aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can/usb/ucan.c
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2021-03-19 15:21:32 +0100
committerMarc Kleine-Budde <mkl@pengutronix.de>2021-03-30 11:14:28 +0200
commitf318482a1c57315d0efccd2861f153f55c2117c6 (patch)
tree7197d4579a82c7098e3c3af382615138529b7003 /drivers/net/can/usb/ucan.c
parentcan: dev: can_free_echo_skb(): don't crash the kernel if can_priv::echo_skb is accessed out of bounds (diff)
downloadlinux-dev-f318482a1c57315d0efccd2861f153f55c2117c6.tar.xz
linux-dev-f318482a1c57315d0efccd2861f153f55c2117c6.zip
can: dev: can_free_echo_skb(): extend to return can frame length
In order to implement byte queue limits (bql) in CAN drivers, the length of the CAN frame needs to be passed into the networking stack even if the transmission failed for some reason. To avoid to calculate this length twice, extend can_free_echo_skb() to return that value. Convert all users of this function, too. This patch is the natural extension of commit: | 9420e1d495e2 ("can: dev: can_get_echo_skb(): extend to return can | frame length") Link: https://lore.kernel.org/r/20210319142700.305648-3-mkl@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/usb/ucan.c')
-rw-r--r--drivers/net/can/usb/ucan.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/can/usb/ucan.c b/drivers/net/can/usb/ucan.c
index fa403c080871..11fddedc36d4 100644
--- a/drivers/net/can/usb/ucan.c
+++ b/drivers/net/can/usb/ucan.c
@@ -675,7 +675,7 @@ static void ucan_tx_complete_msg(struct ucan_priv *up,
can_get_echo_skb(up->netdev, echo_index, NULL);
} else {
up->netdev->stats.tx_dropped++;
- can_free_echo_skb(up->netdev, echo_index);
+ can_free_echo_skb(up->netdev, echo_index, NULL);
}
spin_unlock_irqrestore(&up->echo_skb_lock, flags);
}
@@ -843,7 +843,7 @@ static void ucan_write_bulk_callback(struct urb *urb)
/* update counters an cleanup */
spin_lock_irqsave(&up->echo_skb_lock, flags);
- can_free_echo_skb(up->netdev, context - up->context_array);
+ can_free_echo_skb(up->netdev, context - up->context_array, NULL);
spin_unlock_irqrestore(&up->echo_skb_lock, flags);
up->netdev->stats.tx_dropped++;
@@ -1157,7 +1157,7 @@ static netdev_tx_t ucan_start_xmit(struct sk_buff *skb,
* frees the skb
*/
spin_lock_irqsave(&up->echo_skb_lock, flags);
- can_free_echo_skb(up->netdev, echo_index);
+ can_free_echo_skb(up->netdev, echo_index, NULL);
spin_unlock_irqrestore(&up->echo_skb_lock, flags);
if (ret == -ENODEV) {