From: Greg Kroah-Hartman Date: Mon, 5 Aug 2019 05:40:06 +0000 (+0200) Subject: 4.14-stable patches X-Git-Tag: v4.4.188~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8c1f8d2871198805a1bb17172a81da79cf17c921;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: btrfs-fix-incremental-send-failure-after-deduplication.patch btrfs-fix-race-leading-to-fs-corruption-after-transaction-abort.patch drivers-perf-arm_pmu-fix-failure-path-in-pm-notifier.patch gpiolib-fix-incorrect-irq-requesting-of-an-active-low-lineevent.patch ib-hfi1-check-for-error-on-call-to-alloc_rsm_map_table.patch ib-hfi1-fix-spectre-v1-vulnerability.patch ib-mlx5-fix-rss-toeplitz-setup-to-be-aligned-with-the-hw-specification.patch ib-mlx5-fix-unreg_umr-to-ignore-the-mkey-state.patch ib-mlx5-move-mrs-to-a-kernel-pd-when-freeing-them-to-the-mr-cache.patch ib-mlx5-use-direct-mkey-destroy-command-upon-umr-unreg-failure.patch kbuild-initialize-clang_flags-correctly-in-the-top-makefile.patch mmc-dw_mmc-fix-occasional-hang-after-tuning-on-emmc.patch nbd-replace-kill_bdev-with-__invalidate_device-again.patch parisc-fix-build-of-compressed-kernel-even-with-debug-enabled.patch s390-dasd-fix-endless-loop-after-read-unit-address-configuration.patch selinux-fix-memory-leak-in-policydb_init.patch xen-swiotlb-fix-condition-for-calling-xen_destroy_contiguous_region.patch --- diff --git a/queue-4.14/btrfs-fix-incremental-send-failure-after-deduplication.patch b/queue-4.14/btrfs-fix-incremental-send-failure-after-deduplication.patch new file mode 100644 index 00000000000..f55253106d4 --- /dev/null +++ b/queue-4.14/btrfs-fix-incremental-send-failure-after-deduplication.patch @@ -0,0 +1,180 @@ +From b4f9a1a87a48c255bb90d8a6c3d555a1abb88130 Mon Sep 17 00:00:00 2001 +From: Filipe Manana +Date: Wed, 17 Jul 2019 13:23:39 +0100 +Subject: Btrfs: fix incremental send failure after deduplication + +From: Filipe Manana + +commit b4f9a1a87a48c255bb90d8a6c3d555a1abb88130 upstream. + +When doing an incremental send operation we can fail if we previously did +deduplication operations against a file that exists in both snapshots. In +that case we will fail the send operation with -EIO and print a message +to dmesg/syslog like the following: + + BTRFS error (device sdc): Send: inconsistent snapshot, found updated \ + extent for inode 257 without updated inode item, send root is 258, \ + parent root is 257 + +This requires that we deduplicate to the same file in both snapshots for +the same amount of times on each snapshot. The issue happens because a +deduplication only updates the iversion of an inode and does not update +any other field of the inode, therefore if we deduplicate the file on +each snapshot for the same amount of time, the inode will have the same +iversion value (stored as the "sequence" field on the inode item) on both +snapshots, therefore it will be seen as unchanged between in the send +snapshot while there are new/updated/deleted extent items when comparing +to the parent snapshot. This makes the send operation return -EIO and +print an error message. + +Example reproducer: + + $ mkfs.btrfs -f /dev/sdb + $ mount /dev/sdb /mnt + + # Create our first file. The first half of the file has several 64Kb + # extents while the second half as a single 512Kb extent. + $ xfs_io -f -s -c "pwrite -S 0xb8 -b 64K 0 512K" /mnt/foo + $ xfs_io -c "pwrite -S 0xb8 512K 512K" /mnt/foo + + # Create the base snapshot and the parent send stream from it. + $ btrfs subvolume snapshot -r /mnt /mnt/mysnap1 + $ btrfs send -f /tmp/1.snap /mnt/mysnap1 + + # Create our second file, that has exactly the same data as the first + # file. + $ xfs_io -f -c "pwrite -S 0xb8 0 1M" /mnt/bar + + # Create the second snapshot, used for the incremental send, before + # doing the file deduplication. + $ btrfs subvolume snapshot -r /mnt /mnt/mysnap2 + + # Now before creating the incremental send stream: + # + # 1) Deduplicate into a subrange of file foo in snapshot mysnap1. This + # will drop several extent items and add a new one, also updating + # the inode's iversion (sequence field in inode item) by 1, but not + # any other field of the inode; + # + # 2) Deduplicate into a different subrange of file foo in snapshot + # mysnap2. This will replace an extent item with a new one, also + # updating the inode's iversion by 1 but not any other field of the + # inode. + # + # After these two deduplication operations, the inode items, for file + # foo, are identical in both snapshots, but we have different extent + # items for this inode in both snapshots. We want to check this doesn't + # cause send to fail with an error or produce an incorrect stream. + + $ xfs_io -r -c "dedupe /mnt/bar 0 0 512K" /mnt/mysnap1/foo + $ xfs_io -r -c "dedupe /mnt/bar 512K 512K 512K" /mnt/mysnap2/foo + + # Create the incremental send stream. + $ btrfs send -p /mnt/mysnap1 -f /tmp/2.snap /mnt/mysnap2 + ERROR: send ioctl failed with -5: Input/output error + +This issue started happening back in 2015 when deduplication was updated +to not update the inode's ctime and mtime and update only the iversion. +Back then we would hit a BUG_ON() in send, but later in 2016 send was +updated to return -EIO and print the error message instead of doing the +BUG_ON(). + +A test case for fstests follows soon. + +Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203933 +Fixes: 1c919a5e13702c ("btrfs: don't update mtime/ctime on deduped inodes") +CC: stable@vger.kernel.org # 4.4+ +Signed-off-by: Filipe Manana +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman + +--- + fs/btrfs/send.c | 77 ++++++++++---------------------------------------------- + 1 file changed, 15 insertions(+), 62 deletions(-) + +--- a/fs/btrfs/send.c ++++ b/fs/btrfs/send.c +@@ -6130,68 +6130,21 @@ static int changed_extent(struct send_ct + { + int ret = 0; + +- if (sctx->cur_ino != sctx->cmp_key->objectid) { +- +- if (result == BTRFS_COMPARE_TREE_CHANGED) { +- struct extent_buffer *leaf_l; +- struct extent_buffer *leaf_r; +- struct btrfs_file_extent_item *ei_l; +- struct btrfs_file_extent_item *ei_r; +- +- leaf_l = sctx->left_path->nodes[0]; +- leaf_r = sctx->right_path->nodes[0]; +- ei_l = btrfs_item_ptr(leaf_l, +- sctx->left_path->slots[0], +- struct btrfs_file_extent_item); +- ei_r = btrfs_item_ptr(leaf_r, +- sctx->right_path->slots[0], +- struct btrfs_file_extent_item); +- +- /* +- * We may have found an extent item that has changed +- * only its disk_bytenr field and the corresponding +- * inode item was not updated. This case happens due to +- * very specific timings during relocation when a leaf +- * that contains file extent items is COWed while +- * relocation is ongoing and its in the stage where it +- * updates data pointers. So when this happens we can +- * safely ignore it since we know it's the same extent, +- * but just at different logical and physical locations +- * (when an extent is fully replaced with a new one, we +- * know the generation number must have changed too, +- * since snapshot creation implies committing the current +- * transaction, and the inode item must have been updated +- * as well). +- * This replacement of the disk_bytenr happens at +- * relocation.c:replace_file_extents() through +- * relocation.c:btrfs_reloc_cow_block(). +- */ +- if (btrfs_file_extent_generation(leaf_l, ei_l) == +- btrfs_file_extent_generation(leaf_r, ei_r) && +- btrfs_file_extent_ram_bytes(leaf_l, ei_l) == +- btrfs_file_extent_ram_bytes(leaf_r, ei_r) && +- btrfs_file_extent_compression(leaf_l, ei_l) == +- btrfs_file_extent_compression(leaf_r, ei_r) && +- btrfs_file_extent_encryption(leaf_l, ei_l) == +- btrfs_file_extent_encryption(leaf_r, ei_r) && +- btrfs_file_extent_other_encoding(leaf_l, ei_l) == +- btrfs_file_extent_other_encoding(leaf_r, ei_r) && +- btrfs_file_extent_type(leaf_l, ei_l) == +- btrfs_file_extent_type(leaf_r, ei_r) && +- btrfs_file_extent_disk_bytenr(leaf_l, ei_l) != +- btrfs_file_extent_disk_bytenr(leaf_r, ei_r) && +- btrfs_file_extent_disk_num_bytes(leaf_l, ei_l) == +- btrfs_file_extent_disk_num_bytes(leaf_r, ei_r) && +- btrfs_file_extent_offset(leaf_l, ei_l) == +- btrfs_file_extent_offset(leaf_r, ei_r) && +- btrfs_file_extent_num_bytes(leaf_l, ei_l) == +- btrfs_file_extent_num_bytes(leaf_r, ei_r)) +- return 0; +- } +- +- inconsistent_snapshot_error(sctx, result, "extent"); +- return -EIO; +- } ++ /* ++ * We have found an extent item that changed without the inode item ++ * having changed. This can happen either after relocation (where the ++ * disk_bytenr of an extent item is replaced at ++ * relocation.c:replace_file_extents()) or after deduplication into a ++ * file in both the parent and send snapshots (where an extent item can ++ * get modified or replaced with a new one). Note that deduplication ++ * updates the inode item, but it only changes the iversion (sequence ++ * field in the inode item) of the inode, so if a file is deduplicated ++ * the same amount of times in both the parent and send snapshots, its ++ * iversion becames the same in both snapshots, whence the inode item is ++ * the same on both snapshots. ++ */ ++ if (sctx->cur_ino != sctx->cmp_key->objectid) ++ return 0; + + if (!sctx->cur_inode_new_gen && !sctx->cur_inode_deleted) { + if (result != BTRFS_COMPARE_TREE_DELETED) diff --git a/queue-4.14/btrfs-fix-race-leading-to-fs-corruption-after-transaction-abort.patch b/queue-4.14/btrfs-fix-race-leading-to-fs-corruption-after-transaction-abort.patch new file mode 100644 index 00000000000..8b80271aec9 --- /dev/null +++ b/queue-4.14/btrfs-fix-race-leading-to-fs-corruption-after-transaction-abort.patch @@ -0,0 +1,142 @@ +From cb2d3daddbfb6318d170e79aac1f7d5e4d49f0d7 Mon Sep 17 00:00:00 2001 +From: Filipe Manana +Date: Thu, 25 Jul 2019 11:27:04 +0100 +Subject: Btrfs: fix race leading to fs corruption after transaction abort + +From: Filipe Manana + +commit cb2d3daddbfb6318d170e79aac1f7d5e4d49f0d7 upstream. + +When one transaction is finishing its commit, it is possible for another +transaction to start and enter its initial commit phase as well. If the +first ends up getting aborted, we have a small time window where the second +transaction commit does not notice that the previous transaction aborted +and ends up committing, writing a superblock that points to btrees that +reference extent buffers (nodes and leafs) that were not persisted to disk. +The consequence is that after mounting the filesystem again, we will be +unable to load some btree nodes/leafs, either because the content on disk +is either garbage (or just zeroes) or corresponds to the old content of a +previouly COWed or deleted node/leaf, resulting in the well known error +messages "parent transid verify failed on ...". +The following sequence diagram illustrates how this can happen. + + CPU 1 CPU 2 + + + + btrfs_commit_transaction() + (...) + --> sets transaction state to + TRANS_STATE_UNBLOCKED + --> sets fs_info->running_transaction + to NULL + + (...) + btrfs_start_transaction() + start_transaction() + wait_current_trans() + --> returns immediately + because + fs_info->running_transaction + is NULL + join_transaction() + --> creates transaction N + 1 + --> sets + fs_info->running_transaction + to transaction N + 1 + --> adds transaction N + 1 to + the fs_info->trans_list list + --> returns transaction handle + pointing to the new + transaction N + 1 + (...) + + btrfs_sync_file() + btrfs_start_transaction() + --> returns handle to + transaction N + 1 + (...) + + btrfs_write_and_wait_transaction() + --> writeback of some extent + buffer fails, returns an + error + btrfs_handle_fs_error() + --> sets BTRFS_FS_STATE_ERROR in + fs_info->fs_state + --> jumps to label "scrub_continue" + cleanup_transaction() + btrfs_abort_transaction(N) + --> sets BTRFS_FS_STATE_TRANS_ABORTED + flag in fs_info->fs_state + --> sets aborted field in the + transaction and transaction + handle structures, for + transaction N only + --> removes transaction from the + list fs_info->trans_list + btrfs_commit_transaction(N + 1) + --> transaction N + 1 was not + aborted, so it proceeds + (...) + --> sets the transaction's state + to TRANS_STATE_COMMIT_START + --> does not find the previous + transaction (N) in the + fs_info->trans_list, so it + doesn't know that transaction + was aborted, and the commit + of transaction N + 1 proceeds + (...) + --> sets transaction N + 1 state + to TRANS_STATE_UNBLOCKED + btrfs_write_and_wait_transaction() + --> succeeds writing all extent + buffers created in the + transaction N + 1 + write_all_supers() + --> succeeds + --> we now have a superblock on + disk that points to trees + that refer to at least one + extent buffer that was + never persisted + +So fix this by updating the transaction commit path to check if the flag +BTRFS_FS_STATE_TRANS_ABORTED is set on fs_info->fs_state if after setting +the transaction to the TRANS_STATE_COMMIT_START we do not find any previous +transaction in the fs_info->trans_list. If the flag is set, just fail the +transaction commit with -EROFS, as we do in other places. The exact error +code for the previous transaction abort was already logged and reported. + +Fixes: 49b25e0540904b ("btrfs: enhance transaction abort infrastructure") +CC: stable@vger.kernel.org # 4.4+ +Reviewed-by: Josef Bacik +Signed-off-by: Filipe Manana +Reviewed-by: David Sterba +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman + +--- + fs/btrfs/transaction.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/fs/btrfs/transaction.c ++++ b/fs/btrfs/transaction.c +@@ -2052,6 +2052,16 @@ int btrfs_commit_transaction(struct btrf + } + } else { + spin_unlock(&fs_info->trans_lock); ++ /* ++ * The previous transaction was aborted and was already removed ++ * from the list of transactions at fs_info->trans_list. So we ++ * abort to prevent writing a new superblock that reflects a ++ * corrupt state (pointing to trees with unwritten nodes/leafs). ++ */ ++ if (test_bit(BTRFS_FS_STATE_TRANS_ABORTED, &fs_info->fs_state)) { ++ ret = -EROFS; ++ goto cleanup_transaction; ++ } + } + + extwriter_counter_dec(cur_trans, trans->type); diff --git a/queue-4.14/drivers-perf-arm_pmu-fix-failure-path-in-pm-notifier.patch b/queue-4.14/drivers-perf-arm_pmu-fix-failure-path-in-pm-notifier.patch new file mode 100644 index 00000000000..9dd2a84b3d4 --- /dev/null +++ b/queue-4.14/drivers-perf-arm_pmu-fix-failure-path-in-pm-notifier.patch @@ -0,0 +1,36 @@ +From 0d7fd70f26039bd4b33444ca47f0e69ce3ae0354 Mon Sep 17 00:00:00 2001 +From: Will Deacon +Date: Mon, 29 Jul 2019 11:43:48 +0100 +Subject: drivers/perf: arm_pmu: Fix failure path in PM notifier + +From: Will Deacon + +commit 0d7fd70f26039bd4b33444ca47f0e69ce3ae0354 upstream. + +Handling of the CPU_PM_ENTER_FAILED transition in the Arm PMU PM +notifier code incorrectly skips restoration of the counters. Fix the +logic so that CPU_PM_ENTER_FAILED follows the same path as CPU_PM_EXIT. + +Cc: +Fixes: da4e4f18afe0f372 ("drivers/perf: arm_pmu: implement CPU_PM notifier") +Reported-by: Anders Roxell +Acked-by: Lorenzo Pieralisi +Signed-off-by: Will Deacon +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/perf/arm_pmu.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/perf/arm_pmu.c ++++ b/drivers/perf/arm_pmu.c +@@ -751,8 +751,8 @@ static int cpu_pm_pmu_notify(struct noti + cpu_pm_pmu_setup(armpmu, cmd); + break; + case CPU_PM_EXIT: +- cpu_pm_pmu_setup(armpmu, cmd); + case CPU_PM_ENTER_FAILED: ++ cpu_pm_pmu_setup(armpmu, cmd); + armpmu->start(armpmu); + break; + default: diff --git a/queue-4.14/gpiolib-fix-incorrect-irq-requesting-of-an-active-low-lineevent.patch b/queue-4.14/gpiolib-fix-incorrect-irq-requesting-of-an-active-low-lineevent.patch new file mode 100644 index 00000000000..43e1c2e20d3 --- /dev/null +++ b/queue-4.14/gpiolib-fix-incorrect-irq-requesting-of-an-active-low-lineevent.patch @@ -0,0 +1,70 @@ +From 223ecaf140b1dd1c1d2a1a1d96281efc5c906984 Mon Sep 17 00:00:00 2001 +From: Michael Wu +Date: Mon, 8 Jul 2019 13:23:08 +0800 +Subject: gpiolib: fix incorrect IRQ requesting of an active-low lineevent + +From: Michael Wu + +commit 223ecaf140b1dd1c1d2a1a1d96281efc5c906984 upstream. + +When a pin is active-low, logical trigger edge should be inverted to match +the same interrupt opportunity. + +For example, a button pushed triggers falling edge in ACTIVE_HIGH case; in +ACTIVE_LOW case, the button pushed triggers rising edge. For user space the +IRQ requesting doesn't need to do any modification except to configuring +GPIOHANDLE_REQUEST_ACTIVE_LOW. + +For example, we want to catch the event when the button is pushed. The +button on the original board drives level to be low when it is pushed, and +drives level to be high when it is released. + +In user space we can do: + + req.handleflags = GPIOHANDLE_REQUEST_INPUT; + req.eventflags = GPIOEVENT_REQUEST_FALLING_EDGE; + + while (1) { + read(fd, &dat, sizeof(dat)); + if (dat.id == GPIOEVENT_EVENT_FALLING_EDGE) + printf("button pushed\n"); + } + +Run the same logic on another board which the polarity of the button is +inverted; it drives level to be high when pushed, and level to be low when +released. For this inversion we add flag GPIOHANDLE_REQUEST_ACTIVE_LOW: + + req.handleflags = GPIOHANDLE_REQUEST_INPUT | + GPIOHANDLE_REQUEST_ACTIVE_LOW; + req.eventflags = GPIOEVENT_REQUEST_FALLING_EDGE; + +At the result, there are no any events caught when the button is pushed. +By the way, button releasing will emit a "falling" event. The timing of +"falling" catching is not expected. + +Cc: stable@vger.kernel.org +Signed-off-by: Michael Wu +Tested-by: Bartosz Golaszewski +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpio/gpiolib.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/gpio/gpiolib.c ++++ b/drivers/gpio/gpiolib.c +@@ -835,9 +835,11 @@ static int lineevent_create(struct gpio_ + } + + if (eflags & GPIOEVENT_REQUEST_RISING_EDGE) +- irqflags |= IRQF_TRIGGER_RISING; ++ irqflags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ? ++ IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING; + if (eflags & GPIOEVENT_REQUEST_FALLING_EDGE) +- irqflags |= IRQF_TRIGGER_FALLING; ++ irqflags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ? ++ IRQF_TRIGGER_RISING : IRQF_TRIGGER_FALLING; + irqflags |= IRQF_ONESHOT; + irqflags |= IRQF_SHARED; + diff --git a/queue-4.14/ib-hfi1-check-for-error-on-call-to-alloc_rsm_map_table.patch b/queue-4.14/ib-hfi1-check-for-error-on-call-to-alloc_rsm_map_table.patch new file mode 100644 index 00000000000..1ef183af934 --- /dev/null +++ b/queue-4.14/ib-hfi1-check-for-error-on-call-to-alloc_rsm_map_table.patch @@ -0,0 +1,66 @@ +From cd48a82087231fdba0e77521102386c6ed0168d6 Mon Sep 17 00:00:00 2001 +From: John Fleck +Date: Mon, 15 Jul 2019 12:45:21 -0400 +Subject: IB/hfi1: Check for error on call to alloc_rsm_map_table + +From: John Fleck + +commit cd48a82087231fdba0e77521102386c6ed0168d6 upstream. + +The call to alloc_rsm_map_table does not check if the kmalloc fails. +Check for a NULL on alloc, and bail if it fails. + +Fixes: 372cc85a13c9 ("IB/hfi1: Extract RSM map table init from QOS") +Link: https://lore.kernel.org/r/20190715164521.74174.27047.stgit@awfm-01.aw.intel.com +Cc: +Reviewed-by: Mike Marciniszyn +Signed-off-by: John Fleck +Signed-off-by: Mike Marciniszyn +Signed-off-by: Jason Gunthorpe +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/infiniband/hw/hfi1/chip.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +--- a/drivers/infiniband/hw/hfi1/chip.c ++++ b/drivers/infiniband/hw/hfi1/chip.c +@@ -14566,7 +14566,7 @@ void hfi1_deinit_vnic_rsm(struct hfi1_de + clear_rcvctrl(dd, RCV_CTRL_RCV_RSM_ENABLE_SMASK); + } + +-static void init_rxe(struct hfi1_devdata *dd) ++static int init_rxe(struct hfi1_devdata *dd) + { + struct rsm_map_table *rmt; + u64 val; +@@ -14575,6 +14575,9 @@ static void init_rxe(struct hfi1_devdata + write_csr(dd, RCV_ERR_MASK, ~0ull); + + rmt = alloc_rsm_map_table(dd); ++ if (!rmt) ++ return -ENOMEM; ++ + /* set up QOS, including the QPN map table */ + init_qos(dd, rmt); + init_user_fecn_handling(dd, rmt); +@@ -14599,6 +14602,7 @@ static void init_rxe(struct hfi1_devdata + val = read_csr(dd, RCV_BYPASS); + val |= (4ull << 16); + write_csr(dd, RCV_BYPASS, val); ++ return 0; + } + + static void init_other(struct hfi1_devdata *dd) +@@ -15154,7 +15158,10 @@ struct hfi1_devdata *hfi1_init_dd(struct + goto bail_cleanup; + + /* set initial RXE CSRs */ +- init_rxe(dd); ++ ret = init_rxe(dd); ++ if (ret) ++ goto bail_cleanup; ++ + /* set initial TXE CSRs */ + init_txe(dd); + /* set initial non-RXE, non-TXE CSRs */ diff --git a/queue-4.14/ib-hfi1-fix-spectre-v1-vulnerability.patch b/queue-4.14/ib-hfi1-fix-spectre-v1-vulnerability.patch new file mode 100644 index 00000000000..ac3876b0bd6 --- /dev/null +++ b/queue-4.14/ib-hfi1-fix-spectre-v1-vulnerability.patch @@ -0,0 +1,48 @@ +From 6497d0a9c53df6e98b25e2b79f2295d7caa47b6e Mon Sep 17 00:00:00 2001 +From: "Gustavo A. R. Silva" +Date: Wed, 31 Jul 2019 12:54:28 -0500 +Subject: IB/hfi1: Fix Spectre v1 vulnerability + +From: Gustavo A. R. Silva + +commit 6497d0a9c53df6e98b25e2b79f2295d7caa47b6e upstream. + +sl is controlled by user-space, hence leading to a potential +exploitation of the Spectre variant 1 vulnerability. + +Fix this by sanitizing sl before using it to index ibp->sl_to_sc. + +Notice that given that speculation windows are large, the policy is +to kill the speculation on the first load and not worry if it can be +completed with a dependent load/store [1]. + +[1] https://lore.kernel.org/lkml/20180423164740.GY17484@dhcp22.suse.cz/ + +Cc: stable@vger.kernel.org +Signed-off-by: Gustavo A. R. Silva +Link: https://lore.kernel.org/r/20190731175428.GA16736@embeddedor +Signed-off-by: Doug Ledford +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/infiniband/hw/hfi1/verbs.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/infiniband/hw/hfi1/verbs.c ++++ b/drivers/infiniband/hw/hfi1/verbs.c +@@ -54,6 +54,7 @@ + #include + #include + #include ++#include + + #include "hfi.h" + #include "common.h" +@@ -1587,6 +1588,7 @@ static int hfi1_check_ah(struct ib_devic + sl = rdma_ah_get_sl(ah_attr); + if (sl >= ARRAY_SIZE(ibp->sl_to_sc)) + return -EINVAL; ++ sl = array_index_nospec(sl, ARRAY_SIZE(ibp->sl_to_sc)); + + sc5 = ibp->sl_to_sc[sl]; + if (sc_to_vlt(dd, sc5) > num_vls && sc_to_vlt(dd, sc5) != 0xf) diff --git a/queue-4.14/ib-mlx5-fix-rss-toeplitz-setup-to-be-aligned-with-the-hw-specification.patch b/queue-4.14/ib-mlx5-fix-rss-toeplitz-setup-to-be-aligned-with-the-hw-specification.patch new file mode 100644 index 00000000000..78847e90887 --- /dev/null +++ b/queue-4.14/ib-mlx5-fix-rss-toeplitz-setup-to-be-aligned-with-the-hw-specification.patch @@ -0,0 +1,39 @@ +From b7165bd0d6cbb93732559be6ea8774653b204480 Mon Sep 17 00:00:00 2001 +From: Yishai Hadas +Date: Tue, 23 Jul 2019 09:57:29 +0300 +Subject: IB/mlx5: Fix RSS Toeplitz setup to be aligned with the HW specification + +From: Yishai Hadas + +commit b7165bd0d6cbb93732559be6ea8774653b204480 upstream. + +The specification for the Toeplitz function doesn't require to set the key +explicitly to be symmetric. In case a symmetric functionality is required +a symmetric key can be simply used. + +Wrongly forcing the algorithm to symmetric causes the wrong packet +distribution and a performance degradation. + +Link: https://lore.kernel.org/r/20190723065733.4899-7-leon@kernel.org +Cc: # 4.7 +Fixes: 28d6137008b2 ("IB/mlx5: Add RSS QP support") +Signed-off-by: Yishai Hadas +Reviewed-by: Alex Vainman +Signed-off-by: Leon Romanovsky +Signed-off-by: Jason Gunthorpe +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/infiniband/hw/mlx5/qp.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/infiniband/hw/mlx5/qp.c ++++ b/drivers/infiniband/hw/mlx5/qp.c +@@ -1425,7 +1425,6 @@ static int create_rss_raw_qp_tir(struct + } + + MLX5_SET(tirc, tirc, rx_hash_fn, MLX5_RX_HASH_FN_TOEPLITZ); +- MLX5_SET(tirc, tirc, rx_hash_symmetric, 1); + memcpy(rss_key, ucmd.rx_hash_key, len); + break; + } diff --git a/queue-4.14/ib-mlx5-fix-unreg_umr-to-ignore-the-mkey-state.patch b/queue-4.14/ib-mlx5-fix-unreg_umr-to-ignore-the-mkey-state.patch new file mode 100644 index 00000000000..0272bc017f5 --- /dev/null +++ b/queue-4.14/ib-mlx5-fix-unreg_umr-to-ignore-the-mkey-state.patch @@ -0,0 +1,76 @@ +From 6a053953739d23694474a5f9c81d1a30093da81a Mon Sep 17 00:00:00 2001 +From: Yishai Hadas +Date: Tue, 23 Jul 2019 09:57:25 +0300 +Subject: IB/mlx5: Fix unreg_umr to ignore the mkey state + +From: Yishai Hadas + +commit 6a053953739d23694474a5f9c81d1a30093da81a upstream. + +Fix unreg_umr to ignore the mkey state and do not fail if was freed. This +prevents a case that a user space application already changed the mkey +state to free and then the UMR operation will fail leaving the mkey in an +inappropriate state. + +Link: https://lore.kernel.org/r/20190723065733.4899-3-leon@kernel.org +Cc: # 3.19 +Fixes: 968e78dd9644 ("IB/mlx5: Enhance UMR support to allow partial page table update") +Signed-off-by: Yishai Hadas +Reviewed-by: Artemy Kovalyov +Signed-off-by: Leon Romanovsky +Reviewed-by: Jason Gunthorpe +Signed-off-by: Jason Gunthorpe +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/infiniband/hw/mlx5/mlx5_ib.h | 1 + + drivers/infiniband/hw/mlx5/mr.c | 4 ++-- + drivers/infiniband/hw/mlx5/qp.c | 12 ++++++++---- + 3 files changed, 11 insertions(+), 6 deletions(-) + +--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h ++++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h +@@ -427,6 +427,7 @@ struct mlx5_umr_wr { + u64 length; + int access_flags; + u32 mkey; ++ u8 ignore_free_state:1; + }; + + static inline struct mlx5_umr_wr *umr_wr(struct ib_send_wr *wr) +--- a/drivers/infiniband/hw/mlx5/mr.c ++++ b/drivers/infiniband/hw/mlx5/mr.c +@@ -1302,10 +1302,10 @@ static int unreg_umr(struct mlx5_ib_dev + if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) + return 0; + +- umrwr.wr.send_flags = MLX5_IB_SEND_UMR_DISABLE_MR | +- MLX5_IB_SEND_UMR_FAIL_IF_FREE; ++ umrwr.wr.send_flags = MLX5_IB_SEND_UMR_DISABLE_MR; + umrwr.wr.opcode = MLX5_IB_WR_UMR; + umrwr.mkey = mr->mmkey.key; ++ umrwr.ignore_free_state = 1; + + return mlx5_ib_post_send_wait(dev, &umrwr); + } +--- a/drivers/infiniband/hw/mlx5/qp.c ++++ b/drivers/infiniband/hw/mlx5/qp.c +@@ -3265,10 +3265,14 @@ static void set_reg_umr_segment(struct m + + memset(umr, 0, sizeof(*umr)); + +- if (wr->send_flags & MLX5_IB_SEND_UMR_FAIL_IF_FREE) +- umr->flags = MLX5_UMR_CHECK_FREE; /* fail if free */ +- else +- umr->flags = MLX5_UMR_CHECK_NOT_FREE; /* fail if not free */ ++ if (!umrwr->ignore_free_state) { ++ if (wr->send_flags & MLX5_IB_SEND_UMR_FAIL_IF_FREE) ++ /* fail if free */ ++ umr->flags = MLX5_UMR_CHECK_FREE; ++ else ++ /* fail if not free */ ++ umr->flags = MLX5_UMR_CHECK_NOT_FREE; ++ } + + umr->xlt_octowords = cpu_to_be16(get_xlt_octo(umrwr->xlt_size)); + if (wr->send_flags & MLX5_IB_SEND_UMR_UPDATE_XLT) { diff --git a/queue-4.14/ib-mlx5-move-mrs-to-a-kernel-pd-when-freeing-them-to-the-mr-cache.patch b/queue-4.14/ib-mlx5-move-mrs-to-a-kernel-pd-when-freeing-them-to-the-mr-cache.patch new file mode 100644 index 00000000000..c58a7d0d50d --- /dev/null +++ b/queue-4.14/ib-mlx5-move-mrs-to-a-kernel-pd-when-freeing-them-to-the-mr-cache.patch @@ -0,0 +1,47 @@ +From 9ec4483a3f0f71a228a5933bc040441322bfb090 Mon Sep 17 00:00:00 2001 +From: Yishai Hadas +Date: Tue, 23 Jul 2019 09:57:27 +0300 +Subject: IB/mlx5: Move MRs to a kernel PD when freeing them to the MR cache + +From: Yishai Hadas + +commit 9ec4483a3f0f71a228a5933bc040441322bfb090 upstream. + +Fix unreg_umr to move the MR to a kernel owned PD (i.e. the UMR PD) which +can't be accessed by userspace. + +This ensures that nothing can continue to access the MR once it has been +placed in the kernels cache for reuse. + +MRs in the cache continue to have their HW state, including DMA tables, +present. Even though the MR has been invalidated, changing the PD provides +an additional layer of protection against use of the MR. + +Link: https://lore.kernel.org/r/20190723065733.4899-5-leon@kernel.org +Cc: # 3.10 +Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters") +Signed-off-by: Yishai Hadas +Reviewed-by: Artemy Kovalyov +Signed-off-by: Leon Romanovsky +Reviewed-by: Jason Gunthorpe +Signed-off-by: Jason Gunthorpe +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/infiniband/hw/mlx5/mr.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/infiniband/hw/mlx5/mr.c ++++ b/drivers/infiniband/hw/mlx5/mr.c +@@ -1305,8 +1305,10 @@ static int unreg_umr(struct mlx5_ib_dev + if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) + return 0; + +- umrwr.wr.send_flags = MLX5_IB_SEND_UMR_DISABLE_MR; ++ umrwr.wr.send_flags = MLX5_IB_SEND_UMR_DISABLE_MR | ++ MLX5_IB_SEND_UMR_UPDATE_PD_ACCESS; + umrwr.wr.opcode = MLX5_IB_WR_UMR; ++ umrwr.pd = dev->umrc.pd; + umrwr.mkey = mr->mmkey.key; + umrwr.ignore_free_state = 1; + diff --git a/queue-4.14/ib-mlx5-use-direct-mkey-destroy-command-upon-umr-unreg-failure.patch b/queue-4.14/ib-mlx5-use-direct-mkey-destroy-command-upon-umr-unreg-failure.patch new file mode 100644 index 00000000000..0b0023ba9a3 --- /dev/null +++ b/queue-4.14/ib-mlx5-use-direct-mkey-destroy-command-upon-umr-unreg-failure.patch @@ -0,0 +1,59 @@ +From afd1417404fba6dbfa6c0a8e5763bd348da682e4 Mon Sep 17 00:00:00 2001 +From: Yishai Hadas +Date: Tue, 23 Jul 2019 09:57:26 +0300 +Subject: IB/mlx5: Use direct mkey destroy command upon UMR unreg failure + +From: Yishai Hadas + +commit afd1417404fba6dbfa6c0a8e5763bd348da682e4 upstream. + +Use a direct firmware command to destroy the mkey in case the unreg UMR +operation has failed. + +This prevents a case that a mkey will leak out from the cache post a +failure to be destroyed by a UMR WR. + +In case the MR cache limit didn't reach a call to add another entry to the +cache instead of the destroyed one is issued. + +In addition, replaced a warn message to WARN_ON() as this flow is fatal +and can't happen unless some bug around. + +Link: https://lore.kernel.org/r/20190723065733.4899-4-leon@kernel.org +Cc: # 4.10 +Fixes: 49780d42dfc9 ("IB/mlx5: Expose MR cache for mlx5_ib") +Signed-off-by: Yishai Hadas +Reviewed-by: Artemy Kovalyov +Signed-off-by: Leon Romanovsky +Reviewed-by: Jason Gunthorpe +Signed-off-by: Jason Gunthorpe +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/infiniband/hw/mlx5/mr.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +--- a/drivers/infiniband/hw/mlx5/mr.c ++++ b/drivers/infiniband/hw/mlx5/mr.c +@@ -538,13 +538,16 @@ void mlx5_mr_cache_free(struct mlx5_ib_d + int c; + + c = order2idx(dev, mr->order); +- if (c < 0 || c >= MAX_MR_CACHE_ENTRIES) { +- mlx5_ib_warn(dev, "order %d, cache index %d\n", mr->order, c); +- return; +- } ++ WARN_ON(c < 0 || c >= MAX_MR_CACHE_ENTRIES); + +- if (unreg_umr(dev, mr)) ++ if (unreg_umr(dev, mr)) { ++ mr->allocated_from_cache = false; ++ destroy_mkey(dev, mr); ++ ent = &cache->ent[c]; ++ if (ent->cur < ent->limit) ++ queue_work(cache->wq, &ent->work); + return; ++ } + + ent = &cache->ent[c]; + spin_lock_irq(&ent->lock); diff --git a/queue-4.14/kbuild-initialize-clang_flags-correctly-in-the-top-makefile.patch b/queue-4.14/kbuild-initialize-clang_flags-correctly-in-the-top-makefile.patch new file mode 100644 index 00000000000..33fd3ef46d9 --- /dev/null +++ b/queue-4.14/kbuild-initialize-clang_flags-correctly-in-the-top-makefile.patch @@ -0,0 +1,57 @@ +From 5241ab4cf42d3a93b933b55d3d53f43049081fa1 Mon Sep 17 00:00:00 2001 +From: Masahiro Yamada +Date: Mon, 29 Jul 2019 18:15:17 +0900 +Subject: kbuild: initialize CLANG_FLAGS correctly in the top Makefile + +From: Masahiro Yamada + +commit 5241ab4cf42d3a93b933b55d3d53f43049081fa1 upstream. + +CLANG_FLAGS is initialized by the following line: + + CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%)) + +..., which is run only when CROSS_COMPILE is set. + +Some build targets (bindeb-pkg etc.) recurse to the top Makefile. + +When you build the kernel with Clang but without CROSS_COMPILE, +the same compiler flags such as -no-integrated-as are accumulated +into CLANG_FLAGS. + +If you run 'make CC=clang' and then 'make CC=clang bindeb-pkg', +Kbuild will recompile everything needlessly due to the build command +change. + +Fix this by correctly initializing CLANG_FLAGS. + +Fixes: 238bcbc4e07f ("kbuild: consolidate Clang compiler flags") +Cc: # v5.0+ +Signed-off-by: Masahiro Yamada +Reviewed-by: Nathan Chancellor +Acked-by: Nick Desaulniers +Signed-off-by: Greg Kroah-Hartman + +--- + Makefile | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/Makefile ++++ b/Makefile +@@ -427,6 +427,7 @@ KBUILD_AFLAGS_MODULE := -DMODULE + KBUILD_CFLAGS_MODULE := -DMODULE + KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds + GCC_PLUGINS_CFLAGS := ++CLANG_FLAGS := + + export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC + export CPP AR NM STRIP OBJCOPY OBJDUMP HOSTLDFLAGS HOST_LOADLIBES +@@ -479,7 +480,7 @@ endif + + ifeq ($(cc-name),clang) + ifneq ($(CROSS_COMPILE),) +-CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%)) ++CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) + GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit)) + CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR) + GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) diff --git a/queue-4.14/mmc-dw_mmc-fix-occasional-hang-after-tuning-on-emmc.patch b/queue-4.14/mmc-dw_mmc-fix-occasional-hang-after-tuning-on-emmc.patch new file mode 100644 index 00000000000..f6ce9886c57 --- /dev/null +++ b/queue-4.14/mmc-dw_mmc-fix-occasional-hang-after-tuning-on-emmc.patch @@ -0,0 +1,62 @@ +From ba2d139b02ba684c6c101de42fed782d6cd2b997 Mon Sep 17 00:00:00 2001 +From: Douglas Anderson +Date: Mon, 8 Jul 2019 12:56:13 -0700 +Subject: mmc: dw_mmc: Fix occasional hang after tuning on eMMC + +From: Douglas Anderson + +commit ba2d139b02ba684c6c101de42fed782d6cd2b997 upstream. + +In commit 46d179525a1f ("mmc: dw_mmc: Wait for data transfer after +response errors.") we fixed a tuning-induced hang that I saw when +stress testing tuning on certain SD cards. I won't re-hash that whole +commit, but the summary is that as a normal part of tuning you need to +deal with transfer errors and there were cases where these transfer +errors was putting my system into a bad state causing all future +transfers to fail. That commit fixed handling of the transfer errors +for me. + +In downstream Chrome OS my fix landed and had the same behavior for +all SD/MMC commands. However, it looks like when the commit landed +upstream we limited it to only SD tuning commands. Presumably this +was to try to get around problems that Alim Akhtar reported on exynos +[1]. + +Unfortunately while stress testing reboots (and suspend/resume) on +some rk3288-based Chromebooks I found the same problem on the eMMC on +some of my Chromebooks (the ones with Hynix eMMC). Since the eMMC +tuning command is different (MMC_SEND_TUNING_BLOCK_HS200 +vs. MMC_SEND_TUNING_BLOCK) we were basically getting back into the +same situation. + +I'm hoping that whatever problems exynos was having in the past are +somehow magically fixed now and we can make the behavior the same for +all commands. + +[1] https://lkml.kernel.org/r/CAGOxZ53WfNbaMe0_AM0qBqU47kAfgmPBVZC8K8Y-_J3mDMqW4A@mail.gmail.com + +Fixes: 46d179525a1f ("mmc: dw_mmc: Wait for data transfer after response errors.") +Signed-off-by: Douglas Anderson +Cc: Marek Szyprowski +Cc: Alim Akhtar +Cc: Enric Balletbo i Serra +Cc: stable@vger.kernel.org +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mmc/host/dw_mmc.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/mmc/host/dw_mmc.c ++++ b/drivers/mmc/host/dw_mmc.c +@@ -2046,8 +2046,7 @@ static void dw_mci_tasklet_func(unsigned + * delayed. Allowing the transfer to take place + * avoids races and keeps things simple. + */ +- if ((err != -ETIMEDOUT) && +- (cmd->opcode == MMC_SEND_TUNING_BLOCK)) { ++ if (err != -ETIMEDOUT) { + state = STATE_SENDING_DATA; + continue; + } diff --git a/queue-4.14/nbd-replace-kill_bdev-with-__invalidate_device-again.patch b/queue-4.14/nbd-replace-kill_bdev-with-__invalidate_device-again.patch new file mode 100644 index 00000000000..ace7e3edca0 --- /dev/null +++ b/queue-4.14/nbd-replace-kill_bdev-with-__invalidate_device-again.patch @@ -0,0 +1,74 @@ +From 2b5c8f0063e4b263cf2de82029798183cf85c320 Mon Sep 17 00:00:00 2001 +From: Munehisa Kamata +Date: Wed, 31 Jul 2019 20:13:10 +0800 +Subject: nbd: replace kill_bdev() with __invalidate_device() again + +From: Munehisa Kamata + +commit 2b5c8f0063e4b263cf2de82029798183cf85c320 upstream. + +Commit abbbdf12497d ("replace kill_bdev() with __invalidate_device()") +once did this, but 29eaadc03649 ("nbd: stop using the bdev everywhere") +resurrected kill_bdev() and it has been there since then. So buffer_head +mappings still get killed on a server disconnection, and we can still +hit the BUG_ON on a filesystem on the top of the nbd device. + + EXT4-fs (nbd0): mounted filesystem with ordered data mode. Opts: (null) + block nbd0: Receive control failed (result -32) + block nbd0: shutting down sockets + print_req_error: I/O error, dev nbd0, sector 66264 flags 3000 + EXT4-fs warning (device nbd0): htree_dirblock_to_tree:979: inode #2: lblock 0: comm ls: error -5 reading directory block + print_req_error: I/O error, dev nbd0, sector 2264 flags 3000 + EXT4-fs error (device nbd0): __ext4_get_inode_loc:4690: inode #2: block 283: comm ls: unable to read itable block + EXT4-fs error (device nbd0) in ext4_reserve_inode_write:5894: IO failure + ------------[ cut here ]------------ + kernel BUG at fs/buffer.c:3057! + invalid opcode: 0000 [#1] SMP PTI + CPU: 7 PID: 40045 Comm: jbd2/nbd0-8 Not tainted 5.1.0-rc3+ #4 + Hardware name: Amazon EC2 m5.12xlarge/, BIOS 1.0 10/16/2017 + RIP: 0010:submit_bh_wbc+0x18b/0x190 + ... + Call Trace: + jbd2_write_superblock+0xf1/0x230 [jbd2] + ? account_entity_enqueue+0xc5/0xf0 + jbd2_journal_update_sb_log_tail+0x94/0xe0 [jbd2] + jbd2_journal_commit_transaction+0x12f/0x1d20 [jbd2] + ? __switch_to_asm+0x40/0x70 + ... + ? lock_timer_base+0x67/0x80 + kjournald2+0x121/0x360 [jbd2] + ? remove_wait_queue+0x60/0x60 + kthread+0xf8/0x130 + ? commit_timeout+0x10/0x10 [jbd2] + ? kthread_bind+0x10/0x10 + ret_from_fork+0x35/0x40 + +With __invalidate_device(), I no longer hit the BUG_ON with sync or +unmount on the disconnected device. + +Fixes: 29eaadc03649 ("nbd: stop using the bdev everywhere") +Cc: linux-block@vger.kernel.org +Cc: Ratna Manoj Bolla +Cc: nbd@other.debian.org +Cc: stable@vger.kernel.org +Cc: David Woodhouse +Reviewed-by: Josef Bacik +Signed-off-by: Munehisa Kamata +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/block/nbd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/block/nbd.c ++++ b/drivers/block/nbd.c +@@ -1207,7 +1207,7 @@ static void nbd_clear_sock_ioctl(struct + struct block_device *bdev) + { + sock_shutdown(nbd); +- kill_bdev(bdev); ++ __invalidate_device(bdev, true); + nbd_bdev_reset(bdev); + if (test_and_clear_bit(NBD_HAS_CONFIG_REF, + &nbd->config->runtime_flags)) diff --git a/queue-4.14/parisc-fix-build-of-compressed-kernel-even-with-debug-enabled.patch b/queue-4.14/parisc-fix-build-of-compressed-kernel-even-with-debug-enabled.patch new file mode 100644 index 00000000000..7286fcb1ce9 --- /dev/null +++ b/queue-4.14/parisc-fix-build-of-compressed-kernel-even-with-debug-enabled.patch @@ -0,0 +1,36 @@ +From 3fe6c873af2f2247544debdbe51ec29f690a2ccf Mon Sep 17 00:00:00 2001 +From: Helge Deller +Date: Thu, 1 Aug 2019 13:33:39 +0200 +Subject: parisc: Fix build of compressed kernel even with debug enabled + +From: Helge Deller + +commit 3fe6c873af2f2247544debdbe51ec29f690a2ccf upstream. + +With debug info enabled (CONFIG_DEBUG_INFO=y) the resulting vmlinux may get +that huge that we need to increase the start addresss for the decompression +text section otherwise one will face a linker error. + +Reported-by: Sven Schnelle +Tested-by: Sven Schnelle +Cc: stable@vger.kernel.org # v4.14+ +Signed-off-by: Helge Deller +Signed-off-by: Greg Kroah-Hartman + +--- + arch/parisc/boot/compressed/vmlinux.lds.S | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/parisc/boot/compressed/vmlinux.lds.S ++++ b/arch/parisc/boot/compressed/vmlinux.lds.S +@@ -40,8 +40,8 @@ SECTIONS + #endif + _startcode_end = .; + +- /* bootloader code and data starts behind area of extracted kernel */ +- . = (SZ_end - SZparisc_kernel_start + KERNEL_BINARY_TEXT_START); ++ /* bootloader code and data starts at least behind area of extracted kernel */ ++ . = MAX(ABSOLUTE(.), (SZ_end - SZparisc_kernel_start + KERNEL_BINARY_TEXT_START)); + + /* align on next page boundary */ + . = ALIGN(4096); diff --git a/queue-4.14/s390-dasd-fix-endless-loop-after-read-unit-address-configuration.patch b/queue-4.14/s390-dasd-fix-endless-loop-after-read-unit-address-configuration.patch new file mode 100644 index 00000000000..80ab9045725 --- /dev/null +++ b/queue-4.14/s390-dasd-fix-endless-loop-after-read-unit-address-configuration.patch @@ -0,0 +1,73 @@ +From 41995342b40c418a47603e1321256d2c4a2ed0fb Mon Sep 17 00:00:00 2001 +From: Stefan Haberland +Date: Thu, 1 Aug 2019 13:06:30 +0200 +Subject: s390/dasd: fix endless loop after read unit address configuration + +From: Stefan Haberland + +commit 41995342b40c418a47603e1321256d2c4a2ed0fb upstream. + +After getting a storage server event that causes the DASD device driver +to update its unit address configuration during a device shutdown there is +the possibility of an endless loop in the device driver. + +In the system log there will be ongoing DASD error messages with RC: -19. + +The reason is that the loop starting the ruac request only terminates when +the retry counter is decreased to 0. But in the sleep_on function there are +early exit paths that do not decrease the retry counter. + +Prevent an endless loop by handling those cases separately. + +Remove the unnecessary do..while loop since the sleep_on function takes +care of retries by itself. + +Fixes: 8e09f21574ea ("[S390] dasd: add hyper PAV support to DASD device driver, part 1") +Cc: stable@vger.kernel.org # 2.6.25+ +Signed-off-by: Stefan Haberland +Reviewed-by: Jan Hoeppner +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/s390/block/dasd_alias.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/drivers/s390/block/dasd_alias.c ++++ b/drivers/s390/block/dasd_alias.c +@@ -383,6 +383,20 @@ suborder_not_supported(struct dasd_ccw_r + char msg_format; + char msg_no; + ++ /* ++ * intrc values ENODEV, ENOLINK and EPERM ++ * will be optained from sleep_on to indicate that no ++ * IO operation can be started ++ */ ++ if (cqr->intrc == -ENODEV) ++ return 1; ++ ++ if (cqr->intrc == -ENOLINK) ++ return 1; ++ ++ if (cqr->intrc == -EPERM) ++ return 1; ++ + sense = dasd_get_sense(&cqr->irb); + if (!sense) + return 0; +@@ -447,12 +461,8 @@ static int read_unit_address_configurati + lcu->flags &= ~NEED_UAC_UPDATE; + spin_unlock_irqrestore(&lcu->lock, flags); + +- do { +- rc = dasd_sleep_on(cqr); +- if (rc && suborder_not_supported(cqr)) +- return -EOPNOTSUPP; +- } while (rc && (cqr->retries > 0)); +- if (rc) { ++ rc = dasd_sleep_on(cqr); ++ if (rc && !suborder_not_supported(cqr)) { + spin_lock_irqsave(&lcu->lock, flags); + lcu->flags |= NEED_UAC_UPDATE; + spin_unlock_irqrestore(&lcu->lock, flags); diff --git a/queue-4.14/selinux-fix-memory-leak-in-policydb_init.patch b/queue-4.14/selinux-fix-memory-leak-in-policydb_init.patch new file mode 100644 index 00000000000..5c728308a37 --- /dev/null +++ b/queue-4.14/selinux-fix-memory-leak-in-policydb_init.patch @@ -0,0 +1,47 @@ +From 45385237f65aeee73641f1ef737d7273905a233f Mon Sep 17 00:00:00 2001 +From: Ondrej Mosnacek +Date: Thu, 25 Jul 2019 12:52:43 +0200 +Subject: selinux: fix memory leak in policydb_init() + +From: Ondrej Mosnacek + +commit 45385237f65aeee73641f1ef737d7273905a233f upstream. + +Since roles_init() adds some entries to the role hash table, we need to +destroy also its keys/values on error, otherwise we get a memory leak in +the error path. + +Cc: +Reported-by: syzbot+fee3a14d4cdf92646287@syzkaller.appspotmail.com +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Signed-off-by: Ondrej Mosnacek +Signed-off-by: Paul Moore +Signed-off-by: Greg Kroah-Hartman + +--- + security/selinux/ss/policydb.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/security/selinux/ss/policydb.c ++++ b/security/selinux/ss/policydb.c +@@ -275,6 +275,8 @@ static int rangetr_cmp(struct hashtab *h + return v; + } + ++static int (*destroy_f[SYM_NUM]) (void *key, void *datum, void *datap); ++ + /* + * Initialize a policy database structure. + */ +@@ -322,8 +324,10 @@ static int policydb_init(struct policydb + out: + hashtab_destroy(p->filename_trans); + hashtab_destroy(p->range_tr); +- for (i = 0; i < SYM_NUM; i++) ++ for (i = 0; i < SYM_NUM; i++) { ++ hashtab_map(p->symtab[i].table, destroy_f[i], NULL); + hashtab_destroy(p->symtab[i].table); ++ } + return rc; + } + diff --git a/queue-4.14/series b/queue-4.14/series index ca87732794d..0d92c2e0d20 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -30,3 +30,20 @@ x86-kvm-don-t-call-kvm_spurious_fault-from-.fixup.patch x86-paravirt-fix-callee-saved-function-elf-sizes.patch x86-boot-remove-multiple-copy-of-static-function-san.patch drm-nouveau-fix-memory-leak-in-nouveau_conn_reset.patch +kbuild-initialize-clang_flags-correctly-in-the-top-makefile.patch +btrfs-fix-incremental-send-failure-after-deduplication.patch +btrfs-fix-race-leading-to-fs-corruption-after-transaction-abort.patch +mmc-dw_mmc-fix-occasional-hang-after-tuning-on-emmc.patch +gpiolib-fix-incorrect-irq-requesting-of-an-active-low-lineevent.patch +ib-hfi1-fix-spectre-v1-vulnerability.patch +selinux-fix-memory-leak-in-policydb_init.patch +s390-dasd-fix-endless-loop-after-read-unit-address-configuration.patch +parisc-fix-build-of-compressed-kernel-even-with-debug-enabled.patch +drivers-perf-arm_pmu-fix-failure-path-in-pm-notifier.patch +nbd-replace-kill_bdev-with-__invalidate_device-again.patch +xen-swiotlb-fix-condition-for-calling-xen_destroy_contiguous_region.patch +ib-mlx5-fix-unreg_umr-to-ignore-the-mkey-state.patch +ib-mlx5-use-direct-mkey-destroy-command-upon-umr-unreg-failure.patch +ib-mlx5-move-mrs-to-a-kernel-pd-when-freeing-them-to-the-mr-cache.patch +ib-mlx5-fix-rss-toeplitz-setup-to-be-aligned-with-the-hw-specification.patch +ib-hfi1-check-for-error-on-call-to-alloc_rsm_map_table.patch diff --git a/queue-4.14/xen-swiotlb-fix-condition-for-calling-xen_destroy_contiguous_region.patch b/queue-4.14/xen-swiotlb-fix-condition-for-calling-xen_destroy_contiguous_region.patch new file mode 100644 index 00000000000..f56a81c8da9 --- /dev/null +++ b/queue-4.14/xen-swiotlb-fix-condition-for-calling-xen_destroy_contiguous_region.patch @@ -0,0 +1,44 @@ +From 50f6393f9654c561df4cdcf8e6cfba7260143601 Mon Sep 17 00:00:00 2001 +From: Juergen Gross +Date: Fri, 14 Jun 2019 07:46:02 +0200 +Subject: xen/swiotlb: fix condition for calling xen_destroy_contiguous_region() + +From: Juergen Gross + +commit 50f6393f9654c561df4cdcf8e6cfba7260143601 upstream. + +The condition in xen_swiotlb_free_coherent() for deciding whether to +call xen_destroy_contiguous_region() is wrong: in case the region to +be freed is not contiguous calling xen_destroy_contiguous_region() is +the wrong thing to do: it would result in inconsistent mappings of +multiple PFNs to the same MFN. This will lead to various strange +crashes or data corruption. + +Instead of calling xen_destroy_contiguous_region() in that case a +warning should be issued as that situation should never occur. + +Cc: stable@vger.kernel.org +Signed-off-by: Juergen Gross +Reviewed-by: Boris Ostrovsky +Reviewed-by: Jan Beulich +Acked-by: Konrad Rzeszutek Wilk +Signed-off-by: Juergen Gross +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/xen/swiotlb-xen.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/xen/swiotlb-xen.c ++++ b/drivers/xen/swiotlb-xen.c +@@ -371,8 +371,8 @@ xen_swiotlb_free_coherent(struct device + /* Convert the size to actually allocated. */ + size = 1UL << (order + XEN_PAGE_SHIFT); + +- if (((dev_addr + size - 1 <= dma_mask)) || +- range_straddles_page_boundary(phys, size)) ++ if (!WARN_ON((dev_addr + size - 1 > dma_mask) || ++ range_straddles_page_boundary(phys, size))) + xen_destroy_contiguous_region(phys, order); + + xen_free_coherent_pages(hwdev, size, vaddr, (dma_addr_t)phys, attrs);