mirror of
https://github.com/torvalds/linux.git
synced 2024-12-03 17:41:22 +00:00
ksmbd: fix potential double free on smb2_read_pipe() error path
Fix new smatch warnings:
fs/smb/server/smb2pdu.c:6131 smb2_read_pipe() error: double free of 'rpc_resp'
Fixes: e2b76ab8b5
("ksmbd: add support for read compound")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
414849040f
commit
1903e6d057
@ -6152,12 +6152,12 @@ static noinline int smb2_read_pipe(struct ksmbd_work *work)
|
||||
memcpy(aux_payload_buf, rpc_resp->payload, rpc_resp->payload_sz);
|
||||
|
||||
nbytes = rpc_resp->payload_sz;
|
||||
kvfree(rpc_resp);
|
||||
err = ksmbd_iov_pin_rsp_read(work, (void *)rsp,
|
||||
offsetof(struct smb2_read_rsp, Buffer),
|
||||
aux_payload_buf, nbytes);
|
||||
if (err)
|
||||
goto out;
|
||||
kvfree(rpc_resp);
|
||||
} else {
|
||||
err = ksmbd_iov_pin_rsp(work, (void *)rsp,
|
||||
offsetof(struct smb2_read_rsp, Buffer));
|
||||
|
Loading…
Reference in New Issue
Block a user