浏览代码

video: driver: reset required buffer attributes

Reset all attributes except read only attribute
in msm_vidc_get_driver_buf() for an existing buffer
to avoid buffer flow problems in driver.

Change-Id: If6170caa9b9315f73b6023ef496aed2ba3e6efba
Signed-off-by: Maheshwar Ajja <[email protected]>
Maheshwar Ajja 4 年之前
父节点
当前提交
0cae147e2a
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      driver/vidc/src/msm_vidc_driver.c

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

@@ -1380,7 +1380,11 @@ struct msm_vidc_buffer *msm_vidc_get_driver_buf(struct msm_vidc_inst *inst,
 		buf->dmabuf = dmabuf;
 		INIT_LIST_HEAD(&buf->list);
 		list_add_tail(&buf->list, &buffers->list);
+	} else {
+		/* reset all attributes except read only */
+		buf->attr &= MSM_VIDC_ATTR_READ_ONLY;
 	}
+
 	rc = vb2_buffer_to_driver(vb2, buf);
 	if (rc)
 		goto error;