From c5626a867db52bec3caf03bc2a7fa5a83a2e1906 Mon Sep 17 00:00:00 2001 From: Namjae Jeon Date: Mon, 14 Nov 2022 20:53:06 +0800 Subject: [PATCH] ksmbd: fix SMB 3.11 posix extension mount failure mainline inclusion from mainline-5.17-rc4 commit 9ca8581e79e51c57e60b3b8e3b89d816448f49fe category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I60T7G CVE: NA Reference: https://git.kernel.org/torvalds/linux/c/9ca8581e79e5 ------------------------------- cifs client set 4 to DataLength of create_posix context, which mean Mode variable of create_posix context is only available. So buffer validation of ksmbd should check only the size of Mode except for the size of Reserved variable. Fixes: 8f77150c15f8 ("ksmbd: add buffer validation for SMB2_CREATE_CONTEXT") Cc: stable@vger.kernel.org # v5.15+ Reported-by: Steve French Tested-by: Steve French Signed-off-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Jason Yan Signed-off-by: Zhong Jinghua --- fs/ksmbd/smb2pdu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c index 7bf9f85cd021..98f2805bf092 100644 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -2671,7 +2671,7 @@ int smb2_open(struct ksmbd_work *work) (struct create_posix *)context; if (le16_to_cpu(context->DataOffset) + le32_to_cpu(context->DataLength) < - sizeof(struct create_posix)) { + sizeof(struct create_posix) - 4) { rc = -EINVAL; goto err_out1; } -- GitLab