From: Greg Kroah-Hartman Date: Tue, 6 Jan 2026 15:34:44 +0000 (+0100) Subject: 6.6-stable patches X-Git-Tag: v6.12.64~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3090cecdeb68c7b0e237c70797f2ae34b9b4dc3c;p=thirdparty%2Fkernel%2Fstable-queue.git 6.6-stable patches added patches: blk-mq-add-helper-for-checking-if-one-cpu-is-mapped-to-specified-hctx.patch usb-gadget-lpc32xx_udc-fix-clock-imbalance-in-error-path.patch --- diff --git a/queue-6.6/blk-mq-add-helper-for-checking-if-one-cpu-is-mapped-to-specified-hctx.patch b/queue-6.6/blk-mq-add-helper-for-checking-if-one-cpu-is-mapped-to-specified-hctx.patch new file mode 100644 index 0000000000..0d760d05d4 --- /dev/null +++ b/queue-6.6/blk-mq-add-helper-for-checking-if-one-cpu-is-mapped-to-specified-hctx.patch @@ -0,0 +1,71 @@ +From 7b815817aa58d2e2101feb2fcf64c60cae0b2695 Mon Sep 17 00:00:00 2001 +From: Ming Lei +Date: Fri, 17 May 2024 10:05:14 +0800 +Subject: blk-mq: add helper for checking if one CPU is mapped to specified hctx + +From: Ming Lei + +commit 7b815817aa58d2e2101feb2fcf64c60cae0b2695 upstream. + +Commit a46c27026da1 ("blk-mq: don't schedule block kworker on isolated CPUs") +rules out isolated CPUs from hctx->cpumask, and hctx->cpumask should only be +used for scheduling kworker. + +Add helper blk_mq_cpu_mapped_to_hctx() and apply it into cpuhp handlers. + +This patch avoids to forget clearing INACTIVE of hctx state in case that one +isolated CPU becomes online, and fixes hang issue when allocating request +from this hctx's tags. + +Cc: Raju Cheerla +Fixes: a46c27026da1 ("blk-mq: don't schedule block kworker on isolated CPUs") +Signed-off-by: Ming Lei +Link: https://lore.kernel.org/r/20240517020514.149771-1-ming.lei@redhat.com +Tested-by: Raju Cheerla +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +--- + block/blk-mq.c | 20 ++++++++++++++++++-- + 1 file changed, 18 insertions(+), 2 deletions(-) + +--- a/block/blk-mq.c ++++ b/block/blk-mq.c +@@ -3617,12 +3617,28 @@ static int blk_mq_hctx_notify_offline(un + return ret; + } + ++/* ++ * Check if one CPU is mapped to the specified hctx ++ * ++ * Isolated CPUs have been ruled out from hctx->cpumask, which is supposed ++ * to be used for scheduling kworker only. For other usage, please call this ++ * helper for checking if one CPU belongs to the specified hctx ++ */ ++static bool blk_mq_cpu_mapped_to_hctx(unsigned int cpu, ++ const struct blk_mq_hw_ctx *hctx) ++{ ++ struct blk_mq_hw_ctx *mapped_hctx = blk_mq_map_queue_type(hctx->queue, ++ hctx->type, cpu); ++ ++ return mapped_hctx == hctx; ++} ++ + static int blk_mq_hctx_notify_online(unsigned int cpu, struct hlist_node *node) + { + struct blk_mq_hw_ctx *hctx = hlist_entry_safe(node, + struct blk_mq_hw_ctx, cpuhp_online); + +- if (cpumask_test_cpu(cpu, hctx->cpumask)) ++ if (blk_mq_cpu_mapped_to_hctx(cpu, hctx)) + clear_bit(BLK_MQ_S_INACTIVE, &hctx->state); + return 0; + } +@@ -3640,7 +3656,7 @@ static int blk_mq_hctx_notify_dead(unsig + enum hctx_type type; + + hctx = hlist_entry_safe(node, struct blk_mq_hw_ctx, cpuhp_dead); +- if (!cpumask_test_cpu(cpu, hctx->cpumask)) ++ if (!blk_mq_cpu_mapped_to_hctx(cpu, hctx)) + return 0; + + ctx = __blk_mq_get_ctx(hctx->queue, cpu); diff --git a/queue-6.6/series b/queue-6.6/series index 5e9c1840cc..3f6fccd26a 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -623,3 +623,5 @@ drm-mgag200-fix-big-endian-support.patch drm-msm-dpu-add-missing-null-pointer-check-for-pingpong-interface.patch drm-i915-gem-zero-initialize-the-eb.vma-array-in-i915_gem_do_execbuffer.patch drm-nouveau-dispnv50-don-t-call-drm_atomic_get_crtc_state-in-prepare_fb.patch +usb-gadget-lpc32xx_udc-fix-clock-imbalance-in-error-path.patch +blk-mq-add-helper-for-checking-if-one-cpu-is-mapped-to-specified-hctx.patch diff --git a/queue-6.6/usb-gadget-lpc32xx_udc-fix-clock-imbalance-in-error-path.patch b/queue-6.6/usb-gadget-lpc32xx_udc-fix-clock-imbalance-in-error-path.patch new file mode 100644 index 0000000000..20d339bf12 --- /dev/null +++ b/queue-6.6/usb-gadget-lpc32xx_udc-fix-clock-imbalance-in-error-path.patch @@ -0,0 +1,103 @@ +From 782be79e4551550d7a82b1957fc0f7347e6d461f Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Thu, 18 Dec 2025 16:35:15 +0100 +Subject: usb: gadget: lpc32xx_udc: fix clock imbalance in error path + +From: Johan Hovold + +commit 782be79e4551550d7a82b1957fc0f7347e6d461f upstream. + +A recent change fixing a device reference leak introduced a clock +imbalance by reusing an error path so that the clock may be disabled +before having been enabled. + +Note that the clock framework allows for passing in NULL clocks so there +is no risk for a NULL pointer dereference. + +Also drop the bogus I2C client NULL check added by the offending commit +as the pointer has already been verified to be non-NULL. + +Fixes: c84117912bdd ("USB: lpc32xx_udc: Fix error handling in probe") +Cc: stable@vger.kernel.org +Cc: Ma Ke +Signed-off-by: Johan Hovold +Reviewed-by: Vladimir Zapolskiy +Link: https://patch.msgid.link/20251218153519.19453-2-johan@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/gadget/udc/lpc32xx_udc.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +--- a/drivers/usb/gadget/udc/lpc32xx_udc.c ++++ b/drivers/usb/gadget/udc/lpc32xx_udc.c +@@ -3027,7 +3027,7 @@ static int lpc32xx_udc_probe(struct plat + pdev->dev.dma_mask = &lpc32xx_usbd_dmamask; + retval = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); + if (retval) +- goto i2c_fail; ++ goto err_put_client; + + udc->board = &lpc32xx_usbddata; + +@@ -3047,7 +3047,7 @@ static int lpc32xx_udc_probe(struct plat + udc->udp_irq[i] = platform_get_irq(pdev, i); + if (udc->udp_irq[i] < 0) { + retval = udc->udp_irq[i]; +- goto i2c_fail; ++ goto err_put_client; + } + } + +@@ -3055,7 +3055,7 @@ static int lpc32xx_udc_probe(struct plat + if (IS_ERR(udc->udp_baseaddr)) { + dev_err(udc->dev, "IO map failure\n"); + retval = PTR_ERR(udc->udp_baseaddr); +- goto i2c_fail; ++ goto err_put_client; + } + + /* Get USB device clock */ +@@ -3063,14 +3063,14 @@ static int lpc32xx_udc_probe(struct plat + if (IS_ERR(udc->usb_slv_clk)) { + dev_err(udc->dev, "failed to acquire USB device clock\n"); + retval = PTR_ERR(udc->usb_slv_clk); +- goto i2c_fail; ++ goto err_put_client; + } + + /* Enable USB device clock */ + retval = clk_prepare_enable(udc->usb_slv_clk); + if (retval < 0) { + dev_err(udc->dev, "failed to start USB device clock\n"); +- goto i2c_fail; ++ goto err_put_client; + } + + /* Setup deferred workqueue data */ +@@ -3172,9 +3172,10 @@ dma_alloc_fail: + dma_free_coherent(&pdev->dev, UDCA_BUFF_SIZE, + udc->udca_v_base, udc->udca_p_base); + i2c_fail: +- if (udc->isp1301_i2c_client) +- put_device(&udc->isp1301_i2c_client->dev); + clk_disable_unprepare(udc->usb_slv_clk); ++err_put_client: ++ put_device(&udc->isp1301_i2c_client->dev); ++ + dev_err(udc->dev, "%s probe failed, %d\n", driver_name, retval); + + return retval; +@@ -3199,11 +3200,10 @@ static int lpc32xx_udc_remove(struct pla + dma_free_coherent(&pdev->dev, UDCA_BUFF_SIZE, + udc->udca_v_base, udc->udca_p_base); + +- if (udc->isp1301_i2c_client) +- put_device(&udc->isp1301_i2c_client->dev); +- + clk_disable_unprepare(udc->usb_slv_clk); + ++ put_device(&udc->isp1301_i2c_client->dev); ++ + return 0; + } +