Patchwork bridge: Fix OOM crash in deliver_clone

login
register
mail settings
Submitter Herbert Xu
Date June 16, 2010, 4:02 a.m.
Message ID <20100616040219.GA18000@gondor.apana.org.au>
Download mbox | patch
Permalink /patch/55838/
State Accepted
Delegated to: David Miller
Headers show

Comments

Herbert Xu - June 16, 2010, 4:02 a.m.
Hi Dave:

bridge: Fix OOM crash in deliver_clone

The bridge multicast patches introduced an OOM crash in the forward
path, when deliver_clone fails to clone the skb.

This patch fixes it.

Reported-by: Mark Wagner <mwagner@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


Thanks,
David Miller - June 16, 2010, 4:43 a.m.
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Wed, 16 Jun 2010 14:02:19 +1000

> Hi Dave:
> 
> bridge: Fix OOM crash in deliver_clone
> 
> The bridge multicast patches introduced an OOM crash in the forward
> path, when deliver_clone fails to clone the skb.
> 
> This patch fixes it.
> 
> Reported-by: Mark Wagner <mwagner@redhat.com>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index 6e97711..cbfe87f 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -130,10 +130,10 @@  static int deliver_clone(const struct net_bridge_port *prev,
 			 void (*__packet_hook)(const struct net_bridge_port *p,
 					       struct sk_buff *skb))
 {
+	struct net_device *dev = BR_INPUT_SKB_CB(skb)->brdev;
+
 	skb = skb_clone(skb, GFP_ATOMIC);
 	if (!skb) {
-		struct net_device *dev = BR_INPUT_SKB_CB(skb)->brdev;
-
 		dev->stats.tx_dropped++;
 		return -ENOMEM;
 	}