hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/misc/sgi-gru/grufault.c
....@@ -648,6 +648,7 @@
648648 if ((cb & (GRU_HANDLE_STRIDE - 1)) || ucbnum >= GRU_NUM_CB)
649649 return -EINVAL;
650650
651
+again:
651652 gts = gru_find_lock_gts(cb);
652653 if (!gts)
653654 return -EINVAL;
....@@ -656,7 +657,11 @@
656657 if (ucbnum >= gts->ts_cbr_au_count * GRU_CBR_AU_SIZE)
657658 goto exit;
658659
659
- gru_check_context_placement(gts);
660
+ if (gru_check_context_placement(gts)) {
661
+ gru_unlock_gts(gts);
662
+ gru_unload_context(gts, 1);
663
+ goto again;
664
+ }
660665
661666 /*
662667 * CCH may contain stale data if ts_force_cch_reload is set.
....@@ -874,7 +879,11 @@
874879 } else {
875880 gts->ts_user_blade_id = req.val1;
876881 gts->ts_user_chiplet_id = req.val0;
877
- gru_check_context_placement(gts);
882
+ if (gru_check_context_placement(gts)) {
883
+ gru_unlock_gts(gts);
884
+ gru_unload_context(gts, 1);
885
+ return ret;
886
+ }
878887 }
879888 break;
880889 case sco_gseg_owner: