[dm-devel] [PATCH] dm-delay: fix a crash when invalid device is specified

Mikulas Patocka mpatocka at redhat.com
Thu Apr 25 16:07:54 UTC 2019


When the target line contains 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 at redhat.com>
Cc: stable at vger.kernel.org

---
 drivers/md/dm-delay.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6/drivers/md/dm-delay.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-delay.c	2019-01-12 16:48:32.000000000 +0100
+++ linux-2.6/drivers/md/dm-delay.c	2019-04-25 18:01:08.000000000 +0200
@@ -121,7 +121,8 @@ static void delay_dtr(struct dm_target *
 {
 	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);




More information about the dm-devel mailing list