staging: vchiq_arm: Avoid NULL ptr deref in vchiq_dump_platform_instances

vchiq_get_state() can return a NULL pointer. So handle this cases and
avoid a NULL pointer derefence in vchiq_dump_platform_instances.

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-17-git-send-email-stefan.wahren@i2se.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Stefan Wahren 2022-01-23 21:02:21 +01:00 committed by Greg Kroah-Hartman
parent 914813cc52
commit aa899e686d

View file

@ -1204,6 +1204,9 @@ int vchiq_dump_platform_instances(void *dump_context)
int len;
int i;
if (!state)
return -ENOTCONN;
/*
* There is no list of instances, so instead scan all services,
* marking those that have been dumped.