This is a note to let you know that I've just added the patch titled can: kvaser_usb: Fix potential uninitialized variable use 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-fix-potential-uninitialized-variable-use.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. >From 95217260649aa504eb5d4a0d50959ca4e67c8f96 Mon Sep 17 00:00:00 2001 From: Jimmy Assarsson <jimmyassarsson@xxxxxxxxx> Date: Mon, 6 Aug 2018 15:14:50 +0200 Subject: can: kvaser_usb: Fix potential uninitialized variable use From: Jimmy Assarsson <jimmyassarsson@xxxxxxxxx> commit 95217260649aa504eb5d4a0d50959ca4e67c8f96 upstream. If alloc_can_err_skb() fails, cf is never initialized. Move assignment of cf inside check. Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Signed-off-by: Jimmy Assarsson <jimmyassarsson@xxxxxxxxx> Cc: linux-stable <stable@xxxxxxxxxxxxxxx> Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c @@ -1019,6 +1019,11 @@ kvaser_usb_hydra_error_frame(struct kvas new_state : CAN_STATE_ERROR_ACTIVE; can_change_state(netdev, cf, tx_state, rx_state); + + if (priv->can.restart_ms && + old_state >= CAN_STATE_BUS_OFF && + new_state < CAN_STATE_BUS_OFF) + cf->can_id |= CAN_ERR_RESTARTED; } if (new_state == CAN_STATE_BUS_OFF) { @@ -1028,11 +1033,6 @@ kvaser_usb_hydra_error_frame(struct kvas can_bus_off(netdev); } - - if (priv->can.restart_ms && - old_state >= CAN_STATE_BUS_OFF && - new_state < CAN_STATE_BUS_OFF) - cf->can_id |= CAN_ERR_RESTARTED; } if (!skb) { Patches currently in stable-queue which might be from jimmyassarsson@xxxxxxxxx are queue-4.19/can-kvaser_usb-fix-potential-uninitialized-variable-use.patch queue-4.19/can-kvaser_usb-fix-accessing-freed-memory-in-kvaser_usb_start_xmit.patch