[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170831172049.14576-3-dave@stgolabs.net>
Date: Thu, 31 Aug 2017 10:20:47 -0700
From: Davidlohr Bueso <dave@...olabs.net>
To: akpm@...ux-foundation.org
Cc: manfred@...orfullife.com, dave@...olabs.net,
linux-kernel@...r.kernel.org, Davidlohr Bueso <dbueso@...e.de>
Subject: [PATCH 2/4] 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.
Signed-off-by: Davidlohr Bueso <dbueso@...e.de>
---
ipc/sem.c | 1 +
ipc/shm.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/ipc/sem.c b/ipc/sem.c
index 013c7981f3c7..29c6ab6badc2 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -514,6 +514,7 @@ static int newary(struct ipc_namespace *ns, struct ipc_params *params)
sma->sem_nsems = nsems;
sma->sem_ctime = get_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 8fc97beb5234..ea64ed8782b3 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -600,6 +600,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;
--
2.12.0
Powered by blists - more mailing lists