From: Ciprian Costea <ciprianmarian.costea@oss.nxp.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>,
Vincent Mailhol <mailhol@kernel.org>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
Dario Binacchi <dario.binacchi@amarulasolutions.com>,
Max Staudt <max@enpas.org>,
Markus Schneider-Pargmann <msp@baylibre.com>,
Heiko Stuebner <heiko@sntech.de>,
Manivannan Sadhasivam <mani@kernel.org>,
Thomas Kopp <thomas.kopp@microchip.com>,
Ming Yu <tmyu0@nuvoton.com>
Cc: kernel@pengutronix.de, linux-can@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org,
NXP S32 Linux Team <s32@nxp.com>,
imx@lists.linux.dev, Haibo Chen <haibo.chen@nxp.com>,
Enric Balletbo <eballetb@redhat.com>,
Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
Subject: [PATCH v6 1/3] can: at91_can: release the rx-offload on teardown
Date: Fri, 25 Sep 2026 16:45:56 +0200 [thread overview]
Message-ID: <20260925144558.2909639-2-ciprianmarian.costea@oss.nxp.com> (raw)
In-Reply-To: <20260925144558.2909639-1-ciprianmarian.costea@oss.nxp.com>
From: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
at91_can_probe() ignores the return value of can_rx_offload_add_timestamp()
and can_rx_offload_del() is never called, neither on the register_candev()
error path nor in at91_can_remove(). Any skbs left in the offload queues
are leaked.
Check the return value and call can_rx_offload_del() on both paths.
Fixes: 137f59d5dab4 ("can: at91_can: switch to rx-offload implementation")
Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
---
drivers/net/can/at91_can.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 58da323f14d7..09aa676a03fb 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -1123,7 +1123,11 @@ static int at91_can_probe(struct platform_device *pdev)
priv->offload.mb_first = devtype_data->rx_first;
priv->offload.mb_last = devtype_data->rx_last;
- can_rx_offload_add_timestamp(dev, &priv->offload);
+ err = can_rx_offload_add_timestamp(dev, &priv->offload);
+ if (err) {
+ dev_err(&pdev->dev, "can_rx_offload_add_timestamp() failed\n");
+ goto exit_free;
+ }
if (transceiver)
priv->can.bitrate_max = transceiver->attrs.max_link_rate;
@@ -1137,7 +1141,7 @@ static int at91_can_probe(struct platform_device *pdev)
err = register_candev(dev);
if (err) {
dev_err(&pdev->dev, "registering netdev failed\n");
- goto exit_free;
+ goto exit_offload;
}
dev_info(&pdev->dev, "device registered (reg_base=%p, irq=%d)\n",
@@ -1145,6 +1149,8 @@ static int at91_can_probe(struct platform_device *pdev)
return 0;
+ exit_offload:
+ can_rx_offload_del(&priv->offload);
exit_free:
free_candev(dev);
exit_iounmap:
@@ -1165,6 +1171,8 @@ static void at91_can_remove(struct platform_device *pdev)
unregister_netdev(dev);
+ can_rx_offload_del(&priv->offload);
+
iounmap(priv->reg_base);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
--
2.43.0
next prev parent reply other threads:[~2026-09-25 14:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 14:45 [PATCH v6 0/3] can: rx-offload: add a per-IRQ receive context Ciprian Costea
2026-09-25 14:45 ` Ciprian Costea [this message]
2026-09-26 14:53 ` [PATCH v6 1/3] can: at91_can: release the rx-offload on teardown Max Staudt
2026-09-25 14:45 ` [PATCH v6 2/3] can: rx-offload: add a per-IRQ receive context Ciprian Costea
2026-09-26 15:26 ` Max Staudt
2026-09-28 7:39 ` Ciprian Marian Costea
2026-10-01 3:39 ` Bough Chen
2026-10-01 7:45 ` Ciprian Marian Costea
2026-09-25 14:45 ` [PATCH v6 3/3] can: flexcan: use one rx-offload context per IRQ line Ciprian Costea
2026-09-29 8:21 ` [PATCH v6 0/3] can: rx-offload: add a per-IRQ receive context Ciprian Marian Costea
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260925144558.2909639-2-ciprianmarian.costea@oss.nxp.com \
--to=ciprianmarian.costea@oss.nxp.com \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=dario.binacchi@amarulasolutions.com \
--cc=eballetb@redhat.com \
--cc=haibo.chen@nxp.com \
--cc=heiko@sntech.de \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mailhol@kernel.org \
--cc=mani@kernel.org \
--cc=max@enpas.org \
--cc=mkl@pengutronix.de \
--cc=msp@baylibre.com \
--cc=nicolas.ferre@microchip.com \
--cc=s32@nxp.com \
--cc=thomas.kopp@microchip.com \
--cc=tmyu0@nuvoton.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®