Patch "cifs: potential buffer overflow in handling symlinks" has been added to the 4.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    cifs: potential buffer overflow in handling symlinks

to the 4.9-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-potential-buffer-overflow-in-handling-symlinks.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit dc21113ef389e71b3188940538ac7f62a761a4df
Author: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>
Date:   Wed Apr 13 04:42:51 2022 -0700

    cifs: potential buffer overflow in handling symlinks
    
    [ Upstream commit 64c4a37ac04eeb43c42d272f6e6c8c12bfcf4304 ]
    
    Smatch printed a warning:
            arch/x86/crypto/poly1305_glue.c:198 poly1305_update_arch() error:
            __memcpy() 'dctx->buf' too small (16 vs u32max)
    
    It's caused because Smatch marks 'link_len' as untrusted since it comes
    from sscanf(). Add a check to ensure that 'link_len' is not larger than
    the size of the 'link_str' buffer.
    
    Fixes: c69c1b6eaea1 ("cifs: implement CIFSParseMFSymlink()")
    Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>
    Reviewed-by: Ronnie Sahlberg <lsahlber@xxxxxxxxxx>
    Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index 38d26cbcad07..0c49e2aa7ea4 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -119,6 +119,9 @@ parse_mf_symlink(const u8 *buf, unsigned int buf_len, unsigned int *_link_len,
 	if (rc != 1)
 		return -EINVAL;
 
+	if (link_len > CIFS_MF_SYMLINK_LINK_MAXLEN)
+		return -EINVAL;
+
 	rc = symlink_hash(link_len, link_str, md5_hash);
 	if (rc) {
 		cifs_dbg(FYI, "%s: MD5 hash failure: %d\n", __func__, rc);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux