Loading
media: s5p-jpeg: prevent buffer overflows
stable inclusion from stable-v4.19.324 commit c5f6fefcda8fac8f082b6c5bf416567f4e100c51 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IB5KQX CVE: CVE-2024-53061 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=c5f6fefcda8fac8f082b6c5bf416567f4e100c51 -------------------------------- commit 14a22762c3daeac59a5a534e124acbb4d7a79b3a upstream. The current logic allows word to be less than 2. If this happens, there will be buffer overflows, as reported by smatch. Add extra checks to prevent it. While here, remove an unused word = 0 assignment. Fixes: 6c96dbbc ("[media] s5p-jpeg: add support for 5433") Cc: stable@vger.kernel.org Signed-off-by:Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Reviewed-by:
Jacek Anaszewski <jacek.anaszewski@gmail.com> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by:
Zhang Kunbo <zhangkunbo@huawei.com>