]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
proc: don't do dummy rcu_read_lock/rcu_read_unlock on error path
authorAlexey Dobriyan <adobriyan@gmail.com>
Wed, 25 Apr 2012 01:04:44 +0000 (11:04 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 30 Apr 2012 05:17:39 +0000 (15:17 +1000)
rcu_read_lock()/rcu_read_unlock() is nop for TINY_RCU, but is not a nop
for, say, PREEMPT_RCU.

proc_fill_cache() is called without RCU lock, there is no need to
lock/unlock on error path, simply jump out of the loop.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/proc/base.c

index a05bc466f5b03216b7dd771c2ccad31e3031ccee..ee7534205422a94d780a69b31092d28e889b9dea 100644 (file)
@@ -1941,21 +1941,22 @@ static int proc_readfd_common(struct file * filp, void * dirent,
                             fd++, filp->f_pos++) {
                                char name[PROC_NUMBUF];
                                int len;
+                               int rv;
 
                                if (!fcheck_files(files, fd))
                                        continue;
                                rcu_read_unlock();
 
                                len = snprintf(name, sizeof(name), "%d", fd);
-                               if (proc_fill_cache(filp, dirent, filldir,
-                                                   name, len, instantiate,
-                                                   p, &fd) < 0) {
-                                       rcu_read_lock();
-                                       break;
-                               }
+                               rv = proc_fill_cache(filp, dirent, filldir,
+                                                    name, len, instantiate, p,
+                                                    &fd);
+                               if (rv < 0)
+                                       goto out_fd_loop;
                                rcu_read_lock();
                        }
                        rcu_read_unlock();
+out_fd_loop:
                        put_files_struct(files);
        }
 out: