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: <20251021022925.2881236-1-yicongsrfy@163.com>
Date: Tue, 21 Oct 2025 10:29:25 +0800
From: Yi Cong <yicongsrfy@....com>
To: stern@...land.harvard.edu
Cc: andrew+netdev@...n.ch,
	davem@...emloft.net,
	edumazet@...gle.com,
	kuba@...nel.org,
	linux-usb@...r.kernel.org,
	michal.pecio@...il.com,
	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 Mon, 20 Oct 2025 11:56:50 -0400, Alan Stern <stern@...land.harvard.edu> wrote:
>
> On Sat, Oct 18, 2025 at 05:56:18PM +0200, Michal Pecio wrote:
> > On Sat, 18 Oct 2025 11:36:11 -0400, Alan Stern wrote:
> > > > @@ -169,6 +175,12 @@ int usb_choose_configuration(struct usb_device *udev)
> > > >  #endif
> > > >  		}
> > > >
> > > > +		/* Check if we have a preferred vendor driver for this config */
> > > > +		else if (bus_for_each_drv(&usb_bus_type, NULL, (void *) udev, prefer_vendor)) {
> > > > +			best = c;
> > > > +			break;
> > > > +		}
> > >
> > > How are prefer_vendor() and usb_driver_preferred() supposed to know
> > > which configuration is being considered?
> >
> > Currently they don't need to know, but this could be added by passing
> > a temporary struct with more stuff in place of udev.
> >
> > Really, this whole usb_drv->preferred business could be a simple
> > boolean flag, if not for r8152 needing to issue control transfers to
> > the chip to find whether it supports at all.
> >
> > It seems that ax88179_preferred() could simply always return true.
>
> Instead of all this preferred() stuff, why not have the ax88179 driver's
> probe routine check for a different configuration with a vendor-specific
> interface?  If that other config is present and the chip is the right
> type then you can call usb_driver_set_configuration() -- this is exactly
> what it's meant for.

I tried calling usb_driver_set_configuration inside driver's probe()
to select the configuration, but my USB network card has three
configurations (bNumConfigurations=3), which causes usb_driver_set_configuration
to be called twice within probe():
```
static int ax88179_probe()
{
        if (bConfigurationValue != I_WANT) {
                usb_driver_set_configuration(udev, I_WANT)
                return -ENODEV;
        }
        //else really probe
}
```

Although the final result is correct, this approach seems flawed.

This issue does not occur when using choose_configuration.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ