public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Diego Calleja <diegocg@gmail.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] Fix possible pointer dereference
Date: Tue, 6 Oct 2009 22:15:22 +0200	[thread overview]
Message-ID: <200910062215.22562.diegocg@gmail.com> (raw)

We should always check btrfs_alloc_path(). Some places BUG(),
others return -ENOMEM, btrfs_insert_dir_item() seems like it can return
safely.

Signed-off-by: Diego Calleja <diegocg@gmail.com>

--- linux/fs/btrfs/dir-item.c.BAK	2009-10-06 19:00:48.887361896 +0200
+++ linux/fs/btrfs/dir-item.c	2009-10-06 19:01:00.329132291 +0200
@@ -147,6 +147,9 @@ int btrfs_insert_dir_item(struct btrfs_t
 	key.offset = btrfs_name_hash(name, name_len);
 
 	path = btrfs_alloc_path();
+	if (!path)
+		return -ENOMEM;
+
 	path->leave_spinning = 1;
 
 	data_size = sizeof(*dir_item) + name_len;

             reply	other threads:[~2009-10-06 20:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-06 20:15 Diego Calleja [this message]
2009-10-07  0:03 ` [PATCH] Fix possible pointer dereference Andi Kleen

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=200910062215.22562.diegocg@gmail.com \
    --to=diegocg@gmail.com \
    --cc=linux-btrfs@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox