Commit 3bf10418 authored by Li Zefan's avatar Li Zefan Committed by Chris Mason

Btrfs: 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.
Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent ab78c84d
...@@ -187,6 +187,7 @@ int btrfs_start_workers(struct btrfs_workers *workers, int num_workers) ...@@ -187,6 +187,7 @@ int btrfs_start_workers(struct btrfs_workers *workers, int num_workers)
worker->task = kthread_run(worker_loop, worker, "btrfs"); worker->task = kthread_run(worker_loop, worker, "btrfs");
worker->workers = workers; worker->workers = workers;
if (IS_ERR(worker->task)) { if (IS_ERR(worker->task)) {
kfree(worker);
ret = PTR_ERR(worker->task); ret = PTR_ERR(worker->task);
goto fail; goto fail;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment