* [PATCH v2] staging: vc04_services: vchiq_core: Log through struct vchiq_instance
@ 2023-11-28 20:18 Umang Jain
0 siblings, 0 replies; only message in thread
From: Umang Jain @ 2023-11-28 20:18 UTC (permalink / raw)
To: linux-staging, linux-rpi-kernel, linux-arm-kernel, linux-media
Cc: Stefan Wahren, Greg Kroah-Hartman, Dan Carpenter, Kieran Bingham,
Laurent Pinchart, Dave Stevenson, Ricardo B . Marliere,
Umang Jain
The handle_to_service() helper can return NULL, so `service` pointer
can indeed be set to NULL. So, do not log through service pointer
(which can cause NULL-deference), instead, use the vchiq_instance
function argument to get access to the struct device.
Fixes: f67af5940d6d ("staging: vc04: Convert(and rename) vchiq_log_info() to use dynamic debug")
Reviewed-by: Ricardo B. Marliere <ricardo@marliere.net>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
---
Changes in v2:
- Separate out from patch series:
[PATCH 1/9] staging: vc04_services: vchiq_core: Log through struct vchiq_instance
- Add missing space in FixeS: tag
---
.../staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 0468689a6325..e0022acb4c58 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -245,7 +245,7 @@ find_service_by_handle(struct vchiq_instance *instance, unsigned int handle)
return service;
}
rcu_read_unlock();
- vchiq_log_debug(service->state->dev, VCHIQ_CORE,
+ vchiq_log_debug(instance->state->dev, VCHIQ_CORE,
"Invalid service handle 0x%x", handle);
return NULL;
}
@@ -287,7 +287,7 @@ find_service_for_instance(struct vchiq_instance *instance, unsigned int handle)
return service;
}
rcu_read_unlock();
- vchiq_log_debug(service->state->dev, VCHIQ_CORE,
+ vchiq_log_debug(instance->state->dev, VCHIQ_CORE,
"Invalid service handle 0x%x", handle);
return NULL;
}
@@ -310,7 +310,7 @@ find_closed_service_for_instance(struct vchiq_instance *instance, unsigned int h
return service;
}
rcu_read_unlock();
- vchiq_log_debug(service->state->dev, VCHIQ_CORE,
+ vchiq_log_debug(instance->state->dev, VCHIQ_CORE,
"Invalid service handle 0x%x", handle);
return service;
}
--
2.41.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-28 20:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-28 20:18 [PATCH v2] staging: vc04_services: vchiq_core: Log through struct vchiq_instance Umang Jain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox