]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
cifs: potential buffer overflow in handling symlinks
authorHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Wed, 13 Apr 2022 11:42:51 +0000 (04:42 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 12:42:22 +0000 (14:42 +0200)
commit68e6d1d653ce6e3e926e4f0bb566c83f132be0d3
tree3448e5a00d021a00c45e75f1db4d440eaa5e81a8
parent3d6dc35dcffb72bf1028e531e4f50012d25ad016
cifs: potential buffer overflow in handling symlinks

BugLink: https://bugs.launchpad.net/bugs/1969857
[ 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@oracle.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
fs/cifs/link.c