Skip to content

Commit 79c81d1

Browse files
committed
Input: exc3000 - properly stop timer on shutdown
We need to stop the timer on driver unbind or probe failures, otherwise we get UAF/Oops. Fixes: 7e577a1 ("Input: add I2C attached EETI EXC3000 multi touch driver") Reported-by: "Stahl, Michael" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: [email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 7997ba1 commit 79c81d1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/input/touchscreen/exc3000.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ static inline void exc3000_schedule_timer(struct exc3000_data *data)
109109
mod_timer(&data->timer, jiffies + msecs_to_jiffies(EXC3000_TIMEOUT_MS));
110110
}
111111

112+
static void exc3000_shutdown_timer(void *timer)
113+
{
114+
timer_shutdown_sync(timer);
115+
}
116+
112117
static int exc3000_read_frame(struct exc3000_data *data, u8 *buf)
113118
{
114119
struct i2c_client *client = data->client;
@@ -386,6 +391,11 @@ static int exc3000_probe(struct i2c_client *client)
386391
if (error)
387392
return error;
388393

394+
error = devm_add_action_or_reset(&client->dev, exc3000_shutdown_timer,
395+
&data->timer);
396+
if (error)
397+
return error;
398+
389399
error = devm_request_threaded_irq(&client->dev, client->irq,
390400
NULL, exc3000_interrupt, IRQF_ONESHOT,
391401
client->name, data);

0 commit comments

Comments
 (0)