Skip to content

Commit 29be646

Browse files
sreij-intel
authored andcommitted
platform: arm64: thinkpad-t14s-ec: fix IRQ race condition
Fix a race condition, that an input key related interrupt might be triggered before the input handler has been registered, which results in a NULL pointer dereference. This can happen if the user enables the keyboard backlight shortly before the driver is being probed. This fixes the following backtrace visible in dmesg: Unable to handle kernel NULL pointer dereference at virtual address 00000000000000e0 ... Call trace: sparse_keymap_report_event+0x2c/0x978 [sparse_keymap] (P) t14s_ec_irq_handler+0x190/0x3e8 [lenovo_thinkpad_t14s] irq_thread_fn+0x30/0xb8 irq_thread+0x18c/0x3b0 kthread+0x148/0x228 ret_from_fork+0x10/0x20 Fixes: 60b7ab6 ("platform: arm64: thinkpad-t14s-ec: new driver") Signed-off-by: Sebastian Reichel <sre@kernel.org> Reviewed-by: Bryan O'Donoghue <bod@kernel.org> Link: https://patch.msgid.link/20251119-thinkpad-t14s-ec-improvements-v2-1-441219857c02@kernel.org Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent db30233 commit 29be646

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/platform/arm64/lenovo-thinkpad-t14s.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -557,12 +557,6 @@ static int t14s_ec_probe(struct i2c_client *client)
557557
return dev_err_probe(dev, PTR_ERR(ec->regmap),
558558
"Failed to init regmap\n");
559559

560-
ret = devm_request_threaded_irq(dev, client->irq, NULL,
561-
t14s_ec_irq_handler,
562-
IRQF_ONESHOT, dev_name(dev), ec);
563-
if (ret < 0)
564-
return dev_err_probe(dev, ret, "Failed to get IRQ\n");
565-
566560
ret = t14s_leds_probe(ec);
567561
if (ret < 0)
568562
return ret;
@@ -579,6 +573,12 @@ static int t14s_ec_probe(struct i2c_client *client)
579573
if (ret < 0)
580574
return ret;
581575

576+
ret = devm_request_threaded_irq(dev, client->irq, NULL,
577+
t14s_ec_irq_handler,
578+
IRQF_ONESHOT, dev_name(dev), ec);
579+
if (ret < 0)
580+
return dev_err_probe(dev, ret, "Failed to get IRQ\n");
581+
582582
/*
583583
* Disable wakeup support by default, because the driver currently does
584584
* not support masking any events and the laptop should not wake up when

0 commit comments

Comments
 (0)