]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/dm-delay-fix-a-crash-when-invalid-device-is-specified.patch
Linux 5.0.19
[thirdparty/kernel/stable-queue.git] / queue-4.19 / dm-delay-fix-a-crash-when-invalid-device-is-specified.patch
1 From 81bc6d150ace6250503b825d9d0c10f7bbd24095 Mon Sep 17 00:00:00 2001
2 From: Mikulas Patocka <mpatocka@redhat.com>
3 Date: Thu, 25 Apr 2019 12:07:54 -0400
4 Subject: dm delay: fix a crash when invalid device is specified
5
6 From: Mikulas Patocka <mpatocka@redhat.com>
7
8 commit 81bc6d150ace6250503b825d9d0c10f7bbd24095 upstream.
9
10 When the target line contains an invalid device, delay_ctr() will call
11 delay_dtr() with NULL workqueue. Attempting to destroy the NULL
12 workqueue causes a crash.
13
14 Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
15 Cc: stable@vger.kernel.org
16 Signed-off-by: Mike Snitzer <snitzer@redhat.com>
17 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18
19 ---
20 drivers/md/dm-delay.c | 3 ++-
21 1 file changed, 2 insertions(+), 1 deletion(-)
22
23 --- a/drivers/md/dm-delay.c
24 +++ b/drivers/md/dm-delay.c
25 @@ -121,7 +121,8 @@ static void delay_dtr(struct dm_target *
26 {
27 struct delay_c *dc = ti->private;
28
29 - destroy_workqueue(dc->kdelayd_wq);
30 + if (dc->kdelayd_wq)
31 + destroy_workqueue(dc->kdelayd_wq);
32
33 if (dc->read.dev)
34 dm_put_device(ti, dc->read.dev);