6.11.5-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainercover 6.11.5-rc1 review
This is the start of the stable review cycle for the 6.11.5 release. There are 135 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, 23 Oct 2024 10:22:25 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.11.5-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.11.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.11.5-rc1
Vasiliy Kovalev <[email protected]>
ALSA: hda/conexant - Use cached pin control for Node 0x1d on HP EliteOne 1000 G2
Chris Li <[email protected]>
mm: vmscan.c: fix OOM on swap stress test
Johan Hovold <[email protected]>
serial: qcom-geni: fix receiver enable
Johan Hovold <[email protected]>
serial: qcom-geni: fix dma rx cancellation
Johan Hovold <[email protected]>
serial: qcom-geni: fix shutdown race
Johan Hovold <[email protected]>
serial: qcom-geni: revert broken hibernation support
Johan Hovold <[email protected]>
serial: qcom-geni: fix polled console initialisation
Charlie Jenkins <[email protected]>
irqchip/sifive-plic: Return error code on failure
Nam Cao <[email protected]>
irqchip/sifive-plic: Unmask interrupt in plic_irq_enable()
Marc Zyngier <[email protected]>
irqchip/gic-v4: Don't allow a VMOVP on a dying VPE
Ma Ke <[email protected]>
pinctrl: apple: check devm_kasprintf() returned value
Ma Ke <[email protected]>
pinctrl: stm32: check devm_kasprintf() returned value
Sergey Matsievskiy <[email protected]>
pinctrl: ocelot: fix system hang on level based interrupts
Javier Carrasco <[email protected]>
pinctrl: intel: platform: fix error path in device_for_each_child_node()
Harshit Mogalapalli <[email protected]>
pinctrl: nuvoton: fix a double free in ma35_pinctrl_dt_node_to_map_func()
Pawan Gupta <[email protected]>
x86/bugs: Use code segment selector for VERW operand
Longlong Xia <[email protected]>
tty: n_gsm: Fix use-after-free in gsm_cleanup_mux
Pawan Gupta <[email protected]>
x86/entry_32: Clear CPU buffers after register restore in NMI return
Pawan Gupta <[email protected]>
x86/entry_32: Do not clobber user EFLAGS.ZF
John Allen <[email protected]>
x86/CPU/AMD: Only apply Zenbleed fix for Zen2 during late microcode load
Zhang Rui <[email protected]>
x86/apic: Always explicitly disarm TSC-deadline timer
Nathan Chancellor <[email protected]>
x86/resctrl: Annotate get_mem_config() functions as __init
Takashi Iwai <[email protected]>
parport: Proper fix for array out-of-bounds access
Marek Vasut <[email protected]>
serial: imx: Update mctrl old_status on RTSD interrupt
Heiko Thiery <[email protected]>
misc: microchip: pci1xxxx: add support for NVMEM_DEVID_AUTO for OTP device
Heiko Thiery <[email protected]>
misc: microchip: pci1xxxx: add support for NVMEM_DEVID_AUTO for EEPROM device
Roger Quadros <[email protected]>
usb: dwc3: core: Fix system suspend on TI AM62 platforms
Prashanth K <[email protected]>
usb: dwc3: Wait for EndXfer completion before restoring GUSB2PHYCFG
Kevin Groeneveld <[email protected]>
usb: gadget: f_uac2: fix return value for UAC2_ATTRIBUTE_STRING store
Alan Stern <[email protected]>
USB: gadget: dummy-hcd: Fix "task hung" problem
Jonathan Marek <[email protected]>
usb: typec: qcom-pmic-typec: fix sink status being overwritten with RP_DEF
Daniele Palmas <[email protected]>
USB: serial: option: add Telit FN920C04 MBIM compositions
Benjamin B. Frost <[email protected]>
USB: serial: option: add support for Quectel EG916Q-GL
Mathias Nyman <[email protected]>
xhci: Mitigate failed set dequeue pointer commands
Mathias Nyman <[email protected]>
xhci: Fix incorrect stream context type macro
Henry Lin <[email protected]>
xhci: tegra: fix checked USB2 port number
Jeongjun Park <[email protected]>
vt: prevent kernel-infoleak in con_font_get()
Luiz Augusto von Dentz <[email protected]>
Bluetooth: btusb: Fix regression with fake CSR controllers 0a12:0001
Luiz Augusto von Dentz <[email protected]>
Bluetooth: btusb: Fix not being able to reconnect after suspend
Aaron Thompson <[email protected]>
Bluetooth: ISO: Fix multiple init when debugfs is disabled
Aaron Thompson <[email protected]>
Bluetooth: Remove debugfs directory on module init failure
Aaron Thompson <[email protected]>
Bluetooth: Call iso_exit() on module unload
Javier Carrasco <[email protected]>
iio: accel: kx022a: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
Javier Carrasco <[email protected]>
iio: adc: ad7944: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
Javier Carrasco <[email protected]>
iio: resolver: ad2s1210: add missing select (TRIGGERED_)BUFFER in Kconfig
Javier Carrasco <[email protected]>
iio: adc: ti-ads124s08: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
Javier Carrasco <[email protected]>
iio: adc: ti-lmp92064: add missing select REGMAP_SPI in Kconfig
Javier Carrasco <[email protected]>
iio: adc: ti-lmp92064: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
Javier Carrasco <[email protected]>
iio: dac: ad3552r: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
Javier Carrasco <[email protected]>
iio: proximity: mb1232: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
Javier Carrasco <[email protected]>
iio: dac: ad5766: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
Javier Carrasco <[email protected]>
iio: pressure: bm1390: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
Javier Carrasco <[email protected]>
iio: resolver: ad2s1210 add missing select REGMAP in Kconfig
Javier Carrasco <[email protected]>
iio: magnetometer: af8133j: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
Javier Carrasco <[email protected]>
iio: light: bu27008: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
Javier Carrasco <[email protected]>
iio: chemical: ens160: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
Javier Carrasco <[email protected]>
iio: frequency: adf4377: add missing select REMAP_SPI in Kconfig
Javier Carrasco <[email protected]>
iio: amplifiers: ada4250: add missing select REGMAP_SPI in Kconfig
Emil Gedenryd <[email protected]>
iio: light: opt3001: add missing full-scale range value
Javier Carrasco <[email protected]>
iio: light: veml6030: fix IIO device retrieval from embedded device
Javier Carrasco <[email protected]>
iio: light: veml6030: fix ALS sensor resolution
Christophe JAILLET <[email protected]>
iio: hid-sensors: Fix an error handling path in _hid_sensor_set_report_latency()
Javier Carrasco <[email protected]>
iio: adc: ti-ads8688: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
Javier Carrasco <[email protected]>
iio: dac: stm32-dac-core: add missing select REGMAP_MMIO in Kconfig
Javier Carrasco <[email protected]>
iio: dac: ltc1660: add missing select REGMAP_SPI in Kconfig
Javier Carrasco <[email protected]>
iio: dac: ad5770r: add missing select REGMAP_SPI in Kconfig
Mohammed Anees <[email protected]>
drm/amdgpu: prevent BO_HANDLES error from being overwritten
Alex Deucher <[email protected]>
drm/amdgpu/swsmu: Only force workload setup on init
Alex Deucher <[email protected]>
drm/amdgpu/smu13: always apply the powersave optimization
Michael Chen <[email protected]>
drm/amdgpu/mes: fix issue of writing to the same log buffer from 2 MES pipes
Nikolay Kuratov <[email protected]>
drm/vmwgfx: Handle surface check failure correctly
Zack Rusin <[email protected]>
drm/vmwgfx: Cleanup kms setup without 3d
Nirmoy Das <[email protected]>
drm/xe/ufence: ufence can be signaled right after wait_woken
Matthew Auld <[email protected]>
drm/xe/xe_sync: initialise ufence.signalled
Imre Deak <[email protected]>
drm/i915/dp_mst: Don't require DSC hblank quirk for a non-DSC compatible mode
Imre Deak <[email protected]>
drm/i915/dp_mst: Handle error during DSC BW overhead/slice calculation
Ville Syrjälä <[email protected]>
drm/radeon: Fix encoder->possible_clones
Peter Wang <[email protected]>
scsi: ufs: core: Requeue aborted request
Peter Wang <[email protected]>
scsi: ufs: core: Fix the issue of ICU failure
Seunghwan Baek <[email protected]>
scsi: ufs: core: Set SDEV_OFFLINE when UFS is shut down
Ranjan Kumar <[email protected]>
scsi: mpi3mr: Validate SAS port assignments
John Edwards <[email protected]>
Input: xpad - add support for MSI Claw A1M
Yun Lu <[email protected]>
selftest: hid: add the missing tests directory
Jens Axboe <[email protected]>
io_uring/sqpoll: ensure task state is TASK_RUNNING when running task_work
Ming Lei <[email protected]>
ublk: don't allow user copy for unprivileged device
Ming Lei <[email protected]>
blk-mq: setup queue ->tag_set before initializing hctx
Jens Axboe <[email protected]>
io_uring/sqpoll: close race on waiting for sqring entries
Omar Sandoval <[email protected]>
blk-rq-qos: fix crash on rq_qos_wait vs. rq_qos_wake_function race
Stefan Kerkmann <[email protected]>
Input: xpad - add support for 8BitDo Ultimate 2C Wireless Controller
Steven Rostedt <[email protected]>
fgraph: Use CPU hotplug mechanism to initialize idle shadow stacks
Johannes Wikner <[email protected]>
x86/bugs: Do not use UNTRAIN_RET with IBPB on entry
Johannes Wikner <[email protected]>
x86/bugs: Skip RSB fill at VMEXIT
Johannes Wikner <[email protected]>
x86/entry: Have entry_ibpb() invalidate return predictions
Johannes Wikner <[email protected]>
x86/cpufeatures: Add a IBPB_NO_RET BUG flag
Jim Mattson <[email protected]>
x86/cpufeatures: Define X86_FEATURE_AMD_IBPB_RET
Michael Mueller <[email protected]>
KVM: s390: Change virtual to physical address access in diag 0x258 handler
Nico Boehr <[email protected]>
KVM: s390: gaccess: Check if guest address is in memslot
Thomas Weißschuh <[email protected]>
s390/sclp_vt220: Convert newlines to CRLF instead of LFCR
Thomas Weißschuh <[email protected]>
s390/sclp: Deactivate sclp after all its users
Lu Baolu <[email protected]>
iommu/vt-d: Fix incorrect pci_for_each_dma_alias() for non-PCI devices
Paolo Abeni <[email protected]>
mptcp: prevent MPC handshake on port-based signal endpoints
Csókás, Bence <[email protected]>
net: fec: Remove duplicated code
Csókás, Bence <[email protected]>
net: fec: Move fec_ptp_read() to the top of the file
Paolo Abeni <[email protected]>
tcp: fix mptcp DSS corruption due to large pmtu xmit
Jinjie Ruan <[email protected]>
mm/damon/tests/sysfs-kunit.h: fix memory leak in damon_sysfs_test_add_targets()
Liu Shixin <[email protected]>
mm/swapfile: skip HugeTLB pages for unuse_vma
Wei Xu <[email protected]>
mm/mglru: only clear kswapd_failures if reclaimable
Yang Shi <[email protected]>
mm: khugepaged: fix the arguments order in khugepaged_collapse_file trace point
Jann Horn <[email protected]>
mm/mremap: fix move_normal_pmd/retract_page_tables race
Edward Liaw <[email protected]>
selftests/mm: fix deadlock for fork after pthread_create on ARM
Edward Liaw <[email protected]>
selftests/mm: replace atomic_bool with pthread_barrier_t
Florian Westphal <[email protected]>
lib: alloc_tag_module_unload must wait for pending kfree_rcu calls
OGAWA Hirofumi <[email protected]>
fat: fix uninitialized variable
Ryusuke Konishi <[email protected]>
nilfs2: propagate directory read errors from nilfs_find_entry()
Lorenzo Stoakes <[email protected]>
maple_tree: correct tree corruption on spanning store
Paolo Abeni <[email protected]>
selftests: mptcp: join: test for prohibited MPC to port-based endp
Jinjie Ruan <[email protected]>
net: microchip: vcap api: Fix memory leaks in vcap_api_encode_rule_test()
Oleksij Rempel <[email protected]>
net: macb: Avoid 20s boot delay by skipping MDIO bus registration for fixed-link PHY
Mark Rutland <[email protected]>
arm64: probes: Fix uprobes for big-endian kernels
Mark Rutland <[email protected]>
arm64: probes: Fix simulate_ldr*_literal()
Mark Rutland <[email protected]>
arm64: probes: Remove broken LDR (literal) uprobe support
Josua Mayer <[email protected]>
arm64: dts: marvell: cn9130-sr-som: fix cp0 mdio pin numbers
Jakub Sitnicki <[email protected]>
udp: Compute L4 checksum as usual when not segmenting the skb
Jinjie Ruan <[email protected]>
posix-clock: Fix missing timespec64 check in pc_clock_settime()
Wei Fang <[email protected]>
net: enetc: add missing static descriptor and inline keyword
Wei Fang <[email protected]>
net: enetc: disable NAPI after all rings are disabled
Wei Fang <[email protected]>
net: enetc: disable Tx BD rings after they are empty
Wei Fang <[email protected]>
net: enetc: block concurrent XDP transmissions during ring reconfiguration
Wei Fang <[email protected]>
net: enetc: remove xdp_drops statistic from enetc_xdp_drop()
Matthieu Baerts (NGI0) <[email protected]>
mptcp: pm: fix UaF read in mptcp_pm_nl_rm_addr_or_subflow
Vasiliy Kovalev <[email protected]>
ALSA: hda/conexant - Fix audio routing for HP EliteOne 1000 G2
Zhu Jun <[email protected]>
ALSA: scarlett2: Add error check after retrieving PEQ filter values
Namjae Jeon <[email protected]>
ksmbd: fix user-after-free from session log off
Roi Martin <[email protected]>
btrfs: fix uninitialized pointer free on read_alloc_one_name() error
Roi Martin <[email protected]>
btrfs: fix uninitialized pointer free in add_inode_ref()
-------------
Diffstat:
Makefile | 4 +- arch/arm64/boot/dts/marvell/cn9130-sr-som.dtsi | 2 +- arch/arm64/include/asm/uprobes.h | 8 +- arch/arm64/kernel/probes/decode-insn.c | 16 ++- arch/arm64/kernel/probes/simulate-insn.c | 18 ++-- arch/arm64/kernel/probes/uprobes.c | 4 +- arch/s390/kvm/diag.c | 2 +- arch/s390/kvm/gaccess.c | 4 + arch/s390/kvm/gaccess.h | 14 +-- arch/x86/entry/entry.S | 5 + arch/x86/entry/entry_32.S | 6 +- arch/x86/include/asm/cpufeatures.h | 4 +- arch/x86/include/asm/nospec-branch.h | 11 +- arch/x86/kernel/apic/apic.c | 14 ++- arch/x86/kernel/cpu/amd.c | 3 +- arch/x86/kernel/cpu/bugs.c | 32 ++++++ arch/x86/kernel/cpu/common.c | 3 + arch/x86/kernel/cpu/resctrl/core.c | 4 +- block/blk-mq.c | 8 +- block/blk-rq-qos.c | 2 +- drivers/block/ublk_drv.c | 11 +- drivers/bluetooth/btusb.c | 27 ++--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 4 +- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 6 +- .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 22 ++-- drivers/gpu/drm/i915/display/intel_dp_mst.c | 40 +++++-- drivers/gpu/drm/radeon/radeon_encoders.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 30 +----- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 9 +- drivers/gpu/drm/xe/xe_sync.c | 2 +- drivers/gpu/drm/xe/xe_wait_user_fence.c | 3 - drivers/iio/accel/Kconfig | 2 + drivers/iio/adc/Kconfig | 9 ++ drivers/iio/amplifiers/Kconfig | 1 + drivers/iio/chemical/Kconfig | 2 + .../iio/common/hid-sensors/hid-sensor-trigger.c | 2 +- drivers/iio/dac/Kconfig | 7 ++ drivers/iio/frequency/Kconfig | 1 + drivers/iio/light/Kconfig | 2 + drivers/iio/light/opt3001.c | 4 + drivers/iio/light/veml6030.c | 5 +- drivers/iio/magnetometer/Kconfig | 2 + drivers/iio/pressure/Kconfig | 3 + drivers/iio/proximity/Kconfig | 2 + drivers/iio/resolver/Kconfig | 3 + drivers/input/joystick/xpad.c | 3 + drivers/iommu/intel/iommu.c | 4 +- drivers/irqchip/irq-gic-v3-its.c | 18 ++-- drivers/irqchip/irq-sifive-plic.c | 29 ++--- drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c | 2 + drivers/net/ethernet/cadence/macb_main.c | 14 ++- drivers/net/ethernet/freescale/enetc/enetc.c | 56 +++++++--- drivers/net/ethernet/freescale/enetc/enetc.h | 1 + drivers/net/ethernet/freescale/fec_ptp.c | 58 +++++----- .../net/ethernet/microchip/vcap/vcap_api_kunit.c | 2 + drivers/parport/procfs.c | 22 ++-- drivers/pinctrl/intel/pinctrl-intel-platform.c | 3 +- drivers/pinctrl/nuvoton/pinctrl-ma35.c | 2 +- drivers/pinctrl/pinctrl-apple-gpio.c | 3 + drivers/pinctrl/pinctrl-ocelot.c | 8 +- drivers/pinctrl/stm32/pinctrl-stm32.c | 9 +- drivers/s390/char/sclp.c | 3 +- drivers/s390/char/sclp_vt220.c | 4 +- drivers/scsi/mpi3mr/mpi3mr.h | 4 +- drivers/scsi/mpi3mr/mpi3mr_transport.c | 42 +++++--- drivers/tty/n_gsm.c | 2 + drivers/tty/serial/imx.c | 15 +++ drivers/tty/serial/qcom_geni_serial.c | 91 ++++++++-------- drivers/tty/vt/vt.c | 2 +- drivers/ufs/core/ufs-mcq.c | 15 +-- drivers/ufs/core/ufshcd.c | 24 ++--- drivers/usb/dwc3/core.c | 19 ++++ drivers/usb/dwc3/core.h | 3 + drivers/usb/dwc3/gadget.c | 10 +- drivers/usb/gadget/function/f_uac2.c | 6 +- drivers/usb/gadget/udc/dummy_hcd.c | 20 +++- drivers/usb/host/xhci-ring.c | 2 +- drivers/usb/host/xhci-tegra.c | 2 +- drivers/usb/host/xhci.h | 2 +- drivers/usb/serial/option.c | 8 ++ drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c | 1 - fs/btrfs/tree-log.c | 6 +- fs/fat/namei_vfat.c | 2 +- fs/nilfs2/dir.c | 48 +++++---- fs/nilfs2/namei.c | 39 ++++--- fs/nilfs2/nilfs.h | 2 +- fs/smb/server/mgmt/user_session.c | 26 ++++- fs/smb/server/mgmt/user_session.h | 4 + fs/smb/server/server.c | 2 + fs/smb/server/smb2pdu.c | 8 +- include/linux/fsl/enetc_mdio.h | 3 +- include/linux/irqchip/arm-gic-v4.h | 4 +- include/trace/events/huge_memory.h | 4 +- include/uapi/linux/ublk_cmd.h | 8 +- io_uring/io_uring.h | 10 +- kernel/time/posix-clock.c | 3 + kernel/trace/fgraph.c | 28 +++-- lib/codetag.c | 3 + lib/maple_tree.c | 12 +-- mm/damon/sysfs-test.h | 1 + mm/khugepaged.c | 2 +- mm/mremap.c | 11 +- mm/swapfile.c | 2 +- mm/vmscan.c | 6 +- net/bluetooth/af_bluetooth.c | 3 + net/bluetooth/iso.c | 6 +- net/ipv4/tcp_output.c | 4 +- net/ipv4/udp.c | 4 +- net/ipv6/udp.c | 4 +- net/mptcp/mib.c | 1 + net/mptcp/mib.h | 1 + net/mptcp/pm_netlink.c | 3 +- net/mptcp/protocol.h | 1 + net/mptcp/subflow.c | 11 ++ sound/pci/hda/patch_conexant.c | 19 ++++ sound/usb/mixer_scarlett2.c | 2 + tools/testing/selftests/hid/Makefile | 1 + tools/testing/selftests/mm/uffd-common.c | 5 +- tools/testing/selftests/mm/uffd-common.h | 3 +- tools/testing/selftests/mm/uffd-unit-tests.c | 21 ++-- tools/testing/selftests/net/mptcp/mptcp_join.sh | 117 +++++++++++++++------ 122 files changed, 863 insertions(+), 453 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/135 btrfs: fix uninitialized pointer free in add_inode_ref()
6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roi Martin <[email protected]>
commit 66691c6e2f18d2aa4b22ffb624b9bdc97e9979e4 upstream.
The add_inode_ref() function does not initialize the "name" struct when it is declared. If any of the following calls to "read_one_inode() returns NULL,
dir = read_one_inode(root, parent_objectid);
if (!dir) {
ret = -ENOENT;
goto out;
}
inode = read_one_inode(root, inode_objectid);
if (!inode) {
ret = -EIO;
goto out;
}then "name.name" would be freed on "out" before being initialized.
out:
... kfree(name.name);
This issue was reported by Coverity with CID 1526744.
--- fs/btrfs/tree-log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/tree-log.c +1 -1
@@ -1374,7 +1374,7 @@ static noinline int add_inode_ref(structstruct inode *inode =NULL ;unsigned long ref_ptr;unsigned long ref_end; -struct fscrypt_str name; +struct fscrypt_str name = {0 };int ret;int log_ref_ver =0 ;u64 parent_objectid;
Greg Kroah-Hartman
maintainerPATCH 2/135 btrfs: fix uninitialized pointer free on read_alloc_one_name() error
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roi Martin <[email protected]>
commit 2ab5e243c2266c841e0f6904fad1514b18eaf510 upstream.
The function read_alloc_one_name() does not initialize the name field of the passed fscrypt_str struct if kmalloc fails to allocate the corresponding buffer. Thus, it is not guaranteed that fscrypt_str.name is initialized when freeing it.
This is a follow-up to the linked patch that fixes the remaining instances of the bug introduced by commit e43eec81c516 ("btrfs: use struct qstr instead of name and namelen pairs").
--- fs/btrfs/tree-log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/tree-log.c +2 -2
@@ -1845,7 +1845,7 @@ static noinline int replay_one_name(strustruct btrfs_dir_item *di, struct btrfs_key *key) { - struct fscrypt_str name; + struct fscrypt_str name = { 0 };struct btrfs_dir_item *dir_dst_di;struct btrfs_dir_item *index_dst_di;bool dir_dst_matches = false;
@@ -2125,7 +2125,7 @@ static noinline int check_item_in_log(ststruct extent_buffer *eb;int slot;struct btrfs_dir_item *di; -struct fscrypt_str name; +struct fscrypt_str name = {0 };struct inode *inode =NULL ;struct btrfs_key location;
Greg Kroah-Hartman
maintainerPATCH 3/135 ksmbd: fix user-after-free from session log off
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
commit 7aa8804c0b67b3cb263a472d17f2cb50d7f1a930 upstream.
There is racy issue between smb2 session log off and smb2 session setup. It will cause user-after-free from session log off.
This add session_lock when setting SMB2_SESSION_EXPIRED and referece count to session struct not to free session while it is being used.
--- fs/smb/server/mgmt/user_session.c | 26 +++++++++++++++++++++----- fs/smb/server/mgmt/user_session.h | 4 ++++ fs/smb/server/server.c | 2 ++ fs/smb/server/smb2pdu.c | 8 +++++++- 4 files changed, 34 insertions(+), 6 deletions(-)
fs/smb/server/mgmt/user_session.c +21 -5
@@ -177,9 +177,10 @@ static void ksmbd_expire_session(structdown_write (&conn->session_lock);xa_for_each (&conn->sessions, id, sess) { -if (sess->state !=SMB2_SESSION_VALID || -time_after (jiffies, - sess->last_active +SMB2_SESSION_TIMEOUT )) { +if (atomic_read (&sess->refcnt) ==0 && + (sess->state !=SMB2_SESSION_VALID || +time_after (jiffies, + sess->last_active +SMB2_SESSION_TIMEOUT ))) {xa_erase (&conn->sessions, sess->id);hash_del (&sess->hlist);ksmbd_session_destroy (sess);
@@ -269,8 +270,6 @@ struct ksmbd_session *ksmbd_session_lookdown_read (&sessions_table_lock); sess =__session_lookup (id); -if (sess) - sess->last_active = jiffies;up_read (&sessions_table_lock);return sess;
@@ -289,6 +288,22 @@ struct ksmbd_session *ksmbd_session_lookreturn sess; } +void ksmbd_user_session_get (struct ksmbd_session *sess) +{ +atomic_inc (&sess->refcnt); +} + +void ksmbd_user_session_put (struct ksmbd_session *sess) +{ +if (!sess) +return ; + +if (atomic_read (&sess->refcnt) <=0 ) +WARN_ON (1 ); +else +atomic_dec (&sess->refcnt); +} +struct preauth_session *ksmbd_preauth_session_alloc (struct ksmbd_conn *conn,u64 sess_id) {
@@ -393,6 +408,7 @@ static struct ksmbd_session *__session_cxa_init (&sess->rpc_handle_list); sess->sequence_number =1 ;rwlock_init (&sess->tree_conns_lock); +atomic_set (&sess->refcnt,1 ); ret =__init_smb2_session (sess);if (ret)
fs/smb/server/mgmt/user_session.h +4 -0
@@ -61,6 +61,8 @@ struct ksmbd_session {struct ksmbd_file_table file_table;unsigned long last_active;rwlock_t tree_conns_lock; + +atomic_t refcnt; };static inline int test_session_flag (struct ksmbd_session *sess,int bit)
@@ -104,4 +106,6 @@ void ksmbd_release_tree_conn_id(struct kint ksmbd_session_rpc_open (struct ksmbd_session *sess,char *rpc_name);void ksmbd_session_rpc_close (struct ksmbd_session *sess,int id);int ksmbd_session_rpc_method (struct ksmbd_session *sess,int id); +void ksmbd_user_session_get (struct ksmbd_session *sess); +void ksmbd_user_session_put (struct ksmbd_session *sess);#endif /* __USER_SESSION_MANAGEMENT_H__ */
fs/smb/server/server.c +2 -0
@@ -238,6 +238,8 @@ static void __handle_ksmbd_work(struct k }while (is_chained == true); send: +if (work->sess) +ksmbd_user_session_put (work->sess);if (work->tcon)ksmbd_tree_connect_put (work->tcon);smb3_preauth_hash_rsp (work);
fs/smb/server/smb2pdu.c +7 -1
@@ -605,8 +605,10 @@ int smb2_check_user_session(struct ksmbd/* Check for validity of user session */ work->sess =ksmbd_session_lookup_all (conn, sess_id); -if (work->sess) +if (work->sess) { +ksmbd_user_session_get (work->sess);return 1 ; + }ksmbd_debug (SMB ,"Invalid user session, Uid %llu\n" , sess_id);return -ENOENT ; }
@@ -1746,6 +1748,7 @@ int smb2_sess_setup(struct ksmbd_work *w } 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 )) {
@@ -1772,6 +1775,7 @@ int smb2_sess_setup(struct ksmbd_work *w } conn->binding = false; +ksmbd_user_session_get (sess); } work->sess = sess;
@@ -2232,7 +2236,9 @@ int smb2_session_logoff(struct ksmbd_wor }ksmbd_destroy_file_table (&sess->file_table); +down_write (&conn->session_lock); sess->state =SMB2_SESSION_EXPIRED ; +up_write (&conn->session_lock);ksmbd_free_user (sess->user); sess->user =NULL ;
Greg Kroah-Hartman
maintainerPATCH 4/135 ALSA: scarlett2: Add error check after retrieving PEQ filter values
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Jun <[email protected]>
commit fd5f14c126a65f27ada3f192b982c6797cc302c7 upstream.
Add error check after retrieving PEQ filter values in scarlett2_update_filter_values that ensure function returns error if PEQ filter value retrieval fails.
--- sound/usb/mixer_scarlett2.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/mixer_scarlett2.c +2 -0
@@ -5613,6 +5613,8 @@ static int scarlett2_update_filter_values(struct usb_mixer_interface *mixer) info->peq_flt_total_count *SCARLETT2_BIQUAD_COEFFS , peq_flt_values); +if (err <0 ) +return err;for (i =0 , dst_idx =0 ; i < info->dsp_input_count; i++) { src_idx = i *
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 5/135 ALSA: hda/conexant - Fix audio routing for HP EliteOne 1000 G2
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasiliy Kovalev <[email protected]>
commit 9988844c457f6f17fb2e75aa000b6c3b1b673bb9 upstream.
There is a problem with simultaneous audio output to headphones and speakers, and when headphones are turned off, the speakers also turn off and do not turn them on.
However, it was found that if you boot linux immediately after windows, there are no such problems. When comparing alsa-info, the only difference is the different configuration of Node 0x1d:
working conf. (windows): Pin-ctls: 0x80: HP
not working (linux): Pin-ctls: 0xc0: OUT HP
This patch disable the AC_PINCTL_OUT_EN bit of Node 0x1d and fixes the described problem.
--- sound/pci/hda/patch_conexant.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
sound/pci/hda/patch_conexant.c +19 -0
@@ -303,6 +303,7 @@ enum {CXT_FIXUP_HP_SPECTRE ,CXT_FIXUP_HP_GATE_MIC ,CXT_FIXUP_MUTE_LED_GPIO , +CXT_FIXUP_HP_ELITEONE_OUT_DIS ,CXT_FIXUP_HP_ZBOOK_MUTE_LED ,CXT_FIXUP_HEADSET_MIC , CXT_FIXUP_HP_MIC_NO_PRESENCE,
@@ -320,6 +321,19 @@ static void cxt_fixup_stereo_dmic(struct spec->gen.inv_dmic_split =1 ; } +/* fix widget control pin settings */ +static void cxt_fixup_update_pinctl (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +if (action ==HDA_FIXUP_ACT_PROBE ) { +/* Unset OUT_EN for this Node pin, leaving only HP_EN. +* This is the value stored in the codec register after +* the correct initialization of the previous windows boot. +*/ +snd_hda_set_pin_ctl (codec,0x1d ,AC_PINCTL_HP_EN ); + } +} +static void cxt5066_increase_mic_boost (struct hda_codec *codec,const struct hda_fixup *fix,int action) {
@@ -971,6 +985,10 @@ static const struct hda_fixup cxt_fixups .type = HDA_FIXUP_FUNC, .v.func = cxt_fixup_mute_led_gpio, }, + [CXT_FIXUP_HP_ELITEONE_OUT_DIS] = { + .type = HDA_FIXUP_FUNC, + .v.func = cxt_fixup_update_pinctl, + }, [CXT_FIXUP_HP_ZBOOK_MUTE_LED] = { .type = HDA_FIXUP_FUNC, .v.func = cxt_fixup_hp_zbook_mute_led,
@@ -1061,6 +1079,7 @@ static const struct snd_pci_quirk cxt506SND_PCI_QUIRK (0x103c ,0x83b2 ,"HP EliteBook 840 G5" ,CXT_FIXUP_HP_DOCK ),SND_PCI_QUIRK (0x103c ,0x83b3 ,"HP EliteBook 830 G5" ,CXT_FIXUP_HP_DOCK ),SND_PCI_QUIRK (0x103c ,0x83d3 ,"HP ProBook 640 G4" ,CXT_FIXUP_HP_DOCK ), +SND_PCI_QUIRK (0x103c ,0x83e5 ,"HP EliteOne 1000 G2" ,CXT_FIXUP_HP_ELITEONE_OUT_DIS ),SND_PCI_QUIRK (0x103c ,0x8402 ,"HP ProBook 645 G4" ,CXT_FIXUP_MUTE_LED_GPIO ),SND_PCI_QUIRK (0x103c ,0x8427 ,"HP ZBook Studio G5" ,CXT_FIXUP_HP_ZBOOK_MUTE_LED ), SND_PCI_QUIRK(0x103c, 0x844f, "HP ZBook Studio G5", CXT_FIXUP_HP_ZBOOK_MUTE_LED),
Greg Kroah-Hartman
maintainerPATCH 6/135 mptcp: pm: fix UaF read in mptcp_pm_nl_rm_addr_or_subflow
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 7decd1f5904a489d3ccdcf131972f94645681689 upstream.
Syzkaller reported this splat:
==================================================================
BUG: KASAN: slab-use-after-free in mptcp_pm_nl_rm_addr_or_subflow+0xb44/0xcc0 net/mptcp/pm_netlink.c:881 Read of size 4 at addr ffff8880569ac858 by task syz.1.2799/14662 CPU: 0 UID: 0 PID: 14662 Comm: syz.1.2799 Not tainted 6.12.0-rc2-syzkaller-00307-g36c254515dc6 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: <TASK> __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:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 mptcp_pm_nl_rm_addr_or_subflow+0xb44/0xcc0 net/mptcp/pm_netlink.c:881 mptcp_pm_nl_rm_subflow_received net/mptcp/pm_netlink.c:914 [inline] mptcp_nl_remove_id_zero_address+0x305/0x4a0 net/mptcp/pm_netlink.c:1572 mptcp_pm_nl_del_addr_doit+0x5c9/0x770 net/mptcp/pm_netlink.c:1603 genl_family_rcv_msg_doit+0x202/0x2f0 net/netlink/genetlink.c:1115 genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline] genl_rcv_msg+0x565/0x800 net/netlink/genetlink.c:1210 netlink_rcv_skb+0x165/0x410 net/netlink/af_netlink.c:2551 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219 netlink_unicast_kernel net/netlink/af_netlink.c:1331 [inline] netlink_unicast+0x53c/0x7f0 net/netlink/af_netlink.c:1357 netlink_sendmsg+0x8b8/0xd70 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg net/socket.c:744 [inline] ____sys_sendmsg+0x9ae/0xb40 net/socket.c:2607 ___sys_sendmsg+0x135/0x1e0 net/socket.c:2661 __sys_sendmsg+0x117/0x1f0 net/socket.c:2690 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf7fe4579 Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f574556c EFLAGS: 00000296 ORIG_RAX: 0000000000000172 RAX: ffffffffffffffda RBX: 000000000000000b RCX: 0000000020000140 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000296 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 </TASK> Allocated by task 5387: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394 kmalloc_noprof include/linux/slab.h:878 [inline] kzalloc_noprof include/linux/slab.h:1014 [inline] subflow_create_ctx+0x87/0x2a0 net/mptcp/subflow.c:1803 subflow_ulp_init+0xc3/0x4d0 net/mptcp/subflow.c:1956 __tcp_set_ulp net/ipv4/tcp_ulp.c:146 [inline] tcp_set_ulp+0x326/0x7f0 net/ipv4/tcp_ulp.c:167 mptcp_subflow_create_socket+0x4ae/0x10a0 net/mptcp/subflow.c:1764 __mptcp_subflow_connect+0x3cc/0x1490 net/mptcp/subflow.c:1592 mptcp_pm_create_subflow_or_signal_addr+0xbda/0x23a0 net/mptcp/pm_netlink.c:642 mptcp_pm_nl_fully_established net/mptcp/pm_netlink.c:650 [inline] mptcp_pm_nl_work+0x3a1/0x4f0 net/mptcp/pm_netlink.c:943 mptcp_worker+0x15a/0x1240 net/mptcp/protocol.c:2777 process_one_work+0x958/0x1b30 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391 kthread+0x2c1/0x3a0 kernel/kthread.c:389 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Freed by task 113: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2342 [inline] slab_free mm/slub.c:4579 [inline] kfree+0x14f/0x4b0 mm/slub.c:4727 kvfree+0x47/0x50 mm/util.c:701 kvfree_rcu_list+0xf5/0x2c0 kernel/rcu/tree.c:3423 kvfree_rcu_drain_ready kernel/rcu/tree.c:3563 [inline] kfree_rcu_monitor+0x503/0x8b0 kernel/rcu/tree.c:3632 kfree_rcu_shrink_scan+0x245/0x3a0 kernel/rcu/tree.c:3966 do_shrink_slab+0x44f/0x11c0 mm/shrinker.c:435 shrink_slab+0x32b/0x12a0 mm/shrinker.c:662 shrink_one+0x47e/0x7b0 mm/vmscan.c:4818 shrink_many mm/vmscan.c:4879 [inline] lru_gen_shrink_node mm/vmscan.c:4957 [inline] shrink_node+0x2452/0x39d0 mm/vmscan.c:5937 kswapd_shrink_node mm/vmscan.c:6765 [inline] balance_pgdat+0xc19/0x18f0 mm/vmscan.c:6957 kswapd+0x5ea/0xbf0 mm/vmscan.c:7226 kthread+0x2c1/0x3a0 kernel/kthread.c:389 ret_from_fork+0x45/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+0x33/0x60 mm/kasan/common.c:47 __kasan_record_aux_stack+0xba/0xd0 mm/kasan/generic.c:541 kvfree_call_rcu+0x74/0xbe0 kernel/rcu/tree.c:3810 subflow_ulp_release+0x2ae/0x350 net/mptcp/subflow.c:2009 tcp_cleanup_ulp+0x7c/0x130 net/ipv4/tcp_ulp.c:124 tcp_v4_destroy_sock+0x1c5/0x6a0 net/ipv4/tcp_ipv4.c:2541 inet_csk_destroy_sock+0x1a3/0x440 net/ipv4/inet_connection_sock.c:1293 tcp_done+0x252/0x350 net/ipv4/tcp.c:4870 tcp_rcv_state_process+0x379b/0x4f30 net/ipv4/tcp_input.c:6933 tcp_v4_do_rcv+0x1ad/0xa90 net/ipv4/tcp_ipv4.c:1938 sk_backlog_rcv include/net/sock.h:1115 [inline] __release_sock+0x31b/0x400 net/core/sock.c:3072 __tcp_close+0x4f3/0xff0 net/ipv4/tcp.c:3142 __mptcp_close_ssk+0x331/0x14d0 net/mptcp/protocol.c:2489 mptcp_close_ssk net/mptcp/protocol.c:2543 [inline] mptcp_close_ssk+0x150/0x220 net/mptcp/protocol.c:2526 mptcp_pm_nl_rm_addr_or_subflow+0x2be/0xcc0 net/mptcp/pm_netlink.c:878 mptcp_pm_nl_rm_subflow_received net/mptcp/pm_netlink.c:914 [inline] mptcp_nl_remove_id_zero_address+0x305/0x4a0 net/mptcp/pm_netlink.c:1572 mptcp_pm_nl_del_addr_doit+0x5c9/0x770 net/mptcp/pm_netlink.c:1603 genl_family_rcv_msg_doit+0x202/0x2f0 net/netlink/genetlink.c:1115 genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline] genl_rcv_msg+0x565/0x800 net/netlink/genetlink.c:1210 netlink_rcv_skb+0x165/0x410 net/netlink/af_netlink.c:2551 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219 netlink_unicast_kernel net/netlink/af_netlink.c:1331 [inline] netlink_unicast+0x53c/0x7f0 net/netlink/af_netlink.c:1357 netlink_sendmsg+0x8b8/0xd70 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg net/socket.c:744 [inline] ____sys_sendmsg+0x9ae/0xb40 net/socket.c:2607 ___sys_sendmsg+0x135/0x1e0 net/socket.c:2661 __sys_sendmsg+0x117/0x1f0 net/socket.c:2690 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff8880569ac800 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 88 bytes inside of freed 512-byte region [ffff8880569ac800, ffff8880569aca00) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x569ac head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000040 ffff88801ac42c80 dead000000000100 dead000000000122 raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000 head: 04fff00000000040 ffff88801ac42c80 dead000000000100 dead000000000122 head: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000 head: 04fff00000000002 ffffea00015a6b01 ffffffffffffffff 0000000000000000 head: 0000000000000004 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 10238, tgid 10238 (kworker/u32:6), ts 597403252405, free_ts 597177952947 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25a0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2412 [inline] allocate_slab mm/slub.c:2578 [inline] new_slab+0x2ba/0x3f0 mm/slub.c:2631 ___slab_alloc+0xd1d/0x16f0 mm/slub.c:3818 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3908 __slab_alloc_node mm/slub.c:3961 [inline] slab_alloc_node mm/slub.c:4122 [inline] __kmalloc_cache_noprof+0x2c5/0x310 mm/slub.c:4290 kmalloc_noprof include/linux/slab.h:878 [inline] kzalloc_noprof include/linux/slab.h:1014 [inline] mld_add_delrec net/ipv6/mcast.c:743 [inline] igmp6_leave_group net/ipv6/mcast.c:2625 [inline] igmp6_group_dropped+0x4ab/0xe40 net/ipv6/mcast.c:723 __ipv6_dev_mc_dec+0x281/0x360 net/ipv6/mcast.c:979 addrconf_leave_solict net/ipv6/addrconf.c:2253 [inline] __ipv6_ifa_notify+0x3f6/0xc30 net/ipv6/addrconf.c:6283 addrconf_ifdown.isra.0+0xef9/0x1a20 net/ipv6/addrconf.c:3982 addrconf_notify+0x220/0x19c0 net/ipv6/addrconf.c:3781 notifier_call_chain+0xb9/0x410 kernel/notifier.c:93 call_netdevice_notifiers_info+0xbe/0x140 net/core/dev.c:1996 call_netdevice_notifiers_extack net/core/dev.c:2034 [inline] call_netdevice_notifiers net/core/dev.c:2048 [inline] dev_close_many+0x333/0x6a0 net/core/dev.c:1589 page last free pid 13136 tgid 13136 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_page+0x5f4/0xdc0 mm/page_alloc.c:2638 stack_depot_save_flags+0x2da/0x900 lib/stackdepot.c:666 kasan_save_stack+0x42/0x60 mm/kasan/common.c:48 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:319 [inline] __kasan_slab_alloc+0x89/0x90 mm/kasan/common.c:345 kasan_slab_alloc include/linux/kasan.h:247 [inline] slab_post_alloc_hook mm/slub.c:4085 [inline] slab_alloc_node mm/slub.c:4134 [inline] kmem_cache_alloc_noprof+0x121/0x2f0 mm/slub.c:4141 skb_clone+0x190/0x3f0 net/core/skbuff.c:2084 do_one_broadcast net/netlink/af_netlink.c:1462 [inline] netlink_broadcast_filtered+0xb11/0xef0 net/netlink/af_netlink.c:1540 netlink_broadcast+0x39/0x50 net/netlink/af_netlink.c:1564 uevent_net_broadcast_untagged lib/kobject_uevent.c:331 [inline] kobject_uevent_net_broadcast lib/kobject_uevent.c:410 [inline] kobject_uevent_env+0xacd/0x1670 lib/kobject_uevent.c:608 device_del+0x623/0x9f0 drivers/base/core.c:3882 snd_card_disconnect.part.0+0x58a/0x7c0 sound/core/init.c:546 snd_card_disconnect+0x1f/0x30 sound/core/init.c:495 snd_usx2y_disconnect+0xe9/0x1f0 sound/usb/usx2y/usbusx2y.c:417 usb_unbind_interface+0x1e8/0x970 drivers/usb/core/driver.c:461 device_remove drivers/base/dd.c:569 [inline] device_remove+0x122/0x170 drivers/base/dd.c:561
That's because 'subflow' is used just after 'mptcp_close_ssk(subflow)', which will initiate the release of its memory. Even if it is very likely the release and the re-utilisation will be done later on, it is of course better to avoid any issues and read the content of 'subflow' before closing it.
--- net/mptcp/pm_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mptcp/pm_netlink.c +1 -1
@@ -869,12 +869,12 @@ static void mptcp_pm_nl_rm_addr_or_subfl i, rm_id, id, remote_id, msk->mpc_endpoint_id);spin_unlock_bh (&msk->pm.lock);mptcp_subflow_shutdown (sk, ssk, how); + removed |= subflow->request_join;/* the following takes care of updating the subflows counter */ mptcp_close_ssk (sk, ssk, subflow);spin_lock_bh (&msk->pm.lock); - removed |= subflow->request_join;if (rm_type ==MPTCP_MIB_RMSUBFLOW )__MPTCP_INC_STATS (sock_net (sk), rm_type); }
Greg Kroah-Hartman
maintainerPATCH 7/135 net: enetc: remove xdp_drops statistic from enetc_xdp_drop()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
commit 412950d5746f7aa139e14fe95338694c1f09b595 upstream.
The xdp_drops statistic indicates the number of XDP frames dropped in the Rx direction. However, enetc_xdp_drop() is also used in XDP_TX and XDP_REDIRECT actions. If frame loss occurs in these two actions, the frames loss count should not be included in xdp_drops, because there are already xdp_tx_drops and xdp_redirect_failures to count the frame loss of these two actions, so it's better to remove xdp_drops statistic from enetc_xdp_drop() and increase xdp_drops in XDP_DROP action.
--- drivers/net/ethernet/freescale/enetc/enetc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/enetc/enetc.c +1 -1
@@ -1524,7 +1524,6 @@ static void enetc_xdp_drop(struct enetc_ &rx_ring->rx_swbd[rx_ring_first]);enetc_bdr_idx_inc (rx_ring, &rx_ring_first); } - rx_ring->stats.xdp_drops++; } static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring,
@@ -1589,6 +1588,7 @@ static int enetc_clean_rx_ring_xdp(struc fallthrough;case XDP_DROP :enetc_xdp_drop (rx_ring, orig_i, i); + rx_ring->stats.xdp_drops++;break ;case XDP_PASS : rxbd = orig_rxbd;
Greg Kroah-Hartman
maintainerPATCH 8/135 net: enetc: block concurrent XDP transmissions during ring reconfiguration
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
commit c728a95ccf2a8ba544facfc30a4418d4c68c39f0 upstream.
When testing the XDP_REDIRECT function on the LS1028A platform, we found a very reproducible issue that the Tx frames can no longer be sent out even if XDP_REDIRECT is turned off. Specifically, if there is a lot of traffic on Rx direction, when XDP_REDIRECT is turned on, the console may display some warnings like "timeout for tx ring #6 clear", and all redirected frames will be dropped, the detailed log is as follows.
root@ls1028ardb:~# ./xdp-bench redirect eno0 eno2 Redirecting from eno0 (ifindex 3; driver fsl_enetc) to eno2 (ifindex 4; driver fsl_enetc) [203.849809] fsl_enetc 0000:00:00.2 eno2: timeout for tx ring #5 clear [204.006051] fsl_enetc 0000:00:00.2 eno2: timeout for tx ring #6 clear [204.161944] fsl_enetc 0000:00:00.2 eno2: timeout for tx ring #7 clear eno0->eno2 1420505 rx/s 1420590 err,drop/s 0 xmit/s xmit eno0->eno2 0 xmit/s 1420590 drop/s 0 drv_err/s 15.71 bulk-avg eno0->eno2 1420484 rx/s 1420485 err,drop/s 0 xmit/s xmit eno0->eno2 0 xmit/s 1420485 drop/s 0 drv_err/s 15.71 bulk-avg
By analyzing the XDP_REDIRECT implementation of enetc driver, the driver will reconfigure Tx and Rx BD rings when a bpf program is installed or uninstalled, but there is no mechanisms to block the redirected frames when enetc driver reconfigures rings. Similarly, XDP_TX verdicts on received frames can also lead to frames being enqueued in the Tx rings. Because XDP ignores the state set by the netif_tx_wake_queue() API, so introduce the ENETC_TX_DOWN flag to suppress transmission of XDP frames.
--- drivers/net/ethernet/freescale/enetc/enetc.c | 14 ++++++++++++++ drivers/net/ethernet/freescale/enetc/enetc.h | 1 + 2 files changed, 15 insertions(+)
drivers/net/ethernet/freescale/enetc/enetc.c +14 -0
@@ -902,6 +902,7 @@ static bool enetc_clean_tx_ring(struct eif (unlikely (tx_frm_cnt &&netif_carrier_ok (ndev) &&__netif_subqueue_stopped (ndev, tx_ring->index) && + !test_bit (ENETC_TX_DOWN , &priv->flags) && (enetc_bd_unused (tx_ring) >=ENETC_TXBDS_MAX_NEEDED ))) {netif_wake_subqueue (ndev, tx_ring->index); }
@@ -1380,6 +1381,9 @@ int enetc_xdp_xmit(struct net_device *ndint xdp_tx_bd_cnt, i, k;int xdp_tx_frm_cnt =0 ; +if (unlikely (test_bit (ENETC_TX_DOWN , &priv->flags))) +return -ENETDOWN ; +enetc_lock_mdio (); tx_ring = priv->xdp_tx_ring[smp_processor_id ()];
@@ -1605,6 +1609,12 @@ static int enetc_clean_rx_ring_xdp(strucbreak ;case XDP_TX : tx_ring = priv->xdp_tx_ring[rx_ring->index]; +if (unlikely (test_bit (ENETC_TX_DOWN , &priv->flags))) { +enetc_xdp_drop (rx_ring, orig_i, i); + tx_ring->stats.xdp_tx_drops++; +break ; + } + xdp_tx_bd_cnt =enetc_rx_swbd_to_xdp_tx_swbd (xdp_tx_arr, rx_ring, orig_i, i);
@@ -2466,6 +2476,8 @@ void enetc_start(struct net_device *ndevenetc_enable_bdrs (priv);netif_tx_start_all_queues (ndev); + +clear_bit (ENETC_TX_DOWN , &priv->flags); }EXPORT_SYMBOL_GPL (enetc_start);
@@ -2523,6 +2535,8 @@ void enetc_stop(struct net_device *ndev)struct enetc_ndev_priv *priv =netdev_priv (ndev);int i; +set_bit (ENETC_TX_DOWN , &priv->flags); +netif_tx_stop_all_queues (ndev);enetc_disable_bdrs (priv);
drivers/net/ethernet/freescale/enetc/enetc.h +1 -0
@@ -328,6 +328,7 @@ enum enetc_active_offloads {enum enetc_flags_bit {ENETC_TX_ONESTEP_TSTAMP_IN_PROGRESS =0 , +ENETC_TX_DOWN , };/* interrupt coalescing modes */
Greg Kroah-Hartman
maintainerPATCH 9/135 net: enetc: disable Tx BD rings after they are empty
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
commit 0a93f2ca4be6c4616d371f18a3fabad2df7f8d55 upstream.
The Tx BD rings are disabled first in enetc_stop() and the driver waits for them to become empty. This operation is not safe while the ring is actively transmitting frames, and will cause the ring to not be empty and hardware exception. As described in the NETC block guide, software should only disable an active Tx ring after all pending ring entries have been consumed (i.e. when PI = CI). Disabling a transmit ring that is actively processing BDs risks a HW-SW race hazard whereby a hardware resource becomes assigned to work on one or more ring entries only to have those entries be removed due to the ring becoming disabled.
When testing XDP_REDIRECT feautre, although all frames were blocked from being put into Tx rings during ring reconfiguration, the similar warning log was still encountered:
fsl_enetc 0000:00:00.2 eno2: timeout for tx ring #6 clear fsl_enetc 0000:00:00.2 eno2: timeout for tx ring #7 clear
The reason is that when there are still unsent frames in the Tx ring, disabling the Tx ring causes the remaining frames to be unable to be sent out. And the Tx ring cannot be restored, which means that even if the xdp program is uninstalled, the Tx frames cannot be sent out anymore. Therefore, correct the operation order in enect_start() and enect_stop().
--- drivers/net/ethernet/freescale/enetc/enetc.c | 36 +++++++++++++++++++-------- 1 file changed, 26 insertions(+), 10 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc.c +26 -10
@@ -2236,18 +2236,24 @@ static void enetc_enable_rxbdr(struct enenetc_rxbdr_wr (hw, idx,ENETC_RBMR , rbmr); } -static void enetc_enable_bdrs (struct enetc_ndev_priv *priv) +static void enetc_enable_rx_bdrs (struct enetc_ndev_priv *priv) {struct enetc_hw *hw = &priv->si->hw;int i; -for (i =0 ; i < priv->num_tx_rings; i++) -enetc_enable_txbdr (hw, priv->tx_ring[i]); -for (i =0 ; i < priv->num_rx_rings; i++)enetc_enable_rxbdr (hw, priv->rx_ring[i]); } +static void enetc_enable_tx_bdrs (struct enetc_ndev_priv *priv) +{ +struct enetc_hw *hw = &priv->si->hw; +int i; + +for (i =0 ; i < priv->num_tx_rings; i++) +enetc_enable_txbdr (hw, priv->tx_ring[i]); +} +static void enetc_disable_rxbdr (struct enetc_hw *hw,struct enetc_bdr *rx_ring) {int idx = rx_ring->index;
@@ -2264,18 +2270,24 @@ static void enetc_disable_txbdr(struct eenetc_txbdr_wr (hw, idx,ENETC_TBMR ,0 ); } -static void enetc_disable_bdrs (struct enetc_ndev_priv *priv) +static void enetc_disable_rx_bdrs (struct enetc_ndev_priv *priv) {struct enetc_hw *hw = &priv->si->hw;int i; -for (i =0 ; i < priv->num_tx_rings; i++) -enetc_disable_txbdr (hw, priv->tx_ring[i]); -for (i =0 ; i < priv->num_rx_rings; i++)enetc_disable_rxbdr (hw, priv->rx_ring[i]); } +static void enetc_disable_tx_bdrs (struct enetc_ndev_priv *priv) +{ +struct enetc_hw *hw = &priv->si->hw; +int i; + +for (i =0 ; i < priv->num_tx_rings; i++) +enetc_disable_txbdr (hw, priv->tx_ring[i]); +} +static void enetc_wait_txbdr (struct enetc_hw *hw,struct enetc_bdr *tx_ring) {int delay =8 , timeout =100 ;
@@ -2465,6 +2477,8 @@ void enetc_start(struct net_device *ndevenetc_setup_interrupts (priv); +enetc_enable_tx_bdrs (priv); +for (i =0 ; i < priv->bdr_int_num; i++) {int irq =pci_irq_vector (priv->si->pdev,ENETC_BDR_INT_BASE_IDX + i);
@@ -2473,7 +2487,7 @@ void enetc_start(struct net_device *ndevenable_irq (irq); } -enetc_enable_bdrs (priv); +enetc_enable_rx_bdrs (priv);netif_tx_start_all_queues (ndev);
@@ -2539,7 +2553,7 @@ void enetc_stop(struct net_device *ndev)netif_tx_stop_all_queues (ndev); -enetc_disable_bdrs (priv); +enetc_disable_rx_bdrs (priv);for (i =0 ; i < priv->bdr_int_num; i++) { int irq = pci_irq_vector(priv->si->pdev,
@@ -2552,6 +2566,8 @@ void enetc_stop(struct net_device *ndev)enetc_wait_bdrs (priv); +enetc_disable_tx_bdrs (priv); +enetc_clear_interrupts (priv); }EXPORT_SYMBOL_GPL (enetc_stop);
Greg Kroah-Hartman
maintainerPATCH 10/135 net: enetc: disable NAPI after all rings are disabled
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
commit 6b58fadd44aafbbd6af5f0b965063e1fd2063992 upstream.
When running "xdp-bench tx eno0" to test the XDP_TX feature of ENETC on LS1028A, it was found that if the command was re-run multiple times, Rx could not receive the frames, and the result of xdp-bench showed that the rx rate was 0.
root@ls1028ardb:~# ./xdp-bench tx eno0 Hairpinning (XDP_TX) packets on eno0 (ifindex 3; driver fsl_enetc) Summary 2046 rx/s 0 err,drop/s Summary 0 rx/s 0 err,drop/s Summary 0 rx/s 0 err,drop/s Summary 0 rx/s 0 err,drop/s
By observing the Rx PIR and CIR registers, CIR is always 0x7FF and PIR is always 0x7FE, which means that the Rx ring is full and can no longer accommodate other Rx frames. Therefore, the problem is caused by the Rx BD ring not being cleaned up.
Further analysis of the code revealed that the Rx BD ring will only be cleaned if the "cleaned_cnt > xdp_tx_in_flight" condition is met. Therefore, some debug logs were added to the driver and the current values of cleaned_cnt and xdp_tx_in_flight were printed when the Rx BD ring was full. The logs are as follows.
[ 178.762419] [XDP TX] >> cleaned_cnt:1728, xdp_tx_in_flight:2140 [ 178.771387] [XDP TX] >> cleaned_cnt:1941, xdp_tx_in_flight:2110 [ 178.776058] [XDP TX] >> cleaned_cnt:1792, xdp_tx_in_flight:2110
Quoted 1 line
From the results, the max value of
xdp_tx_in_flighthas reached 2140.
However, the size of the Rx BD ring is only 2048. So xdp_tx_in_flight did not drop to 0 after enetc_stop() is called and the driver does not clear it. The root cause is that NAPI is disabled too aggressively, without having waited for the pending XDP_TX frames to be transmitted, and their buffers recycled, so that xdp_tx_in_flight cannot naturally drop to 0. Later, enetc_free_tx_ring() does free those stale, unsent XDP_TX packets, but it is not coded up to also reset xdp_tx_in_flight, hence the manifestation of the bug.
One option would be to cover this extra condition in enetc_free_tx_ring(), but now that the ENETC_TX_DOWN exists, we have created a window at the beginning of enetc_stop() where NAPI can still be scheduled, but any concurrent enqueue will be blocked. Therefore, enetc_wait_bdrs() and enetc_disable_tx_bdrs() can be called with NAPI still scheduled, and it is guaranteed that this will not wait indefinitely, but instead give us an indication that the pending TX frames have orderly dropped to zero. Only then should we call napi_disable().
This way, enetc_free_tx_ring() becomes entirely redundant and can be dropped as part of subsequent cleanup.
The change also refactors enetc_start() so that it looks like the mirror opposite procedure of enetc_stop().
--- drivers/net/ethernet/freescale/enetc/enetc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc.c +6 -6
@@ -2477,8 +2477,6 @@ void enetc_start(struct net_device *ndevenetc_setup_interrupts (priv); -enetc_enable_tx_bdrs (priv); -for (i =0 ; i < priv->bdr_int_num; i++) {int irq =pci_irq_vector (priv->si->pdev,ENETC_BDR_INT_BASE_IDX + i);
@@ -2487,6 +2485,8 @@ void enetc_start(struct net_device *ndevenable_irq (irq); } +enetc_enable_tx_bdrs (priv); +enetc_enable_rx_bdrs (priv);netif_tx_start_all_queues (ndev);
@@ -2555,6 +2555,10 @@ void enetc_stop(struct net_device *ndev)enetc_disable_rx_bdrs (priv); +enetc_wait_bdrs (priv); + +enetc_disable_tx_bdrs (priv); +for (i =0 ; i < priv->bdr_int_num; i++) {int irq =pci_irq_vector (priv->si->pdev,ENETC_BDR_INT_BASE_IDX + i);
@@ -2564,10 +2568,6 @@ void enetc_stop(struct net_device *ndev)napi_disable (&priv->int_vector[i]->napi); } -enetc_wait_bdrs (priv); - -enetc_disable_tx_bdrs (priv); -enetc_clear_interrupts (priv); }EXPORT_SYMBOL_GPL (enetc_stop);
Greg Kroah-Hartman
maintainerPATCH 11/135 net: enetc: add missing static descriptor and inline keyword
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
commit 1d7b2ce43d2c22a21dadaf689cb36a69570346a6 upstream.
Fix the build warnings when CONFIG_FSL_ENETC_MDIO is not enabled. The detailed warnings are shown as follows.
include/linux/fsl/enetc_mdio.h:62:18: warning: no previous prototype for function 'enetc_hw_alloc' [-Wmissing-prototypes]
62 | struct enetc_hw *enetc_hw_alloc(struct device *dev, void __iomem *port_regs)
| ^include/linux/fsl/enetc_mdio.h:62:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
62 | struct enetc_hw *enetc_hw_alloc(struct device *dev, void __iomem *port_regs)
| ^
| static8 warnings generated.
--- include/linux/fsl/enetc_mdio.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/fsl/enetc_mdio.h +2 -1
@@ -59,7 +59,8 @@ static inline int enetc_mdio_read_c45(ststatic inline int enetc_mdio_write_c45 (struct mii_bus *bus,int phy_id,int devad,int regnum,u16 value) {return -EINVAL ; } -struct enetc_hw *enetc_hw_alloc (struct device *dev,void __iomem *port_regs) +static inline struct enetc_hw *enetc_hw_alloc (struct device *dev, +void __iomem *port_regs) {return ERR_PTR (-EINVAL ); }#endif
Greg Kroah-Hartman
maintainerPATCH 12/135 posix-clock: Fix missing timespec64 check in pc_clock_settime()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <[email protected]>
commit d8794ac20a299b647ba9958f6d657051fc51a540 upstream.
As Andrew pointed out, it will make sense that the PTP core checked timespec64 struct's tv_sec and tv_nsec range before calling ptp->info->settime64().
As the man manual of clock_settime() said, if tp.tv_sec is negative or tp.tv_nsec is outside the range [0..999,999,999], it should return EINVAL, which include dynamic clocks which handles PTP clock, and the condition is consistent with timespec64_valid(). As Thomas suggested, timespec64_valid() only check the timespec is valid, but not ensure that the time is in a valid range, so check it ahead using timespec64_valid_strict() in pc_clock_settime() and return -EINVAL if not valid.
There are some drivers that use tp->tv_sec and tp->tv_nsec directly to write registers without validity checks and assume that the higher layer has checked it, which is dangerous and will benefit from this, such as hclge_ptp_settime(), igb_ptp_settime_i210(), _rcar_gen4_ptp_settime(), and some drivers can remove the checks of itself.
--- kernel/time/posix-clock.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/time/posix-clock.c +3 -0
@@ -319,6 +319,9 @@ static int pc_clock_settime(clockid_t id goto out; } +if (!timespec64_valid_strict (ts)) +return -EINVAL ; +if (cd.clk->ops.clock_settime) err = cd.clk->ops.clock_settime (cd.clk, ts);else
Greg Kroah-Hartman
maintainerPATCH 13/135 udp: Compute L4 checksum as usual when not segmenting the skb
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Sitnicki <[email protected]>
commit d96016a764f6aa5c7528c3d3f9cb472ef7266951 upstream.
If:
1) the user requested USO, but
2) there is not enough payload for GSO to kick in, and
3) the egress device doesn't offer checksum offload, then
we want to compute the L4 checksum in software early on.
In the case when we are not taking the GSO path, but it has been requested, the software checksum fallback in skb_segment doesn't get a chance to compute the full checksum, if the egress device can't do it. As a result we end up sending UDP datagrams with only a partial checksum filled in, which the peer will discard.
--- net/ipv4/udp.c | 4 +++- net/ipv6/udp.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
net/ipv4/udp.c +3 -1
@@ -950,8 +950,10 @@ static int udp_send_skb(struct sk_buff *skb_shinfo (skb)->gso_type =SKB_GSO_UDP_L4 ;skb_shinfo (skb)->gso_segs =DIV_ROUND_UP (datalen, cork->gso_size); + +/* Don't checksum the payload, skb will get segmented */ + goto csum_partial; } - goto csum_partial; }if (is_udplite)/* UDP-Lite */
net/ipv6/udp.c +3 -1
@@ -1266,8 +1266,10 @@ static int udp_v6_send_skb(struct sk_bufskb_shinfo (skb)->gso_type =SKB_GSO_UDP_L4 ;skb_shinfo (skb)->gso_segs =DIV_ROUND_UP (datalen, cork->gso_size); + +/* Don't checksum the payload, skb will get segmented */ + goto csum_partial; } - goto csum_partial; }if (is_udplite)
Greg Kroah-Hartman
maintainerPATCH 14/135 arm64: dts: marvell: cn9130-sr-som: fix cp0 mdio pin numbers
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josua Mayer <[email protected]>
commit 841dd5b122b4b8080ede69c5f72fd6057da43f8a upstream.
SolidRun CN9130 SoM actually uses CP_MPP[0:1] for mdio. CP_MPP[40] provides reference clock for dsa switch and ethernet phy on Clearfog Pro, wheras MPP[41] controls efuse programming voltage "VHV".
Update the cp0 mdio pinctrl node to specify mpp0, mpp1.
--- arch/arm64/boot/dts/marvell/cn9130-sr-som.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/marvell/cn9130-sr-som.dtsi +1 -1
@@ -136,7 +136,7 @@ }; cp0_mdio_pins: cp0-mdio-pins { - marvell,pins = "mpp40", "mpp41"; + marvell,pins = "mpp0", "mpp1"; marvell,function = "ge"; };
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 15/135 arm64: probes: Remove broken LDR (literal) uprobe support
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Rutland <[email protected]>
commit acc450aa07099d071b18174c22a1119c57da8227 upstream.
The simulate_ldr_literal() and simulate_ldrsw_literal() functions are unsafe to use for uprobes. Both functions were originally written for use with kprobes, and access memory with plain C accesses. When uprobes was added, these were reused unmodified even though they cannot safely access user memory.
There are three key problems:
1) The plain C accesses do not have corresponding extable entries, and thus if they encounter a fault the kernel will treat these as unintentional accesses to user memory, resulting in a BUG() which will kill the kernel thread, and likely lead to further issues (e.g. lockup or panic()).
2) The plain C accesses are subject to HW PAN and SW PAN, and so when either is in use, any attempt to simulate an access to user memory will fault. Thus neither simulate_ldr_literal() nor simulate_ldrsw_literal() can do anything useful when simulating a user instruction on any system with HW PAN or SW PAN.
3) The plain C accesses are privileged, as they run in kernel context, and in practice can access a small range of kernel virtual addresses. The instructions they simulate have a range of +/-1MiB, and since the simulated instructions must itself be a user instructions in the TTBR0 address range, these can address the final 1MiB of the TTBR1 acddress range by wrapping downwards from an address in the first 1MiB of the TTBR0 address range.
In contemporary kernels the last 8MiB of TTBR1 address range is reserved, and accesses to this will always fault, meaning this is no worse than (1).
Historically, it was theoretically possible for the linear map or vmemmap to spill into the final 8MiB of the TTBR1 address range, but in practice this is extremely unlikely to occur as this would require either:
* Having enough physical memory to fill the entire linear map all the way to the final 1MiB of the TTBR1 address range.
* Getting unlucky with KASLR randomization of the linear map such that the populated region happens to overlap with the last 1MiB of the TTBR address range.
... and in either case if we were to spill into the final page there would be larger problems as the final page would alias with error pointers.
Practically speaking, (1) and (2) are the big issues. Given there have been no reports of problems since the broken code was introduced, it appears that no-one is relying on probing these instructions with uprobes.
Avoid these issues by not allowing uprobes on LDR (literal) and LDRSW (literal), limiting the use of simulate_ldr_literal() and simulate_ldrsw_literal() to kprobes. Attempts to place uprobes on LDR (literal) and LDRSW (literal) will be rejected as arm_probe_decode_insn() will return INSN_REJECTED. In future we can consider introducing working uprobes support for these instructions, but this will require more significant work.
--- arch/arm64/kernel/probes/decode-insn.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
arch/arm64/kernel/probes/decode-insn.c +11 -5
@@ -99,10 +99,6 @@ arm_probe_decode_insn(probe_opcode_t ins aarch64_insn_is_blr(insn) || aarch64_insn_is_ret(insn)) { api->handler = simulate_br_blr_ret; - } else if (aarch64_insn_is_ldr_lit(insn)) { - api->handler = simulate_ldr_literal; - } else if (aarch64_insn_is_ldrsw_lit(insn)) { - api->handler = simulate_ldrsw_literal; } else {/* * Instruction cannot be stepped out-of-line and we don't
@@ -140,6 +136,17 @@ arm_kprobe_decode_insn(kprobe_opcode_t *probe_opcode_t insn =le32_to_cpu (*addr);probe_opcode_t *scan_end =NULL ;unsigned long size =0 , offset =0 ; +struct arch_probe_insn *api = &asi->api; + +if (aarch64_insn_is_ldr_lit (insn)) { + api->handler = simulate_ldr_literal; + decoded =INSN_GOOD_NO_SLOT ; + }else if (aarch64_insn_is_ldrsw_lit (insn)) { + api->handler = simulate_ldrsw_literal; + decoded =INSN_GOOD_NO_SLOT ; + }else { + decoded =arm_probe_decode_insn (insn, &asi->api); + }/* * If there's a symbol defined in front of and near enough to
@@ -157,7 +164,6 @@ arm_kprobe_decode_insn(kprobe_opcode_t *else scan_end = addr -MAX_ATOMIC_CONTEXT_SIZE ; } - decoded =arm_probe_decode_insn (insn, &asi->api);if (decoded !=INSN_REJECTED && scan_end)if (is_probed_address_atomic (addr -1 , scan_end))
Greg Kroah-Hartman
maintainerPATCH 16/135 arm64: probes: Fix simulate_ldr*_literal()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Rutland <[email protected]>
commit 50f813e57601c22b6f26ced3193b9b94d70a2640 upstream.
The simulate_ldr_literal() code always loads a 64-bit quantity, and when simulating a 32-bit load into a 'W' register, it discards the most significant 32 bits. For big-endian kernels this means that the relevant bits are discarded, and the value returned is the the subsequent 32 bits in memory (i.e. the value at addr + 4).
Additionally, simulate_ldr_literal() and simulate_ldrsw_literal() use a plain C load, which the compiler may tear or elide (e.g. if the target is the zero register). Today this doesn't happen to matter, but it may matter in future if trampoline code uses a LDR (literal) or LDRSW (literal).
Update simulate_ldr_literal() and simulate_ldrsw_literal() to use an appropriately-sized READ_ONCE() to perform the access, which avoids these problems.
--- arch/arm64/kernel/probes/simulate-insn.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
arch/arm64/kernel/probes/simulate-insn.c +7 -11
@@ -171,17 +171,15 @@ simulate_tbz_tbnz(u32 opcode, long addr,void __kprobes simulate_ldr_literal (u32 opcode,long addr,struct pt_regs *regs) { -u64 *load_addr; +unsigned long load_addr;int xn = opcode &0x1f ; -int disp; - disp =ldr_displacement (opcode); - load_addr = (u64 *) (addr + disp); + load_addr = addr +ldr_displacement (opcode);if (opcode & (1 <<30 ))/* x0-x30 */ -set_x_reg (regs, xn, *load_addr); +set_x_reg (regs, xn,READ_ONCE (*(u64 *)load_addr));else /* w0-w30 */ -set_w_reg (regs, xn, *load_addr); +set_w_reg (regs, xn,READ_ONCE (*(u32 *)load_addr));instruction_pointer_set (regs,instruction_pointer (regs) +4 ); }
@@ -189,14 +187,12 @@ simulate_ldr_literal(u32 opcode, long advoid __kprobes simulate_ldrsw_literal (u32 opcode,long addr,struct pt_regs *regs) { -s32 *load_addr; +unsigned long load_addr;int xn = opcode &0x1f ; -int disp; - disp =ldr_displacement (opcode); - load_addr = (s32 *) (addr + disp); + load_addr = addr +ldr_displacement (opcode); -set_x_reg (regs, xn, *load_addr); +set_x_reg (regs, xn,READ_ONCE (*(s32 *)load_addr));instruction_pointer_set (regs,instruction_pointer (regs) +4 ); }
Greg Kroah-Hartman
maintainerPATCH 17/135 arm64: probes: Fix uprobes for big-endian kernels
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Rutland <[email protected]>
commit 13f8f1e05f1dc36dbba6cba0ae03354c0dafcde7 upstream.
The arm64 uprobes code is broken for big-endian kernels as it doesn't convert the in-memory instruction encoding (which is always little-endian) into the kernel's native endianness before analyzing and simulating instructions. This may result in a few distinct problems:
* The kernel may may erroneously reject probing an instruction which can safely be probed.
* The kernel may erroneously erroneously permit stepping an instruction out-of-line when that instruction cannot be stepped out-of-line safely.
* The kernel may erroneously simulate instruction incorrectly dur to interpretting the byte-swapped encoding.
The endianness mismatch isn't caught by the compiler or sparse because:
* The arch_uprobe::{insn,ixol} fields are encoded as arrays of u8, so the compiler and sparse have no idea these contain a little-endian 32-bit value. The core uprobes code populates these with a memcpy() which similarly does not handle endianness.
* While the uprobe_opcode_t type is an alias for __le32, both arch_uprobe_analyze_insn() and arch_uprobe_skip_sstep() cast from u8[] to the similarly-named probe_opcode_t, which is an alias for u32. Hence there is no endianness conversion warning.
Fix this by changing the arch_uprobe::{insn,ixol} fields to __le32 and adding the appropriate __le32_to_cpu() conversions prior to consuming the instruction encoding. The core uprobes copies these fields as opaque ranges of bytes, and so is unaffected by this change.
At the same time, remove MAX_UINSN_BYTES and consistently use AARCH64_INSN_SIZE for clarity.
Tested with the following:
| #include <stdio.h>
| #include <stdbool.h>
|
| #define noinline __attribute__((noinline))
|
| static noinline void *adrp_self(void)
| {
| void *addr;
|
| asm volatile(
| " adrp %x0, adrp_self\n"
| " add %x0, %x0, :lo12:adrp_self\n"
| : "=r" (addr));
| }
|
|
| int main(int argc, char *argv)
| {
| void *ptr = adrp_self();
| bool equal = (ptr == adrp_self);
|
| printf("adrp_self => %p\n"
| "adrp_self() => %p\n"
| "%s\n",
| adrp_self, ptr, equal ? "EQUAL" : "NOT EQUAL");
|
| return 0;
| }.... where the adrp_self() function was compiled to:
| 00000000004007e0 <adrp_self>: | 4007e0: 90000000 adrp x0, 400000 <__ehdr_start> | 4007e4: 911f8000 add x0, x0, #0x7e0 | 4007e8: d65f03c0 ret
Before this patch, the ADRP is not recognized, and is assumed to be steppable, resulting in corruption of the result:
| # ./adrp-self | adrp_self => 0x4007e0 | adrp_self() => 0x4007e0 | EQUAL | # echo 'p /root/adrp-self:0x007e0' > /sys/kernel/tracing/uprobe_events | # echo 1 > /sys/kernel/tracing/events/uprobes/enable | # ./adrp-self | adrp_self => 0x4007e0 | adrp_self() => 0xffffffffff7e0 | NOT EQUAL
After this patch, the ADRP is correctly recognized and simulated:
| # ./adrp-self | adrp_self => 0x4007e0 | adrp_self() => 0x4007e0 | EQUAL | # | # echo 'p /root/adrp-self:0x007e0' > /sys/kernel/tracing/uprobe_events | # echo 1 > /sys/kernel/tracing/events/uprobes/enable | # ./adrp-self | adrp_self => 0x4007e0 | adrp_self() => 0x4007e0 | EQUAL
--- arch/arm64/include/asm/uprobes.h | 8 +++----- arch/arm64/kernel/probes/uprobes.c | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-)
arch/arm64/include/asm/uprobes.h +3 -5
@@ -10,11 +10,9 @@#include <asm/insn.h> #include <asm/probes.h> -#define MAX_UINSN_BYTES AARCH64_INSN_SIZE -#define UPROBE_SWBP_INSN cpu_to_le32(BRK64_OPCODE_UPROBES)#define UPROBE_SWBP_INSN_SIZE AARCH64_INSN_SIZE -#define UPROBE_XOL_SLOT_BYTES MAX_UINSN_BYTES +#define UPROBE_XOL_SLOT_BYTES AARCH64_INSN_SIZEtypedef __le32 uprobe_opcode_t ;
@@ -23,8 +21,8 @@ struct arch_uprobe_task {struct arch_uprobe {union { -u8 insn[MAX_UINSN_BYTES ]; -u8 ixol[MAX_UINSN_BYTES ]; +__le32 insn; +__le32 ixol; };struct arch_probe_insn api;bool simulate;
arch/arm64/kernel/probes/uprobes.c +2 -2
@@ -42,7 +42,7 @@ int arch_uprobe_analyze_insn(struct archelse if (!IS_ALIGNED (addr,AARCH64_INSN_SIZE ))return -EINVAL ; - insn = *(probe_opcode_t *)(&auprobe->insn[0 ]); + insn =le32_to_cpu (auprobe->insn);switch (arm_probe_decode_insn (insn, &auprobe->api)) {case INSN_REJECTED :
@@ -108,7 +108,7 @@ bool arch_uprobe_skip_sstep(struct arch_if (!auprobe->simulate)return false; - insn = *(probe_opcode_t *)(&auprobe->insn[0 ]); + insn =le32_to_cpu (auprobe->insn); addr =instruction_pointer (regs);if (auprobe->api.handler)
Greg Kroah-Hartman
maintainerPATCH 18/135 net: macb: Avoid 20s boot delay by skipping MDIO bus registration for fixed-link PHY
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleksij Rempel <[email protected]>
commit d0c3601f2c4e12e7689b0f46ebc17525250ea8c3 upstream.
A boot delay was introduced by commit 79540d133ed6 ("net: macb: Fix handling of fixed-link node"). This delay was caused by the call to mdiobus_register() in cases where a fixed-link PHY was present. The MDIO bus registration triggered unnecessary PHY address scans, leading to a 20-second delay due to attempts to detect Clause 45 (C45) compatible PHYs, despite no MDIO bus being attached.
The commit 79540d133ed6 ("net: macb: Fix handling of fixed-link node") was originally introduced to fix a regression caused by commit 7897b071ac3b4 ("net: macb: convert to phylink"), which caused the driver to misinterpret fixed-link nodes as PHY nodes. This resulted in warnings like:mdio_bus f0028000.ethernet-ffffffff: fixed-link has invalid PHY address mdio_bus f0028000.ethernet-ffffffff: scan phy fixed-link at address 0
...mdio_bus f0028000.ethernet-ffffffff: scan phy fixed-link at address 31
This patch reworks the logic to avoid registering and allocation of the MDIO bus when:
- The device tree contains a fixed-link node.
- There is no "mdio" child node in the device tree.
If a child node named "mdio" exists, the MDIO bus will be registered to support PHYs attached to the MACB's MDIO bus. Otherwise, with only a fixed-link, the MDIO bus is skipped.
Tested on a sama5d35 based system with a ksz8863 switch attached to macb0.
--- drivers/net/ethernet/cadence/macb_main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/net/ethernet/cadence/macb_main.c +11 -3
@@ -930,9 +930,6 @@ static int macb_mdiobus_register(structreturn ret; } -if (of_phy_is_fixed_link (np)) -return mdiobus_register (bp->mii_bus); -/* Only create the PHY from the device tree if at least one PHY is * described. Otherwise scan the entire MDIO bus. We do this to support * old device tree that did not follow the best practices and did not
@@ -953,8 +950,19 @@ static int macb_mdiobus_register(structstatic int macb_mii_init (struct macb *bp) { +struct device_node *child, *np = bp->pdev->dev.of_node;int err = -ENXIO ; +/* With fixed-link, we don't need to register the MDIO bus, +* except if we have a child named "mdio" in the device tree. +* In that case, some devices may be attached to the MACB's MDIO bus. +*/ + child =of_get_child_by_name (np,"mdio" ); +if (child) +of_node_put (child); +else if (of_phy_is_fixed_link (np)) +return macb_mii_probe (bp->dev); +/* Enable management port */ macb_writel (bp,NCR ,MACB_BIT (MPE ));
Greg Kroah-Hartman
maintainerPATCH 19/135 net: microchip: vcap api: Fix memory leaks in vcap_api_encode_rule_test()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <[email protected]>
commit 217a3d98d1e9891a8b1438a27dfbc64ddf01f691 upstream.
Commit a3c1e45156ad ("net: microchip: vcap: Fix use-after-free error in kunit test") fixed the use-after-free error, but introduced below memory leaks by removing necessary vcap_free_rule(), add it to fix it.
unreferenced object 0xffffff80ca58b700 (size 192): comm "kunit_try_catch", pid 1215, jiffies 4294898264 hex dump (first 32 bytes): 00 12 7a 00 05 00 00 00 0a 00 00 00 64 00 00 00 ..z.........d... 00 00 00 00 00 00 00 00 00 04 0b cc 80 ff ff ff ................ backtrace (crc 9c09c3fe): [<0000000052a0be73>] kmemleak_alloc+0x34/0x40 [<0000000043605459>] __kmalloc_cache_noprof+0x26c/0x2f4 [<0000000040a01b8d>] vcap_alloc_rule+0x3cc/0x9c4 [<000000003fe86110>] vcap_api_encode_rule_test+0x1ac/0x16b0 [<00000000b3595fc4>] kunit_try_run_case+0x13c/0x3ac [<0000000010f5d2bf>] kunit_generic_run_threadfn_adapter+0x80/0xec [<00000000c5d82c9a>] kthread+0x2e8/0x374 [<00000000f4287308>] ret_from_fork+0x10/0x20 unreferenced object 0xffffff80cc0b0400 (size 64): comm "kunit_try_catch", pid 1215, jiffies 4294898265 hex dump (first 32 bytes): 80 04 0b cc 80 ff ff ff 18 b7 58 ca 80 ff ff ff ..........X..... 39 00 00 00 02 00 00 00 06 05 04 03 02 01 ff ff 9............... backtrace (crc daf014e9): [<0000000052a0be73>] kmemleak_alloc+0x34/0x40 [<0000000043605459>] __kmalloc_cache_noprof+0x26c/0x2f4 [<000000000ff63fd4>] vcap_rule_add_key+0x2cc/0x528 [<00000000dfdb1e81>] vcap_api_encode_rule_test+0x224/0x16b0 [<00000000b3595fc4>] kunit_try_run_case+0x13c/0x3ac [<0000000010f5d2bf>] kunit_generic_run_threadfn_adapter+0x80/0xec [<00000000c5d82c9a>] kthread+0x2e8/0x374 [<00000000f4287308>] ret_from_fork+0x10/0x20 unreferenced object 0xffffff80cc0b0700 (size 64): comm "kunit_try_catch", pid 1215, jiffies 4294898265 hex dump (first 32 bytes): 80 07 0b cc 80 ff ff ff 28 b7 58 ca 80 ff ff ff ........(.X..... 3c 00 00 00 00 00 00 00 01 2f 03 b3 ec ff ff ff <......../...... backtrace (crc 8d877792): [<0000000052a0be73>] kmemleak_alloc+0x34/0x40 [<0000000043605459>] __kmalloc_cache_noprof+0x26c/0x2f4 [<000000006eadfab7>] vcap_rule_add_action+0x2d0/0x52c [<00000000323475d1>] vcap_api_encode_rule_test+0x4d4/0x16b0 [<00000000b3595fc4>] kunit_try_run_case+0x13c/0x3ac [<0000000010f5d2bf>] kunit_generic_run_threadfn_adapter+0x80/0xec [<00000000c5d82c9a>] kthread+0x2e8/0x374 [<00000000f4287308>] ret_from_fork+0x10/0x20 unreferenced object 0xffffff80cc0b0900 (size 64): comm "kunit_try_catch", pid 1215, jiffies 4294898266 hex dump (first 32 bytes): 80 09 0b cc 80 ff ff ff 80 06 0b cc 80 ff ff ff ................ 7d 00 00 00 01 00 00 00 00 00 00 00 ff 00 00 00 }............... backtrace (crc 34181e56): [<0000000052a0be73>] kmemleak_alloc+0x34/0x40 [<0000000043605459>] __kmalloc_cache_noprof+0x26c/0x2f4 [<000000000ff63fd4>] vcap_rule_add_key+0x2cc/0x528 [<00000000991e3564>] vcap_val_rule+0xcf0/0x13e8 [<00000000fc9868e5>] vcap_api_encode_rule_test+0x678/0x16b0 [<00000000b3595fc4>] kunit_try_run_case+0x13c/0x3ac [<0000000010f5d2bf>] kunit_generic_run_threadfn_adapter+0x80/0xec [<00000000c5d82c9a>] kthread+0x2e8/0x374 [<00000000f4287308>] ret_from_fork+0x10/0x20 unreferenced object 0xffffff80cc0b0980 (size 64): comm "kunit_try_catch", pid 1215, jiffies 4294898266 hex dump (first 32 bytes): 18 b7 58 ca 80 ff ff ff 00 09 0b cc 80 ff ff ff ..X............. 67 00 00 00 00 00 00 00 01 01 74 88 c0 ff ff ff g.........t..... backtrace (crc 275fd9be): [<0000000052a0be73>] kmemleak_alloc+0x34/0x40 [<0000000043605459>] __kmalloc_cache_noprof+0x26c/0x2f4 [<000000000ff63fd4>] vcap_rule_add_key+0x2cc/0x528 [<000000001396a1a2>] test_add_def_fields+0xb0/0x100 [<000000006e7621f0>] vcap_val_rule+0xa98/0x13e8 [<00000000fc9868e5>] vcap_api_encode_rule_test+0x678/0x16b0 [<00000000b3595fc4>] kunit_try_run_case+0x13c/0x3ac [<0000000010f5d2bf>] kunit_generic_run_threadfn_adapter+0x80/0xec [<00000000c5d82c9a>] kthread+0x2e8/0x374 [<00000000f4287308>] ret_from_fork+0x10/0x20 ......
--- drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c +2 -0
@@ -1444,6 +1444,8 @@ static void vcap_api_encode_rule_test(st ret =vcap_del_rule (&test_vctrl, &test_netdev, id);KUNIT_EXPECT_EQ (test,0 , ret); + +vcap_free_rule (rule); }static void vcap_api_set_rule_counter_test (struct kunit *test)
Greg Kroah-Hartman
maintainerPATCH 20/135 selftests: mptcp: join: test for prohibited MPC to port-based endp
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit 5afca7e996c42aed1b4a42d4712817601ba42aff upstream.
Explicitly verify that MPC connection attempts towards a port-based signal endpoint fail with a reset.
Note that this new test is a bit different from the other ones, not using 'run_tests'. It is then needed to add the capture capability, and the picking the right port which have been extracted into three new helpers. The info about the capture can also be printed from a single point, which simplifies the exit paths in do_transfer().
The 'Fixes' tag here below is the same as the one from the previous
commit: this patch here is not fixing anything wrong in the selftests, but it validates the previous fix for an issue introduced by this commit ID.
--- tools/testing/selftests/net/mptcp/mptcp_join.sh | 115 +++++++++++++++++------- 1 file changed, 85 insertions(+), 30 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +85 -30
@@ -23,6 +23,7 @@ tmpfile="" cout="" err="" capout="" +cappid="" ns1="" ns2="" iptables="iptables"
@@ -861,40 +862,62 @@ check_cestab() fi } -do_transfer() +cond_start_capture() { - local listener_ns="$1" - local connector_ns="$2" - local cl_proto="$3" - local srv_proto="$4" - local connect_addr="$5" - - local port=$((10000 + MPTCP_LIB_TEST_COUNTER - 1)) - local cappid - local FAILING_LINKS=${FAILING_LINKS:-""} - local fastclose=${fastclose:-""} - local speed=${speed:-"fast"} + local ns="$1" - :> "$cout" - :> "$sout" :> "$capout" if $capture; then - local capuser - if [ -z $SUDO_USER ] ; then + local capuser capfile + if [ -z $SUDO_USER ]; then capuser="" else capuser="-Z $SUDO_USER" fi - capfile=$(printf "mp_join-%02u-%s.pcap" "$MPTCP_LIB_TEST_COUNTER" "${listener_ns}") + capfile=$(printf "mp_join-%02u-%s.pcap" "$MPTCP_LIB_TEST_COUNTER" "$ns") echo "Capturing traffic for test $MPTCP_LIB_TEST_COUNTER into $capfile" - ip netns exec ${listener_ns} tcpdump -i any -s 65535 -B 32768 $capuser -w $capfile > "$capout" 2>&1 & + ip netns exec "$ns" tcpdump -i any -s 65535 -B 32768 $capuser -w "$capfile" > "$capout" 2>&1 & cappid=$! sleep 1 fi +} + +cond_stop_capture() +{ + if $capture; then + sleep 1 + kill $cappid + cat "$capout" + fi +} + +get_port() +{ + echo "$((10000 + MPTCP_LIB_TEST_COUNTER - 1))" +} + +do_transfer() +{ + local listener_ns="$1" + local connector_ns="$2" + local cl_proto="$3" + local srv_proto="$4" + local connect_addr="$5" + local port + + local FAILING_LINKS=${FAILING_LINKS:-""} + local fastclose=${fastclose:-""} + local speed=${speed:-"fast"} + port=$(get_port) + + :> "$cout" + :> "$sout" + + cond_start_capture ${listener_ns} NSTAT_HISTORY=/tmp/${listener_ns}.nstat ip netns exec ${listener_ns} \ nstat -n
@@ -981,10 +1004,7 @@ do_transfer() wait $spid local rets=$? - if $capture; then - sleep 1 - kill $cappid - fi + cond_stop_capture NSTAT_HISTORY=/tmp/${listener_ns}.nstat ip netns exec ${listener_ns} \ nstat | grep Tcp > /tmp/${listener_ns}.out
@@ -1000,7 +1020,6 @@ do_transfer() ip netns exec ${connector_ns} ss -Menita 1>&2 -o "dport = :$port" cat /tmp/${connector_ns}.out - cat "$capout" return 1 fi
@@ -1017,13 +1036,7 @@ do_transfer() fi rets=$? - if [ $retc -eq 0 ] && [ $rets -eq 0 ];then - cat "$capout" - return 0 - fi - - cat "$capout" - return 1 + [ $retc -eq 0 ] && [ $rets -eq 0 ] } make_file()
@@ -2786,6 +2799,32 @@ verify_listener_events() fail_test } +chk_mpc_endp_attempt() +{ + local retl=$1 + local attempts=$2 + + print_check "Connect" + + if [ ${retl} = 124 ]; then + fail_test "timeout on connect" + elif [ ${retl} = 0 ]; then + fail_test "unexpected successful connect" + else + print_ok + + print_check "Attempts" + count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPCapableEndpAttempt") + if [ -z "$count" ]; then + print_skip + elif [ "$count" != "$attempts" ]; then + fail_test "got ${count} MPC attempt[s] on port-based endpoint, expected ${attempts}" + else + print_ok + fi + fi +} + add_addr_ports_tests() { # signal address with port
@@ -2876,6 +2915,22 @@ add_addr_ports_tests() chk_join_nr 2 2 2 chk_add_nr 2 2 2 fi + + if reset "port-based signal endpoint must not accept mpc"; then + local port retl count + port=$(get_port) + + cond_start_capture ${ns1} + pm_nl_add_endpoint ${ns1} 10.0.2.1 flags signal port ${port} + mptcp_lib_wait_local_port_listen ${ns1} ${port} + + timeout 1 ip netns exec ${ns2} \ + ./mptcp_connect -t ${timeout_poll} -p $port -s MPTCP 10.0.2.1 >/dev/null 2>&1 + retl=$? + cond_stop_capture + + chk_mpc_endp_attempt ${retl} 1 + fi } syncookies_tests()
Greg Kroah-Hartman
maintainerPATCH 21/135 maple_tree: correct tree corruption on spanning store
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Stoakes <[email protected]>
commit bea07fd63192b61209d48cbb81ef474cc3ee4c62 upstream.
Patch series "maple_tree: correct tree corruption on spanning store", v3.
There has been a nasty yet subtle maple tree corruption bug that appears to have been in existence since the inception of the algorithm.
This bug seems far more likely to happen since commit f8d112a4e657 ("mm/mmap: avoid zeroing vma tree in mmap_region()"), which is the point at which reports started to be submitted concerning this bug.
We were made definitely aware of the bug thanks to the kind efforts of Bert Karwatzki who helped enormously in my being able to track this down and identify the cause of it.
The bug arises when an attempt is made to perform a spanning store across two leaf nodes, where the right leaf node is the rightmost child of the shared parent, AND the store completely consumes the right-mode node.
This results in mas_wr_spanning_store() mitakenly duplicating the new and existing entries at the maximum pivot within the range, and thus maple tree corruption.
The fix patch corrects this by detecting this scenario and disallowing the mistaken duplicate copy.
The fix patch commit message goes into great detail as to how this occurs.
This series also includes a test which reliably reproduces the issue, and asserts that the fix works correctly.
Bert has kindly tested the fix and confirmed it resolved his issues. Also Mikhail Gavrilov kindly reported what appears to be precisely the same bug, which this fix should also resolve.
This patch (of 2):
There has been a subtle bug present in the maple tree implementation from its inception.
This arises from how stores are performed - when a store occurs, it will overwrite overlapping ranges and adjust the tree as necessary to accommodate this.
A range may always ultimately span two leaf nodes. In this instance we walk the two leaf nodes, determine which elements are not overwritten to the left and to the right of the start and end of the ranges respectively and then rebalance the tree to contain these entries and the newly inserted one.
This kind of store is dubbed a 'spanning store' and is implemented by mas_wr_spanning_store().
In order to reach this stage, mas_store_gfp() invokes mas_wr_preallocate(), mas_wr_store_type() and mas_wr_walk() in turn to walk the tree and update the object (mas) to traverse to the location where the write should be performed, determining its store type.
When a spanning store is required, this function returns false stopping at the parent node which contains the target range, and mas_wr_store_type() marks the mas->store_type as wr_spanning_store to denote this fact.
When we go to perform the store in mas_wr_spanning_store(), we first determine the elements AFTER the END of the range we wish to store (that is, to the right of the entry to be inserted) - we do this by walking to the NEXT pivot in the tree (i.e. r_mas.last + 1), starting at the node we have just determined contains the range over which we intend to write.
We then turn our attention to the entries to the left of the entry we are inserting, whose state is represented by l_mas, and copy these into a 'big node', which is a special node which contains enough slots to contain two leaf node's worth of data.
We then copy the entry we wish to store immediately after this - the copy and the insertion of the new entry is performed by mas_store_b_node().
After this we copy the elements to the right of the end of the range which we are inserting, if we have not exceeded the length of the node (i.e. r_mas.offset <= r_mas.end).
Herein lies the bug - under very specific circumstances, this logic can break and corrupt the maple tree.
Consider the following tree:
Height
0 Root Node
/ \
pivot = 0xffff / \ pivot = ULONG_MAX
/ \
1 A [-----] ...
/ \
pivot = 0x4fff / \ pivot = 0xffff
/ \
2 (LEAVES) B [-----] [-----] C
^--- Last pivot 0xffff.Now imagine we wish to store an entry in the range [0x4000, 0xffff] (note that all ranges expressed in maple tree code are inclusive):
1. mas_store_gfp() descends the tree, finds node A at <=0xffff, then determines that this is a spanning store across nodes B and C. The mas state is set such that the current node from which we traverse further is node A.
2. In mas_wr_spanning_store() we try to find elements to the right of pivot 0xffff by searching for an index of 0x10000:
- mas_wr_walk_index() invokes mas_wr_walk_descend() and mas_wr_node_walk() in turn.
- mas_wr_node_walk() loops over entries in node A until EITHER it finds an entry whose pivot equals or exceeds 0x10000 OR it reaches the final entry.
- Since no entry has a pivot equal to or exceeding 0x10000, pivot 0xffff is selected, leading to node C.
- mas_wr_walk_traverse() resets the mas state to traverse node C. We loop around and invoke mas_wr_walk_descend() and mas_wr_node_walk() in turn once again.
- Again, we reach the last entry in node C, which has a pivot of 0xffff.
3. We then copy the elements to the left of 0x4000 in node B to the big node via mas_store_b_node(), and insert the new [0x4000, 0xffff] entry too.
4. We determine whether we have any entries to copy from the right of the end of the range via - and with r_mas set up at the entry at pivot 0xffff, r_mas.offset <= r_mas.end, and then we DUPLICATE the entry at pivot 0xffff.
5. BUG! The maple tree is corrupted with a duplicate entry.
This requires a very specific set of circumstances - we must be spanning the last element in a leaf node, which is the last element in the parent node.
spanning store across two leaf nodes with a range that ends at that shared pivot.
A potential solution to this problem would simply be to reset the walk each time we traverse r_mas, however given the rarity of this situation it seems that would be rather inefficient.
Instead, this patch detects if the right hand node is populated, i.e. has anything we need to copy.
We do so by only copying elements from the right of the entry being inserted when the maximum value present exceeds the last, rather than basing this on offset position.
The patch also updates some comments and eliminates the unused bool return value in mas_wr_walk_index().
The work performed in commit f8d112a4e657 ("mm/mmap: avoid zeroing vma tree in mmap_region()") seems to have made the probability of this event much more likely, which is the point at which reports started to be submitted concerning this bug.
The motivation for this change arose from Bert Karwatzki's report of encountering mm instability after the release of kernel v6.12-rc1 which, after the use of CONFIG_DEBUG_VM_MAPLE_TREE and similar configuration options, was identified as maple tree corruption.
After Bert very generously provided his time and ability to reproduce this event consistently, I was able to finally identify that the issue discussed in this commit message was occurring for him.
--- lib/maple_tree.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
lib/maple_tree.c +6 -6
@@ -2196,6 +2196,8 @@ static inline void mas_node_or_none(stru/* * mas_wr_node_walk() - Find the correct offset for the index in the @mas. +* If @mas->index cannot be found within the containing +* node, we traverse to the last entry in the node. * @wr_mas: The maple write state * * Uses mas_slot_locked() and does not need to worry about dead nodes.
@@ -3609,7 +3611,7 @@ static bool mas_wr_walk(struct ma_wr_stareturn true; } -static bool mas_wr_walk_index (struct ma_wr_state *wr_mas) +static void mas_wr_walk_index (struct ma_wr_state *wr_mas) {struct ma_state *mas = wr_mas->mas;
@@ -3618,11 +3620,9 @@ static bool mas_wr_walk_index(struct ma_ wr_mas->content =mas_slot_locked (mas, wr_mas->slots, mas->offset);if (ma_is_leaf (wr_mas->type)) -return true; +return ;mas_wr_walk_traverse (wr_mas); - } -return true; }/* * mas_extend_spanning_null() - Extend a store of a %NULL to include surrounding %NULLs.
@@ -3853,8 +3853,8 @@ static inline int mas_wr_spanning_store(memset (&b_node,0 ,sizeof (struct maple_big_node ));/* Copy l_mas and store the value in b_node. */ mas_store_b_node (&l_wr_mas, &b_node, l_mas.end); -/* Copy r_mas into b_node. */ -if (r_mas.offset <= r_mas.end) +/* Copy r_mas into b_node if there is anything to copy. */ +if (r_mas.max > r_mas.last)mas_mab_cp (&r_mas, r_mas.offset, r_mas.end, &b_node, b_node.b_end +1 );else
Greg Kroah-Hartman
maintainerPATCH 22/135 nilfs2: propagate directory read errors from nilfs_find_entry()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 08cfa12adf888db98879dbd735bc741360a34168 upstream.
Syzbot reported that a task hang occurs in vcs_open() during a fuzzing test for nilfs2.
The root cause of this problem is that in nilfs_find_entry(), which searches for directory entries, ignores errors when loading a directory page/folio via nilfs_get_folio() fails.
If the filesystem images is corrupted, and the i_size of the directory inode is large, and the directory page/folio is successfully read but fails the sanity check, for example when it is zero-filled, nilfs_check_folio() may continue to spit out error messages in bursts.
Fix this issue by propagating the error to the callers when loading a page/folio fails in nilfs_find_entry().
The current interface of nilfs_find_entry() and its callers is outdated and cannot propagate error codes such as -EIO and -ENOMEM returned via nilfs_find_entry(), so fix it together.
--- fs/nilfs2/dir.c | 48 +++++++++++++++++++++++++----------------------- fs/nilfs2/namei.c | 39 ++++++++++++++++++++++++++------------- fs/nilfs2/nilfs.h | 2 +- 3 files changed, 52 insertions(+), 37 deletions(-)
fs/nilfs2/dir.c +25 -23
@@ -323,7 +323,7 @@ static int nilfs_readdir(struct file *fi* The folio is mapped and unlocked. When the caller is finished with * the entry, it should call folio_release_kmap(). * -* On failure, returns NULL and the caller should ignore foliop. +* On failure, returns an error pointer and the caller should ignore foliop. */ struct nilfs_dir_entry *nilfs_find_entry (struct inode *dir,const struct qstr *qstr,struct folio **foliop)
@@ -346,22 +346,24 @@ struct nilfs_dir_entry *nilfs_find_entry do { char *kaddr = nilfs_get_folio(dir, n, foliop); - if (!IS_ERR(kaddr)) { - de = (struct nilfs_dir_entry *)kaddr; - kaddr += nilfs_last_byte(dir, n) - reclen; - while ((char *) de <= kaddr) { - if (de->rec_len == 0) { - nilfs_error(dir->i_sb, - "zero-length directory entry"); - folio_release_kmap(*foliop, kaddr); - goto out; - } - if (nilfs_match(namelen, name, de)) - goto found; - de = nilfs_next_entry(de); + if (IS_ERR(kaddr)) + return ERR_CAST(kaddr); + + de = (struct nilfs_dir_entry *)kaddr; + kaddr += nilfs_last_byte(dir, n) - reclen; + while ((char *)de <= kaddr) { + if (de->rec_len == 0) { + nilfs_error(dir->i_sb, + "zero-length directory entry"); + folio_release_kmap(*foliop, kaddr); + goto out; } - folio_release_kmap(*foliop, kaddr); + if (nilfs_match(namelen, name, de)) + goto found; + de = nilfs_next_entry(de); } + folio_release_kmap(*foliop, kaddr); + if (++n >= npages) n = 0; /* next folio is past the blocks we've got */
@@ -374,7 +376,7 @@ struct nilfs_dir_entry *nilfs_find_entry } }while (n != start); out: -return NULL ; +return ERR_PTR (-ENOENT ); found: ei->i_dir_start_lookup = n;
@@ -418,18 +420,18 @@ fail:return NULL ; } -ino_t nilfs_inode_by_name (struct inode *dir,const struct qstr *qstr) +int nilfs_inode_by_name (struct inode *dir,const struct qstr *qstr,ino_t *ino) { -ino_t res =0 ;struct nilfs_dir_entry *de;struct folio *folio; de =nilfs_find_entry (dir, qstr, &folio); -if (de) { - res =le64_to_cpu (de->inode); -folio_release_kmap (folio, de); - } -return res; +if (IS_ERR (de)) +return PTR_ERR (de); + + *ino =le64_to_cpu (de->inode); +folio_release_kmap (folio, de); +return 0 ; } void nilfs_set_link(struct inode *dir, struct nilfs_dir_entry *de,
fs/nilfs2/namei.c +26 -13
@@ -55,12 +55,20 @@ nilfs_lookup(struct inode *dir, struct d {struct inode *inode;ino_t ino; +int res;if (dentry->d_name.len >NILFS_NAME_LEN )return ERR_PTR (-ENAMETOOLONG ); - ino =nilfs_inode_by_name (dir, &dentry->d_name); - inode = ino ?nilfs_iget (dir->i_sb,NILFS_I (dir)->i_root, ino) :NULL ; + res =nilfs_inode_by_name (dir, &dentry->d_name, &ino); +if (res) { +if (res != -ENOENT ) +return ERR_PTR (res); + inode =NULL ; + }else { + inode =nilfs_iget (dir->i_sb,NILFS_I (dir)->i_root, ino); + } +return d_splice_alias (inode, dentry); }
@@ -263,10 +271,11 @@ static int nilfs_do_unlink(struct inodestruct folio *folio;int err; - err = -ENOENT ; de =nilfs_find_entry (dir, &dentry->d_name, &folio); -if (!de) +if (IS_ERR (de)) { + err =PTR_ERR (de); goto out; + } inode =d_inode (dentry); err = -EIO ;
@@ -362,10 +371,11 @@ static int nilfs_rename(struct mnt_idmapif (unlikely (err))return err; - err = -ENOENT ; old_de =nilfs_find_entry (old_dir, &old_dentry->d_name, &old_folio); -if (!old_de) +if (IS_ERR (old_de)) { + err =PTR_ERR (old_de); goto out; + }if (S_ISDIR (old_inode->i_mode)) { err = -EIO ;
@@ -382,10 +392,12 @@ static int nilfs_rename(struct mnt_idmapif (dir_de && !nilfs_empty_dir (new_inode)) goto out_dir; - err = -ENOENT ; - new_de =nilfs_find_entry (new_dir, &new_dentry->d_name, &new_folio); -if (!new_de) + new_de =nilfs_find_entry (new_dir, &new_dentry->d_name, + &new_folio); +if (IS_ERR (new_de)) { + err =PTR_ERR (new_de); goto out_dir; + }nilfs_set_link (new_dir, new_de, new_folio, old_inode);folio_release_kmap (new_folio, new_de);nilfs_mark_inode_dirty (new_dir);
@@ -440,12 +452,13 @@ out:*/ static struct dentry *nilfs_get_parent (struct dentry *child) { -unsigned long ino; +ino_t ino; +int res;struct nilfs_root *root; - ino =nilfs_inode_by_name (d_inode (child), &dotdot_name); -if (!ino) -return ERR_PTR (-ENOENT ); + res =nilfs_inode_by_name (d_inode (child), &dotdot_name, &ino); +if (res) +return ERR_PTR (res); root =NILFS_I (d_inode (child))->i_root;
fs/nilfs2/nilfs.h +1 -1
@@ -233,7 +233,7 @@ static inline __u32 nilfs_mask_flags(umo/* dir.c */ int nilfs_add_link (struct dentry *,struct inode *); -ino_t nilfs_inode_by_name (struct inode *,const struct qstr *); +int nilfs_inode_by_name (struct inode *dir,const struct qstr *qstr,ino_t *ino);int nilfs_make_empty (struct inode *,struct inode *);struct nilfs_dir_entry *nilfs_find_entry (struct inode *,const struct qstr *,struct folio **);
Greg Kroah-Hartman
maintainerPATCH 23/135 fat: fix uninitialized variable
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: OGAWA Hirofumi <[email protected]>
commit 963a7f4d3b90ee195b895ca06b95757fcba02d1a upstream.
syszbot produced this with a corrupted fs image. In theory, however an IO error would trigger this also.
This affects just an error report, so should not be a serious error.
--- fs/fat/namei_vfat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fat/namei_vfat.c +1 -1
@@ -1037,7 +1037,7 @@ error_inode:if (corrupt <0 ) {fat_fs_error (new_dir->i_sb,"%s: Filesystem corrupted (i_pos %lld)" , - __func__, sinfo.i_pos); + __func__, new_i_pos); } goto out; }
Greg Kroah-Hartman
maintainerPATCH 24/135 lib: alloc_tag_module_unload must wait for pending kfree_rcu calls
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit dc783ba4b9df3fb3e76e968b2cbeb9960069263c upstream.
Ben Greear reports following splat:
------------[ cut here ]------------ net/netfilter/nf_nat_core.c:1114 module nf_nat func:nf_nat_register_fn has 256 allocated at module unload WARNING: CPU: 1 PID: 10421 at lib/alloc_tag.c:168 alloc_tag_module_unload+0x22b/0x3f0 Modules linked in: nf_nat(-) btrfs ufs qnx4 hfsplus hfs minix vfat msdos fat ... Hardware name: Default string Default string/SKYBAY, BIOS 5.12 08/04/2020 RIP: 0010:alloc_tag_module_unload+0x22b/0x3f0 codetag_unload_module+0x19b/0x2a0 ? codetag_load_module+0x80/0x80
nf_nat module exit calls kfree_rcu on those addresses, but the free operation is likely still pending by the time alloc_tag checks for leaks.
Wait for outstanding kfree_rcu operations to complete before checking resolves this warning.
Reproducer:
unshare -n iptables-nft -t nat -A PREROUTING -p tcp grep nf_nat /proc/allocinfo # will list 4 allocations rmmod nft_chain_nat
rmmod nf_nat # will WARN.
--- lib/codetag.c | 3 +++ 1 file changed, 3 insertions(+)
lib/codetag.c +3 -0
@@ -228,6 +228,9 @@ bool codetag_unload_module(struct module *mod)if (!mod)return true; +/* await any module's kfree_rcu() operations to complete */ +kvfree_rcu_barrier (); +mutex_lock (&codetag_lock);list_for_each_entry (cttype, &codetag_types, link) {struct codetag_module *found =NULL ;
Signature · 1 line
2.47.0
Re: [PATCH 6.11 024/135] lib: alloc_tag_module_unload must wait for pending kfree_rcu calls
Quoted 1 line · Greg Kroah-Hartman
6.11-stable review patch. If anyone has any objections, please let me know.
This won't compile in my 6.11 tree (as of last week), I think it needs more upstream patches and/or a different work-around.
Possibly that has already been backported into 6.11 stable and I just haven't seen it yet.
Thanks,
Ben
Quoted 61 lines
------------------
From: Florian Westphal <[email protected]>
commit
dc783ba4b9df3fb3e76e968b2cbeb9960069263cupstream.Ben Greear reports following splat:
------------[ cut here ]------------ net/netfilter/nf_nat_core.c:1114 module nf_nat func:nf_nat_register_fn has 256 allocated at module unload WARNING: CPU: 1 PID: 10421 at lib/alloc_tag.c:168 alloc_tag_module_unload+0x22b/0x3f0 Modules linked in: nf_nat(-) btrfs ufs qnx4 hfsplus hfs minix vfat msdos fat ... Hardware name: Default string Default string/SKYBAY, BIOS 5.12 08/04/2020 RIP: 0010:alloc_tag_module_unload+0x22b/0x3f0 codetag_unload_module+0x19b/0x2a0 ? codetag_load_module+0x80/0x80
nf_natmodule exit callskfree_rcuon those addresses, but the free operation is likely still pending by the timealloc_tagchecks for leaks.Wait for outstanding
kfree_rcuoperations to complete before checking resolves this warning.Reproducer:
unshare -n iptables-nft -t nat -A PREROUTING -p tcp grepnf_nat/proc/allocinfo# will list 4 allocations rmmodnft_chain_nat
rmmodnf_nat# will WARN.[[email protected]: add comment]Fixes a473573964e5 ("lib: code tagging module support")Signed-off-by Florian Westphal <[email protected]>Reported-by Ben Greear <[email protected]>Cc Uladzislau Rezki <[email protected]>Cc Vlastimil Babka <[email protected]>Cc Suren Baghdasaryan <[email protected]>Cc Kent Overstreet <[email protected]>Cc <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- lib/codetag.c | 3 +++ 1 file changed, 3 insertions(+)lib/codetag.c +3
-0@@ -228,6 +228,9 @@ bool codetag_unload_module(struct module *mod)if (!mod)return true; +/* await any module's kfree_rcu() operations to complete */ +kvfree_rcu_barrier (); +mutex_lock (&codetag_lock);list_for_each_entry (cttype, &codetag_types, link) {struct codetag_module *found =NULL ;
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Re: [PATCH 6.11 024/135] lib: alloc_tag_module_unload must wait for pending kfree_rcu calls
Quoted 9 lines · Ben Greear
Quoted 1 line · Greg Kroah-Hartman
6.11-stable review patch. If anyone has any objections, please let me know.
This won't compile in my 6.11 tree (as of last week), I think it needs more upstream patches and/or a different work-around.
Possibly that has already been backported into 6.11 stable and I just haven't seen it yet.
Right. The kvfree_rcu_barrier() will appear starting from 6.12 kernel.
--
Uladzislau Rezki
Re: [PATCH 6.11 024/135] lib: alloc_tag_module_unload must wait for pending kfree_rcu calls
Quoted 5 lines · Uladzislau Rezki
Quoted 3 lines · Ben Greear
Quoted 1 line · Greg Kroah-Hartman
6.11-stable review patch. If anyone has any objections, please let me know.
Quoted 7 lines
Quoted 6 lines
This won't compile in my 6.11 tree (as of last week), I think it needs more upstream patches and/or a different work-around.
Possibly that has already been backported into 6.11 stable and I just haven't seen it yet.
Right. The
kvfree_rcu_barrier()will appear starting from 6.12 kernel.
I have 6.11 backport for this fix which also includes kvfree_rcu_barrier() backport. I was waiting for this fix to be merged into Linus' tree and now I can post it. Will send it shortly.
Quoted 3 lines
--
Uladzislau Rezki
Re: [PATCH 6.11 024/135] lib: alloc_tag_module_unload must wait for pending kfree_rcu calls
Quoted 9 lines · Suren Baghdasaryan
Quoted 8 lines · Uladzislau Rezki
Quoted 6 lines · Ben Greear
Quoted 1 line · Greg Kroah-Hartman
6.11-stable review patch. If anyone has any objections, please let me know.
This won't compile in my 6.11 tree (as of last week), I think it needs more upstream patches and/or a different work-around.
Quoted 9 lines
Quoted 4 lines
Quoted 3 lines
Possibly that has already been backported into 6.11 stable and I just haven't seen it yet.
Right. The
kvfree_rcu_barrier()will appear starting from 6.12 kernel.I have 6.11 backport for this fix which also includes
kvfree_rcu_barrier()backport. I was waiting for this fix to be merged into Linus' tree and now I can post it. Will send it shortly.
This is good, i reacted because i have not see the "other parts" yet. So, sounds good!
--
Uladzislau Rezki
Greg Kroah-Hartman
maintainerRe: [PATCH 6.11 024/135] lib: alloc_tag_module_unload must wait for pending kfree_rcu calls
In reply to Uladzislau RezkiQuoted 11 lines · Uladzislau Rezki
Quoted 9 lines · Ben Greear
Quoted 1 line · Greg Kroah-Hartman
6.11-stable review patch. If anyone has any objections, please let me know.
This won't compile in my 6.11 tree (as of last week), I think it needs more upstream patches and/or a different work-around.
Possibly that has already been backported into 6.11 stable and I just haven't seen it yet.
Right. The
kvfree_rcu_barrier()will appear starting from 6.12 kernel.
Ick, how is it building on all of my tests? What config option am I missing?
thanks,
greg k-h
Re: [PATCH 6.11 024/135] lib: alloc_tag_module_unload must wait for pending kfree_rcu calls
Quoted 8 lines · Greg Kroah-Hartman
Quoted 7 lines · Uladzislau Rezki
Quoted 6 lines · Ben Greear
Quoted 1 line · Greg Kroah-Hartman
6.11-stable review patch. If anyone has any objections, please let me know.
This won't compile in my 6.11 tree (as of last week), I think it needs more upstream patches and/or a different work-around.
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Possibly that has already been backported into 6.11 stable and I just haven't seen it yet.
Right. The
kvfree_rcu_barrier()will appear starting from 6.12 kernel.Ick, how is it building on all of my tests? What config option am I missing?
Most likely CONFIG_MEM_ALLOC_PROFILING
Depends on: PROC_FS [=y] && !DEBUG_FORCE_WEAK_PER_CPU [=n]
Re: [PATCH 6.11 024/135] lib: alloc_tag_module_unload must wait for pending kfree_rcu calls
Quoted 13 lines · Vlastimil Babka
Quoted 11 lines · Greg Kroah-Hartman
Quoted 10 lines · Uladzislau Rezki
Quoted 9 lines · Ben Greear
Quoted 1 line · Greg Kroah-Hartman
6.11-stable review patch. If anyone has any objections, please let me know.
This won't compile in my 6.11 tree (as of last week), I think it needs more upstream patches and/or a different work-around.
Possibly that has already been backported into 6.11 stable and I just haven't seen it yet.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Right. The
kvfree_rcu_barrier()will appear starting from 6.12 kernel.Ick, how is it building on all of my tests? What config option am I missing?
Most likely
CONFIG_MEM_ALLOC_PROFILING
Depends on:PROC_FS[=y] && !DEBUG_FORCE_WEAK_PER_CPU [=n]
Yes, it's disabled by default.
Quoted 1 line
Re: [PATCH 6.11 024/135] lib: alloc_tag_module_unload must wait for pending kfree_rcu calls
Quoted 17 lines · Suren Baghdasaryan
Quoted 15 lines · Vlastimil Babka
Quoted 13 lines · Greg Kroah-Hartman
Quoted 11 lines · Uladzislau Rezki
Quoted 9 lines · Ben Greear
Quoted 1 line · Greg Kroah-Hartman
6.11-stable review patch. If anyone has any objections, please let me know.
This won't compile in my 6.11 tree (as of last week), I think it needs more upstream patches and/or a different work-around.
Possibly that has already been backported into 6.11 stable and I just haven't seen it yet.
Right. The
kvfree_rcu_barrier()will appear starting from 6.12 kernel.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Ick, how is it building on all of my tests? What config option am I missing?
Most likely
CONFIG_MEM_ALLOC_PROFILING
Depends on:PROC_FS[=y] && !DEBUG_FORCE_WEAK_PER_CPU [=n]Yes, it's disabled by default.
6.11 backports including prerequisite patch are posted at
https://lore.kernel.org/all/[email protected]/
Quoted 2 lines
Quoted 2 lines
Greg Kroah-Hartman
maintainerRe: [PATCH 6.11 024/135] lib: alloc_tag_module_unload must wait for pending kfree_rcu calls
Quoted 21 lines · Suren Baghdasaryan
Quoted 20 lines · Suren Baghdasaryan
Quoted 18 lines · Vlastimil Babka
Quoted 15 lines · Greg Kroah-Hartman
Quoted 11 lines · Uladzislau Rezki
Quoted 9 lines · Ben Greear
Quoted 1 line · Greg Kroah-Hartman
6.11-stable review patch. If anyone has any objections, please let me know.
This won't compile in my 6.11 tree (as of last week), I think it needs more upstream patches and/or a different work-around.
Possibly that has already been backported into 6.11 stable and I just haven't seen it yet.
Right. The
kvfree_rcu_barrier()will appear starting from 6.12 kernel.Ick, how is it building on all of my tests? What config option am I missing?
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Most likely
CONFIG_MEM_ALLOC_PROFILING
Depends on:PROC_FS[=y] && !DEBUG_FORCE_WEAK_PER_CPU [=n]Yes, it's disabled by default.
6.11 backports including prerequisite patch are posted at
https://lore.kernel.org/all/[email protected]/
Thanks, I'll go drop this one from the tree for now and take those for the next stable release.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 25/135 selftests/mm: replace atomic_bool with pthread_barrier_t
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Liaw <[email protected]>
commit e61ef21e27e8deed8c474e9f47f4aa7bc37e138c upstream.
Patch series "selftests/mm: fix deadlock after pthread_create".
On Android arm, pthread_create followed by a fork caused a deadlock in the case where the fork required work to be completed by the created thread.
Update the synchronization primitive to use pthread_barrier instead of atomic_bool.
Apply the same fix to the wp-fork-with-event test.
This patch (of 2):
Swap synchronization primitive with pthread_barrier, so that stdatomic.h does not need to be included.
The synchronization is needed on Android ARM64; we see a deadlock with pthread_create when the parent thread races forward before the child has a chance to start doing work.
--- tools/testing/selftests/mm/uffd-common.c | 5 +++-- tools/testing/selftests/mm/uffd-common.h | 3 +-- tools/testing/selftests/mm/uffd-unit-tests.c | 14 ++++++++------ 3 files changed, 12 insertions(+), 10 deletions(-)
tools/testing/selftests/mm/uffd-common.c +3 -2
@@ -18,7 +18,7 @@ bool test_uffdio_wp = true;unsigned long long *count_verify;uffd_test_ops_t *uffd_test_ops;uffd_test_case_ops_t *uffd_test_case_ops; -atomic_bool ready_for_fork; +pthread_barrier_t ready_for_fork;static int uffd_mem_fd_create (off_t mem_size,bool hugetlb) {
@@ -519,7 +519,8 @@ void *uffd_poll_thread(void *arg) pollfd[1 ].fd = pipefd[cpu*2 ]; pollfd[1 ].events =POLLIN ; - ready_for_fork = true; +/* Ready for parent thread to fork */ +pthread_barrier_wait (&ready_for_fork);for (;;) { ret =poll (pollfd,2 ,-1 );
tools/testing/selftests/mm/uffd-common.h +1 -2
@@ -33,7 +33,6 @@#include <inttypes.h> #include <stdint.h> #include <sys/random.h> -#include <stdatomic.h> #include "../kselftest.h" #include "vm_util.h"
@@ -105,7 +104,7 @@ extern bool map_shared;extern bool test_uffdio_wp;extern unsigned long long *count_verify;extern volatile bool test_uffdio_copy_eexist; -extern atomic_bool ready_for_fork; +extern pthread_barrier_t ready_for_fork;extern uffd_test_ops_t anon_uffd_test_ops;extern uffd_test_ops_t shmem_uffd_test_ops;
tools/testing/selftests/mm/uffd-unit-tests.c +8 -6
@@ -774,7 +774,7 @@ static void uffd_sigbus_test_common(boolchar c;struct uffd_args args = {0 }; - ready_for_fork = false; +pthread_barrier_init (&ready_for_fork,NULL ,2 );fcntl (uffd,F_SETFL , uffd_flags |O_NONBLOCK );
@@ -791,8 +791,9 @@ static void uffd_sigbus_test_common(boolif (pthread_create (&uffd_mon,NULL , uffd_poll_thread, &args))err ("uffd_poll_thread create" ); -while (!ready_for_fork) - ;/* Wait for the poll_thread to start executing before forking */ +/* Wait for child thread to start before forking */ +pthread_barrier_wait (&ready_for_fork); +pthread_barrier_destroy (&ready_for_fork); pid =fork ();if (pid <0 )
@@ -833,7 +834,7 @@ static void uffd_events_test_common(boolchar c;struct uffd_args args = {0 }; - ready_for_fork = false; +pthread_barrier_init (&ready_for_fork,NULL ,2 );fcntl (uffd,F_SETFL , uffd_flags |O_NONBLOCK ); if (uffd_register(uffd, area_dst, nr_pages * page_size,
@@ -844,8 +845,9 @@ static void uffd_events_test_common(boolif (pthread_create (&uffd_mon,NULL , uffd_poll_thread, &args))err ("uffd_poll_thread create" ); -while (!ready_for_fork) - ;/* Wait for the poll_thread to start executing before forking */ +/* Wait for child thread to start before forking */ +pthread_barrier_wait (&ready_for_fork); +pthread_barrier_destroy (&ready_for_fork); pid =fork ();if (pid <0 )
Greg Kroah-Hartman
maintainerPATCH 26/135 selftests/mm: fix deadlock for fork after pthread_create on ARM
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Liaw <[email protected]>
commit e142cc87ac4ec618f2ccf5f68aedcd6e28a59d9d upstream.
On Android with arm, there is some synchronization needed to avoid a deadlock when forking after pthread_create.
--- tools/testing/selftests/mm/uffd-unit-tests.c | 7 +++++++ 1 file changed, 7 insertions(+)
tools/testing/selftests/mm/uffd-unit-tests.c +7 -0
@@ -241,6 +241,9 @@ static void *fork_event_consumer(void *dfork_event_args *args = data;struct uffd_msg msg = {0 }; +/* Ready for parent thread to fork */ +pthread_barrier_wait (&ready_for_fork); +/* Read until a full msg received */ while (uffd_read_msg (args->parent_uffd, &msg));
@@ -308,8 +311,12 @@ static int pagemap_test_fork(int uffd, b/* Prepare a thread to resolve EVENT_FORK */ if (with_event) { +pthread_barrier_init (&ready_for_fork,NULL ,2 );if (pthread_create (&thread,NULL , fork_event_consumer, &args))err ("pthread_create()" ); +/* Wait for child thread to start before forking */ +pthread_barrier_wait (&ready_for_fork); +pthread_barrier_destroy (&ready_for_fork); } child =fork ();
Greg Kroah-Hartman
maintainerPATCH 27/135 mm/mremap: fix move_normal_pmd/retract_page_tables race
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 6fa1066fc5d00cb9f1b0e83b7ff6ef98d26ba2aa upstream.
In mremap(), move_page_tables() looks at the type of the PMD entry and the specified address range to figure out by which method the next chunk of page table entries should be moved.
At that point, the mmap_lock is held in write mode, but no rmap locks are held yet. For PMD entries that point to page tables and are fully covered by the source address range, move_pgt_entry(NORMAL_PMD, ...) is called, which first takes rmap locks, then does move_normal_pmd(). move_normal_pmd() takes the necessary page table locks at source and destination, then moves an entire page table from the source to the destination.
The problem is: The rmap locks, which protect against concurrent page table removal by retract_page_tables() in the THP code, are only taken after the PMD entry has been read and it has been decided how to move it. So we can race as follows (with two processes that have mappings of the same tmpfs file that is stored on a tmpfs mount with huge=advise); note that process A accesses page tables through the MM while process B does it through the file rmap:
process A process B
========= =========
mremap
mremap_to
move_vma
move_page_tables
get_old_pmd
alloc_new_pmd
*** PREEMPT ***
madvise(MADV_COLLAPSE)
do_madvise
madvise_walk_vmas
madvise_vma_behavior
madvise_collapse
hpage_collapse_scan_file
collapse_file
retract_page_tables
i_mmap_lock_read(mapping)
pmdp_collapse_flush
i_mmap_unlock_read(mapping)
move_pgt_entry(NORMAL_PMD, ...)
take_rmap_locks
move_normal_pmd
drop_rmap_locksWhen this happens, move_normal_pmd() can end up creating bogus PMD entries in the line pmd_populate(mm, new_pmd, pmd_pgtable(pmd)). The effect depends on arch-specific and machine-specific details; on x86, you can end up with physical page 0 mapped as a page table, which is likely exploitable for user->kernel privilege escalation.
Fix the race by letting process B recheck that the PMD still points to a page table after the rmap locks have been taken. Otherwise, we bail and let the caller fall back to the PTE-level copying path, which will then bail immediately at the pmd_none() check.
Bug reachability: Reaching this bug requires that you can create shmem/file THP mappings - anonymous THP uses different code that doesn't zap stuff under rmap locks. File THP is gated on an experimental config flag (CONFIG_READ_ONLY_THP_FOR_FS), so on normal distro kernels you need shmem THP to hit this bug. As far as I know, getting shmem THP normally requires that you can mount your own tmpfs with the right mount flags, which would require creating your own user+mount namespace; though I don't know if some distros maybe enable shmem THP by default or something like that.
Bug impact: This issue can likely be used for user->kernel privilege escalation when it is reachable.
--- mm/mremap.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
mm/mremap.c +9 -2
@@ -238,6 +238,7 @@ static bool move_normal_pmd(struct vm_ar {spinlock_t *old_ptl, *new_ptl;struct mm_struct *mm = vma->vm_mm; +bool res = false;pmd_t pmd;if (!arch_supports_page_table_move ())
@@ -277,19 +278,25 @@ static bool move_normal_pmd(struct vm_arif (new_ptl != old_ptl)spin_lock_nested (new_ptl,SINGLE_DEPTH_NESTING ); -/* Clear the pmd */ pmd = *old_pmd; + +/* Racing with collapse? */ +if (unlikely (!pmd_present (pmd) ||pmd_leaf (pmd))) + goto out_unlock; +/* Clear the pmd */ pmd_clear (old_pmd); + res = true;VM_BUG_ON (!pmd_none (*new_pmd));pmd_populate (mm, new_pmd,pmd_pgtable (pmd));flush_tlb_range (vma, old_addr, old_addr +PMD_SIZE ); +out_unlock:if (new_ptl != old_ptl)spin_unlock (new_ptl);spin_unlock (old_ptl); -return true; +return res; }#else static inline bool move_normal_pmd(struct vm_area_struct *vma,
Greg Kroah-Hartman
maintainerPATCH 28/135 mm: khugepaged: fix the arguments order in khugepaged_collapse_file trace point
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Shi <[email protected]>
commit 37f0b47c5143c2957909ced44fc09ffb118c99f7 upstream.
The "addr" and "is_shmem" arguments have different order in TP_PROTO and TP_ARGS. This resulted in the incorrect trace result:
text-hugepage-644429 [276] 392092.878683: mm_khugepaged_collapse_file:
mm=0xffff20025d52c440, hpage_pfn=0x200678c00, index=512, addr=1, is_shmem=0, filename=text-hugepage, nr=512, result=failed
The value of "addr" is wrong because it was treated as bool value, the type of is_shmem.
Fix the order in TP_PROTO to keep "addr" is before "is_shmem" since the original patch review suggested this order to achieve best packing.
And use "lx" for "addr" instead of "ld" in TP_printk because address is typically shown in hex.
After the fix, the trace result looks correct:
text-hugepage-7291 [004] 128.627251: mm_khugepaged_collapse_file:
mm=0xffff0001328f9500, hpage_pfn=0x20016ea00, index=512, addr=0x400000, is_shmem=0, filename=text-hugepage, nr=512, result=failed
--- include/trace/events/huge_memory.h | 4 ++-- mm/khugepaged.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
include/trace/events/huge_memory.h +2 -2
@@ -208,7 +208,7 @@ TRACE_EVENT(mm_khugepaged_scan_file, TRACE_EVENT(mm_khugepaged_collapse_file, TP_PROTO(struct mm_struct *mm, struct folio *new_folio, pgoff_t index, - bool is_shmem, unsigned long addr, struct file *file, + unsigned long addr, bool is_shmem, struct file *file, int nr, int result), TP_ARGS(mm, new_folio, index, addr, is_shmem, file, nr, result), TP_STRUCT__entry(
@@ -233,7 +233,7 @@ TRACE_EVENT(mm_khugepaged_collapse_file, __entry->result = result; ), - TP_printk("mm=%p, hpage_pfn=0x%lx, index=%ld, addr=%ld, is_shmem=%d, filename=%s, nr=%d, result=%s", + TP_printk("mm=%p, hpage_pfn=0x%lx, index=%ld, addr=%lx, is_shmem=%d, filename=%s, nr=%d, result=%s", __entry->mm, __entry->hpfn, __entry->index,
mm/khugepaged.c +1 -1
@@ -2219,7 +2219,7 @@ rollback:folio_put (new_folio); out:VM_BUG_ON (!list_empty (&pagelist)); -trace_mm_khugepaged_collapse_file (mm, new_folio, index, is_shmem, addr, file,HPAGE_PMD_NR , result); +trace_mm_khugepaged_collapse_file (mm, new_folio, index, addr, is_shmem, file,HPAGE_PMD_NR , result);return result; }
Greg Kroah-Hartman
maintainerPATCH 29/135 mm/mglru: only clear kswapd_failures if reclaimable
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Xu <[email protected]>
commit b130ba4a6259f6b64d8af15e9e7ab1e912bcb7ad upstream.
lru_gen_shrink_node() unconditionally clears kswapd_failures, which can prevent kswapd from sleeping and cause 100% kswapd cpu usage even when kswapd repeatedly fails to make progress in reclaim.
Only clear kswap_failures in lru_gen_shrink_node() if reclaim makes some progress, similar to shrink_node().
I happened to run into this problem in one of my tests recently. It requires a combination of several conditions: The allocator needs to allocate a right amount of pages such that it can wake up kswapd without itself being OOM killed; there is no memory for kswapd to reclaim (My test disables swap and cleans page cache first); no other process frees enough memory at the same time.
--- mm/vmscan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/vmscan.c +2 -2
@@ -4940,8 +4940,8 @@ static void lru_gen_shrink_node(struct pblk_finish_plug (&plug); done: -/* kswapd should never fail */ - pgdat->kswapd_failures =0 ; +if (sc->nr_reclaimed > reclaimed) + pgdat->kswapd_failures =0 ; }/******************************************************************************
Greg Kroah-Hartman
maintainerPATCH 30/135 mm/swapfile: skip HugeTLB pages for unuse_vma
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Shixin <[email protected]>
commit 7528c4fb1237512ee18049f852f014eba80bbe8d upstream.
I got a bad pud error and lost a 1GB HugeTLB when calling swapoff. The problem can be reproduced by the following steps:
1. Allocate an anonymous 1GB HugeTLB and some other anonymous memory.
2. Swapout the above anonymous memory.
3. run swapoff and we will get a bad pud error in kernel message:
mm/pgtable-generic.c:42: bad pud 00000000743d215d(84000001400000e7)
We can tell that pud_clear_bad is called by pud_none_or_clear_bad in unuse_pud_range() by ftrace. And therefore the HugeTLB pages will never be freed because we lost it from page table. We can skip HugeTLB pages for unuse_vma to fix it.
--- mm/swapfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/swapfile.c +1 -1
@@ -2106,7 +2106,7 @@ static int unuse_mm(struct mm_struct *mmmmap_read_lock (mm);for_each_vma (vmi, vma) { -if (vma->anon_vma) { +if (vma->anon_vma && !is_vm_hugetlb_page (vma)) { ret =unuse_vma (vma, type);if (ret)break ;
Greg Kroah-Hartman
maintainerPATCH 31/135 mm/damon/tests/sysfs-kunit.h: fix memory leak in damon_sysfs_test_add_targets()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <[email protected]>
commit 2d6a1c835685de3b0c8e8dc871f60f4ef92ab01a upstream.
The sysfs_target->regions allocated in damon_sysfs_regions_alloc() is not freed in damon_sysfs_test_add_targets(), which cause the following memory leak, free it to fix it.
unreferenced object 0xffffff80c2a8db80 (size 96): comm "kunit_try_catch", pid 187, jiffies 4294894363 hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace (crc 0): [<0000000001e3714d>] kmemleak_alloc+0x34/0x40 [<000000008e6835c1>] __kmalloc_cache_noprof+0x26c/0x2f4 [<000000001286d9f8>] damon_sysfs_test_add_targets+0x1cc/0x738 [<0000000032ef8f77>] kunit_try_run_case+0x13c/0x3ac [<00000000f3edea23>] kunit_generic_run_threadfn_adapter+0x80/0xec [<00000000adf936cf>] kthread+0x2e8/0x374 [<0000000041bb1628>] ret_from_fork+0x10/0x20
--- mm/damon/sysfs-test.h | 1 + 1 file changed, 1 insertion(+)
mm/damon/sysfs-test.h +1 -0
@@ -67,6 +67,7 @@ static void damon_sysfs_test_add_targetsdamon_destroy_ctx (ctx);kfree (sysfs_targets->targets_arr);kfree (sysfs_targets); +kfree (sysfs_target->regions);kfree (sysfs_target); }
Greg Kroah-Hartman
maintainerPATCH 32/135 tcp: fix mptcp DSS corruption due to large pmtu xmit
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit 4dabcdf581217e60690467a37c956a5b8dbc6bd9 upstream.
Syzkaller was able to trigger a DSS corruption:
TCP: request_sock_subflow_v4: Possible SYN flooding on port [::]:20002. Sending cookies.
------------[ cut here ]------------ WARNING: CPU: 0 PID: 5227 at net/mptcp/protocol.c:695 __mptcp_move_skbs_from_subflow+0x20a9/0x21f0 net/mptcp/protocol.c:695 Modules linked in: CPU: 0 UID: 0 PID: 5227 Comm: syz-executor350 Not tainted 6.11.0-syzkaller-08829-gaf9c191ac2a0 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 RIP: 0010:__mptcp_move_skbs_from_subflow+0x20a9/0x21f0 net/mptcp/protocol.c:695 Code: 0f b6 dc 31 ff 89 de e8 b5 dd ea f5 89 d8 48 81 c4 50 01 00 00 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc e8 98 da ea f5 90 <0f> 0b 90 e9 47 ff ff ff e8 8a da ea f5 90 0f 0b 90 e9 99 e0 ff ff RSP: 0018:ffffc90000006db8 EFLAGS: 00010246 RAX: ffffffff8ba9df18 RBX: 00000000000055f0 RCX: ffff888030023c00 RDX: 0000000000000100 RSI: 00000000000081e5 RDI: 00000000000055f0 RBP: 1ffff110062bf1ae R08: ffffffff8ba9cf12 R09: 1ffff110062bf1b8 R10: dffffc0000000000 R11: ffffed10062bf1b9 R12: 0000000000000000 R13: dffffc0000000000 R14: 00000000700cec61 R15: 00000000000081e5 FS: 000055556679c380(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020287000 CR3: 0000000077892000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <IRQ> move_skbs_to_msk net/mptcp/protocol.c:811 [inline] mptcp_data_ready+0x29c/0xa90 net/mptcp/protocol.c:854 subflow_data_ready+0x34a/0x920 net/mptcp/subflow.c:1490 tcp_data_queue+0x20fd/0x76c0 net/ipv4/tcp_input.c:5283 tcp_rcv_established+0xfba/0x2020 net/ipv4/tcp_input.c:6237 tcp_v4_do_rcv+0x96d/0xc70 net/ipv4/tcp_ipv4.c:1915 tcp_v4_rcv+0x2dc0/0x37f0 net/ipv4/tcp_ipv4.c:2350 ip_protocol_deliver_rcu+0x22e/0x440 net/ipv4/ip_input.c:205 ip_local_deliver_finish+0x341/0x5f0 net/ipv4/ip_input.c:233 NF_HOOK+0x3a4/0x450 include/linux/netfilter.h:314 NF_HOOK+0x3a4/0x450 include/linux/netfilter.h:314 __netif_receive_skb_one_core net/core/dev.c:5662 [inline] __netif_receive_skb+0x2bf/0x650 net/core/dev.c:5775 process_backlog+0x662/0x15b0 net/core/dev.c:6107 __napi_poll+0xcb/0x490 net/core/dev.c:6771 napi_poll net/core/dev.c:6840 [inline] net_rx_action+0x89b/0x1240 net/core/dev.c:6962 handle_softirqs+0x2c5/0x980 kernel/softirq.c:554 do_softirq+0x11b/0x1e0 kernel/softirq.c:455 </IRQ> <TASK> __local_bh_enable_ip+0x1bb/0x200 kernel/softirq.c:382 local_bh_enable include/linux/bottom_half.h:33 [inline] rcu_read_unlock_bh include/linux/rcupdate.h:919 [inline] __dev_queue_xmit+0x1764/0x3e80 net/core/dev.c:4451 dev_queue_xmit include/linux/netdevice.h:3094 [inline] neigh_hh_output include/net/neighbour.h:526 [inline] neigh_output include/net/neighbour.h:540 [inline] ip_finish_output2+0xd41/0x1390 net/ipv4/ip_output.c:236 ip_local_out net/ipv4/ip_output.c:130 [inline] __ip_queue_xmit+0x118c/0x1b80 net/ipv4/ip_output.c:536 __tcp_transmit_skb+0x2544/0x3b30 net/ipv4/tcp_output.c:1466 tcp_transmit_skb net/ipv4/tcp_output.c:1484 [inline] tcp_mtu_probe net/ipv4/tcp_output.c:2547 [inline] tcp_write_xmit+0x641d/0x6bf0 net/ipv4/tcp_output.c:2752 __tcp_push_pending_frames+0x9b/0x360 net/ipv4/tcp_output.c:3015 tcp_push_pending_frames include/net/tcp.h:2107 [inline] tcp_data_snd_check net/ipv4/tcp_input.c:5714 [inline] tcp_rcv_established+0x1026/0x2020 net/ipv4/tcp_input.c:6239 tcp_v4_do_rcv+0x96d/0xc70 net/ipv4/tcp_ipv4.c:1915 sk_backlog_rcv include/net/sock.h:1113 [inline] __release_sock+0x214/0x350 net/core/sock.c:3072 release_sock+0x61/0x1f0 net/core/sock.c:3626 mptcp_push_release net/mptcp/protocol.c:1486 [inline] __mptcp_push_pending+0x6b5/0x9f0 net/mptcp/protocol.c:1625 mptcp_sendmsg+0x10bb/0x1b10 net/mptcp/protocol.c:1903 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x1a6/0x270 net/socket.c:745 ____sys_sendmsg+0x52a/0x7e0 net/socket.c:2603 ___sys_sendmsg net/socket.c:2657 [inline] __sys_sendmsg+0x2aa/0x390 net/socket.c:2686 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 RIP: 0033:0x7fb06e9317f9 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffe2cfd4f98 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007fb06e97f468 RCX: 00007fb06e9317f9 RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000000000005 RBP: 00007fb06e97f446 R08: 0000555500000000 R09: 0000555500000000 R10: 0000555500000000 R11: 0000000000000246 R12: 00007fb06e97f406 R13: 0000000000000001 R14: 00007ffe2cfd4fe0 R15: 0000000000000003 </TASK>
Additionally syzkaller provided a nice reproducer. The repro enables pmtu on the loopback device, leading to tcp_mtu_probe() generating very large probe packets.
tcp_can_coalesce_send_queue_head() currently does not check for mptcp-level invariants, and allowed the creation of cross-DSS probes, leading to the mentioned corruption.
Address the issue teaching tcp_can_coalesce_send_queue_head() about mptcp using the tcp_skb_can_collapse(), also reducing the code duplication.
[ Conflict in tcp_output.c, because the commit 65249feb6b3d ("net: add
support for skbs with unreadable frags") is not in this version. This commit is linked to a new feature (Devmem TCP) and introduces a new condition which causes the conflicts. Resolving this is easy: we can ignore the missing new condition, and use tcp_skb_can_collapse() like in the original patch. ]
--- net/ipv4/tcp_output.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/ipv4/tcp_output.c +1 -3
@@ -2342,9 +2342,7 @@ static bool tcp_can_coalesce_send_queue_if (len <= skb->len)break ; -if (unlikely (TCP_SKB_CB (skb)->eor) || -tcp_has_tx_tstamp (skb) || - !skb_pure_zcopy_same (skb, next)) +if (tcp_has_tx_tstamp (skb) || !tcp_skb_can_collapse (skb, next))return false; len -= skb->len;
Greg Kroah-Hartman
maintainerPATCH 33/135 net: fec: Move `fec_ptp_read()` to the top of the file
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Csókás, Bence <[email protected]>
commit 4374a1fe580a14f6152752390c678d90311df247 upstream.
This function is used in fec_ptp_enable_pps() through struct cyclecounter read(). Moving the declaration makes it clearer, what's happening.
--- drivers/net/ethernet/freescale/fec_ptp.c | 50 +++++++++++++++---------------- 1 file changed, 25 insertions(+), 25 deletions(-)
drivers/net/ethernet/freescale/fec_ptp.c +25 -25
@@ -91,6 +91,30 @@#define FEC_PTP_MAX_NSEC_COUNTER 0x80000000ULL/** +* fec_ptp_read - read raw cycle counter (to be used by time counter) +* @cc: the cyclecounter structure +* +* this function reads the cyclecounter registers and is called by the +* cyclecounter structure used to construct a ns counter from the +* arbitrary fixed point registers +*/ +static u64 fec_ptp_read (const struct cyclecounter *cc) +{ +struct fec_enet_private *fep = + container_of(cc, struct fec_enet_private, cc); +u32 tempval; + + tempval =readl (fep->hwp +FEC_ATIME_CTRL ); + tempval |=FEC_T_CTRL_CAPTURE ; +writel (tempval, fep->hwp +FEC_ATIME_CTRL ); + +if (fep->quirks &FEC_QUIRK_BUG_CAPTURE ) +udelay (1 ); + +return readl (fep->hwp +FEC_ATIME ); +} + +/** * fec_ptp_enable_pps * @fep: the fec_enet_private structure handle * @enable: enable the channel pps output
@@ -136,7 +160,7 @@ static int fec_ptp_enable_pps(struct fec* NSEC_PER_SEC - ts.tv_nsec. Add the remaining nanoseconds * to current timer would be next second. */ - tempval = fep->cc.read (&fep->cc); + tempval =fec_ptp_read (&fep->cc);/* Convert the ptp local counter to 1588 timestamp */ ns =timecounter_cyc2time (&fep->tc, tempval); ts =ns_to_timespec64 (ns);
@@ -272,30 +296,6 @@ static enum hrtimer_restart fec_ptp_pps_ }/** -* fec_ptp_read - read raw cycle counter (to be used by time counter) -* @cc: the cyclecounter structure -* -* this function reads the cyclecounter registers and is called by the -* cyclecounter structure used to construct a ns counter from the -* arbitrary fixed point registers -*/ -static u64 fec_ptp_read (const struct cyclecounter *cc) -{ -struct fec_enet_private *fep = - container_of(cc, struct fec_enet_private, cc); -u32 tempval; - - tempval =readl (fep->hwp +FEC_ATIME_CTRL ); - tempval |=FEC_T_CTRL_CAPTURE ; -writel (tempval, fep->hwp +FEC_ATIME_CTRL ); - -if (fep->quirks &FEC_QUIRK_BUG_CAPTURE ) -udelay (1 ); - -return readl (fep->hwp +FEC_ATIME ); -} - -/** * fec_ptp_start_cyclecounter - create the cycle counter from hw * @ndev: network device *
Greg Kroah-Hartman
maintainerPATCH 34/135 net: fec: Remove duplicated code
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Csókás, Bence <[email protected]>
commit 713ebaed68d88121cbaf5e74104e2290a9ea74bd upstream.
fec_ptp_pps_perout() reimplements logic already
in fec_ptp_read(). Replace with function call.
--- drivers/net/ethernet/freescale/fec_ptp.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/net/ethernet/freescale/fec_ptp.c +1 -7
@@ -235,13 +235,7 @@ static int fec_ptp_pps_perout(struct fectimecounter_read (&fep->tc);/* Get the current ptp hardware time counter */ - temp_val =readl (fep->hwp +FEC_ATIME_CTRL ); - temp_val |=FEC_T_CTRL_CAPTURE ; -writel (temp_val, fep->hwp +FEC_ATIME_CTRL ); -if (fep->quirks &FEC_QUIRK_BUG_CAPTURE ) -udelay (1 ); - - ptp_hc =readl (fep->hwp +FEC_ATIME ); + ptp_hc =fec_ptp_read (&fep->cc);/* Convert the ptp local counter to 1588 timestamp */ curr_time =timecounter_cyc2time (&fep->tc, ptp_hc);
Greg Kroah-Hartman
maintainerPATCH 35/135 mptcp: prevent MPC handshake on port-based signal endpoints
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit 3d041393ea8c815f773020fb4a995331a69c0139 upstream.
Syzkaller reported a lockdep splat:
============================================
WARNING: possible recursive locking detected 6.11.0-rc6-syzkaller-00019-g67784a74e258 #0 Not tainted
--------------------------------------------
syz-executor364/5113 is trying to acquire lock:
ffff8880449f1958 (k-slock-AF_INET){+.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline] ffff8880449f1958 (k-slock-AF_INET){+.-.}-{2:2}, at: sk_clone_lock+0x2cd/0xf40 net/core/sock.c:2328
but task is already holding lock:
ffff88803fe3cb58 (k-slock-AF_INET){+.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline] ffff88803fe3cb58 (k-slock-AF_INET){+.-.}-{2:2}, at: sk_clone_lock+0x2cd/0xf40 net/core/sock.c:2328
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(k-slock-AF_INET);
lock(k-slock-AF_INET);*** DEADLOCK ***
May be due to missing lock nesting notation
7 locks held by syz-executor364/5113:
#0: ffff8880449f0e18 (sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1607 [inline] #0: ffff8880449f0e18 (sk_lock-AF_INET){+.+.}-{0:0}, at: mptcp_sendmsg+0x153/0x1b10 net/mptcp/protocol.c:1806 #1: ffff88803fe39ad8 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1607 [inline] #1: ffff88803fe39ad8 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: mptcp_sendmsg_fastopen+0x11f/0x530 net/mptcp/protocol.c:1727 #2: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:326 [inline] #2: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:838 [inline] #2: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: __ip_queue_xmit+0x5f/0x1b80 net/ipv4/ip_output.c:470 #3: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:326 [inline] #3: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:838 [inline] #3: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: ip_finish_output2+0x45f/0x1390 net/ipv4/ip_output.c:228 #4: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: local_lock_acquire include/linux/local_lock_internal.h:29 [inline] #4: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: process_backlog+0x33b/0x15b0 net/core/dev.c:6104 #5: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:326 [inline] #5: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:838 [inline] #5: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: ip_local_deliver_finish+0x230/0x5f0 net/ipv4/ip_input.c:232 #6: ffff88803fe3cb58 (k-slock-AF_INET){+.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline] #6: ffff88803fe3cb58 (k-slock-AF_INET){+.-.}-{2:2}, at: sk_clone_lock+0x2cd/0xf40 net/core/sock.c:2328
stack backtrace: CPU: 0 UID: 0 PID: 5113 Comm: syz-executor364 Not tainted 6.11.0-rc6-syzkaller-00019-g67784a74e258 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: <IRQ> __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119 check_deadlock kernel/locking/lockdep.c:3061 [inline] validate_chain+0x15d3/0x5900 kernel/locking/lockdep.c:3855 __lock_acquire+0x137a/0x2040 kernel/locking/lockdep.c:5142 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:351 [inline] sk_clone_lock+0x2cd/0xf40 net/core/sock.c:2328 mptcp_sk_clone_init+0x32/0x13c0 net/mptcp/protocol.c:3279 subflow_syn_recv_sock+0x931/0x1920 net/mptcp/subflow.c:874 tcp_check_req+0xfe4/0x1a20 net/ipv4/tcp_minisocks.c:853 tcp_v4_rcv+0x1c3e/0x37f0 net/ipv4/tcp_ipv4.c:2267 ip_protocol_deliver_rcu+0x22e/0x440 net/ipv4/ip_input.c:205 ip_local_deliver_finish+0x341/0x5f0 net/ipv4/ip_input.c:233 NF_HOOK+0x3a4/0x450 include/linux/netfilter.h:314 NF_HOOK+0x3a4/0x450 include/linux/netfilter.h:314 __netif_receive_skb_one_core net/core/dev.c:5661 [inline] __netif_receive_skb+0x2bf/0x650 net/core/dev.c:5775 process_backlog+0x662/0x15b0 net/core/dev.c:6108 __napi_poll+0xcb/0x490 net/core/dev.c:6772 napi_poll net/core/dev.c:6841 [inline] net_rx_action+0x89b/0x1240 net/core/dev.c:6963 handle_softirqs+0x2c4/0x970 kernel/softirq.c:554 do_softirq+0x11b/0x1e0 kernel/softirq.c:455 </IRQ> <TASK> __local_bh_enable_ip+0x1bb/0x200 kernel/softirq.c:382 local_bh_enable include/linux/bottom_half.h:33 [inline] rcu_read_unlock_bh include/linux/rcupdate.h:908 [inline] __dev_queue_xmit+0x1763/0x3e90 net/core/dev.c:4450 dev_queue_xmit include/linux/netdevice.h:3105 [inline] neigh_hh_output include/net/neighbour.h:526 [inline] neigh_output include/net/neighbour.h:540 [inline] ip_finish_output2+0xd41/0x1390 net/ipv4/ip_output.c:235 ip_local_out net/ipv4/ip_output.c:129 [inline] __ip_queue_xmit+0x118c/0x1b80 net/ipv4/ip_output.c:535 __tcp_transmit_skb+0x2544/0x3b30 net/ipv4/tcp_output.c:1466 tcp_rcv_synsent_state_process net/ipv4/tcp_input.c:6542 [inline] tcp_rcv_state_process+0x2c32/0x4570 net/ipv4/tcp_input.c:6729 tcp_v4_do_rcv+0x77d/0xc70 net/ipv4/tcp_ipv4.c:1934 sk_backlog_rcv include/net/sock.h:1111 [inline] __release_sock+0x214/0x350 net/core/sock.c:3004 release_sock+0x61/0x1f0 net/core/sock.c:3558 mptcp_sendmsg_fastopen+0x1ad/0x530 net/mptcp/protocol.c:1733 mptcp_sendmsg+0x1884/0x1b10 net/mptcp/protocol.c:1812 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x1a6/0x270 net/socket.c:745 ____sys_sendmsg+0x525/0x7d0 net/socket.c:2597 ___sys_sendmsg net/socket.c:2651 [inline] __sys_sendmmsg+0x3b2/0x740 net/socket.c:2737 __do_sys_sendmmsg net/socket.c:2766 [inline] __se_sys_sendmmsg net/socket.c:2763 [inline] __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2763 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 RIP: 0033:0x7f04fb13a6b9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 01 1a 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffd651f42d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000133 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f04fb13a6b9 RDX: 0000000000000001 RSI: 0000000020000d00 RDI: 0000000000000004 RBP: 00007ffd651f4310 R08: 0000000000000001 R09: 0000000000000001 R10: 0000000020000080 R11: 0000000000000246 R12: 00000000000f4240 R13: 00007f04fb187449 R14: 00007ffd651f42f4 R15: 00007ffd651f4300 </TASK>
As noted by Cong Wang, the splat is false positive, but the code path leading to the report is an unexpected one: a client is attempting an MPC handshake towards the in-kernel listener created by the in-kernel PM for a port based signal endpoint.
Such connection will be never accepted; many of them can make the listener queue full and preventing the creation of MPJ subflow via such listener - its intended role.
Explicitly detect this scenario at initial-syn time and drop the incoming MPC request.
[ Conflicts in mib.[ch], because commit 6982826fe5e5 ("mptcp: fallback
to TCP after SYN+MPC drops"), and commit 27069e7cb3d1 ("mptcp: disable active MPTCP in case of blackhole") are linked to new features, not available in this version. Resolving the conflicts is easy, simply adding the new lines declaring the new "endpoint attempt" MIB entry. ]
--- net/mptcp/mib.c | 1 + net/mptcp/mib.h | 1 + net/mptcp/pm_netlink.c | 1 + net/mptcp/protocol.h | 1 + net/mptcp/subflow.c | 11 +++++++++++ 5 files changed, 15 insertions(+)
net/mptcp/mib.c +1 -0
@@ -15,6 +15,7 @@ static const struct snmp_mib mptcp_snmp_SNMP_MIB_ITEM ("MPCapableACKRX" ,MPTCP_MIB_MPCAPABLEPASSIVEACK ),SNMP_MIB_ITEM ("MPCapableFallbackACK" ,MPTCP_MIB_MPCAPABLEPASSIVEFALLBACK ),SNMP_MIB_ITEM ("MPCapableFallbackSYNACK" ,MPTCP_MIB_MPCAPABLEACTIVEFALLBACK ), +SNMP_MIB_ITEM ("MPCapableEndpAttempt" ,MPTCP_MIB_MPCAPABLEENDPATTEMPT ),SNMP_MIB_ITEM ("MPFallbackTokenInit" ,MPTCP_MIB_TOKENFALLBACKINIT ),SNMP_MIB_ITEM ("MPTCPRetrans" ,MPTCP_MIB_RETRANSSEGS ), SNMP_MIB_ITEM("MPJoinNoTokenFound", MPTCP_MIB_JOINNOTOKEN),
net/mptcp/mib.h +1 -0
@@ -10,6 +10,7 @@ enum linux_mptcp_mib_field {MPTCP_MIB_MPCAPABLEPASSIVEACK ,/* Received third ACK with MP_CAPABLE */ MPTCP_MIB_MPCAPABLEPASSIVEFALLBACK ,/* Server-side fallback during 3-way handshake */ MPTCP_MIB_MPCAPABLEACTIVEFALLBACK ,/* Client-side fallback during 3-way handshake */ +MPTCP_MIB_MPCAPABLEENDPATTEMPT ,/* Prohibited MPC to port-based endp */ MPTCP_MIB_TOKENFALLBACKINIT ,/* Could not init/allocate token */ MPTCP_MIB_RETRANSSEGS ,/* Segments retransmitted at the MPTCP-level */ MPTCP_MIB_JOINNOTOKEN, /* Received MP_JOIN but the token was not found */
net/mptcp/pm_netlink.c +1 -0
@@ -1117,6 +1117,7 @@ static int mptcp_pm_nl_create_listen_soc*/ inet_sk_state_store (newsk,TCP_LISTEN );lock_sock (ssk); +WRITE_ONCE (mptcp_subflow_ctx (ssk)->pm_listener, true); err =__inet_listen_sk (ssk, backlog);if (!err)mptcp_event_pm_listener (ssk,MPTCP_EVENT_LISTENER_CREATED );
net/mptcp/protocol.h +1 -0
@@ -528,6 +528,7 @@ struct mptcp_subflow_context { __unused :9 ;bool data_avail;bool scheduled; +bool pm_listener;/* a listener managed by the kernel PM? */ u32 remote_nonce;u64 thmac;u32 local_nonce;
net/mptcp/subflow.c +11 -0
@@ -132,6 +132,13 @@ static void subflow_add_reset_reason(str } } +static int subflow_reset_req_endp (struct request_sock *req,struct sk_buff *skb) +{ +SUBFLOW_REQ_INC_STATS (req,MPTCP_MIB_MPCAPABLEENDPATTEMPT ); +subflow_add_reset_reason (skb,MPTCP_RST_EPROHIBIT ); +return -EPERM ; +} +/* Init mptcp request socket. * * Returns an error code if a JOIN has failed and a TCP reset
@@ -165,6 +172,8 @@ static int subflow_check_req(struct requif (opt_mp_capable) {SUBFLOW_REQ_INC_STATS (req,MPTCP_MIB_MPCAPABLEPASSIVE ); +if (unlikely (listener->pm_listener)) +return subflow_reset_req_endp (req, skb);if (opt_mp_join)return 0 ; }else if (opt_mp_join) {
@@ -172,6 +181,8 @@ static int subflow_check_req(struct requif (mp_opt.backup)SUBFLOW_REQ_INC_STATS (req,MPTCP_MIB_JOINSYNBACKUPRX ); + }else if (unlikely (listener->pm_listener)) { +return subflow_reset_req_endp (req, skb); }if (opt_mp_capable && listener->request_mptcp) {
Greg Kroah-Hartman
maintainerPATCH 36/135 iommu/vt-d: Fix incorrect pci_for_each_dma_alias() for non-PCI devices
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lu Baolu <[email protected]>
commit 6e02a277f1db24fa039e23783c8921c7b0e5b1b3 upstream.
Previously, the domain_context_clear() function incorrectly called pci_for_each_dma_alias() to set up context entries for non-PCI devices. This could lead to kernel hangs or other unexpected behavior.
Add a check to only call pci_for_each_dma_alias() for PCI devices. For non-PCI devices, domain_context_clear_one() is called directly.
--- drivers/iommu/intel/iommu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iommu/intel/iommu.c +3 -1
@@ -3520,8 +3520,10 @@ static int domain_context_clear_one_cb(s*/ static void domain_context_clear (struct device_domain_info *info) { -if (!dev_is_pci (info->dev)) +if (!dev_is_pci (info->dev)) {domain_context_clear_one (info, info->bus, info->devfn); +return ; + }pci_for_each_dma_alias (to_pci_dev (info->dev), &domain_context_clear_one_cb, info);
Greg Kroah-Hartman
maintainerPATCH 37/135 s390/sclp: Deactivate sclp after all its users
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
commit 0d9dc27df22d9b5c8dc7185c8dddbc14f5468518 upstream.
On reboot the SCLP interface is deactivated through a reboot notifier. This happens before other components using SCLP have the chance to run their own reboot notifiers.
Two of those components are the SCLP console and tty drivers which try to flush the last outstanding messages.
At that point the SCLP interface is already unusable and the messages are discarded.
Execute sclp_deactivate() as late as possible to avoid this issue.
--- drivers/s390/char/sclp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/s390/char/sclp.c +2 -1
@@ -1195,7 +1195,8 @@ sclp_reboot_event(struct notifier_block }static struct notifier_block sclp_reboot_notifier = { - .notifier_call = sclp_reboot_event + .notifier_call = sclp_reboot_event, + .priority =INT_MIN , };static ssize_t con_pages_show (struct device_driver *dev,char *buf)
Greg Kroah-Hartman
maintainerPATCH 38/135 s390/sclp_vt220: Convert newlines to CRLF instead of LFCR
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
commit dee3df68ab4b00fff6bdf9fc39541729af37307c upstream.
According to the VT220 specification the possible character combinations sent on RETURN are only CR or CRLF [0].
The Return key sends either a CR character (0/13) or a CR character (0/13) and an LF character (0/10), depending on the set/reset state of line feed/new line mode (LNM).
The sclp/vt220 driver however uses LFCR. This can confuse tools, for example the kunit runner.
--- drivers/s390/char/sclp_vt220.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/s390/char/sclp_vt220.c +2 -2
@@ -319,7 +319,7 @@ sclp_vt220_add_msg(struct sclp_vt220_req buffer = (void *) ((addr_t ) sccb + sccb->header.length);if (convertlf) { -/* Perform Linefeed conversion (0x0a -> 0x0a 0x0d)*/ +/* Perform Linefeed conversion (0x0a -> 0x0d 0x0a)*/ for (from=0 , to=0 ; (from < count) && (to <sclp_vt220_space_left (request)); from++) {
@@ -328,8 +328,8 @@ sclp_vt220_add_msg(struct sclp_vt220_req/* Perform conversion */ if (c ==0x0a ) {if (to +1 <sclp_vt220_space_left (request)) { - ((unsigned char *) buffer)[to++] = c; ((unsigned char *) buffer)[to++] =0x0d ; + ((unsigned char *) buffer)[to++] = c; }else break ;
Greg Kroah-Hartman
maintainerPATCH 39/135 KVM: s390: gaccess: Check if guest address is in memslot
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nico Boehr <[email protected]>
commit e8061f06185be0a06a73760d6526b8b0feadfe52 upstream.
Previously, access_guest_page() did not check whether the given guest address is inside of a memslot. This is not a problem, since kvm_write_guest_page/kvm_read_guest_page return -EFAULT in this case.
However, -EFAULT is also returned when copy_to/from_user fails.
When emulating a guest instruction, the address being outside a memslot usually means that an addressing exception should be injected into the guest.
Failure in copy_to/from_user however indicates that something is wrong in userspace and hence should be handled there.
To be able to distinguish these two cases, return PGM_ADDRESSING in access_guest_page() when the guest address is outside guest memory. In access_guest_real(), populate vcpu->arch.pgm.code such that kvm_s390_inject_prog_cond() can be used in the caller for injecting into the guest (if applicable).
Since this adds a new return value to access_guest_page(), we need to make sure that other callers are not confused by the new positive return value.
There are the following users of access_guest_page():
- access_guest_with_key() does the checking itself (in guest_range_to_gpas()), so this case should never happen. Even if, the handling is set up properly.
- access_guest_real() just passes the return code to its callers, which are:
- read_guest_real() - see below
- write_guest_real() - see below
There are the following users of read_guest_real():
- ar_translation() in gaccess.c which already returns PGM_*
- setup_apcb10(), setup_apcb00(), setup_apcb11() in vsie.c which always return -EFAULT on read_guest_read() nonzero return - no change
- shadow_crycb(), handle_stfle() always present this as validity, this could be handled better but doesn't change current behaviour - no change
There are the following users of write_guest_real():
- kvm_s390_store_status_unloaded() always returns -EFAULT on write_guest_real() failure.
--- arch/s390/kvm/gaccess.c | 4 ++++ arch/s390/kvm/gaccess.h | 14 ++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-)
arch/s390/kvm/gaccess.c +4 -0
@@ -828,6 +828,8 @@ static int access_guest_page(struct kvmconst gfn_t gfn =gpa_to_gfn (gpa);int rc; +if (!gfn_to_memslot (kvm, gfn)) +return PGM_ADDRESSING ;if (mode ==GACC_STORE ) rc =kvm_write_guest_page (kvm, gfn, data, offset, len);else
@@ -985,6 +987,8 @@ int access_guest_real(struct kvm_vcpu *v gra += fragment_len; data += fragment_len; } +if (rc >0 ) + vcpu->arch.pgm.code = rc;return rc; }
arch/s390/kvm/gaccess.h +8 -6
@@ -405,11 +405,12 @@ int read_guest_abs(struct kvm_vcpu *vcpu* @len: number of bytes to copy * * Copy @len bytes from @data (kernel space) to @gra (guest real address). -* It is up to the caller to ensure that the entire guest memory range is -* valid memory before calling this function. * Guest low address and key protection are not checked. * -* Returns zero on success or -EFAULT on error. +* Returns zero on success, -EFAULT when copying from @data failed, or +* PGM_ADRESSING in case @gra is outside a memslot. In this case, pgm check info +* is also stored to allow injecting into the guest (if applicable) using +* kvm_s390_inject_prog_cond(). * * If an error occurs data may have been copied partially to guest memory. */
@@ -428,11 +429,12 @@ int write_guest_real(struct kvm_vcpu *vc* @len: number of bytes to copy * * Copy @len bytes from @gra (guest real address) to @data (kernel space). -* It is up to the caller to ensure that the entire guest memory range is -* valid memory before calling this function. * Guest key protection is not checked. * -* Returns zero on success or -EFAULT on error. +* Returns zero on success, -EFAULT when copying to @data failed, or +* PGM_ADRESSING in case @gra is outside a memslot. In this case, pgm check info +* is also stored to allow injecting into the guest (if applicable) using +* kvm_s390_inject_prog_cond(). * * If an error occurs data may have been copied partially to kernel space. */
Greg Kroah-Hartman
maintainerPATCH 40/135 KVM: s390: Change virtual to physical address access in diag 0x258 handler
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Mueller <[email protected]>
commit cad4b3d4ab1f062708fff33f44d246853f51e966 upstream.
The parameters for the diag 0x258 are real addresses, not virtual, but KVM was using them as virtual addresses. This only happened to work, since the Linux kernel as a guest used to have a 1:1 mapping for physical vs virtual addresses.
Fix KVM so that it correctly uses the addresses as real addresses.
--- arch/s390/kvm/diag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kvm/diag.c +1 -1
@@ -77,7 +77,7 @@ static int __diag_page_ref_service(struc vcpu->stat.instruction_diagnose_258++;if (vcpu->run->s.regs.gprs[rx] &7 )return kvm_s390_inject_program_int (vcpu,PGM_SPECIFICATION ); - rc =read_guest (vcpu, vcpu->run->s.regs.gprs[rx], rx, &parm,sizeof (parm)); + rc =read_guest_real (vcpu, vcpu->run->s.regs.gprs[rx], &parm,sizeof (parm));if (rc)return kvm_s390_inject_prog_cond (vcpu, rc);if (parm.parm_version !=2 || parm.parm_len <5 || parm.code !=0x258 )
Greg Kroah-Hartman
maintainerPATCH 41/135 x86/cpufeatures: Define X86_FEATURE_AMD_IBPB_RET
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jim Mattson <[email protected]>
commit ff898623af2ed564300752bba83a680a1e4fec8d upstream.
AMD's initial implementation of IBPB did not clear the return address predictor. Beginning with Zen4, AMD's IBPB *does* clear the return address predictor. This behavior is enumerated by CPUID.80000008H:EBX.IBPB_RET[30].
Define X86_FEATURE_AMD_IBPB_RET for use in KVM_GET_SUPPORTED_CPUID, when determining cross-vendor capabilities.
--- arch/x86/include/asm/cpufeatures.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/include/asm/cpufeatures.h +2 -1
@@ -215,7 +215,7 @@#define X86_FEATURE_SPEC_STORE_BYPASS_DISABLE ( 7*32+23)/* Disable Speculative Store Bypass. */ #define X86_FEATURE_LS_CFG_SSBD ( 7*32+24)/* AMD SSBD implementation via LS_CFG MSR */ #define X86_FEATURE_IBRS ( 7*32+25)/* "ibrs" Indirect Branch Restricted Speculation */ -#define X86_FEATURE_IBPB ( 7*32+26)/* "ibpb" Indirect Branch Prediction Barrier */ +#define X86_FEATURE_IBPB ( 7*32+26)/* "ibpb" Indirect Branch Prediction Barrier without a guaranteed RSB flush */ #define X86_FEATURE_STIBP ( 7*32+27)/* "stibp" Single Thread Indirect Branch Predictors */ #define X86_FEATURE_ZEN ( 7*32+28)/* Generic flag for all Zen and newer */ #define X86_FEATURE_L1TF_PTEINV ( 7*32+29)/* L1TF workaround PTE inversion */
@@ -348,6 +348,7 @@#define X86_FEATURE_CPPC (13*32+27)/* "cppc" Collaborative Processor Performance Control */ #define X86_FEATURE_AMD_PSFD (13*32+28)/* Predictive Store Forwarding Disable */ #define X86_FEATURE_BTC_NO (13*32+29)/* Not vulnerable to Branch Type Confusion */ +#define X86_FEATURE_AMD_IBPB_RET (13*32+30)/* IBPB clears return address predictor */ #define X86_FEATURE_BRS (13*32+31)/* "brs" Branch Sampling available */ /* Thermal and Power Management Leaf, CPUID level 0x00000006 (EAX), word 14 */
Greg Kroah-Hartman
maintainerPATCH 42/135 x86/cpufeatures: Add a IBPB_NO_RET BUG flag
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Wikner <[email protected]>
commit 3ea87dfa31a7b0bb0ff1675e67b9e54883013074 upstream.
Set this flag if the CPU has an IBPB implementation that does not invalidate return target predictions. Zen generations < 4 do not flush the RSB when executing an IBPB and this bug flag denotes that.
[ bp: Massage. ]
--- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/common.c | 3 +++ 2 files changed, 4 insertions(+)
arch/x86/include/asm/cpufeatures.h +1 -0
@@ -524,4 +524,5 @@#define X86_BUG_DIV0 X86_BUG(1*32 + 1)/* "div0" AMD DIV0 speculation bug */ #define X86_BUG_RFDS X86_BUG(1*32 + 2)/* "rfds" CPU is vulnerable to Register File Data Sampling */ #define X86_BUG_BHI X86_BUG(1*32 + 3)/* "bhi" CPU is affected by Branch History Injection */ +#define X86_BUG_IBPB_NO_RET X86_BUG(1*32 + 4)/* "ibpb_no_ret" IBPB omits return target predictions */ #endif /* _ASM_X86_CPUFEATURES_H */
arch/x86/kernel/cpu/common.c +3 -0
@@ -1443,6 +1443,9 @@ static void __init cpu_set_bug_bits(stru boot_cpu_has(X86_FEATURE_HYPERVISOR)))setup_force_cpu_bug (X86_BUG_BHI ); +if (cpu_has (c,X86_FEATURE_AMD_IBPB ) && !cpu_has (c,X86_FEATURE_AMD_IBPB_RET )) +setup_force_cpu_bug (X86_BUG_IBPB_NO_RET ); +if (cpu_matches (cpu_vuln_whitelist,NO_MELTDOWN ))return ;
Greg Kroah-Hartman
maintainerPATCH 43/135 x86/entry: Have entry_ibpb() invalidate return predictions
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Wikner <[email protected]>
commit 50e4b3b94090babe8d4bb85c95f0d3e6b07ea86e upstream.
entry_ibpb() should invalidate all indirect predictions, including return target predictions. Not all IBPB implementations do this, in which case the fallback is RSB filling.
Prevent SRSO-style hijacks of return predictions following IBPB, as the return target predictor can be corrupted before the IBPB completes.
[ bp: Massage. ]
--- arch/x86/entry/entry.S | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/entry/entry.S +5 -0
@@ -9,6 +9,8 @@ #include <asm/unwind_hints.h> #include <asm/segment.h> #include <asm/cache.h> +#include <asm/cpufeatures.h> +#include <asm/nospec-branch.h> #include "calling.h"
@@ -19,6 +21,9 @@ SYM_FUNC_START(entry_ibpb) movl $PRED_CMD_IBPB, %eax xorl %edx, %edx wrmsr + + /* Make sure IBPB clears return stack preductions too. */ + FILL_RETURN_BUFFER %rax, RSB_CLEAR_LOOPS, X86_BUG_IBPB_NO_RET RET SYM_FUNC_END(entry_ibpb) /* For KVM */
Greg Kroah-Hartman
maintainerPATCH 44/135 x86/bugs: Skip RSB fill at VMEXIT
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Wikner <[email protected]>
commit 0fad2878642ec46225af2054564932745ac5c765 upstream.
entry_ibpb() is designed to follow Intel's IBPB specification regardless of CPU. This includes invalidating RSB entries.
Hence, if IBPB on VMEXIT has been selected, entry_ibpb() as part of the RET untraining in the VMEXIT path will take care of all BTB and RSB clearing so there's no need to explicitly fill the RSB anymore.
[ bp: Massage commit message. ]
--- arch/x86/kernel/cpu/bugs.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/x86/kernel/cpu/bugs.c +15 -0
@@ -1115,6 +1115,14 @@ do_cmd_auto:setup_force_cpu_cap (X86_FEATURE_ENTRY_IBPB );setup_force_cpu_cap (X86_FEATURE_IBPB_ON_VMEXIT ); mitigate_smt = true; + +/* +* There is no need for RSB filling: entry_ibpb() ensures +* all predictions, including the RSB, are invalidated, +* regardless of IBPB implementation. +*/ +setup_clear_cpu_cap (X86_FEATURE_RSB_VMEXIT ); +break ;case RETBLEED_MITIGATION_STUFF :
@@ -2632,6 +2640,13 @@ static void __init srso_select_mitigatioif (!boot_cpu_has (X86_FEATURE_ENTRY_IBPB ) && has_microcode) {setup_force_cpu_cap (X86_FEATURE_IBPB_ON_VMEXIT ); srso_mitigation =SRSO_MITIGATION_IBPB_ON_VMEXIT ; + +/* +* There is no need for RSB filling: entry_ibpb() ensures +* all predictions, including the RSB, are invalidated, +* regardless of IBPB implementation. +*/ +setup_clear_cpu_cap (X86_FEATURE_RSB_VMEXIT ); } }else {pr_err ("WARNING: kernel not compiled with MITIGATION_SRSO.\n" );
Greg Kroah-Hartman
maintainerPATCH 45/135 x86/bugs: Do not use UNTRAIN_RET with IBPB on entry
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Wikner <[email protected]>
commit c62fa117c32bd1abed9304c58e0da6940f8c7fc2 upstream.
Since X86_FEATURE_ENTRY_IBPB will invalidate all harmful predictions with IBPB, no software-based untraining of returns is needed anymore. Currently, this change affects retbleed and SRSO mitigations so if either of the mitigations is doing IBPB and the other one does the software sequence, the latter is not needed anymore.
[ bp: Massage commit message. ]
--- arch/x86/kernel/cpu/bugs.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/x86/kernel/cpu/bugs.c +17 -0
@@ -1113,6 +1113,15 @@ do_cmd_auto:case RETBLEED_MITIGATION_IBPB :setup_force_cpu_cap (X86_FEATURE_ENTRY_IBPB ); + +/* +* IBPB on entry already obviates the need for +* software-based untraining so clear those in case some +* other mitigation like SRSO has selected them. +*/ +setup_clear_cpu_cap (X86_FEATURE_UNRET ); +setup_clear_cpu_cap (X86_FEATURE_RETHUNK ); +setup_force_cpu_cap (X86_FEATURE_IBPB_ON_VMEXIT ); mitigate_smt = true;
@@ -2629,6 +2638,14 @@ static void __init srso_select_mitigatioif (has_microcode) {setup_force_cpu_cap (X86_FEATURE_ENTRY_IBPB ); srso_mitigation =SRSO_MITIGATION_IBPB ; + +/* +* IBPB on entry already obviates the need for +* software-based untraining so clear those in case some +* other mitigation like Retbleed has selected them. +*/ +setup_clear_cpu_cap (X86_FEATURE_UNRET ); +setup_clear_cpu_cap (X86_FEATURE_RETHUNK ); } }else {pr_err ("WARNING: kernel not compiled with MITIGATION_IBPB_ENTRY.\n" );
Greg Kroah-Hartman
maintainerPATCH 46/135 fgraph: Use CPU hotplug mechanism to initialize idle shadow stacks
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit 2c02f7375e658ae93d57a31a66f91b62754ef8f1 upstream.
The function graph infrastructure allocates a shadow stack for every task when enabled. This includes the idle tasks. The first time the function graph is invoked, the shadow stacks are created and never freed until the task exits. This includes the idle tasks.
Only the idle tasks that were for online CPUs had their shadow stacks created when function graph tracing started. If function graph tracing is enabled and a CPU comes online, the idle task representing that CPU will not have its shadow stack created, and all function graph tracing for that idle task will be silently dropped.
Instead, use the CPU hotplug mechanism to allocate the idle shadow stacks. This will include idle tasks for CPUs that come online during tracing.
This issue can be reproduced by:
# cd /sys/kernel/tracing # echo 0 > /sys/devices/system/cpu/cpu1/online # echo 0 > set_ftrace_pid # echo function_graph > current_tracer # echo 1 > options/funcgraph-proc # echo 1 > /sys/devices/system/cpu/cpu1 # grep '<idle>' per_cpu/cpu1/trace | head
Before, nothing would show up.
After:
1) <idle>-0 | 0.811 us | __enqueue_entity();
1) <idle>-0 | 5.626 us | } /* enqueue_entity */
1) <idle>-0 | | dl_server_update_idle_time() {
1) <idle>-0 | | dl_scaled_delta_exec() {
1) <idle>-0 | 0.450 us | arch_scale_cpu_capacity();
1) <idle>-0 | 1.242 us | }
1) <idle>-0 | 1.908 us | }
1) <idle>-0 | | dl_server_start() {
1) <idle>-0 | | enqueue_dl_entity() {
1) <idle>-0 | | task_contending() {Note, if tracing stops and restarts, the old way would then initialize the onlined CPUs.
--- kernel/trace/fgraph.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)
kernel/trace/fgraph.c +21 -7
@@ -1160,19 +1160,13 @@ void fgraph_update_pid_func(void)static int start_graph_tracing (void ) {unsigned long **ret_stack_list; -int ret, cpu; +int ret; ret_stack_list =kmalloc (SHADOW_STACK_SIZE ,GFP_KERNEL );if (!ret_stack_list)return -ENOMEM ; -/* The cpu_boot init_task->ret_stack will never be freed */ -for_each_online_cpu (cpu) { -if (!idle_task (cpu)->ret_stack) -ftrace_graph_init_idle_task (idle_task (cpu), cpu); - } -do { ret =alloc_retstack_tasklist (ret_stack_list); }while (ret == -EAGAIN );
@@ -1242,14 +1236,34 @@ static void ftrace_graph_disable_direct( fgraph_direct_gops = &fgraph_stub; } +/* The cpu_boot init_task->ret_stack will never be freed */ +static int fgraph_cpu_init (unsigned int cpu) +{ +if (!idle_task (cpu)->ret_stack) +ftrace_graph_init_idle_task (idle_task (cpu), cpu); +return 0 ; +} +int register_ftrace_graph (struct fgraph_ops *gops) { +static bool fgraph_initialized;int command =0 ;int ret =0 ;int i =-1 ;mutex_lock (&ftrace_lock); +if (!fgraph_initialized) { + ret =cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"fgraph_idle_init" , + fgraph_cpu_init,NULL ); +if (ret <0 ) { +pr_warn ("fgraph: Error to init cpu hotplug support\n" ); +return ret; + } + fgraph_initialized = true; + ret =0 ; + } +if (!fgraph_array[0 ]) {/* The array must always have real data on it */ for (i =0 ; i <FGRAPH_ARRAY_SIZE ; i++)
Greg Kroah-Hartman
maintainerPATCH 47/135 Input: xpad - add support for 8BitDo Ultimate 2C Wireless Controller
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Kerkmann <[email protected]>
commit ea330429a04b383bd319c66261a5eca4798801e4 upstream.
This XBOX360 compatible gamepad uses the new product id 0x310a under the 8BitDo's vendor id 0x2dc8. The change was tested using the gamepad in a wired and wireless dongle configuration.
--- drivers/input/joystick/xpad.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/joystick/xpad.c +1 -0
@@ -373,6 +373,7 @@ static const struct xpad_device { { 0x294b, 0x3404, "Snakebyte GAMEPAD RGB X", 0, XTYPE_XBOXONE }, { 0x2dc8, 0x2000, "8BitDo Pro 2 Wired Controller fox Xbox", 0, XTYPE_XBOXONE }, { 0x2dc8, 0x3106, "8BitDo Pro 2 Wired Controller", 0, XTYPE_XBOX360 }, + { 0x2dc8, 0x310a, "8BitDo Ultimate 2C Wireless Controller", 0, XTYPE_XBOX360 }, { 0x2e24, 0x0652, "Hyperkin Duke X-Box One pad", 0, XTYPE_XBOXONE }, { 0x31e3, 0x1100, "Wooting One", 0, XTYPE_XBOX360 }, { 0x31e3, 0x1200, "Wooting Two", 0, XTYPE_XBOX360 },
Greg Kroah-Hartman
maintainerPATCH 48/135 blk-rq-qos: fix crash on rq_qos_wait vs. rq_qos_wake_function race
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Omar Sandoval <[email protected]>
commit e972b08b91ef48488bae9789f03cfedb148667fb upstream.
We're seeing crashes from rq_qos_wake_function that look like this:
BUG: unable to handle page fault for address: ffffafe180a40084 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page PGD 100000067 P4D 100000067 PUD 10027c067 PMD 10115d067 PTE 0 Oops: Oops: 0002 [#1] PREEMPT SMP PTI CPU: 17 UID: 0 PID: 0 Comm: swapper/17 Not tainted 6.12.0-rc3-00013-geca631b8fe80 #11 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 RIP: 0010:_raw_spin_lock_irqsave+0x1d/0x40 Code: 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 0f 1f 44 00 00 41 54 9c 41 5c fa 65 ff 05 62 97 30 4c 31 c0 ba 01 00 00 00 <f0> 0f b1 17 75 0a 4c 89 e0 41 5c c3 cc cc cc cc 89 c6 e8 2c 0b 00 RSP: 0018:ffffafe180580ca0 EFLAGS: 00010046 RAX: 0000000000000000 RBX: ffffafe180a3f7a8 RCX: 0000000000000011 RDX: 0000000000000001 RSI: 0000000000000003 RDI: ffffafe180a40084 RBP: 0000000000000000 R08: 00000000001e7240 R09: 0000000000000011 R10: 0000000000000028 R11: 0000000000000888 R12: 0000000000000002 R13: ffffafe180a40084 R14: 0000000000000000 R15: 0000000000000003 FS: 0000000000000000(0000) GS:ffff9aaf1f280000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffafe180a40084 CR3: 000000010e428002 CR4: 0000000000770ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <IRQ> try_to_wake_up+0x5a/0x6a0 rq_qos_wake_function+0x71/0x80 __wake_up_common+0x75/0xa0 __wake_up+0x36/0x60 scale_up.part.0+0x50/0x110 wb_timer_fn+0x227/0x450 ...
So rq_qos_wake_function() calls wake_up_process(data->task), which calls try_to_wake_up(), which faults in raw_spin_lock_irqsave(&p->pi_lock).
p comes from data->task, and data comes from the waitqueue entry, which is stored on the waiter's stack in rq_qos_wait(). Analyzing the core dump with drgn, I found that the waiter had already woken up and moved on to a completely unrelated code path, clobbering what was previously data->task. Meanwhile, the waker was passing the clobbered garbage in data->task to wake_up_process(), leading to the crash.
What's happening is that in between rq_qos_wake_function() deleting the waitqueue entry and calling wake_up_process(), rq_qos_wait() is finding that it already got a token and returning. The race looks like this:
rq_qos_wait() rq_qos_wake_function()
==============================================================prepare_to_wait_exclusive()
data->got_token = true;
list_del_init(&curr->entry);
if (data.got_token)
break;
finish_wait(&rqw->wait, &data.wq);
^- returns immediately because
list_empty_careful(&wq_entry->entry)
is true... return, go do something else ...
wake_up_process(data->task)
(NO LONGER VALID!)-^
Normally, finish_wait() is supposed to synchronize against the waker. But, as noted above, it is returning immediately because the waitqueue entry has already been removed from the waitqueue.
The bug is that rq_qos_wake_function() is accessing the waitqueue entry AFTER deleting it. Note that autoremove_wake_function() wakes the waiter and THEN deletes the waitqueue entry, which is the proper order.
Fix it by swapping the order. We also need to use list_del_init_careful() to match the list_empty_careful() in finish_wait().
--- block/blk-rq-qos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-rq-qos.c +1 -1
@@ -219,8 +219,8 @@ static int rq_qos_wake_function(struct w data->got_token = true;smp_wmb (); -list_del_init (&curr->entry);wake_up_process (data->task); +list_del_init_careful (&curr->entry);return 1 ; }
Greg Kroah-Hartman
maintainerPATCH 49/135 io_uring/sqpoll: close race on waiting for sqring entries
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
commit 28aabffae6be54284869a91cd8bccd3720041129 upstream.
When an application uses SQPOLL, it must wait for the SQPOLL thread to consume SQE entries, if it fails to get an sqe when calling io_uring_get_sqe(). It can do so by calling io_uring_enter(2) with the flag value of IORING_ENTER_SQ_WAIT. In liburing, this is generally done with io_uring_sqring_wait(). There's a natural expectation that once this call returns, a new SQE entry can be retrieved, filled out, and submitted. However, the kernel uses the cached sq head to determine if the SQRING is full or not. If the SQPOLL thread is currently in the process of submitting SQE entries, it may have updated the cached sq head, but not yet committed it to the SQ ring. Hence the kernel may find that there are SQE entries ready to be consumed, and return successfully to the application. If the SQPOLL thread hasn't yet committed the SQ ring entries by the time the application returns to userspace and attempts to get a new SQE, it will fail getting a new SQE.
Fix this by having io_sqring_full() always use the user visible SQ ring head entry, rather than the internally cached one.
--- io_uring/io_uring.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
io_uring/io_uring.h +8 -1
@@ -279,7 +279,14 @@ static inline bool io_sqring_full(struct {struct io_rings *r = ctx->rings; -return READ_ONCE (r->sq.tail) - ctx->cached_sq_head == ctx->sq_entries; +/* +* SQPOLL must use the actual sqring head, as using the cached_sq_head +* is race prone if the SQPOLL thread has grabbed entries but not yet +* committed them to the ring. For !SQPOLL, this doesn't matter, but +* since this helper is just used for SQPOLL sqring waits (or POLLOUT), +* just read the actual sqring head unconditionally. +*/ +return READ_ONCE (r->sq.tail) -READ_ONCE (r->sq.head) == ctx->sq_entries; }static inline unsigned int io_sqring_entries (struct io_ring_ctx *ctx)
Greg Kroah-Hartman
maintainerPATCH 50/135 blk-mq: setup queue ->tag_set before initializing hctx
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
commit c25c0c9035bb8b28c844dfddeda7b8bdbcfcae95 upstream.
Commit 7b815817aa58 ("blk-mq: add helper for checking if one CPU is mapped to specified hctx") needs to check queue mapping via tag set in hctx's cpuhp handler.
However, q->tag_set may not be setup yet when the cpuhp handler is enabled, then kernel oops is triggered.
Fix the issue by setup queue tag_set before initializing hctx.
--- block/blk-mq.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
block/blk-mq.c +6 -2
@@ -4307,6 +4307,12 @@ int blk_mq_init_allocated_queue(struct b/* mark the queue as mq asap */ q->mq_ops = set->ops; +/* +* ->tag_set has to be setup before initialize hctx, which cpuphp +* handler needs it for checking queue mapping +*/ + q->tag_set = set; +if (blk_mq_alloc_ctxs (q)) goto err_exit;
@@ -4325,8 +4331,6 @@ int blk_mq_init_allocated_queue(struct bINIT_WORK (&q->timeout_work, blk_mq_timeout_work);blk_queue_rq_timeout (q, set->timeout ? set->timeout :30 *HZ ); - q->tag_set = set; - q->queue_flags |=QUEUE_FLAG_MQ_DEFAULT ;INIT_DELAYED_WORK (&q->requeue_work, blk_mq_requeue_work);
Greg Kroah-Hartman
maintainerPATCH 51/135 ublk: dont allow user copy for unprivileged device
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
commit 42aafd8b48adac1c3b20fe5892b1b91b80c1a1e6 upstream.
UBLK_F_USER_COPY requires userspace to call write() on ublk char device for filling request buffer, and unprivileged device can't be trusted.
So don't allow user copy for unprivileged device.
--- drivers/block/ublk_drv.c | 11 ++++++++++- include/uapi/linux/ublk_cmd.h | 8 +++++++- 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/block/ublk_drv.c +10 -1
@@ -2381,10 +2381,19 @@ static int ublk_ctrl_add_dev(struct io_u* TODO: provide forward progress for RECOVERY handler, so that * unprivileged device can benefit from it */ -if (info.flags &UBLK_F_UNPRIVILEGED_DEV ) +if (info.flags &UBLK_F_UNPRIVILEGED_DEV ) { info.flags &= ~(UBLK_F_USER_RECOVERY_REISSUE |UBLK_F_USER_RECOVERY ); +/* +* For USER_COPY, we depends on userspace to fill request +* buffer by pwrite() to ublk char device, which can't be +* used for unprivileged device +*/ +if (info.flags &UBLK_F_USER_COPY ) +return -EINVAL ; + } +/* the created device is always owned by current user */ ublk_store_owner_uid_gid (&info.owner_uid, &info.owner_gid);
include/uapi/linux/ublk_cmd.h +7 -1
@@ -175,7 +175,13 @@/* use ioctl encoding for uring command */ #define UBLK_F_CMD_IOCTL_ENCODE (1UL << 6) -/* Copy between request and user buffer by pread()/pwrite() */ +/* +* Copy between request and user buffer by pread()/pwrite() +* +* Not available for UBLK_F_UNPRIVILEGED_DEV, otherwise userspace may +* deceive us by not filling request buffer, then kernel uninitialized +* data may be leaked. +*/ #define UBLK_F_USER_COPY (1UL << 7)/*
Greg Kroah-Hartman
maintainerPATCH 52/135 io_uring/sqpoll: ensure task state is TASK_RUNNING when running task_work
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
commit 8f7033aa4089fbaf7a33995f0f2ee6c9d7b9ca1b upstream.
When the sqpoll is exiting and cancels pending work items, it may need to run task_work. If this happens from within io_uring_cancel_generic(), then it may be under waiting for the io_uring_task waitqueue. This results in the below splat from the scheduler, as the ring mutex may be attempted grabbed while in a TASK_INTERRUPTIBLE state.
Ensure that the task state is set appropriately for that, just like what is done for the other cases in io_run_task_work().
do not call blocking ops when !TASK_RUNNING; state=1 set at [<0000000029387fd2>] prepare_to_wait+0x88/0x2fc
WARNING: CPU: 6 PID: 59939 at kernel/sched/core.c:8561 __might_sleep+0xf4/0x140 Modules linked in: CPU: 6 UID: 0 PID: 59939 Comm: iou-sqp-59938 Not tainted 6.12.0-rc3-00113-g8d020023b155 #7456 Hardware name: linux,dummy-virt (DT) pstate: 61400005 (nZCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--) pc : __might_sleep+0xf4/0x140 lr : __might_sleep+0xf4/0x140
sp : ffff80008c5e7830
x29: ffff80008c5e7830 x28: ffff0000d93088c0 x27: ffff60001c2d7230
x26: dfff800000000000 x25: ffff0000e16b9180 x24: ffff80008c5e7a50
x23: 1ffff000118bcf4a x22: ffff0000e16b9180 x21: ffff0000e16b9180
x20: 000000000000011b x19: ffff80008310fac0 x18: 1ffff000118bcd90
x17: 30303c5b20746120 x16: 74657320313d6574 x15: 0720072007200720
x14: 0720072007200720 x13: 0720072007200720 x12: ffff600036c64f0b
x11: 1fffe00036c64f0a x10: ffff600036c64f0a x9 : dfff800000000000 x8 : 00009fffc939b0f6 x7 : ffff0001b6327853 x6 : 0000000000000001 x5 : ffff0001b6327850 x4 : ffff600036c64f0b x3 : ffff8000803c35bc x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0000e16b9180
Call trace: __might_sleep+0xf4/0x140 mutex_lock+0x84/0x124 io_handle_tw_list+0xf4/0x260 tctx_task_work_run+0x94/0x340 io_run_task_work+0x1ec/0x3c0 io_uring_cancel_generic+0x364/0x524 io_sq_thread+0x820/0x124c ret_from_fork+0x10/0x20
--- io_uring/io_uring.h | 1 + 1 file changed, 1 insertion(+)
io_uring/io_uring.h +1 -0
@@ -322,6 +322,7 @@ static inline int io_run_task_work(void)if (current->io_uring) {unsigned int count =0 ; +__set_current_state (TASK_RUNNING );tctx_task_work_run (current->io_uring,UINT_MAX , &count);if (count) ret = true;
Greg Kroah-Hartman
maintainerPATCH 53/135 selftest: hid: add the missing tests directory
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yun Lu <[email protected]>
commit fe05c40ca9c18cfdb003f639a30fc78a7ab49519 upstream.
Commit 160c826b4dd0 ("selftest: hid: add missing run-hid-tools-tests.sh") has added the run-hid-tools-tests.sh script for it to be installed, but I forgot to add the tests directory together.
If running the test case without the tests directory, will results in the following error message:
make -C tools/testing/selftests/ TARGETS=hid install \
INSTALL_PATH=$KSFT_INSTALL_PATH
cd $KSFT_INSTALL_PATH
./run_kselftest.sh -t hid:hid-core.sh
/usr/lib/python3.11/site-packages/_pytest/config/__init__.py:331: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: helpconfig, Hook: pytest_cmdline_parse
UsageError: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: --udevd
inifile: None
rootdir: /root/linux/kselftest_install/hid
In fact, the run-hid-tools-tests.sh script uses the scripts in the tests directory to run tests. The tests directory also needs to be added to be installed.
--- tools/testing/selftests/hid/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/hid/Makefile +1 -0
@@ -18,6 +18,7 @@ TEST_PROGS += hid-usb_crash.sh TEST_PROGS += hid-wacom.sh TEST_FILES := run-hid-tools-tests.sh +TEST_FILES += tests CXX ?= $(CROSS_COMPILE)g++
Greg Kroah-Hartman
maintainerPATCH 54/135 Input: xpad - add support for MSI Claw A1M
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Edwards <[email protected]>
commit 22a18935d7d96bbb1a28076f843c1926d0ba189e upstream.
Add MSI Claw A1M controller to xpad_device match table when in xinput mode. Add MSI VID as XPAD_XBOX360_VENDOR.
--- drivers/input/joystick/xpad.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/input/joystick/xpad.c +2 -0
@@ -218,6 +218,7 @@ static const struct xpad_device { { 0x0c12, 0x8810, "Zeroplus Xbox Controller", 0, XTYPE_XBOX }, { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", 0, XTYPE_XBOX }, { 0x0d2f, 0x0002, "Andamiro Pump It Up pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, + { 0x0db0, 0x1901, "Micro Star International Xbox360 Controller for Windows", 0, XTYPE_XBOX360 }, { 0x0e4c, 0x1097, "Radica Gamester Controller", 0, XTYPE_XBOX }, { 0x0e4c, 0x1103, "Radica Gamester Reflex", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX }, { 0x0e4c, 0x2390, "Radica Games Jtech Controller", 0, XTYPE_XBOX },
@@ -493,6 +494,7 @@ static const struct usb_device_id xpad_tXPAD_XBOX360_VENDOR (0x07ff ),/* Mad Catz Gamepad */ XPAD_XBOXONE_VENDOR (0x0b05 ),/* ASUS controllers */ XPAD_XBOX360_VENDOR (0x0c12 ),/* Zeroplus X-Box 360 controllers */ +XPAD_XBOX360_VENDOR (0x0db0 ),/* Micro Star International X-Box 360 controllers */ XPAD_XBOX360_VENDOR (0x0e6f ),/* 0x0e6f Xbox 360 controllers */ XPAD_XBOXONE_VENDOR (0x0e6f ),/* 0x0e6f Xbox One controllers */ XPAD_XBOX360_VENDOR(0x0f0d), /* Hori controllers */
Greg Kroah-Hartman
maintainerPATCH 55/135 scsi: mpi3mr: Validate SAS port assignments
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ranjan Kumar <[email protected]>
commit b9e63d6c7c0e94a99e1af7c9c0c7fad13a2f2453 upstream.
A sanity check on phy_mask was added in commit 3668651def2c ("scsi:
mpi3mr: Sanitise num_phys"). This causes warning messages when more than 64 phys are detected and devices connected to phys greater than 64 are dropped.
The phy_mask bitmap is only needed for controller phys and not required for expander phys. Controller phys can go up to a maximum of 64 and therefore u64 is good enough to contain phy_mask bitmap.
To suppress those warnings and allow devices to be discovered as before the offending commit, restrict the phy_mask setting and lowest phy setting only to the controller phys.
--- drivers/scsi/mpi3mr/mpi3mr.h | 4 +-- drivers/scsi/mpi3mr/mpi3mr_transport.c | 42 +++++++++++++++++++++------------ 2 files changed, 29 insertions(+), 17 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +2 -2
@@ -541,8 +541,8 @@ struct mpi3mr_hba_port {* @port_list: List of ports belonging to a SAS node * @num_phys: Number of phys associated with port * @marked_responding: used while refresing the sas ports -* @lowest_phy: lowest phy ID of current sas port -* @phy_mask: phy_mask of current sas port +* @lowest_phy: lowest phy ID of current sas port, valid for controller port +* @phy_mask: phy_mask of current sas port, valid for controller port * @hba_port: HBA port entry * @remote_identify: Attached device identification * @rphy: SAS transport layer rphy object
drivers/scsi/mpi3mr/mpi3mr_transport.c +27 -15
118 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 56/135 scsi: ufs: core: Set SDEV_OFFLINE when UFS is shut down
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seunghwan Baek <[email protected]>
commit 19a198b67767d952c8f3d0cf24eb3100522a8223 upstream.
There is a history of deadlock if reboot is performed at the beginning of booting. SDEV_QUIESCE was set for all LU's scsi_devices by UFS shutdown, and at that time the audio driver was waiting on blk_mq_submit_bio() holding a mutex_lock while reading the fw binary. After that, a deadlock issue occurred while audio driver shutdown was waiting for mutex_unlock of blk_mq_submit_bio(). To solve this, set SDEV_OFFLINE for all LUs except WLUN, so that any I/O that comes down after a UFS shutdown will return an error.
[ 31.907781]I[0: swapper/0: 0] 1 130705007 1651079834 11289729804 0 D( 2) 3 ffffff882e208000 * init [device_shutdown] [ 31.907793]I[0: swapper/0: 0] Mutex: 0xffffff8849a2b8b0: owner[0xffffff882e28cb00 kworker/6:0 :49] [ 31.907806]I[0: swapper/0: 0] Call trace: [ 31.907810]I[0: swapper/0: 0] __switch_to+0x174/0x338 [ 31.907819]I[0: swapper/0: 0] __schedule+0x5ec/0x9cc [ 31.907826]I[0: swapper/0: 0] schedule+0x7c/0xe8 [ 31.907834]I[0: swapper/0: 0] schedule_preempt_disabled+0x24/0x40 [ 31.907842]I[0: swapper/0: 0] __mutex_lock+0x408/0xdac [ 31.907849]I[0: swapper/0: 0] __mutex_lock_slowpath+0x14/0x24 [ 31.907858]I[0: swapper/0: 0] mutex_lock+0x40/0xec [ 31.907866]I[0: swapper/0: 0] device_shutdown+0x108/0x280 [ 31.907875]I[0: swapper/0: 0] kernel_restart+0x4c/0x11c [ 31.907883]I[0: swapper/0: 0] __arm64_sys_reboot+0x15c/0x280 [ 31.907890]I[0: swapper/0: 0] invoke_syscall+0x70/0x158 [ 31.907899]I[0: swapper/0: 0] el0_svc_common+0xb4/0xf4 [ 31.907909]I[0: swapper/0: 0] do_el0_svc+0x2c/0xb0 [ 31.907918]I[0: swapper/0: 0] el0_svc+0x34/0xe0 [ 31.907928]I[0: swapper/0: 0] el0t_64_sync_handler+0x68/0xb4 [ 31.907937]I[0: swapper/0: 0] el0t_64_sync+0x1a0/0x1a4
[ 31.908774]I[0: swapper/0: 0] 49 0 11960702 11236868007 0 D( 2) 6 ffffff882e28cb00 * kworker/6:0 [__bio_queue_enter] [ 31.908783]I[0: swapper/0: 0] Call trace: [ 31.908788]I[0: swapper/0: 0] __switch_to+0x174/0x338 [ 31.908796]I[0: swapper/0: 0] __schedule+0x5ec/0x9cc [ 31.908803]I[0: swapper/0: 0] schedule+0x7c/0xe8 [ 31.908811]I[0: swapper/0: 0] __bio_queue_enter+0xb8/0x178 [ 31.908818]I[0: swapper/0: 0] blk_mq_submit_bio+0x194/0x67c [ 31.908827]I[0: swapper/0: 0] __submit_bio+0xb8/0x19c
--- drivers/ufs/core/ufshcd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +3 -1
@@ -10214,7 +10214,9 @@ static void ufshcd_wl_shutdown(struct deshost_for_each_device (sdev, hba->host) {if (sdev == hba->ufs_device_wlun)continue ; -scsi_device_quiesce (sdev); +mutex_lock (&sdev->state_mutex); +scsi_device_set_state (sdev,SDEV_OFFLINE ); +mutex_unlock (&sdev->state_mutex); }__ufshcd_wl_suspend (hba,UFS_SHUTDOWN_PM );
Greg Kroah-Hartman
maintainerPATCH 57/135 scsi: ufs: core: Fix the issue of ICU failure
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Wang <[email protected]>
commit bf0c6cc73f7f91ec70307f7c72343f6cb7d65d01 upstream.
When setting the ICU bit without using read-modify-write, SQRTCy will restart SQ again and receive an RTC return error code 2 (Failure - SQ not stopped).
Additionally, the error log has been modified so that this type of error can be observed.
--- drivers/ufs/core/ufs-mcq.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/ufs/core/ufs-mcq.c +8 -7
@@ -539,7 +539,7 @@ int ufshcd_mcq_sq_cleanup(struct ufs_hbastruct scsi_cmnd *cmd = lrbp->cmd;struct ufs_hw_queue *hwq;void __iomem *reg, *opr_sqd_base; -u32 nexus, id, val; +u32 nexus, id, val, rtc;int err;if (hba->quirks &UFSHCD_QUIRK_MCQ_BROKEN_RTC )
@@ -569,17 +569,18 @@ int ufshcd_mcq_sq_cleanup(struct ufs_hba opr_sqd_base =mcq_opr_base (hba,OPR_SQD , id);writel (nexus, opr_sqd_base +REG_SQCTI ); -/* SQRTCy.ICU = 1 */ -writel (SQ_ICU , opr_sqd_base +REG_SQRTC ); +/* Initiate Cleanup */ +writel (readl (opr_sqd_base +REG_SQRTC ) |SQ_ICU , + opr_sqd_base +REG_SQRTC );/* Poll SQRTSy.CUS = 1. Return result from SQRTSy.RTC */ reg = opr_sqd_base +REG_SQRTS ; err =read_poll_timeout (readl, val, val &SQ_CUS ,20 ,MCQ_POLL_US , false, reg); -if (err) -dev_err (hba->dev,"%s: failed. hwq=%d, tag=%d err=%ld\n" , - __func__, id, task_tag, -FIELD_GET (SQ_ICU_ERR_CODE_MASK ,readl (reg))); + rtc =FIELD_GET (SQ_ICU_ERR_CODE_MASK ,readl (reg)); +if (err || rtc) +dev_err (hba->dev,"%s: failed. hwq=%d, tag=%d err=%d RTC=%d\n" , + __func__, id, task_tag, err, rtc);if (ufshcd_mcq_sq_start (hba, hwq)) err = -ETIMEDOUT ;
Greg Kroah-Hartman
maintainerPATCH 58/135 scsi: ufs: core: Requeue aborted request
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Wang <[email protected]>
commit 8fa075804cb3b00960dd5c06554308175c834530 upstream.
After the SQ cleanup fix, the CQ will receive a response with the corresponding tag marked as OCS: ABORTED. To align with the behavior of Legacy SDB mode, the handling of OCS: ABORTED has been changed to match that of OCS_INVALID_COMMAND_STATUS (SDB), with both returning a SCSI result of DID_REQUEUE.
Furthermore, the workaround implemented before the SQ cleanup fix can be removed.
--- drivers/ufs/core/ufshcd.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)
drivers/ufs/core/ufshcd.c +4 -16
@@ -5403,10 +5403,12 @@ ufshcd_transfer_rsp_status(struct ufs_hb }break ;case OCS_ABORTED : - result |=DID_ABORT <<16 ; -break ;case OCS_INVALID_COMMAND_STATUS : result |=DID_REQUEUE <<16 ; +dev_warn (hba->dev, +"OCS %s from controller for tag %d\n" , + (ocs ==OCS_ABORTED ?"aborted" :"invalid" ), + lrbp->task_tag);break ;case OCS_INVALID_CMD_TABLE_ATTR :case OCS_INVALID_PRDT_ATTR :
@@ -6470,26 +6472,12 @@ static bool ufshcd_abort_one(struct requstruct scsi_device *sdev = cmd->device;struct Scsi_Host *shost = sdev->host;struct ufs_hba *hba =shost_priv (shost); -struct ufshcd_lrb *lrbp = &hba->lrb[tag]; -struct ufs_hw_queue *hwq; -unsigned long flags; *ret =ufshcd_try_to_abort_task (hba, tag);dev_err (hba->dev,"Aborting tag %d / CDB %#02x %s\n" , tag, hba->lrb[tag].cmd ? hba->lrb[tag].cmd->cmnd[0 ] :-1 , *ret ?"failed" :"succeeded" ); -/* Release cmd in MCQ mode if abort succeeds */ -if (hba->mcq_enabled && (*ret ==0 )) { - hwq =ufshcd_mcq_req_to_hwq (hba,scsi_cmd_to_rq (lrbp->cmd)); -if (!hwq) -return 0 ; -spin_lock_irqsave (&hwq->cq_lock, flags); -if (ufshcd_cmd_inflight (lrbp->cmd)) -ufshcd_release_scsi_cmd (hba, lrbp); -spin_unlock_irqrestore (&hwq->cq_lock, flags); - } -return *ret ==0 ; }
Greg Kroah-Hartman
maintainerPATCH 59/135 drm/radeon: Fix encoder->possible_clones
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ville Syrjälä <[email protected]>
commit 28127dba64d8ae1a0b737b973d6d029908599611 upstream.
Include the encoder itself in its possible_clones bitmask. In the past nothing validated that drivers were populating possible_clones correctly, but that changed in commit 74d2aacbe840 ("drm: Validate encoder->possible_clones"). Looks like radeon never got the memo and is still not following the rules 100% correctly.
This results in some warnings during driver initialization:
Bogus possible_clones: [ENCODER:46:TV-46] possible_clones=0x4 (full encoder mask=0x7)
WARNING: CPU: 0 PID: 170 at drivers/gpu/drm/drm_mode_config.c:615 drm_mode_config_validate+0x113/0x39c
...
--- drivers/gpu/drm/radeon/radeon_encoders.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_encoders.c +1 -1
@@ -43,7 +43,7 @@ static uint32_t radeon_encoder_clones(ststruct radeon_device *rdev = dev->dev_private;struct radeon_encoder *radeon_encoder =to_radeon_encoder (encoder);struct drm_encoder *clone_encoder; -uint32_t index_mask =0 ; +uint32_t index_mask =drm_encoder_mask (encoder);int count;/* DIG routing gets problematic */
Greg Kroah-Hartman
maintainerPATCH 60/135 drm/i915/dp_mst: Handle error during DSC BW overhead/slice calculation
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Deak <[email protected]>
commit 69b3d87212676c4c22aa4660435e2066dc7d1311 upstream.
The MST branch device may not support the number of DSC slices a mode requires, handle the error in this case.
--- drivers/gpu/drm/i915/display/intel_dp_mst.c | 37 ++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/display/intel_dp_mst.c +27 -10
@@ -88,25 +88,19 @@ static int intel_dp_mst_max_dpt_bpp(consstatic int intel_dp_mst_bw_overhead (const struct intel_crtc_state *crtc_state,const struct intel_connector *connector, -bool ssc,bool dsc,int bpp_x16) +bool ssc,int dsc_slice_count,int bpp_x16) {const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;unsigned long flags =DRM_DP_BW_OVERHEAD_MST ; -int dsc_slice_count =0 ;int overhead; flags |=intel_dp_is_uhbr (crtc_state) ?DRM_DP_BW_OVERHEAD_UHBR :0 ; flags |= ssc ?DRM_DP_BW_OVERHEAD_SSC_REF_CLK :0 ; flags |= crtc_state->fec_enable ?DRM_DP_BW_OVERHEAD_FEC :0 ; -if (dsc) { +if (dsc_slice_count) flags |=DRM_DP_BW_OVERHEAD_DSC ; - dsc_slice_count =intel_dp_dsc_get_slice_count (connector, - adjusted_mode->clock, - adjusted_mode->hdisplay, - crtc_state->joiner_pipes); - } overhead = drm_dp_bw_overhead(crtc_state->lane_count, adjusted_mode->hdisplay,
@@ -152,6 +146,19 @@ static int intel_dp_mst_calc_pbn(int pixreturn DIV_ROUND_UP (effective_data_rate *64 ,54 *1000 ); } +static int intel_dp_mst_dsc_get_slice_count (const struct intel_connector *connector, +const struct intel_crtc_state *crtc_state) +{ +const struct drm_display_mode *adjusted_mode = + &crtc_state->hw.adjusted_mode; +int num_joined_pipes = crtc_state->joiner_pipes; + +return intel_dp_dsc_get_slice_count (connector, + adjusted_mode->clock, + adjusted_mode->hdisplay, + num_joined_pipes); +} + static int intel_dp_mst_find_vcpi_slots_for_bpp(struct intel_encoder *encoder, struct intel_crtc_state *crtc_state, int max_bpp,
@@ -171,6 +178,7 @@ static int intel_dp_mst_find_vcpi_slots_const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;int bpp, slots = -EINVAL ; +int dsc_slice_count =0 ;int max_dpt_bpp;int ret =0 ;
@@ -202,6 +210,15 @@ static int intel_dp_mst_find_vcpi_slots_drm_dbg_kms (&i915->drm,"Looking for slots in range min bpp %d max bpp %d\n" , min_bpp, max_bpp); +if (dsc) { + dsc_slice_count =intel_dp_mst_dsc_get_slice_count (connector, crtc_state); +if (!dsc_slice_count) { +drm_dbg_kms (&i915->drm,"Can't get valid DSC slice count\n" ); + +return -ENOSPC ; + } + } +for (bpp = max_bpp; bpp >= min_bpp; bpp -= step) {int local_bw_overhead;int remote_bw_overhead;
@@ -215,9 +232,9 @@ static int intel_dp_mst_find_vcpi_slots_ intel_dp_output_bpp(crtc_state->output_format, bpp)); local_bw_overhead =intel_dp_mst_bw_overhead (crtc_state, connector, - false, dsc, link_bpp_x16); + false, dsc_slice_count, link_bpp_x16); remote_bw_overhead =intel_dp_mst_bw_overhead (crtc_state, connector, - true, dsc, link_bpp_x16); + true, dsc_slice_count, link_bpp_x16); intel_dp_mst_compute_m_n(crtc_state, connector, local_bw_overhead,
Greg Kroah-Hartman
maintainerPATCH 61/135 drm/i915/dp_mst: Dont require DSC hblank quirk for a non-DSC compatible mode
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Deak <[email protected]>
commit 2f54e71359eb2abc0bdf6619cd356e5e350ff27b upstream.
If an MST branch device doesn't support DSC for a given mode, but the MST link has enough BW for the mode, assume that the branch device does support the mode using an uncompressed stream.
--- drivers/gpu/drm/i915/display/intel_dp_mst.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/display/intel_dp_mst.c +3 -0
@@ -465,6 +465,9 @@ hblank_expansion_quirk_needs_dsc(const sif (mode_hblank_period_ns (adjusted_mode) > hblank_limit)return false; +if (!intel_dp_mst_dsc_get_slice_count (connector, crtc_state)) +return false; +return true; }
Greg Kroah-Hartman
maintainerPATCH 62/135 drm/xe/xe_sync: initialise ufence.signalled
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Auld <[email protected]>
commit 816b186ce2e87df7c7ead4ad44f70f3b10a04c91 upstream.
We can incorrectly think that the fence has signalled, if we get a non-zero value here from the kmalloc, which is quite plausible. Just use kzalloc to prevent stuff like this.
--- drivers/gpu/drm/xe/xe_sync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_sync.c +1 -1
@@ -58,7 +58,7 @@ static struct xe_user_fence *user_fence_create(struct xe_device *xe, u64 addr,if (!access_ok (ptr,sizeof (*ptr)))return ERR_PTR (-EFAULT ); - ufence =kmalloc (sizeof (*ufence),GFP_KERNEL ); + ufence =kzalloc (sizeof (*ufence),GFP_KERNEL );if (!ufence)return ERR_PTR (-ENOMEM );
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 63/135 drm/xe/ufence: ufence can be signaled right after wait_woken
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nirmoy Das <[email protected]>
commit 4e8b5a165160e2f521cc10bae58ce0b72b2e22b5 upstream.
do_comapre() can return success after a timedout wait_woken() which was treated as -ETIME. The loop calling wait_woken() sets correct err so there is no need to re-evaluate err.
v2: Remove entire check that reevaluate err at the end(Matt)
--- drivers/gpu/drm/xe/xe_wait_user_fence.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/xe/xe_wait_user_fence.c +0 -3
@@ -169,9 +169,6 @@ int xe_wait_user_fence_ioctl(struct drm_device *dev, void *data, args->timeout =0 ; } -if (!timeout && !(err <0 )) - err = -ETIME ; -if (q)xe_exec_queue_put (q);
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 64/135 drm/vmwgfx: Cleanup kms setup without 3d
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zack Rusin <[email protected]>
commit 512a9721cae0d88d34ff441f2f5917cd149af8af upstream.
Do not validate format equality for the non 3d cases to allow xrgb to argb copies and make sure the dx binding flags are only used on dx compatible surfaces.
Fixes basic 2d kms setup on configurations without 3d. There's little practical benefit to it because kms framebuffer coherence is disabled on configurations without 3d but with those changes the code actually makes sense.
v2: Remove the now unused format variable
--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 29 ----------------------------- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 9 ++++++--- 2 files changed, 6 insertions(+), 32 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +0 -29
@@ -1283,7 +1283,6 @@ static int vmw_kms_new_framebuffer_surfa {struct drm_device *dev = &dev_priv->drm;struct vmw_framebuffer_surface *vfbs; -enum SVGA3dSurfaceFormat format;struct vmw_surface *surface;int ret;
@@ -1320,34 +1319,6 @@ static int vmw_kms_new_framebuffer_surfareturn -EINVAL ; } -switch (mode_cmd->pixel_format) { -case DRM_FORMAT_ARGB8888 : - format =SVGA3D_A8R8G8B8 ; -break ; -case DRM_FORMAT_XRGB8888 : - format =SVGA3D_X8R8G8B8 ; -break ; -case DRM_FORMAT_RGB565 : - format =SVGA3D_R5G6B5 ; -break ; -case DRM_FORMAT_XRGB1555 : - format =SVGA3D_A1R5G5B5 ; -break ; -default : -DRM_ERROR ("Invalid pixel format: %p4cc\n" , - &mode_cmd->pixel_format); -return -EINVAL ; - } - -/* -* For DX, surface format validation is done when surface->scanout -* is set. -*/ -if (!has_sm4_context (dev_priv) && format != surface->metadata.format) { -DRM_ERROR ("Invalid surface format for requested mode.\n" ); -return -EINVAL ; - } - vfbs =kzalloc (sizeof (*vfbs),GFP_KERNEL );if (!vfbs) { ret = -ENOMEM ;
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +6 -3
@@ -2276,9 +2276,12 @@ int vmw_dumb_create(struct drm_file *filconst struct SVGA3dSurfaceDesc *desc =vmw_surface_get_desc (format);SVGA3dSurfaceAllFlags flags =SVGA3D_SURFACE_HINT_TEXTURE |SVGA3D_SURFACE_HINT_RENDERTARGET | -SVGA3D_SURFACE_SCREENTARGET | -SVGA3D_SURFACE_BIND_SHADER_RESOURCE | -SVGA3D_SURFACE_BIND_RENDER_TARGET ; +SVGA3D_SURFACE_SCREENTARGET ; + +if (vmw_surface_is_dx_screen_target_format (format)) { + flags |=SVGA3D_SURFACE_BIND_SHADER_RESOURCE | +SVGA3D_SURFACE_BIND_RENDER_TARGET ; + }/* * Without mob support we're just going to use raw memory buffer
Greg Kroah-Hartman
maintainerPATCH 65/135 drm/vmwgfx: Handle surface check failure correctly
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Kuratov <[email protected]>
commit 26498b8d54373d31a621d7dec95c4bd842563b3b upstream.
Currently if condition (!bo and !vmw_kms_srf_ok()) was met we go to err_out with ret == 0.err_out dereferences vfb if ret == 0, but in our case vfb is still NULL.
Fix this by assigning sensible error to ret.
Found by Linux Verification Center (linuxtesting.org) with SVACE
--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 -0
@@ -1510,6 +1510,7 @@ static struct drm_framebuffer *vmw_kms_fDRM_ERROR ("Surface size cannot exceed %dx%d\n" , dev_priv->texture_max_width, dev_priv->texture_max_height); + ret = -EINVAL ; goto err_out; }
Greg Kroah-Hartman
maintainerPATCH 66/135 drm/amdgpu/mes: fix issue of writing to the same log buffer from 2 MES pipes
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Chen <[email protected]>
commit 7760d7f93c764625fedca176891238675fd06d62 upstream.
With Unified MES enabled in gfx12, need separate event log buffer for the 2 MES pipes to avoid data overwrite.
--- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +2 -2
@@ -595,7 +595,7 @@ static int mes_v12_0_set_hw_resources(stif (amdgpu_mes_log_enable) { mes_set_hw_res_pkt.enable_mes_event_int_logging =1 ; - mes_set_hw_res_pkt.event_intr_history_gpu_mc_ptr = mes->event_log_gpu_addr; + mes_set_hw_res_pkt.event_intr_history_gpu_mc_ptr = mes->event_log_gpu_addr + pipe *AMDGPU_MES_LOG_BUFFER_SIZE ; } return mes_v12_0_submit_pkt_and_poll_completion(mes, pipe,
@@ -1270,7 +1270,7 @@ static int mes_v12_0_sw_init(void *handl adev->mes.kiq_hw_fini = &mes_v12_0_kiq_hw_fini; adev->mes.enable_legacy_queue_map = true; - adev->mes.event_log_size =AMDGPU_MES_LOG_BUFFER_SIZE ; + adev->mes.event_log_size = adev->enable_uni_mes ? (AMDGPU_MAX_MES_PIPES *AMDGPU_MES_LOG_BUFFER_SIZE ) :AMDGPU_MES_LOG_BUFFER_SIZE ; r =amdgpu_mes_init (adev);if (r)
Greg Kroah-Hartman
maintainerPATCH 67/135 drm/amdgpu/smu13: always apply the powersave optimization
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 7a1613e47e65ba6967085ad99dee95420346a0ce upstream.
It can avoid margin issues in some very demanding applications.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 22 ++++++++----------- 1 file changed, 10 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +10 -12
@@ -2555,18 +2555,16 @@ static int smu_v13_0_0_set_power_profile workload_mask =1 << workload_type;/* Add optimizations for SMU13.0.0/10. Reuse the power saving profile */ -if (smu->power_profile_mode ==PP_SMC_POWER_PROFILE_COMPUTE ) { -if ((amdgpu_ip_version (smu->adev,MP1_HWIP ,0 ) ==IP_VERSION (13 ,0 ,0 ) && - ((smu->adev->pm.fw_version ==0x004e6601 ) || - (smu->adev->pm.fw_version >=0x004e7300 ))) || - (amdgpu_ip_version (smu->adev,MP1_HWIP ,0 ) ==IP_VERSION (13 ,0 ,10 ) && - smu->adev->pm.fw_version >=0x00504500 )) { - workload_type =smu_cmn_to_asic_specific_index (smu, -CMN2ASIC_MAPPING_WORKLOAD , -PP_SMC_POWER_PROFILE_POWERSAVING ); -if (workload_type >=0 ) - workload_mask |=1 << workload_type; - } +if ((amdgpu_ip_version (smu->adev,MP1_HWIP ,0 ) ==IP_VERSION (13 ,0 ,0 ) && + ((smu->adev->pm.fw_version ==0x004e6601 ) || + (smu->adev->pm.fw_version >=0x004e7300 ))) || + (amdgpu_ip_version (smu->adev,MP1_HWIP ,0 ) ==IP_VERSION (13 ,0 ,10 ) && + smu->adev->pm.fw_version >=0x00504500 )) { + workload_type =smu_cmn_to_asic_specific_index (smu, +CMN2ASIC_MAPPING_WORKLOAD , +PP_SMC_POWER_PROFILE_POWERSAVING ); +if (workload_type >=0 ) + workload_mask |=1 << workload_type; } ret = smu_cmn_send_smc_msg_with_param(smu,
Greg Kroah-Hartman
maintainerPATCH 68/135 drm/amdgpu/swsmu: Only force workload setup on init
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit cb07c8338fc2b9d5f949a19d4a07ee4d5ecf8793 upstream.
Needed to set the workload type at init time so that we can apply the navi3x margin optimization.
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +3 -3
@@ -2226,7 +2226,7 @@ static int smu_bump_power_profile_mode(sstatic int smu_adjust_power_state_dynamic (struct smu_context *smu,enum amd_dpm_forced_level level,bool skip_display_settings, -bool force_update) +bool init) {int ret =0 ;int index =0 ;
@@ -2255,7 +2255,7 @@ static int smu_adjust_power_state_dynami } } -if (force_update || smu_dpm_ctx->dpm_level != level) { +if (smu_dpm_ctx->dpm_level != level) { ret =smu_asic_set_performance_level (smu, level);if (ret) {dev_err (smu->adev->dev,"Failed to set performance level!" );
@@ -2272,7 +2272,7 @@ static int smu_adjust_power_state_dynami index = index >0 && index <=WORKLOAD_POLICY_MAX ? index -1 :0 ; workload[0 ] = smu->workload_setting[index]; -if (force_update || smu->power_profile_mode != workload[0 ]) +if (init || smu->power_profile_mode != workload[0 ])smu_bump_power_profile_mode (smu, workload,0 ); }
Greg Kroah-Hartman
maintainerPATCH 69/135 drm/amdgpu: prevent BO_HANDLES error from being overwritten
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohammed Anees <[email protected]>
commit c0ec082f10b7a1fd25e8c1e2a686440da913b7a3 upstream.
Before this patch, if multiple BO_HANDLES chunks were submitted, the error -EINVAL would be correctly set but could be overwritten by the return value from amdgpu_cs_p1_bo_handles(). This patch ensures that if there are multiple BO_HANDLES, we stop.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
@@ -265,7 +265,7 @@ static int amdgpu_cs_pass1(struct amdgpu/* Only a single BO list is allowed to simplify handling. */ if (p->bo_list) - ret = -EINVAL ; + goto free_partial_kdata; ret =amdgpu_cs_p1_bo_handles (p, p->chunks[i].kdata);if (ret)
Greg Kroah-Hartman
maintainerPATCH 70/135 iio: dac: ad5770r: add missing select REGMAP_SPI in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit bcdab6f74c91cda19714354fd4e9e3ef3c9a78b3 upstream.
This driver makes use of regmap_spi, but does not select the required module.
Add the missing 'select REGMAP_SPI'.
--- drivers/iio/dac/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/iio/dac/Kconfig +1 -0
@@ -262,6 +262,7 @@ config AD5766 config AD5770R tristate "Analog Devices AD5770R IDAC driver" depends on SPI_MASTER + select REGMAP_SPI help Say yes here to build support for Analog Devices AD5770R Digital to Analog Converter.
Greg Kroah-Hartman
maintainerPATCH 71/135 iio: dac: ltc1660: add missing select REGMAP_SPI in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 252ff06a4cb4e572cb3c7fcfa697db96b08a7781 upstream.
This driver makes use of regmap_spi, but does not select the required module.
Add the missing 'select REGMAP_SPI'.
--- drivers/iio/dac/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/iio/dac/Kconfig +1 -0
@@ -354,6 +354,7 @@ config LPC18XX_DAC config LTC1660 tristate "Linear Technology LTC1660/LTC1665 DAC SPI driver" depends on SPI + select REGMAP_SPI help Say yes here to build support for Linear Technology LTC1660 and LTC1665 Digital to Analog Converters.
Greg Kroah-Hartman
maintainerPATCH 72/135 iio: dac: stm32-dac-core: add missing select REGMAP_MMIO in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 27b6aa68a68105086aef9f0cb541cd688e5edea8 upstream.
This driver makes use of regmap_mmio, but does not select the required module.
Add the missing 'select REGMAP_MMIO'.
--- drivers/iio/dac/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/iio/dac/Kconfig +1 -0
@@ -474,6 +474,7 @@ config STM32_DAC config STM32_DAC_CORE tristate + select REGMAP_MMIO config TI_DAC082S085 tristate "Texas Instruments 8/10/12-bit 2/4-channel DAC driver"
Greg Kroah-Hartman
maintainerPATCH 73/135 iio: adc: ti-ads8688: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 4c4834fd8696a949d1b1f1c2c5b96e1ad2083b02 upstream.
This driver makes use of triggered buffers, but does not select the required modules.
Add the missing 'select IIO_BUFFER' and 'select IIO_TRIGGERED_BUFFER'.
--- drivers/iio/adc/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/adc/Kconfig +2 -0
@@ -1433,6 +1433,8 @@ config TI_ADS8344 config TI_ADS8688 tristate "Texas Instruments ADS8688" depends on SPI + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER help If you say yes here you get support for Texas Instruments ADS8684 and and ADS8688 ADC chips
Greg Kroah-Hartman
maintainerPATCH 74/135 iio: hid-sensors: Fix an error handling path in _hid_sensor_set_report_latency()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
commit 3a29b84cf7fbf912a6ab1b9c886746f02b74ea25 upstream.
If hid_sensor_set_report_latency() fails, the error code should be returned instead of a value likely to be interpreted as 'success'.
--- drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/common/hid-sensors/hid-sensor-trigger.c +1 -1
@@ -32,7 +32,7 @@ static ssize_t _hid_sensor_set_report_la latency = integer *1000 + fract /1000 ; ret =hid_sensor_set_report_latency (attrb, latency);if (ret <0 ) -return len; +return ret; attrb->latency_ms =hid_sensor_get_report_latency (attrb);
Greg Kroah-Hartman
maintainerPATCH 75/135 iio: light: veml6030: fix ALS sensor resolution
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit c9e9746f275c45108f2b0633a4855d65d9ae0736 upstream.
The driver still uses the sensor resolution provided in the datasheet until Rev. 1.6, 28-Apr-2022, which was updated with Rev 1.7, 28-Nov-2023. The original ambient light resolution has been updated from 0.0036 lx/ct to 0.0042 lx/ct, which is the value that can be found in the current device datasheet.
Update the default resolution for IT = 100 ms and GAIN = 1/8 from the original 4608 mlux/cnt to the current value from the "Resolution and maximum detection range" table (Application Note 84367, page 5), 5376 mlux/cnt.
--- drivers/iio/light/veml6030.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/veml6030.c +1 -1
@@ -780,7 +780,7 @@ static int veml6030_hw_init(struct iio_d/* Cache currently active measurement parameters */ data->cur_gain =3 ; - data->cur_resolution =4608 ; + data->cur_resolution =5376 ; data->cur_integration_time =3 ;return ret;
Greg Kroah-Hartman
maintainerPATCH 76/135 iio: light: veml6030: fix IIO device retrieval from embedded device
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit c7c44e57750c31de43906d97813273fdffcf7d02 upstream.
The dev pointer that is received as an argument in the in_illuminance_period_available_show function references the device embedded in the IIO device, not in the i2c client.
dev_to_iio_dev() must be used to accessthe right data. The current implementation leads to a segmentation fault on every attempt to read the attribute because indio_dev gets a NULL assignment.
This bug has been present since the first appearance of the driver, apparently since the last version (V6) before getting applied. A constant attribute was used until then, and the last modifications might have not been tested again.
--- drivers/iio/light/veml6030.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iio/light/veml6030.c +1 -2
@@ -99,9 +99,8 @@ static const char * const period_values[static ssize_t in_illuminance_period_available_show (struct device *dev,struct device_attribute *attr,char *buf) { +struct veml6030_data *data =iio_priv (dev_to_iio_dev (dev));int ret, reg, x; -struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev)); -struct veml6030_data *data =iio_priv (indio_dev); ret =regmap_read (data->regmap,VEML6030_REG_ALS_CONF , ®);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 77/135 iio: light: opt3001: add missing full-scale range value
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emil Gedenryd <[email protected]>
commit 530688e39c644543b71bdd9cb45fdfb458a28eaa upstream.
The opt3001 driver uses predetermined full-scale range values to determine what exponent to use for event trigger threshold values. The problem is that one of the values specified in the datasheet is missing from the implementation. This causes larger values to be scaled down to an incorrect exponent, effectively reducing the maximum settable threshold value by a factor of 2.
Add missing full-scale range array value.
--- drivers/iio/light/opt3001.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/iio/light/opt3001.c +4 -0
@@ -139,6 +139,10 @@ static const struct opt3001_scale opt300 .val2 = 400000, }, { + .val = 41932, + .val2 = 800000, + }, + { .val = 83865, .val2 = 600000, },
Greg Kroah-Hartman
maintainerPATCH 78/135 iio: amplifiers: ada4250: add missing select REGMAP_SPI in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit b7983033a10baa0d98784bb411b2679bfb207d9a upstream.
This driver makes use of regmap_spi, but does not select the required module.
Add the missing 'select REGMAP_SPI'.
--- drivers/iio/amplifiers/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/iio/amplifiers/Kconfig +1 -0
@@ -27,6 +27,7 @@ config AD8366 config ADA4250 tristate "Analog Devices ADA4250 Instrumentation Amplifier" depends on SPI + select REGMAP_SPI help Say yes here to build support for Analog Devices ADA4250 SPI Amplifier's support. The driver provides direct access via
Greg Kroah-Hartman
maintainerPATCH 79/135 iio: frequency: adf4377: add missing select REMAP_SPI in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit c64643ed4eaa5dfd0b3bab7ef1c50b84f3dbaba4 upstream.
This driver makes use of regmap_spi, but does not select the required module.
Add the missing 'select REGMAP_SPI'.
--- drivers/iio/frequency/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/iio/frequency/Kconfig +1 -0
@@ -53,6 +53,7 @@ config ADF4371 config ADF4377 tristate "Analog Devices ADF4377 Microwave Wideband Synthesizer" depends on SPI && COMMON_CLK + select REGMAP_SPI help Say yes here to build support for Analog Devices ADF4377 Microwave Wideband Synthesizer.
Greg Kroah-Hartman
maintainerPATCH 80/135 iio: chemical: ens160: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 3fd8bbf93926162eb59153a5bcd2a53b0cc04cf0 upstream.
This driver makes use of triggered buffers, but does not select the required modules.
Add the missing 'select IIO_BUFFER' and 'select IIO_TRIGGERED_BUFFER'.
--- drivers/iio/chemical/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/chemical/Kconfig +2 -0
@@ -80,6 +80,8 @@ config ENS160 tristate "ScioSense ENS160 sensor driver" depends on (I2C || SPI) select REGMAP + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER select ENS160_I2C if I2C select ENS160_SPI if SPI help
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 81/135 iio: light: bu27008: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit aa99ef68eff5bc6df4959a372ae355b3b73f9930 upstream.
This driver makes use of triggered buffers, but does not select the required modules.
Add the missing 'select IIO_BUFFER' and 'select IIO_TRIGGERED_BUFFER'.
--- drivers/iio/light/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/light/Kconfig +2 -0
@@ -322,6 +322,8 @@ config ROHM_BU27008 depends on I2C select REGMAP_I2C select IIO_GTS_HELPER + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER help Enable support for the ROHM BU27008 color sensor. The ROHM BU27008 is a sensor with 5 photodiodes (red, green,
Greg Kroah-Hartman
maintainerPATCH 82/135 iio: magnetometer: af8133j: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit fbb913895e3da36cb42e1e7a5a3cae1c6d150cf6 upstream.
This driver makes use of triggered buffers, but does not select the required modules.
Add the missing 'select IIO_BUFFER' and 'select IIO_TRIGGERED_BUFFER'.
--- drivers/iio/magnetometer/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/magnetometer/Kconfig +2 -0
@@ -11,6 +11,8 @@ config AF8133J depends on I2C depends on OF select REGMAP_I2C + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER help Say yes here to build support for Voltafield AF8133J I2C-based 3-axis magnetometer chip.
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 83/135 iio: resolver: ad2s1210 add missing select REGMAP in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 17a99360184cf02b2b3bc3c1972e777326bfa63b upstream.
This driver makes use of regmap, but does not select the required module.
Add the missing 'select REGMAP'.
--- drivers/iio/resolver/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/iio/resolver/Kconfig +1 -0
@@ -31,6 +31,7 @@ config AD2S1210 depends on SPI depends on COMMON_CLK depends on GPIOLIB || COMPILE_TEST + select REGMAP help Say yes here to build support for Analog Devices spi resolver to digital converters, ad2s1210, provides direct access via sysfs.
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 84/135 iio: pressure: bm1390: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 3f7b25f6ad0925b9ae9b70656a49abb5af111483 upstream.
This driver makes use of triggered buffers, but does not select the required modules.
Add the missing 'select IIO_BUFFER' and 'select IIO_TRIGGERED_BUFFER'.
Note the original driver patch had wrong part number hence the odd fixes entry.
--- drivers/iio/pressure/Kconfig | 3 +++ 1 file changed, 3 insertions(+)
drivers/iio/pressure/Kconfig +3 -0
@@ -19,6 +19,9 @@ config ABP060MG config ROHM_BM1390 tristate "ROHM BM1390GLV-Z pressure sensor driver" depends on I2C + select REGMAP_I2C + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER help Support for the ROHM BM1390 pressure sensor. The BM1390GLV-Z can measure pressures ranging from 300 hPa to 1300 hPa with
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 85/135 iio: dac: ad5766: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 62ec3df342cca6a8eb7ed33fd4ac8d0fbfcb9391 upstream.
This driver makes use of triggered buffers, but does not select the required modules.
Add the missing 'select IIO_BUFFER' and 'select IIO_TRIGGERED_BUFFER'.
--- drivers/iio/dac/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/dac/Kconfig +2 -0
@@ -252,6 +252,8 @@ config AD5764 config AD5766 tristate "Analog Devices AD5766/AD5767 DAC driver" depends on SPI_MASTER + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER help Say yes here to build support for Analog Devices AD5766, AD5767 Digital to Analog Converter.
Greg Kroah-Hartman
maintainerPATCH 86/135 iio: proximity: mb1232: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 75461a0b15d7c026924d0001abce0476bbc7eda8 upstream.
This driver makes use of triggered buffers, but does not select the required modules.
Add the missing 'select IIO_BUFFER' and 'select IIO_TRIGGERED_BUFFER'.
--- drivers/iio/proximity/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/proximity/Kconfig +2 -0
@@ -72,6 +72,8 @@ config LIDAR_LITE_V2 config MB1232 tristate "MaxSonar I2CXL family ultrasonic sensors" depends on I2C + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER help Say Y to build a driver for the ultrasonic sensors I2CXL of MaxBotix which have an i2c interface. It can be used to measure
Greg Kroah-Hartman
maintainerPATCH 87/135 iio: dac: ad3552r: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 5bede948670f447154df401458aef4e2fd446ba8 upstream.
This driver makes use of triggered buffers, but does not select the required modules.
Add the missing 'select IIO_BUFFER' and 'select IIO_TRIGGERED_BUFFER'.
--- drivers/iio/dac/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/dac/Kconfig +2 -0
@@ -9,6 +9,8 @@ menu "Digital to analog converters" config AD3552R tristate "Analog Devices AD3552R DAC driver" depends on SPI_MASTER + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER help Say yes here to build support for Analog Devices AD3552R Digital to Analog Converter.
Greg Kroah-Hartman
maintainerPATCH 88/135 iio: adc: ti-lmp92064: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit a985576af824426e33100554a5958a6beda60a13 upstream.
This driver makes use of triggered buffers, but does not select the required modules.
Add the missing 'select IIO_BUFFER' and 'select IIO_TRIGGERED_BUFFER'.
--- drivers/iio/adc/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/adc/Kconfig +2 -0
@@ -52,6 +52,8 @@ config AD7091R8 depends on SPI select AD7091R select REGMAP_SPI + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER help Say yes here to build support for Analog Devices AD7091R-2, AD7091R-4, and AD7091R-8 ADC.
Greg Kroah-Hartman
maintainerPATCH 89/135 iio: adc: ti-lmp92064: add missing select REGMAP_SPI in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit f3fe8c52c580e99c6dc0c7859472ec48176af32d upstream.
This driver makes use of regmap_spi, but does not select the required module.
Add the missing 'select REGMAP_SPI'.
--- drivers/iio/adc/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/iio/adc/Kconfig +1 -0
@@ -1481,6 +1481,7 @@ config TI_AM335X_ADC config TI_LMP92064 tristate "Texas Instruments LMP92064 ADC driver" depends on SPI + select REGMAP_SPI help Say yes here to build support for the LMP92064 Precision Current and Voltage sensor.
Greg Kroah-Hartman
maintainerPATCH 90/135 iio: adc: ti-ads124s08: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit eb143d05def52bc6d193e813018e5fa1a0e47c77 upstream.
This driver makes use of triggered buffers, but does not select the required modules.
Add the missing 'select IIO_BUFFER' and 'select IIO_TRIGGERED_BUFFER'.
--- drivers/iio/adc/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/adc/Kconfig +2 -0
@@ -1447,6 +1447,8 @@ config TI_ADS8688 config TI_ADS124S08 tristate "Texas Instruments ADS124S08" depends on SPI + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER help If you say yes here you get support for Texas Instruments ADS124S08 and ADS124S06 ADC chips
Greg Kroah-Hartman
maintainerPATCH 91/135 iio: resolver: ad2s1210: add missing select (TRIGGERED_)BUFFER in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 2caa67b6251c802e0c2257920b225c765e86bf4a upstream.
This driver makes use of triggered buffers, but does not select the required modules.
Add the missing 'select IIO_BUFFER' and 'select IIO_TRIGGERED_BUFFER'.
--- drivers/iio/resolver/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/resolver/Kconfig +2 -0
@@ -32,6 +32,8 @@ config AD2S1210 depends on COMMON_CLK depends on GPIOLIB || COMPILE_TEST select REGMAP + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER help Say yes here to build support for Analog Devices spi resolver to digital converters, ad2s1210, provides direct access via sysfs.
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 92/135 iio: adc: ad7944: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit f4dc96f05149d5e14d7a03c3b16171098847fee9 upstream.
This driver makes use of triggered buffers, but does not select the required modules.
Add the missing 'select IIO_BUFFER' and 'select IIO_TRIGGERED_BUFFER'.
--- drivers/iio/adc/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/adc/Kconfig +2 -0
@@ -307,6 +307,8 @@ config AD7923 config AD7944 tristate "Analog Devices AD7944 and similar ADCs driver" depends on SPI + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER help Say yes here to build support for Analog Devices AD7944, AD7985, AD7986 ADCs.
Greg Kroah-Hartman
maintainerPATCH 93/135 iio: accel: kx022a: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 96666f05d11acf0370cedca17a4c3ab6f9554b35 upstream.
This driver makes use of triggered buffers, but does not select the required modules.
Add the missing 'select IIO_BUFFER' and 'select IIO_TRIGGERED_BUFFER'.
--- drivers/iio/accel/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/accel/Kconfig +2 -0
@@ -420,6 +420,8 @@ config IIO_ST_ACCEL_SPI_3AXIS config IIO_KX022A tristate + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER config IIO_KX022A_SPI tristate "Kionix KX022A tri-axis digital accelerometer SPI interface"
Greg Kroah-Hartman
maintainerPATCH 94/135 Bluetooth: Call iso_exit() on module unload
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Thompson <[email protected]>
commit d458cd1221e9e56da3b2cc5518ad3225caa91f20 upstream.
If iso_init() has been called, iso_exit() must be called on module unload. Without that, the struct proto that iso_init() registered with proto_register() becomes invalid, which could cause unpredictable problems later. In my case, with CONFIG_LIST_HARDENED and CONFIG_BUG_ON_DATA_CORRUPTION enabled, loading the module again usually triggers this BUG():
list_add corruption. next->prev should be prev (ffffffffb5355fd0),
but was 0000000000000068. (next=ffffffffc0a010d0).
------------[ cut here ]------------
kernel BUG at lib/list_debug.c:29!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP PTI
CPU: 1 PID: 4159 Comm: modprobe Not tainted 6.10.11-4+bt2-ao-desktop #1
RIP: 0010:__list_add_valid_or_report+0x61/0xa0
...
__list_add_valid_or_report+0x61/0xa0
proto_register+0x299/0x320
hci_sock_init+0x16/0xc0 [bluetooth]
bt_init+0x68/0xd0 [bluetooth]
__pfx_bt_init+0x10/0x10 [bluetooth]
do_one_initcall+0x80/0x2f0
do_init_module+0x8b/0x230
__do_sys_init_module+0x15f/0x190
do_syscall_64+0x68/0x110
...--- net/bluetooth/af_bluetooth.c | 2 ++ 1 file changed, 2 insertions(+)
net/bluetooth/af_bluetooth.c +2 -0
@@ -830,6 +830,8 @@ cleanup_led: static void __exit bt_exit(void) { +iso_exit (); +mgmt_exit ();sco_exit ();
Greg Kroah-Hartman
maintainerPATCH 95/135 Bluetooth: Remove debugfs directory on module init failure
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Thompson <[email protected]>
commit 1db4564f101b47188c1b71696bd342ef09172b22 upstream.
If bt_init() fails, the debugfs directory currently is not removed. If the module is loaded again after that, the debugfs directory is not set up properly due to the existing directory.
# modprobe bluetooth # ls -laF /sys/kernel/debug/bluetooth total 0 drwxr-xr-x 2 root root 0 Sep 27 14:26 ./ drwx------ 31 root root 0 Sep 27 14:25 ../ -r--r--r-- 1 root root 0 Sep 27 14:26 l2cap -r--r--r-- 1 root root 0 Sep 27 14:26 sco # modprobe -r bluetooth # ls -laF /sys/kernel/debug/bluetooth ls: cannot access '/sys/kernel/debug/bluetooth': No such file or directory #
# modprobe bluetooth modprobe: ERROR: could not insert 'bluetooth': Invalid argument # dmesg | tail -n 6 Bluetooth: Core ver 2.22 NET: Registered PF_BLUETOOTH protocol family Bluetooth: HCI device and connection manager initialized Bluetooth: HCI socket layer initialized Bluetooth: Faking l2cap_init() failure for testing NET: Unregistered PF_BLUETOOTH protocol family # ls -laF /sys/kernel/debug/bluetooth total 0 drwxr-xr-x 2 root root 0 Sep 27 14:31 ./ drwx------ 31 root root 0 Sep 27 14:26 ../ #
# modprobe bluetooth # dmesg | tail -n 7 Bluetooth: Core ver 2.22 debugfs: Directory 'bluetooth' with parent '/' already present! NET: Registered PF_BLUETOOTH protocol family Bluetooth: HCI device and connection manager initialized Bluetooth: HCI socket layer initialized Bluetooth: L2CAP socket layer initialized Bluetooth: SCO socket layer initialized # ls -laF /sys/kernel/debug/bluetooth total 0 drwxr-xr-x 2 root root 0 Sep 27 14:31 ./ drwx------ 31 root root 0 Sep 27 14:26 ../ #
--- net/bluetooth/af_bluetooth.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/af_bluetooth.c +1 -0
@@ -825,6 +825,7 @@ cleanup_sysfs:bt_sysfs_cleanup (); cleanup_led:bt_leds_cleanup (); +debugfs_remove_recursive (bt_debugfs);return err; }
Greg Kroah-Hartman
maintainerPATCH 96/135 Bluetooth: ISO: Fix multiple init when debugfs is disabled
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Thompson <[email protected]>
commit a9b7b535ba192c6b77e6c15a4c82d853163eab8c upstream.
If bt_debugfs is not created successfully, which happens if either CONFIG_DEBUG_FS or CONFIG_DEBUG_FS_ALLOW_ALL is unset, then iso_init() returns early and does not set iso_inited to true. This means that a subsequent call to iso_init() will result in duplicate calls to proto_register(), bt_sock_register(), etc.
With CONFIG_LIST_HARDENED and CONFIG_BUG_ON_DATA_CORRUPTION enabled, the duplicate call to proto_register() triggers this BUG():
list_add double add: new=ffffffffc0b280d0, prev=ffffffffbab56250,
next=ffffffffc0b280d0.
------------[ cut here ]------------
kernel BUG at lib/list_debug.c:35!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP PTI
CPU: 2 PID: 887 Comm: bluetoothd Not tainted 6.10.11-1-ao-desktop #1
RIP: 0010:__list_add_valid_or_report+0x9a/0xa0
...
__list_add_valid_or_report+0x9a/0xa0
proto_register+0x2b5/0x340
iso_init+0x23/0x150 [bluetooth]
set_iso_socket_func+0x68/0x1b0 [bluetooth]
kmem_cache_free+0x308/0x330
hci_sock_sendmsg+0x990/0x9e0 [bluetooth]
__sock_sendmsg+0x7b/0x80
sock_write_iter+0x9a/0x110
do_iter_readv_writev+0x11d/0x220
vfs_writev+0x180/0x3e0
do_writev+0xca/0x100
...This change removes the early return. The check for iso_debugfs being NULL was unnecessary, it is always NULL when iso_inited is false.
--- net/bluetooth/iso.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
net/bluetooth/iso.c +1 -5
@@ -2301,13 +2301,9 @@ int iso_init(void)hci_register_cb (&iso_cb); -if (IS_ERR_OR_NULL (bt_debugfs)) -return 0 ; - -if (!iso_debugfs) { +if (!IS_ERR_OR_NULL (bt_debugfs)) iso_debugfs =debugfs_create_file ("iso" ,0444 , bt_debugfs,NULL , &iso_debugfs_fops); - } iso_inited = true;
Greg Kroah-Hartman
maintainerPATCH 97/135 Bluetooth: btusb: Fix not being able to reconnect after suspend
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
commit 4084286151fc91cd093578f615bfb68f9efbbfcb upstream.
This partially reverts 81b3e33bb054 ("Bluetooth: btusb: Don't fail external suspend requests") as it introduced a call to hci_suspend_dev that assumes the system-suspend which doesn't work well when just the device is being suspended because wakeup flag is only set for remote devices that can wakeup the system.
--- drivers/bluetooth/btusb.c | 14 -------------- 1 file changed, 14 deletions(-)
drivers/bluetooth/btusb.c +0 -14
@@ -4092,7 +4092,6 @@ static void btusb_disconnect(struct usb_static int btusb_suspend (struct usb_interface *intf,pm_message_t message) {struct btusb_data *data =usb_get_intfdata (intf); -int err;BT_DBG ("intf %p" , intf);
@@ -4105,16 +4104,6 @@ static int btusb_suspend(struct usb_inteif (data->suspend_count++)return 0 ; -/* Notify Host stack to suspend; this has to be done before stopping -* the traffic since the hci_suspend_dev itself may generate some -* traffic. -*/ - err =hci_suspend_dev (data->hdev); -if (err) { - data->suspend_count--; -return err; - } -spin_lock_irq (&data->txlock);if (!(PMSG_IS_AUTO (message) && data->tx_in_flight)) {set_bit (BTUSB_SUSPENDING , &data->flags);
@@ -4122,7 +4111,6 @@ static int btusb_suspend(struct usb_inte }else {spin_unlock_irq (&data->txlock); data->suspend_count--; -hci_resume_dev (data->hdev);return -EBUSY ; }
@@ -4243,8 +4231,6 @@ static int btusb_resume(struct usb_interspin_unlock_irq (&data->txlock);schedule_work (&data->work); -hci_resume_dev (data->hdev); -return 0 ; failed:
Greg Kroah-Hartman
maintainerPATCH 98/135 Bluetooth: btusb: Fix regression with fake CSR controllers 0a12:0001
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
commit 2c1dda2acc4192d826e84008d963b528e24d12bc upstream.
Fake CSR controllers don't seem to handle short-transfer properly which cause command to time out:
kernel: usb 1-1: new full-speed USB device number 19 using xhci_hcd
kernel: usb 1-1: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=88.91
kernel: usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
kernel: usb 1-1: Product: BT DONGLE10
...
Bluetooth: hci1: Opcode 0x1004 failed: -110
kernel: Bluetooth: hci1: command 0x1004 tx timeout
According to USB Spec 2.0 Section 5.7.3 Interrupt Transfer Packet Size Constraints a interrupt transfer is considered complete when the size is 0 (ZPL) or < wMaxPacketSize:
'When an interrupt transfer involves more data than can fit in one data payload of the currently established maximum size, all data payloads are required to be maximum-sized except for the last data payload, which will contain the remaining data. An interrupt transfer is complete when the endpoint does one of the following:
• Has transferred exactly the amount of data expected
• Transfers a packet with a payload size less than wMaxPacketSize or transfers a zero-length packet'
--- drivers/bluetooth/btusb.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/bluetooth/btusb.c +9 -4
@@ -1399,10 +1399,15 @@ static int btusb_submit_intr_urb(structif (!urb)return -ENOMEM ; -/* Use maximum HCI Event size so the USB stack handles -* ZPL/short-transfer automatically. -*/ - size =HCI_MAX_EVENT_SIZE ; +if (le16_to_cpu (data->udev->descriptor.idVendor) ==0x0a12 && +le16_to_cpu (data->udev->descriptor.idProduct) ==0x0001 ) +/* Fake CSR devices don't seem to support sort-transter */ + size =le16_to_cpu (data->intr_ep->wMaxPacketSize); +else +/* Use maximum HCI Event size so the USB stack handles +* ZPL/short-transfer automatically. +*/ + size =HCI_MAX_EVENT_SIZE ; buf =kmalloc (size, mem_flags);if (!buf) {
Greg Kroah-Hartman
maintainerPATCH 99/135 vt: prevent kernel-infoleak in con_font_get()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeongjun Park <[email protected]>
commit f956052e00de211b5c9ebaa1958366c23f82ee9e upstream.
font.data may not initialize all memory spaces depending on the implementation of vc->vc_sw->con_font_get. This may cause info-leak, so to prevent this, it is safest to modify it to initialize the allocated memory space to 0, and it generally does not affect the overall performance of the system.
--- drivers/tty/vt/vt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/vt/vt.c +1 -1
@@ -4726,7 +4726,7 @@ static int con_font_get(struct vc_data *return -EINVAL ;if (op->data) { - font.data =kvmalloc (max_font_size,GFP_KERNEL ); + font.data =kvzalloc (max_font_size,GFP_KERNEL );if (!font.data)return -ENOMEM ; }else
Greg Kroah-Hartman
maintainerPATCH 100/135 xhci: tegra: fix checked USB2 port number
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henry Lin <[email protected]>
commit 7d381137cb6ecf558ef6698c7730ddd482d4c8f2 upstream.
If USB virtualizatoin is enabled, USB2 ports are shared between all Virtual Functions. The USB2 port number owned by an USB2 root hub in a Virtual Function may be less than total USB2 phy number supported by the Tegra XUSB controller.
Using total USB2 phy number as port number to check all PORTSC values would cause invalid memory access.
[ 116.923438] Unable to handle kernel paging request at virtual address 006c622f7665642f ... [ 117.213640] Call trace: [ 117.216783] tegra_xusb_enter_elpg+0x23c/0x658 [ 117.222021] tegra_xusb_runtime_suspend+0x40/0x68 [ 117.227260] pm_generic_runtime_suspend+0x30/0x50 [ 117.232847] __rpm_callback+0x84/0x3c0 [ 117.237038] rpm_suspend+0x2dc/0x740 [ 117.241229] pm_runtime_work+0xa0/0xb8 [ 117.245769] process_scheduled_works+0x24c/0x478 [ 117.251007] worker_thread+0x23c/0x328 [ 117.255547] kthread+0x104/0x1b0 [ 117.259389] ret_from_fork+0x10/0x20 [ 117.263582] Code: 54000222 f9461ae8 f8747908 b4ffff48 (f9400100)
--- drivers/usb/host/xhci-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-tegra.c +1 -1
@@ -2183,7 +2183,7 @@ static int tegra_xusb_enter_elpg(struct goto out; } -for (i =0 ; i < tegra->num_usb_phys; i++) { +for (i =0 ; i < xhci->usb2_rhub.num_ports; i++) {if (!xhci->usb2_rhub.ports[i])continue ; portsc =readl (xhci->usb2_rhub.ports[i]->addr);
Greg Kroah-Hartman
maintainerPATCH 101/135 xhci: Fix incorrect stream context type macro
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit 6599b6a6fa8060145046d0744456b6abdb3122a7 upstream.
The stream contex type (SCT) bitfield is used both in the stream context data structure, and in the 'Set TR Dequeue pointer' command TRB. In both cases it uses bits 3:1
The SCT_FOR_TRB(p) macro used to set the stream context type (SCT) field for the 'Set TR Dequeue pointer' command TRB incorrectly shifts the value 1 bit left before masking the three bits.
Fix this by first masking and rshifting, just like the similar SCT_FOR_CTX(p) macro does
This issue has not been visibile as the lost bit 3 is only used with secondary stream arrays (SSA). Xhci driver currently only supports using a primary stream array with Linear stream addressing.
--- drivers/usb/host/xhci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci.h +1 -1
@@ -1001,7 +1001,7 @@ enum xhci_setup_dev {/* Set TR Dequeue Pointer command TRB fields, 6.4.3.9 */ #define TRB_TO_STREAM_ID (p) ((((p) & (0xffff << 16)) >> 16))#define STREAM_ID_FOR_TRB (p) ((((p)) & 0xffff) << 16) -#define SCT_FOR_TRB (p) (((p) << 1) & 0x7) +#define SCT_FOR_TRB (p) (((p) & 0x7) << 1)/* Link TRB specific fields */ #define TRB_TC (1<<1)
Greg Kroah-Hartman
maintainerPATCH 102/135 xhci: Mitigate failed set dequeue pointer commands
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit fe49df60cdb7c2975aa743dc295f8786e4b7db10 upstream.
Avoid xHC host from processing a cancelled URB by always turning cancelled URB TDs into no-op TRBs before queuing a 'Set TR Deq' command.
If the command fails then xHC will start processing the cancelled TD instead of skipping it once endpoint is restarted, causing issues like Babble error.
This is not a complete solution as a failed 'Set TR Deq' command does not guarantee xHC TRB caches are cleared.
--- drivers/usb/host/xhci-ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-ring.c +1 -1
@@ -1023,7 +1023,7 @@ static int xhci_invalidate_cancelled_tdstd_to_noop (xhci, ring, cached_td, false); cached_td->cancel_status =TD_CLEARED ; } - +td_to_noop (xhci, ring, td, false); td->cancel_status =TD_CLEARING_CACHE ; cached_td = td;break ;
Greg Kroah-Hartman
maintainerPATCH 103/135 USB: serial: option: add support for Quectel EG916Q-GL
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin B. Frost <[email protected]>
commit 540eff5d7faf0c9330ec762da49df453263f7676 upstream.
Add Quectel EM916Q-GL with product ID 0x6007
T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 3 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=2c7c ProdID=6007 Rev= 2.00 S: Manufacturer=Quectel S: Product=EG916Q-GL C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=200mA A: FirstIf#= 4 IfCount= 2 Cls=02(comm.) Sub=06 Prot=00 I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=82(I) Atr=03(Int.) MxPS= 16 Ivl=32ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=84(I) Atr=03(Int.) MxPS= 16 Ivl=32ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(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=86(I) Atr=03(Int.) MxPS= 16 Ivl=32ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether E: Ad=88(I) Atr=03(Int.) MxPS= 32 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether I:* If#= 5 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
MI_00 Quectel USB Diag PortMI_01 Quectel USB NMEA PortMI_02 Quectel USB AT PortMI_03 Quectel USB Modem PortMI_04 Quectel USB Net Port
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -279,6 +279,7 @@ static void option_instat_callback(struc#define QUECTEL_PRODUCT_EG912Y 0x6001#define QUECTEL_PRODUCT_EC200S_CN 0x6002#define QUECTEL_PRODUCT_EC200A 0x6005 +#define QUECTEL_PRODUCT_EG916Q 0x6007#define QUECTEL_PRODUCT_EM061K_LWW 0x6008#define QUECTEL_PRODUCT_EM061K_LCN 0x6009#define QUECTEL_PRODUCT_EC200T 0x6026
@@ -1270,6 +1271,7 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200S_CN, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG912Y, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG916Q, 0xff, 0x00, 0x00) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500K, 0xff, 0x00, 0x00) }, { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
Greg Kroah-Hartman
maintainerPATCH 104/135 USB: serial: option: add Telit FN920C04 MBIM compositions
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniele Palmas <[email protected]>
commit 6d951576ee16430822a8dee1e5c54d160e1de87d upstream.
Add the following Telit FN920C04 compositions:
0x10a2: MBIM + tty (AT/NMEA) + tty (AT) + tty (diag)
T: Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 17 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10a2 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN920 S: SerialNumber=92c4c4d8 C: #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim E: Ad=82(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=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#= 3 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#= 4 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
0x10a7: MBIM + tty (AT) + tty (AT) + tty (diag)
T: Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 18 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10a7 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN920 S: SerialNumber=92c4c4d8 C: #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim E: Ad=82(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=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#= 3 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#= 4 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
0x10aa: MBIM + tty (AT) + tty (diag) + DPL (data packet logging) + adb
T: Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 15 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10aa Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN920 S: SerialNumber=92c4c4d8 C: #Ifs= 6 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim E: Ad=82(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=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#= 3 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#= 4 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#= 5 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
@@ -1382,10 +1382,16 @@ static const struct usb_device_id option .driver_info = NCTRL(0) | RSVD(1) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a0, 0xff), /* Telit FN20C04 (rmnet) */ .driver_info = RSVD(0) | NCTRL(3) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a2, 0xff), /* Telit FN920C04 (MBIM) */ + .driver_info = NCTRL(4) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a4, 0xff), /* Telit FN20C04 (rmnet) */ .driver_info = RSVD(0) | NCTRL(3) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a7, 0xff), /* Telit FN920C04 (MBIM) */ + .driver_info = NCTRL(4) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a9, 0xff), /* Telit FN20C04 (rmnet) */ .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(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 105/135 usb: typec: qcom-pmic-typec: fix sink status being overwritten with RP_DEF
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Marek <[email protected]>
commit ffe85c24d7ca5de7d57690c0ab194b3838674935 upstream.
This line is overwriting the result of the above switch-case.
This fixes the tcpm driver getting stuck in a "Sink TX No Go" loop.
--- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c +0 -1
@@ -432,7 +432,6 @@ static int qcom_pmic_typec_port_get_cc(s val =TYPEC_CC_RP_DEF ;break ; } - val =TYPEC_CC_RP_DEF ; }if (misc &CC_ORIENTATION )
Greg Kroah-Hartman
maintainerPATCH 106/135 USB: gadget: dummy-hcd: Fix "task hung" problem
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 5189df7b8088268012882c220d6aca4e64981348 upstream.
The syzbot fuzzer has been encountering "task hung" problems ever since the dummy-hcd driver was changed to use hrtimers instead of regular timers. It turns out that the problems are caused by a subtle difference between the timer_pending() and hrtimer_active() APIs.
The changeover blindly replaced the first by the second. However, timer_pending() returns True when the timer is queued but not when its callback is running, whereas hrtimer_active() returns True when the hrtimer is queued _or_ its callback is running. This difference occasionally caused dummy_urb_enqueue() to think that the callback routine had not yet started when in fact it was almost finished. As a result the hrtimer was not restarted, which made it impossible for the driver to dequeue later the URB that was just enqueued. This caused usb_kill_urb() to hang, and things got worse from there.
Since hrtimers have no API for telling when they are queued and the callback isn't running, the driver must keep track of this for itself. That's what this patch does, adding a new "timer_pending" flag and setting or clearing it at the appropriate times.
--- drivers/usb/gadget/udc/dummy_hcd.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/usb/gadget/udc/dummy_hcd.c +15 -5
@@ -254,6 +254,7 @@ struct dummy_hcd {u32 stream_en_ep;u8 num_stream[30 /2 ]; + unsigned timer_pending:1; unsigned active:1; unsigned old_active:1; unsigned resuming:1;
@@ -1303,9 +1304,11 @@ static int dummy_urb_enqueue( urb->error_count =1 ;/* mark as a new urb */ /* kick the scheduler, it'll do the rest */ -if (!hrtimer_active (&dum_hcd->timer)) +if (!dum_hcd->timer_pending) { + dum_hcd->timer_pending =1 ;hrtimer_start (&dum_hcd->timer,ns_to_ktime (DUMMY_TIMER_INT_NSECS ),HRTIMER_MODE_REL_SOFT ); + } done:spin_unlock_irqrestore (&dum_hcd->dum->lock, flags);
@@ -1324,9 +1327,10 @@ static int dummy_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)spin_lock_irqsave (&dum_hcd->dum->lock, flags); rc =usb_hcd_check_unlink_urb (hcd, urb, status); -if (!rc && dum_hcd->rh_state !=DUMMY_RH_RUNNING && - !list_empty (&dum_hcd->urbp_list)) +if (rc ==0 && !dum_hcd->timer_pending) { + dum_hcd->timer_pending =1 ;hrtimer_start (&dum_hcd->timer,ns_to_ktime (0 ),HRTIMER_MODE_REL_SOFT ); + }spin_unlock_irqrestore (&dum_hcd->dum->lock, flags);return rc;
@@ -1813,6 +1817,7 @@ static enum hrtimer_restart dummy_timer(struct hrtimer *t)/* look at each urb queued by the host side driver */ spin_lock_irqsave (&dum->lock, flags); + dum_hcd->timer_pending =0 ;if (!dum_hcd->udev) { dev_err(dummy_dev(dum_hcd),
@@ -1994,8 +1999,10 @@ static enum hrtimer_restart dummy_timer(struct hrtimer *t)if (list_empty (&dum_hcd->urbp_list)) {usb_put_dev (dum_hcd->udev); dum_hcd->udev =NULL ; - }else if (dum_hcd->rh_state ==DUMMY_RH_RUNNING ) { + }else if (!dum_hcd->timer_pending && + dum_hcd->rh_state ==DUMMY_RH_RUNNING ) {/* want a 1 msec delay here */ + dum_hcd->timer_pending =1 ;hrtimer_start (&dum_hcd->timer,ns_to_ktime (DUMMY_TIMER_INT_NSECS ),HRTIMER_MODE_REL_SOFT ); }
@@ -2390,8 +2397,10 @@ static int dummy_bus_resume(struct usb_hcd *hcd) }else { dum_hcd->rh_state =DUMMY_RH_RUNNING ;set_link_state (dum_hcd); -if (!list_empty (&dum_hcd->urbp_list)) +if (!list_empty (&dum_hcd->urbp_list)) { + dum_hcd->timer_pending =1 ;hrtimer_start (&dum_hcd->timer,ns_to_ktime (0 ),HRTIMER_MODE_REL_SOFT ); + } hcd->state =HC_STATE_RUNNING ; }spin_unlock_irq (&dum_hcd->dum->lock);
@@ -2522,6 +2531,7 @@ static void dummy_stop(struct usb_hcd *hcd)struct dummy_hcd *dum_hcd =hcd_to_dummy_hcd (hcd);hrtimer_cancel (&dum_hcd->timer); + dum_hcd->timer_pending =0 ;device_remove_file (dummy_dev (dum_hcd), &dev_attr_urbs);dev_info (dummy_dev (dum_hcd),"stopped\n" ); }
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 107/135 usb: gadget: f_uac2: fix return value for UAC2_ATTRIBUTE_STRING store
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Groeneveld <[email protected]>
commit 9499327714de7bc5cf6c792112c1474932d8ad31 upstream.
The configfs store callback should return the number of bytes consumed not the total number of bytes we actually stored. These could differ if for example the passed in string had a newline we did not store.
If the returned value does not match the number of bytes written the writer might assume a failure or keep trying to write the remaining bytes.
For example the following command will hang trying to write the final newline over and over again (tested on bash 2.05b):
echo foo > function_name
--- drivers/usb/gadget/function/f_uac2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/gadget/function/f_uac2.c +3 -3
@@ -2055,7 +2055,7 @@ static ssize_t f_uac2_opts_##name##_stor const char *page, size_t len) \ { \struct f_uac2_opts *opts =to_f_uac2_opts (item); \ -int ret =0 ; \ +int ret = len; \ \mutex_lock (&opts->lock); \if (opts->refcnt) { \
@@ -2066,8 +2066,8 @@ static ssize_t f_uac2_opts_##name##_storif (len && page[len -1 ] =='\n' ) \ len--; \ \ - ret =scnprintf (opts->name,min (sizeof (opts->name), len +1 ), \ -"%s" , page); \ +scnprintf (opts->name,min (sizeof (opts->name), len +1 ), \ +"%s" , page); \ \ end: \mutex_unlock (&opts->lock); \
Greg Kroah-Hartman
maintainerPATCH 108/135 usb: dwc3: Wait for EndXfer completion before restoring GUSB2PHYCFG
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prashanth K <[email protected]>
commit c96e31252110a84dcc44412e8a7b456b33c3e298 upstream.
DWC3 programming guide mentions that when operating in USB2.0 speeds, if GUSB2PHYCFG[6] or GUSB2PHYCFG[8] is set, it must be cleared prior to issuing commands and may be set again after the command completes. But currently while issuing EndXfer command without CmdIOC set, we wait for 1ms after GUSB2PHYCFG is restored. This results in cases where EndXfer command doesn't get completed and causes SMMU faults since requests are unmapped afterwards. Hence restore GUSB2PHYCFG after waiting for EndXfer command completion.
--- drivers/usb/dwc3/gadget.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/usb/dwc3/gadget.c +6 -4
@@ -438,6 +438,10 @@ skip_status:dwc3_gadget_ep_get_transfer_index (dep); } +if (DWC3_DEPCMD_CMD (cmd) ==DWC3_DEPCMD_ENDTRANSFER && + !(cmd &DWC3_DEPCMD_CMDIOC )) +mdelay (1 ); +if (saved_config) { reg =dwc3_readl (dwc->regs,DWC3_GUSB2PHYCFG (0 )); reg |= saved_config;
@@ -1715,12 +1719,10 @@ static int __dwc3_stop_active_transfer(sWARN_ON_ONCE (ret); dep->resource_index =0 ; -if (!interrupt) { -mdelay (1 ); +if (!interrupt) dep->flags &= ~DWC3_EP_TRANSFER_STARTED ; - }else if (!ret) { +else if (!ret) dep->flags |=DWC3_EP_END_TRANSFER_PENDING ; - } dep->flags &= ~DWC3_EP_DELAY_STOP ;return ret;
Greg Kroah-Hartman
maintainerPATCH 109/135 usb: dwc3: core: Fix system suspend on TI AM62 platforms
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roger Quadros <[email protected]>
commit 705e3ce37bccdf2ed6f848356ff355f480d51a91 upstream.
Since commit 6d735722063a ("usb: dwc3: core: Prevent phy suspend during init"), system suspend is broken on AM62 TI platforms.
Before that commit, both DWC3_GUSB3PIPECTL_SUSPHY and DWC3_GUSB2PHYCFG_SUSPHY bits (hence forth called 2 SUSPHY bits) were being set during core initialization and even during core re-initialization after a system suspend/resume.
These bits are required to be set for system suspend/resume to work correctly on AM62 platforms.
Since that commit, the 2 SUSPHY bits are not set for DEVICE/OTG mode if gadget driver is not loaded and started.
For Host mode, the 2 SUSPHY bits are set before the first system suspend but get cleared at system resume during core re-init and are never set again.
This patch resovles these two issues by ensuring the 2 SUSPHY bits are set before system suspend and restored to the original state during system resume.
--- drivers/usb/dwc3/core.c | 19 +++++++++++++++++++ drivers/usb/dwc3/core.h | 3 +++ 2 files changed, 22 insertions(+)
drivers/usb/dwc3/core.c +19 -0
@@ -2342,6 +2342,11 @@ static int dwc3_suspend_common(struct dwu32 reg;int i; + dwc->susphy_state = (dwc3_readl (dwc->regs,DWC3_GUSB2PHYCFG (0 )) & +DWC3_GUSB2PHYCFG_SUSPHY ) || + (dwc3_readl (dwc->regs,DWC3_GUSB3PIPECTL (0 )) & +DWC3_GUSB3PIPECTL_SUSPHY ); +switch (dwc->current_dr_role) {case DWC3_GCTL_PRTCAP_DEVICE :if (pm_runtime_suspended (dwc->dev))
@@ -2393,6 +2398,15 @@ static int dwc3_suspend_common(struct dwbreak ; } +if (!PMSG_IS_AUTO (msg)) { +/* +* TI AM62 platform requires SUSPHY to be +* enabled for system suspend to work. +*/ +if (!dwc->susphy_state) +dwc3_enable_susphy (dwc, true); + } +return 0 ; }
@@ -2460,6 +2474,11 @@ static int dwc3_resume_common(struct dwcbreak ; } +if (!PMSG_IS_AUTO (msg)) { +/* restore SUSPHY state to that before system suspend. */ +dwc3_enable_susphy (dwc, dwc->susphy_state); + } +return 0 ; }
drivers/usb/dwc3/core.h +3 -0
@@ -1150,6 +1150,8 @@ struct dwc3_scratchpad_array {* @sys_wakeup: set if the device may do system wakeup. * @wakeup_configured: set if the device is configured for remote wakeup. * @suspended: set to track suspend event due to U3/L2. +* @susphy_state: state of DWC3_GUSB2PHYCFG_SUSPHY + DWC3_GUSB3PIPECTL_SUSPHY +* before PM suspend. * @imod_interval: set the interrupt moderation interval in 250ns * increments or 0 to disable. * @max_cfg_eps: current max number of IN eps used across all USB configs.
@@ -1382,6 +1384,7 @@ struct dwc3 { unsigned sys_wakeup:1; unsigned wakeup_configured:1; unsigned suspended:1; + unsigned susphy_state:1;u16 imod_interval;
Greg Kroah-Hartman
maintainerPATCH 110/135 misc: microchip: pci1xxxx: add support for NVMEM_DEVID_AUTO for EEPROM device
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Thiery <[email protected]>
commit 3c2d73de49be528276474c1a53f78b38ee11c1fa upstream.
By using NVMEM_DEVID_AUTO we support more than 1 device and automatically enumerate.
--- drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c +1 -0
@@ -364,6 +364,7 @@ static int pci1xxxx_otp_eeprom_probe(strif (is_eeprom_responsive (priv)) { priv->nvmem_config_eeprom.type =NVMEM_TYPE_EEPROM ; priv->nvmem_config_eeprom.name =EEPROM_NAME ; + priv->nvmem_config_eeprom.id =NVMEM_DEVID_AUTO ; priv->nvmem_config_eeprom.dev = &aux_dev->dev; priv->nvmem_config_eeprom.owner =THIS_MODULE ; priv->nvmem_config_eeprom.reg_read = pci1xxxx_eeprom_read;
Greg Kroah-Hartman
maintainerPATCH 111/135 misc: microchip: pci1xxxx: add support for NVMEM_DEVID_AUTO for OTP device
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Thiery <[email protected]>
commit 2471787c1f0dae6721f60ab44be37460635d3732 upstream.
By using NVMEM_DEVID_AUTO we support more than 1 device and automatically enumerate.
--- drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c +1 -0
@@ -384,6 +384,7 @@ static int pci1xxxx_otp_eeprom_probe(str priv->nvmem_config_otp.type =NVMEM_TYPE_OTP ; priv->nvmem_config_otp.name =OTP_NAME ; + priv->nvmem_config_otp.id =NVMEM_DEVID_AUTO ; priv->nvmem_config_otp.dev = &aux_dev->dev; priv->nvmem_config_otp.owner =THIS_MODULE ; priv->nvmem_config_otp.reg_read = pci1xxxx_otp_read;
Greg Kroah-Hartman
maintainerPATCH 112/135 serial: imx: Update mctrl old_status on RTSD interrupt
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
commit 40d7903386df4d18f04d90510ba90eedee260085 upstream.
When sending data using DMA at high baudrate (4 Mbdps in local test case) to a device with small RX buffer which keeps asserting RTS after every received byte, it is possible that the iMX UART driver would not recognize the falling edge of RTS input signal and get stuck, unable to transmit any more data.
This condition happens when the following sequence of events occur:
- imx_uart_mctrl_check() is called at some point and takes a snapshot of UART control signal status into sport->old_status using imx_uart_get_hwmctrl(). The RTSS/TIOCM_CTS bit is of interest here (*).
- DMA transfer occurs, the remote device asserts RTS signal after each byte. The i.MX UART driver recognizes each such RTS signal change, raises an interrupt with USR1 register RTSD bit set, which leads to invocation of __imx_uart_rtsint(), which calls uart_handle_cts_change().
- If the RTS signal is deasserted, uart_handle_cts_change() clears
port->hw_stopped and unblocks the port for further data transfers.
- If the RTS is asserted, uart_handle_cts_change() sets port->hw_stopped and blocks the port for further data transfers. This may occur as the last interrupt of a transfer, which means port->hw_stopped remains set and the port remains blocked (**).
- Any further data transfer attempts will trigger imx_uart_mctrl_check(), which will read current status of UART control signals by calling imx_uart_get_hwmctrl() (***) and compare it with sport->old_status .
- If current status differs from sport->old_status for RTS signal, uart_handle_cts_change() is called and possibly unblocks the port by clearing port->hw_stopped .
- If current status does not differ from sport->old_status for RTS signal, no action occurs. This may occur in case prior snapshot (*) was taken before any transfer so the RTS is deasserted, current snapshot (***) was taken after a transfer and therefore RTS is deasserted again, which means current status and sport->old_status are identical. In case (**) triggered when RTS got asserted, and made port->hw_stopped set, the port->hw_stopped will remain set because no change on RTS line is recognized by this driver and uart_handle_cts_change() is not called from here to unblock the port->hw_stopped.
Update sport->old_status in __imx_uart_rtsint() accordingly to make imx_uart_mctrl_check() detect such RTS change. Note that TIOCM_CAR and TIOCM_RI bits in sport->old_status do not suffer from this problem.
--- drivers/tty/serial/imx.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/tty/serial/imx.c +15 -0
@@ -762,6 +762,21 @@ static irqreturn_t __imx_uart_rtsint(intimx_uart_writel (sport,USR1_RTSD ,USR1 ); usr1 =imx_uart_readl (sport,USR1 ) &USR1_RTSS ; +/* +* Update sport->old_status here, so any follow-up calls to +* imx_uart_mctrl_check() will be able to recognize that RTS +* state changed since last imx_uart_mctrl_check() call. +* +* In case RTS has been detected as asserted here and later on +* deasserted by the time imx_uart_mctrl_check() was called, +* imx_uart_mctrl_check() can detect the RTS state change and +* trigger uart_handle_cts_change() to unblock the port for +* further TX transfers. +*/ +if (usr1 &USR1_RTSS ) + sport->old_status |=TIOCM_CTS ; +else + sport->old_status &= ~TIOCM_CTS ;uart_handle_cts_change (&sport->port, usr1);wake_up_interruptible (&sport->port.state->port.delta_msr_wait);
Greg Kroah-Hartman
maintainerPATCH 113/135 parport: Proper fix for array out-of-bounds access
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 02ac3a9ef3a18b58d8f3ea2b6e46de657bf6c4f9 upstream.
The recent fix for array out-of-bounds accesses replaced sprintf() calls blindly with snprintf(). However, since snprintf() returns the would-be-printed size, not the actually output size, the length calculation can still go over the given limit.
Use scnprintf() instead of snprintf(), which returns the actually output letters, for addressing the potential out-of-bounds access properly.
--- drivers/parport/procfs.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/parport/procfs.c +11 -11
@@ -51,12 +51,12 @@ static int do_active_device(const structfor (dev = port->devices; dev ; dev = dev->next) {if (dev == port->cad) { - len +=snprintf (buffer,sizeof (buffer),"%s\n" , dev->name); + len +=scnprintf (buffer,sizeof (buffer),"%s\n" , dev->name); } }if (!len) { - len +=snprintf (buffer,sizeof (buffer),"%s\n" ,"none" ); + len +=scnprintf (buffer,sizeof (buffer),"%s\n" ,"none" ); }if (len > *lenp)
@@ -87,19 +87,19 @@ static int do_autoprobe(const struct ctl }if ((str = info->class_name) !=NULL ) - len +=snprintf (buffer + len,sizeof (buffer) - len,"CLASS:%s;\n" , str); + len +=scnprintf (buffer + len,sizeof (buffer) - len,"CLASS:%s;\n" , str);if ((str = info->model) !=NULL ) - len +=snprintf (buffer + len,sizeof (buffer) - len,"MODEL:%s;\n" , str); + len +=scnprintf (buffer + len,sizeof (buffer) - len,"MODEL:%s;\n" , str);if ((str = info->mfr) !=NULL ) - len +=snprintf (buffer + len,sizeof (buffer) - len,"MANUFACTURER:%s;\n" , str); + len +=scnprintf (buffer + len,sizeof (buffer) - len,"MANUFACTURER:%s;\n" , str);if ((str = info->description) !=NULL ) - len +=snprintf (buffer + len,sizeof (buffer) - len,"DESCRIPTION:%s;\n" , str); + len +=scnprintf (buffer + len,sizeof (buffer) - len,"DESCRIPTION:%s;\n" , str);if ((str = info->cmdset) !=NULL ) - len +=snprintf (buffer + len,sizeof (buffer) - len,"COMMAND SET:%s;\n" , str); + len +=scnprintf (buffer + len,sizeof (buffer) - len,"COMMAND SET:%s;\n" , str);if (len > *lenp) len = *lenp;
@@ -128,7 +128,7 @@ static int do_hardware_base_addr(const sif (write)/* permissions prevent this anyway */ return -EACCES ; - len +=snprintf (buffer,sizeof (buffer),"%lu\t%lu\n" , port->base, port->base_hi); + len +=scnprintf (buffer,sizeof (buffer),"%lu\t%lu\n" , port->base, port->base_hi);if (len > *lenp) len = *lenp;
@@ -155,7 +155,7 @@ static int do_hardware_irq(const structif (write)/* permissions prevent this anyway */ return -EACCES ; - len +=snprintf (buffer,sizeof (buffer),"%d\n" , port->irq); + len +=scnprintf (buffer,sizeof (buffer),"%d\n" , port->irq);if (len > *lenp) len = *lenp;
@@ -182,7 +182,7 @@ static int do_hardware_dma(const structif (write)/* permissions prevent this anyway */ return -EACCES ; - len +=snprintf (buffer,sizeof (buffer),"%d\n" , port->dma); + len +=scnprintf (buffer,sizeof (buffer),"%d\n" , port->dma);if (len > *lenp) len = *lenp;
@@ -213,7 +213,7 @@ static int do_hardware_modes(const struc#define printmode (x) \ do { \ if (port->modes & PARPORT_MODE_##x) \ - len += snprintf(buffer + len, sizeof(buffer) - len, "%s%s", f++ ? "," : "", #x); \ + len += scnprintf(buffer + len, sizeof(buffer) - len, "%s%s", f++ ? "," : "", #x); \ } while (0)int f =0 ;printmode (PCSPP );
Greg Kroah-Hartman
maintainerPATCH 114/135 x86/resctrl: Annotate get_mem_config() functions as __init
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit d5fd042bf4cfb557981d65628e1779a492cd8cfa upstream.
After a recent LLVM change [1] that deduces __cold on functions that only call cold code (such as __init functions), there is a section mismatch warning from __get_mem_config_intel(), which got moved to .text.unlikely. as a result of that optimization:
WARNING: modpost: vmlinux: section mismatch in reference: \ __get_mem_config_intel+0x77 (section: .text.unlikely.) -> thread_throttle_mode_init (section: .init.text)
Mark __get_mem_config_intel() as __init as well since it is only called from __init code, which clears up the warning.
While __rdt_get_mem_config_amd() does not exhibit a warning because it does not call any __init code, it is a similar function that is only called from __init code like __get_mem_config_intel(), so mark it __init as well to keep the code symmetrical.
CONFIG_SECTION_MISMATCH_WARN_ONLY=n would turn this into a fatal error.
--- arch/x86/kernel/cpu/resctrl/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/resctrl/core.c +2 -2
@@ -207,7 +207,7 @@ static inline bool rdt_get_mb_table(strureturn false; } -static bool __get_mem_config_intel (struct rdt_resource *r) +static __init bool __get_mem_config_intel (struct rdt_resource *r) {struct rdt_hw_resource *hw_res =resctrl_to_arch_res (r);union cpuid_0x10_3_eax eax;
@@ -241,7 +241,7 @@ static bool __get_mem_config_intel(strucreturn true; } -static bool __rdt_get_mem_config_amd (struct rdt_resource *r) +static __init bool __rdt_get_mem_config_amd (struct rdt_resource *r) {struct rdt_hw_resource *hw_res =resctrl_to_arch_res (r);u32 eax, ebx, ecx, edx, subleaf;
Greg Kroah-Hartman
maintainerPATCH 115/135 x86/apic: Always explicitly disarm TSC-deadline timer
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Rui <[email protected]>
commit ffd95846c6ec6cf1f93da411ea10d504036cab42 upstream.
New processors have become pickier about the local APIC timer state before entering low power modes. These low power modes are used (for example) when you close your laptop lid and suspend. If you put your laptop in a bag and it is not in this low power mode, it is likely to get quite toasty while it quickly sucks the battery dry.
The problem boils down to some CPUs' inability to power down until the CPU recognizes that the local APIC timer is shut down. The current kernel code works in one-shot and periodic modes but does not work for deadline mode. Deadline mode has been the supported and preferred mode on Intel CPUs for over a decade and uses an MSR to drive the timer instead of an APIC register.
Disable the TSC Deadline timer in lapic_timer_shutdown() by writing to MSR_IA32_TSC_DEADLINE when in TSC-deadline mode. Also avoid writing to the initial-count register (APIC_TMICT) which is ignored in TSC-deadline mode.
Note: The APIC_LVTT|=APIC_LVT_MASKED operation should theoretically be enough to tell the hardware that the timer will not fire in any of the timer modes. But mitigating AMD erratum 411[1] also requires clearing out APIC_TMICT. Solely setting APIC_LVT_MASKED is also ineffective in practice on Intel Lunar Lake systems, which is the motivation for this change.
1. 411 Processor May Exit Message-Triggered C1E State Without an Interrupt if Local APIC Timer Reaches Zero - https://www.amd.com/content/dam/amd/en/documents/archived-tech-docs/revision-guides/41322_10h_Rev_Gd.pdf
--- arch/x86/kernel/apic/apic.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
arch/x86/kernel/apic/apic.c +13 -1
@@ -440,7 +440,19 @@ static int lapic_timer_shutdown(struct c v =apic_read (APIC_LVTT ); v |= (APIC_LVT_MASKED |LOCAL_TIMER_VECTOR );apic_write (APIC_LVTT , v); -apic_write (APIC_TMICT ,0 ); + +/* +* Setting APIC_LVT_MASKED (above) should be enough to tell +* the hardware that this timer will never fire. But AMD +* erratum 411 and some Intel CPU behavior circa 2024 say +* otherwise. Time for belt and suspenders programming: mask +* the timer _and_ zero the counter registers: +*/ +if (v &APIC_LVT_TIMER_TSCDEADLINE ) +wrmsrl (MSR_IA32_TSC_DEADLINE ,0 ); +else +apic_write (APIC_TMICT ,0 ); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 116/135 x86/CPU/AMD: Only apply Zenbleed fix for Zen2 during late microcode load
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Allen <[email protected]>
commit ee4d4e8d2c3bec6ee652599ab31991055a72c322 upstream.
Commit
f69759be251d ("x86/CPU/AMD: Move Zenbleed check to the Zen2 init function")
causes a bit in the DE_CFG MSR to get set erroneously after a microcode late load.
The microcode late load path calls into amd_check_microcode() and subsequently zen2_zenbleed_check(). Since the above commit removes the cpu_has_amd_erratum() call from zen2_zenbleed_check(), this will cause all non-Zen2 CPUs to go through the function and set the bit in the DE_CFG MSR.
Call into the Zenbleed fix path on Zen2 CPUs only.
[ bp: Massage commit message, use cpu_feature_enabled(). ]
--- arch/x86/kernel/cpu/amd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/amd.c +2 -1
@@ -1218,5 +1218,6 @@ void amd_check_microcode(void)if (boot_cpu_data.x86_vendor !=X86_VENDOR_AMD )return ; -on_each_cpu (zenbleed_check_cpu,NULL ,1 ); +if (cpu_feature_enabled (X86_FEATURE_ZEN2 )) +on_each_cpu (zenbleed_check_cpu,NULL ,1 ); }
Greg Kroah-Hartman
maintainerPATCH 117/135 x86/entry_32: Do not clobber user EFLAGS.ZF
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pawan Gupta <[email protected]>
commit 2e2e5143d4868163d6756c8c6a4d28cbfa5245e5 upstream.
Opportunistic SYSEXIT executes VERW to clear CPU buffers after user EFLAGS are restored. This can clobber user EFLAGS.ZF.
Move CLEAR_CPU_BUFFERS before the user EFLAGS are restored. This ensures that the user EFLAGS.ZF is not clobbered.
--- arch/x86/entry/entry_32.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/entry/entry_32.S +2 -1
@@ -871,6 +871,8 @@ SYM_FUNC_START(entry_SYSENTER_32) /* Now ready to switch the cr3 */ SWITCH_TO_USER_CR3 scratch_reg=%eax + /* Clobbers ZF */ + CLEAR_CPU_BUFFERS /* * Restore all flags except IF. (We restore IF separately because
@@ -881,7 +883,6 @@ SYM_FUNC_START(entry_SYSENTER_32) BUG_IF_WRONG_CR3 no_user_check=1 popfl popl %eax - CLEAR_CPU_BUFFERS /* * Return back to the vDSO, which will pop ecx and edx.
Greg Kroah-Hartman
maintainerPATCH 118/135 x86/entry_32: Clear CPU buffers after register restore in NMI return
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pawan Gupta <[email protected]>
commit 48a2440d0f20c826b884e04377ccc1e4696c84e9 upstream.
CPU buffers are currently cleared after call to exc_nmi, but before register state is restored. This may be okay for MDS mitigation but not for RDFS. Because RDFS mitigation requires CPU buffers to be cleared when registers don't have any sensitive data.
Move CLEAR_CPU_BUFFERS after RESTORE_ALL_NMI.
--- arch/x86/entry/entry_32.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/entry/entry_32.S +2 -1
@@ -1145,7 +1145,6 @@ SYM_CODE_START(asm_exc_nmi) /* Not on SYSENTER stack. */ call exc_nmi - CLEAR_CPU_BUFFERS jmp .Lnmi_return .Lnmi_from_sysenter_stack:
@@ -1166,6 +1165,7 @@ SYM_CODE_START(asm_exc_nmi) CHECK_AND_APPLY_ESPFIX RESTORE_ALL_NMI cr3_reg=%edi pop=4 + CLEAR_CPU_BUFFERS jmp .Lirq_return #ifdef CONFIG_X86_ESPFIX32
@@ -1207,6 +1207,7 @@ SYM_CODE_START(asm_exc_nmi) * 1 - orig_ax */ lss (1+5+6)*4(%esp), %esp # back to espfix stack + CLEAR_CPU_BUFFERS jmp .Lirq_return #endif SYM_CODE_END(asm_exc_nmi)
Greg Kroah-Hartman
maintainerPATCH 119/135 tty: n_gsm: Fix use-after-free in gsm_cleanup_mux
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Longlong Xia <[email protected]>
commit 9462f4ca56e7d2430fdb6dcc8498244acbfc4489 upstream.
BUG: KASAN: slab-use-after-free in gsm_cleanup_mux+0x77b/0x7b0 drivers/tty/n_gsm.c:3160 [n_gsm] Read of size 8 at addr ffff88815fe99c00 by task poc/3379 CPU: 0 UID: 0 PID: 3379 Comm: poc Not tainted 6.11.0+ #56 Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 11/12/2020 Call Trace: <TASK> gsm_cleanup_mux+0x77b/0x7b0 drivers/tty/n_gsm.c:3160 [n_gsm] __pfx_gsm_cleanup_mux+0x10/0x10 drivers/tty/n_gsm.c:3124 [n_gsm] __pfx_sched_clock_cpu+0x10/0x10 kernel/sched/clock.c:389 update_load_avg+0x1c1/0x27b0 kernel/sched/fair.c:4500 __pfx_min_vruntime_cb_rotate+0x10/0x10 kernel/sched/fair.c:846 __rb_insert_augmented+0x492/0xbf0 lib/rbtree.c:161 gsmld_ioctl+0x395/0x1450 drivers/tty/n_gsm.c:3408 [n_gsm] _raw_spin_lock_irqsave+0x92/0xf0 arch/x86/include/asm/atomic.h:107 __pfx_gsmld_ioctl+0x10/0x10 drivers/tty/n_gsm.c:3822 [n_gsm] ktime_get+0x5e/0x140 kernel/time/timekeeping.c:195 ldsem_down_read+0x94/0x4e0 arch/x86/include/asm/atomic64_64.h:79 __pfx_ldsem_down_read+0x10/0x10 drivers/tty/tty_ldsem.c:338 __pfx_do_vfs_ioctl+0x10/0x10 fs/ioctl.c:805 tty_ioctl+0x643/0x1100 drivers/tty/tty_io.c:2818 Allocated by task 65: gsm_data_alloc.constprop.0+0x27/0x190 drivers/tty/n_gsm.c:926 [n_gsm] gsm_send+0x2c/0x580 drivers/tty/n_gsm.c:819 [n_gsm] gsm1_receive+0x547/0xad0 drivers/tty/n_gsm.c:3038 [n_gsm] gsmld_receive_buf+0x176/0x280 drivers/tty/n_gsm.c:3609 [n_gsm] tty_ldisc_receive_buf+0x101/0x1e0 drivers/tty/tty_buffer.c:391 tty_port_default_receive_buf+0x61/0xa0 drivers/tty/tty_port.c:39 flush_to_ldisc+0x1b0/0x750 drivers/tty/tty_buffer.c:445 process_scheduled_works+0x2b0/0x10d0 kernel/workqueue.c:3229 worker_thread+0x3dc/0x950 kernel/workqueue.c:3391 kthread+0x2a3/0x370 kernel/kthread.c:389 ret_from_fork+0x2d/0x70 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:257 Freed by task 3367: kfree+0x126/0x420 mm/slub.c:4580 gsm_cleanup_mux+0x36c/0x7b0 drivers/tty/n_gsm.c:3160 [n_gsm] gsmld_ioctl+0x395/0x1450 drivers/tty/n_gsm.c:3408 [n_gsm] tty_ioctl+0x643/0x1100 drivers/tty/tty_io.c:2818
[Analysis]gsm_msg on the tx_ctrl_list or tx_data_list of gsm_mux can be freed by multi threads through ioctl,which leads to the occurrence of uaf. Protect it by gsm tx lock.
--- drivers/tty/n_gsm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/n_gsm.c +2 -0
@@ -3157,6 +3157,8 @@ static void gsm_cleanup_mux(struct gsm_mmutex_unlock (&gsm->mutex);/* Now wipe the queues */ tty_ldisc_flush (gsm->tty); + +guard (spinlock_irqsave)(&gsm->tx_lock);list_for_each_entry_safe (txq, ntxq, &gsm->tx_ctrl_list, list)kfree (txq);INIT_LIST_HEAD (&gsm->tx_ctrl_list);
Greg Kroah-Hartman
maintainerPATCH 120/135 x86/bugs: Use code segment selector for VERW operand
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pawan Gupta <[email protected]>
commit e4d2102018542e3ae5e297bc6e229303abff8a0f upstream.
Robert Gill reported below #GP in 32-bit mode when dosemu software was executing vm86() system call:
general protection fault: 0000 [#1] PREEMPT SMP CPU: 4 PID: 4610 Comm: dosemu.bin Not tainted 6.6.21-gentoo-x86 #1 Hardware name: Dell Inc. PowerEdge 1950/0H723K, BIOS 2.7.0 10/30/2010 EIP: restore_all_switch_stack+0xbe/0xcf EAX: 00000000 EBX: 00000000 ECX: 00000000 EDX: 00000000 ESI: 00000000 EDI: 00000000 EBP: 00000000 ESP: ff8affdc DS: 0000 ES: 0000 FS: 0000 GS: 0033 SS: 0068 EFLAGS: 00010046 CR0: 80050033 CR2: 00c2101c CR3: 04b6d000 CR4: 000406d0 Call Trace: show_regs+0x70/0x78 die_addr+0x29/0x70 exc_general_protection+0x13c/0x348 exc_bounds+0x98/0x98 handle_exception+0x14d/0x14d exc_bounds+0x98/0x98 restore_all_switch_stack+0xbe/0xcf exc_bounds+0x98/0x98 restore_all_switch_stack+0xbe/0xcf
This only happens in 32-bit mode when VERW based mitigations like MDS/RFDS are enabled. This is because segment registers with an arbitrary user value can result in #GP when executing VERW. Intel SDM vol. 2C documents the following behavior for VERW instruction:
#GP(0) - If a memory operand effective address is outside the CS, DS, ES,
FS, or GS segment limit.
CLEAR_CPU_BUFFERS macro executes VERW instruction before returning to user space. Use %cs selector to reference VERW operand. This ensures VERW will not #GP for an arbitrary user %ds.
[ mingo: Fixed the SOB chain. ]
--- arch/x86/include/asm/nospec-branch.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
arch/x86/include/asm/nospec-branch.h +10 -1
@@ -323,7 +323,16 @@* Note: Only the memory operand variant of VERW clears the CPU buffers. */ .macro CLEAR_CPU_BUFFERS - ALTERNATIVE "", __stringify(verw _ASM_RIP(mds_verw_sel)), X86_FEATURE_CLEAR_CPU_BUF +#ifdef CONFIG_X86_64 + ALTERNATIVE "", "verw mds_verw_sel(%rip)", X86_FEATURE_CLEAR_CPU_BUF +#else +/* +* In 32bit mode, the memory operand must be a %cs reference. The data +* segments may not be usable (vm86 mode), and the stack segment may not +* be flat (ESPFIX32). +*/ +ALTERNATIVE "" ,"verw %cs:mds_verw_sel" ,X86_FEATURE_CLEAR_CPU_BUF +#endif .endm#ifdef CONFIG_X86_64
Greg Kroah-Hartman
maintainerPATCH 121/135 pinctrl: nuvoton: fix a double free in ma35_pinctrl_dt_node_to_map_func()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harshit Mogalapalli <[email protected]>
commit 3fd976afe9743110f20a23f93b7ff9693f2be4bf upstream.
'new_map' is allocated using devm_* which takes care of freeing the allocated data on device removal, call to
.dt_free_map = pinconf_generic_dt_free_map
double frees the map as pinconf_generic_dt_free_map() calls pinctrl_utils_free_map().
Fix this by using kcalloc() instead of auto-managed devm_kcalloc().
--- drivers/pinctrl/nuvoton/pinctrl-ma35.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/nuvoton/pinctrl-ma35.c +1 -1
@@ -218,7 +218,7 @@ static int ma35_pinctrl_dt_node_to_map_func(struct pinctrl_dev *pctldev, } map_num += grp->npins; - new_map =devm_kcalloc (pctldev->dev, map_num,sizeof (*new_map),GFP_KERNEL ); + new_map =kcalloc (map_num,sizeof (*new_map),GFP_KERNEL );if (!new_map)return -ENOMEM ;
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 122/135 pinctrl: intel: platform: fix error path in device_for_each_child_node()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 16a6d2e685e8f9a2f51dd5a363d3f97fcad35e22 upstream.
The device_for_each_child_node() loop requires calls to fwnode_handle_put() upon early returns to decrement the refcount of the child node and avoid leaking memory if that error path is triggered.
There is one early returns within that loop in intel_platform_pinctrl_prepare_community(), but fwnode_handle_put() is missing.
Instead of adding the missing call, the scoped version of the loop can be used to simplify the code and avoid mistakes in the future if new early returns are added, as the child node is only used for parsing, and it is never assigned.
--- drivers/pinctrl/intel/pinctrl-intel-platform.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pinctrl/intel/pinctrl-intel-platform.c +1 -2
@@ -90,7 +90,6 @@ static int intel_platform_pinctrl_preparstruct intel_community *community, struct intel_platform_pins *pins) { - struct fwnode_handle *child; struct intel_padgroup *gpps;unsigned int group;size_t ngpps;
@@ -131,7 +130,7 @@ static int intel_platform_pinctrl_preparreturn -ENOMEM ; group =0 ; -device_for_each_child_node (dev, child) { +device_for_each_child_node_scoped (dev, child) {struct intel_padgroup *gpp = &gpps[group]; gpp->reg_num = group;
Greg Kroah-Hartman
maintainerPATCH 123/135 pinctrl: ocelot: fix system hang on level based interrupts
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Matsievskiy <[email protected]>
commit 93b8ddc54507a227087c60a0013ed833b6ae7d3c upstream.
The current implementation only calls chained_irq_enter() and chained_irq_exit() if it detects pending interrupts.
```
for (i = 0; i < info->stride; i++) {
uregmap_read(info->map, id_reg + 4 * i, ®);
if (!reg)
continue;
chained_irq_enter(parent_chip, desc);
```However, in case of GPIO pin configured in level mode and the parent controller configured in edge mode, GPIO interrupt might be lowered by the hardware. In the result, if the interrupt is short enough, the parent interrupt is still pending while the GPIO interrupt is cleared; chained_irq_enter() never gets called and the system hangs trying to service the parent interrupt.
Moving chained_irq_enter() and chained_irq_exit() outside the for loop ensures that they are called even when GPIO interrupt is lowered by the hardware.
The similar code with chained_irq_enter() / chained_irq_exit() functions wrapping interrupt checking loop may be found in many other drivers:
``` grep -r -A 10 chained_irq_enter drivers/pinctrl ```
--- drivers/pinctrl/pinctrl-ocelot.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pinctrl/pinctrl-ocelot.c +4 -4
@@ -1955,21 +1955,21 @@ static void ocelot_irq_handler(struct irunsigned int reg =0 , irq, i;unsigned long irqs; +chained_irq_enter (parent_chip, desc); +for (i =0 ; i < info->stride; i++) {regmap_read (info->map, id_reg +4 * i, ®);if (!reg)continue ; -chained_irq_enter (parent_chip, desc); - irqs = reg;for_each_set_bit (irq, &irqs,min (32U , info->desc->npins -32 * i))generic_handle_domain_irq (chip->irq.domain, irq +32 * i); - -chained_irq_exit (parent_chip, desc); } + +chained_irq_exit (parent_chip, desc); } static int ocelot_gpiochip_register(struct platform_device *pdev,
Greg Kroah-Hartman
maintainerPATCH 124/135 pinctrl: stm32: check devm_kasprintf() returned value
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ma Ke <[email protected]>
commit b0f0e3f0552a566def55c844b0d44250c58e4df6 upstream.
devm_kasprintf() can return a NULL pointer on failure but this returned value is not checked. Fix this lack and check the returned value.
Found by code review.
--- drivers/pinctrl/stm32/pinctrl-stm32.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/pinctrl/stm32/pinctrl-stm32.c +7 -2
@@ -1374,10 +1374,15 @@ static int stm32_gpiolib_register_bank(sfor (i =0 ; i < npins; i++) { stm32_pin =stm32_pctrl_get_desc_pin_from_gpio (pctl, bank, i); -if (stm32_pin && stm32_pin->pin.name) +if (stm32_pin && stm32_pin->pin.name) { names[i] =devm_kasprintf (dev,GFP_KERNEL ,"%s" , stm32_pin->pin.name); -else +if (!names[i]) { + err = -ENOMEM ; + goto err_clk; + } + }else { names[i] =NULL ; + } } bank->gpio_chip.names = (const char *const *)names;
Greg Kroah-Hartman
maintainerPATCH 125/135 pinctrl: apple: check devm_kasprintf() returned value
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ma Ke <[email protected]>
commit 665a58fe663ac7a9ea618dc0b29881649324b116 upstream.
devm_kasprintf() can return a NULL pointer on failure but this returned value is not checked. Fix this lack and check the returned value.
Found by code review.
--- drivers/pinctrl/pinctrl-apple-gpio.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pinctrl/pinctrl-apple-gpio.c +3 -0
@@ -474,6 +474,9 @@ static int apple_gpio_pinctrl_probe(strufor (i =0 ; i < npins; i++) { pins[i].number = i; pins[i].name =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"PIN%u" , i); +if (!pins[i].name) +return -ENOMEM ; + pins[i].drv_data = pctl; pin_names[i] = pins[i].name; pin_nums[i] = i;
Greg Kroah-Hartman
maintainerPATCH 126/135 irqchip/gic-v4: Dont allow a VMOVP on a dying VPE
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
commit 1442ee0011983f0c5c4b92380e6853afb513841a upstream.
Kunkun Jiang reported that there is a small window of opportunity for userspace to force a change of affinity for a VPE while the VPE has already been unmapped, but the corresponding doorbell interrupt still visible in /proc/irq/.
Plug the race by checking the value of vmapp_count, which tracks whether the VPE is mapped ot not, and returning an error in this case.
This involves making vmapp_count common to both GICv4.1 and its v4.0 ancestor.
--- drivers/irqchip/irq-gic-v3-its.c | 18 ++++++++++++------ include/linux/irqchip/arm-gic-v4.h | 4 +++- 2 files changed, 15 insertions(+), 7 deletions(-)
drivers/irqchip/irq-gic-v3-its.c +12 -6
@@ -797,8 +797,8 @@ static struct its_vpe *its_build_vmapp_cits_encode_valid (cmd, desc->its_vmapp_cmd.valid);if (!desc->its_vmapp_cmd.valid) { + alloc = !atomic_dec_return (&desc->its_vmapp_cmd.vpe->vmapp_count);if (is_v4_1 (its)) { - alloc = !atomic_dec_return (&desc->its_vmapp_cmd.vpe->vmapp_count);its_encode_alloc (cmd, alloc);/* * Unmapping a VPE is self-synchronizing on GICv4.1,
@@ -817,13 +817,13 @@ static struct its_vpe *its_build_vmapp_cits_encode_vpt_addr (cmd, vpt_addr);its_encode_vpt_size (cmd,LPI_NRBITS -1 ); + alloc = !atomic_fetch_inc (&desc->its_vmapp_cmd.vpe->vmapp_count); +if (!is_v4_1 (its)) goto out; vconf_addr =virt_to_phys (page_address (desc->its_vmapp_cmd.vpe->its_vm->vprop_page)); - alloc = !atomic_fetch_inc (&desc->its_vmapp_cmd.vpe->vmapp_count); -its_encode_alloc (cmd, alloc);/*
@@ -3807,6 +3807,13 @@ static int its_vpe_set_affinity(struct iunsigned long flags;/* +* Check if we're racing against a VPE being destroyed, for +* which we don't want to allow a VMOVP. +*/ +if (!atomic_read (&vpe->vmapp_count)) +return -EINVAL ; + +/* * Changing affinity is mega expensive, so let's be as lazy as * we can and only do it if we really have to. Also, if mapped * into the proxy device, we need to move the doorbell
@@ -4463,9 +4470,8 @@ static int its_vpe_init(struct its_vpe *raw_spin_lock_init (&vpe->vpe_lock); vpe->vpe_id = vpe_id; vpe->vpt_page = vpt_page; -if (gic_rdists->has_rvpeid) -atomic_set (&vpe->vmapp_count,0 ); -else +atomic_set (&vpe->vmapp_count,0 ); +if (!gic_rdists->has_rvpeid) vpe->vpe_proxy_event =-1 ;return 0 ;
include/linux/irqchip/arm-gic-v4.h +3 -1
@@ -66,10 +66,12 @@ struct its_vpe {bool enabled;bool group; } sgi_config[16 ]; -atomic_t vmapp_count; }; }; +/* Track the VPE being mapped */ +atomic_t vmapp_count; +/* * Ensures mutual exclusion between affinity setting of the * vPE and vLPI operations using vpe->col_idx.
Greg Kroah-Hartman
maintainerPATCH 127/135 irqchip/sifive-plic: Unmask interrupt in plic_irq_enable()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nam Cao <[email protected]>
commit 6b1e0651e9ce8ce418ad4ff360e7b9925dc5da79 upstream.
It is possible that an interrupt is disabled and masked at the same time. When the interrupt is enabled again by enable_irq(), only plic_irq_enable() is called, not plic_irq_unmask(). The interrupt remains masked and never raises.
An example where interrupt is both disabled and masked is when handle_fasteoi_irq() is the handler, and IRQS_ONESHOT is set. The interrupt handler:
1. Mask the interrupt
2. Handle the interrupt
3. Check if interrupt is still enabled, and unmask it (see
cond_unmask_eoi_irq())
If another task disables the interrupt in the middle of the above steps, the interrupt will not get unmasked, and will remain masked when it is enabled in the future.
The problem is occasionally observed when PREEMPT_RT is enabled, because PREEMPT_RT adds the IRQS_ONESHOT flag. But PREEMPT_RT only makes the problem more likely to appear, the bug has been around since commit a1706a1c5062 ("irqchip/sifive-plic: Separate the enable and mask operations").
Fix it by unmasking interrupt in plic_irq_enable().
--- drivers/irqchip/irq-sifive-plic.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/irqchip/irq-sifive-plic.c +11 -10
@@ -123,16 +123,6 @@ static inline void plic_irq_toggle(const } } -static void plic_irq_enable (struct irq_data *d) -{ -plic_irq_toggle (irq_data_get_effective_affinity_mask (d), d,1 ); -} - -static void plic_irq_disable (struct irq_data *d) -{ -plic_irq_toggle (irq_data_get_effective_affinity_mask (d), d,0 ); -} -static void plic_irq_unmask (struct irq_data *d) {struct plic_priv *priv =irq_data_get_irq_chip_data (d);
@@ -147,6 +137,17 @@ static void plic_irq_mask(struct irq_datwritel (0 , priv->regs +PRIORITY_BASE + d->hwirq *PRIORITY_PER_ID ); } +static void plic_irq_enable (struct irq_data *d) +{ +plic_irq_toggle (irq_data_get_effective_affinity_mask (d), d,1 ); +plic_irq_unmask (d); +} + +static void plic_irq_disable (struct irq_data *d) +{ +plic_irq_toggle (irq_data_get_effective_affinity_mask (d), d,0 ); +} +static void plic_irq_eoi (struct irq_data *d) {struct plic_handler *handler =this_cpu_ptr (&plic_handlers);
Greg Kroah-Hartman
maintainerPATCH 128/135 irqchip/sifive-plic: Return error code on failure
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charlie Jenkins <[email protected]>
commit 6eabf656048d904d961584de2e1d45bc0854f9fb upstream.
Set error to -ENOMEM if kcalloc() fails or if irq_domain_add_linear() fails inside of plic_probe() instead of returning 0.
--- drivers/irqchip/irq-sifive-plic.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/irqchip/irq-sifive-plic.c +6 -2
@@ -578,8 +578,10 @@ static int plic_probe(struct fwnode_hand handler->enable_save =kcalloc (DIV_ROUND_UP (nr_irqs,32 ),sizeof (*handler->enable_save),GFP_KERNEL ); -if (!handler->enable_save) +if (!handler->enable_save) { + error = -ENOMEM ; goto fail_cleanup_contexts; + } done:for (hwirq =1 ; hwirq <= nr_irqs; hwirq++) {plic_toggle (handler, hwirq,0 );
@@ -591,8 +593,10 @@ done: priv->irqdomain =irq_domain_add_linear (to_of_node (fwnode), nr_irqs +1 , &plic_irqdomain_ops, priv); -if (WARN_ON (!priv->irqdomain)) +if (WARN_ON (!priv->irqdomain)) { + error = -ENOMEM ; goto fail_cleanup_contexts; + }/* * We can have multiple PLIC instances so setup global state
Greg Kroah-Hartman
maintainerPATCH 129/135 serial: qcom-geni: fix polled console initialisation
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 4bef7c6f299910f19876ad8e7f5897514855f1d2 upstream.
The polled console (KGDB/KDB) implementation must not call port setup unconditionally as the port may already be in use by the console or a getty.
Only make sure that the receiver is enabled, but do not enable any device interrupts.
--- drivers/tty/serial/qcom_geni_serial.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/tty/serial/qcom_geni_serial.c +19 -1
@@ -146,6 +146,7 @@ static struct uart_driver qcom_geni_consstatic struct uart_driver qcom_geni_uart_driver;static void qcom_geni_serial_cancel_tx_cmd (struct uart_port *uport); +static int qcom_geni_serial_port_setup (struct uart_port *uport);static inline struct qcom_geni_serial_port *to_dev_port (struct uart_port *uport) {
@@ -393,6 +394,23 @@ static void qcom_geni_serial_poll_put_chwritel (M_TX_FIFO_WATERMARK_EN , uport->membase +SE_GENI_M_IRQ_CLEAR ); qcom_geni_serial_poll_tx_done(uport); } + +static int qcom_geni_serial_poll_init (struct uart_port *uport) +{ +struct qcom_geni_serial_port *port =to_dev_port (uport); +int ret; + +if (!port->setup) { + ret =qcom_geni_serial_port_setup (uport); +if (ret) +return ret; + } + +if (!qcom_geni_serial_secondary_active (uport)) +geni_se_setup_s_cmd (&port->se,UART_START_READ ,0 ); + +return 0 ; +}#endif #ifdef CONFIG_SERIAL_QCOM_GENI_CONSOLE
@@ -1564,7 +1582,7 @@ static const struct uart_ops qcom_geni_c#ifdef CONFIG_CONSOLE_POLL .poll_get_char = qcom_geni_serial_get_char, .poll_put_char = qcom_geni_serial_poll_put_char, - .poll_init = qcom_geni_serial_port_setup, + .poll_init = qcom_geni_serial_poll_init, #endif .pm = qcom_geni_serial_pm, };
Greg Kroah-Hartman
maintainerPATCH 130/135 serial: qcom-geni: revert broken hibernation support
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 19df76662a33d2f2fc41a66607cb8285fc02d6ec upstream.
This reverts commit 35781d8356a2eecaa6074ceeb80ee22e252fcdae.
Hibernation is not supported on Qualcomm platforms with mainline kernels yet a broken vendor implementation for the GENI serial driver made it upstream.
This is effectively dead code that cannot be tested and should just be removed, but if these paths were ever hit for an open non-console port they would crash the machine as the driver would fail to enable clocks during restore() (i.e. all ports would have to be closed by drivers and user space before hibernating the system to avoid this as a comment in the code hinted at).
The broken implementation also added a random call to enable the receiver in the port setup code where it does not belong and which enables the receiver prematurely for console ports.
--- drivers/tty/serial/qcom_geni_serial.c | 41 +--------------------------------- 1 file changed, 2 insertions(+), 39 deletions(-)
drivers/tty/serial/qcom_geni_serial.c +2 -39
@@ -1152,7 +1152,6 @@ static int qcom_geni_serial_port_setup(s false, true, true);geni_se_init (&port->se,UART_RX_WM , port->rx_fifo_depth -2 );geni_se_select_mode (&port->se, port->dev_data->mode); -qcom_geni_serial_start_rx (uport); port->setup = true;return 0 ;
@@ -1781,38 +1780,6 @@ static int qcom_geni_serial_sys_resume(sreturn ret; } -static int qcom_geni_serial_sys_hib_resume (struct device *dev) -{ -int ret =0 ; -struct uart_port *uport; -struct qcom_geni_private_data *private_data; -struct qcom_geni_serial_port *port =dev_get_drvdata (dev); - - uport = &port->uport; - private_data = uport->private_data; - -if (uart_console (uport)) { -geni_icc_set_tag (&port->se,QCOM_ICC_TAG_ALWAYS ); -geni_icc_set_bw (&port->se); - ret =uart_resume_port (private_data->drv, uport); -/* -* For hibernation usecase clients for -* console UART won't call port setup during restore, -* hence call port setup for console uart. -*/ -qcom_geni_serial_port_setup (uport); - }else { -/* -* Peripheral register settings are lost during hibernation. -* Update setup flag such that port setup happens again -* during next session. Clients of HS-UART will close and -* open the port during hibernation. -*/ - port->setup = false; - } -return ret; -} -static const struct qcom_geni_device_data qcom_geni_console_data = { .console = true, .mode =GENI_SE_FIFO ,
@@ -1824,12 +1791,8 @@ static const struct qcom_geni_device_dat };static const struct dev_pm_ops qcom_geni_serial_pm_ops = { - .suspend =pm_sleep_ptr (qcom_geni_serial_sys_suspend), - .resume =pm_sleep_ptr (qcom_geni_serial_sys_resume), - .freeze =pm_sleep_ptr (qcom_geni_serial_sys_suspend), - .poweroff =pm_sleep_ptr (qcom_geni_serial_sys_suspend), - .restore =pm_sleep_ptr (qcom_geni_serial_sys_hib_resume), - .thaw =pm_sleep_ptr (qcom_geni_serial_sys_hib_resume), +SYSTEM_SLEEP_PM_OPS (qcom_geni_serial_sys_suspend, + qcom_geni_serial_sys_resume) };static const struct of_device_id qcom_geni_serial_match_table[] = {
Greg Kroah-Hartman
maintainerPATCH 131/135 serial: qcom-geni: fix shutdown race
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 23f5f5debcaac1399cfeacec215278bf6dbc1d11 upstream.
A commit adding back the stopping of tx on port shutdown failed to add back the locking which had also been removed by commit e83766334f96 ("tty: serial: qcom_geni_serial: No need to stop tx/rx on UART shutdown").
Holding the port lock is needed to serialise against the console code, which may update the interrupt enable register and access the port state.
--- drivers/tty/serial/qcom_geni_serial.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/qcom_geni_serial.c +2 -0
@@ -1096,10 +1096,12 @@ static void qcom_geni_serial_shutdown(st {disable_irq (uport->irq); +uart_port_lock_irq (uport);qcom_geni_serial_stop_tx (uport);qcom_geni_serial_stop_rx (uport);qcom_geni_serial_cancel_tx_cmd (uport); +uart_port_unlock_irq (uport); }static void qcom_geni_serial_flush_buffer (struct uart_port *uport)
Greg Kroah-Hartman
maintainerPATCH 132/135 serial: qcom-geni: fix dma rx cancellation
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 23ee4a25661c33e6381d41e848a9060ed6d72845 upstream.
Make sure to wait for the DMA transfer to complete when cancelling the rx command on stop_rx(). This specifically prevents the DMA completion interrupt from firing after rx has been restarted, something which can lead to an IOMMU fault and hosed rx when the interrupt handler unmaps the DMA buffer for the new command:
qcom_geni_serial 988000.serial: serial engine reports 0 RX bytes in! arm-smmu 15000000.iommu: FSR = 00000402 [Format=2 TF], SID=0x563 arm-smmu 15000000.iommu: FSYNR0 = 00210013 [S1CBNDX=33 WNR PLVL=3] Bluetooth: hci0: command 0xfc00 tx timeout Bluetooth: hci0: Reading QCA version information failed (-110)
Also add the missing state machine reset which is needed in case cancellation fails.
--- drivers/tty/serial/qcom_geni_serial.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/tty/serial/qcom_geni_serial.c +14 -4
@@ -787,17 +787,27 @@ static void qcom_geni_serial_start_rx_fistatic void qcom_geni_serial_stop_rx_dma (struct uart_port *uport) {struct qcom_geni_serial_port *port =to_dev_port (uport); +bool done;if (!qcom_geni_serial_secondary_active (uport))return ;geni_se_cancel_s_cmd (&port->se); -qcom_geni_serial_poll_bit (uport,SE_GENI_S_IRQ_STATUS , -S_CMD_CANCEL_EN , true); - -if (qcom_geni_serial_secondary_active (uport)) + done =qcom_geni_serial_poll_bit (uport,SE_DMA_RX_IRQ_STAT , +RX_EOT , true); +if (done) { +writel (RX_EOT |RX_DMA_DONE , + uport->membase +SE_DMA_RX_IRQ_CLR ); + }else {qcom_geni_serial_abort_rx (uport); +writel (1 , uport->membase +SE_DMA_RX_FSM_RST ); +qcom_geni_serial_poll_bit (uport,SE_DMA_RX_IRQ_STAT , +RX_RESET_DONE , true); +writel (RX_RESET_DONE |RX_DMA_DONE , + uport->membase +SE_DMA_RX_IRQ_CLR ); + } +if (port->rx_dma_addr) {geni_se_rx_dma_unprep (&port->se, port->rx_dma_addr,DMA_RX_BUF_SIZE );
Greg Kroah-Hartman
maintainerPATCH 133/135 serial: qcom-geni: fix receiver enable
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit fa103d2599e11e802c818684cff821baefe7f206 upstream.
The receiver is supposed to be enabled in the startup() callback and not in set_termios() which is called also during console setup.
This specifically avoids accepting input before the port has been opened (and interrupts enabled), something which can also break the GENI firmware (cancel fails and after abort, the "stale" counter handling appears to be broken so that later input is not processed until twelve chars have been received).
There also does not appear to be any need to keep the receiver disabled while updating the port settings.
Since commit 6f3c3cafb115 ("serial: qcom-geni: disable interrupts during console writes") the calls to manipulate the secondary interrupts, which were done without holding the port lock, can also lead to the receiver being left disabled when set_termios() races with the console code (e.g. when init opens the tty during boot). This can manifest itself as a serial getty not accepting input.
The calls to stop and start rx in set_termios() can similarly race with DMA completion and, for example, cause the DMA buffer to be unmapped twice or the mapping to be leaked.
Fix this by only enabling the receiver during startup and while holding the port lock to avoid racing with the console code.
--- drivers/tty/serial/qcom_geni_serial.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/tty/serial/qcom_geni_serial.c +6 -4
@@ -1179,6 +1179,11 @@ static int qcom_geni_serial_startup(struif (ret)return ret; } + +uart_port_lock_irq (uport); +qcom_geni_serial_start_rx (uport); +uart_port_unlock_irq (uport); +enable_irq (uport->irq);return 0 ;
@@ -1264,7 +1269,6 @@ static void qcom_geni_serial_set_termiosunsigned int avg_bw_core;unsigned long timeout; -qcom_geni_serial_stop_rx (uport);/* baud rate */ baud =uart_get_baud_rate (uport, termios, old,300 ,4000000 );
@@ -1280,7 +1284,7 @@ static void qcom_geni_serial_set_termiosdev_err (port->se.dev,"Couldn't find suitable clock rate for %u\n" , baud * sampling_rate); - goto out_restart_rx; +return ; } dev_dbg(port->se.dev, "desired_rate = %u, clk_rate = %lu, clk_div = %u\n",
@@ -1371,8 +1375,6 @@ static void qcom_geni_serial_set_termioswritel (stop_bit_len, uport->membase +SE_UART_TX_STOP_BIT_LEN );writel (ser_clk_cfg, uport->membase +GENI_SER_M_CLK_CFG );writel (ser_clk_cfg, uport->membase +GENI_SER_S_CLK_CFG ); -out_restart_rx: -qcom_geni_serial_start_rx (uport); }#ifdef CONFIG_SERIAL_QCOM_GENI_CONSOLE
Greg Kroah-Hartman
maintainerPATCH 134/135 mm: vmscan.c: fix OOM on swap stress test
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Li <[email protected]>
commit 0885ef4705607936fc36a38fd74356e1c465b023 upstream.
I found a regression on mm-unstable during my swap stress test, using tmpfs to compile linux. The test OOM very soon after the make spawns many cc processes.
It bisects down to this change: 33dfe9204f29b415bbc0abb1a50642d1ba94f5e9 (mm/gup: clear the LRU flag of a page before adding to LRU batch)
Yu Zhao propose the fix: "I think this is one of the potential side effects -- Huge mentioned earlier about isolate_lru_folios():"
I test that with it the swap stress test no longer OOM.
--- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/vmscan.c +1 -1
@@ -4300,7 +4300,7 @@ static bool sort_folio(struct lruvec *lr }/* ineligible */ -if (zone > sc->reclaim_idx) { +if (!folio_test_lru (folio) || zone > sc->reclaim_idx) { gen =folio_inc_gen (lruvec, folio, false);list_move_tail (&folio->lru, &lrugen->folios[gen][type][zone]);return true;
Greg Kroah-Hartman
maintainerPATCH 135/135 ALSA: hda/conexant - Use cached pin control for Node 0x1d on HP EliteOne 1000 G2
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasiliy Kovalev <[email protected]>
commit 164cd0e077a18d6208523c82b102c98c77fdd51f upstream.
The cached version avoids redundant commands to the codec, improving stability and reducing unnecessary operations. This change ensures better power management and reliable restoration of pin configurations, especially after hibernation (S4) and other power transitions.
--- sound/pci/hda/patch_conexant.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/patch_conexant.c +1 -1
@@ -330,7 +330,7 @@ static void cxt_fixup_update_pinctl(stru* This is the value stored in the codec register after * the correct initialization of the previous windows boot. */ -snd_hda_set_pin_ctl (codec,0x1d ,AC_PINCTL_HP_EN ); +snd_hda_set_pin_ctl_cache (codec,0x1d ,AC_PINCTL_HP_EN ); } }
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.11.5 release. There are 135 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, 23 Oct 2024 10:22:25 +0000. Anything received after that time might be too late.
Hi Greg
6.11.5-rc1 compiles, boots and runs here on x86_64 (AMD Ryzen 5 PRO 4650G, Slackware64-15.0)
Hello,
Quoted 5 lines · On Mon, 21 Oct 2024 12:22:36 +0200 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.11.5 release. There are 135 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 7 lines
Responses should be made by Wed, 23 Oct 2024 10:22:25 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.11.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.11.y
This rc kernel passes DAMON functionality test[1] on my test machine. Attaching the test results summary below. Please note that I retrieved the kernel from linux-stable-rc tree[2].
[1] https://github.com/damonitor/damon-tests/tree/next/corr
[2] 96563e3507d7 ("Linux 6.11.5-rc1")
Thanks,
SJ
[...]
---
ok 9 selftests: damon: damos_tried_regions.py
ok 10 selftests: damon: damon_nr_regions.py
ok 11 selftests: damon: reclaim.sh
ok 12 selftests: damon: lru_sort.sh
ok 13 selftests: damon: debugfs_empty_targets.sh
ok 14 selftests: damon: debugfs_huge_count_read_write.sh
ok 15 selftests: damon: debugfs_duplicate_context_creation.sh ok 16 selftests: damon: debugfs_rm_non_contexts.sh
ok 17 selftests: damon: debugfs_target_ids_read_before_terminate_race.sh ok 18 selftests: damon: debugfs_target_ids_pid_leak.sh
ok 19 selftests: damon: sysfs_update_removed_scheme_dir.sh
ok 20 selftests: damon: sysfs_update_schemes_tried_regions_hang.py ok 1 selftests: damon-tests: kunit.sh
ok 2 selftests: damon-tests: huge_count_read_write.sh
ok 3 selftests: damon-tests: buffer_overflow.sh
ok 4 selftests: damon-tests: rm_contexts.sh
ok 5 selftests: damon-tests: record_null_deref.sh
ok 6 selftests: damon-tests: dbgfs_target_ids_read_before_terminate_race.sh ok 7 selftests: damon-tests: dbgfs_target_ids_pid_leak.sh
ok 8 selftests: damon-tests: damo_tests.sh
ok 9 selftests: damon-tests: masim-record.sh
ok 10 selftests: damon-tests: build_i386.sh
ok 11 selftests: damon-tests: build_arm64.sh # SKIP
ok 12 selftests: damon-tests: build_m68k.sh # SKIP
ok 13 selftests: damon-tests: build_i386_idle_flag.sh
ok 14 selftests: damon-tests: build_i386_highpte.sh
ok 15 selftests: damon-tests: build_nomemcg.sh
[33m
[92mPASS [39m
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.11.5 release. There are 135 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, 23 Oct 2024 10:22:25 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.11.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.11.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 6.11.5-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git commit: 96563e3507d7fd82e448c6803ed8e07bc6e5ec86
* git describe: v6.11.4-136-g96563e3507d7
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.11.y/build/v6.11.4-136-g96563e3507d7
## Test Regressions (compared to v6.11.3-213-g9e707bd5fc59)
## Metric Regressions (compared to v6.11.3-213-g9e707bd5fc59)
## Test Fixes (compared to v6.11.3-213-g9e707bd5fc59)
## Metric Fixes (compared to v6.11.3-213-g9e707bd5fc59)
## Test result summary
total: 140250, pass: 115901, fail: 1938, skip: 22411, xfail: 0
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 131 total, 129 passed, 2 failed
* arm64: 43 total, 43 passed, 0 failed
* i386: 18 total, 16 passed, 2 failed
* mips: 26 total, 25 passed, 1 failed
* parisc: 4 total, 4 passed, 0 failed
* powerpc: 36 total, 35 passed, 1 failed
* riscv: 16 total, 14 passed, 2 failed
* s390: 14 total, 13 passed, 1 failed
* sh: 5 total, 5 passed, 0 failed
* sparc: 4 total, 3 passed, 1 failed
* x86_64: 35 total, 35 passed, 0 failed
## Test suites summary
* boot
* commands
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-efivarfs
* kselftest-exec
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-filesystems-epoll
* kselftest-firmware
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-kcmp
* kselftest-kvm
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-mincore
* kselftest-mqueue
* kselftest-net
* kselftest-net-mptcp
* kselftest-openat2
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-rust
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-tc-testing
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user_events
* kselftest-vDSO
* kselftest-watchdog
* kselftest-x86
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-hugetlb
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* perf
* rcutorture
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.11.5 release. There are 135 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, 23 Oct 2024 10:22:25 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.11.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.11.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.11.5 release. There are 135 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, 23 Oct 2024 10:22:25 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.11.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.11.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 6.11.5 release. There are 135 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-6.11.y
6.6, 5.15 pass our testing, too:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-6.6.y
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-5.15.y
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.11.5 release. There are 135 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, 23 Oct 2024 10:22:25 +0000. Anything received after that time might be too late.
Hello Greg,
I have tested the 6.11.5-rc1 and saw that it still has the [iptables regression][0]. Since there already is a [fix pending][1] (I guess you are aware since you commented in the thread), it would be good to include it once it meets the stable criteria. Also while the issue sounds a bit harmless at first it breaks [tailscale routing][2] so it has a real world impact.
So I can't really sign off on this realease, but also everything besides the issue mentioned above seems to work!
Cheers,
Chris
[0]: https://lore.kernel.org/all/CANPzkXkRKf1a6ZvOJU=m3NwW4B0gQnQSRggw=ZnK6kBYmqLtBw@mail.gmail.com/
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://github.com/tailscale/tailscale/issues/13863
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.11.5 release. There are 135 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.11.5 release. There are 135 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, 23 Oct 2024 10:22:25 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.11.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.11.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v6.11:
10 builds: 10 pass, 0 fail
26 boots: 26 pass, 0 fail
116 tests: 116 pass, 0 failLinux version: 6.11.5-rc1-g96563e3507d7
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.11.5 release. There are 135 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, 23 Oct 2024 10:22:25 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.11.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.11.y
and the diffstat can be found below.
Quoted 5 lines
thanks,
greg k-h
-------------
Hi,
Please find the KernelCI report below :-
OVERVIEW
Builds: 25 passed, 0 failed
Boot tests: 76 passed, 0 failed
CI systems: maestro
REVISION
Commit
name:
hash: 96563e3507d7fd82e448c6803ed8e07bc6e5ec86
Checked out from
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.11.y
BUILDS
No new build failures found
BOOT TESTS
No new boot failures found
See complete and up-to-date report at:
https://kcidb.kernelci.org/d/revision/revision?orgId=1&var-datasource=edquppk2ghfcwc&var-git_commit_hash=96563e3507d7fd82e448c6803ed8e07bc6e5ec86&var-patchset_hash=&var-origin=maestro&var-build_architecture=All&var-build_config_name=All&var-test_path=boot
Thanks,
KernelCI team