Skip to content

Commit

Permalink
dm delay: fix a crash when invalid device is specified
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mikulas Patocka authored and Mike Snitzer committed Apr 26, 2019
1 parent 514cf4f commit 81bc6d1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/md/dm-delay.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 81bc6d1

Please sign in to comment.