Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Filipe David Borba Manana <fdmanana@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Filipe David Borba Manana <fdmanana@gmail.com>, Chris Mason <clm@fb.com>
Subject: [PATCH] Btrfs: fix use-after-free when cloning a trailing file hole
Date: Sun, 29 Jun 2014 20:43:24 +0100	[thread overview]
Message-ID: <1404071004-20724-1-git-send-email-fdmanana@gmail.com> (raw)

The transaction handle was being used after being freed.

Cc: Chris Mason <clm@fb.com>
Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
---
 fs/btrfs/ioctl.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 02dc64b..2562dc7 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -3565,12 +3565,10 @@ process_slot:
 			btrfs_end_transaction(trans, root);
 			goto out;
 		}
-		ret = clone_finish_inode_update(trans, inode, destoff + len,
-						destoff, olen);
-		if (ret)
-			goto out;
 		clone_update_extent_map(inode, trans, path, NULL, last_dest_end,
 					destoff + len - last_dest_end);
+		ret = clone_finish_inode_update(trans, inode, destoff + len,
+						destoff, olen);
 	}
 
 out:
-- 
1.9.1


             reply	other threads:[~2014-06-29 18:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-29 19:43 Filipe David Borba Manana [this message]
2014-06-29 19:23 ` [PATCH] Btrfs: fix use-after-free when cloning a trailing file hole Chris Mason
2014-06-29 19:28   ` Filipe David Manana
2014-06-29 20:45 ` [PATCH v2] " Filipe David Borba Manana

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=1404071004-20724-1-git-send-email-fdmanana@gmail.com \
    --to=fdmanana@gmail.com \
    --cc=clm@fb.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