Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3473496imu; Sun, 11 Nov 2018 15:55:38 -0800 (PST) X-Google-Smtp-Source: AJdET5cSMJGoLu5uKdCZWnUs9GRnq7u8zpbFdrjNn/VZB6ILzjWbsHXiBHloKibOl709fjpnBJLW X-Received: by 2002:aa7:8719:: with SMTP id b25-v6mr17692797pfo.250.1541980538359; Sun, 11 Nov 2018 15:55:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541980538; cv=none; d=google.com; s=arc-20160816; b=r5PuOUK0JfipW1Hz1AlMaturz4LSwVWKxx+mqjixcccUbeLOq0F2er4bcCQyKqEOmB z5vr/M/KT7P90pK+c65S76rdS68KV0v44o3G1cJW+CXyaTXerifHLk9hs3MRBMQBjeZC CDa8F4pqxh/C0OwAVQ9kmL/STvlWJEmrw36o4lQRQdtCG/OMGHWryogio9ro2aLHfgbm 5N2ck2SLZWman5d3j3fKyICzIIitejhYH8RA/Rh6L3i8xTmuCkSTNCrd4XLAr2lOz+Xf HnlUVZa/b2d3s0w4zh6EOb9gzpXZk0NvcrnfFYDDXOSw06U9GjZ2uSwAx2JhX/ANKqV9 NCvA== 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=c94qmrVPxcYtITK6UE1vY8Q5uTC+/YboIFeinQe8ZAA=; b=uh2OMO6DhKt02J0Yw+B2OCbk7HRy8omYnzD85s0izy6Oo+RLprUMo0v8dmLR9t3VUl zdMQZweTRDpGJ7RHwFgOprqsukaAtWEInURHTBgDSdg5hSsxcz9FaDIIBT8wWjK8UomI fXx01zLqwm1YkaOWvJPZQKW1rgPY7zA+wc/rEZ1ShqUZJTinivdkl43vm5m8Mmgp+CkR zB4zTkS2x/Gk7Z6iaimXmjfZDlehyqryzhVljGWdlejK7QRhmeJb2Q0N7dfjNnOf894x 6wVwclW2lInCN+4sOOhUO9ZBOxbIpe22iN6ndwi7sNF67749lJ3S6JaSjGFFN2Zser+y Qhiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=A00Wq5xg; 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 w13-v6si13552207pgj.229.2018.11.11.15.55.23; Sun, 11 Nov 2018 15:55:38 -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=A00Wq5xg; 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 S1732909AbeKLJpZ (ORCPT + 99 others); Mon, 12 Nov 2018 04:45:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:37256 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732681AbeKLISU (ORCPT ); Mon, 12 Nov 2018 03:18:20 -0500 Received: from localhost (unknown [206.108.79.134]) (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 3AFF821508; Sun, 11 Nov 2018 22:28:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975304; bh=KgtBkgvGnko64NT0aeKJNgThNqDfux0x/0ScSQ22LYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A00Wq5xgXeRwQ1rTaiKBoxl1nc6f+wA/V5ALIyv0qYJiFq7xZmUfahC1hdBp6S9mh wKivS+cG2K/ihYSG4G1ef1/Wc7yfdQHYeuJKmE5grIhS6iqVdlpKBiYSnZiO+SGCDC B7ZzxxJKcWwHInwDZO1qaqhBfLRnpQzPkwPVxhdU= 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 Subject: [PATCH 4.19 269/361] NFC: nfcmrvl_uart: fix OF child-node lookup Date: Sun, 11 Nov 2018 14:20:16 -0800 Message-Id: <20181111221654.887737455@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@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.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit 5bf59773aaf36dd62117dc83d50e1bbf9ef432da 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 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: Greg Kroah-Hartman --- drivers/nfc/nfcmrvl/uart.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/nfc/nfcmrvl/uart.c +++ b/drivers/nfc/nfcmrvl/uart.c @@ -73,10 +73,9 @@ static int nfcmrvl_uart_parse_dt(struct 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; }