]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
auxdisplay: img-ascii-lcd: Fix lock-up when displaying empty string
authorGeert Uytterhoeven <geert@linux-m68k.org>
Tue, 19 Oct 2021 14:45:02 +0000 (16:45 +0200)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 4 Jan 2022 08:48:34 +0000 (09:48 +0100)
commit5b4e69f45a6dd31e1262d125adc925c3d7adadae
treef78e574e41061c2d7d66e736e499ccc8e9581292
parent8da680bf1411e1382527ca4f315fd097917049af
auxdisplay: img-ascii-lcd: Fix lock-up when displaying empty string

BugLink: https://bugs.launchpad.net/bugs/1951822
[ Upstream commit afcb5a811ff3ab3969f09666535eb6018a160358 ]

While writing an empty string to a device attribute is a no-op, and thus
does not need explicit safeguards, the user can still write a single
newline to an attribute file:

    echo > .../message

If that happens, img_ascii_lcd_display() trims the newline, yielding an
empty string, and causing an infinite loop in img_ascii_lcd_scroll().

Fix this by adding a check for empty strings.  Clear the display in case
one is encountered.

Fixes: 0cad855fbd083ee5 ("auxdisplay: img-ascii-lcd: driver for simple ASCII LCD displays")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/auxdisplay/img-ascii-lcd.c