aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
diff options
context:
space:
mode:
authorAnssi Hannula <anssi.hannula@bitwise.fi>2022-10-10 17:08:27 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2022-10-11 08:50:44 +0200
commitcd7f30e174d09a02ca2afa5ef093fb0f0352e0d8 (patch)
tree9bea702835493aeea235f28809ca7d921d71f97d /drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
parentcan: kvaser_usb_leaf: Fix overread with an invalid command (diff)
downloadlinux-dev-cd7f30e174d09a02ca2afa5ef093fb0f0352e0d8.tar.xz
linux-dev-cd7f30e174d09a02ca2afa5ef093fb0f0352e0d8.zip
can: kvaser_usb: Fix use of uninitialized completion
flush_comp is initialized when CMD_FLUSH_QUEUE is sent to the device and completed when the device sends CMD_FLUSH_QUEUE_RESP. This causes completion of uninitialized completion if the device sends CMD_FLUSH_QUEUE_RESP before CMD_FLUSH_QUEUE is ever sent (e.g. as a response to a flush by a previously bound driver, or a misbehaving device). Fix that by initializing flush_comp in kvaser_usb_init_one() like the other completions. This issue is only triggerable after RX URBs have been set up, i.e. the interface has been opened at least once. Cc: stable@vger.kernel.org Fixes: aec5fb2268b7 ("can: kvaser_usb: Add support for Kvaser USB hydra family") Tested-by: Jimmy Assarsson <extja@kvaser.com> Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi> Signed-off-by: Jimmy Assarsson <extja@kvaser.com> Link: https://lore.kernel.org/all/20221010150829.199676-3-extja@kvaser.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to '')
-rw-r--r--drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
index 6871d474dabf..7b52fda73d82 100644
--- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
+++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
@@ -1916,7 +1916,7 @@ static int kvaser_usb_hydra_flush_queue(struct kvaser_usb_net_priv *priv)
{
int err;
- init_completion(&priv->flush_comp);
+ reinit_completion(&priv->flush_comp);
err = kvaser_usb_hydra_send_simple_cmd(priv->dev, CMD_FLUSH_QUEUE,
priv->channel);