]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
fbdev: imxfb: Check fb_add_videomode to prevent null-ptr-deref
authorChenyuan Yang <chenyuan0y@gmail.com>
Thu, 24 Jul 2025 03:25:34 +0000 (22:25 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 10:05:04 +0000 (12:05 +0200)
commitac16154cccda8be10ee3ae188f10a06f3890bc5d
treededdd78cd9965a7a2f814ef3fac890bbb9d7833a
parent1f3c8ca0639d77e397fd44f8ada1fb80f27a3c09
fbdev: imxfb: Check fb_add_videomode to prevent null-ptr-deref

[ Upstream commit da11e6a30e0bb8e911288bdc443b3dc8f6a7cac7 ]

fb_add_videomode() can fail with -ENOMEM when its internal kmalloc() cannot
allocate a struct fb_modelist.  If that happens, the modelist stays empty but
the driver continues to register.  Add a check for its return value to prevent
poteintial null-ptr-deref, which is similar to the commit 17186f1f90d3 ("fbdev:
Fix do_register_framebuffer to prevent null-ptr-deref in fb_videomode_to_var").

Fixes: 1b6c79361ba5 ("video: imxfb: Add DT support")
Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/video/fbdev/imxfb.c