Commit 6d519c6a authored by Li Huafei's avatar Li Huafei Committed by Wang Wensheng
Browse files

media: atomisp: Add check for rgby_data memory allocation failure

stable inclusion
from stable-v6.6.64
commit 8066badaf7463194473fb4be19dbe50b11969aa0
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBA6RL
CVE: CVE-2024-56705

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8066badaf7463194473fb4be19dbe50b11969aa0



--------------------------------

[ Upstream commit ed61c59139509f76d3592683c90dc3fdc6e23cd6 ]

In ia_css_3a_statistics_allocate(), there is no check on the allocation
result of the rgby_data memory. If rgby_data is not successfully
allocated, it may trigger the assert(host_stats->rgby_data) assertion in
ia_css_s3a_hmem_decode(). Adding a check to fix this potential issue.

Fixes: a49d2536 ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: default avatarLi Huafei <lihuafei1@huawei.com>
Reviewed-by: default avatarAndy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20241104145051.3088231-1-lihuafei1@huawei.com


Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarZhangPeng <zhangpeng362@huawei.com>
Signed-off-by: default avatarWang Wensheng <wangwensheng4@huawei.com>
parent db89beee
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -4144,6 +4144,8 @@ ia_css_3a_statistics_allocate(const struct ia_css_3a_grid_info *grid)
		goto err;
	/* No weighted histogram, no structure, treat the histogram data as a byte dump in a byte array */
	me->rgby_data = kvmalloc(sizeof_hmem(HMEM0_ID), GFP_KERNEL);
	if (!me->rgby_data)
		goto err;

	IA_CSS_LEAVE("return=%p", me);
	return me;