Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2171294imu; Thu, 29 Nov 2018 00:09:01 -0800 (PST) X-Google-Smtp-Source: AFSGD/XUpJx47FV4sfiSIWMBj2+HJZiNiJpAIbObIC+CxTvG2UnPw5bgeqeRzQ1KeIhukI+z8G0e X-Received: by 2002:a63:4187:: with SMTP id o129mr383182pga.370.1543478941554; Thu, 29 Nov 2018 00:09:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543478941; cv=none; d=google.com; s=arc-20160816; b=TSybMNLOmZTD1cYq/1Oda7e9dxafj3MbgLVVEr9Q074vmc1AxQ1Mu+mpSWcvjQD9ax mzbErz6tNsKlfKeB/h6YNIRcIVFuDy4j5Q3eUDr/TmIap+Sy0cdUvHBtL4trOyX0swKp DEJEZux4rZPxo9I2IWG3sZ1xaavNG8+KaIy5hJ499jOsWnIbQc7VxMVS2GRWZW1Ydwv4 6EWckp9oZ9m/d188d61caSAhDS71yG58Mtou4SHb5irCIb47b8rgEWVVNs88/0T/HkEs m3s5wAhcc4Ka5fm0c4KNvpKHCkdmEbRsazTbYHUMUvrwENQDbVQDXlWrqdc1c6T/ap8U iKlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=z78/eObCV2ZUFmJR03QFQzfM6V75rm2PzCqYg9enAYY=; b=RjBZXDD6L4dDOTPFow+58LETk7zGBsjwKbG7eZ834LBDCcJV7JCwtvKNyBnTc+9sUF JyLGjI5qHhxTs7t3Xro5lFwiSzWgNin1M40zcPIEGVZkBqpDgSMirk2i35D0ignGh6GV rqL3i2X8hr8/xFfLkwMXQYwvk8IPAtA3Q2twj0gUqDwIPr9UsyKwZBgDaxPXQ5w3ouDg nQbPRegaULPOlAm8gHnLvXKi7YWZkxjFirMSI7oTriCEFlxWvRM+YmsLk3eX+BZCJ2rO cQ39llwa3WuKq9hSN/nv/AEQC6jHSaAvaeQLKON5Ju1EvWXypScwvLzEZ2hDPtRTm4sx 8pxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=O794UlsC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n7si1368856plp.147.2018.11.29.00.08.46; Thu, 29 Nov 2018 00:09:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=O794UlsC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726961AbeK2TMo (ORCPT + 99 others); Thu, 29 Nov 2018 14:12:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:36028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726651AbeK2TMo (ORCPT ); Thu, 29 Nov 2018 14:12:44 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6F64520834; Thu, 29 Nov 2018 08:08:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543478892; bh=Y7dCXkwUHZlyun9Jj/P0d5xxj8WOlsQH4+QkSqvvrLM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=O794UlsCLZL4nVP2xiTRgDcaYE8Y7TXSDpYCTN9YczCJgTu1h+WyEtVyq7qtubpR6 uJJEzqH0GeEU2YecJyiLUJQsPiC2P8W28ks4ylVtyW/vgB3vYttSs6x5Umk0JCLsyO kxzX7HkcC7hTAi/Gi6kjzYhBigrsEEyaCUkORs0A= Date: Thu, 29 Nov 2018 09:08:10 +0100 From: Greg Kroah-Hartman To: Johan Hovold Cc: Boris Brezillon , Naresh Kamboju , open list , linux- stable , nicolas.ferre@microchip.com, rainyfeeling@outlook.com Subject: Re: [PATCH 4.14 58/62] mtd: rawnand: atmel: fix OF child-node lookup Message-ID: <20181129080810.GD13859@kroah.com> References: <20181126105050.592727680@linuxfoundation.org> <20181126105054.941598787@linuxfoundation.org> <20181126160840.1c702e87@bbrezillon> <20181126151418.GA19698@kroah.com> <20181126154824.GA2403@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181126154824.GA2403@localhost> User-Agent: Mutt/1.11.0 (2018-11-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 26, 2018 at 07:48:24AM -0800, Johan Hovold wrote: > On Mon, Nov 26, 2018 at 04:14:18PM +0100, Greg Kroah-Hartman wrote: > > On Mon, Nov 26, 2018 at 04:08:40PM +0100, Boris Brezillon wrote: > > > On Mon, 26 Nov 2018 19:46:15 +0530 > > > Naresh Kamboju wrote: > > > > > > > Do you see build failure arm x15 beagleboard on 4.14 due to this patch ? > > > > > > > > On Mon, 26 Nov 2018 at 16:31, Greg Kroah-Hartman > > > > wrote: > > > > > > > > > > 4.14-stable review patch. If anyone has any objections, please let me know. > > > > > > > > > > ------------------ > > > > > > > > > > From: Johan Hovold > > > > > > > > > > commit 5d1e9c2212ea6b4dd735e4fc3dd6279a365d5d10 upstream. > > > > > > > > > > Use the new of_get_compatible_child() helper to lookup the nfc child > > > > > node instead of using of_find_compatible_node(), which searches the > > > > > entire tree from a given start node and thus can return an unrelated > > > > > (i.e. non-child) node. > > > > > > > > > > This also addresses a potential use-after-free (e.g. after probe > > > > > deferral) as the tree-wide helper drops a reference to its first > > > > > argument (i.e. the node of the device being probed). > > > > > > > > > > While at it, also fix a related nfc-node reference leak. > > > > > > > > > > Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver") > > > > > Cc: stable # 4.11 > > > > > Cc: Nicolas Ferre > > > > > Cc: Josh Wu > > > > > Cc: Boris Brezillon > > > > > Signed-off-by: Johan Hovold > > > > > Signed-off-by: Boris Brezillon > > > > > Signed-off-by: Greg Kroah-Hartman > > > > > > > > > > --- > > > > > drivers/mtd/nand/atmel/nand-controller.c | 11 +++++++---- > > > > > 1 file changed, 7 insertions(+), 4 deletions(-) > > > > > > > > > > --- a/drivers/mtd/nand/atmel/nand-controller.c > > > > > +++ b/drivers/mtd/nand/atmel/nand-controller.c > > > > > @@ -2077,8 +2077,7 @@ atmel_hsmc_nand_controller_legacy_init(s > > > > > int ret; > > > > > > > > > > nand_np = dev->of_node; > > > > > - nfc_np = of_find_compatible_node(dev->of_node, NULL, > > > > > - "atmel,sama5d3-nfc"); > > > > > + nfc_np = of_get_compatible_child(dev->of_node, "atmel,sama5d3-nfc"); > > > > > if (!nfc_np) { > > > > > dev_err(dev, "Could not find device node for sama5d3-nfc\n"); > > > > > return -ENODEV; > > > > > @@ -2492,15 +2491,19 @@ static int atmel_nand_controller_probe(s > > > > > } > > > > > > > > > > if (caps->legacy_of_bindings) { > > > > > + struct device_node *nfc_node; > > > > > u32 ale_offs = 21; > > > > > > > > > > /* > > > > > * If we are parsing legacy DT props and the DT contains a > > > > > * valid NFC node, forward the request to the sama5 logic. > > > > > */ > > > > > - if (of_find_compatible_node(pdev->dev.of_node, NULL, > > > > > - "atmel,sama5d3-nfc")) > > > > > + nfc_node = of_get_compatible_child(pdev->dev.of_node, > > > > > + "atmel,sama5d3-nfc"); > > > > > + if (nfc_node) { > > > > > caps = &atmel_sama5_nand_caps; > > > > > + of_node_put(nfc_node); > > > > > + } > > > > > > > > > > /* > > > > > * Even if the compatible says we are dealing with an > > > > > > > > > > > > > > > > > > /drivers/mtd/nand/atmel/nand-controller.c: In function > > > > 'atmel_hsmc_nand_controller_legacy_init': > > > > /drivers/mtd/nand/atmel/nand-controller.c:2080:11: error: implicit > > > > declaration of function 'of_get_compatible_child'; did you mean > > > > 'of_get_next_available_child'? [-Werror=implicit-function-declaration] > > > > nfc_np = of_get_compatible_child(dev->of_node, "atmel,sama5d3-nfc"); > > > > > > Looks like of_get_compatible_child() has been introduced in 4.18, hence > > > this error. > > > > > > Greg, can you drop this patch from 4.14.y? > > > > Yes, my fault, I fixed a number of these in the past, missed this one :( > > > > Now dropped. > > The intention here was that the helper should be backported along with > the fixes. I mentioned this in the cover letter to the series > introducing the helper and the fixes. As they were submitted together I > could not use the usual > > Cc: stable # 4.xx: 36156f9241cb > > notation for this. I realise I should still have mentioned this in each > individual commit messages as well, sorry about that. > > The dependency for all of these fixes is: > > 36156f9241cb ("of: add helper to lookup compatible child node") > > and the original thread can be found here: > > https://lkml.kernel.org/r/20180827082153.22537-1-johan@kernel.org Now fixed up and applied, thanks. greg k-h