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:   Wed,  3 Mar 2021 22:29:25 +0100
From:   Heiko Thiery <heiko.thiery@...il.com>
To:     raychi@...gle.com
Cc:     balbi@...nel.org, colin.king@...onical.com,
        gregkh@...uxfoundation.org, kernel-janitors@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org,
        Heiko Thiery <heiko.thiery@...il.com>
Subject: Re: [PATCH] usb: dwc3: Fix dereferencing of null dwc->usb_psy

Hi all,

> On Wed, Mar 3, 2021 at 6:00 PM Colin King <colin.king@...onical.com> wrote:
>>
>> From: Colin Ian King <colin.king@...onical.com>
>>
>> Currently the null check logic on dwc->usb_psy is inverted as it allows
>> calls to power_supply_put with a null dwc->usb_psy causing a null
>> pointer dereference. Fix this by removing the ! operator.
>>
>> Addresses-Coverity: ("Dereference after null check")
>> Fixes: 59fa3def35de ("usb: dwc3: add a power supply for current control")
>
> Acked-by: Ray Chi <raychi@...gle.com>
>
>> Signed-off-by: Colin Ian King <colin.king@...onical.com>

Tested-by: Heiko Thiery <heiko.thiery@...il.com>

>> ---
>>  drivers/usb/dwc3/core.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>> index d15f065849cd..94fdbe502ce9 100644
>> --- a/drivers/usb/dwc3/core.c
>> +++ b/drivers/usb/dwc3/core.c
>> @@ -1628,7 +1628,7 @@ static int dwc3_probe(struct platform_device *pdev)
>>  assert_reset:
>>         reset_control_assert(dwc->reset);
>>
>> -       if (!dwc->usb_psy)
>> +       if (dwc->usb_psy)
>>                 power_supply_put(dwc->usb_psy);
>>
>>         return ret;
>> @@ -1653,7 +1653,7 @@ static int dwc3_remove(struct platform_device *pdev)
>>         dwc3_free_event_buffers(dwc);
>>         dwc3_free_scratch_buffers(dwc);
>>
>> -       if (!dwc->usb_psy)
>> +       if (dwc->usb_psy)
>>                 power_supply_put(dwc->usb_psy);
>>
>>         return 0;
>> --
>> 2.30.0
>>

Thank you.

-- 
Heiko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ