-
-
Save q66/da01b4baecfdc24cd8fa3253d4e7f05a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 32017a4771c8a1fe0b27f59644b105b033cff5c8 Mon Sep 17 00:00:00 2001 | |
From: Daniel Kolesa <daniel@octaforge.org> | |
Date: Mon, 11 Apr 2022 00:05:30 +0200 | |
Subject: [PATCH] REVERT: fbdev: Hot-unplug firmware fb devices on forced | |
removal | |
This breaks at very least virtio-gpu, resulting on NULL dereference | |
upon probe. | |
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/video/fbdev/core?h=linux-5.15.y&id=c894ac44786cfed383a6c6b20c1bfb12eb96018a | |
--- | |
drivers/video/fbdev/core/fbmem.c | 29 +++-------------------------- | |
1 file changed, 3 insertions(+), 26 deletions(-) | |
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c | |
index 91145d9..7bd5e2a 100644 | |
--- a/drivers/video/fbdev/core/fbmem.c | |
+++ b/drivers/video/fbdev/core/fbmem.c | |
@@ -25,7 +25,6 @@ | |
#include <linux/init.h> | |
#include <linux/linux_logo.h> | |
#include <linux/proc_fs.h> | |
-#include <linux/platform_device.h> | |
#include <linux/seq_file.h> | |
#include <linux/console.h> | |
#include <linux/kmod.h> | |
@@ -1558,36 +1557,18 @@ static void do_remove_conflicting_framebuffers(struct apertures_struct *a, | |
/* check all firmware fbs and kick off if the base addr overlaps */ | |
for_each_registered_fb(i) { | |
struct apertures_struct *gen_aper; | |
- struct device *device; | |
if (!(registered_fb[i]->flags & FBINFO_MISC_FIRMWARE)) | |
continue; | |
gen_aper = registered_fb[i]->apertures; | |
- device = registered_fb[i]->device; | |
if (fb_do_apertures_overlap(gen_aper, a) || | |
(primary && gen_aper && gen_aper->count && | |
gen_aper->ranges[0].base == VGA_FB_PHYS)) { | |
printk(KERN_INFO "fb%d: switching to %s from %s\n", | |
i, name, registered_fb[i]->fix.id); | |
- | |
- /* | |
- * If we kick-out a firmware driver, we also want to remove | |
- * the underlying platform device, such as simple-framebuffer, | |
- * VESA, EFI, etc. A native driver will then be able to | |
- * allocate the memory range. | |
- * | |
- * 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)) { | |
- registered_fb[i]->forced_out = true; | |
- platform_device_unregister(to_platform_device(device)); | |
- } else { | |
- pr_warn("fb%d: cannot remove device\n", i); | |
- do_unregister_framebuffer(registered_fb[i]); | |
- } | |
+ do_unregister_framebuffer(registered_fb[i]); | |
} | |
} | |
} | |
@@ -1914,13 +1895,9 @@ EXPORT_SYMBOL(register_framebuffer); | |
void | |
unregister_framebuffer(struct fb_info *fb_info) | |
{ | |
- bool forced_out = fb_info->forced_out; | |
- | |
- if (!forced_out) | |
- mutex_lock(®istration_lock); | |
+ mutex_lock(®istration_lock); | |
do_unregister_framebuffer(fb_info); | |
- if (!forced_out) | |
- mutex_unlock(®istration_lock); | |
+ mutex_unlock(®istration_lock); | |
} | |
EXPORT_SYMBOL(unregister_framebuffer); | |
-- | |
2.35.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment