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] [day] [month] [year] [list]
Date:   Sat, 11 Mar 2023 00:25:06 +0800
From:   Zheng Hacker <hackerzheng666@...il.com>
To:     Sebastian Reichel <sebastian.reichel@...labora.com>
Cc:     Zheng Wang <zyytlz.wz@....com>, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org, 1395428693sheep@...il.com,
        alex000young@...il.com
Subject: Re: [PATCH] power: supply: bq24190: Fix use after free bug in
 bq24190_remove due to race condition

Sebastian Reichel <sebastian.reichel@...labora.com> 于2023年3月10日周五 07:40写道:
>
> Hi,
>
> On Fri, Mar 10, 2023 at 01:47:28AM +0800, Zheng Wang wrote:
> > In bq24190_probe, &bdi->input_current_limit_work is bound
> > with bq24190_input_current_limit_work. When external power
> > changed, it will call bq24190_charger_external_power_changed
> >  to start the work.
> >
> > If we remove the module which will call bq24190_remove to make
> > cleanup, there may be a unfinished work. The possible
> > sequence is as follows:
> >
> > CPU0                  CPUc1
> >
> >                     |bq24190_input_current_limit_work
> > bq24190_remove      |
> > power_supply_unregister  |
> > device_unregister   |
> > power_supply_dev_release|
> > kfree(psy)          |
> >                     |
> >                     | power_supply_get_property_from_supplier
> >                     |   //use
> >
> > Fix it by finishing the work before cleanup in the bq24190_remove
> >
> > Fixes: 97774672573a ("power_supply: Initialize changed_work before calling device_add")
> > Signed-off-by: Zheng Wang <zyytlz.wz@....com>
> > ---
>
> Thanks, queued to fixes branch.
>
Very glad to hear that. Thanks  for your effort.

Best regards,
Zheng

>
> >  drivers/power/supply/bq24190_charger.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c
> > index be34b9848450..de67b985f0a9 100644
> > --- a/drivers/power/supply/bq24190_charger.c
> > +++ b/drivers/power/supply/bq24190_charger.c
> > @@ -1906,6 +1906,7 @@ static void bq24190_remove(struct i2c_client *client)
> >       struct bq24190_dev_info *bdi = i2c_get_clientdata(client);
> >       int error;
> >
> > +     cancel_delayed_work_sync(&bdi->input_current_limit_work);
> >       error = pm_runtime_resume_and_get(bdi->dev);
> >       if (error < 0)
> >               dev_warn(bdi->dev, "pm_runtime_get failed: %i\n", error);
> > --
> > 2.25.1
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ