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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 15 Jan 2021 15:32:55 +0100
From:   Sebastian Reichel <sebastian.reichel@...labora.com>
To:     Tony Lindgren <tony@...mide.com>
Cc:     Colin King <colin.king@...onical.com>, linux-pm@...r.kernel.org,
        kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] power: supply: cpcap-charger: Fix power_supply_put
 on null battery pointer

Hi,

On Fri, Jan 15, 2021 at 03:24:17PM +0200, Tony Lindgren wrote:
> * Colin King <colin.king@...onical.com> [210115 13:15]:
> > From: Colin Ian King <colin.king@...onical.com>
> > 
> > Currently if the pointer battery is null there is a null pointer
> > dereference on the call to power_supply_put.  Fix this by only
> > performing the put if battery is not null.
> > 
> > Addresses-Coverity: ("Dereference after null check")
> > Fixes: 4bff91bb3231 ("power: supply: cpcap-charger: Fix missing power_supply_put()")
> > Signed-off-by: Colin Ian King <colin.king@...onical.com>
> 
> Oopsie, thanks for fixing it:
> 
> Acked-by: Tony Lindgren <tony@...mide.com>

Thanks, queued.

-- Sebastian

> >  drivers/power/supply/cpcap-charger.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/power/supply/cpcap-charger.c b/drivers/power/supply/cpcap-charger.c
> > index 823d666f09e0..641dcad1133f 100644
> > --- a/drivers/power/supply/cpcap-charger.c
> > +++ b/drivers/power/supply/cpcap-charger.c
> > @@ -300,8 +300,9 @@ cpcap_charger_get_bat_const_charge_voltage(struct cpcap_charger_ddata *ddata)
> >  				&prop);
> >  		if (!error)
> >  			voltage = prop.intval;
> > +
> > +		power_supply_put(battery);
> >  	}
> > -	power_supply_put(battery);
> >  
> >  	return voltage;
> >  }
> > -- 
> > 2.29.2
> > 

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ