Skip to content

Commit

Permalink
ipc/shm: properly return EIDRM in shm_lock()
Browse files Browse the repository at this point in the history
When getting rid of the general ipc_lock(), this was missed furthermore,
making the comment around the ipc object validity check bogus.  Under
EIDRM conditions, callers will in turn not see the error and continue
with the operation.

Link: http://lkml.kernel.org/r/20180824030920.GD3677@linux-r8p5
Link: http://lkml.kernel.org/r/20180823024051.GC13343@shao2-debian
Fixes: 82061c5 ("ipc: drop ipc_lock()")
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Reported-by: kernel test robot <rong.a.chen@intel.com>
Cc: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Davidlohr Bueso authored and Linus Torvalds committed Sep 4, 2018
1 parent 464c7ff commit 9c21dae
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ipc/shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ static inline struct shmid_kernel *shm_lock(struct ipc_namespace *ns, int id)
}

ipc_unlock_object(ipcp);
ipcp = ERR_PTR(-EIDRM);
err:
rcu_read_unlock();
/*
Expand Down

0 comments on commit 9c21dae

Please sign in to comment.