* [PATCH] platform/x86: dell-smbios-wmi: Fix oops on rmmod dell_smbios
@ 2021-05-18 12:50 Hans de Goede
2021-05-18 22:40 ` mark gross
2021-05-19 13:29 ` Hans de Goede
0 siblings, 2 replies; 4+ messages in thread
From: Hans de Goede @ 2021-05-18 12:50 UTC (permalink / raw)
To: Mark Gross, Andy Shevchenko, Dell.Client.Kernel
Cc: Hans de Goede, platform-driver-x86, Mario Limonciello
init_dell_smbios_wmi() only registers the dell_smbios_wmi_driver on systems
where the Dell WMI interface is support. While exit_dell_smbios_wmi()
unregisters it unconditionally, this leads to the following oops:
[ 175.722921] ------------[ cut here ]------------
[ 175.722925] Unexpected driver unregister!
[ 175.722939] WARNING: CPU: 1 PID: 3630 at drivers/base/driver.c:194 driver_unregister+0x38/0x40
...
[ 175.723089] Call Trace:
[ 175.723094] cleanup_module+0x5/0xedd [dell_smbios]
...
[ 175.723148] ---[ end trace 064c34e1ad49509d ]---
Make the unregister happen on the same condition the register happens
to fix this.
Cc: Mario Limonciello <mario.limonciello@outlook.com>
Fixes: 1a258e670434 ("platform/x86: dell-smbios-wmi: Add new WMI dispatcher driver")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/platform/x86/dell/dell-smbios-wmi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/dell/dell-smbios-wmi.c b/drivers/platform/x86/dell/dell-smbios-wmi.c
index a1753485159c..33f823772733 100644
--- a/drivers/platform/x86/dell/dell-smbios-wmi.c
+++ b/drivers/platform/x86/dell/dell-smbios-wmi.c
@@ -270,7 +270,8 @@ int init_dell_smbios_wmi(void)
void exit_dell_smbios_wmi(void)
{
- wmi_driver_unregister(&dell_smbios_wmi_driver);
+ if (wmi_supported)
+ wmi_driver_unregister(&dell_smbios_wmi_driver);
}
MODULE_DEVICE_TABLE(wmi, dell_smbios_wmi_id_table);
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] platform/x86: dell-smbios-wmi: Fix oops on rmmod dell_smbios
2021-05-18 12:50 [PATCH] platform/x86: dell-smbios-wmi: Fix oops on rmmod dell_smbios Hans de Goede
@ 2021-05-18 22:40 ` mark gross
2021-05-18 23:08 ` mark gross
2021-05-19 13:29 ` Hans de Goede
1 sibling, 1 reply; 4+ messages in thread
From: mark gross @ 2021-05-18 22:40 UTC (permalink / raw)
To: Hans de Goede
Cc: Mark Gross, Andy Shevchenko, Dell.Client.Kernel,
platform-driver-x86, Mario Limonciello
On Tue, May 18, 2021 at 02:50:27PM +0200, Hans de Goede wrote:
> init_dell_smbios_wmi() only registers the dell_smbios_wmi_driver on systems
> where the Dell WMI interface is support. While exit_dell_smbios_wmi()
> unregisters it unconditionally, this leads to the following oops:
>
> [ 175.722921] ------------[ cut here ]------------
> [ 175.722925] Unexpected driver unregister!
> [ 175.722939] WARNING: CPU: 1 PID: 3630 at drivers/base/driver.c:194 driver_unregister+0x38/0x40
> ...
> [ 175.723089] Call Trace:
> [ 175.723094] cleanup_module+0x5/0xedd [dell_smbios]
> ...
> [ 175.723148] ---[ end trace 064c34e1ad49509d ]---
>
> Make the unregister happen on the same condition the register happens
> to fix this.
>
> Cc: Mario Limonciello <mario.limonciello@outlook.com>
> Fixes: 1a258e670434 ("platform/x86: dell-smbios-wmi: Add new WMI dispatcher driver")
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/platform/x86/dell/dell-smbios-wmi.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/dell/dell-smbios-wmi.c b/drivers/platform/x86/dell/dell-smbios-wmi.c
> index a1753485159c..33f823772733 100644
> --- a/drivers/platform/x86/dell/dell-smbios-wmi.c
> +++ b/drivers/platform/x86/dell/dell-smbios-wmi.c
> @@ -270,7 +270,8 @@ int init_dell_smbios_wmi(void)
>
> void exit_dell_smbios_wmi(void)
> {
> - wmi_driver_unregister(&dell_smbios_wmi_driver);
> + if (wmi_supported)
Something is fishy with this. wmi_supported is used in the
init_dell_smbios_wmi function so we shouldn't even be able to call this
function if wmi_supported == 0
is there a bug in the wmi framework where drivers that fail to init are not
removed from a list resulting in a failure to unregister? Is your fix hiding a
higher level issue?
Looking more shouldn't the prob function NOT get called if the init function
fails?
--mark
> + wmi_driver_unregister(&dell_smbios_wmi_driver);
> }
>
> MODULE_DEVICE_TABLE(wmi, dell_smbios_wmi_id_table);
> --
> 2.31.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] platform/x86: dell-smbios-wmi: Fix oops on rmmod dell_smbios
2021-05-18 22:40 ` mark gross
@ 2021-05-18 23:08 ` mark gross
0 siblings, 0 replies; 4+ messages in thread
From: mark gross @ 2021-05-18 23:08 UTC (permalink / raw)
To: Hans de Goede
Cc: Mark Gross, Andy Shevchenko, Dell.Client.Kernel,
platform-driver-x86, Mario Limonciello
On Tue, May 18, 2021 at 03:40:26PM -0700, mark gross wrote:
> On Tue, May 18, 2021 at 02:50:27PM +0200, Hans de Goede wrote:
> > init_dell_smbios_wmi() only registers the dell_smbios_wmi_driver on systems
> > where the Dell WMI interface is support. While exit_dell_smbios_wmi()
> > unregisters it unconditionally, this leads to the following oops:
> >
> > [ 175.722921] ------------[ cut here ]------------
> > [ 175.722925] Unexpected driver unregister!
> > [ 175.722939] WARNING: CPU: 1 PID: 3630 at drivers/base/driver.c:194 driver_unregister+0x38/0x40
> > ...
> > [ 175.723089] Call Trace:
> > [ 175.723094] cleanup_module+0x5/0xedd [dell_smbios]
> > ...
> > [ 175.723148] ---[ end trace 064c34e1ad49509d ]---
> >
> > Make the unregister happen on the same condition the register happens
> > to fix this.
> >
> > Cc: Mario Limonciello <mario.limonciello@outlook.com>
> > Fixes: 1a258e670434 ("platform/x86: dell-smbios-wmi: Add new WMI dispatcher driver")
> > Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> > ---
> > drivers/platform/x86/dell/dell-smbios-wmi.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/platform/x86/dell/dell-smbios-wmi.c b/drivers/platform/x86/dell/dell-smbios-wmi.c
> > index a1753485159c..33f823772733 100644
> > --- a/drivers/platform/x86/dell/dell-smbios-wmi.c
> > +++ b/drivers/platform/x86/dell/dell-smbios-wmi.c
> > @@ -270,7 +270,8 @@ int init_dell_smbios_wmi(void)
> >
> > void exit_dell_smbios_wmi(void)
> > {
> > - wmi_driver_unregister(&dell_smbios_wmi_driver);
> > + if (wmi_supported)
> Something is fishy with this. wmi_supported is used in the
> init_dell_smbios_wmi function so we shouldn't even be able to call this
> function if wmi_supported == 0
>
> is there a bug in the wmi framework where drivers that fail to init are not
> removed from a list resulting in a failure to unregister? Is your fix hiding a
> higher level issue?
>
> Looking more shouldn't the prob function NOT get called if the init function
> fails?
Never mind. After thinking it over this fix makes sence the init and exit
functions get called regardless of registering.
the fix looks good.
Reviewed-by: mark gross <mgross@linux.intel.com>
--mrak
>
> > + wmi_driver_unregister(&dell_smbios_wmi_driver);
> > }
> >
> > MODULE_DEVICE_TABLE(wmi, dell_smbios_wmi_id_table);
> > --
> > 2.31.1
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] platform/x86: dell-smbios-wmi: Fix oops on rmmod dell_smbios
2021-05-18 12:50 [PATCH] platform/x86: dell-smbios-wmi: Fix oops on rmmod dell_smbios Hans de Goede
2021-05-18 22:40 ` mark gross
@ 2021-05-19 13:29 ` Hans de Goede
1 sibling, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2021-05-19 13:29 UTC (permalink / raw)
To: Mark Gross, Andy Shevchenko, Dell.Client.Kernel
Cc: platform-driver-x86, Mario Limonciello
Hi all,
On 5/18/21 2:50 PM, Hans de Goede wrote:
> init_dell_smbios_wmi() only registers the dell_smbios_wmi_driver on systems
> where the Dell WMI interface is support. While exit_dell_smbios_wmi()
> unregisters it unconditionally, this leads to the following oops:
>
> [ 175.722921] ------------[ cut here ]------------
> [ 175.722925] Unexpected driver unregister!
> [ 175.722939] WARNING: CPU: 1 PID: 3630 at drivers/base/driver.c:194 driver_unregister+0x38/0x40
> ...
> [ 175.723089] Call Trace:
> [ 175.723094] cleanup_module+0x5/0xedd [dell_smbios]
> ...
> [ 175.723148] ---[ end trace 064c34e1ad49509d ]---
>
> Make the unregister happen on the same condition the register happens
> to fix this.
>
> Cc: Mario Limonciello <mario.limonciello@outlook.com>
> Fixes: 1a258e670434 ("platform/x86: dell-smbios-wmi: Add new WMI dispatcher driver")
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
I've added this to my review-hans branch now and I will also include this
in the next pdx86-fixes pull-req for 5.13.
Regards,
Hans
> ---
> drivers/platform/x86/dell/dell-smbios-wmi.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/dell/dell-smbios-wmi.c b/drivers/platform/x86/dell/dell-smbios-wmi.c
> index a1753485159c..33f823772733 100644
> --- a/drivers/platform/x86/dell/dell-smbios-wmi.c
> +++ b/drivers/platform/x86/dell/dell-smbios-wmi.c
> @@ -270,7 +270,8 @@ int init_dell_smbios_wmi(void)
>
> void exit_dell_smbios_wmi(void)
> {
> - wmi_driver_unregister(&dell_smbios_wmi_driver);
> + if (wmi_supported)
> + wmi_driver_unregister(&dell_smbios_wmi_driver);
> }
>
> MODULE_DEVICE_TABLE(wmi, dell_smbios_wmi_id_table);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-19 13:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 12:50 [PATCH] platform/x86: dell-smbios-wmi: Fix oops on rmmod dell_smbios Hans de Goede
2021-05-18 22:40 ` mark gross
2021-05-18 23:08 ` mark gross
2021-05-19 13:29 ` Hans de Goede
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.