public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Tinguely <tinguely@sgi.com>
To: xfs@oss.sgi.com
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Subject: [PATCH 1/2] xfs: fix double free on error when cleaning log items
Date: Fri, 06 Dec 2013 15:20:28 -0600	[thread overview]
Message-ID: <20131206212037.475868363@sgi.com> (raw)
In-Reply-To: 20131206212027.846346746@sgi.com

[-- Attachment #1: xfs-fix-double-free-on-error-when-cleanning-log_items.patch --]
[-- Type: text/plain, Size: 1260 bytes --]

Commit 2a84108 cleans the remaining pending log item entries
when log recovery fails. Unfortunately, the cleaning call was
not removed from the error path in xlog_recover_commit_trans,
This can result in a use after free and a second free of the
transaction structure when the cleaning is done in
xlog_recover_process_data.

Now the log item entry cleaning in xlog_recover_commit_trans
is only performed for the non-error case.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Tinguely <tinguely@sgi.com>
---
 fs/xfs/xfs_log_recover.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: b/fs/xfs/xfs_log_recover.c
===================================================================
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -3509,9 +3509,10 @@ out:
 	if (!list_empty(&done_list))
 		list_splice_init(&done_list, &trans->r_itemq);
 
-	xlog_recover_free_trans(trans);
-
 	error2 = xfs_buf_delwri_submit(&buffer_list);
+	/* caller will free transactions in the error path */
+	if (!error && !error2)
+		xlog_recover_free_trans(trans);
 	return error ? error : error2;
 }
 


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2013-12-06 21:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-06 21:20 [PATCH 0/2] misc log recovery patches Mark Tinguely
2013-12-06 21:20 ` Mark Tinguely [this message]
2013-12-09  0:29   ` [PATCH 1/2] xfs: fix double free on error when cleaning log items Dave Chinner
2013-12-06 21:20 ` [PATCH 2/2] xfs: free the efi AIL entry on log recovery failure Mark Tinguely
2013-12-08  0:52   ` [PATCH v3] " Mark Tinguely
2013-12-09  1:00     ` Dave Chinner
2013-12-11 11:31     ` Christoph Hellwig
2013-12-11 17:25       ` Mark Tinguely
2013-12-23 16:42       ` Mark Tinguely

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=20131206212037.475868363@sgi.com \
    --to=tinguely@sgi.com \
    --cc=dan.carpenter@oracle.com \
    --cc=xfs@oss.sgi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox