Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp3259267pxx; Mon, 2 Nov 2020 04:29:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJwMHfG0TqDAoe4zKCt1NvBq0s+vMdzzw/PO66lvhCDBgiXk67lsVpye9cwag1HUzbwNjf3B X-Received: by 2002:a17:906:a195:: with SMTP id s21mr14371167ejy.146.1604320196231; Mon, 02 Nov 2020 04:29:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1604320196; cv=pass; d=google.com; s=arc-20160816; b=eeqwfF0go5pxpGzYXk9X3tcraVdBFoIoyERoczB+pwYKeZHmaW6Xd8DA7DyD29xVvS I5EexB+WyiTN6Vc3le74iNR7SBu1FLp7OSV6pYtL3K4a7tTVhvAewFECxs8Ptoih2IwZ A5pjsxlmSLMMZ/Z4QhnHCF1EpoYfHYaHpP6kHTk+HM9uRuvlmdK/k07GBVo3hlQxlpjD iOutF6H158onpjHg9vQiecxHl4EjozaKCZ++B2IdqPzb2lcOO0vqLyqyc7MiLv3jWmzf 37w/dpiI89cyn5ayoRWDgycn9tZVnO34Oyc9FWatcjAoZjGDH8kNnpsim3JIDckUXvKt EGdQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=PVHzbeI/KEEVJb3fByHYJfrYeAfRYsjUbGs8A7Z2srY=; b=TfeP4GgQczjro07yGu43PafgLq79ULrt+kffUpXQ8JLe+glir5btP4r+gx5lGL/dMW ZFAJQoPyrx1XeV8VeICv91jP8umx11CEXSKk7KbZixLMpY5BIXOOkLdAMB6IhNPdZQH3 L2BoFc4PORB3cE/4NuoPuWAbCD1kPSgG5wiL5fHt0AMhoBf7ib8wohlF+2HfKtP0PXiq OZxzVjFJ3rY4PsRip23G8x1p0c14hLZa2A0ZBDSmO0b4l3eSL/LPpuglw4qSW9t0TvgX yT30eHNxgK5pwKwmop/QvqVTlLqWUlaaSdq2a87c5DoJ+7YVJeqKrlL8Zd066bPYzGAq KL8Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quectel.com header.s=selector2 header.b=AbgnE8WS; arc=pass (i=1 spf=pass spfdomain=quectel.com dkim=pass dkdomain=quectel.com dmarc=pass fromdomain=quectel.com); 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y6si10917391edm.295.2020.11.02.04.29.33; Mon, 02 Nov 2020 04:29:56 -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=@quectel.com header.s=selector2 header.b=AbgnE8WS; arc=pass (i=1 spf=pass spfdomain=quectel.com dkim=pass dkdomain=quectel.com dmarc=pass fromdomain=quectel.com); 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728631AbgKBM1x (ORCPT + 99 others); Mon, 2 Nov 2020 07:27:53 -0500 Received: from mail-eopbgr1300074.outbound.protection.outlook.com ([40.107.130.74]:44858 "EHLO APC01-HK2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728359AbgKBM1w (ORCPT ); Mon, 2 Nov 2020 07:27:52 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bt6U0uVOg6vRtFWkh6ovxdA00lYG9jqlj7/GT9IV798and/9ZKpWHXJoAbRd67hYy4apPwivRP+avorY1NvxZYcQqwPYJEvaNjsvo1IEkBL9EKPu/2C/IvcY4XV+EBKtUqH0rx3gYRZN3a5a5raxmqg0a7357m+mw/GPnRr68hg0aoRutUvvCnIf3YXAB4Ddgy3PLcP41McgtF0Fr5vdGhXg9SpzbNRcgdU1mwy1lo4500+3HXg1/M3xz74kWPbNaQda7MbVzi5XkdbjbHnCE+9i5OII/aiDnsSlZTh0QPYM58CDsdgK7t5uSt6LfD5YwfPdGxIf4M88emw2TZWe4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PVHzbeI/KEEVJb3fByHYJfrYeAfRYsjUbGs8A7Z2srY=; b=oCcN+djIxEWB0miIIj6XniNjXl8/1nnihsFr/bjLRYX+Jx1S0BZrTAEv1LEGtcBvlGUSGnkX8FKGHYmemhfcvDQrbfAEhbKsoFBgFQ3uiuM8JKXRRR+ZkbMdMp37ena/qbSFFsXOyh1T1bUJMKxWmvV99w9viXk5oEnA+xemhkWv9RhlANsjEW3Z7bro53i4kienZmcah7xgfP5BleVevQKKgLzWLMvpbkTS+Qz1BO9rN+NHUnrIZfkkxjkc/8uZuo7/hIiAnCeNfMNHn1NZGWAmGImqPpU1wY+ArThvNkc8s9C3jmTr/WuN+WGAUo45sqGXEyMPV/SnqWqFBpx0SA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=quectel.com; dmarc=pass action=none header.from=quectel.com; dkim=pass header.d=quectel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quectel.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PVHzbeI/KEEVJb3fByHYJfrYeAfRYsjUbGs8A7Z2srY=; b=AbgnE8WSSvHpk7xtJSaKatgNVJMf6q/jEYv3Fc4SUolvfHciheOjGu5HfB8t6hOQ8hN0mDc4bx8CZ7Kpxyplbqa0XGgGkK2ft7gSVvk7WWn/DGaB7WSWHrfpmrQ4+HfCCaCeNBp4dlsEghga760s/fl5E1+eu9bPUIrfK+6iqQM= Authentication-Results: linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=none action=none header.from=quectel.com; Received: from HK2PR06MB3507.apcprd06.prod.outlook.com (2603:1096:202:3e::14) by HK0PR06MB2225.apcprd06.prod.outlook.com (2603:1096:203:50::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Mon, 2 Nov 2020 12:27:46 +0000 Received: from HK2PR06MB3507.apcprd06.prod.outlook.com ([fe80::94f:c55a:f9c8:22f4]) by HK2PR06MB3507.apcprd06.prod.outlook.com ([fe80::94f:c55a:f9c8:22f4%5]) with mapi id 15.20.3499.029; Mon, 2 Nov 2020 12:27:46 +0000 From: carl.yin@quectel.com To: manivannan.sadhasivam@linaro.org, hemantk@codeaurora.org, sfr@canb.auug.org.au Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, carl.yin@quectel.com, naveen.kumar@quectel.com Subject: [PATCH v2] bus: mhi: core: Fix null pointer access when parsing MHI configuration Date: Mon, 2 Nov 2020 20:27:10 +0800 Message-Id: <20201102122710.23406-1-carl.yin@quectel.com> X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-Originating-IP: [203.93.254.82] X-ClientProxiedBy: HK0PR03CA0102.apcprd03.prod.outlook.com (2603:1096:203:b0::18) To HK2PR06MB3507.apcprd06.prod.outlook.com (2603:1096:202:3e::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (203.93.254.82) by HK0PR03CA0102.apcprd03.prod.outlook.com (2603:1096:203:b0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Mon, 2 Nov 2020 12:27:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b94d863f-c403-41e6-da98-08d87f2ab3f9 X-MS-TrafficTypeDiagnostic: HK0PR06MB2225: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1468; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2f7buR906Cjj5QQ4MpFjZm+KTI/QcUa+Xy1P5sZz96aGmmTlO789d/IlFx5pttWMzSP97WGy3MjxkJnpR+Gcj+EK4iLvQmjqt6qXE1nsFkdqO1y1jT0fK/ezFYmRP0uUjEG3gkUGArbNLb3QfMhpea0OeKzoteZiU0c9oPvHgBdxEpJeg4RSQmudM9u685T6PA8tLWt57aI4YBymcfpK37R4tHivPyKDfBlbKrVsAFAZtf3ZkcBY09t6ORr/mHekF8y5txe33vJFKVy8LTQO9EeWO6RP65K0CqLWE/k0pfbKzPNwbznyqvaUASOTG9bqQAAhcVxbHr/2I9UQHGBV6RwN4T1Nq2tM9GjKFu/PRioHyGCG6t00lMbO8fjMA4/U X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HK2PR06MB3507.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(346002)(136003)(39860400002)(366004)(396003)(26005)(956004)(69590400008)(83380400001)(186003)(316002)(2616005)(66476007)(66946007)(478600001)(66556008)(16526019)(4326008)(6506007)(52116002)(8676002)(6486002)(36756003)(2906002)(8936002)(1076003)(6512007)(9686003)(5660300002)(86362001)(6666004)(107886003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: x8xB+mrNJI0IBjOqgdiIOv0C4R4/WINxihw4pgKGfVGOR88FjNqmeYzUumZXR7+wW6D7q/j80M0tj2ZPjOerG9B/XdVIhWMXhQmqczC09EXxov7fz2qY5RprMAI4k0bMwSqCCiODTLpHvPBeYXXU2k0U6UWYd/5B4rL/U1ASRFxtLfUG+z6pHYntlRobOeszNQ9vfwDXFtzMr2FBfDUHDc9g02h+Zml/Iu+PZoe+NaX/yMv8yqItrtw3LvVPDiPrlHbSIgqfU7AgSrwdUYd8VkgqvhWGgBkAxDmMcOQlf0jxYzUsI8RvwtgyG2mlb4Dy/qj5XSOyhdeJ1gX0n8SARRAA1EQSfllfZEdVsVhLnozi5wrWd1xWpJR5tWXPichEukXMvwDDELk//Xwkj5r12v3W7oUTpij6ZxLP/lbbMVkUSnEIMDUY1Zfbd19Ekwh6cdEKXPtCCLiOdT6lPWzrJCQo/E80NXffl3wzgJlU0Ss0jbg9vV2JE56PbarMG6JTQmoun6+wPiK+S0r6WmeXJHwL9RUYzbddRTZDgVgEW1VNjF1YC/lcB24NyE/oIHqltQRNi7/XRVo1so9hmPcBHQPJtbVYfoyP1mGK8hc8QQXzJjc0n1RH54vohO080lyKIknCdi7m+wQNVK63yIftjQ== X-OriginatorOrg: quectel.com X-MS-Exchange-CrossTenant-Network-Message-Id: b94d863f-c403-41e6-da98-08d87f2ab3f9 X-MS-Exchange-CrossTenant-AuthSource: HK2PR06MB3507.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2020 12:27:46.1133 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 7730d043-e129-480c-b1ba-e5b6a9f476aa X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: A1NS+MF5uP6GDTBBdTVA2ap//IRqqjraxU5ZM0SwP+pKnL2uHZ0t0LfDHx6YljM+zXA5QyUR6D9y+WMCW4WwiA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK0PR06MB2225 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "carl.yin" 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 --- 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 0ffdebd..c6b43e9 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.25.1