From: Greg Kroah-Hartman Date: Sun, 16 Oct 2022 16:24:48 +0000 (+0200) Subject: 5.15-stable patches X-Git-Tag: v5.4.219~82 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=60f761728cba95d0da96299a6db8d9c70cdbcfde;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: blk-wbt-call-rq_qos_add-after-wb_normal-is-initialized.patch drm-nouveau-fix-a-use-after-free-in-nouveau_gem_prime_import_sg_table.patch drm-nouveau-kms-nv140-disable-interlacing.patch efi-libstub-drop-pointless-get_memory_map-call.patch kvm-nvmx-don-t-propagate-vmcs12-s-perf_global_ctrl-settings-to-vmcs02.patch kvm-nvmx-unconditionally-purge-queued-injected-events-on-nested-exit.patch kvm-vmx-drop-bits-31-16-when-shoving-exception-error-code-into-vmcs.patch kvm-x86-emulator-fix-handing-of-pop-ss-to-correctly-set-interruptibility.patch media-cedrus-fix-endless-loop-in-cedrus_h265_skip_bits.patch media-cedrus-set-the-platform-driver-data-earlier.patch staging-greybus-audio_helper-remove-unused-and-wrong-debugfs-usage.patch --- diff --git a/queue-5.15/blk-wbt-call-rq_qos_add-after-wb_normal-is-initialized.patch b/queue-5.15/blk-wbt-call-rq_qos_add-after-wb_normal-is-initialized.patch new file mode 100644 index 00000000000..3f35215de23 --- /dev/null +++ b/queue-5.15/blk-wbt-call-rq_qos_add-after-wb_normal-is-initialized.patch @@ -0,0 +1,98 @@ +From 8c5035dfbb9475b67c82b3fdb7351236525bf52b Mon Sep 17 00:00:00 2001 +From: Yu Kuai +Date: Tue, 13 Sep 2022 18:57:49 +0800 +Subject: blk-wbt: call rq_qos_add() after wb_normal is initialized +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Yu Kuai + +commit 8c5035dfbb9475b67c82b3fdb7351236525bf52b upstream. + +Our test found a problem that wbt inflight counter is negative, which +will cause io hang(noted that this problem doesn't exist in mainline): + +t1: device create t2: issue io +add_disk + blk_register_queue + wbt_enable_default + wbt_init + rq_qos_add + // wb_normal is still 0 + /* + * in mainline, disk can't be opened before + * bdev_add(), however, in old kernels, disk + * can be opened before blk_register_queue(). + */ + blkdev_issue_flush + // disk size is 0, however, it's not checked + submit_bio_wait + submit_bio + blk_mq_submit_bio + rq_qos_throttle + wbt_wait + bio_to_wbt_flags + rwb_enabled + // wb_normal is 0, inflight is not increased + + wbt_queue_depth_changed(&rwb->rqos); + wbt_update_limits + // wb_normal is initialized + rq_qos_track + wbt_track + rq->wbt_flags |= bio_to_wbt_flags(rwb, bio); + // wb_normal is not 0,wbt_flags will be set +t3: io completion +blk_mq_free_request + rq_qos_done + wbt_done + wbt_is_tracked + // return true + __wbt_done + wbt_rqw_done + atomic_dec_return(&rqw->inflight); + // inflight is decreased + +commit 8235b5c1e8c1 ("block: call bdev_add later in device_add_disk") can +avoid this problem, however it's better to fix this problem in wbt: + +1) Lower kernel can't backport this patch due to lots of refactor. +2) Root cause is that wbt call rq_qos_add() before wb_normal is +initialized. + +Fixes: e34cbd307477 ("blk-wbt: add general throttling mechanism") +Cc: +Signed-off-by: Yu Kuai +Link: https://lore.kernel.org/r/20220913105749.3086243-1-yukuai1@huaweicloud.com +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +--- + block/blk-wbt.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +--- a/block/blk-wbt.c ++++ b/block/blk-wbt.c +@@ -843,6 +843,10 @@ int wbt_init(struct request_queue *q) + rwb->enable_state = WBT_STATE_ON_DEFAULT; + rwb->wc = 1; + rwb->rq_depth.default_depth = RWB_DEF_DEPTH; ++ rwb->min_lat_nsec = wbt_default_latency_nsec(q); ++ ++ wbt_queue_depth_changed(&rwb->rqos); ++ wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags)); + + /* + * Assign rwb and add the stats callback. +@@ -853,11 +857,6 @@ int wbt_init(struct request_queue *q) + + blk_stat_add_callback(q, rwb->cb); + +- rwb->min_lat_nsec = wbt_default_latency_nsec(q); +- +- wbt_queue_depth_changed(&rwb->rqos); +- wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags)); +- + return 0; + + err_free: diff --git a/queue-5.15/drm-nouveau-fix-a-use-after-free-in-nouveau_gem_prime_import_sg_table.patch b/queue-5.15/drm-nouveau-fix-a-use-after-free-in-nouveau_gem_prime_import_sg_table.patch new file mode 100644 index 00000000000..22a8a6cf9a3 --- /dev/null +++ b/queue-5.15/drm-nouveau-fix-a-use-after-free-in-nouveau_gem_prime_import_sg_table.patch @@ -0,0 +1,39 @@ +From 540dfd188ea2940582841c1c220bd035a7db0e51 Mon Sep 17 00:00:00 2001 +From: Jianglei Nie +Date: Tue, 5 Jul 2022 21:25:46 +0800 +Subject: drm/nouveau: fix a use-after-free in nouveau_gem_prime_import_sg_table() + +From: Jianglei Nie + +commit 540dfd188ea2940582841c1c220bd035a7db0e51 upstream. + +nouveau_bo_init() is backed by ttm_bo_init() and ferries its return code +back to the caller. On failures, ttm will call nouveau_bo_del_ttm() and +free the memory.Thus, when nouveau_bo_init() returns an error, the gem +object has already been released. Then the call to nouveau_bo_ref() will +use the freed "nvbo->bo" and lead to a use-after-free bug. + +We should delete the call to nouveau_bo_ref() to avoid the use-after-free. + +Signed-off-by: Jianglei Nie +Reviewed-by: Lyude Paul +Signed-off-by: Lyude Paul +Fixes: 019cbd4a4feb ("drm/nouveau: Initialize GEM object before TTM object") +Cc: Thierry Reding +Cc: # v5.4+ +Link: https://patchwork.freedesktop.org/patch/msgid/20220705132546.2247677-1-niejianglei2021@163.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/nouveau/nouveau_prime.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/gpu/drm/nouveau/nouveau_prime.c ++++ b/drivers/gpu/drm/nouveau/nouveau_prime.c +@@ -71,7 +71,6 @@ struct drm_gem_object *nouveau_gem_prime + ret = nouveau_bo_init(nvbo, size, align, NOUVEAU_GEM_DOMAIN_GART, + sg, robj); + if (ret) { +- nouveau_bo_ref(NULL, &nvbo); + obj = ERR_PTR(ret); + goto unlock; + } diff --git a/queue-5.15/drm-nouveau-kms-nv140-disable-interlacing.patch b/queue-5.15/drm-nouveau-kms-nv140-disable-interlacing.patch new file mode 100644 index 00000000000..3ec2d45dae5 --- /dev/null +++ b/queue-5.15/drm-nouveau-kms-nv140-disable-interlacing.patch @@ -0,0 +1,41 @@ +From 8ba9249396bef37cb68be9e8dee7847f1737db9d Mon Sep 17 00:00:00 2001 +From: Lyude Paul +Date: Tue, 16 Aug 2022 14:04:36 -0400 +Subject: drm/nouveau/kms/nv140-: Disable interlacing + +From: Lyude Paul + +commit 8ba9249396bef37cb68be9e8dee7847f1737db9d upstream. + +As it turns out: while Nvidia does actually have interlacing knobs on their +GPU still pretty much no current GPUs since Volta actually support it. +Trying interlacing on these GPUs will result in NVDisplay being quite +unhappy like so: + +nouveau 0000:1f:00.0: disp: chid 0 stat 00004802 reason 4 [INVALID_ARG] mthd 2008 data 00000001 code 00080000 +nouveau 0000:1f:00.0: disp: chid 0 stat 10005080 reason 5 [INVALID_STATE] mthd 0200 data 00000001 code 00000001 + +So let's fix this by following the same behavior Nvidia's driver does and +disable interlacing entirely. + +Signed-off-by: Lyude Paul +Cc: stable@vger.kernel.org +Reviewed-by: Karol Herbst +Link: https://patchwork.freedesktop.org/patch/msgid/20220816180436.156310-1-lyude@redhat.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/nouveau/nouveau_connector.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/nouveau/nouveau_connector.c ++++ b/drivers/gpu/drm/nouveau/nouveau_connector.c +@@ -503,7 +503,8 @@ nouveau_connector_set_encoder(struct drm + connector->interlace_allowed = + nv_encoder->caps.dp_interlace; + else +- connector->interlace_allowed = true; ++ connector->interlace_allowed = ++ drm->client.device.info.family < NV_DEVICE_INFO_V0_VOLTA; + connector->doublescan_allowed = true; + } else + if (nv_encoder->dcb->type == DCB_OUTPUT_LVDS || diff --git a/queue-5.15/efi-libstub-drop-pointless-get_memory_map-call.patch b/queue-5.15/efi-libstub-drop-pointless-get_memory_map-call.patch new file mode 100644 index 00000000000..da610beb440 --- /dev/null +++ b/queue-5.15/efi-libstub-drop-pointless-get_memory_map-call.patch @@ -0,0 +1,37 @@ +From d80ca810f096ff66f451e7a3ed2f0cd9ef1ff519 Mon Sep 17 00:00:00 2001 +From: Ard Biesheuvel +Date: Thu, 15 Sep 2022 19:00:24 +0200 +Subject: efi: libstub: drop pointless get_memory_map() call + +From: Ard Biesheuvel + +commit d80ca810f096ff66f451e7a3ed2f0cd9ef1ff519 upstream. + +Currently, the non-x86 stub code calls get_memory_map() redundantly, +given that the data it returns is never used anywhere. So drop the call. + +Cc: # v4.14+ +Fixes: 24d7c494ce46 ("efi/arm-stub: Round up FDT allocation to mapping size") +Signed-off-by: Ard Biesheuvel +Signed-off-by: Greg Kroah-Hartman +--- + drivers/firmware/efi/libstub/fdt.c | 8 -------- + 1 file changed, 8 deletions(-) + +--- a/drivers/firmware/efi/libstub/fdt.c ++++ b/drivers/firmware/efi/libstub/fdt.c +@@ -280,14 +280,6 @@ efi_status_t allocate_new_fdt_and_exit_b + goto fail; + } + +- /* +- * Now that we have done our final memory allocation (and free) +- * we can get the memory map key needed for exit_boot_services(). +- */ +- status = efi_get_memory_map(&map); +- if (status != EFI_SUCCESS) +- goto fail_free_new_fdt; +- + status = update_fdt((void *)fdt_addr, fdt_size, + (void *)*new_fdt_addr, MAX_FDT_SIZE, cmdline_ptr, + initrd_addr, initrd_size); diff --git a/queue-5.15/kvm-nvmx-don-t-propagate-vmcs12-s-perf_global_ctrl-settings-to-vmcs02.patch b/queue-5.15/kvm-nvmx-don-t-propagate-vmcs12-s-perf_global_ctrl-settings-to-vmcs02.patch new file mode 100644 index 00000000000..e34b88de0ea --- /dev/null +++ b/queue-5.15/kvm-nvmx-don-t-propagate-vmcs12-s-perf_global_ctrl-settings-to-vmcs02.patch @@ -0,0 +1,48 @@ +From def9d705c05eab3fdedeb10ad67907513b12038e Mon Sep 17 00:00:00 2001 +From: Sean Christopherson +Date: Tue, 30 Aug 2022 15:37:21 +0200 +Subject: KVM: nVMX: Don't propagate vmcs12's PERF_GLOBAL_CTRL settings to vmcs02 + +From: Sean Christopherson + +commit def9d705c05eab3fdedeb10ad67907513b12038e upstream. + +Don't propagate vmcs12's VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL to vmcs02. +KVM doesn't disallow L1 from using VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL +even when KVM itself doesn't use the control, e.g. due to the various +CPU errata that where the MSR can be corrupted on VM-Exit. + +Preserve KVM's (vmcs01) setting to hopefully avoid having to toggle the +bit in vmcs02 at a later point. E.g. if KVM is loading PERF_GLOBAL_CTRL +when running L1, then odds are good KVM will also load the MSR when +running L2. + +Fixes: 8bf00a529967 ("KVM: VMX: add support for switching of PERF_GLOBAL_CTRL") +Cc: stable@vger.kernel.org +Signed-off-by: Sean Christopherson +Signed-off-by: Vitaly Kuznetsov +Link: https://lore.kernel.org/r/20220830133737.1539624-18-vkuznets@redhat.com +Signed-off-by: Paolo Bonzini +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/kvm/vmx/nested.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/arch/x86/kvm/vmx/nested.c ++++ b/arch/x86/kvm/vmx/nested.c +@@ -2313,9 +2313,14 @@ static void prepare_vmcs02_early(struct + * are emulated by vmx_set_efer() in prepare_vmcs02(), but speculate + * on the related bits (if supported by the CPU) in the hope that + * we can avoid VMWrites during vmx_set_efer(). ++ * ++ * Similarly, take vmcs01's PERF_GLOBAL_CTRL in the hope that if KVM is ++ * loading PERF_GLOBAL_CTRL via the VMCS for L1, then KVM will want to ++ * do the same for L2. + */ + exec_control = __vm_entry_controls_get(vmcs01); +- exec_control |= vmcs12->vm_entry_controls; ++ exec_control |= (vmcs12->vm_entry_controls & ++ ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL); + exec_control &= ~(VM_ENTRY_IA32E_MODE | VM_ENTRY_LOAD_IA32_EFER); + if (cpu_has_load_ia32_efer()) { + if (guest_efer & EFER_LMA) diff --git a/queue-5.15/kvm-nvmx-unconditionally-purge-queued-injected-events-on-nested-exit.patch b/queue-5.15/kvm-nvmx-unconditionally-purge-queued-injected-events-on-nested-exit.patch new file mode 100644 index 00000000000..12b4c4227ec --- /dev/null +++ b/queue-5.15/kvm-nvmx-unconditionally-purge-queued-injected-events-on-nested-exit.patch @@ -0,0 +1,72 @@ +From d953540430c5af57f5de97ea9e36253908204027 Mon Sep 17 00:00:00 2001 +From: Sean Christopherson +Date: Tue, 30 Aug 2022 23:15:48 +0000 +Subject: KVM: nVMX: Unconditionally purge queued/injected events on nested "exit" + +From: Sean Christopherson + +commit d953540430c5af57f5de97ea9e36253908204027 upstream. + +Drop pending exceptions and events queued for re-injection when leaving +nested guest mode, even if the "exit" is due to VM-Fail, SMI, or forced +by host userspace. Failure to purge events could result in an event +belonging to L2 being injected into L1. + +This _should_ never happen for VM-Fail as all events should be blocked by +nested_run_pending, but it's possible if KVM, not the L1 hypervisor, is +the source of VM-Fail when running vmcs02. + +SMI is a nop (barring unknown bugs) as recognition of SMI and thus entry +to SMM is blocked by pending exceptions and re-injected events. + +Forced exit is definitely buggy, but has likely gone unnoticed because +userspace probably follows the forced exit with KVM_SET_VCPU_EVENTS (or +some other ioctl() that purges the queue). + +Fixes: 4f350c6dbcb9 ("kvm: nVMX: Handle deferred early VMLAUNCH/VMRESUME failure properly") +Cc: stable@vger.kernel.org +Signed-off-by: Sean Christopherson +Reviewed-by: Jim Mattson +Reviewed-by: Maxim Levitsky +Link: https://lore.kernel.org/r/20220830231614.3580124-2-seanjc@google.com +Signed-off-by: Paolo Bonzini +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/kvm/vmx/nested.c | 19 +++++++++++-------- + 1 file changed, 11 insertions(+), 8 deletions(-) + +--- a/arch/x86/kvm/vmx/nested.c ++++ b/arch/x86/kvm/vmx/nested.c +@@ -4251,14 +4251,6 @@ static void prepare_vmcs12(struct kvm_vc + nested_vmx_abort(vcpu, + VMX_ABORT_SAVE_GUEST_MSR_FAIL); + } +- +- /* +- * Drop what we picked up for L2 via vmx_complete_interrupts. It is +- * preserved above and would only end up incorrectly in L1. +- */ +- vcpu->arch.nmi_injected = false; +- kvm_clear_exception_queue(vcpu); +- kvm_clear_interrupt_queue(vcpu); + } + + /* +@@ -4598,6 +4590,17 @@ void nested_vmx_vmexit(struct kvm_vcpu * + WARN_ON_ONCE(nested_early_check); + } + ++ /* ++ * Drop events/exceptions that were queued for re-injection to L2 ++ * (picked up via vmx_complete_interrupts()), as well as exceptions ++ * that were pending for L2. Note, this must NOT be hoisted above ++ * prepare_vmcs12(), events/exceptions queued for re-injection need to ++ * be captured in vmcs12 (see vmcs12_save_pending_event()). ++ */ ++ vcpu->arch.nmi_injected = false; ++ kvm_clear_exception_queue(vcpu); ++ kvm_clear_interrupt_queue(vcpu); ++ + vmx_switch_vmcs(vcpu, &vmx->vmcs01); + + /* Update any VMCS fields that might have changed while L2 ran */ diff --git a/queue-5.15/kvm-vmx-drop-bits-31-16-when-shoving-exception-error-code-into-vmcs.patch b/queue-5.15/kvm-vmx-drop-bits-31-16-when-shoving-exception-error-code-into-vmcs.patch new file mode 100644 index 00000000000..04c5ab57dd3 --- /dev/null +++ b/queue-5.15/kvm-vmx-drop-bits-31-16-when-shoving-exception-error-code-into-vmcs.patch @@ -0,0 +1,72 @@ +From eba9799b5a6efe2993cf92529608e4aa8163d73b Mon Sep 17 00:00:00 2001 +From: Sean Christopherson +Date: Tue, 30 Aug 2022 23:15:49 +0000 +Subject: KVM: VMX: Drop bits 31:16 when shoving exception error code into VMCS + +From: Sean Christopherson + +commit eba9799b5a6efe2993cf92529608e4aa8163d73b upstream. + +Deliberately truncate the exception error code when shoving it into the +VMCS (VM-Entry field for vmcs01 and vmcs02, VM-Exit field for vmcs12). +Intel CPUs are incapable of handling 32-bit error codes and will never +generate an error code with bits 31:16, but userspace can provide an +arbitrary error code via KVM_SET_VCPU_EVENTS. Failure to drop the bits +on exception injection results in failed VM-Entry, as VMX disallows +setting bits 31:16. Setting the bits on VM-Exit would at best confuse +L1, and at worse induce a nested VM-Entry failure, e.g. if L1 decided to +reinject the exception back into L2. + +Cc: stable@vger.kernel.org +Signed-off-by: Sean Christopherson +Reviewed-by: Jim Mattson +Reviewed-by: Maxim Levitsky +Link: https://lore.kernel.org/r/20220830231614.3580124-3-seanjc@google.com +Signed-off-by: Paolo Bonzini +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/kvm/vmx/nested.c | 11 ++++++++++- + arch/x86/kvm/vmx/vmx.c | 12 +++++++++++- + 2 files changed, 21 insertions(+), 2 deletions(-) + +--- a/arch/x86/kvm/vmx/nested.c ++++ b/arch/x86/kvm/vmx/nested.c +@@ -3826,7 +3826,16 @@ static void nested_vmx_inject_exception_ + u32 intr_info = nr | INTR_INFO_VALID_MASK; + + if (vcpu->arch.exception.has_error_code) { +- vmcs12->vm_exit_intr_error_code = vcpu->arch.exception.error_code; ++ /* ++ * Intel CPUs do not generate error codes with bits 31:16 set, ++ * and more importantly VMX disallows setting bits 31:16 in the ++ * injected error code for VM-Entry. Drop the bits to mimic ++ * hardware and avoid inducing failure on nested VM-Entry if L1 ++ * chooses to inject the exception back to L2. AMD CPUs _do_ ++ * generate "full" 32-bit error codes, so KVM allows userspace ++ * to inject exception error codes with bits 31:16 set. ++ */ ++ vmcs12->vm_exit_intr_error_code = (u16)vcpu->arch.exception.error_code; + intr_info |= INTR_INFO_DELIVER_CODE_MASK; + } + +--- a/arch/x86/kvm/vmx/vmx.c ++++ b/arch/x86/kvm/vmx/vmx.c +@@ -1676,7 +1676,17 @@ static void vmx_queue_exception(struct k + kvm_deliver_exception_payload(vcpu); + + if (has_error_code) { +- vmcs_write32(VM_ENTRY_EXCEPTION_ERROR_CODE, error_code); ++ /* ++ * Despite the error code being architecturally defined as 32 ++ * bits, and the VMCS field being 32 bits, Intel CPUs and thus ++ * VMX don't actually supporting setting bits 31:16. Hardware ++ * will (should) never provide a bogus error code, but AMD CPUs ++ * do generate error codes with bits 31:16 set, and so KVM's ++ * ABI lets userspace shove in arbitrary 32-bit values. Drop ++ * the upper bits to avoid VM-Fail, losing information that ++ * does't really exist is preferable to killing the VM. ++ */ ++ vmcs_write32(VM_ENTRY_EXCEPTION_ERROR_CODE, (u16)error_code); + intr_info |= INTR_INFO_DELIVER_CODE_MASK; + } + diff --git a/queue-5.15/kvm-x86-emulator-fix-handing-of-pop-ss-to-correctly-set-interruptibility.patch b/queue-5.15/kvm-x86-emulator-fix-handing-of-pop-ss-to-correctly-set-interruptibility.patch new file mode 100644 index 00000000000..b9cfc29b71d --- /dev/null +++ b/queue-5.15/kvm-x86-emulator-fix-handing-of-pop-ss-to-correctly-set-interruptibility.patch @@ -0,0 +1,34 @@ +From 6aa5c47c351b22c21205c87977c84809cd015fcf Mon Sep 17 00:00:00 2001 +From: Michal Luczaj +Date: Mon, 22 Aug 2022 00:06:47 +0200 +Subject: KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility + +From: Michal Luczaj + +commit 6aa5c47c351b22c21205c87977c84809cd015fcf upstream. + +The emulator checks the wrong variable while setting the CPU +interruptibility state, the target segment is embedded in the instruction +opcode, not the ModR/M register. Fix the condition. + +Signed-off-by: Michal Luczaj +Fixes: a5457e7bcf9a ("KVM: emulate: POP SS triggers a MOV SS shadow too") +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/all/20220821215900.1419215-1-mhal@rbox.co +Signed-off-by: Sean Christopherson +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/kvm/emulate.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/x86/kvm/emulate.c ++++ b/arch/x86/kvm/emulate.c +@@ -1936,7 +1936,7 @@ static int em_pop_sreg(struct x86_emulat + if (rc != X86EMUL_CONTINUE) + return rc; + +- if (ctxt->modrm_reg == VCPU_SREG_SS) ++ if (seg == VCPU_SREG_SS) + ctxt->interruptibility = KVM_X86_SHADOW_INT_MOV_SS; + if (ctxt->op_bytes > 2) + rsp_increment(ctxt, ctxt->op_bytes - 2); diff --git a/queue-5.15/media-cedrus-fix-endless-loop-in-cedrus_h265_skip_bits.patch b/queue-5.15/media-cedrus-fix-endless-loop-in-cedrus_h265_skip_bits.patch new file mode 100644 index 00000000000..4cd9fe82850 --- /dev/null +++ b/queue-5.15/media-cedrus-fix-endless-loop-in-cedrus_h265_skip_bits.patch @@ -0,0 +1,41 @@ +From 91db7a3fc7fe670cf1770a398a43bb4a1f776bf1 Mon Sep 17 00:00:00 2001 +From: Dmitry Osipenko +Date: Thu, 18 Aug 2022 22:33:08 +0200 +Subject: media: cedrus: Fix endless loop in cedrus_h265_skip_bits() + +From: Dmitry Osipenko + +commit 91db7a3fc7fe670cf1770a398a43bb4a1f776bf1 upstream. + +The busy status bit may never de-assert if number of programmed skip +bits is incorrect, resulting in a kernel hang because the bit is polled +endlessly in the code. Fix it by adding timeout for the bit-polling. +This problem is reproducible by setting the data_bit_offset field of +the HEVC slice params to a wrong value by userspace. + +Cc: stable@vger.kernel.org +Fixes: 7678c5462680 (media: cedrus: Fix decoding for some HEVC videos) +Reported-by: Nicolas Dufresne +Signed-off-by: Dmitry Osipenko +Signed-off-by: Nicolas Dufresne +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman +--- + drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c ++++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c +@@ -234,8 +234,9 @@ static void cedrus_h265_skip_bits(struct + cedrus_write(dev, VE_DEC_H265_TRIGGER, + VE_DEC_H265_TRIGGER_FLUSH_BITS | + VE_DEC_H265_TRIGGER_TYPE_N_BITS(tmp)); +- while (cedrus_read(dev, VE_DEC_H265_STATUS) & VE_DEC_H265_STATUS_VLD_BUSY) +- udelay(1); ++ ++ if (cedrus_wait_for(dev, VE_DEC_H265_STATUS, VE_DEC_H265_STATUS_VLD_BUSY)) ++ dev_err_ratelimited(dev->dev, "timed out waiting to skip bits\n"); + + count += tmp; + } diff --git a/queue-5.15/media-cedrus-set-the-platform-driver-data-earlier.patch b/queue-5.15/media-cedrus-set-the-platform-driver-data-earlier.patch new file mode 100644 index 00000000000..58f83d01fea --- /dev/null +++ b/queue-5.15/media-cedrus-set-the-platform-driver-data-earlier.patch @@ -0,0 +1,46 @@ +From 708938f8495147fe2e77a9a3e1015d8e6899323e Mon Sep 17 00:00:00 2001 +From: Dmitry Osipenko +Date: Thu, 18 Aug 2022 22:33:07 +0200 +Subject: media: cedrus: Set the platform driver data earlier + +From: Dmitry Osipenko + +commit 708938f8495147fe2e77a9a3e1015d8e6899323e upstream. + +The cedrus_hw_resume() crashes with NULL deference on driver probe if +runtime PM is disabled because it uses platform data that hasn't been +set up yet. Fix this by setting the platform data earlier during probe. + +Cc: stable@vger.kernel.org +Fixes: 50e761516f2b (media: platform: Add Cedrus VPU decoder driver) +Signed-off-by: Dmitry Osipenko +Signed-off-by: Nicolas Dufresne +Reviewed-by: Samuel Holland +Acked-by: Paul Kocialkowski +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman +--- + drivers/staging/media/sunxi/cedrus/cedrus.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/staging/media/sunxi/cedrus/cedrus.c ++++ b/drivers/staging/media/sunxi/cedrus/cedrus.c +@@ -369,6 +369,8 @@ static int cedrus_probe(struct platform_ + if (!dev) + return -ENOMEM; + ++ platform_set_drvdata(pdev, dev); ++ + dev->vfd = cedrus_video_device; + dev->dev = &pdev->dev; + dev->pdev = pdev; +@@ -440,8 +442,6 @@ static int cedrus_probe(struct platform_ + goto err_m2m_mc; + } + +- platform_set_drvdata(pdev, dev); +- + return 0; + + err_m2m_mc: diff --git a/queue-5.15/series b/queue-5.15/series index 759a8b74c83..75ba8c5f95f 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -116,3 +116,14 @@ tracing-move-duplicate-code-of-trace_kprobe-eprobe.c-into-header.patch tracing-add-fault-name-injection-to-kernel-probes.patch tracing-fix-reading-strings-from-synthetic-events.patch thunderbolt-explicitly-enable-lane-adapter-hotplug-events-at-startup.patch +efi-libstub-drop-pointless-get_memory_map-call.patch +media-cedrus-set-the-platform-driver-data-earlier.patch +media-cedrus-fix-endless-loop-in-cedrus_h265_skip_bits.patch +blk-wbt-call-rq_qos_add-after-wb_normal-is-initialized.patch +kvm-x86-emulator-fix-handing-of-pop-ss-to-correctly-set-interruptibility.patch +kvm-nvmx-unconditionally-purge-queued-injected-events-on-nested-exit.patch +kvm-nvmx-don-t-propagate-vmcs12-s-perf_global_ctrl-settings-to-vmcs02.patch +kvm-vmx-drop-bits-31-16-when-shoving-exception-error-code-into-vmcs.patch +staging-greybus-audio_helper-remove-unused-and-wrong-debugfs-usage.patch +drm-nouveau-kms-nv140-disable-interlacing.patch +drm-nouveau-fix-a-use-after-free-in-nouveau_gem_prime_import_sg_table.patch diff --git a/queue-5.15/staging-greybus-audio_helper-remove-unused-and-wrong-debugfs-usage.patch b/queue-5.15/staging-greybus-audio_helper-remove-unused-and-wrong-debugfs-usage.patch new file mode 100644 index 00000000000..a24811dbae8 --- /dev/null +++ b/queue-5.15/staging-greybus-audio_helper-remove-unused-and-wrong-debugfs-usage.patch @@ -0,0 +1,66 @@ +From d517cdeb904ddc0cbebcc959d43596426cac40b0 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Fri, 2 Sep 2022 16:37:15 +0200 +Subject: staging: greybus: audio_helper: remove unused and wrong debugfs usage + +From: Greg Kroah-Hartman + +commit d517cdeb904ddc0cbebcc959d43596426cac40b0 upstream. + +In the greybus audio_helper code, the debugfs file for the dapm has the +potential to be removed and memory will be leaked. There is also the +very real potential for this code to remove ALL debugfs entries from the +system, and it seems like this is what will really happen if this code +ever runs. This all is very wrong as the greybus audio driver did not +create this debugfs file, the sound core did and controls the lifespan +of it. + +So remove all of the debugfs logic from the audio_helper code as there's +no way it could be correct. If this really is needed, it can come back +with a fixup for the incorrect usage of the debugfs_lookup() call which +is what caused this to be noticed at all. + +Cc: Johan Hovold +Cc: Alex Elder +Cc: Greg Kroah-Hartman +Cc: stable +Link: https://lore.kernel.org/r/20220902143715.320500-1-gregkh@linuxfoundation.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/staging/greybus/audio_helper.c | 11 ----------- + 1 file changed, 11 deletions(-) + +--- a/drivers/staging/greybus/audio_helper.c ++++ b/drivers/staging/greybus/audio_helper.c +@@ -3,7 +3,6 @@ + * Greybus Audio Sound SoC helper APIs + */ + +-#include + #include + #include + #include +@@ -116,10 +115,6 @@ int gbaudio_dapm_free_controls(struct sn + { + int i; + struct snd_soc_dapm_widget *w, *next_w; +-#ifdef CONFIG_DEBUG_FS +- struct dentry *parent = dapm->debugfs_dapm; +- struct dentry *debugfs_w = NULL; +-#endif + + mutex_lock(&dapm->card->dapm_mutex); + for (i = 0; i < num; i++) { +@@ -139,12 +134,6 @@ int gbaudio_dapm_free_controls(struct sn + continue; + } + widget++; +-#ifdef CONFIG_DEBUG_FS +- if (!parent) +- debugfs_w = debugfs_lookup(w->name, parent); +- debugfs_remove(debugfs_w); +- debugfs_w = NULL; +-#endif + gbaudio_dapm_free_widget(w); + } + mutex_unlock(&dapm->card->dapm_mutex);