5.15.176-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainercover 5.15.176-rc1 review
This is the start of the stable review cycle for the 5.15.176 release. There are 168 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, 08 Jan 2025 15:11:04 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.176-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.15.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.15.176-rc1
Seiji Nishikawa <[email protected]>
mm: vmscan: account for free pages to prevent infinite Loop in throttle_direct_reclaim()
Biju Das <[email protected]>
dt-bindings: display: adi,adv7533: Drop single lane support
Biju Das <[email protected]>
drm: adv7511: Drop dsi single lane support
Nikolay Kuratov <[email protected]>
net/sctp: Prevent autoclose integer overflow in sctp_association_init()
Pascal Hambourg <[email protected]>
sky2: Add device ID 11ab:4373 for Marvell 88E8075
Evgenii Shatokhin <[email protected]>
pinctrl: mcp23s08: Fix sleeping in atomic context due to regmap locking
Dan Carpenter <[email protected]>
RDMA/uverbs: Prevent integer overflow issue
Arnd Bergmann <[email protected]>
kcov: mark in_softirq_really() as __always_inline
Masahiro Yamada <[email protected]>
modpost: fix the missed iteration for the max bit in do_input()
Masahiro Yamada <[email protected]>
modpost: fix input MODULE_DEVICE_TABLE() built for 64-bit on 32-bit host
Michal Pecio <[email protected]>
usb: xhci: Avoid queuing redundant Stop Endpoint commands
Leon Romanovsky <[email protected]>
ARC: build: Try to guess GCC variant of cross compiler
Uros Bizjak <[email protected]>
irqchip/gic: Correct declaration of *percpu_base pointer in union gic_base
Daniele Palmas <[email protected]>
net: usb: qmi_wwan: add Telit FE910C04 compositions
Anton Protopopov <[email protected]>
bpf: fix potential error return
Adrian Ratiu <[email protected]>
sound: usb: format: don't warn that raw DSD is unsupported
Adrian Ratiu <[email protected]>
sound: usb: enable DSD output for ddHiFi TC44C
Filipe Manana <[email protected]>
btrfs: flush delalloc workers queue before stopping cleaner kthread during unmount
Prike Liang <[email protected]>
drm/amdkfd: Correct the migration DMA map direction
Emmanuel Grumbach <[email protected]>
wifi: mac80211: wake the queues in case of failure in resume
Qu Wenruo <[email protected]>
btrfs: sysfs: fix direct super block member reads
Anand Jain <[email protected]>
btrfs: sysfs: convert scnprintf and snprintf to sysfs_emit
Filipe Manana <[email protected]>
btrfs: fix use-after-free when COWing tree bock and tracing is enabled
Filipe Manana <[email protected]>
btrfs: rename and export __btrfs_cow_block()
Eric Dumazet <[email protected]>
ila: serialize calls to nf_register_net_hooks()
Eric Dumazet <[email protected]>
af_packet: fix vlan_get_protocol_dgram() vs MSG_PEEK
Eric Dumazet <[email protected]>
af_packet: fix vlan_get_tci() vs MSG_PEEK
Maciej S. Szmigiero <[email protected]>
net: wwan: iosm: Properly check for valid exec stage in ipc_mmio_init()
Eric Dumazet <[email protected]>
net: restrict SO_REUSEPORT to inet sockets
Li Zhijian <[email protected]>
RDMA/rtrs: Ensure 'ib_sge list' is accessible
Joe Hattori <[email protected]>
net: mv643xx_eth: fix an OF node reference leak
Vitalii Mordan <[email protected]>
eth: bcmsysport: fix call balance of priv->clk handling routines
Tanya Agarwal <[email protected]>
ALSA: usb-audio: US16x08: Initialize array before use
Antonio Pastor <[email protected]>
net: llc: reset skb->transport_header
Pablo Neira Ayuso <[email protected]>
netfilter: nft_set_hash: unaligned atomic read on struct nft_set_ext
Rodrigo Vivi <[email protected]>
drm/i915/dg1: Fix power gate sequence.
Ilya Shchipletsov <[email protected]>
netrom: check buffer length before accessing it
Wang Liang <[email protected]>
net: fix memory leak in tcp_conn_request()
Joe Hattori <[email protected]>
net: stmmac: restructure the error path of stmmac_probe_config_dt()
Andrew Halaney <[email protected]>
net: stmmac: don't create a MDIO bus if unnecessary
Bartosz Golaszewski <[email protected]>
net: stmmac: platform: provide devm_stmmac_probe_config_dt()
Chengchang Tang <[email protected]>
RDMA/hns: Fix missing flush CQE for DWQE
Chengchang Tang <[email protected]>
RDMA/hns: Fix warning storm caused by invalid input in IO path
wenglianfa <[email protected]>
RDMA/hns: Fix mapping error of zero-hop WQE buffer
Yunsheng Lin <[email protected]>
RDMA/hns: Remove redundant 'bt_level' for hem_list_alloc_item()
Yixing Liu <[email protected]>
RDMA/hns: Remove redundant 'attr_mask' in modify_qp_init_to_init()
Stefan Ekenberg <[email protected]>
drm/bridge: adv7511_audio: Update Audio InfoFrame properly
Selvin Xavier <[email protected]>
RDMA/bnxt_re: Fix the locking while accessing the QP table
Selvin Xavier <[email protected]>
RDMA/bnxt_re: Fix max_qp_wrs reported
Kalesh AP <[email protected]>
RDMA/bnxt_re: Fix reporting hw_ver in query_device
Saravanan Vajravel <[email protected]>
RDMA/bnxt_re: Add check for path mtu in modify_qp
Patrisious Haddad <[email protected]>
RDMA/mlx5: Enforce same type port association for multiport RoCE
Kairui Song <[email protected]>
zram: fix uninitialized ZRAM not releasing backing device
Sergey Senozhatsky <[email protected]>
drivers/block/zram/zram_drv.c: do not keep dangling zcomp pointer after zram reset
Mathias Nyman <[email protected]>
xhci: Turn NEC specific quirk for handling Stop Endpoint errors generic
Michal Pecio <[email protected]>
usb: xhci: Limit Stop Endpoint retries
Michal Pecio <[email protected]>
xhci: retry Stop Endpoint on buggy NEC controllers
Mika Westerberg <[email protected]>
thunderbolt: Add support for Intel Panther Lake-M/P
Mika Westerberg <[email protected]>
thunderbolt: Add support for Intel Lunar Lake
Mika Westerberg <[email protected]>
thunderbolt: Add Intel Barlow Ridge PCI ID
Mika Westerberg <[email protected]>
thunderbolt: Add support for Intel Meteor Lake
George D Sworo <[email protected]>
thunderbolt: Add support for Intel Raptor Lake
Steven Rostedt <[email protected]>
tracing: Have process_string() also allow arrays
Thiébaud Weksteen <[email protected]>
selinux: ignore unknown extended permissions
Naman Jain <[email protected]>
x86/hyperv: Fix hv tsc page based sched_clock for hibernation
Vladimir Oltean <[email protected]>
net: dsa: improve shutdown sequence
Yang Erkun <[email protected]>
nfsd: cancel nfsd_shrinker_work using sync mode in nfs4_state_shutdown_net
Filipe Manana <[email protected]>
btrfs: avoid monopolizing a core when activating a swap file
Dimitri Fedrau <[email protected]>
power: supply: gpio-charger: Fix set charge current limits
Lizhi Xu <[email protected]>
tracing: Prevent bad count for tracing_cpumask_write
Christian Göttsche <[email protected]>
tracing: Constify string literal data member in struct trace_event_call
Alexandre Ghiti <[email protected]>
riscv: Fix IPIs usage in kfence_protect_page()
Namjae Jeon <[email protected]>
ksmbd: fix racy issue from session lookup and expire
Kees Cook <[email protected]>
lib: stackinit: hide never-taken branch from compiler
Imre Deak <[email protected]>
drm/dp_mst: Verify request type in the corresponding down message reply
Catalin Marinas <[email protected]>
arm64: Ensure bits ASID[15:8] are masked out when the kernel uses 8-bit ASIDs
Yunfeng Ye <[email protected]>
arm64: mm: Rename asid2idx() to ctxid2asid()
Peterson Guo <[email protected]>
drm/amd/display: Add a left edge pixel if in YCbCr422 or YCbCr420 and odm
Jordy Zomer <[email protected]>
ksmbd: fix Out-of-Bounds Write in ksmbd_vfs_stream_write
Jordy Zomer <[email protected]>
ksmbd: fix Out-of-Bounds Read in ksmbd_vfs_stream_read
Imre Deak <[email protected]>
drm/dp_mst: Fix MST sideband message body length check
Hou Tao <[email protected]>
bpf: Check validity of link->type in bpf_link_show_fdinfo()
Jiaxun Yang <[email protected]>
MIPS: Probe toolchain support of -msym32
Matthew Wilcox (Oracle) <[email protected]>
vmalloc: fix accounting with i915
Ming Lei <[email protected]>
virtio-blk: don't keep queue frozen during system suspend
Cathy Avery <[email protected]>
scsi: storvsc: Do not flag MAINTENANCE_IN return of SRB_STATUS_DATA_OVERRUN as an error
Ranjan Kumar <[email protected]>
scsi: mpt3sas: Diag-Reset when Doorbell-In-Use bit is set during driver load time
Armin Wolf <[email protected]>
platform/x86: asus-nb-wmi: Ignore unknown event 0xCF
Mark Brown <[email protected]>
regmap: Use correct format specifier for logging range errors
bo liu <[email protected]>
ALSA: hda/conexant: fix Z60MR100 startup pop issue
Tomas Henzl <[email protected]>
scsi: megaraid_sas: Fix for a potential deadlock
Magnus Lindholm <[email protected]>
scsi: qla1280: Fix hw revision numbering for ISP1020/1040
James Hilliard <[email protected]>
watchdog: it87_wdt: add PWRGD enable quirk for Qotom QCML04
Masami Hiramatsu (Google) <[email protected]>
tracing/kprobe: Make trace_kprobe's module callback called after jump_label update
Dan Carpenter <[email protected]>
mtd: rawnand: fix double free in atmel_pmecc_create_user()
Chen Ridong <[email protected]>
dmaengine: at_xdmac: avoid null_prt_deref in at_xdmac_prep_dma_memset
Andy Shevchenko <[email protected]>
dmaengine: dw: Select only supported masters for ACPI devices
Javier Carrasco <[email protected]>
dmaengine: mv_xor: fix child node refcount handling in early exit
Zijun Hu <[email protected]>
phy: core: Fix that API devm_phy_destroy() fails to destroy the phy
Zijun Hu <[email protected]>
phy: core: Fix that API devm_of_phy_provider_unregister() fails to unregister the phy provider
Zijun Hu <[email protected]>
phy: core: Fix that API devm_phy_put() fails to release the phy
Zijun Hu <[email protected]>
phy: core: Fix an OF node refcount leakage in of_phy_provider_lookup()
Zijun Hu <[email protected]>
phy: core: Fix an OF node refcount leakage in _of_phy_get()
Maciej Andrzejewski <[email protected]>
mtd: rawnand: arasan: Fix missing de-registration of NAND
Maciej Andrzejewski <[email protected]>
mtd: rawnand: arasan: Fix double assertion of chip-select
Zichen Xie <[email protected]>
mtd: diskonchip: Cast an operand to prevent potential overflow
NeilBrown <[email protected]>
nfsd: restore callback functionality for NFSv4.0
Cong Wang <[email protected]>
bpf: Check negative offsets in __bpf_skb_min_len()
Zijian Zhang <[email protected]>
tcp_bpf: Add sk_rmem_alloc related logic for tcp_bpf ingress redirection
Cong Wang <[email protected]>
tcp_bpf: Charge receive socket buffer in bpf_tcp_ingress()
Bart Van Assche <[email protected]>
mm/vmstat: fix a W=1 clang compiler warning
Nikita Zhandarovich <[email protected]>
media: dvb-frontends: dib3000mb: fix uninit-value in dib3000_write_reg
Michel Dänzer <[email protected]>
drm/amdgpu: Handle NULL bo->tbo.resource (again) in amdgpu_vm_bo_update
Xuewen Yan <[email protected]>
epoll: Add synchronous wakeup support for ep_poll_callback
Ilya Dryomov <[email protected]>
ceph: validate snapdirname option length when mounting
Zijun Hu <[email protected]>
of: Fix refcount leakage for OF node returned by __of_get_dma_parent()
Herve Codina <[email protected]>
of: Fix error path in of_parse_phandle_with_args_map()
Jann Horn <[email protected]>
udmabuf: also check for F_SEAL_FUTURE_WRITE
Edward Adam Davis <[email protected]>
nilfs2: prevent use of deleted inode
Zijun Hu <[email protected]>
of/irq: Fix using uninitialized variable @addr_len in API of_irq_parse_one()
Trond Myklebust <[email protected]>
NFS/pnfs: Fix a live lock between recalled layouts and layoutget
Steven Rostedt <[email protected]>
tracing: Add "%s" check in test_event_printk()
Steven Rostedt <[email protected]>
tracing: Add missing helper functions in event pointer dereference check
Steven Rostedt <[email protected]>
tracing: Fix test_event_printk() to process entire print argument
Sean Christopherson <[email protected]>
KVM: x86: Play nice with protected guests in complete_hypercall_exit()
Michael Kelley <[email protected]>
Drivers: hv: util: Avoid accessing a ringbuffer not initialized yet
Qu Wenruo <[email protected]>
btrfs: tree-checker: reject inline extent items with 0 ref count
Kairui Song <[email protected]>
zram: refuse to use zero sized block device as backing device
Geert Uytterhoeven <[email protected]>
sh: clk: Fix clk_enable() to return 0 on NULL clk
Murad Masimov <[email protected]>
hwmon: (tmp513) Fix interpretation of values of Temperature Result and Limit Registers
Murad Masimov <[email protected]>
hwmon: (tmp513) Fix Current Register value interpretation
Murad Masimov <[email protected]>
hwmon: (tmp513) Fix interpretation of values of Shunt Voltage and Limit Registers
Andy Shevchenko <[email protected]>
hwmon: (tmp513) Use SI constants from units.h
Andy Shevchenko <[email protected]>
hwmon: (tmp513) Simplify with dev_err_probe()
Andy Shevchenko <[email protected]>
hwmon: (tmp513) Don't use "proxy" headers
Ville Syrjälä <[email protected]>
drm/modes: Avoid divide by zero harder in drm_mode_vrefresh()
Daniele Palmas <[email protected]>
USB: serial: option: add Telit FE910C04 rmnet compositions
Jack Wu <[email protected]>
USB: serial: option: add MediaTek T7XX compositions
Mank Wang <[email protected]>
USB: serial: option: add Netprisma LCUK54 modules for WWAN Ready
Michal Hrusecky <[email protected]>
USB: serial: option: add MeiG Smart SLM770A
Daniel Swanemar <[email protected]>
USB: serial: option: add TCL IK512 MBIM & ECM
James Bottomley <[email protected]>
efivarfs: Fix error on non-existent file
Geert Uytterhoeven <[email protected]>
i2c: riic: Always round-up when calculating bus period
Dan Carpenter <[email protected]>
chelsio/chtls: prevent potential integer overflow on 32bit
Prathamesh Shete <[email protected]>
mmc: sdhci-tegra: Remove SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC quirk
Joe Hattori <[email protected]>
net: mdiobus: fix an OF node reference leak
Phil Sutter <[email protected]>
netfilter: ipset: Fix for recursive locking warning
Joe Hattori <[email protected]>
net: ethernet: bgmac-platform: fix an OF node reference leak
Dan Carpenter <[email protected]>
net: hinic: Fix cleanup in create_rxqs/txqs()
Shannon Nelson <[email protected]>
ionic: use ee->offset when returning sprom data
Brett Creeley <[email protected]>
ionic: Fix netdev notifier unregister on failure
Eric Dumazet <[email protected]>
netdevsim: prevent bad user input in nsim_dev_health_break_write()
Guangguan Wang <[email protected]>
net/smc: check return value of sock_recvmsg when draining clc data
Guangguan Wang <[email protected]>
net/smc: check smcd_v2_ext_offset when receiving proposal msg
Guangguan Wang <[email protected]>
net/smc: check iparea_offset and ipv6_prefixes_cnt when receiving proposal msg
Guangguan Wang <[email protected]>
net/smc: check sndbuf_space again after NOSPACE flag is set in smc_poll
Gao Xiang <[email protected]>
erofs: fix incorrect symlink detection in fast symlink
Vladimir Riabchun <[email protected]>
i2c: pnx: Fix timeout in wait functions
Peng Hongchi <[email protected]>
usb: dwc2: gadget: Don't write invalid mapped sg entries into dma_desc with iommu enabled
Jiaxun Yang <[email protected]>
MIPS: Loongson64: DTS: Fix msi node for ls7a
Ajit Khaparde <[email protected]>
PCI: Add ACS quirk for Broadcom BCM5760X NIC
Jiwei Sun <[email protected]>
PCI: vmd: Create domain symlink before pci_bus_add_devices()
Pierre-Louis Bossart <[email protected]>
ASoC: Intel: sof_sdw: fix jack detection on ADL-N variant RVP
Roger Quadros <[email protected]>
usb: cdns3: Add quirk flag to enable suspend residency
Takashi Iwai <[email protected]>
ALSA: usb: Fix UBSAN warning in parse_audio_unit()
Kai-Heng Feng <[email protected]>
PCI/AER: Disable AER service on suspend
Vidya Sagar <[email protected]>
PCI: Use preserve_config in place of pci_flags
Lion Ackermann <[email protected]>
net: sched: fix ordering of qlen adjustment
-------------
Diffstat:
.../bindings/display/bridge/adi,adv7533.yaml | 2 +- Makefile | 4 +- arch/arc/Makefile | 2 +- arch/arm64/mm/context.c | 22 +-- arch/mips/Makefile | 2 +- .../boot/dts/loongson/loongson64g_4core_ls7a.dts | 1 + arch/riscv/include/asm/kfence.h | 4 +- arch/x86/kernel/cpu/mshyperv.c | 58 ++++++ arch/x86/kvm/x86.c | 2 +- drivers/base/regmap/regmap.c | 4 +- drivers/block/virtio_blk.c | 7 +- drivers/block/zram/zram_drv.c | 28 +-- drivers/clocksource/hyperv_timer.c | 14 +- drivers/dma-buf/udmabuf.c | 2 +- drivers/dma/at_xdmac.c | 2 + drivers/dma/dw/acpi.c | 6 +- drivers/dma/dw/internal.h | 8 + drivers/dma/dw/pci.c | 4 +- drivers/dma/mv_xor.c | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 4 +- .../gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 23 +++ drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 14 +- drivers/gpu/drm/bridge/adv7511/adv7533.c | 2 +- drivers/gpu/drm/drm_dp_mst_topology.c | 34 ++++ drivers/gpu/drm/drm_modes.c | 11 +- drivers/gpu/drm/i915/gt/intel_rc6.c | 2 +- drivers/hv/hv_kvp.c | 6 + drivers/hv/hv_snapshot.c | 6 + drivers/hv/hv_util.c | 9 + drivers/hv/hyperv_vmbus.h | 2 + drivers/hwmon/tmp513.c | 74 +++---- drivers/i2c/busses/i2c-pnx.c | 4 +- drivers/i2c/busses/i2c-riic.c | 2 +- drivers/infiniband/core/uverbs_cmd.c | 16 +- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 28 +-- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 2 + drivers/infiniband/hw/bnxt_re/qplib_sp.c | 2 +- drivers/infiniband/hw/hns/hns_roce_hem.c | 49 +++-- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 17 +- drivers/infiniband/hw/hns/hns_roce_mr.c | 5 - drivers/infiniband/hw/mlx5/main.c | 6 +- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 2 +- drivers/irqchip/irq-gic.c | 2 +- drivers/media/dvb-frontends/dib3000mb.c | 2 +- drivers/mmc/host/sdhci-tegra.c | 1 - drivers/mtd/nand/raw/arasan-nand-controller.c | 11 +- drivers/mtd/nand/raw/atmel/pmecc.c | 4 +- drivers/mtd/nand/raw/diskonchip.c | 2 +- drivers/net/ethernet/broadcom/bcmsysport.c | 21 +- drivers/net/ethernet/broadcom/bgmac-platform.c | 5 +- .../chelsio/inline_crypto/chtls/chtls_main.c | 5 +- drivers/net/ethernet/huawei/hinic/hinic_main.c | 2 + drivers/net/ethernet/marvell/mv643xx_eth.c | 14 +- drivers/net/ethernet/marvell/sky2.c | 1 + .../net/ethernet/pensando/ionic/ionic_ethtool.c | 4 +- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 4 +- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 153 ++++++++++----- .../net/ethernet/stmicro/stmmac/stmmac_platform.h | 2 + drivers/net/mdio/fwnode_mdio.c | 13 +- drivers/net/netdevsim/health.c | 2 + drivers/net/usb/qmi_wwan.c | 3 + drivers/net/wwan/iosm/iosm_ipc_mmio.c | 2 +- drivers/of/address.c | 2 +- drivers/of/base.c | 15 +- drivers/of/irq.c | 1 + drivers/pci/controller/pci-host-common.c | 4 - drivers/pci/controller/vmd.c | 8 +- drivers/pci/pcie/aer.c | 18 ++ drivers/pci/probe.c | 22 +-- drivers/pci/quirks.c | 4 + drivers/phy/phy-core.c | 21 +- drivers/pinctrl/pinctrl-mcp23s08.c | 6 + drivers/platform/x86/asus-nb-wmi.c | 1 + drivers/power/supply/gpio-charger.c | 8 + drivers/scsi/megaraid/megaraid_sas_base.c | 5 +- drivers/scsi/mpt3sas/mpt3sas_base.c | 7 +- drivers/scsi/qla1280.h | 12 +- drivers/scsi/storvsc_drv.c | 7 +- drivers/sh/clk/core.c | 2 +- drivers/thunderbolt/icm.c | 5 + drivers/thunderbolt/nhi.c | 24 +++ drivers/thunderbolt/nhi.h | 13 ++ drivers/usb/cdns3/core.h | 1 + drivers/usb/cdns3/drd.c | 10 +- drivers/usb/cdns3/drd.h | 3 + drivers/usb/dwc2/gadget.c | 4 +- drivers/usb/host/xhci-ring.c | 42 +++- drivers/usb/host/xhci.c | 21 +- drivers/usb/host/xhci.h | 2 + drivers/usb/serial/option.c | 27 +++ drivers/watchdog/it87_wdt.c | 39 ++++ fs/btrfs/ctree.c | 37 ++-- fs/btrfs/ctree.h | 7 + fs/btrfs/disk-io.c | 9 + fs/btrfs/inode.c | 2 + fs/btrfs/sysfs.c | 93 +++++---- fs/btrfs/tree-checker.c | 27 ++- fs/ceph/super.c | 2 + fs/efivarfs/inode.c | 2 +- fs/efivarfs/internal.h | 1 - fs/efivarfs/super.c | 3 - fs/erofs/inode.c | 20 +- fs/eventpoll.c | 5 +- fs/ksmbd/auth.c | 2 + fs/ksmbd/mgmt/user_session.c | 6 +- fs/ksmbd/server.c | 4 +- fs/ksmbd/smb2pdu.c | 33 ++-- fs/nfs/pnfs.c | 2 +- fs/nfsd/nfs4callback.c | 4 +- fs/nfsd/nfs4state.c | 2 +- fs/nilfs2/inode.c | 8 +- fs/nilfs2/namei.c | 5 + include/clocksource/hyperv_timer.h | 2 + include/linux/hyperv.h | 1 + include/linux/if_vlan.h | 16 +- include/linux/mlx5/driver.h | 6 + include/linux/skmsg.h | 11 +- include/linux/trace_events.h | 2 +- include/linux/vmstat.h | 2 +- include/linux/wait.h | 1 + include/net/netfilter/nf_tables.h | 7 +- include/net/sock.h | 10 +- kernel/bpf/core.c | 6 +- kernel/bpf/syscall.c | 13 +- kernel/kcov.c | 2 +- kernel/trace/trace.c | 3 + kernel/trace/trace_events.c | 213 +++++++++++++++++---- kernel/trace/trace_kprobe.c | 2 +- lib/test_stackinit.c | 1 + mm/vmalloc.c | 3 +- mm/vmscan.c | 9 +- net/core/filter.c | 21 +- net/core/skmsg.c | 6 +- net/core/sock.c | 5 +- net/dsa/dsa2.c | 7 + net/ipv4/tcp_bpf.c | 6 +- net/ipv4/tcp_input.c | 1 + net/ipv6/ila/ila_xlat.c | 16 +- net/llc/llc_input.c | 2 +- net/mac80211/util.c | 3 + net/netfilter/ipset/ip_set_list_set.c | 3 + net/netrom/nr_route.c | 6 + net/packet/af_packet.c | 28 +-- net/sched/sch_cake.c | 2 +- net/sched/sch_choke.c | 2 +- net/sctp/associola.c | 3 +- net/smc/af_smc.c | 13 +- net/smc/smc_clc.c | 9 + net/smc/smc_clc.h | 14 +- scripts/mod/file2alias.c | 4 +- security/selinux/ss/services.c | 8 +- sound/pci/hda/patch_conexant.c | 28 +++ sound/soc/intel/boards/sof_sdw.c | 9 + sound/usb/format.c | 7 +- sound/usb/mixer.c | 7 + sound/usb/mixer_us16x08.c | 2 +- sound/usb/quirks.c | 2 + 158 files changed, 1391 insertions(+), 495 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/168 net: sched: fix ordering of qlen adjustment
5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lion Ackermann <[email protected]>
commit 5eb7de8cd58e73851cd37ff8d0666517d9926948 upstream.
Changes to sch->q.qlen around qdisc_tree_reduce_backlog() need to happen _before_ a call to said function because otherwise it may fail to notify parent qdiscs when the child is about to become empty.
--- net/sched/sch_cake.c | 2 +- net/sched/sch_choke.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/sched/sch_cake.c +1 -1
@@ -1541,7 +1541,6 @@ static unsigned int cake_drop(struct Qdi b->backlogs[idx] -= len; b->tin_backlog -= len; sch->qstats.backlog -= len; -qdisc_tree_reduce_backlog (sch,1 , len); flow->dropped++; b->tin_dropped++;
@@ -1552,6 +1551,7 @@ static unsigned int cake_drop(struct Qdi__qdisc_drop (skb, to_free); sch->q.qlen--; +qdisc_tree_reduce_backlog (sch,1 , len);cake_heapify (q,0 );
net/sched/sch_choke.c +1 -1
@@ -124,10 +124,10 @@ static void choke_drop_by_idx(struct Qdiif (idx == q->tail)choke_zap_tail_holes (q); + --sch->q.qlen;qdisc_qstats_backlog_dec (sch, skb);qdisc_tree_reduce_backlog (sch,1 ,qdisc_pkt_len (skb));qdisc_drop (skb, sch, to_free); - --sch->q.qlen; }struct choke_skb_cb {
Greg Kroah-Hartman
maintainerPATCH 2/168 PCI: Use preserve_config in place of pci_flags
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vidya Sagar <[email protected]>
[ Upstream commit 7246a4520b4bf1494d7d030166a11b5226f6d508 ]
Use preserve_config in place of checking for PCI_PROBE_ONLY flag to enable support for "linux,pci-probe-only" on a per host bridge basis.
This also obviates the use of adding PCI_REASSIGN_ALL_BUS flag if !PCI_PROBE_ONLY, as pci_assign_unassigned_root_bus_resources() takes care of reassigning the resources that are not already claimed.
--- drivers/pci/controller/pci-host-common.c | 4 ---- drivers/pci/probe.c | 20 +++++++++----------- 2 files changed, 9 insertions(+), 15 deletions(-)
drivers/pci/controller/pci-host-common.c +0 -4
@@ -73,10 +73,6 @@ int pci_host_common_probe(struct platform_device *pdev)if (IS_ERR (cfg))return PTR_ERR (cfg); -/* Do not reassign resources if probe only */ -if (!pci_has_flag (PCI_PROBE_ONLY )) -pci_add_flags (PCI_REASSIGN_ALL_BUS ); - bridge->sysdata = cfg; bridge->ops = (struct pci_ops *)&ops->pci_ops; bridge->msi_domain = true;
drivers/pci/probe.c +9 -11
@@ -3048,20 +3048,18 @@ int pci_host_probe(struct pci_host_bridge *bridge) bus = bridge->bus; +/* If we must preserve the resource configuration, claim now */ +if (bridge->preserve_config) +pci_bus_claim_resources (bus); +/* -* We insert PCI resources into the iomem_resource and -* ioport_resource trees in either pci_bus_claim_resources() -* or pci_bus_assign_resources(). +* Assign whatever was left unassigned. If we didn't claim above, +* this will reassign everything. */ -if (pci_has_flag (PCI_PROBE_ONLY )) { -pci_bus_claim_resources (bus); - }else { -pci_bus_size_bridges (bus); -pci_bus_assign_resources (bus); +pci_assign_unassigned_root_bus_resources (bus); -list_for_each_entry (child, &bus->children, node) -pcie_bus_configure_settings (child); - } +list_for_each_entry (child, &bus->children, node) +pcie_bus_configure_settings (child);pci_bus_add_devices (bus);return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 3/168 PCI/AER: Disable AER service on suspend
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai-Heng Feng <[email protected]>
[ Upstream commit 5afc2f763edc5daae4722ee46fea4e627d01fa90 ]
If the link is powered off during suspend, electrical noise may cause errors that are logged via AER. If the AER interrupt is enabled and shares an IRQ with PME, that causes a spurious wakeup during suspend.
Disable the AER interrupt during suspend to prevent this. Clear error status before re-enabling IRQ interrupts during resume so we don't get an interrupt for errors that occurred during the suspend/resume process.
--- drivers/pci/pcie/aer.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/pci/pcie/aer.c +18 -0
@@ -1382,6 +1382,22 @@ static int aer_probe(struct pcie_device *dev)return 0 ; } +static int aer_suspend (struct pcie_device *dev) +{ +struct aer_rpc *rpc =get_service_data (dev); + +aer_disable_rootport (rpc); +return 0 ; +} + +static int aer_resume (struct pcie_device *dev) +{ +struct aer_rpc *rpc =get_service_data (dev); + +aer_enable_rootport (rpc); +return 0 ; +} +/** * aer_root_reset - reset Root Port hierarchy, RCEC, or RCiEP * @dev: pointer to Root Port, RCEC, or RCiEP
@@ -1453,6 +1469,8 @@ static struct pcie_port_service_driver aerdriver = { .service = PCIE_PORT_SERVICE_AER, .probe = aer_probe, + .suspend = aer_suspend, + .resume = aer_resume, .remove = aer_remove, };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 4/168 ALSA: usb: Fix UBSAN warning in parse_audio_unit()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 2f38cf730caedaeacdefb7ff35b0a3c1168117f9 ]
A malformed USB descriptor may pass the lengthy mixer description with a lot of channels, and this may overflow the 32bit integer shift size, as caught by syzbot UBSAN test. Although this won't cause any real trouble, it's better to address.
This patch introduces a sanity check of the number of channels to bail out the parsing when too many channels are found.
--- sound/usb/mixer.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/usb/mixer.c +7 -0
@@ -2008,6 +2008,13 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, bmaControls = ftr->bmaControls; } +if (channels >32 ) { +usb_audio_info (state->chip, +"usbmixer: too many channels (%d) in unit %d\n" , + channels, unitid); +return -EINVAL ; + } +/* parse the source unit */ err =parse_audio_unit (state, hdr->bSourceID);if (err <0 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 5/168 usb: cdns3: Add quirk flag to enable suspend residency
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roger Quadros <[email protected]>
[ Upstream commit 0aca19e4037a4143273e90f1b44666b78b4dde9b ]
Some platforms (e.g. ti,j721e-usb, ti,am64-usb) require this bit to be set to workaround a lockup issue with PHY short suspend intervals [1]. Add a platform quirk flag to indicate if Suspend Residency should be enabled.
[1] - https://www.ti.com/lit/er/sprz457h/sprz457h.pdf
i2409 - USB: USB2 PHY locks up due to short suspend
--- drivers/usb/cdns3/core.h | 1 + drivers/usb/cdns3/drd.c | 10 +++++++++- drivers/usb/cdns3/drd.h | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-)
drivers/usb/cdns3/core.h +1 -0
@@ -44,6 +44,7 @@ struct cdns3_platform_data { bool suspend, bool wakeup);unsigned long quirks;#define CDNS3_DEFAULT_PM_RUNTIME_ALLOW BIT(0) +#define CDNS3_DRD_SUSPEND_RESIDENCY_ENABLE BIT(1) };/**
drivers/usb/cdns3/drd.c +9 -1
@@ -385,7 +385,7 @@ static irqreturn_t cdns_drd_irq(int irq, void *data)int cdns_drd_init (struct cdns *cdns) {void __iomem *regs; -u32 state; +u32 state, reg;int ret; regs =devm_ioremap_resource (cdns->dev, &cdns->otg_res);
@@ -429,6 +429,14 @@ int cdns_drd_init(struct cdns *cdns) cdns->otg_irq_regs = (struct cdns_otg_irq_regs __iomem *) &cdns->otg_v1_regs->ien;writel (1 , &cdns->otg_v1_regs->simulate); + +if (cdns->pdata && + (cdns->pdata->quirks &CDNS3_DRD_SUSPEND_RESIDENCY_ENABLE )) { + reg =readl (&cdns->otg_v1_regs->susp_ctrl); + reg |=SUSP_CTRL_SUSPEND_RESIDENCY_ENABLE ; +writel (reg, &cdns->otg_v1_regs->susp_ctrl); + } + cdns->version =CDNS3_CONTROLLER_V1 ; }else {dev_err (cdns->dev,"not supporte DID=0x%08x\n" , state);
drivers/usb/cdns3/drd.h +3 -0
@@ -193,6 +193,9 @@ struct cdns_otg_irq_regs {/* OTGREFCLK - bitmasks */ #define OTGREFCLK_STB_CLK_SWITCH_EN BIT(31) +/* SUPS_CTRL - bitmasks */ +#define SUSP_CTRL_SUSPEND_RESIDENCY_ENABLE BIT(17) +/* OVERRIDE - bitmasks */ #define OVERRIDE_IDPULLUP BIT(0)/* Only for CDNS3_CONTROLLER_V0 version */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 6/168 ASoC: Intel: sof_sdw: fix jack detection on ADL-N variant RVP
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 65c90df918205bc84f5448550cde76a54dae5f52 ]
Experimental tests show that JD2_100K is required, otherwise the jack is detected always even with nothing plugged-in.
To avoid matching with other known quirks the SKU information is used.
--- sound/soc/intel/boards/sof_sdw.c | 9 +++++++++ 1 file changed, 9 insertions(+)
sound/soc/intel/boards/sof_sdw.c +9 -0
@@ -258,6 +258,15 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = {SOF_BT_OFFLOAD_SSP (2 ) | SOF_SSP_BT_OFFLOAD_PRESENT), }, + { + .callback = sof_sdw_quirk_cb, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"Intel Corporation" ), + DMI_MATCH(DMI_PRODUCT_SKU, "0000000000070000"), + }, + .driver_data = (void *)(SOF_SDW_TGL_HDMI | + RT711_JD2_100K), + }, { .callback = sof_sdw_quirk_cb, .matches = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 7/168 PCI: vmd: Create domain symlink before pci_bus_add_devices()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiwei Sun <[email protected]>
[ Upstream commit f24c9bfcd423e2b2bb0d198456412f614ec2030a ]
The vmd driver creates a "domain" symlink in sysfs for each VMD bridge. Previously this symlink was created after pci_bus_add_devices() added devices below the VMD bridge and emitted udev events to announce them to userspace.
This led to a race between userspace consumers of the udev events and the kernel creation of the symlink. One such consumer is mdadm, which assembles block devices into a RAID array, and for devices below a VMD bridge, mdadm depends on the "domain" symlink.
If mdadm loses the race, it may be unable to assemble a RAID array, which may cause a boot failure or other issues, with complaints like this:
(udev-worker)[2149]: nvme1n1: '/sbin/mdadm -I /dev/nvme1n1'(err) 'mdadm: Unable to get real path for '/sys/bus/pci/drivers/vmd/0000:c7:00.5/domain/device'' (udev-worker)[2149]: nvme1n1: '/sbin/mdadm -I /dev/nvme1n1'(err) 'mdadm: /dev/nvme1n1 is not attached to Intel(R) RAID controller.' (udev-worker)[2149]: nvme1n1: '/sbin/mdadm -I /dev/nvme1n1'(err) 'mdadm: No OROM/EFI properties for /dev/nvme1n1' (udev-worker)[2149]: nvme1n1: '/sbin/mdadm -I /dev/nvme1n1'(err) 'mdadm: no RAID superblock on /dev/nvme1n1.' (udev-worker)[2149]: nvme1n1: Process '/sbin/mdadm -I /dev/nvme1n1' failed with exit code 1.
This symptom prevents the OS from booting successfully.
After a NVMe disk is probed/added by the nvme driver, udevd invokes mdadm to detect if there is a mdraid associated with this NVMe disk, and mdadm determines if a NVMe device is connected to a particular VMD domain by checking the "domain" symlink. For example:
Thread A Thread B Thread mdadm
vmd_enable_domain
pci_bus_add_devices
__driver_probe_device
...
work_on_cpu
schedule_work_on
: wakeup Thread B
nvme_probe
: wakeup scan_work
to scan nvme disk
and add nvme disk
then wakeup udevd
: udevd executes
mdadm command
flush_work main
: wait for nvme_probe done ...
__driver_probe_device find_driver_devices
: probe next nvme device : 1) Detect domain symlink
... 2) Find domain symlink
... from vmd sysfs
... 3) Domain symlink not
... created yet; failed
sysfs_create_link
: create domain symlink
Create the VMD "domain" symlink before invoking pci_bus_add_devices() to avoid this race.
--- drivers/pci/controller/vmd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pci/controller/vmd.c +4 -4
@@ -798,6 +798,9 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)if (vmd->irq_domain)dev_set_msi_domain (&vmd->bus->dev, vmd->irq_domain); +WARN (sysfs_create_link (&vmd->dev->dev.kobj, &vmd->bus->dev.kobj, +"domain" ),"Can't create symlink to domain\n" ); +vmd_acpi_begin ();pci_scan_child_bus (vmd->bus);
@@ -814,9 +817,6 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)pci_bus_add_devices (vmd->bus);vmd_acpi_end (); - -WARN (sysfs_create_link (&vmd->dev->dev.kobj, &vmd->bus->dev.kobj, -"domain" ),"Can't create symlink to domain\n" );return 0 ; }
@@ -873,8 +873,8 @@ static void vmd_remove(struct pci_dev *dev) {struct vmd_dev *vmd =pci_get_drvdata (dev); -sysfs_remove_link (&vmd->dev->dev.kobj,"domain" );pci_stop_root_bus (vmd->bus); +sysfs_remove_link (&vmd->dev->dev.kobj,"domain" );pci_remove_root_bus (vmd->bus);vmd_cleanup_srcu (vmd);vmd_detach_resources (vmd);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 8/168 PCI: Add ACS quirk for Broadcom BCM5760X NIC
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ajit Khaparde <[email protected]>
[ Upstream commit 524e057b2d66b61f9b63b6db30467ab7b0bb4796 ]
The Broadcom BCM5760X NIC may be a multi-function device.
While it does not advertise an ACS capability, peer-to-peer transactions are not possible between the individual functions. So it is ok to treat them as fully isolated.
Add an ACS quirk for this device so the functions can be in independent IOMMU groups and attached individually to userspace applications using VFIO.
--- drivers/pci/quirks.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/pci/quirks.c +4 -0
@@ -4982,6 +4982,10 @@ static const struct pci_dev_acs_enabled { { PCI_VENDOR_ID_BROADCOM, 0x1750, pci_quirk_mf_endpoint_acs }, { PCI_VENDOR_ID_BROADCOM, 0x1751, pci_quirk_mf_endpoint_acs }, { PCI_VENDOR_ID_BROADCOM, 0x1752, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_BROADCOM, 0x1760, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_BROADCOM, 0x1761, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_BROADCOM, 0x1762, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_BROADCOM, 0x1763, pci_quirk_mf_endpoint_acs }, { PCI_VENDOR_ID_BROADCOM, 0xD714, pci_quirk_brcm_acs },/* Amazon Annapurna Labs */ { PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031, pci_quirk_al_acs },
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 9/168 MIPS: Loongson64: DTS: Fix msi node for ls7a
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaxun Yang <[email protected]>
[ Upstream commit 98a9e2ac3755a353eefea8c52e23d5b0c50f3899 ]
Add it to silent warning:
arch/mips/boot/dts/loongson/ls7a-pch.dtsi:68.16-416.5: Warning (interrupt_provider): /bus@10000000/pci@1a000000: '#interrupt-cells' found, but node is not an interrupt provider arch/mips/boot/dts/loongson/loongson64g_4core_ls7a.dts:32.31-40.4: Warning (interrupt_provider): /bus@10000000/msi-controller@2ff00000: Missing '#interrupt-cells' in interrupt provider arch/mips/boot/dts/loongson/loongson64g_4core_ls7a.dtb: Warning (interrupt_map): Failed prerequisite 'interrupt_provider'
--- arch/mips/boot/dts/loongson/loongson64g_4core_ls7a.dts | 1 + 1 file changed, 1 insertion(+)
arch/mips/boot/dts/loongson/loongson64g_4core_ls7a.dts +1 -0
@@ -33,6 +33,7 @@ compatible = "loongson,pch-msi-1.0"; reg = <0 0x2ff00000 0 0x8>; interrupt-controller; + #interrupt-cells = <1>; msi-controller; loongson,msi-base-vec = <64>; loongson,msi-num-vecs = <192>;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 10/168 usb: dwc2: gadget: Dont write invalid mapped sg entries into dma_desc with iommu enabled
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Hongchi <[email protected]>
[ Upstream commit 1134289b6b93d73721340b66c310fd985385e8fa ]
When using dma_map_sg() to map the scatterlist with iommu enabled, the entries in the scatterlist can be mergerd into less but longer entries in the function __finalise_sg(). So that the number of valid mapped entries is actually smaller than ureq->num_reqs,and there are still some invalid entries in the scatterlist with dma_addr=0xffffffff and len=0. Writing these invalid sg entries into the dma_desc can cause a data transmission error.
The function dma_map_sg() returns the number of valid map entries and the return value is assigned to usb_request::num_mapped_sgs in function usb_gadget_map_request_by_dev(). So that just write valid mapped entries into dma_desc according to the usb_request::num_mapped_sgs, and set the IOC bit if it's the last valid mapped entry.
This patch poses no risk to no-iommu situation, cause ureq->num_mapped_sgs equals ureq->num_sgs while using dma_direct_map_sg() to map the scatterlist whith iommu disabled.
--- drivers/usb/dwc2/gadget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/dwc2/gadget.c +2 -2
@@ -886,10 +886,10 @@ static void dwc2_gadget_config_nonisoc_xfer_ddma(struct dwc2_hsotg_ep *hs_ep, }/* DMA sg buffer */ -for_each_sg (ureq->sg, sg, ureq->num_sgs, i) { +for_each_sg (ureq->sg, sg, ureq->num_mapped_sgs, i) {dwc2_gadget_fill_nonisoc_xfer_ddma_one (hs_ep, &desc,sg_dma_address (sg) + sg->offset,sg_dma_len (sg), -sg_is_last (sg)); + (i == (ureq->num_mapped_sgs -1 ))); desc_count += hs_ep->desc_count; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 11/168 i2c: pnx: Fix timeout in wait functions
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Riabchun <[email protected]>
[ Upstream commit 7363f2d4c18557c99c536b70489187bb4e05c412 ]
Since commit f63b94be6942 ("i2c: pnx: Fix potential deadlock warning from del_timer_sync() call in isr") jiffies are stored in i2c_pnx_algo_data.timeout, but wait_timeout and wait_reset are still using it as milliseconds. Convert jiffies back to milliseconds to wait for the expected amount of time.
--- drivers/i2c/busses/i2c-pnx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-pnx.c +2 -2
@@ -95,7 +95,7 @@ enum {static inline int wait_timeout (struct i2c_pnx_algo_data *data) { -long timeout = data->timeout; +long timeout =jiffies_to_msecs (data->timeout);while (timeout >0 && (ioread32 (I2C_REG_STS (data)) & mstatus_active)) {mdelay (1 );
@@ -106,7 +106,7 @@ static inline int wait_timeout(struct i2c_pnx_algo_data *data)static inline int wait_reset (struct i2c_pnx_algo_data *data) { -long timeout = data->timeout; +long timeout =jiffies_to_msecs (data->timeout);while (timeout >0 && (ioread32 (I2C_REG_CTL (data)) & mcntrl_reset)) {mdelay (1 );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 12/168 erofs: fix incorrect symlink detection in fast symlink
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gao Xiang <[email protected]>
commit 9ed50b8231e37b1ae863f5dec8153b98d9f389b4 upstream.
Fast symlink can be used if the on-disk symlink data is stored in the same block as the on-disk inode, so we don’t need to trigger another I/O for symlink data. However, currently fs correction could be reported _incorrectly_ if inode xattrs are too large.
In fact, these should be valid images although they cannot be handled as fast symlinks.
Many thanks to Colin for reporting this!
--- fs/erofs/inode.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)
fs/erofs/inode.c +6 -14
@@ -219,11 +219,14 @@ static int erofs_fill_symlink(struct inode *inode, void *data, unsigned int m_pofs) {struct erofs_inode *vi =EROFS_I (inode); +loff_t off;char *lnk; -/* if it cannot be handled with fast symlink scheme */ -if (vi->datalayout !=EROFS_INODE_FLAT_INLINE || - inode->i_size >=PAGE_SIZE || inode->i_size <0 ) { + m_pofs += vi->xattr_isize; +/* check if it cannot be handled with fast symlink scheme */ +if (vi->datalayout !=EROFS_INODE_FLAT_INLINE || inode->i_size <0 || +check_add_overflow (m_pofs, inode->i_size, &off) || + off >i_blocksize (inode)) { inode->i_op = &erofs_symlink_iops;return 0 ; }
@@ -232,17 +235,6 @@ static int erofs_fill_symlink(struct inode *inode, void *data,if (!lnk)return -ENOMEM ; - m_pofs += vi->xattr_isize; -/* inline symlink data shouldn't cross page boundary as well */ -if (m_pofs + inode->i_size >PAGE_SIZE ) { -kfree (lnk); -erofs_err (inode->i_sb, -"inline data cross block boundary @ nid %llu" , - vi->nid); -DBG_BUGON (1 ); -return -EFSCORRUPTED ; - } -memcpy (lnk, data + m_pofs, inode->i_size); lnk[inode->i_size] ='\0' ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 13/168 net/smc: check sndbuf_space again after NOSPACE flag is set in smc_poll
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangguan Wang <[email protected]>
[ Upstream commit 679e9ddcf90dbdf98aaaa71a492454654b627bcb ]
When application sending data more than sndbuf_space, there have chances application will sleep in epoll_wait, and will never be wakeup again. This is caused by a race between smc_poll and smc_cdc_tx_handler.
application tasklet
smc_tx_sendmsg(len > sndbuf_space) |
epoll_wait for EPOLL_OUT,timeout=0 |
smc_poll |
if (!smc->conn.sndbuf_space) |
| smc_cdc_tx_handler
| atomic_add sndbuf_space
| smc_tx_sndbuf_nonfull
| if (!test_bit SOCK_NOSPACE)
| do not sk_write_space;
set_bit SOCK_NOSPACE; |
return mask=0; |Application will sleep in epoll_wait as smc_poll returns 0. And smc_cdc_tx_handler will not call sk_write_space because the SOCK_NOSPACE has not be set. If there is no inflight cdc msg, sk_write_space will not be called any more, and application will sleep in epoll_wait forever. So check sndbuf_space again after NOSPACE flag is set to break the race.
--- net/smc/af_smc.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/smc/af_smc.c +7 -0
@@ -2355,6 +2355,13 @@ static __poll_t smc_poll(struct file *file, struct socket *sock, }else {sk_set_bit (SOCKWQ_ASYNC_NOSPACE , sk);set_bit (SOCK_NOSPACE , &sk->sk_socket->flags); + +if (sk->sk_state !=SMC_INIT ) { +/* Race breaker the same way as tcp_poll(). */ +smp_mb__after_atomic (); +if (atomic_read (&smc->conn.sndbuf_space)) + mask |=EPOLLOUT |EPOLLWRNORM ; + } }if (atomic_read (&smc->conn.bytes_to_rcv)) mask |=EPOLLIN |EPOLLRDNORM ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 14/168 net/smc: check iparea_offset and ipv6_prefixes_cnt when receiving proposal msg
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangguan Wang <[email protected]>
[ Upstream commit a29e220d3c8edbf0e1beb0f028878a4a85966556 ]
When receiving proposal msg in server, the field iparea_offset and the field ipv6_prefixes_cnt in proposal msg are from the remote client and can not be fully trusted. Especially the field iparea_offset, once exceed the max value, there has the chance to access wrong address, and crash may happen.
This patch checks iparea_offset and ipv6_prefixes_cnt before using them.
--- net/smc/af_smc.c | 6 +++++- net/smc/smc_clc.c | 4 ++++ net/smc/smc_clc.h | 6 +++++- 3 files changed, 14 insertions(+), 2 deletions(-)
net/smc/af_smc.c +5 -1
@@ -1632,6 +1632,8 @@ static int smc_listen_prfx_check(struct smc_sock *new_smc,if (pclc->hdr.typev1 ==SMC_TYPE_N )return 0 ; pclc_prfx =smc_clc_proposal_get_prefix (pclc); +if (!pclc_prfx) +return -EPROTO ;if (smc_clc_prfx_match (newclcsock, pclc_prfx))return SMC_CLC_DECL_DIFFPREFIX ;
@@ -1797,7 +1799,9 @@ static void smc_find_ism_v1_device_serv(struct smc_sock *new_smc,int rc =0 ;/* check if ISM V1 is available */ -if (!(ini->smcd_version &SMC_V1 ) || !smcd_indicated (ini->smc_type_v1)) +if (!(ini->smcd_version &SMC_V1 ) || + !smcd_indicated (ini->smc_type_v1) || + !pclc_smcd) goto not_found; ini->is_smcd = true;/* prepare ISM check */ ini->ism_peer_gid[0 ] =ntohll (pclc_smcd->ism.gid);
net/smc/smc_clc.c +4 -0
@@ -49,6 +49,10 @@ static bool smc_clc_msg_prop_valid(struct smc_clc_msg_proposal *pclc) v2_ext =smc_get_clc_v2_ext (pclc); pclc_prfx =smc_clc_proposal_get_prefix (pclc); +if (!pclc_prfx || + pclc_prfx->ipv6_prefixes_cnt >SMC_CLC_MAX_V6_PREFIX ) +return false; +if (hdr->version ==SMC_V1 ) {if (hdr->typev1 ==SMC_TYPE_N )return false;
net/smc/smc_clc.h +5 -1
@@ -264,8 +264,12 @@ struct smc_clc_msg_decline { /* clc decline message */static inline struct smc_clc_msg_proposal_prefix *smc_clc_proposal_get_prefix (struct smc_clc_msg_proposal *pclc) { +u16 offset =ntohs (pclc->iparea_offset); + +if (offset >sizeof (struct smc_clc_msg_smcd )) +return NULL ;return (struct smc_clc_msg_proposal_prefix *) - ((u8 *)pclc +sizeof (*pclc) +ntohs (pclc->iparea_offset)); + ((u8 *)pclc +sizeof (*pclc) + offset); }static inline bool smcr_indicated (int smc_type)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 15/168 net/smc: check smcd_v2_ext_offset when receiving proposal msg
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangguan Wang <[email protected]>
[ Upstream commit 9ab332deb671d8f7e66d82a2ff2b3f715bc3a4ad ]
When receiving proposal msg in server, the field smcd_v2_ext_offset in proposal msg is from the remote client and can not be fully trusted. Once the value of smcd_v2_ext_offset exceed the max value, there has the chance to access wrong address, and crash may happen.
This patch checks the value of smcd_v2_ext_offset before using it.
--- net/smc/smc_clc.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/smc/smc_clc.h +7 -1
@@ -311,9 +311,15 @@ smc_get_clc_v2_ext(struct smc_clc_msg_proposal *prop)static inline struct smc_clc_smcd_v2_extension *smc_get_clc_smcd_v2_ext (struct smc_clc_v2_extension *prop_v2ext) { +u16 max_offset = offsetof(struct smc_clc_msg_proposal_area , pclc_smcd_v2_ext) - + offsetof(struct smc_clc_msg_proposal_area , pclc_v2_ext) - + offsetof(struct smc_clc_v2_extension , hdr) - + offsetofend(struct smc_clnt_opts_area_hdr, smcd_v2_ext_offset); +if (!prop_v2ext)return NULL ; -if (!ntohs (prop_v2ext->hdr.smcd_v2_ext_offset)) +if (!ntohs (prop_v2ext->hdr.smcd_v2_ext_offset) || +ntohs (prop_v2ext->hdr.smcd_v2_ext_offset) > max_offset)return NULL ; return (struct smc_clc_smcd_v2_extension *)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 16/168 net/smc: check return value of sock_recvmsg when draining clc data
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangguan Wang <[email protected]>
[ Upstream commit c5b8ee5022a19464783058dc6042e8eefa34e8cd ]
When receiving clc msg, the field length in smc_clc_msg_hdr indicates the length of msg should be received from network and the value should not be fully trusted as it is from the network. Once the value of length exceeds the value of buflen in function smc_clc_wait_msg it may run into deadloop when trying to drain the remaining data exceeding buflen.
This patch checks the return value of sock_recvmsg when draining data in case of deadloop in draining.
--- net/smc/smc_clc.c | 5 +++++ 1 file changed, 5 insertions(+)
net/smc/smc_clc.c +5 -0
@@ -427,6 +427,11 @@ int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen, SMC_CLC_RECV_BUF_LEN : datlen;iov_iter_kvec (&msg.msg_iter,READ , &vec,1 , recvlen); len =sock_recvmsg (smc->clcsock, &msg, krflags); +if (len < recvlen) { + smc->sk.sk_err =EPROTO ; + reason_code = -EPROTO ; + goto out; + } datlen -= len; }if (clcm->type ==SMC_CLC_DECLINE ) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 17/168 netdevsim: prevent bad user input in nsim_dev_health_break_write()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit ee76746387f6233bdfa93d7406990f923641568f ]
If either a zero count or a large one is provided, kernel can crash.
--- drivers/net/netdevsim/health.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/netdevsim/health.c +2 -0
@@ -235,6 +235,8 @@ static ssize_t nsim_dev_health_break_write(struct file *file,char *break_msg;int err; +if (count ==0 || count >PAGE_SIZE ) +return -EINVAL ; break_msg =memdup_user_nul (data, count);if (IS_ERR (break_msg))return PTR_ERR (break_msg);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 18/168 ionic: Fix netdev notifier unregister on failure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brett Creeley <[email protected]>
[ Upstream commit 9590d32e090ea2751e131ae5273859ca22f5ac14 ]
If register_netdev() fails, then the driver leaks the netdev notifier. Fix this by calling ionic_lif_unregister() on register_netdev() failure. This will also call ionic_lif_unregister_phc() if it has already been registered.
--- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +2 -2
@@ -3514,8 +3514,8 @@ int ionic_lif_register(struct ionic_lif *lif)/* only register LIF0 for now */ err =register_netdev (lif->netdev);if (err) { -dev_err (lif->ionic->dev,"Cannot register net device, aborting\n" ); -ionic_lif_unregister_phc (lif); +dev_err (lif->ionic->dev,"Cannot register net device: %d, aborting\n" , err); +ionic_lif_unregister (lif);return err; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 19/168 ionic: use ee->offset when returning sprom data
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shannon Nelson <[email protected]>
[ Upstream commit b096d62ba1323391b2db98b7704e2468cf3b1588 ]
Some calls into ionic_get_module_eeprom() don't use a single full buffer size, but instead multiple calls with an offset. Teach our driver to use the offset correctly so we can respond appropriately to the caller.
--- drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_ethtool.c +2 -2
@@ -861,8 +861,8 @@ static int ionic_get_module_eeprom(struct net_device *netdev, len =min_t (u32,sizeof (xcvr->sprom), ee->len); do { - memcpy(data, xcvr->sprom, len); - memcpy(tbuf, xcvr->sprom, len); + memcpy(data, &xcvr->sprom[ee->offset], len); + memcpy(tbuf, &xcvr->sprom[ee->offset], len); /* Let's make sure we got a consistent copy */ if (!memcmp(data, tbuf, len))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 20/168 net: hinic: Fix cleanup in create_rxqs/txqs()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 7203d10e93b6e6e1d19481ef7907de6a9133a467 ]
There is a check for NULL at the start of create_txqs() and create_rxqs() which tess if "nic_dev->txqs" is non-NULL. The intention is that if the device is already open and the queues are already created then we don't create them a second time.
However, the bug is that if we have an error in the create_txqs() then the pointer doesn't get set back to NULL. The NULL check at the start of the function will say that it's already open when it's not and the device can't be used.
Set ->txqs back to NULL on cleanup on error.
--- drivers/net/ethernet/huawei/hinic/hinic_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/huawei/hinic/hinic_main.c +2 -0
@@ -172,6 +172,7 @@ static int create_txqs(struct hinic_dev *nic_dev)hinic_sq_dbgfs_uninit (nic_dev);devm_kfree (&netdev->dev, nic_dev->txqs); + nic_dev->txqs =NULL ;return err; }
@@ -268,6 +269,7 @@ static int create_rxqs(struct hinic_dev *nic_dev)hinic_rq_dbgfs_uninit (nic_dev);devm_kfree (&netdev->dev, nic_dev->rxqs); + nic_dev->rxqs =NULL ;return err; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 21/168 net: ethernet: bgmac-platform: fix an OF node reference leak
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
[ Upstream commit 0cb2c504d79e7caa3abade3f466750c82ad26f01 ]
The OF node obtained by of_parse_phandle() is not freed. Call of_node_put() to balance the refcount.
This bug was found by an experimental static analysis tool that I am developing.
--- drivers/net/ethernet/broadcom/bgmac-platform.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bgmac-platform.c +4 -1
@@ -171,6 +171,7 @@ static int platform_phy_connect(struct bgmac *bgmac)static int bgmac_probe (struct platform_device *pdev) {struct device_node *np = pdev->dev.of_node; +struct device_node *phy_node;struct bgmac *bgmac;struct resource *regs;int ret;
@@ -236,7 +237,9 @@ static int bgmac_probe(struct platform_device *pdev) bgmac->cco_ctl_maskset = platform_bgmac_cco_ctl_maskset; bgmac->get_bus_clock = platform_bgmac_get_bus_clock; bgmac->cmn_maskset32 = platform_bgmac_cmn_maskset32; -if (of_parse_phandle (np,"phy-handle" ,0 )) { + phy_node =of_parse_phandle (np,"phy-handle" ,0 ); +if (phy_node) { +of_node_put (phy_node); bgmac->phy_connect = platform_phy_connect; }else { bgmac->phy_connect = bgmac_phy_connect_direct;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 22/168 netfilter: ipset: Fix for recursive locking warning
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phil Sutter <[email protected]>
[ Upstream commit 70b6f46a4ed8bd56c85ffff22df91e20e8c85e33 ]
With CONFIG_PROVE_LOCKING, when creating a set of type bitmap:ip, adding it to a set of type list:set and populating it from iptables SET target triggers a kernel warning:
| WARNING: possible recursive locking detected
| 6.12.0-rc7-01692-g5e9a28f41134-dirty #594 Not tainted
| --------------------------------------------
| ping/4018 is trying to acquire lock:
| ffff8881094a6848 (&set->lock){+.-.}-{2:2}, at: ip_set_add+0x28c/0x360 [ip_set]
|
| but task is already holding lock:
| ffff88811034c048 (&set->lock){+.-.}-{2:2}, at: ip_set_add+0x28c/0x360 [ip_set]This is a false alarm: ipset does not allow nested list:set type, so the loop in list_set_kadd() can never encounter the outer set itself. No other set type supports embedded sets, so this is the only case to consider.
To avoid the false report, create a distinct lock class for list:set type ipset locks.
--- net/netfilter/ipset/ip_set_list_set.c | 3 +++ 1 file changed, 3 insertions(+)
net/netfilter/ipset/ip_set_list_set.c +3 -0
@@ -611,6 +611,8 @@ init_list_set(struct net *net, struct ip_set *set, u32 size)return true; } +static struct lock_class_key list_set_lockdep_key; +static int list_set_create (struct net *net,struct ip_set *set,struct nlattr *tb[],u32 flags)
@@ -627,6 +629,7 @@ list_set_create(struct net *net, struct ip_set *set, struct nlattr *tb[],if (size <IP_SET_LIST_MIN_SIZE ) size =IP_SET_LIST_MIN_SIZE ; +lockdep_set_class (&set->lock, &list_set_lockdep_key); set->variant = &set_variant; set->dsize =ip_set_elem_len (set, tb,sizeof (struct set_elem ), __alignof__(struct set_elem ));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 23/168 net: mdiobus: fix an OF node reference leak
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
[ Upstream commit 572af9f284669d31d9175122bbef9bc62cea8ded ]
fwnode_find_mii_timestamper() calls of_parse_phandle_with_fixed_args() but does not decrement the refcount of the obtained OF node. Add an of_node_put() call before returning from the function.
This bug was detected by an experimental static analysis tool that I am developing.
--- drivers/net/mdio/fwnode_mdio.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/net/mdio/fwnode_mdio.c +10 -3
@@ -17,6 +17,7 @@ MODULE_LICENSE("GPL");static struct mii_timestamper *fwnode_find_mii_timestamper (struct fwnode_handle *fwnode) { +struct mii_timestamper *mii_ts;struct of_phandle_args arg;int err;
@@ -30,10 +31,16 @@ fwnode_find_mii_timestamper(struct fwnode_handle *fwnode)else if (err)return ERR_PTR (err); -if (arg.args_count !=1 ) -return ERR_PTR (-EINVAL ); +if (arg.args_count !=1 ) { + mii_ts =ERR_PTR (-EINVAL ); + goto put_node; + } + + mii_ts =register_mii_timestamper (arg.np, arg.args[0 ]); -return register_mii_timestamper (arg.np, arg.args[0 ]); +put_node: +of_node_put (arg.np); +return mii_ts; } int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 24/168 mmc: sdhci-tegra: Remove SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC quirk
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prathamesh Shete <[email protected]>
commit a56335c85b592cb2833db0a71f7112b7d9f0d56b upstream.
Value 0 in ADMA length descriptor is interpreted as 65536 on new Tegra chips, remove SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC quirk to make sure max ADMA2 length is 65536.
Message-ID: <[email protected]>
--- drivers/mmc/host/sdhci-tegra.c | 1 - 1 file changed, 1 deletion(-)
drivers/mmc/host/sdhci-tegra.c +0 -1
@@ -1382,7 +1382,6 @@ static const struct sdhci_pltfm_data sdhSDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |SDHCI_QUIRK_SINGLE_POWER_WRITE |SDHCI_QUIRK_NO_HISPD_BIT | -SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, .quirks2 =SDHCI_QUIRK2_PRESET_VALUE_BROKEN | SDHCI_QUIRK2_BROKEN_HS200 |
Greg Kroah-Hartman
maintainerPATCH 25/168 chelsio/chtls: prevent potential integer overflow on 32bit
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit fbbd84af6ba70334335bdeba3ae536cf751c14c6 upstream.
The "gl->tot_len" variable is controlled by the user. It comes from process_responses(). On 32bit systems, the "gl->tot_len + sizeof(struct cpl_pass_accept_req) + sizeof(struct rss_header)" addition could have an integer wrapping bug. Use size_add() to prevent this.
--- drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_main.c +3 -2
@@ -346,8 +346,9 @@ static struct sk_buff *copy_gl_to_skb_pk* driver. Once driver synthesizes cpl_pass_accpet_req the skb will go * through the regular cpl_pass_accept_req processing in TOM. */ - skb =alloc_skb (gl->tot_len +sizeof (struct cpl_pass_accept_req ) - - pktshift,GFP_ATOMIC ); + skb =alloc_skb (size_add (gl->tot_len, +sizeof (struct cpl_pass_accept_req )) - + pktshift,GFP_ATOMIC );if (unlikely (!skb))return NULL ; __skb_put(skb, gl->tot_len + sizeof(struct cpl_pass_accept_req)
Greg Kroah-Hartman
maintainerPATCH 26/168 i2c: riic: Always round-up when calculating bus period
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit de6b43798d9043a7c749a0428dbb02d5fff156e5 upstream.
Currently, the RIIC driver may run the I2C bus faster than requested, which may cause subtle failures. E.g. Biju reported a measured bus speed of 450 kHz instead of the expected maximum of 400 kHz on RZ/G2L.
The initial calculation of the bus period uses DIV_ROUND_UP(), to make sure the actual bus speed never becomes faster than the requested bus speed. However, the subsequent division-by-two steps do not use round-up, which may lead to a too-small period, hence a too-fast and possible out-of-spec bus speed. E.g. on RZ/Five, requesting a bus speed of 100 resp. 400 kHz will yield too-fast target bus speeds of 100806 resp. 403226 Hz instead of 97656 resp. 390625 Hz.
Fix this by using DIV_ROUND_UP() in the subsequent divisions, too.
Tested on RZ/A1H, RZ/A2M, and RZ/Five.
--- drivers/i2c/busses/i2c-riic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-riic.c +1 -1
@@ -330,7 +330,7 @@ static int riic_init_hw(struct riic_devif (brl <= (0x1F +3 ))break ; - total_ticks /=2 ; + total_ticks =DIV_ROUND_UP (total_ticks,2 ); rate /=2 ; }
Greg Kroah-Hartman
maintainerPATCH 27/168 efivarfs: Fix error on non-existent file
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Bottomley <[email protected]>
commit 2ab0837cb91b7de507daa145d17b3b6b2efb3abf upstream.
When looking up a non-existent file, efivarfs returns -EINVAL if the file does not conform to the NAME-GUID format and -ENOENT if it does. This is caused by efivars_d_hash() returning -EINVAL if the name is not formatted correctly. This error is returned before simple_lookup() returns a negative dentry, and is the error value that the user sees.
Fix by removing this check. If the file does not exist, simple_lookup() will return a negative dentry leading to -ENOENT and efivarfs_create() already has a validity check before it creates an entry (and will correctly return -EINVAL)
--- fs/efivarfs/inode.c | 2 +- fs/efivarfs/internal.h | 1 - fs/efivarfs/super.c | 3 --- 3 files changed, 1 insertion(+), 5 deletions(-)
fs/efivarfs/inode.c +1 -1
@@ -47,7 +47,7 @@ struct inode *efivarfs_get_inode(struct* * VariableName-12345678-1234-1234-1234-1234567891bc */ -bool efivarfs_valid_name (const char *str,int len) +static bool efivarfs_valid_name (const char *str,int len) {const char *s = str + len -EFI_VARIABLE_GUID_LEN ;
fs/efivarfs/internal.h +0 -1
@@ -10,7 +10,6 @@extern const struct file_operations efivarfs_file_operations;extern const struct inode_operations efivarfs_dir_inode_operations; -extern bool efivarfs_valid_name (const char *str,int len);extern struct inode *efivarfs_get_inode (struct super_block *sb,const struct inode *dir,int mode,dev_t dev,bool is_removable);
fs/efivarfs/super.c +0 -3
@@ -64,9 +64,6 @@ static int efivarfs_d_hash(const structconst unsigned char *s = qstr->name;unsigned int len = qstr->len; -if (!efivarfs_valid_name (s, len)) -return -EINVAL ; -while (len-- >EFI_VARIABLE_GUID_LEN ) hash =partial_name_hash (*s++, hash);
Greg Kroah-Hartman
maintainerPATCH 28/168 USB: serial: option: add TCL IK512 MBIM & ECM
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Swanemar <[email protected]>
commit fdad4fb7c506bea8b419f70ff2163d99962e8ede upstream.
Add the following TCL IK512 compositions:
0x0530: Modem + Diag + AT + MBIM
T: Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 3 Spd=10000 MxCh= 0 D: Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs= 1 P: Vendor=1bbb ProdID=0530 Rev=05.04 S: Manufacturer=TCL S: Product=TCL 5G USB Dongle S: SerialNumber=3136b91a C: #Ifs= 5 Cfg#= 1 Atr=80 MxPwr=896mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim E: Ad=86(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 4 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim E: Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
0x0640: ECM + Modem + Diag + AT
T: Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 4 Spd=10000 MxCh= 0 D: Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs= 1 P: Vendor=1bbb ProdID=0640 Rev=05.04 S: Manufacturer=TCL S: Product=TCL 5G USB Dongle S: SerialNumber=3136b91a C: #Ifs= 5 Cfg#= 1 Atr=80 MxPwr=896mA I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=32ms I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether E: Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
--- drivers/usb/serial/option.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/serial/option.c +4 -0
@@ -2385,6 +2385,10 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x30) }, { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x40) }, { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x60) }, + { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0530, 0xff), /* TCL IK512 MBIM */ + .driver_info = NCTRL(1) }, + { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0640, 0xff), /* TCL IK512 ECM */ + .driver_info = NCTRL(3) }, { } /* Terminating entry */ };MODULE_DEVICE_TABLE (usb, option_ids);
Greg Kroah-Hartman
maintainerPATCH 29/168 USB: serial: option: add MeiG Smart SLM770A
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Hrusecky <[email protected]>
commit 724d461e44dfc0815624d2a9792f2f2beb7ee46d upstream.
Update the USB serial option driver to support MeiG Smart SLM770A.
ID 2dee:4d57 Marvell Mobile Composite Device Bus
T: Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=2dee ProdID=4d57 Rev= 1.00 S: Manufacturer=Marvell S: Product=Mobile Composite Device Bus
C:* #Ifs= 6 Cfg#= 1 Atr=c0 MxPwr=500mA
A: FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=03
I:* If#= 0 Alt= 0 #EPs= 1 Cls=e0(wlcon) Sub=01 Prot=03 Driver=rndis_host
E: Ad=87(I) Atr=03(Int.) MxPS= 64 Ivl=4096ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host
E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=0c(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=0b(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=88(I) Atr=03(Int.) MxPS= 64 Ivl=4096ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=0a(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=89(I) Atr=03(Int.) MxPS= 64 Ivl=4096ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=0e(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
Tested successfully connecting to the Internet via rndis interface after dialing via AT commands on If#=3 or If#=4.
Not sure of the purpose of the other serial interfaces.
--- drivers/usb/serial/option.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/option.c +3 -0
@@ -625,6 +625,8 @@ static void option_instat_callback(struc#define MEIGSMART_PRODUCT_SRM825L 0x4d22/* MeiG Smart SLM320 based on UNISOC UIS8910 */ #define MEIGSMART_PRODUCT_SLM320 0x4d41 +/* MeiG Smart SLM770A based on ASR1803 */ +#define MEIGSMART_PRODUCT_SLM770A 0x4d57/* Device flags */
@@ -2382,6 +2384,7 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, TOZED_PRODUCT_LT70C, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, LUAT_PRODUCT_AIR720U, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM320, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM770A, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x30) }, { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x40) }, { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x60) },
Greg Kroah-Hartman
maintainerPATCH 30/168 USB: serial: option: add Netprisma LCUK54 modules for WWAN Ready
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mank Wang <[email protected]>
commit aa954ae08262bb5cd6ab18dd56a0b58c1315db8b upstream.
LCUK54-WRD's pid/vid
0x3731/0x010a
0x3731/0x010c
LCUK54-WWD's pid/vid
0x3731/0x010b
0x3731/0x010d
Above products use the exact same interface layout and option driver:
MBIM + GNSS + DIAG + NMEA + AT + QDSS + DPL
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#= 5 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=3731 ProdID=0101 Rev= 5.04 S: Manufacturer=NetPrisma S: Product=LCUK54-WRD S: SerialNumber=feeba631 C:* #Ifs= 8 Cfg#= 1 Atr=a0 MxPwr=500mA A: FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00 I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim E: Ad=81(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=82(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
E: Ad=8f(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/usb/serial/option.c +12 -0
@@ -2377,6 +2377,18 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0116, 0xff, 0xff, 0x30) }, /* NetPrisma LCUK54-WWD for Golbal EDU */ { USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0116, 0xff, 0x00, 0x40) }, { USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0116, 0xff, 0xff, 0x40) }, + { USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x010a, 0xff, 0xff, 0x30) }, /* NetPrisma LCUK54-WRD for WWAN Ready */ + { USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x010a, 0xff, 0x00, 0x40) }, + { USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x010a, 0xff, 0xff, 0x40) }, + { USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x010b, 0xff, 0xff, 0x30) }, /* NetPrisma LCUK54-WWD for WWAN Ready */ + { USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x010b, 0xff, 0x00, 0x40) }, + { USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x010b, 0xff, 0xff, 0x40) }, + { USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x010c, 0xff, 0xff, 0x30) }, /* NetPrisma LCUK54-WRD for WWAN Ready */ + { USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x010c, 0xff, 0x00, 0x40) }, + { USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x010c, 0xff, 0xff, 0x40) }, + { USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x010d, 0xff, 0xff, 0x30) }, /* NetPrisma LCUK54-WWD for WWAN Ready */ + { USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x010d, 0xff, 0x00, 0x40) }, + { USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x010d, 0xff, 0xff, 0x40) }, { USB_DEVICE_AND_INTERFACE_INFO(OPPO_VENDOR_ID, OPPO_PRODUCT_R11, 0xff, 0xff, 0x30) }, { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0xff, 0x30) }, { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0xff, 0x40) },
Greg Kroah-Hartman
maintainerPATCH 31/168 USB: serial: option: add MediaTek T7XX compositions
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Wu <[email protected]>
commit f07dfa6a1b65034a5c3ba3a555950d972f252757 upstream.
Add the MediaTek T7XX compositions:
T: Bus=03 Lev=01 Prnt=01 Port=05 Cnt=01 Dev#= 74 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0e8d ProdID=7129 Rev= 0.01 S: Manufacturer=MediaTek Inc. S: Product=USB DATA CARD S: SerialNumber=004402459035402 C:* #Ifs=10 Cfg#= 1 Atr=a0 MxPwr=500mA A: FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00 I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim E: Ad=82(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 7 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=08(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=09(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
-------------------------------
| If Number | Function |
-------------------------------
| 2 | USB AP Log Port |
-------------------------------
| 3 | USB AP GNSS Port|
-------------------------------
| 4 | USB AP META Port|
-------------------------------
| 5 | ADB port |
-------------------------------
| 6 | USB MD AT Port |
------------------------------
| 7 | USB MD META Port|
-------------------------------
| 8 | USB NTZ Port |
-------------------------------
| 9 | USB Debug port |
-------------------------------
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -2249,6 +2249,8 @@ static const struct usb_device_id option .driver_info = NCTRL(2) }, { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x7127, 0xff, 0x00, 0x00), .driver_info = NCTRL(2) | NCTRL(3) | NCTRL(4) }, + { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x7129, 0xff, 0x00, 0x00), /* MediaTek T7XX */ + .driver_info = NCTRL(2) | NCTRL(3) | NCTRL(4) }, { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) }, { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MPL200), .driver_info = RSVD(1) | RSVD(4) },
Greg Kroah-Hartman
maintainerPATCH 32/168 USB: serial: option: add Telit FE910C04 rmnet compositions
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniele Palmas <[email protected]>
commit 8366e64a4454481339e7c56a8ad280161f2e441d upstream.
Add the following Telit FE910C04 compositions:
0x10c0: rmnet + tty (AT/NMEA) + tty (AT) + tty (diag)
T: Bus=02 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 13 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10c0 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FE910 S: SerialNumber=f71b8b32 C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x10c4: rmnet + tty (AT) + tty (AT) + tty (diag)
T: Bus=02 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 14 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10c4 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FE910 S: SerialNumber=f71b8b32 C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x10c8: rmnet + tty (AT) + tty (diag) + DPL (data packet logging) + adb
T: Bus=02 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 17 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10c8 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FE910 S: SerialNumber=f71b8b32 C: #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none) E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/serial/option.c +6 -0
@@ -1397,6 +1397,12 @@ static const struct usb_device_id option .driver_info = RSVD(0) | NCTRL(2) | RSVD(3) | RSVD(4) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10aa, 0xff), /* Telit FN920C04 (MBIM) */ .driver_info = NCTRL(3) | RSVD(4) | RSVD(5) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10c0, 0xff), /* Telit FE910C04 (rmnet) */ + .driver_info = RSVD(0) | NCTRL(3) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10c4, 0xff), /* Telit FE910C04 (rmnet) */ + .driver_info = RSVD(0) | NCTRL(3) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10c8, 0xff), /* Telit FE910C04 (rmnet) */ + .driver_info = RSVD(0) | NCTRL(2) | RSVD(3) | RSVD(4) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM),
Greg Kroah-Hartman
maintainerPATCH 33/168 drm/modes: Avoid divide by zero harder in drm_mode_vrefresh()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ville Syrjälä <[email protected]>
commit 9398332f23fab10c5ec57c168b44e72997d6318e upstream.
drm_mode_vrefresh() is trying to avoid divide by zero by checking whether htotal or vtotal are zero. But we may still end up with a div-by-zero of vtotal*htotal*...
--- drivers/gpu/drm/drm_modes.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_modes.c +7 -4
@@ -757,14 +757,11 @@ EXPORT_SYMBOL(drm_mode_set_name);*/ int drm_mode_vrefresh (const struct drm_display_mode *mode) { -unsigned int num, den; +unsigned int num =1 , den =1 ;if (mode->htotal ==0 || mode->vtotal ==0 )return 0 ; - num = mode->clock; - den = mode->htotal * mode->vtotal; -if (mode->flags &DRM_MODE_FLAG_INTERLACE ) num *=2 ;if (mode->flags &DRM_MODE_FLAG_DBLSCAN )
@@ -772,6 +769,12 @@ int drm_mode_vrefresh(const struct drm_dif (mode->vscan >1 ) den *= mode->vscan; +if (check_mul_overflow (mode->clock, num, &num)) +return 0 ; + +if (check_mul_overflow (mode->htotal * mode->vtotal, den, &den)) +return 0 ; +return DIV_ROUND_CLOSEST_ULL (mul_u32_u32 (num,1000 ), den); }EXPORT_SYMBOL (drm_mode_vrefresh);
Greg Kroah-Hartman
maintainerPATCH 34/168 hwmon: (tmp513) Dont use "proxy" headers
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 5d9ad4e0fa7cc27199fdb94beb6ec5f655ba9489 ]
The driver uses math.h and not util_macros.h.
All the same for the kernel.h, replace it with what the driver is using.
Stable-dep-of: 74d7e038fd07 ("hwmon: (tmp513) Fix interpretation of values of Shunt Voltage and Limit Registers")
--- drivers/hwmon/tmp513.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/hwmon/tmp513.c +6 -2
@@ -19,15 +19,19 @@* the Free Software Foundation; version 2 of the License. */ +#include <linux/bitops.h> +#include <linux/bug.h> +#include <linux/device.h> #include <linux/err.h> #include <linux/hwmon.h> #include <linux/i2c.h> #include <linux/init.h> -#include <linux/kernel.h> +#include <linux/math.h> #include <linux/module.h> +#include <linux/property.h> #include <linux/regmap.h> #include <linux/slab.h> -#include <linux/util_macros.h> +#include <linux/types.h> // Common register definition #define TMP51X_SHUNT_CONFIG 0x00
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 35/168 hwmon: (tmp513) Simplify with dev_err_probe()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit df989762bc4b71068e6adc0c2b5ef6f76b6acf74 ]
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
Stable-dep-of: 74d7e038fd07 ("hwmon: (tmp513) Fix interpretation of values of Shunt Voltage and Limit Registers")
--- drivers/hwmon/tmp513.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-)
drivers/hwmon/tmp513.c +15 -20
@@ -632,9 +632,9 @@ static int tmp51x_vbus_range_to_reg(struct device *dev, }else if (data->vbus_range_uvolt ==TMP51X_VBUS_RANGE_16V ) { data->shunt_config &= ~TMP51X_BUS_VOLTAGE_MASK ; }else { -dev_err (dev,"ti,bus-range-microvolt is invalid: %u\n" , - data->vbus_range_uvolt); -return -EINVAL ; +return dev_err_probe (dev, -EINVAL , +"ti,bus-range-microvolt is invalid: %u\n" , + data->vbus_range_uvolt); }return 0 ; }
@@ -650,8 +650,8 @@ static int tmp51x_pga_gain_to_reg(struct device *dev, struct tmp51x_data *data) }else if (data->pga_gain ==1 ) { data->shunt_config |=CURRENT_SENSE_VOLTAGE_40_MASK ; }else { -dev_err (dev,"ti,pga-gain is invalid: %u\n" , data->pga_gain); -return -EINVAL ; +return dev_err_probe (dev, -EINVAL , +"ti,pga-gain is invalid: %u\n" , data->pga_gain); }return 0 ; }
@@ -684,9 +684,9 @@ static int tmp51x_read_properties(struct device *dev, struct tmp51x_data *data)// Check if shunt value is compatible with pga-gain if (data->shunt_uohms > data->pga_gain *40 *1000 *1000 ) { -dev_err (dev,"shunt-resistor: %u too big for pga_gain: %u\n" , - data->shunt_uohms, data->pga_gain); -return -EINVAL ; +return dev_err_probe (dev, -EINVAL , +"shunt-resistor: %u too big for pga_gain: %u\n" , + data->shunt_uohms, data->pga_gain); }return 0 ;
@@ -730,22 +730,17 @@ static int tmp51x_probe(struct i2c_client *client) data->id =i2c_match_id (tmp51x_id, client)->driver_data; ret =tmp51x_configure (dev, data); -if (ret <0 ) { -dev_err (dev,"error configuring the device: %d\n" , ret); -return ret; - } +if (ret <0 ) +return dev_err_probe (dev, ret,"error configuring the device\n" ); data->regmap =devm_regmap_init_i2c (client, &tmp51x_regmap_config); -if (IS_ERR (data->regmap)) { -dev_err (dev,"failed to allocate register map\n" ); -return PTR_ERR (data->regmap); - } +if (IS_ERR (data->regmap)) +return dev_err_probe (dev,PTR_ERR (data->regmap), +"failed to allocate register map\n" ); ret =tmp51x_init (data); -if (ret <0 ) { -dev_err (dev,"error configuring the device: %d\n" , ret); -return -ENODEV ; - } +if (ret <0 ) +return dev_err_probe (dev, ret,"error configuring the device\n" ); hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name, data,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 36/168 hwmon: (tmp513) Use SI constants from units.h
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit f07f9d2467f4a298d24e186ddee6f69724903067 ]
MILLI and MICRO may be used in the driver to make code more robust against possible miscalculations.
Stable-dep-of: 74d7e038fd07 ("hwmon: (tmp513) Fix interpretation of values of Shunt Voltage and Limit Registers")
--- drivers/hwmon/tmp513.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
drivers/hwmon/tmp513.c +10 -11
@@ -32,6 +32,7 @@#include <linux/regmap.h> #include <linux/slab.h> #include <linux/types.h> +#include <linux/units.h> // Common register definition #define TMP51X_SHUNT_CONFIG 0x00
@@ -104,8 +105,8 @@#define TMP51X_REMOTE_TEMP_LIMIT_2_POS 8#define TMP513_REMOTE_TEMP_LIMIT_3_POS 7 -#define TMP51X_VBUS_RANGE_32V 32000000 -#define TMP51X_VBUS_RANGE_16V 16000000 +#define TMP51X_VBUS_RANGE_32V (32 * MICRO) +#define TMP51X_VBUS_RANGE_16V (16 * MICRO)// Max and Min value #define MAX_BUS_VOLTAGE_32_LIMIT 32764
@@ -200,7 +201,7 @@ static int tmp51x_get_value(struct tmp51x_data *data, u8 reg, u8 pos,* on the pga gain setting. 1lsb = 10uV */ *val =sign_extend32 (regval,17 -tmp51x_get_pga_shift (data)); - *val =DIV_ROUND_CLOSEST (*val *10000 , data->shunt_uohms); + *val =DIV_ROUND_CLOSEST (*val *10 *MILLI , data->shunt_uohms);break ;case TMP51X_BUS_VOLTAGE_RESULT :case TMP51X_BUS_VOLTAGE_H_LIMIT :
@@ -216,7 +217,7 @@ static int tmp51x_get_value(struct tmp51x_data *data, u8 reg, u8 pos,case TMP51X_BUS_CURRENT_RESULT :// Current = (ShuntVoltage * CalibrationRegister) / 4096 *val =sign_extend32 (regval,16 ) * data->curr_lsb_ua; - *val =DIV_ROUND_CLOSEST (*val,1000 ); + *val =DIV_ROUND_CLOSEST (*val,MILLI );break ;case TMP51X_LOCAL_TEMP_RESULT :case TMP51X_REMOTE_TEMP_RESULT_1 :
@@ -256,7 +257,7 @@ static int tmp51x_set_value(struct tmp51x_data *data, u8 reg, long val)* The user enter current value and we convert it to * voltage. 1lsb = 10uV */ - val =DIV_ROUND_CLOSEST (val * data->shunt_uohms,10000 ); + val =DIV_ROUND_CLOSEST (val * data->shunt_uohms,10 *MILLI ); max_val =U16_MAX >>tmp51x_get_pga_shift (data); regval =clamp_val (val, -max_val, max_val);break ;
@@ -546,18 +547,16 @@ static int tmp51x_calibrate(struct tmp51x_data *data)if (data->shunt_uohms ==0 )return regmap_write (data->regmap,TMP51X_SHUNT_CALIBRATION ,0 ); - max_curr_ma =DIV_ROUND_CLOSEST_ULL (vshunt_max *1000 *1000 , - data->shunt_uohms); + max_curr_ma =DIV_ROUND_CLOSEST_ULL (vshunt_max *MICRO , data->shunt_uohms);/* * Calculate the minimal bit resolution for the current and the power. * Those values will be used during register interpretation. */ - data->curr_lsb_ua =DIV_ROUND_CLOSEST_ULL (max_curr_ma *1000 ,32767 ); + data->curr_lsb_ua =DIV_ROUND_CLOSEST_ULL (max_curr_ma *MILLI ,32767 ); data->pwr_lsb_uw =20 * data->curr_lsb_ua; - div =DIV_ROUND_CLOSEST_ULL (data->curr_lsb_ua * data->shunt_uohms, -1000 *1000 ); + div =DIV_ROUND_CLOSEST_ULL (data->curr_lsb_ua * data->shunt_uohms,MICRO );return regmap_write (data->regmap,TMP51X_SHUNT_CALIBRATION ,DIV_ROUND_CLOSEST (40960 , div));
@@ -683,7 +682,7 @@ static int tmp51x_read_properties(struct device *dev, struct tmp51x_data *data)memcpy (data->nfactor, nfactor, (data->id == tmp513) ?3 :2 );// Check if shunt value is compatible with pga-gain -if (data->shunt_uohms > data->pga_gain *40 *1000 *1000 ) { +if (data->shunt_uohms > data->pga_gain *40 *MICRO ) {return dev_err_probe (dev, -EINVAL ,"shunt-resistor: %u too big for pga_gain: %u\n" , data->shunt_uohms, data->pga_gain);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 37/168 hwmon: (tmp513) Fix interpretation of values of Shunt Voltage and Limit Registers
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Murad Masimov <[email protected]>
[ Upstream commit 74d7e038fd072635d21e4734e3223378e09168d3 ]
The values returned by the driver after processing the contents of the Shunt Voltage Register and the Shunt Limit Registers do not correspond to the TMP512/TMP513 specifications. A raw register value is converted to a signed integer value by a sign extension in accordance with the algorithm provided in the specification, but due to the off-by-one error in the sign bit index, the result is incorrect. Moreover, the PGA shift calculated with the tmp51x_get_pga_shift function is relevant only to the Shunt Voltage Register, but is also applied to the Shunt Limit Registers.
According to the TMP512 and TMP513 datasheets, the Shunt Voltage Register (04h) is 13 to 16 bit two's complement integer value, depending on the PGA setting. The Shunt Positive (0Ch) and Negative (0Dh) Limit Registers are 16-bit two's complement integer values. Below are some examples:
* Shunt Voltage Register
If PGA = 8, and regval = 1000 0011 0000 0000, then the decimal value must be -32000, but the value calculated by the driver will be 33536.
* Shunt Limit Register
If regval = 1000 0011 0000 0000, then the decimal value must be -32000, but the value calculated by the driver will be 768, if PGA = 1.
Fix sign bit index, and also correct misleading comment describing the tmp51x_get_pga_shift function.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/hwmon/tmp513.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/hwmon/tmp513.c +4 -2
@@ -178,7 +178,7 @@ struct tmp51x_data {struct regmap *regmap; }; -// Set the shift based on the gain 8=4, 4=3, 2=2, 1=1 +// Set the shift based on the gain: 8 -> 1, 4 -> 2, 2 -> 3, 1 -> 4 static inline u8 tmp51x_get_pga_shift (struct tmp51x_data *data) {return 5 -ffs (data->pga_gain);
@@ -200,7 +200,9 @@ static int tmp51x_get_value(struct tmp51x_data *data, u8 reg, u8 pos,* 2's complement number shifted by one to four depending * on the pga gain setting. 1lsb = 10uV */ - *val =sign_extend32 (regval,17 -tmp51x_get_pga_shift (data)); + *val =sign_extend32 (regval, + reg ==TMP51X_SHUNT_CURRENT_RESULT ? +16 -tmp51x_get_pga_shift (data) :15 ); *val =DIV_ROUND_CLOSEST (*val *10 *MILLI , data->shunt_uohms);break ;case TMP51X_BUS_VOLTAGE_RESULT :
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 38/168 hwmon: (tmp513) Fix Current Register value interpretation
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Murad Masimov <[email protected]>
[ Upstream commit da1d0e6ba211baf6747db74c07700caddfd8a179 ]
The value returned by the driver after processing the contents of the Current Register does not correspond to the TMP512/TMP513 specifications. A raw register value is converted to a signed integer value by a sign extension in accordance with the algorithm provided in the specification, but due to the off-by-one error in the sign bit index, the result is incorrect. Moreover, negative values will be reported as large positive due to missing sign extension from u32 to long.
According to the TMP512 and TMP513 datasheets, the Current Register (07h) is a 16-bit two's complement integer value. E.g., if regval = 1000 0011 0000 0000, then the value must be (-32000 * lsb), but the driver will return (33536 * lsb).
Fix off-by-one bug, and also cast data->curr_lsb_ua (which is of type u32) to long to prevent incorrect cast for negative values.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/hwmon/tmp513.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/tmp513.c +1 -1
@@ -218,7 +218,7 @@ static int tmp51x_get_value(struct tmp51x_data *data, u8 reg, u8 pos,break ;case TMP51X_BUS_CURRENT_RESULT :// Current = (ShuntVoltage * CalibrationRegister) / 4096 - *val =sign_extend32 (regval,16 ) * data->curr_lsb_ua; + *val =sign_extend32 (regval,15 ) * (long )data->curr_lsb_ua; *val =DIV_ROUND_CLOSEST (*val,MILLI );break ;case TMP51X_LOCAL_TEMP_RESULT :
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 39/168 hwmon: (tmp513) Fix interpretation of values of Temperature Result and Limit Registers
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Murad Masimov <[email protected]>
[ Upstream commit dd471e25770e7e632f736b90db1e2080b2171668 ]
The values returned by the driver after processing the contents of the Temperature Result and the Temperature Limit Registers do not correspond to the TMP512/TMP513 specifications. A raw register value is converted to a signed integer value by a sign extension in accordance with the algorithm provided in the specification, but due to the off-by-one error in the sign bit index, the result is incorrect.
According to the TMP512 and TMP513 datasheets, the Temperature Result (08h to 0Bh) and Limit (11h to 14h) Registers are 13-bit two's complement integer values, shifted left by 3 bits. The value is scaled by 0.0625 degrees Celsius per bit. E.g., if regval = 1 1110 0111 0000 000, the output should be -25 degrees, but the driver will return +487 degrees.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/hwmon/tmp513.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/tmp513.c +1 -1
@@ -230,7 +230,7 @@ static int tmp51x_get_value(struct tmp51x_data *data, u8 reg, u8 pos,case TMP51X_REMOTE_TEMP_LIMIT_2 :case TMP513_REMOTE_TEMP_LIMIT_3 :// 1lsb = 0.0625 degrees centigrade - *val =sign_extend32 (regval,16 ) >>TMP51X_TEMP_SHIFT ; + *val =sign_extend32 (regval,15 ) >>TMP51X_TEMP_SHIFT ; *val =DIV_ROUND_CLOSEST (*val *625 ,10 );break ;case TMP51X_N_FACTOR_AND_HYST_1 :
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 40/168 sh: clk: Fix clk_enable() to return 0 on NULL clk
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit ff30bd6a6618e979b16977617371c0f28a95036e upstream.
On SH, devm_clk_get_optional_enabled() fails with -EINVAL if the clock is not found. This happens because __devm_clk_get() assumes it can pass a NULL clock pointer (as returned by clk_get_optional()) to the init() function (clk_prepare_enable() in this case), while the SH implementation of clk_enable() considers that an error.
Fix this by making the SH clk_enable() implementation return zero instead, like the Common Clock Framework does.
--- drivers/sh/clk/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/sh/clk/core.c +1 -1
@@ -295,7 +295,7 @@ int clk_enable(struct clk *clk)int ret;if (!clk) -return -EINVAL ; +return 0 ;spin_lock_irqsave (&clock_lock, flags); ret =__clk_enable (clk);
Greg Kroah-Hartman
maintainerPATCH 41/168 zram: refuse to use zero sized block device as backing device
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kairui Song <[email protected]>
commit be48c412f6ebf38849213c19547bc6d5b692b5e5 upstream.
Patch series "zram: fix backing device setup issue", v2.
This series fixes two bugs of backing device setting:
- ZRAM should reject using a zero sized (or the uninitialized ZRAM device itself) as the backing device.
- Fix backing device leaking when removing a uninitialized ZRAM device.
This patch (of 2):
Setting a zero sized block device as backing device is pointless, and one can easily create a recursive loop by setting the uninitialized ZRAM device itself as its own backing device by (zram0 is uninitialized):
echo /dev/zram0 > /sys/block/zram0/backing_dev
It's definitely a wrong config, and the module will pin itself, kernel should refuse doing so in the first place.
By refusing to use zero sized device we avoided misuse cases including this one above.
--- drivers/block/zram/zram_drv.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/block/zram/zram_drv.c +6 -0
@@ -499,6 +499,12 @@ static ssize_t backing_dev_store(struct } nr_pages =i_size_read (inode) >>PAGE_SHIFT ; +/* Refuse to use zero sized device (also prevents self reference) */ +if (!nr_pages) { + err = -EINVAL ; + goto out; + } + bitmap_sz =BITS_TO_LONGS (nr_pages) *sizeof (long ); bitmap =kvzalloc (bitmap_sz,GFP_KERNEL );if (!bitmap) {
Greg Kroah-Hartman
maintainerPATCH 42/168 btrfs: tree-checker: reject inline extent items with 0 ref count
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
commit dfb92681a19e1d5172420baa242806414b3eff6f upstream.
[BUG]
There is a bug report in the mailing list where btrfs_run_delayed_refs() failed to drop the ref count for logical 25870311358464 num_bytes 2113536.
The involved leaf dump looks like this:
item 166 key (25870311358464 168 2113536) itemoff 10091 itemsize 50
extent refs 1 gen 84178 flags 1
ref#0: shared data backref parent 32399126528000 count 0 <<<
ref#1: shared data backref parent 31808973717504 count 1Notice the count number is 0.
[CAUSE]
There is no concrete evidence yet, but considering 0 -> 1 is also a single bit flipped, it's possible that hardware memory bitflip is involved, causing the on-disk extent tree to be corrupted.
[FIX]
To prevent us reading such corrupted extent item, or writing such damaged extent item back to disk, enhance the handling of BTRFS_EXTENT_DATA_REF_KEY and BTRFS_SHARED_DATA_REF_KEY keys for both inlined and key items, to detect such 0 ref count and reject them.
--- fs/btrfs/tree-checker.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
fs/btrfs/tree-checker.c +26 -1
@@ -1416,6 +1416,11 @@ static int check_extent_item(struct exte dref_offset, fs_info->sectorsize);return -EUCLEAN ; } +if (unlikely (btrfs_extent_data_ref_count (leaf, dref) ==0 )) { +extent_err (leaf, slot, +"invalid data ref count, should have non-zero value" ); +return -EUCLEAN ; + } inline_refs +=btrfs_extent_data_ref_count (leaf, dref);break ;/* Contains parent bytenr and ref count */
@@ -1428,6 +1433,11 @@ static int check_extent_item(struct exte inline_offset, fs_info->sectorsize);return -EUCLEAN ; } +if (unlikely (btrfs_shared_data_ref_count (leaf, sref) ==0 )) { +extent_err (leaf, slot, +"invalid shared data ref count, should have non-zero value" ); +return -EUCLEAN ; + } inline_refs +=btrfs_shared_data_ref_count (leaf, sref);break ;default :
@@ -1479,8 +1489,18 @@ static int check_simple_keyed_refs(struc {u32 expect_item_size =0 ; -if (key->type ==BTRFS_SHARED_DATA_REF_KEY ) +if (key->type ==BTRFS_SHARED_DATA_REF_KEY ) { +struct btrfs_shared_data_ref *sref; + + sref = btrfs_item_ptr(leaf, slot, struct btrfs_shared_data_ref); +if (unlikely (btrfs_shared_data_ref_count (leaf, sref) ==0 )) { +extent_err (leaf, slot, +"invalid shared data backref count, should have non-zero value" ); +return -EUCLEAN ; + } + expect_item_size =sizeof (struct btrfs_shared_data_ref ); + }if (unlikely (btrfs_item_size_nr (leaf, slot) != expect_item_size)) { generic_err(leaf, slot,
@@ -1540,6 +1560,11 @@ static int check_extent_data_ref(struct offset, leaf->fs_info->sectorsize);return -EUCLEAN ; } +if (unlikely (btrfs_extent_data_ref_count (leaf, dref) ==0 )) { +extent_err (leaf, slot, +"invalid extent data backref count, should have non-zero value" ); +return -EUCLEAN ; + } }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 43/168 Drivers: hv: util: Avoid accessing a ringbuffer not initialized yet
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Kelley <[email protected]>
commit 07a756a49f4b4290b49ea46e089cbe6f79ff8d26 upstream.
If the KVP (or VSS) daemon starts before the VMBus channel's ringbuffer is fully initialized, we can hit the panic below:
hv_utils: Registering HyperV Utility Driverhv_vmbus: registering driver hv_utils
...
BUG: kernel NULL pointer dereference, address: 0000000000000000 CPU: 44 UID: 0 PID: 2552 Comm: hv_kvp_daemon Tainted: G E 6.11.0-rc3+ #1 RIP: 0010:hv_pkt_iter_first+0x12/0xd0 Call Trace:
...
vmbus_recvpacket
hv_kvp_onchannelcallback
vmbus_on_event
tasklet_action_common
tasklet_action
handle_softirqs
irq_exit_rcu
sysvec_hyperv_stimer0
</IRQ> <TASK> asm_sysvec_hyperv_stimer0
...
kvp_register_done
hvt_op_read
vfs_read
ksys_read
__x64_sys_read
This can happen because the KVP/VSS channel callback can be invoked even before the channel is fully opened:
1) as soon as hv_kvp_init() -> hvutil_transport_init() creates /dev/vmbus/hv_kvp, the kvp daemon can open the device file immediately and register itself to the driver by writing a message KVP_OP_REGISTER1 to the file (which is handled by kvp_on_msg() ->kvp_handle_handshake()) and reading the file for the driver's response, which is handled by hvt_op_read(), which calls hvt->on_read(), i.e. kvp_register_done().
2) the problem with kvp_register_done() is that it can cause the channel callback to be called even before the channel is fully opened, and when the channel callback is starting to run, util_probe()-> vmbus_open() may have not initialized the ringbuffer yet, so the callback can hit the panic of NULL pointer dereference.
To reproduce the panic consistently, we can add a "ssleep(10)" for KVP in __vmbus_open(), just before the first hv_ringbuffer_init(), and then we unload and reload the driver hv_utils, and run the daemon manually within the 10 seconds.
Fix the panic by reordering the steps in util_probe() so the char dev entry used by the KVP or VSS daemon is not created until after vmbus_open() has completed. This reordering prevents the race condition from happening.
Message-ID: <[email protected]>
--- drivers/hv/hv_kvp.c | 6 ++++++ drivers/hv/hv_snapshot.c | 6 ++++++ drivers/hv/hv_util.c | 9 +++++++++ drivers/hv/hyperv_vmbus.h | 2 ++ include/linux/hyperv.h | 1 + 5 files changed, 24 insertions(+)
drivers/hv/hv_kvp.c +6 -0
@@ -767,6 +767,12 @@ hv_kvp_init(struct hv_util_service *srv)*/ kvp_transaction.state =HVUTIL_DEVICE_INIT ; +return 0 ; +} + +int +hv_kvp_init_transport (void ) +{ hvt =hvutil_transport_init (kvp_devname,CN_KVP_IDX ,CN_KVP_VAL , kvp_on_msg, kvp_on_reset);if (!hvt)
drivers/hv/hv_snapshot.c +6 -0
@@ -385,6 +385,12 @@ hv_vss_init(struct hv_util_service *srv)*/ vss_transaction.state =HVUTIL_DEVICE_INIT ; +return 0 ; +} + +int +hv_vss_init_transport (void ) +{ hvt =hvutil_transport_init (vss_devname,CN_VSS_IDX ,CN_VSS_VAL , vss_on_msg, vss_on_reset);if (!hvt) {
drivers/hv/hv_util.c +9 -0
@@ -141,6 +141,7 @@ static struct hv_util_service util_heartstatic struct hv_util_service util_kvp = { .util_cb = hv_kvp_onchannelcallback, .util_init = hv_kvp_init, + .util_init_transport = hv_kvp_init_transport, .util_pre_suspend = hv_kvp_pre_suspend, .util_pre_resume = hv_kvp_pre_resume, .util_deinit = hv_kvp_deinit,
@@ -149,6 +150,7 @@ static struct hv_util_service util_kvp =static struct hv_util_service util_vss = { .util_cb = hv_vss_onchannelcallback, .util_init = hv_vss_init, + .util_init_transport = hv_vss_init_transport, .util_pre_suspend = hv_vss_pre_suspend, .util_pre_resume = hv_vss_pre_resume, .util_deinit = hv_vss_deinit,
@@ -592,6 +594,13 @@ static int util_probe(struct hv_device *if (ret) goto error; +if (srv->util_init_transport) { + ret = srv->util_init_transport (); +if (ret) { +vmbus_close (dev->channel); + goto error; + } + }return 0 ; error:
drivers/hv/hyperv_vmbus.h +2 -0
@@ -356,12 +356,14 @@ void vmbus_on_event(unsigned long data);void vmbus_on_msg_dpc (unsigned long data);int hv_kvp_init (struct hv_util_service *srv); +int hv_kvp_init_transport (void );void hv_kvp_deinit (void );int hv_kvp_pre_suspend (void );int hv_kvp_pre_resume (void );void hv_kvp_onchannelcallback (void *context);int hv_vss_init (struct hv_util_service *srv); +int hv_vss_init_transport (void );void hv_vss_deinit (void );int hv_vss_pre_suspend (void );int hv_vss_pre_resume (void );
include/linux/hyperv.h +1 -0
@@ -1526,6 +1526,7 @@ struct hv_util_service {void *channel;void (*util_cb)(void *);int (*util_init)(struct hv_util_service *); +int (*util_init_transport)(void );void (*util_deinit)(void );int (*util_pre_suspend)(void );int (*util_pre_resume)(void );
Greg Kroah-Hartman
maintainerPATCH 44/168 KVM: x86: Play nice with protected guests in complete_hypercall_exit()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 9b42d1e8e4fe9dc631162c04caa69b0d1860b0f0 upstream.
Use is_64_bit_hypercall() instead of is_64_bit_mode() to detect a 64-bit hypercall when completing said hypercall. For guests with protected state, e.g. SEV-ES and SEV-SNP, KVM must assume the hypercall was made in 64-bit mode as the vCPU state needed to detect 64-bit mode is unavailable.
Hacking the sev_smoke_test selftest to generate a KVM_HC_MAP_GPA_RANGE hypercall via VMGEXIT trips the WARN:
------------[ cut here ]------------ WARNING: CPU: 273 PID: 326626 at arch/x86/kvm/x86.h:180 complete_hypercall_exit+0x44/0xe0 [kvm] Modules linked in: kvm_amd kvm ... [last unloaded: kvm] CPU: 273 UID: 0 PID: 326626 Comm: sev_smoke_test Not tainted 6.12.0-smp--392e932fa0f3-feat #470 Hardware name: Google Astoria/astoria, BIOS 0.20240617.0-0 06/17/2024 RIP: 0010:complete_hypercall_exit+0x44/0xe0 [kvm] Call Trace: <TASK> kvm_arch_vcpu_ioctl_run+0x2400/0x2720 [kvm] kvm_vcpu_ioctl+0x54f/0x630 [kvm] __se_sys_ioctl+0x6b/0xc0 do_syscall_64+0x83/0x160 entry_SYSCALL_64_after_hwframe+0x76/0x7e </TASK> ---[ end trace 0000000000000000 ]---
--- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/x86.c +1 -1
@@ -8946,7 +8946,7 @@ static int complete_hypercall_exit(struc {u64 ret = vcpu->run->hypercall.ret; -if (!is_64_bit_mode (vcpu)) +if (!is_64_bit_hypercall (vcpu)) ret = (u32 )ret;kvm_rax_write (vcpu, ret); ++vcpu->stat.hypercalls;
Greg Kroah-Hartman
maintainerPATCH 45/168 tracing: Fix test_event_printk() to process entire print argument
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit a6629626c584200daf495cc9a740048b455addcd upstream.
The test_event_printk() analyzes print formats of trace events looking for cases where it may dereference a pointer that is not in the ring buffer which can possibly be a bug when the trace event is read from the ring buffer and the content of that pointer no longer exists.
The function needs to accurately go from one print format argument to the next. It handles quotes and parenthesis that may be included in an argument. When it finds the start of the next argument, it uses a simple "c = strstr(fmt + i, ',')" to find the end of that argument!
In order to include "%s" dereferencing, it needs to process the entire content of the print format argument and not just the content of the first ',' it finds. As there may be content like:
({ const char *saved_ptr = trace_seq_buffer_ptr(p); static const char
*access_str[] = { "---", "--x", "w--", "w-x", "-u-", "-ux", "wu-", "wux" }; union kvm_mmu_page_role role; role.word = REC->role; trace_seq_printf(p, "sp gen %u gfn %llx l%u %u-byte q%u%s %s%s" " %snxe %sad root %u %s%c", REC->mmu_valid_gen, REC->gfn, role.level, role.has_4_byte_gpte ? 4 : 8, role.quadrant, role.direct ? " direct" : "", access_str[role.access], role.invalid ? " invalid" : "", role.efer_nx ? "" : "!", role.ad_disabled ? "!" : "", REC->root_count, REC->unsync ? "unsync" : "sync", 0); saved_ptr; })
Which is an example of a full argument of an existing event. As the code already handles finding the next print format argument, process the argument at the end of it and not the start of it. This way it has both the start of the argument as well as the end of it.
Add a helper function "process_pointer()" that will do the processing during the loop as well as at the end. It also makes the code cleaner and easier to read.
--- kernel/trace/trace_events.c | 82 ++++++++++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 29 deletions(-)
kernel/trace/trace_events.c +53 -29
@@ -248,8 +248,7 @@ static bool test_field(const char *fmt, len = p - fmt;for (; field->type; field++) { -if (strncmp (field->name, fmt, len) || - field->name[len]) +if (strncmp (field->name, fmt, len) || field->name[len])continue ; array_descriptor =strchr (field->type,'[' );/* This is an array and is OK to dereference. */
@@ -258,6 +257,32 @@ static bool test_field(const char *fmt,return false; } +/* Return true if the argument pointer is safe */ +static bool process_pointer (const char *fmt,int len,struct trace_event_call *call) +{ +const char *r, *e, *a; + + e = fmt + len; + +/* Find the REC-> in the argument */ + r =strstr (fmt,"REC->" ); +if (r && r < e) { +/* +* Addresses of events on the buffer, or an array on the buffer is +* OK to dereference. There's ways to fool this, but +* this is to catch common mistakes, not malicious code. +*/ + a =strchr (fmt,'&' ); +if ((a && (a < r)) ||test_field (r, call)) +return true; + }else if ((r =strstr (fmt,"__get_dynamic_array(" )) && r < e) { +return true; + }else if ((r =strstr (fmt,"__get_sockaddr(" )) && r < e) { +return true; + } +return false; +} +/* * Examine the print fmt of the event looking for unsafe dereference * pointers using %p* that could be recorded in the trace event and
@@ -268,12 +293,12 @@ static void test_event_printk(struct tra {u64 dereference_flags =0 ;bool first = true; -const char *fmt, *c, *r, *a; +const char *fmt;int parens =0 ;char in_quote =0 ;int start_arg =0 ;int arg =0 ; -int i; +int i, e; fmt = call->print_fmt;
@@ -386,42 +411,41 @@ static void test_event_printk(struct tracase ',' :if (in_quote || parens)continue ; + e = i; i++;while (isspace (fmt[i])) i++; - start_arg = i; -if (!(dereference_flags & (1ULL << arg))) - goto next_arg; -/* Find the REC-> in the argument */ - c =strchr (fmt + i,',' ); - r =strstr (fmt + i,"REC->" ); -if (r && (!c || r < c)) { -/* -* Addresses of events on the buffer, -* or an array on the buffer is -* OK to dereference. -* There's ways to fool this, but -* this is to catch common mistakes, -* not malicious code. -*/ - a =strchr (fmt + i,'&' ); -if ((a && (a < r)) ||test_field (r, call)) +/* +* If start_arg is zero, then this is the start of the +* first argument. The processing of the argument happens +* when the end of the argument is found, as it needs to +* handle paranthesis and such. +*/ +if (!start_arg) { + start_arg = i; +/* Balance out the i++ in the for loop */ + i--; +continue ; + } + +if (dereference_flags & (1ULL << arg)) { +if (process_pointer (fmt + start_arg, e - start_arg, call)) dereference_flags &= ~(1ULL << arg); - }else if ((r =strstr (fmt + i,"__get_dynamic_array(" )) && - (!c || r < c)) { - dereference_flags &= ~(1ULL << arg); - }else if ((r =strstr (fmt + i,"__get_sockaddr(" )) && - (!c || r < c)) { - dereference_flags &= ~(1ULL << arg); } - next_arg: - i--; + start_arg = i; arg++; +/* Balance out the i++ in the for loop */ + i--; } } +if (dereference_flags & (1ULL << arg)) { +if (process_pointer (fmt + start_arg, i - start_arg, call)) + dereference_flags &= ~(1ULL << arg); + } +/* * If you triggered the below warning, the trace event reported * uses an unsafe dereference pointer %p*. As the data stored
Greg Kroah-Hartman
maintainerPATCH 46/168 tracing: Add missing helper functions in event pointer dereference check
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit 917110481f6bc1c96b1e54b62bb114137fbc6d17 upstream.
The process_pointer() helper function looks to see if various trace event macros are used. These macros are for storing data in the event. This makes it safe to dereference as the dereference will then point into the event on the ring buffer where the content of the data stays with the event itself.
A few helper functions were missing. Those were:
__get_rel_dynamic_array()
__get_dynamic_array_len()
__get_rel_dynamic_array_len()
__get_rel_sockaddr()
Also add a helper function find_print_string() to not need to use a middle man variable to test if the string exists.
--- kernel/trace/trace_events.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
kernel/trace/trace_events.c +19 -2
@@ -257,6 +257,15 @@ static bool test_field(const char *fmt,return false; } +/* Look for a string within an argument */ +static bool find_print_string (const char *arg,const char *str,const char *end) +{ +const char *r; + + r =strstr (arg, str); +return r && r < end; +} +/* Return true if the argument pointer is safe */ static bool process_pointer (const char *fmt,int len,struct trace_event_call *call) {
@@ -275,9 +284,17 @@ static bool process_pointer(const char * a =strchr (fmt,'&' );if ((a && (a < r)) ||test_field (r, call))return true; - }else if ((r =strstr (fmt,"__get_dynamic_array(" )) && r < e) { + }else if (find_print_string (fmt,"__get_dynamic_array(" , e)) { +return true; + }else if (find_print_string (fmt,"__get_rel_dynamic_array(" , e)) { +return true; + }else if (find_print_string (fmt,"__get_dynamic_array_len(" , e)) { +return true; + }else if (find_print_string (fmt,"__get_rel_dynamic_array_len(" , e)) { +return true; + }else if (find_print_string (fmt,"__get_sockaddr(" , e)) {return true; - }else if ((r =strstr (fmt,"__get_sockaddr(" )) && r < e) { + }else if (find_print_string (fmt,"__get_rel_sockaddr(" , e)) {return true; }return false;
Greg Kroah-Hartman
maintainerPATCH 47/168 tracing: Add "%s" check in test_event_printk()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit 65a25d9f7ac02e0cf361356e834d1c71d36acca9 upstream.
The test_event_printk() code makes sure that when a trace event is registered, any dereferenced pointers in from the event's TP_printk() are pointing to content in the ring buffer. But currently it does not handle "%s", as there's cases where the string pointer saved in the ring buffer points to a static string in the kernel that will never be freed. As that is a valid case, the pointer needs to be checked at runtime.
Currently the runtime check is done via trace_check_vprintf(), but to not have to replicate everything in vsnprintf() it does some logic with the va_list that may not be reliable across architectures. In order to get rid of that logic, more work in the test_event_printk() needs to be done. Some of the strings can be validated at this time when it is obvious the string is valid because the string will be saved in the ring buffer content.
Do all the validation of strings in the ring buffer at boot in test_event_printk(), and make sure that the field of the strings that point into the kernel are accessible. This will allow adding checks at runtime that will validate the fields themselves and not rely on paring the TP_printk() format at runtime.
--- kernel/trace/trace_events.c | 106 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 91 insertions(+), 15 deletions(-)
kernel/trace/trace_events.c +91 -15
@@ -227,19 +227,16 @@ int trace_event_get_offsets(struct tracereturn tail->offset + tail->size; } -/* -* Check if the referenced field is an array and return true, -* as arrays are OK to dereference. -*/ -static bool test_field (const char *fmt,struct trace_event_call *call) + +static struct trace_event_fields *find_event_field (const char *fmt, +struct trace_event_call *call) {struct trace_event_fields *field = call->class->fields_array; -const char *array_descriptor;const char *p = fmt;int len;if (!(len =str_has_prefix (fmt,"REC->" ))) -return false; +return NULL ; fmt += len;for (p = fmt; *p; p++) {if (!isalnum (*p) && *p !='_' )
@@ -250,11 +247,26 @@ static bool test_field(const char *fmt,for (; field->type; field++) {if (strncmp (field->name, fmt, len) || field->name[len])continue ; - array_descriptor =strchr (field->type,'[' ); -/* This is an array and is OK to dereference. */ -return array_descriptor !=NULL ; + +return field; } -return false; +return NULL ; +} + +/* +* Check if the referenced field is an array and return true, +* as arrays are OK to dereference. +*/ +static bool test_field (const char *fmt,struct trace_event_call *call) +{ +struct trace_event_fields *field; + + field =find_event_field (fmt, call); +if (!field) +return false; + +/* This is an array and is OK to dereference. */ +return strchr (field->type,'[' ) !=NULL ; }/* Look for a string within an argument */
@@ -300,6 +312,55 @@ static bool process_pointer(const char *return false; } +/* Return true if the string is safe */ +static bool process_string (const char *fmt,int len,struct trace_event_call *call) +{ +const char *r, *e, *s; + + e = fmt + len; + +/* +* There are several helper functions that return strings. +* If the argument contains a function, then assume its field is valid. +* It is considered that the argument has a function if it has: +* alphanumeric or '_' before a parenthesis. +*/ + s = fmt; +do { +int i; + + r =strstr (s,"(" ); +if (!r || r >= e) +break ; +for (i =1 ; r - i >= s; i++) { +char ch = *(r - i); +if (isspace (ch)) +continue ; +if (isalnum (ch) || ch =='_' ) +return true; +/* Anything else, this isn't a function */ +break ; + } +/* A function could be wrapped in parethesis, try the next one */ + s = r +1 ; + }while (s < e); + +/* +* If there's any strings in the argument consider this arg OK as it +* could be: REC->field ? "foo" : "bar" and we don't want to get into +* verifying that logic here. +*/ +if (find_print_string (fmt,"\"" , e)) +return true; + +/* Dereferenced strings are also valid like any other pointer */ +if (process_pointer (fmt, len, call)) +return true; + +/* Make sure the field is found, and consider it OK for now if it is */ +return find_event_field (fmt, call) !=NULL ; +} +/* * Examine the print fmt of the event looking for unsafe dereference * pointers using %p* that could be recorded in the trace event and
@@ -309,6 +370,7 @@ static bool process_pointer(const char *static void test_event_printk (struct trace_event_call *call) {u64 dereference_flags =0 ; +u64 string_flags =0 ;bool first = true;const char *fmt;int parens =0 ;
@@ -399,8 +461,16 @@ static void test_event_printk(struct tra star = true;continue ; } -if ((fmt[i + j] =='s' ) && star) - arg++; +if ((fmt[i + j] =='s' )) { +if (star) + arg++; +if (WARN_ONCE (arg ==63 , +"Too many args for event: %s" , +trace_event_name (call))) +return ; + dereference_flags |=1ULL << arg; + string_flags |=1ULL << arg; + }break ; }break ;
@@ -447,7 +517,10 @@ static void test_event_printk(struct tra }if (dereference_flags & (1ULL << arg)) { -if (process_pointer (fmt + start_arg, e - start_arg, call)) +if (string_flags & (1ULL << arg)) { +if (process_string (fmt + start_arg, e - start_arg, call)) + dereference_flags &= ~(1ULL << arg); + }else if (process_pointer (fmt + start_arg, e - start_arg, call)) dereference_flags &= ~(1ULL << arg); }
@@ -459,7 +532,10 @@ static void test_event_printk(struct tra }if (dereference_flags & (1ULL << arg)) { -if (process_pointer (fmt + start_arg, i - start_arg, call)) +if (string_flags & (1ULL << arg)) { +if (process_string (fmt + start_arg, i - start_arg, call)) + dereference_flags &= ~(1ULL << arg); + }else if (process_pointer (fmt + start_arg, i - start_arg, call)) dereference_flags &= ~(1ULL << arg); }
Greg Kroah-Hartman
maintainerPATCH 48/168 NFS/pnfs: Fix a live lock between recalled layouts and layoutget
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 62e2a47ceab8f3f7d2e3f0e03fdd1c5e0059fd8b upstream.
When the server is recalling a layout, we should ignore the count of outstanding layoutget calls, since the server is expected to return either NFS4ERR_RECALLCONFLICT or NFS4ERR_RETURNCONFLICT for as long as the recall is outstanding.
Currently, we may end up livelocking, causing the layout to eventually be forcibly revoked.
--- fs/nfs/pnfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/pnfs.c +1 -1
@@ -1193,7 +1193,7 @@ pnfs_prepare_layoutreturn(struct pnfs_la enum pnfs_iomode *iomode) {/* Serialise LAYOUTGET/LAYOUTRETURN */ -if (atomic_read (&lo->plh_outstanding) !=0 ) +if (atomic_read (&lo->plh_outstanding) !=0 && lo->plh_return_seq ==0 )return false;if (test_and_set_bit (NFS_LAYOUT_RETURN_LOCK , &lo->plh_flags))return false;
Greg Kroah-Hartman
maintainerPATCH 49/168 of/irq: Fix using uninitialized variable @addr_len in API of_irq_parse_one()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit 0f7ca6f69354e0c3923bbc28c92d0ecab4d50a3e upstream.
of_irq_parse_one() may use uninitialized variable @addr_len as shown below:
// @addr_len is uninitialized
int addr_len;
// This operation does not touch @addr_len if it fails. addr = of_get_property(device, "reg", &addr_len);
// Use uninitialized @addr_len if the operation fails. if (addr_len > sizeof(addr_buf))
addr_len = sizeof(addr_buf);
// Check the operation result here.
if (addr)
memcpy(addr_buf, addr, addr_len);
Fix by initializing @addr_len before the operation.
--- drivers/of/irq.c | 1 + 1 file changed, 1 insertion(+)
drivers/of/irq.c +1 -0
@@ -298,6 +298,7 @@ int of_irq_parse_one(struct device_nodereturn of_irq_parse_oldworld (device, index, out_irq);/* Get the reg property (if any) */ + addr_len =0 ; addr =of_get_property (device,"reg" , &addr_len);/* Prevent out-of-bounds read in case of longer interrupt parent address size */
Greg Kroah-Hartman
maintainerPATCH 50/168 nilfs2: prevent use of deleted inode
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
commit 901ce9705fbb9f330ff1f19600e5daf9770b0175 upstream.
syzbot reported a WARNING in nilfs_rmdir. [1]
Because the inode bitmap is corrupted, an inode with an inode number that should exist as a ".nilfs" file was reassigned by nilfs_mkdir for "file0", causing an inode duplication during execution. And this causes an underflow of i_nlink in rmdir operations.
The inode is used twice by the same task to unmount and remove directories ".nilfs" and "file0", it trigger warning in nilfs_rmdir.
Avoid to this issue, check i_nlink in nilfs_iget(), if it is 0, it means that this inode has been deleted, and iput is executed to reclaim it.
[1]
WARNING: CPU: 1 PID: 5824 at fs/inode.c:407 drop_nlink+0xc4/0x110 fs/inode.c:407 ... Call Trace: <TASK> nilfs_rmdir+0x1b0/0x250 fs/nilfs2/namei.c:342 vfs_rmdir+0x3a3/0x510 fs/namei.c:4394 do_rmdir+0x3b5/0x580 fs/namei.c:4453 __do_sys_rmdir fs/namei.c:4472 [inline] __se_sys_rmdir fs/namei.c:4470 [inline] __x64_sys_rmdir+0x47/0x50 fs/namei.c:4470 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- fs/nilfs2/inode.c | 8 +++++++- fs/nilfs2/namei.c | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-)
fs/nilfs2/inode.c +7 -1
@@ -618,8 +618,14 @@ struct inode *nilfs_iget(struct super_bl inode =nilfs_iget_locked (sb, root, ino);if (unlikely (!inode))return ERR_PTR (-ENOMEM ); -if (!(inode->i_state &I_NEW )) + +if (!(inode->i_state &I_NEW )) { +if (!inode->i_nlink) { +iput (inode); +return ERR_PTR (-ESTALE ); + }return inode; + } err =__nilfs_read_inode (sb, root, ino, inode);if (unlikely (err)) {
fs/nilfs2/namei.c +5 -0
@@ -67,6 +67,11 @@ nilfs_lookup(struct inode *dir, struct d inode =NULL ; }else { inode =nilfs_iget (dir->i_sb,NILFS_I (dir)->i_root, ino); +if (inode ==ERR_PTR (-ESTALE )) { +nilfs_error (dir->i_sb, +"deleted inode referenced: %lu" , ino); +return ERR_PTR (-EIO ); + } }return d_splice_alias (inode, dentry);
Greg Kroah-Hartman
maintainerPATCH 51/168 udmabuf: also check for F_SEAL_FUTURE_WRITE
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 0a16e24e34f28210f68195259456c73462518597 upstream.
When F_SEAL_FUTURE_WRITE was introduced, it was overlooked that udmabuf must reject memfds with this flag, just like ones with F_SEAL_WRITE. Fix it by adding F_SEAL_FUTURE_WRITE to SEALS_DENIED.
--- drivers/dma-buf/udmabuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma-buf/udmabuf.c +1 -1
@@ -164,7 +164,7 @@ static const struct dma_buf_ops udmabuf_ };#define SEALS_WANTED (F_SEAL_SHRINK) -#define SEALS_DENIED (F_SEAL_WRITE) +#define SEALS_DENIED (F_SEAL_WRITE|F_SEAL_FUTURE_WRITE) static long udmabuf_create(struct miscdevice *device, struct udmabuf_create_list *head,
Greg Kroah-Hartman
maintainerPATCH 52/168 of: Fix error path in of_parse_phandle_with_args_map()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herve Codina <[email protected]>
commit d7dfa7fde63dde4d2ec0083133efe2c6686c03ff upstream.
The current code uses some 'goto put;' to cancel the parsing operation and can lead to a return code value of 0 even on error cases.
Indeed, some goto calls are done from a loop without setting the ret value explicitly before the goto call and so the ret value can be set to 0 due to operation done in previous loop iteration. For instance match can be set to 0 in the previous loop iteration (leading to a new iteration) but ret can also be set to 0 it the of_property_read_u32() call succeed. In that case if no match are found or if an error is detected the new iteration, the return value can be wrongly 0.
Avoid those cases setting the ret value explicitly before the goto calls.
--- drivers/of/base.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/of/base.c +10 -5
@@ -1620,8 +1620,10 @@ int of_parse_phandle_with_args_map(const map_len--;/* Check if not found */ -if (!new) +if (!new) { + ret = -EINVAL ; goto put; + }if (!of_device_is_available (new)) match =0 ;
@@ -1631,17 +1633,20 @@ int of_parse_phandle_with_args_map(const goto put;/* Check for malformed properties */ -if (WARN_ON (new_size >MAX_PHANDLE_ARGS )) - goto put; -if (map_len < new_size) +if (WARN_ON (new_size >MAX_PHANDLE_ARGS ) || + map_len < new_size) { + ret = -EINVAL ; goto put; + }/* Move forward by new node's #<list>-cells amount */ map += new_size; map_len -= new_size; } -if (!match) +if (!match) { + ret = -ENOENT ; goto put; + }/* Get the <list>-map-pass-thru property (optional) */ pass =of_get_property (cur, pass_name,NULL );
Greg Kroah-Hartman
maintainerPATCH 53/168 of: Fix refcount leakage for OF node returned by __of_get_dma_parent()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit 5d009e024056ded20c5bb1583146b833b23bbd5a upstream.
__of_get_dma_parent() returns OF device node @args.np, but the node's refcount is increased twice, by both of_parse_phandle_with_args() and of_node_get(), so causes refcount leakage for the node.
Fix by directly returning the node got by of_parse_phandle_with_args().
--- drivers/of/address.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/address.c +1 -1
@@ -594,7 +594,7 @@ static struct device_node *__of_get_dma_if (ret <0 )return of_get_parent (np); -return of_node_get (args.np); +return args.np; }static struct device_node *of_get_next_dma_parent (struct device_node *np)
Greg Kroah-Hartman
maintainerPATCH 54/168 ceph: validate snapdirname option length when mounting
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Dryomov <[email protected]>
commit 12eb22a5a609421b380c3c6ca887474fb2089b2c upstream.
It becomes a path component, so it shouldn't exceed NAME_MAX characters. This was hardened in commit c152737be22b ("ceph: Use strscpy() instead of strcpy() in __get_snap_name()"), but no actual check was put in place.
--- fs/ceph/super.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ceph/super.c +2 -0
@@ -301,6 +301,8 @@ static int ceph_parse_mount_param(structswitch (token) {case Opt_snapdirname: +if (strlen (param->string) >NAME_MAX ) +return invalfc (fc,"snapdirname too long" );kfree (fsopt->snapdir_name); fsopt->snapdir_name = param->string; param->string =NULL ;
Greg Kroah-Hartman
maintainerPATCH 55/168 epoll: Add synchronous wakeup support for ep_poll_callback
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xuewen Yan <[email protected]>
commit 900bbaae67e980945dec74d36f8afe0de7556d5a upstream.
Now, the epoll only use wake_up() interface to wake up task. However, sometimes, there are epoll users which want to use the synchronous wakeup flag to hint the scheduler, such as Android binder driver.
So add a wake_up_sync() define, and use the wake_up_sync() when the sync is true in ep_poll_callback().
--- fs/eventpoll.c | 5 ++++- include/linux/wait.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)
fs/eventpoll.c +4 -1
@@ -1230,7 +1230,10 @@ static int ep_poll_callback(wait_queue_ebreak ; } } -wake_up (&ep->wq); +if (sync) +wake_up_sync (&ep->wq); +else +wake_up (&ep->wq); }if (waitqueue_active (&ep->poll_wait)) pwake++;
include/linux/wait.h +1 -0
@@ -224,6 +224,7 @@ void __wake_up_pollfree(struct wait_queu#define wake_up_all (x) __wake_up(x, TASK_NORMAL, 0, NULL)#define wake_up_locked (x) __wake_up_locked((x), TASK_NORMAL, 1)#define wake_up_all_locked (x) __wake_up_locked((x), TASK_NORMAL, 0) +#define wake_up_sync (x) __wake_up_sync(x, TASK_NORMAL)#define wake_up_interruptible (x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL)#define wake_up_interruptible_nr (x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL)
Greg Kroah-Hartman
maintainerPATCH 56/168 drm/amdgpu: Handle NULL bo->tbo.resource (again) in amdgpu_vm_bo_update
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michel Dänzer <[email protected]>
commit 85230ee36d88e7a09fb062d43203035659dd10a5 upstream.
Third time's the charm, I hope?
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +3 -4
@@ -1958,10 +1958,9 @@ int amdgpu_vm_bo_update(struct amdgpu_de* next command submission. */ if (bo && bo->tbo.base.resv == vm->root.bo->tbo.base.resv) { -uint32_t mem_type = bo->tbo.resource->mem_type; - -if (!(bo->preferred_domains & -amdgpu_mem_type_to_domain (mem_type))) +if (bo->tbo.resource && + !(bo->preferred_domains & +amdgpu_mem_type_to_domain (bo->tbo.resource->mem_type)))amdgpu_vm_bo_evicted (&bo_va->base);else amdgpu_vm_bo_idle (&bo_va->base);
Greg Kroah-Hartman
maintainerPATCH 57/168 media: dvb-frontends: dib3000mb: fix uninit-value in dib3000_write_reg
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
[ Upstream commit 2dd59fe0e19e1ab955259978082b62e5751924c7 ]
Syzbot reports [1] an uninitialized value issue found by KMSAN in dib3000_read_reg().
Local u8 rb[2] is used in i2c_transfer() as a read buffer; in case that call fails, the buffer may end up with some undefined values.
Since no elaborate error handling is expected in dib3000_write_reg(), simply zero out rb buffer to mitigate the problem.
[1] Syzkaller report
dvb-usb: bulk message failed: -22 (6/0)
=====================================================
BUG: KMSAN: uninit-value in dib3000mb_attach+0x2d8/0x3c0 drivers/media/dvb-frontends/dib3000mb.c:758 dib3000mb_attach+0x2d8/0x3c0 drivers/media/dvb-frontends/dib3000mb.c:758 dibusb_dib3000mb_frontend_attach+0x155/0x2f0 drivers/media/usb/dvb-usb/dibusb-mb.c:31 dvb_usb_adapter_frontend_init+0xed/0x9a0 drivers/media/usb/dvb-usb/dvb-usb-dvb.c:290 dvb_usb_adapter_init drivers/media/usb/dvb-usb/dvb-usb-init.c:90 [inline] dvb_usb_init drivers/media/usb/dvb-usb/dvb-usb-init.c:186 [inline] dvb_usb_device_init+0x25a8/0x3760 drivers/media/usb/dvb-usb/dvb-usb-init.c:310 dibusb_probe+0x46/0x250 drivers/media/usb/dvb-usb/dibusb-mb.c:110 ... Local variable rb created at: dib3000_read_reg+0x86/0x4e0 drivers/media/dvb-frontends/dib3000mb.c:54 dib3000mb_attach+0x123/0x3c0 drivers/media/dvb-frontends/dib3000mb.c:758
...
--- drivers/media/dvb-frontends/dib3000mb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-frontends/dib3000mb.c +1 -1
@@ -51,7 +51,7 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=setfe,8=getfe (|-astatic int dib3000_read_reg (struct dib3000_state *state,u16 reg) {u8 wb[] = { ((reg >>8 ) |0x80 ) &0xff , reg &0xff }; -u8 rb[2 ]; +u8 rb[2 ] = {};struct i2c_msg msg[] = { { .addr = state->config.demod_address, .flags =0 , .buf = wb, .len =2 }, { .addr = state->config.demod_address, .flags =I2C_M_RD , .buf = rb, .len =2 },
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 58/168 mm/vmstat: fix a W=1 clang compiler warning
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
[ Upstream commit 30c2de0a267c04046d89e678cc0067a9cfb455df ]
Fix the following clang compiler warning that is reported if the kernel is built with W=1:
./include/linux/vmstat.h:518:36: error: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Werror,-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
--- include/linux/vmstat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/vmstat.h +1 -1
@@ -447,7 +447,7 @@ static inline const char *node_stat_name(enum node_stat_item item)static inline const char *lru_list_name (enum lru_list lru) { -return node_stat_name (NR_LRU_BASE + lru) +3 ;// skip "nr_" +return node_stat_name (NR_LRU_BASE + (enum node_stat_item )lru) +3 ;// skip "nr_" }static inline const char *writeback_stat_name (enum writeback_stat_item item)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 59/168 tcp_bpf: Charge receive socket buffer in bpf_tcp_ingress()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit 54f89b3178d5448dd4457afbb98fc1ab99090a65 ]
When bpf_tcp_ingress() is called, the skmsg is being redirected to the ingress of the destination socket. Therefore, we should charge its receive socket buffer, instead of sending socket buffer.
Because sk_rmem_schedule() tests pfmemalloc of skb, we need to introduce a wrapper and call it for skmsg.
--- include/net/sock.h | 10 ++++++++-- net/ipv4/tcp_bpf.c | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-)
include/net/sock.h +8 -2
@@ -1570,7 +1570,7 @@ static inline bool sk_wmem_schedule(struct sock *sk, int size) }static inline bool -sk_rmem_schedule (struct sock *sk,struct sk_buff *skb,int size) +__sk_rmem_schedule (struct sock *sk,int size,bool pfmemalloc) {int delta;
@@ -1578,7 +1578,13 @@ sk_rmem_schedule(struct sock *sk, struct sk_buff *skb, int size)return true; delta = size - sk->sk_forward_alloc;return delta <=0 ||__sk_mem_schedule (sk, delta,SK_MEM_RECV ) || -skb_pfmemalloc (skb); + pfmemalloc; +} + +static inline bool +sk_rmem_schedule (struct sock *sk,struct sk_buff *skb,int size) +{ +return __sk_rmem_schedule (sk, size,skb_pfmemalloc (skb)); }static inline void sk_mem_reclaim (struct sock *sk)
net/ipv4/tcp_bpf.c +1 -1
@@ -31,7 +31,7 @@ static int bpf_tcp_ingress(struct sock *sk, struct sk_psock *psock, sge =sk_msg_elem (msg, i); size = (apply && apply_bytes < sge->length) ? apply_bytes : sge->length; -if (!sk_wmem_schedule (sk, size)) { +if (!__sk_rmem_schedule (sk, size, false)) {if (!copied) ret = -ENOMEM ;break ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 60/168 tcp_bpf: Add sk_rmem_alloc related logic for tcp_bpf ingress redirection
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijian Zhang <[email protected]>
[ Upstream commit d888b7af7c149c115dd6ac772cc11c375da3e17c ]
When we do sk_psock_verdict_apply->sk_psock_skb_ingress, an sk_msg will be created out of the skb, and the rmem accounting of the sk_msg will be handled by the skb.
For skmsgs in __SK_REDIRECT case of tcp_bpf_send_verdict, when redirecting to the ingress of a socket, although we sk_rmem_schedule and add sk_msg to the ingress_msg of sk_redir, we do not update sk_rmem_alloc. As a result, except for the global memory limit, the rmem of sk_redir is nearly unlimited. Thus, add sk_rmem_alloc related logic to limit the recv buffer.
Since the function sk_msg_recvmsg and __sk_psock_purge_ingress_msg are used in these two paths. We use "msg->skb" to test whether the sk_msg is skb backed up. If it's not, we shall do the memory accounting explicitly.
--- include/linux/skmsg.h | 11 ++++++++--- net/core/skmsg.c | 6 +++++- net/ipv4/tcp_bpf.c | 4 +++- 3 files changed, 16 insertions(+), 5 deletions(-)
include/linux/skmsg.h +8 -3
@@ -313,17 +313,22 @@ static inline void sock_drop(struct sock *sk, struct sk_buff *skb)kfree_skb (skb); } -static inline void sk_psock_queue_msg (struct sk_psock *psock, +static inline bool sk_psock_queue_msg (struct sk_psock *psock,struct sk_msg *msg) { +bool ret; +spin_lock_bh (&psock->ingress_lock); -if (sk_psock_test_state (psock,SK_PSOCK_TX_ENABLED )) +if (sk_psock_test_state (psock,SK_PSOCK_TX_ENABLED )) {list_add_tail (&msg->list, &psock->ingress_msg); -else { + ret = true; + }else {sk_msg_free (psock->sk, msg);kfree (msg); + ret = false; }spin_unlock_bh (&psock->ingress_lock); +return ret; }static inline struct sk_msg *sk_psock_dequeue_msg (struct sk_psock *psock)
net/core/skmsg.c +5 -1
@@ -445,8 +445,10 @@ int sk_msg_recvmsg(struct sock *sk, struct sk_psock *psock, struct msghdr *msg,if (likely (!peek)) { sge->offset += copy; sge->length -= copy; -if (!msg_rx->skb) +if (!msg_rx->skb) {sk_mem_uncharge (sk, copy); +atomic_sub (copy, &sk->sk_rmem_alloc); + } msg_rx->sg.size -= copy;if (!sge->length) {
@@ -761,6 +763,8 @@ static void __sk_psock_purge_ingress_msg(struct sk_psock *psock)list_for_each_entry_safe (msg, tmp, &psock->ingress_msg, list) {list_del (&msg->list); +if (!msg->skb) +atomic_sub (msg->sg.size, &psock->sk->sk_rmem_alloc);sk_msg_free (psock->sk, msg);kfree (msg); }
net/ipv4/tcp_bpf.c +3 -1
@@ -38,6 +38,7 @@ static int bpf_tcp_ingress(struct sock *sk, struct sk_psock *psock, }sk_mem_charge (sk, size); +atomic_add (size, &sk->sk_rmem_alloc);sk_msg_xfer (tmp, msg, i, size); copied += size;if (sge->length)
@@ -56,7 +57,8 @@ static int bpf_tcp_ingress(struct sock *sk, struct sk_psock *psock,if (!ret) { msg->sg.start = i; -sk_psock_queue_msg (psock, tmp); +if (!sk_psock_queue_msg (psock, tmp)) +atomic_sub (copied, &sk->sk_rmem_alloc);sk_psock_data_ready (sk, psock); }else {sk_msg_free (sk, tmp);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 61/168 bpf: Check negative offsets in __bpf_skb_min_len()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit 9ecc4d858b92c1bb0673ad9c327298e600c55659 ]
skb_network_offset() and skb_transport_offset() can be negative when they are called after we pull the transport header, for example, when we use eBPF sockmap at the point of ->sk_data_ready().
__bpf_skb_min_len() uses an unsigned int to get these offsets, this leads to a very large number which then causes bpf_skb_change_tail() failed unexpectedly.
Fix this by using a signed int to get these offsets and ensure the minimum is at least zero.
--- net/core/filter.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
net/core/filter.c +15 -6
@@ -3683,13 +3683,22 @@ static const struct bpf_func_proto bpf_skb_adjust_room_proto = {static u32 __bpf_skb_min_len (const struct sk_buff *skb) { -u32 min_len =skb_network_offset (skb); +int offset =skb_network_offset (skb); +u32 min_len =0 ; -if (skb_transport_header_was_set (skb)) - min_len =skb_transport_offset (skb); -if (skb->ip_summed ==CHECKSUM_PARTIAL ) - min_len =skb_checksum_start_offset (skb) + - skb->csum_offset +sizeof (__sum16); +if (offset >0 ) + min_len = offset; +if (skb_transport_header_was_set (skb)) { + offset =skb_transport_offset (skb); +if (offset >0 ) + min_len = offset; + } +if (skb->ip_summed ==CHECKSUM_PARTIAL ) { + offset =skb_checksum_start_offset (skb) + + skb->csum_offset +sizeof (__sum16); +if (offset >0 ) + min_len = offset; + }return min_len; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 62/168 nfsd: restore callback functionality for NFSv4.0
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
[ Upstream commit 7917f01a286ce01e9c085e24468421f596ee1a0c ]
A recent patch inadvertently broke callbacks for NFSv4.0.
In the 4.0 case we do not expect a session to be found but still need to call setup_callback_client() which will not try to dereference it.
This patch moves the check for failure to find a session into the 4.1+ branch of setup_callback_client()
--- fs/nfsd/nfs4callback.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/nfsd/nfs4callback.c +1 -3
@@ -986,7 +986,7 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c args.authflavor = clp->cl_cred.cr_flavor; clp->cl_cb_ident = conn->cb_ident; }else { -if (!conn->cb_xprt) +if (!conn->cb_xprt || !ses)return -EINVAL ; clp->cl_cb_session = ses; args.bc_xprt = conn->cb_xprt;
@@ -1379,8 +1379,6 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb) ses = c->cn_session; }spin_unlock (&clp->cl_lock); -if (!c) -return ; err =setup_callback_client (clp, &conn, ses);if (err) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 63/168 mtd: diskonchip: Cast an operand to prevent potential overflow
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zichen Xie <[email protected]>
commit 9b458e8be0d13e81ed03fffa23f8f9b528bbd786 upstream.
There may be a potential integer overflow issue in inftl_partscan(). parts[0].size is defined as "uint64_t" while mtd->erasesize and ip->firstUnit are defined as 32-bit unsigned integer. The result of the calculation will be limited to 32 bits without correct casting.
--- drivers/mtd/nand/raw/diskonchip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/diskonchip.c +1 -1
@@ -1098,7 +1098,7 @@ static inline int __init inftl_partscan( (i == 0) && (ip->firstUnit > 0)) { parts[0 ].name =" DiskOnChip IPL / Media Header partition" ; parts[0 ].offset =0 ; - parts[0 ].size = mtd->erasesize * ip->firstUnit; + parts[0 ].size = (uint64_t )mtd->erasesize * ip->firstUnit; numparts =1 ; }
Greg Kroah-Hartman
maintainerPATCH 64/168 mtd: rawnand: arasan: Fix double assertion of chip-select
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Andrzejewski <[email protected]>
commit b086a46dae48829e11c0c02580e30d920b76743c upstream.
When two chip-selects are configured in the device tree, and the second is a non-native GPIO, both the GPIO-based chip-select and the first native chip-select may be asserted simultaneously. This double assertion causes incorrect read and write operations.
The issue occurs because when nfc->ncs <= 2, nfc->spare_cs is always initialized to 0 due to static initialization. Consequently, when the second chip-select (GPIO-based) is selected in anfc_assert_cs(), it is detected by anfc_is_gpio_cs(), and nfc->native_cs is assigned the value 0. This results in both the GPIO-based chip-select being asserted and the NAND controller register receiving 0, erroneously selecting the native chip-select.
This patch resolves the issue, as confirmed by oscilloscope testing with configurations involving two or more chip-selects in the device tree.
--- drivers/mtd/nand/raw/arasan-nand-controller.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/arasan-nand-controller.c +2 -2
@@ -1425,8 +1425,8 @@ static int anfc_parse_cs(struct arasan_n* case, the "not" chosen CS is assigned to nfc->spare_cs and selected * whenever a GPIO CS must be asserted. */ -if (nfc->cs_array && nfc->ncs >2 ) { -if (!nfc->cs_array[0 ] && !nfc->cs_array[1 ]) { +if (nfc->cs_array) { +if (nfc->ncs >2 && !nfc->cs_array[0 ] && !nfc->cs_array[1 ]) {dev_err (nfc->dev,"Assign a single native CS when using GPIOs\n" );return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 65/168 mtd: rawnand: arasan: Fix missing de-registration of NAND
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Andrzejewski <[email protected]>
commit 11e6831fd81468cf48155b9b3c11295c391da723 upstream.
The NAND chip-selects are registered for the Arasan driver during initialization but are not de-registered when the driver is unloaded. As a result, if the driver is loaded again, the chip-selects remain registered and busy, making them unavailable for use.
--- drivers/mtd/nand/raw/arasan-nand-controller.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/mtd/nand/raw/arasan-nand-controller.c +7 -0
@@ -1510,8 +1510,15 @@ disable_controller_clk:static int anfc_remove (struct platform_device *pdev) { +int i;struct arasan_nfc *nfc =platform_get_drvdata (pdev); +for (i =0 ; i < nfc->ncs; i++) { +if (nfc->cs_array[i]) { +gpiod_put (nfc->cs_array[i]); + } + } +anfc_chips_cleanup (nfc);clk_disable_unprepare (nfc->bus_clk);
Greg Kroah-Hartman
maintainerPATCH 66/168 phy: core: Fix an OF node refcount leakage in _of_phy_get()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit 5ebdc6be16c2000e37fcb8b4072d442d268ad492 upstream.
_of_phy_get() will directly return when suffers of_device_is_compatible() error, but it forgets to decrease refcount of OF node @args.np before error return, the refcount was increased by previous of_parse_phandle_with_args() so causes the OF node's refcount leakage.
Fix by decreasing the refcount via of_node_put() before the error return.
--- drivers/phy/phy-core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/phy/phy-core.c +5 -2
@@ -537,8 +537,10 @@ static struct phy *_of_phy_get(struct dereturn ERR_PTR (-ENODEV );/* This phy type handled by the usb-phy subsystem for now */ -if (of_device_is_compatible (args.np,"usb-nop-xceiv" )) -return ERR_PTR (-ENODEV ); +if (of_device_is_compatible (args.np,"usb-nop-xceiv" )) { + phy =ERR_PTR (-ENODEV ); + goto out_put_node; + }mutex_lock (&phy_provider_mutex); phy_provider =of_phy_provider_lookup (args.np);
@@ -560,6 +562,7 @@ out_put_module: out_unlock:mutex_unlock (&phy_provider_mutex); +out_put_node:of_node_put (args.np);return phy;
Greg Kroah-Hartman
maintainerPATCH 67/168 phy: core: Fix an OF node refcount leakage in of_phy_provider_lookup()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit a2d633cb1421e679b56f1a9fe1f42f089706f1ed upstream.
For macro for_each_child_of_node(parent, child), refcount of @child has been increased before entering its loop body, so normally needs to call of_node_put(@child) before returning from the loop body to avoid refcount leakage.
of_phy_provider_lookup() has such usage but does not call of_node_put() before returning, so cause leakage of the OF node refcount.
Fix by simply calling of_node_put() before returning from the loop body.
The APIs affected by this issue are shown below since they indirectly invoke problematic of_phy_provider_lookup().phy_get()of_phy_get()devm_phy_get()devm_of_phy_get()devm_of_phy_get_by_index()
--- drivers/phy/phy-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/phy/phy-core.c +3 -1
@@ -138,8 +138,10 @@ static struct phy_provider *of_phy_provireturn phy_provider;for_each_child_of_node (phy_provider->children, child) -if (child == node) +if (child == node) { +of_node_put (child);return phy_provider; + } }return ERR_PTR (-EPROBE_DEFER );
Greg Kroah-Hartman
maintainerPATCH 68/168 phy: core: Fix that API devm_phy_put() fails to release the phy
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit fe4bfa9b6d7bd752bfe4700c937f235aa8ce997b upstream.
For devm_phy_put(), its comment says it needs to invoke phy_put() to release the phy, but it will not actually invoke the function since devres_destroy() does not call devm_phy_release(), and the missing phy_put() call will cause:
- The phy fails to be released.
- devm_phy_put() can not fully undo what API devm_phy_get() does.
- Leak refcount of both the module and device for below typical usage:
devm_phy_get(); // or its variant
...
err = do_something();
if (err)
goto err_out;
...
err_out:
devm_phy_put(); // leak refcount here The file(s) affected by this issue are shown below since they have such typical usage. drivers/pci/controller/cadence/pcie-cadence.c drivers/net/ethernet/ti/am65-cpsw-nuss.c
Fix by using devres_release() instead of devres_destroy() within the API.
--- drivers/phy/phy-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/phy-core.c +1 -1
@@ -650,7 +650,7 @@ void devm_phy_put(struct device *dev, stif (!phy)return ; - r =devres_destroy (dev, devm_phy_release, devm_phy_match, phy); + r =devres_release (dev, devm_phy_release, devm_phy_match, phy);dev_WARN_ONCE (dev, r,"couldn't find PHY resource\n" ); }EXPORT_SYMBOL_GPL (devm_phy_put);
Greg Kroah-Hartman
maintainerPATCH 69/168 phy: core: Fix that API devm_of_phy_provider_unregister() fails to unregister the phy provider
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit c0b82ab95b4f1fbc3e3aeab9d829d012669524b6 upstream.
For devm_of_phy_provider_unregister(), its comment says it needs to invoke of_phy_provider_unregister() to unregister the phy provider, but it will not actually invoke the function since devres_destroy() does not call devm_phy_provider_release(), and the missing of_phy_provider_unregister() call will cause:
- The phy provider fails to be unregistered.
- Leak both memory and the OF node refcount.
Fortunately, the faulty API has not been used by current kernel tree. Fix by using devres_release() instead of devres_destroy() within the API.
--- drivers/phy/phy-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/phy/phy-core.c +3 -3
@@ -1161,12 +1161,12 @@ EXPORT_SYMBOL_GPL(of_phy_provider_unregi* of_phy_provider_unregister to unregister the phy provider. */ void devm_of_phy_provider_unregister (struct device *dev, -struct phy_provider *phy_provider) +struct phy_provider *phy_provider) {int r; - r =devres_destroy (dev, devm_phy_provider_release, devm_phy_match, - phy_provider); + r =devres_release (dev, devm_phy_provider_release, devm_phy_match, + phy_provider);dev_WARN_ONCE (dev, r,"couldn't find PHY provider device resource\n" ); }EXPORT_SYMBOL_GPL (devm_of_phy_provider_unregister);
Greg Kroah-Hartman
maintainerPATCH 70/168 phy: core: Fix that API devm_phy_destroy() fails to destroy the phy
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit 4dc48c88fcf82b89fdebd83a906aaa64f40fb8a9 upstream.
For devm_phy_destroy(), its comment says it needs to invoke phy_destroy() to destroy the phy, but it will not actually invoke the function since devres_destroy() does not call devm_phy_consume(), and the missing phy_destroy() call will cause that the phy fails to be destroyed.
Fortunately, the faulty API has not been used by current kernel tree. Fix by using devres_release() instead of devres_destroy() within the API.
--- drivers/phy/phy-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/phy-core.c +1 -1
@@ -1023,7 +1023,7 @@ void devm_phy_destroy(struct device *dev {int r; - r =devres_destroy (dev, devm_phy_consume, devm_phy_match, phy); + r =devres_release (dev, devm_phy_consume, devm_phy_match, phy);dev_WARN_ONCE (dev, r,"couldn't find PHY resource\n" ); }EXPORT_SYMBOL_GPL (devm_phy_destroy);
Greg Kroah-Hartman
maintainerPATCH 71/168 dmaengine: mv_xor: fix child node refcount handling in early exit
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 362f1bf98a3ecb5a2a4fcbdaa9718c8403beceb2 upstream.
The for_each_child_of_node() loop requires explicit calls to of_node_put() to decrement the child's refcount upon early exits (break, goto, return).
Add the missing calls in the two early exits before the goto instructions.
--- drivers/dma/mv_xor.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/dma/mv_xor.c +2 -0
@@ -1393,6 +1393,7 @@ static int mv_xor_probe(struct platform_ irq =irq_of_parse_and_map (np,0 );if (!irq) { ret = -ENODEV ; +of_node_put (np); goto err_channel_add; }
@@ -1401,6 +1402,7 @@ static int mv_xor_probe(struct platform_if (IS_ERR (chan)) { ret =PTR_ERR (chan);irq_dispose_mapping (irq); +of_node_put (np); goto err_channel_add; }
Greg Kroah-Hartman
maintainerPATCH 72/168 dmaengine: dw: Select only supported masters for ACPI devices
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
commit f0e870a0e9c5521f2952ea9f3ea9d3d122631a89 upstream.
The recently submitted fix-commit revealed a problem in the iDMA 32-bit platform code. Even though the controller supported only a single master the dw_dma_acpi_filter() method hard-coded two master interfaces with IDs 0 and 1. As a result the sanity check implemented in the commit b336268dde75 ("dmaengine: dw: Add peripheral bus width verification") got incorrect interface data width and thus prevented the client drivers from configuring the DMA-channel with the EINVAL error returned. E.g., the next error was printed for the PXA2xx SPI controller driver trying to configure the requested channels:
Quoted 3 lines
[ 164.525604] pxa2xx_spi_pci 0000:00:07.1: DMA slave config failed [ 164.536105] pxa2xx_spi_pci 0000:00:07.1: failed to get DMA TX descriptor [ 164.543213] spidev spi-SPT0001:00: SPI transfer failed: -16
The problem would have been spotted much earlier if the iDMA 32-bit controller supported more than one master interfaces. But since it supports just a single master and the iDMA 32-bit specific code just ignores the master IDs in the CTLLO preparation method, the issue has been gone unnoticed so far.
Fix the problem by specifying the default master ID for both memory and peripheral devices in the driver data. Thus the issue noticed for the iDMA 32-bit controllers will be eliminated and the ACPI-probed DW DMA controllers will be configured with the correct master ID by default.
--- drivers/dma/dw/acpi.c | 6 ++++-- drivers/dma/dw/internal.h | 8 ++++++++ drivers/dma/dw/pci.c | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-)
drivers/dma/dw/acpi.c +4 -2
@@ -8,13 +8,15 @@static bool dw_dma_acpi_filter (struct dma_chan *chan,void *param) { +struct dw_dma *dw =to_dw_dma (chan->device); +struct dw_dma_chip_pdata *data =dev_get_drvdata (dw->dma.dev);struct acpi_dma_spec *dma_spec = param;struct dw_dma_slave slave = { .dma_dev = dma_spec->dev, .src_id = dma_spec->slave_id, .dst_id = dma_spec->slave_id, - .m_master =0 , - .p_master =1 , + .m_master = data->m_master, + .p_master = data->p_master, };return dw_dma_filter (chan, &slave);
drivers/dma/dw/internal.h +8 -0
@@ -51,11 +51,15 @@ struct dw_dma_chip_pdata {int (*probe)(struct dw_dma_chip *chip);int (*remove)(struct dw_dma_chip *chip);struct dw_dma_chip *chip; +u8 m_master; +u8 p_master; };static __maybe_unused const struct dw_dma_chip_pdata dw_dma_chip_pdata = { .probe = dw_dma_probe, .remove = dw_dma_remove, + .m_master =0 , + .p_master =1 , };static const struct dw_dma_platform_data idma32_pdata = {
@@ -72,6 +76,8 @@ static __maybe_unused const struct dw_dm .pdata = &idma32_pdata, .probe = idma32_dma_probe, .remove = idma32_dma_remove, + .m_master = 0, + .p_master = 0, };static const struct dw_dma_platform_data xbar_pdata = {
@@ -88,6 +94,8 @@ static __maybe_unused const struct dw_dm .pdata = &xbar_pdata, .probe = idma32_dma_probe, .remove = idma32_dma_remove, + .m_master = 0, + .p_master = 0, };#endif /* _DMA_DW_INTERNAL_H */
drivers/dma/dw/pci.c +2 -2
@@ -60,10 +60,10 @@ static int dw_pci_probe(struct pci_dev *if (ret)return ret; -dw_dma_acpi_controller_register (chip->dw); -pci_set_drvdata (pdev, data); +dw_dma_acpi_controller_register (chip->dw); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 73/168 dmaengine: at_xdmac: avoid null_prt_deref in at_xdmac_prep_dma_memset
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ridong <[email protected]>
commit c43ec96e8d34399bd9dab2f2dc316b904892133f upstream.
The at_xdmac_memset_create_desc may return NULL, which will lead to a null pointer dereference. For example, the len input is error, or the atchan->free_descs_list is empty and memory is exhausted. Therefore, add check to avoid this.
--- drivers/dma/at_xdmac.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/dma/at_xdmac.c +2 -0
@@ -1280,6 +1280,8 @@ at_xdmac_prep_dma_memset(struct dma_chanreturn NULL ; desc =at_xdmac_memset_create_desc (chan, atchan, dest, len, value); +if (!desc) +return NULL ;list_add_tail (&desc->desc_node, &desc->descs_list); desc->tx_dma_desc.cookie = -EBUSY ;
Greg Kroah-Hartman
maintainerPATCH 74/168 mtd: rawnand: fix double free in atmel_pmecc_create_user()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit d8e4771f99c0400a1873235704b28bb803c83d17 upstream.
The "user" pointer was converted from being allocated with kzalloc() to being allocated by devm_kzalloc(). Calling kfree(user) will lead to a double free.
--- drivers/mtd/nand/raw/atmel/pmecc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mtd/nand/raw/atmel/pmecc.c +1 -3
@@ -380,10 +380,8 @@ atmel_pmecc_create_user(struct atmel_pme user->delta = user->dmu + req->ecc.strength +1 ; gf_tables =atmel_pmecc_get_gf_tables (req); -if (IS_ERR (gf_tables)) { -kfree (user); +if (IS_ERR (gf_tables))return ERR_CAST (gf_tables); - } user->gf_tables = gf_tables;
Greg Kroah-Hartman
maintainerPATCH 75/168 tracing/kprobe: Make trace_kprobes module callback called after jump_label update
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <[email protected]>
[ Upstream commit d685d55dfc86b1a4bdcec77c3c1f8a83f181264e ]
Make sure the trace_kprobe's module notifer callback function is called after jump_label's callback is called. Since the trace_kprobe's callback eventually checks jump_label address during registering new kprobe on the loading module, jump_label must be updated before this registration happens.
--- kernel/trace/trace_kprobe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_kprobe.c +1 -1
@@ -705,7 +705,7 @@ static int trace_kprobe_module_callback(struct notifier_block *nb,static struct notifier_block trace_kprobe_module_nb = { .notifier_call = trace_kprobe_module_callback, - .priority =1 /* Invoked after kprobe module callback */ + .priority =2 /* Invoked after kprobe and jump_label module callback */ };struct count_symbols_struct {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 76/168 watchdog: it87_wdt: add PWRGD enable quirk for Qotom QCML04
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hilliard <[email protected]>
[ Upstream commit 43439076383a7611300334d1357c0f8883f40816 ]
For the watchdog timer to work properly on the QCML04 board we need to set PWRGD enable in the Environment Controller Configuration Registers Special Configuration Register 1 when it is not already set, this may be the case when the watchdog is not enabled from within the BIOS.
--- drivers/watchdog/it87_wdt.c | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
drivers/watchdog/it87_wdt.c +39 -0
@@ -20,6 +20,8 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/bits.h> +#include <linux/dmi.h> #include <linux/init.h> #include <linux/io.h> #include <linux/kernel.h>
@@ -40,6 +42,7 @@#define VAL 0x2f/* Logical device Numbers LDN */ +#define EC 0x04#define GPIO 0x07/* Configuration Registers and Functions */
@@ -71,6 +74,12 @@#define IT8784_ID 0x8784#define IT8786_ID 0x8786 +/* Environment Controller Configuration Registers LDN=0x04 */ +#define SCR1 0xfa + +/* Environment Controller Bits SCR1 */ +#define WDT_PWRGD 0x20 +/* GPIO Configuration Registers LDN=0x07 */ #define WDTCTRL 0x71#define WDTCFG 0x72
@@ -233,6 +242,21 @@ static int wdt_set_timeout(struct watchdog_device *wdd, unsigned int t)return ret; } +enum { +IT87_WDT_OUTPUT_THROUGH_PWRGD =BIT (0 ), +}; + +static const struct dmi_system_id it87_quirks[] = { + { +/* Qotom Q30900P (IT8786) */ + .matches = { +DMI_EXACT_MATCH (DMI_BOARD_NAME ,"QCML04" ), + }, + .driver_data = (void *)IT87_WDT_OUTPUT_THROUGH_PWRGD , + }, + {} +}; +static const struct watchdog_info ident = { .options =WDIOF_SETTIMEOUT |WDIOF_MAGICCLOSE |WDIOF_KEEPALIVEPING , .firmware_version =1 ,
@@ -254,8 +278,10 @@ static struct watchdog_device wdt_dev = {static int __init it87_wdt_init (void ) { +const struct dmi_system_id *dmi_id;u8 chip_rev;u8 ctrl; +int quirks =0 ;int rc; rc =superio_enter ();
@@ -266,6 +292,10 @@ static int __init it87_wdt_init(void) chip_rev =superio_inb (CHIPREV ) &0x0f ;superio_exit (); + dmi_id =dmi_first_match (it87_quirks); +if (dmi_id) + quirks = (long )dmi_id->driver_data; +switch (chip_type) {case IT8702_ID : max_units =255 ;
@@ -326,6 +356,15 @@ static int __init it87_wdt_init(void)superio_outb (0x00 ,WDTCTRL ); } +if (quirks &IT87_WDT_OUTPUT_THROUGH_PWRGD ) { +superio_select (EC ); + ctrl =superio_inb (SCR1 ); +if (!(ctrl &WDT_PWRGD )) { + ctrl |=WDT_PWRGD ; +superio_outb (ctrl,SCR1 ); + } + } +superio_exit ();if (timeout <1 || timeout > max_units *60 ) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 77/168 scsi: qla1280: Fix hw revision numbering for ISP1020/1040
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Magnus Lindholm <[email protected]>
[ Upstream commit c064de86d2a3909222d5996c5047f64c7a8f791b ]
Fix the hardware revision numbering for Qlogic ISP1020/1040 boards. HWMASK suggests that the revision number only needs four bits, this is consistent with how NetBSD does things in their ISP driver. Verified on a IPS1040B which is seen as rev 5 not as BIT_4.
--- drivers/scsi/qla1280.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/qla1280.h +6 -6
@@ -117,12 +117,12 @@ struct device_reg {uint16_t id_h;/* ID high */ uint16_t cfg_0;/* Configuration 0 */ #define ISP_CFG0_HWMSK 0x000f/* Hardware revision mask */ -#define ISP_CFG0_1020 BIT_0/* ISP1020 */ -#define ISP_CFG0_1020A BIT_1/* ISP1020A */ -#define ISP_CFG0_1040 BIT_2/* ISP1040 */ -#define ISP_CFG0_1040A BIT_3/* ISP1040A */ -#define ISP_CFG0_1040B BIT_4/* ISP1040B */ -#define ISP_CFG0_1040C BIT_5/* ISP1040C */ +#define ISP_CFG0_1020 1/* ISP1020 */ +#define ISP_CFG0_1020A 2/* ISP1020A */ +#define ISP_CFG0_1040 3/* ISP1040 */ +#define ISP_CFG0_1040A 4/* ISP1040A */ +#define ISP_CFG0_1040B 5/* ISP1040B */ +#define ISP_CFG0_1040C 6/* ISP1040C */ uint16_t cfg_1;/* Configuration 1 */ #define ISP_CFG1_F128 BIT_6/* 128-byte FIFO threshold */ #define ISP_CFG1_F64 BIT_4|BIT_5/* 128-byte FIFO threshold */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 78/168 scsi: megaraid_sas: Fix for a potential deadlock
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Henzl <[email protected]>
[ Upstream commit 50740f4dc78b41dec7c8e39772619d5ba841ddd7 ]
This fixes a 'possible circular locking dependency detected' warning
CPU0 CPU1
---- ----
lock(&instance->reset_mutex);
lock(&shost->scan_mutex);
lock(&instance->reset_mutex); lock(&shost->scan_mutex);
Fix this by temporarily releasing the reset_mutex.
--- drivers/scsi/megaraid/megaraid_sas_base.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/megaraid/megaraid_sas_base.c +4 -1
@@ -8922,8 +8922,11 @@ megasas_aen_polling(struct work_struct *work) (ld_target_id /MEGASAS_MAX_DEV_PER_CHANNEL ), (ld_target_id -MEGASAS_MAX_DEV_PER_CHANNEL ), 0); -if (sdev1) +if (sdev1) { +mutex_unlock (&instance->reset_mutex);megasas_remove_scsi_device (sdev1); +mutex_lock (&instance->reset_mutex); + } event_type =SCAN_VD_CHANNEL ;break ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 79/168 ALSA: hda/conexant: fix Z60MR100 startup pop issue
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: bo liu <[email protected]>
[ Upstream commit 947c4012f8f03a8bb946beb6e5294d5e32817d67 ]
When Z60MR100 startup, speaker will output a pop. To fix this issue, we mute codec by init verbs in bios when system startup, and set GPIO to low to unmute codec in codec driver when it loaded .
[ white space fixes and compile warning fix by tiwai ]
--- sound/pci/hda/patch_conexant.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
sound/pci/hda/patch_conexant.c +28 -0
@@ -311,6 +311,7 @@ enum {CXT_FIXUP_HP_MIC_NO_PRESENCE ,CXT_PINCFG_SWS_JS201D ,CXT_PINCFG_TOP_SPEAKER , + CXT_FIXUP_HP_A_U, };/* for hda_fixup_thinkpad_acpi() */
@@ -778,6 +779,18 @@ static void cxt_setup_mute_led(struct hda_codec *codec, } } +static void cxt_setup_gpio_unmute (struct hda_codec *codec, +unsigned int gpio_mute_mask) +{ +if (gpio_mute_mask) { +// set gpio data to 0. +snd_hda_codec_write (codec,0x01 ,0 ,AC_VERB_SET_GPIO_DATA ,0 ); +snd_hda_codec_write (codec,0x01 ,0 ,AC_VERB_SET_GPIO_MASK , gpio_mute_mask); +snd_hda_codec_write (codec,0x01 ,0 ,AC_VERB_SET_GPIO_DIRECTION , gpio_mute_mask); +snd_hda_codec_write (codec,0x01 ,0 ,AC_VERB_SET_GPIO_STICKY_MASK ,0 ); + } +} +static void cxt_fixup_mute_led_gpio (struct hda_codec *codec,const struct hda_fixup *fix,int action) {
@@ -792,6 +805,15 @@ static void cxt_fixup_hp_zbook_mute_led(struct hda_codec *codec,cxt_setup_mute_led (codec,0x10 ,0x20 ); } +static void cxt_fixup_hp_a_u (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +// Init vers in BIOS mute the spk/hp by set gpio high to avoid pop noise, +// so need to unmute once by clearing the gpio data when runs into the system. +if (action ==HDA_FIXUP_ACT_INIT ) +cxt_setup_gpio_unmute (codec,0x2 ); +} +/* ThinkPad X200 & co with cxt5051 */ static const struct hda_pintbl cxt_pincfg_lenovo_x200[] = { {0x16 ,0x042140ff },/* HP (seq# overridden) */
@@ -1016,6 +1038,10 @@ static const struct hda_fixup cxt_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = cxt_fixup_sirius_top_speaker, }, + [CXT_FIXUP_HP_A_U] = { + .type = HDA_FIXUP_FUNC, + .v.func = cxt_fixup_hp_a_u, + }, }; static const struct snd_pci_quirk cxt5045_fixups[] = {
@@ -1090,6 +1116,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {SND_PCI_QUIRK (0x103c ,0x8457 ,"HP Z2 G4 mini" ,CXT_FIXUP_HP_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x103c ,0x8458 ,"HP Z2 G4 mini premium" ,CXT_FIXUP_HP_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x138d ,"Asus" ,CXT_FIXUP_HEADPHONE_MIC_PIN ), +SND_PCI_QUIRK (0x14f1 ,0x0252 ,"MBX-Z60MR100" ,CXT_FIXUP_HP_A_U ),SND_PCI_QUIRK (0x14f1 ,0x0265 ,"SWS JS201D" ,CXT_PINCFG_SWS_JS201D ),SND_PCI_QUIRK (0x152d ,0x0833 ,"OLPC XO-1.5" ,CXT_FIXUP_OLPC_XO ), SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410),
@@ -1135,6 +1162,7 @@ static const struct hda_model_fixup cxt5066_fixup_models[] = { { .id = CXT_PINCFG_LENOVO_NOTEBOOK, .name = "lenovo-20149" }, { .id = CXT_PINCFG_SWS_JS201D, .name = "sws-js201d" }, { .id = CXT_PINCFG_TOP_SPEAKER, .name = "sirius-top-speaker" }, + { .id = CXT_FIXUP_HP_A_U, .name = "HP-U-support" }, {} };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 80/168 regmap: Use correct format specifier for logging range errors
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
[ Upstream commit 3f1aa0c533d9dd8a835caf9a6824449c463ee7e2 ]
The register addresses are unsigned ints so we should use %u not %d to log them.
--- drivers/base/regmap/regmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/base/regmap/regmap.c +2 -2
@@ -1153,13 +1153,13 @@ struct regmap *__regmap_init(struct device *dev,/* Sanity check */ if (range_cfg->range_max < range_cfg->range_min) { -dev_err (map->dev,"Invalid range %d: %d < %d\n" , i, +dev_err (map->dev,"Invalid range %d: %u < %u\n" , i, range_cfg->range_max, range_cfg->range_min); goto err_range; }if (range_cfg->range_max > map->max_register) { -dev_err (map->dev,"Invalid range %d: %d > %d\n" , i, +dev_err (map->dev,"Invalid range %d: %u > %u\n" , i, range_cfg->range_max, map->max_register); goto err_range; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 81/168 platform/x86: asus-nb-wmi: Ignore unknown event 0xCF
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Armin Wolf <[email protected]>
[ Upstream commit e9fba20c29e27dc99e55e1c550573a114561bf8c ]
On the Asus X541UAK an unknown event 0xCF is emited when the charger is plugged in. This is caused by the following AML code:
If (ACPS ())
{
ACPF = One
Local0 = 0x58
If (ATKP)
{
^^^^ATKD.IANE (0xCF)
}
}
Else
{
ACPF = Zero
Local0 = 0x57
}
Notify (AC0, 0x80) // Status Change
If (ATKP)
{
^^^^ATKD.IANE (Local0)
}
Sleep (0x64)
PNOT ()
Sleep (0x0A)
NBAT (0x80)Ignore the 0xCF event to silence the unknown event warning.
--- drivers/platform/x86/asus-nb-wmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/asus-nb-wmi.c +1 -0
@@ -574,6 +574,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = { { KE_KEY, 0xC4, { KEY_KBDILLUMUP } }, { KE_KEY, 0xC5, { KEY_KBDILLUMDOWN } }, { KE_IGNORE, 0xC6, }, /* Ambient Light Sensor notification */ + { KE_IGNORE, 0xCF, }, /* AC mode */ { KE_KEY, 0xFA, { KEY_PROG2 } }, /* Lid flip action */ { KE_KEY, 0xBD, { KEY_PROG2 } }, /* Lid flip action on ROG xflow laptops */ { KE_END, 0},
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 82/168 scsi: mpt3sas: Diag-Reset when Doorbell-In-Use bit is set during driver load time
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ranjan Kumar <[email protected]>
[ Upstream commit 3f5eb062e8aa335643181c480e6c590c6cedfd22 ]
Issue a Diag-Reset when the "Doorbell-In-Use" bit is set during the driver load/initialization.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +6 -1
@@ -6901,11 +6901,12 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,int i;u8 failed;__le32 *mfp; +int ret_val;/* make sure doorbell is not in use */ if ((ioc->base_readl_ext_retry (&ioc->chip->Doorbell) &MPI2_DOORBELL_USED )) {ioc_err (ioc,"doorbell is in use (line=%d)\n" , __LINE__); -return -EFAULT ; + goto doorbell_diag_reset; }/* clear pending doorbell interrupts from previous state changes */
@@ -6995,6 +6996,10 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, le32_to_cpu(mfp[i])); }return 0 ; + +doorbell_diag_reset: + ret_val =_base_diag_reset (ioc); +return ret_val; }/**
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 83/168 scsi: storvsc: Do not flag MAINTENANCE_IN return of SRB_STATUS_DATA_OVERRUN as an error
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cathy Avery <[email protected]>
[ Upstream commit b1aee7f034615b6824d2c70ddb37ef9fc23493b7 ]
This partially reverts commit 812fe6420a6e ("scsi: storvsc: Handle additional SRB status values").
HyperV does not support MAINTENANCE_IN resulting in FC passthrough returning the SRB_STATUS_DATA_OVERRUN value. Now that SRB_STATUS_DATA_OVERRUN is treated as an error, multipath ALUA paths go into a faulty state as multipath ALUA submits RTPG commands via MAINTENANCE_IN.
[ 3.215560] hv_storvsc 1d69d403-9692-4460-89f9-a8cbcc0f94f3: tag#230 cmd 0xa3 status: scsi 0x0 srb 0x12 hv 0xc0000001 [ 3.215572] scsi 1:0:0:32: alua: rtpg failed, result 458752
Make MAINTENANCE_IN return success to avoid the error path as is currently done with INQUIRY and MODE_SENSE.
--- drivers/scsi/storvsc_drv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/scsi/storvsc_drv.c +6 -1
@@ -155,6 +155,8 @@ static int sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE;*/ static int vmstor_proto_version; +static bool hv_dev_is_fc (struct hv_device *hv_dev); +#define STORVSC_LOGGING_NONE 0#define STORVSC_LOGGING_ERROR 1#define STORVSC_LOGGING_WARN 2
@@ -1192,6 +1194,7 @@ static void storvsc_on_io_completion(struct storvsc_device *stor_device,* not correctly handle: * INQUIRY command with page code parameter set to 0x80 * MODE_SENSE command with cmd[2] == 0x1c +* MAINTENANCE_IN is not supported by HyperV FC passthrough * * Setup srb and scsi status so this won't be fatal. * We do this so we can distinguish truly fatal failues
@@ -1199,7 +1202,9 @@ static void storvsc_on_io_completion(struct storvsc_device *stor_device,*/ if ((stor_pkt->vm_srb.cdb[0 ] ==INQUIRY ) || - (stor_pkt->vm_srb.cdb[0 ] ==MODE_SENSE )) { + (stor_pkt->vm_srb.cdb[0 ] ==MODE_SENSE ) || + (stor_pkt->vm_srb.cdb[0 ] ==MAINTENANCE_IN && +hv_dev_is_fc (device))) { vstor_packet->vm_srb.scsi_status =0 ; vstor_packet->vm_srb.srb_status =SRB_STATUS_SUCCESS ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 84/168 virtio-blk: dont keep queue frozen during system suspend
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
[ Upstream commit 7678abee0867e6b7fb89aa40f6e9f575f755fb37 ]
Commit 4ce6e2db00de ("virtio-blk: Ensure no requests in virtqueues before deleting vqs.") replaces queue quiesce with queue freeze in virtio-blk's PM callbacks. And the motivation is to drain inflight IOs before suspending.
block layer's queue freeze looks very handy, but it is also easy to cause deadlock, such as, any attempt to call into bio_queue_enter() may run into deadlock if the queue is frozen in current context. There are all kinds of ->suspend() called in suspend context, so keeping queue frozen in the whole suspend context isn't one good idea. And Marek reported lockdep warning[1] caused by virtio-blk's freeze queue in virtblk_freeze().
[1] https://lore.kernel.org/linux-block/[email protected]/
Given the motivation is to drain in-flight IOs, it can be done by calling freeze & unfreeze, meantime restore to previous behavior by keeping queue quiesced during suspend.
--- drivers/block/virtio_blk.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/block/virtio_blk.c +5 -2
@@ -988,9 +988,12 @@ static void virtblk_remove(struct virtio_device *vdev)static int virtblk_freeze (struct virtio_device *vdev) {struct virtio_blk *vblk = vdev->priv; +struct request_queue *q = vblk->disk->queue;/* Ensure no requests in virtqueues before deleting vqs. */ -blk_mq_freeze_queue (vblk->disk->queue); +blk_mq_freeze_queue (q); +blk_mq_quiesce_queue_nowait (q); +blk_mq_unfreeze_queue (q);/* Ensure we don't receive any more interrupts */ vdev->config->reset (vdev);
@@ -1014,8 +1017,8 @@ static int virtblk_restore(struct virtio_device *vdev)return ret;virtio_device_ready (vdev); +blk_mq_unquiesce_queue (vblk->disk->queue); -blk_mq_unfreeze_queue (vblk->disk->queue); return 0; }#endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 85/168 vmalloc: fix accounting with i915
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit a2e740e216f5bf49ccb83b6d490c72a340558a43 ]
If the caller of vmap() specifies VM_MAP_PUT_PAGES (currently only the i915 driver), we will decrement nr_vmalloc_pages and MEMCG_VMALLOC in vfree(). These counters are incremented by vmalloc() but not by vmap() so this will cause an underflow. Check the VM_MAP_PUT_PAGES flag before decrementing either counter.
--- mm/vmalloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/vmalloc.c +2 -1
@@ -2621,7 +2621,8 @@ static void __vunmap(const void *addr, int deallocate_pages)__free_pages (page, page_order);cond_resched (); } -atomic_long_sub (area->nr_pages, &nr_vmalloc_pages); +if (!(area->flags &VM_MAP_PUT_PAGES )) +atomic_long_sub (area->nr_pages, &nr_vmalloc_pages);kvfree (area->pages); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 86/168 MIPS: Probe toolchain support of -msym32
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaxun Yang <[email protected]>
[ Upstream commit 18ca63a2e23c5e170d2d7552b64b1f5ad019cd9b ]
msym32 is not supported by LLVM toolchain.
Workaround by probe toolchain support of msym32 for KBUILD_SYM32 feature.
--- arch/mips/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/Makefile +1 -1
@@ -275,7 +275,7 @@ drivers-$(CONFIG_PCI) += arch/mips/pci/ ifdef CONFIG_64BIT ifndef KBUILD_SYM32 ifeq ($(shell expr $(load-y) \< 0xffffffff80000000), 0) - KBUILD_SYM32 = y + KBUILD_SYM32 = $(call cc-option-yn, -msym32) endif endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 87/168 bpf: Check validity of link->type in bpf_link_show_fdinfo()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
commit 8421d4c8762bd022cb491f2f0f7019ef51b4f0a7 upstream.
If a newly-added link type doesn't invoke BPF_LINK_TYPE(), accessing bpf_link_type_strs[link->type] may result in an out-of-bounds access.
To spot such missed invocations early in the future, checking the validity of link->type in bpf_link_show_fdinfo() and emitting a warning when such invocations are missed.
[ shung-hsi.yu: break up existing seq_printf() call since commit 68b04864ca42
("bpf: Create links for BPF struct_ops maps.") is not present ]
--- kernel/bpf/syscall.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
kernel/bpf/syscall.c +9 -4
@@ -2522,16 +2522,21 @@ static void bpf_link_show_fdinfo(struct seq_file *m, struct file *filp) {const struct bpf_link *link = filp->private_data;const struct bpf_prog *prog = link->prog; +enum bpf_link_type type = link->type;char prog_tag[sizeof (prog->tag) *2 +1 ] = { }; +if (type <ARRAY_SIZE (bpf_link_type_strs) && bpf_link_type_strs[type]) { +seq_printf (m,"link_type:\t%s\n" , bpf_link_type_strs[type]); + }else { +WARN_ONCE (1 ,"missing BPF_LINK_TYPE(...) for link type %u\n" , type); +seq_printf (m,"link_type:\t<%u>\n" , type); + } +seq_printf (m,"link_id:\t%u\n" , link->id); +bin2hex (prog_tag, prog->tag,sizeof (prog->tag));seq_printf (m, -"link_type:\t%s\n" -"link_id:\t%u\n" "prog_tag:\t%s\n" "prog_id:\t%u\n" , - bpf_link_type_strs[link->type], - link->id, prog_tag, prog->aux->id);if (link->ops->show_fdinfo)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 88/168 drm/dp_mst: Fix MST sideband message body length check
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Deak <[email protected]>
[ Upstream commit bd2fccac61b40eaf08d9546acc9fef958bfe4763 ]
Fix the MST sideband message body length check, which must be at least 1 byte accounting for the message body CRC (aka message data CRC) at the end of the message.
This fixes a case where an MST branch device returns a header with a correct header CRC (indicating a correctly received body length), with the body length being incorrectly set to 0. This will later lead to a memory corruption in drm_dp_sideband_append_payload() and the following errors in dmesg:
UBSAN: array-index-out-of-bounds in drivers/gpu/drm/display/drm_dp_mst_topology.c:786:25
index -1 is out of range for type 'u8 [48]'
Call Trace:
drm_dp_sideband_append_payload+0x33d/0x350 [drm_display_helper]
drm_dp_get_one_sb_msg+0x3ce/0x5f0 [drm_display_helper]
drm_dp_mst_hpd_irq_handle_event+0xc8/0x1580 [drm_display_helper] memcpy: detected field-spanning write (size 18446744073709551615) of single field "&msg->msg[msg->curlen]" at drivers/gpu/drm/display/drm_dp_mst_topology.c:791 (size 256)
Call Trace:
drm_dp_sideband_append_payload+0x324/0x350 [drm_display_helper]
drm_dp_get_one_sb_msg+0x3ce/0x5f0 [drm_display_helper]
drm_dp_mst_hpd_irq_handle_event+0xc8/0x1580 [drm_display_helper]--- drivers/gpu/drm/drm_dp_mst_topology.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +3 -0
@@ -319,6 +319,9 @@ static bool drm_dp_decode_sideband_msg_hdr(const struct drm_dp_mst_topology_mgr hdr->broadcast = (buf[idx] >>7 ) &0x1 ; hdr->path_msg = (buf[idx] >>6 ) &0x1 ; hdr->msg_len = buf[idx] &0x3f ; +if (hdr->msg_len <1 )/* min space for body CRC */ +return false; + idx++; hdr->somt = (buf[idx] >>7 ) &0x1 ; hdr->eomt = (buf[idx] >>6 ) &0x1 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 89/168 ksmbd: fix Out-of-Bounds Read in ksmbd_vfs_stream_read
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jordy Zomer <[email protected]>
[ Upstream commit fc342cf86e2dc4d2edb0fc2ff5e28b6c7845adb9 ]
An offset from client could be a negative value, It could lead to an out-of-bounds read from the stream_buf.
Note that this issue is coming when setting
'vfs objects = streams_xattr parameter' in ksmbd.conf.
--- fs/ksmbd/smb2pdu.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/ksmbd/smb2pdu.c +4 -0
@@ -6350,6 +6350,10 @@ int smb2_read(struct ksmbd_work *work) } offset =le64_to_cpu (req->Offset); +if (offset <0 ) { + err = -EINVAL ; + goto out; + } length =le32_to_cpu (req->Length); mincount =le32_to_cpu (req->MinimumCount);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 90/168 ksmbd: fix Out-of-Bounds Write in ksmbd_vfs_stream_write
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jordy Zomer <[email protected]>
[ Upstream commit 313dab082289e460391c82d855430ec8a28ddf81 ]
An offset from client could be a negative value, It could allows to write data outside the bounds of the allocated buffer. Note that this issue is coming when setting
'vfs objects = streams_xattr parameter' in ksmbd.conf.
--- fs/ksmbd/smb2pdu.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ksmbd/smb2pdu.c +2 -0
@@ -6567,6 +6567,8 @@ int smb2_write(struct ksmbd_work *work) } offset =le64_to_cpu (req->Offset); +if (offset <0 ) +return -EINVAL ; length =le32_to_cpu (req->Length); if (req->Channel == SMB2_CHANNEL_RDMA_V1 ||
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 91/168 drm/amd/display: Add a left edge pixel if in YCbCr422 or YCbCr420 and odm
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peterson Guo <[email protected]>
[ Upstream commit 63e7ee677c74e981257cedfdd8543510d09096ba ]
[WHY]
On some cards when odm is used, the monitor will have 2 separate pipes split vertically. When compression is used on the YCbCr colour space on the second pipe to have correct colours, we need to read a pixel from the end of first pipe to accurately display colours. Hardware was programmed properly to account for this extra pixel but it was not calculated properly in software causing a split screen on some monitors.
[HOW]
The fix adjusts the second pipe's viewport and timings if the pixel encoding is YCbCr422 or YCbCr420.
--- .../drm/amd/display/dc/dcn20/dcn20_resource.c | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +23 -0
@@ -1899,6 +1899,7 @@ bool dcn20_split_stream_for_odm(if (prev_odm_pipe->plane_state) {struct scaler_data *sd = &prev_odm_pipe->plane_res.scl_data; +struct output_pixel_processor *opp = next_odm_pipe->stream_res.opp;int new_width;/* HACTIVE halved for odm combine */
@@ -1932,7 +1933,28 @@ bool dcn20_split_stream_for_odm( sd->viewport_c.x +=dc_fixpt_floor (dc_fixpt_mul_int ( sd->ratios.horz_c, sd->h_active - sd->recout.x)); sd->recout.x =0 ; + +/* +* When odm is used in YcbCr422 or 420 colour space, a split screen +* will be seen with the previous calculations since the extra left +* edge pixel is accounted for in fmt but not in viewport. +* +* Below are calculations which fix the split by fixing the calculations +* if there is an extra left edge pixel. +*/ +if (opp && opp->funcs->opp_get_left_edge_extra_pixel_count + && opp->funcs->opp_get_left_edge_extra_pixel_count ( + opp, next_odm_pipe->stream->timing.pixel_encoding, +resource_is_pipe_type (next_odm_pipe,OTG_MASTER )) ==1 ) { + sd->h_active +=1 ; + sd->recout.width +=1 ; + sd->viewport.x -=dc_fixpt_ceil (dc_fixpt_mul_int (sd->ratios.horz,1 )); + sd->viewport_c.x -=dc_fixpt_ceil (dc_fixpt_mul_int (sd->ratios.horz,1 )); + sd->viewport_c.width +=dc_fixpt_ceil (dc_fixpt_mul_int (sd->ratios.horz,1 )); + sd->viewport.width +=dc_fixpt_ceil (dc_fixpt_mul_int (sd->ratios.horz,1 )); + } } +if (!next_odm_pipe->top_pipe) next_odm_pipe->stream_res.opp = pool->opps[next_odm_pipe->pipe_idx];else
@@ -2905,6 +2927,7 @@ bool dcn20_fast_validate_bw(ASSERT (0 ); } } +/* Actual dsc count per stream dsc validation*/ if (!dcn20_validate_dsc (dc, context)) { context->bw_ctx.dml.vba.ValidationStatus[context->bw_ctx.dml.vba.soc.num_states] =
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 92/168 arm64: mm: Rename asid2idx() to ctxid2asid()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yunfeng Ye <[email protected]>
[ Upstream commit a3a5b763410c7bceacf41a52071134d9dc26202a ]
The commit 0c8ea531b774 ("arm64: mm: Allocate ASIDs in pairs") introduce the asid2idx and idx2asid macro, but these macros are not really useful after the commit f88f42f853a8 ("arm64: context: Free up kernel ASIDs if KPTI is not in use").
The code "(asid & ~ASID_MASK)" can be instead by a macro, which is the same code with asid2idx(). So rename it to ctxid2asid() for a better understanding.
Also we add asid2ctxid() macro, the contextid can be generated based on the asid and generation through this macro.
Stable-dep-of: c0900d15d31c ("arm64: Ensure bits ASID[15:8] are masked out when the kernel uses 8-bit ASIDs")
--- arch/arm64/mm/context.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
arch/arm64/mm/context.c +9 -9
@@ -35,8 +35,8 @@ static unsigned long *pinned_asid_map;#define ASID_FIRST_VERSION (1UL << asid_bits)#define NUM_USER_ASIDS ASID_FIRST_VERSION -#define asid2idx (asid) ((asid) & ~ASID_MASK) -#define idx2asid (idx) asid2idx(idx) +#define ctxid2asid (asid) ((asid) & ~ASID_MASK) +#define asid2ctxid (asid, genid) ((asid) | (genid))/* Get the ASIDBits supported by the current CPU */ static u32 get_cpu_asid_bits (void )
@@ -120,7 +120,7 @@ static void flush_context(void)*/ if (asid ==0 ) asid =per_cpu (reserved_asids, i); -__set_bit (asid2idx (asid), asid_map); +__set_bit (ctxid2asid (asid), asid_map);per_cpu (reserved_asids, i) = asid; }
@@ -162,7 +162,7 @@ static u64 new_context(struct mm_struct *mm)u64 generation =atomic64_read (&asid_generation);if (asid !=0 ) { -u64 newasid = generation | (asid & ~ASID_MASK ); +u64 newasid =asid2ctxid (ctxid2asid (asid), generation);/* * If our current ASID was active during a rollover, we
@@ -183,7 +183,7 @@ static u64 new_context(struct mm_struct *mm)* We had a valid ASID in a previous life, so try to re-use * it if possible. */ -if (!__test_and_set_bit (asid2idx (asid), asid_map)) +if (!__test_and_set_bit (ctxid2asid (asid), asid_map))return newasid; }
@@ -209,7 +209,7 @@ static u64 new_context(struct mm_struct *mm) set_asid:__set_bit (asid, asid_map); cur_idx = asid; -return idx2asid (asid) | generation; +return asid2ctxid (asid, generation); }void check_and_switch_context (struct mm_struct *mm)
@@ -300,13 +300,13 @@ unsigned long arm64_mm_context_get(struct mm_struct *mm) } nr_pinned_asids++; -__set_bit (asid2idx (asid), pinned_asid_map); +__set_bit (ctxid2asid (asid), pinned_asid_map);refcount_set (&mm->context.pinned,1 ); out_unlock:raw_spin_unlock_irqrestore (&cpu_asid_lock, flags); - asid &= ~ASID_MASK ; + asid =ctxid2asid (asid);/* Set the equivalent of USER_ASID_BIT */ if (asid &&arm64_kernel_unmapped_at_el0 ())
@@ -327,7 +327,7 @@ void arm64_mm_context_put(struct mm_struct *mm)raw_spin_lock_irqsave (&cpu_asid_lock, flags);if (refcount_dec_and_test (&mm->context.pinned)) { -__clear_bit (asid2idx (asid), pinned_asid_map); +__clear_bit (ctxid2asid (asid), pinned_asid_map); nr_pinned_asids--; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 93/168 arm64: Ensure bits ASID[15:8] are masked out when the kernel uses 8-bit ASIDs
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Catalin Marinas <[email protected]>
[ Upstream commit c0900d15d31c2597dd9f634c8be2b71762199890 ]
Linux currently sets the TCR_EL1.AS bit unconditionally during CPU bring-up. On an 8-bit ASID CPU, this is RES0 and ignored, otherwise 16-bit ASIDs are enabled. However, if running in a VM and the hypervisor reports 8-bit ASIDs (ID_AA64MMFR0_EL1.ASIDBits == 0) on a 16-bit ASIDs CPU, Linux uses bits 8 to 63 as a generation number for tracking old process ASIDs. The bottom 8 bits of this generation end up being written to TTBR1_EL1 and also used for the ASID-based TLBI operations as the upper 8 bits of the ASID. Following an ASID roll-over event we can have threads of the same application with the same 8-bit ASID but different generation numbers running on separate CPUs. Both TLB caching and the TLBI operations will end up using different actual 16-bit ASIDs for the same process.
A similar scenario can happen in a big.LITTLE configuration if the boot CPU only uses 8-bit ASIDs while secondary CPUs have 16-bit ASIDs.
Ensure that the ASID generation is only tracked by bits 16 and up, leaving bits 15:8 as 0 if the kernel uses 8-bit ASIDs. Note that clearing TCR_EL1.AS is not sufficient since the architecture requires that the top 8 bits of the ASID passed to TLBI instructions are 0 rather than ignored in such configuration.
--- arch/arm64/mm/context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/mm/context.c +2 -2
@@ -32,9 +32,9 @@ static unsigned long nr_pinned_asids;static unsigned long *pinned_asid_map;#define ASID_MASK (~GENMASK(asid_bits - 1, 0)) -#define ASID_FIRST_VERSION (1UL << asid_bits) +#define ASID_FIRST_VERSION (1UL << 16) -#define NUM_USER_ASIDS ASID_FIRST_VERSION +#define NUM_USER_ASIDS (1UL << asid_bits)#define ctxid2asid (asid) ((asid) & ~ASID_MASK)#define asid2ctxid (asid, genid) ((asid) | (genid))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 94/168 drm/dp_mst: Verify request type in the corresponding down message reply
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Deak <[email protected]>
[ Upstream commit 4d49e77a973d3b5d1881663c3f122906a0702940 ]
After receiving the response for an MST down request message, the response should be accepted/parsed only if the response type matches that of the request. Ensure this by checking if the request type code stored both in the request and the reply match, dropping the reply in case of a mismatch.
This fixes the topology detection for an MST hub, as described in the Closes link below, where the hub sends an incorrect reply message after a CLEAR_PAYLOAD_TABLE -> LINK_ADDRESS down request message sequence.
--- drivers/gpu/drm/drm_dp_mst_topology.c | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +31 -0
@@ -3993,6 +3993,34 @@ drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up,return true; } +static int get_msg_request_type (u8 data) +{ +return data &0x7f ; +} + +static bool verify_rx_request_type (struct drm_dp_mst_topology_mgr *mgr, +const struct drm_dp_sideband_msg_tx *txmsg, +const struct drm_dp_sideband_msg_rx *rxmsg) +{ +const struct drm_dp_sideband_msg_hdr *hdr = &rxmsg->initial_hdr; +const struct drm_dp_mst_branch *mstb = txmsg->dst; +int tx_req_type =get_msg_request_type (txmsg->msg[0 ]); +int rx_req_type =get_msg_request_type (rxmsg->msg[0 ]); +char rad_str[64 ]; + +if (tx_req_type == rx_req_type) +return true; + +drm_dp_mst_rad_to_str (mstb->rad, mstb->lct, rad_str,sizeof (rad_str)); +drm_dbg_kms (mgr->dev, +"Got unexpected MST reply, mstb: %p seqno: %d lct: %d rad: %s rx_req_type: %s (%02x) != tx_req_type: %s (%02x)\n" , + mstb, hdr->seqno, mstb->lct, rad_str, +drm_dp_mst_req_type_str (rx_req_type), rx_req_type, +drm_dp_mst_req_type_str (tx_req_type), tx_req_type); + +return false; +} +static int drm_dp_mst_handle_down_rep (struct drm_dp_mst_topology_mgr *mgr) {struct drm_dp_sideband_msg_tx *txmsg;
@@ -4022,6 +4050,9 @@ static int drm_dp_mst_handle_down_rep(struct drm_dp_mst_topology_mgr *mgr) goto out_clear_reply; } +if (!verify_rx_request_type (mgr, txmsg, msg)) + goto out_clear_reply; +drm_dp_sideband_parse_reply (mgr, msg, &txmsg->reply);if (txmsg->reply.reply_type ==DP_SIDEBAND_REPLY_NAK ) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 95/168 lib: stackinit: hide never-taken branch from compiler
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit 5c3793604f91123bf49bc792ce697a0bef4c173c ]
The never-taken branch leads to an invalid bounds condition, which is by design. To avoid the unwanted warning from the compiler, hide the variable from the optimizer.
../lib/stackinit_kunit.c: In function 'do_nothing_u16_zero':../lib/stackinit_kunit.c:51:49: error: array subscript 1 is outside array bounds of 'u16[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds=]
51 | #define DO_NOTHING_RETURN_SCALAR(ptr) *(ptr)
| ^~~~~~
../lib/stackinit_kunit.c:219:24: note: in expansion of macro 'DO_NOTHING_RETURN_SCALAR'
219 | return DO_NOTHING_RETURN_ ## which(ptr + 1); \
| ^~~~~~~~~~~~~~~~~~--- lib/test_stackinit.c | 1 + 1 file changed, 1 insertion(+)
lib/test_stackinit.c +1 -0
@@ -259,6 +259,7 @@ static noinline __init int test_ ## name (void) \ static noinline __init DO_NOTHING_TYPE_ ## which(var_type) \ do_nothing_ ## name(var_type *ptr) \ { \ + OPTIMIZER_HIDE_VAR(ptr); \ /* Will always be true, but compiler doesn't know. */ \if ((unsigned long )ptr >0x2 ) \ return DO_NOTHING_RETURN_ ## which(ptr); \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 96/168 ksmbd: fix racy issue from session lookup and expire
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit b95629435b84b9ecc0c765995204a4d8a913ed52 ]
Increment the session reference count within the lock for lookup to avoid racy issue with session expire.
--- fs/ksmbd/auth.c | 2 ++ fs/ksmbd/mgmt/user_session.c | 6 +++++- fs/ksmbd/server.c | 4 ++-- fs/ksmbd/smb2pdu.c | 27 ++++++++++++++------------- 4 files changed, 23 insertions(+), 16 deletions(-)
fs/ksmbd/auth.c +2 -0
@@ -1010,6 +1010,8 @@ static int ksmbd_get_encryption_key(struct ksmbd_work *work, __u64 ses_id, ses_enc_key = enc ? sess->smb3encryptionkey : sess->smb3decryptionkey; +if (enc) +ksmbd_user_session_get (sess);memcpy (key, ses_enc_key,SMB3_ENC_DEC_KEY_SIZE );return 0 ;
fs/ksmbd/mgmt/user_session.c +5 -1
@@ -257,8 +257,10 @@ struct ksmbd_session *ksmbd_session_lookup(struct ksmbd_conn *conn,down_read (&conn->session_lock); sess =xa_load (&conn->sessions, id); -if (sess) +if (sess) { sess->last_active = jiffies; +ksmbd_user_session_get (sess); + }up_read (&conn->session_lock);return sess; }
@@ -269,6 +271,8 @@ struct ksmbd_session *ksmbd_session_lookup_slowpath(unsigned long long id)down_read (&sessions_table_lock); sess =__session_lookup (id); +if (sess) +ksmbd_user_session_get (sess);up_read (&sessions_table_lock);return sess;
fs/ksmbd/server.c +2 -2
@@ -241,14 +241,14 @@ static void __handle_ksmbd_work(struct ksmbd_work *work,if (work->tcon)ksmbd_tree_connect_put (work->tcon);smb3_preauth_hash_rsp (work); -if (work->sess) -ksmbd_user_session_put (work->sess);if (work->sess && work->sess->enc && work->encrypted && conn->ops->encrypt_resp) { rc = conn->ops->encrypt_resp (work);if (rc <0 ) conn->ops->set_rsp_status (work,STATUS_DATA_ERROR ); } +if (work->sess) +ksmbd_user_session_put (work->sess);ksmbd_conn_write (work); }
fs/ksmbd/smb2pdu.c +14 -13
@@ -67,8 +67,10 @@ static inline bool check_session_id(struct ksmbd_conn *conn, u64 id)return false; sess =ksmbd_session_lookup_all (conn, id); -if (sess) +if (sess) { +ksmbd_user_session_put (sess);return true; + }pr_err ("Invalid user session id: %llu\n" , id);return false; }
@@ -606,10 +608,8 @@ int smb2_check_user_session(struct ksmbd_work *work)/* Check for validity of user session */ work->sess =ksmbd_session_lookup_all (conn, sess_id); -if (work->sess) { -ksmbd_user_session_get (work->sess); +if (work->sess)return 1 ; - }ksmbd_debug (SMB ,"Invalid user session, Uid %llu\n" , sess_id);return -ENOENT ; }
@@ -1722,29 +1722,35 @@ int smb2_sess_setup(struct ksmbd_work *work)if (conn->dialect != sess->dialect) { rc = -EINVAL ; +ksmbd_user_session_put (sess); goto out_err; }if (!(req->hdr.Flags &SMB2_FLAGS_SIGNED )) { rc = -EINVAL ; +ksmbd_user_session_put (sess); goto out_err; }if (strncmp (conn->ClientGUID, sess->ClientGUID,SMB2_CLIENT_GUID_SIZE )) { rc = -ENOENT ; +ksmbd_user_session_put (sess); goto out_err; }if (sess->state ==SMB2_SESSION_IN_PROGRESS ) { rc = -EACCES ; +ksmbd_user_session_put (sess); goto out_err; }if (sess->state ==SMB2_SESSION_EXPIRED ) { rc = -EFAULT ; +ksmbd_user_session_put (sess); goto out_err; } +ksmbd_user_session_put (sess);if (ksmbd_conn_need_reconnect (conn)) { rc = -EFAULT ;
@@ -1752,7 +1758,8 @@ int smb2_sess_setup(struct ksmbd_work *work) goto out_err; } -if (ksmbd_session_lookup (conn, sess_id)) { + sess =ksmbd_session_lookup (conn, sess_id); +if (!sess) { rc = -EACCES ; goto out_err; }
@@ -1763,7 +1770,6 @@ int smb2_sess_setup(struct ksmbd_work *work) } conn->binding = true; -ksmbd_user_session_get (sess); }else if ((conn->dialect <SMB30_PROT_ID || server_conf.flags &KSMBD_GLOBAL_FLAG_SMB3_MULTICHANNEL ) && (req->Flags &SMB2_SESSION_REQ_FLAG_BINDING )) {
@@ -1790,7 +1796,6 @@ int smb2_sess_setup(struct ksmbd_work *work) } conn->binding = false; -ksmbd_user_session_get (sess); } work->sess = sess;
@@ -2202,9 +2207,9 @@ int smb2_tree_disconnect(struct ksmbd_work *work)int smb2_session_logoff (struct ksmbd_work *work) {struct ksmbd_conn *conn = work->conn; +struct ksmbd_session *sess = work->sess;struct smb2_logoff_req *req;struct smb2_logoff_rsp *rsp; -struct ksmbd_session *sess;u64 sess_id;int err;
@@ -2226,11 +2231,6 @@ int smb2_session_logoff(struct ksmbd_work *work)ksmbd_close_session_fds (work);ksmbd_conn_wait_idle (conn, sess_id); -/* -* Re-lookup session to validate if session is deleted -* while waiting request complete -*/ - sess =ksmbd_session_lookup_all (conn, sess_id);if (ksmbd_tree_conn_session_logoff (sess)) {ksmbd_debug (SMB ,"Invalid tid %d\n" , req->hdr.Id.SyncId.TreeId); rsp->hdr.Status =STATUS_NETWORK_NAME_DELETED ;
@@ -8660,6 +8660,7 @@ int smb3_decrypt_req(struct ksmbd_work *work) le64_to_cpu(tr_hdr->SessionId));return -ECONNABORTED ; } +ksmbd_user_session_put (sess); iov[0 ].iov_base = buf; iov[0 ].iov_len =sizeof (struct smb2_transform_hdr ) +4 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 97/168 riscv: Fix IPIs usage in kfence_protect_page()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Ghiti <[email protected]>
[ Upstream commit b3431a8bb336cece8adc452437befa7d4534b2fd ]
flush_tlb_kernel_range() may use IPIs to flush the TLBs of all the cores, which triggers the following warning when the irqs are disabled:
[ 3.455330] WARNING: CPU: 1 PID: 0 at kernel/smp.c:815 smp_call_function_many_cond+0x452/0x520 [ 3.456647] Modules linked in: [ 3.457218] CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Not tainted 6.12.0-rc7-00010-g91d3de7240b8 #1 [ 3.457416] Hardware name: QEMU QEMU Virtual Machine, BIOS [ 3.457633] epc : smp_call_function_many_cond+0x452/0x520 [ 3.457736] ra : on_each_cpu_cond_mask+0x1e/0x30 [ 3.457786] epc : ffffffff800b669a ra : ffffffff800b67c2 sp : ff2000000000bb50 [ 3.457824] gp : ffffffff815212b8 tp : ff6000008014f080 t0 : 000000000000003f [ 3.457859] t1 : ffffffff815221e0 t2 : 000000000000000f s0 : ff2000000000bc10 [ 3.457920] s1 : 0000000000000040 a0 : ffffffff815221e0 a1 : 0000000000000001 [ 3.457953] a2 : 0000000000010000 a3 : 0000000000000003 a4 : 0000000000000000 [ 3.458006] a5 : 0000000000000000 a6 : ffffffffffffffff a7 : 0000000000000000 [ 3.458042] s2 : ffffffff815223be s3 : 00fffffffffff000 s4 : ff600001ffe38fc0 [ 3.458076] s5 : ff600001ff950d00 s6 : 0000000200000120 s7 : 0000000000000001 [ 3.458109] s8 : 0000000000000001 s9 : ff60000080841ef0 s10: 0000000000000001 [ 3.458141] s11: ffffffff81524812 t3 : 0000000000000001 t4 : ff60000080092bc0 [ 3.458172] t5 : 0000000000000000 t6 : ff200000000236d0 [ 3.458203] status: 0000000200000100 badaddr: ffffffff800b669a cause: 0000000000000003 [ 3.458373] [<ffffffff800b669a>] smp_call_function_many_cond+0x452/0x520 [ 3.458593] [<ffffffff800b67c2>] on_each_cpu_cond_mask+0x1e/0x30 [ 3.458625] [<ffffffff8000e4ca>] __flush_tlb_range+0x118/0x1ca [ 3.458656] [<ffffffff8000e6b2>] flush_tlb_kernel_range+0x1e/0x26 [ 3.458683] [<ffffffff801ea56a>] kfence_protect+0xc0/0xce [ 3.458717] [<ffffffff801e9456>] kfence_guarded_free+0xc6/0x1c0 [ 3.458742] [<ffffffff801e9d6c>] __kfence_free+0x62/0xc6 [ 3.458764] [<ffffffff801c57d8>] kfree+0x106/0x32c [ 3.458786] [<ffffffff80588cf2>] detach_buf_split+0x188/0x1a8 [ 3.458816] [<ffffffff8058708c>] virtqueue_get_buf_ctx+0xb6/0x1f6 [ 3.458839] [<ffffffff805871da>] virtqueue_get_buf+0xe/0x16 [ 3.458880] [<ffffffff80613d6a>] virtblk_done+0x5c/0xe2 [ 3.458908] [<ffffffff8058766e>] vring_interrupt+0x6a/0x74 [ 3.458930] [<ffffffff800747d8>] __handle_irq_event_percpu+0x7c/0xe2 [ 3.458956] [<ffffffff800748f0>] handle_irq_event+0x3c/0x86 [ 3.458978] [<ffffffff800786cc>] handle_simple_irq+0x9e/0xbe [ 3.459004] [<ffffffff80073934>] generic_handle_domain_irq+0x1c/0x2a [ 3.459027] [<ffffffff804bf87c>] imsic_handle_irq+0xba/0x120 [ 3.459056] [<ffffffff80073934>] generic_handle_domain_irq+0x1c/0x2a [ 3.459080] [<ffffffff804bdb76>] riscv_intc_aia_irq+0x24/0x34 [ 3.459103] [<ffffffff809d0452>] handle_riscv_irq+0x2e/0x4c [ 3.459133] [<ffffffff809d923e>] call_on_irq_stack+0x32/0x40
So only flush the local TLB and let the lazy kfence page fault handling deal with the faults which could happen when a core has an old protected pte version cached in its TLB. That leads to potential inaccuracies which can be tolerated when using kfence.
--- arch/riscv/include/asm/kfence.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/riscv/include/asm/kfence.h +3 -1
@@ -55,7 +55,9 @@ static inline bool kfence_protect_page(unsigned long addr, bool protect)else set_pte (pte,__pte (pte_val (*pte) | _PAGE_PRESENT)); -flush_tlb_kernel_range (addr, addr +PAGE_SIZE ); +preempt_disable (); +local_flush_tlb_kernel_range (addr, addr +PAGE_SIZE ); +preempt_enable ();return true; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 98/168 tracing: Constify string literal data member in struct trace_event_call
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Göttsche <[email protected]>
commit 452f4b31e3f70a52b97890888eeb9eaa9a87139a upstream.
The name member of the struct trace_event_call is assigned with generated string literals; declare them pointer to read-only.
Reported by clang:
security/landlock/syscalls.c:179:1: warning: initializing 'char *' with an expression of type 'const char[34]' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
179 | SYSCALL_DEFINE3(landlock_create_ruleset,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
180 | const struct landlock_ruleset_attr __user *const, attr,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
181 | const size_t, size, const __u32, flags)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/syscalls.h:226:36: note: expanded from macro 'SYSCALL_DEFINE3'
226 | #define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/syscalls.h:234:2: note: expanded from macro 'SYSCALL_DEFINEx'
234 | SYSCALL_METADATA(sname, x, __VA_ARGS__) \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/syscalls.h:184:2: note: expanded from macro 'SYSCALL_METADATA'
184 | SYSCALL_TRACE_ENTER_EVENT(sname); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/syscalls.h:151:30: note: expanded from macro 'SYSCALL_TRACE_ENTER_EVENT'
151 | .name = "sys_enter"#sname, \
| ^~~~~~~~~~~~~~~~~--- include/linux/trace_events.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/trace_events.h +1 -1
@@ -347,7 +347,7 @@ struct trace_event_call {struct list_head list;struct trace_event_class *class;union { -char *name; +const char *name;/* Set TRACE_EVENT_FL_TRACEPOINT flag when using "tp" */ struct tracepoint *tp; };
Greg Kroah-Hartman
maintainerPATCH 99/168 tracing: Prevent bad count for tracing_cpumask_write
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Xu <[email protected]>
commit 98feccbf32cfdde8c722bc4587aaa60ee5ac33f0 upstream.
If a large count is provided, it will trigger a warning in bitmap_parse_user. Also check zero for it.
--- kernel/trace/trace.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/trace/trace.c +3 -0
@@ -5250,6 +5250,9 @@ tracing_cpumask_write(struct file *filp,cpumask_var_t tracing_cpumask_new;int err; +if (count ==0 || count >KMALLOC_MAX_SIZE ) +return -EINVAL ; +if (!zalloc_cpumask_var (&tracing_cpumask_new,GFP_KERNEL ))return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 100/168 power: supply: gpio-charger: Fix set charge current limits
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dimitri Fedrau <[email protected]>
commit afc6e39e824ad0e44b2af50a97885caec8d213d1 upstream.
Fix set charge current limits for devices which allow to set the lowest charge current limit to be greater zero. If requested charge current limit is below lowest limit, the index equals current_limit_map_size which leads to accessing memory beyond allocated memory.
--- drivers/power/supply/gpio-charger.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/power/supply/gpio-charger.c +8 -0
@@ -67,6 +67,14 @@ static int set_charge_current_limit(struif (gpio_charger->current_limit_map[i].limit_ua <= val)break ; } + +/* +* If a valid charge current limit isn't found, default to smallest +* current limitation for safety reasons. +*/ +if (i >= gpio_charger->current_limit_map_size) + i = gpio_charger->current_limit_map_size -1 ; + mapping = gpio_charger->current_limit_map[i];for (i =0 ; i < ndescs; i++) {
Greg Kroah-Hartman
maintainerPATCH 101/168 btrfs: avoid monopolizing a core when activating a swap file
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 2c8507c63f5498d4ee4af404a8e44ceae4345056 upstream.
During swap activation we iterate over the extents of a file and we can have many thousands of them, so we can end up in a busy loop monopolizing a core. Avoid this by doing a voluntary reschedule after processing each extent.
--- fs/btrfs/inode.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/inode.c +2 -0
@@ -7698,6 +7698,8 @@ noinline int can_nocow_extent(struct ino ret = -EAGAIN ; goto out; } + +cond_resched (); }btrfs_release_path (path);
Greg Kroah-Hartman
maintainerPATCH 102/168 nfsd: cancel nfsd_shrinker_work using sync mode in nfs4_state_shutdown_net
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Erkun <[email protected]>
commit d5ff2fb2e7167e9483846e34148e60c0c016a1f6 upstream.
In the normal case, when we excute echo 0 > /proc/fs/nfsd/threads, the function nfs4_state_destroy_net in nfs4_state_shutdown_net will release all resources related to the hashed nfs4_client. If the nfsd_client_shrinker is running concurrently, the expire_client function will first unhash this client and then destroy it. This can lead to the following warning. Additionally, numerous use-after-free errors may occur as well.
nfsd_client_shrinker echo 0 > /proc/fs/nfsd/threads
expire_client nfsd_shutdown_net
unhash_client ...
nfs4_state_shutdown_net
/* won't wait shrinker exit */
/* cancel_work(&nn->nfsd_shrinker_work)
* nfsd_file for this /* won't destroy unhashed client1 */
* client1 still alive nfs4_state_destroy_net*/
nfsd_file_cache_shutdown
/* trigger warning */
kmem_cache_destroy(nfsd_file_slab)
kmem_cache_destroy(nfsd_file_mark_slab) /* release nfsd_file and mark */
__destroy_client
====================================================================
BUG nfsd_file (Not tainted): Objects remaining in nfsd_file on __kmem_cache_shutdown()
--------------------------------------------------------------------
CPU: 4 UID: 0 PID: 764 Comm: sh Not tainted 6.12.0-rc3+ #1 dump_stack_lvl+0x53/0x70 slab_err+0xb0/0xf0 __kmem_cache_shutdown+0x15c/0x310 kmem_cache_destroy+0x66/0x160 nfsd_file_cache_shutdown+0xac/0x210 [nfsd] nfsd_destroy_serv+0x251/0x2a0 [nfsd] nfsd_svc+0x125/0x1e0 [nfsd] write_threads+0x16a/0x2a0 [nfsd] nfsctl_transaction_write+0x74/0xa0 [nfsd] vfs_write+0x1a5/0x6d0 ksys_write+0xc1/0x160 do_syscall_64+0x5f/0x170 entry_SYSCALL_64_after_hwframe+0x76/0x7e
====================================================================
BUG nfsd_file_mark (Tainted: G B W ): Objects remainingnfsd_file_mark on __kmem_cache_shutdown()
--------------------------------------------------------------------
dump_stack_lvl+0x53/0x70 slab_err+0xb0/0xf0 __kmem_cache_shutdown+0x15c/0x310 kmem_cache_destroy+0x66/0x160 nfsd_file_cache_shutdown+0xc8/0x210 [nfsd] nfsd_destroy_serv+0x251/0x2a0 [nfsd] nfsd_svc+0x125/0x1e0 [nfsd] write_threads+0x16a/0x2a0 [nfsd] nfsctl_transaction_write+0x74/0xa0 [nfsd] vfs_write+0x1a5/0x6d0 ksys_write+0xc1/0x160 do_syscall_64+0x5f/0x170 entry_SYSCALL_64_after_hwframe+0x76/0x7e
To resolve this issue, cancel nfsd_shrinker_work using synchronous mode in nfs4_state_shutdown_net.
--- fs/nfsd/nfs4state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4state.c +1 -1
@@ -8211,7 +8211,7 @@ nfs4_state_shutdown_net(struct net *net)struct nfsd_net *nn =net_generic (net, nfsd_net_id);unregister_shrinker (&nn->nfsd_client_shrinker); -cancel_work (&nn->nfsd_shrinker_work); +cancel_work_sync (&nn->nfsd_shrinker_work);cancel_delayed_work_sync (&nn->laundromat_work);locks_end_grace (&nn->nfsd4_manager);
Greg Kroah-Hartman
maintainerPATCH 103/168 net: dsa: improve shutdown sequence
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Oltean <[email protected]>
commit 6c24a03a61a245fe34d47582898331fa034b6ccd upstream.
Alexander Sverdlin presents 2 problems during shutdown with the lan9303 driver. One is specific to lan9303 and the other just happens to reproduce there.
The first problem is that lan9303 is unique among DSA drivers in that it calls dev_get_drvdata() at "arbitrary runtime" (not probe, not shutdown, not remove):
phy_state_machine()
-> ...
-> dsa_user_phy_read()
-> ds->ops->phy_read()
-> lan9303_phy_read()
-> chip->ops->phy_read()
-> lan9303_mdio_phy_read()
-> dev_get_drvdata()But we never stop the phy_state_machine(), so it may continue to run after dsa_switch_shutdown(). Our common pattern in all DSA drivers is to set drvdata to NULL to suppress the remove() method that may come afterwards. But in this case it will result in an NPD.
The second problem is that the way in which we set dp->conduit->dsa_ptr = NULL; is concurrent with receive packet processing. dsa_switch_rcv() checks once whether dev->dsa_ptr is NULL, but afterwards, rather than continuing to use that non-NULL value, dev->dsa_ptr is dereferenced again and again without NULL checks:dsa_conduit_find_user() and many other places. In between dereferences, there is no locking to ensure that what was valid once continues to be valid.
Both problems have the common aspect that closing the conduit interface solves them.
In the first case, dev_close(conduit) triggers the NETDEV_GOING_DOWN event in dsa_user_netdevice_event() which closes user ports as well. dsa_port_disable_rt() calls phylink_stop(), which synchronously stops the phylink state machine, and ds->ops->phy_read() will thus no longer call into the driver after this point.
In the second case, dev_close(conduit) should do this, as per Documentation/networking/driver.rst:
| Quiescence | ---------- | | After the ndo_stop routine has been called, the hardware must | not receive or transmit any data. All in flight packets must | be aborted. If necessary, poll or wait for completion of | any reset commands.
So it should be sufficient to ensure that later, when we zeroize conduit->dsa_ptr, there will be no concurrent dsa_switch_rcv() call on this conduit.
The addition of the netif_device_detach() function is to ensure that ioctls, rtnetlinks and ethtool requests on the user ports no longer propagate down to the driver - we're no longer prepared to handle them.
The race condition actually did not exist when commit 0650bf52b31f ("net: dsa: be compatible with masters which unregister on shutdown") first introduced dsa_switch_shutdown(). It was created later, when we stopped unregistering the user interfaces from a bad spot, and we just replaced that sequence with a racy zeroization of conduit->dsa_ptr (one which doesn't ensure that the interfaces aren't up).
--- net/dsa/dsa2.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/dsa/dsa2.c +7 -0
@@ -1656,6 +1656,7 @@ EXPORT_SYMBOL_GPL(dsa_unregister_switch)void dsa_switch_shutdown (struct dsa_switch *ds) {struct net_device *master, *slave_dev; +LIST_HEAD (close_list);struct dsa_port *dp;mutex_lock (&dsa2_mutex);
@@ -1665,6 +1666,11 @@ void dsa_switch_shutdown(struct dsa_switrtnl_lock (); +dsa_switch_for_each_cpu_port (dp, ds) +list_add (&dp->master->close_list, &close_list); + +dev_close_many (&close_list, true); +list_for_each_entry (dp, &ds->dst->ports, list) {if (dp->ds != ds)continue ;
@@ -1675,6 +1681,7 @@ void dsa_switch_shutdown(struct dsa_swit master = dp->cpu_dp->master; slave_dev = dp->slave; +netif_device_detach (slave_dev);netdev_upper_dev_unlink (master, slave_dev); }
Greg Kroah-Hartman
maintainerPATCH 104/168 x86/hyperv: Fix hv tsc page based sched_clock for hibernation
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naman Jain <[email protected]>
commit bcc80dec91ee745b3d66f3e48f0ec2efdea97149 upstream.
read_hv_sched_clock_tsc() assumes that the Hyper-V clock counter is bigger than the variable hv_sched_clock_offset, which is cached during early boot, but depending on the timing this assumption may be false when a hibernated VM starts again (the clock counter starts from 0 again) and is resuming back (Note: hv_init_tsc_clocksource() is not called during hibernation/resume); consequently, read_hv_sched_clock_tsc() may return a negative integer (which is interpreted as a huge positive integer since the return type is u64) and new kernel messages are prefixed with huge timestamps before read_hv_sched_clock_tsc() grows big enough (which typically takes several seconds).
Fix the issue by saving the Hyper-V clock counter just before the suspend, and using it to correct the hv_sched_clock_offset in resume. This makes hv tsc page based sched_clock continuous and ensures that post resume, it starts from where it left off during suspend. Override x86_platform.save_sched_clock_state and x86_platform.restore_sched_clock_state routines to correct this as soon as possible.
Note: if Invariant TSC is available, the issue doesn't happen because
1) we don't register read_hv_sched_clock_tsc() for sched clock:
See commit e5313f1c5404 ("clocksource/drivers/hyper-v: Rework clocksource and sched clock setup");
2) the common x86 code adjusts TSC similarly: see __restore_processor_state() -> tsc_verify_tsc_adjust(true) and x86_platform.restore_sched_clock_state().
Message-ID: <[email protected]>
--- arch/x86/kernel/cpu/mshyperv.c | 58 +++++++++++++++++++++++++++++++++++++ drivers/clocksource/hyperv_timer.c | 14 ++++++++ include/clocksource/hyperv_timer.h | 2 + 3 files changed, 73 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/mshyperv.c +58 -0
@@ -150,6 +150,63 @@ static void hv_machine_crash_shutdown(sthyperv_cleanup (); }#endif /* CONFIG_KEXEC_CORE */ + +static u64 hv_ref_counter_at_suspend; +static void (*old_save_sched_clock_state)(void ); +static void (*old_restore_sched_clock_state)(void ); + +/* +* Hyper-V clock counter resets during hibernation. Save and restore clock +* offset during suspend/resume, while also considering the time passed +* before suspend. This is to make sure that sched_clock using hv tsc page +* based clocksource, proceeds from where it left off during suspend and +* it shows correct time for the timestamps of kernel messages after resume. +*/ +static void save_hv_clock_tsc_state (void ) +{ + hv_ref_counter_at_suspend =hv_read_reference_counter (); +} + +static void restore_hv_clock_tsc_state (void ) +{ +/* +* Adjust the offsets used by hv tsc clocksource to +* account for the time spent before hibernation. +* adjusted value = reference counter (time) at suspend +* - reference counter (time) now. +*/ +hv_adj_sched_clock_offset (hv_ref_counter_at_suspend -hv_read_reference_counter ()); +} + +/* +* Functions to override save_sched_clock_state and restore_sched_clock_state +* functions of x86_platform. The Hyper-V clock counter is reset during +* suspend-resume and the offset used to measure time needs to be +* corrected, post resume. +*/ +static void hv_save_sched_clock_state (void ) +{ +old_save_sched_clock_state (); +save_hv_clock_tsc_state (); +} + +static void hv_restore_sched_clock_state (void ) +{ +restore_hv_clock_tsc_state (); +old_restore_sched_clock_state (); +} + +static void __init x86_setup_ops_for_tsc_pg_clock (void ) +{ +if (!(ms_hyperv.features &HV_MSR_REFERENCE_TSC_AVAILABLE )) +return ; + + old_save_sched_clock_state = x86_platform.save_sched_clock_state; + x86_platform.save_sched_clock_state = hv_save_sched_clock_state; + + old_restore_sched_clock_state = x86_platform.restore_sched_clock_state; + x86_platform.restore_sched_clock_state = hv_restore_sched_clock_state; +}#endif /* CONFIG_HYPERV */ static uint32_t __init ms_hyperv_platform (void )
@@ -438,6 +495,7 @@ static void __init ms_hyperv_init_platfo/* Register Hyper-V specific clocksource */ hv_init_clocksource (); +x86_setup_ops_for_tsc_pg_clock ();#endif /* * TSC should be marked as unstable only after Hyper-V
drivers/clocksource/hyperv_timer.c +13 -1
@@ -26,7 +26,8 @@#include <asm/mshyperv.h> static struct clock_event_device __percpu *hv_clock_event; -static u64 hv_sched_clock_offset__ro_after_init ; +/* Note: offset can hold negative values after hibernation. */ +static u64 hv_sched_clock_offset__read_mostly ;/* * If false, we're using the old mechanism for stimer0 interrupts
@@ -416,6 +417,17 @@ static void resume_hv_clock_tsc(struct chv_set_register (HV_REGISTER_REFERENCE_TSC , tsc_msr); } +/* +* Called during resume from hibernation, from overridden +* x86_platform.restore_sched_clock_state routine. This is to adjust offsets +* used to calculate time for hv tsc page based sched_clock, to account for +* time spent before hibernation. +*/ +void hv_adj_sched_clock_offset (u64 offset) +{ + hv_sched_clock_offset -= offset; +} +#ifdef HAVE_VDSO_CLOCKMODE_HVCLOCK static int hv_cs_enable (struct clocksource *cs) {
include/clocksource/hyperv_timer.h +2 -0
@@ -34,6 +34,8 @@ extern void hv_init_clocksource(void);extern struct ms_hyperv_tsc_page *hv_get_tsc_page (void ); +extern void hv_adj_sched_clock_offset (u64 offset); + static inline notrace u64hv_read_tsc_page_tsc (const struct ms_hyperv_tsc_page *tsc_pg,u64 *cur_tsc) {
Greg Kroah-Hartman
maintainerPATCH 105/168 selinux: ignore unknown extended permissions
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thiébaud Weksteen <[email protected]>
commit 900f83cf376bdaf798b6f5dcb2eae0c822e908b6 upstream.
When evaluating extended permissions, ignore unknown permissions instead of calling BUG(). This commit ensures that future permissions can be added without interfering with older kernels.
--- security/selinux/ss/services.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
security/selinux/ss/services.c +6 -2
@@ -971,7 +971,10 @@ void services_compute_xperms_decision(st xpermd->driver))return ; }else { -BUG (); +pr_warn_once ( +"SELinux: unknown extended permission (%u) will be ignored\n" , + node->datum.u.xperms->specified); +return ; }if (node->key.specified ==AVTAB_XPERMS_ALLOWED ) {
@@ -1008,7 +1011,8 @@ void services_compute_xperms_decision(st node->datum.u.xperms->perms.p[i]; } }else { -BUG (); +pr_warn_once ("SELinux: unknown specified key (%u)\n" , + node->key.specified); } }
Greg Kroah-Hartman
maintainerPATCH 106/168 tracing: Have process_string() also allow arrays
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit afc6717628f959941d7b33728570568b4af1c4b8 upstream.
In order to catch a common bug where a TRACE_EVENT() TP_fast_assign() assigns an address of an allocated string to the ring buffer and then references it in TP_printk(), which can be executed hours later when the string is free, the function test_event_printk() runs on all events as they are registered to make sure there's no unwanted dereferencing.
It calls process_string() to handle cases in TP_printk() format that has "%s". It returns whether or not the string is safe. But it can have some false positives.
For instance, xe_bo_move() has:
TP_printk("move_lacks_source:%s, migrate object %p [size %zu] from %s to %s device_id:%s",
__entry->move_lacks_source ? "yes" : "no", __entry->bo, __entry->size,
xe_mem_type_to_name[__entry->old_placement],
xe_mem_type_to_name[__entry->new_placement], __get_str(device_id))Where the "%s" references into xe_mem_type_to_name[]. This is an array of pointers that should be safe for the event to access. Instead of flagging this as a bad reference, if a reference points to an array, where the record field is the index, consider it safe.
--- kernel/trace/trace_events.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
kernel/trace/trace_events.c +12 -0
@@ -346,6 +346,18 @@ static bool process_string(const char *f }while (s < e);/* +* Check for arrays. If the argument has: foo[REC->val] +* then it is very likely that foo is an array of strings +* that are safe to use. +*/ + r =strstr (s,"[" ); +if (r && r < e) { + r =strstr (r,"REC->" ); +if (r && r < e) +return true; + } + +/* * If there's any strings in the argument consider this arg OK as it * could be: REC->field ? "foo" : "bar" and we don't want to get into * verifying that logic here.
Greg Kroah-Hartman
maintainerPATCH 107/168 thunderbolt: Add support for Intel Raptor Lake
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: George D Sworo <[email protected]>
[ Upstream commit 7ec58378a985618909ffae18e4ac0de2ae625f33 ]
Intel Raptor Lake has the same integrated Thunderbolt/USB4 controller as Intel Alder Lake. By default it is still using firmware based connection manager so we can use most of the Alder Lake flows.
Stable-dep-of: 8644b48714dc ("thunderbolt: Add support for Intel Panther Lake-M/P")
--- drivers/thunderbolt/icm.c | 2 ++ drivers/thunderbolt/nhi.c | 4 ++++ drivers/thunderbolt/nhi.h | 2 ++ 3 files changed, 8 insertions(+)
drivers/thunderbolt/icm.c +2 -0
@@ -2511,6 +2511,8 @@ struct tb *icm_probe(struct tb_nhi *nhi)case PCI_DEVICE_ID_INTEL_TGL_H_NHI1 :case PCI_DEVICE_ID_INTEL_ADL_NHI0 :case PCI_DEVICE_ID_INTEL_ADL_NHI1 : +case PCI_DEVICE_ID_INTEL_RPL_NHI0 : +case PCI_DEVICE_ID_INTEL_RPL_NHI1 : icm->is_supported = icm_tgl_is_supported; icm->driver_ready = icm_icl_driver_ready; icm->set_uuid = icm_icl_set_uuid;
drivers/thunderbolt/nhi.c +4 -0
@@ -1437,6 +1437,10 @@ static struct pci_device_id nhi_ids[] = { .driver_data = (kernel_ulong_t)&icl_nhi_ops }, { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADL_NHI1), .driver_data = (kernel_ulong_t)&icl_nhi_ops }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPL_NHI0), + .driver_data = (kernel_ulong_t)&icl_nhi_ops }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPL_NHI1), + .driver_data = (kernel_ulong_t)&icl_nhi_ops },/* Any USB4 compliant host */ { PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_USB4, ~0) },
drivers/thunderbolt/nhi.h +2 -0
@@ -81,6 +81,8 @@ extern const struct tb_nhi_ops icl_nhi_ops;#define PCI_DEVICE_ID_INTEL_TGL_NHI1 0x9a1d#define PCI_DEVICE_ID_INTEL_TGL_H_NHI0 0x9a1f#define PCI_DEVICE_ID_INTEL_TGL_H_NHI1 0x9a21 +#define PCI_DEVICE_ID_INTEL_RPL_NHI0 0xa73e +#define PCI_DEVICE_ID_INTEL_RPL_NHI1 0xa76d#define PCI_CLASS_SERIAL_USB_USB4 0x0c0340
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 108/168 thunderbolt: Add support for Intel Meteor Lake
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mika Westerberg <[email protected]>
[ Upstream commit 32249fd8c8cccd7a1ed86c3b6d9b6ae9b4a83623 ]
Intel Meteor Lake has the same integrated Thunderbolt/USB4 controller as Intel Alder Lake. Add the Intel Meteor Lake PCI IDs to the driver list of supported devices.
Stable-dep-of: 8644b48714dc ("thunderbolt: Add support for Intel Panther Lake-M/P")
--- drivers/thunderbolt/icm.c | 3 +++ drivers/thunderbolt/nhi.c | 6 ++++++ drivers/thunderbolt/nhi.h | 3 +++ 3 files changed, 12 insertions(+)
drivers/thunderbolt/icm.c +3 -0
@@ -2513,6 +2513,9 @@ struct tb *icm_probe(struct tb_nhi *nhi)case PCI_DEVICE_ID_INTEL_ADL_NHI1 :case PCI_DEVICE_ID_INTEL_RPL_NHI0 :case PCI_DEVICE_ID_INTEL_RPL_NHI1 : +case PCI_DEVICE_ID_INTEL_MTL_M_NHI0 : +case PCI_DEVICE_ID_INTEL_MTL_P_NHI0 : +case PCI_DEVICE_ID_INTEL_MTL_P_NHI1 : icm->is_supported = icm_tgl_is_supported; icm->driver_ready = icm_icl_driver_ready; icm->set_uuid = icm_icl_set_uuid;
drivers/thunderbolt/nhi.c +6 -0
@@ -1441,6 +1441,12 @@ static struct pci_device_id nhi_ids[] = { .driver_data = (kernel_ulong_t)&icl_nhi_ops }, { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPL_NHI1), .driver_data = (kernel_ulong_t)&icl_nhi_ops }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTL_M_NHI0), + .driver_data = (kernel_ulong_t)&icl_nhi_ops }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTL_P_NHI0), + .driver_data = (kernel_ulong_t)&icl_nhi_ops }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTL_P_NHI1), + .driver_data = (kernel_ulong_t)&icl_nhi_ops },/* Any USB4 compliant host */ { PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_USB4, ~0) },
drivers/thunderbolt/nhi.h +3 -0
@@ -75,6 +75,9 @@ extern const struct tb_nhi_ops icl_nhi_ops;#define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_BRIDGE 0x15ef#define PCI_DEVICE_ID_INTEL_ADL_NHI0 0x463e#define PCI_DEVICE_ID_INTEL_ADL_NHI1 0x466d +#define PCI_DEVICE_ID_INTEL_MTL_M_NHI0 0x7eb2 +#define PCI_DEVICE_ID_INTEL_MTL_P_NHI0 0x7ec2 +#define PCI_DEVICE_ID_INTEL_MTL_P_NHI1 0x7ec3#define PCI_DEVICE_ID_INTEL_ICL_NHI1 0x8a0d#define PCI_DEVICE_ID_INTEL_ICL_NHI0 0x8a17#define PCI_DEVICE_ID_INTEL_TGL_NHI0 0x9a1b
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 109/168 thunderbolt: Add Intel Barlow Ridge PCI ID
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mika Westerberg <[email protected]>
[ Upstream commit 6f14a210661ce03988ef4ed3c8402037c8e06539 ]
Intel Barlow Ridge is the first USB4 v2 controller from Intel. The controller exposes standard USB4 PCI class ID in typical configurations, however there is a way to configure it so that it uses a special class ID to allow using s different driver than the Windows inbox one. For this reason add the Barlow Ridge PCI ID to the Linux driver too so that the driver can attach regardless of the class ID.
Stable-dep-of: 8644b48714dc ("thunderbolt: Add support for Intel Panther Lake-M/P")
--- drivers/thunderbolt/nhi.c | 2 ++ drivers/thunderbolt/nhi.h | 2 ++ 2 files changed, 4 insertions(+)
drivers/thunderbolt/nhi.c +2 -0
@@ -1447,6 +1447,8 @@ static struct pci_device_id nhi_ids[] = { .driver_data = (kernel_ulong_t)&icl_nhi_ops }, { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTL_P_NHI1), .driver_data = (kernel_ulong_t)&icl_nhi_ops }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_80G_NHI) }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_40G_NHI) },/* Any USB4 compliant host */ { PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_USB4, ~0) },
drivers/thunderbolt/nhi.h +2 -0
@@ -75,6 +75,8 @@ extern const struct tb_nhi_ops icl_nhi_ops;#define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_BRIDGE 0x15ef#define PCI_DEVICE_ID_INTEL_ADL_NHI0 0x463e#define PCI_DEVICE_ID_INTEL_ADL_NHI1 0x466d +#define PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_80G_NHI 0x5781 +#define PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_40G_NHI 0x5784#define PCI_DEVICE_ID_INTEL_MTL_M_NHI0 0x7eb2#define PCI_DEVICE_ID_INTEL_MTL_P_NHI0 0x7ec2#define PCI_DEVICE_ID_INTEL_MTL_P_NHI1 0x7ec3
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 110/168 thunderbolt: Add support for Intel Lunar Lake
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mika Westerberg <[email protected]>
[ Upstream commit 2cd3da4e37453019e21a486d9de3144f46b4fdf7 ]
Intel Lunar Lake has similar integrated Thunderbolt/USB4 controller as Intel Meteor Lake with some small differences in the host router (it has 3 DP IN adapters for instance). Add the Intel Lunar Lake PCI IDs to the driver list of supported devices.
Stable-dep-of: 8644b48714dc ("thunderbolt: Add support for Intel Panther Lake-M/P")
--- drivers/thunderbolt/nhi.c | 4 ++++ drivers/thunderbolt/nhi.h | 2 ++ 2 files changed, 6 insertions(+)
drivers/thunderbolt/nhi.c +4 -0
@@ -1447,6 +1447,10 @@ static struct pci_device_id nhi_ids[] = { .driver_data = (kernel_ulong_t)&icl_nhi_ops }, { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTL_P_NHI1), .driver_data = (kernel_ulong_t)&icl_nhi_ops }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_LNL_NHI0), + .driver_data = (kernel_ulong_t)&icl_nhi_ops }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_LNL_NHI1), + .driver_data = (kernel_ulong_t)&icl_nhi_ops }, { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_80G_NHI) }, { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_40G_NHI) },
drivers/thunderbolt/nhi.h +2 -0
@@ -88,6 +88,8 @@ extern const struct tb_nhi_ops icl_nhi_ops;#define PCI_DEVICE_ID_INTEL_TGL_H_NHI1 0x9a21#define PCI_DEVICE_ID_INTEL_RPL_NHI0 0xa73e#define PCI_DEVICE_ID_INTEL_RPL_NHI1 0xa76d +#define PCI_DEVICE_ID_INTEL_LNL_NHI0 0xa833 +#define PCI_DEVICE_ID_INTEL_LNL_NHI1 0xa834#define PCI_CLASS_SERIAL_USB_USB4 0x0c0340
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 111/168 thunderbolt: Add support for Intel Panther Lake-M/P
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mika Westerberg <[email protected]>
[ Upstream commit 8644b48714dca8bf2f42a4ff8311de8efc9bd8c3 ]
Intel Panther Lake-M/P has the same integrated Thunderbolt/USB4 controller as Lunar Lake. Add these PCI IDs to the driver list of supported devices.
--- drivers/thunderbolt/nhi.c | 8 ++++++++ drivers/thunderbolt/nhi.h | 4 ++++ 2 files changed, 12 insertions(+)
drivers/thunderbolt/nhi.c +8 -0
@@ -1451,6 +1451,14 @@ static struct pci_device_id nhi_ids[] = { .driver_data = (kernel_ulong_t)&icl_nhi_ops }, { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_LNL_NHI1), .driver_data = (kernel_ulong_t)&icl_nhi_ops }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_PTL_M_NHI0), + .driver_data = (kernel_ulong_t)&icl_nhi_ops }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_PTL_M_NHI1), + .driver_data = (kernel_ulong_t)&icl_nhi_ops }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_PTL_P_NHI0), + .driver_data = (kernel_ulong_t)&icl_nhi_ops }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_PTL_P_NHI1), + .driver_data = (kernel_ulong_t)&icl_nhi_ops }, { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_80G_NHI) }, { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_40G_NHI) },
drivers/thunderbolt/nhi.h +4 -0
@@ -90,6 +90,10 @@ extern const struct tb_nhi_ops icl_nhi_ops;#define PCI_DEVICE_ID_INTEL_RPL_NHI1 0xa76d#define PCI_DEVICE_ID_INTEL_LNL_NHI0 0xa833#define PCI_DEVICE_ID_INTEL_LNL_NHI1 0xa834 +#define PCI_DEVICE_ID_INTEL_PTL_M_NHI0 0xe333 +#define PCI_DEVICE_ID_INTEL_PTL_M_NHI1 0xe334 +#define PCI_DEVICE_ID_INTEL_PTL_P_NHI0 0xe433 +#define PCI_DEVICE_ID_INTEL_PTL_P_NHI1 0xe434#define PCI_CLASS_SERIAL_USB_USB4 0x0c0340
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 112/168 xhci: retry Stop Endpoint on buggy NEC controllers
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pecio <[email protected]>
[ Upstream commit fd9d55d190c0e5fefd3a9165ea361809427885a1 ]
Two NEC uPD720200 adapters have been observed to randomly misbehave:
a Stop Endpoint command fails with Context Error, the Output Context indicates Stopped state, and the endpoint keeps running. Very often, Set TR Dequeue Pointer is seen to fail next with Context Error too, in addition to problems from unexpectedly completed cancelled work.
The pathology is common on fast running isoc endpoints like uvcvideo, but has also been reproduced on a full-speed bulk endpoint of pl2303. It seems all EPs are affected, with risk proportional to their load.
Reproduction involves receiving any kind of stream and closing it to make the device driver cancel URBs already queued in advance.
Deal with it by retrying the command like in the Running state.
Stable-dep-of: e21ebe51af68 ("xhci: Turn NEC specific quirk for handling Stop Endpoint errors generic")
--- drivers/usb/host/xhci-ring.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/usb/host/xhci-ring.c +9 -0
@@ -1148,6 +1148,15 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id,break ;xhci_stop_watchdog_timer_in_irq (xhci, ep);return ; +case EP_STATE_STOPPED : +/* +* NEC uPD720200 sometimes sets this state and fails with +* Context Error while continuing to process TRBs. +* Be conservative and trust EP_CTX_STATE on other chips. +*/ +if (!(xhci->quirks &XHCI_NEC_HOST )) +break ; + fallthrough;case EP_STATE_RUNNING :/* Race, HW handled stop ep cmd before ep was running */ xhci_dbg (xhci,"Stop ep completion ctx error, ep is running\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 113/168 usb: xhci: Limit Stop Endpoint retries
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pecio <[email protected]>
[ Upstream commit 42b7581376015c1bbcbe5831f043cd0ac119d028 ]
Some host controllers fail to atomically transition an endpoint to the Running state on a doorbell ring and enter a hidden "Restarting" state, which looks very much like Stopped, with the important difference that it will spontaneously transition to Running anytime soon.
A Stop Endpoint command queued in the Restarting state typically fails with Context State Error and the completion handler sees the Endpoint Context State as either still Stopped or already Running. Even a case of Halted was observed, when an error occurred right after the restart.
The Halted state is already recovered from by resetting the endpoint. The Running state is handled by retrying Stop Endpoint.
The Stopped state was recognized as a problem on NEC controllers and worked around also by retrying, because the endpoint soon restarts and then stops for good. But there is a risk: the command may fail if the endpoint is "stopped for good" already, and retries will fail forever.
The possibility of this was not realized at the time, but a number of cases were discovered later and reproduced. Some proved difficult to deal with, and it is outright impossible to predict if an endpoint may fail to ever start at all due to a hardware bug. One such bug (albeit on ASM3142, not on NEC) was found to be reliably triggered simply by toggling an AX88179 NIC up/down in a tight loop for a few seconds.
An endless retries storm is quite nasty. Besides putting needless load on the xHC and CPU, it causes URBs never to be given back, paralyzing the device and connection/disconnection logic for the whole bus if the device is unplugged. User processes waiting for URBs become unkillable, drivers and kworker threads lock up and xhci_hcd cannot be reloaded.
For peace of mind, impose a timeout on Stop Endpoint retries in this case. If they don't succeed in 100ms, consider the endpoint stopped permanently for some reason and just give back the unlinked URBs. This failure case is rare already and work is under way to make it rarer.
Start this work today by also handling one simple case of race with Reset Endpoint, because it costs just two lines to implement.
Stable-dep-of: e21ebe51af68 ("xhci: Turn NEC specific quirk for handling Stop Endpoint errors generic")
--- drivers/usb/host/xhci-ring.c | 28 ++++++++++++++++++++++++---- drivers/usb/host/xhci.c | 2 ++ drivers/usb/host/xhci.h | 1 + 3 files changed, 27 insertions(+), 4 deletions(-)
drivers/usb/host/xhci-ring.c +24 -4
@@ -52,6 +52,7 @@* endpoint rings; it generates events on the event ring for these. */ +#include <linux/jiffies.h> #include <linux/scatterlist.h> #include <linux/slab.h> #include <linux/dma-mapping.h>
@@ -1150,16 +1151,35 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id,return ;case EP_STATE_STOPPED :/* -* NEC uPD720200 sometimes sets this state and fails with -* Context Error while continuing to process TRBs. -* Be conservative and trust EP_CTX_STATE on other chips. +* Per xHCI 4.6.9, Stop Endpoint command on a Stopped +* EP is a Context State Error, and EP stays Stopped. +* +* But maybe it failed on Halted, and somebody ran Reset +* Endpoint later. EP state is now Stopped and EP_HALTED +* still set because Reset EP handler will run after us. +*/ +if (ep->ep_state &EP_HALTED ) +break ; +/* +* On some HCs EP state remains Stopped for some tens of +* us to a few ms or more after a doorbell ring, and any +* new Stop Endpoint fails without aborting the restart. +* This handler may run quickly enough to still see this +* Stopped state, but it will soon change to Running. +* +* Assume this bug on unexpected Stop Endpoint failures. +* Keep retrying until the EP starts and stops again, on +* chips where this is known to help. Wait for 100ms. */ if (!(xhci->quirks &XHCI_NEC_HOST ))break ; +if (time_is_before_jiffies (ep->stop_time +msecs_to_jiffies (100 ))) +break ; fallthrough;case EP_STATE_RUNNING :/* Race, HW handled stop ep cmd before ep was running */ -xhci_dbg (xhci,"Stop ep completion ctx error, ep is running\n" ); +xhci_dbg (xhci,"Stop ep completion ctx error, ctx_state %d\n" , +GET_EP_CTX_STATE (ep_ctx)); command =xhci_alloc_command (xhci, false,GFP_ATOMIC );if (!command)
drivers/usb/host/xhci.c +2 -0
@@ -8,6 +8,7 @@* Some code borrowed from the Linux EHCI driver. */ +#include <linux/jiffies.h> #include <linux/pci.h> #include <linux/iommu.h> #include <linux/iopoll.h>
@@ -1891,6 +1892,7 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) ret = -ENOMEM ; goto done; } + ep->stop_time = jiffies; ep->ep_state |=EP_STOP_CMD_PENDING ; ep->stop_cmd_timer.expires = jiffies +XHCI_STOP_EP_CMD_TIMEOUT *HZ ;
drivers/usb/host/xhci.h +1 -0
@@ -717,6 +717,7 @@ struct xhci_virt_ep {/* Bandwidth checking storage */ struct xhci_bw_info bw_info;struct list_head bw_endpoint_list; +unsigned long stop_time;/* Isoch Frame ID checking storage */ int next_frame_id;/* Use new Isoch TRB layout needed for extended TBC support */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 114/168 xhci: Turn NEC specific quirk for handling Stop Endpoint errors generic
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
[ Upstream commit e21ebe51af688eb98fd6269240212a3c7300deea ]
xHC hosts from several vendors have the same issue where endpoints start so slowly that a later queued 'Stop Endpoint' command may complete before endpoint is up and running.
The 'Stop Endpoint' command fails with context state error as the endpoint still appears as stopped.
See commit 42b758137601 ("usb: xhci: Limit Stop Endpoint retries") for details
--- drivers/usb/host/xhci-ring.c | 2 -- 1 file changed, 2 deletions(-)
drivers/usb/host/xhci-ring.c +0 -2
@@ -1171,8 +1171,6 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id,* Keep retrying until the EP starts and stops again, on * chips where this is known to help. Wait for 100ms. */ -if (!(xhci->quirks &XHCI_NEC_HOST )) -break ;if (time_is_before_jiffies (ep->stop_time +msecs_to_jiffies (100 )))break ; fallthrough;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 115/168 drivers/block/zram/zram_drv.c: do not keep dangling zcomp pointer after zram reset
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Senozhatsky <[email protected]>
[ Upstream commit 6d2453c3dbc5f70eafc1c866289a90a1fc57ce18 ]
We do all reset operations under write lock, so we don't need to save ->disksize and ->comp to stack variables. Another thing is that ->comp is freed during zram reset, but comp pointer is not NULL-ed, so zram keeps the freed pointer value.
Stable-dep-of: 74363ec674cb ("zram: fix uninitialized ZRAM not releasing backing device")
--- drivers/block/zram/zram_drv.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/block/zram/zram_drv.c +4 -9
@@ -1695,9 +1695,6 @@ static int zram_rw_page(struct block_device *bdev, sector_t sector,static void zram_reset_device (struct zram *zram) { -struct zcomp *comp; -u64 disksize; -down_write (&zram->init_lock); zram->limit_pages =0 ;
@@ -1707,18 +1704,16 @@ static void zram_reset_device(struct zram *zram)return ; } - comp = zram->comp; - disksize = zram->disksize; - zram->disksize =0 ; -set_capacity_and_notify (zram->disk,0 );part_stat_set_all (zram->disk->part0,0 );up_write (&zram->init_lock);/* I/O operation under all of CPU are done so let's free */ -zram_meta_free (zram, disksize); +zram_meta_free (zram, zram->disksize); + zram->disksize =0 ;memset (&zram->stats,0 ,sizeof (zram->stats)); -zcomp_destroy (comp); +zcomp_destroy (zram->comp); + zram->comp =NULL ;reset_bdev (zram); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 116/168 zram: fix uninitialized ZRAM not releasing backing device
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kairui Song <[email protected]>
[ Upstream commit 74363ec674cb172d8856de25776c8f3103f05e2f ]
Setting backing device is done before ZRAM initialization. If we set the backing device, then remove the ZRAM module without initializing the device, the backing device reference will be leaked and the device will be hold forever.
Fix this by always reset the ZRAM fully on rmmod or reset store.
--- drivers/block/zram/zram_drv.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/block/zram/zram_drv.c +4 -5
@@ -1150,12 +1150,16 @@ static void zram_meta_free(struct zram *zram, u64 disksize)size_t num_pages = disksize >>PAGE_SHIFT ;size_t index; +if (!zram->table) +return ; +/* Free all pages that are still in this zram device */ for (index =0 ; index < num_pages; index++)zram_free_page (zram, index);zs_destroy_pool (zram->mem_pool);vfree (zram->table); + zram->table =NULL ; }static bool zram_meta_alloc (struct zram *zram,u64 disksize)
@@ -1699,11 +1703,6 @@ static void zram_reset_device(struct zram *zram) zram->limit_pages =0 ; -if (!init_done (zram)) { -up_write (&zram->init_lock); -return ; - } -set_capacity_and_notify (zram->disk,0 );part_stat_set_all (zram->disk->part0,0 );
Signature · 1 line
2.39.5
Re: [PATCH 5.15 116/168] zram: fix uninitialized ZRAM not releasing backing device
Quoted 15 lines · Greg Kroah-Hartman
5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kairui Song <[email protected]>
[ Upstream commit
74363ec674cb172d8856de25776c8f3103f05e2f]Setting backing device is done before ZRAM initialization. If we set the backing device, then remove the ZRAM module without initializing the device, the backing device reference will be leaked and the device will be hold forever.
Fix this by always reset the ZRAM fully on rmmod or reset store.
Quoted 9 lines
Fixes 013bf95a83ec ("zram: add interface to specif backing device")Signed-off-by Kairui Song <[email protected]>Reported-by Desheng Wu <[email protected]>Suggested-by Sergey Senozhatsky <[email protected]>Reviewed-by Sergey Senozhatsky <[email protected]>Cc <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Can we please drop this patch?
Greg Kroah-Hartman
maintainerRe: [PATCH 5.15 116/168] zram: fix uninitialized ZRAM not releasing backing device
Quoted 26 lines · Sergey Senozhatsky
Quoted 15 lines · Greg Kroah-Hartman
5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kairui Song <[email protected]>
[ Upstream commit
74363ec674cb172d8856de25776c8f3103f05e2f]Setting backing device is done before ZRAM initialization. If we set the backing device, then remove the ZRAM module without initializing the device, the backing device reference will be leaked and the device will be hold forever.
Fix this by always reset the ZRAM fully on rmmod or reset store.
Quoted 9 lines
Fixes 013bf95a83ec ("zram: add interface to specif backing device")Signed-off-by Kairui Song <[email protected]>Reported-by Desheng Wu <[email protected]>Suggested-by Sergey Senozhatsky <[email protected]>Reviewed-by Sergey Senozhatsky <[email protected]>Cc <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 2 lines
Can we please drop this patch?
Now dropped (also in 5.10.y)
Greg Kroah-Hartman
maintainerPATCH 117/168 RDMA/mlx5: Enforce same type port association for multiport RoCE
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Patrisious Haddad <[email protected]>
[ Upstream commit e05feab22fd7dabcd6d272c4e2401ec1acdfdb9b ]
Different core device types such as PFs and VFs shouldn't be affiliated together since they have different capabilities, fix that by enforcing type check before doing the affiliation.
--- drivers/infiniband/hw/mlx5/main.c | 6 ++++-- include/linux/mlx5/driver.h | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx5/main.c +4 -2
@@ -3284,7 +3284,8 @@ static int mlx5_ib_init_multiport_master(struct mlx5_ib_dev *dev)list_for_each_entry (mpi, &mlx5_ib_unaffiliated_port_list, list) {if (dev->sys_image_guid == mpi->sys_image_guid && - (mlx5_core_native_port_num (mpi->mdev) -1 ) == i) { + (mlx5_core_native_port_num (mpi->mdev) -1 ) == i && +mlx5_core_same_coredev_type (dev->mdev, mpi->mdev)) { bound =mlx5_ib_bind_slave_port (dev, mpi); }
@@ -4408,7 +4409,8 @@ static int mlx5r_mp_probe(struct auxiliary_device *adev,mutex_lock (&mlx5_ib_multiport_mutex);list_for_each_entry (dev, &mlx5_ib_dev_list, ib_dev_list) { -if (dev->sys_image_guid == mpi->sys_image_guid) +if (dev->sys_image_guid == mpi->sys_image_guid && +mlx5_core_same_coredev_type (dev->mdev, mpi->mdev)) bound =mlx5_ib_bind_slave_port (dev, mpi);if (bound) {
include/linux/mlx5/driver.h +6 -0
@@ -1182,6 +1182,12 @@ static inline bool mlx5_core_is_vf(const struct mlx5_core_dev *dev)return dev->coredev_type ==MLX5_COREDEV_VF ; } +static inline bool mlx5_core_same_coredev_type (const struct mlx5_core_dev *dev1, +const struct mlx5_core_dev *dev2) +{ +return dev1->coredev_type == dev2->coredev_type; +} +static inline bool mlx5_core_is_ecpf (const struct mlx5_core_dev *dev) {return dev->caps.embedded_cpu;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 118/168 RDMA/bnxt_re: Add check for path mtu in modify_qp
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Saravanan Vajravel <[email protected]>
[ Upstream commit 798653a0ee30d3cd495099282751c0f248614ae7 ]
When RDMA app configures path MTU, add a check in modify_qp verb to make sure that it doesn't go beyond interface MTU. If this check fails, driver will fail the modify_qp verb.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 26 +++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +14 -12
@@ -1935,18 +1935,20 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr, } } -if (qp_attr_mask &IB_QP_PATH_MTU ) { - qp->qplib_qp.modify_flags |= -CMDQ_MODIFY_QP_MODIFY_MASK_PATH_MTU ; - qp->qplib_qp.path_mtu =__from_ib_mtu (qp_attr->path_mtu); - qp->qplib_qp.mtu =ib_mtu_enum_to_int (qp_attr->path_mtu); - }else if (qp_attr->qp_state ==IB_QPS_RTR ) { - qp->qplib_qp.modify_flags |= -CMDQ_MODIFY_QP_MODIFY_MASK_PATH_MTU ; - qp->qplib_qp.path_mtu = -__from_ib_mtu (iboe_get_mtu (rdev->netdev->mtu)); - qp->qplib_qp.mtu = -ib_mtu_enum_to_int (iboe_get_mtu (rdev->netdev->mtu)); +if (qp_attr->qp_state ==IB_QPS_RTR ) { +enum ib_mtu qpmtu; + + qpmtu =iboe_get_mtu (rdev->netdev->mtu); +if (qp_attr_mask &IB_QP_PATH_MTU ) { +if (ib_mtu_enum_to_int (qp_attr->path_mtu) > +ib_mtu_enum_to_int (qpmtu)) +return -EINVAL ; + qpmtu = qp_attr->path_mtu; + } + + qp->qplib_qp.modify_flags |=CMDQ_MODIFY_QP_MODIFY_MASK_PATH_MTU ; + qp->qplib_qp.path_mtu =__from_ib_mtu (qpmtu); + qp->qplib_qp.mtu =ib_mtu_enum_to_int (qpmtu); }if (qp_attr_mask &IB_QP_TIMEOUT ) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 119/168 RDMA/bnxt_re: Fix reporting hw_ver in query_device
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kalesh AP <[email protected]>
[ Upstream commit 7179fe0074a3c962e43a9e51169304c4911989ed ]
Driver currently populates subsystem_device id in the "hw_ver" field of ib_attr structure in query_device.
Updated to populate PCI revision ID.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +1 -1
@@ -137,7 +137,7 @@ int bnxt_re_query_device(struct ib_device *ibdev, ib_attr->vendor_id = rdev->en_dev->pdev->vendor; ib_attr->vendor_part_id = rdev->en_dev->pdev->device; - ib_attr->hw_ver = rdev->en_dev->pdev->subsystem_device; + ib_attr->hw_ver = rdev->en_dev->pdev->revision; ib_attr->max_qp = dev_attr->max_qp; ib_attr->max_qp_wr = dev_attr->max_qp_wqes; ib_attr->device_cap_flags =
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 120/168 RDMA/bnxt_re: Fix max_qp_wrs reported
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvin Xavier <[email protected]>
[ Upstream commit 40be32303ec829ea12f9883e499bfd3fe9e52baf ]
While creating qps, driver adds one extra entry to the sq size passed by the ULPs in order to avoid queue full condition. When ULPs creates QPs with max_qp_wr reported, driver creates QP with 1 more than the max_wqes supported by HW. Create QP fails in this case. To avoid this error, reduce 1 entry in max_qp_wqes and report it to the stack.
--- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/bnxt_re/qplib_sp.c +1 -1
@@ -124,7 +124,7 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, attr->max_qp_init_rd_atom = sb->max_qp_init_rd_atom >BNXT_QPLIB_MAX_OUT_RD_ATOM ?BNXT_QPLIB_MAX_OUT_RD_ATOM : sb->max_qp_init_rd_atom; - attr->max_qp_wqes =le16_to_cpu (sb->max_qp_wr); + attr->max_qp_wqes =le16_to_cpu (sb->max_qp_wr) -1 ;/* * 128 WQEs needs to be reserved for the HW (8916). Prevent * reporting the max number
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 121/168 RDMA/bnxt_re: Fix the locking while accessing the QP table
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvin Xavier <[email protected]>
[ Upstream commit 9272cba0ded71b5a2084da3004ec7806b8cb7fd2 ]
QP table handling is synchronized with destroy QP and Async event from the HW. The same needs to be synchronized during create_qp also. Use the same lock in create_qp also.
--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/bnxt_re/qplib_fp.c +2 -0
@@ -1144,9 +1144,11 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) rq->dbinfo.db = qp->dpi->dbr; rq->dbinfo.max_slot =bnxt_qplib_set_rq_max_slot (rq->wqe_size); } +spin_lock_bh (&rcfw->tbl_lock); tbl_indx =map_qp_id_to_tbl_indx (qp->id, rcfw); rcfw->qp_tbl[tbl_indx].qp_id = qp->id; rcfw->qp_tbl[tbl_indx].qp_handle = (void *)qp; +spin_unlock_bh (&rcfw->tbl_lock);return 0 ; fail:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 122/168 drm/bridge: adv7511_audio: Update Audio InfoFrame properly
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Ekenberg <[email protected]>
[ Upstream commit 902806baf3c1e8383c1fe3ff0b6042b8cb5c2707 ]
AUDIO_UPDATE bit (Bit 5 of MAIN register 0x4A) needs to be set to 1 while updating Audio InfoFrame information and then set to 0 when done. Otherwise partially updated Audio InfoFrames could be sent out. Two cases where this rule were not followed are fixed:
- In adv7511_hdmi_hw_params() make sure AUDIO_UPDATE bit is updated before/after setting ADV7511_REG_AUDIO_INFOFRAME.
- In audio_startup() use the correct register for clearing AUDIO_UPDATE bit.
The problem with corrupted audio infoframes were discovered by letting a HDMI logic analyser check the output of ADV7535.
Note that this patchs replaces writing REG_GC(1) with REG_INFOFRAME_UPDATE. Bit 5 of REG_GC(1) is positioned within field GC_PP[3:0] and that field doesn't control audio infoframe and is read- only. My conclusion therefore was that the author if this code meant to clear bit 5 of REG_INFOFRAME_UPDATE from the very beginning.
--- drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/adv7511/adv7511_audio.c +12 -2
@@ -153,7 +153,16 @@ static int adv7511_hdmi_hw_params(struct device *dev, void *data, ADV7511_AUDIO_CFG3_LEN_MASK, len);regmap_update_bits (adv7511->regmap,ADV7511_REG_I2C_FREQ_ID_CFG ,ADV7511_I2C_FREQ_ID_CFG_RATE_MASK , rate <<4 ); -regmap_write (adv7511->regmap,0x73 ,0x1 ); + +/* send current Audio infoframe values while updating */ +regmap_update_bits (adv7511->regmap,ADV7511_REG_INFOFRAME_UPDATE , +BIT (5 ),BIT (5 )); + +regmap_write (adv7511->regmap,ADV7511_REG_AUDIO_INFOFRAME (0 ),0x1 ); + +/* use Audio infoframe updated info */ +regmap_update_bits (adv7511->regmap,ADV7511_REG_INFOFRAME_UPDATE , +BIT (5 ),0 );return 0 ; }
@@ -184,8 +193,9 @@ static int audio_startup(struct device *dev, void *data)regmap_update_bits (adv7511->regmap,ADV7511_REG_GC (0 ),BIT (7 ) |BIT (6 ),BIT (7 ));/* use Audio infoframe updated info */ -regmap_update_bits (adv7511->regmap,ADV7511_REG_GC (1 ), +regmap_update_bits (adv7511->regmap,ADV7511_REG_INFOFRAME_UPDATE ,BIT (5 ),0 ); +/* enable SPDIF receiver */ if (adv7511->audio_source ==ADV7511_AUDIO_SOURCE_SPDIF ) regmap_update_bits(adv7511->regmap, ADV7511_REG_AUDIO_CONFIG,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 123/168 RDMA/hns: Remove redundant attr_mask in modify_qp_init_to_init()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yixing Liu <[email protected]>
[ Upstream commit bb4874af19686019d0dafd58726ed7b4058663ca ]
The attr_mask variable is not used in the function, so remove it.
Stable-dep-of: 8673a6c2d9e4 ("RDMA/hns: Fix mapping error of zero-hop WQE buffer")
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +3 -6
@@ -4073,7 +4073,6 @@ static inline int get_pdn(struct ib_pd *ib_pd)static void modify_qp_reset_to_init (struct ib_qp *ibqp,const struct ib_qp_attr *attr, -int attr_mask,struct hns_roce_v2_qp_context *context,struct hns_roce_v2_qp_context *qpc_mask) {
@@ -4137,7 +4136,7 @@ static void modify_qp_reset_to_init(struct ib_qp *ibqp, }static void modify_qp_init_to_init (struct ib_qp *ibqp, -const struct ib_qp_attr *attr,int attr_mask, +const struct ib_qp_attr *attr,struct hns_roce_v2_qp_context *context,struct hns_roce_v2_qp_context *qpc_mask) {
@@ -4792,11 +4791,9 @@ static int hns_roce_v2_set_abs_fields(struct ib_qp *ibqp,if (cur_state ==IB_QPS_RESET && new_state ==IB_QPS_INIT ) {memset (qpc_mask,0 , hr_dev->caps.qpc_sz); -modify_qp_reset_to_init (ibqp, attr, attr_mask, context, - qpc_mask); +modify_qp_reset_to_init (ibqp, attr, context, qpc_mask); }else if (cur_state ==IB_QPS_INIT && new_state ==IB_QPS_INIT ) { -modify_qp_init_to_init (ibqp, attr, attr_mask, context, - qpc_mask); +modify_qp_init_to_init (ibqp, attr, context, qpc_mask); }else if (cur_state ==IB_QPS_INIT && new_state ==IB_QPS_RTR ) { ret =modify_qp_init_to_rtr (ibqp, attr, attr_mask, context, qpc_mask);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 124/168 RDMA/hns: Remove redundant bt_level for hem_list_alloc_item()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yunsheng Lin <[email protected]>
[ Upstream commit be1eeb667eb748391b1c8158678fe4d892187793 ]
The 'bt_level' parameter is not used in hem_list_alloc_item(), so remove it.
Stable-dep-of: 8673a6c2d9e4 ("RDMA/hns: Fix mapping error of zero-hop WQE buffer")
--- drivers/infiniband/hw/hns/hns_roce_hem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hem.c +4 -4
@@ -988,7 +988,7 @@ struct hns_roce_hem_head {static struct hns_roce_hem_item *hem_list_alloc_item (struct hns_roce_dev *hr_dev,int start,int end,int count, -bool exist_bt,int bt_level) +bool exist_bt) {struct hns_roce_hem_item *hem;
@@ -1199,7 +1199,7 @@ static int hem_list_alloc_mid_bt(struct hns_roce_dev *hr_dev, start_aligned = (distance / step) * step + r->offset; end =min_t (u64, start_aligned + step -1 , max_ofs); cur =hem_list_alloc_item (hr_dev, start_aligned, end, unit, - true, level); + true);if (!cur) { ret = -ENOMEM ; goto err_exit;
@@ -1251,7 +1251,7 @@ alloc_root_hem(struct hns_roce_dev *hr_dev, int unit, int *max_ba_num,/* indicate to last region */ r = ®ions[region_cnt -1 ]; hem =hem_list_alloc_item (hr_dev, offset, r->offset + r->count -1 , - ba_num, true,0 ); + ba_num, true);if (!hem)return ERR_PTR (-ENOMEM );
@@ -1268,7 +1268,7 @@ static int alloc_fake_root_bt(struct hns_roce_dev *hr_dev, void *cpu_base,struct hns_roce_hem_item *hem; hem =hem_list_alloc_item (hr_dev, r->offset, r->offset + r->count -1 , - r->count, false,0 ); + r->count, false);if (!hem)return -ENOMEM ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 125/168 RDMA/hns: Fix mapping error of zero-hop WQE buffer
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: wenglianfa <[email protected]>
[ Upstream commit 8673a6c2d9e483dfeeef83a1f06f59e05636f4d1 ]
Due to HW limitation, the three region of WQE buffer must be mapped and set to HW in a fixed order: SQ buffer, SGE buffer, and RQ buffer.
Currently when one region is zero-hop while the other two are not, the zero-hop region will not be mapped. This violate the limitation above and leads to address error.
--- drivers/infiniband/hw/hns/hns_roce_hem.c | 43 ++++++++++++++++-------- drivers/infiniband/hw/hns/hns_roce_mr.c | 5 --- 2 files changed, 29 insertions(+), 19 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hem.c +29 -14
@@ -977,6 +977,7 @@ struct hns_roce_hem_item {size_t count;/* max ba numbers */ int start;/* start buf offset in this hem */ int end;/* end buf offset in this hem */ +bool exist_bt; };/* All HEM items are linked in a tree structure */
@@ -1005,6 +1006,7 @@ hem_list_alloc_item(struct hns_roce_dev *hr_dev, int start, int end, int count, } } + hem->exist_bt = exist_bt; hem->count = count; hem->start = start; hem->end = end;
@@ -1015,22 +1017,22 @@ hem_list_alloc_item(struct hns_roce_dev *hr_dev, int start, int end, int count, }static void hem_list_free_item (struct hns_roce_dev *hr_dev, -struct hns_roce_hem_item *hem,bool exist_bt) +struct hns_roce_hem_item *hem) { -if (exist_bt) +if (hem->exist_bt)dma_free_coherent (hr_dev->dev, hem->count *BA_BYTE_LEN , hem->addr, hem->dma_addr);kfree (hem); }static void hem_list_free_all (struct hns_roce_dev *hr_dev, -struct list_head *head,bool exist_bt) +struct list_head *head) {struct hns_roce_hem_item *hem, *temp_hem;list_for_each_entry_safe (hem, temp_hem, head, list) {list_del (&hem->list); -hem_list_free_item (hr_dev, hem, exist_bt); +hem_list_free_item (hr_dev, hem); } }
@@ -1132,6 +1134,10 @@ int hns_roce_hem_list_calc_root_ba(const struct hns_roce_buf_region *regions,for (i =0 ; i < region_cnt; i++) { r = (struct hns_roce_buf_region *)®ions[i]; +/* when r->hopnum = 0, the region should not occupy root_ba. */ +if (!r->hopnum) +continue ; +if (r->hopnum >1 ) { step =hem_list_calc_ba_range (r->hopnum,1 , unit);if (step >0 )
@@ -1226,7 +1232,7 @@ static int hem_list_alloc_mid_bt(struct hns_roce_dev *hr_dev, err_exit:for (level =1 ; level < hopnum; level++) -hem_list_free_all (hr_dev, &temp_list[level], true); +hem_list_free_all (hr_dev, &temp_list[level]);return ret; }
@@ -1267,16 +1273,26 @@ static int alloc_fake_root_bt(struct hns_roce_dev *hr_dev, void *cpu_base, {struct hns_roce_hem_item *hem; +/* This is on the has_mtt branch, if r->hopnum +* is 0, there is no root_ba to reuse for the +* region's fake hem, so a dma_alloc request is +* necessary here. +*/ hem =hem_list_alloc_item (hr_dev, r->offset, r->offset + r->count -1 , - r->count, false); + r->count, !r->hopnum);if (!hem)return -ENOMEM ; -hem_list_assign_bt (hr_dev, hem, cpu_base, phy_base); +/* The root_ba can be reused only when r->hopnum > 0. */ +if (r->hopnum) +hem_list_assign_bt (hr_dev, hem, cpu_base, phy_base);list_add (&hem->list, branch_head);list_add (&hem->sibling, leaf_head); -return r->count; +/* If r->hopnum == 0, 0 is returned, +* so that the root_bt entry is not occupied. +*/ +return r->hopnum ? r->count :0 ; } static int setup_middle_bt(struct hns_roce_dev *hr_dev, void *cpu_base,
@@ -1320,7 +1336,7 @@ setup_root_hem(struct hns_roce_dev *hr_dev, struct hns_roce_hem_list *hem_list,return -ENOMEM ; total =0 ; -for (i =0 ; i < region_cnt && total < max_ba_num; i++) { +for (i =0 ; i < region_cnt && total <= max_ba_num; i++) { r = ®ions[i];if (!r->count)continue ;
@@ -1386,9 +1402,9 @@ static int hem_list_alloc_root_bt(struct hns_roce_dev *hr_dev, region_cnt);if (ret) {for (i =0 ; i < region_cnt; i++) -hem_list_free_all (hr_dev, &head.branch[i], false); +hem_list_free_all (hr_dev, &head.branch[i]); -hem_list_free_all (hr_dev, &head.root, true); +hem_list_free_all (hr_dev, &head.root); }return ret;
@@ -1451,10 +1467,9 @@ void hns_roce_hem_list_release(struct hns_roce_dev *hr_dev,for (i =0 ; i <HNS_ROCE_MAX_BT_REGION ; i++)for (j =0 ; j <HNS_ROCE_MAX_BT_LEVEL ; j++) -hem_list_free_all (hr_dev, &hem_list->mid_bt[i][j], - j !=0 ); +hem_list_free_all (hr_dev, &hem_list->mid_bt[i][j]); -hem_list_free_all (hr_dev, &hem_list->root_bt, true); +hem_list_free_all (hr_dev, &hem_list->root_bt);INIT_LIST_HEAD (&hem_list->btm_bt); hem_list->root_ba =0 ; }
drivers/infiniband/hw/hns/hns_roce_mr.c +0 -5
@@ -793,11 +793,6 @@ int hns_roce_mtr_map(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr,for (i =0 , mapped_cnt =0 ; i < mtr->hem_cfg.region_count && mapped_cnt < page_cnt; i++) { r = &mtr->hem_cfg.region[i]; -/* if hopnum is 0, no need to map pages in this region */ -if (!r->hopnum) { - mapped_cnt += r->count; -continue ; - }if (r->offset + r->count > page_cnt) { ret = -EINVAL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 126/168 RDMA/hns: Fix warning storm caused by invalid input in IO path
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit fa5c4ba8cdbfd2c2d6422e001311c8213283ebbf ]
WARN_ON() is called in the IO path. And it could lead to a warning storm. Use WARN_ON_ONCE() instead of WARN_ON().
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +2 -2
@@ -459,7 +459,7 @@ static inline int set_ud_wqe(struct hns_roce_qp *qp, valid_num_sge =calc_wr_sge_num (wr, &msg_len); ret =set_ud_opcode (ud_sq_wqe, wr); -if (WARN_ON (ret)) +if (WARN_ON_ONCE (ret))return ret; ud_sq_wqe->msg_len =cpu_to_le32 (msg_len);
@@ -563,7 +563,7 @@ static inline int set_rc_wqe(struct hns_roce_qp *qp, rc_sq_wqe->msg_len =cpu_to_le32 (msg_len); ret =set_rc_opcode (hr_dev, rc_sq_wqe, wr); -if (WARN_ON (ret)) +if (WARN_ON_ONCE (ret))return ret; hr_reg_write(rc_sq_wqe, RC_SEND_WQE_SO,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 127/168 RDMA/hns: Fix missing flush CQE for DWQE
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit e3debdd48423d3d75b9d366399228d7225d902cd ]
Flush CQE handler has not been called if QP state gets into errored mode in DWQE path. So, the new added outstanding WQEs will never be flushed.
It leads to a hung task timeout when using NFS over RDMA:
__switch_to+0x7c/0xd0
__schedule+0x350/0x750
schedule+0x50/0xf0
schedule_timeout+0x2c8/0x340
wait_for_common+0xf4/0x2b0
wait_for_completion+0x20/0x40
__ib_drain_sq+0x140/0x1d0 [ib_core]
ib_drain_sq+0x98/0xb0 [ib_core]
rpcrdma_xprt_disconnect+0x68/0x270 [rpcrdma]
xprt_rdma_close+0x20/0x60 [rpcrdma]
xprt_autoclose+0x64/0x1cc [sunrpc]
process_one_work+0x1d8/0x4e0
worker_thread+0x154/0x420
kthread+0x108/0x150
ret_from_fork+0x10/0x18--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +4 -0
@@ -656,6 +656,10 @@ static void write_dwqe(struct hns_roce_dev *hr_dev, struct hns_roce_qp *qp,#define HNS_ROCE_SL_SHIFT 2struct hns_roce_v2_rc_send_wqe *rc_sq_wqe = wqe; +if (unlikely (qp->state ==IB_QPS_ERR )) { +flush_cqe (hr_dev, qp); +return ; + }/* All kinds of DirectWQE have the same header field layout */ hr_reg_enable (rc_sq_wqe,RC_SEND_WQE_FLAG );hr_reg_write (rc_sq_wqe,RC_SEND_WQE_DB_SL_L , qp->sl);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 128/168 net: stmmac: platform: provide devm_stmmac_probe_config_dt()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
[ Upstream commit d74065427374da6659a2d7fad4ec55c8926d43c4 ]
Provide a devres variant of stmmac_probe_config_dt() that allows users to skip calling stmmac_remove_config_dt() at driver detach.
Stable-dep-of: 2b6ffcd7873b ("net: stmmac: restructure the error path of stmmac_probe_config_dt()")
--- .../ethernet/stmicro/stmmac/stmmac_platform.c | 41 +++++++++++++++++++ .../ethernet/stmicro/stmmac/stmmac_platform.h | 2 + 2 files changed, 43 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +41 -0
@@ -8,6 +8,7 @@Author: Giuseppe Cavallaro <[email protected]> *******************************************************************************/ +#include <linux/device.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> #include <linux/module.h>
@@ -627,6 +628,39 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)return ret; } +static void devm_stmmac_remove_config_dt (void *data) +{ +struct plat_stmmacenet_data *plat = data; + +/* Platform data argument is unused */ +stmmac_remove_config_dt (NULL , plat); +} + +/** +* devm_stmmac_probe_config_dt +* @pdev: platform_device structure +* @mac: MAC address to use +* Description: Devres variant of stmmac_probe_config_dt(). Does not require +* the user to call stmmac_remove_config_dt() at driver detach. +*/ +struct plat_stmmacenet_data * +devm_stmmac_probe_config_dt (struct platform_device *pdev,u8 *mac) +{ +struct plat_stmmacenet_data *plat; +int ret; + + plat =stmmac_probe_config_dt (pdev, mac); +if (IS_ERR (plat)) +return plat; + + ret =devm_add_action_or_reset (&pdev->dev, + devm_stmmac_remove_config_dt, plat); +if (ret) +return ERR_PTR (ret); + +return plat; +} +/** * stmmac_remove_config_dt - undo the effects of stmmac_probe_config_dt() * @pdev: platform_device structure
@@ -649,12 +683,19 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)return ERR_PTR (-EINVAL ); } +struct plat_stmmacenet_data * +devm_stmmac_probe_config_dt (struct platform_device *pdev,u8 *mac) +{ +return ERR_PTR (-EINVAL ); +} +void stmmac_remove_config_dt (struct platform_device *pdev,struct plat_stmmacenet_data *plat) { }#endif /* CONFIG_OF */ EXPORT_SYMBOL_GPL (stmmac_probe_config_dt); +EXPORT_SYMBOL_GPL (devm_stmmac_probe_config_dt);EXPORT_SYMBOL_GPL (stmmac_remove_config_dt); int stmmac_get_platform_resources(struct platform_device *pdev,
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +2 -0
@@ -13,6 +13,8 @@struct plat_stmmacenet_data *stmmac_probe_config_dt (struct platform_device *pdev,u8 *mac); +struct plat_stmmacenet_data * +devm_stmmac_probe_config_dt (struct platform_device *pdev,u8 *mac);void stmmac_remove_config_dt (struct platform_device *pdev,struct plat_stmmacenet_data *plat);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 129/168 net: stmmac: dont create a MDIO bus if unnecessary
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Halaney <[email protected]>
[ Upstream commit f3c2caacee824ce4a331cdafb0b8dc8e987f105e ]
Currently a MDIO bus is created if the devicetree description is either:
1. Not fixed-link
2. fixed-link but contains a MDIO bus as well
The "1" case above isn't always accurate. If there's a phy-handle, it could be referencing a phy on another MDIO controller's bus[1]. In this case, where the MDIO bus is not described at all, currently stmmac will make a MDIO bus and scan its address space to discover phys (of which there are none). This process takes time scanning a bus that is known to be empty, delaying time to complete probe.
There are also a lot of upstream devicetrees[2] that expect a MDIO bus to be created, scanned for phys, and the first one found connected to the MAC. This case can be inferred from the platform description by not having a phy-handle && not being fixed-link. This hits case "1" in the current driver's logic, and must be handled in any logic change here since it is a valid legacy dt-binding.
Let's improve the logic to create a MDIO bus if either:
- Devicetree contains a MDIO bus
- !fixed-link && !phy-handle (legacy handling)
This way the case where no MDIO bus should be made is handled, as well as retaining backwards compatibility with the valid cases.
Below devicetree snippets can be found that explain some of the cases above more concretely.
Here's[0] a devicetree example where the MAC is both fixed-link and driving a switch on MDIO (case "2" above). This needs a MDIO bus to be created:
&fec1 {
phy-mode = "rmii";
fixed-link {
speed = <100>;
full-duplex;
};
mdio1: mdio {
switch0: switch0@0 {
compatible = "marvell,mv88e6190";
pinctrl-0 = <&pinctrl_gpio_switch0>;
};
};
};Here's[1] an example where there is no MDIO bus or fixed-link for the ethernet1 MAC, so no MDIO bus should be created since ethernet0 is the MDIO master for ethernet1's phy:
ðernet0 {
phy-mode = "sgmii";
phy-handle = <&sgmii_phy0>;
mdio {
compatible = "snps,dwmac-mdio";
sgmii_phy0: phy@8 {
compatible = "ethernet-phy-id0141.0dd4";
reg = <0x8>;
device_type = "ethernet-phy";
};
sgmii_phy1: phy@a {
compatible = "ethernet-phy-id0141.0dd4";
reg = <0xa>;
device_type = "ethernet-phy";
};
};
};
ðernet1 {
phy-mode = "sgmii";
phy-handle = <&sgmii_phy1>;
};Finally there's descriptions like this[2] which don't describe the MDIO bus but expect it to be created and the whole address space scanned for a phy since there's no phy-handle or fixed-link described:
&gmac {
phy-supply = <&vcc_lan>;
phy-mode = "rmii";
snps,reset-gpio = <&gpio3 RK_PB4 GPIO_ACTIVE_HIGH>;
snps,reset-active-low;
snps,reset-delays-us = <0 10000 1000000>;
};[0] https://elixir.bootlin.com/linux/v6.5-rc5/source/arch/arm/boot/dts/nxp/vf/vf610-zii-ssmb-dtu.dts
[1] https://elixir.bootlin.com/linux/v6.6-rc5/source/arch/arm64/boot/dts/qcom/sa8775p-ride.dts
[2] https://elixir.bootlin.com/linux/v6.6-rc5/source/arch/arm64/boot/dts/rockchip/rk3368-r88.dts#L164
Stable-dep-of: 2b6ffcd7873b ("net: stmmac: restructure the error path of stmmac_probe_config_dt()")
--- .../ethernet/stmicro/stmmac/stmmac_platform.c | 91 +++++++++++-------- 1 file changed, 54 insertions(+), 37 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +54 -37
@@ -294,62 +294,80 @@ static int stmmac_mtl_setup(struct platform_device *pdev, }/** -* stmmac_dt_phy - parse device-tree driver parameters to allocate PHY resources -* @plat: driver data platform structure -* @np: device tree node -* @dev: device pointer -* Description: -* The mdio bus will be allocated in case of a phy transceiver is on board; -* it will be NULL if the fixed-link is configured. -* If there is the "snps,dwmac-mdio" sub-node the mdio will be allocated -* in any case (for DSA, mdio must be registered even if fixed-link). -* The table below sums the supported configurations: -* ------------------------------- -* snps,phy-addr | Y -* ------------------------------- -* phy-handle | Y -* ------------------------------- -* fixed-link | N -* ------------------------------- -* snps,dwmac-mdio | -* even if | Y -* fixed-link | -* ------------------------------- +* stmmac_of_get_mdio() - Gets the MDIO bus from the devicetree. +* @np: devicetree node * -* It returns 0 in case of success otherwise -ENODEV. +* The MDIO bus will be searched for in the following ways: +* 1. The compatible is "snps,dwc-qos-ethernet-4.10" && a "mdio" named +* child node exists +* 2. A child node with the "snps,dwmac-mdio" compatible is present +* +* Return: The MDIO node if present otherwise NULL */ -static int stmmac_dt_phy (struct plat_stmmacenet_data *plat, -struct device_node *np,struct device *dev) +static struct device_node *stmmac_of_get_mdio (struct device_node *np) { -bool mdio = !of_phy_is_fixed_link (np);static const struct of_device_id need_mdio_ids[] = { { .compatible ="snps,dwc-qos-ethernet-4.10" }, {}, }; +struct device_node *mdio_node =NULL ;if (of_match_node (need_mdio_ids, np)) { - plat->mdio_node =of_get_child_by_name (np,"mdio" ); + mdio_node =of_get_child_by_name (np,"mdio" ); }else {/** * If snps,dwmac-mdio is passed from DT, always register * the MDIO */ -for_each_child_of_node (np, plat->mdio_node) { -if (of_device_is_compatible (plat->mdio_node, +for_each_child_of_node (np, mdio_node) { +if (of_device_is_compatible (mdio_node,"snps,dwmac-mdio" ))break ; } } -if (plat->mdio_node) { +return mdio_node; +} + +/** +* stmmac_mdio_setup() - Populate platform related MDIO structures. +* @plat: driver data platform structure +* @np: devicetree node +* @dev: device pointer +* +* This searches for MDIO information from the devicetree. +* If an MDIO node is found, it's assigned to plat->mdio_node and +* plat->mdio_bus_data is allocated. +* If no connection can be determined, just plat->mdio_bus_data is allocated +* to indicate a bus should be created and scanned for a phy. +* If it's determined there's no MDIO bus needed, both are left NULL. +* +* This expects that plat->phy_node has already been searched for. +* +* Return: 0 on success, errno otherwise. +*/ +static int stmmac_mdio_setup (struct plat_stmmacenet_data *plat, +struct device_node *np,struct device *dev) +{ +bool legacy_mdio; + + plat->mdio_node =stmmac_of_get_mdio (np); +if (plat->mdio_node)dev_dbg (dev,"Found MDIO subnode\n" ); - mdio = true; - } -if (mdio) { - plat->mdio_bus_data = -devm_kzalloc (dev,sizeof (struct stmmac_mdio_bus_data ), -GFP_KERNEL ); +/* Legacy devicetrees allowed for no MDIO bus description and expect +* the bus to be scanned for devices. If there's no phy or fixed-link +* described assume this is the case since there must be something +* connected to the MAC. +*/ + legacy_mdio = !of_phy_is_fixed_link (np) && !plat->phy_node; +if (legacy_mdio) +dev_info (dev,"Deprecated MDIO bus assumption used\n" ); + +if (plat->mdio_node || legacy_mdio) { + plat->mdio_bus_data =devm_kzalloc (dev, +sizeof (*plat->mdio_bus_data), +GFP_KERNEL );if (!plat->mdio_bus_data)return -ENOMEM ;
@@ -453,8 +471,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)if (of_property_read_u32 (np,"snps,phy-addr" , &plat->phy_addr) ==0 )dev_warn (&pdev->dev,"snps,phy-addr property is deprecated\n" ); -/* To Configure PHY by using all device-tree supported properties */ - rc =stmmac_dt_phy (plat, np, &pdev->dev); + rc =stmmac_mdio_setup (plat, np, &pdev->dev);if (rc)return ERR_PTR (rc);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 130/168 net: stmmac: restructure the error path of stmmac_probe_config_dt()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
[ Upstream commit 2b6ffcd7873b7e8a62c3e15a6f305bfc747c466b ]
Current implementation of stmmac_probe_config_dt() does not release the OF node reference obtained by of_parse_phandle() in some error paths. The problem is that some error paths call stmmac_remove_config_dt() to clean up but others use and unwind ladder. These two types of error handling have not kept in sync and have been a recurring source of bugs. Re-write the error handling in stmmac_probe_config_dt() to use an unwind ladder. Consequently, stmmac_remove_config_dt() is not needed anymore, thus remove it.
This bug was found by an experimental verification tool that I am developing.
--- .../ethernet/stmicro/stmmac/stmmac_platform.c | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +17 -10
@@ -472,8 +472,10 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)dev_warn (&pdev->dev,"snps,phy-addr property is deprecated\n" ); rc =stmmac_mdio_setup (plat, np, &pdev->dev); -if (rc) -return ERR_PTR (rc); +if (rc) { + ret =ERR_PTR (rc); + goto error_put_phy; + }of_property_read_u32 (np,"tx-fifo-depth" , &plat->tx_fifo_size);
@@ -559,8 +561,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) dma_cfg =devm_kzalloc (&pdev->dev,sizeof (*dma_cfg),GFP_KERNEL );if (!dma_cfg) { -stmmac_remove_config_dt (pdev, plat); -return ERR_PTR (-ENOMEM ); + ret =ERR_PTR (-ENOMEM ); + goto error_put_mdio; } plat->dma_cfg = dma_cfg;
@@ -588,8 +590,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) rc =stmmac_mtl_setup (pdev, plat);if (rc) { -stmmac_remove_config_dt (pdev, plat); -return ERR_PTR (rc); + ret =ERR_PTR (rc); + goto error_put_mdio; }/* clock setup */
@@ -641,6 +643,10 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)clk_disable_unprepare (plat->pclk); error_pclk_get:clk_disable_unprepare (plat->stmmac_clk); +error_put_mdio: +of_node_put (plat->mdio_node); +error_put_phy: +of_node_put (plat->phy_node);return ret; }
@@ -649,16 +655,17 @@ static void devm_stmmac_remove_config_dt(void *data) {struct plat_stmmacenet_data *plat = data; -/* Platform data argument is unused */ -stmmac_remove_config_dt (NULL , plat); +clk_disable_unprepare (plat->stmmac_clk); +clk_disable_unprepare (plat->pclk); +of_node_put (plat->mdio_node); +of_node_put (plat->phy_node); }/** * devm_stmmac_probe_config_dt * @pdev: platform_device structure * @mac: MAC address to use -* Description: Devres variant of stmmac_probe_config_dt(). Does not require -* the user to call stmmac_remove_config_dt() at driver detach. +* Description: Devres variant of stmmac_probe_config_dt(). */ struct plat_stmmacenet_data *devm_stmmac_probe_config_dt (struct platform_device *pdev,u8 *mac)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 131/168 net: fix memory leak in tcp_conn_request()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Liang <[email protected]>
[ Upstream commit 4f4aa4aa28142d53f8b06585c478476cfe325cfc ]
If inet_csk_reqsk_queue_hash_add() return false, tcp_conn_request() will return without free the dst memory, which allocated in af_ops->route_req.
Here is the kmemleak stack:
unreferenced object 0xffff8881198631c0 (size 240):
comm "softirq", pid 0, jiffies 4299266571 (age 1802.392s) hex dump (first 32 bytes):
00 10 9b 03 81 88 ff ff 80 98 da bc ff ff ff ff ................
81 55 18 bb ff ff ff ff 00 00 00 00 00 00 00 00 .U..............
backtrace:
[<ffffffffb93e8d4c>] kmem_cache_alloc+0x60c/0xa80
[<ffffffffba11b4c5>] dst_alloc+0x55/0x250
[<ffffffffba227bf6>] rt_dst_alloc+0x46/0x1d0
[<ffffffffba23050a>] __mkroute_output+0x29a/0xa50
[<ffffffffba23456b>] ip_route_output_key_hash+0x10b/0x240
[<ffffffffba2346bd>] ip_route_output_flow+0x1d/0x90
[<ffffffffba254855>] inet_csk_route_req+0x2c5/0x500
[<ffffffffba26b331>] tcp_conn_request+0x691/0x12c0
[<ffffffffba27bd08>] tcp_rcv_state_process+0x3c8/0x11b0
[<ffffffffba2965c6>] tcp_v4_do_rcv+0x156/0x3b0
[<ffffffffba299c98>] tcp_v4_rcv+0x1cf8/0x1d80
[<ffffffffba239656>] ip_protocol_deliver_rcu+0xf6/0x360
[<ffffffffba2399a6>] ip_local_deliver_finish+0xe6/0x1e0
[<ffffffffba239b8e>] ip_local_deliver+0xee/0x360
[<ffffffffba239ead>] ip_rcv+0xad/0x2f0
[<ffffffffba110943>] __netif_receive_skb_one_core+0x123/0x140Call dst_release() to free the dst memory when inet_csk_reqsk_queue_hash_add() return false in tcp_conn_request().
--- net/ipv4/tcp_input.c | 1 + 1 file changed, 1 insertion(+)
net/ipv4/tcp_input.c +1 -0
@@ -7059,6 +7059,7 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,if (unlikely (!inet_csk_reqsk_queue_hash_add (sk, req, req->timeout))) {reqsk_free (req); +dst_release (dst);return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 132/168 netrom: check buffer length before accessing it
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Shchipletsov <[email protected]>
[ Upstream commit a4fd163aed2edd967a244499754dec991d8b4c7d ]
Syzkaller reports an uninit value read from ax25cmp when sending raw message through ieee802154 implementation.
=====================================================
BUG: KMSAN: uninit-value in ax25cmp+0x3a5/0x460 net/ax25/ax25_addr.c:119 ax25cmp+0x3a5/0x460 net/ax25/ax25_addr.c:119 nr_dev_get+0x20e/0x450 net/netrom/nr_route.c:601 nr_route_frame+0x1a2/0xfc0 net/netrom/nr_route.c:774 nr_xmit+0x5a/0x1c0 net/netrom/nr_dev.c:144 __netdev_start_xmit include/linux/netdevice.h:4940 [inline] netdev_start_xmit include/linux/netdevice.h:4954 [inline] xmit_one net/core/dev.c:3548 [inline] dev_hard_start_xmit+0x247/0xa10 net/core/dev.c:3564 __dev_queue_xmit+0x33b8/0x5130 net/core/dev.c:4349 dev_queue_xmit include/linux/netdevice.h:3134 [inline] raw_sendmsg+0x654/0xc10 net/ieee802154/socket.c:299 ieee802154_sock_sendmsg+0x91/0xc0 net/ieee802154/socket.c:96 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] ____sys_sendmsg+0x9c2/0xd60 net/socket.c:2584 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2638 __sys_sendmsg net/socket.c:2667 [inline] __do_sys_sendmsg net/socket.c:2676 [inline] __se_sys_sendmsg net/socket.c:2674 [inline] __x64_sys_sendmsg+0x307/0x490 net/socket.c:2674 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b
Uninit was created at:
slab_post_alloc_hook+0x129/0xa70 mm/slab.h:768 slab_alloc_node mm/slub.c:3478 [inline] kmem_cache_alloc_node+0x5e9/0xb10 mm/slub.c:3523 kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:560 __alloc_skb+0x318/0x740 net/core/skbuff.c:651 alloc_skb include/linux/skbuff.h:1286 [inline] alloc_skb_with_frags+0xc8/0xbd0 net/core/skbuff.c:6334 sock_alloc_send_pskb+0xa80/0xbf0 net/core/sock.c:2780 sock_alloc_send_skb include/net/sock.h:1884 [inline] raw_sendmsg+0x36d/0xc10 net/ieee802154/socket.c:282 ieee802154_sock_sendmsg+0x91/0xc0 net/ieee802154/socket.c:96 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] ____sys_sendmsg+0x9c2/0xd60 net/socket.c:2584 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2638 __sys_sendmsg net/socket.c:2667 [inline] __do_sys_sendmsg net/socket.c:2676 [inline] __se_sys_sendmsg net/socket.c:2674 [inline] __x64_sys_sendmsg+0x307/0x490 net/socket.c:2674 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b CPU: 0 PID: 5037 Comm: syz-executor166 Not tainted 6.7.0-rc7-syzkaller-00003-gfbafc3e621c3 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 =====================================================
This issue occurs because the skb buffer is too small, and it's actual allocation is aligned. This hides an actual issue, which is that nr_route_frame does not validate the buffer size before using it.
Fix this issue by checking skb->len before accessing any fields in skb->data.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- net/netrom/nr_route.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/netrom/nr_route.c +6 -0
@@ -754,6 +754,12 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25)int ret;struct sk_buff *skbn; +/* +* Reject malformed packets early. Check that it contains at least 2 +* addresses and 1 byte more for Time-To-Live +*/ +if (skb->len <2 *sizeof (ax25_address) +1 ) +return 0 ; nr_src = (ax25_address *)(skb->data +0 ); nr_dest = (ax25_address *)(skb->data +7 );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 133/168 drm/i915/dg1: Fix power gate sequence.
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rodrigo Vivi <[email protected]>
[ Upstream commit 20e7c5313ffbf11c34a46395345677adbe890bee ]
sub-pipe PG is not present on DG1. Setting these bits can disable other power gates and cause GPU hangs on video playbacks.
VLK: 16314, 4304
--- drivers/gpu/drm/i915/gt/intel_rc6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/intel_rc6.c +1 -1
@@ -122,7 +122,7 @@ static void gen11_rc6_enable(struct intel_rc6 *rc6)GEN9_MEDIA_PG_ENABLE |GEN11_MEDIA_SAMPLER_PG_ENABLE ; -if (GRAPHICS_VER (gt->i915) >=12 ) { +if (GRAPHICS_VER (gt->i915) >=12 && !IS_DG1 (gt->i915)) {for (i =0 ; i <I915_MAX_VCS ; i++)if (HAS_ENGINE (gt,_VCS (i))) pg_enable |= (VDN_HCP_POWERGATE_ENABLE(i) |
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 134/168 netfilter: nft_set_hash: unaligned atomic read on struct nft_set_ext
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 542ed8145e6f9392e3d0a86a0e9027d2ffd183e4 ]
Access to genmask field in struct nft_set_ext results in unaligned atomic read:
[ 72.130109] Unable to handle kernel paging request at virtual address ffff0000c2bb708c [ 72.131036] Mem abort info: [ 72.131213] ESR = 0x0000000096000021 [ 72.131446] EC = 0x25: DABT (current EL), IL = 32 bits [ 72.132209] SET = 0, FnV = 0 [ 72.133216] EA = 0, S1PTW = 0 [ 72.134080] FSC = 0x21: alignment fault [ 72.135593] Data abort info: [ 72.137194] ISV = 0, ISS = 0x00000021, ISS2 = 0x00000000 [ 72.142351] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 [ 72.145989] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [ 72.150115] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000237d27000 [ 72.154893] [ffff0000c2bb708c] pgd=0000000000000000, p4d=180000023ffff403, pud=180000023f84b403, pmd=180000023f835403, +pte=0068000102bb7707 [ 72.163021] Internal error: Oops: 0000000096000021 [#1] SMP [...] [ 72.170041] CPU: 7 UID: 0 PID: 54 Comm: kworker/7:0 Tainted: G E 6.13.0-rc3+ #2 [ 72.170509] Tainted: [E]=UNSIGNED_MODULE [ 72.170720] Hardware name: QEMU QEMU Virtual Machine, BIOS edk2-stable202302-for-qemu 03/01/2023 [ 72.171192] Workqueue: events_power_efficient nft_rhash_gc [nf_tables] [ 72.171552] pstate: 21400005 (nzCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--) [ 72.171915] pc : nft_rhash_gc+0x200/0x2d8 [nf_tables] [ 72.172166] lr : nft_rhash_gc+0x128/0x2d8 [nf_tables] [ 72.172546] sp : ffff800081f2bce0 [ 72.172724] x29: ffff800081f2bd40 x28: ffff0000c2bb708c x27: 0000000000000038 [ 72.173078] x26: ffff0000c6780ef0 x25: ffff0000c643df00 x24: ffff0000c6778f78 [ 72.173431] x23: 000000000000001a x22: ffff0000c4b1f000 x21: ffff0000c6780f78 [ 72.173782] x20: ffff0000c2bb70dc x19: ffff0000c2bb7080 x18: 0000000000000000 [ 72.174135] x17: ffff0000c0a4e1c0 x16: 0000000000003000 x15: 0000ac26d173b978 [ 72.174485] x14: ffffffffffffffff x13: 0000000000000030 x12: ffff0000c6780ef0 [ 72.174841] x11: 0000000000000000 x10: ffff800081f2bcf8 x9 : ffff0000c3000000 [ 72.175193] x8 : 00000000000004be x7 : 0000000000000000 x6 : 0000000000000000 [ 72.175544] x5 : 0000000000000040 x4 : ffff0000c3000010 x3 : 0000000000000000 [ 72.175871] x2 : 0000000000003a98 x1 : ffff0000c2bb708c x0 : 0000000000000004 [ 72.176207] Call trace: [ 72.176316] nft_rhash_gc+0x200/0x2d8 [nf_tables] (P) [ 72.176653] process_one_work+0x178/0x3d0 [ 72.176831] worker_thread+0x200/0x3f0 [ 72.176995] kthread+0xe8/0xf8 [ 72.177130] ret_from_fork+0x10/0x20 [ 72.177289] Code: 54fff984 d503201f d2800080 91003261 (f820303f) [ 72.177557] ---[ end trace 0000000000000000 ]---
Align struct nft_set_ext to word size to address this and documentation it.
pahole reports that this increases the size of elements for rhash and pipapo in 8 bytes on x86_64.
--- include/net/netfilter/nf_tables.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
include/net/netfilter/nf_tables.h +5 -2
@@ -690,15 +690,18 @@ struct nft_set_ext_tmpl {/** * struct nft_set_ext - set extensions * -* @genmask: generation mask +* @genmask: generation mask, but also flags (see NFT_SET_ELEM_DEAD_BIT) * @offset: offsets of individual extension types * @data: beginning of extension data +* +* This structure must be aligned to word size, otherwise atomic bitops +* on genmask field can cause alignment failure on some archs. */ struct nft_set_ext {u8 genmask;u8 offset[NFT_SET_EXT_NUM ];char data[]; -}; +}__aligned(BITS_PER_LONG / 8) ;static inline void nft_set_ext_prepare (struct nft_set_ext_tmpl *tmpl) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 135/168 net: llc: reset skb->transport_header
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Pastor <[email protected]>
[ Upstream commit a024e377efed31ecfb39210bed562932321345b3 ]
802.2+LLC+SNAP frames received by napi_complete_done with GRO and DSA have skb->transport_header set two bytes short, or pointing 2 bytes before network_header & skb->data. As snap_rcv expects transport_header to point to SNAP header (OID:PID) after LLC processing advances offset over LLC header (llc_rcv & llc_fixup_skb), code doesn't find a match and packet is dropped.
Between napi_complete_done and snap_rcv, transport_header is not used until __netif_receive_skb_core, where originally it was being reset. Commit fda55eca5a33 ("net: introduce skb_transport_header_was_set()") only does so if not set, on the assumption the value was set correctly by GRO (and also on assumption that "network stacks usually reset the transport header anyway"). Afterwards it is moved forward by llc_fixup_skb.
Locally generated traffic shows up at __netif_receive_skb_core with no transport_header set and is processed without issue. On a setup with GRO but no DSA, transport_header and network_header are both set to point to skb->data which is also correct.
As issue is LLC specific, to avoid impacting non-LLC traffic, and to follow up on original assumption made on previous code change, llc_fixup_skb to reset the offset after skb pull. llc_fixup_skb assumes the LLC header is at skb->data, and by definition SNAP header immediately follows.
--- net/llc/llc_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/llc/llc_input.c +1 -1
@@ -124,8 +124,8 @@ static inline int llc_fixup_skb(struct sk_buff *skb)if (unlikely (!pskb_may_pull (skb, llc_len)))return 0 ; - skb->transport_header += llc_len;skb_pull (skb, llc_len); +skb_reset_transport_header (skb);if (skb->protocol ==htons (ETH_P_802_2 )) {__be16 pdulen;s32 data_size;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 136/168 ALSA: usb-audio: US16x08: Initialize array before use
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tanya Agarwal <[email protected]>
[ Upstream commit b06a6187ef983f501e93faa56209169752d3bde3 ]
Initialize meter_urb array before use in mixer_us16x08.c.
CID 1410197: (#1 of 1): Uninitialized scalar variable (UNINIT)uninit_use_in_call: Using uninitialized value *meter_urb when calling get_meter_levels_from_urb.
Coverity Link:
https://scan7.scan.coverity.com/#/project-view/52849/11354?selectedIssue=1410197
--- sound/usb/mixer_us16x08.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/mixer_us16x08.c +1 -1
@@ -687,7 +687,7 @@ static int snd_us16x08_meter_get(struct snd_kcontrol *kcontrol,struct usb_mixer_elem_info *elem = kcontrol->private_data;struct snd_usb_audio *chip = elem->head.mixer->chip;struct snd_us16x08_meter_store *store = elem->private_data; -u8 meter_urb[64 ]; +u8 meter_urb[64 ] = {0 };switch (kcontrol->private_value) {case 0 : {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 137/168 eth: bcmsysport: fix call balance of priv->clk handling routines
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitalii Mordan <[email protected]>
[ Upstream commit b255ef45fcc2141c1bf98456796abb956d843a27 ]
Check the return value of clk_prepare_enable to ensure that priv->clk has been successfully enabled.
If priv->clk was not enabled during bcm_sysport_probe, bcm_sysport_resume, or bcm_sysport_open, it must not be disabled in any subsequent execution paths.
--- drivers/net/ethernet/broadcom/bcmsysport.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bcmsysport.c +18 -3
@@ -1956,7 +1956,11 @@ static int bcm_sysport_open(struct net_device *dev)unsigned int i;int ret; -clk_prepare_enable (priv->clk); + ret =clk_prepare_enable (priv->clk); +if (ret) { +netdev_err (dev,"could not enable priv clock\n" ); +return ret; + }/* Reset UniMAC */ umac_reset (priv);
@@ -2618,7 +2622,11 @@ static int bcm_sysport_probe(struct platform_device *pdev) goto err_deregister_notifier; } -clk_prepare_enable (priv->clk); + ret =clk_prepare_enable (priv->clk); +if (ret) { +dev_err (&pdev->dev,"could not enable priv clock\n" ); + goto err_deregister_netdev; + } priv->rev =topctrl_readl (priv,REV_CNTL ) &REV_MASK ; dev_info(&pdev->dev,
@@ -2632,6 +2640,8 @@ static int bcm_sysport_probe(struct platform_device *pdev)return 0 ; +err_deregister_netdev: +unregister_netdev (dev); err_deregister_notifier:unregister_netdevice_notifier (&priv->netdev_notifier); err_deregister_fixed_link:
@@ -2803,7 +2813,12 @@ static int __maybe_unused bcm_sysport_resume(struct device *d)if (!netif_running (dev))return 0 ; -clk_prepare_enable (priv->clk); + ret =clk_prepare_enable (priv->clk); +if (ret) { +netdev_err (dev,"could not enable priv clock\n" ); +return ret; + } +if (priv->wolopts)clk_disable_unprepare (priv->wol_clk);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 138/168 net: mv643xx_eth: fix an OF node reference leak
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
[ Upstream commit ad5c318086e2e23b577eca33559c5ebf89bc7eb9 ]
Current implementation of mv643xx_eth_shared_of_add_port() calls of_parse_phandle(), but does not release the refcount on error. Call of_node_put() in the error path and in mv643xx_eth_shared_of_remove().
This bug was found by an experimental verification tool that I am developing.
--- drivers/net/ethernet/marvell/mv643xx_eth.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/mv643xx_eth.c +12 -2
@@ -2703,9 +2703,15 @@ static struct platform_device *port_platdev[3];static void mv643xx_eth_shared_of_remove (void ) { +struct mv643xx_eth_platform_data *pd;int n;for (n =0 ; n <3 ; n++) { +if (!port_platdev[n]) +continue ; + pd =dev_get_platdata (&port_platdev[n]->dev); +if (pd) +of_node_put (pd->phy_node);platform_device_del (port_platdev[n]); port_platdev[n] =NULL ; }
@@ -2766,8 +2772,10 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev, } ppdev =platform_device_alloc (MV643XX_ETH_NAME , dev_num); -if (!ppdev) -return -ENOMEM ; +if (!ppdev) { + ret = -ENOMEM ; + goto put_err; + } ppdev->dev.coherent_dma_mask =DMA_BIT_MASK (32 ); ppdev->dev.of_node = pnp;
@@ -2789,6 +2797,8 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev, port_err:platform_device_put (ppdev); +put_err: +of_node_put (ppd.phy_node);return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 139/168 RDMA/rtrs: Ensure ib_sge list is accessible
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Zhijian <[email protected]>
[ Upstream commit fb514b31395946022f13a08e06a435f53cf9e8b3 ]
Move the declaration of the 'ib_sge list' variable outside the 'always_invalidate' block to ensure it remains accessible for use throughout the function.
Previously, 'ib_sge list' was declared within the 'always_invalidate' block, limiting its accessibility, then caused a
'BUG: kernel NULL pointer dereference'[1].
? __die_body.cold+0x19/0x27 ? page_fault_oops+0x15a/0x2d0 ? search_module_extables+0x19/0x60 ? search_bpf_extables+0x5f/0x80 ? exc_page_fault+0x7e/0x180 ? asm_exc_page_fault+0x26/0x30 ? memcpy_orig+0xd5/0x140 rxe_mr_copy+0x1c3/0x200 [rdma_rxe] ? rxe_pool_get_index+0x4b/0x80 [rdma_rxe] copy_data+0xa5/0x230 [rdma_rxe] rxe_requester+0xd9b/0xf70 [rdma_rxe] ? finish_task_switch.isra.0+0x99/0x2e0 rxe_sender+0x13/0x40 [rdma_rxe] do_task+0x68/0x1e0 [rdma_rxe] process_one_work+0x177/0x330 worker_thread+0x252/0x390 ? __pfx_worker_thread+0x10/0x10
This change ensures the variable is available for subsequent operations that require it.
[1] https://lore.kernel.org/linux-rdma/[email protected]/
--- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/ulp/rtrs/rtrs-srv.c +1 -1
@@ -353,6 +353,7 @@ static int send_io_resp_imm(struct rtrs_srv_con *con, struct rtrs_srv_op *id,struct rtrs_srv_mr *srv_mr;bool need_inval = false;enum ib_send_flags flags; +struct ib_sge list;u32 imm;int err;
@@ -403,7 +404,6 @@ static int send_io_resp_imm(struct rtrs_srv_con *con, struct rtrs_srv_op *id, imm =rtrs_to_io_rsp_imm (id->msg_id, errno, need_inval); imm_wr.wr.next =NULL ;if (always_invalidate) { -struct ib_sge list;struct rtrs_msg_rkey_rsp *msg; srv_mr = &srv_path->mrs[id->msg_id];
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 140/168 net: restrict SO_REUSEPORT to inet sockets
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 5b0af621c3f6ef9261cf6067812f2fd9943acb4b ]
After blamed commit, crypto sockets could accidentally be destroyed from RCU call back, as spotted by zyzbot [1].
Trying to acquire a mutex in RCU callback is not allowed.
Restrict SO_REUSEPORT socket option to inet sockets.
v1 of this patch supported TCP, UDP and SCTP sockets, but fcnal-test.sh test needed RAW and ICMP support.
[1]
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:562
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 24, name: ksoftirqd/1preempt_count: 100, expected: 0
RCU nest depth: 0, expected: 0
1 lock held by ksoftirqd/1/24:
#0: ffffffff8e937ba0 (rcu_callback){....}-{0:0}, at: rcu_lock_acquire include/linux/rcupdate.h:337 [inline] #0: ffffffff8e937ba0 (rcu_callback){....}-{0:0}, at: rcu_do_batch kernel/rcu/tree.c:2561 [inline] #0: ffffffff8e937ba0 (rcu_callback){....}-{0:0}, at: rcu_core+0xa37/0x17a0 kernel/rcu/tree.c:2823
Preemption disabled at:
[<ffffffff8161c8c8>] softirq_handle_begin kernel/softirq.c:402 [inline] [<ffffffff8161c8c8>] handle_softirqs+0x128/0x9b0 kernel/softirq.c:537 CPU: 1 UID: 0 PID: 24 Comm: ksoftirqd/1 Not tainted 6.13.0-rc3-syzkaller-00174-ga024e377efed #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 __might_resched+0x5d4/0x780 kernel/sched/core.c:8758 __mutex_lock_common kernel/locking/mutex.c:562 [inline] __mutex_lock+0x131/0xee0 kernel/locking/mutex.c:735 crypto_put_default_null_skcipher+0x18/0x70 crypto/crypto_null.c:179 aead_release+0x3d/0x50 crypto/algif_aead.c:489 alg_do_release crypto/af_alg.c:118 [inline] alg_sock_destruct+0x86/0xc0 crypto/af_alg.c:502 __sk_destruct+0x58/0x5f0 net/core/sock.c:2260 rcu_do_batch kernel/rcu/tree.c:2567 [inline] rcu_core+0xaaa/0x17a0 kernel/rcu/tree.c:2823 handle_softirqs+0x2d4/0x9b0 kernel/softirq.c:561 run_ksoftirqd+0xca/0x130 kernel/softirq.c:950 smpboot_thread_fn+0x544/0xa30 kernel/smpboot.c:164 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 </TASK>
--- net/core/sock.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/core/sock.c +4 -1
@@ -994,7 +994,10 @@ int sock_setsockopt(struct socket *sock, int level, int optname, sk->sk_reuse = (valbool ?SK_CAN_REUSE :SK_NO_REUSE );break ;case SO_REUSEPORT : - sk->sk_reuseport = valbool; +if (valbool && !sk_is_inet (sk)) + ret = -EOPNOTSUPP ; +else + sk->sk_reuseport = valbool;break ;case SO_TYPE :case SO_PROTOCOL :
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 141/168 net: wwan: iosm: Properly check for valid exec stage in ipc_mmio_init()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej S. Szmigiero <[email protected]>
[ Upstream commit a7af435df0e04cfb4a4004136d597c42639a2ae7 ]
ipc_mmio_init() used the post-decrement operator in its loop continuing condition of "retries" counter being "> 0", which meant that when this condition caused loop exit "retries" counter reached -1.
But the later valid exec stage failure check only tests for "retries" counter being exactly zero, so it didn't trigger in this case (but would wrongly trigger if the code reaches a valid exec stage in the very last loop iteration).
Fix this by using the pre-decrement operator instead, so the loop counter is exactly zero on valid exec stage failure.
--- drivers/net/wwan/iosm/iosm_ipc_mmio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wwan/iosm/iosm_ipc_mmio.c +1 -1
@@ -102,7 +102,7 @@ struct iosm_mmio *ipc_mmio_init(void __iomem *mmio, struct device *dev)break ;msleep (20 ); - }while (retries-- >0 ); + }while (--retries >0 );if (!retries) {dev_err (ipc_mmio->dev,"invalid exec stage %X" , stage);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 142/168 af_packet: fix vlan_get_tci() vs MSG_PEEK
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 77ee7a6d16b6ec07b5c3ae2b6b60a24c1afbed09 ]
Blamed commit forgot MSG_PEEK case, allowing a crash [1] as found by syzbot.
Rework vlan_get_tci() to not touch skb at all, so that it can be used from many cpus on the same skb.
Add a const qualifier to skb argument.
[1]
skbuff: skb_under_panic: text:ffffffff8a8da482 len:32 put:14 head:ffff88807a1d5800 data:ffff88807a1d5810 tail:0x14 end:0x140 dev:<NULL>
------------[ cut here ]------------ kernel BUG at net/core/skbuff.c:206 ! Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI CPU: 0 UID: 0 PID: 5880 Comm: syz-executor172 Not tainted 6.13.0-rc3-syzkaller-00762-g9268abe611b0 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 RIP: 0010:skb_panic net/core/skbuff.c:206 [inline] RIP: 0010:skb_under_panic+0x14b/0x150 net/core/skbuff.c:216 Code: 0b 8d 48 c7 c6 9e 6c 26 8e 48 8b 54 24 08 8b 0c 24 44 8b 44 24 04 4d 89 e9 50 41 54 41 57 41 56 e8 3a 5a 79 f7 48 83 c4 20 90 <0f> 0b 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 RSP: 0018:ffffc90003baf5b8 EFLAGS: 00010286 RAX: 0000000000000087 RBX: dffffc0000000000 RCX: 8565c1eec37aa000 RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000 RBP: ffff88802616fb50 R08: ffffffff817f0a4c R09: 1ffff92000775e50 R10: dffffc0000000000 R11: fffff52000775e51 R12: 0000000000000140 R13: ffff88807a1d5800 R14: ffff88807a1d5810 R15: 0000000000000014 FS: 00007fa03261f6c0(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffd65753000 CR3: 0000000031720000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> skb_push+0xe5/0x100 net/core/skbuff.c:2636 vlan_get_tci+0x272/0x550 net/packet/af_packet.c:565 packet_recvmsg+0x13c9/0x1ef0 net/packet/af_packet.c:3616 sock_recvmsg_nosec net/socket.c:1044 [inline] sock_recvmsg+0x22f/0x280 net/socket.c:1066 ____sys_recvmsg+0x1c6/0x480 net/socket.c:2814 ___sys_recvmsg net/socket.c:2856 [inline] do_recvmmsg+0x426/0xab0 net/socket.c:2951 __sys_recvmmsg net/socket.c:3025 [inline] __do_sys_recvmmsg net/socket.c:3048 [inline] __se_sys_recvmmsg net/socket.c:3041 [inline] __x64_sys_recvmmsg+0x199/0x250 net/socket.c:3041 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
--- net/packet/af_packet.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
net/packet/af_packet.c +3 -9
@@ -505,10 +505,8 @@ static void *packet_current_frame(struct packet_sock *po,return packet_lookup_frame (po, rb, rb->head, status); } -static u16 vlan_get_tci (struct sk_buff *skb,struct net_device *dev) +static u16 vlan_get_tci (const struct sk_buff *skb,struct net_device *dev) { -u8 *skb_orig_data = skb->data; -int skb_orig_len = skb->len;struct vlan_hdr vhdr, *vh;unsigned int header_len;
@@ -529,12 +527,8 @@ static u16 vlan_get_tci(struct sk_buff *skb, struct net_device *dev)else return 0 ; -skb_push (skb, skb->data -skb_mac_header (skb)); - vh =skb_header_pointer (skb, header_len,sizeof (vhdr), &vhdr); -if (skb_orig_data != skb->data) { - skb->data = skb_orig_data; - skb->len = skb_orig_len; - } + vh =skb_header_pointer (skb,skb_mac_offset (skb) + header_len, +sizeof (vhdr), &vhdr);if (unlikely (!vh))return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 143/168 af_packet: fix vlan_get_protocol_dgram() vs MSG_PEEK
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit f91a5b8089389eb408501af2762f168c3aaa7b79 ]
Blamed commit forgot MSG_PEEK case, allowing a crash [1] as found by syzbot.
Rework vlan_get_protocol_dgram() to not touch skb at all, so that it can be used from many cpus on the same skb.
Add a const qualifier to skb argument.
[1]
skbuff: skb_under_panic: text:ffffffff8a8ccd05 len:29 put:14 head:ffff88807fc8e400 data:ffff88807fc8e3f4 tail:0x11 end:0x140 dev:<NULL>
------------[ cut here ]------------ kernel BUG at net/core/skbuff.c:206 ! Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI CPU: 1 UID: 0 PID: 5892 Comm: syz-executor883 Not tainted 6.13.0-rc4-syzkaller-00054-gd6ef8b40d075 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 RIP: 0010:skb_panic net/core/skbuff.c:206 [inline] RIP: 0010:skb_under_panic+0x14b/0x150 net/core/skbuff.c:216 Code: 0b 8d 48 c7 c6 86 d5 25 8e 48 8b 54 24 08 8b 0c 24 44 8b 44 24 04 4d 89 e9 50 41 54 41 57 41 56 e8 5a 69 79 f7 48 83 c4 20 90 <0f> 0b 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 RSP: 0018:ffffc900038d7638 EFLAGS: 00010282 RAX: 0000000000000087 RBX: dffffc0000000000 RCX: 609ffd18ea660600 RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000 RBP: ffff88802483c8d0 R08: ffffffff817f0a8c R09: 1ffff9200071ae60 R10: dffffc0000000000 R11: fffff5200071ae61 R12: 0000000000000140 R13: ffff88807fc8e400 R14: ffff88807fc8e3f4 R15: 0000000000000011 FS: 00007fbac5e006c0(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fbac5e00d58 CR3: 000000001238e000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> skb_push+0xe5/0x100 net/core/skbuff.c:2636 vlan_get_protocol_dgram+0x165/0x290 net/packet/af_packet.c:585 packet_recvmsg+0x948/0x1ef0 net/packet/af_packet.c:3552 sock_recvmsg_nosec net/socket.c:1033 [inline] sock_recvmsg+0x22f/0x280 net/socket.c:1055 ____sys_recvmsg+0x1c6/0x480 net/socket.c:2803 ___sys_recvmsg net/socket.c:2845 [inline] do_recvmmsg+0x426/0xab0 net/socket.c:2940 __sys_recvmmsg net/socket.c:3014 [inline] __do_sys_recvmmsg net/socket.c:3037 [inline] __se_sys_recvmmsg net/socket.c:3030 [inline] __x64_sys_recvmmsg+0x199/0x250 net/socket.c:3030 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- include/linux/if_vlan.h | 16 +++++++++++++--- net/packet/af_packet.c | 16 ++++------------ 2 files changed, 17 insertions(+), 15 deletions(-)
include/linux/if_vlan.h +13 -3
@@ -582,13 +582,16 @@ static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)* vlan_get_protocol - get protocol EtherType. * @skb: skbuff to query * @type: first vlan protocol +* @mac_offset: MAC offset * @depth: buffer to store length of eth and vlan tags in bytes * * Returns the EtherType of the packet, regardless of whether it is * vlan encapsulated (normal or hardware accelerated) or not. */ -static inline __be16 __vlan_get_protocol (const struct sk_buff *skb,__be16 type, -int *depth) +static inline __be16 __vlan_get_protocol_offset (const struct sk_buff *skb, +__be16 type, +int mac_offset, +int *depth) {unsigned int vlan_depth = skb->mac_len, parse_depth =VLAN_MAX_DEPTH ;
@@ -607,7 +610,8 @@ static inline __be16 __vlan_get_protocol(const struct sk_buff *skb, __be16 type, do { struct vlan_hdr vhdr, *vh; - vh = skb_header_pointer(skb, vlan_depth, sizeof(vhdr), &vhdr); + vh = skb_header_pointer(skb, mac_offset + vlan_depth, + sizeof(vhdr), &vhdr); if (unlikely(!vh || !--parse_depth)) return 0;
@@ -622,6 +626,12 @@ static inline __be16 __vlan_get_protocol(const struct sk_buff *skb, __be16 type,return type; } +static inline __be16 __vlan_get_protocol (const struct sk_buff *skb,__be16 type, +int *depth) +{ +return __vlan_get_protocol_offset (skb, type,0 , depth); +} +/** * vlan_get_protocol - get protocol EtherType. * @skb: skbuff to query
net/packet/af_packet.c +4 -12
@@ -535,21 +535,13 @@ static u16 vlan_get_tci(const struct sk_buff *skb, struct net_device *dev)return ntohs (vh->h_vlan_TCI); } -static __be16 vlan_get_protocol_dgram (struct sk_buff *skb) +static __be16 vlan_get_protocol_dgram (const struct sk_buff *skb) {__be16 proto = skb->protocol; -if (unlikely (eth_type_vlan (proto))) { -u8 *skb_orig_data = skb->data; -int skb_orig_len = skb->len; - -skb_push (skb, skb->data -skb_mac_header (skb)); - proto =__vlan_get_protocol (skb, proto,NULL ); -if (skb_orig_data != skb->data) { - skb->data = skb_orig_data; - skb->len = skb_orig_len; - } - } +if (unlikely (eth_type_vlan (proto))) + proto =__vlan_get_protocol_offset (skb, proto, +skb_mac_offset (skb),NULL );return proto; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 144/168 ila: serialize calls to nf_register_net_hooks()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 260466b576bca0081a7d4acecc8e93687aa22d0e ]
syzbot found a race in ila_add_mapping() [1]
commit 031ae72825ce ("ila: call nf_unregister_net_hooks() sooner") attempted to fix a similar issue.
Looking at the syzbot repro, we have concurrent ILA_CMD_ADD commands.
Add a mutex to make sure at most one thread is calling nf_register_net_hooks().
[1]
BUG: KASAN: slab-use-after-free in rht_key_hashfn include/linux/rhashtable.h:159 [inline] BUG: KASAN: slab-use-after-free in __rhashtable_lookup.constprop.0+0x426/0x550 include/linux/rhashtable.h:604 Read of size 4 at addr ffff888028f40008 by task dhcpcd/5501 CPU: 1 UID: 0 PID: 5501 Comm: dhcpcd Not tainted 6.13.0-rc4-syzkaller-00054-gd6ef8b40d075 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: <IRQ> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xc3/0x620 mm/kasan/report.c:489 kasan_report+0xd9/0x110 mm/kasan/report.c:602 rht_key_hashfn include/linux/rhashtable.h:159 [inline] __rhashtable_lookup.constprop.0+0x426/0x550 include/linux/rhashtable.h:604 rhashtable_lookup include/linux/rhashtable.h:646 [inline] rhashtable_lookup_fast include/linux/rhashtable.h:672 [inline] ila_lookup_wildcards net/ipv6/ila/ila_xlat.c:127 [inline] ila_xlat_addr net/ipv6/ila/ila_xlat.c:652 [inline] ila_nf_input+0x1ee/0x620 net/ipv6/ila/ila_xlat.c:185 nf_hook_entry_hookfn include/linux/netfilter.h:154 [inline] nf_hook_slow+0xbb/0x200 net/netfilter/core.c:626 nf_hook.constprop.0+0x42e/0x750 include/linux/netfilter.h:269 NF_HOOK include/linux/netfilter.h:312 [inline] ipv6_rcv+0xa4/0x680 net/ipv6/ip6_input.c:309 __netif_receive_skb_one_core+0x12e/0x1e0 net/core/dev.c:5672 __netif_receive_skb+0x1d/0x160 net/core/dev.c:5785 process_backlog+0x443/0x15f0 net/core/dev.c:6117 __napi_poll.constprop.0+0xb7/0x550 net/core/dev.c:6883 napi_poll net/core/dev.c:6952 [inline] net_rx_action+0xa94/0x1010 net/core/dev.c:7074 handle_softirqs+0x213/0x8f0 kernel/softirq.c:561 __do_softirq kernel/softirq.c:595 [inline] invoke_softirq kernel/softirq.c:435 [inline] __irq_exit_rcu+0x109/0x170 kernel/softirq.c:662 irq_exit_rcu+0x9/0x30 kernel/softirq.c:678 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline] sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1049
--- net/ipv6/ila/ila_xlat.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
net/ipv6/ila/ila_xlat.c +11 -5
@@ -201,6 +201,8 @@ static const struct nf_hook_ops ila_nf_hook_ops[] = { }, }; +static DEFINE_MUTEX (ila_mutex); +static int ila_add_mapping (struct net *net,struct ila_xlat_params *xp) {struct ila_net *ilan =net_generic (net, ila_net_id);
@@ -208,16 +210,20 @@ static int ila_add_mapping(struct net *net, struct ila_xlat_params *xp)spinlock_t *lock =ila_get_lock (ilan, xp->ip.locator_match);int err =0 , order; -if (!ilan->xlat.hooks_registered) { +if (!READ_ONCE (ilan->xlat.hooks_registered)) {/* We defer registering net hooks in the namespace until the * first mapping is added. */ - err =nf_register_net_hooks (net, ila_nf_hook_ops, -ARRAY_SIZE (ila_nf_hook_ops)); +mutex_lock (&ila_mutex); +if (!ilan->xlat.hooks_registered) { + err =nf_register_net_hooks (net, ila_nf_hook_ops, +ARRAY_SIZE (ila_nf_hook_ops)); +if (!err) +WRITE_ONCE (ilan->xlat.hooks_registered, true); + } +mutex_unlock (&ila_mutex);if (err)return err; - - ilan->xlat.hooks_registered = true; } ila =kzalloc (sizeof (*ila),GFP_KERNEL );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 145/168 btrfs: rename and export __btrfs_cow_block()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 95f93bc4cbcac6121a5ee85cd5019ee8e7447e0b ]
Rename and export __btrfs_cow_block() as btrfs_force_cow_block(). This is to allow to move defrag specific code out of ctree.c and into defrag.c in one of the next patches.
Stable-dep-of: 44f52bbe96df ("btrfs: fix use-after-free when COWing tree bock and tracing is enabled")
--- fs/btrfs/ctree.c | 30 +++++++++++++++--------------- fs/btrfs/ctree.h | 7 +++++++ 2 files changed, 22 insertions(+), 15 deletions(-)
fs/btrfs/ctree.c +15 -15
@@ -386,13 +386,13 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans,* bytes the allocator should try to find free next to the block it returns. * This is just a hint and may be ignored by the allocator. */ -static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, -struct btrfs_root *root, -struct extent_buffer *buf, -struct extent_buffer *parent,int parent_slot, -struct extent_buffer **cow_ret, -u64 search_start,u64 empty_size, -enum btrfs_lock_nesting nest) +int btrfs_force_cow_block (struct btrfs_trans_handle *trans, +struct btrfs_root *root, +struct extent_buffer *buf, +struct extent_buffer *parent,int parent_slot, +struct extent_buffer **cow_ret, +u64 search_start,u64 empty_size, +enum btrfs_lock_nesting nest) {struct btrfs_fs_info *fs_info = root->fs_info;struct btrfs_disk_key disk_key;
@@ -541,7 +541,7 @@ static inline int should_cow_block(struct btrfs_trans_handle *trans, }/* -* cows a single block, see __btrfs_cow_block for the real work. +* COWs a single block, see btrfs_force_cow_block() for the real work. * This version of it has extra checks so that a block isn't COWed more than * once per transaction, as long as it hasn't been written yet */
@@ -594,8 +594,8 @@ noinline int btrfs_cow_block(struct btrfs_trans_handle *trans,* Also We don't care about the error, as it's handled internally. */ btrfs_qgroup_trace_subtree_after_cow (trans, root, buf); - ret =__btrfs_cow_block (trans, root, buf, parent, - parent_slot, cow_ret, search_start,0 , nest); + ret =btrfs_force_cow_block (trans, root, buf, parent, parent_slot, + cow_ret, search_start,0 , nest);trace_btrfs_cow_block (root, buf, *cow_ret);
@@ -746,11 +746,11 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, search_start = last_block;btrfs_tree_lock (cur); - err =__btrfs_cow_block (trans, root, cur, parent, i, - &cur, search_start, -min (16 * blocksize, - (end_slot - i) * blocksize), -BTRFS_NESTING_COW ); + err =btrfs_force_cow_block (trans, root, cur, parent, i, + &cur, search_start, +min (16 * blocksize, + (end_slot - i) * blocksize), +BTRFS_NESTING_COW );if (err) {btrfs_tree_unlock (cur);free_extent_buffer (cur);
fs/btrfs/ctree.h +7 -0
@@ -2885,6 +2885,13 @@ int btrfs_cow_block(struct btrfs_trans_handle *trans, struct extent_buffer *parent, int parent_slot, struct extent_buffer **cow_ret, enum btrfs_lock_nesting nest); +int btrfs_force_cow_block (struct btrfs_trans_handle *trans, +struct btrfs_root *root, +struct extent_buffer *buf, +struct extent_buffer *parent,int parent_slot, +struct extent_buffer **cow_ret, +u64 search_start,u64 empty_size, +enum btrfs_lock_nesting nest); int btrfs_copy_root(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct extent_buffer *buf,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 146/168 btrfs: fix use-after-free when COWing tree bock and tracing is enabled
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 44f52bbe96dfdbe4aca3818a2534520082a07040 ]
When a COWing a tree block, at btrfs_cow_block(), and we have the tracepoint trace_btrfs_cow_block() enabled and preemption is also enabled (CONFIG_PREEMPT=y), we can trigger a use-after-free in the COWed extent buffer while inside the tracepoint code. This is because in some paths that call btrfs_cow_block(), such as btrfs_search_slot(), we are holding the last reference on the extent buffer @buf so btrfs_force_cow_block() drops the last reference on the @buf extent buffer when it calls free_extent_buffer_stale(buf), which schedules the release of the extent buffer with RCU. This means that if we are on a kernel with preemption, the current task may be preempted before calling trace_btrfs_cow_block() and the extent buffer already released by the time trace_btrfs_cow_block() is called, resulting in a use-after-free.
Fix this by moving the trace_btrfs_cow_block() from btrfs_cow_block() to btrfs_force_cow_block() before the COWed extent buffer is freed. This also has a side effect of invoking the tracepoint in the tree defrag code, at defrag.c:btrfs_realloc_node(), since btrfs_force_cow_block() is called there, but this is fine and it was actually missing there.
--- fs/btrfs/ctree.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
fs/btrfs/ctree.c +4 -7
@@ -502,6 +502,8 @@ int btrfs_force_cow_block(struct btrfs_trans_handle *trans,btrfs_free_tree_block (trans,btrfs_root_id (root), buf, parent_start, last_ref); } + +trace_btrfs_cow_block (root, buf, cow);if (unlock_orig)btrfs_tree_unlock (buf);free_extent_buffer_stale (buf);
@@ -553,7 +555,6 @@ noinline int btrfs_cow_block(struct btrfs_trans_handle *trans, {struct btrfs_fs_info *fs_info = root->fs_info;u64 search_start; -int ret;if (unlikely (test_bit (BTRFS_ROOT_DELETING , &root->state))) {btrfs_abort_transaction (trans, -EUCLEAN );
@@ -594,12 +595,8 @@ noinline int btrfs_cow_block(struct btrfs_trans_handle *trans,* Also We don't care about the error, as it's handled internally. */ btrfs_qgroup_trace_subtree_after_cow (trans, root, buf); - ret =btrfs_force_cow_block (trans, root, buf, parent, parent_slot, - cow_ret, search_start,0 , nest); - -trace_btrfs_cow_block (root, buf, *cow_ret); - -return ret; +return btrfs_force_cow_block (trans, root, buf, parent, parent_slot, + cow_ret, search_start,0 , nest); }ALLOW_ERROR_INJECTION (btrfs_cow_block,ERRNO );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 147/168 btrfs: sysfs: convert scnprintf and snprintf to sysfs_emit
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anand Jain <[email protected]>
[ Upstream commit 020e5277583dc26d7a5322ff2d334c764ac1faa8 ]
Commit 2efc459d06f1 ("sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs out") merged in 5.10 introduced two new functions sysfs_emit() and sysfs_emit_at() which are aware of the PAGE_SIZE limit of the output buffer.
Use the above two new functions instead of scnprintf() and snprintf() in various sysfs show().
Stable-dep-of: fca432e73db2 ("btrfs: sysfs: fix direct super block member reads")
--- fs/btrfs/sysfs.c | 93 +++++++++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 49 deletions(-)
fs/btrfs/sysfs.c +44 -49
@@ -177,7 +177,7 @@ static ssize_t btrfs_feature_attr_show(struct kobject *kobj, }else val =can_modify_feature (fa); -return scnprintf (buf,PAGE_SIZE ,"%d\n" , val); +return sysfs_emit (buf,"%d\n" , val); } static ssize_t btrfs_feature_attr_store(struct kobject *kobj,
@@ -333,7 +333,7 @@ static const struct attribute_group btrfs_feature_attr_group = {static ssize_t rmdir_subvol_show (struct kobject *kobj,struct kobj_attribute *ka,char *buf) { -return scnprintf (buf,PAGE_SIZE ,"0\n" ); +return sysfs_emit (buf,"0\n" ); }BTRFS_ATTR (static_feature, rmdir_subvol, rmdir_subvol_show);
@@ -348,12 +348,12 @@ static ssize_t supported_checksums_show(struct kobject *kobj,* This "trick" only works as long as 'enum btrfs_csum_type' has * no holes in it */ - ret +=scnprintf (buf + ret,PAGE_SIZE - ret,"%s%s" , - (i ==0 ?"" :" " ),btrfs_super_csum_name (i)); + ret +=sysfs_emit_at (buf, ret,"%s%s" , (i ==0 ?"" :" " ), +btrfs_super_csum_name (i)); } - ret +=scnprintf (buf + ret,PAGE_SIZE - ret,"\n" ); + ret +=sysfs_emit_at (buf, ret,"\n" );return ret; }BTRFS_ATTR (static_feature, supported_checksums, supported_checksums_show);
@@ -361,7 +361,7 @@ BTRFS_ATTR(static_feature, supported_checksums, supported_checksums_show);static ssize_t send_stream_version_show (struct kobject *kobj,struct kobj_attribute *ka,char *buf) { -return snprintf (buf,PAGE_SIZE ,"%d\n" ,BTRFS_SEND_STREAM_VERSION ); +return sysfs_emit (buf,"%d\n" ,BTRFS_SEND_STREAM_VERSION ); }BTRFS_ATTR (static_feature, send_stream_version, send_stream_version_show);
@@ -381,9 +381,8 @@ static ssize_t supported_rescue_options_show(struct kobject *kobj,int i;for (i =0 ; i <ARRAY_SIZE (rescue_opts); i++) - ret +=scnprintf (buf + ret,PAGE_SIZE - ret,"%s%s" , - (i ?" " :"" ), rescue_opts[i]); - ret +=scnprintf (buf + ret,PAGE_SIZE - ret,"\n" ); + ret +=sysfs_emit_at (buf, ret,"%s%s" , (i ?" " :"" ), rescue_opts[i]); + ret +=sysfs_emit_at (buf, ret,"\n" );return ret; } BTRFS_ATTR(static_feature, supported_rescue_options,
@@ -397,10 +396,10 @@ static ssize_t supported_sectorsizes_show(struct kobject *kobj,/* 4K sector size is also supported with 64K page size */ if (PAGE_SIZE ==SZ_64K ) - ret +=scnprintf (buf + ret,PAGE_SIZE - ret,"%u " ,SZ_4K ); + ret +=sysfs_emit_at (buf, ret,"%u " ,SZ_4K );/* Only sectorsize == PAGE_SIZE is now supported */ - ret +=scnprintf (buf + ret,PAGE_SIZE - ret,"%lu\n" ,PAGE_SIZE ); + ret +=sysfs_emit_at (buf, ret,"%lu\n" ,PAGE_SIZE );return ret; }
@@ -440,7 +439,7 @@ static ssize_t btrfs_discardable_bytes_show(struct kobject *kobj, {struct btrfs_fs_info *fs_info =discard_to_fs_info (kobj); -return scnprintf (buf,PAGE_SIZE ,"%lld\n" , +return sysfs_emit (buf,"%lld\n" ,atomic64_read (&fs_info->discard_ctl.discardable_bytes)); }BTRFS_ATTR (discard, discardable_bytes, btrfs_discardable_bytes_show);
@@ -451,7 +450,7 @@ static ssize_t btrfs_discardable_extents_show(struct kobject *kobj, {struct btrfs_fs_info *fs_info =discard_to_fs_info (kobj); -return scnprintf (buf,PAGE_SIZE ,"%d\n" , +return sysfs_emit (buf,"%d\n" ,atomic_read (&fs_info->discard_ctl.discardable_extents)); }BTRFS_ATTR (discard, discardable_extents, btrfs_discardable_extents_show);
@@ -462,8 +461,8 @@ static ssize_t btrfs_discard_bitmap_bytes_show(struct kobject *kobj, {struct btrfs_fs_info *fs_info =discard_to_fs_info (kobj); -return scnprintf (buf,PAGE_SIZE ,"%llu\n" , - fs_info->discard_ctl.discard_bitmap_bytes); +return sysfs_emit (buf,"%llu\n" , + fs_info->discard_ctl.discard_bitmap_bytes); }BTRFS_ATTR (discard, discard_bitmap_bytes, btrfs_discard_bitmap_bytes_show);
@@ -473,7 +472,7 @@ static ssize_t btrfs_discard_bytes_saved_show(struct kobject *kobj, {struct btrfs_fs_info *fs_info =discard_to_fs_info (kobj); -return scnprintf (buf,PAGE_SIZE ,"%lld\n" , +return sysfs_emit (buf,"%lld\n" ,atomic64_read (&fs_info->discard_ctl.discard_bytes_saved)); }BTRFS_ATTR (discard, discard_bytes_saved, btrfs_discard_bytes_saved_show);
@@ -484,8 +483,8 @@ static ssize_t btrfs_discard_extent_bytes_show(struct kobject *kobj, {struct btrfs_fs_info *fs_info =discard_to_fs_info (kobj); -return scnprintf (buf,PAGE_SIZE ,"%llu\n" , - fs_info->discard_ctl.discard_extent_bytes); +return sysfs_emit (buf,"%llu\n" , + fs_info->discard_ctl.discard_extent_bytes); }BTRFS_ATTR (discard, discard_extent_bytes, btrfs_discard_extent_bytes_show);
@@ -495,8 +494,8 @@ static ssize_t btrfs_discard_iops_limit_show(struct kobject *kobj, {struct btrfs_fs_info *fs_info =discard_to_fs_info (kobj); -return scnprintf (buf,PAGE_SIZE ,"%u\n" , -READ_ONCE (fs_info->discard_ctl.iops_limit)); +return sysfs_emit (buf,"%u\n" , +READ_ONCE (fs_info->discard_ctl.iops_limit)); } static ssize_t btrfs_discard_iops_limit_store(struct kobject *kobj,
@@ -526,8 +525,8 @@ static ssize_t btrfs_discard_kbps_limit_show(struct kobject *kobj, {struct btrfs_fs_info *fs_info =discard_to_fs_info (kobj); -return scnprintf (buf,PAGE_SIZE ,"%u\n" , -READ_ONCE (fs_info->discard_ctl.kbps_limit)); +return sysfs_emit (buf,"%u\n" , +READ_ONCE (fs_info->discard_ctl.kbps_limit)); } static ssize_t btrfs_discard_kbps_limit_store(struct kobject *kobj,
@@ -556,8 +555,8 @@ static ssize_t btrfs_discard_max_discard_size_show(struct kobject *kobj, {struct btrfs_fs_info *fs_info =discard_to_fs_info (kobj); -return scnprintf (buf,PAGE_SIZE ,"%llu\n" , -READ_ONCE (fs_info->discard_ctl.max_discard_size)); +return sysfs_emit (buf,"%llu\n" , +READ_ONCE (fs_info->discard_ctl.max_discard_size)); } static ssize_t btrfs_discard_max_discard_size_store(struct kobject *kobj,
@@ -630,7 +629,7 @@ static ssize_t btrfs_show_u64(u64 *value_ptr, spinlock_t *lock, char *buf) val = *value_ptr;if (lock)spin_unlock (lock); -return scnprintf (buf,PAGE_SIZE ,"%llu\n" , val); +return sysfs_emit (buf,"%llu\n" , val); } static ssize_t global_rsv_size_show(struct kobject *kobj,
@@ -676,7 +675,7 @@ static ssize_t raid_bytes_show(struct kobject *kobj, val += block_group->used; }up_read (&sinfo->groups_sem); -return scnprintf (buf,PAGE_SIZE ,"%llu\n" , val); +return sysfs_emit (buf,"%llu\n" , val); }/*
@@ -774,7 +773,7 @@ static ssize_t btrfs_label_show(struct kobject *kobj,ssize_t ret;spin_lock (&fs_info->super_lock); - ret =scnprintf (buf,PAGE_SIZE , label[0 ] ?"%s\n" :"%s" , label); + ret =sysfs_emit (buf, label[0 ] ?"%s\n" :"%s" , label);spin_unlock (&fs_info->super_lock);return ret;
@@ -822,7 +821,7 @@ static ssize_t btrfs_nodesize_show(struct kobject *kobj, {struct btrfs_fs_info *fs_info =to_fs_info (kobj); -return scnprintf (buf,PAGE_SIZE ,"%u\n" , fs_info->super_copy->nodesize); +return sysfs_emit (buf,"%u\n" , fs_info->super_copy->nodesize); } BTRFS_ATTR(, nodesize, btrfs_nodesize_show);
@@ -832,8 +831,7 @@ static ssize_t btrfs_sectorsize_show(struct kobject *kobj, {struct btrfs_fs_info *fs_info =to_fs_info (kobj); -return scnprintf (buf,PAGE_SIZE ,"%u\n" , - fs_info->super_copy->sectorsize); +return sysfs_emit (buf,"%u\n" , fs_info->super_copy->sectorsize); } BTRFS_ATTR(, sectorsize, btrfs_sectorsize_show);
@@ -843,7 +841,7 @@ static ssize_t btrfs_clone_alignment_show(struct kobject *kobj, {struct btrfs_fs_info *fs_info =to_fs_info (kobj); -return scnprintf (buf,PAGE_SIZE ,"%u\n" , fs_info->super_copy->sectorsize); +return sysfs_emit (buf,"%u\n" , fs_info->super_copy->sectorsize); } BTRFS_ATTR(, clone_alignment, btrfs_clone_alignment_show);
@@ -855,7 +853,7 @@ static ssize_t quota_override_show(struct kobject *kobj,int quota_override; quota_override =test_bit (BTRFS_FS_QUOTA_OVERRIDE , &fs_info->flags); -return scnprintf (buf,PAGE_SIZE ,"%d\n" , quota_override); +return sysfs_emit (buf,"%d\n" , quota_override); } static ssize_t quota_override_store(struct kobject *kobj,
@@ -893,8 +891,7 @@ static ssize_t btrfs_metadata_uuid_show(struct kobject *kobj, {struct btrfs_fs_info *fs_info =to_fs_info (kobj); -return scnprintf (buf,PAGE_SIZE ,"%pU\n" , - fs_info->fs_devices->metadata_uuid); +return sysfs_emit (buf,"%pU\n" , fs_info->fs_devices->metadata_uuid); } BTRFS_ATTR(, metadata_uuid, btrfs_metadata_uuid_show);
@@ -905,9 +902,9 @@ static ssize_t btrfs_checksum_show(struct kobject *kobj,struct btrfs_fs_info *fs_info =to_fs_info (kobj);u16 csum_type =btrfs_super_csum_type (fs_info->super_copy); -return scnprintf (buf,PAGE_SIZE ,"%s (%s)\n" , -btrfs_super_csum_name (csum_type), -crypto_shash_driver_name (fs_info->csum_shash)); +return sysfs_emit (buf,"%s (%s)\n" , +btrfs_super_csum_name (csum_type), +crypto_shash_driver_name (fs_info->csum_shash)); } BTRFS_ATTR(, checksum, btrfs_checksum_show);
@@ -944,7 +941,7 @@ static ssize_t btrfs_exclusive_operation_show(struct kobject *kobj, str ="UNKNOWN\n" ;break ; } -return scnprintf (buf,PAGE_SIZE ,"%s" , str); +return sysfs_emit (buf,"%s" , str); } BTRFS_ATTR(, exclusive_operation, btrfs_exclusive_operation_show);
@@ -953,7 +950,7 @@ static ssize_t btrfs_generation_show(struct kobject *kobj, {struct btrfs_fs_info *fs_info =to_fs_info (kobj); -return scnprintf (buf,PAGE_SIZE ,"%llu\n" , fs_info->generation); +return sysfs_emit (buf,"%llu\n" , fs_info->generation); } BTRFS_ATTR(, generation, btrfs_generation_show);
@@ -1031,8 +1028,7 @@ static ssize_t btrfs_bg_reclaim_threshold_show(struct kobject *kobj,struct btrfs_fs_info *fs_info =to_fs_info (kobj);ssize_t ret; - ret =scnprintf (buf,PAGE_SIZE ,"%d\n" , -READ_ONCE (fs_info->bg_reclaim_threshold)); + ret =sysfs_emit (buf,"%d\n" ,READ_ONCE (fs_info->bg_reclaim_threshold));return ret; }
@@ -1474,7 +1470,7 @@ static ssize_t btrfs_devinfo_in_fs_metadata_show(struct kobject *kobj, val = !!test_bit (BTRFS_DEV_STATE_IN_FS_METADATA , &device->dev_state); -return scnprintf (buf,PAGE_SIZE ,"%d\n" , val); +return sysfs_emit (buf,"%d\n" , val); }BTRFS_ATTR (devid, in_fs_metadata, btrfs_devinfo_in_fs_metadata_show);
@@ -1487,7 +1483,7 @@ static ssize_t btrfs_devinfo_missing_show(struct kobject *kobj, val = !!test_bit (BTRFS_DEV_STATE_MISSING , &device->dev_state); -return scnprintf (buf,PAGE_SIZE ,"%d\n" , val); +return sysfs_emit (buf,"%d\n" , val); }BTRFS_ATTR (devid, missing, btrfs_devinfo_missing_show);
@@ -1501,7 +1497,7 @@ static ssize_t btrfs_devinfo_replace_target_show(struct kobject *kobj, val = !!test_bit (BTRFS_DEV_STATE_REPLACE_TGT , &device->dev_state); -return scnprintf (buf,PAGE_SIZE ,"%d\n" , val); +return sysfs_emit (buf,"%d\n" , val); }BTRFS_ATTR (devid, replace_target, btrfs_devinfo_replace_target_show);
@@ -1512,8 +1508,7 @@ static ssize_t btrfs_devinfo_scrub_speed_max_show(struct kobject *kobj, struct btrfs_device *device = container_of(kobj, struct btrfs_device, devid_kobj); -return scnprintf (buf,PAGE_SIZE ,"%llu\n" , -READ_ONCE (device->scrub_speed_max)); +return sysfs_emit (buf,"%llu\n" ,READ_ONCE (device->scrub_speed_max)); } static ssize_t btrfs_devinfo_scrub_speed_max_store(struct kobject *kobj,
@@ -1545,7 +1540,7 @@ static ssize_t btrfs_devinfo_writeable_show(struct kobject *kobj, val = !!test_bit (BTRFS_DEV_STATE_WRITEABLE , &device->dev_state); -return scnprintf (buf,PAGE_SIZE ,"%d\n" , val); +return sysfs_emit (buf,"%d\n" , val); }BTRFS_ATTR (devid, writeable, btrfs_devinfo_writeable_show);
@@ -1556,14 +1551,14 @@ static ssize_t btrfs_devinfo_error_stats_show(struct kobject *kobj, devid_kobj);if (!device->dev_stats_valid) -return scnprintf (buf,PAGE_SIZE ,"invalid\n" ); +return sysfs_emit (buf,"invalid\n" );/* * Print all at once so we get a snapshot of all values from the same * time. Keep them in sync and in order of definition of * btrfs_dev_stat_values. */ -return scnprintf (buf,PAGE_SIZE , +return sysfs_emit (buf,"write_errs %d\n" "read_errs %d\n" "flush_errs %d\n"
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 148/168 btrfs: sysfs: fix direct super block member reads
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit fca432e73db2bec0fdbfbf6d98d3ebcd5388a977 ]
The following sysfs entries are reading super block member directly, which can have a different endian and cause wrong values:
- sys/fs/btrfs/<uuid>/nodesize
- sys/fs/btrfs/<uuid>/sectorsize
- sys/fs/btrfs/<uuid>/clone_alignment
Thankfully those values (nodesize and sectorsize) are always aligned inside the btrfs_super_block, so it won't trigger unaligned read errors, just endian problems.
Fix them by using the native cached members instead.
--- fs/btrfs/sysfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/btrfs/sysfs.c +3 -3
@@ -821,7 +821,7 @@ static ssize_t btrfs_nodesize_show(struct kobject *kobj, {struct btrfs_fs_info *fs_info =to_fs_info (kobj); -return sysfs_emit (buf,"%u\n" , fs_info->super_copy->nodesize); +return sysfs_emit (buf,"%u\n" , fs_info->nodesize); } BTRFS_ATTR(, nodesize, btrfs_nodesize_show);
@@ -831,7 +831,7 @@ static ssize_t btrfs_sectorsize_show(struct kobject *kobj, {struct btrfs_fs_info *fs_info =to_fs_info (kobj); -return sysfs_emit (buf,"%u\n" , fs_info->super_copy->sectorsize); +return sysfs_emit (buf,"%u\n" , fs_info->sectorsize); } BTRFS_ATTR(, sectorsize, btrfs_sectorsize_show);
@@ -841,7 +841,7 @@ static ssize_t btrfs_clone_alignment_show(struct kobject *kobj, {struct btrfs_fs_info *fs_info =to_fs_info (kobj); -return sysfs_emit (buf,"%u\n" , fs_info->super_copy->sectorsize); +return sysfs_emit (buf,"%u\n" , fs_info->sectorsize); } BTRFS_ATTR(, clone_alignment, btrfs_clone_alignment_show);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 149/168 wifi: mac80211: wake the queues in case of failure in resume
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit 220bf000530f9b1114fa2a1022a871c7ce8a0b38 ]
In case we fail to resume, we'll WARN with
"Hardware became unavailable during restart." and we'll wait until user space does something. It'll typically bring the interface down and up to recover. This won't work though because the queues are still stopped on IEEE80211_QUEUE_STOP_REASON_SUSPEND reason.
Make sure we clear that reason so that we give a chance to the recovery to succeed.
--- net/mac80211/util.c | 3 +++ 1 file changed, 3 insertions(+)
net/mac80211/util.c +3 -0
@@ -2374,6 +2374,9 @@ int ieee80211_reconfig(struct ieee80211_local *local)WARN (1 ,"Hardware became unavailable upon resume. This could be a software issue prior to suspend or a hardware issue.\n" ); else WARN(1, "Hardware became unavailable during restart.\n"); +ieee80211_wake_queues_by_reason (hw,IEEE80211_MAX_QUEUE_MAP , +IEEE80211_QUEUE_STOP_REASON_SUSPEND , + false);ieee80211_handle_reconfig_failure (local);return res; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 150/168 drm/amdkfd: Correct the migration DMA map direction
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prike Liang <[email protected]>
[ Upstream commit 5c3de6b02d38eb9386edf50490e050bb44398e40 ]
The SVM DMA device map direction should be set the same as the DMA unmap setting, otherwise the DMA core will report the following warning.
Before finialize this solution, there're some discussion on the DMA mapping type(stream-based or coherent) in this KFD migration case, followed by https://lore.kernel.org/all/04d4ab32
[email protected]/T/.
As there's no dma_sync_single_for_*() in the DMA buffer accessed that because this migration operation should be sync properly and automatically. Give that there's might not be a performance problem in various cache sync policy of DMA sync. Therefore, in order to simplify the DMA direction setting alignment, let's set the DMA map direction as BIDIRECTIONAL.
[ 150.834218] WARNING: CPU: 8 PID: 1812 at kernel/dma/debug.c:1028 check_unmap+0x1cc/0x930 [ 150.834225] Modules linked in: amdgpu(OE) amdxcp drm_exec(OE) gpu_sched drm_buddy(OE) drm_ttm_helper(OE) ttm(OE) drm_suballoc_helper(OE) drm_display_helper(OE) drm_kms_helper(OE) i2c_algo_bit rpcsec_gss_krb5 auth_rpcgss nfsv4 nfs lockd grace netfs xt_conntrack xt_MASQUERADE nf_conntrack_netlink xfrm_user xfrm_algo iptable_nat xt_addrtype iptable_filter br_netfilter nvme_fabrics overlay nfnetlink_cttimeout nfnetlink openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c bridge stp llc sch_fq_codel intel_rapl_msr amd_atl intel_rapl_common snd_hda_codec_realtek snd_hda_codec_generic snd_hda_scodec_component snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg edac_mce_amd snd_pci_acp6x snd_hda_codec snd_acp_config snd_hda_core snd_hwdep snd_soc_acpi kvm_amd sunrpc snd_pcm kvm binfmt_misc snd_seq_midi crct10dif_pclmul snd_seq_midi_event ghash_clmulni_intel sha512_ssse3 snd_rawmidi nls_iso8859_1 sha256_ssse3 sha1_ssse3 snd_seq aesni_intel snd_seq_device crypto_simd snd_timer cryptd input_leds [ 150.834310] wmi_bmof serio_raw k10temp rapl snd sp5100_tco ipmi_devintf soundcore ccp ipmi_msghandler cm32181 industrialio mac_hid msr parport_pc ppdev lp parport efi_pstore drm(OE) ip_tables x_tables pci_stub crc32_pclmul nvme ahci libahci i2c_piix4 r8169 nvme_core i2c_designware_pci realtek i2c_ccgx_ucsi video wmi hid_generic cdc_ether usbnet usbhid hid r8152 mii [ 150.834354] CPU: 8 PID: 1812 Comm: rocrtst64 Tainted: G OE 6.10.0-custom #492 [ 150.834358] Hardware name: AMD Majolica-RN/Majolica-RN, BIOS RMJ1009A 06/13/2021 [ 150.834360] RIP: 0010:check_unmap+0x1cc/0x930 [ 150.834363] Code: c0 4c 89 4d c8 e8 34 bf 86 00 4c 8b 4d c8 4c 8b 45 c0 48 8b 4d b8 48 89 c6 41 57 4c 89 ea 48 c7 c7 80 49 b4 84 e8 b4 81 f3 ff <0f> 0b 48 c7 c7 04 83 ac 84 e8 76 ba fc ff 41 8b 76 4c 49 8d 7e 50 [ 150.834365] RSP: 0018:ffffaac5023739e0 EFLAGS: 00010086 [ 150.834368] RAX: 0000000000000000 RBX: ffffffff8566a2e0 RCX: 0000000000000027 [ 150.834370] RDX: ffff8f6a8f621688 RSI: 0000000000000001 RDI: ffff8f6a8f621680 [ 150.834372] RBP: ffffaac502373a30 R08: 00000000000000c9 R09: ffffaac502373850 [ 150.834373] R10: ffffaac502373848 R11: ffffffff84f46328 R12: ffffaac502373a40 [ 150.834375] R13: ffff8f6741045330 R14: ffff8f6741a77700 R15: ffffffff84ac831b [ 150.834377] FS: 00007faf0fc94c00(0000) GS:ffff8f6a8f600000(0000) knlGS:0000000000000000 [ 150.834379] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 150.834381] CR2: 00007faf0b600020 CR3: 000000010a52e000 CR4: 0000000000350ef0 [ 150.834383] Call Trace: [ 150.834385] <TASK> [ 150.834387] ? show_regs+0x6d/0x80 [ 150.834393] ? __warn+0x8c/0x140 [ 150.834397] ? check_unmap+0x1cc/0x930 [ 150.834400] ? report_bug+0x193/0x1a0 [ 150.834406] ? handle_bug+0x46/0x80 [ 150.834410] ? exc_invalid_op+0x1d/0x80 [ 150.834413] ? asm_exc_invalid_op+0x1f/0x30 [ 150.834420] ? check_unmap+0x1cc/0x930 [ 150.834425] debug_dma_unmap_page+0x86/0x90 [ 150.834431] ? srso_return_thunk+0x5/0x5f [ 150.834435] ? rmap_walk+0x28/0x50 [ 150.834438] ? srso_return_thunk+0x5/0x5f [ 150.834441] ? remove_migration_ptes+0x79/0x80 [ 150.834445] ? srso_return_thunk+0x5/0x5f [ 150.834448] dma_unmap_page_attrs+0xfa/0x1d0 [ 150.834453] svm_range_dma_unmap_dev+0x8a/0xf0 [amdgpu] [ 150.834710] svm_migrate_ram_to_vram+0x361/0x740 [amdgpu] [ 150.834914] svm_migrate_to_vram+0xa8/0xe0 [amdgpu] [ 150.835111] svm_range_set_attr+0xff2/0x1450 [amdgpu] [ 150.835311] svm_ioctl+0x4a/0x50 [amdgpu] [ 150.835510] kfd_ioctl_svm+0x54/0x90 [amdgpu] [ 150.835701] kfd_ioctl+0x3c2/0x530 [amdgpu] [ 150.835888] ? __pfx_kfd_ioctl_svm+0x10/0x10 [amdgpu] [ 150.836075] ? srso_return_thunk+0x5/0x5f [ 150.836080] ? tomoyo_file_ioctl+0x20/0x30 [ 150.836086] __x64_sys_ioctl+0x9c/0xd0 [ 150.836091] x64_sys_call+0x1219/0x20d0 [ 150.836095] do_syscall_64+0x51/0x120 [ 150.836098] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 150.836102] RIP: 0033:0x7faf0f11a94f [ 150.836105] Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <41> 89 c0 3d 00 f0 ff ff 77 1f 48 8b 44 24 18 64 48 2b 04 25 28 00 [ 150.836107] RSP: 002b:00007ffeced26bc0 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 [ 150.836110] RAX: ffffffffffffffda RBX: 000055c683528fb0 RCX: 00007faf0f11a94f [ 150.836112] RDX: 00007ffeced26c60 RSI: 00000000c0484b20 RDI: 0000000000000003 [ 150.836114] RBP: 00007ffeced26c50 R08: 0000000000000000 R09: 0000000000000001 [ 150.836115] R10: 0000000000000032 R11: 0000000000000246 R12: 000055c683528bd0 [ 150.836117] R13: 0000000000000000 R14: 0000000000000021 R15: 0000000000000000 [ 150.836122] </TASK> [ 150.836124] ---[ end trace 0000000000000000 ]---
--- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +2 -2
@@ -302,7 +302,7 @@ svm_migrate_copy_to_vram(struct amdgpu_device *adev, struct svm_range *prange, migrate->dst[i] =migrate_pfn (migrate->dst[i]); migrate->dst[i] |=MIGRATE_PFN_LOCKED ; src[i] =dma_map_page (dev, spage,0 ,PAGE_SIZE , -DMA_TO_DEVICE ); +DMA_BIDIRECTIONAL ); r =dma_mapping_error (dev, src[i]);if (r) {pr_debug ("failed %d dma_map_page\n" , r);
@@ -569,7 +569,7 @@ svm_migrate_copy_to_ram(struct amdgpu_device *adev, struct svm_range *prange, goto out_oom; } - dst[i] =dma_map_page (dev, dpage,0 ,PAGE_SIZE ,DMA_FROM_DEVICE ); + dst[i] =dma_map_page (dev, dpage,0 ,PAGE_SIZE ,DMA_BIDIRECTIONAL ); r =dma_mapping_error (dev, dst[i]);if (r) {pr_debug ("failed %d dma_map_page\n" , r);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 151/168 btrfs: flush delalloc workers queue before stopping cleaner kthread during unmount
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit f10bef73fb355e3fc85e63a50386798be68ff486 ]
During the unmount path, at close_ctree(), we first stop the cleaner kthread, using kthread_stop() which frees the associated task_struct, and then stop and destroy all the work queues. However after we stopped the cleaner we may still have a worker from the delalloc_workers queue running inode.c:submit_compressed_extents(), which calls btrfs_add_delayed_iput(), which in turn tries to wake up the cleaner kthread - which was already destroyed before, resulting in a use-after-free on the task_struct.
Syzbot reported this with the following stack traces:
BUG: KASAN: slab-use-after-free in __lock_acquire+0x78/0x2100 kernel/locking/lockdep.c:5089
Read of size 8 at addr ffff8880259d2818 by task kworker/u8:3/52
CPU: 1 UID: 0 PID: 52 Comm: kworker/u8:3 Not tainted 6.13.0-rc1-syzkaller-00002-gcdd30ebb1b9f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Workqueue: btrfs-delalloc btrfs_work_helper
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0x169/0x550 mm/kasan/report.c:489
kasan_report+0x143/0x180 mm/kasan/report.c:602
__lock_acquire+0x78/0x2100 kernel/locking/lockdep.c:5089
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162
class_raw_spinlock_irqsave_constructor include/linux/spinlock.h:551 [inline]
try_to_wake_up+0xc2/0x1470 kernel/sched/core.c:4205
submit_compressed_extents+0xdf/0x16e0 fs/btrfs/inode.c:1615
run_ordered_work fs/btrfs/async-thread.c:288 [inline]
btrfs_work_helper+0x96f/0xc40 fs/btrfs/async-thread.c:324
process_one_work kernel/workqueue.c:3229 [inline]
process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3310
worker_thread+0x870/0xd30 kernel/workqueue.c:3391
kthread+0x2f0/0x390 kernel/kthread.c:389
ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
</TASK>
Allocated by task 2:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
unpoison_slab_object mm/kasan/common.c:319 [inline]
__kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:345
kasan_slab_alloc include/linux/kasan.h:250 [inline]
slab_post_alloc_hook mm/slub.c:4104 [inline]
slab_alloc_node mm/slub.c:4153 [inline]
kmem_cache_alloc_node_noprof+0x1d9/0x380 mm/slub.c:4205
alloc_task_struct_node kernel/fork.c:180 [inline]
dup_task_struct+0x57/0x8c0 kernel/fork.c:1113
copy_process+0x5d1/0x3d50 kernel/fork.c:2225
kernel_clone+0x223/0x870 kernel/fork.c:2807
kernel_thread+0x1bc/0x240 kernel/fork.c:2869
create_kthread kernel/kthread.c:412 [inline]
kthreadd+0x60d/0x810 kernel/kthread.c:767
ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
Freed by task 24:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:582
poison_slab_object mm/kasan/common.c:247 [inline]
__kasan_slab_free+0x59/0x70 mm/kasan/common.c:264
kasan_slab_free include/linux/kasan.h:233 [inline]
slab_free_hook mm/slub.c:2338 [inline]
slab_free mm/slub.c:4598 [inline]
kmem_cache_free+0x195/0x410 mm/slub.c:4700
put_task_struct include/linux/sched/task.h:144 [inline]
delayed_put_task_struct+0x125/0x300 kernel/exit.c:227
rcu_do_batch kernel/rcu/tree.c:2567 [inline]
rcu_core+0xaaa/0x17a0 kernel/rcu/tree.c:2823
handle_softirqs+0x2d4/0x9b0 kernel/softirq.c:554
run_ksoftirqd+0xca/0x130 kernel/softirq.c:943
smpboot_thread_fn+0x544/0xa30 kernel/smpboot.c:164
kthread+0x2f0/0x390 kernel/kthread.c:389
ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
Last potentially related work creation:
kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47
__kasan_record_aux_stack+0xac/0xc0 mm/kasan/generic.c:544
__call_rcu_common kernel/rcu/tree.c:3086 [inline]
call_rcu+0x167/0xa70 kernel/rcu/tree.c:3190
context_switch kernel/sched/core.c:5372 [inline]
__schedule+0x1803/0x4be0 kernel/sched/core.c:6756
__schedule_loop kernel/sched/core.c:6833 [inline]
schedule+0x14b/0x320 kernel/sched/core.c:6848
schedule_timeout+0xb0/0x290 kernel/time/sleep_timeout.c:75
do_wait_for_common kernel/sched/completion.c:95 [inline]
__wait_for_common kernel/sched/completion.c:116 [inline]
wait_for_common kernel/sched/completion.c:127 [inline]
wait_for_completion+0x355/0x620 kernel/sched/completion.c:148
kthread_stop+0x19e/0x640 kernel/kthread.c:712
close_ctree+0x524/0xd60 fs/btrfs/disk-io.c:4328
generic_shutdown_super+0x139/0x2d0 fs/super.c:642
kill_anon_super+0x3b/0x70 fs/super.c:1237
btrfs_kill_super+0x41/0x50 fs/btrfs/super.c:2112
deactivate_locked_super+0xc4/0x130 fs/super.c:473
cleanup_mnt+0x41f/0x4b0 fs/namespace.c:1373
task_work_run+0x24f/0x310 kernel/task_work.c:239
ptrace_notify+0x2d2/0x380 kernel/signal.c:2503
ptrace_report_syscall include/linux/ptrace.h:415 [inline]
ptrace_report_syscall_exit include/linux/ptrace.h:477 [inline]
syscall_exit_work+0xc7/0x1d0 kernel/entry/common.c:173
syscall_exit_to_user_mode_prepare kernel/entry/common.c:200 [inline]
__syscall_exit_to_user_mode_work kernel/entry/common.c:205 [inline]
syscall_exit_to_user_mode+0x24a/0x340 kernel/entry/common.c:218
do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff8880259d1e00
which belongs to the cache task_struct of size 7424
The buggy address is located 2584 bytes inside of
freed 7424-byte region [ffff8880259d1e00, ffff8880259d3b00)
The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x259d0
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff88802f4b56c1
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff88801bafe500 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000040004 00000001f5000000 ffff88802f4b56c1
head: 00fff00000000040 ffff88801bafe500 dead000000000100 dead000000000122
head: 0000000000000000 0000000000040004 00000001f5000000 ffff88802f4b56c1
head: 00fff00000000003 ffffea0000967401 ffffffffffffffff 0000000000000000
head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 12, tgid 12 (kworker/u8:1), ts 7328037942, free_ts 0
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1556
prep_new_page mm/page_alloc.c:1564 [inline]
get_page_from_freelist+0x3651/0x37a0 mm/page_alloc.c:3474
__alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4751
alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265
alloc_slab_page+0x6a/0x140 mm/slub.c:2408
allocate_slab+0x5a/0x2f0 mm/slub.c:2574
new_slab mm/slub.c:2627 [inline]
___slab_alloc+0xcd1/0x14b0 mm/slub.c:3815
__slab_alloc+0x58/0xa0 mm/slub.c:3905
__slab_alloc_node mm/slub.c:3980 [inline]
slab_alloc_node mm/slub.c:4141 [inline]
kmem_cache_alloc_node_noprof+0x269/0x380 mm/slub.c:4205
alloc_task_struct_node kernel/fork.c:180 [inline]
dup_task_struct+0x57/0x8c0 kernel/fork.c:1113
copy_process+0x5d1/0x3d50 kernel/fork.c:2225
kernel_clone+0x223/0x870 kernel/fork.c:2807
user_mode_thread+0x132/0x1a0 kernel/fork.c:2885
call_usermodehelper_exec_work+0x5c/0x230 kernel/umh.c:171
process_one_work kernel/workqueue.c:3229 [inline]
process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3310
worker_thread+0x870/0xd30 kernel/workqueue.c:3391
page_owner free stack trace missing
Memory state around the buggy address:
ffff8880259d2700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880259d2780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880259d2800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880259d2880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880259d2900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================Fix this by flushing the delalloc workers queue before stopping the cleaner kthread.
--- fs/btrfs/disk-io.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/btrfs/disk-io.c +9 -0
@@ -4405,6 +4405,15 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)* already the cleaner, but below we run all pending delayed iputs. */ btrfs_flush_workqueue (fs_info->fixup_workers); +/* +* Similar case here, we have to wait for delalloc workers before we +* proceed below and stop the cleaner kthread, otherwise we trigger a +* use-after-tree on the cleaner kthread task_struct when a delalloc +* worker running submit_compressed_extents() adds a delayed iput, which +* does a wake up on the cleaner kthread, which was already freed below +* when we call kthread_stop(). +*/ +btrfs_flush_workqueue (fs_info->delalloc_workers);/* * After we parked the cleaner kthread, ordered extents may have
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 152/168 sound: usb: enable DSD output for ddHiFi TC44C
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Ratiu <[email protected]>
[ Upstream commit c84bd6c810d1880194fea2229c7086e4b73fddc1 ]
This is a UAC 2 DAC capable of raw DSD on intf 2 alt 4:
Bus 007 Device 004: ID 262a:9302 SAVITECH Corp. TC44C Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 [unknown]
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x262a SAVITECH Corp.
idProduct 0x9302 TC44C
bcdDevice 0.01
iManufacturer 1 DDHIFI iProduct 2 TC44C iSerial 6 5000000001
.......
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 4
bNumEndpoints 2
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 32
iInterface 0
AudioStreaming Interface Descriptor:
bLength 16
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 3
bmControls 0x00
bFormatType 1
bmFormats 0x80000000
bNrChannels 2
bmChannelConfig 0x00000000
iChannelNames 0
.......
--- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/quirks.c +2 -0
@@ -1916,6 +1916,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_GET_SAMPLE_RATE),DEVICE_FLG (0x2522 ,0x0007 ,/* LH Labs Geek Out HD Audio 1V5 */ QUIRK_FLAG_SET_IFACE_FIRST ), +DEVICE_FLG (0x262a ,0x9302 ,/* ddHiFi TC44C */ +QUIRK_FLAG_DSD_RAW ),DEVICE_FLG (0x2708 ,0x0002 ,/* Audient iD14 */ QUIRK_FLAG_IGNORE_CTL_ERROR ), DEVICE_FLG(0x2912, 0x30c8, /* Audioengine D1 */
Signature · 1 line
2.39.5