diff mbox

[1/2] cifs: fix CIFS_ENUMERATE_SNAPSHOTS oops

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

Commit Message

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

Patch

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;