video: fbdev: fbmem: fix pointer reference to null device field
authorZhouyi Zhou <zhouzhouyi@gmail.com>
Thu, 10 Feb 2022 06:58:24 +0000 (14:58 +0800)
committerHelge Deller <deller@gmx.de>
Thu, 14 Apr 2022 20:01:24 +0000 (22:01 +0200)
In function do_remove_conflicting_framebuffers, if device is NULL, there
will be null pointer reference. The patch add a check to the if expression.

Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
Acked-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Helge Deller <deller@gmx.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220210065824.368355-1-zhouzhouyi@gmail.com
drivers/video/fbdev/core/fbmem.c

index bdd00d3..1cfb2bd 100644 (file)
@@ -1579,7 +1579,7 @@ static void do_remove_conflicting_framebuffers(struct apertures_struct *a,
                         * If it's not a platform device, at least print a warning. A
                         * fix would add code to remove the device from the system.
                         */
-                       if (dev_is_platform(device)) {
+                       if (device && dev_is_platform(device)) {
                                registered_fb[i]->forced_out = true;
                                platform_device_unregister(to_platform_device(device));
                        } else {