CIFS: Fix oops while mounting with prefixpath
Subsystems (2)
PATCH 1/1 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.
--- fs/cifs/dir.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/cifs/dir.c +1 -1
@@ -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) {
Signature · 1 line
1.7.1
makes sense. Doesn't it need to be added to stable.
Quoted 36 lines · Pavel Shilovsky
commit
fec11dd9a0109fe52fd631e5c510778d6cbff6cccaused a regression when we have already mounted //server/share/a and want to mount //server/share/a/b.The problem is that
lookup_one_lencalls__lookup_hashwith nd pointer as NULL. Then__lookup_hashcallsdo_revalidatein the case when dentry exists and we end up with NULL pointer deference incifs_d_revalidate:if (
nd->flags&LOOKUP_RCU)
return-ECHILD;Fix this by checking nd for NULL.
Signed-off-by Pavel Shilovsky <[email protected]>---
fs/cifs/dir.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)fs/cifs/dir.c +0
-0@@ -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) {
--
1.7.1
Signature · 3 lines
Thanks, Steve
Merged. Also note patch 34286d6662308d82aed891852d04c7c3a2649b16 introduced the deref before null check.
34286d66
Quoted 36 lines · Pavel Shilovsky
commit
fec11dd9a0109fe52fd631e5c510778d6cbff6cccaused a regression when we have already mounted //server/share/a and want to mount //server/share/a/b.The problem is that
lookup_one_lencalls__lookup_hashwith nd pointer as NULL. Then__lookup_hashcallsdo_revalidatein the case when dentry exists and we end up with NULL pointer deference incifs_d_revalidate:if (
nd->flags&LOOKUP_RCU)
return-ECHILD;Fix this by checking nd for NULL.
Signed-off-by Pavel Shilovsky <[email protected]>---
fs/cifs/dir.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)fs/cifs/dir.c +0
-0@@ -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) {
--
1.7.1
Signature · 3 lines
Thanks, Steve