public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: TARUISI Hiroaki <taruishi.hiroak@jp.fujitsu.com>
To: josef@redhat.com
Cc: linux-btrfs@vger.kernel.org, chris.mason@oracle.com
Subject: Re: [PATCH] Btrfs: fix various things with the listing ioctl
Date: Tue, 15 Dec 2009 11:48:41 +0900	[thread overview]
Message-ID: <4B26F909.2040101@jp.fujitsu.com> (raw)
In-Reply-To: <20091214191722.GB2165@localhost.localdomain>

(2009/12/15 4:17), Josef Bacik wrote:
> With slab poisoning on you could panic the box simply by running btrfsctl -l
> multiple times in a row on the same volume.  This patch fixes up the ioctl stuff
> to be a bit cleaner, makes sure we always call btrfs_free_path() instead of
> kfree(path) and make sure we do not kfree() our work names before we are done
> using them.  There were several memory leaks and use after free problems
> previously, they appear to be gone now, and as an added bonus doing btrfsctl -l
> no longer panic's the box.  Thanks,
> 
> Signed-off-by: Josef Bacik <josef@redhat.com>
> ---

Thank you for your patch. I've tested this patch and
I found it works. And I'd like to add one line to
prevent from another tiny leak.

Signed-off-by: TARUISI Hiroaki <taruishi.hiroak@jp.fujitsu.com>
---
 fs/btrfs/ioctl.c |    1 +
 1 file changed, 1 insertion(+)

Index: b/fs/btrfs/ioctl.c
===================================================================
--- a/fs/btrfs/ioctl.c	2009-12-15 11:31:18.000000000 +0900
+++ b/fs/btrfs/ioctl.c	2009-12-15 11:33:28.000000000 +0900
@@ -989,6 +989,7 @@ static noinline int btrfs_ioctl_snap_lis
 		if (rest < sizeof(struct btrfs_ioctl_subvol_items) +
 			name_len + strlen(work_path) + 1) {
 			svol->next_len = name_len + strlen(work_path);
+			kfree(name);
 			if (copy_to_user(arg, svol, sizeof(*svol))) {
 				ret = -EFAULT;
 				goto out;


      reply	other threads:[~2009-12-15  2:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-14 19:17 [PATCH] Btrfs: fix various things with the listing ioctl Josef Bacik
2009-12-15  2:48 ` TARUISI Hiroaki [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=4B26F909.2040101@jp.fujitsu.com \
    --to=taruishi.hiroak@jp.fujitsu.com \
    --cc=chris.mason@oracle.com \
    --cc=josef@redhat.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