Skip to contentSkip to conversation

[2.5] nfsd/export.c memleak.

PATCH Oleg Drokin 2 participants 2 messages Mar 11, 2003 NFS server

lore
Share & tools
lore
#0 lore raw

Hello!

There is trivial memleak on error exit path in nfsd. See the patch below.
Found with help of smatch + enhanced unfree script.

Bye,
Oleg

===== fs/nfsd/export.c 1.71 vs edited =====

fs/nfsd/export.c +4 -1
@@ -294,7 +294,10 @@
 
 	/* client */
 	len = qword_get(&mesg, buf, PAGE_SIZE);
-	if (len <= 0) return -EINVAL;
+	if (len <= 0) {
+		err = -EINVAL;
+		goto out;
+	}
 	err = -ENOENT;
 	dom = auth_domain_find(buf);
 	if (!dom)
#1 lore raw
Quoted 5 lines · On Tuesday March 11, [email protected] wrote:

Hello!

There is trivial memleak on error exit path in nfsd. See the patch below.
Found with help of smatch + enhanced unfree script.

Thanks to all threee of you?
However in keeping with the style of surrounding code I will make it:

===== fs/nfsd/export.c 1.71 vs edited =====

fs/nfsd/export.c +4 -1
@@ -294,7 +294,10 @@
 
 	/* client */
 	len = qword_get(&mesg, buf, PAGE_SIZE);
-	if (len <= 0) return -EINVAL;
+	err = -EINVAL;
+	if (len <= 0)
+		goto out;
+	
 	err = -ENOENT;
 	dom = auth_domain_find(buf);
 	if (!dom)

NeilBrown