]> git.baikalelectronics.ru Git - kernel.git/commit
CIFS: Do not reconnect TCP session in add_credits()
authorPavel Shilovsky <pshilov@microsoft.com>
Sat, 19 Jan 2019 01:25:36 +0000 (17:25 -0800)
committerSteve French <stfrench@microsoft.com>
Thu, 24 Jan 2019 20:50:57 +0000 (14:50 -0600)
commit90dad3d5477a3aa8f52ed7e2f5027c011858a9ab
tree063f809b38252b893f71bcc101d115048b049b91
parent940399809999f9ff7d15f23bd63fc65f815f0bfc
CIFS: Do not reconnect TCP session in add_credits()

When executing add_credits() we currently call cifs_reconnect()
if the number of credits is zero and there are no requests in
flight. In this case we may call cifs_reconnect() recursively
twice and cause memory corruption given the following sequence
of functions:

mid1.callback() -> add_credits() -> cifs_reconnect() ->
-> mid2.callback() -> add_credits() -> cifs_reconnect().

Fix this by avoiding to call cifs_reconnect() in add_credits()
and checking for zero credits in the demultiplex thread.

Cc: <stable@vger.kernel.org>
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/connect.c
fs/cifs/smb2ops.c