diff options
author | Pierre Peiffer <Pierre.Peiffer@bull.net> | 2007-10-19 10:40:57 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-19 22:53:49 +0400 |
commit | 283bb7fada7e33a759d8fc9bd7a44532e4ad420e (patch) | |
tree | c6704baf10edd10ca64310f2d168969434bb7dcf /ipc/sem.c | |
parent | 3ac88a41ff747b8c2f290f86b5243b2f8fce2cc0 (diff) | |
download | linux-283bb7fada7e33a759d8fc9bd7a44532e4ad420e.tar.xz |
IPC: fix error case when idr-cache is empty in ipcget()
With the use of idr to store the ipc, the case where the idr cache is
empty, when idr_get_new is called (this may happen even if we call
idr_pre_get() before), is not well handled: it lets
semget()/shmget()/msgget() return ENOSPC when this cache is empty, what 1.
does not reflect the facts and 2. does not conform to the man(s).
This patch fixes this by retrying the whole process of allocation in this case.
Signed-off-by: Pierre Peiffer <pierre.peiffer@bull.net>
Cc: Nadia Derbey <Nadia.Derbey@bull.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc/sem.c')
-rw-r--r-- | ipc/sem.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ipc/sem.c b/ipc/sem.c index 7617f4f34edc..35952c0bae46 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -283,10 +283,10 @@ static int newary(struct ipc_namespace *ns, struct ipc_params *params) } id = ipc_addid(&sem_ids(ns), &sma->sem_perm, ns->sc_semmni); - if(id == -1) { + if (id < 0) { security_sem_free(sma); ipc_rcu_putref(sma); - return -ENOSPC; + return id; } ns->used_sems += nsems; |