Skip to content

Commit 5c15c60

Browse files
javiercarrascocruzdtor
authored andcommitted
Input: powermate - fix use-after-free in powermate_config_complete
syzbot has found a use-after-free bug [1] in the powermate driver. This happens when the device is disconnected, which leads to a memory free from the powermate_device struct. When an asynchronous control message completes after the kfree and its callback is invoked, the lock does not exist anymore and hence the bug. Use usb_kill_urb() on pm->config to cancel any in-progress requests upon device disconnection. [1] https://syzkaller.appspot.com/bug?extid=0434ac83f907a1dbdd1e Signed-off-by: Javier Carrasco <[email protected]> Reported-by: [email protected] Link: https://lore.kernel.org/r/20230916-topic-powermate_use_after_free-v3-1-64412b81a7a2@gmail.com Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent a65cd7e commit 5c15c60

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/input/misc/powermate.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ static void powermate_disconnect(struct usb_interface *intf)
425425
pm->requires_update = 0;
426426
usb_kill_urb(pm->irq);
427427
input_unregister_device(pm->input);
428+
usb_kill_urb(pm->config);
428429
usb_free_urb(pm->irq);
429430
usb_free_urb(pm->config);
430431
powermate_free_buffers(interface_to_usbdev(intf), pm);

0 commit comments

Comments
 (0)