Skip to contentSkip to conversation

knfsd : Fix the BUG of exp_get_by_name when used to get an export entry which not be exported

PATCH New Wei Yongjun 1 participant 1 message Mar 8, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 knfsd : Fix the BUG of exp_get_by_name when used to get an export entry which not be exported

If exp_get_by_name() is used to get an export entry which not be exported, and if export entry is added by exportfs command but not export by kernel because of EINVAL etc., this function will add a bad entry to svc_export_cache after call svc_export_lookup(), this let request be revisit.

Normally, if I export /dev/null as root, mount ntf4 command will frozen. Test by following command:
#exportfs -i -o fsid=0,no_root_squash,insecure,rw,async *:/dev/null #mount -t nfs4 127.0.0.1:/ /tmp
mount from other client also frozen, and some client may get kernel panic.

Flollowing is my patch:

nfsd/export.c renamed from nfsd/export.c.orig +7 -0
@@ -786,6 +786,13 @@ exp_get_by_name(svc_client *clp, struct 
 	key.ex_dentry = dentry;
 
 	exp = svc_export_lookup(&key);
+
+	/* does not known flags, so do check after lookup */
+	if(exp != NULL && check_export(exp->ex_dentry->d_inode, exp->ex_flags)) {
+		exp_put(exp);
+		exp = NULL;
+	}
+
 	if (exp != NULL)  {
 		int err;
 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs