]> git.baikalelectronics.ru Git - kernel.git/commit
ksmbd: use LOOKUP_BENEATH to prevent the out of share access
authorHyunchul Lee <hyc.lee@gmail.com>
Fri, 24 Sep 2021 15:06:16 +0000 (00:06 +0900)
committerSteve French <stfrench@microsoft.com>
Sat, 25 Sep 2021 02:25:23 +0000 (21:25 -0500)
commit74ebf2bc881f7669510e6b1b2a89ea41d9d23290
treef243e175b7a357f16b0b8494268c2b1e82996d21
parent0cfbe446f41fa1e14fe56fca8a683dcf1f0538b6
ksmbd: use LOOKUP_BENEATH to prevent the out of share access

instead of removing '..' in a given path, call
kern_path with LOOKUP_BENEATH flag to prevent
the out of share access.

ran various test on this:
smb2-cat-async smb://127.0.0.1/homes/../out_of_share
smb2-cat-async smb://127.0.0.1/homes/foo/../../out_of_share
smbclient //127.0.0.1/homes -c "mkdir ../foo2"
smbclient //127.0.0.1/homes -c "rename bar ../bar"

Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Cc: Ralph Boehme <slow@samba.org>
Tested-by: Steve French <smfrench@gmail.com>
Tested-by: Namjae Jeon <linkinjeon@kernel.org>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/ksmbd/misc.c
fs/ksmbd/misc.h
fs/ksmbd/smb2pdu.c
fs/ksmbd/vfs.c
fs/ksmbd/vfs.h