vdec: add lock to core_show function [1/1]
authorapollo.ling <apollo.ling@amlogic.com>
Thu, 21 May 2020 07:26:40 +0000 (15:26 +0800)
committerHui Zhang <hui.zhang@amlogic.com>
Mon, 25 May 2020 05:36:03 +0000 (22:36 -0700)
PD#SWPL-26415

Problem:
There is no lock in core_show function when access core->connected_vdec_list

Solution:
Add lock to the function.

Verify:
u212

Change-Id: I6cc9cf9126f9b3a52fbed492109e8c150702c1c9
Signed-off-by: apollo.ling <apollo.ling@amlogic.com>
drivers/frame_provider/decoder/utils/vdec.c

index dfcd1c89d86c8d1218bc95e030ff20474c3e6f50..ddb51bbec91b37a88549503c436de0608aa0ba84 100644 (file)
@@ -4955,6 +4955,7 @@ static ssize_t core_show(struct class *class, struct class_attribute *attr,
 {
        struct vdec_core_s *core = vdec_core;
        char *pbuf = buf;
+       unsigned long flags = vdec_core_lock(vdec_core);
 
        if (list_empty(&core->connected_vdec_list))
                pbuf += sprintf(pbuf, "connected vdec list empty\n");
@@ -4978,6 +4979,7 @@ static ssize_t core_show(struct class *class, struct class_attribute *attr,
                }
        }
 
+       vdec_core_unlock(vdec_core, flags);
        return pbuf - buf;
 }