linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org,
	"Denis Kirjanov" <kda@linux-powerpc.org>,
	"Noralf Trønnes" <noralf@tronnes.org>,
	"Bartlomiej Zolnierkiewicz" <b.zolnierkie@samsung.com>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Mikulas Patocka" <mpatocka@redhat.com>
Subject: [PATCH 3.16 70/99] fbdev: fbcon: Fix unregister crash when more than one framebuffer
Date: Tue, 02 Apr 2019 14:38:28 +0100	[thread overview]
Message-ID: <lsq.1554212308.400414536@decadent.org.uk> (raw)
In-Reply-To: <lsq.1554212307.17110877@decadent.org.uk>

3.16.65-rc1 review patch.  If anyone has any objections, please let me know.

------------------

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

commit 2122b40580dd9d0620398739c773d07a7b7939d0 upstream.

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>
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/video/console/fbcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -3019,7 +3019,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;
 		}
 	}


  parent reply	other threads:[~2019-04-02 13:44 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-02 13:38 [PATCH 3.16 00/99] 3.16.65-rc1 review Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 58/99] genwqe: Fix size check Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 24/99] MIPS: Expand MIPS32 ASIDs to 64 bits Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 62/99] ext4: avoid declaring fs inconsistent due to invalid file handles Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 33/99] gpiolib: Fix return value of gpio_to_desc() stub if !GPIOLIB Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 42/99] perf parse-events: Fix unchecked usage of strncpy() Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 66/99] ath6kl: Only use match sets when firmware supports it Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 69/99] fbdev: fbmem: behave better with small rotated displays and many CPUs Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 65/99] scsi: megaraid_sas: Use 63-bit DMA addressing Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 40/99] perf svghelper: Fix unchecked usage of strncpy() Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 22/99] sunrpc: fix cache_head leak due to queued request Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 44/99] USB: serial: pl2303: add ids for Hewlett-Packard HP POS pole displays Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 46/99] pinctrl: sh-pfc: r8a7740: Add missing LCD0 marks to lcd0_data24_1 group Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 55/99] KVM: arm/arm64: Fix VMID alloc race by reverting to lock-less Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 09/99] MIPS: SiByte: Enable ZONE_DMA32 for LittleSur Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 29/99] tools/lib/lockdep: Rename "trywlock" into "trywrlock" Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 10/99] power: supply: olpc_battery: correct the temperature units Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 25/99] misc: vexpress: Off by one in vexpress_syscfg_exec() Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 45/99] pinctrl: sh-pfc: r8a7740: Add missing REF125CK pin to gether_gmii group Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 13/99] perf pmu: Suppress potential format-truncation warning Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 38/99] Btrfs: fix fsync of files with multiple hard links in new directories Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 35/99] btrfs: dev-replace: go back to suspended state if target device is missing Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 17/99] lib/string.c: remove duplicated function Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 31/99] ALSA: pcm: Fix potential Spectre v1 vulnerability Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 67/99] powerpc/configs: Don't enable PPC_EARLY_DEBUG in defconfigs Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 36/99] Btrfs: fill ->last_trans for delayed inode in btrfs_fill_inode Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 04/99] pcrypt: use format specifier in kobject_add Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 16/99] f2fs: read page index before freeing Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 20/99] b43: Fix error in cordic routine Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 26/99] mips: bpf: fix encoding bug for mm_srlv32_op Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 30/99] ALSA: emux: Fix potential Spectre v1 vulnerabilities Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 11/99] MIPS: Ensure pmd_present() returns false after pmd_mknotpresent() Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 05/99] dlm: fixed memory leaks after failed ls_remove_names allocation Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 64/99] ext4: check for shutdown and r/o file system in ext4_write_inode() Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 07/99] dlm: lost put_lkb on error path in receive_convert() and receive_unlock() Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 48/99] pinctrl: sh-pfc: r8a7791: Remove bogus marks from vin1_b_data18 group Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 37/99] Btrfs: fix stale dir entries after unlink, inode eviction and fsync Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 32/99] crypto: user - support incremental algorithm dumps Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 18/99] altera-stapl: check for a null key before strcasecmp'ing it Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 02/99] drm/i915/ringbuffer: Delay after EMIT_INVALIDATE for gen4/gen5 Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 21/99] ext4: missing unlock/put_page() in ext4_try_to_write_inline_data() Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 68/99] cdc-acm: fix abnormal DATA RX issue for Mediatek Preloader Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 52/99] pinctrl: sh-pfc: sh7269: Add missing PCIOR0 field Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 06/99] dlm: possible memory leak on error path in create_lkb() Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 41/99] perf ui helpline: Use strlcpy() as a shorter form of strncpy() + explicit set nul Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 47/99] pinctrl: sh-pfc: r8a7791: Remove bogus ctrl marks from qspi_data4_b group Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 14/99] panic: avoid deadlocks in re-entrant console drivers Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 34/99] kvm: vmx: Set IA32_TSC_AUX for legacy mode guests Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 63/99] ext4: force inode writes when nfsd calls commit_metadata() Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 19/99] serial: imx: fix error handling in console_setup Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 43/99] net/mlx5: Continue driver initialization despite debugfs failure Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 50/99] pinctrl: sh-pfc: sh7734: Add missing IPSR11 field Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 53/99] pinctrl: sh-pfc: sh7734: Remove bogus IPSR10 value Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 27/99] scsi: zfcp: fix posting too many status read buffers leading to adapter shutdown Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 59/99] ALSA: rme9652: Fix potential Spectre v1 vulnerability Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 49/99] pinctrl: sh-pfc: sh73a0: Add missing TO pin to tpu4_to3 group Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 61/99] ext4: include terminating u32 in size of xattr entries when expanding inodes Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 54/99] pinctrl: sh-pfc: sh7734: Fix shifted values in IPSR10 Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 15/99] drm: rcar-du: Fix vblank initialization Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 60/99] ALSA: emu10k1: Fix potential Spectre v1 vulnerabilities Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 23/99] tty/ldsem: Wake up readers after timed out down_write() Ben Hutchings
2019-04-02 14:22   ` Dmitry Safonov
2019-04-02 14:32     ` Ben Hutchings
2019-04-02 14:39       ` Dmitry Safonov
2019-05-07 18:38         ` Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 51/99] pinctrl: sh-pfc: sh7264: Fix PFCR3 and PFCR0 register configuration Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 03/99] x86/PCI: Fix Broadcom CNB20LE unintended sign extension (redux) Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 01/99] wireless: airo: potential buffer overflow in sprintf() Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 56/99] IB/qib: Fix an error code in qib_sdma_verbs_send() Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 28/99] sata_rcar: fix deferred probing Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 57/99] usb: r8a66597: Fix a possible concurrency use-after-free bug in r8a66597_endpoint_disable() Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 12/99] MIPS: Align kernel load address to 64KB Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 08/99] dlm: memory leaks on error path in dlm_user_request() Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 39/99] perf help: Remove needless use of strncpy() Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 94/99] ext4: fix special inode number checks in __ext4_iget() Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 88/99] mm: migration: fix migration of huge PMD shared pages Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 74/99] Input: nomadik-ske-keypad - fix a loop timeout test Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 97/99] Driver: Vmxnet3: Fix regression caused by 5738a09 Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 98/99] Revert "cifs: empty TargetInfo leads to crash on recovery" Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 90/99] hwpoison, memory_hotplug: allow hwpoisoned pages to be offlined Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 82/99] 9p/net: put a lower bound on msize Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 89/99] mm, memory_hotplug: do not clear numa_node association after hot_remove Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 73/99] powerpc/tm: Unset MSR[TS] if not recheckpointing Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 80/99] ext4: ext4_inline_data_fiemap should respect callers argument Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 75/99] kvm: Disallow wraparound in kvm_gfn_to_hva_cache_init Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 96/99] net/hamradio/6pack: use mod_timer() to rearm timers Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 93/99] ibmveth: fix DMA unmap error in ibmveth_xmit_start error path Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 72/99] powerpc/tm: Set MSR[TS] just prior to recheckpoint Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 71/99] igb: Fix an issue that PME is not enabled during runtime suspend Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 86/99] mm Documentation: undoc non-linear vmas Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 84/99] ceph: don't update importing cap's mseq when handing cap export Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 95/99] ALSA: hda/tegra: clear pending irq handlers Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 87/99] mm: rmap use pte lock not mmap_sem to set PageMlocked Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 76/99] KVM: x86: Use jmp to invoke kvm_spurious_fault() from .fixup Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 85/99] sunrpc: use SVC_NET() in svcauth_gss_* functions Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 81/99] ext4: fix a potential fiemap/page fault deadlock w/ inline_data Ben Hutchings
2019-04-02 13:38 ` Ben Hutchings [this message]
2019-04-02 13:38 ` [PATCH 3.16 92/99] block/swim3: Fix -EBUSY error when re-opening device after unmount Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 79/99] ext4: make sure enough credits are reserved for dioread_nolock writes Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 77/99] MIPS: BCM63XX: fix switch core reset on BCM6368 Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 99/99] CIFS: Enable encryption during session setup phase Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 91/99] ext4: avoid kernel warning when writing the superblock to a dead device Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 83/99] 9p/net: fix memory leak in p9_client_create Ben Hutchings
2019-04-02 13:38 ` [PATCH 3.16 78/99] CIFS: Fix error mapping for SMB2_LOCK command which caused OFD lock problem Ben Hutchings
2019-04-03  2:22 ` [PATCH 3.16 00/99] 3.16.65-rc1 review Guenter Roeck
2019-04-03 14:12   ` Ben Hutchings

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=lsq.1554212308.400414536@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=kda@linux-powerpc.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --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).