kernel_samsung_a53x/fs/cifs
Pali Rohár 2826454a9d cifs: Fix buffer overflow when parsing NFS reparse points
commit e2a8910af01653c1c268984855629d71fb81f404 upstream.

ReparseDataLength is sum of the InodeType size and DataBuffer size.
So to get DataBuffer size it is needed to subtract InodeType's size from
ReparseDataLength.

Function cifs_strndup_from_utf16() is currentlly accessing buf->DataBuffer
at position after the end of the buffer because it does not subtract
InodeType size from the length. Fix this problem and correctly subtract
variable len.

Member InodeType is present only when reparse buffer is large enough. Check
for ReparseDataLength before accessing InodeType to prevent another invalid
memory access.

Major and minor rdev values are present also only when reparse buffer is
large enough. Check for reparse buffer size before calling reparse_mkdev().

Fixes: d5ecebc4900d ("smb3: Allow query of symlinks stored as reparse points")
Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
[use variable name symlink_buf, the other buf->InodeType accesses are
not used in current version so skip]
Signed-off-by: Mahmoud Adam <mngyadam@amazon.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-12-17 13:23:58 +01:00
..
asn1.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cache.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifs_debug.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifs_debug.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifs_dfs_ref.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifs_fs_sb.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifs_ioctl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifs_spnego.c cifs: spnego: add ';' in HOST_KEY_LEN 2024-11-18 11:43:20 +01:00
cifs_spnego.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifs_unicode.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifs_unicode.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifs_uniupr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifsacl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifsacl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifsencrypt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifsfs.c cifs: Fix non-availability of dedup breaking generic/304 2024-11-18 12:11:47 +01:00
cifsfs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifsglob.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifspdu.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifsproto.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifsroot.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifssmb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
connect.c exit: Rename module_put_and_exit to module_put_and_kthread_exit 2024-11-19 12:27:50 +01:00
dfs_cache.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dfs_cache.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dir.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dns_resolve.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dns_resolve.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
export.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
file.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fs_context.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fs_context.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fscache.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fscache.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inode.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ioctl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
link.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
misc.c smb: client: fix OOB in smbCalcSize() 2024-11-18 12:12:02 +01:00
netmisc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nterr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nterr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ntlmssp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
readdir.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rfc1002pdu.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sess.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smb1ops.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smb2file.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smb2glob.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smb2inode.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smb2maperror.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smb2misc.c smb3: Replace smb2pdu 1-element arrays with flex-arrays 2024-11-18 12:12:59 +01:00
smb2ops.c cifs: Fix buffer overflow when parsing NFS reparse points 2024-12-17 13:23:58 +01:00
smb2pdu.c smb: client: fix OOBs when building SMB2_IOCTL request 2024-11-23 23:21:59 +01:00
smb2pdu.h smb3: Replace smb2pdu 1-element arrays with flex-arrays 2024-11-18 12:12:59 +01:00
smb2proto.h smb: client: fix potential OOBs in smb2_parse_contexts() 2024-11-18 22:25:31 +01:00
smb2status.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smb2transport.c smb: client: fix deadlock in smb2_find_smb_tcon() 2024-11-19 14:19:30 +01:00
smbdirect.c smbdirect: missing rc checks while waiting for rdma events 2024-11-18 10:58:32 +01:00
smbdirect.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smbencrypt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smberr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smbfsctl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
trace.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
trace.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
transport.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
winucase.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xattr.c smb3: fix caching of ctime on setxattr 2024-11-18 12:11:13 +01:00