Input: maplemouse - fix NULL pointer dereference in open()
authorFlorian Fuchs <fuchsfl@gmail.com>
Tue, 30 Jun 2026 01:33:42 +0000 (18:33 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 30 Jun 2026 05:38:26 +0000 (22:38 -0700)
commitee89db004238bd0b034f2a6176e175561658750b
tree23b2980c18cd1c5739b86ec52f28240616486d6b
parentd86d4f8cbb5a55a3b9b86f7b5ab8c4cdda600a3f
Input: maplemouse - fix NULL pointer dereference in open()

Commit 555c765b0cc2 ("Input: mouse - drop unnecessary calls to
input_set_drvdata") dropped the input_set_drvdata() call in probe
because the data appeared to be unused. However, dc_mouse_open() and
dc_mouse_close() were using maple_get_drvdata(to_maple_dev(&dev->dev)).
This appears to be accessing the data attached to an instance of
maple_device structure, while in reality this actually retrieves driver
data from the input device's embedded struct device (doing invalid
conversion of input device structure to maple device). After
input_set_drvdata() was removed, that lookup started returning NULL and
opening the input device dereferences mse->mdev.

Restore input_set_drvdata() and convert open() and close() to use
input_get_drvdata() so the dependency is no longer hidden.

Fixes: 6b3480855aad ("maple: input: fix up maple mouse driver")
Fixes: 555c765b0cc2 ("Input: mouse - drop unnecessary calls to input_set_drvdata")
Signed-off-by: Florian Fuchs <fuchsfl@gmail.com>
Link: https://patch.msgid.link/20260628230715.2982552-1-fuchsfl@gmail.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/mouse/maplemouse.c