cifs: fix race in assemble_neg_contexts()
authorPaulo Alcantara <pc@cjr.nz>
Thu, 29 Dec 2022 15:33:56 +0000 (12:33 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Jan 2023 06:24:32 +0000 (07:24 +0100)
commit060266625604b34080fc92c538cc9087f16d8b5f
treefbdae0142d8aa39da8bb3e0a136688178a764385
parent66c8b7b6e4bd159009231f6148476894163bec30
cifs: fix race in assemble_neg_contexts()

[ Upstream commit 775e44d6d86dca400d614cbda5dab4def4951fe7 ]

Serialise access of TCP_Server_Info::hostname in
assemble_neg_contexts() by holding the server's mutex otherwise it
might end up accessing an already-freed hostname pointer from
cifs_reconnect() or cifs_resolve_server().

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Reviewed-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/cifs/smb2pdu.c