summaryrefslogtreecommitdiffstats
path: root/drivers/md/bcache/writeback.c
diff options
context:
space:
mode:
authorColy Li2019-06-28 13:59:44 +0200
committerGreg Kroah-Hartman2019-07-26 09:14:21 +0200
commitf11ba9df8eed1abce9c5d7306711e32b657694eb (patch)
tree85ea31588d9f7c625a2318cccc5f31d4d19caa84 /drivers/md/bcache/writeback.c
parentbcache: fix mistaken sysfs entry for io_error counter (diff)
downloadkernel-qcow2-linux-f11ba9df8eed1abce9c5d7306711e32b657694eb.tar.gz
kernel-qcow2-linux-f11ba9df8eed1abce9c5d7306711e32b657694eb.tar.xz
kernel-qcow2-linux-f11ba9df8eed1abce9c5d7306711e32b657694eb.zip
bcache: destroy dc->writeback_write_wq if failed to create dc->writeback_thread
commit f54d801dda14942dbefa00541d10603015b7859c upstream. Commit 9baf30972b55 ("bcache: fix for gc and write-back race") added a new work queue dc->writeback_write_wq, but forgot to destroy it in the error condition when creating dc->writeback_thread failed. This patch destroys dc->writeback_write_wq if kthread_create() returns error pointer to dc->writeback_thread, then a memory leak is avoided. Fixes: 9baf30972b55 ("bcache: fix for gc and write-back race") Signed-off-by: Coly Li <colyli@suse.de> Cc: stable@vger.kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md/bcache/writeback.c')
-rw-r--r--drivers/md/bcache/writeback.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
index 6e72bb6c00f2..ba5395fd386d 100644
--- a/drivers/md/bcache/writeback.c
+++ b/drivers/md/bcache/writeback.c
@@ -807,6 +807,7 @@ int bch_cached_dev_writeback_start(struct cached_dev *dc)
"bcache_writeback");
if (IS_ERR(dc->writeback_thread)) {
cached_dev_put(dc);
+ destroy_workqueue(dc->writeback_write_wq);
return PTR_ERR(dc->writeback_thread);
}