mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 14:42:37 +02:00
cifs: fix memory leak in smb2_copychunk_range
commitd201d7631cupstream. When using smb2_copychunk_range() for large ranges we will run through several iterations of a loop calling SMB2_ioctl() but never actually free the returned buffer except for the final iteration. This leads to memory leaks everytime a large copychunk is requested. Fixes:9bf0c9cd43("CIFS: Fix SMB2/SMB3 Copy offload support (refcopy) for large files") Cc: <stable@vger.kernel.org> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
56001dda03
commit
42d35af922
|
|
@ -1764,6 +1764,8 @@ smb2_copychunk_range(const unsigned int xid,
|
||||||
cpu_to_le32(min_t(u32, len, tcon->max_bytes_chunk));
|
cpu_to_le32(min_t(u32, len, tcon->max_bytes_chunk));
|
||||||
|
|
||||||
/* Request server copy to target from src identified by key */
|
/* Request server copy to target from src identified by key */
|
||||||
|
kfree(retbuf);
|
||||||
|
retbuf = NULL;
|
||||||
rc = SMB2_ioctl(xid, tcon, trgtfile->fid.persistent_fid,
|
rc = SMB2_ioctl(xid, tcon, trgtfile->fid.persistent_fid,
|
||||||
trgtfile->fid.volatile_fid, FSCTL_SRV_COPYCHUNK_WRITE,
|
trgtfile->fid.volatile_fid, FSCTL_SRV_COPYCHUNK_WRITE,
|
||||||
true /* is_fsctl */, (char *)pcchunk,
|
true /* is_fsctl */, (char *)pcchunk,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user