Linux Framebuffer Layer development
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: YuanZhe Liu <25031212351@stu.xidian.edu.cn>,
	Steve Glendinning <steve.glendinning@shawell.net>
Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, Bin Yu <byu@xidian.edu.cn>,
	Cheng Wen <wencheng@xidian.edu.cn>
Subject: Re: [PATCH v2] fbdev: smscufx: keep the usb_device alive while ufx_data is in use
Date: Wed, 18 Nov 2026 20:15:55 +0100	[thread overview]
Message-ID: <96e0feee-1c6f-4235-a76d-b43aba44c19d@gmx.de> (raw)
In-Reply-To: <20261102085724.13456-1-25031212351@stu.xidian.edu.cn>

On 11/2/26 09:57, YuanZhe Liu wrote:
> ufx_usb_probe() stores the usb_device pointer in dev->udev without
> taking a reference, and ufx_usb_disconnect() does not wait for in-flight
> control transfers.  A mode set or blank request that runs while the
> device is being unplugged - through ufx_ops_set_par() or ufx_ops_blank()
> on an open /dev/fbN file - keeps issuing synchronous control messages for
> the whole ufx_set_vid_mode() sequence, including two msleep(1) delays in
> ufx_config_pix_clk().  Once the disconnect callback returns, the USB core
> may release the usb_device, and the next ufx_reg_write()/ufx_reg_read()
> dereferences dev->udev through __create_pipe():
> 
>    general protection fault, probably for non-canonical address
>    0xdffffc0000000006: 0000 [#1] SMP
>    KASAN: null-ptr-deref in range [0x0000000000000030-0x0000000000000037]
>    RIP: __create_pipe include/linux/usb.h:2031
>    Call Trace:
>     ufx_set_vid_mode
>     ufx_ops_set_par
>     fb_set_var
>     fb_set_var_from_user
>     store_rotate
> 
> Take a reference to the usb_device in ufx_usb_probe() and drop it in
> ufx_free(), so dev->udev and dev->gdev stay valid until the last
> ufx_data user is gone.  The control transfers then fail with -ENODEV
> instead of dereferencing freed memory.
> 
> Also return early from ufx_set_vid_mode() while the device is inactive,
> matching the other transmit paths.  That check alone is not enough,
> because it is not serialized against ufx_usb_disconnect() and the
> transfer sequence continues after it; it only avoids a long series of
> failing transfers.
> 
> Fixes: 3c8a63e22a08 ("Add support for SMSC UFX6000/7000 USB display adapters")
> Cc: stable@vger.kernel.org
> ---
> Changes in v2:
>   - Hold a reference to the usb_device and drop it in ufx_free() so
>     dev->udev stays valid for the whole transfer sequence; the
>     usb_active check alone only covers the entry (review feedback).
>   drivers/video/fbdev/smscufx.c | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
applied.

Thanks!
Helge

      reply	other threads:[~2026-11-18 19:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02  7:21 [PATCH] fbdev: smscufx: bail out of ufx_set_vid_mode() when the device is gone YuanZhe Liu
2026-11-02  8:57 ` [PATCH v2] fbdev: smscufx: keep the usb_device alive while ufx_data is in use YuanZhe Liu
2026-11-18 19:15   ` Helge Deller [this message]

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=96e0feee-1c6f-4235-a76d-b43aba44c19d@gmx.de \
    --to=deller@gmx.de \
    --cc=25031212351@stu.xidian.edu.cn \
    --cc=byu@xidian.edu.cn \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=steve.glendinning@shawell.net \
    --cc=wencheng@xidian.edu.cn \
    /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