Whamcloud - gitweb
b=23293 Fix memory leak in lprocfs_fops_read().
authorRicardo M. Correia <ricardo.correia@oracle.com>
Fri, 16 Jul 2010 16:04:06 +0000 (20:04 +0400)
committerMikhail Pershin <tappro@sun.com>
Tue, 20 Jul 2010 07:37:21 +0000 (11:37 +0400)
i=andreas.dilger
i=emoly.liu

It was possible for lprocfs_fops_read() to leak a page in some circumstances.
This small patch should fix it.

lustre/obdclass/lprocfs_status.c

index 1a83697..a253894 100644 (file)
@@ -185,8 +185,10 @@ static ssize_t lprocfs_fops_read(struct file *f, char __user *buf,
         if (page == NULL)
                 return -ENOMEM;
 
         if (page == NULL)
                 return -ENOMEM;
 
-        if (LPROCFS_ENTRY_AND_CHECK(dp))
-                return -ENOENT;
+        if (LPROCFS_ENTRY_AND_CHECK(dp)) {
+                rc = -ENOENT;
+                goto out;
+        }
 
         OBD_FAIL_TIMEOUT(OBD_FAIL_LPROC_REMOVE, 10);
         if (dp->read_proc)
 
         OBD_FAIL_TIMEOUT(OBD_FAIL_LPROC_REMOVE, 10);
         if (dp->read_proc)