Re: [PATCH] PCI: Fix racing for pci device removing via sysfs

From: Yinghai Lu
Date: Fri Apr 26 2013 - 16:21:12 EST


On Fri, Apr 26, 2013 at 9:28 AM, Bjorn Helgaas <bhelgaas@xxxxxxxxxx> wrote:
> This is a gross hack. Iterating through all known pci_devs to see if
> this one still exists?
>
> I reproduced the original problem, applied this patch, and verified
> that it avoids the original crash.
>
> However, it's still incorrect because now you're looking at pdev after
> it's been freed. With CONFIG_SLUB_DEBUG_ON=y, the removal still causes
> a crash in remove_callback().
>

Yes, there is small window, that could have bus and dev get freed...

Please check attached that should address your concerns.

Thanks

Yinghai

Attachment: remove_callback_clean.patch
Description: Binary data

Attachment: fix_racing_removing_2.patch
Description: Binary data