author | renjiang.han <renjiang.han@amlogic.com> | 2019-05-16 08:34:31 (GMT) |
---|---|---|
committer | Shen Liu <shen.liu@amlogic.com> | 2020-04-26 12:02:05 (GMT) |
commit | 51aff0ddcdeb8ec8e82de69f7cfec3f30347f81b (patch) | |
tree | eec8a613cbc730d99471ccf4d39c0de1eeb7d324 | |
parent | ffd9ae14692058e6ab1700fcb322cec75b47d2fc (diff) | |
download | common-51aff0ddcdeb8ec8e82de69f7cfec3f30347f81b.zip common-51aff0ddcdeb8ec8e82de69f7cfec3f30347f81b.tar.gz common-51aff0ddcdeb8ec8e82de69f7cfec3f30347f81b.tar.bz2 |
ppmgr: Add IS_ERR_OR_NULL to determine if the thread exists [1/1]
PD#SWPL-8658
Problem:
handle is NULL cause kernel panic.
Solution:
Add IS_ERR_OR_NULL to prevent hanle from being NULL
to cause kernel panic.
Verify:
on T962X2
Change-Id: I3086a497d99646e6475a93b5a53b3c9aca2d2ada
Signed-off-by: renjiang.han <renjiang.han@amlogic.com>
-rw-r--r-- | drivers/amlogic/media/video_processor/ppmgr/ppmgr_vpp.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/amlogic/media/video_processor/ppmgr/ppmgr_vpp.c b/drivers/amlogic/media/video_processor/ppmgr/ppmgr_vpp.c index 982c8ab..811c216 100644 --- a/drivers/amlogic/media/video_processor/ppmgr/ppmgr_vpp.c +++ b/drivers/amlogic/media/video_processor/ppmgr/ppmgr_vpp.c @@ -3607,7 +3607,10 @@ int start_ppmgr_task(void) ppmgr_quit_flag = false; task = kthread_run(ppmgr_task, 0, "ppmgr"); } - task_running = 1; + if (!IS_ERR_OR_NULL(task)) + task_running = 1; + else + task = NULL; return 0; } @@ -3616,7 +3619,7 @@ void stop_ppmgr_task(void) #ifdef PPMGR_TB_DETECT stop_tb_task(); #endif - if (task) { + if (!IS_ERR_OR_NULL(task)) { /* send_sig(SIGTERM, task, 1); */ ppmgr_quit_flag = true; up(&thread_sem); @@ -3861,7 +3864,10 @@ int start_tb_task(void) tb_detect_init(); tb_detect_task = kthread_run(tb_task, 0, "tb_detect"); } - tb_task_running = 1; + if (!IS_ERR_OR_NULL(tb_detect_task)) + tb_task_running = 1; + else + tb_detect_task = NULL; return 0; } @@ -3869,7 +3875,7 @@ void stop_tb_task(void) { int val = 0; - if (tb_detect_task) { + if (!IS_ERR_OR_NULL(tb_detect_task)) { tb_quit_flag = true; up(&tb_sem); /* send_sig(SIGTERM, tb_detect_task, 1); */ |