summaryrefslogtreecommitdiffstats
path: root/ipc/sem.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-04 20:04:29 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-05 02:24:59 +0200
commit941b0304a74b240c607ff098401fd4ef70c9d1cc (patch)
tree92cb88d1851360c5e890b7daf737b264cf3181de /ipc/sem.c
parentipc: simplify semtimedop/semctl_main() common error path handling (diff)
downloadlinux-941b0304a74b240c607ff098401fd4ef70c9d1cc.tar.xz
linux-941b0304a74b240c607ff098401fd4ef70c9d1cc.zip
ipc: simplify rcu_read_lock() in semctl_nolock()
This trivially combines two rcu_read_lock() calls in both sides of a if-statement into one single one in front of the if-statement. Split out as an independent cleanup from the previous commit. Acked-by: Davidlohr Bueso <davidlohr.bueso@hp.com> Cc: Rik van Riel <riel@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc/sem.c')
-rw-r--r--ipc/sem.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/ipc/sem.c b/ipc/sem.c
index f2151babd26a..899b598b63be 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -948,8 +948,8 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid,
memset(&tbuf, 0, sizeof(tbuf));
+ rcu_read_lock();
if (cmd == SEM_STAT) {
- rcu_read_lock();
sma = sem_obtain_object(ns, semid);
if (IS_ERR(sma)) {
err = PTR_ERR(sma);
@@ -957,7 +957,6 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid,
}
id = sma->sem_perm.id;
} else {
- rcu_read_lock();
sma = sem_obtain_object_check(ns, semid);
if (IS_ERR(sma)) {
err = PTR_ERR(sma);