Re: [PATCH v3 4/6] usb: interface authorization: Introduces the USB interface authorization.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 17 Jun 2015, Stefan Koch wrote:

> The kernel supports the device authorization because of wireless USB.
> These is usable for wired USB devices, too.
> These new interface authorization allows to enable or disable
> individual interfaces instead a whole device.
> 
> To avoid side effects the driver probing process
> for the interface and it's siblings is triggered after each authorization.

No, don't do this.  Allow the user to trigger probing, don't do it 
automatically.

> Signed-off-by: Stefan Koch <skoch@xxxxxxx>
> ---
>  drivers/usb/core/hub.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++-

hub.c deals with devices, not interfaces.  The new routines belong in 
message.c, along with all the other routines that manage interfaces.

>  drivers/usb/core/usb.h |  2 ++
>  2 files changed, 78 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 3b71516..6837281 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -2528,6 +2528,82 @@ out_unauthorized:
>  	return 0;
>  }
>  
> +/*
> + * usb_deauthorize_interface - deauthorize an USB interface
> + *
> + * @intf: USB interface structure
> + *
> + * Returns: 0 at success, <0 at failure
> + */
> +int usb_deauthorize_interface(struct usb_interface *intf)
> +{
> +	struct device *dev = &intf->dev;
> +
> +	if (!dev || !dev->parent)
> +		return -ENODEV;

This can never happen.  Get rid of it.

> +
> +	device_lock(dev->parent);
> +
> +	if (intf->authorized) {
> +		intf->unregistering = 1;

Don't set intf->unregistering.  You aren't unregistering the interface;
you are de-authorizing it.  They are different things.

> +		intf->authorized = 0;
> +		usb_forced_unbind_intf(intf);
> +	}
> +
> +	device_unlock(dev->parent);
> +
> +	return 0;
> +}

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux