5.10.258-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 115/589 arm64: dts: imx8mq-librem5: set regulators boot-on
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Kepplinger <[email protected]>
[ Upstream commit a8bb83c8c7a17e83e04801d0678e93654f9bfaee ]
Expect all those regulators to be turned on initially.
Stable-dep-of: 511f76bf1dce ("arm64: dts: imx8mq-librem5: Bump BUCK1 suspend voltage up to 0.85V")
--- arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi +13 -0
@@ -649,6 +649,7 @@ regulator-name = "buck1"; regulator-min-microvolt = <700000>; regulator-max-microvolt = <1300000>; + regulator-boot-on; regulator-ramp-delay = <1250>; rohm,dvs-run-voltage = <900000>; rohm,dvs-idle-voltage = <850000>;
@@ -660,6 +661,7 @@ regulator-name = "buck2"; regulator-min-microvolt = <700000>; regulator-max-microvolt = <1300000>; + regulator-boot-on; regulator-ramp-delay = <1250>; rohm,dvs-run-voltage = <1000000>; rohm,dvs-idle-voltage = <900000>;
@@ -670,6 +672,7 @@ regulator-name = "buck3"; regulator-min-microvolt = <700000>; regulator-max-microvolt = <1300000>; + regulator-boot-on; rohm,dvs-run-voltage = <900000>; };
@@ -684,6 +687,7 @@ regulator-name = "buck5"; regulator-min-microvolt = <700000>; regulator-max-microvolt = <1350000>; + regulator-boot-on; regulator-always-on; };
@@ -691,6 +695,7 @@ regulator-name = "buck6"; regulator-min-microvolt = <3000000>; regulator-max-microvolt = <3300000>; + regulator-boot-on; regulator-always-on; };
@@ -698,6 +703,7 @@ regulator-name = "buck7"; regulator-min-microvolt = <1605000>; regulator-max-microvolt = <1995000>; + regulator-boot-on; regulator-always-on; };
@@ -705,6 +711,7 @@ regulator-name = "buck8"; regulator-min-microvolt = <800000>; regulator-max-microvolt = <1400000>; + regulator-boot-on; regulator-always-on; };
@@ -712,6 +719,7 @@ regulator-name = "ldo1"; regulator-min-microvolt = <3000000>; regulator-max-microvolt = <3300000>; + regulator-boot-on; /* leave on for snvs power button */ regulator-always-on; };
@@ -720,6 +728,7 @@ regulator-name = "ldo2"; regulator-min-microvolt = <900000>; regulator-max-microvolt = <900000>; + regulator-boot-on; /* leave on for snvs power button */ regulator-always-on; };
@@ -728,6 +737,7 @@ regulator-name = "ldo3"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <3300000>; + regulator-boot-on; regulator-always-on; };
@@ -735,6 +745,7 @@ regulator-name = "ldo4"; regulator-min-microvolt = <900000>; regulator-max-microvolt = <1800000>; + regulator-boot-on; regulator-always-on; };
@@ -751,6 +762,7 @@ regulator-name = "ldo6"; regulator-min-microvolt = <900000>; regulator-max-microvolt = <1800000>; + regulator-boot-on; regulator-always-on; };
@@ -759,6 +771,7 @@ regulator-name = "ldo7"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <3300000>; + regulator-boot-on; regulator-always-on; }; };
Greg Kroah-Hartman
maintainerPATCH 116/589 arm64: dts: imx8mq-librem5: Set the DVS voltages lower
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Krzyszkowiak <[email protected]>
[ Upstream commit c24a9b698fb02cd0723fa8375abab07f94b97b10 ]
They're still in the operating range according to i.MX 8M Quad datasheet. There's some headroom added over minimal values to account for voltage drop.
Operational ranges (min - typ - max [selected]):
- VDD_SOC (BUCK1): 0.81 - 0.9 - 0.99 [0.88]
- VDD_ARM (BUCK2): 0.81 - 0.9 - 1.05 [0.84] (1000MHz)
0.90 - 1.0 - 1.05 [0.93] (1500MHz)
- VDD_GPU (BUCK3): 0.81 - 0.9 - 1.05 [0.85] (800MHz)
0.90 - 1.0 - 1.05 [ -- ] (1000MHz)
- VDD_VPU (BUCK4): 0.81 - 0.9 - 1.05 [ -- ] (550/500/588MHz)
0.90 - 1.0 - 1.05 [0.93] (660/600/800MHz)Idle power consumption doesn't appear to be influenced much, but a simple load test (cat /dev/urandom | pigz - > /dev/null combined with running Animatch) seems to show about 0.3W of difference.
Care is advised, as there may be differences between each units in how low can they be undervolted - in my experience, reaching that point usually makes the phone fail to boot. In my case, it appears that my Birch phone can go down the most.
This is a somewhat conservative set of values that I've seen working well on all my devices; I haven't tried very hard to optimize it, so more experiments are welcome.
Stable-dep-of: 511f76bf1dce ("arm64: dts: imx8mq-librem5: Bump BUCK1 suspend voltage up to 0.85V")
--- arch/arm64/boot/dts/freescale/imx8mq-librem5-r3.dts | 2 - arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 22 ++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-)
arch/arm64/boot/dts/freescale/imx8mq-librem5-r3.dts +1 -1
@@ -12,7 +12,7 @@ &a53_opp_table { opp-1000000000 { - opp-microvolt = <1000000>; + opp-microvolt = <950000>; }; };
arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi +16 -6
@@ -651,8 +651,8 @@ regulator-max-microvolt = <1300000>; regulator-boot-on; regulator-ramp-delay = <1250>; - rohm,dvs-run-voltage = <900000>; - rohm,dvs-idle-voltage = <850000>; + rohm,dvs-run-voltage = <880000>; + rohm,dvs-idle-voltage = <820000>; rohm,dvs-suspend-voltage = <800000>; regulator-always-on; };
@@ -663,8 +663,8 @@ regulator-max-microvolt = <1300000>; regulator-boot-on; regulator-ramp-delay = <1250>; - rohm,dvs-run-voltage = <1000000>; - rohm,dvs-idle-voltage = <900000>; + rohm,dvs-run-voltage = <950000>; + rohm,dvs-idle-voltage = <850000>; regulator-always-on; };
@@ -673,14 +673,14 @@ regulator-min-microvolt = <700000>; regulator-max-microvolt = <1300000>; regulator-boot-on; - rohm,dvs-run-voltage = <900000>; + rohm,dvs-run-voltage = <850000>; }; buck4_reg: BUCK4 { regulator-name = "buck4"; regulator-min-microvolt = <700000>; regulator-max-microvolt = <1300000>; - rohm,dvs-run-voltage = <1000000>; + rohm,dvs-run-voltage = <930000>; }; buck5_reg: BUCK5 {
@@ -1117,3 +1117,13 @@ fsl,ext-reset-output; status = "okay"; }; + +&a53_opp_table { + opp-1000000000 { + opp-microvolt = <850000>; + }; + + opp-1500000000 { + opp-microvolt = <950000>; + }; +};
Greg Kroah-Hartman
maintainerPATCH 117/589 arm64: dts: imx8mq-librem5: Bump BUCK1 suspend voltage to 0.81V
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Krzyszkowiak <[email protected]>
[ Upstream commit 94b91e3ca6688fafd6a5dd70bd89fe9d3aee88da ]
0.8V is outside of the operating voltage specified for imx8mq, see chapter 3.1.4 "Operating ranges" of the IMX8MDQLQCEC document.
Stable-dep-of: 511f76bf1dce ("arm64: dts: imx8mq-librem5: Bump BUCK1 suspend voltage up to 0.85V")
--- arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi +1 -1
@@ -653,7 +653,7 @@ regulator-ramp-delay = <1250>; rohm,dvs-run-voltage = <880000>; rohm,dvs-idle-voltage = <820000>; - rohm,dvs-suspend-voltage = <800000>; + rohm,dvs-suspend-voltage = <810000>; regulator-always-on; };
Greg Kroah-Hartman
maintainerPATCH 118/589 Revert "arm64: dts: imx8mq-librem5: Set the DVS voltages lower"
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Krzyszkowiak <[email protected]>
[ Upstream commit 4cd46ea0eb4504f7f4fea92cb4601c5c9a3e545e ]
This reverts commit c24a9b698fb02cd0723fa8375abab07f94b97b10.
It's been found that there's a significant per-unit variance in accepted supply voltages and the current set still makes some units unstable.
Revert back to nominal values.
Stable-dep-of: 511f76bf1dce ("arm64: dts: imx8mq-librem5: Bump BUCK1 suspend voltage up to 0.85V")
--- arch/arm64/boot/dts/freescale/imx8mq-librem5-r3.dts | 2 - arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 22 +++++--------------- 2 files changed, 7 insertions(+), 17 deletions(-)
arch/arm64/boot/dts/freescale/imx8mq-librem5-r3.dts +1 -1
@@ -12,7 +12,7 @@ &a53_opp_table { opp-1000000000 { - opp-microvolt = <950000>; + opp-microvolt = <1000000>; }; };
arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi +6 -16
@@ -651,8 +651,8 @@ regulator-max-microvolt = <1300000>; regulator-boot-on; regulator-ramp-delay = <1250>; - rohm,dvs-run-voltage = <880000>; - rohm,dvs-idle-voltage = <820000>; + rohm,dvs-run-voltage = <900000>; + rohm,dvs-idle-voltage = <850000>; rohm,dvs-suspend-voltage = <810000>; regulator-always-on; };
@@ -663,8 +663,8 @@ regulator-max-microvolt = <1300000>; regulator-boot-on; regulator-ramp-delay = <1250>; - rohm,dvs-run-voltage = <950000>; - rohm,dvs-idle-voltage = <850000>; + rohm,dvs-run-voltage = <1000000>; + rohm,dvs-idle-voltage = <900000>; regulator-always-on; };
@@ -673,14 +673,14 @@ regulator-min-microvolt = <700000>; regulator-max-microvolt = <1300000>; regulator-boot-on; - rohm,dvs-run-voltage = <850000>; + rohm,dvs-run-voltage = <900000>; }; buck4_reg: BUCK4 { regulator-name = "buck4"; regulator-min-microvolt = <700000>; regulator-max-microvolt = <1300000>; - rohm,dvs-run-voltage = <930000>; + rohm,dvs-run-voltage = <1000000>; }; buck5_reg: BUCK5 {
@@ -1117,13 +1117,3 @@ fsl,ext-reset-output; status = "okay"; }; - -&a53_opp_table { - opp-1000000000 { - opp-microvolt = <850000>; - }; - - opp-1500000000 { - opp-microvolt = <950000>; - }; -};
Greg Kroah-Hartman
maintainerPATCH 119/589 arm64: dts: imx8mq-librem5: Bump BUCK1 suspend voltage up to 0.85V
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Krzyszkowiak <[email protected]>
[ Upstream commit 511f76bf1dce5acf8907b65a7d1bc8f7e7c0d637 ]
The minimal voltage of VDD_SOC sourced from BUCK1 is 0.81V, which is the currently set value. However, BD71837 only guarantees accuracy of ±0.01V, and this still doesn't factor other reasons for actual voltage to slightly drop in, resulting in the possibility of running out of the operational range.
Bump the voltage up to 0.85V, which should give enough headroom.
--- arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi +1 -1
@@ -653,7 +653,7 @@ regulator-ramp-delay = <1250>; rohm,dvs-run-voltage = <900000>; rohm,dvs-idle-voltage = <850000>; - rohm,dvs-suspend-voltage = <810000>; + rohm,dvs-suspend-voltage = <850000>; regulator-always-on; };
Greg Kroah-Hartman
maintainerPATCH 120/589 gfs2: Validate i_depth for exhash directories
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Price <[email protected]>
[ Upstream commit 557c024ca7250bb65ae60f16c02074106c2f197b ]
A fuzzer test introduced corruption that ends up with a depth of 0 in dir_e_read(), causing an undefined shift by 32 at:
index = hash >> (32 - dip->i_depth);
As calculated in an open-coded way in dir_make_exhash(), the minimum depth for an exhash directory is ilog2(sdp->sd_hash_ptrs) and 0 is invalid as sdp->sd_hash_ptrs is fixed as sdp->bsize / 16 at mount time.
So we can avoid the undefined behaviour by checking for depth values lower than the minimum in gfs2_dinode_in(). Values greater than the maximum are already being checked for there.
Also switch the calculation in dir_make_exhash() to use ilog2() to clarify how the depth is calculated.
Tested with the syzkaller repro.c and xfstests '-g quick'.
[ To maintain consistency in error handling in gfs2_dinode_in(), use "goto corrupt" in v5.10. ]
--- fs/gfs2/dir.c | 6 ++---- fs/gfs2/glops.c | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-)
fs/gfs2/dir.c +2 -4
@@ -60,6 +60,7 @@#include <linux/crc32.h> #include <linux/vmalloc.h> #include <linux/bio.h> +#include <linux/log2.h> #include "gfs2.h" #include "incore.h"
@@ -910,7 +911,6 @@ static int dir_make_exhash(struct inodestruct qstr args;struct buffer_head *bh, *dibh;struct gfs2_leaf *leaf; -int y;u32 x;__be64 *lp;u64 bn;
@@ -977,9 +977,7 @@ static int dir_make_exhash(struct inodei_size_write (inode, sdp->sd_sb.sb_bsize /2 );gfs2_add_inode_blocks (&dip->i_inode,1 ); dip->i_diskflags |=GFS2_DIF_EXHASH ; - -for (x = sdp->sd_hash_ptrs, y =-1 ; x; x >>=1 , y++) ; - dip->i_depth = y; + dip->i_depth =ilog2 (sdp->sd_hash_ptrs);gfs2_dinode_out (dip, dibh->b_data);
fs/gfs2/glops.c +4 -0
@@ -11,6 +11,7 @@#include <linux/bio.h> #include <linux/posix_acl.h> #include <linux/security.h> +#include <linux/log2.h> #include "gfs2.h" #include "incore.h"
@@ -452,6 +453,9 @@ static int gfs2_dinode_in(struct gfs2_in depth =be16_to_cpu (str->di_depth);if (unlikely (depth >GFS2_DIR_MAX_DEPTH )) goto corrupt; +if ((ip->i_diskflags &GFS2_DIF_EXHASH ) && + depth <ilog2 (sdp->sd_hash_ptrs)) + goto corrupt; ip->i_depth = (u8 )depth; ip->i_entries =be32_to_cpu (str->di_entries);
Greg Kroah-Hartman
maintainerPATCH 121/589 drm/amd/display: Do not add -mhard-float to calcs, dsc, and dcn30 FP files for clang
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
This patch is for linux-5.10.y only. It is functionally equivalent to upstream commit 7db038d9790e ("drm/amd/display: Do not add '-mhard-float' to dml_ccflags for clang"), which was created after all files that require '-mhard-float' were moved under the dml folder. In linux-5.10.y, which does not contain upstream commits
b4bab46400a0 ("drm/amd/display: move calcs folder into DML") 27e01f10d183 ("drm/amd/display: move FPU associated DSC code to DML folder") 40b31e5355ba ("drm/amd/display: Remove FPU flags from DCN30 Makefile")
clang-21 or newer errors with
clang: error: unsupported option '-mhard-float' for target 'x86_64-pc-linux-gnu'
make[6]: *** [scripts/Makefile.build:286: drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calc_math.o] Error 1
clang: error: unsupported option '-mhard-float' for target 'x86_64-pc-linux-gnu'
make[6]: *** [scripts/Makefile.build:286: drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.o] Error 1
clang: error: unsupported option '-mhard-float' for target 'x86_64-pc-linux-gnu'
make[6]: *** [scripts/Makefile.build:286: drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calc_auto.o] Error 1
clang: error: unsupported option '-mhard-float' for target 'x86_64-pc-linux-gnu'
make[6]: *** [scripts/Makefile.build:286: drivers/gpu/drm/amd/amdgpu/../display/dc/dsc/rc_calc.o] Error 1
clang: error: unsupported option '-mhard-float' for target 'x86_64-pc-linux-gnu'
make[6]: *** [scripts/Makefile.build:286: drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_optc.o] Error 1
clang: error: unsupported option '-mhard-float' for target 'x86_64-pc-linux-gnu'
make[6]: *** [scripts/Makefile.build:286: drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_resource.o] Error 1
Apply a functionally equivalent change to prevent adding '-mhard-float' with clang for these files.
--- drivers/gpu/drm/amd/display/dc/calcs/Makefile | 3 ++- drivers/gpu/drm/amd/display/dc/dcn30/Makefile | 4 ++-- drivers/gpu/drm/amd/display/dc/dsc/Makefile | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/Makefile +2 -1
@@ -26,7 +26,8 @@ # ifdef CONFIG_X86 -calcs_ccflags := -mhard-float -msse +calcs_ccflags-$(CONFIG_CC_IS_GCC) := -mhard-float +calcs_ccflags := $(calcs_ccflags-y) -msse endif ifdef CONFIG_PPC64
drivers/gpu/drm/amd/display/dc/dcn30/Makefile +2 -2
@@ -32,8 +32,8 @@ DCN30 = dcn30_init.o dcn30_hubbub.o dcn3 ifdef CONFIG_X86 -CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse -CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mhard-float -msse +CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := $(if $(CONFIG_CC_IS_GCC),-mhard-float) -msse +CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := $(if $(CONFIG_CC_IS_GCC),-mhard-float) -msse endif ifdef CONFIG_PPC64
drivers/gpu/drm/amd/display/dc/dsc/Makefile +2 -1
@@ -3,7 +3,8 @@ # Makefile for the 'dsc' sub-component of DAL. ifdef CONFIG_X86 -dsc_ccflags := -mhard-float -msse +dsc_ccflags-$(CONFIG_CC_IS_GCC) := -mhard-float +dsc_ccflags := $(dsc_ccflags-y) -msse endif ifdef CONFIG_PPC64
Greg Kroah-Hartman
maintainerPATCH 122/589 scripts/dtc: Remove unused dts_version in dtc-lexer.l
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
This patch is for stable only. Commit 5a09df20872c ("scripts/dtc: Update to upstream version v1.7.2-69-g53373d135579") upstream applied it as part of a regular scripts/dtc sync, which may be unsuitable for older versions of stable where the warning it fixes is present.
A recent strengthening of -Wunused-but-set-variable (enabled with -Wall) in clang under a new subwarning, -Wunused-but-set-global, points out an unused static global variable in dtc-lexer.lex.c (compiled from dtc-lexer.l):
scripts/dtc/dtc-lexer.lex.c:641:12: warning: variable 'dts_version' set but not used [-Wunused-but-set-global]
641 | static int dts_version = 1;
| ^Remove it to clear up the warning, as it is truly unused.
---
This should apply cleanly to all supported stable branches.
--- scripts/dtc/dtc-lexer.l | 3 --- 1 file changed, 3 deletions(-)
scripts/dtc/dtc-lexer.l +0 -3
@@ -39,8 +39,6 @@ extern bool treesource_error; #define DPRINT(fmt, ...) do { } while (0) #endif -static int dts_version = 1; - #define BEGIN_DEFAULT() DPRINT("<V1>\n"); \ BEGIN(V1); \
@@ -101,7 +99,6 @@ static void PRINTF(1, 2) lexical_error(c <*>"/dts-v1/" { DPRINT("Keyword: /dts-v1/\n"); - dts_version = 1; BEGIN_DEFAULT(); return DT_V1; }
Greg Kroah-Hartman
maintainerPATCH 123/589 i3c: fix uninitialized variable use in i2c setup
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamie Iles <[email protected]>
commit 6cbf8b38dfe3aabe330f2c356949bc4d6a1f034f upstream.
Commit 31b9887c7258 ("i3c: remove i2c board info from i2c_dev_desc") removed the boardinfo from i2c_dev_desc to decouple device enumeration from setup but did not correctly lookup the i2c_dev_desc to store the new device, instead dereferencing an uninitialized variable.
Lookup the device that has already been registered by address to store the i2c client device.
--- drivers/i3c/master.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/i3c/master.c +6 -1
@@ -2241,8 +2241,13 @@ static int i3c_master_i2c_adapter_init(s* We silently ignore failures here. The bus should keep working * correctly even if one or more i2c devices are not registered. */ -list_for_each_entry (i2cboardinfo, &master->boardinfo.i2c, node) +list_for_each_entry (i2cboardinfo, &master->boardinfo.i2c, node) { + i2cdev =i3c_master_find_i2c_dev_by_addr (master, + i2cboardinfo->base.addr); +if (WARN_ON (!i2cdev)) +continue ; i2cdev->dev =i2c_new_client_device (adap, &i2cboardinfo->base); + }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 124/589 Revert "scsi: ufs: core: Improve SCSI abort handling"
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
This reverts commit 133811fbc1cc171477281c829eb5fd567f013ba7.
--- drivers/scsi/ufs/ufshcd.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +0 -1
@@ -6788,7 +6788,6 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)__ufshcd_transfer_req_compl (hba, (1UL << tag));spin_unlock_irqrestore (host->host_lock, flags); out: - lrbp->cmd =NULL ; err =SUCCESS ; }else {dev_err (hba->dev,"%s: failed with err %d\n" , __func__, err);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 125/589 rxrpc: Fix recvmsg() unconditional requeue
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 2c28769a51deb6022d7fbd499987e237a01dd63a ]
If rxrpc_recvmsg() fails because MSG_DONTWAIT was specified but the call at the front of the recvmsg queue already has its mutex locked, it requeues the call - whether or not the call is already queued. The call may be on the queue because MSG_PEEK was also passed and so the call was not dequeued or because the I/O thread requeued it.
The unconditional requeue may then corrupt the recvmsg queue, leading to things like UAFs or refcount underruns.
Fix this by only requeuing the call if it isn't already on the queue - and moving it to the front if it is already queued. If we don't queue it, we have to put the ref we obtained by dequeuing it.
Also, MSG_PEEK doesn't dequeue the call so shouldn't call rxrpc_notify_socket() for the call if we didn't use up all the data on the queue, so fix that also.
[Adapted to 5.10: use write_lock_bh/write_unlock_bh, trace_rxrpc_call
directly for see-call tracing, 5.10 trace enum naming convention, and added entries to both plain enum and EM() macro list.]
--- include/trace/events/rxrpc.h | 8 ++++++++ net/rxrpc/recvmsg.c | 22 ++++++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-)
include/trace/events/rxrpc.h +8 -0
@@ -93,9 +93,13 @@ enum rxrpc_call_trace { rxrpc_call_put_notimer, rxrpc_call_put_timer, rxrpc_call_put_userid, + rxrpc_call_put_recvmsg_peek_nowait, rxrpc_call_queued, rxrpc_call_queued_ref, rxrpc_call_release, + rxrpc_call_see_recvmsg_requeue, + rxrpc_call_see_recvmsg_requeue_first, + rxrpc_call_see_recvmsg_requeue_move, rxrpc_call_seen, };
@@ -291,9 +295,13 @@ enum rxrpc_tx_point { EM(rxrpc_call_put_notimer, "PnT") \ EM(rxrpc_call_put_timer, "PTM") \ EM(rxrpc_call_put_userid, "Pus") \ + EM(rxrpc_call_put_recvmsg_peek_nowait, "PpN") \ EM(rxrpc_call_queued, "QUE") \ EM(rxrpc_call_queued_ref, "QUR") \ EM(rxrpc_call_release, "RLS") \ + EM(rxrpc_call_see_recvmsg_requeue, "SrQ") \ + EM(rxrpc_call_see_recvmsg_requeue_first,"SrF") \ + EM(rxrpc_call_see_recvmsg_requeue_move, "SrM") \ E_(rxrpc_call_seen, "SEE")#define rxrpc_transmit_traces \
net/rxrpc/recvmsg.c +18 -4
@@ -607,7 +607,8 @@ int rxrpc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,if (after (call->rx_top, call->rx_hard_ack) && call->rxtx_buffer[(call->rx_hard_ack +1 ) &RXRPC_RXTX_BUFF_MASK ]) -rxrpc_notify_socket (call); +if (!(flags &MSG_PEEK )) +rxrpc_notify_socket (call);break ;default : ret =0 ;
@@ -642,11 +643,24 @@ int rxrpc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, error_requeue_call:if (!(flags &MSG_PEEK )) {write_lock_bh (&rx->recvmsg_lock); -list_add (&call->recvmsg_link, &rx->recvmsg_q); -write_unlock_bh (&rx->recvmsg_lock); +if (list_empty (&call->recvmsg_link)) { +list_add (&call->recvmsg_link, &rx->recvmsg_q); +trace_rxrpc_call (call->debug_id, + rxrpc_call_see_recvmsg_requeue, +refcount_read (&call->ref), +__builtin_return_address (0 ),NULL ); +write_unlock_bh (&rx->recvmsg_lock); + }else if (list_is_first (&call->recvmsg_link, &rx->recvmsg_q)) { +write_unlock_bh (&rx->recvmsg_lock); +rxrpc_put_call (call, rxrpc_call_see_recvmsg_requeue_first); + }else { +list_move (&call->recvmsg_link, &rx->recvmsg_q); +write_unlock_bh (&rx->recvmsg_lock); +rxrpc_put_call (call, rxrpc_call_see_recvmsg_requeue_move); + }trace_rxrpc_recvmsg (call, rxrpc_recvmsg_requeue,0 ,0 ,0 ,0 ); }else { -rxrpc_put_call (call, rxrpc_call_put); +rxrpc_put_call (call, rxrpc_call_put_recvmsg_peek_nowait); } error_no_call:release_sock (&rx->sk);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 126/589 cifs: Fix connections leak when tlink setup failed
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Xiaoxu <[email protected]>
commit 1dcdf5f5b2137185cbdd5385f29949ab3da4f00c upstream.
If the tlink setup failed, lost to put the connections, then the module refcnt leak since the cifsd kthread not exit.
Also leak the fscache info, and for next mount with fsc, it will print the follow errors:
CIFS: Cache volume key already in use (cifs,127.0.0.1:445,TEST)
Let's check the result of tlink setup, and do some cleanup.
[ kovalev: bp to fix CVE-2022-49822; adapted to use direct xid/ses/tcon
variables instead of mnt_ctx struct fields due to the older kernel not having the corresponding cifs_mount() refactoring (see upstream commit c88f7dcd6d64); additionally NULL out mntdata after dfs_cache_add_vol() transfers its ownership to vol_list, otherwise the new error path from mount_setup_tlink() failure would double-free it via kfree(mntdata) in the error: label ]
--- fs/cifs/connect.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
fs/cifs/connect.c +13 -4
@@ -4770,6 +4770,8 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *vol) rc =dfs_cache_add_vol (mntdata, vol, cifs_sb->origin_fullpath);if (rc) goto error; +/* mntdata is now owned by vol_list */ + mntdata =NULL ;/* * After reconnecting to a different server, unique ids won't * match anymore, so we disable serverino. This prevents
@@ -4786,9 +4788,13 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *vol) vol->prepath =NULL ; out: -free_xid (xid);cifs_try_adding_channels (ses); -return mount_setup_tlink (cifs_sb, ses, tcon); + rc =mount_setup_tlink (cifs_sb, ses, tcon); +if (rc) + goto error; + +free_xid (xid); +return rc; error:kfree (ref_path);
@@ -4820,9 +4826,12 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *vol) goto error; } -free_xid (xid); + rc =mount_setup_tlink (cifs_sb, ses, tcon); +if (rc) + goto error; -return mount_setup_tlink (cifs_sb, ses, tcon); +free_xid (xid); +return rc; error:mount_put_conns (cifs_sb, xid, server, ses, tcon);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 127/589 rxrpc: only handle RESPONSE during service challenge
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Jie <[email protected]>
[ Upstream commit c43ffdcfdbb5567b1f143556df8a04b4eeea041c ]
Only process RESPONSE packets while the service connection is still in RXRPC_CONN_SERVICE_CHALLENGING. Check that state under state_lock before running response verification and security initialization, then use a local secured flag to decide whether to queue the secured-connection work after the state transition. This keeps duplicate or late RESPONSE packets from re-running the setup path and removes the unlocked post-transition state test.
--- net/rxrpc/conn_event.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
net/rxrpc/conn_event.c +13 -4
@@ -293,6 +293,7 @@ static int rxrpc_process_event(struct rx u32 *_abort_code) {struct rxrpc_skb_priv *sp =rxrpc_skb (skb); +bool secured = false;__be32 wtmp;u32 abort_code;int loop, ret;
@@ -337,6 +338,13 @@ static int rxrpc_process_event(struct rx _abort_code);case RXRPC_PACKET_TYPE_RESPONSE : +spin_lock_bh (&conn->state_lock); +if (conn->state !=RXRPC_CONN_SERVICE_CHALLENGING ) { +spin_unlock_bh (&conn->state_lock); +return 0 ; + } +spin_unlock_bh (&conn->state_lock); + ret = conn->security->verify_response (conn, skb, _abort_code);if (ret <0 )return ret;
@@ -351,17 +359,18 @@ static int rxrpc_process_event(struct rxspin_lock (&conn->bundle->channel_lock);spin_lock_bh (&conn->state_lock); -if (conn->state ==RXRPC_CONN_SERVICE_CHALLENGING ) { conn->state =RXRPC_CONN_SERVICE ; -spin_unlock_bh (&conn->state_lock); + secured = true; + } +spin_unlock_bh (&conn->state_lock); + +if (secured) {for (loop =0 ; loop <RXRPC_MAXCALLS ; loop++)rxrpc_call_is_secure (rcu_dereference_protected ( conn->channels[loop].call,lockdep_is_held (&conn->bundle->channel_lock))); - }else { -spin_unlock_bh (&conn->state_lock); }spin_unlock (&conn->bundle->channel_lock);
Greg Kroah-Hartman
maintainerPATCH 128/589 rxrpc: Fix anonymous key handling
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 6a59d84b4fc2f27f7b40e348506cc686712e260b ]
In rxrpc_new_client_call_for_sendmsg(), a key with no payload is meant to be substituted for a NULL key pointer, but the variable this is done with is subsequently not used.
Fix this by using "key" rather than "rx->key" when filling in the connection parameters.
Note that this only affects direct use of AF_RXRPC; the kAFS filesystem doesn't use sendmsg() directly and so bypasses the issue. Further, AF_RXRPC passes a NULL key in if no key is set, so using an anonymous key in that manner works. Since this hasn't been noticed to this point, it might be better just to remove the "key" variable and the code that sets it
- and, arguably, rxrpc_init_client_call_security() would be a better place to handle it.
--- net/rxrpc/sendmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rxrpc/sendmsg.c +1 -1
@@ -641,7 +641,7 @@ rxrpc_new_client_call_for_sendmsg(structmemset (&cp,0 ,sizeof (cp)); cp.local = rx->local; - cp.key = rx->key; + cp.key = key; cp.security_level = rx->min_sec_level; cp.exclusive = rx->exclusive | p->exclusive; cp.upgrade = p->upgrade;
Greg Kroah-Hartman
maintainerPATCH 129/589 fuse: reject oversized dirents in page cache
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samuel Page <[email protected]>
commit 51a8de6c50bf947c8f534cd73da4c8f0a13e7bed upstream.
fuse_add_dirent_to_cache() computes a serialized dirent size from the server-controlled namelen field and copies the dirent into a single page-cache page. The existing logic only checks whether the dirent fits in the remaining space of the current page and advances to a fresh page if not. It never checks whether the dirent itself exceeds PAGE_SIZE.
As a result, a malicious FUSE server can return a dirent with namelen=4095, producing a serialized record size of 4120 bytes. On 4 KiB page systems this causes memcpy() to overflow the cache page by 24 bytes into the following kernel page.
Reject dirents that cannot fit in a single page before copying them into the readdir cache.
--- fs/fuse/readdir.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/fuse/readdir.c +4 -0
@@ -41,6 +41,10 @@ static void fuse_add_dirent_to_cache(strunsigned int offset;void *addr; +/* Dirent doesn't fit in readdir cache page? Skip caching. */ +if (reclen >PAGE_SIZE ) +return ; +spin_lock (&fi->rdc.lock);/* * Is cache already completed? Or this entry does not go at the end of
Greg Kroah-Hartman
maintainerPATCH 130/589 fuse: quiet down complaints in fuse_conn_limit_write
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darrick J. Wong <[email protected]>
commit 129a45f9755a89f573c6a513a6b9e3d234ce89b0 upstream.
gcc 15 complains about an uninitialized variable val that is passed by reference into fuse_conn_limit_write:
control.c: In function ‘fuse_conn_congestion_threshold_write’:
include/asm-generic/rwonce.h:55:37: warning: ‘val’ may be used uninitialized [-Wmaybe-uninitialized]
55 | *(volatile typeof(x) *)&(x) = (val); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
include/asm-generic/rwonce.h:61:9: note: in expansion of macro ‘__WRITE_ONCE’
61 | __WRITE_ONCE(x, val); \
| ^~~~~~~~~~~~
control.c:178:9: note: in expansion of macro ‘WRITE_ONCE’
178 | WRITE_ONCE(fc->congestion_threshold, val);
| ^~~~~~~~~~ control.c:166:18: note: ‘val’ was declared here
166 | unsigned val;
| ^~~
Unfortunately there's enough macro spew involved in kstrtoul_from_user that I think gcc gives up on its analysis and sprays the above warning. AFAICT it's not actually a bug, but we could just zero-initialize the variable to enable using -Wmaybe-uninitialized to find real problems.
Previously we would use some weird uninitialized_var annotation to quiet down the warnings, so clearly this code has been like this for quite some time.
--- fs/fuse/control.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/fuse/control.c +2 -2
@@ -120,7 +120,7 @@ static ssize_t fuse_conn_max_background_const char __user *buf, size_t count, loff_t *ppos) { - unsigned val; + unsigned int val = 0;ssize_t ret; ret = fuse_conn_limit_write(file, buf, count, ppos, &val,
@@ -162,7 +162,7 @@ static ssize_t fuse_conn_congestion_threconst char __user *buf, size_t count, loff_t *ppos) { - unsigned val; + unsigned int val = 0;struct fuse_conn *fc;struct fuse_mount *fm;ssize_t ret;
Greg Kroah-Hartman
maintainerPATCH 131/589 ALSA: usb-audio: apply quirk for MOONDROP JU Jiu
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cryolitia PukNgae <[email protected]>
commit 4513d3e0bbc0585b86ccf2631902593ff97e88f5 upstream.
It(ID 31b2:0111 JU Jiu) reports a MIN value -12800 for volume control, but will mute when setting it less than -10880.
Thanks to my girlfriend Kagura for reporting this issue.
--- sound/usb/mixer.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/usb/mixer.c +7 -0
@@ -1199,6 +1199,13 @@ static void volume_control_quirks(struct cval->min =-14208 ;/* Mute under it */ }break ; +case USB_ID (0x31b2 ,0x0111 ):/* MOONDROP JU Jiu */ +if (!strcmp (kctl->id.name,"PCM Playback Volume" )) { +usb_audio_info (chip, +"set volume quirk for MOONDROP JU Jiu\n" ); + cval->min =-10880 ;/* Mute under it */ + } +break ; } }
Greg Kroah-Hartman
maintainerPATCH 132/589 ALSA: caiaq: take a reference on the USB device in create_card()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Berk Cem Goksel <[email protected]>
commit 80bb50e2d459213cccff3111d5ef98ed4238c0d5 upstream.
The caiaq driver stores a pointer to the parent USB device in cdev->chip.dev but never takes a reference on it. The card's private_free callback, snd_usb_caiaq_card_free(), can run asynchronously via snd_card_free_when_closed() after the USB device has already been disconnected and freed, so any access to cdev->chip.dev in that path dereferences a freed usb_device.
On top of the refcounting issue, the current card_free implementation calls usb_reset_device(cdev->chip.dev). A reset in a free callback is inappropriate: the device is going away, the call takes the device lock in a teardown context, and the reset races with the disconnect path that the callback is already cleaning up after.
Take a reference on the USB device in create_card() with usb_get_dev(), drop it with usb_put_dev() in the free callback, and remove the usb_reset_device() call.
--- sound/usb/caiaq/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/usb/caiaq/device.c +2 -2
@@ -398,7 +398,7 @@ static void card_free(struct snd_card *csnd_usb_caiaq_input_free (cdev);#endif snd_usb_caiaq_audio_free (cdev); -usb_reset_device (cdev->chip.dev); +usb_put_dev (cdev->chip.dev); } static int create_card(struct usb_device *usb_dev,
@@ -424,7 +424,7 @@ static int create_card(struct usb_devicereturn err; cdev =caiaqdev (card); - cdev->chip.dev = usb_dev; + cdev->chip.dev =usb_get_dev (usb_dev); cdev->chip.card = card; cdev->chip.usb_id =USB_ID (le16_to_cpu (usb_dev->descriptor.idVendor),le16_to_cpu (usb_dev->descriptor.idProduct));
Greg Kroah-Hartman
maintainerPATCH 133/589 crypto: ccp: Dont attempt to copy CSR to userspace if PSP command failed
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit abe4a6d6f606113251868c2c4a06ba904bb41eed upstream.
When retrieving the PEK CSR, don't attempt to copy the blob to userspace if the firmware command failed. If the failure was due to an invalid length, i.e. the userspace buffer+length was too small, copying the number of bytes _firmware_ requires will overflow the kernel-allocated buffer and leak data to userspace.
BUG: KASAN: slab-out-of-bounds in instrument_copy_to_user ../include/linux/instrumented.h:129 [inline] BUG: KASAN: slab-out-of-bounds in _inline_copy_to_user ../include/linux/uaccess.h:205 [inline] BUG: KASAN: slab-out-of-bounds in _copy_to_user+0x66/0xa0 ../lib/usercopy.c:26 Read of size 2084 at addr ffff898144612e20 by task syz.9.219/21405 CPU: 14 UID: 0 PID: 21405 Comm: syz.9.219 Tainted: G U O 7.0.0-smp-DEV #28 PREEMPTLAZY Tainted: [U]=USER, [O]=OOT_MODULE Hardware name: Google, Inc. Arcadia_IT_80/Arcadia_IT_80, BIOS 12.62.0-0 11/19/2025 Call Trace: <TASK> dump_stack_lvl+0xc5/0x110 ../lib/dump_stack.c:120 print_address_description ../mm/kasan/report.c:378 [inline] print_report+0xbc/0x260 ../mm/kasan/report.c:482 kasan_report+0xa2/0xe0 ../mm/kasan/report.c:595 check_region_inline ../mm/kasan/generic.c:-1 [inline] kasan_check_range+0x264/0x2c0 ../mm/kasan/generic.c:200 instrument_copy_to_user ../include/linux/instrumented.h:129 [inline] _inline_copy_to_user ../include/linux/uaccess.h:205 [inline] _copy_to_user+0x66/0xa0 ../lib/usercopy.c:26 copy_to_user ../include/linux/uaccess.h:236 [inline] sev_ioctl_do_pek_csr+0x31f/0x590 ../drivers/crypto/ccp/sev-dev.c:1872 sev_ioctl+0x3a4/0x490 ../drivers/crypto/ccp/sev-dev.c:2562 vfs_ioctl ../fs/ioctl.c:51 [inline] __do_sys_ioctl ../fs/ioctl.c:597 [inline] __se_sys_ioctl+0x11d/0x1b0 ../fs/ioctl.c:583 do_syscall_x64 ../arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xe0/0x800 ../arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x76/0x7e </TASK>
WARN if the driver says the command succeeded, but the firmware error code says otherwise, as __sev_do_cmd_locked() is expected to return -EIO on any firwmware error.
--- drivers/crypto/ccp/sev-dev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/crypto/ccp/sev-dev.c +7 -1
@@ -458,7 +458,10 @@ cmd: ret =__sev_do_cmd_locked (SEV_CMD_PEK_CSR , &data, &argp->error); -/* If we query the CSR length, FW responded with expected data. */ +/* +* Firmware will returns the length of the CSR blob (either the minimum +* required length or the actual length written), return it to the user. +*/ input.length = data.len;if (copy_to_user ((void __user *)argp->data, &input,sizeof (input))) {
@@ -466,6 +469,9 @@ cmd: goto e_free_blob; } +if (ret ||WARN_ON_ONCE (argp->error)) + goto e_free_blob; +if (blob) {if (copy_to_user (input_address, blob, input.length)) ret = -EFAULT ;
Greg Kroah-Hartman
maintainerPATCH 134/589 crypto: ccp: Dont attempt to copy PDH cert to userspace if PSP command failed
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit e76239fed3cffd6d304d8ca3ce23984fd24f57d3 upstream.
When retrieving the PDH cert, don't attempt to copy the blobs to userspace if the firmware command failed. If the failure was due to an invalid length, i.e. the userspace buffer+length was too small, copying the number of bytes _firmware_ requires will overflow the kernel-allocated buffer and leak data to userspace.
BUG: KASAN: slab-out-of-bounds in instrument_copy_to_user ../include/linux/instrumented.h:129 [inline] BUG: KASAN: slab-out-of-bounds in _inline_copy_to_user ../include/linux/uaccess.h:205 [inline] BUG: KASAN: slab-out-of-bounds in _copy_to_user+0x66/0xa0 ../lib/usercopy.c:26 Read of size 2084 at addr ffff8885c4ab8aa0 by task syz.0.186/21033 CPU: 51 UID: 0 PID: 21033 Comm: syz.0.186 Tainted: G U O 7.0.0-smp-DEV #28 PREEMPTLAZY Tainted: [U]=USER, [O]=OOT_MODULE Hardware name: Google, Inc. Arcadia_IT_80/Arcadia_IT_80, BIOS 34.84.12-0 11/17/2025 Call Trace: <TASK> dump_stack_lvl+0xc5/0x110 ../lib/dump_stack.c:120 print_address_description ../mm/kasan/report.c:378 [inline] print_report+0xbc/0x260 ../mm/kasan/report.c:482 kasan_report+0xa2/0xe0 ../mm/kasan/report.c:595 check_region_inline ../mm/kasan/generic.c:-1 [inline] kasan_check_range+0x264/0x2c0 ../mm/kasan/generic.c:200 instrument_copy_to_user ../include/linux/instrumented.h:129 [inline] _inline_copy_to_user ../include/linux/uaccess.h:205 [inline] _copy_to_user+0x66/0xa0 ../lib/usercopy.c:26 copy_to_user ../include/linux/uaccess.h:236 [inline] sev_ioctl_do_pdh_export+0x3d3/0x7c0 ../drivers/crypto/ccp/sev-dev.c:2347 sev_ioctl+0x2a2/0x490 ../drivers/crypto/ccp/sev-dev.c:2568 vfs_ioctl ../fs/ioctl.c:51 [inline] __do_sys_ioctl ../fs/ioctl.c:597 [inline] __se_sys_ioctl+0x11d/0x1b0 ../fs/ioctl.c:583 do_syscall_x64 ../arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xe0/0x800 ../arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x76/0x7e </TASK>
WARN if the driver says the command succeeded, but the firmware error code says otherwise, as __sev_do_cmd_locked() is expected to return -EIO on any firwmware error.
--- drivers/crypto/ccp/sev-dev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/crypto/ccp/sev-dev.c +7 -1
@@ -817,7 +817,10 @@ static int sev_ioctl_do_pdh_export(struc cmd: ret =__sev_do_cmd_locked (SEV_CMD_PDH_CERT_EXPORT , &data, &argp->error); -/* If we query the length, FW responded with expected data. */ +/* +* Firmware will return the length of the blobs (either the minimum +* required length or the actual length written), return 'em to the user. +*/ input.cert_chain_len = data.cert_chain_len; input.pdh_cert_len = data.pdh_cert_len;
@@ -826,6 +829,9 @@ cmd: goto e_free_cert; } +if (ret ||WARN_ON_ONCE (argp->error)) + goto e_free_cert; +if (pdh_blob) {if (copy_to_user (input_pdh_cert_address, pdh_blob, input.pdh_cert_len)) {
Greg Kroah-Hartman
maintainerPATCH 135/589 crypto: ccp: Dont attempt to copy ID to userspace if PSP command failed
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 4f685dbfa87c546e51d9dc6cab379d20f275e114 upstream.
When retrieving the ID for the CPU, don't attempt to copy the ID blob to userspace if the firmware command failed. If the failure was due to an invalid length, i.e. the userspace buffer+length was too small, copying the number of bytes _firmware_ requires will overflow the kernel-allocated buffer and leak data to userspace.
BUG: KASAN: slab-out-of-bounds in instrument_copy_to_user ../include/linux/instrumented.h:129 [inline] BUG: KASAN: slab-out-of-bounds in _inline_copy_to_user ../include/linux/uaccess.h:205 [inline] BUG: KASAN: slab-out-of-bounds in _copy_to_user+0x66/0xa0 ../lib/usercopy.c:26 Read of size 64 at addr ffff8881867f5960 by task syz.0.906/24388 CPU: 130 UID: 0 PID: 24388 Comm: syz.0.906 Tainted: G U O 7.0.0-smp-DEV #28 PREEMPTLAZY Tainted: [U]=USER, [O]=OOT_MODULE Hardware name: Google, Inc. Arcadia_IT_80/Arcadia_IT_80, BIOS 12.62.0-0 11/19/2025 Call Trace: <TASK> dump_stack_lvl+0xc5/0x110 ../lib/dump_stack.c:120 print_address_description ../mm/kasan/report.c:378 [inline] print_report+0xbc/0x260 ../mm/kasan/report.c:482 kasan_report+0xa2/0xe0 ../mm/kasan/report.c:595 check_region_inline ../mm/kasan/generic.c:-1 [inline] kasan_check_range+0x264/0x2c0 ../mm/kasan/generic.c:200 instrument_copy_to_user ../include/linux/instrumented.h:129 [inline] _inline_copy_to_user ../include/linux/uaccess.h:205 [inline] _copy_to_user+0x66/0xa0 ../lib/usercopy.c:26 copy_to_user ../include/linux/uaccess.h:236 [inline] sev_ioctl_do_get_id2+0x361/0x490 ../drivers/crypto/ccp/sev-dev.c:2222 sev_ioctl+0x25f/0x490 ../drivers/crypto/ccp/sev-dev.c:2575 vfs_ioctl ../fs/ioctl.c:51 [inline] __do_sys_ioctl ../fs/ioctl.c:597 [inline] __se_sys_ioctl+0x11d/0x1b0 ../fs/ioctl.c:583 do_syscall_x64 ../arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xe0/0x800 ../arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x76/0x7e </TASK>
WARN if the driver says the command succeeded, but the firmware error code says otherwise, as __sev_do_cmd_locked() is expected to return -EIO on any firwmware error.
--- drivers/crypto/ccp/sev-dev.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/crypto/ccp/sev-dev.c +3 -0
@@ -703,6 +703,9 @@ static int sev_ioctl_do_get_id2(struct s goto e_free; } +if (ret ||WARN_ON_ONCE (argp->error)) + goto e_free; +if (id_blob) {if (copy_to_user (input_address, id_blob, data.len)) { ret = -EFAULT ;
Greg Kroah-Hartman
maintainerPATCH 136/589 rxrpc: Fix missing validation of ticket length in non-XDR key preparsing
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anderson Nascimento <[email protected]>
commit ac33733b10b484d666f97688561670afd5861383 upstream.
In rxrpc_preparse(), there are two paths for parsing key payloads: the XDR path (for large payloads) and the non-XDR path (for payloads <= 28 bytes). While the XDR path (rxrpc_preparse_xdr_rxkad()) correctly validates the ticket length against AFSTOKEN_RK_TIX_MAX, the non-XDR path fails to do so.
This allows an unprivileged user to provide a very large ticket length. When this key is later read via rxrpc_read(), the total token size (toksize) calculation results in a value that exceeds AFSTOKEN_LENGTH_MAX, triggering a WARN_ON().
[ 2001.302904] WARNING: CPU: 2 PID: 2108 at net/rxrpc/key.c:778 rxrpc_read+0x109/0x5c0 [rxrpc]
Fix this by adding a check in the non-XDR parsing path of rxrpc_preparse() to ensure the ticket length does not exceed AFSTOKEN_RK_TIX_MAX, bringing it into parity with the XDR parsing logic.
--- net/rxrpc/key.c | 4 ++++ 1 file changed, 4 insertions(+)
net/rxrpc/key.c +4 -0
@@ -755,6 +755,10 @@ static int rxrpc_preparse(struct key_preif (v1->security_index !=RXRPC_SECURITY_RXKAD ) goto error; + ret = -EKEYREJECTED ; +if (v1->ticket_length >AFSTOKEN_RK_TIX_MAX ) + goto error; + plen =sizeof (*token->kad) + v1->ticket_length; prep->quotalen += plen +sizeof (*token);
Greg Kroah-Hartman
maintainerPATCH 137/589 ALSA: usb-audio: stop parsing UAC2 rates at MAX_NR_RATES
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
commit 3c318f97dcc50b2e0556a1813bd6958678e881fd upstream.
parse_uac2_sample_rate_range() caps the number of enumerated rates at MAX_NR_RATES, but it only breaks out of the current rate loop. A malformed UAC2 RANGE response with additional triplets continues parsing the remaining triplets and repeatedly prints "invalid uac2 rates" while probe still holds register_mutex.
Stop the whole parse once the cap is reached and return the number of rates collected so far.
--- sound/usb/format.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/format.c +1 -1
@@ -395,7 +395,7 @@ static int parse_uac2_sample_rate_range( nr_rates++;if (nr_rates >=MAX_NR_RATES ) {usb_audio_err (chip,"invalid uac2 rates\n" ); -break ; +return nr_rates; } skip_rate:
Greg Kroah-Hartman
maintainerPATCH 138/589 ALSA: usb-audio: Avoid false E-MU sample-rate notifications
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
commit fca9c850042a7ab4828ce3a9caa8bc40ea09856a upstream.
snd_emuusb_set_samplerate() unconditionally notifies the E-MU SampleRate Extension Unit control after issuing SET_CUR.
If snd_usb_mixer_set_ctl_value() fails, the control value has not changed, yet snd_usb_mixer_notify_id() still invalidates the cache and emits a value-change event to userspace.
Notify the control only after a successful write.
--- sound/usb/mixer_quirks.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
sound/usb/mixer_quirks.c +6 -4
@@ -1420,15 +1420,17 @@ void snd_emuusb_set_samplerate(struct sn {struct usb_mixer_interface *mixer;struct usb_mixer_elem_info *cval; +int err;int unitid =12 ;/* SampleRate ExtensionUnit ID */ list_for_each_entry (mixer, &chip->mixer_list, list) {if (mixer->id_elems[unitid]) { cval =mixer_elem_list_to_info (mixer->id_elems[unitid]); -snd_usb_mixer_set_ctl_value (cval,UAC_SET_CUR , - cval->control <<8 , - samplerate_id); -snd_usb_mixer_notify_id (mixer, unitid); + err =snd_usb_mixer_set_ctl_value (cval,UAC_SET_CUR , + cval->control <<8 , + samplerate_id); +if (!err) +snd_usb_mixer_notify_id (mixer, unitid);break ; } }
Greg Kroah-Hartman
maintainerPATCH 139/589 ALSA: usb-audio: Fix Audio Advantage Micro II SPDIF switch
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
commit a9224f26b754b5034719248891ff3c2ea0d11144 upstream.
snd_microii_spdif_switch_put() returns 0 when the requested vendor register value differs from the cached one.
This comparison was inverted by the resume-support conversion, so real SPDIF switch toggles are ignored while no-op writes still issue SET_CUR and report success.
Return early only when the requested value matches the cached one.
--- sound/usb/mixer_quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/mixer_quirks.c +1 -1
@@ -1925,7 +1925,7 @@ static int snd_microii_spdif_switch_put(int err; reg = ucontrol->value.integer.value[0 ] ?0x28 :0x2a ; -if (reg != list->kctl->private_value) +if (reg == list->kctl->private_value)return 0 ; kcontrol->private_value = reg;
Greg Kroah-Hartman
maintainerPATCH 140/589 usb: xhci: Make usb_host_endpoint.hcpriv survive endpoint_disable()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pecio <[email protected]>
commit 25e531b422dc2ac90cdae3b6e74b5cdeb081440d upstream.
xHCI hardware maintains its endpoint state between add_endpoint() and drop_endpoint() calls followed by successful check_bandwidth(). So does the driver.
Core may call endpoint_disable() during xHCI endpoint life, so don't clear host_ep->hcpriv then, because this breaks endpoint_reset().
If a driver calls usb_set_interface(), submits URBs which make host sequence state non-zero and calls usb_clear_halt(), the device clears its sequence state but xhci_endpoint_reset() bails out. The next URB
malfunctions: USB2 loses one packet, USB3 gets Transaction Error or may not complete at all on some (buggy?) HCs from ASMedia and AMD. This is triggered by uvcvideo on bulk video devices.
The code was copied from ehci_endpoint_disable() but it isn't needed here - hcpriv should only be NULL on emulated root hub endpoints. It might prevent resetting and inadvertently enabling a disabled and dropped endpoint, but core shouldn't try to reset dropped endpoints.
Document xhci requirements regarding hcpriv. They are currently met.
--- drivers/usb/host/xhci.c | 1 - include/linux/usb.h | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/xhci.c +0 -1
@@ -3159,7 +3159,6 @@ rescan:xhci_dbg (xhci,"endpoint disable with ep_state 0x%x\n" , ep->ep_state); done: - host_ep->hcpriv =NULL ;spin_unlock_irqrestore (&xhci->lock, flags); }
include/linux/usb.h +2 -1
@@ -54,7 +54,8 @@ struct ep_device;* @ssp_isoc_ep_comp: SuperSpeedPlus isoc companion descriptor for this endpoint * @urb_list: urbs queued to this endpoint; maintained by usbcore * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) -* with one or more transfer descriptors (TDs) per urb +* with one or more transfer descriptors (TDs) per urb; must be preserved +* by core while BW is allocated for the endpoint * @ep_dev: ep_device for sysfs info * @extra: descriptors following this endpoint in the configuration * @extralen: how many bytes of "extra" are valid
Greg Kroah-Hartman
maintainerPATCH 141/589 misc: ibmasm: fix OOB MMIO read in ibmasm_handle_mouse_interrupt()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tyllis Xu <[email protected]>
commit 4b6e6ead556734bdc14024c5f837132b1e7a4b84 upstream.
ibmasm_handle_mouse_interrupt() performs an out-of-bounds MMIO read when the queue reader or writer index from hardware exceeds REMOTE_QUEUE_SIZE (60).
A compromised service processor can trigger this by writing an out-of-range value to the reader or writer MMIO register before asserting an interrupt. Since writer is re-read from hardware on every loop iteration, it can also be set to an out-of-range value after the loop has already started.
The root cause is that get_queue_reader() and get_queue_writer() return raw readl() values that are passed directly into get_queue_entry(), which computes:
queue_begin + reader * sizeof(struct remote_input)
with no bounds check. This unchecked MMIO address is then passed to memcpy_fromio(), reading 8 bytes from unintended device registers. For sufficiently large values the address falls outside the PCI BAR mapping entirely, triggering a machine check exception.
Fix by checking both indices against REMOTE_QUEUE_SIZE at the top of the loop body, before any call to get_queue_entry(). On an out-of-range value, reset the reader register to 0 via set_queue_reader() before breaking, so that normal queue operation can resume if the corrupted hardware state is transient.
--- drivers/misc/ibmasm/remote.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/misc/ibmasm/remote.c +5 -0
@@ -177,6 +177,11 @@ void ibmasm_handle_mouse_interrupt(struc writer =get_queue_writer (sp);while (reader != writer) { +if (reader >=REMOTE_QUEUE_SIZE || writer >=REMOTE_QUEUE_SIZE ) { +set_queue_reader (sp,0 ); +break ; + } +memcpy_fromio (&input,get_queue_entry (sp, reader),sizeof (struct remote_input ));
Greg Kroah-Hartman
maintainerPATCH 142/589 ibmasm: fix OOB reads in command_file_write due to missing size checks
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tyllis Xu <[email protected]>
commit 0eb09f737428e482a32a2e31e5e223f2b35a71d3 upstream.
The command_file_write() handler allocates a kernel buffer of exactly count bytes and copies user data into it, but does not validate the buffer against the dot command protocol before passing it to get_dot_command_size() and get_dot_command_timeout().
Since both the allocation size (count) and the header fields (command_size, data_size) are independently user-controlled, an attacker can cause get_dot_command_size() to return a value exceeding the allocation, triggering OOB reads in get_dot_command_timeout() and an out-of-bounds memcpy_toio() that leaks kernel heap memory to the service processor.
Fix with two guards: reject writes smaller than sizeof(struct dot_command_header) before allocation, then after copying user data reject commands where the buffer is smaller than the total size declared by the header (sizeof(header) + command_size + data_size). This ensures all subsequent header and payload field accesses stay within the buffer.
--- drivers/misc/ibmasm/ibmasmfs.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/misc/ibmasm/ibmasmfs.c +7 -0
@@ -303,6 +303,8 @@ static ssize_t command_file_write(structreturn -EINVAL ;if (count ==0 || count >IBMASM_CMD_MAX_BUFFER_SIZE )return 0 ; +if (count <sizeof (struct dot_command_header )) +return -EINVAL ;if (*offset !=0 )return 0 ;
@@ -319,6 +321,11 @@ static ssize_t command_file_write(structreturn -EFAULT ; } +if (count <get_dot_command_size (cmd->buffer)) { +command_put (cmd); +return -EINVAL ; + } +spin_lock_irqsave (&command_data->sp->lock, flags);if (command_data->command) {spin_unlock_irqrestore (&command_data->sp->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 143/589 ibmasm: fix heap over-read in ibmasm_send_i2o_message()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tyllis Xu <[email protected]>
commit 9aad71144fa3682cca3837a06c8623016790e7ec upstream.
The ibmasm_send_i2o_message() function uses get_dot_command_size() to compute the byte count for memcpy_toio(), but this value is derived from user-controlled fields in the dot_command_header (command_size: u8,data_size: u16) and is never validated against the actual allocation size. A root user can write a small buffer with inflated header fields, causing memcpy_toio() to read up to ~65 KB past the end of the allocation into adjacent kernel heap, which is then forwarded to the service processor over MMIO.
Silently clamping the copy size is not sufficient: if the header fields claim a larger size than the buffer, the SP receives a dot command whose own header is inconsistent with the I2O message length, which can cause the SP to desynchronize. Reject such commands outright by returning failure.
Validate command_size before calling get_mfa_inbound() to avoid leaking an I2O message frame: reading INBOUND_QUEUE_PORT dequeues a hardware frame from the controller's free pool, and returning without a corresponding set_mfa_inbound() call would permanently exhaust it.
Additionally, clamp command_size to I2O_COMMAND_SIZE before the memcpy_toio() so the MMIO write stays within the I2O message frame, consistent with the clamping already performed by outgoing_message_size() for the header field.
--- drivers/misc/ibmasm/lowlevel.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/misc/ibmasm/lowlevel.c +8 -4
@@ -19,17 +19,21 @@ static struct i2o_header header = I2O_HEint ibmasm_send_i2o_message (struct service_processor *sp) {u32 mfa; -unsigned int command_size; +size_t command_size;struct i2o_message *message;struct command *command = sp->current_command; + command_size =get_dot_command_size (command->buffer); +if (command_size > command->buffer_size) +return 1 ; +if (command_size >I2O_COMMAND_SIZE ) + command_size =I2O_COMMAND_SIZE ; + mfa =get_mfa_inbound (sp->base_address);if (!mfa)return 1 ; - command_size =get_dot_command_size (command->buffer); - header.message_size =outgoing_message_size (command_size); - + header.message_size =outgoing_message_size ((unsigned int )command_size); message =get_i2o_message (sp->base_address, mfa);memcpy_toio (&message->header, &header,sizeof (struct i2o_header ));
Greg Kroah-Hartman
maintainerPATCH 144/589 firmware: google: framebuffer: Do not mark framebuffer as busy
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit f3850d399de3b6142b02315227ef9e772ed0c302 upstream.
Remove the flag IORESOURCE_BUSY flag from coreboot's framebuffer resource. It prevents simpledrm from successfully requesting the range for its own use; resulting in errors such as
[ 2.775430] simple-framebuffer simple-framebuffer.0: [drm] could not acquire memory region [mem 0x80000000-0x80407fff flags 0x80000200]
As with other uses of simple-framebuffer, the simple-framebuffer device should only declare it's I/O resources, but not actively use them.
--- drivers/firmware/google/framebuffer-coreboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/google/framebuffer-coreboot.c +1 -1
@@ -50,7 +50,7 @@ static int framebuffer_probe(struct corereturn -ENODEV ;memset (&res,0 ,sizeof (res)); - res.flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res.flags =IORESOURCE_MEM ; res.name ="Coreboot Framebuffer" ; res.start = fb->physical_address; length =PAGE_ALIGN (fb->y_resolution * fb->bytes_per_line);
Greg Kroah-Hartman
maintainerPATCH 145/589 Revert "riscv: Sparse-Memory/vmemmap out-of-bounds fix"
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
This reverts commit 8af1c121b0102041809bc137ec600d1865eaeedd.
--- arch/riscv/include/asm/pgtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/include/asm/pgtable.h +1 -1
@@ -44,7 +44,7 @@* Define vmemmap for pfn_to_page & page_to_pfn calls. Needed if kernel * is configured with CONFIG_SPARSEMEM_VMEMMAP enabled. */ -#define vmemmap ((struct page *)VMEMMAP_START - (phys_ram_base >> PAGE_SHIFT)) +#define vmemmap ((struct page *)VMEMMAP_START)#define PCI_IO_SIZE SZ_16M#define PCI_IO_END VMEMMAP_START
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 146/589 ocfs2: split transactions in dio completion to avoid credit exhaustion
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heming Zhao <[email protected]>
commit d647c5b2fbf81560818dacade360abc8c00a9665 upstream.
During ocfs2 dio operations, JBD2 may report warnings via following
call trace:ocfs2_dio_end_io_write
ocfs2_mark_extent_written
ocfs2_change_extent_flag
ocfs2_split_extent
ocfs2_try_to_merge_extent
ocfs2_extend_rotate_transaction
ocfs2_extend_trans
jbd2__journal_restart
start_this_handle
output: JBD2: kworker/6:2 wants too many credits credits:5450 rsv_credits:0 max:5449
To prevent exceeding the credits limit, modify ocfs2_dio_end_io_write() to handle extents in a batch of transaction.
Additionally, relocate ocfs2_del_inode_from_orphan(). The orphan inode should only be removed from the orphan list after the extent tree update is complete. This ensures that if a crash occurs in the middle of extent tree updates, we won't leave stale blocks beyond EOF.
This patch also changes the logic for updating the inode size and removing orphan, making it similar to ext4_dio_write_end_io(). Both operations are performed only when everything looks good.
Finally, thanks to Jans and Joseph for providing the bug fix prototype and suggestions.
--- fs/ocfs2/aops.c | 74 ++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 29 deletions(-)
fs/ocfs2/aops.c +45 -29
@@ -39,6 +39,8 @@#include "namei.h" #include "sysfile.h" +#define OCFS2_DIO_MARK_EXTENT_BATCH 200 +static int ocfs2_symlink_get_block (struct inode *inode,sector_t iblock,struct buffer_head *bh_result,int create) {
@@ -2308,7 +2310,7 @@ static int ocfs2_dio_end_io_write(structstruct ocfs2_alloc_context *meta_ac =NULL ;handle_t *handle =NULL ;loff_t end = offset + bytes; -int ret =0 , credits =0 ; +int ret =0 , credits =0 , batch =0 ;ocfs2_init_dealloc_ctxt (&dealloc);
@@ -2325,18 +2327,6 @@ static int ocfs2_dio_end_io_write(struct goto out; } -/* Delete orphan before acquire i_rwsem. */ -if (dwc->dw_orphaned) { -BUG_ON (dwc->dw_writer_pid !=task_pid_nr (current)); - - end = end >i_size_read (inode) ? end :0 ; - - ret =ocfs2_del_inode_from_orphan (osb, inode, di_bh, - !!end, end); -if (ret <0 ) -mlog_errno (ret); - } -down_write (&oi->ip_alloc_sem); di = (struct ocfs2_dinode *)di_bh->b_data;
@@ -2357,24 +2347,25 @@ static int ocfs2_dio_end_io_write(struct credits =ocfs2_calc_extend_credits (inode->i_sb, &di->id2.i_list); - handle =ocfs2_start_trans (osb, credits); -if (IS_ERR (handle)) { - ret =PTR_ERR (handle); -mlog_errno (ret); - goto unlock; - } - ret =ocfs2_journal_access_di (handle,INODE_CACHE (inode), di_bh, -OCFS2_JOURNAL_ACCESS_WRITE ); -if (ret) { -mlog_errno (ret); - goto commit; - } -list_for_each_entry (ue, &dwc->dw_zero_list, ue_node) { +if (!handle) { + handle =ocfs2_start_trans (osb, credits); +if (IS_ERR (handle)) { + ret =PTR_ERR (handle); +mlog_errno (ret); + goto unlock; + } + ret =ocfs2_journal_access_di (handle,INODE_CACHE (inode), di_bh, +OCFS2_JOURNAL_ACCESS_WRITE ); +if (ret) { +mlog_errno (ret); + goto commit; + } + } ret =ocfs2_assure_trans_credits (handle, credits);if (ret <0 ) {mlog_errno (ret); -break ; + goto commit; } ret = ocfs2_mark_extent_written(inode, &et, handle, ue->ue_cpos, 1,
@@ -2382,19 +2373,44 @@ static int ocfs2_dio_end_io_write(struct meta_ac, &dealloc);if (ret <0 ) {mlog_errno (ret); -break ; + goto commit; + } + +if (++batch ==OCFS2_DIO_MARK_EXTENT_BATCH ) { +ocfs2_commit_trans (osb, handle); + handle =NULL ; + batch =0 ; } }if (end >i_size_read (inode)) { +if (!handle) { + handle =ocfs2_start_trans (osb, credits); +if (IS_ERR (handle)) { + ret =PTR_ERR (handle); +mlog_errno (ret); + goto unlock; + } + } ret =ocfs2_set_inode_size (handle, inode, di_bh, end);if (ret <0 )mlog_errno (ret); } + commit: -ocfs2_commit_trans (osb, handle); +if (handle) +ocfs2_commit_trans (osb, handle); unlock:up_write (&oi->ip_alloc_sem); + +/* everything looks good, let's start the cleanup */ +if (!ret && dwc->dw_orphaned) { +BUG_ON (dwc->dw_writer_pid !=task_pid_nr (current)); + + ret =ocfs2_del_inode_from_orphan (osb, inode, di_bh,0 ,0 ); +if (ret <0 ) +mlog_errno (ret); + }ocfs2_inode_unlock (inode,1 );brelse (di_bh); out:
Greg Kroah-Hartman
maintainerPATCH 147/589 padata: Fix pd UAF once and for all
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
[ Upstream commit 71203f68c7749609d7fc8ae6ad054bdedeb24f91 ]
There is a race condition/UAF in padata_reorder that goes back to the initial commit. A reference count is taken at the start of the process in padata_do_parallel, and released at the end in padata_serial_worker.
This reference count is (and only is) required for padata_replace to function correctly. If padata_replace is never called then there is no issue.
In the function padata_reorder which serves as the core of padata, as soon as padata is added to queue->serial.list, and the associated spin lock released, that padata may be processed and the reference count on pd would go away.
Fix this by getting the next padata before the squeue->serial lock is released.
In order to make this possible, simplify padata_reorder by only calling it once the next padata arrives.
[ Adjust context of padata_find_next(). Replace cpumask_next_wrap(cpu, pd->cpumask.pcpu) with cpumask_next_wrap(cpu, pd->cpumask.pcpu, -1, false) in padata_reorder() in v5.10 according to dc5bb9b769c9 ("cpumask: deprecate cpumask_next_wrap()") and f954a2d37637 ("padata: switch padata_find_next() to using cpumask_next_wrap()") . ]
--- include/linux/padata.h | 3 - kernel/padata.c | 136 +++++++++++------------------------------ 2 files changed, 37 insertions(+), 102 deletions(-)
include/linux/padata.h +0 -3
@@ -91,7 +91,6 @@ struct padata_cpumask {* @cpu: Next CPU to be processed. * @cpumask: The cpumasks in use for parallel and serial workers. * @reorder_work: work struct for reordering. -* @lock: Reorder lock. */ struct parallel_data {struct padata_shell *ps;
@@ -102,8 +101,6 @@ struct parallel_data {unsigned int processed;int cpu;struct padata_cpumask cpumask; -struct work_struct reorder_work; -spinlock_t ____cacheline_aligned lock; };/**
kernel/padata.c +37 -99
202 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 148/589 padata: Remove comment for reorder_work
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
[ Upstream commit 82a0302e7167d0b7c6cde56613db3748f8dd806d ]
Remove comment for reorder_work which no longer exists.
--- include/linux/padata.h | 1 - 1 file changed, 1 deletion(-)
include/linux/padata.h +0 -1
@@ -90,7 +90,6 @@ struct padata_cpumask {* @processed: Number of already processed objects. * @cpu: Next CPU to be processed. * @cpumask: The cpumasks in use for parallel and serial workers. -* @reorder_work: work struct for reordering. */ struct parallel_data {struct padata_shell *ps;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 149/589 driver core: Dont let a device probe until its ready
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit a2225b6e834a838ae3c93709760edc0a169eb2f2 ]
The moment we link a "struct device" into the list of devices for the bus, it's possible probe can happen. This is because another thread can load the driver at any time and that can cause the device to probe. This has been seen in practice with a stack crawl that looks like this [1]:
really_probe()
__driver_probe_device()
driver_probe_device()
__driver_attach()
bus_for_each_dev()
driver_attach()
bus_add_driver()
driver_register()
__platform_driver_register()
init_module() [some module]
do_one_initcall()
do_init_module()
load_module()
__arm64_sys_finit_module()
invoke_syscall()
As a result of the above, it was seen that device_links_driver_bound() could be called for the device before "dev->fwnode->dev" was assigned. This prevented __fw_devlink_pickup_dangling_consumers() from being called which meant that other devices waiting on our driver's sub-nodes were stuck deferring forever.
It's believed that this problem is showing up suddenly for two reasons:
1. Android has recently (last ~1 year) implemented an optimization to the order it loads modules [2]. When devices opt-in to this faster loading, modules are loaded one-after-the-other very quickly. This is unlike how other distributions do it. The reproduction of this problem has only been seen on devices that opt-in to Android's "parallel module loading".
2. Android devices typically opt-in to fw_devlink, and the most noticeable issue is the NULL "dev->fwnode->dev" in device_links_driver_bound(). fw_devlink is somewhat new code and also not in use by all Linux devices.
Even though the specific symptom where "dev->fwnode->dev" wasn't assigned could be fixed by moving that assignment higher in device_add(), other parts of device_add() (like the call to device_pm_add()) are also important to run before probe. Only moving the "dev->fwnode->dev" assignment would likely fix the current symptoms but lead to difficult-to-debug problems in the future.
Fix the problem by preventing probe until device_add() has run far enough that the device is ready to probe. If somehow we end up trying to probe before we're allowed, __driver_probe_device() will return -EPROBE_DEFER which will make certain the device is noticed.
In the race condition that was seen with Android's faster module loading, we will temporarily add the device to the deferred list and then take it off immediately when device_add() probes the device.
Instead of adding another flag to the bitfields already in "struct device", instead add a new "flags" field and use that. This allows us to freely change the bit from different thread without worrying about corrupting nearby bits (and means threads changing other bit won't corrupt us).
[1] Captured on a machine running a downstream 6.6 kernel
[2] https://cs.android.com/android/platform/superproject/main/+/main:system/core/libmodprobe/libmodprobe.cpp?q=LoadModulesParallel
--- drivers/base/core.c | 15 ++++++++++++++ drivers/base/dd.c | 12 ++++++++++++ include/linux/device.h | 44 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+)
drivers/base/core.c +15 -0
@@ -3008,6 +3008,21 @@ int device_add(struct device *dev)fw_devlink_link_device (dev); } +/* +* The moment the device was linked into the bus's "klist_devices" in +* bus_add_device() then it's possible that probe could have been +* attempted in a different thread via userspace loading a driver +* matching the device. "ready_to_probe" being unset would have +* blocked those attempts. Now that all of the above initialization has +* happened, unblock probe. If probe happens through another thread +* after this point but before bus_probe_device() runs then it's fine. +* bus_probe_device() -> device_initial_probe() -> __device_attach() +* will notice (under device_lock) that the device is already bound. +*/ +device_lock (dev); +dev_set_ready_to_probe (dev); +device_unlock (dev); +bus_probe_device (dev);if (parent) klist_add_tail(&dev->p->knode_parent,
drivers/base/dd.c +12 -0
@@ -738,6 +738,18 @@ int driver_probe_device(struct device_driver *drv, struct device *dev)if (!device_is_registered (dev))return -ENODEV ; +/* +* In device_add(), the "struct device" gets linked into the subsystem's +* list of devices and broadcast to userspace (via uevent) before we're +* quite ready to probe. Those open pathways to driver probe before +* we've finished enough of device_add() to reliably support probe. +* Detect this and tell other pathways to try again later. device_add() +* itself will also try to probe immediately after setting +* "ready_to_probe". +*/ +if (!dev_ready_to_probe (dev)) +return dev_err_probe (dev, -EPROBE_DEFER ,"Device not ready to probe\n" ); +pr_debug ("bus: '%s': %s: matched device %s with driver %s\n" , drv->bus->name, __func__,dev_name (dev), drv->name);
include/linux/device.h +44 -0
64 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 150/589 um: drivers: call kernel_strrchr() explicitly in cow_user.c
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Bommarito <[email protected]>
commit 91e901c65b4da02a6fd543e3f0049829ae9645b7 upstream.
Building ARCH=um on glibc >= 2.43 fails:
arch/um/drivers/cow_user.c: error: implicit declaration of function 'strrchr' [-Wimplicit-function-declaration]
glibc 2.43's C23 const-preserving strrchr() macro does not survive UML's global -Dstrrchr=kernel_strrchr remap from arch/um/Makefile. Call kernel_strrchr() directly in cow_user.c so the source no longer depends on the -D rewrite.
--- arch/um/drivers/cow_user.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/um/drivers/cow_user.c +7 -1
@@ -15,6 +15,12 @@#include "cow.h" #include "cow_sys.h" +/* +* arch/um/Makefile remaps strrchr to kernel_strrchr; call the kernel +* name directly to avoid glibc >= 2.43's C23 strrchr macro. +*/ +char *kernel_strrchr (const char *,int ); +#define PATH_LEN_V1 256/* unsigned time_t works until year 2106 */
@@ -153,7 +159,7 @@ static int absolutize(char *to, int size errno);return -1 ; } - slash =strrchr (from,'/' ); + slash =kernel_strrchr (from,'/' );if (slash !=NULL ) { *slash ='\0' ;if (chdir (from)) {
Greg Kroah-Hartman
maintainerPATCH 151/589 crypto: pcrypt - Fix handling of MAY_BACKLOG requests
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
commit 915b692e6cb723aac658c25eb82c58fd81235110 upstream.
MAY_BACKLOG requests can return EBUSY. Handle them by checking for that value and filtering out EINPROGRESS notifications.
--- crypto/pcrypt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
crypto/pcrypt.c +5 -2
@@ -69,6 +69,9 @@ static void pcrypt_aead_done(struct crypstruct pcrypt_request *preq =aead_request_ctx (req);struct padata_priv *padata =pcrypt_request_padata (preq); +if (err == -EINPROGRESS ) +return ; + padata->info = err;padata_do_serial (padata);
@@ -82,7 +85,7 @@ static void pcrypt_aead_enc(struct padat ret =crypto_aead_encrypt (req); -if (ret == -EINPROGRESS ) +if (ret == -EINPROGRESS || ret == -EBUSY )return ; padata->info = ret;
@@ -133,7 +136,7 @@ static void pcrypt_aead_dec(struct padat ret =crypto_aead_decrypt (req); -if (ret == -EINPROGRESS ) +if (ret == -EINPROGRESS || ret == -EBUSY )return ; padata->info = ret;
Greg Kroah-Hartman
maintainerPATCH 152/589 ALSA: control: Validate buf_len before strnlen() in snd_ctl_elem_init_enum_names()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ziqing Chen <[email protected]>
commit e0da8a8cac74f4b9f577979d131f0d2b88a84487 upstream.
snd_ctl_elem_init_enum_names() advances pointer p through the names buffer while decrementing buf_len. If buf_len reaches zero but items remain, the next iteration calls strnlen(p, 0).
While strnlen(p, 0) returns 0 and would hit the existing name_len == 0 error path, CONFIG_FORTIFY_SOURCE's fortified strnlen() first checks maxlen against __builtin_dynamic_object_size(). When Clang loses track of p's object size inside the loop, this triggers a BRK exception panic before the return value is examined.
Add a buf_len == 0 guard at the loop entry to prevent calling fortified strnlen() on an exhausted buffer.
Found by kernel fuzz testing through Xiaomi Smartphone.
--- sound/core/control.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/core/control.c +4 -0
@@ -1387,6 +1387,10 @@ static int snd_ctl_elem_init_enum_names( buf_len = ue->info.value.enumerated.names_length; p = names;for (i =0 ; i < ue->info.value.enumerated.items; ++i) { +if (buf_len ==0 ) { +kvfree (names); +return -EINVAL ; + } name_len =strnlen (p, buf_len);if (name_len ==0 || name_len >=64 || name_len == buf_len) {kvfree (names);
Greg Kroah-Hartman
maintainerPATCH 153/589 net: caif: clear client service pointer on teardown
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhengchuan Liang <[email protected]>
commit f7cf8ece8cee3c1ee361991470cdb1eb65ab02e8 upstream.
caif_connect() can tear down an existing client after remote shutdown by calling caif_disconnect_client() followed by caif_free_client(). caif_free_client() releases the service layer referenced by adap_layer->dn, but leaves that pointer stale.
When the socket is later destroyed, caif_sock_destructor() calls caif_free_client() again and dereferences the freed service pointer.
Clear the client/service links before releasing the service object so repeated teardown becomes harmless.
--- net/caif/cfsrvl.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
net/caif/cfsrvl.c +12 -2
@@ -197,10 +197,20 @@ bool cfsrvl_phyid_match(struct cflayer *void caif_free_client (struct cflayer *adap_layer) { +struct cflayer *serv_layer;struct cfsrvl *servl; -if (adap_layer ==NULL || adap_layer->dn ==NULL ) + +if (!adap_layer) +return ; + + serv_layer = adap_layer->dn; +if (!serv_layer)return ; - servl =container_obj (adap_layer->dn); + +layer_set_dn (adap_layer,NULL ); +layer_set_up (serv_layer,NULL ); + + servl =container_obj (serv_layer); servl->release (&servl->layer); }EXPORT_SYMBOL (caif_free_client);
Greg Kroah-Hartman
maintainerPATCH 154/589 net: strparser: fix skb_head leak in strp_abort_strp()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luxiao Xu <[email protected]>
commit fe72340daaf1af588be88056faf98965f39e6032 upstream.
When the stream parser is aborted, for example after a message assembly timeout, it can still hold a reference to a partially assembled message in strp->skb_head.
That skb is not released in strp_abort_strp(), which leaks the partially assembled message and can be triggered repeatedly to exhaust memory.
Fix this by freeing strp->skb_head and resetting the parser state in the abort path. Leave strp_stop() unchanged so final cleanup still happens in strp_done() after the work and timer have been synchronized.
--- net/strparser/strparser.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/strparser/strparser.c +8 -0
@@ -45,6 +45,14 @@ static void strp_abort_strp(struct strpa strp->stopped =1 ; +if (strp->skb_head) { +kfree_skb (strp->skb_head); + strp->skb_head =NULL ; + } + + strp->skb_nextp =NULL ; + strp->need_bytes =0 ; +if (strp->sk) {struct sock *sk = strp->sk;
Greg Kroah-Hartman
maintainerPATCH 155/589 Revert "ALSA: usb: Increase volume range that triggers a warning"
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rong Zhang <[email protected]>
commit 41d78cb724f4b40b7548af420ccfe524b14023bb upstream.
UAC uses 2 bytes to store volume values, so the maximum volume range is 0xFFFF (65535, val = -32768/32767/1).
The reverted commit bumpped the range of triggering the warning to > 65535, effectively making the range check a no-op. It didn't fix anything but covered any potential problems and deviated from the original intention of the range check.
This reverts commit 6b971191fcfc9e3c2c0143eea22534f1f48dbb62.
--- sound/usb/mixer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
sound/usb/mixer.c +4 -3
@@ -1748,10 +1748,11 @@ static void __build_feature_ctl(struct u range = (cval->max - cval->min) / cval->res;/* -* There are definitely devices with a range of ~20,000, so let's be -* conservative and allow for a bit more. +* Are there devices with volume range more than 255? I use a bit more +* to be sure. 384 is a resolution magic number found on Logitech +* devices. It will definitively catch all buggy Logitech devices. */ -if (range >65535 ) { +if (range >384 ) {usb_audio_warn (mixer->chip,"Warning! Unlikely big volume range (=%u), cval->res is probably wrong." , range);
Greg Kroah-Hartman
maintainerPATCH 156/589 lib/ts_kmp: fix integer overflow in pattern length calculation
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Law <[email protected]>
commit 8cdf30813ea8ce881cecc08664144416dbdb3e16 upstream.
The ts_kmp algorithm stores its prefix_tbl[] table and pattern in a single allocation sized from the pattern length. If the prefix_tbl[] size calculation wraps, the resulting allocation can be too small and subsequent pattern copies can overflow it.
Fix this by rejecting zero-length patterns and by using overflow helpers before calculating the combined allocation size.
This fixes a potential heap overflow. The pattern length calculation can wrap during a size_t addition, leading to an undersized allocation. Because the textsearch library is reachable from userspace via Netfilter's xt_string module, this is a security risk that should be backported to LTS kernels.
--- lib/ts_kmp.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
lib/ts_kmp.c +16 -2
@@ -94,8 +94,22 @@ static struct ts_config *kmp_init(conststruct ts_config *conf;struct ts_kmp *kmp;int i; -unsigned int prefix_tbl_len = len *sizeof (unsigned int ); -size_t priv_size =sizeof (*kmp) + len + prefix_tbl_len; +unsigned int prefix_tbl_len; +size_t priv_size; + +/* Zero-length patterns would make kmp_find() read beyond kmp->pattern. */ +if (unlikely (!len)) +return ERR_PTR (-EINVAL ); + +/* +* kmp->pattern is stored immediately after the prefix_tbl[] table. +* Reject lengths that would wrap while sizing either region. +*/ +if (unlikely (check_mul_overflow (len,sizeof (*kmp->prefix_tbl), + &prefix_tbl_len) || +check_add_overflow (sizeof (*kmp), (size_t )len, &priv_size) || +check_add_overflow (priv_size, prefix_tbl_len, &priv_size))) +return ERR_PTR (-EINVAL ); conf =alloc_ts_config (priv_size, gfp_mask);if (IS_ERR (conf))
Greg Kroah-Hartman
maintainerPATCH 157/589 media: i2c: imx219: Check return value of devm_gpiod_get_optional() in imx219_probe()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
commit 943b1f27a3eead21b22e2531a5432ea5910b60eb upstream.
The devm_gpiod_get_optional() function may return an error pointer (ERR_PTR) in case of a genuine failure during GPIO acquisition, not just NULL which indicates the legitimate absence of an optional GPIO.
Add an IS_ERR() check after the function call to catch such errors and propagate them to the probe function, ensuring the driver fails to load safely rather than proceeding with an invalid pointer.
--- drivers/media/i2c/imx219.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/i2c/imx219.c +3 -0
@@ -1420,6 +1420,9 @@ static int imx219_probe(struct i2c_clien/* Request optional enable pin */ imx219->reset_gpio =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_HIGH ); +if (IS_ERR (imx219->reset_gpio)) +return dev_err_probe (dev,PTR_ERR (imx219->reset_gpio), +"failed to get reset gpio\n" );/* * The sensor must be powered for imx219_identify_module()
Greg Kroah-Hartman
maintainerPATCH 158/589 net: qrtr: ns: Fix use-after-free in driver remove()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
commit 7809fea20c9404bfcfa6112ec08d1fe1d3520beb upstream.
In the remove callback, if a packet arrives after destroy_workqueue() is called, but before sock_release(), the qrtr_ns_data_ready() callback will try to queue the work, causing use-after-free issue.
Fix this issue by saving the default 'sk_data_ready' callback during qrtr_ns_init() and use it to replace the qrtr_ns_data_ready() callback at the start of remove(). This ensures that even if a packet arrives after destroy_workqueue(), the work struct will not be dereferenced.
Note that it is also required to ensure that the RX threads are completed before destroying the workqueue, because the threads could be using the qrtr_ns_data_ready() callback.
--- net/qrtr/ns.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
net/qrtr/ns.c +11 -0
@@ -23,6 +23,7 @@ static struct {struct list_head lookups;struct workqueue_struct *workqueue;struct work_struct work; +void (*saved_data_ready)(struct sock *sk);int local_node; } qrtr_ns;
@@ -796,6 +797,7 @@ int qrtr_ns_init(void) goto err_sock; } + qrtr_ns.saved_data_ready = qrtr_ns.sock->sk->sk_data_ready; qrtr_ns.sock->sk->sk_data_ready = qrtr_ns_data_ready; sq.sq_port =QRTR_PORT_CTRL ;
@@ -836,6 +838,10 @@ int qrtr_ns_init(void)return 0 ; err_wq: +write_lock_bh (&qrtr_ns.sock->sk->sk_callback_lock); + qrtr_ns.sock->sk->sk_data_ready = qrtr_ns.saved_data_ready; +write_unlock_bh (&qrtr_ns.sock->sk->sk_callback_lock); +destroy_workqueue (qrtr_ns.workqueue); err_sock:sock_release (qrtr_ns.sock);
@@ -845,7 +851,12 @@ EXPORT_SYMBOL_GPL(qrtr_ns_init);void qrtr_ns_remove (void ) { +write_lock_bh (&qrtr_ns.sock->sk->sk_callback_lock); + qrtr_ns.sock->sk->sk_data_ready = qrtr_ns.saved_data_ready; +write_unlock_bh (&qrtr_ns.sock->sk->sk_callback_lock); +cancel_work_sync (&qrtr_ns.work); +synchronize_net ();destroy_workqueue (qrtr_ns.workqueue);/* sock_release() expects the two references that were put during
Greg Kroah-Hartman
maintainerPATCH 159/589 ext2: reject inodes with zero i_nlink and valid mode in ext2_iget()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasiliy Kovalev <[email protected]>
commit 25947cc5b2374cd5bf627fe3141496444260d04f upstream.
ext2_iget() already rejects inodes with i_nlink == 0 when i_mode is zero or i_dtime is set, treating them as deleted. However, the case of i_nlink == 0 with a non-zero mode and zero dtime slips through. Since ext2 has no orphan list, such a combination can only result from filesystem corruption - a legitimate inode deletion always sets either i_dtime or clears i_mode before freeing the inode.
A crafted image can exploit this gap to present such an inode to the VFS, which then triggers WARN_ON inside drop_nlink() (fs/inode.c) via ext2_unlink(), ext2_rename() and ext2_rmdir():
WARNING: CPU: 3 PID: 609 at fs/inode.c:336 drop_nlink+0xad/0xd0 fs/inode.c:336 CPU: 3 UID: 0 PID: 609 Comm: syz-executor Not tainted 6.12.77+ #1 Call Trace: <TASK> inode_dec_link_count include/linux/fs.h:2518 [inline] ext2_unlink+0x26c/0x300 fs/ext2/namei.c:295 vfs_unlink+0x2fc/0x9b0 fs/namei.c:4477 do_unlinkat+0x53e/0x730 fs/namei.c:4541 __x64_sys_unlink+0xc6/0x110 fs/namei.c:4587 do_syscall_64+0xf5/0x220 arch/x86/entry/common.c:78 entry_SYSCALL_64_after_hwframe+0x77/0x7f </TASK> WARNING: CPU: 0 PID: 646 at fs/inode.c:336 drop_nlink+0xad/0xd0 fs/inode.c:336 CPU: 0 UID: 0 PID: 646 Comm: syz.0.17 Not tainted 6.12.77+ #1 Call Trace: <TASK> inode_dec_link_count include/linux/fs.h:2518 [inline] ext2_rename+0x35e/0x850 fs/ext2/namei.c:374 vfs_rename+0xf2f/0x2060 fs/namei.c:5021 do_renameat2+0xbe2/0xd50 fs/namei.c:5178 __x64_sys_rename+0x7e/0xa0 fs/namei.c:5223 do_syscall_64+0xf5/0x220 arch/x86/entry/common.c:78 entry_SYSCALL_64_after_hwframe+0x77/0x7f </TASK> WARNING: CPU: 0 PID: 634 at fs/inode.c:336 drop_nlink+0xad/0xd0 fs/inode.c:336 CPU: 0 UID: 0 PID: 634 Comm: syz-executor Not tainted 6.12.77+ #1 Call Trace: <TASK> inode_dec_link_count include/linux/fs.h:2518 [inline] ext2_rmdir+0xca/0x110 fs/ext2/namei.c:311 vfs_rmdir+0x204/0x690 fs/namei.c:4348 do_rmdir+0x372/0x3e0 fs/namei.c:4407 __x64_sys_unlinkat+0xf0/0x130 fs/namei.c:4577 do_syscall_64+0xf5/0x220 arch/x86/entry/common.c:78 entry_SYSCALL_64_after_hwframe+0x77/0x7f </TASK>
Extend the existing i_nlink == 0 check to also catch this case, reporting the corruption via ext2_error() and returning -EFSCORRUPTED. This rejects the inode at load time and prevents it from reaching any of the namei.c paths.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- fs/ext2/inode.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
fs/ext2/inode.c +11 -3
@@ -1443,9 +1443,17 @@ struct inode *ext2_iget (struct super_bl* the test is that same one that e2fsck uses * NeilBrown 1999oct15 */ -if (inode->i_nlink ==0 && (inode->i_mode ==0 || ei->i_dtime)) { -/* this inode is deleted */ - ret = -ESTALE ; +if (inode->i_nlink ==0 ) { +if (inode->i_mode ==0 || ei->i_dtime) { +/* this inode is deleted */ + ret = -ESTALE ; + }else { +ext2_error (sb, __func__, +"inode %lu has zero i_nlink with mode 0%o and no dtime, " +"filesystem may be corrupt" , + ino, inode->i_mode); + ret = -EFSCORRUPTED ; + } goto bad_inode; } inode->i_blocks =le32_to_cpu (raw_inode->i_blocks);
Greg Kroah-Hartman
maintainerPATCH 160/589 ALSA: aoa: i2sbus: fix OF node lifetime handling
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
commit 4ec93f070eda6b765b62efcaed9241c3b3b0b6ad upstream.
i2sbus_add_dev() keeps the matched "sound" child pointer after for_each_child_of_node() has dropped the iterator reference. Take an extra reference before saving that node and drop it after the layout-id/device-id lookup is complete.
The function also stores np in dev->sound.ofdev.dev.of_node without taking a reference for the embedded soundbus device. Since i2sbus overrides the embedded platform device release callback, balance that reference explicitly in the local error path and in i2sbus_release_dev().
--- sound/aoa/soundbus/i2sbus/core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
sound/aoa/soundbus/i2sbus/core.c +6 -3
@@ -83,6 +83,7 @@ static void i2sbus_release_dev(struct defor (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++)free_irq (i2sdev->interrupts[i], i2sdev);i2sbus_control_remove_dev (i2sdev->control, i2sdev); +of_node_put (i2sdev->sound.ofdev.dev.of_node);mutex_destroy (&i2sdev->lock);kfree (i2sdev); }
@@ -148,7 +149,6 @@ static int i2sbus_get_and_fixup_rsrc(str }/* Returns 1 if added, 0 for otherwise; don't return a negative value! */ -/* FIXME: look at device node refcounting */ static int i2sbus_add_dev (struct macio_dev *macio,struct i2sbus_control *control,struct device_node *np)
@@ -179,8 +179,9 @@ static int i2sbus_add_dev(struct macio_d i =0 ;for_each_child_of_node (np, child) {if (of_node_name_eq (child,"sound" )) { +of_node_put (sound); i++; - sound = child; + sound =of_node_get (child); } }if (i ==1 ) {
@@ -206,6 +207,7 @@ static int i2sbus_add_dev(struct macio_d } } } +of_node_put (sound);/* for the time being, until we can handle non-layout-id * things in some fabric, refuse to attach if there is no * layout-id property or we haven't been forced to attach.
@@ -220,7 +222,7 @@ static int i2sbus_add_dev(struct macio_dmutex_init (&dev->lock);spin_lock_init (&dev->low_lock); dev->sound.ofdev.archdata.dma_mask = macio->ofdev.archdata.dma_mask; - dev->sound.ofdev.dev.of_node = np; + dev->sound.ofdev.dev.of_node =of_node_get (np); dev->sound.ofdev.dev.dma_mask = &dev->sound.ofdev.archdata.dma_mask; dev->sound.ofdev.dev.parent = &macio->ofdev.dev; dev->sound.ofdev.dev.release = i2sbus_release_dev;
@@ -328,6 +330,7 @@ static int i2sbus_add_dev(struct macio_dfor (i=0 ;i<3 ;i++)release_and_free_resource (dev->allocated_resource[i]);mutex_destroy (&dev->lock); +of_node_put (dev->sound.ofdev.dev.of_node);kfree (dev);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 161/589 ALSA: ctxfi: Add fallback to default RSR for S/PDIF
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harin Lee <[email protected]>
commit 7d61662197ecdc458e33e475b6ada7f6da61d364 upstream.
spdif_passthru_playback_get_resources() uses atc->pll_rate as the RSR for the MSR calculation loop. However, pll_rate is only updated in atc_pll_init() and not in hw_pll_init(), so it remains 0 after the card init.
When spdif_passthru_playback_setup() skips atc_pll_init() for 32000 Hz, (rsr * desc.msr) always becomes 0, causing the loop to spin indefinitely.
Add fallback to use atc->rsr when atc->pll_rate is 0. This reflects the hardware state, since hw_card_init() already configures the PLL to the default RSR.
--- sound/pci/ctxfi/ctatc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/ctxfi/ctatc.c +2 -1
@@ -791,7 +791,8 @@ static int spdif_passthru_playback_get_rstruct src *src;int err;int n_amixer = apcm->substream->runtime->channels, i; -unsigned int pitch, rsr = atc->pll_rate; +unsigned int pitch; +unsigned int rsr = atc->pll_rate ? atc->pll_rate : atc->rsr;/* first release old resources */ atc_pcm_release_resources (atc, apcm);
Greg Kroah-Hartman
maintainerPATCH 162/589 ALSA: seq_oss: return full count for successful SEQ_FULLSIZE writes
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
commit bbc6c0dda54fc0ad8f8aed0b796c23e186e1a188 upstream.
snd_seq_oss_write() currently returns the raw load_patch() callback result for SEQ_FULLSIZE events.
That callback is documented as returning 0 on success and -errno on failure, but snd_seq_oss_write() is the file write path and should report the number of user bytes consumed on success. Some in-tree backends also return backend-specific positive values, which can still be shorter than the original write size.
Return the full byte count for successful SEQ_FULLSIZE writes. Preserve negative errors and convert any nonnegative completion to the original count.
--- sound/core/seq/oss/seq_oss_rw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/core/seq/oss/seq_oss_rw.c +3 -3
@@ -101,9 +101,9 @@ snd_seq_oss_write(struct seq_oss_devinfobreak ; } fmt = (*(unsigned short *)rec.c) &0xffff ; -/* FIXME the return value isn't correct */ -return snd_seq_oss_synth_load_patch (dp, rec.s.dev, - fmt, buf,0 , count); + err =snd_seq_oss_synth_load_patch (dp, rec.s.dev, + fmt, buf,0 , count); +return err <0 ? err : count; }if (ev_is_long (&rec)) {/* extended code */
Greg Kroah-Hartman
maintainerPATCH 163/589 parisc: _llseek syscall is only available for 32-bit userspace
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit da3680f564bd787ce974f9931e6e924d908b3b2a upstream.
--- arch/parisc/kernel/syscalls/syscall.tbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/kernel/syscalls/syscall.tbl +1 -1
@@ -154,7 +154,7 @@ # 137 was afs_syscall 138 common setfsuid sys_setfsuid 139 common setfsgid sys_setfsgid -140 common _llseek sys_llseek +140 32 _llseek sys_llseek 141 common getdents sys_getdents compat_sys_getdents 142 common _newselect sys_select compat_sys_select 143 common flock sys_flock
Greg Kroah-Hartman
maintainerPATCH 164/589 selftests/mqueue: Fix incorrectly named file
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Liebold <[email protected]>
commit 64fac99037689020ad97e472ae898e96ea3616dc upstream.
Commit 85506aca2eb4 ("selftests/mqueue: Set timeout to 180 seconds") intended to increase the timeout for mq_perf_tests from the default kselftest limit of 45 seconds to 180 seconds.
Unfortunately, the file storing this information was incorrectly named setting instead of settings, causing the kselftest runner not to pick up the limit and keep using the default 45 seconds limit.
Fix this by renaming it to settings to ensure that the kselftest runner uses the increased timeout of 180 seconds for this test.
---
tools/testing/selftests/mqueue/{setting => settings} | 0
tools/testing/selftests/mqueue/setting | 1 -
tools/testing/selftests/mqueue/settings | 1 +
2 files changed, 1 insertion(+), 1 deletion(-)
rename tools/testing/selftests/mqueue/{setting => settings} (100%)tools/testing/selftests/mqueue/setting deleted +0 -1
@@ -1 +0,0 @@ -timeout=180
tools/testing/selftests/mqueue/settings new file +1 -0
@@ -0,0 +1 @@ +timeout=180
Greg Kroah-Hartman
maintainerPATCH 165/589 ALSA: caiaq: Fix control_put() result and cache rollback
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
commit a3542d1b30f92307f545f2def14e8d988dffdff0 upstream.
control_put() always returns 1 and updates cdev->control_state[] before sending the USB command. It also ignores transport errors from usb_bulk_msg(), snd_usb_caiaq_send_command(), and snd_usb_caiaq_send_command_bank().
That breaks the ALSA .put() contract and can leave control_get() reporting a cached value the device never accepted.
Return 0 for unchanged values, propagate transport failures, and restore the cached byte when the write fails.
--- sound/usb/caiaq/control.c | 54 +++++++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 17 deletions(-)
sound/usb/caiaq/control.c +37 -17
@@ -87,6 +87,7 @@ static int control_put(struct snd_kcontrstruct snd_usb_caiaqdev *cdev =caiaqdev (chip->card);int pos = kcontrol->private_value;int v = ucontrol->value.integer.value[0 ]; +int ret;unsigned char cmd;switch (cdev->chip.usb_id) {
@@ -103,6 +104,10 @@ static int control_put(struct snd_kcontrif (pos &CNT_INTVAL ) {int i = pos & ~CNT_INTVAL ; +unsigned char old = cdev->control_state[i]; + +if (old == v) +return 0 ; cdev->control_state[i] = v;
@@ -113,10 +118,11 @@ static int control_put(struct snd_kcontr cdev->ep8_out_buf[0 ] = i; cdev->ep8_out_buf[1 ] = v; -usb_bulk_msg (cdev->chip.dev, -usb_sndbulkpipe (cdev->chip.dev,8 ), - cdev->ep8_out_buf,sizeof (cdev->ep8_out_buf), - &actual_len,200 ); + ret =usb_bulk_msg (cdev->chip.dev, +usb_sndbulkpipe (cdev->chip.dev,8 ), + cdev->ep8_out_buf, +sizeof (cdev->ep8_out_buf), + &actual_len,200 ); }else if (cdev->chip.usb_id ==USB_ID (USB_VID_NATIVEINSTRUMENTS ,USB_PID_MASCHINECONTROLLER )) {
@@ -128,21 +134,36 @@ static int control_put(struct snd_kcontr offset =MASCHINE_BANK_SIZE ; } -snd_usb_caiaq_send_command_bank (cdev, cmd, bank, - cdev->control_state + offset, -MASCHINE_BANK_SIZE ); + ret =snd_usb_caiaq_send_command_bank (cdev, cmd, bank, + cdev->control_state + offset, +MASCHINE_BANK_SIZE ); }else { -snd_usb_caiaq_send_command (cdev, cmd, - cdev->control_state,sizeof (cdev->control_state)); + ret =snd_usb_caiaq_send_command (cdev, cmd, + cdev->control_state, +sizeof (cdev->control_state)); } - }else { -if (v) - cdev->control_state[pos /8 ] |=1 << (pos %8 ); -else - cdev->control_state[pos /8 ] &= ~(1 << (pos %8 )); -snd_usb_caiaq_send_command (cdev, cmd, - cdev->control_state,sizeof (cdev->control_state)); +if (ret <0 ) { + cdev->control_state[i] = old; +return ret; + } + }else { +int idx = pos /8 ; +unsigned char mask =1 << (pos %8 ); +unsigned char old = cdev->control_state[idx]; +unsigned char val = v ? (old | mask) : (old & ~mask); + +if (old == val) +return 0 ; + + cdev->control_state[idx] = val; + ret =snd_usb_caiaq_send_command (cdev, cmd, + cdev->control_state, +sizeof (cdev->control_state)); +if (ret <0 ) { + cdev->control_state[idx] = old; +return ret; + } }return 1 ;
@@ -640,4 +661,3 @@ int snd_usb_caiaq_control_init(struct snreturn ret; } -
Greg Kroah-Hartman
maintainerPATCH 166/589 ALSA: caiaq: Handle probe errors properly
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 28abd224db4a49560b452115bca3672a20e45b2f upstream.
The probe procedure of setup_card() in caiaq driver doesn't treat the error cases gracefully, e.g. the error from snd_card_register() calls snd_card_free() but continues. This would lead to a UAF for the further calls like snd_usb_caiaq_control_init(), as Berk suggested in another patch in the link below.
However, the problem is not only that; in general, this function drops the all error handlings (as it's a void function) although its caller can propagate an error to snd_probe(), which eventually calls snd_card_free() as a proper error path. That said, we should treat each error case in setup_card(), and just return the error code promptly, which is then handled later as a fatal error in snd_probe().
This patch achieves it by changing the setup_card() to return an error code. Also, the superfluous snd_card_free() call is removed, too.
Note that card->private_free can be set still safely at returning an error. All called functions in card_free() have checks of the unassigned resources or NULL checks.
--- sound/usb/caiaq/device.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-)
sound/usb/caiaq/device.c +24 -9
@@ -304,7 +304,7 @@ int snd_usb_caiaq_set_auto_msg(struct sn tmp, sizeof(tmp)); } -static void setup_card (struct snd_usb_caiaqdev *cdev) +static int setup_card (struct snd_usb_caiaqdev *cdev) {int ret;char val[4 ];
@@ -339,8 +339,10 @@ static void setup_card(struct snd_usb_casnd_usb_caiaq_send_command (cdev,EP1_CMD_READ_IO ,NULL ,0 );if (!wait_event_timeout (cdev->ep1_wait_queue, - cdev->control_state[0 ] !=0xff ,HZ )) -return ; + cdev->control_state[0 ] !=0xff ,HZ )) { +dev_err (dev,"Read timeout for control state\n" ); +return -EINVAL ; + }/* fix up some defaults */ if ((cdev->control_state[1] != 2) ||
@@ -361,33 +363,43 @@ static void setup_card(struct snd_usb_ca cdev->spec.num_digital_audio_out + cdev->spec.num_digital_audio_in > 0) { ret =snd_usb_caiaq_audio_init (cdev); -if (ret <0 ) +if (ret <0 ) {dev_err (dev,"Unable to set up audio system (ret=%d)\n" , ret); +return ret; + } }if (cdev->spec.num_midi_in + cdev->spec.num_midi_out >0 ) { ret =snd_usb_caiaq_midi_init (cdev); -if (ret <0 ) +if (ret <0 ) {dev_err (dev,"Unable to set up MIDI system (ret=%d)\n" , ret); +return ret; + } }#ifdef CONFIG_SND_USB_CAIAQ_INPUT ret =snd_usb_caiaq_input_init (cdev); -if (ret <0 ) +if (ret <0 ) {dev_err (dev,"Unable to set up input system (ret=%d)\n" , ret); +return ret; + }#endif /* finally, register the card and all its sub-instances */ ret =snd_card_register (cdev->chip.card);if (ret <0 ) {dev_err (dev,"snd_card_register() returned %d\n" , ret); -snd_card_free (cdev->chip.card); +return ret; } ret =snd_usb_caiaq_control_init (cdev); -if (ret <0 ) +if (ret <0 ) {dev_err (dev,"Unable to set up control system (ret=%d)\n" , ret); +return ret; + } + +return 0 ; }static void card_free (struct snd_card *card)
@@ -513,8 +525,11 @@ static int init_card(struct snd_usb_caiasnprintf (card->longname,sizeof (card->longname),"%s %s (%s)" , cdev->vendor_name, cdev->product_name, usbpath); -setup_card (cdev); card->private_free = card_free; + err =setup_card (cdev); +if (err <0 ) +return err; +return 0 ; err_kill_urb:
Greg Kroah-Hartman
maintainerPATCH 167/589 ALSA: 6fire: Fix input volume change detection
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
commit dc88eef8f55e85e92d016cdf7e291f5560efd79b upstream.
usb6fire_control_input_vol_put() stores the analog capture volume as a signed offset in rt->input_vol[] (-15..+15), but it compares the cached value against the user-visible mixer value (0..30) before subtracting 15.
This mixes two domains in the change detection path. Since the runtime is zero-initialized, the visible default is 15; writing 0 right after probe is ignored, while writing 15 is reported as a change even though the cached value remains 0.
Normalize the user value before comparing it with the cached offset.
--- sound/usb/6fire/control.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
sound/usb/6fire/control.c +6 -4
@@ -290,15 +290,17 @@ static int usb6fire_control_input_vol_pu struct snd_ctl_elem_value *ucontrol) {struct control_runtime *rt =snd_kcontrol_chip (kcontrol); +int vol0 = ucontrol->value.integer.value[0 ] -15 ; +int vol1 = ucontrol->value.integer.value[1 ] -15 ;int changed =0 ; -if (rt->input_vol[0 ] != ucontrol->value.integer.value[0 ]) { - rt->input_vol[0 ] = ucontrol->value.integer.value[0 ] -15 ; +if (rt->input_vol[0 ] != vol0) { + rt->input_vol[0 ] = vol0; rt->ivol_updated &= ~(1 <<0 ); changed =1 ; } -if (rt->input_vol[1 ] != ucontrol->value.integer.value[1 ]) { - rt->input_vol[1 ] = ucontrol->value.integer.value[1 ] -15 ; +if (rt->input_vol[1 ] != vol1) { + rt->input_vol[1 ] = vol1; rt->ivol_updated &= ~(1 <<1 ); changed =1 ; }
Greg Kroah-Hartman
maintainerPATCH 168/589 iio: adc: ad7768-1: fix one-shot mode data acquisition
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Santos <[email protected]>
commit 8be19e233744961db6069da9c9ab63eb085a0447 upstream.
According to the datasheet, one-shot mode requires a SYNC_IN pulse to trigger a new sample conversion. In the current implementation, No sync pulse was sent after switching to one-shot mode and reinit_completion() was called before mode switching, creating a race condition where spurious interrupts during mode change could trigger completion prematurely.
Fix by sending a sync pulse after configuring one-shot mode and reinit_completion() to ensure it only waits for the actual conversion completion.
--- drivers/iio/adc/ad7768-1.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/iio/adc/ad7768-1.c +7 -2
@@ -240,12 +240,17 @@ static int ad7768_scan_direct(struct iiostruct ad7768_state *st =iio_priv (indio_dev);int readval, ret; -reinit_completion (&st->completion); - ret =ad7768_set_mode (st,AD7768_ONE_SHOT );if (ret <0 )return ret; +reinit_completion (&st->completion); + +/* One-shot mode requires a SYNC pulse to generate a new sample */ + ret =ad7768_send_sync_pulse (st); +if (ret) +return ret; + ret =wait_for_completion_timeout (&st->completion,msecs_to_jiffies (1000 ));if (!ret)
Greg Kroah-Hartman
maintainerPATCH 169/589 net: rds: fix MR cleanup on copy error
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ao Zhou <[email protected]>
commit 8141a2dc70080eda1aedc0389ed2db2b292af5bd upstream.
__rds_rdma_map() hands sg/pages ownership to the transport after get_mr() succeeds. If copying the generated cookie back to user space fails after that point, the error path must not free those resources again before dropping the MR reference.
Remove the duplicate unpin/free from the put_user() failure branch so that MR teardown is handled only through the existing final cleanup path.
--- net/rds/rdma.c | 4 ---- 1 file changed, 4 deletions(-)
net/rds/rdma.c +0 -4
@@ -326,10 +326,6 @@ static int __rds_rdma_map(struct rds_socif (args->cookie_addr &&put_user (cookie, (u64 __user *)(unsigned long )args->cookie_addr)) { -if (!need_odp) { -unpin_user_pages (pages, nr_pages); -kfree (sg); - } ret = -EFAULT ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 170/589 net/smc: avoid early lgr access in smc_clc_wait_msg
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruijie Li <[email protected]>
commit 5a8db80f721deee8e916c2cfdee78decda02ce4f upstream.
A CLC decline can be received while the handshake is still in an early stage, before the connection has been associated with a link group.
The decline handling in smc_clc_wait_msg() updates link-group level sync state for first-contact declines, but that state only exists after link group setup has completed. Guard the link-group update accordingly and keep the per-socket peer diagnosis handling unchanged.
This preserves the existing sync_err handling for established link-group contexts and avoids touching link-group state before it is available.
--- net/smc/smc_clc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/smc/smc_clc.c +2 -2
@@ -440,8 +440,8 @@ int smc_clc_wait_msg(struct smc_sock *sm dclc = (struct smc_clc_msg_decline *)clcm; reason_code =SMC_CLC_DECL_PEERDECL ; smc->peer_diagnosis =ntohl (dclc->peer_diagnosis); -if (((struct smc_clc_msg_decline *)buf)->hdr.typev2 & -SMC_FIRST_CONTACT_MASK ) { +if ((dclc->hdr.typev2 &SMC_FIRST_CONTACT_MASK ) && + smc->conn.lgr) { smc->conn.lgr->sync_err =1 ;smc_lgr_terminate_sched (smc->conn.lgr); }
Greg Kroah-Hartman
maintainerPATCH 171/589 RDMA/rxe: Validate pad and ICRC before payload_size() in rxe_rcv
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: hkbinbin <[email protected]>
commit 7244491dab347f648e661da96dc0febadd9daec3 upstream.
rxe_rcv() currently checks only that the incoming packet is at least header_size(pkt) bytes long before payload_size() is used.
However, payload_size() subtracts both the attacker-controlled BTH pad field and RXE_ICRC_SIZE from pkt->paylen:
payload_size = pkt->paylen - offset[RXE_PAYLOAD] - bth_pad(pkt)
- RXE_ICRC_SIZE
This means a short packet can still make payload_size() underflow even if it includes enough bytes for the fixed headers. Simply requiring header_size(pkt) + RXE_ICRC_SIZE is not sufficient either, because a packet with a forged non-zero BTH pad can still leave payload_size() negative and pass an underflowed value to later receive-path users.
Fix this by validating pkt->paylen against the full minimum length required by payload_size(): header_size(pkt) + bth_pad(pkt) + RXE_ICRC_SIZE.
--- drivers/infiniband/sw/rxe/rxe_recv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_recv.c +2 -1
@@ -364,7 +364,8 @@ void rxe_rcv(struct sk_buff *skb) pkt->qp =NULL ; pkt->mask |= rxe_opcode[pkt->opcode].mask; -if (unlikely (skb->len <header_size (pkt))) +if (unlikely (pkt->paylen <header_size (pkt) +bth_pad (pkt) + +RXE_ICRC_SIZE )) goto drop; err =hdr_check (pkt);
Greg Kroah-Hartman
maintainerPATCH 172/589 tpm: avoid -Wunused-but-set-variable
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 6f1d4d2ecfcd1b577dc87350ea965fe81f272e83 upstream.
Outside of the EFI tpm code, the TPM_MEMREMAP()/TPM_MEMUNMAP functions are defined as trivial macros, leading to the mapping_size variable ending up unused:
In file included from drivers/char/tpm/tpm-sysfs.c:16:
In file included from drivers/char/tpm/tpm.h:28:include/linux/tpm_eventlog.h:167:6: error: variable 'mapping_size' set but not used [-Werror,-Wunused-but-set-variable]
167 | int mapping_size;
Turn the stubs into inline functions to avoid this warning.
--- include/linux/tpm_eventlog.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
include/linux/tpm_eventlog.h +7 -2
@@ -131,11 +131,16 @@ struct tcg_algorithm_info { };#ifndef TPM_MEMREMAP -#define TPM_MEMREMAP (start, size) NULL +static inline void *TPM_MEMREMAP (unsigned long start,size_t size) +{ +return NULL ; +}#endif #ifndef TPM_MEMUNMAP -#define TPM_MEMUNMAP (start, size) do{} while(0) +static inline void TPM_MEMUNMAP (void *mapping,size_t size) +{ +}#endif /**
Greg Kroah-Hartman
maintainerPATCH 173/589 mmc: block: use single block write in retry
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bin Liu <[email protected]>
commit c7c6d4f5103864f73ee3a78bfd6da241f84197dd upstream.
Due to errata i2493[0], multi-block write would still fail in retries.
With i2493, the MMC interface has the potential of write failures when issuing multi-block writes operating in HS200 mode with excessive IO supply noise.
While the errata provides guidance in hardware design and layout to minimize the IO supply noise, in theory the write failure cannot be resolved in hardware. The software solution to ensure the data integrity is to add minimum 5us delay between block writes. Single-block write is the practical way to introduce the delay.
This patch reuses recovery_mode flag, and switches to single-block write in retry when multi-block write fails. It covers both CQE and non-CQE cases.
[0] https://www.ti.com/lit/pdf/sprz582
--- drivers/mmc/core/block.c | 12 ++++++++++-- drivers/mmc/core/queue.h | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/mmc/core/block.c +10 -2
@@ -1316,6 +1316,9 @@ static void mmc_blk_data_prep(struct mmcrq_data_dir (req) ==WRITE && (md->flags &MMC_BLK_REL_WR ); +if (mqrq->flags &MQRQ_XFER_SINGLE_BLOCK ) + recovery_mode =1 ; +memset (brq,0 ,sizeof (struct mmc_blk_request )); brq->mrq.data = &brq->data;
@@ -1453,10 +1456,13 @@ static void mmc_blk_cqe_complete_rq(stru err =0 ;if (err) { -if (mqrq->retries++ <MMC_CQE_RETRIES ) +if (mqrq->retries++ <MMC_CQE_RETRIES ) { +if (rq_data_dir (req) ==WRITE ) + mqrq->flags |=MQRQ_XFER_SINGLE_BLOCK ;blk_mq_requeue_request (req, true); -else + }else {blk_mq_end_request (req,BLK_STS_IOERR ); + } }else if (mrq->data) {if (blk_update_request (req,BLK_STS_OK , mrq->data->bytes_xfered))blk_mq_requeue_request (req, true);
@@ -1941,6 +1947,8 @@ static void mmc_blk_mq_complete_rq(struc }else if (!blk_rq_bytes (req)) {__blk_mq_end_request (req,BLK_STS_IOERR ); }else if (mqrq->retries++ <MMC_MAX_RETRIES ) { +if (rq_data_dir (req) ==WRITE ) + mqrq->flags |=MQRQ_XFER_SINGLE_BLOCK ;blk_mq_requeue_request (req, true); }else {if (mmc_card_removed (mq->card))
drivers/mmc/core/queue.h +3 -0
@@ -61,6 +61,8 @@ enum mmc_drv_op { MMC_DRV_OP_GET_EXT_CSD, }; +#define MQRQ_XFER_SINGLE_BLOCK BIT(0) +struct mmc_queue_req {struct mmc_blk_request brq;struct scatterlist *sg;
@@ -69,6 +71,7 @@ struct mmc_queue_req {void *drv_op_data;unsigned int ioc_count;int retries; +u32 flags; };struct mmc_queue {
Greg Kroah-Hartman
maintainerPATCH 174/589 tpm: tpm_tis: add error logging for data transfer
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacqueline Wong <[email protected]>
commit 0471921e2d1043dcc6de5cffb49dd37709521abe upstream.
Add logging to more easily determine reason for transmit failure
--- drivers/char/tpm/tpm_tis_core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/char/tpm/tpm_tis_core.c +4 -0
@@ -410,6 +410,8 @@ static int tpm_tis_send_data(struct tpm_ status =tpm_tis_status (chip);if (!itpm && (status &TPM_STS_DATA_EXPECT ) ==0 ) { rc = -EIO ; +dev_err (&chip->dev,"TPM_STS_DATA_EXPECT should be set. sts = 0x%08x\n" , + status); goto out_err; } }
@@ -427,6 +429,8 @@ static int tpm_tis_send_data(struct tpm_ status =tpm_tis_status (chip);if (!itpm && (status &TPM_STS_DATA_EXPECT ) !=0 ) { rc = -EIO ; +dev_err (&chip->dev,"TPM_STS_DATA_EXPECT should be unset. sts = 0x%08x\n" , + status); goto out_err; }
Greg Kroah-Hartman
maintainerPATCH 175/589 userfaultfd: allow registration of ranges below mmap_min_addr
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Denis M. Karpov <[email protected]>
commit 161ce69c2c89781784b945d8e281ff2da9dede9c upstream.
The current implementation of validate_range() in fs/userfaultfd.c performs a hard check against mmap_min_addr. This is redundant because UFFDIO_REGISTER operates on memory ranges that must already be backed by a VMA.
Enforcing mmap_min_addr or capability checks again in userfaultfd is unnecessary and prevents applications like binary compilers from using UFFD for valid memory regions mapped by application.
Remove the redundant check for mmap_min_addr.
We started using UFFD instead of the classic mprotect approach in the binary translator to track application writes. During development, we encountered this bug. The translator cannot control where the translated application chooses to map its memory and if the app requires a low-address area, UFFD fails, whereas mprotect would work just fine. I believe this is a genuine logic bug rather than an improvement, and I would appreciate including the fix in stable.
--- fs/userfaultfd.c | 2 -- 1 file changed, 2 deletions(-)
fs/userfaultfd.c +0 -2
@@ -1233,8 +1233,6 @@ static __always_inline int validate_rangreturn -EINVAL ;if (!len)return -EINVAL ; -if (start < mmap_min_addr) -return -EINVAL ;if (start >= task_size)return -EINVAL ;if (len > task_size - start)
Greg Kroah-Hartman
maintainerPATCH 176/589 KVM: nSVM: Mark all of vmcb02 dirty when restoring nested state
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit e63fb1379f4b9300a44739964e69549bebbcdca4 upstream.
When restoring a vCPU in guest mode, any state restored before KVM_SET_NESTED_STATE (e.g. KVM_SET_SREGS) will mark the corresponding dirty bits in vmcb01, as it is the active VMCB before switching to vmcb02 in svm_set_nested_state().
Hence, mark all fields in vmcb02 dirty in svm_set_nested_state() to capture any previously restored fields.
--- arch/x86/kvm/svm/nested.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/x86/kvm/svm/nested.c +6 -0
@@ -1236,6 +1236,12 @@ static int svm_set_nested_state(struct k goto out_free;/* +* Any previously restored state (e.g. KVM_SET_SREGS) would mark fields +* dirty in vmcb01 instead of vmcb02, so mark all of vmcb02 dirty here. +*/ +vmcb_mark_all_dirty (svm->vmcb); + +/* * All checks done, we can enter guest mode. L1 control fields * come from the nested save state. Guest state is already * in the registers, the save area of the nested state instead
Re: [PATCH 5.10 176/589] KVM: nSVM: Mark all of vmcb02 dirty when restoring nested state
Quoted 4 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
Quoted 8 lines
From: Yosry Ahmed <[email protected]>
commit
e63fb1379f4b9300a44739964e69549bebbcdca4upstream.When restoring a vCPU in guest mode, any state restored before
KVM_SET_NESTED_STATE(e.g.KVM_SET_SREGS) will mark the corresponding dirty bits in vmcb01, as it is the active VMCB before switching to vmcb02 insvm_set_nested_state().
Given thow much svm_set_nested_state() has changed since 5.10, I'm having a hard time seeing how this fix can work here, particularly without commit 4995a3685f1b "KVM: SVM: Use a separate vmcb for the nested L2 guest". Has this been tested on 5.10?
Ben.
Quoted 31 lines
Hence, mark all fields in vmcb02 dirty in
svm_set_nested_state()to capture any previously restored fields.Fixes cc440cdad5b7 ("KVM: nSVM: implement KVM_GET_NESTED_STATE and KVM_SET_NESTED_STATE")Signed-off-by Yosry Ahmed <[email protected]>Signed-off-by Sean Christopherson <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/x86/kvm/svm/nested.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/x86/kvm/svm/nested.c +6
-0@@ -1236,6 +1236,12 @@ static int svm_set_nested_state(struct k goto out_free;/* +* Any previously restored state (e.g. KVM_SET_SREGS) would mark fields +* dirty in vmcb01 instead of vmcb02, so mark all of vmcb02 dirty here. +*/ +vmcb_mark_all_dirty (svm->vmcb); + +/* * All checks done, we can enter guest mode. L1 control fields * come from the nested save state. Guest state is already * in the registers, the save area of the nested state instead
Signature · 3 lines
Ben Hutchings Time is nature's way of making sure that everything doesn't happen at once.
Sasha Levin
maintainerRe: [PATCH 5.10 176/589] KVM: nSVM: Mark all of vmcb02 dirty when restoring nested state
Quoted 4 lines · Ben Hutchings
Given thow much
svm_set_nested_state()has changed since 5.10, I'm having a hard time seeing how this fix can work here, particularly without commit4995a3685f1b"KVM: SVM: Use a separate vmcb for the nested L2 guest". Has this been tested on 5.10?
I've dropped it from the 5.10 queue. 5.15 and 6.1 have the prerequisite and apply the fix correctly, so they're kept. Thanks for the review.
--
Thanks,
Sasha
Greg Kroah-Hartman
maintainerPATCH 177/589 KVM: nSVM: Sync NextRIP to cached vmcb12 after VMRUN of L2
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit 778d8c1b2a6ffe622ddcd3bb35b620e6e41f4da0 upstream.
After VMRUN in guest mode, nested_sync_control_from_vmcb02() syncs fields written by the CPU from vmcb02 to the cached vmcb12. This is because the cached vmcb12 is used as the authoritative copy of some of the controls, and is the payload when saving/restoring nested state.
NextRIP is also written by the CPU (in some cases) after VMRUN, but is not sync'd to the cached vmcb12. As a result, it is corrupted after save/restore (replaced by the original value written by L1 on nested VMRUN). This could cause problems for both KVM (e.g. when injecting a soft IRQ) or L1 (e.g. when using NextRIP to advance RIP after emulating an instruction).
Fix this by sync'ing NextRIP to the cache after VMRUN of L2, but only after completing interrupts (not in nested_sync_control_from_vmcb02()), as KVM may update NextRIP (e.g. when re-injecting a soft IRQ).
--- arch/x86/kvm/svm/svm.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/x86/kvm/svm/svm.c +10 -0
@@ -3677,6 +3677,16 @@ static __no_kcsan fastpath_t svm_vcpu_ruif (is_guest_mode (vcpu))return EXIT_FASTPATH_NONE ; +/* +* Update the cache after completing interrupts to get an accurate +* NextRIP, e.g. when re-injecting a soft interrupt. +* +* FIXME: Rework svm_get_nested_state() to not pull data from the +* cache (except for maybe int_ctl). +*/ +if (is_guest_mode (vcpu)) + svm->nested.ctl.next_rip = svm->vmcb->control.next_rip; +return svm_exit_handlers_fastpath (vcpu); }
Re: [PATCH 5.10 177/589] KVM: nSVM: Sync NextRIP to cached vmcb12 after VMRUN of L2
Quoted 40 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit
778d8c1b2a6ffe622ddcd3bb35b620e6e41f4da0upstream.After VMRUN in guest mode,
nested_sync_control_from_vmcb02()syncs fields written by the CPU from vmcb02 to the cached vmcb12. This is because the cached vmcb12 is used as the authoritative copy of some of the controls, and is the payload when saving/restoring nested state.NextRIP is also written by the CPU (in some cases) after VMRUN, but is not sync'd to the cached vmcb12. As a result, it is corrupted after save/restore (replaced by the original value written by L1 on nested VMRUN). This could cause problems for both KVM (e.g. when injecting a soft IRQ) or L1 (e.g. when using NextRIP to advance RIP after emulating an instruction).
Fix this by sync'ing NextRIP to the cache after VMRUN of L2, but only after completing interrupts (not in
nested_sync_control_from_vmcb02()), as KVM may update NextRIP (e.g. when re-injecting a soft IRQ).Fixes cc440cdad5b7 ("KVM: nSVM: implement KVM_GET_NESTED_STATE and KVM_SET_NESTED_STATE")Co-developed-by Sean Christopherson <[email protected]>Signed-off-by Yosry Ahmed <[email protected]>Signed-off-by Sean Christopherson <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/x86/kvm/svm/svm.c | 10 ++++++++++ 1 file changed, 10 insertions(+)arch/x86/kvm/svm/svm.c +0
-0@@ -3677,6 +3677,16 @@ static __no_kcsan fastpath_t svm_vcpu_ruif (is_guest_mode (vcpu))return EXIT_FASTPATH_NONE ;
arch/x86/kvm/svm/svm.c static __no_kcsan fastpath_t svm_vcpu_ru · line 3688
Quoted 10 lines
arch/x86/kvm/svm/svm.c +9
-0+/* +* Update the cache after completing interrupts to get an accurate +* NextRIP, e.g. when re-injecting a soft interrupt. +* +* FIXME: Rework svm_get_nested_state() to not pull data from the +* cache (except for maybe int_ctl). +*/ +if (is_guest_mode (vcpu)) + svm->nested.ctl.next_rip = svm->vmcb->control.next_rip;
I don't know whether this assignment would be a correct fix for 5.10, but in this version it is unreachable because of the previous if- statement.
Ben.
Quoted 6 lines
arch/x86/kvm/svm/svm.c +1
-0+return svm_exit_handlers_fastpath (vcpu); }
Signature · 3 lines
Ben Hutchings Time is nature's way of making sure that everything doesn't happen at once.
Sasha Levin
maintainerRe: [PATCH 5.10 177/589] KVM: nSVM: Sync NextRIP to cached vmcb12 after VMRUN of L2
Quoted 2 lines · Ben Hutchings
arch/x86/kvm/svm/svm.c static __no_kcsan fastpath_t svm_vcpu_ru · line 3688
Quoted 2 lines
arch/x86/kvm/svm/svm.c +2
-0+if (is_guest_mode (vcpu)) + svm->nested.ctl.next_rip = svm->vmcb->control.next_rip;
I've dropped it from the 5.10 and 5.15 queues. The 6.1 backport places the assignment after svm_complete_interrupts() with no preceding guest-mode early return, so it's reachable and correct there.
--
Thanks,
Sasha
Greg Kroah-Hartman
maintainerPATCH 178/589 KVM: nSVM: Sync interrupt shadow to cached vmcb12 after VMRUN of L2
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit 03bee264f8ebfd39e0254c98e112d033a7aa9055 upstream.
After VMRUN in guest mode, nested_sync_control_from_vmcb02() syncs fields written by the CPU from vmcb02 to the cached vmcb12. This is because the cached vmcb12 is used as the authoritative copy of some of the controls, and is the payload when saving/restoring nested state.
int_state is also written by the CPU, specifically bit 0 (i.e. SVM_INTERRUPT_SHADOW_MASK) for nested VMs, but it is not sync'd to cached vmcb12. This does not cause a problem if KVM_SET_NESTED_STATE preceeds KVM_SET_VCPU_EVENTS in the restore path, as an interrupt shadow would be correctly restored to vmcb02 (KVM_SET_VCPU_EVENTS overwrites what KVM_SET_NESTED_STATE restored in int_state).
However, if KVM_SET_VCPU_EVENTS preceeds KVM_SET_NESTED_STATE, an interrupt shadow would be restored into vmcb01 instead of vmcb02. This would mostly be benign for L1 (delays an interrupt), but not for L2. For L2, the vCPU could hang (e.g. if a wakeup interrupt is delivered before a HLT that should have been in an interrupt shadow).
Sync int_state to the cached vmcb12 in nested_sync_control_from_vmcb02() to avoid this problem. With that, KVM_SET_NESTED_STATE restores the correct interrupt shadow state, and if KVM_SET_VCPU_EVENTS follows it would overwrite it with the same value.
--- arch/x86/kvm/svm/nested.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kvm/svm/nested.c +1 -0
@@ -308,6 +308,7 @@ void sync_nested_vmcb_control(struct vcpu32 mask; svm->nested.ctl.event_inj = svm->vmcb->control.event_inj; svm->nested.ctl.event_inj_err = svm->vmcb->control.event_inj_err; + svm->nested.ctl.int_state = svm->vmcb->control.int_state;/* Only a few fields of int_ctl are written by the processor. */ mask =V_IRQ_MASK |V_TPR_MASK ;
Greg Kroah-Hartman
maintainerPATCH 179/589 KVM: nSVM: Ensure AVIC is inhibited when restoring a vCPU to guest mode
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit 24f7d36b824b65cf1a2db3db478059187b2a37b0 upstream.
On nested VMRUN, KVM ensures AVIC is inhibited by requesting KVM_REQ_APICV_UPDATE, triggering a check of inhibit reasons, finding APICV_INHIBIT_REASON_NESTED, and disabling AVIC.
However, when KVM_SET_NESTED_STATE is performed on a vCPU not in guest mode with AVIC enabled, KVM_REQ_APICV_UPDATE is not requested, and AVIC is not inhibited.
Request KVM_REQ_APICV_UPDATE in the KVM_SET_NESTED_STATE path if AVIC is active, similar to the nested VMRUN path.
--- arch/x86/kvm/svm/nested.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kvm/svm/nested.c +3 -0
@@ -1258,6 +1258,9 @@ static int svm_set_nested_state(struct kload_nested_vmcb_control (svm, ctl);nested_prepare_vmcb_control (svm); +if (kvm_vcpu_apicv_active (vcpu)) +kvm_make_request (KVM_REQ_APICV_UPDATE , vcpu); +kvm_make_request (KVM_REQ_GET_NESTED_STATE_PAGES , vcpu); ret =0 ; out_free:
Greg Kroah-Hartman
maintainerPATCH 180/589 KVM: nSVM: Clear GIF on nested #VMEXIT(INVALID)
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit f85a6ce06e4a0d49652f57967a649ab09e06287c upstream.
According to the APM, GIF is set to 0 on any #VMEXIT, including an #VMEXIT(INVALID) due to failed consistency checks. Clear GIF on consistency check failures.
--- arch/x86/kvm/svm/nested.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kvm/svm/nested.c +1 -0
@@ -532,6 +532,7 @@ int nested_svm_vmrun(struct vcpu_svm *sv vmcb12->control.exit_code_hi =-1u ; vmcb12->control.exit_info_1 =0 ; vmcb12->control.exit_info_2 =0 ; +svm_set_gif (svm, false); goto out; }
Greg Kroah-Hartman
maintainerPATCH 181/589 io_uring/poll: fix EPOLL_URING_WAKE sometimes not being honored
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
Rather than do the masking only when we jump straight to execution, mark it as EPOLLONESHOT regardless. This ensures it doesn't get lost. And just kill the poll entry upfront, if marked. This is an optimization in later kernels, but it's actually required on the older kernels to note the EPOLL_URING_WAKE mask correctly.
--- io_uring/io_uring.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
io_uring/io_uring.c +12 -7
@@ -5647,14 +5647,19 @@ static int io_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,if (mask && !(mask & poll->events))return 0 ; +/* +* If we trigger a multishot poll off our own wakeup path, +* disable multishot as there is a circular dependency between +* CQ posting and triggering the event. +*/ +if (mask &EPOLL_URING_WAKE ) + poll->events |=EPOLLONESHOT ; +if (io_poll_get_ownership (req)) { -/* -* If we trigger a multishot poll off our own wakeup path, -* disable multishot as there is a circular dependency between -* CQ posting and triggering the event. -*/ -if (mask &EPOLL_URING_WAKE ) - poll->events |=EPOLLONESHOT ; +if (mask && poll->events &EPOLLONESHOT ) { +list_del_init (&poll->wait.entry); +smp_store_release (&poll->head,NULL ); + }__io_poll_execute (req, mask); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 182/589 io_uring/poll: fix backport of io_poll_add() changes
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
The 5.15/5.10 backport of 84230ad2d2af had a few issues, due to the older poll base. Notably return value handling __io_arm_poll_handler() and in return __io_poll_add() as well. Fix them up.
--- io_uring/io_uring.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
io_uring/io_uring.c +6 -10
@@ -5997,26 +5997,22 @@ static int __io_poll_add(struct io_kiocb *req, unsigned int issue_flags)if (!ret && ipt.error)req_set_fail (req); ret = ret ?: ipt.error; -if (ret >0 ) { +if (ret)__io_req_complete (req, issue_flags, ret,0 ); -return ret; - } -return 0 ; +return ret; }static int io_poll_add (struct io_kiocb *req,unsigned int issue_flags) { -int ret; - - ret =__io_poll_add (req, issue_flags); -return ret <0 ? ret :0 ; +__io_poll_add (req, issue_flags); +return 0 ; }static int io_poll_update (struct io_kiocb *req,unsigned int issue_flags) {struct io_ring_ctx *ctx = req->ctx;struct io_kiocb *preq; -int ret2, ret =0 ; +int ret2 = -ECANCELED , ret =0 ;io_ring_submit_lock (ctx, !(issue_flags &IO_URING_F_NONBLOCK ));
@@ -6047,7 +6043,7 @@ static int io_poll_update(struct io_kiocb *req, unsigned int issue_flags) preq->result = ret2; } -if (preq->result <0 ) +if (ret2 <0 )req_set_fail (preq);io_req_complete (preq, preq->result); out:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 183/589 mtd: docg3: fix use-after-free in docg3_release()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Kim <[email protected]>
[ Upstream commit ca19808bc6fac7e29420d8508df569b346b3e339 ]
In docg3_release(), the docg3 pointer is obtained from cascade->floors[0]->priv before the loop that calls doc_release_device() on each floor. doc_release_device() frees the docg3 struct via kfree(docg3) at line 1881. After the loop, docg3->cascade->bch dereferences the already-freed pointer.
Fix this by accessing cascade->bch directly, which is equivalent since docg3->cascade points back to the same cascade struct, and is already available as a local variable. This also removes the now-unused docg3 local variable.
--- drivers/mtd/devices/docg3.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/devices/docg3.c +1 -2
@@ -2042,7 +2042,6 @@ static int __init docg3_probe(struct platform_device *pdev)static int docg3_release (struct platform_device *pdev) {struct docg3_cascade *cascade =platform_get_drvdata (pdev); -struct docg3 *docg3 = cascade->floors[0 ]->priv;int floor;doc_unregister_sysfs (pdev, cascade);
@@ -2050,7 +2049,7 @@ static int docg3_release(struct platform_device *pdev)if (cascade->floors[floor])doc_release_device (cascade->floors[floor]); -bch_free (docg3->cascade->bch); +bch_free (cascade->bch);return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 184/589 ext4: fix missing brelse() in ext4_xattr_inode_dec_ref_all()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sohei Koyama <[email protected]>
commit 77d059519382bd66283e6a4e83ee186e87e7708f upstream.
The commit c8e008b60492 ("ext4: ignore xattrs past end") introduced a refcount leak in when block_csum is false.
ext4_xattr_inode_dec_ref_all() calls ext4_get_inode_loc() to get iloc.bh, but never releases it with brelse().
--- fs/ext4/xattr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/xattr.c +3 -1
@@ -1108,7 +1108,7 @@ ext4_xattr_inode_dec_ref_all(handle_t *h {struct inode *ea_inode;struct ext4_xattr_entry *entry; -struct ext4_iloc iloc; +struct ext4_iloc iloc = { .bh =NULL };bool dirty = false;unsigned int ea_ino;int err;
@@ -1202,6 +1202,8 @@ ext4_xattr_inode_dec_ref_all(handle_t *hext4_warning_inode (parent,"handle dirty metadata err=%d" , err); } + +brelse (iloc.bh); }/*
Greg Kroah-Hartman
maintainerPATCH 185/589 md/raid5: fix soft lockup in retry_aligned_read()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chia-Ming Chang <[email protected]>
commit 7f9f7c697474268d9ef9479df3ddfe7cdcfbbffc upstream.
When retry_aligned_read() encounters an overlapped stripe, it releases the stripe via raid5_release_stripe() which puts it on the lockless released_stripes llist. In the next raid5d loop iteration, release_stripe_list() drains the stripe onto handle_list (since STRIPE_HANDLE is set by the original IO), but retry_aligned_read() runs before handle_active_stripes() and removes the stripe from handle_list via find_get_stripe() -> list_del_init(). This prevents handle_stripe() from ever processing the stripe to resolve the overlap, causing an infinite loop and soft lockup.
Fix this by using __release_stripe() with temp_inactive_list instead of raid5_release_stripe() in the failure path, so the stripe does not go through the released_stripes llist. This allows raid5d to break out of its loop, and the overlap will be resolved when the stripe is eventually processed by handle_stripe().
--- drivers/md/raid5.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/md/raid5.c +7 -1
@@ -6349,7 +6349,13 @@ static int retry_aligned_read(struct r5 }if (!add_stripe_bio (sh, raid_bio, dd_idx,0 ,0 )) { -raid5_release_stripe (sh); +int hash; + +spin_lock_irq (&conf->device_lock); + hash = sh->hash_lock_index; +__release_stripe (conf, sh, + &conf->temp_inactive_list[hash]); +spin_unlock_irq (&conf->device_lock); conf->retry_read_aligned = raid_bio; conf->retry_read_offset = scnt;return handled;
Greg Kroah-Hartman
maintainerPATCH 186/589 md/raid5: validate payload size before accessing journal metadata
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junrui Luo <[email protected]>
commit b0cc3ae97e893bf54bbce447f4e9fd2e0b88bff9 upstream.
r5c_recovery_analyze_meta_block() and r5l_recovery_verify_data_checksum_for_mb() iterate over payloads in a journal metadata block using on-disk payload size fields without validating them against the remaining space in the metadata block.
A corrupted journal contains payload sizes extending beyond the PAGE_SIZE boundary can cause out-of-bounds reads when accessing payload fields or computing offsets.
Add bounds validation for each payload type to ensure the full payload fits within meta_size before processing.
--- drivers/md/raid5-cache.c | 48 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 15 deletions(-)
drivers/md/raid5-cache.c +33 -15
@@ -2017,15 +2017,27 @@ r5l_recovery_verify_data_checksum_for_mbreturn -ENOMEM ;while (mb_offset <le32_to_cpu (mb->meta_size)) { +sector_t payload_len; + payload = (void *)mb + mb_offset; payload_flush = (void *)mb + mb_offset;if (le16_to_cpu (payload->header.type) ==R5LOG_PAYLOAD_DATA ) { + payload_len =sizeof (struct r5l_payload_data_parity ) + + (sector_t )sizeof (__le32) * + (le32_to_cpu (payload->size) >> (PAGE_SHIFT -9 )); +if (mb_offset + payload_len >le32_to_cpu (mb->meta_size)) + goto mismatch;if (r5l_recovery_verify_data_checksum ( log, ctx, page, log_offset, payload->checksum[0 ]) <0 ) goto mismatch; }else if (le16_to_cpu (payload->header.type) ==R5LOG_PAYLOAD_PARITY ) { + payload_len =sizeof (struct r5l_payload_data_parity ) + + (sector_t )sizeof (__le32) * + (le32_to_cpu (payload->size) >> (PAGE_SHIFT -9 )); +if (mb_offset + payload_len >le32_to_cpu (mb->meta_size)) + goto mismatch;if (r5l_recovery_verify_data_checksum ( log, ctx, page, log_offset, payload->checksum[0 ]) <0 )
@@ -2038,22 +2050,18 @@ r5l_recovery_verify_data_checksum_for_mb payload->checksum[1]) < 0) goto mismatch; }else if (le16_to_cpu (payload->header.type) ==R5LOG_PAYLOAD_FLUSH ) { -/* nothing to do for R5LOG_PAYLOAD_FLUSH here */ + payload_len =sizeof (struct r5l_payload_flush ) + + (sector_t )le32_to_cpu (payload_flush->size); +if (mb_offset + payload_len >le32_to_cpu (mb->meta_size)) + goto mismatch; }else /* not R5LOG_PAYLOAD_DATA/PARITY/FLUSH */ goto mismatch; -if (le16_to_cpu (payload->header.type) ==R5LOG_PAYLOAD_FLUSH ) { - mb_offset +=sizeof (struct r5l_payload_flush ) + -le32_to_cpu (payload_flush->size); - }else { -/* DATA or PARITY payload */ +if (le16_to_cpu (payload->header.type) !=R5LOG_PAYLOAD_FLUSH ) { log_offset =r5l_ring_add (log, log_offset,le32_to_cpu (payload->size)); - mb_offset +=sizeof (struct r5l_payload_data_parity ) + -sizeof (__le32) * - (le32_to_cpu (payload->size) >> (PAGE_SHIFT -9 )); } - + mb_offset += payload_len; }put_page (page);
@@ -2104,6 +2112,7 @@ r5c_recovery_analyze_meta_block(struct r log_offset =r5l_ring_add (log, ctx->pos,BLOCK_SECTORS );while (mb_offset <le32_to_cpu (mb->meta_size)) { +sector_t payload_len;int dd; payload = (void *)mb + mb_offset;
@@ -2112,6 +2121,12 @@ r5c_recovery_analyze_meta_block(struct rif (le16_to_cpu (payload->header.type) ==R5LOG_PAYLOAD_FLUSH ) {int i, count; + payload_len =sizeof (struct r5l_payload_flush ) + + (sector_t )le32_to_cpu (payload_flush->size); +if (mb_offset + payload_len > +le32_to_cpu (mb->meta_size)) +return -EINVAL ; + count =le32_to_cpu (payload_flush->size) /sizeof (__le64);for (i =0 ; i < count; ++i) { stripe_sect =le64_to_cpu (payload_flush->flush_stripes[i]);
@@ -2125,12 +2140,17 @@ r5c_recovery_analyze_meta_block(struct r } } - mb_offset +=sizeof (struct r5l_payload_flush ) + -le32_to_cpu (payload_flush->size); + mb_offset += payload_len;continue ; }/* DATA or PARITY payload */ + payload_len =sizeof (struct r5l_payload_data_parity ) + + (sector_t )sizeof (__le32) * + (le32_to_cpu (payload->size) >> (PAGE_SHIFT -9 )); +if (mb_offset + payload_len >le32_to_cpu (mb->meta_size)) +return -EINVAL ; + stripe_sect = (le16_to_cpu(payload->header.type) == R5LOG_PAYLOAD_DATA) ? raid5_compute_sector( conf, le64_to_cpu(payload->location), 0, &dd,
@@ -2195,9 +2215,7 @@ r5c_recovery_analyze_meta_block(struct r log_offset =r5l_ring_add (log, log_offset,le32_to_cpu (payload->size)); - mb_offset +=sizeof (struct r5l_payload_data_parity ) + -sizeof (__le32) * - (le32_to_cpu (payload->size) >> (PAGE_SHIFT -9 )); + mb_offset += payload_len; }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 187/589 inotify: fix watch count leak when fsnotify_add_inode_mark_locked() fails
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chia-Ming Chang <[email protected]>
commit 6a320935fa4293e9e599ec9f85dc9eb3be7029f8 upstream.
When fsnotify_add_inode_mark_locked() fails in inotify_new_watch(), the error path calls inotify_remove_from_idr() but does not call dec_inotify_watches() to undo the preceding inc_inotify_watches(). This leaks a watch count, and repeated failures can exhaust the max_user_watches limit with -ENOSPC even when no watches are active.
Prior to commit 1cce1eea0aff ("inotify: Convert to using per-namespace limits"), the watch count was incremented after fsnotify_add_mark_locked() succeeded, so this path was not affected. The conversion moved inc_inotify_watches() before the mark insertion without adding the corresponding rollback.
Add the missing dec_inotify_watches() call in the error path.
--- fs/notify/inotify/inotify_user.c | 1 + 1 file changed, 1 insertion(+)
fs/notify/inotify/inotify_user.c +1 -0
@@ -609,6 +609,7 @@ static int inotify_new_watch(struct fsnoif (ret) {/* we failed to get on the inode, get off the idr */ inotify_remove_from_idr (group, tmp_i_mark); +dec_inotify_watches (group->inotify_data.ucounts); goto out_err; }
Greg Kroah-Hartman
maintainerPATCH 188/589 taskstats: set version in TGID exit notifications
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yiyang Chen <[email protected]>
commit 16c4f0211aaa1ec1422b11b59f64f1abe9009fc0 upstream.
delay accounting started populating taskstats records with a valid version field via fill_pid() and fill_tgid().
Later, commit ad4ecbcba728 ("[PATCH] delay accounting taskstats interface send tgid once") changed the TGID exit path to send the cached signal->stats aggregate directly instead of building the outgoing record through fill_tgid(). Unlike fill_tgid(), fill_tgid_exit() only accumulates accounting data and never initializes stats->version.
As a result, TGID exit notifications can reach userspace with version == 0 even though PID exit notifications and TASKSTATS_CMD_GET replies carry a valid taskstats version.
This is easy to reproduce with tools/accounting/getdelays.c.
I have a small follow-up patch for that tool which:
1. increases the receive buffer/message size so the pid+tgid combined exit notification is not dropped/truncated
2. prints stats->version.
With that patch, the reproducer is:
Terminal 1:
./getdelays -d -v -l -m 0
Terminal 2:
taskset -c 0 python3 -c 'import threading,time; t=threading.Thread(target=time.sleep,args=(0.1,)); t.start(); t.join()'
That produces both PID and TGID exit notifications for the same process. The PID exit record reports a valid taskstats version, while the TGID exit record reports version 0.
This patch (of 2):
Set stats->version = TASKSTATS_VERSION after copying the cached TGID aggregate into the outgoing netlink payload so all taskstats records are self-describing again.
--- kernel/taskstats.c | 1 + 1 file changed, 1 insertion(+)
kernel/taskstats.c +1 -0
@@ -632,6 +632,7 @@ void taskstats_exit(struct task_struct * goto err;memcpy (stats, tsk->signal->stats,sizeof (*stats)); + stats->version =TASKSTATS_VERSION ; send:send_cpu_listeners (rep_skb, listeners);
Greg Kroah-Hartman
maintainerPATCH 189/589 crypto: atmel-aes - Fix 3-page memory leak in atmel_aes_buff_cleanup
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
commit 3fcfff4ed35f963380a68741bcd52742baff7f76 upstream.
atmel_aes_buff_init() allocates 4 pages using __get_free_pages() with ATMEL_AES_BUFFER_ORDER, but atmel_aes_buff_cleanup() frees only the first page using free_page(), leaking the remaining 3 pages. Use free_pages() with ATMEL_AES_BUFFER_ORDER to fix the memory leak.
--- drivers/crypto/atmel-aes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/atmel-aes.c +1 -1
@@ -2265,7 +2265,7 @@ static int atmel_aes_buff_init(struct atstatic void atmel_aes_buff_cleanup (struct atmel_aes_dev *dd) { -free_page ((unsigned long )dd->buf); +free_pages ((unsigned long )dd->buf,ATMEL_AES_BUFFER_ORDER ); }static int atmel_aes_dma_init (struct atmel_aes_dev *dd)
Greg Kroah-Hartman
maintainerPATCH 190/589 crypto: atmel-ecc - Release client on allocation failure
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
commit 095d50008d55d13f8fcf1bbeb7c6eba51779bc85 upstream.
Call atmel_ecc_i2c_client_free() to release the I2C client reserved by atmel_ecc_i2c_client_alloc() when crypto_alloc_kpp() fails. Otherwise ->tfm_count will be out of sync.
--- drivers/crypto/atmel-ecc.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/atmel-ecc.c +1 -0
@@ -273,6 +273,7 @@ static int atmel_ecdh_init_tfm(struct crif (IS_ERR (fallback)) {dev_err (&ctx->client->dev,"Failed to allocate transformation for '%s': %ld\n" , alg,PTR_ERR (fallback)); +atmel_ecc_i2c_client_free (ctx->client);return PTR_ERR (fallback); }
Greg Kroah-Hartman
maintainerPATCH 191/589 crypto: hisilicon - Fix dma_unmap_single() direction
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
commit 1ee57ab93b75eb59f426aef37b5498a7ffc28278 upstream.
The direction used to map the buffer skreq->iv is DMA_TO_DEVICE but it is unmapped with direction DMA_BIDIRECTIONAL in the error path.
Change the unmap to match the mapping.
--- drivers/crypto/hisilicon/sec/sec_algs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/hisilicon/sec/sec_algs.c +1 -1
@@ -844,7 +844,7 @@ err_free_elements:if (crypto_skcipher_ivsize (atfm))dma_unmap_single (info->dev, sec_req->dma_iv,crypto_skcipher_ivsize (atfm), -DMA_BIDIRECTIONAL ); +DMA_TO_DEVICE ); err_unmap_out_sg:if (split) sec_unmap_sg_on_err(skreq->dst, steps, splits_out,
Greg Kroah-Hartman
maintainerPATCH 192/589 crypto: ccree - fix a memory leak in cc_mac_digest()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoxiang Li <[email protected]>
commit 02c64052fad03699b9c6d1df2f9b444d17e4ac50 upstream.
Add cc_unmap_result() if cc_map_hash_request_final() fails to prevent potential memory leak.
--- drivers/crypto/ccree/cc_hash.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/ccree/cc_hash.c +1 -0
@@ -1448,6 +1448,7 @@ static int cc_mac_digest(struct ahash_reif (cc_map_hash_request_final (ctx->drvdata, state, req->src, req->nbytes,1 , flags)) {dev_err (dev,"map_ahash_request_final() failed\n" ); +cc_unmap_result (dev, state, digestsize, req->result);cc_unmap_req (dev, state, ctx);return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 193/589 crypto: atmel-tdes - fix DMA sync direction
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
commit c8a9a647532f5c2a04180352693215e24e9dba03 upstream.
Before DMA output is consumed by the CPU, ->dma_addr_out must be synced with dma_sync_single_for_cpu() instead of dma_sync_single_for_device(). Using the wrong direction can return stale cache data on non-coherent platforms.
--- drivers/crypto/atmel-tdes.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/crypto/atmel-tdes.c +4 -4
@@ -312,8 +312,8 @@ static int atmel_tdes_crypt_pdc_stop(strdma_unmap_sg (dd->dev, dd->out_sg,1 ,DMA_FROM_DEVICE );dma_unmap_sg (dd->dev, dd->in_sg,1 ,DMA_TO_DEVICE ); }else { -dma_sync_single_for_device (dd->dev, dd->dma_addr_out, - dd->dma_size,DMA_FROM_DEVICE ); +dma_sync_single_for_cpu (dd->dev, dd->dma_addr_out, + dd->dma_size,DMA_FROM_DEVICE );/* copy data */ count = atmel_tdes_sg_copy(&dd->out_sg, &dd->out_offset,
@@ -671,8 +671,8 @@ static int atmel_tdes_crypt_dma_stop(strdma_unmap_sg (dd->dev, dd->out_sg,1 ,DMA_FROM_DEVICE );dma_unmap_sg (dd->dev, dd->in_sg,1 ,DMA_TO_DEVICE ); }else { -dma_sync_single_for_device (dd->dev, dd->dma_addr_out, - dd->dma_size,DMA_FROM_DEVICE ); +dma_sync_single_for_cpu (dd->dev, dd->dma_addr_out, + dd->dma_size,DMA_FROM_DEVICE );/* copy data */ count = atmel_tdes_sg_copy(&dd->out_sg, &dd->out_offset,
Greg Kroah-Hartman
maintainerPATCH 194/589 dm mirror: fix integer overflow in create_dirty_log()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junrui Luo <[email protected]>
commit 4c788c6f921b22f9b6c3f316c4a071c05683e7de upstream.
The argument count calculation in create_dirty_log() performs *args_used = 2 + param_count before validating against argc. When a user provides a param_count close to UINT_MAX via the device mapper table string, this unsigned addition wraps around to a small value, causing the subsequent argc < *args_used check to be bypassed.
The overflowed param_count is then passed as argc to dm_dirty_log_create(), where it can cause out-of-bounds reads on the argv array.
Fix by comparing param_count against argc - 2 before performing the addition, following the same pattern used by parse_features() in the same file. Since argc >= 2 is already guaranteed, the subtraction is safe.
--- drivers/md/dm-raid1.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/md/dm-raid1.c +3 -3
@@ -981,13 +981,13 @@ static struct dm_dirty_log *create_dirtyreturn NULL ; } - *args_used =2 + param_count; - -if (argc < *args_used) { +if (param_count > argc -2 ) { ti->error ="Insufficient mirror log arguments" ;return NULL ; } + *args_used =2 + param_count; + dl =dm_dirty_log_create (argv[0 ], ti, mirror_flush, param_count, argv +2 );if (!dl) {
Greg Kroah-Hartman
maintainerPATCH 195/589 IB/core: Fix zero dmac race in neighbor resolution
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Zhao <[email protected]>
commit 5e6de34d82b49cab9d8a42063e9cd0f22a4f31e5 upstream.
dst_fetch_ha() checks nud_state without holding the neighbor lock, then copies ha under the seqlock. A race in __neigh_update() where nud_state is set to NUD_REACHABLE before ha is written allows dst_fetch_ha() to read a zero MAC address while the seqlock reports no concurrent writer.
netevent_callback amplifies this by waking ALL pending addr_req workers when ANY neighbor becomes NUD_VALID. At scale (N peers resolving ARP concurrently), the hit probability scales as N^2, making it near-certain for large RDMA workloads.
N(A): neigh_update(A) W(A): addr_resolve(A)
| [sleep] | write_lock_bh(&A->lock) | | A->nud_state = NUD_REACHABLE | | // A->ha is still 0 | | [woken by netevent_cb() of | another neighbour] | | dst_fetch_ha(A) | | A->nud_state & NUD_VALID | | read_seqbegin(&A->ha_lock) | | snapshot = A->ha /* 0 */ | | read_seqretry(&A->ha_lock) | | return snapshot | seqlock(&A->ha_lock) | A->ha = mac_A /* too late */ | sequnlock(&A->ha_lock) | write_unlock_bh(&A->lock)
The incorrect/zero mac is read and programmed in the device QP while it was not yet updated. This causes silent packet loss and eventual RETRY_EXC_ERR.
Fix by holding the neighbor read lock across the nud_state check and ha copy in dst_fetch_ha(), ensuring it synchronizes with __neigh_update() which is updating while holding the write lock.
--- drivers/infiniband/core/addr.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/core/addr.c +3 -0
@@ -322,11 +322,14 @@ static int dst_fetch_ha(const struct dstif (!n)return -ENODATA ; +read_lock_bh (&n->lock);if (!(n->nud_state &NUD_VALID )) { +read_unlock_bh (&n->lock);neigh_event_send (n,NULL ); ret = -ENODATA ; }else {neigh_ha_snapshot (dev_addr->dst_dev_addr, n, dst->dev); +read_unlock_bh (&n->lock); }neigh_release (n);
Greg Kroah-Hartman
maintainerPATCH 196/589 crypto: authencesn - reject short ahash digests during instance creation
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yucheng Lu <[email protected]>
commit 5db6ef9847717329f12c5ea8aba7e9f588a980c0 upstream.
authencesn requires either a zero authsize or an authsize of at least 4 bytes because the ESN encrypt/decrypt paths always move 4 bytes of high-order sequence number data at the end of the authenticated data.
While crypto_authenc_esn_setauthsize() already rejects explicit non-zero authsizes in the range 1..3, crypto_authenc_esn_create() still copied auth->digestsize into inst->alg.maxauthsize without validating it. The AEAD core then initialized the tfm's default authsize from that value.
As a result, selecting an ahash with digest size 1..3, such as cbcmac(cipher_null), exposed authencesn instances whose default authsize was invalid even though setauthsize() would have rejected the same value. AF_ALG could then trigger the ESN tail handling with a too-short tag and hit an out-of-bounds access.
Reject authencesn instances whose ahash digest size is in the invalid non-zero range 1..3 so that no tfm can inherit an unsupported default authsize.
--- crypto/authencesn.c | 5 +++++ 1 file changed, 5 insertions(+)
crypto/authencesn.c +5 -0
@@ -400,6 +400,11 @@ static int crypto_authenc_esn_create(str auth =crypto_spawn_ahash_alg (&ctx->auth); auth_base = &auth->base; +if (auth->digestsize >0 && auth->digestsize <4 ) { + err = -EINVAL ; + goto err_free_inst; + } + err =crypto_grab_skcipher (&ctx->enc,aead_crypto_instance (inst),crypto_attr_alg_name (tb[2 ]),0 , mask);if (err)
Greg Kroah-Hartman
maintainerPATCH 197/589 driver core: Add kernel-doc for DEV_FLAG_COUNT enum value
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
commit 5b484311507b5d403c1f7a45f6aa3778549e268b upstream.
Even though nobody should use this value (except when declaring the "flags" bitmap), kernel-doc still gets upset that it's not documented. It reports:
WARNING: ../include/linux/device.h:519 Enum value 'DEV_FLAG_COUNT' not described in enum 'struct_device_flags'
Add the description of DEV_FLAG_COUNT.
--- include/linux/device.h | 1 + 1 file changed, 1 insertion(+)
include/linux/device.h +1 -0
@@ -393,6 +393,7 @@ struct dev_links_info {* * @DEV_FLAG_READY_TO_PROBE: If set then device_add() has finished enough * initialization that probe could be called. +* @DEV_FLAG_COUNT: Number of defined struct_device_flags. */ enum struct_device_flags {DEV_FLAG_READY_TO_PROBE =0 ,
Greg Kroah-Hartman
maintainerPATCH 198/589 ALSA: caiaq: Fix potentially leftover ep1_in_urb at error path
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 0a7b5221b5b51cc798fcfc3be00d02eade149d69 upstream.
The previous fix for handling the error from setup_card() missed that an internal URB cdev->ep1_in_urb might have been already submitted beforehand. In the normal case, this URB gets killed at the disconnection, but in the error path, we didn't do it, hence there can be a potential leak.
Fix it in the error path for setup_card(), too.
--- sound/usb/caiaq/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/caiaq/device.c +1 -1
@@ -528,7 +528,7 @@ static int init_card(struct snd_usb_caia card->private_free = card_free; err =setup_card (cdev);if (err <0 ) -return err; + goto err_kill_urb;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 199/589 ALSA: caiaq: Dont abort when no input device is available
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit b32ae47a2b0a1fb4bd4942242847966d9b178222 upstream.
The previous fix to handle the error from setup_card() caused a regression for the models that have no dedicated input device; snd_usb_caiaq_input_init() just returns -EINVAL, and we treat it as a fatal error although it should be ignored.
As a regression fix, change the error code to -ENODEV, and ignore this error in the callee, to continue probing.
--- sound/usb/caiaq/device.c | 2 +- sound/usb/caiaq/input.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/usb/caiaq/device.c +1 -1
@@ -380,7 +380,7 @@ static int setup_card(struct snd_usb_cai#ifdef CONFIG_SND_USB_CAIAQ_INPUT ret =snd_usb_caiaq_input_init (cdev); -if (ret <0 ) { +if (ret <0 && ret != -ENODEV ) {dev_err (dev,"Unable to set up input system (ret=%d)\n" , ret);return ret; }
sound/usb/caiaq/input.c +1 -1
@@ -804,7 +804,7 @@ int snd_usb_caiaq_input_init(struct snd_default :/* no input methods supported on this device */ - ret = -EINVAL ; + ret = -ENODEV ; goto exit_free_idev; }
Greg Kroah-Hartman
maintainerPATCH 200/589 ipv6: rpl: reserve mac_len headroom when recompressed SRH grows
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 9e6bf146b55999a095bb14f73a843942456d1adc upstream.
ipv6_rpl_srh_rcv() decompresses an RFC 6554 Source Routing Header, swaps the next segment into ipv6_hdr->daddr, recompresses, then pulls the old header and pushes the new one plus the IPv6 header back. The recompressed header can be larger than the received one when the swap reduces the common-prefix length the segments share with daddr (CmprI=0, CmprE>0, seg[0][0] != daddr[0] gives the maximum +8 bytes).
pskb_expand_head() was gated on segments_left == 0, so on earlier segments the push consumed unchecked headroom. Once skb_push() leaves fewer than skb->mac_len bytes in front of data, skb_mac_header_rebuild()'s call to:
skb_set_mac_header(skb, -skb->mac_len);
will store (data - head) - mac_len into the u16 mac_header field, which wraps to ~65530, and the following memmove() writes mac_len bytes ~64KiB past skb->head.
A single AF_INET6/SOCK_RAW/IPV6_HDRINCL packet over lo with a two segment type-3 SRH (CmprI=0, CmprE=15) reaches headroom 8 after one pass; KASAN reports a 14-byte OOB write in ipv6_rthdr_rcv.
Fix this by expanding the head whenever the remaining room is less than the push size plus mac_len, and request that much extra so the rebuilt MAC header fits afterwards.
--- net/ipv6/exthdrs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/ipv6/exthdrs.c +6 -3
@@ -480,6 +480,7 @@ static int ipv6_rpl_srh_rcv(struct sk_bustruct inet6_dev *idev;struct ipv6hdr *oldhdr;struct in6_addr addr; +unsigned int chdr_len;unsigned char *buf;int accept_rpl_seg;int i, err;
@@ -601,8 +602,10 @@ looped_back:skb_pull (skb, ((hdr->hdrlen +1 ) <<3 ));skb_postpull_rcsum (skb, oldhdr,sizeof (struct ipv6hdr ) + ((hdr->hdrlen +1 ) <<3 )); -if (unlikely (!hdr->segments_left)) { -if (pskb_expand_head (skb,sizeof (struct ipv6hdr ) + ((chdr->hdrlen +1 ) <<3 ),0 , + chdr_len =sizeof (struct ipv6hdr ) + ((chdr->hdrlen +1 ) <<3 ); +if (unlikely (!hdr->segments_left || +skb_headroom (skb) < chdr_len + skb->mac_len)) { +if (pskb_expand_head (skb, chdr_len + skb->mac_len,0 ,GFP_ATOMIC )) {__IP6_INC_STATS (net,ip6_dst_idev (skb_dst (skb)),IPSTATS_MIB_OUTDISCARDS );kfree_skb (skb);
@@ -612,7 +615,7 @@ looped_back: oldhdr =ipv6_hdr (skb); } -skb_push (skb, ((chdr->hdrlen +1 ) <<3 ) +sizeof (struct ipv6hdr )); +skb_push (skb, chdr_len);skb_reset_network_header (skb);skb_mac_header_rebuild (skb);skb_set_transport_header (skb,sizeof (struct ipv6hdr ));
Greg Kroah-Hartman
maintainerPATCH 201/589 drm/amdgpu: fix zero-size GDS range init on RDNA4
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arjan van de Ven <[email protected]>
commit 095a8b0ad3c3b5cdc3850d961adb8a8f735220bb upstream.
RDNA4 (GFX 12) hardware removes the GDS, GWS, and OA on-chip memory resources. The gfx_v12_0 initialisation code correctly leaves adev->gds.gds_size, adev->gds.gws_size, and adev->gds.oa_size at zero to reflect this.
amdgpu_ttm_init() unconditionally calls amdgpu_ttm_init_on_chip() for each of these resources regardless of size. When the size is zero, amdgpu_ttm_init_on_chip() forwards the call to ttm_range_man_init(), which calls drm_mm_init(mm, 0, 0). drm_mm_init() immediately fires DRM_MM_BUG_ON(start + size <= start) -- trivially true when size is zero -- crashing the kernel during modprobe of amdgpu on an RX 9070 XT.
Guard against this by returning 0 early from amdgpu_ttm_init_on_chip() when size_in_page is zero. This skips TTM resource manager registration for hardware resources that are absent, without affecting any other GPU type.
DRM_MM_BUG_ON() only asserts if CONFIG_DRM_DEBUG_MM is enabled in the kernel config. This is apparently rarely enabled as these chips have been in the market for over a year and this issue was only reported now.
Oops-Analysis: http://oops.fenrus.org/reports/bugzilla.korg/221376/report.html
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3 -0
@@ -71,6 +71,9 @@ static int amdgpu_ttm_init_on_chip(struc unsigned int type, uint64_t size_in_page) { +if (!size_in_page) +return 0 ; +return ttm_range_man_init (&adev->mman.bdev, type, false, size_in_page); }
Greg Kroah-Hartman
maintainerPATCH 202/589 ALSA: caiaq: fix usb_dev refcount leak on probe failure
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <[email protected]>
commit 7a5f1cd22d47f8ca4b760b6334378ae42c1bd24b upstream.
create_card() takes a reference on the USB device with usb_get_dev() and stores the matching usb_put_dev() in card_free(), which is installed as the snd_card's ->private_free destructor.
However, ->private_free is only assigned near the end of init_card(), after several failure points (usb_set_interface(), EP type checks, usb_submit_urb(), the EP1_CMD_GET_DEVICE_INFO exchange, and its timeout). When any of those fail, init_card() returns an error to snd_probe(), which calls snd_card_free(card). Because ->private_free is still NULL, card_free() never runs, the usb_get_dev() reference is not dropped, and the struct usb_device leaks along with its descriptor allocations and device_private.
syzbot reproduces this with a malformed UAC3 device whose only valid altsetting is 0; init_card()'s usb_set_interface(usb_dev, 0, 1) call fails with -EIO and triggers the leak.
Move the ->private_free assignment into create_card(), immediately after usb_get_dev(), so that every error path reaching snd_card_free() balances the reference. card_free()'s callees (snd_usb_caiaq_input_free, free_urbs, kfree) already tolerate the partially-initialized state because the chip private area is zero-initialized by snd_card_new().
--- sound/usb/caiaq/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/caiaq/device.c +1 -1
@@ -437,6 +437,7 @@ static int create_card(struct usb_device cdev =caiaqdev (card); cdev->chip.dev =usb_get_dev (usb_dev); + card->private_free = card_free; cdev->chip.card = card; cdev->chip.usb_id =USB_ID (le16_to_cpu (usb_dev->descriptor.idVendor),le16_to_cpu (usb_dev->descriptor.idProduct));
@@ -525,7 +526,6 @@ static int init_card(struct snd_usb_caiasnprintf (card->longname,sizeof (card->longname),"%s %s (%s)" , cdev->vendor_name, cdev->product_name, usbpath); - card->private_free = card_free; err =setup_card (cdev);if (err <0 ) goto err_kill_urb;
Greg Kroah-Hartman
maintainerPATCH 203/589 netfilter: reject zero shift in nft_bitwise
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai Ma <[email protected]>
commit fe11e5c40817b84abaa5d83bfb6586d8412bfd07 upstream.
Reject zero shift operands for nft_bitwise left and right shift expressions during initialization.
The carry propagation logic computes the carry from the adjacent 32-bit word using BITS_PER_TYPE(u32) - shift. A zero shift operand turns this into a 32-bit shift, which is undefined behaviour.
Reject zero shift operands in the control plane, alongside the existing check for values greater than or equal to 32, so malformed rules never reach the packet path.
--- net/netfilter/nft_bitwise.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nft_bitwise.c +2 -1
@@ -149,7 +149,8 @@ static int nft_bitwise_init_shift(structif (err <0 )return err; -if (priv->data.data[0 ] >=BITS_PER_TYPE (u32)) { +if (!priv->data.data[0 ] || + priv->data.data[0 ] >=BITS_PER_TYPE (u32)) {nft_data_release (&priv->data, desc.type);return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 204/589 scsi: target: configfs: Bound snprintf() return in tg_pt_gp_members_show()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 772a896a56e0e3ef9424a025cec9176f9d8f4552 upstream.
target_tg_pt_gp_members_show() formats LUN paths with snprintf() into a 256-byte stack buffer, then will memcpy() cur_len bytes from that buffer. snprintf() returns the length the output would have had, which can exceed the buffer size when the fabric WWN is long because iSCSI IQN names can be up to 223 bytes. The check at the memcpy() site only guards the destination page write, not the source read, so memcpy() will read past the stack buffer and copy adjacent stack contents to the sysfs reader, which when CONFIG_FORTIFY_SOURCE is enabled, fortify_panic() will be triggered.
Commit 27e06650a5ea ("scsi: target: target_core_configfs: Add length check to avoid buffer overflow") added the same bound to the target_lu_gp_members_show() but the tg_pt_gp variant was missed so resolve that here.
--- drivers/target/target_core_configfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/target_core_configfs.c +1 -1
@@ -3043,7 +3043,7 @@ static ssize_t target_tg_pt_gp_members_s config_item_name(&lun->lun_group.cg_item)); cur_len++;/* Extra byte for NULL terminator */ -if ((cur_len + len) >PAGE_SIZE ) { +if (cur_len >TG_PT_GROUP_NAME_BUF || (cur_len + len) >PAGE_SIZE ) {pr_warn ("Ran out of lu_gp_show_attr" "_members buffer\n" );break ;
Greg Kroah-Hartman
maintainerPATCH 205/589 ipmi: Add limits to event and receive message requests
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Corey Minyard <[email protected]>
commit c4cca236968683eb0d59abfb12d5c7e4d8514227 upstream.
The driver would just fetch events and receive messages until the BMC said it was done. To avoid issues with BMCs that never say they are done, add a limit of 10 fetches at a time.
In addition, an si interface has an attn state it can return from the hardware which is supposed to cause a flag fetch to see if the driver needs to fetch events or message or a few other things. If the attn bit gets stuck, it's a similar problem. So allow messages in between flag fetches so the driver itself doesn't get stuck.
This is a more general fix than the previous fix for the specific bad BMC, but should fix the more general issue of a BMC that won't stop saying it has data.
This has been there from the beginning of the driver. It's not a bug per-se, but it is accounting for bugs in BMCs.
--- drivers/char/ipmi/ipmi_si_intf.c | 54 +++++++++++++++++++++++++++++++-------- drivers/char/ipmi/ipmi_ssif.c | 23 +++++++++++++++- 2 files changed, 64 insertions(+), 13 deletions(-)
drivers/char/ipmi/ipmi_si_intf.c +43 -11
@@ -161,6 +161,10 @@ struct smi_info { OEM2_DATA_AVAIL) unsigned char msg_flags; +/* When requesting events and messages, don't do it forever. */ +unsigned int num_requests_in_a_row; +bool last_was_flag_fetch; +/* Does the BMC have an event buffer? */ bool has_event_buffer;
@@ -392,7 +396,10 @@ static void start_getting_msg_queue(strustart_new_msg (smi_info, smi_info->curr_msg->data, smi_info->curr_msg->data_size); - smi_info->si_state =SI_GETTING_MESSAGES ; +if (smi_info->si_state !=SI_GETTING_MESSAGES ) { + smi_info->num_requests_in_a_row =0 ; + smi_info->si_state =SI_GETTING_MESSAGES ; + } }static void start_getting_events (struct smi_info *smi_info)
@@ -403,7 +410,10 @@ static void start_getting_events(structstart_new_msg (smi_info, smi_info->curr_msg->data, smi_info->curr_msg->data_size); - smi_info->si_state =SI_GETTING_EVENTS ; +if (smi_info->si_state !=SI_GETTING_EVENTS ) { + smi_info->num_requests_in_a_row =0 ; + smi_info->si_state =SI_GETTING_EVENTS ; + } }/*
@@ -577,6 +587,7 @@ static void handle_transaction_done(stru smi_info->si_state =SI_NORMAL ; }else { smi_info->msg_flags = msg[3 ]; + smi_info->last_was_flag_fetch = true;handle_flags (smi_info); }break ;
@@ -622,6 +633,11 @@ static void handle_transaction_done(stru }else {smi_inc_stat (smi_info, events); + smi_info->num_requests_in_a_row++; +if (smi_info->num_requests_in_a_row >10 ) +/* Stop if we do this too many times. */ + smi_info->msg_flags &= ~EVENT_MSG_BUFFER_FULL ; +/* * Do this before we deliver the message * because delivering the message releases the
@@ -660,6 +676,11 @@ static void handle_transaction_done(stru }else {smi_inc_stat (smi_info, incoming_messages); + smi_info->num_requests_in_a_row++; +if (smi_info->num_requests_in_a_row >10 ) +/* Stop if we do this too many times. */ + smi_info->msg_flags &= ~RECEIVE_MSG_AVAIL ; +/* * Do this before we deliver the message * because delivering the message releases the
@@ -788,6 +809,26 @@ restart: }/* +* If we are currently idle, or if the last thing that was +* done was a flag fetch and there is a message pending, try +* to start the next message. +* +* We do the waiting message check to avoid a stuck flag +* completely wedging the driver. Let a message through +* in between flag operations if that happens. +*/ +if (si_sm_result ==SI_SM_IDLE || + (si_sm_result ==SI_SM_ATTN && smi_info->waiting_msg && + smi_info->last_was_flag_fetch)) { + smi_info->last_was_flag_fetch = false; +smi_inc_stat (smi_info, idles); + + si_sm_result =start_next_msg (smi_info); +if (si_sm_result !=SI_SM_IDLE ) + goto restart; + } + +/* * We prefer handling attn over new messages. But don't do * this if there is not yet an upper layer to handle anything. */
@@ -820,15 +861,6 @@ restart: } } -/* If we are currently idle, try to start the next message. */ -if (si_sm_result ==SI_SM_IDLE ) { -smi_inc_stat (smi_info, idles); - - si_sm_result =start_next_msg (smi_info); -if (si_sm_result !=SI_SM_IDLE ) - goto restart; - } -if ((si_sm_result ==SI_SM_IDLE ) && (atomic_read (&smi_info->req_events))) {/*
drivers/char/ipmi/ipmi_ssif.c +21 -2
@@ -225,6 +225,9 @@ struct ssif_info {bool has_event_buffer;bool supports_alert; +/* When requesting events and messages, don't do it forever. */ +unsigned int num_requests_in_a_row; +/* * Used to tell what we should do with alerts. If we are * waiting on a response, read the data immediately.
@@ -419,7 +422,10 @@ static void start_event_fetch(struct ssi } ssif_info->curr_msg = msg; - ssif_info->ssif_state =SSIF_GETTING_EVENTS ; +if (ssif_info->ssif_state !=SSIF_GETTING_EVENTS ) { + ssif_info->num_requests_in_a_row =0 ; + ssif_info->ssif_state =SSIF_GETTING_EVENTS ; + }ipmi_ssif_unlock_cond (ssif_info, flags); msg->data[0 ] = (IPMI_NETFN_APP_REQUEST <<2 );
@@ -442,7 +448,10 @@ static void start_recv_msg_fetch(struct } ssif_info->curr_msg = msg; - ssif_info->ssif_state =SSIF_GETTING_MESSAGES ; +if (ssif_info->ssif_state !=SSIF_GETTING_MESSAGES ) { + ssif_info->num_requests_in_a_row =0 ; + ssif_info->ssif_state =SSIF_GETTING_MESSAGES ; + }ipmi_ssif_unlock_cond (ssif_info, flags); msg->data[0 ] = (IPMI_NETFN_APP_REQUEST <<2 );
@@ -851,6 +860,11 @@ static void msg_done_handler(struct ssif ssif_info->msg_flags &= ~EVENT_MSG_BUFFER_FULL ;handle_flags (ssif_info, flags); }else { + ssif_info->num_requests_in_a_row++; +if (ssif_info->num_requests_in_a_row >10 ) +/* Stop if we do this too many times. */ + ssif_info->msg_flags &= ~EVENT_MSG_BUFFER_FULL ; +handle_flags (ssif_info, flags);ssif_inc_stat (ssif_info, events);deliver_recv_msg (ssif_info, msg);
@@ -884,6 +898,11 @@ static void msg_done_handler(struct ssif ssif_info->msg_flags &= ~RECEIVE_MSG_AVAIL ;handle_flags (ssif_info, flags); }else { + ssif_info->num_requests_in_a_row++; +if (ssif_info->num_requests_in_a_row >10 ) +/* Stop if we do this too many times. */ + ssif_info->msg_flags &= ~RECEIVE_MSG_AVAIL ; +ssif_inc_stat (ssif_info, incoming_messages);handle_flags (ssif_info, flags);deliver_recv_msg (ssif_info, msg);
Greg Kroah-Hartman
maintainerPATCH 206/589 ipmi: Check event message buffer response for bad data
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Corey Minyard <[email protected]>
commit 36920f30e78e69df01f9691c470b6f3ba8aebf98 upstream.
The event message buffer response data size got checked later when processing, but check it right after the response comes back. It appears some BMCs may return an empty message instead of an error when fetching events.
There are apparently some new BMCs that make this error, so we need to compensate.
--- drivers/char/ipmi/ipmi_si_intf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/char/ipmi/ipmi_si_intf.c +7 -1
@@ -623,7 +623,13 @@ static void handle_transaction_done(stru*/ msg = smi_info->curr_msg; smi_info->curr_msg =NULL ; -if (msg->rsp[2 ] !=0 ) { +/* +* It appears some BMCs, with no event data, return no +* data in the message and not a 0x80 error as the +* spec says they should. Shut down processing if +* the data is not the right length. +*/ +if (msg->rsp[2 ] !=0 || msg->rsp_size !=19 ) {/* Error getting event, probably done. */ msg->done (msg);
Greg Kroah-Hartman
maintainerPATCH 207/589 ipmi:si: Return state to normal if message allocation fails
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Corey Minyard <[email protected]>
commit 09dd798270ff582d7309f285d4aaf5dbebae01cb upstream.
There were places where nothing would get started if a message allocation failed, so the driver needs to return to normal state.
--- drivers/char/ipmi/ipmi_si_intf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/char/ipmi/ipmi_si_intf.c +6 -2
@@ -479,15 +479,19 @@ retry: }else if (smi_info->msg_flags &RECEIVE_MSG_AVAIL ) {/* Messages available. */ smi_info->curr_msg =alloc_msg_handle_irq (smi_info); -if (!smi_info->curr_msg) +if (!smi_info->curr_msg) { + smi_info->si_state =SI_NORMAL ;return ; + }start_getting_msg_queue (smi_info); }else if (smi_info->msg_flags &EVENT_MSG_BUFFER_FULL ) {/* Events available. */ smi_info->curr_msg =alloc_msg_handle_irq (smi_info); -if (!smi_info->curr_msg) +if (!smi_info->curr_msg) { + smi_info->si_state =SI_NORMAL ;return ; + }start_getting_events (smi_info); } else if (smi_info->msg_flags & OEM_DATA_AVAIL &&
Greg Kroah-Hartman
maintainerPATCH 208/589 fbdev: udlfb: add vm_ops to dlfb_ops_mmap to prevent use-after-free
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rajat Gupta <[email protected]>
commit 8de779dc40d35d39fa07387b6f921eb11df0f511 upstream.
dlfb_ops_mmap() uses remap_pfn_range() to map vmalloc framebuffer pages to userspace but sets no vm_ops on the VMA. This means the kernel cannot track active mmaps. When dlfb_realloc_framebuffer() replaces the backing buffer via FBIOPUT_VSCREENINFO, existing mmap PTEs are not invalidated. On USB disconnect, dlfb_ops_destroy() calls vfree() on the old pages while userspace PTEs still reference them, resulting in a use-after-free:
the process retains read/write access to freed kernel pages.
Add vm_operations_struct with open/close callbacks that maintain an atomic mmap_count on struct dlfb_data. In dlfb_realloc_framebuffer(), check mmap_count and return -EBUSY if the buffer is currently mapped, preventing buffer replacement while userspace holds stale PTEs.
Tested with PoC using dummy_hcd + raw_gadget USB device emulation.
--- drivers/video/fbdev/udlfb.c | 31 ++++++++++++++++++++++++++++++- include/video/udlfb.h | 1 + 2 files changed, 31 insertions(+), 1 deletion(-)
drivers/video/fbdev/udlfb.c +30 -1
@@ -321,12 +321,32 @@ static int dlfb_set_video_mode(struct dlreturn retval; } +static void dlfb_vm_open (struct vm_area_struct *vma) +{ +struct dlfb_data *dlfb = vma->vm_private_data; + +atomic_inc (&dlfb->mmap_count); +} + +static void dlfb_vm_close (struct vm_area_struct *vma) +{ +struct dlfb_data *dlfb = vma->vm_private_data; + +atomic_dec (&dlfb->mmap_count); +} + +static const struct vm_operations_struct dlfb_vm_ops = { + .open = dlfb_vm_open, + .close = dlfb_vm_close, +}; +static int dlfb_ops_mmap (struct fb_info *info,struct vm_area_struct *vma) {unsigned long start = vma->vm_start;unsigned long size = vma->vm_end - vma->vm_start;unsigned long offset = vma->vm_pgoff <<PAGE_SHIFT ;unsigned long page, pos; +struct dlfb_data *dlfb = info->par;if (vma->vm_pgoff > (~0UL >>PAGE_SHIFT ))return -EINVAL ;
@@ -353,6 +373,9 @@ static int dlfb_ops_mmap(struct fb_info size =0 ; } + vma->vm_ops = &dlfb_vm_ops; + vma->vm_private_data = dlfb; +atomic_inc (&dlfb->mmap_count);return 0 ; }
@@ -1218,7 +1241,6 @@ static void dlfb_deferred_vfree(struct d/* * Assumes &info->lock held by caller -* Assumes no active clients have framebuffer open */ static int dlfb_realloc_framebuffer (struct dlfb_data *dlfb,struct fb_info *info,u32 new_len) {
@@ -1230,6 +1252,13 @@ static int dlfb_realloc_framebuffer(stru new_len =PAGE_ALIGN (new_len);if (new_len > old_len) { +if (atomic_read (&dlfb->mmap_count) >0 ) { +dev_warn (info->dev, +"refusing realloc: %d active mmaps\n" , +atomic_read (&dlfb->mmap_count)); +return -EBUSY ; + } +/* * Alloc system memory for virtual framebuffer */
include/video/udlfb.h +1 -0
@@ -56,6 +56,7 @@ struct dlfb_data {spinlock_t damage_lock;struct work_struct damage_work;struct fb_ops ops; +atomic_t mmap_count;/* blit-only rendering path metrics, exposed through sysfs */ atomic_t bytes_rendered;/* raw pixel-bytes driver asked to render */ atomic_t bytes_identical;/* saved effort with backbuffer comparison */
Greg Kroah-Hartman
maintainerPATCH 209/589 ACPI: video: force native backlight on HP OMEN 16 (8A44)
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shivam Kalra <[email protected]>
commit 4b506ea5351a1f5937ac632a4a5c35f6f796cc41 upstream.
The HP OMEN 16 Gaming Laptop (board name 8A44) has a mux-less hybrid GPU configuration with AMD Rembrandt (Radeon 680M) and NVIDIA GA104 (RTX 3070 Ti). The internal eDP panel is wired to the AMD iGPU.
When Nouveau loads without GSP firmware, the ACPI video backlight device (acpi_video0) gets registered alongside the native AMD backlight (amdgpu_bl2). In this state, writes to amdgpu_bl2 update the software brightness value but fail to change the physical panel brightness.
Force native backlight to prevent acpi_video0 from registering. Confirmed that booting with acpi_backlight=native resolves the issue.
--- drivers/acpi/video_detect.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/acpi/video_detect.c +8 -0
@@ -154,6 +154,14 @@ static const struct dmi_system_id video_ DMI_MATCH(DMI_PRODUCT_NAME, "VPCEH3U1E"), }, }, + { + .callback = video_detect_force_native, + /* HP OMEN Gaming Laptop 16-n0xxx */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "HP"), + DMI_MATCH(DMI_PRODUCT_NAME, "OMEN by HP Gaming Laptop 16-n0xxx"), + }, + },/* * These models have a working acpi_video backlight control, and using
Greg Kroah-Hartman
maintainerPATCH 210/589 spi: rockchip: fix controller deregistration
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 53e7a16070feb7d1d4d81a583eaac5e25048b9c3 upstream.
Make sure to deregister the controller before freeing underlying resources like DMA channels during driver unbind.
--- drivers/spi/spi-rockchip.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/spi/spi-rockchip.c +3 -1
@@ -792,7 +792,7 @@ static int rockchip_spi_probe(struct pla ctlr->can_dma = rockchip_spi_can_dma; } - ret =devm_spi_register_controller (&pdev->dev, ctlr); + ret =spi_register_controller (ctlr);if (ret <0 ) {dev_err (&pdev->dev,"Failed to register controller\n" ); goto err_free_dma_rx;
@@ -828,6 +828,8 @@ static int rockchip_spi_remove(struct plclk_disable_unprepare (rs->spiclk);clk_disable_unprepare (rs->apb_pclk); +spi_unregister_controller (ctlr); +pm_runtime_put_noidle (&pdev->dev);pm_runtime_disable (&pdev->dev);pm_runtime_set_suspended (&pdev->dev);
Re: [PATCH 5.10 210/589] spi: rockchip: fix controller deregistration
Quoted 34 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit
53e7a16070feb7d1d4d81a583eaac5e25048b9c3upstream.Make sure to deregister the controller before freeing underlying resources like DMA channels during driver unbind.
Fixes 64e36824b32b ("spi/rockchip: add driver for Rockchip RK3xxx SoCs integrated SPI")Cc [email protected] # 3.17Cc addy ke <[email protected]>Signed-off-by Johan Hovold <[email protected]>Signed-off-by Mark Brown <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/spi/spi-rockchip.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/spi/spi-rockchip.c +1
-1@@ -792,7 +792,7 @@ static int rockchip_spi_probe(struct pla ctlr->can_dma = rockchip_spi_can_dma; } - ret =devm_spi_register_controller (&pdev->dev, ctlr); + ret =spi_register_controller (ctlr);if (ret <0 ) {dev_err (&pdev->dev,"Failed to register controller\n" ); goto err_free_dma_rx;
drivers/spi/spi-rockchip.c static int rockchip_spi_remove(struct pl · line 831
Quoted 4 lines
drivers/spi/spi-rockchip.c +1
-0@@ -828,6 +828,8 @@ static int rockchip_spi_remove(struct plclk_disable_unprepare (rs->spiclk);clk_disable_unprepare (rs->apb_pclk); +spi_unregister_controller (ctlr);
This needs to be inserted above the clk_disable_unprepare()s.
Ben.
Quoted 6 lines
drivers/spi/spi-rockchip.c +1
-0+pm_runtime_put_noidle (&pdev->dev);pm_runtime_disable (&pdev->dev);pm_runtime_set_suspended (&pdev->dev);
Signature · 4 lines
Ben Hutchings
The obvious mathematical breakthrough [to break modern encryption]
would be development of an easy way to factor large prime numbers.
- Bill GatesGreg Kroah-Hartman
maintainerRe: [PATCH 5.10 210/589] spi: rockchip: fix controller deregistration
Quoted 38 lines · Ben Hutchings
Quoted 37 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit
53e7a16070feb7d1d4d81a583eaac5e25048b9c3upstream.Make sure to deregister the controller before freeing underlying resources like DMA channels during driver unbind.
Fixes 64e36824b32b ("spi/rockchip: add driver for Rockchip RK3xxx SoCs integrated SPI")Cc [email protected] # 3.17Cc addy ke <[email protected]>Signed-off-by Johan Hovold <[email protected]>Signed-off-by Mark Brown <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/spi/spi-rockchip.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/spi/spi-rockchip.c +1
-1@@ -792,7 +792,7 @@ static int rockchip_spi_probe(struct pla ctlr->can_dma = rockchip_spi_can_dma; } - ret =devm_spi_register_controller (&pdev->dev, ctlr); + ret =spi_register_controller (ctlr);if (ret <0 ) {dev_err (&pdev->dev,"Failed to register controller\n" ); goto err_free_dma_rx;@@ -828,6 +828,8 @@ static int rockchip_spi_remove(struct plclk_disable_unprepare (rs->spiclk);clk_disable_unprepare (rs->apb_pclk);
Quoted 3 lines
drivers/spi/spi-rockchip.c static int rockchip_spi_remove(struct pl · line 831
Quoted 1 line
drivers/spi/spi-rockchip.c +1
-0+spi_unregister_controller (ctlr);This needs to be inserted above the clk_disable_unprepare()s.
Ick, ok, let me drop this for now.
Greg Kroah-Hartman
maintainerPATCH 211/589 net/sched: sch_red: Replace direct dequeue call with peek and qdisc_dequeue_peeked
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
commit 458d5615272d3de535748342eb68ca492343048c upstream.
When red qdisc has children (eg qfq qdisc) whose peek() callback is qdisc_peek_dequeued(), we could get a kernel panic. When the parent of such qdiscs (eg illustrated in patch #3 as tbf) wants to retrieve an skb from its child (red in this case), it will do the following:
1a. do a peek() - and when sensing there's an skb the child can offer, then
- the child in this case(red) calls its child's (qfq) peek. qfq does the right thing and will return the gso_skb queue packet.
Note: if there wasnt a gso_skb entry then qfq will store it there.
1b. invoke a dequeue() on the child (red). And herein lies the problem.
- red will call the child's dequeue() which will essentially just try to grab something of qfq's queue.
[ 78.667668][ T363] KASAN: null-ptr-deref in range [0x0000000000000048-0x000000000000004f] [ 78.667927][ T363] CPU: 1 UID: 0 PID: 363 Comm: ping Not tainted 7.1.0-rc1-00033-g46f74a3f7d57-dirty #790 PREEMPT(full) [ 78.668263][ T363] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 [ 78.668486][ T363] RIP: 0010:qfq_dequeue+0x446/0xc90 [sch_qfq] [ 78.668718][ T363] Code: 54 c0 e8 dd 90 00 f1 48 c7 c7 e0 03 54 c0 48 89 de e8 ce 90 00 f1 48 8d 7b 48 b8 ff ff 37 00 48 89 fa 48 c1 e0 2a 48 c1 ea 03 <80> 3c 02 00 74 05 e8 ef a1 e1 f1 48 8b 7b 48 48 8d 54 24 58 48 8d [ 78.669312][ T363] RSP: 0018:ffff88810de573e0 EFLAGS: 00010216 [ 78.669533][ T363] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000000 [ 78.669790][ T363] RDX: 0000000000000009 RSI: 0000000000000004 RDI: 0000000000000048 [ 78.670044][ T363] RBP: ffff888110dc4000 R08: ffffffffb1b0885a R09: fffffbfff6ba9078 [ 78.670297][ T363] R10: 0000000000000003 R11: ffff888110e31c80 R12: 0000001880000000 [ 78.670560][ T363] R13: ffff888110dc4150 R14: ffff888110dc42b8 R15: 0000000000000200 [ 78.670814][ T363] FS: 00007f66a8f09c40(0000) GS:ffff888163428000(0000) knlGS:0000000000000000 [ 78.671110][ T363] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 78.671324][ T363] CR2: 000055db4c6a30a8 CR3: 000000010da67000 CR4: 0000000000750ef0 [ 78.671585][ T363] PKRU: 55555554 [ 78.671713][ T363] Call Trace: [ 78.671843][ T363] <TASK> [ 78.671936][ T363] ? __pfx_qfq_dequeue+0x10/0x10 [sch_qfq] [ 78.672148][ T363] ? __pfx__printk+0x10/0x10 [ 78.672322][ T363] ? srso_alias_return_thunk+0x5/0xfbef5 [ 78.672496][ T363] ? lockdep_hardirqs_on_prepare+0xa8/0x1a0 [ 78.672706][ T363] ? srso_alias_return_thunk+0x5/0xfbef5 [ 78.672875][ T363] ? trace_hardirqs_on+0x19/0x1a0 [ 78.673047][ T363] red_dequeue+0x65/0x270 [sch_red] [ 78.673217][ T363] ? srso_alias_return_thunk+0x5/0xfbef5 [ 78.673385][ T363] tbf_dequeue.cold+0xb0/0x70c [sch_tbf] [ 78.673566][ T363] __qdisc_run+0x169/0x1900
The right thing to do in #1b is to grab the skb off gso_skb queue. This patchset fixes that issue by changing #1b to use qdisc_dequeue_peeked() method instead.
--- net/sched/sch_red.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_red.c +1 -1
@@ -153,7 +153,7 @@ static struct sk_buff *red_dequeue(strucstruct red_sched_data *q =qdisc_priv (sch);struct Qdisc *child = q->qdisc; - skb = child->dequeue (child); + skb =qdisc_dequeue_peeked (child);if (skb) {qdisc_bstats_update (sch, skb);qdisc_qstats_backlog_dec (sch, skb);
Re: [PATCH 5.10 211/589] net/sched: sch_red: Replace direct dequeue call with peek and qdisc_dequeue_peeked
Quoted 4 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
Quoted 8 lines
From: Jamal Hadi Salim <[email protected]>
commit
458d5615272d3de535748342eb68ca492343048cupstream.When red qdisc has children (eg qfq qdisc) whose
peek()callback isqdisc_peek_dequeued(), we could get a kernel panic. When the parent of such qdiscs (eg illustrated in patch #3 as tbf) wants to retrieve an skb from its child (red in this case), it will do the following:
The same bug exists in sch_sfb and was fixed by commit 1b9bc71153b0 "net/sched: sch_sfb: Replace direct dequeue call with peek and qdisc_dequeue_peeked", so please also pick that for stable.
(From a very brief scan it seems like sch_multiq and sch_taprio might also have this bug, but perhaps they have restrictions that make this impossible.)
Ben.
Quoted 65 lines
1a. do a
peek()- and when sensing there's an skb the child can offer, then
- the child in this case(red) calls its child's (qfq) peek. qfq does the right thing and will return thegso_skbqueue packet.
Note: if there wasnt agso_skbentry then qfq will store it there.
1b. invoke adequeue()on the child (red). And herein lies the problem.
- red will call the child'sdequeue()which will essentially just try to grab something of qfq's queue.[ 78.667668][ T363] KASAN: null-ptr-deref in range [0x0000000000000048-0x000000000000004f] [ 78.667927][ T363] CPU: 1 UID: 0 PID: 363 Comm: ping Not tainted 7.1.0-rc1-00033-g46f74a3f7d57-dirty #790 PREEMPT(full) [ 78.668263][ T363] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 [ 78.668486][ T363] RIP: 0010:qfq_dequeue+0x446/0xc90 [sch_qfq] [ 78.668718][ T363] Code: 54 c0 e8 dd 90 00 f1 48 c7 c7 e0 03 54 c0 48 89 de e8 ce 90 00 f1 48 8d 7b 48 b8 ff ff 37 00 48 89 fa 48 c1 e0 2a 48 c1 ea 03 <80> 3c 02 00 74 05 e8 ef a1 e1 f1 48 8b 7b 48 48 8d 54 24 58 48 8d [ 78.669312][ T363] RSP: 0018:ffff88810de573e0 EFLAGS: 00010216 [ 78.669533][ T363] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000000 [ 78.669790][ T363] RDX: 0000000000000009 RSI: 0000000000000004 RDI: 0000000000000048 [ 78.670044][ T363] RBP: ffff888110dc4000 R08: ffffffffb1b0885a R09: fffffbfff6ba9078 [ 78.670297][ T363] R10: 0000000000000003 R11: ffff888110e31c80 R12: 0000001880000000 [ 78.670560][ T363] R13: ffff888110dc4150 R14: ffff888110dc42b8 R15: 0000000000000200 [ 78.670814][ T363] FS: 00007f66a8f09c40(0000) GS:ffff888163428000(0000) knlGS:0000000000000000 [ 78.671110][ T363] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 78.671324][ T363] CR2: 000055db4c6a30a8 CR3: 000000010da67000 CR4: 0000000000750ef0 [ 78.671585][ T363] PKRU: 55555554 [ 78.671713][ T363] Call Trace: [ 78.671843][ T363] <TASK> [ 78.671936][ T363] ? __pfx_qfq_dequeue+0x10/0x10 [sch_qfq] [ 78.672148][ T363] ? __pfx__printk+0x10/0x10 [ 78.672322][ T363] ? srso_alias_return_thunk+0x5/0xfbef5 [ 78.672496][ T363] ? lockdep_hardirqs_on_prepare+0xa8/0x1a0 [ 78.672706][ T363] ? srso_alias_return_thunk+0x5/0xfbef5 [ 78.672875][ T363] ? trace_hardirqs_on+0x19/0x1a0 [ 78.673047][ T363] red_dequeue+0x65/0x270 [sch_red] [ 78.673217][ T363] ? srso_alias_return_thunk+0x5/0xfbef5 [ 78.673385][ T363] tbf_dequeue.cold+0xb0/0x70c [sch_tbf] [ 78.673566][ T363] __qdisc_run+0x169/0x1900The right thing to do in #1b is to grab the skb off
gso_skbqueue. This patchset fixes that issue by changing #1b to useqdisc_dequeue_peeked()method instead.Fixes 77be155cba4e ("pkt_sched: Add peek emulation for non-work-conserving qdiscs.")Reported-by Manas <[email protected]>Reported-by Rakshit Awasthi <[email protected]>Signed-off-by Jamal Hadi Salim <[email protected]>Reviewed-by Eric Dumazet <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- net/sched/sch_red.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/sched/sch_red.c +1
-1@@ -153,7 +153,7 @@ static struct sk_buff *red_dequeue(strucstruct red_sched_data *q =qdisc_priv (sch);struct Qdisc *child = q->qdisc; - skb = child->dequeue (child); + skb =qdisc_dequeue_peeked (child);if (skb) {qdisc_bstats_update (sch, skb);qdisc_qstats_backlog_dec (sch, skb);
Signature · 4 lines
Ben Hutchings
The obvious mathematical breakthrough [to break modern encryption]
would be development of an easy way to factor large prime numbers.
- Bill GatesGreg Kroah-Hartman
maintainerRe: [PATCH 5.10 211/589] net/sched: sch_red: Replace direct dequeue call with peek and qdisc_dequeue_peeked
Quoted 9 lines · Ben Hutchings
Quoted 8 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
commit
458d5615272d3de535748342eb68ca492343048cupstream.
Quoted 8 lines
Quoted 4 lines
When red qdisc has children (eg qfq qdisc) whose
peek()callback isqdisc_peek_dequeued(), we could get a kernel panic. When the parent of such qdiscs (eg illustrated in patch #3 as tbf) wants to retrieve an skb from its child (red in this case), it will do the following:The same bug exists in
sch_sfband was fixed by commit1b9bc71153b0"net/sched:sch_sfb: Replace direct dequeue call with peek andqdisc_dequeue_peeked", so please also pick that for stable.
We can for the next round of releases.
thanks,
greg k-h
Sasha Levin
maintainerRe: [PATCH 5.10 211/589] net/sched: sch_red: Replace direct dequeue call with peek and qdisc_dequeue_peeked
In reply to Ben HutchingsQuoted 2 lines · Ben Hutchings
The same fix is needed for
sch_sfb:1b9bc71153b0"net/sched:sch_sfb:
Replace direct dequeue call with peek andqdisc_dequeue_peeked".
Now queued from mainline (1b9bc71153b0) for all active trees: 7.0.y, 6.18.y, 6.12.y, 6.6.y, 6.1.y, 5.15.y and 5.10.y.
Thanks for the catch.
--
Thanks,
Sasha
Greg Kroah-Hartman
maintainerPATCH 212/589 ipmi:ssif: Fix a shutdown race
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Corey Minyard <[email protected]>
It was possible for the SSIF thread to stop and quit before the kthread_stop() call because ssif->stopping was set before the stop. So only exit the SSIF thread is kthread_should_stop() returns true.
In the mainstream kernel this was fixed in 6bd0eb6d759b ("ipmi:ssif:
Fix a shutdown race"). However, that requires a fix in kernel version 6.1 has a fix to kthread stop to cause interruptible waits to return -ERESTARTSYS on a stop. This has not been backported to older kernels, and that would probably be a bad idea. But it means that the mainstrem kernel fix for this will not work.
Instead, wait for kthread_should_stop() to return true before exiting the thread.
--- drivers/char/ipmi/ipmi_ssif.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/char/ipmi/ipmi_ssif.c +10 -0
@@ -522,6 +522,16 @@ static int ipmi_ssif_thread(void *data) } } +/* +* The thread can break out of the loop if stopping is set, +* and this can be before kthread_stop() gets called and thus +* kthread_should_stop() will not be set. This can cause +* spinning calling this function and other bad things. So +* wait for kthread_should_stop() to be set. +*/ +while (!kthread_should_stop ()) +msleep_interruptible (1 ); +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 213/589 ipmi:ssif: Clean up kthread on errors
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Corey Minyard <[email protected]>
commit 75c486cb1bcaa1a3ec3a6438498176a3a4998ae4 upstream.
If an error occurs after the ssif kthread is created, but before the main IPMI code starts the ssif interface, the ssif kthread will not be stopped.
So make sure the kthread is stopped on an error condition if it is running.
--- drivers/char/ipmi/ipmi_ssif.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/char/ipmi/ipmi_ssif.c +12 -0
@@ -1311,6 +1311,7 @@ static void shutdown_ssif(void *send_info)if (ssif_info->thread) {complete (&ssif_info->wake_thread);kthread_stop (ssif_info->thread); + ssif_info->thread =NULL ; } }
@@ -1941,6 +1942,17 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id) out:if (rv) { +/* +* If ipmi_register_smi() starts the interface, it will +* call shutdown and that will free the thread and set +* it to NULL. Otherwise it must be freed here. +*/ +if (ssif_info->thread) { + ssif_info->stopping = true; +complete (&ssif_info->wake_thread); +kthread_stop (ssif_info->thread); + ssif_info->thread =NULL ; + }if (addr_info) addr_info->client =NULL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 214/589 ipmi:ssif: Remove unnecessary indention
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Corey Minyard <[email protected]>
commit 91eb7ec7261254b6875909df767185838598e21e upstream.
A section was in {} that didn't need to be, move the variable definition to the top and set th eindentino properly.
--- drivers/char/ipmi/ipmi_ssif.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-)
drivers/char/ipmi/ipmi_ssif.c +12 -16
@@ -1694,6 +1694,7 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)int len;int i;u8 slave_addr =0 ; +unsigned int thread_num;struct ssif_addr_info *addr_info =NULL ;mutex_lock (&ssif_infos_mutex);
@@ -1902,22 +1903,17 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id) ssif_info->handlers.request_events = request_events; ssif_info->handlers.set_need_watch = ssif_set_need_watch; - { -unsigned int thread_num; - - thread_num = ((i2c_adapter_id (ssif_info->client->adapter) - <<8 ) | - ssif_info->client->addr); -init_completion (&ssif_info->wake_thread); - ssif_info->thread =kthread_run (ipmi_ssif_thread, ssif_info, -"kssif%4.4x" , thread_num); -if (IS_ERR (ssif_info->thread)) { - rv =PTR_ERR (ssif_info->thread); -dev_notice (&ssif_info->client->dev, -"Could not start kernel thread: error %d\n" , - rv); - goto out; - } + thread_num = ((i2c_adapter_id (ssif_info->client->adapter) <<8 ) | + ssif_info->client->addr); +init_completion (&ssif_info->wake_thread); + ssif_info->thread =kthread_run (ipmi_ssif_thread, ssif_info, +"kssif%4.4x" , thread_num); +if (IS_ERR (ssif_info->thread)) { + rv =PTR_ERR (ssif_info->thread); +dev_notice (&ssif_info->client->dev, +"Could not start kernel thread: error %d\n" , + rv); + goto out; }dev_set_drvdata (&ssif_info->client->dev, ssif_info);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 215/589 ipmi:ssif: NULL thread on error
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Corey Minyard <[email protected]>
commit a8aebe93a4938c0ca1941eeaae821738f869be3d upstream.
Cleanup code was checking the thread for NULL, but it was possibly a PTR_ERR() in one spot.
Spotted with static analysis.
--- drivers/char/ipmi/ipmi_ssif.c | 1 + 1 file changed, 1 insertion(+)
drivers/char/ipmi/ipmi_ssif.c +1 -0
@@ -1910,6 +1910,7 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id) "kssif%4.4x", thread_num);if (IS_ERR (ssif_info->thread)) { rv =PTR_ERR (ssif_info->thread); + ssif_info->thread =NULL ;dev_notice (&ssif_info->client->dev,"Could not start kernel thread: error %d\n" , rv);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 216/589 wifi: b43legacy: enforce bounds check on firmware key index in RX path
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tristan Madani <[email protected]>
commit a035766f970bde2d4298346a31a80685be5c0205 upstream.
Same fix as b43: the firmware-controlled key index in b43legacy_rx() can exceed dev->max_nr_keys. The existing B43legacy_WARN_ON is non-enforcing in production builds, allowing an out-of-bounds read of dev->key[].
Make the check enforcing by dropping the frame for invalid indices.
--- drivers/net/wireless/broadcom/b43legacy/xmit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/b43legacy/xmit.c +2 -1
@@ -476,7 +476,8 @@ void b43legacy_rx(struct b43legacy_wldev* key index, but the ucode passed it slightly different. */ keyidx =b43legacy_kidx_to_raw (dev, keyidx); -B43legacy_WARN_ON (keyidx >= dev->max_nr_keys); +if (B43legacy_WARN_ON (keyidx >= dev->max_nr_keys)) + goto drop;if (dev->key[keyidx].algorithm != B43legacy_SEC_ALGO_NONE) {/* Remove PROTECTED flag to mark it as decrypted. */
Greg Kroah-Hartman
maintainerPATCH 217/589 wifi: rsi: fix kthread lifetime race between self-exit and external-stop
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeongjun Park <[email protected]>
commit db57a1aa54ff68669781976e4edb045e09e2b65b upstream.
RSI driver use both self-exit(kthread_complete_and_exit) and external-stop (kthread_stop) when killing a kthread. Generally, kthread_stop() is called first, and in this case, no particular issues occur.
However, in rare instances where kthread_complete_and_exit() is called first and then kthread_stop() is called, a UAF occurs because the kthread object, which has already exited and been freed, is accessed again.
Therefore, to prevent this with minimal modification, you must remove kthread_stop() and change the code to wait until the self-exit operation is completed.
--- drivers/net/wireless/rsi/rsi_common.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/rsi/rsi_common.h +2 -3
@@ -70,12 +70,11 @@ static inline int rsi_create_kthread(strreturn 0 ; } -static inline int rsi_kill_thread (struct rsi_thread *handle) +static inline void rsi_kill_thread (struct rsi_thread *handle) {atomic_inc (&handle->thread_done);rsi_set_event (&handle->event); - -return kthread_stop (handle->task); +wait_for_completion (&handle->completion); }void rsi_mac80211_detach (struct rsi_hw *hw);
Greg Kroah-Hartman
maintainerPATCH 218/589 wifi: ath5k: do not access array OOB
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Slaby (SUSE) <[email protected]>
commit d748603f12baff112caa3ab7d39f50100f010dbd upstream.
Vincent reports:
Quoted 12 lines
The ath5k driver seems to do an array-index-out-of-bounds access as shown by the UBSAN kernel message:
UBSAN: array-index-out-of-bounds in drivers/net/wireless/ath/ath5k/base.c:1741:20 index 4 is out of range for type 'ieee80211_tx_rate [4]' ... Call Trace: <TASK> dump_stack_lvl+0x5d/0x80 ubsan_epilogue+0x5/0x2b __ubsan_handle_out_of_bounds.cold+0x46/0x4b ath5k_tasklet_tx+0x4e0/0x560 [ath5k] tasklet_action_common+0xb5/0x1c0
It is real. 'ts->ts_final_idx' can be 3 on 5212, so:
info->status.rates[ts->ts_final_idx + 1].idx = -1;
with the array defined as:
struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
while the size is:
#define IEEE80211_TX_MAX_RATES 4
is indeed bogus.
Set this 'idx = -1' sentinel only if the array index is less than the array size. As mac80211 will not look at rates beyond the size (IEEE80211_TX_MAX_RATES).
Note: The effect of the OOB write is negligible. It just overwrites the next member of info->status, i.e. ack_signal.
--- drivers/net/wireless/ath/ath5k/base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath5k/base.c +2 -1
@@ -1693,7 +1693,8 @@ ath5k_tx_frame_completed(struct ath5k_hw } info->status.rates[ts->ts_final_idx].count = ts->ts_final_retry; - info->status.rates[ts->ts_final_idx +1 ].idx =-1 ; +if (ts->ts_final_idx +1 <IEEE80211_TX_MAX_RATES ) + info->status.rates[ts->ts_final_idx +1 ].idx =-1 ;if (unlikely (ts->ts_status)) { ah->stats.ack_fail++;
Greg Kroah-Hartman
maintainerPATCH 219/589 wifi: b43: enforce bounds check on firmware key index in b43_rx()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tristan Madani <[email protected]>
commit 1f4f78bf8549e6ac4f04fba4176854f3a6e0c332 upstream.
The firmware-controlled key index in b43_rx() can exceed the dev->key[] array size (58 entries). The existing B43_WARN_ON is non-enforcing in production builds, allowing an out-of-bounds read.
Make the B43_WARN_ON check enforcing by dropping the frame when the firmware returns an invalid key index.
--- drivers/net/wireless/broadcom/b43/xmit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/b43/xmit.c +2 -1
@@ -702,7 +702,8 @@ void b43_rx(struct b43_wldev *dev, struc* key index, but the ucode passed it slightly different. */ keyidx =b43_kidx_to_raw (dev, keyidx); -B43_WARN_ON (keyidx >=ARRAY_SIZE (dev->key)); +if (B43_WARN_ON (keyidx >=ARRAY_SIZE (dev->key))) + goto drop;if (dev->key[keyidx].algorithm !=B43_SEC_ALGO_NONE ) { wlhdr_len =ieee80211_hdrlen (fctl);
Greg Kroah-Hartman
maintainerPATCH 220/589 usb: usblp: fix heap leak in IEEE 1284 device ID via short response
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 7a400c6fe3617e31e690e3f7ca37bb335e0498f3 upstream.
usblp_ctrl_msg() collapses the usb_control_msg() return value to 0/-errno, discarding the actual number of bytes transferred. A broken printer can complete the GET_DEVICE_ID control transfer short and the driver has no way to know.
usblp_cache_device_id_string() reads the 2-byte big-endian length prefix from the response and trusts it (clamped only to the buffer bounds). The buffer is kmalloc(1024) at probe time. A device that sends exactly two bytes (e.g. 0x03 0xFF, claiming a 1023-byte ID) leaves device_id_string[2..1022] holding stale kmalloc heap.
That stale data is then exposed:
- via the ieee1284_id sysfs attribute (sprintf("%s", buf+2), truncated at the first NUL in the stale heap), and
- via the IOCNR_GET_DEVICE_ID ioctl, which copy_to_user()s the full claimed length regardless of NULs, up to 1021 bytes of uninitialized heap, with the leak size chosen by the device.
Fix this up by just zapping the buffer with zeros before each request sent to the device.
--- drivers/usb/class/usblp.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/class/usblp.c +1 -0
@@ -1365,6 +1365,7 @@ static int usblp_cache_device_id_string( {int err, length; +memset (usblp->device_id_string,0 ,USBLP_DEVICE_ID_SIZE ); err =usblp_get_id (usblp,0 , usblp->device_id_string,USBLP_DEVICE_ID_SIZE -1 );if (err <0 ) { dev_dbg(&usblp->intf->dev,
Greg Kroah-Hartman
maintainerPATCH 221/589 usb: usblp: fix uninitialized heap leak via LPGETSTATUS ioctl
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit b38e53cbfb9d84732e5984fbd73e128d592415c5 upstream.
Just like in a previous problem in this driver, usblp_ctrl_msg() will collapse the usb_control_msg() return value to 0/-errno, discarding the actual number of bytes transferred.
Ideally that short command should be detected and error out, but many printers are known to send "incorrect" responses back so we can't just do that.
statusbuf is kmalloc(8) at probe time and never filled before the first LPGETSTATUS ioctl.
usblp_read_status() requests 1 byte. If a malicious printer responds with zero bytes, *statusbuf is one byte of stale kmalloc heap, sign-extended into the local int status, which the LPGETSTATUS path then copy_to_user()s directly to the ioctl caller.
Fix this all by just zapping out the memory buffer when allocated at probe time. If a later call does a short read, the data will be identical to what the device sent it the last time, so there is no "leak" of information happening.
--- drivers/usb/class/usblp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/class/usblp.c +1 -1
@@ -1166,7 +1166,7 @@ static int usblp_probe(struct usb_interf }/* Allocate buffer for printer status */ - usblp->statusbuf =kmalloc (STATUS_BUF_SIZE ,GFP_KERNEL ); + usblp->statusbuf =kzalloc (STATUS_BUF_SIZE ,GFP_KERNEL );if (!usblp->statusbuf) { retval = -ENOMEM ; goto abort;
Greg Kroah-Hartman
maintainerPATCH 222/589 ALSA: usb-audio: Avoid potential endless loop in convert_chmap_v3()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 6e7247d8f5fefeceb0bb9cc80a5388a636b219cd upstream.
The convert_chmap_v3() has a loop with its increment size of cs_desc->wLength, but we forgot to validate cs_desc->wLength itself, which may lead to potential endless loop by a malformed descriptor.
Add a proper size check to abort the loop for plugging the hole.
--- sound/usb/stream.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/stream.c +2 -0
@@ -353,6 +353,8 @@ snd_pcm_chmap_elem *convert_chmap_v3(strif (len <sizeof (*cs_desc))break ; cs_len =le16_to_cpu (cs_desc->wLength); +if (cs_len <sizeof (*cs_desc)) +break ;if (len < cs_len)break ; cs_type = cs_desc->bSegmentType;
Greg Kroah-Hartman
maintainerPATCH 223/589 ALSA: usb-audio: Fix UAC3 cluster descriptor size check
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
commit 26265dd69da32d88a88d21987853cec899d9e21f upstream.
The UAC3 cluster descriptor length check in snd_usb_get_audioformat_uac3()was added to make sure that the buffer is large enough for a struct uac3_cluster_header_descriptor before the returned data is cast and used.
However, the check uses sizeof(cluster), where cluster is a pointer, not the size of the descriptor header. This makes the validation depend on the architecture pointer size and does not match the intended object size.
Check against sizeof(*cluster) instead.
--- sound/usb/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/stream.c +1 -1
@@ -994,7 +994,7 @@ snd_usb_get_audioformat_uac3(struct snd_* and request Cluster Descriptor */ wLength =le16_to_cpu (hc_header.wLength); -if (wLength <sizeof (cluster)) +if (wLength <sizeof (*cluster))return NULL ; cluster =kzalloc (wLength,GFP_KERNEL );if (!cluster)
Greg Kroah-Hartman
maintainerPATCH 224/589 USB: omap_udc: DMA: Dont enable burst 4 mode
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaro Koskinen <[email protected]>
commit 3f91484f6c13c434bd573ca6b6779c26adb0ddab upstream.
Commit 65111084c63d7 ("USB: more omap_udc updates (dma and omap1710)") added setting for DMA burst 4 mode. But I think this should be undone for two reasons:
- It breaks DMA on 15xx boards - transfers just silently stall.
- On newer OMAP1 boards, like Nokia 770 (omap1710), there is no measurable performance impact when testing TCP throughput with g_ether with large 15000 byte MTU size.
It's also worth noting that when the original change was made, the OMAP_DMA_DATA_BURST_4 handling in arch/arm/plat-omap/dma.c was broken, and actually resulted in the same as the OMAP_DMA_DATA_BURST_DIS i.e. burst disabled. This was fixed not until a couple kernel releases later in an unrelated commit 1a8bfa1eb998a ("[ARM] 3142/1: OMAP 2/5: Update files common to omap1 and omap2").
So based on this it seems there was never really a very good reason to enable this burst mode in omap_udc, so remove it now to allow 15xx DMA to work again (it provides 2x throughput compared to PIO mode).
--- drivers/usb/gadget/udc/omap_udc.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/usb/gadget/udc/omap_udc.c +0 -4
@@ -731,8 +731,6 @@ static void dma_channel_claim(struct omaif (status ==0 ) {omap_writew (reg,UDC_TXDMA_CFG );/* EMIFF or SDRC */ -omap_set_dma_src_burst_mode (ep->lch, -OMAP_DMA_DATA_BURST_4 );omap_set_dma_src_data_pack (ep->lch,1 );/* TIPB */ omap_set_dma_dest_params(ep->lch,
@@ -754,8 +752,6 @@ static void dma_channel_claim(struct omaUDC_DATA_DMA , 0, 0);/* EMIFF or SDRC */ -omap_set_dma_dest_burst_mode (ep->lch, -OMAP_DMA_DATA_BURST_4 );omap_set_dma_dest_data_pack (ep->lch,1 ); } }
Greg Kroah-Hartman
maintainerPATCH 225/589 USB: serial: option: add Telit Cinterion LE910Cx compositions
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Porcedda <[email protected]>
commit 100201d349edd226ca3470c894c92dccc67ee7a8 upstream.
Add the following Telit Cinterion LE910Cx compositions:
0x1251: RNDIS + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (SAP)
T: Bus=01 Lev=01 Prnt=21 Port=06 Cnt=01 Dev#=108 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=1251 Rev=03.18 S: Manufacturer=Android S: Product=LE910C1-EU S: SerialNumber=0123456789ABCDEF C: #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=02 Prot=ff Driver=rndis_host E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
0x1253: ECM + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (SAP)
T: Bus=01 Lev=01 Prnt=21 Port=06 Cnt=01 Dev#=121 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=1253 Rev=03.18 S: Manufacturer=Android S: Product=LE910C1-EU S: SerialNumber=0123456789ABCDEF C: #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether E: Ad=82(I) Atr=03(Int.) MxPS= 16 Ivl=32ms I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
0x1254: tty (AT) + tty (AT)
T: Bus=01 Lev=01 Prnt=21 Port=06 Cnt=01 Dev#=122 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=1254 Rev=03.18 S: Manufacturer=Android S: Product=LE910C1-EU S: SerialNumber=0123456789ABCDEF C: #Ifs= 2 Cfg#= 1 Atr=a0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
0x1255: tty (AT/NMEA) + tty (AT) + tty (AT) + tty (SAP)
T: Bus=01 Lev=01 Prnt=21 Port=06 Cnt=01 Dev#=123 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=1255 Rev=03.18 S: Manufacturer=Android S: Product=LE910C1-EU S: SerialNumber=0123456789ABCDEF C: #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
--- drivers/usb/serial/option.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/serial/option.c +4 -0
@@ -1513,7 +1513,11 @@ static const struct usb_device_id option { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1231, 0xff), /* Telit LE910Cx (RNDIS) */ .driver_info = NCTRL(2) | RSVD(3) }, { USB_DEVICE_AND_INTERFACE_INFO(TELIT_VENDOR_ID, 0x1250, 0xff, 0x00, 0x00) }, /* Telit LE910Cx (rmnet) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1251, 0xff) }, /* Telit LE910Cx (RNDIS) */ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1252, 0xff) }, /* Telit LE910Cx (MBIM) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1253, 0xff) }, /* Telit LE910Cx (ECM) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1254, 0xff) }, /* Telit LE910Cx */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1255, 0xff) }, /* Telit LE910Cx */ { USB_DEVICE(TELIT_VENDOR_ID, 0x1260), .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, { USB_DEVICE(TELIT_VENDOR_ID, 0x1261),
Greg Kroah-Hartman
maintainerPATCH 226/589 usb: ulpi: fix memory leak on ulpi_register() error paths
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Gu <[email protected]>
commit 0b9fcab1b8608d429e5f239afb197de928d4de7d upstream.
Commit 01af542392b5 ("usb: ulpi: fix double free in ulpi_register_interface() error path") removed kfree(ulpi) from ulpi_register_interface() to fix a double-free when device_register() fails.
But when ulpi_of_register() or ulpi_read_id() fail before device_register() is called, the ulpi allocation is leaked.
Add kfree(ulpi) on both error paths to properly clean up the allocation.
--- drivers/usb/common/ulpi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/common/ulpi.c +4 -1
@@ -246,12 +246,15 @@ static int ulpi_register(struct device *ACPI_COMPANION_SET (&ulpi->dev,ACPI_COMPANION (dev)); ret =ulpi_of_register (ulpi); -if (ret) +if (ret) { +kfree (ulpi);return ret; + } ret =ulpi_read_id (ulpi);if (ret) {of_node_put (ulpi->dev.of_node); +kfree (ulpi);return ret; }
Greg Kroah-Hartman
maintainerPATCH 227/589 ALSA: firewire-tascam: Do not drop unread control events
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
commit 0749daa8eb5ab90334aaad3b0671efd7150d43b1 upstream.
tscm_hwdep_read_queue() copies as many queued control events as fit in the userspace buffer. When the buffer is smaller than the current contiguous queue segment, length is rounded down to the number of bytes that can be copied.
However, after copying that shortened length, the code advances pull_pos to the original tail_pos, marking the whole contiguous segment as consumed. Any events between the copied portion and tail_pos are lost.
Limit tail_pos to the position after the entries actually copied before updating pull_pos. When the whole segment fits, this is equivalent to the old tail_pos update; when the buffer is smaller, the remaining events stay queued for the next read.
--- sound/firewire/tascam/tascam-hwdep.c | 1 + 1 file changed, 1 insertion(+)
sound/firewire/tascam/tascam-hwdep.c +1 -0
@@ -73,6 +73,7 @@ static long tscm_hwdep_read_queue(struct length =rounddown (remained,sizeof (*entries));if (length ==0 )break ; + tail_pos = head_pos + length /sizeof (*entries);spin_unlock_irq (&tscm->lock);if (copy_to_user (pos, &entries[head_pos], length))
Greg Kroah-Hartman
maintainerPATCH 228/589 xfrm: provide message size for XFRM_MSG_MAPPING
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruijie Li <[email protected]>
commit 28465227c80fe417b4013c432be1f3737cb9f9a3 upstream.
The compat 64=>32 translation path handles XFRM_MSG_MAPPING, but xfrm_msg_min[] does not provide the native payload size for this message type.
Add the missing XFRM_MSG_MAPPING entry so compat translation can size and translate mapping notifications correctly.
--- net/xfrm/xfrm_user.c | 1 + 1 file changed, 1 insertion(+)
net/xfrm/xfrm_user.c +1 -0
@@ -2727,6 +2727,7 @@ const int xfrm_msg_min[XFRM_NR_MSGTYPES] [XFRM_MSG_GETSADINFO - XFRM_MSG_BASE] = sizeof(u32), [XFRM_MSG_NEWSPDINFO - XFRM_MSG_BASE] = sizeof(u32), [XFRM_MSG_GETSPDINFO - XFRM_MSG_BASE] = sizeof(u32), + [XFRM_MSG_MAPPING - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_mapping), [XFRM_MSG_SETDEFAULT - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_default), [XFRM_MSG_GETDEFAULT - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_default), };
Greg Kroah-Hartman
maintainerPATCH 229/589 ipv6: xfrm6: release dst on error in xfrm6_rcv_encap()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yilin Zhu <[email protected]>
commit bc0fcb9823cd0894934cf968b525c575833d7078 upstream.
xfrm6_rcv_encap() performs an IPv6 route lookup when the skb does not already have a dst attached. ip6_route_input_lookup() returns a referenced dst entry even when the lookup resolves to an error route.
If dst->error is set, xfrm6_rcv_encap() drops the skb without attaching the dst to the skb and without releasing the reference returned by the lookup. Repeated packets hitting this path therefore leak dst entries.
Release the dst before jumping to the drop path.
--- net/ipv6/xfrm6_protocol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv6/xfrm6_protocol.c +3 -1
@@ -88,8 +88,10 @@ int xfrm6_rcv_encap(struct sk_buff *skb, dst =ip6_route_input_lookup (dev_net (skb->dev), skb->dev, &fl6, skb, flags); -if (dst->error) +if (dst->error) { +dst_release (dst); goto drop; + }skb_dst_set (skb, dst); }
Greg Kroah-Hartman
maintainerPATCH 230/589 Bluetooth: L2CAP: Fix null-ptr-deref in l2cap_sock_new_connection_cb()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siwei Zhang <[email protected]>
commit 0a120d96166301d7a95be75b52f843837dbd1219 upstream.
Add the same NULL guard already present inl2cap_sock_resume_cb() and l2cap_sock_ready_cb().
--- net/bluetooth/l2cap_sock.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/l2cap_sock.c +3 -0
@@ -1455,6 +1455,9 @@ static struct l2cap_chan *l2cap_sock_new {struct sock *sk, *parent = chan->data; +if (!parent) +return NULL ; +lock_sock (parent);/* Check for backlog size */
Greg Kroah-Hartman
maintainerPATCH 231/589 Bluetooth: L2CAP: Fix null-ptr-deref in l2cap_sock_state_change_cb()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siwei Zhang <[email protected]>
commit 2ff1a41a912de8517b4482e946dd951b7d80edbf upstream.
Add the same NULL guard already present inl2cap_sock_resume_cb() and l2cap_sock_ready_cb().
--- net/bluetooth/l2cap_sock.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/l2cap_sock.c +3 -0
@@ -1599,6 +1599,9 @@ static void l2cap_sock_state_change_cb(s {struct sock *sk = chan->data; +if (!sk) +return ; + sk->sk_state = state;if (err)
Greg Kroah-Hartman
maintainerPATCH 232/589 spi: zynqmp-gqspi: fix controller deregistration
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 6895fc4faafc9082e15e4e624b23dd5f0c98feb5 upstream.
Make sure to deregister the controller before disabling underlying resources like clocks during driver unbind.
--- drivers/spi/spi-zynqmp-gqspi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/spi/spi-zynqmp-gqspi.c +3 -1
@@ -1175,7 +1175,7 @@ static int zynqmp_qspi_probe(struct platSPI_TX_DUAL |SPI_TX_QUAD ; ctlr->dev.of_node = np; - ret =devm_spi_register_controller (&pdev->dev, ctlr); + ret =spi_register_controller (ctlr);if (ret) {dev_err (&pdev->dev,"spi_register_controller failed\n" ); goto clk_dis_all;
@@ -1209,6 +1209,8 @@ static int zynqmp_qspi_remove(struct pla {struct zynqmp_qspi *xqspi =platform_get_drvdata (pdev); +spi_unregister_controller (xqspi->ctlr); +zynqmp_gqspi_write (xqspi,GQSPI_EN_OFST ,0x0 );clk_disable_unprepare (xqspi->refclk);clk_disable_unprepare (xqspi->pclk);
Greg Kroah-Hartman
maintainerPATCH 233/589 fanotify: fix false positive on permission events
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit 7746e3bd4cc19b5092e00d32d676e329bfcb6900 upstream.
fsnotify_get_mark_safe() may return false for a mark on an unrelated group, which results in bypassing the permission check.
Fix by skipping over detached marks that are not in the current group.
--- fs/notify/fsnotify.c | 2 +- fs/notify/mark.c | 18 +++++++++++------- include/linux/fsnotify_backend.h | 1 + 3 files changed, 13 insertions(+), 8 deletions(-)
fs/notify/fsnotify.c +1 -1
@@ -398,7 +398,7 @@ static struct fsnotify_mark *fsnotify_fi return hlist_entry_safe(node, struct fsnotify_mark, obj_list); } -static struct fsnotify_mark *fsnotify_next_mark (struct fsnotify_mark *mark) +struct fsnotify_mark *fsnotify_next_mark (struct fsnotify_mark *mark) {struct hlist_node *node =NULL ;
fs/notify/mark.c +11 -7
@@ -380,9 +380,6 @@ EXPORT_SYMBOL_GPL(fsnotify_put_mark);*/ static bool fsnotify_get_mark_safe (struct fsnotify_mark *mark) { -if (!mark) -return true; -if (refcount_inc_not_zero (&mark->refcnt)) {spin_lock (&mark->lock);if (mark->flags &FSNOTIFY_MARK_FLAG_ATTACHED ) {
@@ -423,15 +420,22 @@ bool fsnotify_prepare_user_wait(struct fint type;fsnotify_foreach_iter_type (type) { +struct fsnotify_mark *mark = iter_info->marks[type]; +/* This can fail if mark is being removed */ -if (!fsnotify_get_mark_safe (iter_info->marks[type])) { -__release (&fsnotify_mark_srcu); - goto fail; +while (mark && !fsnotify_get_mark_safe (mark)) { +if (mark->group == iter_info->current_group) { +__release (&fsnotify_mark_srcu); + goto fail; + } +/* This is a mark in an unrelated group, skip */ + mark =fsnotify_next_mark (mark); + iter_info->marks[type] = mark; } }/* -* Now that both marks are pinned by refcount in the inode / vfsmount +* Now that all marks are pinned by refcount in the inode / vfsmount / etc * lists, we can drop SRCU lock, and safely resume the list iteration * once userspace returns. */
include/linux/fsnotify_backend.h +1 -0
@@ -820,6 +820,7 @@ static inline void fsnotify_clear_sb_mar }extern void fsnotify_get_mark (struct fsnotify_mark *mark);extern void fsnotify_put_mark (struct fsnotify_mark *mark); +struct fsnotify_mark *fsnotify_next_mark (struct fsnotify_mark *mark);extern void fsnotify_finish_user_wait (struct fsnotify_iter_info *iter_info);extern bool fsnotify_prepare_user_wait (struct fsnotify_iter_info *iter_info);
Greg Kroah-Hartman
maintainerPATCH 234/589 net: rtnetlink: zero ifla_vf_broadcast to avoid stack infoleak in rtnl_fill_vfinfo
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai Zen <[email protected]>
commit 4b9e327991815e128ad3af75c3a04630a63ce3e0 upstream.
rtnl_fill_vfinfo() declares struct ifla_vf_broadcast on the stack without initialisation:
struct ifla_vf_broadcast vf_broadcast;
The struct contains a single fixed 32-byte field:
/* include/uapi/linux/if_link.h */
struct ifla_vf_broadcast {
__u8 broadcast[32];
};The function then copies dev->broadcast into it using dev->addr_len as the length:
memcpy(vf_broadcast.broadcast, dev->broadcast, dev->addr_len);
On Ethernet devices (the overwhelming majority of SR-IOV NICs) dev->addr_len is 6, so only the first 6 bytes of broadcast[] are written. The remaining 26 bytes retain whatever was previously on the kernel stack. The full struct is then handed to userspace via:
nla_put(skb, IFLA_VF_BROADCAST,
sizeof(vf_broadcast), &vf_broadcast)
leaking up to 26 bytes of uninitialised kernel stack per VF per RTM_GETLINK request, repeatable.
The other vf_* structs in the same function are explicitly zeroed for exactly this reason - see the memset() calls for ivi, vf_vlan_info, node_guid and port_guid a few lines above. vf_broadcast was simply missed when it was added.
Reachability: any unprivileged local process can open AF_NETLINK / NETLINK_ROUTE without capabilities and send RTM_GETLINK with an IFLA_EXT_MASK attribute carrying RTEXT_FILTER_VF. The kernel walks each VF and emits IFLA_VF_BROADCAST, leaking 26 bytes of stack per VF per request. Stack residue at this call site can include return addresses and transient sensitive data; KASAN with stack instrumentation, or KMSAN, will flag the nla_put() when reproduced.
Zero the on-stack struct before the partial memcpy, matching the existing pattern used for the other vf_* structs in the same function.
--- net/core/rtnetlink.c | 1 + 1 file changed, 1 insertion(+)
net/core/rtnetlink.c +1 -0
@@ -1287,6 +1287,7 @@ static noinline_for_stack int rtnl_fill_ port_guid.vf = ivi.vf;memcpy (vf_mac.mac, ivi.mac,sizeof (ivi.mac)); +memset (&vf_broadcast,0 ,sizeof (vf_broadcast));memcpy (vf_broadcast.broadcast, dev->broadcast, dev->addr_len); vf_vlan.vlan = ivi.vlan; vf_vlan.qos = ivi.qos;
Greg Kroah-Hartman
maintainerPATCH 235/589 sound: ua101: fix division by zero at probe
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeungJu Cheon <[email protected]>
commit d1f73f169c1014463b5060e3f60813e13ddc7b87 upstream.
Add a missing sanity check for bNrChannels in detect_usb_format() to prevent a division by zero in playback_urb_complete() and capture_urb_complete().
USB core does not validate class-specific descriptor fields such as bNrChannels, so drivers must verify them before use. If a device provides bNrChannels = 0, frame_bytes becomes zero and is later used as a divisor in the URB completion handlers, leading to a kernel crash.
--- sound/usb/misc/ua101.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/usb/misc/ua101.c +7 -0
@@ -995,6 +995,13 @@ static int detect_usb_format(struct ua10 ua->capture.channels = fmt_capture->bNrChannels; ua->playback.channels = fmt_playback->bNrChannels; +if (!ua->capture.channels || !ua->playback.channels) { +dev_err (&ua->dev->dev, +"invalid channel count: capture %u, playback %u\n" , + ua->capture.channels, ua->playback.channels); +return -EINVAL ; + } + ua->capture.frame_bytes = fmt_capture->bSubframeSize * ua->capture.channels; ua->playback.frame_bytes =
Greg Kroah-Hartman
maintainerPATCH 236/589 ip6_gre: Use cached t->net in ip6erspan_changelink().
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maoyi Xie <[email protected]>
commit 1d324c2f43f70c965f25c58cc3611c779adbe47e upstream.
After commit 5e72ce3e3980 ("net: ipv6: Use link netns in newlink() of rtnl_link_ops"), ip6erspan_newlink() correctly resolves the per-netns ip6gre hash via link_net. ip6erspan_changelink() was not converted in that series and still uses dev_net(dev), which diverges from the device's creation netns after IFLA_NET_NS_FD migration.
This re-inserts the tunnel into the wrong per-netns hash. The original netns keeps a stale entry. When that netns is later destroyed, ip6gre_exit_rtnl_net() walks the stale entry, producing a slab-use-after-free reported by KASAN, followed by a kernel BUG at net/core/dev.c (LIST_POISON1) in unregister_netdevice_many_notify().
Reachable from an unprivileged user namespace (unshare --user --map-root-user --net).
ip6gre_changelink() earlier in the same file already uses the cached t->net; only ip6erspan_changelink() has the wrong shape.
--- net/ipv6/ip6_gre.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/ipv6/ip6_gre.c +3 -2
@@ -2300,10 +2300,11 @@ static int ip6erspan_changelink(struct nstruct nlattr *data[], struct netlink_ext_ack *extack) { - struct ip6gre_net *ign = net_generic(dev_net(dev), ip6gre_net_id); + struct ip6_tnl *t = netdev_priv(dev);struct __ip6_tnl_parm p; -struct ip6_tnl *t; +struct ip6gre_net *ign; + ign =net_generic (t->net, ip6gre_net_id); t =ip6gre_changelink_common (dev, tb, data, &p, extack);if (IS_ERR (t))return PTR_ERR (t);
Greg Kroah-Hartman
maintainerPATCH 237/589 net/rds: handle zerocopy send cleanup before the message is queued
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nan Li <[email protected]>
commit 44b550d88b267320459d518c0743a241ab2108fa upstream.
A zerocopy send can fail after user pages have been pinned but before the message is attached to the sending socket.
The purge path currently infers zerocopy state from rm->m_rs, so an unqueued message can be cleaned up as if it owned normal payload pages. However, zerocopy ownership is really determined by the presence of op_mmp_znotifier, regardless of whether the message has reached the socket queue.
Capture op_mmp_znotifier up front in rds_message_purge() and use it as the cleanup discriminator. If the message is already associated with a socket, keep the existing completion path. Otherwise, drop the pinned page accounting directly and release the notifier before putting the payload pages.
This keeps early send failure cleanup consistent with the zerocopy lifetime rules without changing the normal queued completion path.
--- net/rds/message.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
net/rds/message.c +15 -5
@@ -129,24 +129,34 @@ static void rds_rm_zerocopy_callback(str*/ static void rds_message_purge (struct rds_message *rm) { +struct rds_znotifier *znotifier;unsigned long i, flags; -bool zcopy = false; +bool zcopy;if (unlikely (test_bit (RDS_MSG_PAGEVEC , &rm->m_flags)))return ;spin_lock_irqsave (&rm->m_rs_lock, flags); + znotifier = rm->data.op_mmp_znotifier; + rm->data.op_mmp_znotifier =NULL ; + zcopy = !!znotifier; +if (rm->m_rs) {struct rds_sock *rs = rm->m_rs; -if (rm->data.op_mmp_znotifier) { - zcopy = true; -rds_rm_zerocopy_callback (rs, rm->data.op_mmp_znotifier); +if (znotifier) { +rds_rm_zerocopy_callback (rs, znotifier);rds_wake_sk_sleep (rs); - rm->data.op_mmp_znotifier =NULL ; }sock_put (rds_rs_to_sk (rs)); rm->m_rs =NULL ; + }else if (znotifier) { +/* +* Zerocopy can fail before the message is queued on the +* socket, so there is no rs to carry the notification. +*/ +mm_unaccount_pinned_pages (&znotifier->z_mmp); +kfree (rds_info_from_znotifier (znotifier)); }spin_unlock_irqrestore (&rm->m_rs_lock, flags);
Greg Kroah-Hartman
maintainerPATCH 238/589 parisc: Fix IRQ leak in LASI driver
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongling Zeng <[email protected]>
commit 37b0dc5e279f35036fb638d1e187197b6c05a76d upstream.
When request_irq() succeeds but gsc_common_setup() fails later, the IRQ is never released. Fix this by adding proper error handling with goto labels to ensure resources are released in LIFO order.
Detected by Smatch:
drivers/parisc/lasi.c:216 lasi_init_chip() warn: 'lasi->gsc_irq.irq'
from request_irq() not released on lines: 207.
--- drivers/parisc/lasi.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/parisc/lasi.c +8 -4
@@ -196,8 +196,7 @@ static int __init lasi_init_chip(struct ret =request_irq (lasi->gsc_irq.irq, gsc_asic_intr,0 ,"lasi" , lasi);if (ret <0 ) { -kfree (lasi); -return ret; + goto err_free; }/* enable IRQ's for devices below LASI */
@@ -206,8 +205,7 @@ static int __init lasi_init_chip(struct/* Done init'ing, register this driver */ ret =gsc_common_setup (dev, lasi);if (ret) { -kfree (lasi); -return ret; + goto err_irq; }gsc_fixup_irqs (dev, lasi, lasi_choose_irq);
@@ -220,6 +218,12 @@ static int __init lasi_init_chip(struct chassis_power_off = lasi_power_off;return ret; + +err_irq: +free_irq (lasi->gsc_irq.irq, lasi); +err_free: +kfree (lasi); +return ret; }static struct parisc_device_id lasi_tbl[]__initdata = {
Greg Kroah-Hartman
maintainerPATCH 239/589 hv_sock: fix ARM64 support
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hamza Mahfooz <[email protected]>
commit b31681206e3f527970a7c7ed807fbf6a028fc25b upstream.
VMBUS ring buffers must be page aligned. Therefore, the current value of 24K presents a challenge on ARM64 kernels (with 64K pages). So, use VMBUS_RING_SIZE() to ensure they are always aligned and large enough to hold all of the relevant data.
--- net/vmw_vsock/hyperv_transport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/vmw_vsock/hyperv_transport.c +2 -2
@@ -366,10 +366,10 @@ static void hvs_open_connection(struct v }else { sndbuf =max_t (int, sk->sk_sndbuf,RINGBUFFER_HVS_SND_SIZE ); sndbuf =min_t (int, sndbuf,RINGBUFFER_HVS_MAX_SIZE ); - sndbuf =ALIGN (sndbuf,HV_HYP_PAGE_SIZE ); + sndbuf =VMBUS_RING_SIZE (sndbuf); rcvbuf =max_t (int, sk->sk_rcvbuf,RINGBUFFER_HVS_RCV_SIZE ); rcvbuf =min_t (int, rcvbuf,RINGBUFFER_HVS_MAX_SIZE ); - rcvbuf =ALIGN (rcvbuf,HV_HYP_PAGE_SIZE ); + rcvbuf =VMBUS_RING_SIZE (rcvbuf); } ret = vmbus_open(chan, sndbuf, rcvbuf, NULL, 0, hvs_channel_cb,
Greg Kroah-Hartman
maintainerPATCH 240/589 ibmveth: Disable GSO for packets with small MSS
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mingming Cao <[email protected]>
commit cc427d24ac6442ffdeafd157a63c7c5b73ed4de4 upstream.
Some physical adapters on Power systems do not support segmentation offload when the MSS is less than 224 bytes. Attempting to send such packets causes the adapter to freeze, stopping all traffic until manually reset.
Implement ndo_features_check to disable GSO for packets with small MSS values. The network stack will perform software segmentation instead.
The 224-byte minimum matches ibmvnic
commit <f10b09ef687f> ("ibmvnic: Enforce stronger sanity checks on GSO packets")
which uses the same physical adapters in SEA configurations.
The issue occurs specifically when the hardware attempts to perform segmentation (gso_segs > 1) with a small MSS. Single-segment GSO packets (gso_segs == 1) do not trigger the problematic LSO code path and are transmitted normally without segmentation.
Add an ndo_features_check callback to disable GSO when MSS < 224 bytes. Also call vlan_features_check() to ensure proper handling of VLAN packets, particularly QinQ (802.1ad) configurations where the hardware parser may not support certain offload features.
Validated using iptables to force small MSS values. Without the fix, the adapter freezes. With the fix, packets are segmented in software and transmission succeeds. Comprehensive regression testing completedd (MSS tests, performance, stability).
--- drivers/net/ethernet/ibm/ibmveth.c | 22 ++++++++++++++++++++++ drivers/net/ethernet/ibm/ibmveth.h | 1 + 2 files changed, 23 insertions(+)
drivers/net/ethernet/ibm/ibmveth.c +22 -0
@@ -1620,6 +1620,27 @@ static int ibmveth_set_mac_addr(struct nreturn 0 ; } +static netdev_features_t ibmveth_features_check (struct sk_buff *skb, +struct net_device *dev, +netdev_features_t features) +{ +/* Some physical adapters do not support segmentation offload with +* MSS < 224. Disable GSO for such packets to avoid adapter freeze. +* Note: Single-segment packets (gso_segs == 1) don't need this check +* as they bypass the LSO path and are transmitted without segmentation. +*/ +if (skb_is_gso (skb)) { +if (skb_shinfo (skb)->gso_size <IBMVETH_MIN_LSO_MSS ) { +netdev_warn_once (dev, +"MSS %u too small for LSO, disabling GSO\n" , +skb_shinfo (skb)->gso_size); + features &= ~NETIF_F_GSO_MASK ; + } + } + +return vlan_features_check (skb, features); +} +static const struct net_device_ops ibmveth_netdev_ops = { .ndo_open = ibmveth_open, .ndo_stop = ibmveth_close,
@@ -1631,6 +1652,7 @@ static const struct net_device_ops ibmve .ndo_set_features = ibmveth_set_features, .ndo_validate_addr = eth_validate_addr, .ndo_set_mac_address = ibmveth_set_mac_addr, + .ndo_features_check = ibmveth_features_check,#ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = ibmveth_poll_controller,#endif
drivers/net/ethernet/ibm/ibmveth.h +1 -0
@@ -36,6 +36,7 @@#define IBMVETH_ILLAN_IPV4_TCP_CSUM 0x0000000000000002UL#define IBMVETH_ILLAN_ACTIVE_TRUNK 0x0000000000000001UL +#define IBMVETH_MIN_LSO_MSS 224/* Minimum MSS for LSO */ /* hcall macros */ #define h_register_logical_lan (ua, buflst, rxq, fltlst, mac) \ plpar_hcall_norets(H_REGISTER_LOGICAL_LAN, ua, buflst, rxq, fltlst, mac)
Greg Kroah-Hartman
maintainerPATCH 241/589 udf: reject descriptors with oversized CRC length
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Bommarito <[email protected]>
commit 55d41b0a20128e86b9e960dd2e3f0a2d69a18df7 upstream.
udf_read_tagged() skips CRC verification when descCRCLength + sizeof(struct tag) exceeds the block size. A crafted UDF image can set descCRCLength to an oversized value to bypass CRC validation entirely; the descriptor is then accepted based solely on the 8-bit tag checksum, which is trivially recomputable.
Reject such descriptors instead of silently accepting them. A legitimate single-block descriptor should never have a CRC length that exceeds the block.
--- fs/udf/misc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/udf/misc.c +6 -2
@@ -250,8 +250,12 @@ struct buffer_head *udf_read_tagged(stru }/* Verify the descriptor CRC */ -if (le16_to_cpu (tag_p->descCRCLength) +sizeof (struct tag ) > sb->s_blocksize || -le16_to_cpu (tag_p->descCRC) ==crc_itu_t (0 , +if (le16_to_cpu (tag_p->descCRCLength) +sizeof (struct tag ) > sb->s_blocksize) { +udf_err (sb,"block %u: CRC length %u exceeds block size\n" , + block,le16_to_cpu (tag_p->descCRCLength)); + goto error_out; + } +if (le16_to_cpu (tag_p->descCRC) ==crc_itu_t (0 , bh->b_data +sizeof (struct tag ),le16_to_cpu (tag_p->descCRCLength)))return bh;
Greg Kroah-Hartman
maintainerPATCH 242/589 thermal/drivers/sprd: Fix temperature clamping in sprd_thm_temp_to_rawdata
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
commit 83c0f9a5d679a6f8d84fc49b2f62ea434ccab4b6 upstream.
The temperature was never clamped to SPRD_THM_TEMP_LOW or SPRD_THM_TEMP_HIGH because the return value of clamp() was not used. Fix this by assigning the clamped value to 'temp'.
Casting SPRD_THM_TEMP_LOW and SPRD_THM_TEMP_HIGH to int is also redundant and can be removed.
--- drivers/thermal/sprd_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/sprd_thermal.c +1 -1
@@ -192,7 +192,7 @@ static int sprd_thm_temp_to_rawdata(int {u32 val; -clamp (temp, (int )SPRD_THM_TEMP_LOW , (int )SPRD_THM_TEMP_HIGH ); + temp =clamp (temp,SPRD_THM_TEMP_LOW ,SPRD_THM_TEMP_HIGH );/* * According to the thermal datasheet, the formula of converting
Greg Kroah-Hartman
maintainerPATCH 243/589 thermal/drivers/sprd: Fix raw temperature clamping in sprd_thm_rawdata_to_temp
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
commit b3414148bbc1f9cd56217e58a558c6ac4fd1b4a6 upstream.
The raw temperature data was never clamped to SPRD_THM_RAW_DATA_LOW or SPRD_THM_RAW_DATA_HIGH because the return value of clamp() was not used. Fix this by assigning the clamped value to 'rawdata'.
Casting SPRD_THM_RAW_DATA_LOW and SPRD_THM_RAW_DATA_HIGH to u32 is also redundant and can be removed.
--- drivers/thermal/sprd_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/sprd_thermal.c +1 -1
@@ -178,7 +178,7 @@ static int sprd_thm_sensor_calibration(sstatic int sprd_thm_rawdata_to_temp (struct sprd_thermal_sensor *sen,u32 rawdata) { -clamp (rawdata, (u32 )SPRD_THM_RAW_DATA_LOW , (u32 )SPRD_THM_RAW_DATA_HIGH ); + rawdata =clamp (rawdata,SPRD_THM_RAW_DATA_LOW ,SPRD_THM_RAW_DATA_HIGH );/* * According to the thermal datasheet, the formula of converting
Greg Kroah-Hartman
maintainerPATCH 244/589 spi: topcliff-pch: fix use-after-free on unbind
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 9d72732fe70c11424bc90ed466c7ccfa58b42a9a upstream.
Give the driver a chance to flush its queue before releasing the DMA buffers on driver unbind
--- drivers/spi/spi-topcliff-pch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/spi/spi-topcliff-pch.c +3 -3
@@ -1426,9 +1426,6 @@ static int pch_spi_pd_remove(struct platdev_dbg (&plat_dev->dev,"%s:[ch%d] irq=%d\n" , __func__, plat_dev->id, board_dat->pdev->irq); -if (use_dma) -pch_free_dma_buf (board_dat, data); -/* check for any pending messages; no action is taken if the queue * is still full; but at least we tried. Unload anyway */ count =500 ;
@@ -1452,6 +1449,9 @@ static int pch_spi_pd_remove(struct platfree_irq (board_dat->pdev->irq, data); } +if (use_dma) +pch_free_dma_buf (board_dat, data); +pci_iounmap (board_dat->pdev, data->io_remap_addr);spi_unregister_master (data->master);
Re: [PATCH 5.10 244/589] spi: topcliff-pch: fix use-after-free on unbind
Quoted 10 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit
9d72732fe70c11424bc90ed466c7ccfa58b42a9aupstream.Give the driver a chance to flush its queue before releasing the DMA buffers on driver unbind
This doesn't seem like it will fix anything unless commit 5d6f477d6fc0 "spi: topcliff-pch: fix controller deregistration" is applied first. And that definitely needs backporting for older kernel versions due to the API name changes.
Ben.
Quoted 36 lines
Fixes c37f3c2749b5 ("spi/topcliff_pch: DMA support")Cc [email protected] # 3.1Cc Tomoya MORINAGA <[email protected]>Signed-off-by Johan Hovold <[email protected]>Signed-off-by Mark Brown <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/spi/spi-topcliff-pch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/spi/spi-topcliff-pch.c +3
-3@@ -1426,9 +1426,6 @@ static int pch_spi_pd_remove(struct platdev_dbg (&plat_dev->dev,"%s:[ch%d] irq=%d\n" , __func__, plat_dev->id, board_dat->pdev->irq); -if (use_dma) -pch_free_dma_buf (board_dat, data); -/* check for any pending messages; no action is taken if the queue * is still full; but at least we tried. Unload anyway */ count =500 ;@@ -1452,6 +1449,9 @@ static int pch_spi_pd_remove(struct platfree_irq (board_dat->pdev->irq, data); } +if (use_dma) +pch_free_dma_buf (board_dat, data); +pci_iounmap (board_dat->pdev, data->io_remap_addr);spi_unregister_master (data->master);
Signature · 4 lines
Ben Hutchings
The obvious mathematical breakthrough [to break modern encryption]
would be development of an easy way to factor large prime numbers.
- Bill GatesGreg Kroah-Hartman
maintainerPATCH 245/589 cpuidle: powerpc: avoid double clear when breaking snooze
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shrikanth Hegde <[email protected]>
commit 64ed1e3e728afb57ba9acb59e69de930ead847d9 upstream.
snooze_loop is done often in any system which has fair bit of idle time. So it qualifies for even micro-optimizations.
When breaking the snooze due to timeout, TIF_POLLING_NRFLAG is cleared twice. Clearing the bit invokes atomics. Avoid double clear and thereby avoid one atomic write.
dev->poll_time_limit indicates whether the loop was broken due to timeout. Use that instead of defining a new variable.
--- drivers/cpuidle/cpuidle-powernv.c | 5 ++++- drivers/cpuidle/cpuidle-pseries.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/cpuidle/cpuidle-powernv.c +4 -1
@@ -93,7 +93,10 @@ static int snooze_loop(struct cpuidle_deHMT_medium ();ppc64_runlatch_on (); -clear_thread_flag (TIF_POLLING_NRFLAG ); + +/* Avoid double clear when breaking */ +if (!dev->poll_time_limit) +clear_thread_flag (TIF_POLLING_NRFLAG );local_irq_disable ();
drivers/cpuidle/cpuidle-pseries.c +4 -1
@@ -61,7 +61,10 @@ static int snooze_loop(struct cpuidle_de }HMT_medium (); -clear_thread_flag (TIF_POLLING_NRFLAG ); + +/* Avoid double clear when breaking */ +if (!dev->poll_time_limit) +clear_thread_flag (TIF_POLLING_NRFLAG );local_irq_disable ();
Re: [PATCH 5.10 245/589] cpuidle: powerpc: avoid double clear when breaking snooze
Quoted 11 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shrikanth Hegde <[email protected]>
commit
64ed1e3e728afb57ba9acb59e69de930ead847d9upstream.
snooze_loopis done often in any system which has fair bit of idle time. So it qualifies for even micro-optimizations.
Quoted 6 lines
When breaking the snooze due to timeout,
TIF_POLLING_NRFLAGis cleared twice. Clearing the bit invokes atomics. Avoid double clear and thereby avoid one atomic write.
dev->poll_time_limitindicates whether the loop was broken due to timeout. Use that instead of defining a new variable.
That is only true after commit 5ddcc03a07ae "powerpc/cpuidle: Set CPUIDLE_FLAG_POLLING for snooze state". So please drop this for 5.10, 5.15, and 6.1.
Ben.
Quoted 43 lines
Fixes 7ded429152e8 ("cpuidle: powerpc: no memory barrier after break from idle")Signed-off-by Shrikanth Hegde <[email protected]>Signed-off-by Madhavan Srinivasan <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/cpuidle/cpuidle-powernv.c | 5 ++++- drivers/cpuidle/cpuidle-pseries.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-)drivers/cpuidle/cpuidle-powernv.c +4
-1@@ -93,7 +93,10 @@ static int snooze_loop(struct cpuidle_deHMT_medium ();ppc64_runlatch_on (); -clear_thread_flag (TIF_POLLING_NRFLAG ); + +/* Avoid double clear when breaking */ +if (!dev->poll_time_limit) +clear_thread_flag (TIF_POLLING_NRFLAG );local_irq_disable ();drivers/cpuidle/cpuidle-pseries.c +4
-1@@ -61,7 +61,10 @@ static int snooze_loop(struct cpuidle_de }HMT_medium (); -clear_thread_flag (TIF_POLLING_NRFLAG ); + +/* Avoid double clear when breaking */ +if (!dev->poll_time_limit) +clear_thread_flag (TIF_POLLING_NRFLAG );local_irq_disable ();
Signature · 4 lines
Ben Hutchings
The obvious mathematical breakthrough [to break modern encryption]
would be development of an easy way to factor large prime numbers.
- Bill GatesGreg Kroah-Hartman
maintainerPATCH 246/589 ASoC: fsl_easrc: fix comment typo
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joseph Salisbury <[email protected]>
commit 804dce6c73fdfa44184ee4e8b09abad7f5da408f upstream.
The file contains a spelling error in a source comment (funciton).
Typos in comments reduce readability and make text searches less reliable for developers and maintainers.
Replace 'funciton' with 'function' in the affected comment. This is a comment-only cleanup and does not change behavior.
--- sound/soc/fsl/fsl_easrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/fsl/fsl_easrc.c +1 -1
@@ -1286,7 +1286,7 @@ static int fsl_easrc_request_context(int/* * Release the context * -* This funciton is mainly doing the revert thing in request context +* This function is mainly doing the revert thing in request context */ static void fsl_easrc_release_context (struct fsl_asrc_pair *ctx) {
Greg Kroah-Hartman
maintainerPATCH 247/589 dm: dont report warning when doing deferred remove
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit b7cce3e2cca9cd78418f3c3784474b778e7996fe upstream.
If dm_hash_remove_all was called from dm_deferred_remove, it would write a warning "remove_all left %d open device(s)" if there are some other devices active.
The warning is bogus, so let's disable it in this case.
--- drivers/md/dm-ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-ioctl.c +1 -1
@@ -328,7 +328,7 @@ retry:up_write (&_hash_lock); -if (dev_skipped) +if (dev_skipped && !only_deferred)DMWARN ("remove_all left %d open device(s)" , dev_skipped); }
Greg Kroah-Hartman
maintainerPATCH 248/589 dm: fix a buffer overflow in ioctl processing
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 2fa49cc884f6496a915c35621ba4da35649bf159 upstream.
Tony Asleson (using Claude) found a buffer overflow in dm-ioctl in the function retrieve_status:
1. The code in retrieve_status checks that the output string fits into the output buffer and writes the output string there
2. Then, the code aligns the "outptr" variable to the next 8-byte boundary:
outptr = align_ptr(outptr); 3. The alignment doesn't check overflow, so outptr could point past the buffer end 4. The "for" loop is iterated again, it executes: remaining = len - (outptr - outbuf);
5. If "outptr" points past "outbuf + len", the arithmetics wraps around and the variable "remaining" contains unusually high number
6. With "remaining" being high, the code writes more data past the end of the buffer
Luckily, this bug has no security implications because:
1. Only root can issue device mapper ioctls
2. The commonly used libraries that communicate with device mapper (libdevmapper and devicemapper-rs) use buffer size that is aligned to 8 bytes - thus, "outptr = align_ptr(outptr)" can't overshoot the input buffer and the bug can't happen accidentally
--- drivers/md/dm-ioctl.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/md/dm-ioctl.c +4 -0
@@ -1214,6 +1214,10 @@ static void retrieve_status(struct dm_ta used = param->data_start + (outptr - outbuf); outptr =align_ptr (outptr); +if (!outptr || outptr > outbuf + len) { + param->flags |=DM_BUFFER_FULL_FLAG ; +break ; + } spec->next = outptr - outbuf; }
Greg Kroah-Hartman
maintainerPATCH 249/589 dm-verity-fec: correctly reject too-small FEC devices
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 2b14e0bb63cc671120e7791658f5c494fc66d072 upstream.
Fix verity_fec_ctr() to reject too-small FEC devices by correctly computing the number of parity blocks as 'f->rounds * f->roots'. Previously it incorrectly used 'div64_u64(f->rounds * f->roots, v->fec->roots << SECTOR_SHIFT)' which is a much smaller value.
Note that the units of 'rounds' are blocks, not bytes. This matches the units of the value returned by dm_bufio_get_device_size(), which are also blocks. A later commit will give 'rounds' a clearer name.
--- drivers/md/dm-verity-fec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/md/dm-verity-fec.c +2 -3
@@ -670,7 +670,7 @@ int verity_fec_ctr(struct dm_verity *v) {struct dm_verity_fec *f = v->fec;struct dm_target *ti = v->ti; -u64 hash_blocks, fec_blocks; +u64 hash_blocks;int ret;if (!verity_fec_is_enabled (v)) {
@@ -754,8 +754,7 @@ int verity_fec_ctr(struct dm_verity *v)dm_bufio_set_sector_offset (f->bufio, f->start << (v->data_dev_block_bits -SECTOR_SHIFT )); - fec_blocks =div64_u64 (f->rounds * f->roots, v->fec->roots <<SECTOR_SHIFT ); -if (dm_bufio_get_device_size (f->bufio) < fec_blocks) { +if (dm_bufio_get_device_size (f->bufio) < f->rounds * f->roots) { ti->error ="FEC device is too small" ;return -E2BIG ; }
Greg Kroah-Hartman
maintainerPATCH 250/589 dm-verity-fec: correctly reject too-small hash devices
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 4355142245f7e55336dcc005ec03592df4d546f8 upstream.
Fix verity_fec_ctr() to reject too-small hash devices by correctly taking hash_start into account.
Note that this is necessary because dm-verity doesn't call dm_bufio_set_sector_offset() on the hash device's bufio client (v->bufio). Thus, dm_bufio_get_device_size(v->bufio) returns a size relative to 0 rather than hash_start. An alternative fix would be to call dm_bufio_set_sector_offset() on v->bufio, but then all the code that reads from the hash device would have to be adjusted accordingly.
--- drivers/md/dm-verity-fec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/dm-verity-fec.c +2 -1
@@ -733,7 +733,8 @@ int verity_fec_ctr(struct dm_verity *v)* it to be large enough. */ f->hash_blocks = f->blocks - v->data_blocks; -if (dm_bufio_get_device_size (v->bufio) < f->hash_blocks) { +if (dm_bufio_get_device_size (v->bufio) < + v->hash_start + f->hash_blocks) { ti->error ="Hash device is too small for " DM_VERITY_OPT_FEC_BLOCKS ;return -E2BIG ;
Greg Kroah-Hartman
maintainerPATCH 251/589 isofs: validate Rock Ridge CE continuation extent against volume size
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Bommarito <[email protected]>
commit a36d990f591320e9dd379ab30063ebfe91d47e1f upstream.
rock_continue() reads rs->cont_extent verbatim from the Rock Ridge CE record and passes it to sb_bread() without checking that the block number is within the mounted ISO 9660 volume. commit e595447e177b ("[PATCH] rock.c: handle corrupted directories") added cont_offset and cont_size rejection for the CE continuation but did not validate the extent block number itself. commit f54e18f1b831 ("isofs: Fix infinite looping over CE entries") later capped the CE chain length at RR_MAX_CE_ENTRIES = 32 but again left the block number unchecked.
With a crafted ISO mounted via udisks2 (desktop optical auto-mount) or via CAP_SYS_ADMIN mount, rs->cont_extent can therefore point at an out-of-range block or at blocks belonging to an adjacent filesystem on the same block device. sb_bread() on an out-of-range block returns NULL cleanly via the block layer EIO path, so there is no memory-safety violation. For in-range reads of adjacent- filesystem data, the CE buffer is parsed as Rock Ridge records and only the text of SL sub-records reaches userspace through readlink(), which makes the info-leak channel narrow and difficult to exploit; still, rejecting the malformed CE outright matches the rejection shape already present in the same function for cont_offset and cont_size.
Add an ISOFS_SB(sb)->s_nzones bounds check to rock_continue() next to the existing offset/size rejection, printing the same corrupted-directory-entry notice.
--- fs/isofs/rock.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/isofs/rock.c +9 -0
@@ -101,6 +101,15 @@ static int rock_continue(struct rock_sta goto out; } +if ((unsigned )rs->cont_extent >=ISOFS_SB (rs->inode->i_sb)->s_nzones) { +printk (KERN_NOTICE "rock: corrupted directory entry. " +"extent=%u out of volume (nzones=%lu)\n" , + (unsigned )rs->cont_extent, +ISOFS_SB (rs->inode->i_sb)->s_nzones); + ret = -EIO ; + goto out; + } +if (rs->cont_extent) {struct buffer_head *bh;
Greg Kroah-Hartman
maintainerPATCH 252/589 isofs: validate block number from NFS file handle in isofs_export_iget
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Bommarito <[email protected]>
commit 24376458138387fb251e782e624c7776e9826796 upstream.
isofs_fh_to_dentry() and isofs_fh_to_parent() pass an attacker- controlled block number (ifid->block or ifid->parent_block) from the NFS file handle to isofs_export_iget(), which only rejects block == 0 before calling isofs_iget() and ultimately sb_bread(). A crafted file handle with fh_len sufficient to pass the check added by commit 0405d4b63d08 ("isofs: Prevent the use of too small fid") can still drive the server to read any in-range block on the backing device as if it were an iso_directory_record. That earlier fix was assigned CVE-2025-37780.
sb_bread() on an out-of-range block returns NULL cleanly via the EIO path, so there is no memory-safety violation. For in-range reads of adjacent-partition data on the same block device, the unrelated bytes end up in iso_inode_info fields that reach the NFS client as dentry metadata. The deployment surface (isofs exported over NFS from loop-mounted images) is narrow and requires an authenticated NFS peer, but the malformed-file-handle class is reportable as hardening next to the existing CVE-2025-37780 fix.
Reject block >= ISOFS_SB(sb)->s_nzones in isofs_export_iget() so the check covers both isofs_fh_to_dentry() and isofs_fh_to_parent() call sites with a single line.
--- fs/isofs/export.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/isofs/export.c +1 -1
@@ -24,7 +24,7 @@ isofs_export_iget(struct super_block *sb {struct inode *inode; -if (block ==0 ) +if (block ==0 || block >=ISOFS_SB (sb)->s_nzones)return ERR_PTR (-ESTALE ); inode =isofs_iget (sb, block, offset);if (IS_ERR (inode))
Greg Kroah-Hartman
maintainerPATCH 253/589 md/raid10: fix divide-by-zero in setup_geo() with zero far_copies
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junrui Luo <[email protected]>
commit 9aa6d860b0930e2f72795665c42c44252a558a0c upstream.
setup_geo() extracts near_copies (nc) and far_copies (fc) from the user-provided layout parameter without checking for zero. When fc=0 with the "improved" far set layout selected, 'geo->far_set_size = disks / fc' triggers a divide-by-zero.
Validate nc and fc immediately after extraction, returning -1 if either is zero.
--- drivers/md/raid10.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/md/raid10.c +2 -0
@@ -3606,6 +3606,8 @@ static int setup_geo(struct geom *geo, s nc = layout &255 ; fc = (layout >>8 ) &255 ; fo = layout & (1 <<16 ); +if (!nc || !fc) +return -1 ; geo->raid_disks = disks; geo->near_copies = nc; geo->far_copies = fc;
Greg Kroah-Hartman
maintainerPATCH 254/589 nvmet: avoid recursive nvmet-wq flush in nvmet_ctrl_free
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chaitanya Kulkarni <[email protected]>
commit aade8abd8b868b6ffa9697aadaea28ec7f65bee6 upstream.
nvmet_tcp_release_queue_work() runs on nvmet-wq and can drop the final controller reference through nvmet_cq_put(). If that triggers nvmet_ctrl_free(), the teardown path flushes ctrl->async_event_work on the same nvmet-wq.
Call chain:
nvmet_tcp_schedule_release_queue()
kref_put(&queue->kref, nvmet_tcp_release_queue)
nvmet_tcp_release_queue()
queue_work(nvmet_wq, &queue->release_work) <--- nvmet_wq
process_one_work()
nvmet_tcp_release_queue_work()
nvmet_cq_put(&queue->nvme_cq)
nvmet_cq_destroy()
nvmet_ctrl_put(cq->ctrl)
nvmet_ctrl_free()
flush_work(&ctrl->async_event_work) <--- nvmet_wq
Previously Scheduled by :-
nvmet_add_async_event
queue_work(nvmet_wq, &ctrl->async_event_work);This trips lockdep with a possible recursive locking warning.
[ 5223.015876] run blktests nvme/003 at 2026-04-07 20:53:55 [ 5223.061801] loop0: detected capacity change from 0 to 2097152 [ 5223.072206] nvmet: adding nsid 1 to subsystem blktests-subsystem-1 [ 5223.088368] nvmet_tcp: enabling port 0 (127.0.0.1:4420) [ 5223.126086] nvmet: Created discovery controller 1 for subsystem nqn.2014-08.org.nvmexpress.discovery for NQN nqn.2014-08.org.nvmexpress:uuid:0f01fb42-9f7f-4856-b0b3-51e60b8de349. [ 5223.128453] nvme nvme1: new ctrl: NQN "nqn.2014-08.org.nvmexpress.discovery", addr 127.0.0.1:4420, hostnqn: nqn.2014-08.org.nvmexpress:uuid:0f01fb42-9f7f-4856-b0b3-51e60b8de349 [ 5233.199447] nvme nvme1: Removing ctrl: NQN "nqn.2014-08.org.nvmexpress.discovery"
[ 5233.227718] ============================================
[ 5233.231283] WARNING: possible recursive locking detected
[ 5233.234696] 7.0.0-rc3nvme+ #20 Tainted: G O N
[ 5233.238434] --------------------------------------------
[ 5233.241852] kworker/u192:6/2413 is trying to acquire lock:
[ 5233.245429] ffff888111632548 ((wq_completion)nvmet-wq){+.+.}-{0:0}, at: touch_wq_lockdep_map+0x26/0x90
[ 5233.251438]
but task is already holding lock:
[ 5233.255254] ffff888111632548 ((wq_completion)nvmet-wq){+.+.}-{0:0}, at: process_one_work+0x5cc/0x6e0
[ 5233.261125]
other info that might help us debug this:
[ 5233.265333] Possible unsafe locking scenario:[ 5233.269217] CPU0
[ 5233.270795] ----
[ 5233.272436] lock((wq_completion)nvmet-wq);
[ 5233.275241] lock((wq_completion)nvmet-wq);
[ 5233.278020]
*** DEADLOCK ***[ 5233.281793] May be due to missing lock nesting notation
[ 5233.286195] 3 locks held by kworker/u192:6/2413:
[ 5233.289192] #0: ffff888111632548 ((wq_completion)nvmet-wq){+.+.}-{0:0}, at: process_one_work+0x5cc/0x6e0
[ 5233.294569] #1: ffffc9000e2a7e40 ((work_completion)(&queue->release_work)){+.+.}-{0:0}, at: process_one_work+0x1c5/0x6e0
[ 5233.300128] #2: ffffffff82d7dc40 (rcu_read_lock){....}-{1:3}, at: __flush_work+0x62/0x530
[ 5233.304290]
stack backtrace:
[ 5233.306520] CPU: 4 UID: 0 PID: 2413 Comm: kworker/u192:6 Tainted: G O N 7.0.0-rc3nvme+ #20 PREEMPT(full)
[ 5233.306524] Tainted: [O]=OOT_MODULE, [N]=TEST
[ 5233.306525] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.17.0-0-gb52ca86e094d-prebuilt.qemu.org 04/01/2014
[ 5233.306527] Workqueue: nvmet-wq nvmet_tcp_release_queue_work [nvmet_tcp]
[ 5233.306532] Call Trace:
[ 5233.306534] <TASK>
[ 5233.306536] dump_stack_lvl+0x73/0xb0
[ 5233.306552] print_deadlock_bug+0x225/0x2f0
[ 5233.306556] __lock_acquire+0x13f0/0x2290
[ 5233.306563] lock_acquire+0xd0/0x300
[ 5233.306565] ? touch_wq_lockdep_map+0x26/0x90
[ 5233.306571] ? __flush_work+0x20b/0x530
[ 5233.306573] ? touch_wq_lockdep_map+0x26/0x90
[ 5233.306577] touch_wq_lockdep_map+0x3b/0x90
[ 5233.306580] ? touch_wq_lockdep_map+0x26/0x90
[ 5233.306583] ? __flush_work+0x20b/0x530
[ 5233.306585] __flush_work+0x268/0x530
[ 5233.306588] ? __pfx_wq_barrier_func+0x10/0x10
[ 5233.306594] ? xen_error_entry+0x30/0x60
[ 5233.306600] nvmet_ctrl_free+0x140/0x310 [nvmet]
[ 5233.306617] nvmet_cq_put+0x74/0x90 [nvmet]
[ 5233.306629] nvmet_tcp_release_queue_work+0x19f/0x360 [nvmet_tcp]
[ 5233.306634] process_one_work+0x206/0x6e0
[ 5233.306640] worker_thread+0x184/0x320
[ 5233.306643] ? __pfx_worker_thread+0x10/0x10
[ 5233.306646] kthread+0xf1/0x130
[ 5233.306648] ? __pfx_kthread+0x10/0x10
[ 5233.306651] ret_from_fork+0x355/0x450
[ 5233.306653] ? __pfx_kthread+0x10/0x10
[ 5233.306656] ret_from_fork_asm+0x1a/0x30
[ 5233.306664] </TASK>There is also no need to flush async_event_work from controller teardown. The admin queue teardown already fails outstanding AER requests before the final controller put :-
nvmet_sq_destroy(admin sq)
nvmet_async_events_failall(ctrl)
The controller has already been removed from the subsystem list before nvmet_ctrl_free() quiesces outstanding work.
Replace flush_work() with cancel_work_sync() so a pending async_event_work item is canceled and a running instance is waited on without recursing into the same workqueue.
--- drivers/nvme/target/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/core.c +1 -1
@@ -1440,7 +1440,7 @@ static void nvmet_ctrl_free(struct krefnvmet_stop_keep_alive_timer (ctrl); -flush_work (&ctrl->async_event_work); +cancel_work_sync (&ctrl->async_event_work);cancel_work_sync (&ctrl->fatal_err_work);ida_simple_remove (&cntlid_ida, ctrl->cntlid);
Greg Kroah-Hartman
maintainerPATCH 255/589 s390/debug: Reject zero-length input in debug_input_flush_fn()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Gorbik <[email protected]>
commit e14622a7584f9608927c59a7d6ae4a0999dc545e upstream.
debug_input_flush_fn() always copies one byte from the userspace buffer with copy_from_user() regardless of the supplied write length. A zero-length write therefore reads one byte beyond the caller's buffer. If the stale byte happens to be '-' or a digit the debug log is silently flushed. With an unmapped buffer the call returns -EFAULT.
Reject zero-length writes before copying from userspace.
--- arch/s390/kernel/debug.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/s390/kernel/debug.c +5 -0
@@ -1387,6 +1387,11 @@ static int debug_input_flush_fn(debug_inchar input_buf[1 ];int rc = user_len; +if (!user_len) { + rc = -EINVAL ; + goto out; + } +if (user_len >0x10000 ) user_len =0x10000 ;if (*offset !=0 ) {
Greg Kroah-Hartman
maintainerPATCH 256/589 PCI/AER: Clear only error bits in PCIe Device Status
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Xue <[email protected]>
commit a8aeea1bf3c80cc87983689e0118770e019bd4f3 upstream.
Currently, pcie_clear_device_status() clears the entire PCIe Device Status register (PCI_EXP_DEVSTA) by writing back the value read from the register, which affects not only the error status bits but also other writable bits.
According to PCIe r7.0, sec 7.5.3.5, this register contains:
- RW1C error status bits (CED, NFED, FED, URD at bits 0-3): These are the four error status bits that need to be cleared.
- Read-only bits (AUXPD at bit 4, TRPND at bit 5): Writing to these has no effect.
- Emergency Power Reduction Detected (bit 6): A RW1C non-error bit introduced in PCIe r5.0 (2019). This is currently the only writable non-error bit in the Device Status register. Unconditionally clearing this bit can interfere with other software components that rely on this power management indication.
- Reserved bits (RsvdZ): These bits are required to be written as zero. Writing 1s to them (as the current implementation may do) violates the specification.
To prevent unintended side effects, modify pcie_clear_device_status() to only write 1s to the four error status bits (CED, NFED, FED, URD), leaving the Emergency Power Reduction Detected bit and reserved bits unaffected.
--- drivers/pci/pci.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/pci/pci.c +3 -4
@@ -2182,10 +2182,9 @@ EXPORT_SYMBOL_GPL(pci_set_pcie_reset_stavoid pcie_clear_device_status (struct pci_dev *dev) { -u16 sta; - -pcie_capability_read_word (dev,PCI_EXP_DEVSTA , &sta); -pcie_capability_write_word (dev,PCI_EXP_DEVSTA , sta); +pcie_capability_write_word (dev,PCI_EXP_DEVSTA , +PCI_EXP_DEVSTA_CED |PCI_EXP_DEVSTA_NFED | +PCI_EXP_DEVSTA_FED |PCI_EXP_DEVSTA_URD ); }/**
Greg Kroah-Hartman
maintainerPATCH 257/589 PCI/AER: Stop ruling out unbound devices as error source
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Wunner <[email protected]>
commit 1ab4a3c805084d752ec571efc78272295a9f2f74 upstream.
When searching for the error source, the AER driver rules out devices whose enable_cnt is zero. This was introduced in 2009 by commit 28eb27cf0839 ("PCI AER: support invalid error source IDs") without providing a rationale.
Drivers typically call pci_enable_device() on probe, hence the enable_cnt check essentially filters out unbound devices. At the time of the commit, drivers had to opt in to AER by calling pci_enable_pcie_error_reporting() and so any AER-enabled device could be assumed to be bound to a driver. The check thus made sense because it allowed skipping config space accesses to devices which were known not to be the error source.
But since 2022, AER is universally enabled on all devices when they are enumerated, cf. commit f26e58bf6f54 ("PCI/AER: Enable error reporting when AER is native").
Errors may very well be reported by unbound devices, e.g. due to link instability. By ruling them out as error source, errors reported by them are neither logged nor cleared. When they do get bound and another error occurs, the earlier error is reported together with the new error, which may confuse users. Stop doing so.
--- drivers/pci/pcie/aer.c | 2 -- 1 file changed, 2 deletions(-)
drivers/pci/pcie/aer.c +0 -2
@@ -853,8 +853,6 @@ static bool is_error_source(struct pci_d* 3) There are multiple errors and prior ID comparing fails; * We check AER status registers to find possible reporter. */ -if (atomic_read (&dev->enable_cnt) ==0 ) -return false;/* Check if AER is enabled */ pcie_capability_read_word (dev,PCI_EXP_DEVCTL , ®16);
Re: [PATCH 5.10 257/589] PCI/AER: Stop ruling out unbound devices as error source
Quoted 20 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Wunner <[email protected]>
commit
1ab4a3c805084d752ec571efc78272295a9f2f74upstream.When searching for the error source, the AER driver rules out devices whose
enable_cntis zero. This was introduced in 2009 by commit28eb27cf0839("PCI AER: support invalid error source IDs") without providing a rationale.Drivers typically call
pci_enable_device()on probe, hence theenable_cntcheck essentially filters out unbound devices. At the time of the commit, drivers had to opt in to AER by callingpci_enable_pcie_error_reporting()and so any AER-enabled device could be assumed to be bound to a driver. The check thus made sense because it allowed skipping config space accesses to devices which were known not to be the error source.
Quoted 3 lines
But since 2022, AER is universally enabled on all devices when they are enumerated, cf. commit
f26e58bf6f54("PCI/AER: Enable error reporting when AER is native").
That commit went into 6.0 and didn't get backported, so this doesn't seem to be needed here.
Ben.
Quoted 31 lines
Errors may very well be reported by unbound devices, e.g. due to link instability. By ruling them out as error source, errors reported by them are neither logged nor cleared. When they do get bound and another error occurs, the earlier error is reported together with the new error, which may confuse users. Stop doing so.
Fixes f26e58bf6f54 ("PCI/AER: Enable error reporting when AER is native")Signed-off-by Lukas Wunner <[email protected]>Signed-off-by Bjorn Helgaas <[email protected]>Reviewed-by Stefan Roese <[email protected]>Cc [email protected] # v6.0+Link https://patch.msgid.link/734338c2e8b669db5a5a3b45d34131b55ffebfca.1774605029.git.lukas@wunner.de open hereSigned-off-by Greg Kroah-Hartman <[email protected]>--- drivers/pci/pcie/aer.c | 2 -- 1 file changed, 2 deletions(-)drivers/pci/pcie/aer.c +0
-2@@ -853,8 +853,6 @@ static bool is_error_source(struct pci_d* 3) There are multiple errors and prior ID comparing fails; * We check AER status registers to find possible reporter. */ -if (atomic_read (&dev->enable_cnt) ==0 ) -return false;/* Check if AER is enabled */ pcie_capability_read_word (dev,PCI_EXP_DEVCTL , ®16);
Signature · 4 lines
Ben Hutchings
The obvious mathematical breakthrough [to break modern encryption]
would be development of an easy way to factor large prime numbers.
- Bill GatesGreg Kroah-Hartman
maintainerPATCH 258/589 power: supply: max17042: avoid overflow when determining health
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: André Draszik <[email protected]>
commit 9a44949da669708f19d29141e65b3ac774d08f5a upstream.
If vmax has the default value of INT_MAX (e.g. because not specified in DT), battery health is reported as over-voltage. This is because adding any value to vmax (the vmax tolerance in this case) causes it to wrap around, making it negative and smaller than the measured battery voltage.
Avoid that by using size_add().
--- drivers/power/supply/max17042_battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/max17042_battery.c +1 -1
@@ -199,7 +199,7 @@ static int max17042_get_battery_health(s goto out; } -if (vbatt > chip->pdata->vmax +MAX17042_VMAX_TOLERANCE ) { +if (vbatt >size_add (chip->pdata->vmax,MAX17042_VMAX_TOLERANCE )) { *health =POWER_SUPPLY_HEALTH_OVERVOLTAGE ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 259/589 RDMA/mlx4: Fix resource leak on error in mlx4_ib_create_srq()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
commit c54c7e4cb679c0aaa1cb489b9c3f2cd98e63a44c upstream.
Sashiko points out that mlx4_srq_alloc() was not undone during error unwind, add the missing call to mlx4_srq_free().
--- drivers/infiniband/hw/mlx4/srq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx4/srq.c +3 -1
@@ -189,13 +189,15 @@ int mlx4_ib_create_srq(struct ib_srq *ibif (udata)if (ib_copy_to_udata (udata, &srq->msrq.srqn,sizeof (__u32))) { err = -EFAULT ; - goto err_wrid; + goto err_srq; } init_attr->attr.max_wr = srq->msrq.max -1 ;return 0 ; +err_srq: +mlx4_srq_free (dev->dev, &srq->msrq); err_wrid:if (udata)mlx4_ib_db_unmap_user (ucontext, &srq->db);
Greg Kroah-Hartman
maintainerPATCH 260/589 RDMA/ocrdma: Dont NULL deref uctx on errors in ocrdma_copy_pd_uresp()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
commit 34fbf48cf3b410d2a6e8c586fa952a36331ca5ba upstream.
Sashiko points out that pd->uctx isn't initialized until late in the function so all these error flow references are NULL and will crash. Use the uctx that isn't NULL.
--- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +2 -2
@@ -618,9 +618,9 @@ static int ocrdma_copy_pd_uresp(struct o ucopy_err:if (pd->dpp_enabled) -ocrdma_del_mmap (pd->uctx, dpp_page_addr,PAGE_SIZE ); +ocrdma_del_mmap (uctx, dpp_page_addr,PAGE_SIZE ); dpp_map_err: -ocrdma_del_mmap (pd->uctx, db_page_addr, db_page_size); +ocrdma_del_mmap (uctx, db_page_addr, db_page_size);return status; }
Greg Kroah-Hartman
maintainerPATCH 261/589 RDMA/rxe: Reject unknown opcodes before ICRC processing
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Bommarito <[email protected]>
commit 4c6f86d85d03cdb33addce86aa69aa795ca6c47a upstream.
Even after applying commit 7244491dab34 ("RDMA/rxe: Validate pad and ICRC before payload_size() in rxe_rcv"), a single unauthenticated UDP packet can still trigger panic. That patch handled payload_size() underflow only for valid opcodes with short packets, not for packets carrying an unknown opcode. The unknown-opcode OOB read described below predates that commit and reaches back to the initial Soft RoCE driver.
The check added there reads
pkt->paylen < header_size(pkt) + bth_pad(pkt) + RXE_ICRC_SIZE
where header_size(pkt) expands to rxe_opcode[pkt->opcode].length. The rxe_opcode[] array has 256 entries but is only populated for defined IB opcodes; any other entry (for example opcode 0xff) is zero-initialized, so length == 0 and the check degenerates to
pkt->paylen < 0 + bth_pad(pkt) + RXE_ICRC_SIZE
which does not constrain pkt->paylen enough. rxe_icrc_hdr() then computes
rxe_opcode[pkt->opcode].length - RXE_BTH_BYTES
which underflows when length == 0 and passes a huge value to rxe_crc32(), causing an out-of-bounds read of the skb payload.
Reproduced on v7.0-rc7 with that fix applied, QEMU/KVM with CONFIG_RDMA_RXE=y and CONFIG_KASAN=y, after
rdma link add rxe0 type rxe netdev eth0
A single 48-byte UDP packet to port 4791 with BTH opcode=0xff and QPN=IB_MULTICAST_QPN triggers:
BUG: KASAN: slab-out-of-bounds in crc32_le+0x115/0x170
Read of size 1 at addr ...
The buggy address is located 0 bytes to the right of
allocated 704-byte region
Call Trace:
crc32_le+0x115/0x170
rxe_icrc_hdr.isra.0+0x226/0x300
rxe_icrc_check+0x13f/0x3a0
rxe_rcv+0x6e1/0x16e0
rxe_udp_encap_recv+0x20a/0x320
udp_queue_rcv_one_skb+0x7ed/0x12c0Subsequent packets with the same shape fault on unmapped memory and panic the kernel. The trigger requires only module load and "rdma link add"; no QP, no connection, and no authentication.
Fix this by rejecting packets whose opcode has no rxe_opcode[] entry, detected via the zero mask or zero length, before any length arithmetic runs.
--- drivers/infiniband/sw/rxe/rxe_recv.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/infiniband/sw/rxe/rxe_recv.c +11 -0
@@ -364,6 +364,17 @@ void rxe_rcv(struct sk_buff *skb) pkt->qp =NULL ; pkt->mask |= rxe_opcode[pkt->opcode].mask; +/* +* Unknown opcodes have a zero-initialized rxe_opcode[] entry, so +* both mask and length are 0. Reject them before any length math: +* rxe_icrc_hdr() would otherwise compute length - RXE_BTH_BYTES +* and pass the underflowed value to rxe_crc32(), producing an +* out-of-bounds read. +*/ +if (unlikely (!rxe_opcode[pkt->opcode].mask || + !rxe_opcode[pkt->opcode].length)) + goto drop; +if (unlikely (pkt->paylen <header_size (pkt) +bth_pad (pkt) +RXE_ICRC_SIZE )) goto drop;
Greg Kroah-Hartman
maintainerPATCH 262/589 RDMA/vmw_pvrdma: Fix double free on pvrdma_alloc_ucontext() error path
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
commit e38e86995df27f1f854063dab1f0c6a513db3faf upstream.
Sashiko points out that pvrdma_uar_free() is already called within pvrdma_dealloc_ucontext(), so calling it before triggers a double free.
--- drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c +1 -1
@@ -350,7 +350,7 @@ int pvrdma_alloc_ucontext(struct ib_ucon uresp.qp_tab_size = vdev->dsr->caps.max_qp; ret =ib_copy_to_udata (udata, &uresp,sizeof (uresp));if (ret) { -pvrdma_uar_free (vdev, &context->uar); +/* pvrdma_dealloc_ucontext() also frees the UAR */ pvrdma_dealloc_ucontext (&context->ibucontext);return -EFAULT ; }
Greg Kroah-Hartman
maintainerPATCH 263/589 media: uvcvideo: Enable VB2_DMABUF for metadata stream
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit fbac03467e53d8d72e5099c03df26d9adae11416 upstream.
The UVC driver has two video streams, one for the frames and another one for the metadata. Both streams share most of the codebase, but only the data stream declares support for DMABUF transfer mode.
I have tried the DMABUF transfer mode with CONFIG_DMABUF_HEAPS_SYSTEM and the frames looked correct.
This patch announces the support for DMABUF for the metadata stream. This is useful for apps/HALs that only want to support DMABUF.
--- drivers/media/usb/uvc/uvc_queue.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/usb/uvc/uvc_queue.c +1 -2
@@ -222,7 +222,7 @@ int uvc_queue_init(struct uvc_video_queuint ret; queue->queue.type = type; - queue->queue.io_modes =VB2_MMAP |VB2_USERPTR ; + queue->queue.io_modes =VB2_MMAP |VB2_USERPTR |VB2_DMABUF ; queue->queue.drv_priv = queue; queue->queue.buf_struct_size =sizeof (struct uvc_buffer ); queue->queue.mem_ops = &vb2_vmalloc_memops;
@@ -235,7 +235,6 @@ int uvc_queue_init(struct uvc_video_queu queue->queue.ops = &uvc_meta_queue_qops;break ;default : - queue->queue.io_modes |=VB2_DMABUF ; queue->queue.ops = &uvc_queue_qops;break ; }
Re: [PATCH 5.10 263/589] media: uvcvideo: Enable VB2_DMABUF for metadata stream
Quoted 12 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit
fbac03467e53d8d72e5099c03df26d9adae11416upstream.The UVC driver has two video streams, one for the frames and another one for the metadata. Both streams share most of the codebase, but only the data stream declares support for DMABUF transfer mode.
Quoted 5 lines
I have tried the DMABUF transfer mode with
CONFIG_DMABUF_HEAPS_SYSTEMand the frames looked correct.This patch announces the support for DMABUF for the metadata stream. This is useful for apps/HALs that only want to support DMABUF.
So this is a feature addition.
And the uvcvideo driver has changed a lot since 5.10 (or even 6.1), so unless someone specifically tested that these older versions will also work with dmabuf I question whether this is worth the risk.
Ben.
Quoted 34 lines
Fixes 088ead2552458 ("media: uvcvideo: Add a metadata device node")Signed-off-by Ricardo Ribalda <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>Reviewed-by Hans de Goede <[email protected]>Signed-off-by Laurent Pinchart <[email protected]>Signed-off-by Hans Verkuil <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/media/usb/uvc/uvc_queue.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/media/usb/uvc/uvc_queue.c +1
-2@@ -222,7 +222,7 @@ int uvc_queue_init(struct uvc_video_queuint ret; queue->queue.type = type; - queue->queue.io_modes =VB2_MMAP |VB2_USERPTR ; + queue->queue.io_modes =VB2_MMAP |VB2_USERPTR |VB2_DMABUF ; queue->queue.drv_priv = queue; queue->queue.buf_struct_size =sizeof (struct uvc_buffer ); queue->queue.mem_ops = &vb2_vmalloc_memops;@@ -235,7 +235,6 @@ int uvc_queue_init(struct uvc_video_queu queue->queue.ops = &uvc_meta_queue_qops;break ;default : - queue->queue.io_modes |=VB2_DMABUF ; queue->queue.ops = &uvc_queue_qops;break ; }
Signature · 4 lines
Ben Hutchings
The obvious mathematical breakthrough [to break modern encryption]
would be development of an easy way to factor large prime numbers.
- Bill GatesRe: [PATCH 5.10 263/589] media: uvcvideo: Enable VB2_DMABUF for metadata stream
Hi Ben
Quoted 17 lines · Ben Hutchings
Quoted 15 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit
fbac03467e53d8d72e5099c03df26d9adae11416upstream.The UVC driver has two video streams, one for the frames and another one for the metadata. Both streams share most of the codebase, but only the data stream declares support for DMABUF transfer mode.
I have tried the DMABUF transfer mode with
CONFIG_DMABUF_HEAPS_SYSTEMand the frames looked correct.
Quoted 8 lines
Quoted 2 lines
This patch announces the support for DMABUF for the metadata stream. This is useful for apps/HALs that only want to support DMABUF.
So this is a feature addition.
And the uvcvideo driver has changed a lot since 5.10 (or even 6.1), so unless someone specifically tested that these older versions will also work with dmabuf I question whether this is worth the risk.
Just one note: The different transfer modes are implemented by vb2, not by the driver, so changes in the driver should not affect this specific change.
I have no specific use case for this change in 5.10. So I am fine if it is not backported that far. But it should be very low risk (famous last words)
Quoted 43 lines
Ben.
Quoted 27 lines
Fixes 088ead2552458 ("media: uvcvideo: Add a metadata device node")Signed-off-by Ricardo Ribalda <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>Reviewed-by Hans de Goede <[email protected]>Signed-off-by Laurent Pinchart <[email protected]>Signed-off-by Hans Verkuil <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/media/usb/uvc/uvc_queue.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/media/usb/uvc/uvc_queue.c +1
-1@@ -222,7 +222,7 @@ int uvc_queue_init(struct uvc_video_queuint ret; queue->queue.type = type; - queue->queue.io_modes =VB2_MMAP |VB2_USERPTR ; + queue->queue.io_modes =VB2_MMAP |VB2_USERPTR |VB2_DMABUF ; queue->queue.drv_priv = queue; queue->queue.buf_struct_size =sizeof (struct uvc_buffer ); queue->queue.mem_ops = &vb2_vmalloc_memops;drivers/media/usb/uvc/uvc_queue.c int uvc_queue_init(struct uvc_video_queu · line 240
Quoted 7 lines
drivers/media/usb/uvc/uvc_queue.c +0
-1@@ -235,7 +235,6 @@ int uvc_queue_init(struct uvc_video_queu queue->queue.ops = &uvc_meta_queue_qops;break ;default : - queue->queue.io_modes |=VB2_DMABUF ; queue->queue.ops = &uvc_queue_qops;break ; }--
Ben Hutchings
The obvious mathematical breakthrough [to break modern encryption] would be development of an easy way to factor large prime numbers.
- Bill Gates
Signature · 1 line
Ricardo Ribalda
Greg Kroah-Hartman
maintainerPATCH 264/589 staging: media: atomisp: Disallow all private IOCTLs
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit 2b7eb2c5dc72f0fc954ac4aa155f9e285e937f7c upstream.
Disallow all private IOCTLs. These aren't quite as safe as one could assume of IOCTL handlers; disable them for now. Instead of removing the code, return in the beginning of the function if cmd is non-zero in order to keep static checkers happy.
--- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +4 -0
@@ -2865,6 +2865,10 @@ static long atomisp_vidioc_default(strucbool acc_node;int err; +/* Disable all private IOCTLs for now! */ +if (cmd) +return -EINVAL ; + acc_node = !strcmp (vdev->name,"ATOMISP ISP ACC" );if (acc_node) asd =atomisp_to_acc_pipe (vdev)->asd;
Greg Kroah-Hartman
maintainerPATCH 265/589 regulator: max77650: fix OF node reference imbalance
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 2edaf5f7ada0ab5c9ec1f0836bd19779a8d85262 upstream.
The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.
Fix this by using the intended helper for reusing OF nodes.
--- drivers/regulator/max77650-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/max77650-regulator.c +1 -1
@@ -339,7 +339,7 @@ static int max77650_regulator_probe(stru parent = dev->parent;if (!dev->of_node) - dev->of_node = parent->of_node; +device_set_of_node_from_dev (dev, parent); rdescs =devm_kcalloc (dev,MAX77650_REGULATOR_NUM_REGULATORS ,sizeof (*rdescs),GFP_KERNEL );
Greg Kroah-Hartman
maintainerPATCH 266/589 media: rc: xbox_remote: heed DMA restrictions
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit e280d1e5e3f2595bbb43fe6e1bce00c59a43c0ff upstream.
The buffer for IO must not be part of the device structure because that violates the DMA coherency rules.
--- drivers/media/rc/xbox_remote.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/media/rc/xbox_remote.c +8 -1
@@ -55,7 +55,7 @@ struct xbox_remote {struct usb_interface *interface;struct urb *irq_urb; -unsigned char inbuf[DATA_BUFSIZE ]__aligned(sizeof(u16)) ; +u8 *inbuf;char rc_name[NAME_BUFSIZE ];char rc_phys[NAME_BUFSIZE ];
@@ -220,6 +220,10 @@ static int xbox_remote_probe(struct usb_if (!xbox_remote || !rc_dev) goto exit_free_dev_rdev; + xbox_remote->inbuf =kzalloc (DATA_BUFSIZE ,GFP_KERNEL ); +if (!xbox_remote->inbuf) + goto exit_free_inbuf; +/* Allocate URB buffer */ xbox_remote->irq_urb =usb_alloc_urb (0 ,GFP_KERNEL );if (!xbox_remote->irq_urb)
@@ -266,6 +270,8 @@ exit_kill_urbs:usb_kill_urb (xbox_remote->irq_urb); exit_free_buffers:usb_free_urb (xbox_remote->irq_urb); +exit_free_inbuf: +kfree (xbox_remote->inbuf); exit_free_dev_rdev:rc_free_device (rc_dev);kfree (xbox_remote);
@@ -290,6 +296,7 @@ static void xbox_remote_disconnect(strucusb_kill_urb (xbox_remote->irq_urb);rc_unregister_device (xbox_remote->rdev);usb_free_urb (xbox_remote->irq_urb); +kfree (xbox_remote->inbuf);kfree (xbox_remote); }
Greg Kroah-Hartman
maintainerPATCH 267/589 media: rc: streamzap: Error handling in probe
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit 42844992664f03ef9f930e64f7370fa481e9c267 upstream.
If submitting the URB fails, the device will be unusable. Probe() must fail.
--- drivers/media/rc/streamzap.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/media/rc/streamzap.c +8 -4
@@ -255,9 +255,8 @@ static void streamzap_callback(struct urcase -ESHUTDOWN :/* * this urb is terminated, clean up. -* sz might already be invalid at this point */ -dev_err (sz->dev,"urb terminated, status: %d\n" , urb->status); +dev_dbg (sz->dev,"urb terminated, status: %d\n" , urb->status);return ;default :break ;
@@ -398,11 +397,16 @@ static int streamzap_probe(struct usb_inusb_set_intfdata (intf, sz); -if (usb_submit_urb (sz->urb_in,GFP_ATOMIC )) + retval =usb_submit_urb (sz->urb_in,GFP_ATOMIC ); +if (retval <0 ) {dev_err (sz->dev,"urb submit failed\n" ); + goto rc_submit_fail; + }return 0 ; - +rc_submit_fail: +rc_free_device (sz->rdev); +usb_set_intfdata (intf,NULL ); rc_dev_fail:usb_free_urb (sz->urb_in); free_buf_in:
Re: [PATCH 5.10 267/589] media: rc: streamzap: Error handling in probe
Quoted 10 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit
42844992664f03ef9f930e64f7370fa481e9c267upstream.If submitting the URB fails, the device will be unusable.
Probe()must fail.
[...]
Quoted 5 lines
drivers/media/rc/streamzap.c +0
-1@@ -398,11 +397,16 @@ static int streamzap_probe(struct usb_inusb_set_intfdata (intf, sz); -if (usb_submit_urb (sz->urb_in,GFP_ATOMIC ))
drivers/media/rc/streamzap.c static int streamzap_probe(struct usb_in · line 408
Quoted 10 lines
drivers/media/rc/streamzap.c +6
-1+ retval =usb_submit_urb (sz->urb_in,GFP_ATOMIC ); +if (retval <0 ) {dev_err (sz->dev,"urb submit failed\n" ); + goto rc_submit_fail; + }return 0 ; - +rc_submit_fail: +rc_free_device (sz->rdev);
Shouldn't this be rc_unregister_device()?
Ben.
Quoted 6 lines
drivers/media/rc/streamzap.c +1
-0+usb_set_intfdata (intf,NULL ); rc_dev_fail:usb_free_urb (sz->urb_in); free_buf_in:
Signature · 4 lines
Ben Hutchings
The obvious mathematical breakthrough [to break modern encryption]
would be development of an easy way to factor large prime numbers.
- Bill GatesGreg Kroah-Hartman
maintainerPATCH 268/589 regulator: act8945a: fix OF node reference imbalance
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 0d15ce31375ccef4162f960b34547a821b7619d2 upstream.
The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.
Fix this by using the intended helper for reusing OF nodes.
--- drivers/regulator/act8945a-regulator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/regulator/act8945a-regulator.c +2 -1
@@ -302,8 +302,9 @@ static int act8945a_pmic_probe(struct pl num_regulators =ARRAY_SIZE (act8945a_regulators); } +device_set_of_node_from_dev (&pdev->dev, pdev->dev.parent); + config.dev = &pdev->dev; - config.dev->of_node = pdev->dev.parent->of_node; config.driver_data = act8945a;for (i =0 ; i < num_regulators; i++) { rdev = devm_regulator_register(&pdev->dev, ®ulators[i],
Greg Kroah-Hartman
maintainerPATCH 269/589 media: dib8000: avoid division by 0 in dib8000_set_dds()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Shtylyov <[email protected]>
commit dde3c37af95cd6fa301c4906f33d627bc9dd874c upstream.
In dib8000_set_dds(), 1 << 26 (67108864) divided by e.g. 1 apparently can't fit into 16-bit variable unit_khz_dds_val, being truncated to 0; this will cause division by 0 while calling dprintk() with debugging enabled (via the module parameter). Use s32 instead of s16 to declare the variable, getting rid of the cast to u16 in the *else* branch as well...
Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool.
--- drivers/media/dvb-frontends/dib8000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/dvb-frontends/dib8000.c +2 -2
@@ -2694,7 +2694,7 @@ static void dib8000_viterbi_state(structstatic void dib8000_set_dds (struct dib8000_state *state,s32 offset_khz) { -s16 unit_khz_dds_val; +s32 unit_khz_dds_val;u32 abs_offset_khz =abs (offset_khz);u32 dds = state->cfg.pll->ifreq &0x1ffffff ;u8 invert = !!(state->cfg.pll->ifreq & (1 <<25 ));
@@ -2715,7 +2715,7 @@ static void dib8000_set_dds(struct dib80 dds = (1 <<26 ) - dds; }else { ratio =2 ; - unit_khz_dds_val = (u16) (67108864 / state->cfg.pll->internal); + unit_khz_dds_val =67108864 / state->cfg.pll->internal;if (offset_khz <0 ) unit_khz_dds_val *=-1 ;