]> git.baikalelectronics.ru Git - kernel.git/commit
power: supply: bq27xxx: Fix kernel crash on IRQ handler register error
authorHans de Goede <hdegoede@redhat.com>
Sun, 31 Oct 2021 15:25:22 +0000 (16:25 +0100)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Tue, 2 Nov 2021 12:47:19 +0000 (13:47 +0100)
commit50eb99781da06b6563a9380f998b91adb5f39160
tree235c1a94f992b9de6b8b2c815e0c48ab4c056cb3
parent10b01ac17aeb1ae7961b276c4dc1803d16c9071b
power: supply: bq27xxx: Fix kernel crash on IRQ handler register error

When registering the IRQ handler fails, do not just return the error code,
this will free the devm_kzalloc()-ed data struct while leaving the queued
work queued and the registered power_supply registered with both of them
now pointing to free-ed memory, resulting in various kernel crashes
soon afterwards.

Instead properly tear-down things on IRQ handler register errors.

Fixes: 44f0cec95c00 ("power: bq27xxx_battery: Reorganize I2C into a module")
Cc: Andrew F. Davis <afd@ti.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/bq27xxx_battery_i2c.c