Commit 983bfb7d authored by Nadia Derbey's avatar Nadia Derbey Committed by Linus Torvalds
Browse files

ipc: call idr_find() without locking in ipc_lock()

Call idr_find() locklessly from ipc_lock(), since the idr tree is now RCU
Signed-off-by: default avatarNadia Derbey <>
Acked-by: default avatar"Paul E. McKenney" <>
Cc: Manfred Spraul <>
Cc: Jim Houston <>
Cc: Pierre Peiffer <>
Acked-by: default avatarRik van Riel <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent cf481c20
......@@ -688,10 +688,6 @@ void ipc64_perm_to_ipc_perm (struct ipc64_perm *in, struct ipc_perm *out)
* Look for an id in the ipc ids idr and lock the associated ipc object.
* The ipc object is locked on exit.
* This is the routine that should be called when the rw_mutex is not already
* held, i.e. idr tree not protected: it protects the idr tree in read mode
* during the idr_find().
struct kern_ipc_perm *ipc_lock(struct ipc_ids *ids, int id)
......@@ -699,18 +695,13 @@ struct kern_ipc_perm *ipc_lock(struct ipc_ids *ids, int id)
struct kern_ipc_perm *out;
int lid = ipcid_to_idx(id);
out = idr_find(&ids->ipcs_idr, lid);
if (out == NULL) {
return ERR_PTR(-EINVAL);
/* ipc_rmid() may have already freed the ID while ipc_lock
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