mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 14:42:37 +02:00
bcache: destroy dc->writeback_write_wq if failed to create dc->writeback_thread
commitf54d801ddaupstream. Commit9baf30972b("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:9baf30972b("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>
This commit is contained in:
parent
2ab14861d2
commit
f11ba9df8e
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user