Archive-only list for patches
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Nicolas Pitre <npitre@baylibre.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sasha Levin <sashal@kernel.org>,
	gnoack@google.com, tglx@linutronix.de, kees@kernel.org,
	aha310510@gmail.com
Subject: [PATCH AUTOSEL 6.12 16/21] vt: add missing notification when switching back to text mode
Date: Mon, 30 Jun 2025 16:45:31 -0400	[thread overview]
Message-ID: <20250630204536.1358327-16-sashal@kernel.org> (raw)
In-Reply-To: <20250630204536.1358327-1-sashal@kernel.org>

From: Nicolas Pitre <npitre@baylibre.com>

[ Upstream commit ff78538e07fa284ce08cbbcb0730daa91ed16722 ]

Programs using poll() on /dev/vcsa to be notified when VT changes occur
were missing one case: the switch from gfx to text mode.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Link: https://lore.kernel.org/r/9o5ro928-0pp4-05rq-70p4-ro385n21n723@onlyvoer.pbz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

**YES**

This commit should be backported to stable kernel trees for the
following reasons:

1. **It fixes a real bug affecting userspace programs**: The commit
   addresses a missing notification that prevents programs using
   `poll()` on `/dev/vcsa` from being properly notified when the VT
   switches from graphics mode back to text mode. This is a functional
   regression that breaks userspace applications monitoring VT state
   changes.

2. **The fix is minimal and low-risk**: The change adds only a single
   line - `notify_update(vc);` - in the `do_unblank_screen()` function.
   This follows an established pattern where `notify_update()` is called
   after VT state changes to notify userspace watchers.

3. **Consistent with existing code patterns**: Looking at the codebase,
   `notify_update()` is already called in similar contexts throughout
   vt.c. For example, in `vc_do_resize()`, we see:
  ```c
  vt_event_post(VT_EVENT_RESIZE, vc->vc_num, vc->vc_num);
  notify_update(vc);
  ```
  The same pattern should apply when unblanking the screen.

4. **Similar commits were backported**: The historical commits provided
   show that previous fixes adding or correcting `notify_update()` calls
   were marked for stable backporting (all three YES examples had `Cc:
   stable@vger.kernel.org`). These commits fixed similar issues where
   userspace poll() notifications were missing.

5. **Clear symptom and fix**: The bug has a clear symptom (missing
   notifications when switching from graphics to text mode) and a
   straightforward fix that directly addresses the root cause. The
   `leaving_gfx` parameter in `do_unblank_screen()` specifically
   indicates this transition scenario.

6. **No architectural changes**: This is purely a bug fix that restores
   expected behavior without introducing new features or changing the
   architecture of the VT subsystem.

The commit meets all the criteria for stable backporting: it fixes an
important bug affecting userspace, the fix is minimal and contained, and
it follows established patterns for similar fixes that were previously
backported.

 drivers/tty/vt/vt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index be5564ed8c018..5b09ce71345b6 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -4566,6 +4566,7 @@ void do_unblank_screen(int leaving_gfx)
 	set_palette(vc);
 	set_cursor(vc);
 	vt_event_post(VT_EVENT_UNBLANK, vc->vc_num, vc->vc_num);
+	notify_update(vc);
 }
 EXPORT_SYMBOL(do_unblank_screen);
 
-- 
2.39.5


  parent reply	other threads:[~2025-06-30 21:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30 20:45 [PATCH AUTOSEL 6.12 01/21] ublk: sanity check add_dev input for underflow Sasha Levin
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 02/21] atm: idt77252: Add missing `dma_map_error()` Sasha Levin
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 03/21] um: vector: Reduce stack usage in vector_eth_configure() Sasha Levin
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 04/21] ASoC: SOF: Intel: hda: Use devm_kstrdup() to avoid memleak Sasha Levin
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 05/21] Revert "PCI/ACPI: Fix allocated memory release on error in pci_acpi_scan_root()" Sasha Levin
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 06/21] ALSA: hda/realtek: Add mic-mute LED setup for ASUS UM5606 Sasha Levin
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 07/21] io_uring: make fallocate be hashed work Sasha Levin
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 08/21] ASoC: amd: yc: add quirk for Acer Nitro ANV15-41 internal mic Sasha Levin
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 09/21] ALSA: hda/realtek - Enable mute LED on HP Pavilion Laptop 15-eg100 Sasha Levin
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 10/21] ALSA: hda/realtek: Add quirks for some Clevo laptops Sasha Levin
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 11/21] net: usb: qmi_wwan: add SIMCom 8230C composition Sasha Levin
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 12/21] driver: bluetooth: hci_qca:fix unable to load the BT driver Sasha Levin
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 13/21] HID: lenovo: Add support for ThinkPad X1 Tablet Thin Keyboard Gen2 Sasha Levin
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 14/21] net: mana: Record doorbell physical address in PF mode Sasha Levin
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 15/21] btrfs: fix assertion when building free space tree Sasha Levin
2025-06-30 20:45 ` Sasha Levin [this message]
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 17/21] bpf: Adjust free target to avoid global starvation of LRU map Sasha Levin
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 18/21] riscv: vdso: Exclude .rodata from the PT_DYNAMIC segment Sasha Levin
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 19/21] HID: Add IGNORE quirk for SMARTLINKTECHNOLOGY Sasha Levin
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 20/21] HID: quirks: Add quirk for 2 Chicony Electronics HP 5MP Cameras Sasha Levin
2025-06-30 20:45 ` [PATCH AUTOSEL 6.12 21/21] HID: nintendo: avoid bluetooth suspend/resume stalls 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=20250630204536.1358327-16-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=aha310510@gmail.com \
    --cc=gnoack@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kees@kernel.org \
    --cc=npitre@baylibre.com \
    --cc=patches@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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