cifs: fix memory leak in smb2_copychunk_range
authorRonnie Sahlberg <lsahlber@redhat.com>
Tue, 18 May 2021 22:40:11 +0000 (08:40 +1000)
committerSteve French <stfrench@microsoft.com>
Thu, 20 May 2021 00:19:20 +0000 (19:19 -0500)
commitd201d7631ca170b038e7f8921120d05eec70d7c5
tree5f0b595a798b4d81ca201ca7a2c148730c58b0c5
parentc0d46717b95735b0eacfddbcca9df37a49de9c7a
cifs: fix memory leak in smb2_copychunk_range

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: 9bf0c9cd4314 ("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>
fs/cifs/smb2ops.c