* [PATCH] xen/pci: prevent infinite loop for faulty SR-IOV cards
@ 2025-10-24 15:13 Frediano Ziglio
2025-10-24 15:58 ` Andrew Cooper
0 siblings, 1 reply; 5+ messages in thread
From: Frediano Ziglio @ 2025-10-24 15:13 UTC (permalink / raw)
To: xen-devel; +Cc: Jan Beulich, Roger Pau Monné, Andrew Cooper
If a SR-IOV card presents an I/O space inside a BAR the
code will continue to loop on the same card.
This is due to the missing increment of the cycle variable.
Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
xen/drivers/passthrough/pci.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 3edcfa8a04..52c22fa50c 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -746,6 +746,7 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
printk(XENLOG_WARNING
"SR-IOV device %pp with vf BAR%u in IO space\n",
&pdev->sbdf, i);
+ ++i;
continue;
}
ret = pci_size_mem_bar(pdev->sbdf, idx, NULL,
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] xen/pci: prevent infinite loop for faulty SR-IOV cards
2025-10-24 15:13 [PATCH] xen/pci: prevent infinite loop for faulty SR-IOV cards Frediano Ziglio
@ 2025-10-24 15:58 ` Andrew Cooper
2025-10-24 16:00 ` Andrew Cooper
2025-10-25 20:09 ` Frediano Ziglio
0 siblings, 2 replies; 5+ messages in thread
From: Andrew Cooper @ 2025-10-24 15:58 UTC (permalink / raw)
To: Frediano Ziglio, xen-devel; +Cc: Jan Beulich, Roger Pau Monné
On 24/10/2025 4:13 pm, Frediano Ziglio wrote:
> If a SR-IOV card presents an I/O space inside a BAR the
> code will continue to loop on the same card.
> This is due to the missing increment of the cycle variable.
>
> Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
Yes, that's buggy. Was this from a real card, or just code inspection?
~Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xen/pci: prevent infinite loop for faulty SR-IOV cards
2025-10-24 15:58 ` Andrew Cooper
@ 2025-10-24 16:00 ` Andrew Cooper
2025-10-27 8:43 ` Roger Pau Monné
2025-10-25 20:09 ` Frediano Ziglio
1 sibling, 1 reply; 5+ messages in thread
From: Andrew Cooper @ 2025-10-24 16:00 UTC (permalink / raw)
To: Frediano Ziglio, xen-devel; +Cc: Jan Beulich, Roger Pau Monné
On 24/10/2025 4:58 pm, Andrew Cooper wrote:
> On 24/10/2025 4:13 pm, Frediano Ziglio wrote:
>> If a SR-IOV card presents an I/O space inside a BAR the
>> code will continue to loop on the same card.
>> This is due to the missing increment of the cycle variable.
>>
>> Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
> Yes, that's buggy. Was this from a real card, or just code inspection?
Sorry, sent too early.
This was broken by a1a6d59862f4 ("pci: split code to size BARs from
pci_add_device") when it changed the loop from having an increment, to not.
~Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xen/pci: prevent infinite loop for faulty SR-IOV cards
2025-10-24 15:58 ` Andrew Cooper
2025-10-24 16:00 ` Andrew Cooper
@ 2025-10-25 20:09 ` Frediano Ziglio
1 sibling, 0 replies; 5+ messages in thread
From: Frediano Ziglio @ 2025-10-25 20:09 UTC (permalink / raw)
To: Andrew Cooper; +Cc: xen-devel, Jan Beulich, Roger Pau Monné
On Fri, 24 Oct 2025 at 16:58, Andrew Cooper <andrew.cooper3@citrix.com> wrote:
>
> On 24/10/2025 4:13 pm, Frediano Ziglio wrote:
> > If a SR-IOV card presents an I/O space inside a BAR the
> > code will continue to loop on the same card.
> > This is due to the missing increment of the cycle variable.
> >
> > Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
>
> Yes, that's buggy. Was this from a real card, or just code inspection?
>
Code inspection.
> ~Andrew
Frediano
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xen/pci: prevent infinite loop for faulty SR-IOV cards
2025-10-24 16:00 ` Andrew Cooper
@ 2025-10-27 8:43 ` Roger Pau Monné
0 siblings, 0 replies; 5+ messages in thread
From: Roger Pau Monné @ 2025-10-27 8:43 UTC (permalink / raw)
To: Andrew Cooper, Oleksii Kurochko; +Cc: Frediano Ziglio, xen-devel, Jan Beulich
On Fri, Oct 24, 2025 at 05:00:34PM +0100, Andrew Cooper wrote:
> On 24/10/2025 4:58 pm, Andrew Cooper wrote:
> > On 24/10/2025 4:13 pm, Frediano Ziglio wrote:
> >> If a SR-IOV card presents an I/O space inside a BAR the
> >> code will continue to loop on the same card.
> >> This is due to the missing increment of the cycle variable.
> >>
> >> Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
> > Yes, that's buggy. Was this from a real card, or just code inspection?
>
> Sorry, sent too early.
>
> This was broken by a1a6d59862f4 ("pci: split code to size BARs from
> pci_add_device") when it changed the loop from having an increment, to not.
That was my fault.
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
I think we want to consider, this for 4.21, what's your opinion
Oleksii?
Thanks, Roger.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-10-27 8:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-24 15:13 [PATCH] xen/pci: prevent infinite loop for faulty SR-IOV cards Frediano Ziglio
2025-10-24 15:58 ` Andrew Cooper
2025-10-24 16:00 ` Andrew Cooper
2025-10-27 8:43 ` Roger Pau Monné
2025-10-25 20:09 ` Frediano Ziglio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).