Loading
media: s5p-jpeg: prevent buffer overflows
stable inclusion from stable-v5.10.230 commit f54e8e1e39dacccebcfb9a9a36f0552a0a97e2ef 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=f54e8e1e39dacccebcfb9a9a36f0552a0a97e2ef -------------------------------- 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>