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

[Xen-devel] locking in drivers/xen/xen-pciback/passthrough.c:__xen_pcibk_publish_pci_roots()



Konrad,

this function, before calling the passed in callback, drops the lock it
acquired at the beginning of the function, and re-acquires it after the
callback returned. It also uses list_for_each_entry_safe() in an
apparent attempt to deal with races here. However, I'm getting the
impression that this wouldn't really work (as the construct really isn't
meant for this case): If in the meantime the successor element got
removed from the list, the loop continuation would access data that
may already have got freed.

I see two possible solutions: Either after re-acquiring the lock the
function checks whether the current object is sill on the list, starting
over if not found (xen_pcibk_publish_pci_root() makes sure a
device doesn't get published twice), or (if so possible) the lock gets
converted to a mutex (which should be safe to be held across the
callback invocation).

What are your thoughts here?

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.