Patch "power: supply: cpcap-charger: Fix power_supply_put on null battery pointer" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    power: supply: cpcap-charger: Fix power_supply_put on null battery pointer

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     power-supply-cpcap-charger-fix-power_supply_put-on-n.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit ddfc175759a1c9e726e01a76772cc1f4c584b46b
Author: Colin Ian King <colin.king@xxxxxxxxxxxxx>
Date:   Fri Jan 15 13:15:24 2021 +0000

    power: supply: cpcap-charger: Fix power_supply_put on null battery pointer
    
    [ Upstream commit 39196cfe10dd2b46ee28b44abbc0db4f4cb7822f ]
    
    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@xxxxxxxxxxxxx>
    Acked-by: Tony Lindgren <tony@xxxxxxxxxxx>
    Signed-off-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/power/supply/cpcap-charger.c b/drivers/power/supply/cpcap-charger.c
index 2c5f2246c6eaa..22fff01425d63 100644
--- a/drivers/power/supply/cpcap-charger.c
+++ b/drivers/power/supply/cpcap-charger.c
@@ -301,8 +301,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;
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux