From: David Disseldorp Date: Wed, 3 May 2017 15:39:09 +0000 (+0200) Subject: cifs: fix leak in FSCTL_ENUM_SNAPS response handling X-Git-Tag: archive/raspbian/4.9.30-2+deb9u2+rpi1~6^2~184 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=449a74439d1525b43357be9da42b84fcdbd6b5a9;p=linux-4.9.git cifs: fix leak in FSCTL_ENUM_SNAPS response handling commit 0e5c795592930d51fd30d53a2e7b73cba022a29b upstream. The server may respond with success, and an output buffer less than sizeof(struct smb_snapshot_array) in length. Do not leak the output buffer in this case. Fixes: 834170c85978 ("Enable previous version support") Signed-off-by: David Disseldorp Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 007abf7195af..36334fe3266c 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -924,6 +924,7 @@ smb3_enum_snapshots(const unsigned int xid, struct cifs_tcon *tcon, } if (snapshot_in.snapshot_array_size < sizeof(struct smb_snapshot_array)) { rc = -ERANGE; + kfree(retbuf); return rc; }