Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9081983pxu; Mon, 28 Dec 2020 06:12:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5Ow8izKrOGF5kFmnK+36JeUHT8LL8YV6fTJJ+7x5FcC8PUwaBYqZxCZIYclBERH41+gsM X-Received: by 2002:a50:ce13:: with SMTP id y19mr42541024edi.241.1609164731849; Mon, 28 Dec 2020 06:12:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609164731; cv=none; d=google.com; s=arc-20160816; b=fpvtA8sB89JgzQaN3z1ZzRzHJJdLTy9F7vyJPaEabgX3/W+1fA0Zftt3q2tnSzp1HR k0GEnjsaLCG7Zim9vR8weH/caFa5HGyOhOF87/JEFbyS7SUcEV6GUdUcHi4cOmpy8VdD x/CwZdPUdvNmeYHKzN6es1hzFAMvZ+kubnqm27czhfTKX4vKeo1KB+AUIvytNNMBG1fK e7LFJZsuNJoMMAD2dtJor+IKOsNTGHMcnVaQgFsJkXMn+SJk9x1neb0PvKiYthFNGtIQ T8oqnDZEiWqJXcQHcOmMHBYmYm19ZFYpyVLE+rYBl6Af/j1pVe9fSZLAzIbERHA3WiIU l5IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=z8PH9Oa9VlsNcsJyvPE0nYmmVgI1nZWpVaDK+fvaLNY=; b=xFxhTbAv4Wi9RjbKsdNiBGCMRIIiTLDSKA5JqxU2TQcc2eslAPgOPDcI8JAajhNrFC 4SBnuA6rRCyZZkA7aCohkUQcZfwkSxwszXNht3sei4wRjwzPNO++TsCmlMLfhMgK8IMw ZgiiBdsXBbklwzf216MyBaJGXZC9FDQMFk5h734ll4QstE5UcrlXuWzMd2CUNZ5JAFqN OoWzcdrzrW3a9Jj/+cNH/F9Sn8TIBo+nr9+jOv1KooUCH+6hqBU6ab4dNRriIwj8vwCN JeCeWDCKAWK9VCxaJ0+36sLvcfnfUH3Q0BsoCYLyueUoP/QW4sNCVdRAjtI3QJ1D5WVA sCWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xdr4Q6Re; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e15si20203234edr.313.2020.12.28.06.11.49; Mon, 28 Dec 2020 06:12:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xdr4Q6Re; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438619AbgL1OIN (ORCPT + 99 others); Mon, 28 Dec 2020 09:08:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:42540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438568AbgL1OIC (ORCPT ); Mon, 28 Dec 2020 09:08:02 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 10C58207CC; Mon, 28 Dec 2020 14:07:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164441; bh=kxrCbyT3PxzfcGh20bH6TjoHTOAC0oaWrGIUi+f+FkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xdr4Q6ReOXEqlJQ4lM2zWRODZFReE5qx1zbdJqajn8n/ekGOAeMKO34cMrbL9qBMc GmwjADb/8JrIvW/VLzR5jJKlxYD2WtcZSW8pNX5akJQW9Kz7tx2BwG8UYIr7Kx9BDi l1tpam3g9p+sLPk6pI+jgz2QJ73klmPxGC4Z7elA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Carl Yin , Bhaumik Bhatt , Hemant Kumar , Manivannan Sadhasivam , Sasha Levin Subject: [PATCH 5.10 151/717] bus: mhi: core: Fix null pointer access when parsing MHI configuration Date: Mon, 28 Dec 2020 13:42:29 +0100 Message-Id: <20201228125028.200166670@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Carl Yin [ Upstream commit f4d0b39c842585c74bce8f8a80553369181b72df ] Functions parse_ev_cfg() and parse_ch_cfg() access mhi_cntrl->mhi_dev before it is set in function mhi_register_controller(), use cntrl_dev instead of mhi_dev. Fixes: 0cbf260820fa ("bus: mhi: core: Add support for registering MHI controllers") Signed-off-by: Carl Yin Reviewed-by: Bhaumik Bhatt Reviewed-by: Hemant Kumar Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam Signed-off-by: Sasha Levin --- drivers/bus/mhi/core/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index 0a09f8215057d..8cefa359fccd8 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -610,7 +610,7 @@ static int parse_ev_cfg(struct mhi_controller *mhi_cntrl, { struct mhi_event *mhi_event; const struct mhi_event_config *event_cfg; - struct device *dev = &mhi_cntrl->mhi_dev->dev; + struct device *dev = mhi_cntrl->cntrl_dev; int i, num; num = config->num_events; @@ -692,7 +692,7 @@ static int parse_ch_cfg(struct mhi_controller *mhi_cntrl, const struct mhi_controller_config *config) { const struct mhi_channel_config *ch_cfg; - struct device *dev = &mhi_cntrl->mhi_dev->dev; + struct device *dev = mhi_cntrl->cntrl_dev; int i; u32 chan; -- 2.27.0