[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140328093457.5d25b9a3@samsung-9>
Date: Fri, 28 Mar 2014 09:34:57 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Toshiaki Makita <makita.toshiaki@....ntt.co.jp>
Cc: "David S . Miller" <davem@...emloft.net>,
Vlad Yasevich <vyasevic@...hat.com>, netdev@...r.kernel.org,
bridge@...ts.linux-foundation.org
Subject: Re: [PATCH net] bridge: Fix memory leak in br_dev_xmit
On Fri, 28 Mar 2014 15:21:19 +0900
Toshiaki Makita <makita.toshiaki@....ntt.co.jp> wrote:
> When a frame is rejected by br_allowed_ingress(), the skb is not freed.
>
> Signed-off-by: Toshiaki Makita <makita.toshiaki@....ntt.co.jp>
> ---
> net/bridge/br_device.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
> index 8fe8b71..b152fb6 100644
> --- a/net/bridge/br_device.c
> +++ b/net/bridge/br_device.c
> @@ -55,7 +55,7 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
> skb_pull(skb, ETH_HLEN);
>
> if (!br_allowed_ingress(br, br_get_vlan_info(br), skb, &vid))
> - goto out;
> + goto drop;
>
> if (is_broadcast_ether_addr(dest))
> br_flood_deliver(br, skb, false);
> @@ -64,10 +64,8 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
> br_flood_deliver(br, skb, false);
> goto out;
> }
> - if (br_multicast_rcv(br, NULL, skb, vid)) {
> - kfree_skb(skb);
> - goto out;
> - }
> + if (br_multicast_rcv(br, NULL, skb, vid))
> + goto drop;
>
> mdst = br_mdb_get(br, skb, vid);
> if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) &&
> @@ -83,6 +81,9 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
> out:
> rcu_read_unlock();
> return NETDEV_TX_OK;
> +drop:
> + kfree_skb(skb);
> + goto out;
> }
Increment dev->tx_dropped?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists