From: Andi Kleen <andi@firstfloor.org>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: chris.mason@oracle.com, Andrew Morton <akpm@linux-foundation.org>,
linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: potential NULL dereferences
Date: Sun, 06 Sep 2009 09:36:51 +0200 [thread overview]
Message-ID: <874org5xt8.fsf@basil.nowhere.org> (raw)
In-Reply-To: <4A9BCD64.8010308@gmail.com> (Roel Kluin's message of "Mon, 31 Aug 2009 15:17:24 +0200")
Roel Kluin <roel.kluin@gmail.com> writes:
> Allocations may fail, prevent NULL dereferences.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> In several sections of fs/btrfs code a kmalloc() occurs without a
> check whether it succeeded. this potentially leads to dereferences
> of a NULL pointer. Are there reasons why we do not check the
> allocations? Did I choose an incorrect way to err out? please
> review.
Yes, the erroring out needs much more work because often
the callers don't handle errors and it can need quite a lot of surgery
Until that is done it's actually better to oops than to silently
leak resources. BUG_ON(name == NULL) is also fairly useless
because it oopses anyways in a obvious way.
I had some patches to add more error handling for ENOMEM, but it's
fairly complicated. Should probably resurrect my old patchkit. It
still wasn't fully complete.
-Andi
--
ak@linux.intel.com -- Speaking for myself only.
prev parent reply other threads:[~2009-09-06 7:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-31 13:17 [PATCH] Btrfs: potential NULL dereferences Roel Kluin
2009-09-06 7:36 ` Andi Kleen [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=874org5xt8.fsf@basil.nowhere.org \
--to=andi@firstfloor.org \
--cc=akpm@linux-foundation.org \
--cc=chris.mason@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=roel.kluin@gmail.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 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.