CIFS: Fix a possible memory corruption during reconnect
authorPavel Shilovsky <pshilov@microsoft.com>
Fri, 4 Nov 2016 18:50:31 +0000 (11:50 -0700)
committerWilly Tarreau <w@1wt.eu>
Tue, 20 Jun 2017 06:02:59 +0000 (08:02 +0200)
commite008a962311a875a828cbae54b43285858aaa6c8
tree8c963238e47f70cbd02f50d324eeb77af088f8d6
parentd45256ff3ed6edf2d61caf25b37643eed9001908
CIFS: Fix a possible memory corruption during reconnect

commit 53e0e11efe9289535b060a51d4cf37c25e0d0f2b upstream.

We can not unlock/lock cifs_tcp_ses_lock while walking through ses
and tcon lists because it can corrupt list iterator pointers and
a tcon structure can be released if we don't hold an extra reference.
Fix it by moving a reconnect process to a separate delayed work
and acquiring a reference to every tcon that needs to be reconnected.
Also do not send an echo request on newly established connections.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Willy Tarreau <w@1wt.eu>
fs/cifs/cifsglob.h
fs/cifs/cifsproto.h
fs/cifs/connect.c
fs/cifs/smb2pdu.c
fs/cifs/smb2proto.h