Skip to content

Commit 94ab886

Browse files
hrasiqopsiff
authored andcommitted
usb: usbtmc: Flush anchored URBs in usbtmc_release
commit 8a768552f7a8276fb9e01d49773d2094ace7c8f1 upstream. When calling usbtmc_release, pending anchored URBs must be flushed or killed to prevent use-after-free errors (e.g. in the HCD giveback path). Call usbtmc_draw_down() to allow anchored URBs to be completed. Fixes: 4f3c8d6 ("usb: usbtmc: Support Read Status Byte with SRQ per file") Reported-by: syzbot+9a3c54f52bd1edbd975f@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=9a3c54f52bd1edbd975f Cc: stable <stable@kernel.org> Signed-off-by: Heitor Alves de Siqueira <halves@igalia.com> Link: https://patch.msgid.link/20260312-usbtmc-flush-release-v1-1-5755e9f4336f@igalia.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 977b632db51d231dec0bc571089a5c2402674139) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent e9592f9 commit 94ab886

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/usb/class/usbtmc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ static int usbtmc_release(struct inode *inode, struct file *file)
254254
list_del(&file_data->file_elem);
255255

256256
spin_unlock_irq(&file_data->data->dev_lock);
257+
258+
/* flush anchored URBs */
259+
usbtmc_draw_down(file_data);
257260
mutex_unlock(&file_data->data->io_mutex);
258261

259262
kref_put(&file_data->data->kref, usbtmc_delete);

0 commit comments

Comments
 (0)