summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorSteve French <stfrench@microsoft.com>2019-09-13 16:47:31 -0500
committerSteve French <stfrench@microsoft.com>2019-09-16 11:43:38 -0500
commit2255397c33425b9c43e36ab01479842258dedccb (patch)
tree66bffec700a14240d1f822a21618b9e25fe19118 /fs
parent96d9f7ed00b86104bf03adeffc8980897e9694ab (diff)
smb3: fix potential null dereference in decrypt offload
commit a091c5f67c99 ("smb3: allow parallelizing decryption of reads") had a potential null dereference Reported-by: kbuild test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Suggested-by: Pavel Shilovsky <pshilov@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/smb2ops.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 5776d7b0a97e..eaed18061314 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -4055,6 +4055,7 @@ static void smb2_decrypt_offload(struct work_struct *work)
goto free_pages;
}
+ dw->server->lstrp = jiffies;
mid = smb2_find_mid(dw->server, dw->buf);
if (mid == NULL)
cifs_dbg(FYI, "mid not found\n");
@@ -4063,14 +4064,10 @@ static void smb2_decrypt_offload(struct work_struct *work)
rc = handle_read_data(dw->server, mid, dw->buf,
dw->server->vals->read_rsp_size,
dw->ppages, dw->npages, dw->len);
+ mid->callback(mid);
+ cifs_mid_q_entry_release(mid);
}
- dw->server->lstrp = jiffies;
-
- mid->callback(mid);
-
- cifs_mid_q_entry_release(mid);
-
free_pages:
for (i = dw->npages-1; i >= 0; i--)
put_page(dw->ppages[i]);