From: Greg Kroah-Hartman Date: Thu, 23 May 2019 12:35:22 +0000 (+0200) Subject: 4.14-stable patches X-Git-Tag: v5.1.5~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f429077988a8203222f1ac562ce3b454101a6b30;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: dm-cache-metadata-fix-loading-discard-bitset.patch dm-delay-fix-a-crash-when-invalid-device-is-specified.patch dm-zoned-fix-zone-report-handling.patch --- diff --git a/queue-4.14/dm-cache-metadata-fix-loading-discard-bitset.patch b/queue-4.14/dm-cache-metadata-fix-loading-discard-bitset.patch new file mode 100644 index 00000000000..9311c26c16c --- /dev/null +++ b/queue-4.14/dm-cache-metadata-fix-loading-discard-bitset.patch @@ -0,0 +1,47 @@ +From e28adc3bf34e434b30e8d063df4823ba0f3e0529 Mon Sep 17 00:00:00 2001 +From: Nikos Tsironis +Date: Wed, 17 Apr 2019 17:19:18 +0300 +Subject: dm cache metadata: Fix loading discard bitset + +From: Nikos Tsironis + +commit e28adc3bf34e434b30e8d063df4823ba0f3e0529 upstream. + +Add missing dm_bitset_cursor_next() to properly advance the bitset +cursor. + +Otherwise, the discarded state of all blocks is set according to the +discarded state of the first block. + +Fixes: ae4a46a1f6 ("dm cache metadata: use bitset cursor api to load discard bitset") +Cc: stable@vger.kernel.org +Signed-off-by: Nikos Tsironis +Signed-off-by: Mike Snitzer +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/md/dm-cache-metadata.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +--- a/drivers/md/dm-cache-metadata.c ++++ b/drivers/md/dm-cache-metadata.c +@@ -1166,11 +1166,18 @@ static int __load_discards(struct dm_cac + if (r) + return r; + +- for (b = 0; b < from_dblock(cmd->discard_nr_blocks); b++) { ++ for (b = 0; ; b++) { + r = fn(context, cmd->discard_block_size, to_dblock(b), + dm_bitset_cursor_get_value(&c)); + if (r) + break; ++ ++ if (b >= (from_dblock(cmd->discard_nr_blocks) - 1)) ++ break; ++ ++ r = dm_bitset_cursor_next(&c); ++ if (r) ++ break; + } + + dm_bitset_cursor_end(&c); diff --git a/queue-4.14/dm-delay-fix-a-crash-when-invalid-device-is-specified.patch b/queue-4.14/dm-delay-fix-a-crash-when-invalid-device-is-specified.patch new file mode 100644 index 00000000000..8d94d140013 --- /dev/null +++ b/queue-4.14/dm-delay-fix-a-crash-when-invalid-device-is-specified.patch @@ -0,0 +1,34 @@ +From 81bc6d150ace6250503b825d9d0c10f7bbd24095 Mon Sep 17 00:00:00 2001 +From: Mikulas Patocka +Date: Thu, 25 Apr 2019 12:07:54 -0400 +Subject: dm delay: fix a crash when invalid device is specified + +From: Mikulas Patocka + +commit 81bc6d150ace6250503b825d9d0c10f7bbd24095 upstream. + +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 +Cc: stable@vger.kernel.org +Signed-off-by: Mike Snitzer +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/md/dm-delay.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/md/dm-delay.c ++++ b/drivers/md/dm-delay.c +@@ -222,7 +222,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); + + dm_put_device(ti, dc->dev_read); + diff --git a/queue-4.14/dm-zoned-fix-zone-report-handling.patch b/queue-4.14/dm-zoned-fix-zone-report-handling.patch new file mode 100644 index 00000000000..d623826669e --- /dev/null +++ b/queue-4.14/dm-zoned-fix-zone-report-handling.patch @@ -0,0 +1,57 @@ +From 7aedf75ff740a98f3683439449cd91c8662d03b2 Mon Sep 17 00:00:00 2001 +From: Damien Le Moal +Date: Thu, 18 Apr 2019 18:03:07 +0900 +Subject: dm zoned: Fix zone report handling + +From: Damien Le Moal + +commit 7aedf75ff740a98f3683439449cd91c8662d03b2 upstream. + +The function blkdev_report_zones() returns success even if no zone +information is reported (empty report). Empty zone reports can only +happen if the report start sector passed exceeds the device capacity. +The conditions for this to happen are either a bug in the caller code, +or, a change in the device that forced the low level driver to change +the device capacity to a value that is lower than the report start +sector. This situation includes a failed disk revalidation resulting in +the disk capacity being changed to 0. + +If this change happens while dm-zoned is in its initialization phase +executing dmz_init_zones(), this function may enter an infinite loop +and hang the system. To avoid this, add a check to disallow empty zone +reports and bail out early. Also fix the function dmz_update_zone() to +make sure that the report for the requested zone was correctly obtained. + +Fixes: 3b1a94c88b79 ("dm zoned: drive-managed zoned block device target") +Cc: stable@vger.kernel.org +Signed-off-by: Damien Le Moal +Reviewed-by: Shaun Tancheff +Signed-off-by: Damien Le Moal +Signed-off-by: Mike Snitzer +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/md/dm-zoned-metadata.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/md/dm-zoned-metadata.c ++++ b/drivers/md/dm-zoned-metadata.c +@@ -1169,6 +1169,9 @@ static int dmz_init_zones(struct dmz_met + goto out; + } + ++ if (!nr_blkz) ++ break; ++ + /* Process report */ + for (i = 0; i < nr_blkz; i++) { + ret = dmz_init_zone(zmd, zone, &blkz[i]); +@@ -1204,6 +1207,8 @@ static int dmz_update_zone(struct dmz_me + /* Get zone information from disk */ + ret = blkdev_report_zones(zmd->dev->bdev, dmz_start_sect(zmd, zone), + &blkz, &nr_blkz, GFP_NOIO); ++ if (!nr_blkz) ++ ret = -EIO; + if (ret) { + dmz_dev_err(zmd->dev, "Get zone %u report failed", + dmz_id(zmd, zone)); diff --git a/queue-4.14/series b/queue-4.14/series index ef8d0bf3bab..356fdd1befd 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -50,3 +50,6 @@ pci-mark-amd-stoney-radeon-r7-gpu-ats-as-broken.patch pci-mark-atheros-ar9462-to-avoid-bus-reset.patch pci-factor-out-pcie_retrain_link-function.patch pci-work-around-pericom-pcie-to-pci-bridge-retrain-link-erratum.patch +dm-cache-metadata-fix-loading-discard-bitset.patch +dm-zoned-fix-zone-report-handling.patch +dm-delay-fix-a-crash-when-invalid-device-is-specified.patch