media: fixes an issue where the CTS cause the kernel crash
authorNanxin Qin <nanxin.qin@amlogic.com>
Tue, 6 Mar 2018 08:18:46 +0000 (16:18 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Thu, 8 Mar 2018 08:32:00 +0000 (00:32 -0800)
PD#161202: recycles the vf data before must to be checked.

Change-Id: Ief413c5169d859be632f4799d6897ae1322e2fbb
Signed-off-by: Nanxin Qin <nanxin.qin@amlogic.com>
drivers/amlogic/media/video_sink/video.c

index 4455d3c..90dd822 100644 (file)
@@ -6132,6 +6132,7 @@ static void set_omx_pts(u32 *p)
        u32 set_from_hwc = p[2];
        u32 frame_num = p[3];
        u32 not_reset = p[4];
+       unsigned int try_cnt = 0x1000;
 
        mutex_lock(&omx_mutex);
        if (omx_pts_set_index < frame_num)
@@ -6155,12 +6156,13 @@ static void set_omx_pts(u32 *p)
        } else if (set_from_hwc == 0 && !omx_run) {
                struct vframe_s *vf = NULL;
 
-               while (1) {
+               while (try_cnt--) {
                        vf = vf_peek(RECEIVER_NAME);
                        if (vf) {
                                if (frame_num >= vf->omx_index) {
                                        vf = vf_get(RECEIVER_NAME);
-                                       vf_put(vf, RECEIVER_NAME);
+                                       if (vf)
+                                               vf_put(vf, RECEIVER_NAME);
                                } else
                                        break;
                        } else