[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] pci: fix handling of PCI bridges with subordinate bus number 0xff


  • To: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Tue, 28 Sep 2021 12:32:54 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=kMe0gzp8UMKJoHftubjUl2uIKsSHCR1TAN8fJuJayb8=; b=fDWF+at0EBmfTK8i0LoX2A4o9bd3Ep0BDjB4nQ4igo4M6LY/TbBhWQizdbRE/RwfxHwiMSzC5+QjqTHRUfOpiCy5l3Sgofb6MkTWwYmHhzG6oGabYGNRzzNDoDttAwGsg1RnGutzSBmPogz8PaBV6V2/ePxyT+s8tEQJ+HGO9aIMzDa+Rdtj0BQD/puJsjLjs5gAdFWabZQnqHVwZgKGFBPp/iSrwfFjmapTiYZoNZNXDZol3+TzDv+iY9TaZiqw70kEzj9r0Uk8UgO+y6X26KsXepxcFvNEsj0eTKX60zIL+LB2WrD0oOD3+s0Fslam3CjiDHAbl2qGm96T16FoCQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fc1KbGwYSQuS5L1/gHVcXXNgRO/wuoypKTKtK1NlxondqirTAQlJLY77FCtBP94NLaZ7ws8rWRHFJTyzBmnwerk87vYYK6avIlOsTfIzzCwaU49g1OLcSFY3LTU5+iGVG5FyL/BabEJieLHAHsuZb/w2Q7TpdlOybII+Shb+7TRIBWa50Kh0W+WyiFbNPS9lbs4Z86VySrlLMmp59wKuQocp5kbULhNNcGocXbbdNnb9GZHXzXDJA2cmpkCwFMWyeWZRYZQCSCcwaSYFsBrylZD241g66P+CVuUhBK7oVUpg5rURYAIVg/crSJtEGF3LZWPdVleybNj67KVX/FvwfQ==
  • Authentication-results-original: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "jbeulich@xxxxxxxx" <jbeulich@xxxxxxxx>, "paul@xxxxxxx" <paul@xxxxxxx>
  • Delivery-date: Tue, 28 Sep 2021 12:33:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXsSQXPb+dzbvL/kOUSxwoDVQ8/6u5Z6IA
  • Thread-topic: [PATCH v2] pci: fix handling of PCI bridges with subordinate bus number 0xff

Hi,

> On 24 Sep 2021, at 10:10, Igor Druzhinin <igor.druzhinin@xxxxxxxxxx> wrote:
> 
> Bus number 0xff is valid according to the PCI spec. Using u8 typed sub_bus
> and assigning 0xff to it will result in the following loop getting stuck.
> 
>    for ( ; sec_bus <= sub_bus; sec_bus++ ) {...}
> 
> Just change its type to unsigned int similarly to what is already done in
> dmar_scope_add_buses().
> 
> Signed-off-by: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand


> ---
> v2:
> - fix free_pdev() as well
> - style fixes
> ---
> xen/drivers/passthrough/pci.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
> index fc4fa2e..d65cda8 100644
> --- a/xen/drivers/passthrough/pci.c
> +++ b/xen/drivers/passthrough/pci.c
> @@ -363,8 +363,7 @@ static struct pci_dev *alloc_pdev(struct pci_seg *pseg, 
> u8 bus, u8 devfn)
>     /* update bus2bridge */
>     switch ( pdev->type = pdev_type(pseg->nr, bus, devfn) )
>     {
> -        u16 cap;
> -        u8 sec_bus, sub_bus;
> +        unsigned int cap, sec_bus, sub_bus;
> 
>         case DEV_TYPE_PCIe2PCI_BRIDGE:
>         case DEV_TYPE_LEGACY_PCI_BRIDGE:
> @@ -431,7 +430,7 @@ static void free_pdev(struct pci_seg *pseg, struct 
> pci_dev *pdev)
>     /* update bus2bridge */
>     switch ( pdev->type )
>     {
> -        uint8_t sec_bus, sub_bus;
> +        unsigned int sec_bus, sub_bus;
> 
>         case DEV_TYPE_PCIe2PCI_BRIDGE:
>         case DEV_TYPE_LEGACY_PCI_BRIDGE:
> -- 
> 2.7.4
> 
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.