Skip to content

Commit 3db89bc

Browse files
lategoodbyegregkh
authored andcommitted
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: 863a756 ("staging: vc04_services: vchiq_core: Stop kthreads on vchiq module unload") Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/20250309125014.37166-3-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 63f4dbb commit 3db89bc

File tree

1 file changed

+2
-1
lines changed
  • drivers/staging/vc04_services/interface/vchiq_arm

1 file changed

+2
-1
lines changed

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,8 @@ static void vchiq_remove(struct platform_device *pdev)
14221422
kthread_stop(mgmt->state.slot_handler_thread);
14231423

14241424
arm_state = vchiq_platform_get_arm_state(&mgmt->state);
1425-
kthread_stop(arm_state->ka_thread);
1425+
if (!IS_ERR_OR_NULL(arm_state->ka_thread))
1426+
kthread_stop(arm_state->ka_thread);
14261427
}
14271428

14281429
static struct platform_driver vchiq_driver = {

0 commit comments

Comments
 (0)