diff options
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/sem.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -322,7 +322,6 @@ static inline struct sem_array *sem_obtain_object_check(struct ipc_namespace *ns | |||
322 | 322 | ||
323 | static inline void sem_lock_and_putref(struct sem_array *sma) | 323 | static inline void sem_lock_and_putref(struct sem_array *sma) |
324 | { | 324 | { |
325 | rcu_read_lock(); | ||
326 | sem_lock(sma, NULL, -1); | 325 | sem_lock(sma, NULL, -1); |
327 | ipc_rcu_putref(sma); | 326 | ipc_rcu_putref(sma); |
328 | } | 327 | } |
@@ -1117,6 +1116,7 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum, | |||
1117 | return -ENOMEM; | 1116 | return -ENOMEM; |
1118 | } | 1117 | } |
1119 | 1118 | ||
1119 | rcu_read_lock(); | ||
1120 | sem_lock_and_putref(sma); | 1120 | sem_lock_and_putref(sma); |
1121 | if (sma->sem_perm.deleted) { | 1121 | if (sma->sem_perm.deleted) { |
1122 | sem_unlock(sma, -1); | 1122 | sem_unlock(sma, -1); |
@@ -1166,6 +1166,7 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum, | |||
1166 | goto out_free; | 1166 | goto out_free; |
1167 | } | 1167 | } |
1168 | } | 1168 | } |
1169 | rcu_read_lock(); | ||
1169 | sem_lock_and_putref(sma); | 1170 | sem_lock_and_putref(sma); |
1170 | if (sma->sem_perm.deleted) { | 1171 | if (sma->sem_perm.deleted) { |
1171 | sem_unlock(sma, -1); | 1172 | sem_unlock(sma, -1); |
@@ -1451,7 +1452,7 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid) | |||
1451 | } | 1452 | } |
1452 | 1453 | ||
1453 | /* step 3: Acquire the lock on semaphore array */ | 1454 | /* step 3: Acquire the lock on semaphore array */ |
1454 | /* This also does the rcu_read_lock() */ | 1455 | rcu_read_lock(); |
1455 | sem_lock_and_putref(sma); | 1456 | sem_lock_and_putref(sma); |
1456 | if (sma->sem_perm.deleted) { | 1457 | if (sma->sem_perm.deleted) { |
1457 | sem_unlock(sma, -1); | 1458 | sem_unlock(sma, -1); |