Btrfs: fix use after free in btrfs_start_workers fail path

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git-commits-head@...>
Date: Friday, July 3, 2009 - 5:59 pm

Gitweb:     http://git.kernel.org/linus/9b627e9bf49ebfeb060dfae0435bdba06cf27cb8
Commit:     9b627e9bf49ebfeb060dfae0435bdba06cf27cb8
Parent:     9427216476d4fa75103f39d4b228c47d56ba20da
Author:     Jiri Slaby <jirislaby@gmail.com>
AuthorDate: Thu Jul 2 13:50:58 2009 -0400
Committer:  Chris Mason <chris.mason@oracle.com>
CommitDate: Thu Jul 2 13:50:58 2009 -0400

    Btrfs: fix use after free in btrfs_start_workers fail path
    
    worker memory is already freed on one fail path in btrfs_start_workers,
    but is still dereferenced. Switch the dereference and kfree.
    
    Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
    Signed-off-by: Chris Mason <chris.mason@oracle.com>
---
 fs/btrfs/async-thread.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c
index 7f88628..6e4f6c5 100644
--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -299,8 +299,8 @@ int btrfs_start_workers(struct btrfs_workers *workers, int num_workers)
 					   "btrfs-%s-%d", workers->name,
 					   workers->num_workers + i);
 		if (IS_ERR(worker->task)) {
-			kfree(worker);
 			ret = PTR_ERR(worker->task);
+			kfree(worker);
 			goto fail;
 		}
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Btrfs: fix use after free in btrfs_start_workers fail path, Linux Kernel Mailing List..., (Fri Jul 3, 5:59 pm)