提交 cd156549 编写于 作者: N NeilBrown 提交者: Linus Torvalds

[PATCH] knfsd: nfsd: oops exporting nonexistent directory

Export a directory that does not exist:
	exportfs -orw,fsid=0,insecure,no_subtree_check client:/home/NFS4

Try to mount from client with nfs4. Mount hangs (I'm not sure why -
that's another issue).

While client is hung, back on server

	mkdir /home/NFS4

The server panics in dput.  I traced the problem back to svc_export_parse()
calling path_release() even though path_lookup() failed (it happens to fill in
the nameidata structure with a negative dentry - so the test after out:
succeeds).

After patching, an recreating the problem, the client mount still takes some
time before finally exiting with a message "couldn't read superblock".

Here is a simple patch to resolve this issue:
Signed-off-by: NFrank Filz <ffilzlnx@us.ibm.com>
Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: NNeil Brown <neilb@suse.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 b5872b0d
...@@ -422,7 +422,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen) ...@@ -422,7 +422,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0) if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0)
goto out; goto out;
err = path_lookup(buf, 0, &nd); err = path_lookup(buf, 0, &nd);
if (err) goto out; if (err) goto out_no_path;
exp.h.flags = 0; exp.h.flags = 0;
exp.ex_client = dom; exp.ex_client = dom;
...@@ -475,6 +475,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen) ...@@ -475,6 +475,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
out: out:
if (nd.dentry) if (nd.dentry)
path_release(&nd); path_release(&nd);
out_no_path:
if (dom) if (dom)
auth_domain_put(dom); auth_domain_put(dom);
kfree(buf); kfree(buf);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册