Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp473808ybb; Wed, 25 Mar 2020 03:38:27 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvN5CXGKsVAM6cOlg5PLVwWJttn6x85lkz1PILayc7KqssbTyme2afMMuZfEFaiphwfljkS X-Received: by 2002:a05:6830:1e38:: with SMTP id t24mr1888444otr.125.1585132706952; Wed, 25 Mar 2020 03:38:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585132706; cv=none; d=google.com; s=arc-20160816; b=ldaQ9UKqwVh+NyJOIJSrwo4etq+AnKUt1Ycj3c/BvRTDJAgEthiDA+BvhpQKLbkFMg zfCufgpPEgZv1PItIy7IgMOKK9Osbhf6poLOFxej/zJEuZZT/7/rKsATgzbTAopa21GC LHOpI7W6l9P3jn0C65iCpgKN5RK2AsmiJlQC7sZ+1w015vL5cqzwhtn8FUYff8OtZJvP iUKa8ZMPirmGgKFWowG9Rj8yB9hMStVv4yQwMlkvuiPF6fHZ4G6ZNiWPr22jgzpQClBz vwWq4QxOHoDqBKY7hq43n3xnyDI5XyB1nq/lI7w8+PCkKF6T3p63GMJ2ARNM3OiLZf92 U2hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=DlLW89XwpBO8E7laTz1NTUu9kDyYvZx5YM54xOpswfI=; b=s9KjpWsKWTjqoOCJDu1BuTX+0eaeg35SdsHFmNKStOZ2Ke49UuyzMZA8w0ImCOenf8 GKrFjMIDHBdeRS6MmPvfFJGznxivDUNhd1YSC7RMu7xcpCqXCXnBYU2LUqK5HWff2tmd n7+6OF15FnYxy7/LS5YXjrgStfQEg1QfpRdvaOsSiTv4ouOnFyL2JliPuhDggScZKWnW lYp+FfQB801xyZkcQW4WNhV/htasD3OPxyuC5xqZDJLu8MMYx9GNbcVb4kyH7JIaCc2a bQEoFybmZwtn/cd/kS7kz2ZKqZy6R7qsaixeDNN4Sta0HMyuTCYXBU6JgY1o9yU6CRau jLPg== ARC-Authentication-Results: i=1; mx.google.com; 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 o18si11022425otk.80.2020.03.25.03.38.13; Wed, 25 Mar 2020 03:38:26 -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; 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 S1727525AbgCYKhw (ORCPT + 99 others); Wed, 25 Mar 2020 06:37:52 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:55216 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726276AbgCYKhv (ORCPT ); Wed, 25 Mar 2020 06:37:51 -0400 Received: from 185.80.35.16 (185.80.35.16) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.341) id 9e7838f87465dcf7; Wed, 25 Mar 2020 11:37:49 +0100 From: "Rafael J. Wysocki" To: Neeraj Upadhyay Cc: pavel@ucw.cz, len.brown@intel.com, gregkh@linuxfoundation.org, swboyd@chromium.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, irgeorgiev@codeaurora.org, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH] PM / wakeup: Skip wakeup_source_sysfs_remove if device is not added Date: Wed, 25 Mar 2020 11:37:49 +0100 Message-ID: <45310800.nJ51lTlq64@kreacher> In-Reply-To: <1584940131-1591-1-git-send-email-neeraju@codeaurora.org> References: <1584940131-1591-1-git-send-email-neeraju@codeaurora.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday, March 23, 2020 6:08:51 AM CET Neeraj Upadhyay wrote: > Skip wakeup_source_sysfs_remove(), to fix null pinter access of > ws->dev, if wakeup source is unregistered before wakeup class > is registered from device_add(). > > Fixes: 2ca3d1ecb8c4 ("PM / wakeup: Register wakeup class kobj after device is added") > Signed-off-by: Neeraj Upadhyay > --- > drivers/base/power/wakeup.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c > index 27f3e60..f8f8c0a 100644 > --- a/drivers/base/power/wakeup.c > +++ b/drivers/base/power/wakeup.c > @@ -241,7 +241,8 @@ void wakeup_source_unregister(struct wakeup_source *ws) > { > if (ws) { > wakeup_source_remove(ws); > - wakeup_source_sysfs_remove(ws); > + if (ws->dev) > + wakeup_source_sysfs_remove(ws); > wakeup_source_destroy(ws); > } > } > Applied (with some minor changes) as 5.7 material, thanks!