From patchwork Wed Nov 7 21:30:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 10673101 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D0E3613A4 for ; Wed, 7 Nov 2018 21:29:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C167A2C5E9 for ; Wed, 7 Nov 2018 21:29:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B583C2CC7F; Wed, 7 Nov 2018 21:29:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,HK_RANDOM_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6C6CB2CC44 for ; Wed, 7 Nov 2018 21:29:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=4cV6T9dSn0FOjCvH4sEiQHK9P8ATdcR5V1BbYdVpZ5g=; b=I0a I38jno5y+rXoQsF/acLtX629XKID6dCAaw66+lny9+ItueA5NEzR+VMUOQUVoVxhd/BkV9t8Ztprl pVh7iB4GVi/NJCwXd1ZGn/kgpPXBnURctRFeW7rqiSGqlna7e7KLjxDCRMhTaTKcxTb+Ixr6XjRAW JKYs2aYH4ZVYZ7cw13wZtpcmrVg/LZExmqGFaVfTfZ4Y1I0CJweTIPAjhbSU01vNobNq+RAorKCL1 /X2MLLvVDGNyYDnssjThTO9Kb33+Gn1Gkp19EzscYqlvcBJJe931w40fiwBkau+8WDbmwVfE8iTOR 1RUBLj7aCSM/fURzg9XiFZJnshM6eTg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKVNp-0004E2-T4; Wed, 07 Nov 2018 21:29:05 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKVNn-0004D4-5p for linux-arm-kernel@lists.infradead.org; Wed, 07 Nov 2018 21:29:04 +0000 Received: by mail-lj1-x244.google.com with SMTP id z80-v6so16089521ljb.8 for ; Wed, 07 Nov 2018 13:28:52 -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=QfiICCYdyY4QpMtnLb/h7GCiansstskMrwvrAUmtb9fOrCpi5HXOUL7U9MbX4ulkc4 9ld2tPrhAkeslhrKHr8TdO3Ih/7bf30rSJyAy5r1mk7Zm3JHy68EXzGgBFHYUvDiSu/G rbiy/ZNjy2/vWtxaoOP8qcMB9wef8C9+lSkyYkBewlkYEZVH5WYMthxOHSyzr6FjsR4b 83+JOsRRXfrPzRd8Zc1i2K/lZ0kFCm6FjIXM453xQ7H5J8NlhbimGBPdrh+RnFyb6HF3 0+GnqdsnOaAGdU+hucXGBH5yHvBWB4MWVPPbkSjsgOHY9jqkFGke9CSNefvl9WzlNYMD JkKw== X-Gm-Message-State: AGRZ1gIAlOaxNuosaDsSaFkc6PyE7YunHwQwz7Q4x6PEIZpRn3om9Ahj 7fvJmzxP9FwlImGNyNqWadT6wajcGQU= X-Google-Smtp-Source: AJdET5fbY95RO7GxJweu85nwpTviRO1iml9J1JOewsMtlScCz6p6ro2SJGawcWca0LoDSIe58GAv7g== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181107_132903_212431_A65114F9 X-CRM114-Status: GOOD ( 11.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aaro Koskinen , Greg Kroah-Hartman , Janusz Krzysztofik , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Jiri Slaby , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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;