* [PATCH] usb: core: prevent double URB enqueue causing list corruption
@ 2025-10-31 13:47 vsshingne
2025-10-31 13:59 ` Greg KH
0 siblings, 1 reply; 6+ messages in thread
From: vsshingne @ 2025-10-31 13:47 UTC (permalink / raw)
To: skhan; +Cc: gregkh, linux-usb, linux-kernel, vsshingne
Prevents the same URB from being enqueued twice on the same endpoint,
which could lead to list corruption detected by list_debug.c.
This was observed in syzbot reports where URBs were re-submitted
before completion, triggering 'list_add double add' errors.
Adding a check to return -EEXIST if the URB is already on a queue
prevents this corruption.
Signed-off-by: vsshingne <vaibhavshingne66@gmail.com>
---
drivers/usb/core/hcd.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 87fcb78c34a8..66861f372daf 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1758,16 +1758,15 @@ void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, int status)
pr_warn("usb: URB already linked to bh->head, skipping duplicate addition\n");
return;
}
-
list_add_tail(&urb->urb_list, &bh->head);
running = bh->running;
spin_unlock(&bh->lock);
if (!running) {
- if (bh->high_prio)
- queue_work(system_bh_highpri_wq, &bh->bh);
- else
- queue_work(system_bh_wq, &bh->bh);
+ if (bh->high_prio)
+ queue_work(system_bh_highpri_wq, &bh->bh);
+ else
+ queue_work(system_bh_wq, &bh->bh);
}
}
EXPORT_SYMBOL_GPL(usb_hcd_giveback_urb);
--
2.48.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] usb: core: prevent double URB enqueue causing list corruption
2025-10-31 13:47 [PATCH] usb: core: prevent double URB enqueue causing list corruption vsshingne
@ 2025-10-31 13:59 ` Greg KH
2025-10-31 14:13 ` Alan Stern
0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2025-10-31 13:59 UTC (permalink / raw)
To: vsshingne; +Cc: skhan, linux-usb, linux-kernel
On Fri, Oct 31, 2025 at 07:17:39PM +0530, vsshingne wrote:
> Prevents the same URB from being enqueued twice on the same endpoint,
> which could lead to list corruption detected by list_debug.c.
>
> This was observed in syzbot reports where URBs were re-submitted
> before completion, triggering 'list_add double add' errors.
>
> Adding a check to return -EEXIST if the URB is already on a queue
> prevents this corruption.
This text makes no sense at all, it does not describe what this patch
does in any way. Please do not use AI to generate patches.
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: core: prevent double URB enqueue causing list corruption
2025-10-31 13:59 ` Greg KH
@ 2025-10-31 14:13 ` Alan Stern
2025-10-31 17:21 ` Shuah Khan
0 siblings, 1 reply; 6+ messages in thread
From: Alan Stern @ 2025-10-31 14:13 UTC (permalink / raw)
To: Greg KH; +Cc: vsshingne, skhan, linux-usb, linux-kernel
On Fri, Oct 31, 2025 at 02:59:07PM +0100, Greg KH wrote:
> On Fri, Oct 31, 2025 at 07:17:39PM +0530, vsshingne wrote:
> > Prevents the same URB from being enqueued twice on the same endpoint,
> > which could lead to list corruption detected by list_debug.c.
> >
> > This was observed in syzbot reports where URBs were re-submitted
> > before completion, triggering 'list_add double add' errors.
> >
> > Adding a check to return -EEXIST if the URB is already on a queue
> > prevents this corruption.
>
> This text makes no sense at all, it does not describe what this patch
> does in any way. Please do not use AI to generate patches.
In fact, the patch doesn't do _anything_ (except maybe change some
whitespace). And it does not apply to any recent kernel source.
Alan Stern
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: core: prevent double URB enqueue causing list corruption
2025-10-31 14:13 ` Alan Stern
@ 2025-10-31 17:21 ` Shuah Khan
0 siblings, 0 replies; 6+ messages in thread
From: Shuah Khan @ 2025-10-31 17:21 UTC (permalink / raw)
To: Alan Stern, Greg KH; +Cc: vsshingne, linux-usb, linux-kernel, Shuah Khan
On 10/31/25 08:13, Alan Stern wrote:
> On Fri, Oct 31, 2025 at 02:59:07PM +0100, Greg KH wrote:
>> On Fri, Oct 31, 2025 at 07:17:39PM +0530, vsshingne wrote:
>>> Prevents the same URB from being enqueued twice on the same endpoint,
>>> which could lead to list corruption detected by list_debug.c.
>>>
>>> This was observed in syzbot reports where URBs were re-submitted
>>> before completion, triggering 'list_add double add' errors.
>>>
>>> Adding a check to return -EEXIST if the URB is already on a queue
>>> prevents this corruption.
>>
>> This text makes no sense at all, it does not describe what this patch
>> does in any way. Please do not use AI to generate patches.
>
> In fact, the patch doesn't do _anything_ (except maybe change some
> whitespace). And it does not apply to any recent kernel source.
>
Agree - this patch does nothing. Looks like the patch isn't sent
to right people either.
This person happens to be in the mentorship program - I will make
sure they won't send such patches in the future.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] usb: core: prevent double URB enqueue causing list corruption
@ 2025-10-31 13:50 vsshingne
2025-10-31 13:59 ` Greg KH
0 siblings, 1 reply; 6+ messages in thread
From: vsshingne @ 2025-10-31 13:50 UTC (permalink / raw)
To: skhan; +Cc: gregkh, linux-usb, linux-kernel, vsshingne
Prevents the same URB from being enqueued twice on the same endpoint,
which could lead to list corruption detected by list_debug.c.
This was observed in syzbot reports where URBs were re-submitted
before completion, triggering 'list_add double add' errors.
Adding a check to return if the URB is already on a queue
prevents this corruption.
Signed-off-by: vsshingne <vaibhavshingne66@gmail.com>
---
drivers/usb/core/hcd.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 87fcb78c34a8..66861f372daf 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1758,16 +1758,15 @@ void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, int status)
pr_warn("usb: URB already linked to bh->head, skipping duplicate addition\n");
return;
}
-
list_add_tail(&urb->urb_list, &bh->head);
running = bh->running;
spin_unlock(&bh->lock);
if (!running) {
- if (bh->high_prio)
- queue_work(system_bh_highpri_wq, &bh->bh);
- else
- queue_work(system_bh_wq, &bh->bh);
+ if (bh->high_prio)
+ queue_work(system_bh_highpri_wq, &bh->bh);
+ else
+ queue_work(system_bh_wq, &bh->bh);
}
}
EXPORT_SYMBOL_GPL(usb_hcd_giveback_urb);
--
2.48.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] usb: core: prevent double URB enqueue causing list corruption
2025-10-31 13:50 vsshingne
@ 2025-10-31 13:59 ` Greg KH
0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2025-10-31 13:59 UTC (permalink / raw)
To: vsshingne; +Cc: skhan, linux-usb, linux-kernel
On Fri, Oct 31, 2025 at 07:20:32PM +0530, vsshingne wrote:
> Prevents the same URB from being enqueued twice on the same endpoint,
> which could lead to list corruption detected by list_debug.c.
>
> This was observed in syzbot reports where URBs were re-submitted
> before completion, triggering 'list_add double add' errors.
>
> Adding a check to return if the URB is already on a queue
> prevents this corruption.
>
> Signed-off-by: vsshingne <vaibhavshingne66@gmail.com>
> ---
> drivers/usb/core/hcd.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
Please do not send patches multiple times, in invalid formats.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-10-31 17:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-31 13:47 [PATCH] usb: core: prevent double URB enqueue causing list corruption vsshingne
2025-10-31 13:59 ` Greg KH
2025-10-31 14:13 ` Alan Stern
2025-10-31 17:21 ` Shuah Khan
-- strict thread matches above, loose matches on Subject: below --
2025-10-31 13:50 vsshingne
2025-10-31 13:59 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox