Patch "can: kvaser_usb_leaf: Fix wrong CAN state after stopping" has been added to the 4.19-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    can: kvaser_usb_leaf: Fix wrong CAN state after stopping

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     can-kvaser_usb_leaf-fix-wrong-can-state-after-stoppi.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit bc8b6c970fad77efd0e968c055f784ae5e2a2af6
Author: Anssi Hannula <anssi.hannula@xxxxxxxxxx>
Date:   Mon Oct 10 20:52:33 2022 +0200

    can: kvaser_usb_leaf: Fix wrong CAN state after stopping
    
    [ Upstream commit a11249acf802341294557895d8e5f6aef080253f ]
    
    0bfd:0124 Kvaser Mini PCI Express 2xHS FW 4.18.778 sends a
    CMD_CHIP_STATE_EVENT indicating bus-off after stopping the device,
    causing a stopped device to appear as CAN_STATE_BUS_OFF instead of
    CAN_STATE_STOPPED.
    
    Fix that by not handling error events on stopped devices.
    
    Fixes: 080f40a6fa28 ("can: kvaser_usb: Add support for Kvaser CAN/USB devices")
    Tested-by: Jimmy Assarsson <extja@xxxxxxxxxx>
    Signed-off-by: Anssi Hannula <anssi.hannula@xxxxxxxxxx>
    Signed-off-by: Jimmy Assarsson <extja@xxxxxxxxxx>
    Link: https://lore.kernel.org/all/20221010185237.319219-8-extja@xxxxxxxxxx
    Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

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 6d45ae6f2a08..52ac6446634d 100644
--- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
+++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
@@ -1049,6 +1049,10 @@ static void kvaser_usb_leaf_rx_error(const struct kvaser_usb *dev,
 	leaf = priv->sub_priv;
 	stats = &priv->netdev->stats;
 
+	/* Ignore e.g. state change to bus-off reported just after stopping */
+	if (!netif_running(priv->netdev))
+		return;
+
 	/* Update all of the CAN interface's state and error counters before
 	 * trying any memory allocation that can actually fail with -ENOMEM.
 	 *



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux