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: <99dc6953-b300-36a6-32cb-52edb289ca57@kvaser.com>
Date:   Sat, 28 May 2022 09:35:15 +0200
From:   Jimmy Assarsson <extja@...ser.com>
To:     Anssi Hannula <anssi.hannula@...wise.fi>
Cc:     linux-can@...r.kernel.org, Marc Kleine-Budde <mkl@...gutronix.de>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 12/12] can: kvaser_usb_leaf: Fix bogus restart events

On 5/16/22 15:47, Anssi Hannula wrote:
> When auto-restart is enabled, the kvaser_usb_leaf driver considers
> transition from any state >= CAN_STATE_BUS_OFF as a bus-off recovery
> event (restart).
> 
> However, these events may occur at interface startup time before
> kvaser_usb_open() has set the state to CAN_STATE_ERROR_ACTIVE, causing
> restarts counter to increase and CAN_ERR_RESTARTED to be sent despite no
> actual restart having occurred.
> 
> Fix that by making the auto-restart condition checks more strict so that
> they only trigger when the interface was actually in the BUS_OFF state.
> 
> Fixes: 080f40a6fa28 ("can: kvaser_usb: Add support for Kvaser CAN/USB devices")
> Signed-off-by: Anssi Hannula <anssi.hannula@...wise.fi>

Looks good to me.
Tested-by: Jimmy Assarsson <extja@...ser.com>

> ---
>   drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
> index 4125074c7066..b280d315673f 100644
> --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
> +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
> @@ -735,7 +735,7 @@ static void kvaser_usb_leaf_tx_acknowledge(const struct kvaser_usb *dev,
>   	context = &priv->tx_contexts[tid % dev->max_tx_urbs];
>   
>   	/* Sometimes the state change doesn't come after a bus-off event */
> -	if (priv->can.restart_ms && priv->can.state >= CAN_STATE_BUS_OFF) {
> +	if (priv->can.restart_ms && priv->can.state == CAN_STATE_BUS_OFF) {
>   		struct sk_buff *skb;
>   		struct can_frame *cf;
>   
> @@ -852,7 +852,7 @@ kvaser_usb_leaf_rx_error_update_can_state(struct kvaser_usb_net_priv *priv,
>   	}
>   
>   	if (priv->can.restart_ms &&
> -	    cur_state >= CAN_STATE_BUS_OFF &&
> +	    cur_state == CAN_STATE_BUS_OFF &&
>   	    new_state < CAN_STATE_BUS_OFF)
>   		priv->can.can_stats.restarts++;
>   
> @@ -945,7 +945,7 @@ static void kvaser_usb_leaf_rx_error(const struct kvaser_usb *dev,
>   		}
>   
>   		if (priv->can.restart_ms &&
> -		    old_state >= CAN_STATE_BUS_OFF &&
> +		    old_state == CAN_STATE_BUS_OFF &&
>   		    new_state < CAN_STATE_BUS_OFF) {
>   			cf->can_id |= CAN_ERR_RESTARTED;
>   			netif_carrier_on(priv->netdev);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ