Skip to content

Commit 108a020

Browse files
pchelkin91Steve French
authored andcommitted
ksmbd: free aux buffer if ksmbd_iov_pin_rsp_read fails
ksmbd_iov_pin_rsp_read() doesn't free the provided aux buffer if it fails. Seems to be the caller's responsibility to clear the buffer in error case. Found by Linux Verification Center (linuxtesting.org). Fixes: e2b76ab ("ksmbd: add support for read compound") Cc: stable@vger.kernel.org Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent a12bc36 commit 108a020

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fs/smb/server/smb2pdu.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6173,8 +6173,10 @@ static noinline int smb2_read_pipe(struct ksmbd_work *work)
61736173
err = ksmbd_iov_pin_rsp_read(work, (void *)rsp,
61746174
offsetof(struct smb2_read_rsp, Buffer),
61756175
aux_payload_buf, nbytes);
6176-
if (err)
6176+
if (err) {
6177+
kvfree(aux_payload_buf);
61776178
goto out;
6179+
}
61786180
kvfree(rpc_resp);
61796181
} else {
61806182
err = ksmbd_iov_pin_rsp(work, (void *)rsp,
@@ -6384,8 +6386,10 @@ int smb2_read(struct ksmbd_work *work)
63846386
err = ksmbd_iov_pin_rsp_read(work, (void *)rsp,
63856387
offsetof(struct smb2_read_rsp, Buffer),
63866388
aux_payload_buf, nbytes);
6387-
if (err)
6389+
if (err) {
6390+
kvfree(aux_payload_buf);
63886391
goto out;
6392+
}
63896393
ksmbd_fd_put(work, fp);
63906394
return 0;
63916395

0 commit comments

Comments
 (0)