6.4.5-rc1 review
Subsystems (9)
Greg Kroah-Hartman
maintainercover 6.4.5-rc1 review
This is the start of the stable review cycle for the 6.4.5 release. There are 292 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun, 23 Jul 2023 16:04:29 +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.4.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.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.4.5-rc1
Mario Limonciello <[email protected]>
Revert "drm/amd: Disable PSR-SU on Parade 0803 TCON"
Thomas Bogendoerfer <[email protected]>
MIPS: kvm: Fix build error with KVM_MIPS_DEBUG_COP0_COUNTERS enabled
Dan Carpenter <[email protected]>
net: dsa: ocelot: unlock on error in vsc9959_qos_port_tas_set()
Dan Carpenter <[email protected]>
scsi: qla2xxx: Fix end of loop test
Manish Rangankar <[email protected]>
scsi: qla2xxx: Remove unused nvme_ls_waitq wait queue
Shreyas Deodhar <[email protected]>
scsi: qla2xxx: Pointer may be dereferenced
Bikash Hazarika <[email protected]>
scsi: qla2xxx: Correct the index of array
Nilesh Javali <[email protected]>
scsi: qla2xxx: Check valid rport returned by fc_bsg_to_rport()
Bikash Hazarika <[email protected]>
scsi: qla2xxx: Fix potential NULL pointer dereference
Quinn Tran <[email protected]>
scsi: qla2xxx: Fix buffer overrun
Nilesh Javali <[email protected]>
scsi: qla2xxx: Avoid fcport pointer dereference
Nilesh Javali <[email protected]>
scsi: qla2xxx: Array index may go out of bound
Quinn Tran <[email protected]>
scsi: qla2xxx: Fix mem access after free
Quinn Tran <[email protected]>
scsi: qla2xxx: Wait for io return on terminate rport
Quinn Tran <[email protected]>
scsi: qla2xxx: Fix hang in task management
Quinn Tran <[email protected]>
scsi: qla2xxx: Fix task management cmd fail due to unavailable resource
Quinn Tran <[email protected]>
scsi: qla2xxx: Fix task management cmd failure
Quinn Tran <[email protected]>
scsi: qla2xxx: Multi-que support for TMF
Beau Belgrave <[email protected]>
tracing/user_events: Fix struct arg size match check
Masami Hiramatsu (Google) <[email protected]>
tracing/probes: Fix to record 0-length data_loc in fetch_store_string*() if fails
Masami Hiramatsu (Google) <[email protected]>
Revert "tracing: Add "(fault)" name injection to kernel probes"
Masami Hiramatsu (Google) <[email protected]>
tracing/probes: Fix to update dynamic data counter if fetcharg uses it
Masami Hiramatsu (Google) <[email protected]>
tracing/probes: Fix not to count error code to total length
Masami Hiramatsu (Google) <[email protected]>
tracing/probes: Fix to avoid double count of the string length on the array
Gustavo A. R. Silva <[email protected]>
smb: client: Fix -Wstringop-overflow issues
Matthieu Baerts <[email protected]>
selftests: mptcp: pm_nl_ctl: fix 32-bit support
Matthieu Baerts <[email protected]>
selftests: mptcp: depend on SYN_COOKIES
Matthieu Baerts <[email protected]>
selftests: mptcp: userspace_pm: report errors with 'remove' tests
Matthieu Baerts <[email protected]>
selftests: mptcp: userspace_pm: use correct server port
Matthieu Baerts <[email protected]>
selftests: mptcp: sockopt: return error if wrong mark
Matthieu Baerts <[email protected]>
selftests: mptcp: connect: fail if nft supposed to work
Matthieu Baerts <[email protected]>
selftests: mptcp: sockopt: use 'iptables-legacy' if available
Paolo Abeni <[email protected]>
mptcp: ensure subflow is unhashed before cleaning the backlog
Paolo Abeni <[email protected]>
mptcp: do not rely on implicit state check in mptcp_listen()
Mateusz Stachyra <[email protected]>
tracing: Fix null pointer dereference in tracing_err_log_open()
Masami Hiramatsu (Google) <[email protected]>
fprobe: Ensure running fprobe_exit_handler() finished before calling rethook_free()
Jiri Olsa <[email protected]>
fprobe: Release rethook after the ftrace_ops is unregistered
Karol Wachowski <[email protected]>
accel/ivpu: Clear specific interrupt status bits on C0
Karol Wachowski <[email protected]>
accel/ivpu: Fix VPU register access in irq disable
Heiner Kallweit <[email protected]>
pwm: meson: fix handling of period/duty if greater than UINT_MAX
Heiner Kallweit <[email protected]>
pwm: meson: modify and simplify calculation in meson_pwm_get_state
Chungkai Yang <[email protected]>
PM: QoS: Restore support for default value on frequency QoS
Namhyung Kim <[email protected]>
perf/x86: Fix lockdep warning in for_each_sibling_event() on SPR
Max Filippov <[email protected]>
xtensa: ISS: fix call to split_if_spec
Bharath SM <[email protected]>
cifs: if deferred close is disabled then close files immediately
Mario Limonciello <[email protected]>
drm/amd/pm: conditionally disable pcie lane/speed switching for SMU13
Evan Quan <[email protected]>
drm/amd/pm: share the code around SMU13 pcie parameters update
Zheng Yejian <[email protected]>
ftrace: Fix possible warning on checking all pages used in ftrace_process_locs()
Zheng Yejian <[email protected]>
ring-buffer: Fix deadloop issue on reading trace_pipe
Krister Johansen <[email protected]>
net: ena: fix shift-out-of-bounds in exponential backoff
Isaac J. Manjarres <[email protected]>
regmap-irq: Fix out-of-bounds access when allocating config buffers
Eric Lin <[email protected]>
perf: RISC-V: Remove PERF_HES_STOPPED flag checking in riscv_pmu_start()
Florent Revest <[email protected]>
samples: ftrace: Save required argument registers in sample trampolines
Christoph Hellwig <[email protected]>
nvme: don't reject probe due to duplicate IDs for single-ported PCIe devices
Zheng Yejian <[email protected]>
tracing: Fix memory leak of iter->temp when reading trace_pipe
Mohamed Khalfella <[email protected]>
tracing/histograms: Add histograms to hist_vars if they have referenced variables
Matthias Kaehlcke <[email protected]>
dm: verity-loadpin: Add NULL pointer check for 'bdev' parameter
Heiko Carstens <[email protected]>
s390/decompressor: fix misaligned symbol build error
Jonas Gorski <[email protected]>
bus: ixp4xx: fix IXP4XX_EXP_T1_MASK
Jiaqing Zhao <[email protected]>
Revert "8250: add support for ASIX devices with a FIFO bug"
Sakari Ailus <[email protected]>
media: uapi: Fix [GS]_ROUTING ACTIVE flag value
Krzysztof Kozlowski <[email protected]>
soundwire: qcom: fix storing port config out-of-bounds
Stephan Gerhold <[email protected]>
opp: Fix use-after-free in lazy_opp_tables after probe deferral
George Stark <[email protected]>
meson saradc: fix clock divider mask length
Weitao Wang <[email protected]>
xhci: Show ZHAOXIN xHCI root hub speed correctly
Weitao Wang <[email protected]>
xhci: Fix TRB prefetch issue of ZHAOXIN hosts
Weitao Wang <[email protected]>
xhci: Fix resume issue of some ZHAOXIN hosts
Oliver Upton <[email protected]>
arm64: errata: Mitigate Ampere1 erratum AC03_CPU_38 at stage-2
Yinjun Zhang <[email protected]>
nfp: clean mc addresses in application firmware when closing port
Xiubo Li <[email protected]>
ceph: don't let check_caps skip sending responses for revoke msgs
Xiubo Li <[email protected]>
ceph: fix blindly expanding the readahead windows
Xiubo Li <[email protected]>
ceph: add a dedicated private data for netfs rreq
Ilya Dryomov <[email protected]>
libceph: harden msgr2.1 frame segment length checks
Christophe JAILLET <[email protected]>
firmware: stratix10-svc: Fix a potential resource leak in svc_create_memory_pool()
Hui Li <[email protected]>
tty: fix hang on tty device with no_room set
Martin Fuzzey <[email protected]>
tty: serial: imx: fix rs485 rx after tx
Christophe JAILLET <[email protected]>
tty: serial: samsung_tty: Fix a memory leak in s3c24xx_serial_getclk() when iterating clk
Christophe JAILLET <[email protected]>
tty: serial: samsung_tty: Fix a memory leak in s3c24xx_serial_getclk() in case of error
Dan Carpenter <[email protected]>
serial: atmel: don't enable IRQs prematurely
Christian König <[email protected]>
drm/ttm: never consider pinned BOs for eviction&swap
Thomas Hellström <[email protected]>
drm/ttm: Don't leak a resource on swapout move error
Thomas Hellström <[email protected]>
drm/ttm: Don't leak a resource on eviction error
Yang Wang <[email protected]>
drm/amd/pm: fix smu i2c data read risk
gaba <[email protected]>
drm/amdgpu: avoid restore process run into dead loop.
Aurabindo Pillai <[email protected]>
drm/amd/display: Add monitor specific edid quirk
Mario Limonciello <[email protected]>
drm/amd/display: Correct DMUB_FW_VERSION macro
Ilya Bakoulin <[email protected]>
drm/amd/display: Fix 128b132b link loss handling
Sung-huai Wang <[email protected]>
drm/amd/display: add a NULL pointer check
Mario Limonciello <[email protected]>
drm/amd: Disable PSR-SU on Parade 0803 TCON
Samuel Pitoiset <[email protected]>
drm/amdgpu: fix clearing mappings for BOs that are always valid in VM
Leo Chen <[email protected]>
drm/amd/display: disable seamless boot if force_odm_combine is enabled
Austin Zheng <[email protected]>
drm/amd/display: Remove Phantom Pipe Check When Calculating K1 and K2
Hersen Wu <[email protected]>
drm/amd/display: edp do not add non-edid timings
Dmytro Laktyushkin <[email protected]>
drm/amd/display: fix seamless odm transitions
Alan Liu <[email protected]>
drm/amd/display: Fix in secure display context creation
Alvin Lee <[email protected]>
drm/amd/display: Limit DCN32 8 channel or less parts to DPM1 for FPO
Wayne Lin <[email protected]>
drm/dp_mst: Clear MSG_RDY flag before sending new message
Brian Norris <[email protected]>
drm/rockchip: vop: Leave vblank enabled in self-refresh
Brian Norris <[email protected]>
drm/atomic: Allow vblank-enabled + self-refresh "disable"
Justin Tee <[email protected]>
scsi: lpfc: Fix double free in lpfc_cmpl_els_logo_acc() caused by lpfc_nlp_not_used()
Alexander Aring <[email protected]>
fs: dlm: fix missing pending to false
Alexander Aring <[email protected]>
fs: dlm: clear pending bit when queue was empty
Alexander Aring <[email protected]>
fs: dlm: fix mismatch of plock results from userspace
Alexander Aring <[email protected]>
fs: dlm: make F_SETLK use unkillable wait_event
Alexander Aring <[email protected]>
fs: dlm: interrupt posix locks only when process is killed
Alexander Aring <[email protected]>
fs: dlm: fix cleanup pending ops when interrupted
Alexander Aring <[email protected]>
fs: dlm: return positive pid value for F_GETLK
Jason Baron <[email protected]>
md/raid0: add discard support for the 'original' layout
Johan Hovold <[email protected]>
mfd: pm8008: Fix module autoloading
Damien Le Moal <[email protected]>
misc: pci_endpoint_test: Re-init completion for every test
Damien Le Moal <[email protected]>
misc: pci_endpoint_test: Free IRQs before removing the device
Damien Le Moal <[email protected]>
PCI: rockchip: Set address alignment for endpoint mode
Rick Wertenbroek <[email protected]>
PCI: rockchip: Use u32 variable to access 32-bit registers
Rick Wertenbroek <[email protected]>
PCI: rockchip: Fix legacy IRQ generation for RK3399 PCIe endpoint core
Rick Wertenbroek <[email protected]>
PCI: rockchip: Add poll and timeout to wait for PHY PLLs to be locked
Rick Wertenbroek <[email protected]>
PCI: rockchip: Write PCI Device ID to correct register
Rick Wertenbroek <[email protected]>
PCI: rockchip: Assert PCI Configuration Enable bit after probe
Damien Le Moal <[email protected]>
PCI: epf-test: Fix DMA transfer completion detection
Damien Le Moal <[email protected]>
PCI: epf-test: Fix DMA transfer completion initialization
Manivannan Sadhasivam <[email protected]>
PCI: qcom: Disable write access to read only registers for IP v2.3.3
Igor Mammedov <[email protected]>
PCI: acpiphp: Reassign resources on bridge if necessary
Robin Murphy <[email protected]>
PCI: Add function 1 DMA alias quirk for Marvell 88SE9235
Ross Lagerwall <[email protected]>
PCI: Release resource invalidated by coalescing
Ondrej Zary <[email protected]>
PCI/PM: Avoid putting EloPOS E2/S2/H2 PCIe Ports in D3cold
Harald Freudenberger <[email protected]>
s390/zcrypt: do not retry administrative requests
Sathya Prakash <[email protected]>
scsi: mpi3mr: Propagate sense data for admin queue SCSI I/O
Mikulas Patocka <[email protected]>
dm integrity: reduce vmalloc space footprint on 32-bit architectures
Martin Kaiser <[email protected]>
hwrng: imx-rngc - fix the timeout for init and self check
Sinthu Raja <[email protected]>
arm64: dts: ti: k3-j721s2: Fix wkup pinmux range
Frank Wunderlich <[email protected]>
arm64: dts: mt7986: use size of reserved partition for bl2
Siddh Raman Pant <[email protected]>
jfs: jfs_dmap: Validate db_l2nbperpage while mounting
Ritesh Harjani (IBM) <[email protected]>
ext2/dax: Fix ext2_setsize when len is page aligned
Christian Marangi <[email protected]>
soc: qcom: mdt_loader: Fix unconditional call to scm_pas_mem_setup
David Woodhouse <[email protected]>
mm/mmap: Fix error return in do_vmi_align_munmap()
Alexander Aring <[email protected]>
fs: dlm: revert check required context while close
Baokun Li <[email protected]>
ext4: only update i_reserved_data_blocks on successful block allocation
Baokun Li <[email protected]>
ext4: turn quotas off if mount failed after enabling quotas
Chao Yu <[email protected]>
ext4: fix to check return value of freeze_bdev() in ext4_shutdown()
Theodore Ts'o <[email protected]>
ext4: avoid updating the superblock on a r/o mount if not needed
Kemeng Shi <[email protected]>
ext4: fix wrong unit use in ext4_mb_new_blocks
Kemeng Shi <[email protected]>
ext4: get block from bh in ext4_free_blocks for fast commit replay
Kemeng Shi <[email protected]>
ext4: fix wrong unit use in ext4_mb_clear_bb
Zhihao Cheng <[email protected]>
ext4: Fix reusing stale buffer heads from last failed mounting
Huacai Chen <[email protected]>
MIPS: KVM: Fix NULL pointer dereference
Huacai Chen <[email protected]>
MIPS: Loongson: Fix build error when make modules_install
Huacai Chen <[email protected]>
MIPS: Loongson: Fix cpu_probe_loongson() again
Jiaxun Yang <[email protected]>
MIPS: cpu-features: Use boot_cpu_type for CPU type based features
Hamza Mahfooz <[email protected]>
drm/amd/display: perform a bounds check before filling dirty rectangles
Michael Ellerman <[email protected]>
powerpc/64s: Fix native_hpte_remove() to be irq-safe
Michael Ellerman <[email protected]>
powerpc/security: Fix Speculation_Store_Bypass reporting on Power10
Ekansh Gupta <[email protected]>
misc: fastrpc: Create fastrpc scalar with correct buffer count
Naveen N Rao <[email protected]>
powerpc: Fail build if using recordmcount with binutils v2.37
sunliming <[email protected]>
tracing/user_events: Fix incorrect return value for writing operation when events are disabled
Andrey Konovalov <[email protected]>
kasan: fix type cast in memory_is_poisoned_n
Andrey Konovalov <[email protected]>
kasan, slub: fix HW_TAGS zeroing with slub_debug
Arnd Bergmann <[email protected]>
kasan: use internal prototypes matching gcc-13 builtins
Arnd Bergmann <[email protected]>
kasan: add kasan_tag_mismatch prototype
Oleksij Rempel <[email protected]>
net: phy: dp83td510: fix kernel stall during netboot in DP83TD510E PHY driver
Florian Fainelli <[email protected]>
net: bcmgenet: Ensure MDIO unregistration has clocks enabled
Arseniy Krasnov <[email protected]>
mtd: rawnand: meson: fix unaligned DMA buffers handling
Florian Bezdeka <[email protected]>
tpm/tpm_tis: Disable interrupts for Lenovo L590 devices
Lino Sanfilippo <[email protected]>
tpm,tpm_tis: Disable interrupts after 1000 unhandled IRQs
Christian Hesse <[email protected]>
tpm/tpm_tis: Disable interrupts for Framework Laptop Intel 13th gen
Jerry Snitselaar <[email protected]>
tpm: return false from tpm_amd_is_rng_defective on non-x86 platforms
Alexander Sverdlin <[email protected]>
tpm: tis_i2c: Limit write bursts to I2C_SMBUS_BLOCK_MAX (32) bytes
Christian Hesse <[email protected]>
tpm/tpm_tis: Disable interrupts for Framework Laptop Intel 12th gen
Alexander Sverdlin <[email protected]>
tpm: tis_i2c: Limit read bursts to I2C_SMBUS_BLOCK_MAX (32) bytes
Peter Ujfalusi <[email protected]>
tpm: tpm_tis: Disable interrupts *only* for AEON UPX-i11
Jarkko Sakkinen <[email protected]>
tpm: tpm_vtpm_proxy: fix a race condition in /dev/vtpmx creation
Valentin David <[email protected]>
tpm: Do not remap from ACPI resources again for Pluton TPM
Mario Limonciello <[email protected]>
pinctrl: amd: Unify debounce handling into amd_pinconf_set()
Mario Limonciello <[email protected]>
pinctrl: amd: Drop pull up select configuration
Mario Limonciello <[email protected]>
pinctrl: amd: Use amd_pinconf_set() for all config options
Mario Limonciello <[email protected]>
pinctrl: amd: Only use special debounce behavior for GPIO 0
Mario Limonciello <[email protected]>
pinctrl: amd: Revert "pinctrl: amd: disable and mask interrupts on probe"
Kornel Dulęba <[email protected]>
pinctrl: amd: Detect and mask spurious interrupts
Mario Limonciello <[email protected]>
pinctrl: amd: Fix mistake in handling clearing pins at startup
Mario Limonciello <[email protected]>
pinctrl: amd: Detect internal GPIO0 debounce handling
Masahiro Yamada <[email protected]>
kbuild: make modules_install copy modules.builtin(.modinfo)
Jaegeuk Kim <[email protected]>
f2fs: fix deadlock in i_xattr_sem and inode page lock
Chao Yu <[email protected]>
f2fs: don't reset unchangable mount option in f2fs_remount()
Thomas Zimmermann <[email protected]>
drm/client: Send hotplug event after registering a client
Paulo Alcantara <[email protected]>
smb: client: fix parsing of source mount option
Winston Wen <[email protected]>
cifs: fix session state check in smb2_find_smb_ses
Paulo Alcantara <[email protected]>
smb: client: improve DFS mount check
Ming Lei <[email protected]>
nvme-pci: fix DMA direction of unmapping integrity data
Pedro Tammela <[email protected]>
net/sched: sch_qfq: account for stab overhead in qfq_enqueue
Pedro Tammela <[email protected]>
net/sched: sch_qfq: reintroduce lmax bound check for MTU
Zhang Shurong <[email protected]>
wifi: rtw89: debug: fix error code in rtw89_debug_priv_send_h2c_set()
Jiawen Wu <[email protected]>
net: txgbe: fix eeprom calculation error
Pedro Tammela <[email protected]>
net/sched: make psched_mtu() RTNL-less safe
Karol Herbst <[email protected]>
drm/nouveau: bring back blit subchannel for pre nv50 GPUs
Karol Herbst <[email protected]>
drm/nouveau/acr: Abort loading ACR if no firmware was found
Dan Carpenter <[email protected]>
netdevsim: fix uninitialized data in nsim_dev_trap_fa_cookie_write()
Karol Herbst <[email protected]>
drm/nouveau/disp/g94: enable HDMI
Karol Herbst <[email protected]>
drm/nouveau/disp: fix HDMI on gt215+
Jisheng Zhang <[email protected]>
riscv: mm: fix truncation warning on RV32
Ido Schimmel <[email protected]>
net/sched: flower: Ensure both minimum and maximum ports are specified
Larysa Zaremba <[email protected]>
xdp: use trusted arguments in XDP hints kfuncs
Pu Lehui <[email protected]>
bpf: cpumap: Fix memory leak in cpu_map_update_elem
Randy Dunlap <[email protected]>
wifi: airo: avoid uninitialized warning in airo_get_rate()
Xin Yin <[email protected]>
erofs: fix fsdax unavailability for chunk-based regular files
Chunhai Guo <[email protected]>
erofs: avoid infinite loop in z_erofs_do_read_page() when reading beyond EOF
Chunhai Guo <[email protected]>
erofs: avoid useless loops in z_erofs_pcluster_readmore() when reading beyond EOF
Suman Ghosh <[email protected]>
octeontx2-pf: Add additional check for MCAM rules
Lu Hongfei <[email protected]>
net: dsa: Removed unneeded of_node_put in felix_parse_ports_node
Tvrtko Ursulin <[email protected]>
drm/i915: Fix one wrong caching mode enum usage
Stanislav Lisovskiy <[email protected]>
drm/i915: Don't preserve dpll_hw_state for slave crtc in Bigjoiner
Wei Fang <[email protected]>
net: fec: increase the size of tx ring and update tx_wake_threshold
Wei Fang <[email protected]>
net: fec: recycle pages for transmitted XDP frames
Wei Fang <[email protected]>
net: fec: remove last_bdp from fec_enet_txq_xmit_frame()
Wei Fang <[email protected]>
net: fec: remove useless fec_enet_reset_skb()
Björn Töpel <[email protected]>
riscv, bpf: Fix inconsistent JIT image generation
Stafford Horne <[email protected]>
openrisc: Union fpcsr and oldmask in sigcontext to unbreak userspace ABI
Ankit Kumar <[email protected]>
nvme: fix the NVME_ID_NS_NVM_STS_MASK definition
Florian Kauer <[email protected]>
igc: Fix inserting of empty frame for launchtime
Florian Kauer <[email protected]>
igc: Fix launchtime before start of cycle
Florian Kauer <[email protected]>
igc: No strict mode in pure launchtime/CBS offload
Ze Gao <[email protected]>
fprobe: add unlock to match a succeeded ftrace_test_recursion_trylock
Tzvetomir Stoyanov (VMware) <[email protected]>
kernel/trace: Fix cleanup logic of enable_trace_eprobe
Florian Kauer <[email protected]>
igc: Handle already enabled taprio offload for basetime 0
Florian Kauer <[email protected]>
igc: Do not enable taprio offload for invalid arguments
Florian Kauer <[email protected]>
igc: Rename qbv_enable to taprio_offload_enable
Vladimir Oltean <[email protected]>
net/sched: taprio: replace tc_taprio_qopt_offload :: enable with a "cmd" enum
Andy Shevchenko <[email protected]>
platform/x86: wmi: Break possible infinite loop when parsing GUID
Peter Zijlstra <[email protected]>
x86/fineibt: Poison ENDBR at +0
Jiasheng Jiang <[email protected]>
net: dsa: qca8k: Add check for skb_copy
Arnd Bergmann <[email protected]>
HID: hyperv: avoid struct memcpy overrun warning
Ziyang Xuan <[email protected]>
ipv6/addrconf: fix a potential refcount underflow for idev
Jiasheng Jiang <[email protected]>
NTB: ntb_tool: Add check for devm_kcalloc
Yang Yingliang <[email protected]>
NTB: ntb_transport: fix possible memory leak while device_register() fails
Yuan Can <[email protected]>
ntb: intel: Fix error handling in intel_ntb_pci_driver_init()
Yuan Can <[email protected]>
NTB: amd: Fix error handling in amd_ntb_pci_driver_init()
Yuan Can <[email protected]>
ntb: idt: Fix error handling in idt_pci_driver_init()
Eric Dumazet <[email protected]>
udp6: fix udp6_ehashfn() typo
Kuniyuki Iwashima <[email protected]>
icmp6: Fix null-ptr-deref of ip6_null_entry->rt6i_idev in icmp6_dev().
Niklas Schnelle <[email protected]>
s390/ism: Do not unregister clients with registered DMBs
Niklas Schnelle <[email protected]>
s390/ism: Fix and simplify add()/remove() callback handling
Niklas Schnelle <[email protected]>
s390/ism: Fix locking for forwarding of IRQs and events to clients
Paolo Abeni <[email protected]>
net: prevent skb corruption on frag list segmentation
Rafał Miłecki <[email protected]>
net: bgmac: postpone turning IRQs off to avoid SoC hangs
Ivan Babrou <[email protected]>
udp6: add a missing call into udp_fail_queue_rcv_skb tracepoint
Nitya Sunkad <[email protected]>
ionic: remove WARN_ON to prevent panic_on_warn
Sai Krishna <[email protected]>
octeontx2-af: Move validation of ptp pointer before its usage
Ratheesh Kannoth <[email protected]>
octeontx2-af: Promisc enable/disable through mbox
Geert Uytterhoeven <[email protected]>
drm/fbdev-dma: Fix documented default preferred_bpp value
Junfeng Guo <[email protected]>
gve: Set default duplex configuration to full
M A Ramdhan <[email protected]>
net/sched: cls_fw: Fix improper refcount update leads to use-after-free
Vladimir Oltean <[email protected]>
net: mscc: ocelot: fix oversize frame dropping for preemptible TCs
Vladimir Oltean <[email protected]>
net: dsa: felix: make vsc9959_tas_guard_bands_update() visible to ocelot->ops
Klaus Kudielka <[email protected]>
net: mvneta: fix txq_map in case of txq_number==1
Kumar Kartikeya Dwivedi <[email protected]>
bpf: Fix max stack depth check for async callbacks
Randy Dunlap <[email protected]>
scsi: ufs: ufs-mediatek: Add dependency for RESET_CONTROLLER
Dan Carpenter <[email protected]>
scsi: qla2xxx: Fix error code in qla2x00_start_sp()
Eric Biggers <[email protected]>
blk-crypto: use dynamic lock class for blk_crypto_profile::lock
Aravindhan Gunasekaran <[email protected]>
igc: Handle PPS start time programming for past time values
Tan Tee Min <[email protected]>
igc: Include the length/type field and VLAN tag in queueMaxSDU
Prasad Koya <[email protected]>
igc: set TP bit in 'supported' and 'advertising' fields of ethtool_link_ksettings
Dragos Tatulea <[email protected]>
net/mlx5e: RX, Fix page_pool page fragment tracking for XDP
Maher Sanalla <[email protected]>
net/mlx5: Query hca_cap_2 only when supported
Yevgeny Kliteynik <[email protected]>
net/mlx5e: TC, CT: Offload ct clear only once
Vlad Buslov <[email protected]>
net/mlx5e: Check for NOT_READY flag state after locking
Saeed Mahameed <[email protected]>
net/mlx5: Register a unique thermal zone per device
Dragos Tatulea <[email protected]>
net/mlx5e: RX, Fix flush and close release flow of regular rq for legacy rq
Zhengchao Shao <[email protected]>
net/mlx5e: fix memory leak in mlx5e_ptp_open
Zhengchao Shao <[email protected]>
net/mlx5e: fix memory leak in mlx5e_fs_tt_redirect_any_create
Zhengchao Shao <[email protected]>
net/mlx5e: fix double free in mlx5e_destroy_flow_table
Muhammad Husaini Zulkifli <[email protected]>
igc: Fix TX Hang issue when QBV Gate is closed
Jesper Dangaard Brouer <[email protected]>
igc: Add XDP hints kfuncs for RX hash
Jesper Dangaard Brouer <[email protected]>
igc: Add igc_xdp_buff wrapper for xdp_buff in driver
Muhammad Husaini Zulkifli <[email protected]>
igc: Remove delay during TX ring configuration
Muhammad Husaini Zulkifli <[email protected]>
igc: Add condition for qbv_config_change_errors counter
Sridhar Samudrala <[email protected]>
ice: Fix tx queue rate limit when TCs are configured
Sridhar Samudrala <[email protected]>
ice: Fix max_rate check while configuring TX rate limits
Florian Westphal <[email protected]>
netfilter: conntrack: don't fold port numbers into addresses before hashing
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: report use refcount overflow
Petr Pavlu <[email protected]>
xen/virtio: Fix NULL deref when a bridge of PCI root bus has no parent
Marek Vasut <[email protected]>
drm/panel: simple: Add Powertip PH800480T013 drm_display_mode flags
Petr Tesarik <[email protected]>
swiotlb: reduce the number of areas to match actual memory pool size
Petr Tesarik <[email protected]>
swiotlb: always set the number of areas before allocating the pool
Douglas Anderson <[email protected]>
drm/bridge: ti-sn65dsi86: Fix auxiliary bus lifetime
Adrián Larumbe <[email protected]>
drm: bridge: dw_hdmi: fix connector access for scdc
Fabio Estevam <[email protected]>
drm/panel: simple: Add connector_type for innolux_at043tn24
Namjae Jeon <[email protected]>
ksmbd: fix out of bounds read in smb2_sess_setup
Namjae Jeon <[email protected]>
ksmbd: add missing compound request handing in some commands
Simon Horman <[email protected]>
net: lan743x: select FIXED_PHY
Moritz Fischer <[email protected]>
net: lan743x: Don't sleep in atomic context
Basavaraj Natikar <[email protected]>
HID: amd_sfh: Fix for shift-out-of-bounds
Basavaraj Natikar <[email protected]>
HID: amd_sfh: Rename the float32 variable
Dmitry Torokhov <[email protected]>
HID: input: fix mapping for camera access keys
Nayna Jain <[email protected]>
security/integrity: fix pointer to ESL data and its size on pseries
Ivan Mikhaylov <[email protected]>
net/ncsi: change from ndo_set_mac_address to dev_set_mac_address
-------------
Diffstat:
Documentation/arm64/silicon-errata.rst | 3 + .../media/v4l/vidioc-subdev-g-routing.rst | 2 +- Makefile | 30 ++- arch/arm64/Kconfig | 19 ++ .../dts/mediatek/mt7986a-bananapi-bpi-r3-nor.dtso | 7 +- arch/arm64/boot/dts/ti/k3-am68-sk-base-board.dts | 42 ++-- .../boot/dts/ti/k3-j721s2-common-proc-board.dts | 76 +++--- arch/arm64/boot/dts/ti/k3-j721s2-mcu-wakeup.dtsi | 29 ++- arch/arm64/kernel/cpu_errata.c | 7 + arch/arm64/kernel/traps.c | 2 +- arch/arm64/kvm/hyp/pgtable.c | 14 +- arch/arm64/mm/fault.c | 2 +- arch/arm64/tools/cpucaps | 1 + arch/mips/Makefile | 10 +- arch/mips/include/asm/cpu-features.h | 4 +- arch/mips/include/asm/kvm_host.h | 6 +- arch/mips/kernel/cpu-probe.c | 9 +- arch/mips/kvm/emulate.c | 22 +- arch/mips/kvm/mips.c | 16 +- arch/mips/kvm/stats.c | 4 +- arch/mips/kvm/trace.h | 8 +- arch/mips/kvm/vz.c | 20 +- arch/openrisc/include/uapi/asm/sigcontext.h | 6 +- arch/openrisc/kernel/signal.c | 4 +- arch/powerpc/Makefile | 8 + arch/powerpc/kernel/security.c | 37 +-- arch/powerpc/mm/book3s64/hash_native.c | 13 +- arch/riscv/mm/init.c | 2 +- arch/riscv/net/bpf_jit.h | 6 +- arch/riscv/net/bpf_jit_core.c | 19 +- arch/s390/Makefile | 1 + arch/x86/events/intel/core.c | 7 + arch/x86/kernel/alternative.c | 16 ++ arch/xtensa/platforms/iss/network.c | 2 +- block/blk-crypto-profile.c | 12 +- drivers/accel/ivpu/ivpu_drv.h | 1 + drivers/accel/ivpu/ivpu_hw_mtl.c | 20 +- drivers/base/regmap/regmap-irq.c | 2 +- drivers/bus/intel-ixp4xx-eb.c | 2 +- drivers/char/hw_random/imx-rngc.c | 6 +- drivers/char/tpm/tpm-chip.c | 7 + drivers/char/tpm/tpm_crb.c | 19 +- drivers/char/tpm/tpm_tis.c | 25 ++ drivers/char/tpm/tpm_tis_core.c | 103 ++++++-- drivers/char/tpm/tpm_tis_core.h | 4 + drivers/char/tpm/tpm_tis_i2c.c | 59 +++-- drivers/char/tpm/tpm_vtpm_proxy.c | 30 +-- drivers/firmware/stratix10-svc.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 12 + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 64 ++--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.h | 2 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 26 +++ drivers/gpu/drm/amd/display/dc/core/dc.c | 3 + .../drm/amd/display/dc/dce112/dce112_resource.c | 10 +- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 11 + drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c | 4 - drivers/gpu/drm/amd/display/dc/dcn32/dcn32_optc.c | 2 +- drivers/gpu/drm/amd/display/dc/dcn32/dcn32_optc.h | 1 + .../gpu/drm/amd/display/dc/dcn32/dcn32_resource.c | 2 + .../gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 15 ++ .../gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.h | 2 + .../dc/link/protocols/link_dp_irq_handler.c | 11 +- drivers/gpu/drm/amd/display/dmub/dmub_srv.h | 2 +- drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h | 4 + drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 2 +- drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 2 +- .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 2 +- drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 2 +- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 67 ++++++ .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 35 +-- .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 2 +- .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 33 +-- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 9 +- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 35 +-- drivers/gpu/drm/display/drm_dp_mst_topology.c | 54 ++++- drivers/gpu/drm/drm_atomic_helper.c | 11 +- drivers/gpu/drm/drm_client.c | 21 ++ drivers/gpu/drm/drm_fbdev_dma.c | 6 +- drivers/gpu/drm/drm_fbdev_generic.c | 4 - drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 4 - drivers/gpu/drm/gma500/fbdev.c | 4 - drivers/gpu/drm/i915/display/intel_display.c | 1 - drivers/gpu/drm/i915/display/intel_dp.c | 7 +- drivers/gpu/drm/i915/gt/intel_gtt.c | 2 +- drivers/gpu/drm/msm/msm_fbdev.c | 4 - drivers/gpu/drm/nouveau/dispnv50/disp.c | 12 +- drivers/gpu/drm/nouveau/nouveau_chan.c | 1 + drivers/gpu/drm/nouveau/nouveau_chan.h | 1 + drivers/gpu/drm/nouveau/nouveau_drm.c | 20 +- drivers/gpu/drm/nouveau/nvkm/engine/disp/g94.c | 1 + drivers/gpu/drm/nouveau/nvkm/engine/disp/gt215.c | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c | 2 +- drivers/gpu/drm/omapdrm/omap_fbdev.c | 4 - drivers/gpu/drm/panel/panel-simple.c | 2 + drivers/gpu/drm/radeon/radeon_fbdev.c | 4 - drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 8 +- drivers/gpu/drm/tegra/fbdev.c | 4 - drivers/gpu/drm/ttm/ttm_bo.c | 29 ++- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c | 30 ++- drivers/hid/hid-hyperv.c | 10 +- drivers/hid/hid-input.c | 7 +- drivers/iio/adc/meson_saradc.c | 2 +- drivers/md/dm-integrity.c | 4 +- drivers/md/dm-verity-loadpin.c | 3 + drivers/md/raid0.c | 62 ++++- drivers/md/raid0.h | 1 + drivers/mfd/qcom-pm8008.c | 1 + drivers/misc/fastrpc.c | 2 +- drivers/misc/pci_endpoint_test.c | 10 +- drivers/mtd/nand/raw/meson_nand.c | 4 + drivers/net/dsa/hirschmann/hellcreek.c | 14 +- drivers/net/dsa/ocelot/felix.c | 6 +- drivers/net/dsa/ocelot/felix.h | 1 - drivers/net/dsa/ocelot/felix_vsc9959.c | 28 ++- drivers/net/dsa/qca/qca8k-8xxx.c | 3 + drivers/net/dsa/sja1105/sja1105_tas.c | 7 +- drivers/net/ethernet/amazon/ena/ena_com.c | 3 + drivers/net/ethernet/broadcom/bgmac.c | 4 +- drivers/net/ethernet/broadcom/genet/bcmmii.c | 2 + drivers/net/ethernet/engleder/tsnep_selftests.c | 12 +- drivers/net/ethernet/engleder/tsnep_tc.c | 4 +- drivers/net/ethernet/freescale/enetc/enetc_qos.c | 6 +- drivers/net/ethernet/freescale/fec.h | 17 +- drivers/net/ethernet/freescale/fec_main.c | 178 ++++++++------ drivers/net/ethernet/google/gve/gve_ethtool.c | 3 + drivers/net/ethernet/intel/ice/ice_main.c | 23 +- drivers/net/ethernet/intel/ice/ice_tc_lib.c | 22 +- drivers/net/ethernet/intel/ice/ice_tc_lib.h | 1 + drivers/net/ethernet/intel/igc/igc.h | 15 +- drivers/net/ethernet/intel/igc/igc_ethtool.c | 2 + drivers/net/ethernet/intel/igc/igc_main.c | 158 ++++++++++--- drivers/net/ethernet/intel/igc/igc_ptp.c | 25 +- drivers/net/ethernet/intel/igc/igc_tsn.c | 68 ++++-- drivers/net/ethernet/marvell/mvneta.c | 4 +- drivers/net/ethernet/marvell/octeontx2/af/ptp.c | 19 +- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 2 +- .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 11 +- .../ethernet/marvell/octeontx2/af/rvu_npc_hash.c | 23 +- .../ethernet/marvell/octeontx2/nic/otx2_flows.c | 8 + .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 15 ++ .../mellanox/mlx5/core/en/fs_tt_redirect.c | 6 +- drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c | 6 +- drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 14 +- drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c | 3 +- .../ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 44 ++-- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 6 +- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 3 + drivers/net/ethernet/mellanox/mlx5/core/thermal.c | 19 +- drivers/net/ethernet/microchip/Kconfig | 2 +- drivers/net/ethernet/microchip/lan743x_main.c | 21 +- .../net/ethernet/microchip/lan966x/lan966x_tc.c | 10 +- drivers/net/ethernet/mscc/ocelot_mm.c | 7 +- .../net/ethernet/netronome/nfp/nfp_net_common.c | 5 + drivers/net/ethernet/pensando/ionic/ionic_lif.c | 5 - drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 7 +- drivers/net/ethernet/ti/am65-cpsw-qos.c | 11 +- drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c | 3 - drivers/net/netdevsim/dev.c | 9 +- drivers/net/phy/dp83td510.c | 23 +- drivers/net/wireless/cisco/airo.c | 5 +- drivers/net/wireless/realtek/rtw89/debug.c | 5 +- drivers/ntb/hw/amd/ntb_hw_amd.c | 7 +- drivers/ntb/hw/idt/ntb_hw_idt.c | 7 +- drivers/ntb/hw/intel/ntb_hw_gen1.c | 7 +- drivers/ntb/ntb_transport.c | 2 +- drivers/ntb/test/ntb_tool.c | 2 + drivers/nvme/host/core.c | 36 ++- drivers/nvme/host/pci.c | 2 +- drivers/opp/core.c | 3 + drivers/pci/controller/dwc/pcie-qcom.c | 2 + drivers/pci/controller/pcie-rockchip-ep.c | 65 ++---- drivers/pci/controller/pcie-rockchip.c | 17 ++ drivers/pci/controller/pcie-rockchip.h | 11 +- drivers/pci/endpoint/functions/pci-epf-test.c | 40 +++- drivers/pci/hotplug/acpiphp_glue.c | 5 +- drivers/pci/pci.c | 10 +- drivers/pci/probe.c | 4 +- drivers/pci/quirks.c | 2 + drivers/perf/riscv_pmu.c | 3 - drivers/pinctrl/pinctrl-amd.c | 103 +++----- drivers/pinctrl/pinctrl-amd.h | 2 +- drivers/platform/x86/wmi.c | 22 +- drivers/pwm/pwm-meson.c | 28 +-- drivers/s390/crypto/zcrypt_msgtype6.c | 6 + drivers/s390/net/ism_drv.c | 139 ++++++----- drivers/scsi/lpfc/lpfc_crtn.h | 1 - drivers/scsi/lpfc/lpfc_els.c | 30 +-- drivers/scsi/lpfc/lpfc_hbadisc.c | 24 +- drivers/scsi/mpi3mr/mpi3mr_fw.c | 5 + drivers/scsi/qla2xxx/qla_attr.c | 13 ++ drivers/scsi/qla2xxx/qla_bsg.c | 6 + drivers/scsi/qla2xxx/qla_def.h | 22 +- drivers/scsi/qla2xxx/qla_edif.c | 4 +- drivers/scsi/qla2xxx/qla_gbl.h | 2 +- drivers/scsi/qla2xxx/qla_init.c | 258 +++++++++++++++++++-- drivers/scsi/qla2xxx/qla_inline.h | 5 +- drivers/scsi/qla2xxx/qla_iocb.c | 38 ++- drivers/scsi/qla2xxx/qla_isr.c | 64 ++++- drivers/scsi/qla2xxx/qla_nvme.c | 3 - drivers/scsi/qla2xxx/qla_os.c | 133 ++++++----- drivers/soc/qcom/mdt_loader.c | 16 +- drivers/soundwire/qcom.c | 3 +- drivers/tty/n_tty.c | 25 +- drivers/tty/serial/8250/8250.h | 1 - drivers/tty/serial/8250/8250_pci.c | 19 -- drivers/tty/serial/8250/8250_port.c | 11 +- drivers/tty/serial/atmel_serial.c | 4 +- drivers/tty/serial/imx.c | 18 +- drivers/tty/serial/samsung_tty.c | 14 +- drivers/ufs/host/Kconfig | 1 + drivers/usb/host/xhci-mem.c | 39 +++- drivers/usb/host/xhci-pci.c | 12 + drivers/usb/host/xhci.h | 2 + drivers/xen/grant-dma-ops.c | 2 + fs/ceph/addr.c | 85 +++++-- fs/ceph/caps.c | 9 + fs/ceph/super.h | 13 ++ fs/dlm/ast.c | 8 +- fs/dlm/lockspace.c | 12 - fs/dlm/lockspace.h | 1 - fs/dlm/lowcomms.c | 1 + fs/dlm/midcomms.c | 3 - fs/dlm/plock.c | 115 +++++---- fs/erofs/inode.c | 3 +- fs/erofs/zdata.c | 4 +- fs/ext2/inode.c | 5 +- fs/ext4/indirect.c | 8 + fs/ext4/inode.c | 10 - fs/ext4/ioctl.c | 5 +- fs/ext4/mballoc.c | 17 +- fs/ext4/super.c | 31 ++- fs/f2fs/dir.c | 9 +- fs/f2fs/super.c | 30 ++- fs/f2fs/xattr.c | 6 +- fs/jfs/jfs_dmap.c | 6 + fs/jfs/jfs_filsys.h | 2 + fs/smb/client/cifs_dfs_ref.c | 20 +- fs/smb/client/cifsproto.h | 2 + fs/smb/client/cifssmb.c | 2 +- fs/smb/client/dfs.c | 43 +--- fs/smb/client/file.c | 4 +- fs/smb/client/fs_context.c | 59 ++++- fs/smb/client/misc.c | 17 +- fs/smb/client/smb2transport.c | 7 + fs/smb/server/smb2pdu.c | 109 +++++---- include/drm/display/drm_dp_mst_helper.h | 7 +- include/linux/blk-crypto-profile.h | 1 + include/linux/ism.h | 7 +- include/linux/kasan.h | 2 +- include/linux/nvme.h | 2 +- include/linux/rethook.h | 1 + include/linux/serial_8250.h | 1 - include/net/netfilter/nf_conntrack_tuple.h | 3 + include/net/netfilter/nf_tables.h | 31 ++- include/net/pkt_sched.h | 9 +- include/soc/mscc/ocelot.h | 1 + kernel/bpf/cpumap.c | 40 ++-- kernel/bpf/verifier.c | 5 +- kernel/dma/swiotlb.c | 46 +++- kernel/power/qos.c | 9 +- kernel/trace/fprobe.c | 15 +- kernel/trace/ftrace.c | 45 ++-- kernel/trace/rethook.c | 13 ++ kernel/trace/ring_buffer.c | 24 +- kernel/trace/trace.c | 3 +- kernel/trace/trace.h | 2 + kernel/trace/trace_eprobe.c | 18 +- kernel/trace/trace_events_hist.c | 8 +- kernel/trace/trace_events_user.c | 6 +- kernel/trace/trace_probe.c | 2 +- kernel/trace/trace_probe_kernel.h | 30 +-- kernel/trace/trace_probe_tmpl.h | 10 +- kernel/trace/trace_uprobe.c | 3 +- mm/kasan/common.c | 2 +- mm/kasan/generic.c | 73 +++--- mm/kasan/kasan.h | 171 +++++++------- mm/kasan/report.c | 17 +- mm/kasan/report_generic.c | 12 +- mm/kasan/report_hw_tags.c | 2 +- mm/kasan/report_sw_tags.c | 2 +- mm/kasan/shadow.c | 36 +-- mm/kasan/sw_tags.c | 20 +- mm/mmap.c | 9 +- mm/slab.h | 16 +- net/ceph/messenger_v2.c | 41 ++-- net/core/net-traces.c | 2 + net/core/skbuff.c | 5 + net/core/xdp.c | 2 +- net/ipv6/addrconf.c | 3 +- net/ipv6/icmp.c | 5 +- net/ipv6/udp.c | 4 +- net/mptcp/protocol.c | 7 +- net/ncsi/ncsi-rsp.c | 5 +- net/netfilter/nf_conntrack_core.c | 20 +- net/netfilter/nf_tables_api.c | 163 ++++++++----- net/netfilter/nft_flow_offload.c | 6 +- net/netfilter/nft_immediate.c | 8 +- net/netfilter/nft_objref.c | 8 +- net/sched/cls_flower.c | 10 + net/sched/cls_fw.c | 10 +- net/sched/sch_qfq.c | 18 +- net/sched/sch_taprio.c | 4 +- samples/ftrace/ftrace-direct-too.c | 14 +- security/integrity/platform_certs/load_powerpc.c | 40 ++-- tools/testing/selftests/net/mptcp/config | 1 + tools/testing/selftests/net/mptcp/mptcp_connect.sh | 3 + tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 29 +-- tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 10 +- tools/testing/selftests/net/mptcp/userspace_pm.sh | 4 +- 312 files changed, 3504 insertions(+), 1921 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/292 net/ncsi: change from ndo_set_mac_address to dev_set_mac_address
From: Ivan Mikhaylov <[email protected]>
commit 790071347a0a1a89e618eedcd51c687ea783aeb3 upstream.
Change ndo_set_mac_address to dev_set_mac_address because dev_set_mac_address provides a way to notify network layer about MAC change. In other case, services may not aware about MAC change and keep using old one which set from network adapter driver.
As example, DHCP client from systemd do not update MAC address without notification from net subsystem which leads to the problem with acquiring the right address from DHCP server.
--- net/ncsi/ncsi-rsp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/ncsi/ncsi-rsp.c +3 -2
@@ -616,7 +616,6 @@ static int ncsi_rsp_handler_oem_mlx_gma( {struct ncsi_dev_priv *ndp = nr->ndp;struct net_device *ndev = ndp->ndev.dev; -const struct net_device_ops *ops = ndev->netdev_ops;struct ncsi_rsp_oem_pkt *rsp;struct sockaddr saddr;int ret =0 ;
@@ -630,7 +629,9 @@ static int ncsi_rsp_handler_oem_mlx_gma(/* Set the flag for GMA command which should only be called once */ ndp->gma_flag =1 ; - ret = ops->ndo_set_mac_address (ndev, &saddr); +rtnl_lock (); + ret =dev_set_mac_address (ndev, &saddr,NULL ); +rtnl_unlock ();if (ret <0 )netdev_warn (ndev,"NCSI: 'Writing mac address to device failed\n" );
Greg Kroah-Hartman
maintainerPATCH 2/292 security/integrity: fix pointer to ESL data and its size on pseries
In reply to Greg Kroah-HartmanFrom: Nayna Jain <[email protected]>
commit e66effaf61ffb1dc6088492ca3a0e98dcbf1c10d upstream.
On PowerVM guest, variable data is prefixed with 8 bytes of timestamp. Extract ESL by stripping off the timestamp before passing to ESL parser.
--- .../integrity/platform_certs/load_powerpc.c | 40 ++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-)
security/integrity/platform_certs/load_powerpc.c +26 -14
@@ -15,6 +15,9 @@#include "keyring_handler.h" #include "../integrity.h" +#define extract_esl (db, data, size, offset) \ + do { db = data + offset; size = size - offset; } while (0) +/* * Get a certificate list blob from the named secure variable. *
@@ -55,8 +58,9 @@ static __init void *get_cert_list(u8 *key, unsigned long keylen, u64 *size)*/ static int __init load_powerpc_certs (void ) { -void *db =NULL , *dbx =NULL ; -u64 dbsize =0 , dbxsize =0 ; +void *db =NULL , *dbx =NULL , *data =NULL ; +u64 dsize =0 ; +u64 offset =0 ;int rc =0 ;ssize_t len;char buf[32 ];
@@ -74,38 +78,46 @@ static int __init load_powerpc_certs(void)return -ENODEV ; } +if (strcmp ("ibm,plpks-sb-v1" , buf) ==0 ) +/* PLPKS authenticated variables ESL data is prefixed with 8 bytes of timestamp */ + offset =8 ; +/* * Get db, and dbx. They might not exist, so it isn't an error if we * can't get them. */ - db =get_cert_list ("db" ,3 , &dbsize); -if (!db) { + data =get_cert_list ("db" ,3 , &dsize); +if (!data) {pr_info ("Couldn't get db list from firmware\n" ); - }else if (IS_ERR (db)) { - rc =PTR_ERR (db); + }else if (IS_ERR (data)) { + rc =PTR_ERR (data);pr_err ("Error reading db from firmware: %d\n" , rc);return rc; }else { - rc =parse_efi_signature_list ("powerpc:db" , db, dbsize, +extract_esl (db, data, dsize, offset); + + rc =parse_efi_signature_list ("powerpc:db" , db, dsize, get_handler_for_db);if (rc)pr_err ("Couldn't parse db signatures: %d\n" , rc); -kfree (db); +kfree (data); } - dbx =get_cert_list ("dbx" ,4 , &dbxsize); -if (!dbx) { + data =get_cert_list ("dbx" ,4 , &dsize); +if (!data) {pr_info ("Couldn't get dbx list from firmware\n" ); - }else if (IS_ERR (dbx)) { - rc =PTR_ERR (dbx); + }else if (IS_ERR (data)) { + rc =PTR_ERR (data);pr_err ("Error reading dbx from firmware: %d\n" , rc);return rc; }else { - rc =parse_efi_signature_list ("powerpc:dbx" , dbx, dbxsize, +extract_esl (dbx, data, dsize, offset); + + rc =parse_efi_signature_list ("powerpc:dbx" , dbx, dsize, get_handler_for_dbx);if (rc)pr_err ("Couldn't parse dbx signatures: %d\n" , rc); -kfree (dbx); +kfree (data); }return rc;
Signature · 1 line
2.41.0
Greg Kroah-Hartman
maintainerPATCH 3/292 HID: input: fix mapping for camera access keys
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
commit e3ea6467f623b80906ff0c93b58755ab903ce12f upstream.
Commit 9f4211bf7f81 ("HID: add mapping for camera access keys") added mapping for the camera access keys, but unfortunately used wrong usage codes for them. HUTRR72[1] specifies that camera access controls use 0x76, 0x077 and 0x78 usages in the consumer control page. Previously mapped 0xd5, 0xd6 and 0xd7 usages are actually defined in HUTRR64[2] as game recording controls.
[1] https://www.usb.org/sites/default/files/hutrr72_-_usages_to_control_camera_access_0.pdf
[2] https://www.usb.org/sites/default/files/hutrr64b_-_game_recording_controllers_0.pdf
--- drivers/hid/hid-input.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/hid/hid-input.c +4 -3
@@ -1093,6 +1093,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fielcase 0x074 :map_key_clear (KEY_BRIGHTNESS_MAX );break ;case 0x075 :map_key_clear (KEY_BRIGHTNESS_AUTO );break ; +case 0x076 :map_key_clear (KEY_CAMERA_ACCESS_ENABLE );break ; +case 0x077 :map_key_clear (KEY_CAMERA_ACCESS_DISABLE );break ; +case 0x078 :map_key_clear (KEY_CAMERA_ACCESS_TOGGLE );break ; +case 0x079 :map_key_clear (KEY_KBDILLUMUP );break ;case 0x07a :map_key_clear (KEY_KBDILLUMDOWN );break ;case 0x07c :map_key_clear (KEY_KBDILLUMTOGGLE );break ;
@@ -1139,9 +1143,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fielcase 0x0cd :map_key_clear (KEY_PLAYPAUSE );break ;case 0x0cf :map_key_clear (KEY_VOICECOMMAND );break ; -case 0x0d5 :map_key_clear (KEY_CAMERA_ACCESS_ENABLE );break ; -case 0x0d6 :map_key_clear (KEY_CAMERA_ACCESS_DISABLE );break ; -case 0x0d7 :map_key_clear (KEY_CAMERA_ACCESS_TOGGLE );break ;case 0x0d8 :map_key_clear (KEY_DICTATE );break ;case 0x0d9 :map_key_clear (KEY_EMOJI_PICKER );break ;
Signature · 1 line
2.41.0
Greg Kroah-Hartman
maintainerPATCH 4/292 HID: amd_sfh: Rename the float32 variable
In reply to Greg Kroah-HartmanFrom: Basavaraj Natikar <[email protected]>
commit c1685a862a4bea863537f06abaa37a123aef493c upstream.
As float32 is also used in other places as a data type, it is necessary to rename the float32 variable in order to avoid confusion.
--- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c +6 -6
@@ -132,13 +132,13 @@ static void get_common_inputs(struct com common->event_type =HID_USAGE_SENSOR_EVENT_DATA_UPDATED_ENUM ; } -static int float_to_int (u32 float32) +static int float_to_int (u32 flt32_val) {int fraction, shift, mantissa, sign, exp, zeropre; - mantissa = float32 &GENMASK (22 ,0 ); - sign = (float32 &BIT (31 )) ?-1 :1 ; - exp = (float32 & ~BIT (31 )) >>23 ; + mantissa = flt32_val &GENMASK (22 ,0 ); + sign = (flt32_val &BIT (31 )) ?-1 :1 ; + exp = (flt32_val & ~BIT (31 )) >>23 ;if (!exp && !mantissa)return 0 ;
@@ -151,10 +151,10 @@ static int float_to_int(u32 float32) } shift =23 - exp; - float32 =BIT (exp) + (mantissa >> shift); + flt32_val =BIT (exp) + (mantissa >> shift); fraction = mantissa &GENMASK (shift -1 ,0 ); -return (((fraction *100 ) >> shift) >=50 ) ? sign * (float32 +1 ) : sign * float32; +return (((fraction *100 ) >> shift) >=50 ) ? sign * (flt32_val +1 ) : sign * flt32_val; } static u8 get_input_rep(u8 current_index, int sensor_idx, int report_id,
Greg Kroah-Hartman
maintainerPATCH 5/292 HID: amd_sfh: Fix for shift-out-of-bounds
In reply to Greg Kroah-HartmanFrom: Basavaraj Natikar <[email protected]>
commit 87854366176403438d01f368b09de3ec2234e0f5 upstream.
Shift operation of 'exp' and 'shift' variables exceeds the maximum number of shift values in the u32 range leading to UBSAN shift-out-of-bounds.
...
[ 6.120512] UBSAN: shift-out-of-bounds in drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c:149:50 [ 6.120598] shift exponent 104 is too large for 64-bit type 'long unsigned int' [ 6.120659] CPU: 4 PID: 96 Comm: kworker/4:1 Not tainted 6.4.0amd_1-next-20230519-dirty #10 [ 6.120665] Hardware name: AMD Birman-PHX/Birman-PHX, BIOS SFH_with_HPD_SEN.FD 04/05/2023 [ 6.120667] Workqueue: events amd_sfh_work_buffer [amd_sfh] [ 6.120687] Call Trace: [ 6.120690] <TASK> [ 6.120694] dump_stack_lvl+0x48/0x70 [ 6.120704] dump_stack+0x10/0x20 [ 6.120707] ubsan_epilogue+0x9/0x40 [ 6.120716] __ubsan_handle_shift_out_of_bounds+0x10f/0x170 [ 6.120720] ? psi_group_change+0x25f/0x4b0 [ 6.120729] float_to_int.cold+0x18/0xba [amd_sfh] [ 6.120739] get_input_rep+0x57/0x340 [amd_sfh] [ 6.120748] ? __schedule+0xba7/0x1b60 [ 6.120756] ? __pfx_get_input_rep+0x10/0x10 [amd_sfh] [ 6.120764] amd_sfh_work_buffer+0x91/0x180 [amd_sfh] [ 6.120772] process_one_work+0x229/0x430 [ 6.120780] worker_thread+0x4a/0x3c0 [ 6.120784] ? __pfx_worker_thread+0x10/0x10 [ 6.120788] kthread+0xf7/0x130 [ 6.120792] ? __pfx_kthread+0x10/0x10 [ 6.120795] ret_from_fork+0x29/0x50 [ 6.120804] </TASK>
...
Fix this by adding the condition to validate shift ranges.
--- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c +18 -2
@@ -143,16 +143,32 @@ static int float_to_int(u32 flt32_val)if (!exp && !mantissa)return 0 ; +/* +* Calculate the exponent and fraction part of floating +* point representation. +*/ exp -=127 ;if (exp <0 ) { exp = -exp; +if (exp >=BITS_PER_TYPE (u32)) +return 0 ; zeropre = (((BIT (23 ) + mantissa) *100 ) >>23 ) >> exp;return zeropre >=50 ? sign :0 ; } shift =23 - exp; - flt32_val =BIT (exp) + (mantissa >> shift); - fraction = mantissa &GENMASK (shift -1 ,0 ); +if (abs (shift) >=BITS_PER_TYPE (u32)) +return 0 ; + +if (shift <0 ) { + shift = -shift; + flt32_val =BIT (exp) + (mantissa << shift); + shift =0 ; + }else { + flt32_val =BIT (exp) + (mantissa >> shift); + } + + fraction = (shift ==0 ) ?0 : mantissa &GENMASK (shift -1 ,0 );return (((fraction *100 ) >> shift) >=50 ) ? sign * (flt32_val +1 ) : sign * flt32_val; }
Greg Kroah-Hartman
maintainerPATCH 6/292 net: lan743x: Dont sleep in atomic context
In reply to Greg Kroah-HartmanFrom: Moritz Fischer <[email protected]>
commit 7a8227b2e76be506b2ac64d2beac950ca04892a5 upstream.
dev_set_rx_mode() grabs a spin_lock, and the lan743x implementation proceeds subsequently to go to sleep using readx_poll_timeout().
Introduce a helper wrapping the readx_poll_timeout_atomic() function and use it to replace the calls to readx_polL_timeout().
--- drivers/net/ethernet/microchip/lan743x_main.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/net/ethernet/microchip/lan743x_main.c +17 -4
@@ -144,6 +144,18 @@ static int lan743x_csr_light_reset(struc !(data & HW_CFG_LRST_), 100000, 10000000); } +static int lan743x_csr_wait_for_bit_atomic (struct lan743x_adapter *adapter, +int offset,u32 bit_mask, +int target_value,int udelay_min, +int udelay_max,int count) +{ +u32 data; + +return readx_poll_timeout_atomic (LAN743X_CSR_READ_OP , offset, data, + target_value == !!(data & bit_mask), + udelay_max, udelay_min * count); +} + static int lan743x_csr_wait_for_bit(struct lan743x_adapter *adapter, int offset, u32 bit_mask, int target_value, int usleep_min,
@@ -746,8 +758,8 @@ static int lan743x_dp_write(struct lan74u32 dp_sel;int i; -if (lan743x_csr_wait_for_bit (adapter,DP_SEL ,DP_SEL_DPRDY_ , -1 ,40 ,100 ,100 )) +if (lan743x_csr_wait_for_bit_atomic (adapter,DP_SEL ,DP_SEL_DPRDY_ , +1 ,40 ,100 ,100 ))return -EIO ; dp_sel =lan743x_csr_read (adapter,DP_SEL ); dp_sel &= ~DP_SEL_MASK_ ;
@@ -758,8 +770,9 @@ static int lan743x_dp_write(struct lan74lan743x_csr_write (adapter,DP_ADDR , addr + i);lan743x_csr_write (adapter,DP_DATA_0 , buf[i]);lan743x_csr_write (adapter,DP_CMD ,DP_CMD_WRITE_ ); -if (lan743x_csr_wait_for_bit (adapter,DP_SEL ,DP_SEL_DPRDY_ , -1 ,40 ,100 ,100 )) +if (lan743x_csr_wait_for_bit_atomic (adapter,DP_SEL , +DP_SEL_DPRDY_ , +1 ,40 ,100 ,100 ))return -EIO ; }
Greg Kroah-Hartman
maintainerPATCH 7/292 net: lan743x: select FIXED_PHY
In reply to Greg Kroah-HartmanFrom: Simon Horman <[email protected]>
commit 73c4d1b307aeb713e80ab03f90c7df9d417dc0f0 upstream.
The blamed commit introduces usage of fixed_phy_register() but not a corresponding dependency on FIXED_PHY.
This can result in a build failure.
s390-linux-ld: drivers/net/ethernet/microchip/lan743x_main.o: in function `lan743x_phy_open':
drivers/net/ethernet/microchip/lan743x_main.c:1514: undefined reference to `fixed_phy_register'
--- drivers/net/ethernet/microchip/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/microchip/Kconfig +1 -1
@@ -46,7 +46,7 @@ config LAN743X tristate "LAN743x support" depends on PCI depends on PTP_1588_CLOCK_OPTIONAL - select PHYLIB + select FIXED_PHY select CRC16 select CRC32 help
Greg Kroah-Hartman
maintainerPATCH 8/292 ksmbd: add missing compound request handing in some commands
In reply to Greg Kroah-HartmanFrom: Namjae Jeon <[email protected]>
commit 7b7d709ef7cf285309157fb94c33f625dd22c5e1 upstream.
This patch add the compound request handling to the some commands. Existing clients do not send these commands as compound requests, but ksmbd should consider that they may come.
--- fs/smb/server/smb2pdu.c | 78 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 25 deletions(-)
fs/smb/server/smb2pdu.c +53 -25
@@ -1911,14 +1911,16 @@ out_err:int smb2_tree_connect (struct ksmbd_work *work) {struct ksmbd_conn *conn = work->conn; -struct smb2_tree_connect_req *req =smb2_get_msg (work->request_buf); -struct smb2_tree_connect_rsp *rsp =smb2_get_msg (work->response_buf); +struct smb2_tree_connect_req *req; +struct smb2_tree_connect_rsp *rsp;struct ksmbd_session *sess = work->sess;char *treename =NULL , *name =NULL ;struct ksmbd_tree_conn_status status;struct ksmbd_share_config *share;int rc = -EINVAL ; +WORK_BUFFERS (work, req, rsp); + treename =smb_strndup_from_utf16 (req->Buffer,le16_to_cpu (req->PathLength), true, conn->local_nls);
@@ -2087,19 +2089,19 @@ static int smb2_create_open_flags(bool f*/ int smb2_tree_disconnect (struct ksmbd_work *work) { -struct smb2_tree_disconnect_rsp *rsp =smb2_get_msg (work->response_buf); +struct smb2_tree_disconnect_rsp *rsp; +struct smb2_tree_disconnect_req *req;struct ksmbd_session *sess = work->sess;struct ksmbd_tree_connect *tcon = work->tcon; +WORK_BUFFERS (work, req, rsp); + rsp->StructureSize =cpu_to_le16 (4 );inc_rfc1001_len (work->response_buf,4 );ksmbd_debug (SMB ,"request\n" );if (!tcon ||test_and_set_bit (TREE_CONN_EXPIRE , &tcon->status)) { -struct smb2_tree_disconnect_req *req = -smb2_get_msg (work->request_buf); -ksmbd_debug (SMB ,"Invalid tid %d\n" , req->hdr.Id.SyncId.TreeId); rsp->hdr.Status =STATUS_NETWORK_NAME_DELETED ;
@@ -2122,10 +2124,14 @@ int smb2_tree_disconnect(struct ksmbd_woint smb2_session_logoff (struct ksmbd_work *work) {struct ksmbd_conn *conn = work->conn; -struct smb2_logoff_rsp *rsp =smb2_get_msg (work->response_buf); +struct smb2_logoff_req *req; +struct smb2_logoff_rsp *rsp;struct ksmbd_session *sess; -struct smb2_logoff_req *req =smb2_get_msg (work->request_buf); -u64 sess_id =le64_to_cpu (req->hdr.SessionId); +u64 sess_id; + +WORK_BUFFERS (work, req, rsp); + + sess_id =le64_to_cpu (req->hdr.SessionId); rsp->StructureSize =cpu_to_le16 (4 );inc_rfc1001_len (work->response_buf,4 );
@@ -2165,12 +2171,14 @@ int smb2_session_logoff(struct ksmbd_wor*/ static noinline int create_smb2_pipe(struct ksmbd_work *work) { -struct smb2_create_rsp *rsp =smb2_get_msg (work->response_buf); -struct smb2_create_req *req =smb2_get_msg (work->request_buf); +struct smb2_create_rsp *rsp; +struct smb2_create_req *req;int id;int err;char *name; +WORK_BUFFERS (work, req, rsp); + name =smb_strndup_from_utf16 (req->Buffer,le16_to_cpu (req->NameLength),1 , work->conn->local_nls);if (IS_ERR (name)) {
@@ -5305,8 +5313,10 @@ int smb2_query_info(struct ksmbd_work *w static noinline int smb2_close_pipe(struct ksmbd_work *work) {u64 id; -struct smb2_close_req *req =smb2_get_msg (work->request_buf); -struct smb2_close_rsp *rsp =smb2_get_msg (work->response_buf); +struct smb2_close_req *req; +struct smb2_close_rsp *rsp; + +WORK_BUFFERS (work, req, rsp); id = req->VolatileFileId;ksmbd_session_rpc_close (work->sess, id);
@@ -5448,6 +5458,9 @@ int smb2_echo(struct ksmbd_work *work) {struct smb2_echo_rsp *rsp =smb2_get_msg (work->response_buf); +if (work->next_smb2_rcv_hdr_off) + rsp =ksmbd_resp_buf_next (work); + rsp->StructureSize =cpu_to_le16 (4 ); rsp->Reserved =0 ;inc_rfc1001_len (work->response_buf,4 );
@@ -6082,8 +6095,10 @@ static noinline int smb2_read_pipe(strucint nbytes =0 , err;u64 id;struct ksmbd_rpc_command *rpc_resp; -struct smb2_read_req *req =smb2_get_msg (work->request_buf); -struct smb2_read_rsp *rsp =smb2_get_msg (work->response_buf); +struct smb2_read_req *req; +struct smb2_read_rsp *rsp; + +WORK_BUFFERS (work, req, rsp); id = req->VolatileFileId;
@@ -6331,14 +6346,16 @@ out:*/ static noinline int smb2_write_pipe(struct ksmbd_work *work) { -struct smb2_write_req *req =smb2_get_msg (work->request_buf); -struct smb2_write_rsp *rsp =smb2_get_msg (work->response_buf); +struct smb2_write_req *req; +struct smb2_write_rsp *rsp;struct ksmbd_rpc_command *rpc_resp;u64 id =0 ;int err =0 , ret =0 ;char *data_buf;size_t length; +WORK_BUFFERS (work, req, rsp); + length =le32_to_cpu (req->Length); id = req->VolatileFileId;
@@ -6607,6 +6624,9 @@ int smb2_cancel(struct ksmbd_work *work)struct ksmbd_work *iter;struct list_head *command_list; +if (work->next_smb2_rcv_hdr_off) + hdr =ksmbd_resp_buf_next (work); +ksmbd_debug (SMB ,"smb2 cancel called on mid %llu, async flags 0x%x\n" , hdr->MessageId, hdr->Flags);
@@ -6766,8 +6786,8 @@ static inline bool lock_defer_pending(st*/ int smb2_lock (struct ksmbd_work *work) { -struct smb2_lock_req *req =smb2_get_msg (work->request_buf); -struct smb2_lock_rsp *rsp =smb2_get_msg (work->response_buf); +struct smb2_lock_req *req; +struct smb2_lock_rsp *rsp;struct smb2_lock_element *lock_ele;struct ksmbd_file *fp =NULL ;struct file_lock *flock =NULL ;
@@ -6784,6 +6804,8 @@ int smb2_lock(struct ksmbd_work *work)LIST_HEAD (rollback_list);int prior_lock =0 ; +WORK_BUFFERS (work, req, rsp); +ksmbd_debug (SMB ,"Received lock request\n" ); fp =ksmbd_lookup_fd_slow (work, req->VolatileFileId, req->PersistentFileId);if (!fp) {
@@ -7897,8 +7919,8 @@ out:*/ static void smb20_oplock_break_ack (struct ksmbd_work *work) { -struct smb2_oplock_break *req =smb2_get_msg (work->request_buf); -struct smb2_oplock_break *rsp =smb2_get_msg (work->response_buf); +struct smb2_oplock_break *req; +struct smb2_oplock_break *rsp;struct ksmbd_file *fp;struct oplock_info *opinfo =NULL ;__le32 err =0 ;
@@ -7907,6 +7929,8 @@ static void smb20_oplock_break_ack(strucchar req_oplevel =0 , rsp_oplevel =0 ;unsigned int oplock_change_type; +WORK_BUFFERS (work, req, rsp); + volatile_id = req->VolatileFid; persistent_id = req->PersistentFid; req_oplevel = req->OplockLevel;
@@ -8041,8 +8065,8 @@ static int check_lease_state(struct leasstatic void smb21_lease_break_ack (struct ksmbd_work *work) {struct ksmbd_conn *conn = work->conn; -struct smb2_lease_ack *req =smb2_get_msg (work->request_buf); -struct smb2_lease_ack *rsp =smb2_get_msg (work->response_buf); +struct smb2_lease_ack *req; +struct smb2_lease_ack *rsp;struct oplock_info *opinfo;__le32 err =0 ;int ret =0 ;
@@ -8050,6 +8074,8 @@ static void smb21_lease_break_ack(struct__le32 lease_state;struct lease *lease; +WORK_BUFFERS (work, req, rsp); +ksmbd_debug (OPLOCK ,"smb21 lease break, lease state(0x%x)\n" ,le32_to_cpu (req->LeaseState)); opinfo =lookup_lease_in_table (conn, req->LeaseKey);
@@ -8175,8 +8201,10 @@ err_out:*/ int smb2_oplock_break (struct ksmbd_work *work) { -struct smb2_oplock_break *req =smb2_get_msg (work->request_buf); -struct smb2_oplock_break *rsp =smb2_get_msg (work->response_buf); +struct smb2_oplock_break *req; +struct smb2_oplock_break *rsp; + +WORK_BUFFERS (work, req, rsp);switch (le16_to_cpu (req->StructureSize)) {case OP_BREAK_STRUCT_SIZE_20 :
Greg Kroah-Hartman
maintainerPATCH 9/292 ksmbd: fix out of bounds read in smb2_sess_setup
In reply to Greg Kroah-HartmanFrom: Namjae Jeon <[email protected]>
commit 98422bdd4cb3ca4d08844046f6507d7ec2c2b8d8 upstream.
ksmbd does not consider the case of that smb2 session setup is in compound request. If this is the second payload of the compound, OOB read issue occurs while processing the first payload in the smb2_sess_setup().
--- fs/smb/server/smb2pdu.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-)
fs/smb/server/smb2pdu.c +17 -14
@@ -1322,9 +1322,8 @@ static int decode_negotiation_token(strustatic int ntlm_negotiate (struct ksmbd_work *work,struct negotiate_message *negblob, -size_t negblob_len) +size_t negblob_len,struct smb2_sess_setup_rsp *rsp) { -struct smb2_sess_setup_rsp *rsp =smb2_get_msg (work->response_buf);struct challenge_message *chgblob;unsigned char *spnego_blob =NULL ;u16 spnego_blob_len;
@@ -1429,10 +1428,10 @@ static struct ksmbd_user *session_user(sreturn user; } -static int ntlm_authenticate (struct ksmbd_work *work) +static int ntlm_authenticate (struct ksmbd_work *work, +struct smb2_sess_setup_req *req, +struct smb2_sess_setup_rsp *rsp) { -struct smb2_sess_setup_req *req =smb2_get_msg (work->request_buf); -struct smb2_sess_setup_rsp *rsp =smb2_get_msg (work->response_buf);struct ksmbd_conn *conn = work->conn;struct ksmbd_session *sess = work->sess;struct channel *chann =NULL ;
@@ -1566,10 +1565,10 @@ binding_session: }#ifdef CONFIG_SMB_SERVER_KERBEROS5 -static int krb5_authenticate (struct ksmbd_work *work) +static int krb5_authenticate (struct ksmbd_work *work, +struct smb2_sess_setup_req *req, +struct smb2_sess_setup_rsp *rsp) { -struct smb2_sess_setup_req *req =smb2_get_msg (work->request_buf); -struct smb2_sess_setup_rsp *rsp =smb2_get_msg (work->response_buf);struct ksmbd_conn *conn = work->conn;struct ksmbd_session *sess = work->sess;char *in_blob, *out_blob;
@@ -1647,7 +1646,9 @@ static int krb5_authenticate(struct ksmb return 0; }#else -static int krb5_authenticate (struct ksmbd_work *work) +static int krb5_authenticate (struct ksmbd_work *work, +struct smb2_sess_setup_req *req, +struct smb2_sess_setup_rsp *rsp) {return -EOPNOTSUPP ; }
@@ -1656,8 +1657,8 @@ static int krb5_authenticate(struct ksmbint smb2_sess_setup (struct ksmbd_work *work) {struct ksmbd_conn *conn = work->conn; -struct smb2_sess_setup_req *req =smb2_get_msg (work->request_buf); -struct smb2_sess_setup_rsp *rsp =smb2_get_msg (work->response_buf); +struct smb2_sess_setup_req *req; +struct smb2_sess_setup_rsp *rsp;struct ksmbd_session *sess;struct negotiate_message *negblob;unsigned int negblob_len, negblob_off;
@@ -1665,6 +1666,8 @@ int smb2_sess_setup(struct ksmbd_work *wksmbd_debug (SMB ,"Received request for session setup\n" ); +WORK_BUFFERS (work, req, rsp); + rsp->StructureSize =cpu_to_le16 (9 ); rsp->SessionFlags =0 ; rsp->SecurityBufferOffset =cpu_to_le16 (72 );
@@ -1786,7 +1789,7 @@ int smb2_sess_setup(struct ksmbd_work *wif (conn->preferred_auth_mech & (KSMBD_AUTH_KRB5 |KSMBD_AUTH_MSKRB5 )) { - rc =krb5_authenticate (work); + rc =krb5_authenticate (work, req, rsp);if (rc) { rc = -EINVAL ; goto out_err;
@@ -1800,7 +1803,7 @@ int smb2_sess_setup(struct ksmbd_work *w sess->Preauth_HashValue =NULL ; }else if (conn->preferred_auth_mech ==KSMBD_AUTH_NTLMSSP ) {if (negblob->MessageType == NtLmNegotiate) { - rc =ntlm_negotiate (work, negblob, negblob_len); + rc =ntlm_negotiate (work, negblob, negblob_len, rsp);if (rc) goto out_err; rsp->hdr.Status =
@@ -1813,7 +1816,7 @@ int smb2_sess_setup(struct ksmbd_work *w le16_to_cpu(rsp->SecurityBufferLength) - 1); }else if (negblob->MessageType == NtLmAuthenticate) { - rc =ntlm_authenticate (work); + rc =ntlm_authenticate (work, req, rsp);if (rc) goto out_err;
Greg Kroah-Hartman
maintainerPATCH 10/292 drm/panel: simple: Add connector_type for innolux_at043tn24
In reply to Greg Kroah-HartmanFrom: Fabio Estevam <[email protected]>
[ Upstream commit 2c56a751845ddfd3078ebe79981aaaa182629163 ]
The innolux at043tn24 display is a parallel LCD. Pass the 'connector_type' information to avoid the following warning:
panel-simple panel: Specify missing connector_type
--- drivers/gpu/drm/panel/panel-simple.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/panel/panel-simple.c +1 -0
@@ -2117,6 +2117,7 @@ static const struct panel_desc innolux_at043tn24 = { .height = 54, }, .bus_format = MEDIA_BUS_FMT_RGB888_1X24, + .connector_type = DRM_MODE_CONNECTOR_DPI, .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE, };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 11/292 drm: bridge: dw_hdmi: fix connector access for scdc
In reply to Greg Kroah-HartmanFrom: Adrián Larumbe <[email protected]>
[ Upstream commit 98703e4e061fb8715c7613cd227e32cdfd136b23 ]
Commit 5d844091f237 ("drm/scdc-helper: Pimp SCDC debugs") changed the scdc interface to pick up an i2c adapter from a connector instead. However, in the case of dw-hdmi, the wrong connector was being used to pass i2c adapter information, since dw-hdmi's embedded connector structure is only populated when the bridge attachment callback explicitly asks for it.
drm-meson is handling connector creation, so this won't happen, leading to a NULL pointer dereference.
Fix it by having scdc functions access dw-hdmi's current connector pointer instead, which is assigned during the bridge enablement stage.
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +5 -4
@@ -1426,9 +1426,9 @@ void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi,/* Control for TMDS Bit Period/TMDS Clock-Period Ratio */ if (dw_hdmi_support_scdc (hdmi, display)) {if (mtmdsclock >HDMI14_MAX_TMDSCLK ) -drm_scdc_set_high_tmds_clock_ratio (&hdmi->connector,1 ); +drm_scdc_set_high_tmds_clock_ratio (hdmi->curr_conn,1 );else -drm_scdc_set_high_tmds_clock_ratio (&hdmi->connector,0 ); +drm_scdc_set_high_tmds_clock_ratio (hdmi->curr_conn,0 ); } }EXPORT_SYMBOL_GPL (dw_hdmi_set_high_tmds_clock_ratio);
@@ -2116,7 +2116,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, min_t(u8, bytes, SCDC_MIN_SOURCE_VERSION));/* Enabled Scrambling in the Sink */ -drm_scdc_set_scrambling (&hdmi->connector,1 ); +drm_scdc_set_scrambling (hdmi->curr_conn,1 );/* * To activate the scrambler feature, you must ensure
@@ -2132,7 +2132,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,hdmi_writeb (hdmi,0 ,HDMI_FC_SCRAMBLER_CTRL );hdmi_writeb (hdmi, (u8 )~HDMI_MC_SWRSTZ_TMDSSWRST_REQ ,HDMI_MC_SWRSTZ ); -drm_scdc_set_scrambling (&hdmi->connector,0 ); +drm_scdc_set_scrambling (hdmi->curr_conn,0 ); } }
@@ -3553,6 +3553,7 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, hdmi->bridge.ops =DRM_BRIDGE_OP_DETECT |DRM_BRIDGE_OP_EDID |DRM_BRIDGE_OP_HPD ; hdmi->bridge.interlace_allowed = true; + hdmi->bridge.ddc = hdmi->ddc;#ifdef CONFIG_OF hdmi->bridge.of_node = pdev->dev.of_node;#endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 12/292 drm/bridge: ti-sn65dsi86: Fix auxiliary bus lifetime
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
[ Upstream commit 7aa83fbd712a6f08ffa67890061f26d140c2a84f ]
Memory for the "struct device" for any given device isn't supposed to be released until the device's release() is called. This is important because someone might be holding a kobject reference to the "struct device" and might try to access one of its members even after any other cleanup/uninitialization has happened.
Code analysis of ti-sn65dsi86 shows that this isn't quite right. When the code was written, it was believed that we could rely on the fact that the child devices would all be freed before the parent devices and thus we didn't need to worry about a release() function. While I still believe that the parent's "struct device" is guaranteed to outlive the child's "struct device" (because the child holds a kobject reference to the parent), the parent's "devm" allocated memory is a different story. That appears to be freed much earlier.
Let's make this better for ti-sn65dsi86 by allocating each auxiliary with kzalloc and then free that memory in the release().
--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 35 +++++++++++++++++---------- 1 file changed, 22 insertions(+), 13 deletions(-)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +22 -13
@@ -170,10 +170,10 @@* @pwm_refclk_freq: Cache for the reference clock input to the PWM. */ struct ti_sn65dsi86 { -struct auxiliary_device bridge_aux; -struct auxiliary_device gpio_aux; -struct auxiliary_device aux_aux; -struct auxiliary_device pwm_aux; +struct auxiliary_device *bridge_aux; +struct auxiliary_device *gpio_aux; +struct auxiliary_device *aux_aux; +struct auxiliary_device *pwm_aux;struct device *dev;struct regmap *regmap;
@@ -468,27 +468,34 @@ static void ti_sn65dsi86_delete_aux(void *data)auxiliary_device_delete (data); } -/* -* AUX bus docs say that a non-NULL release is mandatory, but it makes no -* sense for the model used here where all of the aux devices are allocated -* in the single shared structure. We'll use this noop as a workaround. -*/ -static void ti_sn65dsi86_noop (struct device *dev) {} +static void ti_sn65dsi86_aux_device_release (struct device *dev) +{ + struct auxiliary_device *aux = container_of(dev, struct auxiliary_device, dev); + +kfree (aux); +}static int ti_sn65dsi86_add_aux_device (struct ti_sn65dsi86 *pdata, -struct auxiliary_device *aux, +struct auxiliary_device **aux_out,const char *name) {struct device *dev = pdata->dev; +struct auxiliary_device *aux;int ret; + aux =kzalloc (sizeof (*aux),GFP_KERNEL ); +if (!aux) +return -ENOMEM ; + aux->name = name; aux->dev.parent = dev; - aux->dev.release = ti_sn65dsi86_noop; + aux->dev.release = ti_sn65dsi86_aux_device_release;device_set_of_node_from_dev (&aux->dev, dev); ret =auxiliary_device_init (aux); -if (ret) +if (ret) { +kfree (aux);return ret; + } ret =devm_add_action_or_reset (dev, ti_sn65dsi86_uninit_aux, aux);if (ret)return ret;
@@ -497,6 +504,8 @@ static int ti_sn65dsi86_add_aux_device(struct ti_sn65dsi86 *pdata,if (ret)return ret; ret =devm_add_action_or_reset (dev, ti_sn65dsi86_delete_aux, aux); +if (!ret) + *aux_out = aux;return ret; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 13/292 swiotlb: always set the number of areas before allocating the pool
In reply to Greg Kroah-HartmanFrom: Petr Tesarik <[email protected]>
[ Upstream commit aabd12609f91155f26584508b01f548215cc3c0c ]
The number of areas defaults to the number of possible CPUs. However, the total number of slots may have to be increased after adjusting the number of areas. Consequently, the number of areas must be determined before allocating the memory pool. This is even explained with a comment in swiotlb_init_remap(), but swiotlb_init_late() adjusts the number of areas after slots are already allocated. The areas may end up being smaller than IO_TLB_SEGSIZE, which breaks per-area locking.
While fixing swiotlb_init_late(), move all relevant comments before the definition of swiotlb_adjust_nareas() and convert them to kernel-doc.
--- kernel/dma/swiotlb.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
kernel/dma/swiotlb.c +11 -8
@@ -115,9 +115,16 @@ static bool round_up_default_nslabs(void)return true; } +/** +* swiotlb_adjust_nareas() - adjust the number of areas and slots +* @nareas: Desired number of areas. Zero is treated as 1. +* +* Adjust the default number of areas in a memory pool. +* The default size of the memory pool may also change to meet minimum area +* size requirements. +*/ static void swiotlb_adjust_nareas (unsigned int nareas) { -/* use a single area when non is specified */ if (!nareas) nareas =1 ;else if (!is_power_of_2 (nareas))
@@ -298,10 +305,6 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,if (swiotlb_force_disable)return ; -/* -* default_nslabs maybe changed when adjust area number. -* So allocate bounce buffer after adjusting area number. -*/ if (!default_nareas)swiotlb_adjust_nareas (num_possible_cpus ());
@@ -363,6 +366,9 @@ int swiotlb_init_late(size_t size, gfp_t gfp_mask,if (swiotlb_force_disable)return 0 ; +if (!default_nareas) +swiotlb_adjust_nareas (num_possible_cpus ()); + retry: order =get_order (nslabs <<IO_TLB_SHIFT ); nslabs =SLABS_PER_PAGE << order;
@@ -397,9 +403,6 @@ int swiotlb_init_late(size_t size, gfp_t gfp_mask, (PAGE_SIZE << order) >> 20); } -if (!default_nareas) -swiotlb_adjust_nareas (num_possible_cpus ()); - area_order =get_order (array_size (sizeof (*mem->areas), default_nareas)); mem->areas = (struct io_tlb_area *)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 14/292 swiotlb: reduce the number of areas to match actual memory pool size
In reply to Greg Kroah-HartmanFrom: Petr Tesarik <[email protected]>
[ Upstream commit 8ac04063354a01a484d2e55d20ed1958aa0d3392 ]
Although the desired size of the SWIOTLB memory pool is increased in swiotlb_adjust_nareas() to match the number of areas, the actual allocation may be smaller, which may require reducing the number of areas.
For example, Xen uses swiotlb_init_late(), which in turn uses the page allocator. On x86, page size is 4 KiB and MAX_ORDER is 10 (1024 pages), resulting in a maximum memory pool size of 4 MiB. This corresponds to 2048 slots of 2 KiB each. The minimum area size is 128 (IO_TLB_SEGSIZE), allowing at most 2048 / 128 = 16 areas.
If num_possible_cpus() is greater than the maximum number of areas, areas are smaller than IO_TLB_SEGSIZE and contiguous groups of free slots will span multiple areas. When allocating and freeing slots, only one area will be properly locked, causing race conditions on the unlocked slots and ultimately data corruption, kernel hangs and crashes.
--- kernel/dma/swiotlb.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-)
kernel/dma/swiotlb.c +24 -3
@@ -138,6 +138,23 @@ static void swiotlb_adjust_nareas(unsigned int nareas) (default_nslabs << IO_TLB_SHIFT) >> 20); } +/** +* limit_nareas() - get the maximum number of areas for a given memory pool size +* @nareas: Desired number of areas. +* @nslots: Total number of slots in the memory pool. +* +* Limit the number of areas to the maximum possible number of areas in +* a memory pool of the given size. +* +* Return: Maximum possible number of areas. +*/ +static unsigned int limit_nareas (unsigned int nareas,unsigned long nslots) +{ +if (nslots < nareas *IO_TLB_SEGSIZE ) +return nslots /IO_TLB_SEGSIZE ; +return nareas; +} +static int __init setup_io_tlb_npages (char *str) {
@@ -297,6 +314,7 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags, {struct io_tlb_mem *mem = &io_tlb_default_mem;unsigned long nslabs; +unsigned int nareas;size_t alloc_size;void *tlb;
@@ -309,10 +327,12 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,swiotlb_adjust_nareas (num_possible_cpus ()); nslabs = default_nslabs; + nareas =limit_nareas (default_nareas, nslabs);while ((tlb =swiotlb_memblock_alloc (nslabs, flags, remap)) ==NULL ) {if (nslabs <=IO_TLB_MIN_SLABS )return ; nslabs =ALIGN (nslabs >>1 ,IO_TLB_SEGSIZE ); + nareas =limit_nareas (nareas, nslabs); }if (default_nslabs != nslabs) {
@@ -358,6 +378,7 @@ int swiotlb_init_late(size_t size, gfp_t gfp_mask, {struct io_tlb_mem *mem = &io_tlb_default_mem;unsigned long nslabs =ALIGN (size >>IO_TLB_SHIFT ,IO_TLB_SEGSIZE ); +unsigned int nareas;unsigned char *vstart =NULL ;unsigned int order, area_order;bool retried = false;
@@ -403,8 +424,8 @@ int swiotlb_init_late(size_t size, gfp_t gfp_mask, (PAGE_SIZE << order) >> 20); } - area_order =get_order (array_size (sizeof (*mem->areas), - default_nareas)); + nareas =limit_nareas (default_nareas, nslabs); + area_order =get_order (array_size (sizeof (*mem->areas), nareas)); mem->areas = (struct io_tlb_area *)__get_free_pages (GFP_KERNEL | __GFP_ZERO, area_order);if (!mem->areas)
@@ -418,7 +439,7 @@ int swiotlb_init_late(size_t size, gfp_t gfp_mask,set_memory_decrypted ((unsigned long )vstart, (nslabs <<IO_TLB_SHIFT ) >>PAGE_SHIFT );swiotlb_init_io_tlb_mem (mem,virt_to_phys (vstart), nslabs,0 , true, - default_nareas); + nareas);swiotlb_print_info ();return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 15/292 drm/panel: simple: Add Powertip PH800480T013 drm_display_mode flags
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit 1c519980aced3da1fae37c1339cf43b24eccdee7 ]
Add missing drm_display_mode DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC flags. Those are used by various bridges in the pipeline to correctly configure its sync signals polarity.
--- drivers/gpu/drm/panel/panel-simple.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/panel/panel-simple.c +1 -0
@@ -3110,6 +3110,7 @@ static const struct drm_display_mode powertip_ph800480t013_idf02_mode = { .vsync_start = 480 + 49, .vsync_end = 480 + 49 + 2, .vtotal = 480 + 49 + 2 + 22, + .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC, };static const struct panel_desc powertip_ph800480t013_idf02 = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 16/292 xen/virtio: Fix NULL deref when a bridge of PCI root bus has no parent
In reply to Greg Kroah-HartmanFrom: Petr Pavlu <[email protected]>
[ Upstream commit 21a235bce12361e64adfc2ef97e4ae2e51ad63d4 ]
When attempting to run Xen on a QEMU/KVM virtual machine with virtio devices (all x86_64), function xen_dt_get_node() crashes on accessing bus->bridge->parent->of_node because a bridge of the PCI root bus has no parent set:
[ 1.694192][ T1] BUG: kernel NULL pointer dereference, address: 0000000000000288 [ 1.695688][ T1] #PF: supervisor read access in kernel mode [ 1.696297][ T1] #PF: error_code(0x0000) - not-present page [ 1.696297][ T1] PGD 0 P4D 0 [ 1.696297][ T1] Oops: 0000 [#1] PREEMPT SMP NOPTI [ 1.696297][ T1] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.3.7-1-default #1 openSUSE Tumbleweed a577eae57964bb7e83477b5a5645a1781df990f0 [ 1.696297][ T1] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.15.0-0-g2dd4b9b-rebuilt.opensuse.org 04/01/2014 [ 1.696297][ T1] RIP: e030:xen_virtio_restricted_mem_acc+0xd9/0x1c0 [ 1.696297][ T1] Code: 45 0c 83 e8 c9 a3 ea ff 31 c0 eb d7 48 8b 87 40 ff ff ff 48 89 c2 48 8b 40 10 48 85 c0 75 f4 48 8b 82 10 01 00 00 48 8b 40 40 <48> 83 b8 88 02 00 00 00 0f 84 45 ff ff ff 66 90 31 c0 eb a5 48 89 [ 1.696297][ T1] RSP: e02b:ffffc90040013cc8 EFLAGS: 00010246 [ 1.696297][ T1] RAX: 0000000000000000 RBX: ffff888006c75000 RCX: 0000000000000029 [ 1.696297][ T1] RDX: ffff888005ed1000 RSI: ffffc900400f100c RDI: ffff888005ee30d0 [ 1.696297][ T1] RBP: ffff888006c75010 R08: 0000000000000001 R09: 0000000330000006 [ 1.696297][ T1] R10: ffff888005850028 R11: 0000000000000002 R12: ffffffff830439a0 [ 1.696297][ T1] R13: 0000000000000000 R14: ffff888005657900 R15: ffff888006e3e1e8 [ 1.696297][ T1] FS: 0000000000000000(0000) GS:ffff88804a000000(0000) knlGS:0000000000000000 [ 1.696297][ T1] CS: e030 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1.696297][ T1] CR2: 0000000000000288 CR3: 0000000002e36000 CR4: 0000000000050660 [ 1.696297][ T1] Call Trace: [ 1.696297][ T1] <TASK> [ 1.696297][ T1] virtio_features_ok+0x1b/0xd0 [ 1.696297][ T1] virtio_dev_probe+0x19c/0x270 [ 1.696297][ T1] really_probe+0x19b/0x3e0 [ 1.696297][ T1] __driver_probe_device+0x78/0x160 [ 1.696297][ T1] driver_probe_device+0x1f/0x90 [ 1.696297][ T1] __driver_attach+0xd2/0x1c0 [ 1.696297][ T1] bus_for_each_dev+0x74/0xc0 [ 1.696297][ T1] bus_add_driver+0x116/0x220 [ 1.696297][ T1] driver_register+0x59/0x100 [ 1.696297][ T1] virtio_console_init+0x7f/0x110 [ 1.696297][ T1] do_one_initcall+0x47/0x220 [ 1.696297][ T1] kernel_init_freeable+0x328/0x480 [ 1.696297][ T1] kernel_init+0x1a/0x1c0 [ 1.696297][ T1] ret_from_fork+0x29/0x50 [ 1.696297][ T1] </TASK> [ 1.696297][ T1] Modules linked in: [ 1.696297][ T1] CR2: 0000000000000288 [ 1.696297][ T1] ---[ end trace 0000000000000000 ]---
The PCI root bus is in this case created from ACPI description via acpi_pci_root_add() -> pci_acpi_scan_root() -> acpi_pci_root_create() -> pci_create_root_bus() where the last function is called with parent=NULL. It indicates that no parent is present and then bus->bridge->parent is NULL too.
Fix the problem by checking bus->bridge->parent in xen_dt_get_node() for NULL first.
--- drivers/xen/grant-dma-ops.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/xen/grant-dma-ops.c +2 -0
@@ -303,6 +303,8 @@ static struct device_node *xen_dt_get_node(struct device *dev)while (!pci_is_root_bus (bus)) bus = bus->parent; +if (!bus->bridge->parent) +return NULL ;return of_node_get (bus->bridge->parent->of_node); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 17/292 netfilter: nf_tables: report use refcount overflow
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 1689f25924ada8fe14a4a82c38925d04994c7142 ]
Overflow use refcount checks are not complete.
Add helper function to deal with object reference counter tracking. Report -EMFILE in case UINT_MAX is reached.
nft_use_dec() splats in case that reference counter underflows, which should not ever happen.
Add nft_use_inc_restore() and nft_use_dec_restore() which are used to restore reference counter from error and abort paths.
Use u32 in nft_flowtable and nft_object since helper functions cannot work on bitfields.
Remove the few early incomplete checks now that the helper functions are in place and used to check for refcount overflow.
--- include/net/netfilter/nf_tables.h | 31 +++++- net/netfilter/nf_tables_api.c | 163 ++++++++++++++++++------------ net/netfilter/nft_flow_offload.c | 6 +- net/netfilter/nft_immediate.c | 8 +- net/netfilter/nft_objref.c | 8 +- 5 files changed, 141 insertions(+), 75 deletions(-)
include/net/netfilter/nf_tables.h +27 -4
@@ -1211,6 +1211,29 @@ int __nft_release_basechain(struct nft_ctx *ctx);unsigned int nft_do_chain (struct nft_pktinfo *pkt,void *priv); +static inline bool nft_use_inc (u32 *use) +{ +if (*use ==UINT_MAX ) +return false; + + (*use)++; + +return true; +} + +static inline void nft_use_dec (u32 *use) +{ +WARN_ON_ONCE ((*use)-- ==0 ); +} + +/* For error and abort path: restore use counter to previous state. */ +static inline void nft_use_inc_restore (u32 *use) +{ +WARN_ON_ONCE (!nft_use_inc (use)); +} + +#define nft_use_dec_restore nft_use_dec +/** * struct nft_table - nf_tables table *
@@ -1296,8 +1319,8 @@ struct nft_object {struct list_head list;struct rhlist_head rhlhead;struct nft_object_hash_key key; - u32 genmask:2, - use:30; + u32 genmask:2; +u32 use;u64 handle;u16 udlen;u8 *udata;
@@ -1399,8 +1422,8 @@ struct nft_flowtable {char *name;int hooknum;int ops_len; - u32 genmask:2, - use:30; + u32 genmask:2; +u32 use;u64 handle;/* runtime data below here */ struct list_head hook_list____cacheline_aligned ;
net/netfilter/nf_tables_api.c +101 -62
508 lines not on this page · raw message
net/netfilter/nft_flow_offload.c +4 -2
@@ -404,8 +404,10 @@ static int nft_flow_offload_init(const struct nft_ctx *ctx,if (IS_ERR (flowtable))return PTR_ERR (flowtable); +if (!nft_use_inc (&flowtable->use)) +return -EMFILE ; + priv->flowtable = flowtable; - flowtable->use++;return nf_ct_netns_get (ctx->net, ctx->family); }
@@ -424,7 +426,7 @@ static void nft_flow_offload_activate(const struct nft_ctx *ctx, {struct nft_flow_offload *priv =nft_expr_priv (expr); - priv->flowtable->use++; +nft_use_inc_restore (&priv->flowtable->use); } static void nft_flow_offload_destroy(const struct nft_ctx *ctx,
net/netfilter/nft_immediate.c +4 -4
@@ -159,7 +159,7 @@ static void nft_immediate_deactivate(const struct nft_ctx *ctx,default :nft_chain_del (chain); chain->bound = false; - chain->table->use--; +nft_use_dec (&chain->table->use);break ; }break ;
@@ -198,7 +198,7 @@ static void nft_immediate_destroy(const struct nft_ctx *ctx,* let the transaction records release this chain and its rules. */ if (chain->bound) { - chain->use--; +nft_use_dec (&chain->use);break ; }
@@ -206,9 +206,9 @@ static void nft_immediate_destroy(const struct nft_ctx *ctx, chain_ctx = *ctx; chain_ctx.chain = chain; - chain->use--; +nft_use_dec (&chain->use);list_for_each_entry_safe (rule, n, &chain->rules, list) { - chain->use--; +nft_use_dec (&chain->use);list_del (&rule->list);nf_tables_rule_destroy (&chain_ctx, rule); }
net/netfilter/nft_objref.c +5 -3
@@ -41,8 +41,10 @@ static int nft_objref_init(const struct nft_ctx *ctx,if (IS_ERR (obj))return -ENOENT ; +if (!nft_use_inc (&obj->use)) +return -EMFILE ; +nft_objref_priv (expr) = obj; - obj->use++;return 0 ; }
@@ -72,7 +74,7 @@ static void nft_objref_deactivate(const struct nft_ctx *ctx,if (phase ==NFT_TRANS_COMMIT )return ; - obj->use--; +nft_use_dec (&obj->use); } static void nft_objref_activate(const struct nft_ctx *ctx,
@@ -80,7 +82,7 @@ static void nft_objref_activate(const struct nft_ctx *ctx, {struct nft_object *obj =nft_objref_priv (expr); - obj->use++; +nft_use_inc_restore (&obj->use); }static const struct nft_expr_ops nft_objref_ops = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 18/292 netfilter: conntrack: dont fold port numbers into addresses before hashing
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit eaf9e7192ec9af2fbf1b6eb2299dd0feca6c5f7e ]
Originally this used jhash2() over tuple and folded the zone id, the pernet hash value, destination port and l4 protocol number into the 32bit seed value.
When the switch to siphash was done, I used an on-stack temporary buffer to build a suitable key to be hashed via siphash().
But this showed up as performance regression, so I got rid of the temporary copy and collected to-be-hashed data in 4 u64 variables.
This makes it easy to build tuples that produce the same hash, which isn't desirable even though chain lengths are limited.
Switch back to plain siphash, but just like with jhash2(), take advantage of the fact that most of to-be-hashed data is already in a suitable order.
Use an empty struct as annotation in 'struct nf_conntrack_tuple' to mark last member that can be used as hash input.
The only remaining data that isn't present in the tuple structure are the zone identifier and the pernet hash: fold those into the key.
--- include/net/netfilter/nf_conntrack_tuple.h | 3 +++ net/netfilter/nf_conntrack_core.c | 20 +++++++------------- 2 files changed, 10 insertions(+), 13 deletions(-)
include/net/netfilter/nf_conntrack_tuple.h +3 -0
@@ -67,6 +67,9 @@ struct nf_conntrack_tuple {/* The protocol. */ u_int8_t protonum; +/* The direction must be ignored for the tuplehash */ +struct { } __nfct_hash_offsetend; +/* The direction (for tuplehash) */ u_int8_t dir; } dst;
net/netfilter/nf_conntrack_core.c +7 -13
@@ -211,24 +211,18 @@ static u32 hash_conntrack_raw(const struct nf_conntrack_tuple *tuple,unsigned int zoneid, const struct net *net) { - u64 a, b, c, d; + siphash_key_t key;get_random_once (&nf_conntrack_hash_rnd,sizeof (nf_conntrack_hash_rnd)); -/* The direction must be ignored, handle usable tuplehash members manually */ - a = (u64 )tuple->src.u3.all[0 ] <<32 | tuple->src.u3.all[3 ]; - b = (u64 )tuple->dst.u3.all[0 ] <<32 | tuple->dst.u3.all[3 ]; + key = nf_conntrack_hash_rnd; - c = (__force u64 )tuple->src.u.all <<32 | (__force u64 )tuple->dst.u.all <<16 ; - c |= tuple->dst.protonum; + key.key[0 ] ^= zoneid; + key.key[1 ] ^=net_hash_mix (net); - d = (u64 )zoneid <<32 |net_hash_mix (net); - -/* IPv4: u3.all[1,2,3] == 0 */ - c ^= (u64 )tuple->src.u3.all[1 ] <<32 | tuple->src.u3.all[2 ]; - d += (u64 )tuple->dst.u3.all[1 ] <<32 | tuple->dst.u3.all[2 ]; - -return (u32 )siphash_4u64 (a, b, c, d, &nf_conntrack_hash_rnd); +return siphash ((void *)tuple, + offsetofend(struct nf_conntrack_tuple, dst.__nfct_hash_offsetend), + &key); }static u32 scale_hash (u32 hash)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 19/292 ice: Fix max_rate check while configuring TX rate limits
In reply to Greg Kroah-HartmanFrom: Sridhar Samudrala <[email protected]>
[ Upstream commit 5f16da6ee6ac32e6c8098bc4cfcc4f170694f9da ]
Remove incorrect check in ice_validate_mqprio_opt() that limits filter configuration when sum of max_rates of all TCs exceeds the link speed. The max rate of each TC is unrelated to value used by other TCs and is valid as long as it is less than link speed.
--- drivers/net/ethernet/intel/ice/ice_main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +8 -8
@@ -8114,10 +8114,10 @@ static int ice_validate_mqprio_qopt(struct ice_vsi *vsi, struct tc_mqprio_qopt_offload *mqprio_qopt) { - u64 sum_max_rate = 0, sum_min_rate = 0; int non_power_of_2_qcount = 0;struct ice_pf *pf = vsi->back;int max_rss_q_cnt =0 ; +u64 sum_min_rate =0 ;struct device *dev;int i, speed;u8 num_tc;
@@ -8133,6 +8133,7 @@ ice_validate_mqprio_qopt(struct ice_vsi *vsi, dev =ice_pf_to_dev (pf); vsi->ch_rss_size =0 ; num_tc = mqprio_qopt->qopt.num_tc; + speed =ice_get_link_speed_kbps (vsi);for (i =0 ; num_tc; i++) {int qcount = mqprio_qopt->qopt.count[i];
@@ -8173,7 +8174,6 @@ ice_validate_mqprio_qopt(struct ice_vsi *vsi,*/ max_rate = mqprio_qopt->max_rate[i]; max_rate =div_u64 (max_rate,ICE_BW_KBPS_DIVISOR ); - sum_max_rate += max_rate;/* min_rate is minimum guaranteed rate and it can't be zero */ min_rate = mqprio_qopt->min_rate[i];
@@ -8186,6 +8186,12 @@ ice_validate_mqprio_qopt(struct ice_vsi *vsi,return -EINVAL ; } +if (max_rate && max_rate > speed) { +dev_err (dev,"TC%d: max_rate(%llu Kbps) > link speed of %u Kbps\n" , + i, max_rate, speed); +return -EINVAL ; + } +iter_div_u64_rem (min_rate,ICE_MIN_BW_LIMIT , &rem);if (rem) { dev_err(dev, "TC%d: Min Rate not multiple of %u Kbps",
@@ -8223,12 +8229,6 @@ ice_validate_mqprio_qopt(struct ice_vsi *vsi, (mqprio_qopt->qopt.offset[i] + mqprio_qopt->qopt.count[i]))return -EINVAL ; - speed =ice_get_link_speed_kbps (vsi); -if (sum_max_rate && sum_max_rate > (u64 )speed) { -dev_err (dev,"Invalid max Tx rate(%llu) Kbps > speed(%u) Kbps specified\n" , - sum_max_rate, speed); -return -EINVAL ; - }if (sum_min_rate && sum_min_rate > (u64 )speed) {dev_err (dev,"Invalid min Tx rate(%llu) Kbps > speed (%u) Kbps specified\n" , sum_min_rate, speed);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 20/292 ice: Fix tx queue rate limit when TCs are configured
In reply to Greg Kroah-HartmanFrom: Sridhar Samudrala <[email protected]>
[ Upstream commit 479cdfe388a04a16fdd127f3e9e9e019e45e5573 ]
Configuring tx_maxrate via sysfs interface /sys/class/net/eth0/queues/tx-1/tx_maxrate was not working when TCs are configured because always main VSI was being used. Fix by using correct VSI in ice_set_tx_maxrate when TCs are configured.
--- drivers/net/ethernet/intel/ice/ice_main.c | 7 +++++++ drivers/net/ethernet/intel/ice/ice_tc_lib.c | 22 ++++++++++----------- drivers/net/ethernet/intel/ice/ice_tc_lib.h | 1 + 3 files changed, 19 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +7 -0
@@ -5969,6 +5969,13 @@ ice_set_tx_maxrate(struct net_device *netdev, int queue_index, u32 maxrate) q_handle = vsi->tx_rings[queue_index]->q_handle; tc =ice_dcb_get_tc (vsi, queue_index); + vsi =ice_locate_vsi_using_queue (vsi, queue_index); +if (!vsi) { +netdev_err (netdev,"Invalid VSI for given queue %d\n" , + queue_index); +return -EINVAL ; + } +/* Set BW back to default, when user set maxrate to 0 */ if (!maxrate) status = ice_cfg_q_bw_dflt_lmt(vsi->port_info, vsi->idx, tc,
drivers/net/ethernet/intel/ice/ice_tc_lib.c +11 -11
@@ -735,17 +735,16 @@ ice_eswitch_add_tc_fltr(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr)/** * ice_locate_vsi_using_queue - locate VSI using queue (forward to queue action) * @vsi: Pointer to VSI -* @tc_fltr: Pointer to tc_flower_filter +* @queue: Queue index * -* Locate the VSI using specified queue. When ADQ is not enabled, always -* return input VSI, otherwise locate corresponding VSI based on per channel -* offset and qcount +* Locate the VSI using specified "queue". When ADQ is not enabled, +* always return input VSI, otherwise locate corresponding +* VSI based on per channel "offset" and "qcount" */ -static struct ice_vsi * -ice_locate_vsi_using_queue (struct ice_vsi *vsi, -struct ice_tc_flower_fltr *tc_fltr) +struct ice_vsi * +ice_locate_vsi_using_queue (struct ice_vsi *vsi,int queue) { -int num_tc, tc, queue; +int num_tc, tc;/* if ADQ is not active, passed VSI is the candidate VSI */ if (!ice_is_adq_active (vsi->back))
@@ -755,7 +754,6 @@ ice_locate_vsi_using_queue(struct ice_vsi *vsi,* upon queue number) */ num_tc = vsi->mqprio_qopt.qopt.num_tc; - queue = tc_fltr->action.fwd.q.queue;for (tc =0 ; tc < num_tc; tc++) {int qcount = vsi->mqprio_qopt.qopt.count[tc];
@@ -797,6 +795,7 @@ ice_tc_forward_action(struct ice_vsi *vsi, struct ice_tc_flower_fltr *tc_fltr)struct ice_pf *pf = vsi->back;struct device *dev;u32 tc_class; +int q; dev =ice_pf_to_dev (pf);
@@ -825,7 +824,8 @@ ice_tc_forward_action(struct ice_vsi *vsi, struct ice_tc_flower_fltr *tc_fltr)/* Determine destination VSI even though the action is * FWD_TO_QUEUE, because QUEUE is associated with VSI */ - dest_vsi = tc_fltr->dest_vsi; + q = tc_fltr->action.fwd.q.queue; + dest_vsi =ice_locate_vsi_using_queue (vsi, q);break ;default : dev_err(dev,
@@ -1702,7 +1702,7 @@ ice_tc_forward_to_queue(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr,/* If ADQ is configured, and the queue belongs to ADQ VSI, then prepare * ADQ switch filter */ - ch_vsi =ice_locate_vsi_using_queue (vsi, fltr); + ch_vsi =ice_locate_vsi_using_queue (vsi, fltr->action.fwd.q.queue);if (!ch_vsi)return -EINVAL ; fltr->dest_vsi = ch_vsi;
drivers/net/ethernet/intel/ice/ice_tc_lib.h +1 -0
@@ -203,6 +203,7 @@ static inline int ice_chnl_dmac_fltr_cnt(struct ice_pf *pf)return pf->num_dmac_chnl_fltrs; } +struct ice_vsi *ice_locate_vsi_using_queue (struct ice_vsi *vsi,int queue);int ice_add_cls_flower (struct net_device *netdev,struct ice_vsi *vsi,struct flow_cls_offload *cls_flower);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 21/292 igc: Add condition for qbv_config_change_errors counter
In reply to Greg Kroah-HartmanFrom: Muhammad Husaini Zulkifli <[email protected]>
[ Upstream commit ed89b74d2dc920cb61d3094e0e97ec8775b13086 ]
Add condition to increase the qbv counter during taprio qbv configuration only.
There might be a case when TC already been setup then user configure the ETF/CBS qdisc and this counter will increase if no condition above.
--- drivers/net/ethernet/intel/igc/igc.h | 1 + drivers/net/ethernet/intel/igc/igc_main.c | 2 ++ drivers/net/ethernet/intel/igc/igc_tsn.c | 1 + 3 files changed, 4 insertions(+)
drivers/net/ethernet/intel/igc/igc.h +1 -0
@@ -184,6 +184,7 @@ struct igc_adapter {u32 max_frame_size;u32 min_frame_size; +int tc_setup_type;ktime_t base_time;ktime_t cycle_time;bool qbv_enable;
drivers/net/ethernet/intel/igc/igc_main.c +2 -0
@@ -6295,6 +6295,8 @@ static int igc_setup_tc(struct net_device *dev, enum tc_setup_type type, {struct igc_adapter *adapter =netdev_priv (dev); + adapter->tc_setup_type = type; +switch (type) {case TC_QUERY_CAPS :return igc_tc_query_caps (adapter, type_data);
drivers/net/ethernet/intel/igc/igc_tsn.c +1 -0
@@ -249,6 +249,7 @@ static int igc_tsn_enable_offload(struct igc_adapter *adapter)* Gate Control List (GCL) is running. */ if ((rd32 (IGC_BASET_H ) ||rd32 (IGC_BASET_L )) && + (adapter->tc_setup_type ==TC_SETUP_QDISC_TAPRIO ) && tsn_mode_reconfig) adapter->qbv_config_change_errors++; }else {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 22/292 igc: Remove delay during TX ring configuration
In reply to Greg Kroah-HartmanFrom: Muhammad Husaini Zulkifli <[email protected]>
[ Upstream commit cca28ceac7c7857bc2d313777017585aef00bcc4 ]
Remove unnecessary delay during the TX ring configuration. This will cause delay, especially during link down and link up activity.
Furthermore, old SKUs like as I225 will call the reset_adapter to reset the controller during TSN mode Gate Control List (GCL) setting. This will add more time to the configuration of the real-time use case.
It doesn't mentioned about this delay in the Software User Manual. It might have been ported from legacy code I210 in the past.
--- drivers/net/ethernet/intel/igc/igc_main.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/intel/igc/igc_main.c +0 -1
@@ -711,7 +711,6 @@ static void igc_configure_tx_ring(struct igc_adapter *adapter,/* disable the queue */ wr32 (IGC_TXDCTL (reg_idx),0 );wrfl (); -mdelay (10 );wr32 (IGC_TDLEN (reg_idx), ring->count *sizeof (union igc_adv_tx_desc ));
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 23/292 igc: Add igc_xdp_buff wrapper for xdp_buff in driver
In reply to Greg Kroah-HartmanFrom: Jesper Dangaard Brouer <[email protected]>
[ Upstream commit 73b7123de0cfa4f6609677e927ab02cb05b593c2 ]
Driver specific metadata data for XDP-hints kfuncs are propagated via tail extending the struct xdp_buff with a locally scoped driver struct.
Zero-Copy AF_XDP/XSK does similar tricks via struct xdp_buff_xsk. This xdp_buff_xsk struct contains a CB area (24 bytes) that can be used for extending the locally scoped driver into. The XSK_CHECK_PRIV_TYPE define catch size violations build time.
The changes needed for AF_XDP zero-copy in igc_clean_rx_irq_zc() is done in next patch, because the member rx_desc isn't available at this point.
Stable-dep-of: 175c241288c0 ("igc: Fix TX Hang issue when QBV Gate is closed")
--- drivers/net/ethernet/intel/igc/igc.h | 5 +++++ drivers/net/ethernet/intel/igc/igc_main.c | 16 +++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/igc/igc.h +5 -0
@@ -502,6 +502,11 @@ struct igc_rx_buffer { }; }; +/* context wrapper around xdp_buff to provide access to descriptor metadata */ +struct igc_xdp_buff { +struct xdp_buff xdp; +}; +struct igc_q_vector {struct igc_adapter *adapter;/* backlink */ void __iomem *itr_register;
drivers/net/ethernet/intel/igc/igc_main.c +9 -7
@@ -2246,6 +2246,8 @@ static bool igc_alloc_rx_buffers_zc(struct igc_ring *ring, u16 count)if (!count)return ok; +XSK_CHECK_PRIV_TYPE (struct igc_xdp_buff ); + desc =IGC_RX_DESC (ring, i); bi = &ring->rx_buffer_info[i]; i -= ring->count;
@@ -2530,8 +2532,8 @@ static int igc_clean_rx_irq(struct igc_q_vector *q_vector, const int budget)union igc_adv_rx_desc *rx_desc;struct igc_rx_buffer *rx_buffer;unsigned int size, truesize; +struct igc_xdp_buff ctx;ktime_t timestamp =0 ; -struct xdp_buff xdp;int pkt_offset =0 ;void *pktbuf;
@@ -2565,13 +2567,13 @@ static int igc_clean_rx_irq(struct igc_q_vector *q_vector, const int budget) }if (!skb) { -xdp_init_buff (&xdp, truesize, &rx_ring->xdp_rxq); -xdp_prepare_buff (&xdp, pktbuf -igc_rx_offset (rx_ring), +xdp_init_buff (&ctx.xdp, truesize, &rx_ring->xdp_rxq); +xdp_prepare_buff (&ctx.xdp, pktbuf -igc_rx_offset (rx_ring),igc_rx_offset (rx_ring) + pkt_offset, size, true); -xdp_buff_clear_frags_flag (&xdp); +xdp_buff_clear_frags_flag (&ctx.xdp); - skb =igc_xdp_run_prog (adapter, &xdp); + skb =igc_xdp_run_prog (adapter, &ctx.xdp); }if (IS_ERR (skb)) {
@@ -2593,9 +2595,9 @@ static int igc_clean_rx_irq(struct igc_q_vector *q_vector, const int budget) }else if (skb)igc_add_rx_frag (rx_ring, rx_buffer, skb, size);else if (ring_uses_build_skb (rx_ring)) - skb =igc_build_skb (rx_ring, rx_buffer, &xdp); + skb =igc_build_skb (rx_ring, rx_buffer, &ctx.xdp);else - skb =igc_construct_skb (rx_ring, rx_buffer, &xdp, + skb =igc_construct_skb (rx_ring, rx_buffer, &ctx.xdp, timestamp);/* exit if we failed to retrieve a buffer */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 24/292 igc: Add XDP hints kfuncs for RX hash
In reply to Greg Kroah-HartmanFrom: Jesper Dangaard Brouer <[email protected]>
[ Upstream commit 8416814fffa9cfa74c18da149f522dd9e1850987 ]
This implements XDP hints kfunc for RX-hash (xmo_rx_hash). The HW rss hash type is handled via mapping table.
This igc driver (default config) does L3 hashing for UDP packets (excludes UDP src/dest ports in hash calc). Meaning RSS hash type is L3 based. Tested that the igc_rss_type_num for UDP is either IGC_RSS_TYPE_HASH_IPV4 or IGC_RSS_TYPE_HASH_IPV6.
This patch also updates AF_XDP zero-copy function igc_clean_rx_irq_zc() to use the xdp_buff wrapper struct igc_xdp_buff.
Stable-dep-of: 175c241288c0 ("igc: Fix TX Hang issue when QBV Gate is closed")
--- drivers/net/ethernet/intel/igc/igc.h | 1 + drivers/net/ethernet/intel/igc/igc_main.c | 53 +++++++++++++++++++++++ 2 files changed, 54 insertions(+)
drivers/net/ethernet/intel/igc/igc.h +1 -0
@@ -505,6 +505,7 @@ struct igc_rx_buffer {/* context wrapper around xdp_buff to provide access to descriptor metadata */ struct igc_xdp_buff {struct xdp_buff xdp; +union igc_adv_rx_desc *rx_desc; };struct igc_q_vector {
drivers/net/ethernet/intel/igc/igc_main.c +53 -0
89 lines not on this page · raw message
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 25/292 igc: Fix TX Hang issue when QBV Gate is closed
In reply to Greg Kroah-HartmanFrom: Muhammad Husaini Zulkifli <[email protected]>
[ Upstream commit 175c241288c09f81eb7b44d65c1ef6045efa4d1a ]
If a user schedules a Gate Control List (GCL) to close one of the QBV gates while also transmitting a packet to that closed gate, TX Hang will be happen. HW would not drop any packet when the gate is closed and keep queuing up in HW TX FIFO until the gate is re-opened. This patch implements the solution to drop the packet for the closed gate.
This patch will also reset the adapter to perform SW initialization for each 1st Gate Control List (GCL) to avoid hang.
This is due to the HW design, where changing to TSN transmit mode requires SW initialization. Intel Discrete I225/6 transmit mode cannot be changed when in dynamic mode according to Software User Manual Section 7.5.2.1. Subsequent Gate Control List (GCL) operations will proceed without a reset, as they already are in TSN Mode.
Step to reproduce:
DUT:
1) Configure GCL List with certain gate close.
BASE=$(date +%s%N)
tc qdisc replace dev $IFACE parent root handle 100 taprio \
num_tc 4 \
map 0 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 \
queues 1@0 1@1 1@2 1@3 \
base-time $BASE \
sched-entry S 0x8 500000 \
sched-entry S 0x4 500000 \
flags 0x22) Transmit the packet to closed gate. You may use udp_tai application to transmit UDP packet to any of the closed gate.
./udp_tai -i <interface> -P 100000 -p 90 -c 1 -t <0/1> -u 30004
--- drivers/net/ethernet/intel/igc/igc.h | 6 +++ drivers/net/ethernet/intel/igc/igc_main.c | 58 +++++++++++++++++++++-- drivers/net/ethernet/intel/igc/igc_tsn.c | 41 ++++++++++------ 3 files changed, 87 insertions(+), 18 deletions(-)
drivers/net/ethernet/intel/igc/igc.h +6 -0
@@ -14,6 +14,7 @@#include <linux/timecounter.h> #include <linux/net_tstamp.h> #include <linux/bitfield.h> +#include <linux/hrtimer.h> #include "igc_hw.h"
@@ -101,6 +102,8 @@ struct igc_ring {u32 start_time;u32 end_time;u32 max_sdu; +bool oper_gate_closed;/* Operating gate. True if the TX Queue is closed */ +bool admin_gate_closed;/* Future gate. True if the TX Queue will be closed */ /* CBS parameters */ bool cbs_enable;/* indicates if CBS is enabled */
@@ -160,6 +163,7 @@ struct igc_adapter {struct timer_list watchdog_timer;struct timer_list dma_err_timer;struct timer_list phy_info_timer; +struct hrtimer hrtimer;u32 wol;u32 en_mng_pt;
@@ -189,6 +193,8 @@ struct igc_adapter {ktime_t cycle_time;bool qbv_enable;u32 qbv_config_change_errors; +bool qbv_transition; +unsigned int qbv_count;/* OS defined structs */ struct pci_dev *pdev;
drivers/net/ethernet/intel/igc/igc_main.c +54 -4
125 lines not on this page · raw message
drivers/net/ethernet/intel/igc/igc_tsn.c +27 -14
69 lines not on this page · raw message
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 26/292 net/mlx5e: fix double free in mlx5e_destroy_flow_table
In reply to Greg Kroah-HartmanFrom: Zhengchao Shao <[email protected]>
[ Upstream commit 884abe45a9014d0de2e6edb0630dfd64f23f1d1b ]
In function accel_fs_tcp_create_groups(), when the ft->g memory is successfully allocated but the 'in' memory fails to be allocated, the memory pointed to by ft->g is released once. And in function accel_fs_tcp_create_table, mlx5e_destroy_flow_table is called to release the memory pointed to by ft->g again. This will cause double free problem.
--- drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c +1 -0
@@ -190,6 +190,7 @@ static int accel_fs_tcp_create_groups(struct mlx5e_flow_table *ft, in =kvzalloc (inlen,GFP_KERNEL );if (!in || !ft->g) {kfree (ft->g); + ft->g =NULL ;kvfree (in);return -ENOMEM ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 27/292 net/mlx5e: fix memory leak in mlx5e_fs_tt_redirect_any_create
In reply to Greg Kroah-HartmanFrom: Zhengchao Shao <[email protected]>
[ Upstream commit 3250affdc658557a41df9c5fb567723e421f8bf2 ]
The memory pointed to by the fs->any pointer is not freed in the error path of mlx5e_fs_tt_redirect_any_create, which can lead to a memory leak. Fix by freeing the memory in the error path, thereby making the error path identical to mlx5e_fs_tt_redirect_any_destroy().
--- drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c +3 -3
@@ -594,7 +594,7 @@ int mlx5e_fs_tt_redirect_any_create(struct mlx5e_flow_steering *fs) err =fs_any_create_table (fs);if (err) -return err; + goto err_free_any; err =fs_any_enable (fs);if (err)
@@ -606,8 +606,8 @@ int mlx5e_fs_tt_redirect_any_create(struct mlx5e_flow_steering *fs) err_destroy_table:fs_any_destroy_table (fs_any); - -kfree (fs_any); +err_free_any:mlx5e_fs_set_any (fs,NULL ); +kfree (fs_any);return err; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 28/292 net/mlx5e: fix memory leak in mlx5e_ptp_open
In reply to Greg Kroah-HartmanFrom: Zhengchao Shao <[email protected]>
[ Upstream commit d543b649ffe58a0cb4b6948b3305069c5980a1fa ]
When kvzalloc_node or kvzalloc failed in mlx5e_ptp_open, the memory pointed by "c" or "cparams" is not freed, which can lead to a memory leak. Fix by freeing the array in the error path.
--- drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +4 -2
@@ -729,8 +729,10 @@ int mlx5e_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params, c =kvzalloc_node (sizeof (*c),GFP_KERNEL ,dev_to_node (mlx5_core_dma_dev (mdev))); cparams =kvzalloc (sizeof (*cparams),GFP_KERNEL ); -if (!c || !cparams) -return -ENOMEM ; +if (!c || !cparams) { + err = -ENOMEM ; + goto err_free; + } c->priv = priv; c->mdev = priv->mdev;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 29/292 net/mlx5e: RX, Fix flush and close release flow of regular rq for legacy rq
In reply to Greg Kroah-HartmanFrom: Dragos Tatulea <[email protected]>
[ Upstream commit 2e2d1965794d22fbe86df45bf4f933216743577d ]
Regular (non-XSK) RQs get flushed on XSK setup and re-activated on XSK close. If the same regular RQ is closed (a config change for example) soon after the XSK close, a double release occurs because the missing wqes get released a second time.
--- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +10 -2
@@ -390,10 +390,18 @@ static void mlx5e_dealloc_rx_wqe(struct mlx5e_rq *rq, u16 ix) {struct mlx5e_wqe_frag_info *wi =get_frag (rq, ix); -if (rq->xsk_pool) +if (rq->xsk_pool) {mlx5e_xsk_free_rx_wqe (wi); -else + }else {mlx5e_free_rx_wqe (rq, wi); + +/* Avoid a second release of the wqe pages: dealloc is called +* for the same missing wqes on regular RQ flush and on regular +* RQ close. This happens when XSK RQs come into play. +*/ +for (int i =0 ; i < rq->wqe.info.num_frags; i++, wi++) + wi->flags |=BIT (MLX5E_WQE_FRAG_SKIP_RELEASE ); + } }static void mlx5e_xsk_free_rx_wqes (struct mlx5e_rq *rq,u16 ix,int wqe_bulk)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 30/292 net/mlx5: Register a unique thermal zone per device
In reply to Greg Kroah-HartmanFrom: Saeed Mahameed <[email protected]>
[ Upstream commit 631079e08aa4a20b73e70de4cf457886194f029f ]
Prior to this patch only one "mlx5" thermal zone could have been registered regardless of the number of individual mlx5 devices in the system.
To fix this setup a unique name per device to register its own thermal zone.
In order to not register a thermal zone for a virtual device (VF/SF) add a check for PF device type.
The new name is a concatenation between "mlx5_" and "<PCI_DEV_BDF>", which will also help associating a thermal zone with its PCI device.
$ lspci | grep ConnectX 00:04.0 Ethernet controller: Mellanox Technologies MT2892 Family [ConnectX-6 Dx] 00:05.0 Ethernet controller: Mellanox Technologies MT2892 Family [ConnectX-6 Dx]
$ cat /sys/devices/virtual/thermal/thermal_zone0/type mlx5_0000:00:04.0 $ cat /sys/devices/virtual/thermal/thermal_zone1/type mlx5_0000:00:05.0
--- .../net/ethernet/mellanox/mlx5/core/thermal.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/thermal.c +12 -7
@@ -68,14 +68,19 @@ static struct thermal_zone_device_ops mlx5_thermal_ops = {int mlx5_thermal_init (struct mlx5_core_dev *mdev) { +char data[THERMAL_NAME_LENGTH ];struct mlx5_thermal *thermal; -struct thermal_zone_device *tzd; -const char *data ="mlx5" ; +int err; - tzd =thermal_zone_get_zone_by_name (data); -if (!IS_ERR (tzd)) +if (!mlx5_core_is_pf (mdev) && !mlx5_core_is_ecpf (mdev))return 0 ; + err =snprintf (data,sizeof (data),"mlx5_%s" ,dev_name (mdev->device)); +if (err <0 || err >=sizeof (data)) { +mlx5_core_err (mdev,"Failed to setup thermal zone name, %d\n" , err); +return -EINVAL ; + } + thermal =kzalloc (sizeof (*thermal),GFP_KERNEL );if (!thermal)return -ENOMEM ;
@@ -88,10 +93,10 @@ int mlx5_thermal_init(struct mlx5_core_dev *mdev) &mlx5_thermal_ops, NULL, 0, MLX5_THERMAL_POLL_INT_MSEC);if (IS_ERR (thermal->tzdev)) { -dev_err (mdev->device,"Failed to register thermal zone device (%s) %ld\n" , - data,PTR_ERR (thermal->tzdev)); + err =PTR_ERR (thermal->tzdev); +mlx5_core_err (mdev,"Failed to register thermal zone device (%s) %d\n" , data, err);kfree (thermal); -return -EINVAL ; +return err; } mdev->thermal = thermal;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 31/292 net/mlx5e: Check for NOT_READY flag state after locking
In reply to Greg Kroah-HartmanFrom: Vlad Buslov <[email protected]>
[ Upstream commit 65e64640e97c0f223e77f9ea69b5a46186b93470 ]
Currently the check for NOT_READY flag is performed before obtaining the necessary lock. This opens a possibility for race condition when the flow is concurrently removed from unready_flows list by the workqueue task, which causes a double-removal from the list and a crash[0]. Fix the issue by moving the flag check inside the section protected by uplink_priv->unready_flows_lock mutex.
[0]:
[44376.389654] general protection fault, probably for non-canonical address 0xdead000000000108: 0000 [#1] SMP [44376.391665] CPU: 7 PID: 59123 Comm: tc Not tainted 6.4.0-rc4+ #1 [44376.392984] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 [44376.395342] RIP: 0010:mlx5e_tc_del_fdb_flow+0xb3/0x340 [mlx5_core] [44376.396857] Code: 00 48 8b b8 68 ce 02 00 e8 8a 4d 02 00 4c 8d a8 a8 01 00 00 4c 89 ef e8 8b 79 88 e1 48 8b 83 98 06 00 00 48 8b 93 90 06 00 00 <48> 89 42 08 48 89 10 48 b8 00 01 00 00 00 00 ad de 48 89 83 90 06 [44376.399167] RSP: 0018:ffff88812cc97570 EFLAGS: 00010246 [44376.399680] RAX: dead000000000122 RBX: ffff8881088e3800 RCX: ffff8881881bac00 [44376.400337] RDX: dead000000000100 RSI: ffff88812cc97500 RDI: ffff8881242f71b0 [44376.401001] RBP: ffff88811cbb0940 R08: 0000000000000400 R09: 0000000000000001 [44376.401663] R10: 0000000000000001 R11: 0000000000000000 R12: ffff88812c944000 [44376.402342] R13: ffff8881242f71a8 R14: ffff8881222b4000 R15: 0000000000000000 [44376.402999] FS: 00007f0451104800(0000) GS:ffff88852cb80000(0000) knlGS:0000000000000000 [44376.403787] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [44376.404343] CR2: 0000000000489108 CR3: 0000000123a79003 CR4: 0000000000370ea0 [44376.405004] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [44376.405665] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [44376.406339] Call Trace: [44376.406651] <TASK> [44376.406939] ? die_addr+0x33/0x90 [44376.407311] ? exc_general_protection+0x192/0x390 [44376.407795] ? asm_exc_general_protection+0x22/0x30 [44376.408292] ? mlx5e_tc_del_fdb_flow+0xb3/0x340 [mlx5_core] [44376.408876] __mlx5e_tc_del_fdb_peer_flow+0xbc/0xe0 [mlx5_core] [44376.409482] mlx5e_tc_del_flow+0x42/0x210 [mlx5_core] [44376.410055] mlx5e_flow_put+0x25/0x50 [mlx5_core] [44376.410529] mlx5e_delete_flower+0x24b/0x350 [mlx5_core] [44376.411043] tc_setup_cb_reoffload+0x22/0x80 [44376.411462] fl_reoffload+0x261/0x2f0 [cls_flower] [44376.411907] ? mlx5e_rep_indr_setup_ft_cb+0x160/0x160 [mlx5_core] [44376.412481] ? mlx5e_rep_indr_setup_ft_cb+0x160/0x160 [mlx5_core] [44376.413044] tcf_block_playback_offloads+0x76/0x170 [44376.413497] tcf_block_unbind+0x7b/0xd0 [44376.413881] tcf_block_setup+0x17d/0x1c0 [44376.414269] tcf_block_offload_cmd.isra.0+0xf1/0x130 [44376.414725] tcf_block_offload_unbind+0x43/0x70 [44376.415153] __tcf_block_put+0x82/0x150 [44376.415532] ingress_destroy+0x22/0x30 [sch_ingress] [44376.415986] qdisc_destroy+0x3b/0xd0 [44376.416343] qdisc_graft+0x4d0/0x620 [44376.416706] tc_get_qdisc+0x1c9/0x3b0 [44376.417074] rtnetlink_rcv_msg+0x29c/0x390 [44376.419978] ? rep_movs_alternative+0x3a/0xa0 [44376.420399] ? rtnl_calcit.isra.0+0x120/0x120 [44376.420813] netlink_rcv_skb+0x54/0x100 [44376.421192] netlink_unicast+0x1f6/0x2c0 [44376.421573] netlink_sendmsg+0x232/0x4a0 [44376.421980] sock_sendmsg+0x38/0x60 [44376.422328] ____sys_sendmsg+0x1d0/0x1e0 [44376.422709] ? copy_msghdr_from_user+0x6d/0xa0 [44376.423127] ___sys_sendmsg+0x80/0xc0 [44376.423495] ? ___sys_recvmsg+0x8b/0xc0 [44376.423869] __sys_sendmsg+0x51/0x90 [44376.424226] do_syscall_64+0x3d/0x90 [44376.424587] entry_SYSCALL_64_after_hwframe+0x46/0xb0 [44376.425046] RIP: 0033:0x7f045134f887 [44376.425403] Code: 0a 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b9 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 89 54 24 1c 48 89 74 24 10 [44376.426914] RSP: 002b:00007ffd63a82b98 EFLAGS: 00000246 ORIG_RAX: 000000000000002e [44376.427592] RAX: ffffffffffffffda RBX: 000000006481955f RCX: 00007f045134f887 [44376.428195] RDX: 0000000000000000 RSI: 00007ffd63a82c00 RDI: 0000000000000003 [44376.428796] RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000 [44376.429404] R10: 00007f0451208708 R11: 0000000000000246 R12: 0000000000000001 [44376.430039] R13: 0000000000409980 R14: 000000000047e538 R15: 0000000000485400 [44376.430644] </TASK> [44376.430907] Modules linked in: mlx5_ib mlx5_core act_mirred act_tunnel_key cls_flower vxlan dummy sch_ingress openvswitch nsh rpcrdma rdma_ucm ib_iser libiscsi scsi_transport_iscsi ib_umad rdma_cm ib_ipoib iw_cm ib_cm ib_uverbs ib_core xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xt_addrtype iptable_nat nf_nat br_netfilter rpcsec_g ss_krb5 auth_rpcgss oid_registry overlay zram zsmalloc fuse [last unloaded: mlx5_core] [44376.433936] ---[ end trace 0000000000000000 ]--- [44376.434373] RIP: 0010:mlx5e_tc_del_fdb_flow+0xb3/0x340 [mlx5_core] [44376.434951] Code: 00 48 8b b8 68 ce 02 00 e8 8a 4d 02 00 4c 8d a8 a8 01 00 00 4c 89 ef e8 8b 79 88 e1 48 8b 83 98 06 00 00 48 8b 93 90 06 00 00 <48> 89 42 08 48 89 10 48 b8 00 01 00 00 00 00 ad de 48 89 83 90 06 [44376.436452] RSP: 0018:ffff88812cc97570 EFLAGS: 00010246 [44376.436924] RAX: dead000000000122 RBX: ffff8881088e3800 RCX: ffff8881881bac00 [44376.437530] RDX: dead000000000100 RSI: ffff88812cc97500 RDI: ffff8881242f71b0 [44376.438179] RBP: ffff88811cbb0940 R08: 0000000000000400 R09: 0000000000000001 [44376.438786] R10: 0000000000000001 R11: 0000000000000000 R12: ffff88812c944000 [44376.439393] R13: ffff8881242f71a8 R14: ffff8881222b4000 R15: 0000000000000000 [44376.439998] FS: 00007f0451104800(0000) GS:ffff88852cb80000(0000) knlGS:0000000000000000 [44376.440714] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [44376.441225] CR2: 0000000000489108 CR3: 0000000123a79003 CR4: 0000000000370ea0 [44376.441843] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [44376.442471] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +3 -3
@@ -1639,7 +1639,8 @@ static void remove_unready_flow(struct mlx5e_tc_flow *flow) uplink_priv = &rpriv->uplink_priv;mutex_lock (&uplink_priv->unready_flows_lock); -unready_flow_del (flow); +if (flow_flag_test (flow,NOT_READY )) +unready_flow_del (flow);mutex_unlock (&uplink_priv->unready_flows_lock); }
@@ -1932,8 +1933,7 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv, esw_attr = attr->esw_attr;mlx5e_put_flow_tunnel_id (flow); -if (flow_flag_test (flow,NOT_READY )) -remove_unready_flow (flow); +remove_unready_flow (flow);if (mlx5e_is_offloaded_flow (flow)) {if (flow_flag_test (flow,SLOW ))
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 32/292 net/mlx5e: TC, CT: Offload ct clear only once
In reply to Greg Kroah-HartmanFrom: Yevgeny Kliteynik <[email protected]>
[ Upstream commit f7a485115ad4cfc560833942014bf791abf1f827 ]
Non-clear CT action causes a flow rule split, while CT clear action doesn't and is just a header-rewrite to the current flow rule. But ct offload is done in post_parse and is per ct action instance, so ct clear offload is parsed multiple times, while its deleted once.
Fix this by post_parsing the ct action only once per flow attribute (which is per flow rule) by using a offloaded ct_attr flag.
--- drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 14 +++++++++++--- drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +11 -3
@@ -1545,7 +1545,8 @@ mlx5_tc_ct_parse_action(struct mlx5_tc_ct_priv *priv, attr->ct_attr.ct_action |= act->ct.action;/* So we can have clear + ct */ attr->ct_attr.zone = act->ct.zone; - attr->ct_attr.nf_ft = act->ct.flow_table; +if (!(act->ct.action &TCA_CT_ACT_CLEAR )) + attr->ct_attr.nf_ft = act->ct.flow_table; attr->ct_attr.act_miss_cookie = act->miss_cookie;return 0 ;
@@ -1990,6 +1991,9 @@ mlx5_tc_ct_flow_offload(struct mlx5_tc_ct_priv *priv, struct mlx5_flow_attr *attif (!priv)return -EOPNOTSUPP ; +if (attr->ct_attr.offloaded) +return 0 ; +if (attr->ct_attr.ct_action &TCA_CT_ACT_CLEAR ) { err =mlx5_tc_ct_entry_set_registers (priv, &attr->parse_attr->mod_hdr_acts,0 ,0 ,0 ,0 );
@@ -1999,11 +2003,15 @@ mlx5_tc_ct_flow_offload(struct mlx5_tc_ct_priv *priv, struct mlx5_flow_attr *att attr->action |=MLX5_FLOW_CONTEXT_ACTION_MOD_HDR ; } -if (!attr->ct_attr.nf_ft)/* means only ct clear action, and not ct_clear,ct() */ +if (!attr->ct_attr.nf_ft) {/* means only ct clear action, and not ct_clear,ct() */ + attr->ct_attr.offloaded = true;return 0 ; + }mutex_lock (&priv->control_lock); err =__mlx5_tc_ct_flow_offload (priv, attr); +if (!err) + attr->ct_attr.offloaded = true;mutex_unlock (&priv->control_lock);return err;
@@ -2021,7 +2029,7 @@ void mlx5_tc_ct_delete_flow(struct mlx5_tc_ct_priv *priv, struct mlx5_flow_attr *attr) { -if (!attr->ct_attr.ft)/* no ct action, return */ +if (!attr->ct_attr.offloaded)/* no ct action, return */ return ;if (!attr->ct_attr.nf_ft)/* means only ct clear action, and not ct_clear,ct() */ return ;
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h +1 -0
@@ -29,6 +29,7 @@ struct mlx5_ct_attr {u32 ct_labels_id;u32 act_miss_mapping;u64 act_miss_cookie; +bool offloaded;struct mlx5_ct_ft *ft; };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 33/292 net/mlx5: Query hca_cap_2 only when supported
In reply to Greg Kroah-HartmanFrom: Maher Sanalla <[email protected]>
[ Upstream commit 6496357aa5f710eec96f91345b9da1b37c3231f6 ]
On vport enable, where fw's hca caps are queried, the driver queries hca_caps_2 without checking if fw truly supports them, causing a false failure of vfs vport load and blocking SRIOV enablement on old devices such as CX4 where hca_caps_2 support is missing.
Thus, add a check for the said caps support before accessing them.
--- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +3 -0
@@ -800,6 +800,9 @@ static int mlx5_esw_vport_caps_get(struct mlx5_eswitch *esw, struct mlx5_vport * hca_caps =MLX5_ADDR_OF (query_hca_cap_out, query_ctx, capability); vport->info.roce_enabled =MLX5_GET (cmd_hca_cap, hca_caps, roce); +if (!MLX5_CAP_GEN_MAX (esw->dev, hca_cap_2)) + goto out_free; +memset (query_ctx,0 , query_out_sz); err =mlx5_vport_get_other_func_cap (esw->dev, vport->vport, query_ctx,MLX5_CAP_GENERAL_2 );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 34/292 net/mlx5e: RX, Fix page_pool page fragment tracking for XDP
In reply to Greg Kroah-HartmanFrom: Dragos Tatulea <[email protected]>
[ Upstream commit 7abd955a58fb0fcd4e756fa2065c03ae488fcfa7 ]
Currently mlx5e releases pages directly to the page_pool for XDP_TX and does page fragment counting for XDP_REDIRECT. RX pages from the page_pool are leaking on XDP_REDIRECT because the xdp core will release only one fragment out of MLX5E_PAGECNT_BIAS_MAX and subsequently the page is marked as "skip release" which avoids the driver release.
A fix would be to take an extra fragment for XDP_REDIRECT and not set the "skip release" bit so that the release on the driver side can handle the remaining bias fragments. But this would be a shortsighted solution. Instead, this patch converges the two XDP paths (XDP_TX and XDP_REDIRECT) to always do fragment tracking. The "skip release" bit is no longer necessary for XDP.
--- .../net/ethernet/mellanox/mlx5/core/en/xdp.c | 3 +- .../net/ethernet/mellanox/mlx5/core/en_rx.c | 32 +++++++------------ 2 files changed, 13 insertions(+), 22 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c +1 -2
@@ -662,8 +662,7 @@ static void mlx5e_free_xdpsq_desc(struct mlx5e_xdpsq *sq,/* No need to check ((page->pp_magic & ~0x3UL) == PP_SIGNATURE) * as we know this is a page_pool page. */ -page_pool_put_defragged_page (page->pp, - page,-1 , true); +page_pool_recycle_direct (page->pp, page); }while (++n < num);break ;
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +12 -20
@@ -1753,11 +1753,11 @@ mlx5e_skb_from_cqe_nonlinear(struct mlx5e_rq *rq, struct mlx5e_wqe_frag_info *wi prog =rcu_dereference (rq->xdp_prog);if (prog &&mlx5e_xdp_handle (rq, prog, &mxbuf)) { -if (test_bit (MLX5E_RQ_FLAG_XDP_XMIT , rq->flags)) { +if (__test_and_clear_bit (MLX5E_RQ_FLAG_XDP_XMIT , rq->flags)) {struct mlx5e_wqe_frag_info *pwi;for (pwi = head_wi; pwi < wi; pwi++) - pwi->flags |=BIT (MLX5E_WQE_FRAG_SKIP_RELEASE ); + pwi->frag_page->frags++; }return NULL ;/* page/packet was consumed by XDP */ }
@@ -1827,12 +1827,8 @@ static void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe) rq, wi, cqe, cqe_bcnt);if (!skb) {/* probably for XDP */ -if (__test_and_clear_bit (MLX5E_RQ_FLAG_XDP_XMIT , rq->flags)) { -/* do not return page to cache, -* it will be returned on XDP_TX completion. -*/ - wi->flags |=BIT (MLX5E_WQE_FRAG_SKIP_RELEASE ); - } +if (__test_and_clear_bit (MLX5E_RQ_FLAG_XDP_XMIT , rq->flags)) + wi->frag_page->frags++; goto wq_cyc_pop; }
@@ -1878,12 +1874,8 @@ static void mlx5e_handle_rx_cqe_rep(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe) rq, wi, cqe, cqe_bcnt);if (!skb) {/* probably for XDP */ -if (__test_and_clear_bit (MLX5E_RQ_FLAG_XDP_XMIT , rq->flags)) { -/* do not return page to cache, -* it will be returned on XDP_TX completion. -*/ - wi->flags |=BIT (MLX5E_WQE_FRAG_SKIP_RELEASE ); - } +if (__test_and_clear_bit (MLX5E_RQ_FLAG_XDP_XMIT , rq->flags)) + wi->frag_page->frags++; goto wq_cyc_pop; }
@@ -2062,12 +2054,12 @@ mlx5e_skb_from_cqe_mpwrq_nonlinear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wif (prog) {if (mlx5e_xdp_handle (rq, prog, &mxbuf)) {if (__test_and_clear_bit (MLX5E_RQ_FLAG_XDP_XMIT , rq->flags)) { -int i; +struct mlx5e_frag_page *pfp; + +for (pfp = head_page; pfp < frag_page; pfp++) + pfp->frags++; -for (i =0 ; i < sinfo->nr_frags; i++) -/* non-atomic */ -__set_bit (page_idx + i, wi->skip_release_bitmap); -return NULL ; + wi->linear_page.frags++; }mlx5e_page_release_fragmented (rq, &wi->linear_page);return NULL ;/* page/packet was consumed by XDP */
@@ -2165,7 +2157,7 @@ mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, cqe_bcnt, &mxbuf);if (mlx5e_xdp_handle (rq, prog, &mxbuf)) {if (__test_and_clear_bit (MLX5E_RQ_FLAG_XDP_XMIT , rq->flags)) -__set_bit (page_idx, wi->skip_release_bitmap);/* non-atomic */ + frag_page->frags++;return NULL ;/* page/packet was consumed by XDP */ }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 35/292 igc: set TP bit in supported and advertising fields of ethtool_link_ksettings
In reply to Greg Kroah-HartmanFrom: Prasad Koya <[email protected]>
[ Upstream commit 9ac3fc2f42e5ffa1e927dcbffb71b15fa81459e2 ]
set TP bit in the 'supported' and 'advertising' fields. i225/226 parts only support twisted pair copper.
--- drivers/net/ethernet/intel/igc/igc_ethtool.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/igc/igc_ethtool.c +2 -0
@@ -1708,6 +1708,8 @@ static int igc_ethtool_get_link_ksettings(struct net_device *netdev,/* twisted pair */ cmd->base.port =PORT_TP ; cmd->base.phy_address = hw->phy.addr; +ethtool_link_ksettings_add_link_mode (cmd, supported,TP ); +ethtool_link_ksettings_add_link_mode (cmd, advertising,TP );/* advertising link modes */ if (hw->phy.autoneg_advertised &ADVERTISE_10_HALF )
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 36/292 igc: Include the length/type field and VLAN tag in queueMaxSDU
In reply to Greg Kroah-HartmanFrom: Tan Tee Min <[email protected]>
[ Upstream commit 25102893e409bc02761ab82dbcfa092006404790 ]
IEEE 802.1Q does not have clear definitions of what constitutes an SDU (Service Data Unit), but IEEE Std 802.3 clause 3.1.2 does define the MAC service primitives and clause 3.2.7 does define the MAC Client Data for Q-tagged frames.
It shows that the mac_service_data_unit (MSDU) does NOT contain the preamble, destination and source address, or FCS. The MSDU does contain the length/type field, MAC client data, VLAN tag and any padding data (prior to the FCS).
Thus, the maximum 802.3 frame size that is allowed to be transmitted should be QueueMaxSDU (MSDU) + 16 (6 byte SA + 6 byte DA + 4 byte FCS).
--- drivers/net/ethernet/intel/igc/igc_main.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +4 -11
@@ -1575,16 +1575,9 @@ static netdev_tx_t igc_xmit_frame_ring(struct sk_buff *skb,if (adapter->qbv_transition || tx_ring->oper_gate_closed) goto out_drop; -if (tx_ring->max_sdu >0 ) { -u32 max_sdu =0 ; - - max_sdu = tx_ring->max_sdu + - (skb_vlan_tagged (first->skb) ?VLAN_HLEN :0 ); - -if (first->bytecount > max_sdu) { - adapter->stats.txdrop++; - goto out_drop; - } +if (tx_ring->max_sdu >0 && first->bytecount > tx_ring->max_sdu) { + adapter->stats.txdrop++; + goto out_drop; } if (unlikely(test_bit(IGC_RING_FLAG_TX_HWTSTAMP, &tx_ring->flags) &&
@@ -6215,7 +6208,7 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter,struct net_device *dev = adapter->netdev;if (qopt->max_sdu[i]) - ring->max_sdu = qopt->max_sdu[i] + dev->hard_header_len; + ring->max_sdu = qopt->max_sdu[i] + dev->hard_header_len -ETH_TLEN ;else ring->max_sdu =0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 37/292 igc: Handle PPS start time programming for past time values
In reply to Greg Kroah-HartmanFrom: Aravindhan Gunasekaran <[email protected]>
[ Upstream commit 84a192e46106355de1a314d709e657231d4b1026 ]
I225/6 hardware can be programmed to start PPS output once the time in Target Time registers is reached. The time programmed in these registers should always be into future. Only then PPS output is triggered when SYSTIM register reaches the programmed value. There are two modes in i225/6 hardware to program PPS, pulse and clock mode.
There were issues reported where PPS is not generated when start time is in past.
Example 1, "echo 0 0 0 2 0 > /sys/class/ptp/ptp0/period"
In the current implementation, a value of '0' is programmed into Target time registers and PPS output is in pulse mode. Eventually an interrupt which is triggered upon SYSTIM register reaching Target time is not fired. Thus no PPS output is generated.
Example 2, "echo 0 0 0 1 0 > /sys/class/ptp/ptp0/period"
Above case, a value of '0' is programmed into Target time registers and PPS output is in clock mode. Here, HW tries to catch-up the current time by incrementing Target Time register. This catch-up time seem to vary according to programmed PPS period time as per the HW design. In my experiments, the delay ranged between few tens of seconds to few minutes. The PPS output is only generated after the Target time register reaches current time.
In my experiments, I also observed PPS stopped working with below test and could not recover until module is removed and loaded again.
1) echo 0 <future time> 0 1 0 > /sys/class/ptp/ptp1/period
2) echo 0 0 0 1 0 > /sys/class/ptp/ptp1/period
3) echo 0 0 0 1 0 > /sys/class/ptp/ptp1/period
After this PPS did not work even if i re-program with proper values. I could only get this back working by reloading the driver.
This patch takes care of calculating and programming appropriate future time value into Target Time registers.
--- drivers/net/ethernet/intel/igc/igc_ptp.c | 25 +++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/igc/igc_ptp.c +22 -3
@@ -356,16 +356,35 @@ static int igc_ptp_feature_enable_i225(struct ptp_clock_info *ptp, tsim &= ~IGC_TSICR_TT0 ; }if (on) { +struct timespec64 safe_start;int i = rq->perout.index;igc_pin_perout (igc, i, pin, use_freq); - igc->perout[i].start.tv_sec = rq->perout.start.sec; +igc_ptp_read (igc, &safe_start); + +/* PPS output start time is triggered by Target time(TT) +* register. Programming any past time value into TT +* register will cause PPS to never start. Need to make +* sure we program the TT register a time ahead in +* future. There isn't a stringent need to fire PPS out +* right away. Adding +2 seconds should take care of +* corner cases. Let's say if the SYSTIML is close to +* wrap up and the timer keeps ticking as we program the +* register, adding +2seconds is safe bet. +*/ + safe_start.tv_sec +=2 ; + +if (rq->perout.start.sec < safe_start.tv_sec) + igc->perout[i].start.tv_sec = safe_start.tv_sec; +else + igc->perout[i].start.tv_sec = rq->perout.start.sec; igc->perout[i].start.tv_nsec = rq->perout.start.nsec; igc->perout[i].period.tv_sec = ts.tv_sec; igc->perout[i].period.tv_nsec = ts.tv_nsec; -wr32 (trgttimh, rq->perout.start.sec); +wr32 (trgttimh, (u32 )igc->perout[i].start.tv_sec);/* For now, always select timer 0 as source. */ -wr32 (trgttiml, rq->perout.start.nsec |IGC_TT_IO_TIMER_SEL_SYSTIM0 ); +wr32 (trgttiml, (u32)(igc->perout[i].start.tv_nsec | +IGC_TT_IO_TIMER_SEL_SYSTIM0 ));if (use_freq)wr32 (freqout, ns); tsauxc |= tsauxc_mask;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 38/292 blk-crypto: use dynamic lock class for blk_crypto_profile::lock
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
[ Upstream commit 2fb48d88e77f29bf9d278f25bcfe82cf59a0e09b ]
When a device-mapper device is passing through the inline encryption support of an underlying device, calls to blk_crypto_evict_key() take the blk_crypto_profile::lock of the device-mapper device, then take the blk_crypto_profile::lock of the underlying device (nested). This isn't a real deadlock, but it causes a lockdep report because there is only one lock class for all instances of this lock.
Lockdep subclasses don't really work here because the hierarchy of block devices is dynamic and could have more than 2 levels.
Instead, register a dynamic lock class for each blk_crypto_profile, and associate that with the lock.
This avoids false-positive lockdep reports like the following:
============================================
WARNING: possible recursive locking detected
6.4.0-rc5 #2 Not tainted
--------------------------------------------
fscryptctl/1421 is trying to acquire lock:
ffffff80829ca418 (&profile->lock){++++}-{3:3}, at: __blk_crypto_evict_key+0x44/0x1c0
but task is already holding lock:
ffffff8086b68ca8 (&profile->lock){++++}-{3:3}, at: __blk_crypto_evict_key+0xc8/0x1c0
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(&profile->lock);
lock(&profile->lock);
*** DEADLOCK ***
May be due to missing lock nesting notation--- block/blk-crypto-profile.c | 12 ++++++++++-- include/linux/blk-crypto-profile.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-)
block/blk-crypto-profile.c +10 -2
@@ -79,7 +79,14 @@ int blk_crypto_profile_init(struct blk_crypto_profile *profile,unsigned int slot_hashtable_size;memset (profile,0 ,sizeof (*profile)); -init_rwsem (&profile->lock); + +/* +* profile->lock of an underlying device can nest inside profile->lock +* of a device-mapper device, so use a dynamic lock class to avoid +* false-positive lockdep reports. +*/ +lockdep_register_key (&profile->lockdep_key); +__init_rwsem (&profile->lock,"&profile->lock" , &profile->lockdep_key);if (num_slots ==0 )return 0 ;
@@ -89,7 +96,7 @@ int blk_crypto_profile_init(struct blk_crypto_profile *profile, profile->slots =kvcalloc (num_slots,sizeof (profile->slots[0 ]),GFP_KERNEL );if (!profile->slots) -return -ENOMEM ; + goto err_destroy; profile->num_slots = num_slots;
@@ -435,6 +442,7 @@ void blk_crypto_profile_destroy(struct blk_crypto_profile *profile) {if (!profile)return ; +lockdep_unregister_key (&profile->lockdep_key);kvfree (profile->slot_hashtable);kvfree_sensitive (profile->slots,sizeof (profile->slots[0 ]) * profile->num_slots);
include/linux/blk-crypto-profile.h +1 -0
@@ -111,6 +111,7 @@ struct blk_crypto_profile {* keyslots while ensuring that they can't be changed concurrently. */ struct rw_semaphore lock; +struct lock_class_key lockdep_key;/* List of idle slots, with least recently used slot at front */ wait_queue_head_t idle_slots_wait_queue;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 39/292 scsi: qla2xxx: Fix error code in qla2x00_start_sp()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit e579b007eff3ff8d29d59d16214cd85fb9e573f7 ]
This should be negative -EAGAIN instead of positive. The callers treat non-zero error codes the same so it doesn't really impact runtime beyond some trivial differences to debug output.
--- drivers/scsi/qla2xxx/qla_iocb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_iocb.c +1 -1
@@ -3892,7 +3892,7 @@ qla2x00_start_sp(srb_t *sp) pkt =__qla2x00_alloc_iocbs (sp->qpair, sp);if (!pkt) { - rval =EAGAIN ; + rval = -EAGAIN ;ql_log (ql_log_warn, vha,0x700c ,"qla2x00_alloc_iocbs failed.\n" ); goto done;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 40/292 scsi: ufs: ufs-mediatek: Add dependency for RESET_CONTROLLER
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 89f7ef7f2b23b2a7b8ce346c23161916eae5b15c ]
When RESET_CONTROLLER is not set, kconfig complains about missing dependencies for RESET_TI_SYSCON, so add the missing dependency just as is done above for SCSI_UFS_QCOM.
Silences this kconfig warning:
WARNING: unmet direct dependencies detected for RESET_TI_SYSCON
Depends on [n]: RESET_CONTROLLER [=n] && HAS_IOMEM [=y]
Selected by [m]:
- SCSI_UFS_MEDIATEK [=m] && SCSI_UFSHCD [=y] && SCSI_UFSHCD_PLATFORM [=y] && ARCH_MEDIATEK [=y]
--- drivers/ufs/host/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/ufs/host/Kconfig +1 -0
@@ -72,6 +72,7 @@ config SCSI_UFS_QCOM config SCSI_UFS_MEDIATEK tristate "Mediatek specific hooks to UFS controller platform driver" depends on SCSI_UFSHCD_PLATFORM && ARCH_MEDIATEK + depends on RESET_CONTROLLER select PHY_MTK_UFS select RESET_TI_SYSCON help
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 41/292 bpf: Fix max stack depth check for async callbacks
In reply to Greg Kroah-HartmanFrom: Kumar Kartikeya Dwivedi <[email protected]>
[ Upstream commit 5415ccd50a8620c8cbaa32d6f18c946c453566f5 ]
The check_max_stack_depth pass happens after the verifier's symbolic execution, and attempts to walk the call graph of the BPF program, ensuring that the stack usage stays within bounds for all possible call chains. There are two cases to consider: bpf_pseudo_func and bpf_pseudo_call. In the former case, the callback pointer is loaded into a register, and is assumed that it is passed to some helper later which calls it (however there is no way to be sure), but the check remains conservative and accounts the stack usage anyway. For this particular case, asynchronous callbacks are skipped as they execute asynchronously when their corresponding event fires.
The case of bpf_pseudo_call is simpler and we know that the call is definitely made, hence the stack depth of the subprog is accounted for.
However, the current check still skips an asynchronous callback even if a bpf_pseudo_call was made for it. This is erroneous, as it will miss accounting for the stack usage of the asynchronous callback, which can be used to breach the maximum stack depth limit.
Fix this by only skipping asynchronous callbacks when the instruction is not a pseudo call to the subprog.
--- kernel/bpf/verifier.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/bpf/verifier.c +3 -2
@@ -5450,8 +5450,9 @@ static int check_max_stack_depth(struct bpf_verifier_env *env)verbose (env,"verifier bug. subprog has tail_call and async cb\n" );return -EFAULT ; } -/* async callbacks don't increase bpf prog stack size */ -continue ; +/* async callbacks don't increase bpf prog stack size unless called directly */ +if (!bpf_pseudo_call (insn + i)) +continue ; } i = next_insn;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 42/292 net: mvneta: fix txq_map in case of txq_number==1
In reply to Greg Kroah-HartmanFrom: Klaus Kudielka <[email protected]>
[ Upstream commit 21327f81db6337c8843ce755b01523c7d3df715b ]
If we boot with mvneta.txq_number=1, the txq_map is set incorrectly:MVNETA_CPU_TXQ_ACCESS(1) refers to TX queue 1, but only TX queue 0 is initialized. Fix this.
--- drivers/net/ethernet/marvell/mvneta.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/mvneta.c +2 -2
@@ -1505,7 +1505,7 @@ static void mvneta_defaults_set(struct mvneta_port *pp)*/ if (txq_number ==1 ) txq_map = (cpu == pp->rxq_def) ? -MVNETA_CPU_TXQ_ACCESS (1 ) :0 ; +MVNETA_CPU_TXQ_ACCESS (0 ) :0 ; }else { txq_map =MVNETA_CPU_TXQ_ACCESS_ALL_MASK ;
@@ -4295,7 +4295,7 @@ static void mvneta_percpu_elect(struct mvneta_port *pp)*/ if (txq_number ==1 ) txq_map = (cpu == elected_cpu) ? -MVNETA_CPU_TXQ_ACCESS (1 ) :0 ; +MVNETA_CPU_TXQ_ACCESS (0 ) :0 ;else txq_map =mvreg_read (pp,MVNETA_CPU_MAP (cpu)) &MVNETA_CPU_TXQ_ACCESS_ALL_MASK ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 43/292 net: dsa: felix: make vsc9959_tas_guard_bands_update() visible to ocelot->ops
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit c60819149b637d0f9f7f66e110d2a0d90a3993ea ]
In a future change we will need to make ocelot_port_update_active_preemptible_tcs() call vsc9959_tas_guard_bands_update(), but that is currently not possible, since the ocelot switch lib does not have access to functions private to the DSA wrapper.
Move the pointer to vsc9959_tas_guard_bands_update() from felix->info (which is private to the DSA driver) to ocelot->ops (which is also visible to the ocelot switch lib).
Message-ID: <[email protected]>
Stable-dep-of: c6efb4ae387c ("net: mscc: ocelot: fix oversize frame dropping for preemptible TCs")
--- drivers/net/dsa/ocelot/felix.c | 5 ++--- drivers/net/dsa/ocelot/felix.h | 1 - drivers/net/dsa/ocelot/felix_vsc9959.c | 2 +- include/soc/mscc/ocelot.h | 1 + 4 files changed, 4 insertions(+), 5 deletions(-)
drivers/net/dsa/ocelot/felix.c +2 -3
@@ -1786,14 +1786,13 @@ static int felix_change_mtu(struct dsa_switch *ds, int port, int new_mtu) {struct ocelot *ocelot = ds->priv;struct ocelot_port *ocelot_port = ocelot->ports[port]; -struct felix *felix =ocelot_to_felix (ocelot);ocelot_port_set_maxlen (ocelot, port, new_mtu);mutex_lock (&ocelot->tas_lock); -if (ocelot_port->taprio && felix->info->tas_guard_bands_update) - felix->info->tas_guard_bands_update (ocelot, port); +if (ocelot_port->taprio && ocelot->ops->tas_guard_bands_update) + ocelot->ops->tas_guard_bands_update (ocelot, port);mutex_unlock (&ocelot->tas_lock);
drivers/net/dsa/ocelot/felix.h +0 -1
@@ -57,7 +57,6 @@ struct felix_info {void (*mdio_bus_free)(struct ocelot *ocelot);int (*port_setup_tc)(struct dsa_switch *ds,int port,enum tc_setup_type type,void *type_data); -void (*tas_guard_bands_update)(struct ocelot *ocelot,int port);void (*port_sched_speed_set)(struct ocelot *ocelot,int port,u32 speed); void (*phylink_mac_config)(struct ocelot *ocelot, int port,
drivers/net/dsa/ocelot/felix_vsc9959.c +1 -1
@@ -2600,6 +2600,7 @@ static const struct ocelot_ops vsc9959_ops = { .cut_through_fwd = vsc9959_cut_through_fwd, .tas_clock_adjust = vsc9959_tas_clock_adjust, .update_stats = vsc9959_update_stats, + .tas_guard_bands_update = vsc9959_tas_guard_bands_update, };static const struct felix_info felix_info_vsc9959 = {
@@ -2625,7 +2626,6 @@ static const struct felix_info felix_info_vsc9959 = { .port_modes = vsc9959_port_modes, .port_setup_tc = vsc9959_port_setup_tc, .port_sched_speed_set = vsc9959_sched_speed_set, - .tas_guard_bands_update = vsc9959_tas_guard_bands_update, };/* The INTB interrupt is shared between for PTP TX timestamp availability
include/soc/mscc/ocelot.h +1 -0
@@ -663,6 +663,7 @@ struct ocelot_ops { struct flow_stats *stats);void (*cut_through_fwd)(struct ocelot *ocelot);void (*tas_clock_adjust)(struct ocelot *ocelot); +void (*tas_guard_bands_update)(struct ocelot *ocelot,int port);void (*update_stats)(struct ocelot *ocelot); };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 44/292 net: mscc: ocelot: fix oversize frame dropping for preemptible TCs
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit c6efb4ae387c79bf0d4da286108c810b7b40de3c ]
This switch implements Hold/Release in a strange way, with no control from the user as required by IEEE 802.1Q-2018 through Set-And-Hold-MAC and Set-And-Release-MAC, but rather, it emits HOLD requests implicitly based on the schedule.
Namely, when the gate of a preemptible TC is about to close (actually QSYS::PREEMPTION_CFG.HOLD_ADVANCE octet times in advance of this event), the QSYS seems to emit a HOLD request pulse towards the MAC which preempts the currently transmitted packet, and further packets are held back in the queue system.
This allows large frames to be squeezed through small time slots, because HOLD requests initiated by the gate events result in the frame being segmented in multiple fragments, the bit time of which is equal to the size of the time slot.
It has been reported that the vsc9959_tas_guard_bands_update() logic breaks this, because it doesn't take preemptible TCs into account, and enables oversized frame dropping when the time slot doesn't allow a full MTU to be sent, but it does allow 2*minFragSize to be sent (128B). Packets larger than 128B are dropped instead of being sent in multiple fragments.
Confusingly, the manual says:
| For guard band, SDU calculation of a traffic class of a port, if | preemption is enabled (through 'QSYS::PREEMPTION_CFG.P_QUEUES') then | QSYS::PREEMPTION_CFG.HOLD_ADVANCE is used, otherwise | QSYS::QMAXSDU_CFG_*.QMAXSDU_* is used.
but this only refers to the static guard band durations, and the QMAXSDU_CFG_* registers have dual purpose - the other being oversized frame dropping, which takes place irrespective of whether frames are preemptible or express.
So, to fix the problem, we need to call vsc9959_tas_guard_bands_update() from ocelot_port_update_active_preemptible_tcs(), and modify the guard band logic to consider a different (lower) oversize limit for preemptible traffic classes.
Message-ID: <[email protected]>
--- drivers/net/dsa/ocelot/felix_vsc9959.c | 21 +++++++++++++++++---- drivers/net/ethernet/mscc/ocelot_mm.c | 7 +++++-- 2 files changed, 22 insertions(+), 6 deletions(-)
drivers/net/dsa/ocelot/felix_vsc9959.c +17 -4
@@ -1221,11 +1221,13 @@ static u32 vsc9959_tas_tc_max_sdu(struct tc_taprio_qopt_offload *taprio, int tc)static void vsc9959_tas_guard_bands_update (struct ocelot *ocelot,int port) {struct ocelot_port *ocelot_port = ocelot->ports[port]; +struct ocelot_mm_state *mm = &ocelot->mm[port];struct tc_taprio_qopt_offload *taprio;u64 min_gate_len[OCELOT_NUM_TC ]; +u32 val, maxlen, add_frag_size; +u64 needed_min_frag_time_ps;int speed, picos_per_byte;u64 needed_bit_time_ps; -u32 val, maxlen;u8 tas_speed;int tc;
@@ -1265,9 +1267,18 @@ static void vsc9959_tas_guard_bands_update(struct ocelot *ocelot, int port)*/ needed_bit_time_ps = (u64)(maxlen +24 ) * picos_per_byte; +/* Preemptible TCs don't need to pass a full MTU, the port will +* automatically emit a HOLD request when a preemptible TC gate closes +*/ + val =ocelot_read_rix (ocelot,QSYS_PREEMPTION_CFG , port); + add_frag_size =QSYS_PREEMPTION_CFG_MM_ADD_FRAG_SIZE_X (val); + needed_min_frag_time_ps = picos_per_byte * + (u64)(24 +2 *ethtool_mm_frag_size_add_to_min (add_frag_size)); +dev_dbg (ocelot->dev, -"port %d: max frame size %d needs %llu ps at speed %d\n" , - port, maxlen, needed_bit_time_ps, speed); +"port %d: max frame size %d needs %llu ps, %llu ps for mPackets at speed %d\n" , + port, maxlen, needed_bit_time_ps, needed_min_frag_time_ps, + speed);vsc9959_tas_min_gate_lengths (taprio, min_gate_len);
@@ -1281,7 +1292,9 @@ static void vsc9959_tas_guard_bands_update(struct ocelot *ocelot, int port) remaining_gate_len_ps =vsc9959_tas_remaining_gate_len_ps (min_gate_len[tc]); -if (remaining_gate_len_ps > needed_bit_time_ps) { +if ((mm->active_preemptible_tcs &BIT (tc)) ? + remaining_gate_len_ps > needed_min_frag_time_ps : + remaining_gate_len_ps > needed_bit_time_ps) {/* Setting QMAXSDU_CFG to 0 disables oversized frame * dropping. */
drivers/net/ethernet/mscc/ocelot_mm.c +5 -2
@@ -67,10 +67,13 @@ void ocelot_port_update_active_preemptible_tcs(struct ocelot *ocelot, int port) val = mm->preemptible_tcs;/* Cut through switching doesn't work for preemptible priorities, -* so first make sure it is disabled. +* so first make sure it is disabled. Also, changing the preemptible +* TCs affects the oversized frame dropping logic, so that needs to be +* re-triggered. And since tas_guard_bands_update() also implicitly +* calls cut_through_fwd(), we don't need to explicitly call it. */ mm->active_preemptible_tcs = val; - ocelot->ops->cut_through_fwd (ocelot); + ocelot->ops->tas_guard_bands_update (ocelot, port); dev_dbg(ocelot->dev, "port %d %s/%s, MM TX %s, preemptible TCs 0x%x, active 0x%x\n",
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 45/292 net/sched: cls_fw: Fix improper refcount update leads to use-after-free
In reply to Greg Kroah-HartmanFrom: M A Ramdhan <[email protected]>
[ Upstream commit 0323bce598eea038714f941ce2b22541c46d488f ]
In the event of a failure in tcf_change_indev(), fw_set_parms() will immediately return an error after incrementing or decrementing reference counter in tcf_bind_filter(). If attacker can control reference counter to zero and make reference freed, leading to use after free.
In order to prevent this, move the point of possible failure above the point where the TC_FW_CLASSID is handled.
Message-ID: <[email protected]>
--- net/sched/cls_fw.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/sched/cls_fw.c +5 -5
@@ -212,11 +212,6 @@ static int fw_set_parms(struct net *net, struct tcf_proto *tp,if (err <0 )return err; -if (tb[TCA_FW_CLASSID ]) { - f->res.classid =nla_get_u32 (tb[TCA_FW_CLASSID ]); -tcf_bind_filter (tp, &f->res, base); - } -if (tb[TCA_FW_INDEV ]) {int ret; ret =tcf_change_indev (net, tb[TCA_FW_INDEV ], extack);
@@ -233,6 +228,11 @@ static int fw_set_parms(struct net *net, struct tcf_proto *tp, }else if (head->mask !=0xFFFFFFFF )return err; +if (tb[TCA_FW_CLASSID ]) { + f->res.classid =nla_get_u32 (tb[TCA_FW_CLASSID ]); +tcf_bind_filter (tp, &f->res, base); + } +return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 46/292 gve: Set default duplex configuration to full
In reply to Greg Kroah-HartmanFrom: Junfeng Guo <[email protected]>
[ Upstream commit 0503efeadbf6bb8bf24397613a73b67e665eac5f ]
Current duplex mode was unset in the driver, resulting in the default parameter being set to 0, which corresponds to half duplex. It might mislead users to have incorrect expectation about the driver's transmission capabilities.
Set the default duplex configuration to full, as the driver runs in full duplex mode at this point.
Message-ID: <[email protected]>
--- drivers/net/ethernet/google/gve/gve_ethtool.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/google/gve/gve_ethtool.c +3 -0
@@ -590,6 +590,9 @@ static int gve_get_link_ksettings(struct net_device *netdev, err =gve_adminq_report_link_speed (priv); cmd->base.speed = priv->link_speed; + + cmd->base.duplex =DUPLEX_FULL ; +return err; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 47/292 drm/fbdev-dma: Fix documented default preferred_bpp value
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 15008052b34efaa86c1d56190ac73c4bf8c462f9 ]
As of commit 6c80a93be62d398e ("drm/fb-helper: Initialize fb-helper's preferred BPP in prepare function"), the preferred_bpp parameter of drm_fb_helper_prepare() defaults to 32 instead of drm_mode_config.preferred_depth. Hence this also applies to drm_fbdev_dma_setup(), which just passes its own preferred_bpp parameter.
--- drivers/gpu/drm/drm_fbdev_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_fbdev_dma.c +1 -1
@@ -218,7 +218,7 @@ static const struct drm_client_funcs drm_fbdev_dma_client_funcs = {* drm_fbdev_dma_setup() - Setup fbdev emulation for GEM DMA helpers * @dev: DRM device * @preferred_bpp: Preferred bits per pixel for the device. -* @dev->mode_config.preferred_depth is used if this is zero. +* 32 is used if this is zero. * * This function sets up fbdev emulation for GEM DMA drivers that support * dumb buffers with a virtual address and that can be mmap'ed.
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 48/292 octeontx2-af: Promisc enable/disable through mbox
In reply to Greg Kroah-HartmanFrom: Ratheesh Kannoth <[email protected]>
[ Upstream commit af42088bdaf292060b8d8a00d8644ca7b2b3f2d1 ]
In legacy silicon, promiscuous mode is only modified through CGX mbox messages. In CN10KB silicon, it is modified from CGX mbox and NIX. This breaks legacy application behaviour. Fix this by removing call from NIX.
--- .../ethernet/marvell/octeontx2/af/rvu_nix.c | 11 ++------- .../marvell/octeontx2/af/rvu_npc_hash.c | 23 +++++++++++++++++-- 2 files changed, 23 insertions(+), 11 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +2 -9
@@ -3815,21 +3815,14 @@ int rvu_mbox_handler_nix_set_rx_mode(struct rvu *rvu, struct nix_rx_mode *req, }/* install/uninstall promisc entry */ -if (promisc) { +if (promisc)rvu_npc_install_promisc_entry (rvu, pcifunc, nixlf, pfvf->rx_chan_base, pfvf->rx_chan_cnt); - -if (rvu_npc_exact_has_match_table (rvu)) -rvu_npc_exact_promisc_enable (rvu, pcifunc); - }else { +else if (!nix_rx_multicast)rvu_npc_enable_promisc_entry (rvu, pcifunc, nixlf, false); -if (rvu_npc_exact_has_match_table (rvu)) -rvu_npc_exact_promisc_disable (rvu, pcifunc); - } -return 0 ; }
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +21 -2
@@ -1164,8 +1164,10 @@ static u16 __rvu_npc_exact_cmd_rules_cnt_update(struct rvu *rvu, int drop_mcam_i {struct npc_exact_table *table;u16 *cnt, old_cnt; +bool promisc; table = rvu->hw->table; + promisc = table->promisc_mode[drop_mcam_idx]; cnt = &table->cnt_cmd_rules[drop_mcam_idx]; old_cnt = *cnt;
@@ -1177,13 +1179,18 @@ static u16 __rvu_npc_exact_cmd_rules_cnt_update(struct rvu *rvu, int drop_mcam_i *enable_or_disable_cam = false; -/* If all rules are deleted, disable cam */ +if (promisc) + goto done; + +/* If all rules are deleted and not already in promisc mode; +* disable cam +*/ if (!*cnt && val <0 ) { *enable_or_disable_cam = true; goto done; } -/* If rule got added, enable cam */ +/* If rule got added and not already in promisc mode; enable cam */ if (!old_cnt && val >0 ) { *enable_or_disable_cam = true; goto done;
@@ -1462,6 +1469,12 @@ int rvu_npc_exact_promisc_disable(struct rvu *rvu, u16 pcifunc) *promisc = false;mutex_unlock (&table->lock); +/* Enable drop rule */ +rvu_npc_enable_mcam_by_entry_index (rvu, drop_mcam_idx,NIX_INTF_RX , + true); + +dev_dbg (rvu->dev,"%s: disabled promisc mode (cgx=%d lmac=%d)\n" , + __func__, cgx_id, lmac_id);return 0 ; }
@@ -1503,6 +1516,12 @@ int rvu_npc_exact_promisc_enable(struct rvu *rvu, u16 pcifunc) *promisc = true;mutex_unlock (&table->lock); +/* disable drop rule */ +rvu_npc_enable_mcam_by_entry_index (rvu, drop_mcam_idx,NIX_INTF_RX , + false); + +dev_dbg (rvu->dev,"%s: Enabled promisc mode (cgx=%d lmac=%d)\n" , + __func__, cgx_id, lmac_id);return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 49/292 octeontx2-af: Move validation of ptp pointer before its usage
In reply to Greg Kroah-HartmanFrom: Sai Krishna <[email protected]>
[ Upstream commit 7709fbd4922c197efabda03660d93e48a3e80323 ]
Moved PTP pointer validation before its use to avoid smatch warning. Also used kzalloc/kfree instead of devm_kzalloc/devm_kfree.
--- .../net/ethernet/marvell/octeontx2/af/ptp.c | 19 +++++++++---------- .../net/ethernet/marvell/octeontx2/af/rvu.c | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/ptp.c +9 -10
@@ -208,7 +208,7 @@ struct ptp *ptp_get(void)/* Check driver is bound to PTP block */ if (!ptp) ptp =ERR_PTR (-EPROBE_DEFER ); -else +else if (!IS_ERR (ptp))pci_dev_get (ptp->pdev);return ptp;
@@ -388,11 +388,10 @@ static int ptp_extts_on(struct ptp *ptp, int on)static int ptp_probe (struct pci_dev *pdev,const struct pci_device_id *ent) { -struct device *dev = &pdev->dev;struct ptp *ptp;int err; - ptp =devm_kzalloc (dev,sizeof (*ptp),GFP_KERNEL ); + ptp =kzalloc (sizeof (*ptp),GFP_KERNEL );if (!ptp) { err = -ENOMEM ; goto error;
@@ -428,20 +427,19 @@ static int ptp_probe(struct pci_dev *pdev,return 0 ; error_free: -devm_kfree (dev, ptp); +kfree (ptp); error:/* For `ptp_get()` we need to differentiate between the case * when the core has not tried to probe this device and the case when -* the probe failed. In the later case we pretend that the -* initialization was successful and keep the error in +* the probe failed. In the later case we keep the error in * `dev->driver_data`. */ pci_set_drvdata (pdev,ERR_PTR (err));if (!first_ptp_block) first_ptp_block =ERR_PTR (err); -return 0 ; +return err; }static void ptp_remove (struct pci_dev *pdev)
@@ -449,16 +447,17 @@ static void ptp_remove(struct pci_dev *pdev)struct ptp *ptp =pci_get_drvdata (pdev);u64 clock_cfg; -if (cn10k_ptp_errata (ptp) &&hrtimer_active (&ptp->hrtimer)) -hrtimer_cancel (&ptp->hrtimer); -if (IS_ERR_OR_NULL (ptp))return ; +if (cn10k_ptp_errata (ptp) &&hrtimer_active (&ptp->hrtimer)) +hrtimer_cancel (&ptp->hrtimer); +/* Disable PTP clock */ clock_cfg =readq (ptp->reg_base +PTP_CLOCK_CFG ); clock_cfg &= ~PTP_CLOCK_CFG_PTP_EN ;writeq (clock_cfg, ptp->reg_base +PTP_CLOCK_CFG ); +kfree (ptp); }static const struct pci_device_id ptp_id_table[] = {
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +1 -1
@@ -3253,7 +3253,7 @@ static int rvu_probe(struct pci_dev *pdev, const struct pci_device_id *id) rvu->ptp =ptp_get ();if (IS_ERR (rvu->ptp)) { err =PTR_ERR (rvu->ptp); -if (err == -EPROBE_DEFER ) +if (err) goto err_release_regions; rvu->ptp =NULL ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 50/292 ionic: remove WARN_ON to prevent panic_on_warn
In reply to Greg Kroah-HartmanFrom: Nitya Sunkad <[email protected]>
[ Upstream commit abfb2a58a5377ebab717d4362d6180f901b6e5c1 ]
Remove unnecessary early code development check and the WARN_ON that it uses. The irq alloc and free paths have long been cleaned up and this check shouldn't have stuck around so long.
--- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +0 -5
@@ -474,11 +474,6 @@ static void ionic_qcqs_free(struct ionic_lif *lif)static void ionic_link_qcq_interrupts (struct ionic_qcq *src_qcq,struct ionic_qcq *n_qcq) { -if (WARN_ON (n_qcq->flags &IONIC_QCQ_F_INTR )) { -ionic_intr_free (n_qcq->cq.lif->ionic, n_qcq->intr.index); - n_qcq->flags &= ~IONIC_QCQ_F_INTR ; - } - n_qcq->intr.vector = src_qcq->intr.vector; n_qcq->intr.index = src_qcq->intr.index; n_qcq->napi_qcq = src_qcq->napi_qcq;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 51/292 udp6: add a missing call into udp_fail_queue_rcv_skb tracepoint
In reply to Greg Kroah-HartmanFrom: Ivan Babrou <[email protected]>
[ Upstream commit 8139dccd464aaee4a2c351506ff883733c6ca5a3 ]
The tracepoint has existed for 12 years, but it only covered udp over the legacy IPv4 protocol. Having it enabled for udp6 removes the unnecessary difference in error visibility.
--- net/core/net-traces.c | 2 ++ net/ipv6/udp.c | 2 ++ 2 files changed, 4 insertions(+)
net/core/net-traces.c +2 -0
@@ -63,4 +63,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(napi_poll);EXPORT_TRACEPOINT_SYMBOL_GPL (tcp_send_reset);EXPORT_TRACEPOINT_SYMBOL_GPL (tcp_bad_csum); +EXPORT_TRACEPOINT_SYMBOL_GPL (udp_fail_queue_rcv_skb); +EXPORT_TRACEPOINT_SYMBOL_GPL (sk_data_ready);
net/ipv6/udp.c +2 -0
@@ -45,6 +45,7 @@#include <net/tcp_states.h> #include <net/ip6_checksum.h> #include <net/ip6_tunnel.h> +#include <trace/events/udp.h> #include <net/xfrm.h> #include <net/inet_hashtables.h> #include <net/inet6_hashtables.h>
@@ -680,6 +681,7 @@ static int __udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) }UDP6_INC_STATS (sock_net (sk),UDP_MIB_INERRORS , is_udplite);kfree_skb_reason (skb, drop_reason); +trace_udp_fail_queue_rcv_skb (rc, sk);return -1 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 52/292 net: bgmac: postpone turning IRQs off to avoid SoC hangs
In reply to Greg Kroah-HartmanFrom: Rafał Miłecki <[email protected]>
[ Upstream commit e7731194fdf085f46d58b1adccfddbd0dfee4873 ]
Turning IRQs off is done by accessing Ethernet controller registers. That can't be done until device's clock is enabled. It results in a SoC hang otherwise.
This bug remained unnoticed for years as most bootloaders keep all Ethernet interfaces turned on. It seems to only affect a niche SoC family BCM47189. It has two Ethernet controllers but CFE bootloader uses only the first one.
--- drivers/net/ethernet/broadcom/bgmac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bgmac.c +2 -2
@@ -1492,8 +1492,6 @@ int bgmac_enet_probe(struct bgmac *bgmac) bgmac->in_init = true; -bgmac_chip_intrs_off (bgmac); - net_dev->irq = bgmac->irq;SET_NETDEV_DEV (net_dev, bgmac->dev);dev_set_drvdata (bgmac->dev, bgmac);
@@ -1511,6 +1509,8 @@ int bgmac_enet_probe(struct bgmac *bgmac)*/ bgmac_clk_enable (bgmac,0 ); +bgmac_chip_intrs_off (bgmac); +/* This seems to be fixing IRQ by assigning OOB #6 to the core */ if (!(bgmac->feature_flags &BGMAC_FEAT_IDM_MASK )) {if (bgmac->feature_flags &BGMAC_FEAT_IRQ_ID_OOB_6 )
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 53/292 net: prevent skb corruption on frag list segmentation
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit c329b261afe71197d9da83c1f18eb45a7e97e089 ]
Ian reported several skb corruptions triggered by rx-gro-list, collecting different oops alike:
[ 62.624003] BUG: kernel NULL pointer dereference, address: 00000000000000c0 [ 62.631083] #PF: supervisor read access in kernel mode [ 62.636312] #PF: error_code(0x0000) - not-present page [ 62.641541] PGD 0 P4D 0 [ 62.644174] Oops: 0000 [#1] PREEMPT SMP NOPTI [ 62.648629] CPU: 1 PID: 913 Comm: napi/eno2-79 Not tainted 6.4.0 #364 [ 62.655162] Hardware name: Supermicro Super Server/A2SDi-12C-HLN4F, BIOS 1.7a 10/13/2022 [ 62.663344] RIP: 0010:__udp_gso_segment (./include/linux/skbuff.h:2858 ./include/linux/udp.h:23 net/ipv4/udp_offload.c:228 net/ipv4/udp_offload.c:261 net/ipv4/udp_offload.c:277) [ 62.687193] RSP: 0018:ffffbd3a83b4f868 EFLAGS: 00010246 [ 62.692515] RAX: 00000000000000ce RBX: 0000000000000000 RCX: 0000000000000000 [ 62.699743] RDX: ffffa124def8a000 RSI: 0000000000000079 RDI: ffffa125952a14d4 [ 62.706970] RBP: ffffa124def8a000 R08: 0000000000000022 R09: 00002000001558c9 [ 62.714199] R10: 0000000000000000 R11: 00000000be554639 R12: 00000000000000e2 [ 62.721426] R13: ffffa125952a1400 R14: ffffa125952a1400 R15: 00002000001558c9 [ 62.728654] FS: 0000000000000000(0000) GS:ffffa127efa40000(0000) knlGS:0000000000000000 [ 62.736852] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 62.742702] CR2: 00000000000000c0 CR3: 00000001034b0000 CR4: 00000000003526e0 [ 62.749948] Call Trace: [ 62.752498] <TASK> [ 62.779267] inet_gso_segment (net/ipv4/af_inet.c:1398) [ 62.787605] skb_mac_gso_segment (net/core/gro.c:141) [ 62.791906] __skb_gso_segment (net/core/dev.c:3403 (discriminator 2)) [ 62.800492] validate_xmit_skb (./include/linux/netdevice.h:4862 net/core/dev.c:3659) [ 62.804695] validate_xmit_skb_list (net/core/dev.c:3710) [ 62.809158] sch_direct_xmit (net/sched/sch_generic.c:330) [ 62.813198] __dev_queue_xmit (net/core/dev.c:3805 net/core/dev.c:4210) net/netfilter/core.c:626) [ 62.821093] br_dev_queue_push_xmit (net/bridge/br_forward.c:55) [ 62.825652] maybe_deliver (net/bridge/br_forward.c:193) [ 62.829420] br_flood (net/bridge/br_forward.c:233) [ 62.832758] br_handle_frame_finish (net/bridge/br_input.c:215) [ 62.837403] br_handle_frame (net/bridge/br_input.c:298 net/bridge/br_input.c:416) [ 62.851417] __netif_receive_skb_core.constprop.0 (net/core/dev.c:5387) [ 62.866114] __netif_receive_skb_list_core (net/core/dev.c:5570) [ 62.871367] netif_receive_skb_list_internal (net/core/dev.c:5638 net/core/dev.c:5727) [ 62.876795] napi_complete_done (./include/linux/list.h:37 ./include/net/gro.h:434 ./include/net/gro.h:429 net/core/dev.c:6067) [ 62.881004] ixgbe_poll (drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:3191) [ 62.893534] __napi_poll (net/core/dev.c:6498) [ 62.897133] napi_threaded_poll (./include/linux/netpoll.h:89 net/core/dev.c:6640) [ 62.905276] kthread (kernel/kthread.c:379) [ 62.913435] ret_from_fork (arch/x86/entry/entry_64.S:314) [ 62.917119] </TASK>
In the critical scenario, rx-gro-list GRO-ed packets are fed, via a bridge, both to the local input path and to an egress device (tun).
The segmentation of such packets unsafely writes to the cloned skbs with shared heads.
This change addresses the issue by uncloning as needed the to-be-segmented skbs.
--- net/core/skbuff.c | 5 +++++ 1 file changed, 5 insertions(+)
net/core/skbuff.c +5 -0
@@ -4270,6 +4270,11 @@ struct sk_buff *skb_segment_list(struct sk_buff *skb,skb_push (skb, -skb_network_offset (skb) + offset); +/* Ensure the head is writeable before touching the shared info */ + err =skb_unclone (skb,GFP_ATOMIC ); +if (err) + goto err_linearize; +skb_shinfo (skb)->frag_list =NULL ;while (list_skb) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 54/292 s390/ism: Fix locking for forwarding of IRQs and events to clients
In reply to Greg Kroah-HartmanFrom: Niklas Schnelle <[email protected]>
[ Upstream commit 6b5c13b591d753c6022fbd12f8c0c0a9a07fc065 ]
The clients array references all registered clients and is protected by the clients_lock. Besides its use as general list of clients the clients array is accessed in ism_handle_irq() to forward ISM device events to clients.
While the clients_lock is taken in the IRQ handler when calling handle_event() it is however incorrectly not held during the client->handle_irq() call and for the preceding clients[] access leaving it unprotected against concurrent client (un-)registration.
Furthermore the accesses to ism->sba_client_arr[] in ism_register_dmb() and ism_unregister_dmb() are not protected by any lock. This is especially problematic as the client ID from the ism->sba_client_arr[] is not checked against NO_CLIENT and neither is the client pointer checked.
Instead of expanding the use of the clients_lock further add a separate array in struct ism_dev which references clients subscribed to the device's events and IRQs. This array is protected by ism->lock which is already taken in ism_handle_irq() and can be taken outside the IRQ handler when adding/removing subscribers or the accessing ism->sba_client_arr[]. This also means that the clients_lock is no longer taken in IRQ context.
--- drivers/s390/net/ism_drv.c | 44 +++++++++++++++++++++++++++++++------- include/linux/ism.h | 1 + 2 files changed, 37 insertions(+), 8 deletions(-)
drivers/s390/net/ism_drv.c +36 -8
@@ -47,6 +47,15 @@ static struct ism_dev_list ism_dev_list = { .mutex = __MUTEX_INITIALIZER(ism_dev_list.mutex), }; +static void ism_setup_forwarding (struct ism_client *client,struct ism_dev *ism) +{ +unsigned long flags; + +spin_lock_irqsave (&ism->lock, flags); + ism->subs[client->id] = client; +spin_unlock_irqrestore (&ism->lock, flags); +} +int ism_register_client (struct ism_client *client) {struct ism_dev *ism;
@@ -71,6 +80,7 @@ int ism_register_client(struct ism_client *client)list_for_each_entry (ism, &ism_dev_list.list, list) { ism->priv[i] =NULL ; client->add (ism); +ism_setup_forwarding (client, ism); } }mutex_unlock (&ism_dev_list.mutex);
@@ -92,6 +102,9 @@ int ism_unregister_client(struct ism_client *client) max_client--;spin_unlock_irqrestore (&clients_lock, flags);list_for_each_entry (ism, &ism_dev_list.list, list) { +spin_lock_irqsave (&ism->lock, flags); +/* Stop forwarding IRQs and events */ + ism->subs[client->id] =NULL ;for (int i =0 ; i <ISM_NR_DMBS ; ++i) {if (ism->sba_client_arr[i] == client->id) { pr_err("%s: attempt to unregister client '%s'"
@@ -101,6 +114,7 @@ int ism_unregister_client(struct ism_client *client) goto out; } } +spin_unlock_irqrestore (&ism->lock, flags); } out:mutex_unlock (&ism_dev_list.mutex);
@@ -328,6 +342,7 @@ int ism_register_dmb(struct ism_dev *ism, struct ism_dmb *dmb, struct ism_client *client) {union ism_reg_dmb cmd; +unsigned long flags;int ret; ret =ism_alloc_dmb (ism, dmb);
@@ -351,7 +366,9 @@ int ism_register_dmb(struct ism_dev *ism, struct ism_dmb *dmb, goto out; } dmb->dmb_tok = cmd.response.dmb_tok; +spin_lock_irqsave (&ism->lock, flags); ism->sba_client_arr[dmb->sba_idx -ISM_DMB_BIT_OFFSET ] = client->id; +spin_unlock_irqrestore (&ism->lock, flags); out:return ret; }
@@ -360,6 +377,7 @@ EXPORT_SYMBOL_GPL(ism_register_dmb);int ism_unregister_dmb (struct ism_dev *ism,struct ism_dmb *dmb) {union ism_unreg_dmb cmd; +unsigned long flags;int ret;memset (&cmd,0 ,sizeof (cmd));
@@ -368,7 +386,9 @@ int ism_unregister_dmb(struct ism_dev *ism, struct ism_dmb *dmb) cmd.request.dmb_tok = dmb->dmb_tok; +spin_lock_irqsave (&ism->lock, flags); ism->sba_client_arr[dmb->sba_idx -ISM_DMB_BIT_OFFSET ] =NO_CLIENT ; +spin_unlock_irqrestore (&ism->lock, flags); ret =ism_cmd (ism, &cmd);if (ret && ret !=ISM_ERROR )
@@ -491,6 +511,7 @@ static u16 ism_get_chid(struct ism_dev *ism)static void ism_handle_event (struct ism_dev *ism) {struct ism_event *entry; +struct ism_client *clt;int i;while ((ism->ieq_idx +1 ) !=READ_ONCE (ism->ieq->header.idx)) {
@@ -499,21 +520,21 @@ static void ism_handle_event(struct ism_dev *ism) entry = &ism->ieq->entry[ism->ieq_idx];debug_event (ism_debug_info,2 , entry,sizeof (*entry)); -spin_lock (&clients_lock); -for (i =0 ; i < max_client; ++i) -if (clients[i]) - clients[i]->handle_event (ism, entry); -spin_unlock (&clients_lock); +for (i =0 ; i < max_client; ++i) { + clt = ism->subs[i]; +if (clt) + clt->handle_event (ism, entry); + } } }static irqreturn_t ism_handle_irq (int irq,void *data) {struct ism_dev *ism = data; -struct ism_client *clt;unsigned long bit, end;unsigned long *bv;u16 dmbemask; +u8 client_id; bv = (void *) &ism->sba->dmb_bits[ISM_DMB_WORD_OFFSET ]; end =sizeof (ism->sba->dmb_bits) *BITS_PER_BYTE -ISM_DMB_BIT_OFFSET ;
@@ -530,8 +551,10 @@ static irqreturn_t ism_handle_irq(int irq, void *data) dmbemask = ism->sba->dmbe_mask[bit +ISM_DMB_BIT_OFFSET ]; ism->sba->dmbe_mask[bit +ISM_DMB_BIT_OFFSET ] =0 ;barrier (); - clt = clients[ism->sba_client_arr[bit]]; - clt->handle_irq (ism, bit +ISM_DMB_BIT_OFFSET , dmbemask); + client_id = ism->sba_client_arr[bit]; +if (unlikely (client_id ==NO_CLIENT || !ism->subs[client_id])) +continue ; + ism->subs[client_id]->handle_irq (ism, bit +ISM_DMB_BIT_OFFSET , dmbemask); }if (ism->sba->e) {
@@ -554,6 +577,7 @@ static void ism_dev_add_work_func(struct work_struct *work) add_work); client->add (client->tgt_ism); +ism_setup_forwarding (client, client->tgt_ism);atomic_dec (&client->tgt_ism->add_dev_cnt);wake_up (&client->tgt_ism->waitq); }
@@ -691,7 +715,11 @@ static void ism_dev_remove_work_func(struct work_struct *work) { struct ism_client *client = container_of(work, struct ism_client, remove_work); +unsigned long flags; +spin_lock_irqsave (&client->tgt_ism->lock, flags); + client->tgt_ism->subs[client->id] =NULL ; +spin_unlock_irqrestore (&client->tgt_ism->lock, flags); client->remove (client->tgt_ism);atomic_dec (&client->tgt_ism->free_clients_cnt);wake_up (&client->tgt_ism->waitq);
include/linux/ism.h +1 -0
@@ -44,6 +44,7 @@ struct ism_dev {u64 local_gid;int ieq_idx; +struct ism_client *subs[MAX_CLIENTS ];atomic_t free_clients_cnt;atomic_t add_dev_cnt;wait_queue_head_t waitq;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 55/292 s390/ism: Fix and simplify add()/remove() callback handling
In reply to Greg Kroah-HartmanFrom: Niklas Schnelle <[email protected]>
[ Upstream commit 76631ffa2fd2d45bae5ad717eef716b94144e0e7 ]
Previously the clients_lock was protecting the clients array against concurrent addition/removal of clients but was also accessed from IRQ context. This meant that it had to be a spinlock and that the add() and remove() callbacks in which clients need to do allocation and take mutexes can't be called under the clients_lock. To work around this these callbacks were moved to workqueues. This not only introduced significant complexity but is also subtly broken in at least one way.
In ism_dev_init() and ism_dev_exit() clients[i]->tgt_ism is used to communicate the added/removed ISM device to the work function. While write access to client[i]->tgt_ism is protected by the clients_lock and the code waits that there is no pending add/remove work before and after setting clients[i]->tgt_ism this is not enough. The problem is that the wait happens based on per ISM device counters. Thus a concurrent ism_dev_init()/ism_dev_exit() for a different ISM device may overwrite a clients[i]->tgt_ism between unlocking the clients_lock and the subsequent wait for the work to finnish.
Thankfully with the clients_lock no longer held in IRQ context it can be turned into a mutex which can be held during the calls to add()/remove() completely removing the need for the workqueues and the associated broken housekeeping including the per ISM device counters and the clients[i]->tgt_ism.
--- drivers/s390/net/ism_drv.c | 86 +++++++++++--------------------------- include/linux/ism.h | 6 --- 2 files changed, 24 insertions(+), 68 deletions(-)
drivers/s390/net/ism_drv.c +24 -62
@@ -36,7 +36,7 @@ static const struct smcd_ops ism_ops;static struct ism_client *clients[MAX_CLIENTS ];/* use an array rather than */ /* a list for fast mapping */ static u8 max_client; -static DEFINE_SPINLOCK (clients_lock); +static DEFINE_MUTEX (clients_lock);struct ism_dev_list {struct list_head list;struct mutex mutex;/* protects ism device list */
@@ -59,11 +59,10 @@ static void ism_setup_forwarding(struct ism_client *client, struct ism_dev *ism)int ism_register_client (struct ism_client *client) {struct ism_dev *ism; -unsigned long flags;int i, rc = -ENOSPC ;mutex_lock (&ism_dev_list.mutex); -spin_lock_irqsave (&clients_lock, flags); +mutex_lock (&clients_lock);for (i =0 ; i <MAX_CLIENTS ; ++i) {if (!clients[i]) { clients[i] = client;
@@ -74,7 +73,8 @@ int ism_register_client(struct ism_client *client)break ; } } -spin_unlock_irqrestore (&clients_lock, flags); +mutex_unlock (&clients_lock); +if (i <MAX_CLIENTS ) {/* initialize with all devices that we got so far */ list_for_each_entry (ism, &ism_dev_list.list, list) {
@@ -96,11 +96,11 @@ int ism_unregister_client(struct ism_client *client)int rc =0 ;mutex_lock (&ism_dev_list.mutex); -spin_lock_irqsave (&clients_lock, flags); +mutex_lock (&clients_lock); clients[client->id] =NULL ;if (client->id +1 == max_client) max_client--; -spin_unlock_irqrestore (&clients_lock, flags); +mutex_unlock (&clients_lock);list_for_each_entry (ism, &ism_dev_list.list, list) {spin_lock_irqsave (&ism->lock, flags);/* Stop forwarding IRQs and events */
@@ -571,21 +571,9 @@ static u64 ism_get_local_gid(struct ism_dev *ism)return ism->local_gid; } -static void ism_dev_add_work_func (struct work_struct *work) -{ - struct ism_client *client = container_of(work, struct ism_client, - add_work); - - client->add (client->tgt_ism); -ism_setup_forwarding (client, client->tgt_ism); -atomic_dec (&client->tgt_ism->add_dev_cnt); -wake_up (&client->tgt_ism->waitq); -} -static int ism_dev_init (struct ism_dev *ism) {struct pci_dev *pdev = ism->pdev; -unsigned long flags;int i, ret; ret =pci_alloc_irq_vectors (pdev,1 ,1 ,PCI_IRQ_MSI );
@@ -618,25 +606,16 @@ static int ism_dev_init(struct ism_dev *ism)/* hardware is V2 capable */ ism_create_system_eid (); -init_waitqueue_head (&ism->waitq); -atomic_set (&ism->free_clients_cnt,0 ); -atomic_set (&ism->add_dev_cnt,0 ); - -wait_event (ism->waitq, !atomic_read (&ism->add_dev_cnt)); -spin_lock_irqsave (&clients_lock, flags); -for (i =0 ; i < max_client; ++i) +mutex_lock (&ism_dev_list.mutex); +mutex_lock (&clients_lock); +for (i =0 ; i < max_client; ++i) {if (clients[i]) { -INIT_WORK (&clients[i]->add_work, - ism_dev_add_work_func); - clients[i]->tgt_ism = ism; -atomic_inc (&ism->add_dev_cnt); -schedule_work (&clients[i]->add_work); + clients[i]->add (ism); +ism_setup_forwarding (clients[i], ism); } -spin_unlock_irqrestore (&clients_lock, flags); - -wait_event (ism->waitq, !atomic_read (&ism->add_dev_cnt)); + } +mutex_unlock (&clients_lock); -mutex_lock (&ism_dev_list.mutex);list_add (&ism->list, &ism_dev_list.list);mutex_unlock (&ism_dev_list.mutex);
@@ -711,40 +690,24 @@ static int ism_probe(struct pci_dev *pdev, const struct pci_device_id *id)return ret; } -static void ism_dev_remove_work_func (struct work_struct *work) -{ - struct ism_client *client = container_of(work, struct ism_client, - remove_work); -unsigned long flags; - -spin_lock_irqsave (&client->tgt_ism->lock, flags); - client->tgt_ism->subs[client->id] =NULL ; -spin_unlock_irqrestore (&client->tgt_ism->lock, flags); - client->remove (client->tgt_ism); -atomic_dec (&client->tgt_ism->free_clients_cnt); -wake_up (&client->tgt_ism->waitq); -} - -/* Callers must hold ism_dev_list.mutex */ static void ism_dev_exit (struct ism_dev *ism) {struct pci_dev *pdev = ism->pdev;unsigned long flags;int i; -wait_event (ism->waitq, !atomic_read (&ism->free_clients_cnt)); -spin_lock_irqsave (&clients_lock, flags); +spin_lock_irqsave (&ism->lock, flags);for (i =0 ; i < max_client; ++i) -if (clients[i]) { -INIT_WORK (&clients[i]->remove_work, - ism_dev_remove_work_func); - clients[i]->tgt_ism = ism; -atomic_inc (&ism->free_clients_cnt); -schedule_work (&clients[i]->remove_work); - } -spin_unlock_irqrestore (&clients_lock, flags); + ism->subs[i] =NULL ; +spin_unlock_irqrestore (&ism->lock, flags); -wait_event (ism->waitq, !atomic_read (&ism->free_clients_cnt)); +mutex_lock (&ism_dev_list.mutex); +mutex_lock (&clients_lock); +for (i =0 ; i < max_client; ++i) { +if (clients[i]) + clients[i]->remove (ism); + } +mutex_unlock (&clients_lock);if (SYSTEM_EID .serial_number[0 ] !='0' ||SYSTEM_EID .type[0 ] !='0' )
@@ -755,15 +718,14 @@ static void ism_dev_exit(struct ism_dev *ism)kfree (ism->sba_client_arr);pci_free_irq_vectors (pdev);list_del_init (&ism->list); +mutex_unlock (&ism_dev_list.mutex); }static void ism_remove (struct pci_dev *pdev) {struct ism_dev *ism =dev_get_drvdata (&pdev->dev); -mutex_lock (&ism_dev_list.mutex);ism_dev_exit (ism); -mutex_unlock (&ism_dev_list.mutex);pci_release_mem_regions (pdev);pci_disable_device (pdev);
include/linux/ism.h +0 -6
@@ -45,9 +45,6 @@ struct ism_dev {int ieq_idx;struct ism_client *subs[MAX_CLIENTS ]; -atomic_t free_clients_cnt; -atomic_t add_dev_cnt; -wait_queue_head_t waitq; };struct ism_event {
@@ -69,9 +66,6 @@ struct ism_client {*/ void (*handle_irq)(struct ism_dev *dev,unsigned int bit,u16 dmbemask);/* Private area - don't touch! */ -struct work_struct remove_work; -struct work_struct add_work; -struct ism_dev *tgt_ism;u8 id; };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 56/292 s390/ism: Do not unregister clients with registered DMBs
In reply to Greg Kroah-HartmanFrom: Niklas Schnelle <[email protected]>
[ Upstream commit 266deeea34ffd28c6b6a63edf2af9b5a07161c24 ]
When ism_unregister_client() is called but the client still has DMBs registered it returns -EBUSY and prints an error. This only happens after the client has already been unregistered however. This is unexpected as the unregister claims to have failed. Furthermore as this implies a client bug a WARN() is more appropriate. Thus move the deregistration after the check and use WARN().
--- drivers/s390/net/ism_drv.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/s390/net/ism_drv.c +13 -10
@@ -96,29 +96,32 @@ int ism_unregister_client(struct ism_client *client)int rc =0 ;mutex_lock (&ism_dev_list.mutex); -mutex_lock (&clients_lock); - clients[client->id] =NULL ; -if (client->id +1 == max_client) - max_client--; -mutex_unlock (&clients_lock);list_for_each_entry (ism, &ism_dev_list.list, list) {spin_lock_irqsave (&ism->lock, flags);/* Stop forwarding IRQs and events */ ism->subs[client->id] =NULL ;for (int i =0 ; i <ISM_NR_DMBS ; ++i) {if (ism->sba_client_arr[i] == client->id) { -pr_err ("%s: attempt to unregister client '%s'" -"with registered dmb(s)\n" , __func__, - client->name); +WARN (1 ,"%s: attempt to unregister '%s' with registered dmb(s)\n" , + __func__, client->name); rc = -EBUSY ; - goto out; + goto err_reg_dmb; } }spin_unlock_irqrestore (&ism->lock, flags); } -out:mutex_unlock (&ism_dev_list.mutex); +mutex_lock (&clients_lock); + clients[client->id] =NULL ; +if (client->id +1 == max_client) + max_client--; +mutex_unlock (&clients_lock); +return rc; + +err_reg_dmb: +spin_unlock_irqrestore (&ism->lock, flags); +mutex_unlock (&ism_dev_list.mutex);return rc; }EXPORT_SYMBOL_GPL (ism_unregister_client);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 57/292 icmp6: Fix null-ptr-deref of ip6_null_entry->rt6i_idev in icmp6_dev().
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 2aaa8a15de73874847d62eb595c6683bface80fd ]
With some IPv6 Ext Hdr (RPL, SRv6, etc.), we can send a packet that has the link-local address as src and dst IP and will be forwarded to an external IP in the IPv6 Ext Hdr.
For example, the script below generates a packet whose src IP is the link-local address and dst is updated to 11::.
# for f in $(find /proc/sys/net/ -name *seg6_enabled*); do echo 1 > $f; done # python3
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
from socket import *
from scapy.all import *
SRC_ADDR=DST_ADDR= "fe80::5054:ff:fe12:3456"pkt =
IPv6(src=SRC_ADDR, dst=DST_ADDR)
pkt /=IPv6ExtHdrSegmentRouting(type=4, addresses=["11::", "22::"], segleft=1)sk =
socket(AF_INET6, SOCK_RAW, IPPROTO_RAW)sk.sendto(bytes(pkt), (DST_ADDR, 0))
For such a packet, we call ip6_route_input() to look up a route for the next destination in these three functions depending on the header type.
* ipv6_rthdr_rcv()
* ipv6_rpl_srh_rcv()
* ipv6_srh_rcv()
If no route is found, ip6_null_entry is set to skb, and the following dst_input(skb) calls ip6_pkt_drop().
Finally, in icmp6_dev(), we dereference skb_rt6_info(skb)->rt6i_idev->dev as the input device is the loopback interface. Then, we have to check if skb_rt6_info(skb)->rt6i_idev is NULL or not to avoid NULL pointer deref for ip6_null_entry.
BUG: kernel NULL pointer dereference, address: 0000000000000000 PF: supervisor read access in kernel mode PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP PTI CPU: 0 PID: 157 Comm: python3 Not tainted 6.4.0-11996-gb121d614371c #35 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 RIP: 0010:icmp6_send (net/ipv6/icmp.c:436 net/ipv6/icmp.c:503) Code: fe ff ff 48 c7 40 30 c0 86 5d 83 e8 c6 44 1c 00 e9 c8 fc ff ff 49 8b 46 58 48 83 e0 fe 0f 84 4a fb ff ff 48 8b 80 d0 00 00 00 <48> 8b 00 44 8b 88 e0 00 00 00 e9 34 fb ff ff 4d 85 ed 0f 85 69 01 RSP: 0018:ffffc90000003c70 EFLAGS: 00000286 RAX: 0000000000000000 RBX: 0000000000000001 RCX: 00000000000000e0 RDX: 0000000000000021 RSI: 0000000000000000 RDI: ffff888006d72a18 RBP: ffffc90000003d80 R08: 0000000000000000 R09: 0000000000000001 R10: ffffc90000003d98 R11: 0000000000000040 R12: ffff888006d72a10 R13: 0000000000000000 R14: ffff8880057fb800 R15: ffffffff835d86c0 FS: 00007f9dc72ee740(0000) GS:ffff88807dc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 00000000057b2000 CR4: 00000000007506f0 PKRU: 55555554 Call Trace: <IRQ> ip6_pkt_drop (net/ipv6/route.c:4513) ipv6_rthdr_rcv (net/ipv6/exthdrs.c:640 net/ipv6/exthdrs.c:686) ip6_protocol_deliver_rcu (net/ipv6/ip6_input.c:437 (discriminator 5)) ip6_input_finish (./include/linux/rcupdate.h:781 net/ipv6/ip6_input.c:483) __netif_receive_skb_one_core (net/core/dev.c:5455) process_backlog (./include/linux/rcupdate.h:781 net/core/dev.c:5895) __napi_poll (net/core/dev.c:6460) net_rx_action (net/core/dev.c:6529 net/core/dev.c:6660) __do_softirq (./arch/x86/include/asm/jump_label.h:27 ./include/linux/jump_label.h:207 ./include/trace/events/irq.h:142 kernel/softirq.c:554) do_softirq (kernel/softirq.c:454 kernel/softirq.c:441) </IRQ> <TASK> __local_bh_enable_ip (kernel/softirq.c:381) __dev_queue_xmit (net/core/dev.c:4231) ip6_finish_output2 (./include/net/neighbour.h:544 net/ipv6/ip6_output.c:135) rawv6_sendmsg (./include/net/dst.h:458 ./include/linux/netfilter.h:303 net/ipv6/raw.c:656 net/ipv6/raw.c:914) sock_sendmsg (net/socket.c:725 net/socket.c:748) __sys_sendto (net/socket.c:2134) __x64_sys_sendto (net/socket.c:2146 net/socket.c:2142 net/socket.c:2142) do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120) RIP: 0033:0x7f9dc751baea Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f 1e fa 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 15 b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 7e c3 0f 1f 44 00 00 41 54 48 83 ec 30 44 89 RSP: 002b:00007ffe98712c38 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00007ffe98712cf8 RCX: 00007f9dc751baea RDX: 0000000000000060 RSI: 00007f9dc6460b90 RDI: 0000000000000003 RBP: 00007f9dc56e8be0 R08: 00007ffe98712d70 R09: 000000000000001c R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: ffffffffc4653600 R14: 0000000000000001 R15: 00007f9dc6af5d1b </TASK> Modules linked in: CR2: 0000000000000000 ---[ end trace 0000000000000000 ]--- RIP: 0010:icmp6_send (net/ipv6/icmp.c:436 net/ipv6/icmp.c:503) Code: fe ff ff 48 c7 40 30 c0 86 5d 83 e8 c6 44 1c 00 e9 c8 fc ff ff 49 8b 46 58 48 83 e0 fe 0f 84 4a fb ff ff 48 8b 80 d0 00 00 00 <48> 8b 00 44 8b 88 e0 00 00 00 e9 34 fb ff ff 4d 85 ed 0f 85 69 01 RSP: 0018:ffffc90000003c70 EFLAGS: 00000286 RAX: 0000000000000000 RBX: 0000000000000001 RCX: 00000000000000e0 RDX: 0000000000000021 RSI: 0000000000000000 RDI: ffff888006d72a18 RBP: ffffc90000003d80 R08: 0000000000000000 R09: 0000000000000001 R10: ffffc90000003d98 R11: 0000000000000040 R12: ffff888006d72a10 R13: 0000000000000000 R14: ffff8880057fb800 R15: ffffffff835d86c0 FS: 00007f9dc72ee740(0000) GS:ffff88807dc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 00000000057b2000 CR4: 00000000007506f0 PKRU: 55555554 Kernel panic - not syncing: Fatal exception in interrupt
Kernel Offset: disabled
--- net/ipv6/icmp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/ipv6/icmp.c +4 -1
@@ -424,7 +424,10 @@ static struct net_device *icmp6_dev(const struct sk_buff *skb)if (unlikely (dev->ifindex ==LOOPBACK_IFINDEX ||netif_is_l3_master (skb->dev))) {const struct rt6_info *rt6 =skb_rt6_info (skb); -if (rt6) +/* The destination could be an external IP in Ext Hdr (SRv6, RPL, etc.), +* and ip6_null_entry could be set to skb if no route is found. +*/ +if (rt6 && rt6->rt6i_idev) dev = rt6->rt6i_idev->dev; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 58/292 udp6: fix udp6_ehashfn() typo
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 51d03e2f2203e76ed02d33fb5ffbb5fc85ffaf54 ]
Amit Klein reported that udp6_ehash_secret was initialized but never used.
--- net/ipv6/udp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/udp.c +1 -1
@@ -91,7 +91,7 @@ static u32 udp6_ehashfn(const struct net *net, fhash =__ipv6_addr_jhash (faddr, udp_ipv6_hash_secret);return __inet6_ehashfn (lhash, lport, fhash, fport, - udp_ipv6_hash_secret +net_hash_mix (net)); + udp6_ehash_secret +net_hash_mix (net)); }int udp_v6_get_port (struct sock *sk,unsigned short snum)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 59/292 ntb: idt: Fix error handling in idt_pci_driver_init()
In reply to Greg Kroah-HartmanFrom: Yuan Can <[email protected]>
[ Upstream commit c012968259b451dc4db407f2310fe131eaefd800 ]
A problem about ntb_hw_idt create debugfs failed is triggered with the following log given:
[ 1236.637636] IDT PCI-E Non-Transparent Bridge Driver 2.0 [ 1236.639292] debugfs: Directory 'ntb_hw_idt' with parent '/' already present!
The reason is that idt_pci_driver_init() returns pci_register_driver() directly without checking its return value, if pci_register_driver() failed, it returns without destroy the newly created debugfs, resulting the debugfs of ntb_hw_idt can never be created later.
idt_pci_driver_init()
debugfs_create_dir() # create debugfs directory pci_register_driver()
driver_register()
bus_add_driver()
priv = kzalloc(...) # OOM happened
# return without destroy debugfs directory
Fix by removing debugfs when pci_register_driver() returns error.
--- drivers/ntb/hw/idt/ntb_hw_idt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ntb/hw/idt/ntb_hw_idt.c +6 -1
@@ -2891,6 +2891,7 @@ static struct pci_driver idt_pci_driver = {static int __init idt_pci_driver_init (void ) { +int ret;pr_info ("%s %s\n" ,NTB_DESC ,NTB_VER );/* Create the top DebugFS directory if the FS is initialized */
@@ -2898,7 +2899,11 @@ static int __init idt_pci_driver_init(void) dbgfs_topdir =debugfs_create_dir (KBUILD_MODNAME ,NULL );/* Register the NTB hardware driver to handle the PCI device */ -return pci_register_driver (&idt_pci_driver); + ret =pci_register_driver (&idt_pci_driver); +if (ret) +debugfs_remove_recursive (dbgfs_topdir); + +return ret; }module_init (idt_pci_driver_init);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 60/292 NTB: amd: Fix error handling in amd_ntb_pci_driver_init()
In reply to Greg Kroah-HartmanFrom: Yuan Can <[email protected]>
[ Upstream commit 98af0a33c1101c29b3ce4f0cf4715fd927c717f9 ]
A problem about ntb_hw_amd create debugfs failed is triggered with the following log given:
[ 618.431232] AMD(R) PCI-E Non-Transparent Bridge Driver 1.0 [ 618.433284] debugfs: Directory 'ntb_hw_amd' with parent '/' already present!
The reason is that amd_ntb_pci_driver_init() returns pci_register_driver() directly without checking its return value, if pci_register_driver() failed, it returns without destroy the newly created debugfs, resulting the debugfs of ntb_hw_amd can never be created later.
amd_ntb_pci_driver_init()
debugfs_create_dir() # create debugfs directory pci_register_driver()
driver_register()
bus_add_driver()
priv = kzalloc(...) # OOM happened
# return without destroy debugfs directory
Fix by removing debugfs when pci_register_driver() returns error.
--- drivers/ntb/hw/amd/ntb_hw_amd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ntb/hw/amd/ntb_hw_amd.c +6 -1
@@ -1338,12 +1338,17 @@ static struct pci_driver amd_ntb_pci_driver = {static int __init amd_ntb_pci_driver_init (void ) { +int ret;pr_info ("%s %s\n" ,NTB_DESC ,NTB_VER );if (debugfs_initialized ()) debugfs_dir =debugfs_create_dir (KBUILD_MODNAME ,NULL ); -return pci_register_driver (&amd_ntb_pci_driver); + ret =pci_register_driver (&amd_ntb_pci_driver); +if (ret) +debugfs_remove_recursive (debugfs_dir); + +return ret; }module_init (amd_ntb_pci_driver_init);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 61/292 ntb: intel: Fix error handling in intel_ntb_pci_driver_init()
In reply to Greg Kroah-HartmanFrom: Yuan Can <[email protected]>
[ Upstream commit 4c3c796aca02883ad35bb117468938cc4022ca41 ]
A problem about ntb_hw_intel create debugfs failed is triggered with the following log given:
[ 273.112733] Intel(R) PCI-E Non-Transparent Bridge Driver 2.0 [ 273.115342] debugfs: Directory 'ntb_hw_intel' with parent '/' already present!
The reason is that intel_ntb_pci_driver_init() returns pci_register_driver() directly without checking its return value, if pci_register_driver() failed, it returns without destroy the newly created debugfs, resulting the debugfs of ntb_hw_intel can never be created later.
intel_ntb_pci_driver_init()
debugfs_create_dir() # create debugfs directory pci_register_driver()
driver_register()
bus_add_driver()
priv = kzalloc(...) # OOM happened
# return without destroy debugfs directory
Fix by removing debugfs when pci_register_driver() returns error.
--- drivers/ntb/hw/intel/ntb_hw_gen1.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ntb/hw/intel/ntb_hw_gen1.c +6 -1
@@ -2064,12 +2064,17 @@ static struct pci_driver intel_ntb_pci_driver = {static int __init intel_ntb_pci_driver_init (void ) { +int ret;pr_info ("%s %s\n" ,NTB_DESC ,NTB_VER );if (debugfs_initialized ()) debugfs_dir =debugfs_create_dir (KBUILD_MODNAME ,NULL ); -return pci_register_driver (&intel_ntb_pci_driver); + ret =pci_register_driver (&intel_ntb_pci_driver); +if (ret) +debugfs_remove_recursive (debugfs_dir); + +return ret; }module_init (intel_ntb_pci_driver_init);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 62/292 NTB: ntb_transport: fix possible memory leak while device_register() fails
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 8623ccbfc55d962e19a3537652803676ad7acb90 ]
If device_register() returns error, the name allocated by dev_set_name() need be freed. As comment of device_register() says, it should use put_device() to give up the reference in the error path. So fix this by calling put_device(), then the name can be freed in kobject_cleanup(), and client_dev is freed in ntb_transport_client_release().
--- drivers/ntb/ntb_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/ntb_transport.c +1 -1
@@ -410,7 +410,7 @@ int ntb_transport_register_client_dev(char *device_name) rc =device_register (dev);if (rc) { -kfree (client_dev); +put_device (dev); goto err; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 63/292 NTB: ntb_tool: Add check for devm_kcalloc
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 2790143f09938776a3b4f69685b380bae8fd06c7 ]
As the devm_kcalloc may return NULL pointer,
it should be better to add check for the return
value, as same as the others.
--- drivers/ntb/test/ntb_tool.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/ntb/test/ntb_tool.c +2 -0
@@ -998,6 +998,8 @@ static int tool_init_mws(struct tool_ctx *tc) tc->peers[pidx].outmws =devm_kcalloc (&tc->ntb->dev, tc->peers[pidx].outmw_cnt,sizeof (*tc->peers[pidx].outmws),GFP_KERNEL ); +if (tc->peers[pidx].outmws ==NULL ) +return -ENOMEM ;for (widx =0 ; widx < tc->peers[pidx].outmw_cnt; widx++) { tc->peers[pidx].outmws[widx].pidx = pidx;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 64/292 ipv6/addrconf: fix a potential refcount underflow for idev
In reply to Greg Kroah-HartmanFrom: Ziyang Xuan <[email protected]>
[ Upstream commit 06a0716949c22e2aefb648526580671197151acc ]
Now in addrconf_mod_rs_timer(), reference idev depends on whether rs_timer is not pending. Then modify rs_timer timeout.
There is a time gap in [1], during which if the pending rs_timer becomes not pending. It will miss to hold idev, but the rs_timer is activated. Thus rs_timer callback function addrconf_rs_timer() will be executed and put idev later without holding idev. A refcount underflow issue for idev can be caused by this.
if (!timer_pending(&idev->rs_timer)) in6_dev_hold(idev); <--------------[1] mod_timer(&idev->rs_timer, jiffies + when);
To fix the issue, hold idev if mod_timer() return 0.
--- net/ipv6/addrconf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/ipv6/addrconf.c +1 -2
@@ -318,9 +318,8 @@ static void addrconf_del_dad_work(struct inet6_ifaddr *ifp)static void addrconf_mod_rs_timer (struct inet6_dev *idev,unsigned long when) { -if (!timer_pending (&idev->rs_timer)) +if (!mod_timer (&idev->rs_timer, jiffies + when))in6_dev_hold (idev); -mod_timer (&idev->rs_timer, jiffies + when); } static void addrconf_mod_dad_work(struct inet6_ifaddr *ifp,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 65/292 HID: hyperv: avoid struct memcpy overrun warning
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 5f151364b1da6bd217632fd4ee8cc24eaf66a497 ]
A previous patch addressed the fortified memcpy warning for most builds, but I still see this one with gcc-9:
In file included from include/linux/string.h:254,
from drivers/hid/hid-hyperv.c:8:
In function 'fortify_memcpy_chk',
inlined from 'mousevsc_on_receive' at drivers/hid/hid-hyperv.c:272:3:include/linux/fortify-string.h:583:4: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning]
583 | __write_overflow_field(p_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~My guess is that the WARN_ON() itself is what confuses gcc, so it no longer sees that there is a correct range check. Rework the code in a way that helps readability and avoids the warning.
--- drivers/hid/hid-hyperv.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/hid/hid-hyperv.c +4 -6
@@ -258,19 +258,17 @@ static void mousevsc_on_receive(struct hv_device *device,switch (hid_msg_hdr->type) {case SYNTH_HID_PROTOCOL_RESPONSE : + len =struct_size (pipe_msg, data, pipe_msg->size); +/* * While it will be impossible for us to protect against * malicious/buggy hypervisor/host, add a check here to * ensure we don't corrupt memory. */ -if (struct_size (pipe_msg, data, pipe_msg->size) - >sizeof (struct mousevsc_prt_msg )) { -WARN_ON (1 ); +if (WARN_ON (len >sizeof (struct mousevsc_prt_msg )))break ; - } -memcpy (&input_dev->protocol_resp, pipe_msg, -struct_size (pipe_msg, data, pipe_msg->size)); +memcpy (&input_dev->protocol_resp, pipe_msg, len);complete (&input_dev->wait_event);break ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 66/292 net: dsa: qca8k: Add check for skb_copy
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 87355b7c3da9bfd81935caba0ab763355147f7b0 ]
Add check for the return value of skb_copy in order to avoid NULL pointer dereference.
--- drivers/net/dsa/qca/qca8k-8xxx.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/dsa/qca/qca8k-8xxx.c +3 -0
@@ -588,6 +588,9 @@ qca8k_phy_eth_busy_wait(struct qca8k_mgmt_eth_data *mgmt_eth_data,bool ack;int ret; +if (!skb) +return -ENOMEM ; +reinit_completion (&mgmt_eth_data->rw_done);/* Increment seq_num and set it in the copy pkt */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 67/292 x86/fineibt: Poison ENDBR at +0
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 04505bbbbb15da950ea0239e328a76a3ad2376e0 ]
Alyssa noticed that when building the kernel with CFI_CLANG+IBT and booting on IBT enabled hardware to obtain FineIBT, the indirect functions look like:
__cfi_foo:
endbr64 subl $hash, %r10d jz 1f ud2 nop 1: foo: endbr64
This is because the compiler generates code for kCFI+IBT. In that case the caller does the hash check and will jump to +0, so there must be an ENDBR there. The compiler doesn't know about FineIBT at all; also it is possible to actually use kCFI+IBT when booting with 'cfi=kcfi' on IBT enabled hardware.
Having this second ENDBR however makes it possible to elide the CFI check. Therefore, we should poison this second ENDBR when switching to FineIBT mode.
--- arch/x86/kernel/alternative.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/x86/kernel/alternative.c +16 -0
@@ -940,6 +940,17 @@ static int cfi_rewrite_preamble(s32 *start, s32 *end)return 0 ; } +static void cfi_rewrite_endbr (s32 *start,s32 *end) +{ +s32 *s; + +for (s = start; s < end; s++) { +void *addr = (void *)s + *s; + +poison_endbr (addr+16 , false); + } +} +/* .retpoline_sites */ static int cfi_rand_callers (s32 *start,s32 *end) {
@@ -1034,14 +1045,19 @@ static void __apply_fineibt(s32 *start_retpoline, s32 *end_retpoline,return ;case CFI_FINEIBT : +/* place the FineIBT preamble at func()-16 */ ret =cfi_rewrite_preamble (start_cfi, end_cfi);if (ret) goto err; +/* rewrite the callers to target func()-16 */ ret =cfi_rewrite_callers (start_retpoline, end_retpoline);if (ret) goto err; +/* now that nobody targets func()+0, remove ENDBR there */ +cfi_rewrite_endbr (start_cfi, end_cfi); +if (builtin)pr_info ("Using FineIBT CFI\n" );return ;
Signature · 1 line
2.39.2
Re: [PATCH 6.4 067/292] x86/fineibt: Poison ENDBR at +0
Quoted 28 lines · Greg Kroah-Hartman
From: Peter Zijlstra <[email protected]>
[ Upstream commit
04505bbbbb15da950ea0239e328a76a3ad2376e0]Alyssa noticed that when building the kernel with CFI_CLANG+IBT and booting on IBT enabled hardware to obtain FineIBT, the indirect functions look like:
__cfi_foo:endbr64 subl $hash, %r10d jz 1f ud2 nop 1: foo: endbr64This is because the compiler generates code for kCFI+IBT. In that case the caller does the hash check and will jump to +0, so there must be an ENDBR there. The compiler doesn't know about FineIBT at all; also it is possible to actually use kCFI+IBT when booting with 'cfi=kcfi' on IBT enabled hardware.
Having this second ENDBR however makes it possible to elide the CFI check. Therefore, we should poison this second ENDBR when switching to FineIBT mode.
Quoted 7 lines
Fixes 931ab63664f0 ("x86/ibt: Implement FineIBT")Reported-by "Milburn, Alyssa" <[email protected]>Signed-off-by Peter Zijlstra (Intel) <[email protected]>Reviewed-by Kees Cook <[email protected]>Reviewed-by Sami Tolvanen <[email protected]>Signed-off-by Sasha Levin <[email protected]>
If you take this patch you should also take the patches from Brian that moves ret_from_fork() into C, otherwise you end up with a non-bootable kernel.
Greg Kroah-Hartman
maintainerRe: [PATCH 6.4 067/292] x86/fineibt: Poison ENDBR at +0
Quoted 37 lines · Peter Zijlstra
Quoted 28 lines · Greg Kroah-Hartman
From: Peter Zijlstra <[email protected]>
[ Upstream commit
04505bbbbb15da950ea0239e328a76a3ad2376e0]Alyssa noticed that when building the kernel with CFI_CLANG+IBT and booting on IBT enabled hardware to obtain FineIBT, the indirect functions look like:
__cfi_foo:endbr64 subl $hash, %r10d jz 1f ud2 nop 1: foo: endbr64This is because the compiler generates code for kCFI+IBT. In that case the caller does the hash check and will jump to +0, so there must be an ENDBR there. The compiler doesn't know about FineIBT at all; also it is possible to actually use kCFI+IBT when booting with 'cfi=kcfi' on IBT enabled hardware.
Having this second ENDBR however makes it possible to elide the CFI check. Therefore, we should poison this second ENDBR when switching to FineIBT mode.
Quoted 7 lines
Fixes 931ab63664f0 ("x86/ibt: Implement FineIBT")Reported-by "Milburn, Alyssa" <[email protected]>Signed-off-by Peter Zijlstra (Intel) <[email protected]>Reviewed-by Kees Cook <[email protected]>Reviewed-by Sami Tolvanen <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 3 lines
If you take this patch you should also take the patches from Brian that moves
ret_from_fork()into C, otherwise you end up with a non-bootable kernel.
Thanks for letting me know, I've just dropped this patch instead for now.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 68/292 platform/x86: wmi: Break possible infinite loop when parsing GUID
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 028e6e204ace1f080cfeacd72c50397eb8ae8883 ]
The while-loop may break on one of the two conditions, either ID string is empty or GUID matches. The second one, may never be reached if the parsed string is not correct GUID. In such a case the loop will never advance to check the next ID.
Break possible infinite loop by factoring out guid_parse_and_compare() helper which may be moved to the generic header for everyone later on and preventing from similar mistake in the future.
Interestingly that firstly it appeared when WMI was turned into a bus driver, but later when duplicated GUIDs were checked, the while-loop has been replaced by for-loop and hence no mistake made again.
--- drivers/platform/x86/wmi.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/platform/x86/wmi.c +12 -10
@@ -136,6 +136,16 @@ static acpi_status find_guid(const char *guid_string, struct wmi_block **out)return AE_NOT_FOUND ; } +static bool guid_parse_and_compare (const char *string,const guid_t *guid) +{ +guid_t guid_input; + +if (guid_parse (string, &guid_input)) +return false; + +return guid_equal (&guid_input, guid); +} +static const void *find_guid_context (struct wmi_block *wblock,struct wmi_driver *wdriver) {
@@ -146,11 +156,7 @@ static const void *find_guid_context(struct wmi_block *wblock,return NULL ;while (*id->guid_string) { -guid_t guid_input; - -if (guid_parse (id->guid_string, &guid_input)) -continue ; -if (guid_equal (&wblock->gblock.guid, &guid_input)) +if (guid_parse_and_compare (id->guid_string, &wblock->gblock.guid))return id->context; id++; }
@@ -827,11 +833,7 @@ static int wmi_dev_match(struct device *dev, struct device_driver *driver)return 0 ;while (*id->guid_string) { -guid_t driver_guid; - -if (WARN_ON (guid_parse (id->guid_string, &driver_guid))) -continue ; -if (guid_equal (&driver_guid, &wblock->gblock.guid)) +if (guid_parse_and_compare (id->guid_string, &wblock->gblock.guid))return 1 ; id++;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 69/292 net/sched: taprio: replace tc_taprio_qopt_offload :: enable with a "cmd" enum
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 2d800bc500fb3fb07a0fb42e2d0a1356fb9e1e8f ]
Inspired from struct flow_cls_offload :: cmd, in order for taprio to be able to report statistics (which is future work), it seems that we need to drill one step further with the ndo_setup_tc(TC_SETUP_QDISC_TAPRIO) multiplexing, and pass the command as part of the common portion of the muxed structure.
Since we already have an "enable" variable in tc_taprio_qopt_offload, refactor all drivers to check for "cmd" instead of "enable", and reject every other command except "replace" and "destroy" - to be future proof.
Stable-dep-of: 8046063df887 ("igc: Rename qbv_enable to taprio_offload_enable")
--- drivers/net/dsa/hirschmann/hellcreek.c | 14 +++++++++----- drivers/net/dsa/ocelot/felix_vsc9959.c | 4 +++- drivers/net/dsa/sja1105/sja1105_tas.c | 7 +++++-- drivers/net/ethernet/engleder/tsnep_selftests.c | 12 ++++++------ drivers/net/ethernet/engleder/tsnep_tc.c | 4 +++- drivers/net/ethernet/freescale/enetc/enetc_qos.c | 6 +++++- drivers/net/ethernet/intel/igc/igc_main.c | 13 +++++++++++-- .../net/ethernet/microchip/lan966x/lan966x_tc.c | 10 ++++++++-- drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 7 +++++-- drivers/net/ethernet/ti/am65-cpsw-qos.c | 11 ++++++++--- include/net/pkt_sched.h | 7 ++++++- net/sched/sch_taprio.c | 4 ++-- 12 files changed, 71 insertions(+), 28 deletions(-)
drivers/net/dsa/hirschmann/hellcreek.c +9 -5
@@ -1885,13 +1885,17 @@ static int hellcreek_port_setup_tc(struct dsa_switch *ds, int port,case TC_SETUP_QDISC_TAPRIO : {struct tc_taprio_qopt_offload *taprio = type_data; -if (!hellcreek_validate_schedule (hellcreek, taprio)) -return -EOPNOTSUPP ; +switch (taprio->cmd) { +case TAPRIO_CMD_REPLACE : +if (!hellcreek_validate_schedule (hellcreek, taprio)) +return -EOPNOTSUPP ; -if (taprio->enable)return hellcreek_port_set_schedule (ds, port, taprio); - -return hellcreek_port_del_schedule (ds, port); +case TAPRIO_CMD_DESTROY : +return hellcreek_port_del_schedule (ds, port); +default : +return -EOPNOTSUPP ; + } }default :return -EOPNOTSUPP ;
drivers/net/dsa/ocelot/felix_vsc9959.c +3 -1
@@ -1436,7 +1436,7 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port,mutex_lock (&ocelot->tas_lock); -if (!taprio->enable) { +if (taprio->cmd ==TAPRIO_CMD_DESTROY ) {ocelot_port_mqprio (ocelot, port, &taprio->mqprio);ocelot_rmw_rix (ocelot,0 ,QSYS_TAG_CONFIG_ENABLE ,QSYS_TAG_CONFIG , port);
@@ -1448,6 +1448,8 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port,mutex_unlock (&ocelot->tas_lock);return 0 ; + }else if (taprio->cmd !=TAPRIO_CMD_REPLACE ) { +return -EOPNOTSUPP ; } ret =ocelot_port_mqprio (ocelot, port, &taprio->mqprio);
drivers/net/dsa/sja1105/sja1105_tas.c +5 -2
@@ -516,10 +516,11 @@ int sja1105_setup_tc_taprio(struct dsa_switch *ds, int port,/* Can't change an already configured port (must delete qdisc first). * Can't delete the qdisc from an unconfigured port. */ -if (!!tas_data->offload[port] == admin->enable) +if ((!!tas_data->offload[port] && admin->cmd ==TAPRIO_CMD_REPLACE ) || + (!tas_data->offload[port] && admin->cmd ==TAPRIO_CMD_DESTROY ))return -EINVAL ; -if (!admin->enable) { +if (admin->cmd ==TAPRIO_CMD_DESTROY ) {taprio_offload_free (tas_data->offload[port]); tas_data->offload[port] =NULL ;
@@ -528,6 +529,8 @@ int sja1105_setup_tc_taprio(struct dsa_switch *ds, int port,return rc;return sja1105_static_config_reload (priv,SJA1105_SCHEDULING ); + }else if (admin->cmd !=TAPRIO_CMD_REPLACE ) { +return -EOPNOTSUPP ; }/* The cycle time extension is the amount of time the last cycle from
drivers/net/ethernet/engleder/tsnep_selftests.c +6 -6
@@ -329,7 +329,7 @@ static bool disable_taprio(struct tsnep_adapter *adapter)int retval;memset (&qopt,0 ,sizeof (qopt)); - qopt.enable =0 ; + qopt.cmd =TAPRIO_CMD_DESTROY ; retval =tsnep_tc_setup (adapter->netdev,TC_SETUP_QDISC_TAPRIO , &qopt);if (retval)return false;
@@ -360,7 +360,7 @@ static bool tsnep_test_taprio(struct tsnep_adapter *adapter)for (i =0 ; i <255 ; i++) qopt->entries[i].command =TC_TAPRIO_CMD_SET_GATES ; - qopt->enable =1 ; + qopt->cmd =TAPRIO_CMD_REPLACE ; qopt->base_time =ktime_set (0 ,0 ); qopt->cycle_time =1500000 ; qopt->cycle_time_extension =0 ;
@@ -382,7 +382,7 @@ static bool tsnep_test_taprio(struct tsnep_adapter *adapter)if (!run_taprio (adapter, qopt,100 )) goto failed; - qopt->enable =1 ; + qopt->cmd =TAPRIO_CMD_REPLACE ; qopt->base_time =ktime_set (0 ,0 ); qopt->cycle_time =411854 ; qopt->cycle_time_extension =0 ;
@@ -406,7 +406,7 @@ static bool tsnep_test_taprio(struct tsnep_adapter *adapter)if (!run_taprio (adapter, qopt,100 )) goto failed; - qopt->enable =1 ; + qopt->cmd =TAPRIO_CMD_REPLACE ; qopt->base_time =ktime_set (0 ,0 );delay_base_time (adapter, qopt,12 ); qopt->cycle_time =125000 ;
@@ -457,7 +457,7 @@ static bool tsnep_test_taprio_change(struct tsnep_adapter *adapter)for (i =0 ; i <255 ; i++) qopt->entries[i].command =TC_TAPRIO_CMD_SET_GATES ; - qopt->enable =1 ; + qopt->cmd =TAPRIO_CMD_REPLACE ; qopt->base_time =ktime_set (0 ,0 ); qopt->cycle_time =100000 ; qopt->cycle_time_extension =0 ;
@@ -610,7 +610,7 @@ static bool tsnep_test_taprio_extension(struct tsnep_adapter *adapter)for (i =0 ; i <255 ; i++) qopt->entries[i].command =TC_TAPRIO_CMD_SET_GATES ; - qopt->enable =1 ; + qopt->cmd =TAPRIO_CMD_REPLACE ; qopt->base_time =ktime_set (0 ,0 ); qopt->cycle_time =100000 ; qopt->cycle_time_extension =50000 ;
drivers/net/ethernet/engleder/tsnep_tc.c +3 -1
@@ -325,7 +325,7 @@ static int tsnep_taprio(struct tsnep_adapter *adapter,if (!adapter->gate_control)return -EOPNOTSUPP ; -if (!qopt->enable) { +if (qopt->cmd ==TAPRIO_CMD_DESTROY ) {/* disable gate control if active */ mutex_lock (&adapter->gate_control_lock);
@@ -337,6 +337,8 @@ static int tsnep_taprio(struct tsnep_adapter *adapter,mutex_unlock (&adapter->gate_control_lock);return 0 ; + }else if (qopt->cmd !=TAPRIO_CMD_REPLACE ) { +return -EOPNOTSUPP ; } retval =tsnep_validate_gcl (qopt);
drivers/net/ethernet/freescale/enetc/enetc_qos.c +5 -1
@@ -65,7 +65,7 @@ static int enetc_setup_taprio(struct net_device *ndev, gcl_len = admin_conf->num_entries; tge =enetc_rd (hw,ENETC_PTGCR ); -if (!admin_conf->enable) { +if (admin_conf->cmd ==TAPRIO_CMD_DESTROY ) {enetc_wr (hw,ENETC_PTGCR , tge & ~ENETC_PTGCR_TGE );enetc_reset_ptcmsdur (hw);
@@ -138,6 +138,10 @@ int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data)struct enetc_ndev_priv *priv =netdev_priv (ndev);int err, i; +if (taprio->cmd !=TAPRIO_CMD_REPLACE && + taprio->cmd !=TAPRIO_CMD_DESTROY ) +return -EOPNOTSUPP ; +/* TSD and Qbv are mutually exclusive in hardware */ for (i =0 ; i < priv->num_tx_rings; i++)if (priv->tx_ring[i]->tsd_enable)
drivers/net/ethernet/intel/igc/igc_main.c +11 -2
@@ -6117,9 +6117,18 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter,size_t n;int i; - adapter->qbv_enable = qopt->enable; +switch (qopt->cmd) { +case TAPRIO_CMD_REPLACE : + adapter->qbv_enable = true; +break ; +case TAPRIO_CMD_DESTROY : + adapter->qbv_enable = false; +break ; +default : +return -EOPNOTSUPP ; + } -if (!qopt->enable) +if (!adapter->qbv_enable)return igc_tsn_clear_schedule (adapter);if (qopt->base_time <0 )
drivers/net/ethernet/microchip/lan966x/lan966x_tc.c +8 -2
@@ -21,8 +21,14 @@ static int lan966x_tc_setup_qdisc_mqprio(struct lan966x_port *port,static int lan966x_tc_setup_qdisc_taprio (struct lan966x_port *port,struct tc_taprio_qopt_offload *taprio) { -return taprio->enable ?lan966x_taprio_add (port, taprio) : -lan966x_taprio_del (port); +switch (taprio->cmd) { +case TAPRIO_CMD_REPLACE : +return lan966x_taprio_add (port, taprio); +case TAPRIO_CMD_DESTROY : +return lan966x_taprio_del (port); +default : +return -EOPNOTSUPP ; + } } static int lan966x_tc_setup_qdisc_tbf(struct lan966x_port *port,
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +5 -2
@@ -966,8 +966,11 @@ static int tc_setup_taprio(struct stmmac_priv *priv,return -EOPNOTSUPP ; } -if (!qopt->enable) +if (qopt->cmd ==TAPRIO_CMD_DESTROY ) goto disable; +else if (qopt->cmd !=TAPRIO_CMD_REPLACE ) +return -EOPNOTSUPP ; +if (qopt->num_entries >= dep)return -EINVAL ;if (!qopt->cycle_time)
@@ -988,7 +991,7 @@ static int tc_setup_taprio(struct stmmac_priv *priv,mutex_lock (&priv->plat->est->lock); priv->plat->est->gcl_size = size; - priv->plat->est->enable = qopt->enable; + priv->plat->est->enable = qopt->cmd ==TAPRIO_CMD_REPLACE ;mutex_unlock (&priv->plat->est->lock);for (i =0 ; i < size; i++) {
drivers/net/ethernet/ti/am65-cpsw-qos.c +8 -3
@@ -450,7 +450,7 @@ static int am65_cpsw_configure_taprio(struct net_device *ndev,am65_cpsw_est_update_state (ndev); -if (!est_new->taprio.enable) { +if (est_new->taprio.cmd ==TAPRIO_CMD_DESTROY ) {am65_cpsw_stop_est (ndev);return ret; }
@@ -476,7 +476,7 @@ static int am65_cpsw_configure_taprio(struct net_device *ndev,am65_cpsw_est_set_sched_list (ndev, est_new);am65_cpsw_port_est_assign_buf_num (ndev, est_new->buf); -am65_cpsw_est_set (ndev, est_new->taprio.enable); +am65_cpsw_est_set (ndev, est_new->taprio.cmd ==TAPRIO_CMD_REPLACE );if (tact ==TACT_PROG ) { ret =am65_cpsw_timer_set (ndev, est_new);
@@ -520,7 +520,7 @@ static int am65_cpsw_set_taprio(struct net_device *ndev, void *type_data)am65_cpsw_cp_taprio (taprio, &est_new->taprio); ret =am65_cpsw_configure_taprio (ndev, est_new);if (!ret) { -if (taprio->enable) { +if (taprio->cmd ==TAPRIO_CMD_REPLACE ) {devm_kfree (&ndev->dev, port->qos.est_admin); port->qos.est_admin = est_new;
@@ -564,8 +564,13 @@ static void am65_cpsw_est_link_up(struct net_device *ndev, int link_speed)static int am65_cpsw_setup_taprio (struct net_device *ndev,void *type_data) {struct am65_cpsw_port *port =am65_ndev_to_port (ndev); +struct tc_taprio_qopt_offload *taprio = type_data;struct am65_cpsw_common *common = port->common; +if (taprio->cmd !=TAPRIO_CMD_REPLACE && + taprio->cmd !=TAPRIO_CMD_DESTROY ) +return -EOPNOTSUPP ; +if (!IS_ENABLED (CONFIG_TI_AM65_CPSW_TAS ))return -ENODEV ;
include/net/pkt_sched.h +6 -1
@@ -187,6 +187,11 @@ struct tc_taprio_caps { bool broken_mqprio:1; }; +enum tc_taprio_qopt_cmd { +TAPRIO_CMD_REPLACE , +TAPRIO_CMD_DESTROY , +}; +struct tc_taprio_sched_entry {u8 command;/* TC_TAPRIO_CMD_* */
@@ -198,7 +203,7 @@ struct tc_taprio_sched_entry {struct tc_taprio_qopt_offload {struct tc_mqprio_qopt_offload mqprio;struct netlink_ext_ack *extack; -u8 enable; +enum tc_taprio_qopt_cmd cmd;ktime_t base_time;u64 cycle_time;u64 cycle_time_extension;
net/sched/sch_taprio.c +2 -2
@@ -1527,7 +1527,7 @@ static int taprio_enable_offload(struct net_device *dev, "Not enough memory for enabling offload mode");return -ENOMEM ; } - offload->enable =1 ; + offload->cmd =TAPRIO_CMD_REPLACE ; offload->extack = extack;mqprio_qopt_reconstruct (dev, &offload->mqprio.qopt); offload->mqprio.extack = extack;
@@ -1575,7 +1575,7 @@ static int taprio_disable_offload(struct net_device *dev, "Not enough memory to disable offload mode");return -ENOMEM ; } - offload->enable =0 ; + offload->cmd =TAPRIO_CMD_DESTROY ; err = ops->ndo_setup_tc (dev,TC_SETUP_QDISC_TAPRIO , offload);if (err <0 ) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 70/292 igc: Rename qbv_enable to taprio_offload_enable
In reply to Greg Kroah-HartmanFrom: Florian Kauer <[email protected]>
[ Upstream commit 8046063df887bee35c002224267ba46f41be7cf6 ]
In the current implementation the flags adapter->qbv_enable and IGC_FLAG_TSN_QBV_ENABLED have a similar name, but do not have the same meaning. The first one is used only to indicate taprio offload (i.e. when igc_save_qbv_schedule was called), while the second one corresponds to the Qbv mode of the hardware. However, the second one is also used to support the TX launchtime feature, i.e. ETF qdisc offload. This leads to situations where adapter->qbv_enable is false, but the flag IGC_FLAG_TSN_QBV_ENABLED is set. This is prone to confusion.
The rename should reduce this confusion. Since it is a pure rename, it has no impact on functionality.
--- drivers/net/ethernet/intel/igc/igc.h | 2 +- drivers/net/ethernet/intel/igc/igc_main.c | 6 +++--- drivers/net/ethernet/intel/igc/igc_tsn.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/igc/igc.h +1 -1
@@ -191,7 +191,7 @@ struct igc_adapter {int tc_setup_type;ktime_t base_time;ktime_t cycle_time; -bool qbv_enable; +bool taprio_offload_enable;u32 qbv_config_change_errors;bool qbv_transition;unsigned int qbv_count;
drivers/net/ethernet/intel/igc/igc_main.c +3 -3
@@ -6119,16 +6119,16 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter,switch (qopt->cmd) {case TAPRIO_CMD_REPLACE : - adapter->qbv_enable = true; + adapter->taprio_offload_enable = true;break ;case TAPRIO_CMD_DESTROY : - adapter->qbv_enable = false; + adapter->taprio_offload_enable = false;break ;default :return -EOPNOTSUPP ; } -if (!adapter->qbv_enable) +if (!adapter->taprio_offload_enable)return igc_tsn_clear_schedule (adapter);if (qopt->base_time <0 )
drivers/net/ethernet/intel/igc/igc_tsn.c +1 -1
@@ -37,7 +37,7 @@ static unsigned int igc_tsn_new_flags(struct igc_adapter *adapter) {unsigned int new_flags = adapter->flags & ~IGC_FLAG_TSN_ANY_ENABLED ; -if (adapter->qbv_enable) +if (adapter->taprio_offload_enable) new_flags |=IGC_FLAG_TSN_QBV_ENABLED ;if (is_any_launchtime (adapter))
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 71/292 igc: Do not enable taprio offload for invalid arguments
In reply to Greg Kroah-HartmanFrom: Florian Kauer <[email protected]>
[ Upstream commit 82ff5f29b7377d614f0c01fd74b5d0cb225f0adc ]
Only set adapter->taprio_offload_enable after validating the arguments. Otherwise, it stays set even if the offload was not enabled. Since the subsequent code does not get executed in case of invalid arguments, it will not be read at first.
However, by activating and then deactivating another offload (e.g. ETF/TX launchtime offload), taprio_offload_enable is read and erroneously keeps the offload feature of the NIC enabled.
This can be reproduced as follows:
# TAPRIO offload (flags == 0x2) and negative base-time leading to expected -ERANGE
sudo tc qdisc replace dev enp1s0 parent root handle 100 stab overhead 24 taprio \
num_tc 1 \
map 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \
queues 1@0 \
base-time -1000 \
sched-entry S 01 300000 \
flags 0x2
# IGC_TQAVCTRL is 0x0 as expected (iomem=relaxed for reading register)
sudo pcimem /sys/bus/pci/devices/0000:01:00.0/resource0 0x3570 w*1
# Activate ETF offload
sudo tc qdisc replace dev enp1s0 parent root handle 6666 mqprio \
num_tc 3 \
map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
queues 1@0 1@1 2@2 \
hw 0
sudo tc qdisc add dev enp1s0 parent 6666:1 etf \
clockid CLOCK_TAI \
delta 500000 \
offload
# IGC_TQAVCTRL is 0x9 as expected
sudo pcimem /sys/bus/pci/devices/0000:01:00.0/resource0 0x3570 w*1
# Deactivate ETF offload again
sudo tc qdisc delete dev enp1s0 parent 6666:1
# IGC_TQAVCTRL should now be 0x0 again, but is observed as 0x9
sudo pcimem /sys/bus/pci/devices/0000:01:00.0/resource0 0x3570 w*1--- drivers/net/ethernet/intel/igc/igc_main.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +6 -12
@@ -6090,6 +6090,7 @@ static int igc_tsn_clear_schedule(struct igc_adapter *adapter) adapter->base_time =0 ; adapter->cycle_time =NSEC_PER_SEC ; + adapter->taprio_offload_enable = false; adapter->qbv_config_change_errors =0 ; adapter->qbv_transition = false; adapter->qbv_count =0 ;
@@ -6117,20 +6118,12 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter,size_t n;int i; -switch (qopt->cmd) { -case TAPRIO_CMD_REPLACE : - adapter->taprio_offload_enable = true; -break ; -case TAPRIO_CMD_DESTROY : - adapter->taprio_offload_enable = false; -break ; -default : -return -EOPNOTSUPP ; - } - -if (!adapter->taprio_offload_enable) +if (qopt->cmd ==TAPRIO_CMD_DESTROY )return igc_tsn_clear_schedule (adapter); +if (qopt->cmd !=TAPRIO_CMD_REPLACE ) +return -EOPNOTSUPP ; +if (qopt->base_time <0 )return -ERANGE ;
@@ -6142,6 +6135,7 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter, adapter->cycle_time = qopt->cycle_time; adapter->base_time = qopt->base_time; + adapter->taprio_offload_enable = true;igc_ptp_read (adapter, &now);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 72/292 igc: Handle already enabled taprio offload for basetime 0
In reply to Greg Kroah-HartmanFrom: Florian Kauer <[email protected]>
[ Upstream commit e5d88c53d03f8df864776431175d08c053645f50 ]
Since commit e17090eb2494 ("igc: allow BaseTime 0 enrollment for Qbv") it is possible to enable taprio offload with a basetime of 0. However, the check if taprio offload is already enabled (and thus -EALREADY should be returned for igc_save_qbv_schedule) still relied on adapter->base_time > 0.
This can be reproduced as follows:
# TAPRIO offload (flags == 0x2) and base-time = 0
sudo tc qdisc replace dev enp1s0 parent root handle 100 stab overhead 24 taprio \
num_tc 1 \
map 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \
queues 1@0 \
base-time 0 \
sched-entry S 01 300000 \
flags 0x2
# The second call should fail with "Error: Device failed to setup taprio offload."
# But that only happens if base-time was != 0
sudo tc qdisc replace dev enp1s0 parent root handle 100 stab overhead 24 taprio \
num_tc 1 \
map 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \
queues 1@0 \
base-time 0 \
sched-entry S 01 300000 \
flags 0x2--- drivers/net/ethernet/intel/igc/igc_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/igc/igc_main.c +1 -1
@@ -6127,7 +6127,7 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter,if (qopt->base_time <0 )return -ERANGE ; -if (igc_is_device_id_i225 (hw) && adapter->base_time) +if (igc_is_device_id_i225 (hw) && adapter->taprio_offload_enable)return -EALREADY ;if (!validate_schedule (adapter, qopt))
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 73/292 kernel/trace: Fix cleanup logic of enable_trace_eprobe
In reply to Greg Kroah-HartmanFrom: Tzvetomir Stoyanov (VMware) <[email protected]>
[ Upstream commit cf0a624dc706c306294c14e6b3e7694702f25191 ]
The enable_trace_eprobe() function enables all event probes, attached to given trace probe. If an error occurs in enabling one of the event probes, all others should be roll backed. There is a bug in that roll back logic - instead of all event probes, only the failed one is disabled.
--- kernel/trace/trace_eprobe.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
kernel/trace/trace_eprobe.c +16 -2
@@ -675,6 +675,7 @@ static int enable_trace_eprobe(struct trace_event_call *call,struct trace_eprobe *ep;bool enabled;int ret =0 ; +int cnt =0 ; tp =trace_probe_primary_from_call (call);if (WARN_ON_ONCE (!tp))
@@ -698,12 +699,25 @@ static int enable_trace_eprobe(struct trace_event_call *call,if (ret)break ; enabled = true; + cnt++; }if (ret) {/* Failed to enable one of them. Roll back all */ -if (enabled) -disable_eprobe (ep, file->tr); +if (enabled) { +/* +* It's a bug if one failed for something other than memory +* not being available but another eprobe succeeded. +*/ +WARN_ON_ONCE (ret != -ENOMEM ); + +list_for_each_entry (pos,trace_probe_probe_list (tp), list) { + ep = container_of(pos, struct trace_eprobe, tp); +disable_eprobe (ep, file->tr); +if (!--cnt) +break ; + } + }if (file)trace_probe_remove_file (tp, file);else
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 74/292 fprobe: add unlock to match a succeeded ftrace_test_recursion_trylock
In reply to Greg Kroah-HartmanFrom: Ze Gao <[email protected]>
[ Upstream commit 5f0c584daf7464f04114c65dd07269ee2bfedc13 ]
Unlock ftrace recursion lock when fprobe_kprobe_handler() is failed because of some running kprobe.
--- kernel/trace/fprobe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/trace/fprobe.c +3 -1
@@ -102,12 +102,14 @@ static void fprobe_kprobe_handler(unsigned long ip, unsigned long parent_ip,if (unlikely (kprobe_running ())) { fp->nmissed++; -return ; + goto recursion_unlock; }kprobe_busy_begin ();__fprobe_handler (ip, parent_ip, ops, fregs);kprobe_busy_end (); + +recursion_unlock:ftrace_test_recursion_unlock (bit); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 75/292 igc: No strict mode in pure launchtime/CBS offload
In reply to Greg Kroah-HartmanFrom: Florian Kauer <[email protected]>
[ Upstream commit 8b86f10ab64eca0287ea8f7c94e9ad8b2e101c01 ]
The flags IGC_TXQCTL_STRICT_CYCLE and IGC_TXQCTL_STRICT_END prevent the packet transmission over slot and cycle boundaries. This is important for taprio offload where the slots and cycles correspond to the slots and cycles configured for the network.
However, the Qbv offload feature of the i225 is also used for enabling TX launchtime / ETF offload. In that case, however, the cycle has no meaning for the network and is only used internally to adapt the base time register after a second has passed.
Enabling strict mode in this case would unnecessarily prevent the transmission of certain packets (i.e. at the boundary of a second) and thus interferes with the ETF qdisc that promises transmission at a certain point in time.
Similar to ETF, this also applies to CBS offload that also should not be influenced by strict mode unless taprio offload would be enabled at the same time.
This fully reverts
commit d8f45be01dd9 ("igc: Use strict cycles for Qbv scheduling") but its commit message only describes what was already implemented before that commit. The difference to a plain revert of that commit is that it now copes with the base_time = 0 case that was fixed with commit e17090eb2494 ("igc: allow BaseTime 0 enrollment for Qbv")
In particular, enabling strict mode leads to TX hang situations under high traffic if taprio is applied WITHOUT taprio offload but WITH ETF offload, e.g. as in
sudo tc qdisc replace dev enp1s0 parent root handle 100 taprio \
num_tc 1 \
map 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \
queues 1@0 \
base-time 0 \
sched-entry S 01 300000 \
flags 0x1 \
txtime-delay 500000 \
clockid CLOCK_TAI
sudo tc qdisc replace dev enp1s0 parent 100:1 etf \
clockid CLOCK_TAI \
delta 500000 \
offload \
skip_sock_checkand traffic generator
sudo trafgen -i traffic.cfg -o enp1s0 --cpp -n0 -q -t1400ns
with traffic.cfg
#define ETH_P_IP 0x0800
{
/* Ethernet Header */
0x30, 0x1f, 0x9a, 0xd0, 0xf0, 0x0e, # MAC Dest - adapt as needed
0x24, 0x5e, 0xbe, 0x57, 0x2e, 0x36, # MAC Src - adapt as needed
const16(ETH_P_IP),
/* IPv4 Header */
0b01000101, 0, # IPv4 version, IHL, TOS
const16(1028), # IPv4 total length (UDP length + 20 bytes (IP header))
const16(2), # IPv4 ident
0b01000000, 0, # IPv4 flags, fragmentation off
64, # IPv4 TTL
17, # Protocol UDP
csumip(14, 33), # IPv4 checksum
/* UDP Header */
10, 0, 48, 1, # IP Src - adapt as needed
10, 0, 48, 10, # IP Dest - adapt as needed
const16(5555), # UDP Src Port
const16(6666), # UDP Dest Port
const16(1008), # UDP length (UDP header 8 bytes + payload length)
csumudp(14, 34), # UDP checksum
/* Payload */
fill('W', 1000),
}and the observed message with that is for example
igc 0000:01:00.0 enp1s0: Detected Tx Unit Hang
Tx Queue <0> TDH <d0> TDT <f0> next_to_use <f0> next_to_clean <d0> buffer_info[next_to_clean] time_stamp <ffff661f> next_to_watch <00000000245a4efb> jiffies <ffff6e48> desc.status <1048000>
--- drivers/net/ethernet/intel/igc/igc_tsn.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/igc/igc_tsn.c +22 -2
@@ -132,8 +132,28 @@ static int igc_tsn_enable_offload(struct igc_adapter *adapter)wr32 (IGC_STQT (i), ring->start_time);wr32 (IGC_ENDQT (i), ring->end_time); - txqctl |=IGC_TXQCTL_STRICT_CYCLE | -IGC_TXQCTL_STRICT_END ; +if (adapter->taprio_offload_enable) { +/* If taprio_offload_enable is set we are in "taprio" +* mode and we need to be strict about the +* cycles: only transmit a packet if it can be +* completed during that cycle. +* +* If taprio_offload_enable is NOT true when +* enabling TSN offload, the cycle should have +* no external effects, but is only used internally +* to adapt the base time register after a second +* has passed. +* +* Enabling strict mode in this case would +* unnecessarily prevent the transmission of +* certain packets (i.e. at the boundary of a +* second) and thus interfere with the launchtime +* feature that promises transmission at a +* certain point in time. +*/ + txqctl |=IGC_TXQCTL_STRICT_CYCLE | +IGC_TXQCTL_STRICT_END ; + }if (ring->launchtime_enable) txqctl |=IGC_TXQCTL_QUEUE_MODE_LAUNCHT ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 76/292 igc: Fix launchtime before start of cycle
In reply to Greg Kroah-HartmanFrom: Florian Kauer <[email protected]>
[ Upstream commit c1bca9ac0bcb355be11354c2e68bc7bf31f5ac5a ]
It is possible (verified on a running system) that frames are processed by igc_tx_launchtime with a txtime before the start of the cycle (baset_est).
However, the result of txtime - baset_est is written into a u32, leading to a wrap around to a positive number. The following launchtime > 0 check will only branch to executing launchtime = 0 if launchtime is already 0.
Fix it by using a s32 before checking launchtime > 0.
--- drivers/net/ethernet/intel/igc/igc_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/igc/igc_main.c +1 -1
@@ -1016,7 +1016,7 @@ static __le32 igc_tx_launchtime(struct igc_ring *ring, ktime_t txtime,ktime_t base_time = adapter->base_time;ktime_t now =ktime_get_clocktai ();ktime_t baset_est, end_of_cycle; -u32 launchtime; +s32 launchtime;s64 n; n =div64_s64 (ktime_sub_ns (now, base_time), cycle_time);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 77/292 igc: Fix inserting of empty frame for launchtime
In reply to Greg Kroah-HartmanFrom: Florian Kauer <[email protected]>
[ Upstream commit 0bcc62858d6ba62cbade957d69745e6adeed5f3d ]
The insertion of an empty frame was introduced with
commit db0b124f02ba ("igc: Enhance Qbv scheduling by using first flag bit") in order to ensure that the current cycle has at least one packet if there is some packet to be scheduled for the next cycle.
However, the current implementation does not properly check if a packet is already scheduled for the current cycle. Currently, an empty packet is always inserted if and only if txtime >= end_of_cycle && txtime > last_tx_cycle
but since last_tx_cycle is always either the end of the current cycle (end_of_cycle) or the end of a previous cycle, the second part (txtime > last_tx_cycle) is always true unless txtime == last_tx_cycle.
What actually needs to be checked here is if the last_tx_cycle was already written within the current cycle, so an empty frame should only be inserted if and only if
txtime >= end_of_cycle && end_of_cycle > last_tx_cycle.
This patch does not only avoid an unnecessary insertion, but it can actually be harmful to insert an empty packet if packets are already scheduled in the current cycle, because it can lead to a situation where the empty packet is actually processed as the first packet in the upcoming cycle shifting the packet with the first_flag even one cycle into the future, finally leading to a TX hang.
The TX hang can be reproduced on a i225 with:
sudo tc qdisc replace dev enp1s0 parent root handle 100 taprio \
num_tc 1 \
map 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \
queues 1@0 \
base-time 0 \
sched-entry S 01 300000 \
flags 0x1 \
txtime-delay 500000 \
clockid CLOCK_TAI
sudo tc qdisc replace dev enp1s0 parent 100:1 etf \
clockid CLOCK_TAI \
delta 500000 \
offload \
skip_sock_checkand traffic generator
sudo trafgen -i traffic.cfg -o enp1s0 --cpp -n0 -q -t1400ns
with traffic.cfg
#define ETH_P_IP 0x0800
{
/* Ethernet Header */
0x30, 0x1f, 0x9a, 0xd0, 0xf0, 0x0e, # MAC Dest - adapt as needed
0x24, 0x5e, 0xbe, 0x57, 0x2e, 0x36, # MAC Src - adapt as needed
const16(ETH_P_IP),
/* IPv4 Header */
0b01000101, 0, # IPv4 version, IHL, TOS
const16(1028), # IPv4 total length (UDP length + 20 bytes (IP header))
const16(2), # IPv4 ident
0b01000000, 0, # IPv4 flags, fragmentation off
64, # IPv4 TTL
17, # Protocol UDP
csumip(14, 33), # IPv4 checksum
/* UDP Header */
10, 0, 48, 1, # IP Src - adapt as needed
10, 0, 48, 10, # IP Dest - adapt as needed
const16(5555), # UDP Src Port
const16(6666), # UDP Dest Port
const16(1008), # UDP length (UDP header 8 bytes + payload length)
csumudp(14, 34), # UDP checksum
/* Payload */
fill('W', 1000),
}and the observed message with that is for example
igc 0000:01:00.0 enp1s0: Detected Tx Unit Hang
Tx Queue <0> TDH <32> TDT <3c> next_to_use <3c> next_to_clean <32> buffer_info[next_to_clean] time_stamp <ffff26a8> next_to_watch <00000000632a1828> jiffies <ffff27f8> desc.status <1048000>
--- drivers/net/ethernet/intel/igc/igc_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/igc/igc_main.c +1 -1
@@ -1029,7 +1029,7 @@ static __le32 igc_tx_launchtime(struct igc_ring *ring, ktime_t txtime, *first_flag = true; ring->last_ff_cycle = baset_est; -if (ktime_compare (txtime, ring->last_tx_cycle) >0 ) +if (ktime_compare (end_of_cycle, ring->last_tx_cycle) >0 ) *insert_empty = true; } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 78/292 nvme: fix the NVME_ID_NS_NVM_STS_MASK definition
In reply to Greg Kroah-HartmanFrom: Ankit Kumar <[email protected]>
[ Upstream commit b938e6603660652dc3db66d3c915fbfed3bce21d ]
As per NVMe command set specification 1.0c Storage tag size is 7 bits.
--- include/linux/nvme.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/nvme.h +1 -1
@@ -473,7 +473,7 @@ struct nvme_id_ns_nvm { };enum { -NVME_ID_NS_NVM_STS_MASK =0x3f , +NVME_ID_NS_NVM_STS_MASK =0x7f ,NVME_ID_NS_NVM_GUARD_SHIFT =7 ,NVME_ID_NS_NVM_GUARD_MASK =0x3 , };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 79/292 openrisc: Union fpcsr and oldmask in sigcontext to unbreak userspace ABI
In reply to Greg Kroah-HartmanFrom: Stafford Horne <[email protected]>
[ Upstream commit dceaafd668812115037fc13a1893d068b7b880f5 ]
With commit 27267655c531 ("openrisc: Support floating point user api") I added an entry to the struct sigcontext which caused an unwanted change to the userspace ABI.
To fix this we use the previously unused oldmask field space for the floating point fpcsr state. We do this with a union to restore the ABI back to the pre kernel v6.4 ABI and keep API compatibility.
This does mean if there is some code somewhere that is setting oldmask in an OpenRISC specific userspace sighandler it would end up setting the floating point register status, but I think it's unlikely as oldmask was never functional before.
--- arch/openrisc/include/uapi/asm/sigcontext.h | 6 ++++-- arch/openrisc/kernel/signal.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-)
arch/openrisc/include/uapi/asm/sigcontext.h +4 -2
@@ -28,8 +28,10 @@struct sigcontext {struct user_regs_struct regs;/* needs to be first */ -struct __or1k_fpu_state fpu; -unsigned long oldmask; +union { +unsigned long fpcsr; +unsigned long oldmask;/* unused */ + }; };#endif /* __ASM_OPENRISC_SIGCONTEXT_H */
arch/openrisc/kernel/signal.c +2 -2
@@ -50,7 +50,7 @@ static int restore_sigcontext(struct pt_regs *regs, err |=__copy_from_user (regs, sc->regs.gpr,32 *sizeof (unsigned long )); err |=__copy_from_user (®s->pc, &sc->regs.pc,sizeof (unsigned long )); err |=__copy_from_user (®s->sr, &sc->regs.sr,sizeof (unsigned long )); - err |=__copy_from_user (®s->fpcsr, &sc->fpu.fpcsr,sizeof (unsigned long )); + err |=__copy_from_user (®s->fpcsr, &sc->fpcsr,sizeof (unsigned long ));/* make sure the SM-bit is cleared so user-mode cannot fool us */ regs->sr &= ~SPR_SR_SM ;
@@ -113,7 +113,7 @@ static int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) err |=__copy_to_user (sc->regs.gpr, regs,32 *sizeof (unsigned long )); err |=__copy_to_user (&sc->regs.pc, ®s->pc,sizeof (unsigned long )); err |=__copy_to_user (&sc->regs.sr, ®s->sr,sizeof (unsigned long )); - err |=__copy_to_user (&sc->fpu.fpcsr, ®s->fpcsr,sizeof (unsigned long )); + err |=__copy_to_user (&sc->fpcsr, ®s->fpcsr,sizeof (unsigned long ));return err; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 80/292 riscv, bpf: Fix inconsistent JIT image generation
In reply to Greg Kroah-HartmanFrom: Björn Töpel <[email protected]>
[ Upstream commit c56fb2aab23505bb7160d06097c8de100b82b851 ]
In order to generate the prologue and epilogue, the BPF JIT needs to know which registers that are clobbered. Therefore, the during pre-final passes, the prologue is generated after the body of the program body-prologue-epilogue. Then, in the final pass, a proper prologue-body-epilogue JITted image is generated.
This scheme has worked most of the time. However, for some large programs with many jumps, e.g. the test_kmod.sh BPF selftest with hardening enabled (blinding constants), this has shown to be incorrect. For the final pass, when the proper prologue-body-epilogue is generated, the image has not converged. This will lead to that the final image will have incorrect jump offsets. The following is an excerpt from an incorrect image:
| ... | 3b8: 00c50663 beq a0,a2,3c4 <.text+0x3c4> | 3bc: 0020e317 auipc t1,0x20e | 3c0: 49630067 jalr zero,1174(t1) # 20e852 <.text+0x20e852> | ... | 20e84c: 8796 c.mv a5,t0 | 20e84e: 6422 c.ldsp s0,8(sp) # Epilogue start | 20e850: 6141 c.addi16sp sp,16 | 20e852: 853e c.mv a0,a5 # Incorrect jump target | 20e854: 8082 c.jr ra
The image has shrunk, and the epilogue offset is incorrect in the final pass.
Correct the problem by always generating proper prologue-body-epilogue outputs, which means that the first pass will only generate the body to track what registers that are touched.
--- arch/riscv/net/bpf_jit.h | 6 +++--- arch/riscv/net/bpf_jit_core.c | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 9 deletions(-)
arch/riscv/net/bpf_jit.h +3 -3
@@ -69,7 +69,7 @@ struct rv_jit_context {struct bpf_prog *prog;u16 *insns;/* RV insns */ int ninsns; -int body_len; +int prologue_len;int epilogue_offset;int *offset;/* BPF to RV */ int nexentries;
@@ -216,8 +216,8 @@ static inline int rv_offset(int insn, int off, struct rv_jit_context *ctx)int from, to; off++;/* BPF branch is from PC+1, RV is from PC */ - from = (insn >0 ) ? ctx->offset[insn -1 ] :0 ; - to = (insn + off >0 ) ? ctx->offset[insn + off -1 ] :0 ; + from = (insn >0 ) ? ctx->offset[insn -1 ] : ctx->prologue_len; + to = (insn + off >0 ) ? ctx->offset[insn + off -1 ] : ctx->prologue_len;return ninsns_rvoff (to - from); }
arch/riscv/net/bpf_jit_core.c +13 -6
@@ -44,7 +44,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)unsigned int prog_size =0 , extable_size =0 ;bool tmp_blinded = false, extra_pass = false;struct bpf_prog *tmp, *orig_prog = prog; -int pass =0 , prev_ninsns =0 , prologue_len, i; +int pass =0 , prev_ninsns =0 , i;struct rv_jit_data *jit_data;struct rv_jit_context *ctx;
@@ -83,6 +83,12 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) prog = orig_prog; goto out_offset; } + +if (build_body (ctx, extra_pass,NULL )) { + prog = orig_prog; + goto out_offset; + } +for (i =0 ; i < prog->len; i++) { prev_ninsns +=32 ; ctx->offset[i] = prev_ninsns;
@@ -91,12 +97,15 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)for (i =0 ; i <NR_JIT_ITERATIONS ; i++) { pass++; ctx->ninsns =0 ; + +bpf_jit_build_prologue (ctx); + ctx->prologue_len = ctx->ninsns; +if (build_body (ctx, extra_pass, ctx->offset)) { prog = orig_prog; goto out_offset; } - ctx->body_len = ctx->ninsns; -bpf_jit_build_prologue (ctx); + ctx->epilogue_offset = ctx->ninsns;bpf_jit_build_epilogue (ctx);
@@ -162,10 +171,8 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)if (!prog->is_func || extra_pass) {bpf_jit_binary_lock_ro (jit_data->header); - prologue_len = ctx->epilogue_offset - ctx->body_len;for (i =0 ; i < prog->len; i++) - ctx->offset[i] =ninsns_rvoff (prologue_len + - ctx->offset[i]); + ctx->offset[i] =ninsns_rvoff (ctx->offset[i]);bpf_prog_fill_jited_linfo (prog, ctx->offset); out_offset:kfree (ctx->offset);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 81/292 net: fec: remove useless fec_enet_reset_skb()
In reply to Greg Kroah-HartmanFrom: Wei Fang <[email protected]>
[ Upstream commit 2ae9c66b04554bf5b3eeaab8c12a0bfb9f28ebde ]
This patch is a cleanup for fec driver. The fec_enet_reset_skb() is used to free skb buffers for tx queues and is only invoked in fec_restart(). However, fec_enet_bd_init() also resets skb buffers and is invoked in fec_restart() too. So fec_enet_reset_skb() is redundant and useless.
Stable-dep-of: 20f797399035 ("net: fec: recycle pages for transmitted XDP frames")
--- drivers/net/ethernet/freescale/fec_main.c | 21 --------------------- 1 file changed, 21 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +0 -21
@@ -1011,24 +1011,6 @@ static void fec_enet_enable_ring(struct net_device *ndev) } } -static void fec_enet_reset_skb (struct net_device *ndev) -{ -struct fec_enet_private *fep =netdev_priv (ndev); -struct fec_enet_priv_tx_q *txq; -int i, j; - -for (i =0 ; i < fep->num_tx_queues; i++) { - txq = fep->tx_queue[i]; - -for (j =0 ; j < txq->bd.ring_size; j++) { -if (txq->tx_skbuff[j]) { -dev_kfree_skb_any (txq->tx_skbuff[j]); - txq->tx_skbuff[j] =NULL ; - } - } - } -} -/* * This function is called to start or restart the FEC during a link * change, transmit timeout, or to reconfigure the FEC. The network
@@ -1071,9 +1053,6 @@ fec_restart(struct net_device *ndev)fec_enet_enable_ring (ndev); -/* Reset tx SKB buffers. */ -fec_enet_reset_skb (ndev); -/* Enable MII mode */ if (fep->full_duplex ==DUPLEX_FULL ) {/* FD enable */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 82/292 net: fec: remove last_bdp from fec_enet_txq_xmit_frame()
In reply to Greg Kroah-HartmanFrom: Wei Fang <[email protected]>
[ Upstream commit bc638eabfed90fdc798fd5765e67e41abea76152 ]
The last_bdp is initialized to bdp, and both last_bdp and bdp are not changed. That is to say that last_bdp and bdp are always equal. So bdp can be used directly.
Stable-dep-of: 20f797399035 ("net: fec: recycle pages for transmitted XDP frames")
--- drivers/net/ethernet/freescale/fec_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +2 -4
@@ -3770,7 +3770,7 @@ static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep, struct xdp_frame *frame) {unsigned int index, status, estatus; -struct bufdesc *bdp, *last_bdp; +struct bufdesc *bdp;dma_addr_t dma_addr;int entries_free;
@@ -3782,7 +3782,6 @@ static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep,/* Fill in a Tx ring entry */ bdp = txq->bd.cur; - last_bdp = bdp; status =fec16_to_cpu (bdp->cbd_sc); status &= ~BD_ENET_TX_STATS ;
@@ -3810,7 +3809,6 @@ static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep, ebdp->cbd_esc =cpu_to_fec32 (estatus); } - index =fec_enet_get_bd_index (last_bdp, &txq->bd); txq->tx_skbuff[index] =NULL ;/* Make sure the updates to rest of the descriptor are performed before
@@ -3825,7 +3823,7 @@ static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep, bdp->cbd_sc =cpu_to_fec16 (status);/* If this was the last BD in the ring, start at the beginning again. */ - bdp =fec_enet_get_nextdesc (last_bdp, &txq->bd); + bdp =fec_enet_get_nextdesc (bdp, &txq->bd);/* Make sure the update to bdp are performed before txq->bd.cur. */ dma_wmb ();
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 83/292 net: fec: recycle pages for transmitted XDP frames
In reply to Greg Kroah-HartmanFrom: Wei Fang <[email protected]>
[ Upstream commit 20f797399035a8052dbd7297fdbe094079a9482e ]
Once the XDP frames have been successfully transmitted through the ndo_xdp_xmit() interface, it's the driver responsibility to free the frames so that the page_pool can recycle the pages and reuse them. However, this action is not implemented in the fec driver. This leads to a user-visible problem that the console will print the following warning log.
[ 157.568851] page_pool_release_retry() stalled pool shutdown 1389 inflight 60 sec [ 217.983446] page_pool_release_retry() stalled pool shutdown 1389 inflight 120 sec [ 278.399006] page_pool_release_retry() stalled pool shutdown 1389 inflight 181 sec [ 338.812885] page_pool_release_retry() stalled pool shutdown 1389 inflight 241 sec [ 399.226946] page_pool_release_retry() stalled pool shutdown 1389 inflight 302 sec
Therefore, to solve this issue, we free XDP frames via xdp_return_frame() while cleaning the tx BD ring.
--- drivers/net/ethernet/freescale/fec.h | 15 ++- drivers/net/ethernet/freescale/fec_main.c | 148 +++++++++++++++------- 2 files changed, 115 insertions(+), 48 deletions(-)
drivers/net/ethernet/freescale/fec.h +14 -1
@@ -544,10 +544,23 @@ enum { XDP_STATS_TOTAL, }; +enum fec_txbuf_type { +FEC_TXBUF_T_SKB , +FEC_TXBUF_T_XDP_NDO , +}; + +struct fec_tx_buffer { +union { +struct sk_buff *skb; +struct xdp_frame *xdp; + }; +enum fec_txbuf_type type; +}; +struct fec_enet_priv_tx_q {struct bufdesc_prop bd;unsigned char *tx_bounce[TX_RING_SIZE ]; -struct sk_buff *tx_skbuff[TX_RING_SIZE ]; +struct fec_tx_buffer tx_buf[TX_RING_SIZE ];unsigned short tx_stop_threshold;unsigned short tx_wake_threshold;
drivers/net/ethernet/freescale/fec_main.c +101 -47
216 lines not on this page · raw message
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 84/292 net: fec: increase the size of tx ring and update tx_wake_threshold
In reply to Greg Kroah-HartmanFrom: Wei Fang <[email protected]>
[ Upstream commit 56b3c6ba53d0e9649ea5e4089b39cadde13aaef8 ]
When the XDP feature is enabled and with heavy XDP frames to be transmitted, there is a considerable probability that available tx BDs are insufficient. This will lead to some XDP frames to be discarded and the "NOT enough BD for SG!" error log will appear in the console (as shown below).
[ 160.013112] fec 30be0000.ethernet eth0: NOT enough BD for SG! [ 160.023116] fec 30be0000.ethernet eth0: NOT enough BD for SG! [ 160.028926] fec 30be0000.ethernet eth0: NOT enough BD for SG! [ 160.038946] fec 30be0000.ethernet eth0: NOT enough BD for SG! [ 160.044758] fec 30be0000.ethernet eth0: NOT enough BD for SG!
In the case of heavy XDP traffic, sometimes the speed of recycling tx BDs may be slower than the speed of sending XDP frames. There may be several specific reasons, such as the interrupt is not responsed in time, the efficiency of the NAPI callback function is too low due to all the queues (tx queues and rx queues) share the same NAPI, and so on.
After trying various methods, I think that increase the size of tx BD ring is simple and effective. Maybe the best resolution is that allocate NAPI for each queue to improve the efficiency of the NAPI callback, but this change is a bit big and I didn't try this method. Perheps this method will be implemented in a future patch.
This patch also updates the tx_wake_threshold of tx ring which is related to the size of tx ring in the previous logic. Otherwise, the tx_wake_threshold will be too high (403 BDs), which is more likely to impact the slow path in the case of heavy XDP traffic, because XDP path and slow path share the tx BD rings. According to Jakub's suggestion, the tx_wake_threshold is at least equal to tx_stop_threshold + 2 * MAX_SKB_FRAGS, if a queue of hundreds of entries is overflowing, we should be able to apply a hysteresis of a few tens of entries.
--- drivers/net/ethernet/freescale/fec.h | 2 +- drivers/net/ethernet/freescale/fec_main.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/freescale/fec.h +1 -1
@@ -355,7 +355,7 @@ struct bufdesc_ex {#define RX_RING_SIZE (FEC_ENET_RX_FRPPG * FEC_ENET_RX_PAGES)#define FEC_ENET_TX_FRSIZE 2048#define FEC_ENET_TX_FRPPG (PAGE_SIZE / FEC_ENET_TX_FRSIZE) -#define TX_RING_SIZE 512/* Must be power of two */ +#define TX_RING_SIZE 1024/* Must be power of two */ #define TX_RING_MOD_MASK 511/* for this to work */ #define BD_ENET_RX_INT 0x00800000
drivers/net/ethernet/freescale/fec_main.c +1 -2
@@ -3347,8 +3347,7 @@ static int fec_enet_alloc_queue(struct net_device *ndev) fep->total_tx_ring_size += fep->tx_queue[i]->bd.ring_size; txq->tx_stop_threshold =FEC_MAX_SKB_DESCS ; - txq->tx_wake_threshold = - (txq->bd.ring_size - txq->tx_stop_threshold) /2 ; + txq->tx_wake_threshold =FEC_MAX_SKB_DESCS +2 *MAX_SKB_FRAGS ; txq->tso_hdrs = dma_alloc_coherent(&fep->pdev->dev, txq->bd.ring_size * TSO_HEADER_SIZE,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 85/292 drm/i915: Dont preserve dpll_hw_state for slave crtc in Bigjoiner
In reply to Greg Kroah-HartmanFrom: Stanislav Lisovskiy <[email protected]>
[ Upstream commit 5c413188c68da0e4bffc93de1c80257e20741e69 ]
If we are using Bigjoiner dpll_hw_state is supposed to be exactly same as for master crtc, so no need to save it's state for slave crtc.
--- drivers/gpu/drm/i915/display/intel_display.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/i915/display/intel_display.c +0 -1
@@ -4968,7 +4968,6 @@ copy_bigjoiner_crtc_state_modeset(struct intel_atomic_state *state, saved_state->uapi = slave_crtc_state->uapi; saved_state->scaler_state = slave_crtc_state->scaler_state; saved_state->shared_dpll = slave_crtc_state->shared_dpll; - saved_state->dpll_hw_state = slave_crtc_state->dpll_hw_state; saved_state->crc_enabled = slave_crtc_state->crc_enabled;intel_crtc_free_hw_state (slave_crtc_state);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 86/292 drm/i915: Fix one wrong caching mode enum usage
In reply to Greg Kroah-HartmanFrom: Tvrtko Ursulin <[email protected]>
[ Upstream commit 113899c2669dff148b2a5bea4780123811aecc13 ]
Commit a4d86249c773 ("drm/i915/gt: Provide a utility to create a scratch buffer") mistakenly passed in uapi I915_CACHING_CACHED as argument to i915_gem_object_set_cache_coherency(), which actually takes internal enum i915_cache_level.
No functional issue since the value matches I915_CACHE_LLC (1 == 1), which is the intended caching mode, but lets clean it up nevertheless.
--- drivers/gpu/drm/i915/gt/intel_gtt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/intel_gtt.c +1 -1
@@ -625,7 +625,7 @@ __vm_create_scratch_for_read(struct i915_address_space *vm, unsigned long size)if (IS_ERR (obj))return ERR_CAST (obj); -i915_gem_object_set_cache_coherency (obj,I915_CACHING_CACHED ); +i915_gem_object_set_cache_coherency (obj,I915_CACHE_LLC ); vma =i915_vma_instance (obj, vm,NULL );if (IS_ERR (vma)) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 87/292 net: dsa: Removed unneeded of_node_put in felix_parse_ports_node
In reply to Greg Kroah-HartmanFrom: Lu Hongfei <[email protected]>
[ Upstream commit 04499f28b40bfc24f20b0e2331008bb90a54a6cf ]
Remove unnecessary of_node_put from the continue path to prevent child node from being released twice, which could avoid resource leak or other unexpected issues.
--- drivers/net/dsa/ocelot/felix.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/dsa/ocelot/felix.c +0 -1
@@ -1286,7 +1286,6 @@ static int felix_parse_ports_node(struct felix *felix,if (err <0 ) {dev_info (dev,"Unsupported PHY mode %s on port %d\n" ,phy_modes (phy_mode), port); -of_node_put (child);/* Leave port_phy_modes[port] = 0, which is also * PHY_INTERFACE_MODE_NA. This will perform a
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 88/292 octeontx2-pf: Add additional check for MCAM rules
In reply to Greg Kroah-HartmanFrom: Suman Ghosh <[email protected]>
[ Upstream commit 8278ee2a2646b9acf747317895e47a640ba933c9 ]
Due to hardware limitation, MCAM drop rule withether_type == 802.1Q and vlan_id == 0 is not supported. Hence rejecting such rules.
--- .../ethernet/marvell/octeontx2/nic/otx2_flows.c | 8 ++++++++ .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 15 +++++++++++++++ 2 files changed, 23 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c +8 -0
@@ -872,6 +872,14 @@ static int otx2_prepare_flow_request(struct ethtool_rx_flow_spec *fsp,return -EINVAL ; vlan_etype =be16_to_cpu (fsp->h_ext.vlan_etype); + +/* Drop rule with vlan_etype == 802.1Q +* and vlan_id == 0 is not supported +*/ +if (vlan_etype ==ETH_P_8021Q && !fsp->m_ext.vlan_tci && + fsp->ring_cookie ==RX_CLS_FLOW_DISC ) +return -EINVAL ; +/* Only ETH_P_8021Q and ETH_P_802AD types supported */ if (vlan_etype !=ETH_P_8021Q && vlan_etype !=ETH_P_8021AD )
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +15 -0
@@ -604,6 +604,21 @@ static int otx2_tc_prepare_flow(struct otx2_nic *nic, struct otx2_tc_flow *node,return -EOPNOTSUPP ; } +if (!match.mask->vlan_id) { +struct flow_action_entry *act; +int i; + +flow_action_for_each (i, act, &rule->action) { +if (act->id ==FLOW_ACTION_DROP ) { +netdev_err (nic->netdev, +"vlan tpid 0x%x with vlan_id %d is not supported for DROP rule.\n" , +ntohs (match.key->vlan_tpid), + match.key->vlan_id); +return -EOPNOTSUPP ; + } + } + } +if (match.mask->vlan_id || match.mask->vlan_dei || match.mask->vlan_priority) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 89/292 erofs: avoid useless loops in z_erofs_pcluster_readmore() when reading beyond EOF
In reply to Greg Kroah-HartmanFrom: Chunhai Guo <[email protected]>
[ Upstream commit 936aa701d82d397c2d1afcd18ce2c739471d978d ]
z_erofs_pcluster_readmore() may take a long time to loop when the page offset is large enough, which is unnecessary should be prevented.
For example, when the following case is encountered, it will loop 4691368 times, taking about 27 seconds:
- offset = 19217289215
- inode_size = 1442672
--- fs/erofs/zdata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/erofs/zdata.c +1 -1
@@ -1807,7 +1807,7 @@ static void z_erofs_pcluster_readmore(struct z_erofs_decompress_frontend *f, } cur = map->m_la + map->m_llen -1 ; -while (cur >= end) { +while ((cur >= end) && (cur <i_size_read (inode))) {pgoff_t index = cur >>PAGE_SHIFT ;struct page *page;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 90/292 erofs: avoid infinite loop in z_erofs_do_read_page() when reading beyond EOF
In reply to Greg Kroah-HartmanFrom: Chunhai Guo <[email protected]>
[ Upstream commit 8191213a5835b0317c5e4d0d337ae1ae00c75253 ]
z_erofs_do_read_page() may loop infinitely due to the inappropriate truncation in the below statement. Since the offset is 64 bits and min_t() truncates the result to 32 bits. The solution is to replace unsigned int with a 64-bit type, such as erofs_off_t.
cur = end - min_t(unsigned int, offset + end - map->m_la, end);
- For example:
- offset = 0x400160000
- end = 0x370
- map->m_la = 0x160370
- offset + end - map->m_la = 0x400000000
- offset + end - map->m_la = 0x00000000 (truncated as unsigned int)
- Expected result:
- cur = 0
- Actual result:
- cur = 0x370
--- fs/erofs/zdata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/erofs/zdata.c +1 -1
@@ -990,7 +990,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,*/ tight &= (fe->mode >Z_EROFS_PCLUSTER_FOLLOWED_NOINPLACE ); - cur = end - min_t(unsigned int, offset + end - map->m_la, end); + cur = end -min_t (erofs_off_t, offset + end - map->m_la, end);if (!(map->m_flags &EROFS_MAP_MAPPED )) {zero_user_segment (page, cur, end); goto next_part;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 91/292 erofs: fix fsdax unavailability for chunk-based regular files
In reply to Greg Kroah-HartmanFrom: Xin Yin <[email protected]>
[ Upstream commit 18bddc5b67038722cb88fcf51fbf41a0277092cb ]
DAX can be used to share page cache between VMs, reducing guest memory overhead. And chunk based data format is widely used for VM and container image. So enable dax support for it, make erofs better used for VM scenarios.
--- fs/erofs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/erofs/inode.c +2 -1
@@ -183,7 +183,8 @@ static void *erofs_read_inode(struct erofs_buf *buf, inode->i_flags &= ~S_DAX ;if (test_opt (&sbi->opt,DAX_ALWAYS ) &&S_ISREG (inode->i_mode) && - vi->datalayout ==EROFS_INODE_FLAT_PLAIN ) + (vi->datalayout ==EROFS_INODE_FLAT_PLAIN || + vi->datalayout ==EROFS_INODE_CHUNK_BASED )) inode->i_flags |=S_DAX ;if (!nblks)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 92/292 wifi: airo: avoid uninitialized warning in airo_get_rate()
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 9373771aaed17f5c2c38485f785568abe3a9f8c1 ]
Quieten a gcc (11.3.0) build error or warning by checking the function call status and returning -EBUSY if the function call failed. This is similar to what several other wireless drivers do for the SIOCGIWRATE ioctl call when there is a locking problem.
drivers/net/wireless/cisco/airo.c: error: 'status_rid.currentXmitRate' is used uninitialized [-Werror=uninitialized]
--- drivers/net/wireless/cisco/airo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/cisco/airo.c +4 -1
@@ -6157,8 +6157,11 @@ static int airo_get_rate(struct net_device *dev,struct iw_param *vwrq = &wrqu->bitrate;struct airo_info *local = dev->ml_priv;StatusRid status_rid;/* Card status info */ +int ret; -readStatusRid (local, &status_rid,1 ); + ret =readStatusRid (local, &status_rid,1 ); +if (ret) +return -EBUSY ; vwrq->value =le16_to_cpu (status_rid.currentXmitRate) *500000 ;/* If more than one rate, set auto */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 93/292 bpf: cpumap: Fix memory leak in cpu_map_update_elem
In reply to Greg Kroah-HartmanFrom: Pu Lehui <[email protected]>
[ Upstream commit 4369016497319a9635702da010d02af1ebb1849d ]
Syzkaller reported a memory leak as follows:
BUG: memory leak
unreferenced object 0xff110001198ef748 (size 192):
comm "syz-executor.3", pid 17672, jiffies 4298118891 (age 9.906s)
hex dump (first 32 bytes):
00 00 00 00 4a 19 00 00 80 ad e3 e4 fe ff c0 00 ....J...........
00 b2 d3 0c 01 00 11 ff 28 f5 8e 19 01 00 11 ff ........(.......
backtrace:
[<ffffffffadd28087>] __cpu_map_entry_alloc+0xf7/0xb00
[<ffffffffadd28d8e>] cpu_map_update_elem+0x2fe/0x3d0
[<ffffffffadc6d0fd>] bpf_map_update_value.isra.0+0x2bd/0x520
[<ffffffffadc7349b>] map_update_elem+0x4cb/0x720
[<ffffffffadc7d983>] __se_sys_bpf+0x8c3/0xb90
[<ffffffffb029cc80>] do_syscall_64+0x30/0x40
[<ffffffffb0400099>] entry_SYSCALL_64_after_hwframe+0x61/0xc6
BUG: memory leak
unreferenced object 0xff110001198ef528 (size 192):
comm "syz-executor.3", pid 17672, jiffies 4298118891 (age 9.906s)
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:
[<ffffffffadd281f0>] __cpu_map_entry_alloc+0x260/0xb00
[<ffffffffadd28d8e>] cpu_map_update_elem+0x2fe/0x3d0
[<ffffffffadc6d0fd>] bpf_map_update_value.isra.0+0x2bd/0x520
[<ffffffffadc7349b>] map_update_elem+0x4cb/0x720
[<ffffffffadc7d983>] __se_sys_bpf+0x8c3/0xb90
[<ffffffffb029cc80>] do_syscall_64+0x30/0x40
[<ffffffffb0400099>] entry_SYSCALL_64_after_hwframe+0x61/0xc6
BUG: memory leak
unreferenced object 0xff1100010fd93d68 (size 8):
comm "syz-executor.3", pid 17672, jiffies 4298118891 (age 9.906s)
hex dump (first 8 bytes):
00 00 00 00 00 00 00 00 ........
backtrace:
[<ffffffffade5db3e>] kvmalloc_node+0x11e/0x170
[<ffffffffadd28280>] __cpu_map_entry_alloc+0x2f0/0xb00
[<ffffffffadd28d8e>] cpu_map_update_elem+0x2fe/0x3d0
[<ffffffffadc6d0fd>] bpf_map_update_value.isra.0+0x2bd/0x520
[<ffffffffadc7349b>] map_update_elem+0x4cb/0x720
[<ffffffffadc7d983>] __se_sys_bpf+0x8c3/0xb90
[<ffffffffb029cc80>] do_syscall_64+0x30/0x40
[<ffffffffb0400099>] entry_SYSCALL_64_after_hwframe+0x61/0xc6In the cpu_map_update_elem flow, when kthread_stop is called before calling the threadfn of rcpu->kthread, since the KTHREAD_SHOULD_STOP bit of kthread has been set by kthread_stop, the threadfn of rcpu->kthread will never be executed, and rcpu->refcnt will never be 0, which will lead to the allocated rcpu, rcpu->queue and rcpu->queue->queue cannot be released.
Calling kthread_stop before executing kthread's threadfn will return -EINTR. We can complete the release of memory resources in this state.
--- kernel/bpf/cpumap.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-)
kernel/bpf/cpumap.c +24 -16
@@ -126,22 +126,6 @@ static void get_cpu_map_entry(struct bpf_cpu_map_entry *rcpu)atomic_inc (&rcpu->refcnt); } -/* called from workqueue, to workaround syscall using preempt_disable */ -static void cpu_map_kthread_stop (struct work_struct *work) -{ -struct bpf_cpu_map_entry *rcpu; - - rcpu = container_of(work, struct bpf_cpu_map_entry, kthread_stop_wq); - -/* Wait for flush in __cpu_map_entry_free(), via full RCU barrier, -* as it waits until all in-flight call_rcu() callbacks complete. -*/ -rcu_barrier (); - -/* kthread_stop will wake_up_process and wait for it to complete */ -kthread_stop (rcpu->kthread); -} -static void __cpu_map_ring_cleanup (struct ptr_ring *ring) {/* The tear-down procedure should have made sure that queue is
@@ -169,6 +153,30 @@ static void put_cpu_map_entry(struct bpf_cpu_map_entry *rcpu) } } +/* called from workqueue, to workaround syscall using preempt_disable */ +static void cpu_map_kthread_stop (struct work_struct *work) +{ +struct bpf_cpu_map_entry *rcpu; +int err; + + rcpu = container_of(work, struct bpf_cpu_map_entry, kthread_stop_wq); + +/* Wait for flush in __cpu_map_entry_free(), via full RCU barrier, +* as it waits until all in-flight call_rcu() callbacks complete. +*/ +rcu_barrier (); + +/* kthread_stop will wake_up_process and wait for it to complete */ + err =kthread_stop (rcpu->kthread); +if (err) { +/* kthread_stop may be called before cpu_map_kthread_run +* is executed, so we need to release the memory related +* to rcpu. +*/ +put_cpu_map_entry (rcpu); + } +} +static void cpu_map_bpf_prog_run_skb (struct bpf_cpu_map_entry *rcpu,struct list_head *listp,struct xdp_cpumap_stats *stats)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 94/292 xdp: use trusted arguments in XDP hints kfuncs
In reply to Greg Kroah-HartmanFrom: Larysa Zaremba <[email protected]>
[ Upstream commit 2e06c57d66d3f6c26faa5f5b479fb3add34ce85a ]
Currently, verifier does not reject XDP programs that pass NULL pointer to hints functions. At the same time, this case is not handled in any driver implementation (including veth). For example, changing
bpf_xdp_metadata_rx_timestamp(ctx, ×tamp);
to
bpf_xdp_metadata_rx_timestamp(ctx, NULL);
in xdp_metadata test successfully crashes the system.
Add KF_TRUSTED_ARGS flag to hints kfunc definitions, so driver code does not have to worry about getting invalid pointers.
--- net/core/xdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/xdp.c +1 -1
@@ -741,7 +741,7 @@ __bpf_kfunc int bpf_xdp_metadata_rx_hash(const struct xdp_md *ctx, u32 *hash,__diag_pop (); BTF_SET8_START(xdp_metadata_kfunc_ids) -#define XDP_METADATA_KFUNC(_, name) BTF_ID_FLAGS(func, name, 0) +#define XDP_METADATA_KFUNC(_, name) BTF_ID_FLAGS(func, name, KF_TRUSTED_ARGS) XDP_METADATA_KFUNC_xxx #undef XDP_METADATA_KFUNC BTF_SET8_END(xdp_metadata_kfunc_ids)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 95/292 net/sched: flower: Ensure both minimum and maximum ports are specified
In reply to Greg Kroah-HartmanFrom: Ido Schimmel <[email protected]>
[ Upstream commit d3f87278bcb80bd7f9519669d928b43320363d4f ]
The kernel does not currently validate that both the minimum and maximum ports of a port range are specified. This can lead user space to think that a filter matching on a port range was successfully added, when in fact it was not. For example, with a patched (buggy) iproute2 that only sends the minimum port, the following commands do not return an error:
# tc filter add dev swp1 ingress pref 1 proto ip flower ip_proto udp src_port 100-200 action pass
# tc filter add dev swp1 ingress pref 1 proto ip flower ip_proto udp dst_port 100-200 action pass
# tc filter show dev swp1 ingress
filter protocol ip pref 1 flower chain 0
filter protocol ip pref 1 flower chain 0 handle 0x1
eth_type ipv4
ip_proto udp
not_in_hw
action order 1: gact action pass
random type none pass val 0
index 1 ref 1 bind 1 filter protocol ip pref 1 flower chain 0 handle 0x2
eth_type ipv4
ip_proto udp
not_in_hw
action order 1: gact action pass
random type none pass val 0
index 2 ref 1 bind 1
Fix by returning an error unless both ports are specified:
# tc filter add dev swp1 ingress pref 1 proto ip flower ip_proto udp src_port 100-200 action pass Error: Both min and max source ports must be specified. We have an error talking to the kernel
# tc filter add dev swp1 ingress pref 1 proto ip flower ip_proto udp dst_port 100-200 action pass Error: Both min and max destination ports must be specified. We have an error talking to the kernel
--- net/sched/cls_flower.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/sched/cls_flower.c +10 -0
@@ -799,6 +799,16 @@ static int fl_set_key_port_range(struct nlattr **tb, struct fl_flow_key *key,TCA_FLOWER_KEY_PORT_SRC_MAX , &mask->tp_range.tp_max.src, TCA_FLOWER_UNSPEC, sizeof(key->tp_range.tp_max.src)); +if (mask->tp_range.tp_min.dst != mask->tp_range.tp_max.dst) { +NL_SET_ERR_MSG (extack, +"Both min and max destination ports must be specified" ); +return -EINVAL ; + } +if (mask->tp_range.tp_min.src != mask->tp_range.tp_max.src) { +NL_SET_ERR_MSG (extack, +"Both min and max source ports must be specified" ); +return -EINVAL ; + }if (mask->tp_range.tp_min.dst && mask->tp_range.tp_max.dst &&ntohs (key->tp_range.tp_max.dst) <=ntohs (key->tp_range.tp_min.dst)) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 96/292 riscv: mm: fix truncation warning on RV32
In reply to Greg Kroah-HartmanFrom: Jisheng Zhang <[email protected]>
[ Upstream commit b690e266dae2f85f4dfea21fa6a05e3500a51054 ]
lkp reports below sparse warning when building for RV32:arch/riscv/mm/init.c:1204:48: sparse: warning: cast truncates bits from constant value (100000000 becomes 0)
IMO, the reason we didn't see this truncates bug in real world is "0" means MEMBLOCK_ALLOC_ACCESSIBLE in memblock and there's no RV32 HW with more than 4GB memory.
Fix it anyway to make sparse happy.
--- arch/riscv/mm/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/mm/init.c +1 -1
@@ -1346,7 +1346,7 @@ static void __init reserve_crashkernel(void)*/ crash_base =memblock_phys_alloc_range (crash_size,PMD_SIZE , search_start, -min (search_end, (unsigned long )SZ_4G )); +min (search_end, (unsigned long )(SZ_4G -1 )));if (crash_base ==0 ) {/* Try again without restricting region to 32bit addressible memory */ crash_base = memblock_phys_alloc_range(crash_size, PMD_SIZE,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 97/292 drm/nouveau/disp: fix HDMI on gt215+
In reply to Greg Kroah-HartmanFrom: Karol Herbst <[email protected]>
[ Upstream commit d94303699921bda8141ad33554ae55b615ddd149 ]
--- drivers/gpu/drm/nouveau/nvkm/engine/disp/gt215.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/engine/disp/gt215.c +1 -1
@@ -125,7 +125,7 @@ gt215_sor_hdmi_infoframe_avi(struct nvkm_ior *ior, int head, void *data, u32 sizpack_hdmi_infoframe (&avi, data, size);nvkm_mask (device,0x61c520 + soff,0x00000001 ,0x00000000 ); -if (size) +if (!size)return ;nvkm_wr32 (device,0x61c528 + soff, avi.header);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 98/292 drm/nouveau/disp/g94: enable HDMI
In reply to Greg Kroah-HartmanFrom: Karol Herbst <[email protected]>
[ Upstream commit c177872cb056e0b499af4717d8d1977017fd53df ]
--- drivers/gpu/drm/nouveau/nvkm/engine/disp/g94.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nvkm/engine/disp/g94.c +1 -0
@@ -295,6 +295,7 @@ g94_sor = { .clock = nv50_sor_clock, .war_2 = g94_sor_war_2, .war_3 = g94_sor_war_3, + .hdmi = &g84_sor_hdmi, .dp = &g94_sor_dp, };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 99/292 netdevsim: fix uninitialized data in nsim_dev_trap_fa_cookie_write()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit f72207a5c0dbaaf6921cf9a6c0d2fd0bc249ea78 ]
The simple_write_to_buffer() function is designed to handle partial writes. It returns negatives on error, otherwise it returns the number of bytes that were able to be copied. This code doesn't check the return properly. We only know that the first byte is written, the rest of the buffer might be uninitialized.
There is no need to use the simple_write_to_buffer() function. Partial writes are prohibited by the "if (*ppos != 0)" check at the start of the function. Just use memdup_user() and copy the whole buffer.
--- drivers/net/netdevsim/dev.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/net/netdevsim/dev.c +3 -6
@@ -184,13 +184,10 @@ static ssize_t nsim_dev_trap_fa_cookie_write(struct file *file, cookie_len = (count -1 ) /2 ;if ((count -1 ) %2 )return -EINVAL ; - buf =kmalloc (count,GFP_KERNEL | __GFP_NOWARN); -if (!buf) -return -ENOMEM ; - ret =simple_write_to_buffer (buf, count, ppos, data, count); -if (ret <0 ) - goto free_buf; + buf =memdup_user (data, count); +if (IS_ERR (buf)) +return PTR_ERR (buf); fa_cookie =kmalloc (sizeof (*fa_cookie) + cookie_len,GFP_KERNEL | __GFP_NOWARN);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 100/292 drm/nouveau/acr: Abort loading ACR if no firmware was found
In reply to Greg Kroah-HartmanFrom: Karol Herbst <[email protected]>
[ Upstream commit 938a06c8b7913455073506c33ae3bff029c3c4ef ]
This fixes a NULL pointer access inside nvkm_acr_oneinit in case necessary firmware files couldn't be loaded.
--- drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c +1 -1
@@ -224,7 +224,7 @@ nvkm_acr_oneinit(struct nvkm_subdev *subdev)u64 falcons;int ret, i; -if (list_empty (&acr->hsfw)) { +if (list_empty (&acr->hsfw) || !acr->func || !acr->func->wpr_layout) {nvkm_debug (subdev,"No HSFW(s)\n" );nvkm_acr_cleanup (acr);return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 101/292 drm/nouveau: bring back blit subchannel for pre nv50 GPUs
In reply to Greg Kroah-HartmanFrom: Karol Herbst <[email protected]>
[ Upstream commit 835a65f51790e1f72b1ab106ec89db9ac15b47d6 ]
1ba6113a90a0 removed a lot of the kernel GPU channel, but method 0x128 was important as otherwise the GPU spams us with CACHE_ERROR messages.
We use the blit subchannel inside our vblank handling, so we should keep at least this part.
v2: Only do it for NV11+ GPUs
--- drivers/gpu/drm/nouveau/nouveau_chan.c | 1 + drivers/gpu/drm/nouveau/nouveau_chan.h | 1 + drivers/gpu/drm/nouveau/nouveau_drm.c | 20 +++++++++++++++++--- 3 files changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nouveau_chan.c +1 -0
@@ -90,6 +90,7 @@ nouveau_channel_del(struct nouveau_channel **pchan)if (cli)nouveau_svmm_part (chan->vmm->svmm, chan->inst); +nvif_object_dtor (&chan->blit);nvif_object_dtor (&chan->nvsw);nvif_object_dtor (&chan->gart);nvif_object_dtor (&chan->vram);
drivers/gpu/drm/nouveau/nouveau_chan.h +1 -0
@@ -53,6 +53,7 @@ struct nouveau_channel {u32 user_put;struct nvif_object user; +struct nvif_object blit;struct nvif_event kill;atomic_t killed;
drivers/gpu/drm/nouveau/nouveau_drm.c +17 -3
@@ -375,15 +375,29 @@ nouveau_accel_gr_init(struct nouveau_drm *drm) ret =nvif_object_ctor (&drm->channel->user,"drmNvsw" ,NVDRM_NVSW ,nouveau_abi16_swclass (drm),NULL ,0 , &drm->channel->nvsw); + +if (ret ==0 && device->info.chipset >=0x11 ) { + ret =nvif_object_ctor (&drm->channel->user,"drmBlit" , +0x005f ,0x009f , +NULL ,0 , &drm->channel->blit); + } +if (ret ==0 ) {struct nvif_push *push = drm->channel->chan.push; - ret =PUSH_WAIT (push,2 ); -if (ret ==0 ) + ret =PUSH_WAIT (push,8 ); +if (ret ==0 ) { +if (device->info.chipset >=0x11 ) { +PUSH_NVSQ (push,NV05F ,0x0000 , drm->channel->blit.handle); +PUSH_NVSQ (push,NV09F ,0x0120 ,0 , +0x0124 ,1 , +0x0128 ,2 ); + }PUSH_NVSQ (push,NV_SW ,0x0000 , drm->channel->nvsw.handle); + } }if (ret) { -NV_ERROR (drm,"failed to allocate sw class, %d\n" , ret); +NV_ERROR (drm,"failed to allocate sw or blit class, %d\n" , ret);nouveau_accel_gr_fini (drm);return ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 102/292 net/sched: make psched_mtu() RTNL-less safe
In reply to Greg Kroah-HartmanFrom: Pedro Tammela <[email protected]>
[ Upstream commit 150e33e62c1fa4af5aaab02776b6c3812711d478 ]
Eric Dumazet says[1]:
-------
Speaking of psched_mtu(), I see that net/sched/sch_pie.c is using it without holding RTNL, so dev->mtu can be changed underneath. KCSAN could issue a warning.
-------
Annotate dev->mtu with READ_ONCE() so KCSAN don't issue a warning.
[1] https://lore.kernel.org/all/CANn89iJoJO5VtaJ-2=_d2aOQhb0Xw8iBT_Cxqp2HyuS-zj6azw@mail.gmail.com/
v1 -> v2: Fix commit message
--- include/net/pkt_sched.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/pkt_sched.h +1 -1
@@ -134,7 +134,7 @@ extern const struct nla_policy rtm_tca_policy[TCA_MAX + 1];*/ static inline unsigned int psched_mtu (const struct net_device *dev) { -return dev->mtu + dev->hard_header_len; +return READ_ONCE (dev->mtu) + dev->hard_header_len; }static inline struct net *qdisc_net (struct Qdisc *q)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 103/292 net: txgbe: fix eeprom calculation error
In reply to Greg Kroah-HartmanFrom: Jiawen Wu <[email protected]>
[ Upstream commit aa846677a9fb19a0f2c58154c140398aa92a87ba ]
For some device types like TXGBE_ID_XAUI, *checksum computed in txgbe_calc_eeprom_checksum() is larger than TXGBE_EEPROM_SUM. Remove the limit on the size of *checksum.
--- drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c +0 -3
@@ -196,9 +196,6 @@ static int txgbe_calc_eeprom_checksum(struct wx *wx, u16 *checksum)if (eeprom_ptrs)kvfree (eeprom_ptrs); -if (*checksum >TXGBE_EEPROM_SUM ) -return -EINVAL ; - *checksum =TXGBE_EEPROM_SUM - *checksum;return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 104/292 wifi: rtw89: debug: fix error code in rtw89_debug_priv_send_h2c_set()
In reply to Greg Kroah-HartmanFrom: Zhang Shurong <[email protected]>
[ Upstream commit 4f4626cd049576af1276c7568d5b44eb3f7bb1b1 ]
If there is a failure during rtw89_fw_h2c_raw() rtw89_debug_priv_send_h2c should return negative error code instead of a positive value count. Fix this bug by returning correct error code.
--- drivers/net/wireless/realtek/rtw89/debug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw89/debug.c +3 -2
@@ -2998,17 +2998,18 @@ static ssize_t rtw89_debug_priv_send_h2c_set(struct file *filp,struct rtw89_debugfs_priv *debugfs_priv = filp->private_data;struct rtw89_dev *rtwdev = debugfs_priv->rtwdev;u8 *h2c; +int ret;u16 h2c_len = count /2 ; h2c =rtw89_hex2bin_user (rtwdev, user_buf, count);if (IS_ERR (h2c))return -EFAULT ; -rtw89_fw_h2c_raw (rtwdev, h2c, h2c_len); + ret =rtw89_fw_h2c_raw (rtwdev, h2c, h2c_len);kfree (h2c); -return count; +return ret ? ret : count; } static int
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 105/292 net/sched: sch_qfq: reintroduce lmax bound check for MTU
In reply to Greg Kroah-HartmanFrom: Pedro Tammela <[email protected]>
[ Upstream commit 158810b261d02fc7dd92ca9c392d8f8a211a2401 ]
25369891fcef deletes a check for the case where no 'lmax' is specified which 3037933448f6 previously fixed as 'lmax' could be set to the device's MTU without any bound checking for QFQ_LMAX_MIN and QFQ_LMAX_MAX. Therefore, reintroduce the check.
--- net/sched/sch_qfq.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
net/sched/sch_qfq.c +9 -2
@@ -423,10 +423,17 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,else weight =1 ; -if (tb[TCA_QFQ_LMAX ]) +if (tb[TCA_QFQ_LMAX ]) { lmax =nla_get_u32 (tb[TCA_QFQ_LMAX ]); -else + }else { +/* MTU size is user controlled */ lmax =psched_mtu (qdisc_dev (sch)); +if (lmax <QFQ_MIN_LMAX || lmax >QFQ_MAX_LMAX ) { +NL_SET_ERR_MSG_MOD (extack, +"MTU size out of bounds for qfq" ); +return -EINVAL ; + } + } inv_w =ONE_FP / weight; weight =ONE_FP / inv_w;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 106/292 net/sched: sch_qfq: account for stab overhead in qfq_enqueue
In reply to Greg Kroah-HartmanFrom: Pedro Tammela <[email protected]>
[ Upstream commit 3e337087c3b5805fe0b8a46ba622a962880b5d64 ]
Lion says:
-------
In the QFQ scheduler a similar issue to CVE-2023-31436 persists.
Consider the following code in net/sched/sch_qfq.c:
static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch,
struct sk_buff **to_free)
{
unsigned int len = qdisc_pkt_len(skb), gso_segs;
// ...
if (unlikely(cl->agg->lmax < len)) {
pr_debug("qfq: increasing maxpkt from %u to %u for class %u",
cl->agg->lmax, len, cl->common.classid);
err = qfq_change_agg(sch, cl, cl->agg->class_weight, len);
if (err) {
cl->qstats.drops++;
return qdisc_drop(skb, sch, to_free);
}
// ...
}Similarly to CVE-2023-31436, "lmax" is increased without any bounds checks according to the packet length "len". Usually this would not impose a problem because packet sizes are naturally limited.
This is however not the actual packet length, rather the "qdisc_pkt_len(skb)" which might apply size transformations according to "struct qdisc_size_table" as created by "qdisc_get_stab()" in net/sched/sch_api.c if the TCA_STAB option was set when modifying the qdisc.
A user may choose virtually any size using such a table.
As a result the same issue as in CVE-2023-31436 can occur, allowing heap out-of-bounds read / writes in the kmalloc-8192 cache.
-------
We can create the issue with the following commands:
tc qdisc add dev $DEV root handle 1: stab mtu 2048 tsize 512 mpu 0 \
overhead 999999999 linklayer ethernet qfq
tc class add dev $DEV parent 1: classid 1:1 htb rate 6mbit burst 15k tc filter add dev $DEV parent 1: matchall classid 1:1 ping -I $DEV 1.1.1.2
This is caused by incorrectly assuming that qdisc_pkt_len() returns a length within the QFQ_MIN_LMAX < len < QFQ_MAX_LMAX.
--- net/sched/sch_qfq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/sched/sch_qfq.c +6 -1
@@ -381,8 +381,13 @@ static int qfq_change_agg(struct Qdisc *sch, struct qfq_class *cl, u32 weight, u32 lmax) {struct qfq_sched *q =qdisc_priv (sch); -struct qfq_aggregate *new_agg =qfq_find_agg (q, lmax, weight); +struct qfq_aggregate *new_agg; +/* 'lmax' can range from [QFQ_MIN_LMAX, pktlen + stab overhead] */ +if (lmax >QFQ_MAX_LMAX ) +return -EINVAL ; + + new_agg =qfq_find_agg (q, lmax, weight);if (new_agg ==NULL ) {/* create new aggregate */ new_agg =kzalloc (sizeof (*new_agg),GFP_ATOMIC );if (new_agg ==NULL )
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 107/292 nvme-pci: fix DMA direction of unmapping integrity data
In reply to Greg Kroah-HartmanFrom: Ming Lei <[email protected]>
[ Upstream commit b8f6446b6853768cb99e7c201bddce69ca60c15e ]
DMA direction should be taken in dma_unmap_page() for unmapping integrity data.
Fix this DMA direction, and reported in Guangwu's test.
--- drivers/nvme/host/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/pci.c +1 -1
@@ -968,7 +968,7 @@ static __always_inline void nvme_pci_unmap_rq(struct request *req)struct nvme_iod *iod =blk_mq_rq_to_pdu (req);dma_unmap_page (dev->dev, iod->meta_dma, -rq_integrity_vec (req)->bv_len,rq_data_dir (req)); +rq_integrity_vec (req)->bv_len,rq_dma_dir (req)); }if (blk_rq_nr_phys_segments (req))
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 108/292 smb: client: improve DFS mount check
In reply to Greg Kroah-HartmanFrom: Paulo Alcantara <[email protected]>
commit 5f2a0afa9890e728428db2ed9281bddca242e90b upstream.
Some servers may return error codes from REQ_GET_DFS_REFERRAL requests that are unexpected by the client, so to make it easier, assume non-DFS mounts when the client can't get the initial DFS referral of @ctx->UNC in dfs_mount_share().
--- fs/smb/client/dfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/smb/client/dfs.c +3 -2
@@ -296,8 +296,9 @@ int dfs_mount_share(struct cifs_mount_ctif (!nodfs) { rc =dfs_get_referral (mnt_ctx, ctx->UNC +1 ,NULL ,NULL );if (rc) { -if (rc != -ENOENT && rc != -EOPNOTSUPP && rc != -EIO ) -return rc; +cifs_dbg (FYI ,"%s: no dfs referral for %s: %d\n" , + __func__, ctx->UNC +1 , rc); +cifs_dbg (FYI ,"%s: assuming non-dfs mount...\n" , __func__); nodfs = true; } }
Greg Kroah-Hartman
maintainerPATCH 109/292 cifs: fix session state check in smb2_find_smb_ses
In reply to Greg Kroah-HartmanFrom: Winston Wen <[email protected]>
commit 66be5c48ee1b5b8c919cc329fe6d32e16badaa40 upstream.
Chech the session state and skip it if it's exiting.
--- fs/smb/client/smb2transport.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/smb/client/smb2transport.c +7 -0
@@ -153,7 +153,14 @@ smb2_find_smb_ses_unlocked(struct TCP_Selist_for_each_entry (ses, &pserver->smb_ses_list, smb_ses_list) {if (ses->Suid != ses_id)continue ; + +spin_lock (&ses->ses_lock); +if (ses->ses_status ==SES_EXITING ) { +spin_unlock (&ses->ses_lock); +continue ; + } ++ses->ses_count; +spin_unlock (&ses->ses_lock);return ses; }
Greg Kroah-Hartman
maintainerPATCH 110/292 smb: client: fix parsing of source mount option
In reply to Greg Kroah-HartmanFrom: Paulo Alcantara <[email protected]>
commit 49024ec8795ed2bd7217c249ef50a70c4e25d662 upstream.
Handle trailing and leading separators when parsing UNC and prefix paths in smb3_parse_devname(). Then, store the sanitised paths in smb3_fs_context::source.
This fixes the following cases
$ mount //srv/share// /mnt/1 -o ... $ cat /mnt/1/d0/f0 cat: /mnt/1/d0/f0: Invalid argument
The -EINVAL was returned because the client sent SMB2_CREATE "\\d0\f0" rather than SMB2_CREATE "\d0\f0".
$ mount //srv//share /mnt/1 -o ... mount: Invalid argument
The -EINVAL was returned correctly although the client only realised it after sending a couple of bad requests rather than bailing out earlier when parsing mount options.
--- fs/smb/client/cifs_dfs_ref.c | 20 ++++++++++---- fs/smb/client/cifsproto.h | 2 + fs/smb/client/dfs.c | 38 ++------------------------- fs/smb/client/fs_context.c | 59 ++++++++++++++++++++++++++++++++++++------- fs/smb/client/misc.c | 17 ++++++++---- 5 files changed, 80 insertions(+), 56 deletions(-)
fs/smb/client/cifs_dfs_ref.c +14 -6
@@ -118,12 +118,12 @@ cifs_build_devname(char *nodename, constreturn dev; } -static int set_dest_addr (struct smb3_fs_context *ctx,const char *full_path) +static int set_dest_addr (struct smb3_fs_context *ctx) {struct sockaddr *addr = (struct sockaddr *)&ctx->dstaddr;int rc; - rc =dns_resolve_server_name_to_ip (full_path, addr,NULL ); + rc =dns_resolve_server_name_to_ip (ctx->source, addr,NULL );if (!rc)cifs_set_port (addr, ctx->port);return rc;
@@ -171,10 +171,9 @@ static struct vfsmount *cifs_dfs_do_auto mnt =ERR_CAST (full_path); goto out; } -cifs_dbg (FYI ,"%s: full_path: %s\n" , __func__, full_path); tmp = *cur_ctx; - tmp.source = full_path; + tmp.source =NULL ; tmp.leaf_fullpath =NULL ; tmp.UNC = tmp.prepath =NULL ; tmp.dfs_root_ses =NULL ;
@@ -185,13 +184,22 @@ static struct vfsmount *cifs_dfs_do_auto goto out; } - rc =set_dest_addr (ctx, full_path); + rc =smb3_parse_devname (full_path, ctx);if (rc) { mnt =ERR_PTR (rc); goto out; } - rc =smb3_parse_devname (full_path, ctx); + ctx->source =smb3_fs_context_fullpath (ctx,'/' ); +if (IS_ERR (ctx->source)) { + mnt =ERR_CAST (ctx->source); + ctx->source =NULL ; + goto out; + } +cifs_dbg (FYI ,"%s: ctx: source=%s UNC=%s prepath=%s dstaddr=%pISpc\n" , + __func__, ctx->source, ctx->UNC, ctx->prepath, &ctx->dstaddr); + + rc =set_dest_addr (ctx);if (!rc) mnt =fc_mount (fc);else
fs/smb/client/cifsproto.h +2 -0
@@ -85,6 +85,8 @@ extern void release_mid(struct mid_q_entextern void cifs_wake_up_task (struct mid_q_entry *mid);extern int cifs_handle_standard (struct TCP_Server_Info *server,struct mid_q_entry *mid); +extern char *smb3_fs_context_fullpath (const struct smb3_fs_context *ctx, +char dirsep);extern int smb3_parse_devname (const char *devname,struct smb3_fs_context *ctx);extern int smb3_parse_opt (const char *options,const char *key,char **val);extern int cifs_ipaddr_cmp (struct sockaddr *srcaddr,struct sockaddr *rhs);
fs/smb/client/dfs.c +3 -35
@@ -54,39 +54,6 @@ out:return rc; } -/* -* cifs_build_path_to_root returns full path to root when we do not have an -* existing connection (tcon) -*/ -static char *build_unc_path_to_root (const struct smb3_fs_context *ctx, -const struct cifs_sb_info *cifs_sb,bool useppath) -{ -char *full_path, *pos; -unsigned int pplen = useppath && ctx->prepath ?strlen (ctx->prepath) +1 :0 ; -unsigned int unc_len =strnlen (ctx->UNC,MAX_TREE_SIZE +1 ); - -if (unc_len >MAX_TREE_SIZE ) -return ERR_PTR (-EINVAL ); - - full_path =kmalloc (unc_len + pplen +1 ,GFP_KERNEL ); -if (full_path ==NULL ) -return ERR_PTR (-ENOMEM ); - -memcpy (full_path, ctx->UNC, unc_len); - pos = full_path + unc_len; - -if (pplen) { - *pos =CIFS_DIR_SEP (cifs_sb); -memcpy (pos +1 , ctx->prepath, pplen); - pos += pplen; - } - - *pos ='\0' ;/* add trailing null */ -convert_delimiter (full_path,CIFS_DIR_SEP (cifs_sb)); -cifs_dbg (FYI ,"%s: full_path=%s\n" , __func__, full_path); -return full_path; -} -static int get_session (struct cifs_mount_ctx *mnt_ctx,const char *full_path) {struct smb3_fs_context *ctx = mnt_ctx->fs_ctx;
@@ -179,6 +146,7 @@ static int __dfs_mount_share(struct cifsstruct TCP_Server_Info *server;struct cifs_tcon *tcon;char *origin_fullpath =NULL ; +char sep =CIFS_DIR_SEP (cifs_sb);int num_links =0 ;int rc;
@@ -186,7 +154,7 @@ static int __dfs_mount_share(struct cifsif (IS_ERR (ref_path))return PTR_ERR (ref_path); - full_path =build_unc_path_to_root (ctx, cifs_sb, true); + full_path =smb3_fs_context_fullpath (ctx, sep);if (IS_ERR (full_path)) { rc =PTR_ERR (full_path); full_path =NULL ;
@@ -228,7 +196,7 @@ static int __dfs_mount_share(struct cifskfree (full_path); ref_path = full_path =NULL ; - full_path =build_unc_path_to_root (ctx, cifs_sb, true); + full_path =smb3_fs_context_fullpath (ctx, sep);if (IS_ERR (full_path)) { rc =PTR_ERR (full_path); full_path =NULL ;
fs/smb/client/fs_context.c +50 -9
104 lines not on this page · raw message
fs/smb/client/misc.c +11 -6
@@ -1211,16 +1211,21 @@ int match_target_ip(struct TCP_Server_Inint cifs_update_super_prepath (struct cifs_sb_info *cifs_sb,char *prefix) { +int rc; +kfree (cifs_sb->prepath); + cifs_sb->prepath =NULL ;if (prefix && *prefix) { cifs_sb->prepath =cifs_sanitize_prepath (prefix,GFP_ATOMIC ); -if (!cifs_sb->prepath) -return -ENOMEM ; - -convert_delimiter (cifs_sb->prepath,CIFS_DIR_SEP (cifs_sb)); - }else - cifs_sb->prepath =NULL ; +if (IS_ERR (cifs_sb->prepath)) { + rc =PTR_ERR (cifs_sb->prepath); + cifs_sb->prepath =NULL ; +return rc; + } +if (cifs_sb->prepath) +convert_delimiter (cifs_sb->prepath,CIFS_DIR_SEP (cifs_sb)); + } cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_USE_PREFIX_PATH ;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 111/292 drm/client: Send hotplug event after registering a client
In reply to Greg Kroah-HartmanFrom: Thomas Zimmermann <[email protected]>
commit 27655b9bb9f0d9c32b8de8bec649b676898c52d5 upstream.
Generate a hotplug event after registering a client to allow the client to configure its display. Remove the hotplug calls from the existing clients for fbdev emulation. This change fixes a concurrency bug between registering a client and receiving events from the DRM core. The bug is present in the fbdev emulation of all drivers.
The fbdev emulation currently generates a hotplug event before registering the client to the device. For each new output, the DRM core sends an additional hotplug event to each registered client.
If the DRM core detects first output between sending the artificial hotplug and registering the device, the output's hotplug event gets lost. If this is the first output, the fbdev console display remains dark. This has been observed with amdgpu and fbdev-generic.
Fix this by adding hotplug generation directly to the client's register helper drm_client_register(). Registering the client and receiving events are serialized by struct drm_device.clientlist_mutex. So an output is either configured by the initial hotplug event, or the client has already been registered.
The bug was originally added in commit 6e3f17ee73f7 ("drm/fb-helper:
generic: Call drm_client_add() after setup is done"), in which adding a client and receiving a hotplug event switched order. It was hidden, as most hardware and drivers have at least on static output configured. Other drivers didn't use the internal DRM client or still had struct drm_mode_config_funcs.output_poll_changed set. That callback handled hotplug events as well. After not setting the callback in amdgpu in commit 0e3172bac3f4 ("drm/amdgpu: Don't set struct drm_driver.output_poll_changed"), amdgpu did not show a framebuffer console if output events got lost. The bug got copy-pasted from fbdev-generic into the other fbdev emulation.
[ Dropped changes to drivers/gpu/drm/armada/armada_fbdev.c as
174c3c38e3a2 drm/armada: Initialize fbdev DRM client was introduced in 6.5-rc1 ]
--- drivers/gpu/drm/drm_client.c | 21 +++++++++++++++++++++ drivers/gpu/drm/drm_fbdev_dma.c | 4 ---- drivers/gpu/drm/drm_fbdev_generic.c | 4 ---- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 4 ---- drivers/gpu/drm/gma500/fbdev.c | 4 ---- drivers/gpu/drm/msm/msm_fbdev.c | 4 ---- drivers/gpu/drm/omapdrm/omap_fbdev.c | 4 ---- drivers/gpu/drm/radeon/radeon_fbdev.c | 4 ---- drivers/gpu/drm/tegra/fbdev.c | 4 ---- 9 files changed, 21 insertions(+), 32 deletions(-)
drivers/gpu/drm/drm_client.c +21 -0
@@ -122,13 +122,34 @@ EXPORT_SYMBOL(drm_client_init);* drm_client_register() it is no longer permissible to call drm_client_release() * directly (outside the unregister callback), instead cleanup will happen * automatically on driver unload. +* +* Registering a client generates a hotplug event that allows the client +* to set up its display from pre-existing outputs. The client must have +* initialized its state to able to handle the hotplug event successfully. */ void drm_client_register (struct drm_client_dev *client) {struct drm_device *dev = client->dev; +int ret;mutex_lock (&dev->clientlist_mutex);list_add (&client->list, &dev->clientlist); + +if (client->funcs && client->funcs->hotplug) { +/* +* Perform an initial hotplug event to pick up the +* display configuration for the client. This step +* has to be performed *after* registering the client +* in the list of clients, or a concurrent hotplug +* event might be lost; leaving the display off. +* +* Hold the clientlist_mutex as for a regular hotplug +* event. +*/ + ret = client->funcs->hotplug (client); +if (ret) +drm_dbg_kms (dev,"client hotplug ret=%d\n" , ret); + }mutex_unlock (&dev->clientlist_mutex); }EXPORT_SYMBOL (drm_client_register);
drivers/gpu/drm/drm_fbdev_dma.c +0 -4
@@ -253,10 +253,6 @@ void drm_fbdev_dma_setup(struct drm_devi goto err_drm_client_init; } - ret =drm_fbdev_dma_client_hotplug (&fb_helper->client); -if (ret) -drm_dbg_kms (dev,"client hotplug ret=%d\n" , ret); -drm_client_register (&fb_helper->client);return ;
drivers/gpu/drm/drm_fbdev_generic.c +0 -4
@@ -340,10 +340,6 @@ void drm_fbdev_generic_setup(struct drm_ goto err_drm_client_init; } - ret =drm_fbdev_generic_client_hotplug (&fb_helper->client); -if (ret) -drm_dbg_kms (dev,"client hotplug ret=%d\n" , ret); -drm_client_register (&fb_helper->client);return ;
drivers/gpu/drm/exynos/exynos_drm_fbdev.c +0 -4
@@ -216,10 +216,6 @@ void exynos_drm_fbdev_setup(struct drm_dif (ret) goto err_drm_client_init; - ret =exynos_drm_fbdev_client_hotplug (&fb_helper->client); -if (ret) -drm_dbg_kms (dev,"client hotplug ret=%d\n" , ret); -drm_client_register (&fb_helper->client);return ;
drivers/gpu/drm/gma500/fbdev.c +0 -4
@@ -330,10 +330,6 @@ void psb_fbdev_setup(struct drm_psb_priv goto err_drm_fb_helper_unprepare; } - ret =psb_fbdev_client_hotplug (&fb_helper->client); -if (ret) -drm_dbg_kms (dev,"client hotplug ret=%d\n" , ret); -drm_client_register (&fb_helper->client);return ;
drivers/gpu/drm/msm/msm_fbdev.c +0 -4
@@ -227,10 +227,6 @@ void msm_fbdev_setup(struct drm_device * goto err_drm_fb_helper_unprepare; } - ret =msm_fbdev_client_hotplug (&helper->client); -if (ret) -drm_dbg_kms (dev,"client hotplug ret=%d\n" , ret); -drm_client_register (&helper->client);return ;
drivers/gpu/drm/omapdrm/omap_fbdev.c +0 -4
@@ -323,10 +323,6 @@ void omap_fbdev_setup(struct drm_deviceINIT_WORK (&fbdev->work, pan_worker); - ret =omap_fbdev_client_hotplug (&helper->client); -if (ret) -drm_dbg_kms (dev,"client hotplug ret=%d\n" , ret); -drm_client_register (&helper->client);return ;
drivers/gpu/drm/radeon/radeon_fbdev.c +0 -4
@@ -386,10 +386,6 @@ void radeon_fbdev_setup(struct radeon_de goto err_drm_client_init; } - ret =radeon_fbdev_client_hotplug (&fb_helper->client); -if (ret) -drm_dbg_kms (rdev->ddev,"client hotplug ret=%d\n" , ret); -drm_client_register (&fb_helper->client);return ;
drivers/gpu/drm/tegra/fbdev.c +0 -4
@@ -227,10 +227,6 @@ void tegra_fbdev_setup(struct drm_deviceif (ret) goto err_drm_client_init; - ret =tegra_fbdev_client_hotplug (&helper->client); -if (ret) -drm_dbg_kms (dev,"client hotplug ret=%d\n" , ret); -drm_client_register (&helper->client);return ;
Greg Kroah-Hartman
maintainerPATCH 112/292 f2fs: dont reset unchangable mount option in f2fs_remount()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
commit 458c15dfbce62c35fefd9ca637b20a051309c9f1 upstream.
syzbot reports a bug as below:
general protection fault, probably for non-canonical address 0xdffffc0000000009: 0000 [#1] PREEMPT SMP KASAN RIP: 0010:__lock_acquire+0x69/0x2000 kernel/locking/lockdep.c:4942 Call Trace: lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5691 __raw_write_lock include/linux/rwlock_api_smp.h:209 [inline] _raw_write_lock+0x2e/0x40 kernel/locking/spinlock.c:300 __drop_extent_tree+0x3ac/0x660 fs/f2fs/extent_cache.c:1100 f2fs_drop_extent_tree+0x17/0x30 fs/f2fs/extent_cache.c:1116 f2fs_insert_range+0x2d5/0x3c0 fs/f2fs/file.c:1664 f2fs_fallocate+0x4e4/0x6d0 fs/f2fs/file.c:1838 vfs_fallocate+0x54b/0x6b0 fs/open.c:324 ksys_fallocate fs/open.c:347 [inline] __do_sys_fallocate fs/open.c:355 [inline] __se_sys_fallocate fs/open.c:353 [inline] __x64_sys_fallocate+0xbd/0x100 fs/open.c:353 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
The root cause is race condition as below:
- since it tries to remount rw filesystem, so that do_remount won't call sb_prepare_remount_readonly to block fallocate, there may be race condition in between remount and fallocate.
- in f2fs_remount(), default_options() will reset mount option to default one, and then update it based on result of parse_options(), so there is a hole which race condition can happen.
Thread A Thread B
- f2fs_fill_super
- parse_options
- clear_opt(READ_EXTENT_CACHE)
- f2fs_remount
- default_options
- set_opt(READ_EXTENT_CACHE)
- f2fs_fallocate
- f2fs_insert_range
- f2fs_drop_extent_tree
- __drop_extent_tree
- __may_extent_tree
- test_opt(READ_EXTENT_CACHE) return true
- write_lock(&et->lock) access NULL pointer
- parse_options
- clear_opt(READ_EXTENT_CACHE)
--- fs/f2fs/super.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
fs/f2fs/super.c +18 -12
@@ -2086,9 +2086,22 @@ static int f2fs_show_options(struct seq_return 0 ; } -static void default_options (struct f2fs_sb_info *sbi) +static void default_options (struct f2fs_sb_info *sbi,bool remount) {/* init some FS parameters */ +if (!remount) { +set_opt (sbi,READ_EXTENT_CACHE ); +clear_opt (sbi,DISABLE_CHECKPOINT ); + +if (f2fs_hw_support_discard (sbi) ||f2fs_hw_should_discard (sbi)) +set_opt (sbi,DISCARD ); + +if (f2fs_sb_has_blkzoned (sbi)) +F2FS_OPTION (sbi).discard_unit =DISCARD_UNIT_SECTION ; +else +F2FS_OPTION (sbi).discard_unit =DISCARD_UNIT_BLOCK ; + } +if (f2fs_sb_has_readonly (sbi))F2FS_OPTION (sbi).active_logs =NR_CURSEG_RO_TYPE ;else
@@ -2118,23 +2131,16 @@ static void default_options(struct f2fs_set_opt (sbi,INLINE_XATTR );set_opt (sbi,INLINE_DATA );set_opt (sbi,INLINE_DENTRY ); -set_opt (sbi,READ_EXTENT_CACHE );set_opt (sbi,NOHEAP ); -clear_opt (sbi,DISABLE_CHECKPOINT );set_opt (sbi,MERGE_CHECKPOINT );F2FS_OPTION (sbi).unusable_cap =0 ; sbi->sb->s_flags |=SB_LAZYTIME ;if (!f2fs_is_readonly (sbi))set_opt (sbi,FLUSH_MERGE ); -if (f2fs_hw_support_discard (sbi) ||f2fs_hw_should_discard (sbi)) -set_opt (sbi,DISCARD ); -if (f2fs_sb_has_blkzoned (sbi)) { +if (f2fs_sb_has_blkzoned (sbi))F2FS_OPTION (sbi).fs_mode =FS_MODE_LFS ; -F2FS_OPTION (sbi).discard_unit =DISCARD_UNIT_SECTION ; - }else { +else F2FS_OPTION (sbi).fs_mode =FS_MODE_ADAPTIVE ; -F2FS_OPTION (sbi).discard_unit =DISCARD_UNIT_BLOCK ; - }#ifdef CONFIG_F2FS_FS_XATTR set_opt (sbi,XATTR_USER );
@@ -2306,7 +2312,7 @@ static int f2fs_remount(struct super_bloclear_sbi_flag (sbi,SBI_NEED_SB_WRITE ); } -default_options (sbi); +default_options (sbi, true);/* parse mount options */ err =parse_options (sb, data, true);
@@ -4357,7 +4363,7 @@ try_onemore: sbi->s_chksum_seed =f2fs_chksum (sbi, ~0 , raw_super->uuid,sizeof (raw_super->uuid)); -default_options (sbi); +default_options (sbi, false);/* parse mount options */ options =kstrdup ((const char *)data,GFP_KERNEL );if (data && !options) {
Greg Kroah-Hartman
maintainerPATCH 113/292 f2fs: fix deadlock in i_xattr_sem and inode page lock
In reply to Greg Kroah-HartmanFrom: Jaegeuk Kim <[email protected]>
commit 5eda1ad1aaffdfebdecf7a164e586060a210f74f upstream.
Thread #1:
[122554.641906][ T92] f2fs_getxattr+0xd4/0x5fc
-> waiting for f2fs_down_read(&F2FS_I(inode)->i_xattr_sem);[122554.641927][ T92] __f2fs_get_acl+0x50/0x284
[122554.641948][ T92] f2fs_init_acl+0x84/0x54c
[122554.641969][ T92] f2fs_init_inode_metadata+0x460/0x5f0
[122554.641990][ T92] f2fs_add_inline_entry+0x11c/0x350
-> Locked dir->inode_page by f2fs_get_node_page()[122554.642009][ T92] f2fs_do_add_link+0x100/0x1e4 [122554.642025][ T92] f2fs_create+0xf4/0x22c [122554.642047][ T92] vfs_create+0x130/0x1f4
Thread #2:
[123996.386358][ T92] __get_node_page+0x8c/0x504
-> waiting for dir->inode_page lock[123996.386383][ T92] read_all_xattrs+0x11c/0x1f4
[123996.386405][ T92] __f2fs_setxattr+0xcc/0x528
[123996.386424][ T92] f2fs_setxattr+0x158/0x1f4
-> f2fs_down_write(&F2FS_I(inode)->i_xattr_sem);[123996.386443][ T92] __f2fs_set_acl+0x328/0x430 [123996.386618][ T92] f2fs_set_acl+0x38/0x50 [123996.386642][ T92] posix_acl_chmod+0xc8/0x1c8 [123996.386669][ T92] f2fs_setattr+0x5e0/0x6bc [123996.386689][ T92] notify_change+0x4d8/0x580 [123996.386717][ T92] chmod_common+0xd8/0x184 [123996.386748][ T92] do_fchmodat+0x60/0x124 [123996.386766][ T92] __arm64_sys_fchmodat+0x28/0x3c
--- fs/f2fs/dir.c | 9 ++++++++- fs/f2fs/xattr.c | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-)
fs/f2fs/dir.c +8 -1
@@ -775,8 +775,15 @@ int f2fs_add_dentry(struct inode *dir, c {int err = -EAGAIN ; -if (f2fs_has_inline_dentry (dir)) +if (f2fs_has_inline_dentry (dir)) { +/* +* Should get i_xattr_sem to keep the lock order: +* i_xattr_sem -> inode_page lock used by f2fs_setxattr. +*/ +f2fs_down_read (&F2FS_I (dir)->i_xattr_sem); err =f2fs_add_inline_entry (dir, fname, inode, ino, mode); +f2fs_up_read (&F2FS_I (dir)->i_xattr_sem); + }if (err == -EAGAIN ) err =f2fs_add_regular_entry (dir, fname, inode, ino, mode);
fs/f2fs/xattr.c +4 -2
@@ -528,10 +528,12 @@ int f2fs_getxattr(struct inode *inode, iif (len >F2FS_NAME_LEN )return -ERANGE ; -f2fs_down_read (&F2FS_I (inode)->i_xattr_sem); +if (!ipage) +f2fs_down_read (&F2FS_I (inode)->i_xattr_sem); error =lookup_all_xattrs (inode, ipage, index, len, name, &entry, &base_addr, &base_size, &is_inline); -f2fs_up_read (&F2FS_I (inode)->i_xattr_sem); +if (!ipage) +f2fs_up_read (&F2FS_I (inode)->i_xattr_sem);if (error)return error;
Greg Kroah-Hartman
maintainerPATCH 114/292 kbuild: make modules_install copy modules.builtin(.modinfo)
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit 8ae071fc216a25f4f797f33c56857f4dd6b4408e upstream.
Josh Triplett reports that initramfs-tools needs modules.builtin and modules.builtin.modinfo to create a working initramfs for a non-modular kernel.
If this is a general tooling issue not limited to Debian, I think it makes sense to change modules_install.
This commit changes the targets as follows when CONFIG_MODULES=n.
In-tree builds:
make modules -> no-op
make modules_install -> install modules.builtin(.modinfo)
External module builds:
make modules -> show error message like before
make modules_install -> show error message like before
Stable-dep-of: 4243afdb9326 ("kbuild: builddeb: always make modules_install, to install modules.builtin*")
--- Makefile | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
Makefile +16 -10
@@ -1561,6 +1561,8 @@ modules_sign_only := y endif endif +endif # CONFIG_MODULES + modinst_pre := ifneq ($(filter modules_install,$(MAKECMDGOALS)),) modinst_pre := __modinst_pre
@@ -1571,18 +1573,18 @@ PHONY += __modinst_pre __modinst_pre: @rm -rf $(MODLIB)/kernel @rm -f $(MODLIB)/source - @mkdir -p $(MODLIB)/kernel + @mkdir -p $(MODLIB) +ifdef CONFIG_MODULES @ln -s $(abspath $(srctree)) $(MODLIB)/source @if [ ! $(objtree) -ef $(MODLIB)/build ]; then \ rm -f $(MODLIB)/build ; \ ln -s $(CURDIR) $(MODLIB)/build ; \ fi @sed 's:^\(.*\)\.o$$:kernel/\1.ko:' modules.order > $(MODLIB)/modules.order +endif @cp -f modules.builtin $(MODLIB)/ @cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/ -endif # CONFIG_MODULES - ### # Cleaning is done on three levels. # make clean Delete most generated files
@@ -1924,6 +1926,13 @@ help: @echo ' clean - remove generated files in module directory only' @echo '' +__external_modules_error: + @echo >&2 '***' + @echo >&2 '*** The present kernel disabled CONFIG_MODULES.' + @echo >&2 '*** You cannot build or install external modules.' + @echo >&2 '***' + @false + endif # KBUILD_EXTMOD # ---------------------------------------------------------------------------
@@ -1960,13 +1969,10 @@ else # CONFIG_MODULES # Modules not configured # --------------------------------------------------------------------------- -modules modules_install: - @echo >&2 '***' - @echo >&2 '*** The present kernel configuration has modules disabled.' - @echo >&2 '*** To use the module feature, please run "make menuconfig" etc.' - @echo >&2 '*** to enable CONFIG_MODULES.' - @echo >&2 '***' - @exit 1 +PHONY += __external_modules_error + +modules modules_install: __external_modules_error + @: KBUILD_MODULES :=
Greg Kroah-Hartman
maintainerPATCH 115/292 pinctrl: amd: Detect internal GPIO0 debounce handling
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
commit 968ab9261627fa305307e3935ca1a32fcddd36cb upstream.
commit 4e5a04be88fe ("pinctrl: amd: disable and mask interrupts on probe") had a mistake in loop iteration 63 that it would clear offset 0xFC instead of 0x100. Offset 0xFC is actually WAKE_INT_MASTER_REG. This was clearing bits 13 and 15 from the register which significantly changed the expected handling for some platforms for GPIO0.
commit b26cd9325be4 ("pinctrl: amd: Disable and mask interrupts on resume") actually fixed this bug, but lead to regressions on Lenovo Z13 and some other systems. This is because there was no handling in the driver for bit 15 debounce behavior.
Quoting a public BKDG:
``` EnWinBlueBtn. Read-write. Reset: 0. 0=GPIO0 detect debounced power button; Power button override is 4 seconds. 1=GPIO0 detect debounced power button in S3/S5/S0i3, and detect "pressed less than 2 seconds" and "pressed 2~10 seconds" in S0; Power button override is 10 seconds ```
Cross referencing the same master register in Windows it's obvious that Windows doesn't use debounce values in this configuration. So align the Linux driver to do this as well. This fixes wake on lid when WAKE_INT_MASTER_REG is properly programmed.
--- drivers/pinctrl/pinctrl-amd.c | 7 +++++++ drivers/pinctrl/pinctrl-amd.h | 1 + 2 files changed, 8 insertions(+)
drivers/pinctrl/pinctrl-amd.c +7 -0
@@ -125,6 +125,12 @@ static int amd_gpio_set_debounce(structstruct amd_gpio *gpio_dev =gpiochip_get_data (gc);raw_spin_lock_irqsave (&gpio_dev->lock, flags); + +/* Use special handling for Pin0 debounce */ + pin_reg =readl (gpio_dev->base +WAKE_INT_MASTER_REG ); +if (pin_reg &INTERNAL_GPIO0_DEBOUNCE ) + debounce =0 ; + pin_reg =readl (gpio_dev->base + offset *4 );if (debounce) {
@@ -219,6 +225,7 @@ static void amd_gpio_dbg_show(struct seqchar *debounce_enable;char *wake_cntrlz; +seq_printf (s,"WAKE_INT_MASTER_REG: 0x%08x\n" ,readl (gpio_dev->base +WAKE_INT_MASTER_REG ));for (bank =0 ; bank < gpio_dev->hwbank_num; bank++) {unsigned int time =0 ;unsigned int unit =0 ;
drivers/pinctrl/pinctrl-amd.h +1 -0
@@ -17,6 +17,7 @@#define AMD_GPIO_PINS_BANK3 32#define WAKE_INT_MASTER_REG 0xfc +#define INTERNAL_GPIO0_DEBOUNCE (1 << 15)#define EOI_MASK (1 << 29)#define WAKE_INT_STATUS_REG0 0x2f8
Greg Kroah-Hartman
maintainerPATCH 116/292 pinctrl: amd: Fix mistake in handling clearing pins at startup
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
commit a855724dc08b8cb0c13ab1e065a4922f1e5a7552 upstream.
commit 4e5a04be88fe ("pinctrl: amd: disable and mask interrupts on probe") had a mistake in loop iteration 63 that it would clear offset 0xFC instead of 0x100. Offset 0xFC is actually WAKE_INT_MASTER_REG. This was clearing bits 13 and 15 from the register which significantly changed the expected handling for some platforms for GPIO0.
--- drivers/pinctrl/pinctrl-amd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-amd.c +2 -2
@@ -897,9 +897,9 @@ static void amd_gpio_irq_init(struct amdraw_spin_lock_irqsave (&gpio_dev->lock, flags); - pin_reg =readl (gpio_dev->base + i *4 ); + pin_reg =readl (gpio_dev->base + pin *4 ); pin_reg &= ~mask; -writel (pin_reg, gpio_dev->base + i *4 ); +writel (pin_reg, gpio_dev->base + pin *4 );raw_spin_unlock_irqrestore (&gpio_dev->lock, flags); }
Greg Kroah-Hartman
maintainerPATCH 117/292 pinctrl: amd: Detect and mask spurious interrupts
In reply to Greg Kroah-HartmanFrom: Kornel Dulęba <[email protected]>
commit 0cf9e48ff22e15f3f0882991f33d23ccc5ae1d01 upstream.
Leverage gpiochip_line_is_irq to check whether a pin has an irq associated with it. The previous check ("irq == 0") didn't make much sense. The irq variable refers to the pinctrl irq, and has nothing do to with an individual pin.
On some systems, during suspend/resume cycle, the firmware leaves an interrupt enabled on a pin that is not used by the kernel. Without this patch that caused an interrupt storm.
--- drivers/pinctrl/pinctrl-amd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/pinctrl/pinctrl-amd.c +6 -6
@@ -660,21 +660,21 @@ static bool do_amd_gpio_irq_handler(int* We must read the pin register again, in case the * value was changed while executing * generic_handle_domain_irq() above. -* If we didn't find a mapping for the interrupt, -* disable it in order to avoid a system hang caused -* by an interrupt storm. +* If the line is not an irq, disable it in order to +* avoid a system hang caused by an interrupt storm. */ raw_spin_lock_irqsave (&gpio_dev->lock, flags); regval =readl (regs + i); -if (irq ==0 ) { - regval &= ~BIT (INTERRUPT_ENABLE_OFF ); +if (!gpiochip_line_is_irq (gc, irqnr + i)) { + regval &= ~BIT (INTERRUPT_MASK_OFF );dev_dbg (&gpio_dev->pdev->dev,"Disabling spurious GPIO IRQ %d\n" , irqnr + i); + }else { + ret = true; }writel (regval, regs + i);raw_spin_unlock_irqrestore (&gpio_dev->lock, flags); - ret = true; } }/* did not cause wake on resume context for shared IRQ */
Greg Kroah-Hartman
maintainerPATCH 118/292 pinctrl: amd: Revert "pinctrl: amd: disable and mask interrupts on probe"
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
commit 65f6c7c91cb2ebacbf155e0f881f81e79f90d138 upstream.
commit 4e5a04be88fe ("pinctrl: amd: disable and mask interrupts on probe") was well intentioned to mask a firmware issue on a surface laptop, but it has a few problems:
1. It had a bug in the loop handling for iteration 63 that lead to other problems with GPIO0 handling.
2. It disables interrupts that are used internally by the SOC but masked by default.
3. It masked a real firmware problem in some chromebooks that should have been caught during development but wasn't.
There has been a lot of other development around s2idle; particularly around handling of the spurious wakeups. If there is still a problem on the original reported surface laptop it should be avoided by adding a quirk to gpiolib-acpi for that system instead.
--- drivers/pinctrl/pinctrl-amd.c | 31 ------------------------------- 1 file changed, 31 deletions(-)
drivers/pinctrl/pinctrl-amd.c +0 -31
@@ -877,34 +877,6 @@ static const struct pinconf_ops amd_pinc .pin_config_group_set = amd_pinconf_group_set, }; -static void amd_gpio_irq_init (struct amd_gpio *gpio_dev) -{ -struct pinctrl_desc *desc = gpio_dev->pctrl->desc; -unsigned long flags; -u32 pin_reg, mask; -int i; - - mask =BIT (WAKE_CNTRL_OFF_S0I3 ) |BIT (WAKE_CNTRL_OFF_S3 ) | -BIT (INTERRUPT_MASK_OFF ) |BIT (INTERRUPT_ENABLE_OFF ) | -BIT (WAKE_CNTRL_OFF_S4 ); - -for (i =0 ; i < desc->npins; i++) { -int pin = desc->pins[i].number; -const struct pin_desc *pd =pin_desc_get (gpio_dev->pctrl, pin); - -if (!pd) -continue ; - -raw_spin_lock_irqsave (&gpio_dev->lock, flags); - - pin_reg =readl (gpio_dev->base + pin *4 ); - pin_reg &= ~mask; -writel (pin_reg, gpio_dev->base + pin *4 ); - -raw_spin_unlock_irqrestore (&gpio_dev->lock, flags); - } -} -#ifdef CONFIG_PM_SLEEP static bool amd_gpio_should_save (struct amd_gpio *gpio_dev,unsigned int pin) {
@@ -1142,9 +1114,6 @@ static int amd_gpio_probe(struct platforreturn PTR_ERR (gpio_dev->pctrl); } -/* Disable and mask interrupts */ -amd_gpio_irq_init (gpio_dev); - girq = &gpio_dev->gc.irq;gpio_irq_chip_set_chip (girq, &amd_gpio_irqchip);/* This will let us handle the parent IRQ in the driver */
Greg Kroah-Hartman
maintainerPATCH 119/292 pinctrl: amd: Only use special debounce behavior for GPIO 0
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
commit 0d5ace1a07f7e846d0f6d972af60d05515599d0b upstream.
It's uncommon to use debounce on any other pin, but technically we should only set debounce to 0 when working off GPIO0.
--- drivers/pinctrl/pinctrl-amd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-amd.c +5 -3
@@ -127,9 +127,11 @@ static int amd_gpio_set_debounce(structraw_spin_lock_irqsave (&gpio_dev->lock, flags);/* Use special handling for Pin0 debounce */ - pin_reg =readl (gpio_dev->base +WAKE_INT_MASTER_REG ); -if (pin_reg &INTERNAL_GPIO0_DEBOUNCE ) - debounce =0 ; +if (offset ==0 ) { + pin_reg =readl (gpio_dev->base +WAKE_INT_MASTER_REG ); +if (pin_reg &INTERNAL_GPIO0_DEBOUNCE ) + debounce =0 ; + } pin_reg =readl (gpio_dev->base + offset *4 );
Greg Kroah-Hartman
maintainerPATCH 120/292 pinctrl: amd: Use amd_pinconf_set() for all config options
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
commit 635a750d958e158e17af0f524bedc484b27fbb93 upstream.
On ASUS TUF A16 it is reported that the ITE5570 ACPI device connected to GPIO 7 is causing an interrupt storm. This issue doesn't happen on Windows.
Comparing the GPIO register configuration between Windows and Linux bit 20 has been configured as a pull up on Windows, but not on Linux. Checking GPIO declaration from the firmware it is clear it *should* have been a pull up on Linux as well.
```
GpioInt (Level, ActiveLow, Exclusive, PullUp, 0x0000,
"\\_SB.GPIO", 0x00, ResourceConsumer, ,)
{ // Pin list
0x0007
}
```On Linux amd_gpio_set_config() is currently only used for programming the debounce. Actually the GPIO core calls it with all the arguments that are supported by a GPIO, pinctrl-amd just responds -ENOTSUPP.
To solve this issue expand amd_gpio_set_config() to support the other arguments amd_pinconf_set() supports, namely PIN_CONFIG_BIAS_PULL_DOWN, PIN_CONFIG_BIAS_PULL_UP, and PIN_CONFIG_DRIVE_STRENGTH.
--- drivers/pinctrl/pinctrl-amd.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
drivers/pinctrl/pinctrl-amd.c +15 -13
@@ -188,18 +188,6 @@ static int amd_gpio_set_debounce(structreturn ret; } -static int amd_gpio_set_config (struct gpio_chip *gc,unsigned offset, -unsigned long config) -{ -u32 debounce; - -if (pinconf_to_config_param (config) !=PIN_CONFIG_INPUT_DEBOUNCE ) -return -ENOTSUPP ; - - debounce =pinconf_to_config_argument (config); -return amd_gpio_set_debounce (gc, offset, debounce); -} -#ifdef CONFIG_DEBUG_FS static void amd_gpio_dbg_show (struct seq_file *s,struct gpio_chip *gc) {
@@ -782,7 +770,7 @@ static int amd_pinconf_get(struct pinctr }static int amd_pinconf_set (struct pinctrl_dev *pctldev,unsigned int pin, -unsigned long *configs,unsigned num_configs) +unsigned long *configs,unsigned int num_configs) {int i;u32 arg;
@@ -872,6 +860,20 @@ static int amd_pinconf_group_set(structreturn 0 ; } +static int amd_gpio_set_config (struct gpio_chip *gc,unsigned int pin, +unsigned long config) +{ +struct amd_gpio *gpio_dev =gpiochip_get_data (gc); + +if (pinconf_to_config_param (config) ==PIN_CONFIG_INPUT_DEBOUNCE ) { +u32 debounce =pinconf_to_config_argument (config); + +return amd_gpio_set_debounce (gc, pin, debounce); + } + +return amd_pinconf_set (gpio_dev->pctrl, pin, &config,1 ); +} +static const struct pinconf_ops amd_pinconf_ops = { .pin_config_get = amd_pinconf_get, .pin_config_set = amd_pinconf_set,
Greg Kroah-Hartman
maintainerPATCH 121/292 pinctrl: amd: Drop pull up select configuration
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
commit 3f62312d04d4c68aace9cd06fc135e09573325f3 upstream.
pinctrl-amd currently tries to program bit 19 of all GPIOs to select either a 4kΩ or 8hΩ pull up, but this isn't what bit 19 does. Bit 19 is marked as reserved, even in the latest platforms documentation.
Drop this programming functionality.
--- drivers/pinctrl/pinctrl-amd.c | 16 ++++------------ drivers/pinctrl/pinctrl-amd.h | 1 - 2 files changed, 4 insertions(+), 13 deletions(-)
drivers/pinctrl/pinctrl-amd.c +4 -12
@@ -209,7 +209,6 @@ static void amd_gpio_dbg_show(struct seqchar *pin_sts;char *interrupt_sts;char *wake_sts; -char *pull_up_sel;char *orientation;char debounce_value[40 ];char *debounce_enable;
@@ -317,14 +316,9 @@ static void amd_gpio_dbg_show(struct seqseq_printf (s," %s|" , wake_sts);if (pin_reg &BIT (PULL_UP_ENABLE_OFF )) { -if (pin_reg &BIT (PULL_UP_SEL_OFF )) - pull_up_sel ="8k" ; -else - pull_up_sel ="4k" ; -seq_printf (s,"%s ↑|" , - pull_up_sel); +seq_puts (s," ↑ |" ); }else if (pin_reg &BIT (PULL_DOWN_ENABLE_OFF )) { -seq_puts (s," ↓|" ); +seq_puts (s," ↓ |" ); }else {seq_puts (s," |" ); }
@@ -751,7 +745,7 @@ static int amd_pinconf_get(struct pinctrbreak ;case PIN_CONFIG_BIAS_PULL_UP : - arg = (pin_reg >>PULL_UP_SEL_OFF ) & (BIT (0 ) |BIT (1 )); + arg = (pin_reg >>PULL_UP_ENABLE_OFF ) &BIT (0 );break ;case PIN_CONFIG_DRIVE_STRENGTH :
@@ -798,10 +792,8 @@ static int amd_pinconf_set(struct pinctrbreak ;case PIN_CONFIG_BIAS_PULL_UP : - pin_reg &= ~BIT (PULL_UP_SEL_OFF ); - pin_reg |= (arg &BIT (0 )) <<PULL_UP_SEL_OFF ; pin_reg &= ~BIT (PULL_UP_ENABLE_OFF ); - pin_reg |= ((arg>>1 ) &BIT (0 )) <<PULL_UP_ENABLE_OFF ; + pin_reg |= (arg &BIT (0 )) <<PULL_UP_ENABLE_OFF ;break ;case PIN_CONFIG_DRIVE_STRENGTH :
drivers/pinctrl/pinctrl-amd.h +0 -1
@@ -36,7 +36,6 @@#define WAKE_CNTRL_OFF_S4 15#define PIN_STS_OFF 16#define DRV_STRENGTH_SEL_OFF 17 -#define PULL_UP_SEL_OFF 19#define PULL_UP_ENABLE_OFF 20#define PULL_DOWN_ENABLE_OFF 21#define OUTPUT_VALUE_OFF 22
Greg Kroah-Hartman
maintainerPATCH 122/292 pinctrl: amd: Unify debounce handling into amd_pinconf_set()
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
commit 283c5ce7da0a676f46539094d40067ad17c4f294 upstream.
Debounce handling is done in two different entry points in the driver. Unify this to make sure that it's always handled the same.
--- drivers/pinctrl/pinctrl-amd.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-)
drivers/pinctrl/pinctrl-amd.c +5 -16
@@ -115,16 +115,12 @@ static void amd_gpio_set_value(struct gpraw_spin_unlock_irqrestore (&gpio_dev->lock, flags); } -static int amd_gpio_set_debounce (struct gpio_chip *gc,unsigned offset, -unsigned debounce) +static int amd_gpio_set_debounce (struct amd_gpio *gpio_dev,unsigned int offset, +unsigned int debounce) {u32 time;u32 pin_reg;int ret =0 ; -unsigned long flags; -struct amd_gpio *gpio_dev =gpiochip_get_data (gc); - -raw_spin_lock_irqsave (&gpio_dev->lock, flags);/* Use special handling for Pin0 debounce */ if (offset ==0 ) {
@@ -183,7 +179,6 @@ static int amd_gpio_set_debounce(struct pin_reg &= ~(DB_CNTRl_MASK <<DB_CNTRL_OFF ); }writel (pin_reg, gpio_dev->base + offset *4 ); -raw_spin_unlock_irqrestore (&gpio_dev->lock, flags);return ret; }
@@ -782,9 +777,8 @@ static int amd_pinconf_set(struct pinctrswitch (param) {case PIN_CONFIG_INPUT_DEBOUNCE : - pin_reg &= ~DB_TMR_OUT_MASK ; - pin_reg |= arg &DB_TMR_OUT_MASK ; -break ; + ret =amd_gpio_set_debounce (gpio_dev, pin, arg); + goto out_unlock;case PIN_CONFIG_BIAS_PULL_DOWN : pin_reg &= ~BIT (PULL_DOWN_ENABLE_OFF );
@@ -811,6 +805,7 @@ static int amd_pinconf_set(struct pinctrwritel (pin_reg, gpio_dev->base + pin*4 ); } +out_unlock:raw_spin_unlock_irqrestore (&gpio_dev->lock, flags);return ret;
@@ -857,12 +852,6 @@ static int amd_gpio_set_config(struct gp {struct amd_gpio *gpio_dev =gpiochip_get_data (gc); -if (pinconf_to_config_param (config) ==PIN_CONFIG_INPUT_DEBOUNCE ) { -u32 debounce =pinconf_to_config_argument (config); - -return amd_gpio_set_debounce (gc, pin, debounce); - } -return amd_pinconf_set (gpio_dev->pctrl, pin, &config,1 ); }
Greg Kroah-Hartman
maintainerPATCH 123/292 tpm: Do not remap from ACPI resources again for Pluton TPM
In reply to Greg Kroah-HartmanFrom: Valentin David <[email protected]>
commit b1c1b98962d17a922989aa3b2822946bbb5c091f upstream.
For Pluton TPM devices, it was assumed that there was no ACPI memory regions. This is not true for ASUS ROG Ally. ACPI advertises 0xfd500000-0xfd5fffff.
Since remapping is already done in crb_map_pluton, remapping again in crb_map_io causes EBUSY error:
[ 3.510453] tpm_crb MSFT0101:00: can't request region for resource [mem 0xfd500000-0xfd5fffff] [ 3.510463] tpm_crb: probe of MSFT0101:00 failed with error -16
--- drivers/char/tpm/tpm_crb.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/char/tpm/tpm_crb.c +11 -8
@@ -563,15 +563,18 @@ static int crb_map_io(struct acpi_deviceu32 rsp_size;int ret; -INIT_LIST_HEAD (&acpi_resource_list); - ret =acpi_dev_get_resources (device, &acpi_resource_list, - crb_check_resource, iores_array); -if (ret <0 ) -return ret; -acpi_dev_free_resource_list (&acpi_resource_list); - -/* Pluton doesn't appear to define ACPI memory regions */ +/* +* Pluton sometimes does not define ACPI memory regions. +* Mapping is then done in crb_map_pluton +*/ if (priv->sm !=ACPI_TPM2_COMMAND_BUFFER_WITH_PLUTON ) { +INIT_LIST_HEAD (&acpi_resource_list); + ret =acpi_dev_get_resources (device, &acpi_resource_list, + crb_check_resource, iores_array); +if (ret <0 ) +return ret; +acpi_dev_free_resource_list (&acpi_resource_list); +if (resource_type (iores_array) !=IORESOURCE_MEM ) {dev_err (dev,FW_BUG "TPM2 ACPI table does not define a memory resource\n" );return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 124/292 tpm: tpm_vtpm_proxy: fix a race condition in /dev/vtpmx creation
In reply to Greg Kroah-HartmanFrom: Jarkko Sakkinen <[email protected]>
commit f4032d615f90970d6c3ac1d9c0bce3351eb4445c upstream.
/dev/vtpmx is made visible before 'workqueue' is initialized, which can lead to a memory corruption in the worst case scenario.
Address this by initializing 'workqueue' as the very first step of the driver initialization.
--- drivers/char/tpm/tpm_vtpm_proxy.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-)
drivers/char/tpm/tpm_vtpm_proxy.c +7 -23
@@ -683,37 +683,21 @@ static struct miscdevice vtpmx_miscdev = .fops = &vtpmx_fops, }; -static int vtpmx_init (void ) -{ -return misc_register (&vtpmx_miscdev); -} - -static void vtpmx_cleanup (void ) -{ -misc_deregister (&vtpmx_miscdev); -} -static int __init vtpm_module_init (void ) {int rc; - rc =vtpmx_init (); -if (rc) { -pr_err ("couldn't create vtpmx device\n" ); -return rc; - } - workqueue =create_workqueue ("tpm-vtpm" );if (!workqueue) {pr_err ("couldn't create workqueue\n" ); - rc = -ENOMEM ; - goto err_vtpmx_cleanup; +return -ENOMEM ; } -return 0 ; - -err_vtpmx_cleanup: -vtpmx_cleanup (); + rc =misc_register (&vtpmx_miscdev); +if (rc) { +pr_err ("couldn't create vtpmx device\n" ); +destroy_workqueue (workqueue); + }return rc; }
@@ -721,7 +705,7 @@ err_vtpmx_cleanup: static void __exit vtpm_module_exit(void) {destroy_workqueue (workqueue); -vtpmx_cleanup (); +misc_deregister (&vtpmx_miscdev); }module_init (vtpm_module_init);
Greg Kroah-Hartman
maintainerPATCH 125/292 tpm: tpm_tis: Disable interrupts *only* for AEON UPX-i11
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
commit edb13d7bb034c4d5523f15e9aeea31c504af6f91 upstream.
Further restrict with DMI_PRODUCT_VERSION.
--- drivers/char/tpm/tpm_tis.c | 1 + 1 file changed, 1 insertion(+)
drivers/char/tpm/tpm_tis.c +1 -0
@@ -143,6 +143,7 @@ static const struct dmi_system_id tpm_tis_dmi_table[] = { .ident = "UPX-TGL", .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"AAEON" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "UPX-TGL"), }, }, {}
Signature · 1 line
2.41.0
Greg Kroah-Hartman
maintainerPATCH 126/292 tpm: tis_i2c: Limit read bursts to I2C_SMBUS_BLOCK_MAX (32) bytes
In reply to Greg Kroah-HartmanFrom: Alexander Sverdlin <[email protected]>
commit f3b70b6e3390bfdf18fdd7d278a72a12784fdcce upstream.
Underlying I2C bus drivers not always support longer transfers and imx-lpi2c for instance doesn't. SLB 9673 offers 427-bytes packets.
Visible symptoms are:
tpm tpm0: Error left over data
tpm tpm0: tpm_transmit: tpm_recv: error -5tpm_tis_i2c: probe of 1-002e failed with error -5
--- drivers/char/tpm/tpm_tis_i2c.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-)
drivers/char/tpm/tpm_tis_i2c.c +21 -14
@@ -189,21 +189,28 @@ static int tpm_tis_i2c_read_bytes(structint ret;for (i =0 ; i <TPM_RETRY ; i++) { -/* write register */ - msg.len =sizeof (reg); - msg.buf = ® - msg.flags =0 ; - ret =tpm_tis_i2c_retry_transfer_until_ack (data, &msg); -if (ret <0 ) -return ret; +u16 read =0 ; -/* read data */ - msg.buf = result; - msg.len = len; - msg.flags =I2C_M_RD ; - ret =tpm_tis_i2c_retry_transfer_until_ack (data, &msg); -if (ret <0 ) -return ret; +while (read < len) { +/* write register */ + msg.len =sizeof (reg); + msg.buf = ® + msg.flags =0 ; + ret =tpm_tis_i2c_retry_transfer_until_ack (data, &msg); +if (ret <0 ) +return ret; + +/* read data */ + msg.buf = result + read; + msg.len = len - read; + msg.flags =I2C_M_RD ; +if (msg.len >I2C_SMBUS_BLOCK_MAX ) + msg.len =I2C_SMBUS_BLOCK_MAX ; + ret =tpm_tis_i2c_retry_transfer_until_ack (data, &msg); +if (ret <0 ) +return ret; + read += msg.len; + } ret =tpm_tis_i2c_sanity_check_read (reg, len, result);if (ret ==0 )
Greg Kroah-Hartman
maintainerPATCH 127/292 tpm/tpm_tis: Disable interrupts for Framework Laptop Intel 12th gen
In reply to Greg Kroah-HartmanFrom: Christian Hesse <[email protected]>
commit 08b0af4478bacb8bb701c172c99a34ea32da89f5 upstream.
This device suffer an irq storm, so add it in tpm_tis_dmi_table to force polling.
--- drivers/char/tpm/tpm_tis.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/char/tpm/tpm_tis.c +8 -0
@@ -114,6 +114,14 @@ static int tpm_tis_disable_irq(const struct dmi_system_id *d) }static const struct dmi_system_id tpm_tis_dmi_table[] = { + { + .callback = tpm_tis_disable_irq, + .ident ="Framework Laptop (12th Gen Intel Core)" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Framework" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Laptop (12th Gen Intel Core)" ), + }, + }, { .callback = tpm_tis_disable_irq, .ident ="ThinkPad T490s" ,
Signature · 1 line
2.41.0
Greg Kroah-Hartman
maintainerPATCH 128/292 tpm: tis_i2c: Limit write bursts to I2C_SMBUS_BLOCK_MAX (32) bytes
In reply to Greg Kroah-HartmanFrom: Alexander Sverdlin <[email protected]>
commit 83e7e5d89f04d1c417492940f7922bc8416a8cc4 upstream.
Underlying I2C bus drivers not always support longer transfers and imx-lpi2c for instance doesn't. The fix is symmetric to previous patch which fixed the read direction.
--- drivers/char/tpm/tpm_tis_i2c.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/char/tpm/tpm_tis_i2c.c +15 -7
@@ -230,19 +230,27 @@ static int tpm_tis_i2c_write_bytes(strucstruct i2c_msg msg = { .addr = phy->i2c_client->addr };u8 reg =tpm_tis_i2c_address_to_register (addr);int ret; +u16 wrote =0 ;if (len >TPM_BUFSIZE -1 )return -EIO ; -/* write register and data in one go */ phy->io_buf[0 ] = reg; -memcpy (phy->io_buf +sizeof (reg), value, len); - - msg.len =sizeof (reg) + len; msg.buf = phy->io_buf; - ret =tpm_tis_i2c_retry_transfer_until_ack (data, &msg); -if (ret <0 ) -return ret; +while (wrote < len) { +/* write register and data in one go */ + msg.len =sizeof (reg) + len - wrote; +if (msg.len >I2C_SMBUS_BLOCK_MAX ) + msg.len =I2C_SMBUS_BLOCK_MAX ; + +memcpy (phy->io_buf +sizeof (reg), value + wrote, + msg.len -sizeof (reg)); + + ret =tpm_tis_i2c_retry_transfer_until_ack (data, &msg); +if (ret <0 ) +return ret; + wrote += msg.len -sizeof (reg); + }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 129/292 tpm: return false from tpm_amd_is_rng_defective on non-x86 platforms
In reply to Greg Kroah-HartmanFrom: Jerry Snitselaar <[email protected]>
commit ecff6813d2bcf0c670881a9ba3f51cb032dd405a upstream.
tpm_amd_is_rng_defective is for dealing with an issue related to the AMD firmware TPM, so on non-x86 architectures just have it inline and return false.
--- drivers/char/tpm/tpm-chip.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/char/tpm/tpm-chip.c +7 -0
@@ -518,6 +518,7 @@ static int tpm_add_legacy_sysfs(struct t* 6.x.y.z series: 6.0.18.6 + * 3.x.y.z series: 3.57.y.5 + */ +#ifdef CONFIG_X86 static bool tpm_amd_is_rng_defective (struct tpm_chip *chip) {u32 val1, val2;
@@ -566,6 +567,12 @@ release: return true; } +#else +static inline bool tpm_amd_is_rng_defective (struct tpm_chip *chip) +{ +return false; +} +#endif /* CONFIG_X86 */ static int tpm_hwrng_read (struct hwrng *rng,void *data,size_t max,bool wait) {
Greg Kroah-Hartman
maintainerPATCH 130/292 tpm/tpm_tis: Disable interrupts for Framework Laptop Intel 13th gen
In reply to Greg Kroah-HartmanFrom: Christian Hesse <[email protected]>
commit bc825e851c2fe89c127cac1e0e5cf344c4940619 upstream.
This device suffer an irq storm, so add it in tpm_tis_dmi_table to force polling.
--- drivers/char/tpm/tpm_tis.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/char/tpm/tpm_tis.c +8 -0
@@ -122,6 +122,14 @@ static const struct dmi_system_id tpm_tis_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Laptop (12th Gen Intel Core)"), }, }, + { + .callback = tpm_tis_disable_irq, + .ident = "Framework Laptop (13th Gen Intel Core)", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Framework" ), + DMI_MATCH(DMI_PRODUCT_NAME, "Laptop (13th Gen Intel Core)"), + }, + }, { .callback = tpm_tis_disable_irq, .ident = "ThinkPad T490s",
Signature · 1 line
2.41.0
Greg Kroah-Hartman
maintainerPATCH 131/292 tpm,tpm_tis: Disable interrupts after 1000 unhandled IRQs
In reply to Greg Kroah-HartmanFrom: Lino Sanfilippo <[email protected]>
commit 481c2d14627de8ecbb54dd125466e4b4a5069b47 upstream.
After activation of interrupts for TPM TIS drivers 0-day reports an interrupt storm on an Inspur NF5180M6 server.
Fix this by detecting the storm and falling back to polling:
Count the number of unhandled interrupts within a 10 ms time interval. In case that more than 1000 were unhandled deactivate interrupts entirely, deregister the handler and use polling instead.
Also print a note to point to the tpm_tis_dmi_table.
Since the interrupt deregistration function devm_free_irq() waits for all interrupt handlers to finish, only trigger a worker in the interrupt handler and do the unregistration in the worker to avoid a deadlock.
Note: the storm detection logic equals the implementation in note_interrupt() which uses timestamps and counters stored in struct irq_desc. Since this structure is private to the generic interrupt core the TPM TIS core uses its own timestamps and counters. Furthermore the TPM interrupt handler always returns IRQ_HANDLED to prevent the generic interrupt core from processing the interrupt storm.
--- drivers/char/tpm/tpm_tis_core.c | 103 +++++++++++++++++++++++++++----- drivers/char/tpm/tpm_tis_core.h | 4 ++ 2 files changed, 92 insertions(+), 15 deletions(-)
drivers/char/tpm/tpm_tis_core.c +88 -15
@@ -24,9 +24,12 @@#include <linux/wait.h> #include <linux/acpi.h> #include <linux/freezer.h> +#include <linux/dmi.h> #include "tpm.h" #include "tpm_tis_core.h" +#define TPM_TIS_MAX_UNHANDLED_IRQS 1000 +static void tpm_tis_clkrun_enable (struct tpm_chip *chip,bool value); static bool wait_for_tpm_stat_cond(struct tpm_chip *chip, u8 mask,
@@ -468,25 +471,29 @@ static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len)return rc; } -static void disable_interrupts (struct tpm_chip *chip) +static void __tpm_tis_disable_interrupts (struct tpm_chip *chip) +{ +struct tpm_tis_data *priv =dev_get_drvdata (&chip->dev); +u32 int_mask =0 ; + +tpm_tis_read32 (priv,TPM_INT_ENABLE (priv->locality), &int_mask); + int_mask &= ~TPM_GLOBAL_INT_ENABLE ; +tpm_tis_write32 (priv,TPM_INT_ENABLE (priv->locality), int_mask); + + chip->flags &= ~TPM_CHIP_FLAG_IRQ ; +} + +static void tpm_tis_disable_interrupts (struct tpm_chip *chip) {struct tpm_tis_data *priv =dev_get_drvdata (&chip->dev); -u32 intmask; -int rc;if (priv->irq ==0 )return ; - rc =tpm_tis_read32 (priv,TPM_INT_ENABLE (priv->locality), &intmask); -if (rc <0 ) - intmask =0 ; - - intmask &= ~TPM_GLOBAL_INT_ENABLE ; - rc =tpm_tis_write32 (priv,TPM_INT_ENABLE (priv->locality), intmask); +__tpm_tis_disable_interrupts (chip);devm_free_irq (chip->dev.parent, priv->irq, chip); priv->irq =0 ; - chip->flags &= ~TPM_CHIP_FLAG_IRQ ; }/*
@@ -552,7 +559,7 @@ static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len)if (!test_bit (TPM_TIS_IRQ_TESTED , &priv->flags))tpm_msleep (1 );if (!test_bit (TPM_TIS_IRQ_TESTED , &priv->flags)) -disable_interrupts (chip); +tpm_tis_disable_interrupts (chip);set_bit (TPM_TIS_IRQ_TESTED , &priv->flags);return rc; }
@@ -752,6 +759,57 @@ static bool tpm_tis_req_canceled(struct tpm_chip *chip, u8 status)return status ==TPM_STS_COMMAND_READY ; } +static irqreturn_t tpm_tis_revert_interrupts (struct tpm_chip *chip) +{ +struct tpm_tis_data *priv =dev_get_drvdata (&chip->dev); +const char *product; +const char *vendor; + +dev_warn (&chip->dev,FW_BUG +"TPM interrupt storm detected, polling instead\n" ); + + vendor =dmi_get_system_info (DMI_SYS_VENDOR ); + product =dmi_get_system_info (DMI_PRODUCT_VERSION ); + +if (vendor && product) { +dev_info (&chip->dev, +"Consider adding the following entry to tpm_tis_dmi_table:\n" ); +dev_info (&chip->dev,"\tDMI_SYS_VENDOR: %s\n" , vendor); +dev_info (&chip->dev,"\tDMI_PRODUCT_VERSION: %s\n" , product); + } + +if (tpm_tis_request_locality (chip,0 ) !=0 ) +return IRQ_NONE ; + +__tpm_tis_disable_interrupts (chip); +tpm_tis_relinquish_locality (chip,0 ); + +schedule_work (&priv->free_irq_work); + +return IRQ_HANDLED ; +} + +static irqreturn_t tpm_tis_update_unhandled_irqs (struct tpm_chip *chip) +{ +struct tpm_tis_data *priv =dev_get_drvdata (&chip->dev); +irqreturn_t irqret =IRQ_HANDLED ; + +if (!(chip->flags &TPM_CHIP_FLAG_IRQ )) +return IRQ_HANDLED ; + +if (time_after (jiffies, priv->last_unhandled_irq +HZ /10 )) + priv->unhandled_irqs =1 ; +else + priv->unhandled_irqs++; + + priv->last_unhandled_irq = jiffies; + +if (priv->unhandled_irqs >TPM_TIS_MAX_UNHANDLED_IRQS ) + irqret =tpm_tis_revert_interrupts (chip); + +return irqret; +} +static irqreturn_t tis_int_handler (int dummy,void *dev_id) {struct tpm_chip *chip = dev_id;
@@ -761,10 +819,10 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id) rc =tpm_tis_read32 (priv,TPM_INT_STATUS (priv->locality), &interrupt);if (rc <0 ) -return IRQ_NONE ; + goto err;if (interrupt ==0 ) -return IRQ_NONE ; + goto err;set_bit (TPM_TIS_IRQ_TESTED , &priv->flags);if (interrupt &TPM_INTF_DATA_AVAIL_INT )
@@ -780,10 +838,13 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id) rc =tpm_tis_write32 (priv,TPM_INT_STATUS (priv->locality), interrupt);tpm_tis_relinquish_locality (chip,0 );if (rc <0 ) -return IRQ_NONE ; + goto err;tpm_tis_read32 (priv,TPM_INT_STATUS (priv->locality), &interrupt);return IRQ_HANDLED ; + +err: +return tpm_tis_update_unhandled_irqs (chip); }static void tpm_tis_gen_interrupt (struct tpm_chip *chip)
@@ -804,6 +865,15 @@ static void tpm_tis_gen_interrupt(struct tpm_chip *chip) chip->flags &= ~TPM_CHIP_FLAG_IRQ ; } +static void tpm_tis_free_irq_func (struct work_struct *work) +{ +struct tpm_tis_data *priv =container_of (work,typeof (*priv), free_irq_work); +struct tpm_chip *chip = priv->chip; + +devm_free_irq (chip->dev.parent, priv->irq, chip); + priv->irq =0 ; +} +/* Register the IRQ and issue a command that will cause an interrupt. If an * irq is seen then leave the chip setup for IRQ operation, otherwise reverse * everything and leave in polling mode. Returns 0 on success.
@@ -816,6 +886,7 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,int rc;u32 int_status; +INIT_WORK (&priv->free_irq_work, tpm_tis_free_irq_func); rc = devm_request_threaded_irq(chip->dev.parent, irq, NULL, tis_int_handler, IRQF_ONESHOT | flags,
@@ -918,6 +989,7 @@ void tpm_tis_remove(struct tpm_chip *chip) interrupt =0 ;tpm_tis_write32 (priv, reg, ~TPM_GLOBAL_INT_ENABLE & interrupt); +flush_work (&priv->free_irq_work);tpm_tis_clkrun_enable (chip, false);
@@ -1021,6 +1093,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, chip->timeout_b =msecs_to_jiffies (TIS_TIMEOUT_B_MAX ); chip->timeout_c =msecs_to_jiffies (TIS_TIMEOUT_C_MAX ); chip->timeout_d =msecs_to_jiffies (TIS_TIMEOUT_D_MAX ); + priv->chip = chip; priv->timeout_min =TPM_TIMEOUT_USECS_MIN ; priv->timeout_max =TPM_TIMEOUT_USECS_MAX ; priv->phy_ops = phy_ops;
@@ -1179,7 +1252,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, rc =tpm_tis_request_locality (chip,0 );if (rc <0 ) goto out_err; -disable_interrupts (chip); +tpm_tis_disable_interrupts (chip);tpm_tis_relinquish_locality (chip,0 ); } }
drivers/char/tpm/tpm_tis_core.h +4 -0
@@ -91,11 +91,15 @@ enum tpm_tis_flags { };struct tpm_tis_data { +struct tpm_chip *chip;u16 manufacturer_id;struct mutex locality_count_mutex;unsigned int locality_count;int locality;int irq; +struct work_struct free_irq_work; +unsigned long last_unhandled_irq; +unsigned int unhandled_irqs;unsigned int int_mask;unsigned long flags;void __iomem *ilb_base_addr;
Signature · 1 line
2.41.0
Greg Kroah-Hartman
maintainerPATCH 132/292 tpm/tpm_tis: Disable interrupts for Lenovo L590 devices
In reply to Greg Kroah-HartmanFrom: Florian Bezdeka <[email protected]>
commit 393f362389cecc2e4f2e3520a6c8ee9dbb1e3d15 upstream.
The Lenovo L590 suffers from an irq storm issue like the T490, T490s and P360 Tiny, so add an entry for it to tpm_tis_dmi_table and force polling.
--- drivers/char/tpm/tpm_tis.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/char/tpm/tpm_tis.c +8 -0
@@ -154,6 +154,14 @@ static const struct dmi_system_id tpm_tis_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L490"), }, }, + { + .callback = tpm_tis_disable_irq, + .ident = "ThinkPad L590", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L590"), + }, + }, { .callback = tpm_tis_disable_irq, .ident = "UPX-TGL",
Signature · 1 line
2.41.0
Greg Kroah-Hartman
maintainerPATCH 133/292 mtd: rawnand: meson: fix unaligned DMA buffers handling
In reply to Greg Kroah-HartmanFrom: Arseniy Krasnov <[email protected]>
commit 98480a181a08ceeede417e5b28f6d0429d8ae156 upstream.
Meson NAND controller requires 8 bytes alignment for DMA addresses, otherwise it "aligns" passed address by itself thus accessing invalid location in the provided buffer. This patch makes unaligned buffers to be reallocated to become valid.
--- drivers/mtd/nand/raw/meson_nand.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mtd/nand/raw/meson_nand.c +4 -0
@@ -76,6 +76,7 @@#define GENCMDIADDRH (aih, addr) ((aih) | (((addr) >> 16) & 0xffff))#define DMA_DIR (dir) ((dir) ? NFC_CMD_N2M : NFC_CMD_M2N) +#define DMA_ADDR_ALIGN 8#define ECC_CHECK_RETURN_FF (-1)
@@ -842,6 +843,9 @@ static int meson_nfc_read_oob(struct nanstatic bool meson_nfc_is_buffer_dma_safe (const void *buffer) { +if ((uintptr_t )buffer %DMA_ADDR_ALIGN ) +return false; +if (virt_addr_valid (buffer) && (!object_is_on_stack (buffer)))return true;return false;
Greg Kroah-Hartman
maintainerPATCH 134/292 net: bcmgenet: Ensure MDIO unregistration has clocks enabled
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
commit 1b5ea7ffb7a3bdfffb4b7f40ce0d20a3372ee405 upstream.
With support for Ethernet PHY LEDs having been added, while unregistering a MDIO bus and its child device liks PHYs there may be "late" accesses to the MDIO bus. One typical use case is setting the PHY LEDs brightness to OFF for instance.
We need to ensure that the MDIO bus controller remains entirely functional since it runs off the main GENET adapter clock.
--- drivers/net/ethernet/broadcom/genet/bcmmii.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/broadcom/genet/bcmmii.c +2 -0
@@ -673,5 +673,7 @@ void bcmgenet_mii_exit(struct net_deviceif (of_phy_is_fixed_link (dn))of_phy_deregister_fixed_link (dn);of_node_put (priv->phy_dn); +clk_prepare_enable (priv->clk);platform_device_unregister (priv->mii_pdev); +clk_disable_unprepare (priv->clk); }
Greg Kroah-Hartman
maintainerPATCH 135/292 net: phy: dp83td510: fix kernel stall during netboot in DP83TD510E PHY driver
In reply to Greg Kroah-HartmanFrom: Oleksij Rempel <[email protected]>
commit fc0649395dca81f2b3b02d9b248acb38cbcee55c upstream.
Fix an issue where the kernel would stall during netboot, showing the "sched: RT throttling activated" message. This stall was triggered by the behavior of the mii_interrupt bit (Bit 7 - DP83TD510E_STS_MII_INT) in the DP83TD510E's PHY_STS Register (Address = 0x10). The DP83TD510E datasheet (2020) states that the bit clears on write, however, in practice, the bit clears on read.
This discrepancy had significant implications on the driver's interrupt handling. The PHY_STS Register was used by handle_interrupt() to check for pending interrupts and by read_status() to get the current link status. The call to read_status() was unintentionally clearing the mii_interrupt status bit without deasserting the IRQ pin, causing handle_interrupt() to miss other pending interrupts. This issue was most apparent during netboot.
The fix refrains from using the PHY_STS Register for interrupt handling. Instead, we now solely rely on the INTERRUPT_REG_1 Register (Address = 0x12) and INTERRUPT_REG_2 Register (Address = 0x13) for this purpose. These registers directly influence the IRQ pin state and are latched high until read.
Note: The INTERRUPT_REG_2 Register (Address = 0x13) exists and can also be used for interrupt handling, specifically for "Aneg page received interrupt" and "Polarity change interrupt". However, these features are currently not supported by this driver.
--- drivers/net/phy/dp83td510.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)
drivers/net/phy/dp83td510.c +5 -18
@@ -12,6 +12,11 @@/* MDIO_MMD_VEND2 registers */ #define DP83TD510E_PHY_STS 0x10 +/* Bit 7 - mii_interrupt, active high. Clears on read. +* Note: Clearing does not necessarily deactivate IRQ pin if interrupts pending. +* This differs from the DP83TD510E datasheet (2020) which states this bit +* clears on write 0. +*/ #define DP83TD510E_STS_MII_INT BIT(7)#define DP83TD510E_LINK_STATUS BIT(0)
@@ -53,12 +58,6 @@ static int dp83td510_config_intr(structint ret;if (phydev->interrupts ==PHY_INTERRUPT_ENABLED ) { -/* Clear any pending interrupts */ - ret =phy_write_mmd (phydev,MDIO_MMD_VEND2 ,DP83TD510E_PHY_STS , -0x0 ); -if (ret) -return ret; - ret =phy_write_mmd (phydev,MDIO_MMD_VEND2 ,DP83TD510E_INTERRUPT_REG_1 ,DP83TD510E_INT1_LINK_EN );
@@ -81,10 +80,6 @@ static int dp83td510_config_intr(struct DP83TD510E_GENCFG_INT_EN);if (ret)return ret; - -/* Clear any pending interrupts */ - ret =phy_write_mmd (phydev,MDIO_MMD_VEND2 ,DP83TD510E_PHY_STS , -0x0 ); }return ret;
@@ -94,14 +89,6 @@ static irqreturn_t dp83td510_handle_inte {int ret; - ret =phy_read_mmd (phydev,MDIO_MMD_VEND2 ,DP83TD510E_PHY_STS ); -if (ret <0 ) { -phy_error (phydev); -return IRQ_NONE ; - }else if (!(ret &DP83TD510E_STS_MII_INT )) { -return IRQ_NONE ; - } -/* Read the current enabled interrupts */ ret =phy_read_mmd (phydev,MDIO_MMD_VEND2 ,DP83TD510E_INTERRUPT_REG_1 );if (ret <0 ) {
Greg Kroah-Hartman
maintainerPATCH 136/292 kasan: add kasan_tag_mismatch prototype
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit fb646a4cd3f0ff27d19911bef7b6622263723df6 upstream.
The kasan sw-tags implementation contains one function that is only called from assembler and has no prototype in a header. This causes a W=1 warning:
mm/kasan/sw_tags.c:171:6: warning: no previous prototype for 'kasan_tag_mismatch' [-Wmissing-prototypes]
171 | void kasan_tag_mismatch(unsigned long addr, unsigned long access_info,
Add a prototype in the local header to get a clean build.
--- mm/kasan/kasan.h | 3 +++ 1 file changed, 3 insertions(+)
mm/kasan/kasan.h +3 -0
@@ -646,4 +646,7 @@ void *__hwasan_memset(void *addr, int c,void *__hwasan_memmove (void *dest,const void *src,size_t len);void *__hwasan_memcpy (void *dest,const void *src,size_t len); +void kasan_tag_mismatch (unsigned long addr,unsigned long access_info, +unsigned long ret_ip); +#endif /* __MM_KASAN_KASAN_H */