public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: guhuinan <guhuinan@xiaomi.com>
Cc: stable@vger.kernel.org, linux-usb@vger.kernel.org,
	Al Viro <viro@zeniv.linux.org.uk>,
	Ingo Rohloff <ingo.rohloff@lauterbach.com>,
	Christian Brauner <brauner@kernel.org>,
	Chen Ni <nichen@iscas.ac.cn>,
	Peter Zijlstra <peterz@infradead.org>,
	Sabyrzhan Tasbolatov <snovitoll@gmail.com>,
	Akash M <akash.m5@samsung.com>, Chenyu <chenyu45@xiaomi.com>,
	Yudongbin <yudongbin@xiaomi.com>,
	Mahongwei <mahongwei3@xiaomi.com>,
	Jiangdayu <jiangdayu@xiaomi.com>
Subject: Re: [PATCH 6.12.y] usb: gadget: f_fs: Fix epfile null pointer access after ep enable.
Date: Tue, 4 Nov 2025 14:15:44 +0900	[thread overview]
Message-ID: <2025110452-graffiti-blizzard-9cbc@gregkh> (raw)
In-Reply-To: <20251104034946.605-1-guhuinan@xiaomi.com>

On Tue, Nov 04, 2025 at 11:49:46AM +0800, guhuinan wrote:
> From: Owen Gu <guhuinan@xiaomi.com>
> 
> [ Upstream commit cfd6f1a7b42f ("usb: gadget: f_fs: Fix epfile null
> pointer access after ep enable.") ]
> 
> A race condition occurs when ffs_func_eps_enable() runs concurrently
> with ffs_data_reset(). The ffs_data_clear() called in ffs_data_reset()
> sets ffs->epfiles to NULL before resetting ffs->eps_count to 0, leading
> to a NULL pointer dereference when accessing epfile->ep in
> ffs_func_eps_enable() after successful usb_ep_enable().
> 
> The ffs->epfiles pointer is set to NULL in both ffs_data_clear() and
> ffs_data_close() functions, and its modification is protected by the
> spinlock ffs->eps_lock. And the whole ffs_func_eps_enable() function
> is also protected by ffs->eps_lock.
> 
> Thus, add NULL pointer handling for ffs->epfiles in the
> ffs_func_eps_enable() function to fix issues
> 
> Signed-off-by: Owen Gu <guhuinan@xiaomi.com>
> Link: https://lore.kernel.org/r/20250915092907.17802-1-guhuinan@xiaomi.com
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/usb/gadget/function/f_fs.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

What about 6.17.y?  You do not want to upgrade from 6.12 to a newer
kernel and have a regression.

And if this fixes a bug, why was it not marked with a Fixes: tag or a
 cc: stable tag?  Did I just miss that before?

thanks,

greg k-h

  reply	other threads:[~2025-11-04  5:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-04  3:49 [PATCH 6.12.y] usb: gadget: f_fs: Fix epfile null pointer access after ep enable guhuinan
2025-11-04  5:15 ` Greg Kroah-Hartman [this message]
2025-11-05  2:33   ` Owen Gu

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=2025110452-graffiti-blizzard-9cbc@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=akash.m5@samsung.com \
    --cc=brauner@kernel.org \
    --cc=chenyu45@xiaomi.com \
    --cc=guhuinan@xiaomi.com \
    --cc=ingo.rohloff@lauterbach.com \
    --cc=jiangdayu@xiaomi.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mahongwei3@xiaomi.com \
    --cc=nichen@iscas.ac.cn \
    --cc=peterz@infradead.org \
    --cc=snovitoll@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yudongbin@xiaomi.com \
    /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