Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp91099imu; Wed, 7 Nov 2018 13:31:32 -0800 (PST) X-Google-Smtp-Source: AJdET5dPU2wJqgcSN7zsBSeWlexddc2jmDyYvL4qW5jH+6TUl96Ony3svSZ52SoZCONi7vtU2FRo X-Received: by 2002:aa7:814f:: with SMTP id d15-v6mr1987982pfn.78.1541626292459; Wed, 07 Nov 2018 13:31:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541626292; cv=none; d=google.com; s=arc-20160816; b=A0uEfxkhUyRLIw2OnWJdXOp8r2B2g9z8aBXnVUVLb92aR7yVqnATnYLHmI2+kIagPM 62DaMMRkUjgDM9pb7DH6wjQ0EDzNoahi/vNFiOjHl21F6SQqCXYYDChPEDCEKzDifHAD Gf2VDu0A6JrBHGDCW+yAINWRLmKqMlci5Da+avt2+7fORtJOBCCiz1iZT8uFrC4PDklb 2y1zWHckz470Y8fP8reQwbeAF8gPOkjP9q7sYlm6b/yM3SXEM3sLvvFVs26mKqNFUxqm hwLr0mCYf+g7xEustJkOCV668Ru9XIVvVHYEHw0WbdmcsDKDlqpw2zZS+u3YwoaO7Xo+ cW2Q== 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; bh=6vcWWTl3ebvipFnYFugbKnPUdf33cHwYS4fWiZH16YA=; b=i54I7A7LMm1OdexvoSxkaIUVG8m50Q+B2Eu8LA5Gbt4ce4/yyEQCI6K7o7+J4Ex+PC y+bsTtvFf2Fxt7u0beDXNfSuUFX8tVFyxwHSRgQcrl/uBRExyMeKC1GsWffoi3SYIo7U iQdtx5q2So/G66D+dw5rSHm9pKWhXTjlLUl9Vjdp/cnAPUnz83e40cY6Ea85uJKjsqo5 x9mg07Lfj5cAKFvgqF99E5bCYmMBKm6mKkj3XV65+lD+APf5Ub46ULBQq4Pld+Z9y5BG HUThieUzzOOcbl9eyKpJWzYSf1Gd4il5ai+k0QYgwp8EFmbH7YCMrW8wUipzspLOsjes c7lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pOIDwmxd; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v23-v6si1557820pff.103.2018.11.07.13.31.17; Wed, 07 Nov 2018 13:31:32 -0800 (PST) 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=pass header.i=@gmail.com header.s=20161025 header.b=pOIDwmxd; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727653AbeKHHBG (ORCPT + 99 others); Thu, 8 Nov 2018 02:01:06 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:46077 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727412AbeKHHBG (ORCPT ); Thu, 8 Nov 2018 02:01:06 -0500 Received: by mail-lj1-f194.google.com with SMTP id j4-v6so16085049ljc.12; Wed, 07 Nov 2018 13:28:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=6vcWWTl3ebvipFnYFugbKnPUdf33cHwYS4fWiZH16YA=; b=pOIDwmxdTU/5o5PxIuKV8jqM08VzZVV45NE7w5bIZ6ASsWOcQlLnBAk4evo7O2Fy14 Nh1S/HncUr8bAV1X4a13zthVzUXMQMEyeDOAIDyS6mYAymVnI6ltZ4gGD9v7+OeRGaY8 gwh171n6gPTE++MssLD+cDlkGQmpQARx+Kxrh9YCvyfAUqGlvtebYnNpe7F2SqXcpqBj Uin2qMpmEoXq7ohkRwf3sBR4w/6rPISPDds8ZRDlF2cegS2op4Pfe1lpE79oHMcRt+HK PnfbFVT8jwlx1wVdldXswmm5VCKfSWnuwNp6PcqqBvKzSZM21GTbgfiXTINLNoimhCrC eyFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6vcWWTl3ebvipFnYFugbKnPUdf33cHwYS4fWiZH16YA=; b=Mg/LORJcZHlJlEbFkogx4WvGkdQNHv2lRuxvAA+2fhfIWXKej7lN25hpALwvTDrm41 b5NZrNUrVdk/9vjp6WnjJsfqyhWOqq8NtOJpfchmUM3Tjv/uQXJgVAkxJTZtfhpY4w23 yjRYefbpKZacyO78PlPHwopiLRTjF+u+bIlZhz8MgryNE1bOod8kiFNc3qhmDw7487bV uJu7q92NXBx7U46gPbJ2Vf2PvFgv4THCo7dKwfxXdQQr2z39OSMUXXL6lmd3/ZSuoSOy /3Sl+dS1+iKl21ypuv78V99Pb2PzvL0MgiBMSU3PrFkHcDIyvObkU3jQd39CmFv2nym0 wOLg== X-Gm-Message-State: AGRZ1gJAgsEeDOvw7wqhG6dEVuZ/IeUhVtBXtT2Y5diOqLX/k8/MsTkt pRZwpm3Ca2/buZZCkucWBH0= X-Received: by 2002:a2e:9f56:: with SMTP id v22-v6mr1151189ljk.114.1541626130857; Wed, 07 Nov 2018 13:28:50 -0800 (PST) Received: from z50.lan (93-181-165-181.internetia.net.pl. [93.181.165.181]) by smtp.gmail.com with ESMTPSA id 18-v6sm310020ljp.49.2018.11.07.13.28.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Nov 2018 13:28:50 -0800 (PST) From: Janusz Krzysztofik To: Tony Lindgren Cc: Aaro Koskinen , Greg Kroah-Hartman , Jiri Slaby , linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Janusz Krzysztofik Subject: [PATCH] ARM: OMAP1: ams-delta: Fix possible use of uninitialized field Date: Wed, 7 Nov 2018 22:30:31 +0100 Message-Id: <20181107213031.21650-1-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.16.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While playing with initialization order of modem device, it has been discovered that under some circumstances (early console init, I believe) its .pm() callback may be called before the uart_port->private_data pointer is initialized from plat_serial8250_port->private_data, resulting in NULL pointer dereference. Fix it by checking for uninitialized pointer before using it in modem_pm(). Fixes: aabf31737a6a ("ARM: OMAP1: ams-delta: update the modem to use regulator API") Signed-off-by: Janusz Krzysztofik --- arch/arm/mach-omap1/board-ams-delta.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index 1947bc63074e..17e0b386e1b2 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -764,6 +764,9 @@ static void modem_pm(struct uart_port *port, unsigned int state, unsigned old) struct modem_private_data *priv = port->private_data; int ret; + if (!priv) + return; + if (IS_ERR(priv->regulator)) return; -- 2.16.4