]> git.hungrycats.org Git - linux/commit
HID: picoLCD: check for fb_deferred_io_init() error
authorLorenzo Stoakes (ARM) <ljs@kernel.org>
Sat, 26 Sep 2026 13:17:01 +0000 (14:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Nov 2026 17:10:50 +0000 (12:10 -0500)
commitebe54f9e793bf05c7bd82110fdab24f10b89eac3
treeb7afadadeaa084e128aa72b2ee9b2812bac8d427
parent54a9b3a72c669c841e4e6499b487e9ceec607f1b
HID: picoLCD: check for fb_deferred_io_init() error

commit feade898fc958ff355101adf12d5632272e64220 upstream.

fb_deferred_io_init() allocates deferred I/O state, populating
info->fbdefio_state, or leaving it NULL if an error occurs.

Currently picolcd_init_framebuffer() ignores its return value.

Therefore if an error arises in fb_deferred_io_init() (for instance, due
to an allocation failure) info->fbdefio_state is left NULL.

When the file is subsequently opened, fb_open() will dereference a NULL
pointer (calling fb_deferred_io_open()).

Fix this by checking for the error.

Also correct cleanup ordering - defio is initialised after the sysfs file,
so cleanup defio first.

Fixes: 56c134f7f1b5 ("fbdev: Track deferred-I/O pages in pageref struct")
Cc: stable@vger.kernel.org
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hid/hid-picolcd_fb.c