smb/client: avoid dereferencing rdata=NULL in smb2_new_read_req()

commit c724b2ab6a upstream.

This happens when called from SMB2_read() while using rdma
and reaching the rdma_readwrite_threshold.

Cc: stable@vger.kernel.org
Fixes: a6559cc1d3 ("cifs: split out smb3_use_rdma_offload() helper")
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Stefan Metzmacher 2024-08-21 17:18:23 +02:00 committed by Greg Kroah-Hartman
parent 4401326066
commit a01859dd6a

View File

@ -4431,7 +4431,7 @@ smb2_new_read_req(void **buf, unsigned int *total_len,
* If we want to do a RDMA write, fill in and append * If we want to do a RDMA write, fill in and append
* smbd_buffer_descriptor_v1 to the end of read request * smbd_buffer_descriptor_v1 to the end of read request
*/ */
if (smb3_use_rdma_offload(io_parms)) { if (rdata && smb3_use_rdma_offload(io_parms)) {
struct smbd_buffer_descriptor_v1 *v1; struct smbd_buffer_descriptor_v1 *v1;
bool need_invalidate = server->dialect == SMB30_PROT_ID; bool need_invalidate = server->dialect == SMB30_PROT_ID;