Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2571745imu; Thu, 29 Nov 2018 07:04:43 -0800 (PST) X-Google-Smtp-Source: AFSGD/WsN8q65TwUcA9lWFcuAl+EsuNWz0ZyF+7keH9KpA4Z1fstNUepf/k55gYTuEe0Ukv/eZyn X-Received: by 2002:a62:1c7:: with SMTP id 190mr1746524pfb.46.1543503883375; Thu, 29 Nov 2018 07:04:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543503883; cv=none; d=google.com; s=arc-20160816; b=W6K+w6u8K8TM/7nXJmh3yubhKkEmy0liG8f+og2wWU1f1vyvA4nuBhXFMijtW1aKSh wslhO+WxNoC/oKPjDQOX84orr+LIIikUDcUcfrAtrBxthz6Kgam+izQz5K7TNNFkzByH i4X+NWxbHosROB9g36OIh/xSs61Q0afQi3OJyZpegwzUNpU8GzNhwfWnwp7nEaqr3eKL xlAUkOww+aC/rCXCpWPKk3OtZ3BVF+X6WYw1kaGE1o5bPYpYEh+huMwM+2MdFh16R+fJ zrd30LDgSVnbPDtXWrN5jsmRw9N0x2EDkR3yd45V0X8W8RrjnelEB8Zj77L/4kVzrU7E MsOA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zS6zJoXo6lV5Z2XcbTJvrIjk2FHNDFOmo5rR06zs9f4=; b=KhoNLzl/O6lBrKR9XHzRF+cS0zYwvKOwSNJSusYUNeMdaM45X3olJJ+woc1yct6/mg O5NRky2tOe9NJ+G/HmLCQ5Qbj5kzoGiIYkhYsauKc1JDuqT4IpSUPhMGs6iy+JFiTk0a Az6xlmNzDpXUGE4A6W87YWGaAHaCda5SdLhGJ0154V7mDBQEBF7uTziGWBIQy/zsfc5t QzCcKfiXSNwYto7cbtu8ohcSK4hy6dKDC7ZQs/+TMheT2schc2v8HOTrwk3/ew6mrA5H iqN3qSThN1NKkd9SV7oiXjxb5laoMYweTMZ77V1bnOl/y/qWMclPGbtICBCbcTzPBhbh /70w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cO1zpcuk; 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 h96si2571711plb.230.2018.11.29.07.04.28; Thu, 29 Nov 2018 07:04: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; dkim=pass header.i=@kernel.org header.s=default header.b=cO1zpcuk; 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 S1730497AbeK3BXO (ORCPT + 99 others); Thu, 29 Nov 2018 20:23:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:45204 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728439AbeK3BXL (ORCPT ); Thu, 29 Nov 2018 20:23:11 -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 5641B208E7; Thu, 29 Nov 2018 14:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501060; bh=qrJlO7ChsW6N7FuN2u9leXHRO/S/utT869ihTEro1bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cO1zpcukAA0yWaa1EKaJJ3gv7OPi6zMphdHpjgWUVzeOUOqeKxSdDk398Y+ecggCS fVV/ckbhVbH2JgsCBJeooEna6GF0/NsftYVmcrs6BJc3IXL2bzsAJSqoOw4HvI0jBy AsLixRQqW/y9cQSThLFoeay9OYAOPqoGtIXfpWiw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Cuissard , Samuel Ortiz , Johan Hovold , Rob Herring , Sasha Levin Subject: [PATCH 4.4 26/86] NFC: nfcmrvl_uart: fix OF child-node lookup Date: Thu, 29 Nov 2018 15:11:51 +0100 Message-Id: <20181129140112.016477420@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129140109.832117862@linuxfoundation.org> References: <20181129140109.832117862@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 5bf59773aaf36dd62117dc83d50e1bbf9ef432da ] 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 parent node). Fixes: e097dc624f78 ("NFC: nfcmrvl: add UART driver") Fixes: d8e018c0b321 ("NFC: nfcmrvl: update device tree bindings for Marvell NFC") Cc: stable # 4.2 Cc: Vincent Cuissard Cc: Samuel Ortiz Signed-off-by: Johan Hovold Signed-off-by: Rob Herring Signed-off-by: Sasha Levin --- drivers/nfc/nfcmrvl/uart.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/nfc/nfcmrvl/uart.c b/drivers/nfc/nfcmrvl/uart.c index 6c0c301611c4..1b11ded79c4f 100644 --- a/drivers/nfc/nfcmrvl/uart.c +++ b/drivers/nfc/nfcmrvl/uart.c @@ -73,10 +73,9 @@ static int nfcmrvl_uart_parse_dt(struct device_node *node, struct device_node *matched_node; int ret; - matched_node = of_find_compatible_node(node, NULL, "marvell,nfc-uart"); + matched_node = of_get_compatible_child(node, "marvell,nfc-uart"); if (!matched_node) { - matched_node = of_find_compatible_node(node, NULL, - "mrvl,nfc-uart"); + matched_node = of_get_compatible_child(node, "mrvl,nfc-uart"); if (!matched_node) return -ENODEV; } -- 2.17.1