summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorNamjae Jeon <linkinjeon@kernel.org>2025-02-21 14:16:23 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-03-13 13:07:40 +0100
commit1e8833c03a38e1d5d5df6484e3f670a2fd38fb76 (patch)
tree8069f89726b7600d672a1c17ba7c9013336c4105 /fs
parentde19c9dfb68f7c5791accc89047f92e952f57996 (diff)
downloadlinux-1e8833c03a38e1d5d5df6484e3f670a2fd38fb76.tar.gz
linux-1e8833c03a38e1d5d5df6484e3f670a2fd38fb76.tar.bz2
linux-1e8833c03a38e1d5d5df6484e3f670a2fd38fb76.zip
ksmbd: fix type confusion via race condition when using ipc_msg_send_request
commit e2ff19f0b7a30e03516e6eb73b948e27a55bc9d2 upstream. req->handle is allocated using ksmbd_acquire_id(&ipc_ida), based on ida_alloc. req->handle from ksmbd_ipc_login_request and FSCTL_PIPE_TRANSCEIVE ioctl can be same and it could lead to type confusion between messages, resulting in access to unexpected parts of memory after an incorrect delivery. ksmbd check type of ipc response but missing add continue to check next ipc reponse. Cc: stable@vger.kernel.org Reported-by: Norbert Szetei <norbert@doyensec.com> Tested-by: Norbert Szetei <norbert@doyensec.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/smb/server/transport_ipc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/smb/server/transport_ipc.c b/fs/smb/server/transport_ipc.c
index e9aa92d02789..22a3646b909b 100644
--- a/fs/smb/server/transport_ipc.c
+++ b/fs/smb/server/transport_ipc.c
@@ -281,6 +281,7 @@ static int handle_response(int type, void *payload, size_t sz)
if (entry->type + 1 != type) {
pr_err("Waiting for IPC type %d, got %d. Ignore.\n",
entry->type + 1, type);
+ continue;
}
entry->response = kvzalloc(sz, KSMBD_DEFAULT_GFP);