Browse Source

video: driver: add error handling at event_queue_deinit sequence

If msm_vidc_open() sequence fails before calling event_queue_init()
then it calls msm_vidc_close as part of cleanup.

So event_queue_deinit will attempt to call v4l2_fh_del without
completing v4l2_fh_init & v4l2_fh_add. So i.e leading to NULL ptr
dereferrence issue at v4l2_fh_del api.

Added change to avoid calling event_queue_deinit() sequence, if
event_queue_init is not completed.

Change-Id: Ia2732c39be819247379d955d40dddccaba7c00eb
Signed-off-by: Govindaraj Rajagopal <[email protected]>
Govindaraj Rajagopal 4 năm trước cách đây
mục cha
commit
58207fc7d8
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  1. 6 0
      driver/vidc/src/msm_vidc_driver.c

+ 6 - 0
driver/vidc/src/msm_vidc_driver.c

@@ -3433,6 +3433,12 @@ int msm_vidc_event_queue_deinit(struct msm_vidc_inst *inst)
 		return -EINVAL;
 	}
 
+	/* do not deinit, if not already inited */
+	if (!inst->event_handler.vdev) {
+		i_vpr_e(inst, "%s: already not inited\n", __func__);
+		return 0;
+	}
+
 	v4l2_fh_del(&inst->event_handler);
 	v4l2_fh_exit(&inst->event_handler);