From: Alan Stern <stern@rowland.harvard.edu>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Paul Cercueil <paul@crapouillou.net>,
linux-usb@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH 1/2] usb: gadget: u_ether: Do not make UDC parent of the net device
Date: Fri, 10 Feb 2023 10:45:54 -0500 [thread overview]
Message-ID: <Y+ZmsofmJPYRoUjW@rowland.harvard.edu> (raw)
In-Reply-To: <20230210144940.GB10447@pengutronix.de>
On Fri, Feb 10, 2023 at 03:49:41PM +0100, Sascha Hauer wrote:
> On Thu, Feb 09, 2023 at 10:05:35AM -0500, Alan Stern wrote:
> > Sascha:
> >
> > When you first posted your original patch, I wondered if it was really
> > the right thing to do. Making the net device not be a child of the UDC
> > device means you can (in theory) have strange behavior such as the
> > kernel suspending the USB device controller while expecting the network
> > interface to keep on working.
> >
> > Is there a different way of solving the original problem?
>
> I don't know which. One thing would be to couple the lifetime of the
> ethernet device to the lifetime of the UDC, but the result would look
> different to userspace, so wouldn't be ideal either.
>
> Note the original reason doing this change was that we saw backtraces
> when doing a 'reboot -f', the 'rmmod dummy_hcd' was just an easy
> reproducer for the problem.
>
> One other possibility might be to take a reference to the UDC while
> it is in use so that the module can't be rmmoded. Not sure if that fixes
> my original problem though.
Not being familiar with the networking code, I don't really understand
the original problem. Does the use-after-free error occur when you try
to dereference a dev->parent pointer in the ethernet device?
If that's so, then taking a reference (i.e. get_device()) on the parent
device should fix the problem.
If not, maybe you can give a more detailed guide as to what's going
wrong.
Alan Stern
next prev parent reply other threads:[~2023-02-10 15:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-04 13:10 [PATCH 0/2] use-after-free issues in configfs Sascha Hauer
2022-11-04 13:10 ` [PATCH 1/2] usb: gadget: u_ether: Do not make UDC parent of the net device Sascha Hauer
2023-02-01 13:32 ` Paul Cercueil
2023-02-03 12:46 ` Linux kernel regression tracking (#adding)
2023-02-16 11:07 ` Linux regression tracking #update (Thorsten Leemhuis)
2023-02-08 12:06 ` Greg Kroah-Hartman
2023-02-08 13:45 ` Paul Cercueil
2023-02-09 10:18 ` Sascha Hauer
2023-02-09 10:37 ` Paul Cercueil
2023-02-09 11:41 ` Sascha Hauer
2023-02-09 15:05 ` Alan Stern
2023-02-10 14:49 ` Sascha Hauer
2023-02-10 15:45 ` Alan Stern [this message]
2023-02-10 18:46 ` Sascha Hauer
2023-09-04 13:14 ` Ondřej Jirman
2023-09-05 0:12 ` Ondřej Jirman
2022-11-04 13:10 ` [PATCH 2/2] usb: gadget: f_ecm: Always set current gadget in ecm_bind() Sascha Hauer
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=Y+ZmsofmJPYRoUjW@rowland.harvard.edu \
--to=stern@rowland.harvard.edu \
--cc=gregkh@linuxfoundation.org \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=paul@crapouillou.net \
--cc=s.hauer@pengutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).