lightnvm: pblk-gc: fix an error pointer dereference in init
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 15 Apr 2017 18:55:51 +0000 (20:55 +0200)
committerJens Axboe <axboe@fb.com>
Sun, 16 Apr 2017 16:06:34 +0000 (10:06 -0600)
These labels are reversed so we could end up dereferencing an error
pointer or leaking.

Fixes: 7f347ba6bb3a ("lightnvm: physical block device (pblk) target")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Matias Bjørling <matias@cnexlabs.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/lightnvm/pblk-gc.c

index 9b147cfd8a4132192ae41e82311b1f7344816693..f173fd4ea94770b2e276decea0eda9176fde5c7f 100644 (file)
@@ -527,10 +527,10 @@ int pblk_gc_init(struct pblk *pblk)
 
        return 0;
 
-fail_free_main_kthread:
-       kthread_stop(gc->gc_ts);
 fail_free_writer_kthread:
        kthread_stop(gc->gc_writer_ts);
+fail_free_main_kthread:
+       kthread_stop(gc->gc_ts);
 
        return ret;
 }