Received: by 10.213.65.68 with SMTP id h4csp110712imn; Thu, 15 Mar 2018 11:04:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELsYIvhyj6xuW2moCR+Oj62uHqZ4zCM1W1S18ns8l+sJBLe0zpLm6Ss9aGCLxHo24NOn0zjR X-Received: by 2002:a17:902:14cb:: with SMTP id y11-v6mr9278136plg.23.1521137081639; Thu, 15 Mar 2018 11:04:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521137081; cv=none; d=google.com; s=arc-20160816; b=VVVxIVH00cvQAeiinGbQOpsKkaFXZJaGvdIxL4rY2GiEiuOutbsh6qqYiMKdfVYklo bMO8FW9rhaDj4JgbtU+2vVtQ1abKjBf1X0TTXo1UwEUCcA9QANPYmJ/w99gbsv0P0jTp PXezyTbZHvTzdLVlV05hOEAuERHDoIuSvT2+vDs7+7iHv84cLQcjG3oXMAcg6jj9OxFk XD+KPML+XV4r4A618RznSd/6tZ9lduu+4xZBaWAAVsy0C2JLUNI8dgOAHohIhtx0hc8F mjFu+9pGUveCc+mEA8Vrq9j/5ET/UFNg9ifjbKN0UHZh5EThIBnOnw92UBYw02dguA8b RMxQ== 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=97p7HepbHrSq+KDDaMu4p/yqYSWBFuR9rvTqM2GO+9c=; b=R/3YDju6Q+9hX9wVOOaVr748aqJ2ArTSAD3fJV7enyvII6woh+YnO/4Dt1OSI24sPq DQikQgS/2uij1Y36USjndIokzNTCHpXSS0cXlCY+Q3TJsu++tlEyL8FjKlr4eO0csl/Y 2CIb/mhzMN8kK8vLnExw8V2NEcafjAHs37uB+Lp+ZTEFyE/wTXHp1Of9t8RvIZPZFQdq +VTI2SvilOoKzjzJJxdRBcdbcBI08Bwgi4x9cZB0Gka6Q9HIYoolgMqQuScC7Cit0yCb wp3/Hq895FKtz9whpgjQYnukP3u2gbTSJUNNUf/SX/mKB6zq6lgJ9r+aPG0zYCd4ttAz jG/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=V376Optj; 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 n68si3746793pga.524.2018.03.15.11.04.26; Thu, 15 Mar 2018 11:04:41 -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=V376Optj; 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 S1752589AbeCOSDG (ORCPT + 99 others); Thu, 15 Mar 2018 14:03:06 -0400 Received: from vern.gendns.com ([206.190.152.46]:35797 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752006AbeCOSDE (ORCPT ); Thu, 15 Mar 2018 14:03:04 -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=97p7HepbHrSq+KDDaMu4p/yqYSWBFuR9rvTqM2GO+9c=; b=V376OptjbyzpVo/WZDW/Uy6RTs etOnKH5OE7sgtCuR0D7pZ/y4/EnMdWkCDke+uRp8sDHyN6kIikBT4ErppMrIDitD1hQOe8/Vs8m4H YRUO4YLwM9Rugrs0yuq2oSFVXxwCHd7B2jIZBW1/TVdwOM1bJ8+OxWe1dpQZtaNiMZ1CG6TtDtZHU aBTu8EmKhIAssmAnOwdPoMWYOEAJtz2OSjzd8EkCAiKhPZWsQ1gFeyOMP+csOmi+oIb8S1iSbDim3 b+HJyK9LgZLaUhp1uyOr6v2MI8hUYHdQ7QGr9eoOTcul8m4XdIztSzo/NzKk/oQ88MnK/Jjv8bnCQ qUR0QOVQ==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:38422 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-SHA256:128) (Exim 4.89_1) (envelope-from ) id 1ewXBY-001ASs-Bz; Thu, 15 Mar 2018 14:01:04 -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] ARM: davinci: DA8XX: fix oops in USB PHY driver due to stack allocated platform platform_data Date: Thu, 15 Mar 2018 13:02:56 -0500 Message-Id: <1521136976-32730-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. Tested on OMAP-L138 LCDK board using legacy board file. Fixes: 9b504750923cb ("ARM: davinci: da8xx: Add USB PHY platform device") Signed-off-by: David Lechner --- arch/arm/mach-davinci/usb-da8xx.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-davinci/usb-da8xx.c b/arch/arm/mach-davinci/usb-da8xx.c index b1e53e31..9ff9624 100644 --- a/arch/arm/mach-davinci/usb-da8xx.c +++ b/arch/arm/mach-davinci/usb-da8xx.c @@ -23,17 +23,20 @@ #define DA8XX_USB0_BASE 0x01e00000 #define DA8XX_USB1_BASE 0x01e25000 +static struct da8xx_usb_phy_platform_data da8xx_usb_phy_pdata; + static struct platform_device da8xx_usb_phy = { .name = "da8xx-usb-phy", .id = -1, + .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