cifs: fix CIFS_IOC_GET_MNT_INFO oops
authorDavid Disseldorp <ddiss@suse.de>
Wed, 3 May 2017 22:41:13 +0000 (00:41 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 May 2017 12:27:01 +0000 (14:27 +0200)
commit d8a6e505d6bba2250852fbc1c1c86fe68aaf9af3 upstream.

An open directory may have a NULL private_data pointer prior to readdir.

Fixes: 0de1f4c6f6c0 ("Add way to query server fs info for smb3")
Signed-off-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/ioctl.c

index 35cf990f87d3245d01662cc550f4f3b43cc2dc58..a8f5b31636dc835a94a03f768101ec20e4c505a9 100644 (file)
@@ -272,6 +272,8 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
                                rc = -EOPNOTSUPP;
                        break;
                case CIFS_IOC_GET_MNT_INFO:
+                       if (pSMBFile == NULL)
+                               break;
                        tcon = tlink_tcon(pSMBFile->tlink);
                        rc = smb_mnt_get_fsinfo(xid, tcon, (void __user *)arg);
                        break;