X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=ipc%2Fshm.c;h=b5bae9d945b62103ad8924ecf17dee8ee18a728c;hb=0ea648441a189f6e3e90a25c74511738799a0c7a;hp=9fb044f3b345e5e61ea072e255ab3b67b5ce3539;hpb=965e32b18d6b6bbcb79f4a7308fc8bdb4d03e813;p=firefly-linux-kernel-4.4.55.git diff --git a/ipc/shm.c b/ipc/shm.c index 9fb044f3b345..b5bae9d945b6 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -294,7 +294,7 @@ static int shm_try_destroy_orphaned(int id, void *p, void *data) void shm_destroy_orphaned(struct ipc_namespace *ns) { 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); up_write(&shm_ids(ns).rw_mutex); } @@ -304,9 +304,12 @@ void exit_shm(struct task_struct *task) { struct ipc_namespace *ns = task->nsproxy->ipc_ns; + if (shm_ids(ns).in_use == 0) + return; + /* Destroy all already created segments, but not mapped yet */ 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); up_write(&shm_ids(ns).rw_mutex); }