aboutsummaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
Diffstat (limited to 'ipc')
-rw-r--r--ipc/msg.c7
-rw-r--r--ipc/shm.c5
-rw-r--r--ipc/util.c3
3 files changed, 8 insertions, 7 deletions
diff --git a/ipc/msg.c b/ipc/msg.c
index d0c6d967b390..996feb819248 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -199,9 +199,7 @@ static int newque(struct ipc_namespace *ns, struct ipc_params *params)
199 return retval; 199 return retval;
200 } 200 }
201 201
202 /* 202 /* ipc_addid() locks msq upon success. */
203 * ipc_addid() locks msq
204 */
205 id = ipc_addid(&msg_ids(ns), &msq->q_perm, ns->msg_ctlmni); 203 id = ipc_addid(&msg_ids(ns), &msq->q_perm, ns->msg_ctlmni);
206 if (id < 0) { 204 if (id < 0) {
207 security_msg_queue_free(msq); 205 security_msg_queue_free(msq);
@@ -218,7 +216,8 @@ static int newque(struct ipc_namespace *ns, struct ipc_params *params)
218 INIT_LIST_HEAD(&msq->q_receivers); 216 INIT_LIST_HEAD(&msq->q_receivers);
219 INIT_LIST_HEAD(&msq->q_senders); 217 INIT_LIST_HEAD(&msq->q_senders);
220 218
221 msg_unlock(msq); 219 spin_unlock(&msq->q_perm.lock);
220 rcu_read_unlock();
222 221
223 return msq->q_perm.id; 222 return msq->q_perm.id;
224} 223}
diff --git a/ipc/shm.c b/ipc/shm.c
index 85dc001634b1..bd2b14ef1bba 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -535,6 +535,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
535 shp->shm_nattch = 0; 535 shp->shm_nattch = 0;
536 shp->shm_file = file; 536 shp->shm_file = file;
537 shp->shm_creator = current; 537 shp->shm_creator = current;
538
538 /* 539 /*
539 * shmid gets reported as "inode#" in /proc/pid/maps. 540 * shmid gets reported as "inode#" in /proc/pid/maps.
540 * proc-ps tools use this. Changing this will break them. 541 * proc-ps tools use this. Changing this will break them.
@@ -543,7 +544,9 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
543 544
544 ns->shm_tot += numpages; 545 ns->shm_tot += numpages;
545 error = shp->shm_perm.id; 546 error = shp->shm_perm.id;
546 shm_unlock(shp); 547
548 spin_unlock(&shp->shm_perm.lock);
549 rcu_read_unlock();
547 return error; 550 return error;
548 551
549no_id: 552no_id:
diff --git a/ipc/util.c b/ipc/util.c
index 809ec5ec8122..399821ac0a9a 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -246,9 +246,8 @@ int ipc_get_maxid(struct ipc_ids *ids)
246 * is returned. The 'new' entry is returned in a locked state on success. 246 * is returned. The 'new' entry is returned in a locked state on success.
247 * On failure the entry is not locked and a negative err-code is returned. 247 * On failure the entry is not locked and a negative err-code is returned.
248 * 248 *
249 * Called with ipc_ids.rw_mutex held as a writer. 249 * Called with writer ipc_ids.rw_mutex held.
250 */ 250 */
251
252int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size) 251int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size)
253{ 252{
254 kuid_t euid; 253 kuid_t euid;