Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753728AbbFDAYx (ORCPT ); Wed, 3 Jun 2015 20:24:53 -0400 Received: from cantor2.suse.de ([195.135.220.15]:54252 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752516AbbFDAYr (ORCPT ); Wed, 3 Jun 2015 20:24:47 -0400 Message-ID: <1433377480.2320.9.camel@stgolabs.net> Subject: Re: [PATCH 1/2] ipc,shm: move BUG_ON check into shm_lock From: Davidlohr Bueso To: Andrew Morton Cc: Manfred Spraul , linux-kernel@vger.kernel.org Date: Wed, 03 Jun 2015 17:24:40 -0700 In-Reply-To: <20150601155223.d919df461c92ff82e3fafd20@linux-foundation.org> References: <1432944186-7305-1-git-send-email-dave@stgolabs.net> <20150601155223.d919df461c92ff82e3fafd20@linux-foundation.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1050 Lines: 36 On Mon, 2015-06-01 at 15:52 -0700, Andrew Morton wrote: > On Fri, 29 May 2015 17:03:05 -0700 Davidlohr Bueso 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/