Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80975d21 authored by Jeff Layton's avatar Jeff Layton Committed by Steve French
Browse files

cifs: cope with negative dentries in cifs_get_root

The loop around lookup_one_len doesn't handle the case where it might
return a negative dentry, which can cause an oops on the next pass
through the loop. Check for that and break out of the loop with an
error of -ENOENT if there is one.

Fixes the panic reported here:

    https://bugzilla.redhat.com/show_bug.cgi?id=727927



Reported-by: default avatarTR Bentley <home@trarbentley.net>
Reported-by: default avatarIain Arnell <iarnell@gmail.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Cc: stable@kernel.org
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent f9e8c450
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -563,6 +563,10 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
		mutex_unlock(&dir->i_mutex);
		mutex_unlock(&dir->i_mutex);
		dput(dentry);
		dput(dentry);
		dentry = child;
		dentry = child;
		if (!dentry->d_inode) {
			dput(dentry);
			dentry = ERR_PTR(-ENOENT);
		}
	} while (!IS_ERR(dentry));
	} while (!IS_ERR(dentry));
	_FreeXid(xid);
	_FreeXid(xid);
	kfree(full_path);
	kfree(full_path);