5.10.114-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainercover 5.10.114-rc1 review
This is the start of the stable review cycle for the 5.10.114 release. There are 129 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 Fri, 06 May 2022 15:25:19 +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.114-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.114-rc1
Namhyung Kim <[email protected]>
perf symbol: Remove arch__symbols__fixup_end()
Daniel Starke <[email protected]>
tty: n_gsm: fix software flow control handling
Daniel Starke <[email protected]>
tty: n_gsm: fix incorrect UA handling
Daniel Starke <[email protected]>
tty: n_gsm: fix reset fifo race condition
Daniel Starke <[email protected]>
tty: n_gsm: fix wrong command frame length field encoding
Daniel Starke <[email protected]>
tty: n_gsm: fix wrong command retry handling
Daniel Starke <[email protected]>
tty: n_gsm: fix missing explicit ldisc flush
Daniel Starke <[email protected]>
tty: n_gsm: fix wrong DLCI release order
Daniel Starke <[email protected]>
tty: n_gsm: fix insufficient txframe size
Florian Westphal <[email protected]>
netfilter: nft_socket: only do sk lookups when indev is available
Daniel Starke <[email protected]>
tty: n_gsm: fix malformed counter for out of frame data
Daniel Starke <[email protected]>
tty: n_gsm: fix wrong signal octet encoding in convergence layer type 2
Daniel Starke <[email protected]>
tty: n_gsm: fix mux cleanup after unregister tty device
Daniel Starke <[email protected]>
tty: n_gsm: fix decoupled mux resource
Daniel Starke <[email protected]>
tty: n_gsm: fix restart handling via CLD command
Namhyung Kim <[email protected]>
perf symbol: Update symbols__fixup_end()
Namhyung Kim <[email protected]>
perf symbol: Pass is_kallsyms to symbols__fixup_end()
Borislav Petkov <[email protected]>
x86/cpu: Load microcode during restore_processor_state()
Kees Cook <[email protected]>
thermal: int340x: Fix attr.show callback prototype
Dinh Nguyen <[email protected]>
net: ethernet: stmmac: fix write to sgmii_adapter_base
Imre Deak <[email protected]>
drm/i915: Fix SEL_FETCH_PLANE_*(PIPE_B+) register addresses
Zqiang <[email protected]>
kasan: prevent cpu_quarantine corruption when CPU offline and cache shrink occur at same time
Damien Le Moal <[email protected]>
zonefs: Clear inode information flags on inode creation
Damien Le Moal <[email protected]>
zonefs: Fix management of open zones
Alexey Kardashevskiy <[email protected]>
powerpc/perf: Fix 32bit compile
Duoming Zhou <[email protected]>
drivers: net: hippi: Fix deadlock in rr_close()
Ronnie Sahlberg <[email protected]>
cifs: destage any unwritten data to the server before calling copychunk_write
Mikulas Patocka <[email protected]>
x86: __memcpy_flushcache: fix wrong alignment if size > 2^32
Ye Bin <[email protected]>
ext4: fix bug_on in start_this_handle during umount filesystem
Zheyu Ma <[email protected]>
ASoC: wm8731: Disable the regulator when probing fails
Chao Song <[email protected]>
ASoC: Intel: soc-acpi: correct device endpoints for max98373
Pengcheng Yang <[email protected]>
tcp: fix F-RTO may not work correctly when receiving DSACK
Dany Madden <[email protected]>
Revert "ibmvnic: Add ethtool private flag for driver-defined queue limits"
Lijun Pan <[email protected]>
ibmvnic: fix miscellaneous checks
Leon Romanovsky <[email protected]>
ixgbe: ensure IPsec VF<->PF compatibility
Yang Yingliang <[email protected]>
net: fec: add missing of_node_put() in fec_enet_init_stop_mode()
Manish Chopra <[email protected]>
bnx2x: fix napi API usage sequence
Maxim Mikityanskiy <[email protected]>
tls: Skip tls_append_frag on zero copy size
Miaoqian Lin <[email protected]>
drm/amd/display: Fix memory leak in dcn21_clock_source_create
David Yat Sin <[email protected]>
drm/amdkfd: Fix GWS queue count
Martin Blumenstingl <[email protected]>
net: dsa: lantiq_gswip: Don't set GSWIP_MII_CFG_RMII_CLK
Baruch Siach <[email protected]>
net: phy: marvell10g: fix return value on error
Jonathan Lemon <[email protected]>
net: bcmgenet: hide status block before TX timestamping
Yang Yingliang <[email protected]>
clk: sunxi: sun9i-mmc: check return value after calling platform_get_resource()
Christophe JAILLET <[email protected]>
bus: sunxi-rsb: Fix the return value of sunxi_rsb_device_create()
Eric Dumazet <[email protected]>
tcp: make sure treq->af_specific is initialized
Eric Dumazet <[email protected]>
tcp: fix potential xmit stalls caused by TCP_NOTSENT_LOWAT
Peilin Ye <[email protected]>
ip_gre, ip6_gre: Fix race condition on o_seqno in collect_md mode
Peilin Ye <[email protected]>
ip6_gre: Make o_seqno start from 0 in native mode
Peilin Ye <[email protected]>
ip_gre: Make o_seqno start from 0 in native mode
liuyacan <[email protected]>
net/smc: sync err code when tcp connection was refused
Jian Shen <[email protected]>
net: hns3: add return value for mailbox handling in PF
Jian Shen <[email protected]>
net: hns3: add validity check for message data length
Jie Wang <[email protected]>
net: hns3: modify the return code of hclge_get_ring_chain_from_mbx
Xiaobing Luo <[email protected]>
cpufreq: fix memory leak in sun50i_cpufreq_nvmem_probe
Lv Ruyi <[email protected]>
pinctrl: pistachio: fix use of irq_of_parse_and_map()
Fabio Estevam <[email protected]>
arm64: dts: imx8mn-ddr4-evk: Describe the 32.768 kHz PMIC clock
Max Krummenacher <[email protected]>
ARM: dts: imx6ull-colibri: fix vqmmc regulator
Xin Long <[email protected]>
sctp: check asoc strreset_chunk in sctp_generate_reconf_event
Nikolay Aleksandrov <[email protected]>
wireguard: device: check for metadata_dst with skb_valid_dst()
Pengcheng Yang <[email protected]>
tcp: ensure to use the most recently sent skb when filling the rate sample
Marek Vasut <[email protected]>
pinctrl: stm32: Keep pinctrl block clock enabled when LEVEL IRQ requested
Francesco Ruggeri <[email protected]>
tcp: md5: incorrect tcp_header_len for incoming connections
Luca Ceresoli <[email protected]>
pinctrl: rockchip: fix RK3308 pinmux bits
Eyal Birger <[email protected]>
bpf, lwt: Fix crash when using bpf_skb_set_tunnel_key() from bpf_xmit lwt hook
Pablo Neira Ayuso <[email protected]>
netfilter: nft_set_rbtree: overlap detection with element re-addition after deletion
Miaoqian Lin <[email protected]>
net: dsa: Add missing of_node_put() in dsa_port_link_register_of
Geert Uytterhoeven <[email protected]>
memory: renesas-rpc-if: Fix HF/OSPI data transfer in Manual Mode
Marek Vasut <[email protected]>
pinctrl: stm32: Do not call stm32_gpio_get() for edge triggered IRQs in EOI
Oleksandr Ocheretnyi <[email protected]>
mtd: fix 'part' field data corruption in mtd_info
Miaoqian Lin <[email protected]>
mtd: rawnand: Fix return value check of wait_for_completion_timeout
YueHaibing <[email protected]>
pinctrl: mediatek: moore: Fix build error
Pengcheng Yang <[email protected]>
ipvs: correctly print the memory size of ip_vs_conn_tab
Adam Ford <[email protected]>
ARM: dts: logicpd-som-lv: Fix wrong pinmuxing on OMAP35
Adam Ford <[email protected]>
ARM: dts: am3517-evm: Fix misc pinmuxing
H. Nikolaus Schaller <[email protected]>
ARM: dts: Fix mmc order for omap3-gta04
Miaoqian Lin <[email protected]>
phy: ti: Add missing pm_runtime_disable() in serdes_am654_probe
Miaoqian Lin <[email protected]>
phy: mapphone-mdm6600: Fix PM error handling in phy_mdm6600_probe
Claudiu Beznea <[email protected]>
ARM: dts: at91: sama5d4_xplained: fix pinctrl phandle name
Mark Brown <[email protected]>
ARM: dts: at91: Map MCLK for wm8731 on at91sam9g20ek
Miaoqian Lin <[email protected]>
phy: ti: omap-usb2: Fix error handling in omap_usb2_enable_clocks
Tony Lindgren <[email protected]>
bus: ti-sysc: Make omap3 gpt12 quirk handling SoC specific
Miaoqian Lin <[email protected]>
ARM: OMAP2+: Fix refcount leak in omap_gic_of_init
Krzysztof Kozlowski <[email protected]>
phy: samsung: exynos5250-sata: fix missing device put in probe error paths
Miaoqian Lin <[email protected]>
phy: samsung: Fix missing of_node_put() in exynos_sata_phy_probe
Fabio Estevam <[email protected]>
ARM: dts: imx6qdl-apalis: Fix sgtl5000 detection issue
Weitao Wang <[email protected]>
USB: Fix xhci event ring dequeue pointer ERDP update issue
Chuanhong Guo <[email protected]>
mtd: rawnand: fix ecc parameters for mt7622
Tong Zhang <[email protected]>
iio:imu:bmi160: disable regulator in error path
Christian Hewitt <[email protected]>
arm64: dts: meson: remove CPU opps below 1GHz for SM1 boards
Christian Hewitt <[email protected]>
arm64: dts: meson: remove CPU opps below 1GHz for G12B boards
Pavel Skripkin <[email protected]>
video: fbdev: udlfb: properly check endpoint type
Tejun Heo <[email protected]>
iocost: don't reset the inuse weight of under-weighted debtors
Thomas Gleixner <[email protected]>
x86/pci/xen: Disable PCI/MSI[-X] masking for XEN_HVM guests
Guo Ren <[email protected]>
riscv: patch_text: Fixup last cpu should be master
Mikulas Patocka <[email protected]>
hex2bin: fix access beyond string end
Mikulas Patocka <[email protected]>
hex2bin: make the function hex_to_bin constant-time
Krzysztof Kozlowski <[email protected]>
pinctrl: samsung: fix missing GPIOLIB on ARM64 Exynos config
Wang Qing <[email protected]>
arch_topology: Do not set llc_sibling if llc_id is invalid
Maciej W. Rozycki <[email protected]>
serial: 8250: Correct the clock for EndRun PTP/1588 PCIe device
Maciej W. Rozycki <[email protected]>
serial: 8250: Also set sticky MCR bits in console restoration
Johan Hovold <[email protected]>
serial: imx: fix overrun interrupts in DMA mode
Sean Anderson <[email protected]>
usb: phy: generic: Get the vbus supply
Pawel Laszczak <[email protected]>
usb: cdns3: Fix issue for clear halt endpoint
Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Return proper request status
Thinh Nguyen <[email protected]>
usb: dwc3: core: Only handle soft-reset in DCTL
Thinh Nguyen <[email protected]>
usb: dwc3: core: Fix tx/rx threshold settings
Sven Peter <[email protected]>
usb: dwc3: Try usb-role-switch first in dwc3_drd_init
Vijayavardhan Vennapusa <[email protected]>
usb: gadget: configfs: clear deactivation flag in configfs_composite_unbind()
Dan Vacura <[email protected]>
usb: gadget: uvc: Fix crash when encoding data for usb request
Heikki Krogerus <[email protected]>
usb: typec: ucsi: Fix role swapping
Heikki Krogerus <[email protected]>
usb: typec: ucsi: Fix reuse of completion structure
Hangyu Hua <[email protected]>
usb: misc: fix improper handling of refcount in uss720_probe()
Fawzi Khaber <[email protected]>
iio: imu: inv_icm42600: Fix I2C init possible nack
Zheyu Ma <[email protected]>
iio: magnetometer: ak8975: Fix the error handling in ak8975_power_on()
Michael Hennerich <[email protected]>
iio: dac: ad5446: Fix read_raw not returning set value
Zizhuang Deng <[email protected]>
iio: dac: ad5592r: Fix the missing return value.
Mathias Nyman <[email protected]>
xhci: increase usb U3 -> U0 link resume timeout from 100ms to 500ms
Henry Lin <[email protected]>
xhci: stop polling roothubs after shutdown
Evan Green <[email protected]>
xhci: Enable runtime PM on second Alderlake controller
Daniele Palmas <[email protected]>
USB: serial: option: add Telit 0x1057, 0x1058, 0x1075 compositions
Slark Xiao <[email protected]>
USB: serial: option: add support for Cinterion MV32-WA/MV32-WB
Bruno Thomsen <[email protected]>
USB: serial: cp210x: add PIDs for Kamstrup USB Meter Reader
Kees Cook <[email protected]>
USB: serial: whiteheat: fix heap overflow in WHITEHEAT_GET_DTR_RTS
Oliver Neukum <[email protected]>
USB: quirks: add STRING quirk for VCOM device
Oliver Neukum <[email protected]>
USB: quirks: add a Realtek card reader
Macpaul Lin <[email protected]>
usb: mtu3: fix USB 3.0 dual-role-switch from device to host
Greg Kroah-Hartman <[email protected]>
lightnvm: disable the subsystem
Willy Tarreau <[email protected]>
floppy: disable FDRAWCMD by default
-------------
Diffstat:
Makefile | 4 +- arch/arm/boot/dts/am3517-evm.dts | 45 ++++- arch/arm/boot/dts/am3517-som.dtsi | 9 + arch/arm/boot/dts/at91-sama5d4_xplained.dts | 4 +- arch/arm/boot/dts/at91sam9g20ek_common.dtsi | 6 + arch/arm/boot/dts/imx6qdl-apalis.dtsi | 10 +- arch/arm/boot/dts/imx6ull-colibri.dtsi | 2 +- arch/arm/boot/dts/logicpd-som-lv-35xx-devkit.dts | 15 ++ arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts | 15 ++ arch/arm/boot/dts/logicpd-som-lv.dtsi | 15 -- arch/arm/boot/dts/omap3-gta04.dtsi | 2 + arch/arm/mach-exynos/Kconfig | 1 - arch/arm/mach-omap2/omap4-common.c | 2 + arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi | 40 ----- arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi | 40 ----- arch/arm64/boot/dts/amlogic/meson-sm1.dtsi | 20 --- arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts | 4 + arch/powerpc/perf/Makefile | 4 +- arch/riscv/kernel/patch.c | 2 +- arch/x86/include/asm/microcode.h | 2 + arch/x86/kernel/cpu/microcode/core.c | 6 +- arch/x86/lib/usercopy_64.c | 2 +- arch/x86/pci/xen.c | 6 +- arch/x86/power/cpu.c | 10 +- block/blk-iocost.c | 12 +- drivers/base/arch_topology.c | 2 +- drivers/block/Kconfig | 16 ++ drivers/block/floppy.c | 43 +++-- drivers/bus/sunxi-rsb.c | 2 + drivers/bus/ti-sysc.c | 16 +- drivers/clk/sunxi/clk-sun9i-mmc.c | 2 + drivers/cpufreq/sun50i-cpufreq-nvmem.c | 4 +- .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 83 ++++----- .../gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 1 + drivers/gpu/drm/i915/i915_reg.h | 2 +- drivers/iio/dac/ad5446.c | 2 +- drivers/iio/dac/ad5592r-base.c | 2 +- drivers/iio/imu/bmi160/bmi160_core.c | 20 ++- drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c | 15 +- drivers/iio/magnetometer/ak8975.c | 1 + drivers/lightnvm/Kconfig | 2 +- drivers/memory/renesas-rpc-if.c | 60 +++++-- drivers/mtd/nand/raw/mtk_ecc.c | 12 +- drivers/mtd/nand/raw/sh_flctl.c | 14 +- drivers/net/dsa/lantiq_gswip.c | 3 - drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 9 +- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 7 + drivers/net/ethernet/freescale/fec_main.c | 2 +- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 31 ++-- drivers/net/ethernet/ibm/ibmvnic.c | 144 +++++---------- drivers/net/ethernet/ibm/ibmvnic.h | 6 - drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 3 +- .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 12 +- drivers/net/hippi/rrunner.c | 2 + drivers/net/phy/marvell10g.c | 2 +- drivers/net/wireguard/device.c | 3 +- drivers/phy/motorola/phy-mapphone-mdm6600.c | 3 +- drivers/phy/samsung/phy-exynos5250-sata.c | 21 ++- drivers/phy/ti/phy-am654-serdes.c | 2 +- drivers/phy/ti/phy-omap-usb2.c | 2 +- drivers/pinctrl/mediatek/Kconfig | 1 + drivers/pinctrl/pinctrl-pistachio.c | 6 +- drivers/pinctrl/pinctrl-rockchip.c | 45 +++-- drivers/pinctrl/samsung/Kconfig | 11 +- drivers/pinctrl/stm32/pinctrl-stm32.c | 23 ++- .../intel/int340x_thermal/int3400_thermal.c | 4 +- drivers/tty/n_gsm.c | 194 +++++++++++---------- drivers/tty/serial/8250/8250_pci.c | 8 +- drivers/tty/serial/8250/8250_port.c | 2 +- drivers/tty/serial/imx.c | 2 +- drivers/usb/cdns3/gadget.c | 7 +- drivers/usb/core/quirks.c | 6 + drivers/usb/dwc3/core.c | 11 +- drivers/usb/dwc3/drd.c | 11 +- drivers/usb/dwc3/gadget.c | 31 +++- drivers/usb/gadget/configfs.c | 2 + drivers/usb/gadget/function/uvc_queue.c | 2 + drivers/usb/host/xhci-hub.c | 2 +- drivers/usb/host/xhci-pci.c | 4 +- drivers/usb/host/xhci-ring.c | 2 + drivers/usb/host/xhci.c | 11 ++ drivers/usb/misc/uss720.c | 3 +- drivers/usb/mtu3/mtu3_dr.c | 6 +- drivers/usb/phy/phy-generic.c | 7 + drivers/usb/serial/cp210x.c | 2 + drivers/usb/serial/option.c | 12 ++ drivers/usb/serial/whiteheat.c | 5 +- drivers/usb/typec/ucsi/ucsi.c | 24 ++- drivers/video/fbdev/udlfb.c | 14 +- fs/cifs/smb2ops.c | 8 + fs/ext4/super.c | 15 +- fs/zonefs/super.c | 46 ++++- include/linux/kernel.h | 2 +- include/linux/mtd/mtd.h | 6 +- include/memory/renesas-rpc-if.h | 1 + include/net/ip6_tunnel.h | 2 +- include/net/ip_tunnels.h | 2 +- include/net/tcp.h | 8 + lib/hexdump.c | 41 +++-- mm/kasan/quarantine.c | 7 + net/core/lwt_bpf.c | 7 +- net/dsa/port.c | 2 + net/ipv4/ip_gre.c | 12 +- net/ipv4/syncookies.c | 8 +- net/ipv4/tcp_input.c | 15 +- net/ipv4/tcp_minisocks.c | 2 +- net/ipv4/tcp_output.c | 1 + net/ipv4/tcp_rate.c | 11 +- net/ipv6/ip6_gre.c | 16 +- net/ipv6/syncookies.c | 3 +- net/netfilter/ipvs/ip_vs_conn.c | 2 +- net/netfilter/nft_set_rbtree.c | 6 +- net/netfilter/nft_socket.c | 52 ++++-- net/sctp/sm_sideeffect.c | 4 + net/smc/af_smc.c | 2 + net/tls/tls_device.c | 12 +- sound/soc/codecs/wm8731.c | 19 +- sound/soc/intel/common/soc-acpi-intel-tgl-match.c | 4 +- tools/perf/arch/arm64/util/Build | 1 - tools/perf/arch/arm64/util/machine.c | 27 --- tools/perf/arch/s390/util/machine.c | 16 -- tools/perf/util/symbol-elf.c | 2 +- tools/perf/util/symbol.c | 37 ++-- tools/perf/util/symbol.h | 3 +- 124 files changed, 1008 insertions(+), 681 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/129 floppy: disable FDRAWCMD by default
From: Willy Tarreau <[email protected]>
commit 233087ca063686964a53c829d547c7571e3f67bf upstream.
Minh Yuan reported a concurrency use-after-free issue in the floppy code between raw_cmd_ioctl and seek_interrupt.
[ It turns out this has been around, and that others have reported the
KASAN splats over the years, but Minh Yuan had a reproducer for it and
so gets primary credit for reporting it for this fix - Linus ]
The problem is, this driver tends to break very easily and nowadays, nobody is expected to use FDRAWCMD anyway since it was used to manipulate non-standard formats. The risk of breaking the driver is higher than the risk presented by this race, and accessing the device requires privileges anyway.
Let's just add a config option to completely disable this ioctl and leave it disabled by default. Distros shouldn't use it, and only those running on antique hardware might need to enable it.
--- drivers/block/Kconfig | 16 ++++++++++++++++ drivers/block/floppy.c | 43 ++++++++++++++++++++++++++++++++----------- 2 files changed, 48 insertions(+), 11 deletions(-)
drivers/block/Kconfig +16 -0
@@ -39,6 +39,22 @@ config BLK_DEV_FD To compile this driver as a module, choose M here: the module will be called floppy. +config BLK_DEV_FD_RAWCMD + bool "Support for raw floppy disk commands (DEPRECATED)" + depends on BLK_DEV_FD + help + If you want to use actual physical floppies and expect to do + special low-level hardware accesses to them (access and use + non-standard formats, for example), then enable this. + + Note that the code enabled by this option is rarely used and + might be unstable or insecure, and distros should not enable it. + + Note: FDRAWCMD is deprecated and will be removed from the kernel + in the near future. + + If unsure, say N. + config AMIGA_FLOPPY tristate "Amiga floppy support" depends on AMIGA
drivers/block/floppy.c +32 -11
67 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 2/129 lightnvm: disable the subsystem
In reply to Greg Kroah-HartmanIn commit 9ea9b9c48387 ("remove the lightnvm subsystem") the lightnvm subsystem was removed as there is no hardware in the wild for it, and the code is known to have problems. This should also be disabled for older LTS kernels as well to prevent anyone from accidentally using it.
--- drivers/lightnvm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/lightnvm/Kconfig +1 -1
@@ -5,7 +5,7 @@ menuconfig NVM bool "Open-Channel SSD target support" - depends on BLOCK + depends on BLOCK && BROKEN help Say Y here to get to enable Open-channel SSDs.
Greg Kroah-Hartman
maintainerPATCH 3/129 usb: mtu3: fix USB 3.0 dual-role-switch from device to host
In reply to Greg Kroah-HartmanFrom: Macpaul Lin <[email protected]>
commit 456244aeecd54249096362a173dfe06b82a5cafa upstream.
Issue description:
When an OTG port has been switched to device role and then switch back to host role again, the USB 3.0 Host (XHCI) will not be able to detect "plug in event of a connected USB 2.0/1.0 ((Highspeed and Fullspeed) devices until system reboot.
Root cause and Solution:
There is a condition checking flag "ssusb->otg_switch.is_u3_drd" in toggle_opstate(). At the end of role switch procedure, toggle_opstate() will be called to set DC_SESSION and SOFT_CONN bit. If "is_u3_drd" was set and switched the role to USB host 3.0, bit DC_SESSION and SOFT_CONN will be skipped hence caused the port cannot detect connected USB 2.0 (Highspeed and Fullspeed) devices. Simply remove the condition check to solve this issue.
--- drivers/usb/mtu3/mtu3_dr.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/usb/mtu3/mtu3_dr.c +2 -4
@@ -41,10 +41,8 @@ static char *mailbox_state_string(enum mstatic void toggle_opstate (struct ssusb_mtk *ssusb) { -if (!ssusb->otg_switch.is_u3_drd) { -mtu3_setbits (ssusb->mac_base,U3D_DEVICE_CONTROL ,DC_SESSION ); -mtu3_setbits (ssusb->mac_base,U3D_POWER_MANAGEMENT ,SOFT_CONN ); - } +mtu3_setbits (ssusb->mac_base,U3D_DEVICE_CONTROL ,DC_SESSION ); +mtu3_setbits (ssusb->mac_base,U3D_POWER_MANAGEMENT ,SOFT_CONN ); }/* only port0 supports dual-role mode */
Greg Kroah-Hartman
maintainerPATCH 4/129 USB: quirks: add a Realtek card reader
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
commit 2a7ccf6bb6f147f64c025ad68f4255d8e1e0ce6d upstream.
This device is reported to stall when enummerated.
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -404,6 +404,9 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x0b05, 0x17e0), .driver_info = USB_QUIRK_IGNORE_REMOTE_WAKEUP }, + /* Realtek Semiconductor Corp. Mass Storage Device (Multicard Reader)*/ + { USB_DEVICE(0x0bda, 0x0151), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, + /* Realtek hub in Dell WD19 (Type-C) */ { USB_DEVICE(0x0bda, 0x0487), .driver_info = USB_QUIRK_NO_LPM }, { USB_DEVICE(0x0bda, 0x5487), .driver_info = USB_QUIRK_RESET_RESUME },
Greg Kroah-Hartman
maintainerPATCH 5/129 USB: quirks: add STRING quirk for VCOM device
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
commit ec547af8a9ea6441864bad34172676b5652ceb96 upstream.
This has been reported to stall if queried
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -511,6 +511,9 @@ static const struct usb_device_id usb_qu/* DJI CineSSD */ { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, + /* VCOM device */ + { USB_DEVICE(0x4296, 0x7570), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, + /* INTEL VALUE SSD */ { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
Greg Kroah-Hartman
maintainerPATCH 6/129 USB: serial: whiteheat: fix heap overflow in WHITEHEAT_GET_DTR_RTS
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
commit e23e50e7acc8d8f16498e9c129db33e6a00e80eb upstream.
The sizeof(struct whitehat_dr_info) can be 4 bytes under CONFIG_AEABI=n due to "-mabi=apcs-gnu", even though it has a single u8:
whiteheat_private {
__u8 mcr; /* 0 1 */
/* size: 4, cachelines: 1, members: 1 */
/* padding: 3 */
/* last cacheline: 4 bytes */
};The result is technically harmless, as both the source and the destinations are currently the same allocation size (4 bytes) and don't use their padding, but if anything were to ever be added after the "mcr" member in "struct whiteheat_private", it would be overwritten. The structs both have a single u8 "mcr" member, but are 4 bytes in padded size. The memcpy() destination was explicitly targeting the u8 member (size 1) with the length of the whole structure (size 4), triggering the memcpy buffer overflow warning:
In file included from include/linux/string.h:253,
from include/linux/bitmap.h:11,
from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/spinlock.h:62,
from include/linux/mmzone.h:8,
from include/linux/gfp.h:6,
from include/linux/slab.h:15,
from drivers/usb/serial/whiteheat.c:17:
In function 'fortify_memcpy_chk',
inlined from 'firm_send_command' at drivers/usb/serial/whiteheat.c:587:4:include/linux/fortify-string.h:328:25: warning: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]
328 | __write_overflow_field(p_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Instead, just assign the one byte directly.
--- drivers/usb/serial/whiteheat.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/serial/whiteheat.c +2 -3
@@ -599,9 +599,8 @@ static int firm_send_command(struct usb_switch (command) {case WHITEHEAT_GET_DTR_RTS : info =usb_get_serial_port_data (port); -memcpy (&info->mcr, command_info->result_buffer, -sizeof (struct whiteheat_dr_info )); -break ; + info->mcr = command_info->result_buffer[0 ]; +break ; } } exit:
Greg Kroah-Hartman
maintainerPATCH 7/129 USB: serial: cp210x: add PIDs for Kamstrup USB Meter Reader
In reply to Greg Kroah-HartmanFrom: Bruno Thomsen <[email protected]>
commit 35a923a0b329c343e9e81d79518e2937eba06fcd upstream.
Wireless reading of water and heat meters using 868 MHz wM-Bus mode C1.
The two different product IDs allow detection of dongle antenna solution:
- Internal antenna
- External antenna using SMA connector
https://www.kamstrup.com/en-en/water-solutions/water-meter-reading/usb-meter-reader
--- drivers/usb/serial/cp210x.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/cp210x.c +2 -0
@@ -198,6 +198,8 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x16DC, 0x0015) }, /* W-IE-NE-R Plein & Baus GmbH CML Control, Monitoring and Data Logger */ { USB_DEVICE(0x17A8, 0x0001) }, /* Kamstrup Optical Eye/3-wire */ { USB_DEVICE(0x17A8, 0x0005) }, /* Kamstrup M-Bus Master MultiPort 250D */ + { USB_DEVICE(0x17A8, 0x0101) }, /* Kamstrup 868 MHz wM-Bus C-Mode Meter Reader (Int Ant) */ + { USB_DEVICE(0x17A8, 0x0102) }, /* Kamstrup 868 MHz wM-Bus C-Mode Meter Reader (Ext Ant) */ { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */ { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
Greg Kroah-Hartman
maintainerPATCH 8/129 USB: serial: option: add support for Cinterion MV32-WA/MV32-WB
In reply to Greg Kroah-HartmanFrom: Slark Xiao <[email protected]>
commit b4a64ed6e7b857317070fcb9d87ff5d4a73be3e8 upstream.
Add support for Cinterion device MV32-WA/MV32-WB. MV32-WA PID is 0x00F1, and MV32-WB PID is 0x00F2.
Test evidence as below:
T: Bus=04 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 4 Spd=5000 MxCh= 0 D: Ver= 3.20 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs= 1 P: Vendor=1e2d ProdID=00f1 Rev=05.04 S: Manufacturer=Cinterion S: Product=Cinterion PID 0x00F1 USB Mobile Broadband S: SerialNumber=78ada8c4 C: #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=896mA I: If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim I: If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim I: If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option I: If#=0x3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) I: If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option I: If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
T: Bus=04 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 3 Spd=5000 MxCh= 0 D: Ver= 3.20 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs= 1 P: Vendor=1e2d ProdID=00f2 Rev=05.04 S: Manufacturer=Cinterion S: Product=Cinterion PID 0x00F2 USB Mobile Broadband S: SerialNumber=cdd06a78 C: #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=896mA I: If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim I: If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim I: If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option I: If#=0x3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) I: If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option I: If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
Interface 0&1: MBIM, 2:Modem, 3: GNSS, 4: NMEA, 5: Diag GNSS port don't use serial driver.
--- drivers/usb/serial/option.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/serial/option.c +6 -0
@@ -432,6 +432,8 @@ static void option_instat_callback(struc#define CINTERION_PRODUCT_CLS8 0x00b0#define CINTERION_PRODUCT_MV31_MBIM 0x00b3#define CINTERION_PRODUCT_MV31_RMNET 0x00b7 +#define CINTERION_PRODUCT_MV32_WA 0x00f1 +#define CINTERION_PRODUCT_MV32_WB 0x00f2/* Olivetti products */ #define OLIVETTI_VENDOR_ID 0x0b3c
@@ -1969,6 +1971,10 @@ static const struct usb_device_id option .driver_info = RSVD(3)}, { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV31_RMNET, 0xff), .driver_info = RSVD(0)}, + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WA, 0xff), + .driver_info = RSVD(3)}, + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WB, 0xff), + .driver_info = RSVD(3)}, { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100), .driver_info = RSVD(4) }, { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120),
Greg Kroah-Hartman
maintainerPATCH 9/129 USB: serial: option: add Telit 0x1057, 0x1058, 0x1075 compositions
In reply to Greg Kroah-HartmanFrom: Daniele Palmas <[email protected]>
commit f32c5a0423400e01f4d7c607949fa3a1f006e8fa upstream.
Add support for the following Telit FN980 and FN990 compositions:
0x1057: tty, adb, rmnet, tty, tty, tty, tty, tty0x1058: tty, adb, tty, tty, tty, tty, tty0x1075: adb, tty
--- drivers/usb/serial/option.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/serial/option.c +6 -0
@@ -1219,6 +1219,10 @@ static const struct usb_device_id option .driver_info = NCTRL(0) | RSVD(1) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1056, 0xff), /* Telit FD980 */ .driver_info = NCTRL(2) | RSVD(3) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1057, 0xff), /* Telit FN980 */ + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1058, 0xff), /* Telit FN980 (PCIe) */ + .driver_info = NCTRL(0) | RSVD(1) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1060, 0xff), /* Telit LN920 (rmnet) */ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1061, 0xff), /* Telit LN920 (MBIM) */
@@ -1235,6 +1239,8 @@ static const struct usb_device_id option .driver_info = NCTRL(2) | RSVD(3) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1073, 0xff), /* Telit FN990 (ECM) */ .driver_info = NCTRL(0) | RSVD(1) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1075, 0xff), /* Telit FN990 (PCIe) */ + .driver_info = RSVD(0) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM),
Greg Kroah-Hartman
maintainerPATCH 10/129 xhci: Enable runtime PM on second Alderlake controller
In reply to Greg Kroah-HartmanFrom: Evan Green <[email protected]>
commit d8bfe5091d6cc4b8b8395e4666979ae72a6069ca upstream.
Alderlake has two XHCI controllers with PCI IDs 0x461e and 0x51ed. We had previously added the quirk to default enable runtime PM for 0x461e, now add it for 0x51ed as well.
--- drivers/usb/host/xhci-pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +3 -1
@@ -59,6 +59,7 @@#define PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI 0x9a13#define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI 0x1138#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI 0x461e +#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI 0x51ed#define PCI_DEVICE_ID_AMD_PROMONTORYA_4 0x43b9#define PCI_DEVICE_ID_AMD_PROMONTORYA_3 0x43ba
@@ -261,7 +262,8 @@ static void xhci_pci_quirks(struct devic pdev->device ==PCI_DEVICE_ID_INTEL_ICE_LAKE_XHCI || pdev->device ==PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI || pdev->device ==PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI || - pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI)) + pdev->device ==PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI || + pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI)) xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
Greg Kroah-Hartman
maintainerPATCH 11/129 xhci: stop polling roothubs after shutdown
In reply to Greg Kroah-HartmanFrom: Henry Lin <[email protected]>
commit dc92944a014cd6a6f6c94299aaa36164dd2c238a upstream.
While rebooting, XHCI controller and its bus device will be shut down in order by .shutdown callback. Stopping roothubs polling in xhci_shutdown() can prevent XHCI driver from accessing port status after its bus device shutdown.
Take PCIe XHCI controller as example, if XHCI driver doesn't stop roothubs polling, XHCI driver may access PCIe BAR register for port status after parent PCIe root port driver is shutdown and cause PCIe bus error.
[check shared hcd exist before stopping its roothub polling -Mathias]
--- drivers/usb/host/xhci.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/usb/host/xhci.c +11 -0
@@ -779,6 +779,17 @@ void xhci_shutdown(struct usb_hcd *hcd)if (xhci->quirks &XHCI_SPURIOUS_REBOOT )usb_disable_xhci_ports (to_pci_dev (hcd->self.sysdev)); +/* Don't poll the roothubs after shutdown. */ +xhci_dbg (xhci,"%s: stopping usb%d port polling.\n" , + __func__, hcd->self.busnum); +clear_bit (HCD_FLAG_POLL_RH , &hcd->flags); +del_timer_sync (&hcd->rh_timer); + +if (xhci->shared_hcd) { +clear_bit (HCD_FLAG_POLL_RH , &xhci->shared_hcd->flags); +del_timer_sync (&xhci->shared_hcd->rh_timer); + } +spin_lock_irq (&xhci->lock);xhci_halt (xhci);/* Workaround for spurious wakeups at shutdown with HSW */
Greg Kroah-Hartman
maintainerPATCH 12/129 xhci: increase usb U3 -> U0 link resume timeout from 100ms to 500ms
In reply to Greg Kroah-HartmanFrom: Mathias Nyman <[email protected]>
commit 33597f0c48be0836854d43c577e35c8f8a765a7d upstream.
The first U3 wake signal by the host may be lost if the USB 3 connection is tunneled over USB4, with a runtime suspended USB4 host, and firmware implemented connection manager.
Specs state the host must wait 100ms (tU3WakeupRetryDelay) before resending a U3 wake signal if device doesn't respond, leading to U3 -> U0 link transition times around 270ms in the tunneled case.
--- drivers/usb/host/xhci-hub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-hub.c +1 -1
@@ -1348,7 +1348,7 @@ int xhci_hub_control(struct usb_hcd *hcd }spin_unlock_irqrestore (&xhci->lock, flags);if (!wait_for_completion_timeout (&bus_state->u3exit_done[wIndex], -msecs_to_jiffies (100 ))) +msecs_to_jiffies (500 )))xhci_dbg (xhci,"missing U0 port change event for port %d-%d\n" , hcd->self.busnum, wIndex +1 );spin_lock_irqsave (&xhci->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 13/129 iio: dac: ad5592r: Fix the missing return value.
In reply to Greg Kroah-HartmanFrom: Zizhuang Deng <[email protected]>
commit b55b38f7cc12da3b9ef36e7a3b7f8f96737df4d5 upstream.
The third call to fwnode_property_read_u32 did not record the return value, resulting in channel_offstate possibly being assigned the wrong value.
--- drivers/iio/dac/ad5592r-base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad5592r-base.c +1 -1
@@ -523,7 +523,7 @@ static int ad5592r_alloc_channels(structif (!ret) st->channel_modes[reg] = tmp; -fwnode_property_read_u32 (child,"adi,off-state" , &tmp); + ret =fwnode_property_read_u32 (child,"adi,off-state" , &tmp);if (!ret) st->channel_offstate[reg] = tmp; }
Greg Kroah-Hartman
maintainerPATCH 14/129 iio: dac: ad5446: Fix read_raw not returning set value
In reply to Greg Kroah-HartmanFrom: Michael Hennerich <[email protected]>
commit 89a01cd688d3c0ac983ef0b0e5f40018ab768317 upstream.
read_raw should return the un-scaled value.
--- drivers/iio/dac/ad5446.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad5446.c +1 -1
@@ -178,7 +178,7 @@ static int ad5446_read_raw(struct iio_deswitch (m) {case IIO_CHAN_INFO_RAW : - *val = st->cached_val; + *val = st->cached_val >> chan->scan_type.shift;return IIO_VAL_INT ;case IIO_CHAN_INFO_SCALE : *val = st->vref_mv;
Greg Kroah-Hartman
maintainerPATCH 15/129 iio: magnetometer: ak8975: Fix the error handling in ak8975_power_on()
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
commit 3a26787dacf04257a68b16315c984eb2c340bc5e upstream.
When the driver fails to enable the regulator 'vid', we will get the following splat:
[ 79.955610] WARNING: CPU: 5 PID: 441 at drivers/regulator/core.c:2257 _regulator_put+0x3ec/0x4e0 [ 79.959641] RIP: 0010:_regulator_put+0x3ec/0x4e0 [ 79.967570] Call Trace: [ 79.967773] <TASK> [ 79.967951] regulator_put+0x1f/0x30 [ 79.968254] devres_release_group+0x319/0x3d0 [ 79.968608] i2c_device_probe+0x766/0x940
Fix this by disabling the 'vdd' regulator when failing to enable 'vid' regulator.
--- drivers/iio/magnetometer/ak8975.c | 1 + 1 file changed, 1 insertion(+)
drivers/iio/magnetometer/ak8975.c +1 -0
@@ -389,6 +389,7 @@ static int ak8975_power_on(const structif (ret) {dev_warn (&data->client->dev,"Failed to enable specified Vid supply\n" ); +regulator_disable (data->vdd);return ret; }
Greg Kroah-Hartman
maintainerPATCH 16/129 iio: imu: inv_icm42600: Fix I2C init possible nack
In reply to Greg Kroah-HartmanFrom: Fawzi Khaber <[email protected]>
commit b5d6ba09b10d2ccb865ed9bc45941db0a41c6756 upstream.
This register write to REG_INTF_CONFIG6 enables a spike filter that is impacting the line and can prevent the I2C ACK to be seen by the controller. So we don't test the return value.
--- drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c +9 -6
@@ -18,12 +18,15 @@ static int inv_icm42600_i2c_bus_setup(stunsigned int mask, val;int ret; -/* setup interface registers */ - ret =regmap_update_bits (st->map,INV_ICM42600_REG_INTF_CONFIG6 , -INV_ICM42600_INTF_CONFIG6_MASK , -INV_ICM42600_INTF_CONFIG6_I3C_EN ); -if (ret) -return ret; +/* +* setup interface registers +* This register write to REG_INTF_CONFIG6 enables a spike filter that +* is impacting the line and can prevent the I2C ACK to be seen by the +* controller. So we don't test the return value. +*/ +regmap_update_bits (st->map,INV_ICM42600_REG_INTF_CONFIG6 , +INV_ICM42600_INTF_CONFIG6_MASK , +INV_ICM42600_INTF_CONFIG6_I3C_EN ); ret =regmap_update_bits (st->map,INV_ICM42600_REG_INTF_CONFIG4 ,INV_ICM42600_INTF_CONFIG4_I3C_BUS_ONLY ,0 );
Greg Kroah-Hartman
maintainerPATCH 17/129 usb: misc: fix improper handling of refcount in uss720_probe()
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
commit 0a96fa640dc928da9eaa46a22c46521b037b78ad upstream.
usb_put_dev shouldn't be called when uss720_probe succeeds because of priv->usbdev. At the same time, priv->usbdev shouldn't be set to NULL before destroy_priv in uss720_disconnect because usb_put_dev is in destroy_priv.
Fix this by moving priv->usbdev = NULL after usb_put_dev.
--- drivers/usb/misc/uss720.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/misc/uss720.c +1 -2
@@ -71,6 +71,7 @@ static void destroy_priv(struct kref *krdev_dbg (&priv->usbdev->dev,"destroying priv datastructure\n" );usb_put_dev (priv->usbdev); + priv->usbdev =NULL ;kfree (priv); }
@@ -736,7 +737,6 @@ static int uss720_probe(struct usb_interparport_announce_port (pp);usb_set_intfdata (intf, pp); -usb_put_dev (usbdev);return 0 ; probe_abort:
@@ -754,7 +754,6 @@ static void uss720_disconnect(struct usbusb_set_intfdata (intf,NULL );if (pp) { priv = pp->private_data; - priv->usbdev =NULL ; priv->pp =NULL ;dev_dbg (&intf->dev,"parport_remove_port\n" );parport_remove_port (pp);
Greg Kroah-Hartman
maintainerPATCH 18/129 usb: typec: ucsi: Fix reuse of completion structure
In reply to Greg Kroah-HartmanFrom: Heikki Krogerus <[email protected]>
commit e25adcca917d7e4cdc1dc6444d0692ffda7594bf upstream.
The role swapping completion variable is reused, so it needs to be reinitialised every time. Otherwise it will be marked as done after the first time it's used and completing immediately.
--- drivers/usb/typec/ucsi/ucsi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/typec/ucsi/ucsi.c +4 -0
@@ -928,6 +928,8 @@ static int ucsi_dr_swap(struct typec_por role == TYPEC_HOST)) goto out_unlock; +reinit_completion (&con->complete); + command =UCSI_SET_UOR |UCSI_CONNECTOR_NUMBER (con->num); command |=UCSI_SET_UOR_ROLE (role); command |=UCSI_SET_UOR_ACCEPT_ROLE_SWAPS ;
@@ -964,6 +966,8 @@ static int ucsi_pr_swap(struct typec_porif (cur_role == role) goto out_unlock; +reinit_completion (&con->complete); + command =UCSI_SET_PDR |UCSI_CONNECTOR_NUMBER (con->num); command |=UCSI_SET_PDR_ROLE (role); command |=UCSI_SET_PDR_ACCEPT_ROLE_SWAPS ;
Greg Kroah-Hartman
maintainerPATCH 19/129 usb: typec: ucsi: Fix role swapping
In reply to Greg Kroah-HartmanFrom: Heikki Krogerus <[email protected]>
commit eb5d7ff3cf0d55093c619b5ad107cd5c05ce8134 upstream.
All attempts to swap the roles timed out because the completion was done without releasing the port lock. Fixing that by releasing the lock before starting to wait for the completion.
--- drivers/usb/typec/ucsi/ucsi.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/usb/typec/ucsi/ucsi.c +13 -7
@@ -937,14 +937,18 @@ static int ucsi_dr_swap(struct typec_porif (ret <0 ) goto out_unlock; +mutex_unlock (&con->lock); +if (!wait_for_completion_timeout (&con->complete, -msecs_to_jiffies (UCSI_SWAP_TIMEOUT_MS ))) - ret = -ETIMEDOUT ; +msecs_to_jiffies (UCSI_SWAP_TIMEOUT_MS ))) +return -ETIMEDOUT ; + +return 0 ; out_unlock:mutex_unlock (&con->lock); -return ret <0 ? ret :0 ; +return ret; }static int ucsi_pr_swap (struct typec_port *port,enum typec_role role)
@@ -975,11 +979,13 @@ static int ucsi_pr_swap(struct typec_porif (ret <0 ) goto out_unlock; +mutex_unlock (&con->lock); +if (!wait_for_completion_timeout (&con->complete, -msecs_to_jiffies (UCSI_SWAP_TIMEOUT_MS ))) { - ret = -ETIMEDOUT ; - goto out_unlock; - } +msecs_to_jiffies (UCSI_SWAP_TIMEOUT_MS ))) +return -ETIMEDOUT ; + +mutex_lock (&con->lock);/* Something has gone wrong while swapping the role */ if (UCSI_CONSTAT_PWR_OPMODE(con->status.flags) !=
Greg Kroah-Hartman
maintainerPATCH 20/129 usb: gadget: uvc: Fix crash when encoding data for usb request
In reply to Greg Kroah-HartmanFrom: Dan Vacura <[email protected]>
commit 71d471e3faf90c9674cadc7605ac719e82cb7fac upstream.
During the uvcg_video_pump() process, if an error occurs and uvcg_queue_cancel() is called, the buffer queue will be cleared out, but the current marker (queue->buf_used) of the active buffer (no longer active) is not reset. On the next iteration of uvcg_video_pump() the stale buf_used count will be used and the logic of min((unsigned int)len, buf->bytesused - queue->buf_used) may incorrectly calculate a nbytes size, causing an invalid memory access.
[80802.185460][ T315] configfs-gadget gadget: uvc: VS request completed with status -18. [80802.185519][ T315] configfs-gadget gadget: uvc: VS request completed
with status -18.
...uvcg_queue_cancel() is called and the queue is cleared out, but the marker queue->buf_used is not reset.
...
[80802.262328][ T8682] Unable to handle kernel paging request at virtual address ffffffc03af9f000 ... ... [80802.263138][ T8682] Call trace: [80802.263146][ T8682] __memcpy+0x12c/0x180 [80802.263155][ T8682] uvcg_video_pump+0xcc/0x1e0 [80802.263165][ T8682] process_one_work+0x2cc/0x568 [80802.263173][ T8682] worker_thread+0x28c/0x518 [80802.263181][ T8682] kthread+0x160/0x170 [80802.263188][ T8682] ret_from_fork+0x10/0x18 [80802.263198][ T8682] Code: a8c12829 a88130cb a8c130
--- drivers/usb/gadget/function/uvc_queue.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/gadget/function/uvc_queue.c +2 -0
@@ -242,6 +242,8 @@ void uvcg_queue_cancel(struct uvc_video_ buf->state =UVC_BUF_STATE_ERROR ;vb2_buffer_done (&buf->buf.vb2_buf,VB2_BUF_STATE_ERROR ); } + queue->buf_used =0 ; +/* This must be protected by the irqlock spinlock to avoid race * conditions between uvc_queue_buffer and the disconnection event that * could result in an interruptible wait in uvc_dequeue_buffer. Do not
Greg Kroah-Hartman
maintainerPATCH 21/129 usb: gadget: configfs: clear deactivation flag in configfs_composite_unbind()
In reply to Greg Kroah-HartmanFrom: Vijayavardhan Vennapusa <[email protected]>
commit bf95c4d4630c7a2c16e7b424fdea5177d9ce0864 upstream.
If any function like UVC is deactivating gadget as part of composition switch which results in not calling pullup enablement, it is not getting enabled after switch to new composition due to this deactivation flag not cleared. This results in USB enumeration not happening after switch to new USB composition. Hence clear deactivation flag inside gadget structure in configfs_composite_unbind() before switch to new USB composition.
--- drivers/usb/gadget/configfs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/gadget/configfs.c +2 -0
@@ -1443,6 +1443,8 @@ static void configfs_composite_unbind(stusb_ep_autoconfig_reset (cdev->gadget);spin_lock_irqsave (&gi->spinlock, flags); cdev->gadget =NULL ; + cdev->deactivations =0 ; + gadget->deactivated = false;set_gadget_data (gadget,NULL );spin_unlock_irqrestore (&gi->spinlock, flags); }
Greg Kroah-Hartman
maintainerPATCH 22/129 usb: dwc3: Try usb-role-switch first in dwc3_drd_init
In reply to Greg Kroah-HartmanFrom: Sven Peter <[email protected]>
commit ab7aa2866d295438dc60522f85c5421c6b4f1507 upstream.
If the PHY controller node has a "port" dwc3 tries to find an extcon device even when "usb-role-switch" is present. This happens because dwc3_get_extcon() sees that "port" node and then calls extcon_find_edev_by_node() which will always return EPROBE_DEFER in that case.
On the other hand, even if an extcon was present and dwc3_get_extcon() was successful it would still be ignored in favor of "usb-role-switch".
Let's just first check if "usb-role-switch" is configured in the device tree and directly use it instead and only try to look for an extcon device otherwise.
--- drivers/usb/dwc3/drd.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/usb/dwc3/drd.c +5 -6
@@ -568,16 +568,15 @@ int dwc3_drd_init(struct dwc3 *dwc) {int ret, irq; +if (ROLE_SWITCH && +device_property_read_bool (dwc->dev,"usb-role-switch" )) +return dwc3_setup_role_switch (dwc); + dwc->edev =dwc3_get_extcon (dwc);if (IS_ERR (dwc->edev))return PTR_ERR (dwc->edev); -if (ROLE_SWITCH && -device_property_read_bool (dwc->dev,"usb-role-switch" )) { - ret =dwc3_setup_role_switch (dwc); -if (ret <0 ) -return ret; - }else if (dwc->edev) { +if (dwc->edev) { dwc->edev_nb.notifier_call = dwc3_drd_notifier; ret =extcon_register_notifier (dwc->edev,EXTCON_USB_HOST , &dwc->edev_nb);
Greg Kroah-Hartman
maintainerPATCH 23/129 usb: dwc3: core: Fix tx/rx threshold settings
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
commit f28ad9069363dec7deb88032b70612755eed9ee6 upstream.
The current driver logic checks against 0 to determine whether the periodic tx/rx threshold settings are set, but we may get bogus values from uninitialized variables if no device property is set. Properly default these variables to 0.
--- drivers/usb/dwc3/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/dwc3/core.c +4 -4
@@ -1277,10 +1277,10 @@ static void dwc3_get_properties(struct du8 lpm_nyet_threshold;u8 tx_de_emphasis;u8 hird_threshold; -u8 rx_thr_num_pkt_prd; -u8 rx_max_burst_prd; -u8 tx_thr_num_pkt_prd; -u8 tx_max_burst_prd; +u8 rx_thr_num_pkt_prd =0 ; +u8 rx_max_burst_prd =0 ; +u8 tx_thr_num_pkt_prd =0 ; +u8 tx_max_burst_prd =0 ;/* default to highest possible threshold */ lpm_nyet_threshold =0xf ;
Greg Kroah-Hartman
maintainerPATCH 24/129 usb: dwc3: core: Only handle soft-reset in DCTL
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
commit f4fd84ae0765a80494b28c43b756a95100351a94 upstream.
Make sure not to set run_stop bit or link state change request while initiating soft-reset. Register read-modify-write operation may unintentionally start the controller before the initialization completes with its previous DCTL value, which can cause initialization failure.
--- drivers/usb/dwc3/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc3/core.c +2 -1
@@ -275,7 +275,8 @@ static int dwc3_core_soft_reset(struct d reg =dwc3_readl (dwc->regs,DWC3_DCTL ); reg |=DWC3_DCTL_CSFTRST ; -dwc3_writel (dwc->regs,DWC3_DCTL , reg); + reg &= ~DWC3_DCTL_RUN_STOP ; +dwc3_gadget_dctl_write_safe (dwc, reg);/* * For DWC_usb31 controller 1.90a and later, the DCTL.CSFRST bit
Greg Kroah-Hartman
maintainerPATCH 25/129 usb: dwc3: gadget: Return proper request status
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
commit c7428dbddcf4ea1919e1c8e15f715b94ca359268 upstream.
If the user sets the usb_request's no_interrupt, then there will be no completion event for the request. Currently the driver incorrectly uses the event status of a different request to report the status for a request with no_interrupt. The dwc3 driver needs to check the TRB status associated with the request when reporting its status.
Note: this is only applicable to missed_isoc TRB completion status, but the other status are also listed for completeness/documentation.
--- drivers/usb/dwc3/gadget.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +30 -1
@@ -2859,6 +2859,7 @@ static int dwc3_gadget_ep_cleanup_compleconst struct dwc3_event_depevt *event, struct dwc3_request *req, int status) { + int request_status;int ret;if (req->request.num_mapped_sgs)
@@ -2879,7 +2880,35 @@ static int dwc3_gadget_ep_cleanup_comple req->needs_extra_trb = false; } -dwc3_gadget_giveback (dep, req, status); +/* +* The event status only reflects the status of the TRB with IOC set. +* For the requests that don't set interrupt on completion, the driver +* needs to check and return the status of the completed TRBs associated +* with the request. Use the status of the last TRB of the request. +*/ +if (req->request.no_interrupt) { +struct dwc3_trb *trb; + + trb =dwc3_ep_prev_trb (dep, dep->trb_dequeue); +switch (DWC3_TRB_SIZE_TRBSTS (trb->size)) { +case DWC3_TRBSTS_MISSED_ISOC : +/* Isoc endpoint only */ + request_status = -EXDEV ; +break ; +case DWC3_TRB_STS_XFER_IN_PROG : +/* Applicable when End Transfer with ForceRM=0 */ +case DWC3_TRBSTS_SETUP_PENDING : +/* Control endpoint only */ +case DWC3_TRBSTS_OK : +default : + request_status =0 ; +break ; + } + }else { + request_status = status; + } + +dwc3_gadget_giveback (dep, req, request_status); out:return ret;
Greg Kroah-Hartman
maintainerPATCH 26/129 usb: cdns3: Fix issue for clear halt endpoint
In reply to Greg Kroah-HartmanFrom: Pawel Laszczak <[email protected]>
commit b3fa25de31fb7e9afebe9599b8ff32eda13d7c94 upstream.
Path fixes bug which occurs during resetting endpoint in __cdns3_gadget_ep_clear_halt function. During resetting endpoint controller will change HW/DMA owned TRB. It set Abort flag in trb->control and will change trb->length field. If driver want to use the aborted trb it must update the changed field in TRB.
--- drivers/usb/cdns3/gadget.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/cdns3/gadget.c +5 -2
@@ -2697,6 +2697,7 @@ int __cdns3_gadget_ep_clear_halt(structstruct usb_request *request;struct cdns3_request *priv_req;struct cdns3_trb *trb =NULL ; +struct cdns3_trb trb_tmp;int ret;int val;
@@ -2706,8 +2707,10 @@ int __cdns3_gadget_ep_clear_halt(structif (request) { priv_req =to_cdns3_request (request); trb = priv_req->trb; -if (trb) +if (trb) { + trb_tmp = *trb; trb->control = trb->control ^cpu_to_le32 (TRB_CYCLE ); + } }writel (EP_CMD_CSTALL |EP_CMD_EPRST , &priv_dev->regs->ep_cmd);
@@ -2722,7 +2725,7 @@ int __cdns3_gadget_ep_clear_halt(structif (request) {if (trb) - trb->control = trb->control ^cpu_to_le32 (TRB_CYCLE ); + *trb = trb_tmp;cdns3_rearm_transfer (priv_ep,1 ); }
Greg Kroah-Hartman
maintainerPATCH 27/129 usb: phy: generic: Get the vbus supply
In reply to Greg Kroah-HartmanFrom: Sean Anderson <[email protected]>
commit 03e607cbb2931374db1825f371e9c7f28526d3f4 upstream.
While support for working with a vbus was added, the regulator was never actually gotten (despite what was documented). Fix this by actually getting the supply from the device tree.
--- drivers/usb/phy/phy-generic.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/phy/phy-generic.c +7 -0
@@ -268,6 +268,13 @@ int usb_phy_gen_create_phy(struct devicereturn -EPROBE_DEFER ; } + nop->vbus_draw =devm_regulator_get_exclusive (dev,"vbus" ); +if (PTR_ERR (nop->vbus_draw) == -ENODEV ) + nop->vbus_draw =NULL ; +if (IS_ERR (nop->vbus_draw)) +return dev_err_probe (dev,PTR_ERR (nop->vbus_draw), +"could not get vbus regulator\n" ); + nop->dev = dev; nop->phy.dev = nop->dev; nop->phy.label ="nop-xceiv" ;
Greg Kroah-Hartman
maintainerPATCH 28/129 serial: imx: fix overrun interrupts in DMA mode
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 3ee82c6e41f3d2212647ce0bc5a05a0f69097824 upstream.
Commit 76821e222c18 ("serial: imx: ensure that RX irqs are off if RX is off") accidentally enabled overrun interrupts unconditionally when deferring DMA enable until after the receiver has been enabled during startup.
Fix this by using the DMA-initialised instead of DMA-enabled flag to determine whether overrun interrupts should be enabled.
Note that overrun interrupts are already accounted for in imx_uart_clear_rx_errors() when using DMA since commit 41d98b5da92f ("serial: imx-serial - update RX error counters when DMA is used").
--- drivers/tty/serial/imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/imx.c +1 -1
@@ -1470,7 +1470,7 @@ static int imx_uart_startup(struct uart_imx_uart_writel (sport, ucr1,UCR1 ); ucr4 =imx_uart_readl (sport,UCR4 ) & ~(UCR4_OREN |UCR4_INVR ); -if (!sport->dma_is_enabled) +if (!dma_is_inited) ucr4 |=UCR4_OREN ;if (sport->inverted_rx) ucr4 |=UCR4_INVR ;
Greg Kroah-Hartman
maintainerPATCH 29/129 serial: 8250: Also set sticky MCR bits in console restoration
In reply to Greg Kroah-HartmanFrom: Maciej W. Rozycki <[email protected]>
commit 6e6eebdf5e2455f089ccd000754a0deaeb79af82 upstream.
Sticky MCR bits are lost in console restoration if console suspending has been disabled. This currently affects the AFE bit, which works in combination with RTS which we set, so we want to make sure the UART retains control of its FIFO where previously requested. Also specific drivers may need other bits in the future.
--- drivers/tty/serial/8250/8250_port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_port.c +1 -1
@@ -3311,7 +3311,7 @@ static void serial8250_console_restore(sserial8250_set_divisor (port, baud, quot, frac);serial_port_out (port,UART_LCR , up->lcr); -serial8250_out_MCR (up,UART_MCR_DTR |UART_MCR_RTS ); +serial8250_out_MCR (up, up->mcr |UART_MCR_DTR |UART_MCR_RTS ); }/*
Greg Kroah-Hartman
maintainerPATCH 30/129 serial: 8250: Correct the clock for EndRun PTP/1588 PCIe device
In reply to Greg Kroah-HartmanFrom: Maciej W. Rozycki <[email protected]>
commit 637674fa40059cddcc3ad2212728965072f62ea3 upstream.
The EndRun PTP/1588 dual serial port device is based on the Oxford Semiconductor OXPCIe952 UART device with the PCI vendor:device ID set for EndRun Technologies and is therefore driven by a fixed 62.5MHz clock input derived from the 100MHz PCI Express clock. The clock rate is divided by the oversampling rate of 16 as it is supplied to the baud rate generator, yielding the baud base of 3906250.
Replace the incorrect baud base of 4000000 with the right value of 3906250 then, complementing commit 6cbe45d8ac93 ("serial: 8250: Correct the clock for OxSemi PCIe devices").
--- drivers/tty/serial/8250/8250_pci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/serial/8250/8250_pci.c +4 -4
@@ -2940,7 +2940,7 @@ enum pci_board_num_t { pbn_panacom2, pbn_panacom4, pbn_plx_romulus, - pbn_endrun_2_4000000, + pbn_endrun_2_3906250, pbn_oxsemi, pbn_oxsemi_1_4000000, pbn_oxsemi_2_4000000,
@@ -3468,10 +3468,10 @@ static struct pciserial_board pci_boards* signal now many ports are available * 2 port 952 Uart support */ - [pbn_endrun_2_4000000] = { + [pbn_endrun_2_3906250] = { .flags = FL_BASE0, .num_ports = 2, - .base_baud = 4000000, + .base_baud = 3906250, .uart_offset = 0x200, .first_offset = 0x1000, },
@@ -4386,7 +4386,7 @@ static const struct pci_device_id serial*/ {PCI_VENDOR_ID_ENDRUN ,PCI_DEVICE_ID_ENDRUN_1588 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_endrun_2_4000000 }, + pbn_endrun_2_3906250 },/* * Quatech cards. These actually have configurable clocks but for * now we just use the default.
Greg Kroah-Hartman
maintainerPATCH 31/129 arch_topology: Do not set llc_sibling if llc_id is invalid
In reply to Greg Kroah-HartmanFrom: Wang Qing <[email protected]>
commit 1dc9f1a66e1718479e1c4f95514e1750602a3cb9 upstream.
When ACPI is not enabled, cpuid_topo->llc_id = cpu_topo->llc_id = -1, which will set llc_sibling 0xff(...), this is misleading.
Don't set llc_sibling(default 0) if we don't know the cache topology.
--- drivers/base/arch_topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/arch_topology.c +1 -1
@@ -515,7 +515,7 @@ void update_siblings_masks(unsigned intfor_each_online_cpu (cpu) { cpu_topo = &cpu_topology[cpu]; -if (cpuid_topo->llc_id == cpu_topo->llc_id) { +if (cpu_topo->llc_id !=-1 && cpuid_topo->llc_id == cpu_topo->llc_id) {cpumask_set_cpu (cpu, &cpuid_topo->llc_sibling);cpumask_set_cpu (cpuid, &cpu_topo->llc_sibling); }
Greg Kroah-Hartman
maintainerPATCH 32/129 pinctrl: samsung: fix missing GPIOLIB on ARM64 Exynos config
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit ac875df4d854ab13d9c4af682a1837a1214fecec upstream.
The Samsung pinctrl drivers depend on OF_GPIO, which is part of GPIOLIB. ARMv7 Exynos platform selects GPIOLIB and Samsung pinctrl drivers. ARMv8 Exynos selects only the latter leading to possible wrong configuration on ARMv8 build:
WARNING: unmet direct dependencies detected for PINCTRL_EXYNOS
Depends on [n]: PINCTRL [=y] && OF_GPIO [=n] && (ARCH_EXYNOS [=y] || ARCH_S5PV210 || COMPILE_TEST [=y]) Selected by [y]:
- ARCH_EXYNOS [=y]
Always select the GPIOLIB from the Samsung pinctrl drivers to fix the issue. This requires removing of OF_GPIO dependency (to avoid recursive dependency), so add dependency on OF for COMPILE_TEST cases.
--- arch/arm/mach-exynos/Kconfig | 1 - drivers/pinctrl/samsung/Kconfig | 11 ++++------- 2 files changed, 4 insertions(+), 8 deletions(-)
arch/arm/mach-exynos/Kconfig +0 -1
@@ -20,7 +20,6 @@ menuconfig ARCH_EXYNOS select EXYNOS_PMU select EXYNOS_SROM select EXYNOS_PM_DOMAINS if PM_GENERIC_DOMAINS - select GPIOLIB select HAVE_ARM_ARCH_TIMER if ARCH_EXYNOS5 select HAVE_ARM_SCU if SMP select HAVE_S3C2410_I2C if I2C
drivers/pinctrl/samsung/Kconfig +4 -7
@@ -4,14 +4,13 @@ # config PINCTRL_SAMSUNG bool - depends on OF_GPIO + select GPIOLIB select PINMUX select PINCONF config PINCTRL_EXYNOS bool "Pinctrl common driver part for Samsung Exynos SoCs" - depends on OF_GPIO - depends on ARCH_EXYNOS || ARCH_S5PV210 || COMPILE_TEST + depends on ARCH_EXYNOS || ARCH_S5PV210 || (COMPILE_TEST && OF) select PINCTRL_SAMSUNG select PINCTRL_EXYNOS_ARM if ARM && (ARCH_EXYNOS || ARCH_S5PV210) select PINCTRL_EXYNOS_ARM64 if ARM64 && ARCH_EXYNOS
@@ -26,12 +25,10 @@ config PINCTRL_EXYNOS_ARM64 config PINCTRL_S3C24XX bool "Samsung S3C24XX SoC pinctrl driver" - depends on OF_GPIO - depends on ARCH_S3C24XX || COMPILE_TEST + depends on ARCH_S3C24XX || (COMPILE_TEST && OF) select PINCTRL_SAMSUNG config PINCTRL_S3C64XX bool "Samsung S3C64XX SoC pinctrl driver" - depends on OF_GPIO - depends on ARCH_S3C64XX || COMPILE_TEST + depends on ARCH_S3C64XX || (COMPILE_TEST && OF) select PINCTRL_SAMSUNG
Greg Kroah-Hartman
maintainerPATCH 33/129 hex2bin: make the function hex_to_bin constant-time
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
commit e5be15767e7e284351853cbaba80cde8620341fb upstream.
The function hex2bin is used to load cryptographic keys into device mapper targets dm-crypt and dm-integrity. It should take constant time independent on the processed data, so that concurrently running unprivileged code can't infer any information about the keys via microarchitectural convert channels.
This patch changes the function hex_to_bin so that it contains no branches and no memory accesses.
Note that this shouldn't cause performance degradation because the size of the new function is the same as the size of the old function (on x86-64) - and the new function causes no branch misprediction penalties.
I compile-tested this function with gcc on aarch64 alpha arm hppa hppa64 i386 ia64 m68k mips32 mips64 powerpc powerpc64 riscv sh4 s390x sparc32 sparc64 x86_64 and with clang on aarch64 arm hexagon i386 mips32 mips64 powerpc powerpc64 s390x sparc32 sparc64 x86_64 to verify that there are no branches in the generated code.
--- include/linux/kernel.h | 2 +- lib/hexdump.c | 32 +++++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 8 deletions(-)
include/linux/kernel.h +1 -1
@@ -635,7 +635,7 @@ static inline char *hex_byte_pack_upper(return buf; } -extern int hex_to_bin (char ch); +extern int hex_to_bin (unsigned char ch);extern int __must_check hex2bin (u8 *dst,const char *src,size_t count);extern char *bin2hex (char *dst,const void *src,size_t count);
lib/hexdump.c +25 -7
@@ -22,15 +22,33 @@ EXPORT_SYMBOL(hex_asc_upper);* * hex_to_bin() converts one hex digit to its actual value or -1 in case of bad * input. +* +* This function is used to load cryptographic keys, so it is coded in such a +* way that there are no conditions or memory accesses that depend on data. +* +* Explanation of the logic: +* (ch - '9' - 1) is negative if ch <= '9' +* ('0' - 1 - ch) is negative if ch >= '0' +* we "and" these two values, so the result is negative if ch is in the range +* '0' ... '9' +* we are only interested in the sign, so we do a shift ">> 8"; note that right +* shift of a negative value is implementation-defined, so we cast the +* value to (unsigned) before the shift --- we have 0xffffff if ch is in +* the range '0' ... '9', 0 otherwise +* we "and" this value with (ch - '0' + 1) --- we have a value 1 ... 10 if ch is +* in the range '0' ... '9', 0 otherwise +* we add this value to -1 --- we have a value 0 ... 9 if ch is in the range '0' +* ... '9', -1 otherwise +* the next line is similar to the previous one, but we need to decode both +* uppercase and lowercase letters, so we use (ch & 0xdf), which converts +* lowercase to uppercase */ -int hex_to_bin (char ch) +int hex_to_bin (unsigned char ch) { -if ((ch >='0' ) && (ch <='9' )) -return ch -'0' ; - ch =tolower (ch); -if ((ch >='a' ) && (ch <='f' )) -return ch -'a' +10 ; -return -1 ; +unsigned char cu = ch &0xdf ; +return -1 + + ((ch -'0' +1 ) & (unsigned )((ch -'9' -1 ) & ('0' -1 - ch)) >>8 ) + + ((cu -'A' +11 ) & (unsigned )((cu -'F' -1 ) & ('A' -1 - cu)) >>8 ); }EXPORT_SYMBOL (hex_to_bin);
Greg Kroah-Hartman
maintainerPATCH 34/129 hex2bin: fix access beyond string end
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
commit e4d8a29997731b3bb14059024b24df9f784288d0 upstream.
If we pass too short string to "hex2bin" (and the string size without the terminating NUL character is even), "hex2bin" reads one byte after the terminating NUL character. This patch fixes it.
Note that hex_to_bin returns -1 on error and hex2bin return -EINVAL on error - so we can't just return the variable "hi" or "lo" on error. This inconsistency may be fixed in the next merge window, but for the purpose of fixing this bug, we just preserve the existing behavior and return -1 and -EINVAL.
--- lib/hexdump.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
lib/hexdump.c +6 -3
@@ -63,10 +63,13 @@ EXPORT_SYMBOL(hex_to_bin);int hex2bin (u8 *dst,const char *src,size_t count) {while (count--) { -int hi =hex_to_bin (*src++); -int lo =hex_to_bin (*src++); +int hi, lo; -if ((hi <0 ) || (lo <0 )) + hi =hex_to_bin (*src++); +if (unlikely (hi <0 )) +return -EINVAL ; + lo =hex_to_bin (*src++); +if (unlikely (lo <0 ))return -EINVAL ; *dst++ = (hi <<4 ) | lo;
Greg Kroah-Hartman
maintainerPATCH 35/129 riscv: patch_text: Fixup last cpu should be master
In reply to Greg Kroah-HartmanFrom: Guo Ren <[email protected]>
commit 8ec1442953c66a1d8462cccd8c20b7ba561f5915 upstream.
These patch_text implementations are using stop_machine_cpuslocked infrastructure with atomic cpu_count. The original idea: When the master CPU patch_text, the others should wait for it. But current implementation is using the first CPU as master, which couldn't guarantee the remaining CPUs are waiting. This patch changes the last CPU as the master to solve the potential risk.
--- arch/riscv/kernel/patch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/patch.c +1 -1
@@ -100,7 +100,7 @@ static int patch_text_cb(void *data)struct patch_insn *patch = data;int ret =0 ; -if (atomic_inc_return (&patch->cpu_count) ==1 ) { +if (atomic_inc_return (&patch->cpu_count) ==num_online_cpus ()) { ret =patch_text_nosync (patch->addr, &patch->insn,GET_INSN_LENGTH (patch->insn));
Greg Kroah-Hartman
maintainerPATCH 36/129 x86/pci/xen: Disable PCI/MSI[-X] masking for XEN_HVM guests
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit 7e0815b3e09986d2fe651199363e135b9358132a upstream.
When a XEN_HVM guest uses the XEN PIRQ/Eventchannel mechanism, then PCI/MSI[-X] masking is solely controlled by the hypervisor, but contrary to XEN_PV guests this does not disable PCI/MSI[-X] masking in the PCI/MSI layer.
This can lead to a situation where the PCI/MSI layer masks an MSI[-X] interrupt and the hypervisor grants the write despite the fact that it already requested the interrupt. As a consequence interrupt delivery on the affected device is not happening ever.
Set pci_msi_ignore_mask to prevent that like it's done for XEN_PV guests already.
--- arch/x86/pci/xen.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/x86/pci/xen.c +5 -1
@@ -476,7 +476,6 @@ static __init void xen_setup_pci_msi(voi xen_msi_ops.setup_msi_irqs = xen_setup_msi_irqs; } xen_msi_ops.teardown_msi_irqs = xen_pv_teardown_msi_irqs; - pci_msi_ignore_mask =1 ; }else if (xen_hvm_domain ()) { xen_msi_ops.setup_msi_irqs = xen_hvm_setup_msi_irqs; xen_msi_ops.teardown_msi_irqs = xen_teardown_msi_irqs;
@@ -490,6 +489,11 @@ static __init void xen_setup_pci_msi(voi* in allocating the native domain and never use it. */ x86_init.irqs.create_pci_msi_domain = xen_create_pci_msi_domain; +/* +* With XEN PIRQ/Eventchannels in use PCI/MSI[-X] masking is solely +* controlled by the hypervisor. +*/ + pci_msi_ignore_mask = 1; }#else /* CONFIG_PCI_MSI */
Greg Kroah-Hartman
maintainerPATCH 37/129 iocost: dont reset the inuse weight of under-weighted debtors
In reply to Greg Kroah-HartmanFrom: Tejun Heo <[email protected]>
commit 8c936f9ea11ec4e35e288810a7503b5c841a355f upstream.
When an iocg is in debt, its inuse weight is owned by debt handling and should stay at 1. This invariant was broken when determining the amount of surpluses at the beginning of donation calculation - when an iocg's hierarchical weight is too low, the iocg is excluded from donation calculation and its inuse is reset to its active regardless of its indebtedness, triggering warnings like the following:
WARNING: CPU: 5 PID: 0 at block/blk-iocost.c:1416 iocg_kick_waitq+0x392/0x3a0 ... RIP: 0010:iocg_kick_waitq+0x392/0x3a0 Code: 00 00 be ff ff ff ff 48 89 4d a8 e8 98 b2 70 00 48 8b 4d a8 85 c0 0f 85 4a fe ff ff 0f 0b e9 43 fe ff ff 0f 0b e9 4d fe ff ff <0f> 0b e9 50 fe ff ff e8 a2 ae 70 00 66 90 0f 1f 44 00 00 55 48 89 RSP: 0018:ffffc90000200d08 EFLAGS: 00010016 ... <IRQ> ioc_timer_fn+0x2e0/0x1470 call_timer_fn+0xa1/0x2c0 ...
As this happens only when an iocg's hierarchical weight is negligible, its impact likely is limited to triggering the warnings. Fix it by skipping resetting inuse of under-weighted debtors.
--- block/blk-iocost.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
block/blk-iocost.c +11 -1
@@ -2257,7 +2257,17 @@ static void ioc_timer_fn(struct timer_li iocg->hweight_donating = hwa; iocg->hweight_after_donation = new_hwi;list_add (&iocg->surplus_list, &surpluses); - }else { + }else if (!iocg->abs_vdebt) { +/* +* @iocg doesn't have enough to donate. Reset +* its inuse to active. +* +* Don't reset debtors as their inuse's are +* owned by debt handling. This shouldn't affect +* donation calculuation in any meaningful way +* as @iocg doesn't have a meaningful amount of +* share anyway. +*/ TRACE_IOCG_PATH (inuse_shortage, iocg, &now, iocg->inuse, iocg->active, iocg->hweight_inuse, new_hwi);
Greg Kroah-Hartman
maintainerPATCH 38/129 video: fbdev: udlfb: properly check endpoint type
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit aaf7dbe07385e0b8deb7237eca2a79926bbc7091 ]
syzbot reported warning in usb_submit_urb, which is caused by wrong endpoint type.
This driver uses out bulk endpoint for communication, so let's check if this endpoint is present and bail out early if not.
Fail log:
usb 1-1: BOGUS urb xfer, pipe 3 != type 1
WARNING: CPU: 0 PID: 4822 at drivers/usb/core/urb.c:493 usb_submit_urb+0xd27/0x1540 drivers/usb/core/urb.c:493 Modules linked in: CPU: 0 PID: 4822 Comm: kworker/0:3 Tainted: G W 5.13.0-syzkaller #0 ... Workqueue: usb_hub_wq hub_event RIP: 0010:usb_submit_urb+0xd27/0x1540 drivers/usb/core/urb.c:493 ... Call Trace: dlfb_submit_urb+0x89/0x160 drivers/video/fbdev/udlfb.c:1969 dlfb_set_video_mode+0x21f0/0x2950 drivers/video/fbdev/udlfb.c:315 dlfb_ops_set_par+0x2a3/0x840 drivers/video/fbdev/udlfb.c:1110 dlfb_usb_probe.cold+0x113e/0x1f4a drivers/video/fbdev/udlfb.c:1732 usb_probe_interface+0x315/0x7f0 drivers/usb/core/driver.c:396
--- drivers/video/fbdev/udlfb.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/video/fbdev/udlfb.c +12 -2
@@ -1649,8 +1649,9 @@ static int dlfb_usb_probe(struct usb_interface *intf,const struct device_attribute *attr;struct dlfb_data *dlfb;struct fb_info *info; -int retval = -ENOMEM ; +int retval;struct usb_device *usbdev =interface_to_usbdev (intf); +struct usb_endpoint_descriptor *out;/* usb initialization */ dlfb =kzalloc (sizeof (*dlfb),GFP_KERNEL );
@@ -1664,6 +1665,12 @@ static int dlfb_usb_probe(struct usb_interface *intf, dlfb->udev =usb_get_dev (usbdev);usb_set_intfdata (intf, dlfb); + retval =usb_find_common_endpoints (intf->cur_altsetting,NULL , &out,NULL ,NULL ); +if (retval) { +dev_err (&intf->dev,"Device should have at lease 1 bulk endpoint!\n" ); + goto error; + } +dev_dbg (&intf->dev,"console enable=%d\n" , console);dev_dbg (&intf->dev,"fb_defio enable=%d\n" , fb_defio);dev_dbg (&intf->dev,"shadow enable=%d\n" , shadow);
@@ -1673,6 +1680,7 @@ static int dlfb_usb_probe(struct usb_interface *intf,if (!dlfb_parse_vendor_descriptor (dlfb, intf)) {dev_err (&intf->dev,"firmware not recognized, incompatible device?\n" ); + retval = -ENODEV ; goto error; }
@@ -1686,8 +1694,10 @@ static int dlfb_usb_probe(struct usb_interface *intf,/* allocates framebuffer driver structure, not framebuffer memory */ info =framebuffer_alloc (0 , &dlfb->udev->dev); -if (!info) +if (!info) { + retval = -ENOMEM ; goto error; + } dlfb->info = info; info->par = dlfb;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 39/129 arm64: dts: meson: remove CPU opps below 1GHz for G12B boards
In reply to Greg Kroah-HartmanFrom: Christian Hewitt <[email protected]>
[ Upstream commit 6c4d636bc00dc17c63ffb2a73a0da850240e26e3 ]
Amlogic G12B devices experience CPU stalls and random board wedges when the system idles and CPU cores clock down to lower opp points. Recent vendor kernels include a change to remove 100-250MHz and other distro sources also remove the 500/667MHz points. Unless all 100-667Mhz opps are removed or the CPU governor forced to performance stalls are still observed, so let's remove them to improve stability and uptime.
--- .../boot/dts/amlogic/meson-g12b-a311d.dtsi | 40 ------------------- .../boot/dts/amlogic/meson-g12b-s922x.dtsi | 40 ------------------- 2 files changed, 80 deletions(-)
arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi +0 -40
@@ -11,26 +11,6 @@ cpu_opp_table_0: opp-table-0 { compatible = "operating-points-v2"; opp-shared; - opp-100000000 { - opp-hz = /bits/ 64 <100000000>; - opp-microvolt = <731000>; - }; - - opp-250000000 { - opp-hz = /bits/ 64 <250000000>; - opp-microvolt = <731000>; - }; - - opp-500000000 { - opp-hz = /bits/ 64 <500000000>; - opp-microvolt = <731000>; - }; - - opp-667000000 { - opp-hz = /bits/ 64 <667000000>; - opp-microvolt = <731000>; - }; - opp-1000000000 { opp-hz = /bits/ 64 <1000000000>; opp-microvolt = <761000>;
@@ -71,26 +51,6 @@ cpub_opp_table_1: opp-table-1 { compatible = "operating-points-v2"; opp-shared; - opp-100000000 { - opp-hz = /bits/ 64 <100000000>; - opp-microvolt = <731000>; - }; - - opp-250000000 { - opp-hz = /bits/ 64 <250000000>; - opp-microvolt = <731000>; - }; - - opp-500000000 { - opp-hz = /bits/ 64 <500000000>; - opp-microvolt = <731000>; - }; - - opp-667000000 { - opp-hz = /bits/ 64 <667000000>; - opp-microvolt = <731000>; - }; - opp-1000000000 { opp-hz = /bits/ 64 <1000000000>; opp-microvolt = <731000>;
arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi +0 -40
@@ -11,26 +11,6 @@ cpu_opp_table_0: opp-table-0 { compatible = "operating-points-v2"; opp-shared; - opp-100000000 { - opp-hz = /bits/ 64 <100000000>; - opp-microvolt = <731000>; - }; - - opp-250000000 { - opp-hz = /bits/ 64 <250000000>; - opp-microvolt = <731000>; - }; - - opp-500000000 { - opp-hz = /bits/ 64 <500000000>; - opp-microvolt = <731000>; - }; - - opp-667000000 { - opp-hz = /bits/ 64 <667000000>; - opp-microvolt = <731000>; - }; - opp-1000000000 { opp-hz = /bits/ 64 <1000000000>; opp-microvolt = <731000>;
@@ -76,26 +56,6 @@ cpub_opp_table_1: opp-table-1 { compatible = "operating-points-v2"; opp-shared; - opp-100000000 { - opp-hz = /bits/ 64 <100000000>; - opp-microvolt = <751000>; - }; - - opp-250000000 { - opp-hz = /bits/ 64 <250000000>; - opp-microvolt = <751000>; - }; - - opp-500000000 { - opp-hz = /bits/ 64 <500000000>; - opp-microvolt = <751000>; - }; - - opp-667000000 { - opp-hz = /bits/ 64 <667000000>; - opp-microvolt = <751000>; - }; - opp-1000000000 { opp-hz = /bits/ 64 <1000000000>; opp-microvolt = <771000>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 40/129 arm64: dts: meson: remove CPU opps below 1GHz for SM1 boards
In reply to Greg Kroah-HartmanFrom: Christian Hewitt <[email protected]>
[ Upstream commit fd86d85401c2049f652293877c0f7e6e5afc3bbc ]
Amlogic SM1 devices experience CPU stalls and random board wedges when the system idles and CPU cores clock down to lower opp points. Recent vendor kernels include a change to remove 100-250MHz and other distro sources also remove the 500/667MHz points. Unless all 100-667Mhz opps are removed or the CPU governor forced to performance stalls are still observed, so let's remove them to improve stability and uptime.
--- arch/arm64/boot/dts/amlogic/meson-sm1.dtsi | 20 -------------------- 1 file changed, 20 deletions(-)
arch/arm64/boot/dts/amlogic/meson-sm1.dtsi +0 -20
@@ -95,26 +95,6 @@ cpu_opp_table: opp-table { compatible = "operating-points-v2"; opp-shared; - opp-100000000 { - opp-hz = /bits/ 64 <100000000>; - opp-microvolt = <730000>; - }; - - opp-250000000 { - opp-hz = /bits/ 64 <250000000>; - opp-microvolt = <730000>; - }; - - opp-500000000 { - opp-hz = /bits/ 64 <500000000>; - opp-microvolt = <730000>; - }; - - opp-667000000 { - opp-hz = /bits/ 64 <666666666>; - opp-microvolt = <750000>; - }; - opp-1000000000 { opp-hz = /bits/ 64 <1000000000>; opp-microvolt = <770000>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 41/129 iio:imu:bmi160: disable regulator in error path
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
[ Upstream commit d926054d5565d3cfa2c7c3f7a48e79bcc10453ed ]
Regulator should be disabled in error path as mentioned in _regulator_put(). Also disable accel if gyro cannot be enabled.
[ 16.233604] WARNING: CPU: 0 PID: 2177 at drivers/regulator/core.c:2257 _regulator_put [ 16.240453] Call Trace: [ 16.240572] <TASK> [ 16.240676] regulator_put+0x26/0x40 [ 16.240853] regulator_bulk_free+0x26/0x50 [ 16.241050] release_nodes+0x3f/0x70 [ 16.241225] devres_release_group+0x147/0x1c0 [ 16.241441] ? bmi160_core_probe+0x175/0x3a0 [bmi160_core]
--- drivers/iio/imu/bmi160/bmi160_core.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/iio/imu/bmi160/bmi160_core.c +14 -6
@@ -731,7 +731,7 @@ static int bmi160_chip_init(struct bmi160_data *data, bool use_spi) ret =regmap_write (data->regmap,BMI160_REG_CMD ,BMI160_CMD_SOFTRESET );if (ret) -return ret; + goto disable_regulator;usleep_range (BMI160_SOFTRESET_USLEEP ,BMI160_SOFTRESET_USLEEP +1 );
@@ -742,29 +742,37 @@ static int bmi160_chip_init(struct bmi160_data *data, bool use_spi)if (use_spi) { ret =regmap_read (data->regmap,BMI160_REG_DUMMY , &val);if (ret) -return ret; + goto disable_regulator; } ret =regmap_read (data->regmap,BMI160_REG_CHIP_ID , &val);if (ret) {dev_err (dev,"Error reading chip id\n" ); -return ret; + goto disable_regulator; }if (val !=BMI160_CHIP_ID_VAL ) {dev_err (dev,"Wrong chip id, got %x expected %x\n" , val,BMI160_CHIP_ID_VAL ); -return -ENODEV ; + ret = -ENODEV ; + goto disable_regulator; } ret =bmi160_set_mode (data,BMI160_ACCEL , true);if (ret) -return ret; + goto disable_regulator; ret =bmi160_set_mode (data,BMI160_GYRO , true);if (ret) -return ret; + goto disable_accel;return 0 ; + +disable_accel: +bmi160_set_mode (data,BMI160_ACCEL , false); + +disable_regulator: +regulator_bulk_disable (ARRAY_SIZE (data->supplies), data->supplies); +return ret; } static int bmi160_data_rdy_trigger_set_state(struct iio_trigger *trig,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 42/129 mtd: rawnand: fix ecc parameters for mt7622
In reply to Greg Kroah-HartmanFrom: Chuanhong Guo <[email protected]>
[ Upstream commit 9fe4e0d3cbfe90152137963cc024ecb63db6e8e6 ]
According to the datasheet, mt7622 only has 5 ECC capabilities instead of 7, and the decoding error register is arranged as follows:
+------+---------+---------+---------+---------+ | Bits | 19:15 | 14:10 | 9:5 | 4:0 | +------+---------+---------+---------+---------+ | Name | ERRNUM3 | ERRNUM2 | ERRNUM1 | ERRNUM0 | +------+---------+---------+---------+---------+
This means err_mask should be 0x1f instead of 0x3f and the number of bits shifted in mtk_ecc_get_stats should be 5 instead of 8.
This commit introduces err_shift for the difference in this register and fix other existing parameters.
Public MT7622 reference manual can be found on [0] and the info this commit is based on is from page 656 and page 660.
[0]: https://wiki.banana-pi.org/Banana_Pi_BPI-R64#Documents
--- drivers/mtd/nand/raw/mtk_ecc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/mtd/nand/raw/mtk_ecc.c +8 -4
@@ -43,6 +43,7 @@struct mtk_ecc_caps {u32 err_mask; +u32 err_shift;const u8 *ecc_strength;const u32 *ecc_regs;u8 num_ecc_strength;
@@ -76,7 +77,7 @@ static const u8 ecc_strength_mt2712[] = { };static const u8 ecc_strength_mt7622[] = { -4 ,6 ,8 ,10 ,12 ,14 ,16 +4 ,6 ,8 ,10 ,12 };enum mtk_ecc_regs {
@@ -221,7 +222,7 @@ void mtk_ecc_get_stats(struct mtk_ecc *ecc, struct mtk_ecc_stats *stats,for (i =0 ; i < sectors; i++) { offset = (i >>2 ) <<2 ; err =readl (ecc->regs +ECC_DECENUM0 + offset); - err = err >> ((i %4 ) *8 ); + err = err >> ((i %4 ) * ecc->caps->err_shift); err &= ecc->caps->err_mask;if (err == ecc->caps->err_mask) {/* uncorrectable errors */
@@ -449,6 +450,7 @@ EXPORT_SYMBOL(mtk_ecc_get_parity_bits);static const struct mtk_ecc_caps mtk_ecc_caps_mt2701 = { .err_mask =0x3f , + .err_shift =8 , .ecc_strength = ecc_strength_mt2701, .ecc_regs = mt2701_ecc_regs, .num_ecc_strength =20 ,
@@ -459,6 +461,7 @@ static const struct mtk_ecc_caps mtk_ecc_caps_mt2701 = {static const struct mtk_ecc_caps mtk_ecc_caps_mt2712 = { .err_mask =0x7f , + .err_shift =8 , .ecc_strength = ecc_strength_mt2712, .ecc_regs = mt2712_ecc_regs, .num_ecc_strength =23 ,
@@ -468,10 +471,11 @@ static const struct mtk_ecc_caps mtk_ecc_caps_mt2712 = { };static const struct mtk_ecc_caps mtk_ecc_caps_mt7622 = { - .err_mask =0x3f , + .err_mask =0x1f , + .err_shift =5 , .ecc_strength = ecc_strength_mt7622, .ecc_regs = mt7622_ecc_regs, - .num_ecc_strength =7 , + .num_ecc_strength =5 , .ecc_mode_shift =4 , .parity_bits =13 , .pg_irq_sel =0 ,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 43/129 USB: Fix xhci event ring dequeue pointer ERDP update issue
In reply to Greg Kroah-HartmanFrom: Weitao Wang <[email protected]>
[ Upstream commit e91ac20889d1a26d077cc511365cd7ff4346a6f3 ]
In some situations software handles TRB events slower than adding TRBs. If the number of TRB events to be processed in a given interrupt is exactly the same as the event ring size 256, then the local variable "event_ring_deq" that holds the initial dequeue position is equal to software_dequeue after handling all 256 interrupts.
It will cause driver to not update ERDP to hardware,
Software dequeue pointer is out of sync with ERDP on interrupt exit. On the next interrupt, the event ring may full but driver will not update ERDP as software_dequeue is equal to ERDP.
[ 536.377115] xhci_hcd 0000:00:12.0: ERROR unknown event type 37 [ 566.933173] sd 8:0:0:0: [sdb] tag#27 uas_eh_abort_handler 0 uas-tag 7 inflight: CMD OUT [ 566.933181] sd 8:0:0:0: [sdb] tag#27 CDB: Write(10) 2a 00 17 71 e6 78 00 00 08 00 [ 572.041186] xhci_hcd On some situataions,the0000:00:12.0: xHCI host not responding to stop endpoint command. [ 572.057193] xhci_hcd 0000:00:12.0: Host halt failed, -110 [ 572.057196] xhci_hcd 0000:00:12.0: xHCI host controller not responding, assume dead [ 572.057236] sd 8:0:0:0: [sdb] tag#26 uas_eh_abort_handler 0 uas-tag 6 inflight: CMD [ 572.057240] sd 8:0:0:0: [sdb] tag#26 CDB: Write(10) 2a 00 38 eb cc d8 00 00 08 00 [ 572.057244] sd 8:0:0:0: [sdb] tag#25 uas_eh_abort_handler 0 uas-tag 5 inflight: CMD
Hardware ERDP is updated mid event handling if there are more than 128 events in an interrupt (half of ring size).
Fix this by updating the software local variable at the same time as hardware ERDP.
[commit message rewording -Mathias]
--- drivers/usb/host/xhci-ring.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/host/xhci-ring.c +2 -0
@@ -2969,6 +2969,8 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)if (event_loop++ <TRBS_PER_SEGMENT /2 )continue ;xhci_update_erst_dequeue (xhci, event_ring_deq); + event_ring_deq = xhci->event_ring->dequeue; + event_loop =0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 44/129 ARM: dts: imx6qdl-apalis: Fix sgtl5000 detection issue
In reply to Greg Kroah-HartmanFrom: Fabio Estevam <[email protected]>
[ Upstream commit fa51e1dc4b91375bc18349663a52395ad585bd3c ]
On a custom carrier board with a i.MX6Q Apalis SoM, the sgtl5000 codec on the SoM is often not detected and the following error message is seen when the sgtl5000 driver tries to read the ID register:
sgtl5000 1-000a: Error reading chip id -6
The reason for the error is that the MCLK clock is not provided early enough.
Fix the problem by describing the MCLK pinctrl inside the codec node instead of placing it inside the audmux pinctrl group.
With this change applied the sgtl5000 is always detected on every boot.
--- arch/arm/boot/dts/imx6qdl-apalis.dtsi | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
arch/arm/boot/dts/imx6qdl-apalis.dtsi +8 -2
@@ -286,6 +286,8 @@ vgen6_reg: vgen6 { codec: sgtl5000@a { compatible = "fsl,sgtl5000"; reg = <0x0a>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_sgtl5000>; clocks = <&clks IMX6QDL_CLK_CKO>; VDDA-supply = <®_module_3v3_audio>; VDDIO-supply = <®_module_3v3>;
@@ -516,8 +518,6 @@ MX6QDL_PAD_DISP0_DAT20__AUD4_TXC 0x130b0 MX6QDL_PAD_DISP0_DAT21__AUD4_TXD 0x130b0 MX6QDL_PAD_DISP0_DAT22__AUD4_TXFS 0x130b0 MX6QDL_PAD_DISP0_DAT23__AUD4_RXD 0x130b0 - /* SGTL5000 sys_mclk */ - MX6QDL_PAD_GPIO_5__CCM_CLKO1 0x130b0 >; };
@@ -810,6 +810,12 @@ MX6QDL_PAD_NANDF_CS1__GPIO6_IO14 0x000b0 >; }; + pinctrl_sgtl5000: sgtl5000grp { + fsl,pins = < + MX6QDL_PAD_GPIO_5__CCM_CLKO1 0x130b0 + >; + }; + pinctrl_spdif: spdifgrp { fsl,pins = < MX6QDL_PAD_GPIO_16__SPDIF_IN 0x1b0b0
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 45/129 phy: samsung: Fix missing of_node_put() in exynos_sata_phy_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 388ec8f079f2f20d5cd183c3bc6f33cbc3ffd3ef ]
The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done.
--- drivers/phy/samsung/phy-exynos5250-sata.c | 1 + 1 file changed, 1 insertion(+)
drivers/phy/samsung/phy-exynos5250-sata.c +1 -0
@@ -190,6 +190,7 @@ static int exynos_sata_phy_probe(struct platform_device *pdev)return -EINVAL ; sata_phy->client =of_find_i2c_device_by_node (node); +of_node_put (node);if (!sata_phy->client)return -EPROBE_DEFER ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 46/129 phy: samsung: exynos5250-sata: fix missing device put in probe error paths
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 5c8402c4db45dd55c2c93c8d730f5dfa7c78a702 ]
The actions of of_find_i2c_device_by_node() in probe function should be reversed in error paths by putting the reference to obtained device.
--- drivers/phy/samsung/phy-exynos5250-sata.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/phy/samsung/phy-exynos5250-sata.c +14 -6
@@ -199,20 +199,21 @@ static int exynos_sata_phy_probe(struct platform_device *pdev) sata_phy->phyclk =devm_clk_get (dev,"sata_phyctrl" );if (IS_ERR (sata_phy->phyclk)) {dev_err (dev,"failed to get clk for PHY\n" ); -return PTR_ERR (sata_phy->phyclk); + ret =PTR_ERR (sata_phy->phyclk); + goto put_dev; } ret =clk_prepare_enable (sata_phy->phyclk);if (ret <0 ) {dev_err (dev,"failed to enable source clk\n" ); -return ret; + goto put_dev; } sata_phy->phy =devm_phy_create (dev,NULL , &exynos_sata_phy_ops);if (IS_ERR (sata_phy->phy)) { -clk_disable_unprepare (sata_phy->phyclk);dev_err (dev,"failed to create PHY\n" ); -return PTR_ERR (sata_phy->phy); + ret =PTR_ERR (sata_phy->phy); + goto clk_disable; }phy_set_drvdata (sata_phy->phy, sata_phy);
@@ -220,11 +221,18 @@ static int exynos_sata_phy_probe(struct platform_device *pdev) phy_provider =devm_of_phy_provider_register (dev, of_phy_simple_xlate);if (IS_ERR (phy_provider)) { -clk_disable_unprepare (sata_phy->phyclk); -return PTR_ERR (phy_provider); + ret =PTR_ERR (phy_provider); + goto clk_disable; }return 0 ; + +clk_disable: +clk_disable_unprepare (sata_phy->phyclk); +put_dev: +put_device (&sata_phy->client->dev); + +return ret; }static const struct of_device_id exynos_sata_phy_of_match[] = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 47/129 ARM: OMAP2+: Fix refcount leak in omap_gic_of_init
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 0f83e6b4161617014017a694888dd8743f46f071 ]
The of_find_compatible_node() function returns a node pointer with refcount incremented, We should use of_node_put() on it when done Add the missing of_node_put() to release the refcount.
Message-Id: <[email protected]>
--- arch/arm/mach-omap2/omap4-common.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-omap2/omap4-common.c +2 -0
@@ -314,10 +314,12 @@ void __init omap_gic_of_init(void) np =of_find_compatible_node (NULL ,NULL ,"arm,cortex-a9-gic" ); gic_dist_base_addr =of_iomap (np,0 ); +of_node_put (np);WARN_ON (!gic_dist_base_addr); np =of_find_compatible_node (NULL ,NULL ,"arm,cortex-a9-twd-timer" ); twd_base =of_iomap (np,0 ); +of_node_put (np);WARN_ON (!twd_base); skip_errata_init:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 48/129 bus: ti-sysc: Make omap3 gpt12 quirk handling SoC specific
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit a12315d6d27093392b6c634e1d35a59f1d1f7a59 ]
On beagleboard revisions A to B4 we need to use gpt12 as the system timer. However, the quirk handling added for gpt12 caused a regression for system suspend for am335x as the PM coprocessor needs the timers idled for suspend.
Let's make the gpt12 quirk specific to omap34xx, other SoCs don't need it. Beagleboard revisions C and later no longer need to use the gpt12 related quirk. Then at some point, if we decide to drop support for the old beagleboard revisions A to B4, we can also drop the gpt12 related quirks completely.
--- drivers/bus/ti-sysc.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/bus/ti-sysc.c +15 -1
@@ -3130,13 +3130,27 @@ static int sysc_check_disabled_devices(struct sysc *ddata)*/ static int sysc_check_active_timer (struct sysc *ddata) { +int error; +if (ddata->cap->type !=TI_SYSC_OMAP2_TIMER && ddata->cap->type !=TI_SYSC_OMAP4_TIMER )return 0 ; +/* +* Quirk for omap3 beagleboard revision A to B4 to use gpt12. +* Revision C and later are fixed with commit 23885389dbbb ("ARM: +* dts: Fix timer regression for beagleboard revision c"). This all +* can be dropped if we stop supporting old beagleboard revisions +* A to B4 at some point. +*/ +if (sysc_soc->soc ==SOC_3430 ) + error = -ENXIO ; +else + error = -EBUSY ; +if ((ddata->cfg.quirks &SYSC_QUIRK_NO_RESET_ON_INIT ) && (ddata->cfg.quirks &SYSC_QUIRK_NO_IDLE )) -return -ENXIO ; +return error;return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 49/129 phy: ti: omap-usb2: Fix error handling in omap_usb2_enable_clocks
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 3588060befff75ff39fab7122b94c6fb3148fcda ]
The corresponding API for clk_prepare_enable is clk_disable_unprepare. Make sure that the clock is unprepared on exit by changing clk_disable to clk_disable_unprepare.
--- drivers/phy/ti/phy-omap-usb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/ti/phy-omap-usb2.c +1 -1
@@ -215,7 +215,7 @@ static int omap_usb2_enable_clocks(struct omap_usb *phy)return 0 ; err1: -clk_disable (phy->wkupclk); +clk_disable_unprepare (phy->wkupclk); err0:return ret;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 50/129 ARM: dts: at91: Map MCLK for wm8731 on at91sam9g20ek
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 0e486fe341fabd8e583f3d601a874cd394979c45 ]
The MCLK of the WM8731 on the AT91SAM9G20-EK board is connected to the PCK0 output of the SoC and is expected to be set to 12MHz. Previously this was mapped using pre-common clock API calls in the audio machine driver but the conversion to the common clock framework broke that so describe things in the DT instead.
--- arch/arm/boot/dts/at91sam9g20ek_common.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/boot/dts/at91sam9g20ek_common.dtsi +6 -0
@@ -219,6 +219,12 @@ i2c-gpio-0 { wm8731: wm8731@1b { compatible = "wm8731"; reg = <0x1b>; + + /* PCK0 at 12MHz */ + clocks = <&pmc PMC_TYPE_SYSTEM 8>; + clock-names = "mclk"; + assigned-clocks = <&pmc PMC_TYPE_SYSTEM 8>; + assigned-clock-rates = <12000000>; }; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 51/129 ARM: dts: at91: sama5d4_xplained: fix pinctrl phandle name
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 5c8b49852910caffeebb1ce541fdd264ffc691b8 ]
Pinctrl phandle is for spi1 so rename it to reflect this.
--- arch/arm/boot/dts/at91-sama5d4_xplained.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/at91-sama5d4_xplained.dts +2 -2
@@ -91,7 +91,7 @@ usart4: serial@fc010000 { spi1: spi@fc018000 { pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_spi0_cs>; + pinctrl-0 = <&pinctrl_spi1_cs>; cs-gpios = <&pioB 21 0>; status = "okay"; };
@@ -149,7 +149,7 @@ pinctrl_macb0_phy_irq: macb0_phy_irq_0 { atmel,pins = <AT91_PIOE 1 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; }; - pinctrl_spi0_cs: spi0_cs_default { + pinctrl_spi1_cs: spi1_cs_default { atmel,pins = <AT91_PIOB 21 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 52/129 phy: mapphone-mdm6600: Fix PM error handling in phy_mdm6600_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit d644e0d79829b1b9a14beedbdb0dc1256fc3677d ]
The pm_runtime_enable will increase power disable depth. If the probe fails, we should use pm_runtime_disable() to balance pm_runtime_enable(). And use pm_runtime_dont_use_autosuspend() to undo pm_runtime_use_autosuspend()
In the PM Runtime docs:
Drivers in ->remove() callback should undo the runtime PM changes done
in ->probe(). Usually this means calling pm_runtime_disable(),
pm_runtime_dont_use_autosuspend() etc.We should do this in error handling.
--- drivers/phy/motorola/phy-mapphone-mdm6600.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/phy/motorola/phy-mapphone-mdm6600.c +2 -1
@@ -629,7 +629,8 @@ static int phy_mdm6600_probe(struct platform_device *pdev) cleanup:if (error <0 )phy_mdm6600_device_power_off (ddata); - +pm_runtime_disable (ddata->dev); +pm_runtime_dont_use_autosuspend (ddata->dev);return error; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 53/129 phy: ti: Add missing pm_runtime_disable() in serdes_am654_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit ce88613e5bd579478653a028291098143f2a5bdf ]
The pm_runtime_enable() will increase power disable depth. If the probe fails, we should use pm_runtime_disable() to balance pm_runtime_enable().
Add missing pm_runtime_disable() for serdes_am654_probe().
--- drivers/phy/ti/phy-am654-serdes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/ti/phy-am654-serdes.c +1 -1
@@ -838,7 +838,7 @@ static int serdes_am654_probe(struct platform_device *pdev) clk_err:of_clk_del_provider (node); - +pm_runtime_disable (dev);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 54/129 ARM: dts: Fix mmc order for omap3-gta04
In reply to Greg Kroah-HartmanFrom: H. Nikolaus Schaller <[email protected]>
[ Upstream commit 09269dd050094593fc747f2a5853d189fefcb6b5 ]
Commit a1ebdb374199 ("ARM: dts: Fix swapped mmc order for omap3") introduces general mmc aliases. Let's tailor them to the need of the GTA04 board which does not make use of mmc2 and mmc3 interfaces.
Message-Id: <dc9173ee3d391d9e92b7ab8ed4f84b29f0a21c83.1646744420.git.hns@goldelico.com>
--- arch/arm/boot/dts/omap3-gta04.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/omap3-gta04.dtsi +2 -0
@@ -31,6 +31,8 @@ chosen { aliases { display0 = &lcd; display1 = &tv0; + /delete-property/ mmc2; + /delete-property/ mmc3; }; ldo_3v3: fixedregulator {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 55/129 ARM: dts: am3517-evm: Fix misc pinmuxing
In reply to Greg Kroah-HartmanFrom: Adam Ford <[email protected]>
[ Upstream commit 942da3af32b2288e674736eb159d1fc676261691 ]
The bootloader for the AM3517 has previously done much of the pin muxing, but as the bootloader is moving more and more to a model based on the device tree, it may no longer automatically mux the pins, so it is necessary to add the pinmuxing to the Linux device trees so the respective peripherals can remain functional.
Message-Id: <[email protected]>
--- arch/arm/boot/dts/am3517-evm.dts | 45 +++++++++++++++++++++++++++---- arch/arm/boot/dts/am3517-som.dtsi | 9 +++++++ 2 files changed, 49 insertions(+), 5 deletions(-)
arch/arm/boot/dts/am3517-evm.dts +40 -5
@@ -161,6 +161,8 @@ pwm11: dmtimer-pwm@11 { /* HS USB Host PHY on PORT 1 */ hsusb1_phy: hsusb1_phy { + pinctrl-names = "default"; + pinctrl-0 = <&hsusb1_rst_pins>; compatible = "usb-nop-xceiv"; reset-gpios = <&gpio2 25 GPIO_ACTIVE_LOW>; /* gpio_57 */ #phy-cells = <0>;
@@ -168,7 +170,9 @@ hsusb1_phy: hsusb1_phy { }; &davinci_emac { - status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <ðernet_pins>; + status = "okay"; }; &davinci_mdio {
@@ -193,6 +197,8 @@ dpi_out: endpoint { }; &i2c2 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c2_pins>; clock-frequency = <400000>; /* User DIP swithes [1:8] / User LEDS [1:2] */ tca6416: gpio@21 {
@@ -205,6 +211,8 @@ tca6416: gpio@21 { }; &i2c3 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c3_pins>; clock-frequency = <400000>; };
@@ -223,6 +231,8 @@ &mmc3 { }; &usbhshost { + pinctrl-names = "default"; + pinctrl-0 = <&hsusb1_pins>; port1-mode = "ehci-phy"; };
@@ -231,8 +241,35 @@ &usbhsehci { }; &omap3_pmx_core { - pinctrl-names = "default"; - pinctrl-0 = <&hsusb1_rst_pins>; + + ethernet_pins: pinmux_ethernet_pins { + pinctrl-single,pins = < + OMAP3_CORE1_IOPAD(0x21fe, PIN_INPUT | MUX_MODE0) /* rmii_mdio_data */ + OMAP3_CORE1_IOPAD(0x2200, MUX_MODE0) /* rmii_mdio_clk */ + OMAP3_CORE1_IOPAD(0x2202, PIN_INPUT_PULLDOWN | MUX_MODE0) /* rmii_rxd0 */ + OMAP3_CORE1_IOPAD(0x2204, PIN_INPUT_PULLDOWN | MUX_MODE0) /* rmii_rxd1 */ + OMAP3_CORE1_IOPAD(0x2206, PIN_INPUT_PULLDOWN | MUX_MODE0) /* rmii_crs_dv */ + OMAP3_CORE1_IOPAD(0x2208, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* rmii_rxer */ + OMAP3_CORE1_IOPAD(0x220a, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* rmii_txd0 */ + OMAP3_CORE1_IOPAD(0x220c, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* rmii_txd1 */ + OMAP3_CORE1_IOPAD(0x220e, PIN_OUTPUT_PULLDOWN |MUX_MODE0) /* rmii_txen */ + OMAP3_CORE1_IOPAD(0x2210, PIN_INPUT_PULLDOWN | MUX_MODE0) /* rmii_50mhz_clk */ + >; + }; + + i2c2_pins: pinmux_i2c2_pins { + pinctrl-single,pins = < + OMAP3_CORE1_IOPAD(0x21be, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c2_scl */ + OMAP3_CORE1_IOPAD(0x21c0, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c2_sda */ + >; + }; + + i2c3_pins: pinmux_i2c3_pins { + pinctrl-single,pins = < + OMAP3_CORE1_IOPAD(0x21c2, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c3_scl */ + OMAP3_CORE1_IOPAD(0x21c4, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c3_sda */ + >; + }; leds_pins: pinmux_leds_pins { pinctrl-single,pins = <
@@ -300,8 +337,6 @@ OMAP3_CORE1_IOPAD(0x20ba, PIN_OUTPUT | MUX_MODE4) /* gpmc_ncs6.gpio_57 */ }; &omap3_pmx_core2 { - pinctrl-names = "default"; - pinctrl-0 = <&hsusb1_pins>; hsusb1_pins: pinmux_hsusb1_pins { pinctrl-single,pins = <
arch/arm/boot/dts/am3517-som.dtsi +9 -0
@@ -69,6 +69,8 @@ nand@0,0 { }; &i2c1 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c1_pins>; clock-frequency = <400000>; s35390a: s35390a@30 {
@@ -179,6 +181,13 @@ bluetooth { &omap3_pmx_core { + i2c1_pins: pinmux_i2c1_pins { + pinctrl-single,pins = < + OMAP3_CORE1_IOPAD(0x21ba, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_scl */ + OMAP3_CORE1_IOPAD(0x21bc, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_sda */ + >; + }; + wl12xx_buffer_pins: pinmux_wl12xx_buffer_pins { pinctrl-single,pins = < OMAP3_CORE1_IOPAD(0x2156, PIN_OUTPUT | MUX_MODE4) /* mmc1_dat7.gpio_129 */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 56/129 ARM: dts: logicpd-som-lv: Fix wrong pinmuxing on OMAP35
In reply to Greg Kroah-HartmanFrom: Adam Ford <[email protected]>
[ Upstream commit 46ff3df87215ff42c0cd2c4bdb7d74540384a69c ]
The pinout of the OMAP35 and DM37 variants of the SOM-LV are the same, but the macros which define the pinmuxing are different between OMAP3530 and DM3730. The pinmuxing was correct for for the DM3730, but wrong for the OMAP3530. Since the boot loader was correctly pin-muxing the pins, this was not obvious. As the bootloader not guaranteed to pinmux all the pins any more, this causes an issue, so the pinmux needs to be moved from a common file to their respective board files.
Message-Id: <[email protected]>
--- arch/arm/boot/dts/logicpd-som-lv-35xx-devkit.dts | 15 +++++++++++++++ arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts | 15 +++++++++++++++ arch/arm/boot/dts/logicpd-som-lv.dtsi | 15 --------------- 3 files changed, 30 insertions(+), 15 deletions(-)
arch/arm/boot/dts/logicpd-som-lv-35xx-devkit.dts +15 -0
@@ -11,3 +11,18 @@ / { model = "LogicPD Zoom OMAP35xx SOM-LV Development Kit"; compatible = "logicpd,dm3730-som-lv-devkit", "ti,omap3430", "ti,omap3"; }; + +&omap3_pmx_core2 { + pinctrl-names = "default"; + pinctrl-0 = <&hsusb2_2_pins>; + hsusb2_2_pins: pinmux_hsusb2_2_pins { + pinctrl-single,pins = < + OMAP3430_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3) /* etk_d10.hsusb2_clk */ + OMAP3430_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3) /* etk_d11.hsusb2_stp */ + OMAP3430_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d12.hsusb2_dir */ + OMAP3430_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d13.hsusb2_nxt */ + OMAP3430_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d14.hsusb2_data0 */ + OMAP3430_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d15.hsusb2_data1 */ + >; + }; +};
arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts +15 -0
@@ -11,3 +11,18 @@ / { model = "LogicPD Zoom DM3730 SOM-LV Development Kit"; compatible = "logicpd,dm3730-som-lv-devkit", "ti,omap3630", "ti,omap3"; }; + +&omap3_pmx_core2 { + pinctrl-names = "default"; + pinctrl-0 = <&hsusb2_2_pins>; + hsusb2_2_pins: pinmux_hsusb2_2_pins { + pinctrl-single,pins = < + OMAP3630_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3) /* etk_d10.hsusb2_clk */ + OMAP3630_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3) /* etk_d11.hsusb2_stp */ + OMAP3630_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d12.hsusb2_dir */ + OMAP3630_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d13.hsusb2_nxt */ + OMAP3630_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d14.hsusb2_data0 */ + OMAP3630_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d15.hsusb2_data1 */ + >; + }; +};
arch/arm/boot/dts/logicpd-som-lv.dtsi +0 -15
@@ -265,21 +265,6 @@ OMAP3_WKUP_IOPAD(0x2a0c, PIN_OUTPUT | MUX_MODE4) /* sys_boot1.gpio_3 */ }; }; -&omap3_pmx_core2 { - pinctrl-names = "default"; - pinctrl-0 = <&hsusb2_2_pins>; - hsusb2_2_pins: pinmux_hsusb2_2_pins { - pinctrl-single,pins = < - OMAP3630_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3) /* etk_d10.hsusb2_clk */ - OMAP3630_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3) /* etk_d11.hsusb2_stp */ - OMAP3630_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d12.hsusb2_dir */ - OMAP3630_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d13.hsusb2_nxt */ - OMAP3630_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d14.hsusb2_data0 */ - OMAP3630_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d15.hsusb2_data1 */ - >; - }; -}; - &uart2 { interrupts-extended = <&intc 73 &omap3_pmx_core OMAP3_UART2_RX>; pinctrl-names = "default";
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 57/129 ipvs: correctly print the memory size of ip_vs_conn_tab
In reply to Greg Kroah-HartmanFrom: Pengcheng Yang <[email protected]>
[ Upstream commit eba1a872cb73314280d5448d934935b23e30b7ca ]
The memory size of ip_vs_conn_tab changed after we use hlist instead of list.
--- net/netfilter/ipvs/ip_vs_conn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/ipvs/ip_vs_conn.c +1 -1
@@ -1495,7 +1495,7 @@ int __init ip_vs_conn_init(void)pr_info ("Connection hash table configured " "(size=%d, memory=%ldKbytes)\n" , ip_vs_conn_tab_size, - (long )(ip_vs_conn_tab_size*sizeof (struct list_head ))/1024 ); + (long )(ip_vs_conn_tab_size*sizeof (*ip_vs_conn_tab))/1024 );IP_VS_DBG (0 ,"Each connection entry needs %zd bytes at least\n" ,sizeof (struct ip_vs_conn ));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 58/129 pinctrl: mediatek: moore: Fix build error
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 87950929e2ff2236207bdbe14bff8230558b541b ]
If EINT_MTK is m and PINCTRL_MTK_V2 is y, build fails:
drivers/pinctrl/mediatek/pinctrl-moore.o: In function `mtk_gpio_set_config':
pinctrl-moore.c:(.text+0xa6c): undefined reference to mtk_eint_set_debounce' drivers/pinctrl/mediatek/pinctrl-moore.o: In function mtk_gpio_to_irq':
pinctrl-moore.c:(.text+0xacc): undefined reference to `mtk_eint_find_irq'
Select EINT_MTK for PINCTRL_MTK_V2 to fix this.
--- drivers/pinctrl/mediatek/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/pinctrl/mediatek/Kconfig +1 -0
@@ -30,6 +30,7 @@ config PINCTRL_MTK_MOORE select GENERIC_PINMUX_FUNCTIONS select GPIOLIB select OF_GPIO + select EINT_MTK select PINCTRL_MTK_V2 config PINCTRL_MTK_PARIS
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 59/129 mtd: rawnand: Fix return value check of wait_for_completion_timeout
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 084c16ab423a8890121b902b405823bfec5b4365 ]
wait_for_completion_timeout() returns unsigned long not int. It returns 0 if timed out, and positive if completed. The check for <= 0 is ambiguous and should be == 0 here indicating timeout which is the only error case.
--- drivers/mtd/nand/raw/sh_flctl.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/mtd/nand/raw/sh_flctl.c +8 -6
@@ -384,7 +384,8 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl *flctl, unsigned long *buf,dma_addr_t dma_addr;dma_cookie_t cookie;uint32_t reg; -int ret; +int ret =0 ; +unsigned long time_left;if (dir ==DMA_FROM_DEVICE ) { chan = flctl->chan_fifo0_rx;
@@ -425,13 +426,14 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl *flctl, unsigned long *buf, goto out; } - ret = + time_left =wait_for_completion_timeout (&flctl->dma_complete,msecs_to_jiffies (3000 )); -if (ret <=0 ) { +if (time_left ==0 ) {dmaengine_terminate_all (chan);dev_err (&flctl->pdev->dev,"wait_for_completion_timeout\n" ); + ret = -ETIMEDOUT ; } out:
@@ -441,7 +443,7 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl *flctl, unsigned long *buf,dma_unmap_single (chan->device->dev, dma_addr, len, dir); -/* ret > 0 is success */ +/* ret == 0 is success */ return ret; }
@@ -465,7 +467,7 @@ static void read_fiforeg(struct sh_flctl *flctl, int rlen, int offset)/* initiate DMA transfer */ if (flctl->chan_fifo0_rx && rlen >=32 && -flctl_dma_fifo0_transfer (flctl, buf, rlen,DMA_FROM_DEVICE ) >0 ) + !flctl_dma_fifo0_transfer (flctl, buf, rlen,DMA_FROM_DEVICE )) goto convert;/* DMA success */ /* do polling transfer */
@@ -524,7 +526,7 @@ static void write_ec_fiforeg(struct sh_flctl *flctl, int rlen,/* initiate DMA transfer */ if (flctl->chan_fifo0_tx && rlen >=32 && -flctl_dma_fifo0_transfer (flctl, buf, rlen,DMA_TO_DEVICE ) >0 ) + !flctl_dma_fifo0_transfer (flctl, buf, rlen,DMA_TO_DEVICE ))return ;/* DMA success */ /* do polling transfer */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 60/129 mtd: fix part field data corruption in mtd_info
In reply to Greg Kroah-HartmanFrom: Oleksandr Ocheretnyi <[email protected]>
[ Upstream commit 37c5f9e80e015d0df17d0c377c18523002986851 ]
Commit 46b5889cc2c5 ("mtd: implement proper partition handling") started using "mtd_get_master_ofs()" in mtd callbacks to determine memory offsets by means of 'part' field from mtd_info, what previously was smashed accessing 'master' field in the mtd_set_dev_defaults() method. That provides wrong offset what causes hardware access errors.
Just make 'part', 'master' as separate fields, rather than using union type to avoid 'part' data corruption when mtd_set_dev_defaults() is called.
--- include/linux/mtd/mtd.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
include/linux/mtd/mtd.h +2 -4
@@ -388,10 +388,8 @@ struct mtd_info {/* List of partitions attached to this MTD device */ struct list_head partitions; -union { -struct mtd_part part; -struct mtd_master master; - }; +struct mtd_part part; +struct mtd_master master; };static inline struct mtd_info *mtd_get_master (struct mtd_info *mtd)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 61/129 pinctrl: stm32: Do not call stm32_gpio_get() for edge triggered IRQs in EOI
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit e74200ebf7c4f6a7a7d1be9f63833ddba251effa ]
The stm32_gpio_get() should only be called for LEVEL triggered interrupts, skip calling it for EDGE triggered interrupts altogether to avoid wasting CPU cycles in EOI handler. On this platform, EDGE triggered interrupts are the majority and LEVEL triggered interrupts are the exception no less, and the CPU cycles are not abundant.
--- drivers/pinctrl/stm32/pinctrl-stm32.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/pinctrl/stm32/pinctrl-stm32.c +4 -0
@@ -311,6 +311,10 @@ static void stm32_gpio_irq_trigger(struct irq_data *d)struct stm32_gpio_bank *bank = d->domain->host_data;int level; +/* Do not access the GPIO if this is not LEVEL triggered IRQ. */ +if (!(bank->irq_type[d->hwirq] &IRQ_TYPE_LEVEL_MASK )) +return ; +/* If level interrupt type then retrig */ level =stm32_gpio_get (&bank->gpio_chip, d->hwirq); if ((level == 0 && bank->irq_type[d->hwirq] == IRQ_TYPE_LEVEL_LOW) ||
Signature · 9 lines
2.35.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 62/129 memory: renesas-rpc-if: Fix HF/OSPI data transfer in Manual Mode
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 7e842d70fe599bc13594b650b2144c4b6e6d6bf1 ]
HyperFlash devices fail to probe:
rpc-if-hyperflash rpc-if-hyperflash: probing of hyperbus device failed
In HyperFlash or Octal-SPI Flash mode, the Transfer Data Enable bits (SPIDE) in the Manual Mode Enable Setting Register (SMENR) are derived from half of the transfer size, cfr. the rpcif_bits_set() helper function. However, rpcif_reg_{read,write}() does not take the bus size into account, and does not double all Manual Mode Data Register access sizes when communicating with a HyperFlash or Octal-SPI Flash device.
Fix this, and avoid the back-and-forth conversion between transfer size and Transfer Data Enable bits, by explicitly storing the transfer size in struct rpcif, and using that value to determine access size in rpcif_reg_{read,write}().
Enforce that the "high" Manual Mode Read/Write Data Registers (SM[RW]DR1) are only used for 8-byte data accesses. While at it, forbid writing to the Manual Mode Read Data Registers, as they are read-only.
--- drivers/memory/renesas-rpc-if.c | 60 +++++++++++++++++++++++++-------- include/memory/renesas-rpc-if.h | 1 + 2 files changed, 47 insertions(+), 14 deletions(-)
drivers/memory/renesas-rpc-if.c +46 -14
@@ -163,25 +163,39 @@ static const struct regmap_access_table rpcif_volatile_table = {/* -* Custom accessor functions to ensure SMRDR0 and SMWDR0 are always accessed -* with proper width. Requires SMENR_SPIDE to be correctly set before! +* Custom accessor functions to ensure SM[RW]DR[01] are always accessed with +* proper width. Requires rpcif.xfer_size to be correctly set before! */ static int rpcif_reg_read (void *context,unsigned int reg,unsigned int *val) {struct rpcif *rpc = context; -if (reg ==RPCIF_SMRDR0 || reg ==RPCIF_SMWDR0 ) { -u32 spide =readl (rpc->base +RPCIF_SMENR ) &RPCIF_SMENR_SPIDE (0xF ); - -if (spide ==0x8 ) { +switch (reg) { +case RPCIF_SMRDR0 : +case RPCIF_SMWDR0 : +switch (rpc->xfer_size) { +case 1 : *val =readb (rpc->base + reg);return 0 ; - }else if (spide ==0xC ) { + +case 2 : *val =readw (rpc->base + reg);return 0 ; - }else if (spide !=0xF ) { + +case 4 : +case 8 : + *val =readl (rpc->base + reg); +return 0 ; + +default :return -EILSEQ ; } + +case RPCIF_SMRDR1 : +case RPCIF_SMWDR1 : +if (rpc->xfer_size !=8 ) +return -EILSEQ ; +break ; } *val =readl (rpc->base + reg);
@@ -193,18 +207,34 @@ static int rpcif_reg_write(void *context, unsigned int reg, unsigned int val) {struct rpcif *rpc = context; -if (reg ==RPCIF_SMRDR0 || reg ==RPCIF_SMWDR0 ) { -u32 spide =readl (rpc->base +RPCIF_SMENR ) &RPCIF_SMENR_SPIDE (0xF ); - -if (spide ==0x8 ) { +switch (reg) { +case RPCIF_SMWDR0 : +switch (rpc->xfer_size) { +case 1 :writeb (val, rpc->base + reg);return 0 ; - }else if (spide ==0xC ) { + +case 2 :writew (val, rpc->base + reg);return 0 ; - }else if (spide !=0xF ) { + +case 4 : +case 8 : +writel (val, rpc->base + reg); +return 0 ; + +default :return -EILSEQ ; } + +case RPCIF_SMWDR1 : +if (rpc->xfer_size !=8 ) +return -EILSEQ ; +break ; + +case RPCIF_SMRDR0 : +case RPCIF_SMRDR1 : +return -EPERM ; }writel (val, rpc->base + reg);
@@ -455,6 +485,7 @@ int rpcif_manual_xfer(struct rpcif *rpc) smenr |=RPCIF_SMENR_SPIDE (rpcif_bits_set (rpc, nbytes));regmap_write (rpc->regmap,RPCIF_SMENR , smenr); + rpc->xfer_size = nbytes;memcpy (data, rpc->buffer + pos, nbytes);if (nbytes ==8 ) {
@@ -519,6 +550,7 @@ int rpcif_manual_xfer(struct rpcif *rpc)regmap_write (rpc->regmap,RPCIF_SMENR , smenr);regmap_write (rpc->regmap,RPCIF_SMCR , rpc->smcr |RPCIF_SMCR_SPIE ); + rpc->xfer_size = nbytes; ret =wait_msg_xfer_end (rpc);if (ret) goto err_out;
include/memory/renesas-rpc-if.h +1 -0
@@ -65,6 +65,7 @@ struct rpcif {size_t size;enum rpcif_data_dir dir;u8 bus_size; +u8 xfer_size;void *buffer;u32 xferlen;u32 smcr;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 63/129 net: dsa: Add missing of_node_put() in dsa_port_link_register_of
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit fc06b2867f4cea543505acfb194c2be4ebf0c7d3 ]
The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done. of_node_put() will check for NULL value.
--- net/dsa/port.c | 2 ++ 1 file changed, 2 insertions(+)
net/dsa/port.c +2 -0
@@ -721,8 +721,10 @@ int dsa_port_link_register_of(struct dsa_port *dp)if (ds->ops->phylink_mac_link_down) ds->ops->phylink_mac_link_down (ds, port,MLO_AN_FIXED ,PHY_INTERFACE_MODE_NA ); +of_node_put (phy_np);return dsa_port_phylink_register (dp); } +of_node_put (phy_np);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 64/129 netfilter: nft_set_rbtree: overlap detection with element re-addition after deletion
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit babc3dc9524f0bcb5a0ec61f3c3639b11508fad6 ]
This patch fixes spurious EEXIST errors.
Extend d2df92e98a34 ("netfilter: nft_set_rbtree: handle element re-addition after deletion") to deal with elements with same end flags in the same transation.
Reset the overlap flag as described by 7c84d41416d8 ("netfilter:nft_set_rbtree: Detect partial overlaps on insertion").
--- net/netfilter/nft_set_rbtree.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/netfilter/nft_set_rbtree.c +5 -1
@@ -348,7 +348,11 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, *ext = &rbe->ext;return -EEXIST ; }else { - p = &parent->rb_left; + overlap = false; +if (nft_rbtree_interval_end (rbe)) + p = &parent->rb_left; +else + p = &parent->rb_right; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 65/129 bpf, lwt: Fix crash when using bpf_skb_set_tunnel_key() from bpf_xmit lwt hook
In reply to Greg Kroah-HartmanFrom: Eyal Birger <[email protected]>
[ Upstream commit b02d196c44ead1a5949729be9ff08fe781c3e48a ]
xmit_check_hhlen() observes the dst for getting the device hard header length to make sure a modified packet can fit. When a helper which changes the dst - such as bpf_skb_set_tunnel_key() - is called as part of the xmit program the accessed dst is no longer valid.
This leads to the following splat:
BUG: kernel NULL pointer dereference, address: 00000000000000de #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP PTI CPU: 0 PID: 798 Comm: ping Not tainted 5.18.0-rc2+ #103 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014 RIP: 0010:bpf_xmit+0xfb/0x17f Code: c6 c0 4d cd 8e 48 c7 c7 7d 33 f0 8e e8 42 09 fb ff 48 8b 45 58 48 8b 95 c8 00 00 00 48 2b 95 c0 00 00 00 48 83 e0 fe 48 8b 00 <0f> b7 80 de 00 00 00 39 c2 73 22 29 d0 b9 20 0a 00 00 31 d2 48 89 RSP: 0018:ffffb148c0bc7b98 EFLAGS: 00010282 RAX: 0000000000000000 RBX: 0000000000240008 RCX: 0000000000000000 RDX: 0000000000000010 RSI: 00000000ffffffea RDI: 00000000ffffffff RBP: ffff922a828a4e00 R08: ffffffff8f1350e8 R09: 00000000ffffdfff R10: ffffffff8f055100 R11: ffffffff8f105100 R12: 0000000000000000 R13: ffff922a828a4e00 R14: 0000000000000040 R15: 0000000000000000 FS: 00007f414e8f0080(0000) GS:ffff922afdc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000000000de CR3: 0000000002d80006 CR4: 0000000000370ef0 Call Trace: <TASK> lwtunnel_xmit.cold+0x71/0xc8 ip_finish_output2+0x279/0x520 ? __ip_finish_output.part.0+0x21/0x130
Fix by fetching the device hard header length before running the BPF code.
--- net/core/lwt_bpf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
net/core/lwt_bpf.c +3 -4
@@ -158,10 +158,8 @@ static int bpf_output(struct net *net, struct sock *sk, struct sk_buff *skb)return dst->lwtstate->orig_output (net, sk, skb); } -static int xmit_check_hhlen (struct sk_buff *skb) +static int xmit_check_hhlen (struct sk_buff *skb,int hh_len) { -int hh_len =skb_dst (skb)->dev->hard_header_len; -if (skb_headroom (skb) < hh_len) {int nhead =HH_DATA_ALIGN (hh_len -skb_headroom (skb));
@@ -273,6 +271,7 @@ static int bpf_xmit(struct sk_buff *skb) bpf =bpf_lwt_lwtunnel (dst->lwtstate);if (bpf->xmit.prog) { +int hh_len = dst->dev->hard_header_len;__be16 proto = skb->protocol;int ret;
@@ -290,7 +289,7 @@ static int bpf_xmit(struct sk_buff *skb)/* If the header was expanded, headroom might be too * small for L2 header to come, expand as needed. */ - ret =xmit_check_hhlen (skb); + ret =xmit_check_hhlen (skb, hh_len);if (unlikely (ret))return ret;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 66/129 pinctrl: rockchip: fix RK3308 pinmux bits
In reply to Greg Kroah-HartmanFrom: Luca Ceresoli <[email protected]>
[ Upstream commit 1f3e25a068832f8892a5ff71467622d012f5bc9f ]
Some of the pinmuxing bits described in rk3308_mux_recalced_data are wrong, pointing to non-existing registers.
Fix the entire table.
Also add a comment in front of each entry with the same string that appears in the datasheet to make the table easier to compare with the docs.
This fix has been tested on real hardware for the gpio3b3_sel entry.
--- drivers/pinctrl/pinctrl-rockchip.c | 45 ++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 15 deletions(-)
drivers/pinctrl/pinctrl-rockchip.c +30 -15
@@ -663,95 +663,110 @@ static struct rockchip_mux_recalced_data rk3128_mux_recalced_data[] = {static struct rockchip_mux_recalced_data rk3308_mux_recalced_data[] = { { +/* gpio1b6_sel */ .num =1 , .pin =14 , .reg =0x28 , .bit =12 , .mask =0xf }, { +/* gpio1b7_sel */ .num =1 , .pin =15 , .reg =0x2c , .bit =0 , .mask =0x3 }, { +/* gpio1c2_sel */ .num =1 , .pin =18 , .reg =0x30 , .bit =4 , .mask =0xf }, { +/* gpio1c3_sel */ .num =1 , .pin =19 , .reg =0x30 , .bit =8 , .mask =0xf }, { +/* gpio1c4_sel */ .num =1 , .pin =20 , .reg =0x30 , .bit =12 , .mask =0xf }, { +/* gpio1c5_sel */ .num =1 , .pin =21 , .reg =0x34 , .bit =0 , .mask =0xf }, { +/* gpio1c6_sel */ .num =1 , .pin =22 , .reg =0x34 , .bit =4 , .mask =0xf }, { +/* gpio1c7_sel */ .num =1 , .pin =23 , .reg =0x34 , .bit =8 , .mask =0xf }, { +/* gpio3b4_sel */ .num =3 , .pin =12 , .reg =0x68 , .bit =8 , .mask =0xf }, { +/* gpio3b5_sel */ .num =3 , .pin =13 , .reg =0x68 , .bit =12 , .mask =0xf }, { +/* gpio2a2_sel */ .num =2 , .pin =2 , - .reg =0x608 , - .bit =0 , - .mask =0x7 + .reg =0x40 , + .bit =4 , + .mask =0x3 }, { +/* gpio2a3_sel */ .num =2 , .pin =3 , - .reg =0x608 , - .bit =4 , - .mask =0x7 + .reg =0x40 , + .bit =6 , + .mask =0x3 }, { +/* gpio2c0_sel */ .num =2 , .pin =16 , - .reg =0x610 , - .bit =8 , - .mask =0x7 + .reg =0x50 , + .bit =0 , + .mask =0x3 }, { +/* gpio3b2_sel */ .num =3 , .pin =10 , - .reg =0x610 , - .bit =0 , - .mask =0x7 + .reg =0x68 , + .bit =4 , + .mask =0x3 }, { +/* gpio3b3_sel */ .num =3 , .pin =11 , - .reg =0x610 , - .bit =4 , - .mask =0x7 + .reg =0x68 , + .bit =6 , + .mask =0x3 }, };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 67/129 tcp: md5: incorrect tcp_header_len for incoming connections
In reply to Greg Kroah-HartmanFrom: Francesco Ruggeri <[email protected]>
[ Upstream commit 5b0b9e4c2c895227c8852488b3f09839233bba54 ]
In tcp_create_openreq_child we adjust tcp_header_len for md5 using the remote address in newsk. But that address is still 0 in newsk at this point, and it is only set later by the callers (tcp_v[46]_syn_recv_sock). Use the address from the request socket instead.
--- net/ipv4/tcp_minisocks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_minisocks.c +1 -1
@@ -538,7 +538,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, newtp->tsoffset = treq->ts_off;#ifdef CONFIG_TCP_MD5SIG newtp->md5sig_info =NULL ;/*XXX*/ -if (newtp->af_specific->md5_lookup (sk, newsk)) +if (treq->af_specific->req_md5_lookup (sk,req_to_sk (req))) newtp->tcp_header_len +=TCPOLEN_MD5SIG_ALIGNED ;#endif if (skb->len >=TCP_MSS_DEFAULT + newtp->tcp_header_len)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 68/129 pinctrl: stm32: Keep pinctrl block clock enabled when LEVEL IRQ requested
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit 05d8af449d93e04547b4c6b328e39c890bc803f4 ]
The current EOI handler for LEVEL triggered interrupts calls clk_enable(), register IO, clk_disable(). The clock manipulation requires locking which happens with IRQs disabled in clk_enable_lock(). Instead of turning the clock on and off all the time, enable the clock in case LEVEL interrupt is requested and keep the clock enabled until all LEVEL interrupts are freed. The LEVEL interrupts are an exception on this platform and seldom used, so this does not affect the common case.
This simplifies the LEVEL interrupt handling considerably and also fixes the following splat found when using preempt-rt:
------------[ cut here ]------------ WARNING: CPU: 0 PID: 0 at kernel/locking/rtmutex.c:2040 __rt_mutex_trylock+0x37/0x62 Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.10.109-rt65-stable-standard-00068-g6a5afc4b1217 #85 Hardware name: STM32 (Device Tree Support) [<c010a45d>] (unwind_backtrace) from [<c010766f>] (show_stack+0xb/0xc) [<c010766f>] (show_stack) from [<c06353ab>] (dump_stack+0x6f/0x84) [<c06353ab>] (dump_stack) from [<c01145e3>] (__warn+0x7f/0xa4) [<c01145e3>] (__warn) from [<c063386f>] (warn_slowpath_fmt+0x3b/0x74) [<c063386f>] (warn_slowpath_fmt) from [<c063b43d>] (__rt_mutex_trylock+0x37/0x62) [<c063b43d>] (__rt_mutex_trylock) from [<c063c053>] (rt_spin_trylock+0x7/0x16) [<c063c053>] (rt_spin_trylock) from [<c036a2f3>] (clk_enable_lock+0xb/0x80) [<c036a2f3>] (clk_enable_lock) from [<c036ba69>] (clk_core_enable_lock+0x9/0x18) [<c036ba69>] (clk_core_enable_lock) from [<c034e9f3>] (stm32_gpio_get+0x11/0x24) [<c034e9f3>] (stm32_gpio_get) from [<c034ef43>] (stm32_gpio_irq_trigger+0x1f/0x48) [<c034ef43>] (stm32_gpio_irq_trigger) from [<c014aa53>] (handle_fasteoi_irq+0x71/0xa8) [<c014aa53>] (handle_fasteoi_irq) from [<c0147111>] (generic_handle_irq+0x19/0x22) [<c0147111>] (generic_handle_irq) from [<c014752d>] (__handle_domain_irq+0x55/0x64) [<c014752d>] (__handle_domain_irq) from [<c0346f13>] (gic_handle_irq+0x53/0x64) [<c0346f13>] (gic_handle_irq) from [<c0100ba5>] (__irq_svc+0x65/0xc0) Exception stack(0xc0e01f18 to 0xc0e01f60) 1f00: 0000300c 00000000 1f20: 0000300c c010ff01 00000000 00000000 c0e00000 c0e07714 00000001 c0e01f78 1f40: c0e07758 00000000 ef7cd0ff c0e01f68 c010554b c0105542 40000033 ffffffff [<c0100ba5>] (__irq_svc) from [<c0105542>] (arch_cpu_idle+0xc/0x1e) [<c0105542>] (arch_cpu_idle) from [<c063be95>] (default_idle_call+0x21/0x3c) [<c063be95>] (default_idle_call) from [<c01324f7>] (do_idle+0xe3/0x1e4) [<c01324f7>] (do_idle) from [<c01327b3>] (cpu_startup_entry+0x13/0x14) [<c01327b3>] (cpu_startup_entry) from [<c0a00c13>] (start_kernel+0x397/0x3d4) [<c0a00c13>] (start_kernel) from [<00000000>] (0x0) ---[ end trace 0000000000000002 ]---
Power consumption measured on STM32MP157C DHCOM SoM is not increased or is below noise threshold.
--- drivers/pinctrl/stm32/pinctrl-stm32.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/pinctrl/stm32/pinctrl-stm32.c +17 -2
@@ -225,6 +225,13 @@ static void stm32_gpio_free(struct gpio_chip *chip, unsigned offset)pinctrl_gpio_free (chip->base + offset); } +static int stm32_gpio_get_noclk (struct gpio_chip *chip,unsigned int offset) +{ +struct stm32_gpio_bank *bank =gpiochip_get_data (chip); + +return !!(readl_relaxed (bank->base +STM32_GPIO_IDR ) &BIT (offset)); +} +static int stm32_gpio_get (struct gpio_chip *chip,unsigned offset) {struct stm32_gpio_bank *bank =gpiochip_get_data (chip);
@@ -232,7 +239,7 @@ static int stm32_gpio_get(struct gpio_chip *chip, unsigned offset)clk_enable (bank->clk); - ret = !!(readl_relaxed (bank->base +STM32_GPIO_IDR ) &BIT (offset)); + ret =stm32_gpio_get_noclk (chip, offset);clk_disable (bank->clk);
@@ -316,7 +323,7 @@ static void stm32_gpio_irq_trigger(struct irq_data *d)return ;/* If level interrupt type then retrig */ - level =stm32_gpio_get (&bank->gpio_chip, d->hwirq); + level =stm32_gpio_get_noclk (&bank->gpio_chip, d->hwirq);if ((level ==0 && bank->irq_type[d->hwirq] ==IRQ_TYPE_LEVEL_LOW ) || (level ==1 && bank->irq_type[d->hwirq] ==IRQ_TYPE_LEVEL_HIGH ))irq_chip_retrigger_hierarchy (d);
@@ -358,6 +365,7 @@ static int stm32_gpio_irq_request_resources(struct irq_data *irq_data) {struct stm32_gpio_bank *bank = irq_data->domain->host_data;struct stm32_pinctrl *pctl =dev_get_drvdata (bank->gpio_chip.parent); +unsigned long flags;int ret; ret =stm32_gpio_direction_input (&bank->gpio_chip, irq_data->hwirq);
@@ -371,6 +379,10 @@ static int stm32_gpio_irq_request_resources(struct irq_data *irq_data)return ret; } + flags =irqd_get_trigger_type (irq_data); +if (flags &IRQ_TYPE_LEVEL_MASK ) +clk_enable (bank->clk); +return 0 ; }
@@ -378,6 +390,9 @@ static void stm32_gpio_irq_release_resources(struct irq_data *irq_data) {struct stm32_gpio_bank *bank = irq_data->domain->host_data; +if (bank->irq_type[irq_data->hwirq] &IRQ_TYPE_LEVEL_MASK ) +clk_disable (bank->clk); +gpiochip_unlock_as_irq (&bank->gpio_chip, irq_data->hwirq); }
Signature · 9 lines
2.35.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 69/129 tcp: ensure to use the most recently sent skb when filling the rate sample
In reply to Greg Kroah-HartmanFrom: Pengcheng Yang <[email protected]>
[ Upstream commit b253a0680ceadc5d7b4acca7aa2d870326cad8ad ]
If an ACK (s)acks multiple skbs, we favor the information from the most recently sent skb by choosing the skb with the highest prior_delivered count. But in the interval between receiving ACKs, we send multiple skbs with the same prior_delivered, because the tp->delivered only changes when we receive an ACK.
We used RACK's solution, copying tcp_rack_sent_after() as tcp_skb_sent_after() helper to determine "which packet was sent last?". Later, we will use tcp_skb_sent_after() instead in RACK.
--- include/net/tcp.h | 6 ++++++ net/ipv4/tcp_rate.c | 11 ++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-)
include/net/tcp.h +6 -0
@@ -1041,6 +1041,7 @@ struct rate_sample {int losses;/* number of packets marked lost upon ACK */ u32 acked_sacked;/* number of packets newly (S)ACKed upon ACK */ u32 prior_in_flight;/* in flight before this ACK */ +u32 last_end_seq;/* end_seq of most recently ACKed packet */ bool is_app_limited;/* is sample from packet with bubble in pipe? */ bool is_retrans;/* is sample from retransmission? */ bool is_ack_delayed;/* is this (likely) a delayed ACK? */
@@ -1151,6 +1152,11 @@ void tcp_rate_gen(struct sock *sk, u32 delivered, u32 lost, bool is_sack_reneg, struct rate_sample *rs);void tcp_rate_check_app_limited (struct sock *sk); +static inline bool tcp_skb_sent_after (u64 t1,u64 t2,u32 seq1,u32 seq2) +{ +return t1 > t2 || (t1 == t2 &&after (seq1, seq2)); +} +/* These functions determine how the current flow behaves in respect of SACK * handling. SACK is negotiated with the peer, and therefore it can vary * between different flows.
net/ipv4/tcp_rate.c +8 -3
@@ -73,26 +73,31 @@ void tcp_rate_skb_sent(struct sock *sk, struct sk_buff *skb)* * If an ACK (s)acks multiple skbs (e.g., stretched-acks), this function is * called multiple times. We favor the information from the most recently -* sent skb, i.e., the skb with the highest prior_delivered count. +* sent skb, i.e., the skb with the most recently sent time and the highest +* sequence. */ void tcp_rate_skb_delivered (struct sock *sk,struct sk_buff *skb,struct rate_sample *rs) {struct tcp_sock *tp =tcp_sk (sk);struct tcp_skb_cb *scb =TCP_SKB_CB (skb); +u64 tx_tstamp;if (!scb->tx.delivered_mstamp)return ; + tx_tstamp =tcp_skb_timestamp_us (skb);if (!rs->prior_delivered || -after (scb->tx.delivered, rs->prior_delivered)) { +tcp_skb_sent_after (tx_tstamp, tp->first_tx_mstamp, + scb->end_seq, rs->last_end_seq)) { rs->prior_delivered = scb->tx.delivered; rs->prior_mstamp = scb->tx.delivered_mstamp; rs->is_app_limited = scb->tx.is_app_limited; rs->is_retrans = scb->sacked &TCPCB_RETRANS ; + rs->last_end_seq = scb->end_seq;/* Record send time of most recently ACKed packet: */ - tp->first_tx_mstamp =tcp_skb_timestamp_us (skb); + tp->first_tx_mstamp = tx_tstamp;/* Find the duration of the "send phase" of this window: */ rs->interval_us =tcp_stamp_us_delta (tp->first_tx_mstamp, scb->tx.first_tx_mstamp);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 70/129 wireguard: device: check for metadata_dst with skb_valid_dst()
In reply to Greg Kroah-HartmanFrom: Nikolay Aleksandrov <[email protected]>
[ Upstream commit 45ac774c33d834fe9d4de06ab5f1022fe8cd2071 ]
When we try to transmit an skb with md_dst attached through wireguard we hit a null pointer dereference in wg_xmit() due to the use of dst_mtu() which calls into dst_blackhole_mtu() which in turn tries to dereference dst->dev.
Since wireguard doesn't use md_dsts we should use skb_valid_dst(), which checks for DST_METADATA flag, and if it's set, then falls back to wireguard's device mtu. That gives us the best chance of transmitting the packet; otherwise if the blackhole netdev is used we'd get ETH_MIN_MTU.
[ 263.693506] BUG: kernel NULL pointer dereference, address: 00000000000000e0 [ 263.693908] #PF: supervisor read access in kernel mode [ 263.694174] #PF: error_code(0x0000) - not-present page [ 263.694424] PGD 0 P4D 0 [ 263.694653] Oops: 0000 [#1] PREEMPT SMP NOPTI [ 263.694876] CPU: 5 PID: 951 Comm: mausezahn Kdump: loaded Not tainted 5.18.0-rc1+ #522 [ 263.695190] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1.fc35 04/01/2014 [ 263.695529] RIP: 0010:dst_blackhole_mtu+0x17/0x20 [ 263.695770] Code: 00 00 00 0f 1f 44 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 8b 47 10 48 83 e0 fc 8b 40 04 85 c0 75 09 48 8b 07 <8b> 80 e0 00 00 00 c3 66 90 0f 1f 44 00 00 48 89 d7 be 01 00 00 00 [ 263.696339] RSP: 0018:ffffa4a4422fbb28 EFLAGS: 00010246 [ 263.696600] RAX: 0000000000000000 RBX: ffff8ac9c3553000 RCX: 0000000000000000 [ 263.696891] RDX: 0000000000000401 RSI: 00000000fffffe01 RDI: ffffc4a43fb48900 [ 263.697178] RBP: ffffa4a4422fbb90 R08: ffffffff9622635e R09: 0000000000000002 [ 263.697469] R10: ffffffff9b69a6c0 R11: ffffa4a4422fbd0c R12: ffff8ac9d18b1a00 [ 263.697766] R13: ffff8ac9d0ce1840 R14: ffff8ac9d18b1a00 R15: ffff8ac9c3553000 [ 263.698054] FS: 00007f3704c337c0(0000) GS:ffff8acaebf40000(0000) knlGS:0000000000000000 [ 263.698470] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 263.698826] CR2: 00000000000000e0 CR3: 0000000117a5c000 CR4: 00000000000006e0 [ 263.699214] Call Trace: [ 263.699505] <TASK> [ 263.699759] wg_xmit+0x411/0x450 [ 263.700059] ? bpf_skb_set_tunnel_key+0x46/0x2d0 [ 263.700382] ? dev_queue_xmit_nit+0x31/0x2b0 [ 263.700719] dev_hard_start_xmit+0xd9/0x220 [ 263.701047] __dev_queue_xmit+0x8b9/0xd30 [ 263.701344] __bpf_redirect+0x1a4/0x380 [ 263.701664] __dev_queue_xmit+0x83b/0xd30 [ 263.701961] ? packet_parse_headers+0xb4/0xf0 [ 263.702275] packet_sendmsg+0x9a8/0x16a0 [ 263.702596] ? _raw_spin_unlock_irqrestore+0x23/0x40 [ 263.702933] sock_sendmsg+0x5e/0x60 [ 263.703239] __sys_sendto+0xf0/0x160 [ 263.703549] __x64_sys_sendto+0x20/0x30 [ 263.703853] do_syscall_64+0x3b/0x90 [ 263.704162] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 263.704494] RIP: 0033:0x7f3704d50506 [ 263.704789] Code: 48 c7 c0 ff ff ff ff eb b7 66 2e 0f 1f 84 00 00 00 00 00 90 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 11 b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 72 c3 90 55 48 83 ec 30 44 89 4c 24 2c 4c 89 [ 263.705652] RSP: 002b:00007ffe954b0b88 EFLAGS: 00000246 ORIG_RAX: 000000000000002c [ 263.706141] RAX: ffffffffffffffda RBX: 0000558bb259b490 RCX: 00007f3704d50506 [ 263.706544] RDX: 000000000000004a RSI: 0000558bb259b7b2 RDI: 0000000000000003 [ 263.706952] RBP: 0000000000000000 R08: 00007ffe954b0b90 R09: 0000000000000014 [ 263.707339] R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffe954b0b90 [ 263.707735] R13: 000000000000004a R14: 0000558bb259b7b2 R15: 0000000000000001 [ 263.708132] </TASK> [ 263.708398] Modules linked in: bridge netconsole bonding [last unloaded: bridge] [ 263.708942] CR2: 00000000000000e0
--- drivers/net/wireguard/device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireguard/device.c +2 -1
@@ -19,6 +19,7 @@#include <linux/if_arp.h> #include <linux/icmp.h> #include <linux/suspend.h> +#include <net/dst_metadata.h> #include <net/icmp.h> #include <net/rtnetlink.h> #include <net/ip_tunnels.h>
@@ -152,7 +153,7 @@ static netdev_tx_t wg_xmit(struct sk_buff *skb, struct net_device *dev) goto err_peer; } - mtu =skb_dst (skb) ?dst_mtu (skb_dst (skb)) : dev->mtu; + mtu =skb_valid_dst (skb) ?dst_mtu (skb_dst (skb)) : dev->mtu;__skb_queue_head_init (&packets);if (!skb_is_gso (skb)) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 71/129 sctp: check asoc strreset_chunk in sctp_generate_reconf_event
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 165e3e17fe8fe6a8aab319bc6e631a2e23b9a857 ]
A null pointer reference issue can be triggered when the response of a stream reconf request arrives after the timer is triggered, such as:
send Incoming SSN Reset Request --->
CPU0:
reconf timer is triggered,
go to the handler code before hold sk lock
<--- reply with Outgoing SSN Reset Request
CPU1:
process Outgoing SSN Reset Request,
and set asoc->strreset_chunk to NULL
CPU0:
continue the handler code, hold sk lock,
and try to hold asoc->strreset_chunk, crash!
In Ying Xu's testing, the call trace is:
[ ] BUG: kernel NULL pointer dereference, address: 0000000000000010 [ ] RIP: 0010:sctp_chunk_hold+0xe/0x40 [sctp]
[ ] Call Trace:
[ ] <IRQ> [ ] sctp_sf_send_reconf+0x2c/0x100 [sctp] [ ] sctp_do_sm+0xa4/0x220 [sctp] [ ] sctp_generate_reconf_event+0xbd/0xe0 [sctp] [ ] call_timer_fn+0x26/0x130
This patch is to fix it by returning from the timer handler if asoc strreset_chunk is already set to NULL.
--- net/sctp/sm_sideeffect.c | 4 ++++ 1 file changed, 4 insertions(+)
net/sctp/sm_sideeffect.c +4 -0
@@ -458,6 +458,10 @@ void sctp_generate_reconf_event(struct timer_list *t) goto out_unlock; } +/* This happens when the response arrives after the timer is triggered. */ +if (!asoc->strreset_chunk) + goto out_unlock; + error = sctp_do_sm(net, SCTP_EVENT_T_TIMEOUT, SCTP_ST_TIMEOUT(SCTP_EVENT_TIMEOUT_RECONF), asoc->state, asoc->ep, asoc,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 72/129 ARM: dts: imx6ull-colibri: fix vqmmc regulator
In reply to Greg Kroah-HartmanFrom: Max Krummenacher <[email protected]>
[ Upstream commit 45974e4276a8d6653394f66666fc57d8ffa6de9a ]
The correct spelling for the property is gpios. Otherwise, the regulator will neither reserve nor control any GPIOs. Thus, any SD/MMC card which can use UHS-I modes will fail.
--- arch/arm/boot/dts/imx6ull-colibri.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx6ull-colibri.dtsi +1 -1
@@ -37,7 +37,7 @@ reg_module_3v3_avdd: regulator-module-3v3-avdd { reg_sd1_vmmc: regulator-sd1-vmmc { compatible = "regulator-gpio"; - gpio = <&gpio5 9 GPIO_ACTIVE_HIGH>; + gpios = <&gpio5 9 GPIO_ACTIVE_HIGH>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_snvs_reg_sd>; regulator-always-on;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 73/129 arm64: dts: imx8mn-ddr4-evk: Describe the 32.768 kHz PMIC clock
In reply to Greg Kroah-HartmanFrom: Fabio Estevam <[email protected]>
[ Upstream commit 0310b5aa0656a94102344f1e9ae2892e342a665d ]
The ROHM BD71847 PMIC has a 32.768 kHz clock.
Describe the PMIC clock to fix the following boot errors:
bd718xx-clk bd71847-clk.1.auto: No parent clk found
bd718xx-clk: probe of bd71847-clk.1.auto failed with error -22
Based on the same fix done for imx8mm-evk as per commit a6a355ede574 ("arm64: dts: imx8mm-evk: Add 32.768 kHz clock to PMIC")
--- arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts +4 -0
@@ -59,6 +59,10 @@ pmic@4b { interrupts = <3 IRQ_TYPE_LEVEL_LOW>; rohm,reset-snvs-powered; + #clock-cells = <0>; + clocks = <&osc_32k 0>; + clock-output-names = "clk-32k-out"; + regulators { buck1_reg: BUCK1 { regulator-name = "buck1";
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 74/129 pinctrl: pistachio: fix use of irq_of_parse_and_map()
In reply to Greg Kroah-HartmanFrom: Lv Ruyi <[email protected]>
[ Upstream commit 0c9843a74a85224a89daa81fa66891dae2f930e1 ]
The irq_of_parse_and_map() function returns 0 on failure, and does not return an negative value.
--- drivers/pinctrl/pinctrl-pistachio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-pistachio.c +3 -3
@@ -1374,10 +1374,10 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl) } irq =irq_of_parse_and_map (child,0 ); -if (irq <0 ) { -dev_err (pctl->dev,"No IRQ for bank %u: %d\n" , i, irq); +if (!irq) { +dev_err (pctl->dev,"No IRQ for bank %u\n" , i);of_node_put (child); - ret = irq; + ret = -EINVAL ; goto err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 75/129 cpufreq: fix memory leak in sun50i_cpufreq_nvmem_probe
In reply to Greg Kroah-HartmanFrom: Xiaobing Luo <[email protected]>
[ Upstream commit 1aa24a8f3b5133dae4bc1e57427e345445f3e902 ]
--------------------------------------------
unreferenced object 0xffff000010742a00 (size 128):
comm "swapper/0", pid 1, jiffies 4294902015 (age 1187.652s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<00000000b4dfebaa>] __kmalloc+0x338/0x474
[<00000000d6e716db>] sun50i_cpufreq_nvmem_probe+0xc4/0x36c
[<000000007d6082a0>] platform_probe+0x98/0x11c
[<00000000c990f549>] really_probe+0x234/0x5a0
[<000000002d9fecc6>] __driver_probe_device+0x194/0x224
[<00000000cf0b94fa>] driver_probe_device+0x64/0x13c
[<00000000f238e4cf>] __device_attach_driver+0xf8/0x180
[<000000006720e418>] bus_for_each_drv+0xf8/0x160
[<00000000df4f14f6>] __device_attach+0x174/0x29c
[<00000000782002fb>] device_initial_probe+0x20/0x30
[<00000000c2681b06>] bus_probe_device+0xfc/0x110
[<00000000964cf3bd>] device_add+0x5f0/0xcd0
[<000000004b9264e3>] platform_device_add+0x198/0x390
[<00000000fa82a9d0>] platform_device_register_full+0x178/0x210
[<000000009a5daf13>] sun50i_cpufreq_init+0xf8/0x168
[<000000000377cc7c>] do_one_initcall+0xe4/0x570
--------------------------------------------if sun50i_cpufreq_get_efuse failed, then opp_tables leak.
--- drivers/cpufreq/sun50i-cpufreq-nvmem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/cpufreq/sun50i-cpufreq-nvmem.c +3 -1
@@ -98,8 +98,10 @@ static int sun50i_cpufreq_nvmem_probe(struct platform_device *pdev)return -ENOMEM ; ret =sun50i_cpufreq_get_efuse (&speed); -if (ret) +if (ret) { +kfree (opp_tables);return ret; + }snprintf (name,MAX_NAME_LEN ,"speed%d" , speed);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 76/129 net: hns3: modify the return code of hclge_get_ring_chain_from_mbx
In reply to Greg Kroah-HartmanFrom: Jie Wang <[email protected]>
[ Upstream commit 48009e9972974c52a5f649f761862dd67bce3d13 ]
Currently, function hclge_get_ring_chain_from_mbx will return -ENOMEM if ring_num is bigger than HCLGE_MBX_MAX_RING_CHAIN_PARAM_NUM. It is better to return -EINVAL for the invalid parameter case.
So this patch fixes it by return -EINVAL in this abnormal branch.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +1 -1
@@ -173,7 +173,7 @@ static int hclge_get_ring_chain_from_mbx( ring_num = req->msg.ring_num;if (ring_num >HCLGE_MBX_MAX_RING_CHAIN_PARAM_NUM ) -return -ENOMEM ; +return -EINVAL ;for (i =0 ; i < ring_num; i++) {if (req->msg.param[i].tqp_index >= vport->nic.kinfo.rss_size) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 77/129 net: hns3: add validity check for message data length
In reply to Greg Kroah-HartmanFrom: Jian Shen <[email protected]>
[ Upstream commit 7d413735cb18ff73aaba3457b16b08332e8d3cc4 ]
Add validity check for message data length in function hclge_send_mbx_msg(), avoid unexpected overflow.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +7 -0
@@ -91,6 +91,13 @@ static int hclge_send_mbx_msg(struct hclge_vport *vport, u8 *msg, u16 msg_len,enum hclge_cmd_status status;struct hclge_desc desc; +if (msg_len >HCLGE_MBX_MAX_MSG_SIZE ) { +dev_err (&hdev->pdev->dev, +"msg data length(=%u) exceeds maximum(=%u)\n" , + msg_len,HCLGE_MBX_MAX_MSG_SIZE ); +return -EMSGSIZE ; + } + resp_pf_to_vf = (struct hclge_mbx_pf_to_vf_cmd *)desc.data;hclge_cmd_setup_basic_desc (&desc,HCLGEVF_OPC_MBX_PF_TO_VF , false);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 78/129 net: hns3: add return value for mailbox handling in PF
In reply to Greg Kroah-HartmanFrom: Jian Shen <[email protected]>
[ Upstream commit c59d606296842409a6e5a4828235b0bd46b12bc4 ]
Currently, there are some querying mailboxes sent from VF to PF, and VF will wait the PF's handling result. For mailbox HCLGE_MBX_GET_QID_IN_PF and HCLGE_MBX_GET_RSS_KEY, it may fail when the input parameter is invalid, but the prototype of their handler function is void. In this case, PF always return success to VF, which may cause the VF get incorrect result.
Fixes it by adding return value for these function.
--- .../hisilicon/hns3/hns3pf/hclge_mbx.c | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +12 -10
@@ -584,9 +584,9 @@ static int hclge_set_vf_mtu(struct hclge_vport *vport,return hclge_set_vport_mtu (vport, mtu); } -static void hclge_get_queue_id_in_pf (struct hclge_vport *vport, -struct hclge_mbx_vf_to_pf_cmd *mbx_req, -struct hclge_respond_to_vf_msg *resp_msg) +static int hclge_get_queue_id_in_pf (struct hclge_vport *vport, +struct hclge_mbx_vf_to_pf_cmd *mbx_req, +struct hclge_respond_to_vf_msg *resp_msg) {struct hnae3_handle *handle = &vport->nic;struct hclge_dev *hdev = vport->back;
@@ -596,17 +596,18 @@ static void hclge_get_queue_id_in_pf(struct hclge_vport *vport,if (queue_id >= handle->kinfo.num_tqps) {dev_err (&hdev->pdev->dev,"Invalid queue id(%u) from VF %u\n" , queue_id, mbx_req->mbx_src_vfid); -return ; +return -EINVAL ; } qid_in_pf =hclge_covert_handle_qid_global (&vport->nic, queue_id);memcpy (resp_msg->data, &qid_in_pf,sizeof (qid_in_pf)); resp_msg->len =sizeof (qid_in_pf); +return 0 ; } -static void hclge_get_rss_key (struct hclge_vport *vport, -struct hclge_mbx_vf_to_pf_cmd *mbx_req, -struct hclge_respond_to_vf_msg *resp_msg) +static int hclge_get_rss_key (struct hclge_vport *vport, +struct hclge_mbx_vf_to_pf_cmd *mbx_req, +struct hclge_respond_to_vf_msg *resp_msg) {#define HCLGE_RSS_MBX_RESP_LEN 8struct hclge_dev *hdev = vport->back;
@@ -622,13 +623,14 @@ static void hclge_get_rss_key(struct hclge_vport *vport,dev_warn (&hdev->pdev->dev,"failed to get the rss hash key, the index(%u) invalid !\n" , index); -return ; +return -EINVAL ; }memcpy (resp_msg->data, &hdev->vport[0 ].rss_hash_key[index *HCLGE_RSS_MBX_RESP_LEN ],HCLGE_RSS_MBX_RESP_LEN ); resp_msg->len =HCLGE_RSS_MBX_RESP_LEN ; +return 0 ; }static void hclge_link_fail_parse (struct hclge_dev *hdev,u8 link_fail_code)
@@ -807,10 +809,10 @@ void hclge_mbx_handler(struct hclge_dev *hdev) "VF fail(%d) to set mtu\n", ret);break ;case HCLGE_MBX_GET_QID_IN_PF : -hclge_get_queue_id_in_pf (vport, req, &resp_msg); + ret =hclge_get_queue_id_in_pf (vport, req, &resp_msg);break ;case HCLGE_MBX_GET_RSS_KEY : -hclge_get_rss_key (vport, req, &resp_msg); + ret =hclge_get_rss_key (vport, req, &resp_msg);break ;case HCLGE_MBX_GET_LINK_MODE :hclge_get_link_mode (vport, req);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 79/129 net/smc: sync err code when tcp connection was refused
In reply to Greg Kroah-HartmanFrom: liuyacan <[email protected]>
[ Upstream commit 4e2e65e2e56c6ceb4ea1719360080c0af083229e ]
In the current implementation, when TCP initiates a connection to an unavailable [ip,port], ECONNREFUSED will be stored in the TCP socket, but SMC will not. However, some apps (like curl) use getsockopt(,,SO_ERROR,,) to get the error information, which makes them miss the error message and behave strangely.
--- net/smc/af_smc.c | 2 ++ 1 file changed, 2 insertions(+)
net/smc/af_smc.c +2 -0
@@ -1057,6 +1057,8 @@ static void smc_connect_work(struct work_struct *work) smc->sk.sk_state =SMC_CLOSED ;if (rc == -EPIPE || rc == -EAGAIN ) smc->sk.sk_err =EPIPE ; +else if (rc == -ECONNREFUSED ) + smc->sk.sk_err =ECONNREFUSED ;else if (signal_pending (current)) smc->sk.sk_err = -sock_intr_errno (timeo);sock_put (&smc->sk);/* passive closing */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 80/129 ip_gre: Make o_seqno start from 0 in native mode
In reply to Greg Kroah-HartmanFrom: Peilin Ye <[email protected]>
[ Upstream commit ff827beb706ed719c766acf36449801ded0c17fc ]
For GRE and GRETAP devices, currently o_seqno starts from 1 in native mode. According to RFC 2890 2.2., "The first datagram is sent with a sequence number of 0." Fix it.
It is worth mentioning that o_seqno already starts from 0 in collect_md mode, see gre_fb_xmit(), where tunnel->o_seqno is passed to gre_build_header() before getting incremented.
--- net/ipv4/ip_gre.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
net/ipv4/ip_gre.c +3 -5
@@ -454,14 +454,12 @@ static void __gre_xmit(struct sk_buff *skb, struct net_device *dev, __be16 proto) {struct ip_tunnel *tunnel =netdev_priv (dev); - -if (tunnel->parms.o_flags &TUNNEL_SEQ ) - tunnel->o_seqno++; +__be16 flags = tunnel->parms.o_flags;/* Push GRE header. */ gre_build_header (skb, tunnel->tun_hlen, - tunnel->parms.o_flags, proto, tunnel->parms.o_key, -htonl (tunnel->o_seqno)); + flags, proto, tunnel->parms.o_key, + (flags &TUNNEL_SEQ ) ?htonl (tunnel->o_seqno++) :0 );ip_tunnel_xmit (skb, dev, tnl_params, tnl_params->protocol); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 81/129 ip6_gre: Make o_seqno start from 0 in native mode
In reply to Greg Kroah-HartmanFrom: Peilin Ye <[email protected]>
[ Upstream commit fde98ae91f79cab4e020f40c35ed23cbdc59661c ]
For IP6GRE and IP6GRETAP devices, currently o_seqno starts from 1 in native mode. According to RFC 2890 2.2., "The first datagram is sent with a sequence number of 0." Fix it.
It is worth mentioning that o_seqno already starts from 0 in collect_md mode, see the "if (tunnel->parms.collect_md)" clause in __gre6_xmit(), where tunnel->o_seqno is passed to gre_build_header() before getting incremented.
--- net/ipv6/ip6_gre.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
net/ipv6/ip6_gre.c +5 -6
@@ -724,6 +724,7 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb, {struct ip6_tnl *tunnel =netdev_priv (dev);__be16 protocol; +__be16 flags;if (dev->type ==ARPHRD_ETHER )IPCB (skb)->flags =0 ;
@@ -739,7 +740,6 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb,if (tunnel->parms.collect_md) {struct ip_tunnel_info *tun_info;const struct ip_tunnel_key *key; -__be16 flags;int tun_hlen; tun_info =skb_tunnel_info_txcheck (skb);
@@ -770,15 +770,14 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb, : 0); }else { -if (tunnel->parms.o_flags &TUNNEL_SEQ ) - tunnel->o_seqno++; -if (skb_cow_head (skb, dev->needed_headroom ?: tunnel->hlen))return -ENOMEM ; -gre_build_header (skb, tunnel->tun_hlen, tunnel->parms.o_flags, + flags = tunnel->parms.o_flags; + +gre_build_header (skb, tunnel->tun_hlen, flags, protocol, tunnel->parms.o_key, -htonl (tunnel->o_seqno)); + (flags &TUNNEL_SEQ ) ?htonl (tunnel->o_seqno++) :0 ); } return ip6_tnl_xmit(skb, dev, dsfield, fl6, encap_limit, pmtu,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 82/129 ip_gre, ip6_gre: Fix race condition on o_seqno in collect_md mode
In reply to Greg Kroah-HartmanFrom: Peilin Ye <[email protected]>
[ Upstream commit 31c417c948d7f6909cb63f0ac3298f3c38f8ce20 ]
As pointed out by Jakub Kicinski, currently using TUNNEL_SEQ in collect_md mode is racy for [IP6]GRE[TAP] devices. Consider the following sequence of events:
1. An [IP6]GRE[TAP] device is created in collect_md mode using "ip link add ... external". "ip" ignores "[o]seq" if "external" is specified, so TUNNEL_SEQ is off, and the device is marked as NETIF_F_LLTX (i.e. it uses lockless TX);
2. Someone sets TUNNEL_SEQ on outgoing skb's, using e.g. bpf_skb_set_tunnel_key() in an eBPF program attached to this device;
3. gre_fb_xmit() or __gre6_xmit() processes these skb's:
gre_build_header(skb, tun_hlen, flags, protocol, tunnel_id_to_key32(tun_info->key.tun_id), (flags & TUNNEL_SEQ) ? htonl(tunnel->o_seqno++) : 0); ^^^^^^^^^^^^^^^^^
Since we are not using the TX lock (&txq->_xmit_lock), multiple CPUs may try to do this tunnel->o_seqno++ in parallel, which is racy. Fix it by making o_seqno atomic_t.
As mentioned by Eric Dumazet in commit b790e01aee74 ("ip_gre: lockless xmit"), making o_seqno atomic_t increases "chance for packets being out of order at receiver" when NETIF_F_LLTX is on.
Maybe a better fix would be:
1. Do not ignore "oseq" in external mode. Users MUST specify "oseq" if they want the kernel to allow sequencing of outgoing packets;
2. Reject all outgoing TUNNEL_SEQ packets if the device was not created with "oseq".
Unfortunately, that would break userspace.
We could now make [IP6]GRE[TAP] devices always NETIF_F_LLTX, but let us do it in separate patches to keep this fix minimal.
--- include/net/ip6_tunnel.h | 2 +- include/net/ip_tunnels.h | 2 +- net/ipv4/ip_gre.c | 6 +++--- net/ipv6/ip6_gre.c | 7 ++++--- 4 files changed, 9 insertions(+), 8 deletions(-)
include/net/ip6_tunnel.h +1 -1
@@ -57,7 +57,7 @@ struct ip6_tnl {/* These fields used only by GRE */ __u32 i_seqno;/* The last seen seqno */ -__u32 o_seqno;/* The last output seqno */ +atomic_t o_seqno;/* The last output seqno */ int hlen;/* tun_hlen + encap_hlen */ int tun_hlen;/* Precalculated header length */ int encap_hlen;/* Encap header length (FOU,GUE) */
include/net/ip_tunnels.h +1 -1
@@ -113,7 +113,7 @@ struct ip_tunnel {/* These four fields used only by GRE */ u32 i_seqno;/* The last seen seqno */ -u32 o_seqno;/* The last output seqno */ +atomic_t o_seqno;/* The last output seqno */ int tun_hlen;/* Precalculated header length */ /* These four fields used only by ERSPAN */
net/ipv4/ip_gre.c +3 -3
@@ -459,7 +459,7 @@ static void __gre_xmit(struct sk_buff *skb, struct net_device *dev,/* Push GRE header. */ gre_build_header (skb, tunnel->tun_hlen, flags, proto, tunnel->parms.o_key, - (flags &TUNNEL_SEQ ) ?htonl (tunnel->o_seqno++) :0 ); + (flags &TUNNEL_SEQ ) ?htonl (atomic_fetch_inc (&tunnel->o_seqno)) :0 );ip_tunnel_xmit (skb, dev, tnl_params, tnl_params->protocol); }
@@ -497,7 +497,7 @@ static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev, (TUNNEL_CSUM |TUNNEL_KEY |TUNNEL_SEQ );gre_build_header (skb, tunnel_hlen, flags, proto,tunnel_id_to_key32 (tun_info->key.tun_id), - (flags &TUNNEL_SEQ ) ?htonl (tunnel->o_seqno++) :0 ); + (flags &TUNNEL_SEQ ) ?htonl (atomic_fetch_inc (&tunnel->o_seqno)) :0 );ip_md_tunnel_xmit (skb, dev,IPPROTO_GRE , tunnel_hlen);
@@ -574,7 +574,7 @@ static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev) }gre_build_header (skb,8 ,TUNNEL_SEQ , - proto,0 ,htonl (tunnel->o_seqno++)); + proto,0 ,htonl (atomic_fetch_inc (&tunnel->o_seqno)));ip_md_tunnel_xmit (skb, dev,IPPROTO_GRE , tunnel_hlen);
net/ipv6/ip6_gre.c +4 -3
@@ -766,7 +766,7 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb,gre_build_header (skb, tun_hlen, flags, protocol,tunnel_id_to_key32 (tun_info->key.tun_id), - (flags &TUNNEL_SEQ ) ?htonl (tunnel->o_seqno++) + (flags &TUNNEL_SEQ ) ?htonl (atomic_fetch_inc (&tunnel->o_seqno)) :0 ); }else {
@@ -777,7 +777,8 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb,gre_build_header (skb, tunnel->tun_hlen, flags, protocol, tunnel->parms.o_key, - (flags &TUNNEL_SEQ ) ?htonl (tunnel->o_seqno++) :0 ); + (flags &TUNNEL_SEQ ) ?htonl (atomic_fetch_inc (&tunnel->o_seqno)) + :0 ); } return ip6_tnl_xmit(skb, dev, dsfield, fl6, encap_limit, pmtu,
@@ -1055,7 +1056,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,/* Push GRE header. */ proto = (t->parms.erspan_ver ==1 ) ?htons (ETH_P_ERSPAN ) :htons (ETH_P_ERSPAN2 ); -gre_build_header (skb,8 ,TUNNEL_SEQ , proto,0 ,htonl (t->o_seqno++)); +gre_build_header (skb,8 ,TUNNEL_SEQ , proto,0 ,htonl (atomic_fetch_inc (&t->o_seqno)));/* TooBig packet may have updated dst->dev's mtu */ if (!t->parms.collect_md && dst &&dst_mtu (dst) > dst->dev->mtu)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 83/129 tcp: fix potential xmit stalls caused by TCP_NOTSENT_LOWAT
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 4bfe744ff1644fbc0a991a2677dc874475dd6776 ]
I had this bug sitting for too long in my pile, it is time to fix it.
Thanks to Doug Porter for reminding me of it!
We had various attempts in the past, including commit 0cbe6a8f089e ("tcp: remove SOCK_QUEUE_SHRUNK"), but the issue is that TCP stack currently only generates EPOLLOUT from input path, when tp->snd_una has advanced and skb(s) cleaned from rtx queue.
If a flow has a big RTT, and/or receives SACKs, it is possible that the notsent part (tp->write_seq - tp->snd_nxt) reaches 0 and no more data can be sent until tp->snd_una finally advances.
What is needed is to also check if POLLOUT needs to be generated whenever tp->snd_nxt is advanced, from output path.
This bug triggers more often after an idle period, as we do not receive ACK for at least one RTT. tcp_notsent_lowat could be a fraction of what CWND and pacing rate would allow to send during this RTT.
In a followup patch, I will remove the bogus call to tcp_chrono_stop(sk, TCP_CHRONO_SNDBUF_LIMITED) from tcp_check_space(). Fact that we have decided to generate an EPOLLOUT does not mean the application has immediately refilled the transmit queue. This optimistic call might have been the reason the bug seemed not too serious.
Tested:
200 ms rtt, 1% packet loss, 32 MB tcp_rmem[2] and tcp_wmem[2]
$ echo 500000 >/proc/sys/net/ipv4/tcp_notsent_lowat
$ cat bench_rr.sh
SUM=0
for i in {1..10}
do
V=`netperf -H remote_host -l30 -t TCP_RR -- -r 10000000,10000 -o LOCAL_BYTES_SENT | egrep -v "MIGRATED|Bytes"`
echo $V
SUM=$(($SUM + $V))
done
echo SUM=$SUMBefore patch:
$ bench_rr.sh 130000000 80000000 140000000 140000000 140000000 140000000 130000000 40000000 90000000 110000000 SUM=1140000000
After patch:
$ bench_rr.sh 430000000 590000000 530000000 450000000 450000000 350000000 450000000 490000000 480000000 460000000 SUM=4680000000 # This is 410 % of the value before patch.
--- include/net/tcp.h | 1 + net/ipv4/tcp_input.c | 12 +++++++++++- net/ipv4/tcp_output.c | 1 + 3 files changed, 13 insertions(+), 1 deletion(-)
include/net/tcp.h +1 -0
@@ -598,6 +598,7 @@ void tcp_synack_rtt_meas(struct sock *sk, struct request_sock *req);void tcp_reset (struct sock *sk);void tcp_skb_mark_lost_uncond_verify (struct tcp_sock *tp,struct sk_buff *skb);void tcp_fin (struct sock *sk); +void tcp_check_space (struct sock *sk);/* tcp_timer.c */ void tcp_init_xmit_timers (struct sock *);
net/ipv4/tcp_input.c +11 -1
@@ -5370,7 +5370,17 @@ static void tcp_new_space(struct sock *sk) sk->sk_write_space (sk); } -static void tcp_check_space (struct sock *sk) +/* Caller made space either from: +* 1) Freeing skbs in rtx queues (after tp->snd_una has advanced) +* 2) Sent skbs from output queue (and thus advancing tp->snd_nxt) +* +* We might be able to generate EPOLLOUT to the application if: +* 1) Space consumed in output/rtx queues is below sk->sk_sndbuf/2 +* 2) notsent amount (tp->write_seq - tp->snd_nxt) became +* small enough that tcp_stream_memory_free() decides it +* is time to generate EPOLLOUT. +*/ +void tcp_check_space (struct sock *sk) {/* pairs with tcp_poll() */ smp_mb ();
net/ipv4/tcp_output.c +1 -0
@@ -82,6 +82,7 @@ static void tcp_event_new_data_sent(struct sock *sk, struct sk_buff *skb)NET_ADD_STATS (sock_net (sk),LINUX_MIB_TCPORIGDATASENT ,tcp_skb_pcount (skb)); +tcp_check_space (sk); }/* SND.NXT, if window was not shrunk or the amount of shrunk was less than one
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 84/129 tcp: make sure treq->af_specific is initialized
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit ba5a4fdd63ae0c575707030db0b634b160baddd7 ]
syzbot complained about a recent change in TCP stack, hitting a NULL pointer [1]
tcp request sockets have an af_specific pointer, which was used before the blamed change only for SYNACK generation in non SYNCOOKIE mode.
tcp requests sockets momentarily created when third packet coming from client in SYNCOOKIE mode were not using treq->af_specific.
Make sure this field is populated, in the same way normal TCP requests sockets do in tcp_conn_request().
[1]
TCP: request_sock_TCPv6: Possible SYN flooding on port 20002. Sending cookies. Check SNMP counters.
general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] CPU: 1 PID: 3695 Comm: syz-executor864 Not tainted 5.18.0-rc3-syzkaller-00224-g5fd1fe4807f9 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:tcp_create_openreq_child+0xe16/0x16b0 net/ipv4/tcp_minisocks.c:534 Code: 48 c1 ea 03 80 3c 02 00 0f 85 e5 07 00 00 4c 8b b3 28 01 00 00 48 b8 00 00 00 00 00 fc ff df 49 8d 7e 08 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 c9 07 00 00 48 8b 3c 24 48 89 de 41 ff 56 08 48 RSP: 0018:ffffc90000de0588 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: ffff888076490330 RCX: 0000000000000100 RDX: 0000000000000001 RSI: ffffffff87d67ff0 RDI: 0000000000000008 RBP: ffff88806ee1c7f8 R08: 0000000000000000 R09: 0000000000000000 R10: ffffffff87d67f00 R11: 0000000000000000 R12: ffff88806ee1bfc0 R13: ffff88801b0e0368 R14: 0000000000000000 R15: 0000000000000000 FS: 00007f517fe58700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffcead76960 CR3: 000000006f97b000 CR4: 00000000003506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <IRQ> tcp_v6_syn_recv_sock+0x199/0x23b0 net/ipv6/tcp_ipv6.c:1267 tcp_get_cookie_sock+0xc9/0x850 net/ipv4/syncookies.c:207 cookie_v6_check+0x15c3/0x2340 net/ipv6/syncookies.c:258 tcp_v6_cookie_check net/ipv6/tcp_ipv6.c:1131 [inline] tcp_v6_do_rcv+0x1148/0x13b0 net/ipv6/tcp_ipv6.c:1486 tcp_v6_rcv+0x3305/0x3840 net/ipv6/tcp_ipv6.c:1725 ip6_protocol_deliver_rcu+0x2e9/0x1900 net/ipv6/ip6_input.c:422 ip6_input_finish+0x14c/0x2c0 net/ipv6/ip6_input.c:464 NF_HOOK include/linux/netfilter.h:307 [inline] NF_HOOK include/linux/netfilter.h:301 [inline] ip6_input+0x9c/0xd0 net/ipv6/ip6_input.c:473 dst_input include/net/dst.h:461 [inline] ip6_rcv_finish net/ipv6/ip6_input.c:76 [inline] NF_HOOK include/linux/netfilter.h:307 [inline] NF_HOOK include/linux/netfilter.h:301 [inline] ipv6_rcv+0x27f/0x3b0 net/ipv6/ip6_input.c:297 __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5405 __netif_receive_skb+0x24/0x1b0 net/core/dev.c:5519 process_backlog+0x3a0/0x7c0 net/core/dev.c:5847 __napi_poll+0xb3/0x6e0 net/core/dev.c:6413 napi_poll net/core/dev.c:6480 [inline] net_rx_action+0x8ec/0xc60 net/core/dev.c:6567 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:637 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1097
--- include/net/tcp.h | 1 + net/ipv4/syncookies.c | 8 +++++++- net/ipv6/syncookies.c | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-)
include/net/tcp.h +1 -0
@@ -460,6 +460,7 @@ int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th, u32 cookie);struct sock *cookie_v4_check (struct sock *sk,struct sk_buff *skb);struct request_sock *cookie_tcp_reqsk_alloc (const struct request_sock_ops *ops, +const struct tcp_request_sock_ops *af_ops,struct sock *sk,struct sk_buff *skb);#ifdef CONFIG_SYN_COOKIES
net/ipv4/syncookies.c +7 -1
@@ -283,6 +283,7 @@ bool cookie_ecn_ok(const struct tcp_options_received *tcp_opt,EXPORT_SYMBOL (cookie_ecn_ok);struct request_sock *cookie_tcp_reqsk_alloc (const struct request_sock_ops *ops, +const struct tcp_request_sock_ops *af_ops,struct sock *sk,struct sk_buff *skb) {
@@ -299,6 +300,10 @@ struct request_sock *cookie_tcp_reqsk_alloc(const struct request_sock_ops *ops,return NULL ; treq =tcp_rsk (req); + +/* treq->af_specific might be used to perform TCP_MD5 lookup */ + treq->af_specific = af_ops; + treq->syn_tos =TCP_SKB_CB (skb)->ip_dsfield;#if IS_ENABLED (CONFIG_MPTCP ) treq->is_mptcp =sk_is_mptcp (sk);
@@ -366,7 +371,8 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb) goto out; ret =NULL ; - req =cookie_tcp_reqsk_alloc (&tcp_request_sock_ops, sk, skb); + req =cookie_tcp_reqsk_alloc (&tcp_request_sock_ops, + &tcp_request_sock_ipv4_ops, sk, skb);if (!req) goto out;
net/ipv6/syncookies.c +2 -1
@@ -170,7 +170,8 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) goto out; ret =NULL ; - req =cookie_tcp_reqsk_alloc (&tcp6_request_sock_ops, sk, skb); + req =cookie_tcp_reqsk_alloc (&tcp6_request_sock_ops, + &tcp_request_sock_ipv6_ops, sk, skb);if (!req) goto out;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 85/129 bus: sunxi-rsb: Fix the return value of sunxi_rsb_device_create()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit fff8c10368e64e7f8960f149375c12ca5f3b30af ]
This code is really spurious.
It always returns an ERR_PTR, even when err is known to be 0 and calls put_device() after a successful device_register() call.
It is likely that the return statement in the normal path is missing. Add 'return rdev;' to fix it.
--- drivers/bus/sunxi-rsb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bus/sunxi-rsb.c +2 -0
@@ -224,6 +224,8 @@ static struct sunxi_rsb_device *sunxi_rsb_device_create(struct sunxi_rsb *rsb,dev_dbg (&rdev->dev,"device %s registered\n" ,dev_name (&rdev->dev)); +return rdev; + err_device_add:put_device (&rdev->dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 86/129 clk: sunxi: sun9i-mmc: check return value after calling platform_get_resource()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit f58ca215cda1975f77b2b762903684a3c101bec9 ]
It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value.
--- drivers/clk/sunxi/clk-sun9i-mmc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/sunxi/clk-sun9i-mmc.c +2 -0
@@ -109,6 +109,8 @@ static int sun9i_a80_mmc_config_clk_probe(struct platform_device *pdev)spin_lock_init (&data->lock); r =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!r) +return -EINVAL ;/* one clock/reset pair per word */ count =DIV_ROUND_UP ((resource_size (r)),SUN9I_MMC_WIDTH ); data->membase =devm_ioremap_resource (&pdev->dev, r);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 87/129 net: bcmgenet: hide status block before TX timestamping
In reply to Greg Kroah-HartmanFrom: Jonathan Lemon <[email protected]>
[ Upstream commit acac0541d1d65e81e599ec399d34d184d2424401 ]
The hardware checksum offloading requires use of a transmit status block inserted before the outgoing frame data, this was updated in '9a9ba2a4aaaa ("net: bcmgenet: always enable status blocks")'
However, skb_tx_timestamp() assumes that it is passed a raw frame and PTP parsing chokes on this status block.
Fix this by calling __skb_pull(), which hides the TSB before calling skb_tx_timestamp(), so an outgoing PTP packet is parsed correctly.
As the data in the skb has already been set up for DMA, and the dma_unmap_* calls use a separately stored address, there is no no effective change in the data transmission.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +7 -0
@@ -1987,6 +1987,11 @@ static struct sk_buff *bcmgenet_add_tsb(struct net_device *dev,return skb; } +static void bcmgenet_hide_tsb (struct sk_buff *skb) +{ +__skb_pull (skb,sizeof (struct status_64 )); +} +static netdev_tx_t bcmgenet_xmit (struct sk_buff *skb,struct net_device *dev) {struct bcmgenet_priv *priv =netdev_priv (dev);
@@ -2093,6 +2098,8 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) }GENET_CB (skb)->last_cb = tx_cb_ptr; + +bcmgenet_hide_tsb (skb);skb_tx_timestamp (skb);/* Decrement total BD count and advance our write pointer */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 88/129 net: phy: marvell10g: fix return value on error
In reply to Greg Kroah-HartmanFrom: Baruch Siach <[email protected]>
[ Upstream commit 0ed9704b660b259b54743cad8a84a11148f60f0a ]
Return back the error value that we get from phy_read_mmd().
--- drivers/net/phy/marvell10g.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/marvell10g.c +1 -1
@@ -650,7 +650,7 @@ static int mv3310_read_status_copper(struct phy_device *phydev) cssr1 =phy_read_mmd (phydev,MDIO_MMD_PCS ,MV_PCS_CSSR1 );if (cssr1 <0 ) -return val; +return cssr1;/* If the link settings are not resolved, mark the link down */ if (!(cssr1 &MV_PCS_CSSR1_RESOLVED )) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 89/129 net: dsa: lantiq_gswip: Dont set GSWIP_MII_CFG_RMII_CLK
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 71cffebf6358a7f5031f5b208bbdc1cb4db6e539 ]
Commit 4b5923249b8fa4 ("net: dsa: lantiq_gswip: Configure all remaining GSWIP_MII_CFG bits") added all known bits in the GSWIP_MII_CFGp register. It helped bring this register into a well-defined state so the driver has to rely less on the bootloader to do things right. Unfortunately it also sets the GSWIP_MII_CFG_RMII_CLK bit without any possibility to configure it. Upon further testing it turns out that all boards which are supported by the GSWIP driver in OpenWrt which use an RMII PHY have a dedicated oscillator on the board which provides the 50MHz RMII reference clock.
Don't set the GSWIP_MII_CFG_RMII_CLK bit (but keep the code which always clears it) to fix support for the Fritz!Box 7362 SL in OpenWrt. This is a board with two Atheros AR8030 RMII PHYs. With the "RMII clock" bit set the MAC also generates the RMII reference clock whose signal then conflicts with the signal from the oscillator on the board. This results in a constant cycle of the PHY detecting link up/down (and as a result of that: the two ports using the AR8030 PHYs are not working).
At the time of writing this patch there's no known board where the MAC (GSWIP) has to generate the RMII reference clock. If needed this can be implemented in future by providing a device-tree flag so the GSWIP_MII_CFG_RMII_CLK bit can be toggled per port.
--- drivers/net/dsa/lantiq_gswip.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/dsa/lantiq_gswip.c +0 -3
@@ -1629,9 +1629,6 @@ static void gswip_phylink_mac_config(struct dsa_switch *ds, int port,break ;case PHY_INTERFACE_MODE_RMII : miicfg |=GSWIP_MII_CFG_MODE_RMIIM ; - -/* Configure the RMII clock as output: */ - miicfg |=GSWIP_MII_CFG_RMII_CLK ;break ;case PHY_INTERFACE_MODE_RGMII :case PHY_INTERFACE_MODE_RGMII_ID :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 90/129 drm/amdkfd: Fix GWS queue count
In reply to Greg Kroah-HartmanFrom: David Yat Sin <[email protected]>
[ Upstream commit 7c6b6e18c890f30965b0589b0a57645e1dbccfde ]
dqm->gws_queue_count and pdd->qpd.mapped_gws_queue need to be updated each time the queue gets evicted.
--- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 83 +++++++++---------- 1 file changed, 37 insertions(+), 46 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +37 -46
@@ -138,19 +138,33 @@ void program_sh_mem_settings(struct device_queue_manager *dqm, }static void increment_queue_count (struct device_queue_manager *dqm, -enum kfd_queue_type type) +struct qcm_process_device *qpd, +struct queue *q) { dqm->active_queue_count++; -if (type ==KFD_QUEUE_TYPE_COMPUTE || type ==KFD_QUEUE_TYPE_DIQ ) +if (q->properties.type ==KFD_QUEUE_TYPE_COMPUTE || + q->properties.type ==KFD_QUEUE_TYPE_DIQ ) dqm->active_cp_queue_count++; + +if (q->properties.is_gws) { + dqm->gws_queue_count++; + qpd->mapped_gws_queue = true; + } }static void decrement_queue_count (struct device_queue_manager *dqm, -enum kfd_queue_type type) +struct qcm_process_device *qpd, +struct queue *q) { dqm->active_queue_count--; -if (type ==KFD_QUEUE_TYPE_COMPUTE || type ==KFD_QUEUE_TYPE_DIQ ) +if (q->properties.type ==KFD_QUEUE_TYPE_COMPUTE || + q->properties.type ==KFD_QUEUE_TYPE_DIQ ) dqm->active_cp_queue_count--; + +if (q->properties.is_gws) { + dqm->gws_queue_count--; + qpd->mapped_gws_queue = false; + } }static int allocate_doorbell (struct qcm_process_device *qpd,struct queue *q)
@@ -377,7 +391,7 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm,list_add (&q->list, &qpd->queues_list); qpd->queue_count++;if (q->properties.is_active) -increment_queue_count (dqm, q->properties.type); +increment_queue_count (dqm, qpd, q);/* * Unconditionally increment this counter, regardless of the queue's
@@ -502,13 +516,8 @@ static int destroy_queue_nocpsch_locked(struct device_queue_manager *dqm,deallocate_vmid (dqm, qpd, q); } qpd->queue_count--; -if (q->properties.is_active) { -decrement_queue_count (dqm, q->properties.type); -if (q->properties.is_gws) { - dqm->gws_queue_count--; - qpd->mapped_gws_queue = false; - } - } +if (q->properties.is_active) +decrement_queue_count (dqm, qpd, q);return retval; }
@@ -598,12 +607,11 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q)* dqm->active_queue_count to determine whether a new runlist must be * uploaded. */ -if (q->properties.is_active && !prev_active) -increment_queue_count (dqm, q->properties.type); -else if (!q->properties.is_active && prev_active) -decrement_queue_count (dqm, q->properties.type); - -if (q->gws && !q->properties.is_gws) { +if (q->properties.is_active && !prev_active) { +increment_queue_count (dqm, &pdd->qpd, q); + }else if (!q->properties.is_active && prev_active) { +decrement_queue_count (dqm, &pdd->qpd, q); + }else if (q->gws && !q->properties.is_gws) {if (q->properties.is_active) { dqm->gws_queue_count++; pdd->qpd.mapped_gws_queue = true;
@@ -665,11 +673,7 @@ static int evict_process_queues_nocpsch(struct device_queue_manager *dqm, mqd_mgr = dqm->mqd_mgrs[get_mqd_type_from_queue_type ( q->properties.type)]; q->properties.is_active = false; -decrement_queue_count (dqm, q->properties.type); -if (q->properties.is_gws) { - dqm->gws_queue_count--; - qpd->mapped_gws_queue = false; - } +decrement_queue_count (dqm, qpd, q);if (WARN_ONCE (!dqm->sched_running,"Evict when stopped\n" ))continue ;
@@ -713,7 +717,7 @@ static int evict_process_queues_cpsch(struct device_queue_manager *dqm,continue ; q->properties.is_active = false; -decrement_queue_count (dqm, q->properties.type); +decrement_queue_count (dqm, qpd, q); } pdd->last_evict_timestamp =get_jiffies_64 (); retval = execute_queues_cpsch(dqm,
@@ -784,11 +788,7 @@ static int restore_process_queues_nocpsch(struct device_queue_manager *dqm, mqd_mgr = dqm->mqd_mgrs[get_mqd_type_from_queue_type ( q->properties.type)]; q->properties.is_active = true; -increment_queue_count (dqm, q->properties.type); -if (q->properties.is_gws) { - dqm->gws_queue_count++; - qpd->mapped_gws_queue = true; - } +increment_queue_count (dqm, qpd, q);if (WARN_ONCE (!dqm->sched_running,"Restore when stopped\n" ))continue ;
@@ -846,7 +846,7 @@ static int restore_process_queues_cpsch(struct device_queue_manager *dqm,continue ; q->properties.is_active = true; -increment_queue_count (dqm, q->properties.type); +increment_queue_count (dqm, &pdd->qpd, q); } retval =execute_queues_cpsch (dqm,KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES ,0 );
@@ -1247,7 +1247,7 @@ static int create_kernel_queue_cpsch(struct device_queue_manager *dqm, dqm->total_queue_count);list_add (&kq->list, &qpd->priv_queue_list); -increment_queue_count (dqm, kq->queue->properties.type); +increment_queue_count (dqm, qpd, kq->queue); qpd->is_debug = true;execute_queues_cpsch (dqm,KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES ,0 );dqm_unlock (dqm);
@@ -1261,7 +1261,7 @@ static void destroy_kernel_queue_cpsch(struct device_queue_manager *dqm, {dqm_lock (dqm);list_del (&kq->list); -decrement_queue_count (dqm, kq->queue->properties.type); +decrement_queue_count (dqm, qpd, kq->queue); qpd->is_debug = false;execute_queues_cpsch (dqm,KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES ,0 );/*
@@ -1328,7 +1328,7 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q, qpd->queue_count++;if (q->properties.is_active) { -increment_queue_count (dqm, q->properties.type); +increment_queue_count (dqm, qpd, q);execute_queues_cpsch (dqm,KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES ,0 );
@@ -1513,15 +1513,11 @@ static int destroy_queue_cpsch(struct device_queue_manager *dqm,list_del (&q->list); qpd->queue_count--;if (q->properties.is_active) { -decrement_queue_count (dqm, q->properties.type); +decrement_queue_count (dqm, qpd, q); retval =execute_queues_cpsch (dqm,KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES ,0 );if (retval == -ETIME ) qpd->reset_wavefronts = true; -if (q->properties.is_gws) { - dqm->gws_queue_count--; - qpd->mapped_gws_queue = false; - } }/*
@@ -1732,7 +1728,7 @@ static int process_termination_cpsch(struct device_queue_manager *dqm,/* Clean all kernel queues */ list_for_each_entry_safe (kq, kq_next, &qpd->priv_queue_list, list) {list_del (&kq->list); -decrement_queue_count (dqm, kq->queue->properties.type); +decrement_queue_count (dqm, qpd, kq->queue); qpd->is_debug = false; dqm->total_queue_count--; filter =KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES ;
@@ -1745,13 +1741,8 @@ static int process_termination_cpsch(struct device_queue_manager *dqm,else if (q->properties.type ==KFD_QUEUE_TYPE_SDMA_XGMI )deallocate_sdma_queue (dqm, q); -if (q->properties.is_active) { -decrement_queue_count (dqm, q->properties.type); -if (q->properties.is_gws) { - dqm->gws_queue_count--; - qpd->mapped_gws_queue = false; - } - } +if (q->properties.is_active) +decrement_queue_count (dqm, qpd, q); dqm->total_queue_count--; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 91/129 drm/amd/display: Fix memory leak in dcn21_clock_source_create
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 65e54987508b6f0771f56bdfa3ee1926d52785ae ]
When dcn20_clk_src_construct() fails, we need to release clk_src.
--- drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +1 -0
@@ -1267,6 +1267,7 @@ static struct clock_source *dcn21_clock_source_create(return &clk_src->base; } +kfree (clk_src);BREAK_TO_DEBUGGER ();return NULL ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 92/129 tls: Skip tls_append_frag on zero copy size
In reply to Greg Kroah-HartmanFrom: Maxim Mikityanskiy <[email protected]>
[ Upstream commit a0df71948e9548de819a6f1da68f5f1742258a52 ]
Calling tls_append_frag when max_open_record_len == record->len might add an empty fragment to the TLS record if the call happens to be on the page boundary. Normally tls_append_frag coalesces the zero-sized fragment to the previous one, but not if it's on page boundary.
If a resync happens then, the mlx5 driver posts dump WQEs in tx_post_resync_dump, and the empty fragment may become a data segment with byte_count == 0, which will confuse the NIC and lead to a CQE error.
This commit fixes the described issue by skipping tls_append_frag on zero size to avoid adding empty fragments. The fix is not in the driver, because an empty fragment is hardly the desired behavior.
--- net/tls/tls_device.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
net/tls/tls_device.c +7 -5
@@ -483,11 +483,13 @@ static int tls_push_data(struct sock *sk, copy =min_t (size_t, size, (pfrag->size - pfrag->offset)); copy =min_t (size_t, copy, (max_open_record_len - record->len)); - rc =tls_device_copy_data (page_address (pfrag->page) + - pfrag->offset, copy, msg_iter); -if (rc) - goto handle_error; -tls_append_frag (record, pfrag, copy); +if (copy) { + rc =tls_device_copy_data (page_address (pfrag->page) + + pfrag->offset, copy, msg_iter); +if (rc) + goto handle_error; +tls_append_frag (record, pfrag, copy); + } size -= copy;if (!size) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 93/129 bnx2x: fix napi API usage sequence
In reply to Greg Kroah-HartmanFrom: Manish Chopra <[email protected]>
[ Upstream commit af68656d66eda219b7f55ce8313a1da0312c79e1 ]
While handling PCI errors (AER flow) driver tries to disable NAPI [napi_disable()] after NAPI is deleted [__netif_napi_del()] which causes unexpected system hang/crash.
System message log shows the following:
=======================================
[ 3222.537510] EEH: Detected PCI bus error on PHB#384-PE#800000 [ 3222.537511] EEH: This PCI device has failed 2 times in the last hour and will be permanently disabled after 5 failures. [ 3222.537512] EEH: Notify device drivers to shutdown [ 3222.537513] EEH: Beginning: 'error_detected(IO frozen)' [ 3222.537514] EEH: PE#800000 (PCI 0384:80:00.0): Invoking bnx2x->error_detected(IO frozen) [ 3222.537516] bnx2x: [bnx2x_io_error_detected:14236(eth14)]IO error detected [ 3222.537650] EEH: PE#800000 (PCI 0384:80:00.0): bnx2x driver reports: 'need reset' [ 3222.537651] EEH: PE#800000 (PCI 0384:80:00.1): Invoking bnx2x->error_detected(IO frozen) [ 3222.537651] bnx2x: [bnx2x_io_error_detected:14236(eth13)]IO error detected [ 3222.537729] EEH: PE#800000 (PCI 0384:80:00.1): bnx2x driver reports: 'need reset' [ 3222.537729] EEH: Finished:'error_detected(IO frozen)' with aggregate recovery state:'need reset' [ 3222.537890] EEH: Collect temporary log [ 3222.583481] EEH: of node=0384:80:00.0 [ 3222.583519] EEH: PCI device/vendor: 168e14e4 [ 3222.583557] EEH: PCI cmd/status register: 00100140 [ 3222.583557] EEH: PCI-E capabilities and status follow: [ 3222.583744] EEH: PCI-E 00: 00020010 012c8da2 00095d5e 00455c82 [ 3222.583892] EEH: PCI-E 10: 10820000 00000000 00000000 00000000 [ 3222.583893] EEH: PCI-E 20: 00000000 [ 3222.583893] EEH: PCI-E AER capability register set follows: [ 3222.584079] EEH: PCI-E AER 00: 13c10001 00000000 00000000 00062030 [ 3222.584230] EEH: PCI-E AER 10: 00002000 000031c0 000001e0 00000000 [ 3222.584378] EEH: PCI-E AER 20: 00000000 00000000 00000000 00000000 [ 3222.584416] EEH: PCI-E AER 30: 00000000 00000000 [ 3222.584416] EEH: of node=0384:80:00.1 [ 3222.584454] EEH: PCI device/vendor: 168e14e4 [ 3222.584491] EEH: PCI cmd/status register: 00100140 [ 3222.584492] EEH: PCI-E capabilities and status follow: [ 3222.584677] EEH: PCI-E 00: 00020010 012c8da2 00095d5e 00455c82 [ 3222.584825] EEH: PCI-E 10: 10820000 00000000 00000000 00000000 [ 3222.584826] EEH: PCI-E 20: 00000000 [ 3222.584826] EEH: PCI-E AER capability register set follows: [ 3222.585011] EEH: PCI-E AER 00: 13c10001 00000000 00000000 00062030 [ 3222.585160] EEH: PCI-E AER 10: 00002000 000031c0 000001e0 00000000 [ 3222.585309] EEH: PCI-E AER 20: 00000000 00000000 00000000 00000000 [ 3222.585347] EEH: PCI-E AER 30: 00000000 00000000 [ 3222.586872] RTAS: event: 5, Type: Platform Error (224), Severity: 2 [ 3222.586873] EEH: Reset without hotplug activity [ 3224.762767] EEH: Beginning: 'slot_reset' [ 3224.762770] EEH: PE#800000 (PCI 0384:80:00.0): Invoking bnx2x->slot_reset() [ 3224.762771] bnx2x: [bnx2x_io_slot_reset:14271(eth14)]IO slot reset initializing... [ 3224.762887] bnx2x 0384:80:00.0: enabling device (0140 -> 0142) [ 3224.768157] bnx2x: [bnx2x_io_slot_reset:14287(eth14)]IO slot reset
--> driver unload
Uninterruptible tasks
=====================
crash> ps | grep UN
213 2 11 c000000004c89e00 UN 0.0 0 0 [eehd]
215 2 0 c000000004c80000 UN 0.0 0 0
[kworker/0:2]
2196 1 28 c000000004504f00 UN 0.1 15936 11136 wickedd
4287 1 9 c00000020d076800 UN 0.0 4032 3008 agetty
4289 1 20 c00000020d056680 UN 0.0 7232 3840 agetty
32423 2 26 c00000020038c580 UN 0.0 0 0
[kworker/26:3]
32871 4241 27 c0000002609ddd00 UN 0.1 18624 11648 sshd
32920 10130 16 c00000027284a100 UN 0.1 48512 12608 sendmail
33092 32987 0 c000000205218b00 UN 0.1 48512 12608 sendmail
33154 4567 16 c000000260e51780 UN 0.1 48832 12864 pickup
33209 4241 36 c000000270cb6500 UN 0.1 18624 11712 sshd
33473 33283 0 c000000205211480 UN 0.1 48512 12672 sendmail
33531 4241 37 c00000023c902780 UN 0.1 18624 11648 sshdEEH handler hung while bnx2x sleeping and holding RTNL lock
===========================================================
crash> bt 213
PID: 213 TASK: c000000004c89e00 CPU: 11 COMMAND: "eehd"
#0 [c000000004d477e0] __schedule at c000000000c70808 #1 [c000000004d478b0] schedule at c000000000c70ee0 #2 [c000000004d478e0] schedule_timeout at c000000000c76dec #3 [c000000004d479c0] msleep at c0000000002120cc #4 [c000000004d479f0] napi_disable at c000000000a06448
^^^^^^^^^^^^^^^^
#5 [c000000004d47a30] bnx2x_netif_stop at c0080000018dba94 [bnx2x] #6 [c000000004d47a60] bnx2x_io_slot_reset at c0080000018a551c [bnx2x] #7 [c000000004d47b20] eeh_report_reset at c00000000004c9bc #8 [c000000004d47b90] eeh_pe_report at c00000000004d1a8
#9 [c000000004d47c40] eeh_handle_normal_event at c00000000004da64
And the sleeping source code
============================
crash> dis -ls c000000000a06448
FILE: ../net/core/dev.c
LINE: 6702
6697 {
6698 might_sleep();
6699 set_bit(NAPI_STATE_DISABLE, &n->state);
6700
6701 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
* 6702 msleep(1);
6703 while (test_and_set_bit(NAPI_STATE_NPSVC, &n->state))
6704 msleep(1);
6705
6706 hrtimer_cancel(&n->timer);
6707
6708 clear_bit(NAPI_STATE_DISABLE, &n->state);
6709 }
EEH calls into bnx2x twice based on the system log above, first through bnx2x_io_error_detected() and then bnx2x_io_slot_reset(), and executes the following call chains:
bnx2x_io_error_detected()
+-> bnx2x_eeh_nic_unload()
+-> bnx2x_del_all_napi()
+-> __netif_napi_del()bnx2x_io_slot_reset()
+-> bnx2x_netif_stop()
+-> bnx2x_napi_disable()
+->napi_disable()Fix this by correcting the sequence of NAPI APIs usage, that is delete the NAPI after disabling it.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +5 -4
@@ -14213,10 +14213,6 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp)/* Stop Tx */ bnx2x_tx_disable (bp); -/* Delete all NAPI objects */ -bnx2x_del_all_napi (bp); -if (CNIC_LOADED (bp)) -bnx2x_del_all_napi_cnic (bp);netdev_reset_tc (bp->dev);del_timer_sync (&bp->timer);
@@ -14321,6 +14317,11 @@ static pci_ers_result_t bnx2x_io_slot_reset(struct pci_dev *pdev)bnx2x_drain_tx_queues (bp);bnx2x_send_unload_req (bp,UNLOAD_RECOVERY );bnx2x_netif_stop (bp,1 ); +bnx2x_del_all_napi (bp); + +if (CNIC_LOADED (bp)) +bnx2x_del_all_napi_cnic (bp); +bnx2x_free_irq (bp);/* Report UNLOAD_DONE to MCP */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 94/129 net: fec: add missing of_node_put() in fec_enet_init_stop_mode()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit d2b52ec056d5bddb055c8f21d7489a23548d0838 ]
Put device node in error path in fec_enet_init_stop_mode().
--- drivers/net/ethernet/freescale/fec_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/fec_main.c +1 -1
@@ -3529,7 +3529,7 @@ static int fec_enet_init_stop_mode(struct fec_enet_private *fep, ARRAY_SIZE(out_val));if (ret) {dev_dbg (&fep->pdev->dev,"no stop mode property\n" ); -return ret; + goto out; } fep->stop_gpr.gpr =syscon_node_to_regmap (gpr_np);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 95/129 ixgbe: ensure IPsec VF<->PF compatibility
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit f049efc7f7cd2f3c419f55040928eaefb13b3636 ]
The VF driver can forward any IPsec flags and such makes the function is not extendable and prone to backward/forward incompatibility.
If new software runs on VF, it won't know that PF configured something completely different as it "knows" only XFRM_OFFLOAD_INBOUND flag.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c +2 -1
@@ -903,7 +903,8 @@ int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)/* Tx IPsec offload doesn't seem to work on this * device, so block these requests for now. */ -if (!(sam->flags &XFRM_OFFLOAD_INBOUND )) { + sam->flags = sam->flags & ~XFRM_OFFLOAD_IPV6 ; +if (sam->flags !=XFRM_OFFLOAD_INBOUND ) { err = -EOPNOTSUPP ; goto err_out; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 96/129 ibmvnic: fix miscellaneous checks
In reply to Greg Kroah-HartmanFrom: Lijun Pan <[email protected]>
[ Upstream commit 91dc5d2553fbf20e2e8384ac997f278a50c70561 ]
Fix the following checkpatch checks:
CHECK: Macro argument 'off' may be better as '(off)' to avoid precedence issues
CHECK: Alignment should match open parenthesis
CHECK: multiple assignments should be avoided
CHECK: Blank lines aren't necessary before a close brace '}'
CHECK: Please use a blank line after function/struct/union/enum declarations
CHECK: Unnecessary parentheses around 'rc != H_FUNCTION'
--- drivers/net/ethernet/ibm/ibmvnic.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +9 -8
@@ -117,7 +117,7 @@ struct ibmvnic_stat {#define IBMVNIC_STAT_OFF (stat) (offsetof(struct ibmvnic_adapter, stats) + \ offsetof(struct ibmvnic_statistics, stat)) -#define IBMVNIC_GET_STAT (a, off) (*((u64 *)(((unsigned long)(a)) + off))) +#define IBMVNIC_GET_STAT (a, off) (*((u64 *)(((unsigned long)(a)) + (off))))static const struct ibmvnic_stat ibmvnic_stats[] = { {"rx_packets" ,IBMVNIC_STAT_OFF (rx_packets)},
@@ -2063,14 +2063,14 @@ static int do_reset(struct ibmvnic_adapter *adapter, rc =reset_tx_pools (adapter);if (rc) {netdev_dbg (adapter->netdev,"reset tx pools failed (%d)\n" , - rc); + rc); goto out; } rc =reset_rx_pools (adapter);if (rc) {netdev_dbg (adapter->netdev,"reset rx pools failed (%d)\n" , - rc); + rc); goto out; } }
@@ -2331,7 +2331,8 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter,if (adapter->state ==VNIC_PROBING ) {netdev_warn (netdev,"Adapter reset during probe\n" ); - ret = adapter->init_done_rc =EAGAIN ; + adapter->init_done_rc =EAGAIN ; + ret =EAGAIN ; goto err; }
@@ -2744,7 +2745,6 @@ static int ibmvnic_set_channels(struct net_device *netdev, channels->rx_count, channels->tx_count, adapter->req_rx_queues, adapter->req_tx_queues);return ret; - }static void ibmvnic_get_strings (struct net_device *dev,u32 stringset,u8 *data)
@@ -2833,8 +2833,8 @@ static void ibmvnic_get_ethtool_stats(struct net_device *dev,return ;for (i =0 ; i <ARRAY_SIZE (ibmvnic_stats); i++) - data[i] =be64_to_cpu (IBMVNIC_GET_STAT (adapter, - ibmvnic_stats[i].offset)); + data[i] =be64_to_cpu (IBMVNIC_GET_STAT + (adapter, ibmvnic_stats[i].offset));for (j =0 ; j < adapter->req_tx_queues; j++) { data[i] = adapter->tx_stats_buffers[j].packets;
@@ -2874,6 +2874,7 @@ static int ibmvnic_set_priv_flags(struct net_device *netdev, u32 flags)return 0 ; } +static const struct ethtool_ops ibmvnic_ethtool_ops = { .get_drvinfo = ibmvnic_get_drvinfo, .get_msglevel = ibmvnic_get_msglevel,
@@ -3119,7 +3120,7 @@ static int enable_scrq_irq(struct ibmvnic_adapter *adapter,/* H_EOI would fail with rc = H_FUNCTION when running * in XIVE mode which is expected, but not an error. */ -if (rc && (rc !=H_FUNCTION )) +if (rc && rc !=H_FUNCTION )dev_err (dev,"H_EOI FAILED irq 0x%llx. rc=%ld\n" , val, rc); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 97/129 Revert "ibmvnic: Add ethtool private flag for driver-defined queue limits"
In reply to Greg Kroah-HartmanFrom: Dany Madden <[email protected]>
[ Upstream commit aeaf59b78712c7a1827c76f086acff4f586e072f ]
This reverts commit 723ad916134784b317b72f3f6cf0f7ba774e5dae
When client requests channel or ring size larger than what the server can support the server will cap the request to the supported max. So, the client would not be able to successfully request resources that exceed the server limit.
--- drivers/net/ethernet/ibm/ibmvnic.c | 129 ++++++++--------------------- drivers/net/ethernet/ibm/ibmvnic.h | 6 -- 2 files changed, 35 insertions(+), 100 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +35 -94
@@ -2666,13 +2666,8 @@ static void ibmvnic_get_ringparam(struct net_device *netdev, {struct ibmvnic_adapter *adapter =netdev_priv (netdev); -if (adapter->priv_flags &IBMVNIC_USE_SERVER_MAXES ) { - ring->rx_max_pending = adapter->max_rx_add_entries_per_subcrq; - ring->tx_max_pending = adapter->max_tx_entries_per_subcrq; - }else { - ring->rx_max_pending =IBMVNIC_MAX_QUEUE_SZ ; - ring->tx_max_pending =IBMVNIC_MAX_QUEUE_SZ ; - } + ring->rx_max_pending = adapter->max_rx_add_entries_per_subcrq; + ring->tx_max_pending = adapter->max_tx_entries_per_subcrq; ring->rx_mini_max_pending =0 ; ring->rx_jumbo_max_pending =0 ; ring->rx_pending = adapter->req_rx_add_entries_per_subcrq;
@@ -2685,23 +2680,21 @@ static int ibmvnic_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) {struct ibmvnic_adapter *adapter =netdev_priv (netdev); -int ret; - ret =0 ; +if (ring->rx_pending > adapter->max_rx_add_entries_per_subcrq || + ring->tx_pending > adapter->max_tx_entries_per_subcrq) { +netdev_err (netdev,"Invalid request.\n" ); +netdev_err (netdev,"Max tx buffers = %llu\n" , + adapter->max_rx_add_entries_per_subcrq); +netdev_err (netdev,"Max rx buffers = %llu\n" , + adapter->max_tx_entries_per_subcrq); +return -EINVAL ; + } + adapter->desired.rx_entries = ring->rx_pending; adapter->desired.tx_entries = ring->tx_pending; - ret =wait_for_reset (adapter); - -if (!ret && - (adapter->req_rx_add_entries_per_subcrq != ring->rx_pending || - adapter->req_tx_entries_per_subcrq != ring->tx_pending)) -netdev_info (netdev, -"Could not match full ringsize request. Requested: RX %d, TX %d; Allowed: RX %llu, TX %llu\n" , - ring->rx_pending, ring->tx_pending, - adapter->req_rx_add_entries_per_subcrq, - adapter->req_tx_entries_per_subcrq); -return ret; +return wait_for_reset (adapter); } static void ibmvnic_get_channels(struct net_device *netdev,
@@ -2709,14 +2702,8 @@ static void ibmvnic_get_channels(struct net_device *netdev, {struct ibmvnic_adapter *adapter =netdev_priv (netdev); -if (adapter->priv_flags &IBMVNIC_USE_SERVER_MAXES ) { - channels->max_rx = adapter->max_rx_queues; - channels->max_tx = adapter->max_tx_queues; - }else { - channels->max_rx =IBMVNIC_MAX_QUEUES ; - channels->max_tx =IBMVNIC_MAX_QUEUES ; - } - + channels->max_rx = adapter->max_rx_queues; + channels->max_tx = adapter->max_tx_queues; channels->max_other =0 ; channels->max_combined =0 ; channels->rx_count = adapter->req_rx_queues;
@@ -2729,22 +2716,11 @@ static int ibmvnic_set_channels(struct net_device *netdev, struct ethtool_channels *channels) {struct ibmvnic_adapter *adapter =netdev_priv (netdev); -int ret; - ret =0 ; adapter->desired.rx_queues = channels->rx_count; adapter->desired.tx_queues = channels->tx_count; - ret =wait_for_reset (adapter); - -if (!ret && - (adapter->req_rx_queues != channels->rx_count || - adapter->req_tx_queues != channels->tx_count)) -netdev_info (netdev, -"Could not match full channels request. Requested: RX %d, TX %d; Allowed: RX %llu, TX %llu\n" , - channels->rx_count, channels->tx_count, - adapter->req_rx_queues, adapter->req_tx_queues); -return ret; +return wait_for_reset (adapter); }static void ibmvnic_get_strings (struct net_device *dev,u32 stringset,u8 *data)
@@ -2752,43 +2728,32 @@ static void ibmvnic_get_strings(struct net_device *dev, u32 stringset, u8 *data)struct ibmvnic_adapter *adapter =netdev_priv (dev);int i; -switch (stringset) { -case ETH_SS_STATS : -for (i =0 ; i <ARRAY_SIZE (ibmvnic_stats); - i++, data +=ETH_GSTRING_LEN ) -memcpy (data, ibmvnic_stats[i].name,ETH_GSTRING_LEN ); +if (stringset !=ETH_SS_STATS ) +return ; -for (i =0 ; i < adapter->req_tx_queues; i++) { -snprintf (data,ETH_GSTRING_LEN ,"tx%d_packets" , i); - data +=ETH_GSTRING_LEN ; +for (i =0 ; i <ARRAY_SIZE (ibmvnic_stats); i++, data +=ETH_GSTRING_LEN ) +memcpy (data, ibmvnic_stats[i].name,ETH_GSTRING_LEN ); -snprintf (data,ETH_GSTRING_LEN ,"tx%d_bytes" , i); - data +=ETH_GSTRING_LEN ; +for (i =0 ; i < adapter->req_tx_queues; i++) { +snprintf (data,ETH_GSTRING_LEN ,"tx%d_packets" , i); + data +=ETH_GSTRING_LEN ; -snprintf (data,ETH_GSTRING_LEN , -"tx%d_dropped_packets" , i); - data +=ETH_GSTRING_LEN ; - } +snprintf (data,ETH_GSTRING_LEN ,"tx%d_bytes" , i); + data +=ETH_GSTRING_LEN ; -for (i =0 ; i < adapter->req_rx_queues; i++) { -snprintf (data,ETH_GSTRING_LEN ,"rx%d_packets" , i); - data +=ETH_GSTRING_LEN ; +snprintf (data,ETH_GSTRING_LEN ,"tx%d_dropped_packets" , i); + data +=ETH_GSTRING_LEN ; + } -snprintf (data,ETH_GSTRING_LEN ,"rx%d_bytes" , i); - data +=ETH_GSTRING_LEN ; +for (i =0 ; i < adapter->req_rx_queues; i++) { +snprintf (data,ETH_GSTRING_LEN ,"rx%d_packets" , i); + data +=ETH_GSTRING_LEN ; -snprintf (data,ETH_GSTRING_LEN ,"rx%d_interrupts" , i); - data +=ETH_GSTRING_LEN ; - } -break ; +snprintf (data,ETH_GSTRING_LEN ,"rx%d_bytes" , i); + data +=ETH_GSTRING_LEN ; -case ETH_SS_PRIV_FLAGS : -for (i =0 ; i <ARRAY_SIZE (ibmvnic_priv_flags); i++) -strcpy (data + i *ETH_GSTRING_LEN , - ibmvnic_priv_flags[i]); -break ; -default : -return ; +snprintf (data,ETH_GSTRING_LEN ,"rx%d_interrupts" , i); + data +=ETH_GSTRING_LEN ; } }
@@ -2801,8 +2766,6 @@ static int ibmvnic_get_sset_count(struct net_device *dev, int sset)return ARRAY_SIZE (ibmvnic_stats) + adapter->req_tx_queues *NUM_TX_STATS + adapter->req_rx_queues *NUM_RX_STATS ; -case ETH_SS_PRIV_FLAGS : -return ARRAY_SIZE (ibmvnic_priv_flags);default :return -EOPNOTSUPP ; }
@@ -2855,26 +2818,6 @@ static void ibmvnic_get_ethtool_stats(struct net_device *dev, } } -static u32 ibmvnic_get_priv_flags (struct net_device *netdev) -{ -struct ibmvnic_adapter *adapter =netdev_priv (netdev); - -return adapter->priv_flags; -} - -static int ibmvnic_set_priv_flags (struct net_device *netdev,u32 flags) -{ -struct ibmvnic_adapter *adapter =netdev_priv (netdev); -bool which_maxes = !!(flags &IBMVNIC_USE_SERVER_MAXES ); - -if (which_maxes) - adapter->priv_flags |=IBMVNIC_USE_SERVER_MAXES ; -else - adapter->priv_flags &= ~IBMVNIC_USE_SERVER_MAXES ; - -return 0 ; -} -static const struct ethtool_ops ibmvnic_ethtool_ops = { .get_drvinfo = ibmvnic_get_drvinfo, .get_msglevel = ibmvnic_get_msglevel,
@@ -2888,8 +2831,6 @@ static const struct ethtool_ops ibmvnic_ethtool_ops = { .get_sset_count = ibmvnic_get_sset_count, .get_ethtool_stats = ibmvnic_get_ethtool_stats, .get_link_ksettings = ibmvnic_get_link_ksettings, - .get_priv_flags = ibmvnic_get_priv_flags, - .set_priv_flags = ibmvnic_set_priv_flags, };/* Routines for managing CRQs/sCRQs */
drivers/net/ethernet/ibm/ibmvnic.h +0 -6
@@ -41,11 +41,6 @@#define IBMVNIC_RESET_DELAY 100 -static const char ibmvnic_priv_flags[][ETH_GSTRING_LEN ] = { -#define IBMVNIC_USE_SERVER_MAXES 0x1 -"use-server-maxes" -}; -struct ibmvnic_login_buffer {__be32 len;__be32 version;
@@ -974,7 +969,6 @@ struct ibmvnic_adapter {struct ibmvnic_control_ip_offload_buffer ip_offload_ctrl;dma_addr_t ip_offload_ctrl_tok;u32 msg_enable; -u32 priv_flags;/* Vital Product Data (VPD) */ struct ibmvnic_vpd *vpd;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 98/129 tcp: fix F-RTO may not work correctly when receiving DSACK
In reply to Greg Kroah-HartmanFrom: Pengcheng Yang <[email protected]>
[ Upstream commit d9157f6806d1499e173770df1f1b234763de5c79 ]
Currently DSACK is regarded as a dupack, which may cause F-RTO to incorrectly enter "loss was real" when receiving DSACK.
Packetdrill to demonstrate:
// Enable F-RTO and TLP
0 `sysctl -q net.ipv4.tcp_frto=2`
0 `sysctl -q net.ipv4.tcp_early_retrans=3`
0 `sysctl -q net.ipv4.tcp_congestion_control=cubic`// Establish a connection
+0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 +0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0
// RTT 10ms, RTO 210ms
+.1 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
+0 > S. 0:0(0) ack 1 <...>
+.01 < . 1:1(0) ack 1 win 257
+0 accept(3, ..., ...) = 4
// Send 2 data segments
+0 write(4, ..., 2000) = 2000
+0 > P. 1:2001(2000) ack 1
// TLP
+.022 > P. 1001:2001(1000) ack 1
// Continue to send 8 data segments
+0 write(4, ..., 10000) = 10000
+0 > P. 2001:10001(8000) ack 1
// RTO
+.188 > . 1:1001(1000) ack 1
// The original data is acked and new data is sent(F-RTO step 2.b)
+0 < . 1:1(0) ack 2001 win 257
+0 > P. 10001:12001(2000) ack 1
// D-SACK caused by TLP is regarded as a dupack, this results in // the incorrect judgment of "loss was real"(F-RTO step 3.a) +.022 < . 1:1(0) ack 2001 win 257 <sack 1001:2001,nop,nop>
// Never-retransmitted data(3001:4001) are acked and // expect to switch to open state(F-RTO step 3.b)
+0 < . 1:1(0) ack 4001 win 257
+0 %{ assert tcpi_ca_state == 0, tcpi_ca_state }%
--- net/ipv4/tcp_input.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/tcp_input.c +2 -1
@@ -3814,7 +3814,8 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)tcp_process_tlp_ack (sk, ack, flag);if (tcp_ack_is_dubious (sk, flag)) { -if (!(flag & (FLAG_SND_UNA_ADVANCED |FLAG_NOT_DUP ))) { +if (!(flag & (FLAG_SND_UNA_ADVANCED | +FLAG_NOT_DUP |FLAG_DSACKING_ACK ))) { num_dupack =1 ;/* Consider if pure acks were aggregated in tcp_add_backlog() */ if (!(flag &FLAG_DATA ))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 99/129 ASoC: Intel: soc-acpi: correct device endpoints for max98373
In reply to Greg Kroah-HartmanFrom: Chao Song <[email protected]>
[ Upstream commit 97326be14df7bacc6ba5c62c0556298c27ea0432 ]
The left speaker of max98373 uses spk_r_endpoint, and right speaker uses spk_l_endpoint, this is obviously wrong.
This patch corrects the endpoints for max98373 codec.
--- sound/soc/intel/common/soc-acpi-intel-tgl-match.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/intel/common/soc-acpi-intel-tgl-match.c +2 -2
@@ -126,13 +126,13 @@ static const struct snd_soc_acpi_adr_device mx8373_1_adr[] = { { .adr = 0x000123019F837300, .num_endpoints = 1, - .endpoints = &spk_l_endpoint, + .endpoints = &spk_r_endpoint, .name_prefix = "Right" }, { .adr = 0x000127019F837300, .num_endpoints = 1, - .endpoints = &spk_r_endpoint, + .endpoints = &spk_l_endpoint, .name_prefix = "Left" } };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 100/129 ASoC: wm8731: Disable the regulator when probing fails
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 92ccbf17eeacf510cf1eed9c252d9332ca24f02d ]
When the driver fails during probing, the driver should disable the regulator, not just handle it in wm8731_hw_init().
The following log reveals it:
[ 17.812483] WARNING: CPU: 1 PID: 364 at drivers/regulator/core.c:2257 _regulator_put+0x3ec/0x4e0 [ 17.815958] RIP: 0010:_regulator_put+0x3ec/0x4e0 [ 17.824467] Call Trace: [ 17.824774] <TASK> [ 17.825040] regulator_bulk_free+0x82/0xe0 [ 17.825514] devres_release_group+0x319/0x3d0 [ 17.825882] i2c_device_probe+0x766/0x940 [ 17.829198] i2c_register_driver+0xb5/0x130
--- sound/soc/codecs/wm8731.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
sound/soc/codecs/wm8731.c +11 -8
@@ -602,7 +602,7 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731) ret =wm8731_reset (wm8731->regmap);if (ret <0 ) {dev_err (dev,"Failed to issue reset: %d\n" , ret); - goto err_regulator_enable; + goto err; }/* Clear POWEROFF, keep everything else disabled */
@@ -619,10 +619,7 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731)regcache_mark_dirty (wm8731->regmap); -err_regulator_enable: -/* Regulators will be enabled by bias management */ -regulator_bulk_disable (ARRAY_SIZE (wm8731->supplies), wm8731->supplies); - +err:return ret; }
@@ -766,21 +763,27 @@ static int wm8731_i2c_probe(struct i2c_client *i2c, ret =PTR_ERR (wm8731->regmap);dev_err (&i2c->dev,"Failed to allocate register map: %d\n" , ret); -return ret; + goto err_regulator_enable; } ret =wm8731_hw_init (&i2c->dev, wm8731);if (ret !=0 ) -return ret; + goto err_regulator_enable; ret =devm_snd_soc_register_component (&i2c->dev, &soc_component_dev_wm8731, &wm8731_dai,1 );if (ret !=0 ) {dev_err (&i2c->dev,"Failed to register CODEC: %d\n" , ret); -return ret; + goto err_regulator_enable; }return 0 ; + +err_regulator_enable: +/* Regulators will be enabled by bias management */ +regulator_bulk_disable (ARRAY_SIZE (wm8731->supplies), wm8731->supplies); + +return ret; }static int wm8731_i2c_remove (struct i2c_client *client)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 101/129 ext4: fix bug_on in start_this_handle during umount filesystem
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
[ Upstream commit b98535d091795a79336f520b0708457aacf55c67 ]
We got issue as follows:
------------[ cut here ]------------ kernel BUG at fs/jbd2/transaction.c:389! invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI CPU: 9 PID: 131 Comm: kworker/9:1 Not tainted 5.17.0-862.14.0.6.x86_64-00001-g23f87daf7d74-dirty #197 Workqueue: events flush_stashed_error_work RIP: 0010:start_this_handle+0x41c/0x1160 RSP: 0018:ffff888106b47c20 EFLAGS: 00010202 RAX: ffffed10251b8400 RBX: ffff888128dc204c RCX: ffffffffb52972ac RDX: 0000000000000200 RSI: 0000000000000004 RDI: ffff888128dc2050 RBP: 0000000000000039 R08: 0000000000000001 R09: ffffed10251b840a R10: ffff888128dc204f R11: ffffed10251b8409 R12: ffff888116d78000 R13: 0000000000000000 R14: dffffc0000000000 R15: ffff888128dc2000 FS: 0000000000000000(0000) GS:ffff88839d680000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000001620068 CR3: 0000000376c0e000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> jbd2__journal_start+0x38a/0x790 jbd2_journal_start+0x19/0x20 flush_stashed_error_work+0x110/0x2b3 process_one_work+0x688/0x1080 worker_thread+0x8b/0xc50 kthread+0x26f/0x310 ret_from_fork+0x22/0x30 </TASK> Modules linked in: ---[ end trace 0000000000000000 ]---
Above issue may happen as follows:
umount read procfs error_workext4_put_super
flush_work(&sbi->s_error_work);
ext4_mb_seq_groups_show ext4_mb_load_buddy_gfp ext4_mb_init_group ext4_mb_init_cache ext4_read_block_bitmap_nowait ext4_validate_block_bitmap ext4_error ext4_handle_error schedule_work(&EXT4_SB(sb)->s_error_work);
ext4_unregister_sysfs(sb);
jbd2_journal_destroy(sbi->s_journal);
journal_kill_thread
journal->j_flags |= JBD2_UNMOUNT;flush_stashed_error_work jbd2_journal_start start_this_handle BUG_ON(journal->j_flags & JBD2_UNMOUNT);
To solve this issue, we call 'ext4_unregister_sysfs() before flushing s_error_work in ext4_put_super().
--- fs/ext4/super.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
fs/ext4/super.c +10 -5
@@ -1176,18 +1176,23 @@ static void ext4_put_super(struct super_block *sb)int aborted =0 ;int i, err; -ext4_unregister_li_request (sb); -ext4_quota_off_umount (sb); - -destroy_workqueue (sbi->rsv_conversion_wq); -/* * Unregister sysfs before destroying jbd2 journal. * Since we could still access attr_journal_task attribute via sysfs * path which could have sbi->s_journal->j_task as NULL +* Unregister sysfs before flush sbi->s_error_work. +* Since user may read /proc/fs/ext4/xx/mb_groups during umount, If +* read metadata verify failed then will queue error work. +* flush_stashed_error_work will call start_this_handle may trigger +* BUG_ON. */ ext4_unregister_sysfs (sb); +ext4_unregister_li_request (sb); +ext4_quota_off_umount (sb); + +destroy_workqueue (sbi->rsv_conversion_wq); +if (sbi->s_journal) { aborted =is_journal_aborted (sbi->s_journal); err =jbd2_journal_destroy (sbi->s_journal);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 102/129 x86: __memcpy_flushcache: fix wrong alignment if size > 2^32
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
[ Upstream commit a6823e4e360fe975bd3da4ab156df7c74c8b07f3 ]
The first "if" condition in __memcpy_flushcache is supposed to align the "dest" variable to 8 bytes and copy data up to this alignment. However, this condition may misbehave if "size" is greater than 4GiB.
The statement min_t(unsigned, size, ALIGN(dest, 8) - dest); casts both arguments to unsigned int and selects the smaller one. However, the cast truncates high bits in "size" and it results in misbehavior.
For example:
suppose that size == 0x100000001, dest == 0x200000002 min_t(unsigned, size, ALIGN(dest, 8) - dest) == min_t(0x1, 0xe) == 0x1; ... dest += 0x1;
so we copy just one byte "and" dest remains unaligned.
This patch fixes the bug by replacing unsigned with size_t.
--- arch/x86/lib/usercopy_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/lib/usercopy_64.c +1 -1
@@ -121,7 +121,7 @@ void __memcpy_flushcache(void *_dst, const void *_src, size_t size)/* cache copy and flush to align dest */ if (!IS_ALIGNED (dest,8 )) { -unsigned len =min_t (unsigned, size,ALIGN (dest,8 ) - dest); +size_t len =min_t (size_t, size,ALIGN (dest,8 ) - dest);memcpy ((void *) dest, (void *) source, len);clean_cache_range ((void *) dest, len);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 103/129 cifs: destage any unwritten data to the server before calling copychunk_write
In reply to Greg Kroah-HartmanFrom: Ronnie Sahlberg <[email protected]>
[ Upstream commit f5d0f921ea362636e4a2efb7c38d1ead373a8700 ]
because the copychunk_write might cover a region of the file that has not yet been sent to the server and thus fail.
A simple way to reproduce this is:
truncate -s 0 /mnt/testfile; strace -f -o x -ttT xfs_io -i -f -c 'pwrite 0k 128k' -c 'fcollapse 16k 24k' /mnt/testfile
the issue is that the 'pwrite 0k 128k' becomes rearranged on the wire with the 'fcollapse 16k 24k' due to write-back caching.
fcollapse is implemented in cifs.ko as a SMB2 IOCTL(COPYCHUNK_WRITE) call and it will fail serverside since the file is still 0b in size serverside until the writes have been destaged.
To avoid this we must ensure that we destage any unwritten data to the server before calling COPYCHUNK_WRITE.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1997373
--- fs/cifs/smb2ops.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/cifs/smb2ops.c +8 -0
@@ -1744,9 +1744,17 @@ smb2_copychunk_range(const unsigned int xid,int chunks_copied =0 ;bool chunk_sizes_updated = false;ssize_t bytes_written, total_bytes_written =0 ; +struct inode *inode; pcchunk =kmalloc (sizeof (struct copychunk_ioctl ),GFP_KERNEL ); +/* +* We need to flush all unwritten data before we can send the +* copychunk ioctl to the server. +*/ + inode =d_inode (trgtfile->dentry); +filemap_write_and_wait (inode->i_mapping); +if (pcchunk ==NULL )return -ENOMEM ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 104/129 drivers: net: hippi: Fix deadlock in rr_close()
In reply to Greg Kroah-HartmanFrom: Duoming Zhou <[email protected]>
[ Upstream commit bc6de2878429e85c1f1afaa566f7b5abb2243eef ]
There is a deadlock in rr_close(), which is shown below:
(Thread 1) | (Thread 2)
| rr_open()
rr_close() | add_timer()
spin_lock_irqsave() //(1) | (wait a time)
... | rr_timer()
del_timer_sync() | spin_lock_irqsave() //(2)
(wait timer to stop) | ...We hold rrpriv->lock in position (1) of thread 1 and use del_timer_sync() to wait timer to stop, but timer handler also need rrpriv->lock in position (2) of thread 2. As a result, rr_close() will block forever.
This patch extracts del_timer_sync() from the protection of spin_lock_irqsave(), which could let timer handler to obtain the needed lock.
--- drivers/net/hippi/rrunner.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/hippi/rrunner.c +2 -0
@@ -1353,7 +1353,9 @@ static int rr_close(struct net_device *dev) rrpriv->fw_running =0 ; +spin_unlock_irqrestore (&rrpriv->lock, flags);del_timer_sync (&rrpriv->timer); +spin_lock_irqsave (&rrpriv->lock, flags);writel (0 , ®s->TxPi);writel (0 , ®s->IpRxPi);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 105/129 powerpc/perf: Fix 32bit compile
In reply to Greg Kroah-HartmanFrom: Alexey Kardashevskiy <[email protected]>
[ Upstream commit bb82c574691daf8f7fa9a160264d15c5804cb769 ]
The "read_bhrb" global symbol is only called under CONFIG_PPC64 of arch/powerpc/perf/core-book3s.c but it is compiled for both 32 and 64 bit anyway (and LLVM fails to link this on 32bit).
This fixes it by moving bhrb.o to obj64 targets.
--- arch/powerpc/perf/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/perf/Makefile +2 -2
@@ -5,11 +5,11 @@ ifdef CONFIG_COMPAT obj-$(CONFIG_PERF_EVENTS) += callchain_32.o endif -obj-$(CONFIG_PPC_PERF_CTRS) += core-book3s.o bhrb.o +obj-$(CONFIG_PPC_PERF_CTRS) += core-book3s.o obj64-$(CONFIG_PPC_PERF_CTRS) += ppc970-pmu.o power5-pmu.o \ power5+-pmu.o power6-pmu.o power7-pmu.o \ isa207-common.o power8-pmu.o power9-pmu.o \ - generic-compat-pmu.o power10-pmu.o + generic-compat-pmu.o power10-pmu.o bhrb.o obj32-$(CONFIG_PPC_PERF_CTRS) += mpc7450-pmu.o obj-$(CONFIG_PPC_POWERNV) += imc-pmu.o
Greg Kroah-Hartman
maintainerPATCH 106/129 zonefs: Fix management of open zones
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
commit 1da18a296f5ba4f99429e62a7cf4fdbefa598902 upstream.
The mount option "explicit_open" manages the device open zone resources to ensure that if an application opens a sequential file for writing, the file zone can always be written by explicitly opening the zone and accounting for that state with the s_open_zones counter.
However, if some zones are already open when mounting, the device open zone resource usage status will be larger than the initial s_open_zones value of 0. Ensure that this inconsistency does not happen by closing any sequential zone that is open when mounting.
Furthermore, with ZNS drives, closing an explicitly open zone that has not been written will change the zone state to "closed", that is, the zone will remain in an active state. Since this can then cause failures of explicit open operations on other zones if the drive active zone resources are exceeded, we need to make sure that the zone is not active anymore by resetting it instead of closing it. To address this, zonefs_zone_mgmt() is modified to change a REQ_OP_ZONE_CLOSE request into a REQ_OP_ZONE_RESET for sequential zones that have not been written.
--- fs/zonefs/super.c | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-)
fs/zonefs/super.c +40 -5
@@ -32,6 +32,17 @@ static inline int zonefs_zone_mgmt(struclockdep_assert_held (&zi->i_truncate_mutex); +/* +* With ZNS drives, closing an explicitly open zone that has not been +* written will change the zone state to "closed", that is, the zone +* will remain active. Since this can then cause failure of explicit +* open operation on other zones if the drive active zone resources +* are exceeded, make sure that the zone does not remain active by +* resetting it. +*/ +if (op ==REQ_OP_ZONE_CLOSE && !zi->i_wpoffset) + op =REQ_OP_ZONE_RESET ; + ret =blkdev_zone_mgmt (inode->i_sb->s_bdev, op, zi->i_zsector, zi->i_zone_size >>SECTOR_SHIFT ,GFP_NOFS );if (ret) {
@@ -1306,12 +1317,13 @@ static void zonefs_init_dir_inode(structinc_nlink (parent); } -static void zonefs_init_file_inode (struct inode *inode,struct blk_zone *zone, -enum zonefs_ztype type) +static int zonefs_init_file_inode (struct inode *inode,struct blk_zone *zone, +enum zonefs_ztype type) {struct super_block *sb = inode->i_sb;struct zonefs_sb_info *sbi =ZONEFS_SB (sb);struct zonefs_inode_info *zi =ZONEFS_I (inode); +int ret =0 ; inode->i_ino = zone->start >> sbi->s_zone_sectors_shift; inode->i_mode =S_IFREG | sbi->s_perm;
@@ -1336,6 +1348,22 @@ static void zonefs_init_file_inode(struc sb->s_maxbytes =max (zi->i_max_size, sb->s_maxbytes); sbi->s_blocks += zi->i_max_size >> sb->s_blocksize_bits; sbi->s_used_blocks += zi->i_wpoffset >> sb->s_blocksize_bits; + +/* +* For sequential zones, make sure that any open zone is closed first +* to ensure that the initial number of open zones is 0, in sync with +* the open zone accounting done when the mount option +* ZONEFS_MNTOPT_EXPLICIT_OPEN is used. +*/ +if (type ==ZONEFS_ZTYPE_SEQ && + (zone->cond ==BLK_ZONE_COND_IMP_OPEN || + zone->cond ==BLK_ZONE_COND_EXP_OPEN )) { +mutex_lock (&zi->i_truncate_mutex); + ret =zonefs_zone_mgmt (inode,REQ_OP_ZONE_CLOSE ); +mutex_unlock (&zi->i_truncate_mutex); + } + +return ret; } static struct dentry *zonefs_create_inode(struct dentry *parent,
@@ -1345,6 +1373,7 @@ static struct dentry *zonefs_create_inodstruct inode *dir =d_inode (parent);struct dentry *dentry;struct inode *inode; +int ret; dentry =d_alloc_name (parent, name);if (!dentry)
@@ -1355,10 +1384,16 @@ static struct dentry *zonefs_create_inod goto dput; inode->i_ctime = inode->i_mtime = inode->i_atime = dir->i_ctime; -if (zone) -zonefs_init_file_inode (inode, zone, type); -else +if (zone) { + ret =zonefs_init_file_inode (inode, zone, type); +if (ret) { +iput (inode); + goto dput; + } + }else {zonefs_init_dir_inode (dir, inode, type); + } +d_add (dentry, inode); dir->i_size++;
Greg Kroah-Hartman
maintainerPATCH 107/129 zonefs: Clear inode information flags on inode creation
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
commit 694852ead287a3433126e7ebda397b242dc99624 upstream.
Ensure that the i_flags field of struct zonefs_inode_info is cleared to 0 when initializing a zone file inode, avoiding seeing the flag ZONEFS_ZONE_OPEN being incorrectly set.
--- fs/zonefs/super.c | 1 + 1 file changed, 1 insertion(+)
fs/zonefs/super.c +1 -0
@@ -1163,6 +1163,7 @@ static struct inode *zonefs_alloc_inode(mutex_init (&zi->i_truncate_mutex);init_rwsem (&zi->i_mmap_sem); zi->i_wr_refcnt =0 ; + zi->i_flags =0 ;return &zi->i_vnode; }
Greg Kroah-Hartman
maintainerPATCH 108/129 kasan: prevent cpu_quarantine corruption when CPU offline and cache shrink occur at same time
In reply to Greg Kroah-HartmanFrom: Zqiang <[email protected]>
commit 31fa985b4196f8a66f027672e9bf2b81fea0417c upstream.
kasan_quarantine_remove_cache() is called in kmem_cache_shrink()/ destroy(). The kasan_quarantine_remove_cache() call is protected by cpuslock in kmem_cache_destroy() to ensure serialization with kasan_cpu_offline().
However the kasan_quarantine_remove_cache() call is not protected by cpuslock in kmem_cache_shrink(). When a CPU is going offline and cache shrink occurs at same time, the cpu_quarantine may be corrupted by interrupt (per_cpu_remove_cache operation).
So add a cpu_quarantine offline flags check in per_cpu_remove_cache().
[[email protected]: add comment, per Zqiang]
--- mm/kasan/quarantine.c | 7 +++++++ 1 file changed, 7 insertions(+)
mm/kasan/quarantine.c +7 -0
@@ -299,6 +299,13 @@ static void per_cpu_remove_cache(void *astruct qlist_head *q; q =this_cpu_ptr (&cpu_quarantine); +/* +* Ensure the ordering between the writing to q->offline and +* per_cpu_remove_cache. Prevent cpu_quarantine from being corrupted +* by interrupt. +*/ +if (READ_ONCE (q->offline)) +return ;qlist_move_cache (q, &to_free, cache);qlist_free_all (&to_free, cache); }
Greg Kroah-Hartman
maintainerPATCH 109/129 drm/i915: Fix SEL_FETCH_PLANE_*(PIPE_B+) register addresses
In reply to Greg Kroah-HartmanFrom: Imre Deak <[email protected]>
commit 4ae4dd2e26fdfebf0b8c6af6c325383eadfefdb4 upstream.
Fix typo in the _SEL_FETCH_PLANE_BASE_1_B register base address.
--- drivers/gpu/drm/i915/i915_reg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +1 -1
@@ -7202,7 +7202,7 @@ enum {#define _SEL_FETCH_PLANE_BASE_6_A 0x70940#define _SEL_FETCH_PLANE_BASE_7_A 0x70960#define _SEL_FETCH_PLANE_BASE_CUR_A 0x70880 -#define _SEL_FETCH_PLANE_BASE_1_B 0x70990 +#define _SEL_FETCH_PLANE_BASE_1_B 0x71890#define _SEL_FETCH_PLANE_BASE_A (plane) _PICK(plane, \ _SEL_FETCH_PLANE_BASE_1_A, \
Greg Kroah-Hartman
maintainerPATCH 110/129 net: ethernet: stmmac: fix write to sgmii_adapter_base
In reply to Greg Kroah-HartmanFrom: Dinh Nguyen <[email protected]>
commit 5fd1fe4807f91ea0cca043114d929faa11bd4190 upstream.
I made a mistake with the commit a6aaa0032424 ("net: ethernet: stmmac:
fix altr_tse_pcs function when using a fixed-link"). I should have tested against both scenario of having a SGMII interface and one without.
Without the SGMII PCS TSE adpater, the sgmii_adapter_base address is NULL, thus a write to this address will fail.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +7 -5
@@ -65,8 +65,9 @@ static void socfpga_dwmac_fix_mac_speed(struct phy_device *phy_dev = ndev->phydev;u32 val; -writew (SGMII_ADAPTER_DISABLE , - sgmii_adapter_base +SGMII_ADAPTER_CTRL_REG ); +if (sgmii_adapter_base) +writew (SGMII_ADAPTER_DISABLE , + sgmii_adapter_base +SGMII_ADAPTER_CTRL_REG );if (splitter_base) { val =readl (splitter_base +EMAC_SPLITTER_CTRL_REG );
@@ -88,10 +89,11 @@ static void socfpga_dwmac_fix_mac_speed(writel (val, splitter_base +EMAC_SPLITTER_CTRL_REG ); } -writew (SGMII_ADAPTER_ENABLE , - sgmii_adapter_base +SGMII_ADAPTER_CTRL_REG ); -if (phy_dev) +if (phy_dev && sgmii_adapter_base) { +writew (SGMII_ADAPTER_ENABLE , + sgmii_adapter_base +SGMII_ADAPTER_CTRL_REG );tse_pcs_fix_mac_speed (&dwmac->pcs, phy_dev, speed); + } }static int socfpga_dwmac_parse_data (struct socfpga_dwmac *dwmac,struct device *dev)
Greg Kroah-Hartman
maintainerPATCH 111/129 thermal: int340x: Fix attr.show callback prototype
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
commit d0f6cfb2bd165b0aa307750e07e03420859bd554 upstream.
Control Flow Integrity (CFI) instrumentation of the kernel noticed that the caller, dev_attr_show(), and the callback, odvp_show(), did not have matching function prototypes, which would cause a CFI exception to be raised. Correct the prototype by using struct device_attribute instead of struct kobj_attribute.
--- drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/intel/int340x_thermal/int3400_thermal.c +2 -2
@@ -67,7 +67,7 @@ static int evaluate_odvp(struct int3400_struct odvp_attr {int odvp;struct int3400_thermal_priv *priv; -struct kobj_attribute attr; +struct device_attribute attr; }; static ssize_t data_vault_read(struct file *file, struct kobject *kobj,
@@ -269,7 +269,7 @@ static int int3400_thermal_run_osc(acpi_return result; } -static ssize_t odvp_show (struct kobject *kobj,struct kobj_attribute *attr, +static ssize_t odvp_show (struct device *dev,struct device_attribute *attr,char *buf) {struct odvp_attr *odvp_attr;
Greg Kroah-Hartman
maintainerPATCH 112/129 x86/cpu: Load microcode during restore_processor_state()
In reply to Greg Kroah-HartmanFrom: Borislav Petkov <[email protected]>
commit f9e14dbbd454581061c736bf70bf5cbb15ac927c upstream.
When resuming from system sleep state, restore_processor_state() restores the boot CPU MSRs. These MSRs could be emulated by microcode. If microcode is not loaded yet, writing to emulated MSRs leads to unchecked MSR access error:
...
PM: Calling lapic_suspend+0x0/0x210
unchecked MSR access error: WRMSR to 0x10f (tried to write 0x0...0) at rIP: ... (native_write_msr)
Call Trace:
<TASK>
? restore_processor_state
x86_acpi_suspend_lowlevel
acpi_suspend_enter
suspend_devices_and_enter
pm_suspend.cold
state_store
kobj_attr_store
sysfs_kf_write
kernfs_fop_write_iter
new_sync_write
vfs_write
ksys_write
__x64_sys_write
do_syscall_64
entry_SYSCALL_64_after_hwframe
RIP: 0033:0x7fda13c260a7To ensure microcode emulated MSRs are available for restoration, load the microcode on the boot CPU before restoring these MSRs.
[ Pawan: write commit message and productize it. ]
--- arch/x86/include/asm/microcode.h | 2 ++ arch/x86/kernel/cpu/microcode/core.c | 6 +++--- arch/x86/power/cpu.c | 10 +++++++++- 3 files changed, 14 insertions(+), 4 deletions(-)
arch/x86/include/asm/microcode.h +2 -0
@@ -133,11 +133,13 @@ extern void load_ucode_ap(void);void reload_early_microcode (void );extern bool get_builtin_firmware (struct cpio_data *cd,const char *name);extern bool initrd_gone; +void microcode_bsp_resume (void );#else static inline int __init microcode_init (void ) {return 0 ; };static inline void __init load_ucode_bsp (void ) { }static inline void load_ucode_ap (void ) { }static inline void reload_early_microcode (void ) { } +static inline void microcode_bsp_resume (void ) { }static inline bool get_builtin_firmware (struct cpio_data *cd,const char *name) {return false; }#endif
arch/x86/kernel/cpu/microcode/core.c +3 -3
@@ -775,9 +775,9 @@ static struct subsys_interface mc_cpu_in };/** -* mc_bp_resume - Update boot CPU microcode during resume. +* microcode_bsp_resume - Update boot CPU microcode during resume. */ -static void mc_bp_resume (void ) +void microcode_bsp_resume (void ) {int cpu =smp_processor_id ();struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
@@ -789,7 +789,7 @@ static void mc_bp_resume(void) }static struct syscore_ops mc_syscore_ops = { - .resume = mc_bp_resume, + .resume = microcode_bsp_resume, };static int mc_cpu_starting (unsigned int cpu)
arch/x86/power/cpu.c +9 -1
@@ -25,6 +25,7 @@#include <asm/cpu.h> #include <asm/mmu_context.h> #include <asm/cpu_device_id.h> +#include <asm/microcode.h> #ifdef CONFIG_X86_32 __visible unsigned long saved_context_ebx;
@@ -265,11 +266,18 @@ static void notrace __restore_processor_ x86_platform.restore_sched_clock_state ();mtrr_bp_restore ();perf_restore_debug_store (); -msr_restore_context (ctxt); c = &cpu_data (smp_processor_id ());if (cpu_has (c,X86_FEATURE_MSR_IA32_FEAT_CTL ))init_ia32_feat_ctl (c); + +microcode_bsp_resume (); + +/* +* This needs to happen after the microcode has been updated upon resume +* because some of the MSRs are "emulated" in microcode. +*/ +msr_restore_context (ctxt); }/* Needed by apm.c */
Greg Kroah-Hartman
maintainerPATCH 113/129 perf symbol: Pass is_kallsyms to symbols__fixup_end()
In reply to Greg Kroah-HartmanFrom: Namhyung Kim <[email protected]>
commit 838425f2defe5262906b698752d28fd2fca1aac2 upstream.
The symbol fixup is necessary for symbols in kallsyms since they don't have size info. So we use the next symbol's address to calculate the size. Now it's also used for user binaries because sometimes they miss size for hand-written asm functions.
There's a arch-specific function to handle kallsyms differently but currently it cannot distinguish kallsyms from others. Pass this information explicitly to handle it properly. Note that those arch functions will be moved to the generic function so I didn't added it to the arch-functions.
--- tools/perf/util/symbol-elf.c | 2 +- tools/perf/util/symbol.c | 7 ++++--- tools/perf/util/symbol.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-)
tools/perf/util/symbol-elf.c +1 -1
@@ -1245,7 +1245,7 @@ int dso__load_sym(struct dso *dso, struc* For misannotated, zeroed, ASM function sizes. */ if (nr >0 ) { -symbols__fixup_end (&dso->symbols); +symbols__fixup_end (&dso->symbols, false);symbols__fixup_duplicate (&dso->symbols);if (kmap) {/*
tools/perf/util/symbol.c +4 -3
@@ -217,7 +217,8 @@ again: } } -void symbols__fixup_end (struct rb_root_cached *symbols) +void symbols__fixup_end (struct rb_root_cached *symbols, +bool is_kallsyms__maybe_unused ) {struct rb_node *nd, *prevnd =rb_first_cached (symbols);struct symbol *curr, *prev;
@@ -1456,7 +1457,7 @@ int __dso__load_kallsyms(struct dso *dsoif (kallsyms__delta (kmap, filename, &delta))return -1 ; -symbols__fixup_end (&dso->symbols); +symbols__fixup_end (&dso->symbols, true);symbols__fixup_duplicate (&dso->symbols);if (dso->kernel ==DSO_SPACE__KERNEL_GUEST )
@@ -1651,7 +1652,7 @@ int dso__load_bfd_symbols(struct dso *ds#undef bfd_asymbol_section#endif -symbols__fixup_end (&dso->symbols); +symbols__fixup_end (&dso->symbols, false);symbols__fixup_duplicate (&dso->symbols); dso->adjust_symbols =1 ;
tools/perf/util/symbol.h +1 -1
@@ -192,7 +192,7 @@ void __symbols__insert(struct rb_root_ca bool kernel);void symbols__insert (struct rb_root_cached *symbols,struct symbol *sym);void symbols__fixup_duplicate (struct rb_root_cached *symbols); -void symbols__fixup_end (struct rb_root_cached *symbols); +void symbols__fixup_end (struct rb_root_cached *symbols,bool is_kallsyms);void maps__fixup_end (struct maps *maps);typedef int (*mapfn_t )(u64 start,u64 len,u64 pgoff,void *data);
Greg Kroah-Hartman
maintainerPATCH 114/129 perf symbol: Update symbols__fixup_end()
In reply to Greg Kroah-HartmanFrom: Namhyung Kim <[email protected]>
commit 8799ebce84d672aae1dc3170510f6a3e66f96b11 upstream.
Now arch-specific functions all do the same thing. When it fixes the symbol address it needs to check the boundary between the kernel image and modules. For the last symbol in the previous region, it cannot know the exact size as it's discarded already. Thus it just uses a small page size (4096) and rounds it up like the last symbol.
--- tools/perf/util/symbol.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-)
tools/perf/util/symbol.c +25 -4
@@ -217,8 +217,8 @@ again: } } -void symbols__fixup_end (struct rb_root_cached *symbols, -bool is_kallsyms__maybe_unused ) +/* Update zero-sized symbols using the address of the next symbol */ +void symbols__fixup_end (struct rb_root_cached *symbols,bool is_kallsyms) {struct rb_node *nd, *prevnd =rb_first_cached (symbols);struct symbol *curr, *prev;
@@ -232,8 +232,29 @@ void symbols__fixup_end(struct rb_root_c prev = curr; curr = rb_entry(nd, struct symbol, rb_node); -if (prev->end == prev->start || prev->end != curr->start) -arch__symbols__fixup_end (prev, curr); +/* +* On some architecture kernel text segment start is located at +* some low memory address, while modules are located at high +* memory addresses (or vice versa). The gap between end of +* kernel text segment and beginning of first module's text +* segment is very big. Therefore do not fill this gap and do +* not assign it to the kernel dso map (kallsyms). +* +* In kallsyms, it determines module symbols using '[' character +* like in: +* ffffffffc1937000 T hdmi_driver_init [snd_hda_codec_hdmi] +*/ +if (prev->end == prev->start) { +/* Last kernel/module symbol mapped to end of page */ +if (is_kallsyms && (!strchr (prev->name,'[' ) != + !strchr (curr->name,'[' ))) + prev->end =roundup (prev->end +4096 ,4096 ); +else + prev->end = curr->start; + +pr_debug4 ("%s sym:%s end:%#" PRIx64"\n" , + __func__, prev->name, prev->end); + } }/* Last entry */
Greg Kroah-Hartman
maintainerPATCH 115/129 tty: n_gsm: fix restart handling via CLD command
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
commit aa371e96f05dcb36a88298f5cb70aa7234d5e8b8 upstream.
n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010.
See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1516
The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to
the newer 27.010 here. Chapter 5.8.2 states that both sides will revert to
the non-multiplexed mode via a close-down message (CLD). The usual program
flow is as following:
- start multiplex mode by sending AT+CMUX to the mobile
- establish the control channel (DLCI 0)
- establish user channels (DLCI >0)
- terminate user channels
- send close-down message (CLD)
- revert to AT protocol (i.e. leave multiplexed mode)
The AT protocol is out of scope of the n_gsm driver. However, gsm_disconnect() sends CLD if gsm_config() detects that the requested parameters require the mux protocol to restart. The next immediate action is to start the mux protocol by opening DLCI 0 again. Any responder side which handles CLD commands correctly forces us to fail at this point because AT+CMUX needs to be sent to the mobile to start the mux again. Therefore, remove the CLD command in this phase and keep both sides in multiplexed mode.
Remove the gsm_disconnect() function as it become unnecessary and merge the remaining parts into gsm_cleanup_mux() to handle the termination order and locking correctly.
--- drivers/tty/n_gsm.c | 68 +++++++++++++++------------------------------------- 1 file changed, 20 insertions(+), 48 deletions(-)
drivers/tty/n_gsm.c +20 -48
@@ -2040,49 +2040,35 @@ static void gsm_error(struct gsm_mux *gs gsm->io_error++; } -static int gsm_disconnect (struct gsm_mux *gsm) -{ -struct gsm_dlci *dlci = gsm->dlci[0 ]; -struct gsm_control *gc; - -if (!dlci) -return 0 ; - -/* In theory disconnecting DLCI 0 is sufficient but for some -modems this is apparently not the case. */ - gc =gsm_control_send (gsm,CMD_CLD ,NULL ,0 ); -if (gc) -gsm_control_wait (gsm, gc); - -del_timer_sync (&gsm->t2_timer); -/* Now we are sure T2 has stopped */ - -gsm_dlci_begin_close (dlci); -wait_event_interruptible (gsm->event, - dlci->state ==DLCI_CLOSED ); - -if (signal_pending (current)) -return -EINTR ; - -return 0 ; -} -/** * gsm_cleanup_mux - generic GSM protocol cleanup * @gsm: our mux +* @disc: disconnect link? * * Clean up the bits of the mux which are the same for all framing * protocols. Remove the mux from the mux table, stop all the timers * and then shut down each device hanging up the channels as we go. */ -static void gsm_cleanup_mux (struct gsm_mux *gsm) +static void gsm_cleanup_mux (struct gsm_mux *gsm,bool disc) {int i;struct gsm_dlci *dlci = gsm->dlci[0 ];struct gsm_msg *txq, *ntxq; gsm->dead = true; +mutex_lock (&gsm->mutex); + +if (dlci) { +if (disc && dlci->state !=DLCI_CLOSED ) { +gsm_dlci_begin_close (dlci); +wait_event (gsm->event, dlci->state ==DLCI_CLOSED ); + } + dlci->dead = true; + } + +/* Finish outstanding timers, making sure they are done */ +del_timer_sync (&gsm->t2_timer);spin_lock (&gsm_mux_lock);for (i =0 ; i <MAX_MUX ; i++) {
@@ -2096,13 +2082,7 @@ static void gsm_cleanup_mux(struct gsm_mif (i ==MAX_MUX )return ; -del_timer_sync (&gsm->t2_timer); -/* Now we are sure T2 has stopped */ -if (dlci) - dlci->dead = true; -/* Free up any link layer users */ -mutex_lock (&gsm->mutex);for (i =0 ; i <NUM_DLCI ; i++)if (gsm->dlci[i])gsm_dlci_release (gsm->dlci[i]);
@@ -2304,19 +2284,11 @@ static int gsm_config(struct gsm_mux *gs/* * Close down what is needed, restart and initiate the new -* configuration +* configuration. On the first time there is no DLCI[0] +* and closing or cleaning up is not necessary. */ - -if (need_close || need_restart) { -int ret; - - ret =gsm_disconnect (gsm); - -if (ret) -return ret; - } -if (need_restart) -gsm_cleanup_mux (gsm); +if (need_close || need_restart) +gsm_cleanup_mux (gsm, true); gsm->initiator = c->initiator; gsm->mru = c->mru;
@@ -2425,7 +2397,7 @@ static void gsmld_detach_gsm(struct tty_WARN_ON (tty != gsm->tty);for (i =1 ; i <NUM_DLCI ; i++)tty_unregister_device (gsm_tty_driver, base + i); -gsm_cleanup_mux (gsm); +gsm_cleanup_mux (gsm, false);tty_kref_put (gsm->tty); gsm->tty =NULL ; }
@@ -2531,7 +2503,7 @@ static int gsmld_open(struct tty_struct ret =gsmld_attach_gsm (tty, gsm);if (ret !=0 ) { -gsm_cleanup_mux (gsm); +gsm_cleanup_mux (gsm, false);mux_put (gsm); }return ret;
Greg Kroah-Hartman
maintainerPATCH 116/129 tty: n_gsm: fix decoupled mux resource
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
commit 1ec92e9742774bf42614fceea3bf6b50c9409225 upstream.
The active mux instances are managed in the gsm_mux array and via mux_get() and mux_put() functions separately. This gives a very loose coupling between the actual instance and the gsm_mux array which manages it. It also results in unnecessary lockings which makes it prone to failures. And it creates a race condition if more than the maximum number of mux instances are requested while the user changes the parameters of an active instance. The user may loose ownership of the current mux instance in this case. Fix this by moving the gsm_mux array handling to the mux allocation and deallocation functions.
--- drivers/tty/n_gsm.c | 63 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 25 deletions(-)
drivers/tty/n_gsm.c +38 -25
@@ -2070,18 +2070,6 @@ static void gsm_cleanup_mux(struct gsm_m/* Finish outstanding timers, making sure they are done */ del_timer_sync (&gsm->t2_timer); -spin_lock (&gsm_mux_lock); -for (i =0 ; i <MAX_MUX ; i++) { -if (gsm_mux[i] == gsm) { - gsm_mux[i] =NULL ; -break ; - } - } -spin_unlock (&gsm_mux_lock); -/* open failed before registering => nothing to do */ -if (i ==MAX_MUX ) -return ; -/* Free up any link layer users */ for (i =0 ; i <NUM_DLCI ; i++)if (gsm->dlci[i])
@@ -2105,7 +2093,6 @@ static void gsm_cleanup_mux(struct gsm_mstatic int gsm_activate_mux (struct gsm_mux *gsm) {struct gsm_dlci *dlci; -int i =0 ;timer_setup (&gsm->t2_timer, gsm_control_retransmit,0 );init_waitqueue_head (&gsm->event);
@@ -2117,18 +2104,6 @@ static int gsm_activate_mux(struct gsm_melse gsm->receive = gsm1_receive; -spin_lock (&gsm_mux_lock); -for (i =0 ; i <MAX_MUX ; i++) { -if (gsm_mux[i] ==NULL ) { - gsm->num = i; - gsm_mux[i] = gsm; -break ; - } - } -spin_unlock (&gsm_mux_lock); -if (i ==MAX_MUX ) -return -EBUSY ; - dlci =gsm_dlci_alloc (gsm,0 );if (dlci ==NULL )return -ENOMEM ;
@@ -2144,6 +2119,15 @@ static int gsm_activate_mux(struct gsm_m*/ static void gsm_free_mux (struct gsm_mux *gsm) { +int i; + +for (i =0 ; i <MAX_MUX ; i++) { +if (gsm == gsm_mux[i]) { + gsm_mux[i] =NULL ; +break ; + } + } +mutex_destroy (&gsm->mutex);kfree (gsm->txframe);kfree (gsm->buf);kfree (gsm);
@@ -2163,12 +2147,20 @@ static void gsm_free_muxr(struct kref *rstatic inline void mux_get (struct gsm_mux *gsm) { +unsigned long flags; + +spin_lock_irqsave (&gsm_mux_lock, flags);kref_get (&gsm->ref); +spin_unlock_irqrestore (&gsm_mux_lock, flags); }static inline void mux_put (struct gsm_mux *gsm) { +unsigned long flags; + +spin_lock_irqsave (&gsm_mux_lock, flags);kref_put (&gsm->ref, gsm_free_muxr); +spin_unlock_irqrestore (&gsm_mux_lock, flags); }static inline unsigned int mux_num_to_base (struct gsm_mux *gsm)
@@ -2189,6 +2181,7 @@ static inline unsigned int mux_line_to_nstatic struct gsm_mux *gsm_alloc_mux (void ) { +int i;struct gsm_mux *gsm =kzalloc (sizeof (struct gsm_mux ),GFP_KERNEL );if (gsm ==NULL )return NULL ;
@@ -2218,6 +2211,26 @@ static struct gsm_mux *gsm_alloc_mux(voi gsm->mtu =64 ; gsm->dead = true;/* Avoid early tty opens */ +/* Store the instance to the mux array or abort if no space is +* available. +*/ +spin_lock (&gsm_mux_lock); +for (i =0 ; i <MAX_MUX ; i++) { +if (!gsm_mux[i]) { + gsm_mux[i] = gsm; + gsm->num = i; +break ; + } + } +spin_unlock (&gsm_mux_lock); +if (i ==MAX_MUX ) { +mutex_destroy (&gsm->mutex); +kfree (gsm->txframe); +kfree (gsm->buf); +kfree (gsm); +return NULL ; + } +return gsm; }
Greg Kroah-Hartman
maintainerPATCH 117/129 tty: n_gsm: fix mux cleanup after unregister tty device
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
commit 284260f278b706364fb4c88a7b56ba5298d5973c upstream.
Internally, we manage the alive state of the mux channels and mux itself with the field member 'dead'. This makes it possible to notify the user if the accessed underlying link is already gone. On the other hand, however, removing the virtual ttys before terminating the channels may result in peer messages being received without any internal target. Move the mux cleanup procedure from gsmld_detach_gsm() to gsmld_close() to fix this by keeping the virtual ttys open until the mux has been cleaned up.
--- drivers/tty/n_gsm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/tty/n_gsm.c +6 -1
@@ -2410,7 +2410,6 @@ static void gsmld_detach_gsm(struct tty_WARN_ON (tty != gsm->tty);for (i =1 ; i <NUM_DLCI ; i++)tty_unregister_device (gsm_tty_driver, base + i); -gsm_cleanup_mux (gsm, false);tty_kref_put (gsm->tty); gsm->tty =NULL ; }
@@ -2478,6 +2477,12 @@ static void gsmld_close(struct tty_struc {struct gsm_mux *gsm = tty->disc_data; +/* The ldisc locks and closes the port before calling our close. This +* means we have no way to do a proper disconnect. We will not bother +* to do one. +*/ +gsm_cleanup_mux (gsm, false); +gsmld_detach_gsm (tty, gsm);gsmld_flush_buffer (tty);
Greg Kroah-Hartman
maintainerPATCH 118/129 tty: n_gsm: fix wrong signal octet encoding in convergence layer type 2
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
commit 06d5afd4d640eea67f5623e76cd5fc03359b7f3c upstream.
n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010.
See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1516
The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to
the newer 27.010 here. Chapter 5.5.2 describes that the signal octet in
convergence layer type 2 can be either one or two bytes. The length is
encoded in the EA bit. This is set 1 for the last byte in the sequence. gsmtty_modem_update() handles this correctly but gsm_dlci_data_output()
fails to set EA to 1. There is no case in which we encode two signal octets
as there is no case in which we send out a break signal.
Therefore, always set the EA bit to 1 for the signal octet to fix this.
--- drivers/tty/n_gsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/n_gsm.c +1 -1
@@ -818,7 +818,7 @@ static int gsm_dlci_data_output(struct gbreak ;case 2 :/* Unstructed with modem bits. Always one byte as we never send inline break data */ - *dp++ =gsm_encode_modem (dlci); + *dp++ = (gsm_encode_modem (dlci) <<1 ) |EA ;break ; }WARN_ON (kfifo_out_locked (&dlci->fifo, dp , len, &dlci->lock) != len);
Greg Kroah-Hartman
maintainerPATCH 119/129 tty: n_gsm: fix malformed counter for out of frame data
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
commit a24b4b2f660b7ddf3f484b37600bba382cb28a9d upstream.
The gsm_mux field 'malformed' represents the number of malformed frames received. However, gsm1_receive() also increases this counter for any out of frame byte.
Fix this by ignoring out of frame data for the malformed counter.
--- drivers/tty/n_gsm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/n_gsm.c +2 -1
@@ -1968,7 +1968,8 @@ static void gsm1_receive(struct gsm_mux }/* Any partial frame was a runt so go back to start */ if (gsm->state !=GSM_START ) { - gsm->malformed++; +if (gsm->state !=GSM_SEARCH ) + gsm->malformed++; gsm->state =GSM_START ; }/* A SOF in GSM_START means we are still reading idling or
Greg Kroah-Hartman
maintainerPATCH 120/129 netfilter: nft_socket: only do sk lookups when indev is available
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
commit 743b83f15d4069ea57c3e40996bf4a1077e0cdc1 upstream.
Check if the incoming interface is available and NFT_BREAK in case neither skb->sk nor input device are set.
Because nf_sk_lookup_slow*() assume packet headers are in the 'in' direction, use in postrouting is not going to yield a meaningful result. Same is true for the forward chain, so restrict the use to prerouting, input and output.
Use in output work if a socket is already attached to the skb.
--- net/netfilter/nft_socket.c | 52 ++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 14 deletions(-)
net/netfilter/nft_socket.c +38 -14
@@ -33,6 +33,32 @@ static void nft_socket_wildcard(const st } } +static struct sock *nft_socket_do_lookup (const struct nft_pktinfo *pkt) +{ +const struct net_device *indev =nft_in (pkt); +const struct sk_buff *skb = pkt->skb; +struct sock *sk =NULL ; + +if (!indev) +return NULL ; + +switch (nft_pf (pkt)) { +case NFPROTO_IPV4 : + sk =nf_sk_lookup_slow_v4 (nft_net (pkt), skb, indev); +break ; +#if IS_ENABLED (CONFIG_NF_TABLES_IPV6 ) +case NFPROTO_IPV6 : + sk =nf_sk_lookup_slow_v6 (nft_net (pkt), skb, indev); +break ; +#endif +default : +WARN_ON_ONCE (1 ); +break ; + } + +return sk; +} +static void nft_socket_eval (const struct nft_expr *expr,struct nft_regs *regs,const struct nft_pktinfo *pkt)
@@ -46,20 +72,7 @@ static void nft_socket_eval(const struct sk =NULL ;if (!sk) -switch (nft_pf (pkt)) { -case NFPROTO_IPV4 : - sk =nf_sk_lookup_slow_v4 (nft_net (pkt), skb,nft_in (pkt)); -break ; -#if IS_ENABLED (CONFIG_NF_TABLES_IPV6 ) -case NFPROTO_IPV6 : - sk =nf_sk_lookup_slow_v6 (nft_net (pkt), skb,nft_in (pkt)); -break ; -#endif -default : -WARN_ON_ONCE (1 ); - regs->verdict.code =NFT_BREAK ; -return ; - } + sk =nft_socket_do_lookup (pkt);if (!sk) { regs->verdict.code =NFT_BREAK ;
@@ -150,6 +163,16 @@ static int nft_socket_dump(struct sk_bufreturn 0 ; } +static int nft_socket_validate (const struct nft_ctx *ctx, +const struct nft_expr *expr, +const struct nft_data **data) +{ +return nft_chain_validate_hooks (ctx->chain, + (1 <<NF_INET_PRE_ROUTING ) | + (1 <<NF_INET_LOCAL_IN ) | + (1 <<NF_INET_LOCAL_OUT )); +} +static struct nft_expr_type nft_socket_type;static const struct nft_expr_ops nft_socket_ops = { .type = &nft_socket_type,
@@ -157,6 +180,7 @@ static const struct nft_expr_ops nft_soc .eval = nft_socket_eval, .init = nft_socket_init, .dump = nft_socket_dump, + .validate = nft_socket_validate, };static struct nft_expr_type nft_socket_type__read_mostly = {
Greg Kroah-Hartman
maintainerPATCH 121/129 tty: n_gsm: fix insufficient txframe size
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
commit 535bf600de75a859698892ee873521a48d289ec1 upstream.
n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010.
See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1516
The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to
the newer 27.010 here. Chapter 5.7.2 states that the maximum frame size
(N1) refers to the length of the information field (i.e. user payload).
However, 'txframe' stores the whole frame including frame header, checksum
and start/end flags. We also need to consider the byte stuffing overhead.
Define constant for the protocol overhead and adjust the 'txframe' size
calculation accordingly to reserve enough space for a complete mux frame
including byte stuffing for advanced option mode. Note that no byte
stuffing is applied to the start and end flag.
Also use MAX_MTU instead of MAX_MRU as this buffer is used for data
transmission.
--- drivers/tty/n_gsm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/tty/n_gsm.c +3 -1
@@ -72,6 +72,8 @@ module_param(debug, int, 0600);*/ #define MAX_MRU 1500#define MAX_MTU 1500 +/* SOF, ADDR, CTRL, LEN1, LEN2, ..., FCS, EOF */ +#define PROT_OVERHEAD 7#define GSM_NET_TX_TIMEOUT (HZ*10)/**
@@ -2191,7 +2193,7 @@ static struct gsm_mux *gsm_alloc_mux(voikfree (gsm);return NULL ; } - gsm->txframe =kmalloc (2 *MAX_MRU +2 ,GFP_KERNEL ); + gsm->txframe =kmalloc (2 * (MAX_MTU +PROT_OVERHEAD -1 ),GFP_KERNEL );if (gsm->txframe ==NULL ) {kfree (gsm->buf);kfree (gsm);
Greg Kroah-Hartman
maintainerPATCH 122/129 tty: n_gsm: fix wrong DLCI release order
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
commit deefc58bafb4841df7f0a0d85d89a1c819db9743 upstream.
The current DLCI release order starts with the control channel followed by the user channels. Reverse this order to keep the control channel open until all user channels have been released.
--- drivers/tty/n_gsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/n_gsm.c +2 -2
@@ -2073,8 +2073,8 @@ static void gsm_cleanup_mux(struct gsm_m/* Finish outstanding timers, making sure they are done */ del_timer_sync (&gsm->t2_timer); -/* Free up any link layer users */ -for (i =0 ; i <NUM_DLCI ; i++) +/* Free up any link layer users and finally the control channel */ +for (i =NUM_DLCI -1 ; i >=0 ; i--)if (gsm->dlci[i])gsm_dlci_release (gsm->dlci[i]);mutex_unlock (&gsm->mutex);
Greg Kroah-Hartman
maintainerPATCH 123/129 tty: n_gsm: fix missing explicit ldisc flush
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
commit 17eac652028501df7ea296b1d9b9c134db262b7d upstream.
In gsm_cleanup_mux() the muxer is closed down and all queues are removed. However, removing the queues is done without explicit control of the underlying buffers. Flush those before freeing up our queues to ensure that all outgoing queues are cleared consistently. Otherwise, a new mux connection establishment attempt may time out while the underlying tty is still busy sending out the remaining data from the previous connection.
--- drivers/tty/n_gsm.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/n_gsm.c +1 -0
@@ -2079,6 +2079,7 @@ static void gsm_cleanup_mux(struct gsm_mgsm_dlci_release (gsm->dlci[i]);mutex_unlock (&gsm->mutex);/* Now wipe the queues */ +tty_ldisc_flush (gsm->tty);list_for_each_entry_safe (txq, ntxq, &gsm->tx_list, list)kfree (txq);INIT_LIST_HEAD (&gsm->tx_list);
Greg Kroah-Hartman
maintainerPATCH 124/129 tty: n_gsm: fix wrong command retry handling
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
commit d0bcdffcad5a22f202e3bf37190c0dd8c080ea92 upstream.
n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010.
See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1516
The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to
the newer 27.010 here. Chapter 5.7.3 states that the valid range for the
maximum number of retransmissions (N2) is from 0 to 255 (both including).gsm_config() fails to limit this range correctly. Furthermore,gsm_control_retransmit() handles this number incorrectly by performing
N2 - 1 retransmission attempts. Setting N2 to zero results in more than 255 retransmission attempts.
Fix the range check in gsm_config() and the value handling ingsm_control_send() and gsm_control_retransmit() to comply with 3GPP 27.010.
--- drivers/tty/n_gsm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/tty/n_gsm.c +3 -3
@@ -1324,7 +1324,6 @@ static void gsm_control_retransmit(strucspin_lock_irqsave (&gsm->control_lock, flags); ctrl = gsm->pending_cmd;if (ctrl) { - gsm->cretries--;if (gsm->cretries ==0 ) { gsm->pending_cmd =NULL ; ctrl->error = -ETIMEDOUT ;
@@ -1333,6 +1332,7 @@ static void gsm_control_retransmit(strucwake_up (&gsm->event);return ; } + gsm->cretries--;gsm_control_transmit (gsm, ctrl);mod_timer (&gsm->t2_timer, jiffies + gsm->t2 *HZ /100 ); }
@@ -1373,7 +1373,7 @@ retry:/* If DLCI0 is in ADM mode skip retries, it won't respond */ if (gsm->dlci[0 ]->mode ==DLCI_MODE_ADM ) - gsm->cretries =1 ; + gsm->cretries =0 ;else gsm->cretries = gsm->n2;
@@ -2270,7 +2270,7 @@ static int gsm_config(struct gsm_mux *gs/* Check the MRU/MTU range looks sane */ if (c->mru >MAX_MRU || c->mtu >MAX_MTU || c->mru <8 || c->mtu <8 )return -EINVAL ; -if (c->n2 <3 ) +if (c->n2 >255 )return -EINVAL ;if (c->encapsulation >1 )/* Basic, advanced, no I */ return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 125/129 tty: n_gsm: fix wrong command frame length field encoding
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
commit 398867f59f956985f4c324f173eff7b946e14bd8 upstream.
n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010.
See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1516
The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to
the newer 27.010 here. Chapter 5.4.6.1 states that each command frame shall
be made up from type, length and value. Looking for example in chapter
5.4.6.3.5 at the description for the encoding of a flow control on command
it becomes obvious, that the type and length field is always present
whereas the value may be zero bytes long. The current implementation omits
the length field if the value is not present. This is wrong.
Correct this by always sending the length in gsm_control_transmit().
So far only the modem status command (MSC) has included a value and encoded
its length directly. Therefore, also change gsmtty_modem_update().
--- drivers/tty/n_gsm.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
drivers/tty/n_gsm.c +11 -12
@@ -1297,11 +1297,12 @@ static void gsm_control_response(structstatic void gsm_control_transmit (struct gsm_mux *gsm,struct gsm_control *ctrl) { -struct gsm_msg *msg =gsm_data_alloc (gsm,0 , ctrl->len +1 , gsm->ftype); +struct gsm_msg *msg =gsm_data_alloc (gsm,0 , ctrl->len +2 , gsm->ftype);if (msg ==NULL )return ; - msg->data[0 ] = (ctrl->cmd <<1 ) |2 |EA ;/* command */ -memcpy (msg->data +1 , ctrl->data, ctrl->len); + msg->data[0 ] = (ctrl->cmd <<1 ) |CR |EA ;/* command */ + msg->data[1 ] = (ctrl->len <<1 ) |EA ; +memcpy (msg->data +2 , ctrl->data, ctrl->len);gsm_data_queue (gsm->dlci[0 ], msg); }
@@ -2882,19 +2883,17 @@ static struct tty_ldisc_ops tty_ldisc_pastatic int gsmtty_modem_update (struct gsm_dlci *dlci,u8 brk) { -u8 modembits[5 ]; +u8 modembits[3 ];struct gsm_control *ctrl;int len =2 ; -if (brk) + modembits[0 ] = (dlci->addr <<2 ) |2 |EA ;/* DLCI, Valid, EA */ + modembits[1 ] = (gsm_encode_modem (dlci) <<1 ) |EA ; +if (brk) { + modembits[2 ] = (brk <<4 ) |2 |EA ;/* Length, Break, EA */ len++; - - modembits[0 ] = len <<1 |EA ;/* Data bytes */ - modembits[1 ] = dlci->addr <<2 |3 ;/* DLCI, EA, 1 */ - modembits[2 ] =gsm_encode_modem (dlci) <<1 |EA ; -if (brk) - modembits[3 ] = brk <<4 |2 |EA ;/* Valid, EA */ - ctrl =gsm_control_send (dlci->gsm,CMD_MSC , modembits, len +1 ); + } + ctrl =gsm_control_send (dlci->gsm,CMD_MSC , modembits, len);if (ctrl ==NULL )return -ENOMEM ;return gsm_control_wait (dlci->gsm, ctrl);
Greg Kroah-Hartman
maintainerPATCH 126/129 tty: n_gsm: fix reset fifo race condition
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
commit 73029a4d7161f8b6c0934553145ef574d2d0c645 upstream.
gsmtty_write() and gsm_dlci_data_output() properly guard the fifo access. However, gsm_dlci_close() and gsmtty_flush_buffer() modifies the fifo but do not guard this.
Add a guard here to prevent race conditions on parallel writes to the fifo.
--- drivers/tty/n_gsm.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/tty/n_gsm.c +8 -0
@@ -1422,13 +1422,17 @@ static int gsm_control_wait(struct gsm_mstatic void gsm_dlci_close (struct gsm_dlci *dlci) { +unsigned long flags; +del_timer (&dlci->t1);if (debug &8 )pr_debug ("DLCI %d goes closed.\n" , dlci->addr); dlci->state =DLCI_CLOSED ;if (dlci->addr !=0 ) {tty_port_tty_hangup (&dlci->port, false); +spin_lock_irqsave (&dlci->lock, flags);kfifo_reset (&dlci->fifo); +spin_unlock_irqrestore (&dlci->lock, flags);/* Ensure that gsmtty_open() can return. */ tty_port_set_initialized (&dlci->port,0 );wake_up_interruptible (&dlci->port.open_wait);
@@ -3078,13 +3082,17 @@ static int gsmtty_chars_in_buffer(structstatic void gsmtty_flush_buffer (struct tty_struct *tty) {struct gsm_dlci *dlci = tty->driver_data; +unsigned long flags; +if (dlci->state ==DLCI_CLOSED )return ;/* Caution needed: If we implement reliable transport classes then the data being transmitted can't simply be junked once it has first hit the stack. Until then we can just blow it away */ +spin_lock_irqsave (&dlci->lock, flags);kfifo_reset (&dlci->fifo); +spin_unlock_irqrestore (&dlci->lock, flags);/* Need to unhook this DLCI from the transmit queue logic */ }
Greg Kroah-Hartman
maintainerPATCH 127/129 tty: n_gsm: fix incorrect UA handling
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
commit ff9166c623704337bd6fe66fce2838d9768a6634 upstream.
n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010.
See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1516
The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to
the newer 27.010 here. Chapter 5.4.4.2 states that any received unnumbered acknowledgment (UA) with its poll/final (PF) bit set to 0 shall be
discarded. Currently, all UA frame are handled in the same way regardless
of the PF bit. This does not comply with the standard.
Remove the UA case in gsm_queue() to process only UA frames with PF bit set
to 1 to abide the standard.
--- drivers/tty/n_gsm.c | 1 - 1 file changed, 1 deletion(-)
drivers/tty/n_gsm.c +0 -1
@@ -1817,7 +1817,6 @@ static void gsm_queue(struct gsm_mux *gsgsm_response (gsm, address,UA );gsm_dlci_close (dlci);break ; -case UA :case UA |PF :if (cr ==0 || dlci ==NULL )break ;
Greg Kroah-Hartman
maintainerPATCH 128/129 tty: n_gsm: fix software flow control handling
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
commit f4f7d63287217ba25e5c80f5faae5e4f7118790e upstream.
n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010.
See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1516
The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to
the newer 27.010 here. Chapter 5.4.8.1 states that XON/XOFF characters
shall be used instead of Fcon/Fcoff command in advanced option mode to
handle flow control. Chapter 5.4.8.2 describes how XON/XOFF characters
shall be handled. Basic option mode only used Fcon/Fcoff commands and no
XON/XOFF characters. These are treated as data bytes here.
The current implementation uses the gsm_mux field 'constipated' to handle
flow control from the remote peer and the gsm_dlci field 'constipated' to
handle flow control from each DLCI. The later is unrelated to this patch.
The gsm_mux field is correctly set for Fcon/Fcoff commands ingsm_control_message(). However, the same is not true for XON/XOFF
characters in gsm1_receive().
Disable software flow control handling in the tty to allow explicit
handling by n_gsm.
Add the missing handling in advanced option mode for gsm_mux ingsm1_receive() to comply with the standard.
This patch depends on the following commit:
Commit 8838b2af23ca ("tty: n_gsm: fix SW flow control encoding/handling")
--- drivers/tty/n_gsm.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/tty/n_gsm.c +16 -0
@@ -232,6 +232,7 @@ struct gsm_mux {int initiator;/* Did we initiate connection */ bool dead;/* Has the mux been shut down */ struct gsm_dlci *dlci[NUM_DLCI ]; +int old_c_iflag;/* termios c_iflag value before attach */ bool constipated;/* Asked by remote to shut up */ spinlock_t tx_lock;
@@ -1960,6 +1961,16 @@ static void gsm0_receive(struct gsm_muxstatic void gsm1_receive (struct gsm_mux *gsm,unsigned char c) { +/* handle XON/XOFF */ +if ((c &ISO_IEC_646_MASK ) ==XON ) { + gsm->constipated = true; +return ; + }else if ((c &ISO_IEC_646_MASK ) ==XOFF ) { + gsm->constipated = false; +/* Kick the link in case it is idling */ +gsm_data_kick (gsm,NULL ); +return ; + }if (c ==GSM1_SOF ) {/* EOF is only valid in frame if we have got to the data state and received at least one byte (the FCS) */
@@ -2378,6 +2389,9 @@ static int gsmld_attach_gsm(struct tty_sint ret, i; gsm->tty =tty_kref_get (tty); +/* Turn off tty XON/XOFF handling to handle it explicitly. */ + gsm->old_c_iflag = tty->termios.c_iflag; + tty->termios.c_iflag &= (IXON |IXOFF ); ret =gsm_activate_mux (gsm);if (ret !=0 )tty_kref_put (gsm->tty);
@@ -2418,6 +2432,8 @@ static void gsmld_detach_gsm(struct tty_WARN_ON (tty != gsm->tty);for (i =1 ; i <NUM_DLCI ; i++)tty_unregister_device (gsm_tty_driver, base + i); +/* Restore tty XON/XOFF handling. */ + gsm->tty->termios.c_iflag = gsm->old_c_iflag;tty_kref_put (gsm->tty); gsm->tty =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 129/129 perf symbol: Remove arch__symbols__fixup_end()
In reply to Greg Kroah-HartmanFrom: Namhyung Kim <[email protected]>
commit a5d20d42a2f2dc2b2f9e9361912062732414090d upstream.
Now the generic code can handle kallsyms fixup properly so no need to keep the arch-functions anymore.
--- tools/perf/arch/arm64/util/Build | 1 - tools/perf/arch/arm64/util/machine.c | 27 --------------------------- tools/perf/arch/s390/util/machine.c | 16 ---------------- tools/perf/util/symbol.c | 5 ----- tools/perf/util/symbol.h | 1 - 5 files changed, 50 deletions(-) delete mode 100644 tools/perf/arch/powerpc/util/machine.c
tools/perf/arch/arm64/util/Build +0 -1
@@ -1,5 +1,4 @@ perf-y += header.o -perf-y += machine.o perf-y += perf_regs.o perf-y += tsc.o perf-$(CONFIG_DWARF) += dwarf-regs.o
tools/perf/arch/arm64/util/machine.c deleted +0 -27
@@ -1,27 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -#include <stdio.h> -#include <string.h> -#include "debug.h" -#include "symbol.h" - -/* On arm64, kernel text segment start at high memory address, -* for example 0xffff 0000 8xxx xxxx. Modules start at a low memory -* address, like 0xffff 0000 00ax xxxx. When only samll amount of -* memory is used by modules, gap between end of module's text segment -* and start of kernel text segment may be reach 2G. -* Therefore do not fill this gap and do not assign it to the kernel dso map. -*/ - -#define SYMBOL_LIMIT (1 << 12)/* 4K */ - -void arch__symbols__fixup_end (struct symbol *p,struct symbol *c) -{ -if ((strchr (p->name,'[' ) &&strchr (c->name,'[' ) ==NULL ) || - (strchr (p->name,'[' ) ==NULL &&strchr (c->name,'[' ))) -/* Limit range of last symbol in module and kernel */ - p->end +=SYMBOL_LIMIT ; -else - p->end = c->start; -pr_debug4 ("%s sym:%s end:%#lx\n" , __func__, p->name, p->end); -}
tools/perf/arch/s390/util/machine.c +0 -16
@@ -34,19 +34,3 @@ int arch__fix_module_text_start(u64 *stareturn 0 ; } - -/* On s390 kernel text segment start is located at very low memory addresses, -* for example 0x10000. Modules are located at very high memory addresses, -* for example 0x3ff xxxx xxxx. The gap between end of kernel text segment -* and beginning of first module's text segment is very big. -* Therefore do not fill this gap and do not assign it to the kernel dso map. -*/ -void arch__symbols__fixup_end (struct symbol *p,struct symbol *c) -{ -if (strchr (p->name,'[' ) ==NULL &&strchr (c->name,'[' )) -/* Last kernel symbol mapped to end of page */ - p->end =roundup (p->end, page_size); -else - p->end = c->start; -pr_debug4 ("%s sym:%s end:%#lx\n" , __func__, p->name, p->end); -}
tools/perf/util/symbol.c +0 -5
@@ -101,11 +101,6 @@ static int prefix_underscores_count(consreturn tail - str; } -void __weak arch__symbols__fixup_end (struct symbol *p,struct symbol *c) -{ - p->end = c->start; -} -const char *__weak arch__normalize_symbol_name (const char *name) {return name;
tools/perf/util/symbol.h +0 -1
@@ -230,7 +230,6 @@ const char *arch__normalize_symbol_name(#define SYMBOL_A 0#define SYMBOL_B 1 -void arch__symbols__fixup_end (struct symbol *p,struct symbol *c);int arch__compare_symbol_names (const char *namea,const char *nameb);int arch__compare_symbol_names_n (const char *namea,const char *nameb,unsigned int n);
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 5.10.114 release. There are 129 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: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.114 release. There are 129 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 Fri, 06 May 2022 15:25:19 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.114-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
Tested on arm64 and x86 for 5.10.114-rc1,
Kernel repo:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Branch: linux-5.10.y
Version: 5.10.114-rc1
Commit: 9bf02e9ae445793d3e1cdb9129d19c5efa417ddc
Compiler: gcc version 7.3.0 (GCC)
arm64:
--------------------------------------------------------------------
Testcase Result Summary:
total: 9033
passed: 9033
failed: 0
timeout: 0
--------------------------------------------------------------------
x86:
--------------------------------------------------------------------
Testcase Result Summary:
total: 9033
passed: 9033
failed: 0
timeout: 0
--------------------------------------------------------------------
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.114 release. There are 129 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 Fri, 06 May 2022 15:25:19 +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.114-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:
Signature · 1 line
Florian
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.114 release. There are 129 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 Fri, 06 May 2022 15:25:19 +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.114-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
28 boots: 28 pass, 0 fail
75 tests: 75 pass, 0 failLinux version: 5.10.114-rc1-g0412f4bd3360
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 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.114 release. There are 129 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 Fri, 06 May 2022 15:25:19 +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.114-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.114-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-5.10.y
* git commit: 0412f4bd3360abe0f87f814f6b1325813bbe9f44
* git describe: v5.10.113-130-g0412f4bd3360
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.10.y/build/v5.10.113-130-g0412f4bd3360
## Test Regressions (compared to v5.10.113-3-gbc311a966773) No test regressions found.
## Metric Regressions (compared to v5.10.113-3-gbc311a966773) No metric regressions found.
## Test Fixes (compared to v5.10.113-3-gbc311a966773) No test fixes found.
## Metric Fixes (compared to v5.10.113-3-gbc311a966773) No metric fixes found.
## Test result summary
total: 100855, pass: 85629, fail: 641, skip: 13505, xfail: 1080
## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 291 total, 291 passed, 0 failed
* arm64: 41 total, 41 passed, 0 failed
* i386: 39 total, 39 passed, 0 failed
* mips: 37 total, 37 passed, 0 failed
* parisc: 12 total, 12 passed, 0 failed
* powerpc: 60 total, 51 passed, 9 failed
* riscv: 27 total, 27 passed, 0 failed
* s390: 21 total, 21 passed, 0 failed
* sh: 24 total, 24 passed, 0 failed
* sparc: 12 total, 12 passed, 0 failed
* x86_64: 41 total, 41 passed, 0 failed
## Test suites summary
* fwts
* igt-gpu-tools
* kselftest-android
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-vm
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-tracing-tests
* network-basic-tests
* packetdrill
* perf
* perf/Zstd-perf.data-compression
* rcutorture
* ssuite
* v4l2-compliance
* vdso
--
Linaro LKFT
https://lkft.linaro.org
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.114 release. There are 129 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 Fri, 06 May 2022 15:25:19 +0000. Anything received after that time might be too late.
Build results:
total: 161 pass: 161 fail: 0 Qemu test results: total: 477 pass: 477 fail: 0
Guenter