Skip to content
/ linux Public

Commit 58dd722

Browse files
Szymon WilczekSasha Levin
authored andcommitted
media: pvrusb2: fix URB leak in pvr2_send_request_ex
[ Upstream commit a8333c8 ] When pvr2_send_request_ex() submits a write URB successfully but fails to submit the read URB (e.g. returns -ENOMEM), it returns immediately without waiting for the write URB to complete. Since the driver reuses the same URB structure, a subsequent call to pvr2_send_request_ex() attempts to submit the still-active write URB, triggering a 'URB submitted while active' warning in usb_submit_urb(). Fix this by ensuring the write URB is unlinked and waited upon if the read URB submission fails. Reported-by: syzbot+405dcd13121ff75a9e16@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=405dcd13121ff75a9e16 Signed-off-by: Szymon Wilczek <szymonwilczek@gmx.com> Acked-by: Mike Isely <isely@pobox.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a854c58 commit 58dd722

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/media/usb/pvrusb2/pvrusb2-hdw.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3709,6 +3709,11 @@ status);
37093709
"Failed to submit read-control URB status=%d",
37103710
status);
37113711
hdw->ctl_read_pend_flag = 0;
3712+
if (hdw->ctl_write_pend_flag) {
3713+
usb_unlink_urb(hdw->ctl_write_urb);
3714+
while (hdw->ctl_write_pend_flag)
3715+
wait_for_completion(&hdw->ctl_done);
3716+
}
37123717
goto done;
37133718
}
37143719
}

0 commit comments

Comments
 (0)