[PATCH 06/10] Input: synaptics-rmi4 - check for NULL drvdata in rmi_set_attn_data()

From: Lee Jones

Date: Mon Nov 23 2026 - 13:32:59 EST


Transport drivers such as hid-rmi remain registered and continue
delivering attention reports via rmi_set_attn_data() even if the
physical RMI driver failed to probe rmi_dev or was unbound via sysfs.

When rmi_dev is unbound, dev_get_drvdata(&rmi_dev->dev) returns NULL and
rmi_set_attn_data() dereferences drvdata->enabled in interrupt context.

Check that drvdata is non-NULL before accessing drvdata->enabled,
matching rmi_process_interrupt_requests(), rmi_driver_suspend(), and
rmi_driver_resume().

Fixes: b908d3cd812a ("Input: synaptics-rmi4 - allow to add attention data")
Closes: https://sashiko.dev/#/bug/linux-0165ea80-0dcb-4d48-96cf-e2c1532199a0
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
drivers/input/rmi4/rmi_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 7bbe9e801c35..5053c1edad6f 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -172,7 +172,7 @@ void rmi_set_attn_data(struct rmi_device *rmi_dev, unsigned long irq_status,
struct rmi4_attn_data attn_data;
void *fifo_data;

- if (!drvdata->enabled)
+ if (!drvdata || !drvdata->enabled)
return;

fifo_data = kmemdup(data, size, GFP_ATOMIC);
--
2.56.1.750.gf70dc682cf-goog