mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
ksmbd: free aux buffer if ksmbd_iov_pin_rsp_read fails
commit 108a020c64434fed4b69762879d78cd24088b4c7 upstream.
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: e2b76ab8b5 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
9f6087851e
commit
7505a0ce08
@@ -6171,8 +6171,10 @@ static noinline int smb2_read_pipe(struct ksmbd_work *work)
|
||||
err = ksmbd_iov_pin_rsp_read(work, (void *)rsp,
|
||||
offsetof(struct smb2_read_rsp, Buffer),
|
||||
aux_payload_buf, nbytes);
|
||||
if (err)
|
||||
if (err) {
|
||||
kvfree(aux_payload_buf);
|
||||
goto out;
|
||||
}
|
||||
kvfree(rpc_resp);
|
||||
} else {
|
||||
err = ksmbd_iov_pin_rsp(work, (void *)rsp,
|
||||
@@ -6382,8 +6384,10 @@ int smb2_read(struct ksmbd_work *work)
|
||||
err = ksmbd_iov_pin_rsp_read(work, (void *)rsp,
|
||||
offsetof(struct smb2_read_rsp, Buffer),
|
||||
aux_payload_buf, nbytes);
|
||||
if (err)
|
||||
if (err) {
|
||||
kvfree(aux_payload_buf);
|
||||
goto out;
|
||||
}
|
||||
ksmbd_fd_put(work, fp);
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user