All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vasily Averin <vvs@parallels.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, bridge@lists.linux-foundation.org,
	devel@openvz.org, Herbert Xu <herbert@gondor.hengli.com.au>
Subject: [Bridge] [PATCH v2] bridge: Reset IPCB on forward non-local packets in br_handle_frame_finish()
Date: Wed, 02 Nov 2011 19:37:01 -0000	[thread overview]
Message-ID: <4EB19BF9.8060801@parallels.com> (raw)

v2: extra bracket was removed

if dst is not local br_handle_frame_finish() does not clone original skb and
forgets to reset IPCB before return to IP stack. it can lead to stack corruption
in icmp_send()

Signed-off-by: Vasily Averin <vvs@sw.ru>
---
 net/bridge/br_input.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index f06ee39..6be8d00 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -93,10 +93,11 @@ int br_handle_frame_finish(struct sk_buff *skb)
 			skb2 = skb;

 		br->dev->stats.multicast++;
-	} else if ((dst = __br_fdb_get(br, dest)) && dst->is_local) {
+	} else if ((dst = __br_fdb_get(br, dest)) != NULL) {
 		skb2 = skb;
 		/* Do not forward the packet since it's local. */
-		skb = NULL;
+		if (dst->is_local)
+			skb = NULL;
 	}

 	if (skb) {
-- 1.7.5.4

WARNING: multiple messages have this Message-ID (diff)
From: Vasily Averin <vvs@parallels.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: bridge@lists.linux-foundation.org, netdev@vger.kernel.org,
	Herbert Xu <herbert@gondor.hengli.com.au>,
	devel@openvz.org
Subject: [PATCH v2] bridge: Reset IPCB on forward non-local packets in br_handle_frame_finish()
Date: Wed, 02 Nov 2011 23:37:29 +0400	[thread overview]
Message-ID: <4EB19BF9.8060801@parallels.com> (raw)

v2: extra bracket was removed

if dst is not local br_handle_frame_finish() does not clone original skb and
forgets to reset IPCB before return to IP stack. it can lead to stack corruption
in icmp_send()

Signed-off-by: Vasily Averin <vvs@sw.ru>
---
 net/bridge/br_input.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index f06ee39..6be8d00 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -93,10 +93,11 @@ int br_handle_frame_finish(struct sk_buff *skb)
 			skb2 = skb;

 		br->dev->stats.multicast++;
-	} else if ((dst = __br_fdb_get(br, dest)) && dst->is_local) {
+	} else if ((dst = __br_fdb_get(br, dest)) != NULL) {
 		skb2 = skb;
 		/* Do not forward the packet since it's local. */
-		skb = NULL;
+		if (dst->is_local)
+			skb = NULL;
 	}

 	if (skb) {
-- 1.7.5.4

             reply	other threads:[~2011-11-02 19:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-02 19:37 Vasily Averin [this message]
2011-11-02 19:37 ` [PATCH v2] bridge: Reset IPCB on forward non-local packets in br_handle_frame_finish() Vasily Averin

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=4EB19BF9.8060801@parallels.com \
    --to=vvs@parallels.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=devel@openvz.org \
    --cc=herbert@gondor.hengli.com.au \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.