[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1395987680-8151-1-git-send-email-makita.toshiaki@lab.ntt.co.jp>
Date: Fri, 28 Mar 2014 15:21:19 +0900
From: Toshiaki Makita <makita.toshiaki@....ntt.co.jp>
To: "David S . Miller" <davem@...emloft.net>,
Stephen Hemminger <stephen@...workplumber.org>
Cc: Toshiaki Makita <makita.toshiaki@....ntt.co.jp>,
Vlad Yasevich <vyasevic@...hat.com>, netdev@...r.kernel.org,
bridge@...ts.linux-foundation.org
Subject: [PATCH net] bridge: Fix memory leak in br_dev_xmit
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;
}
static int br_dev_init(struct net_device *dev)
--
1.8.1.2
--
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