aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can/mcp251x.c
diff options
context:
space:
mode:
authorOliver Hartkopp <oliver@hartkopp.net>2010-01-12 05:00:46 -0500
committerDavid S. Miller <davem@davemloft.net>2010-01-12 05:00:46 -0500
commit3ccd4c6167d3b39d52631767ebbf8b5677c5855d (patch)
treebfcb801edebd00e8b30e897038bad7fee39625cc /drivers/net/can/mcp251x.c
parentd218d11133d888f9745802146a50255a4781d37a (diff)
can: Unify droping of invalid tx skbs and netdev stats
To prevent the CAN drivers to operate on invalid socketbuffers the skbs are now checked and silently dropped at the xmit-function consistently. Also the netdev stats are consistently using the CAN data length code (dlc) for [rx|tx]_bytes now. Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net> Acked-by: Wolfgang Grandegger <wg@grandegger.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/can/mcp251x.c')
-rw-r--r--drivers/net/can/mcp251x.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index 1a72ca066a17..afa2fa45fed9 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -494,12 +494,8 @@ static netdev_tx_t mcp251x_hard_start_xmit(struct sk_buff *skb,
494 return NETDEV_TX_BUSY; 494 return NETDEV_TX_BUSY;
495 } 495 }
496 496
497 if (skb->len != sizeof(struct can_frame)) { 497 if (can_dropped_invalid_skb(net, skb))
498 dev_err(&spi->dev, "dropping packet - bad length\n");
499 dev_kfree_skb(skb);
500 net->stats.tx_dropped++;
501 return NETDEV_TX_OK; 498 return NETDEV_TX_OK;
502 }
503 499
504 netif_stop_queue(net); 500 netif_stop_queue(net);
505 priv->tx_skb = skb; 501 priv->tx_skb = skb;