dm delay: fix a crash when invalid device is specified
authorMikulas Patocka <mpatocka@redhat.com>
Thu, 25 Apr 2019 16:07:54 +0000 (12:07 -0400)
committerMike Snitzer <snitzer@redhat.com>
Fri, 26 Apr 2019 15:29:32 +0000 (11:29 -0400)
When the target line contains an invalid device, delay_ctr() will call
delay_dtr() with NULL workqueue.  Attempting to destroy the NULL
workqueue causes a crash.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-delay.c

index fddffe2..f496213 100644 (file)
@@ -121,7 +121,8 @@ static void delay_dtr(struct dm_target *ti)
 {
        struct delay_c *dc = ti->private;
 
-       destroy_workqueue(dc->kdelayd_wq);
+       if (dc->kdelayd_wq)
+               destroy_workqueue(dc->kdelayd_wq);
 
        if (dc->read.dev)
                dm_put_device(ti, dc->read.dev);