]> www.infradead.org Git - users/jedix/linux-maple.git/commit
cifs: prevent data race in cifs_reconnect_tcon()
authorPaulo Alcantara <pc@manguebit.com>
Tue, 28 Feb 2023 22:01:55 +0000 (19:01 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Apr 2023 10:10:33 +0000 (12:10 +0200)
commita5698f3ebb785aeb73e38497a1f029c9a4b93966
tree4be22637b7ba5f2382f10b320ae028b938430f4a
parentf60cdd319b2c35df32934802ce2bfb6810cac048
cifs: prevent data race in cifs_reconnect_tcon()

[ Upstream commit 1bcd548d935a33c6fc58331405eb1b82fd6150de ]

Make sure to get an up-to-date TCP_Server_Info::nr_targets value prior
to waiting the server to be reconnected in cifs_reconnect_tcon().  It
is set in cifs_tcp_ses_needs_reconnect() and protected by
TCP_Server_Info::srv_lock.

Create a new cifs_wait_for_server_reconnect() helper that can be used
by both SMB2+ and CIFS reconnect code.

Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Stable-dep-of: bc962159e8e3 ("cifs: avoid race conditions with parallel reconnects")
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/cifs/cifsproto.h
fs/cifs/cifssmb.c
fs/cifs/misc.c
fs/cifs/smb2pdu.c