Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47bc95ca authored by Jeyaprakash Soundrapandian's avatar Jeyaprakash Soundrapandian Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: mem: Validate return value of dma_buf_get" into dev/msm-4.14-camx

parents dd89b26d 303e710b
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -433,6 +433,7 @@ static int cam_mem_util_get_dma_buf_fd(size_t len,
	struct dma_buf **buf,
	int *fd)
{
	struct dma_buf *dmabuf = NULL;
	int rc = 0;

	if (!buf || !fd) {
@@ -456,7 +457,11 @@ static int cam_mem_util_get_dma_buf_fd(size_t len,
	 * when we close fd, refcount becomes 1 and when we do
	 * dmap_put_buf, ref count becomes 0 and memory will be freed.
	 */
	dma_buf_get(*fd);
	dmabuf = dma_buf_get(*fd);
	if (IS_ERR_OR_NULL(dmabuf)) {
		CAM_ERR(CAM_MEM, "dma_buf_get failed, *fd=%d", *fd);
		rc = -EINVAL;
	}

	return rc;