Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] drm/xe/pf: NULL deref in xe_lmtt_page_size() via unguarded debugfs paths --
commit 2b2063f5a4b0e6ca91307ed198eee693dd8674d9 Author: Lu Yao <[email protected]> drm/xe/gt: Log LMTT init failure and block VF operations This commit logs an error when xe_lmtt_init() fails during GT initialization while keeping the PF alive, and adds a readiness check in xe_sriov_pf_wait_ready() to reject subsequent VF operations when the LMTT is uninitialized. Link: https://lore.kernel.org/dri-devel/[email protected]/ > diff --git a/drivers/gpu/drm/xe/xe_sriov_pf.c > b/drivers/gpu/drm/xe/xe_sriov_pf.c > index 33bd754d138fa..2122964610a0f 100644 > --- a/drivers/gpu/drm/xe/xe_sriov_pf.c > +++ b/drivers/gpu/drm/xe/xe_sriov_pf.c [ ... ] > @@ -143,6 +145,18 @@ int xe_sriov_pf_init_late(struct xe_device *xe) > return 0; > } > > +static int pf_check_lmtt(struct xe_device *xe) > +{ > + struct xe_tile *tile; > + unsigned int id; > + > + for_each_tile(tile, xe, id) > + if (!xe_lmtt_is_ready(&tile->sriov.pf.lmtt)) > + return -ENODEV; > + > + return 0; > +} > + > /** > * xe_sriov_pf_wait_ready() - Wait until PF is ready to operate. > * @xe: the &xe_device to test > @@ -160,6 +174,10 @@ int xe_sriov_pf_wait_ready(struct xe_device *xe) > if (xe_device_wedged(xe)) > return -ECANCELED; > > + err = pf_check_lmtt(xe); > + if (err) > + return err; [Severity: Medium] Can PF-side VF debugfs handlers still reach the uninitialized LMTT and dereference a NULL lmtt->ops pointer when xe_lmtt_init() fails? When xe_lmtt_init() fails, it clears lmtt->ops and leaves lmtt->pd NULL, while gt_init_lmtt() lets probe complete and register SR-IOV debugfs files. Not all PF-side VF debugfs entry points call xe_sriov_pf_wait_ready(). For example, writing a KLV blob containing GUC_KLV_VF_CFG_LMEM_SIZE_KEY to config_blob runs config_blob_write() -> xe_gt_sriov_pf_config_restore() -> pf_restore_vf_config_klv() -> pf_provision_vf_lmem() -> pf_get_lmem_alignment() -> xe_lmtt_page_size(), which hits lmtt_assert(lmtt, lmtt->ops) and dereferences lmtt->ops in lmtt_page_size(). -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1
