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>
This commit is contained in:
parent
d218d11133
commit
3ccd4c6167
9 changed files with 41 additions and 13 deletions
|
@ -494,12 +494,8 @@ static netdev_tx_t mcp251x_hard_start_xmit(struct sk_buff *skb,
|
|||
return NETDEV_TX_BUSY;
|
||||
}
|
||||
|
||||
if (skb->len != sizeof(struct can_frame)) {
|
||||
dev_err(&spi->dev, "dropping packet - bad length\n");
|
||||
dev_kfree_skb(skb);
|
||||
net->stats.tx_dropped++;
|
||||
if (can_dropped_invalid_skb(net, skb))
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
netif_stop_queue(net);
|
||||
priv->tx_skb = skb;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue