From 2255397c33425b9c43e36ab01479842258dedccb Mon Sep 17 00:00:00 2001 From: Steve French Date: Fri, 13 Sep 2019 16:47:31 -0500 Subject: [PATCH] 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 Reported-by: Dan Carpenter Suggested-by: Pavel Shilovsky Signed-off-by: Steve French --- fs/cifs/smb2ops.c | 9 +++------ 1 file 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]);