From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752371AbbLKNx2 (ORCPT ); Fri, 11 Dec 2015 08:53:28 -0500 Received: from down.free-electrons.com ([37.187.137.238]:59932 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751762AbbLKNxZ (ORCPT ); Fri, 11 Dec 2015 08:53:25 -0500 Date: Fri, 11 Dec 2015 14:53:20 +0100 From: Boris Brezillon To: Brian Norris Cc: David Woodhouse , linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jonathan Corbet , linux-doc@vger.kernel.org, Hartley Sweeten , Ryan Mallon , Shawn Guo , Sascha Hauer , Imre Kaloz , Krzysztof Halasa , Tony Lindgren , linux-omap@vger.kernel.org, Alexander Clouter , Thomas Petazzoni , Gregory CLEMENT , Jason Cooper , Sebastian Hesselbarth , Andrew Lunn , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Marek Vasut , Steven Miao , adi-buildroot-devel@lists.sourceforge.net, Mikael Starvik , Jesper Nilsson , linux-cris-kernel@axis.com, Josh Wu , Wan ZongShun , Ezequiel Garcia , Maxim Levitsky , Kukjin Kim , Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org, Maxime Ripard , Chen-Yu Tsai , linux-sunxi@googlegroups.com, Stefan Agner , Greg Kroah-Hartman , devel@driverdev.osuosl.org, stable@vger.kernel.org Subject: Re: [PATCH v4 01/58] mtd: nand: denali: add missing nand_release() call in denali_remove() Message-ID: <20151211145320.1560fac3@bbrezillon> In-Reply-To: <20151211004008.GQ144338@google.com> References: <1449734442-18672-1-git-send-email-boris.brezillon@free-electrons.com> <1449734442-18672-2-git-send-email-boris.brezillon@free-electrons.com> <20151211004008.GQ144338@google.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.27; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Brian, On Thu, 10 Dec 2015 16:40:08 -0800 Brian Norris wrote: > On Thu, Dec 10, 2015 at 08:59:45AM +0100, Boris Brezillon wrote: > > Unregister the NAND device from the NAND subsystem when removing a denali > > NAND controller, otherwise the MTD attached to the NAND device is still > > exposed by the MTD layer, and accesses to this device will likely crash > > the system. > > > > Signed-off-by: Boris Brezillon > > Cc: #3.8+ > > Does this follow these rules, from > Documentation/stable_kernel_rules.txt? > > - It must be obviously correct and tested. > > - It must fix a real bug that bothers people (not a, "This could be a > problem..." type thing). As you wish, I'll remove those Cc and Fixes tags, or just drop the patch if you think it's useless... I just noticed the bug while reworking this series, and thought it would be useful to fix it, but I honestly don't care if it's applied or not (I don't use this platform). > > > Fixes: 2a0a288ec258 ("mtd: denali: split the generic driver and PCI layer") > > --- > > drivers/mtd/nand/denali.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c > > index 67eb2be..8feece3 100644 > > --- a/drivers/mtd/nand/denali.c > > +++ b/drivers/mtd/nand/denali.c > > @@ -1622,6 +1622,7 @@ EXPORT_SYMBOL(denali_init); > > /* driver exit point */ > > void denali_remove(struct denali_nand_info *denali) > > { > > + nand_release(&denali->mtd); > > denali_irq_cleanup(denali->irq, denali); > > dma_unmap_single(denali->dev, denali->buf.dma_buf, > > denali->mtd.writesize + denali->mtd.oobsize, > > It feels a bit odd to allow usage of MTD fields after it has been > unregistered. Maybe precompute this before the nand_release()? nand_realease() is not releasing the mtd instance or re-initialazing its field, so it should be safe, but I agree that pre-computing the DMA buffer size is more future-proof. I'll fix that, send a v5 and let you decide whether it's needed or not. Best Regards, Boris -- Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com