Skip to contentSkip to conversation

[2.5] memleak in fs/nfs/inode.c::nfs_get_sb()

PATCH Oleg Drokin 1 participant 1 message Mar 11, 2003 NFS client

lore
Share & tools
lore
#0 lore raw

Hello!

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

Bye,
Oleg

===== fs/nfs/inode.c 1.72 vs edited =====

fs/nfs/inode.c +1 -0
@@ -1231,6 +1231,7 @@
 
 	if (root->size > sizeof(root->data)) {
 		printk("nfs_get_sb: invalid root filehandle\n");
+		kfree(server);
 		return ERR_PTR(-EINVAL);
 	}
 	/* We now require that the mount process passes the remote address */