Skip to content

Commit d5a5e5b

Browse files
Evan Greendtor
authored andcommitted
Input: synaptics-rmi4 - really fix attn_data use-after-free
Fix a use-after-free noticed by running with KASAN enabled. If rmi_irq_fn() is run twice in a row, then rmi_f11_attention() (among others) will end up reading from drvdata->attn_data.data, which was freed and left dangling in rmi_irq_fn(). Commit 55edde9 ("Input: synaptics-rmi4 - prevent UAF reported by KASAN") correctly identified and analyzed this bug. However the attempted fix only NULLed out a local variable, missing the fact that drvdata->attn_data is a struct, not a pointer. NULL out the correct pointer in the driver data to prevent the attention functions from copying from it. Fixes: 55edde9 ("Input: synaptics-rmi4 - prevent UAF reported by KASAN") Fixes: b908d3c ("Input: synaptics-rmi4 - allow to add attention data") Signed-off-by: Evan Green <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/20200427145537.1.Ic8f898e0147beeee2c005ee7b20f1aebdef1e7eb@changeid Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 2712c91 commit d5a5e5b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/input/rmi4/rmi_driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
205205

206206
if (count) {
207207
kfree(attn_data.data);
208-
attn_data.data = NULL;
208+
drvdata->attn_data.data = NULL;
209209
}
210210

211211
if (!kfifo_is_empty(&drvdata->attn_fifo))

0 commit comments

Comments
 (0)