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

Commit eaacf31d authored by Surajit Podder's avatar Surajit Podder Committed by Gerrit - the friendly Code Review server
Browse files

msm_vidc: Clear pendingq when releasing buffers



Clear pendingq when releasing buffers to ensure
that invalid buffers are not accessed when new
buffers are queued.

Change-Id: I7ce2babe8bcc25b2582e92f04fc4233a6cfc8ef1
Signed-off-by: default avatarSurajit Podder <spodder@codeaurora.org>
parent b184cdd6
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -720,6 +720,7 @@ int msm_vidc_release_buffers(void *instance, int buffer_type)
	struct buffer_info *bi, *dummy;
	struct v4l2_buffer buffer_info;
	struct v4l2_plane plane[VIDEO_MAX_PLANES];
	struct vb2_buf_entry *temp, *next;
	int i, rc = 0;

	if (!inst)
@@ -807,6 +808,15 @@ free_and_unmap:
		}
	}
	mutex_unlock(&inst->registeredbufs.lock);

	mutex_lock(&inst->pendingq.lock);
	list_for_each_entry_safe(temp, next, &inst->pendingq.list, list) {
		if (temp->vb->type == buffer_type) {
			list_del(&temp->list);
			kfree(temp);
		}
	}
	mutex_unlock(&inst->pendingq.lock);
	return rc;
}
EXPORT_SYMBOL(msm_vidc_release_buffers);