public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ISDN: Avoid a potential NULL ptr deref in ippp
@ 2006-10-30 20:17 Jesper Juhl
  2006-10-30 22:19 ` [PATCH] net s2io: return on NULL dev_alloc_skb() David Rientjes
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Jesper Juhl @ 2006-10-30 20:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: Michael Hipp, Karsten Keil, Kai Germaschewski, isdn4linux,
	Jesper Juhl


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) {

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-11-21 22:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-30 20:17 [PATCH] ISDN: Avoid a potential NULL ptr deref in ippp Jesper Juhl
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox