]> git.baikalelectronics.ru Git - kernel.git/commit
CIFS: Fix NULL pointer dereference in mid callback
authorPavel Shilovsky <pshilov@microsoft.com>
Thu, 21 Nov 2019 19:35:13 +0000 (11:35 -0800)
committerSteve French <stfrench@microsoft.com>
Mon, 25 Nov 2019 07:14:53 +0000 (01:14 -0600)
commit441c1054a65b37d0f471dd0503c0abb93973c4a9
tree5fcf70bf32a87191bd6c4f31a59544b6b7741d22
parent7382e6846c478030527792a4156ea538ab353eb5
CIFS: Fix NULL pointer dereference in mid callback

There is a race between a system call processing thread
and the demultiplex thread when mid->resp_buf becomes NULL
and later is being accessed to get credits. It happens when
the 1st thread wakes up before a mid callback is called in
the 2nd one but the mid state has already been set to
MID_RESPONSE_RECEIVED. This causes NULL pointer dereference
in mid callback.

Fix this by saving credits from the response before we
update the mid state and then use this value in the mid
callback rather then accessing a response buffer.

Cc: Stable <stable@vger.kernel.org>
Fixes: 730980ced8db935c ("CIFS: Move credit processing to mid callbacks for SMB3")
Tested-by: Frank Sorenson <sorenson@redhat.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/cifsglob.h
fs/cifs/connect.c
fs/cifs/smb2ops.c