All of lore.kernel.org
 help / color / mirror / Atom feed
From: Valdis.Kletnieks@vt.edu (Valdis.Kletnieks at vt.edu)
To: kernelnewbies@lists.kernelnewbies.org
Subject: [PATCH] staging: Check for Null return of allocated skb in fw_download_code
Date: Wed, 13 Aug 2014 01:35:24 -0400	[thread overview]
Message-ID: <14218.1407908124@turing-police.cc.vt.edu> (raw)
In-Reply-To: Your message of "Tue, 12 Aug 2014 23:24:32 -0400." <1407900272-29402-1-git-send-email-xerofoify@gmail.com>

On Tue, 12 Aug 2014 23:24:32 -0400, Nicholas Krause said:
> This patch checks if we are getting a Null allocated skb in the while/do
> loop of this function.
>  		skb  = dev_alloc_skb(frag_length + 4);
> +		if (skb == NULL) {
> +			rt_status =  false;
> +			break;
> +		}

Nick, it's *STILL* wrong.  And although I admit I blew it on the refcount
issue, that doesn't change the fact that you're still leaking memory here.

Work this through.  Hand simulate it.  Pretend that 3 fragments are
needed, and that the first two succeed but the third one fails.

Who frees the first two fragments before you return?

For bonus points - explain under what conditions this bug can *possibly*
be triggered on an actual system.  Consider in your reply both (a) when this
code is called and (b) what the system state *should* be at that point, and
what it has to be for this bug to trigger.  Given your answer to (a) and (b),
extrapolate to what the next few hundredths of a second likely hold for
this system even after we've fixed the bug you're mis-fixing here.

Once you've done that, you'll hopefully understand why you're trying to fix
a bug from 2009.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140813/5b0c1af4/attachment.bin 

  parent reply	other threads:[~2014-08-13  5:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13  3:24 [PATCH] staging: Check for Null return of allocated skb in fw_download_code Nicholas Krause
2014-08-13  3:31 ` Nick Krause
2014-08-13  5:35 ` Valdis.Kletnieks at vt.edu [this message]
2014-08-13  5:53   ` Manish Katiyar
2014-08-13 13:56     ` Valdis.Kletnieks at vt.edu
2014-08-13 14:50       ` Max Filippov
2014-08-13 16:02         ` Valdis.Kletnieks at vt.edu
2014-08-13 16:55           ` Nick Krause
2014-08-13 18:03             ` Nick Krause
2014-08-13 18:09               ` Philipp Muhoray
2014-08-13 18:11               ` Max Filippov
2014-08-13 18:25                 ` Jerry Snitselaar
2014-08-13 18:27                   ` Nick Krause
2014-08-13 18:58                     ` Nick Krause
2014-08-13 18:20               ` Jeff Haran
2014-08-13 19:17               ` Valdis.Kletnieks at vt.edu
2014-08-13 19:24                 ` Nick Krause
2014-08-13 19:52                   ` Nick Krause
2014-08-13 19:06             ` Valdis.Kletnieks at vt.edu
  -- strict thread matches above, loose matches on Subject: below --
2014-08-13  3:12 Nicholas Krause
2014-08-13  3:14 ` Nick Krause

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=14218.1407908124@turing-police.cc.vt.edu \
    --to=valdis.kletnieks@vt.edu \
    --cc=kernelnewbies@lists.kernelnewbies.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.