Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3712140pxu; Mon, 30 Nov 2020 08:47:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7/+73448Uw7YGrFBzjMLwGhiYs3Qb//RQGjBL1cQsV7fBg/Ph/h9ALpfDynaTpMbTN7kV X-Received: by 2002:a05:6402:1155:: with SMTP id g21mr23451817edw.53.1606754849772; Mon, 30 Nov 2020 08:47:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606754849; cv=none; d=google.com; s=arc-20160816; b=FTAIver9uXd33TEM+eA6h/U92+612RRCDYQNTI1cAmtsTE/rKkyW4+MYamyaay0nMk C8jzVT2GlfwA6Yb23RyI/jLL7eEbCDweSEGh0dl7wsEtXeBSKnAbMhS3X95P7ZcO6+sc 8/WsDKeSbGrmOTpfjOb7VFre7CLjwp/PpXlSk/jZfpo1s4WaMPCkaP5BTrEQWu0PFy+u PhtTRLsKhFlp0LBgmxdM6s8lTg+mpf2Jdiocla60XW78lmyjGozjct/KK5NKhtsLjy37 aBFjkehd/fVQhcLN23W3+F6en5Tghsw6pxdwKU9MCgla1e8FLpq9+yZf6cqM7KvF+vbg nq4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=6Aj9qTViVOHCGvhmmXfPUv/vIUXbZzuXKzMiwCVk9dA=; b=ftGztD87cpKSRVLrSvHH1r8dYjyb2oR3Y4V0sAFrHVAtyxQFsibx6du2SmBfsP4u5O b1+7q1O6OJES4E9NtmpAYZczBof017Q+vHMrS63dQoGN3+gapLifHBuZbqxuDShb7AIj BwG2a+weDo2mu9OBbBkHXYYdZa66Us4fQyH03alrWH35JDH8nEFm41zevqUGTdLkX7AH Jq1+9tOvaReEFF6OVtvWasN/vdaHDBg2bLPh7Bn4DrgyPNOcdJ1IPwVyhmP3D02LEwzO 7E2YQzRtUNgi3X4KbS8M1W02kHJo+zDxxk/QhXNUobAIK41XPo6YnQSks6wAYojoqNL6 2KhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=vAenNzbh; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z16si11622321edi.476.2020.11.30.08.47.02; Mon, 30 Nov 2020 08:47:29 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=vAenNzbh; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728291AbgK3Qng (ORCPT + 99 others); Mon, 30 Nov 2020 11:43:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726770AbgK3Qng (ORCPT ); Mon, 30 Nov 2020 11:43:36 -0500 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFBA9C0613D2 for ; Mon, 30 Nov 2020 08:42:55 -0800 (PST) Received: by mail-ej1-x643.google.com with SMTP id lt17so23064320ejb.3 for ; Mon, 30 Nov 2020 08:42:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6Aj9qTViVOHCGvhmmXfPUv/vIUXbZzuXKzMiwCVk9dA=; b=vAenNzbhnM5r2BYN76rB5ZO5qCzDR5XUkM+SwTBret68X09UIwXSokyZdy5TT/qU8a nk15qM4d6gkNPcoDaaBEfMLXoN0PXLe4IzfL+q66F9gQCtbrWUdacULDr1SjgHCzY8Kk ukeK69U8Z0kAEu/0EpOTgAY6f0yne+BC/C4rTjkzxEYN+OVjR8NjdSiaGqhbUeY60ghI BY+QJmqrIdNJLpS+fye+x3FM6edHQJcxnM6YVy4IaGEAH19R55p0ZV4gj+B1jpDKkVuP oWT5mojQBy3I3WUtW+tO+T2FfHC4yiF/0jkIJL71SpCpN+Y9uWR+Z6Npv3L8XiY/Yzfe bhog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6Aj9qTViVOHCGvhmmXfPUv/vIUXbZzuXKzMiwCVk9dA=; b=Rw/3VauEX+C1fw5gpXTL7A2/52vIgNOrWDcA6K50MT7HN509gKwtlqnT/RO2pcsjO3 3MxxMB2o7XflqEnFq8J5mHp05SxCXwqvADJB4DpEhYvSjDV1Ltf6ksO35DoeV6Pemxp/ QtgBvmNR3kpOQI+7daPAHFup9wjJw+tr0KifChtQpX32aDXMfyd2zexoIsHWb0TVMwYU ekinl7i6qz9xufNeWGwfDBFCSFREy2tydJ0FiMRHhfEuoQGxtJvJotaPl8hbV8PQA8h8 39/YFyEjGY+TQHu562+N9qVxRc2Sv7hqlMGVFSoLr5sVAjCBlxQFhus/WA1++CInY3U9 KPOw== X-Gm-Message-State: AOAM530lAsDc+RecI8ojPPTLxiU29lLrB1KplUUHfSJ4eX0UPUDj6uKT HAOvqSRqIUlTAhFVKPVy40GfDeOcSu4HVZtNpe7LpQ== X-Received: by 2002:a17:906:15cc:: with SMTP id l12mr20845359ejd.363.1606754574134; Mon, 30 Nov 2020 08:42:54 -0800 (PST) MIME-Version: 1.0 References: <1606467002-62964-1-git-send-email-luojiaxing@huawei.com> In-Reply-To: <1606467002-62964-1-git-send-email-luojiaxing@huawei.com> From: Bartosz Golaszewski Date: Mon, 30 Nov 2020 17:42:43 +0100 Message-ID: Subject: Re: [PATCH v2] gpio: dwapb: fix NULL pointer dereference at dwapb_gpio_suspend() To: Luo Jiaxing Cc: Linus Walleij , Sergey.Semin@baikalelectronics.ru, Andy Shevchenko , Andy Shevchenko , linux-gpio , LKML , linuxarm@huawei.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 27, 2020 at 9:50 AM Luo Jiaxing wrote: > > Following Calltrace is found when running echo freeze > /sys/power/state. > > [ 272.755506] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010 > [ 272.755585] Call trace: > [ 272.755587] dwapb_gpio_suspend+0x18/0x318 > [ 272.755588] pm_generic_suspend+0x2c/0x48 > [ 272.755595] acpi_subsys_suspend+0x60/0x70 > [ 272.755599] dpm_run_callback.isra.18+0x40/0xe0 > [ 272.755601] __device_suspend+0xf4/0x360 > > The reason is platform_set_drvdata() is deleted, and dwapb_gpio_suspend() > get *gpio by dev_get_drvdata(). > > Fixes: feeaefd378ca ("gpio: dwapb: Use resource managed GPIO-chip add data method") > Signed-off-by: Luo Jiaxing > Acked-by: Serge Semin > Reviewed-by: Andy Shevchenko > > --- > v1->v2: > 1. reduce calltrace log > 2. delete blank line in tag block > --- > --- > drivers/gpio/gpio-dwapb.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c > index 2a9046c..4275c18 100644 > --- a/drivers/gpio/gpio-dwapb.c > +++ b/drivers/gpio/gpio-dwapb.c > @@ -724,6 +724,8 @@ static int dwapb_gpio_probe(struct platform_device *pdev) > return err; > } > > + platform_set_drvdata(pdev, gpio); > + > return 0; > } > > -- > 2.7.4 > Applied, thanks! Bartosz