cifs: fix CIFS_IOC_GET_MNT_INFO oops
authorDavid Disseldorp <ddiss@suse.de>
Wed, 3 May 2017 22:41:13 +0000 (00:41 +0200)
committerSteve French <smfrench@gmail.com>
Thu, 4 May 2017 00:32:35 +0000 (19:32 -0500)
An open directory may have a NULL private_data pointer prior to readdir.

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

index 4d598a71cf84c29825616ac52d9ac80e4e2dd581..76fb0917dc8c37405b4a481831ee6a695d1e265c 100644 (file)
@@ -209,6 +209,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;