5.10.230-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 5.10.230-rc1 review
This is the start of the stable review cycle for the 5.10.230 release. There are 82 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun, 17 Nov 2024 06:37:07 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.230-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.10.230-rc1
Linus Torvalds <[email protected]>
9p: fix slab cache name creation for real
Qun-Wei Lin <[email protected]>
mm: krealloc: Fix MTE false alarm in __do_krealloc
Hagar Hemdan <[email protected]>
io_uring: fix possible deadlock in io_register_iowq_max_workers()
Li Nan <[email protected]>
md/raid10: improve code of mrdev in raid10_sync_request
Reinhard Speyerer <[email protected]>
net: usb: qmi_wwan: add Fibocom FG132 0x0112 composition
Alessandro Zanni <[email protected]>
fs: Fix uninitialized value issue in from_kuid and from_kgid
Yuan Can <[email protected]>
vDPA/ifcvf: Fix pci_read_config_byte() return code handling
Michael Ellerman <[email protected]>
powerpc/powernv: Free name on error in opal_event_init()
Julian Vetter <[email protected]>
sound: Make CONFIG_SND depend on INDIRECT_IOMEM instead of UML
Herbert Xu <[email protected]>
crypto: marvell/cesa - Disable hash algorithms
Rik van Riel <[email protected]>
bpf: use kvzmalloc to allocate BPF verifier environment
WangYuli <[email protected]>
HID: multitouch: Add quirk for HONOR MagicBook Art 14 touchpad
Pedro Falcato <[email protected]>
9p: Avoid creating multiple slab caches with the same name
Ioana Ciornei <[email protected]>
net: phy: ti: take into account all possible interrupt sources
Jan Schär <[email protected]>
ALSA: usb-audio: Add endianness annotations
Hyunwoo Kim <[email protected]>
vsock/virtio: Initialization of the dangling pointer occurring in vsk->trans
Hyunwoo Kim <[email protected]>
hv_sock: Initializing vsk->trans to NULL to prevent a dangling pointer
Jan Schär <[email protected]>
ALSA: usb-audio: Add quirks for Dell WD19 dock
Jan Schär <[email protected]>
ALSA: usb-audio: Support jack detection on Dell dock
Andrew Kanner <[email protected]>
ocfs2: remove entry once instead of null-ptr-dereference in ocfs2_xa_remove()
Marc Zyngier <[email protected]>
irqchip/gic-v3: Force propagation of the active state with a read-back
Benoît Monin <[email protected]>
USB: serial: option: add Quectel RG650V
Reinhard Speyerer <[email protected]>
USB: serial: option: add Fibocom FG132 0x0112 composition
Jack Wu <[email protected]>
USB: serial: qcserial: add support for Sierra Wireless EM86xx
Dan Carpenter <[email protected]>
USB: serial: io_edgeport: fix use after free in debug printk
Dan Carpenter <[email protected]>
usb: typec: fix potential out of bounds in ucsi_ccg_update_set_new_cam_cmd()
Zijun Hu <[email protected]>
usb: musb: sunxi: Fix accessing an released usb phy
Qi Xi <[email protected]>
fs/proc: fix compile warning about variable 'vmcore_mmap_ops'
Benoit Sevens <[email protected]>
media: uvcvideo: Skip parsing frames of type UVC_VS_UNDEFINED in uvc_parse_format
Eric Dumazet <[email protected]>
net: do not delay dst_entries_add() in dst_release()
Riccardo Mancini <[email protected]>
perf session: Add missing evlist__delete when deleting a session
Shuai Xue <[email protected]>
Revert "perf hist: Add missing puts to hist__account_cycles"
Nikolay Aleksandrov <[email protected]>
net: bridge: xmit: make sure we have at least eth header len bytes
Michael Walle <[email protected]>
spi: fix use-after-free of the add_lock mutex
Mark Brown <[email protected]>
spi: Fix deadlock when adding SPI controllers on SPI buses
Pavel Begunkov <[email protected]>
splice: don't generate zero-len segement bvecs
Filipe Manana <[email protected]>
btrfs: reinitialize delayed ref list after deleting it from the list
Roberto Sassu <[email protected]>
nfs: Fix KMSAN warning in decode_getfattr_attrs()
Jens Axboe <[email protected]>
io_uring/rw: fix missing NOWAIT check for O_DIRECT start write
Amir Goldstein <[email protected]>
io_uring: use kiocb_{start,end}_write() helpers
Amir Goldstein <[email protected]>
fs: create kiocb_{start,end}_write() helpers
Amir Goldstein <[email protected]>
io_uring: rename kiocb_end_write() local helper
Zichen Xie <[email protected]>
dm-unstriped: cast an operand to sector_t to prevent potential uint32_t overflow
Ming-Hung Tsai <[email protected]>
dm cache: fix potential out-of-bounds access on the first resume
Ming-Hung Tsai <[email protected]>
dm cache: optimize dirty bit checking with find_next_bit when resizing
Ming-Hung Tsai <[email protected]>
dm cache: fix out-of-bounds access to the dirty bitset when resizing
Ming-Hung Tsai <[email protected]>
dm cache: correct the number of origin blocks to match the target length
Antonio Quartulli <[email protected]>
drm/amdgpu: prevent NULL pointer dereference if ATIF is not supported
Alex Deucher <[email protected]>
drm/amdgpu: add missing size check in amdgpu_debugfs_gprwave_read()
Erik Schumacher <[email protected]>
pwm: imx-tpm: Use correct MODULO value for EPWM mode
Mauro Carvalho Chehab <[email protected]>
media: v4l2-tpg: prevent the risk of a division by zero
Mauro Carvalho Chehab <[email protected]>
media: pulse8-cec: fix data timestamp at pulse8_setup()
Mauro Carvalho Chehab <[email protected]>
media: cx24116: prevent overflows on SNR calculus
Mauro Carvalho Chehab <[email protected]>
media: s5p-jpeg: prevent buffer overflows
Amelie Delaunay <[email protected]>
ASoC: stm32: spdifrx: fix dma channel release in stm32_spdifrx_remove
Murad Masimov <[email protected]>
ALSA: firewire-lib: fix return value on fail in amdtp_tscm_init()
Johannes Thumshirn <[email protected]>
scsi: sd_zbc: Use kvzalloc() to allocate REPORT ZONES buffer
Mauro Carvalho Chehab <[email protected]>
media: adv7604: prevent underflow condition when reporting colorspace
Mauro Carvalho Chehab <[email protected]>
media: dvb_frontend: don't play tricks with underflow values
Mauro Carvalho Chehab <[email protected]>
media: dvbdev: prevent the risk of out of memory access
Mauro Carvalho Chehab <[email protected]>
media: stb0899_algo: initialize cfr before using it
Jarosław Janik <[email protected]>
Revert "ALSA: hda/conexant: Mute speakers at suspend / shutdown"
Johan Jonker <[email protected]>
net: arc: fix the device for dma_map_single/dma_unmap_single
Diogo Silva <[email protected]>
net: phy: ti: add PHY_RST_AFTER_CLK_EN flag
Ioana Ciornei <[email protected]>
net: phy: ti: implement generic .handle_interrupt() callback
Ioana Ciornei <[email protected]>
net: phy: export phy_error and phy_trigger_machine
Peiyang Wang <[email protected]>
net: hns3: fix kernel crash when uninstalling driver
Dario Binacchi <[email protected]>
can: c_can: fix {rx,tx}_errors statistics
Xin Long <[email protected]>
sctp: properly validate chunk size in sctp_sf_ootb()
Wei Fang <[email protected]>
net: enetc: set MAC address to the VF net_device
Chen Ridong <[email protected]>
security/keys: fix slab-out-of-bounds in key_task_permission
Jiri Kosina <[email protected]>
HID: core: zero-initialize the report buffer
Heiko Stuebner <[email protected]>
ARM: dts: rockchip: Fix the realtek audio codec on rk3036-kylin
Heiko Stuebner <[email protected]>
ARM: dts: rockchip: Fix the spi controller on rk3036
Heiko Stuebner <[email protected]>
ARM: dts: rockchip: drop grf reference from rk3036 hdmi
Heiko Stuebner <[email protected]>
ARM: dts: rockchip: fix rk3036 acodec node
Peng Fan <[email protected]>
arm64: dts: imx8mp: correct sdhc ipg clk
Heiko Stuebner <[email protected]>
arm64: dts: rockchip: Fix LED triggers on rk3308-roc-cc
Heiko Stuebner <[email protected]>
arm64: dts: rockchip: Remove #cooling-cells from fan on Theobroma lion
Heiko Stuebner <[email protected]>
arm64: dts: rockchip: Fix bluetooth properties on Rock960 boards
Diederik de Haas <[email protected]>
arm64: dts: rockchip: Remove hdmi's 2nd interrupt on rk3328
Geert Uytterhoeven <[email protected]>
arm64: dts: rockchip: Fix rt5651 compatible value on rk3399-sapphire-excavator
-------------
Diffstat:
Makefile | 4 +- arch/arm/boot/dts/rk3036-kylin.dts | 4 +- arch/arm/boot/dts/rk3036.dtsi | 14 +- arch/arm64/boot/dts/freescale/imx8mp.dtsi | 6 +- arch/arm64/boot/dts/rockchip/rk3308-roc-cc.dts | 4 +- arch/arm64/boot/dts/rockchip/rk3328.dtsi | 3 +- arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi | 1 - arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi | 2 +- .../dts/rockchip/rk3399-sapphire-excavator.dts | 2 +- arch/powerpc/platforms/powernv/opal-irqchip.c | 1 + drivers/crypto/marvell/cesa/hash.c | 12 +- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +- drivers/hid/hid-core.c | 2 +- drivers/hid/hid-multitouch.c | 5 + drivers/irqchip/irq-gic-v3.c | 7 + drivers/md/dm-cache-target.c | 35 ++--- drivers/md/dm-unstripe.c | 4 +- drivers/md/raid10.c | 23 +-- drivers/media/cec/usb/pulse8/pulse8-cec.c | 2 +- drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 3 + drivers/media/dvb-core/dvb_frontend.c | 4 +- drivers/media/dvb-core/dvbdev.c | 17 ++- drivers/media/dvb-frontends/cx24116.c | 7 +- drivers/media/dvb-frontends/stb0899_algo.c | 2 +- drivers/media/i2c/adv7604.c | 26 ++-- drivers/media/platform/s5p-jpeg/jpeg-core.c | 17 ++- drivers/media/usb/uvc/uvc_driver.c | 2 +- drivers/net/can/c_can/c_can.c | 7 +- drivers/net/ethernet/arc/emac_main.c | 27 ++-- drivers/net/ethernet/freescale/enetc/enetc_vf.c | 9 +- drivers/net/ethernet/hisilicon/hns3/hnae3.c | 5 +- drivers/net/phy/dp83640.c | 27 ++++ drivers/net/phy/dp83822.c | 38 +++++ drivers/net/phy/dp83848.c | 35 +++++ drivers/net/phy/dp83867.c | 25 +++ drivers/net/phy/dp83869.c | 25 +++ drivers/net/phy/dp83tc811.c | 45 ++++++ drivers/net/phy/phy.c | 6 +- drivers/net/usb/qmi_wwan.c | 1 + drivers/pwm/pwm-imx-tpm.c | 4 +- drivers/scsi/sd_zbc.c | 3 +- drivers/spi/spi.c | 27 ++-- drivers/usb/musb/sunxi.c | 2 - drivers/usb/serial/io_edgeport.c | 8 +- drivers/usb/serial/option.c | 6 + drivers/usb/serial/qcserial.c | 2 + drivers/usb/typec/ucsi/ucsi_ccg.c | 2 + drivers/vdpa/ifcvf/ifcvf_base.c | 2 +- fs/btrfs/delayed-ref.c | 2 +- fs/nfs/inode.c | 1 + fs/ocfs2/file.c | 9 +- fs/ocfs2/xattr.c | 3 +- fs/proc/vmcore.c | 9 +- fs/splice.c | 9 +- include/linux/fs.h | 35 +++++ include/linux/phy.h | 2 + include/linux/spi/spi.h | 3 + io_uring/io_uring.c | 55 ++++--- kernel/bpf/verifier.c | 4 +- mm/slab_common.c | 2 +- net/9p/client.c | 12 +- net/bridge/br_device.c | 5 + net/core/dst.c | 17 ++- net/sctp/sm_statefuns.c | 2 +- net/vmw_vsock/hyperv_transport.c | 1 + net/vmw_vsock/virtio_transport_common.c | 1 + security/keys/keyring.c | 7 +- sound/Kconfig | 2 +- sound/firewire/tascam/amdtp-tascam.c | 2 +- sound/pci/hda/patch_conexant.c | 2 - sound/soc/stm/stm32_spdifrx.c | 2 +- sound/usb/mixer_quirks.c | 170 +++++++++++++++++++++ tools/perf/util/hist.c | 10 +- tools/perf/util/session.c | 5 +- 75 files changed, 703 insertions(+), 190 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/82 arm64: dts: rockchip: Fix rt5651 compatible value on rk3399-sapphire-excavator
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 577b5761679da90e691acc939ebbe7879fff5f31 ]
There are no DT bindings and driver support for a "rockchip,rt5651" codec. Replace "rockchip,rt5651" by "realtek,rt5651", which matches the "simple-audio-card,name" property in the "rt5651-sound" node.
--- arch/arm64/boot/dts/rockchip/rk3399-sapphire-excavator.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3399-sapphire-excavator.dts +1 -1
@@ -159,7 +159,7 @@ status = "okay"; rt5651: rt5651@1a { - compatible = "rockchip,rt5651"; + compatible = "realtek,rt5651"; reg = <0x1a>; clocks = <&cru SCLK_I2S_8CH_OUT>; clock-names = "mclk";
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 2/82 arm64: dts: rockchip: Remove hdmis 2nd interrupt on rk3328
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diederik de Haas <[email protected]>
[ Upstream commit de50a7e3681771c6b990238af82bf1dea9b11b21 ]
The "synopsys,dw-hdmi.yaml" binding specifies that the interrupts property of the hdmi node has 'maxItems: 1', so the hdmi node in rk3328.dtsi having 2 is incorrect.
Paragraph 1.3 ("System Interrupt connection") of the RK3328 TRM v1.1 page 16 and 17 define the following hdmi related interrupts:
- 67 hdmi_intr
- 103 hdmi_intr_wakeup
The difference of 32 is due to a different base used in the TRM.
The RK3399 (which uses the same binding) has '23: hdmi_irq' and '24: hdmi_wakeup_irq' according to its TRM (page 19).
The RK3568 (also same binding) has '76: hdmi_wakeup' and '77: hdmi' according to page 17 of its TRM.
In both cases the non-wakeup IRQ was used, so use that too for rk3328.
--- arch/arm64/boot/dts/rockchip/rk3328.dtsi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3328.dtsi +1 -2
@@ -715,8 +715,7 @@ compatible = "rockchip,rk3328-dw-hdmi"; reg = <0x0 0xff3c0000 0x0 0x20000>; reg-io-width = <4>; - interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru PCLK_HDMI>, <&cru SCLK_HDMI_SFC>, <&cru SCLK_RTC32K>;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 3/82 arm64: dts: rockchip: Fix bluetooth properties on Rock960 boards
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
[ Upstream commit ea74528aaea5a1dfc8e3de09ef2af37530eca526 ]
The expected clock-name is different, and extclk also is deprecated in favor of txco for clocks that are not crystals.
So fix it to match the binding.
--- arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi +1 -1
@@ -568,7 +568,7 @@ bluetooth { compatible = "brcm,bcm43438-bt"; clocks = <&rk808 1>; - clock-names = "ext_clock"; + clock-names = "txco"; device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 4/82 arm64: dts: rockchip: Remove #cooling-cells from fan on Theobroma lion
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
[ Upstream commit 5ed96580568c4f79a0aff11a67f10b3e9229ba86 ]
All Theobroma boards use a ti,amc6821 as fan controller.
It normally runs in an automatically controlled way and while it may be possible to use it as part of a dt-based thermal management, this is not yet specified in the binding, nor implemented in any kernel.
Newer boards already don't contain that #cooling-cells property, but older ones do. So remove them for now, they can be re-added if thermal integration gets implemented in the future.
There are two further occurences in v6.12-rc in px30-ringneck and rk3399-puma, but those already get removed by the i2c-mux conversion scheduled for 6.13 . As the undocumented property is in the kernel so long, I opted for not causing extra merge conflicts between 6.12 and 6.13
--- arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi | 1 - 1 file changed, 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi +0 -1
@@ -56,7 +56,6 @@ fan: fan@18 { compatible = "ti,amc6821"; reg = <0x18>; - #cooling-cells = <2>; }; rtc_twi: rtc@6f {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 5/82 arm64: dts: rockchip: Fix LED triggers on rk3308-roc-cc
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
[ Upstream commit 3a53a7187f41ec3db12cf4c2cb0db4ba87c2f3a1 ]
There are two LEDs on the board, power and user events. Currently both are assigned undocumented IR(-remote) triggers that are probably only part of the vendor-kernel.
To make dtbs check happier, assign the power-led to a generic default-on trigger and the user led to the documented rc-feedback trigger that should mostly match its current usage.
--- arch/arm64/boot/dts/rockchip/rk3308-roc-cc.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3308-roc-cc.dts +2 -2
@@ -30,14 +30,14 @@ power_led: led-0 { label = "firefly:red:power"; - linux,default-trigger = "ir-power-click"; + linux,default-trigger = "default-on"; default-state = "on"; gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; }; user_led: led-1 { label = "firefly:blue:user"; - linux,default-trigger = "ir-user-click"; + linux,default-trigger = "rc-feedback"; default-state = "off"; gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_HIGH>; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 6/82 arm64: dts: imx8mp: correct sdhc ipg clk
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit eab6ba2aa3bbaf598a66e31f709bf84b7bb7dc8a ]
The ipg clk for sdhc sources from IPG_CLK_ROOT per i.MX 8M Plus Applications Processor Reference Manual, Table 5-2. System Clocks.
--- arch/arm64/boot/dts/freescale/imx8mp.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/freescale/imx8mp.dtsi +3 -3
@@ -659,7 +659,7 @@ compatible = "fsl,imx8mp-usdhc", "fsl,imx7d-usdhc"; reg = <0x30b40000 0x10000>; interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&clk IMX8MP_CLK_DUMMY>, + clocks = <&clk IMX8MP_CLK_IPG_ROOT>, <&clk IMX8MP_CLK_NAND_USDHC_BUS>, <&clk IMX8MP_CLK_USDHC1_ROOT>; clock-names = "ipg", "ahb", "per";
@@ -673,7 +673,7 @@ compatible = "fsl,imx8mp-usdhc", "fsl,imx7d-usdhc"; reg = <0x30b50000 0x10000>; interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&clk IMX8MP_CLK_DUMMY>, + clocks = <&clk IMX8MP_CLK_IPG_ROOT>, <&clk IMX8MP_CLK_NAND_USDHC_BUS>, <&clk IMX8MP_CLK_USDHC2_ROOT>; clock-names = "ipg", "ahb", "per";
@@ -687,7 +687,7 @@ compatible = "fsl,imx8mp-usdhc", "fsl,imx7d-usdhc"; reg = <0x30b60000 0x10000>; interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&clk IMX8MP_CLK_DUMMY>, + clocks = <&clk IMX8MP_CLK_IPG_ROOT>, <&clk IMX8MP_CLK_NAND_USDHC_BUS>, <&clk IMX8MP_CLK_USDHC3_ROOT>; clock-names = "ipg", "ahb", "per";
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 7/82 ARM: dts: rockchip: fix rk3036 acodec node
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
[ Upstream commit c7206853cd7d31c52575fb1dc7616b4398f3bc8f ]
The acodec node is not conformant to the binding.
Set the correct nodename, use the correct compatible, add the needed #sound-dai-cells and sort the rockchip,grf below clocks properties as expected.
--- arch/arm/boot/dts/rk3036.dtsi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/arm/boot/dts/rk3036.dtsi +4 -3
@@ -316,12 +316,13 @@ }; }; - acodec: acodec-ana@20030000 { - compatible = "rk3036-codec"; + acodec: audio-codec@20030000 { + compatible = "rockchip,rk3036-codec"; reg = <0x20030000 0x4000>; - rockchip,grf = <&grf>; clock-names = "acodec_pclk"; clocks = <&cru PCLK_ACODEC>; + rockchip,grf = <&grf>; + #sound-dai-cells = <0>; status = "disabled"; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 8/82 ARM: dts: rockchip: drop grf reference from rk3036 hdmi
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
[ Upstream commit 1580ccb6ed9dc76b8ff3e2d8912e8215c8b0fa6d ]
Neither the binding nor the driver implementation specify/use the grf reference provided in the rk3036. And neither does the newer rk3128 user of the hdmi controller. So drop the rockchip,grf property.
--- arch/arm/boot/dts/rk3036.dtsi | 1 - 1 file changed, 1 deletion(-)
arch/arm/boot/dts/rk3036.dtsi +0 -1
@@ -332,7 +332,6 @@ interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru PCLK_HDMI>; clock-names = "pclk"; - rockchip,grf = <&grf>; pinctrl-names = "default"; pinctrl-0 = <&hdmi_ctl>; status = "disabled";
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 9/82 ARM: dts: rockchip: Fix the spi controller on rk3036
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
[ Upstream commit 8bade1ad1f0821aef31f6a8fb1027ae292566d85 ]
Compatible and clock names did not match the existing binding. So set the correct values and re-order+rename the clocks.
It looks like no rk3036 board did use the spi controller so far, so this was never detected on a running device yet.
--- arch/arm/boot/dts/rk3036.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/rk3036.dtsi +3 -3
@@ -488,11 +488,11 @@ }; spi: spi@20074000 { - compatible = "rockchip,rockchip-spi"; + compatible = "rockchip,rk3036-spi"; reg = <0x20074000 0x1000>; interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&cru PCLK_SPI>, <&cru SCLK_SPI>; - clock-names = "apb-pclk","spi_pclk"; + clocks = <&cru SCLK_SPI>, <&cru PCLK_SPI>; + clock-names = "spiclk", "apb_pclk"; dmas = <&pdma 8>, <&pdma 9>; dma-names = "tx", "rx"; pinctrl-names = "default";
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 10/82 ARM: dts: rockchip: Fix the realtek audio codec on rk3036-kylin
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
[ Upstream commit 77a9a7f2d3b94d29d13d71b851114d593a2147cf ]
Both the node name as well as the compatible were not named according to the binding expectations, fix that.
--- arch/arm/boot/dts/rk3036-kylin.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/rk3036-kylin.dts +2 -2
@@ -300,8 +300,8 @@ &i2c2 { status = "okay"; - rt5616: rt5616@1b { - compatible = "rt5616"; + rt5616: audio-codec@1b { + compatible = "realtek,rt5616"; reg = <0x1b>; clocks = <&cru SCLK_I2S_OUT>; clock-names = "mclk";
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 11/82 HID: core: zero-initialize the report buffer
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Kosina <[email protected]>
[ Upstream commit 177f25d1292c7e16e1199b39c85480f7f8815552 ]
Since the report buffer is used by all kinds of drivers in various ways, let's zero-initialize it during allocation to make sure that it can't be ever used to leak kernel memory via specially-crafted report.
--- drivers/hid/hid-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-core.c +1 -1
@@ -1664,7 +1664,7 @@ u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags)u32 len =hid_report_len (report) +7 ; -return kmalloc (len, flags); +return kzalloc (len, flags); }EXPORT_SYMBOL_GPL (hid_alloc_report_buf);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 12/82 security/keys: fix slab-out-of-bounds in key_task_permission
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ridong <[email protected]>
[ Upstream commit 4a74da044ec9ec8679e6beccc4306b936b62873f ]
KASAN reports an out of bounds read:
BUG: KASAN: slab-out-of-bounds in __kuid_val include/linux/uidgid.h:36 BUG: KASAN: slab-out-of-bounds in uid_eq include/linux/uidgid.h:63 [inline] BUG: KASAN: slab-out-of-bounds in key_task_permission+0x394/0x410 security/keys/permission.c:54 Read of size 4 at addr ffff88813c3ab618 by task stress-ng/4362 CPU: 2 PID: 4362 Comm: stress-ng Not tainted 5.10.0-14930-gafbffd6c3ede #15 Call Trace: __dump_stack lib/dump_stack.c:82 [inline] dump_stack+0x107/0x167 lib/dump_stack.c:123 print_address_description.constprop.0+0x19/0x170 mm/kasan/report.c:400 __kasan_report.cold+0x6c/0x84 mm/kasan/report.c:560 kasan_report+0x3a/0x50 mm/kasan/report.c:585 __kuid_val include/linux/uidgid.h:36 [inline] uid_eq include/linux/uidgid.h:63 [inline] key_task_permission+0x394/0x410 security/keys/permission.c:54 search_nested_keyrings+0x90e/0xe90 security/keys/keyring.c:793
This issue was also reported by syzbot.
It can be reproduced by following these steps(more details [1]):
1. Obtain more than 32 inputs that have similar hashes, which ends with the pattern '0xxxxxxxe6'.
2. Reboot and add the keys obtained in step 1.
The reproducer demonstrates how this issue happened:
1. In the search_nested_keyrings function, when it iterates through the slots in a node(below tag ascend_to_node), if the slot pointer is meta and node->back_pointer != NULL(it means a root), it will proceed to descend_to_node. However, there is an exception. If node is the root, and one of the slots points to a shortcut, it will be treated as a keyring.
2. Whether the ptr is keyring decided by keyring_ptr_is_keyring function. However, KEYRING_PTR_SUBTYPE is 0x2UL, the same as ASSOC_ARRAY_PTR_SUBTYPE_MASK.
3. When 32 keys with the similar hashes are added to the tree, the ROOT has keys with hashes that are not similar (e.g. slot 0) and it splits NODE A without using a shortcut. When NODE A is filled with keys that all hashes are xxe6, the keys are similar, NODE A will split with a shortcut. Finally, it forms the tree as shown below, where slot 6 points to a shortcut.
NODE A
+------>+---+
ROOT | | 0 | xxe6
+---+ | +---+
xxxx | 0 | shortcut : : xxe6
+---+ | +---+
xxe6 : : | | | xxe6
+---+ | +---+
| 6 |---+ : : xxe6
+---+ +---+
xxe6 : : | f | xxe6
+---+ +---+
xxe6 | f |
+---+4. As mentioned above, If a slot(slot 6) of the root points to a shortcut, it may be mistakenly transferred to a key*, leading to a read out-of-bounds read.
To fix this issue, one should jump to descend_to_node if the ptr is a shortcut, regardless of whether the node is root or not.
[1] https://lore.kernel.org/linux-kernel/[email protected]/
[jarkko: tweaked the commit message a bit to have an appropriate closes
tag.]
--- security/keys/keyring.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
security/keys/keyring.c +5 -2
@@ -772,8 +772,11 @@ static bool search_nested_keyrings(struct key *keyring,for (; slot <ASSOC_ARRAY_FAN_OUT ; slot++) { ptr =READ_ONCE (node->slots[slot]); -if (assoc_array_ptr_is_meta (ptr) && node->back_pointer) - goto descend_to_node; +if (assoc_array_ptr_is_meta (ptr)) { +if (node->back_pointer || +assoc_array_ptr_is_shortcut (ptr)) + goto descend_to_node; + }if (!keyring_ptr_is_keyring (ptr))continue ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 13/82 net: enetc: set MAC address to the VF net_device
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit badccd49b93bb945bf4e5cc8707db67cdc5e27e5 ]
The MAC address of VF can be configured through the mailbox mechanism of ENETC, but the previous implementation forgot to set the MAC address in net_device, resulting in the SMAC of the sent frames still being the old MAC address. Since the MAC address in the hardware has been changed, Rx cannot receive frames with the DMAC address as the new MAC address. The most obvious phenomenon is that after changing the MAC address, we can see that the MAC address of eno0vf0 has not changed through the "ifconfig eno0vf0" command and the IP address cannot be obtained .
root@ls1028ardb:~# ifconfig eno0vf0 down
root@ls1028ardb:~# ifconfig eno0vf0 hw ether 00:04:9f:3a:4d:56 up
root@ls1028ardb:~# ifconfig eno0vf0
eno0vf0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 66:36:2c:3b:87:76 txqueuelen 1000 (Ethernet)
RX packets 794 bytes 69239 (69.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 11 bytes 2226 (2.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0--- drivers/net/ethernet/freescale/enetc/enetc_vf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/enetc/enetc_vf.c +8 -1
@@ -78,11 +78,18 @@ static int enetc_vf_set_mac_addr(struct net_device *ndev, void *addr) {struct enetc_ndev_priv *priv =netdev_priv (ndev);struct sockaddr *saddr = addr; +int err;if (!is_valid_ether_addr (saddr->sa_data))return -EADDRNOTAVAIL ; -return enetc_msg_vsi_set_primary_mac_addr (priv, saddr); + err =enetc_msg_vsi_set_primary_mac_addr (priv, saddr); +if (err) +return err; + +eth_hw_addr_set (ndev, saddr->sa_data); + +return 0 ; } static int enetc_vf_set_features(struct net_device *ndev,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 14/82 sctp: properly validate chunk size in sctp_sf_ootb()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit 0ead60804b64f5bd6999eec88e503c6a1a242d41 ]
A size validation fix similar to that in Commit 50619dbf8db7 ("sctp: add size validation when walking chunks") is also required in sctp_sf_ootb() to address a crash reported by syzbot:
BUG: KMSAN: uninit-value in sctp_sf_ootb+0x7f5/0xce0 net/sctp/sm_statefuns.c:3712 sctp_sf_ootb+0x7f5/0xce0 net/sctp/sm_statefuns.c:3712 sctp_do_sm+0x181/0x93d0 net/sctp/sm_sideeffect.c:1166 sctp_endpoint_bh_rcv+0xc38/0xf90 net/sctp/endpointola.c:407 sctp_inq_push+0x2ef/0x380 net/sctp/inqueue.c:88 sctp_rcv+0x3831/0x3b20 net/sctp/input.c:243 sctp4_rcv+0x42/0x50 net/sctp/protocol.c:1159 ip_protocol_deliver_rcu+0xb51/0x13d0 net/ipv4/ip_input.c:205 ip_local_deliver_finish+0x336/0x500 net/ipv4/ip_input.c:233
--- net/sctp/sm_statefuns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sctp/sm_statefuns.c +1 -1
@@ -3637,7 +3637,7 @@ enum sctp_disposition sctp_sf_ootb(struct net *net, } ch = (struct sctp_chunkhdr *)ch_end; - }while (ch_end <skb_tail_pointer (skb)); + }while (ch_end +sizeof (*ch) <skb_tail_pointer (skb));if (ootb_shut_ack)return sctp_sf_shut_8_4_5 (net, ep, asoc, type, arg, commands);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 15/82 can: c_can: fix {rx,tx}_errors statistics
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dario Binacchi <[email protected]>
[ Upstream commit 4d6d26537940f3b3e17138987ed9e4a334780bf7 ]
The c_can_handle_bus_err() function was incorrectly incrementing only the receive error counter, even in cases of bit or acknowledgment errors that occur during transmission. The patch fixes the issue by incrementing the appropriate counter based on the type of error.
--- drivers/net/can/c_can/c_can.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/can/c_can/c_can.c +6 -1
@@ -992,7 +992,6 @@ static int c_can_handle_bus_err(struct net_device *dev,/* common for all type of bus errors */ priv->can.can_stats.bus_error++; - stats->rx_errors++;/* propagate the error condition to the CAN stack */ skb =alloc_can_err_skb (dev, &cf);
@@ -1009,26 +1008,32 @@ static int c_can_handle_bus_err(struct net_device *dev,case LEC_STUFF_ERROR :netdev_dbg (dev,"stuff error\n" ); cf->data[2 ] |=CAN_ERR_PROT_STUFF ; + stats->rx_errors++;break ;case LEC_FORM_ERROR :netdev_dbg (dev,"form error\n" ); cf->data[2 ] |=CAN_ERR_PROT_FORM ; + stats->rx_errors++;break ;case LEC_ACK_ERROR :netdev_dbg (dev,"ack error\n" ); cf->data[3 ] =CAN_ERR_PROT_LOC_ACK ; + stats->tx_errors++;break ;case LEC_BIT1_ERROR :netdev_dbg (dev,"bit1 error\n" ); cf->data[2 ] |=CAN_ERR_PROT_BIT1 ; + stats->tx_errors++;break ;case LEC_BIT0_ERROR :netdev_dbg (dev,"bit0 error\n" ); cf->data[2 ] |=CAN_ERR_PROT_BIT0 ; + stats->tx_errors++;break ;case LEC_CRC_ERROR :netdev_dbg (dev,"CRC error\n" ); cf->data[3 ] =CAN_ERR_PROT_LOC_CRC_SEQ ; + stats->rx_errors++;break ;default :break ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 16/82 net: hns3: fix kernel crash when uninstalling driver
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peiyang Wang <[email protected]>
[ Upstream commit df3dff8ab6d79edc942464999d06fbaedf8cdd18 ]
When the driver is uninstalled and the VF is disabled concurrently, a kernel crash occurs. The reason is that the two actions call function pci_disable_sriov(). The num_VFs is checked to determine whether to release the corresponding resources. During the second calling, num_VFs is not 0 and the resource release function is called. However, the corresponding resource has been released during the first invoking. Therefore, the problem occurs:
[15277.839633][T50670] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020 ... [15278.131557][T50670] Call trace: [15278.134686][T50670] klist_put+0x28/0x12c [15278.138682][T50670] klist_del+0x14/0x20 [15278.142592][T50670] device_del+0xbc/0x3c0 [15278.146676][T50670] pci_remove_bus_device+0x84/0x120 [15278.151714][T50670] pci_stop_and_remove_bus_device+0x6c/0x80 [15278.157447][T50670] pci_iov_remove_virtfn+0xb4/0x12c [15278.162485][T50670] sriov_disable+0x50/0x11c [15278.166829][T50670] pci_disable_sriov+0x24/0x30 [15278.171433][T50670] hnae3_unregister_ae_algo_prepare+0x60/0x90 [hnae3] [15278.178039][T50670] hclge_exit+0x28/0xd0 [hclge] [15278.182730][T50670] __se_sys_delete_module.isra.0+0x164/0x230 [15278.188550][T50670] __arm64_sys_delete_module+0x1c/0x30 [15278.193848][T50670] invoke_syscall+0x50/0x11c [15278.198278][T50670] el0_svc_common.constprop.0+0x158/0x164 [15278.203837][T50670] do_el0_svc+0x34/0xcc [15278.207834][T50670] el0_svc+0x20/0x30
For details, see the following figure.
rmmod hclge disable VFs
----------------------------------------------------hclge_exit() sriov_numvfs_store()
... device_lock()
pci_disable_sriov() hns3_pci_sriov_configure()
pci_disable_sriov()
sriov_disable()
sriov_disable() if !num_VFs :
if !num_VFs : return;
return; sriov_del_vfs()
sriov_del_vfs() ...
... klist_put()
klist_put() ...
... num_VFs = 0;
num_VFs = 0; device_unlock();In this patch, when driver is removing, we get the device_lock() to protect num_VFs, just like sriov_numvfs_store().
--- drivers/net/ethernet/hisilicon/hns3/hnae3.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hnae3.c +4 -1
@@ -25,8 +25,11 @@ void hnae3_unregister_ae_algo_prepare(struct hnae3_ae_algo *ae_algo) pci_id =pci_match_id (ae_algo->pdev_id_table, ae_dev->pdev);if (!pci_id)continue ; -if (IS_ENABLED (CONFIG_PCI_IOV )) +if (IS_ENABLED (CONFIG_PCI_IOV )) { +device_lock (&ae_dev->pdev->dev);pci_disable_sriov (ae_dev->pdev); +device_unlock (&ae_dev->pdev->dev); + } } }EXPORT_SYMBOL (hnae3_unregister_ae_algo_prepare);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 17/82 net: phy: export phy_error and phy_trigger_machine
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ioana Ciornei <[email protected]>
[ Upstream commit 293e9a3d950dfebc76d9fa6931e6f91ef856b9ab ]
These functions are currently used by phy_interrupt() to either signal an error condition or to trigger the link state machine. In an attempt to actually support shared PHY IRQs, export these two functions so that the actual PHY drivers can use them.
Stable-dep-of: 256748d5480b ("net: phy: ti: add PHY_RST_AFTER_CLK_EN flag")
--- drivers/net/phy/phy.c | 6 ++++-- include/linux/phy.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/phy/phy.c +4 -2
@@ -461,10 +461,11 @@ EXPORT_SYMBOL(phy_queue_state_machine);* * @phydev: the phy_device struct */ -static void phy_trigger_machine (struct phy_device *phydev) +void phy_trigger_machine (struct phy_device *phydev) {phy_queue_state_machine (phydev,0 ); } +EXPORT_SYMBOL (phy_trigger_machine);static void phy_abort_cable_test (struct phy_device *phydev) {
@@ -970,7 +971,7 @@ void phy_stop_machine(struct phy_device *phydev)* Must not be called from interrupt context, or while the * phydev->lock is held. */ -static void phy_error (struct phy_device *phydev) +void phy_error (struct phy_device *phydev) {WARN_ON (1 );
@@ -980,6 +981,7 @@ static void phy_error(struct phy_device *phydev)phy_trigger_machine (phydev); } +EXPORT_SYMBOL (phy_error);/** * phy_disable_interrupts - Disable the PHY interrupts from the PHY side
include/linux/phy.h +2 -0
@@ -1542,8 +1542,10 @@ void phy_drivers_unregister(struct phy_driver *drv, int n);int phy_driver_register (struct phy_driver *new_driver,struct module *owner);int phy_drivers_register (struct phy_driver *new_driver,int n,struct module *owner); +void phy_error (struct phy_device *phydev);void phy_state_machine (struct work_struct *work);void phy_queue_state_machine (struct phy_device *phydev,unsigned long jiffies); +void phy_trigger_machine (struct phy_device *phydev);void phy_mac_interrupt (struct phy_device *phydev);void phy_start_machine (struct phy_device *phydev);void phy_stop_machine (struct phy_device *phydev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 18/82 net: phy: ti: implement generic .handle_interrupt() callback
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ioana Ciornei <[email protected]>
[ Upstream commit 1d1ae3c6ca3ff49843d73852bb2a8153ce16f432 ]
In an attempt to actually support shared IRQs in phylib, we now move the responsibility of triggering the phylib state machine or just returning IRQ_NONE, based on the IRQ status register, to the PHY driver. Having 3 different IRQ handling callbacks (.handle_interrupt(), .did_interrupt() and .ack_interrupt() ) is confusing so let the PHY driver implement directly an IRQ handler like any other device driver. Make this driver follow the new convention.
Stable-dep-of: 256748d5480b ("net: phy: ti: add PHY_RST_AFTER_CLK_EN flag")
--- drivers/net/phy/dp83640.c | 27 +++++++++++++++++++++++ drivers/net/phy/dp83822.c | 37 +++++++++++++++++++++++++++++++ drivers/net/phy/dp83848.c | 33 ++++++++++++++++++++++++++++ drivers/net/phy/dp83867.c | 25 +++++++++++++++++++++ drivers/net/phy/dp83869.c | 25 +++++++++++++++++++++ drivers/net/phy/dp83tc811.c | 44 +++++++++++++++++++++++++++++++++++++ 6 files changed, 191 insertions(+)
drivers/net/phy/dp83640.c +27 -0
@@ -50,6 +50,14 @@#define MII_DP83640_MISR_LINK_INT_EN 0x20#define MII_DP83640_MISR_ED_INT_EN 0x40#define MII_DP83640_MISR_LQ_INT_EN 0x80 +#define MII_DP83640_MISR_ANC_INT 0x400 +#define MII_DP83640_MISR_DUP_INT 0x800 +#define MII_DP83640_MISR_SPD_INT 0x1000 +#define MII_DP83640_MISR_LINK_INT 0x2000 +#define MII_DP83640_MISR_INT_MASK (MII_DP83640_MISR_ANC_INT |\ + MII_DP83640_MISR_DUP_INT |\ + MII_DP83640_MISR_SPD_INT |\ + MII_DP83640_MISR_LINK_INT)/* phyter seems to miss the mark by 16 ns */ #define ADJTIME_FIX 16
@@ -1193,6 +1201,24 @@ static int dp83640_config_intr(struct phy_device *phydev) } } +static irqreturn_t dp83640_handle_interrupt (struct phy_device *phydev) +{ +int irq_status; + + irq_status =phy_read (phydev,MII_DP83640_MISR ); +if (irq_status <0 ) { +phy_error (phydev); +return IRQ_NONE ; + } + +if (!(irq_status &MII_DP83640_MISR_INT_MASK )) +return IRQ_NONE ; + +phy_trigger_machine (phydev); + +return IRQ_HANDLED ; +} +static int dp83640_hwtstamp (struct mii_timestamper *mii_ts,struct ifreq *ifr) { struct dp83640_private *dp83640 =
@@ -1517,6 +1543,7 @@ static struct phy_driver dp83640_driver = { .config_init = dp83640_config_init, .ack_interrupt = dp83640_ack_interrupt, .config_intr = dp83640_config_intr, + .handle_interrupt = dp83640_handle_interrupt, };static int __init dp83640_init (void )
drivers/net/phy/dp83822.c +37 -0
@@ -303,6 +303,41 @@ static int dp83822_config_intr(struct phy_device *phydev)return phy_write (phydev,MII_DP83822_PHYSCR , physcr_status); } +static irqreturn_t dp83822_handle_interrupt (struct phy_device *phydev) +{ +int irq_status; + +/* The MISR1 and MISR2 registers are holding the interrupt status in +* the upper half (15:8), while the lower half (7:0) is used for +* controlling the interrupt enable state of those individual interrupt +* sources. To determine the possible interrupt sources, just read the +* MISR* register and use it directly to know which interrupts have +* been enabled previously or not. +*/ + irq_status =phy_read (phydev,MII_DP83822_MISR1 ); +if (irq_status <0 ) { +phy_error (phydev); +return IRQ_NONE ; + } +if (irq_status & ((irq_status &GENMASK (7 ,0 )) <<8 )) + goto trigger_machine; + + irq_status =phy_read (phydev,MII_DP83822_MISR2 ); +if (irq_status <0 ) { +phy_error (phydev); +return IRQ_NONE ; + } +if (irq_status & ((irq_status &GENMASK (7 ,0 )) <<8 )) + goto trigger_machine; + +return IRQ_NONE ; + +trigger_machine: +phy_trigger_machine (phydev); + +return IRQ_HANDLED ; +} +static int dp8382x_disable_wol (struct phy_device *phydev) { return phy_clear_bits_mmd(phydev, DP83822_DEVADDR, MII_DP83822_WOL_CFG,
@@ -586,6 +621,7 @@ static int dp83822_resume(struct phy_device *phydev) .set_wol = dp83822_set_wol, \ .ack_interrupt = dp83822_ack_interrupt, \ .config_intr = dp83822_config_intr, \ + .handle_interrupt = dp83822_handle_interrupt, \ .suspend = dp83822_suspend, \ .resume = dp83822_resume, \ }
@@ -601,6 +637,7 @@ static int dp83822_resume(struct phy_device *phydev) .set_wol = dp83822_set_wol, \ .ack_interrupt = dp83822_ack_interrupt, \ .config_intr = dp83822_config_intr, \ + .handle_interrupt = dp83822_handle_interrupt, \ .suspend = dp83822_suspend, \ .resume = dp83822_resume, \ }
drivers/net/phy/dp83848.c +33 -0
@@ -37,6 +37,20 @@ DP83848_MISR_SPD_INT_EN | \ DP83848_MISR_LINK_INT_EN) +#define DP83848_MISR_RHF_INT BIT(8) +#define DP83848_MISR_FHF_INT BIT(9) +#define DP83848_MISR_ANC_INT BIT(10) +#define DP83848_MISR_DUP_INT BIT(11) +#define DP83848_MISR_SPD_INT BIT(12) +#define DP83848_MISR_LINK_INT BIT(13) +#define DP83848_MISR_ED_INT BIT(14) + +#define DP83848_INT_MASK \ + (DP83848_MISR_ANC_INT | \ + DP83848_MISR_DUP_INT | \ + DP83848_MISR_SPD_INT | \ + DP83848_MISR_LINK_INT) +static int dp83848_ack_interrupt (struct phy_device *phydev) {int err =phy_read (phydev,DP83848_MISR );
@@ -66,6 +80,24 @@ static int dp83848_config_intr(struct phy_device *phydev)return phy_write (phydev,DP83848_MICR , control); } +static irqreturn_t dp83848_handle_interrupt (struct phy_device *phydev) +{ +int irq_status; + + irq_status =phy_read (phydev,DP83848_MISR ); +if (irq_status <0 ) { +phy_error (phydev); +return IRQ_NONE ; + } + +if (!(irq_status &DP83848_INT_MASK )) +return IRQ_NONE ; + +phy_trigger_machine (phydev); + +return IRQ_HANDLED ; +} +static int dp83848_config_init (struct phy_device *phydev) {int val;
@@ -104,6 +136,7 @@ MODULE_DEVICE_TABLE(mdio, dp83848_tbl);/* IRQ related */ \ .ack_interrupt = dp83848_ack_interrupt, \ .config_intr = dp83848_config_intr, \ + .handle_interrupt = dp83848_handle_interrupt, \ }static struct phy_driver dp83848_driver[] = {
drivers/net/phy/dp83867.c +25 -0
@@ -312,6 +312,30 @@ static int dp83867_config_intr(struct phy_device *phydev)return phy_write (phydev,MII_DP83867_MICR , micr_status); } +static irqreturn_t dp83867_handle_interrupt (struct phy_device *phydev) +{ +int irq_status, irq_enabled; + + irq_status =phy_read (phydev,MII_DP83867_ISR ); +if (irq_status <0 ) { +phy_error (phydev); +return IRQ_NONE ; + } + + irq_enabled =phy_read (phydev,MII_DP83867_MICR ); +if (irq_enabled <0 ) { +phy_error (phydev); +return IRQ_NONE ; + } + +if (!(irq_status & irq_enabled)) +return IRQ_NONE ; + +phy_trigger_machine (phydev); + +return IRQ_HANDLED ; +} +static int dp83867_read_status (struct phy_device *phydev) {int status =phy_read (phydev,MII_DP83867_PHYSTS );
@@ -878,6 +902,7 @@ static struct phy_driver dp83867_driver[] = {/* IRQ related */ .ack_interrupt = dp83867_ack_interrupt, .config_intr = dp83867_config_intr, + .handle_interrupt = dp83867_handle_interrupt, .suspend = genphy_suspend, .resume = genphy_resume,
drivers/net/phy/dp83869.c +25 -0
@@ -207,6 +207,30 @@ static int dp83869_config_intr(struct phy_device *phydev)return phy_write (phydev,MII_DP83869_MICR , micr_status); } +static irqreturn_t dp83869_handle_interrupt (struct phy_device *phydev) +{ +int irq_status, irq_enabled; + + irq_status =phy_read (phydev,MII_DP83869_ISR ); +if (irq_status <0 ) { +phy_error (phydev); +return IRQ_NONE ; + } + + irq_enabled =phy_read (phydev,MII_DP83869_MICR ); +if (irq_enabled <0 ) { +phy_error (phydev); +return IRQ_NONE ; + } + +if (!(irq_status & irq_enabled)) +return IRQ_NONE ; + +phy_trigger_machine (phydev); + +return IRQ_HANDLED ; +} +static int dp83869_set_wol (struct phy_device *phydev,struct ethtool_wolinfo *wol) {
@@ -853,6 +877,7 @@ static struct phy_driver dp83869_driver[] = {/* IRQ related */ .ack_interrupt = dp83869_ack_interrupt, .config_intr = dp83869_config_intr, + .handle_interrupt = dp83869_handle_interrupt, .read_status = dp83869_read_status, .get_tunable = dp83869_get_tunable,
drivers/net/phy/dp83tc811.c +44 -0
56 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 19/82 net: phy: ti: add PHY_RST_AFTER_CLK_EN flag
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diogo Silva <[email protected]>
[ Upstream commit 256748d5480bb3c4b731236c6d6fc86a8e2815d8 ]
DP83848 datasheet (section 4.7.2) indicates that the reset pin should be
toggled after the clocks are running. Add the PHY_RST_AFTER_CLK_EN to make sure that this indication is respected.
In my experience not having this flag enabled would lead to, on some boots, the wrong MII mode being selected if the PHY was initialized on the bootloader and was receiving data during Linux boot.
--- drivers/net/phy/dp83848.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/phy/dp83848.c +2 -0
@@ -137,6 +137,8 @@ MODULE_DEVICE_TABLE(mdio, dp83848_tbl); .ack_interrupt = dp83848_ack_interrupt, \ .config_intr = dp83848_config_intr, \ .handle_interrupt = dp83848_handle_interrupt, \ + \ + .flags = PHY_RST_AFTER_CLK_EN, \ }static struct phy_driver dp83848_driver[] = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 20/82 net: arc: fix the device for dma_map_single/dma_unmap_single
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Jonker <[email protected]>
[ Upstream commit 71803c1dfa29e0d13b99e48fda11107cc8caebc7 ]
The ndev->dev and pdev->dev aren't the same device, use ndev->dev.parent which has dma_mask, ndev->dev.parent is just pdev->dev.
Or it would cause the following issue:
[ 39.933526] ------------[ cut here ]------------ [ 39.938414] WARNING: CPU: 1 PID: 501 at kernel/dma/mapping.c:149 dma_map_page_attrs+0x90/0x1f8
--- drivers/net/ethernet/arc/emac_main.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
drivers/net/ethernet/arc/emac_main.c +16 -11
@@ -111,6 +111,7 @@ static void arc_emac_tx_clean(struct net_device *ndev) {struct arc_emac_priv *priv =netdev_priv (ndev);struct net_device_stats *stats = &ndev->stats; +struct device *dev = ndev->dev.parent;unsigned int i;for (i =0 ; i <TX_BD_NUM ; i++) {
@@ -140,7 +141,7 @@ static void arc_emac_tx_clean(struct net_device *ndev) stats->tx_bytes += skb->len; } -dma_unmap_single (&ndev->dev,dma_unmap_addr (tx_buff, addr), +dma_unmap_single (dev,dma_unmap_addr (tx_buff, addr),dma_unmap_len (tx_buff, len),DMA_TO_DEVICE );/* return the sk_buff to system */
@@ -174,6 +175,7 @@ static void arc_emac_tx_clean(struct net_device *ndev)static int arc_emac_rx (struct net_device *ndev,int budget) {struct arc_emac_priv *priv =netdev_priv (ndev); +struct device *dev = ndev->dev.parent;unsigned int work_done;for (work_done =0 ; work_done < budget; work_done++) {
@@ -223,9 +225,9 @@ static int arc_emac_rx(struct net_device *ndev, int budget)continue ; } - addr =dma_map_single (&ndev->dev, (void *)skb->data, + addr =dma_map_single (dev, (void *)skb->data,EMAC_BUFFER_SIZE ,DMA_FROM_DEVICE ); -if (dma_mapping_error (&ndev->dev, addr)) { +if (dma_mapping_error (dev, addr)) {if (net_ratelimit ())netdev_err (ndev,"cannot map dma buffer\n" );dev_kfree_skb (skb);
@@ -237,7 +239,7 @@ static int arc_emac_rx(struct net_device *ndev, int budget) }/* unmap previosly mapped skb */ -dma_unmap_single (&ndev->dev,dma_unmap_addr (rx_buff, addr), +dma_unmap_single (dev,dma_unmap_addr (rx_buff, addr),dma_unmap_len (rx_buff, len),DMA_FROM_DEVICE ); pktlen = info &LEN_MASK ;
@@ -423,6 +425,7 @@ static int arc_emac_open(struct net_device *ndev) {struct arc_emac_priv *priv =netdev_priv (ndev);struct phy_device *phy_dev = ndev->phydev; +struct device *dev = ndev->dev.parent;int i; phy_dev->autoneg =AUTONEG_ENABLE ;
@@ -445,9 +448,9 @@ static int arc_emac_open(struct net_device *ndev)if (unlikely (!rx_buff->skb))return -ENOMEM ; - addr =dma_map_single (&ndev->dev, (void *)rx_buff->skb->data, + addr =dma_map_single (dev, (void *)rx_buff->skb->data,EMAC_BUFFER_SIZE ,DMA_FROM_DEVICE ); -if (dma_mapping_error (&ndev->dev, addr)) { +if (dma_mapping_error (dev, addr)) {netdev_err (ndev,"cannot dma map\n" );dev_kfree_skb (rx_buff->skb);return -ENOMEM ;
@@ -548,6 +551,7 @@ static void arc_emac_set_rx_mode(struct net_device *ndev)static void arc_free_tx_queue (struct net_device *ndev) {struct arc_emac_priv *priv =netdev_priv (ndev); +struct device *dev = ndev->dev.parent;unsigned int i;for (i =0 ; i <TX_BD_NUM ; i++) {
@@ -555,7 +559,7 @@ static void arc_free_tx_queue(struct net_device *ndev)struct buffer_state *tx_buff = &priv->tx_buff[i];if (tx_buff->skb) { -dma_unmap_single (&ndev->dev, +dma_unmap_single (dev,dma_unmap_addr (tx_buff, addr),dma_unmap_len (tx_buff, len),DMA_TO_DEVICE );
@@ -579,6 +583,7 @@ static void arc_free_tx_queue(struct net_device *ndev)static void arc_free_rx_queue (struct net_device *ndev) {struct arc_emac_priv *priv =netdev_priv (ndev); +struct device *dev = ndev->dev.parent;unsigned int i;for (i =0 ; i <RX_BD_NUM ; i++) {
@@ -586,7 +591,7 @@ static void arc_free_rx_queue(struct net_device *ndev)struct buffer_state *rx_buff = &priv->rx_buff[i];if (rx_buff->skb) { -dma_unmap_single (&ndev->dev, +dma_unmap_single (dev,dma_unmap_addr (rx_buff, addr),dma_unmap_len (rx_buff, len),DMA_FROM_DEVICE );
@@ -679,6 +684,7 @@ static netdev_tx_t arc_emac_tx(struct sk_buff *skb, struct net_device *ndev)unsigned int len, *txbd_curr = &priv->txbd_curr;struct net_device_stats *stats = &ndev->stats;__le32 *info = &priv->txbd[*txbd_curr].info; +struct device *dev = ndev->dev.parent;dma_addr_t addr;if (skb_padto (skb,ETH_ZLEN ))
@@ -692,10 +698,9 @@ static netdev_tx_t arc_emac_tx(struct sk_buff *skb, struct net_device *ndev)return NETDEV_TX_BUSY ; } - addr =dma_map_single (&ndev->dev, (void *)skb->data, len, -DMA_TO_DEVICE ); + addr =dma_map_single (dev, (void *)skb->data, len,DMA_TO_DEVICE ); -if (unlikely (dma_mapping_error (&ndev->dev, addr))) { +if (unlikely (dma_mapping_error (dev, addr))) { stats->tx_dropped++; stats->tx_errors++;dev_kfree_skb_any (skb);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 21/82 Revert "ALSA: hda/conexant: Mute speakers at suspend / shutdown"
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarosław Janik <[email protected]>
commit c9363bbb0f68dd1ddb8be7bbfe958cdfcd38d851 upstream.
Commit 4f61c8fe3520 ("ALSA: hda/conexant: Mute speakers at suspend / shutdown") mutes speakers on system shutdown or whenever HDA controller is suspended by PM; this however interacts badly with Thinkpad's ACPI firmware behavior which uses beeps to signal various events (enter/leave suspend or hibernation, AC power connect/disconnect, low battery, etc.); now those beeps are either muted altogether (for suspend/hibernate/ shutdown related events) or work more or less randomly (eg. AC plug/unplug is only audible when you are playing music at the moment, because HDA device is likely in suspend mode otherwise).
Since the original bug report mentioned in 4f61c8fe3520 complained about Lenovo's Thinkpad laptop - revert this commit altogether.
--- sound/pci/hda/patch_conexant.c | 2 -- 1 file changed, 2 deletions(-)
sound/pci/hda/patch_conexant.c +0 -2
@@ -181,8 +181,6 @@ static void cx_auto_reboot_notify(struct {struct conexant_spec *spec = codec->spec; -snd_hda_gen_shutup_speakers (codec); -/* Turn the problematic codec into D3 to avoid spurious noises from the internal speaker during (and after) reboot */ cx_auto_turn_eapd (codec, spec->num_eapds, spec->eapds, false);
Greg Kroah-Hartman
maintainerPATCH 22/82 media: stb0899_algo: initialize cfr before using it
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 2d861977e7314f00bf27d0db17c11ff5e85e609a upstream.
The loop at stb0899_search_carrier() starts with a random value for cfr, as reported by Coverity.
Initialize it to zero, just like stb0899_dvbs_algo() to ensure that carrier search won't bail out.
--- drivers/media/dvb-frontends/stb0899_algo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-frontends/stb0899_algo.c +1 -1
@@ -269,7 +269,7 @@ static enum stb0899_status stb0899_searcshort int derot_freq =0 , last_derot_freq =0 , derot_limit, next_loop =3 ;int index =0 ; -u8 cfr[2 ]; +u8 cfr[2 ] = {0 };u8 reg; internal->status =NOCARRIER ;
Greg Kroah-Hartman
maintainerPATCH 23/82 media: dvbdev: prevent the risk of out of memory access
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 972e63e895abbe8aa1ccbdbb4e6362abda7cd457 ]
The dvbdev contains a static variable used to store dvb minors.
The behavior of it depends if CONFIG_DVB_DYNAMIC_MINORS is set or not. When not set, dvb_register_device() won't check for boundaries, as it will rely that a previous call to dvb_register_adapter() would already be enforcing it.
On a similar way, dvb_device_open() uses the assumption that the register functions already did the needed checks.
This can be fragile if some device ends using different calls. This also generate warnings on static check analysers like Coverity.
So, add explicit guards to prevent potential risk of OOM issues.
--- drivers/media/dvb-core/dvbdev.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/media/dvb-core/dvbdev.c +15 -2
@@ -96,10 +96,15 @@ static DECLARE_RWSEM(minor_rwsem);static int dvb_device_open (struct inode *inode,struct file *file) {struct dvb_device *dvbdev; +unsigned int minor =iminor (inode); + +if (minor >=MAX_DVB_MINORS ) +return -ENODEV ;mutex_lock (&dvbdev_mutex);down_read (&minor_rwsem); - dvbdev = dvb_minors[iminor (inode)]; + + dvbdev = dvb_minors[minor];if (dvbdev && dvbdev->fops) {int err =0 ;
@@ -539,7 +544,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,for (minor =0 ; minor <MAX_DVB_MINORS ; minor++)if (dvb_minors[minor] ==NULL )break ; -if (minor ==MAX_DVB_MINORS ) { +if (minor >=MAX_DVB_MINORS ) {if (new_node) {list_del (&new_node->list_head);kfree (dvbdevfops);
@@ -554,6 +559,14 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, }#else minor =nums2minor (adap->num, type, id); +if (minor >=MAX_DVB_MINORS ) { +dvb_media_device_free (dvbdev); +list_del (&dvbdev->list_head); +kfree (dvbdev); + *pdvbdev =NULL ; +mutex_unlock (&dvbdev_register_lock); +return ret; + }#endif dvbdev->minor = minor; dvb_minors[minor] =dvb_device_get (dvbdev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 24/82 media: dvb_frontend: dont play tricks with underflow values
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 9883a4d41aba7612644e9bb807b971247cea9b9d ]
fepriv->auto_sub_step is unsigned. Setting it to -1 is just a trick to avoid calling continue, as reported by Coverity.
It relies to have this code just afterwards:
if (!ready) fepriv->auto_sub_step++;
Simplify the code by simply setting it to zero and use continue to return to the while loop.
--- drivers/media/dvb-core/dvb_frontend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/dvb-core/dvb_frontend.c +2 -2
@@ -442,8 +442,8 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wradefault : fepriv->auto_step++; - fepriv->auto_sub_step =-1 ;/* it'll be incremented to 0 in a moment */ -break ; + fepriv->auto_sub_step =0 ; +continue ; }if (!ready) fepriv->auto_sub_step++;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 25/82 media: adv7604: prevent underflow condition when reporting colorspace
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 50b9fa751d1aef5d262bde871c70a7f44262f0bc ]
Currently, adv76xx_log_status() reads some date using io_read() which may return negative values. The current logic doesn't check such errors, causing colorspace to be reported on a wrong way at adv76xx_log_status(), as reported by Coverity.
If I/O error happens there, print a different message, instead of reporting bogus messages to userspace.
--- drivers/media/i2c/adv7604.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
drivers/media/i2c/adv7604.c +17 -9
@@ -2487,10 +2487,10 @@ static int adv76xx_log_status(struct v4l2_subdev *sd)const struct adv76xx_chip_info *info = state->info;struct v4l2_dv_timings timings;struct stdi_readback stdi; -u8 reg_io_0x02 =io_read (sd,0x02 ); +int ret; +u8 reg_io_0x02;u8 edid_enabled;u8 cable_det; -static const char *const csc_coeff_sel_rb[16 ] = {"bypassed" ,"YPbPr601 -> RGB" ,"reserved" ,"YPbPr709 -> RGB" ,"reserved" ,"RGB -> YPbPr601" ,"reserved" ,"RGB -> YPbPr709" ,
@@ -2589,13 +2589,21 @@ static int adv76xx_log_status(struct v4l2_subdev *sd)v4l2_info (sd,"-----Color space-----\n" );v4l2_info (sd,"RGB quantization range ctrl: %s\n" , rgb_quantization_range_txt[state->rgb_quantization_range]); -v4l2_info (sd,"Input color space: %s\n" , - input_color_space_txt[reg_io_0x02 >>4 ]); -v4l2_info (sd,"Output color space: %s %s, alt-gamma %s\n" , - (reg_io_0x02 &0x02 ) ?"RGB" :"YCbCr" , - (((reg_io_0x02 >>2 ) &0x01 ) ^ (reg_io_0x02 &0x01 )) ? -"(16-235)" :"(0-255)" , - (reg_io_0x02 &0x08 ) ?"enabled" :"disabled" ); + + ret =io_read (sd,0x02 ); +if (ret <0 ) { +v4l2_info (sd,"Can't read Input/Output color space\n" ); + }else { + reg_io_0x02 = ret; + +v4l2_info (sd,"Input color space: %s\n" , + input_color_space_txt[reg_io_0x02 >>4 ]); +v4l2_info (sd,"Output color space: %s %s, alt-gamma %s\n" , + (reg_io_0x02 &0x02 ) ?"RGB" :"YCbCr" , + (((reg_io_0x02 >>2 ) &0x01 ) ^ (reg_io_0x02 &0x01 )) ? +"(16-235)" :"(0-255)" , + (reg_io_0x02 &0x08 ) ?"enabled" :"disabled" ); + }v4l2_info (sd,"Color space conversion: %s\n" , csc_coeff_sel_rb[cp_read (sd, info->cp_csc) >>4 ]);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 26/82 scsi: sd_zbc: Use kvzalloc() to allocate REPORT ZONES buffer
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Thumshirn <[email protected]>
[ Upstream commit 7ce3e6107103214d354a16729a472f588be60572 ]
We have two reports of failed memory allocation in btrfs' code which is calling into report zones.
Both of these reports have the following signature coming from __vmalloc_area_node():
kworker/u17:5: vmalloc error: size 0, failed to allocate pages, mode:0x10dc2(GFP_KERNEL|__GFP_HIGHMEM|__GFP_NORETRY|__GFP_ZERO), nodemask=(null),cpuset=/,mems_allowed=0
Further debugging showed these where allocations of one sector (512 bytes) and at least one of the reporter's systems where low on memory, so going through the overhead of allocating a vm area failed.
Switching the allocation from __vmalloc() to kvzalloc() avoids the overhead of vmalloc() on small allocations and succeeds.
Note: the buffer is already freed using kvfree() so there's no need to adjust the free path.
--- drivers/scsi/sd_zbc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/sd_zbc.c +1 -2
@@ -169,8 +169,7 @@ static void *sd_zbc_alloc_report_buffer(struct scsi_disk *sdkp, bufsize =min_t (size_t, bufsize,queue_max_segments (q) <<PAGE_SHIFT );while (bufsize >=SECTOR_SIZE ) { - buf =__vmalloc (bufsize, -GFP_KERNEL | __GFP_ZERO | __GFP_NORETRY); + buf =kvzalloc (bufsize,GFP_KERNEL | __GFP_NORETRY);if (buf) { *buflen = bufsize;return buf;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 27/82 ALSA: firewire-lib: fix return value on fail in amdtp_tscm_init()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Murad Masimov <[email protected]>
[ Upstream commit 8abbf1f01d6a2ef9f911f793e30f7382154b5a3a ]
If amdtp_stream_init() fails in amdtp_tscm_init(), the latter returns zero, though it's supposed to return error code, which is checked inside init_stream() in file tascam-stream.c.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- sound/firewire/tascam/amdtp-tascam.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/firewire/tascam/amdtp-tascam.c +1 -1
@@ -244,7 +244,7 @@ int amdtp_tscm_init(struct amdtp_stream *s, struct fw_unit *unit,CIP_NONBLOCKING |CIP_SKIP_DBC_ZERO_CHECK , fmt, process_ctx_payloads, sizeof(struct amdtp_tscm));if (err <0 ) -return 0 ; +return err;if (dir ==AMDTP_OUT_STREAM ) {// Use fixed value for FDF field.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 28/82 ASoC: stm32: spdifrx: fix dma channel release in stm32_spdifrx_remove
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amelie Delaunay <[email protected]>
[ Upstream commit 9bb4af400c386374ab1047df44c508512c08c31f ]
In case of error when requesting ctrl_chan DMA channel, ctrl_chan is not null. So the release of the dma channel leads to the following issue:
[ 4.879000] st,stm32-spdifrx 500d0000.audio-controller: dma_request_slave_channel error -19 [ 4.888975] Unable to handle kernel NULL pointer dereference at virtual address 000000000000003d [...] [ 5.096577] Call trace: [ 5.099099] dma_release_channel+0x24/0x100 [ 5.103235] stm32_spdifrx_remove+0x24/0x60 [snd_soc_stm32_spdifrx] [ 5.109494] stm32_spdifrx_probe+0x320/0x4c4 [snd_soc_stm32_spdifrx]
To avoid this issue, release channel only if the pointer is valid.
--- sound/soc/stm/stm32_spdifrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/stm/stm32_spdifrx.c +1 -1
@@ -948,7 +948,7 @@ static int stm32_spdifrx_remove(struct platform_device *pdev) {struct stm32_spdifrx_data *spdifrx =platform_get_drvdata (pdev); -if (spdifrx->ctrl_chan) +if (!IS_ERR (spdifrx->ctrl_chan))dma_release_channel (spdifrx->ctrl_chan);if (spdifrx->dmab)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 29/82 media: s5p-jpeg: prevent buffer overflows
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 14a22762c3daeac59a5a534e124acbb4d7a79b3a upstream.
The current logic allows word to be less than 2. If this happens, there will be buffer overflows, as reported by smatch. Add extra checks to prevent it.
While here, remove an unused word = 0 assignment.
--- drivers/media/platform/s5p-jpeg/jpeg-core.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/media/platform/s5p-jpeg/jpeg-core.c +11 -6
@@ -775,11 +775,14 @@ static void exynos4_jpeg_parse_decode_h_ (unsigned long )vb2_plane_vaddr (&vb->vb2_buf,0 ) + ctx->out_q.sos +2 ; jpeg_buffer.curr =0 ; - word =0 ; -if (get_word_be (&jpeg_buffer, &word))return ; - jpeg_buffer.size = (long )word -2 ; + +if (word <2 ) + jpeg_buffer.size =0 ; +else + jpeg_buffer.size = (long )word -2 ; + jpeg_buffer.data +=2 ; jpeg_buffer.curr =0 ;
@@ -1058,6 +1061,7 @@ static int get_word_be(struct s5p_jpeg_bif (byte ==-1 )return -1 ; *word = (unsigned int )byte | temp; +return 0 ; }
@@ -1145,7 +1149,7 @@ static bool s5p_jpeg_parse_hdr(struct s5if (get_word_be (&jpeg_buffer, &word))break ; length = (long )word -2 ; -if (!length) +if (length <=0 )return false; sof = jpeg_buffer.curr;/* after 0xffc0 */ sof_len = length;
@@ -1176,7 +1180,7 @@ static bool s5p_jpeg_parse_hdr(struct s5if (get_word_be (&jpeg_buffer, &word))break ; length = (long )word -2 ; -if (!length) +if (length <=0 )return false;if (n_dqt >=S5P_JPEG_MAX_MARKER )return false;
@@ -1189,7 +1193,7 @@ static bool s5p_jpeg_parse_hdr(struct s5if (get_word_be (&jpeg_buffer, &word))break ; length = (long )word -2 ; -if (!length) +if (length <=0 )return false;if (n_dht >=S5P_JPEG_MAX_MARKER )return false;
@@ -1214,6 +1218,7 @@ static bool s5p_jpeg_parse_hdr(struct s5if (get_word_be (&jpeg_buffer, &word))break ; length = (long )word -2 ; +/* No need to check underflows as skip() does it */ skip (&jpeg_buffer, length);break ; }
Greg Kroah-Hartman
maintainerPATCH 30/82 media: cx24116: prevent overflows on SNR calculus
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 576a307a7650bd544fbb24df801b9b7863b85e2f upstream.
as reported by Coverity, if reading SNR registers fail, a negative number will be returned, causing an underflow when reading SNR registers.
Prevent that.
--- drivers/media/dvb-frontends/cx24116.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/media/dvb-frontends/cx24116.c +6 -1
@@ -741,6 +741,7 @@ static int cx24116_read_snr_pct(struct d {struct cx24116_state *state = fe->demodulator_priv;u8 snr_reading; +int ret;static const u32 snr_tab[] = {/* 10 x Table (rounded up) */ 0x00000 ,0x0199A ,0x03333 ,0x04ccD ,0x06667 ,0x08000 ,0x0999A ,0x0b333 ,0x0cccD ,0x0e667 ,
@@ -749,7 +750,11 @@ static int cx24116_read_snr_pct(struct ddprintk ("%s()\n" , __func__); - snr_reading =cx24116_readreg (state,CX24116_REG_QUALITY0 ); + ret =cx24116_readreg (state,CX24116_REG_QUALITY0 ); +if (ret <0 ) +return ret; + + snr_reading = ret;if (snr_reading >=0xa0 /* 100% */ ) *snr =0xffff ;
Greg Kroah-Hartman
maintainerPATCH 31/82 media: pulse8-cec: fix data timestamp at pulse8_setup()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit ba9cf6b430433e57bfc8072364e944b7c0eca2a4 upstream.
As pointed by Coverity, there is a hidden overflow condition there. As date is signed and u8 is unsigned, doing:
date = (data[0] << 24)
With a value bigger than 07f will make all upper bits of date 0xffffffff. This can be demonstrated with this small code:
<code>
typedef int64_t time64_t;
typedef uint8_t u8;
int main(void)
{
u8 data[] = { 0xde ,0xad , 0xbe, 0xef };
time64_t date;
date = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3];
printf("Invalid data = 0x%08lx\n", date);
date = ((unsigned)data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3];
printf("Expected data = 0x%08lx\n", date);
return 0;
}</code>
Fix it by converting the upper bit calculation to unsigned.
--- drivers/media/cec/usb/pulse8/pulse8-cec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/cec/usb/pulse8/pulse8-cec.c +1 -1
@@ -685,7 +685,7 @@ static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio, err =pulse8_send_and_wait (pulse8, cmd,1 , cmd[0 ],4 );if (err)return err; - date = (data[0 ] <<24 ) | (data[1 ] <<16 ) | (data[2 ] <<8 ) | data[3 ]; + date = ((unsigned )data[0 ] <<24 ) | (data[1 ] <<16 ) | (data[2 ] <<8 ) | data[3 ];dev_info (pulse8->dev,"Firmware build date %ptT\n" , &date);dev_dbg (pulse8->dev,"Persistent config:\n" );
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 32/82 media: v4l2-tpg: prevent the risk of a division by zero
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit e6a3ea83fbe15d4818d01804e904cbb0e64e543b upstream.
As reported by Coverity, the logic at tpg_precalculate_line() blindly rescales the buffer even when scaled_witdh is equal to zero. If this ever happens, this will cause a division by zero.
Instead, add a WARN_ON_ONCE() to trigger such cases and return without doing any precalculation.
--- drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/common/v4l2-tpg/v4l2-tpg-core.c +3 -0
@@ -1789,6 +1789,9 @@ static void tpg_precalculate_line(structunsigned p;unsigned x; +if (WARN_ON_ONCE (!tpg->src_width || !tpg->scaled_width)) +return ; +switch (tpg->pattern) {case TPG_PAT_GREEN : contrast =TPG_COLOR_100_RED ;
Greg Kroah-Hartman
maintainerPATCH 33/82 pwm: imx-tpm: Use correct MODULO value for EPWM mode
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Erik Schumacher <[email protected]>
commit cc6a931d1f3b412263d515fd93b21fc0ca5147fe upstream.
The modulo register defines the period of the edge-aligned PWM mode (which is the only mode implemented). The reference manual states:
"The EPWM period is determined by (MOD + 0001h) ..." So the value that is written to the MOD register must therefore be one less than the calculated period length. Return -EINVAL if the calculated length is already zero.
A correct MODULO value is particularly relevant if the PWM has to output a high frequency due to a low period value.
--- drivers/pwm/pwm-imx-tpm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pwm/pwm-imx-tpm.c +3 -1
@@ -106,7 +106,9 @@ static int pwm_imx_tpm_round_state(struc p->prescale = prescale; period_count = (clock_unit + ((1 << prescale) >>1 )) >> prescale; - p->mod = period_count; +if (period_count ==0 ) +return -EINVAL ; + p->mod = period_count -1 ;/* calculate real period HW can support */ tmp = (u64 )period_count << prescale;
Greg Kroah-Hartman
maintainerPATCH 34/82 drm/amdgpu: add missing size check in amdgpu_debugfs_gprwave_read()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 4d75b9468021c73108b4439794d69e892b1d24e3 upstream.
Avoid a possible buffer overflow if size is larger than 4K.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +1 -1
@@ -396,7 +396,7 @@ static ssize_t amdgpu_debugfs_regs_pcie_ssize_t result =0 ;int r; -if (size &0x3 || *pos &0x3 ) +if (size >4096 || size &0x3 || *pos &0x3 )return -EINVAL ; r =pm_runtime_get_sync (adev_to_drm (adev)->dev);
Greg Kroah-Hartman
maintainerPATCH 35/82 drm/amdgpu: prevent NULL pointer dereference if ATIF is not supported
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Quartulli <[email protected]>
commit a6dd15981c03f2cdc9a351a278f09b5479d53d2e upstream.
acpi_evaluate_object() may return AE_NOT_FOUND (failure), which would result in dereferencing buffer.pointer (obj) while being NULL.
Although this case may be unrealistic for the current code, it is still better to protect against possible bugs.
Bail out also when status is AE_NOT_FOUND.
This fixes 1 FORWARD_NULL issue reported by Coverity
Report: CID 1600951: Null pointer dereferences (FORWARD_NULL)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -2
@@ -112,8 +112,8 @@ static union acpi_object *amdgpu_atif_ca &buffer); obj = (union acpi_object *)buffer.pointer; -/* Fail if calling the method fails and ATIF is supported */ -if (ACPI_FAILURE (status) && status !=AE_NOT_FOUND ) { +/* Fail if calling the method fails */ +if (ACPI_FAILURE (status)) {DRM_DEBUG_DRIVER ("failed to evaluate ATIF got %s\n" ,acpi_format_exception (status));kfree (obj);
Greg Kroah-Hartman
maintainerPATCH 36/82 dm cache: correct the number of origin blocks to match the target length
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming-Hung Tsai <[email protected]>
commit 235d2e739fcbe964c9ce179b4c991025662dcdb6 upstream.
When creating a cache device, the actual size of the cache origin might be greater than the specified cache target length. In such case, the number of origin blocks should match the cache target length, not the full size of the origin device, since access beyond the cache target is not possible. This issue occurs when reducing the origin device size using lvm, as lvreduce preloads the new cache table before resuming the cache origin, which can result in incorrect sizes for the discard bitset and smq hotspot blocks.
Reproduce steps:
1. create a cache device consists of 4096 origin blocks
dmsetup create cmeta --table "0 8192 linear /dev/sdc 0" dmsetup create cdata --table "0 65536 linear /dev/sdc 8192" dmsetup create corig --table "0 524288 linear /dev/sdc 262144" dd if=/dev/zero of=/dev/mapper/cmeta bs=4k count=1 oflag=direct dmsetup create cache --table "0 524288 cache /dev/mapper/cmeta \/dev/mapper/cdata /dev/mapper/corig 128 2 metadata2 writethrough smq 0"
2. reduce the cache origin to 2048 oblocks, in lvreduce's approach
dmsetup reload corig --table "0 262144 linear /dev/sdc 262144" dmsetup reload cache --table "0 262144 cache /dev/mapper/cmeta \/dev/mapper/cdata /dev/mapper/corig 128 2 metadata2 writethrough smq 0" dmsetup suspend cache
dmsetup suspend corig
dmsetup suspend cdata
dmsetup suspend cmeta
dmsetup resume corig
dmsetup resume cdata
dmsetup resume cmeta
dmsetup resume cache
3. shutdown the cache, and check the number of discard blocks in superblock. The value is expected to be 2048, but actually is 4096.
dmsetup remove cache corig cdata cmeta
dd if=/dev/sdc bs=1c count=8 skip=224 2>/dev/null | hexdump -e '1/8 "%u\n"'
Fix by correcting the origin_blocks initialization in cache_create and removing the unused origin_sectors from struct cache_args accordingly.
--- drivers/md/dm-cache-target.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/md/dm-cache-target.c +4 -4
@@ -2058,7 +2058,6 @@ struct cache_args {sector_t cache_sectors;struct dm_dev *origin_dev; -sector_t origin_sectors;uint32_t block_size;
@@ -2140,6 +2139,7 @@ static int parse_cache_dev(struct cache_static int parse_origin_dev (struct cache_args *ca,struct dm_arg_set *as,char **error) { +sector_t origin_sectors;int r;if (!at_least_one_arg (as, error))
@@ -2152,8 +2152,8 @@ static int parse_origin_dev(struct cachereturn r; } - ca->origin_sectors =get_dev_size (ca->origin_dev); -if (ca->ti->len > ca->origin_sectors) { + origin_sectors =get_dev_size (ca->origin_dev); +if (ca->ti->len > origin_sectors) { *error ="Device size larger than cached device" ;return -EINVAL ; }
@@ -2462,7 +2462,7 @@ static int cache_create(struct cache_arg ca->metadata_dev = ca->origin_dev = ca->cache_dev =NULL ; - origin_blocks = cache->origin_sectors = ca->origin_sectors; + origin_blocks = cache->origin_sectors = ti->len; origin_blocks =block_div (origin_blocks, ca->block_size); cache->origin_blocks =to_oblock (origin_blocks);
Greg Kroah-Hartman
maintainerPATCH 37/82 dm cache: fix out-of-bounds access to the dirty bitset when resizing
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming-Hung Tsai <[email protected]>
commit 792227719725497ce10a8039803bec13f89f8910 upstream.
dm-cache checks the dirty bits of the cache blocks to be dropped when shrinking the fast device, but an index bug in bitset iteration causes out-of-bounds access.
Reproduce steps:
1. create a cache device of 1024 cache blocks (128 bytes dirty bitset)
dmsetup create cmeta --table "0 8192 linear /dev/sdc 0" dmsetup create cdata --table "0 131072 linear /dev/sdc 8192" dmsetup create corig --table "0 524288 linear /dev/sdc 262144" dd if=/dev/zero of=/dev/mapper/cmeta bs=4k count=1 oflag=direct dmsetup create cache --table "0 524288 cache /dev/mapper/cmeta \/dev/mapper/cdata /dev/mapper/corig 128 2 metadata2 writethrough smq 0"
2. shrink the fast device to 512 cache blocks, triggering out-of-bounds access to the dirty bitset (offset 0x80)
dmsetup suspend cache
dmsetup reload cdata --table "0 65536 linear /dev/sdc 8192" dmsetup resume cdata
dmsetup resume cache
KASAN reports:
BUG: KASAN: vmalloc-out-of-bounds in cache_preresume+0x269/0x7b0 Read of size 8 at addr ffffc900000f3080 by task dmsetup/131
(...snip...)
The buggy address belongs to the virtual mapping at [ffffc900000f3000, ffffc900000f5000) created by: cache_ctr+0x176a/0x35f0
(...snip...)
Memory state around the buggy address:
ffffc900000f2f80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
ffffc900000f3000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffffc900000f3080: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
^
ffffc900000f3100: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
ffffc900000f3180: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8Fix by making the index post-incremented.
--- drivers/md/dm-cache-target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-cache-target.c +1 -1
@@ -2966,13 +2966,13 @@ static bool can_resize(struct cache *cac* We can't drop a dirty block when shrinking the cache. */ while (from_cblock (new_size) <from_cblock (cache->cache_size)) { - new_size =to_cblock (from_cblock (new_size) +1 );if (is_dirty (cache, new_size)) {DMERR ("%s: unable to shrink cache; cache block %llu is dirty" ,cache_device_name (cache), (unsigned long long )from_cblock (new_size));return false; } + new_size =to_cblock (from_cblock (new_size) +1 ); }return true;
Greg Kroah-Hartman
maintainerPATCH 38/82 dm cache: optimize dirty bit checking with find_next_bit when resizing
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming-Hung Tsai <[email protected]>
commit f484697e619a83ecc370443a34746379ad99d204 upstream.
When shrinking the fast device, dm-cache iteratively searches for a dirty bit among the cache blocks to be dropped, which is less efficient. Use find_next_bit instead, as it is twice as fast as the iterative approach with test_bit.
--- drivers/md/dm-cache-target.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/md/dm-cache-target.c +8 -8
@@ -2965,14 +2965,14 @@ static bool can_resize(struct cache *cac/* * We can't drop a dirty block when shrinking the cache. */ -while (from_cblock (new_size) <from_cblock (cache->cache_size)) { -if (is_dirty (cache, new_size)) { -DMERR ("%s: unable to shrink cache; cache block %llu is dirty" , -cache_device_name (cache), - (unsigned long long )from_cblock (new_size)); -return false; - } - new_size =to_cblock (from_cblock (new_size) +1 ); + new_size =to_cblock (find_next_bit (cache->dirty_bitset, +from_cblock (cache->cache_size), +from_cblock (new_size))); +if (new_size != cache->cache_size) { +DMERR ("%s: unable to shrink cache; cache block %llu is dirty" , +cache_device_name (cache), + (unsigned long long )from_cblock (new_size)); +return false; }return true;
Greg Kroah-Hartman
maintainerPATCH 39/82 dm cache: fix potential out-of-bounds access on the first resume
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming-Hung Tsai <[email protected]>
commit c0ade5d98979585d4f5a93e4514c2e9a65afa08d upstream.
Out-of-bounds access occurs if the fast device is expanded unexpectedly before the first-time resume of the cache table. This happens because expanding the fast device requires reloading the cache table for cache_create to allocate new in-core data structures that fit the new size, and the check in cache_preresume is not performed during the first resume, leading to the issue.
Reproduce steps:
1. prepare component devices:
dmsetup create cmeta --table "0 8192 linear /dev/sdc 0" dmsetup create cdata --table "0 65536 linear /dev/sdc 8192" dmsetup create corig --table "0 524288 linear /dev/sdc 262144" dd if=/dev/zero of=/dev/mapper/cmeta bs=4k count=1 oflag=direct
2. load a cache table of 512 cache blocks, and deliberately expand the fast device before resuming the cache, making the in-core data structures inadequate.
dmsetup create cache --notable
dmsetup reload cache --table "0 524288 cache /dev/mapper/cmeta \/dev/mapper/cdata /dev/mapper/corig 128 2 metadata2 writethrough smq 0" dmsetup reload cdata --table "0 131072 linear /dev/sdc 8192" dmsetup resume cdata
dmsetup resume cache
3. suspend the cache to write out the in-core dirty bitset and hint array, leading to out-of-bounds access to the dirty bitset at offset 0x40:
dmsetup suspend cache
KASAN reports:
BUG: KASAN: vmalloc-out-of-bounds in is_dirty_callback+0x2b/0x80 Read of size 8 at addr ffffc90000085040 by task dmsetup/90
(...snip...)
The buggy address belongs to the virtual mapping at [ffffc90000085000, ffffc90000087000) created by: cache_ctr+0x176a/0x35f0
(...snip...)
Memory state around the buggy address:
ffffc90000084f00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
ffffc90000084f80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
>ffffc90000085000: 00 00 00 00 00 00 00 00 f8 f8 f8 f8 f8 f8 f8 f8
^
ffffc90000085080: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
ffffc90000085100: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8Fix by checking the size change on the first resume.
--- drivers/md/dm-cache-target.c | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-)
drivers/md/dm-cache-target.c +16 -21
@@ -2955,24 +2955,24 @@ static dm_cblock_t get_cache_dev_size(ststatic bool can_resize (struct cache *cache,dm_cblock_t new_size) {if (from_cblock (new_size) >from_cblock (cache->cache_size)) { -if (cache->sized) { -DMERR ("%s: unable to extend cache due to missing cache table reload" , -cache_device_name (cache)); -return false; - } +DMERR ("%s: unable to extend cache due to missing cache table reload" , +cache_device_name (cache)); +return false; }/* * We can't drop a dirty block when shrinking the cache. */ - new_size =to_cblock (find_next_bit (cache->dirty_bitset, -from_cblock (cache->cache_size), -from_cblock (new_size))); -if (new_size != cache->cache_size) { -DMERR ("%s: unable to shrink cache; cache block %llu is dirty" , -cache_device_name (cache), - (unsigned long long )from_cblock (new_size)); -return false; +if (cache->loaded_mappings) { + new_size =to_cblock (find_next_bit (cache->dirty_bitset, +from_cblock (cache->cache_size), +from_cblock (new_size))); +if (new_size != cache->cache_size) { +DMERR ("%s: unable to shrink cache; cache block %llu is dirty" , +cache_device_name (cache), + (unsigned long long )from_cblock (new_size)); +return false; + } }return true;
@@ -3003,20 +3003,15 @@ static int cache_preresume(struct dm_tar/* * Check to see if the cache has resized. */ -if (!cache->sized) { - r =resize_cache_dev (cache, csize); -if (r) -return r; - - cache->sized = true; - - }else if (csize != cache->cache_size) { +if (!cache->sized || csize != cache->cache_size) {if (!can_resize (cache, csize))return -EINVAL ; r =resize_cache_dev (cache, csize);if (r)return r; + + cache->sized = true; }if (!cache->loaded_mappings) {
Greg Kroah-Hartman
maintainerPATCH 40/82 dm-unstriped: cast an operand to sector_t to prevent potential uint32_t overflow
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zichen Xie <[email protected]>
commit 5a4510c762fc04c74cff264cd4d9e9f5bf364bae upstream.
This was found by a static analyzer.
There may be a potential integer overflow issue in unstripe_ctr(). uc->unstripe_offset and uc->unstripe_width are defined as "sector_t"(uint64_t), while uc->unstripe, uc->chunk_size and uc->stripes are all defined as "uint32_t". The result of the calculation will be limited to "uint32_t" without correct casting.
So, we recommend adding an extra cast to prevent potential integer overflow.
--- drivers/md/dm-unstripe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/md/dm-unstripe.c +2 -2
@@ -84,8 +84,8 @@ static int unstripe_ctr(struct dm_target } uc->physical_start = start; - uc->unstripe_offset = uc->unstripe * uc->chunk_size; - uc->unstripe_width = (uc->stripes -1 ) * uc->chunk_size; + uc->unstripe_offset = (sector_t )uc->unstripe * uc->chunk_size; + uc->unstripe_width = (sector_t)(uc->stripes -1 ) * uc->chunk_size; uc->chunk_shift =is_power_of_2 (uc->chunk_size) ?fls (uc->chunk_size) -1 :0 ; tmp_len = ti->len;
Greg Kroah-Hartman
maintainerPATCH 41/82 io_uring: rename kiocb_end_write() local helper
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <[email protected]>
Commit a370167fe526123637965f60859a9f1f3e1a58b7 upstream.
This helper does not take a kiocb as input and we want to create a common helper by that name that takes a kiocb as input.
Message-Id: <[email protected]>
--- io_uring/io_uring.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
io_uring/io_uring.c +4 -4
@@ -2667,7 +2667,7 @@ static int io_iopoll_check(struct io_ring_ctx *ctx, long min)return ret; } -static void kiocb_end_write (struct io_kiocb *req) +static void io_req_end_write (struct io_kiocb *req) {/* * Tell lockdep we inherited freeze protection from submission
@@ -2737,7 +2737,7 @@ static void io_req_io_end(struct io_kiocb *req)struct io_rw *rw = &req->rw;if (rw->kiocb.ki_flags &IOCB_WRITE ) { -kiocb_end_write (req); +io_req_end_write (req);fsnotify_modify (req->file); }else {fsnotify_access (req->file);
@@ -2817,7 +2817,7 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res, long res2) struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw.kiocb);if (kiocb->ki_flags &IOCB_WRITE ) -kiocb_end_write (req); +io_req_end_write (req);if (unlikely (res != req->result)) {if (res == -EAGAIN &&io_rw_should_reissue (req)) { req->flags |=REQ_F_REISSUE ;
@@ -3817,7 +3817,7 @@ static int io_write(struct io_kiocb *req, unsigned int issue_flags) ret =io_setup_async_rw (req, iovec, inline_vecs, iter, false);if (!ret) {if (kiocb->ki_flags &IOCB_WRITE ) -kiocb_end_write (req); +io_req_end_write (req);return -EAGAIN ; }return ret;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 42/82 fs: create kiocb_{start,end}_write() helpers
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <[email protected]>
Commit ed0360bbab72b829437b67ebb2f9cfac19f59dfe upstream.
aio, io_uring, cachefiles and overlayfs, all open code an ugly variant of file_{start,end}_write() to silence lockdep warnings.
Create helpers for this lockdep dance so we can use the helpers in all the callers.
Message-Id: <[email protected]>
--- include/linux/fs.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
include/linux/fs.h +35 -0
@@ -1797,6 +1797,41 @@ static inline bool sb_start_intwrite_trylock(struct super_block *sb)return __sb_start_write_trylock (sb,SB_FREEZE_FS ); } +/** +* kiocb_start_write - get write access to a superblock for async file io +* @iocb: the io context we want to submit the write with +* +* This is a variant of sb_start_write() for async io submission. +* Should be matched with a call to kiocb_end_write(). +*/ +static inline void kiocb_start_write (struct kiocb *iocb) +{ +struct inode *inode =file_inode (iocb->ki_filp); + +sb_start_write (inode->i_sb); +/* +* Fool lockdep by telling it the lock got released so that it +* doesn't complain about the held lock when we return to userspace. +*/ +__sb_writers_release (inode->i_sb,SB_FREEZE_WRITE ); +} + +/** +* kiocb_end_write - drop write access to a superblock after async file io +* @iocb: the io context we sumbitted the write with +* +* Should be matched with a call to kiocb_start_write(). +*/ +static inline void kiocb_end_write (struct kiocb *iocb) +{ +struct inode *inode =file_inode (iocb->ki_filp); + +/* +* Tell lockdep we inherited freeze protection from submission thread. +*/ +__sb_writers_acquired (inode->i_sb,SB_FREEZE_WRITE ); +sb_end_write (inode->i_sb); +}extern bool inode_owner_or_capable (const struct inode *inode);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 43/82 io_uring: use kiocb_{start,end}_write() helpers
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <[email protected]>
Commit e484fd73f4bdcb00c2188100c2d84e9f3f5c9f7d upstream.
Use helpers instead of the open coded dance to silence lockdep warnings.
Message-Id: <[email protected]>
--- io_uring/io_uring.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-)
io_uring/io_uring.c +4 -19
@@ -2669,15 +2669,10 @@ static int io_iopoll_check(struct io_ring_ctx *ctx, long min)static void io_req_end_write (struct io_kiocb *req) { -/* -* Tell lockdep we inherited freeze protection from submission -* thread. -*/ if (req->flags &REQ_F_ISREG ) { -struct super_block *sb =file_inode (req->file)->i_sb; +struct io_rw *rw = &req->rw; -__sb_writers_acquired (sb,SB_FREEZE_WRITE ); -sb_end_write (sb); +kiocb_end_write (&rw->kiocb); } }
@@ -3770,18 +3765,8 @@ static int io_write(struct io_kiocb *req, unsigned int issue_flags)if (unlikely (ret)) goto out_free; -/* -* Open-code file_start_write here to grab freeze protection, -* which will be released by another thread in -* io_complete_rw(). Fool lockdep by telling it the lock got -* released so that it doesn't complain about the held lock when -* we return to userspace. -*/ -if (req->flags &REQ_F_ISREG ) { -sb_start_write (file_inode (req->file)->i_sb); -__sb_writers_release (file_inode (req->file)->i_sb, -SB_FREEZE_WRITE ); - } +if (req->flags &REQ_F_ISREG ) +kiocb_start_write (kiocb); kiocb->ki_flags |=IOCB_WRITE ;if (req->file->f_op->write_iter)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 44/82 io_uring/rw: fix missing NOWAIT check for O_DIRECT start write
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
Commit 1d60d74e852647255bd8e76f5a22dc42531e4389 upstream.
When io_uring starts a write, it'll call kiocb_start_write() to bump the super block rwsem, preventing any freezes from happening while that write is in-flight. The freeze side will grab that rwsem for writing, excluding any new writers from happening and waiting for existing writes to finish. But io_uring unconditionally uses kiocb_start_write(), which will block if someone is currently attempting to freeze the mount point. This causes a deadlock where freeze is waiting for previous writes to complete, but the previous writes cannot complete, as the task that is supposed to complete them is blocked waiting on starting a new write. This results in the following stuck trace showing that dependency with the write blocked starting a new write:
task:fio state:D stack:0 pid:886 tgid:886 ppid:876
Call trace:
__switch_to+0x1d8/0x348
__schedule+0x8e8/0x2248
schedule+0x110/0x3f0
percpu_rwsem_wait+0x1e8/0x3f8
__percpu_down_read+0xe8/0x500
io_write+0xbb8/0xff8
io_issue_sqe+0x10c/0x1020
io_submit_sqes+0x614/0x2110
__arm64_sys_io_uring_enter+0x524/0x1038
invoke_syscall+0x74/0x268
el0_svc_common.constprop.0+0x160/0x238
do_el0_svc+0x44/0x60
el0_svc+0x44/0xb0
el0t_64_sync_handler+0x118/0x128
el0t_64_sync+0x168/0x170
INFO: task fsfreeze:7364 blocked for more than 15 seconds.
Not tainted 6.12.0-rc5-00063-g76aaf945701c #7963with the attempting freezer stuck trying to grab the rwsem:
task:fsfreeze state:D stack:0 pid:7364 tgid:7364 ppid:995
Call trace: __switch_to+0x1d8/0x348 __schedule+0x8e8/0x2248 schedule+0x110/0x3f0 percpu_down_write+0x2b0/0x680 freeze_super+0x248/0x8a8 do_vfs_ioctl+0x149c/0x1b18 __arm64_sys_ioctl+0xd0/0x1a0 invoke_syscall+0x74/0x268 el0_svc_common.constprop.0+0x160/0x238 do_el0_svc+0x44/0x60 el0_svc+0x44/0xb0 el0t_64_sync_handler+0x118/0x128 el0t_64_sync+0x168/0x170
Fix this by having the io_uring side honor IOCB_NOWAIT, and only attempt a blocking grab of the super block rwsem if it isn't set. For normal issue where IOCB_NOWAIT would always be set, this returns -EAGAIN which will have io_uring core issue a blocking attempt of the write. That will in turn also get completions run, ensuring forward progress.
Since freezing requires CAP_SYS_ADMIN in the first place, this isn't something that can be triggered by a regular user.
--- io_uring/io_uring.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
io_uring/io_uring.c +21 -2
@@ -3719,6 +3719,25 @@ static int io_write_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)return io_prep_rw (req, sqe,WRITE ); } +static bool io_kiocb_start_write (struct io_kiocb *req,struct kiocb *kiocb) +{ +struct inode *inode; +bool ret; + +if (!(req->flags &REQ_F_ISREG )) +return true; +if (!(kiocb->ki_flags &IOCB_NOWAIT )) { +kiocb_start_write (kiocb); +return true; + } + + inode =file_inode (kiocb->ki_filp); + ret =sb_start_write_trylock (inode->i_sb); +if (ret) +__sb_writers_release (inode->i_sb,SB_FREEZE_WRITE ); +return ret; +} +static int io_write (struct io_kiocb *req,unsigned int issue_flags) {struct iovec inline_vecs[UIO_FASTIOV ], *iovec = inline_vecs;
@@ -3765,8 +3784,8 @@ static int io_write(struct io_kiocb *req, unsigned int issue_flags)if (unlikely (ret)) goto out_free; -if (req->flags &REQ_F_ISREG ) -kiocb_start_write (kiocb); +if (unlikely (!io_kiocb_start_write (req, kiocb))) + goto copy_iov; kiocb->ki_flags |=IOCB_WRITE ;if (req->file->f_op->write_iter)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 45/82 nfs: Fix KMSAN warning in decode_getfattr_attrs()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roberto Sassu <[email protected]>
commit dc270d7159699ad6d11decadfce9633f0f71c1db upstream.
Fix the following KMSAN warning:
CPU: 1 UID: 0 PID: 7651 Comm: cp Tainted: G B Tainted: [B]=BAD_PAGE Hardware name: QEMU Standard PC (Q35 + ICH9, 2009) ===================================================== ===================================================== BUG: KMSAN: uninit-value in decode_getfattr_attrs+0x2d6d/0x2f90 decode_getfattr_attrs+0x2d6d/0x2f90 decode_getfattr_generic+0x806/0xb00 nfs4_xdr_dec_getattr+0x1de/0x240 rpcauth_unwrap_resp_decode+0xab/0x100 rpcauth_unwrap_resp+0x95/0xc0 call_decode+0x4ff/0xb50 __rpc_execute+0x57b/0x19d0 rpc_execute+0x368/0x5e0 rpc_run_task+0xcfe/0xee0 nfs4_proc_getattr+0x5b5/0x990 __nfs_revalidate_inode+0x477/0xd00 nfs_access_get_cached+0x1021/0x1cc0 nfs_do_access+0x9f/0xae0 nfs_permission+0x1e4/0x8c0 inode_permission+0x356/0x6c0 link_path_walk+0x958/0x1330 path_lookupat+0xce/0x6b0 filename_lookup+0x23e/0x770 vfs_statx+0xe7/0x970 vfs_fstatat+0x1f2/0x2c0 __se_sys_newfstatat+0x67/0x880 __x64_sys_newfstatat+0xbd/0x120 x64_sys_call+0x1826/0x3cf0 do_syscall_64+0xd0/0x1b0 entry_SYSCALL_64_after_hwframe+0x77/0x7f
The KMSAN warning is triggered in decode_getfattr_attrs(), when calling decode_attr_mdsthreshold(). It appears that fattr->mdsthreshold is not initialized.
Fix the issue by initializing fattr->mdsthreshold to NULL in nfs_fattr_init().
--- fs/nfs/inode.c | 1 + 1 file changed, 1 insertion(+)
fs/nfs/inode.c +1 -0
@@ -1532,6 +1532,7 @@ void nfs_fattr_init(struct nfs_fattr *fa fattr->gencount =nfs_inc_attr_generation_counter (); fattr->owner_name =NULL ; fattr->group_name =NULL ; + fattr->mdsthreshold =NULL ; }EXPORT_SYMBOL_GPL (nfs_fattr_init);
Greg Kroah-Hartman
maintainerPATCH 46/82 btrfs: reinitialize delayed ref list after deleting it from the list
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit c9a75ec45f1111ef530ab186c2a7684d0a0c9245 upstream.
At insert_delayed_ref() if we need to update the action of an existing ref to BTRFS_DROP_DELAYED_REF, we delete the ref from its ref head's ref_add_list using list_del(), which leaves the ref's add_list member not reinitialized, as list_del() sets the next and prev members of the list to LIST_POISON1 and LIST_POISON2, respectively.
If later we end up calling drop_delayed_ref() against the ref, which can happen during merging or when destroying delayed refs due to a transaction abort, we can trigger a crash since at drop_delayed_ref() we call list_empty() against the ref's add_list, which returns false since the list was not reinitialized after the list_del() and as a consequence we call list_del() again at drop_delayed_ref(). This results in an invalid list access since the next and prev members are set to poison pointers, resulting in a splat if CONFIG_LIST_HARDENED and CONFIG_DEBUG_LIST are set or invalid poison pointer dereferences otherwise.
So fix this by deleting from the list with list_del_init() instead.
--- fs/btrfs/delayed-ref.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/delayed-ref.c +1 -1
@@ -620,7 +620,7 @@ static int insert_delayed_ref(struct btr &href->ref_add_list); else if (ref->action == BTRFS_DROP_DELAYED_REF) {ASSERT (!list_empty (&exist->add_list)); -list_del (&exist->add_list); +list_del_init (&exist->add_list); } else {ASSERT (0 ); }
Greg Kroah-Hartman
maintainerPATCH 47/82 splice: dont generate zero-len segement bvecs
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
commit 0f1d344feb534555a0dcd0beafb7211a37c5355e upstream.
iter_file_splice_write() may spawn bvec segments with zero-length. In preparation for prohibiting them, filter out by hand at splice level.
--- fs/splice.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
fs/splice.c +6 -3
@@ -662,12 +662,14 @@ iter_file_splice_write(struct pipe_inode/* build the vector */ left = sd.total_len; -for (n =0 ; !pipe_empty (head, tail) && left && n < nbufs; tail++, n++) { +for (n =0 ; !pipe_empty (head, tail) && left && n < nbufs; tail++) {struct pipe_buffer *buf = &pipe->bufs[tail & mask];size_t this_len = buf->len; -if (this_len > left) - this_len = left; +/* zero-length bvecs are not supported, skip them */ +if (!this_len) +continue ; + this_len =min (this_len, left); ret =pipe_buf_confirm (pipe, buf);if (unlikely (ret)) {
@@ -680,6 +682,7 @@ iter_file_splice_write(struct pipe_inode array[n].bv_len = this_len; array[n].bv_offset = buf->offset; left -= this_len; + n++; }iov_iter_bvec (&from,WRITE , array, n, sd.total_len - left);
Greg Kroah-Hartman
maintainerPATCH 48/82 spi: Fix deadlock when adding SPI controllers on SPI buses
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 6098475d4cb48d821bdf453c61118c56e26294f0 upstream.
Currently we have a global spi_add_lock which we take when adding new devices so that we can check that we're not trying to reuse a chip select that's already controlled. This means that if the SPI device is itself a SPI controller and triggers the instantiation of further SPI devices we trigger a deadlock as we try to register and instantiate those devices while in the process of doing so for the parent controller and hence already holding the global spi_add_lock. Since we only care about concurrency within a single SPI bus move the lock to be per controller, avoiding the deadlock.
This can be easily triggered in the case of spi-mux.
--- drivers/spi/spi.c | 15 +++++---------- include/linux/spi/spi.h | 3 +++ 2 files changed, 8 insertions(+), 10 deletions(-)
drivers/spi/spi.c +5 -10
@@ -472,12 +472,6 @@ static LIST_HEAD(spi_controller_list);*/ static DEFINE_MUTEX (board_lock); -/* -* Prevents addition of devices with same chip select and -* addition of devices below an unregistering controller. -*/ -static DEFINE_MUTEX (spi_add_lock); -/** * spi_alloc_device - Allocate a new SPI device * @ctlr: Controller to which device is connected
@@ -581,7 +575,7 @@ int spi_add_device(struct spi_device *sp* chipselect **BEFORE** we call setup(), else we'll trash * its configuration. Lock against concurrent add() calls. */ -mutex_lock (&spi_add_lock); +mutex_lock (&ctlr->add_lock); status =bus_for_each_dev (&spi_bus_type,NULL , spi, spi_dev_check);if (status) {
@@ -625,7 +619,7 @@ int spi_add_device(struct spi_device *sp } done: -mutex_unlock (&spi_add_lock); +mutex_unlock (&ctlr->add_lock);return status; }EXPORT_SYMBOL_GPL (spi_add_device);
@@ -2734,6 +2728,7 @@ int spi_register_controller(struct spi_cspin_lock_init (&ctlr->bus_lock_spinlock);mutex_init (&ctlr->bus_lock_mutex);mutex_init (&ctlr->io_mutex); +mutex_init (&ctlr->add_lock); ctlr->bus_lock_flag =0 ;init_completion (&ctlr->xfer_completion);if (!ctlr->max_dma_len)
@@ -2879,7 +2874,7 @@ void spi_unregister_controller(struct sp/* Prevent addition of new devices, unregister existing ones */ if (IS_ENABLED (CONFIG_SPI_DYNAMIC )) -mutex_lock (&spi_add_lock); +mutex_lock (&ctlr->add_lock);device_for_each_child (&ctlr->dev,NULL , __unregister);
@@ -2910,7 +2905,7 @@ void spi_unregister_controller(struct spmutex_unlock (&board_lock);if (IS_ENABLED (CONFIG_SPI_DYNAMIC )) -mutex_unlock (&spi_add_lock); +mutex_unlock (&ctlr->add_lock); }EXPORT_SYMBOL_GPL (spi_unregister_controller);
include/linux/spi/spi.h +3 -0
@@ -528,6 +528,9 @@ struct spi_controller {/* I/O mutex */ struct mutex io_mutex; +/* Used to avoid adding the same CS twice */ +struct mutex add_lock; +/* lock and mutex for SPI bus locking */ spinlock_t bus_lock_spinlock;struct mutex bus_lock_mutex;
Greg Kroah-Hartman
maintainerPATCH 49/82 spi: fix use-after-free of the add_lock mutex
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Walle <[email protected]>
commit 6c53b45c71b4920b5e62f0ea8079a1da382b9434 upstream.
Commit 6098475d4cb4 ("spi: Fix deadlock when adding SPI controllers on SPI buses") introduced a per-controller mutex. But mutex_unlock() of said lock is called after the controller is already freed:
spi_unregister_controller(ctlr)
-> put_device(&ctlr->dev)
-> spi_controller_release(dev)
-> mutex_unlock(&ctrl->add_lock)
Move the put_device() after the mutex_unlock().
--- drivers/spi/spi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/spi/spi.c +6 -6
@@ -2892,12 +2892,6 @@ void spi_unregister_controller(struct spdevice_del (&ctlr->dev); -/* Release the last reference on the controller if its driver -* has not yet been converted to devm_spi_alloc_master/slave(). -*/ -if (!ctlr->devm_allocated) -put_device (&ctlr->dev); -/* free bus id */ mutex_lock (&board_lock);if (found == ctlr)
@@ -2906,6 +2900,12 @@ void spi_unregister_controller(struct spif (IS_ENABLED (CONFIG_SPI_DYNAMIC ))mutex_unlock (&ctlr->add_lock); + +/* Release the last reference on the controller if its driver +* has not yet been converted to devm_spi_alloc_master/slave(). +*/ +if (!ctlr->devm_allocated) +put_device (&ctlr->dev); }EXPORT_SYMBOL_GPL (spi_unregister_controller);
Greg Kroah-Hartman
maintainerPATCH 50/82 net: bridge: xmit: make sure we have at least eth header len bytes
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
commit 8bd67ebb50c0145fd2ca8681ab65eb7e8cde1afc upstream.
syzbot triggered an uninit value[1] error in bridge device's xmit path by sending a short (less than ETH_HLEN bytes) skb. To fix it check if we can actually pull that amount instead of assuming.
Tested with dropwatch:
drop at: br_dev_xmit+0xb93/0x12d0 [bridge] (0xffffffffc06739b3)
origin: software
timestamp: Mon May 13 11:31:53 2024 778214037 nsec
protocol: 0x88a8
length: 2
original length: 2
drop reason: PKT_TOO_SMALL
[1]
BUG: KMSAN: uninit-value in br_dev_xmit+0x61d/0x1cb0 net/bridge/br_device.c:65 br_dev_xmit+0x61d/0x1cb0 net/bridge/br_device.c:65 __netdev_start_xmit include/linux/netdevice.h:4903 [inline] netdev_start_xmit include/linux/netdevice.h:4917 [inline] xmit_one net/core/dev.c:3531 [inline] dev_hard_start_xmit+0x247/0xa20 net/core/dev.c:3547 __dev_queue_xmit+0x34db/0x5350 net/core/dev.c:4341 dev_queue_xmit include/linux/netdevice.h:3091 [inline] __bpf_tx_skb net/core/filter.c:2136 [inline] __bpf_redirect_common net/core/filter.c:2180 [inline] __bpf_redirect+0x14a6/0x1620 net/core/filter.c:2187 ____bpf_clone_redirect net/core/filter.c:2460 [inline] bpf_clone_redirect+0x328/0x470 net/core/filter.c:2432 ___bpf_prog_run+0x13fe/0xe0f0 kernel/bpf/core.c:1997 __bpf_prog_run512+0xb5/0xe0 kernel/bpf/core.c:2238 bpf_dispatcher_nop_func include/linux/bpf.h:1234 [inline] __bpf_prog_run include/linux/filter.h:657 [inline] bpf_prog_run include/linux/filter.h:664 [inline] bpf_test_run+0x499/0xc30 net/bpf/test_run.c:425 bpf_prog_test_run_skb+0x14ea/0x1f20 net/bpf/test_run.c:1058 bpf_prog_test_run+0x6b7/0xad0 kernel/bpf/syscall.c:4269 __sys_bpf+0x6aa/0xd90 kernel/bpf/syscall.c:5678 __do_sys_bpf kernel/bpf/syscall.c:5767 [inline] __se_sys_bpf kernel/bpf/syscall.c:5765 [inline] __x64_sys_bpf+0xa0/0xe0 kernel/bpf/syscall.c:5765 x64_sys_call+0x96b/0x3b50 arch/x86/include/generated/asm/syscalls_64.h:322 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- net/bridge/br_device.c | 5 +++++ 1 file changed, 5 insertions(+)
net/bridge/br_device.c +5 -0
@@ -36,6 +36,11 @@ netdev_tx_t br_dev_xmit(struct sk_buff *const unsigned char *dest;u16 vid =0 ; +if (unlikely (!pskb_may_pull (skb,ETH_HLEN ))) { +kfree_skb (skb); +return NETDEV_TX_OK ; + } +memset (skb->cb,0 ,sizeof (struct br_input_skb_cb ));rcu_read_lock ();
Greg Kroah-Hartman
maintainerPATCH 51/82 Revert "perf hist: Add missing puts to hist__account_cycles"
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Xue <[email protected]>
Revert "perf hist: Add missing puts to hist__account_cycles"
This reverts commit a83fc293acd5c5050a4828eced4a71d2b2fffdd3.
On x86 platform, kernel v5.10.228, perf-report command aborts due to "free():
invalid pointer" when perf-record command is run with taken branch stack sampling enabled. This regression can be reproduced with the following steps:
- sudo perf record -b
- sudo perf report
The root cause is that bi[i].to.ms.maps does not always point to thread->maps, which is a buffer dynamically allocated by maps_new(). Instead, it may point to &machine->kmaps, while kmaps is not a pointer but a variable. The original upstream commit c1149037f65b ("perf hist: Add missing puts to hist__account_cycles") worked well because machine->kmaps had been refactored to a pointer by the previous commit 1a97cee604dc ("perf maps: Use a pointer for kmaps").
To this end, just revert commit a83fc293acd5c5050a4828eced4a71d2b2fffdd3.
It is worth noting that the memory leak issue, which the reverted patch intended to fix, has been solved by commit cf96b8e45a9b ("perf session: Add missing evlist__delete when deleting a session"). The root cause is that the evlist is not being deleted on exit in perf-report, perf-script, and perf-data. Consequently, the reference count of the thread increased by thread__get() in hist_entry__init() is not decremented in hist_entry__delete(). As a result, thread->maps is not properly freed.
--- tools/perf/util/hist.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
tools/perf/util/hist.c +3 -7
@@ -2624,6 +2624,8 @@ void hist__account_cycles(struct branch_/* If we have branch cycles always annotate them. */ if (bs && bs->nr && entries[0 ].flags.cycles) { +int i; + bi =sample__resolve_bstack (sample, al);if (bi) {struct addr_map_symbol *prev =NULL ;
@@ -2638,7 +2640,7 @@ void hist__account_cycles(struct branch_* Note that perf stores branches reversed from * program order! */ -for (int i = bs->nr -1 ; i >=0 ; i--) { +for (i = bs->nr -1 ; i >=0 ; i--) {addr_map_symbol__account_cycles (&bi[i].from, nonany_branch_mode ?NULL : prev, bi[i].flags.cycles);
@@ -2647,12 +2649,6 @@ void hist__account_cycles(struct branch_if (total_cycles) *total_cycles += bi[i].flags.cycles; } -for (unsigned int i =0 ; i < bs->nr; i++) { -map__put (bi[i].to.ms.map); -maps__put (bi[i].to.ms.maps); -map__put (bi[i].from.ms.map); -maps__put (bi[i].from.ms.maps); - }free (bi); } }
Greg Kroah-Hartman
maintainerPATCH 52/82 perf session: Add missing evlist__delete when deleting a session
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Riccardo Mancini <[email protected]>
commit cf96b8e45a9bf74d2a6f1e1f88a41b10e9357c6b upstream.
ASan reports a memory leak caused by evlist not being deleted on exit in perf-report, perf-script and perf-data.
The problem is caused by evlist->session not being deleted, which is allocated in perf_session__read_header, called in perf_session__new if perf_data is in read mode.
In case of write mode, the session->evlist is filled by the caller. This patch solves the problem by calling evlist__delete in perf_session__delete if perf_data is in read mode.
Changes in v2:
- call evlist__delete from within perf_session__delete
v1: https://lore.kernel.org/lkml/[email protected]/
ASan report follows:
$ ./perf script report flamegraph ================================================================= ==227640==ERROR: LeakSanitizer: detected memory leaks
<SNIP unrelated>
Indirect leak of 2704 byte(s) in 1 object(s) allocated from:
#0 0x4f4137 in calloc (/home/user/linux/tools/perf/perf+0x4f4137)
#1 0xbe3d56 in zalloc /home/user/linux/tools/lib/perf/../../lib/zalloc.c:8:9
#2 0x7f999e in evlist__new /home/user/linux/tools/perf/util/evlist.c:77:26
#3 0x8ad938 in perf_session__read_header /home/user/linux/tools/perf/util/header.c:3797:20
#4 0x8ec714 in perf_session__open /home/user/linux/tools/perf/util/session.c:109:6
#5 0x8ebe83 in perf_session__new /home/user/linux/tools/perf/util/session.c:213:10
#6 0x60c6de in cmd_script /home/user/linux/tools/perf/builtin-script.c:3856:12
#7 0x7b2930 in run_builtin /home/user/linux/tools/perf/perf.c:313:11
#8 0x7b120f in handle_internal_command /home/user/linux/tools/perf/perf.c:365:8
#9 0x7b2493 in run_argv /home/user/linux/tools/perf/perf.c:409:2
#10 0x7b0c89 in main /home/user/linux/tools/perf/perf.c:539:3
#11 0x7f5260654b74 (/lib64/libc.so.6+0x27b74)Indirect leak of 568 byte(s) in 1 object(s) allocated from:
#0 0x4f4137 in calloc (/home/user/linux/tools/perf/perf+0x4f4137)
#1 0xbe3d56 in zalloc /home/user/linux/tools/lib/perf/../../lib/zalloc.c:8:9
#2 0x80ce88 in evsel__new_idx /home/user/linux/tools/perf/util/evsel.c:268:24
#3 0x8aed93 in evsel__new /home/user/linux/tools/perf/util/evsel.h:210:9
#4 0x8ae07e in perf_session__read_header /home/user/linux/tools/perf/util/header.c:3853:11
#5 0x8ec714 in perf_session__open /home/user/linux/tools/perf/util/session.c:109:6
#6 0x8ebe83 in perf_session__new /home/user/linux/tools/perf/util/session.c:213:10
#7 0x60c6de in cmd_script /home/user/linux/tools/perf/builtin-script.c:3856:12
#8 0x7b2930 in run_builtin /home/user/linux/tools/perf/perf.c:313:11
#9 0x7b120f in handle_internal_command /home/user/linux/tools/perf/perf.c:365:8
#10 0x7b2493 in run_argv /home/user/linux/tools/perf/perf.c:409:2
#11 0x7b0c89 in main /home/user/linux/tools/perf/perf.c:539:3
#12 0x7f5260654b74 (/lib64/libc.so.6+0x27b74)Indirect leak of 264 byte(s) in 1 object(s) allocated from:
#0 0x4f4137 in calloc (/home/user/linux/tools/perf/perf+0x4f4137)
#1 0xbe3d56 in zalloc /home/user/linux/tools/lib/perf/../../lib/zalloc.c:8:9
#2 0xbe3e70 in xyarray__new /home/user/linux/tools/lib/perf/xyarray.c:10:23
#3 0xbd7754 in perf_evsel__alloc_id /home/user/linux/tools/lib/perf/evsel.c:361:21
#4 0x8ae201 in perf_session__read_header /home/user/linux/tools/perf/util/header.c:3871:7
#5 0x8ec714 in perf_session__open /home/user/linux/tools/perf/util/session.c:109:6
#6 0x8ebe83 in perf_session__new /home/user/linux/tools/perf/util/session.c:213:10
#7 0x60c6de in cmd_script /home/user/linux/tools/perf/builtin-script.c:3856:12
#8 0x7b2930 in run_builtin /home/user/linux/tools/perf/perf.c:313:11
#9 0x7b120f in handle_internal_command /home/user/linux/tools/perf/perf.c:365:8
#10 0x7b2493 in run_argv /home/user/linux/tools/perf/perf.c:409:2
#11 0x7b0c89 in main /home/user/linux/tools/perf/perf.c:539:3
#12 0x7f5260654b74 (/lib64/libc.so.6+0x27b74)Indirect leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x4f4137 in calloc (/home/user/linux/tools/perf/perf+0x4f4137)
#1 0xbe3d56 in zalloc /home/user/linux/tools/lib/perf/../../lib/zalloc.c:8:9
#2 0xbd77e0 in perf_evsel__alloc_id /home/user/linux/tools/lib/perf/evsel.c:365:14
#3 0x8ae201 in perf_session__read_header /home/user/linux/tools/perf/util/header.c:3871:7
#4 0x8ec714 in perf_session__open /home/user/linux/tools/perf/util/session.c:109:6
#5 0x8ebe83 in perf_session__new /home/user/linux/tools/perf/util/session.c:213:10
#6 0x60c6de in cmd_script /home/user/linux/tools/perf/builtin-script.c:3856:12
#7 0x7b2930 in run_builtin /home/user/linux/tools/perf/perf.c:313:11
#8 0x7b120f in handle_internal_command /home/user/linux/tools/perf/perf.c:365:8
#9 0x7b2493 in run_argv /home/user/linux/tools/perf/perf.c:409:2
#10 0x7b0c89 in main /home/user/linux/tools/perf/perf.c:539:3
#11 0x7f5260654b74 (/lib64/libc.so.6+0x27b74)Indirect leak of 7 byte(s) in 1 object(s) allocated from:
#0 0x4b8207 in strdup (/home/user/linux/tools/perf/perf+0x4b8207)
#1 0x8b4459 in evlist__set_event_name /home/user/linux/tools/perf/util/header.c:2292:16
#2 0x89d862 in process_event_desc /home/user/linux/tools/perf/util/header.c:2313:3
#3 0x8af319 in perf_file_section__process /home/user/linux/tools/perf/util/header.c:3651:9
#4 0x8aa6e9 in perf_header__process_sections /home/user/linux/tools/perf/util/header.c:3427:9
#5 0x8ae3e7 in perf_session__read_header /home/user/linux/tools/perf/util/header.c:3886:2
#6 0x8ec714 in perf_session__open /home/user/linux/tools/perf/util/session.c:109:6
#7 0x8ebe83 in perf_session__new /home/user/linux/tools/perf/util/session.c:213:10
#8 0x60c6de in cmd_script /home/user/linux/tools/perf/builtin-script.c:3856:12
#9 0x7b2930 in run_builtin /home/user/linux/tools/perf/perf.c:313:11
#10 0x7b120f in handle_internal_command /home/user/linux/tools/perf/perf.c:365:8
#11 0x7b2493 in run_argv /home/user/linux/tools/perf/perf.c:409:2
#12 0x7b0c89 in main /home/user/linux/tools/perf/perf.c:539:3
#13 0x7f5260654b74 (/lib64/libc.so.6+0x27b74)SUMMARY: AddressSanitizer: 3728 byte(s) leaked in 7 allocation(s).
--- tools/perf/util/session.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/util/session.c +4 -1
@@ -299,8 +299,11 @@ void perf_session__delete(struct perf_seperf_session__release_decomp_events (session);perf_env__exit (&session->header.env);machines__exit (&session->machines); -if (session->data) +if (session->data) { +if (perf_data__is_read (session->data)) +evlist__delete (session->evlist);perf_data__close (session->data); + }free (session); }
Greg Kroah-Hartman
maintainerPATCH 53/82 net: do not delay dst_entries_add() in dst_release()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit ac888d58869bb99753e7652be19a151df9ecb35d upstream.
dst_entries_add() uses per-cpu data that might be freed at netns dismantle from ip6_route_net_exit() calling dst_entries_destroy()
Before ip6_route_net_exit() can be called, we release all the dsts associated with this netns, via calls to dst_release(), which waits an rcu grace period before calling dst_destroy()
dst_entries_add() use in dst_destroy() is racy, because dst_entries_destroy() could have been called already.
Decrementing the number of dsts must happen sooner.
Notes:
1) in CONFIG_XFRM case, dst_destroy() can call dst_release_immediate(child), this might also cause UAF if the child does not have DST_NOCOUNT set.
IPSEC maintainers might take a look and see how to address this.
2) There is also discussion about removing this count of dst, which might happen in future kernels.
[ resolved conflict due to bc9d3a9f2afc ("net: dst: Switch to rcuref_t
reference counting") is not in the tree ]
--- net/core/dst.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
net/core/dst.c +12 -5
@@ -109,9 +109,6 @@ struct dst_entry *dst_destroy(struct dst child = xdst->child; }#endif -if (!(dst->flags &DST_NOCOUNT )) -dst_entries_add (dst->ops,-1 ); -if (dst->ops->destroy) dst->ops->destroy (dst);if (dst->dev)
@@ -162,6 +159,12 @@ void dst_dev_put(struct dst_entry *dst) }EXPORT_SYMBOL (dst_dev_put); +static void dst_count_dec (struct dst_entry *dst) +{ +if (!(dst->flags &DST_NOCOUNT )) +dst_entries_add (dst->ops,-1 ); +} +void dst_release (struct dst_entry *dst) {if (dst) {
@@ -171,8 +174,10 @@ void dst_release(struct dst_entry *dst)if (WARN_ONCE (newrefcnt <0 ,"dst_release underflow" ))net_warn_ratelimited ("%s: dst:%p refcnt:%d\n" , __func__, dst, newrefcnt); -if (!newrefcnt) +if (!newrefcnt){ +dst_count_dec (dst);call_rcu (&dst->rcu_head, dst_destroy_rcu); + } } }EXPORT_SYMBOL (dst_release);
@@ -186,8 +191,10 @@ void dst_release_immediate(struct dst_enif (WARN_ONCE (newrefcnt <0 ,"dst_release_immediate underflow" ))net_warn_ratelimited ("%s: dst:%p refcnt:%d\n" , __func__, dst, newrefcnt); -if (!newrefcnt) +if (!newrefcnt){ +dst_count_dec (dst);dst_destroy (dst); + } } }EXPORT_SYMBOL (dst_release_immediate);
Greg Kroah-Hartman
maintainerPATCH 54/82 media: uvcvideo: Skip parsing frames of type UVC_VS_UNDEFINED in uvc_parse_format
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benoit Sevens <[email protected]>
commit ecf2b43018da9579842c774b7f35dbe11b5c38dd upstream.
This can lead to out of bounds writes since frames of this type were not taken into account when calculating the size of the frames buffer in uvc_parse_streaming.
--- drivers/media/usb/uvc/uvc_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_driver.c +1 -1
@@ -661,7 +661,7 @@ static int uvc_parse_format(struct uvc_d/* Parse the frame descriptors. Only uncompressed, MJPEG and frame * based formats have frame descriptors. */ -while (buflen >2 && buffer[1 ] ==USB_DT_CS_INTERFACE && +while (ftype && buflen >2 && buffer[1 ] ==USB_DT_CS_INTERFACE && buffer[2 ] == ftype) { frame = &format->frame[format->nframes];if (ftype !=UVC_VS_FRAME_FRAME_BASED )
Greg Kroah-Hartman
maintainerPATCH 55/82 fs/proc: fix compile warning about variable vmcore_mmap_ops
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qi Xi <[email protected]>
commit b8ee299855f08539e04d6c1a6acb3dc9e5423c00 upstream.
When build with !CONFIG_MMU, the variable 'vmcore_mmap_ops' is defined but not used:
Quoted 1 line
Quoted 1 line
fs/proc/vmcore.c:458:42: warning: unused variable 'vmcore_mmap_ops'
458 | static const struct vm_operations_struct vmcore_mmap_ops = {Fix this by only defining it when CONFIG_MMU is enabled.
--- fs/proc/vmcore.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
fs/proc/vmcore.c +5 -4
@@ -446,10 +446,6 @@ static vm_fault_t mmap_vmcore_fault(stru#endif } -static const struct vm_operations_struct vmcore_mmap_ops = { - .fault = mmap_vmcore_fault, -}; -/** * vmcore_alloc_buf - allocate buffer in vmalloc memory * @sizez: size of buffer
@@ -477,6 +473,11 @@ static inline char *vmcore_alloc_buf(siz* virtually contiguous user-space in ELF layout. */ #ifdef CONFIG_MMU + +static const struct vm_operations_struct vmcore_mmap_ops = { + .fault = mmap_vmcore_fault, +}; +/* * remap_oldmem_pfn_checked - do remap_oldmem_pfn_range replacing all pages * reported as not being ram with the zero page.
Greg Kroah-Hartman
maintainerPATCH 56/82 usb: musb: sunxi: Fix accessing an released usb phy
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit 498dbd9aea205db9da674994b74c7bf8e18448bd upstream.
Commit 6ed05c68cbca ("usb: musb: sunxi: Explicitly release USB PHY on exit") will cause that usb phy @glue->xceiv is accessed after released.
1) register platform driver @sunxi_musb_driver
// get the usb phy @glue->xceivsunxi_musb_probe() -> devm_usb_get_phy().
2) register and unregister platform driver @musb_driver musb_probe() -> sunxi_musb_init()
use the phy here
//the phy is released heremusb_remove() -> sunxi_musb_exit() -> devm_usb_put_phy()
3) register @musb_driver againmusb_probe() -> sunxi_musb_init()
use the phy here but the phy has been released at 2).
...
Fixed by reverting the commit, namely, removing devm_usb_put_phy() from sunxi_musb_exit().
--- drivers/usb/musb/sunxi.c | 2 -- 1 file changed, 2 deletions(-)
drivers/usb/musb/sunxi.c +0 -2
@@ -286,8 +286,6 @@ static int sunxi_musb_exit(struct musb *if (test_bit (SUNXI_MUSB_FL_HAS_SRAM , &glue->flags))sunxi_sram_release (musb->controller->parent); -devm_usb_put_phy (glue->dev, glue->xceiv); -return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 57/82 usb: typec: fix potential out of bounds in ucsi_ccg_update_set_new_cam_cmd()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 7dd08a0b4193087976db6b3ee7807de7e8316f96 upstream.
The "*cmd" variable can be controlled by the user via debugfs. That means "new_cam" can be as high as 255 while the size of the uc->updated[] array is UCSI_MAX_ALTMODES (30).
The call tree is:ucsi_cmd() // val comes from simple_attr_write_xsigned() -> ucsi_send_command()
-> ucsi_send_command_common()
-> ucsi_run_command() // calls ucsi->ops->sync_control()
-> ucsi_ccg_sync_control()--- drivers/usb/typec/ucsi/ucsi_ccg.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/typec/ucsi/ucsi_ccg.c +2 -0
@@ -436,6 +436,8 @@ static void ucsi_ccg_update_set_new_cam_ port = uc->orig; new_cam =UCSI_SET_NEW_CAM_GET_AM (*cmd); +if (new_cam >=ARRAY_SIZE (uc->updated)) +return ; new_port = &uc->updated[new_cam]; cam = new_port->linked_idx; enter_new_mode =UCSI_SET_NEW_CAM_ENTER (*cmd);
Greg Kroah-Hartman
maintainerPATCH 58/82 USB: serial: io_edgeport: fix use after free in debug printk
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 37bb5628379295c1254c113a407cab03a0f4d0b4 upstream.
The "dev_dbg(&urb->dev->dev, ..." which happens after usb_free_urb(urb) is a use after free of the "urb" pointer. Store the "dev" pointer at the start of the function to avoid this issue.
--- drivers/usb/serial/io_edgeport.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/serial/io_edgeport.c +4 -4
@@ -846,11 +846,12 @@ static void edge_bulk_out_data_callback(static void edge_bulk_out_cmd_callback (struct urb *urb) {struct edgeport_port *edge_port = urb->context; +struct device *dev = &urb->dev->dev;int status = urb->status;atomic_dec (&CmdUrbs); -dev_dbg (&urb->dev->dev,"%s - FREE URB %p (outstanding %d)\n" , - __func__, urb,atomic_read (&CmdUrbs)); +dev_dbg (dev,"%s - FREE URB %p (outstanding %d)\n" , __func__, urb, +atomic_read (&CmdUrbs));/* clean up the transfer buffer */
@@ -860,8 +861,7 @@ static void edge_bulk_out_cmd_callback(susb_free_urb (urb);if (status) { -dev_dbg (&urb->dev->dev, -"%s - nonzero write bulk status received: %d\n" , +dev_dbg (dev,"%s - nonzero write bulk status received: %d\n" , __func__, status);return ; }
Greg Kroah-Hartman
maintainerPATCH 59/82 USB: serial: qcserial: add support for Sierra Wireless EM86xx
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Wu <[email protected]>
commit 25eb47eed52979c2f5eee3f37e6c67714e02c49c upstream.
Add support for Sierra Wireless EM86xx with USB-id 0x1199:0x90e5 and 0x1199:0x90e4.
0x1199:0x90e5
T: Bus=03 Lev=01 Prnt=01 Port=05 Cnt=01 Dev#= 14 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=1199 ProdID=90e5 Rev= 5.15 S: Manufacturer=Sierra Wireless, Incorporated S: Product=Semtech EM8695 Mobile Broadband Adapter S: SerialNumber=004403161882339 C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA A: FirstIf#=12 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00 I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=qcserial E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=qcserial E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I:* If#=12 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim E: Ad=87(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#=13 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim I:* If#=13 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x1199:0x90e4
T: Bus=03 Lev=01 Prnt=01 Port=05 Cnt=01 Dev#= 16 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1199 ProdID=90e4 Rev= 0.00 S: Manufacturer=Sierra Wireless, Incorporated S: SerialNumber=004403161882339 C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 2mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=10 Driver=qcserial E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/qcserial.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/qcserial.c +2 -0
@@ -166,6 +166,8 @@ static const struct usb_device_id id_tab {DEVICE_SWI(0x1199, 0x9090)}, /* Sierra Wireless EM7565 QDL */ {DEVICE_SWI(0x1199, 0x9091)}, /* Sierra Wireless EM7565 */ {DEVICE_SWI(0x1199, 0x90d2)}, /* Sierra Wireless EM9191 QDL */ + {DEVICE_SWI(0x1199, 0x90e4)}, /* Sierra Wireless EM86xx QDL*/ + {DEVICE_SWI(0x1199, 0x90e5)}, /* Sierra Wireless EM86xx */ {DEVICE_SWI(0x1199, 0xc080)}, /* Sierra Wireless EM7590 QDL */ {DEVICE_SWI(0x1199, 0xc081)}, /* Sierra Wireless EM7590 */ {DEVICE_SWI(0x413c, 0x81a2)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */
Greg Kroah-Hartman
maintainerPATCH 60/82 USB: serial: option: add Fibocom FG132 0x0112 composition
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Reinhard Speyerer <[email protected]>
commit 393c74ccbd847bacf18865a01b422586fc7341cf upstream.
Add Fibocom FG132 0x0112 composition:
T: Bus=03 Lev=02 Prnt=06 Port=01 Cnt=02 Dev#= 10 Spd=12 MxCh= 0 D: Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=2cb7 ProdID=0112 Rev= 5.15 S: Manufacturer=Fibocom Wireless Inc. S: Product=Fibocom Module S: SerialNumber=xxxxxxxx C:* #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=84(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=86(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
--- drivers/usb/serial/option.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/option.c +3 -0
@@ -2320,6 +2320,9 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(0x2cb7, 0x010b, 0xff, 0xff, 0x30) }, /* Fibocom FG150 Diag */ { USB_DEVICE_AND_INTERFACE_INFO(0x2cb7, 0x010b, 0xff, 0, 0) }, /* Fibocom FG150 AT */ { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0111, 0xff) }, /* Fibocom FM160 (MBIM mode) */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2cb7, 0x0112, 0xff, 0xff, 0x30) }, /* Fibocom FG132 Diag */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2cb7, 0x0112, 0xff, 0xff, 0x40) }, /* Fibocom FG132 AT */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2cb7, 0x0112, 0xff, 0, 0) }, /* Fibocom FG132 NMEA */ { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0115, 0xff), /* Fibocom FM135 (laptop MBIM) */ .driver_info = RSVD(5) }, { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x01a0, 0xff) }, /* Fibocom NL668-AM/NL652-EU (laptop MBIM) */
Greg Kroah-Hartman
maintainerPATCH 61/82 USB: serial: option: add Quectel RG650V
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benoît Monin <[email protected]>
commit 3b05949ba39f305b585452d0e177470607842165 upstream.
Add support for Quectel RG650V which is based on Qualcomm SDX65 chip. The composition is DIAG / NMEA / AT / AT / QMI.
T: Bus=02 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#= 4 Spd=5000 MxCh= 0 D: Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs= 1 P: Vendor=2c7c ProdID=0122 Rev=05.15 S: Manufacturer=Quectel S: Product=RG650V-EU S: SerialNumber=xxxxxxx C: #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=896mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=9ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=9ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan E: Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 8 Ivl=9ms
--- drivers/usb/serial/option.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/option.c +3 -0
@@ -251,6 +251,7 @@ static void option_instat_callback(struc#define QUECTEL_VENDOR_ID 0x2c7c/* These Quectel products use Quectel's vendor ID */ #define QUECTEL_PRODUCT_EC21 0x0121 +#define QUECTEL_PRODUCT_RG650V 0x0122#define QUECTEL_PRODUCT_EM061K_LTA 0x0123#define QUECTEL_PRODUCT_EM061K_LMS 0x0124#define QUECTEL_PRODUCT_EC25 0x0125
@@ -1273,6 +1274,8 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG912Y, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG916Q, 0xff, 0x00, 0x00) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500K, 0xff, 0x00, 0x00) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RG650V, 0xff, 0xff, 0x30) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RG650V, 0xff, 0, 0) }, { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
Greg Kroah-Hartman
maintainerPATCH 62/82 irqchip/gic-v3: Force propagation of the active state with a read-back
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
commit 464cb98f1c07298c4c10e714ae0c36338d18d316 upstream.
Christoffer reports that on some implementations, writing to GICR_ISACTIVER0 (and similar GICD registers) can race badly with a guest issuing a deactivation of that interrupt via the system register interface.
There are multiple reasons to this:
- this uses an early write-acknoledgement memory type (nGnRE), meaning that the write may only have made it as far as some interconnect by the time the store is considered "done"
- the GIC itself is allowed to buffer the write until it decides to take it into account (as long as it is in finite time)
The effects are that the activation may not have taken effect by the time the kernel enters the guest, forcing an immediate exit, or that a guest deactivation occurs before the interrupt is active, doing nothing.
In order to guarantee that the write to the ISACTIVER register has taken effect, read back from it, forcing the interconnect to propagate the write, and the GIC to process the write before returning the read.
--- drivers/irqchip/irq-gic-v3.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/irqchip/irq-gic-v3.c +7 -0
@@ -429,6 +429,13 @@ static int gic_irq_set_irqchip_state(str }gic_poke_irq (d, reg); + +/* +* Force read-back to guarantee that the active state has taken +* effect, and won't race with a guest-driven deactivation. +*/ +if (reg ==GICD_ISACTIVER ) +gic_peek_irq (d, reg);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 63/82 ocfs2: remove entry once instead of null-ptr-dereference in ocfs2_xa_remove()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Kanner <[email protected]>
commit 0b63c0e01fba40e3992bc627272ec7b618ccaef7 upstream.
Syzkaller is able to provoke null-ptr-dereference in ocfs2_xa_remove():
[ 57.319872] (a.out,1161,7):ocfs2_xa_remove:2028 ERROR: status = -12 [ 57.320420] (a.out,1161,7):ocfs2_xa_cleanup_value_truncate:1999 ERROR: Partial truncate while removing xattr overlay.upper. Leaking 1 clusters and removing the entry [ 57.321727] BUG: kernel NULL pointer dereference, address: 0000000000000004 [...] [ 57.325727] RIP: 0010:ocfs2_xa_block_wipe_namevalue+0x2a/0xc0 [...] [ 57.331328] Call Trace: [ 57.331477] <TASK> [...] [ 57.333511] ? do_user_addr_fault+0x3e5/0x740 [ 57.333778] ? exc_page_fault+0x70/0x170 [ 57.334016] ? asm_exc_page_fault+0x2b/0x30 [ 57.334263] ? __pfx_ocfs2_xa_block_wipe_namevalue+0x10/0x10 [ 57.334596] ? ocfs2_xa_block_wipe_namevalue+0x2a/0xc0 [ 57.334913] ocfs2_xa_remove_entry+0x23/0xc0 [ 57.335164] ocfs2_xa_set+0x704/0xcf0 [ 57.335381] ? _raw_spin_unlock+0x1a/0x40 [ 57.335620] ? ocfs2_inode_cache_unlock+0x16/0x20 [ 57.335915] ? trace_preempt_on+0x1e/0x70 [ 57.336153] ? start_this_handle+0x16c/0x500 [ 57.336410] ? preempt_count_sub+0x50/0x80 [ 57.336656] ? _raw_read_unlock+0x20/0x40 [ 57.336906] ? start_this_handle+0x16c/0x500 [ 57.337162] ocfs2_xattr_block_set+0xa6/0x1e0 [ 57.337424] __ocfs2_xattr_set_handle+0x1fd/0x5d0 [ 57.337706] ? ocfs2_start_trans+0x13d/0x290 [ 57.337971] ocfs2_xattr_set+0xb13/0xfb0 [ 57.338207] ? dput+0x46/0x1c0 [ 57.338393] ocfs2_xattr_trusted_set+0x28/0x30 [ 57.338665] ? ocfs2_xattr_trusted_set+0x28/0x30 [ 57.338948] __vfs_removexattr+0x92/0xc0 [ 57.339182] __vfs_removexattr_locked+0xd5/0x190 [ 57.339456] ? preempt_count_sub+0x50/0x80 [ 57.339705] vfs_removexattr+0x5f/0x100
[...]
Reproducer uses faultinject facility to fail ocfs2_xa_remove() -> ocfs2_xa_value_truncate() with -ENOMEM.
In this case the comment mentions that we can return 0 if ocfs2_xa_cleanup_value_truncate() is going to wipe the entry anyway. But the following 'rc' check is wrong and execution flow do 'ocfs2_xa_remove_entry(loc);' twice:
* 1st: in ocfs2_xa_cleanup_value_truncate();
* 2nd: returning back to ocfs2_xa_remove() instead of going to 'out'.
Fix this by skipping the 2nd removal of the same entry and making syzkaller repro happy.
--- fs/ocfs2/xattr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ocfs2/xattr.c +1 -2
@@ -2042,8 +2042,7 @@ static int ocfs2_xa_remove(struct ocfs2_ rc =0 ;ocfs2_xa_cleanup_value_truncate (loc,"removing" , orig_clusters); -if (rc) - goto out; + goto out; } }
Greg Kroah-Hartman
maintainerPATCH 64/82 ALSA: usb-audio: Support jack detection on Dell dock
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Schär <[email protected]>
[ Upstream commit 4b8ea38fabab45ad911a32a336416062553dfe9c ]
The Dell WD15 dock has a headset and a line out port. Add support for detecting if a jack is inserted into one of these ports. For the headset jack, additionally determine if a mic is present.
The WD15 contains an ALC4020 USB audio controller and ALC3263 audio codec from Realtek. It is a UAC 1 device, and UAC 1 does not support jack detection. Instead, jack detection works by sending HD Audio commands over vendor-type USB messages.
I found out how it works by looking at USB captures on Windows. The audio codec is very similar to the one supported by sound/soc/codecs/rt298.c / rt298.h, some constant names and the mic detection are adapted from there. The realtek_add_jack function is adapted from build_connector_control in sound/usb/mixer.c.
I tested this on a WD15 dock with the latest firmware.
Stable-dep-of: 4413665dd6c5 ("ALSA: usb-audio: Add quirks for Dell WD19 dock")
--- sound/usb/mixer_quirks.c | 167 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+)
sound/usb/mixer_quirks.c +167 -0
@@ -24,6 +24,7 @@#include <sound/asoundef.h> #include <sound/core.h> #include <sound/control.h> +#include <sound/hda_verbs.h> #include <sound/hwdep.h> #include <sound/info.h> #include <sound/tlv.h>
@@ -1793,6 +1794,169 @@ static int snd_soundblaster_e1_switch_create(struct usb_mixer_interface *mixer) NULL); } +/* +* Dell WD15 dock jack detection +* +* The WD15 contains an ALC4020 USB audio controller and ALC3263 audio codec +* from Realtek. It is a UAC 1 device, and UAC 1 does not support jack +* detection. Instead, jack detection works by sending HD Audio commands over +* vendor-type USB messages. +*/ + +#define HDA_VERB_CMD (V ,N ,D ) (((N) << 20) | ((V) << 8) | (D)) + +#define REALTEK_HDA_VALUE 0x0038 + +#define REALTEK_HDA_SET 62 +#define REALTEK_HDA_GET_OUT 88 +#define REALTEK_HDA_GET_IN 89 + +#define REALTEK_LINE1 0x1a +#define REALTEK_VENDOR_REGISTERS 0x20 +#define REALTEK_HP_OUT 0x21 + +#define REALTEK_CBJ_CTRL2 0x50 + +#define REALTEK_JACK_INTERRUPT_NODE 5 + +#define REALTEK_MIC_FLAG 0x100 + +static int realtek_hda_set (struct snd_usb_audio *chip,u32 cmd) +{ +struct usb_device *dev = chip->dev; +u32 buf =cpu_to_be32 (cmd); + +return snd_usb_ctl_msg (dev,usb_sndctrlpipe (dev,0 ),REALTEK_HDA_SET , +USB_RECIP_DEVICE |USB_TYPE_VENDOR |USB_DIR_OUT , +REALTEK_HDA_VALUE ,0 , &buf,sizeof (buf)); +} + +static int realtek_hda_get (struct snd_usb_audio *chip,u32 cmd,u32 *value) +{ +struct usb_device *dev = chip->dev; +int err; +u32 buf =cpu_to_be32 (cmd); + + err =snd_usb_ctl_msg (dev,usb_sndctrlpipe (dev,0 ),REALTEK_HDA_GET_OUT , +USB_RECIP_DEVICE |USB_TYPE_VENDOR |USB_DIR_OUT , +REALTEK_HDA_VALUE ,0 , &buf,sizeof (buf)); +if (err <0 ) +return err; + err =snd_usb_ctl_msg (dev,usb_rcvctrlpipe (dev,0 ),REALTEK_HDA_GET_IN , +USB_RECIP_DEVICE |USB_TYPE_VENDOR |USB_DIR_IN , +REALTEK_HDA_VALUE ,0 , &buf,sizeof (buf)); +if (err <0 ) +return err; + + *value =be32_to_cpu (buf); +return 0 ; +} + +static int realtek_ctl_connector_get (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ +struct usb_mixer_elem_info *cval = kcontrol->private_data; +struct snd_usb_audio *chip = cval->head.mixer->chip; +u32 pv = kcontrol->private_value; +u32 node_id = pv &0xff ; +u32 sense; +u32 cbj_ctrl2; +bool presence; +int err; + + err =snd_usb_lock_shutdown (chip); +if (err <0 ) +return err; + err =realtek_hda_get (chip, +HDA_VERB_CMD (AC_VERB_GET_PIN_SENSE , node_id,0 ), + &sense); +if (err <0 ) + goto err; +if (pv &REALTEK_MIC_FLAG ) { + err =realtek_hda_set (chip, +HDA_VERB_CMD (AC_VERB_SET_COEF_INDEX , +REALTEK_VENDOR_REGISTERS , +REALTEK_CBJ_CTRL2 )); +if (err <0 ) + goto err; + err =realtek_hda_get (chip, +HDA_VERB_CMD (AC_VERB_GET_PROC_COEF , +REALTEK_VENDOR_REGISTERS ,0 ), + &cbj_ctrl2); +if (err <0 ) + goto err; + } +err: +snd_usb_unlock_shutdown (chip); +if (err <0 ) +return err; + + presence = sense &AC_PINSENSE_PRESENCE ; +if (pv &REALTEK_MIC_FLAG ) + presence = presence && (cbj_ctrl2 &0x0070 ) ==0x0070 ; + ucontrol->value.integer.value[0 ] = presence; +return 0 ; +} + +static const struct snd_kcontrol_new realtek_connector_ctl_ro = { + .iface =SNDRV_CTL_ELEM_IFACE_CARD , + .name ="" ,/* will be filled later manually */ + .access =SNDRV_CTL_ELEM_ACCESS_READ , + .info = snd_ctl_boolean_mono_info, + .get = realtek_ctl_connector_get, +}; + +static int realtek_resume_jack (struct usb_mixer_elem_list *list) +{ +snd_ctl_notify (list->mixer->chip->card,SNDRV_CTL_EVENT_MASK_VALUE , + &list->kctl->id); +return 0 ; +} + +static int realtek_add_jack (struct usb_mixer_interface *mixer, +char *name,u32 val) +{ +struct usb_mixer_elem_info *cval; +struct snd_kcontrol *kctl; + + cval =kzalloc (sizeof (*cval),GFP_KERNEL ); +if (!cval) +return -ENOMEM ; +snd_usb_mixer_elem_init_std (&cval->head, mixer, +REALTEK_JACK_INTERRUPT_NODE ); + cval->head.resume = realtek_resume_jack; + cval->val_type =USB_MIXER_BOOLEAN ; + cval->channels =1 ; + cval->min =0 ; + cval->max =1 ; + kctl =snd_ctl_new1 (&realtek_connector_ctl_ro, cval); +if (!kctl) { +kfree (cval); +return -ENOMEM ; + } + kctl->private_value = val; +strscpy (kctl->id.name, name,sizeof (kctl->id.name)); + kctl->private_free = snd_usb_mixer_elem_free; +return snd_usb_mixer_add_control (&cval->head, kctl); +} + +static int dell_dock_mixer_create (struct usb_mixer_interface *mixer) +{ +int err; + + err =realtek_add_jack (mixer,"Line Out Jack" ,REALTEK_LINE1 ); +if (err <0 ) +return err; + err =realtek_add_jack (mixer,"Headphone Jack" ,REALTEK_HP_OUT ); +if (err <0 ) +return err; + err =realtek_add_jack (mixer,"Headset Mic Jack" , +REALTEK_HP_OUT |REALTEK_MIC_FLAG ); +if (err <0 ) +return err; +return 0 ; +} +static void dell_dock_init_vol (struct snd_usb_audio *chip,int ch,int id) {u16 buf =0 ;
@@ -3024,6 +3188,9 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) err =snd_soundblaster_e1_switch_create (mixer);break ;case USB_ID (0x0bda ,0x4014 ):/* Dell WD15 dock */ + err =dell_dock_mixer_create (mixer); +if (err <0 ) +break ; err =dell_dock_mixer_init (mixer);break ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 65/82 ALSA: usb-audio: Add quirks for Dell WD19 dock
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Schär <[email protected]>
[ Upstream commit 4413665dd6c528b31284119e3571c25f371e1c36 ]
The WD19 family of docks has the same audio chipset as the WD15. This change enables jack detection on the WD19.
We don't need the dell_dock_mixer_init quirk for the WD19. It is only needed because of the dell_alc4020_map quirk for the WD15 in mixer_maps.c, which disables the volume controls. Even for the WD15, this quirk was apparently only needed when the dock firmware was not updated.
--- sound/usb/mixer_quirks.c | 3 +++ 1 file changed, 3 insertions(+)
sound/usb/mixer_quirks.c +3 -0
@@ -3193,6 +3193,9 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)break ; err =dell_dock_mixer_init (mixer);break ; +case USB_ID (0x0bda ,0x402e ):/* Dell WD19 dock */ + err =dell_dock_mixer_create (mixer); +break ;case USB_ID (0x2a39 ,0x3fd2 ):/* RME ADI-2 Pro */ case USB_ID (0x2a39 ,0x3fd3 ):/* RME ADI-2 DAC */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 66/82 hv_sock: Initializing vsk->trans to NULL to prevent a dangling pointer
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hyunwoo Kim <[email protected]>
commit e629295bd60abf4da1db85b82819ca6a4f6c1e79 upstream.
When hvs is released, there is a possibility that vsk->trans may not be initialized to NULL, which could lead to a dangling pointer. This issue is resolved by initializing vsk->trans to NULL.
--- net/vmw_vsock/hyperv_transport.c | 1 + 1 file changed, 1 insertion(+)
net/vmw_vsock/hyperv_transport.c +1 -0
@@ -538,6 +538,7 @@ static void hvs_destruct(struct vsock_sovmbus_hvsock_device_unregister (chan);kfree (hvs); + vsk->trans =NULL ; }static int hvs_dgram_bind (struct vsock_sock *vsk,struct sockaddr_vm *addr)
Greg Kroah-Hartman
maintainerPATCH 67/82 vsock/virtio: Initialization of the dangling pointer occurring in vsk->trans
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hyunwoo Kim <[email protected]>
commit 6ca575374dd9a507cdd16dfa0e78c2e9e20bd05f upstream.
During loopback communication, a dangling pointer can be created in vsk->trans, potentially leading to a Use-After-Free condition. This issue is resolved by initializing vsk->trans to NULL.
Message-Id: <2024102245-strive-crib-c8d3@gregkh>
--- net/vmw_vsock/virtio_transport_common.c | 1 + 1 file changed, 1 insertion(+)
net/vmw_vsock/virtio_transport_common.c +1 -0
@@ -687,6 +687,7 @@ void virtio_transport_destruct(struct vsstruct virtio_vsock_sock *vvs = vsk->trans;kfree (vvs); + vsk->trans =NULL ; }EXPORT_SYMBOL_GPL (virtio_transport_destruct);
Greg Kroah-Hartman
maintainerPATCH 68/82 ALSA: usb-audio: Add endianness annotations
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Schär <[email protected]>
commit 61c606a43b6c74556e35acc645c7a1b6a67c2af9 upstream.
--- sound/usb/mixer_quirks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/usb/mixer_quirks.c +2 -2
@@ -1824,7 +1824,7 @@ static int snd_soundblaster_e1_switch_crstatic int realtek_hda_set (struct snd_usb_audio *chip,u32 cmd) {struct usb_device *dev = chip->dev; -u32 buf =cpu_to_be32 (cmd); +__be32 buf =cpu_to_be32 (cmd); return snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), REALTEK_HDA_SET, USB_RECIP_DEVICE | USB_TYPE_VENDOR | USB_DIR_OUT,
@@ -1835,7 +1835,7 @@ static int realtek_hda_get(struct snd_us {struct usb_device *dev = chip->dev;int err; -u32 buf =cpu_to_be32 (cmd); +__be32 buf =cpu_to_be32 (cmd); err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), REALTEK_HDA_GET_OUT, USB_RECIP_DEVICE | USB_TYPE_VENDOR | USB_DIR_OUT,
Greg Kroah-Hartman
maintainerPATCH 69/82 net: phy: ti: take into account all possible interrupt sources
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ioana Ciornei <[email protected]>
commit 73f476aa1975bae6a792b340f5b26ffcfba869a6 upstream.
The previous implementation of .handle_interrupt() did not take into account the fact that all the interrupt status registers should be acknowledged since multiple interrupt sources could be asserted.
Fix this by reading all the status registers before exiting with IRQ_NONE or triggering the PHY state machine.
--- drivers/net/phy/dp83822.c | 9 +++++---- drivers/net/phy/dp83tc811.c | 11 ++++++----- 2 files changed, 11 insertions(+), 9 deletions(-)
drivers/net/phy/dp83822.c +5 -4
@@ -305,6 +305,7 @@ static int dp83822_config_intr(struct phstatic irqreturn_t dp83822_handle_interrupt (struct phy_device *phydev) { +bool trigger_machine = false;int irq_status;/* The MISR1 and MISR2 registers are holding the interrupt status in
@@ -320,7 +321,7 @@ static irqreturn_t dp83822_handle_interrreturn IRQ_NONE ; }if (irq_status & ((irq_status &GENMASK (7 ,0 )) <<8 )) - goto trigger_machine; + trigger_machine = true; irq_status =phy_read (phydev,MII_DP83822_MISR2 );if (irq_status <0 ) {
@@ -328,11 +329,11 @@ static irqreturn_t dp83822_handle_interrreturn IRQ_NONE ; }if (irq_status & ((irq_status &GENMASK (7 ,0 )) <<8 )) - goto trigger_machine; + trigger_machine = true; -return IRQ_NONE ; +if (!trigger_machine) +return IRQ_NONE ; -trigger_machine:phy_trigger_machine (phydev);return IRQ_HANDLED ;
drivers/net/phy/dp83tc811.c +6 -5
@@ -256,6 +256,7 @@ static int dp83811_config_intr(struct phstatic irqreturn_t dp83811_handle_interrupt (struct phy_device *phydev) { +bool trigger_machine = false;int irq_status;/* The INT_STAT registers 1, 2 and 3 are holding the interrupt status
@@ -271,7 +272,7 @@ static irqreturn_t dp83811_handle_interrreturn IRQ_NONE ; }if (irq_status & ((irq_status &GENMASK (7 ,0 )) <<8 )) - goto trigger_machine; + trigger_machine = true; irq_status =phy_read (phydev,MII_DP83811_INT_STAT2 );if (irq_status <0 ) {
@@ -279,7 +280,7 @@ static irqreturn_t dp83811_handle_interrreturn IRQ_NONE ; }if (irq_status & ((irq_status &GENMASK (7 ,0 )) <<8 )) - goto trigger_machine; + trigger_machine = true; irq_status =phy_read (phydev,MII_DP83811_INT_STAT3 );if (irq_status <0 ) {
@@ -287,11 +288,11 @@ static irqreturn_t dp83811_handle_interrreturn IRQ_NONE ; }if (irq_status & ((irq_status &GENMASK (7 ,0 )) <<8 )) - goto trigger_machine; + trigger_machine = true; -return IRQ_NONE ; +if (!trigger_machine) +return IRQ_NONE ; -trigger_machine:phy_trigger_machine (phydev);return IRQ_HANDLED ;
Greg Kroah-Hartman
maintainerPATCH 70/82 9p: Avoid creating multiple slab caches with the same name
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pedro Falcato <[email protected]>
[ Upstream commit 79efebae4afc2221fa814c3cae001bede66ab259 ]
In the spirit of [1], avoid creating multiple slab caches with the same name. Instead, add the dev_name into the mix.
[1]: https://lore.kernel.org/all/[email protected]/
Message-ID: <[email protected]>
--- net/9p/client.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
net/9p/client.c +9 -1
@@ -1006,6 +1006,7 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)int err;struct p9_client *clnt;char *client_id; +char *cache_name; err =0 ; clnt =kmalloc (sizeof (struct p9_client ),GFP_KERNEL );
@@ -1058,15 +1059,22 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)if (err) goto close_trans; + cache_name =kasprintf (GFP_KERNEL ,"9p-fcall-cache-%s" , dev_name); +if (!cache_name) { + err = -ENOMEM ; + goto close_trans; + } +/* P9_HDRSZ + 4 is the smallest packet header we can have that is * followed by data accessed from userspace by read */ clnt->fcall_cache = -kmem_cache_create_usercopy ("9p-fcall-cache" , clnt->msize, +kmem_cache_create_usercopy (cache_name, clnt->msize,0 ,0 ,P9_HDRSZ +4 , clnt->msize - (P9_HDRSZ +4 ),NULL ); +kfree (cache_name);return clnt; close_trans:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 71/82 HID: multitouch: Add quirk for HONOR MagicBook Art 14 touchpad
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: WangYuli <[email protected]>
[ Upstream commit 7a5ab8071114344f62a8b1e64ed3452a77257d76 ]
The behavior of HONOR MagicBook Art 14 touchpad is not consistent after reboots, as sometimes it reports itself as a touchpad, and sometimes as a mouse.
Similarly to GLO-GXXX it is possible to call MT_QUIRK_FORCE_GET_FEATURE as a workaround to force set feature in mt_set_input_mode() for such special touchpad device.
--- drivers/hid/hid-multitouch.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hid/hid-multitouch.c +5 -0
@@ -1967,6 +1967,11 @@ static const struct hid_device_id mt_devices[] = { HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, 0x347d, 0x7853) }, +/* HONOR MagicBook Art 14 touchpad */ + { .driver_data = MT_CLS_VTL, +HID_DEVICE (BUS_I2C ,HID_GROUP_MULTITOUCH_WIN_8 , + 0x35cc, 0x0104) }, + /* Ilitek dual touch panel */ { .driver_data = MT_CLS_NSMU, MT_USB_DEVICE(USB_VENDOR_ID_ILITEK,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 72/82 bpf: use kvzmalloc to allocate BPF verifier environment
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rik van Riel <[email protected]>
[ Upstream commit 434247637c66e1be2bc71a9987d4c3f0d8672387 ]
The kzmalloc call in bpf_check can fail when memory is very fragmented, which in turn can lead to an OOM kill.
Use kvzmalloc to fall back to vmalloc when memory is too fragmented to allocate an order 3 sized bpf verifier environment.
Admittedly this is not a very common case, and only happens on systems where memory has already been squeezed close to the limit, but this does not seem like much of a hot path, and it's a simple enough fix.
--- kernel/bpf/verifier.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/bpf/verifier.c +2 -2
@@ -12564,7 +12564,7 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr,/* 'struct bpf_verifier_env' can be global, but since it's not small, * allocate/free it every time bpf_check() is called */ - env =kzalloc (sizeof (struct bpf_verifier_env ),GFP_KERNEL ); + env =kvzalloc (sizeof (struct bpf_verifier_env ),GFP_KERNEL );if (!env)return -ENOMEM ; log = &env->log;
@@ -12755,6 +12755,6 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr,mutex_unlock (&bpf_verifier_lock);vfree (env->insn_aux_data); err_free_env: -kfree (env); +kvfree (env);return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 73/82 crypto: marvell/cesa - Disable hash algorithms
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 e845d2399a00f866f287e0cefbd4fc7d8ef0d2f7 ]
Disable cesa hash algorithms by lowering the priority because they appear to be broken when invoked in parallel. This allows them to still be tested for debugging purposes.
--- drivers/crypto/marvell/cesa/hash.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/crypto/marvell/cesa/hash.c +6 -6
@@ -923,7 +923,7 @@ struct ahash_alg mv_md5_alg = { .base = { .cra_name = "md5", .cra_driver_name = "mv-md5", - .cra_priority = 300, + .cra_priority = 0, .cra_flags =CRYPTO_ALG_ASYNC |CRYPTO_ALG_ALLOCATES_MEMORY | CRYPTO_ALG_KERN_DRIVER_ONLY,
@@ -994,7 +994,7 @@ struct ahash_alg mv_sha1_alg = { .base = { .cra_name = "sha1", .cra_driver_name = "mv-sha1", - .cra_priority = 300, + .cra_priority = 0, .cra_flags =CRYPTO_ALG_ASYNC |CRYPTO_ALG_ALLOCATES_MEMORY | CRYPTO_ALG_KERN_DRIVER_ONLY,
@@ -1068,7 +1068,7 @@ struct ahash_alg mv_sha256_alg = { .base = { .cra_name = "sha256", .cra_driver_name = "mv-sha256", - .cra_priority = 300, + .cra_priority = 0, .cra_flags =CRYPTO_ALG_ASYNC |CRYPTO_ALG_ALLOCATES_MEMORY | CRYPTO_ALG_KERN_DRIVER_ONLY,
@@ -1303,7 +1303,7 @@ struct ahash_alg mv_ahmac_md5_alg = { .base = { .cra_name = "hmac(md5)", .cra_driver_name = "mv-hmac-md5", - .cra_priority = 300, + .cra_priority = 0, .cra_flags =CRYPTO_ALG_ASYNC |CRYPTO_ALG_ALLOCATES_MEMORY | CRYPTO_ALG_KERN_DRIVER_ONLY,
@@ -1374,7 +1374,7 @@ struct ahash_alg mv_ahmac_sha1_alg = { .base = { .cra_name = "hmac(sha1)", .cra_driver_name = "mv-hmac-sha1", - .cra_priority = 300, + .cra_priority = 0, .cra_flags =CRYPTO_ALG_ASYNC |CRYPTO_ALG_ALLOCATES_MEMORY | CRYPTO_ALG_KERN_DRIVER_ONLY,
@@ -1445,7 +1445,7 @@ struct ahash_alg mv_ahmac_sha256_alg = { .base = { .cra_name = "hmac(sha256)", .cra_driver_name = "mv-hmac-sha256", - .cra_priority = 300, + .cra_priority = 0, .cra_flags =CRYPTO_ALG_ASYNC |CRYPTO_ALG_ALLOCATES_MEMORY | CRYPTO_ALG_KERN_DRIVER_ONLY,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 74/82 sound: Make CONFIG_SND depend on INDIRECT_IOMEM instead of UML
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Vetter <[email protected]>
[ Upstream commit ad6639f143a0b42d7fb110ad14f5949f7c218890 ]
When building for the UM arch and neither INDIRECT_IOMEM=y, nor HAS_IOMEM=y is selected, it will fall back to the implementations from asm-generic/io.h for IO memcpy. But these fall-back functions just do a memcpy. So, instead of depending on UML, add dependency on 'HAS_IOMEM || INDIRECT_IOMEM'.
--- sound/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only menuconfig SOUND tristate "Sound card support" - depends on HAS_IOMEM || UML + depends on HAS_IOMEM || INDIRECT_IOMEM help If you have a sound card in your computer, i.e. if it can say more than an occasional beep, say Y.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 75/82 powerpc/powernv: Free name on error in opal_event_init()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit cf8989d20d64ad702a6210c11a0347ebf3852aa7 ]
In opal_event_init() if request_irq() fails name is not freed, leading to a memory leak. The code only runs at boot time, there's no way for a user to trigger it, so there's no security impact.
Fix the leak by freeing name in the error path.
--- arch/powerpc/platforms/powernv/opal-irqchip.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/powernv/opal-irqchip.c +1 -0
@@ -285,6 +285,7 @@ int __init opal_event_init(void) name, NULL);if (rc) {pr_warn ("Error %d requesting OPAL irq %d\n" , rc, (int )r->start); +kfree (name);continue ; } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 76/82 vDPA/ifcvf: Fix pci_read_config_byte() return code handling
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Can <[email protected]>
[ Upstream commit 7f8825b2a78ac392d3fbb3a2e65e56d9e39d75e9 ]
ifcvf_init_hw() uses pci_read_config_byte() that returns PCIBIOS_* codes. The error handling, however, assumes the codes are normal errnos because it checks for < 0.
Convert the error check to plain non-zero check.
Message-Id: <[email protected]>
--- drivers/vdpa/ifcvf/ifcvf_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vdpa/ifcvf/ifcvf_base.c +1 -1
@@ -105,7 +105,7 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, struct pci_dev *pdev)u32 i; ret =pci_read_config_byte (pdev,PCI_CAPABILITY_LIST , &pos); -if (ret <0 ) { +if (ret) {IFCVF_ERR (pdev,"Failed to read PCI capability list\n" );return -EIO ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 77/82 fs: Fix uninitialized value issue in from_kuid and from_kgid
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alessandro Zanni <[email protected]>
[ Upstream commit 15f34347481648a567db67fb473c23befb796af5 ]
ocfs2_setattr() uses attr->ia_mode, attr->ia_uid and attr->ia_gid in a trace point even though ATTR_MODE, ATTR_UID and ATTR_GID aren't set.
Initialize all fields of newattrs to avoid uninitialized variables, by checking if ATTR_MODE, ATTR_UID, ATTR_GID are initialized, otherwise 0.
--- fs/ocfs2/file.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
fs/ocfs2/file.c +6 -3
@@ -1133,9 +1133,12 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)trace_ocfs2_setattr (inode, dentry, (unsigned long long )OCFS2_I (inode)->ip_blkno, dentry->d_name.len, dentry->d_name.name, - attr->ia_valid, attr->ia_mode, -from_kuid (&init_user_ns, attr->ia_uid), -from_kgid (&init_user_ns, attr->ia_gid)); + attr->ia_valid, + attr->ia_valid &ATTR_MODE ? attr->ia_mode :0 , + attr->ia_valid &ATTR_UID ? +from_kuid (&init_user_ns, attr->ia_uid) :0 , + attr->ia_valid &ATTR_GID ? +from_kgid (&init_user_ns, attr->ia_gid) :0 );/* ensuring we don't even attempt to truncate a symlink */ if (S_ISLNK (inode->i_mode))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 78/82 net: usb: qmi_wwan: add Fibocom FG132 0x0112 composition
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Reinhard Speyerer <[email protected]>
[ Upstream commit 64761c980cbf71fb7a532a8c7299907ea972a88c ]
Add Fibocom FG132 0x0112 composition:
T: Bus=03 Lev=02 Prnt=06 Port=01 Cnt=02 Dev#= 10 Spd=12 MxCh= 0 D: Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=2cb7 ProdID=0112 Rev= 5.15 S: Manufacturer=Fibocom Wireless Inc. S: Product=Fibocom Module S: SerialNumber=xxxxxxxx C:* #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=84(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=86(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -1360,6 +1360,7 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x2c7c, 0x0296, 4)}, /* Quectel BG96 */ {QMI_QUIRK_SET_DTR(0x2c7c, 0x030e, 4)}, /* Quectel EM05GV2 */ {QMI_QUIRK_SET_DTR(0x2cb7, 0x0104, 4)}, /* Fibocom NL678 series */ + {QMI_QUIRK_SET_DTR(0x2cb7, 0x0112, 0)}, /* Fibocom FG132 */ {QMI_FIXED_INTF(0x0489, 0xe0b4, 0)}, /* Foxconn T77W968 LTE */ {QMI_FIXED_INTF(0x0489, 0xe0b5, 0)}, /* Foxconn T77W968 LTE with eSIM support*/ {QMI_FIXED_INTF(0x2692, 0x9025, 4)}, /* Cellient MPL200 (rebranded Qualcomm 05c6:9025) */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 79/82 md/raid10: improve code of mrdev in raid10_sync_request
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Nan <[email protected]>
commit 59f8f0b54c8ffb4521f6bbd1cb6f4dfa5022e75e upstream.
'need_recover' and 'mrdev' are equivalent in raid10_sync_request(), and inc mrdev->nr_pending is unreasonable if don't need recovery. Replace 'need_recover' with 'mrdev', and only inc nr_pending when needed.
--- drivers/md/raid10.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
drivers/md/raid10.c +12 -11
@@ -3052,7 +3052,6 @@ static sector_t raid10_sync_request(strusector_t sect;int must_sync;int any_working; -int need_recover =0 ;struct raid10_info *mirror = &conf->mirrors[i];struct md_rdev *mrdev, *mreplace;
@@ -3060,14 +3059,13 @@ static sector_t raid10_sync_request(stru mrdev =rcu_dereference (mirror->rdev); mreplace =rcu_dereference (mirror->replacement); -if (mrdev !=NULL && - !test_bit (Faulty, &mrdev->flags) && - !test_bit (In_sync, &mrdev->flags)) - need_recover =1 ; +if (mrdev && (test_bit (Faulty, &mrdev->flags) || +test_bit (In_sync, &mrdev->flags))) + mrdev =NULL ;if (mreplace &&test_bit (Faulty, &mreplace->flags)) mreplace =NULL ; -if (!need_recover && !mreplace) { +if (!mrdev && !mreplace) {rcu_read_unlock ();continue ; }
@@ -3101,7 +3099,8 @@ static sector_t raid10_sync_request(strurcu_read_unlock ();continue ; } -atomic_inc (&mrdev->nr_pending); +if (mrdev) +atomic_inc (&mrdev->nr_pending);if (mreplace)atomic_inc (&mreplace->nr_pending);rcu_read_unlock ();
@@ -3188,7 +3187,7 @@ static sector_t raid10_sync_request(stru r10_bio->devs[1 ].devnum = i; r10_bio->devs[1 ].addr = to_addr; -if (need_recover) { +if (mrdev) { bio = r10_bio->devs[1 ].bio; bio->bi_next = biolist; biolist = bio;
@@ -3233,7 +3232,7 @@ static sector_t raid10_sync_request(strufor (k =0 ; k < conf->copies; k++)if (r10_bio->devs[k].devnum == i)break ; -if (!test_bit (In_sync, +if (mrdev && !test_bit (In_sync, &mrdev->flags) && !rdev_set_badblocks( mrdev,
@@ -3259,12 +3258,14 @@ static sector_t raid10_sync_request(struif (rb2)atomic_dec (&rb2->remaining); r10_bio = rb2; -rdev_dec_pending (mrdev, mddev); +if (mrdev) +rdev_dec_pending (mrdev, mddev);if (mreplace)rdev_dec_pending (mreplace, mddev);break ; } -rdev_dec_pending (mrdev, mddev); +if (mrdev) +rdev_dec_pending (mrdev, mddev);if (mreplace)rdev_dec_pending (mreplace, mddev);if (r10_bio->devs[0 ].bio->bi_opf &MD_FAILFAST ) {
Greg Kroah-Hartman
maintainerPATCH 80/82 io_uring: fix possible deadlock in io_register_iowq_max_workers()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hagar Hemdan <[email protected]>
commit 73254a297c2dd094abec7c9efee32455ae875bdf upstream.
The io_register_iowq_max_workers() function calls io_put_sq_data(), which acquires the sqd->lock without releasing the uring_lock. Similar to the commit 009ad9f0c6ee ("io_uring: drop ctx->uring_lock before acquiring sqd->lock"), this can lead to a potential deadlock situation.
To resolve this issue, the uring_lock is released before calling io_put_sq_data(), and then it is re-acquired after the function call.
This change ensures that the locks are acquired in the correct order, preventing the possibility of a deadlock.
--- io_uring/io_uring.c | 5 +++++ 1 file changed, 5 insertions(+)
io_uring/io_uring.c +5 -0
@@ -10653,8 +10653,10 @@ static int io_register_iowq_max_workers( }if (sqd) { +mutex_unlock (&ctx->uring_lock);mutex_unlock (&sqd->lock);io_put_sq_data (sqd); +mutex_lock (&ctx->uring_lock); }if (copy_to_user (arg, new_count,sizeof (new_count)))
@@ -10679,8 +10681,11 @@ static int io_register_iowq_max_workers(return 0 ; err:if (sqd) { +mutex_unlock (&ctx->uring_lock);mutex_unlock (&sqd->lock);io_put_sq_data (sqd); +mutex_lock (&ctx->uring_lock); + }return ret; }
Greg Kroah-Hartman
maintainerPATCH 81/82 mm: krealloc: Fix MTE false alarm in __do_krealloc
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qun-Wei Lin <[email protected]>
commit 704573851b51808b45dae2d62059d1d8189138a2 upstream.
This patch addresses an issue introduced by commit 1a83a716ec233 ("mm:
krealloc: consider spare memory for __GFP_ZERO") which causes MTE (Memory Tagging Extension) to falsely report a slab-out-of-bounds error.
The problem occurs when zeroing out spare memory in __do_krealloc. The original code only considered software-based KASAN and did not account for MTE. It does not reset the KASAN tag before calling memset, leading to a mismatch between the pointer tag and the memory tag, resulting in a false positive.
Example of the error:
==================================================================
swapper/0: BUG: KASAN: slab-out-of-bounds in __memset+0x84/0x188 swapper/0: Write at addr f4ffff8005f0fdf0 by task swapper/0/1 swapper/0: Pointer tag: [f4], memory tag: [fe] swapper/0:
swapper/0: CPU: 4 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12. swapper/0: Hardware name: MT6991(ENG) (DT) swapper/0: Call trace: swapper/0: dump_backtrace+0xfc/0x17c swapper/0: show_stack+0x18/0x28 swapper/0: dump_stack_lvl+0x40/0xa0 swapper/0: print_report+0x1b8/0x71c swapper/0: kasan_report+0xec/0x14c swapper/0: __do_kernel_fault+0x60/0x29c swapper/0: do_bad_area+0x30/0xdc swapper/0: do_tag_check_fault+0x20/0x34 swapper/0: do_mem_abort+0x58/0x104 swapper/0: el1_abort+0x3c/0x5c swapper/0: el1h_64_sync_handler+0x80/0xcc swapper/0: el1h_64_sync+0x68/0x6c swapper/0: __memset+0x84/0x188 swapper/0: btf_populate_kfunc_set+0x280/0x3d8 swapper/0: __register_btf_kfunc_id_set+0x43c/0x468 swapper/0: register_btf_kfunc_id_set+0x48/0x60 swapper/0: register_nf_nat_bpf+0x1c/0x40 swapper/0: nf_nat_init+0xc0/0x128 swapper/0: do_one_initcall+0x184/0x464 swapper/0: do_initcall_level+0xdc/0x1b0 swapper/0: do_initcalls+0x70/0xc0 swapper/0: do_basic_setup+0x1c/0x28 swapper/0: kernel_init_freeable+0x144/0x1b8 swapper/0: kernel_init+0x20/0x1a8 swapper/0: ret_from_fork+0x10/0x20
==================================================================
--- mm/slab_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/slab_common.c +1 -1
@@ -1075,7 +1075,7 @@ static __always_inline void *__do_kreall/* Zero out spare memory. */ if (want_init_on_alloc (flags)) {kasan_disable_current (); -memset ((void *)p + new_size,0 , ks - new_size); +memset (kasan_reset_tag (p) + new_size,0 , ks - new_size);kasan_enable_current (); }
Greg Kroah-Hartman
maintainerPATCH 82/82 9p: fix slab cache name creation for real
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit a360f311f57a36e96d88fa8086b749159714dcd2 upstream.
This was attempted by using the dev_name in the slab cache name, but as Omar Sandoval pointed out, that can be an arbitrary string, eg something like "/dev/root". Which in turn trips verify_dirent_name(), which fails if a filename contains a slash.
So just make it use a sequence counter, and make it an atomic_t to avoid any possible races or locking issues.
--- net/9p/client.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/9p/client.c +3 -1
@@ -1004,6 +1004,7 @@ error:struct p9_client *p9_client_create (const char *dev_name,char *options) {int err; +static atomic_t seqno =ATOMIC_INIT (0 );struct p9_client *clnt;char *client_id;char *cache_name;
@@ -1059,7 +1060,8 @@ struct p9_client *p9_client_create(constif (err) goto close_trans; - cache_name =kasprintf (GFP_KERNEL ,"9p-fcall-cache-%s" , dev_name); + cache_name =kasprintf (GFP_KERNEL , +"9p-fcall-cache-%u" ,atomic_inc_return (&seqno));if (!cache_name) { err = -ENOMEM ; goto close_trans;
Greg Kroah-Hartman wrote on Fri, Nov 15, 2024 at 07:37:37AM +0100:
Quoted 5 lines
This is the start of the stable review cycle for the 5.10.230 release. There are 82 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Responses should be made by Sun, 17 Nov 2024 06:37:07 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.230-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.
Tested d7359abfa20d ("Linux 5.10.230-rc1") on:
- arm i.MX6ULL (Armadillo 640)
- arm64 i.MX8MP (Armadillo G4)
No obvious regression in dmesg or basic tests:
Signature · 1 line
Dominique Martinet
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.230 release. There are 82 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun, 17 Nov 2024 06:37:07 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.230-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.10:
10 builds: 10 pass, 0 fail
26 boots: 26 pass, 0 fail
67 tests: 67 pass, 0 failLinux version: 5.10.230-rc1-gd7359abfa20d
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.230 release. There are 82 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun, 17 Nov 2024 06:37:07 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.230-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested with BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.230 release. There are 82 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.230 release. There are 82 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun, 17 Nov 2024 06:37:07 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.230-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 5.10.230-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git commit: d7359abfa20de2d21fb8189353e5c82b34ecc0e8
* git describe: v5.10.229-83-gd7359abfa20d
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.10.y/build/v5.10.229-83-gd7359abfa20d
## Test Regressions (compared to v5.10.227-164-g5d5f7338c1ba)
## Metric Regressions (compared to v5.10.227-164-g5d5f7338c1ba)
## Test Fixes (compared to v5.10.227-164-g5d5f7338c1ba)
## Metric Fixes (compared to v5.10.227-164-g5d5f7338c1ba)
## Test result summary
total: 63187, pass: 46635, fail: 2066, skip: 14420, xfail: 66
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 101 total, 101 passed, 0 failed
* arm64: 28 total, 28 passed, 0 failed
* i386: 22 total, 22 passed, 0 failed
* mips: 22 total, 22 passed, 0 failed
* parisc: 3 total, 0 passed, 3 failed
* powerpc: 21 total, 21 passed, 0 failed
* riscv: 9 total, 9 passed, 0 failed
* s390: 9 total, 9 passed, 0 failed
* sh: 10 total, 10 passed, 0 failed
* sparc: 6 total, 6 passed, 0 failed
* x86_64: 24 total, 24 passed, 0 failed
## Test suites summary
* boot
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-efivarfs
* kselftest-exec
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-filesystems-epoll
* kselftest-firmware
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-kcmp
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-mincore
* kselftest-mqueue
* kselftest-net
* kselftest-net-mptcp
* kselftest-openat2
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-sigaltstack
* kselftest-size
* kselftest-tc-testing
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user_events
* kselftest-vDSO
* kselftest-watchdog
* kselftest-x86
* kunit
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-test
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-hugetlb
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* perf
* rcutorture
--
Linaro LKFT
https://lkft.linaro.org
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 5.10.230 release. There are 82 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-5.10.y
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany