All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesper Juhl <jesper.juhl@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Michael Hipp <Michael.Hipp@student.uni-tuebingen.de>,
	Karsten Keil <kkeil@suse.de>,
	Kai Germaschewski <kai.germaschewski@gmx.de>,
	isdn4linux@listserv.isdn4linux.de,
	Jesper Juhl <jesper.juhl@gmail.com>
Subject: [PATCH] ISDN: Avoid a potential NULL ptr deref in ippp
Date: Mon, 30 Oct 2006 21:17:24 +0100	[thread overview]
Message-ID: <200610302117.24760.jesper.juhl@gmail.com> (raw)


There's a potential problem in isdn_ppp.c::isdn_ppp_decompress().
dev_alloc_skb() may fail and return NULL. If it does we will be passing a
NULL skb_out to ipc->decompress() and may also end up
dereferencing a NULL pointer at 
    *proto = isdn_ppp_strip_proto(skb_out);
Correct this by testing 'skb_out' against NULL early and bail out.


Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---

 drivers/isdn/i4l/isdn_ppp.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c
index 119412d..5a97ce6 100644
--- a/drivers/isdn/i4l/isdn_ppp.c
+++ b/drivers/isdn/i4l/isdn_ppp.c
@@ -2536,6 +2536,11 @@ static struct sk_buff *isdn_ppp_decompre
   		rsparm.maxdlen = IPPP_RESET_MAXDATABYTES;
   
   		skb_out = dev_alloc_skb(is->mru + PPP_HDRLEN);
+  		if (!skb_out) {
+  			kfree_skb(skb);
+  			printk(KERN_ERR "ippp: decomp memory allocation failure\n");
+			return NULL;
+  		}  		
 		len = ipc->decompress(stat, skb, skb_out, &rsparm);
 		kfree_skb(skb);
 		if (len <= 0) {

             reply	other threads:[~2006-10-30 20:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-30 20:17 Jesper Juhl [this message]
2006-10-30 22:19 ` [PATCH] net s2io: return on NULL dev_alloc_skb() David Rientjes
2006-11-01  1:21   ` Jeff Garzik
2006-10-30 22:19 ` [PATCH] ISDN: Avoid a potential NULL ptr deref in ippp David Rientjes
2006-10-31  1:01   ` [PATCH] drivers cris: return on NULL dev_alloc_skb() David Rientjes
2006-11-21 13:37 ` [PATCH] ISDN: Avoid a potential NULL ptr deref in ippp Jesper Juhl
2006-11-21 20:20   ` David Rientjes
2006-11-21 22:21     ` Jesper Juhl
2006-11-21 22:49       ` David Rientjes
2006-11-21 22:53         ` Jesper Juhl

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=200610302117.24760.jesper.juhl@gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=Michael.Hipp@student.uni-tuebingen.de \
    --cc=isdn4linux@listserv.isdn4linux.de \
    --cc=kai.germaschewski@gmx.de \
    --cc=kkeil@suse.de \
    --cc=linux-kernel@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.