Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2353908imm; Wed, 3 Oct 2018 02:30:41 -0700 (PDT) X-Google-Smtp-Source: ACcGV60Zz0XSOzF+huhBUWtTi8CYasPvaIcQEJOLvZjw5jsfyyux8dBsY2cU7JIJbvSjgJVcvh/N X-Received: by 2002:a17:902:2d24:: with SMTP id o33-v6mr666685plb.211.1538559041470; Wed, 03 Oct 2018 02:30:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538559041; cv=none; d=google.com; s=arc-20160816; b=YVUZKPtkUT7Lu3U4u3fImVBe5/6and3X9MXRlHLMswYoq2SiOSNCaNV3Ivxs07fIbG o5TFuUpUm76jwcYpX6Cd5rMACw+TxRge9+9XhWP5BSTRRFw4GnkcRAR0DD6R/zufqmuk k4OEvajBanf6CjIBN/Ax7sJ+UtINNk8/8MF35WMwjyzfVj9Bel8fTJfGrj68Gk33fb/2 Ijbeg352W6X598lii1Zxasijaq0rhd+PlLTxFqwhiagEpmknKqGEl06GmYFsmcGhxc4a 2VfP9YJbHRs0k6nEnt0N7Icy45okpVlRX6zMrD3lYTK4rmcXnQrrtddEwQ3ii5WjVbd8 aHBw== 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=xOeYcLJK6WhWPsNH3YpFgWMX7bTXZFi5kE3+lhsrDe0=; b=D/GFl6MUnz70TzBZkYvrOxv8o/IAOM/9M9EHlfph2em+0iTv9PjcPDyEKY4uJqxUSI vXn3NMAqCgTKYZzDvbkOMEMWdqzvhZPr3NhJDbnTibn8W/bXsLQAD1a35C29lrcGIhK2 NACPpwFjdyUv4aMRD9qW+o2lu2tPLNX3cMqFJjE4L83joYRHeQfFr9SuMXCPCvjbTnPT 8OlE8dZDrsaGWGArEYVh1ctcIToW1VPlwXDfKy5ffrhZ0rLCQu15OBmX8MpsdhJVSUmx QjvlYdHP51YFVs23JIc7KXWzwF2bW+gCzlIthOHVy3ClpcTGqa7q7Pd0NgFmZV8v2sl7 TfoQ== 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 p19-v6si1037796pfi.12.2018.10.03.02.30.25; Wed, 03 Oct 2018 02:30:41 -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 S1727761AbeJCQRE convert rfc822-to-8bit (ORCPT + 99 others); Wed, 3 Oct 2018 12:17:04 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:44037 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726724AbeJCQRD (ORCPT ); Wed, 3 Oct 2018 12:17:03 -0400 Received: from 79.184.253.194.ipv4.supernova.orange.pl (79.184.253.194) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.148) id 3776aaf8a60974ad; Wed, 3 Oct 2018 11:29:27 +0200 From: "Rafael J. Wysocki" To: Ronald =?ISO-8859-1?Q?Tschal=E4r?= Cc: Len Brown , Zhang Rui , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ACPI/sbshc: Fix rare oops when removing modules. Date: Wed, 03 Oct 2018 11:26:27 +0200 Message-ID: <6138243.jYEBpdSlFa@aspire.rjw.lan> In-Reply-To: <20181001025313.GA9144@innovation.ch> References: <20181001025313.GA9144@innovation.ch> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="iso-8859-1" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday, October 1, 2018 4:53:13 AM CEST Ronald Tschal?r wrote: > There was a small race when removing the sbshc module where > smbus_alarm() had queued acpi_smbus_callback() for deferred execution > but it hadn't been run yet, so that when it did run hc had been freed > and the module unloaded, resulting in an invalid paging request. > > A similar race existed when removing the sbs module with regards to > acpi_sbs_callback() (which is called from acpi_smbus_callback()). > > We therefore need to ensure no callbacks are pending or executing before > the cleanups are done and the modules are removed. > > Signed-off-by: Ronald Tschal?r > --- > drivers/acpi/osl.c | 1 + > drivers/acpi/sbshc.c | 2 ++ > 2 files changed, 3 insertions(+) > > diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c > index 8df9abfa947b..9d139727f164 100644 > --- a/drivers/acpi/osl.c > +++ b/drivers/acpi/osl.c > @@ -1129,6 +1129,7 @@ void acpi_os_wait_events_complete(void) > flush_workqueue(kacpid_wq); > flush_workqueue(kacpi_notify_wq); > } > +EXPORT_SYMBOL(acpi_os_wait_events_complete); > > struct acpi_hp_work { > struct work_struct work; > diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c > index 7a3431018e0a..5008ead4609a 100644 > --- a/drivers/acpi/sbshc.c > +++ b/drivers/acpi/sbshc.c > @@ -196,6 +196,7 @@ int acpi_smbus_unregister_callback(struct acpi_smb_hc *hc) > hc->callback = NULL; > hc->context = NULL; > mutex_unlock(&hc->lock); > + acpi_os_wait_events_complete(); > return 0; > } > > @@ -292,6 +293,7 @@ static int acpi_smbus_hc_remove(struct acpi_device *device) > > hc = acpi_driver_data(device); > acpi_ec_remove_query_handler(hc->ec, hc->query_bit); > + acpi_os_wait_events_complete(); > kfree(hc); > device->driver_data = NULL; > return 0; > Applied, thanks!