Message ID | 1252925033-29696-4-git-send-email-corentincj@iksaif.net (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Matthew Garrett wrote: > On Mon, Sep 14, 2009 at 12:43:53PM +0200, Corentin Chary wrote: > >> rfkill_unregister() should always be followed by rfkill_destroy() >> >> Cc: Matthew Garrett <mjg@redhat.com> >> Signed-off-by: Corentin Chary <corentincj@iksaif.net> >> > > Acked-by: Matthew Garrett <mjg@redhat.com> > > I can endorse this as I already submitted something similar :-). <http://patchwork.kernel.org/patch/42699/> (with a disclaimer that it was not tested on dell hardware). -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Monday 14 September 2009 13:02:39 Alan Jenkins wrote: > Matthew Garrett wrote: > > On Mon, Sep 14, 2009 at 12:43:53PM +0200, Corentin Chary wrote: > >> rfkill_unregister() should always be followed by rfkill_destroy() > >> > >> Cc: Matthew Garrett <mjg@redhat.com> > >> Signed-off-by: Corentin Chary <corentincj@iksaif.net> > > > > Acked-by: Matthew Garrett <mjg@redhat.com> > > I can endorse this as I already submitted something similar :-). > <http://patchwork.kernel.org/patch/42699/> (with a disclaimer that it > was not tested on dell hardware). I haven't seen your patch, sorry :/ It also conflicts with http://patchwork.kernel.org/patch/42705/ (I set wlan_rfkill to NULL to avoid use-after-free). Let's drop this patch and merge your series
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index 74909c4..c81002c 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c @@ -206,6 +206,25 @@ static const struct rfkill_ops dell_rfkill_ops = { .query = dell_rfkill_query, }; +static void dell_free_rfkill(void) +{ + if (wifi_rfkill) { + rfkill_unregister(wifi_rfkill); + rfkill_destroy(wifi_rfkill); + wifi_rfkill = NULL; + } + if (bluetooth_rfkill) { + rfkill_unregister(bluetooth_rfkill); + rfkill_destroy(bluetooth_rfkill); + bluetooth_rfkill = NULL; + } + if (wwan_rfkill) { + rfkill_unregister(wwan_rfkill); + rfkill_destroy(wwan_rfkill); + wwan_rfkill = NULL; + } +} + static int dell_setup_rfkill(void) { struct calling_interface_buffer buffer; @@ -256,14 +275,17 @@ static int dell_setup_rfkill(void) return 0; err_wwan: rfkill_destroy(wwan_rfkill); + wwan_rfkill = NULL; if (bluetooth_rfkill) rfkill_unregister(bluetooth_rfkill); err_bluetooth: rfkill_destroy(bluetooth_rfkill); + bluetooth_rfkill = NULL; if (wifi_rfkill) rfkill_unregister(wifi_rfkill); err_wifi: rfkill_destroy(wifi_rfkill); + wifi_rfkill = NULL; return ret; } @@ -369,12 +391,7 @@ static int __init dell_init(void) return 0; out: - if (wifi_rfkill) - rfkill_unregister(wifi_rfkill); - if (bluetooth_rfkill) - rfkill_unregister(bluetooth_rfkill); - if (wwan_rfkill) - rfkill_unregister(wwan_rfkill); + dell_free_rfkill(); kfree(da_tokens); return ret; } @@ -382,12 +399,7 @@ out: static void __exit dell_exit(void) { backlight_device_unregister(dell_backlight_device); - if (wifi_rfkill) - rfkill_unregister(wifi_rfkill); - if (bluetooth_rfkill) - rfkill_unregister(bluetooth_rfkill); - if (wwan_rfkill) - rfkill_unregister(wwan_rfkill); + dell_free_rfkill(); } module_init(dell_init);
rfkill_unregister() should always be followed by rfkill_destroy() Cc: Matthew Garrett <mjg@redhat.com> Signed-off-by: Corentin Chary <corentincj@iksaif.net> --- drivers/platform/x86/dell-laptop.c | 36 ++++++++++++++++++++++++------------ 1 files changed, 24 insertions(+), 12 deletions(-)