linux-stable/drivers/video/fbdev
Thomas Zimmermann 0f525289ff fbdev: Fix unregistering of framebuffers without device
OF framebuffers do not have an underlying device in the Linux
device hierarchy. Do a regular unregister call instead of hot
unplugging such a non-existing device. Fixes a NULL dereference.
An example error message on ppc64le is shown below.

  BUG: Kernel NULL pointer dereference on read at 0x00000060
  Faulting instruction address: 0xc00000000080dfa4
  Oops: Kernel access of bad area, sig: 11 [#1]
  LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
  [...]
  CPU: 2 PID: 139 Comm: systemd-udevd Not tainted 5.17.0-ae085d7f9365 #1
  NIP:  c00000000080dfa4 LR: c00000000080df9c CTR: c000000000797430
  REGS: c000000004132fe0 TRAP: 0300   Not tainted  (5.17.0-ae085d7f9365)
  MSR:  8000000002009033 <SF,VEC,EE,ME,IR,DR,RI,LE>  CR: 28228282  XER: 20000000
  CFAR: c00000000000c80c DAR: 0000000000000060 DSISR: 40000000 IRQMASK: 0
  GPR00: c00000000080df9c c000000004133280 c00000000169d200 0000000000000029
  GPR04: 00000000ffffefff c000000004132f90 c000000004132f88 0000000000000000
  GPR08: c0000000015658f8 c0000000015cd200 c0000000014f57d0 0000000048228283
  GPR12: 0000000000000000 c00000003fffe300 0000000020000000 0000000000000000
  GPR16: 0000000000000000 0000000113fc4a40 0000000000000005 0000000113fcfb80
  GPR20: 000001000f7283b0 0000000000000000 c000000000e4a588 c000000000e4a5b0
  GPR24: 0000000000000001 00000000000a0000 c008000000db0168 c0000000021f6ec0
  GPR28: c0000000016d65a8 c000000004b36460 0000000000000000 c0000000016d64b0
  NIP [c00000000080dfa4] do_remove_conflicting_framebuffers+0x184/0x1d0
  [c000000004133280] [c00000000080df9c] do_remove_conflicting_framebuffers+0x17c/0x1d0 (unreliable)
  [c000000004133350] [c00000000080e4d0] remove_conflicting_framebuffers+0x60/0x150
  [c0000000041333a0] [c00000000080e6f4] remove_conflicting_pci_framebuffers+0x134/0x1b0
  [c000000004133450] [c008000000e70438] drm_aperture_remove_conflicting_pci_framebuffers+0x90/0x100 [drm]
  [c000000004133490] [c008000000da0ce4] bochs_pci_probe+0x6c/0xa64 [bochs]
  [...]
  [c000000004133db0] [c00000000002aaa0] system_call_exception+0x170/0x2d0
  [c000000004133e10] [c00000000000c3cc] system_call_common+0xec/0x250

The bug [1] was introduced by commit 27599aacba ("fbdev: Hot-unplug
firmware fb devices on forced removal"). Most firmware framebuffers
have an underlying platform device, which can be hot-unplugged
before loading the native graphics driver. OF framebuffers do not
(yet) have that device. Fix the code by unregistering the framebuffer
as before without a hot unplug.

Tested with 5.17 on qemu ppc64le emulation.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: 27599aacba ("fbdev: Hot-unplug firmware fb devices on forced removal")
Reported-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Cc: Zack Rusin <zackr@vmware.com>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: stable@vger.kernel.org # v5.11+
Cc: Helge Deller <deller@gmx.de>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Zheyu Ma <zheyuma97@gmail.com>
Cc: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Cc: Zhen Lei <thunder.leizhen@huawei.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Link: https://lore.kernel.org/all/YkHXO6LGHAN0p1pq@debian/ # [1]
Link: https://patchwork.freedesktop.org/patch/msgid/20220404194402.29974-1-tzimmermann@suse.de
2022-04-06 21:12:28 +02:00
..
aty video: fbdev: atyfb: Remove assigned but never used variable statements 2022-01-29 22:24:26 +01:00
core fbdev: Fix unregistering of framebuffers without device 2022-04-06 21:12:28 +02:00
geode video: fbdev: lxfb_ops: Fix fall-through warnings for Clang 2020-11-22 22:58:55 +01:00
i810 video: fbdev: i810: use true,false for bool variables 2020-05-06 19:29:10 +02:00
intelfb drm pull for 5.6-rc1 2020-01-30 08:04:01 -08:00
kyro video: fbdev: kyro: make read-only array ODValues static const 2022-03-11 08:27:37 +01:00
matrox video: fbdev: matroxfb: set maxvram of vbG200eW to the same as vbG200 to avoid black screen 2022-01-29 22:24:25 +01:00
mb862xx video: fbdev: mb862xx: remove redundant assignment to pointer ptr 2022-01-29 22:24:25 +01:00
mmp video: fbdev: mmp: Make use of the helper function dev_err_probe() 2022-01-29 23:22:36 +01:00
nvidia video: fbdev: nvidiafb: Use strscpy() to prevent buffer overflow 2022-01-29 22:24:25 +01:00
omap fbdev fixes and updates for kernel v5.18-rc1 2022-03-23 14:45:01 -07:00
omap2 Driver core changes for 5.18-rc1 2022-03-28 12:41:28 -07:00
riva video: fbdev: riva: Error out if 'pixclock' equals zero 2021-07-26 20:06:03 +02:00
savage video: fbdev: savagefb: make a variable local 2022-01-30 19:37:03 +01:00
sis video: fbdev: sis: use swap() to make code cleaner 2022-01-29 22:24:25 +01:00
vermilion remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
via video: fbdev: via: check the return value of kstrdup() 2022-02-22 09:00:09 +01:00
68328fb.c video/fbdev/68328fb: Remove dead code 2020-01-03 14:27:43 +01:00
acornfb.c video: fbdev: acornfb: remove free_unused_pages() 2021-02-24 13:38:31 -08:00
acornfb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
amba-clcd.c drm-misc-next for 5.13: 2021-03-16 17:08:46 +10:00
amifb.c backlight/video: Use Platform getter/setter functions 2021-02-12 10:01:45 +00:00
arcfb.c video: fbdev: arcfb: remove redundant initialization of variable err 2021-07-21 13:09:21 +02:00
arkfb.c fbdev: arkfb: use generic power management 2020-09-08 13:33:20 +02:00
asiliantfb.c video: fbdev: asiliantfb: remove redundant assignment to variable Ftarget 2022-01-29 23:04:57 +01:00
atafb.c video: fbdev: atari: Atari 2 bpp (STe) palette bugfix 2022-02-16 09:11:12 +01:00
atafb.h
atafb_iplan2p2.c
atafb_iplan2p4.c
atafb_iplan2p8.c
atafb_mfb.c
atafb_utils.h
atmel_lcdfb.c video: fbdev: atmel_lcdfb: fix an error code in atmel_lcdfb_probe() 2022-01-30 19:38:35 +01:00
au1100fb.c video: fbdev: au1100fb: Spelling s/palette/palette/ 2022-02-16 10:54:42 +01:00
au1100fb.h video: fbdev: au1100fb: Spelling s/palette/palette/ 2022-02-16 10:54:42 +01:00
au1200fb.c video: fbdev: au1200fb: Make use of dma_mmap_coherent() 2022-01-29 22:24:25 +01:00
au1200fb.h
broadsheetfb.c fbdev: Don't sort deferred-I/O pages by default 2022-02-16 16:41:45 +01:00
bt431.h
bt455.h
bw2.c video: fbdev: sparc drivers: fix kernel-doc warnings for blank_mode 2020-12-08 18:34:08 +01:00
c2p.h
c2p_core.h fbdev: c2p: Use BUILD_BUG() instead of custom solution 2020-03-09 11:12:19 +01:00
c2p_iplan2.c
c2p_planar.c
carminefb.c drm pull for 5.6-rc1 2020-01-30 08:04:01 -08:00
carminefb.h
carminefb_regs.h
cg3.c video: fbdev: sparc drivers: fix kernel-doc warnings for blank_mode 2020-12-08 18:34:08 +01:00
cg6.c video: fbdev: sparc drivers: fix kernel-doc warnings for blank_mode 2020-12-08 18:34:08 +01:00
cg14.c fbdev: cg14fb: use resource_size 2020-01-15 17:31:50 +01:00
chipsfb.c video: fbdev: chipsfb: use memset_io() instead of memset() 2021-10-09 00:15:59 +11:00
cirrusfb.c video: fbdev: cirrusfb: check pixclock to avoid divide by zero 2022-01-29 23:32:49 +01:00
clps711x-fb.c video: constify fb ops across all drivers 2019-12-05 10:57:53 +02:00
cobalt_lcdfb.c video: constify fb ops across all drivers 2019-12-05 10:57:53 +02:00
controlfb.c video: fbdev: controlfb: Fix COMPILE_TEST build 2022-01-29 22:24:25 +01:00
controlfb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
cyber2000fb.c fbdev: cyber2000fb: use generic power management 2020-09-08 13:33:16 +02:00
cyber2000fb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
da8xx-fb.c video: fbdev: da8xx-fb: Make use of the helper function dev_err_probe() 2022-01-29 23:22:36 +01:00
dnfb.c video: constify fb ops across all drivers 2019-12-05 10:57:53 +02:00
edid.h
efifb.c fbdev: Prevent probing generic drivers if a FB is already registered 2021-11-17 10:15:05 +01:00
ep93xx-fb.c video: ep93xx: Prepare clock before using it 2021-07-26 22:10:29 +02:00
ffb.c video: fbdev: sparc drivers: fix kernel-doc warnings for blank_mode 2020-12-08 18:34:08 +01:00
fm2fb.c video: constify fb ops across all drivers 2019-12-05 10:57:53 +02:00
fsl-diu-fb.c video: fbdev: fsl-diu-fb: remove unneeded variable 'res' 2020-10-17 08:23:14 +02:00
g364fb.c fbdev/g364fb: Fix build failure 2020-02-19 10:58:22 -08:00
gbefb.c video: fbdev: gbefb: Only instantiate device when built for IP32 2021-10-06 11:12:28 +02:00
goldfishfb.c video: fbdev: goldfishfb: Fix defined but not used warning 2020-12-08 18:34:50 +01:00
grvga.c video: fbdev: Replace HTTP links with HTTPS ones 2020-07-20 11:47:29 +02:00
gxt4500.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
hecubafb.c video: constify fb ops across all drivers 2019-12-05 10:57:53 +02:00
hgafb.c video: hgafb: correctly handle card detect failure during probe 2021-05-21 15:04:05 +02:00
hitfb.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
hpfb.c maccess: rename probe_kernel_{read,write} to copy_{from,to}_kernel_nofault 2020-06-17 10:57:41 -07:00
hyperv_fb.c video: hyperv_fb: Fix validation of screen resolution 2022-01-24 14:01:12 +00:00
i740_reg.h
i740fb.c fbdev: i740fb: use generic power management 2020-09-08 13:33:17 +02:00
imsttfb.c video: imsttfb: check for ioremap() failures 2021-05-13 18:58:39 +02:00
imxfb.c video: fbdev: imxfb: Check for null res pointer 2022-01-29 22:24:24 +01:00
Kconfig video: fbdev: Fix wrong file path for pvr2fb.c in Kconfig help text 2022-02-02 16:27:42 +01:00
leo.c video: fbdev: sparc drivers: fix kernel-doc warnings for blank_mode 2020-12-08 18:34:08 +01:00
macfb.c video: fbdev: Replace HTTP links with HTTPS ones 2020-07-20 11:47:29 +02:00
macmodes.c
macmodes.h
Makefile drm next for 5.10-rc1 2020-10-15 10:46:16 -07:00
maxinefb.c video: constify fb ops across all drivers 2019-12-05 10:57:53 +02:00
metronomefb.c fbdev: Don't sort deferred-I/O pages by default 2022-02-16 16:41:45 +01:00
mx3fb.c video: fbdev: mx3fb: Fix kernel-doc, set but not used and string warnings 2020-11-30 20:04:56 +01:00
n411.c
neofb.c video: fbdev: neofb: add a check against divide error 2021-07-21 15:02:03 +02:00
ocfb.c video: fbdev: ocfb: add const to of_device_id 2022-01-29 22:24:25 +01:00
offb.c video: fbdev: offb: fix warning comparing pointer to 0 2022-03-11 08:23:53 +01:00
p9100.c video: fbdev: sparc drivers: fix kernel-doc warnings for blank_mode 2020-12-08 18:34:08 +01:00
platinumfb.c video: constify fb ops across all drivers 2019-12-05 10:57:53 +02:00
platinumfb.h
pm2fb.c video: fbdev: pm2fb: Fix kernel-doc warnings 2020-11-30 20:04:43 +01:00
pm3fb.c treewide: Remove uninitialized_var() usage 2020-07-16 12:35:15 -07:00
pmag-aa-fb.c drm pull for 5.6-rc1 2020-01-30 08:04:01 -08:00
pmag-ba-fb.c drm pull for 5.6-rc1 2020-01-30 08:04:01 -08:00
pmagb-b-fb.c drm pull for 5.6-rc1 2020-01-30 08:04:01 -08:00
ps3fb.c powerpc/ps3: make system bus's remove and shutdown callbacks return void 2020-12-04 01:01:22 +11:00
pvr2fb.c video: fbdev: pvr2fb: initialize variables 2020-08-05 19:47:22 +02:00
pxa3xx-gcu.c video: fbdev: pxa3xx-gcu: Remove unnecessary print function dev_err() 2022-02-01 20:45:52 +01:00
pxa3xx-gcu.h
pxa168fb.c video: fbdev: pxa168fb: Remove unnecessary print function dev_err() 2022-02-01 20:45:51 +01:00
pxa168fb.h
pxafb.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
pxafb.h video: pxafb: Remove cpufreq policy notifier 2019-08-26 10:02:02 +02:00
q40fb.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
s1d13xxxfb.c video: fbdev: s1d13xxxfb: Fix kernel-doc and set but not used warnings 2020-11-29 22:51:07 +01:00
s3c-fb.c drm for 5.18-rc1 2022-03-24 16:19:43 -07:00
s3c2410fb-regs-lcd.h fbdev: s3c2410fb: remove mach header dependency 2020-08-20 17:48:12 +02:00
s3c2410fb.c fbdev: s3c2410fb: remove mach header dependency 2020-08-20 17:48:12 +02:00
s3c2410fb.h
s3fb.c fbdev: s3fb: use generic power management 2020-09-08 13:33:19 +02:00
sa1100fb.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
sa1100fb.h ARM/fbdev: sa11x0: Switch to use GPIO descriptors 2020-04-17 15:50:11 +02:00
sbuslib.c fbdev: sbuslib: remove compat_alloc_user_space usage 2020-09-25 16:34:50 +02:00
sbuslib.h
sh7760fb.c drm pull for 5.6-rc1 2020-01-30 08:04:01 -08:00
sh_mobile_lcdcfb.c fbdev/sh_mobile: Drop unused include 2020-11-01 10:29:04 +01:00
sh_mobile_lcdcfb.h fbdev/sh_mobile: remove sh_mobile_lcdc_display_notify 2019-06-12 20:28:11 +02:00
simplefb.c fbdev/simplefb: Request memory region in driver 2022-01-27 09:21:14 +01:00
skeletonfb.c Revert "fbdev: Garbage collect fbdev scrolling acceleration, part 1 (from TODO list)" 2022-02-02 15:14:56 +01:00
sm501fb.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
sm712.h fbdev: sm712fb: use 1024x768 by default on non-MIPS, fix garbled display 2019-04-01 17:46:59 +02:00
sm712fb.c video: fbdev: sm712fb: Fix crash in smtcfb_write() 2022-03-03 11:13:40 +01:00
smscufx.c video: fbdev: smscufx: Fix null-ptr-deref in ufx_usb_probe() 2022-01-29 22:24:25 +01:00
ssd1307fb.c video: fbdev: ssd1307fb: Make use of the helper function dev_err_probe() 2022-01-29 23:22:36 +01:00
sstfb.c video: fbdev: sstfb: Updated logging to fix set but not used warnings 2020-11-30 20:04:59 +01:00
sticore.h parisc/sticon: Add user font support 2020-10-15 08:12:59 +02:00
stifb.c video/fbdev/stifb: Implement the stifb_fillrect() function 2022-03-11 19:49:30 +01:00
sunxvr500.c video: constify fb ops across all drivers 2019-12-05 10:57:53 +02:00
sunxvr1000.c video: constify fb ops across all drivers 2019-12-05 10:57:53 +02:00
sunxvr2500.c video: constify fb ops across all drivers 2019-12-05 10:57:53 +02:00
tcx.c video: fbdev: sparc drivers: fix kernel-doc warnings for blank_mode 2020-12-08 18:34:08 +01:00
tdfxfb.c video: fbdev: tdfx: Fix set but not used warning in att_outb() 2020-11-30 20:04:30 +01:00
tgafb.c video: fbdev: tgafb: Fix kernel-doc and set but not used warnings 2020-11-30 20:04:50 +01:00
tmiofb.c video: constify fb ops across all drivers 2019-12-05 10:57:53 +02:00
tridentfb.c drm pull for 5.6-rc1 2020-01-30 08:04:01 -08:00
udlfb.c drm for 5.18-rc1 2022-03-24 16:19:43 -07:00
uvesafb.c video: fbdev: uvesafb: Fix set but not used warning 2020-12-08 18:33:48 +01:00
valkyriefb.c video: fbdev: valkyriefb.c: fix warning comparing pointer to 0 2020-05-06 21:04:45 +02:00
valkyriefb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
vesafb.c video: fbdev: vesafb: add missed release_region 2020-04-17 15:50:14 +02:00
vfb.c video: constify fb ops across all drivers 2019-12-05 10:57:53 +02:00
vga16fb.c drm-misc-next for v5.18: 2022-02-01 19:02:41 +10:00
vt8500lcdfb.c video: vt8500lcdfb: fix fallthrough warning 2020-04-17 15:50:08 +02:00
vt8500lcdfb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
vt8623fb.c fbdev: vt8623fb: use generic power management 2020-09-08 13:33:18 +02:00
w100fb.c video: fbdev: w100fb: Reset global state 2022-01-29 22:24:26 +01:00
w100fb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
wm8505fb.c video: fbdev: wm8505fb: fix sparse warnings about using incorrect types 2020-03-02 16:32:04 +01:00
wm8505fb_regs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
wmt_ge_rops.c video: fbdev: wmt_ge_rops: Fix function not declared warnings 2020-12-08 18:34:36 +01:00
wmt_ge_rops.h
xen-fbfront.c xen: add "not_essential" flag to struct xenbus_driver 2021-11-23 13:41:29 -06:00
xilinxfb.c video: fbdev: Fix fall-through warning for Clang 2021-07-13 13:58:29 -05:00