]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
can: kvaser_usb: kvaser_usb_hydra_get_busparams(): fix memory leak in kvaser_usb_hydr...
authorAbdun Nihaal <nihaal@cse.iitm.ac.in>
Wed, 22 Jul 2026 10:39:03 +0000 (16:09 +0530)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 29 Jul 2026 10:00:00 +0000 (12:00 +0200)
The memory allocated for cmd is not freed after the call to
kvaser_usb_send_cmd() in both the normal and error paths.
Fix that by adding a kfree() immediately after the call.

Fixes: 39d3df6b0ea8 ("can: kvaser_usb: Compare requested bittiming parameters with actual parameters in do_set_{,data}_bittiming")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Link: https://patch.msgid.link/20260722103906.108571-1-nihaal@cse.iitm.ac.in
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c

index e09d663e362f98d22a2980732839be03354c9a15..efbb7bed34c9d9c01428699a0860739582369f1b 100644 (file)
@@ -1626,6 +1626,7 @@ static int kvaser_usb_hydra_get_busparams(struct kvaser_usb_net_priv *priv,
        reinit_completion(&priv->get_busparams_comp);
 
        err = kvaser_usb_send_cmd(dev, cmd, cmd_len);
+       kfree(cmd);
        if (err)
                return err;