diff mbox

lightnvm: pblk-gc: fix an error pointer dereference in init

Message ID 20170413193241.GA591@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter April 13, 2017, 7:32 p.m. UTC
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>

Comments

Matias Bjørling April 13, 2017, 7:35 p.m. UTC | #1
On 04/13/2017 09:32 PM, Dan Carpenter wrote:
> 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>
>
> diff --git a/drivers/lightnvm/pblk-gc.c b/drivers/lightnvm/pblk-gc.c
> index 9b147cfd8a41..f173fd4ea947 100644
> --- a/drivers/lightnvm/pblk-gc.c
> +++ b/drivers/lightnvm/pblk-gc.c
> @@ -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;
>  }
>

Thanks Dan. I've applied it for 4.12.
diff mbox

Patch

diff --git a/drivers/lightnvm/pblk-gc.c b/drivers/lightnvm/pblk-gc.c
index 9b147cfd8a41..f173fd4ea947 100644
--- a/drivers/lightnvm/pblk-gc.c
+++ b/drivers/lightnvm/pblk-gc.c
@@ -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;
 }