From: "Martin Hundebøll" <martin@geanix.com>
To: Wolfgang Grandegger <wg@grandegger.com>,
Marc Kleine-Budde <mkl@pengutronix.de>,
linux-can@vger.kernel.org
Cc: "Martin Hundebøll" <martin@geanix.com>,
"David S . Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, "Sean Nyekjaer" <sean@geanix.com>
Subject: [PATCH] can: flexcan: free error skb if enqueueing failed
Date: Mon, 15 Jul 2019 20:53:08 +0200 [thread overview]
Message-ID: <20190715185308.104333-1-martin@geanix.com> (raw)
If the call to can_rx_offload_queue_sorted() fails, the passed skb isn't
consumed, so the caller must do so.
Fixes: 30164759db1b ("can: flexcan: make use of rx-offload's irq_offload_fifo")
Signed-off-by: Martin Hundebøll <martin@geanix.com>
---
drivers/net/can/flexcan.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 1c66fb2ad76b..21f39e805d42 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -688,7 +688,8 @@ static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr)
if (tx_errors)
dev->stats.tx_errors++;
- can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
+ if (can_rx_offload_queue_sorted(&priv->offload, skb, timestamp))
+ kfree_skb(skb);
}
static void flexcan_irq_state(struct net_device *dev, u32 reg_esr)
@@ -732,7 +733,8 @@ static void flexcan_irq_state(struct net_device *dev, u32 reg_esr)
if (unlikely(new_state == CAN_STATE_BUS_OFF))
can_bus_off(dev);
- can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
+ if (can_rx_offload_queue_sorted(&priv->offload, skb, timestamp))
+ kfree_skb(skb);
}
static inline struct flexcan_priv *rx_offload_to_priv(struct can_rx_offload *offload)
--
2.22.0
next reply other threads:[~2019-07-15 18:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-15 18:53 Martin Hundebøll [this message]
2019-08-01 7:59 ` [PATCH] can: flexcan: free error skb if enqueueing failed Martin Hundebøll
2019-09-13 9:44 ` Sean Nyekjaer
2019-08-20 9:49 ` Sean Nyekjaer
2019-08-20 10:12 ` Joakim Zhang
2019-10-10 8:08 ` Marc Kleine-Budde
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=20190715185308.104333-1-martin@geanix.com \
--to=martin@geanix.com \
--cc=davem@davemloft.net \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=sean@geanix.com \
--cc=wg@grandegger.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