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>
This commit is contained in:
Steve French 2019-09-13 16:47:31 -05:00
parent 96d9f7ed00
commit 2255397c33
1 changed files with 3 additions and 6 deletions

View File

@ -4055,6 +4055,7 @@ static void smb2_decrypt_offload(struct work_struct *work)
goto free_pages; goto free_pages;
} }
dw->server->lstrp = jiffies;
mid = smb2_find_mid(dw->server, dw->buf); mid = smb2_find_mid(dw->server, dw->buf);
if (mid == NULL) if (mid == NULL)
cifs_dbg(FYI, "mid not found\n"); 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, rc = handle_read_data(dw->server, mid, dw->buf,
dw->server->vals->read_rsp_size, dw->server->vals->read_rsp_size,
dw->ppages, dw->npages, dw->len); 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: free_pages:
for (i = dw->npages-1; i >= 0; i--) for (i = dw->npages-1; i >= 0; i--)
put_page(dw->ppages[i]); put_page(dw->ppages[i]);