diff options
| author | YuanZhe Liu <25031212351@stu.xidian.edu.cn> | 2026-11-02 16:48:30 +0800 |
|---|---|---|
| committer | Helge Deller <deller@gmx.de> | 2026-11-19 17:57:10 +0100 |
| commit | ed52e47133f72195f246a9f70c98e47431bb566d (patch) | |
| tree | f089ce69e4a7eed85631096ea2f3af9274d6bad9 /rust/kernel/alloc | |
| parent | 2c8b0da3209955b42280ef60d8e0470dc788c0d8 (diff) | |
fbdev: smscufx: don't free registered framebuffer on probe error
register_framebuffer() can return an error after the framebuffer has
already been installed: do_register_framebuffer() bumps info->count,
creates /dev/fbN and stores the fb_info in registered_fb[] before it
returns the result of the console takeover, and that takeover may fail.
ufx_usb_probe() treats any error as "nothing was registered" and unwinds
through reset_active, which releases the fb_info and drops both
references to struct ufx_data, freeing @dev.
The framebuffer stays registered and can still be opened, so the next
open() of /dev/fbN reaches ufx_ops_open() with info->par pointing at
freed memory:
refcount_t: addition on 0; use-after-free.
WARNING: lib/refcount.c:25 at refcount_warn_saturate
Call Trace:
kref_get
ufx_ops_open drivers/video/fbdev/smscufx.c:1033
fb_open drivers/video/fbdev/core/fb_chrdev.c:351
chrdev_open
...
refcount_t: underflow; use-after-free.
WARNING: lib/refcount.c:28 at refcount_warn_saturate
Call Trace:
ufx_ops_release drivers/video/fbdev/smscufx.c:1135
fb_release drivers/video/fbdev/core/fb_chrdev.c:378
__fput
Reuse the "has this fb_info been registered" test that ufx_setup_modes()
already uses: take the error path only when refcount_read(&info->count)
says the core did not register the framebuffer. A failed console
takeover is not fatal for the driver, so report it and keep the
framebuffer registered; the disconnect callback will unregister it
normally.
Fixes: 3c8a63e22a08 ("Add support for SMSC UFX6000/7000 USB display adapters")
Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Cc: stable@vger.kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'rust/kernel/alloc')
0 files changed, 0 insertions, 0 deletions
