diff mbox

cifs: fix CIFS_IOC_GET_MNT_INFO oops

Message ID 20170503224113.28791-1-ddiss@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

David Disseldorp May 3, 2017, 10:41 p.m. UTC
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>
---
 fs/cifs/ioctl.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Steve French May 4, 2017, 12:40 a.m. UTC | #1
merged into cifs-2.6.git thx

On Wed, May 3, 2017 at 5:41 PM, David Disseldorp <ddiss@suse.de> wrote:
> 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>
> ---
>  fs/cifs/ioctl.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c
> index 4d598a71cf84..76fb0917dc8c 100644
> --- a/fs/cifs/ioctl.c
> +++ b/fs/cifs/ioctl.c
> @@ -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;
> --
> 2.12.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c
index 4d598a71cf84..76fb0917dc8c 100644
--- a/fs/cifs/ioctl.c
+++ b/fs/cifs/ioctl.c
@@ -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;