Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1423903pxu; Mon, 23 Nov 2020 22:52:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJxgQ1Ssd45VV1ySTV+z7x2Fv+OgN5qwUXBz9g8br1MybyAzKDk7ScfmfXv+Mcn4PH5Radl5 X-Received: by 2002:a50:fe88:: with SMTP id d8mr2676881edt.36.1606200771613; Mon, 23 Nov 2020 22:52:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1606200771; cv=pass; d=google.com; s=arc-20160816; b=HMTG7wFuK2U2fJ69aXDs0xoYF9ZRVHNY3wak9Q8IHOdIwI/iEQEkokYXBufMfyJY2j WrC4umlzBGJW1CTfwhqqBPqXPa1u+pP9VXarYZJLWa0Lunc/B4ehiDY0fZYm9tMs0VNA cBq/oeRt4Zf7BamLhF4BtADqxPJeTWJvrM0sNxlKiGc6c5YSZxbwDgoYdVvex8Po5Bgu GTOD7naPRz8gHmpbIf6Eg+St7GiqXic0YZ1kBtk2ztUWzHBaothf3humNCvY0KdaJH9q vR/fERv80mc0HAA+7T7jAtQs89rNs7lLdZcN7tZAzQvAtV7mABOWD3fjbImwRsLqsglp va/w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=J5ZLoOxvx4T+WIUQDNJdUUtFmEwVgMIcNCMb7S4Sdm8=; b=hmCV4l+J+xQwnhWLorWkxf4pEGn0T9dnee+Wlp6ZpC6is487V1VVKLHXosfqfXw5Td Ka/HVFwh4OfcMtCcrisjSzW1Np83zwKxriOyPvc/NBH1qr4D6DkSuCe3N7cX3I1/IJyQ ylbmXC7iHaa4Y9FU+rgh9myBIWY6nAaqEyHvHDGmfz8MqDlmEgXTHZbDlyYtEGIn+DAh w7uVZcapWCPfZc45I8kKE50ZYsq5x7BVNmLB9covBPk2V0R4LhDKHU1qJ+ZzjUiT01jF fyfnUtu1MPFOplu67MqKEwjHCcMS38qdb9MLfl17dtNbIjmwRSbwAyQ4r7t1cJ7yDRan OEUQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=jGZuQcRA; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p15si8322562edq.35.2020.11.23.22.52.29; Mon, 23 Nov 2020 22:52:51 -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=@nxp.com header.s=selector2 header.b=jGZuQcRA; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729833AbgKXGtc (ORCPT + 99 others); Tue, 24 Nov 2020 01:49:32 -0500 Received: from mail-eopbgr30070.outbound.protection.outlook.com ([40.107.3.70]:24099 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725786AbgKXGtb (ORCPT ); Tue, 24 Nov 2020 01:49:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i+3om4+Ia4B++BpcNkGX/r9O4pIQi+Ctr/GGOkZ0fh2q02TxJL1HarUedJ9vQoncMvUvqlwYV2SBjF+zavqLUZ+RWGCP2lhhBRDMmiscT8kUHVCLRxSxeAu4s2eyNozzfWZmj0Mcz5Pz2F5G7Zpqn+l/PWrtbR5k0f+id9H9wNJOsYcsk31FkFZvWzajdI4WOjDc8Vai1/FKfuvwtiBdh+/ZypUWwmlOhvhiBLy/brVaeJbGPyQJNTpZMzclpH6wAiK0gPQmIh5BselXt8wAuGEam2Vkv3VsebivODUn7WLKfiflU4DvdY+p6kkYdoaJ1s/QTkaMVVzkYLBLGIA4SQ== 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=J5ZLoOxvx4T+WIUQDNJdUUtFmEwVgMIcNCMb7S4Sdm8=; b=lh7e3nlniojbk+IDcpsG+eZHA30NNbjYm+X1xaF80dN1T6ZxTMHP964rbFH3CXAQjTWpA5yoz1AFScl4+IS0iunypc1TkGe8kSR4BGMBhD5o9t6CoxHmHgBu3fQkSeSSeOhAJNS99m8ihC2u6mlRFVEIVxt+0IzwjsnwV0MINz/ZMkPLKsss+ofklotNFI/hzhzVCfLOKDW3U0PwkrTgg83mUEB1y0UxqnlOIn9sEP1ZcnwZTZ94925auMSy0r5/Zgiwg7Rw+5CYltnP46H/p1KMM5y5ekzT1aBgtGXI/ML2bKW3mISAh7GWpWVidIc14kWUpoN8CRLqZaOh+l5Vuw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J5ZLoOxvx4T+WIUQDNJdUUtFmEwVgMIcNCMb7S4Sdm8=; b=jGZuQcRAXx9yhQjW4ZB1C9p4AyedagYnOQRTIo4SbamCb61xoNRPPADQ0O146i8NHURNaJWM1yU9+xPmSU0aJJIQtN6awOfMBuHWC5gCjEtU+9MkNFWcX8wnOm5i3zhxfRxOUxtTiHGy2Txw08w5VZcqGrG9yASt4JE474nL5aI= Received: from DBBPR04MB7979.eurprd04.prod.outlook.com (2603:10a6:10:1ec::9) by DBBPR04MB7817.eurprd04.prod.outlook.com (2603:10a6:10:1ef::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.20; Tue, 24 Nov 2020 06:49:27 +0000 Received: from DBBPR04MB7979.eurprd04.prod.outlook.com ([fe80::c8c:888f:3e0c:8d5c]) by DBBPR04MB7979.eurprd04.prod.outlook.com ([fe80::c8c:888f:3e0c:8d5c%5]) with mapi id 15.20.3589.030; Tue, 24 Nov 2020 06:49:27 +0000 From: Peter Chen To: Roger Quadros CC: "pawell@cadence.com" , "balbi@kernel.org" , "nm@ti.com" , "nsekhar@ti.com" , "a-govindraju@ti.com" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] usb: cdns3: fix NULL pointer dereference on no platform data Thread-Topic: [PATCH] usb: cdns3: fix NULL pointer dereference on no platform data Thread-Index: AQHWwYZZgRghacfihUSnukQUanlqQqnW2K+A Date: Tue, 24 Nov 2020 06:49:27 +0000 Message-ID: <20201124064851.GB32310@b29397-desktop> References: <20201123104931.2653-1-rogerq@ti.com> In-Reply-To: <20201123104931.2653-1-rogerq@ti.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: ti.com; dkim=none (message not signed) header.d=none;ti.com; dmarc=none action=none header.from=nxp.com; x-originating-ip: [119.31.174.67] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 209b05af-c73d-4057-ba3c-08d89045163d x-ms-traffictypediagnostic: DBBPR04MB7817: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: DiZl9Ug5PKiEPYP2gt21bKW5AetlTtFITJ8YPpwm8AlON4fFPig/HL2yC/08CMvw2RP0bbeSiJhlqG8H29yRfuy4CV47x4oBrNxYeyOL6LPtYI5V81e0XT4J8oHuA0oXXbJJ5VVhfr4mfpTHq0pizUJgc46kvefYZ8U8b0DKb4wnSX4Bu7HWhkANflmL32zPQlJMH7PiztcKrz5rnHQenFEc7D2FmD26amzhzLmx/vaZDo6ZSG87jiorKhvcS5o/pxrGvAsdoYyqVPN/nDjY2CdBOB+h3oeJghuXDxaKYLbNBXB4fj+sLQqQA50TV4AqrKd7H8XkqmxFHxoDEHxfAQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DBBPR04MB7979.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(7916004)(376002)(396003)(136003)(366004)(39860400002)(346002)(83380400001)(33656002)(2906002)(8936002)(8676002)(6486002)(5660300002)(44832011)(9686003)(6512007)(316002)(86362001)(4326008)(6506007)(71200400001)(66446008)(186003)(54906003)(33716001)(76116006)(91956017)(26005)(66946007)(66556008)(478600001)(6916009)(66476007)(53546011)(1076003)(64756008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: 0aGOQ1gNSAHuAu7QytKWKbrPzMa0r9fosKA188c8SZeBmn+dDNisJ9z3xd+cjRopJamxBfVUcqSldu1xieRIIv2BgnFhff0E1V58FEsGRnjIV2V/8ubCIgTKQNWELT649vJBuioifod91Al1OJha/53HjPqZSM/z7ofBoIw/Hmb1wsxyM/TERk019wzyN13oBFKhAqBNMZu7uQuAmklw8uRpn1zAnIj2m+hrnj2xxpadSoNuKZecJ3N123mRGmr7xrw1LiRctNPtWeMEtA/gBZyiQ9KuQwxgDXO2KHGS9GXpcgDK7ApXapjE3RP0BmN5le6+a9e3f+umvKpixmVOjk7QH2CQA5L2vHuh5a+LstONbTn8UQJjjE0NifiMXb/g7dM0f7MxNV+0y8/NCfAeqcclhknpqz7fJtTvzSuiLHFwebwlCh1dTJRLTLnw3fNOMPF5cuy562LzNUHlJY50gqp/BatgptJHDqMIRzVmEdxEXkBYdIZhtkG/abbIBVYcs7MKnpPl9vs+bsOg3YnTgoVLwJMq5vIeHANRFa7HKxLqCQMFKiIdRKscBEWGBs6kS4XN04iVu9ybDpLWNIOciRB8FvnIBCGFOSNLJ/BMdtUi0hiY3Fc974ZfiQ4ePpW3ey1hUh+vtXqEz/z9BTK9ZVlt6m/0WYEbx8U0Ea/AJlRHGbocPcAB2zGtdHnD376HvA8Awxq4nmuGBirismT1fv8g+5Ct7eau1OGWYEZHNAAvzyWCQMjoPxTBgj+UW6Hn2f80fNbTmO2ieDL4fA0sjhGJHylovKU/z2GXObewoj4Ar2v8naMGMQ3ZEW5HXBmD44+o7zOtNO0oND1e59eTrKaP/bCeTf7d2Pzb8I+ExyH7ufZnO4OONA2yEV76RWfEXat5lW5MUddLckk2sUkpkg== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DBBPR04MB7979.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 209b05af-c73d-4057-ba3c-08d89045163d X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Nov 2020 06:49:27.2615 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 1SZ4tJIFQtWyASmzAJBtkw+E+wN8AlcP25xU1cwSt2W/BA5rEfdZIeFH5ahHqLkqPpDOURyDPeRauaUU0FbwCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7817 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20-11-23 12:49:31, Roger Quadros wrote: > Some platforms (e.g. TI) will not have any platform data which will > lead to NULL pointer dereference if we don't check for NULL pdata. >=20 > Fixes: a284b7fd1b8f ("usb: cdns3: add quirk for enable runtime pm by defa= ult") > Reported-by: Nishanth Menon > Signed-off-by: Roger Quadros > --- > drivers/usb/cdns3/core.c | 2 +- > drivers/usb/cdns3/host.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c > index 54d841aa626f..0f08aebce86d 100644 > --- a/drivers/usb/cdns3/core.c > +++ b/drivers/usb/cdns3/core.c > @@ -559,7 +559,7 @@ static int cdns3_probe(struct platform_device *pdev) > device_set_wakeup_capable(dev, true); > pm_runtime_set_active(dev); > pm_runtime_enable(dev); > - if (!(cdns->pdata->quirks & CDNS3_DEFAULT_PM_RUNTIME_ALLOW)) > + if (!(cdns->pdata && (cdns->pdata->quirks & CDNS3_DEFAULT_PM_RUNTIME_AL= LOW))) > pm_runtime_forbid(dev); > =20 > /* > diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c > index 08103785a17a..ec89f2e5430f 100644 > --- a/drivers/usb/cdns3/host.c > +++ b/drivers/usb/cdns3/host.c > @@ -59,7 +59,7 @@ static int __cdns3_host_init(struct cdns3 *cdns) > goto err1; > } > =20 > - if (cdns->pdata->quirks & CDNS3_DEFAULT_PM_RUNTIME_ALLOW) > + if (cdns->pdata && (cdns->pdata->quirks & CDNS3_DEFAULT_PM_RUNTIME_ALLO= W)) > cdns->xhci_plat_data->quirks |=3D XHCI_DEFAULT_PM_RUNTIME_ALLOW; > =20 > ret =3D platform_device_add_data(xhci, cdns->xhci_plat_data, Thanks for fixing it, already applied to -next tree. --=20 Thanks, Peter Chen=