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

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

 



On Thu, 18 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.
> 
> If a deauthorized interface will be authorized so the driver probing must
> be triggered manually by writing INTERFACE to /sys/bus/usb/drivers_probe
> 
> Signed-off-by: Stefan Koch <skoch@xxxxxxx>
> ---
>  drivers/usb/core/message.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++
>  drivers/usb/core/usb.h     |  2 ++
>  2 files changed, 54 insertions(+)
> 
> diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
> index 1e85f62..333957a 100644
> --- a/drivers/usb/core/message.c
> +++ b/drivers/usb/core/message.c
> @@ -1555,6 +1555,58 @@ static void usb_release_interface(struct device *dev)
>  	kfree(intf);
>  }
>  
> +/*
> + * 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't happen; you should remove it.

> +
> +	device_lock(dev->parent);
> +
> +	if (intf->authorized) {
> +		device_lock(dev);
> +		intf->authorized = 0;
> +		device_unlock(dev);
> +
> +		usb_forced_unbind_intf(intf);
> +	}
> +
> +	device_unlock(dev->parent);
> +
> +	return 0;
> +}
> +
> +/*
> + * usb_authorize_interface - authorize an USB interface
> + *
> + * @intf: USB interface structure
> + *
> + * Returns: 0 at success, <0 at failure
> + */
> +int usb_authorize_interface(struct usb_interface *intf)
> +{
> +	struct device *dev = &intf->dev;
> +
> +	if (!dev)
> +		return -ENODEV;

This can't happen either.

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