mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-05 21:44:23 -04:00
drm/xe/oa: Fix potential NPD when OA is not initialized
If oa->xe can be NULL then we shall not use it as a valid pointer. Fixes:cdf02fe1a9("drm/xe/oa/uapi: Add/remove OA config perf ops") Fixes:b6fd51c621("drm/xe/oa/uapi: Define and parse OA stream properties") Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com> Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240619175427.861-1-michal.wajdeczko@intel.com
This commit is contained in:
committed by
Ashutosh Dixit
parent
7a893345a4
commit
cb925d31f0
@@ -1725,7 +1725,8 @@ static int xe_oa_user_extensions(struct xe_oa *oa, u64 extension, int ext_number
|
||||
*/
|
||||
int xe_oa_stream_open_ioctl(struct drm_device *dev, u64 data, struct drm_file *file)
|
||||
{
|
||||
struct xe_oa *oa = &to_xe_device(dev)->oa;
|
||||
struct xe_device *xe = to_xe_device(dev);
|
||||
struct xe_oa *oa = &xe->oa;
|
||||
struct xe_file *xef = to_xe_file(file);
|
||||
struct xe_oa_open_param param = {};
|
||||
const struct xe_oa_format *f;
|
||||
@@ -1733,7 +1734,7 @@ int xe_oa_stream_open_ioctl(struct drm_device *dev, u64 data, struct drm_file *f
|
||||
int ret;
|
||||
|
||||
if (!oa->xe) {
|
||||
drm_dbg(&oa->xe->drm, "xe oa interface not available for this system\n");
|
||||
drm_dbg(&xe->drm, "xe oa interface not available for this system\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -2005,7 +2006,8 @@ static int create_dynamic_oa_sysfs_entry(struct xe_oa *oa,
|
||||
*/
|
||||
int xe_oa_add_config_ioctl(struct drm_device *dev, u64 data, struct drm_file *file)
|
||||
{
|
||||
struct xe_oa *oa = &to_xe_device(dev)->oa;
|
||||
struct xe_device *xe = to_xe_device(dev);
|
||||
struct xe_oa *oa = &xe->oa;
|
||||
struct drm_xe_oa_config param;
|
||||
struct drm_xe_oa_config *arg = ¶m;
|
||||
struct xe_oa_config *oa_config, *tmp;
|
||||
@@ -2013,7 +2015,7 @@ int xe_oa_add_config_ioctl(struct drm_device *dev, u64 data, struct drm_file *fi
|
||||
int err, id;
|
||||
|
||||
if (!oa->xe) {
|
||||
drm_dbg(&oa->xe->drm, "xe oa interface not available for this system\n");
|
||||
drm_dbg(&xe->drm, "xe oa interface not available for this system\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -2106,13 +2108,14 @@ int xe_oa_add_config_ioctl(struct drm_device *dev, u64 data, struct drm_file *fi
|
||||
*/
|
||||
int xe_oa_remove_config_ioctl(struct drm_device *dev, u64 data, struct drm_file *file)
|
||||
{
|
||||
struct xe_oa *oa = &to_xe_device(dev)->oa;
|
||||
struct xe_device *xe = to_xe_device(dev);
|
||||
struct xe_oa *oa = &xe->oa;
|
||||
struct xe_oa_config *oa_config;
|
||||
u64 arg, *ptr = u64_to_user_ptr(data);
|
||||
int ret;
|
||||
|
||||
if (!oa->xe) {
|
||||
drm_dbg(&oa->xe->drm, "xe oa interface not available for this system\n");
|
||||
drm_dbg(&xe->drm, "xe oa interface not available for this system\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user