author | apollo.ling <apollo.ling@amlogic.com> | 2020-05-21 07:26:40 (GMT) |
---|---|---|
committer | Hui Zhang <hui.zhang@amlogic.com> | 2020-05-25 05:36:03 (GMT) |
commit | 2743b7c1998bde0d926cada1c68feafddfab50ba (patch) | |
tree | a59c2fec020356706798b99a0f98de119fc7df65 | |
parent | d44eaef0a3e91a2e4cfa7b0fc423a3b57387883c (diff) | |
download | media_modules-2743b7c1998bde0d926cada1c68feafddfab50ba.zip media_modules-2743b7c1998bde0d926cada1c68feafddfab50ba.tar.gz media_modules-2743b7c1998bde0d926cada1c68feafddfab50ba.tar.bz2 |
vdec: add lock to core_show function [1/1]
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>
-rw-r--r-- | drivers/frame_provider/decoder/utils/vdec.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/frame_provider/decoder/utils/vdec.c b/drivers/frame_provider/decoder/utils/vdec.c index dfcd1c8..ddb51bb 100644 --- a/drivers/frame_provider/decoder/utils/vdec.c +++ b/drivers/frame_provider/decoder/utils/vdec.c @@ -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; } |