Patch "can: sun4i_can: sun4i_can_err(): call can_change_state() even if cf is NULL" has been added to the 5.10-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: sun4i_can: sun4i_can_err(): call can_change_state() even if cf is NULL

to the 5.10-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-sun4i_can-sun4i_can_err-call-can_change_state-ev.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 9dd7b855d91b6781d88a884a7c249a3a8097525f
Author: Dario Binacchi <dario.binacchi@xxxxxxxxxxxxxxxxxxxx>
Date:   Fri Nov 22 23:15:43 2024 +0100

    can: sun4i_can: sun4i_can_err(): call can_change_state() even if cf is NULL
    
    [ Upstream commit ee6bf3677ae03569d833795064e17f605c2163c7 ]
    
    Call the function can_change_state() if the allocation of the skb
    fails, as it handles the cf parameter when it is null.
    
    Additionally, this ensures that the statistics related to state error
    counters (i. e. warning, passive, and bus-off) are updated.
    
    Fixes: 0738eff14d81 ("can: Allwinner A10/A20 CAN Controller support - Kernel module")
    Signed-off-by: Dario Binacchi <dario.binacchi@xxxxxxxxxxxxxxxxxxxx>
    Link: https://patch.msgid.link/20241122221650.633981-3-dario.binacchi@xxxxxxxxxxxxxxxxxxxx
    Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/can/sun4i_can.c b/drivers/net/can/sun4i_can.c
index 39ddb3d849dd8..e9fa3921efbed 100644
--- a/drivers/net/can/sun4i_can.c
+++ b/drivers/net/can/sun4i_can.c
@@ -613,10 +613,10 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status)
 		tx_state = txerr >= rxerr ? state : 0;
 		rx_state = txerr <= rxerr ? state : 0;
 
-		if (likely(skb))
-			can_change_state(dev, cf, tx_state, rx_state);
-		else
-			priv->can.state = state;
+		/* The skb allocation might fail, but can_change_state()
+		 * handles cf == NULL.
+		 */
+		can_change_state(dev, cf, tx_state, rx_state);
 		if (state == CAN_STATE_BUS_OFF)
 			can_bus_off(dev);
 	}




[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