Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp243118pxf; Wed, 10 Mar 2021 05:30:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzuBVeJRt6CdOvjS5qSzAn8Nk1NYFJ9U5Tap5MTgjZz9CWTYsSFkhKnus0oFC+4N8ekwGud X-Received: by 2002:a17:906:1c41:: with SMTP id l1mr3572936ejg.299.1615383032886; Wed, 10 Mar 2021 05:30:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615383032; cv=none; d=google.com; s=arc-20160816; b=SGZMW0FH5mCUFjFDFfjnZ9btSjIFwCTE7mGmgY1z0dUTcUqd8jGRdfWpwpmMvUvndF mTBPvuaa2jJrImdUgacLA29vefvbwrjBTd8jVAvXlbo0vJHaDdqQbR9Pn0LA7zS/rdu5 cR1ozJ+rQvbh3IdgkWXjst1WsWOs5Y5ws5WhBrwOzbqlyOcEK8ARjyIbXzPRtU4xwQUn UsKxBBW7qehlHkQ6Fbfaq9WkwMv03x9eYDFs126raz8qipi/+tSwMOyBBppimYcKV74j ZGfTl48BlkzrdGZucnWdTA4ufWdL/3TiUMDyTrUrWWPFM+ezlyF0FJ3E+idM4QhDmYCG UdIQ== 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=62kR/GCh9ATi0bxS4uzzwV+vBpZZM6H1rYoQGfBNDGs=; b=ZlRvNcAPRE/t8X+kE1IGbDO+7fSEN3ywQAlw1tCETurqoNzeRPdDpoGs1z83lPR9+T iP9BV7iKBUdAMHw3YzyZ27t3yRdGheQhvfW2rv6ZaPptyWk9VZRT7Lc1sk+orbwoY3km bCbwhJlgQ4N4YitXIFnn+8NK94JD7gPLmBKBQW5EKr7OSc1oiO98N6zioWJH3L62ab8o SJoq63ToS3MYLsp3u0rNN+oii+Y+fH5kv0WDrPFqL9FyuRhLivIQO8M2GuAivvszsrgJ ONBNIphgvDh6BkGLz4j1Un9qMN4z4Ugbv9JFuD5hraHRUQWs/hbwPsbJpV2+cRjVZbhg YA/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q+M52O+N; 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 m1si12465232ejq.592.2021.03.10.05.30.08; Wed, 10 Mar 2021 05:30:32 -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=q+M52O+N; 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 S232858AbhCJN1L (ORCPT + 99 others); Wed, 10 Mar 2021 08:27:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:46432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233130AbhCJNY5 (ORCPT ); Wed, 10 Mar 2021 08:24:57 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5517364FEF; Wed, 10 Mar 2021 13:24:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615382696; bh=bkk9e+K0PeWR2B3vg6L3EGwP4rJSltn/D6guNeruDvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q+M52O+N44dlIHFCSkMIJEaU5HPk65dmNbj8fg9g5ZCWDIKVBB0NOvpJvULvK+pEx b2khhxVFA4vfjhc19Mg7MNzstXATgPlQvwO4TOoJMH9sKlzXIcrkR6c5/MJiOvo1y/ HxXx6wGKqmlRrY4yvweFU/XUqJ6CdIwnePDe3/WM= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nishanth Menon , Roger Quadros , Pawel Laszczak , Peter Chen , Sasha Levin Subject: [PATCH 5.10 28/49] usb: cdns3: fix NULL pointer dereference on no platform data Date: Wed, 10 Mar 2021 14:23:39 +0100 Message-Id: <20210310132322.836195902@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210310132321.948258062@linuxfoundation.org> References: <20210310132321.948258062@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: Greg Kroah-Hartman From: Roger Quadros [ Upstream commit 448373d9db1a7000072f65103af19e20503f0c0c ] 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. Fixes: 7cea9657756b ("usb: cdns3: add quirk for enable runtime pm by default") Reported-by: Nishanth Menon Signed-off-by: Roger Quadros Acked-by: Pawel Laszczak Signed-off-by: Peter Chen Signed-off-by: Sasha Levin --- drivers/usb/cdns3/core.c | 2 +- drivers/usb/cdns3/host.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c index 29affbf1e828..6eeb7ed8e91f 100644 --- a/drivers/usb/cdns3/core.c +++ b/drivers/usb/cdns3/core.c @@ -569,7 +569,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_ALLOW))) pm_runtime_forbid(dev); /* diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c index c3b29a9c77a5..102977790d60 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; } - if (cdns->pdata->quirks & CDNS3_DEFAULT_PM_RUNTIME_ALLOW) + if (cdns->pdata && (cdns->pdata->quirks & CDNS3_DEFAULT_PM_RUNTIME_ALLOW)) cdns->xhci_plat_data->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; ret = platform_device_add_data(xhci, cdns->xhci_plat_data, -- 2.30.1