diff options
Diffstat (limited to 'drivers/net/can/vcan.c')
| -rw-r--r-- | drivers/net/can/vcan.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c index 0a2a5ee79a17..4e94057ef5cf 100644 --- a/drivers/net/can/vcan.c +++ b/drivers/net/can/vcan.c | |||
| @@ -46,6 +46,7 @@ | |||
| 46 | #include <linux/if_ether.h> | 46 | #include <linux/if_ether.h> |
| 47 | #include <linux/can.h> | 47 | #include <linux/can.h> |
| 48 | #include <linux/can/dev.h> | 48 | #include <linux/can/dev.h> |
| 49 | #include <linux/can/skb.h> | ||
| 49 | #include <linux/slab.h> | 50 | #include <linux/slab.h> |
| 50 | #include <net/rtnetlink.h> | 51 | #include <net/rtnetlink.h> |
| 51 | 52 | ||
| @@ -109,25 +110,23 @@ static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev) | |||
| 109 | stats->rx_packets++; | 110 | stats->rx_packets++; |
| 110 | stats->rx_bytes += cfd->len; | 111 | stats->rx_bytes += cfd->len; |
| 111 | } | 112 | } |
| 112 | kfree_skb(skb); | 113 | consume_skb(skb); |
| 113 | return NETDEV_TX_OK; | 114 | return NETDEV_TX_OK; |
| 114 | } | 115 | } |
| 115 | 116 | ||
| 116 | /* perform standard echo handling for CAN network interfaces */ | 117 | /* perform standard echo handling for CAN network interfaces */ |
| 117 | 118 | ||
| 118 | if (loop) { | 119 | if (loop) { |
| 119 | struct sock *srcsk = skb->sk; | ||
| 120 | 120 | ||
| 121 | skb = skb_share_check(skb, GFP_ATOMIC); | 121 | skb = can_create_echo_skb(skb); |
| 122 | if (!skb) | 122 | if (!skb) |
| 123 | return NETDEV_TX_OK; | 123 | return NETDEV_TX_OK; |
| 124 | 124 | ||
| 125 | /* receive with packet counting */ | 125 | /* receive with packet counting */ |
| 126 | skb->sk = srcsk; | ||
| 127 | vcan_rx(skb, dev); | 126 | vcan_rx(skb, dev); |
| 128 | } else { | 127 | } else { |
| 129 | /* no looped packets => no counting */ | 128 | /* no looped packets => no counting */ |
| 130 | kfree_skb(skb); | 129 | consume_skb(skb); |
| 131 | } | 130 | } |
| 132 | return NETDEV_TX_OK; | 131 | return NETDEV_TX_OK; |
| 133 | } | 132 | } |
