Patchwork PCI: Limit VPD length for Broadcom 5708S

login
register
mail settings
Submitter Zhao, Yu
Date Oct. 28, 2008, 6:44 a.m.
Message ID <20081028064411.GA7043@yzhao12-linux.sh.intel.com>
Download mbox | patch
Permalink /patch/6054/
State Not Applicable
Headers show

Comments

Zhao, Yu - Oct. 28, 2008, 6:44 a.m.
On Tue, Oct 28, 2008 at 02:21:19PM +0800, Eric Dumazet wrote:
> Benjamin Li a écrit :
> > Hi Eric,
> > 
> > It looks like the same problem again: we are reading past a valid VPD
> > address.
> > 
> > After some initial debugging, it looks like dev->vpd is NULL when the
> > Broadcom 5706C/5706S/5708C/570S/5709 quirk is called.  Because of this
> > dev->vpd->len is never set to the proper length to limit the VPD reads.
> > I will debug further to determine what has changed.
> > 
> > Thanks again for pointing out the problem.
> > 
> 
> I did a git bisect this morning :
> 
> $ git bisect good
> 201de56eb22f1ff3f36804bc70cbff220b50f067 is first bad commit
> commit 201de56eb22f1ff3f36804bc70cbff220b50f067
> Author: Zhao, Yu <yu.zhao@intel.com>
> Date:   Mon Oct 13 19:49:55 2008 +0800
> 
>     PCI: centralize the capabilities code in probe.c
> 
>     This patch centralizes the initialization and release functions of
>     various PCI capabilities in probe.c, which makes the introduction
>     of new capability support functions cleaner in the future.
> 
>     Signed-off-by: Yu Zhao <yu.zhao@intel.com>
>     Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> 

Yes, the VPD initialization code has been moved to a later stage that is
after the pci_fixup_header. Can you please try following fix?

Thanks,
Yu

VPD quirks needs to be called after the capability is initialized. Since
VPD initialization is move to after pci_fixup_header, VPD quirks should
be done at pci_fixup_final stage correspondingly.

Signed-off-by: Yu Zhao <yu.zhao@intel.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet - Oct. 28, 2008, 8:38 a.m.
Yu Zhao a écrit :
> On Tue, Oct 28, 2008 at 02:21:19PM +0800, Eric Dumazet wrote:
>> Benjamin Li a écrit :
>>> Hi Eric,
>>>
>>> It looks like the same problem again: we are reading past a valid VPD
>>> address.
>>>
>>> After some initial debugging, it looks like dev->vpd is NULL when the
>>> Broadcom 5706C/5706S/5708C/570S/5709 quirk is called.  Because of this
>>> dev->vpd->len is never set to the proper length to limit the VPD reads.
>>> I will debug further to determine what has changed.
>>>
>>> Thanks again for pointing out the problem.
>>>
>> I did a git bisect this morning :
>>
>> $ git bisect good
>> 201de56eb22f1ff3f36804bc70cbff220b50f067 is first bad commit
>> commit 201de56eb22f1ff3f36804bc70cbff220b50f067
>> Author: Zhao, Yu <yu.zhao@intel.com>
>> Date:   Mon Oct 13 19:49:55 2008 +0800
>>
>>     PCI: centralize the capabilities code in probe.c
>>
>>     This patch centralizes the initialization and release functions of
>>     various PCI capabilities in probe.c, which makes the introduction
>>     of new capability support functions cleaner in the future.
>>
>>     Signed-off-by: Yu Zhao <yu.zhao@intel.com>
>>     Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
>>
> 
> Yes, the VPD initialization code has been moved to a later stage that is
> after the pci_fixup_header. Can you please try following fix?
>

Yes, this patch corrects the problem, thanks Yu.

Tested-by: Eric Dumazet <dada1@cosmosbay.com>
 
> Thanks,
> Yu
> 
> VPD quirks needs to be called after the capability is initialized. Since
> VPD initialization is move to after pci_fixup_header, VPD quirks should
> be done at pci_fixup_final stage correspondingly.
> 
> Signed-off-by: Yu Zhao <yu.zhao@intel.com>
> 
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index bbf66ea..5049a47 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -1692,24 +1692,24 @@ static void __devinit quirk_brcm_570x_limit_vpd(struct pci_dev *dev)
>  	}
>  }
>  
> -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM,
> -			 PCI_DEVICE_ID_NX2_5706,
> -			 quirk_brcm_570x_limit_vpd);
> -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM,
> -			 PCI_DEVICE_ID_NX2_5706S,
> -			 quirk_brcm_570x_limit_vpd);
> -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM,
> -			 PCI_DEVICE_ID_NX2_5708,
> -			 quirk_brcm_570x_limit_vpd);
> -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM,
> -			 PCI_DEVICE_ID_NX2_5708S,
> -			 quirk_brcm_570x_limit_vpd);
> -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM,
> -			 PCI_DEVICE_ID_NX2_5709,
> -			 quirk_brcm_570x_limit_vpd);
> -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM,
> -			 PCI_DEVICE_ID_NX2_5709S,
> -			 quirk_brcm_570x_limit_vpd);
> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
> +			PCI_DEVICE_ID_NX2_5706,
> +			quirk_brcm_570x_limit_vpd);
> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
> +			PCI_DEVICE_ID_NX2_5706S,
> +			quirk_brcm_570x_limit_vpd);
> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
> +			PCI_DEVICE_ID_NX2_5708,
> +			quirk_brcm_570x_limit_vpd);
> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
> +			PCI_DEVICE_ID_NX2_5708S,
> +			quirk_brcm_570x_limit_vpd);
> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
> +			PCI_DEVICE_ID_NX2_5709,
> +			quirk_brcm_570x_limit_vpd);
> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
> +			PCI_DEVICE_ID_NX2_5709S,
> +			quirk_brcm_570x_limit_vpd);
>  
>  #ifdef CONFIG_PCI_MSI
>  /* Some chipsets do not support MSI. We cannot easily rely on setting
> 
> 


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jesse Barnes - Oct. 30, 2008, 4:14 p.m.
On Monday, October 27, 2008 11:44 pm Yu Zhao wrote:
>
> VPD quirks needs to be called after the capability is initialized. Since
> VPD initialization is move to after pci_fixup_header, VPD quirks should
> be done at pci_fixup_final stage correspondingly.
>
> Signed-off-by: Yu Zhao <yu.zhao@intel.com>

Thanks, I'll queue this up for the next pull.

Jesse
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jesse Barnes - Nov. 3, 2008, 10:37 p.m.
On Monday, October 27, 2008 11:44 pm Yu Zhao wrote:
> VPD quirks needs to be called after the capability is initialized. Since
> VPD initialization is move to after pci_fixup_header, VPD quirks should
> be done at pci_fixup_final stage correspondingly.
>
> Signed-off-by: Yu Zhao <yu.zhao@intel.com>

Thanks Yu.  Applied to my for-linus branch.  Looks like that was the only 
affected quirk.

Jesse
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index bbf66ea..5049a47 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1692,24 +1692,24 @@  static void __devinit quirk_brcm_570x_limit_vpd(struct pci_dev *dev)
 	}
 }
 
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM,
-			 PCI_DEVICE_ID_NX2_5706,
-			 quirk_brcm_570x_limit_vpd);
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM,
-			 PCI_DEVICE_ID_NX2_5706S,
-			 quirk_brcm_570x_limit_vpd);
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM,
-			 PCI_DEVICE_ID_NX2_5708,
-			 quirk_brcm_570x_limit_vpd);
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM,
-			 PCI_DEVICE_ID_NX2_5708S,
-			 quirk_brcm_570x_limit_vpd);
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM,
-			 PCI_DEVICE_ID_NX2_5709,
-			 quirk_brcm_570x_limit_vpd);
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM,
-			 PCI_DEVICE_ID_NX2_5709S,
-			 quirk_brcm_570x_limit_vpd);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
+			PCI_DEVICE_ID_NX2_5706,
+			quirk_brcm_570x_limit_vpd);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
+			PCI_DEVICE_ID_NX2_5706S,
+			quirk_brcm_570x_limit_vpd);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
+			PCI_DEVICE_ID_NX2_5708,
+			quirk_brcm_570x_limit_vpd);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
+			PCI_DEVICE_ID_NX2_5708S,
+			quirk_brcm_570x_limit_vpd);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
+			PCI_DEVICE_ID_NX2_5709,
+			quirk_brcm_570x_limit_vpd);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
+			PCI_DEVICE_ID_NX2_5709S,
+			quirk_brcm_570x_limit_vpd);
 
 #ifdef CONFIG_PCI_MSI
 /* Some chipsets do not support MSI. We cannot easily rely on setting