Re: [PATCH v2 1/3] PCI: Data corruption happening due to race condition

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

 



On Sun, Jul 1, 2018 at 7:36 PM, Lukas Wunner <lukas@xxxxxxxxx> wrote:
> On Fri, Jun 29, 2018 at 03:57:39PM +0530, Hari Vyas wrote:
>> Fix moves device addition is_added bit to separate private flag
>> variable and use different atomic functions to set, clear and
>> retrieve device addition state. As is_added shares different
>> memory location so race condition is avoided.
>
> As 0-day has already discovered, you need to squash all 3 patches
> together to avoid breaking the build.
>
>
Agreed. I will squash and raise a new patch
>> +static inline int pci_dev_set_added(struct pci_dev *dev, void *unused)
>> +{
>> +     set_bit(PCI_DEV_ADDED, &dev->priv_flags);
>> +     return 0;
>> +}
>> +
>> +static inline int pci_dev_clear_added(struct pci_dev *dev, void *unused)
>> +{
>> +     clear_bit(PCI_DEV_ADDED, &dev->priv_flags);
>> +     return 0;
>> +}
>
> You don't need the "unused" parameter here and you can return void.
> pci_dev_set_disconnected() has the parameter because the function is
> passed in to pci_walk_bus() in a few places, but you're not doing that
> AFAICS.
>
> What you *could* do however is collapse pci_dev_set_added() and
> pci_dev_clear_added() into a single function, pass in a bool "added",
> then use assign_bit() to set or clear it.  It would save 6 LoC.
>
Agreed.  Just for symmetry I did that one. Will incorporate change.
> Thanks,
>
> Lukas



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux