Commit 3db89bc6 authored by Stefan Wahren's avatar Stefan Wahren Committed by Greg Kroah-Hartman
Browse files

staging: vchiq_arm: Fix possible NPR of keep-alive thread



In case vchiq_platform_conn_state_changed() is never called or fails before
driver removal, ka_thread won't be a valid pointer to a task_struct. So
do the necessary checks before calling kthread_stop to avoid a crash.

Fixes: 863a756a ("staging: vc04_services: vchiq_core: Stop kthreads on vchiq module unload")
Signed-off-by: default avatarStefan Wahren <wahrenst@gmx.net>
Link: https://lore.kernel.org/r/20250309125014.37166-3-wahrenst@gmx.net


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 63f4dbb1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1422,6 +1422,7 @@ static void vchiq_remove(struct platform_device *pdev)
	kthread_stop(mgmt->state.slot_handler_thread);

	arm_state = vchiq_platform_get_arm_state(&mgmt->state);
	if (!IS_ERR_OR_NULL(arm_state->ka_thread))
		kthread_stop(arm_state->ka_thread);
}