Received: by 10.213.65.68 with SMTP id h4csp755720imn; Sat, 7 Apr 2018 08:53:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx48wLC7J2ffWkDgn0Q7i5urL4J0gqDPrg1aJ6BdtdVI9nqEn50RbSAdAFOOHGL329o1r9nJy X-Received: by 2002:a17:902:8d82:: with SMTP id v2-v6mr32198770plo.101.1523116416929; Sat, 07 Apr 2018 08:53:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523116416; cv=none; d=google.com; s=arc-20160816; b=P5lLZ14WdugbH+cjYO1o0BcGGVEJeOCeDncAvDPUflBkPZnxaaeBvQsBVa5050v6mn J6ZlCPxwxIR1pQMBXYCh7fqDZGaK29/QmjzFlse0Iqm4n6NhlvyWZuZxdjSzNAAUfzdq AHqFUshTAtKCu6Tc2OxIHoAPSlP9UjweDYtlkPm074LWcX68SYzU0n1eRQ/WrV4AB0yu LWVnq/fw+i+EgGk7dOyuSxLjGrGLnb9HT1gfn2qLS443A47sJKo3A2OlB7hH2DNssLKK 9N23muxw9IPBgsV+tDa3vo07U3TRKOguJYwcQHh4+Sn61f3rhOVzxVNX5UwF/MoWuwNT tYJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=FfzTOlVLOKpUHm8TDYOj1tTbUN41CZUesEMGOUPmAHA=; b=dOXs5afqoMJY3aorPoC2EEMotSNsZeB+c8/0+F8pB9SbpRucD+xyebtkWTDuolq1eE z15te7jFlG3db3GIUp+AF5yxOsC7PYK0rBb4jmkEkhC3ZSOGsPmlKPAkvn5knES+2ng5 CURoGyVfkWW/7uZgwYlY0/jFYJBKxEUvE0HT62MwXIfnmDg4p3DhJ5WsPGjg+fy/Bymr yd5+w4/pFDz98xEEjhzcf6R/2PyL7OAwKY5TisoGTYYMT1/+9Qnu8JmOKNqe1W4B3ev2 Nilc2aTEqkVKH/8Qx3OulP3mj30osFR54XiAf8/FM/3popr42Y17d/Vbnzy20YQaoNbd LfmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@infradead.org header.s=bombadil.20170209 header.b=djc+mW8V; 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 w125si8652529pgb.190.2018.04.07.08.52.58; Sat, 07 Apr 2018 08:53:36 -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=neutral (body hash did not verify) header.i=@infradead.org header.s=bombadil.20170209 header.b=djc+mW8V; 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 S1751956AbeDGPuL (ORCPT + 99 others); Sat, 7 Apr 2018 11:50:11 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:60882 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751558AbeDGPuJ (ORCPT ); Sat, 7 Apr 2018 11:50:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=XTWpCxV6Ougzs5JNfigi1UJCAF9TZ05Kh1oEfEQiSqA=; b=djc+mW8VUhjOEJ4hHKqfrPhqmI 5Tr1jOCZv16bXiXkJviTmhk9HBuspmVcH1UiSicIzop2/7FJ2sW3RVho59s+qDmGIe5vB+w6mc5Uo GYzw3+jv/XBgUXeSqgf8bv2pX+yqybEmWPv9UtLC9Jz9ONq/7fY9DqHA85pI6RG5b2CbG1nOnlr6g GQ740RSCxEbxBgpoapwlJO0MiPhM926MHDz97EFFeuEiA2FiIoMfSuYTqCZ4+YpbZ1tarPWI7WvY4 boOEc4MIVzSNaRE2b3klwgAUykoHeRQsROIZLGgrf0co8h/NJBT6gyR3/9JtQUGeX2MdZPZOsUmC9 q5qM8Wtg==; Received: from dvhart by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1f4q6S-0007FZ-FZ; Sat, 07 Apr 2018 15:50:08 +0000 Date: Sat, 7 Apr 2018 08:50:06 -0700 From: Darren Hart To: =?iso-8859-1?Q?Jo=E3o?= Paulo Rechi Vita Cc: Corentin Chary , Andy Shevchenko , platform-driver-x86@vger.kernel.org, acpi4asus-user@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux@endlessm.com, Dun Hum , =?iso-8859-1?Q?Jo=E3o?= Paulo Rechi Vita Subject: Re: [PATCH] platform/x86: asus-wireless: Fix NULL pointer dereference Message-ID: <20180407155006.GA11256@fury> References: <20180407053729.5434-1-jprvita@endlessm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180407053729.5434-1-jprvita@endlessm.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 06, 2018 at 10:37:29PM -0700, Jo?o Paulo Rechi Vita wrote: > When the module is removed the led workqueue is destroyed in the remove > callback, before the led device is unregistered from the led subsystem. > > This leads to a NULL pointer derefence when the led device is > unregistered automatically later as part of the module removal cleanup. > Bellow is the backtrace showing the problem. > Thanks Jo?o Paulo, ... > Unregistering the led device on the remove callback before destroying the > workqueue avoids this problem. > > https://bugzilla.kernel.org/show_bug.cgi?id=196097 > > Reported-by: Dun Hum > Signed-off-by: Jo?o Paulo Rechi Vita > --- > drivers/platform/x86/asus-wireless.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/platform/x86/asus-wireless.c b/drivers/platform/x86/asus-wireless.c > index 343e12547660..ecd715c82de5 100644 > --- a/drivers/platform/x86/asus-wireless.c > +++ b/drivers/platform/x86/asus-wireless.c > @@ -181,6 +181,7 @@ static int asus_wireless_remove(struct acpi_device *adev) > { > struct asus_wireless_data *data = acpi_driver_data(adev); > > + devm_led_classdev_unregister(&adev->dev, &data->led); > if (data->wq) > destroy_workqueue(data->wq); > return 0; asus_wireless_add only calls devm_led_classdev_register() iff the workqueue is successfully created. It seems like it would make sense to move the devm_led_classdev_unregister() call within the 'if (data->wq)' condition block. This should also cc stable. Thanks, -- Darren Hart VMware Open Source Technology Center