diff options
| author | Jesse.Zhang <Jesse.Zhang@amd.com> | 2025-10-13 16:58:25 +0800 |
|---|---|---|
| committer | Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> | 2025-10-14 13:17:34 +0530 |
| commit | 74e2c12ea287089f093a1e37fd2b8b8c7dd41c9f (patch) | |
| tree | bd991a3cd9a5c2502a1c513b588491cae12a3c11 /tools/perf/scripts/python/syscall-counts.py | |
| parent | dba5f91829aef3ab1b3bdd7933d544a397aa9af5 (diff) | |
| download | linux-74e2c12ea287089f093a1e37fd2b8b8c7dd41c9f.tar.gz linux-74e2c12ea287089f093a1e37fd2b8b8c7dd41c9f.zip | |
drm/ttm: Add safety check for NULL man->bdev in ttm_resource_manager_usage
The `ttm_resource_manager_usage()` function currently assumes `man->bdev` is non-NULL when accessing `man->bdev->lru_lock`.
However, in scenarios where the resource manager is not fully initialized (e.g., APU platforms that lack dedicated VRAM, or incomplete manager setup),
`man->bdev` may remain NULL. This leads to a NULL pointer dereference when attempting to acquire the `lru_lock`, triggering kernel OOPS.
Fix this by adding an explicit safety check for `man->bdev` before accessing its members:
- Use `WARN_ON_ONCE(!man->bdev)` to emit a one-time warning (a soft assertion) when `man->bdev` is NULL. This helps catch invalid usage patterns during debugging without breaking production workflows.
- Return 0 immediately if `man->bdev` is NULL, as a non-initialized manager cannot have valid resource usage to report.
Suggested-by: Christian König <christian.koenig@amd.com>
Suggested-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Jesse Zhang <jesse.zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Link: https://lore.kernel.org/r/20251013085849.1735612-1-Jesse.Zhang@amd.com
Diffstat (limited to 'tools/perf/scripts/python/syscall-counts.py')
0 files changed, 0 insertions, 0 deletions
