From: Stephen Hemminger <stephen@networkplumber.org>
To: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Cc: Vlad Yasevich <vyasevic@redhat.com>,
netdev@vger.kernel.org, bridge@lists.linux-foundation.org,
"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH net] bridge: Fix memory leak in br_dev_xmit
Date: Fri, 28 Mar 2014 09:34:57 -0700 [thread overview]
Message-ID: <20140328093457.5d25b9a3@samsung-9> (raw)
In-Reply-To: <1395987680-8151-1-git-send-email-makita.toshiaki@lab.ntt.co.jp>
On Fri, 28 Mar 2014 15:21:19 +0900
Toshiaki Makita <makita.toshiaki@lab.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@lab.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?
next prev parent reply other threads:[~2014-03-28 16:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-28 6:21 [PATCH net] bridge: Fix memory leak in br_dev_xmit Toshiaki Makita
2014-03-28 16:34 ` Stephen Hemminger [this message]
2014-03-29 7:40 ` Toshiaki Makita
2014-03-30 2:41 ` Toshiaki Makita
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140328093457.5d25b9a3@samsung-9 \
--to=stephen@networkplumber.org \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=makita.toshiaki@lab.ntt.co.jp \
--cc=netdev@vger.kernel.org \
--cc=vyasevic@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).