From: David Heidelberg <david@ixit.cz>
To: Kuen-Han Tsai <khtsai@google.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@kernel.org, kernel test robot <oliver.sang@intel.com>
Subject: Re: [PATCH v2 0/2] usb: gadget: Fix g_ncm regression and atomic sleep in f_ncm
Date: Sat, 28 Feb 2026 22:03:40 +0100 [thread overview]
Message-ID: <70b558ea-a12e-4170-9b8e-c951131249af@ixit.cz> (raw)
In-Reply-To: <20260221-legacy-ncm-v2-0-dfb891d76507@google.com>
Hello Kuen-Han,
sadly this series is not enough to fully fix the usb issue encountered
on qcom sdm845 platform (namely Pixel 3, OnePlus 6/6T etc.).
I didn't debugged deeply, but without these patches interface (indicated
by NM icon) goes on/off/on/off indefinitely. With your patches it seems
stable, but I'm not getting the DHCP address from the phone, which isn't
issue at all when I revert the 56a512a9b4107079f68701e7d55da8507eb963d9
("usb: gadget: f_ncm: align net_device lifecycle with bind/unbind").
I think reverting the original patch would make more sense and then
follow up with new one.
Feel free to add me into CC and I'll happily test on the sdm845 mobile
devices for you.
David
On 21/02/2026 15:48, Kuen-Han Tsai wrote:
> Commit 56a512a9b410 ("usb: gadget: f_ncm: align net_device lifecycle
> with bind/unbind") addressed a lifetime mismatch where the network
> interface outlived the parent gadget. However, this introduced two
> regressions:
>
> 1. A NULL pointer dereference in the legacy g_ncm driver. The legacy
> driver attempts to access the net_device during its binding process
> before the NCM function driver is fully initialized.
>
> 2. A "sleeping function called from atomic context" error in f_ncm.
> The current implementation holds a mutex which might sleep within
> an atomic context.
>
> To resolve these, store the configuration parameters (qmult, host_addr,
> dev_addr) in opts_net until the network device is ready for g_ncm.
> Additionally, remove the net_device pointer from the f_ncm_opts
> structure. This eliminates the race condition with configfs and allows
> dropping the mutex, preventing the atomic sleep issue.
>
> Signed-off-by: Kuen-Han Tsai <khtsai@google.com>
> ---
> Changes in v2:
> - Remove the RFC tag.
> - Fix NPE in gncm reported by the kernel test bot.
> - Fix a "sleeping function called from atomic context" error.
> - Link to v1: https://lore.kernel.org/r/20260214-legacy-ncm-v1-1-139c5bcc6636@google.com
>
> ---
> Kuen-Han Tsai (2):
> usb: legacy: ncm: Fix NPE in gncm_bind
> usb: gadget: f_ncm: Fix atomic context locking issue
>
> drivers/usb/gadget/function/f_ncm.c | 29 +++++++++++---------------
> drivers/usb/gadget/function/u_ether_configfs.h | 11 +---------
> drivers/usb/gadget/function/u_ncm.h | 1 -
> drivers/usb/gadget/legacy/ncm.c | 13 +++++++++---
> 4 files changed, 23 insertions(+), 31 deletions(-)
> ---
> base-commit: da87d45b195148d670ab995367d52aa9e8a9a1fa
> change-id: 20260214-legacy-ncm-8c001295b343
>
> Best regards,
--
David Heidelberg
next prev parent reply other threads:[~2026-02-28 21:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-21 14:48 [PATCH v2 0/2] usb: gadget: Fix g_ncm regression and atomic sleep in f_ncm Kuen-Han Tsai
2026-02-21 14:48 ` [PATCH v2 1/2] usb: legacy: ncm: Fix NPE in gncm_bind Kuen-Han Tsai
2026-02-21 14:48 ` [PATCH v2 2/2] usb: gadget: f_ncm: Fix atomic context locking issue Kuen-Han Tsai
2026-02-28 21:03 ` David Heidelberg [this message]
2026-03-02 10:15 ` [PATCH v2 0/2] usb: gadget: Fix g_ncm regression and atomic sleep in f_ncm Kuen-Han Tsai
2026-03-02 13:05 ` Greg Kroah-Hartman
2026-03-02 15:41 ` David Heidelberg
2026-03-02 17:22 ` David Heidelberg
2026-03-03 10:24 ` Kuen-Han Tsai
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=70b558ea-a12e-4170-9b8e-c951131249af@ixit.cz \
--to=david@ixit.cz \
--cc=gregkh@linuxfoundation.org \
--cc=khtsai@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=oliver.sang@intel.com \
--cc=stable@kernel.org \
/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