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 1/2] cifs: fix CIFS_ENUMERATE_SNAPSHOTS oops
Date: Wed,  3 May 2017 17:39:08 +0200	[thread overview]
Message-ID: <20170503153909.5783-2-ddiss@suse.de> (raw)
In-Reply-To: <20170503153909.5783-1-ddiss-l3A5Bk7waGM@public.gmane.org>

As with 618763958b22, an open directory may have a NULL private_data
pointer prior to readdir. CIFS_ENUMERATE_SNAPSHOTS must check for this
before dereference.

Fixes: 834170c85978 ("Enable previous version support")
Signed-off-by: David Disseldorp <ddiss-l3A5Bk7waGM@public.gmane.org>
---
 fs/cifs/ioctl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c
index 7f4bba574930..4d598a71cf84 100644
--- a/fs/cifs/ioctl.c
+++ b/fs/cifs/ioctl.c
@@ -213,6 +213,8 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
 			rc = smb_mnt_get_fsinfo(xid, tcon, (void __user *)arg);
 			break;
 		case CIFS_ENUMERATE_SNAPSHOTS:
+			if (pSMBFile == NULL)
+				break;
 			if (arg == 0) {
 				rc = -EINVAL;
 				goto cifs_ioc_exit;
-- 
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   ` David Disseldorp [this message]
2017-05-03 15:39   ` [PATCH 2/2] cifs: fix leak in FSCTL_ENUM_SNAPS response handling David Disseldorp
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-2-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