summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorDavidlohr Bueso <dave@stgolabs.net>2017-11-18 00:31:11 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-18 01:10:04 +0100
commit39c96a1b96a5991b1c9e79b85a8d74ef93b36026 (patch)
tree5bd92209fad8d1a35f9a7720829204862ad29723 /ipc
parentsysvipc: unteach ids->next_id for !CHECKPOINT_RESTORE (diff)
downloadlinux-39c96a1b96a5991b1c9e79b85a8d74ef93b36026.tar.xz
linux-39c96a1b96a5991b1c9e79b85a8d74ef93b36026.zip
sysvipc: duplicate lock comments wrt ipc_addid()
The comment in msgqueues when using ipc_addid() is quite useful imo. Duplicate it for shm and semaphores. Link: http://lkml.kernel.org/r/20170831172049.14576-3-dave@stgolabs.net Signed-off-by: Davidlohr Bueso <dbueso@suse.de> Cc: Manfred Spraul <manfred@colorfullife.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/sem.c1
-rw-r--r--ipc/shm.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/ipc/sem.c b/ipc/sem.c
index b2698ebdcb31..28a5c9f0be87 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -515,6 +515,7 @@ static int newary(struct ipc_namespace *ns, struct ipc_params *params)
sma->sem_nsems = nsems;
sma->sem_ctime = ktime_get_real_seconds();
+ /* ipc_addid() locks sma upon success. */
retval = ipc_addid(&sem_ids(ns), &sma->sem_perm, ns->sc_semmni);
if (retval < 0) {
call_rcu(&sma->sem_perm.rcu, sem_rcu_free);
diff --git a/ipc/shm.c b/ipc/shm.c
index bd652755d32c..378c929194ce 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -601,6 +601,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
shp->shm_file = file;
shp->shm_creator = current;
+ /* ipc_addid() locks shp upon success. */
error = ipc_addid(&shm_ids(ns), &shp->shm_perm, ns->shm_ctlmni);
if (error < 0)
goto no_id;