Skip to content

Commit eb988e4

Browse files
Dan Carpenterdtor
authored andcommitted
Input: synaptics-rmi4 - fix use after free in rmi_unregister_function()
The put_device() calls rmi_release_function() which frees "fn" so the dereference on the next line "fn->num_of_irqs" is a use after free. Move the put_device() to the end to fix this. Fixes: 24d28e4 ("Input: synaptics-rmi4 - convert irq distribution to irq_domain") Signed-off-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 290e44b commit eb988e4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/input/rmi4/rmi_bus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,11 @@ void rmi_unregister_function(struct rmi_function *fn)
277277

278278
device_del(&fn->dev);
279279
of_node_put(fn->dev.of_node);
280-
put_device(&fn->dev);
281280

282281
for (i = 0; i < fn->num_of_irqs; i++)
283282
irq_dispose_mapping(fn->irq[i]);
284283

284+
put_device(&fn->dev);
285285
}
286286

287287
/**

0 commit comments

Comments
 (0)