Patch "cifs: fix NULL deref in SMB2_read" has been added to the 4.14-stable tree
This is a note to let you know that I've just added the patch titled
cifs: fix NULL deref in SMB2_read
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
cifs-fix-null-deref-in-smb2_read.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
a821df3f1af72aa6a0d573eea94a7dd2613e9f4eMon Sep 17 00:00:00 2001
From: Ronnie Sahlberg <[email protected]>
Date: Tue, 21 Nov 2017 09:36:33 +1100
Subject: cifs: fix NULL deref in SMB2_read
From: Ronnie Sahlberg <[email protected]>
commit a821df3f1af72aa6a0d573eea94a7dd2613e9f4e upstream.
--- fs/cifs/smb2pdu.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
fs/cifs/smb2pdu.c +15 -15
@@ -2678,27 +2678,27 @@ SMB2_read(const unsigned int xid, structcifs_small_buf_release (req); rsp = (struct smb2_read_rsp *)rsp_iov.iov_base; - shdr =get_sync_hdr (rsp); -if (shdr->Status ==STATUS_END_OF_FILE ) { +if (rc) { +if (rc != -ENODATA ) { +cifs_stats_fail_inc (io_parms->tcon,SMB2_READ_HE ); +cifs_dbg (VFS ,"Send error in read = %d\n" , rc); + }free_rsp_buf (resp_buftype, rsp_iov.iov_base); -return 0 ; +return rc == -ENODATA ?0 : rc; } -if (rc) { -cifs_stats_fail_inc (io_parms->tcon,SMB2_READ_HE ); -cifs_dbg (VFS ,"Send error in read = %d\n" , rc); - }else { - *nbytes =le32_to_cpu (rsp->DataLength); -if ((*nbytes >CIFS_MAX_MSGSIZE ) || - (*nbytes > io_parms->length)) { -cifs_dbg (FYI ,"bad length %d for count %d\n" , - *nbytes, io_parms->length); - rc = -EIO ; - *nbytes =0 ; - } + *nbytes =le32_to_cpu (rsp->DataLength); +if ((*nbytes >CIFS_MAX_MSGSIZE ) || + (*nbytes > io_parms->length)) { +cifs_dbg (FYI ,"bad length %d for count %d\n" , + *nbytes, io_parms->length); + rc = -EIO ; + *nbytes =0 ; } + shdr =get_sync_hdr (rsp); +if (*buf) {memcpy (*buf, (char *)shdr + rsp->DataOffset, *nbytes);free_rsp_buf (resp_buftype, rsp_iov.iov_base);
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/cifs-fix-null-deref-in-smb2_read.patch