On Tue, 2016-11-08 at 17:45 +0100, Simon Wunderlich wrote: > From: Sven Eckelmann <s...@narfation.org> > > 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 <s...@narfation.org> > Signed-off-by: Simon Wunderlich <s...@simonwunderlich.de> > --- > net/batman-adv/bat_iv_ogm.c | 17 +++-- > net/batman-adv/bat_v_elp.c | 25 ++++--- > net/batman-adv/bat_v_ogm.c | 10 +-- > net/batman-adv/main.c | 11 +-- > net/batman-adv/network-coding.c | 11 +-- > net/batman-adv/routing.c | 149 > +++++++++++++++++++++++++++------------- > 6 files changed, 141 insertions(+), 82 deletions(-) > > diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c > index 310f391..b9941bf 100644 > --- a/net/batman-adv/bat_iv_ogm.c > +++ b/net/batman-adv/bat_iv_ogm.c > @@ -1823,17 +1823,18 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb, > struct batadv_ogm_packet *ogm_packet; > u8 *packet_pos; > int ogm_offset; > - bool ret; > + bool res; > + int ret = NET_RX_DROP; > > - ret = batadv_check_management_packet(skb, if_incoming, BATADV_OGM_HLEN); > - if (!ret) > - return NET_RX_DROP; > + res = batadv_check_management_packet(skb, if_incoming, BATADV_OGM_HLEN); > + if (!res) > + goto free_skb; > > /* did we receive a B.A.T.M.A.N. IV OGM packet on an interface > * that does not have B.A.T.M.A.N. IV enabled ? > */ > if (bat_priv->algo_ops->iface.enable != batadv_iv_ogm_iface_enable) > - return NET_RX_DROP; > + goto free_skb; > > batadv_inc_counter(bat_priv, BATADV_CNT_MGMT_RX); > batadv_add_counter(bat_priv, BATADV_CNT_MGMT_RX_BYTES, > @@ -1854,8 +1855,12 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb, > ogm_packet = (struct batadv_ogm_packet *)packet_pos; > } > > + ret = NET_RX_SUCCESS; > + > +free_skb: > consume_skb(skb); > - return NET_RX_SUCCESS; > + > + return ret; > }
Okay, but we do have kfree_skb() and consume_skb() and they should be used appropriately.