Received: by 10.213.65.68 with SMTP id h4csp147784imn; Thu, 15 Mar 2018 12:18:42 -0700 (PDT) X-Google-Smtp-Source: AG47ELscTr/MmEFKjEXUnwq1Poirkk5DaDsrt7jWBxsu89IE+qDtRngUL5iKgIGac+i3wLPO+JD8 X-Received: by 10.101.82.70 with SMTP id q6mr7412340pgp.67.1521141522888; Thu, 15 Mar 2018 12:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521141522; cv=none; d=google.com; s=arc-20160816; b=o6/1vgj442Zkl4kIeifSer6A2FT2AUd1UoqhOcokyDR8PgXmSsJ5kIK1eq+jpgpSbd XO7MnLozQN3tAP5ectdNmoDDCXCcITA+WVbA+6kKK8yA813nrpgP7c+gR/g732BAbe2X WDQpydPxAHUTeNE9KQQUNFQVIuiyFy/BDhynnQMlC/Ex8+FyhLELP/itXeO/hk7fEhn4 OuQBbGVWlgkHJ6EmRY4JTMvH1ShIGwEcRlfEheTMGp3wQYeQCjOewXEdQ4d4cTs3zZi2 A24lRbN+sxUFyqFSuqG6WNputki13qNHC3szU/ZZPtHfncF5nM28A7U1gMr6lmNlo/sV 4EZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=HBO3+nZoU0AaKMH5r0p8PdlPqjNzt8ec0qng7qWnwNU=; b=uRC3zRPg2OyrBIeT62BEtbTDBOrApOp90eesqNllhhpD/T48HnY/oOj/XncY5pNjpt jp5PsEJxh7RkUToZPXlFmyNmWzuX1oTI49683PzRRn0TSf5LRlxQRI34pgGsKrdvNJFJ LqrbmpInjW5LPVwAnd/ABLf0pCv6up6nwCcfuouWSdTrCUI2TV6dOvsm8WJeo7V2iM5M fAbAKPHfWBa8mC6qCGb8Q6JUnIFcStA0q17J/deiup8iGZ0scF5hLkIS0kTuP7HUOi8/ 3Rk8RK8DYAO6ybGUwu0VDm1+NZzGAkgZCpJ0dA4So9ZWpDaVE7GdH21aqN+JzVFm5N/k K0vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=ezkBSwM7; 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 t13si4189055pfa.294.2018.03.15.12.18.28; Thu, 15 Mar 2018 12:18:42 -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; dkim=fail header.i=@lechnology.com header.s=default header.b=ezkBSwM7; 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 S932652AbeCOTRc (ORCPT + 99 others); Thu, 15 Mar 2018 15:17:32 -0400 Received: from vern.gendns.com ([206.190.152.46]:38754 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752198AbeCOTR3 (ORCPT ); Thu, 15 Mar 2018 15:17:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=HBO3+nZoU0AaKMH5r0p8PdlPqjNzt8ec0qng7qWnwNU=; b=ezkBSwM7VnUQw3Q3Ogp0o6ArZi zGOEvPws3MELFxtj0WskFGnPbZgNfpAX9MEHlU9LKJ8uChL9UacJfuHav0Lkt9ZyWJ2zn7Dak1yEt m9jTMpDvEQhbtUi8jJDzatBG+J1DFBjfeebdp+cM4HyRPWLrzrGiIuMJauokZT5MEXWOhTnT2aF7v rRAvQHV8WAn6uCdFs4TajSUYsn/y9/I7pz6r4HLCzoH6pGeHiyEOcliZfDX0Mx2SfVxGL37yumRvb owmD06G/IbGnm5/6UoLKaojH7hkXN5RwtnFzSBjyX0qpvHe+3p3QKyiTuf0sNJMBXjGLDd0XQuA2v 1mqJX/vg==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:39472 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-SHA256:128) (Exim 4.89_1) (envelope-from ) id 1ewYLX-001MPB-82; Thu, 15 Mar 2018 15:15:27 -0400 From: David Lechner To: linux-arm-kernel@lists.infradead.org Cc: David Lechner , Sekhar Nori , Kevin Hilman , Bartosz Golaszewski , linux-kernel@vger.kernel.org Subject: [PATCH v2] ARM: davinci: DA8XX: fix oops in USB PHY driver due to stack allocated platform platform_data Date: Thu, 15 Mar 2018 14:17:20 -0500 Message-Id: <1521141440-16418-1-git-send-email-david@lechnology.com> X-Mailer: git-send-email 2.7.4 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This fixes a possible kernel oops due to using stack allocated platform data for the USB PHY driver on DA8XX devices. If the platform device probe is deferred, then we get a corrupt pointer for the platform data. We now use a global static struct for the platform data so that the platform data pointer does not get written over. Fixes: 9b504750923cb ("ARM: davinci: da8xx: Add USB PHY platform device") Signed-off-by: David Lechner --- arch/arm/mach-davinci/usb-da8xx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-davinci/usb-da8xx.c b/arch/arm/mach-davinci/usb-da8xx.c index 4d89d86..67d634b 100644 --- a/arch/arm/mach-davinci/usb-da8xx.c +++ b/arch/arm/mach-davinci/usb-da8xx.c @@ -26,6 +26,8 @@ static struct clk *usb20_clk; +static struct da8xx_usb_phy_platform_data da8xx_usb_phy_pdata; + static struct platform_device da8xx_usb_phy = { .name = "da8xx-usb-phy", .id = -1, @@ -37,14 +39,14 @@ static struct platform_device da8xx_usb_phy = { */ .init_name = "da8xx-usb-phy", }, + .dev = { + .platform_data = &da8xx_usb_phy_pdata, + }, }; int __init da8xx_register_usb_phy(void) { - struct da8xx_usb_phy_platform_data pdata; - - pdata.cfgchip = da8xx_get_cfgchip(); - da8xx_usb_phy.dev.platform_data = &pdata; + da8xx_usb_phy_pdata.cfgchip = da8xx_get_cfgchip(); return platform_device_register(&da8xx_usb_phy); } -- 2.7.4