Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1158141 > unrolled thread

Re: [PATCH 1/2] ipc,shm: move BUG_ON check into shm_lock

Started byDavidlohr Bueso <dave@stgolabs.net>
First post2015-06-04 02:30 +0200
Last post2015-06-04 02:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/2] ipc,shm: move BUG_ON check into shm_lock Davidlohr Bueso <dave@stgolabs.net> - 2015-06-04 02:30 +0200

#1158141 — Re: [PATCH 1/2] ipc,shm: move BUG_ON check into shm_lock

FromDavidlohr Bueso <dave@stgolabs.net>
Date2015-06-04 02:30 +0200
SubjectRe: [PATCH 1/2] ipc,shm: move BUG_ON check into shm_lock
Message-ID<pxrcJ-BE-11@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web