Skip to content

Commit

Permalink
Btrfs: async-thread: fix possible memory leak
Browse files Browse the repository at this point in the history
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@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Li Zefan authored and Chris Mason committed Sep 25, 2008
1 parent ab78c84 commit 3bf1041
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/btrfs/async-thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 3bf1041

Please sign in to comment.