Commit 42ec2f07 authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab
Browse files

media: atomisp: fix uninitialized stack mem usage in ia_css_rmgr_acq_vbuf()

When ia_css_rmgr_acq_vbuf() enters the code path where it uses the local
"struct ia_css_rmgr_vbuf_handle v" on the stack it relies on v.count==0
so that ia_css_rmgr_refcount_retain_vbuf allocates a new handle.

Explicitly set v.count to 0 rather then it being whatever was on the stack.

Link: https://lore.kernel.org/linux-media/20220612160556.108264-3-hdegoede@redhat.com


Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent a3b36a8c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -254,7 +254,7 @@ void rmgr_pop_handle(struct ia_css_rmgr_vbuf_pool *pool,
void ia_css_rmgr_acq_vbuf(struct ia_css_rmgr_vbuf_pool *pool,
			  struct ia_css_rmgr_vbuf_handle **handle)
{
	struct ia_css_rmgr_vbuf_handle h;
	struct ia_css_rmgr_vbuf_handle h = { 0 };

	if ((!pool) || (!handle) || (!*handle)) {
		IA_CSS_LOG("Invalid inputs");