Skip to contentSkip to conversation

async-thread: fix possible memory leak

PATCH In review Li Zefan 2 participants 2 messages Jul 25, 2008 Btrfs file system

lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/1 async-thread: fix possible memory leak

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

---
 async-thread.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
async-thread.c +1 -0
index 8d4cc46..5fe6a0d 100644
@@ -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;
 		}
Signature · 1 line
1.5.4.rc3
#1 lore raw
Quoted 3 lines · Li Zefan

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

Thanks, I've queued this one up for inclusion.

-chris