Commit 774a1fa
s390/pci: Serialize device addition and removal
Prior changes ensured that when zpci_release_device() is called and it
removed the zdev from the zpci_list this instance can not be found via
the zpci_list anymore even while allowing re-add of reserved devices.
This only accounts for the overall lifetime and zpci_list addition and
removal, it does not yet prevent concurrent add of a new instance for
the same underlying device. Such concurrent add would subsequently cause
issues such as attempted re-use of the same IOMMU sysfs directory and is
generally undesired.
Introduce a new zpci_add_remove_lock mutex to serialize adding a new
device with removal. Together this ensures that if a struct zpci_dev is
not found in the zpci_list it was either already removed and torn down,
or its removal and tear down is in progress with the
zpci_add_remove_lock held.
Cc: stable@vger.kernel.org
Fixes: a46044a ("s390/pci: fix zpci_zdev_put() on reserve")
Reviewed-by: Gerd Bayer <gbayer@linux.ibm.com>
Tested-by: Gerd Bayer <gbayer@linux.ibm.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>1 parent 4b1815a commit 774a1fa
1 file changed
+7
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| 78 | + | |
77 | 79 | | |
| 80 | + | |
78 | 81 | | |
79 | 82 | | |
80 | 83 | | |
| |||
844 | 847 | | |
845 | 848 | | |
846 | 849 | | |
| 850 | + | |
847 | 851 | | |
848 | 852 | | |
849 | 853 | | |
| |||
857 | 861 | | |
858 | 862 | | |
859 | 863 | | |
| 864 | + | |
860 | 865 | | |
861 | 866 | | |
862 | 867 | | |
863 | 868 | | |
864 | 869 | | |
865 | 870 | | |
| 871 | + | |
866 | 872 | | |
867 | 873 | | |
868 | 874 | | |
| |||
953 | 959 | | |
954 | 960 | | |
955 | 961 | | |
| 962 | + | |
956 | 963 | | |
957 | 964 | | |
958 | 965 | | |
| |||
0 commit comments