lkml.org 
[lkml]   [2015]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/2] ipc,shm: move BUG_ON check into shm_lock
From
Date
On Mon, 2015-06-01 at 15:52 -0700, Andrew Morton wrote:
> On Fri, 29 May 2015 17:03:05 -0700 Davidlohr Bueso <dave@stgolabs.net> wrote:
>
> > Upon every shm_lock call, we BUG_ON if an error was returned,
> > indicating racing either in idr or in RMID. Move this logic
> > into the locking.
> >
> > ...
> >
> > --- a/ipc/shm.c
> > +++ b/ipc/shm.c
> > @@ -155,8 +155,14 @@ static inline struct shmid_kernel *shm_lock(struct ipc_namespace *ns, int id)
> > {
> > struct kern_ipc_perm *ipcp = ipc_lock(&shm_ids(ns), id);
> >
> > - if (IS_ERR(ipcp))
> > + if (IS_ERR(ipcp)) {
> > + /*
> > + * We raced in the idr lookup or with RMID,
> > + * either way, the ID is busted.
> > + */
> > + BUG_ON(1);
> > return (struct shmid_kernel *)ipcp;
> > + }
> >

Sure, this is fine.

Thanks,
Davidlohr



\
 
 \ /
  Last update: 2015-06-04 02:41    [W:0.102 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site