From 6e5347de565544b5ee296b0266a130dc37e59dfa Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 28 Feb 2021 15:02:46 +0100 Subject: [PATCH] 5.4-stable patches added patches: alsa-usb-audio-fix-pcm-buffer-allocation-in-non-vmalloc-mode.patch bfq-avoid-false-bfq-queue-merging.patch debugfs-be-more-robust-at-handling-improper-input-in-debugfs_lookup.patch debugfs-do-not-attempt-to-create-a-new-file-before-the-filesystem-is-initalized.patch kdb-make-memory-allocations-more-robust.patch mips-vmlinux.lds.s-add-missing-page_aligned_data-section.patch pci-decline-to-resize-resources-if-boot-config-must-be-preserved.patch pci-qcom-use-phy_refclk_use_pad-only-for-ipq8064.patch random-fix-the-rndreseedcrng-ioctl.patch virt-vbox-do-not-use-wait_event_interruptible-when-called-from-kernel-context.patch --- ...uffer-allocation-in-non-vmalloc-mode.patch | 41 ++++++++++++ .../bfq-avoid-false-bfq-queue-merging.patch | 55 ++++++++++++++++ ...ing-improper-input-in-debugfs_lookup.patch | 37 +++++++++++ ...-before-the-filesystem-is-initalized.patch | 36 ++++++++++ ...-make-memory-allocations-more-robust.patch | 40 +++++++++++ ...dd-missing-page_aligned_data-section.patch | 66 +++++++++++++++++++ ...ces-if-boot-config-must-be-preserved.patch | 42 ++++++++++++ ...-phy_refclk_use_pad-only-for-ipq8064.patch | 40 +++++++++++ .../random-fix-the-rndreseedcrng-ioctl.patch | 38 +++++++++++ queue-5.4/series | 10 +++ ...ible-when-called-from-kernel-context.patch | 66 +++++++++++++++++++ 11 files changed, 471 insertions(+) create mode 100644 queue-5.4/alsa-usb-audio-fix-pcm-buffer-allocation-in-non-vmalloc-mode.patch create mode 100644 queue-5.4/bfq-avoid-false-bfq-queue-merging.patch create mode 100644 queue-5.4/debugfs-be-more-robust-at-handling-improper-input-in-debugfs_lookup.patch create mode 100644 queue-5.4/debugfs-do-not-attempt-to-create-a-new-file-before-the-filesystem-is-initalized.patch create mode 100644 queue-5.4/kdb-make-memory-allocations-more-robust.patch create mode 100644 queue-5.4/mips-vmlinux.lds.s-add-missing-page_aligned_data-section.patch create mode 100644 queue-5.4/pci-decline-to-resize-resources-if-boot-config-must-be-preserved.patch create mode 100644 queue-5.4/pci-qcom-use-phy_refclk_use_pad-only-for-ipq8064.patch create mode 100644 queue-5.4/random-fix-the-rndreseedcrng-ioctl.patch create mode 100644 queue-5.4/virt-vbox-do-not-use-wait_event_interruptible-when-called-from-kernel-context.patch diff --git a/queue-5.4/alsa-usb-audio-fix-pcm-buffer-allocation-in-non-vmalloc-mode.patch b/queue-5.4/alsa-usb-audio-fix-pcm-buffer-allocation-in-non-vmalloc-mode.patch new file mode 100644 index 00000000000..fbc816c6d39 --- /dev/null +++ b/queue-5.4/alsa-usb-audio-fix-pcm-buffer-allocation-in-non-vmalloc-mode.patch @@ -0,0 +1,41 @@ +From fb3c293b82c31a9a68fbcf4e7a45fadd8a47ea2b Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Fri, 5 Feb 2021 15:45:59 +0100 +Subject: ALSA: usb-audio: Fix PCM buffer allocation in non-vmalloc mode + +From: Takashi Iwai + +commit fb3c293b82c31a9a68fbcf4e7a45fadd8a47ea2b upstream. + +The commit f274baa49be6 ("ALSA: usb-audio: Allow non-vmalloc buffer +for PCM buffers") introduced the mode to allocate coherent pages for +PCM buffers, and it used bus->controller device as its DMA device. +It turned out, however, that bus->sysdev is a more appropriate device +to be used for DMA mapping in HCD code. + +This patch corrects the device reference accordingly. + +Note that, on most platforms, both point to the very same device, +hence this patch doesn't change anything practically. But on +platforms like xhcd-plat hcd, the change becomes effective. + +Fixes: f274baa49be6 ("ALSA: usb-audio: Allow non-vmalloc buffer for PCM buffers") +Cc: +Link: https://lore.kernel.org/r/20210205144559.29555-1-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/usb/pcm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sound/usb/pcm.c ++++ b/sound/usb/pcm.c +@@ -1885,7 +1885,7 @@ void snd_usb_preallocate_buffer(struct s + { + struct snd_pcm *pcm = subs->stream->pcm; + struct snd_pcm_substream *s = pcm->streams[subs->direction].substream; +- struct device *dev = subs->dev->bus->controller; ++ struct device *dev = subs->dev->bus->sysdev; + + if (!snd_usb_use_vmalloc) + snd_pcm_lib_preallocate_pages(s, SNDRV_DMA_TYPE_DEV_SG, diff --git a/queue-5.4/bfq-avoid-false-bfq-queue-merging.patch b/queue-5.4/bfq-avoid-false-bfq-queue-merging.patch new file mode 100644 index 00000000000..a109e03f82b --- /dev/null +++ b/queue-5.4/bfq-avoid-false-bfq-queue-merging.patch @@ -0,0 +1,55 @@ +From 41e76c85660c022c6bf5713bfb6c21e64a487cec Mon Sep 17 00:00:00 2001 +From: Jan Kara +Date: Fri, 5 Jun 2020 16:16:16 +0200 +Subject: bfq: Avoid false bfq queue merging + +From: Jan Kara + +commit 41e76c85660c022c6bf5713bfb6c21e64a487cec upstream. + +bfq_setup_cooperator() uses bfqd->in_serv_last_pos so detect whether it +makes sense to merge current bfq queue with the in-service queue. +However if the in-service queue is freshly scheduled and didn't dispatch +any requests yet, bfqd->in_serv_last_pos is stale and contains value +from the previously scheduled bfq queue which can thus result in a bogus +decision that the two queues should be merged. This bug can be observed +for example with the following fio jobfile: + +[global] +direct=0 +ioengine=sync +invalidate=1 +size=1g +rw=read + +[reader] +numjobs=4 +directory=/mnt + +where the 4 processes will end up in the one shared bfq queue although +they do IO to physically very distant files (for some reason I was able to +observe this only with slice_idle=1ms setting). + +Fix the problem by invalidating bfqd->in_serv_last_pos when switching +in-service queue. + +Fixes: 058fdecc6de7 ("block, bfq: fix in-service-queue check for queue merging") +CC: stable@vger.kernel.org +Signed-off-by: Jan Kara +Acked-by: Paolo Valente +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +--- + block/bfq-iosched.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/block/bfq-iosched.c ++++ b/block/bfq-iosched.c +@@ -2937,6 +2937,7 @@ static void __bfq_set_in_service_queue(s + } + + bfqd->in_service_queue = bfqq; ++ bfqd->in_serv_last_pos = 0; + } + + /* diff --git a/queue-5.4/debugfs-be-more-robust-at-handling-improper-input-in-debugfs_lookup.patch b/queue-5.4/debugfs-be-more-robust-at-handling-improper-input-in-debugfs_lookup.patch new file mode 100644 index 00000000000..0731489020a --- /dev/null +++ b/queue-5.4/debugfs-be-more-robust-at-handling-improper-input-in-debugfs_lookup.patch @@ -0,0 +1,37 @@ +From bc6de804d36b3709d54fa22bd128cbac91c11526 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Thu, 18 Feb 2021 11:08:17 +0100 +Subject: debugfs: be more robust at handling improper input in debugfs_lookup() + +From: Greg Kroah-Hartman + +commit bc6de804d36b3709d54fa22bd128cbac91c11526 upstream. + +debugfs_lookup() doesn't like it if it is passed an illegal name +pointer, or if the filesystem isn't even initialized yet. If either of +these happen, it will crash the system, so fix it up by properly testing +for valid input and that we are up and running before trying to find a +file in the filesystem. + +Cc: "Rafael J. Wysocki" +Cc: stable +Reported-by: Michael Walle +Tested-by: Michael Walle +Tested-by: Marc Zyngier +Link: https://lore.kernel.org/r/20210218100818.3622317-1-gregkh@linuxfoundation.org +Signed-off-by: Greg Kroah-Hartman +--- + fs/debugfs/inode.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/debugfs/inode.c ++++ b/fs/debugfs/inode.c +@@ -293,7 +293,7 @@ struct dentry *debugfs_lookup(const char + { + struct dentry *dentry; + +- if (IS_ERR(parent)) ++ if (!debugfs_initialized() || IS_ERR_OR_NULL(name) || IS_ERR(parent)) + return NULL; + + if (!parent) diff --git a/queue-5.4/debugfs-do-not-attempt-to-create-a-new-file-before-the-filesystem-is-initalized.patch b/queue-5.4/debugfs-do-not-attempt-to-create-a-new-file-before-the-filesystem-is-initalized.patch new file mode 100644 index 00000000000..a66216ec612 --- /dev/null +++ b/queue-5.4/debugfs-do-not-attempt-to-create-a-new-file-before-the-filesystem-is-initalized.patch @@ -0,0 +1,36 @@ +From 56348560d495d2501e87db559a61de717cd3ab02 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Thu, 18 Feb 2021 11:08:18 +0100 +Subject: debugfs: do not attempt to create a new file before the filesystem is initalized + +From: Greg Kroah-Hartman + +commit 56348560d495d2501e87db559a61de717cd3ab02 upstream. + +Some subsystems want to add debugfs files at early boot, way before +debugfs is initialized. This seems to work somehow as the vfs layer +will not allow it to happen, but let's be explicit and test to ensure we +are properly up and running before allowing files to be created. + +Cc: "Rafael J. Wysocki" +Cc: stable +Reported-by: Michael Walle +Reported-by: Marc Zyngier +Link: https://lore.kernel.org/r/20210218100818.3622317-2-gregkh@linuxfoundation.org +Signed-off-by: Greg Kroah-Hartman +--- + fs/debugfs/inode.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/fs/debugfs/inode.c ++++ b/fs/debugfs/inode.c +@@ -315,6 +315,9 @@ static struct dentry *start_creating(con + struct dentry *dentry; + int error; + ++ if (!debugfs_initialized()) ++ return ERR_PTR(-ENOENT); ++ + pr_debug("creating file '%s'\n", name); + + if (IS_ERR(parent)) diff --git a/queue-5.4/kdb-make-memory-allocations-more-robust.patch b/queue-5.4/kdb-make-memory-allocations-more-robust.patch new file mode 100644 index 00000000000..f3e3f9f5e01 --- /dev/null +++ b/queue-5.4/kdb-make-memory-allocations-more-robust.patch @@ -0,0 +1,40 @@ +From 93f7a6d818deef69d0ba652d46bae6fbabbf365c Mon Sep 17 00:00:00 2001 +From: Sumit Garg +Date: Fri, 22 Jan 2021 16:35:56 +0530 +Subject: kdb: Make memory allocations more robust + +From: Sumit Garg + +commit 93f7a6d818deef69d0ba652d46bae6fbabbf365c upstream. + +Currently kdb uses in_interrupt() to determine whether its library +code has been called from the kgdb trap handler or from a saner calling +context such as driver init. This approach is broken because +in_interrupt() alone isn't able to determine kgdb trap handler entry from +normal task context. This can happen during normal use of basic features +such as breakpoints and can also be trivially reproduced using: +echo g > /proc/sysrq-trigger + +We can improve this by adding check for in_dbg_master() instead which +explicitly determines if we are running in debugger context. + +Cc: stable@vger.kernel.org +Signed-off-by: Sumit Garg +Link: https://lore.kernel.org/r/1611313556-4004-1-git-send-email-sumit.garg@linaro.org +Signed-off-by: Daniel Thompson +Signed-off-by: Greg Kroah-Hartman +--- + kernel/debug/kdb/kdb_private.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/kernel/debug/kdb/kdb_private.h ++++ b/kernel/debug/kdb/kdb_private.h +@@ -233,7 +233,7 @@ extern struct task_struct *kdb_curr_task + #define kdb_do_each_thread(g, p) do_each_thread(g, p) + #define kdb_while_each_thread(g, p) while_each_thread(g, p) + +-#define GFP_KDB (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL) ++#define GFP_KDB (in_dbg_master() ? GFP_ATOMIC : GFP_KERNEL) + + extern void *debug_kmalloc(size_t size, gfp_t flags); + extern void debug_kfree(void *); diff --git a/queue-5.4/mips-vmlinux.lds.s-add-missing-page_aligned_data-section.patch b/queue-5.4/mips-vmlinux.lds.s-add-missing-page_aligned_data-section.patch new file mode 100644 index 00000000000..60961a2dfb8 --- /dev/null +++ b/queue-5.4/mips-vmlinux.lds.s-add-missing-page_aligned_data-section.patch @@ -0,0 +1,66 @@ +From 8ac7c87acdcac156670f9920c8acbd84308ff4b1 Mon Sep 17 00:00:00 2001 +From: Alexander Lobakin +Date: Sun, 10 Jan 2021 11:56:08 +0000 +Subject: MIPS: vmlinux.lds.S: add missing PAGE_ALIGNED_DATA() section + +From: Alexander Lobakin + +commit 8ac7c87acdcac156670f9920c8acbd84308ff4b1 upstream. + +MIPS uses its own declaration of rwdata, and thus it should be kept +in sync with the asm-generic one. Currently PAGE_ALIGNED_DATA() is +missing from the linker script, which emits the following ld +warnings: + +mips-alpine-linux-musl-ld: warning: orphan section +`.data..page_aligned' from `arch/mips/kernel/vdso.o' being placed +in section `.data..page_aligned' +mips-alpine-linux-musl-ld: warning: orphan section +`.data..page_aligned' from `arch/mips/vdso/vdso-image.o' being placed +in section `.data..page_aligned' + +Add the necessary declaration, so the mentioned structures will be +placed in vmlinux as intended: + +ffffffff80630580 D __end_once +ffffffff80630580 D __start___dyndbg +ffffffff80630580 D __start_once +ffffffff80630580 D __stop___dyndbg +ffffffff80634000 d mips_vdso_data +ffffffff80638000 d vdso_data +ffffffff80638580 D _gp +ffffffff8063c000 T __init_begin +ffffffff8063c000 D _edata +ffffffff8063c000 T _sinittext + +-> + +ffffffff805a4000 D __end_init_task +ffffffff805a4000 D __nosave_begin +ffffffff805a4000 D __nosave_end +ffffffff805a4000 d mips_vdso_data +ffffffff805a8000 d vdso_data +ffffffff805ac000 D mmlist_lock +ffffffff805ac080 D tasklist_lock + +Fixes: ebb5e78cc634 ("MIPS: Initial implementation of a VDSO") +Signed-off-by: Alexander Lobakin +Reviewed-by: Kees Cook +Reviewed-by: Nathan Chancellor +Cc: stable@vger.kernel.org # 4.4+ +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Greg Kroah-Hartman +--- + arch/mips/kernel/vmlinux.lds.S | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/mips/kernel/vmlinux.lds.S ++++ b/arch/mips/kernel/vmlinux.lds.S +@@ -93,6 +93,7 @@ SECTIONS + + INIT_TASK_DATA(THREAD_SIZE) + NOSAVE_DATA ++ PAGE_ALIGNED_DATA(PAGE_SIZE) + CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT) + READ_MOSTLY_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT) + DATA_DATA diff --git a/queue-5.4/pci-decline-to-resize-resources-if-boot-config-must-be-preserved.patch b/queue-5.4/pci-decline-to-resize-resources-if-boot-config-must-be-preserved.patch new file mode 100644 index 00000000000..d2f98354a82 --- /dev/null +++ b/queue-5.4/pci-decline-to-resize-resources-if-boot-config-must-be-preserved.patch @@ -0,0 +1,42 @@ +From 729e3a669d1b62e9876a671ac03ccba399a23b68 Mon Sep 17 00:00:00 2001 +From: Ard Biesheuvel +Date: Sat, 9 Jan 2021 10:53:53 +0100 +Subject: PCI: Decline to resize resources if boot config must be preserved + +From: Ard Biesheuvel + +commit 729e3a669d1b62e9876a671ac03ccba399a23b68 upstream. + +The _DSM #5 method in the ACPI host bridge object tells us whether the OS +must preserve the resource assignments done by firmware. If this is the +case, we should not permit drivers to resize BARs on the fly. Make +pci_resize_resource() take this into account. + +Link: https://lore.kernel.org/r/20210109095353.13417-1-ardb@kernel.org +Signed-off-by: Ard Biesheuvel +Signed-off-by: Bjorn Helgaas +Cc: stable@vger.kernel.org # v5.4+ +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/setup-res.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/pci/setup-res.c ++++ b/drivers/pci/setup-res.c +@@ -409,10 +409,16 @@ EXPORT_SYMBOL(pci_release_resource); + int pci_resize_resource(struct pci_dev *dev, int resno, int size) + { + struct resource *res = dev->resource + resno; ++ struct pci_host_bridge *host; + int old, ret; + u32 sizes; + u16 cmd; + ++ /* Check if we must preserve the firmware's resource assignment */ ++ host = pci_find_host_bridge(dev->bus); ++ if (host->preserve_config) ++ return -ENOTSUPP; ++ + /* Make sure the resource isn't assigned before resizing it. */ + if (!(res->flags & IORESOURCE_UNSET)) + return -EBUSY; diff --git a/queue-5.4/pci-qcom-use-phy_refclk_use_pad-only-for-ipq8064.patch b/queue-5.4/pci-qcom-use-phy_refclk_use_pad-only-for-ipq8064.patch new file mode 100644 index 00000000000..c517a70ca07 --- /dev/null +++ b/queue-5.4/pci-qcom-use-phy_refclk_use_pad-only-for-ipq8064.patch @@ -0,0 +1,40 @@ +From 2cfef1971aea6119ee27429181d6cb3383031ac2 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Mon, 19 Oct 2020 18:55:55 +0200 +Subject: PCI: qcom: Use PHY_REFCLK_USE_PAD only for ipq8064 + +From: Ansuel Smith + +commit 2cfef1971aea6119ee27429181d6cb3383031ac2 upstream. + +The use of PHY_REFCLK_USE_PAD introduced a regression for apq8064 devices. +It was tested that while apq doesn't require the padding, ipq SoC must use +it or the kernel hangs on boot. + +Link: https://lore.kernel.org/r/20201019165555.8269-1-ansuelsmth@gmail.com +Fixes: de3c4bf64897 ("PCI: qcom: Add support for tx term offset for rev 2.1.0") +Reported-by: Ilia Mirkin +Signed-off-by: Ilia Mirkin +Signed-off-by: Ansuel Smith +Signed-off-by: Lorenzo Pieralisi +Signed-off-by: Bjorn Helgaas +Acked-by: Stanimir Varbanov +Cc: stable@vger.kernel.org # v4.19+ +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/controller/dwc/pcie-qcom.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/pci/controller/dwc/pcie-qcom.c ++++ b/drivers/pci/controller/dwc/pcie-qcom.c +@@ -402,7 +402,9 @@ static int qcom_pcie_init_2_1_0(struct q + + /* enable external reference clock */ + val = readl(pcie->parf + PCIE20_PARF_PHY_REFCLK); +- val &= ~PHY_REFCLK_USE_PAD; ++ /* USE_PAD is required only for ipq806x */ ++ if (!of_device_is_compatible(node, "qcom,pcie-apq8064")) ++ val &= ~PHY_REFCLK_USE_PAD; + val |= PHY_REFCLK_SSP_EN; + writel(val, pcie->parf + PCIE20_PARF_PHY_REFCLK); + diff --git a/queue-5.4/random-fix-the-rndreseedcrng-ioctl.patch b/queue-5.4/random-fix-the-rndreseedcrng-ioctl.patch new file mode 100644 index 00000000000..fea6a79eeb0 --- /dev/null +++ b/queue-5.4/random-fix-the-rndreseedcrng-ioctl.patch @@ -0,0 +1,38 @@ +From 11a0b5e0ec8c13bef06f7414f9e914506140d5cb Mon Sep 17 00:00:00 2001 +From: Eric Biggers +Date: Tue, 12 Jan 2021 11:28:18 -0800 +Subject: random: fix the RNDRESEEDCRNG ioctl + +From: Eric Biggers + +commit 11a0b5e0ec8c13bef06f7414f9e914506140d5cb upstream. + +The RNDRESEEDCRNG ioctl reseeds the primary_crng from itself, which +doesn't make sense. Reseed it from the input_pool instead. + +Fixes: d848e5f8e1eb ("random: add new ioctl RNDRESEEDCRNG") +Cc: stable@vger.kernel.org +Cc: linux-crypto@vger.kernel.org +Cc: Andy Lutomirski +Cc: Jann Horn +Cc: Theodore Ts'o +Reviewed-by: Jann Horn +Acked-by: Ard Biesheuvel +Signed-off-by: Eric Biggers +Link: https://lore.kernel.org/r/20210112192818.69921-1-ebiggers@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/char/random.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/char/random.c ++++ b/drivers/char/random.c +@@ -2149,7 +2149,7 @@ static long random_ioctl(struct file *f, + return -EPERM; + if (crng_init < 2) + return -ENODATA; +- crng_reseed(&primary_crng, NULL); ++ crng_reseed(&primary_crng, &input_pool); + crng_global_init_time = jiffies - 1; + return 0; + default: diff --git a/queue-5.4/series b/queue-5.4/series index ba25511936e..507089936b3 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -1,2 +1,12 @@ vmlinux.lds.h-add-dwarf-v5-sections.patch kvm-x86-replace-kvm_spec_ctrl_test_value-with-runtime-test-on-the-host.patch +debugfs-be-more-robust-at-handling-improper-input-in-debugfs_lookup.patch +debugfs-do-not-attempt-to-create-a-new-file-before-the-filesystem-is-initalized.patch +kdb-make-memory-allocations-more-robust.patch +pci-qcom-use-phy_refclk_use_pad-only-for-ipq8064.patch +pci-decline-to-resize-resources-if-boot-config-must-be-preserved.patch +virt-vbox-do-not-use-wait_event_interruptible-when-called-from-kernel-context.patch +bfq-avoid-false-bfq-queue-merging.patch +alsa-usb-audio-fix-pcm-buffer-allocation-in-non-vmalloc-mode.patch +mips-vmlinux.lds.s-add-missing-page_aligned_data-section.patch +random-fix-the-rndreseedcrng-ioctl.patch diff --git a/queue-5.4/virt-vbox-do-not-use-wait_event_interruptible-when-called-from-kernel-context.patch b/queue-5.4/virt-vbox-do-not-use-wait_event_interruptible-when-called-from-kernel-context.patch new file mode 100644 index 00000000000..253d7a69ffb --- /dev/null +++ b/queue-5.4/virt-vbox-do-not-use-wait_event_interruptible-when-called-from-kernel-context.patch @@ -0,0 +1,66 @@ +From c35901b39ddc20077f4ae7b9f7bf344487f62212 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 21 Jan 2021 16:07:54 +0100 +Subject: virt: vbox: Do not use wait_event_interruptible when called from kernel context + +From: Hans de Goede + +commit c35901b39ddc20077f4ae7b9f7bf344487f62212 upstream. + +Do not use wait_event_interruptible when vbg_hgcm_call() gets called from +kernel-context, such as it being called by the vboxsf filesystem code. + +This fixes some filesystem related system calls on shared folders +unexpectedly failing with -EINTR. + +Fixes: 0532a1b0d045 ("virt: vbox: Implement passing requestor info to the host for VirtualBox 6.0.x") +Reported-by: Ludovic Pouzenc +Signed-off-by: Hans de Goede +Cc: stable +Link: https://lore.kernel.org/r/20210121150754.147598-1-hdegoede@redhat.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/virt/vboxguest/vboxguest_utils.c | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +--- a/drivers/virt/vboxguest/vboxguest_utils.c ++++ b/drivers/virt/vboxguest/vboxguest_utils.c +@@ -466,7 +466,7 @@ static int hgcm_cancel_call(struct vbg_d + * Cancellation fun. + */ + static int vbg_hgcm_do_call(struct vbg_dev *gdev, struct vmmdev_hgcm_call *call, +- u32 timeout_ms, bool *leak_it) ++ u32 timeout_ms, bool interruptible, bool *leak_it) + { + int rc, cancel_rc, ret; + long timeout; +@@ -493,10 +493,15 @@ static int vbg_hgcm_do_call(struct vbg_d + else + timeout = msecs_to_jiffies(timeout_ms); + +- timeout = wait_event_interruptible_timeout( +- gdev->hgcm_wq, +- hgcm_req_done(gdev, &call->header), +- timeout); ++ if (interruptible) { ++ timeout = wait_event_interruptible_timeout(gdev->hgcm_wq, ++ hgcm_req_done(gdev, &call->header), ++ timeout); ++ } else { ++ timeout = wait_event_timeout(gdev->hgcm_wq, ++ hgcm_req_done(gdev, &call->header), ++ timeout); ++ } + + /* timeout > 0 means hgcm_req_done has returned true, so success */ + if (timeout > 0) +@@ -629,7 +634,8 @@ int vbg_hgcm_call(struct vbg_dev *gdev, + hgcm_call_init_call(call, client_id, function, parms, parm_count, + bounce_bufs); + +- ret = vbg_hgcm_do_call(gdev, call, timeout_ms, &leak_it); ++ ret = vbg_hgcm_do_call(gdev, call, timeout_ms, ++ requestor & VMMDEV_REQUESTOR_USERMODE, &leak_it); + if (ret == 0) { + *vbox_status = call->header.result; + ret = hgcm_call_copy_back_result(call, parms, parm_count, -- 2.47.3