public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Andrej Ota <andrej@ota•si>
To: Jarek Poplawski <jarkao2@gmail•com>
Cc: "Paweł Staszewski" <pstaszewski@itcare•pl>,
	"Andrew Morton" <akpm@linux-foundation•org>,
	netdev@vger•kernel.org, "Paul Mackerras" <paulus@samba•org>,
	bugzilla-daemon@bugzilla•kernel.org,
	bugme-daemon@bugzilla•kernel.org, pstaszewski@artcom•pl,
	"Eric Dumazet" <eric.dumazet@gmail•com>,
	"David Miller" <davem@davemloft•net>
Subject: [PATCH] [Bug 24472] Kernel panic - not syncing: Fatal Exception
Date: Fri, 10 Dec 2010 15:49:08 +0100	[thread overview]
Message-ID: <4D023DE4.8000400@ota.si> (raw)
In-Reply-To: <20101210091505.GA7868@ff.dom.local>

Move kfree_skb which was causing memory corruption to new location, while still keeping appropriate return value for function __pppoe_xmit. Prevents memory corruption and consequent kernel panic when PPPoE peer terminates the link.

Signed-off-by: Andrej Ota [andrej@ota•si]
Reported-by: Pawel Staszewski [pstaszewski@artcom•pl]
---
 drivers/net/pppoe.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index d72fb05..1a21dce 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -924,8 +924,10 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
 	/* Copy the data if there is no space for the header or if it's
 	 * read-only.
 	 */
-	if (skb_cow_head(skb, sizeof(*ph) + dev->hard_header_len))
+	if (skb_cow_head(skb, sizeof(*ph) + dev->hard_header_len)) {
+		kfree_skb(skb);
 		goto abort;
+	}

 	__skb_push(skb, sizeof(*ph));
 	skb_reset_network_header(skb);
@@ -947,7 +949,6 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
 	return 1;

 abort:
-	kfree_skb(skb);
 	return 0;
 }

---

Andrej Ota.

       reply	other threads:[~2010-12-10 14:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20101210091505.GA7868@ff.dom.local>
2010-12-10 14:49 ` Andrej Ota [this message]
2010-12-10 15:55   ` [PATCH] [Bug 24472] Kernel panic - not syncing: Fatal Exception Jarek Poplawski
     [not found]     ` <4D037236.4080903@ota.si>
2010-12-11 20:08       ` [PATCH] pppoe.c: Fix kernel panic caused by __pppoe_xmit Jarek Poplawski
2010-12-11 23:23         ` Andrej Ota
2010-12-12 23:06           ` David Miller
2010-12-12 21:02         ` Denys Fedoryshchenko

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=4D023DE4.8000400@ota.si \
    --to=andrej@ota$(echo .)si \
    --cc=akpm@linux-foundation$(echo .)org \
    --cc=bugme-daemon@bugzilla$(echo .)kernel.org \
    --cc=bugzilla-daemon@bugzilla$(echo .)kernel.org \
    --cc=davem@davemloft$(echo .)net \
    --cc=eric.dumazet@gmail$(echo .)com \
    --cc=jarkao2@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=paulus@samba$(echo .)org \
    --cc=pstaszewski@artcom$(echo .)pl \
    --cc=pstaszewski@itcare$(echo .)pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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