[vivid][PATCH] UBUNTU: [Config] CONFIG_PCIEASPM_DEBUG=y

Colin Ian King colin.king at canonical.com
Sun Dec 7 23:18:28 UTC 2014


On 05/12/14 19:51, Chris J Arges wrote:
> Here are the device attributes that get added and their permissions:
> 
> static DEVICE_ATTR(link_state, 0644, link_state_show, link_state_store);
> static DEVICE_ATTR(clk_ctl, 0644, clk_ctl_show, clk_ctl_store);
> 
> These are only added if link_state->{aspm_support,clkpm_capable} are
> true respectively.
> 
> So this does allow for storing those variables. And looking through the
> kernel I don't see many examples of this pattern; in addition the
> parameter checking seems a bit weak:
> 
> static ssize_t link_state_store(struct device *dev,
>                 struct device_attribute *attr,
>                 const char *buf,
>                 size_t n)
> {
>         struct pci_dev *pdev = to_pci_dev(dev);
>         struct pcie_link_state *link, *root = pdev->link_state->root;
>         u32 val = buf[0] - '0', state = 0;
> 
>         if (aspm_disabled)
>                 return -EPERM;
>         if (n < 1 || val > 3)
>                 return -EINVAL;
> ...
> 
> static ssize_t clk_ctl_store(struct device *dev,
>                 struct device_attribute *attr,
>                 const char *buf,
>                 size_t n)
> {
>         struct pci_dev *pdev = to_pci_dev(dev);
>         int state;
> 
>         if (n < 1)
>                 return -EINVAL;
>         state = buf[0]-'0';
> ...
> 

What happens if the user abuses the interface and passes in values in
buf that are clearly out of range? e.g. state = buf[0] - '0';

> 
> --chris
> 
> 
> 
> On 12/05/2014 12:48 PM, Chris J Arges wrote:
>> BugLink: http://bugs.launchpad.net/bugs/1398544
>>
>> CONFIG_PCIEASPM_DEBUG can be used to enable/disable ASPM settings per PCIE
>> device. This config option allows for easier debugging of bugs in BIOS.
>> Enabling this adds sysfs entires to access ASPM settings for PCIe devices.
>>
>> Signed-off-by: Chris J Arges <chris.j.arges at canonical.com>
>> ---
>>  debian.master/config/config.common.ubuntu | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/debian.master/config/config.common.ubuntu b/debian.master/config/config.common.ubuntu
>> index 0f4fd6e..2d2c68f 100644
>> --- a/debian.master/config/config.common.ubuntu
>> +++ b/debian.master/config/config.common.ubuntu
>> @@ -5182,7 +5182,7 @@ CONFIG_PCI200SYN=m
>>  CONFIG_PCIEAER=y
>>  # CONFIG_PCIEAER_INJECT is not set
>>  CONFIG_PCIEASPM=y
>> -# CONFIG_PCIEASPM_DEBUG is not set
>> +CONFIG_PCIEASPM_DEBUG=y
>>  CONFIG_PCIEASPM_DEFAULT=y
>>  # CONFIG_PCIEASPM_PERFORMANCE is not set
>>  # CONFIG_PCIEASPM_POWERSAVE is not set
>>
> 





More information about the kernel-team mailing list