Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2954imu; Mon, 26 Nov 2018 07:13:43 -0800 (PST) X-Google-Smtp-Source: AFSGD/XzI45WUUKRqEmPHdd4adD1h9dmHr7fry+EX2BnGtgmNWkp4vDHq8Vu6qv3V8ZKTaExm7Kw X-Received: by 2002:a63:4c4e:: with SMTP id m14mr25412992pgl.173.1543245223583; Mon, 26 Nov 2018 07:13:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543245223; cv=none; d=google.com; s=arc-20160816; b=OXI8uFCO73TQdxBSxZY4uf/C+4Valajv5avaJ18V3685igZuo9u9JEHCnwDYsnckaq atPiuoNXUGWbml7VyjscGBkzijH0fwIhYWs3uL0mZp09x9BOw1G6MCXpNQe2AbwEHmKP hWtOeK4P3IlMK1VbgfHLLeSdmXBe0JHpQbEwaX0zZoYArNjYJrX9KdbU88nan+R0bRbN iFyZeD+18KJSynSnQvg4pCE4fkBQ1YkVdLtAcVCUQej9pDkBhE0hcPvHg3YZILRnWxK+ 3LtLuJPYREs53hK5FjOnEfbcdkt7A0y8w8pLUdkIEBlbbhqpyOWvPIwowhKkCzBjgJNL /wJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=ZMtWCrY+SVVf9vyfVQodh+agp2qRQOwxp5mL5QBERw0=; b=BaixAvwdILqBz2DkIgqZ9H4QBN2GAJ7hE1fOJ+8iRtGk6F5Vd7PUmogPJFX19Hnguh KvNmuoYrx+6q/f3oMZpbREh5hG3dLGWmqcVWQ7HsoxBwyTyCE+pbYJ0rdDwIfNAyvkbf KfaL0wrCcHVTONOk1aAwoDUUzjxAjWHmViBkfrxg4Ud8W4U3Ulb8urfO9WGKZAXJcDRO g8DSWvczoNZLT7Qz0Q11L+cqWCXBs61u+H9PHr1cqD+ysHrMUcwsNeq0rC4LDw5gV9lZ 0/fhKmhI+jt60I7GIOUcRY/4jcZ3px88KNccV2j2rfpJnsXf96y79J/LzHBopOVkVTlP Zjyg== ARC-Authentication-Results: i=1; mx.google.com; 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 t5si582470pgc.369.2018.11.26.07.13.18; Mon, 26 Nov 2018 07:13:43 -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; 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 S1726507AbeK0CDY (ORCPT + 99 others); Mon, 26 Nov 2018 21:03:24 -0500 Received: from mail.bootlin.com ([62.4.15.54]:59801 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726210AbeK0CDX (ORCPT ); Mon, 26 Nov 2018 21:03:23 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id AA7E2207BD; Mon, 26 Nov 2018 16:08:58 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from bbrezillon (aaubervilliers-681-1-94-205.w90-88.abo.wanadoo.fr [90.88.35.205]) by mail.bootlin.com (Postfix) with ESMTPSA id C2ECC2073D; Mon, 26 Nov 2018 16:08:40 +0100 (CET) Date: Mon, 26 Nov 2018 16:08:40 +0100 From: Boris Brezillon To: Naresh Kamboju Cc: Greg Kroah-Hartman , open list , linux- stable , nicolas.ferre@microchip.com, rainyfeeling@outlook.com, johan@kernel.org Subject: Re: [PATCH 4.14 58/62] mtd: rawnand: atmel: fix OF child-node lookup Message-ID: <20181126160840.1c702e87@bbrezillon> In-Reply-To: References: <20181126105050.592727680@linuxfoundation.org> <20181126105054.941598787@linuxfoundation.org> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?