Skip to content

Commit

Permalink
[PATCH] ISDN: Avoid a potential NULL ptr deref in ippp
Browse files Browse the repository at this point in the history
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>
Cc: Karsten Keil <kkeil@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Jesper Juhl authored and Linus Torvalds committed Dec 8, 2006
1 parent ba6d14a commit f6e2cdc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/isdn/i4l/isdn_ppp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2536,6 +2536,11 @@ static struct sk_buff *isdn_ppp_decompress(struct sk_buff *skb,struct ippp_struc
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) {
Expand Down

0 comments on commit f6e2cdc

Please sign in to comment.