mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jesper Juhl" <jesper.juhl@gmail.com>
To: "David Rientjes" <rientjes@cs.washington.edu>
Cc: linux-kernel@vger.kernel.org,
	"Michael Hipp" <Michael.Hipp@student.uni-tuebingen.de>,
	"Karsten Keil" <kkeil@suse.de>,
	"Kai Germaschewski" <kai.germaschewski@gmx.de>,
	isdn4linux@listserv.isdn4linux.de, starvik@axis.com,
	dev-etrax@axis.com
Subject: Re: [PATCH] ISDN: Avoid a potential NULL ptr deref in ippp
Date: Tue, 21 Nov 2006 23:53:45 +0100	[thread overview]
Message-ID: <9a8748490611211453m33828363y143cdb8758440f00@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64N.0611211438340.3549@attu4.cs.washington.edu>

On 21/11/06, David Rientjes <rientjes@cs.washington.edu> wrote:
> On Tue, 21 Nov 2006, Jesper Juhl wrote:
>
> > Ok, I see your point. There may not be an actual bug here, but
> > couldn't it still be considered an improvement, given that with my
> > patch we'll  a) print a warning that we ran into a memory shortage
> > problem, and  b) we save a call to ipc->decompress() and some switch
> > logic in the failing case.   ???
> >
>
> No, because there is duplication of code.  This error condition is already
> addressed:
>
>         skb_out = dev_alloc_skb(is->mru + PPP_HDRLEN);
>         len = ipc->decompress(stat, skb, skb_out, &rsparm);
>         kfree_skb(skb);
>         if (len <= 0) {
>                 switch (len) {
>                 case DECOMP_ERROR:
>                         ...
>                         break;
>                 case DECOMP_FATALERROR:
>                         ...
>                         break;
>                 }
>                 kfree_skb(skb_out);
>                 return NULL;
>         }
>
> Since neither DECOMP_ERROR or DECOMP_FATALERROR represent a NULL return
> from ipc->decompress(), the switch clause is a no-op and skb_out is freed
> and NULL is returned.
>
> The only thing your patch addresses is moving this before the
> ipc->decompress() call and _duplicating_ both the skb free and the return
> code, as well as adding a warning.  The warning is unnecessary because OOM
> killer will be called soon anyway if this condition is ever reached so the
> fact that it was this allocation that could not be satisfied doesn't
> matter.  Likewise, we need the return code from ipc->decompress() to do
> the other error checking involved.
>

You are right. I concede your point.

-- 
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

      reply	other threads:[~2006-11-21 22:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-30 20:17 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 message]

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=9a8748490611211453m33828363y143cdb8758440f00@mail.gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=Michael.Hipp@student.uni-tuebingen.de \
    --cc=dev-etrax@axis.com \
    --cc=isdn4linux@listserv.isdn4linux.de \
    --cc=kai.germaschewski@gmx.de \
    --cc=kkeil@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@cs.washington.edu \
    --cc=starvik@axis.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®