media: meson: vdec: potential dereference of null pointer
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Thu, 13 Jan 2022 06:59:28 +0000 (07:59 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:23:14 +0000 (14:23 +0200)
commitb0b890dd8df3b9a2fe726826980b1cffe17b9679
tree1094b31c1f6a332129e93b9e3e13d251812236a7
parentc3590ec1161d2178bfba0155bb0dc2d29dffbc4e
media: meson: vdec: potential dereference of null pointer

[ Upstream commit c8c80c996182239ff9b05eda4db50184cf3b2e99 ]

As the possible failure of the kzalloc(), the 'new_ts' could be NULL
pointer.
Therefore, it should be better to check it in order to avoid the
dereference of the NULL pointer.
Also, the caller esparser_queue() needs to deal with the return value of
the amvdec_add_ts().

Fixes: 876f123b8956 ("media: meson: vdec: bring up to compliance")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Suggested-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/staging/media/meson/vdec/esparser.c
drivers/staging/media/meson/vdec/vdec_helpers.c
drivers/staging/media/meson/vdec/vdec_helpers.h