6.12.23-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 144/423 pinctrl: npcm8xx: Fix incorrect struct npcm8xx_pincfg assignment
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 113ec87b0f26a17b02c58aa2714a9b8f1020eed9 ]
Sparse is not happy about implementation of the NPCM8XX_PINCFG()
pinctrl-npcm8xx.c:1314:9: warning: obsolete array initializer, use C99 syntax pinctrl-npcm8xx.c:1315:9: warning: obsolete array initializer, use C99 syntax
...
pinctrl-npcm8xx.c:1412:9: warning: obsolete array initializer, use C99 syntax pinctrl-npcm8xx.c:1413:9: warning: too many warnings
which uses index-based assignment in a wrong way, i.e. it missed the equal sign and hence the index is simply ignored, while the entries are indexed naturally. This is not a problem as the pin numbering repeats the natural order, but it might be in case of shuffling the entries. Fix this by adding missed equal sign and reformat a bit for better readability.
--- drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c +4 -2
@@ -1290,12 +1290,14 @@ static struct npcm8xx_func npcm8xx_funcs[] = { };#define NPCM8XX_PINCFG (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) \ - [a] { .fn0 = fn_ ## b, .reg0 = NPCM8XX_GCR_ ## c, .bit0 = d, \ + [a] = { \ + .flag = q, \ + .fn0 = fn_ ## b, .reg0 = NPCM8XX_GCR_ ## c, .bit0 = d, \ .fn1 = fn_ ## e, .reg1 = NPCM8XX_GCR_ ## f, .bit1 = g, \ .fn2 = fn_ ## h, .reg2 = NPCM8XX_GCR_ ## i, .bit2 = j, \ .fn3 = fn_ ## k, .reg3 = NPCM8XX_GCR_ ## l, .bit3 = m, \ .fn4 = fn_ ## n, .reg4 = NPCM8XX_GCR_ ## o, .bit4 = p, \ - .flag = q } + }/* Drive strength controlled by NPCM8XX_GP_N_ODSC */ #define DRIVE_STRENGTH_LO_SHIFT 8
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 145/423 crypto: qat - remove access to parity register for QAT GEN4
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bairavi Alagappan <[email protected]>
[ Upstream commit 92c6a707d82f0629debf1c21dd87717776d96af2 ]
The firmware already handles parity errors reported by the accelerators by clearing them through the corresponding SSMSOFTERRORPARITY register. To ensure consistent behavior and prevent race conditions between the driver and firmware, remove the logic that checks the SSMSOFTERRORPARITY registers.
Additionally, change the return type of the function adf_handle_rf_parr_err() to void, as it consistently returns false. Parity errors are recoverable and do not necessitate a device reset.
--- .../intel/qat/qat_common/adf_gen4_ras.c | 57 ++----------------- 1 file changed, 5 insertions(+), 52 deletions(-)
drivers/crypto/intel/qat/qat_common/adf_gen4_ras.c +5 -52
@@ -1043,63 +1043,16 @@ static bool adf_handle_ssmcpppar_err(struct adf_accel_dev *accel_dev,return reset_required; } -static bool adf_handle_rf_parr_err (struct adf_accel_dev *accel_dev, +static void adf_handle_rf_parr_err (struct adf_accel_dev *accel_dev,void __iomem *csr,u32 iastatssm) { -struct adf_dev_err_mask *err_mask =GET_ERR_MASK (accel_dev); -u32 reg; -if (!(iastatssm &ADF_GEN4_IAINTSTATSSM_SSMSOFTERRORPARITY_BIT )) -return false; - - reg =ADF_CSR_RD (csr,ADF_GEN4_SSMSOFTERRORPARITY_SRC ); - reg &=ADF_GEN4_SSMSOFTERRORPARITY_SRC_BIT ; -if (reg) { -ADF_RAS_ERR_CTR_INC (accel_dev->ras_errors,ADF_RAS_UNCORR ); -ADF_CSR_WR (csr,ADF_GEN4_SSMSOFTERRORPARITY_SRC , reg); - } - - reg =ADF_CSR_RD (csr,ADF_GEN4_SSMSOFTERRORPARITY_ATH_CPH ); - reg &= err_mask->parerr_ath_cph_mask; -if (reg) { -ADF_RAS_ERR_CTR_INC (accel_dev->ras_errors,ADF_RAS_UNCORR ); -ADF_CSR_WR (csr,ADF_GEN4_SSMSOFTERRORPARITY_ATH_CPH , reg); - } - - reg =ADF_CSR_RD (csr,ADF_GEN4_SSMSOFTERRORPARITY_CPR_XLT ); - reg &= err_mask->parerr_cpr_xlt_mask; -if (reg) { -ADF_RAS_ERR_CTR_INC (accel_dev->ras_errors,ADF_RAS_UNCORR ); -ADF_CSR_WR (csr,ADF_GEN4_SSMSOFTERRORPARITY_CPR_XLT , reg); - } - - reg =ADF_CSR_RD (csr,ADF_GEN4_SSMSOFTERRORPARITY_DCPR_UCS ); - reg &= err_mask->parerr_dcpr_ucs_mask; -if (reg) { -ADF_RAS_ERR_CTR_INC (accel_dev->ras_errors,ADF_RAS_UNCORR ); -ADF_CSR_WR (csr,ADF_GEN4_SSMSOFTERRORPARITY_DCPR_UCS , reg); - } - - reg =ADF_CSR_RD (csr,ADF_GEN4_SSMSOFTERRORPARITY_PKE ); - reg &= err_mask->parerr_pke_mask; -if (reg) { -ADF_RAS_ERR_CTR_INC (accel_dev->ras_errors,ADF_RAS_UNCORR ); -ADF_CSR_WR (csr,ADF_GEN4_SSMSOFTERRORPARITY_PKE , reg); - } - -if (err_mask->parerr_wat_wcp_mask) { - reg =ADF_CSR_RD (csr,ADF_GEN4_SSMSOFTERRORPARITY_WAT_WCP ); - reg &= err_mask->parerr_wat_wcp_mask; -if (reg) { -ADF_RAS_ERR_CTR_INC (accel_dev->ras_errors,ADF_RAS_UNCORR ); -ADF_CSR_WR (csr,ADF_GEN4_SSMSOFTERRORPARITY_WAT_WCP , - reg); - } - } +return ; +ADF_RAS_ERR_CTR_INC (accel_dev->ras_errors,ADF_RAS_UNCORR );dev_err (&GET_DEV (accel_dev),"Slice ssm soft parity error reported" ); -return false; +return ; } static bool adf_handle_ser_err_ssmsh(struct adf_accel_dev *accel_dev,
@@ -1171,8 +1124,8 @@ static bool adf_handle_iaintstatssm(struct adf_accel_dev *accel_dev, reset_required |=adf_handle_slice_hang_error (accel_dev, csr, iastatssm); reset_required |=adf_handle_spppar_err (accel_dev, csr, iastatssm); reset_required |=adf_handle_ssmcpppar_err (accel_dev, csr, iastatssm); - reset_required |=adf_handle_rf_parr_err (accel_dev, csr, iastatssm); reset_required |=adf_handle_ser_err_ssmsh (accel_dev, csr, iastatssm); +adf_handle_rf_parr_err (accel_dev, csr, iastatssm);ADF_CSR_WR (csr,ADF_GEN4_IAINTSTATSSM , iastatssm);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 146/423 clk: clk-imx8mp-audiomix: fix dsp/ocram_a clock parents
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurentiu Mihalcea <[email protected]>
[ Upstream commit 91be7d27099dedf813b80702e4ca117d1fb38ce6 ]
The DSP and OCRAM_A modules from AUDIOMIX are clocked by AUDIO_AXI_CLK_ROOT, not AUDIO_AHB_CLK_ROOT. Update the clock data accordingly.
--- drivers/clk/imx/clk-imx8mp-audiomix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/imx/clk-imx8mp-audiomix.c +3 -3
@@ -180,14 +180,14 @@ static struct clk_imx8mp_audiomix_sel sels[] = {CLK_GATE ("asrc" ,ASRC_IPG ),CLK_GATE ("pdm" ,PDM_IPG ),CLK_GATE ("earc" ,EARC_IPG ), -CLK_GATE ("ocrama" ,OCRAMA_IPG ), +CLK_GATE_PARENT ("ocrama" ,OCRAMA_IPG ,"axi" ),CLK_GATE ("aud2htx" ,AUD2HTX_IPG ),CLK_GATE_PARENT ("earc_phy" ,EARC_PHY ,"sai_pll_out_div2" ),CLK_GATE ("sdma2" ,SDMA2_ROOT ),CLK_GATE ("sdma3" ,SDMA3_ROOT ),CLK_GATE ("spba2" ,SPBA2_ROOT ), -CLK_GATE ("dsp" ,DSP_ROOT ), -CLK_GATE ("dspdbg" ,DSPDBG_ROOT ), +CLK_GATE_PARENT ("dsp" ,DSP_ROOT ,"axi" ), +CLK_GATE_PARENT ("dspdbg" ,DSPDBG_ROOT ,"axi" ),CLK_GATE ("edma" ,EDMA_ROOT ),CLK_GATE_PARENT ("audpll" ,AUDPLL_ROOT ,"osc_24m" ), CLK_GATE("mu2", MU2_ROOT),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 147/423 clk: amlogic: g12a: fix mmc A peripheral clock
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Brunet <[email protected]>
[ Upstream commit 0079e77c08de692cb20b38e408365c830a44b1ef ]
The bit index of the peripheral clock for mmc A is wrong
This was probably not a problem for mmc A as the peripheral is likely left enabled by the bootloader.
No issues has been reported so far but it could be a problem, most likely some form of conflict between the ethernet and mmc A clock, breaking ethernet on init.
Use the value provided by the documentation for mmc A before this becomes an actual problem.
--- drivers/clk/meson/g12a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/meson/g12a.c +1 -1
@@ -4329,7 +4329,7 @@ static MESON_GATE(g12a_spicc_1, HHI_GCLK_MPEG0, 14); static MESON_GATE(g12a_hiu_reg, HHI_GCLK_MPEG0, 19); static MESON_GATE(g12a_mipi_dsi_phy, HHI_GCLK_MPEG0, 20); static MESON_GATE(g12a_assist_misc, HHI_GCLK_MPEG0, 23); -static MESON_GATE(g12a_emmc_a, HHI_GCLK_MPEG0, 4); +static MESON_GATE(g12a_emmc_a, HHI_GCLK_MPEG0, 24); static MESON_GATE(g12a_emmc_b, HHI_GCLK_MPEG0, 25); static MESON_GATE(g12a_emmc_c, HHI_GCLK_MPEG0, 26); static MESON_GATE(g12a_audio_codec, HHI_GCLK_MPEG0, 28);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 148/423 x86/entry: Fix ORC unwinder for PUSH_REGS with save_ret=1
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
[ Upstream commit 57e2428f8df8263275344566e02c277648a4b7f1 ]
PUSH_REGS with save_ret=1 is used by interrupt entry helper functions that initially start with a UNWIND_HINT_FUNC ORC state.
However, save_ret=1 means that we clobber the helper function's return address (and then later restore the return address further down on the stack); after that point, the only thing on the stack we can unwind through is the IRET frame, so use UNWIND_HINT_IRET_REGS until we have a full pt_regs frame.
( An alternate approach would be to move the pt_regs->di overwrite down
such that it is the final step of pt_regs setup; but I don't want to rearrange entry code just to make unwinding a tiny bit more elegant. )
--- arch/x86/entry/calling.h | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/entry/calling.h +2 -0
@@ -70,6 +70,8 @@ For 32-bit we have the following conventions - kernel is built with pushq %rsi /* pt_regs->si */ movq 8(%rsp), %rsi /* temporarily store the return address in %rsi */ movq %rdi, 8(%rsp) /* pt_regs->di (overwriting original return address) */ +/* We just clobbered the return address - use the IRET frame for unwinding: */ +UNWIND_HINT_IRET_REGS offset=3 *8 .else pushq %rdi /* pt_regs->di */ pushq %rsi/* pt_regs->si */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 149/423 power: supply: max77693: Fix wrong conversion of charge input threshold value
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artur Weber <[email protected]>
[ Upstream commit 30cc7b0d0e9341d419eb7da15fb5c22406dbe499 ]
The charge input threshold voltage register on the MAX77693 PMIC accepts four values: 0x0 for 4.3v, 0x1 for 4.7v, 0x2 for 4.8v and 0x3 for 4.9v. Due to an oversight, the driver calculated the values for 4.7v and above starting from 0x0, rather than from 0x1 ([(4700000 - 4700000) / 100000] gives 0).
Add 1 to the calculation to ensure that 4.7v is converted to a register value of 0x1 and that the other two voltages are converted correctly as well.
--- drivers/power/supply/max77693_charger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/max77693_charger.c +1 -1
@@ -608,7 +608,7 @@ static int max77693_set_charge_input_threshold_volt(struct max77693_charger *chgcase 4700000 :case 4800000 :case 4900000 : - data = (uvolt -4700000 ) /100000 ; + data = ((uvolt -4700000 ) /100000 ) +1 ;break ;default :dev_err (chg->dev,"Wrong value for charge input voltage regulation threshold\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 150/423 crypto: nx - Fix uninitialised hv_nxc on error
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
[ Upstream commit 9b00eb923f3e60ca76cbc8b31123716f3a87ac6a ]
The compiler correctly warns that hv_nxc may be used uninitialised as that will occur when NX-GZIP is unavailable.
Fix it by rearranging the code and delay setting caps_feat until the final query succeeds.
--- drivers/crypto/nx/nx-common-pseries.c | 37 ++++++++++++--------------- 1 file changed, 17 insertions(+), 20 deletions(-)
drivers/crypto/nx/nx-common-pseries.c +17 -20
@@ -1144,6 +1144,7 @@ static void __init nxcop_get_capabilities(void) {struct hv_vas_all_caps *hv_caps;struct hv_nx_cop_caps *hv_nxc; +u64 feat;int rc; hv_caps =kmalloc (sizeof (*hv_caps),GFP_KERNEL );
@@ -1154,27 +1155,26 @@ static void __init nxcop_get_capabilities(void)*/ rc =h_query_vas_capabilities (H_QUERY_NX_CAPABILITIES ,0 , (u64 )virt_to_phys (hv_caps)); +if (!rc) + feat =be64_to_cpu (hv_caps->feat_type); +kfree (hv_caps);if (rc) - goto out; +return ; +if (!(feat &VAS_NX_GZIP_FEAT_BIT )) +return ; - caps_feat =be64_to_cpu (hv_caps->feat_type);/* * NX-GZIP feature available */ -if (caps_feat &VAS_NX_GZIP_FEAT_BIT ) { - hv_nxc =kmalloc (sizeof (*hv_nxc),GFP_KERNEL ); -if (!hv_nxc) - goto out; -/* -* Get capabilities for NX-GZIP feature -*/ - rc =h_query_vas_capabilities (H_QUERY_NX_CAPABILITIES , -VAS_NX_GZIP_FEAT , - (u64 )virt_to_phys (hv_nxc)); - }else { -pr_err ("NX-GZIP feature is not available\n" ); - rc = -EINVAL ; - } + hv_nxc =kmalloc (sizeof (*hv_nxc),GFP_KERNEL ); +if (!hv_nxc) +return ; +/* +* Get capabilities for NX-GZIP feature +*/ + rc =h_query_vas_capabilities (H_QUERY_NX_CAPABILITIES , +VAS_NX_GZIP_FEAT , + (u64 )virt_to_phys (hv_nxc));if (!rc) { nx_cop_caps.descriptor =be64_to_cpu (hv_nxc->descriptor);
@@ -1184,13 +1184,10 @@ static void __init nxcop_get_capabilities(void)be64_to_cpu (hv_nxc->min_compress_len); nx_cop_caps.min_decompress_len =be64_to_cpu (hv_nxc->min_decompress_len); - }else { - caps_feat =0 ; + caps_feat = feat; }kfree (hv_nxc); -out: -kfree (hv_caps); }static const struct vio_device_id nx842_vio_driver_ids[] = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 151/423 clk: qcom: gcc-sm8650: Do not turn off USB GDSCs during gdsc_disable()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neil Armstrong <[email protected]>
[ Upstream commit 8b75c2973997e66fd897b7e87b5ba2f3d683e94b ]
With PWRSTS_OFF_ON, USB GDSCs are turned off during gdsc_disable(). This can happen during scenarios such as system suspend and breaks the resume of USB controller from suspend.
So use PWRSTS_RET_ON to indicate the GDSC driver to not turn off the GDSCs during gdsc_disable() and allow the hardware to transition the GDSCs to retention when the parent domain enters low power state during system suspend.
--- drivers/clk/qcom/gcc-sm8650.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/qcom/gcc-sm8650.c +2 -2
@@ -3497,7 +3497,7 @@ static struct gdsc usb30_prim_gdsc = { .pd = { .name = "usb30_prim_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE, };
@@ -3506,7 +3506,7 @@ static struct gdsc usb3_phy_gdsc = { .pd = { .name = "usb3_phy_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE, };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 152/423 bpf: Fix array bounds error with may_goto
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit 6ebc5030e0c5a698f1dd9a6684cddf6ccaed64a0 ]
may_goto uses an additional 8 bytes on the stack, which causes the interpreters[] array to go out of bounds when calculating index by stack_size.
1. If a BPF program is rewritten, re-evaluate the stack size. For non-JIT cases, reject loading directly.
2. For non-JIT cases, calculating interpreters[idx] may still cause out-of-bounds array access, and just warn about it.
3. For jit_requested cases, the execution of bpf_func also needs to be warned. So move the definition of function __bpf_prog_ret0_warn out of the macro definition CONFIG_BPF_JIT_ALWAYS_ON.
--- kernel/bpf/core.c | 19 +++++++++++++++---- kernel/bpf/verifier.c | 7 +++++++ 2 files changed, 22 insertions(+), 4 deletions(-)
kernel/bpf/core.c +15 -4
@@ -2290,17 +2290,18 @@ void bpf_patch_call_args(struct bpf_insn *insn, u32 stack_depth) insn->code =BPF_JMP |BPF_CALL_ARGS ; }#endif -#else +#endif +static unsigned int __bpf_prog_ret0_warn (const void *ctx,const struct bpf_insn *insn) {/* If this handler ever gets executed, then BPF_JIT_ALWAYS_ON -* is not working properly, so warn about it! +* is not working properly, or interpreter is being used when +* prog->jit_requested is not 0, so warn about it! */ WARN_ON_ONCE (1 );return 0 ; } -#endif bool bpf_prog_map_compatible (struct bpf_map *map,const struct bpf_prog *fp)
@@ -2380,8 +2381,18 @@ static void bpf_prog_select_func(struct bpf_prog *fp) {#ifndef CONFIG_BPF_JIT_ALWAYS_ON u32 stack_depth =max_t (u32, fp->aux->stack_depth,1 ); +u32 idx = (round_up (stack_depth,32 ) /32 ) -1 ; - fp->bpf_func = interpreters[(round_up (stack_depth,32 ) /32 ) -1 ]; +/* may_goto may cause stack size > 512, leading to idx out-of-bounds. +* But for non-JITed programs, we don't need bpf_func, so no bounds +* check needed. +*/ +if (!fp->jit_requested && + !WARN_ON_ONCE (idx >=ARRAY_SIZE (interpreters))) { + fp->bpf_func = interpreters[idx]; + }else { + fp->bpf_func = __bpf_prog_ret0_warn; + }#else fp->bpf_func = __bpf_prog_ret0_warn;#endif
kernel/bpf/verifier.c +7 -0
@@ -21276,6 +21276,13 @@ static int do_misc_fixups(struct bpf_verifier_env *env)if (subprogs[cur_subprog +1 ].start == i + delta +1 ) { subprogs[cur_subprog].stack_depth += stack_depth_extra; subprogs[cur_subprog].stack_extra = stack_depth_extra; + + stack_depth = subprogs[cur_subprog].stack_depth; +if (stack_depth >MAX_BPF_STACK && !prog->jit_requested) { +verbose (env,"stack size %d(extra %d) is too large\n" , + stack_depth, stack_depth_extra); +return -EINVAL ; + } cur_subprog++; stack_depth = subprogs[cur_subprog].stack_depth; stack_depth_extra =0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 153/423 RDMA/mlx5: Fix mlx5_poll_one() cur_qp update flow
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Patrisious Haddad <[email protected]>
[ Upstream commit 5ed3b0cb3f827072e93b4c5b6e2b8106fd7cccbd ]
When cur_qp isn't NULL, in order to avoid fetching the QP from the radix tree again we check if the next cqe QP is identical to the one we already have.
The bug however is that we are checking if the QP is identical by checking the QP number inside the CQE against the QP number inside the mlx5_ib_qp, but that's wrong since the QP number from the CQE is from FW so it should be matched against mlx5_core_qp which is our FW QP number.
Otherwise we could use the wrong QP when handling a CQE which could cause the kernel trace below.
This issue is mainly noticeable over QPs 0 & 1, since for now they are the only QPs in our driver whereas the QP number inside mlx5_ib_qp doesn't match the QP number inside mlx5_core_qp.
BUG: kernel NULL pointer dereference, address: 0000000000000012 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: Oops: 0000 [#1] SMP CPU: 0 UID: 0 PID: 7927 Comm: kworker/u62:1 Not tainted 6.14.0-rc3+ #189 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014 Workqueue: ib-comp-unb-wq ib_cq_poll_work [ib_core] RIP: 0010:mlx5_ib_poll_cq+0x4c7/0xd90 [mlx5_ib] Code: 03 00 00 8d 58 ff 21 cb 66 39 d3 74 39 48 c7 c7 3c 89 6e a0 0f b7 db e8 b7 d2 b3 e0 49 8b 86 60 03 00 00 48 c7 c7 4a 89 6e a0 <0f> b7 5c 98 02 e8 9f d2 b3 e0 41 0f b7 86 78 03 00 00 83 e8 01 21 RSP: 0018:ffff88810511bd60 EFLAGS: 00010046 RAX: 0000000000000010 RBX: 0000000000000000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffff88885fa1b3c0 RDI: ffffffffa06e894a RBP: 00000000000000b0 R08: 0000000000000000 R09: ffff88810511bc10 R10: 0000000000000001 R11: 0000000000000001 R12: ffff88810d593000 R13: ffff88810e579108 R14: ffff888105146000 R15: 00000000000000b0 FS: 0000000000000000(0000) GS:ffff88885fa00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000012 CR3: 00000001077e6001 CR4: 0000000000370eb0 Call Trace: <TASK> ? __die+0x20/0x60 ? page_fault_oops+0x150/0x3e0 ? exc_page_fault+0x74/0x130 ? asm_exc_page_fault+0x22/0x30 ? mlx5_ib_poll_cq+0x4c7/0xd90 [mlx5_ib] __ib_process_cq+0x5a/0x150 [ib_core] ib_cq_poll_work+0x31/0x90 [ib_core] process_one_work+0x169/0x320 worker_thread+0x288/0x3a0 ? work_busy+0xb0/0xb0 kthread+0xd7/0x1f0 ? kthreads_online_cpu+0x130/0x130 ? kthreads_online_cpu+0x130/0x130 ret_from_fork+0x2d/0x50 ? kthreads_online_cpu+0x130/0x130 ret_from_fork_asm+0x11/0x20 </TASK>
--- drivers/infiniband/hw/mlx5/cq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/cq.c +1 -1
@@ -490,7 +490,7 @@ static int mlx5_poll_one(struct mlx5_ib_cq *cq, } qpn =ntohl (cqe64->sop_drop_qpn) &0xffffff ; -if (!*cur_qp || (qpn != (*cur_qp)->ibqp.qp_num)) { +if (!*cur_qp || (qpn != (*cur_qp)->trans_qp.base.mqp.qpn)) {/* We do not have to take the QP table lock here, * because CQs will be locked while QPs are removed * from the table.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 154/423 pinctrl: renesas: rzv2m: Fix missing of_node_put() call
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabrizio Castro <[email protected]>
[ Upstream commit 5a550b00704d3a2cd9d766a9427b0f8166da37df ]
of_parse_phandle_with_fixed_args() requires its caller to call into of_node_put() on the node pointer from the output structure, but such a call is currently missing.
Call into of_node_put() to rectify that.
--- drivers/pinctrl/renesas/pinctrl-rzv2m.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/renesas/pinctrl-rzv2m.c +2 -0
@@ -940,6 +940,8 @@ static int rzv2m_gpio_register(struct rzv2m_pinctrl *pctrl)return ret; } +of_node_put (of_args.np); +if (of_args.args[0 ] !=0 || of_args.args[1 ] !=0 || of_args.args[2 ] != pctrl->data->n_port_pins) {dev_err (pctrl->dev,"gpio-ranges does not match selected SOC\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 155/423 mfd: sm501: Switch to BIT() to mitigate integer overflows
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
[ Upstream commit 2d8cb9ffe18c2f1e5bd07a19cbce85b26c1d0cf0 ]
If offset end up being high enough, right hand expression in functions like sm501_gpio_set() shifted left for that number of bits, may not fit in int type.
Just in case, fix that by using BIT() both as an option safe from overflow issues and to make this step look similar to other gpio drivers.
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- drivers/mfd/sm501.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mfd/sm501.c +3 -3
@@ -920,7 +920,7 @@ static void sm501_gpio_set(struct gpio_chip *chip, unsigned offset, int value) {struct sm501_gpio_chip *smchip =gpiochip_get_data (chip);struct sm501_gpio *smgpio = smchip->ourgpio; -unsigned long bit =1 << offset; +unsigned long bit =BIT (offset);void __iomem *regs = smchip->regbase;unsigned long save;unsigned long val;
@@ -946,7 +946,7 @@ static int sm501_gpio_input(struct gpio_chip *chip, unsigned offset)struct sm501_gpio_chip *smchip =gpiochip_get_data (chip);struct sm501_gpio *smgpio = smchip->ourgpio;void __iomem *regs = smchip->regbase; -unsigned long bit =1 << offset; +unsigned long bit =BIT (offset);unsigned long save;unsigned long ddr;
@@ -971,7 +971,7 @@ static int sm501_gpio_output(struct gpio_chip *chip, {struct sm501_gpio_chip *smchip =gpiochip_get_data (chip);struct sm501_gpio *smgpio = smchip->ourgpio; -unsigned long bit =1 << offset; +unsigned long bit =BIT (offset);void __iomem *regs = smchip->regbase;unsigned long save;unsigned long val;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 156/423 leds: Fix LED_OFF brightness race
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Remi Pommarel <[email protected]>
[ Upstream commit 2c70953b6f535f7698ccbf22c1f5ba26cb6c2816 ]
While commit fa15d8c69238 ("leds: Fix set_brightness_delayed() race") successfully forces led_set_brightness() to be called with LED_OFF at least once when switching from blinking to LED on state so that hw-blinking can be disabled, another race remains. Indeed in led_set_brightness(LED_OFF) followed by led_set_brightness(any) scenario the following CPU scheduling can happen:
CPU0 CPU1
---- ----
set_brightness_delayed() {
test_and_clear_bit(BRIGHTNESS_OFF)
led_set_brightness(LED_OFF) {
set_bit(BRIGHTNESS_OFF)
queue_work()
}
led_set_brightness(any) {
set_bit(BRIGHTNESS)
queue_work() //already queued
}
test_and_clear_bit(BRIGHTNESS)
/* LED set with brightness any */}
/* From previous CPU1 queue_work() */
set_brightness_delayed() {
test_and_clear_bit(BRIGHTNESS_OFF)
/* LED turned off */
test_and_clear_bit(BRIGHTNESS)
/* Clear from previous run, LED remains off */In that case the led_set_brightness(LED_OFF)/led_set_brightness(any) sequence will be effectively executed in reverse order and LED will remain off.
With the introduction of commit 32360bf6a5d4 ("leds: Introduce ordered workqueue for LEDs events instead of system_wq") the race is easier to trigger as sysfs brightness configuration does not wait for set_brightness_delayed() work to finish (flush_work() removal).
Use delayed_set_value to optionnally re-configure brightness after a LED_OFF. That way a LED state could be configured more that once but final state will always be as expected. Ensure that delayed_set_value modification is seen before set_bit() using smp_mb__before_atomic().
--- drivers/leds/led-core.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/leds/led-core.c +18 -4
@@ -159,8 +159,19 @@ static void set_brightness_delayed(struct work_struct *ws)* before this work item runs once. To make sure this works properly * handle LED_SET_BRIGHTNESS_OFF first. */ -if (test_and_clear_bit (LED_SET_BRIGHTNESS_OFF , &led_cdev->work_flags)) +if (test_and_clear_bit (LED_SET_BRIGHTNESS_OFF , &led_cdev->work_flags)) {set_brightness_delayed_set_brightness (led_cdev,LED_OFF ); +/* +* The consecutives led_set_brightness(LED_OFF), +* led_set_brightness(LED_FULL) could have been executed out of +* order (LED_FULL first), if the work_flags has been set +* between LED_SET_BRIGHTNESS_OFF and LED_SET_BRIGHTNESS of this +* work. To avoid ending with the LED turned off, turn the LED +* on again. +*/ +if (led_cdev->delayed_set_value !=LED_OFF ) +set_bit (LED_SET_BRIGHTNESS , &led_cdev->work_flags); + }if (test_and_clear_bit (LED_SET_BRIGHTNESS , &led_cdev->work_flags))set_brightness_delayed_set_brightness (led_cdev, led_cdev->delayed_set_value);
@@ -331,10 +342,13 @@ void led_set_brightness_nopm(struct led_classdev *led_cdev, unsigned int value)* change is done immediately afterwards (before the work runs), * it uses a separate work_flag. */ -if (value) { - led_cdev->delayed_set_value = value; + led_cdev->delayed_set_value = value; +/* Ensure delayed_set_value is seen before work_flags modification */ +smp_mb__before_atomic (); + +if (value)set_bit (LED_SET_BRIGHTNESS , &led_cdev->work_flags); - }else { +else {clear_bit (LED_SET_BRIGHTNESS , &led_cdev->work_flags);clear_bit (LED_SET_BLINK , &led_cdev->work_flags);set_bit (LED_SET_BRIGHTNESS_OFF , &led_cdev->work_flags);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 157/423 x86/dumpstack: Fix inaccurate unwinding from exception stacks due to misplaced assignment
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
[ Upstream commit 2c118f50d7fd4d9aefc4533a26f83338b2906b7a ]
Commit:
2e4be0d011f2 ("x86/show_trace_log_lvl: Ensure stack pointer is aligned, again")
was intended to ensure alignment of the stack pointer; but it also moved the initialization of the "stack" variable down into the loop header.
This was likely intended as a no-op cleanup, since the commit message does not mention it; however, this caused a behavioral change because the value of "regs" is different between the two places.
Originally, get_stack_pointer() used the regs provided by the caller; after that commit, get_stack_pointer() instead uses the regs at the top of the stack frame the unwinder is looking at. Often, there are no such regs at all, and "regs" is NULL, causing get_stack_pointer() to fall back to the task's current stack pointer, which is not what we want here, but probably happens to mostly work. Other times, the original regs will point to another regs frame - in that case, the linear guess unwind logic in show_trace_log_lvl() will start unwinding too far up the stack, causing the first frame found by the proper unwinder to never be visited, resulting in a stack trace consisting purely of guess lines.
Fix it by moving the "stack = " assignment back where it belongs.
--- arch/x86/kernel/dumpstack.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kernel/dumpstack.c +2 -3
@@ -195,6 +195,7 @@ static void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,printk ("%sCall Trace:\n" , log_lvl);unwind_start (&state, task, regs, stack); + stack = stack ?:get_stack_pointer (task, regs); regs =unwind_get_entry_regs (&state, &partial);/*
@@ -213,9 +214,7 @@ static void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,* - hardirq stack * - entry stack */ -for (stack = stack ?:get_stack_pointer (task, regs); - stack; - stack = stack_info.next_sp) { +for (; stack; stack = stack_info.next_sp) {const char *stack_name; stack =PTR_ALIGN (stack,sizeof (long ));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 158/423 RDMA/core: Fix use-after-free when rename device name
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Liang <[email protected]>
[ Upstream commit 1d6a9e7449e2a0c1e2934eee7880ba8bd1e464cd ]
Syzbot reported a slab-use-after-free with the following call trace:
==================================================================
BUG: KASAN: slab-use-after-free in nla_put+0xd3/0x150 lib/nlattr.c:1099 Read of size 5 at addr ffff888140ea1c60 by task syz.0.988/10025 CPU: 0 UID: 0 PID: 10025 Comm: syz.0.988 Not tainted 6.14.0-rc4-syzkaller-00859-gf77f12010f67 #0 Hardware name: Google Compute Engine, BIOS Google 02/12/2025 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0x16e/0x5b0 mm/kasan/report.c:521 kasan_report+0x143/0x180 mm/kasan/report.c:634 kasan_check_range+0x282/0x290 mm/kasan/generic.c:189 __asan_memcpy+0x29/0x70 mm/kasan/shadow.c:105 nla_put+0xd3/0x150 lib/nlattr.c:1099 nla_put_string include/net/netlink.h:1621 [inline] fill_nldev_handle+0x16e/0x200 drivers/infiniband/core/nldev.c:265 rdma_nl_notify_event+0x561/0xef0 drivers/infiniband/core/nldev.c:2857 ib_device_notify_register+0x22/0x230 drivers/infiniband/core/device.c:1344 ib_register_device+0x1292/0x1460 drivers/infiniband/core/device.c:1460 rxe_register_device+0x233/0x350 drivers/infiniband/sw/rxe/rxe_verbs.c:1540 rxe_net_add+0x74/0xf0 drivers/infiniband/sw/rxe/rxe_net.c:550 rxe_newlink+0xde/0x1a0 drivers/infiniband/sw/rxe/rxe.c:212 nldev_newlink+0x5ea/0x680 drivers/infiniband/core/nldev.c:1795 rdma_nl_rcv_skb drivers/infiniband/core/netlink.c:239 [inline] rdma_nl_rcv+0x6dd/0x9e0 drivers/infiniband/core/netlink.c:259 netlink_unicast_kernel net/netlink/af_netlink.c:1313 [inline] netlink_unicast+0x7f6/0x990 net/netlink/af_netlink.c:1339 netlink_sendmsg+0x8de/0xcb0 net/netlink/af_netlink.c:1883 sock_sendmsg_nosec net/socket.c:709 [inline] __sock_sendmsg+0x221/0x270 net/socket.c:724 ____sys_sendmsg+0x53a/0x860 net/socket.c:2564 ___sys_sendmsg net/socket.c:2618 [inline] __sys_sendmsg+0x269/0x350 net/socket.c:2650 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f42d1b8d169 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 ... RSP: 002b:00007f42d2960038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f42d1da6320 RCX: 00007f42d1b8d169 RDX: 0000000000000000 RSI: 00004000000002c0 RDI: 000000000000000c RBP: 00007f42d1c0e2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f42d1da6320 R15: 00007ffe399344a8 </TASK> Allocated by task 10025: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __do_kmalloc_node mm/slub.c:4294 [inline] __kmalloc_node_track_caller_noprof+0x28b/0x4c0 mm/slub.c:4313 __kmemdup_nul mm/util.c:61 [inline] kstrdup+0x42/0x100 mm/util.c:81 kobject_set_name_vargs+0x61/0x120 lib/kobject.c:274 dev_set_name+0xd5/0x120 drivers/base/core.c:3468 assign_name drivers/infiniband/core/device.c:1202 [inline] ib_register_device+0x178/0x1460 drivers/infiniband/core/device.c:1384 rxe_register_device+0x233/0x350 drivers/infiniband/sw/rxe/rxe_verbs.c:1540 rxe_net_add+0x74/0xf0 drivers/infiniband/sw/rxe/rxe_net.c:550 rxe_newlink+0xde/0x1a0 drivers/infiniband/sw/rxe/rxe.c:212 nldev_newlink+0x5ea/0x680 drivers/infiniband/core/nldev.c:1795 rdma_nl_rcv_skb drivers/infiniband/core/netlink.c:239 [inline] rdma_nl_rcv+0x6dd/0x9e0 drivers/infiniband/core/netlink.c:259 netlink_unicast_kernel net/netlink/af_netlink.c:1313 [inline] netlink_unicast+0x7f6/0x990 net/netlink/af_netlink.c:1339 netlink_sendmsg+0x8de/0xcb0 net/netlink/af_netlink.c:1883 sock_sendmsg_nosec net/socket.c:709 [inline] __sock_sendmsg+0x221/0x270 net/socket.c:724 ____sys_sendmsg+0x53a/0x860 net/socket.c:2564 ___sys_sendmsg net/socket.c:2618 [inline] __sys_sendmsg+0x269/0x350 net/socket.c:2650 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 10035: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:576 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x59/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2353 [inline] slab_free mm/slub.c:4609 [inline] kfree+0x196/0x430 mm/slub.c:4757 kobject_rename+0x38f/0x410 lib/kobject.c:524 device_rename+0x16a/0x200 drivers/base/core.c:4525 ib_device_rename+0x270/0x710 drivers/infiniband/core/device.c:402 nldev_set_doit+0x30e/0x4c0 drivers/infiniband/core/nldev.c:1146 rdma_nl_rcv_skb drivers/infiniband/core/netlink.c:239 [inline] rdma_nl_rcv+0x6dd/0x9e0 drivers/infiniband/core/netlink.c:259 netlink_unicast_kernel net/netlink/af_netlink.c:1313 [inline] netlink_unicast+0x7f6/0x990 net/netlink/af_netlink.c:1339 netlink_sendmsg+0x8de/0xcb0 net/netlink/af_netlink.c:1883 sock_sendmsg_nosec net/socket.c:709 [inline] __sock_sendmsg+0x221/0x270 net/socket.c:724 ____sys_sendmsg+0x53a/0x860 net/socket.c:2564 ___sys_sendmsg net/socket.c:2618 [inline] __sys_sendmsg+0x269/0x350 net/socket.c:2650 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
This is because if rename device happens, the old name is freed in ib_device_rename() with lock, but ib_device_notify_register() may visit the dev name locklessly by event RDMA_REGISTER_EVENT or RDMA_NETDEV_ATTACH_EVENT.
Fix this by hold devices_rwsem in ib_device_notify_register().
--- drivers/infiniband/core/device.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/infiniband/core/device.c +7 -2
@@ -1366,9 +1366,11 @@ static void ib_device_notify_register(struct ib_device *device)u32 port;int ret; +down_read (&devices_rwsem); + ret =rdma_nl_notify_event (device,0 ,RDMA_REGISTER_EVENT );if (ret) -return ; + goto out;rdma_for_each_port (device, port) { netdev =ib_device_get_netdev (device, port);
@@ -1379,8 +1381,11 @@ static void ib_device_notify_register(struct ib_device *device) RDMA_NETDEV_ATTACH_EVENT);dev_put (netdev);if (ret) -return ; + goto out; } + +out: +up_read (&devices_rwsem); }/**
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 159/423 crypto: hisilicon/sec2 - fix for aead auth key length
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wenkai Lin <[email protected]>
[ Upstream commit 1b284ffc30b02808a0de698667cbcf5ce5f9144e ]
According to the HMAC RFC, the authentication key can be 0 bytes, and the hardware can handle this scenario. Therefore, remove the incorrect validation for this case.
--- drivers/crypto/hisilicon/sec2/sec_crypto.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/crypto/hisilicon/sec2/sec_crypto.c +2 -6
@@ -1085,11 +1085,6 @@ static int sec_aead_auth_set_key(struct sec_auth_ctx *ctx,struct crypto_shash *hash_tfm = ctx->hash_tfm;int blocksize, digestsize, ret; -if (!keys->authkeylen) { -pr_err ("hisi_sec2: aead auth key error!\n" ); -return -EINVAL ; - } - blocksize =crypto_shash_blocksize (hash_tfm); digestsize =crypto_shash_digestsize (hash_tfm);if (keys->authkeylen > blocksize) {
@@ -1101,7 +1096,8 @@ static int sec_aead_auth_set_key(struct sec_auth_ctx *ctx, } ctx->a_key_len = digestsize; }else { -memcpy (ctx->a_key, keys->authkey, keys->authkeylen); +if (keys->authkeylen) +memcpy (ctx->a_key, keys->authkey, keys->authkeylen); ctx->a_key_len = keys->authkeylen; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 160/423 pinctrl: intel: Fix wrong bypass assignment in intel_pinctrl_probe_pwm()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 0eee258cdf172763502f142d85e967f27a573be0 ]
When instantiating PWM, the bypass should be set to false. The field is used for the selected Intel SoCs that do not have PWM feature enabled in their pin control IPs.
--- drivers/pinctrl/intel/pinctrl-intel.c | 1 - 1 file changed, 1 deletion(-)
drivers/pinctrl/intel/pinctrl-intel.c +0 -1
@@ -1531,7 +1531,6 @@ static int intel_pinctrl_probe_pwm(struct intel_pinctrl *pctrl, .clk_rate = 19200000, .npwm = 1, .base_unit_bits = 22, - .bypass = true, };struct pwm_chip *chip;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 161/423 clk: qcom: mmcc-sdm660: fix stuck video_subcore0 clock
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Barnabás Czémán <[email protected]>
[ Upstream commit 000cbe3896c56bf5c625e286ff096533a6b27657 ]
This clock can't be enable with VENUS_CORE0 GDSC turned off. But that GDSC is under HW control so it can be turned off at any moment. Instead of checking the dependent clock we can just vote for it to enable later when GDSC gets turned on.
--- drivers/clk/qcom/mmcc-sdm660.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/mmcc-sdm660.c +1 -1
@@ -2544,7 +2544,7 @@ static struct clk_branch video_core_clk = {static struct clk_branch video_subcore0_clk = { .halt_reg =0x1048 , - .halt_check =BRANCH_HALT , + .halt_check =BRANCH_HALT_SKIP , .clkr = { .enable_reg =0x1048 , .enable_mask =BIT (0 ),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 162/423 perf stat: Fix find_stat for mixed legacy/non-legacy events
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 8ce0d2da14d3fb62844dd0e95982c194326b1a5f ]
Legacy events typically don't have a PMU when added leading to mismatched legacy/non-legacy cases in find_stat. Use evsel__find_pmu to make sure the evsel PMU is looked up. Update the evsel__find_pmu code to look for the PMU using the extended config type or, for legacy hardware/hw_cache events on non-hybrid systems, just use the core PMU.
Before:
```
$ perf stat -e cycles,cpu/instructions/ -a sleep 1
Performance counter stats for 'system wide':
215,309,764 cycles
44,326,491 cpu/instructions/
1.002555314 seconds time elapsed
```
After:
```
$ perf stat -e cycles,cpu/instructions/ -a sleep 1
Performance counter stats for 'system wide':
990,676,332 cycles
1,235,762,487 cpu/instructions/ # 1.25 insn per cycle
1.002667198 seconds time elapsed
```--- tools/perf/util/pmus.c | 20 +++++++++++++++++--- tools/perf/util/stat-shadow.c | 3 ++- 2 files changed, 19 insertions(+), 4 deletions(-)
tools/perf/util/pmus.c +17 -3
@@ -701,11 +701,25 @@ char *perf_pmus__default_pmu_name(void)struct perf_pmu *evsel__find_pmu (const struct evsel *evsel) {struct perf_pmu *pmu = evsel->pmu; +bool legacy_core_type; -if (!pmu) { - pmu =perf_pmus__find_by_type (evsel->core.attr.type); - ((struct evsel *)evsel)->pmu = pmu; +if (pmu) +return pmu; + + pmu =perf_pmus__find_by_type (evsel->core.attr.type); + legacy_core_type = + evsel->core.attr.type ==PERF_TYPE_HARDWARE || + evsel->core.attr.type ==PERF_TYPE_HW_CACHE ; +if (!pmu && legacy_core_type) { +if (perf_pmus__supports_extended_type ()) { +u32 type = evsel->core.attr.config >>PERF_PMU_TYPE_SHIFT ; + + pmu =perf_pmus__find_by_type (type); + }else { + pmu =perf_pmus__find_core_pmu (); + } } + ((struct evsel *)evsel)->pmu = pmu;return pmu; }
tools/perf/util/stat-shadow.c +2 -1
@@ -154,6 +154,7 @@ static double find_stat(const struct evsel *evsel, int aggr_idx, enum stat_type {const struct evsel *cur;int evsel_ctx =evsel_context (evsel); +struct perf_pmu *evsel_pmu =evsel__find_pmu (evsel);evlist__for_each_entry (evsel->evlist, cur) {struct perf_stat_aggr *aggr;
@@ -180,7 +181,7 @@ static double find_stat(const struct evsel *evsel, int aggr_idx, enum stat_type* Except the SW CLOCK events, * ignore if not the PMU we're looking for. */ -if ((type !=STAT_NSECS ) && (evsel->pmu != cur->pmu)) +if ((type !=STAT_NSECS ) && (evsel_pmu !=evsel__find_pmu (cur)))continue ; aggr = &cur->stats->aggr[aggr_idx];
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 163/423 perf: Always feature test reallocarray
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Clark <[email protected]>
[ Upstream commit 4c4c0724d6521a8092b7c16f8f210c5869d95b17 ]
This is also used in util/comm.c now, so instead of selectively doing the feature test, always do it. If it's ever used anywhere else it's less likely to cause another build failure.
This doesn't remove the need to manually include libc_compat.h, and missing that will still cause an error for glibc < 2.26. There isn't a way to fix that without poisoning reallocarray like libbpf did, but that has other downsides like making memory debugging tools less useful. So for Perf keep it like this and we'll have to fix up any missed includes.
Fixes the following build error:
util/comm.c:152:31: error: implicit declaration of function
'reallocarray' [-Wimplicit-function-declaration]
152 | tmp = reallocarray(comm_strs->strs,
| ^~~~~~~~~~~~
--- tools/perf/Makefile.config | 10 ++++------ tools/perf/util/comm.c | 2 ++ 2 files changed, 6 insertions(+), 6 deletions(-)
tools/perf/Makefile.config +4 -6
@@ -513,13 +513,14 @@ ifeq ($(feature-setns), 1) $(call detected,CONFIG_SETNS) endif +ifeq ($(feature-reallocarray), 0) + CFLAGS += -DCOMPAT_NEED_REALLOCARRAY +endif + ifdef CORESIGHT $(call feature_check,libopencsd) ifeq ($(feature-libopencsd), 1) CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS) - ifeq ($(feature-reallocarray), 0) - CFLAGS += -DCOMPAT_NEED_REALLOCARRAY - endif LDFLAGS += $(LIBOPENCSD_LDFLAGS) EXTLIBS += $(OPENCSDLIBS) $(call detected,CONFIG_LIBOPENCSD)
@@ -1135,9 +1136,6 @@ ifndef NO_AUXTRACE ifndef NO_AUXTRACE $(call detected,CONFIG_AUXTRACE) CFLAGS += -DHAVE_AUXTRACE_SUPPORT - ifeq ($(feature-reallocarray), 0) - CFLAGS += -DCOMPAT_NEED_REALLOCARRAY - endif endif endif
tools/perf/util/comm.c +2 -0
@@ -5,6 +5,8 @@#include <internal/rc_check.h> #include <linux/refcount.h> #include <linux/zalloc.h> +#include <tools/libc_compat.h> // reallocarray +#include "rwsem.h" DECLARE_RC_STRUCT (comm_str) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 164/423 w1: fix NULL pointer dereference in probe
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenyuan Yang <[email protected]>
[ Upstream commit 0dd6770a72f138dabea9eae87f3da6ffa68f0d06 ]
The w1_uart_probe() function calls w1_uart_serdev_open() (which includes devm_serdev_device_open()) before setting the client ops via serdev_device_set_client_ops(). This ordering can trigger a NULL pointer dereference in the serdev controller's receive_buf handler, as it assumes serdev->ops is valid when SERPORT_ACTIVE is set.
This is similar to the issue fixed in commit 5e700b384ec1 ("platform/chrome: cros_ec_uart: properly fix race condition") where devm_serdev_device_open() was called before fully initializing the device.
Fix the race by ensuring client ops are set before enabling the port via w1_uart_serdev_open().
--- drivers/w1/masters/w1-uart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/w1/masters/w1-uart.c +2 -2
@@ -372,11 +372,11 @@ static int w1_uart_probe(struct serdev_device *serdev)init_completion (&w1dev->rx_byte_received);mutex_init (&w1dev->rx_mutex); +serdev_device_set_drvdata (serdev, w1dev); +serdev_device_set_client_ops (serdev, &w1_uart_serdev_ops); ret =w1_uart_serdev_open (w1dev);if (ret <0 )return ret; -serdev_device_set_drvdata (serdev, w1dev); -serdev_device_set_client_ops (serdev, &w1_uart_serdev_ops);return w1_add_master_device (&w1dev->bus); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 165/423 fs/ntfs3: Update inode->i_mapping->a_ops on compression state
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit b432163ebd15a0fb74051949cb61456d6c55ccbd ]
Update inode->i_mapping->a_ops when the compression state changes to ensure correct address space operations.
Clear ATTR_FLAG_SPARSED/FILE_ATTRIBUTE_SPARSE_FILE when enabling compression to prevent flag conflicts.
v2:
Additionally, ensure that all dirty pages are flushed and concurrent access to the page cache is blocked.
--- fs/ntfs3/attrib.c | 3 ++- fs/ntfs3/file.c | 22 ++++++++++++++++++++-- fs/ntfs3/frecord.c | 6 ++++-- 3 files changed, 26 insertions(+), 5 deletions(-)
fs/ntfs3/attrib.c +2 -1
@@ -2663,8 +2663,9 @@ int attr_set_compress(struct ntfs_inode *ni, bool compr) attr->nres.run_off =cpu_to_le16 (run_off); } -/* Update data attribute flags. */ +/* Update attribute flags. */ if (compr) { + attr->flags &= ~ATTR_FLAG_SPARSED ; attr->flags |=ATTR_FLAG_COMPRESSED ; attr->nres.c_unit =NTFS_LZNT_CUNIT ; }else {
fs/ntfs3/file.c +20 -2
@@ -101,8 +101,26 @@ int ntfs_fileattr_set(struct mnt_idmap *idmap, struct dentry *dentry,/* Allowed to change compression for empty files and for directories only. */ if (!is_dedup (ni) && !is_encrypted (ni) && (S_ISREG (inode->i_mode) ||S_ISDIR (inode->i_mode))) { -/* Change compress state. */ -int err =ni_set_compress (inode, flags &FS_COMPR_FL ); +int err =0 ; +struct address_space *mapping = inode->i_mapping; + +/* write out all data and wait. */ +filemap_invalidate_lock (mapping); + err =filemap_write_and_wait (mapping); + +if (err >=0 ) { +/* Change compress state. */ +bool compr = flags &FS_COMPR_FL ; + err =ni_set_compress (inode, compr); + +/* For files change a_ops too. */ +if (!err) + mapping->a_ops = compr ? &ntfs_aops_cmpr : + &ntfs_aops; + } + +filemap_invalidate_unlock (mapping); +if (err)return err; }
fs/ntfs3/frecord.c +4 -2
@@ -3431,10 +3431,12 @@ int ni_set_compress(struct inode *inode, bool compr) } ni->std_fa = std->fa; -if (compr) +if (compr) { + std->fa &= ~FILE_ATTRIBUTE_SPARSE_FILE ; std->fa |=FILE_ATTRIBUTE_COMPRESSED ; -else + }else { std->fa &= ~FILE_ATTRIBUTE_COMPRESSED ; + }if (ni->std_fa != std->fa) { ni->std_fa = std->fa;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 166/423 phy: phy-rockchip-samsung-hdptx: Dont use dt aliases to determine phy-id
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
[ Upstream commit f08d1c08563846f9be79a4859e912c8795d690fd ]
The phy needs to know its identity in the system (phy0 or phy1 on rk3588) for some actions and the driver currently contains code abusing of_alias for that.
Devicetree aliases are always optional and should not be used for core device functionality, so instead keep a list of phys on a soc in the of_device_data and find the phy-id by comparing against the mapped register-base.
--- .../phy/rockchip/phy-rockchip-samsung-hdptx.c | 50 ++++++++++++++++--- 1 file changed, 44 insertions(+), 6 deletions(-)
drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +44 -6
@@ -266,11 +266,22 @@ enum rk_hdptx_reset {RST_MAX }; +#define MAX_HDPTX_PHY_NUM 2 + +struct rk_hdptx_phy_cfg { +unsigned int num_phys; +unsigned int phy_ids[MAX_HDPTX_PHY_NUM ]; +}; +struct rk_hdptx_phy {struct device *dev;struct regmap *regmap;struct regmap *grf; +/* PHY const config */ +const struct rk_hdptx_phy_cfg *cfgs; +int phy_id; +struct phy *phy;struct phy_config *phy_cfg;struct clk_bulk_data *clks;
@@ -1019,15 +1030,14 @@ static int rk_hdptx_phy_clk_register(struct rk_hdptx_phy *hdptx)struct device *dev = hdptx->dev;const char *name, *pname;struct clk *refclk; -int ret, id; +int ret; refclk =devm_clk_get (dev,"ref" );if (IS_ERR (refclk))return dev_err_probe (dev,PTR_ERR (refclk),"Failed to get ref clock\n" ); - id =of_alias_get_id (dev->of_node,"hdptxphy" ); - name = id >0 ?"clk_hdmiphy_pixel1" :"clk_hdmiphy_pixel0" ; + name = hdptx->phy_id >0 ?"clk_hdmiphy_pixel1" :"clk_hdmiphy_pixel0" ; pname =__clk_get_name (refclk); hdptx->hw.init = CLK_HW_INIT(name, pname, &hdptx_phy_clk_ops,
@@ -1070,8 +1080,9 @@ static int rk_hdptx_phy_probe(struct platform_device *pdev)struct phy_provider *phy_provider;struct device *dev = &pdev->dev;struct rk_hdptx_phy *hdptx; +struct resource *res;void __iomem *regs; -int ret; +int ret, id; hdptx =devm_kzalloc (dev,sizeof (*hdptx),GFP_KERNEL );if (!hdptx)
@@ -1079,11 +1090,27 @@ static int rk_hdptx_phy_probe(struct platform_device *pdev) hdptx->dev = dev; - regs =devm_platform_ioremap_resource (pdev,0 ); + regs =devm_platform_get_and_ioremap_resource (pdev,0 , &res);if (IS_ERR (regs))return dev_err_probe (dev,PTR_ERR (regs),"Failed to ioremap resource\n" ); + hdptx->cfgs =device_get_match_data (dev); +if (!hdptx->cfgs) +return dev_err_probe (dev, -EINVAL ,"missing match data\n" ); + +/* find the phy-id from the io address */ + hdptx->phy_id = -ENODEV ; +for (id =0 ; id < hdptx->cfgs->num_phys; id++) { +if (res->start == hdptx->cfgs->phy_ids[id]) { + hdptx->phy_id = id; +break ; + } + } + +if (hdptx->phy_id <0 ) +return dev_err_probe (dev, -ENODEV ,"no matching device found\n" ); + ret =devm_clk_bulk_get_all (dev, &hdptx->clks);if (ret <0 )return dev_err_probe (dev, ret,"Failed to get clocks\n" );
@@ -1147,8 +1174,19 @@ static const struct dev_pm_ops rk_hdptx_phy_pm_ops = { rk_hdptx_phy_runtime_resume, NULL) }; +static const struct rk_hdptx_phy_cfg rk3588_hdptx_phy_cfgs = { + .num_phys =2 , + .phy_ids = { +0xfed60000 , +0xfed70000 , + }, +}; +static const struct of_device_id rk_hdptx_phy_of_match[] = { - { .compatible ="rockchip,rk3588-hdptx-phy" , }, + { + .compatible ="rockchip,rk3588-hdptx-phy" , + .data = &rk3588_hdptx_phy_cfgs + }, {} };MODULE_DEVICE_TABLE (of, rk_hdptx_phy_of_match);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 167/423 isofs: fix KMSAN uninit-value bug in do_isofs_readdir()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qasim Ijaz <[email protected]>
[ Upstream commit 81a82e8f33880793029cd6f8a766fb13b737e6a7 ]
In do_isofs_readdir() when assigning the variable
"struct iso_directory_record *de" the b_data field of the buffer_head is accessed and an offset is added to it, the size of b_data is 2048 and the offset size is 2047, meaning
"de = (struct iso_directory_record *) (bh->b_data + offset);" yields the final byte of the 2048 sized b_data block.
The first byte of the directory record (de_len) is then read and found to be 31, meaning the directory record size is 31 bytes long. The directory record is defined by the structure:
struct iso_directory_record {
__u8 length; // 1 byte
__u8 ext_attr_length; // 1 byte
__u8 extent[8]; // 8 bytes
__u8 size[8]; // 8 bytes
__u8 date[7]; // 7 bytes
__u8 flags; // 1 byte
__u8 file_unit_size; // 1 byte
__u8 interleave; // 1 byte
__u8 volume_sequence_number[4]; // 4 bytes
__u8 name_len; // 1 byte
char name[]; // variable size
} __attribute__((packed));
The fixed portion of this structure occupies 33 bytes. Therefore, a valid directory record must be at least 33 bytes long (even without considering the variable-length name field). Since de_len is only 31, it is insufficient to contain the complete fixed header.
The code later hits the following sanity check that compares de_len against the sum of de->name_len and sizeof(struct iso_directory_record):
if (de_len < de->name_len[0] + sizeof(struct iso_directory_record)) {
...
}Since the fixed portion of the structure is
33 bytes (up to and including name_len member),
a valid record should have de_len of at least 33 bytes; here, however, de_len is too short, and the field de->name_len (located at offset 32) is accessed even though it lies beyond the available 31 bytes.
This access on the corrupted isofs data triggers a KASAN uninitialized memory warning. The fix would be to first verify that de_len is at least sizeof(struct iso_directory_record) before accessing any fields like de->name_len.
--- fs/isofs/dir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/isofs/dir.c +2 -1
@@ -147,7 +147,8 @@ static int do_isofs_readdir(struct inode *inode, struct file *file, de = tmpde; }/* Basic sanity check, whether name doesn't exceed dir entry */ -if (de_len < de->name_len[0 ] + +if (de_len <sizeof (struct iso_directory_record ) || + de_len < de->name_len[0 ] +sizeof (struct iso_directory_record )) { printk(KERN_NOTICE "iso9660: Corrupted directory entry" " in block %lu of inode %lu\n", block,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 168/423 soundwire: slave: fix an OF node reference leak in soundwire slave device
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
[ Upstream commit aac2f8363f773ae1f65aab140e06e2084ac6b787 ]
When initializing a soundwire slave device, an OF node is stored to the device with refcount incremented. However, the refcount is not decremented in .release(), thus call of_node_put() in sdw_slave_release().
--- drivers/soundwire/slave.c | 1 + 1 file changed, 1 insertion(+)
drivers/soundwire/slave.c +1 -0
@@ -12,6 +12,7 @@ static void sdw_slave_release(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev); +of_node_put (slave->dev.of_node);mutex_destroy (&slave->sdw_dev_lock);kfree (slave); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 169/423 perf report: Switch data file correctly in TUI
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 43c2b6139b188d8a756130147f7efd5ddf99f88d ]
The 's' key is to switch to a new data file and load the data in the same window. The switch_data_file() will show a popup menu to select which data file user wants and update the 'input_name' global variable.
But in the cmd_report(), it didn't update the data.path using the new 'input_name' and keep usng the old file. This is fairly an old bug and I assume people don't use this feature much. :)
--- tools/perf/builtin-report.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-report.c +1 -1
@@ -1551,12 +1551,12 @@ int cmd_report(int argc, const char **argv) input_name ="perf.data" ; } +repeat: data.path = input_name; data.force = symbol_conf.force; symbol_conf.skip_empty = report.skip_empty; -repeat:perf_tool__init (&report.tool, ordered_events); report.tool.sample = process_sample_event; report.tool.mmap = perf_event__process_mmap;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 170/423 greybus: gb-beagleplay: Add error handling for gb_greybus_init
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit be382372d55d65b5c7e5a523793ca5e403f8c595 ]
Add error handling for the gb_greybus_init(bg) function call during the firmware reflash process to maintain consistency in error handling throughout the codebase. If initialization fails, log an error and return FW_UPLOAD_ERR_RW_ERROR.
--- drivers/greybus/gb-beagleplay.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/greybus/gb-beagleplay.c +3 -1
@@ -912,7 +912,9 @@ static enum fw_upload_err cc1352_prepare(struct fw_upload *fw_upload,cc1352_bootloader_reset (bg);WRITE_ONCE (bg->flashing_mode, false);msleep (200 ); -gb_greybus_init (bg); +if (gb_greybus_init (bg) <0 ) +return dev_err_probe (&bg->sd->dev,FW_UPLOAD_ERR_RW_ERROR , +"Failed to initialize greybus" );gb_beagleplay_start_svc (bg);return FW_UPLOAD_ERR_FW_INVALID ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 171/423 coresight: catu: Fix number of pages while using 64k pages
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilkka Koskinen <[email protected]>
[ Upstream commit 0e14e062f5ff98aa15264dfa87c5f5e924028561 ]
Trying to record a trace on kernel with 64k pages resulted in -ENOMEM. This happens due to a bug in calculating the number of table pages, which returns zero. Fix the issue by rounding up.
$ perf record --kcore -e cs_etm/@tmc_etr55,cycacc,branch_broadcast/k --per-thread taskset --cpu-list 1 dd if=/dev/zero of=/dev/null failed to mmap with 12 (Cannot allocate memory)
--- drivers/hwtracing/coresight/coresight-catu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/coresight/coresight-catu.c +1 -1
@@ -269,7 +269,7 @@ catu_init_sg_table(struct device *catu_dev, int node,* Each table can address upto 1MB and we can have * CATU_PAGES_PER_SYSPAGE tables in a system page. */ - nr_tpages =DIV_ROUND_UP (size,SZ_1M ) /CATU_PAGES_PER_SYSPAGE ; + nr_tpages =DIV_ROUND_UP (size,CATU_PAGES_PER_SYSPAGE *SZ_1M ); catu_table =tmc_alloc_sg_table (catu_dev, node, nr_tpages, size >>PAGE_SHIFT , pages);if (IS_ERR (catu_table))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 172/423 vhost-scsi: Fix handling of multiple calls to vhost_scsi_set_endpoint
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Christie <[email protected]>
[ Upstream commit 5dd639a1646ef5fe8f4bf270fad47c5c3755b9b6 ]
If vhost_scsi_set_endpoint is called multiple times without a vhost_scsi_clear_endpoint between them, we can hit multiple bugs found by Haoran Zhang:
1. Use-after-free when no tpgs are found:
This fixes a use after free that occurs when vhost_scsi_set_endpoint is called more than once and calls after the first call do not find any tpgs to add to the vs_tpg. When vhost_scsi_set_endpoint first finds tpgs to add to the vs_tpg array match=true, so we will do:
vhost_vq_set_backend(vq, vs_tpg);
...
kfree(vs->vs_tpg);vs->vs_tpg = vs_tpg;
If vhost_scsi_set_endpoint is called again and no tpgs are found match=false so we skip the vhost_vq_set_backend call leaving the pointer to the vs_tpg we then free via:
kfree(vs->vs_tpg);vs->vs_tpg = vs_tpg;
If a scsi request is then sent we do:
vhost_scsi_handle_vq -> vhost_scsi_get_req -> vhost_vq_get_backend
which sees the vs_tpg we just did a kfree on.
2. Tpg dir removal hang:
This patch fixes an issue where we cannot remove a LIO/target layer tpg (and structs above it like the target) dir due to the refcount dropping to -1.
The problem is that if vhost_scsi_set_endpoint detects a tpg is already in the vs->vs_tpg array or if the tpg has been removed so target_depend_item fails, the undepend goto handler will do target_undepend_item on all tpgs in the vs_tpg array dropping their refcount to 0. At this time vs_tpg contains both the tpgs we have added in the current vhost_scsi_set_endpoint call as well as tpgs we added in previous calls which are also in vs->vs_tpg.
Later, when vhost_scsi_clear_endpoint runs it will do target_undepend_item on all the tpgs in the vs->vs_tpg which will drop their refcount to -1. Userspace will then not be able to remove the tpg and will hang when it tries to do rmdir on the tpg dir.
3. Tpg leak:
This fixes a bug where we can leak tpgs and cause them to be un-removable because the target name is overwritten when vhost_scsi_set_endpoint is called multiple times but with different target names.
The bug occurs if a user has called VHOST_SCSI_SET_ENDPOINT and setup a vhost-scsi device to target/tpg mapping, then calls VHOST_SCSI_SET_ENDPOINT again with a new target name that has tpgs we haven't seen before (target1 has tpg1 but target2 has tpg2). When this happens we don't teardown the old target tpg mapping and just overwrite the target name and the vs->vs_tpg array. Later when we do vhost_scsi_clear_endpoint, we are passed in either target1 or target2's name and we will only match that target's tpgs when we loop over the vs->vs_tpg. We will then return from the function without doing target_undepend_item on the tpgs.
Because of all these bugs, it looks like being able to call vhost_scsi_set_endpoint multiple times was never supported. The major user, QEMU, already has checks to prevent this use case. So to fix the issues, this patch prevents vhost_scsi_set_endpoint from being called if it's already successfully added tpgs. To add, remove or change the tpg config or target name, you must do a vhost_scsi_clear_endpoint first.
Message-Id: <[email protected]>
--- drivers/vhost/scsi.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
drivers/vhost/scsi.c +13 -12
@@ -1699,14 +1699,19 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs, } } +if (vs->vs_tpg) { +pr_err ("vhost-scsi endpoint already set for %s.\n" , + vs->vs_vhost_wwpn); + ret = -EEXIST ; + goto out; + } + len =sizeof (vs_tpg[0 ]) *VHOST_SCSI_MAX_TARGET ; vs_tpg =kzalloc (len,GFP_KERNEL );if (!vs_tpg) { ret = -ENOMEM ; goto out; } -if (vs->vs_tpg) -memcpy (vs_tpg, vs->vs_tpg, len);mutex_lock (&vhost_scsi_mutex);list_for_each_entry (tpg, &vhost_scsi_list, tv_tpg_list) {
@@ -1722,12 +1727,6 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs, tv_tport = tpg->tport;if (!strcmp (tv_tport->tport_name, t->vhost_wwpn)) { -if (vs->vs_tpg && vs->vs_tpg[tpg->tport_tpgt]) { -mutex_unlock (&tpg->tv_tpg_mutex); -mutex_unlock (&vhost_scsi_mutex); - ret = -EEXIST ; - goto undepend; - }/* * In order to ensure individual vhost-scsi configfs * groups cannot be removed while in use by vhost ioctl,
@@ -1774,15 +1773,15 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs, } ret =0 ; }else { - ret = -EEXIST ; + ret = -ENODEV ; + goto free_tpg; }/* -* Act as synchronize_rcu to make sure access to -* old vs->vs_tpg is finished. +* Act as synchronize_rcu to make sure requests after this point +* see a fully setup device. */ vhost_scsi_flush (vs); -kfree (vs->vs_tpg); vs->vs_tpg = vs_tpg; goto out;
@@ -1802,6 +1801,7 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs,target_undepend_item (&tpg->se_tpg.tpg_group.cg_item); } } +free_tpg:kfree (vs_tpg); out:mutex_unlock (&vs->dev.mutex);
@@ -1904,6 +1904,7 @@ vhost_scsi_clear_endpoint(struct vhost_scsi *vs,vhost_scsi_flush (vs);kfree (vs->vs_tpg); vs->vs_tpg =NULL ; +memset (vs->vs_vhost_wwpn,0 ,sizeof (vs->vs_vhost_wwpn));WARN_ON (vs->vs_events_nr);mutex_unlock (&vs->dev.mutex);return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 173/423 coresight-etm4x: add isb() before reading the TRCSTATR
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuanfang Zhang <[email protected]>
[ Upstream commit 4ff6039ffb79a4a8a44b63810a8a2f2b43264856 ]
As recommended by section 4.3.7 ("Synchronization when using system instructions to progrom the trace unit") of ARM IHI 0064H.b, the self-hosted trace analyzer must perform a Context synchronization event between writing to the TRCPRGCTLR and reading the TRCSTATR. Additionally, add an ISB between the each read of TRCSTATR on coresight_timeout() when using system instructions to program the trace unit.
--- drivers/hwtracing/coresight/coresight-core.c | 20 ++++++-- .../coresight/coresight-etm4x-core.c | 48 +++++++++++++++++-- include/linux/coresight.h | 4 ++ 3 files changed, 62 insertions(+), 10 deletions(-)
drivers/hwtracing/coresight/coresight-core.c +15 -5
@@ -1017,18 +1017,20 @@ static void coresight_remove_conns(struct coresight_device *csdev) }/** -* coresight_timeout - loop until a bit has changed to a specific register -* state. +* coresight_timeout_action - loop until a bit has changed to a specific register +* state, with a callback after every trial. * @csa: coresight device access for the device * @offset: Offset of the register from the base of the device. * @position: the position of the bit of interest. * @value: the value the bit should have. +* @cb: Call back after each trial. * * Return: 0 as soon as the bit has taken the desired state or -EAGAIN if * TIMEOUT_US has elapsed, which ever happens first. */ -int coresight_timeout (struct csdev_access *csa,u32 offset, -int position,int value) +int coresight_timeout_action (struct csdev_access *csa,u32 offset, +int position,int value, +coresight_timeout_cb_t cb) {int i;u32 val;
@@ -1044,7 +1046,8 @@ int coresight_timeout(struct csdev_access *csa, u32 offset,if (!(val &BIT (position)))return 0 ; } - +if (cb) +cb (csa, offset, position, value);/* * Delay is arbitrary - the specification doesn't say how long * we are expected to wait. Extra check required to make sure
@@ -1056,6 +1059,13 @@ int coresight_timeout(struct csdev_access *csa, u32 offset,return -EAGAIN ; } +EXPORT_SYMBOL_GPL (coresight_timeout_action); + +int coresight_timeout (struct csdev_access *csa,u32 offset, +int position,int value) +{ +return coresight_timeout_action (csa, offset, position, value,NULL ); +}EXPORT_SYMBOL_GPL (coresight_timeout);u32 coresight_relaxed_read32 (struct coresight_device *csdev,u32 offset)
drivers/hwtracing/coresight/coresight-etm4x-core.c +43 -5
87 lines not on this page · raw message
include/linux/coresight.h +4 -0
@@ -639,6 +639,10 @@ extern int coresight_enable_sysfs(struct coresight_device *csdev);extern void coresight_disable_sysfs (struct coresight_device *csdev);extern int coresight_timeout (struct csdev_access *csa,u32 offset,int position,int value); +typedef void (*coresight_timeout_cb_t ) (struct csdev_access *,u32 ,int ,int ); +extern int coresight_timeout_action (struct csdev_access *csa,u32 offset, +int position,int value, +coresight_timeout_cb_t cb);extern int coresight_claim_device (struct coresight_device *csdev);extern int coresight_claim_device_unlocked (struct coresight_device *csdev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 174/423 perf pmu: Dont double count common sysfs and json events
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Clark <[email protected]>
[ Upstream commit c9d699e10fa6c0cdabcddcf991e7ff42af6b2503 ]
After pmu_add_cpu_aliases() is called, perf_pmu__num_events() returns an incorrect value that double counts common events and doesn't match the actual count of events in the alias list. This is because after 'cpu_aliases_added == true', the number of events returned is 'sysfs_aliases + cpu_json_aliases'. But when adding 'case EVENT_SRC_SYSFS' events, 'sysfs_aliases' and 'cpu_json_aliases' are both incremented together, failing to account that these ones overlap and only add a single item to the list. Fix it by adding another counter for overlapping events which doesn't influence 'cpu_json_aliases'.
There doesn't seem to be a current issue because it's used in perf list before pmu_add_cpu_aliases() so the correct value is returned. Other uses in tests may also miss it for other reasons like only looking at uncore events. However it's marked as a fixes commit in case any new fix with new uses of perf_pmu__num_events() is backported.
--- tools/perf/util/pmu.c | 7 ++++--- tools/perf/util/pmu.h | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-)
tools/perf/util/pmu.c +4 -3
@@ -593,7 +593,7 @@ static int perf_pmu__new_alias(struct perf_pmu *pmu, const char *name, };if (pmu_events_table__find_event (pmu->events_table, pmu, name, update_alias, &data) ==0 ) - pmu->cpu_json_aliases++; + pmu->cpu_common_json_aliases++; } pmu->sysfs_aliases++;break ;
@@ -1807,9 +1807,10 @@ size_t perf_pmu__num_events(struct perf_pmu *pmu)if (pmu->cpu_aliases_added) nr += pmu->cpu_json_aliases;else if (pmu->events_table) - nr +=pmu_events_table__num_events (pmu->events_table, pmu) - pmu->cpu_json_aliases; + nr +=pmu_events_table__num_events (pmu->events_table, pmu) - + pmu->cpu_common_json_aliases;else -assert (pmu->cpu_json_aliases ==0 ); +assert (pmu->cpu_json_aliases ==0 && pmu->cpu_common_json_aliases ==0 );return pmu->selectable ? nr +1 : nr; }
tools/perf/util/pmu.h +5 -0
@@ -131,6 +131,11 @@ struct perf_pmu {uint32_t cpu_json_aliases;/** @sys_json_aliases: Number of json event aliases loaded matching the PMU's identifier. */ uint32_t sys_json_aliases; +/** +* @cpu_common_json_aliases: Number of json events that overlapped with sysfs when +* loading all sysfs events. +*/ +uint32_t cpu_common_json_aliases;/** @sysfs_aliases_loaded: Are sysfs aliases loaded from disk? */ bool sysfs_aliases_loaded;/**
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 175/423 tools/x86: Fix linux/unaligned.h include path in lib/insn.c
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit fad07a5c0f07ad0884e1cb4362fe28c083b5b811 ]
tools/arch/x86/include/linux doesn't exist but building is working by virtue of a -I. Building using bazel this fails. Use angle brackets to include unaligned.h so there isn't an invalid relative include.
--- tools/arch/x86/lib/insn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/arch/x86/lib/insn.c +1 -1
@@ -13,7 +13,7 @@#endif #include "../include/asm/inat.h" /* __ignore_sync_check__ */ #include "../include/asm/insn.h" /* __ignore_sync_check__ */ -#include "../include/linux/unaligned.h" /* __ignore_sync_check__ */ +#include <linux/unaligned.h> /* __ignore_sync_check__ */ #include <linux/errno.h> #include <linux/kconfig.h>
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 176/423 perf build: Fix in-tree build due to symbolic link
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Ceresoli <[email protected]>
[ Upstream commit 75100d848ef4b8ca39bb6dd3a21181e37dea27e2 ]
Building perf in-tree is broken after commit 890a1961c812 ("perf tools:
Create source symlink in perf object dir") which added a 'source' symlink in the output dir pointing to the source dir.
With in-tree builds, the added 'SOURCE = ...' line is executed multiple times (I observed 2 during the build plus 2 during installation). This is a minor inefficiency, in theory not harmful because symlink creation is assumed to be idempotent. But it is not.
Considering with in-tree builds:
srctree=/absolute/path/to/linux
OUTPUT=/absolute/path/to/linux/tools/perf
here's what happens:
1. ln -sf $(srctree)/tools/perf $(OUTPUT)/source
-> creates /absolute/path/to/linux/tools/perf/source
link to /absolute/path/to/linux/tools/perf
=> OK, that's what was intended
2. ln -sf $(srctree)/tools/perf $(OUTPUT)/source # same command as 1
-> creates /absolute/path/to/linux/tools/perf/perf
link to /absolute/path/to/linux/tools/perf
=> Not what was intended, not idempotent
3. Now the build _should_ create the 'perf' executable, but it fails
The reason is the tricky 'ln' command line. At the first invocation 'ln' uses the 1st form:
ln [OPTION]... [-T] TARGET LINK_NAME
and creates a link to TARGET *called LINK_NAME*.
At the second invocation $(OUTPUT)/source exists, so 'ln' uses the 3rd form:
ln [OPTION]... TARGET... DIRECTORY
and creates a link to TARGET *called TARGET* inside DIRECTORY.
Fix by adding -n/--no-dereference to "treat LINK_NAME as a normal file if it is a symbolic link to a directory", as the manpage says.
--- tools/perf/Makefile.perf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.perf +1 -1
@@ -164,7 +164,7 @@ ifneq ($(OUTPUT),) VPATH += $(OUTPUT) export VPATH # create symlink to the original source -SOURCE := $(shell ln -sf $(srctree)/tools/perf $(OUTPUT)/source) +SOURCE := $(shell ln -sfn $(srctree)/tools/perf $(OUTPUT)/source) endif ifeq ($(V),1)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 177/423 ucsi_ccg: Dont show failed to get FW build information error
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit c16006852732dc4fe37c14b81f9b4458df05b832 ]
The error failed to get FW build information is added for what looks to be for misdetection of the device property firmware-name.
If the property is missing (such as on non-nvidia HW) this error shows up. Move the error into the scope of the property parser for "firmware-name" to avoid showing errors on systems without the firmware-name property.
--- drivers/usb/typec/ucsi/ucsi_ccg.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/typec/ucsi/ucsi_ccg.c +2 -3
@@ -1433,11 +1433,10 @@ static int ucsi_ccg_probe(struct i2c_client *client) uc->fw_build =CCG_FW_BUILD_NVIDIA_TEGRA ; else if (!strcmp(fw_name, "nvidia,gpu")) uc->fw_build =CCG_FW_BUILD_NVIDIA ; +if (!uc->fw_build) +dev_err (uc->dev,"failed to get FW build information\n" ); } -if (!uc->fw_build) -dev_err (uc->dev,"failed to get FW build information\n" ); -/* reset ccg device and initialize ucsi */ status =ucsi_ccg_init (uc);if (status <0 ) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 178/423 iio: accel: mma8452: Ensure error return on failure to matching oversampling ratio
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Cameron <[email protected]>
[ Upstream commit df330c808182a8beab5d0f84a6cbc9cff76c61fc ]
If a match was not found, then the write_raw() callback would return the odr index, not an error. Return -EINVAL if this occurs. To avoid similar issues in future, introduce j, a new indexing variable rather than using ret for this purpose.
--- drivers/iio/accel/mma8452.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/accel/mma8452.c +7 -3
@@ -711,7 +711,7 @@ static int mma8452_write_raw(struct iio_dev *indio_dev, int val, int val2, long mask) { struct mma8452_data *data = iio_priv(indio_dev); -int i, ret; +int i, j, ret; ret =iio_device_claim_direct_mode (indio_dev);if (ret)
@@ -771,14 +771,18 @@ static int mma8452_write_raw(struct iio_dev *indio_dev,break ;case IIO_CHAN_INFO_OVERSAMPLING_RATIO : - ret =mma8452_get_odr_index (data); + j =mma8452_get_odr_index (data);for (i =0 ; i <ARRAY_SIZE (mma8452_os_ratio); i++) { -if (mma8452_os_ratio[i][ret] == val) { +if (mma8452_os_ratio[i][j] == val) { ret =mma8452_set_power_mode (data, i);break ; } } +if (i ==ARRAY_SIZE (mma8452_os_ratio)) { + ret = -EINVAL ; +break ; + }break ;default : ret = -EINVAL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 179/423 iio: accel: msa311: Fix failure to release runtime pm if direct mode claim fails.
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Cameron <[email protected]>
[ Upstream commit 60a0cf2ebab92011055ab7db6553c0fc3c546938 ]
Reorder the claiming of direct mode and runtime pm calls to simplify handling a little. For correct error handling, after the reorder iio_device_release_direct_mode() must be claimed in an error occurs in pm_runtime_resume_and_get()
--- drivers/iio/accel/msa311.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/iio/accel/msa311.c +15 -11
@@ -593,23 +593,25 @@ static int msa311_read_raw_data(struct iio_dev *indio_dev,__le16 axis;int err; - err =pm_runtime_resume_and_get (dev); + err =iio_device_claim_direct_mode (indio_dev);if (err)return err; - err =iio_device_claim_direct_mode (indio_dev); -if (err) + err =pm_runtime_resume_and_get (dev); +if (err) { +iio_device_release_direct_mode (indio_dev);return err; + }mutex_lock (&msa311->lock); err =msa311_get_axis (msa311, chan, &axis);mutex_unlock (&msa311->lock); -iio_device_release_direct_mode (indio_dev); -pm_runtime_mark_last_busy (dev);pm_runtime_put_autosuspend (dev); +iio_device_release_direct_mode (indio_dev); +if (err) {dev_err (dev,"can't get axis %s (%pe)\n" , chan->datasheet_name,ERR_PTR (err));
@@ -755,10 +757,6 @@ static int msa311_write_samp_freq(struct iio_dev *indio_dev, int val, int val2)unsigned int odr;int err; - err =pm_runtime_resume_and_get (dev); -if (err) -return err; -/* * Sampling frequency changing is prohibited when buffer mode is * enabled, because sometimes MSA311 chip returns outliers during
@@ -768,6 +766,12 @@ static int msa311_write_samp_freq(struct iio_dev *indio_dev, int val, int val2)if (err)return err; + err =pm_runtime_resume_and_get (dev); +if (err) { +iio_device_release_direct_mode (indio_dev); +return err; + } + err = -EINVAL ;for (odr =0 ; odr <ARRAY_SIZE (msa311_odr_table); odr++) if (val == msa311_odr_table[odr].integral &&
@@ -778,11 +782,11 @@ static int msa311_write_samp_freq(struct iio_dev *indio_dev, int val, int val2)break ; } -iio_device_release_direct_mode (indio_dev); -pm_runtime_mark_last_busy (dev);pm_runtime_put_autosuspend (dev); +iio_device_release_direct_mode (indio_dev); +if (err)dev_err (dev,"can't update frequency (%pe)\n" ,ERR_PTR (err));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 180/423 iio: backend: make sure to NULL terminate stack buffer
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nuno Sá <[email protected]>
[ Upstream commit 035b4989211dc1c8626e186d655ae8ca5141bb73 ]
Make sure to NULL terminate the buffer in iio_backend_debugfs_write_reg() before passing it to sscanf(). It is a stack variable so we should not assume it will 0 initialized.
--- drivers/iio/industrialio-backend.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/industrialio-backend.c +3 -1
@@ -155,10 +155,12 @@ static ssize_t iio_backend_debugfs_write_reg(struct file *file,ssize_t rc;int ret; - rc =simple_write_to_buffer (buf,sizeof (buf), ppos, userbuf, count); + rc =simple_write_to_buffer (buf,sizeof (buf) -1 , ppos, userbuf, count);if (rc <0 )return rc; + buf[count] ='\0' ; + ret =sscanf (buf,"%i %i" , &back->cached_reg_addr, &val);switch (ret) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 181/423 perf arm-spe: Fix load-store operation checking
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit e1d47850bbf79a541c9b3bacdd562f5e0112274d ]
The ARM_SPE_OP_LD and ARM_SPE_OP_ST operations are secondary operation type, they are overlapping with other second level's operation types belonging to SVE and branch operations. As a result, a non load-store operation can be parsed for data source and memory sample.
To fix the issue, this commit introduces a is_ldst_op() macro for checking LDST operation, and apply the checking when synthesize data source and memory samples.
--- tools/perf/util/arm-spe.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tools/perf/util/arm-spe.c +7 -1
@@ -37,6 +37,8 @@#include "../../arch/arm64/include/asm/cputype.h" #define MAX_TIMESTAMP (~0ULL) +#define is_ldst_op (op) (!!((op) & ARM_SPE_OP_LDST)) +struct arm_spe {struct auxtrace auxtrace;struct auxtrace_queues queues;
@@ -520,6 +522,10 @@ static u64 arm_spe__synth_data_source(const struct arm_spe_record *record, u64 munion perf_mem_data_src data_src = { .mem_op =PERF_MEM_OP_NA };bool is_neoverse =is_midr_in_range_list (midr, neoverse_spe); +/* Only synthesize data source for LDST operations */ +if (!is_ldst_op (record->op)) +return 0 ; +if (record->op &ARM_SPE_OP_LD ) data_src.mem_op =PERF_MEM_OP_LOAD ;else if (record->op &ARM_SPE_OP_ST )
@@ -619,7 +625,7 @@ static int arm_spe_sample(struct arm_spe_queue *speq)* When data_src is zero it means the record is not a memory operation, * skip to synthesize memory sample for this case. */ -if (spe->sample_memory && data_src) { +if (spe->sample_memory &&is_ldst_op (record->op)) { err =arm_spe__synth_mem_sample (speq, spe->memory_id, data_src);if (err)return err;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 182/423 perf bench: Fix perf bench syscall loop count
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Richter <[email protected]>
[ Upstream commit 957d194163bf983da98bf7ec7e4f86caff8cd0eb ]
Command 'perf bench syscall fork -l 100000' offers option -l to run for a specified number of iterations. However this option is not always observed. The number is silently limited to 10000 iterations as can be seen:
Output before:
# perf bench syscall fork -l 100000
# Running 'syscall/fork' benchmark:
# Executed 10,000 fork() calls
Total time: 23.388 [sec] 2338.809800 usecs/op
427 ops/sec#
When explicitly specified with option -l or --loops, also observe higher number of iterations:
Output after:
# perf bench syscall fork -l 100000
# Running 'syscall/fork' benchmark:
# Executed 100,000 fork() calls
Total time: 716.982 [sec] 7169.829510 usecs/op
139 ops/sec#
This patch fixes the issue for basic execve fork and getpgid.
--- tools/perf/bench/syscall.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
tools/perf/bench/syscall.c +13 -9
@@ -22,8 +22,7 @@#define __NR_fork -1#endif -#define LOOPS_DEFAULT 10000000 -static int loops =LOOPS_DEFAULT ; +static int loops;static const struct option options[] = {OPT_INTEGER ('l' ,"loop" , &loops,"Specify number of loops" ),
@@ -80,6 +79,18 @@ static int bench_syscall_common(int argc, const char **argv, int syscall)const char *name =NULL ;int i; +switch (syscall) { +case __NR_fork: +case __NR_execve: +/* Limit default loop to 10000 times to save time */ + loops =10000 ; +break ; +default : + loops =10000000 ; +break ; + } + +/* Options -l and --loops override default above */ argc =parse_options (argc, argv, options, bench_syscall_usage,0 );gettimeofday (&start,NULL );
@@ -94,16 +105,9 @@ static int bench_syscall_common(int argc, const char **argv, int syscall)break ;case __NR_fork:test_fork (); -/* Only loop 10000 times to save time */ -if (i ==10000 ) - loops =10000 ;break ;case __NR_execve:test_execve (); -/* Only loop 10000 times to save time */ -if (i ==10000 ) - loops =10000 ; -break ;default :break ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 183/423 usb: xhci: correct debug message page size calculation
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Neronin <[email protected]>
[ Upstream commit 55741c723318905e6d5161bf1e12749020b161e3 ]
The ffs() function returns the index of the first set bit, starting from 1. If no bits are set, it returns zero. This behavior causes an off-by-one page size in the debug message, as the page size calculation [1] is zero-based, while ffs() is one-based.
Fix this by subtracting one from the result of ffs(). Note that since variable 'val' is unsigned, subtracting one from zero will result in the maximum unsigned integer value. Consequently, the condition 'if (val < 16)' will still function correctly.
[1], Page size: (2^(n+12)), where 'n' is the set page size bit.
--- drivers/usb/host/xhci-mem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/xhci-mem.c +3 -3
@@ -2397,10 +2397,10 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) page_size =readl (&xhci->op_regs->page_size);xhci_dbg_trace (xhci, trace_xhci_dbg_init,"Supported page size register = 0x%x" , page_size); - i =ffs (page_size); -if (i <16 ) + val =ffs (page_size) -1 ; +if (val <16 )xhci_dbg_trace (xhci, trace_xhci_dbg_init, -"Supported page size of %iK" , (1 << (i+12 )) /1024 ); +"Supported page size of %iK" , (1 << (val +12 )) /1024 );else xhci_warn (xhci,"WARN: no supported page size\n" );/* Use 4K pages, since that's common and the minimum the HC supports */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 184/423 fs/ntfs3: Fix a couple integer overflows on 32bit systems
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 5ad414f4df2294b28836b5b7b69787659d6aa708 ]
On 32bit systems the "off + sizeof(struct NTFS_DE)" addition can have an integer wrapping issue. Fix it by using size_add().
--- fs/ntfs3/index.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ntfs3/index.c +2 -2
@@ -618,7 +618,7 @@ static bool index_hdr_check(const struct INDEX_HDR *hdr, u32 bytes)u32 off =le32_to_cpu (hdr->de_off);if (!IS_ALIGNED (off,8 ) || tot > bytes || end > tot || - off +sizeof (struct NTFS_DE ) > end) { +size_add (off,sizeof (struct NTFS_DE )) > end) {/* incorrect index buffer. */ return false; }
@@ -736,7 +736,7 @@ static struct NTFS_DE *hdr_find_e(const struct ntfs_index *indx,if (end > total)return NULL ; -if (off +sizeof (struct NTFS_DE ) > end) +if (size_add (off,sizeof (struct NTFS_DE )) > end)return NULL ; e =Add2Ptr (hdr, off);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 185/423 fs/ntfs3: Prevent integer overflow in hdr_first_de()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 6bb81b94f7a9cba6bde9a905cef52a65317a8b04 ]
The "de_off" and "used" variables come from the disk so they both need to check. The problem is that on 32bit systems if they're both greater than UINT_MAX - 16 then the check does work as intended because of an integer overflow.
--- fs/ntfs3/ntfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/ntfs.h +1 -1
@@ -717,7 +717,7 @@ static inline struct NTFS_DE *hdr_first_de(const struct INDEX_HDR *hdr)struct NTFS_DE *e;u16 esize; -if (de_off >= used || de_off +sizeof (struct NTFS_DE ) > used ) +if (de_off >= used ||size_add (de_off,sizeof (struct NTFS_DE )) > used)return NULL ; e =Add2Ptr (hdr, de_off);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 186/423 dmaengine: fsl-edma: cleanup chan after dma_async_device_unregister
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit c9c59da76ce9cb3f215b66eb3708cda1134a5206 ]
There is kernel dump when do module test:
sysfs: cannot create duplicate filename /devices/platform/soc@0/44000000.bus/44000000.dma-controller/dma/dma0chan0
__dma_async_device_channel_register+0x128/0x19c dma_async_device_register+0x150/0x454 fsl_edma_probe+0x6cc/0x8a0 platform_probe+0x68/0xc8
fsl_edma_cleanup_vchan will unlink vchan.chan.device_node, while dma_async_device_unregister needs the link to do __dma_async_device_channel_unregister. So need move fsl_edma_cleanup_vchan after dma_async_device_unregister to make sure channel could be freed.
So clean up chan after dma_async_device_unregister to address this.
--- drivers/dma/fsl-edma-main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/fsl-edma-main.c +1 -1
@@ -699,9 +699,9 @@ static void fsl_edma_remove(struct platform_device *pdev)struct fsl_edma_engine *fsl_edma =platform_get_drvdata (pdev);fsl_edma_irq_exit (pdev, fsl_edma); -fsl_edma_cleanup_vchan (&fsl_edma->dma_dev);of_dma_controller_free (np);dma_async_device_unregister (&fsl_edma->dma_dev); +fsl_edma_cleanup_vchan (&fsl_edma->dma_dev);fsl_disable_clocks (fsl_edma, fsl_edma->drvdata->dmamuxs); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 187/423 dmaengine: fsl-edma: free irq correctly in remove path
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit fa70c4c3c580c239a0f9e83a14770ab026e8d820 ]
Add fsl_edma->txirq/errirq check to avoid below warning because no errirq at i.MX9 platform. Otherwise there will be kernel dump:
WARNING: CPU: 0 PID: 11 at kernel/irq/devres.c:144 devm_free_irq+0x74/0x80 Modules linked in: CPU: 0 UID: 0 PID: 11 Comm: kworker/u8:0 Not tainted 6.12.0-rc7#18 Hardware name: NXP i.MX93 11X11 EVK board (DT) Workqueue: events_unbound deferred_probe_work_func pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : devm_free_irq+0x74/0x80 lr : devm_free_irq+0x48/0x80 Call trace: devm_free_irq+0x74/0x80 (P) devm_free_irq+0x48/0x80 (L) fsl_edma_remove+0xc4/0xc8 platform_remove+0x28/0x44 device_remove+0x4c/0x80
--- drivers/dma/fsl-edma-main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/dma/fsl-edma-main.c +9 -3
@@ -303,6 +303,7 @@ fsl_edma2_irq_init(struct platform_device *pdev,/* The last IRQ is for eDMA err */ if (i == count -1 ) { + fsl_edma->errirq = irq; ret =devm_request_irq (&pdev->dev, irq, fsl_edma_err_handler,0 ,"eDMA2-ERR" , fsl_edma);
@@ -322,10 +323,13 @@ static void fsl_edma_irq_exit( struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) {if (fsl_edma->txirq == fsl_edma->errirq) { -devm_free_irq (&pdev->dev, fsl_edma->txirq, fsl_edma); +if (fsl_edma->txirq >=0 ) +devm_free_irq (&pdev->dev, fsl_edma->txirq, fsl_edma); }else { -devm_free_irq (&pdev->dev, fsl_edma->txirq, fsl_edma); -devm_free_irq (&pdev->dev, fsl_edma->errirq, fsl_edma); +if (fsl_edma->txirq >=0 ) +devm_free_irq (&pdev->dev, fsl_edma->txirq, fsl_edma); +if (fsl_edma->errirq >=0 ) +devm_free_irq (&pdev->dev, fsl_edma->errirq, fsl_edma); } }
@@ -513,6 +517,8 @@ static int fsl_edma_probe(struct platform_device *pdev)if (!fsl_edma)return -ENOMEM ; + fsl_edma->errirq = -EINVAL ; + fsl_edma->txirq = -EINVAL ; fsl_edma->drvdata = drvdata; fsl_edma->n_chans = chans;mutex_init (&fsl_edma->fsl_edma_mutex);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 188/423 iio: adc: ad4130: Fix comparison of channel setups
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 280acb19824663d55a3f4d09087c76fabe86fa3c ]
Checking the binary representation of two structs (of the same type) for equality doesn't have the same semantic as comparing all members for equality. The former might find a difference where the latter doesn't in the presence of padding or when ambiguous types like float or bool are involved. (Floats typically have different representations for single values, like -0.0 vs +0.0, or 0.5 * 2² vs 0.25 * 2³. The type bool has at least 8 bits and the raw values 1 and 2 (probably) both evaluate to true, but memcmp finds a difference.)
When searching for a channel that already has the configuration we need, the comparison by member is the one that is needed.
Convert the comparison accordingly to compare the members one after another. Also add a static_assert guard to (somewhat) ensure that when struct ad4130_setup_info is expanded, the comparison is adapted, too.
This issue is somewhat theoretic, but using memcmp() on a struct is a bad pattern that is worth fixing.
--- drivers/iio/adc/ad4130.c | 41 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-)
drivers/iio/adc/ad4130.c +39 -2
@@ -223,6 +223,10 @@ enum ad4130_pin_function { AD4130_PIN_FN_VBIAS = BIT(3), }; +/* +* If you make adaptations in this struct, you most likely also have to adapt +* ad4130_setup_info_eq(), too. +*/ struct ad4130_setup_info {unsigned int iout0_val;unsigned int iout1_val;
@@ -591,6 +595,40 @@ static irqreturn_t ad4130_irq_handler(int irq, void *private)return IRQ_HANDLED ; } +static bool ad4130_setup_info_eq (struct ad4130_setup_info *a, +struct ad4130_setup_info *b) +{ +/* +* This is just to make sure that the comparison is adapted after +* struct ad4130_setup_info was changed. +*/ +static_assert (sizeof (*a) == +sizeof (struct { +unsigned int iout0_val; +unsigned int iout1_val; +unsigned int burnout; +unsigned int pga; +unsigned int fs; +u32 ref_sel; +enum ad4130_filter_mode filter_mode; +bool ref_bufp; +bool ref_bufm; + })); + +if (a->iout0_val != b->iout0_val || + a->iout1_val != b->iout1_val || + a->burnout != b->burnout || + a->pga != b->pga || + a->fs != b->fs || + a->ref_sel != b->ref_sel || + a->filter_mode != b->filter_mode || + a->ref_bufp != b->ref_bufp || + a->ref_bufm != b->ref_bufm) +return false; + +return true; +} +static int ad4130_find_slot (struct ad4130_state *st,struct ad4130_setup_info *target_setup_info,unsigned int *slot,bool *overwrite)
@@ -604,8 +642,7 @@ static int ad4130_find_slot(struct ad4130_state *st,struct ad4130_slot_info *slot_info = &st->slots_info[i];/* Immediately accept a matching setup info. */ -if (!memcmp (target_setup_info, &slot_info->setup, -sizeof (*target_setup_info))) { +if (ad4130_setup_info_eq (target_setup_info, &slot_info->setup)) { *slot = i;return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 189/423 iio: adc: ad7124: Fix comparison of channel configs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 05a5d874f7327b75e9bc4359618017e047cc129c ]
Checking the binary representation of two structs (of the same type) for equality doesn't have the same semantic as comparing all members for equality. The former might find a difference where the latter doesn't in the presence of padding or when ambiguous types like float or bool are involved. (Floats typically have different representations for single values, like -0.0 vs +0.0, or 0.5 * 2² vs 0.25 * 2³. The type bool has at least 8 bits and the raw values 1 and 2 (probably) both evaluate to true, but memcmp finds a difference.)
When searching for a channel that already has the configuration we need, the comparison by member is the one that is needed.
Convert the comparison accordingly to compare the members one after another. Also add a static_assert guard to (somewhat) ensure that when struct ad7124_channel_config::config_props is expanded, the comparison is adapted, too.
This issue is somewhat theoretic, but using memcmp() on a struct is a bad pattern that is worth fixing.
--- drivers/iio/adc/ad7124.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)
drivers/iio/adc/ad7124.c +31 -4
@@ -147,7 +147,11 @@ struct ad7124_chip_info {struct ad7124_channel_config {bool live;unsigned int cfg_slot; -/* Following fields are used to compare equality. */ +/* +* Following fields are used to compare for equality. If you +* make adaptations in it, you most likely also have to adapt +* ad7124_find_similar_live_cfg(), too. +*/ struct_group(config_props, enum ad7124_ref_sel refsel;bool bipolar;
@@ -334,15 +338,38 @@ static struct ad7124_channel_config *ad7124_find_similar_live_cfg(struct ad7124_ struct ad7124_channel_config *cfg) {struct ad7124_channel_config *cfg_aux; -ptrdiff_t cmp_size;int i; - cmp_size = sizeof_field(struct ad7124_channel_config, config_props); +/* +* This is just to make sure that the comparison is adapted after +* struct ad7124_channel_config was changed. +*/ + static_assert(sizeof_field(struct ad7124_channel_config, config_props) == +sizeof (struct { +enum ad7124_ref_sel refsel; +bool bipolar; +bool buf_positive; +bool buf_negative; +unsigned int vref_mv; +unsigned int pga_bits; +unsigned int odr; +unsigned int odr_sel_bits; +unsigned int filter_type; + })); +for (i =0 ; i < st->num_channels; i++) { cfg_aux = &st->channels[i].cfg;if (cfg_aux->live && - !memcmp (&cfg->config_props, &cfg_aux->config_props, cmp_size)) + cfg->refsel == cfg_aux->refsel && + cfg->bipolar == cfg_aux->bipolar && + cfg->buf_positive == cfg_aux->buf_positive && + cfg->buf_negative == cfg_aux->buf_negative && + cfg->vref_mv == cfg_aux->vref_mv && + cfg->pga_bits == cfg_aux->pga_bits && + cfg->odr == cfg_aux->odr && + cfg->odr_sel_bits == cfg_aux->odr_sel_bits && + cfg->filter_type == cfg_aux->filter_type)return cfg_aux; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 190/423 iio: adc: ad7173: Fix comparison of channel configs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 7b6033ed5a9e1a369a9cf58018388ae4c5f17e41 ]
Checking the binary representation of two structs (of the same type) for equality doesn't have the same semantic as comparing all members for equality. The former might find a difference where the latter doesn't in the presence of padding or when ambiguous types like float or bool are involved. (Floats typically have different representations for single values, like -0.0 vs +0.0, or 0.5 * 2² vs 0.25 * 2³. The type bool has at least 8 bits and the raw values 1 and 2 (probably) both evaluate to true, but memcmp finds a difference.)
When searching for a channel that already has the configuration we need, the comparison by member is the one that is needed.
Convert the comparison accordingly to compare the members one after another. Also add a static_assert guard to (somewhat) ensure that when struct ad7173_channel_config::config_props is expanded, the comparison is adapted, too.
This issue is somewhat theoretic, but using memcmp() on a struct is a bad pattern that is worth fixing.
--- drivers/iio/adc/ad7173.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
drivers/iio/adc/ad7173.c +21 -4
@@ -181,7 +181,11 @@ struct ad7173_channel_config {u8 cfg_slot;bool live; -/* Following fields are used to compare equality. */ +/* +* Following fields are used to compare equality. If you +* make adaptations in it, you most likely also have to adapt +* ad7173_find_live_config(), too. +*/ struct_group (config_props, bool bipolar; bool input_buf;
@@ -582,15 +586,28 @@ static struct ad7173_channel_config * ad7173_find_live_config(struct ad7173_state *st, struct ad7173_channel_config *cfg) { struct ad7173_channel_config *cfg_aux; -ptrdiff_t cmp_size;int i; - cmp_size = sizeof_field(struct ad7173_channel_config, config_props); +/* +* This is just to make sure that the comparison is adapted after +* struct ad7173_channel_config was changed. +*/ + static_assert(sizeof_field(struct ad7173_channel_config, config_props) == +sizeof (struct { +bool bipolar; +bool input_buf; +u8 odr; +u8 ref_sel; + })); +for (i =0 ; i < st->num_channels; i++) { cfg_aux = &st->channels[i].cfg;if (cfg_aux->live && - !memcmp (&cfg->config_props, &cfg_aux->config_props, cmp_size)) + cfg->bipolar == cfg_aux->bipolar && + cfg->input_buf == cfg_aux->input_buf && + cfg->odr == cfg_aux->odr && + cfg->ref_sel == cfg_aux->ref_sel)return cfg_aux; }return NULL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 191/423 iio: adc: ad7768-1: set MOSI idle state to prevent accidental reset
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Santos <[email protected]>
[ Upstream commit 2416cec859299be04d021b4cf98eff814f345af7 ]
Datasheet recommends Setting the MOSI idle state to high in order to prevent accidental reset of the device when SCLK is free running. This happens when the controller clocks out a 1 followed by 63 zeros while the CS is held low.
Check if SPI controller supports SPI_MOSI_IDLE_HIGH flag and set it.
--- drivers/iio/adc/ad7768-1.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/iio/adc/ad7768-1.c +15 -0
@@ -574,6 +574,21 @@ static int ad7768_probe(struct spi_device *spi)return -ENOMEM ; st =iio_priv (indio_dev); +/* +* Datasheet recommends SDI line to be kept high when data is not being +* clocked out of the controller and the spi clock is free running, +* to prevent accidental reset. +* Since many controllers do not support the SPI_MOSI_IDLE_HIGH flag +* yet, only request the MOSI idle state to enable if the controller +* supports it. +*/ +if (spi->controller->mode_bits &SPI_MOSI_IDLE_HIGH ) { + spi->mode |=SPI_MOSI_IDLE_HIGH ; + ret =spi_setup (spi); +if (ret <0 ) +return ret; + } + st->spi = spi; st->vref =devm_regulator_get (&spi->dev,"vref" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 192/423 iio: light: Add check for array bounds in veml6075_read_int_time_ms
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karan Sanghavi <[email protected]>
[ Upstream commit ee735aa33db16c1fb5ebccbaf84ad38f5583f3cc ]
The array contains only 5 elements, but the index calculated by veml6075_read_int_time_index can range from 0 to 7,
which could lead to out-of-bounds access. The check prevents this issue.
Coverity Issue
CID 1574309: (#1 of 1): Out-of-bounds read (OVERRUN)
overrun-local: Overrunning array veml6075_it_ms of 5 4-byte elements at element index 7 (byte offset 31) using index int_index (which evaluates to 7)
This is hardening against potentially broken hardware. Good to have but not necessary to backport.
--- drivers/iio/light/veml6075.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/iio/light/veml6075.c +6 -2
@@ -195,13 +195,17 @@ static int veml6075_read_uv_direct(struct veml6075_data *data, int chan,static int veml6075_read_int_time_index (struct veml6075_data *data) { -int ret, conf; +int ret, conf, int_index; ret =regmap_read (data->regmap,VEML6075_CMD_CONF , &conf);if (ret <0 )return ret; -return FIELD_GET (VEML6075_CONF_IT , conf); + int_index =FIELD_GET (VEML6075_CONF_IT , conf); +if (int_index >=ARRAY_SIZE (veml6075_it_ms)) +return -EINVAL ; + +return int_index; }static int veml6075_read_int_time_ms (struct veml6075_data *data,int *val)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 193/423 perf debug: Avoid stack overflow in recursive error message
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit bda840191d2aae3b7cadc3ac21835dcf29487191 ]
In debug_file, pr_warning_once is called on error. As that function calls debug_file the function will yield a stack overflow. Switch the location of the call so the recursion is avoided.
--- tools/perf/util/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/debug.c +1 -1
@@ -46,8 +46,8 @@ int debug_type_profile;FILE *debug_file (void ) {if (!_debug_file) { -pr_warning_once ("debug_file not set" );debug_set_file (stderr); +pr_warning_once ("debug_file not set" ); }return _debug_file; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 194/423 perf evlist: Add success path to evlist__create_syswide_maps
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit fe0ce8a9d85a48642880c9b78944cb0d23e779c5 ]
Over various refactorings evlist__create_syswide_maps has been made to only ever return with -ENOMEM. Fix this so that when perf_evlist__set_maps is successfully called, 0 is returned.
--- tools/perf/util/evlist.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
tools/perf/util/evlist.c +6 -7
@@ -1434,19 +1434,18 @@ static int evlist__create_syswide_maps(struct evlist *evlist)*/ cpus =perf_cpu_map__new_online_cpus ();if (!cpus) - goto out; +return -ENOMEM ; threads =perf_thread_map__new_dummy (); -if (!threads) - goto out_put; +if (!threads) { +perf_cpu_map__put (cpus); +return -ENOMEM ; + }perf_evlist__set_maps (&evlist->core, cpus, threads); -perf_thread_map__put (threads); -out_put:perf_cpu_map__put (cpus); -out: -return -ENOMEM ; +return 0 ; }int evlist__open (struct evlist *evlist)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 195/423 perf units: Fix insufficient array space
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit cf67629f7f637fb988228abdb3aae46d0c1748fe ]
No need to specify the array size, let the compiler figure that out.
This addresses this compiler warning that was noticed while build testing on fedora rawhide:
31 15.81 fedora:rawhide : FAIL gcc version 15.0.1 20250225 (Red Hat 15.0.1-0) (GCC)
util/units.c: In function 'unit_number__scnprintf':
util/units.c:67:24: error: initializer-string for array of 'char' is too long [-Werror=unterminated-string-initialization]
67 | char unit[4] = "BKMG";
| ^~~~~~
cc1: all warnings being treated as errors
--- tools/perf/util/units.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/units.c +1 -1
@@ -64,7 +64,7 @@ unsigned long convert_unit(unsigned long value, char *unit)int unit_number__scnprintf (char *buf,size_t size,u64 n) { -char unit[4 ] ="BKMG" ; +char unit[] ="BKMG" ;int i =0 ;while (((n /1024 ) >1 ) && (i <3 )) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 196/423 kernel/events/uprobes: handle device-exclusive entries correctly in __replace_page()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
[ Upstream commit 096cbb80ab3fd85a9035ec17a1312c2a7db8bc8c ]
Ever since commit b756a3b5e7ea ("mm: device exclusive memory access") we can return with a device-exclusive entry from page_vma_mapped_walk().
__replace_page() is not prepared for that, so teach it about these PFN swap PTEs. Note that device-private entries are so far not applicable on that path, because GUP would never have returned such folios (conversion to device-private happens by page migration, not in-place conversion of the PTE).
There is a race between GUP and us locking the folio to look it up using page_vma_mapped_walk(), so this is likely a fix (unless something else could prevent that race, but it doesn't look like). pte_pfn() on something that is not a present pte could give use garbage, and we'd wrongly mess up the mapcount because it was already adjusted by calling folio_remove_rmap_pte() when making the entry device-exclusive.
--- kernel/events/uprobes.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
kernel/events/uprobes.c +12 -1
@@ -167,6 +167,7 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr,DEFINE_FOLIO_VMA_WALK (pvmw, old_folio, vma, addr,0 );int err;struct mmu_notifier_range range; +pte_t pte;mmu_notifier_range_init (&range,MMU_NOTIFY_CLEAR ,0 , mm, addr, addr +PAGE_SIZE );
@@ -186,6 +187,16 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr,if (!page_vma_mapped_walk (&pvmw)) goto unlock;VM_BUG_ON_PAGE (addr != pvmw.address, old_page); + pte =ptep_get (pvmw.pte); + +/* +* Handle PFN swap PTES, such as device-exclusive ones, that actually +* map pages: simply trigger GUP again to fix it up. +*/ +if (unlikely (!pte_present (pte))) { +page_vma_mapped_walk_done (&pvmw); + goto unlock; + }if (new_page) {folio_get (new_folio);
@@ -200,7 +211,7 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr,inc_mm_counter (mm,MM_ANONPAGES ); } -flush_cache_page (vma, addr,pte_pfn (ptep_get (pvmw.pte))); +flush_cache_page (vma, addr,pte_pfn (pte));ptep_clear_flush (vma, addr, pvmw.pte);if (new_page) set_pte_at(mm, addr, pvmw.pte,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 197/423 kexec: initialize ELF lowest address to ULONG_MAX
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sourabh Jain <[email protected]>
[ Upstream commit 9986fb5164c8b21f6439cfd45ba36d8cc80c9710 ]
Patch series "powerpc/crash: use generic crashkernel reservation", v3.
Commit 0ab97169aa05 ("crash_core: add generic function to do reservation") added a generic function to reserve crashkernel memory. So let's use the same function on powerpc and remove the architecture-specific code that essentially does the same thing.
The generic crashkernel reservation also provides a way to split the crashkernel reservation into high and low memory reservations, which can be enabled for powerpc in the future.
Additionally move powerpc to use generic APIs to locate memory hole for kexec segments while loading kdump kernel.
This patch (of 7):
kexec_elf_load() loads an ELF executable and sets the address of the lowest PT_LOAD section to the address held by the lowest_load_addr function argument.
To determine the lowest PT_LOAD address, a local variable lowest_addr (type unsigned long) is initialized to UINT_MAX. After loading each PT_LOAD, its address is compared to lowest_addr. If a loaded PT_LOAD address is lower, lowest_addr is updated. However, setting lowest_addr to UINT_MAX won't work when the kernel image is loaded above 4G, as the returned lowest PT_LOAD address would be invalid. This is resolved by initializing lowest_addr to ULONG_MAX instead.
This issue was discovered while implementing crashkernel high/low reservation on the PowerPC architecture.
--- kernel/kexec_elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/kexec_elf.c +1 -1
@@ -390,7 +390,7 @@ int kexec_elf_load(struct kimage *image, struct elfhdr *ehdr,struct kexec_buf *kbuf, unsigned long *lowest_load_addr) { - unsigned long lowest_addr = UINT_MAX; + unsigned long lowest_addr = ULONG_MAX;int ret;size_t i;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 198/423 ocfs2: validate l_tree_depth to avoid out-of-bounds access
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasiliy Kovalev <[email protected]>
[ Upstream commit a406aff8c05115119127c962cbbbbd202e1973ef ]
The l_tree_depth field is 16-bit (__le16), but the actual maximum depth is limited to OCFS2_MAX_PATH_DEPTH.
Add a check to prevent out-of-bounds access if l_tree_depth has an invalid value, which may occur when reading from a corrupted mounted disk [1].
--- fs/ocfs2/alloc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/ocfs2/alloc.c +8 -0
@@ -1803,6 +1803,14 @@ static int __ocfs2_find_path(struct ocfs2_caching_info *ci, el = root_el;while (el->l_tree_depth) { +if (unlikely (le16_to_cpu (el->l_tree_depth) >=OCFS2_MAX_PATH_DEPTH )) { +ocfs2_error (ocfs2_metadata_cache_get_super (ci), +"Owner %llu has invalid tree depth %u in extent list\n" , + (unsigned long long )ocfs2_metadata_cache_owner (ci), +le16_to_cpu (el->l_tree_depth)); + ret = -EROFS ; + goto out; + }if (le16_to_cpu (el->l_next_free_rec) ==0 ) { ocfs2_error(ocfs2_metadata_cache_get_super(ci), "Owner %llu has empty extent list at depth %u\n",
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 199/423 arch/powerpc: drop GENERIC_PTDUMP from mpc885_ads_defconfig
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anshuman Khandual <[email protected]>
[ Upstream commit 2c5e6ac2db64ace51f66a9f3b3b3ab9553d748e8 ]
GENERIC_PTDUMP gets selected on powerpc explicitly and hence can be dropped off from mpc885_ads_defconfig. Replace with CONFIG_PTDUMP_DEBUGFS instead.
--- arch/powerpc/configs/mpc885_ads_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/configs/mpc885_ads_defconfig +1 -1
@@ -78,4 +78,4 @@ CONFIG_DEBUG_VM_PGTABLE=y CONFIG_DETECT_HUNG_TASK=y CONFIG_BDI_SWITCH=y CONFIG_PPC_EARLY_DEBUG=y -CONFIG_GENERIC_PTDUMP=y +CONFIG_PTDUMP_DEBUGFS=y
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 200/423 NFSv4: Dont trigger uneccessary scans for return-on-close delegations
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit 47acca884f714f41d95dc654f802845544554784 ]
The amount of looping through the list of delegations is occasionally leading to soft lockups. Avoid at least some loops by not requiring the NFSv4 state manager to scan for delegations that are marked for return-on-close. Instead, either mark them for immediate return (if possible) or else leave it up to nfs4_inode_return_delegation_on_close() to return them once the file is closed by the application.
--- fs/nfs/delegation.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-)
fs/nfs/delegation.c +18 -15
@@ -590,17 +590,6 @@ static bool nfs_delegation_need_return(struct nfs_delegation *delegation)if (test_and_clear_bit (NFS_DELEGATION_RETURN , &delegation->flags)) ret = true; -else if (test_bit (NFS_DELEGATION_RETURN_IF_CLOSED , &delegation->flags)) { -struct inode *inode; - -spin_lock (&delegation->lock); - inode = delegation->inode; -if (inode &&list_empty (&NFS_I (inode)->open_files)) - ret = true; -spin_unlock (&delegation->lock); - } -if (ret) -clear_bit (NFS_DELEGATION_RETURN_IF_CLOSED , &delegation->flags);if (test_bit (NFS_DELEGATION_RETURNING , &delegation->flags) ||test_bit (NFS_DELEGATION_RETURN_DELAYED , &delegation->flags) ||test_bit (NFS_DELEGATION_REVOKED , &delegation->flags))
@@ -878,11 +867,25 @@ int nfs4_inode_make_writeable(struct inode *inode)return nfs4_inode_return_delegation (inode); } -static void nfs_mark_return_if_closed_delegation (struct nfs_server *server, -struct nfs_delegation *delegation) +static void +nfs_mark_return_if_closed_delegation (struct nfs_server *server, +struct nfs_delegation *delegation) { -set_bit (NFS_DELEGATION_RETURN_IF_CLOSED , &delegation->flags); -set_bit (NFS4CLNT_DELEGRETURN , &server->nfs_client->cl_state); +struct inode *inode; + +if (test_bit (NFS_DELEGATION_RETURN , &delegation->flags) || +test_bit (NFS_DELEGATION_RETURN_IF_CLOSED , &delegation->flags)) +return ; +spin_lock (&delegation->lock); + inode = delegation->inode; +if (!inode) + goto out; +if (list_empty (&NFS_I (inode)->open_files)) +nfs_mark_return_delegation (server, delegation); +else +set_bit (NFS_DELEGATION_RETURN_IF_CLOSED , &delegation->flags); +out: +spin_unlock (&delegation->lock); }static bool nfs_server_mark_return_all_delegations (struct nfs_server *server)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 201/423 NFSv4: Avoid unnecessary scans of filesystems for returning delegations
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit 35a566a24e58f1b5f89737edf60b77de58719ed0 ]
The amount of looping through the list of delegations is occasionally leading to soft lockups. If the state manager was asked to return delegations asynchronously, it should only scan those filesystems that hold delegations that need to be returned.
--- fs/nfs/delegation.c | 5 +++++ include/linux/nfs_fs_sb.h | 2 ++ 2 files changed, 7 insertions(+)
fs/nfs/delegation.c +5 -0
@@ -79,6 +79,7 @@ static void nfs_mark_return_delegation(struct nfs_server *server, struct nfs_delegation *delegation) {set_bit (NFS_DELEGATION_RETURN , &delegation->flags); +set_bit (NFS4SERV_DELEGRETURN , &server->delegation_flags);set_bit (NFS4CLNT_DELEGRETURN , &server->nfs_client->cl_state); }
@@ -608,6 +609,9 @@ static int nfs_server_return_marked_delegations(struct nfs_server *server,struct nfs_delegation *place_holder_deleg =NULL ;int err =0 ; +if (!test_and_clear_bit (NFS4SERV_DELEGRETURN , + &server->delegation_flags)) +return 0 ; restart:/* * To avoid quadratic looping we hold a reference
@@ -659,6 +663,7 @@ static int nfs_server_return_marked_delegations(struct nfs_server *server,cond_resched ();if (!err) goto restart; +set_bit (NFS4SERV_DELEGRETURN , &server->delegation_flags);set_bit (NFS4CLNT_DELEGRETURN , &server->nfs_client->cl_state); goto out; }
include/linux/nfs_fs_sb.h +2 -0
@@ -251,6 +251,8 @@ struct nfs_server {struct list_head ss_copies;struct list_head ss_src_copies; +unsigned long delegation_flags; +#define NFS4SERV_DELEGRETURN (1)unsigned long delegation_gen;unsigned long mig_gen;unsigned long mig_status;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 202/423 NFSv4: Avoid unnecessary scans of filesystems for expired delegations
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit f163aa81a799e2d46d7f8f0b42a0e7770eaa0d06 ]
The amount of looping through the list of delegations is occasionally leading to soft lockups. If the state manager was asked to reap the expired delegations, it should scan only those filesystems that hold delegations that need to be reaped.
--- fs/nfs/delegation.c | 7 +++++++ include/linux/nfs_fs_sb.h | 1 + 2 files changed, 8 insertions(+)
fs/nfs/delegation.c +7 -0
@@ -1284,6 +1284,7 @@ static void nfs_mark_test_expired_delegation(struct nfs_server *server,return ;clear_bit (NFS_DELEGATION_NEED_RECLAIM , &delegation->flags);set_bit (NFS_DELEGATION_TEST_EXPIRED , &delegation->flags); +set_bit (NFS4SERV_DELEGATION_EXPIRED , &server->delegation_flags);set_bit (NFS4CLNT_DELEGATION_EXPIRED , &server->nfs_client->cl_state); }
@@ -1362,6 +1363,9 @@ static int nfs_server_reap_expired_delegations(struct nfs_server *server,nfs4_stateid stateid;unsigned long gen = ++server->delegation_gen; +if (!test_and_clear_bit (NFS4SERV_DELEGATION_EXPIRED , + &server->delegation_flags)) +return 0 ; restart:rcu_read_lock ();list_for_each_entry_rcu (delegation, &server->delegations, super_list) {
@@ -1391,6 +1395,9 @@ static int nfs_server_reap_expired_delegations(struct nfs_server *server, goto restart; }nfs_inode_mark_test_expired_delegation (server,inode); +set_bit (NFS4SERV_DELEGATION_EXPIRED , &server->delegation_flags); +set_bit (NFS4CLNT_DELEGATION_EXPIRED , + &server->nfs_client->cl_state);iput (inode);return -EAGAIN ; }
include/linux/nfs_fs_sb.h +1 -0
@@ -253,6 +253,7 @@ struct nfs_server {unsigned long delegation_flags;#define NFS4SERV_DELEGRETURN (1) +#define NFS4SERV_DELEGATION_EXPIRED (2)unsigned long delegation_gen;unsigned long mig_gen;unsigned long mig_status;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 203/423 NFSv4: Avoid unnecessary scans of filesystems for delayed delegations
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit e767b59e29b8327d25edde65efc743f479f30d0a ]
The amount of looping through the list of delegations is occasionally leading to soft lockups. If the state manager was asked to manage the delayed return of delegations, then only scan those filesystems containing delegations that were marked as being delayed.
--- fs/nfs/delegation.c | 18 ++++++++++++------ include/linux/nfs_fs_sb.h | 1 + 2 files changed, 13 insertions(+), 6 deletions(-)
fs/nfs/delegation.c +12 -6
@@ -331,14 +331,16 @@ nfs_start_delegation_return(struct nfs_inode *nfsi) }static void nfs_abort_delegation_return (struct nfs_delegation *delegation, -struct nfs_client *clp,int err) +struct nfs_server *server,int err) { -spin_lock (&delegation->lock);clear_bit (NFS_DELEGATION_RETURNING , &delegation->flags);if (err == -EAGAIN ) {set_bit (NFS_DELEGATION_RETURN_DELAYED , &delegation->flags); -set_bit (NFS4CLNT_DELEGRETURN_DELAYED , &clp->cl_state); +set_bit (NFS4SERV_DELEGRETURN_DELAYED , + &server->delegation_flags); +set_bit (NFS4CLNT_DELEGRETURN_DELAYED , + &server->nfs_client->cl_state); }spin_unlock (&delegation->lock); }
@@ -548,7 +550,7 @@ int nfs_inode_set_delegation(struct inode *inode, const struct cred *cred,*/ static int nfs_end_delegation_return (struct inode *inode,struct nfs_delegation *delegation,int issync) { -struct nfs_client *clp =NFS_SERVER (inode)->nfs_client; +struct nfs_server *server =NFS_SERVER (inode);unsigned int mode =O_WRONLY |O_RDWR ;int err =0 ;
@@ -570,11 +572,11 @@ static int nfs_end_delegation_return(struct inode *inode, struct nfs_delegation/* * Guard against state recovery */ - err =nfs4_wait_clnt_recover (clp); + err =nfs4_wait_clnt_recover (server->nfs_client); }if (err) { -nfs_abort_delegation_return (delegation, clp, err); +nfs_abort_delegation_return (delegation, server, err); goto out; }
@@ -678,6 +680,9 @@ static bool nfs_server_clear_delayed_delegations(struct nfs_server *server)struct nfs_delegation *d;bool ret = false; +if (!test_and_clear_bit (NFS4SERV_DELEGRETURN_DELAYED , + &server->delegation_flags)) + goto out; list_for_each_entry_rcu (d, &server->delegations, super_list) {if (!test_bit (NFS_DELEGATION_RETURN_DELAYED , &d->flags))continue ;
@@ -685,6 +690,7 @@ static bool nfs_server_clear_delayed_delegations(struct nfs_server *server)clear_bit (NFS_DELEGATION_RETURN_DELAYED , &d->flags); ret = true; } +out:return ret; }
include/linux/nfs_fs_sb.h +1 -0
@@ -254,6 +254,7 @@ struct nfs_server {unsigned long delegation_flags;#define NFS4SERV_DELEGRETURN (1)#define NFS4SERV_DELEGATION_EXPIRED (2) +#define NFS4SERV_DELEGRETURN_DELAYED (3)unsigned long delegation_gen;unsigned long mig_gen;unsigned long mig_status;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 204/423 NFS: fix open_owner_id_maxsz and related fields.
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
[ Upstream commit 43502f6e8d1e767d6736ea0676cc784025cf6eeb ]
A recent change increased the size of an NFSv4 open owner, but didn't increase the corresponding max_sz defines. This is not know to have caused failure, but should be fixed.
This patch also fixes some relates _maxsz fields that are wrong.
Note that the XXX_owner_id_maxsz values now are only the size of the id and do NOT include the len field that will always preceed the id in xdr encoding. I think this is clearer.
--- fs/nfs/nfs4xdr.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
fs/nfs/nfs4xdr.c +9 -9
@@ -82,9 +82,8 @@ static int decode_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req,* we currently use size 2 (u64) out of (NFS4_OPAQUE_LIMIT >> 2) */ #define pagepad_maxsz (1) -#define open_owner_id_maxsz (1 + 2 + 1 + 1 + 2) -#define lock_owner_id_maxsz (1 + 1 + 4) -#define decode_lockowner_maxsz (1 + XDR_QUADLEN(IDMAP_NAMESZ)) +#define open_owner_id_maxsz (2 + 1 + 2 + 2) +#define lock_owner_id_maxsz (2 + 1 + 2)#define compound_encode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2))#define compound_decode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2))#define op_encode_hdr_maxsz (1)
@@ -185,7 +184,7 @@ static int decode_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req,#define encode_claim_null_maxsz (1 + nfs4_name_maxsz)#define encode_open_maxsz (op_encode_hdr_maxsz + \ 2 + encode_share_access_maxsz + 2 + \ - open_owner_id_maxsz + \ + 1 + open_owner_id_maxsz + \ encode_opentype_maxsz + \ encode_claim_null_maxsz)#define decode_space_limit_maxsz (3)
@@ -255,13 +254,14 @@ static int decode_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req,#define encode_link_maxsz (op_encode_hdr_maxsz + \ nfs4_name_maxsz)#define decode_link_maxsz (op_decode_hdr_maxsz + decode_change_info_maxsz) -#define encode_lockowner_maxsz (7) +#define encode_lockowner_maxsz (2 + 1 + lock_owner_id_maxsz) +#define encode_lock_maxsz (op_encode_hdr_maxsz + \ 7 + \ 1 + encode_stateid_maxsz + 1 + \ encode_lockowner_maxsz)#define decode_lock_denied_maxsz \ - (8 + decode_lockowner_maxsz) + (2 + 2 + 1 + 2 + 1 + lock_owner_id_maxsz)#define decode_lock_maxsz (op_decode_hdr_maxsz + \ decode_lock_denied_maxsz)#define encode_lockt_maxsz (op_encode_hdr_maxsz + 5 + \
@@ -617,7 +617,7 @@ static int decode_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req, encode_lockowner_maxsz)#define NFS4_dec_release_lockowner_sz \ (compound_decode_hdr_maxsz + \ - decode_lockowner_maxsz) + decode_release_lockowner_maxsz)#define NFS4_enc_access_sz (compound_encode_hdr_maxsz + \ encode_sequence_maxsz + \ encode_putfh_maxsz + \
@@ -1412,7 +1412,7 @@ static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_opena__be32 *p;/* * opcode 4, seqid 4, share_access 4, share_deny 4, clientid 8, ownerlen 4, -* owner 4 = 32 +* owner 28 */ encode_nfs4_seqid (xdr, arg->seqid);encode_share_access (xdr, arg->share_access);
@@ -5077,7 +5077,7 @@ static int decode_link(struct xdr_stream *xdr, struct nfs4_change_info *cinfo)/* * We create the owner, so we know a proper owner.id length is 4. */ -static int decode_lock_denied (struct xdr_stream *xdr,struct file_lock *fl) +static int decode_lock_denied (struct xdr_stream *xdr,struct file_lock *fl) {uint64_t offset, length, clientid;__be32 *p;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 205/423 fuse: fix dax truncate/punch_hole fault path
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alistair Popple <[email protected]>
[ Upstream commit 7851bf649d423edd7286b292739f2eefded3d35c ]
Patch series "fs/dax: Fix ZONE_DEVICE page reference counts", v9.
Device and FS DAX pages have always maintained their own page reference counts without following the normal rules for page reference counting. In particular pages are considered free when the refcount hits one rather than zero and refcounts are not added when mapping the page.
Tracking this requires special PTE bits (PTE_DEVMAP) and a secondary mechanism for allowing GUP to hold references on the page (see get_dev_pagemap). However there doesn't seem to be any reason why FS DAX pages need their own reference counting scheme.
By treating the refcounts on these pages the same way as normal pages we can remove a lot of special checks. In particular pXd_trans_huge() becomes the same as pXd_leaf(), although I haven't made that change here. It also frees up a valuable SW define PTE bit on architectures that have devmap PTE bits defined.
It also almost certainly allows further clean-up of the devmap managed functions, but I have left that as a future improvment. It also enables support for compound ZONE_DEVICE pages which is one of my primary motivators for doing this work.
This patch (of 20):
FS DAX requires file systems to call into the DAX layout prior to unlinking inodes to ensure there is no ongoing DMA or other remote access to the direct mapped page. The fuse file system implements fuse_dax_break_layouts() to do this which includes a comment indicating that passing dmap_end == 0 leads to unmapping of the whole file.
However this is not true - passing dmap_end == 0 will not unmap anything before dmap_start, and further more dax_layout_busy_page_range() will not scan any of the range to see if there maybe ongoing DMA access to the range. Fix this by passing -1 for dmap_end to fuse_dax_break_layouts() which will invalidate the entire file range to dax_layout_busy_page_range().
--- fs/fuse/dax.c | 1 - fs/fuse/dir.c | 2 +- fs/fuse/file.c | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-)
fs/fuse/dax.c +0 -1
@@ -681,7 +681,6 @@ static int __fuse_dax_break_layouts(struct inode *inode, bool *retry, 0, 0, fuse_wait_dax_page(inode)); } -/* dmap_end == 0 leads to unmapping of whole file */ int fuse_dax_break_layouts (struct inode *inode,u64 dmap_start,u64 dmap_end) {
fs/fuse/dir.c +1 -1
@@ -1936,7 +1936,7 @@ int fuse_do_setattr(struct mnt_idmap *idmap, struct dentry *dentry,if (FUSE_IS_DAX (inode) && is_truncate) {filemap_invalidate_lock (mapping); fault_blocked = true; - err =fuse_dax_break_layouts (inode,0 ,0 ); + err =fuse_dax_break_layouts (inode,0 ,-1 );if (err) {filemap_invalidate_unlock (mapping);return err;
fs/fuse/file.c +2 -2
@@ -253,7 +253,7 @@ static int fuse_open(struct inode *inode, struct file *file)if (dax_truncate) {filemap_invalidate_lock (inode->i_mapping); - err =fuse_dax_break_layouts (inode,0 ,0 ); + err =fuse_dax_break_layouts (inode,0 ,-1 );if (err) goto out_inode_unlock; }
@@ -3146,7 +3146,7 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,inode_lock (inode);if (block_faults) {filemap_invalidate_lock (inode->i_mapping); - err =fuse_dax_break_layouts (inode,0 ,0 ); + err =fuse_dax_break_layouts (inode,0 ,-1 );if (err) goto out; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 206/423 selftests/mm/cow: fix the incorrect error handling
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cyan Yang <[email protected]>
[ Upstream commit f841ad9ca5007167c02de143980c9dc703f90b3d ]
Error handling doesn't check the correct return value. This patch will fix it.
--- tools/testing/selftests/mm/cow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/mm/cow.c +1 -1
@@ -876,7 +876,7 @@ static void do_run_with_thp(test_fn fn, enum thp_run thp_run, size_t thpsize) mremap_size = thpsize /2 ; mremap_mem =mmap (NULL , mremap_size,PROT_NONE ,MAP_PRIVATE |MAP_ANONYMOUS ,-1 ,0 ); -if (mem ==MAP_FAILED ) { +if (mremap_mem ==MAP_FAILED ) {ksft_test_result_fail ("mmap() failed\n" ); goto munmap; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 207/423 um: Pass the correct Rust target and options with gcc
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Gow <[email protected]>
[ Upstream commit 5550187c4c21740942c32a9ae56f9f472a104cb4 ]
In order to work around some issues with disabling SSE on older versions of gcc (compilation would fail upon seeing a function declaration containing a float, even if it was never called or defined), the corresponding CFLAGS and RUSTFLAGS were only set when using clang.
However, this led to two problems:
- Newer gcc versions also wouldn't get the correct flags, despite not having the bug.
- The RUSTFLAGS for setting the rust target definition were not set, despite being unrelated. This works by chance for x86_64, as the built-in default target is close enough, but not for 32-bit x86.
Move the target definition outside the conditional block, and update the condition to take into account the gcc version.
--- arch/x86/Makefile.um | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/x86/Makefile.um +4 -3
@@ -7,12 +7,13 @@ core-y += arch/x86/crypto/ # GCC versions < 11. See: # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99652 # -ifeq ($(CONFIG_CC_IS_CLANG),y) -KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -KBUILD_RUSTFLAGS += --target=$(objtree)/scripts/target.json +ifeq ($(call gcc-min-version, 110000)$(CONFIG_CC_IS_CLANG),y) +KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2 endif +KBUILD_RUSTFLAGS += --target=$(objtree)/scripts/target.json + ifeq ($(CONFIG_X86_32),y) START := 0x8048000
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 208/423 um: remove copy_from_kernel_nofault_allowed
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Berg <[email protected]>
[ Upstream commit 84a6fc378471fbeaf48f8604566a5a33a3d63c18 ]
There is no need to override the default version of this function anymore as UML now has proper _nofault memory access functions.
Doing this also fixes the fact that the implementation was incorrect as using mincore() will incorrectly flag pages as inaccessible if they were swapped out by the host.
--- arch/um/include/shared/os.h | 1 - arch/um/kernel/Makefile | 2 +- arch/um/kernel/maccess.c | 19 -------------- arch/um/os-Linux/process.c | 51 ------------------------------------- 4 files changed, 1 insertion(+), 72 deletions(-) delete mode 100644 arch/um/kernel/maccess.c
arch/um/include/shared/os.h +0 -1
@@ -218,7 +218,6 @@ extern int os_protect_memory(void *addr, unsigned long len,extern int os_unmap_memory (void *addr,int len);extern int os_drop_memory (void *addr,int length);extern int can_drop_memory (void ); -extern int os_mincore (void *addr,unsigned long len);/* execvp.c */ extern int execvp_noalloc (char *buf,const char *file,char *const argv[]);
arch/um/kernel/Makefile +1 -1
@@ -17,7 +17,7 @@ extra-y := vmlinux.lds obj-y = config.o exec.o exitcode.o irq.o ksyms.o mem.o \ physmem.o process.o ptrace.o reboot.o sigio.o \ signal.o sysrq.o time.o tlb.o trap.o \ - um_arch.o umid.o maccess.o kmsg_dump.o capflags.o skas/ + um_arch.o umid.o kmsg_dump.o capflags.o skas/ obj-y += load_file.o obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o
arch/um/kernel/maccess.c deleted +0 -19
@@ -1,19 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* -* Copyright (C) 2013 Richard Weinberger <[email protected]> -*/ - -#include <linux/uaccess.h> -#include <linux/kernel.h> -#include <os.h> - -bool copy_from_kernel_nofault_allowed (const void *src,size_t size) -{ -void *psrc = (void *)rounddown ((unsigned long )src,PAGE_SIZE ); - -if ((unsigned long )src <PAGE_SIZE || size <=0 ) -return false; -if (os_mincore (psrc, size + src - psrc) <=0 ) -return false; -return true; -}
arch/um/os-Linux/process.c +0 -51
57 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 209/423 um: hostfs: avoid issues on inode number reuse by host
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Berg <[email protected]>
[ Upstream commit 0bc754d1e31f40f4a343b692096d9e092ccc0370 ]
Some file systems (e.g. ext4) may reuse inode numbers once the inode is not in use anymore. Usually hostfs will keep an FD open for each inode, but this is not always the case. In the case of sockets, this cannot even be done properly.
As such, the following sequence of events was possible:
* application creates and deletes a socket
* hostfs creates/deletes the socket on the host
* inode is still in the hostfs cache
* hostfs creates a new file
* ext4 on the outside reuses the inode number
* hostfs finds the socket inode for the newly created file
* application receives -ENXIO when opening the file
As mentioned, this can only happen if the deleted file is a special file that is never opened on the host (i.e. no .open fop).
As such, to prevent issues, it is sufficient to check that the inode has the expected type. That said, also add a check for the inode birth time, just to be on the safe side.
--- fs/hostfs/hostfs.h | 2 +- fs/hostfs/hostfs_kern.c | 7 ++++- fs/hostfs/hostfs_user.c | 59 ++++++++++++++++++++++++----------------- 3 files changed, 41 insertions(+), 27 deletions(-)
fs/hostfs/hostfs.h +1 -1
@@ -60,7 +60,7 @@ struct hostfs_stat {unsigned int uid;unsigned int gid;unsigned long long size; -struct hostfs_timespec atime, mtime, ctime; +struct hostfs_timespec atime, mtime, ctime, btime;unsigned int blksize;unsigned long long blocks;struct {
fs/hostfs/hostfs_kern.c +6 -1
@@ -33,6 +33,7 @@ struct hostfs_inode_info {struct inode vfs_inode;struct mutex open_mutex;dev_t dev; +struct hostfs_timespec btime; };static inline struct hostfs_inode_info *HOSTFS_I (struct inode *inode)
@@ -550,6 +551,7 @@ static int hostfs_inode_set(struct inode *ino, void *data) }HOSTFS_I (ino)->dev = dev; +HOSTFS_I (ino)->btime = st->btime; ino->i_ino = st->ino; ino->i_mode = st->mode;return hostfs_inode_update (ino, st);
@@ -560,7 +562,10 @@ static int hostfs_inode_test(struct inode *inode, void *data)const struct hostfs_stat *st = data;dev_t dev =MKDEV (st->dev.maj, st->dev.min); -return inode->i_ino == st->ino &&HOSTFS_I (inode)->dev == dev; +return inode->i_ino == st->ino &&HOSTFS_I (inode)->dev == dev && + (inode->i_mode &S_IFMT ) == (st->mode &S_IFMT ) && +HOSTFS_I (inode)->btime.tv_sec == st->btime.tv_sec && +HOSTFS_I (inode)->btime.tv_nsec == st->btime.tv_nsec; }static struct inode *hostfs_iget (struct super_block *sb,char *name)
fs/hostfs/hostfs_user.c +34 -25
73 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 210/423 i3c: master: svc: Fix missing the IBI rules
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanley Chu <[email protected]>
[ Upstream commit 9cecad134d84d14dc72a0eea7a107691c3e5a837 ]
The code does not add IBI rules for devices with controller capability. However, the secondary controller has the controller capability and works at target mode when the device is probed. Therefore, add IBI rules for such devices.
--- drivers/i3c/master/svc-i3c-master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i3c/master/svc-i3c-master.c +1 -1
@@ -990,7 +990,7 @@ static int svc_i3c_update_ibirules(struct svc_i3c_master *master)/* Create the IBIRULES register for both cases */ i3c_bus_for_each_i3cdev (&master->base.bus, dev) { -if (I3C_BCR_DEVICE_ROLE (dev->info.bcr) ==I3C_BCR_I3C_MASTER ) +if (!(dev->info.bcr &I3C_BCR_IBI_REQ_CAP ))continue ;if (dev->info.bcr &I3C_BCR_IBI_PAYLOAD ) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 211/423 perf python: Fixup description of sample.id event member
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 1376c195e8ad327bb9f2d32e0acc5ac39e7cb30a ]
Some old cut'n'paste error, its "ip", so the description should be "event ip", not "event type".
--- tools/perf/util/python.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/python.c +1 -1
@@ -79,7 +79,7 @@ struct pyrf_event { };#define sample_members \ - sample_member_def(sample_ip, ip, T_ULONGLONG, "event type"), \ + sample_member_def(sample_ip, ip, T_ULONGLONG, "event ip"), \ sample_member_def(sample_pid, pid, T_INT, "event pid"), \ sample_member_def(sample_tid, tid, T_INT, "event tid"), \ sample_member_def(sample_time, time, T_ULONGLONG, "event timestamp"), \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 212/423 perf python: Decrement the refcount of just created event on failure
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 3de5a2bf5b4847f7a59a184568f969f8fe05d57f ]
To avoid a leak if we have the python object but then something happens and we need to return the operation, decrement the offset of the newly created object.
--- tools/perf/util/python.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/util/python.c +5 -1
@@ -1011,6 +1011,7 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist, evsel =evlist__event2evsel (evlist, event);if (!evsel) { +Py_DECREF (pyevent);Py_INCREF (Py_None);return Py_None; }
@@ -1022,9 +1023,12 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,/* Consume the even only after we parsed it out. */ perf_mmap__consume (&md->core); -if (err) +if (err) { +Py_DECREF (pyevent);return PyErr_Format (PyExc_OSError,"perf: can't parse sample, err=%d" , err); + } +return pyevent; } end:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 213/423 perf python: Dont keep a raw_data pointer to consumed ring buffer space
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit f3fed3ae34d606819d87a63d970cc3092a5be7ab ]
When processing tracepoints the perf python binding was parsing the event before calling perf_mmap__consume(&md->core) in pyrf_evlist__read_on_cpu().
But part of this event parsing was to set the perf_sample->raw_data pointer to the payload of the event, which then could be overwritten by other event before tracepoint fields were asked for via event.prev_comm in a python program, for instance.
This also happened with other fields, but strings were were problems were surfacing, as there is UTF-8 validation for the potentially garbled data.
This ended up showing up as (with some added debugging messages):
( field 'prev_comm' ret=0x7f7c31f65110, raw_size=68 ) ( field 'prev_pid' ret=0x7f7c23b1bed0, raw_size=68 ) ( field 'prev_prio' ret=0x7f7c239c0030, raw_size=68 ) ( field 'prev_state' ret=0x7f7c239c0250, raw_size=68 ) time 14771421785867 prev_comm= prev_pid=1919907691 prev_prio=796026219 prev_state=0x303a32313175 ==> ( XXX '��' len=16, raw_size=68) ( field 'next_comm' ret=(nil), raw_size=68 ) Traceback (most recent call last):
File "/home/acme/git/perf-tools-next/tools/perf/python/tracepoint.py", line 51, in <module>
main()
File "/home/acme/git/perf-tools-next/tools/perf/python/tracepoint.py", line 46, in main
event.next_comm,
^^^^^^^^^^^^^^^ AttributeError: 'perf.sample_event' object has no attribute 'next_comm'
When event.next_comm was asked for, the PyUnicode_FromString() python API would fail and that tracepoint field wouldn't be available, stopping the tools/perf/python/tracepoint.py test tool.
But, since we already do a copy of the whole event in pyrf_event__new, just use it and while at it remove what was done in in e8968e654191390a ("perf python: Fix pyrf_evlist__read_on_cpu event consuming") because we don't really need to wait for parsing the sample before declaring the event as consumed.
This copy is questionable as is now, as it limits the maximum event + sample_type and tracepoint payload to sizeof(union perf_event), this all has been "working" because 'struct perf_event_mmap2', the largest entry in 'union perf_event' is:
$ pahole -C perf_event ~/bin/perf | grep mmap2 struct perf_record_mmap2 mmap2; /* 0 4168 */ $
--- tools/perf/util/python.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
tools/perf/util/python.c +1 -3
@@ -1018,11 +1018,9 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist, pevent->evsel = evsel; - err =evsel__parse_sample (evsel, event, &pevent->sample); - -/* Consume the even only after we parsed it out. */ perf_mmap__consume (&md->core); + err =evsel__parse_sample (evsel, &pevent->event, &pevent->sample);if (err) {Py_DECREF (pyevent); return PyErr_Format(PyExc_OSError,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 214/423 perf python: Check if there is space to copy all the event
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 89aaeaf84231157288035b366cb6300c1c6cac64 ]
The pyrf_event__new() method copies the event obtained from the perf ring buffer to a structure that will then be turned into a python object for further consumption, so it copies perf_event.header.size bytes to its 'event' member:
$ pahole -C pyrf_event /tmp/build/perf-tools-next/python/perf.cpython-312-x86_64-linux-gnu.so
struct pyrf_event {
PyObject ob_base; /* 0 16 */
struct evsel * evsel; /* 16 8 */
struct perf_sample sample; /* 24 312 *//* XXX last struct has 7 bytes of padding, 2 holes */
/* --- cacheline 5 boundary (320 bytes) was 16 bytes ago --- */
union perf_event event; /* 336 4168 */
/* size: 4504, cachelines: 71, members: 4 */ /* member types with holes: 1, total: 2 */ /* paddings: 1, sum paddings: 7 */ /* last cacheline: 24 bytes */ };
$
It was doing so without checking if the event just obtained has more than that space, fix it.
This isn't a proper, final solution, as we need to support larger events, but for the time being we at least bounds check and document it.
--- tools/perf/util/python.c | 5 +++++ 1 file changed, 5 insertions(+)
tools/perf/util/python.c +5 -0
@@ -512,6 +512,11 @@ static PyObject *pyrf_event__new(union perf_event *event) event->header.type == PERF_RECORD_SWITCH_CPU_WIDE))return NULL ; +// FIXME this better be dynamic or we need to parse everything +// before calling perf_mmap__consume(), including tracepoint fields. +if (sizeof (pevent->event) < event->header.size) +return NULL ; + ptype = pyrf_event__type[event->header.type]; pevent = PyObject_New(struct pyrf_event, ptype);if (pevent !=NULL )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 215/423 perf dso: fix dso__is_kallsyms() check
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Brennan <[email protected]>
[ Upstream commit ebf0b332732dcc64239119e554faa946562b0b93 ]
Kernel modules for which we cannot find a file on-disk will have a dso->long_name that looks like "[module_name]". Prior to the commit listed in the fixes, the dso->kernel field would be zero (for user space), so dso__is_kallsyms() would return false. After the commit, kernel module DSOs are correctly labeled, but the result is that dso__is_kallsyms() erroneously returns true for those modules without a filesystem path.
Later, build_id_cache__add() consults this value of is_kallsyms, and when true, it copies /proc/kallsyms into the cache. Users with many kernel modules without a filesystem path (e.g. ksplice or possibly kernel live patch modules) have reported excessive disk space usage in the build ID cache directory due to this behavior.
To reproduce the issue, it's enough to build a trivial out-of-tree hello world kernel module, load it using insmod, and then use:
perf record -ag -- sleep 1
In the build ID directory, there will be a directory for your module name containing a kallsyms file.
Fix this up by changing dso__is_kallsyms() to consult the dso_binary_type enumeration, which is also symmetric to the above checks for dso__is_vmlinux() and dso__is_kcore(). With this change, kallsyms is not cached in the build-id cache for out-of-tree modules.
--- tools/perf/util/dso.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/util/dso.h +3 -1
@@ -808,7 +808,9 @@ static inline bool dso__is_kcore(const struct dso *dso)static inline bool dso__is_kallsyms (const struct dso *dso) { -return RC_CHK_ACCESS (dso)->kernel &&RC_CHK_ACCESS (dso)->long_name[0 ] !='/' ; +enum dso_binary_type bt =dso__binary_type (dso); + +return bt ==DSO_BINARY_TYPE__KALLSYMS || bt ==DSO_BINARY_TYPE__GUEST_KALLSYMS ; }bool dso__is_object_file (const struct dso *dso);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 216/423 perf: intel-tpebs: Fix incorrect usage of zfree()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Clark <[email protected]>
[ Upstream commit 6d2dcd635204c023eb5328ad7d38b198a5558c9b ]
zfree() requires an address otherwise it frees what's in name, rather than name itself. Pass the address of name to fix it.
This was the only incorrect occurrence in Perf found using a search.
--- tools/perf/util/intel-tpebs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/intel-tpebs.c +1 -1
@@ -254,7 +254,7 @@ int tpebs_start(struct evlist *evsel_list) new =zalloc (sizeof (*new));if (!new) { ret =-1 ; -zfree (name); +zfree (&name); goto err; } new->name = name;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 217/423 staging: rtl8723bs: select CONFIG_CRYPTO_LIB_AES
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: 谢致邦 (XIE Zhibang) <[email protected]>
[ Upstream commit b2a9a6a26b7e954297e51822e396572026480bad ]
This fixes the following issue:
ERROR: modpost: "aes_expandkey" [drivers/staging/rtl8723bs/r8723bs.ko] undefined!
ERROR: modpost: "aes_encrypt" [drivers/staging/rtl8723bs/r8723bs.ko] undefined!
--- drivers/staging/rtl8723bs/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/staging/rtl8723bs/Kconfig +1 -0
@@ -4,6 +4,7 @@ config RTL8723BS depends on WLAN && MMC && CFG80211 depends on m select CRYPTO + select CRYPTO_LIB_AES select CRYPTO_LIB_ARC4 help This option enables support for RTL8723BS SDIO drivers, such as
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 218/423 staging: vchiq_arm: Register debugfs after cdev
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Wahren <[email protected]>
[ Upstream commit 63f4dbb196db60a8536ba3d1b835d597a83f6cbb ]
The commit 2a4d15a4ae98 ("staging: vchiq: Refactor vchiq cdev code") moved the debugfs directory creation before vchiq character device registration. In case the latter fails, the debugfs directory won't be cleaned up.
--- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +2 -2
@@ -1745,8 +1745,6 @@ static int vchiq_probe(struct platform_device *pdev)if (ret) goto failed_platform_init; -vchiq_debugfs_init (&mgmt->state); -dev_dbg (&pdev->dev,"arm: platform initialised - version %d (min %d)\n" ,VCHIQ_VERSION ,VCHIQ_VERSION_MIN );
@@ -1760,6 +1758,8 @@ static int vchiq_probe(struct platform_device *pdev) goto error_exit; } +vchiq_debugfs_init (&mgmt->state); + bcm2835_audio =vchiq_device_register (&pdev->dev,"bcm2835-audio" ); bcm2835_camera =vchiq_device_register (&pdev->dev,"bcm2835-camera" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 219/423 staging: vchiq_arm: Fix possible NPR of keep-alive thread
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Wahren <[email protected]>
[ Upstream commit 3db89bc6d973e2bcaa852f6409c98c228f39a926 ]
In case vchiq_platform_conn_state_changed() is never called or fails before driver removal, ka_thread won't be a valid pointer to a task_struct. So do the necessary checks before calling kthread_stop to avoid a crash.
--- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +2 -1
@@ -1786,7 +1786,8 @@ static void vchiq_remove(struct platform_device *pdev)kthread_stop (mgmt->state.slot_handler_thread); arm_state =vchiq_platform_get_arm_state (&mgmt->state); -kthread_stop (arm_state->ka_thread); +if (!IS_ERR_OR_NULL (arm_state->ka_thread)) +kthread_stop (arm_state->ka_thread); }static struct platform_driver vchiq_driver = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 220/423 tty: n_tty: use uint for space returned by tty_write_room()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Slaby (SUSE) <[email protected]>
[ Upstream commit d97aa066678bd1e2951ee93db9690835dfe57ab6 ]
tty_write_room() returns an "unsigned int". So in case some insane driver (like my tty test driver) returns (legitimate) UINT_MAX from its tty_operations::write_room(), n_tty is confused on several places.
For example, in process_output_block(), the result of tty_write_room() is stored into (signed) "int". So this UINT_MAX suddenly becomes -1. And that is extended to ssize_t and returned from process_output_block(). This causes a write() to such a node to receive -EPERM (which is -1).
Fix that by using proper "unsigned int" and proper "== 0" test. And return 0 constant directly in that "if", so that it is immediately clear what is returned ("space" equals to 0 at that point).
Similarly for process_output() and __process_echoes().
Note this does not fix any in-tree driver as of now.
If you want "Fixes: something", it would be commit 03b3b1a2405c ("tty:
make tty_operations::write_room return uint"). I intentionally do not mark this patch by a real tag below.
--- drivers/tty/n_tty.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/tty/n_tty.c +7 -6
@@ -486,7 +486,8 @@ static int do_output_char(u8 c, struct tty_struct *tty, int space)static int process_output (u8 c,struct tty_struct *tty) {struct n_tty_data *ldata = tty->disc_data; -int space, retval; +unsigned int space; +int retval;mutex_lock (&ldata->output_lock);
@@ -522,16 +523,16 @@ static ssize_t process_output_block(struct tty_struct *tty, const u8 *buf, unsigned int nr) {struct n_tty_data *ldata = tty->disc_data; -int space; -int i; +unsigned int space; +int i;const u8 *cp;mutex_lock (&ldata->output_lock); space =tty_write_room (tty); -if (space <=0 ) { +if (space ==0 ) {mutex_unlock (&ldata->output_lock); -return space; +return 0 ; }if (nr > space) nr = space;
@@ -696,7 +697,7 @@ static int n_tty_process_echo_ops(struct tty_struct *tty, size_t *tail,static size_t __process_echoes (struct tty_struct *tty) {struct n_tty_data *ldata = tty->disc_data; -int space, old_space; +unsigned int space, old_space;size_t tail;u8 c;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 221/423 perf vendor events arm64 AmpereOneX: Fix frontend_bound calculation
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilkka Koskinen <[email protected]>
[ Upstream commit 182f12f3193341c3400ae719a34c00a8a1204cff ]
frontend_bound metrics was miscalculated due to different scaling in a couple of metrics it depends on. Change the scaling to match with AmpereOne.
--- .../arch/arm64/ampere/ampereonex/metrics.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
tools/perf/pmu-events/arch/arm64/ampere/ampereonex/metrics.json +5 -5
@@ -229,19 +229,19 @@ }, { "MetricName": "slots_lost_misspeculation_fraction", - "MetricExpr": "(OP_SPEC - OP_RETIRED) / (CPU_CYCLES * #slots)", + "MetricExpr": "100 * (OP_SPEC - OP_RETIRED) / (CPU_CYCLES * #slots)", "BriefDescription": "Fraction of slots lost due to misspeculation", "DefaultMetricgroupName": "TopdownL1", "MetricGroup": "Default;TopdownL1", - "ScaleUnit": "100percent of slots" + "ScaleUnit": "1percent of slots" }, { "MetricName": "retired_fraction", - "MetricExpr": "OP_RETIRED / (CPU_CYCLES * #slots)", + "MetricExpr": "100 * OP_RETIRED / (CPU_CYCLES * #slots)", "BriefDescription": "Fraction of slots retiring, useful work", "DefaultMetricgroupName": "TopdownL1", "MetricGroup": "Default;TopdownL1", - "ScaleUnit": "100percent of slots" + "ScaleUnit": "1percent of slots" }, { "MetricName": "backend_core",
@@ -266,7 +266,7 @@ }, { "MetricName": "frontend_bandwidth", - "MetricExpr": "frontend_bound - frontend_latency", + "MetricExpr": "frontend_bound - 100 * frontend_latency", "BriefDescription": "Fraction of slots the CPU did not dispatch at full bandwidth - able to dispatch partial slots only (1, 2, or 3 uops)", "MetricGroup": "TopdownL2", "ScaleUnit": "1percent of slots"
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 222/423 fs/procfs: fix the comment above proc_pid_wchan()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
[ Upstream commit 6287fbad1cd91f0c25cdc3a580499060828a8f30 ]
proc_pid_wchan() used to report kernel addresses to user space but that is no longer the case today. Bring the comment above proc_pid_wchan() in sync with the implementation.
--- fs/proc/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/proc/base.c +1 -1
@@ -417,7 +417,7 @@ static const struct file_operations proc_pid_cmdline_ops = {#ifdef CONFIG_KALLSYMS /* * Provides a wchan file via kallsyms in a proper one-value-per-file format. -* Returns the resolved symbol. If that fails, simply return the address. +* Returns the resolved symbol to user space. */ static int proc_pid_wchan (struct seq_file *m,struct pid_namespace *ns,struct pid *pid,struct task_struct *task)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 223/423 perf tools: annotate asm_pure_loop.S
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcus Meissner <[email protected]>
[ Upstream commit 9a352a90e88a041f4b26d359493e12a7f5ae1a6a ]
Annotate so it is built with non-executable stack.
--- tools/perf/tests/shell/coresight/asm_pure_loop/asm_pure_loop.S | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/tests/shell/coresight/asm_pure_loop/asm_pure_loop.S +2 -0
@@ -26,3 +26,5 @@ skip: mov x0, #0 mov x8, #93 // __NR_exit syscall svc #0 + +.section .note.GNU-stack, "", @progbits
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 224/423 perf bpf-filter: Fix a parsing error with comma
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 35d13f841a3d8159ef20d5e32a9ed3faa27875bc ]
The previous change to support cgroup filters introduced a bug that pathname can include commas. It confused the lexer to treat an item and the trailing comma as a single token. And it resulted in a parse error:
$ sudo perf record -e cycles:P --filter 'period > 0, ip > 64' -- true perf_bpf_filter: Error: Unexpected item: 0, perf_bpf_filter: syntax error, unexpected BFT_ERROR, expecting BFT_NUM
Usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
--filter <filter>
event filter
It should get "0" and "," separately.
An easiest fix would be to remove "," from the possible pathname characters. As it's for cgroup names, probably ok to assume it won't have commas in the pathname.
I found that the existing BPF filtering test didn't have any complex filter condition with commas. Let's update the group filter test which is supposed to test filter combinations like this.
--- tools/perf/tests/shell/record_bpf_filter.sh | 4 ++-- tools/perf/util/bpf-filter.l | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
tools/perf/tests/shell/record_bpf_filter.sh +2 -2
@@ -89,7 +89,7 @@ test_bpf_filter_fail() { test_bpf_filter_group() { echo "Group bpf-filter test" - if ! perf record -e task-clock --filter 'period > 1000 || ip > 0' \ + if ! perf record -e task-clock --filter 'period > 1000, ip > 0' \ -o /dev/null true 2>/dev/null then echo "Group bpf-filter test [Failed should succeed]"
@@ -97,7 +97,7 @@ test_bpf_filter_group() { return fi - if ! perf record -e task-clock --filter 'cpu > 0 || ip > 0' \ + if ! perf record -e task-clock --filter 'period > 1000 , cpu > 0 || ip > 0' \ -o /dev/null true 2>&1 | grep -q PERF_SAMPLE_CPU then echo "Group bpf-filter test [Failed forbidden CPU]"
tools/perf/util/bpf-filter.l +1 -1
@@ -76,7 +76,7 @@ static int path_or_error(void) num_dec [0-9]+ num_hex 0[Xx][0-9a-fA-F]+ space [ \t]+ -path [^ \t\n]+ +path [^ \t\n,]+ ident [_a-zA-Z][_a-zA-Z0-9]+ %%
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 225/423 thermal: core: Remove duplicate struct declaration
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: xueqin Luo <[email protected]>
[ Upstream commit 9e6ec8cf64e2973f0ec74f09023988cabd218426 ]
The struct thermal_zone_device is already declared on line 32, so the duplicate declaration has been removed.
--- include/linux/thermal.h | 2 -- 1 file changed, 2 deletions(-)
include/linux/thermal.h +0 -2
@@ -83,8 +83,6 @@ struct thermal_trip {#define THERMAL_TRIP_PRIV_TO_INT (_val_) (uintptr_t)(_val_)#define THERMAL_INT_TO_TRIP_PRIV (_val_) (void *)(uintptr_t)(_val_) -struct thermal_zone_device ; -struct cooling_spec {unsigned long upper;/* Highest cooling state */ unsigned long lower;/* Lowest cooling state */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 226/423 objtool, nvmet: Fix out-of-bounds stack access in nvmet_ctrl_state_show()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
[ Upstream commit 107a23185d990e3df6638d9a84c835f963fe30a6 ]
The csts_state_names[] array only has six sparse entries, but the iteration code in nvmet_ctrl_state_show() iterates seven, resulting in a potential out-of-bounds stack read. Fix that.
Fixes the following warning with an UBSAN kernel:
vmlinux.o: warning: objtool: .text.nvmet_ctrl_state_show: unexpected end of section
--- drivers/nvme/target/debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/debugfs.c +1 -1
@@ -78,7 +78,7 @@ static int nvmet_ctrl_state_show(struct seq_file *m, void *p)bool sep = false;int i; -for (i =0 ; i <7 ; i++) { +for (i =0 ; i <ARRAY_SIZE (csts_state_names); i++) {int state =BIT (i);if (!(ctrl->csts & state))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 227/423 objtool, media: dib8000: Prevent divide-by-zero in dib8000_set_dds()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
[ Upstream commit e63d465f59011dede0a0f1d21718b59a64c3ff5c ]
If dib8000_set_dds()'s call to dib8000_read32() returns zero, the result is a divide-by-zero. Prevent that from happening.
Fixes the following warning with an UBSAN kernel:
drivers/media/dvb-frontends/dib8000.o: warning: objtool: dib8000_tune() falls through to next function dib8096p_cfg_DibRx()
--- drivers/media/dvb-frontends/dib8000.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/dvb-frontends/dib8000.c +4 -1
@@ -2701,8 +2701,11 @@ static void dib8000_set_dds(struct dib8000_state *state, s32 offset_khz)u8 ratio;if (state->revision ==0x8090 ) { +u32 internal =dib8000_read32 (state,23 ) /1000 ; + ratio =4 ; - unit_khz_dds_val = (1 <<26 ) / (dib8000_read32 (state,23 ) /1000 ); + + unit_khz_dds_val = (1 <<26 ) / (internal ?:1 );if (offset_khz <0 ) dds = (1 <<26 ) - (abs_offset_khz * unit_khz_dds_val);else
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 228/423 NFS: Shut down the nfs_client only after all the superblocks
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit 2d3e998a0bc7fe26a724f87a8ce217848040520e ]
The nfs_client manages state for all the superblocks in the "cl_superblocks" list, so it must not be shut down until all of them are gone.
--- fs/nfs/sysfs.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
fs/nfs/sysfs.c +21 -1
@@ -14,6 +14,7 @@#include <linux/rcupdate.h> #include <linux/lockd/lockd.h> +#include "internal.h" #include "nfs4_fs.h" #include "netns.h" #include "sysfs.h"
@@ -228,6 +229,25 @@ static void shutdown_client(struct rpc_clnt *clnt)rpc_cancel_tasks (clnt, -EIO , shutdown_match_client,NULL ); } +/* +* Shut down the nfs_client only once all the superblocks +* have been shut down. +*/ +static void shutdown_nfs_client (struct nfs_client *clp) +{ +struct nfs_server *server; +rcu_read_lock (); +list_for_each_entry_rcu (server, &clp->cl_superblocks, client_link) { +if (!(server->flags &NFS_MOUNT_SHUTDOWN )) { +rcu_read_unlock (); +return ; + } + } +rcu_read_unlock (); +nfs_mark_client_ready (clp, -EIO ); +shutdown_client (clp->cl_rpcclient); +} +static ssize_t shutdown_show (struct kobject *kobj,struct kobj_attribute *attr,char *buf)
@@ -259,7 +279,6 @@ shutdown_store(struct kobject *kobj, struct kobj_attribute *attr, server->flags |=NFS_MOUNT_SHUTDOWN ;shutdown_client (server->client); -shutdown_client (server->nfs_client->cl_rpcclient);if (!IS_ERR (server->client_acl))shutdown_client (server->client_acl);
@@ -267,6 +286,7 @@ shutdown_store(struct kobject *kobj, struct kobj_attribute *attr,if (server->nlm_host)shutdown_client (server->nlm_host->h_rpcclnt); out: +shutdown_nfs_client (server->nfs_client);return count; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 229/423 smb: client: Fix netns refcount imbalance causing leaks and use-after-free
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Zhaolong <[email protected]>
[ Upstream commit 4e7f1644f2ac6d01dc584f6301c3b1d5aac4eaef ]
Commit ef7134c7fc48 ("smb: client: Fix use-after-free of network namespace.") attempted to fix a netns use-after-free issue by manually adjusting reference counts via sk->sk_net_refcnt and sock_inuse_add().
However, a later commit e9f2517a3e18 ("smb: client: fix TCP timers deadlock after rmmod") pointed out that the approach of manually setting sk->sk_net_refcnt in the first commit was technically incorrect, as sk->sk_net_refcnt should only be set for user sockets. It led to issues like TCP timers not being cleared properly on close. The second commit moved to a model of just holding an extra netns reference for server->ssocket using get_net(), and dropping it when the server is torn down.
But there remain some gaps in the get_net()/put_net() balancing added by these commits. The incomplete reference handling in these fixes results in two issues:
1. Netns refcount leaks[1]
The problem process is as follows:
```
mount.cifs cifsd
cifs_do_mount
cifs_mount
cifs_mount_get_session
cifs_get_tcp_session
get_net() /* First get net. */
ip_connect
generic_ip_connect /* Try port 445 */
get_net()
->connect() /* Failed */
put_net()
generic_ip_connect /* Try port 139 */
get_net() /* Missing matching put_net() for this get_net().*/
cifs_get_smb_ses
cifs_negotiate_protocol
smb2_negotiate
SMB2_negotiate
cifs_send_recv
wait_for_response
cifs_demultiplex_thread
cifs_read_from_socket
cifs_readv_from_socket
cifs_reconnect
cifs_abort_connection
sock_release();
server->ssocket = NULL;
/* Missing put_net() here. */
generic_ip_connect
get_net()
->connect() /* Failed */
put_net()
sock_release();
server->ssocket = NULL;
free_rsp_buf
...
clean_demultiplex_info
/* It's only called once here. */
put_net()
```When cifs_reconnect() is triggered, the server->ssocket is released without a corresponding put_net() for the reference acquired in generic_ip_connect() before. it ends up calling generic_ip_connect() again to retry get_net(). After that, server->ssocket is set to NULL in the error path of generic_ip_connect(), and the net count cannot be released in the final clean_demultiplex_info() function.
2. Potential use-after-free
The current refcounting scheme can lead to a potential use-after-free issue in the following scenario:
```
cifs_do_mount
cifs_mount
cifs_mount_get_session
cifs_get_tcp_session
get_net() /* First get net */
ip_connect
generic_ip_connect
get_net()
bind_socket
kernel_bind /* failed */
put_net()
/* after out_err_crypto_release label */
put_net()
/* after out_err label */
put_net()
```In the exception handling process where binding the socket fails, the get_net() and put_net() calls are unbalanced, which may cause the server->net reference count to drop to zero and be prematurely released.
To address both issues, this patch ties the netns reference counting to the server->ssocket and server lifecycles. The extra reference is now acquired when the server or socket is created, and released when the socket is destroyed or the server is torn down.
[1]: https://bugzilla.kernel.org/show_bug.cgi?id=219792
--- fs/smb/client/connect.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/smb/client/connect.c +8 -8
@@ -316,6 +316,7 @@ cifs_abort_connection(struct TCP_Server_Info *server) server->ssocket->flags);sock_release (server->ssocket); server->ssocket =NULL ; +put_net (cifs_net_ns (server)); } server->sequence_number =0 ; server->session_estab = false;
@@ -3138,8 +3139,12 @@ generic_ip_connect(struct TCP_Server_Info *server)/* * Grab netns reference for the socket. * -* It'll be released here, on error, or in clean_demultiplex_info() upon server -* teardown. +* This reference will be released in several situations: +* - In the failure path before the cifsd thread is started. +* - In the all place where server->socket is released, it is +* also set to NULL. +* - Ultimately in clean_demultiplex_info(), during the final +* teardown. */ get_net (net);
@@ -3155,10 +3160,8 @@ generic_ip_connect(struct TCP_Server_Info *server) } rc =bind_socket (server); -if (rc <0 ) { -put_net (cifs_net_ns (server)); +if (rc <0 )return rc; - }/* * Eventually check for other socket options to change from
@@ -3204,9 +3207,6 @@ generic_ip_connect(struct TCP_Server_Info *server)if (sport ==htons (RFC1001_PORT )) rc =ip_rfc1001_connect (server); -if (rc <0 ) -put_net (cifs_net_ns (server)); -return rc; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 230/423 exfat: fix the infinite loop in exfat_find_last_cluster()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuezhang Mo <[email protected]>
[ Upstream commit b0522303f67255926b946aa66885a0104d1b2980 ]
In exfat_find_last_cluster(), the cluster chain is traversed until the EOF cluster. If the cluster chain includes a loop due to file system corruption, the EOF cluster cannot be traversed, resulting in an infinite loop.
If the number of clusters indicated by the file size is inconsistent with the cluster chain length, exfat_find_last_cluster() will return an error, so if this inconsistency is found, the traversal can be aborted without traversing to the EOF cluster.
--- fs/exfat/fatent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/exfat/fatent.c +1 -1
@@ -265,7 +265,7 @@ int exfat_find_last_cluster(struct super_block *sb, struct exfat_chain *p_chain, clu = next;if (exfat_ent_get (sb, clu, &next))return -EIO ; - }while (next !=EXFAT_EOF_CLUSTER ); + }while (next !=EXFAT_EOF_CLUSTER && count <= p_chain->size);if (p_chain->size != count) { exfat_fs_error(sb,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 231/423 exfat: fix missing shutdown check
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuezhang Mo <[email protected]>
[ Upstream commit 47e35366bc6fa3cf189a8305bce63992495f3efa ]
xfstests generic/730 test failed because after deleting the device that still had dirty data, the file could still be read without returning an error. The reason is the missing shutdown check in ->read_iter.
I also noticed that shutdown checks were missing from ->write_iter, ->splice_read, and ->mmap. This commit adds shutdown checks to all of them.
--- fs/exfat/file.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
fs/exfat/file.c +27 -2
@@ -582,6 +582,9 @@ static ssize_t exfat_file_write_iter(struct kiocb *iocb, struct iov_iter *iter)loff_t pos = iocb->ki_pos;loff_t valid_size; +if (unlikely (exfat_forced_shutdown (inode->i_sb))) +return -EIO ; +inode_lock (inode); valid_size = ei->valid_size;
@@ -635,6 +638,16 @@ static ssize_t exfat_file_write_iter(struct kiocb *iocb, struct iov_iter *iter)return ret; } +static ssize_t exfat_file_read_iter (struct kiocb *iocb,struct iov_iter *iter) +{ +struct inode *inode =file_inode (iocb->ki_filp); + +if (unlikely (exfat_forced_shutdown (inode->i_sb))) +return -EIO ; + +return generic_file_read_iter (iocb, iter); +} +static vm_fault_t exfat_page_mkwrite (struct vm_fault *vmf) {int err;
@@ -672,14 +685,26 @@ static const struct vm_operations_struct exfat_file_vm_ops = {static int exfat_file_mmap (struct file *file,struct vm_area_struct *vma) { +if (unlikely (exfat_forced_shutdown (file_inode (file)->i_sb))) +return -EIO ; +file_accessed (file); vma->vm_ops = &exfat_file_vm_ops;return 0 ; } +static ssize_t exfat_splice_read (struct file *in,loff_t *ppos, +struct pipe_inode_info *pipe,size_t len,unsigned int flags) +{ +if (unlikely (exfat_forced_shutdown (file_inode (in)->i_sb))) +return -EIO ; + +return filemap_splice_read (in, ppos, pipe, len, flags); +} +const struct file_operations exfat_file_operations = { .llseek = generic_file_llseek, - .read_iter = generic_file_read_iter, + .read_iter = exfat_file_read_iter, .write_iter = exfat_file_write_iter, .unlocked_ioctl = exfat_ioctl, #ifdef CONFIG_COMPAT
@@ -687,7 +712,7 @@ const struct file_operations exfat_file_operations = {#endif .mmap = exfat_file_mmap, .fsync = exfat_file_fsync, - .splice_read = filemap_splice_read, + .splice_read = exfat_splice_read, .splice_write = iter_file_splice_write, };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 232/423 rtnetlink: Allocate vfinfo size for VF GUIDs when supported
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Zhang <[email protected]>
[ Upstream commit 23f00807619d15063d676218f36c5dfeda1eb420 ]
Commit 30aad41721e0 ("net/core: Add support for getting VF GUIDs") added support for getting VF port and node GUIDs in netlink ifinfo messages, but their size was not taken into consideration in the function that allocates the netlink message, causing the following warning when a netlink message is filled with many VF port and node GUIDs:
# echo 64 > /sys/bus/pci/devices/0000\:08\:00.0/sriov_numvfs # ip link show dev ib0 RTNETLINK answers: Message too long Cannot send link get request: Message too long
Kernel warning:
------------[ cut here ]------------ WARNING: CPU: 2 PID: 1930 at net/core/rtnetlink.c:4151 rtnl_getlink+0x586/0x5a0 Modules linked in: xt_conntrack xt_MASQUERADE nfnetlink xt_addrtype iptable_nat nf_nat br_netfilter overlay mlx5_ib macsec mlx5_core tls rpcrdma rdma_ucm ib_uverbs ib_iser libiscsi scsi_transport_iscsi ib_umad rdma_cm iw_cm ib_ipoib fuse ib_cm ib_core CPU: 2 UID: 0 PID: 1930 Comm: ip Not tainted 6.14.0-rc2+ #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 RIP: 0010:rtnl_getlink+0x586/0x5a0 Code: cb 82 e8 3d af 0a 00 4d 85 ff 0f 84 08 ff ff ff 4c 89 ff 41 be ea ff ff ff e8 66 63 5b ff 49 c7 07 80 4f cb 82 e9 36 fc ff ff <0f> 0b e9 16 fe ff ff e8 de a0 56 00 66 66 2e 0f 1f 84 00 00 00 00 RSP: 0018:ffff888113557348 EFLAGS: 00010246 RAX: 00000000ffffffa6 RBX: ffff88817e87aa34 RCX: dffffc0000000000 RDX: 0000000000000003 RSI: 0000000000000000 RDI: ffff88817e87afb8 RBP: 0000000000000009 R08: ffffffff821f44aa R09: 0000000000000000 R10: ffff8881260f79a8 R11: ffff88817e87af00 R12: ffff88817e87aa00 R13: ffffffff8563d300 R14: 00000000ffffffa6 R15: 00000000ffffffff FS: 00007f63a5dbf280(0000) GS:ffff88881ee00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f63a5ba4493 CR3: 00000001700fe002 CR4: 0000000000772eb0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <TASK> ? __warn+0xa5/0x230 ? rtnl_getlink+0x586/0x5a0 ? report_bug+0x22d/0x240 ? handle_bug+0x53/0xa0 ? exc_invalid_op+0x14/0x50 ? asm_exc_invalid_op+0x16/0x20 ? skb_trim+0x6a/0x80 ? rtnl_getlink+0x586/0x5a0 ? __pfx_rtnl_getlink+0x10/0x10 ? rtnetlink_rcv_msg+0x1e5/0x860 ? __pfx___mutex_lock+0x10/0x10 ? rcu_is_watching+0x34/0x60 ? __pfx_lock_acquire+0x10/0x10 ? stack_trace_save+0x90/0xd0 ? filter_irq_stacks+0x1d/0x70 ? kasan_save_stack+0x30/0x40 ? kasan_save_stack+0x20/0x40 ? kasan_save_track+0x10/0x30 rtnetlink_rcv_msg+0x21c/0x860 ? entry_SYSCALL_64_after_hwframe+0x76/0x7e ? __pfx_rtnetlink_rcv_msg+0x10/0x10 ? arch_stack_walk+0x9e/0xf0 ? rcu_is_watching+0x34/0x60 ? lock_acquire+0xd5/0x410 ? rcu_is_watching+0x34/0x60 netlink_rcv_skb+0xe0/0x210 ? __pfx_rtnetlink_rcv_msg+0x10/0x10 ? __pfx_netlink_rcv_skb+0x10/0x10 ? rcu_is_watching+0x34/0x60 ? __pfx___netlink_lookup+0x10/0x10 ? lock_release+0x62/0x200 ? netlink_deliver_tap+0xfd/0x290 ? rcu_is_watching+0x34/0x60 ? lock_release+0x62/0x200 ? netlink_deliver_tap+0x95/0x290 netlink_unicast+0x31f/0x480 ? __pfx_netlink_unicast+0x10/0x10 ? rcu_is_watching+0x34/0x60 ? lock_acquire+0xd5/0x410 netlink_sendmsg+0x369/0x660 ? lock_release+0x62/0x200 ? __pfx_netlink_sendmsg+0x10/0x10 ? import_ubuf+0xb9/0xf0 ? __import_iovec+0x254/0x2b0 ? lock_release+0x62/0x200 ? __pfx_netlink_sendmsg+0x10/0x10 ____sys_sendmsg+0x559/0x5a0 ? __pfx_____sys_sendmsg+0x10/0x10 ? __pfx_copy_msghdr_from_user+0x10/0x10 ? rcu_is_watching+0x34/0x60 ? do_read_fault+0x213/0x4a0 ? rcu_is_watching+0x34/0x60 ___sys_sendmsg+0xe4/0x150 ? __pfx____sys_sendmsg+0x10/0x10 ? do_fault+0x2cc/0x6f0 ? handle_pte_fault+0x2e3/0x3d0 ? __pfx_handle_pte_fault+0x10/0x10 ? preempt_count_sub+0x14/0xc0 ? __down_read_trylock+0x150/0x270 ? __handle_mm_fault+0x404/0x8e0 ? __pfx___handle_mm_fault+0x10/0x10 ? lock_release+0x62/0x200 ? __rcu_read_unlock+0x65/0x90 ? rcu_is_watching+0x34/0x60 __sys_sendmsg+0xd5/0x150 ? __pfx___sys_sendmsg+0x10/0x10 ? __up_read+0x192/0x480 ? lock_release+0x62/0x200 ? __rcu_read_unlock+0x65/0x90 ? rcu_is_watching+0x34/0x60 do_syscall_64+0x6d/0x140 entry_SYSCALL_64_after_hwframe+0x76/0x7e RIP: 0033:0x7f63a5b13367 Code: 0e 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b9 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 89 54 24 1c 48 89 74 24 10 RSP: 002b:00007fff8c726bc8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 0000000067b687c2 RCX: 00007f63a5b13367 RDX: 0000000000000000 RSI: 00007fff8c726c30 RDI: 0000000000000004 RBP: 00007fff8c726cb8 R08: 0000000000000000 R09: 0000000000000034 R10: 00007fff8c726c7c R11: 0000000000000246 R12: 0000000000000001 R13: 0000000000000000 R14: 00007fff8c726cd0 R15: 00007fff8c726cd0 </TASK> irq event stamp: 0 hardirqs last enabled at (0): [<0000000000000000>] 0x0 hardirqs last disabled at (0): [<ffffffff813f9e58>] copy_process+0xd08/0x2830 softirqs last enabled at (0): [<ffffffff813f9e58>] copy_process+0xd08/0x2830 softirqs last disabled at (0): [<0000000000000000>] 0x0 ---[ end trace 0000000000000000 ]---
Thus, when calculating ifinfo message size, take VF GUIDs sizes into account when supported.
--- net/core/rtnetlink.c | 3 +++ 1 file changed, 3 insertions(+)
net/core/rtnetlink.c +3 -0
@@ -1005,6 +1005,9 @@ static inline int rtnl_vfinfo_size(const struct net_device *dev,/* IFLA_VF_STATS_TX_DROPPED */ nla_total_size_64bit(sizeof(__u64))); } +if (dev->netdev_ops->ndo_get_vf_guid) + size += num_vfs *2 * +nla_total_size (sizeof (struct ifla_vf_guid ));return size; }else return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 233/423 rndis_host: Flag RNDIS modems as WWAN devices
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lubomir Rintel <[email protected]>
[ Upstream commit 67d1a8956d2d62fe6b4c13ebabb57806098511d8 ]
Set FLAG_WWAN instead of FLAG_ETHERNET for RNDIS interfaces on Mobile Broadband Modems, as opposed to regular Ethernet adapters.
Otherwise NetworkManager gets confused, misjudges the device type, and wouldn't know it should connect a modem to get the device to work. What would be the result depends on ModemManager version -- older ModemManager would end up disconnecting a device after an unsuccessful probe attempt (if it connected without needing to unlock a SIM), while a newer one might spawn a separate PPP connection over a tty interface instead, resulting in a general confusion and no end of chaos.
The only way to get this work reliably is to fix the device type and have good enough version ModemManager (or equivalent).
--- drivers/net/usb/rndis_host.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/net/usb/rndis_host.c +14 -2
@@ -630,6 +630,16 @@ static const struct driver_info zte_rndis_info = { .tx_fixup = rndis_tx_fixup, }; +static const struct driver_info wwan_rndis_info = { + .description ="Mobile Broadband RNDIS device" , + .flags =FLAG_WWAN |FLAG_POINTTOPOINT |FLAG_FRAMING_RN |FLAG_NO_SETINT , + .bind = rndis_bind, + .unbind = rndis_unbind, + .status = rndis_status, + .rx_fixup = rndis_rx_fixup, + .tx_fixup = rndis_tx_fixup, +}; +/*-------------------------------------------------------------------------*/ static const struct usb_device_id products [] = {
@@ -666,9 +676,11 @@ static const struct usb_device_id products [] = { USB_INTERFACE_INFO(USB_CLASS_WIRELESS_CONTROLLER, 1, 3), .driver_info = (unsigned long) &rndis_info, }, { -/* Novatel Verizon USB730L */ +/* Mobile Broadband Modem, seen in Novatel Verizon USB730L and +* Telit FN990A (RNDIS) +*/ USB_INTERFACE_INFO(USB_CLASS_MISC, 4, 1), - .driver_info = (unsigned long) &rndis_info, + .driver_info = (unsigned long)&wwan_rndis_info, }, { }, // END };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 234/423 ksmbd: use aead_request_free to match aead_request_alloc
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miaoqian Lin <[email protected]>
[ Upstream commit 6171063e9d046ffa46f51579b2ca4a43caef581a ]
Use aead_request_free() instead of kfree() to properly free memory allocated by aead_request_alloc(). This ensures sensitive crypto data is zeroed before being freed.
--- fs/smb/server/auth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/server/auth.c +1 -1
@@ -1217,7 +1217,7 @@ int ksmbd_crypt_message(struct ksmbd_work *work, struct kvec *iov, free_sg:kfree (sg); free_req: -kfree (req); +aead_request_free (req); free_ctx:ksmbd_release_crypto_ctx (ctx);return rc;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 235/423 ksmbd: fix multichannel connection failure
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit c1883049aa9b2b7dffd3a68c5fc67fa92c174bd9 ]
ksmbd check that the session of second channel is in the session list of first connection. If it is in session list, multichannel connection should not be allowed.
--- fs/smb/server/mgmt/user_session.c | 16 ++++++++++++++++ fs/smb/server/mgmt/user_session.h | 2 ++ fs/smb/server/smb2pdu.c | 12 ++++-------- 3 files changed, 22 insertions(+), 8 deletions(-)
fs/smb/server/mgmt/user_session.c +16 -0
@@ -256,6 +256,22 @@ void ksmbd_sessions_deregister(struct ksmbd_conn *conn)up_write (&sessions_table_lock); } +bool is_ksmbd_session_in_connection (struct ksmbd_conn *conn, +unsigned long long id) +{ +struct ksmbd_session *sess; + +down_read (&conn->session_lock); + sess =xa_load (&conn->sessions, id); +if (sess) { +up_read (&conn->session_lock); +return true; + } +up_read (&conn->session_lock); + +return false; +} +struct ksmbd_session *ksmbd_session_lookup (struct ksmbd_conn *conn,unsigned long long id) {
fs/smb/server/mgmt/user_session.h +2 -0
@@ -87,6 +87,8 @@ void ksmbd_session_destroy(struct ksmbd_session *sess);struct ksmbd_session *ksmbd_session_lookup_slowpath (unsigned long long id);struct ksmbd_session *ksmbd_session_lookup (struct ksmbd_conn *conn,unsigned long long id); +bool is_ksmbd_session_in_connection (struct ksmbd_conn *conn, +unsigned long long id);int ksmbd_session_register (struct ksmbd_conn *conn,struct ksmbd_session *sess);void ksmbd_sessions_deregister (struct ksmbd_conn *conn);
fs/smb/server/smb2pdu.c +4 -8
@@ -1704,44 +1704,38 @@ int smb2_sess_setup(struct ksmbd_work *work)if (conn->dialect != sess->dialect) { rc = -EINVAL ; -ksmbd_user_session_put (sess); goto out_err; }if (!(req->hdr.Flags &SMB2_FLAGS_SIGNED )) { rc = -EINVAL ; -ksmbd_user_session_put (sess); goto out_err; }if (strncmp (conn->ClientGUID, sess->ClientGUID,SMB2_CLIENT_GUID_SIZE )) { rc = -ENOENT ; -ksmbd_user_session_put (sess); goto out_err; }if (sess->state ==SMB2_SESSION_IN_PROGRESS ) { rc = -EACCES ; -ksmbd_user_session_put (sess); goto out_err; }if (sess->state ==SMB2_SESSION_EXPIRED ) { rc = -EFAULT ; -ksmbd_user_session_put (sess); goto out_err; } -ksmbd_user_session_put (sess);if (ksmbd_conn_need_reconnect (conn)) { rc = -EFAULT ; +ksmbd_user_session_put (sess); sess =NULL ; goto out_err; } - sess =ksmbd_session_lookup (conn, sess_id); -if (!sess) { +if (is_ksmbd_session_in_connection (conn, sess_id)) { rc = -EACCES ; goto out_err; }
@@ -1907,6 +1901,8 @@ int smb2_sess_setup(struct ksmbd_work *work) sess->last_active = jiffies; sess->state =SMB2_SESSION_EXPIRED ; +ksmbd_user_session_put (sess); + work->sess =NULL ;if (try_delay) {ksmbd_conn_set_need_reconnect (conn);ssleep (5 );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 236/423 ksmbd: fix r_count dec/increment mismatch
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit ddb7ea36ba7129c2ed107e2186591128618864e1 ]
r_count is only increased when there is an oplock break wait, so r_count inc/decrement are not paired. This can cause r_count to become negative, which can lead to a problem where the ksmbd thread does not terminate.
--- fs/smb/server/oplock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/smb/server/oplock.c +2 -2
@@ -724,8 +724,8 @@ static int smb2_oplock_break_noti(struct oplock_info *opinfo) work->conn = conn; work->sess = opinfo->sess; +ksmbd_conn_r_count_inc (conn);if (opinfo->op_state ==OPLOCK_ACK_WAIT ) { -ksmbd_conn_r_count_inc (conn);INIT_WORK (&work->work, __smb2_oplock_break_noti);ksmbd_queue_work (work);
@@ -833,8 +833,8 @@ static int smb2_lease_break_noti(struct oplock_info *opinfo) work->conn = conn; work->sess = opinfo->sess; +ksmbd_conn_r_count_inc (conn);if (opinfo->op_state ==OPLOCK_ACK_WAIT ) { -ksmbd_conn_r_count_inc (conn);INIT_WORK (&work->work, __smb2_lease_break_noti);ksmbd_queue_work (work);wait_for_break_ack (opinfo);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 237/423 net/mlx5e: SHAMPO, Make reserved size independent of page size
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lama Kayal <[email protected]>
[ Upstream commit fab05835688526f9de123d1e98e4d1f838da4e22 ]
When hw-gro is enabled, the maximum number of header entries that are needed per wqe (hd_per_wqe) is calculated based on the size of the reservations among other parameters.
Miscalculation of the size of reservations leads to incorrect calculation of hd_per_wqe as 0, particularly in the case of large page size like in aarch64, this prevents the SHAMPO header from being correctly initialized in the device, ultimately causing the following cqe err that indicates a violation of PD.
mlx5_core 0000:00:08.0 eth2: ERR CQE on RQ: 0x1180
mlx5_core 0000:00:08.0 eth2: Error cqe on cqn 0x510, ci 0x0, qn 0x1180, opcode 0xe, syndrome 0x4, vendor syndrome 0x32 00000000: 00 00 00 00 04 4a 00 00 00 00 00 00 20 00 93 32
00000010: 55 00 00 00 fb cc 00 00 00 00 00 00 07 18 00 00
00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4a
00000030: 00 00 00 9a 93 00 32 04 00 00 00 00 00 00 da e1
Use the correct formula for calculating the size of reservations, precisely it shouldn't be dependent on page size, instead use the correct multiply of MLX5E_SHAMPO_WQ_BASE_RESRV_SIZE.
--- drivers/net/ethernet/mellanox/mlx5/core/en/params.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/params.c +5 -3
@@ -423,7 +423,7 @@ u8 mlx5e_shampo_get_log_pkt_per_rsrv(struct mlx5_core_dev *mdev, struct mlx5e_params *params) {u32 resrv_size =BIT (mlx5e_shampo_get_log_rsrv_size (mdev, params)) * -PAGE_SIZE ; +MLX5E_SHAMPO_WQ_BASE_RESRV_SIZE ;return order_base_2 (DIV_ROUND_UP (resrv_size, params->sw_mtu)); }
@@ -827,7 +827,8 @@ static u32 mlx5e_shampo_get_log_cq_size(struct mlx5_core_dev *mdev,struct mlx5e_params *params, struct mlx5e_xsk_param *xsk) { - int rsrv_size = BIT(mlx5e_shampo_get_log_rsrv_size(mdev, params)) * PAGE_SIZE; + int rsrv_size = BIT(mlx5e_shampo_get_log_rsrv_size(mdev, params)) * +MLX5E_SHAMPO_WQ_BASE_RESRV_SIZE ;u16 num_strides =BIT (mlx5e_mpwqe_get_log_num_strides (mdev, params, xsk));int pkt_per_rsrv =BIT (mlx5e_shampo_get_log_pkt_per_rsrv (mdev, params));u8 log_stride_sz =mlx5e_mpwqe_get_log_stride_size (mdev, params, xsk);
@@ -1036,7 +1037,8 @@ u32 mlx5e_shampo_hd_per_wqe(struct mlx5_core_dev *mdev,struct mlx5e_params *params, struct mlx5e_rq_param *rq_param) { - int resv_size = BIT(mlx5e_shampo_get_log_rsrv_size(mdev, params)) * PAGE_SIZE; + int resv_size = BIT(mlx5e_shampo_get_log_rsrv_size(mdev, params)) * +MLX5E_SHAMPO_WQ_BASE_RESRV_SIZE ;u16 num_strides =BIT (mlx5e_mpwqe_get_log_num_strides (mdev, params,NULL ));int pkt_per_resv =BIT (mlx5e_shampo_get_log_pkt_per_rsrv (mdev, params));u8 log_stride_sz =mlx5e_mpwqe_get_log_stride_size (mdev, params,NULL );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 238/423 ring-buffer: Fix bytes_dropped calculation issue
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Feng Yang <[email protected]>
[ Upstream commit c73f0b69648501978e8b3e8fa7eef7f4197d0481 ]
The calculation of bytes-dropped and bytes_dropped_nested is reversed. Although it does not affect the final calculation of total_dropped, it should still be modified.
--- kernel/trace/ring_buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/ring_buffer.c +2 -2
@@ -7442,9 +7442,9 @@ static __init int rb_write_something(struct rb_test_data *data, bool nested)/* Ignore dropped events before test starts. */ if (started) {if (nested) - data->bytes_dropped += len; -else data->bytes_dropped_nested += len; +else + data->bytes_dropped += len; }return len; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 239/423 objtool: Fix segfault in ignore_unreachable_insn()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
[ Upstream commit 69d41d6dafff0967565b971d950bd10443e4076c ]
Check 'prev_insn' before dereferencing it.
--- tools/objtool/check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/objtool/check.c +1 -1
@@ -4153,7 +4153,7 @@ static bool ignore_unreachable_insn(struct objtool_file *file, struct instructio* It may also insert a UD2 after calling a __noreturn function. */ prev_insn =prev_insn_same_sec (file, insn); -if (prev_insn->dead_end && +if (prev_insn && prev_insn->dead_end && (insn->type ==INSN_BUG || (insn->type ==INSN_JUMP_UNCONDITIONAL && insn->jump_dest && insn->jump_dest->type ==INSN_BUG )))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 240/423 LoongArch: Fix help text of CMDLINE_EXTEND in Kconfig
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: 谢致邦 (XIE Zhibang) <[email protected]>
[ Upstream commit be216cbc1ddf99a51915414ce147311c0dfd50a2 ]
It is the built-in command line appended to the bootloader command line, not the bootloader command line appended to the built-in command line.
--- arch/loongarch/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/loongarch/Kconfig +2 -2
@@ -375,8 +375,8 @@ config CMDLINE_BOOTLOADER config CMDLINE_EXTEND bool "Use built-in to extend bootloader kernel arguments" help - The command-line arguments provided during boot will be - appended to the built-in command line. This is useful in + The built-in command line will be appended to the command- + line arguments provided during boot. This is useful in cases where the provided arguments are insufficient and you don't want to or cannot modify them.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 241/423 LoongArch: Fix device node refcount leak in fdt_cpu_clk_init()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miaoqian Lin <[email protected]>
[ Upstream commit 2e3bc71e4f394ecf8f499d21923cf556b4bfa1e7 ]
Add missing of_node_put() to properly handle the reference count of the device node obtained from of_get_cpu_node().
--- arch/loongarch/kernel/env.c | 2 ++ 1 file changed, 2 insertions(+)
arch/loongarch/kernel/env.c +2 -0
@@ -68,6 +68,8 @@ static int __init fdt_cpu_clk_init(void)return -ENODEV ; clk =of_clk_get (np,0 ); +of_node_put (np); +if (IS_ERR (clk))return -ENODEV ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 242/423 LoongArch: Rework the arch_kgdb_breakpoint() implementation
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuli Wang <[email protected]>
[ Upstream commit 29c92a41c6d2879c1f62220fe4758dce191bb38f ]
The arch_kgdb_breakpoint() function defines the kgdb_breakinst symbol using inline assembly.
1. There's a potential issue where the compiler might inline arch_kgdb_breakpoint(), which would then define the kgdb_breakinst symbol multiple times, leading to a linker error.
To prevent this, declare arch_kgdb_breakpoint() as noinline.
Fix follow error with LLVM-19 *only* when LTO_CLANG_FULL:
LD vmlinux.o
ld.lld-19: error: ld-temp.o <inline asm>:3:1: symbol 'kgdb_breakinst' is already defined
kgdb_breakinst: break 2
^
2. Remove "nop" in the inline assembly because it's meaningless for LoongArch here.
3. Add "STACK_FRAME_NON_STANDARD" for arch_kgdb_breakpoint() to avoid the objtool warning.
--- arch/loongarch/kernel/kgdb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/loongarch/kernel/kgdb.c +3 -2
@@ -8,6 +8,7 @@#include <linux/hw_breakpoint.h> #include <linux/kdebug.h> #include <linux/kgdb.h> +#include <linux/objtool.h> #include <linux/processor.h> #include <linux/ptrace.h> #include <linux/sched.h>
@@ -224,13 +225,13 @@ void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc) regs->csr_era = pc; } -void arch_kgdb_breakpoint (void ) +noinline void arch_kgdb_breakpoint(void) { __asm__ __volatile__ ( \".globl kgdb_breakinst\n\t" \ -"nop\n" \"kgdb_breakinst:\tbreak 2\n\t" );/* BRK_KDB = 2 */ } +STACK_FRAME_NON_STANDARD (arch_kgdb_breakpoint);/* * Calls linux_debug_hook before the kernel dies. If KGDB is enabled,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 243/423 ACPI: processor: idle: Return an error if both P_LVL{2,3} idle states are invalid
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giovanni Gherdovich <[email protected]>
[ Upstream commit 9e9b893404d43894d69a18dd2fc8fcf1c36abb7e ]
Prior to commit 496121c02127 ("ACPI: processor: idle: Allow probing on platforms with one ACPI C-state"), the acpi_idle driver wouldn't load on systems without a valid C-State at least as deep as C2.
The behavior was desirable for guests on hypervisors such as VMWare ESXi, which by default don't have the _CST ACPI method, and set the C2 and C3 latencies to 101 and 1001 microseconds respectively via the FADT, to signify they're unsupported.
Since the above change though, these virtualized deployments end up loading acpi_idle, and thus entering the default C1 C-State set by acpi_processor_get_power_info_default(); this is undesirable for a system that's communicating to the OS it doesn't want C-States (missing _CST, and invalid C2/C3 in FADT).
Make acpi_processor_get_power_info_fadt() return -ENODEV in that case, so that acpi_processor_get_cstate_info() exits early and doesn't set pr->flags.power = 1.
--- drivers/acpi/processor_idle.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/acpi/processor_idle.c +4 -0
@@ -268,6 +268,10 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)ACPI_CX_DESC_LEN ,"ACPI P_LVL3 IOPORT 0x%x" , pr->power.states[ACPI_STATE_C3].address); +if (!pr->power.states[ACPI_STATE_C2 ].address && + !pr->power.states[ACPI_STATE_C3 ].address) +return -ENODEV ; +return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 244/423 net: phy: broadcom: Correct BCM5221 PHY model detection
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jim Liu <[email protected]>
[ Upstream commit 4f1eaabb4b66a1f7473f584e14e15b2ac19dfaf3 ]
Correct detect condition is applied to the entire 5221 family of PHYs.
--- drivers/net/phy/broadcom.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/phy/broadcom.c +3 -3
@@ -859,7 +859,7 @@ static int brcm_fet_config_init(struct phy_device *phydev)return reg;/* Unmask events we are interested in and mask interrupts globally. */ -if (phydev->phy_id ==PHY_ID_BCM5221 ) +if (phydev->drv->phy_id ==PHY_ID_BCM5221 ) reg =MII_BRCM_FET_IR_ENABLE |MII_BRCM_FET_IR_MASK ;else
@@ -888,7 +888,7 @@ static int brcm_fet_config_init(struct phy_device *phydev)return err; } -if (phydev->phy_id !=PHY_ID_BCM5221 ) { +if (phydev->drv->phy_id !=PHY_ID_BCM5221 ) {/* Set the LED mode */ reg =__phy_read (phydev,MII_BRCM_FET_SHDW_AUXMODE4 );if (reg <0 ) {
@@ -1009,7 +1009,7 @@ static int brcm_fet_suspend(struct phy_device *phydev)return err; } -if (phydev->phy_id ==PHY_ID_BCM5221 ) +if (phydev->drv->phy_id ==PHY_ID_BCM5221 )/* Force Low Power Mode with clock enabled */ reg =BCM5221_SHDW_AM4_EN_CLK_LPM |BCM5221_SHDW_AM4_FORCE_LPM ;else
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 245/423 octeontx2-af: Fix mbox INTR handler when num VFs > 64
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geetha sowjanya <[email protected]>
[ Upstream commit 0fdba88a211508984eb5df62008c29688692b134 ]
When number of RVU VFs > 64, the vfs value passed to "rvu_queue_work" function is incorrect. Due to which mbox workqueue entries for VFs 0 to 63 never gets added to workqueue.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +1 -1
@@ -2634,7 +2634,7 @@ static irqreturn_t rvu_mbox_intr_handler(int irq, void *rvu_irq)rvupf_write64 (rvu,RVU_PF_VFPF_MBOX_INTX (1 ), intr);rvu_queue_work (&rvu->afvf_wq_info,64 , vfs, intr); - vfs -=64 ; + vfs =64 ; } intr =rvupf_read64 (rvu,RVU_PF_VFPF_MBOX_INTX (0 ));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 246/423 octeontx2-af: Free NIX_AF_INT_VEC_GEN irq
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geetha sowjanya <[email protected]>
[ Upstream commit 323d6db6dc7decb06f2545efb9496259ddacd4f4 ]
Due to the incorrect initial vector number in rvu_nix_unregister_interrupts(), NIX_AF_INT_VEC_GEN is not geeting free. Fix the vector number to include NIX_AF_INT_VEC_GEN irq.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c +1 -1
@@ -207,7 +207,7 @@ static void rvu_nix_unregister_interrupts(struct rvu *rvu) rvu->irq_allocated[offs +NIX_AF_INT_VEC_RVU ] = false; } -for (i =NIX_AF_INT_VEC_AF_ERR ; i <NIX_AF_INT_VEC_CNT ; i++) +for (i =NIX_AF_INT_VEC_GEN ; i <NIX_AF_INT_VEC_CNT ; i++)if (rvu->irq_allocated[offs + i]) {free_irq (pci_irq_vector (rvu->pdev, offs + i), rvu_dl); rvu->irq_allocated[offs + i] = false;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 247/423 objtool: Fix verbose disassembly if CROSS_COMPILE isnt set
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Laight <[email protected]>
[ Upstream commit e77956e4e5c11218e60a1fe8cdbccd02476f2e56 ]
In verbose mode, when printing the disassembly of affected functions, if CROSS_COMPILE isn't set, the objdump command string gets prefixed with "(null)".
Somehow this worked before. Maybe some versions of glibc return an empty string instead of NULL. Fix it regardless.
[ jpoimboe: Rewrite commit log. ]
--- tools/objtool/check.c | 2 ++ 1 file changed, 2 insertions(+)
tools/objtool/check.c +2 -0
@@ -4614,6 +4614,8 @@ static int disas_funcs(const char *funcs)char *cmd; cross_compile =getenv ("CROSS_COMPILE" ); +if (!cross_compile) + cross_compile ="" ; objdump_str ="%sobjdump -wdr %s | gawk -M -v _funcs='%s' '" "BEGIN { split(_funcs, funcs); }"
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 248/423 sched/smt: Always inline sched_smt_active()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
[ Upstream commit 09f37f2d7b21ff35b8b533f9ab8cfad2fe8f72f6 ]
sched_smt_active() can be called from noinstr code, so it should always be inlined. The CONFIG_SCHED_SMT version already has __always_inline. Do the same for its !CONFIG_SCHED_SMT counterpart.
Fixes the following warning:
vmlinux.o: error: objtool: intel_idle_ibrs+0x13: call to sched_smt_active() leaves .noinstr.text section
--- include/linux/sched/smt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/sched/smt.h +1 -1
@@ -12,7 +12,7 @@ static __always_inline bool sched_smt_active(void)return static_branch_likely (&sched_smt_present); }#else -static inline bool sched_smt_active (void ) {return false; } +static __always_inline bool sched_smt_active(void) { return false; }#endif void arch_smt_update (void );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 249/423 context_tracking: Always inline ct_{nmi,irq}_{enter,exit}()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
[ Upstream commit 9ac50f7311dc8b39e355582f14c1e82da47a8196 ]
Thanks to CONFIG_DEBUG_SECTION_MISMATCH, empty functions can be generated out of line. These can be called from noinstr code, so make sure they're always inlined.
Fixes the following warnings:
vmlinux.o: warning: objtool: irqentry_nmi_enter+0xa2: call to ct_nmi_enter() leaves .noinstr.text section vmlinux.o: warning: objtool: irqentry_nmi_exit+0x16: call to ct_nmi_exit() leaves .noinstr.text section vmlinux.o: warning: objtool: irqentry_exit+0x78: call to ct_irq_exit() leaves .noinstr.text section
--- include/linux/context_tracking_irq.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
include/linux/context_tracking_irq.h +4 -4
@@ -10,12 +10,12 @@ void ct_irq_exit_irqson(void);void ct_nmi_enter (void );void ct_nmi_exit (void );#else -static inline void ct_irq_enter (void ) { } -static inline void ct_irq_exit (void ) { } +static __always_inline void ct_irq_enter(void) { } +static __always_inline void ct_irq_exit(void) { }static inline void ct_irq_enter_irqson (void ) { }static inline void ct_irq_exit_irqson (void ) { } -static inline void ct_nmi_enter (void ) { } -static inline void ct_nmi_exit (void ) { } +static __always_inline void ct_nmi_enter(void) { } +static __always_inline void ct_nmi_exit(void) { }#endif #endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 250/423 rcu-tasks: Always inline rcu_irq_work_resched()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
[ Upstream commit 6309a5c43b0dc629851f25b2e5ef8beff61d08e5 ]
Thanks to CONFIG_DEBUG_SECTION_MISMATCH, empty functions can be generated out of line. rcu_irq_work_resched() can be called from noinstr code, so make sure it's always inlined.
--- include/linux/rcupdate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/rcupdate.h +1 -1
@@ -138,7 +138,7 @@ static inline void rcu_sysrq_end(void) { }#if defined(CONFIG_NO_HZ_FULL ) && (!defined(CONFIG_GENERIC_ENTRY ) || !defined(CONFIG_KVM_XFER_TO_GUEST_WORK ))void rcu_irq_work_resched (void );#else -static inline void rcu_irq_work_resched (void ) { } +static __always_inline void rcu_irq_work_resched(void) { }#endif #ifdef CONFIG_RCU_NOCB_CPU
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 251/423 objtool/loongarch: Add unwind hints in prepare_frametrace()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
[ Upstream commit 7c977393b8277ed319e92e4b598b26598c9d30c0 ]
If 'regs' points to a local stack variable, prepare_frametrace() stores all registers to the stack. This confuses objtool as it expects them to be restored from the stack later.
The stores don't affect stack tracing, so use unwind hints to hide them from objtool.
Fixes the following warnings:
arch/loongarch/kernel/traps.o: warning: objtool: show_stack+0xe0: stack state mismatch: reg1[22]=-1+0 reg2[22]=-2-160 arch/loongarch/kernel/traps.o: warning: objtool: show_stack+0xe0: stack state mismatch: reg1[23]=-1+0 reg2[23]=-2-152
--- arch/loongarch/include/asm/stacktrace.h | 3 +++ arch/loongarch/include/asm/unwind_hints.h | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-)
arch/loongarch/include/asm/stacktrace.h +3 -0
@@ -8,6 +8,7 @@#include <asm/asm.h> #include <asm/ptrace.h> #include <asm/loongarch.h> +#include <asm/unwind_hints.h> #include <linux/stringify.h> enum stack_type {
@@ -43,6 +44,7 @@ int get_stack_info(unsigned long stack, struct task_struct *task, struct stack_i static __always_inline void prepare_frametrace(struct pt_regs *regs) { __asm__ __volatile__( + UNWIND_HINT_SAVE /* Save $ra */ STORE_ONE_REG(1)/* Use $ra to save PC */
@@ -80,6 +82,7 @@ static __always_inline void prepare_frametrace(struct pt_regs *regs) STORE_ONE_REG(29) STORE_ONE_REG(30) STORE_ONE_REG(31) + UNWIND_HINT_RESTORE : "=m" (regs->csr_era) : "r" (regs->regs) : "memory");
arch/loongarch/include/asm/unwind_hints.h +9 -1
@@ -23,6 +23,14 @@ UNWIND_HINT sp_reg=ORC_REG_SP type=UNWIND_HINT_TYPE_CALL .endm -#endif /* __ASSEMBLY__ */ +#else /* !__ASSEMBLY__ */ + +#define UNWIND_HINT_SAVE \ + UNWIND_HINT(UNWIND_HINT_TYPE_SAVE, 0, 0, 0) + +#define UNWIND_HINT_RESTORE \ + UNWIND_HINT(UNWIND_HINT_TYPE_RESTORE, 0, 0, 0) + +#endif /* !__ASSEMBLY__ */ #endif /* _ASM_LOONGARCH_UNWIND_HINTS_H */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 252/423 nfs: Add missing release on error in nfs_lock_and_join_requests()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 8e5419d6542fdf2dca9a0acdef2b8255f0e4ba69 ]
Call nfs_release_request() on this error path before returning.
--- fs/nfs/write.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfs/write.c +3 -1
@@ -579,8 +579,10 @@ static struct nfs_page *nfs_lock_and_join_requests(struct folio *folio)while (!nfs_lock_request (head)) { ret =nfs_wait_on_request (head); -if (ret <0 ) +if (ret <0 ) { +nfs_release_request (head);return ERR_PTR (ret); + } }/* Ensure that nobody removed the request before we locked it */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 253/423 wifi: mac80211: Cleanup sta TXQs on flush
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Wetzel <[email protected]>
[ Upstream commit 5b999006e35ea9c11116ddff7e375b256421d0af ]
Drop the sta TXQs on flush when the drivers is not supporting flush.
ieee80211_set_disassoc() tries to clean up everything for the sta. But it ignored queued frames in the sta TX queues when the driver isn't supporting the flush driver ops.
--- net/mac80211/util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/mac80211/util.c +3 -2
@@ -685,7 +685,7 @@ void __ieee80211_flush_queues(struct ieee80211_local *local,struct ieee80211_sub_if_data *sdata, unsigned int queues, bool drop) { - if (!local->ops->flush) + if (!local->ops->flush && !drop) return;/*
@@ -712,7 +712,8 @@ void __ieee80211_flush_queues(struct ieee80211_local *local, } } -drv_flush (local, sdata, queues, drop); +if (local->ops->flush) +drv_flush (local, sdata, queues, drop); ieee80211_wake_queues_by_reason(&local->hw, queues, IEEE80211_QUEUE_STOP_REASON_FLUSH,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 254/423 wifi: mac80211: remove debugfs dir for virtual monitor
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Wetzel <[email protected]>
[ Upstream commit 646262c71aca87bb66945933abe4e620796d6c5a ]
Don't call ieee80211_debugfs_recreate_netdev() for virtual monitor interface when deleting it.
The virtual monitor interface shouldn't have debugfs entries and trying to update them will *create* them on deletion.
And when the virtual monitor interface is created/destroyed multiple times we'll get warnings about debugfs name conflicts.
--- net/mac80211/driver-ops.c | 10 ++++++++-- net/mac80211/iface.c | 11 ++++++----- 2 files changed, 14 insertions(+), 7 deletions(-)
net/mac80211/driver-ops.c +8 -2
@@ -115,8 +115,14 @@ void drv_remove_interface(struct ieee80211_local *local, sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER ; -/* Remove driver debugfs entries */ -ieee80211_debugfs_recreate_netdev (sdata, sdata->vif.valid_links); +/* +* Remove driver debugfs entries. +* The virtual monitor interface doesn't get a debugfs +* entry, so it's exempt here. +*/ +if (sdata != local->monitor_sdata) +ieee80211_debugfs_recreate_netdev (sdata, + sdata->vif.valid_links);trace_drv_remove_interface (local, sdata); local->ops->remove_interface (&local->hw, &sdata->vif);
net/mac80211/iface.c +6 -5
@@ -1205,16 +1205,17 @@ void ieee80211_del_virtual_monitor(struct ieee80211_local *local)return ; } -RCU_INIT_POINTER (local->monitor_sdata,NULL ); -mutex_unlock (&local->iflist_mtx); - -synchronize_net (); - +clear_bit (SDATA_STATE_RUNNING , &sdata->state);ieee80211_link_release_channel (&sdata->deflink);if (ieee80211_hw_check (&local->hw,WANT_MONITOR_VIF ))drv_remove_interface (local, sdata); +RCU_INIT_POINTER (local->monitor_sdata,NULL ); +mutex_unlock (&local->iflist_mtx); + +synchronize_net (); +kfree (sdata); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 255/423 wifi: iwlwifi: fw: allocate chained SG tables for dump
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit 7774e3920029398ad49dc848b23840593f14d515 ]
The firmware dumps can be pretty big, and since we use single pages for each SG table entry, even the table itself may end up being an order-5 allocation. Build chained tables so that we need not allocate a higher-order table here.
This could be improved and cleaned up, e.g. by using the SG pool code or simply kvmalloc(), but all of that would require also updating the devcoredump first since that frees it all, so we need to be more careful. SG pool might also run against the CONFIG_ARCH_NO_SG_CHAIN limitation, which is irrelevant here.
Also use _devcd_free_sgtable() for the error paths now, much simpler especially since it's in two places now.
--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 86 ++++++++++++++------- 1 file changed, 58 insertions(+), 28 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +58 -28
@@ -558,41 +558,71 @@ static void iwl_dump_prph(struct iwl_fw_runtime *fwrt, }/* -* alloc_sgtable - allocates scallerlist table in the given size, -* fills it with pages and returns it +* alloc_sgtable - allocates (chained) scatterlist in the given size, +* fills it with pages and returns it * @size: the size (in bytes) of the table -*/ -static struct scatterlist *alloc_sgtable (int size) +*/ +static struct scatterlist *alloc_sgtable (ssize_t size) { -int alloc_size, nents, i; -struct page *new_page; -struct scatterlist *iter; -struct scatterlist *table; +struct scatterlist *result =NULL , *prev; +int nents, i, n_prev; nents =DIV_ROUND_UP (size,PAGE_SIZE ); - table =kcalloc (nents,sizeof (*table),GFP_KERNEL ); -if (!table) -return NULL ; -sg_init_table (table, nents); - iter = table; -for_each_sg (table, iter,sg_nents (table), i) { - new_page =alloc_page (GFP_KERNEL ); -if (!new_page) { -/* release all previous allocated pages in the table */ - iter = table; -for_each_sg (table, iter,sg_nents (table), i) { - new_page =sg_page (iter); -if (new_page) -__free_page (new_page); - } -kfree (table); + +#define N_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof(*result)) +/* +* We need an additional entry for table chaining, +* this ensures the loop can finish i.e. we can +* fit at least two entries per page (obviously, +* many more really fit.) +*/ +BUILD_BUG_ON (N_ENTRIES_PER_PAGE <2 ); + +while (nents >0 ) { +struct scatterlist *new, *iter; +int n_fill, n_alloc; + +if (nents <=N_ENTRIES_PER_PAGE ) { +/* last needed table */ + n_fill = nents; + n_alloc = nents; + nents =0 ; + }else { +/* fill a page with entries */ + n_alloc =N_ENTRIES_PER_PAGE ; +/* reserve one for chaining */ + n_fill = n_alloc -1 ; + nents -= n_fill; + } + + new =kcalloc (n_alloc,sizeof (*new),GFP_KERNEL ); +if (!new) { +if (result) +_devcd_free_sgtable (result);return NULL ; } - alloc_size =min_t (int, size,PAGE_SIZE ); - size -=PAGE_SIZE ; -sg_set_page (iter, new_page, alloc_size,0 ); +sg_init_table (new, n_alloc); + +if (!result) + result = new; +else +sg_chain (prev, n_prev, new); + prev = new; + n_prev = n_alloc; + +for_each_sg (new, iter, n_fill, i) { +struct page *new_page =alloc_page (GFP_KERNEL ); + +if (!new_page) { +_devcd_free_sgtable (result); +return NULL ; + } + +sg_set_page (iter, new_page,PAGE_SIZE ,0 ); + } } -return table; + +return result; } static void iwl_fw_get_prph_len(struct iwl_fw_runtime *fwrt,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 256/423 wifi: iwlwifi: mvm: use the right version of the rate API
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit a03e2082e678ea10d0d8bdf3ed933eb05a8ddbb0 ]
The firmware uses the newer version of the API in recent devices. For older devices, we translate the rate to the new format. Don't parse the rate with old parsing macros.
--- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +4 -4
@@ -995,7 +995,7 @@ iwl_mvm_decode_he_phy_ru_alloc(struct iwl_mvm_rx_phy_data *phy_data,*/ u8 ru =le32_get_bits (phy_data->d1,IWL_RX_PHY_DATA1_HE_RU_ALLOC_MASK );u32 rate_n_flags = phy_data->rate_n_flags; -u32 he_type = rate_n_flags &RATE_MCS_HE_TYPE_MSK_V1 ; +u32 he_type = rate_n_flags &RATE_MCS_HE_TYPE_MSK ;u8 offs =0 ; rx_status->bw =RATE_INFO_BW_HE_RU ;
@@ -1050,13 +1050,13 @@ iwl_mvm_decode_he_phy_ru_alloc(struct iwl_mvm_rx_phy_data *phy_data,if (he_mu) he_mu->flags2 |= -le16_encode_bits (FIELD_GET (RATE_MCS_CHAN_WIDTH_MSK_V1 , +le16_encode_bits (FIELD_GET (RATE_MCS_CHAN_WIDTH_MSK , rate_n_flags),IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW ); -else if (he_type ==RATE_MCS_HE_TYPE_TRIG_V1 ) +else if (he_type ==RATE_MCS_HE_TYPE_TRIG ) he->data6 |=cpu_to_le16 (IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_KNOWN ) | -le16_encode_bits (FIELD_GET (RATE_MCS_CHAN_WIDTH_MSK_V1 , +le16_encode_bits (FIELD_GET (RATE_MCS_CHAN_WIDTH_MSK , rate_n_flags),IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW ); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 257/423 ntsync: Set the permissions to be 0666
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Lothian <[email protected]>
[ Upstream commit fa2e55811ae25020a5e9b23a8932e67e6d6261a4 ]
This allows ntsync to be usuable by non-root processes out of the box
--- drivers/misc/ntsync.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/ntsync.c +1 -0
@@ -238,6 +238,7 @@ static struct miscdevice ntsync_misc = { .minor = MISC_DYNAMIC_MINOR, .name = NTSYNC_NAME, .fops = &ntsync_fops, + .mode = 0666, };module_misc_device (ntsync_misc);
Signature · 1 line
2.39.5
Re: [PATCH 6.12 257/423] ntsync: Set the permissions to be 0666
Quoted 9 lines · On Tuesday, 8 April 2025 05:49:43 CDT Greg Kroah-Hartman wrote:
6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Lothian <[email protected]>
[ Upstream commit
fa2e55811ae25020a5e9b23a8932e67e6d6261a4]This allows ntsync to be usuable by non-root processes out of the box
I would be inclined to drop this from 6.12 and 6.13, since ntsync isn't actually functional in those versions. Leaving the file unaccessible by default means that userspace doesn't have to perform extra checks to make sure that things actually work.
Greg Kroah-Hartman
maintainerRe: [PATCH 6.12 257/423] ntsync: Set the permissions to be 0666
Quoted 5 lines · Elizabeth Figura
Quoted 4 lines · On Tuesday, 8 April 2025 05:49:43 CDT Greg Kroah-Hartman wrote:
6.12-stable review patch. If anyone has any objections, please let me know.
------------------
Quoted 9 lines
Quoted 5 lines
From: Mike Lothian <[email protected]>
[ Upstream commit
fa2e55811ae25020a5e9b23a8932e67e6d6261a4]This allows ntsync to be usuable by non-root processes out of the box
I would be inclined to drop this from 6.12 and 6.13, since ntsync isn't actually functional in those versions. Leaving the file unaccessible by default means that userspace doesn't have to perform extra checks to make sure that things actually work.
Good point, now dropped from both queues, thanks for the review!
greg k-h
Greg Kroah-Hartman
maintainerPATCH 258/423 nvme-tcp: fix possible UAF in nvme_tcp_poll
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
[ Upstream commit 8c1624b63a7d24142a2bbc3a5ee7e95f004ea36e ]
nvme_tcp_poll() may race with the send path error handler because it may complete the request while it is actively being polled for completion, resulting in a UAF panic [1]:
We should make sure to stop polling when we see an error when trying to read from the socket. Hence make sure to propagate the error so that the block layer breaks the polling cycle.
[1]:
--
[35665.692310] nvme nvme2: failed to send request -13 [35665.702265] nvme nvme2: unsupported pdu type (3) [35665.702272] BUG: kernel NULL pointer dereference, address: 0000000000000000 [35665.702542] nvme nvme2: queue 1 receive failed: -22 [35665.703209] #PF: supervisor write access in kernel mode [35665.703213] #PF: error_code(0x0002) - not-present page [35665.703214] PGD 8000003801cce067 P4D 8000003801cce067 PUD 37e6f79067 PMD 0 [35665.703220] Oops: 0002 [#1] SMP PTI [35665.703658] nvme nvme2: starting error recovery [35665.705809] Hardware name: Inspur aaabbb/YZMB-00882-104, BIOS 4.1.26 09/22/2022 [35665.705812] Workqueue: kblockd blk_mq_requeue_work [35665.709172] RIP: 0010:_raw_spin_lock+0xc/0x30 [35665.715788] Call Trace: [35665.716201] <TASK> [35665.716613] ? show_trace_log_lvl+0x1c1/0x2d9 [35665.717049] ? show_trace_log_lvl+0x1c1/0x2d9 [35665.717457] ? blk_mq_request_bypass_insert+0x2c/0xb0 [35665.717950] ? __die_body.cold+0x8/0xd [35665.718361] ? page_fault_oops+0xac/0x140 [35665.718749] ? blk_mq_start_request+0x30/0xf0 [35665.719144] ? nvme_tcp_queue_rq+0xc7/0x170 [nvme_tcp] [35665.719547] ? exc_page_fault+0x62/0x130 [35665.719938] ? asm_exc_page_fault+0x22/0x30 [35665.720333] ? _raw_spin_lock+0xc/0x30 [35665.720723] blk_mq_request_bypass_insert+0x2c/0xb0 [35665.721101] blk_mq_requeue_work+0xa5/0x180 [35665.721451] process_one_work+0x1e8/0x390 [35665.721809] worker_thread+0x53/0x3d0 [35665.722159] ? process_one_work+0x390/0x390 [35665.722501] kthread+0x124/0x150 [35665.722849] ? set_kthread_struct+0x50/0x50 [35665.723182] ret_from_fork+0x1f/0x30
--- drivers/nvme/host/tcp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/nvme/host/tcp.c +3 -2
@@ -2736,6 +2736,7 @@ static int nvme_tcp_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob) {struct nvme_tcp_queue *queue = hctx->driver_data;struct sock *sk = queue->sock->sk; +int ret;if (!test_bit (NVME_TCP_Q_LIVE , &queue->flags))return 0 ;
@@ -2743,9 +2744,9 @@ static int nvme_tcp_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob)set_bit (NVME_TCP_Q_POLLING , &queue->flags);if (sk_can_busy_loop (sk) &&skb_queue_empty_lockless (&sk->sk_receive_queue))sk_busy_loop (sk, true); -nvme_tcp_try_recv (queue); + ret =nvme_tcp_try_recv (queue);clear_bit (NVME_TCP_Q_POLLING , &queue->flags); -return queue->nr_cqe; +return ret <0 ? ret : queue->nr_cqe; }static int nvme_tcp_get_address (struct nvme_ctrl *ctrl,char *buf,int size)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 259/423 nvme-pci: clean up CMBMSC when registering CMB fails
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Icenowy Zheng <[email protected]>
[ Upstream commit 6a3572e10f740acd48e2713ef37e92186a3ce5e8 ]
CMB decoding should get disabled when the CMB block isn't successfully registered to P2P DMA subsystem.
Clean up the CMBMSC register in this error handling codepath to disable CMB decoding (and CMBLOC/CMBSZ registers).
--- drivers/nvme/host/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/host/pci.c +1 -0
@@ -2005,6 +2005,7 @@ static void nvme_map_cmb(struct nvme_dev *dev)if (pci_p2pdma_add_resource (pdev, bar, size, offset)) {dev_warn (dev->ctrl.device,"failed to register the CMB\n" ); +hi_lo_writeq (0 , dev->bar +NVME_REG_CMBMSC );return ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 260/423 nvme-pci: skip CMB blocks incompatible with PCI P2P DMA
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Icenowy Zheng <[email protected]>
[ Upstream commit 56cf7ef0d490b28fad8f8629fc135c5ab7c9f54e ]
The PCI P2PDMA code will register the CMB block to the memory hot-plugging subsystem, which have an alignment requirement. Memory blocks that do not satisfy this alignment requirement (usually 2MB) will lead to a WARNING from memory hotplugging.
Verify the CMB block's address and size against the alignment and only try to send CMB blocks compatible with it to prevent this warning.
Tested on Intel DC D4502 SSD, which has a 512K CMB block that is too small for memory hotplugging (thus PCI P2PDMA).
--- drivers/nvme/host/pci.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/nvme/host/pci.c +12 -8
@@ -1984,6 +1984,18 @@ static void nvme_map_cmb(struct nvme_dev *dev)if (offset > bar_size)return ; +/* +* Controllers may support a CMB size larger than their BAR, for +* example, due to being behind a bridge. Reduce the CMB to the +* reported size of the BAR +*/ + size =min (size, bar_size - offset); + +if (!IS_ALIGNED (size,memremap_compat_align ()) || + !IS_ALIGNED (pci_resource_start (pdev, bar), +memremap_compat_align ())) +return ; +/* * Tell the controller about the host side address mapping the CMB, * and enable CMB decoding for the NVMe 1.4+ scheme:
@@ -1994,14 +2006,6 @@ static void nvme_map_cmb(struct nvme_dev *dev) dev->bar + NVME_REG_CMBMSC); } -/* -* Controllers may support a CMB size larger than their BAR, -* for example, due to being behind a bridge. Reduce the CMB to -* the reported size of the BAR -*/ -if (size > bar_size - offset) - size = bar_size - offset; -if (pci_p2pdma_add_resource (pdev, bar, size, offset)) {dev_warn (dev->ctrl.device,"failed to register the CMB\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 261/423 wifi: brcmfmac: keep power during suspend if board requires it
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthias Proske <[email protected]>
[ Upstream commit 8c3170628a9ce24a59647bd24f897e666af919b8 ]
After commit 92cadedd9d5f ("brcmfmac: Avoid keeping power to SDIO card unless WOWL is used"), the wifi adapter by default is turned off on suspend and then re-probed on resume.
This conflicts with some embedded boards that require to remain powered. They will fail on resume with:
brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout ieee80211 phy1: brcmf_bus_started: failed: -110 ieee80211 phy1: brcmf_attach: dongle is not responding: err=-110
brcmfmac: brcmf_sdio_firmware_callback: brcmf_attach failed
This commit checks for the Device Tree property 'cap-power-off-cards'. If this property is not set, it means that we do not have the capability to power off and should therefore remain powered.
--- .../broadcom/brcm80211/brcmfmac/bcmsdh.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +13 -7
@@ -1167,6 +1167,7 @@ static int brcmf_ops_sdio_suspend(struct device *dev)struct brcmf_bus *bus_if;struct brcmf_sdio_dev *sdiodev;mmc_pm_flag_t sdio_flags; +bool cap_power_off;int ret =0 ; func = container_of(dev, struct sdio_func, dev);
@@ -1174,19 +1175,23 @@ static int brcmf_ops_sdio_suspend(struct device *dev)if (func->num !=1 )return 0 ; + cap_power_off = !!(func->card->host->caps &MMC_CAP_POWER_OFF_CARD ); bus_if =dev_get_drvdata (dev); sdiodev = bus_if->bus_priv.sdio; -if (sdiodev->wowl_enabled) { +if (sdiodev->wowl_enabled || !cap_power_off) {brcmf_sdiod_freezer_on (sdiodev);brcmf_sdio_wd_timer (sdiodev->bus,0 ); sdio_flags =MMC_PM_KEEP_POWER ; -if (sdiodev->settings->bus.sdio.oob_irq_supported) -enable_irq_wake (sdiodev->settings->bus.sdio.oob_irq_nr); -else - sdio_flags |=MMC_PM_WAKE_SDIO_IRQ ; + +if (sdiodev->wowl_enabled) { +if (sdiodev->settings->bus.sdio.oob_irq_supported) +enable_irq_wake (sdiodev->settings->bus.sdio.oob_irq_nr); +else + sdio_flags |=MMC_PM_WAKE_SDIO_IRQ ; + }if (sdio_set_host_pm_flags (sdiodev->func1, sdio_flags))brcmf_err ("Failed to set pm_flags %x\n" , sdio_flags);
@@ -1208,18 +1213,19 @@ static int brcmf_ops_sdio_resume(struct device *dev)struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; struct sdio_func *func = container_of(dev, struct sdio_func, dev);int ret =0 ; +bool cap_power_off = !!(func->card->host->caps &MMC_CAP_POWER_OFF_CARD );brcmf_dbg (SDIO ,"Enter: F%d\n" , func->num);if (func->num !=2 )return 0 ; -if (!sdiodev->wowl_enabled) { +if (!sdiodev->wowl_enabled && cap_power_off) {/* bus was powered off and device removed, probe again */ ret =brcmf_sdiod_probe (sdiodev);if (ret)brcmf_err ("Failed to probe device on resume\n" ); }else { -if (sdiodev->settings->bus.sdio.oob_irq_supported) +if (sdiodev->wowl_enabled && sdiodev->settings->bus.sdio.oob_irq_supported)disable_irq_wake (sdiodev->settings->bus.sdio.oob_irq_nr);brcmf_sdiod_freezer_off (sdiodev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 262/423 affs: generate OFS sequence numbers starting at 1
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Tatham <[email protected]>
[ Upstream commit e4cf8ec4de4e13f156c1d61977d282d90c221085 ]
If I write a file to an OFS floppy image, and try to read it back on an emulated Amiga running Workbench 1.3, the Amiga reports a disk error trying to read the file. (That is, it's unable to read it _at all_, even to copy it to the NIL: device. It isn't a matter of getting the wrong data and being unable to parse the file format.)
This is because the 'sequence number' field in the OFS data block header is supposed to be based at 1, but affs writes it based at 0. All three locations changed by this patch were setting the sequence number to a variable 'bidx' which was previously obtained by dividing a file position by bsize, so bidx will naturally use 0 for the first block. Therefore all three should add 1 to that value before writing it into the sequence number field.
With this change, the Amiga successfully reads the file.
For data block reference: https://wiki.osdev.org/FFS_(Amiga)
--- fs/affs/file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/affs/file.c +3 -3
@@ -596,7 +596,7 @@ affs_extent_file_ofs(struct inode *inode, u32 newsize)BUG_ON (tmp > bsize);AFFS_DATA_HEAD (bh)->ptype =cpu_to_be32 (T_DATA );AFFS_DATA_HEAD (bh)->key =cpu_to_be32 (inode->i_ino); -AFFS_DATA_HEAD (bh)->sequence =cpu_to_be32 (bidx); +AFFS_DATA_HEAD (bh)->sequence =cpu_to_be32 (bidx +1 );AFFS_DATA_HEAD (bh)->size =cpu_to_be32 (tmp);affs_fix_checksum (sb, bh); bh->b_state &= ~(1UL << BH_New);
@@ -746,7 +746,7 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping,if (buffer_new (bh)) {AFFS_DATA_HEAD (bh)->ptype =cpu_to_be32 (T_DATA );AFFS_DATA_HEAD (bh)->key =cpu_to_be32 (inode->i_ino); -AFFS_DATA_HEAD (bh)->sequence =cpu_to_be32 (bidx); +AFFS_DATA_HEAD (bh)->sequence =cpu_to_be32 (bidx +1 );AFFS_DATA_HEAD (bh)->size =cpu_to_be32 (bsize);AFFS_DATA_HEAD (bh)->next =0 ; bh->b_state &= ~(1UL << BH_New);
@@ -780,7 +780,7 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping,if (buffer_new (bh)) {AFFS_DATA_HEAD (bh)->ptype =cpu_to_be32 (T_DATA );AFFS_DATA_HEAD (bh)->key =cpu_to_be32 (inode->i_ino); -AFFS_DATA_HEAD (bh)->sequence =cpu_to_be32 (bidx); +AFFS_DATA_HEAD (bh)->sequence =cpu_to_be32 (bidx +1 );AFFS_DATA_HEAD (bh)->size =cpu_to_be32 (tmp);AFFS_DATA_HEAD (bh)->next =0 ; bh->b_state &= ~(1UL << BH_New);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 263/423 affs: dont write overlarge OFS data block size fields
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Tatham <[email protected]>
[ Upstream commit 011ea742a25a77bac3d995f457886a67d178c6f0 ]
If a data sector on an OFS floppy contains a value > 0x1e8 (the largest amount of data that fits in the sector after its header), then an Amiga reading the file can return corrupt data, by taking the overlarge size at its word and reading past the end of the buffer it read the disk sector into!
The cause: when affs_write_end_ofs() writes data to an OFS filesystem, the new size field for a data block was computed by adding the amount of data currently being written (into the block) to the existing value of the size field. This is correct if you're extending the file at the end, but if you seek backwards in the file and overwrite _existing_ data, it can lead to the size field being larger than the maximum legal value.
This commit changes the calculation so that it sets the size field to the max of its previous size and the position within the block that we just wrote up to.
--- fs/affs/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/affs/file.c +2 -1
@@ -724,7 +724,8 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping, tmp =min (bsize - boff, to - from);BUG_ON (boff + tmp > bsize || tmp > bsize);memcpy (AFFS_DATA (bh) + boff, data + from, tmp); -be32_add_cpu (&AFFS_DATA_HEAD (bh)->size, tmp); +AFFS_DATA_HEAD (bh)->size =cpu_to_be32 ( +max (boff + tmp,be32_to_cpu (AFFS_DATA_HEAD (bh)->size)));affs_fix_checksum (sb, bh);mark_buffer_dirty_inode (bh, inode); written += tmp;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 264/423 ALSA: hda/realtek: Fix Asus Z13 2025 audio
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antheas Kapenekakis <[email protected]>
[ Upstream commit 12784ca33b62fd327631749e6a0cd2a10110a56c ]
Use the basic quirk for this type of amplifier. Sound works in speakers, headphones, and microphone. Whereas none worked before.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10718,6 +10718,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x1f1f ,"ASUS H7604JI/JV/J3D" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x1f62 ,"ASUS UX7602ZM" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x1f92 ,"ASUS ROG Flow X16" ,ALC289_FIXUP_ASUS_GA401 ), +SND_PCI_QUIRK (0x1043 ,0x1fb3 ,"ASUS ROG Flow Z13 GZ302EA" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x1043 ,0x3030 ,"ASUS ZN270IE" ,ALC256_FIXUP_ASUS_AIO_GPIO2 ),SND_PCI_QUIRK (0x1043 ,0x31d0 ,"ASUS Zen AIO 27 Z272SD_A272SD" ,ALC274_FIXUP_ASUS_ZEN_AIO_27 ), SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 265/423 ALSA: hda: Fix speakers on ASUS EXPERTBOOK P5405CSA 1.0
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Bárta <[email protected]>
[ Upstream commit f479ecc5ef15ed8d774968c1a8726a49420f11a0 ]
After some digging around I have found that this laptop has Cirrus's smart aplifiers connected to SPI bus (spi1-CSC3551:00-cs35l41-hda).
To get them correctly detected and working I had to modify patch_realtek.c with ASUS EXPERTBOOK P5405CSA 1.0 SystemID (0x1043, 0x1f63) and add corresponding hda_quirk (ALC245_FIXUP_CS35L41_SPI_2).
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10717,6 +10717,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x1f12 ,"ASUS UM5302" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x1043 ,0x1f1f ,"ASUS H7604JI/JV/J3D" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x1f62 ,"ASUS UX7602ZM" ,ALC245_FIXUP_CS35L41_SPI_2 ), +SND_PCI_QUIRK (0x1043 ,0x1f63 ,"ASUS P5405CSA" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x1f92 ,"ASUS ROG Flow X16" ,ALC289_FIXUP_ASUS_GA401 ),SND_PCI_QUIRK (0x1043 ,0x1fb3 ,"ASUS ROG Flow Z13 GZ302EA" ,ALC287_FIXUP_CS35L41_I2C_2 ), SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 266/423 perf/core: Fix perf_pmu_register() vs. perf_init_event()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit 003659fec9f6d8c04738cb74b5384398ae8a7e88 ]
There is a fairly obvious race between perf_init_event() doing idr_find() and perf_pmu_register() doing idr_alloc() with an incompletely initialized PMU pointer.
Avoid by doing idr_alloc() on a NULL pointer to register the id, and swizzling the real struct pmu pointer at the end using idr_replace().
Also making sure to not set struct pmu members after publishing the struct pmu, duh.
[ introduce idr_cmpxchg() in order to better handle the idr_replace()
error case -- if it were to return an unexpected pointer, it will already have replaced the value and there is no going back. ]
--- kernel/events/core.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)
kernel/events/core.c +26 -2
@@ -11737,6 +11737,21 @@ static int pmu_dev_alloc(struct pmu *pmu)static struct lock_class_key cpuctx_mutex;static struct lock_class_key cpuctx_lock; +static bool idr_cmpxchg (struct idr *idr,unsigned long id,void *old,void *new) +{ +void *tmp, *val =idr_find (idr, id); + +if (val != old) +return false; + + tmp =idr_replace (idr, new, id); +if (IS_ERR (tmp)) +return false; + +WARN_ON_ONCE (tmp != val); +return true; +} +int perf_pmu_register (struct pmu *pmu,const char *name,int type) {int cpu, ret, max =PERF_TYPE_MAX ;
@@ -11763,7 +11778,7 @@ int perf_pmu_register(struct pmu *pmu, const char *name, int type)if (type >=0 ) max = type; - ret =idr_alloc (&pmu_idr, pmu, max,0 ,GFP_KERNEL ); + ret =idr_alloc (&pmu_idr,NULL , max,0 ,GFP_KERNEL );if (ret <0 ) goto free_pdc;
@@ -11771,6 +11786,7 @@ int perf_pmu_register(struct pmu *pmu, const char *name, int type) type = ret; pmu->type = type; +atomic_set (&pmu->exclusive_cnt,0 );if (pmu_bus_running && !pmu->dev) { ret =pmu_dev_alloc (pmu);
@@ -11819,14 +11835,22 @@ int perf_pmu_register(struct pmu *pmu, const char *name, int type)if (!pmu->event_idx) pmu->event_idx = perf_event_idx_default; +/* +* Now that the PMU is complete, make it visible to perf_try_init_event(). +*/ +if (!idr_cmpxchg (&pmu_idr, pmu->type,NULL , pmu)) + goto free_context;list_add_rcu (&pmu->entry, &pmus); -atomic_set (&pmu->exclusive_cnt,0 ); + ret =0 ; unlock:mutex_unlock (&pmus_lock);return ret; +free_context: +free_percpu (pmu->cpu_pmu_context); + free_dev:if (pmu->dev && pmu->dev !=PMU_NULL_DEV ) {device_del (pmu->dev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 267/423 smb: common: change the data type of num_aces to le16
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 62e7dd0a39c2d0d7ff03274c36df971f1b3d2d0d ]
2.4.5 in [MS-DTYP].pdf describe the data type of num_aces as le16.
AceCount (2 bytes): An unsigned 16-bit integer that specifies the count of the number of ACE records in the ACL.
Change it to le16 and add reserved field to smb_acl struct.
--- fs/smb/client/cifsacl.c | 26 +++++++++++++------------- fs/smb/common/smbacl.h | 3 ++- fs/smb/server/smbacl.c | 31 ++++++++++++++++--------------- fs/smb/server/smbacl.h | 2 +- 4 files changed, 32 insertions(+), 30 deletions(-)
fs/smb/client/cifsacl.c +13 -13
@@ -763,7 +763,7 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl, struct cifs_fattr *fattr, bool mode_from_special_sid) { int i; -int num_aces =0 ; +u16 num_aces =0 ;int acl_size;char *acl_base;struct smb_ace **ppace;
@@ -785,7 +785,7 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl,cifs_dbg (NOISY ,"DACL revision %d size %d num aces %d\n" ,le16_to_cpu (pdacl->revision),le16_to_cpu (pdacl->size), -le32_to_cpu (pdacl->num_aces)); +le16_to_cpu (pdacl->num_aces));/* reset rwx permissions for user/group/other. Also, if num_aces is 0 i.e. DACL has no ACEs,
@@ -795,7 +795,7 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl, acl_base = (char *)pdacl; acl_size =sizeof (struct smb_acl ); - num_aces =le32_to_cpu (pdacl->num_aces); + num_aces =le16_to_cpu (pdacl->num_aces);if (num_aces >0 ) {umode_t denied_mode =0 ;
@@ -937,12 +937,12 @@ unsigned int setup_special_user_owner_ACE(struct smb_ace *pntace)static void populate_new_aces (char *nacl_base,struct smb_sid *pownersid,struct smb_sid *pgrpsid, -__u64 *pnmode,u32 *pnum_aces,u16 *pnsize, +__u64 *pnmode,u16 *pnum_aces,u16 *pnsize,bool modefromsid,bool posix) {__u64 nmode; -u32 num_aces =0 ; +u16 num_aces =0 ;u16 nsize =0 ;__u64 user_mode;__u64 group_mode;
@@ -1050,7 +1050,7 @@ static __u16 replace_sids_and_copy_aces(struct smb_acl *pdacl, struct smb_acl *pu16 size =0 ;struct smb_ace *pntace =NULL ;char *acl_base =NULL ; -u32 src_num_aces =0 ; +u16 src_num_aces =0 ;u16 nsize =0 ;struct smb_ace *pnntace =NULL ;char *nacl_base =NULL ;
@@ -1058,7 +1058,7 @@ static __u16 replace_sids_and_copy_aces(struct smb_acl *pdacl, struct smb_acl *p acl_base = (char *)pdacl; size =sizeof (struct smb_acl ); - src_num_aces =le32_to_cpu (pdacl->num_aces); + src_num_aces =le16_to_cpu (pdacl->num_aces); nacl_base = (char *)pndacl; nsize =sizeof (struct smb_acl );
@@ -1090,11 +1090,11 @@ static int set_chmod_dacl(struct smb_acl *pdacl, struct smb_acl *pndacl,u16 size =0 ;struct smb_ace *pntace =NULL ;char *acl_base =NULL ; -u32 src_num_aces =0 ; +u16 src_num_aces =0 ;u16 nsize =0 ;struct smb_ace *pnntace =NULL ;char *nacl_base =NULL ; -u32 num_aces =0 ; +u16 num_aces =0 ;bool new_aces_set = false;/* Assuming that pndacl and pnmode are never NULL */
@@ -1112,7 +1112,7 @@ static int set_chmod_dacl(struct smb_acl *pdacl, struct smb_acl *pndacl, acl_base = (char *)pdacl; size =sizeof (struct smb_acl ); - src_num_aces =le32_to_cpu (pdacl->num_aces); + src_num_aces =le16_to_cpu (pdacl->num_aces);/* Retain old ACEs which we can retain */ for (i =0 ; i < src_num_aces; ++i) {
@@ -1158,7 +1158,7 @@ static int set_chmod_dacl(struct smb_acl *pdacl, struct smb_acl *pndacl, } finalize_dacl: - pndacl->num_aces =cpu_to_le32 (num_aces); + pndacl->num_aces =cpu_to_le16 (num_aces); pndacl->size =cpu_to_le16 (nsize);return 0 ;
@@ -1293,7 +1293,7 @@ static int build_sec_desc(struct smb_ntsd *pntsd, struct smb_ntsd *pnntsd, dacloffset ? dacl_ptr->revision :cpu_to_le16 (ACL_REVISION ); ndacl_ptr->size =cpu_to_le16 (0 ); - ndacl_ptr->num_aces =cpu_to_le32 (0 ); + ndacl_ptr->num_aces =cpu_to_le16 (0 ); rc =set_chmod_dacl (dacl_ptr, ndacl_ptr, owner_sid_ptr, group_sid_ptr, pnmode, mode_from_sid, posix);
@@ -1651,7 +1651,7 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode, dacl_ptr = (struct smb_acl *)((char *)pntsd + dacloffset);if (mode_from_sid) nsecdesclen += -le32_to_cpu (dacl_ptr->num_aces) *sizeof (struct smb_ace ); +le16_to_cpu (dacl_ptr->num_aces) *sizeof (struct smb_ace );else /* cifsacl */ nsecdesclen +=le16_to_cpu (dacl_ptr->size); }
fs/smb/common/smbacl.h +2 -1
@@ -107,7 +107,8 @@ struct smb_sid {struct smb_acl {__le16 revision;/* revision level */ __le16 size; -__le32 num_aces; +__le16 num_aces; +__le16 reserved; } __attribute__((packed));struct smb_ace {
fs/smb/server/smbacl.c +16 -15
@@ -333,7 +333,7 @@ void posix_state_to_acl(struct posix_acl_state *state, pace->e_perm = state->other.allow; } -int init_acl_state (struct posix_acl_state *state,int cnt) +int init_acl_state (struct posix_acl_state *state,u16 cnt) {int alloc;
@@ -368,7 +368,7 @@ static void parse_dacl(struct mnt_idmap *idmap, struct smb_fattr *fattr) {int i, ret; -int num_aces =0 ; +u16 num_aces =0 ;unsigned int acl_size;char *acl_base;struct smb_ace **ppace;
@@ -389,12 +389,12 @@ static void parse_dacl(struct mnt_idmap *idmap,ksmbd_debug (SMB ,"DACL revision %d size %d num aces %d\n" ,le16_to_cpu (pdacl->revision),le16_to_cpu (pdacl->size), -le32_to_cpu (pdacl->num_aces)); +le16_to_cpu (pdacl->num_aces)); acl_base = (char *)pdacl; acl_size =sizeof (struct smb_acl ); - num_aces =le32_to_cpu (pdacl->num_aces); + num_aces =le16_to_cpu (pdacl->num_aces);if (num_aces <=0 )return ;
@@ -583,7 +583,7 @@ static void parse_dacl(struct mnt_idmap *idmap,static void set_posix_acl_entries_dacl (struct mnt_idmap *idmap,struct smb_ace *pndace, -struct smb_fattr *fattr,u32 *num_aces, +struct smb_fattr *fattr,u16 *num_aces,u16 *size,u32 nt_aces_num) {struct posix_acl_entry *pace;
@@ -704,7 +704,7 @@ static void set_ntacl_dacl(struct mnt_idmap *idmap, struct smb_fattr *fattr) {struct smb_ace *ntace, *pndace; -int nt_num_aces =le32_to_cpu (nt_dacl->num_aces), num_aces =0 ; +u16 nt_num_aces =le16_to_cpu (nt_dacl->num_aces), num_aces =0 ;unsigned short size =0 ;int i;
@@ -731,7 +731,7 @@ static void set_ntacl_dacl(struct mnt_idmap *idmap,set_posix_acl_entries_dacl (idmap, pndace, fattr, &num_aces, &size, nt_num_aces); - pndacl->num_aces =cpu_to_le32 (num_aces); + pndacl->num_aces =cpu_to_le16 (num_aces); pndacl->size =cpu_to_le16 (le16_to_cpu (pndacl->size) + size); }
@@ -739,7 +739,7 @@ static void set_mode_dacl(struct mnt_idmap *idmap, struct smb_acl *pndacl, struct smb_fattr *fattr) { struct smb_ace *pace, *pndace; -u32 num_aces =0 ; +u16 num_aces =0 ;u16 size =0 , ace_size =0 ;uid_t uid;const struct smb_sid *sid;
@@ -795,7 +795,7 @@ static void set_mode_dacl(struct mnt_idmap *idmap, fattr->cf_mode, 0007); out: - pndacl->num_aces =cpu_to_le32 (num_aces); + pndacl->num_aces =cpu_to_le16 (num_aces); pndacl->size =cpu_to_le16 (le16_to_cpu (pndacl->size) + size); }
@@ -1025,8 +1025,9 @@ int smb_inherit_dacl(struct ksmbd_conn *conn,struct smb_sid owner_sid, group_sid;struct dentry *parent = path->dentry->d_parent;struct mnt_idmap *idmap =mnt_idmap (path->mnt); -int inherited_flags =0 , flags =0 , i, ace_cnt =0 , nt_size =0 , pdacl_size; -int rc =0 , num_aces, dacloffset, pntsd_type, pntsd_size, acl_len, aces_size; +int inherited_flags =0 , flags =0 , i, nt_size =0 , pdacl_size; +int rc =0 , dacloffset, pntsd_type, pntsd_size, acl_len, aces_size; +u16 num_aces, ace_cnt =0 ;char *aces_base;bool is_dir =S_ISDIR (d_inode (path->dentry)->i_mode);
@@ -1042,7 +1043,7 @@ int smb_inherit_dacl(struct ksmbd_conn *conn, parent_pdacl = (struct smb_acl *)((char *)parent_pntsd + dacloffset); acl_len = pntsd_size - dacloffset; - num_aces =le32_to_cpu (parent_pdacl->num_aces); + num_aces =le16_to_cpu (parent_pdacl->num_aces); pntsd_type =le16_to_cpu (parent_pntsd->type); pdacl_size =le16_to_cpu (parent_pdacl->size);
@@ -1201,7 +1202,7 @@ int smb_inherit_dacl(struct ksmbd_conn *conn, pdacl = (struct smb_acl *)((char *)pntsd +le32_to_cpu (pntsd->dacloffset)); pdacl->revision =cpu_to_le16 (2 ); pdacl->size =cpu_to_le16 (sizeof (struct smb_acl ) + nt_size); - pdacl->num_aces =cpu_to_le32 (ace_cnt); + pdacl->num_aces =cpu_to_le16 (ace_cnt); pace = (struct smb_ace *)((char *)pdacl +sizeof (struct smb_acl ));memcpy (pace, aces_base, nt_size); pntsd_size +=sizeof (struct smb_acl ) + nt_size;
@@ -1282,7 +1283,7 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, const struct path *path, ace = (struct smb_ace *)((char *)pdacl +sizeof (struct smb_acl )); aces_size = acl_size -sizeof (struct smb_acl ); -for (i =0 ; i <le32_to_cpu (pdacl->num_aces); i++) { +for (i =0 ; i <le16_to_cpu (pdacl->num_aces); i++) {if (offsetof(struct smb_ace , access_req) > aces_size)break ; ace_size =le16_to_cpu (ace->size);
@@ -1303,7 +1304,7 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, const struct path *path, ace = (struct smb_ace *)((char *)pdacl +sizeof (struct smb_acl )); aces_size = acl_size -sizeof (struct smb_acl ); -for (i =0 ; i <le32_to_cpu (pdacl->num_aces); i++) { +for (i =0 ; i <le16_to_cpu (pdacl->num_aces); i++) {if (offsetof(struct smb_ace , access_req) > aces_size)break ; ace_size =le16_to_cpu (ace->size);
fs/smb/server/smbacl.h +1 -1
@@ -86,7 +86,7 @@ int parse_sec_desc(struct mnt_idmap *idmap, struct smb_ntsd *pntsd,int build_sec_desc (struct mnt_idmap *idmap,struct smb_ntsd *pntsd,struct smb_ntsd *ppntsd,int ppntsd_size,int addition_info,__u32 *secdesclen,struct smb_fattr *fattr); -int init_acl_state (struct posix_acl_state *state,int cnt); +int init_acl_state (struct posix_acl_state *state,u16 cnt);void free_acl_state (struct posix_acl_state *state);void posix_state_to_acl (struct posix_acl_state *state,struct posix_acl_entry *pace);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 268/423 cifs: fix incorrect validation for num_aces field of smb_acl
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit aa2a739a75ab6f24ef72fb3fdb9192c081eacf06 ]
parse_dcal() validate num_aces to allocate ace array.
f (num_aces > ULONG_MAX / sizeof(struct smb_ace *))
It is an incorrect validation that we can create an array of size ULONG_MAX. smb_acl has ->size field to calculate actual number of aces in response buffer size. Use this to check invalid num_aces.
--- fs/smb/client/cifsacl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/smb/client/cifsacl.c +6 -2
@@ -778,7 +778,8 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl, }/* validate that we do not go past end of acl */ -if (end_of_acl < (char *)pdacl +le16_to_cpu (pdacl->size)) { +if (end_of_acl < (char *)pdacl +sizeof (struct smb_acl ) || + end_of_acl < (char *)pdacl +le16_to_cpu (pdacl->size)) {cifs_dbg (VFS ,"ACL too small to parse DACL\n" );return ; }
@@ -799,8 +800,11 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl,if (num_aces >0 ) {umode_t denied_mode =0 ; -if (num_aces >ULONG_MAX /sizeof (struct smb_ace *)) +if (num_aces > (le16_to_cpu (pdacl->size) -sizeof (struct smb_acl )) / + (offsetof(struct smb_ace , sid) + + offsetof(struct smb_sid , sub_auth) +sizeof (__le16)))return ; + ppace =kmalloc_array (num_aces,sizeof (struct smb_ace *),GFP_KERNEL );if (!ppace)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 269/423 platform/x86: intel-hid: fix volume buttons on Microsoft Surface Go 4 tablet
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Panchenko <[email protected]>
[ Upstream commit 2738d06fb4f01145b24c542fb06de538ffc56430 ]
Volume buttons on Microsoft Surface Go 4 tablet didn't send any events. Add Surface Go 4 DMI match to button_array_table to fix this.
--- drivers/platform/x86/intel/hid.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/intel/hid.c +7 -0
@@ -132,6 +132,13 @@ static const struct dmi_system_id button_array_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go 3"), }, }, + { + .ident = "Microsoft Surface Go 4", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), + DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go 4"), + }, + }, { } };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 270/423 platform/x86/intel/vsec: Add Diamond Rapids support
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David E. Box <[email protected]>
[ Upstream commit f317f38e7fbb15a0d8329289fef8cf034938fb4f ]
Add PCI ID for the Diamond Rapids Platforms
--- drivers/platform/x86/intel/vsec.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/intel/vsec.c +7 -0
@@ -410,6 +410,11 @@ static const struct intel_vsec_platform_info oobmsm_info = { .caps = VSEC_CAP_TELEMETRY | VSEC_CAP_SDSI | VSEC_CAP_TPMI, }; +/* DMR OOBMSM info */ +static const struct intel_vsec_platform_info dmr_oobmsm_info = { + .caps =VSEC_CAP_TELEMETRY |VSEC_CAP_TPMI , +}; +/* TGL info */ static const struct intel_vsec_platform_info tgl_info = { .caps =VSEC_CAP_TELEMETRY ,
@@ -426,6 +431,7 @@ static const struct intel_vsec_platform_info lnl_info = {#define PCI_DEVICE_ID_INTEL_VSEC_MTL_M 0x7d0d#define PCI_DEVICE_ID_INTEL_VSEC_MTL_S 0xad0d#define PCI_DEVICE_ID_INTEL_VSEC_OOBMSM 0x09a7 +#define PCI_DEVICE_ID_INTEL_VSEC_OOBMSM_DMR 0x09a1#define PCI_DEVICE_ID_INTEL_VSEC_RPL 0xa77d#define PCI_DEVICE_ID_INTEL_VSEC_TGL 0x9a0d#define PCI_DEVICE_ID_INTEL_VSEC_LNL_M 0x647d
@@ -435,6 +441,7 @@ static const struct pci_device_id intel_vsec_pci_ids[] = { { PCI_DEVICE_DATA(INTEL, VSEC_MTL_M, &mtl_info) }, { PCI_DEVICE_DATA(INTEL, VSEC_MTL_S, &mtl_info) }, { PCI_DEVICE_DATA(INTEL, VSEC_OOBMSM, &oobmsm_info) }, + { PCI_DEVICE_DATA(INTEL, VSEC_OOBMSM_DMR, &dmr_oobmsm_info) }, { PCI_DEVICE_DATA(INTEL, VSEC_RPL, &tgl_info) }, { PCI_DEVICE_DATA(INTEL, VSEC_TGL, &tgl_info) }, { PCI_DEVICE_DATA(INTEL, VSEC_LNL_M, &lnl_info) },
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 271/423 net: dsa: rtl8366rb: dont prompt users for LED control
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit c34424eb3be4c01db831428c0d7d483701ae820f ]
Make NET_DSA_REALTEK_RTL8366RB_LEDS a hidden symbol. It seems very unlikely user would want to intentionally disable it.
--- drivers/net/dsa/realtek/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/realtek/Kconfig +1 -1
@@ -44,7 +44,7 @@ config NET_DSA_REALTEK_RTL8366RB Select to enable support for Realtek RTL8366RB. config NET_DSA_REALTEK_RTL8366RB_LEDS - bool "Support RTL8366RB LED control" + bool depends on (LEDS_CLASS=y || LEDS_CLASS=NET_DSA_REALTEK_RTL8366RB) depends on NET_DSA_REALTEK_RTL8366RB default NET_DSA_REALTEK_RTL8366RB
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 272/423 HID: i2c-hid: improve i2c_hid_get_report error message
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Guan <[email protected]>
[ Upstream commit 723aa55c08c9d1e0734e39a815fd41272eac8269 ]
We have two places to print "failed to set a report to ...", use "get a report from" instead of "set a report to", it makes people who knows less about the module to know where the error happened.
Before:i2c_hid_acpi i2c-FTSC1000:00: failed to set a report to device: -11
After:i2c_hid_acpi i2c-FTSC1000:00: failed to get a report from device: -11
--- drivers/hid/i2c-hid/i2c-hid-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/i2c-hid/i2c-hid-core.c +1 -1
@@ -284,7 +284,7 @@ static int i2c_hid_get_report(struct i2c_hid *ihid, ihid->rawbuf, recv_len + sizeof(__le16));if (error) {dev_err (&ihid->client->dev, -"failed to set a report to device: %d\n" , error); +"failed to get a report from device: %d\n" , error);return error; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 273/423 platform/x86/amd/pmf: Propagate PMF-TA return codes
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shyam Sundar S K <[email protected]>
[ Upstream commit 9ba93cb8212d62bccd8b41b8adb6656abf37280a ]
In the amd_pmf_invoke_cmd_init() function within the PMF driver ensure that the actual result from the PMF-TA is returned rather than a generic EIO. This change allows for proper handling of errors originating from the PMF-TA.
--- drivers/platform/x86/amd/pmf/tee-if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/amd/pmf/tee-if.c +1 -1
@@ -323,7 +323,7 @@ static int amd_pmf_start_policy_engine(struct amd_pmf_dev *dev) }else {dev_err (dev->dev,"ta invoke cmd init failed err: %x\n" , res); dev->smart_pc_enabled = false; -return -EIO ; +return res; }return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 274/423 platform/x86/amd/pmf: Update PMF Driver for Compatibility with new PMF-TA
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shyam Sundar S K <[email protected]>
[ Upstream commit 376a8c2a144397d9cf2a67d403dd64f4a7ff9104 ]
The PMF driver allocates a shared memory buffer using tee_shm_alloc_kernel_buf() for communication with the PMF-TA.
The latest PMF-TA version introduces new structures with OEM debug information and additional policy input conditions for evaluating the policy binary. Consequently, the shared memory size must be increased to ensure compatibility between the PMF driver and the updated PMF-TA.
To do so, introduce the new PMF-TA UUID and update the PMF shared memory configuration to ensure compatibility with the latest PMF-TA version. Additionally, export the TA UUID.
These updates will result in modifications to the prototypes of amd_pmf_tee_init() and amd_pmf_ta_open_session().
--- drivers/platform/x86/amd/pmf/pmf.h | 5 ++- drivers/platform/x86/amd/pmf/tee-if.c | 50 +++++++++++++++++++-------- 2 files changed, 40 insertions(+), 15 deletions(-)
drivers/platform/x86/amd/pmf/pmf.h +4 -1
@@ -105,9 +105,12 @@ struct cookie_header {#define PMF_TA_IF_VERSION_MAJOR 1#define TA_PMF_ACTION_MAX 32#define TA_PMF_UNDO_MAX 8 -#define TA_OUTPUT_RESERVED_MEM 906 +#define TA_OUTPUT_RESERVED_MEM 922#define MAX_OPERATION_PARAMS 4 +#define TA_ERROR_CRYPTO_INVALID_PARAM 0x20002 +#define TA_ERROR_CRYPTO_BIN_TOO_LARGE 0x2000d +#define PMF_IF_V1 1#define PMF_IF_V2 2
drivers/platform/x86/amd/pmf/tee-if.c +36 -14
102 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 275/423 exfat: add a check for invalid data size
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuezhang Mo <[email protected]>
[ Upstream commit 13940cef95491472760ca261b6713692ece9b946 ]
Add a check for invalid data size to avoid corrupted filesystem from being further corrupted.
--- fs/exfat/namei.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/exfat/namei.c +5 -0
@@ -639,6 +639,11 @@ static int exfat_find(struct inode *dir, struct qstr *qname, info->valid_size =le64_to_cpu (ep2->dentry.stream.valid_size); info->size =le64_to_cpu (ep2->dentry.stream.size); +if (unlikely (EXFAT_B_TO_CLU_ROUND_UP (info->size, sbi) > sbi->used_clusters)) { +exfat_fs_error (sb,"data size is invalid(%lld)" , info->size); +return -EIO ; + } + info->start_clu =le32_to_cpu (ep2->dentry.stream.start_clu);if (!is_valid_cluster (sbi, info->start_clu) && info->size) { exfat_warn(sb, "start_clu is invalid cluster(0x%x)",
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 276/423 ALSA: hda/realtek: Add support for ASUS ROG Strix G814 Laptop using CS35L41 HDA
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Binding <[email protected]>
[ Upstream commit f2c11231b57b5163bf16cdfd65271d53d61dd996 ]
Add support for ASUS G814PH/PM/PP and G814FH/FM/FP.
Laptops use 2 CS35L41 Amps with HDA, using Internal boost, with I2C.
--- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_realtek.c +2 -0
@@ -10727,6 +10727,8 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x3a40 ,"ASUS G814JZR" ,ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS ),SND_PCI_QUIRK (0x1043 ,0x3a50 ,"ASUS G834JYR/JZR" ,ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS ),SND_PCI_QUIRK (0x1043 ,0x3a60 ,"ASUS G634JYR/JZR" ,ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS ), +SND_PCI_QUIRK (0x1043 ,0x3e00 ,"ASUS G814FH/FM/FP" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x1043 ,0x3e20 ,"ASUS G814PH/PM/PP" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x1043 ,0x3e30 ,"ASUS TP3607SA" ,ALC287_FIXUP_TAS2781_I2C ),SND_PCI_QUIRK (0x1043 ,0x3ee0 ,"ASUS Strix G815_JHR_JMR_JPR" ,ALC287_FIXUP_TAS2781_I2C ), SND_PCI_QUIRK(0x1043, 0x3ef0, "ASUS Strix G635LR_LW_LX", ALC287_FIXUP_TAS2781_I2C),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 277/423 ALSA: hda/realtek: Add support for ASUS ROG Strix GA603 Laptops using CS35L41 HDA
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Binding <[email protected]>
[ Upstream commit 16dc157346dd4404b02b42e73b88604be3652039 ]
Add support for ASUS GA603KP, GA603KM and GA603KH.
Laptops use 2 CS35L41 Amps with HDA, using Internal boost, with I2C
--- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_realtek.c +2 -0
@@ -10727,6 +10727,8 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x3a40 ,"ASUS G814JZR" ,ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS ),SND_PCI_QUIRK (0x1043 ,0x3a50 ,"ASUS G834JYR/JZR" ,ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS ),SND_PCI_QUIRK (0x1043 ,0x3a60 ,"ASUS G634JYR/JZR" ,ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS ), +SND_PCI_QUIRK (0x1043 ,0x3d78 ,"ASUS GA603KH" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x1043 ,0x3d88 ,"ASUS GA603KM" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x1043 ,0x3e00 ,"ASUS G814FH/FM/FP" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x1043 ,0x3e20 ,"ASUS G814PH/PM/PP" ,ALC287_FIXUP_CS35L41_I2C_2 ), SND_PCI_QUIRK(0x1043, 0x3e30, "ASUS TP3607SA", ALC287_FIXUP_TAS2781_I2C),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 278/423 ALSA: hda/realtek: Add support for ASUS ROG Strix G614 Laptops using CS35L41 HDA
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Binding <[email protected]>
[ Upstream commit 9120b2b4ad0dad2f6bbb6bcacd0456f806fda62d ]
Add support for ASUS G614PH/PM/PP and G614FH/FM/FP.
Laptops use 2 CS35L41 Amps with HDA, using Internal boost, with I2C
--- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_realtek.c +2 -0
@@ -10620,7 +10620,9 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8e1a ,"HP ZBook Firefly 14 G12A" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x1043 ,0x103e ,"ASUS X540SA" ,ALC256_FIXUP_ASUS_MIC ),SND_PCI_QUIRK (0x1043 ,0x103f ,"ASUS TX300" ,ALC282_FIXUP_ASUS_TX300 ), +SND_PCI_QUIRK (0x1043 ,0x1054 ,"ASUS G614FH/FM/FP" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x1043 ,0x106d ,"Asus K53BE" ,ALC269_FIXUP_LIMIT_INT_MIC_BOOST ), +SND_PCI_QUIRK (0x1043 ,0x1074 ,"ASUS G614PH/PM/PP" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x1043 ,0x10a1 ,"ASUS UX391UA" ,ALC294_FIXUP_ASUS_SPK ),SND_PCI_QUIRK (0x1043 ,0x10a4 ,"ASUS TP3407SA" ,ALC287_FIXUP_TAS2781_I2C ), SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 279/423 ALSA: hda/realtek: Add support for various ASUS Laptops using CS35L41 HDA
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Binding <[email protected]>
[ Upstream commit 859a11917001424776e1cca02b762efcabb4044e ]
Add support for ASUS B3405CVA, B5405CVA, B5605CVA, B3605CVA.
Laptops use 2 CS35L41 Amps with HDA, using Internal boost, with SPI
--- sound/pci/hda/patch_realtek.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/pci/hda/patch_realtek.c +4 -0
@@ -10636,6 +10636,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x125e ,"ASUS Q524UQK" ,ALC255_FIXUP_ASUS_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x1271 ,"ASUS X430UN" ,ALC256_FIXUP_ASUS_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x1290 ,"ASUS X441SA" ,ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1043 ,0x1294 ,"ASUS B3405CVA" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x12a0 ,"ASUS X441UV" ,ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x12a3 ,"Asus N7691ZM" ,ALC269_FIXUP_ASUS_N7601ZM ), SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
@@ -10722,6 +10723,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x1f63 ,"ASUS P5405CSA" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x1f92 ,"ASUS ROG Flow X16" ,ALC289_FIXUP_ASUS_GA401 ),SND_PCI_QUIRK (0x1043 ,0x1fb3 ,"ASUS ROG Flow Z13 GZ302EA" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x1043 ,0x3011 ,"ASUS B5605CVA" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x3030 ,"ASUS ZN270IE" ,ALC256_FIXUP_ASUS_AIO_GPIO2 ),SND_PCI_QUIRK (0x1043 ,0x31d0 ,"ASUS Zen AIO 27 Z272SD_A272SD" ,ALC274_FIXUP_ASUS_ZEN_AIO_27 ), SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
@@ -10740,6 +10742,8 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x3f10 ,"ASUS Strix G835LR_LW_LX" ,ALC287_FIXUP_TAS2781_I2C ),SND_PCI_QUIRK (0x1043 ,0x3f20 ,"ASUS Strix G615LR_LW" ,ALC287_FIXUP_TAS2781_I2C ),SND_PCI_QUIRK (0x1043 ,0x3f30 ,"ASUS Strix G815LR_LW" ,ALC287_FIXUP_TAS2781_I2C ), +SND_PCI_QUIRK (0x1043 ,0x3fd0 ,"ASUS B3605CVA" ,ALC245_FIXUP_CS35L41_SPI_2 ), +SND_PCI_QUIRK (0x1043 ,0x3ff0 ,"ASUS B5405CVA" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x831a ,"ASUS P901" ,ALC269_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x1043 ,0x834a ,"ASUS S101" ,ALC269_FIXUP_STEREO_DMIC ), SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 280/423 ALSA: hda/realtek: Add support for ASUS B3405 and B3605 Laptops using CS35L41 HDA
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Binding <[email protected]>
[ Upstream commit 7ab61d0a9a35e32497bcf2233310fec79ee3338f ]
Add support for ASUS B3405CCA / P3405CCA, B3605CCA / P3605CCA, B3405CCA, B3605CCA.
Laptops use 2 CS35L41 Amps with HDA, using Internal boost, with SPI
--- sound/pci/hda/patch_realtek.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/pci/hda/patch_realtek.c +4 -0
@@ -10640,6 +10640,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x12a0 ,"ASUS X441UV" ,ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x12a3 ,"Asus N7691ZM" ,ALC269_FIXUP_ASUS_N7601ZM ),SND_PCI_QUIRK (0x1043 ,0x12af ,"ASUS UX582ZS" ,ALC245_FIXUP_CS35L41_SPI_2 ), +SND_PCI_QUIRK (0x1043 ,0x12b4 ,"ASUS B3405CCA / P3405CCA" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x12e0 ,"ASUS X541SA" ,ALC256_FIXUP_ASUS_MIC ),SND_PCI_QUIRK (0x1043 ,0x12f0 ,"ASUS X541UV" ,ALC256_FIXUP_ASUS_MIC ), SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
@@ -10725,7 +10726,10 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x1fb3 ,"ASUS ROG Flow Z13 GZ302EA" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x1043 ,0x3011 ,"ASUS B5605CVA" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x3030 ,"ASUS ZN270IE" ,ALC256_FIXUP_ASUS_AIO_GPIO2 ), +SND_PCI_QUIRK (0x1043 ,0x3061 ,"ASUS B3405CCA" ,ALC245_FIXUP_CS35L41_SPI_2 ), +SND_PCI_QUIRK (0x1043 ,0x30c1 ,"ASUS B3605CCA / P3605CCA" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x31d0 ,"ASUS Zen AIO 27 Z272SD_A272SD" ,ALC274_FIXUP_ASUS_ZEN_AIO_27 ), +SND_PCI_QUIRK (0x1043 ,0x31f1 ,"ASUS B3605CCA" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x3a20 ,"ASUS G614JZR" ,ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS ),SND_PCI_QUIRK (0x1043 ,0x3a30 ,"ASUS G814JVR/JIR" ,ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS ), SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 281/423 ALSA: hda/realtek: Add support for ASUS B5405 and B5605 Laptops using CS35L41 HDA
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Binding <[email protected]>
[ Upstream commit c86dd79a7c338fff9bebb9503857e07db9845eca ]
Add support for ASUS B5605CCA and B5405CCA.
Laptops use 2 CS35L41 Amps with HDA, using Internal boost, with SPI
--- sound/pci/hda/patch_realtek.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/pci/hda/patch_realtek.c +4 -0
@@ -10727,8 +10727,12 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x3011 ,"ASUS B5605CVA" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x3030 ,"ASUS ZN270IE" ,ALC256_FIXUP_ASUS_AIO_GPIO2 ),SND_PCI_QUIRK (0x1043 ,0x3061 ,"ASUS B3405CCA" ,ALC245_FIXUP_CS35L41_SPI_2 ), +SND_PCI_QUIRK (0x1043 ,0x3071 ,"ASUS B5405CCA" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x30c1 ,"ASUS B3605CCA / P3605CCA" ,ALC245_FIXUP_CS35L41_SPI_2 ), +SND_PCI_QUIRK (0x1043 ,0x30d1 ,"ASUS B5405CCA" ,ALC245_FIXUP_CS35L41_SPI_2 ), +SND_PCI_QUIRK (0x1043 ,0x30e1 ,"ASUS B5605CCA" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x31d0 ,"ASUS Zen AIO 27 Z272SD_A272SD" ,ALC274_FIXUP_ASUS_ZEN_AIO_27 ), +SND_PCI_QUIRK (0x1043 ,0x31e1 ,"ASUS B5605CCA" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x31f1 ,"ASUS B3605CCA" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x3a20 ,"ASUS G614JZR" ,ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS ), SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 282/423 ALSA: hda/realtek: Add support for ASUS Zenbook UM3406KA Laptops using CS35L41 HDA
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Binding <[email protected]>
[ Upstream commit 8463d2adbe1901247937fcdfe4b525130f6db10b ]
Laptop uses 2 CS35L41 Amps with HDA, using External boost with I2C
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10630,6 +10630,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x10d3 ,"ASUS K6500ZC" ,ALC294_FIXUP_ASUS_SPK ),SND_PCI_QUIRK (0x1043 ,0x1154 ,"ASUS TP3607SH" ,ALC287_FIXUP_TAS2781_I2C ),SND_PCI_QUIRK (0x1043 ,0x115d ,"Asus 1015E" ,ALC269_FIXUP_LIMIT_INT_MIC_BOOST ), +SND_PCI_QUIRK (0x1043 ,0x1194 ,"ASUS UM3406KA" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x1043 ,0x11c0 ,"ASUS X556UR" ,ALC255_FIXUP_ASUS_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x1204 ,"ASUS Strix G615JHR_JMR_JPR" ,ALC287_FIXUP_TAS2781_I2C ), SND_PCI_QUIRK(0x1043, 0x1214, "ASUS Strix G615LH_LM_LP", ALC287_FIXUP_TAS2781_I2C),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 283/423 sched/deadline: Use online cpus for validating runtime
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shrikanth Hegde <[email protected]>
[ Upstream commit 14672f059d83f591afb2ee1fff56858efe055e5a ]
The ftrace selftest reported a failure because writing -1 to sched_rt_runtime_us returns -EBUSY. This happens when the possible CPUs are different from active CPUs.
Active CPUs are part of one root domain, while remaining CPUs are part of def_root_domain. Since active cpumask is being used, this results in cpus=0 when a non active CPUs is used in the loop.
Fix it by looping over the online CPUs instead for validating the bandwidth calculations.
--- kernel/sched/deadline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/deadline.c +1 -1
@@ -3179,7 +3179,7 @@ int sched_dl_global_validate(void)* value smaller than the currently allocated bandwidth in * any of the root_domains. */ -for_each_possible_cpu (cpu) { +for_each_online_cpu (cpu) {rcu_read_lock_sched ();if (dl_bw_visited (cpu, gen))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 284/423 x86/hyperv/vtl: Stop kernel from probing VTL0 low memory
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naman Jain <[email protected]>
[ Upstream commit 59115e2e25f42924181055ed7cc1d123af7598b7 ]
For Linux, running in Hyper-V VTL (Virtual Trust Level), kernel in VTL2 tries to access VTL0 low memory in probe_roms. This memory is not described in the e820 map. Initialize probe_roms call to no-ops during boot for VTL2 kernel to avoid this. The issue got identified in OpenVMM which detects invalid accesses initiated from kernel running in VTL2.
Message-ID: <[email protected]>
--- arch/x86/hyperv/hv_vtl.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/hyperv/hv_vtl.c +1 -0
@@ -30,6 +30,7 @@ void __init hv_vtl_init_platform(void) x86_platform.realmode_init = x86_init_noop; x86_init.irqs.pre_vector_init = x86_init_noop; x86_init.timers.timer_init = x86_init_noop; + x86_init.resources.probe_roms = x86_init_noop;/* Avoid searching for BIOS MP tables */ x86_init.mpparse.find_mptable = x86_init_noop;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 285/423 ASoC: codecs: wsa884x: report temps to hwmon in millidegree of Celsius
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Klimov <[email protected]>
[ Upstream commit d776f016d24816f15033169dcd081f077b6c10f4 ]
Temperatures are reported in units of Celsius however hwmon expects values to be in millidegree of Celsius. Userspace tools observe values close to zero and report it as "Not available" or incorrect values like 0C or 1C. Add a simple conversion to fix that.
Before the change:
wsa884x-virtual-0
Adapter: Virtual device
temp1: +0.0°C
--
wsa884x-virtual-0
Adapter: Virtual device
temp1: +0.0°C
Also reported as N/A before first amplifier power on.
After this change and initial wsa884x power on:
wsa884x-virtual-0
Adapter: Virtual device
temp1: +39.0°C
--
wsa884x-virtual-0
Adapter: Virtual device
temp1: +37.0°C
Tested on sm8550 only.
--- sound/soc/codecs/wsa884x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/wsa884x.c +2 -2
@@ -1875,7 +1875,7 @@ static int wsa884x_get_temp(struct wsa884x_priv *wsa884x, long *temp)* Reading temperature is possible only when Power Amplifier is * off. Report last cached data. */ - *temp = wsa884x->temperature; + *temp = wsa884x->temperature *1000 ;return 0 ; }
@@ -1934,7 +1934,7 @@ static int wsa884x_get_temp(struct wsa884x_priv *wsa884x, long *temp)if ((val >WSA884X_LOW_TEMP_THRESHOLD ) && (val <WSA884X_HIGH_TEMP_THRESHOLD )) { wsa884x->temperature = val; - *temp = val; + *temp = val *1000 ; ret =0 ; }else { ret = -EAGAIN ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 286/423 ASoC: rt1320: set wake_capable = 0 explicitly
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bard Liao <[email protected]>
[ Upstream commit 927e6bec5cf3624665b0a2e9f64a1d32f3d22cdd ]
"generic_new_peripheral_assigned: invalid dev_num 1, wake supported 1" is reported by our internal CI test.
Rt1320's wake feature is not used in Linux and that's why it is not in the wake_capable_list[] list in intel_auxdevice.c.
However, BIOS may set it as wake-capable. Overwrite wake_capable to 0 in the codec driver to align with wake_capable_list[].
--- sound/soc/codecs/rt1320-sdw.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/codecs/rt1320-sdw.c +3 -0
@@ -3705,6 +3705,9 @@ static int rt1320_read_prop(struct sdw_slave *slave)/* set the timeout values */ prop->clk_stop_timeout =64 ; +/* BIOS may set wake_capable. Make sure it is 0 as wake events are disabled. */ + prop->wake_capable =0 ; +return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 287/423 wifi: mac80211: flush the station before moving it to UN-AUTHORIZED state
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit 43e04077170799d0e6289f3e928f727e401b3d79 ]
We first want to flush the station to make sure we no longer have any frames being Tx by the station before the station is moved to un-authorized state. Failing to do that will lead to races: a frame may be sent after the station's state has been changed.
Since the API clearly states that the driver can't fail the sta_state() transition down the list of state, we can easily flush the station first, and only then call the driver's sta_state().
--- net/mac80211/sta_info.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
net/mac80211/sta_info.c +17 -3
@@ -4,7 +4,7 @@* Copyright 2006-2007 Jiri Benc <[email protected]> * Copyright 2013-2014 Intel Mobile Communications GmbH * Copyright (C) 2015 - 2017 Intel Deutschland GmbH -* Copyright (C) 2018-2023 Intel Corporation +* Copyright (C) 2018-2024 Intel Corporation */ #include <linux/module.h>
@@ -1317,9 +1317,13 @@ static int _sta_info_move_state(struct sta_info *sta, sta->sta.addr, new_state);/* notify the driver before the actual changes so it can -* fail the transition +* fail the transition if the state is increasing. +* The driver is required not to fail when the transition +* is decreasing the state, so first, do all the preparation +* work and only then, notify the driver. */ -if (test_sta_flag (sta,WLAN_STA_INSERTED )) { +if (new_state > sta->sta_state && +test_sta_flag (sta,WLAN_STA_INSERTED )) {int err =drv_sta_state (sta->local, sta->sdata, sta, sta->sta_state, new_state);if (err)
@@ -1395,6 +1399,16 @@ static int _sta_info_move_state(struct sta_info *sta,break ; } +if (new_state < sta->sta_state && +test_sta_flag (sta,WLAN_STA_INSERTED )) { +int err =drv_sta_state (sta->local, sta->sdata, sta, + sta->sta_state, new_state); + +WARN_ONCE (err, +"Driver is not allowed to fail if the sta_state is transitioning down the list: %d\n" , + err); + } + sta->sta_state = new_state;return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 288/423 wifi: mac80211: fix SA Query processing in MLO
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit 9a267ce4a3fca93a34a8881046f97bcf472228c8 ]
When MLO is used and SA Query processing isn't done by userspace (e.g. wpa_supplicant w/o CONFIG_OCV), then the mac80211 code kicks in but uses the wrong addresses. Fix them.
--- net/mac80211/rx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/mac80211/rx.c +5 -5
@@ -6,7 +6,7 @@* Copyright 2007-2010 Johannes Berg <[email protected]> * Copyright 2013-2014 Intel Mobile Communications GmbH * Copyright(c) 2015 - 2017 Intel Deutschland GmbH -* Copyright (C) 2018-2024 Intel Corporation +* Copyright (C) 2018-2025 Intel Corporation */ #include <linux/jiffies.h>
@@ -3323,8 +3323,8 @@ static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata,return ; } -if (!ether_addr_equal (mgmt->sa, sdata->deflink.u.mgd.bssid) || - !ether_addr_equal (mgmt->bssid, sdata->deflink.u.mgd.bssid)) { +if (!ether_addr_equal (mgmt->sa, sdata->vif.cfg.ap_addr) || + !ether_addr_equal (mgmt->bssid, sdata->vif.cfg.ap_addr)) {/* Not from the current AP or not associated yet. */ return ; }
@@ -3340,9 +3340,9 @@ static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata,skb_reserve (skb, local->hw.extra_tx_headroom); resp =skb_put_zero (skb,24 ); -memcpy (resp->da, mgmt->sa,ETH_ALEN ); +memcpy (resp->da, sdata->vif.cfg.ap_addr,ETH_ALEN );memcpy (resp->sa, sdata->vif.addr,ETH_ALEN ); -memcpy (resp->bssid, sdata->deflink.u.mgd.bssid,ETH_ALEN ); +memcpy (resp->bssid, sdata->vif.cfg.ap_addr,ETH_ALEN ); resp->frame_control =cpu_to_le16 (IEEE80211_FTYPE_MGMT |IEEE80211_STYPE_ACTION );skb_put (skb,1 +sizeof (resp->u.action.u.sa_query));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 289/423 locking/semaphore: Use wake_q to wake up processes outside lock critical section
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
[ Upstream commit 85b2b9c16d053364e2004883140538e73b333cdb ]
A circular lock dependency splat has been seen involving down_trylock():
======================================================
WARNING: possible circular locking dependency detected 6.12.0-41.el10.s390x+debug
------------------------------------------------------
dd/32479 is trying to acquire lock:
0015a20accd0d4f8 ((console_sem).lock){-.-.}-{2:2}, at: down_trylock+0x26/0x90
but task is already holding lock:
000000017e461698 (&zone->lock){-.-.}-{2:2}, at: rmqueue_bulk+0xac/0x8f0
the existing dependency chain (in reverse order) is:
-> #4 (&zone->lock){-.-.}-{2:2}:
-> #3 (hrtimer_bases.lock){-.-.}-{2:2}:
-> #2 (&rq->__lock){-.-.}-{2:2}:
-> #1 (&p->pi_lock){-.-.}-{2:2}:
-> #0 ((console_sem).lock){-.-.}-{2:2}:
The console_sem -> pi_lock dependency is due to calling try_to_wake_up() while holding the console_sem raw_spinlock. This dependency can be broken by using wake_q to do the wakeup instead of calling try_to_wake_up() under the console_sem lock. This will also make the semaphore's raw_spinlock become a terminal lock without taking any further locks underneath it.
The hrtimer_bases.lock is a raw_spinlock while zone->lock is a spinlock. The hrtimer_bases.lock -> zone->lock dependency happens via the debug_objects_fill_pool() helper function in the debugobjects code.
-> #4 (&zone->lock){-.-.}-{2:2}:
__lock_acquire+0xe86/0x1cc0
lock_acquire.part.0+0x258/0x630
lock_acquire+0xb8/0xe0
_raw_spin_lock_irqsave+0xb4/0x120
rmqueue_bulk+0xac/0x8f0
__rmqueue_pcplist+0x580/0x830
rmqueue_pcplist+0xfc/0x470
rmqueue.isra.0+0xdec/0x11b0
get_page_from_freelist+0x2ee/0xeb0
__alloc_pages_noprof+0x2c2/0x520
alloc_pages_mpol_noprof+0x1fc/0x4d0
alloc_pages_noprof+0x8c/0xe0
allocate_slab+0x320/0x460
___slab_alloc+0xa58/0x12b0
__slab_alloc.isra.0+0x42/0x60
kmem_cache_alloc_noprof+0x304/0x350
fill_pool+0xf6/0x450
debug_object_activate+0xfe/0x360
enqueue_hrtimer+0x34/0x190
__run_hrtimer+0x3c8/0x4c0
__hrtimer_run_queues+0x1b2/0x260
hrtimer_interrupt+0x316/0x760
do_IRQ+0x9a/0xe0
do_irq_async+0xf6/0x160Normally a raw_spinlock to spinlock dependency is not legitimate and will be warned if CONFIG_PROVE_RAW_LOCK_NESTING is enabled, but debug_objects_fill_pool() is an exception as it explicitly allows this dependency for non-PREEMPT_RT kernel without causing PROVE_RAW_LOCK_NESTING lockdep splat. As a result, this dependency is legitimate and not a bug.
Anyway, semaphore is the only locking primitive left that is still using try_to_wake_up() to do wakeup inside critical section, all the other locking primitives had been migrated to use wake_q to do wakeup outside of the critical section. It is also possible that there are other circular locking dependencies involving printk/console_sem or other existing/new semaphores lurking somewhere which may show up in the future. Let just do the migration now to wake_q to avoid headache like this.
--- kernel/locking/semaphore.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
kernel/locking/semaphore.c +9 -4
@@ -29,6 +29,7 @@#include <linux/export.h> #include <linux/sched.h> #include <linux/sched/debug.h> +#include <linux/sched/wake_q.h> #include <linux/semaphore.h> #include <linux/spinlock.h> #include <linux/ftrace.h>
@@ -38,7 +39,7 @@ static noinline void __down(struct semaphore *sem); static noinline int __down_interruptible(struct semaphore *sem); static noinline int __down_killable(struct semaphore *sem); static noinline int __down_timeout(struct semaphore *sem, long timeout); -static noinline void __up(struct semaphore *sem); +static noinline void __up(struct semaphore *sem, struct wake_q_head *wake_q);/** * down - acquire the semaphore
@@ -183,13 +184,16 @@ EXPORT_SYMBOL(down_timeout); void __sched up(struct semaphore *sem) {unsigned long flags; +DEFINE_WAKE_Q (wake_q);raw_spin_lock_irqsave (&sem->lock, flags);if (likely (list_empty (&sem->wait_list))) sem->count++;else -__up (sem); +__up (sem, &wake_q);raw_spin_unlock_irqrestore (&sem->lock, flags); +if (!wake_q_empty (&wake_q)) +wake_up_q (&wake_q); }EXPORT_SYMBOL (up);
@@ -269,11 +273,12 @@ static noinline int __sched __down_timeout(struct semaphore *sem, long timeout)return __down_common (sem,TASK_UNINTERRUPTIBLE , timeout); } -static noinline void __sched __up(struct semaphore *sem) +static noinline void __sched __up(struct semaphore *sem, +struct wake_q_head *wake_q) {struct semaphore_waiter *waiter =list_first_entry (&sem->wait_list, struct semaphore_waiter, list);list_del (&waiter->list); waiter->up = true; -wake_up_process (waiter->task); +wake_q_add (wake_q, waiter->task); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 290/423 x86/hyperv: Fix output argument to hypercall that changes page visibility
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Kelley <[email protected]>
[ Upstream commit 09beefefb57bbc3a06d98f319d85db4d719d7bcb ]
The hypercall in hv_mark_gpa_visibility() is invoked with an input argument and an output argument. The output argument ostensibly returns the number of pages that were processed. But in fact, the hypercall does not provide any output, so the output argument is spurious.
The spurious argument is harmless because Hyper-V ignores it, but in the interest of correctness and to avoid the potential for future problems, remove it.
Message-ID: <[email protected]>
--- arch/x86/hyperv/ivm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/hyperv/ivm.c +1 -2
@@ -465,7 +465,6 @@ static int hv_mark_gpa_visibility(u16 count, const u64 pfn[], enum hv_mem_host_visibility visibility) {struct hv_gpa_range_for_visibility *input; -u16 pages_processed;u64 hv_status;unsigned long flags;
@@ -494,7 +493,7 @@ static int hv_mark_gpa_visibility(u16 count, const u64 pfn[],memcpy ((void *)input->gpa_page_list, pfn, count *sizeof (*pfn)); hv_status =hv_do_rep_hypercall (HVCALL_MODIFY_SPARSE_GPA_PAGE_HOST_VISIBILITY , count, -0 , input, &pages_processed); +0 , input,NULL );local_irq_restore (flags);if (hv_result_success (hv_status))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 291/423 x86/sgx: Warn explicitly if X86_FEATURE_SGX_LC is not enabled
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladis Dronov <[email protected]>
[ Upstream commit 65be5c95d08eedda570a6c888a12384c77fe7614 ]
The kernel requires X86_FEATURE_SGX_LC to be able to create SGX enclaves, not just X86_FEATURE_SGX.
There is quite a number of hardware which has X86_FEATURE_SGX but not X86_FEATURE_SGX_LC. A kernel running on such hardware does not create the /dev/sgx_enclave file and does so silently.
Explicitly warn if X86_FEATURE_SGX_LC is not enabled to properly notify users that the kernel disabled the SGX driver.
The X86_FEATURE_SGX_LC, a.k.a. SGX Launch Control, is a CPU feature that enables LE (Launch Enclave) hash MSRs to be writable (with additional opt-in required in the 'feature control' MSR) when running enclaves, i.e. using a custom root key rather than the Intel proprietary key for enclave signing.
I've hit this issue myself and have spent some time researching where my /dev/sgx_enclave file went on SGX-enabled hardware.
Related links:
https://github.com/intel/linux-sgx/issues/837
https://patchwork.kernel.org/project/platform-driver-x86/patch/[email protected]/
[ mingo: Made the error message a bit more verbose, and added other cases
where the kernel fails to create the /dev/sgx_enclave device node. ]
--- arch/x86/kernel/cpu/sgx/driver.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/sgx/driver.c +7 -3
@@ -150,13 +150,15 @@ int __init sgx_drv_init(void)u64 xfrm_mask;int ret; -if (!cpu_feature_enabled (X86_FEATURE_SGX_LC )) +if (!cpu_feature_enabled (X86_FEATURE_SGX_LC )) { +pr_info ("SGX disabled: SGX launch control CPU feature is not available, /dev/sgx_enclave disabled.\n" );return -ENODEV ; + }cpuid_count (SGX_CPUID ,0 , &eax, &ebx, &ecx, &edx);if (!(eax &1 )) { -pr_err ("SGX disabled: SGX1 instruction support not available.\n" ); +pr_info ("SGX disabled: SGX1 instruction support not available, /dev/sgx_enclave disabled.\n" );return -ENODEV ; }
@@ -173,8 +175,10 @@ int __init sgx_drv_init(void) } ret =misc_register (&sgx_dev_enclave); -if (ret) +if (ret) { +pr_info ("SGX disabled: Unable to register the /dev/sgx_enclave driver (%d).\n" , ret);return ret; + }return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 292/423 nvme-pci: fix stuck reset on concurrent DPC and HP
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keith Busch <[email protected]>
[ Upstream commit 3f674e7b670b7b7d9261935820e4eba3c059f835 ]
The PCIe error handling has the nvme driver quiesce the device, attempt to restart it, then wait for that restart to complete.
A PCIe DPC event also toggles the PCIe link. If the slot doesn't have out-of-band presence detection, this will trigger a pciehp re-enumeration.
The error handling that calls nvme_error_resume is holding the device lock while this happens. This lock blocks pciehp's request to disconnect the driver from proceeding.
Meanwhile the nvme's reset can't make forward progress because its device isn't there anymore with outstanding IO, and the timeout handler won't do anything to fix it because the device is undergoing error handling.
End result: deadlocked.
Fix this by having the timeout handler short cut the disabling for a disconnected PCIe device. The downside is that we're relying on an IO timeout to clean up this mess, which could be a minute by default.
--- drivers/nvme/host/pci.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/nvme/host/pci.c +12 -1
@@ -1413,9 +1413,20 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req)struct nvme_dev *dev = nvmeq->dev;struct request *abort_req;struct nvme_command cmd = { }; +struct pci_dev *pdev =to_pci_dev (dev->dev);u32 csts =readl (dev->bar +NVME_REG_CSTS );u8 opcode; +/* +* Shutdown the device immediately if we see it is disconnected. This +* unblocks PCIe error handling if the nvme driver is waiting in +* error_resume for a device that has been removed. We can't unbind the +* driver while the driver's error callback is waiting to complete, so +* we're relying on a timeout to break that deadlock if a removal +* occurs while reset work is running. +*/ +if (pci_dev_is_disconnected (pdev)) +nvme_change_ctrl_state (&dev->ctrl,NVME_CTRL_DELETING );if (nvme_state_terminal (&dev->ctrl)) goto disable;
@@ -1423,7 +1434,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req)* the recovery mechanism will surely fail. */ mb (); -if (pci_channel_offline (to_pci_dev (dev->dev))) +if (pci_channel_offline (pdev))return BLK_EH_RESET_TIMER ;/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 293/423 drm/amd: Keep display off while going into S4
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit 4afacc9948e1f8fdbca401d259ae65ad93d298c0 ]
When userspace invokes S4 the flow is:
1) amdgpu_pmops_prepare()
2) amdgpu_pmops_freeze()
3) Create hibernation image
4) amdgpu_pmops_thaw()
5) Write out image to disk
6) Turn off system
Then on resume amdgpu_pmops_restore() is called.
This flow has a problem that because amdgpu_pmops_thaw() is called it will call amdgpu_device_resume() which will resume all of the GPU.
This includes turning the display hardware back on and discovering connectors again.
This is an unexpected experience for the display to turn back on. Adjust the flow so that during the S4 sequence display hardware is not turned back on.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 11 +++++++++-- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +9 -2
@@ -2633,7 +2633,6 @@ static int amdgpu_pmops_freeze(struct device *dev) adev->in_s4 = true; r =amdgpu_device_suspend (drm_dev, true); - adev->in_s4 = false;if (r)return r;
@@ -2645,8 +2644,13 @@ static int amdgpu_pmops_freeze(struct device *dev)static int amdgpu_pmops_thaw (struct device *dev) {struct drm_device *drm_dev =dev_get_drvdata (dev); +struct amdgpu_device *adev =drm_to_adev (drm_dev); +int r; -return amdgpu_device_resume (drm_dev, true); + r =amdgpu_device_resume (drm_dev, true); + adev->in_s4 = false; + +return r; }static int amdgpu_pmops_poweroff (struct device *dev)
@@ -2659,6 +2663,9 @@ static int amdgpu_pmops_poweroff(struct device *dev)static int amdgpu_pmops_restore (struct device *dev) {struct drm_device *drm_dev =dev_get_drvdata (dev); +struct amdgpu_device *adev =drm_to_adev (drm_dev); + + adev->in_s4 = false;return amdgpu_device_resume (drm_dev, true); }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -0
@@ -3306,6 +3306,11 @@ static int dm_resume(void *handle)return 0 ; } + +/* leave display off for S4 sequence */ +if (adev->in_s4) +return 0 ; +/* Recreate dc_state - DC invalidates it when setting power state to S3. */ dc_state_release (dm_state->context); dm_state->context =dc_state_create (dm->dc,NULL );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 294/423 net: devmem: do not WARN conditionally after netdev_rx_queue_restart()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taehee Yoo <[email protected]>
[ Upstream commit a70f891e0fa0435379ad4950e156a15a4ef88b4d ]
When devmem socket is closed, netdev_rx_queue_restart() is called to reset queue by the net_devmem_unbind_dmabuf(). But callback may return -ENETDOWN if the interface is down because queues are already freed when the interface is down so queue reset is not needed. So, it should not warn if the return value is -ENETDOWN.
--- net/core/devmem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/core/devmem.c +3 -1
@@ -108,6 +108,7 @@ void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding)struct netdev_rx_queue *rxq;unsigned long xa_idx;unsigned int rxq_idx; +int err;if (binding->list.next)list_del (&binding->list);
@@ -119,7 +120,8 @@ void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding) rxq_idx =get_netdev_rx_queue_index (rxq); -WARN_ON (netdev_rx_queue_restart (binding->dev, rxq_idx)); + err =netdev_rx_queue_restart (binding->dev, rxq_idx); +WARN_ON (err && err != -ENETDOWN ); }xa_erase (&net_devmem_dmabuf_bindings, binding->id);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 295/423 selftests: netfilter: skip br_netfilter queue tests if kernel is tainted
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit c21b02fd9cbf15aed6e32c89e0fd70070281e3d1 ]
These scripts fail if the kernel is tainted which leads to wrong test failure reports in CI environments when an unrelated test triggers some splat.
Check taint state at start of script and SKIP if its already dodgy.
--- tools/testing/selftests/net/netfilter/br_netfilter.sh | 7 +++++++ .../testing/selftests/net/netfilter/br_netfilter_queue.sh | 7 +++++++ tools/testing/selftests/net/netfilter/nft_queue.sh | 1 + 3 files changed, 15 insertions(+)
tools/testing/selftests/net/netfilter/br_netfilter.sh +7 -0
@@ -13,6 +13,12 @@ source lib.sh checktool "nft --version" "run test without nft tool" +read t < /proc/sys/kernel/tainted +if [ "$t" -ne 0 ];then + echo SKIP: kernel is tainted + exit $ksft_skip +fi + cleanup() { cleanup_all_ns }
@@ -165,6 +171,7 @@ if [ "$t" -eq 0 ];then echo PASS: kernel not tainted else echo ERROR: kernel is tainted + dmesg ret=1 fi
tools/testing/selftests/net/netfilter/br_netfilter_queue.sh +7 -0
@@ -4,6 +4,12 @@ source lib.sh checktool "nft --version" "run test without nft tool" +read t < /proc/sys/kernel/tainted +if [ "$t" -ne 0 ];then + echo SKIP: kernel is tainted + exit $ksft_skip +fi + cleanup() { cleanup_all_ns }
@@ -72,6 +78,7 @@ if [ "$t" -eq 0 ];then echo PASS: kernel not tainted else echo ERROR: kernel is tainted + dmesg exit 1 fi
tools/testing/selftests/net/netfilter/nft_queue.sh +1 -0
@@ -593,6 +593,7 @@ EOF echo "PASS: queue program exiting while packets queued" else echo "TAINT: queue program exiting while packets queued" + dmesg ret=1 fi }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 296/423 ALSA: hda/realtek: Add mute LED quirk for HP Pavilion x360 14-dy1xxx
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Navon John Lukose <[email protected]>
[ Upstream commit b11a74ac4f545626d0dc95a8ca8c41df90532bf3 ]
Add a fixup to enable the mute LED on HP Pavilion x360 Convertible 14-dy1xxx with ALC295 codec. The appropriate coefficient index and bits were identified through a brute-force method, as detailed in
https://bbs.archlinux.org/viewtopic.php?pid=2079504#p2079504.
--- sound/pci/hda/patch_realtek.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
sound/pci/hda/patch_realtek.c +21 -0
@@ -4794,6 +4794,21 @@ static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec, } } +static void alc295_fixup_hp_mute_led_coefbit11 (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { + spec->mute_led_polarity =0 ; + spec->mute_led_coef.idx =0xb ; + spec->mute_led_coef.mask =3 <<3 ; + spec->mute_led_coef.on =1 <<3 ; + spec->mute_led_coef.off =1 <<4 ; +snd_hda_gen_add_mute_led_cdev (codec, coef_mute_led_set); + } +} +static void alc285_fixup_hp_mute_led (struct hda_codec *codec,const struct hda_fixup *fix,int action) {
@@ -7626,6 +7641,7 @@ enum {ALC290_FIXUP_MONO_SPEAKERS_HSJACK ,ALC290_FIXUP_SUBWOOFER ,ALC290_FIXUP_SUBWOOFER_HSJACK , +ALC295_FIXUP_HP_MUTE_LED_COEFBIT11 ,ALC269_FIXUP_THINKPAD_ACPI ,ALC269_FIXUP_DMIC_THINKPAD_ACPI , ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13,
@@ -9361,6 +9377,10 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id = ALC283_FIXUP_INT_MIC, }, + [ALC295_FIXUP_HP_MUTE_LED_COEFBIT11] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc295_fixup_hp_mute_led_coefbit11, + }, [ALC298_FIXUP_SAMSUNG_AMP] = { .type = HDA_FIXUP_FUNC, .v.func = alc298_fixup_samsung_amp,
@@ -10396,6 +10416,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x84e7 ,"HP Pavilion 15" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ),SND_PCI_QUIRK (0x103c ,0x8519 ,"HP Spectre x360 15-df0xxx" ,ALC285_FIXUP_HP_SPECTRE_X360 ),SND_PCI_QUIRK (0x103c ,0x8537 ,"HP ProBook 440 G6" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ), +SND_PCI_QUIRK (0x103c ,0x85c6 ,"HP Pavilion x360 Convertible 14-dy1xxx" ,ALC295_FIXUP_HP_MUTE_LED_COEFBIT11 ),SND_PCI_QUIRK (0x103c ,0x85de ,"HP Envy x360 13-ar0xxx" ,ALC285_FIXUP_HP_ENVY_X360 ),SND_PCI_QUIRK (0x103c ,0x860f ,"HP ZBook 15 G6" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ), SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 297/423 can: statistics: use atomic access in hot path
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Hartkopp <[email protected]>
[ Upstream commit 80b5f90158d1364cbd80ad82852a757fc0692bf2 ]
In can_send() and can_receive() CAN messages and CAN filter matches are counted to be visible in the CAN procfs files.
KCSAN detected a data race within can_send() when two CAN frames have been generated by a timer event writing to the same CAN netdevice at the same time. Use atomic operations to access the statistics in the hot path to fix the KCSAN complaint.
--- net/can/af_can.c | 12 ++++++------ net/can/af_can.h | 12 ++++++------ net/can/proc.c | 46 +++++++++++++++++++++++++++------------------- 3 files changed, 39 insertions(+), 31 deletions(-)
net/can/af_can.c +6 -6
@@ -287,8 +287,8 @@ int can_send(struct sk_buff *skb, int loop)netif_rx (newskb);/* update statistics */ - pkg_stats->tx_frames++; - pkg_stats->tx_frames_delta++; +atomic_long_inc (&pkg_stats->tx_frames); +atomic_long_inc (&pkg_stats->tx_frames_delta);return 0 ;
@@ -647,8 +647,8 @@ static void can_receive(struct sk_buff *skb, struct net_device *dev)int matches;/* update statistics */ - pkg_stats->rx_frames++; - pkg_stats->rx_frames_delta++; +atomic_long_inc (&pkg_stats->rx_frames); +atomic_long_inc (&pkg_stats->rx_frames_delta);/* create non-zero unique skb identifier together with *skb */ while (!(can_skb_prv (skb)->skbcnt))
@@ -669,8 +669,8 @@ static void can_receive(struct sk_buff *skb, struct net_device *dev)consume_skb (skb);if (matches >0 ) { - pkg_stats->matches++; - pkg_stats->matches_delta++; +atomic_long_inc (&pkg_stats->matches); +atomic_long_inc (&pkg_stats->matches_delta); } }
net/can/af_can.h +6 -6
@@ -66,9 +66,9 @@ struct receiver {struct can_pkg_stats {unsigned long jiffies_init; -unsigned long rx_frames; -unsigned long tx_frames; -unsigned long matches; +atomic_long_t rx_frames; +atomic_long_t tx_frames; +atomic_long_t matches;unsigned long total_rx_rate;unsigned long total_tx_rate;
@@ -82,9 +82,9 @@ struct can_pkg_stats {unsigned long max_tx_rate;unsigned long max_rx_match_ratio; -unsigned long rx_frames_delta; -unsigned long tx_frames_delta; -unsigned long matches_delta; +atomic_long_t rx_frames_delta; +atomic_long_t tx_frames_delta; +atomic_long_t matches_delta; };/* persistent statistics */
net/can/proc.c +27 -19
86 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 298/423 memory: omap-gpmc: drop no compatible check
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roger Quadros <[email protected]>
[ Upstream commit edcccc6892f65eff5fd3027a13976131dc7fd733 ]
We are no longer depending on legacy device trees so drop the no compatible check for NAND and OneNAND nodes.
--- drivers/memory/omap-gpmc.c | 20 -------------------- 1 file changed, 20 deletions(-)
drivers/memory/omap-gpmc.c +0 -20
@@ -2245,26 +2245,6 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, goto err; } -if (of_node_name_eq (child,"nand" )) { -/* Warn about older DT blobs with no compatible property */ -if (!of_property_read_bool (child,"compatible" )) { -dev_warn (&pdev->dev, -"Incompatible NAND node: missing compatible" ); - ret = -EINVAL ; - goto err; - } - } - -if (of_node_name_eq (child,"onenand" )) { -/* Warn about older DT blobs with no compatible property */ -if (!of_property_read_bool (child,"compatible" )) { -dev_warn (&pdev->dev, -"Incompatible OneNAND node: missing compatible" ); - ret = -EINVAL ; - goto err; - } - } -if (of_match_node (omap_nand_ids, child)) {/* NAND specific setup */ val =8 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 299/423 hwmon: (nct6775-core) Fix out of bounds access for NCT679{8,9}
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tasos Sahanidis <[email protected]>
[ Upstream commit 815f80ad20b63830949a77c816e35395d5d55144 ]
pwm_num is set to 7 for these chips, but NCT6776_REG_PWM_MODE and NCT6776_PWM_MODE_MASK only contain 6 values.
Fix this by adding another 0 to the end of each array.
--- drivers/hwmon/nct6775-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/nct6775-core.c +2 -2
@@ -273,8 +273,8 @@ static const s8 NCT6776_BEEP_BITS[NUM_BEEP_BITS] = {static const u16 NCT6776_REG_TOLERANCE_H [] = {0x10c ,0x20c ,0x30c ,0x80c ,0x90c ,0xa0c ,0xb0c }; -static const u8 NCT6776_REG_PWM_MODE [] = {0x04 ,0 ,0 ,0 ,0 ,0 }; -static const u8 NCT6776_PWM_MODE_MASK [] = {0x01 ,0 ,0 ,0 ,0 ,0 }; +static const u8 NCT6776_REG_PWM_MODE [] = {0x04 ,0 ,0 ,0 ,0 ,0 ,0 }; +static const u8 NCT6776_PWM_MODE_MASK [] = {0x01 ,0 ,0 ,0 ,0 ,0 ,0 };static const u16 NCT6776_REG_FAN_MIN [] = {0x63a ,0x63c ,0x63e ,0x640 ,0x642 ,0x64a ,0x64c };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 300/423 netfs: Fix netfs_unbuffered_read() to return ssize_t rather than int
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 07c574eb53d4cc9aa7b985bc8bfcb302e5dc4694 ]
Fix netfs_unbuffered_read() to return an ssize_t rather than an int as netfs_wait_for_read() returns ssize_t and this gets implicitly truncated.
--- fs/netfs/direct_read.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/netfs/direct_read.c +3 -3
@@ -108,9 +108,9 @@ static int netfs_dispatch_unbuffered_reads(struct netfs_io_request *rreq)* Perform a read to an application buffer, bypassing the pagecache and the * local disk cache. */ -static int netfs_unbuffered_read (struct netfs_io_request *rreq,bool sync) +static ssize_t netfs_unbuffered_read (struct netfs_io_request *rreq,bool sync) { -int ret; +ssize_t ret;_enter ("R=%x %llx-%llx" , rreq->debug_id, rreq->start, rreq->start + rreq->len -1 );
@@ -149,7 +149,7 @@ static int netfs_unbuffered_read(struct netfs_io_request *rreq, bool sync) } out: -_leave (" = %d" , ret); +_leave (" = %zd" , ret);return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 301/423 spufs: fix a leak on spufs_new_file() failure
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit d1ca8698ca1332625d83ea0d753747be66f9906d ]
It's called from spufs_fill_dir(), and caller of that will do spufs_rmdir() in case of failure. That does remove everything we'd managed to create, but... the problem dentry is still negative. IOW, it needs to be explicitly dropped.
--- arch/powerpc/platforms/cell/spufs/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/platforms/cell/spufs/inode.c +3 -1
@@ -192,8 +192,10 @@ static int spufs_fill_dir(struct dentry *dir,return -ENOMEM ; ret =spufs_new_file (dir->d_sb, dentry, files->ops, files->mode & mode, files->size, ctx); -if (ret) +if (ret) { +dput (dentry);return ret; + } files++; }return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 302/423 spufs: fix gang directory lifetimes
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit c134deabf4784e155d360744d4a6a835b9de4dd4 ]
prior to "[POWERPC] spufs: Fix gang destroy leaks" we used to have a problem with gang lifetimes - creation of a gang returns opened gang directory, which normally gets removed when that gets closed, but if somebody has created a context belonging to that gang and kept it alive until the gang got closed, removal failed and we ended up with a leak.
Unfortunately, it had been fixed the wrong way. Dentry of gang directory was no longer pinned, and rmdir on close was gone. One problem was that failure of open kept calling simple_rmdir() as cleanup, which meant an unbalanced dput(). Another bug was in the success case - gang creation incremented link count on root directory, but that was no longer undone when gang got destroyed.
Fix consists of
* reverting the commit in question
* adding a counter to gang, protected by ->i_rwsem
of gang directory inode.
* having it set to 1 at creation time, dropped
in both spufs_dir_close() and spufs_gang_close() and bumped in spufs_create_context(), provided that it's not 0.
* using simple_recursive_removal() to take the gang
directory out when counter reaches zero.
--- arch/powerpc/platforms/cell/spufs/gang.c | 1 + arch/powerpc/platforms/cell/spufs/inode.c | 54 +++++++++++++++++++---- arch/powerpc/platforms/cell/spufs/spufs.h | 2 + 3 files changed, 49 insertions(+), 8 deletions(-)
arch/powerpc/platforms/cell/spufs/gang.c +1 -0
@@ -25,6 +25,7 @@ struct spu_gang *alloc_spu_gang(void)mutex_init (&gang->aff_mutex);INIT_LIST_HEAD (&gang->list);INIT_LIST_HEAD (&gang->aff_list_head); + gang->alive =1 ; out:return gang;
arch/powerpc/platforms/cell/spufs/inode.c +46 -8
111 lines not on this page · raw message
arch/powerpc/platforms/cell/spufs/spufs.h +2 -0
@@ -151,6 +151,8 @@ struct spu_gang {int aff_flags;struct spu *aff_ref_spu;atomic_t aff_sched_count; + +int alive; };/* Flag bits for spu_gang aff_flags */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 303/423 spufs: fix a leak in spufs_create_context()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit 0f5cce3fc55b08ee4da3372baccf4bcd36a98396 ]
Leak fixes back in 2008 missed one case - if we are trying to set affinity and spufs_mkdir() fails, we need to drop the reference to neighbor.
--- arch/powerpc/platforms/cell/spufs/inode.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/powerpc/platforms/cell/spufs/inode.c +4 -1
@@ -460,8 +460,11 @@ spufs_create_context(struct inode *inode, struct dentry *dentry, } ret =spufs_mkdir (inode, dentry, flags, mode &0777 ); -if (ret) +if (ret) { +if (neighbor) +put_spu_context (neighbor); goto out_aff_unlock; + }if (affinity) { spufs_set_affinity(flags, SPUFS_I(d_inode(dentry))->i_ctx,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 304/423 fs/9p: fix NULL pointer dereference on mkdir
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Schoenebeck <[email protected]>
[ Upstream commit 3f61ac7c65bdb26accb52f9db66313597e759821 ]
When a 9p tree was mounted with option 'posixacl', parent directory had a default ACL set for its subdirectories, e.g.:
setfacl -m default:group:simpsons:rwx parentdir
then creating a subdirectory crashed 9p client, as v9fs_fid_add() call in function v9fs_vfs_mkdir_dotl() sets the passed 'fid' pointer to NULL (since dafbe689736) even though the subsequent v9fs_set_create_acl() call expects a valid non-NULL 'fid' pointer:
[ 37.273191] BUG: kernel NULL pointer dereference, address: 0000000000000000 ... [ 37.322338] Call Trace: [ 37.323043] <TASK> [ 37.323621] ? __die (arch/x86/kernel/dumpstack.c:421 arch/x86/kernel/dumpstack.c:434) [ 37.324448] ? page_fault_oops (arch/x86/mm/fault.c:714) [ 37.325532] ? search_module_extables (kernel/module/main.c:3733) [ 37.326742] ? p9_client_walk (net/9p/client.c:1165) 9pnet [ 37.328006] ? search_bpf_extables (kernel/bpf/core.c:804) [ 37.329142] ? exc_page_fault (./arch/x86/include/asm/paravirt.h:686 arch/x86/mm/fault.c:1488 arch/x86/mm/fault.c:1538) [ 37.330196] ? asm_exc_page_fault (./arch/x86/include/asm/idtentry.h:574) [ 37.331330] ? p9_client_walk (net/9p/client.c:1165) 9pnet [ 37.332562] ? v9fs_fid_xattr_get (fs/9p/xattr.c:30) 9p [ 37.333824] v9fs_fid_xattr_set (fs/9p/fid.h:23 fs/9p/xattr.c:121) 9p [ 37.335077] v9fs_set_acl (fs/9p/acl.c:276) 9p [ 37.336112] v9fs_set_create_acl (fs/9p/acl.c:307) 9p [ 37.337326] v9fs_vfs_mkdir_dotl (fs/9p/vfs_inode_dotl.c:411) 9p [ 37.338590] vfs_mkdir (fs/namei.c:4313) [ 37.339535] do_mkdirat (fs/namei.c:4336) [ 37.340465] __x64_sys_mkdir (fs/namei.c:4354) [ 37.341455] do_syscall_64 (arch/x86/entry/common.c:52 arch/x86/entry/common.c:83) [ 37.342447] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
Fix this by simply swapping the sequence of these two calls in v9fs_vfs_mkdir_dotl(), i.e. calling v9fs_set_create_acl() before v9fs_fid_add().
Message-ID: <[email protected]>
--- fs/9p/vfs_inode_dotl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/9p/vfs_inode_dotl.c +1 -1
@@ -407,8 +407,8 @@ static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap, err); goto error; } -v9fs_fid_add (dentry, &fid);v9fs_set_create_acl (inode, fid, dacl, pacl); +v9fs_fid_add (dentry, &fid);d_instantiate (dentry, inode); err =0 ;inc_nlink (dir);
Signature · 1 line
2.39.5