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] [day] [month] [year] [list]
Message-ID: <59e18374-0941-1298-4119-366452375404@suse.com>
Date:   Wed, 2 Feb 2022 10:14:24 +0100
From:   Oliver Neukum <oneukum@...e.com>
To:     Oleksij Rempel <o.rempel@...gutronix.de>,
        Greg KH <gregkh@...uxfoundation.org>
CC:     Oliver Neukum <oneukum@...e.com>, netdev@...r.kernel.org,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel@...gutronix.de, Jakub Kicinski <kuba@...nel.org>,
        "David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH net-next v1 1/1] usbnet: add devlink support


On 28.01.22 12:12, Oleksij Rempel wrote:
> The user space should get an event in case there is a problem with the
> USB transfers, i.e. the URB status is != 0.
That would need filtering for unlinks, but that is a detail
> The use space then can decide if the USB device needs to be reset, power
> cycled and so on.

This is highly problematic. Not necessarily impossible but problematic.

Executing URBs is part of the

* device removal and addition IO paths
* block IO path
* SCSI error handling
* PM transition IO paths

While we can send messages to user space, we cannot allocate a lot
of memory and we cannot wait for responses.

> What about calling a to-be-written devlink function that reports the USB
> status if the URB status is not 0:
>
> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
> index d0f45600b669..a90134854f32 100644
> --- a/drivers/usb/core/hcd.c
> +++ b/drivers/usb/core/hcd.c
> @@ -1648,6 +1648,8 @@ static void __usb_hcd_giveback_urb(struct urb *urb)
>  	usb_unanchor_urb(urb);
>  	if (likely(status == 0))
>  		usb_led_activity(USB_LED_EVENT_HOST);
> +	else
> +		devlink_report_usb_status(urb, status);
>  
>  
It seems to me that you are approaching this issue on too low
a level. Drivers generally do at least rudimentary error handling
or rather detection.

This would be easy to use if you gave them a nice API. Something
like:

devlink_report_urb_error(usb_interface * intf, int reason, bool handling);

Maybe also report resets and hub events from the hub driver and
I think you'd get what you need. You need to be aware of a need for
some kind of limiting logic for disconnects.

The change over from logging something not very helpful to
properly reporting is easy.

    Regards
        Oliver

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ