6.0.13-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainercover 6.0.13-rc1 review
This is the start of the stable review cycle for the 6.0.13 release. There are 157 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 Wed, 14 Dec 2022 13:08:57 +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/v6.x/stable-review/patch-6.0.13-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-6.0.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.0.13-rc1
Ruijing Dong <[email protected]>
drm/amdgpu/vcn: update vcn4 fw shared data structure
Alexandra Winter <[email protected]>
s390/qeth: fix use-after-free in hsci
Emeel Hakim <[email protected]>
macsec: add missing attribute validation for offload
Dan Carpenter <[email protected]>
net: mvneta: Fix an out of bounds check
Zhengchao Shao <[email protected]>
net: thunderbolt: fix memory leak in tbnet_open()
Eric Dumazet <[email protected]>
ipv6: avoid use-after-free in ip6_fragment()
Yang Yingliang <[email protected]>
net: plip: don't call kfree_skb/dev_kfree_skb() under spin_lock_irq()
Michael Walle <[email protected]>
net: phy: mxl-gpy: add MDINT workaround
Vladimir Oltean <[email protected]>
net: dsa: mv88e6xxx: accept phy-mode = "internal" for internal PHY ports
Juergen Gross <[email protected]>
xen/netback: fix build warning
Yuan Can <[email protected]>
dpaa2-switch: Fix memory leak in dpaa2_switch_acl_entry_add() and dpaa2_switch_acl_entry_remove()
Zhang Changzhong <[email protected]>
ethernet: aeroflex: fix potential skb leak in greth_init_rings()
Xin Long <[email protected]>
tipc: call tipc_lxc_xmit without holding node_read_lock
Zhengchao Shao <[email protected]>
net: dsa: sja1105: fix memory leak in sja1105_setup_devlink_regions()
Ido Schimmel <[email protected]>
ipv4: Fix incorrect route flushing when table ID 0 is used
Ido Schimmel <[email protected]>
ipv4: Fix incorrect route flushing when source address is deleted
Hangbin Liu <[email protected]>
bonding: get correct NA dest address
YueHaibing <[email protected]>
tipc: Fix potential OOB in tipc_link_proto_rcv()
Liu Jian <[email protected]>
net: hisilicon: Fix potential use-after-free in hix5hd2_rx()
Zeng Heng <[email protected]>
net: mdio: fix unbalanced fwnode reference count in mdio_device_release()
Liu Jian <[email protected]>
net: hisilicon: Fix potential use-after-free in hisi_femac_rx()
Yongqiang Liu <[email protected]>
net: thunderx: Fix missing destroy_workqueue of nicvf_rx_mode_wq
YueHaibing <[email protected]>
ravb: Fix potential use-after-free in ravb_rx_gbeth()
Qiheng Lin <[email protected]>
net: microchip: sparx5: Fix missing destroy_workqueue of mact_queue
Hangbin Liu <[email protected]>
ip_gre: do not report erspan version on GRE interface
Zhengchao Shao <[email protected]>
net: wwan: iosm: fix memory leak in ipc_mux_init()
Jisheng Zhang <[email protected]>
net: stmmac: fix "snps,axi-config" node property parsing
Wang Yufen <[email protected]>
gpio/rockchip: fix refcount leak in rockchip_gpiolib_register()
Pankaj Raghav <[email protected]>
nvme initialize core quirks before calling nvme_init_subsystem
Kees Cook <[email protected]>
NFC: nci: Bounds check struct nfc_target arrays
Przemyslaw Patynowski <[email protected]>
i40e: Disallow ip4 and ip6 l4_4_bytes
Sylwester Dziedziuch <[email protected]>
i40e: Fix for VF MAC address 0
Michal Jaron <[email protected]>
i40e: Fix not setting default xps_cpus after reset
Dan Carpenter <[email protected]>
net: mvneta: Prevent out of bounds read in mvneta_config_rss()
Lin Liu <[email protected]>
xen-netfront: Fix NULL sring after live migration
Casper Andersson <[email protected]>
net: microchip: sparx5: correctly free skb in xmit
Ziyang Xuan <[email protected]>
octeontx2-pf: Fix potential memory leak in otx2_init_tc()
Yang Yingliang <[email protected]>
net: mdiobus: fix double put fwnode in the error path
Oleksij Rempel <[email protected]>
net: mdiobus: fwnode_mdiobus_register_phy() rework error handling
Valentina Goncharenko <[email protected]>
net: encx24j600: Fix invalid logic in reading of MISTAT register
Valentina Goncharenko <[email protected]>
net: encx24j600: Add parentheses to fix precedence
Wei Yongjun <[email protected]>
mac802154: fix missing INIT_LIST_HEAD in ieee802154_if_add()
Yinjun Zhang <[email protected]>
nfp: correct desc type when header dma len is 4096
Zhengchao Shao <[email protected]>
selftests: rtnetlink: correct xfrm policy rule in kci_test_ipsec_offload
Artem Chernyshev <[email protected]>
net: dsa: sja1105: Check return value
Artem Chernyshev <[email protected]>
net: dsa: hellcreek: Check return value
Artem Chernyshev <[email protected]>
net: dsa: ksz: Check return value
Chen Zhongjin <[email protected]>
Bluetooth: Fix not cleanup led when bt_init fails
Chethan T N <[email protected]>
Bluetooth: Fix support for Read Local Supported Codecs V2
Chethan T N <[email protected]>
Bluetooth: Remove codec id field in vendor codec definition
Wang ShaoBo <[email protected]>
Bluetooth: hci_conn: add missing hci_dev_put() in iso_listen_bis()
Wang ShaoBo <[email protected]>
Bluetooth: 6LoWPAN: add missing hci_dev_put() in get_l2cap_conn()
Ronak Doshi <[email protected]>
vmxnet3: use correct intrConf reference when using extended queues
Ronak Doshi <[email protected]>
vmxnet3: correctly report encapsulated LRO packet
Florian Westphal <[email protected]>
inet: ping: use hlist_nulls rcu iterator during lookup
Kuniyuki Iwashima <[email protected]>
af_unix: Get user_ns from in_skb in unix_diag_get_exact().
Guillaume BRUN <[email protected]>
drm: bridge: dw_hdmi: fix preference of RGB modes over YUV420
Siddharth Vadapalli <[email protected]>
net: ethernet: ti: am65-cpsw: Fix RGMII configuration at SPEED_10
YueHaibing <[email protected]>
net: broadcom: Add PTP_1588_CLOCK_OPTIONAL dependency for BCMGENET under ARCH_BCM2835
Akihiko Odaki <[email protected]>
igb: Allocate MSI-X vector when testing
Akihiko Odaki <[email protected]>
e1000e: Fix TX dispatch condition
Xiongfeng Wang <[email protected]>
gpio: amd8111: Fix PCI device reference count leak
Qiqi Zhang <[email protected]>
drm/bridge: ti-sn65dsi86: Fix output polarity setting bug
Pablo Neira Ayuso <[email protected]>
netfilter: ctnetlink: fix compilation warning after data race fixes in ct mark
Xin Long <[email protected]>
netfilter: conntrack: fix using __this_cpu_add in preemptible
Hauke Mehrtens <[email protected]>
ca8210: Fix crash by zero initializing data
Ziyang Xuan <[email protected]>
ieee802154: cc2520: Fix error return code in cc2520_hw_init()
Dawei Li <[email protected]>
drm/vmwgfx: Fix race issue calling pin_user_pages
Xin Long <[email protected]>
netfilter: flowtable_offload: fix using __this_cpu_add in preemptible
Stefano Brivio <[email protected]>
netfilter: nft_set_pipapo: Actually validate intervals in fields after the first one
Zeng Heng <[email protected]>
gpiolib: fix memory leak in gpiochip_setup_dev()
Peter Rosin <[email protected]>
ARM: at91: fix build for SAMA5D3 w/o L2 cache
Oliver Hartkopp <[email protected]>
can: af_can: fix NULL pointer dereference in can_rcv_filter
Wang Kefeng <[email protected]>
ARM: 9278/1: kfence: only handle translation faults
Hans de Goede <[email protected]>
HID: ite: Enable QUIRK_TOUCHPAD_ON_OFF_REPORT on Acer Aspire Switch V 10
ZhangPeng <[email protected]>
HID: core: fix shift-out-of-bounds in hid_report_raw_event
Anastasia Belova <[email protected]>
HID: hid-lg4ff: Add check for empty lbuf
José Expósito <[email protected]>
HID: uclogic: Add HID_QUIRK_HIDINPUT_FORCE quirk
Benjamin Tissoires <[email protected]>
HID: fix I2C_HID not selected when I2C_HID_OF_ELAN is
Ankit Patel <[email protected]>
HID: usbhid: Add ALWAYS_POLL quirk for some mice
Radu Nicolae Pirea (OSS) <[email protected]>
net: dsa: sja1105: avoid out of bounds access in sja1105_init_l2_policing()
Rob Clark <[email protected]>
drm/shmem-helper: Avoid vm_open error paths
Rob Clark <[email protected]>
drm/shmem-helper: Remove errant put in error path
Aurabindo Pillai <[email protected]>
drm/amd/display: fix array index out of bound error in DCN32 DML
Prike Liang <[email protected]>
drm/amdgpu/sdma_v4_0: turn off SDMA ring buffer in the s2idle suspend
Frank Jungclaus <[email protected]>
can: esd_usb: Allow REC and TEC to return to zero
Jiri Slaby (SUSE) <[email protected]>
can: slcan: fix freed work crash
Max Staudt <[email protected]>
can: can327: flush TX_work on ldisc .close()
Zack Rusin <[email protected]>
drm/vmwgfx: Don't use screen objects when SEV is active
Thomas Huth <[email protected]>
KVM: s390: vsie: Fix the initialization of the epoch extension (epdx) field
José Expósito <[email protected]>
HID: uclogic: Fix frame templates for big endian architectures
Harshit Mogalapalli <[email protected]>
io_uring: Fix a null-ptr-deref in io_tctx_exit_cb()
Haiyang Zhang <[email protected]>
net: mana: Fix race on per-CQ variable napi work_done
Tianjia Zhang <[email protected]>
selftests/tls: Fix tls selftests dependency to correct algorithm
Luiz Augusto von Dentz <[email protected]>
Bluetooth: Fix crash when replugging CSR fake controllers
Ismael Ferreras Morezuelas <[email protected]>
Bluetooth: btusb: Add debug message for CSR controllers
Ismael Ferreras Morezuelas <[email protected]>
Bluetooth: btusb: Fix CSR clones again by re-adding ERR_DATA_REPORTING quirk
Hugh Dickins <[email protected]>
tmpfs: fix data loss from failed fallocate
John Starks <[email protected]>
mm/gup: fix gup_pud_range() for dax
Tejun Heo <[email protected]>
memcg: fix possible use-after-free in memcg_write_event_control()
Hans Verkuil <[email protected]>
media: v4l2-dv-timings.c: fix too strict blanking sanity checks
Francesco Dolcini <[email protected]>
Revert "ARM: dts: imx7: Fix NAND controller size-cells"
Sjoerd Simons <[email protected]>
soundwire: intel: Initialize clock stop timeout
Dave Wysochanski <[email protected]>
fscache: Fix oops due to race with cookie_lru and use_cookie
Hans Verkuil <[email protected]>
media: videobuf2-core: take mmap_lock in vb2_get_unmapped_area()
Juergen Gross <[email protected]>
xen/netback: don't call kfree_skb() with interrupts disabled
Ross Lagerwall <[email protected]>
xen/netback: Ensure protocol headers don't fall in the non-linear area
Luke D. Jones <[email protected]>
platform/x86: asus-wmi: Add support for ROG X13 tablet mode
Luke D. Jones <[email protected]>
platform/x86: asus-wmi: Adjust tablet/lidflip handling to use enum
Pierre-Louis Bossart <[email protected]>
soundwire: dmi-quirks: add remapping for HP Omen 16-k0005TX
Jarkko Sakkinen <[email protected]>
crypto: ccp - Add a quirk to firmware update
Takashi Iwai <[email protected]>
ALSA: hda/realtek: More robust component matching for CS35L41
Mike Kravetz <[email protected]>
hugetlb: don't delete vma_lock in hugetlb MADV_DONTNEED processing
Jann Horn <[email protected]>
mm/khugepaged: invoke MMU notifiers in shmem/file collapse paths
Jann Horn <[email protected]>
mm/khugepaged: fix GUP-fast interaction by sending IPI
Jann Horn <[email protected]>
mm/khugepaged: take the right locks for page table retraction
Stanley.Yang <[email protected]>
drm/amdgpu: fix use-after-free during gpu recovery
Dillon Varone <[email protected]>
drm/amd/display: Use new num clk levels struct for max mclk index
Taimur Hassan <[email protected]>
drm/amd/display: Avoid setting pixel rate divider to N/A
Dillon Varone <[email protected]>
drm/amd/display: Use viewport height for subvp mall allocation size
Davide Tronchin <[email protected]>
net: usb: qmi_wwan: add u-blox 0x1342 composition
Dominique Martinet <[email protected]>
9p/xen: check logical size for buffer size
Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Disable GUSB2PHYCFG.SUSPHY for End Transfer
Tetsuo Handa <[email protected]>
fbcon: Use kzalloc() in fbcon_prepare_logo()
Andreas Kemnade <[email protected]>
regulator: twl6030: fix get status of twl6032 regulators
Srinivasa Rao Mandadapu <[email protected]>
ASoC: soc-pcm: Add NULL check in BE reparenting
Eli Cohen <[email protected]>
net/mlx5: Lag, avoid lockdep warnings
Filipe Manana <[email protected]>
btrfs: send: avoid unaligned encoded writes when attempting to clone range
Daniel Díaz <[email protected]>
selftests/net: Find nettest in current directory
KaiLong Wang <[email protected]>
LoongArch: Fix unsigned comparison with less than zero
Huacai Chen <[email protected]>
LoongArch: Set _PAGE_DIRTY only if _PAGE_MODIFIED is set in {pmd,pte}_mkwrite()
Huacai Chen <[email protected]>
LoongArch: Combine acpi_boot_table_init() and acpi_boot_init()
Tiezhu Yang <[email protected]>
LoongArch: Makefile: Use "grep -E" instead of "egrep"
Kees Cook <[email protected]>
ALSA: seq: Fix function prototype mismatch in snd_seq_expand_var_event
Konrad Dybcio <[email protected]>
regulator: slg51000: Wait after asserting CS pin
GUO Zihua <[email protected]>
9p/fd: Use P9_HDRSZ for header size
Shuming Fan <[email protected]>
ASoC: rt711-sdca: fix the latency time of clock stop prepare state machine transitions
Johan Jonker <[email protected]>
ARM: dts: rockchip: disable arm_global_timer on rk3066 and rk3188
Zhichao Liu <[email protected]>
spi: mediatek: Fix DEVAPC Violation at KO Remove
Chancel Liu <[email protected]>
ASoC: wm8962: Wait for updated value of WM8962_CLOCKING1 register
Giulio Benetti <[email protected]>
ARM: 9266/1: mm: fix no-MMU ZERO_PAGE() implementation
Tomislav Novak <[email protected]>
ARM: 9251/1: perf: Fix stacktraces for tracepoint events in THUMB2 kernels
Jann Horn <[email protected]>
fs: use acquire ordering in __fget_light()
Johan Jonker <[email protected]>
ARM: dts: rockchip: rk3188: fix lcdc1-rgb24 node name
Johan Jonker <[email protected]>
arm64: dts: rockchip: fix ir-receiver node names
Johan Jonker <[email protected]>
ARM: dts: rockchip: fix ir-receiver node names
Johan Jonker <[email protected]>
arm64: dts: rockchip: fix adc-keys sub node names
Johan Jonker <[email protected]>
ARM: dts: rockchip: fix adc-keys sub node names
Sebastian Reichel <[email protected]>
arm: dts: rockchip: remove clock-frequency from rtc
Sebastian Reichel <[email protected]>
arm: dts: rockchip: fix node name for hym8563 rtc
Sebastian Reichel <[email protected]>
arm64: dts: rockchip: fix node name for hym8563 rtc
FUKAUMI Naoki <[email protected]>
arm64: dts: rockchip: keep I2S1 disabled for GPIO function on ROCK Pi 4 series
Furkan Kardame <[email protected]>
arm64: dts: rockchip: remove i2c5 from rk3566-roc-pc
Furkan Kardame <[email protected]>
arm64: dts: rockchip: Fix i2c3 pinctrl on rk3566-roc-pc
Furkan Kardame <[email protected]>
arm64: dts: rockchip: Fix gmac failure of rgmii-id from rk3566-roc-pc
Ville Syrjälä <[email protected]>
drm/i915: Remove non-existent pipes from bigjoiner pipe mask
Mike Kravetz <[email protected]>
madvise: use zap_page_range_single for madvise dontneed
-------------
Diffstat:
.clang-format | 1 + Makefile | 4 +- arch/arm/boot/dts/imx7s.dtsi | 4 +- arch/arm/boot/dts/rk3036-evb.dts | 3 +- arch/arm/boot/dts/rk3066a-mk808.dts | 2 +- arch/arm/boot/dts/rk3188-radxarock.dts | 2 +- arch/arm/boot/dts/rk3188.dtsi | 3 +- arch/arm/boot/dts/rk3288-evb-act8846.dts | 2 +- arch/arm/boot/dts/rk3288-evb.dtsi | 6 +- arch/arm/boot/dts/rk3288-firefly.dtsi | 3 +- arch/arm/boot/dts/rk3288-miqi.dts | 3 +- arch/arm/boot/dts/rk3288-rock2-square.dts | 3 +- arch/arm/boot/dts/rk3288-vmarc-som.dtsi | 1 - arch/arm/boot/dts/rk3xxx.dtsi | 7 + arch/arm/include/asm/perf_event.h | 2 +- arch/arm/include/asm/pgtable-nommu.h | 6 - arch/arm/include/asm/pgtable.h | 16 +- arch/arm/mach-at91/sama5.c | 2 +- arch/arm/mm/fault.c | 18 +- arch/arm/mm/fault.h | 9 +- arch/arm/mm/nommu.c | 19 ++ arch/arm64/boot/dts/rockchip/px30-evb.dts | 10 +- arch/arm64/boot/dts/rockchip/rk3308-evb.dts | 12 +- arch/arm64/boot/dts/rockchip/rk3308-roc-cc.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3318-a95x-z2.dts | 2 +- .../boot/dts/rockchip/rk3368-orion-r68-meta.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3368-r88.dts | 2 +- .../boot/dts/rockchip/rk3399-khadas-edge.dtsi | 2 +- arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4b.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts | 4 +- .../arm64/boot/dts/rockchip/rk3399-roc-pc-plus.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi | 2 +- arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi | 1 - .../dts/rockchip/rk3399-sapphire-excavator.dts | 4 +- .../boot/dts/rockchip/rk3399pro-vmarc-som.dtsi | 2 +- arch/arm64/boot/dts/rockchip/rk3566-pinenote.dtsi | 2 +- arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts | 8 +- arch/loongarch/Makefile | 2 +- arch/loongarch/include/asm/pgtable.h | 8 +- arch/loongarch/kernel/acpi.c | 31 +-- arch/loongarch/kernel/setup.c | 1 - arch/loongarch/kernel/unwind_prologue.c | 3 +- arch/s390/kvm/vsie.c | 4 +- drivers/bluetooth/btusb.c | 6 + drivers/crypto/ccp/sev-dev.c | 16 +- drivers/gpio/gpio-amd8111.c | 4 + drivers/gpio/gpio-rockchip.c | 1 + drivers/gpio/gpiolib.c | 42 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 7 + drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 24 ++- drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 4 + .../gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c | 7 + .../gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.c | 3 +- drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dccg.c | 4 +- drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c | 1 + .../amd/display/dc/dcn32/dcn32_resource_helpers.c | 2 +- .../gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 2 +- .../gpu/drm/amd/display/dc/dml/display_mode_vba.h | 2 +- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 6 +- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 4 +- drivers/gpu/drm/drm_gem_shmem_helper.c | 18 +- drivers/gpu/drm/i915/display/intel_display.c | 10 +- drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 6 +- drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 4 + drivers/hid/hid-core.c | 3 + drivers/hid/hid-ids.h | 4 + drivers/hid/hid-ite.c | 5 + drivers/hid/hid-lg4ff.c | 6 + drivers/hid/hid-quirks.c | 3 + drivers/hid/hid-uclogic-core.c | 1 + drivers/hid/hid-uclogic-rdesc.c | 2 +- drivers/hid/i2c-hid/Kconfig | 4 +- drivers/media/common/videobuf2/videobuf2-core.c | 102 +++++++--- drivers/media/v4l2-core/v4l2-dv-timings.c | 20 +- drivers/net/bonding/bond_main.c | 2 +- drivers/net/can/can327.c | 17 +- drivers/net/can/slcan/slcan-core.c | 10 +- drivers/net/can/usb/esd_usb.c | 6 + drivers/net/dsa/mv88e6xxx/chip.c | 7 +- drivers/net/dsa/sja1105/sja1105_devlink.c | 2 + drivers/net/dsa/sja1105/sja1105_main.c | 2 +- drivers/net/ethernet/aeroflex/greth.c | 1 + drivers/net/ethernet/broadcom/Kconfig | 3 +- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 4 +- .../ethernet/freescale/dpaa2/dpaa2-switch-flower.c | 4 + drivers/net/ethernet/hisilicon/hisi_femac.c | 2 +- drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 2 +- drivers/net/ethernet/intel/e1000e/netdev.c | 4 +- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 12 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 19 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 + drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 + drivers/net/ethernet/marvell/mvneta.c | 2 +- .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 7 +- drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 3 +- drivers/net/ethernet/mellanox/mlx5/core/lag/lag.h | 14 +- .../net/ethernet/mellanox/mlx5/core/lag/mpesw.c | 100 +++++---- .../net/ethernet/mellanox/mlx5/core/lag/mpesw.h | 1 - drivers/net/ethernet/microchip/encx24j600-regmap.c | 4 +- .../net/ethernet/microchip/sparx5/sparx5_fdma.c | 2 +- .../net/ethernet/microchip/sparx5/sparx5_main.c | 3 + .../net/ethernet/microchip/sparx5/sparx5_packet.c | 41 ++-- drivers/net/ethernet/microsoft/mana/gdma.h | 9 +- drivers/net/ethernet/microsoft/mana/mana_en.c | 16 +- drivers/net/ethernet/netronome/nfp/nfdk/dp.c | 6 +- drivers/net/ethernet/renesas/ravb_main.c | 2 +- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 8 +- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 +- drivers/net/ieee802154/ca8210.c | 2 +- drivers/net/ieee802154/cc2520.c | 2 +- drivers/net/macsec.c | 1 + drivers/net/mdio/fwnode_mdio.c | 25 ++- drivers/net/mdio/of_mdio.c | 3 +- drivers/net/phy/mdio_device.c | 2 + drivers/net/phy/mxl-gpy.c | 85 ++++++++ drivers/net/plip/plip.c | 4 +- drivers/net/thunderbolt.c | 1 + drivers/net/usb/qmi_wwan.c | 1 + drivers/net/vmxnet3/vmxnet3_drv.c | 27 ++- drivers/net/wwan/iosm/iosm_ipc_mux.c | 1 + drivers/net/xen-netback/common.h | 2 +- drivers/net/xen-netback/interface.c | 6 +- drivers/net/xen-netback/netback.c | 225 ++++++++++++--------- drivers/net/xen-netback/rx.c | 8 +- drivers/net/xen-netfront.c | 6 + drivers/nvme/host/core.c | 8 +- drivers/platform/x86/asus-nb-wmi.c | 28 ++- drivers/platform/x86/asus-wmi.c | 86 ++++++-- drivers/platform/x86/asus-wmi.h | 10 +- drivers/regulator/slg51000-regulator.c | 2 + drivers/regulator/twl6030-regulator.c | 15 +- drivers/s390/net/qeth_l2_main.c | 2 +- drivers/soundwire/dmi-quirks.c | 27 +++ drivers/soundwire/intel.c | 1 + drivers/spi/spi-mt65xx.c | 8 +- drivers/usb/dwc3/gadget.c | 3 +- drivers/video/fbdev/core/fbcon.c | 2 +- fs/btrfs/send.c | 24 ++- fs/file.c | 11 +- fs/fscache/cookie.c | 8 + include/asm-generic/tlb.h | 4 + include/linux/cgroup.h | 1 + include/linux/mm.h | 29 ++- include/linux/platform_data/x86/asus-wmi.h | 1 + include/net/bluetooth/hci.h | 12 +- include/net/ping.h | 3 - include/trace/events/fscache.h | 2 + io_uring/io_uring.c | 4 +- kernel/cgroup/cgroup-internal.h | 1 - mm/gup.c | 2 +- mm/hugetlb.c | 25 ++- mm/khugepaged.c | 63 +++++- mm/madvise.c | 6 +- mm/memcontrol.c | 15 +- mm/memory.c | 25 ++- mm/mmu_gather.c | 4 +- mm/shmem.c | 11 + net/9p/trans_fd.c | 6 +- net/9p/trans_xen.c | 9 + net/bluetooth/6lowpan.c | 1 + net/bluetooth/af_bluetooth.c | 4 +- net/bluetooth/hci_codec.c | 19 +- net/bluetooth/hci_core.c | 8 +- net/bluetooth/hci_sync.c | 19 +- net/bluetooth/iso.c | 1 + net/can/af_can.c | 4 +- net/dsa/tag_hellcreek.c | 3 +- net/dsa/tag_ksz.c | 3 +- net/dsa/tag_sja1105.c | 3 +- net/ipv4/fib_frontend.c | 3 + net/ipv4/fib_semantics.c | 1 + net/ipv4/ip_gre.c | 48 +++-- net/ipv4/ping.c | 7 +- net/ipv6/ip6_output.c | 5 + net/mac802154/iface.c | 1 + net/netfilter/nf_conntrack_core.c | 6 +- net/netfilter/nf_conntrack_netlink.c | 19 +- net/netfilter/nf_flow_table_offload.c | 6 +- net/netfilter/nft_set_pipapo.c | 5 +- net/nfc/nci/ntf.c | 6 + net/tipc/link.c | 4 +- net/tipc/node.c | 12 +- net/unix/diag.c | 20 +- sound/core/seq/seq_memory.c | 11 +- sound/pci/hda/patch_realtek.c | 62 +++--- sound/soc/codecs/rt711-sdca-sdw.c | 2 +- sound/soc/codecs/wm8962.c | 8 + sound/soc/soc-pcm.c | 2 + tools/testing/selftests/net/config | 2 +- tools/testing/selftests/net/fcnal-test.sh | 11 +- tools/testing/selftests/net/fib_tests.sh | 37 ++++ tools/testing/selftests/net/pmtu.sh | 10 +- tools/testing/selftests/net/rtnetlink.sh | 2 +- 195 files changed, 1462 insertions(+), 628 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/157 madvise: use zap_page_range_single for madvise dontneed
From: Mike Kravetz <[email protected]>
[ Upstream commit 21b85b09527c28e242db55c1b751f7f7549b830c ]
This series addresses the issue first reported in [1], and fully described in patch 2. Patches 1 and 2 address the user visible issue and are tagged for stable backports.
While exploring solutions to this issue, related problems with mmu notification calls were discovered. This is addressed in the patch "hugetlb: remove duplicate mmu notifications:". Since there are no user visible effects, this third is not tagged for stable backports.
Previous discussions suggested further cleanup by removing the routine zap_page_range. This is possible because zap_page_range_single is now exported, and all callers of zap_page_range pass ranges entirely within a single vma. This work will be done in a later patch so as not to distract from this bug fix.
[1] https://lore.kernel.org/lkml/CAO4mrfdLMXsao9RF4fUE8-Wfde8xmjsKrTNMNC9wjUb6JudD0g@mail.gmail.com/
This patch (of 2):
Expose the routine zap_page_range_single to zap a range within a single vma. The madvise routine madvise_dontneed_single_vma can use this routine as it explicitly operates on a single vma. Also, update the mmu notification range in zap_page_range_single to take hugetlb pmd sharing into account. This is required as MADV_DONTNEED supports hugetlb vmas.
--- include/linux/mm.h | 27 +++++++++++++++++++-------- mm/madvise.c | 6 +++--- mm/memory.c | 23 +++++++++++------------ 3 files changed, 33 insertions(+), 23 deletions(-)
include/linux/mm.h +19 -8
@@ -1778,6 +1778,23 @@ extern void pagefault_out_of_memory(void);extern void show_free_areas (unsigned int flags,nodemask_t *nodemask); +/* +* Parameter block passed down to zap_pte_range in exceptional cases. +*/ +struct zap_details { +struct folio *single_folio;/* Locked folio to be unmapped */ +bool even_cows;/* Zap COWed private pages too? */ +zap_flags_t zap_flags;/* Extra flags for zapping */ +}; + +/* +* Whether to drop the pte markers, for example, the uffd-wp information for +* file-backed memory. This should only be specified when we will completely +* drop the page in the mm, either by truncation or unmapping of the vma. By +* default, the flag is not set. +*/ +#define ZAP_FLAG_DROP_MARKER ((__force zap_flags_t) BIT(0)) +#ifdef CONFIG_MMU extern bool can_do_mlock (void );#else
@@ -1797,6 +1814,8 @@ void zap_page_range(struct vm_area_struct *vma, unsigned long address, unsigned long size);void unmap_vmas (struct mmu_gather *tlb,struct vm_area_struct *start_vma,unsigned long start,unsigned long end); +void zap_page_range_single (struct vm_area_struct *vma,unsigned long address, +unsigned long size,struct zap_details *details);struct mmu_notifier_range ;
@@ -3386,12 +3405,4 @@ madvise_set_anon_name(struct mm_struct *mm, unsigned long start, }#endif -/* -* Whether to drop the pte markers, for example, the uffd-wp information for -* file-backed memory. This should only be specified when we will completely -* drop the page in the mm, either by truncation or unmapping of the vma. By -* default, the flag is not set. -*/ -#define ZAP_FLAG_DROP_MARKER ((__force zap_flags_t) BIT(0)) -#endif /* _LINUX_MM_H */
mm/madvise.c +3 -3
@@ -770,8 +770,8 @@ static int madvise_free_single_vma(struct vm_area_struct *vma,* Application no longer needs these pages. If the pages are dirty, * it's OK to just throw them away. The app will be more careful about * data it wants to keep. Be sure to free swap resources too. The -* zap_page_range call sets things up for shrink_active_list to actually free -* these pages later if no one else has touched them in the meantime, +* zap_page_range_single call sets things up for shrink_active_list to actually +* free these pages later if no one else has touched them in the meantime, * although we could add these pages to a global reuse list for * shrink_active_list to pick up before reclaiming other pages. *
@@ -788,7 +788,7 @@ static int madvise_free_single_vma(struct vm_area_struct *vma,static long madvise_dontneed_single_vma (struct vm_area_struct *vma,unsigned long start,unsigned long end) { -zap_page_range (vma, start, end - start); +zap_page_range_single (vma, start, end - start,NULL );return 0 ; }
mm/memory.c +11 -12
@@ -1341,15 +1341,6 @@ copy_page_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma)return ret; } -/* -* Parameter block passed down to zap_pte_range in exceptional cases. -*/ -struct zap_details { -struct folio *single_folio;/* Locked folio to be unmapped */ -bool even_cows;/* Zap COWed private pages too? */ -zap_flags_t zap_flags;/* Extra flags for zapping */ -}; -/* Whether we should zap all COWed (private) pages too */ static inline bool should_zap_cows (struct zap_details *details) {
@@ -1769,19 +1760,27 @@ void zap_page_range(struct vm_area_struct *vma, unsigned long start,* * The range must fit into one VMA. */ -static void zap_page_range_single (struct vm_area_struct *vma,unsigned long address, +void zap_page_range_single (struct vm_area_struct *vma,unsigned long address,unsigned long size,struct zap_details *details) { +const unsigned long end = address + size;struct mmu_notifier_range range;struct mmu_gather tlb;lru_add_drain ();mmu_notifier_range_init (&range,MMU_NOTIFY_CLEAR ,0 , vma, vma->vm_mm, - address, address + size); + address, end); +if (is_vm_hugetlb_page (vma)) +adjust_range_if_pmd_sharing_possible (vma, &range.start, + &range.end);tlb_gather_mmu (&tlb, vma->vm_mm);update_hiwater_rss (vma->vm_mm);mmu_notifier_invalidate_range_start (&range); -unmap_single_vma (&tlb, vma, address, range.end, details); +/* +* unmap 'address-end' not 'range.start-range.end' as range +* could have been expanded for hugetlb pmd sharing. +*/ +unmap_single_vma (&tlb, vma, address, end, details);mmu_notifier_invalidate_range_end (&range);tlb_finish_mmu (&tlb); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 2/157 drm/i915: Remove non-existent pipes from bigjoiner pipe mask
In reply to Greg Kroah-HartmanFrom: Ville Syrjälä <[email protected]>
[ Upstream commit 3c1ea6a5f4f55d4e376675dda16945eb5d9bb4de ]
bigjoiner_pipes() doesn't consider that:
- RKL only has three pipes
- some pipes may be fused off
This means that intel_atomic_check_bigjoiner() won't reject all configurations that would need a non-existent pipe. Instead we just keep on rolling witout actually having reserved the slave pipe we need.
It's possible that we don't outright explode anywhere due to this since eg. for_each_intel_crtc_in_pipe_mask() will only walk the crtcs we've registered even though the passed in pipe_mask asks for more of them. But clearly the thing won't do what is expected of it when the required pipes are not present.
Fix the problem by consulting the device info pipe_mask already in bigjoiner_pipes().
--- drivers/gpu/drm/i915/display/intel_display.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +7 -3
@@ -3717,12 +3717,16 @@ static bool ilk_get_pipe_config(struct intel_crtc *crtc,static u8 bigjoiner_pipes (struct drm_i915_private *i915) { +u8 pipes; +if (DISPLAY_VER (i915) >=12 ) -return BIT (PIPE_A ) |BIT (PIPE_B ) |BIT (PIPE_C ) |BIT (PIPE_D ); + pipes =BIT (PIPE_A ) |BIT (PIPE_B ) |BIT (PIPE_C ) |BIT (PIPE_D );else if (DISPLAY_VER (i915) >=11 ) -return BIT (PIPE_B ) |BIT (PIPE_C ); + pipes =BIT (PIPE_B ) |BIT (PIPE_C );else -return 0 ; + pipes =0 ; + +return pipes &INTEL_INFO (i915)->display.pipe_mask; } static bool transcoder_ddi_func_is_enabled(struct drm_i915_private *dev_priv,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 3/157 arm64: dts: rockchip: Fix gmac failure of rgmii-id from rk3566-roc-pc
In reply to Greg Kroah-HartmanFrom: Furkan Kardame <[email protected]>
[ Upstream commit adbab347ec8861aa80d850693df3cd005ec65a99 ]
Lan does not work on rgmii-id, most rk356x devices lan is being switched to rgmii.
--- arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts +1 -1
@@ -130,7 +130,7 @@ assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru SCLK_GMAC1>; assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru SCLK_GMAC1>, <&gmac1_clkin>; clock_in_out = "input"; - phy-mode = "rgmii-id"; + phy-mode = "rgmii"; phy-supply = <&vcc_3v3>; pinctrl-names = "default"; pinctrl-0 = <&gmac1m0_miim
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 4/157 arm64: dts: rockchip: Fix i2c3 pinctrl on rk3566-roc-pc
In reply to Greg Kroah-HartmanFrom: Furkan Kardame <[email protected]>
[ Upstream commit 2440ad0d851e404adcd1b9ad758f28bd59365bae ]
As per device schematic i2c3 pinctrl is connected to m0 instead of m1
--- arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts +1 -1
@@ -397,7 +397,7 @@ &i2c3 { pinctrl-names = "default"; - pinctrl-0 = <&i2c3m1_xfer>; + pinctrl-0 = <&i2c3m0_xfer>; status = "okay"; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 5/157 arm64: dts: rockchip: remove i2c5 from rk3566-roc-pc
In reply to Greg Kroah-HartmanFrom: Furkan Kardame <[email protected]>
[ Upstream commit b44bc59d0d279fa4f3dc11b895f2c8f77719885d ]
i2c5 is owned by hdmi port
--- arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts | 4 ---- 1 file changed, 4 deletions(-)
arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts +0 -4
@@ -401,10 +401,6 @@ status = "okay"; }; -&i2c5 { - status = "okay"; -}; - &mdio1 { rgmii_phy1: ethernet-phy@0 { compatible = "ethernet-phy-ieee802.3-c22";
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 6/157 arm64: dts: rockchip: keep I2S1 disabled for GPIO function on ROCK Pi 4 series
In reply to Greg Kroah-HartmanFrom: FUKAUMI Naoki <[email protected]>
[ Upstream commit 849c19d14940b87332d5d59c7fc581d73f2099fd ]
I2S1 pins are exposed on 40-pin header on Radxa ROCK Pi 4 series. their default function is GPIO, so I2S1 need to be disabled.
--- arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi | 1 - 1 file changed, 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi +0 -1
@@ -491,7 +491,6 @@ &i2s1 { rockchip,playback-channels = <2>; rockchip,capture-channels = <2>; - status = "okay"; }; &i2s2 {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 7/157 arm64: dts: rockchip: fix node name for hym8563 rtc
In reply to Greg Kroah-HartmanFrom: Sebastian Reichel <[email protected]>
[ Upstream commit 67a9aeef44e42b1ac2becf5e61eae0880f48d9db ]
Fix the node name for hym8563 in all arm64 rockchip devicetrees.
--- arch/arm64/boot/dts/rockchip/rk3368-orion-r68-meta.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3368-r88.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3399-roc-pc-plus.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/rockchip/rk3368-orion-r68-meta.dts +1 -1
@@ -208,7 +208,7 @@ vin-supply = <&vcc_sys>; }; - hym8563: hym8563@51 { + hym8563: rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>; #clock-cells = <0>;
arch/arm64/boot/dts/rockchip/rk3368-r88.dts +1 -1
@@ -192,7 +192,7 @@ vin-supply = <&vcc_sys>; }; - hym8563: hym8563@51 { + hym8563: rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>; #clock-cells = <0>;
arch/arm64/boot/dts/rockchip/rk3399-roc-pc-plus.dts +1 -1
@@ -98,7 +98,7 @@ }; &i2c0 { - hym8563: hym8563@51 { + hym8563: rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>; interrupt-parent = <&gpio0>;
arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi +1 -1
@@ -297,7 +297,7 @@ clock-frequency = <400000>; status = "okay"; - hym8563: hym8563@51 { + hym8563: rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>; #clock-cells = <0>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 8/157 arm: dts: rockchip: fix node name for hym8563 rtc
In reply to Greg Kroah-HartmanFrom: Sebastian Reichel <[email protected]>
[ Upstream commit 17b57beafccb4569accbfc8c11390744cf59c021 ]
Fix the node name for hym8563 in all arm rockchip devicetrees.
--- arch/arm/boot/dts/rk3036-evb.dts | 2 +- arch/arm/boot/dts/rk3288-evb-act8846.dts | 2 +- arch/arm/boot/dts/rk3288-firefly.dtsi | 2 +- arch/arm/boot/dts/rk3288-miqi.dts | 2 +- arch/arm/boot/dts/rk3288-rock2-square.dts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/boot/dts/rk3036-evb.dts +1 -1
@@ -31,7 +31,7 @@ &i2c1 { status = "okay"; - hym8563: hym8563@51 { + hym8563: rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>; #clock-cells = <0>;
arch/arm/boot/dts/rk3288-evb-act8846.dts +1 -1
@@ -54,7 +54,7 @@ vin-supply = <&vcc_sys>; }; - hym8563@51 { + rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>;
arch/arm/boot/dts/rk3288-firefly.dtsi +1 -1
@@ -233,7 +233,7 @@ vin-supply = <&vcc_sys>; }; - hym8563: hym8563@51 { + hym8563: rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>; #clock-cells = <0>;
arch/arm/boot/dts/rk3288-miqi.dts +1 -1
@@ -162,7 +162,7 @@ vin-supply = <&vcc_sys>; }; - hym8563: hym8563@51 { + hym8563: rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>; #clock-cells = <0>;
arch/arm/boot/dts/rk3288-rock2-square.dts +1 -1
@@ -165,7 +165,7 @@ }; &i2c0 { - hym8563: hym8563@51 { + hym8563: rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>; #clock-cells = <0>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 9/157 arm: dts: rockchip: remove clock-frequency from rtc
In reply to Greg Kroah-HartmanFrom: Sebastian Reichel <[email protected]>
[ Upstream commit 6122f3be70d90a1b2a1188d8910256fc218376a9 ]
'clock-frequency' is not part of the DT binding and not supported by the Linux driver.
--- arch/arm/boot/dts/rk3036-evb.dts | 1 - arch/arm/boot/dts/rk3288-firefly.dtsi | 1 - arch/arm/boot/dts/rk3288-miqi.dts | 1 - arch/arm/boot/dts/rk3288-rock2-square.dts | 1 - arch/arm/boot/dts/rk3288-vmarc-som.dtsi | 1 - 5 files changed, 5 deletions(-)
arch/arm/boot/dts/rk3036-evb.dts +0 -1
@@ -35,7 +35,6 @@ compatible = "haoyu,hym8563"; reg = <0x51>; #clock-cells = <0>; - clock-frequency = <32768>; clock-output-names = "xin32k"; }; };
arch/arm/boot/dts/rk3288-firefly.dtsi +0 -1
@@ -237,7 +237,6 @@ compatible = "haoyu,hym8563"; reg = <0x51>; #clock-cells = <0>; - clock-frequency = <32768>; clock-output-names = "xin32k"; interrupt-parent = <&gpio7>; interrupts = <RK_PA4 IRQ_TYPE_EDGE_FALLING>;
arch/arm/boot/dts/rk3288-miqi.dts +0 -1
@@ -166,7 +166,6 @@ compatible = "haoyu,hym8563"; reg = <0x51>; #clock-cells = <0>; - clock-frequency = <32768>; clock-output-names = "xin32k"; };
arch/arm/boot/dts/rk3288-rock2-square.dts +0 -1
@@ -169,7 +169,6 @@ compatible = "haoyu,hym8563"; reg = <0x51>; #clock-cells = <0>; - clock-frequency = <32768>; clock-output-names = "xin32k"; interrupt-parent = <&gpio0>; interrupts = <RK_PA4 IRQ_TYPE_EDGE_FALLING>;
arch/arm/boot/dts/rk3288-vmarc-som.dtsi +0 -1
@@ -241,7 +241,6 @@ interrupt-parent = <&gpio5>; interrupts = <RK_PC3 IRQ_TYPE_LEVEL_LOW>; #clock-cells = <0>; - clock-frequency = <32768>; clock-output-names = "hym8563"; pinctrl-names = "default"; pinctrl-0 = <&hym8563_int>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 10/157 ARM: dts: rockchip: fix adc-keys sub node names
In reply to Greg Kroah-HartmanFrom: Johan Jonker <[email protected]>
[ Upstream commit 942b35de22efeb4f9ded83f1ea7747f3fe5a3bb2 ]
Fix adc-keys sub node names on Rockchip boards,
so that they match with regex: '^button-'
--- arch/arm/boot/dts/rk3066a-mk808.dts | 2 +- arch/arm/boot/dts/rk3288-evb.dtsi | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/rk3066a-mk808.dts +1 -1
@@ -32,7 +32,7 @@ keyup-threshold-microvolt = <2500000>; poll-interval = <100>; - recovery { + button-recovery { label = "recovery"; linux,code = <KEY_VENDOR>; press-threshold-microvolt = <0>;
arch/arm/boot/dts/rk3288-evb.dtsi +3 -3
@@ -28,19 +28,19 @@ press-threshold-microvolt = <300000>; }; - menu { + button-menu { label = "Menu"; linux,code = <KEY_MENU>; press-threshold-microvolt = <640000>; }; - esc { + button-esc { label = "Esc"; linux,code = <KEY_ESC>; press-threshold-microvolt = <1000000>; }; - home { + button-home { label = "Home"; linux,code = <KEY_HOME>; press-threshold-microvolt = <1300000>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 11/157 arm64: dts: rockchip: fix adc-keys sub node names
In reply to Greg Kroah-HartmanFrom: Johan Jonker <[email protected]>
[ Upstream commit f2bd2e76d6ea13e12849975adae46145375532a4 ]
Fix adc-keys sub node names on Rockchip boards,
so that they match with regex: '^button-'
--- arch/arm64/boot/dts/rockchip/px30-evb.dts | 10 +++++----- arch/arm64/boot/dts/rockchip/rk3308-evb.dts | 12 ++++++------ arch/arm64/boot/dts/rockchip/rk3318-a95x-z2.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi | 2 +- arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4b.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts | 4 ++-- arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi | 2 +- .../boot/dts/rockchip/rk3399-sapphire-excavator.dts | 4 ++-- arch/arm64/boot/dts/rockchip/rk3566-pinenote.dtsi | 2 +- 10 files changed, 21 insertions(+), 21 deletions(-)
arch/arm64/boot/dts/rockchip/px30-evb.dts +5 -5
@@ -30,31 +30,31 @@ keyup-threshold-microvolt = <1800000>; poll-interval = <100>; - esc-key { + button-esc { label = "esc"; linux,code = <KEY_ESC>; press-threshold-microvolt = <1310000>; }; - home-key { + button-home { label = "home"; linux,code = <KEY_HOME>; press-threshold-microvolt = <624000>; }; - menu-key { + button-menu { label = "menu"; linux,code = <KEY_MENU>; press-threshold-microvolt = <987000>; }; - vol-down-key { + button-down { label = "volume down"; linux,code = <KEY_VOLUMEDOWN>; press-threshold-microvolt = <300000>; }; - vol-up-key { + button-up { label = "volume up"; linux,code = <KEY_VOLUMEUP>; press-threshold-microvolt = <17000>;
arch/arm64/boot/dts/rockchip/rk3308-evb.dts +6 -6
@@ -23,7 +23,7 @@ poll-interval = <100>; keyup-threshold-microvolt = <1800000>; - func-key { + button-func { linux,code = <KEY_FN>; label = "function"; press-threshold-microvolt = <18000>;
@@ -37,31 +37,31 @@ poll-interval = <100>; keyup-threshold-microvolt = <1800000>; - esc-key { + button-esc { linux,code = <KEY_MICMUTE>; label = "micmute"; press-threshold-microvolt = <1130000>; }; - home-key { + button-home { linux,code = <KEY_MODE>; label = "mode"; press-threshold-microvolt = <901000>; }; - menu-key { + button-menu { linux,code = <KEY_PLAY>; label = "play"; press-threshold-microvolt = <624000>; }; - vol-down-key { + button-down { linux,code = <KEY_VOLUMEDOWN>; label = "volume down"; press-threshold-microvolt = <300000>; }; - vol-up-key { + button-up { linux,code = <KEY_VOLUMEUP>; label = "volume up"; press-threshold-microvolt = <18000>;
arch/arm64/boot/dts/rockchip/rk3318-a95x-z2.dts +1 -1
@@ -25,7 +25,7 @@ keyup-threshold-microvolt = <1800000>; poll-interval = <100>; - recovery { + button-recovery { label = "recovery"; linux,code = <KEY_VENDOR>; press-threshold-microvolt = <17000>;
arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi +1 -1
@@ -123,7 +123,7 @@ keyup-threshold-microvolt = <1800000>; poll-interval = <100>; - recovery { + button-recovery { label = "Recovery"; linux,code = <KEY_VENDOR>; press-threshold-microvolt = <18000>;
arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts +1 -1
@@ -39,7 +39,7 @@ keyup-threshold-microvolt = <1800000>; poll-interval = <100>; - recovery { + button-recovery { label = "Recovery"; linux,code = <KEY_VENDOR>; press-threshold-microvolt = <18000>;
arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4b.dts +1 -1
@@ -19,7 +19,7 @@ keyup-threshold-microvolt = <1500000>; poll-interval = <100>; - recovery { + button-recovery { label = "Recovery"; linux,code = <KEY_VENDOR>; press-threshold-microvolt = <18000>;
arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts +2 -2
@@ -52,13 +52,13 @@ press-threshold-microvolt = <300000>; }; - back { + button-back { label = "Back"; linux,code = <KEY_BACK>; press-threshold-microvolt = <985000>; }; - menu { + button-menu { label = "Menu"; linux,code = <KEY_MENU>; press-threshold-microvolt = <1314000>;
arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi +1 -1
@@ -41,7 +41,7 @@ keyup-threshold-microvolt = <1500000>; poll-interval = <100>; - recovery { + button-recovery { label = "Recovery"; linux,code = <KEY_VENDOR>; press-threshold-microvolt = <18000>;
arch/arm64/boot/dts/rockchip/rk3399-sapphire-excavator.dts +2 -2
@@ -33,13 +33,13 @@ press-threshold-microvolt = <300000>; }; - back { + button-back { label = "Back"; linux,code = <KEY_BACK>; press-threshold-microvolt = <985000>; }; - menu { + button-menu { label = "Menu"; linux,code = <KEY_MENU>; press-threshold-microvolt = <1314000>;
arch/arm64/boot/dts/rockchip/rk3566-pinenote.dtsi +1 -1
@@ -23,7 +23,7 @@ io-channel-names = "buttons"; keyup-threshold-microvolt = <1750000>; - recovery { + button-recovery { label = "recovery"; linux,code = <KEY_VENDOR>; press-threshold-microvolt = <0>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 12/157 ARM: dts: rockchip: fix ir-receiver node names
In reply to Greg Kroah-HartmanFrom: Johan Jonker <[email protected]>
[ Upstream commit dd847fe34cdf1e89afed1af24986359f13082bfb ]
Fix ir-receiver node names on Rockchip boards,
so that they match with regex: '^ir(-receiver)?(@[a-f0-9]+)?$'
--- arch/arm/boot/dts/rk3188-radxarock.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/rk3188-radxarock.dts +1 -1
@@ -71,7 +71,7 @@ #sound-dai-cells = <0>; }; - ir_recv: gpio-ir-receiver { + ir_recv: ir-receiver { compatible = "gpio-ir-receiver"; gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>; pinctrl-names = "default";
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 13/157 arm64: dts: rockchip: fix ir-receiver node names
In reply to Greg Kroah-HartmanFrom: Johan Jonker <[email protected]>
[ Upstream commit de0d04b9780a23eb928aedfb6f981285f78d58e5 ]
Fix ir-receiver node names on Rockchip boards,
so that they match with regex: '^ir(-receiver)?(@[a-f0-9]+)?$'
--- arch/arm64/boot/dts/rockchip/rk3308-roc-cc.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3308-roc-cc.dts +1 -1
@@ -19,7 +19,7 @@ stdout-path = "serial2:1500000n8"; }; - ir_rx { + ir-receiver { compatible = "gpio-ir-receiver"; gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_HIGH>; pinctrl-names = "default";
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 14/157 ARM: dts: rockchip: rk3188: fix lcdc1-rgb24 node name
In reply to Greg Kroah-HartmanFrom: Johan Jonker <[email protected]>
[ Upstream commit 11871e20bcb23c00966e785a124fb72bc8340af4 ]
The lcdc1-rgb24 node name is out of line with the rest of the rk3188 lcdc1 node, so fix it.
--- arch/arm/boot/dts/rk3188.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/rk3188.dtsi +1 -1
@@ -379,7 +379,7 @@ rockchip,pins = <2 RK_PD3 1 &pcfg_pull_none>; }; - lcdc1_rgb24: ldcd1-rgb24 { + lcdc1_rgb24: lcdc1-rgb24 { rockchip,pins = <2 RK_PA0 1 &pcfg_pull_none>, <2 RK_PA1 1 &pcfg_pull_none>, <2 RK_PA2 1 &pcfg_pull_none>,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 15/157 fs: use acquire ordering in __fget_light()
In reply to Greg Kroah-HartmanFrom: Jann Horn <[email protected]>
[ Upstream commit 7ee47dcfff1835ff75a794d1075b6b5f5462cfed ]
We must prevent the CPU from reordering the files->count read with the FD table access like this, on architectures where read-read reordering is possible:
files_lookup_fd_raw()
close_fd()
put_files_struct()
atomic_read(&files->count)I would like to mark this for stable, but the stable rules explicitly say "no theoretical races", and given that the FD table pointer and files->count are explicitly stored in the same cacheline, this sort of reordering seems quite unlikely in practice...
--- fs/file.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
fs/file.c +10 -1
@@ -1002,7 +1002,16 @@ static unsigned long __fget_light(unsigned int fd, fmode_t mask)struct files_struct *files = current->files;struct file *file; -if (atomic_read (&files->count) ==1 ) { +/* +* If another thread is concurrently calling close_fd() followed +* by put_files_struct(), we must not observe the old table +* entry combined with the new refcount - otherwise we could +* return a file that is concurrently being freed. +* +* atomic_read_acquire() pairs with atomic_dec_and_test() in +* put_files_struct(). +*/ +if (atomic_read_acquire (&files->count) ==1 ) { file =files_lookup_fd_raw (files, fd);if (!file ||unlikely (file->f_mode & mask))return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 16/157 ARM: 9251/1: perf: Fix stacktraces for tracepoint events in THUMB2 kernels
In reply to Greg Kroah-HartmanFrom: Tomislav Novak <[email protected]>
[ Upstream commit 612695bccfdbd52004551308a55bae410e7cd22f ]
Store the frame address where arm_get_current_stackframe() looks for it (ARM_r7 instead of ARM_fp if CONFIG_THUMB2_KERNEL=y). Otherwise frame->fp gets set to 0, causing unwind_frame() to fail.
# bpftrace -e 't:sched:sched_switch { @[kstack] = count(); exit(); }'
Attaching 1 probe...
@[
__schedule+1059
]: 1A typical first unwind instruction is 0x97 (SP = R7), so after executing it SP ends up being 0 and -URC_FAILURE is returned.
unwind_frame(pc = ac9da7d7 lr = 00000000 sp = c69bdda0 fp = 00000000) unwind_find_idx(ac9da7d7)
unwind_exec_insn: insn = 00000097
unwind_exec_insn: fp = 00000000 sp = 00000000 lr = 00000000 pc = 00000000
With this patch:
# bpftrace -e 't:sched:sched_switch { @[kstack] = count(); exit(); }'
Attaching 1 probe...
@[
__schedule+1059
__schedule+1059
schedule+79
schedule_hrtimeout_range_clock+163
schedule_hrtimeout_range+17
ep_poll+471
SyS_epoll_wait+111
sys_epoll_pwait+231
__ret_fast_syscall+1
]: 1--- arch/arm/include/asm/perf_event.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/perf_event.h +1 -1
@@ -17,7 +17,7 @@ extern unsigned long perf_misc_flags(struct pt_regs *regs);#define perf_arch_fetch_caller_regs (regs, __ip) { \ (regs)->ARM_pc = (__ip); \ - (regs)->ARM_fp = (unsigned long) __builtin_frame_address(0); \ + frame_pointer((regs)) = (unsigned long) __builtin_frame_address(0); \ (regs)->ARM_sp = current_stack_pointer; \ (regs)->ARM_cpsr = SVC_MODE; \ }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 17/157 ARM: 9266/1: mm: fix no-MMU ZERO_PAGE() implementation
In reply to Greg Kroah-HartmanFrom: Giulio Benetti <[email protected]>
[ Upstream commit 340a982825f76f1cff0daa605970fe47321b5ee7 ]
Actually in no-MMU SoCs(i.e. i.MXRT) ZERO_PAGE(vaddr) expands to
```
virt_to_page(0)
```
that in order expands to:
```
pfn_to_page(virt_to_pfn(0))
```
and then virt_to_pfn(0) to:
```
((((unsigned long)(0) - PAGE_OFFSET) >> PAGE_SHIFT) +
PHYS_PFN_OFFSET)
```where PAGE_OFFSET and PHYS_PFN_OFFSET are the DRAM offset(0x80000000) and PAGE_SHIFT is 12. This way we obtain 16MB(0x01000000) summed to the base of DRAM(0x80000000).
When ZERO_PAGE(0) is then used, for example in bio_add_page(), the page gets an address that is out of DRAM bounds.
So instead of using fake virtual page 0 let's allocate a dedicated zero_page during paging_init() and assign it to a global 'struct page * empty_zero_page' the same way mmu.c does and it's the same approach used in m68k with commit dc068f462179 as discussed here[0]. Then let's move ZERO_PAGE() definition to the top of pgtable.h to be in common between mmu.c and nommu.c.
[0]: https://lore.kernel.org/linux-m68k/[email protected]/T/#m1266ceb63ad140743174d6b3070364d3c9a5179b
--- arch/arm/include/asm/pgtable-nommu.h | 6 ------ arch/arm/include/asm/pgtable.h | 16 +++++++++------- arch/arm/mm/nommu.c | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+), 13 deletions(-)
arch/arm/include/asm/pgtable-nommu.h +0 -6
@@ -44,12 +44,6 @@typedef pte_t *pte_addr_t ; -/* -* ZERO_PAGE is a global shared page that is always zero: used -* for zero-mapped memory areas etc.. -*/ -#define ZERO_PAGE (vaddr) (virt_to_page(0)) -/* * Mark the prot value as uncacheable and unbufferable. */
arch/arm/include/asm/pgtable.h +9 -7
@@ -10,6 +10,15 @@#include <linux/const.h> #include <asm/proc-fns.h> +#ifndef __ASSEMBLY__ +/* +* ZERO_PAGE is a global shared page that is always zero: used +* for zero-mapped memory areas etc.. +*/ +extern struct page *empty_zero_page; +#define ZERO_PAGE (vaddr) (empty_zero_page) +#endif +#ifndef CONFIG_MMU #include <asm-generic/pgtable-nopud.h>
@@ -139,13 +148,6 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,*/ #ifndef __ASSEMBLY__ -/* -* ZERO_PAGE is a global shared page that is always zero: used -* for zero-mapped memory areas etc.. -*/ -extern struct page *empty_zero_page; -#define ZERO_PAGE (vaddr) (empty_zero_page) -extern pgd_t swapper_pg_dir[PTRS_PER_PGD ];
arch/arm/mm/nommu.c +19 -0
@@ -26,6 +26,13 @@unsigned long vectors_base; +/* +* empty_zero_page is a special page that is used for +* zero-initialized data and COW. +*/ +struct page *empty_zero_page; +EXPORT_SYMBOL (empty_zero_page); +#ifdef CONFIG_ARM_MPU struct mpu_rgn_info mpu_rgn_info;#endif
@@ -148,9 +155,21 @@ void __init adjust_lowmem_bounds(void)*/ void __init paging_init (const struct machine_desc *mdesc) { +void *zero_page; +early_trap_init ((void *)vectors_base);mpu_setup (); + +/* allocate the zero page. */ + zero_page =memblock_alloc (PAGE_SIZE ,PAGE_SIZE ); +if (!zero_page) +panic ("%s: Failed to allocate %lu bytes align=0x%lx\n" , + __func__,PAGE_SIZE ,PAGE_SIZE ); +bootmem_init (); + + empty_zero_page =virt_to_page (zero_page); +flush_dcache_page (empty_zero_page); }/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 18/157 ASoC: wm8962: Wait for updated value of WM8962_CLOCKING1 register
In reply to Greg Kroah-HartmanFrom: Chancel Liu <[email protected]>
[ Upstream commit 3ca507bf99611c82dafced73e921c1b10ee12869 ]
DSPCLK_DIV field in WM8962_CLOCKING1 register is used to generate correct frequency of LRCLK and BCLK. Sometimes the read-only value can't be updated timely after enabling SYSCLK. This results in wrong calculation values. Delay is introduced here to wait for newest value from register. The time of the delay should be at least 500~1000us according to test.
--- sound/soc/codecs/wm8962.c | 8 ++++++++ 1 file changed, 8 insertions(+)
sound/soc/codecs/wm8962.c +8 -0
@@ -2503,6 +2503,14 @@ static void wm8962_configure_bclk(struct snd_soc_component *component)snd_soc_component_update_bits (component,WM8962_CLOCKING2 ,WM8962_SYSCLK_ENA_MASK ,WM8962_SYSCLK_ENA ); +/* DSPCLK_DIV field in WM8962_CLOCKING1 register is used to generate +* correct frequency of LRCLK and BCLK. Sometimes the read-only value +* can't be updated timely after enabling SYSCLK. This results in wrong +* calculation values. Delay is introduced here to wait for newest +* value from register. The time of the delay should be at least +* 500~1000us according to test. +*/ +usleep_range (500 ,1000 ); dspclk =snd_soc_component_read (component,WM8962_CLOCKING1 );if (snd_soc_component_get_bias_level (component) !=SND_SOC_BIAS_ON )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 19/157 spi: mediatek: Fix DEVAPC Violation at KO Remove
In reply to Greg Kroah-HartmanFrom: Zhichao Liu <[email protected]>
[ Upstream commit 0d10e90cee9eb57882b0f7e19fd699033722e226 ]
A DEVAPC violation occurs when removing the module due to accessing HW registers without base clock. To fix this bug, the correct method is:
1. Call the runtime resume function to enable the clock;
2. Operate the registers to reset the HW;
3. Turn off the clocks and disable the device RPM mechanism.
--- drivers/spi/spi-mt65xx.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/spi/spi-mt65xx.c +7 -1
@@ -1268,8 +1268,11 @@ static int mtk_spi_remove(struct platform_device *pdev) {struct spi_master *master =platform_get_drvdata (pdev);struct mtk_spi *mdata =spi_master_get_devdata (master); +int ret; -pm_runtime_disable (&pdev->dev); + ret =pm_runtime_resume_and_get (&pdev->dev); +if (ret <0 ) +return ret;mtk_spi_reset (mdata);
@@ -1278,6 +1281,9 @@ static int mtk_spi_remove(struct platform_device *pdev)clk_unprepare (mdata->spi_hclk); } +pm_runtime_put_noidle (&pdev->dev); +pm_runtime_disable (&pdev->dev); +return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 20/157 ARM: dts: rockchip: disable arm_global_timer on rk3066 and rk3188
In reply to Greg Kroah-HartmanFrom: Johan Jonker <[email protected]>
[ Upstream commit da74858a475782a3f16470907814c8cc5950ad68 ]
The clock source and the sched_clock provided by the arm_global_timer on Rockchip rk3066a/rk3188 are quite unstable because their rates depend on the CPU frequency.
Recent changes to the arm_global_timer driver makes it impossible to use.
On the other side, the arm_global_timer has a higher rating than the ROCKCHIP_TIMER, it will be selected by default by the time framework while we want to use the stable Rockchip clock source.
Keep the arm_global_timer disabled in order to have the DW_APB_TIMER (rk3066a) or ROCKCHIP_TIMER (rk3188) selected by default.
--- arch/arm/boot/dts/rk3188.dtsi | 1 - arch/arm/boot/dts/rk3xxx.dtsi | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-)
arch/arm/boot/dts/rk3188.dtsi +0 -1
@@ -607,7 +607,6 @@ &global_timer { interrupts = <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; - status = "disabled"; }; &local_timer {
arch/arm/boot/dts/rk3xxx.dtsi +7 -0
@@ -76,6 +76,13 @@ reg = <0x1013c200 0x20>; interrupts = <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_EDGE_RISING)>; clocks = <&cru CORE_PERI>; + status = "disabled"; + /* The clock source and the sched_clock provided by the arm_global_timer + * on Rockchip rk3066a/rk3188 are quite unstable because their rates + * depend on the CPU frequency. + * Keep the arm_global_timer disabled in order to have the + * DW_APB_TIMER (rk3066a) or ROCKCHIP_TIMER (rk3188) selected by default. + */ }; local_timer: local-timer@1013c600 {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 21/157 ASoC: rt711-sdca: fix the latency time of clock stop prepare state machine transitions
In reply to Greg Kroah-HartmanFrom: Shuming Fan <[email protected]>
[ Upstream commit c7d7d4e7bb1290cc473610b0bb96d9fa606d00e7 ]
Due to the hardware behavior, it takes some time for CBJ detection/impedance sensing/de-bounce. The ClockStop_NotFinished flag will be raised until these functions are completed. In ClockStopMode0 mode case, the SdW controller might check this flag from D3 to D0 when the jack detection interrupt happened.
--- sound/soc/codecs/rt711-sdca-sdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/rt711-sdca-sdw.c +1 -1
@@ -230,7 +230,7 @@ static int rt711_sdca_read_prop(struct sdw_slave *slave) }/* set the timeout values */ - prop->clk_stop_timeout =20 ; + prop->clk_stop_timeout =700 ;/* wake-up event */ prop->wake_capable =1 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 22/157 9p/fd: Use P9_HDRSZ for header size
In reply to Greg Kroah-HartmanFrom: GUO Zihua <[email protected]>
[ Upstream commit 6854fadbeee10891ed74246bdc05031906b6c8cf ]
Cleanup hardcoded header sizes to use P9_HDRSZ instead of '7'
[Dominique: commit message adjusted to make sense after offset size adjustment got removed]
--- net/9p/trans_fd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/9p/trans_fd.c +3 -3
@@ -120,7 +120,7 @@ struct p9_conn {struct list_head unsent_req_list;struct p9_req_t *rreq;struct p9_req_t *wreq; -char tmp_buf[7 ]; +char tmp_buf[P9_HDRSZ ];struct p9_fcall rc;int wpos;int wsize;
@@ -293,7 +293,7 @@ static void p9_read_work(struct work_struct *work)if (!m->rc.sdata) { m->rc.sdata = m->tmp_buf; m->rc.offset =0 ; - m->rc.capacity =7 ;/* start by reading header */ + m->rc.capacity =P9_HDRSZ ;/* start by reading header */ }clear_bit (Rpending, &m->wsched);
@@ -316,7 +316,7 @@ static void p9_read_work(struct work_struct *work)p9_debug (P9_DEBUG_TRANS ,"got new header\n" );/* Header size */ - m->rc.size =7 ; + m->rc.size =P9_HDRSZ ; err =p9_parse_header (&m->rc, &m->rc.size,NULL ,NULL ,0 );if (err) { p9_debug(P9_DEBUG_ERROR,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 23/157 regulator: slg51000: Wait after asserting CS pin
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 0b24dfa587c6cc7484cfb170da5c7dd73451f670 ]
Sony's downstream driver [1], among some other changes, adds a seemingly random 10ms usleep_range, which turned out to be necessary for the hardware to function properly on at least Sony Xperia 1 IV. Without this, I2C transactions with the SLG51000 straight up fail.
Relax (10-10ms -> 10-11ms) and add the aforementioned sleep to make sure the hardware has some time to wake up.
(nagara-2.0.0-mlc/vendor/semc/hardware/camera-kernel-module/)
[1] https://developer.sony.com/file/download/open-source-archive-for-64-0-m-4-29/
--- drivers/regulator/slg51000-regulator.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/regulator/slg51000-regulator.c +2 -0
@@ -457,6 +457,8 @@ static int slg51000_i2c_probe(struct i2c_client *client) chip->cs_gpiod = cs_gpiod; } +usleep_range (10000 ,11000 ); +i2c_set_clientdata (client, chip); chip->chip_irq = client->irq; chip->dev = dev;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 24/157 ALSA: seq: Fix function prototype mismatch in snd_seq_expand_var_event
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 05530ef7cf7c7d700f6753f058999b1b5099a026 ]
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed.
seq_copy_in_user() and seq_copy_in_kernel() did not have prototypes matching snd_seq_dump_func_t. Adjust this and remove the casts. There are not resulting binary output differences.
This was found as a result of Clang's new -Wcast-function-type-strict flag, which is more sensitive than the simpler -Wcast-function-type, which only checks for type width mismatches.
--- sound/core/seq/seq_memory.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
sound/core/seq/seq_memory.c +7 -4
@@ -113,15 +113,19 @@ EXPORT_SYMBOL(snd_seq_dump_var_event);* expand the variable length event to linear buffer space. */ -static int seq_copy_in_kernel (char **bufptr,const void *src,int size) +static int seq_copy_in_kernel (void *ptr,void *src,int size) { +char **bufptr = ptr; +memcpy (*bufptr, src, size); *bufptr += size;return 0 ; } -static int seq_copy_in_user (char __user **bufptr,const void *src,int size) +static int seq_copy_in_user (void *ptr,void *src,int size) { +char __user **bufptr = ptr; +if (copy_to_user (*bufptr, src, size))return -EFAULT ; *bufptr += size;
@@ -151,8 +155,7 @@ int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, charreturn newlen; } err =snd_seq_dump_var_event (event, - in_kernel ? (snd_seq_dump_func_t )seq_copy_in_kernel : - (snd_seq_dump_func_t )seq_copy_in_user, + in_kernel ? seq_copy_in_kernel : seq_copy_in_user, &buf);return err <0 ? err : newlen; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 25/157 LoongArch: Makefile: Use "grep -E" instead of "egrep"
In reply to Greg Kroah-HartmanFrom: Tiezhu Yang <[email protected]>
[ Upstream commit 83f638bca0ccd94942bc3c4eb9bcec24dd8a1cf9 ]
The latest version of grep claims the egrep is now obsolete so the build now contains warnings that look like:
egrep: warning: egrep is obsolescent; using grep -E
Fix this up by changing the LoongArch Makefile to use "grep -E" instead.
--- arch/loongarch/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/Makefile +1 -1
@@ -68,7 +68,7 @@ KBUILD_LDFLAGS += -m $(ld-emul) ifdef CONFIG_LOONGARCH CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ - egrep -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \ + grep -E -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \ sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g') endif
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 26/157 LoongArch: Combine acpi_boot_table_init() and acpi_boot_init()
In reply to Greg Kroah-HartmanFrom: Huacai Chen <[email protected]>
[ Upstream commit 538eafc6deae12fbac5f277b89aa139b812bca49 ]
Combine acpi_boot_table_init() and acpi_boot_init() since they are very simple, and we don't need to check the return value of acpi_boot_init().
--- arch/loongarch/kernel/acpi.c | 31 ++++++++++--------------------- arch/loongarch/kernel/setup.c | 1 - 2 files changed, 10 insertions(+), 22 deletions(-)
arch/loongarch/kernel/acpi.c +10 -21
@@ -56,23 +56,6 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)return ioremap_cache (phys, size); } -void __init acpi_boot_table_init (void ) -{ -/* -* If acpi_disabled, bail out -*/ -if (acpi_disabled) -return ; - -/* -* Initialize the ACPI boot-time table parser. -*/ -if (acpi_table_init ()) { -disable_acpi (); -return ; - } -} -#ifdef CONFIG_SMP static int set_processor_mask (u32 id,u32 flags) {
@@ -156,13 +139,21 @@ static void __init acpi_process_madt(void) loongson_sysconf.nr_cpus = num_processors; } -int __init acpi_boot_init (void ) +void __init acpi_boot_table_init (void ) {/* * If acpi_disabled, bail out */ if (acpi_disabled) -return -1 ; +return ; + +/* +* Initialize the ACPI boot-time table parser. +*/ +if (acpi_table_init ()) { +disable_acpi (); +return ; + } loongson_sysconf.boot_cpu_id =read_csr_cpuid ();
@@ -173,8 +164,6 @@ int __init acpi_boot_init(void)/* Do not enable ACPI SPCR console by default */ acpi_parse_spcr (earlycon_acpi_spcr_enable, false); - -return 0 ; }#ifdef CONFIG_ACPI_NUMA
arch/loongarch/kernel/setup.c +0 -1
@@ -203,7 +203,6 @@ void __init platform_init(void)#ifdef CONFIG_ACPI acpi_gbl_use_default_register_widths = false;acpi_boot_table_init (); -acpi_boot_init ();#endif #ifdef CONFIG_NUMA
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 27/157 LoongArch: Set _PAGE_DIRTY only if _PAGE_MODIFIED is set in {pmd,pte}_mkwrite()
In reply to Greg Kroah-HartmanFrom: Huacai Chen <[email protected]>
[ Upstream commit 54e6cd42a183b602e3627ad3aaeeed44f7443e67 ]
Set _PAGE_DIRTY only if _PAGE_MODIFIED is set in {pmd,pte}_mkwrite(). Otherwise, _PAGE_DIRTY silences the TLB modify exception and make us have no chance to mark a pmd/pte dirty (_PAGE_MODIFIED) for software.
--- arch/loongarch/include/asm/pgtable.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/loongarch/include/asm/pgtable.h +6 -2
@@ -357,7 +357,9 @@ static inline pte_t pte_mkdirty(pte_t pte)static inline pte_t pte_mkwrite (pte_t pte) { -pte_val (pte) |= (_PAGE_WRITE | _PAGE_DIRTY); +pte_val (pte) |= _PAGE_WRITE; +if (pte_val (pte) & _PAGE_MODIFIED) +pte_val (pte) |= _PAGE_DIRTY;return pte; }
@@ -454,7 +456,9 @@ static inline int pmd_write(pmd_t pmd)static inline pmd_t pmd_mkwrite (pmd_t pmd) { -pmd_val (pmd) |= (_PAGE_WRITE | _PAGE_DIRTY); +pmd_val (pmd) |= _PAGE_WRITE; +if (pmd_val (pmd) & _PAGE_MODIFIED) +pmd_val (pmd) |= _PAGE_DIRTY;return pmd; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 28/157 LoongArch: Fix unsigned comparison with less than zero
In reply to Greg Kroah-HartmanFrom: KaiLong Wang <[email protected]>
[ Upstream commit b96e74bb439f096168c78ba3ba1599e0b85cfd73 ]
Eliminate the following coccicheck warning:
./arch/loongarch/kernel/unwind_prologue.c:84:5-13: WARNING: Unsigned expression compared with zero: frame_ra < 0
--- arch/loongarch/kernel/unwind_prologue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/loongarch/kernel/unwind_prologue.c +2 -1
@@ -43,7 +43,8 @@ static bool unwind_by_prologue(struct unwind_state *state) {struct stack_info *info = &state->stack_info;union loongarch_instruction *ip, *ip_end; -unsigned long frame_size =0 , frame_ra =-1 ; +long frame_ra =-1 ; +unsigned long frame_size =0 ;unsigned long size, offset, pc = state->pc;if (state->sp >= info->end || state->sp < info->begin)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 29/157 selftests/net: Find nettest in current directory
In reply to Greg Kroah-HartmanFrom: Daniel Díaz <[email protected]>
[ Upstream commit bd5e1e42826f18147afb0ba07e6a815f52cf8bcb ]
The nettest binary, built from selftests/net/nettest.c, was expected to be found in the path during test execution of fcnal-test.sh and pmtu.sh, leading to tests getting skipped when the binary is not installed in the system, as can be seen in these logs found in the wild [1]:
# TEST: vti4: PMTU exceptions [SKIP]
[ 350.600250] IPv6: ADDRCONF(NETDEV_CHANGE): veth_b: link becomes ready [ 350.607421] IPv6: ADDRCONF(NETDEV_CHANGE): veth_a: link becomes ready # 'nettest' command not found; skipping tests # xfrm6udp not supported # TEST: vti6: PMTU exceptions (ESP-in-UDP) [SKIP] [ 351.605102] IPv6: ADDRCONF(NETDEV_CHANGE): veth_b: link becomes ready [ 351.612243] IPv6: ADDRCONF(NETDEV_CHANGE): veth_a: link becomes ready # 'nettest' command not found; skipping tests # xfrm4udp not supported
The unicast_extensions.sh tests also rely on nettest, but it runs fine there because it looks for the binary in the current working directory [2]:
The same mechanism that works for the Unicast extensions tests is here copied over to the PMTU and functional tests.
[1] https://lkft.validation.linaro.org/scheduler/job/5839508#L6221
[2] https://lkft.validation.linaro.org/scheduler/job/5839508#L7958
--- tools/testing/selftests/net/fcnal-test.sh | 11 +++++++---- tools/testing/selftests/net/pmtu.sh | 10 ++++++---- 2 files changed, 13 insertions(+), 8 deletions(-)
tools/testing/selftests/net/fcnal-test.sh +7 -4
@@ -4196,10 +4196,13 @@ elif [ "$TESTS" = "ipv6" ]; then TESTS="$TESTS_IPV6" fi -which nettest >/dev/null -if [ $? -ne 0 ]; then - echo "'nettest' command not found; skipping tests" - exit $ksft_skip +# nettest can be run from PATH or from same directory as this selftest +if ! which nettest >/dev/null; then + PATH=$PWD:$PATH + if ! which nettest >/dev/null; then + echo "'nettest' command not found; skipping tests" + exit $ksft_skip + fi fi declare -i nfail=0
tools/testing/selftests/net/pmtu.sh +6 -4
@@ -686,10 +686,12 @@ setup_xfrm() { } setup_nettest_xfrm() { - which nettest >/dev/null - if [ $? -ne 0 ]; then - echo "'nettest' command not found; skipping tests" - return 1 + if ! which nettest >/dev/null; then + PATH=$PWD:$PATH + if ! which nettest >/dev/null; then + echo "'nettest' command not found; skipping tests" + return 1 + fi fi [ ${1} -eq 6 ] && proto="-6" || proto=""
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 30/157 btrfs: send: avoid unaligned encoded writes when attempting to clone range
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
[ Upstream commit a11452a3709e217492798cf3686ac2cc8eb3fb51 ]
When trying to see if we can clone a file range, there are cases where we end up sending two write operations in case the inode from the source root has an i_size that is not sector size aligned and the length from the current offset to its i_size is less than the remaining length we are trying to clone.
Issuing two write operations when we could instead issue a single write operation is not incorrect. However it is not optimal, specially if the extents are compressed and the flag BTRFS_SEND_FLAG_COMPRESSED was passed to the send ioctl. In that case we can end up sending an encoded write with an offset that is not sector size aligned, which makes the receiver fallback to decompressing the data and writing it using regular buffered IO (so re-compressing the data in case the fs is mounted with compression enabled), because encoded writes fail with -EINVAL when an offset is not sector size aligned.
The following example, which triggered a bug in the receiver code for the fallback logic of decompressing + regular buffer IO and is fixed by the patchset referred in a Link at the bottom of this changelog, is an example where we have the non-optimal behaviour due to an unaligned encoded write:
$ cat test.sh #!/bin/bash
DEV=/dev/sdj
MNT=/mnt/sdj
mkfs.btrfs -f $DEV > /dev/null
mount -o compress $DEV $MNT
# File foo has a size of 33K, not aligned to the sector size. xfs_io -f -c "pwrite -S 0xab 0 33K" $MNT/foo
xfs_io -f -c "pwrite -S 0xcd 0 64K" $MNT/bar
# Now clone the first 32K of file bar into foo at offset 0. xfs_io -c "reflink $MNT/bar 0 0 32K" $MNT/foo
# Snapshot the default subvolume and create a full send stream (v2). btrfs subvolume snapshot -r $MNT $MNT/snap
btrfs send --compressed-data -f /tmp/test.send $MNT/snap
echo -e "\nFile bar in the original filesystem:" od -A d -t x1 $MNT/snap/bar
umount $MNT
mkfs.btrfs -f $DEV > /dev/null
mount $DEV $MNT
echo -e "\nReceiving stream in a new filesystem..." btrfs receive -f /tmp/test.send $MNT
echo -e "\nFile bar in the new filesystem:"
od -A d -t x1 $MNT/snap/bar
umount $MNT
Before this patch, the send stream included one regular write and one encoded write for file 'bar', with the later being not sector size aligned and causing the receiver to fallback to decompression + buffered writes. The output of the btrfs receive command in verbose mode (-vvv):
(...)
mkfile o258-7-0
rename o258-7-0 -> bar
utimes
clone bar - source=foo source offset=0 offset=0 length=32768
write bar - offset=32768 length=1024
encoded_write bar - offset=33792, len=4096, unencoded_offset=33792, unencoded_file_len=31744, unencoded_len=65536, compression=1, encryption=0 encoded_write bar - falling back to decompress and write due to errno 22 ("Invalid argument")
(...)
This patch avoids the regular write followed by an unaligned encoded write so that we end up sending a single encoded write that is aligned. So after this patch the stream content is (output of btrfs receive -vvv):
(...)
mkfile o258-7-0
rename o258-7-0 -> bar
utimes
clone bar - source=foo source offset=0 offset=0 length=32768
encoded_write bar - offset=32768, len=4096, unencoded_offset=32768, unencoded_file_len=32768, unencoded_len=65536, compression=1, encryption=0 (...)
So we get more optimal behaviour and avoid the silent data loss bug in versions of btrfs-progs affected by the bug referred by the Link tag below (btrfs-progs v5.19, v5.19.1, v6.0 and v6.0.1).
--- fs/btrfs/send.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
fs/btrfs/send.c +23 -1
@@ -5615,6 +5615,7 @@ static int clone_range(struct send_ctx *sctx, struct btrfs_path *dst_path,u64 ext_len;u64 clone_len;u64 clone_data_offset; +bool crossed_src_i_size = false;if (slot >=btrfs_header_nritems (leaf)) { ret =btrfs_next_leaf (clone_root->root, path);
@@ -5672,8 +5673,10 @@ static int clone_range(struct send_ctx *sctx, struct btrfs_path *dst_path,if (key.offset >= clone_src_i_size)break ; -if (key.offset + ext_len > clone_src_i_size) +if (key.offset + ext_len > clone_src_i_size) { ext_len = clone_src_i_size - key.offset; + crossed_src_i_size = true; + } clone_data_offset =btrfs_file_extent_offset (leaf, ei);if (btrfs_file_extent_disk_bytenr (leaf, ei) == disk_byte) {
@@ -5734,6 +5737,25 @@ static int clone_range(struct send_ctx *sctx, struct btrfs_path *dst_path, ret =send_clone (sctx, offset, clone_len, clone_root); } + }else if (crossed_src_i_size && clone_len < len) { +/* +* If we are at i_size of the clone source inode and we +* can not clone from it, terminate the loop. This is +* to avoid sending two write operations, one with a +* length matching clone_len and the final one after +* this loop with a length of len - clone_len. +* +* When using encoded writes (BTRFS_SEND_FLAG_COMPRESSED +* was passed to the send ioctl), this helps avoid +* sending an encoded write for an offset that is not +* sector size aligned, in case the i_size of the source +* inode is not sector size aligned. That will make the +* receiver fallback to decompression of the data and +* writing it using regular buffered IO, therefore while +* not incorrect, it's not optimal due decompression and +* possible re-compression at the receiver. +*/ +break ; }else { ret =send_extent_data (sctx, dst_path, offset, clone_len);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 31/157 net/mlx5: Lag, avoid lockdep warnings
In reply to Greg Kroah-HartmanFrom: Eli Cohen <[email protected]>
[ Upstream commit 0d4e8ed139d871fcb2844dd71075997753baeec8 ]
ldev->lock is used to serialize lag change operations. Since multiport eswtich functionality was added, we now change the mode dynamically. However, acquiring ldev->lock is not allowed as it could possibly lead to a deadlock as reported by the lockdep mechanism.
[ 836.154963] WARNING: possible circular locking dependency detected
[ 836.155850] 5.19.0-rc5_net_56b7df2 #1 Not tainted
[ 836.156549] ------------------------------------------------------
[ 836.157418] handler1/12198 is trying to acquire lock:
[ 836.158178] ffff888187d52b58 (&ldev->lock){+.+.}-{3:3}, at: mlx5_lag_do_mirred+0x3b/0x70 [mlx5_core]
[ 836.159575]
[ 836.159575] but task is already holding lock:
[ 836.160474] ffff8881d4de2930 (&block->cb_lock){++++}-{3:3}, at: tc_setup_cb_add+0x5b/0x200
[ 836.161669] which lock already depends on the new lock.
[ 836.162905]
[ 836.162905] the existing dependency chain (in reverse order) is:
[ 836.164008] -> #3 (&block->cb_lock){++++}-{3:3}:
[ 836.164946] down_write+0x25/0x60
[ 836.165548] tcf_block_get_ext+0x1c6/0x5d0
[ 836.166253] ingress_init+0x74/0xa0 [sch_ingress]
[ 836.167028] qdisc_create.constprop.0+0x130/0x5e0
[ 836.167805] tc_modify_qdisc+0x481/0x9f0
[ 836.168490] rtnetlink_rcv_msg+0x16e/0x5a0
[ 836.169189] netlink_rcv_skb+0x4e/0xf0
[ 836.169861] netlink_unicast+0x190/0x250
[ 836.170543] netlink_sendmsg+0x243/0x4b0
[ 836.171226] sock_sendmsg+0x33/0x40
[ 836.171860] ____sys_sendmsg+0x1d1/0x1f0
[ 836.172535] ___sys_sendmsg+0xab/0xf0
[ 836.173183] __sys_sendmsg+0x51/0x90
[ 836.173836] do_syscall_64+0x3d/0x90
[ 836.174471] entry_SYSCALL_64_after_hwframe+0x46/0xb0
[ 836.175282][ 836.175282] -> #2 (rtnl_mutex){+.+.}-{3:3}:
[ 836.176190] __mutex_lock+0x6b/0xf80
[ 836.176830] register_netdevice_notifier+0x21/0x120
[ 836.177631] rtnetlink_init+0x2d/0x1e9
[ 836.178289] netlink_proto_init+0x163/0x179
[ 836.178994] do_one_initcall+0x63/0x300
[ 836.179672] kernel_init_freeable+0x2cb/0x31b
[ 836.180403] kernel_init+0x17/0x140
[ 836.181035] ret_from_fork+0x1f/0x30 [ 836.181687] -> #1 (pernet_ops_rwsem){+.+.}-{3:3}:
[ 836.182628] down_write+0x25/0x60
[ 836.183235] unregister_netdevice_notifier+0x1c/0xb0
[ 836.184029] mlx5_ib_roce_cleanup+0x94/0x120 [mlx5_ib]
[ 836.184855] __mlx5_ib_remove+0x35/0x60 [mlx5_ib]
[ 836.185637] mlx5_eswitch_unregister_vport_reps+0x22f/0x440 [mlx5_core]
[ 836.186698] auxiliary_bus_remove+0x18/0x30
[ 836.187409] device_release_driver_internal+0x1f6/0x270
[ 836.188253] bus_remove_device+0xef/0x160
[ 836.188939] device_del+0x18b/0x3f0
[ 836.189562] mlx5_rescan_drivers_locked+0xd6/0x2d0 [mlx5_core]
[ 836.190516] mlx5_lag_remove_devices+0x69/0xe0 [mlx5_core]
[ 836.191414] mlx5_do_bond_work+0x441/0x620 [mlx5_core]
[ 836.192278] process_one_work+0x25c/0x590
[ 836.192963] worker_thread+0x4f/0x3d0
[ 836.193609] kthread+0xcb/0xf0
[ 836.194189] ret_from_fork+0x1f/0x30[ 836.194826] -> #0 (&ldev->lock){+.+.}-{3:3}:
[ 836.195734] __lock_acquire+0x15b8/0x2a10
[ 836.196426] lock_acquire+0xce/0x2d0
[ 836.197057] __mutex_lock+0x6b/0xf80
[ 836.197708] mlx5_lag_do_mirred+0x3b/0x70 [mlx5_core]
[ 836.198575] tc_act_parse_mirred+0x25b/0x800 [mlx5_core]
[ 836.199467] parse_tc_actions+0x168/0x5a0 [mlx5_core]
[ 836.200340] __mlx5e_add_fdb_flow+0x263/0x480 [mlx5_core]
[ 836.201241] mlx5e_configure_flower+0x8a0/0x1820 [mlx5_core]
[ 836.202187] tc_setup_cb_add+0xd7/0x200
[ 836.202856] fl_hw_replace_filter+0x14c/0x1f0 [cls_flower]
[ 836.203739] fl_change+0xbbe/0x1730 [cls_flower]
[ 836.204501] tc_new_tfilter+0x407/0xd90
[ 836.205168] rtnetlink_rcv_msg+0x406/0x5a0
[ 836.205877] netlink_rcv_skb+0x4e/0xf0
[ 836.206535] netlink_unicast+0x190/0x250
[ 836.207217] netlink_sendmsg+0x243/0x4b0
[ 836.207915] sock_sendmsg+0x33/0x40
[ 836.208538] ____sys_sendmsg+0x1d1/0x1f0
[ 836.209219] ___sys_sendmsg+0xab/0xf0
[ 836.209878] __sys_sendmsg+0x51/0x90
[ 836.210510] do_syscall_64+0x3d/0x90
[ 836.211137] entry_SYSCALL_64_after_hwframe+0x46/0xb0[ 836.211954] other info that might help us debug this:
[ 836.213174] Chain exists of:
[ 836.213174] &ldev->lock --> rtnl_mutex --> &block->cb_lock
836.214650] Possible unsafe locking scenario:
[ 836.214650]
[ 836.215574] CPU0 CPU1
[ 836.216255] ---- ----
[ 836.216943] lock(&block->cb_lock);
[ 836.217518] lock(rtnl_mutex);
[ 836.218348] lock(&block->cb_lock);
[ 836.219212] lock(&ldev->lock);
[ 836.219758]
[ 836.219758] *** DEADLOCK ***
[ 836.219758]
[ 836.220747] 2 locks held by handler1/12198:
[ 836.221390] #0: ffff8881d4de2930 (&block->cb_lock){++++}-{3:3}, at: tc_setup_cb_add+0x5b/0x200
[ 836.222646] #1: ffff88810c9a92c0 (&esw->mode_lock){++++}-{3:3}, at: mlx5_esw_hold+0x39/0x50 [mlx5_core][ 836.224063] stack backtrace: [ 836.224799] CPU: 6 PID: 12198 Comm: handler1 Not tainted 5.19.0-rc5_net_56b7df2 #1 [ 836.225923] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 [ 836.227476] Call Trace: [ 836.227929] <TASK> [ 836.228332] dump_stack_lvl+0x57/0x7d [ 836.228924] check_noncircular+0x104/0x120 [ 836.229562] __lock_acquire+0x15b8/0x2a10 [ 836.230201] lock_acquire+0xce/0x2d0 [ 836.230776] ? mlx5_lag_do_mirred+0x3b/0x70 [mlx5_core] [ 836.231614] ? find_held_lock+0x2b/0x80 [ 836.232221] __mutex_lock+0x6b/0xf80 [ 836.232799] ? mlx5_lag_do_mirred+0x3b/0x70 [mlx5_core] [ 836.233636] ? mlx5_lag_do_mirred+0x3b/0x70 [mlx5_core] [ 836.234451] ? xa_load+0xc3/0x190 [ 836.234995] mlx5_lag_do_mirred+0x3b/0x70 [mlx5_core] [ 836.235803] tc_act_parse_mirred+0x25b/0x800 [mlx5_core] [ 836.236636] ? tc_act_can_offload_mirred+0x135/0x210 [mlx5_core] [ 836.237550] parse_tc_actions+0x168/0x5a0 [mlx5_core] [ 836.238364] __mlx5e_add_fdb_flow+0x263/0x480 [mlx5_core] [ 836.239202] mlx5e_configure_flower+0x8a0/0x1820 [mlx5_core] [ 836.240076] ? lock_acquire+0xce/0x2d0 [ 836.240668] ? tc_setup_cb_add+0x5b/0x200 [ 836.241294] tc_setup_cb_add+0xd7/0x200 [ 836.241917] fl_hw_replace_filter+0x14c/0x1f0 [cls_flower] [ 836.242709] fl_change+0xbbe/0x1730 [cls_flower] [ 836.243408] tc_new_tfilter+0x407/0xd90 [ 836.244043] ? tc_del_tfilter+0x880/0x880 [ 836.244672] rtnetlink_rcv_msg+0x406/0x5a0 [ 836.245310] ? netlink_deliver_tap+0x7a/0x4b0 [ 836.245991] ? if_nlmsg_stats_size+0x2b0/0x2b0 [ 836.246675] netlink_rcv_skb+0x4e/0xf0 [ 836.258046] netlink_unicast+0x190/0x250 [ 836.258669] netlink_sendmsg+0x243/0x4b0 [ 836.259288] sock_sendmsg+0x33/0x40 [ 836.259857] ____sys_sendmsg+0x1d1/0x1f0 [ 836.260473] ___sys_sendmsg+0xab/0xf0 [ 836.261064] ? lock_acquire+0xce/0x2d0 [ 836.261669] ? find_held_lock+0x2b/0x80 [ 836.262272] ? __fget_files+0xb9/0x190 [ 836.262871] ? __fget_files+0xd3/0x190 [ 836.263462] __sys_sendmsg+0x51/0x90 [ 836.264064] do_syscall_64+0x3d/0x90 [ 836.264652] entry_SYSCALL_64_after_hwframe+0x46/0xb0 [ 836.265425] RIP: 0033:0x7fdbe5e2677d
[ 836.266012] Code: 28 89 54 24 1c 48 89 74 24 10 89 7c 24 08 e8 ba ee ff ff 8b 54 24 1c 48 8b 74 24 10 41 89 c0 8b 7c 24 08 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 33 44 89 c7 48 89 44 24 08 e8 ee ee ff ff 48 [ 836.268485] RSP: 002b:00007fdbe48a75a0 EFLAGS: 00000293 ORIG_RAX: 000000000000002e [ 836.269598] RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007fdbe5e2677d [ 836.270576] RDX: 0000000000000000 RSI: 00007fdbe48a7640 RDI: 000000000000003c [ 836.271565] RBP: 00007fdbe48a8368 R08: 0000000000000000 R09: 0000000000000000 [ 836.272546] R10: 00007fdbe48a84b0 R11: 0000000000000293 R12: 0000557bd17dc860 [ 836.273527] R13: 0000000000000000 R14: 0000557bd17dc860 R15: 00007fdbe48a7640
[ 836.274521] </TASK>
To avoid using mode holding ldev->lock in the configure flow, we queue a work to the lag workqueue and cease wait on a completion object.
In addition, we remove the lock from mlx5_lag_do_mirred() since it is not really protecting anything.
It should be noted that an actual deadlock has not been observed.
--- .../net/ethernet/mellanox/mlx5/core/lag/lag.c | 3 +- .../net/ethernet/mellanox/mlx5/core/lag/lag.h | 14 ++- .../ethernet/mellanox/mlx5/core/lag/mpesw.c | 100 +++++++++++------- .../ethernet/mellanox/mlx5/core/lag/mpesw.h | 1 - 4 files changed, 78 insertions(+), 40 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +1 -2
@@ -201,9 +201,8 @@ static void mlx5_ldev_free(struct kref *ref)if (ldev->nb.notifier_call)unregister_netdevice_notifier_net (&init_net, &ldev->nb);mlx5_lag_mp_cleanup (ldev); -mlx5_lag_mpesw_cleanup (ldev); -cancel_work_sync (&ldev->mpesw_work);destroy_workqueue (ldev->wq); +mlx5_lag_mpesw_cleanup (ldev);mutex_destroy (&ldev->lock);kfree (ldev); }
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.h +13 -1
@@ -50,6 +50,19 @@ struct lag_tracker {enum netdev_lag_hash hash_type; }; +enum mpesw_op { +MLX5_MPESW_OP_ENABLE , +MLX5_MPESW_OP_DISABLE , +}; + +struct mlx5_mpesw_work_st { +struct work_struct work; +struct mlx5_lag *lag; +enum mpesw_op op; +struct completion comp; +int result; +}; +/* LAG data of a ConnectX card. * It serves both its phys functions. */
@@ -66,7 +79,6 @@ struct mlx5_lag {struct lag_tracker tracker;struct workqueue_struct *wq;struct delayed_work bond_work; -struct work_struct mpesw_work;struct notifier_block nb;struct lag_mp lag_mp;struct mlx5_lag_port_sel port_sel;
drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c +64 -36
150 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.h +0 -1
@@ -12,7 +12,6 @@ struct lag_mpesw {atomic_t mpesw_rule_count; }; -void mlx5_mpesw_work (struct work_struct *work);int mlx5_lag_do_mirred (struct mlx5_core_dev *mdev,struct net_device *out_dev);bool mlx5_lag_mpesw_is_activated (struct mlx5_core_dev *dev);#if IS_ENABLED (CONFIG_MLX5_ESWITCH )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 32/157 ASoC: soc-pcm: Add NULL check in BE reparenting
In reply to Greg Kroah-HartmanFrom: Srinivasa Rao Mandadapu <[email protected]>
[ Upstream commit db8f91d424fe0ea6db337aca8bc05908bbce1498 ]
Add NULL check in dpcm_be_reparent API, to handle kernel NULL pointer dereference error. The issue occurred in fuzzing test.
--- sound/soc/soc-pcm.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/soc-pcm.c +2 -0
@@ -1242,6 +1242,8 @@ static void dpcm_be_reparent(struct snd_soc_pcm_runtime *fe,return ; be_substream =snd_soc_dpcm_get_substream (be, stream); +if (!be_substream) +return ;for_each_dpcm_fe (be, stream, dpcm) {if (dpcm->fe == fe)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 33/157 regulator: twl6030: fix get status of twl6032 regulators
In reply to Greg Kroah-HartmanFrom: Andreas Kemnade <[email protected]>
[ Upstream commit 31a6297b89aabc81b274c093a308a7f5b55081a7 ]
Status is reported as always off in the 6032 case. Status reporting now matches the logic in the setters. Once of the differences to the 6030 is that there are no groups, therefore the state needs to be read out in the lower bits.
--- drivers/regulator/twl6030-regulator.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/regulator/twl6030-regulator.c +11 -4
@@ -67,6 +67,7 @@ struct twlreg_info {#define TWL6030_CFG_STATE_SLEEP 0x03#define TWL6030_CFG_STATE_GRP_SHIFT 5#define TWL6030_CFG_STATE_APP_SHIFT 2 +#define TWL6030_CFG_STATE_MASK 0x03#define TWL6030_CFG_STATE_APP_MASK (0x03 << TWL6030_CFG_STATE_APP_SHIFT)#define TWL6030_CFG_STATE_APP (v) (((v) & TWL6030_CFG_STATE_APP_MASK) >>\ TWL6030_CFG_STATE_APP_SHIFT)
@@ -128,13 +129,14 @@ static int twl6030reg_is_enabled(struct regulator_dev *rdev)if (grp <0 )return grp; grp &=P1_GRP_6030 ; + val =twlreg_read (info,TWL_MODULE_PM_RECEIVER ,VREG_STATE ); + val =TWL6030_CFG_STATE_APP (val); }else { + val =twlreg_read (info,TWL_MODULE_PM_RECEIVER ,VREG_STATE ); + val &=TWL6030_CFG_STATE_MASK ; grp =1 ; } - val =twlreg_read (info,TWL_MODULE_PM_RECEIVER ,VREG_STATE ); - val =TWL6030_CFG_STATE_APP (val); -return grp && (val ==TWL6030_CFG_STATE_ON ); }
@@ -187,7 +189,12 @@ static int twl6030reg_get_status(struct regulator_dev *rdev) val =twlreg_read (info,TWL_MODULE_PM_RECEIVER ,VREG_STATE ); -switch (TWL6030_CFG_STATE_APP (val)) { +if (info->features &TWL6032_SUBCLASS ) + val &=TWL6030_CFG_STATE_MASK ; +else + val =TWL6030_CFG_STATE_APP (val); + +switch (val) {case TWL6030_CFG_STATE_ON :return REGULATOR_STATUS_NORMAL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 34/157 fbcon: Use kzalloc() in fbcon_prepare_logo()
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit a6a00d7e8ffd78d1cdb7a43f1278f081038c638f ]
A kernel built with syzbot's config file reported that
scr_memcpyw(q, save, array3_size(logo_lines, new_cols, 2))
causes uninitialized "save" to be copied.
----------
[drm] Initialized vgem 1.0.0 20120112 for vgem on minor 0 [drm] Initialized vkms 1.0.0 20180514 for vkms on minor 1
Console: switching to colour frame buffer device 128x48
=====================================================
BUG: KMSAN: uninit-value in do_update_region+0x4b8/0xba0 do_update_region+0x4b8/0xba0 update_region+0x40d/0x840 fbcon_switch+0x3364/0x35e0 redraw_screen+0xae3/0x18a0 do_bind_con_driver+0x1cb3/0x1df0 do_take_over_console+0x11cb/0x13f0 fbcon_fb_registered+0xacc/0xfd0 register_framebuffer+0x1179/0x1320 __drm_fb_helper_initial_config_and_unlock+0x23ad/0x2b40 drm_fbdev_client_hotplug+0xbea/0xda0 drm_fbdev_generic_setup+0x65e/0x9d0 vkms_init+0x9f3/0xc76 (...snipped...)
Uninit was stored to memory at:
fbcon_prepare_logo+0x143b/0x1940 fbcon_init+0x2c1b/0x31c0 visual_init+0x3e7/0x820 do_bind_con_driver+0x14a4/0x1df0 do_take_over_console+0x11cb/0x13f0 fbcon_fb_registered+0xacc/0xfd0 register_framebuffer+0x1179/0x1320 __drm_fb_helper_initial_config_and_unlock+0x23ad/0x2b40 drm_fbdev_client_hotplug+0xbea/0xda0 drm_fbdev_generic_setup+0x65e/0x9d0 vkms_init+0x9f3/0xc76 (...snipped...)
Uninit was created at:
__kmem_cache_alloc_node+0xb69/0x1020 __kmalloc+0x379/0x680 fbcon_prepare_logo+0x704/0x1940 fbcon_init+0x2c1b/0x31c0 visual_init+0x3e7/0x820 do_bind_con_driver+0x14a4/0x1df0 do_take_over_console+0x11cb/0x13f0 fbcon_fb_registered+0xacc/0xfd0 register_framebuffer+0x1179/0x1320 __drm_fb_helper_initial_config_and_unlock+0x23ad/0x2b40 drm_fbdev_client_hotplug+0xbea/0xda0 drm_fbdev_generic_setup+0x65e/0x9d0 vkms_init+0x9f3/0xc76 (...snipped...) CPU: 2 PID: 1 Comm: swapper/0 Not tainted 6.1.0-rc4-00356-g8f2975c2bb4c #924 Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 ----------
--- drivers/video/fbdev/core/fbcon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/core/fbcon.c +1 -1
@@ -577,7 +577,7 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info,if (scr_readw (r) != vc->vc_video_erase_char)break ;if (r != q && new_rows >= rows + logo_lines) { - save =kmalloc (array3_size (logo_lines, new_cols,2 ), + save =kzalloc (array3_size (logo_lines, new_cols,2 ),GFP_KERNEL );if (save) {int i =min (cols, new_cols);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 35/157 usb: dwc3: gadget: Disable GUSB2PHYCFG.SUSPHY for End Transfer
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
[ Upstream commit 3aa07f72894d209fcf922ad686cbb28cf005aaad ]
If there's a disconnection while operating in eSS, there may be a delay in VBUS drop response from the connector. In that case, the internal link state may drop to operate in usb2 speed while the controller thinks the VBUS is still high. The driver must make sure to disable GUSB2PHYCFG.SUSPHY when sending endpoint command while in usb2 speed. The End Transfer command may be called, and only that command needs to go through at this point. Let's keep it simple and unconditionally disable GUSB2PHYCFG.SUSPHY whenever we issue the command.
This scenario is not seen in real hardware. In a rare case, our prototype type-c controller/interface may have a slow response triggerring this issue.
--- drivers/usb/dwc3/gadget.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +2 -1
@@ -291,7 +291,8 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned int cmd,* * DWC_usb3 3.30a and DWC_usb31 1.90a programming guide section 3.2.2 */ -if (dwc->gadget->speed <=USB_SPEED_HIGH ) { +if (dwc->gadget->speed <=USB_SPEED_HIGH || +DWC3_DEPCMD_CMD (cmd) ==DWC3_DEPCMD_ENDTRANSFER ) { reg =dwc3_readl (dwc->regs,DWC3_GUSB2PHYCFG (0 ));if (unlikely (reg &DWC3_GUSB2PHYCFG_SUSPHY )) { saved_config |=DWC3_GUSB2PHYCFG_SUSPHY ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 36/157 9p/xen: check logical size for buffer size
In reply to Greg Kroah-HartmanFrom: Dominique Martinet <[email protected]>
[ Upstream commit 391c18cf776eb4569ecda1f7794f360fe0a45a26 ]
trans_xen did not check the data fits into the buffer before copying from the xen ring, but we probably should.
Add a check that just skips the request and return an error to userspace if it did not fit
--- net/9p/trans_xen.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/9p/trans_xen.c +9 -0
@@ -208,6 +208,14 @@ static void p9_xen_response(struct work_struct *work)continue ; } +if (h.size > req->rc.capacity) { +dev_warn (&priv->dev->dev, +"requested packet size too big: %d for tag %d with capacity %zd\n" , + h.size, h.tag, req->rc.capacity); + req->status =REQ_STATUS_ERROR ; + goto recv_error; + } +memcpy (&req->rc, &h,sizeof (h)); req->rc.offset =0 ;
@@ -217,6 +225,7 @@ static void p9_xen_response(struct work_struct *work) masked_prod, &masked_cons, XEN_9PFS_RING_SIZE(ring)); +recv_error:virt_mb (); cons += h.size; ring->intf->in_cons = cons;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 37/157 net: usb: qmi_wwan: add u-blox 0x1342 composition
In reply to Greg Kroah-HartmanFrom: Davide Tronchin <[email protected]>
[ Upstream commit a487069e11b6527373f7c6f435d8998051d0b5d9 ]
Add RmNet support for LARA-L6.
LARA-L6 module can be configured (by AT interface) in three different USB modes:
* Default mode (Vendor ID: 0x1546 Product ID: 0x1341) with 4 serial interfaces
* RmNet mode (Vendor ID: 0x1546 Product ID: 0x1342) with 4 serial interfaces and 1 RmNet virtual network interface
* CDC-ECM mode (Vendor ID: 0x1546 Product ID: 0x1343) with 4 serial interface and 1 CDC-ECM virtual network interface
In RmNet mode LARA-L6 exposes the following interfaces:
If 0: Diagnostic
If 1: AT parser
If 2: AT parser
If 3: AT parset/alternative functions
If 4: RMNET interface
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -1423,6 +1423,7 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x0489, 0xe0b4, 0)}, /* Foxconn T77W968 LTE */ {QMI_FIXED_INTF(0x0489, 0xe0b5, 0)}, /* Foxconn T77W968 LTE with eSIM support*/ {QMI_FIXED_INTF(0x2692, 0x9025, 4)}, /* Cellient MPL200 (rebranded Qualcomm 05c6:9025) */ + {QMI_QUIRK_SET_DTR(0x1546, 0x1342, 4)}, /* u-blox LARA-L6 *//* 4. Gobi 1000 devices */ {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 38/157 drm/amd/display: Use viewport height for subvp mall allocation size
In reply to Greg Kroah-HartmanFrom: Dillon Varone <[email protected]>
[ Upstream commit dd2c028c1395d622df7ddd6837f8ab2dc94008ee ]
[WHY?]
MALL allocation size depends on the viewport height, not the addressable vertical lines, which will not match when scaling.
[HOW?]
Base MALL allocation size calculations off viewport height.
--- drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c +1 -1
@@ -103,7 +103,7 @@ uint32_t dcn32_helper_calculate_num_ways_for_subvp(struct dc *dc, struct dc_stat mall_alloc_width_blk_aligned = full_vp_width_blk_aligned;/* mall_alloc_height_blk_aligned_l/c = CEILING(sub_vp_height_l/c - 1, blk_height_l/c) + blk_height_l/c */ - mall_alloc_height_blk_aligned = (pipe->stream->timing.v_addressable -1 + mblk_height -1 ) / + mall_alloc_height_blk_aligned = (pipe->plane_res.scl_data.viewport.height -1 + mblk_height -1 ) / mblk_height * mblk_height + mblk_height;/* full_mblk_width_ub_l/c = mall_alloc_width_blk_aligned_l/c;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 39/157 drm/amd/display: Avoid setting pixel rate divider to N/A
In reply to Greg Kroah-HartmanFrom: Taimur Hassan <[email protected]>
[ Upstream commit 2a5dd86a69ea5435f1a837bdb7fafcda609a7c91 ]
[Why]
Pixel rate divider values should never be set to N/A (0xF) as the K1/K2 field is only 1/2 bits wide.
[How]
Set valid divider values for virtual and FRL/DP2 cases.
--- drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c | 7 +++++++ drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.c | 3 ++- drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dccg.c | 4 +++- drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c | 1 + 4 files changed, 13 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c +7 -0
@@ -96,6 +96,13 @@ static void dccg314_set_pixel_rate_div(struct dcn_dccg *dccg_dcn =TO_DCN_DCCG (dccg);enum pixel_rate_div cur_k1 =PIXEL_RATE_DIV_NA , cur_k2 =PIXEL_RATE_DIV_NA ; +// Don't program 0xF into the register field. Not valid since +// K1 / K2 field is only 1 / 2 bits wide +if (k1 ==PIXEL_RATE_DIV_NA || k2 ==PIXEL_RATE_DIV_NA ) { +BREAK_TO_DEBUGGER (); +return ; + } +dccg314_get_pixel_rate_div (dccg, otg_inst, &cur_k1, &cur_k2);if (k1 ==PIXEL_RATE_DIV_NA || k2 ==PIXEL_RATE_DIV_NA || (k1 == cur_k1 && k2 == cur_k2))return ;
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.c +2 -1
@@ -349,6 +349,7 @@ unsigned int dcn314_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsig odm_combine_factor =get_odm_config (pipe_ctx,NULL );if (is_dp_128b_132b_signal (pipe_ctx)) { + *k1_div =PIXEL_RATE_DIV_BY_1 ; *k2_div =PIXEL_RATE_DIV_BY_1 ; }else if (dc_is_hdmi_tmds_signal (pipe_ctx->stream->signal) ||dc_is_dvi_signal (pipe_ctx->stream->signal)) { *k1_div =PIXEL_RATE_DIV_BY_1 ;
@@ -356,7 +357,7 @@ unsigned int dcn314_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsig *k2_div =PIXEL_RATE_DIV_BY_2 ; else *k2_div =PIXEL_RATE_DIV_BY_4 ; - }else if (dc_is_dp_signal (pipe_ctx->stream->signal)) { + }else if (dc_is_dp_signal (pipe_ctx->stream->signal) ||dc_is_virtual_signal (pipe_ctx->stream->signal)) {if (two_pix_per_container) { *k1_div =PIXEL_RATE_DIV_BY_1 ; *k2_div =PIXEL_RATE_DIV_BY_2 ;
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dccg.c +3 -1
@@ -96,8 +96,10 @@ static void dccg32_set_pixel_rate_div(// Don't program 0xF into the register field. Not valid since // K1 / K2 field is only 1 / 2 bits wide -if (k1 ==PIXEL_RATE_DIV_NA || k2 ==PIXEL_RATE_DIV_NA ) +if (k1 ==PIXEL_RATE_DIV_NA || k2 ==PIXEL_RATE_DIV_NA ) { +BREAK_TO_DEBUGGER ();return ; + }dccg32_get_pixel_rate_div (dccg, otg_inst, &cur_k1, &cur_k2);if (k1 == cur_k1 && k2 == cur_k2)
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +1 -0
@@ -1171,6 +1171,7 @@ unsigned int dcn32_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsign odm_combine_factor =get_odm_config (pipe_ctx,NULL );if (is_dp_128b_132b_signal (pipe_ctx)) { + *k1_div =PIXEL_RATE_DIV_BY_1 ; *k2_div =PIXEL_RATE_DIV_BY_1 ; }else if (dc_is_hdmi_tmds_signal (pipe_ctx->stream->signal) ||dc_is_dvi_signal (pipe_ctx->stream->signal)) { *k1_div =PIXEL_RATE_DIV_BY_1 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 40/157 drm/amd/display: Use new num clk levels struct for max mclk index
In reply to Greg Kroah-HartmanFrom: Dillon Varone <[email protected]>
[ Upstream commit e667ee3b0c049bf0c69426879586a2572bb28d26 ]
[WHY?]
When calculating watermark and dlg values, the max mclk level index and associated speed are needed to find the correlated dummy latency value. Currently the incorrect index is given due to a clock manager refactor.
[HOW?]
Use num_memclk_level from num_entries_per_clk struct for getting the correct max mem speed.
--- drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c +1 -1
@@ -1803,7 +1803,7 @@ void dcn32_calculate_wm_and_dlg_fpu(struct dc *dc, struct dc_state *context,if (context->bw_ctx.dml.vba.DRAMClockChangeSupport[vlevel][maxMpcComb] == dm_dram_clock_change_unsupported) { -int min_dram_speed_mts_offset = dc->clk_mgr->bw_params->clk_table.num_entries -1 ; +int min_dram_speed_mts_offset = dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_memclk_levels -1 ; min_dram_speed_mts = dc->clk_mgr->bw_params->clk_table.entries[min_dram_speed_mts_offset].memclk_mhz *16 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 41/157 drm/amdgpu: fix use-after-free during gpu recovery
In reply to Greg Kroah-HartmanFrom: Stanley.Yang <[email protected]>
[ Upstream commit 3cb93f390453cde4d6afda1587aaa00e75e09617 ]
[Why]
[ 754.862560] refcount_t: underflow; use-after-free.
[ 754.862898] Call Trace:
[ 754.862903] <TASK>
[ 754.862913] amdgpu_job_free_cb+0xc2/0xe1 [amdgpu]
[ 754.863543] drm_sched_main.cold+0x34/0x39 [amd_sched][How]
The fw_fence may be not init, check whether dma_fence_init is performed before job free
--- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +5 -1
@@ -167,7 +167,11 @@ static void amdgpu_job_free_cb(struct drm_sched_job *s_job)amdgpu_sync_free (&job->sync);amdgpu_sync_free (&job->sched_sync); -dma_fence_put (&job->hw_fence); +/* only put the hw fence if has embedded fence */ +if (!job->hw_fence.ops) +kfree (job); +else +dma_fence_put (&job->hw_fence); }void amdgpu_job_free (struct amdgpu_job *job)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 42/157 mm/khugepaged: take the right locks for page table retraction
In reply to Greg Kroah-HartmanFrom: Jann Horn <[email protected]>
commit 8d3c106e19e8d251da31ff4cc7462e4565d65084 upstream.
pagetable walks on address ranges mapped by VMAs can be done under the mmap lock, the lock of an anon_vma attached to the VMA, or the lock of the VMA's address_space. Only one of these needs to be held, and it does not need to be held in exclusive mode.
Under those circumstances, the rules for concurrent access to page table entries are:
- Terminal page table entries (entries that don't point to another page table) can be arbitrarily changed under the page table lock, with the exception that they always need to be consistent for hardware page table walks and lockless_pages_from_mm().
This includes that they can be changed into non-terminal entries.
- Non-terminal page table entries (which point to another page table) can not be modified; readers are allowed to READ_ONCE() an entry, verify that it is non-terminal, and then assume that its value will stay as-is.
Retracting a page table involves modifying a non-terminal entry, so page-table-level locks are insufficient to protect against concurrent page table traversal; it requires taking all the higher-level locks under which it is possible to start a page walk in the relevant range in exclusive mode.
The collapse_huge_page() path for anonymous THP already follows this rule, but the shmem/file THP path was getting it wrong, making it possible for concurrent rmap-based operations to cause corruption.
[backport fixed up manually: collapse_pte_mapped_thp returns different type]
--- mm/khugepaged.c | 56 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 4 deletions(-)
mm/khugepaged.c +52 -4
@@ -1360,16 +1360,37 @@ static void khugepaged_add_pte_mapped_thp(struct mm_struct *mm,spin_unlock (&khugepaged_mm_lock); } +/* +* A note about locking: +* Trying to take the page table spinlocks would be useless here because those +* are only used to synchronize: +* +* - modifying terminal entries (ones that point to a data page, not to another +* page table) +* - installing *new* non-terminal entries +* +* Instead, we need roughly the same kind of protection as free_pgtables() or +* mm_take_all_locks() (but only for a single VMA): +* The mmap lock together with this VMA's rmap locks covers all paths towards +* the page table entries we're messing with here, except for hardware page +* table walks and lockless_pages_from_mm(). +*/ static void collapse_and_free_pmd (struct mm_struct *mm,struct vm_area_struct *vma,unsigned long addr,pmd_t *pmdp) { -spinlock_t *ptl;pmd_t pmd;mmap_assert_write_locked (mm); - ptl =pmd_lock (vma->vm_mm, pmdp); +if (vma->vm_file) +lockdep_assert_held_write (&vma->vm_file->f_mapping->i_mmap_rwsem); +/* +* All anon_vmas attached to the VMA have the same root and are +* therefore locked by the same lock. +*/ +if (vma->anon_vma) +lockdep_assert_held_write (&vma->anon_vma->root->rwsem); + pmd =pmdp_collapse_flush (vma, addr, pmdp); -spin_unlock (ptl);mm_dec_nr_ptes (mm);page_table_check_pte_clear_range (mm, addr, pmd);pte_free (mm,pmd_pgtable (pmd));
@@ -1410,6 +1431,14 @@ void collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr)if (!hugepage_vma_check (vma, vma->vm_flags |VM_HUGEPAGE , false, false))return ; +/* +* Symmetry with retract_page_tables(): Exclude MAP_PRIVATE mappings +* that got written to. Without this, we'd have to also lock the +* anon_vma if one exists. +*/ +if (vma->anon_vma) +return ; +/* Keep pmd pgtable for uffd-wp; see comment in retract_page_tables() */ if (userfaultfd_wp (vma))return ;
@@ -1426,6 +1455,20 @@ void collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr)if (!pmd) goto drop_hpage; +/* +* We need to lock the mapping so that from here on, only GUP-fast and +* hardware page walks can access the parts of the page tables that +* we're operating on. +* See collapse_and_free_pmd(). +*/ +i_mmap_lock_write (vma->vm_file->f_mapping); + +/* +* This spinlock should be unnecessary: Nobody else should be accessing +* the page tables under spinlock protection here, only +* lockless_pages_from_mm() and the hardware page walker can access page +* tables while all the high-level locks are held in write mode. +*/ start_pte =pte_offset_map_lock (mm, pmd, haddr, &ptl);/* step 1: check all mapped PTEs are to the right huge page */
@@ -1476,6 +1519,9 @@ void collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr)/* step 4: collapse pmd */ collapse_and_free_pmd (mm, vma, haddr, pmd); + +i_mmap_unlock_write (vma->vm_file->f_mapping); + drop_hpage:unlock_page (hpage);put_page (hpage);
@@ -1483,6 +1529,7 @@ void collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr) abort:pte_unmap_unlock (start_pte, ptl); +i_mmap_unlock_write (vma->vm_file->f_mapping); goto drop_hpage; }
@@ -1531,7 +1578,8 @@ static void retract_page_tables(struct address_space *mapping, pgoff_t pgoff)* An alternative would be drop the check, but check that page * table is clear before calling pmdp_collapse_flush() under * ptl. It has higher chance to recover THP for the VMA, but -* has higher cost too. +* has higher cost too. It would also probably require locking +* the anon_vma. */ if (vma->anon_vma)continue ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 43/157 mm/khugepaged: fix GUP-fast interaction by sending IPI
In reply to Greg Kroah-HartmanFrom: Jann Horn <[email protected]>
commit 2ba99c5e08812494bc57f319fb562f527d9bacd8 upstream.
Since commit 70cbc3cc78a99 ("mm: gup: fix the fast GUP race against THP collapse"), the lockless_pages_from_mm() fastpath rechecks the pmd_t to ensure that the page table was not removed by khugepaged in between.
However, lockless_pages_from_mm() still requires that the page table is not concurrently freed. Fix it by sending IPIs (if the architecture uses semi-RCU-style page table freeing) before freeing/reusing page tables.
--- include/asm-generic/tlb.h | 4 ++++ mm/khugepaged.c | 2 ++ mm/mmu_gather.c | 4 +--- 3 files changed, 7 insertions(+), 3 deletions(-)
include/asm-generic/tlb.h +4 -0
@@ -222,12 +222,16 @@ extern void tlb_remove_table(struct mmu_gather *tlb, void *table);#define tlb_needs_table_invalidate () (true)#endif +void tlb_remove_table_sync_one (void ); +#else #ifdef tlb_needs_table_invalidate#error tlb_needs_table_invalidate() requires MMU_GATHER_RCU_TABLE_FREE#endif +static inline void tlb_remove_table_sync_one (void ) { } +#endif /* CONFIG_MMU_GATHER_RCU_TABLE_FREE */
mm/khugepaged.c +2 -0
@@ -1093,6 +1093,7 @@ static void collapse_huge_page(struct mm_struct *mm, _pmd =pmdp_collapse_flush (vma, address, pmd);spin_unlock (pmd_ptl);mmu_notifier_invalidate_range_end (&range); +tlb_remove_table_sync_one ();spin_lock (pte_ptl); isolated = __collapse_huge_page_isolate(vma, address, pte,
@@ -1391,6 +1392,7 @@ static void collapse_and_free_pmd(struct mm_struct *mm, struct vm_area_struct *vlockdep_assert_held_write (&vma->anon_vma->root->rwsem); pmd =pmdp_collapse_flush (vma, addr, pmdp); +tlb_remove_table_sync_one ();mm_dec_nr_ptes (mm);page_table_check_pte_clear_range (mm, addr, pmd);pte_free (mm,pmd_pgtable (pmd));
mm/mmu_gather.c +1 -3
@@ -152,7 +152,7 @@ static void tlb_remove_table_smp_sync(void *arg)/* Simply deliver the interrupt */ } -static void tlb_remove_table_sync_one (void ) +void tlb_remove_table_sync_one (void ) {/* * This isn't an RCU grace period and hence the page-tables cannot be
@@ -176,8 +176,6 @@ static void tlb_remove_table_free(struct mmu_table_batch *batch)#else /* !CONFIG_MMU_GATHER_RCU_TABLE_FREE */ -static void tlb_remove_table_sync_one (void ) { } -static void tlb_remove_table_free (struct mmu_table_batch *batch) {__tlb_remove_table_free (batch);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 44/157 mm/khugepaged: invoke MMU notifiers in shmem/file collapse paths
In reply to Greg Kroah-HartmanFrom: Jann Horn <[email protected]>
commit f268f6cf875f3220afc77bdd0bf1bb136eb54db9 upstream.
Any codepath that zaps page table entries must invoke MMU notifiers to ensure that secondary MMUs (like KVM) don't keep accessing pages which aren't mapped anymore. Secondary MMUs don't hold their own references to pages that are mirrored over, so failing to notify them can lead to page use-after-free.
I'm marking this as addressing an issue introduced in commit f3f0e1d2150b ("khugepaged: add support of collapse for tmpfs/shmem pages"), but most of the security impact of this only came in commit 27e1f8273113 ("khugepaged:
enable collapse pmd for pte-mapped THP"), which actually omitted flushes for the removal of present PTEs, not just for the removal of empty page tables.
--- mm/khugepaged.c | 5 +++++ 1 file changed, 5 insertions(+)
mm/khugepaged.c +5 -0
@@ -1380,6 +1380,7 @@ static void collapse_and_free_pmd(struct mm_struct *mm, struct vm_area_struct *v unsigned long addr, pmd_t *pmdp) { pmd_t pmd; +struct mmu_notifier_range range;mmap_assert_write_locked (mm);if (vma->vm_file)
@@ -1391,8 +1392,12 @@ static void collapse_and_free_pmd(struct mm_struct *mm, struct vm_area_struct *vif (vma->anon_vma)lockdep_assert_held_write (&vma->anon_vma->root->rwsem); +mmu_notifier_range_init (&range,MMU_NOTIFY_CLEAR ,0 ,NULL , mm, addr, + addr +HPAGE_PMD_SIZE ); +mmu_notifier_invalidate_range_start (&range); pmd =pmdp_collapse_flush (vma, addr, pmdp);tlb_remove_table_sync_one (); +mmu_notifier_invalidate_range_end (&range);mm_dec_nr_ptes (mm);page_table_check_pte_clear_range (mm, addr, pmd);pte_free (mm,pmd_pgtable (pmd));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 45/157 hugetlb: dont delete vma_lock in hugetlb MADV_DONTNEED processing
In reply to Greg Kroah-HartmanFrom: Mike Kravetz <[email protected]>
commit 04ada095dcfc4ae359418053c0be94453bdf1e84 upstream.
madvise(MADV_DONTNEED) ends up calling zap_page_range() to clear page tables associated with the address range. For hugetlb vmas, zap_page_range will call __unmap_hugepage_range_final. However, __unmap_hugepage_range_final assumes the passed vma is about to be removed and deletes the vma_lock to prevent pmd sharing as the vma is on the way out. In the case of madvise(MADV_DONTNEED) the vma remains, but the missing vma_lock prevents pmd sharing and could potentially lead to issues with truncation/fault races.
This issue was originally reported here [1] as a BUG triggered in page_try_dup_anon_rmap. Prior to the introduction of the hugetlb vma_lock, __unmap_hugepage_range_final cleared the VM_MAYSHARE flag to prevent pmd sharing. Subsequent faults on this vma were confused as VM_MAYSHARE indicates a sharable vma, but was not set so page_mapping was not set in new pages added to the page table. This resulted in pages that appeared anonymous in a VM_SHARED vma and triggered the BUG.
Address issue by adding a new zap flag ZAP_FLAG_UNMAP to indicate an unmap call from unmap_vmas(). This is used to indicate the 'final' unmapping of a hugetlb vma. When called via MADV_DONTNEED, this flag is not set and the vm_lock is not deleted.
NOTE - Prior to the introduction of the huegtlb vma_lock in v6.1, this
issue is addressed by not clearing the VM_MAYSHARE flag when __unmap_hugepage_range_final is called in the MADV_DONTNEED case.
[1] https://lore.kernel.org/lkml/CAO4mrfdLMXsao9RF4fUE8-Wfde8xmjsKrTNMNC9wjUb6JudD0g@mail.gmail.com/
--- include/linux/mm.h | 2 ++ mm/hugetlb.c | 25 ++++++++++++++----------- mm/memory.c | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-)
include/linux/mm.h +2 -0
@@ -1794,6 +1794,8 @@ struct zap_details {* default, the flag is not set. */ #define ZAP_FLAG_DROP_MARKER ((__force zap_flags_t) BIT(0)) +/* Set in unmap_vmas() to indicate a final unmap call. Only used by hugetlb */ +#define ZAP_FLAG_UNMAP ((__force zap_flags_t) BIT(1))#ifdef CONFIG_MMU extern bool can_do_mlock (void );
mm/hugetlb.c +14 -11
@@ -5145,17 +5145,20 @@ void __unmap_hugepage_range_final(struct mmu_gather *tlb, {__unmap_hugepage_range (tlb, vma, start, end, ref_page, zap_flags); -/* -* Clear this flag so that x86's huge_pmd_share page_table_shareable -* test will fail on a vma being torn down, and not grab a page table -* on its way out. We're lucky that the flag has such an appropriate -* name, and can in fact be safely cleared here. We could clear it -* before the __unmap_hugepage_range above, but all that's necessary -* is to clear it before releasing the i_mmap_rwsem. This works -* because in the context this is called, the VMA is about to be -* destroyed and the i_mmap_rwsem is held. -*/ - vma->vm_flags &= ~VM_MAYSHARE ; +if (zap_flags &ZAP_FLAG_UNMAP ) {/* final unmap */ +/* +* Clear this flag so that x86's huge_pmd_share +* page_table_shareable test will fail on a vma being torn +* down, and not grab a page table on its way out. We're lucky +* that the flag has such an appropriate name, and can in fact +* be safely cleared here. We could clear it before the +* __unmap_hugepage_range above, but all that's necessary +* is to clear it before releasing the i_mmap_rwsem. This works +* because in the context this is called, the VMA is about to +* be destroyed and the i_mmap_rwsem is held. +*/ + vma->vm_flags &= ~VM_MAYSHARE ; + } } void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start,
mm/memory.c +1 -1
@@ -1712,7 +1712,7 @@ void unmap_vmas(struct mmu_gather *tlb, {struct mmu_notifier_range range;struct zap_details details = { - .zap_flags =ZAP_FLAG_DROP_MARKER , + .zap_flags =ZAP_FLAG_DROP_MARKER |ZAP_FLAG_UNMAP ,/* Careful - we need to zap private pages too! */ .even_cows = true, };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 46/157 ALSA: hda/realtek: More robust component matching for CS35L41
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 35a1744423743247026668e2323d1b932583fc2a ]
As the previous commit implies, a system may have a different SPI bus number that is embedded in the device string. And, assuming the fixed bus number is rather fragile; it may be assigned differently depending on the configuration or on the boot environment. Once when a bus number change happens, the binding fails, resulting in the silence.
This patch tries to make the matching a bit more relaxed, allowing to bind with a different bus number (or without it). So the previous fix, the introduction of ALC245_FIXUP_CS35L41_SPI1_2 fixup became superfluous, and this is unified to ALC245_FIXUP_CS35L41_SPI_2.
--- sound/pci/hda/patch_realtek.c | 62 +++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 25 deletions(-)
sound/pci/hda/patch_realtek.c +37 -25
@@ -18,6 +18,7 @@#include <linux/module.h> #include <linux/input.h> #include <linux/leds.h> +#include <linux/ctype.h> #include <sound/core.h> #include <sound/jack.h> #include <sound/hda_codec.h>
@@ -6704,23 +6705,51 @@ static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_ } } +struct cs35l41_dev_name { +const char *bus; +const char *hid; +int index; +}; + +/* match the device name in a slightly relaxed manner */ +static int comp_match_cs35l41_dev_name (struct device *dev,void *data) +{ +struct cs35l41_dev_name *p = data; +const char *d =dev_name (dev); +int n =strlen (p->bus); +char tmp[32 ]; + +/* check the bus name */ +if (strncmp (d, p->bus, n)) +return 0 ; +/* skip the bus number */ +if (isdigit (d[n])) + n++; +/* the rest must be exact matching */ +snprintf (tmp,sizeof (tmp),"-%s:00-cs35l41-hda.%d" , p->hid, p->index); +return !strcmp (d + n, tmp); +} +static void cs35l41_generic_fixup (struct hda_codec *cdc,int action,const char *bus,const char *hid,int count) {struct device *dev =hda_codec_dev (cdc);struct alc_spec *spec = cdc->spec; -char *name; +struct cs35l41_dev_name *rec;int ret, i;switch (action) {case HDA_FIXUP_ACT_PRE_PROBE :for (i =0 ; i < count; i++) { - name =devm_kasprintf (dev,GFP_KERNEL , -"%s-%s:00-cs35l41-hda.%d" , bus, hid, i); -if (!name) + rec =devm_kmalloc (dev,sizeof (*rec),GFP_KERNEL ); +if (!rec)return ; + rec->bus = bus; + rec->hid = hid; + rec->index = i; spec->comps[i].codec = cdc; -component_match_add (dev, &spec->match, component_compare_dev_name, name); +component_match_add (dev, &spec->match, + comp_match_cs35l41_dev_name, rec); } ret =component_master_add_with_match (dev, &comp_master_ops, spec->match);if (ret)
@@ -6738,17 +6767,12 @@ static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixupstatic void cs35l41_fixup_spi_two (struct hda_codec *codec,const struct hda_fixup *fix,int action) { -cs35l41_generic_fixup (codec, action,"spi0" ,"CSC3551" ,2 ); -} - -static void cs35l41_fixup_spi1_two (struct hda_codec *codec,const struct hda_fixup *fix,int action) -{ -cs35l41_generic_fixup (codec, action,"spi1" ,"CSC3551" ,2 ); +cs35l41_generic_fixup (codec, action,"spi" ,"CSC3551" ,2 ); }static void cs35l41_fixup_spi_four (struct hda_codec *codec,const struct hda_fixup *fix,int action) { -cs35l41_generic_fixup (codec, action,"spi0" ,"CSC3551" ,4 ); +cs35l41_generic_fixup (codec, action,"spi" ,"CSC3551" ,4 ); } static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
@@ -7137,8 +7161,6 @@ enum {ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED ,ALC245_FIXUP_CS35L41_SPI_2 ,ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED , -ALC245_FIXUP_CS35L41_SPI1_2 , -ALC245_FIXUP_CS35L41_SPI1_2_HP_GPIO_LED ,ALC245_FIXUP_CS35L41_SPI_4 ,ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED , ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
@@ -8988,16 +9010,6 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id = ALC285_FIXUP_HP_GPIO_LED, }, - [ALC245_FIXUP_CS35L41_SPI1_2] = { - .type = HDA_FIXUP_FUNC, - .v.func = cs35l41_fixup_spi1_two, - }, - [ALC245_FIXUP_CS35L41_SPI1_2_HP_GPIO_LED] = { - .type = HDA_FIXUP_FUNC, - .v.func = cs35l41_fixup_spi1_two, - .chained = true, - .chain_id = ALC285_FIXUP_HP_GPIO_LED, - }, [ALC245_FIXUP_CS35L41_SPI_4] = { .type = HDA_FIXUP_FUNC, .v.func = cs35l41_fixup_spi_four,
@@ -9361,7 +9373,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8aa3 ,"HP ProBook 450 G9 (MB 8AA1)" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8aa8 ,"HP EliteBook 640 G9 (MB 8AA6)" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8aab ,"HP EliteBook 650 G9 (MB 8AA9)" ,ALC236_FIXUP_HP_GPIO_LED ), -SND_PCI_QUIRK (0x103c ,0x8abb ,"HP ZBook Firefly 14 G9" ,ALC245_FIXUP_CS35L41_SPI1_2_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8abb ,"HP ZBook Firefly 14 G9" ,ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8ad1 ,"HP EliteBook 840 14 inch G9 Notebook PC" ,ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8ad2 ,"HP EliteBook 860 16 inch G9 Notebook PC" ,ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED ), SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 47/157 crypto: ccp - Add a quirk to firmware update
In reply to Greg Kroah-HartmanFrom: Jarkko Sakkinen <[email protected]>
[ Upstream commit b3b9fdf1a9be4266b01a2063b1f37cdc20806e3b ]
A quirk for fixing the committed TCB version, when upgrading from a firmware version earlier than 1.50. This is a known issue, and the documented workaround is to load the firmware twice.
Currently, this issue requires the following workaround:
sudo modprobe -r kvm_amd
sudo modprobe -r ccp
sudo modprobe ccp
sudo modprobe kvm_amd
Implement this workaround inside kernel by checking whether the API version is less than 1.50, and if so, download the firmware twice. This addresses the TCB version issue.
--- drivers/crypto/ccp/sev-dev.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/crypto/ccp/sev-dev.c +14 -2
@@ -748,6 +748,11 @@ static int sev_update_firmware(struct device *dev)struct page *p;u64 data_size; +if (!sev_version_greater_or_equal (0 ,15 )) { +dev_dbg (dev,"DOWNLOAD_FIRMWARE not supported\n" ); +return -1 ; + } +if (sev_get_firmware (dev, &firmware) == -ENOENT ) {dev_dbg (dev,"No SEV firmware file present\n" );return -1 ;
@@ -780,6 +785,14 @@ static int sev_update_firmware(struct device *dev) data->len = firmware->size; ret =sev_do_cmd (SEV_CMD_DOWNLOAD_FIRMWARE , data, &error); + +/* +* A quirk for fixing the committed TCB version, when upgrading from +* earlier firmware version than 1.50. +*/ +if (!ret && !sev_version_greater_or_equal (1 ,50 )) + ret =sev_do_cmd (SEV_CMD_DOWNLOAD_FIRMWARE , data, &error); +if (ret)dev_dbg (dev,"Failed to update SEV firmware: %#x\n" , error);else
@@ -1289,8 +1302,7 @@ void sev_pci_init(void)if (sev_get_api_version ()) goto err; -if (sev_version_greater_or_equal (0 ,15 ) && -sev_update_firmware (sev->dev) ==0 ) +if (sev_update_firmware (sev->dev) ==0 )sev_get_api_version ();/* If an init_ex_path is provided rely on INIT_EX for PSP initialization
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 48/157 soundwire: dmi-quirks: add remapping for HP Omen 16-k0005TX
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit df55100551a34bddab02dff48d0296bda0659c02 ]
The DSDT for this device has a number of problems:
a) it lists rt711 on link0 and link1, but link1 is disabled
b) the rt711 entry on link0 uses the wrong v2 instead of v3 (SDCA)
c) the rt1316 amplifier on link3 is not listed.
Add a remapping table to work-around these BIOS shenanigans.
--- drivers/soundwire/dmi-quirks.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/soundwire/dmi-quirks.c +27 -0
@@ -55,7 +55,26 @@ static const struct adr_remap dell_sku_0A3E[] = { {} }; +/* +* The HP Omen 16-k0005TX does not expose the correct version of RT711 on link0 +* and does not expose a RT1316 on link3 +*/ +static const struct adr_remap hp_omen_16[] = { +/* rt711-sdca on link0 */ + { +0x000020025d071100ull , +0x000030025d071101ull + }, +/* rt1316-sdca on link3 */ + { +0x000120025d071100ull , +0x000330025d131601ull + }, + {} +}; +static const struct dmi_system_id adr_remap_quirk_table[] = { +/* TGL devices */ { .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"HP" ),
@@ -78,6 +97,14 @@ static const struct dmi_system_id adr_remap_quirk_table[] = { }, .driver_data = (void *)dell_sku_0A3E, }, +/* ADL devices */ + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "HP"), + DMI_MATCH(DMI_PRODUCT_NAME, "OMEN by HP Gaming Laptop 16-k0xxx"), + }, + .driver_data = (void *)hp_omen_16, + }, {} };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 49/157 platform/x86: asus-wmi: Adjust tablet/lidflip handling to use enum
In reply to Greg Kroah-HartmanFrom: Luke D. Jones <[email protected]>
[ Upstream commit 00aa846955fbfb04f7bc0c26c49febfe5395eca1 ]
Due to multiple types of tablet/lidflip, the existing code for handling these events is refactored to use an enum for each type.
Stable-dep-of: e397c3c460bf ("platform/x86: asus-wmi: Add support for ROG X13 tablet mode")
--- drivers/platform/x86/asus-nb-wmi.c | 13 +++----- drivers/platform/x86/asus-wmi.c | 49 +++++++++++++++++++++--------- drivers/platform/x86/asus-wmi.h | 9 ++++-- 3 files changed, 47 insertions(+), 24 deletions(-)
drivers/platform/x86/asus-nb-wmi.c +5 -8
@@ -115,12 +115,12 @@ static struct quirk_entry quirk_asus_forceals = { };static struct quirk_entry quirk_asus_use_kbd_dock_devid = { - .use_kbd_dock_devid = true, + .tablet_switch_mode = asus_wmi_kbd_dock_devid, };static struct quirk_entry quirk_asus_use_lid_flip_devid = { .wmi_backlight_set_devstate = true, - .use_lid_flip_devid = true, + .tablet_switch_mode = asus_wmi_lid_flip_devid, };static int dmi_matched (const struct dmi_system_id *dmi)
@@ -492,16 +492,13 @@ static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver)switch (tablet_mode_sw) {case 0 : - quirks->use_kbd_dock_devid = false; - quirks->use_lid_flip_devid = false; + quirks->tablet_switch_mode = asus_wmi_no_tablet_switch;break ;case 1 : - quirks->use_kbd_dock_devid = true; - quirks->use_lid_flip_devid = false; + quirks->tablet_switch_mode = asus_wmi_kbd_dock_devid;break ;case 2 : - quirks->use_kbd_dock_devid = false; - quirks->use_lid_flip_devid = true; + quirks->tablet_switch_mode = asus_wmi_lid_flip_devid;break ; }
drivers/platform/x86/asus-wmi.c +35 -14
116 lines not on this page · raw message
drivers/platform/x86/asus-wmi.h +7 -2
@@ -25,6 +25,12 @@ struct module;struct key_entry ;struct asus_wmi ; +enum asus_wmi_tablet_switch_mode { + asus_wmi_no_tablet_switch, + asus_wmi_kbd_dock_devid, + asus_wmi_lid_flip_devid, +}; +struct quirk_entry {bool hotplug_wireless;bool scalar_panel_brightness;
@@ -33,8 +39,7 @@ struct quirk_entry {bool wmi_backlight_native;bool wmi_backlight_set_devstate;bool wmi_force_als_set; -bool use_kbd_dock_devid; -bool use_lid_flip_devid; +enum asus_wmi_tablet_switch_mode tablet_switch_mode;int wapf;/* * For machines with AMD graphic chips, it will send out WMI event
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 50/157 platform/x86: asus-wmi: Add support for ROG X13 tablet mode
In reply to Greg Kroah-HartmanFrom: Luke D. Jones <[email protected]>
[ Upstream commit e397c3c460bf3849384f2f55516d1887617cfca9 ]
Add quirk for ASUS ROG X13 Flow 2-in-1 to enable tablet mode with lid flip (all screen rotations).
--- drivers/platform/x86/asus-nb-wmi.c | 15 +++++++++ drivers/platform/x86/asus-wmi.c | 37 ++++++++++++++++++++++ drivers/platform/x86/asus-wmi.h | 1 + include/linux/platform_data/x86/asus-wmi.h | 1 + 4 files changed, 54 insertions(+)
drivers/platform/x86/asus-nb-wmi.c +15 -0
@@ -123,6 +123,11 @@ static struct quirk_entry quirk_asus_use_lid_flip_devid = { .tablet_switch_mode = asus_wmi_lid_flip_devid, }; +static struct quirk_entry quirk_asus_tablet_mode = { + .wmi_backlight_set_devstate = true, + .tablet_switch_mode = asus_wmi_lid_flip_rog_devid, +}; +static int dmi_matched (const struct dmi_system_id *dmi) {pr_info ("Identified laptop model '%s'\n" , dmi->ident);
@@ -471,6 +476,15 @@ static const struct dmi_system_id asus_quirks[] = { }, .driver_data = &quirk_asus_use_lid_flip_devid, }, + { + .callback = dmi_matched, + .ident = "ASUS ROG FLOW X13", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "GV301Q"), + }, + .driver_data = &quirk_asus_tablet_mode, + }, {}, };
@@ -578,6 +592,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = { { KE_KEY, 0xC5, { KEY_KBDILLUMDOWN } }, { KE_IGNORE, 0xC6, }, /* Ambient Light Sensor notification */ { KE_KEY, 0xFA, { KEY_PROG2 } }, /* Lid flip action */ + { KE_KEY, 0xBD, { KEY_PROG2 } }, /* Lid flip action on ROG xflow laptops */ { KE_END, 0}, };
drivers/platform/x86/asus-wmi.c +37 -0
@@ -68,6 +68,7 @@ module_param(fnlock_default, bool, 0444);#define NOTIFY_KBD_FBM 0x99#define NOTIFY_KBD_TTP 0xae#define NOTIFY_LID_FLIP 0xfa +#define NOTIFY_LID_FLIP_ROG 0xbd#define ASUS_WMI_FNLOCK_BIOS_DISABLED BIT(0)
@@ -533,6 +534,19 @@ static int asus_wmi_input_init(struct asus_wmi *asus)dev_err (dev,"Error checking for lid-flip: %d\n" , result); }break ; +case asus_wmi_lid_flip_rog_devid: + result =asus_wmi_get_devstate_simple (asus,ASUS_WMI_DEVID_LID_FLIP_ROG ); +if (result <0 ) + asus->driver->quirks->tablet_switch_mode = asus_wmi_no_tablet_switch; +if (result >=0 ) { +input_set_capability (asus->inputdev,EV_SW ,SW_TABLET_MODE ); +input_report_switch (asus->inputdev,SW_TABLET_MODE , result); + }else if (result == -ENODEV ) { +dev_err (dev,"This device has lid-flip-rog quirk but got ENODEV checking it. This is a bug." ); + }else { +dev_err (dev,"Error checking for lid-flip: %d\n" , result); + } +break ; } err =input_register_device (asus->inputdev);
@@ -567,6 +581,17 @@ static void lid_flip_tablet_mode_get_state(struct asus_wmi *asus) } } +static void lid_flip_rog_tablet_mode_get_state (struct asus_wmi *asus) +{ +int result; + + result =asus_wmi_get_devstate_simple (asus,ASUS_WMI_DEVID_LID_FLIP_ROG ); +if (result >=0 ) { +input_report_switch (asus->inputdev,SW_TABLET_MODE , result); +input_sync (asus->inputdev); + } +} +/* dGPU ********************************************************************/ static int dgpu_disable_check_present (struct asus_wmi *asus) {
@@ -3134,6 +3159,12 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)return ; } +if (asus->driver->quirks->tablet_switch_mode == asus_wmi_lid_flip_rog_devid && + code ==NOTIFY_LID_FLIP_ROG ) { +lid_flip_rog_tablet_mode_get_state (asus); +return ; + } +if (asus->fan_boost_mode_available && code ==NOTIFY_KBD_FBM ) {fan_boost_mode_switch_next (asus);return ;
@@ -3773,6 +3804,9 @@ static int asus_hotk_resume(struct device *device)case asus_wmi_lid_flip_devid:lid_flip_tablet_mode_get_state (asus);break ; +case asus_wmi_lid_flip_rog_devid: +lid_flip_rog_tablet_mode_get_state (asus); +break ; }return 0 ;
@@ -3821,6 +3855,9 @@ static int asus_hotk_restore(struct device *device)case asus_wmi_lid_flip_devid:lid_flip_tablet_mode_get_state (asus);break ; +case asus_wmi_lid_flip_rog_devid: +lid_flip_rog_tablet_mode_get_state (asus); +break ; }return 0 ;
drivers/platform/x86/asus-wmi.h +1 -0
@@ -29,6 +29,7 @@ enum asus_wmi_tablet_switch_mode { asus_wmi_no_tablet_switch, asus_wmi_kbd_dock_devid, asus_wmi_lid_flip_devid, + asus_wmi_lid_flip_rog_devid, }; struct quirk_entry {
include/linux/platform_data/x86/asus-wmi.h +1 -0
@@ -65,6 +65,7 @@#define ASUS_WMI_DEVID_PANEL_OD 0x00050019#define ASUS_WMI_DEVID_CAMERA 0x00060013#define ASUS_WMI_DEVID_LID_FLIP 0x00060062 +#define ASUS_WMI_DEVID_LID_FLIP_ROG 0x00060077/* Storage */ #define ASUS_WMI_DEVID_CARDREADER 0x00080013
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 51/157 xen/netback: Ensure protocol headers dont fall in the non-linear area
In reply to Greg Kroah-HartmanFrom: Ross Lagerwall <[email protected]>
[ Upstream commit ad7f402ae4f466647c3a669b8a6f3e5d4271c84a ]
In some cases, the frontend may send a packet where the protocol headers are spread across multiple slots. This would result in netback creating an skb where the protocol headers spill over into the non-linear area. Some drivers and NICs don't handle this properly resulting in an interface reset or worse.
This issue was introduced by the removal of an unconditional skb pull in the tx path to improve performance. Fix this without reintroducing the pull by setting up grant copy ops for as many slots as needed to reach the XEN_NETBACK_TX_COPY_LEN size. Adjust the rest of the code to handle multiple copy operations per skb.
This is XSA-423 / CVE-2022-3643.
--- drivers/net/xen-netback/netback.c | 223 ++++++++++++++++-------------- 1 file changed, 123 insertions(+), 100 deletions(-)
drivers/net/xen-netback/netback.c +123 -100
@@ -332,10 +332,13 @@ static int xenvif_count_requests(struct xenvif_queue *queue,struct xenvif_tx_cb { -u16 pending_idx; +u16 copy_pending_idx[XEN_NETBK_LEGACY_SLOTS_MAX +1 ]; +u8 copy_count; };#define XENVIF_TX_CB (skb) ((struct xenvif_tx_cb *)(skb)->cb) +#define copy_pending_idx (skb, i) (XENVIF_TX_CB(skb)->copy_pending_idx[i]) +#define copy_count (skb) (XENVIF_TX_CB(skb)->copy_count) static inline void xenvif_tx_create_map_op(struct xenvif_queue *queue, u16 pending_idx,
@@ -370,31 +373,93 @@ static inline struct sk_buff *xenvif_alloc_skb(unsigned int size)return skb; } -static struct gnttab_map_grant_ref *xenvif_get_requests (struct xenvif_queue *queue, -struct sk_buff *skb, -struct xen_netif_tx_request *txp, -struct gnttab_map_grant_ref *gop, -unsigned int frag_overflow, -struct sk_buff *nskb) +static void xenvif_get_requests (struct xenvif_queue *queue, +struct sk_buff *skb, +struct xen_netif_tx_request *first, +struct xen_netif_tx_request *txfrags, +unsigned *copy_ops, +unsigned *map_ops, +unsigned int frag_overflow, +struct sk_buff *nskb, +unsigned int extra_count, +unsigned int data_len) {struct skb_shared_info *shinfo =skb_shinfo (skb);skb_frag_t *frags = shinfo->frags; -u16 pending_idx =XENVIF_TX_CB (skb)->pending_idx; -int start; +u16 pending_idx;pending_ring_idx_t index;unsigned int nr_slots; +struct gnttab_copy *cop = queue->tx_copy_ops + *copy_ops; +struct gnttab_map_grant_ref *gop = queue->tx_map_ops + *map_ops; +struct xen_netif_tx_request *txp = first; + + nr_slots = shinfo->nr_frags +1 ; + +copy_count (skb) =0 ; + +/* Create copy ops for exactly data_len bytes into the skb head. */ +__skb_put (skb, data_len); +while (data_len >0 ) { +int amount = data_len > txp->size ? txp->size : data_len; + + cop->source.u.ref = txp->gref; + cop->source.domid = queue->vif->domid; + cop->source.offset = txp->offset; + + cop->dest.domid =DOMID_SELF ; + cop->dest.offset = (offset_in_page (skb->data + +skb_headlen (skb) - + data_len)) & ~XEN_PAGE_MASK ; + cop->dest.u.gmfn =virt_to_gfn (skb->data +skb_headlen (skb) + - data_len); + + cop->len = amount; + cop->flags = GNTCOPY_source_gref; - nr_slots = shinfo->nr_frags; + index =pending_index (queue->pending_cons); + pending_idx = queue->pending_ring[index]; +callback_param (queue, pending_idx).ctx =NULL ; +copy_pending_idx (skb,copy_count (skb)) = pending_idx; +copy_count (skb)++; + + cop++; + data_len -= amount; -/* Skip first skb fragment if it is on same page as header fragment. */ - start = (frag_get_pending_idx (&shinfo->frags[0 ]) == pending_idx); +if (amount == txp->size) { +/* The copy op covered the full tx_request */ + +memcpy (&queue->pending_tx_info[pending_idx].req, + txp,sizeof (*txp)); + queue->pending_tx_info[pending_idx].extra_count = + (txp == first) ? extra_count :0 ; + +if (txp == first) + txp = txfrags; +else + txp++; + queue->pending_cons++; + nr_slots--; + }else { +/* The copy op partially covered the tx_request. +* The remainder will be mapped. +*/ + txp->offset += amount; + txp->size -= amount; + } + } -for (shinfo->nr_frags = start; shinfo->nr_frags < nr_slots; - shinfo->nr_frags++, txp++, gop++) { +for (shinfo->nr_frags =0 ; shinfo->nr_frags < nr_slots; + shinfo->nr_frags++, gop++) { index =pending_index (queue->pending_cons++); pending_idx = queue->pending_ring[index]; -xenvif_tx_create_map_op (queue, pending_idx, txp,0 , gop); +xenvif_tx_create_map_op (queue, pending_idx, txp, + txp == first ? extra_count :0 , gop);frag_set_pending_idx (&frags[shinfo->nr_frags], pending_idx); + +if (txp == first) + txp = txfrags; +else + txp++; }if (frag_overflow) {
@@ -415,7 +480,8 @@ static struct gnttab_map_grant_ref *xenvif_get_requests(struct xenvif_queue *queskb_shinfo (skb)->frag_list = nskb; } -return gop; + (*copy_ops) = cop - queue->tx_copy_ops; + (*map_ops) = gop - queue->tx_map_ops; } static inline void xenvif_grant_handle_set(struct xenvif_queue *queue,
@@ -451,7 +517,7 @@ static int xenvif_tx_check_gop(struct xenvif_queue *queue, struct gnttab_copy **gopp_copy) {struct gnttab_map_grant_ref *gop_map = *gopp_map; -u16 pending_idx =XENVIF_TX_CB (skb)->pending_idx; +u16 pending_idx;/* This always points to the shinfo of the skb being checked, which * could be either the first or the one on the frag_list */
@@ -462,24 +528,37 @@ static int xenvif_tx_check_gop(struct xenvif_queue *queue,struct skb_shared_info *first_shinfo =NULL ;int nr_frags = shinfo->nr_frags;const bool sharedslot = nr_frags && -frag_get_pending_idx (&shinfo->frags[0 ]) == pending_idx; +frag_get_pending_idx (&shinfo->frags[0 ]) == +copy_pending_idx (skb,copy_count (skb) -1 );int i, err; -/* Check status of header. */ - err = (*gopp_copy)->status; -if (unlikely (err)) { -if (net_ratelimit ()) -netdev_dbg (queue->vif->dev, -"Grant copy of header failed! status: %d pending_idx: %u ref: %u\n" , - (*gopp_copy)->status, - pending_idx, - (*gopp_copy)->source.u.ref); -/* The first frag might still have this slot mapped */ -if (!sharedslot) -xenvif_idx_release (queue, pending_idx, -XEN_NETIF_RSP_ERROR ); +for (i =0 ; i <copy_count (skb); i++) { +int newerr; + +/* Check status of header. */ + pending_idx =copy_pending_idx (skb, i); + + newerr = (*gopp_copy)->status; +if (likely (!newerr)) { +/* The first frag might still have this slot mapped */ +if (i <copy_count (skb) -1 || !sharedslot) +xenvif_idx_release (queue, pending_idx, +XEN_NETIF_RSP_OKAY ); + }else { + err = newerr; +if (net_ratelimit ()) +netdev_dbg (queue->vif->dev, +"Grant copy of header failed! status: %d pending_idx: %u ref: %u\n" , + (*gopp_copy)->status, + pending_idx, + (*gopp_copy)->source.u.ref); +/* The first frag might still have this slot mapped */ +if (i <copy_count (skb) -1 || !sharedslot) +xenvif_idx_release (queue, pending_idx, +XEN_NETIF_RSP_ERROR ); + } + (*gopp_copy)++; } - (*gopp_copy)++; check_frags:for (i =0 ; i < nr_frags; i++, gop_map++) {
@@ -526,14 +605,6 @@ static int xenvif_tx_check_gop(struct xenvif_queue *queue,if (err)continue ; -/* First error: if the header haven't shared a slot with the -* first frag, release it as well. -*/ -if (!sharedslot) -xenvif_idx_release (queue, -XENVIF_TX_CB (skb)->pending_idx, -XEN_NETIF_RSP_OKAY ); -/* Invalidate preceding fragments of this skb. */ for (j =0 ; j < i; j++) { pending_idx =frag_get_pending_idx (&shinfo->frags[j]);
@@ -803,7 +874,6 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,unsigned *copy_ops, unsigned *map_ops) { - struct gnttab_map_grant_ref *gop = queue->tx_map_ops; struct sk_buff *skb, *nskb;int ret;unsigned int frag_overflow;
@@ -885,8 +955,12 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,continue ; } + data_len = (txreq.size >XEN_NETBACK_TX_COPY_LEN ) ? +XEN_NETBACK_TX_COPY_LEN : txreq.size; + ret =xenvif_count_requests (queue, &txreq, extra_count, txfrags, work_to_do); +if (unlikely (ret <0 ))break ;
@@ -912,9 +986,8 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, index =pending_index (queue->pending_cons); pending_idx = queue->pending_ring[index]; - data_len = (txreq.size >XEN_NETBACK_TX_COPY_LEN && - ret <XEN_NETBK_LEGACY_SLOTS_MAX ) ? -XEN_NETBACK_TX_COPY_LEN : txreq.size; +if (ret >=XEN_NETBK_LEGACY_SLOTS_MAX -1 && data_len < txreq.size) + data_len = txreq.size; skb =xenvif_alloc_skb (data_len);if (unlikely (skb ==NULL )) {
@@ -925,8 +998,6 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, }skb_shinfo (skb)->nr_frags = ret; -if (data_len < txreq.size) -skb_shinfo (skb)->nr_frags++;/* At this point shinfo->nr_frags is in fact the number of * slots, which can be as large as XEN_NETBK_LEGACY_SLOTS_MAX. */
@@ -988,54 +1059,19 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, type); } -XENVIF_TX_CB (skb)->pending_idx = pending_idx; - -__skb_put (skb, data_len); - queue->tx_copy_ops[*copy_ops].source.u.ref = txreq.gref; - queue->tx_copy_ops[*copy_ops].source.domid = queue->vif->domid; - queue->tx_copy_ops[*copy_ops].source.offset = txreq.offset; - - queue->tx_copy_ops[*copy_ops].dest.u.gmfn = -virt_to_gfn (skb->data); - queue->tx_copy_ops[*copy_ops].dest.domid =DOMID_SELF ; - queue->tx_copy_ops[*copy_ops].dest.offset = -offset_in_page (skb->data) & ~XEN_PAGE_MASK ; - - queue->tx_copy_ops[*copy_ops].len = data_len; - queue->tx_copy_ops[*copy_ops].flags = GNTCOPY_source_gref; - - (*copy_ops)++; - -if (data_len < txreq.size) { -frag_set_pending_idx (&skb_shinfo (skb)->frags[0 ], - pending_idx); -xenvif_tx_create_map_op (queue, pending_idx, &txreq, - extra_count, gop); - gop++; - }else { -frag_set_pending_idx (&skb_shinfo (skb)->frags[0 ], -INVALID_PENDING_IDX ); -memcpy (&queue->pending_tx_info[pending_idx].req, - &txreq,sizeof (txreq)); - queue->pending_tx_info[pending_idx].extra_count = - extra_count; - } - - queue->pending_cons++; - - gop =xenvif_get_requests (queue, skb, txfrags, gop, - frag_overflow, nskb); +xenvif_get_requests (queue, skb, &txreq, txfrags, copy_ops, + map_ops, frag_overflow, nskb, extra_count, + data_len);__skb_queue_tail (&queue->tx_queue, skb); queue->tx.req_cons = idx; -if (((gop-queue->tx_map_ops) >=ARRAY_SIZE (queue->tx_map_ops)) || +if ((*map_ops >=ARRAY_SIZE (queue->tx_map_ops)) || (*copy_ops >=ARRAY_SIZE (queue->tx_copy_ops)))break ; } - (*map_ops) = gop - queue->tx_map_ops;return ; }
@@ -1114,9 +1150,8 @@ static int xenvif_tx_submit(struct xenvif_queue *queue)while ((skb =__skb_dequeue (&queue->tx_queue)) !=NULL ) {struct xen_netif_tx_request *txp;u16 pending_idx; -unsigned data_len; - pending_idx =XENVIF_TX_CB (skb)->pending_idx; + pending_idx =copy_pending_idx (skb,0 ); txp = &queue->pending_tx_info[pending_idx].req;/* Check the remap error code. */
@@ -1135,18 +1170,6 @@ static int xenvif_tx_submit(struct xenvif_queue *queue)continue ; } - data_len = skb->len; -callback_param (queue, pending_idx).ctx =NULL ; -if (data_len < txp->size) { -/* Append the packet payload as a fragment. */ - txp->offset += data_len; - txp->size -= data_len; - }else { -/* Schedule a response immediately. */ -xenvif_idx_release (queue, pending_idx, -XEN_NETIF_RSP_OKAY ); - } -if (txp->flags & XEN_NETTXF_csum_blank) skb->ip_summed =CHECKSUM_PARTIAL ;else if (txp->flags & XEN_NETTXF_data_validated)
@@ -1331,7 +1354,7 @@ static inline void xenvif_tx_dealloc_action(struct xenvif_queue *queue)/* Called after netfront has transmitted */ int xenvif_tx_action (struct xenvif_queue *queue,int budget) { -unsigned nr_mops, nr_cops =0 ; +unsigned nr_mops =0 , nr_cops =0 ;int work_done, ret;if (unlikely (!tx_work_todo (queue)))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 52/157 xen/netback: dont call kfree_skb() with interrupts disabled
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
[ Upstream commit 74e7e1efdad45580cc3839f2a155174cf158f9b5 ]
It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. So remove kfree_skb() from the spin_lock_irqsave() section and use the already existing "drop" label in xenvif_start_xmit() for dropping the SKB. At the same time replace the dev_kfree_skb() call there with a call of dev_kfree_skb_any(), as xenvif_start_xmit() can be called with disabled interrupts.
This is XSA-424 / CVE-2022-42328 / CVE-2022-42329.
--- drivers/net/xen-netback/common.h | 2 +- drivers/net/xen-netback/interface.c | 6 ++++-- drivers/net/xen-netback/rx.c | 8 +++++--- 3 files changed, 10 insertions(+), 6 deletions(-)
drivers/net/xen-netback/common.h +1 -1
@@ -386,7 +386,7 @@ int xenvif_dealloc_kthread(void *data);irqreturn_t xenvif_ctrl_irq_fn (int irq,void *data);bool xenvif_have_rx_work (struct xenvif_queue *queue,bool test_kthread); -void xenvif_rx_queue_tail (struct xenvif_queue *queue,struct sk_buff *skb); +bool xenvif_rx_queue_tail (struct xenvif_queue *queue,struct sk_buff *skb);void xenvif_carrier_on (struct xenvif *vif);
drivers/net/xen-netback/interface.c +4 -2
@@ -254,14 +254,16 @@ xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev)if (vif->hash.alg ==XEN_NETIF_CTRL_HASH_ALGORITHM_NONE )skb_clear_hash (skb); -xenvif_rx_queue_tail (queue, skb); +if (!xenvif_rx_queue_tail (queue, skb)) + goto drop; +xenvif_kick_thread (queue);return NETDEV_TX_OK ; drop: vif->dev->stats.tx_dropped++; -dev_kfree_skb (skb); +dev_kfree_skb_any (skb);return NETDEV_TX_OK ; }
drivers/net/xen-netback/rx.c +5 -3
@@ -82,9 +82,10 @@ static bool xenvif_rx_ring_slots_available(struct xenvif_queue *queue)return false; } -void xenvif_rx_queue_tail (struct xenvif_queue *queue,struct sk_buff *skb) +bool xenvif_rx_queue_tail (struct xenvif_queue *queue,struct sk_buff *skb) {unsigned long flags; +bool ret = true;spin_lock_irqsave (&queue->rx_queue.lock, flags);
@@ -92,8 +93,7 @@ void xenvif_rx_queue_tail(struct xenvif_queue *queue, struct sk_buff *skb)struct net_device *dev = queue->vif->dev;netif_tx_stop_queue (netdev_get_tx_queue (dev, queue->id)); -kfree_skb (skb); - queue->vif->dev->stats.rx_dropped++; + ret = false; }else {if (skb_queue_empty (&queue->rx_queue))xenvif_update_needed_slots (queue, skb);
@@ -104,6 +104,8 @@ void xenvif_rx_queue_tail(struct xenvif_queue *queue, struct sk_buff *skb) }spin_unlock_irqrestore (&queue->rx_queue.lock, flags); + +return ret; }static struct sk_buff *xenvif_rx_dequeue (struct xenvif_queue *queue)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 53/157 media: videobuf2-core: take mmap_lock in vb2_get_unmapped_area()
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
[ Upstream commit 098e5edc5d048a8df8691fd9fde895af100be42b ]
While vb2_mmap took the mmap_lock mutex, vb2_get_unmapped_area didn't. Add this.
Also take this opportunity to move the 'q->memory != VB2_MEMORY_MMAP' check and vb2_fileio_is_active() check into __find_plane_by_offset() so both vb2_mmap and vb2_get_unmapped_area do the same checks.
Since q->memory is checked while mmap_lock is held, also take that lock in reqbufs and create_bufs when it is set, and set it back to MEMORY_UNKNOWN on error.
--- .../media/common/videobuf2/videobuf2-core.c | 102 +++++++++++++----- 1 file changed, 73 insertions(+), 29 deletions(-)
drivers/media/common/videobuf2/videobuf2-core.c +73 -29
@@ -813,7 +813,13 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory, num_buffers = max_t(unsigned int, *count, q->min_buffers_needed); num_buffers = min_t(unsigned int, num_buffers, VB2_MAX_FRAME);memset (q->alloc_devs,0 ,sizeof (q->alloc_devs)); +/* +* Set this now to ensure that drivers see the correct q->memory value +* in the queue_setup op. +*/ +mutex_lock (&q->mmap_lock); q->memory = memory; +mutex_unlock (&q->mmap_lock);set_queue_coherency (q, non_coherent_mem);/*
@@ -823,22 +829,27 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory, ret =call_qop (q, queue_setup, q, &num_buffers, &num_planes, plane_sizes, q->alloc_devs);if (ret) -return ret; + goto error;/* Check that driver has set sane values */ -if (WARN_ON (!num_planes)) -return -EINVAL ; +if (WARN_ON (!num_planes)) { + ret = -EINVAL ; + goto error; + }for (i =0 ; i < num_planes; i++) -if (WARN_ON (!plane_sizes[i])) -return -EINVAL ; +if (WARN_ON (!plane_sizes[i])) { + ret = -EINVAL ; + goto error; + }/* Finally, allocate buffers and video memory */ allocated_buffers =__vb2_queue_alloc (q, memory, num_buffers, num_planes, plane_sizes);if (allocated_buffers ==0 ) {dprintk (q,1 ,"memory allocation failed\n" ); -return -ENOMEM ; + ret = -ENOMEM ; + goto error; }/*
@@ -879,7 +890,8 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,if (ret <0 ) {/* * Note: __vb2_queue_free() will subtract 'allocated_buffers' -* from q->num_buffers. +* from q->num_buffers and it will reset q->memory to +* VB2_MEMORY_UNKNOWN. */ __vb2_queue_free (q, allocated_buffers);mutex_unlock (&q->mmap_lock);
@@ -895,6 +907,12 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory, q->waiting_for_buffers = !q->is_output;return 0 ; + +error: +mutex_lock (&q->mmap_lock); + q->memory =VB2_MEMORY_UNKNOWN ; +mutex_unlock (&q->mmap_lock); +return ret; }EXPORT_SYMBOL_GPL (vb2_core_reqbufs);
@@ -906,6 +924,7 @@ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,unsigned int num_planes =0 , num_buffers, allocated_buffers;unsigned plane_sizes[VB2_MAX_PLANES ] = { };bool non_coherent_mem = flags &V4L2_MEMORY_FLAG_NON_COHERENT ; +bool no_previous_buffers = !q->num_buffers;int ret;if (q->num_buffers ==VB2_MAX_FRAME ) {
@@ -913,13 +932,19 @@ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,return -ENOBUFS ; } -if (!q->num_buffers) { +if (no_previous_buffers) {if (q->waiting_in_dqbuf && *count) {dprintk (q,1 ,"another dup()ped fd is waiting for a buffer\n" );return -EBUSY ; }memset (q->alloc_devs,0 ,sizeof (q->alloc_devs)); +/* +* Set this now to ensure that drivers see the correct q->memory +* value in the queue_setup op. +*/ +mutex_lock (&q->mmap_lock); q->memory = memory; +mutex_unlock (&q->mmap_lock); q->waiting_for_buffers = !q->is_output;set_queue_coherency (q, non_coherent_mem); }else {
@@ -945,14 +970,15 @@ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory, ret =call_qop (q, queue_setup, q, &num_buffers, &num_planes, plane_sizes, q->alloc_devs);if (ret) -return ret; + goto error;/* Finally, allocate buffers and video memory */ allocated_buffers =__vb2_queue_alloc (q, memory, num_buffers, num_planes, plane_sizes);if (allocated_buffers ==0 ) {dprintk (q,1 ,"memory allocation failed\n" ); -return -ENOMEM ; + ret = -ENOMEM ; + goto error; }/*
@@ -983,7 +1009,8 @@ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,if (ret <0 ) {/* * Note: __vb2_queue_free() will subtract 'allocated_buffers' -* from q->num_buffers. +* from q->num_buffers and it will reset q->memory to +* VB2_MEMORY_UNKNOWN. */ __vb2_queue_free (q, allocated_buffers);mutex_unlock (&q->mmap_lock);
@@ -998,6 +1025,14 @@ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory, *count = allocated_buffers;return 0 ; + +error: +if (no_previous_buffers) { +mutex_lock (&q->mmap_lock); + q->memory =VB2_MEMORY_UNKNOWN ; +mutex_unlock (&q->mmap_lock); + } +return ret; }EXPORT_SYMBOL_GPL (vb2_core_create_bufs);
@@ -2164,6 +2199,22 @@ static int __find_plane_by_offset(struct vb2_queue *q, unsigned long off,struct vb2_buffer *vb;unsigned int buffer, plane; +/* +* Sanity checks to ensure the lock is held, MEMORY_MMAP is +* used and fileio isn't active. +*/ +lockdep_assert_held (&q->mmap_lock); + +if (q->memory !=VB2_MEMORY_MMAP ) { +dprintk (q,1 ,"queue is not currently set up for mmap\n" ); +return -EINVAL ; + } + +if (vb2_fileio_is_active (q)) { +dprintk (q,1 ,"file io in progress\n" ); +return -EBUSY ; + } +/* * Go over all buffers and their planes, comparing the given offset * with an offset assigned to each plane. If a match is found,
@@ -2265,11 +2316,6 @@ int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma)int ret;unsigned long length; -if (q->memory !=VB2_MEMORY_MMAP ) { -dprintk (q,1 ,"queue is not currently set up for mmap\n" ); -return -EINVAL ; - } -/* * Check memory area access mode. */
@@ -2291,14 +2337,9 @@ int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma)mutex_lock (&q->mmap_lock); -if (vb2_fileio_is_active (q)) { -dprintk (q,1 ,"mmap: file io in progress\n" ); - ret = -EBUSY ; - goto unlock; - } -/* -* Find the plane corresponding to the offset passed by userspace. +* Find the plane corresponding to the offset passed by userspace. This +* will return an error if not MEMORY_MMAP or file I/O is in progress. */ ret =__find_plane_by_offset (q, off, &buffer, &plane);if (ret)
@@ -2351,22 +2392,25 @@ unsigned long vb2_get_unmapped_area(struct vb2_queue *q,void *vaddr;int ret; -if (q->memory !=VB2_MEMORY_MMAP ) { -dprintk (q,1 ,"queue is not currently set up for mmap\n" ); -return -EINVAL ; - } +mutex_lock (&q->mmap_lock);/* -* Find the plane corresponding to the offset passed by userspace. +* Find the plane corresponding to the offset passed by userspace. This +* will return an error if not MEMORY_MMAP or file I/O is in progress. */ ret =__find_plane_by_offset (q, off, &buffer, &plane);if (ret) -return ret; + goto unlock; vb = q->bufs[buffer]; vaddr =vb2_plane_vaddr (vb, plane); +mutex_unlock (&q->mmap_lock);return vaddr ? (unsigned long )vaddr : -EINVAL ; + +unlock: +mutex_unlock (&q->mmap_lock); + return ret; }EXPORT_SYMBOL_GPL (vb2_get_unmapped_area);#endif
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 54/157 fscache: Fix oops due to race with cookie_lru and use_cookie
In reply to Greg Kroah-HartmanFrom: Dave Wysochanski <[email protected]>
[ Upstream commit b5b52de3214a29911f949459a79f6640969b5487 ]
If a cookie expires from the LRU and the LRU_DISCARD flag is set, but the state machine has not run yet, it's possible another thread can call fscache_use_cookie and begin to use it.
When the cookie_worker finally runs, it will see the LRU_DISCARD flag set, transition the cookie->state to LRU_DISCARDING, which will then withdraw the cookie. Once the cookie is withdrawn the object is removed the below oops will occur because the object associated with the cookie is now NULL.
Fix the oops by clearing the LRU_DISCARD bit if another thread uses the cookie before the cookie_worker runs.
BUG: kernel NULL pointer dereference, address: 0000000000000008
...
CPU: 31 PID: 44773 Comm: kworker/u130:1 Tainted: G E 6.0.0-5.dneg.x86_64 #1
Hardware name: Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022
Workqueue: events_unbound netfs_rreq_write_to_cache_work [netfs]
RIP: 0010:cachefiles_prepare_write+0x28/0x90 [cachefiles]
...
Call Trace:
netfs_rreq_write_to_cache_work+0x11c/0x320 [netfs]
process_one_work+0x217/0x3e0
worker_thread+0x4a/0x3b0
kthread+0xd6/0x100--- fs/fscache/cookie.c | 8 ++++++++ include/trace/events/fscache.h | 2 ++ 2 files changed, 10 insertions(+)
fs/fscache/cookie.c +8 -0
@@ -605,6 +605,14 @@ void __fscache_use_cookie(struct fscache_cookie *cookie, bool will_modify)set_bit (FSCACHE_COOKIE_DO_PREP_TO_WRITE , &cookie->flags); queue = true; } +/* +* We could race with cookie_lru which may set LRU_DISCARD bit +* but has yet to run the cookie state machine. If this happens +* and another thread tries to use the cookie, clear LRU_DISCARD +* so we don't end up withdrawing the cookie while in use. +*/ +if (test_and_clear_bit (FSCACHE_COOKIE_DO_LRU_DISCARD , &cookie->flags)) +fscache_see_cookie (cookie, fscache_cookie_see_lru_discard_clear);break ;case FSCACHE_COOKIE_STATE_FAILED :
include/trace/events/fscache.h +2 -0
@@ -66,6 +66,7 @@ enum fscache_cookie_trace { fscache_cookie_put_work, fscache_cookie_see_active, fscache_cookie_see_lru_discard, + fscache_cookie_see_lru_discard_clear, fscache_cookie_see_lru_do_one, fscache_cookie_see_relinquish, fscache_cookie_see_withdraw,
@@ -149,6 +150,7 @@ enum fscache_access_trace { EM(fscache_cookie_put_work, "PQ work ") \ EM(fscache_cookie_see_active, "- activ") \ EM(fscache_cookie_see_lru_discard, "- x-lru") \ + EM(fscache_cookie_see_lru_discard_clear,"- lrudc") \ EM(fscache_cookie_see_lru_do_one, "- lrudo") \ EM(fscache_cookie_see_relinquish, "- x-rlq") \EM (fscache_cookie_see_withdraw,"- x-wth" ) \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 55/157 soundwire: intel: Initialize clock stop timeout
In reply to Greg Kroah-HartmanFrom: Sjoerd Simons <[email protected]>
commit 13c30a755847c7e804e1bf755e66e3ff7b7f9367 upstream.
The bus->clk_stop_timeout member is only initialized to a non-zero value during the codec driver probe. This can lead to corner cases where this value remains pegged at zero when the bus suspends, which results in an endless loop in sdw_bus_wait_for_clk_prep_deprep().
Corner cases include configurations with no codecs described in the firmware, or delays in probing codec drivers.
Initializing the default timeout to the smallest non-zero value avoid this problem and allows for the existing logic to be preserved: the bus->clk_stop_timeout is set as the maximum required by all codecs connected on the bus.
--- drivers/soundwire/intel.c | 1 + 1 file changed, 1 insertion(+)
drivers/soundwire/intel.c +1 -0
@@ -1307,6 +1307,7 @@ static int intel_link_probe(struct auxil cdns->msg_count =0 ; bus->link_id = auxdev->id; + bus->clk_stop_timeout =1 ;sdw_cdns_probe (cdns);
Greg Kroah-Hartman
maintainerPATCH 56/157 Revert "ARM: dts: imx7: Fix NAND controller size-cells"
In reply to Greg Kroah-HartmanFrom: Francesco Dolcini <[email protected]>
commit ef19964da8a668c683f1d38274f6fb756e047945 upstream.
This reverts commit 753395ea1e45c724150070b5785900b6a44bd5fb.
It introduced a boot regression on colibri-imx7, and potentially any other i.MX7 boards with MTD partition list generated into the fdt by U-Boot.
While the commit we are reverting here is not obviously wrong, it fixes only a dt binding checker warning that is non-functional, while it introduces a boot regression and there is no obvious fix ready.
--- arch/arm/boot/dts/imx7s.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/imx7s.dtsi +2 -2
@@ -1270,10 +1270,10 @@ clocks = <&clks IMX7D_NAND_USDHC_BUS_RAWNAND_CLK>; }; - gpmi: nand-controller@33002000 { + gpmi: nand-controller@33002000{ compatible = "fsl,imx7d-gpmi-nand"; #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; reg = <0x33002000 0x2000>, <0x33004000 0x4000>; reg-names = "gpmi-nand", "bch"; interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
Greg Kroah-Hartman
maintainerPATCH 57/157 media: v4l2-dv-timings.c: fix too strict blanking sanity checks
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
commit 5eef2141776da02772c44ec406d6871a790761ee upstream.
Sanity checks were added to verify the v4l2_bt_timings blanking fields in order to avoid integer overflows when userspace passes weird values.
But that assumed that userspace would correctly fill in the front porch, backporch and sync values, but sometimes all you know is the total blanking, which is then assigned to just one of these fields.
And that can fail with these checks.
So instead set a maximum for the total horizontal and vertical blanking and check that each field remains below that.
That is still sufficient to avoid integer overflows, but it also allows for more flexibility in how userspace fills in these fields.
--- drivers/media/v4l2-core/v4l2-dv-timings.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/media/v4l2-core/v4l2-dv-timings.c +14 -6
@@ -145,6 +145,8 @@ bool v4l2_valid_dv_timings(const structconst struct v4l2_bt_timings *bt = &t->bt;const struct v4l2_bt_timings_cap *cap = &dvcap->bt;u32 caps = cap->capabilities; +const u32 max_vert =10240 ; +u32 max_hor =3 * bt->width;if (t->type !=V4L2_DV_BT_656_1120 )return false;
@@ -166,14 +168,20 @@ bool v4l2_valid_dv_timings(const structif (!bt->interlaced && (bt->il_vbackporch || bt->il_vsync || bt->il_vfrontporch))return false; -if (bt->hfrontporch >2 * bt->width || - bt->hsync >1024 || bt->hbackporch >1024 ) +/* +* Some video receivers cannot properly separate the frontporch, +* backporch and sync values, and instead they only have the total +* blanking. That can be assigned to any of these three fields. +* So just check that none of these are way out of range. +*/ +if (bt->hfrontporch > max_hor || + bt->hsync > max_hor || bt->hbackporch > max_hor)return false; -if (bt->vfrontporch >4096 || - bt->vsync >128 || bt->vbackporch >4096 ) +if (bt->vfrontporch > max_vert || + bt->vsync > max_vert || bt->vbackporch > max_vert)return false; -if (bt->interlaced && (bt->il_vfrontporch >4096 || - bt->il_vsync >128 || bt->il_vbackporch >4096 )) +if (bt->interlaced && (bt->il_vfrontporch > max_vert || + bt->il_vsync > max_vert || bt->il_vbackporch > max_vert))return false;return fnc ==NULL ||fnc (t, fnc_handle); }
Greg Kroah-Hartman
maintainerPATCH 58/157 memcg: fix possible use-after-free in memcg_write_event_control()
In reply to Greg Kroah-HartmanFrom: Tejun Heo <[email protected]>
commit 4a7ba45b1a435e7097ca0f79a847d0949d0eb088 upstream.
memcg_write_event_control() accesses the dentry->d_name of the specified control fd to route the write call. As a cgroup interface file can't be renamed, it's safe to access d_name as long as the specified file is a regular cgroup file. Also, as these cgroup interface files can't be removed before the directory, it's safe to access the parent too.
Prior to 347c4a874710 ("memcg: remove cgroup_event->cft"), there was a call to __file_cft() which verified that the specified file is a regular cgroupfs file before further accesses. The cftype pointer returned from __file_cft() was no longer necessary and the commit inadvertently dropped the file type check with it allowing any file to slip through. With the invarients broken, the d_name and parent accesses can now race against renames and removals of arbitrary files and cause use-after-free's.
Fix the bug by resurrecting the file type check in __file_cft(). Now that cgroupfs is implemented through kernfs, checking the file operations needs to go through a layer of indirection. Instead, let's check the superblock and dentry type.
--- include/linux/cgroup.h | 1 + kernel/cgroup/cgroup-internal.h | 1 - mm/memcontrol.c | 15 +++++++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-)
include/linux/cgroup.h +1 -0
@@ -68,6 +68,7 @@ struct css_task_iter {struct list_head iters_node;/* css_set->task_iters */ }; +extern struct file_system_type cgroup_fs_type;extern struct cgroup_root cgrp_dfl_root;extern struct css_set init_css_set;
kernel/cgroup/cgroup-internal.h +0 -1
@@ -168,7 +168,6 @@ extern struct mutex cgroup_mutex;extern spinlock_t css_set_lock;extern struct cgroup_subsys *cgroup_subsys[];extern struct list_head cgroup_roots; -extern struct file_system_type cgroup_fs_type;/* iterate across the hierarchies */ #define for_each_root (root) \
mm/memcontrol.c +13 -2
@@ -4772,6 +4772,7 @@ static ssize_t memcg_write_event_controlunsigned int efd, cfd;struct fd efile;struct fd cfile; +struct dentry *cdentry;const char *name;char *endp;int ret;
@@ -4826,6 +4827,16 @@ static ssize_t memcg_write_event_control goto out_put_cfile;/* +* The control file must be a regular cgroup1 file. As a regular cgroup +* file can't be renamed, it's safe to access its name afterwards. +*/ + cdentry = cfile.file->f_path.dentry; +if (cdentry->d_sb->s_type != &cgroup_fs_type || !d_is_reg (cdentry)) { + ret = -EINVAL ; + goto out_put_cfile; + } + +/* * Determine the event callbacks and set them in @event. This used * to be done via struct cftype but cgroup core no longer knows * about these events. The following is crude but the whole thing
@@ -4833,7 +4844,7 @@ static ssize_t memcg_write_event_control* * DO NOT ADD NEW FILES. */ - name = cfile.file->f_path.dentry->d_name.name; + name = cdentry->d_name.name;if (!strcmp (name,"memory.usage_in_bytes" )) { event->register_event = mem_cgroup_usage_register_event;
@@ -4857,7 +4868,7 @@ static ssize_t memcg_write_event_control* automatically removed on cgroup destruction but the removal is * asynchronous, so take an extra ref on @css. */ - cfile_css =css_tryget_online_from_dir (cfile.file->f_path.dentry->d_parent, + cfile_css =css_tryget_online_from_dir (cdentry->d_parent, &memory_cgrp_subsys); ret = -EINVAL ;if (IS_ERR (cfile_css))
Greg Kroah-Hartman
maintainerPATCH 59/157 mm/gup: fix gup_pud_range() for dax
In reply to Greg Kroah-HartmanFrom: John Starks <[email protected]>
commit fcd0ccd836ffad73d98a66f6fea7b16f735ea920 upstream.
For dax pud, pud_huge() returns true on x86. So the function works as long as hugetlb is configured. However, dax doesn't depend on hugetlb. Commit 414fd080d125 ("mm/gup: fix gup_pmd_range() for dax") fixed devmap-backed huge PMDs, but missed devmap-backed huge PUDs. Fix this as well.
This fixes the below kernel panic:
general protection fault, probably for non-canonical address 0x69e7c000cc478: 0000 [#1] SMP < snip > Call Trace: <TASK> get_user_pages_fast+0x1f/0x40 iov_iter_get_pages+0xc6/0x3b0 ? mempool_alloc+0x5d/0x170 bio_iov_iter_get_pages+0x82/0x4e0 ? bvec_alloc+0x91/0xc0 ? bio_alloc_bioset+0x19a/0x2a0 blkdev_direct_IO+0x282/0x480 ? __io_complete_rw_common+0xc0/0xc0 ? filemap_range_has_page+0x82/0xc0 generic_file_direct_write+0x9d/0x1a0 ? inode_update_time+0x24/0x30 __generic_file_write_iter+0xbd/0x1e0 blkdev_write_iter+0xb4/0x150 ? io_import_iovec+0x8d/0x340 io_write+0xf9/0x300 io_issue_sqe+0x3c3/0x1d30 ? sysvec_reschedule_ipi+0x6c/0x80 __io_queue_sqe+0x33/0x240 ? fget+0x76/0xa0 io_submit_sqes+0xe6a/0x18d0 ? __fget_light+0xd1/0x100 __x64_sys_io_uring_enter+0x199/0x880 ? __context_tracking_enter+0x1f/0x70 ? irqentry_exit_to_user_mode+0x24/0x30 ? irqentry_exit+0x1d/0x30 ? __context_tracking_exit+0xe/0x70 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7fc97c11a7be < snip > </TASK> ---[ end trace 48b2e0e67debcaeb ]--- RIP: 0010:internal_get_user_pages_fast+0x340/0x990 < snip > Kernel panic - not syncing: Fatal exception
Kernel Offset: disabled
--- mm/gup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/gup.c +1 -1
@@ -2818,7 +2818,7 @@ static int gup_pud_range(p4d_t *p4dp, p4 next =pud_addr_end (addr, end);if (unlikely (!pud_present (pud)))return 0 ; -if (unlikely (pud_huge (pud))) { +if (unlikely (pud_huge (pud) ||pud_devmap (pud))) {if (!gup_huge_pud (pud, pudp, addr, next, flags, pages, nr))return 0 ;
Greg Kroah-Hartman
maintainerPATCH 60/157 tmpfs: fix data loss from failed fallocate
In reply to Greg Kroah-HartmanFrom: Hugh Dickins <[email protected]>
commit 44bcabd70cf1425b4243e02251c02b01638a8287 upstream.
Fix tmpfs data loss when the fallocate system call is interrupted by a signal, or fails for some other reason. The partial folio handling in shmem_undo_range() forgot to consider this unfalloc case, and was liable to erase or truncate out data which had already been committed earlier.
It turns out that none of the partial folio handling there is appropriate for the unfalloc case, which just wants to proceed to removal of whole
folios: which find_get_entries() provides, even when partially covered.
Original patch by Rui Wang.
--- mm/shmem.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
mm/shmem.c +11 -0
@@ -958,6 +958,15 @@ static void shmem_undo_range(struct inod index++; } +/* +* When undoing a failed fallocate, we want none of the partial folio +* zeroing and splitting below, but shall want to truncate the whole +* folio when !uptodate indicates that it was added by this fallocate, +* even when [lstart, lend] covers only a part of the folio. +*/ +if (unfalloc) + goto whole_folios; + same_folio = (lstart >>PAGE_SHIFT ) == (lend >>PAGE_SHIFT ); folio =shmem_get_partial_folio (inode, lstart >>PAGE_SHIFT );if (folio) {
@@ -983,6 +992,8 @@ static void shmem_undo_range(struct inodfolio_put (folio); } +whole_folios: + index = start;while (index < end) {cond_resched ();
Greg Kroah-Hartman
maintainerPATCH 61/157 Bluetooth: btusb: Fix CSR clones again by re-adding ERR_DATA_REPORTING quirk
In reply to Greg Kroah-HartmanFrom: Ismael Ferreras Morezuelas <[email protected]>
commit 42d7731e3e7409f9444ff44e30c025958f1b14f0 upstream.
A patch series by a Qualcomm engineer essentially removed my quirk/workaround because they thought it was unnecessary.
It wasn't, and it broke everything again:
https://patchwork.kernel.org/project/netdevbpf/list/?series=661703&archive=both&state=*
He argues that the quirk is not necessary because the code should check if the dongle says if it's supported or not. The problem is that for these Chinese CSR clones they say that it would work:
= New Index: 00:00:00:00:00:00 (Primary,USB,hci0)
= Open Index: 00:00:00:00:00:00
< HCI Command: Read Local Version Information (0x04|0x0001) plen 0
Quoted 2 lines
HCI Event: Command Complete (
0x0e) plen 12
[hci0] 11.276039
Read Local Version Information (0x04|0x0001) ncmd 1
Status: Success (0x00)
HCI version: Bluetooth 5.0 (0x09) - Revision 2064 (0x0810)
LMP version: Bluetooth 5.0 (0x09) - Subversion 8978 (0x2312)
Manufacturer: Cambridge Silicon Radio (10)...
< HCI Command: Read Local Supported Features (0x04|0x0003) plen 0
Quoted 2 lines
HCI Event: Command Complete (
0x0e) plen 68
[hci0] 11.668030
Read Local Supported Commands (0x04|0x0002) ncmd 1
Status: Success (0x00)
Commands: 163 entries
...
Read Default Erroneous Data Reporting (Octet 18 - Bit 2)
Write Default Erroneous Data Reporting (Octet 18 - Bit 3)
......
< HCI Command: Read Default Erroneous Data Reporting (0x03|0x005a) plen 0 = Close Index: 00:1A:7D:DA:71:XX
So bring it back wholesale.
--- drivers/bluetooth/btusb.c | 1 + include/net/bluetooth/hci.h | 11 +++++++++++ net/bluetooth/hci_sync.c | 9 +++++++-- 3 files changed, 19 insertions(+), 2 deletions(-)
drivers/bluetooth/btusb.c +1 -0
@@ -2104,6 +2104,7 @@ static int btusb_setup_csr(struct hci_de* without these the controller will lock up. */ set_bit (HCI_QUIRK_BROKEN_STORED_LINK_KEY , &hdev->quirks); +set_bit (HCI_QUIRK_BROKEN_ERR_DATA_REPORTING , &hdev->quirks);set_bit (HCI_QUIRK_BROKEN_FILTER_CLEAR_ALL , &hdev->quirks);set_bit (HCI_QUIRK_NO_SUSPEND_NOTIFIER , &hdev->quirks);
include/net/bluetooth/hci.h +11 -0
@@ -228,6 +228,17 @@ enum {*/ HCI_QUIRK_VALID_LE_STATES , +/* When this quirk is set, then erroneous data reporting +* is ignored. This is mainly due to the fact that the HCI +* Read Default Erroneous Data Reporting command is advertised, +* but not supported; these controllers often reply with unknown +* command and tend to lock up randomly. Needing a hard reset. +* +* This quirk can be set before hci_register_dev is called or +* during the hdev->setup vendor callback. +*/ + HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, +/* * When this quirk is set, then the hci_suspend_notifier is not * registered. This is intended for devices which drop completely
net/bluetooth/hci_sync.c +7 -2
@@ -3459,7 +3459,8 @@ static int hci_read_page_scan_activity_sstatic int hci_read_def_err_data_reporting_sync (struct hci_dev *hdev) {if (!(hdev->commands[18 ] &0x04 ) || - !(hdev->features[0 ][6 ] &LMP_ERR_DATA_REPORTING )) + !(hdev->features[0 ][6 ] &LMP_ERR_DATA_REPORTING ) || +test_bit (HCI_QUIRK_BROKEN_ERR_DATA_REPORTING , &hdev->quirks))return 0 ; return __hci_cmd_sync_status(hdev, HCI_OP_READ_DEF_ERR_DATA_REPORTING,
@@ -3977,7 +3978,8 @@ static int hci_set_err_data_report_sync(bool enabled =hci_dev_test_flag (hdev,HCI_WIDEBAND_SPEECH_ENABLED );if (!(hdev->commands[18 ] &0x08 ) || - !(hdev->features[0 ][6 ] &LMP_ERR_DATA_REPORTING )) + !(hdev->features[0 ][6 ] &LMP_ERR_DATA_REPORTING ) || +test_bit (HCI_QUIRK_BROKEN_ERR_DATA_REPORTING , &hdev->quirks))return 0 ;if (enabled == hdev->err_data_reporting)
@@ -4136,6 +4138,9 @@ static const struct {HCI_QUIRK_BROKEN (STORED_LINK_KEY ,"HCI Delete Stored Link Key command is advertised, " "but not supported." ), +HCI_QUIRK_BROKEN (ERR_DATA_REPORTING , +"HCI Read Default Erroneous Data Reporting command is " +"advertised, but not supported." ),HCI_QUIRK_BROKEN (READ_TRANSMIT_POWER ,"HCI Read Transmit Power Level command is advertised, " "but not supported."),
Greg Kroah-Hartman
maintainerPATCH 62/157 Bluetooth: btusb: Add debug message for CSR controllers
In reply to Greg Kroah-HartmanFrom: Ismael Ferreras Morezuelas <[email protected]>
commit 955aebd445e2b49622f2184b7abb82b05c060549 upstream.
The rationale of showing this is that it's potentially critical information to diagnose and find more CSR compatibility bugs in the future and it will save a lot of headaches.
Given that clones come from a wide array of vendors (some are actually Barrot, some are something else) and these numbers are what let us find differences between actual and fake ones, it will be immensely helpful to scour the Internet looking for this pattern and building an actual database to find correlations and improve the checks.
--- drivers/bluetooth/btusb.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/bluetooth/btusb.c +5 -0
@@ -2042,6 +2042,11 @@ static int btusb_setup_csr(struct hci_de rp = (struct hci_rp_read_local_version *)skb->data; +bt_dev_info (hdev,"CSR: Setting up dongle with HCI ver=%u rev=%04x; LMP ver=%u subver=%04x; manufacturer=%u" , +le16_to_cpu (rp->hci_ver),le16_to_cpu (rp->hci_rev), +le16_to_cpu (rp->lmp_ver),le16_to_cpu (rp->lmp_subver), +le16_to_cpu (rp->manufacturer)); +/* Detect a wide host of Chinese controllers that aren't CSR. * * Known fake bcdDevices: 0x0100, 0x0134, 0x1915, 0x2520, 0x7558, 0x8891
Greg Kroah-Hartman
maintainerPATCH 63/157 Bluetooth: Fix crash when replugging CSR fake controllers
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
commit b5ca338751ad4783ec8d37b5d99c3e37b7813e59 upstream.
It seems fake CSR 5.0 clones can cause the suspend notifier to be registered twice causing the following kernel panic:
[ 71.986122] Call Trace: [ 71.986124] <TASK> [ 71.986125] blocking_notifier_chain_register+0x33/0x60 [ 71.986130] hci_register_dev+0x316/0x3d0 [bluetooth 99b5497ea3d09708fa1366c1dc03288bf3cca8da] [ 71.986154] btusb_probe+0x979/0xd85 [btusb e1e0605a4f4c01984a4b9c8ac58c3666ae287477] [ 71.986159] ? __pm_runtime_set_status+0x1a9/0x300 [ 71.986162] ? ktime_get_mono_fast_ns+0x3e/0x90 [ 71.986167] usb_probe_interface+0xe3/0x2b0 [ 71.986171] really_probe+0xdb/0x380 [ 71.986174] ? pm_runtime_barrier+0x54/0x90 [ 71.986177] __driver_probe_device+0x78/0x170 [ 71.986180] driver_probe_device+0x1f/0x90 [ 71.986183] __device_attach_driver+0x89/0x110 [ 71.986186] ? driver_allows_async_probing+0x70/0x70 [ 71.986189] bus_for_each_drv+0x8c/0xe0 [ 71.986192] __device_attach+0xb2/0x1e0 [ 71.986195] bus_probe_device+0x92/0xb0 [ 71.986198] device_add+0x422/0x9a0 [ 71.986201] ? sysfs_merge_group+0xd4/0x110 [ 71.986205] usb_set_configuration+0x57a/0x820 [ 71.986208] usb_generic_driver_probe+0x4f/0x70 [ 71.986211] usb_probe_device+0x3a/0x110 [ 71.986213] really_probe+0xdb/0x380 [ 71.986216] ? pm_runtime_barrier+0x54/0x90 [ 71.986219] __driver_probe_device+0x78/0x170 [ 71.986221] driver_probe_device+0x1f/0x90 [ 71.986224] __device_attach_driver+0x89/0x110 [ 71.986227] ? driver_allows_async_probing+0x70/0x70 [ 71.986230] bus_for_each_drv+0x8c/0xe0 [ 71.986232] __device_attach+0xb2/0x1e0 [ 71.986235] bus_probe_device+0x92/0xb0 [ 71.986237] device_add+0x422/0x9a0 [ 71.986239] ? _dev_info+0x7d/0x98 [ 71.986242] ? blake2s_update+0x4c/0xc0 [ 71.986246] usb_new_device.cold+0x148/0x36d [ 71.986250] hub_event+0xa8a/0x1910 [ 71.986255] process_one_work+0x1c4/0x380 [ 71.986259] worker_thread+0x51/0x390 [ 71.986262] ? rescuer_thread+0x3b0/0x3b0 [ 71.986264] kthread+0xdb/0x110 [ 71.986266] ? kthread_complete_and_exit+0x20/0x20 [ 71.986268] ret_from_fork+0x1f/0x30 [ 71.986273] </TASK> [ 71.986274] ---[ end trace 0000000000000000 ]--- [ 71.986284] btusb: probe of 2-1.6:1.0 failed with error -17
--- net/bluetooth/hci_core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/bluetooth/hci_core.c +6 -2
@@ -2757,7 +2757,8 @@ int hci_register_suspend_notifier(struct {int ret =0 ; -if (!test_bit (HCI_QUIRK_NO_SUSPEND_NOTIFIER , &hdev->quirks)) { +if (!hdev->suspend_notifier.notifier_call && + !test_bit (HCI_QUIRK_NO_SUSPEND_NOTIFIER , &hdev->quirks)) { hdev->suspend_notifier.notifier_call = hci_suspend_notifier; ret =register_pm_notifier (&hdev->suspend_notifier); }
@@ -2769,8 +2770,11 @@ int hci_unregister_suspend_notifier(stru {int ret =0 ; -if (!test_bit (HCI_QUIRK_NO_SUSPEND_NOTIFIER , &hdev->quirks)) +if (hdev->suspend_notifier.notifier_call) { ret =unregister_pm_notifier (&hdev->suspend_notifier); +if (!ret) + hdev->suspend_notifier.notifier_call =NULL ; + }return ret; }
Greg Kroah-Hartman
maintainerPATCH 64/157 selftests/tls: Fix tls selftests dependency to correct algorithm
In reply to Greg Kroah-HartmanFrom: Tianjia Zhang <[email protected]>
commit 6648eadba8d6b37c8e6cb1b906f68509b3b39385 upstream.
Commit d2825fa9365d ("crypto: sm3,sm4 - move into crypto directory") moves SM3 and SM4 algorithm implementations from stand-alone library to crypto API. The corresponding configuration options for the API version (generic) are CONFIG_CRYPTO_SM3_GENERIC and CONFIG_CRYPTO_SM4_GENERIC, respectively.
Replace option selected in selftests configuration from the library version to the API version.
--- tools/testing/selftests/net/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/config +1 -1
@@ -43,5 +43,5 @@ CONFIG_NET_ACT_TUNNEL_KEY=m CONFIG_NET_ACT_MIRRED=m CONFIG_BAREUDP=m CONFIG_IPV6_IOAM6_LWTUNNEL=y -CONFIG_CRYPTO_SM4=y +CONFIG_CRYPTO_SM4_GENERIC=y CONFIG_AMT=m
Signature · 1 line
2.38.1
Greg Kroah-Hartman
maintainerPATCH 65/157 net: mana: Fix race on per-CQ variable napi work_done
In reply to Greg Kroah-HartmanFrom: Haiyang Zhang <[email protected]>
commit 18010ff776fa42340efc428b3ea6d19b3e7c7b21 upstream.
After calling napi_complete_done(), the NAPIF_STATE_SCHED bit may be cleared, and another CPU can start napi thread and access per-CQ variable, cq->work_done. If the other thread (for example, from busy_poll) sets it to a value >= budget, this thread will continue to run when it should stop, and cause memory corruption and panic.
To fix this issue, save the per-CQ work_done variable in a local variable before napi_complete_done(), so it won't be corrupted by a possible concurrent thread after napi_complete_done().
Also, add a flag bit to advertise to the NIC firmware: the NAPI work_done variable race is fixed, so the driver is able to reliably support features like busy_poll.
--- drivers/net/ethernet/microsoft/mana/gdma.h | 9 ++++++++- drivers/net/ethernet/microsoft/mana/mana_en.c | 16 +++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-)
drivers/net/ethernet/microsoft/mana/gdma.h +8 -1
@@ -498,7 +498,14 @@ enum {#define GDMA_DRV_CAP_FLAG_1_EQ_SHARING_MULTI_VPORT BIT(0) -#define GDMA_DRV_CAP_FLAGS1 GDMA_DRV_CAP_FLAG_1_EQ_SHARING_MULTI_VPORT +/* Advertise to the NIC firmware: the NAPI work_done variable race is fixed, +* so the driver is able to reliably support features like busy_poll. +*/ +#define GDMA_DRV_CAP_FLAG_1_NAPI_WKDONE_FIX BIT(2) + +#define GDMA_DRV_CAP_FLAGS1 \ + (GDMA_DRV_CAP_FLAG_1_EQ_SHARING_MULTI_VPORT | \ + GDMA_DRV_CAP_FLAG_1_NAPI_WKDONE_FIX)#define GDMA_DRV_CAP_FLAGS2 0
drivers/net/ethernet/microsoft/mana/mana_en.c +11 -5
@@ -1303,10 +1303,11 @@ static void mana_poll_rx_cq(struct mana_xdp_do_flush (); } -static void mana_cq_handler (void *context,struct gdma_queue *gdma_queue) +static int mana_cq_handler (void *context,struct gdma_queue *gdma_queue) {struct mana_cq *cq = context;u8 arm_bit; +int w;WARN_ON_ONCE (cq->gdma_cq != gdma_queue);
@@ -1315,26 +1316,31 @@ static void mana_cq_handler(void *contexelse mana_poll_tx_cq (cq); -if (cq->work_done < cq->budget && -napi_complete_done (&cq->napi, cq->work_done)) { + w = cq->work_done; + +if (w < cq->budget && +napi_complete_done (&cq->napi, w)) { arm_bit =SET_ARM_BIT ; }else { arm_bit =0 ; }mana_gd_ring_cq (gdma_queue, arm_bit); + +return w; }static int mana_poll (struct napi_struct *napi,int budget) { struct mana_cq *cq = container_of(napi, struct mana_cq, napi); +int w; cq->work_done =0 ; cq->budget = budget; -mana_cq_handler (cq, cq->gdma_cq); + w =mana_cq_handler (cq, cq->gdma_cq); -return min (cq->work_done, budget); +return min (w, budget); }static void mana_schedule_napi (void *context,struct gdma_queue *gdma_queue)
Greg Kroah-Hartman
maintainerPATCH 66/157 io_uring: Fix a null-ptr-deref in io_tctx_exit_cb()
In reply to Greg Kroah-HartmanFrom: Harshit Mogalapalli <[email protected]>
commit 998b30c3948e4d0b1097e639918c5cff332acac5 upstream.
Syzkaller reports a NULL deref bug as follows:
BUG: KASAN: null-ptr-deref in io_tctx_exit_cb+0x53/0xd3 Read of size 4 at addr 0000000000000138 by task file1/1955 CPU: 1 PID: 1955 Comm: file1 Not tainted 6.1.0-rc7-00103-gef4d3ea40565 #75 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0xcd/0x134 ? io_tctx_exit_cb+0x53/0xd3 kasan_report+0xbb/0x1f0 ? io_tctx_exit_cb+0x53/0xd3 kasan_check_range+0x140/0x190 io_tctx_exit_cb+0x53/0xd3 task_work_run+0x164/0x250 ? task_work_cancel+0x30/0x30 get_signal+0x1c3/0x2440 ? lock_downgrade+0x6e0/0x6e0 ? lock_downgrade+0x6e0/0x6e0 ? exit_signals+0x8b0/0x8b0 ? do_raw_read_unlock+0x3b/0x70 ? do_raw_spin_unlock+0x50/0x230 arch_do_signal_or_restart+0x82/0x2470 ? kmem_cache_free+0x260/0x4b0 ? putname+0xfe/0x140 ? get_sigframe_size+0x10/0x10 ? do_execveat_common.isra.0+0x226/0x710 ? lockdep_hardirqs_on+0x79/0x100 ? putname+0xfe/0x140 ? do_execveat_common.isra.0+0x238/0x710 exit_to_user_mode_prepare+0x15f/0x250 syscall_exit_to_user_mode+0x19/0x50 do_syscall_64+0x42/0xb0 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0023:0x0 Code: Unable to access opcode bytes at 0xffffffffffffffd6. RSP: 002b:00000000fffb7790 EFLAGS: 00000200 ORIG_RAX: 000000000000000b RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 </TASK> Kernel panic - not syncing: panic_on_warn set ...
This happens because the adding of task_work from io_ring_exit_work() isn't synchronized with canceling all work items from eg exec. The execution of the two are ordered in that they are both run by the task itself, but if io_tctx_exit_cb() is queued while we're canceling all work items off exec AND gets executed when the task exits to userspace rather than in the main loop in io_uring_cancel_generic(), then we can find current->io_uring == NULL and hit the above crash.
It's safe to add this NULL check here, because the execution of the two paths are done by the task itself.
--- io_uring/io_uring.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
io_uring/io_uring.c +3 -1
@@ -2560,8 +2560,10 @@ static __cold void io_tctx_exit_cb(struc/* * When @in_idle, we're in cancellation and it's racy to remove the * node. It'll be removed by the end of cancellation, just ignore it. +* tctx can be NULL if the queueing of this task_work raced with +* work cancelation off the exec path. */ -if (!atomic_read (&tctx->in_idle)) +if (tctx && !atomic_read (&tctx->in_idle))io_uring_del_tctx_node ((unsigned long )work->ctx);complete (&work->completion); }
Greg Kroah-Hartman
maintainerPATCH 67/157 HID: uclogic: Fix frame templates for big endian architectures
In reply to Greg Kroah-HartmanFrom: José Expósito <[email protected]>
commit a6f4f1662711bd03308371d9649783a5be596898 upstream.
When parsing a frame template with a placeholder indicating the number of buttons present on the frame its value was incorrectly set on big endian architectures due to double little endian conversion.
In order to reproduce the issue and verify the fix, run the HID KUnit tests on the PowerPC architecture:
$ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/hid \
--arch=powerpc --cross_compile=powerpc64-linux-gnu---- drivers/hid/hid-uclogic-rdesc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-uclogic-rdesc.c +1 -1
@@ -1119,7 +1119,7 @@ __u8 *uclogic_rdesc_template_apply(const p[sizeof(btn_head)] < param_num) { v = param_list[p[sizeof(btn_head)]]; put_unaligned((__u8)0x2A, p); /* Usage Maximum */ - put_unaligned_le16((__force u16)cpu_to_le16(v), p + 1); + put_unaligned((__force u16)cpu_to_le16(v), (s16 *)(p + 1)); p += sizeof(btn_head) + 1; } else { p++;
Greg Kroah-Hartman
maintainerPATCH 68/157 KVM: s390: vsie: Fix the initialization of the epoch extension (epdx) field
In reply to Greg Kroah-HartmanFrom: Thomas Huth <[email protected]>
commit 0dd4cdccdab3d74bd86b868768a7dca216bcce7e upstream.
We recently experienced some weird huge time jumps in nested guests when rebooting them in certain cases. After adding some debug code to the epoch handling in vsie.c (thanks to David Hildenbrand for the idea!), it was obvious that the "epdx" field (the multi-epoch extension) did not get set to 0xff in case the "epoch" field was negative.
Seems like the code misses to copy the value from the epdx field from the guest to the shadow control block. By doing so, the weird time jumps are gone in our scenarios.
Message-Id: <[email protected]>
--- arch/s390/kvm/vsie.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/s390/kvm/vsie.c +3 -1
@@ -546,8 +546,10 @@ static int shadow_scb(struct kvm_vcpu *vif (test_kvm_cpu_feat (vcpu->kvm,KVM_S390_VM_CPU_FEAT_CEI )) scb_s->eca |= scb_o->eca &ECA_CEI ;/* Epoch Extension */ -if (test_kvm_facility (vcpu->kvm,139 )) +if (test_kvm_facility (vcpu->kvm,139 )) { scb_s->ecd |= scb_o->ecd &ECD_MEF ; + scb_s->epdx = scb_o->epdx; + }/* etoken */ if (test_kvm_facility (vcpu->kvm,156 ))
Greg Kroah-Hartman
maintainerPATCH 69/157 drm/vmwgfx: Dont use screen objects when SEV is active
In reply to Greg Kroah-HartmanFrom: Zack Rusin <[email protected]>
commit 6e90293618ed476d6b11f82ce724efbb9e9a071b upstream.
When SEV is enabled gmr's and mob's are explicitly disabled because the encrypted system memory can not be used by the hypervisor.
The driver was disabling GMR's but the presentation code, which depends on GMR's, wasn't honoring it which lead to black screen on hosts with SEV enabled.
Make sure screen objects presentation is not used when guest memory regions have been disabled to fix presentation on SEV enabled hosts.
--- drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +4 -0
@@ -950,6 +950,10 @@ int vmw_kms_sou_init_display(struct vmw_struct drm_device *dev = &dev_priv->drm;int i, ret; +/* Screen objects won't work if GMR's aren't available */ +if (!dev_priv->has_gmr) +return -ENOSYS ; +if (!(dev_priv->capabilities &SVGA_CAP_SCREEN_OBJECT_2 )) {return -ENOSYS ; }
Greg Kroah-Hartman
maintainerPATCH 70/157 can: can327: flush TX_work on ldisc .close()
In reply to Greg Kroah-HartmanFrom: Max Staudt <[email protected]>
commit f4a4d121ebecaa6f396f21745ce97de014281ccc upstream.
Additionally, remove it from .ndo_stop().
This ensures that the worker is not called after being freed, and that the UART TX queue remains active to send final commands when the netdev is stopped.
Thanks to Jiri Slaby for finding this in slcan:
https://lore.kernel.org/linux-can/[email protected]/
A variant of this patch for slcan, with the flush in .ndo_stop() still present, has been tested successfully on physical hardware:
https://bugzilla.suse.com/show_bug.cgi?id=1205597
--- drivers/net/can/can327.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/net/can/can327.c +10 -7
@@ -796,9 +796,9 @@ static int can327_netdev_close(struct net_device *dev)netif_stop_queue (dev); -/* Give UART one final chance to flush. */ -clear_bit (TTY_DO_WRITE_WAKEUP , &elm->tty->flags); -flush_work (&elm->tx_work); +/* We don't flush the UART TX queue here, as we want final stop +* commands (like the above dummy char) to be flushed out. +*/ can_rx_offload_disable (&elm->offload); elm->can.state =CAN_STATE_STOPPED ;
@@ -1069,12 +1069,15 @@ static void can327_ldisc_close(struct tty_struct *tty) {struct can327 *elm = (struct can327 *)tty->disc_data; -/* unregister_netdev() calls .ndo_stop() so we don't have to. -* Our .ndo_stop() also flushes the TTY write wakeup handler, -* so we can safely set elm->tty = NULL after this. -*/ +/* unregister_netdev() calls .ndo_stop() so we don't have to. */ unregister_candev (elm->dev); +/* Give UART one final chance to flush. +* No need to clear TTY_DO_WRITE_WAKEUP since .write_wakeup() is +* serialised against .close() and will not be called once we return. +*/ +flush_work (&elm->tx_work); +/* Mark channel as dead */ spin_lock_bh (&elm->lock); tty->disc_data =NULL ;
Signature · 1 line
2.38.1
Re: [PATCH 6.0 070/157] can: can327: flush TX_work on ldisc .close()
This series was applied to bpf/bpf-next.git (master) by Marc Kleine-Budde <[email protected]>:
Hello:
This series was applied to bpf/bpf-next.git (master) by Marc Kleine-Budde <[email protected]>:
Quoted 11 lines · On Mon, 12 Dec 2022 14:16:58 +0100 you wrote:
From: Max Staudt <[email protected]>
commit
f4a4d121ebecaa6f396f21745ce97de014281cccupstream.Additionally, remove it from .ndo_stop().
This ensures that the worker is not called after being freed, and that the UART TX queue remains active to send final commands when the netdev is stopped.
[...]
Here is the summary with links:
- [6.0,070/157] can: can327: flush TX_work on ldisc .close()
https://git.kernel.org/bpf/bpf-next/c/f4a4d121ebec - [6.0,071/157] can: slcan: fix freed work crash https://git.kernel.org/bpf/bpf-next/c/fb855e9f3b6b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Greg Kroah-Hartman
maintainerPATCH 71/157 can: slcan: fix freed work crash
In reply to Greg Kroah-HartmanFrom: Jiri Slaby (SUSE) <[email protected]>
commit fb855e9f3b6b42c72af3f1eb0b288998fe0d5ebb upstream.
The LTP test pty03 is causing a crash in slcan:
BUG: kernel NULL pointer dereference, address: 0000000000000008 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP NOPTI CPU: 0 PID: 348 Comm: kworker/0:3 Not tainted 6.0.8-1-default #1 openSUSE Tumbleweed 9d20364b934f5aab0a9bdf84e8f45cfdfae39dab Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.15.0-0-g2dd4b9b-rebuilt.opensuse.org 04/01/2014 Workqueue: 0x0 (events) RIP: 0010:process_one_work (/home/rich/kernel/linux/kernel/workqueue.c:706 /home/rich/kernel/linux/kernel/workqueue.c:2185) Code: 49 89 ff 41 56 41 55 41 54 55 53 48 89 f3 48 83 ec 10 48 8b 06 48 8b 6f 48 49 89 c4 45 30 e4 a8 04 b8 00 00 00 00 4c 0f 44 e0 <49> 8b 44 24 08 44 8b a8 00 01 00 00 41 83 e5 20 f6 45 10 04 75 0e RSP: 0018:ffffaf7b40f47e98 EFLAGS: 00010046 RAX: 0000000000000000 RBX: ffff9d644e1b8b48 RCX: ffff9d649e439968 RDX: 00000000ffff8455 RSI: ffff9d644e1b8b48 RDI: ffff9d64764aa6c0 RBP: ffff9d649e4335c0 R08: 0000000000000c00 R09: ffff9d64764aa734 R10: 0000000000000007 R11: 0000000000000001 R12: 0000000000000000 R13: ffff9d649e4335e8 R14: ffff9d64490da780 R15: ffff9d64764aa6c0 FS: 0000000000000000(0000) GS:ffff9d649e400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000008 CR3: 0000000036424000 CR4: 00000000000006f0 Call Trace: <TASK> worker_thread (/home/rich/kernel/linux/kernel/workqueue.c:2436) kthread (/home/rich/kernel/linux/kernel/kthread.c:376) ret_from_fork (/home/rich/kernel/linux/arch/x86/entry/entry_64.S:312)
Apparently, the slcan's tx_work is freed while being scheduled. While slcan_netdev_close() (netdev side) calls flush_work(&sl->tx_work), slcan_close() (tty side) does not. So when the netdev is never set UP, but the tty is stuffed with bytes and forced to wakeup write, the work is scheduled, but never flushed.
So add an additional flush_work() to slcan_close() to be sure the work is flushed under all circumstances.
The Fixes commit below moved flush_work() from slcan_close() to slcan_netdev_close(). What was the rationale behind it? Maybe we can drop the one in slcan_netdev_close()?
I see the same pattern in can327. So it perhaps needs the very same fix.
--- drivers/net/can/slcan/slcan-core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/can/slcan/slcan-core.c +6 -4
@@ -864,12 +864,14 @@ static void slcan_close(struct tty_struct *tty) {struct slcan *sl = (struct slcan *)tty->disc_data; -/* unregister_netdev() calls .ndo_stop() so we don't have to. -* Our .ndo_stop() also flushes the TTY write wakeup handler, -* so we can safely set sl->tty = NULL after this. -*/ unregister_candev (sl->dev); +/* +* The netdev needn't be UP (so .ndo_stop() is not called). Hence make +* sure this is not running before freeing it up. +*/ +flush_work (&sl->tx_work); +/* Mark channel as dead */ spin_lock_bh (&sl->lock); tty->disc_data =NULL ;
Signature · 1 line
2.38.1
Greg Kroah-Hartman
maintainerPATCH 72/157 can: esd_usb: Allow REC and TEC to return to zero
In reply to Greg Kroah-HartmanFrom: Frank Jungclaus <[email protected]>
commit 918ee4911f7a41fb4505dff877c1d7f9f64eb43e upstream.
We don't get any further EVENT from an esd CAN USB device for changes on REC or TEC while those counters converge to 0 (with ecc == 0). So when handling the "Back to Error Active"-event force txerr = rxerr = 0, otherwise the berr-counters might stay on values like 95 forever.
Also, to make life easier during the ongoing development a netdev_dbg() has been introduced to allow dumping error events send by an esd CAN USB device.
--- drivers/net/can/usb/esd_usb.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/can/usb/esd_usb.c +6 -0
@@ -234,6 +234,10 @@ static void esd_usb_rx_event(struct esd_u8 rxerr = msg->msg.rx.data[2 ];u8 txerr = msg->msg.rx.data[3 ]; +netdev_dbg (priv->netdev, +"CAN_ERR_EV_EXT: dlc=%#02x state=%02x ecc=%02x rec=%02x tec=%02x\n" , + msg->msg.rx.dlc, state, ecc, rxerr, txerr); + skb =alloc_can_err_skb (priv->netdev, &cf);if (skb ==NULL ) { stats->rx_dropped++;
@@ -260,6 +264,8 @@ static void esd_usb_rx_event(struct esd_break ;default : priv->can.state =CAN_STATE_ERROR_ACTIVE ; + txerr =0 ; + rxerr =0 ;break ; } }else {
Greg Kroah-Hartman
maintainerPATCH 73/157 drm/amdgpu/sdma_v4_0: turn off SDMA ring buffer in the s2idle suspend
In reply to Greg Kroah-HartmanFrom: Prike Liang <[email protected]>
commit bc21fe9a5844c5bc8f7ec319b11d2671a94eb867 upstream.
In the SDMA s0ix save process requires to turn off SDMA ring buffer for avoiding the SDMA in-flight request, otherwise will suffer from SDMA page fault which causes by page request from in-flight SDMA ring accessing at SDMA restore phase.
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +15 -9
@@ -980,13 +980,13 @@ static void sdma_v4_0_ring_emit_fence(st/** -* sdma_v4_0_gfx_stop - stop the gfx async dma engines +* sdma_v4_0_gfx_enable - enable the gfx async dma engines * * @adev: amdgpu_device pointer -* -* Stop the gfx async dma ring buffers (VEGA10). +* @enable: enable SDMA RB/IB +* control the gfx async dma ring buffers (VEGA10). */ -static void sdma_v4_0_gfx_stop (struct amdgpu_device *adev) +static void sdma_v4_0_gfx_enable (struct amdgpu_device *adev,bool enable) {struct amdgpu_ring *sdma[AMDGPU_MAX_SDMA_INSTANCES ];u32 rb_cntl, ib_cntl;
@@ -1001,10 +1001,10 @@ static void sdma_v4_0_gfx_stop(struct am } rb_cntl =RREG32_SDMA (i, mmSDMA0_GFX_RB_CNTL); - rb_cntl =REG_SET_FIELD (rb_cntl,SDMA0_GFX_RB_CNTL ,RB_ENABLE ,0 ); + rb_cntl =REG_SET_FIELD (rb_cntl,SDMA0_GFX_RB_CNTL ,RB_ENABLE , enable ?1 :0 );WREG32_SDMA (i, mmSDMA0_GFX_RB_CNTL, rb_cntl); ib_cntl =RREG32_SDMA (i, mmSDMA0_GFX_IB_CNTL); - ib_cntl =REG_SET_FIELD (ib_cntl,SDMA0_GFX_IB_CNTL ,IB_ENABLE ,0 ); + ib_cntl =REG_SET_FIELD (ib_cntl,SDMA0_GFX_IB_CNTL ,IB_ENABLE , enable ?1 :0 );WREG32_SDMA (i, mmSDMA0_GFX_IB_CNTL, ib_cntl); } }
@@ -1131,7 +1131,7 @@ static void sdma_v4_0_enable(struct amdgint i;if (!enable) { -sdma_v4_0_gfx_stop (adev); +sdma_v4_0_gfx_enable (adev, enable);sdma_v4_0_rlc_stop (adev);if (adev->sdma.has_page_queue)sdma_v4_0_page_stop (adev);
@@ -2043,8 +2043,10 @@ static int sdma_v4_0_suspend(void *handlstruct amdgpu_device *adev = (struct amdgpu_device *)handle;/* SMU saves SDMA state for us */ -if (adev->in_s0ix) +if (adev->in_s0ix) { +sdma_v4_0_gfx_enable (adev, false);return 0 ; + }return sdma_v4_0_hw_fini (adev); }
@@ -2054,8 +2056,12 @@ static int sdma_v4_0_resume(void *handlestruct amdgpu_device *adev = (struct amdgpu_device *)handle;/* SMU restores SDMA state for us */ -if (adev->in_s0ix) +if (adev->in_s0ix) { +sdma_v4_0_enable (adev, true); +sdma_v4_0_gfx_enable (adev, true); +amdgpu_ttm_set_buffer_funcs_status (adev, true);return 0 ; + }return sdma_v4_0_hw_init (adev); }
Greg Kroah-Hartman
maintainerPATCH 74/157 drm/amd/display: fix array index out of bound error in DCN32 DML
In reply to Greg Kroah-HartmanFrom: Aurabindo Pillai <[email protected]>
commit aeffc8fb2174f017a10df114bc312f899904dc68 upstream.
[Why&How]
LinkCapacitySupport array is indexed with the number of voltage states and not the number of max DPPs. Fix the error by changing the array declaration to use the correct (larger) array size of total number of voltage states.
--- drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h +1 -1
@@ -1152,7 +1152,7 @@ struct vba_vars_st {double UrgBurstFactorLumaPre[DC__NUM_DPP__MAX ];double UrgBurstFactorChromaPre[DC__NUM_DPP__MAX ];bool NotUrgentLatencyHidingPre[DC__NUM_DPP__MAX ]; -bool LinkCapacitySupport[DC__NUM_DPP__MAX ]; +bool LinkCapacitySupport[DC__VOLTAGE_STATES ];bool VREADY_AT_OR_AFTER_VSYNC [DC__NUM_DPP__MAX ];unsigned int MIN_DST_Y_NEXT_START [DC__NUM_DPP__MAX ];unsigned int VFrontPorch[DC__NUM_DPP__MAX ];
Greg Kroah-Hartman
maintainerPATCH 75/157 drm/shmem-helper: Remove errant put in error path
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
commit 24013314be6ee4ee456114a671e9fa3461323de8 upstream.
drm_gem_shmem_mmap() doesn't own this reference, resulting in the GEM object getting prematurely freed leading to a later use-after-free.
--- drivers/gpu/drm/drm_gem_shmem_helper.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/drm_gem_shmem_helper.c +1 -3
@@ -622,10 +622,8 @@ int drm_gem_shmem_mmap(struct drm_gem_sh } ret =drm_gem_shmem_get_pages (shmem); -if (ret) { -drm_gem_vm_close (vma); +if (ret)return ret; - } vma->vm_flags |=VM_PFNMAP |VM_DONTEXPAND |VM_DONTDUMP ; vma->vm_page_prot =vm_get_page_prot (vma->vm_flags);
Greg Kroah-Hartman
maintainerPATCH 76/157 drm/shmem-helper: Avoid vm_open error paths
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
commit 09bf649a74573cb596e211418a4f8008f265c5a9 upstream.
vm_open() is not allowed to fail. Fortunately we are guaranteed that the pages are already pinned, thanks to the initial mmap which is now being cloned into a forked process, and only need to increment the refcnt. So just increment it directly. Previously if a signal was delivered at the wrong time to the forking process, the mutex_lock_interruptible() could fail resulting in the pages_use_count not being incremented.
--- drivers/gpu/drm/drm_gem_shmem_helper.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_gem_shmem_helper.c +11 -3
@@ -571,12 +571,20 @@ static void drm_gem_shmem_vm_open(struct {struct drm_gem_object *obj = vma->vm_private_data;struct drm_gem_shmem_object *shmem =to_drm_gem_shmem_obj (obj); -int ret;WARN_ON (shmem->base.import_attach); - ret =drm_gem_shmem_get_pages (shmem); -WARN_ON_ONCE (ret !=0 ); +mutex_lock (&shmem->pages_lock); + +/* +* We should have already pinned the pages when the buffer was first +* mmap'd, vm_open() just grabs an additional reference for the new +* mm the vma is getting copied into (ie. on fork()). +*/ +if (!WARN_ON_ONCE (!shmem->pages_use_count)) + shmem->pages_use_count++; + +mutex_unlock (&shmem->pages_lock);drm_gem_vm_open (vma); }
Greg Kroah-Hartman
maintainerPATCH 77/157 net: dsa: sja1105: avoid out of bounds access in sja1105_init_l2_policing()
In reply to Greg Kroah-HartmanFrom: Radu Nicolae Pirea (OSS) <[email protected]>
commit f8bac7f9fdb0017b32157957ffffd490f95faa07 upstream.
The SJA1105 family has 45 L2 policing table entries (SJA1105_MAX_L2_POLICING_COUNT) and SJA1110 has 110 (SJA1110_MAX_L2_POLICING_COUNT). Keeping the table structure but accounting for the difference in port count (5 in SJA1105 vs 10 in SJA1110) does not fully explain the difference. Rather, the SJA1110 also has L2 ingress policers for multicast traffic. If a packet is classified as multicast, it will be processed by the policer index 99 + SRCPORT.
The sja1105_init_l2_policing() function initializes all L2 policers such that they don't interfere with normal packet reception by default. To have a common code between SJA1105 and SJA1110, the index of the multicast policer for the port is calculated because it's an index that is out of bounds for SJA1105 but in bounds for SJA1110, and a bounds check is performed.
The code fails to do the proper thing when determining what to do with the multicast policer of port 0 on SJA1105 (ds->num_ports = 5). The "mcast" index will be equal to 45, which is also equal to table->ops->max_entry_count (SJA1105_MAX_L2_POLICING_COUNT). So it passes through the check. But at the same time, SJA1105 doesn't have multicast policers. So the code programs the SHARINDX field of an out-of-bounds element in the L2 Policing table of the static config.
The comparison between index 45 and 45 entries should have determined the code to not access this policer index on SJA1105, since its memory wasn't even allocated.
With enough bad luck, the out-of-bounds write could even overwrite other valid kernel data, but in this case, the issue was detected using KASAN.
Kernel log:
sja1105 spi5.0: Probed switch chip: SJA1105Q
==================================================================
BUG: KASAN: slab-out-of-bounds in sja1105_setup+0x1cbc/0x2340 Write of size 8 at addr ffffff880bd57708 by task kworker/u8:0/8 ... Workqueue: events_unbound deferred_probe_work_func Call trace: ... sja1105_setup+0x1cbc/0x2340 dsa_register_switch+0x1284/0x18d0 sja1105_probe+0x748/0x840 ... Allocated by task 8: ... sja1105_setup+0x1bcc/0x2340 dsa_register_switch+0x1284/0x18d0 sja1105_probe+0x748/0x840
...
--- drivers/net/dsa/sja1105/sja1105_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/sja1105/sja1105_main.c +1 -1
@@ -1038,7 +1038,7 @@ static int sja1105_init_l2_policing(stru policing[bcast].sharindx = port;/* Only SJA1110 has multicast policers */ -if (mcast <= table->ops->max_entry_count) +if (mcast < table->ops->max_entry_count) policing[mcast].sharindx = port; }
Greg Kroah-Hartman
maintainerPATCH 78/157 HID: usbhid: Add ALWAYS_POLL quirk for some mice
In reply to Greg Kroah-HartmanFrom: Ankit Patel <[email protected]>
commit f6d910a89a2391e5ce1f275d205023880a33d3f8 upstream.
Some additional USB mouse devices are needing ALWAYS_POLL quirk without which they disconnect and reconnect every 60s.
Add below devices to the known quirk list.
CHERRY VID 0x046a, PID 0x000c
MICROSOFT VID 0x045e, PID 0x0783
PRIMAX VID 0x0461, PID 0x4e2a
--- drivers/hid/hid-ids.h | 3 +++ drivers/hid/hid-quirks.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/hid/hid-ids.h +3 -0
@@ -274,6 +274,7 @@#define USB_DEVICE_ID_CH_AXIS_295 0x001c#define USB_VENDOR_ID_CHERRY 0x046a +#define USB_DEVICE_ID_CHERRY_MOUSE_000C 0x000c#define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023#define USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR 0x0027
@@ -917,6 +918,7 @@#define USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER 0x02fd#define USB_DEVICE_ID_MS_PIXART_MOUSE 0x00cb#define USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS 0x02e0 +#define USB_DEVICE_ID_MS_MOUSE_0783 0x0783#define USB_VENDOR_ID_MOJO 0x8282#define USB_DEVICE_ID_RETRO_ADAPTER 0x3201
@@ -1379,6 +1381,7 @@#define USB_VENDOR_ID_PRIMAX 0x0461#define USB_DEVICE_ID_PRIMAX_MOUSE_4D22 0x4d22 +#define USB_DEVICE_ID_PRIMAX_MOUSE_4E2A 0x4e2a#define USB_DEVICE_ID_PRIMAX_KEYBOARD 0x4e05#define USB_DEVICE_ID_PRIMAX_REZEL 0x4e72#define USB_DEVICE_ID_PRIMAX_PIXART_MOUSE_4D0F 0x4d0f
drivers/hid/hid-quirks.c +3 -0
@@ -54,6 +54,7 @@ static const struct hid_device_id hid_qu { HID_USB_DEVICE(USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE), HID_QUIRK_NOGET }, { HID_USB_DEVICE(USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_PEDALS), HID_QUIRK_NOGET }, { HID_USB_DEVICE(USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_THROTTLE), HID_QUIRK_NOGET }, + { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_MOUSE_000C), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K65RGB), HID_QUIRK_NO_INIT_REPORTS }, { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K65RGB_RAPIDFIRE), HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K70RGB), HID_QUIRK_NO_INIT_REPORTS },
@@ -122,6 +123,7 @@ static const struct hid_device_id hid_qu { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C05A), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C06A), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_MCS, USB_DEVICE_ID_MCS_GAMEPADBLOCK), HID_QUIRK_MULTI_INPUT }, + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_MOUSE_0783), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PIXART_MOUSE), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER), HID_QUIRK_NO_INIT_REPORTS }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE3_COVER), HID_QUIRK_NO_INIT_REPORTS },
@@ -146,6 +148,7 @@ static const struct hid_device_id hid_qu { HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN), HID_QUIRK_NO_INIT_REPORTS }, { HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_MOUSE_4D22), HID_QUIRK_ALWAYS_POLL }, + { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_MOUSE_4E2A), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_PIXART_MOUSE_4D0F), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_PIXART_MOUSE_4D65), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_PIXART_MOUSE_4E22), HID_QUIRK_ALWAYS_POLL },
Greg Kroah-Hartman
maintainerPATCH 79/157 HID: fix I2C_HID not selected when I2C_HID_OF_ELAN is
In reply to Greg Kroah-HartmanFrom: Benjamin Tissoires <[email protected]>
commit 2afac81dd16544d825f309fd992d2af6304353df upstream.
When I2C_HID_OF_ELAN is set, we need to turn on I2C_HID_CORE to ensure we get all the HID requirements.
--- drivers/hid/i2c-hid/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/i2c-hid/Kconfig +2 -2
@@ -66,6 +66,6 @@ endmenu config I2C_HID_CORE tristate - default y if I2C_HID_ACPI=y || I2C_HID_OF=y || I2C_HID_OF_GOODIX=y - default m if I2C_HID_ACPI=m || I2C_HID_OF=m || I2C_HID_OF_GOODIX=m + default y if I2C_HID_ACPI=y || I2C_HID_OF=y || I2C_HID_OF_ELAN=y || I2C_HID_OF_GOODIX=y + default m if I2C_HID_ACPI=m || I2C_HID_OF=m || I2C_HID_OF_ELAN=m || I2C_HID_OF_GOODIX=m select HID
Signature · 1 line
2.38.1
Greg Kroah-Hartman
maintainerPATCH 80/157 HID: uclogic: Add HID_QUIRK_HIDINPUT_FORCE quirk
In reply to Greg Kroah-HartmanFrom: José Expósito <[email protected]>
commit 3405a4beaaa852f3ed2a5eb3b5149932d5c3779b upstream.
Commit f7d8e387d9ae ("HID: uclogic: Switch to Digitizer usage for styluses") changed the usage used in UCLogic from "Pen" to "Digitizer".
However, the IS_INPUT_APPLICATION() macro evaluates to false for HID_DG_DIGITIZER causing issues with the XP-Pen Star G640 tablet.
Add the HID_QUIRK_HIDINPUT_FORCE quirk to bypass the IS_INPUT_APPLICATION() check.
--- drivers/hid/hid-uclogic-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/hid/hid-uclogic-core.c +1 -0
@@ -192,6 +192,7 @@ static int uclogic_probe(struct hid_device *hdev,* than the pen, so use QUIRK_MULTI_INPUT for all tablets. */ hdev->quirks |=HID_QUIRK_MULTI_INPUT ; + hdev->quirks |=HID_QUIRK_HIDINPUT_FORCE ;/* Allocate and assign driver data */ drvdata =devm_kzalloc (&hdev->dev,sizeof (*drvdata),GFP_KERNEL );
Signature · 1 line
2.38.1
Greg Kroah-Hartman
maintainerPATCH 81/157 HID: hid-lg4ff: Add check for empty lbuf
In reply to Greg Kroah-HartmanFrom: Anastasia Belova <[email protected]>
commit d180b6496143cd360c5d5f58ae4b9a8229c1f344 upstream.
If an empty buf is received, lbuf is also empty. So lbuf is accessed by index -1.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/hid/hid-lg4ff.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/hid/hid-lg4ff.c +6 -0
@@ -872,6 +872,12 @@ static ssize_t lg4ff_alternate_modes_storeturn -ENOMEM ; i =strlen (lbuf); + +if (i ==0 ) { +kfree (lbuf); +return -EINVAL ; + } +if (lbuf[i-1 ] =='\n' ) {if (i ==1 ) {kfree (lbuf);
Greg Kroah-Hartman
maintainerPATCH 82/157 HID: core: fix shift-out-of-bounds in hid_report_raw_event
In reply to Greg Kroah-HartmanFrom: ZhangPeng <[email protected]>
commit ec61b41918587be530398b0d1c9a0d16619397e5 upstream.
Syzbot reported shift-out-of-bounds in hid_report_raw_event.
microsoft 0003:045E:07DA.0001: hid_field_extract() called with n (128) > 32! (swapper/0)
======================================================================
UBSAN: shift-out-of-bounds in drivers/hid/hid-core.c:1323:20 shift exponent 127 is too large for 32-bit type 'int' CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.1.0-rc4-syzkaller-00159-g4bbf3422df78 #0 Hardware name: Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: <IRQ> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 ubsan_epilogue lib/ubsan.c:151 [inline] __ubsan_handle_shift_out_of_bounds+0x3a6/0x420 lib/ubsan.c:322 snto32 drivers/hid/hid-core.c:1323 [inline] hid_input_fetch_field drivers/hid/hid-core.c:1572 [inline] hid_process_report drivers/hid/hid-core.c:1665 [inline] hid_report_raw_event+0xd56/0x18b0 drivers/hid/hid-core.c:1998 hid_input_report+0x408/0x4f0 drivers/hid/hid-core.c:2066 hid_irq_in+0x459/0x690 drivers/hid/usbhid/hid-core.c:284 __usb_hcd_giveback_urb+0x369/0x530 drivers/usb/core/hcd.c:1671 dummy_timer+0x86b/0x3110 drivers/usb/gadget/udc/dummy_hcd.c:1988 call_timer_fn+0xf5/0x210 kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1519 [inline] __run_timers+0x76a/0x980 kernel/time/timer.c:1790 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1803 __do_softirq+0x277/0x75b kernel/softirq.c:571 __irq_exit_rcu+0xec/0x170 kernel/softirq.c:650 irq_exit_rcu+0x5/0x20 kernel/softirq.c:662 sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1107 ======================================================================
If the size of the integer (unsigned n) is bigger than 32 in snto32(), shift exponent will be too large for 32-bit type 'int', resulting in a shift-out-of-bounds bug.
Fix this by adding a check on the size of the integer (unsigned n) in snto32(). To add support for n greater than 32 bits, set n to 32, if n is greater than 32.
--- drivers/hid/hid-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/hid/hid-core.c +3 -0
@@ -1315,6 +1315,9 @@ static s32 snto32(__u32 value, unsignedif (!value || !n)return 0 ; +if (n >32 ) + n =32 ; +switch (n) {case 8 :return ((__s8 )value);case 16 :return ((__s16 )value);
Greg Kroah-Hartman
maintainerPATCH 83/157 HID: ite: Enable QUIRK_TOUCHPAD_ON_OFF_REPORT on Acer Aspire Switch V 10
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit 9ad6645a9dce4d0e42daca6ebf32a154401c59d3 upstream.
The Acer Aspire Switch V 10 (SW5-017)'s keyboard-dock uses the same ITE controller setup as other Acer Switch 2-in-1's.
This needs special handling for the wifi on/off toggle hotkey as well as to properly report touchpad on/off keypresses.
Add the USB-ids for the SW5-017's keyboard-dock with a quirk setting of QUIRK_TOUCHPAD_ON_OFF_REPORT to fix both issues.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-ite.c | 5 +++++ 2 files changed, 6 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -1217,6 +1217,7 @@#define USB_DEVICE_ID_SYNAPTICS_DELL_K15A 0x6e21#define USB_DEVICE_ID_SYNAPTICS_ACER_ONE_S1002 0x73f4#define USB_DEVICE_ID_SYNAPTICS_ACER_ONE_S1003 0x73f5 +#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_017 0x73f6#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5 0x81a7#define USB_VENDOR_ID_TEXAS_INSTRUMENTS 0x2047
drivers/hid/hid-ite.c +5 -0
@@ -121,6 +121,11 @@ static const struct hid_device_id ite_de USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_ACER_ONE_S1003), .driver_data = QUIRK_TOUCHPAD_ON_OFF_REPORT }, +/* ITE8910 USB kbd ctlr, with Synaptics touchpad connected to it. */ + { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, +USB_VENDOR_ID_SYNAPTICS , +USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_017 ), + .driver_data = QUIRK_TOUCHPAD_ON_OFF_REPORT }, { } };MODULE_DEVICE_TABLE (hid, ite_devices);
Greg Kroah-Hartman
maintainerPATCH 84/157 ARM: 9278/1: kfence: only handle translation faults
In reply to Greg Kroah-HartmanFrom: Wang Kefeng <[email protected]>
commit 73a0b6ee5d6269f92df43e1d09b3278a2886bf8a upstream.
This is a similar fixup like arm64 does, only handle translation faults in case of unexpected kfence report when alignment faults on ARM, see more from commit 0bb1fbffc631 ("arm64: mm: kfence: only handle translation faults").
--- arch/arm/mm/fault.c | 18 ++++++++++++++++-- arch/arm/mm/fault.h | 9 ++++++--- 2 files changed, 22 insertions(+), 5 deletions(-)
arch/arm/mm/fault.c +16 -2
@@ -105,6 +105,19 @@ static inline bool is_write_fault(unsignreturn (fsr &FSR_WRITE ) && !(fsr &FSR_CM ); } +static inline bool is_translation_fault (unsigned int fsr) +{ +int fs =fsr_fs (fsr); +#ifdef CONFIG_ARM_LPAE +if ((fs &FS_MMU_NOLL_MASK ) ==FS_TRANS_NOLL ) +return true; +#else +if (fs ==FS_L1_TRANS || fs ==FS_L2_TRANS ) +return true; +#endif +return false; +} +static void die_kernel_fault (const char *msg,struct mm_struct *mm,unsigned long addr,unsigned int fsr,struct pt_regs *regs)
@@ -140,7 +153,8 @@ __do_kernel_fault(struct mm_struct *mm,if (addr <PAGE_SIZE ) { msg ="NULL pointer dereference" ; }else { -if (kfence_handle_page_fault (addr,is_write_fault (fsr), regs)) +if (is_translation_fault (fsr) && +kfence_handle_page_fault (addr,is_write_fault (fsr), regs))return ; msg ="paging request" ;
@@ -208,7 +222,7 @@ static inline bool is_permission_fault(u {int fs =fsr_fs (fsr);#ifdef CONFIG_ARM_LPAE -if ((fs &FS_PERM_NOLL_MASK ) ==FS_PERM_NOLL ) +if ((fs &FS_MMU_NOLL_MASK ) ==FS_PERM_NOLL )return true;#else if (fs ==FS_L1_PERM || fs ==FS_L2_PERM )
arch/arm/mm/fault.h +6 -3
@@ -14,8 +14,9 @@#ifdef CONFIG_ARM_LPAE #define FSR_FS_AEA 17 +#define FS_TRANS_NOLL 0x4#define FS_PERM_NOLL 0xC -#define FS_PERM_NOLL_MASK 0x3C +#define FS_MMU_NOLL_MASK 0x3Cstatic inline int fsr_fs (unsigned int fsr) {
@@ -23,8 +24,10 @@ static inline int fsr_fs(unsigned int fs }#else #define FSR_FS_AEA 22 -#define FS_L1_PERM 0xD -#define FS_L2_PERM 0xF +#define FS_L1_TRANS 0x5 +#define FS_L2_TRANS 0x7 +#define FS_L1_PERM 0xD +#define FS_L2_PERM 0xFstatic inline int fsr_fs (unsigned int fsr) {
Greg Kroah-Hartman
maintainerPATCH 85/157 can: af_can: fix NULL pointer dereference in can_rcv_filter
In reply to Greg Kroah-HartmanFrom: Oliver Hartkopp <[email protected]>
commit 0acc442309a0a1b01bcdaa135e56e6398a49439c upstream.
Analogue to commit 8aa59e355949 ("can: af_can: fix NULL pointer dereference in can_rx_register()") we need to check for a missing initialization of ml_priv in the receive path of CAN frames.
Since commit 4e096a18867a ("net: introduce CAN specific pointer in the struct net_device") the check for dev->type to be ARPHRD_CAN is not sufficient anymore since bonding or tun netdevices claim to be CAN devices but do not initialize ml_priv accordingly.
--- net/can/af_can.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/can/af_can.c +2 -2
@@ -680,7 +680,7 @@ static int can_rcv(struct sk_buff *skb, {struct canfd_frame *cfd = (struct canfd_frame *)skb->data; -if (unlikely (dev->type !=ARPHRD_CAN || skb->len !=CAN_MTU )) { +if (unlikely (dev->type !=ARPHRD_CAN || !can_get_ml_priv (dev) || skb->len !=CAN_MTU )) {pr_warn_once ("PF_CAN: dropped non conform CAN skbuff: dev type %d, len %d\n" , dev->type, skb->len); goto free_skb;
@@ -706,7 +706,7 @@ static int canfd_rcv(struct sk_buff *skb {struct canfd_frame *cfd = (struct canfd_frame *)skb->data; -if (unlikely (dev->type !=ARPHRD_CAN || skb->len !=CANFD_MTU )) { +if (unlikely (dev->type !=ARPHRD_CAN || !can_get_ml_priv (dev) || skb->len !=CANFD_MTU )) {pr_warn_once ("PF_CAN: dropped non conform CAN FD skbuff: dev type %d, len %d\n" , dev->type, skb->len); goto free_skb;
Greg Kroah-Hartman
maintainerPATCH 86/157 ARM: at91: fix build for SAMA5D3 w/o L2 cache
In reply to Greg Kroah-HartmanFrom: Peter Rosin <[email protected]>
[ Upstream commit 6a3fc8c330d1c1fa3d8773d7d38a7c55c4900dfe ]
The L2 cache is present on the newer SAMA5D2 and SAMA5D4 families, but apparently not for the older SAMA5D3.
Solves a build-time regression with the following symptom:
sama5.c:(.init.text+0x48): undefined reference to `outer_cache'
--- arch/arm/mach-at91/sama5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-at91/sama5.c +1 -1
@@ -26,7 +26,7 @@ static void sama5_l2c310_write_sec(unsigned long val, unsigned reg)static void __init sama5_secure_cache_init (void ) {sam_secure_init (); -if (sam_linux_is_optee_available ()) +if (IS_ENABLED (CONFIG_OUTER_CACHE ) &&sam_linux_is_optee_available ()) outer_cache.write_sec = sama5_l2c310_write_sec; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 87/157 gpiolib: fix memory leak in gpiochip_setup_dev()
In reply to Greg Kroah-HartmanFrom: Zeng Heng <[email protected]>
[ Upstream commit ec851b23084b3a0af8bf0f5e51d33a8d678bdc49 ]
Here is a backtrace report about memory leak detected in gpiochip_setup_dev():
unreferenced object 0xffff88810b406400 (size 512):
comm "python3", pid 1682, jiffies 4295346908 (age 24.090s) backtrace:
kmalloc_trace
device_add device_private_init at drivers/base/core.c:3361
(inlined by) device_add at drivers/base/core.c:3411
cdev_device_add
gpiolib_cdev_register
gpiochip_setup_dev
gpiochip_add_data_with_key
gcdev_register() & gcdev_unregister() would call device_add() & device_del() (no matter CONFIG_GPIO_CDEV is enabled or not) to register/unregister device.
However, if device_add() succeeds, some resource (like struct device_private allocated by device_private_init()) is not released by device_del().
Therefore, after device_add() succeeds by gcdev_register(), it needs to call put_device() to release resource in the error handle path.
Here we move forward the register of release function, and let it release every piece of resource by put_device() instead of kfree().
While at it, fix another subtle issue, i.e. when gc->ngpio is equal to 0, we still call kcalloc() and, in case of further error, kfree() on the ZERO_PTR pointer, which is not NULL. It's not a bug per se, but rather waste of the resources and potentially wrong expectation about contents of the gdev->descs variable.
--- drivers/gpio/gpiolib.c | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-)
drivers/gpio/gpiolib.c +26 -16
@@ -526,12 +526,13 @@ static int gpiochip_setup_dev(struct gpio_device *gdev)if (ret)return ret; +/* From this point, the .release() function cleans up gpio_device */ + gdev->dev.release = gpiodevice_release; + ret =gpiochip_sysfs_register (gdev);if (ret) goto err_remove_device; -/* From this point, the .release() function cleans up gpio_device */ - gdev->dev.release = gpiodevice_release;dev_dbg (&gdev->dev,"registered GPIOs %d to %d on %s\n" , gdev->base, gdev->base + gdev->ngpio -1 , gdev->chip->label ? :"generic" );
@@ -597,10 +598,10 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,struct fwnode_handle *fwnode =NULL ;struct gpio_device *gdev;unsigned long flags; -int base = gc->base;unsigned int i; +u32 ngpios =0 ; +int base =0 ;int ret =0 ; -u32 ngpios;if (gc->fwnode) fwnode = gc->fwnode;
@@ -647,17 +648,12 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,else gdev->owner =THIS_MODULE ; - gdev->descs =kcalloc (gc->ngpio,sizeof (gdev->descs[0 ]),GFP_KERNEL ); -if (!gdev->descs) { - ret = -ENOMEM ; - goto err_free_dev_name; - } -/* * Try the device properties if the driver didn't supply the number * of GPIO lines. */ -if (gc->ngpio ==0 ) { + ngpios = gc->ngpio; +if (ngpios ==0 ) { ret =device_property_read_u32 (&gdev->dev,"ngpios" , &ngpios);if (ret == -ENODATA )/*
@@ -668,7 +664,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,*/ ngpios =0 ; else if (ret) - goto err_free_descs; + goto err_free_dev_name; gc->ngpio = ngpios; }
@@ -676,13 +672,19 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,if (gc->ngpio ==0 ) {chip_err (gc,"tried to insert a GPIO chip with zero lines\n" ); ret = -EINVAL ; - goto err_free_descs; + goto err_free_dev_name; }if (gc->ngpio >FASTPATH_NGPIO )chip_warn (gc,"line cnt %u is greater than fast path cnt %u\n" , gc->ngpio,FASTPATH_NGPIO ); + gdev->descs =kcalloc (gc->ngpio,sizeof (*gdev->descs),GFP_KERNEL ); +if (!gdev->descs) { + ret = -ENOMEM ; + goto err_free_dev_name; + } + gdev->label =kstrdup_const (gc->label ?:"unknown" ,GFP_KERNEL );if (!gdev->label) { ret = -ENOMEM ;
@@ -701,11 +703,13 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,* it may be a pipe dream. It will not happen before we get rid * of the sysfs interface anyways. */ + base = gc->base;if (base <0 ) { base =gpiochip_find_base (gc->ngpio);if (base <0 ) { - ret = base;spin_unlock_irqrestore (&gpio_lock, flags); + ret = base; + base =0 ; goto err_free_label; }/*
@@ -816,6 +820,11 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, err_free_gpiochip_mask:gpiochip_remove_pin_ranges (gc);gpiochip_free_valid_mask (gc); +if (gdev->dev.release) { +/* release() has been registered by gpiochip_setup_dev() */ +put_device (&gdev->dev); + goto err_print_message; + } err_remove_from_list:spin_lock_irqsave (&gpio_lock, flags);list_del (&gdev->list);
@@ -829,13 +838,14 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, err_free_ida:ida_free (&gpio_ida, gdev->id); err_free_gdev: +kfree (gdev); +err_print_message:/* failures here can mean systems won't boot... */ if (ret != -EPROBE_DEFER ) {pr_err ("%s: GPIOs %d..%d (%s) failed to register, %d\n" , __func__, - gdev->base, gdev->base + gdev->ngpio -1 , + base, base + (int )ngpios -1 , gc->label ? :"generic" , ret); } -kfree (gdev);return ret; }EXPORT_SYMBOL_GPL (gpiochip_add_data_with_key);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 88/157 netfilter: nft_set_pipapo: Actually validate intervals in fields after the first one
In reply to Greg Kroah-HartmanFrom: Stefano Brivio <[email protected]>
[ Upstream commit 97d4d394b58777f7056ebba8ffdb4002d0563259 ]
Embarrassingly, nft_pipapo_insert() checked for interval validity in the first field only.
The start_p and end_p pointers were reset to key data from the first field at every iteration of the loop which was supposed to go over the set fields.
--- net/netfilter/nft_set_pipapo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/netfilter/nft_set_pipapo.c +3 -2
@@ -1162,6 +1162,7 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set,struct nft_pipapo_match *m = priv->clone;u8 genmask =nft_genmask_next (net);struct nft_pipapo_field *f; +const u8 *start_p, *end_p;int i, bsize_max, err =0 ;if (nft_set_ext_exists (ext,NFT_SET_EXT_KEY_END ))
@@ -1202,9 +1203,9 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set, }/* Validate */ + start_p = start; + end_p = end;nft_pipapo_for_each_field (f, i, m) { -const u8 *start_p = start, *end_p = end; -if (f->rules >= (unsigned long )NFT_PIPAPO_RULE0_MAX )return -ENOSPC ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 89/157 netfilter: flowtable_offload: fix using __this_cpu_add in preemptible
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit a81047154e7ce4eb8769d5d21adcbc9693542a79 ]
flow_offload_queue_work() can be called in workqueue without bh disabled, like the call trace showed in my act_ct testing, calling NF_FLOW_TABLE_STAT_INC() there would cause a call trace:
BUG: using __this_cpu_add() in preemptible [00000000] code: kworker/u4:0/138560 caller is flow_offload_queue_work+0xec/0x1b0 [nf_flow_table] Workqueue: act_ct_workqueue tcf_ct_flow_table_cleanup_work [act_ct] Call Trace: <TASK> dump_stack_lvl+0x33/0x46 check_preemption_disabled+0xc3/0xf0 flow_offload_queue_work+0xec/0x1b0 [nf_flow_table] nf_flow_table_iterate+0x138/0x170 [nf_flow_table] nf_flow_table_free+0x140/0x1a0 [nf_flow_table] tcf_ct_flow_table_cleanup_work+0x2f/0x2b0 [act_ct] process_one_work+0x6a3/0x1030 worker_thread+0x8a/0xdf0
This patch fixes it by using NF_FLOW_TABLE_STAT_INC_ATOMIC() instead in flow_offload_queue_work().
Note that for FLOW_CLS_REPLACE branch in flow_offload_queue_work(), it may not be called in preemptible path, but it's good to use NF_FLOW_TABLE_STAT_INC_ATOMIC() for all cases in flow_offload_queue_work().
--- net/netfilter/nf_flow_table_offload.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/netfilter/nf_flow_table_offload.c +3 -3
@@ -997,13 +997,13 @@ static void flow_offload_queue_work(struct flow_offload_work *offload)struct net *net =read_pnet (&offload->flowtable->net);if (offload->cmd ==FLOW_CLS_REPLACE ) { -NF_FLOW_TABLE_STAT_INC (net, count_wq_add); +NF_FLOW_TABLE_STAT_INC_ATOMIC (net, count_wq_add);queue_work (nf_flow_offload_add_wq, &offload->work); }else if (offload->cmd ==FLOW_CLS_DESTROY ) { -NF_FLOW_TABLE_STAT_INC (net, count_wq_del); +NF_FLOW_TABLE_STAT_INC_ATOMIC (net, count_wq_del);queue_work (nf_flow_offload_del_wq, &offload->work); }else { -NF_FLOW_TABLE_STAT_INC (net, count_wq_stats); +NF_FLOW_TABLE_STAT_INC_ATOMIC (net, count_wq_stats);queue_work (nf_flow_offload_stats_wq, &offload->work); } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 90/157 drm/vmwgfx: Fix race issue calling pin_user_pages
In reply to Greg Kroah-HartmanFrom: Dawei Li <[email protected]>
[ Upstream commit ed14d225cc7c842f6d4d5a3009f71a44f5852d09 ]
pin_user_pages() is unsafe without protection of mmap_lock, fix it by calling pin_user_pages_fast().
--- drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_msg.c +3 -3
@@ -1085,21 +1085,21 @@ int vmw_mksstat_add_ioctl(struct drm_device *dev, void *data,reset_ppn_array (pdesc->strsPPNs,ARRAY_SIZE (pdesc->strsPPNs));/* Pin mksGuestStat user pages and store those in the instance descriptor */ - nr_pinned_stat =pin_user_pages (arg->stat, num_pages_stat,FOLL_LONGTERM , pages_stat,NULL ); + nr_pinned_stat =pin_user_pages_fast (arg->stat, num_pages_stat,FOLL_LONGTERM , pages_stat);if (num_pages_stat != nr_pinned_stat) goto err_pin_stat;for (i =0 ; i < num_pages_stat; ++i) pdesc->statPPNs[i] =page_to_pfn (pages_stat[i]); - nr_pinned_info =pin_user_pages (arg->info, num_pages_info,FOLL_LONGTERM , pages_info,NULL ); + nr_pinned_info =pin_user_pages_fast (arg->info, num_pages_info,FOLL_LONGTERM , pages_info);if (num_pages_info != nr_pinned_info) goto err_pin_info;for (i =0 ; i < num_pages_info; ++i) pdesc->infoPPNs[i] =page_to_pfn (pages_info[i]); - nr_pinned_strs =pin_user_pages (arg->strs, num_pages_strs,FOLL_LONGTERM , pages_strs,NULL ); + nr_pinned_strs =pin_user_pages_fast (arg->strs, num_pages_strs,FOLL_LONGTERM , pages_strs);if (num_pages_strs != nr_pinned_strs) goto err_pin_strs;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 91/157 ieee802154: cc2520: Fix error return code in cc2520_hw_init()
In reply to Greg Kroah-HartmanFrom: Ziyang Xuan <[email protected]>
[ Upstream commit 4d002d6a2a00ac1c433899bd7625c6400a74cfba ]
In cc2520_hw_init(), if oscillator start failed, the error code should be returned.
--- drivers/net/ieee802154/cc2520.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ieee802154/cc2520.c +1 -1
@@ -970,7 +970,7 @@ static int cc2520_hw_init(struct cc2520_private *priv)if (timeout-- <=0 ) {dev_err (&priv->spi->dev,"oscillator start failed!\n" ); -return ret; +return -ETIMEDOUT ; }udelay (1 ); }while (!(status &CC2520_STATUS_XOSC32M_STABLE ));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 92/157 ca8210: Fix crash by zero initializing data
In reply to Greg Kroah-HartmanFrom: Hauke Mehrtens <[email protected]>
[ Upstream commit 1e24c54da257ab93cff5826be8a793b014a5dc9c ]
The struct cas_control embeds multiple generic SPI structures and we have to make sure these structures are initialized to default values. This driver does not set all attributes. When using kmalloc before some attributes were not initialized and contained random data which caused random crashes at bootup.
--- drivers/net/ieee802154/ca8210.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ieee802154/ca8210.c +1 -1
@@ -885,7 +885,7 @@ static int ca8210_spi_transfer(dev_dbg (&spi->dev,"%s called\n" , __func__); - cas_ctl =kmalloc (sizeof (*cas_ctl),GFP_ATOMIC ); + cas_ctl =kzalloc (sizeof (*cas_ctl),GFP_ATOMIC );if (!cas_ctl)return -ENOMEM ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 93/157 netfilter: conntrack: fix using __this_cpu_add in preemptible
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 9464d0b68f11a9bc768370c3260ec02b3550447b ]
Currently in nf_conntrack_hash_check_insert(), when it fails in nf_ct_ext_valid_pre/post(), NF_CT_STAT_INC() will be called in the preemptible context, a call trace can be triggered:
BUG: using __this_cpu_add() in preemptible [00000000] code: conntrack/1636
caller is nf_conntrack_hash_check_insert+0x45/0x430 [nf_conntrack]
Call Trace:
<TASK>
dump_stack_lvl+0x33/0x46
check_preemption_disabled+0xc3/0xf0
nf_conntrack_hash_check_insert+0x45/0x430 [nf_conntrack]
ctnetlink_create_conntrack+0x3cd/0x4e0 [nf_conntrack_netlink]
ctnetlink_new_conntrack+0x1c0/0x450 [nf_conntrack_netlink]
nfnetlink_rcv_msg+0x277/0x2f0 [nfnetlink]
netlink_rcv_skb+0x50/0x100
nfnetlink_rcv+0x65/0x144 [nfnetlink]
netlink_unicast+0x1ae/0x290
netlink_sendmsg+0x257/0x4f0
sock_sendmsg+0x5f/0x70This patch is to fix it by changing to use NF_CT_STAT_INC_ATOMIC() for nf_ct_ext_valid_pre/post() check in nf_conntrack_hash_check_insert(), as well as nf_ct_ext_valid_post() in __nf_conntrack_confirm().
Note that nf_ct_ext_valid_pre() check in __nf_conntrack_confirm() is safe to use NF_CT_STAT_INC(), as it's under local_bh_disable().
--- net/netfilter/nf_conntrack_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/netfilter/nf_conntrack_core.c +3 -3
@@ -891,7 +891,7 @@ nf_conntrack_hash_check_insert(struct nf_conn *ct) zone =nf_ct_zone (ct);if (!nf_ct_ext_valid_pre (ct->ext)) { -NF_CT_STAT_INC (net, insert_failed); +NF_CT_STAT_INC_ATOMIC (net, insert_failed);return -ETIMEDOUT ; }
@@ -938,7 +938,7 @@ nf_conntrack_hash_check_insert(struct nf_conn *ct)if (!nf_ct_ext_valid_post (ct->ext)) {nf_ct_kill (ct); -NF_CT_STAT_INC (net, drop); +NF_CT_STAT_INC_ATOMIC (net, drop);return -ETIMEDOUT ; }
@@ -1275,7 +1275,7 @@ __nf_conntrack_confirm(struct sk_buff *skb)*/ if (!nf_ct_ext_valid_post (ct->ext)) {nf_ct_kill (ct); -NF_CT_STAT_INC (net, drop); +NF_CT_STAT_INC_ATOMIC (net, drop);return NF_DROP ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 94/157 netfilter: ctnetlink: fix compilation warning after data race fixes in ct mark
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 1feeae071507ad65cf9f462a1bdd543a4bf89e71 ]
All warnings (new ones prefixed by >>):
net/netfilter/nf_conntrack_netlink.c: In function '__ctnetlink_glue_build':
Quoted 1 line
Quoted 1 line
net/netfilter/nf_conntrack_netlink.c:2674:13: warning: unused variable 'mark' [-Wunused-variable]
2674 | u32 mark;
| ^~~~--- net/netfilter/nf_conntrack_netlink.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
net/netfilter/nf_conntrack_netlink.c +10 -9
@@ -328,8 +328,13 @@ ctnetlink_dump_timestamp(struct sk_buff *skb, const struct nf_conn *ct) }#ifdef CONFIG_NF_CONNTRACK_MARK -static int ctnetlink_dump_mark (struct sk_buff *skb,u32 mark) +static int ctnetlink_dump_mark (struct sk_buff *skb,const struct nf_conn *ct) { +u32 mark =READ_ONCE (ct->mark); + +if (!mark) +return 0 ; +if (nla_put_be32 (skb,CTA_MARK ,htonl (mark))) goto nla_put_failure;return 0 ;
@@ -543,7 +548,7 @@ static int ctnetlink_dump_extinfo(struct sk_buff *skb,static int ctnetlink_dump_info (struct sk_buff *skb,struct nf_conn *ct) { if (ctnetlink_dump_status(skb, ct) < 0 || - ctnetlink_dump_mark(skb, READ_ONCE(ct->mark)) < 0 || + ctnetlink_dump_mark(skb, ct) < 0 || ctnetlink_dump_secctx(skb, ct) < 0 || ctnetlink_dump_id(skb, ct) < 0 || ctnetlink_dump_use(skb, ct) < 0 ||
@@ -722,7 +727,6 @@ ctnetlink_conntrack_event(unsigned int events, const struct nf_ct_event *item)struct sk_buff *skb;unsigned int type;unsigned int flags =0 , group; -u32 mark;int err;if (events & (1 <<IPCT_DESTROY )) {
@@ -827,9 +831,8 @@ ctnetlink_conntrack_event(unsigned int events, const struct nf_ct_event *item) }#ifdef CONFIG_NF_CONNTRACK_MARK - mark =READ_ONCE (ct->mark); -if ((events & (1 <<IPCT_MARK ) || mark) && -ctnetlink_dump_mark (skb, mark) <0 ) +if (events & (1 <<IPCT_MARK ) && +ctnetlink_dump_mark (skb, ct) <0 ) goto nla_put_failure;#endif nlmsg_end (skb, nlh);
@@ -2671,7 +2674,6 @@ static int __ctnetlink_glue_build(struct sk_buff *skb, struct nf_conn *ct) {const struct nf_conntrack_zone *zone;struct nlattr *nest_parms; -u32 mark; zone =nf_ct_zone (ct);
@@ -2733,8 +2735,7 @@ static int __ctnetlink_glue_build(struct sk_buff *skb, struct nf_conn *ct) goto nla_put_failure;#ifdef CONFIG_NF_CONNTRACK_MARK - mark =READ_ONCE (ct->mark); -if (mark &&ctnetlink_dump_mark (skb, mark) <0 ) +if (ctnetlink_dump_mark (skb, ct) <0 ) goto nla_put_failure;#endif if (ctnetlink_dump_labels (skb, ct) <0 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 95/157 drm/bridge: ti-sn65dsi86: Fix output polarity setting bug
In reply to Greg Kroah-HartmanFrom: Qiqi Zhang <[email protected]>
[ Upstream commit 8c115864501fc09932cdfec53d9ec1cde82b4a28 ]
According to the description in ti-sn65dsi86's datasheet:
CHA_HSYNC_POLARITY:
0 = Active High Pulse. Synchronization signal is high for the sync pulse width. (default)
1 = Active Low Pulse. Synchronization signal is low for the sync pulse width.
CHA_VSYNC_POLARITY:
0 = Active High Pulse. Synchronization signal is high for the sync pulse width. (Default)
1 = Active Low Pulse. Synchronization signal is low for the sync pulse width.
We should only set these bits when the polarity is negative.
--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +2 -2
@@ -906,9 +906,9 @@ static void ti_sn_bridge_set_video_timings(struct ti_sn65dsi86 *pdata) &pdata->bridge.encoder->crtc->state->adjusted_mode;u8 hsync_polarity =0 , vsync_polarity =0 ; -if (mode->flags &DRM_MODE_FLAG_PHSYNC ) +if (mode->flags &DRM_MODE_FLAG_NHSYNC ) hsync_polarity =CHA_HSYNC_POLARITY ; -if (mode->flags &DRM_MODE_FLAG_PVSYNC ) +if (mode->flags &DRM_MODE_FLAG_NVSYNC ) vsync_polarity =CHA_VSYNC_POLARITY ; ti_sn65dsi86_write_u16(pdata, SN_CHA_ACTIVE_LINE_LENGTH_LOW_REG,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 96/157 gpio: amd8111: Fix PCI device reference count leak
In reply to Greg Kroah-HartmanFrom: Xiongfeng Wang <[email protected]>
[ Upstream commit 45fecdb9f658d9c82960c98240bc0770ade19aca ]
for_each_pci_dev() is implemented by pci_get_device(). The comment of pci_get_device() says that it will increase the reference count for the returned pci_dev and also decrease the reference count for the input pci_dev @from if it is not NULL.
If we break for_each_pci_dev() loop with pdev not NULL, we need to call pci_dev_put() to decrease the reference count. Add the missing pci_dev_put() after the 'out' label. Since pci_dev_put() can handle NULL input parameter, there is no problem for the 'Device not found' branch. For the normal path, add pci_dev_put() in amd_gpio_exit().
--- drivers/gpio/gpio-amd8111.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpio/gpio-amd8111.c +4 -0
@@ -226,7 +226,10 @@ static int __init amd_gpio_init(void)ioport_unmap (gp.pm); goto out; } +return 0 ; + out: +pci_dev_put (pdev);return err; }
@@ -234,6 +237,7 @@ static void __exit amd_gpio_exit(void) {gpiochip_remove (&gp.chip);ioport_unmap (gp.pm); +pci_dev_put (gp.pdev); }module_init (amd_gpio_init);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 97/157 e1000e: Fix TX dispatch condition
In reply to Greg Kroah-HartmanFrom: Akihiko Odaki <[email protected]>
[ Upstream commit eed913f6919e253f35d454b2f115f2a4db2b741a ]
e1000_xmit_frame is expected to stop the queue and dispatch frames to hardware if there is not sufficient space for the next frame in the buffer, but sometimes it failed to do so because the estimated maximum size of frame was wrong. As the consequence, the later invocation of e1000_xmit_frame failed with NETDEV_TX_BUSY, and the frame in the buffer remained forever, resulting in a watchdog failure.
This change fixes the estimated size by making it match with the condition for NETDEV_TX_BUSY. Apparently, the old estimation failed to account for the following lines which determines the space requirement for not causing NETDEV_TX_BUSY:
```
/* reserve a descriptor for the offload context */
if ((mss) || (skb->ip_summed == CHECKSUM_PARTIAL))
count++;
count++;
count += DIV_ROUND_UP(len, adapter->tx_fifo_limit);
```This issue was found when running http-stress02 test included in Linux Test Project 20220930 on QEMU with the following commandline:
``` qemu-system-x86_64 -M q35,accel=kvm -m 8G -smp 8 -drive if=virtio,format=raw,file=root.img,file.locking=on -device e1000e,netdev=netdev -netdev tap,script=ifup,downscript=no,id=netdev ```
--- drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +2 -2
@@ -5936,9 +5936,9 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,e1000_tx_queue (tx_ring, tx_flags, count);/* Make sure there is space in the ring for the next send. */ e1000_maybe_stop_tx (tx_ring, - (MAX_SKB_FRAGS * + ((MAX_SKB_FRAGS +1 ) *DIV_ROUND_UP (PAGE_SIZE , - adapter->tx_fifo_limit) +2 )); + adapter->tx_fifo_limit) +4 ));if (!netdev_xmit_more () ||netif_xmit_stopped (netdev_get_tx_queue (netdev,0 ))) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 98/157 igb: Allocate MSI-X vector when testing
In reply to Greg Kroah-HartmanFrom: Akihiko Odaki <[email protected]>
[ Upstream commit 28e96556baca7056d11d9fb3cdd0aba4483e00d8 ]
Without this change, the interrupt test fail with MSI-X environment:
$ sudo ethtool -t enp0s2 offline [ 43.921783] igb 0000:00:02.0: offline testing starting [ 44.855824] igb 0000:00:02.0 enp0s2: igb: enp0s2 NIC Link is Down [ 44.961249] igb 0000:00:02.0 enp0s2: igb: enp0s2 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX [ 51.272202] igb 0000:00:02.0: testing shared interrupt [ 56.996975] igb 0000:00:02.0 enp0s2: igb: enp0s2 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX The test result is FAIL The test extra info: Register test (offline) 0 Eeprom test (offline) 0 Interrupt test (offline) 4 Loopback test (offline) 0 Link test (on/offline) 0
Here, "4" means an expected interrupt was not delivered.
To fix this, route IRQs correctly to the first MSI-X vector by setting IVAR_MISC. Also, set bit 0 of EIMS so that the vector will not be masked. The interrupt test now runs properly with this change:
$ sudo ethtool -t enp0s2 offline [ 42.762985] igb 0000:00:02.0: offline testing starting [ 50.141967] igb 0000:00:02.0: testing shared interrupt [ 56.163957] igb 0000:00:02.0 enp0s2: igb: enp0s2 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX The test result is PASS The test extra info: Register test (offline) 0 Eeprom test (offline) 0 Interrupt test (offline) 0 Loopback test (offline) 0 Link test (on/offline) 0
--- drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/igb/igb_ethtool.c +2 -0
@@ -1413,6 +1413,8 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data) *data =1 ;return -1 ; } +wr32 (E1000_IVAR_MISC ,E1000_IVAR_VALID <<8 ); +wr32 (E1000_EIMS ,BIT (0 )); }else if (adapter->flags &IGB_FLAG_HAS_MSI ) { shared_int = false; if (request_irq(irq,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 99/157 net: broadcom: Add PTP_1588_CLOCK_OPTIONAL dependency for BCMGENET under ARCH_BCM2835
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 421f8663b3a775c32f724f793264097c60028f2e ]
commit 8d820bc9d12b ("net: broadcom: Fix BCMGENET Kconfig") fixes the build that contain 99addbe31f55 ("net: broadcom: Select BROADCOM_PHY for BCMGENET") and enable BCMGENET=y but PTP_1588_CLOCK_OPTIONAL=m, which otherwise leads to a link failure. However this may trigger a runtime failure.
Fix the original issue by propagating the PTP_1588_CLOCK_OPTIONAL dependency of BROADCOM_PHY down to BCMGENET.
--- drivers/net/ethernet/broadcom/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/Kconfig +2 -1
@@ -71,13 +71,14 @@ config BCM63XX_ENET config BCMGENET tristate "Broadcom GENET internal MAC support" depends on HAS_IOMEM + depends on PTP_1588_CLOCK_OPTIONAL || !ARCH_BCM2835 select MII select PHYLIB select FIXED_PHY select BCM7XXX_PHY select MDIO_BCM_UNIMAC select DIMLIB - select BROADCOM_PHY if (ARCH_BCM2835 && PTP_1588_CLOCK_OPTIONAL) + select BROADCOM_PHY if ARCH_BCM2835 help This driver supports the built-in Ethernet MACs found in the Broadcom BCM7xxx Set Top Box family chipset.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 100/157 net: ethernet: ti: am65-cpsw: Fix RGMII configuration at SPEED_10
In reply to Greg Kroah-HartmanFrom: Siddharth Vadapalli <[email protected]>
[ Upstream commit 6c681f899e0360803b924ac8c96ee21965118649 ]
The am65-cpsw driver supports configuring all RGMII variants at interface speed of 10 Mbps. However, in the process of shifting to the PHYLINK framework, the support for all variants of RGMII except the PHY_INTERFACE_MODE_RGMII variant was accidentally removed.
Fix this by using phy_interface_mode_is_rgmii() to check for all variants of RGMII mode.
--- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ti/am65-cpsw-nuss.c +1 -1
@@ -1450,7 +1450,7 @@ static void am65_cpsw_nuss_mac_link_up(struct phylink_config *config, struct phyif (speed ==SPEED_1000 ) mac_control |=CPSW_SL_CTL_GIG ; -if (speed ==SPEED_10 && interface ==PHY_INTERFACE_MODE_RGMII ) +if (speed ==SPEED_10 &&phy_interface_mode_is_rgmii (interface))/* Can be used with in band mode only */ mac_control |=CPSW_SL_CTL_EXT_EN ;if (speed ==SPEED_100 && interface ==PHY_INTERFACE_MODE_RMII )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 101/157 drm: bridge: dw_hdmi: fix preference of RGB modes over YUV420
In reply to Greg Kroah-HartmanFrom: Guillaume BRUN <[email protected]>
[ Upstream commit d3d6b1bf85aefe0ebc0624574b3bb62f0693914c ]
Cheap monitors sometimes advertise YUV modes they don't really have (HDMI specification mandates YUV support so even monitors without actual support will often wrongfully advertise it) which results in YUV matches and user forum complaints of a red tint to light colour display areas in common desktop environments.
Moving the default RGB fall-back before YUV selection results in RGB mode matching in most cases, reducing complaints.
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +3 -3
@@ -2720,6 +2720,9 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,* if supported. In any case the default RGB888 format is added */ +/* Default 8bit RGB fallback */ + output_fmts[i++] =MEDIA_BUS_FMT_RGB888_1X24 ; +if (max_bpc >=16 && info->bpc ==16 ) {if (info->color_formats &DRM_COLOR_FORMAT_YCBCR444 ) output_fmts[i++] =MEDIA_BUS_FMT_YUV16_1X48 ;
@@ -2753,9 +2756,6 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,if (info->color_formats &DRM_COLOR_FORMAT_YCBCR444 ) output_fmts[i++] =MEDIA_BUS_FMT_YUV8_1X24 ; -/* Default 8bit RGB fallback */ - output_fmts[i++] =MEDIA_BUS_FMT_RGB888_1X24 ; - *num_output_fmts = i;return output_fmts;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 102/157 af_unix: Get user_ns from in_skb in unix_diag_get_exact().
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit b3abe42e94900bdd045c472f9c9be620ba5ce553 ]
Wei Chen reported a NULL deref in sk_user_ns() [0][1], and Paolo diagnosed the root cause: in unix_diag_get_exact(), the newly allocated skb does not have sk. [2]
We must get the user_ns from the NETLINK_CB(in_skb).sk and pass it to sk_diag_fill().
[0]:
BUG: kernel NULL pointer dereference, address: 0000000000000270 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 12bbce067 P4D 12bbce067 PUD 12bc40067 PMD 0 Oops: 0000 [#1] PREEMPT SMP CPU: 0 PID: 27942 Comm: syz-executor.0 Not tainted 6.1.0-rc5-next-20221118 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-48-gd9c812dda519-prebuilt.qemu.org 04/01/2014 RIP: 0010:sk_user_ns include/net/sock.h:920 [inline] RIP: 0010:sk_diag_dump_uid net/unix/diag.c:119 [inline] RIP: 0010:sk_diag_fill+0x77d/0x890 net/unix/diag.c:170 Code: 89 ef e8 66 d4 2d fd c7 44 24 40 00 00 00 00 49 8d 7c 24 18 e8 54 d7 2d fd 49 8b 5c 24 18 48 8d bb 70 02 00 00 e8 43 d7 2d fd <48> 8b 9b 70 02 00 00 48 8d 7b 10 e8 33 d7 2d fd 48 8b 5b 10 48 8d RSP: 0018:ffffc90000d67968 EFLAGS: 00010246 RAX: ffff88812badaa48 RBX: 0000000000000000 RCX: ffffffff840d481d RDX: 0000000000000465 RSI: 0000000000000000 RDI: 0000000000000270 RBP: ffffc90000d679a8 R08: 0000000000000277 R09: 0000000000000000 R10: 0001ffffffffffff R11: 0001c90000d679a8 R12: ffff88812ac03800 R13: ffff88812c87c400 R14: ffff88812ae42210 R15: ffff888103026940 FS: 00007f08b4e6f700(0000) GS:ffff88813bc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000270 CR3: 000000012c58b000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> unix_diag_get_exact net/unix/diag.c:285 [inline] unix_diag_handler_dump+0x3f9/0x500 net/unix/diag.c:317 __sock_diag_cmd net/core/sock_diag.c:235 [inline] sock_diag_rcv_msg+0x237/0x250 net/core/sock_diag.c:266 netlink_rcv_skb+0x13e/0x250 net/netlink/af_netlink.c:2564 sock_diag_rcv+0x24/0x40 net/core/sock_diag.c:277 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline] netlink_unicast+0x5e9/0x6b0 net/netlink/af_netlink.c:1356 netlink_sendmsg+0x739/0x860 net/netlink/af_netlink.c:1932 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg net/socket.c:734 [inline] ____sys_sendmsg+0x38f/0x500 net/socket.c:2476 ___sys_sendmsg net/socket.c:2530 [inline] __sys_sendmsg+0x197/0x230 net/socket.c:2559 __do_sys_sendmsg net/socket.c:2568 [inline] __se_sys_sendmsg net/socket.c:2566 [inline] __x64_sys_sendmsg+0x42/0x50 net/socket.c:2566 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x4697f9 Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48
89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f08b4e6ec48 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 000000000077bf80 RCX: 00000000004697f9
RDX: 0000000000000000 RSI: 00000000200001c0 RDI: 0000000000000003
RBP: 00000000004d29e9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000077bf80
R13: 0000000000000000 R14: 000000000077bf80 R15: 00007ffdb36bc6c0
</TASK> Modules linked in:
CR2: 0000000000000270
[1]: https://lore.kernel.org/netdev/CAO4mrfdvyjFpokhNsiwZiP-wpdSD0AStcJwfKcKQdAALQ9_2Qw@mail.gmail.com/
[2]: https://lore.kernel.org/netdev/[email protected]/
--- net/unix/diag.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
net/unix/diag.c +12 -8
@@ -114,14 +114,16 @@ static int sk_diag_show_rqlen(struct sock *sk, struct sk_buff *nlskb)return nla_put (nlskb,UNIX_DIAG_RQLEN ,sizeof (rql), &rql); } -static int sk_diag_dump_uid (struct sock *sk,struct sk_buff *nlskb) +static int sk_diag_dump_uid (struct sock *sk,struct sk_buff *nlskb, +struct user_namespace *user_ns) { -uid_t uid =from_kuid_munged (sk_user_ns (nlskb->sk),sock_i_uid (sk)); +uid_t uid =from_kuid_munged (user_ns,sock_i_uid (sk));return nla_put (nlskb,UNIX_DIAG_UID ,sizeof (uid_t), &uid); }static int sk_diag_fill (struct sock *sk,struct sk_buff *skb,struct unix_diag_req *req, -u32 portid,u32 seq,u32 flags,int sk_ino) +struct user_namespace *user_ns, +u32 portid,u32 seq,u32 flags,int sk_ino) {struct nlmsghdr *nlh;struct unix_diag_msg *rep;
@@ -167,7 +169,7 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct unix_diag_r goto out_nlmsg_trim;if ((req->udiag_show &UDIAG_SHOW_UID ) && -sk_diag_dump_uid (sk, skb)) +sk_diag_dump_uid (sk, skb, user_ns)) goto out_nlmsg_trim;nlmsg_end (skb, nlh);
@@ -179,7 +181,8 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct unix_diag_r }static int sk_diag_dump (struct sock *sk,struct sk_buff *skb,struct unix_diag_req *req, -u32 portid,u32 seq,u32 flags) +struct user_namespace *user_ns, +u32 portid,u32 seq,u32 flags) {int sk_ino;
@@ -190,7 +193,7 @@ static int sk_diag_dump(struct sock *sk, struct sk_buff *skb, struct unix_diag_rif (!sk_ino)return 0 ; -return sk_diag_fill (sk, skb, req, portid, seq, flags, sk_ino); +return sk_diag_fill (sk, skb, req, user_ns, portid, seq, flags, sk_ino); }static int unix_diag_dump (struct sk_buff *skb,struct netlink_callback *cb)
@@ -214,7 +217,7 @@ static int unix_diag_dump(struct sk_buff *skb, struct netlink_callback *cb) goto next;if (!(req->udiag_states & (1 << sk->sk_state))) goto next; -if (sk_diag_dump (sk, skb, req, +if (sk_diag_dump (sk, skb, req,sk_user_ns (skb->sk),NETLINK_CB (cb->skb).portid, cb->nlh->nlmsg_seq,NLM_F_MULTI ) <0 ) {
@@ -282,7 +285,8 @@ static int unix_diag_get_exact(struct sk_buff *in_skb,if (!rep) goto out; - err =sk_diag_fill (sk, rep, req,NETLINK_CB (in_skb).portid, + err =sk_diag_fill (sk, rep, req,sk_user_ns (NETLINK_CB (in_skb).sk), +NETLINK_CB (in_skb).portid, nlh->nlmsg_seq,0 , req->udiag_ino);if (err <0 ) {nlmsg_free (rep);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 103/157 inet: ping: use hlist_nulls rcu iterator during lookup
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit c25b7a7a565e5eeb2459b37583eea67942057511 ]
ping_lookup() does not acquire the table spinlock, so iteration should use hlist_nulls_for_each_entry_rcu().
Spotted during code review.
--- .clang-format | 1 + include/net/ping.h | 3 --- net/ipv4/ping.c | 7 ++++++- 3 files changed, 7 insertions(+), 4 deletions(-)
.clang-format +1 -0
@@ -535,6 +535,7 @@ ForEachMacros: - 'perf_hpp_list__for_each_sort_list_safe' - 'perf_pmu__for_each_hybrid_pmu' - 'ping_portaddr_for_each_entry' + - 'ping_portaddr_for_each_entry_rcu' - 'plist_for_each' - 'plist_for_each_continue' - 'plist_for_each_entry'
include/net/ping.h +0 -3
@@ -16,9 +16,6 @@#define PING_HTABLE_SIZE 64#define PING_HTABLE_MASK (PING_HTABLE_SIZE-1) -#define ping_portaddr_for_each_entry (__sk, node, list) \ - hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node) -/* * gid_t is either uint or ushort. We want to pass it to * proc_dointvec_minmax(), so it must not be larger than MAX_INT
net/ipv4/ping.c +6 -1
@@ -48,6 +48,11 @@#include <net/transp_v6.h> #endif +#define ping_portaddr_for_each_entry (__sk, node, list) \ + hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node) +#define ping_portaddr_for_each_entry_rcu (__sk, node, list) \ + hlist_nulls_for_each_entry_rcu(__sk, node, list, sk_nulls_node) +struct ping_table {struct hlist_nulls_head hash[PING_HTABLE_SIZE ];spinlock_t lock;
@@ -191,7 +196,7 @@ static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident)return NULL ; } -ping_portaddr_for_each_entry (sk, hnode, hslot) { +ping_portaddr_for_each_entry_rcu (sk, hnode, hslot) { isk =inet_sk (sk);pr_debug ("iterate\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 104/157 vmxnet3: correctly report encapsulated LRO packet
In reply to Greg Kroah-HartmanFrom: Ronak Doshi <[email protected]>
[ Upstream commit 40b8c2a1af03ba3e8da55a4490d646bfa845e71a ]
Commit dacce2be3312 ("vmxnet3: add geneve and vxlan tunnel offload support") added support for encapsulation offload. However, the pathc did not report correctly the encapsulated packet which is LRO'ed by the hypervisor.
This patch fixes this issue by using correct callback for the LRO'ed encapsulated packet.
--- drivers/net/vmxnet3/vmxnet3_drv.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/vmxnet3/vmxnet3_drv.c +9 -2
@@ -1396,6 +1396,7 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq, };u32 num_pkts =0 ;bool skip_page_frags = false; +bool encap_lro = false;struct Vmxnet3_RxCompDesc *rcd;struct vmxnet3_rx_ctx *ctx = &rq->rx_ctx;u16 segCnt =0 , mss =0 ;
@@ -1556,13 +1557,18 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,if (VMXNET3_VERSION_GE_2 (adapter) && rcd->type ==VMXNET3_CDTYPE_RXCOMP_LRO ) {struct Vmxnet3_RxCompDescExt *rcdlro; +union Vmxnet3_GenericDesc *gdesc; + rcdlro = (struct Vmxnet3_RxCompDescExt *)rcd; + gdesc = (union Vmxnet3_GenericDesc *)rcd; segCnt = rcdlro->segCnt;WARN_ON_ONCE (segCnt ==0 ); mss = rcdlro->mss;if (unlikely (segCnt <=1 )) segCnt =0 ; + encap_lro = (le32_to_cpu (gdesc->dword[0 ]) & + (1UL <<VMXNET3_RCD_HDR_INNER_SHIFT )); }else { segCnt =0 ; }
@@ -1630,7 +1636,7 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,vmxnet3_rx_csum (adapter, skb, (union Vmxnet3_GenericDesc *)rcd); skb->protocol =eth_type_trans (skb, adapter->netdev); -if (!rcd->tcp || +if ((!rcd->tcp && !encap_lro) || !(adapter->netdev->features &NETIF_F_LRO )) goto not_lro;
@@ -1639,7 +1645,7 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq, SKB_GSO_TCPV4 :SKB_GSO_TCPV6 ;skb_shinfo (skb)->gso_size = mss;skb_shinfo (skb)->gso_segs = segCnt; - }else if (segCnt !=0 || skb->len > mtu) { + }else if ((segCnt !=0 || skb->len > mtu) && !encap_lro) {u32 hlen; hlen = vmxnet3_get_hdr_len(adapter, skb,
@@ -1668,6 +1674,7 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,napi_gro_receive (&rq->napi, skb); ctx->skb =NULL ; + encap_lro = false; num_pkts++; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 105/157 vmxnet3: use correct intrConf reference when using extended queues
In reply to Greg Kroah-HartmanFrom: Ronak Doshi <[email protected]>
[ Upstream commit 409e8ec8c5825591895937b8499b54aa2476fae7 ]
Commit 39f9895a00f4 ("vmxnet3: add support for 32 Tx/Rx queues") added support for 32Tx/Rx queues. As a part of this patch, intrConf structure was extended to incorporate increased queues.
This patch fixes the issue where incorrect reference is being used.
--- drivers/net/vmxnet3/vmxnet3_drv.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/net/vmxnet3/vmxnet3_drv.c +14 -2
@@ -75,8 +75,14 @@ vmxnet3_enable_all_intrs(struct vmxnet3_adapter *adapter)for (i =0 ; i < adapter->intr.num_intrs; i++)vmxnet3_enable_intr (adapter, i); - adapter->shared->devRead.intrConf.intrCtrl &= +if (!VMXNET3_VERSION_GE_6 (adapter) || + !adapter->queuesExtEnabled) { + adapter->shared->devRead.intrConf.intrCtrl &=cpu_to_le32 (~VMXNET3_IC_DISABLE_ALL ); + }else { + adapter->shared->devReadExt.intrConfExt.intrCtrl &= +cpu_to_le32 (~VMXNET3_IC_DISABLE_ALL ); + } }
@@ -85,8 +91,14 @@ vmxnet3_disable_all_intrs(struct vmxnet3_adapter *adapter) {int i; - adapter->shared->devRead.intrConf.intrCtrl |= +if (!VMXNET3_VERSION_GE_6 (adapter) || + !adapter->queuesExtEnabled) { + adapter->shared->devRead.intrConf.intrCtrl |=cpu_to_le32 (VMXNET3_IC_DISABLE_ALL ); + }else { + adapter->shared->devReadExt.intrConfExt.intrCtrl |= +cpu_to_le32 (VMXNET3_IC_DISABLE_ALL ); + }for (i =0 ; i < adapter->intr.num_intrs; i++)vmxnet3_disable_intr (adapter, i); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 106/157 Bluetooth: 6LoWPAN: add missing hci_dev_put() in get_l2cap_conn()
In reply to Greg Kroah-HartmanFrom: Wang ShaoBo <[email protected]>
[ Upstream commit 747da1308bdd5021409974f9180f0d8ece53d142 ]
hci_get_route() takes reference, we should use hci_dev_put() to release it when not need anymore.
--- net/bluetooth/6lowpan.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/6lowpan.c +1 -0
@@ -972,6 +972,7 @@ static int get_l2cap_conn(char *buf, bdaddr_t *addr, u8 *addr_type,hci_dev_lock (hdev); hcon =hci_conn_hash_lookup_le (hdev, addr, *addr_type);hci_dev_unlock (hdev); +hci_dev_put (hdev);if (!hcon)return -ENOENT ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 107/157 Bluetooth: hci_conn: add missing hci_dev_put() in iso_listen_bis()
In reply to Greg Kroah-HartmanFrom: Wang ShaoBo <[email protected]>
[ Upstream commit 7e7df2c10c92cab7d1dde3b301e584e2e877fbda ]
hci_get_route() takes reference, we should use hci_dev_put() to release it when not need anymore.
--- net/bluetooth/iso.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/iso.c +1 -0
@@ -879,6 +879,7 @@ static int iso_listen_bis(struct sock *sk) iso_pi(sk)->bc_sid);hci_dev_unlock (hdev); +hci_dev_put (hdev);return err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 108/157 Bluetooth: Remove codec id field in vendor codec definition
In reply to Greg Kroah-HartmanFrom: Chethan T N <[email protected]>
[ Upstream commit 93df7d56f15e217009323c0fbb5213ab7a14520b ]
As per the specfication vendor codec id is defined. BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E page 2127
--- include/net/bluetooth/hci.h | 1 - 1 file changed, 1 deletion(-)
include/net/bluetooth/hci.h +0 -1
@@ -1431,7 +1431,6 @@ struct hci_std_codecs_v2 { } __packed;struct hci_vnd_codec_v2 { -__u8 id;__le16 cid;__le16 vid;__u8 transport;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 109/157 Bluetooth: Fix support for Read Local Supported Codecs V2
In reply to Greg Kroah-HartmanFrom: Chethan T N <[email protected]>
[ Upstream commit 828cea2b71de501827f62d3c92d149f6052ad01e ]
Handling of Read Local Supported Codecs was broken during the HCI serialization design change patches.
--- net/bluetooth/hci_codec.c | 19 ++++++++++--------- net/bluetooth/hci_sync.c | 10 ++++++---- 2 files changed, 16 insertions(+), 13 deletions(-)
net/bluetooth/hci_codec.c +10 -9
@@ -72,9 +72,8 @@ static void hci_read_codec_capabilities(struct hci_dev *hdev, __u8 transport,continue ; } - skb =__hci_cmd_sync (hdev,HCI_OP_READ_LOCAL_CODEC_CAPS , -sizeof (*cmd), cmd, -HCI_CMD_TIMEOUT ); + skb =__hci_cmd_sync_sk (hdev,HCI_OP_READ_LOCAL_CODEC_CAPS , +sizeof (*cmd), cmd,0 ,HCI_CMD_TIMEOUT ,NULL );if (IS_ERR (skb)) {bt_dev_err (hdev,"Failed to read codec capabilities (%ld)" ,PTR_ERR (skb));
@@ -127,8 +126,8 @@ void hci_read_supported_codecs(struct hci_dev *hdev)struct hci_op_read_local_codec_caps caps;__u8 i; - skb =__hci_cmd_sync (hdev,HCI_OP_READ_LOCAL_CODECS ,0 ,NULL , -HCI_CMD_TIMEOUT ); + skb =__hci_cmd_sync_sk (hdev,HCI_OP_READ_LOCAL_CODECS ,0 ,NULL , +0 ,HCI_CMD_TIMEOUT ,NULL );if (IS_ERR (skb)) { bt_dev_err(hdev, "Failed to read local supported codecs (%ld)",
@@ -158,7 +157,8 @@ void hci_read_supported_codecs(struct hci_dev *hdev)for (i =0 ; i < std_codecs->num; i++) { caps.id = std_codecs->codec[i]; caps.direction =0x00 ; -hci_read_codec_capabilities (hdev,LOCAL_CODEC_ACL_MASK , &caps); +hci_read_codec_capabilities (hdev, +LOCAL_CODEC_ACL_MASK |LOCAL_CODEC_SCO_MASK , &caps); } skb_pull(skb, flex_array_size(std_codecs, codec, std_codecs->num)
@@ -178,7 +178,8 @@ void hci_read_supported_codecs(struct hci_dev *hdev) caps.cid = vnd_codecs->codec[i].cid; caps.vid = vnd_codecs->codec[i].vid; caps.direction =0x00 ; -hci_read_codec_capabilities (hdev,LOCAL_CODEC_ACL_MASK , &caps); +hci_read_codec_capabilities (hdev, +LOCAL_CODEC_ACL_MASK |LOCAL_CODEC_SCO_MASK , &caps); } error:
@@ -194,8 +195,8 @@ void hci_read_supported_codecs_v2(struct hci_dev *hdev)struct hci_op_read_local_codec_caps caps;__u8 i; - skb =__hci_cmd_sync (hdev,HCI_OP_READ_LOCAL_CODECS_V2 ,0 ,NULL , -HCI_CMD_TIMEOUT ); + skb =__hci_cmd_sync_sk (hdev,HCI_OP_READ_LOCAL_CODECS_V2 ,0 ,NULL , +0 ,HCI_CMD_TIMEOUT ,NULL );if (IS_ERR (skb)) { bt_dev_err(hdev, "Failed to read local supported codecs (%ld)",
net/bluetooth/hci_sync.c +6 -4
@@ -12,6 +12,7 @@#include <net/bluetooth/mgmt.h> #include "hci_request.h" +#include "hci_codec.h" #include "hci_debugfs.h" #include "smp.h" #include "eir.h"
@@ -3918,11 +3919,12 @@ static int hci_set_event_mask_page_2_sync(struct hci_dev *hdev)/* Read local codec list if the HCI command is supported */ static int hci_read_local_codecs_sync (struct hci_dev *hdev) { -if (!(hdev->commands[29 ] &0x20 )) -return 0 ; +if (hdev->commands[45 ] &0x04 ) +hci_read_supported_codecs_v2 (hdev); +else if (hdev->commands[29 ] &0x20 ) +hci_read_supported_codecs (hdev); -return __hci_cmd_sync_status (hdev,HCI_OP_READ_LOCAL_CODECS ,0 ,NULL , -HCI_CMD_TIMEOUT ); +return 0 ; }/* Read local pairing options if the HCI command is supported */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 110/157 Bluetooth: Fix not cleanup led when bt_init fails
In reply to Greg Kroah-HartmanFrom: Chen Zhongjin <[email protected]>
[ Upstream commit 2f3957c7eb4e07df944169a3e50a4d6790e1c744 ]
bt_init() calls bt_leds_init() to register led, but if it fails later, bt_leds_cleanup() is not called to unregister it.
This can cause panic if the argument "bluetooth-power" in text is freed and then another led_trigger_register() tries to access it:
BUG: unable to handle page fault for address: ffffffffc06d3bc0
RIP: 0010:strcmp+0xc/0x30
Call Trace:
<TASK>
led_trigger_register+0x10d/0x4f0
led_trigger_register_simple+0x7d/0x100
bt_init+0x39/0xf7 [bluetooth]
do_one_initcall+0xd0/0x4e0--- net/bluetooth/af_bluetooth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/bluetooth/af_bluetooth.c +3 -1
@@ -737,7 +737,7 @@ static int __init bt_init(void) err =bt_sysfs_init ();if (err <0 ) -return err; + goto cleanup_led; err =sock_register (&bt_sock_family_ops);if (err)
@@ -773,6 +773,8 @@ static int __init bt_init(void)sock_unregister (PF_BLUETOOTH ); cleanup_sysfs:bt_sysfs_cleanup (); +cleanup_led: +bt_leds_cleanup ();return err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 111/157 net: dsa: ksz: Check return value
In reply to Greg Kroah-HartmanFrom: Artem Chernyshev <[email protected]>
[ Upstream commit 3d8fdcbf1f42e2bb9ae8b8c0b6f202278c788a22 ]
Return NULL if we got unexpected value from skb_trim_rcsum() in ksz_common_rcv()
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- net/dsa/tag_ksz.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/dsa/tag_ksz.c +2 -1
@@ -21,7 +21,8 @@ static struct sk_buff *ksz_common_rcv(struct sk_buff *skb,if (!skb->dev)return NULL ; -pskb_trim_rcsum (skb, skb->len - len); +if (pskb_trim_rcsum (skb, skb->len - len)) +return NULL ;dsa_default_offload_fwd_mark (skb);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 112/157 net: dsa: hellcreek: Check return value
In reply to Greg Kroah-HartmanFrom: Artem Chernyshev <[email protected]>
[ Upstream commit d4edb50688652eb10be270bc515da63815de428f ]
Return NULL if we got unexpected value from skb_trim_rcsum() in hellcreek_rcv()
--- net/dsa/tag_hellcreek.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/dsa/tag_hellcreek.c +2 -1
@@ -49,7 +49,8 @@ static struct sk_buff *hellcreek_rcv(struct sk_buff *skb,return NULL ; } -pskb_trim_rcsum (skb, skb->len -HELLCREEK_TAG_LEN ); +if (pskb_trim_rcsum (skb, skb->len -HELLCREEK_TAG_LEN )) +return NULL ;dsa_default_offload_fwd_mark (skb);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 113/157 net: dsa: sja1105: Check return value
In reply to Greg Kroah-HartmanFrom: Artem Chernyshev <[email protected]>
[ Upstream commit 8948876335b1752176afdff8e704099a3ea0f6e6 ]
Return NULL if we got unexpected value from skb_trim_rcsum() in sja1110_rcv_inband_control_extension()
--- net/dsa/tag_sja1105.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/dsa/tag_sja1105.c +2 -1
@@ -665,7 +665,8 @@ static struct sk_buff *sja1110_rcv_inband_control_extension(struct sk_buff *skb,* padding and trailer we need to account for the fact that * skb->data points to skb_mac_header(skb) + ETH_HLEN. */ -pskb_trim_rcsum (skb, start_of_padding -ETH_HLEN ); +if (pskb_trim_rcsum (skb, start_of_padding -ETH_HLEN )) +return NULL ;/* Trap-to-host frame, no timestamp trailer */ }else { *source_port =SJA1110_RX_HEADER_SRC_PORT (rx_header);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 114/157 selftests: rtnetlink: correct xfrm policy rule in kci_test_ipsec_offload
In reply to Greg Kroah-HartmanFrom: Zhengchao Shao <[email protected]>
[ Upstream commit 85a0506c073332a3057f5a9635fa0d4db5a8e03b ]
When testing in kci_test_ipsec_offload, srcip is configured as $dstip, it should add xfrm policy rule in instead of out.
The test result of this patch is as follows:
PASS: ipsec_offload
--- tools/testing/selftests/net/rtnetlink.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/rtnetlink.sh +1 -1
@@ -782,7 +782,7 @@ kci_test_ipsec_offload() tmpl proto esp src $srcip dst $dstip spi 9 \ mode transport reqid 42 check_err $? - ip x p add dir out src $dstip/24 dst $srcip/24 \ + ip x p add dir in src $dstip/24 dst $srcip/24 \ tmpl proto esp src $dstip dst $srcip spi 9 \ mode transport reqid 42 check_err $?
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 115/157 nfp: correct desc type when header dma len is 4096
In reply to Greg Kroah-HartmanFrom: Yinjun Zhang <[email protected]>
[ Upstream commit 5c306de8f787ab7df51f846e57ac79cd713537d5 ]
When there's only one buffer to dma and its length is 4096, then only one data descriptor is needed to carry it according to current descriptor definition. So the descriptor type should be simple instead of gather, the latter requires more than one descriptor, otherwise it'll be dropped by application firmware.
--- drivers/net/ethernet/netronome/nfp/nfdk/dp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/netronome/nfp/nfdk/dp.c +3 -3
@@ -282,7 +282,7 @@ netdev_tx_t nfp_nfdk_tx(struct sk_buff *skb, struct net_device *netdev) dma_len =skb_headlen (skb);if (skb_is_gso (skb)) type =NFDK_DESC_TX_TYPE_TSO ; -else if (!nr_frags && dma_len <NFDK_TX_MAX_DATA_PER_HEAD ) +else if (!nr_frags && dma_len <=NFDK_TX_MAX_DATA_PER_HEAD ) type =NFDK_DESC_TX_TYPE_SIMPLE ;else type =NFDK_DESC_TX_TYPE_GATHER ;
@@ -927,7 +927,7 @@ nfp_nfdk_tx_xdp_buf(struct nfp_net_dp *dp, struct nfp_net_rx_ring *rx_ring, dma_len = pkt_len; dma_addr = rxbuf->dma_addr + dma_off; -if (dma_len <NFDK_TX_MAX_DATA_PER_HEAD ) +if (dma_len <=NFDK_TX_MAX_DATA_PER_HEAD ) type =NFDK_DESC_TX_TYPE_SIMPLE ;else type =NFDK_DESC_TX_TYPE_GATHER ;
@@ -1325,7 +1325,7 @@ nfp_nfdk_ctrl_tx_one(struct nfp_net *nn, struct nfp_net_r_vector *r_vec, txbuf = &tx_ring->ktxbufs[wr_idx]; dma_len =skb_headlen (skb); -if (dma_len <NFDK_TX_MAX_DATA_PER_HEAD ) +if (dma_len <=NFDK_TX_MAX_DATA_PER_HEAD ) type =NFDK_DESC_TX_TYPE_SIMPLE ;else type =NFDK_DESC_TX_TYPE_GATHER ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 116/157 mac802154: fix missing INIT_LIST_HEAD in ieee802154_if_add()
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit b3d72d3135d2ef68296c1ee174436efd65386f04 ]
Kernel fault injection test reports null-ptr-deref as follows:
BUG: kernel NULL pointer dereference, address: 0000000000000008 RIP: 0010:cfg802154_netdev_notifier_call+0x120/0x310 include/linux/list.h:114 Call Trace: <TASK> raw_notifier_call_chain+0x6d/0xa0 kernel/notifier.c:87 call_netdevice_notifiers_info+0x6e/0xc0 net/core/dev.c:1944 unregister_netdevice_many_notify+0x60d/0xcb0 net/core/dev.c:1982 unregister_netdevice_queue+0x154/0x1a0 net/core/dev.c:10879 register_netdevice+0x9a8/0xb90 net/core/dev.c:10083 ieee802154_if_add+0x6ed/0x7e0 net/mac802154/iface.c:659 ieee802154_register_hw+0x29c/0x330 net/mac802154/main.c:229 mcr20a_probe+0xaaa/0xcb1 drivers/net/ieee802154/mcr20a.c:1316
ieee802154_if_add() allocates wpan_dev as netdev's private data, but not init the list in struct wpan_dev. cfg802154_netdev_notifier_call() manage the list when device register/unregister, and may lead to null-ptr-deref.
Use INIT_LIST_HEAD() on it to initialize it correctly.
--- net/mac802154/iface.c | 1 + 1 file changed, 1 insertion(+)
net/mac802154/iface.c +1 -0
@@ -662,6 +662,7 @@ ieee802154_if_add(struct ieee802154_local *local, const char *name, sdata->dev = ndev; sdata->wpan_dev.wpan_phy = local->hw.phy; sdata->local = local; +INIT_LIST_HEAD (&sdata->wpan_dev.list);/* setup type-dependent data */ ret =ieee802154_setup_sdata (sdata, type);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 117/157 net: encx24j600: Add parentheses to fix precedence
In reply to Greg Kroah-HartmanFrom: Valentina Goncharenko <[email protected]>
[ Upstream commit 167b3f2dcc62c271f3555b33df17e361bb1fa0ee ]
In functions regmap_encx24j600_phy_reg_read() and regmap_encx24j600_phy_reg_write() in the conditions of the waiting cycles for filling the variable 'ret' it is necessary to add parentheses to prevent wrong assignment due to logical operations precedence.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/microchip/encx24j600-regmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/microchip/encx24j600-regmap.c +2 -2
@@ -359,7 +359,7 @@ static int regmap_encx24j600_phy_reg_read(void *context, unsigned int reg, goto err_out;usleep_range (26 ,100 ); -while ((ret =regmap_read (ctx->regmap,MISTAT , &mistat) !=0 ) && +while (((ret =regmap_read (ctx->regmap,MISTAT , &mistat)) !=0 ) && (mistat &BUSY ))cpu_relax ();
@@ -397,7 +397,7 @@ static int regmap_encx24j600_phy_reg_write(void *context, unsigned int reg, goto err_out;usleep_range (26 ,100 ); -while ((ret =regmap_read (ctx->regmap,MISTAT , &mistat) !=0 ) && +while (((ret =regmap_read (ctx->regmap,MISTAT , &mistat)) !=0 ) && (mistat &BUSY ))cpu_relax ();
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 118/157 net: encx24j600: Fix invalid logic in reading of MISTAT register
In reply to Greg Kroah-HartmanFrom: Valentina Goncharenko <[email protected]>
[ Upstream commit 25f427ac7b8d89b0259f86c0c6407b329df742b2 ]
A loop for reading MISTAT register continues while regmap_read() fails and (mistat & BUSY), but if regmap_read() fails a value of mistat is undefined.
The patch proposes to check for BUSY flag only when regmap_read() succeed. Compile test only.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/microchip/encx24j600-regmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/microchip/encx24j600-regmap.c +2 -2
@@ -359,7 +359,7 @@ static int regmap_encx24j600_phy_reg_read(void *context, unsigned int reg, goto err_out;usleep_range (26 ,100 ); -while (((ret =regmap_read (ctx->regmap,MISTAT , &mistat)) !=0 ) && +while (((ret =regmap_read (ctx->regmap,MISTAT , &mistat)) ==0 ) && (mistat &BUSY ))cpu_relax ();
@@ -397,7 +397,7 @@ static int regmap_encx24j600_phy_reg_write(void *context, unsigned int reg, goto err_out;usleep_range (26 ,100 ); -while (((ret =regmap_read (ctx->regmap,MISTAT , &mistat)) !=0 ) && +while (((ret =regmap_read (ctx->regmap,MISTAT , &mistat)) ==0 ) && (mistat &BUSY ))cpu_relax ();
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 119/157 net: mdiobus: fwnode_mdiobus_register_phy() rework error handling
In reply to Greg Kroah-HartmanFrom: Oleksij Rempel <[email protected]>
[ Upstream commit cfaa202a73eafaf91a3d0a86b5e5df006562f5c0 ]
Rework error handling as preparation for PSE patch. This patch should make it easier to extend this function.
Stable-dep-of: 165df24186ec ("net: mdiobus: fix double put fwnode in the error path")
--- drivers/net/mdio/fwnode_mdio.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/net/mdio/fwnode_mdio.c +12 -9
@@ -110,8 +110,8 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,else phy =phy_device_create (bus, addr, phy_id,0 ,NULL );if (IS_ERR (phy)) { -unregister_mii_timestamper (mii_ts); -return PTR_ERR (phy); + rc =PTR_ERR (phy); + goto clean_mii_ts; }if (is_acpi_node (child)) {
@@ -125,17 +125,13 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,/* All data is now stored in the phy struct, so register it */ rc =phy_device_register (phy);if (rc) { -phy_device_free (phy);fwnode_handle_put (phy->mdio.dev.fwnode); -return rc; + goto clean_phy; } }else if (is_of_node (child)) { rc =fwnode_mdiobus_phy_device_register (bus, phy, child, addr); -if (rc) { -unregister_mii_timestamper (mii_ts); -phy_device_free (phy); -return rc; - } +if (rc) + goto clean_phy; }/* phy->mii_ts may already be defined by the PHY driver. A
@@ -145,5 +141,12 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,if (mii_ts) phy->mii_ts = mii_ts;return 0 ; + +clean_phy: +phy_device_free (phy); +clean_mii_ts: +unregister_mii_timestamper (mii_ts); + +return rc; }EXPORT_SYMBOL (fwnode_mdiobus_register_phy);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 120/157 net: mdiobus: fix double put fwnode in the error path
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 165df24186ecea95705505627df3dacf5e7ff6bf ]
If phy_device_register() or fwnode_mdiobus_phy_device_register() fail, phy_device_free() is called, the device refcount is decreased to 0, then fwnode_handle_put() will be called in phy_device_release(), but in the error path, fwnode_handle_put() has already been called, so set fwnode to NULL after fwnode_handle_put() in the error path to avoid double put.
--- drivers/net/mdio/fwnode_mdio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/mdio/fwnode_mdio.c +3 -1
@@ -77,6 +77,7 @@ int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,*/ rc =phy_device_register (phy);if (rc) { +device_set_node (&phy->mdio.dev,NULL );fwnode_handle_put (child);return rc; }
@@ -125,7 +126,8 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,/* All data is now stored in the phy struct, so register it */ rc =phy_device_register (phy);if (rc) { -fwnode_handle_put (phy->mdio.dev.fwnode); + phy->mdio.dev.fwnode =NULL ; +fwnode_handle_put (child); goto clean_phy; } }else if (is_of_node (child)) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 121/157 octeontx2-pf: Fix potential memory leak in otx2_init_tc()
In reply to Greg Kroah-HartmanFrom: Ziyang Xuan <[email protected]>
[ Upstream commit fbf33f5ac76f2cdb47ad9763f620026d5cfa57ce ]
In otx2_init_tc(), if rhashtable_init() failed, it does not free tc->tc_entries_bitmap which is allocated in otx2_tc_alloc_ent_bitmap().
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +6 -1
@@ -1134,7 +1134,12 @@ int otx2_init_tc(struct otx2_nic *nic)return err; tc->flow_ht_params = tc_flow_ht_params; -return rhashtable_init (&tc->flow_table, &tc->flow_ht_params); + err =rhashtable_init (&tc->flow_table, &tc->flow_ht_params); +if (err) { +kfree (tc->tc_entries_bitmap); + tc->tc_entries_bitmap =NULL ; + } +return err; }EXPORT_SYMBOL (otx2_init_tc);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 122/157 net: microchip: sparx5: correctly free skb in xmit
In reply to Greg Kroah-HartmanFrom: Casper Andersson <[email protected]>
[ Upstream commit 121c6672b0191ffcebff4b88ec022c39e0a95789 ]
consume_skb on transmitted, kfree_skb on dropped, do not free on TX_BUSY.
Previously the xmit function could return -EBUSY without freeing, which supposedly is interpreted as a drop. And was using kfree on successfully transmitted packets.
sparx5_fdma_xmit and sparx5_inject returns error code, where -EBUSY indicates TX_BUSY and any other error code indicates dropped.
--- .../ethernet/microchip/sparx5/sparx5_fdma.c | 2 +- .../ethernet/microchip/sparx5/sparx5_packet.c | 41 +++++++++++-------- 2 files changed, 25 insertions(+), 18 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c +1 -1
@@ -317,7 +317,7 @@ int sparx5_fdma_xmit(struct sparx5 *sparx5, u32 *ifh, struct sk_buff *skb) next_dcb_hw =sparx5_fdma_next_dcb (tx, tx->curr_entry); db_hw = &next_dcb_hw->db[0 ];if (!(db_hw->status &FDMA_DCB_STATUS_DONE )) - tx->dropped++; +return -EINVAL ; db = list_first_entry(&tx->db_list, struct sparx5_db, list);list_move_tail (&db->list, &tx->db_list); next_dcb_hw->nextptr =FDMA_DCB_INVALID_DATA ;
drivers/net/ethernet/microchip/sparx5/sparx5_packet.c +24 -17
56 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 123/157 xen-netfront: Fix NULL sring after live migration
In reply to Greg Kroah-HartmanFrom: Lin Liu <[email protected]>
[ Upstream commit d50b7914fae04d840ce36491d22133070b18cca9 ]
A NAPI is setup for each network sring to poll data to kernel The sring with source host is destroyed before live migration and new sring with target host is setup after live migration. The NAPI for the old sring is not deleted until setup new sring with target host after migration. With busy_poll/busy_read enabled, the NAPI can be polled before got deleted when resume VM.
BUG: unable to handle kernel NULL pointer dereference at 0000000000000008 IP: xennet_poll+0xae/0xd20 PGD 0 P4D 0 Oops: 0000 [#1] SMP PTI Call Trace: finish_task_switch+0x71/0x230 timerqueue_del+0x1d/0x40 hrtimer_try_to_cancel+0xb5/0x110 xennet_alloc_rx_buffers+0x2a0/0x2a0 napi_busy_loop+0xdb/0x270 sock_poll+0x87/0x90 do_sys_poll+0x26f/0x580 tracing_map_insert+0x1d4/0x2f0 event_hist_trigger+0x14a/0x260 finish_task_switch+0x71/0x230 __schedule+0x256/0x890 recalc_sigpending+0x1b/0x50 xen_sched_clock+0x15/0x20 __rb_reserve_next+0x12d/0x140 ring_buffer_lock_reserve+0x123/0x3d0 event_triggers_call+0x87/0xb0 trace_event_buffer_commit+0x1c4/0x210 xen_clocksource_get_cycles+0x15/0x20 ktime_get_ts64+0x51/0xf0 SyS_ppoll+0x160/0x1a0 SyS_ppoll+0x160/0x1a0 do_syscall_64+0x73/0x130 entry_SYSCALL_64_after_hwframe+0x41/0xa6 ... RIP: xennet_poll+0xae/0xd20 RSP: ffffb4f041933900 CR2: 0000000000000008 ---[ end trace f8601785b354351c ]---
xen frontend should remove the NAPIs for the old srings before live migration as the bond srings are destroyed
There is a tiny window between the srings are set to NULL and the NAPIs are disabled, It is safe as the NAPI threads are still frozen at that time
--- drivers/net/xen-netfront.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/xen-netfront.c +6 -0
@@ -1862,6 +1862,12 @@ static int netfront_resume(struct xenbus_device *dev)netif_tx_unlock_bh (info->netdev);xennet_disconnect_backend (info); + +rtnl_lock (); +if (info->queues) +xennet_destroy_queues (info); +rtnl_unlock (); +return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 124/157 net: mvneta: Prevent out of bounds read in mvneta_config_rss()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit e8b4fc13900b8e8be48debffd0dfd391772501f7 ]
The pp->indir[0] value comes from the user. It is passed to:
if (cpu_online(pp->rxq_def))
inside the mvneta_percpu_elect() function. It needs bounds checkeding to ensure that it is not beyond the end of the cpu bitmap.
--- drivers/net/ethernet/marvell/mvneta.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/marvell/mvneta.c +3 -0
@@ -4927,6 +4927,9 @@ static int mvneta_config_rss(struct mvneta_port *pp)napi_disable (&pp->napi); } +if (pp->indir[0 ] >= nr_cpu_ids) +return -EINVAL ; + pp->rxq_def = pp->indir[0 ];/* Update unicast mapping */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 125/157 i40e: Fix not setting default xps_cpus after reset
In reply to Greg Kroah-HartmanFrom: Michal Jaron <[email protected]>
[ Upstream commit 82e0572b23029b380464fa9fdc125db9c1506d0a ]
During tx rings configuration default XPS queue config is set and __I40E_TX_XPS_INIT_DONE is locked. __I40E_TX_XPS_INIT_DONE state is cleared and set again with default mapping only during queues build, it means after first setup or reset with queues rebuild. (i.e. ethtool -L <interface> combined <number>) After other resets (i.e. ethtool -t <interface>) XPS_INIT_DONE is not cleared and those default maps cannot be set again. It results in cleared xps_cpus mapping until queues are not rebuild or mapping is not set by user.
Add clearing __I40E_TX_XPS_INIT_DONE state during reset to let the driver set xps_cpus to defaults again after it was cleared.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +18 -1
@@ -10661,6 +10661,21 @@ static int i40e_rebuild_channels(struct i40e_vsi *vsi)return 0 ; } +/** +* i40e_clean_xps_state - clean xps state for every tx_ring +* @vsi: ptr to the VSI +**/ +static void i40e_clean_xps_state (struct i40e_vsi *vsi) +{ +int i; + +if (vsi->tx_rings) +for (i =0 ; i < vsi->num_queue_pairs; i++) +if (vsi->tx_rings[i]) +clear_bit (__I40E_TX_XPS_INIT_DONE, + vsi->tx_rings[i]->state); +} +/** * i40e_prep_for_reset - prep for the core to reset * @pf: board private structure
@@ -10685,8 +10700,10 @@ static void i40e_prep_for_reset(struct i40e_pf *pf)i40e_pf_quiesce_all_vsi (pf);for (v =0 ; v < pf->num_alloc_vsi; v++) { -if (pf->vsi[v]) +if (pf->vsi[v]) { +i40e_clean_xps_state (pf->vsi[v]); pf->vsi[v]->seid =0 ; + } }i40e_shutdown_adminq (&pf->hw);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 126/157 i40e: Fix for VF MAC address 0
In reply to Greg Kroah-HartmanFrom: Sylwester Dziedziuch <[email protected]>
[ Upstream commit 08501970472077ed5de346ad89943a37d1692e9b ]
After spawning max VFs on a PF, some VFs were not getting resources and their MAC addresses were 0. This was caused by PF sleeping before flushing HW registers which caused VIRTCHNL_VFR_VFACTIVE to not be set in time for VF.
Fix by adding a sleep after hw flush.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +2 -0
@@ -1578,6 +1578,7 @@ bool i40e_reset_vf(struct i40e_vf *vf, bool flr)i40e_cleanup_reset_vf (vf);i40e_flush (hw); +usleep_range (20000 ,40000 );clear_bit (I40E_VF_STATE_RESETTING , &vf->vf_states);return true;
@@ -1701,6 +1702,7 @@ bool i40e_reset_all_vfs(struct i40e_pf *pf, bool flr) }i40e_flush (hw); +usleep_range (20000 ,40000 );clear_bit (__I40E_VF_DISABLE, pf->state);return true;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 127/157 i40e: Disallow ip4 and ip6 l4_4_bytes
In reply to Greg Kroah-HartmanFrom: Przemyslaw Patynowski <[email protected]>
[ Upstream commit d64aaf3f7869f915fd120763d75f11d6b116424d ]
Return -EOPNOTSUPP, when user requests l4_4_bytes for raw IP4 or IP6 flow director filters. Flow director does not support filtering on l4 bytes for PCTYPEs used by IP4 and IP6 filters. Without this patch, user could create filters with l4_4_bytes fields, which did not do any filtering on L4, but only on L3 fields.
--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +2 -10
@@ -4464,11 +4464,7 @@ static int i40e_check_fdir_input_set(struct i40e_vsi *vsi,return -EOPNOTSUPP ;/* First 4 bytes of L4 header */ -if (usr_ip4_spec->l4_4_bytes ==htonl (0xFFFFFFFF )) - new_mask |=I40E_L4_SRC_MASK |I40E_L4_DST_MASK ; -else if (!usr_ip4_spec->l4_4_bytes) - new_mask &= ~(I40E_L4_SRC_MASK |I40E_L4_DST_MASK ); -else +if (usr_ip4_spec->l4_4_bytes)return -EOPNOTSUPP ;/* Filtering on Type of Service is not supported. */
@@ -4507,11 +4503,7 @@ static int i40e_check_fdir_input_set(struct i40e_vsi *vsi,else return -EOPNOTSUPP ; -if (usr_ip6_spec->l4_4_bytes ==htonl (0xFFFFFFFF )) - new_mask |=I40E_L4_SRC_MASK |I40E_L4_DST_MASK ; -else if (!usr_ip6_spec->l4_4_bytes) - new_mask &= ~(I40E_L4_SRC_MASK |I40E_L4_DST_MASK ); -else +if (usr_ip6_spec->l4_4_bytes)return -EOPNOTSUPP ;/* Filtering on Traffic class is not supported. */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 128/157 NFC: nci: Bounds check struct nfc_target arrays
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit e329e71013c9b5a4535b099208493c7826ee4a64 ]
While running under CONFIG_FORTIFY_SOURCE=y, syzkaller reported:
memcpy: detected field-spanning write (size 129) of single field "target->sensf_res" at net/nfc/nci/ntf.c:260 (size 18)
This appears to be a legitimate lack of bounds checking in nci_add_new_protocol(). Add the missing checks.
--- net/nfc/nci/ntf.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/nfc/nci/ntf.c +6 -0
@@ -240,6 +240,8 @@ static int nci_add_new_protocol(struct nci_dev *ndev, target->sens_res = nfca_poll->sens_res; target->sel_res = nfca_poll->sel_res; target->nfcid1_len = nfca_poll->nfcid1_len; +if (target->nfcid1_len >ARRAY_SIZE (target->nfcid1)) +return -EPROTO ;if (target->nfcid1_len >0 ) {memcpy (target->nfcid1, nfca_poll->nfcid1, target->nfcid1_len);
@@ -248,6 +250,8 @@ static int nci_add_new_protocol(struct nci_dev *ndev, nfcb_poll = (struct rf_tech_specific_params_nfcb_poll *)params; target->sensb_res_len = nfcb_poll->sensb_res_len; +if (target->sensb_res_len >ARRAY_SIZE (target->sensb_res)) +return -EPROTO ;if (target->sensb_res_len >0 ) {memcpy (target->sensb_res, nfcb_poll->sensb_res, target->sensb_res_len);
@@ -256,6 +260,8 @@ static int nci_add_new_protocol(struct nci_dev *ndev, nfcf_poll = (struct rf_tech_specific_params_nfcf_poll *)params; target->sensf_res_len = nfcf_poll->sensf_res_len; +if (target->sensf_res_len >ARRAY_SIZE (target->sensf_res)) +return -EPROTO ;if (target->sensf_res_len >0 ) {memcpy (target->sensf_res, nfcf_poll->sensf_res, target->sensf_res_len);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 129/157 nvme initialize core quirks before calling nvme_init_subsystem
In reply to Greg Kroah-HartmanFrom: Pankaj Raghav <[email protected]>
[ Upstream commit 6f2d71524bcfdeb1fcbd22a4a92a5b7b161ab224 ]
A device might have a core quirk for NVME_QUIRK_IGNORE_DEV_SUBNQN (such as Samsung X5) but it would still give a:
"missing or invalid SUBNQN field"
warning as core quirks are filled after calling nvme_init_subnqn. Fill ctrl->quirks from struct core_quirks before calling nvme_init_subsystem to fix this.
Tested on a Samsung X5.
--- drivers/nvme/host/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/nvme/host/core.c +4 -4
@@ -3089,10 +3089,6 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl)if (!ctrl->identified) {unsigned int i; - ret =nvme_init_subsystem (ctrl, id); -if (ret) - goto out_free; -/* * Check for quirks. Quirk can depend on firmware version, * so, in principle, the set of quirks present can change
@@ -3105,6 +3101,10 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl)if (quirk_matches (id, &core_quirks[i])) ctrl->quirks |= core_quirks[i].quirks; } + + ret =nvme_init_subsystem (ctrl, id); +if (ret) + goto out_free; }memcpy (ctrl->subsys->firmware_rev, id->fr,sizeof (ctrl->subsys->firmware_rev));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 130/157 gpio/rockchip: fix refcount leak in rockchip_gpiolib_register()
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 63ff545af73f759d1bd04198af8ed8577fb739fc ]
The node returned by of_get_parent() with refcount incremented, of_node_put() needs be called when finish using it. So add it in the end of of_pinctrl_get().
--- drivers/gpio/gpio-rockchip.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpio-rockchip.c +1 -0
@@ -621,6 +621,7 @@ static int rockchip_gpiolib_register(struct rockchip_pin_bank *bank)return -ENODATA ; pctldev =of_pinctrl_get (pctlnp); +of_node_put (pctlnp);if (!pctldev)return -ENODEV ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 131/157 net: stmmac: fix "snps,axi-config" node property parsing
In reply to Greg Kroah-HartmanFrom: Jisheng Zhang <[email protected]>
[ Upstream commit 61d4f140943c47c1386ed89f7260e00418dfad9d ]
In dt-binding snps,dwmac.yaml, some properties under "snps,axi-config" node are named without "axi_" prefix, but the driver expects the prefix. Since the dt-binding has been there for a long time, we'd better make driver match the binding for compatibility.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +4 -4
@@ -108,10 +108,10 @@ static struct stmmac_axi *stmmac_axi_setup(struct platform_device *pdev) axi->axi_lpi_en =of_property_read_bool (np,"snps,lpi_en" ); axi->axi_xit_frm =of_property_read_bool (np,"snps,xit_frm" ); - axi->axi_kbbe =of_property_read_bool (np,"snps,axi_kbbe" ); - axi->axi_fb =of_property_read_bool (np,"snps,axi_fb" ); - axi->axi_mb =of_property_read_bool (np,"snps,axi_mb" ); - axi->axi_rb =of_property_read_bool (np,"snps,axi_rb" ); + axi->axi_kbbe =of_property_read_bool (np,"snps,kbbe" ); + axi->axi_fb =of_property_read_bool (np,"snps,fb" ); + axi->axi_mb =of_property_read_bool (np,"snps,mb" ); + axi->axi_rb =of_property_read_bool (np,"snps,rb" );if (of_property_read_u32 (np,"snps,wr_osr_lmt" , &axi->axi_wr_osr_lmt)) axi->axi_wr_osr_lmt =1 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 132/157 net: wwan: iosm: fix memory leak in ipc_mux_init()
In reply to Greg Kroah-HartmanFrom: Zhengchao Shao <[email protected]>
[ Upstream commit 23353efc26e98b61b925274ecbb8f0610f69a8aa ]
When failed to alloc ipc_mux->ul_adb.pp_qlt in ipc_mux_init(), ipc_mux is not released.
--- drivers/net/wwan/iosm/iosm_ipc_mux.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wwan/iosm/iosm_ipc_mux.c +1 -0
@@ -332,6 +332,7 @@ struct iosm_mux *ipc_mux_init(struct ipc_mux_config *mux_cfg,if (!ipc_mux->ul_adb.pp_qlt[i]) {for (j = i -1 ; j >=0 ; j--)kfree (ipc_mux->ul_adb.pp_qlt[j]); +kfree (ipc_mux);return NULL ; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 133/157 ip_gre: do not report erspan version on GRE interface
In reply to Greg Kroah-HartmanFrom: Hangbin Liu <[email protected]>
[ Upstream commit ee496694b9eea651ae1aa4c4667d886cdf74aa3b ]
Although the type I ERSPAN is based on the barebones IP + GRE encapsulation and no extra ERSPAN header. Report erspan version on GRE interface looks unreasonable. Fix this by separating the erspan and gre fill info.
IPv6 GRE does not have this info as IPv6 only supports erspan version 1 and 2.
--- net/ipv4/ip_gre.c | 48 ++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-)
net/ipv4/ip_gre.c +29 -19
@@ -1492,24 +1492,6 @@ static int ipgre_fill_info(struct sk_buff *skb, const struct net_device *dev)struct ip_tunnel_parm *p = &t->parms;__be16 o_flags = p->o_flags; -if (t->erspan_ver <=2 ) { -if (t->erspan_ver !=0 && !t->collect_md) - o_flags |=TUNNEL_KEY ; - -if (nla_put_u8 (skb,IFLA_GRE_ERSPAN_VER , t->erspan_ver)) - goto nla_put_failure; - -if (t->erspan_ver ==1 ) { -if (nla_put_u32 (skb,IFLA_GRE_ERSPAN_INDEX , t->index)) - goto nla_put_failure; - }else if (t->erspan_ver ==2 ) { -if (nla_put_u8 (skb,IFLA_GRE_ERSPAN_DIR , t->dir)) - goto nla_put_failure; -if (nla_put_u16 (skb,IFLA_GRE_ERSPAN_HWID , t->hwid)) - goto nla_put_failure; - } - } - if (nla_put_u32(skb, IFLA_GRE_LINK, p->link) || nla_put_be16(skb, IFLA_GRE_IFLAGS, gre_tnl_flags_to_gre_flags(p->i_flags)) ||
@@ -1550,6 +1532,34 @@ static int ipgre_fill_info(struct sk_buff *skb, const struct net_device *dev)return -EMSGSIZE ; } +static int erspan_fill_info (struct sk_buff *skb,const struct net_device *dev) +{ +struct ip_tunnel *t =netdev_priv (dev); + +if (t->erspan_ver <=2 ) { +if (t->erspan_ver !=0 && !t->collect_md) + t->parms.o_flags |=TUNNEL_KEY ; + +if (nla_put_u8 (skb,IFLA_GRE_ERSPAN_VER , t->erspan_ver)) + goto nla_put_failure; + +if (t->erspan_ver ==1 ) { +if (nla_put_u32 (skb,IFLA_GRE_ERSPAN_INDEX , t->index)) + goto nla_put_failure; + }else if (t->erspan_ver ==2 ) { +if (nla_put_u8 (skb,IFLA_GRE_ERSPAN_DIR , t->dir)) + goto nla_put_failure; +if (nla_put_u16 (skb,IFLA_GRE_ERSPAN_HWID , t->hwid)) + goto nla_put_failure; + } + } + +return ipgre_fill_info (skb, dev); + +nla_put_failure: +return -EMSGSIZE ; +} +static void erspan_setup (struct net_device *dev) {struct ip_tunnel *t =netdev_priv (dev);
@@ -1628,7 +1638,7 @@ static struct rtnl_link_ops erspan_link_ops __read_mostly = { .changelink = erspan_changelink, .dellink = ip_tunnel_dellink, .get_size = ipgre_get_size, - .fill_info = ipgre_fill_info, + .fill_info = erspan_fill_info, .get_link_net = ip_tunnel_get_link_net, };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 134/157 net: microchip: sparx5: Fix missing destroy_workqueue of mact_queue
In reply to Greg Kroah-HartmanFrom: Qiheng Lin <[email protected]>
[ Upstream commit 7b8232bdb1789a257de3129a9bb08c69b93a17db ]
The mchp_sparx5_probe() won't destroy workqueue created by create_singlethread_workqueue() in sparx5_start() when later inits failed. Add destroy_workqueue in the cleanup_ports case, also add it in mchp_sparx5_remove()
--- drivers/net/ethernet/microchip/sparx5/sparx5_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/microchip/sparx5/sparx5_main.c +3 -0
@@ -876,6 +876,8 @@ static int mchp_sparx5_probe(struct platform_device *pdev) cleanup_ports:sparx5_cleanup_ports (sparx5); +if (sparx5->mact_queue) +destroy_workqueue (sparx5->mact_queue); cleanup_config:kfree (configs); cleanup_pnode:
@@ -900,6 +902,7 @@ static int mchp_sparx5_remove(struct platform_device *pdev)sparx5_cleanup_ports (sparx5);/* Unregister netdevs */ sparx5_unregister_notifier_blocks (sparx5); +destroy_workqueue (sparx5->mact_queue);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 135/157 ravb: Fix potential use-after-free in ravb_rx_gbeth()
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 5a5a3e564de6a8db987410c5c2f4748d50ea82b8 ]
The skb is delivered to napi_gro_receive() which may free it, after calling this, dereferencing skb may trigger use-after-free.
--- drivers/net/ethernet/renesas/ravb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/renesas/ravb_main.c +1 -1
@@ -835,7 +835,7 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q)napi_gro_receive (&priv->napi[q], priv->rx_1st_skb); stats->rx_packets++; - stats->rx_bytes += priv->rx_1st_skb->len; + stats->rx_bytes += pkt_len;break ; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 136/157 net: thunderx: Fix missing destroy_workqueue of nicvf_rx_mode_wq
In reply to Greg Kroah-HartmanFrom: Yongqiang Liu <[email protected]>
[ Upstream commit 42330a32933fb42180c52022804dcf09f47a2f99 ]
The nicvf_probe() won't destroy workqueue when register_netdev() failed. Add destroy_workqueue err handle case to fix this issue.
--- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/cavium/thunder/nicvf_main.c +3 -1
@@ -2240,7 +2240,7 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err =register_netdev (netdev);if (err) {dev_err (dev,"Failed to register netdevice\n" ); - goto err_unregister_interrupts; + goto err_destroy_workqueue; } nic->msg_enable = debug;
@@ -2249,6 +2249,8 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)return 0 ; +err_destroy_workqueue: +destroy_workqueue (nic->nicvf_rx_mode_wq); err_unregister_interrupts:nicvf_unregister_interrupts (nic); err_free_netdev:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 137/157 net: hisilicon: Fix potential use-after-free in hisi_femac_rx()
In reply to Greg Kroah-HartmanFrom: Liu Jian <[email protected]>
[ Upstream commit 4640177049549de1a43e9bc49265f0cdfce08cfd ]
The skb is delivered to napi_gro_receive() which may free it, after calling this, dereferencing skb may trigger use-after-free.
--- drivers/net/ethernet/hisilicon/hisi_femac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hisi_femac.c +1 -1
@@ -283,7 +283,7 @@ static int hisi_femac_rx(struct net_device *dev, int limit) skb->protocol =eth_type_trans (skb, dev);napi_gro_receive (&priv->napi, skb); dev->stats.rx_packets++; - dev->stats.rx_bytes += skb->len; + dev->stats.rx_bytes += len; next: pos = (pos +1 ) % rxq->num;if (rx_pkts_num >= limit)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 138/157 net: mdio: fix unbalanced fwnode reference count in mdio_device_release()
In reply to Greg Kroah-HartmanFrom: Zeng Heng <[email protected]>
[ Upstream commit cb37617687f2bfa5b675df7779f869147c9002bd ]
There is warning report about of_node refcount leak while probing mdio device:
OF: ERROR: memory leak, expected refcount 1 instead of 2, of_node_get()/of_node_put() unbalanced - destroy cset entry:
attach overlay node /spi/soc@0/mdio@710700c0/ethernet@4
In of_mdiobus_register_device(), we increase fwnode refcount by fwnode_handle_get() before associating the of_node with mdio device, but it has never been decreased in normal path. Since that, in mdio_device_release(), it needs to call fwnode_handle_put() in addition instead of calling kfree() directly.
After above, just calling mdio_device_free() in the error handle path of of_mdiobus_register_device() is enough to keep the refcount balanced.
--- drivers/net/mdio/of_mdio.c | 3 ++- drivers/net/phy/mdio_device.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/net/mdio/of_mdio.c +2 -1
@@ -68,8 +68,9 @@ static int of_mdiobus_register_device(struct mii_bus *mdio,/* All data is now stored in the mdiodev struct; register it. */ rc =mdio_device_register (mdiodev);if (rc) { +device_set_node (&mdiodev->dev,NULL ); +fwnode_handle_put (fwnode);mdio_device_free (mdiodev); -of_node_put (child);return rc; }
drivers/net/phy/mdio_device.c +2 -0
@@ -21,6 +21,7 @@#include <linux/slab.h> #include <linux/string.h> #include <linux/unistd.h> +#include <linux/property.h> void mdio_device_free (struct mdio_device *mdiodev) {
@@ -30,6 +31,7 @@ EXPORT_SYMBOL(mdio_device_free);static void mdio_device_release (struct device *dev) { +fwnode_handle_put (dev->fwnode);kfree (to_mdio_device (dev)); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 139/157 net: hisilicon: Fix potential use-after-free in hix5hd2_rx()
In reply to Greg Kroah-HartmanFrom: Liu Jian <[email protected]>
[ Upstream commit 433c07a13f59856e4585e89e86b7d4cc59348fab ]
The skb is delivered to napi_gro_receive() which may free it, after calling this, dereferencing skb may trigger use-after-free.
--- drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hix5hd2_gmac.c +1 -1
@@ -550,7 +550,7 @@ static int hix5hd2_rx(struct net_device *dev, int limit) skb->protocol =eth_type_trans (skb, dev);napi_gro_receive (&priv->napi, skb); dev->stats.rx_packets++; - dev->stats.rx_bytes += skb->len; + dev->stats.rx_bytes += len; next: pos =dma_ring_incr (pos,RX_DESC_NUM ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 140/157 tipc: Fix potential OOB in tipc_link_proto_rcv()
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 743117a997bbd4840e827295c07e59bcd7f7caa3 ]
Fix the potential risk of OOB if skb_linearize() fails in tipc_link_proto_rcv().
--- net/tipc/link.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/tipc/link.c +3 -1
@@ -2224,7 +2224,9 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,if (tipc_own_addr (l->net) >msg_prevnode (hdr)) l->net_plane =msg_net_plane (hdr); -skb_linearize (skb); +if (skb_linearize (skb)) + goto exit; + hdr =buf_msg (skb); data =msg_data (hdr);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 141/157 bonding: get correct NA dest address
In reply to Greg Kroah-HartmanFrom: Hangbin Liu <[email protected]>
[ Upstream commit 1f154f3b56a1a172833eedf77b72745acc8d9259 ]
In commit 4d633d1b468b ("bonding: fix ICMPv6 header handling when receiving IPv6 messages"), there is a copy/paste issue for NA daddr. I found that in my testing and fixed it in my local branch. But I forgot to re-format the patch and sent the wrong mail.
Fix it by reading the correct dest address.
--- drivers/net/bonding/bond_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bonding/bond_main.c +1 -1
@@ -3247,7 +3247,7 @@ static int bond_na_rcv(const struct sk_buff *skb, struct bonding *bond, goto out; saddr = &combined->ip6.saddr; - daddr = &combined->ip6.saddr; + daddr = &combined->ip6.daddr; slave_dbg(bond->dev, slave->dev, "%s: %s/%d av %d sv %d sip %pI6c tip %pI6c\n", __func__, slave->dev->name, bond_slave_state(slave),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 142/157 ipv4: Fix incorrect route flushing when source address is deleted
In reply to Greg Kroah-HartmanFrom: Ido Schimmel <[email protected]>
[ Upstream commit f96a3d74554df537b6db5c99c27c80e7afadc8d1 ]
Cited commit added the table ID to the FIB info structure, but did not prevent structures with different table IDs from being consolidated. This can lead to routes being flushed from a VRF when an address is deleted from a different VRF.
Fix by taking the table ID into account when looking for a matching FIB info. This is already done for FIB info structures backed by a nexthop object in fib_find_info_nh().
Add test cases that fail before the fix:
# ./fib_tests.sh -t ipv4_del_addr
IPv4 delete address route tests
Regular FIB info
TEST: Route removed from VRF when source address deleted [ OK ]
TEST: Route in default VRF not removed [ OK ]
TEST: Route removed in default VRF when source address deleted [ OK ]
TEST: Route in VRF is not removed by address delete [ OK ]
Identical FIB info with different table ID
TEST: Route removed from VRF when source address deleted [FAIL]
TEST: Route in default VRF not removed [ OK ]
RTNETLINK answers: File exists
TEST: Route removed in default VRF when source address deleted [ OK ]
TEST: Route in VRF is not removed by address delete [FAIL]
Tests passed: 6
Tests failed: 2
And pass after:
# ./fib_tests.sh -t ipv4_del_addr
IPv4 delete address route tests
Regular FIB info
TEST: Route removed from VRF when source address deleted [ OK ]
TEST: Route in default VRF not removed [ OK ]
TEST: Route removed in default VRF when source address deleted [ OK ]
TEST: Route in VRF is not removed by address delete [ OK ]
Identical FIB info with different table ID
TEST: Route removed from VRF when source address deleted [ OK ]
TEST: Route in default VRF not removed [ OK ]
TEST: Route removed in default VRF when source address deleted [ OK ]
TEST: Route in VRF is not removed by address delete [ OK ]
Tests passed: 8
Tests failed: 0
--- net/ipv4/fib_semantics.c | 1 + tools/testing/selftests/net/fib_tests.sh | 27 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+)
net/ipv4/fib_semantics.c +1 -0
@@ -423,6 +423,7 @@ static struct fib_info *fib_find_info(struct fib_info *nfi) nfi->fib_prefsrc == fi->fib_prefsrc && nfi->fib_priority == fi->fib_priority && nfi->fib_type == fi->fib_type && + nfi->fib_tb_id == fi->fib_tb_id &&memcmp (nfi->fib_metrics, fi->fib_metrics,sizeof (u32) *RTAX_MAX ) ==0 && !((nfi->fib_flags ^ fi->fib_flags) & ~RTNH_COMPARE_MASK) &&
tools/testing/selftests/net/fib_tests.sh +27 -0
@@ -1711,13 +1711,19 @@ ipv4_del_addr_test() $IP addr add dev dummy1 172.16.104.1/24 $IP addr add dev dummy1 172.16.104.11/24 + $IP addr add dev dummy1 172.16.104.12/24 $IP addr add dev dummy2 172.16.104.1/24 $IP addr add dev dummy2 172.16.104.11/24 + $IP addr add dev dummy2 172.16.104.12/24 $IP route add 172.16.105.0/24 via 172.16.104.2 src 172.16.104.11 + $IP route add 172.16.106.0/24 dev lo src 172.16.104.12 $IP route add vrf red 172.16.105.0/24 via 172.16.104.2 src 172.16.104.11 + $IP route add vrf red 172.16.106.0/24 dev lo src 172.16.104.12 set +e # removing address from device in vrf should only remove route from vrf table + echo " Regular FIB info" + $IP addr del dev dummy2 172.16.104.11/24 $IP ro ls vrf red | grep -q 172.16.105.0/24 log_test $? 1 "Route removed from VRF when source address deleted"
@@ -1735,6 +1741,27 @@ ipv4_del_addr_test() $IP ro ls vrf red | grep -q 172.16.105.0/24 log_test $? 0 "Route in VRF is not removed by address delete" + # removing address from device in vrf should only remove route from vrf + # table even when the associated fib info only differs in table ID + echo " Identical FIB info with different table ID" + + $IP addr del dev dummy2 172.16.104.12/24 + $IP ro ls vrf red | grep -q 172.16.106.0/24 + log_test $? 1 "Route removed from VRF when source address deleted" + + $IP ro ls | grep -q 172.16.106.0/24 + log_test $? 0 "Route in default VRF not removed" + + $IP addr add dev dummy2 172.16.104.12/24 + $IP route add vrf red 172.16.106.0/24 dev lo src 172.16.104.12 + + $IP addr del dev dummy1 172.16.104.12/24 + $IP ro ls | grep -q 172.16.106.0/24 + log_test $? 1 "Route removed in default VRF when source address deleted" + + $IP ro ls vrf red | grep -q 172.16.106.0/24 + log_test $? 0 "Route in VRF is not removed by address delete" + $IP li del dummy1 $IP li del dummy2 cleanup
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 143/157 ipv4: Fix incorrect route flushing when table ID 0 is used
In reply to Greg Kroah-HartmanFrom: Ido Schimmel <[email protected]>
[ Upstream commit c0d999348e01df03e0a7f550351f3907fabbf611 ]
Cited commit added the table ID to the FIB info structure, but did not properly initialize it when table ID 0 is used. This can lead to a route in the default VRF with a preferred source address not being flushed when the address is deleted.
Consider the following example:
# ip address add dev dummy1 192.0.2.1/28 # ip address add dev dummy1 192.0.2.17/28 # ip route add 198.51.100.0/24 via 192.0.2.2 src 192.0.2.17 metric 100 # ip route add table 0 198.51.100.0/24 via 192.0.2.2 src 192.0.2.17 metric 200 # ip route show 198.51.100.0/24 198.51.100.0/24 via 192.0.2.2 dev dummy1 src 192.0.2.17 metric 100 198.51.100.0/24 via 192.0.2.2 dev dummy1 src 192.0.2.17 metric 200
Both routes are installed in the default VRF, but they are using two different FIB info structures. One with a metric of 100 and table ID of 254 (main) and one with a metric of 200 and table ID of 0. Therefore, when the preferred source address is deleted from the default VRF, the second route is not flushed:
# ip address del dev dummy1 192.0.2.17/28 # ip route show 198.51.100.0/24 198.51.100.0/24 via 192.0.2.2 dev dummy1 src 192.0.2.17 metric 200
Fix by storing a table ID of 254 instead of 0 in the route configuration structure.
Add a test case that fails before the fix:
# ./fib_tests.sh -t ipv4_del_addr
IPv4 delete address route tests
Regular FIB info
TEST: Route removed from VRF when source address deleted [ OK ]
TEST: Route in default VRF not removed [ OK ]
TEST: Route removed in default VRF when source address deleted [ OK ]
TEST: Route in VRF is not removed by address delete [ OK ]
Identical FIB info with different table ID
TEST: Route removed from VRF when source address deleted [ OK ]
TEST: Route in default VRF not removed [ OK ]
TEST: Route removed in default VRF when source address deleted [ OK ]
TEST: Route in VRF is not removed by address delete [ OK ]
Table ID 0
TEST: Route removed in default VRF when source address deleted [FAIL]
Tests passed: 8
Tests failed: 1
And passes after:
# ./fib_tests.sh -t ipv4_del_addr
IPv4 delete address route tests
Regular FIB info
TEST: Route removed from VRF when source address deleted [ OK ]
TEST: Route in default VRF not removed [ OK ]
TEST: Route removed in default VRF when source address deleted [ OK ]
TEST: Route in VRF is not removed by address delete [ OK ]
Identical FIB info with different table ID
TEST: Route removed from VRF when source address deleted [ OK ]
TEST: Route in default VRF not removed [ OK ]
TEST: Route removed in default VRF when source address deleted [ OK ]
TEST: Route in VRF is not removed by address delete [ OK ]
Table ID 0
TEST: Route removed in default VRF when source address deleted [ OK ]
Tests passed: 9
Tests failed: 0
--- net/ipv4/fib_frontend.c | 3 +++ tools/testing/selftests/net/fib_tests.sh | 10 ++++++++++ 2 files changed, 13 insertions(+)
net/ipv4/fib_frontend.c +3 -0
@@ -841,6 +841,9 @@ static int rtm_to_fib_config(struct net *net, struct sk_buff *skb,return -EINVAL ; } +if (!cfg->fc_table) + cfg->fc_table =RT_TABLE_MAIN ; +return 0 ; errout:return err;
tools/testing/selftests/net/fib_tests.sh +10 -0
@@ -1712,11 +1712,13 @@ ipv4_del_addr_test() $IP addr add dev dummy1 172.16.104.1/24 $IP addr add dev dummy1 172.16.104.11/24 $IP addr add dev dummy1 172.16.104.12/24 + $IP addr add dev dummy1 172.16.104.13/24 $IP addr add dev dummy2 172.16.104.1/24 $IP addr add dev dummy2 172.16.104.11/24 $IP addr add dev dummy2 172.16.104.12/24 $IP route add 172.16.105.0/24 via 172.16.104.2 src 172.16.104.11 $IP route add 172.16.106.0/24 dev lo src 172.16.104.12 + $IP route add table 0 172.16.107.0/24 via 172.16.104.2 src 172.16.104.13 $IP route add vrf red 172.16.105.0/24 via 172.16.104.2 src 172.16.104.11 $IP route add vrf red 172.16.106.0/24 dev lo src 172.16.104.12 set +e
@@ -1762,6 +1764,14 @@ ipv4_del_addr_test() $IP ro ls vrf red | grep -q 172.16.106.0/24 log_test $? 0 "Route in VRF is not removed by address delete" + # removing address from device in default vrf should remove route from + # the default vrf even when route was inserted with a table ID of 0. + echo " Table ID 0" + + $IP addr del dev dummy1 172.16.104.13/24 + $IP ro ls | grep -q 172.16.107.0/24 + log_test $? 1 "Route removed in default VRF when source address deleted" + $IP li del dummy1 $IP li del dummy2 cleanup
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 144/157 net: dsa: sja1105: fix memory leak in sja1105_setup_devlink_regions()
In reply to Greg Kroah-HartmanFrom: Zhengchao Shao <[email protected]>
[ Upstream commit 78a9ea43fc1a7c06a420b132d2d47cbf4344a5df ]
When dsa_devlink_region_create failed in sja1105_setup_devlink_regions(), priv->regions is not released.
--- drivers/net/dsa/sja1105/sja1105_devlink.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/dsa/sja1105/sja1105_devlink.c +2 -0
@@ -95,6 +95,8 @@ static int sja1105_setup_devlink_regions(struct dsa_switch *ds)if (IS_ERR (region)) {while (--i >=0 )dsa_devlink_region_destroy (priv->regions[i]); + +kfree (priv->regions);return PTR_ERR (region); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 145/157 tipc: call tipc_lxc_xmit without holding node_read_lock
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 88956177db179e4eba7cd590971961857d1565b8 ]
When sending packets between nodes in netns, it calls tipc_lxc_xmit() for peer node to receive the packets where tipc_sk_mcast_rcv()/tipc_sk_rcv() might be called, and it's pretty much like in tipc_rcv().
Currently the local 'node rw lock' is held during calling tipc_lxc_xmit() to protect the peer_net not being freed by another thread. However, when receiving these packets, tipc_node_add_conn() might be called where the peer 'node rw lock' is acquired. Then a dead lock warning is triggered by lockdep detector, although it is not a real dead lock:
WARNING: possible recursive locking detected
--------------------------------------------
conn_server/1086 is trying to acquire lock:
ffff8880065cb020 (&n->lock#2){++--}-{2:2}, \
at: tipc_node_add_conn.cold.76+0xaa/0x211 [tipc]
but task is already holding lock:
ffff8880065cd020 (&n->lock#2){++--}-{2:2}, \
at: tipc_node_xmit+0x285/0xb30 [tipc]
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(&n->lock#2);
lock(&n->lock#2);
*** DEADLOCK ***
May be due to missing lock nesting notation
4 locks held by conn_server/1086:
#0: ffff8880036d1e40 (sk_lock-AF_TIPC){+.+.}-{0:0}, \
at: tipc_accept+0x9c0/0x10b0 [tipc]
#1: ffff8880036d5f80 (sk_lock-AF_TIPC/1){+.+.}-{0:0}, \
at: tipc_accept+0x363/0x10b0 [tipc]
#2: ffff8880065cd020 (&n->lock#2){++--}-{2:2}, \
at: tipc_node_xmit+0x285/0xb30 [tipc]
#3: ffff888012e13370 (slock-AF_TIPC){+...}-{2:2}, \
at: tipc_sk_rcv+0x2da/0x1b40 [tipc]
Call Trace:
<TASK>
dump_stack_lvl+0x44/0x5b
__lock_acquire.cold.77+0x1f2/0x3d7
lock_acquire+0x1d2/0x610
_raw_write_lock_bh+0x38/0x80
tipc_node_add_conn.cold.76+0xaa/0x211 [tipc]
tipc_sk_finish_conn+0x21e/0x640 [tipc]
tipc_sk_filter_rcv+0x147b/0x3030 [tipc]
tipc_sk_rcv+0xbb4/0x1b40 [tipc]
tipc_lxc_xmit+0x225/0x26b [tipc]
tipc_node_xmit.cold.82+0x4a/0x102 [tipc]
__tipc_sendstream+0x879/0xff0 [tipc]
tipc_accept+0x966/0x10b0 [tipc]
do_accept+0x37d/0x590This patch avoids this warning by not holding the 'node rw lock' before calling tipc_lxc_xmit(). As to protect the 'peer_net', rcu_read_lock() should be enough, as in cleanup_net() when freeing the netns, it calls synchronize_rcu() before the free is continued.
Also since tipc_lxc_xmit() is like the RX path in tipc_rcv(), it makes sense to call it under rcu_read_lock(). Note that the right lock order must be:
rcu_read_lock(); tipc_node_read_lock(n); tipc_node_read_unlock(n); tipc_lxc_xmit(); rcu_read_unlock();
instead of:
tipc_node_read_lock(n); rcu_read_lock(); tipc_node_read_unlock(n); tipc_lxc_xmit(); rcu_read_unlock();
and we have to call tipc_node_read_lock/unlock() twice in tipc_node_xmit().
--- net/tipc/node.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
net/tipc/node.c +9 -3
@@ -1689,6 +1689,7 @@ int tipc_node_xmit(struct net *net, struct sk_buff_head *list,struct tipc_node *n;struct sk_buff_head xmitq;bool node_up = false; +struct net *peer_net;int bearer_id;int rc;
@@ -1705,18 +1706,23 @@ int tipc_node_xmit(struct net *net, struct sk_buff_head *list,return -EHOSTUNREACH ; } +rcu_read_lock ();tipc_node_read_lock (n); node_up =node_is_up (n); -if (node_up && n->peer_net &&check_net (n->peer_net)) { + peer_net = n->peer_net; +tipc_node_read_unlock (n); +if (node_up && peer_net &&check_net (peer_net)) {/* xmit inner linux container */ -tipc_lxc_xmit (n->peer_net, list); +tipc_lxc_xmit (peer_net, list);if (likely (skb_queue_empty (list))) { -tipc_node_read_unlock (n); +rcu_read_unlock ();tipc_node_put (n);return 0 ; } } +rcu_read_unlock (); +tipc_node_read_lock (n); bearer_id = n->active_links[selector &1 ];if (unlikely (bearer_id ==INVALID_BEARER_ID )) {tipc_node_read_unlock (n);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 146/157 ethernet: aeroflex: fix potential skb leak in greth_init_rings()
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
[ Upstream commit 063a932b64db3317ec020c94466fe52923a15f60 ]
The greth_init_rings() function won't free the newly allocated skb when dma_mapping_error() returns error, so add dev_kfree_skb() to fix it.
Compile tested only.
--- drivers/net/ethernet/aeroflex/greth.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/aeroflex/greth.c +1 -0
@@ -258,6 +258,7 @@ static int greth_init_rings(struct greth_private *greth)if (dma_mapping_error (greth->dev, dma_addr)) {if (netif_msg_ifup (greth))dev_err (greth->dev,"Could not create initial DMA mapping\n" ); +dev_kfree_skb (skb); goto cleanup; } greth->rx_skbuff[i] = skb;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 147/157 dpaa2-switch: Fix memory leak in dpaa2_switch_acl_entry_add() and dpaa2_switch_acl_entry_remove()
In reply to Greg Kroah-HartmanFrom: Yuan Can <[email protected]>
[ Upstream commit 4fad22a1281c500f15b172c9d261eff347ca634b ]
The cmd_buff needs to be freed when error happened in dpaa2_switch_acl_entry_add() and dpaa2_switch_acl_entry_remove().
--- drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c +4 -0
@@ -132,6 +132,7 @@ int dpaa2_switch_acl_entry_add(struct dpaa2_switch_filter_block *filter_block, DMA_TO_DEVICE);if (unlikely (dma_mapping_error (dev, acl_entry_cfg->key_iova))) {dev_err (dev,"DMA mapping failed\n" ); +kfree (cmd_buff);return -EFAULT ; }
@@ -142,6 +143,7 @@ int dpaa2_switch_acl_entry_add(struct dpaa2_switch_filter_block *filter_block, DMA_TO_DEVICE);if (err) {dev_err (dev,"dpsw_acl_add_entry() failed %d\n" , err); +kfree (cmd_buff);return err; }
@@ -172,6 +174,7 @@ dpaa2_switch_acl_entry_remove(struct dpaa2_switch_filter_block *block, DMA_TO_DEVICE);if (unlikely (dma_mapping_error (dev, acl_entry_cfg->key_iova))) {dev_err (dev,"DMA mapping failed\n" ); +kfree (cmd_buff);return -EFAULT ; }
@@ -182,6 +185,7 @@ dpaa2_switch_acl_entry_remove(struct dpaa2_switch_filter_block *block, DMA_TO_DEVICE);if (err) {dev_err (dev,"dpsw_acl_remove_entry() failed %d\n" , err); +kfree (cmd_buff);return err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 148/157 xen/netback: fix build warning
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
[ Upstream commit 7dfa764e0223a324366a2a1fc056d4d9d4e95491 ]
Commit ad7f402ae4f4 ("xen/netback: Ensure protocol headers don't fall in the non-linear area") introduced a (valid) build warning. There have even been reports of this problem breaking networking of Xen guests.
--- drivers/net/xen-netback/netback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen-netback/netback.c +1 -1
@@ -530,7 +530,7 @@ static int xenvif_tx_check_gop(struct xenvif_queue *queue,const bool sharedslot = nr_frags &&frag_get_pending_idx (&shinfo->frags[0 ]) ==copy_pending_idx (skb,copy_count (skb) -1 ); -int i, err; +int i, err =0 ;for (i =0 ; i <copy_count (skb); i++) {int newerr;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 149/157 net: dsa: mv88e6xxx: accept phy-mode = "internal" for internal PHY ports
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 87a39882b5ab3127700ac4b9277608075f98eda2 ]
The ethernet-controller dt-schema, mostly pushed forward by Linux, has the "internal" PHY mode for denoting MAC connections to an internal PHY.
U-Boot may provide device tree blobs where this phy-mode is specified, so make the Linux driver accept them.
It appears that the current behavior with phy-mode = "internal" was introduced when mv88e6xxx started reporting supported_interfaces to phylink. Prior to that, I don't think it would have any issues accepting this phy-mode.
--- drivers/net/dsa/mv88e6xxx/chip.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.c +5 -2
@@ -825,10 +825,13 @@ static void mv88e6xxx_get_caps(struct dsa_switch *ds, int port, chip->info->ops->phylink_get_caps (chip, port, config); -/* Internal ports need GMII for PHYLIB */ -if (mv88e6xxx_phy_is_internal (ds, port)) +if (mv88e6xxx_phy_is_internal (ds, port)) { +__set_bit (PHY_INTERFACE_MODE_INTERNAL , + config->supported_interfaces); +/* Internal ports with no phy-mode need GMII for PHYLIB */ __set_bit (PHY_INTERFACE_MODE_GMII , config->supported_interfaces); + } } static void mv88e6xxx_mac_config(struct dsa_switch *ds, int port,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 150/157 net: phy: mxl-gpy: add MDINT workaround
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit 5f4d487d01ff5349da38f7a09ca36bf6aa2e29fb ]
At least the GPY215B and GPY215C has a bug where it is still driving the interrupt line (MDINT) even after the interrupt status register is read and its bits are cleared. This will cause an interrupt storm.
Although the MDINT is multiplexed with a GPIO pin and theoretically we could switch the pinmux to GPIO input mode, this isn't possible because the access to this register will stall exactly as long as the interrupt line is asserted. We exploit this very fact and just read a random internal register in our interrupt handler. This way, it will be delayed until the external interrupt line is released and an interrupt storm is avoided.
The internal register access via the mailbox was deduced by looking at the downstream PHY API because the datasheet doesn't mention any of this.
--- drivers/net/phy/mxl-gpy.c | 85 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+)
drivers/net/phy/mxl-gpy.c +85 -0
@@ -9,6 +9,7 @@#include <linux/module.h> #include <linux/bitfield.h> #include <linux/hwmon.h> +#include <linux/mutex.h> #include <linux/phy.h> #include <linux/polynomial.h> #include <linux/netdevice.h>
@@ -70,6 +71,14 @@#define VPSPEC1_TEMP_STA 0x0E#define VPSPEC1_TEMP_STA_DATA GENMASK(9, 0) +/* Mailbox */ +#define VSPEC1_MBOX_DATA 0x5 +#define VSPEC1_MBOX_ADDRLO 0x6 +#define VSPEC1_MBOX_CMD 0x7 +#define VSPEC1_MBOX_CMD_ADDRHI GENMASK(7, 0) +#define VSPEC1_MBOX_CMD_RD (0 << 8) +#define VSPEC1_MBOX_CMD_READY BIT(15) +/* WoL */ #define VPSPEC2_WOL_CTL 0x0E06#define VPSPEC2_WOL_AD01 0x0E08
@@ -77,7 +86,13 @@#define VPSPEC2_WOL_AD45 0x0E0A#define WOL_EN BIT(0) +/* Internal registers, access via mbox */ +#define REG_GPIO0_OUT 0xd3ce00 +struct gpy_priv { +/* serialize mailbox acesses */ +struct mutex mbox_lock; +u8 fw_major;u8 fw_minor; };
@@ -187,6 +202,45 @@ static int gpy_hwmon_register(struct phy_device *phydev) }#endif +static int gpy_mbox_read (struct phy_device *phydev,u32 addr) +{ +struct gpy_priv *priv = phydev->priv; +int val, ret; +u16 cmd; + +mutex_lock (&priv->mbox_lock); + + ret =phy_write_mmd (phydev,MDIO_MMD_VEND1 ,VSPEC1_MBOX_ADDRLO , + addr); +if (ret) + goto out; + + cmd =VSPEC1_MBOX_CMD_RD ; + cmd |=FIELD_PREP (VSPEC1_MBOX_CMD_ADDRHI , addr >>16 ); + + ret =phy_write_mmd (phydev,MDIO_MMD_VEND1 ,VSPEC1_MBOX_CMD , cmd); +if (ret) + goto out; + +/* The mbox read is used in the interrupt workaround. It was observed +* that a read might take up to 2.5ms. This is also the time for which +* the interrupt line is stuck low. To be on the safe side, poll the +* ready bit for 10ms. +*/ + ret =phy_read_mmd_poll_timeout (phydev,MDIO_MMD_VEND1 , +VSPEC1_MBOX_CMD , val, + (val &VSPEC1_MBOX_CMD_READY ), +500 ,10000 , false); +if (ret) + goto out; + + ret =phy_read_mmd (phydev,MDIO_MMD_VEND1 ,VSPEC1_MBOX_DATA ); + +out: +mutex_unlock (&priv->mbox_lock); +return ret; +} +static int gpy_config_init (struct phy_device *phydev) {int ret;
@@ -201,6 +255,13 @@ static int gpy_config_init(struct phy_device *phydev)return ret <0 ? ret :0 ; } +static bool gpy_has_broken_mdint (struct phy_device *phydev) +{ +/* At least these PHYs are known to have broken interrupt handling */ +return phydev->drv->phy_id ==PHY_ID_GPY215B || + phydev->drv->phy_id ==PHY_ID_GPY215C ; +} +static int gpy_probe (struct phy_device *phydev) {struct device *dev = &phydev->mdio.dev;
@@ -218,6 +279,7 @@ static int gpy_probe(struct phy_device *phydev)if (!priv)return -ENOMEM ; phydev->priv = priv; +mutex_init (&priv->mbox_lock); fw_version =phy_read (phydev,PHY_FWV );if (fw_version <0 )
@@ -492,6 +554,29 @@ static irqreturn_t gpy_handle_interrupt(struct phy_device *phydev)if (!(reg &PHY_IMASK_MASK ))return IRQ_NONE ; +/* The PHY might leave the interrupt line asserted even after PHY_ISTAT +* is read. To avoid interrupt storms, delay the interrupt handling as +* long as the PHY drives the interrupt line. An internal bus read will +* stall as long as the interrupt line is asserted, thus just read a +* random register here. +* Because we cannot access the internal bus at all while the interrupt +* is driven by the PHY, there is no way to make the interrupt line +* unstuck (e.g. by changing the pinmux to GPIO input) during that time +* frame. Therefore, polling is the best we can do and won't do any more +* harm. +* It was observed that this bug happens on link state and link speed +* changes on a GPY215B and GYP215C independent of the firmware version +* (which doesn't mean that this list is exhaustive). +*/ +if (gpy_has_broken_mdint (phydev) && + (reg & (PHY_IMASK_LSTC |PHY_IMASK_LSPC ))) { + reg =gpy_mbox_read (phydev,REG_GPIO0_OUT ); +if (reg <0 ) { +phy_error (phydev); +return IRQ_NONE ; + } + } +phy_trigger_machine (phydev);return IRQ_HANDLED ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 151/157 net: plip: dont call kfree_skb/dev_kfree_skb() under spin_lock_irq()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 7d8c19bfc8ff3f78e5337107ca9246327fcb6b45 ]
It is not allowed to call kfree_skb() or consume_skb() from hardware interrupt context or with interrupts being disabled. So replace kfree_skb/dev_kfree_skb() with dev_kfree_skb_irq() and dev_consume_skb_irq() under spin_lock_irq().
--- drivers/net/plip/plip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/plip/plip.c +2 -2
@@ -450,12 +450,12 @@ plip_bh_timeout_error(struct net_device *dev, struct net_local *nl, } rcv->state =PLIP_PK_DONE ;if (rcv->skb) { -kfree_skb (rcv->skb); +dev_kfree_skb_irq (rcv->skb); rcv->skb =NULL ; } snd->state =PLIP_PK_DONE ;if (snd->skb) { -dev_kfree_skb (snd->skb); +dev_consume_skb_irq (snd->skb); snd->skb =NULL ; }spin_unlock_irq (&nl->lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 152/157 ipv6: avoid use-after-free in ip6_fragment()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 803e84867de59a1e5d126666d25eb4860cfd2ebe ]
Blamed commit claimed rcu_read_lock() was held by ip6_fragment() callers.
It seems to not be always true, at least for UDP stack.
syzbot reported:
BUG: KASAN: use-after-free in ip6_dst_idev include/net/ip6_fib.h:245 [inline] BUG: KASAN: use-after-free in ip6_fragment+0x2724/0x2770 net/ipv6/ip6_output.c:951 Read of size 8 at addr ffff88801d403e80 by task syz-executor.3/7618 CPU: 1 PID: 7618 Comm: syz-executor.3 Not tainted 6.1.0-rc6-syzkaller-00012-g4312098baf37 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15e/0x45d mm/kasan/report.c:395 kasan_report+0xbf/0x1f0 mm/kasan/report.c:495 ip6_dst_idev include/net/ip6_fib.h:245 [inline] ip6_fragment+0x2724/0x2770 net/ipv6/ip6_output.c:951 __ip6_finish_output net/ipv6/ip6_output.c:193 [inline] ip6_finish_output+0x9a3/0x1170 net/ipv6/ip6_output.c:206 NF_HOOK_COND include/linux/netfilter.h:291 [inline] ip6_output+0x1f1/0x540 net/ipv6/ip6_output.c:227 dst_output include/net/dst.h:445 [inline] ip6_local_out+0xb3/0x1a0 net/ipv6/output_core.c:161 ip6_send_skb+0xbb/0x340 net/ipv6/ip6_output.c:1966 udp_v6_send_skb+0x82a/0x18a0 net/ipv6/udp.c:1286 udp_v6_push_pending_frames+0x140/0x200 net/ipv6/udp.c:1313 udpv6_sendmsg+0x18da/0x2c80 net/ipv6/udp.c:1606 inet6_sendmsg+0x9d/0xe0 net/ipv6/af_inet6.c:665 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xd3/0x120 net/socket.c:734 sock_write_iter+0x295/0x3d0 net/socket.c:1108 call_write_iter include/linux/fs.h:2191 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x9ed/0xdd0 fs/read_write.c:584 ksys_write+0x1ec/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fde3588c0d9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fde365b6168 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007fde359ac050 RCX: 00007fde3588c0d9 RDX: 000000000000ffdc RSI: 00000000200000c0 RDI: 000000000000000a RBP: 00007fde358e7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fde35acfb1f R14: 00007fde365b6300 R15: 0000000000022000 </TASK> Allocated by task 7618: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 __kasan_slab_alloc+0x82/0x90 mm/kasan/common.c:325 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slab.h:737 [inline] slab_alloc_node mm/slub.c:3398 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x2b4/0x3d0 mm/slub.c:3422 dst_alloc+0x14a/0x1f0 net/core/dst.c:92 ip6_dst_alloc+0x32/0xa0 net/ipv6/route.c:344 ip6_rt_pcpu_alloc net/ipv6/route.c:1369 [inline] rt6_make_pcpu_route net/ipv6/route.c:1417 [inline] ip6_pol_route+0x901/0x1190 net/ipv6/route.c:2254 pol_lookup_func include/net/ip6_fib.h:582 [inline] fib6_rule_lookup+0x52e/0x6f0 net/ipv6/fib6_rules.c:121 ip6_route_output_flags_noref+0x2e6/0x380 net/ipv6/route.c:2625 ip6_route_output_flags+0x76/0x320 net/ipv6/route.c:2638 ip6_route_output include/net/ip6_route.h:98 [inline] ip6_dst_lookup_tail+0x5ab/0x1620 net/ipv6/ip6_output.c:1092 ip6_dst_lookup_flow+0x90/0x1d0 net/ipv6/ip6_output.c:1222 ip6_sk_dst_lookup_flow+0x553/0x980 net/ipv6/ip6_output.c:1260 udpv6_sendmsg+0x151d/0x2c80 net/ipv6/udp.c:1554 inet6_sendmsg+0x9d/0xe0 net/ipv6/af_inet6.c:665 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xd3/0x120 net/socket.c:734 __sys_sendto+0x23a/0x340 net/socket.c:2117 __do_sys_sendto net/socket.c:2129 [inline] __se_sys_sendto net/socket.c:2125 [inline] __x64_sys_sendto+0xe1/0x1b0 net/socket.c:2125 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 7599: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:511 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1750 slab_free mm/slub.c:3661 [inline] kmem_cache_free+0xee/0x5c0 mm/slub.c:3683 dst_destroy+0x2ea/0x400 net/core/dst.c:127 rcu_do_batch kernel/rcu/tree.c:2250 [inline] rcu_core+0x81f/0x1980 kernel/rcu/tree.c:2510 __do_softirq+0x1fb/0xadc kernel/softirq.c:571 Last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:481 call_rcu+0x9d/0x820 kernel/rcu/tree.c:2798 dst_release net/core/dst.c:177 [inline] dst_release+0x7d/0xe0 net/core/dst.c:167 refdst_drop include/net/dst.h:256 [inline] skb_dst_drop include/net/dst.h:268 [inline] skb_release_head_state+0x250/0x2a0 net/core/skbuff.c:838 skb_release_all net/core/skbuff.c:852 [inline] __kfree_skb net/core/skbuff.c:868 [inline] kfree_skb_reason+0x151/0x4b0 net/core/skbuff.c:891 kfree_skb_list_reason+0x4b/0x70 net/core/skbuff.c:901 kfree_skb_list include/linux/skbuff.h:1227 [inline] ip6_fragment+0x2026/0x2770 net/ipv6/ip6_output.c:949 __ip6_finish_output net/ipv6/ip6_output.c:193 [inline] ip6_finish_output+0x9a3/0x1170 net/ipv6/ip6_output.c:206 NF_HOOK_COND include/linux/netfilter.h:291 [inline] ip6_output+0x1f1/0x540 net/ipv6/ip6_output.c:227 dst_output include/net/dst.h:445 [inline] ip6_local_out+0xb3/0x1a0 net/ipv6/output_core.c:161 ip6_send_skb+0xbb/0x340 net/ipv6/ip6_output.c:1966 udp_v6_send_skb+0x82a/0x18a0 net/ipv6/udp.c:1286 udp_v6_push_pending_frames+0x140/0x200 net/ipv6/udp.c:1313 udpv6_sendmsg+0x18da/0x2c80 net/ipv6/udp.c:1606 inet6_sendmsg+0x9d/0xe0 net/ipv6/af_inet6.c:665 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xd3/0x120 net/socket.c:734 sock_write_iter+0x295/0x3d0 net/socket.c:1108 call_write_iter include/linux/fs.h:2191 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x9ed/0xdd0 fs/read_write.c:584 ksys_write+0x1ec/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Second to last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:481 call_rcu+0x9d/0x820 kernel/rcu/tree.c:2798 dst_release net/core/dst.c:177 [inline] dst_release+0x7d/0xe0 net/core/dst.c:167 refdst_drop include/net/dst.h:256 [inline] skb_dst_drop include/net/dst.h:268 [inline] __dev_queue_xmit+0x1b9d/0x3ba0 net/core/dev.c:4211 dev_queue_xmit include/linux/netdevice.h:3008 [inline] neigh_resolve_output net/core/neighbour.c:1552 [inline] neigh_resolve_output+0x51b/0x840 net/core/neighbour.c:1532 neigh_output include/net/neighbour.h:546 [inline] ip6_finish_output2+0x56c/0x1530 net/ipv6/ip6_output.c:134 __ip6_finish_output net/ipv6/ip6_output.c:195 [inline] ip6_finish_output+0x694/0x1170 net/ipv6/ip6_output.c:206 NF_HOOK_COND include/linux/netfilter.h:291 [inline] ip6_output+0x1f1/0x540 net/ipv6/ip6_output.c:227 dst_output include/net/dst.h:445 [inline] NF_HOOK include/linux/netfilter.h:302 [inline] NF_HOOK include/linux/netfilter.h:296 [inline] mld_sendpack+0xa09/0xe70 net/ipv6/mcast.c:1820 mld_send_cr net/ipv6/mcast.c:2121 [inline] mld_ifc_work+0x720/0xdc0 net/ipv6/mcast.c:2653 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x669/0x1090 kernel/workqueue.c:2436 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 The buggy address belongs to the object at ffff88801d403dc0 which belongs to the cache ip6_dst_cache of size 240
The buggy address is located 192 bytes inside of
240-byte region [ffff88801d403dc0, ffff88801d403eb0)
The buggy address belongs to the physical page: page:ffffea00007500c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1d403 memcg:ffff888022f49c81 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea0001ef6580 dead000000000002 ffff88814addf640 raw: 0000000000000000 00000000800c000c 00000001ffffffff ffff888022f49c81 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 3719, tgid 3719 (kworker/0:6), ts 136223432244, free_ts 136222971441 prep_new_page mm/page_alloc.c:2539 [inline] get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4288 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5555 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2285 alloc_slab_page mm/slub.c:1794 [inline] allocate_slab+0x213/0x300 mm/slub.c:1939 new_slab mm/slub.c:1992 [inline] ___slab_alloc+0xa91/0x1400 mm/slub.c:3180 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3279 slab_alloc_node mm/slub.c:3364 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x31a/0x3d0 mm/slub.c:3422 dst_alloc+0x14a/0x1f0 net/core/dst.c:92 ip6_dst_alloc+0x32/0xa0 net/ipv6/route.c:344 icmp6_dst_alloc+0x71/0x680 net/ipv6/route.c:3261 mld_sendpack+0x5de/0xe70 net/ipv6/mcast.c:1809 mld_send_cr net/ipv6/mcast.c:2121 [inline] mld_ifc_work+0x720/0xdc0 net/ipv6/mcast.c:2653 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x669/0x1090 kernel/workqueue.c:2436 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1459 [inline] free_pcp_prepare+0x65c/0xd90 mm/page_alloc.c:1509 free_unref_page_prepare mm/page_alloc.c:3387 [inline] free_unref_page+0x1d/0x4d0 mm/page_alloc.c:3483 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2586 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x184/0x210 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x66/0x90 mm/kasan/common.c:302 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slab.h:737 [inline] slab_alloc_node mm/slub.c:3398 [inline] kmem_cache_alloc_node+0x304/0x410 mm/slub.c:3443 __alloc_skb+0x214/0x300 net/core/skbuff.c:497 alloc_skb include/linux/skbuff.h:1267 [inline] netlink_alloc_large_skb net/netlink/af_netlink.c:1191 [inline] netlink_sendmsg+0x9a6/0xe10 net/netlink/af_netlink.c:1896 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xd3/0x120 net/socket.c:734 __sys_sendto+0x23a/0x340 net/socket.c:2117 __do_sys_sendto net/socket.c:2129 [inline] __se_sys_sendto net/socket.c:2125 [inline] __x64_sys_sendto+0xe1/0x1b0 net/socket.c:2125 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
--- net/ipv6/ip6_output.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ipv6/ip6_output.c +5 -0
@@ -920,6 +920,9 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,if (err <0 ) goto fail; +/* We prevent @rt from being freed. */ +rcu_read_lock (); +for (;;) {/* Prepare header of the next frame, * before previous one went down. */
@@ -943,6 +946,7 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,if (err ==0 ) {IP6_INC_STATS (net,ip6_dst_idev (&rt->dst),IPSTATS_MIB_FRAGOKS ); +rcu_read_unlock ();return 0 ; }
@@ -950,6 +954,7 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,IP6_INC_STATS (net,ip6_dst_idev (&rt->dst),IPSTATS_MIB_FRAGFAILS ); +rcu_read_unlock ();return err; slow_path_clean:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 153/157 net: thunderbolt: fix memory leak in tbnet_open()
In reply to Greg Kroah-HartmanFrom: Zhengchao Shao <[email protected]>
[ Upstream commit ed14e5903638f6eb868e3e2b4e610985e6a6c876 ]
When tb_ring_alloc_rx() failed in tbnet_open(), ida that allocated in tb_xdomain_alloc_out_hopid() is not released. Add tb_xdomain_release_out_hopid() to the error path to release ida.
--- drivers/net/thunderbolt.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/thunderbolt.c +1 -0
@@ -902,6 +902,7 @@ static int tbnet_open(struct net_device *dev) tbnet_start_poll, net);if (!ring) {netdev_err (dev,"failed to allocate Rx ring\n" ); +tb_xdomain_release_out_hopid (xd, hopid);tb_ring_free (net->tx_ring.ring); net->tx_ring.ring =NULL ;return -ENOMEM ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 154/157 net: mvneta: Fix an out of bounds check
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit cdd97383e19d4afe29adc3376025a15ae3bab3a3 ]
In an earlier commit, I added a bounds check to prevent an out of bounds read and a WARN(). On further discussion and consideration that check was probably too aggressive. Instead of returning -EINVAL, a better fix would be to just prevent the out of bounds read but continue the process.
Background: The value of "pp->rxq_def" is a number between 0-7 by default, or even higher depending on the value of "rxq_number", which is a module parameter. If the value is more than the number of available CPUs then it will trigger the WARN() in cpu_max_bits_warn().
--- drivers/net/ethernet/marvell/mvneta.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/ethernet/marvell/mvneta.c +1 -4
@@ -4271,7 +4271,7 @@ static void mvneta_percpu_elect(struct mvneta_port *pp)/* Use the cpu associated to the rxq when it is online, in all * the other cases, use the cpu 0 which can't be offline. */ -if (cpu_online (pp->rxq_def)) +if (pp->rxq_def < nr_cpu_ids &&cpu_online (pp->rxq_def)) elected_cpu = pp->rxq_def; max_cpu =num_present_cpus ();
@@ -4927,9 +4927,6 @@ static int mvneta_config_rss(struct mvneta_port *pp)napi_disable (&pp->napi); } -if (pp->indir[0 ] >= nr_cpu_ids) -return -EINVAL ; - pp->rxq_def = pp->indir[0 ];/* Update unicast mapping */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 155/157 macsec: add missing attribute validation for offload
In reply to Greg Kroah-HartmanFrom: Emeel Hakim <[email protected]>
[ Upstream commit 38099024e51ee37dee5f0f577ca37175c932e3f7 ]
Add missing attribute validation for IFLA_MACSEC_OFFLOAD to the netlink policy.
--- drivers/net/macsec.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/macsec.c +1 -0
@@ -3720,6 +3720,7 @@ static const struct nla_policy macsec_rtnl_policy[IFLA_MACSEC_MAX + 1] = { [IFLA_MACSEC_SCB] = { .type = NLA_U8 }, [IFLA_MACSEC_REPLAY_PROTECT] = { .type = NLA_U8 }, [IFLA_MACSEC_VALIDATION] = { .type = NLA_U8 }, + [IFLA_MACSEC_OFFLOAD] = { .type = NLA_U8 }, };static void macsec_free_netdev (struct net_device *dev)
Signature · 1 line
2.35.1