CIFS: Fix oops while mounting with prefixpath
authorPavel Shilovsky <piastryyy@gmail.com>
Mon, 25 Jul 2011 13:59:10 +0000 (17:59 +0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 5 Aug 2011 04:58:33 +0000 (21:58 -0700)
commite181f90e497752b371229fd8d46f1f7cc4d3e3ec
tree33baef99d638a0c00754201d6d7efea824e666aa
parent79db0af8b41b543e1fa684a4eb5949663aa52ae4
CIFS: Fix oops while mounting with prefixpath

commit f5bc1e755d23d022bf948904386337fc3e5e29a8 upstream.

commit fec11dd9a0109fe52fd631e5c510778d6cbff6cc caused
a regression when we have already mounted //server/share/a
and want to mount //server/share/a/b.

The problem is that lookup_one_len calls __lookup_hash
with nd pointer as NULL. Then __lookup_hash calls
do_revalidate in the case when dentry exists and we end
up with NULL pointer deference in cifs_d_revalidate:

if (nd->flags & LOOKUP_RCU)
return -ECHILD;

Fix this by checking nd for NULL.

Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com>
Reviewed-by: Shirish Pargaonkar <shirishp@us.ibm.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/cifs/dir.c