lkml.org 
[lkml]   [2013]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 04/10] PCI: Destroy pci dev only once
From
On Tue, Nov 26, 2013 at 5:24 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>
> So assume pci_destroy_dev() is called twice in parallel for the same dev
> by two different threads. Thread 1 does the atomic_inc_and_test() and
> finds that it is OK to do the device_del() and put_device() which causes
> the device object to be freed. Then thread 2 does the atomic_inc_and_test()
> on the already freed device object and crashes the kernel.
>
thread2 should still hold one extra reference.
that is in
device_schedule_callback
==> sysfs_schedule_callback
==> kobject_get(kobj)

pci_destroy_dev for thread2 is called at this point.

and that reference will be released from
sysfs_schedule_callback
==> kobject_put()...

Thanks

Yinghai


\
 
 \ /
  Last update: 2013-11-27 03:41    [W:0.192 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site