提交 3bf10418 编写于 作者: L Li Zefan 提交者: 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: NLi Zefan <lizf@cn.fujitsu.com>
Signed-off-by: NChris Mason <chris.mason@oracle.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册