Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: David Disseldorp <ddiss-l3A5Bk7waGM@public.gmane.org>
To: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: David Disseldorp <ddiss-l3A5Bk7waGM@public.gmane.org>
Subject: [PATCH 2/2] cifs: fix leak in FSCTL_ENUM_SNAPS response handling
Date: Wed,  3 May 2017 17:39:09 +0200	[thread overview]
Message-ID: <20170503153909.5783-3-ddiss@suse.de> (raw)
In-Reply-To: <20170503153909.5783-1-ddiss-l3A5Bk7waGM@public.gmane.org>

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 <ddiss-l3A5Bk7waGM@public.gmane.org>
---
 fs/cifs/smb2ops.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 152e37f2ad92..c58691834eb2 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -942,6 +942,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;
 		}
 
-- 
2.12.0

  parent reply	other threads:[~2017-05-03 15:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-03 15:39 [PATCH 0/2] cifs: CIFS_ENUMERATE_SNAPSHOTS fixes David Disseldorp
     [not found] ` <20170503153909.5783-1-ddiss-l3A5Bk7waGM@public.gmane.org>
2017-05-03 15:39   ` [PATCH 1/2] cifs: fix CIFS_ENUMERATE_SNAPSHOTS oops David Disseldorp
2017-05-03 15:39   ` David Disseldorp [this message]
2017-05-03 16:18   ` [PATCH 0/2] cifs: CIFS_ENUMERATE_SNAPSHOTS fixes Steve French
2017-05-05 13:47   ` David Disseldorp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170503153909.5783-3-ddiss@suse.de \
    --to=ddiss-l3a5bk7wagm@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox