pci_enable_sriov is not thread safe

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

 



Hi,
I've noticed that pci_enable_sriov() is not thread safe. 
Running it in parallel with the following command:
echo 2 >  /sys/class/net/enp66s0f0/device/sriov_numvfs  & echo 2 >  /sys/class/net/enp66s0f0/device/sriov_numvfs
triggers the BUG_ON() at [1].
I'm wondering if device driver is supposed to prevent this?
Or whether this is acceptable because admin privileges are required to trigger it?

This issue concerns me because I'm working on VFIO sriov support[2] 
and I would like give untrusted VMs the ability to call pci_enable_sriov().

I've noticed that we do have an sriov mutex but we take it only inside virtfn_add()
rather than around the entire sriov_enable() function. Is there a good reason for that?

[1] http://lxr.free-electrons.com/source/drivers/pci/iov.c#L155
[2] http://www.spinics.net/lists/kvm/msg127075.html

Thanks,
Ilya
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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