diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2018-11-17 14:25:08 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-12-13 11:16:17 +0300 |
commit | 663bfc44d1a0ac440dd0d94ec7aa94a4c690f233 (patch) | |
tree | 55567d54341d534e0f909ceb85d3d5aa36b69ecf /drivers | |
parent | c4dabf370838d1cf3bae6e96fc1a02cd39f9404f (diff) | |
download | linux-663bfc44d1a0ac440dd0d94ec7aa94a4c690f233.tar.xz |
media: vicodec: fix memchr() kernel oops
commit cb3b2ffb757e75fef40fb94bc093cbbf49a6bf6e upstream.
The size passed to memchr is too large as it assumes the search
starts at the start of the buffer, but it can start at an offset.
Cc: <stable@vger.kernel.org> # for v4.19 and up
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/platform/vicodec/vicodec-core.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/platform/vicodec/vicodec-core.c b/drivers/media/platform/vicodec/vicodec-core.c index daa5caa6adc6..7a33a52eacca 100644 --- a/drivers/media/platform/vicodec/vicodec-core.c +++ b/drivers/media/platform/vicodec/vicodec-core.c @@ -438,7 +438,8 @@ restart: for (; p < p_out + sz; p++) { u32 copy; - p = memchr(p, magic[ctx->comp_magic_cnt], sz); + p = memchr(p, magic[ctx->comp_magic_cnt], + p_out + sz - p); if (!p) { ctx->comp_magic_cnt = 0; break; |