ksmbd: validate handle for create or get object id

FSCTL_CREATE_OR_GET_OBJECT_ID returned a dummy successful response without
checking whether the request handle was valid. That let an invalid related
compound handle succeed in smb2.compound.related5, although the client
expected STATUS_FILE_CLOSED.

Look up the file handle before building the object id response and fail
with STATUS_FILE_CLOSED when the handle is invalid or already closed.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
Namjae Jeon 2026-06-21 19:39:59 +09:00 committed by Steve French
parent 3f67e624e5
commit 7d258465ea

View File

@ -8789,6 +8789,15 @@ int smb2_ioctl(struct ksmbd_work *work)
case FSCTL_CREATE_OR_GET_OBJECT_ID:
{
struct file_object_buf_type1_ioctl_rsp *obj_buf;
struct ksmbd_file *fp;
fp = ksmbd_lookup_fd_fast(work, id);
if (!fp) {
ret = -EBADF;
rsp->hdr.Status = STATUS_FILE_CLOSED;
goto out2;
}
ksmbd_fd_put(work, fp);
nbytes = sizeof(struct file_object_buf_type1_ioctl_rsp);
obj_buf = (struct file_object_buf_type1_ioctl_rsp *)