This is a note to let you know that I've just added the patch titled power: supply: bq27xxx: Fix I2C IRQ race on remove to the 6.1-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-bq27xxx-fix-i2c-irq-race-on-remove.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 444ff00734f3878cd54ddd1ed5e2e6dbea9326d5 Mon Sep 17 00:00:00 2001 From: Hans de Goede <hdegoede@xxxxxxxxxx> Date: Sat, 15 Apr 2023 20:23:33 +0200 Subject: power: supply: bq27xxx: Fix I2C IRQ race on remove From: Hans de Goede <hdegoede@xxxxxxxxxx> commit 444ff00734f3878cd54ddd1ed5e2e6dbea9326d5 upstream. devm_request_threaded_irq() requested IRQs are only free-ed after the driver's remove function has ran. So the IRQ could trigger and call bq27xxx_battery_update() after bq27xxx_battery_teardown() has already run. Switch to explicitly free-ing the IRQ in bq27xxx_battery_i2c_remove() to fix this. Fixes: 8807feb91b76 ("power: bq27xxx_battery: Add interrupt handling support") Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx> Signed-off-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/power/supply/bq27xxx_battery_i2c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/power/supply/bq27xxx_battery_i2c.c +++ b/drivers/power/supply/bq27xxx_battery_i2c.c @@ -179,7 +179,7 @@ static int bq27xxx_battery_i2c_probe(str i2c_set_clientdata(client, di); if (client->irq) { - ret = devm_request_threaded_irq(&client->dev, client->irq, + ret = request_threaded_irq(client->irq, NULL, bq27xxx_battery_irq_handler_thread, IRQF_ONESHOT, di->name, di); @@ -209,6 +209,7 @@ static void bq27xxx_battery_i2c_remove(s { struct bq27xxx_device_info *di = i2c_get_clientdata(client); + free_irq(client->irq, di); bq27xxx_battery_teardown(di); mutex_lock(&battery_mutex); Patches currently in stable-queue which might be from hdegoede@xxxxxxxxxx are queue-6.1/power-supply-leds-fix-blink-to-led-on-transition.patch queue-6.1/platform-x86-hp-wmi-fix-cast-to-smaller-integer-type-warning.patch queue-6.1/power-supply-bq25890-call-power_supply_changed-after-updating-input-current-or-voltage.patch queue-6.1/power-supply-bq27xxx-ensure-power_supply_changed-is-called-on-current-sign-changes.patch queue-6.1/power-supply-bq27xxx-move-bq27xxx_battery_update-down.patch queue-6.1/platform-x86-intel-ifs-annotate-work-queue-on-stack-so-object-debug-does-not-complain.patch queue-6.1/power-supply-bq25890-fix-external_power_changed-race.patch queue-6.1/power-supply-bq27xxx-fix-i2c-irq-race-on-remove.patch queue-6.1/power-supply-bq27xxx-fix-bq27xxx_battery_update-race-condition.patch queue-6.1/power-supply-bq27xxx-add-cache-parameter-to-bq27xxx_battery_current_and_status.patch queue-6.1/power-supply-bq27xxx-fix-poll_interval-handling-and-races-on-remove.patch queue-6.1/power-supply-bq24190-call-power_supply_changed-after-updating-input-current.patch queue-6.1/platform-x86-isst-remove-8-socket-limit.patch queue-6.1/power-supply-axp288_fuel_gauge-fix-external_power_changed-race.patch queue-6.1/power-supply-bq27xxx-after-charger-plug-in-out-wait-0.5s-for-things-to-stabilize.patch