Workqueue bug in v1.9.0 and v1.10.0, Request review for this patch.


Xin Zhou
 

Hi


In v1.9.0 and v1.10.0, when remove from the queue if already submitted, k_delayed_work_cancel() did not clear bit of work.flags.

This will cause the queue already submitted can not be handled by queue manager.


Certainly, we have tested and verified on our local side. Request review for our patch as below:


zephyr-zephyr-v1.9.0\kernel\work_q.c

zephyr-zephyr-v1.10.0\kernel\work_q.c                                                                                                                                   Patch of Sanechips

===================================================================

--- zephyr-zephyr-v1.9.0/kernel/work_q.c        (revision 65)

+++ zephyr-zephyr-v1.9.0/kernel/work_q.c        (working copy)

@@ -123,11 +123,17 @@

        }


        if (k_work_pending(&work->work)) {

+

+               /*zxic modify*/

+               atomic_clear_bit(work->work.flags,K_WORK_STATE_PENDING);

+

+

                /* Remove from the queue if already submitted */

                if (!k_queue_remove(&work->work_q->queue, &work->work)) {

                        irq_unlock(key);

                        return -EINVAL;

                }

+

        } else {

                _abort_timeout(&work->timeout);

        }






周欣 Zhou Xin


安全操作系统与驱动
解决方案一部/解决方案部/深圳市中兴微电子技术有限公司


南京市雨花台区紫荆花路68号中兴通讯南京研发中心4C

4C/F, ZTE R&D Center(NanJing), No.68 ZiJinghua Road, 

YuHuatai District, Nanjing, P.R.China, 210012

T: 025-52870384

M: +86 13770868539

E: zhou.xin8@...

Join devel@lists.zephyrproject.org to automatically receive all group messages.