Commit 33a30ed4 authored by Vasiliy Kulikov's avatar Vasiliy Kulikov Committed by Linus Torvalds

shm: fix wrong tests

Commit 4c677e2e ("shm: optimize locking and ipc_namespace getting")
introduced a copy-paste bug.  Due to the bug cycle optimizations were
disabled.
Signed-off-by: default avatarVasiliy Kulikov <segoon@openwall.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 206506cc
...@@ -294,7 +294,7 @@ static int shm_try_destroy_orphaned(int id, void *p, void *data) ...@@ -294,7 +294,7 @@ static int shm_try_destroy_orphaned(int id, void *p, void *data)
void shm_destroy_orphaned(struct ipc_namespace *ns) void shm_destroy_orphaned(struct ipc_namespace *ns)
{ {
down_write(&shm_ids(ns).rw_mutex); down_write(&shm_ids(ns).rw_mutex);
if (&shm_ids(ns).in_use) if (shm_ids(ns).in_use)
idr_for_each(&shm_ids(ns).ipcs_idr, &shm_try_destroy_orphaned, ns); idr_for_each(&shm_ids(ns).ipcs_idr, &shm_try_destroy_orphaned, ns);
up_write(&shm_ids(ns).rw_mutex); up_write(&shm_ids(ns).rw_mutex);
} }
...@@ -306,7 +306,7 @@ void exit_shm(struct task_struct *task) ...@@ -306,7 +306,7 @@ void exit_shm(struct task_struct *task)
/* Destroy all already created segments, but not mapped yet */ /* Destroy all already created segments, but not mapped yet */
down_write(&shm_ids(ns).rw_mutex); down_write(&shm_ids(ns).rw_mutex);
if (&shm_ids(ns).in_use) if (shm_ids(ns).in_use)
idr_for_each(&shm_ids(ns).ipcs_idr, &shm_try_destroy_current, ns); idr_for_each(&shm_ids(ns).ipcs_idr, &shm_try_destroy_current, ns);
up_write(&shm_ids(ns).rw_mutex); up_write(&shm_ids(ns).rw_mutex);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment