History

Merge tag 's390-6.0-5' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Pull s390 fix from Vasily Gorbik: - Fix potential hangs in VFIO AP driver * tag 's390-6.0-5' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: s390/vfio-ap: bypass unnecessary processing of AP resources

Linus Torvalds committed 4 years ago

Commit 23b99232 parents 42f9508 1918f2b1 file · +30 −0Browse files

Unified · Split

drivers/s390/crypto/vfio_ap_ops.c+30−0
@@ -984,6 +984,11 @@ static ssize_t assign_adapter_store(struct device *dev, · 983 unmodified lines
984 goto done;984 goto done;
985 }985 }
986 986
987 if (test_bit_inv(apid, matrix_mdev->matrix.apm)) {
988 ret = count;
989 goto done;
990 }
991
987 set_bit_inv(apid, matrix_mdev->matrix.apm);992 set_bit_inv(apid, matrix_mdev->matrix.apm);
988 993
989 ret = vfio_ap_mdev_validate_masks(matrix_mdev);994 ret = vfio_ap_mdev_validate_masks(matrix_mdev);
@@ -1109,6 +1114,11 @@ static ssize_t unassign_adapter_store(struct device *dev, · 119 unmodified lines
1109 goto done;1114 goto done;
1110 }1115 }
1111 1116
1117 if (!test_bit_inv(apid, matrix_mdev->matrix.apm)) {
1118 ret = count;
1119 goto done;
1120 }
1121
1112 clear_bit_inv((unsigned long)apid, matrix_mdev->matrix.apm);1122 clear_bit_inv((unsigned long)apid, matrix_mdev->matrix.apm);
1113 vfio_ap_mdev_hot_unplug_adapter(matrix_mdev, apid);1123 vfio_ap_mdev_hot_unplug_adapter(matrix_mdev, apid);
1114 ret = count;1124 ret = count;
@@ -1183,6 +1193,11 @@ static ssize_t assign_domain_store(struct device *dev, · 68 unmodified lines
1183 goto done;1193 goto done;
1184 }1194 }
1185 1195
1196 if (test_bit_inv(apqi, matrix_mdev->matrix.aqm)) {
1197 ret = count;
1198 goto done;
1199 }
1200
1186 set_bit_inv(apqi, matrix_mdev->matrix.aqm);1201 set_bit_inv(apqi, matrix_mdev->matrix.aqm);
1187 1202
1188 ret = vfio_ap_mdev_validate_masks(matrix_mdev);1203 ret = vfio_ap_mdev_validate_masks(matrix_mdev);
@@ -1286,6 +1301,11 @@ static ssize_t unassign_domain_store(struct device *dev, · 97 unmodified lines
1286 goto done;1301 goto done;
1287 }1302 }
1288 1303
1304 if (!test_bit_inv(apqi, matrix_mdev->matrix.aqm)) {
1305 ret = count;
1306 goto done;
1307 }
1308
1289 clear_bit_inv((unsigned long)apqi, matrix_mdev->matrix.aqm);1309 clear_bit_inv((unsigned long)apqi, matrix_mdev->matrix.aqm);
1290 vfio_ap_mdev_hot_unplug_domain(matrix_mdev, apqi);1310 vfio_ap_mdev_hot_unplug_domain(matrix_mdev, apqi);
1291 ret = count;1311 ret = count;
@@ -1329,6 +1349,11 @@ static ssize_t assign_control_domain_store(struct device *dev, · 37 unmodified lines
1329 goto done;1349 goto done;
1330 }1350 }
1331 1351
1352 if (test_bit_inv(id, matrix_mdev->matrix.adm)) {
1353 ret = count;
1354 goto done;
1355 }
1356
1332 /* Set the bit in the ADM (bitmask) corresponding to the AP control1357 /* Set the bit in the ADM (bitmask) corresponding to the AP control
1333 * domain number (id). The bits in the mask, from most significant to1358 * domain number (id). The bits in the mask, from most significant to
1334 * least significant, correspond to IDs 0 up to the one less than the1359 * least significant, correspond to IDs 0 up to the one less than the
@@ -1378,6 +1403,11 @@ static ssize_t unassign_control_domain_store(struct device *dev, · 43 unmodified lines
1378 goto done;1403 goto done;
1379 }1404 }
1380 1405
1406 if (!test_bit_inv(domid, matrix_mdev->matrix.adm)) {
1407 ret = count;
1408 goto done;
1409 }
1410
1381 clear_bit_inv(domid, matrix_mdev->matrix.adm);1411 clear_bit_inv(domid, matrix_mdev->matrix.adm);
1382 1412
1383 if (test_bit_inv(domid, matrix_mdev->shadow_apcb.adm)) {1413 if (test_bit_inv(domid, matrix_mdev->shadow_apcb.adm)) {