diff options
| author | Oliver Hartkopp <[email protected]> | 2022-11-02 09:54:31 +0000 |
|---|---|---|
| committer | Marc Kleine-Budde <[email protected]> | 2022-11-07 13:00:27 +0000 |
| commit | ae64438be1923e3c1102d90fd41db7afcfaf54cc (patch) | |
| tree | 4653f59a5d91825bee51259007370416134a0663 /drivers/net/can/usb/gs_usb.c | |
| parent | can: j1939: j1939_send_one(): fix missing CAN header initialization (diff) | |
| download | kernel-ae64438be1923e3c1102d90fd41db7afcfaf54cc.tar.gz kernel-ae64438be1923e3c1102d90fd41db7afcfaf54cc.zip | |
can: dev: fix skb drop check
In commit a6d190f8c767 ("can: skb: drop tx skb if in listen only
mode") the priv->ctrlmode element is read even on virtual CAN
interfaces that do not create the struct can_priv at startup. This
out-of-bounds read may lead to CAN frame drops for virtual CAN
interfaces like vcan and vxcan.
This patch mainly reverts the original commit and adds a new helper
for CAN interface drivers that provide the required information in
struct can_priv.
Fixes: a6d190f8c767 ("can: skb: drop tx skb if in listen only mode")
Reported-by: Dariusz Stojaczyk <[email protected]>
Cc: Vincent Mailhol <[email protected]>
Cc: Max Staudt <[email protected]>
Signed-off-by: Oliver Hartkopp <[email protected]>
Acked-by: Vincent Mailhol <[email protected]>
Link: https://lore.kernel.org/all/[email protected]
Cc: [email protected] # 6.0.x
[mkl: patch pch_can, too]
Signed-off-by: Marc Kleine-Budde <[email protected]>
Diffstat (limited to 'drivers/net/can/usb/gs_usb.c')
| -rw-r--r-- | drivers/net/can/usb/gs_usb.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c index f0065d40eb24..9c2c25fde3d1 100644 --- a/drivers/net/can/usb/gs_usb.c +++ b/drivers/net/can/usb/gs_usb.c @@ -723,7 +723,7 @@ static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb, unsigned int idx; struct gs_tx_context *txc; - if (can_dropped_invalid_skb(netdev, skb)) + if (can_dev_dropped_skb(netdev, skb)) return NETDEV_TX_OK; /* find an empty context to keep track of transmission */ |
