diff options
author | 2021-05-06 11:38:35 +0900 | |
---|---|---|
committer | 2021-05-10 19:15:47 -0500 | |
commit | 79caa9606df1504b3b5104457cbb5d759f0e5fae (patch) | |
tree | 93a4036e470223e5c77ef6db0f00d6dee2a88b58 | |
parent | cifsd: Call smb2_set_err_rsp() in smb2_read/smb2_write error path (diff) | |
download | wireguard-linux-79caa9606df1504b3b5104457cbb5d759f0e5fae.tar.xz wireguard-linux-79caa9606df1504b3b5104457cbb5d759f0e5fae.zip |
cifsd: Handle ksmbd_session_rpc_open() failure in create_smb2_pipe()
Currently, a SMB2 client does not receive an error message if
ksmbd_session_rpc_open() fails when opening a pipe.
Fix this by responding with STATUS_NO_MEMORY or STATUS_INVALID_PARAMETER
depending on the error that occurred.
Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to '')
-rw-r--r-- | fs/cifsd/smb2pdu.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/fs/cifsd/smb2pdu.c b/fs/cifsd/smb2pdu.c index e5aff1ca11e1..fec385318ff3 100644 --- a/fs/cifsd/smb2pdu.c +++ b/fs/cifsd/smb2pdu.c @@ -1917,9 +1917,13 @@ static noinline int create_smb2_pipe(struct ksmbd_work *work) } id = ksmbd_session_rpc_open(work->sess, name); - if (id < 0) + if (id < 0) { ksmbd_err("Unable to open RPC pipe: %d\n", id); + err = id; + goto out; + } + rsp->hdr.Status = STATUS_SUCCESS; rsp->StructureSize = cpu_to_le16(89); rsp->OplockLevel = SMB2_OPLOCK_LEVEL_NONE; rsp->Reserved = 0; @@ -1942,6 +1946,19 @@ static noinline int create_smb2_pipe(struct ksmbd_work *work) return 0; out: + switch (err) { + case -EINVAL: + rsp->hdr.Status = STATUS_INVALID_PARAMETER; + break; + case -ENOSPC: + case -ENOMEM: + rsp->hdr.Status = STATUS_NO_MEMORY; + break; + } + + if (!IS_ERR(name)) + kfree(name); + smb2_set_err_rsp(work); return err; } |