From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.bootlin.com ([62.4.15.54]:40360 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728065AbeIQTvh (ORCPT ); Mon, 17 Sep 2018 15:51:37 -0400 Date: Mon, 17 Sep 2018 16:24:02 +0200 From: Boris Brezillon To: Miquel Raynal Cc: Richard Weinberger , =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , stable@vger.kernel.org, Marek Vasut , linux-mtd@lists.infradead.org, Brian Norris , David Woodhouse Subject: Re: [PATCH] mtd: partitions: fix of_node_get/put balance in parser Message-ID: <20180917162402.10cc8994@bbrezillon> In-Reply-To: <20180917160318.37afd433@xps13> References: <20180907143554.13496-1-miquel.raynal@bootlin.com> <20180907163824.6cec1a43@xps13> <20180910145312.3b9ae4ad@bbrezillon> <20180910151423.2944aca6@xps13> <20180910152551.23ffa474@bbrezillon> <20180910153831.0f426ada@xps13> <20180910154219.30fddb7a@bbrezillon> <20180917115520.7cceef50@xps13> <20180917155140.33fb4cc1@bbrezillon> <20180917160318.37afd433@xps13> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: stable-owner@vger.kernel.org List-ID: On Mon, 17 Sep 2018 16:03:18 +0200 Miquel Raynal wrote: > Hi Boris, > > Boris Brezillon wrote on Mon, 17 Sep 2018 > 15:51:40 +0200: > > > On Mon, 17 Sep 2018 11:55:20 +0200 > > Miquel Raynal wrote: > > > > > > Or you just say that mtd_get_of_node() does not retain a reference to > > > > the device_node object it returns and that should be enough ;-). > > > > > > Fine by me, you can apply it and modify in place. > > > > Here is the new commit message: > > > > " > > mtd: partitions: fix unbalanced of_node_get/put() > > > > While at first mtd_part_of_parse() would just call > > of_get_chil_by_name(), it has been patched to deal with sub-partitions > > and will now directly manipulate the node returned mtd_get_of_node() if > > ^by > > > the MTD device is a partition. > > > > A of_node_put() was a bit below in the code, to balance the > > of_get_child_by_name(). However, despite its name, mtd_get_of_node() > > does not take a reference on the OF node. It is a simple helper > > hiding some pointer logic to retrieve the OF node related to an MTD > > device. > > > > The direct effect of such unbalanced reference counting is visible > > by rmmod'ing any module that would have added MTD partitions: > > > > OF: ERROR: Bad of_node_put() on > > > > As it seems normal to get a reference on the OF node during the > > of_property_for_each_string() that follows, add a call to > > of_node_get() when relevant. > > > > Fixes: 76a832254ab0 ("mtd: partitions: use DT info for parsing partitions with "compatible" prop") > > Cc: stable@vger.kernel.org > > Signed-off-by: Miquel Raynal > > Signed-off-by: Boris Brezillon > > " > > > > Let me know if you're okay with this update. > > One missing work, otherwise I'm ok. Fixed and pushed. Thanks, Boris