lkml.org 
[lkml]   [2023]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] usb: gadget: u_ether: Do not make UDC parent of the net device
On Fri, Feb 10, 2023 at 10:45:54AM -0500, Alan Stern wrote:
> 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.

I don't remember the details anymore. I'll do some more investigation
next week.

Sascha

--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

\
 
 \ /
  Last update: 2023-03-27 00:18    [W:0.112 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site