[PATCH] async-thread: fix possible memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When kthread_run() returns failure, this worker hasn't been
added to the list, so btrfs_stop_workers() won't free it.

Signed-off-by: Li Zefan <lizf@xxxxxxxxxxxxxx>
---
 async-thread.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/async-thread.c b/async-thread.c
index 8d4cc46..5fe6a0d 100644
--- a/async-thread.c
+++ b/async-thread.c
@@ -187,6 +187,7 @@ int btrfs_start_workers(struct btrfs_workers *workers, int num_workers)
 		worker->task = kthread_run(worker_loop, worker, "btrfs");
 		worker->workers = workers;
 		if (IS_ERR(worker->task)) {
+			kfree(worker);
 			ret = PTR_ERR(worker->task);
 			goto fail;
 		}
-- 
1.5.4.rc3
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux