Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1821887imm; Mon, 3 Sep 2018 10:18:47 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYURqtGJrx8u5Ijcla1TChhc3WPCJWyPWlX3nCfAJybcSbeH/OOE22Wko1gKGc2TH4KfABz X-Received: by 2002:a62:2646:: with SMTP id m67-v6mr30679075pfm.254.1535995127742; Mon, 03 Sep 2018 10:18:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995127; cv=none; d=google.com; s=arc-20160816; b=Pg6AWwZh8H1VvIt8jNVuBmABMLh5T8WjG9Ko9mThk+Qt0ulTyVRgJrsCSIv40afxp1 AGeIHR6E/e1pnFHYDHV3n1dhI4TCEHdvrw0fHTvkvC68miw1QkBxNlQr64X7W2W1Bj8D dt7Gbv3BuYpv7lTFi1gg6OqArrYftgIMvmPP68ZUcXFAErnsXxJ0kZ5FDg8nqPtiM1rR M/FI3qXIpkkJVAoWd8YERDJg7NVXT13Qp2aDIYmFYYtuVMxACXxqkWBtWzOGaqspRirH Jfwqe+Vay4FT0REbPh79oz3sbWQSELo7wiYCi/EOr3+JJUhkrAhc8c3NhQ8+LSZdYyM1 2AOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=RS69MnwFrVtwW+UaSJAUU7y763QraZxBcHllayM41Zg=; b=LhOJW/eEtUtz9r8dezpruW+czmsyS+QRCbCbyzaxcyaCwcOJTspcarO16X43SNw+Ji AUWVsiTbEIYQBkUSKYEh71gt/8lGGAUHLhzLj7xaL37y800p0DbfRdUS38o+nDr+vBzq 5EZUm1hlbUVsgmWvFajp8NrE0RwiVTh42SzMv5CSQ1rpGkB9qkvNcXPSX5HdKxdBT21t +4LC4S1/AaA6iHV+58p0ULc/QvjcwNsZBnLzQUISNKzrJqdH8L9tks2TH3e7RBx5Ewc1 G18/PUaGctTk5cxEZ+tS/sIFUfGh1HiRs4eYKtP21AVoz5fVIi+1C4D4bnZcJxDCtLaD Rc7g== 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 f15-v6si925429pgb.666.2018.09.03.10.18.33; Mon, 03 Sep 2018 10:18:47 -0700 (PDT) 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 S1730110AbeICViM (ORCPT + 99 others); Mon, 3 Sep 2018 17:38:12 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42712 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728282AbeICViL (ORCPT ); Mon, 3 Sep 2018 17:38:11 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3E8A9D12; Mon, 3 Sep 2018 17:17:07 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Mc Guire , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 4.14 039/165] can: mpc5xxx_can: check of_iomap return before use Date: Mon, 3 Sep 2018 18:55:25 +0200 Message-Id: <20180903165657.057533525@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicholas Mc Guire [ Upstream commit b5c1a23b17e563b656cc9bb76ce5323b997d90e8 ] of_iomap() can return NULL so that return needs to be checked and NULL treated as failure. While at it also take care of the missing of_node_put() in the error path. Signed-off-by: Nicholas Mc Guire Fixes: commit afa17a500a36 ("net/can: add driver for mscan family & mpc52xx_mscan") Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/mscan/mpc5xxx_can.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/net/can/mscan/mpc5xxx_can.c +++ b/drivers/net/can/mscan/mpc5xxx_can.c @@ -86,6 +86,11 @@ static u32 mpc52xx_can_get_clock(struct return 0; } cdm = of_iomap(np_cdm, 0); + if (!cdm) { + of_node_put(np_cdm); + dev_err(&ofdev->dev, "can't map clock node!\n"); + return 0; + } if (in_8(&cdm->ipb_clk_sel) & 0x1) freq *= 2;