lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251017191511.6dd841e9.michal.pecio@gmail.com>
Date: Fri, 17 Oct 2025 19:15:11 +0200
From: Michal Pecio <michal.pecio@...il.com>
To: Alan Stern <stern@...land.harvard.edu>
Cc: yicongsrfy@....com, andrew+netdev@...n.ch, davem@...emloft.net,
 edumazet@...gle.com, kuba@...nel.org, linux-usb@...r.kernel.org,
 netdev@...r.kernel.org, oliver@...kum.org, pabeni@...hat.com
Subject: Re: [PATCH net v5 2/3] net: usb: ax88179_178a: add USB device
 driver for config selection

On Fri, 17 Oct 2025 09:10:22 -0400, Alan Stern wrote:
> On Fri, Oct 17, 2025 at 10:42:29AM +0800, yicongsrfy@....com wrote:
> > > > +	/* The vendor mode is not always config #1, so to find it out. */
> > > > +	c = udev->config;
> > > > +	num_configs = udev->descriptor.bNumConfigurations;
> > > > +	for (i = 0; i < num_configs; (i++, c++)) {
> > > > +		struct usb_interface_descriptor	*desc = NULL;
> > > > +
> > > > +		if (!c->desc.bNumInterfaces)
> > > > +			continue;
> > > > +		desc = &c->intf_cache[0]->altsetting->desc;
> > > > +		if (desc->bInterfaceClass == USB_CLASS_VENDOR_SPEC)
> > > > +			break;
> > > > +	}
> > > > +
> > > > +	if (i == num_configs)
> > > > +		return -ENODEV;
> > > > +
> > > > +	return c->desc.bConfigurationValue;
> > > > +}  
> > >
> > > I wonder how many copies of this code would justify making it some
> > > sort of library in usbnet or usbcore?  
> > 
> > Yes, there are many similar code instances in the USB subsystem.
> > However, I'm primarily focused on the networking subsystem,
> > so my abstraction work here might not be thorough enough.
> > Hopefully, an experienced USB developer may can optimize this issue.  
> 
> Would it help to have a USB quirks flag that tells the core to prefer 
> configurations with a USB_CLASS_VENDOR_SPEC interface class when we 
> choose the device's configuration?  Or something similar to that (I'm 
> not sure exactly what you are looking for)?

Either that or just patch usb_choose_configuration() to prefer vendor
config *if* an interface driver is available. But not 100% sure if that
couldn't backfire, so maybe only if the driver asked for it, indeed.

I was looking into making a PoC of that (I have r8152 with two configs)
but there is a snag: r8152-cfgselector bails out if a vendor-specific
check indicates the chip isn't a supported HW revision.

So to to fully replicate r8152-cfgselector, core would neet to get new
"pre_probe" callback in the interface driver. It gets complicated.

A less complicated improvement could be moving the common part of all
cfgselectors into usbnet. Not sure if it's worth it yet for only two?

Regards,
Michal 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ