lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 19 Apr 2018 06:59:43 -0700
From:   João Paulo Rechi Vita <jprvita@...il.com>
To:     Darren Hart <dvhart@...radead.org>
Cc:     Corentin Chary <corentin.chary@...il.com>,
        Andy Shevchenko <andy@...radead.org>,
        Platform Driver <platform-driver-x86@...r.kernel.org>,
        acpi4asus-user <acpi4asus-user@...ts.sourceforge.net>,
        LKML <linux-kernel@...r.kernel.org>, linux@...lessm.com,
        Dun Hum <bitter.taste@....com>,
        João Paulo Rechi Vita <jprvita@...lessm.com>
Subject: Re: [PATCH] platform/x86: asus-wireless: Fix NULL pointer dereference

On Sat, Apr 7, 2018 at 8:50 AM, Darren Hart <dvhart@...radead.org> wrote:
> 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 <bitter.taste@....com>
>> Signed-off-by: João Paulo Rechi Vita <jprvita@...lessm.com>
>> ---
>>  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.
>

I agree. I didn't do it this way initially as I believe the call to
devm_led_classdev_unregister() would be harmless in any case, but it
indeed best to avoid it if we can.

> This should also cc stable.
>

Adding to v2.

--
João Paulo Rechi Vita
http://about.me/jprvita

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ