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: <7353775a-bc2c-4c2d-93bc-b8d3e03c3496@rowland.harvard.edu>
Date: Mon, 20 Oct 2025 22:59:36 -0400
From: Alan Stern <stern@...land.harvard.edu>
To: Yi Cong <yicongsrfy@....com>
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 Tue, Oct 21, 2025 at 10:29:25AM +0800, Yi Cong wrote:
> On Mon, 20 Oct 2025 11:56:50 -0400, Alan Stern <stern@...land.harvard.edu> wrote:
> >
> > 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
> }
> ```

Why is it called twice?  The first time probe() runs, it calls 
usb_driver_set_configuration() with the config that you want.  Then the 
second time probe() runs, the config you want has been installed, so 
there's no reason to call usb_driver_set_configuration() again.

Unless something is going wrong, that's how it should work.  And the 
total number of configurations should not matter.

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

This kind of approach is currently being used by usb_modeswitch for a 
bunch of devices.  The only difference being that the choice of which 
config to use is made in userspace, not by a kernel driver.

> This issue does not occur when using choose_configuration.

True, but the discussion in this thread seems to indicate that telling 
choose_configuration what to do for some of these network devices would 
be extremely awkward.

Alan Stern

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ