linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "Noralf Trønnes" <noralf@tronnes.org>,
	"Bartlomiej Zolnierkiewicz" <b.zolnierkie@samsung.com>,
	"Sasha Levin" <sashal@kernel.org>,
	dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.4 60/80] fbdev: fbcon: Fix unregister crash when more than one framebuffer
Date: Mon, 28 Jan 2019 11:23:41 -0500	[thread overview]
Message-ID: <20190128162401.58841-60-sashal@kernel.org> (raw)
In-Reply-To: <20190128162401.58841-1-sashal@kernel.org>

From: Noralf Trønnes <noralf@tronnes.org>

[ Upstream commit 2122b40580dd9d0620398739c773d07a7b7939d0 ]

When unregistering fbdev using unregister_framebuffer(), any bound
console will unbind automatically. This is working fine if this is the
only framebuffer, resulting in a switch to the dummy console. However if
there is a fb0 and I unregister fb1 having a bound console, I eventually
get a crash. The fastest way for me to trigger the crash is to do a
reboot, resulting in this splat:

[   76.478825] WARNING: CPU: 0 PID: 527 at linux/kernel/workqueue.c:1442 __queue_work+0x2d4/0x41c
[   76.478849] Modules linked in: raspberrypi_hwmon gpio_backlight backlight bcm2835_rng rng_core [last unloaded: tinydrm]
[   76.478916] CPU: 0 PID: 527 Comm: systemd-udevd Not tainted 4.20.0-rc4+ #4
[   76.478933] Hardware name: BCM2835
[   76.478949] Backtrace:
[   76.478995] [<c010d388>] (dump_backtrace) from [<c010d670>] (show_stack+0x20/0x24)
[   76.479022]  r6:00000000 r5:c0bc73be r4:00000000 r3:6fb5bf81
[   76.479060] [<c010d650>] (show_stack) from [<c08e82f4>] (dump_stack+0x20/0x28)
[   76.479102] [<c08e82d4>] (dump_stack) from [<c0120070>] (__warn+0xec/0x12c)
[   76.479134] [<c011ff84>] (__warn) from [<c01201e4>] (warn_slowpath_null+0x4c/0x58)
[   76.479165]  r9:c0eb6944 r8:00000001 r7:c0e927f8 r6:c0bc73be r5:000005a2 r4:c0139e84
[   76.479197] [<c0120198>] (warn_slowpath_null) from [<c0139e84>] (__queue_work+0x2d4/0x41c)
[   76.479222]  r6:d7666a00 r5:c0e918ee r4:dbc4e700
[   76.479251] [<c0139bb0>] (__queue_work) from [<c013a02c>] (queue_work_on+0x60/0x88)
[   76.479281]  r10:c0496bf8 r9:00000100 r8:c0e92ae0 r7:00000001 r6:d9403700 r5:d7666a00
[   76.479298]  r4:20000113
[   76.479348] [<c0139fcc>] (queue_work_on) from [<c0496c28>] (cursor_timer_handler+0x30/0x54)
[   76.479374]  r7:d8a8fabc r6:c0e08088 r5:d8afdc5c r4:d8a8fabc
[   76.479413] [<c0496bf8>] (cursor_timer_handler) from [<c0178744>] (call_timer_fn+0x100/0x230)
[   76.479435]  r4:c0e9192f r3:d758a340
[   76.479465] [<c0178644>] (call_timer_fn) from [<c0178980>] (expire_timers+0x10c/0x12c)
[   76.479495]  r10:40000000 r9:c0e9192f r8:c0e92ae0 r7:d8afdccc r6:c0e19280 r5:c0496bf8
[   76.479513]  r4:d8a8fabc
[   76.479541] [<c0178874>] (expire_timers) from [<c0179630>] (run_timer_softirq+0xa8/0x184)
[   76.479570]  r9:00000001 r8:c0e19280 r7:00000000 r6:c0e08088 r5:c0e1a3e0 r4:c0e19280
[   76.479603] [<c0179588>] (run_timer_softirq) from [<c0102404>] (__do_softirq+0x1ac/0x3fc)
[   76.479632]  r10:c0e91680 r9:d8afc020 r8:0000000a r7:00000100 r6:00000001 r5:00000002
[   76.479650]  r4:c0eb65ec
[   76.479686] [<c0102258>] (__do_softirq) from [<c0124d10>] (irq_exit+0xe8/0x168)
[   76.479716]  r10:d8d1a9b0 r9:d8afc000 r8:00000001 r7:d949c000 r6:00000000 r5:c0e8b3f0
[   76.479734]  r4:00000000
[   76.479764] [<c0124c28>] (irq_exit) from [<c016b72c>] (__handle_domain_irq+0x94/0xb0)
[   76.479793] [<c016b698>] (__handle_domain_irq) from [<c01021dc>] (bcm2835_handle_irq+0x3c/0x48)
[   76.479823]  r8:d8afdebc r7:d8afddfc r6:ffffffff r5:c0e089f8 r4:d8afddc8 r3:d8afddc8
[   76.479851] [<c01021a0>] (bcm2835_handle_irq) from [<c01019f0>] (__irq_svc+0x70/0x98)

The problem is in the console rebinding in fbcon_fb_unbind(). It uses the
virtual console index as the new framebuffer index to bind the console(s)
to. The correct way is to use the con2fb_map lookup table to find the
framebuffer index.

Fixes: cfafca8067c6 ("fbdev: fbcon: console unregistration from unregister_framebuffer")
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Mikulas Patocka <mpatocka@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/video/console/fbcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 4e3c78d88832..c03c5b9602bb 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -3032,7 +3032,7 @@ static int fbcon_fb_unbind(int idx)
 	for (i = first_fb_vc; i <= last_fb_vc; i++) {
 		if (con2fb_map[i] != idx &&
 		    con2fb_map[i] != -1) {
-			new_idx = i;
+			new_idx = con2fb_map[i];
 			break;
 		}
 	}
-- 
2.19.1


  parent reply	other threads:[~2019-01-28 16:35 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-28 16:22 [PATCH AUTOSEL 4.4 01/80] drm/bufs: Fix Spectre v1 vulnerability Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 02/80] staging: iio: adc: ad7280a: handle error from __ad7280_read32() Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 03/80] ASoC: Intel: mrfld: fix uninitialized variable access Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 04/80] ath9k: dynack: use authentication messages for 'late' ack Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 05/80] scsi: lpfc: Correct LCB RJT handling Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 06/80] platform/x86: asus-nb-wmi: Map 0x35 to KEY_SCREENLOCK Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 07/80] ARM: 8808/1: kexec:offline panic_smp_self_stop CPU Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 08/80] dlm: Don't swamp the CPU with callbacks queued during recovery Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 09/80] x86/PCI: Fix Broadcom CNB20LE unintended sign extension (redux) Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 10/80] powerpc/pseries: add of_node_put() in dlpar_detach_node() Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 11/80] serial: fsl_lpuart: clear parity enable bit when disable parity Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 12/80] serial: core: Allow processing sysrq at port unlock time Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 13/80] ptp: check gettime64 return code in PTP_SYS_OFFSET ioctl Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 14/80] staging:iio:ad2s90: Make probe handle spi_setup failure Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 15/80] staging: iio: ad7780: update voltage on read Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 16/80] ARM: OMAP2+: hwmod: Fix some section annotations Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 17/80] modpost: validate symbol names also in find_elf_symbol Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 18/80] perf tools: Add Hygon Dhyana support Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 19/80] soc/tegra: Don't leak device tree node reference Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 20/80] f2fs: move dir data flush to write checkpoint process Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 21/80] f2fs: fix wrong return value of f2fs_acl_create Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 22/80] sunvdc: Do not spin in an infinite loop when vio_ldc_send() returns EAGAIN Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 23/80] nfsd4: fix crash on writing v4_end_grace before nfsd startup Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 24/80] arm64: ftrace: don't adjust the LR value Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 25/80] ARM: dts: mmp2: fix TWSI2 Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 26/80] ARM: mmp/mmp2: dt: enable the clock Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 27/80] x86/fpu: Add might_fault() to user_insn() Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 28/80] media: DaVinci-VPBE: fix error handling in vpbe_initialize() Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 29/80] smack: fix access permissions for keyring Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 30/80] usb: hub: delay hub autosuspend if USB3 port is still link training Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 31/80] timekeeping: Use proper seqcount initializer Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 32/80] ARM: dts: Fix OMAP4430 SDP Ethernet startup Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 33/80] mips: bpf: fix encoding bug for mm_srlv32_op Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 34/80] tracing: Have trace_stack nr_entries compare not be so subtle Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 35/80] iommu/arm-smmu-v3: Use explicit mb() when moving cons pointer Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 36/80] sata_rcar: fix deferred probing Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 37/80] clk: imx6sl: ensure MMDC CH0 handshake is bypassed Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 38/80] cpuidle: big.LITTLE: fix refcount leak Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 39/80] i2c-axxia: check for error conditions first Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 40/80] udf: Fix BUG on corrupted inode Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 41/80] ARM: pxa: avoid section mismatch warning Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 42/80] ASoC: fsl: Fix SND_SOC_EUKREA_TLV320 build error on i.MX8M Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 43/80] ARM: mmp: fix timer_init calls Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 44/80] memstick: Prevent memstick host from getting runtime suspended during card detection Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 45/80] tty: serial: samsung: Properly set flags in autoCTS mode Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 46/80] KVM: s390: unregister debug feature on failing arch init Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 47/80] arm64: KVM: Skip MMIO insn after emulation Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 48/80] powerpc/uaccess: fix warning/error with access_ok() Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 49/80] mac80211: fix radiotap vendor presence bitmap handling Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 50/80] xfrm6_tunnel: Fix spi check in __xfrm6_tunnel_alloc_spi Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 51/80] Bluetooth: Fix unnecessary error message for HCI request completion Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 52/80] cw1200: Fix concurrency use-after-free bugs in cw1200_hw_scan() Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 53/80] drbd: narrow rcu_read_lock in drbd_sync_handshake Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 54/80] drbd: disconnect, if the wrong UUIDs are attached on a connected peer Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 55/80] drbd: skip spurious timeout (ping-timeo) when failing promote Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 56/80] drbd: Avoid Clang warning about pointless switch statment Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 57/80] video: clps711x-fb: release disp device node in probe() Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 58/80] fbdev: fbmem: behave better with small rotated displays and many CPUs Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 59/80] igb: Fix an issue that PME is not enabled during runtime suspend Sasha Levin
2019-01-28 16:23 ` Sasha Levin [this message]
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 61/80] KVM: x86: svm: report MSR_IA32_MCG_EXT_CTL as unsupported Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 62/80] NFS: nfs_compare_mount_options always compare auth flavors Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 63/80] hwmon: (lm80) fix a missing check of the status of SMBus read Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 64/80] hwmon: (lm80) fix a missing check of bus read in lm80 probe Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 65/80] seq_buf: Make seq_buf_puts() null-terminate the buffer Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 66/80] crypto: ux500 - Use proper enum in cryp_set_dma_transfer Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 67/80] crypto: ux500 - Use proper enum in hash_set_dma_transfer Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 68/80] cifs: check ntwrk_buf_start for NULL before dereferencing it Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 69/80] um: Avoid marking pages with "changed protection" Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 70/80] niu: fix missing checks of niu_pci_eeprom_read Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 71/80] scripts/decode_stacktrace: only strip base path when a prefix of the path Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 72/80] mm/page_owner: clamp read count to PAGE_SIZE Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 73/80] ocfs2: don't clear bh uptodate for block read Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 74/80] isdn: hisax: hfc_pci: Fix a possible concurrency use-after-free bug in HFCPCI_l1hw() Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 75/80] gdrom: fix a memory leak bug Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 76/80] block/swim3: Fix -EBUSY error when re-opening device after unmount Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 77/80] HID: lenovo: Add checks to fix of_led_classdev_register Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 78/80] kernel/hung_task.c: break RCU locks based on jiffies Sasha Levin
2019-01-28 16:24 ` [PATCH AUTOSEL 4.4 79/80] fs/epoll: drop ovflist branch prediction Sasha Levin
2019-01-28 16:24 ` [PATCH AUTOSEL 4.4 80/80] exec: load_script: don't blindly truncate shebang string Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190128162401.58841-60-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noralf@tronnes.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).