diff options
author | Sven Eckelmann <sven@narfation.org> | 2016-07-17 15:04:04 -0400 |
---|---|---|
committer | Simon Wunderlich <sw@simonwunderlich.de> | 2016-11-08 13:02:34 -0500 |
commit | b91a2543b4c15fed504e587d4441169c75d6646e (patch) | |
tree | 563f0c5b039a4ee2d83f6023b2e42c7a7dd1db3d /net/batman-adv/network-coding.c | |
parent | 1ad5bcb2a032262170fdc508abfa0acb0565e2b5 (diff) |
batman-adv: Consume skb in receive handlers
Receiving functions in Linux consume the supplied skbuff. Doing the same in
the batadv_rx_handler functions makes the behavior more similar to the rest
of the Linux network code.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Diffstat (limited to 'net/batman-adv/network-coding.c')
-rw-r--r-- | net/batman-adv/network-coding.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c index 3af66d33d4bf..ab5a3bf0765f 100644 --- a/net/batman-adv/network-coding.c +++ b/net/batman-adv/network-coding.c | |||
@@ -1819,11 +1819,11 @@ static int batadv_nc_recv_coded_packet(struct sk_buff *skb, | |||
1819 | 1819 | ||
1820 | /* Check if network coding is enabled */ | 1820 | /* Check if network coding is enabled */ |
1821 | if (!atomic_read(&bat_priv->network_coding)) | 1821 | if (!atomic_read(&bat_priv->network_coding)) |
1822 | return NET_RX_DROP; | 1822 | goto free_skb; |
1823 | 1823 | ||
1824 | /* Make sure we can access (and remove) header */ | 1824 | /* Make sure we can access (and remove) header */ |
1825 | if (unlikely(!pskb_may_pull(skb, hdr_size))) | 1825 | if (unlikely(!pskb_may_pull(skb, hdr_size))) |
1826 | return NET_RX_DROP; | 1826 | goto free_skb; |
1827 | 1827 | ||
1828 | coded_packet = (struct batadv_coded_packet *)skb->data; | 1828 | coded_packet = (struct batadv_coded_packet *)skb->data; |
1829 | ethhdr = eth_hdr(skb); | 1829 | ethhdr = eth_hdr(skb); |
@@ -1831,7 +1831,7 @@ static int batadv_nc_recv_coded_packet(struct sk_buff *skb, | |||
1831 | /* Verify frame is destined for us */ | 1831 | /* Verify frame is destined for us */ |
1832 | if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest) && | 1832 | if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest) && |
1833 | !batadv_is_my_mac(bat_priv, coded_packet->second_dest)) | 1833 | !batadv_is_my_mac(bat_priv, coded_packet->second_dest)) |
1834 | return NET_RX_DROP; | 1834 | goto free_skb; |
1835 | 1835 | ||
1836 | /* Update stat counter */ | 1836 | /* Update stat counter */ |
1837 | if (batadv_is_my_mac(bat_priv, coded_packet->second_dest)) | 1837 | if (batadv_is_my_mac(bat_priv, coded_packet->second_dest)) |
@@ -1841,7 +1841,7 @@ static int batadv_nc_recv_coded_packet(struct sk_buff *skb, | |||
1841 | coded_packet); | 1841 | coded_packet); |
1842 | if (!nc_packet) { | 1842 | if (!nc_packet) { |
1843 | batadv_inc_counter(bat_priv, BATADV_CNT_NC_DECODE_FAILED); | 1843 | batadv_inc_counter(bat_priv, BATADV_CNT_NC_DECODE_FAILED); |
1844 | return NET_RX_DROP; | 1844 | goto free_skb; |
1845 | } | 1845 | } |
1846 | 1846 | ||
1847 | /* Make skb's linear, because decoding accesses the entire buffer */ | 1847 | /* Make skb's linear, because decoding accesses the entire buffer */ |
@@ -1867,6 +1867,9 @@ static int batadv_nc_recv_coded_packet(struct sk_buff *skb, | |||
1867 | 1867 | ||
1868 | free_nc_packet: | 1868 | free_nc_packet: |
1869 | batadv_nc_packet_free(nc_packet, true); | 1869 | batadv_nc_packet_free(nc_packet, true); |
1870 | free_skb: | ||
1871 | kfree_skb(skb); | ||
1872 | |||
1870 | return NET_RX_DROP; | 1873 | return NET_RX_DROP; |
1871 | } | 1874 | } |
1872 | 1875 | ||