bcache: destroy dc->writeback_write_wq if failed to create dc->writeback_thread
authorColy Li <colyli@suse.de>
Fri, 28 Jun 2019 11:59:44 +0000 (19:59 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2019 07:14:21 +0000 (09:14 +0200)
commitf11ba9df8eed1abce9c5d7306711e32b657694eb
tree85ea31588d9f7c625a2318cccc5f31d4d19caa84
parent2ab14861d2eb33b8471c73a8089d1a64e846d289
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>
drivers/md/bcache/writeback.c