From: Pavel Shilovsky Date: Mon, 25 Jul 2011 13:59:10 +0000 (+0400) Subject: CIFS: Fix oops while mounting with prefixpath X-Git-Tag: v3.1-rc1~246^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ca30d40a91fb9b9871e61d5dea2c1a895906a15;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git CIFS: Fix oops while mounting with prefixpath 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 Signed-off-by: Al Viro --- diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 14d602f..499f27f 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -641,7 +641,7 @@ lookup_out: static int cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd) { - if (nd->flags & LOOKUP_RCU) + if (nd && (nd->flags & LOOKUP_RCU)) return -ECHILD; if (direntry->d_inode) {