Re: [PATCH v3] Input: powermate - fix use-after-free in powermate_config_complete

From: Dmitry Torokhov
Date: Fri Oct 13 2023 - 23:13:26 EST


On Wed, Oct 04, 2023 at 04:36:13PM +0200, Javier Carrasco wrote:
> 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 <javier.carrasco.cruz@xxxxxxxxx>
> Reported-by: syzbot+0434ac83f907a1dbdd1e@xxxxxxxxxxxxxxxxxxxxxxxxx

Applied, thank you.

--
Dmitry