Skip to contentSkip to conversation

nfsd: potential ERR_PTR dereference on exp_export() error

PATCH In review Dan Carpenter 2 participants 2 messages Apr 22, 2010

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

PATCH 1/1 nfsd: potential ERR_PTR dereference on exp_export() error

We "goto finish" from several places where "exp" is an ERR_PTR. Also I changed the check for "fsid_key" so that it was consistent with the check I added.

fs/nfsd/export.c +2 -2
index 872a5ef..bfe6f3f 100644
@@ -1071,9 +1071,9 @@ exp_export(struct nfsctl_export *nxp)
 		err = 0;
 finish:
 	kfree(new.ex_pathname);
-	if (exp)
+	if (!IS_ERR_OR_NULL(exp))
 		exp_put(exp);
-	if (fsid_key && !IS_ERR(fsid_key))
+	if (!IS_ERR_OR_NULL(fsid_key))
 		cache_put(&fsid_key->h, &svc_expkey_cache);
 	path_put(&path);
 out_put_clp:
#1 lore raw

Re: [patch] nfsd: potential ERR_PTR dereference on exp_export()

Quoted 3 lines · Dan Carpenter

We "goto finish" from several places where "exp" is an ERR_PTR. Also I changed the check for "fsid_key" so that it was consistent with the check I added.

OK, thanks; applied.

--b.

Quoted 19 lines
fs/nfsd/export.c +2 -2
index 872a5ef..bfe6f3f 100644
@@ -1071,9 +1071,9 @@ exp_export(struct nfsctl_export *nxp)
 		err = 0;
 finish:
 	kfree(new.ex_pathname);
-	if (exp)
+	if (!IS_ERR_OR_NULL(exp))
 		exp_put(exp);
-	if (fsid_key && !IS_ERR(fsid_key))
+	if (!IS_ERR_OR_NULL(fsid_key))
 		cache_put(&fsid_key->h, &svc_expkey_cache);
 	path_put(&path);
 out_put_clp: