Skip to content

Commit

Permalink
ksmbd: override fsids for smb2_query_info()
Browse files Browse the repository at this point in the history
[ Upstream commit f6bd412 ]

Sangsoo reported that a DAC denial error occurred when accessing
files through the ksmbd thread. This patch override fsids for
smb2_query_info().

Reported-by: Sangsoo Lee <[email protected]>
Signed-off-by: Namjae Jeon <[email protected]>
Signed-off-by: Steve French <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
namjaejeon authored and gregkh committed Sep 18, 2024
1 parent 08f9f96 commit 02bc490
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fs/smb/server/smb2pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -5601,6 +5601,11 @@ int smb2_query_info(struct ksmbd_work *work)

ksmbd_debug(SMB, "GOT query info request\n");

if (ksmbd_override_fsids(work)) {
rc = -ENOMEM;
goto err_out;
}

switch (req->InfoType) {
case SMB2_O_INFO_FILE:
ksmbd_debug(SMB, "GOT SMB2_O_INFO_FILE\n");
Expand All @@ -5619,6 +5624,7 @@ int smb2_query_info(struct ksmbd_work *work)
req->InfoType);
rc = -EOPNOTSUPP;
}
ksmbd_revert_fsids(work);

if (!rc) {
rsp->StructureSize = cpu_to_le16(9);
Expand All @@ -5628,6 +5634,7 @@ int smb2_query_info(struct ksmbd_work *work)
le32_to_cpu(rsp->OutputBufferLength));
}

err_out:
if (rc < 0) {
if (rc == -EACCES)
rsp->hdr.Status = STATUS_ACCESS_DENIED;
Expand Down

0 comments on commit 02bc490

Please sign in to comment.