2022-05-14 16:17:15

by Vincent MAILHOL

[permalink] [raw]
Subject: [PATCH v3 1/4] can: slcan: use can_dropped_invalid_skb() instead of manual check

slcan does a manual check in slc_xmit() to verify if the skb is
valid. This check is incomplete, use instead
can_dropped_invalid_skb().

Signed-off-by: Vincent Mailhol <[email protected]>
---
drivers/net/can/slcan.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index 27783fbf011f..1879b50391ee 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -359,8 +359,8 @@ static netdev_tx_t slc_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct slcan *sl = netdev_priv(dev);

- if (skb->len != CAN_MTU)
- goto out;
+ if (can_dropped_invalid_skb(dev, skb))
+ return NETDEV_TX_OK;

spin_lock(&sl->lock);
if (!netif_running(dev)) {
--
2.35.1



2022-05-17 02:38:49

by Marc Kleine-Budde

[permalink] [raw]
Subject: Re: [PATCH v3 1/4] can: slcan: use can_dropped_invalid_skb() instead of manual check

On 14.05.2022 23:16:47, Vincent Mailhol wrote:
> slcan does a manual check in slc_xmit() to verify if the skb is
> valid. This check is incomplete, use instead
> can_dropped_invalid_skb().
>
> Signed-off-by: Vincent Mailhol <[email protected]>

I've taken this patch into the latest pull request to net-next.

regards,
Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |


Attachments:
(No filename) (616.00 B)
signature.asc (499.00 B)
Download all attachments