From: Greg Kroah-Hartman Date: Thu, 27 Feb 2020 09:22:08 +0000 (+0100) Subject: 4.4-stable patches X-Git-Tag: v4.4.215~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b9b3d90df68f2d5358fdb1f34b537682518a2292;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: btrfs-fix-btrfs_wait_ordered_range-so-that-it-waits-for-all-ordered-extents.patch kvm-apic-avoid-calculating-pending-eoi-from-an-uninitialized-val.patch --- diff --git a/queue-4.4/btrfs-fix-btrfs_wait_ordered_range-so-that-it-waits-for-all-ordered-extents.patch b/queue-4.4/btrfs-fix-btrfs_wait_ordered_range-so-that-it-waits-for-all-ordered-extents.patch new file mode 100644 index 00000000000..82d7a859ed4 --- /dev/null +++ b/queue-4.4/btrfs-fix-btrfs_wait_ordered_range-so-that-it-waits-for-all-ordered-extents.patch @@ -0,0 +1,59 @@ +From e75fd33b3f744f644061a4f9662bd63f5434f806 Mon Sep 17 00:00:00 2001 +From: Filipe Manana +Date: Thu, 13 Feb 2020 12:29:50 +0000 +Subject: Btrfs: fix btrfs_wait_ordered_range() so that it waits for all ordered extents + +From: Filipe Manana + +commit e75fd33b3f744f644061a4f9662bd63f5434f806 upstream. + +In btrfs_wait_ordered_range() once we find an ordered extent that has +finished with an error we exit the loop and don't wait for any other +ordered extents that might be still in progress. + +All the users of btrfs_wait_ordered_range() expect that there are no more +ordered extents in progress after that function returns. So past fixes +such like the ones from the two following commits: + + ff612ba7849964 ("btrfs: fix panic during relocation after ENOSPC before + writeback happens") + + 28aeeac1dd3080 ("Btrfs: fix panic when starting bg cache writeout after + IO error") + +don't work when there are multiple ordered extents in the range. + +Fix that by making btrfs_wait_ordered_range() wait for all ordered extents +even after it finds one that had an error. + +Link: https://github.com/kdave/btrfs-progs/issues/228#issuecomment-569777554 +CC: stable@vger.kernel.org # 4.4+ +Reviewed-by: Qu Wenruo +Reviewed-by: Josef Bacik +Signed-off-by: Filipe Manana +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman + +--- + fs/btrfs/ordered-data.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/fs/btrfs/ordered-data.c ++++ b/fs/btrfs/ordered-data.c +@@ -820,10 +820,15 @@ int btrfs_wait_ordered_range(struct inod + } + btrfs_start_ordered_extent(inode, ordered, 1); + end = ordered->file_offset; ++ /* ++ * If the ordered extent had an error save the error but don't ++ * exit without waiting first for all other ordered extents in ++ * the range to complete. ++ */ + if (test_bit(BTRFS_ORDERED_IOERR, &ordered->flags)) + ret = -EIO; + btrfs_put_ordered_extent(ordered); +- if (ret || end == 0 || end == start) ++ if (end == 0 || end == start) + break; + end--; + } diff --git a/queue-4.4/kvm-apic-avoid-calculating-pending-eoi-from-an-uninitialized-val.patch b/queue-4.4/kvm-apic-avoid-calculating-pending-eoi-from-an-uninitialized-val.patch new file mode 100644 index 00000000000..0d878698297 --- /dev/null +++ b/queue-4.4/kvm-apic-avoid-calculating-pending-eoi-from-an-uninitialized-val.patch @@ -0,0 +1,38 @@ +From 23520b2def95205f132e167cf5b25c609975e959 Mon Sep 17 00:00:00 2001 +From: Miaohe Lin +Date: Fri, 21 Feb 2020 22:04:46 +0800 +Subject: KVM: apic: avoid calculating pending eoi from an uninitialized val + +From: Miaohe Lin + +commit 23520b2def95205f132e167cf5b25c609975e959 upstream. + +When pv_eoi_get_user() fails, 'val' may remain uninitialized and the return +value of pv_eoi_get_pending() becomes random. Fix the issue by initializing +the variable. + +Reviewed-by: Vitaly Kuznetsov +Signed-off-by: Miaohe Lin +Cc: stable@vger.kernel.org +Signed-off-by: Paolo Bonzini +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/kvm/lapic.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/arch/x86/kvm/lapic.c ++++ b/arch/x86/kvm/lapic.c +@@ -536,9 +536,11 @@ static inline bool pv_eoi_enabled(struct + static bool pv_eoi_get_pending(struct kvm_vcpu *vcpu) + { + u8 val; +- if (pv_eoi_get_user(vcpu, &val) < 0) ++ if (pv_eoi_get_user(vcpu, &val) < 0) { + apic_debug("Can't read EOI MSR value: 0x%llx\n", + (unsigned long long)vcpu->arch.pv_eoi.msr_val); ++ return false; ++ } + return val & 0x1; + } + diff --git a/queue-4.4/series b/queue-4.4/series index 1677b06db41..de34c417246 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -102,3 +102,5 @@ ext4-fix-a-data-race-in-ext4_i-inode-i_disksize.patch ext4-add-cond_resched-to-__ext4_find_entry.patch kvm-nvmx-refactor-io-bitmap-checks-into-helper-function.patch kvm-nvmx-check-io-instruction-vm-exit-conditions.patch +kvm-apic-avoid-calculating-pending-eoi-from-an-uninitialized-val.patch +btrfs-fix-btrfs_wait_ordered_range-so-that-it-waits-for-all-ordered-extents.patch