mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
staging: vchiq_core: handle NULL result of find_service_by_handle
[ Upstream commit ca225857fa ]
In case of an invalid handle the function find_servive_by_handle
returns NULL. So take care of this and avoid a NULL pointer dereference.
Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/1642968143-19281-18-git-send-email-stefan.wahren@i2se.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
be4ecca958
commit
aa0b729678
|
|
@ -2280,6 +2280,9 @@ void vchiq_msg_queue_push(unsigned int handle, struct vchiq_header *header)
|
||||||
struct vchiq_service *service = find_service_by_handle(handle);
|
struct vchiq_service *service = find_service_by_handle(handle);
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
|
if (!service)
|
||||||
|
return;
|
||||||
|
|
||||||
while (service->msg_queue_write == service->msg_queue_read +
|
while (service->msg_queue_write == service->msg_queue_read +
|
||||||
VCHIQ_MAX_SLOTS) {
|
VCHIQ_MAX_SLOTS) {
|
||||||
if (wait_for_completion_interruptible(&service->msg_queue_pop))
|
if (wait_for_completion_interruptible(&service->msg_queue_pop))
|
||||||
|
|
@ -2299,6 +2302,9 @@ struct vchiq_header *vchiq_msg_hold(unsigned int handle)
|
||||||
struct vchiq_header *header;
|
struct vchiq_header *header;
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
|
if (!service)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (service->msg_queue_write == service->msg_queue_read)
|
if (service->msg_queue_write == service->msg_queue_read)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user