5.7.7-rc1 review
Subsystems (3)
Sasha Levin
maintainercover 5.7.7-rc1 review
This is the start of the stable review cycle for the 5.7.7 release. There are 265 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed 01 Jul 2020 03:14:48 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.7.y&id2=v5.7.6
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.7.y
and the diffstat can be found below.
--
Thanks,
Sasha
-------------------------
Pseudo-Shortlog of commits:
Aaron Plattner (1):
ALSA: hda: Add NVIDIA codec IDs 9a & 9d through a0 to patch table
Adam Ford (1):
drm/panel-simple: fix connector type for LogicPD Type28 Display
Aditya Pakki (3):
rocker: fix incorrect error handling in dma_rings_init RDMA/rvt: Fix potential memory leak caused by rvt_alloc_rq
test_objagg: Fix potential memory leak in error handling
Al Cooper (1):
xhci: Fix enumeration issue when setting max packet size for FS
devices.
Al Viro (1):
fix a braino in "sparc32: fix register window handling in
genregs32_[gs]et()"
Alexander Lobakin (10):
net: ethtool: add missing string for NETIF_F_GSO_TUNNEL_REMCSUM
net: ethtool: add missing NETIF_F_GSO_FRAGLIST feature string
net: qed: fix left elements count calculation
net: qed: fix async event callbacks unregistering
net: qede: stop adding events on an already destroyed workqueue
net: qed: fix NVMe login fails over VFs
net: qed: fix excessive QM ILT lines consumption
net: qede: fix PTP initialization on recovery
net: qede: fix use-after-free on recovery and AER handling
net: qed: reset ILT block sizes before recomputing to fix crashes
Alexander Usyskin (1):
mei: me: add tiger lake point device ids for H platforms.
Anand Moon (1):
Revert "usb: dwc3: exynos: Add support for Exynos5422 suspend clk"
Anson Huang (1):
soc: imx8m: Correct i.MX8MP UID fuse offset
Anton Eidelman (2):
nvme-multipath: fix deadlock between ana_work and scan_work
nvme-multipath: fix deadlock due to head->lock
Ard Biesheuvel (1):
net: phy: mscc: avoid skcipher API for single block AES encryption
Arseny Solokha (1):
powerpc/fsl_booke/32: Fix build with CONFIG_RANDOMIZE_BASE
Arvind Sankar (1):
efi/x86: Setup stack correctly for efi_pe_entry
Babu Moger (1):
x86/resctrl: Fix memory bandwidth counter width for AMD
Ben Widawsky (1):
mm/memory_hotplug.c: fix false softlockup during pfn range removal
Bernard Zhao (1):
drm/amd: fix potential memleak in err branch
Borislav Petkov (1):
EDAC/amd64: Read back the scrub rate PCI register on F15h
Chaitanya Kulkarni (1):
nvmet: fail outstanding host posted AEN req
Charles Keepax (1):
regmap: Fix memory leak from regmap_register_patch
Christoffer Nielsen (1):
ALSA: usb-audio: Add registration quirk for Kingston HyperX Cloud
Flight S
Christopher Swenson (1):
ALSA: usb-audio: Set 48 kHz rate for Rodecaster
Chuck Lever (2):
SUNRPC: Properly set the @subbuf parameter of xdr_buf_subsegment()
xprtrdma: Fix handling of RDMA_ERROR replies
Chuhong Yuan (1):
USB: ohci-sm501: Add missed iounmap() in remove
Claudiu Beznea (3):
net: macb: undo operations in case of failure
net: macb: call pm_runtime_put_sync on failure path
net: macb: free resources on failure path of at91ether_open()
Claudiu Manoil (1):
enetc: Fix tx rings bitmap iteration range, irq handling
Colin Ian King (1):
qed: add missing error test for DBG_STATUS_NO_MATCHING_FRAMING_MODE
Cong Wang (1):
genetlink: clean up family attributes allocations
Dan Carpenter (3):
x86/resctrl: Fix a NULL vs IS_ERR() static checker warning in
rdt_cdp_peer_get()
usb: gadget: udc: Potential Oops in error handling code
Staging: rtl8723bs: prevent buffer overflow in
update_sta_support_rate()
Daniel Gomez (1):
drm: rcar-du: Fix build error
Daniel Vetter (1):
drm/fb-helper: Fix vt restore
Dave Martin (1):
arm64/sve: Eliminate data races on sve_default_vl
David Christensen (1):
tg3: driver sleeps indefinitely when EEH errors exceed eeh_max_freezes
David Howells (3):
rxrpc: Fix notification call on completion of discarded calls
rxrpc: Fix handling of rwind from an ACK packet
afs: Fix storage of cell names
David Milburn (1):
nvmet: cleanups the loop in nvmet_async_events_process
David Rientjes (3):
dma-direct: re-encrypt memory if dma_direct_alloc_pages() fails
dma-direct: check return value when encrypting or decrypting memory
dma-direct: add missing set_memory_decrypted() for coherent mapping
Dejin Zheng (1):
net: phy: smsc: fix printing too many logs
Denis Efremov (2):
drm/amd/display: Use kfree() to free rgb_user in
calculate_user_regamma_ramp()
drm/radeon: fix fb_div check in ni_init_smc_spll_table()
Denis Kirjanov (1):
tcp: don't ignore ECN CWR on pure ACK
Dennis Dalessandro (1):
IB/hfi1: Fix module use count flaw due to leftover module put calls
Dinghao Liu (1):
hwrng: ks-sa - Fix runtime PM imbalance on error
Dmitry Baryshkov (1):
pinctrl: qcom: spmi-gpio: fix warning about irq chip reusage
Doug Berger (1):
net: bcmgenet: use hardware padding of runt frames
Drew Fustini (1):
ARM: dts: am335x-pocketbeagle: Fix mmc0 Write Protect
Eddie James (1):
i2c: fsi: Fix the port number field in status register
Eric Dumazet (2):
net: increment xmit_recursion level in dev_direct_xmit()
tcp: grow window for OOO packets only for SACK flows
Fabian Vogt (1):
efi/tpm: Verify event log header before parsing
Fan Guo (1):
RDMA/mad: Fix possible memory leak in ib_mad_post_receive_mads()
Filipe Manana (7):
btrfs: fix a block group ref counter leak after failure to remove
block group
btrfs: fix bytes_may_use underflow when running balance and scrub in
parallel
btrfs: fix data block group relocation failure due to concurrent scrub
btrfs: check if a log root exists before locking the log_mutex on
unlink
btrfs: fix hang on snapshot creation after RWF_NOWAIT write
btrfs: fix failure of RWF_NOWAIT write into prealloc extent beyond eof
btrfs: fix RWF_NOWAIT write not failling when we need to cow
Florian Fainelli (3):
net: phy: Check harder for errors in get_phy_id()
of: of_mdio: Correct loop scanning logic
net: dsa: bcm_sf2: Fix node reference count
Frieder Schrempf (2):
ARM: dts: imx6ul-kontron: Move watchdog from Kontron i.MX6UL/ULL board
to SoM
ARM: dts: imx6ul-kontron: Change WDOG_ANY signal from push-pull to
open-drain
Gal Pressman (1):
RDMA/efa: Set maximum pkeys device attribute
Gao Xiang (1):
erofs: fix partially uninitialized misuse in z_erofs_onlinepage_fixup
Gaurav Singh (2):
ethtool: Fix check in ethtool_rx_flow_rule_create bpf, xdp, samples: Fix null pointer dereference in *_user code
Geliang Tang (1):
mptcp: drop sndr_key in mptcp_syn_options
Harish (1):
selftests/powerpc: Fix build failure in ebb tests
Heikki Krogerus (1):
usb: typec: mux: intel_pmc_mux: Fix DP alternate mode entry
Heiner Kallweit (1):
r8169: fix firmware not resetting tp->ocp_base
Huaisheng Ye (1):
dm writecache: correct uncommitted_block when discarding uncommitted
entry
Huy Nguyen (1):
xfrm: Fix double ESP trailer insertion in IPsec crypto offload.
Ido Schimmel (1):
mlxsw: spectrum: Do not rely on machine endianness
Igor Mammedov (1):
kvm: lapic: fix broken vcpu hotplug
Ilya Ponetayev (1):
sch_cake: don't try to reallocate or unshare skb unconditionally
Jason A. Donenfeld (5):
wireguard: device: avoid circular netns references
wireguard: receive: account for napi_gro_receive never returning
GRO_DROP
socionext: account for napi_gro_receive never returning GRO_DROP
wil6210: account for napi_gro_receive never returning GRO_DROP
ACPI: configfs: Disallow loading ACPI tables when locked down
Jeremy Kerr (1):
net: usb: ax88179_178a: fix packet alignment padding
Jiping Ma (1):
arm64: perf: Report the PC value in REGS_ABI_32 mode
Jiri Slaby (1):
syscalls: Fix offset type of ksys_ftruncate()
Joakim Tjernlund (1):
cdc-acm: Add DISABLE_ECHO quirk for Microchip/SMSC chip
Johannes Weiner (1):
mm: memcontrol: handle div0 crash race condition in memory.low
John van der Kamp (1):
drm/amdgpu/display: Unlock mutex on error
Julian Wiedmann (1):
s390/qeth: fix error handling for isolation mode cmds
Junxiao Bi (4):
ocfs2: avoid inode removal while nfsd is accessing it
ocfs2: load global_inode_alloc
ocfs2: fix value of OCFS2_INVALID_SLOT
ocfs2: fix panic on nfs server over ocfs2
Juri Lelli (2):
sched/deadline: Initialize ->dl_boosted sched/core: Fix PI boosting between RT and DEADLINE tasks
Kai-Heng Feng (3):
xhci: Poll for U0 after disabling USB2 LPM
xhci: Return if xHCI doesn't support LPM
ALSA: hda/realtek: Add mute LED and micmute LED support for HP systems
Kees Cook (1):
x86/cpu: Use pinning mask for CR4 bits needing to be 0
Keith Busch (1):
nvme-multipath: set bdi capabilities once
Krzysztof Kozlowski (1):
spi: spi-fsl-dspi: Free DMA memory with matching function
Laurence Tratt (1):
ALSA: usb-audio: Add implicit feedback quirk for SSL2+.
Leon Romanovsky (1):
RDMA/core: Check that type_attrs is not NULL prior access
Li Jun (1):
usb: typec: tcpci_rt1711h: avoid screaming irq causing boot hangs
Longfang Liu (1):
USB: ehci: reopen solution for Synopsys HC bug
Lorenzo Bianconi (2):
openvswitch: take into account de-fragmentation/gso_size in
execute_check_pkt_len
samples/bpf: xdp_redirect_cpu: Set MAX_CPUS according to NR_CPUS
Lu Baolu (3):
iommu/vt-d: Set U/S bit in first level page table by default iommu/vt-d: Enable PCI ACS for platform opt in hint iommu/vt-d: Update scalable mode paging structure coherency
Luis Chamberlain (1):
blktrace: break out of blktrace setup on concurrent calls
Macpaul Lin (2):
usb: host: xhci-mtk: avoid runtime suspend when removing hcd
ALSA: usb-audio: add quirk for Samsung USBC Headset (AKG)
Mans Rullgard (1):
i2c: core: check returned size of emulated smbus block read
Marcelo Ricardo Leitner (1):
sctp: Don't advertise IPv4 addresses if ipv6only is set on the socket
Mark Zhang (1):
RDMA/cma: Protect bind_list and listen_list while finding matching cm
id
Martin (1):
bareudp: Fixed multiproto mode configuration
Martin Fuzzey (1):
regulator: da9063: fix LDO9 suspend and warning.
Masahiro Yamada (1):
kbuild: improve cc-option to clean up all temporary files
Masami Hiramatsu (2):
kprobes: Suppress the suspicious RCU warning on kprobes
tracing: Fix event trigger to accept redundant spaces
Mathias Nyman (1):
xhci: Fix incorrect EP_STATE_MASK
Matt Fleming (1):
x86/asm/64: Align start of __clear_user() loop to 16-bytes
Matthew Hagan (3):
ARM: bcm: Select ARM_TIMER_SP804 for ARCH_BCM_NSP
ARM: dts: NSP: Disable PL330 by default, add dma-coherent property
ARM: dts: NSP: Correct FA2 mailbox node
Mauricio Faria de Oliveira (1):
bcache: check and adjust logical block size for backing devices
Michael Chan (3):
bnxt_en: Store the running firmware version code.
bnxt_en: Do not enable legacy TX push on older firmware.
bnxt_en: Fix statistics counters issue during ifdown with older
firmware.
Michal Kalderon (1):
RDMA/qedr: Fix KASAN: use-after-free in ucma_event_handler+0x532
Mikulas Patocka (1):
dm writecache: add cond_resched to loop in persistent_memory_claim()
Minas Harutyunyan (1):
usb: dwc2: Postponed gadget registration to the udc class driver
Muchun Song (1):
mm/memcontrol.c: add missed css_put()
Nathan Chancellor (2):
s390/vdso: Use $(LD) instead of $(CC) to link vDSO
ACPI: sysfs: Fix pm_profile_attr type
Nathan Huckleberry (1):
riscv/atomic: Fix sign extension for RV64I
Navid Emamdoost (1):
sata_rcar: handle pm_runtime_get_sync failure cases
Neal Cardwell (2):
tcp_cubic: fix spurious HYSTART_DELAY exit upon drop in min RTT
bpf: tcp: bpf_cubic: fix spurious HYSTART_DELAY exit upon drop in min
RTT
Olga Kornievskaia (1):
NFSv4 fix CLOSE not waiting for direct IO compeletion
Oskar Holmlund (2):
ARM: dts: Fix am33xx.dtsi USB ranges length
ARM: dts: Fix am33xx.dtsi ti,sysc-mask wrong softreset flag
Pavel Begunkov (1):
io_uring: fix hanging iopoll in case of -EAGAIN
Peter Chen (3):
usb: cdns3: trace: using correct dir value
usb: cdns3: ep0: fix the test mode set incorrectly
usb: cdns3: ep0: add spinlock for cdns3_check_new_setup
Philipp Fent (1):
efi/libstub: Fix path separator regression
Pierre-Louis Bossart (1):
ASoC: soc-pcm: fix checks for multi-cpu FE dailinks
Qiushi Wu (2):
efi/esrt: Fix reference count leak in esre_create_sysfs_entry.
ASoC: rockchip: Fix a reference count leak.
Rafał Miłecki (1):
ARM: dts: BCM5301X: Add missing memory "device_type" for Luxul
XWC-2000
Rahul Lakkireddy (2):
cxgb4: move handling L2T ARP failures to caller
cxgb4: move PTP lock and unlock to caller in Tx path
Reinette Chatre (2):
x86/cpu: Move resctrl CPUID code to resctrl/ x86/resctrl: Support CPUID enumeration of MBM counter width
Robin Gong (3):
regualtor: pfuze100: correct sw1a/sw2 on pfuze3000
arm64: dts: imx8mm-evk: correct ldo1/ldo2 voltage range
arm64: dts: imx8mn-ddr4-evk: correct ldo1/ldo2 voltage range
Roman Bolshakov (1):
scsi: qla2xxx: Keep initiator ports after RSCN
Russell King (3):
net: phylink: fix ethtool -A with attached PHYs
net: phylink: ensure manual pause mode configuration takes effect
netfilter: ipset: fix unaligned atomic access
Sabrina Dubroca (1):
geneve: allow changing DF behavior after creation
Sagi Grimberg (2):
nvme: fix possible deadlock when I/O is blocked
nvme: don't protect ns mutation with ns->head->lock
Sami Tolvanen (1):
recordmcount: support >64k sections
Sascha Ortmann (1):
tracing/boottime: Fix kprobe multiple events
Sasha Levin (1):
Linux 5.7.7-rc1
Sean Christopherson (3):
KVM: nVMX: Plumb L2 GPA through to PML emulation
KVM: VMX: Stop context switching MSR_IA32_UMWAIT_CONTROL x86/cpu: Reinitialize IA32_FEAT_CTL MSR on BSP during wakeup
SeongJae Park (1):
scsi: lpfc: Avoid another null dereference in lpfc_sli4_hba_unset()
Shannon Nelson (2):
ionic: update the queue count on open
ionic: tame the watchdog timer on reconfig
Shay Drory (1):
IB/mad: Fix use after free when destroying MAD agent
Shengjiu Wang (1):
ASoC: fsl_ssi: Fix bclk calculation for mono channel
Srinivas Kandagatla (3):
ASoC: q6asm: handle EOS correctly
ASoc: q6afe: add support to get port direction
ASoC: qcom: common: set correct directions for dailinks
Stanislav Fomichev (1):
bpf: Don't return EINVAL from {get,set}sockopt when optlen > PAGE_SIZE
Steffen Maier (1):
scsi: zfcp: Fix panic on ERP timeout for previously dismissed ERP
action
Steven Rostedt (VMware) (1):
ring-buffer: Zero out time extend if it is nested and not absolute
Stylon Wang (1):
drm/amd/display: Enable output_bpc property on all outputs
Sven Auhagen (1):
mvpp2: ethtool rxtx stats fix
Sven Schnelle (4):
s390/seccomp: pass syscall arguments via seccomp_data s390/ptrace: return -ENOSYS when invalid syscall is supplied s390/ptrace: pass invalid syscall numbers to tracing s390/ptrace: fix setting syscall number
Taehee Yoo (3):
net: core: reduce recursion limit value
ip6_gre: fix use-after-free in ip6gre_tunnel_lookup()
ip_tunnel: fix use-after-free in ip_tunnel_lookup()
Takashi Iwai (3):
ALSA: usb-audio: Fix potential use-after-free of streams
ALSA: usb-audio: Fix OOB access of mixer element list
ALSA: hda/realtek - Add quirk for MSI GE63 laptop
Tang Bin (1):
usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()
Tariq Toukan (1):
net: Do not clear the sock TX queue in sk_set_socket()
Thierry Reding (1):
Revert "i2c: tegra: Fix suspending in active runtime PM state"
Thomas Falcon (2):
ibmveth: Fix max MTU limit
ibmvnic: Harden device login requests
Thomas Martitz (1):
net: bridge: enfore alignment for ethernet address
Todd Kjos (1):
binder: fix null deref of proc->context
Toke Høiland-Jørgensen (3):
sch_cake: don't call diffserv parsing code when it is not needed
sch_cake: fix a few style nits
devmap: Use bpf_map_area_alloc() for allocating hash buckets
Tom Seewald (1):
RDMA/siw: Fix pointer-to-int-cast warning in siw_rx_pbl()
Tomas Winkler (1):
mei: me: disable mei interface on Mehlow server platforms
Tomasz Meresiński (1):
usb: add USB_QUIRK_DELAY_INIT for Logitech C922
Tomi Valkeinen (1):
drm/panel-simple: fix connector type for newhaven_nhd_43_480272ef_atxl
Tony Lindgren (6):
bus: ti-sysc: Flush posted write on enable and disable
bus: ti-sysc: Use optional clocks on for enable and wait for softreset
bit
bus: ti-sysc: Ignore clockactivity unless specified as a quirk
bus: ti-sysc: Fix uninitialized framedonetv_irq
ARM: OMAP2+: Fix legacy mode dss_reset
ARM: dts: Fix duovero smsc interrupt for suspend
Trond Myklebust (1):
pNFS/flexfiles: Fix list corruption if the mirror count changes
Vasily Averin (1):
sunrpc: fixed rollback in rpc_gssd_dummy_populate()
Vasundhara Volam (1):
bnxt_en: Read VPD info only for PFs
Vidya Sagar (1):
pinctrl: tegra: Use noirq suspend/resume callbacks
Vincent Chen (1):
clk: sifive: allocate sufficient memory for struct __prci_data
Vincent Guittot (1):
sched/cfs: change initial value of runnable_avg
Vincenzo Frascino (1):
s390/vdso: fix vDSO clock_getres()
Vishal Verma (1):
nvdimm/region: always show the 'align' attribute
Vitaly Kuznetsov (1):
Revert "KVM: VMX: Micro-optimize vmexit time when not exposing PMU"
Vlastimil Babka (1):
mm, compaction: make capture control handling safe wrt interrupts
Waiman Long (2):
mm, slab: fix sign conversion problem in memcg_uncharge_slab() mm/slab: use memzero_explicit() in kzfree()
Wang Hai (1):
mld: fix memory leak in ipv6_mc_destroy_dev()
Wei Yongjun (1):
mptcp: fix memory leak in mptcp_subflow_create_socket()
Weiping Zhang (1):
block: update hctx map when use multiple maps
Wenhui Sheng (1):
drm/amdgpu: add fw release for sdma v5_0
Will Deacon (1):
arm64: sve: Fix build failure when ARM64_SVE=y and SYSCTL=n
Willem de Bruijn (1):
selftests/net: report etf errors correctly
Xiaoyao Li (1):
KVM: X86: Fix MSR range of APIC registers in X2APIC mode
Xiyu Yang (1):
cifs: Fix cached_fid refcnt leak in open_shroot
Yang Yingliang (1):
net: fix memleak in register_netdevice()
Yash Shah (1):
RISC-V: Don't allow write+exec only page mapping request in mmap
Ye Bin (1):
ata/libata: Fix usage of page address by page_address in
ata_scsi_mode_select_xlat function
Yick W. Tse (1):
ALSA: usb-audio: add quirk for Denon DCD-1500RE
Yoshihiro Shimoda (1):
usb: renesas_usbhs: getting residue from callback_result
Zekun Shen (1):
net: alx: fix race condition in alx_remove
Zhang Xiaoxu (2):
cifs/smb3: Fix data inconsistent when punch hole cifs/smb3: Fix data inconsistent when zero file range
Zheng Bin (1):
loop: replace kill_bdev with invalidate_bdev
guodeqing (1):
net: Fix the arp error in some cases
yu kuai (2):
block/bio-integrity: don't free 'buf' if bio_integrity_add_page()
failed
ARM: imx5: add missing put_device() call in imx_suspend_alloc_ocram()
Makefile | 4 +- arch/arm/boot/dts/am335x-pocketbeagle.dts | 1 - arch/arm/boot/dts/am33xx.dtsi | 4 +- arch/arm/boot/dts/bcm-nsp.dtsi | 10 +- arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts | 1 + arch/arm/boot/dts/bcm958522er.dts | 4 + arch/arm/boot/dts/bcm958525er.dts | 4 + arch/arm/boot/dts/bcm958525xmc.dts | 4 + arch/arm/boot/dts/bcm958622hr.dts | 4 + arch/arm/boot/dts/bcm958623hr.dts | 4 + arch/arm/boot/dts/bcm958625hr.dts | 4 + arch/arm/boot/dts/bcm958625k.dts | 4 + arch/arm/boot/dts/imx6ul-kontron-n6x1x-s.dtsi | 13 -- .../dts/imx6ul-kontron-n6x1x-som-common.dtsi | 13 ++ arch/arm/boot/dts/omap4-duovero-parlor.dts | 2 +- arch/arm/mach-bcm/Kconfig | 1 + arch/arm/mach-imx/pm-imx5.c | 6 +- arch/arm/mach-omap2/omap_hwmod.c | 2 +- arch/arm64/boot/dts/freescale/imx8mm-evk.dts | 4 +- .../boot/dts/freescale/imx8mn-ddr4-evk.dts | 4 +- arch/arm64/kernel/fpsimd.c | 31 +++-- arch/arm64/kernel/perf_regs.c | 25 +++- arch/powerpc/mm/nohash/kaslr_booke.c | 1 + arch/riscv/include/asm/cmpxchg.h | 8 +- arch/riscv/kernel/sys_riscv.c | 6 + arch/s390/include/asm/vdso.h | 1 + arch/s390/kernel/asm-offsets.c | 2 +- arch/s390/kernel/entry.S | 2 +- arch/s390/kernel/ptrace.c | 83 ++++++++++-- arch/s390/kernel/time.c | 1 + arch/s390/kernel/vdso64/Makefile | 10 +- arch/s390/kernel/vdso64/clock_getres.S | 10 +- arch/sparc/kernel/ptrace_32.c | 9 +- arch/x86/boot/compressed/head_64.S | 11 +- arch/x86/include/asm/cpu.h | 5 + arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/include/asm/mwait.h | 2 - arch/x86/include/asm/processor.h | 3 +- arch/x86/include/asm/resctrl_sched.h | 3 + arch/x86/kernel/cpu/centaur.c | 1 + arch/x86/kernel/cpu/common.c | 51 ++----- arch/x86/kernel/cpu/cpu.h | 4 - arch/x86/kernel/cpu/resctrl/core.c | 29 ++++ arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 1 + arch/x86/kernel/cpu/umwait.c | 6 - arch/x86/kernel/cpu/zhaoxin.c | 1 + arch/x86/kvm/lapic.c | 1 + arch/x86/kvm/mmu.h | 2 +- arch/x86/kvm/mmu/mmu.c | 4 +- arch/x86/kvm/mmu/paging_tmpl.h | 7 +- arch/x86/kvm/vmx/vmx.c | 27 +--- arch/x86/kvm/x86.c | 4 +- arch/x86/lib/usercopy_64.c | 1 + arch/x86/power/cpu.c | 6 + block/bio-integrity.c | 1 - block/blk-mq.c | 4 +- drivers/acpi/acpi_configfs.c | 6 +- drivers/acpi/sysfs.c | 4 +- drivers/android/binder.c | 14 +- drivers/ata/libata-scsi.c | 9 +- drivers/ata/sata_rcar.c | 11 +- drivers/base/regmap/regmap.c | 1 + drivers/block/loop.c | 8 +- drivers/bus/ti-sysc.c | 98 ++++++++++---- drivers/char/hw_random/ks-sa-rng.c | 1 + drivers/clk/sifive/fu540-prci.c | 5 +- drivers/edac/amd64_edac.c | 2 + drivers/firmware/efi/esrt.c | 2 +- drivers/firmware/efi/libstub/file.c | 16 ++- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 6 +- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 1 + .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 4 +- .../amd/display/amdgpu_dm/amdgpu_dm_hdcp.c | 6 +- .../amd/display/modules/color/color_gamma.c | 2 +- drivers/gpu/drm/drm_fb_helper.c | 63 +++++++-- drivers/gpu/drm/panel/panel-simple.c | 2 + drivers/gpu/drm/radeon/ni_dpm.c | 2 +- drivers/gpu/drm/rcar-du/Kconfig | 1 + drivers/i2c/busses/i2c-fsi.c | 2 +- drivers/i2c/busses/i2c-tegra.c | 9 -- drivers/i2c/i2c-core-smbus.c | 7 + drivers/infiniband/core/cma.c | 18 +++ drivers/infiniband/core/mad.c | 3 +- drivers/infiniband/core/rdma_core.c | 36 +++-- drivers/infiniband/hw/efa/efa_verbs.c | 1 + drivers/infiniband/hw/hfi1/debugfs.c | 19 +-- drivers/infiniband/hw/qedr/qedr_iw_cm.c | 13 +- drivers/infiniband/sw/rdmavt/qp.c | 6 +- drivers/infiniband/sw/siw/siw_qp_rx.c | 3 +- drivers/iommu/dmar.c | 3 +- drivers/iommu/intel-iommu.c | 18 ++- drivers/md/bcache/super.c | 22 ++- drivers/md/dm-writecache.c | 4 + drivers/misc/mei/hw-me-regs.h | 3 + drivers/misc/mei/hw-me.c | 70 +++++++++- drivers/misc/mei/hw-me.h | 17 ++- drivers/misc/mei/pci-me.c | 17 +-- drivers/net/bareudp.c | 3 + drivers/net/dsa/bcm_sf2.c | 2 + drivers/net/ethernet/atheros/alx/main.c | 9 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 36 ++++- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 5 + .../net/ethernet/broadcom/genet/bcmgenet.c | 8 +- drivers/net/ethernet/broadcom/tg3.c | 4 +- drivers/net/ethernet/cadence/macb_main.c | 128 +++++++++++------- drivers/net/ethernet/chelsio/cxgb4/l2t.c | 52 ++++--- drivers/net/ethernet/chelsio/cxgb4/sge.c | 23 ++-- drivers/net/ethernet/freescale/enetc/enetc.c | 4 +- drivers/net/ethernet/ibm/ibmveth.c | 2 +- drivers/net/ethernet/ibm/ibmvnic.c | 21 ++- .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 4 +- .../net/ethernet/mellanox/mlxsw/spectrum.c | 4 +- .../net/ethernet/mellanox/mlxsw/spectrum.h | 8 +- .../mellanox/mlxsw/spectrum_buffers.c | 2 +- .../ethernet/mellanox/mlxsw/spectrum_span.c | 2 +- .../net/ethernet/pensando/ionic/ionic_lif.c | 21 ++- drivers/net/ethernet/qlogic/qed/qed_cxt.c | 21 ++- drivers/net/ethernet/qlogic/qed/qed_debug.c | 3 +- drivers/net/ethernet/qlogic/qed/qed_dev.c | 9 +- drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 2 - drivers/net/ethernet/qlogic/qed/qed_roce.c | 1 - drivers/net/ethernet/qlogic/qed/qed_vf.c | 23 +++- drivers/net/ethernet/qlogic/qede/qede_main.c | 3 +- drivers/net/ethernet/qlogic/qede/qede_ptp.c | 31 ++--- drivers/net/ethernet/qlogic/qede/qede_ptp.h | 2 +- drivers/net/ethernet/qlogic/qede/qede_rdma.c | 3 +- drivers/net/ethernet/realtek/r8169_main.c | 5 +- drivers/net/ethernet/rocker/rocker_main.c | 4 +- drivers/net/ethernet/socionext/netsec.c | 5 +- drivers/net/geneve.c | 1 + drivers/net/phy/Kconfig | 3 +- drivers/net/phy/mscc/mscc_macsec.c | 40 ++---- drivers/net/phy/phy_device.c | 6 +- drivers/net/phy/phylink.c | 45 ++++-- drivers/net/phy/smsc.c | 11 +- drivers/net/usb/ax88179_178a.c | 11 +- drivers/net/wireguard/device.c | 58 ++++---- drivers/net/wireguard/device.h | 3 +- drivers/net/wireguard/netlink.c | 14 +- drivers/net/wireguard/receive.c | 10 +- drivers/net/wireguard/socket.c | 25 +++- drivers/net/wireless/ath/wil6210/txrx.c | 39 ++---- drivers/nvdimm/region_devs.c | 14 +- drivers/nvme/host/core.c | 8 -- drivers/nvme/host/multipath.c | 46 ++++--- drivers/nvme/host/nvme.h | 2 + drivers/nvme/target/core.c | 40 ++++-- drivers/of/of_mdio.c | 9 +- drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 21 ++- drivers/pinctrl/tegra/pinctrl-tegra.c | 4 +- drivers/regulator/da9063-regulator.c | 1 - drivers/regulator/pfuze100-regulator.c | 60 +++++--- drivers/s390/net/qeth_core_main.c | 5 +- drivers/s390/scsi/zfcp_erp.c | 13 +- drivers/scsi/lpfc/lpfc_init.c | 3 +- drivers/scsi/qla2xxx/qla_gs.c | 4 +- drivers/soc/imx/soc-imx8m.c | 8 +- drivers/spi/spi-fsl-dspi.c | 8 +- .../staging/rtl8723bs/core/rtw_wlan_util.c | 4 +- drivers/usb/cdns3/ep0.c | 10 +- drivers/usb/cdns3/trace.h | 2 +- drivers/usb/class/cdc-acm.c | 2 + drivers/usb/core/quirks.c | 3 +- drivers/usb/dwc2/gadget.c | 6 - drivers/usb/dwc2/platform.c | 11 ++ drivers/usb/dwc3/dwc3-exynos.c | 9 -- drivers/usb/gadget/udc/mv_udc_core.c | 3 +- drivers/usb/host/ehci-exynos.c | 5 +- drivers/usb/host/ehci-pci.c | 7 + drivers/usb/host/ohci-sm501.c | 1 + drivers/usb/host/xhci-mtk.c | 5 +- drivers/usb/host/xhci.c | 9 +- drivers/usb/host/xhci.h | 2 +- drivers/usb/renesas_usbhs/fifo.c | 23 ++-- drivers/usb/renesas_usbhs/fifo.h | 2 +- drivers/usb/typec/mux/intel_pmc_mux.c | 13 +- drivers/usb/typec/tcpm/tcpci_rt1711h.c | 31 ++--- drivers/video/fbdev/core/fbcon.c | 3 +- fs/afs/cell.c | 9 ++ fs/afs/internal.h | 2 +- fs/btrfs/block-group.c | 19 ++- fs/btrfs/ctree.h | 2 + fs/btrfs/file.c | 15 +- fs/btrfs/inode.c | 39 ++++-- fs/btrfs/tree-log.c | 5 + fs/cifs/smb2ops.c | 12 ++ fs/erofs/zdata.h | 20 +-- fs/io_uring.c | 9 +- fs/nfs/direct.c | 13 +- fs/nfs/file.c | 1 + fs/nfs/flexfilelayout/flexfilelayout.c | 11 +- fs/ocfs2/dlmglue.c | 17 ++- fs/ocfs2/ocfs2.h | 1 + fs/ocfs2/ocfs2_fs.h | 4 +- fs/ocfs2/suballoc.c | 9 +- include/linux/intel-iommu.h | 1 + include/linux/netdevice.h | 2 +- include/linux/qed/qed_chain.h | 26 ++-- include/linux/syscalls.h | 2 +- include/linux/tpm_eventlog.h | 14 +- include/net/sctp/constants.h | 8 +- include/net/sock.h | 1 - include/net/xfrm.h | 1 + include/uapi/linux/fb.h | 1 + kernel/bpf/cgroup.c | 53 +++++--- kernel/bpf/devmap.c | 10 +- kernel/dma/direct.c | 26 +++- kernel/kprobes.c | 3 +- kernel/sched/core.c | 3 +- kernel/sched/deadline.c | 1 + kernel/sched/fair.c | 2 +- kernel/trace/blktrace.c | 13 ++ kernel/trace/ring_buffer.c | 2 +- kernel/trace/trace_boot.c | 8 +- kernel/trace/trace_events_trigger.c | 21 ++- lib/test_objagg.c | 4 +- mm/compaction.c | 17 ++- mm/memcontrol.c | 13 +- mm/memory_hotplug.c | 13 +- mm/slab.h | 4 +- mm/slab_common.c | 2 +- net/bridge/br_private.h | 2 +- net/core/dev.c | 9 ++ net/core/sock.c | 4 +- net/ethtool/common.c | 2 + net/ethtool/ioctl.c | 2 +- net/ipv4/fib_semantics.c | 2 +- net/ipv4/ip_tunnel.c | 14 +- net/ipv4/tcp_cubic.c | 5 +- net/ipv4/tcp_input.c | 26 +++- net/ipv6/ip6_gre.c | 9 +- net/ipv6/mcast.c | 1 + net/mptcp/options.c | 2 - net/mptcp/subflow.c | 4 +- net/netfilter/ipset/ip_set_core.c | 2 + net/netlink/genetlink.c | 28 ++-- net/openvswitch/actions.c | 9 +- net/rxrpc/call_accept.c | 7 + net/rxrpc/input.c | 7 +- net/sched/sch_cake.c | 58 +++++--- net/sctp/associola.c | 5 +- net/sctp/bind_addr.c | 1 + net/sctp/protocol.c | 3 +- net/sunrpc/rpc_pipe.c | 1 + net/sunrpc/xdr.c | 4 + net/sunrpc/xprtrdma/rpc_rdma.c | 9 +- net/xfrm/xfrm_device.c | 4 +- samples/bpf/xdp_monitor_user.c | 8 +- samples/bpf/xdp_redirect_cpu_kern.c | 2 +- samples/bpf/xdp_redirect_cpu_user.c | 34 ++--- samples/bpf/xdp_rxq_info_user.c | 13 +- scripts/Kbuild.include | 11 +- scripts/recordmcount.h | 98 +++++++++++++- sound/pci/hda/patch_hdmi.c | 5 + sound/pci/hda/patch_realtek.c | 3 + sound/soc/fsl/fsl_ssi.c | 13 +- sound/soc/qcom/common.c | 14 +- sound/soc/qcom/qdsp6/q6afe.c | 8 ++ sound/soc/qcom/qdsp6/q6afe.h | 1 + sound/soc/qcom/qdsp6/q6asm.c | 7 +- sound/soc/rockchip/rockchip_pdm.c | 4 +- sound/soc/soc-pcm.c | 6 +- sound/usb/format.c | 6 +- sound/usb/mixer.c | 15 +- sound/usb/mixer.h | 9 +- sound/usb/mixer_quirks.c | 3 +- sound/usb/pcm.c | 2 + sound/usb/quirks.c | 10 ++ tools/testing/selftests/bpf/progs/bpf_cubic.c | 5 +- tools/testing/selftests/net/so_txtime.c | 33 ++++- .../selftests/powerpc/pmu/ebb/Makefile | 2 +- tools/testing/selftests/wireguard/netns.sh | 13 +- 273 files changed, 2043 insertions(+), 1048 deletions(-)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 1/265 spi: spi-fsl-dspi: Free DMA memory with matching function
From: Krzysztof Kozlowski <[email protected]>
commit 03fe7aaf0c3d40ef7feff2bdc7180c146989586a upstream.
Driver allocates DMA memory with dma_alloc_coherent() but frees it with dma_unmap_single().
This causes DMA warning during system shutdown (with DMA debugging) on Toradex Colibri VF50 module:
WARNING: CPU: 0 PID: 1 at ../kernel/dma/debug.c:1036 check_unmap+0x3fc/0xb04
DMA-API: fsl-edma 40098000.dma-controller: device driver frees DMA memory with wrong function
[device address=0x0000000087040000] [size=8 bytes] [mapped as coherent] [unmapped as single]
Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree)
(unwind_backtrace) from [<8010bb34>] (show_stack+0x10/0x14)
(show_stack) from [<8011ced8>] (__warn+0xf0/0x108)
(__warn) from [<8011cf64>] (warn_slowpath_fmt+0x74/0xb8)
(warn_slowpath_fmt) from [<8017d170>] (check_unmap+0x3fc/0xb04)
(check_unmap) from [<8017d900>] (debug_dma_unmap_page+0x88/0x90)
(debug_dma_unmap_page) from [<80601d68>] (dspi_release_dma+0x88/0x110)
(dspi_release_dma) from [<80601e4c>] (dspi_shutdown+0x5c/0x80)
(dspi_shutdown) from [<805845f8>] (device_shutdown+0x17c/0x220)
(device_shutdown) from [<80143ef8>] (kernel_restart+0xc/0x50)
(kernel_restart) from [<801441cc>] (__do_sys_reboot+0x18c/0x210)
(__do_sys_reboot) from [<80100060>] (ret_fast_syscall+0x0/0x28)
DMA-API: Mapped at:
dma_alloc_attrs+0xa4/0x130
dspi_probe+0x568/0x7b4
platform_drv_probe+0x6c/0xa4
really_probe+0x208/0x348
driver_probe_device+0x5c/0xb4--- drivers/spi/spi-fsl-dspi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/spi/spi-fsl-dspi.c +4 -4
@@ -584,14 +584,14 @@ static void dspi_release_dma(struct fsl_dspi *dspi)return ;if (dma->chan_tx) { -dma_unmap_single (dma->chan_tx->device->dev, dma->tx_dma_phys, - dma_bufsize,DMA_TO_DEVICE ); +dma_free_coherent (dma->chan_tx->device->dev, dma_bufsize, + dma->tx_dma_buf, dma->tx_dma_phys);dma_release_channel (dma->chan_tx); }if (dma->chan_rx) { -dma_unmap_single (dma->chan_rx->device->dev, dma->rx_dma_phys, - dma_bufsize,DMA_FROM_DEVICE ); +dma_free_coherent (dma->chan_rx->device->dev, dma_bufsize, + dma->rx_dma_buf, dma->rx_dma_phys);dma_release_channel (dma->chan_rx); } }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 2/265 block/bio-integrity: don't free 'buf' if bio_integrity_add_page() failed
In reply to Sasha LevinFrom: yu kuai <[email protected]>
commit a75ca9303175d36af93c0937dd9b1a6422908b8d upstream.
commit e7bf90e5afe3 ("block/bio-integrity: fix a memory leak bug") added a kfree() for 'buf' if bio_integrity_add_page() returns '0'. However, the object will be freed in bio_integrity_free() since 'bio->bi_opf' and 'bio->bi_integrity' were set previousy in bio_integrity_alloc().
--- block/bio-integrity.c | 1 - 1 file changed, 1 deletion(-)
block/bio-integrity.c +0 -1
@@ -278,7 +278,6 @@ bool bio_integrity_prep(struct bio *bio)if (ret ==0 ) {printk (KERN_ERR "could not attach integrity payload\n" ); -kfree (buf); status =BLK_STS_RESOURCE ; goto err_end_io; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 3/265 enetc: Fix tx rings bitmap iteration range, irq handling
In reply to Sasha LevinFrom: Claudiu Manoil <[email protected]>
[ Upstream commit 0574e2000fc3103cbc69ba82ec1175ce171fdf5e ]
The rings bitmap of an interrupt vector encodes which of the device's rings were assigned to that interrupt vector.
Hence the iteration range of the tx rings bitmap (for_each_set_bit()) should be the total number of Tx rings of that netdevice instead of the number of rings assigned to the interrupt vector.
Since there are 2 cores, and one interrupt vector for each core, the number of rings asigned to an interrupt vector is half the number of available rings. The impact of this error is that the upper half of the tx rings could still generate interrupts during napi polling.
--- drivers/net/ethernet/freescale/enetc/enetc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc.c +2 -2
@@ -266,7 +266,7 @@ static irqreturn_t enetc_msix(int irq, void *data)/* disable interrupts */ enetc_wr_reg (v->rbier,0 ); -for_each_set_bit (i, &v->tx_rings_map, v->count_tx_rings) +for_each_set_bit (i, &v->tx_rings_map,ENETC_MAX_NUM_TXQS )enetc_wr_reg (v->tbier_base +ENETC_BDR_OFF (i),0 );napi_schedule_irqoff (&v->napi);
@@ -302,7 +302,7 @@ static int enetc_poll(struct napi_struct *napi, int budget)/* enable interrupts */ enetc_wr_reg (v->rbier,ENETC_RBIER_RXTIE ); -for_each_set_bit (i, &v->tx_rings_map, v->count_tx_rings) +for_each_set_bit (i, &v->tx_rings_map,ENETC_MAX_NUM_TXQS )enetc_wr_reg (v->tbier_base +ENETC_BDR_OFF (i),ENETC_TBIER_TXTIE );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 4/265 ethtool: Fix check in ethtool_rx_flow_rule_create
In reply to Sasha LevinFrom: Gaurav Singh <[email protected]>
[ Upstream commit 21a739c64d3e9871186483a0cc3e7b52638c3d59 ]
Fix check in ethtool_rx_flow_rule_create
--- net/ethtool/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ethtool/ioctl.c +1 -1
@@ -2957,7 +2957,7 @@ ethtool_rx_flow_rule_create(const struct ethtool_rx_flow_spec_input *input) sizeof(match->mask.ipv6.dst)); }if (memcmp (v6_m_spec->ip6src, &zero_addr,sizeof (zero_addr)) || -memcmp (v6_m_spec->ip6src, &zero_addr,sizeof (zero_addr))) { +memcmp (v6_m_spec->ip6dst, &zero_addr,sizeof (zero_addr))) { match->dissector.used_keys |=BIT (FLOW_DISSECTOR_KEY_IPV6_ADDRS ); match->dissector.offset[FLOW_DISSECTOR_KEY_IPV6_ADDRS] =
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 5/265 geneve: allow changing DF behavior after creation
In reply to Sasha LevinFrom: Sabrina Dubroca <[email protected]>
[ Upstream commit 56c09de347e40804fc8dad155272fb9609e0a97b ]
Currently, trying to change the DF parameter of a geneve device does nothing:
# ip -d link show geneve1
14: geneve1: <snip>
link/ether <snip>
geneve id 1 remote 10.0.0.1 ttl auto df set dstport 6081 <snip>
# ip link set geneve1 type geneve id 1 df unset
# ip -d link show geneve1
14: geneve1: <snip>
link/ether <snip>
geneve id 1 remote 10.0.0.1 ttl auto df set dstport 6081 <snip>We just need to update the value in geneve_changelink.
--- drivers/net/geneve.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/geneve.c +1 -0
@@ -1649,6 +1649,7 @@ static int geneve_changelink(struct net_device *dev, struct nlattr *tb[], geneve->collect_md = metadata; geneve->use_udp6_rx_checksums = use_udp6_rx_checksums; geneve->ttl_inherit = ttl_inherit; + geneve->df = df;geneve_unquiesce (geneve, gs4, gs6);return 0 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 6/265 ibmveth: Fix max MTU limit
In reply to Sasha LevinFrom: Thomas Falcon <[email protected]>
[ Upstream commit 5948378b26d89f8aa5eac37629dbd0616ce8d7a7 ]
The max MTU limit defined for ibmveth is not accounting for virtual ethernet buffer overhead, which is twenty-two additional bytes set aside for the ethernet header and eight additional bytes of an opaque handle reserved for use by the hypervisor. Update the max MTU to reflect this overhead.
--- drivers/net/ethernet/ibm/ibmveth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ibm/ibmveth.c +1 -1
@@ -1715,7 +1715,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id) } netdev->min_mtu =IBMVETH_MIN_MTU ; - netdev->max_mtu =ETH_MAX_MTU ; + netdev->max_mtu =ETH_MAX_MTU -IBMVETH_BUFF_OH ;memcpy (netdev->dev_addr, mac_addr_p,ETH_ALEN );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 7/265 mld: fix memory leak in ipv6_mc_destroy_dev()
In reply to Sasha LevinFrom: Wang Hai <[email protected]>
[ Upstream commit ea2fce88d2fd678ed9d45354ff49b73f1d5615dd ]
Commit a84d01647989 ("mld: fix memory leak in mld_del_delrec()") fixed the memory leak of MLD, but missing the ipv6_mc_destroy_dev() path, in which mca_sources are leaked after ma_put().
Using ip6_mc_clear_src() to take care of the missing free.
BUG: memory leak
unreferenced object 0xffff8881113d3180 (size 64):
comm "syz-executor071", pid 389, jiffies 4294887985 (age 17.943s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 ff 02 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 ................
backtrace:
[<000000002cbc483c>] kmalloc include/linux/slab.h:555 [inline]
[<000000002cbc483c>] kzalloc include/linux/slab.h:669 [inline]
[<000000002cbc483c>] ip6_mc_add1_src net/ipv6/mcast.c:2237 [inline]
[<000000002cbc483c>] ip6_mc_add_src+0x7f5/0xbb0 net/ipv6/mcast.c:2357
[<0000000058b8b1ff>] ip6_mc_source+0xe0c/0x1530 net/ipv6/mcast.c:449
[<000000000bfc4fb5>] do_ipv6_setsockopt.isra.12+0x1b2c/0x3b30 net/ipv6/ipv6_sockglue.c:754
[<00000000e4e7a722>] ipv6_setsockopt+0xda/0x150 net/ipv6/ipv6_sockglue.c:950
[<0000000029260d9a>] rawv6_setsockopt+0x45/0x100 net/ipv6/raw.c:1081
[<000000005c1b46f9>] __sys_setsockopt+0x131/0x210 net/socket.c:2132
[<000000008491f7db>] __do_sys_setsockopt net/socket.c:2148 [inline]
[<000000008491f7db>] __se_sys_setsockopt net/socket.c:2145 [inline]
[<000000008491f7db>] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2145
[<00000000c7bc11c5>] do_syscall_64+0xa1/0x530 arch/x86/entry/common.c:295
[<000000005fb7a3f3>] entry_SYSCALL_64_after_hwframe+0x49/0xb3--- net/ipv6/mcast.c | 1 + 1 file changed, 1 insertion(+)
net/ipv6/mcast.c +1 -0
@@ -2618,6 +2618,7 @@ void ipv6_mc_destroy_dev(struct inet6_dev *idev) idev->mc_list = i->next;write_unlock_bh (&idev->lock); +ip6_mc_clear_src (i);ma_put (i);write_lock_bh (&idev->lock); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 8/265 mlxsw: spectrum: Do not rely on machine endianness
In reply to Sasha LevinFrom: Ido Schimmel <[email protected]>
[ Upstream commit f3fe412b0a634286a6a3753c3f9ff201e6bec716 ]
The second commit cited below performed a cast of 'u32 buffsize' to '(u16 *)' when calling mlxsw_sp_port_headroom_8x_adjust():
mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, (u16 *) &buffsize);
Colin noted that this will behave differently on big endian architectures compared to little endian architectures.
Fix this by following Colin's suggestion and have the function accept and return 'u32' instead of passing the current size by reference.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 4 ++-- drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 8 +++----- drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +2 -2
@@ -990,10 +990,10 @@ int __mlxsw_sp_port_headroom_set(struct mlxsw_sp_port *mlxsw_sp_port, int mtu, lossy = !(pfc || pause_en); thres_cells =mlxsw_sp_pg_buf_threshold_get (mlxsw_sp, mtu); -mlxsw_sp_port_headroom_8x_adjust (mlxsw_sp_port, &thres_cells); + thres_cells =mlxsw_sp_port_headroom_8x_adjust (mlxsw_sp_port, thres_cells); delay_cells =mlxsw_sp_pg_buf_delay_get (mlxsw_sp, mtu, delay, pfc, pause_en); -mlxsw_sp_port_headroom_8x_adjust (mlxsw_sp_port, &delay_cells); + delay_cells =mlxsw_sp_port_headroom_8x_adjust (mlxsw_sp_port, delay_cells); total_cells = thres_cells + delay_cells; taken_headroom_cells += total_cells;
drivers/net/ethernet/mellanox/mlxsw/spectrum.h +3 -5
@@ -395,17 +395,15 @@ mlxsw_sp_port_vlan_find_by_vid(const struct mlxsw_sp_port *mlxsw_sp_port,return NULL ; } -static inline void +static inline u32 mlxsw_sp_port_headroom_8x_adjust (const struct mlxsw_sp_port *mlxsw_sp_port, -u16 *p_size) +u32 size_cells) {/* Ports with eight lanes use two headroom buffers between which the * configured headroom size is split. Therefore, multiply the calculated * headroom size by two. */ -if (mlxsw_sp_port->mapping.width !=8 ) -return ; - *p_size *=2 ; +return mlxsw_sp_port->mapping.width ==8 ?2 * size_cells : size_cells; }enum mlxsw_sp_flood_type {
drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c +1 -1
@@ -312,7 +312,7 @@ static int mlxsw_sp_port_pb_init(struct mlxsw_sp_port *mlxsw_sp_port)if (i ==MLXSW_SP_PB_UNUSED )continue ; -mlxsw_sp_port_headroom_8x_adjust (mlxsw_sp_port, &size); + size =mlxsw_sp_port_headroom_8x_adjust (mlxsw_sp_port, size);mlxsw_reg_pbmc_lossy_buffer_pack (pbmc_pl, i, size); } mlxsw_reg_pbmc_lossy_buffer_pack(pbmc_pl,
drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c +1 -1
@@ -776,7 +776,7 @@ mlxsw_sp_span_port_buffsize_update(struct mlxsw_sp_port *mlxsw_sp_port, u16 mtu) speed =0 ; buffsize =mlxsw_sp_span_buffsize_get (mlxsw_sp, speed, mtu); -mlxsw_sp_port_headroom_8x_adjust (mlxsw_sp_port, (u16 *) &buffsize); + buffsize =mlxsw_sp_port_headroom_8x_adjust (mlxsw_sp_port, buffsize);mlxsw_reg_sbib_pack (sbib_pl, mlxsw_sp_port->local_port, buffsize);return mlxsw_reg_write (mlxsw_sp->core,MLXSW_REG (sbib), sbib_pl); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 9/265 mvpp2: ethtool rxtx stats fix
In reply to Sasha LevinFrom: Sven Auhagen <[email protected]>
[ Upstream commit cc970925feb9a38c2f0d34305518e00a3084ce85 ]
The ethtool rx and tx queue statistics are reporting wrong values. Fix reading out the correct ones.
--- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +2 -2
@@ -1544,7 +1544,7 @@ static void mvpp2_read_stats(struct mvpp2_port *port)for (q =0 ; q < port->ntxqs; q++)for (i =0 ; i <ARRAY_SIZE (mvpp2_ethtool_txq_regs); i++) *pstats++ +=mvpp2_read_index (port->priv, -MVPP22_CTRS_TX_CTR (port->id, i), +MVPP22_CTRS_TX_CTR (port->id, q), mvpp2_ethtool_txq_regs[i].offset);/* Rxqs are numbered from 0 from the user standpoint, but not from the
@@ -1553,7 +1553,7 @@ static void mvpp2_read_stats(struct mvpp2_port *port)for (q =0 ; q < port->nrxqs; q++)for (i =0 ; i <ARRAY_SIZE (mvpp2_ethtool_rxq_regs); i++) *pstats++ +=mvpp2_read_index (port->priv, - port->first_rxq + i, + port->first_rxq + q, mvpp2_ethtool_rxq_regs[i].offset); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 10/265 net: bridge: enfore alignment for ethernet address
In reply to Sasha LevinFrom: Thomas Martitz <[email protected]>
[ Upstream commit db7202dec92e6caa2706c21d6fc359af318bde2e ]
The eth_addr member is passed to ether_addr functions that require 2-byte alignment, therefore the member must be properly aligned to avoid unaligned accesses.
The problem is in place since the initial merge of multicast to unicast:
commit 6db6f0eae6052b70885562e1733896647ec1d807 bridge: multicast to unicast
--- net/bridge/br_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bridge/br_private.h +1 -1
@@ -217,8 +217,8 @@ struct net_bridge_port_group {struct rcu_head rcu;struct timer_list timer;struct br_ip addr; +unsigned char eth_addr[ETH_ALEN ]__aligned(2) ;unsigned char flags; -unsigned char eth_addr[ETH_ALEN ]; };struct net_bridge_mdb_entry {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 11/265 net: core: reduce recursion limit value
In reply to Sasha LevinFrom: Taehee Yoo <[email protected]>
[ Upstream commit fb7861d14c8d7edac65b2fcb6e8031cb138457b2 ]
In the current code, ->ndo_start_xmit() can be executed recursively only 10 times because of stack memory.
But, in the case of the vxlan, 10 recursion limit value results in a stack overflow.
In the current code, the nested interface is limited by 8 depth. There is no critical reason that the recursion limitation value should be 10.
So, it would be good to be the same value with the limitation value of nesting interface depth.
Test commands:
ip link add vxlan10 type vxlan vni 10 dstport 4789 srcport 4789 4789
ip link set vxlan10 up
ip a a 192.168.10.1/24 dev vxlan10
ip n a 192.168.10.2 dev vxlan10 lladdr fc:22:33:44:55:66 nud permanent
for i in {9..0}
do
let A=$i+1
ip link add vxlan$i type vxlan vni $i dstport 4789 srcport 4789 4789
ip link set vxlan$i up
ip a a 192.168.$i.1/24 dev vxlan$i
ip n a 192.168.$i.2 dev vxlan$i lladdr fc:22:33:44:55:66 nud permanent
bridge fdb add fc:22:33:44:55:66 dev vxlan$A dst 192.168.$i.2 self
done
hping3 192.168.10.2 -2 -d 60000Splat looks like:
[ 103.814237][ T1127] ============================================================================= [ 103.871955][ T1127] BUG kmalloc-2k (Tainted: G B ): Padding overwritten. 0x00000000897a2e4f-0x000 [ 103.873187][ T1127] ----------------------------------------------------------------------------- [ 103.873187][ T1127] [ 103.874252][ T1127] INFO: Slab 0x000000005cccc724 objects=5 used=5 fp=0x0000000000000000 flags=0x10000000001020 [ 103.881323][ T1127] CPU: 3 PID: 1127 Comm: hping3 Tainted: G B 5.7.0+ #575 [ 103.882131][ T1127] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 [ 103.883006][ T1127] Call Trace: [ 103.883324][ T1127] dump_stack+0x96/0xdb [ 103.883716][ T1127] slab_err+0xad/0xd0 [ 103.884106][ T1127] ? _raw_spin_unlock+0x1f/0x30 [ 103.884620][ T1127] ? get_partial_node.isra.78+0x140/0x360 [ 103.885214][ T1127] slab_pad_check.part.53+0xf7/0x160 [ 103.885769][ T1127] ? pskb_expand_head+0x110/0xe10 [ 103.886316][ T1127] check_slab+0x97/0xb0 [ 103.886763][ T1127] alloc_debug_processing+0x84/0x1a0 [ 103.887308][ T1127] ___slab_alloc+0x5a5/0x630 [ 103.887765][ T1127] ? pskb_expand_head+0x110/0xe10 [ 103.888265][ T1127] ? lock_downgrade+0x730/0x730 [ 103.888762][ T1127] ? pskb_expand_head+0x110/0xe10 [ 103.889244][ T1127] ? __slab_alloc+0x3e/0x80 [ 103.889675][ T1127] __slab_alloc+0x3e/0x80 [ 103.890108][ T1127] __kmalloc_node_track_caller+0xc7/0x420
[ ... ]
--- include/linux/netdevice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/netdevice.h +1 -1
@@ -3125,7 +3125,7 @@ static inline int dev_recursion_level(void)return this_cpu_read (softnet_data.xmit.recursion); } -#define XMIT_RECURSION_LIMIT 10 +#define XMIT_RECURSION_LIMIT 8static inline bool dev_xmit_recursion (void ) { return unlikely(__this_cpu_read(softnet_data.xmit.recursion) >
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 12/265 net: Do not clear the sock TX queue in sk_set_socket()
In reply to Sasha LevinFrom: Tariq Toukan <[email protected]>
[ Upstream commit 41b14fb8724d5a4b382a63cb4a1a61880347ccb8 ]
Clearing the sock TX queue in sk_set_socket() might cause unexpected out-of-order transmit when called from sock_orphan(), as outstanding packets can pick a different TX queue and bypass the ones already queued.
This is undesired in general. More specifically, it breaks the in-order scheduling property guarantee for device-offloaded TLS sockets.
Remove the call to sk_tx_queue_clear() in sk_set_socket(), and add it explicitly only where needed.
--- include/net/sock.h | 1 - net/core/sock.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-)
include/net/sock.h +0 -1
@@ -1846,7 +1846,6 @@ static inline int sk_rx_queue_get(const struct sock *sk)static inline void sk_set_socket (struct sock *sk,struct socket *sock) { -sk_tx_queue_clear (sk); sk->sk_socket = sock; }
net/core/sock.c +2 -0
@@ -1678,6 +1678,7 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority,cgroup_sk_alloc (&sk->sk_cgrp_data);sock_update_classid (&sk->sk_cgrp_data);sock_update_netprioidx (&sk->sk_cgrp_data); +sk_tx_queue_clear (sk); }return sk;
@@ -1901,6 +1902,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)*/ sk_refcnt_debug_inc (newsk);sk_set_socket (newsk,NULL ); +sk_tx_queue_clear (newsk);RCU_INIT_POINTER (newsk->sk_wq,NULL );if (newsk->sk_prot->sockets_allocated)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 13/265 net: ethtool: add missing string for NETIF_F_GSO_TUNNEL_REMCSUM
In reply to Sasha LevinFrom: Alexander Lobakin <[email protected]>
[ Upstream commit b4730ae6a443afe611afb4fb651c885c51003c15 ]
Commit e585f2363637 ("udp: Changes to udp_offload to support remote checksum offload") added new GSO type and a corresponding netdev feature, but missed Ethtool's 'netdev_features_strings' table. Give it a name so it will be exposed to userspace and become available for manual configuration.
v3:
- decouple from "netdev_features_strings[] cleanup" series;
- no functional changes.
v2:
- don't split the "Fixes:" tag across lines;
- no functional changes.
--- net/ethtool/common.c | 1 + 1 file changed, 1 insertion(+)
net/ethtool/common.c +1 -0
@@ -40,6 +40,7 @@ const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = { [NETIF_F_GSO_UDP_TUNNEL_BIT] = "tx-udp_tnl-segmentation", [NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT] = "tx-udp_tnl-csum-segmentation", [NETIF_F_GSO_PARTIAL_BIT] = "tx-gso-partial", + [NETIF_F_GSO_TUNNEL_REMCSUM_BIT] = "tx-tunnel-remcsum-segmentation", [NETIF_F_GSO_SCTP_BIT] = "tx-sctp-segmentation", [NETIF_F_GSO_ESP_BIT] = "tx-esp-segmentation", [NETIF_F_GSO_UDP_L4_BIT] = "tx-udp-segmentation",
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 14/265 net: fix memleak in register_netdevice()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit 814152a89ed52c722ab92e9fbabcac3cb8a39245 ]
I got a memleak report when doing some fuzz test:
unreferenced object 0xffff888112584000 (size 13599):
comm "ip", pid 3048, jiffies 4294911734 (age 343.491s) hex dump (first 32 bytes):
74 61 70 30 00 00 00 00 00 00 00 00 00 00 00 00 tap0............
00 ee d9 19 81 88 ff ff 00 00 00 00 00 00 00 00 ................
backtrace:
[<000000002f60ba65>] __kmalloc_node+0x309/0x3a0
[<0000000075b211ec>] kvmalloc_node+0x7f/0xc0
[<00000000d3a97396>] alloc_netdev_mqs+0x76/0xfc0
[<00000000609c3655>] __tun_chr_ioctl+0x1456/0x3d70
[<000000001127ca24>] ksys_ioctl+0xe5/0x130
[<00000000b7d5e66a>] __x64_sys_ioctl+0x6f/0xb0
[<00000000e1023498>] do_syscall_64+0x56/0xa0
[<000000009ec0eb12>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
unreferenced object 0xffff888111845cc0 (size 8):
comm "ip", pid 3048, jiffies 4294911734 (age 343.491s)
hex dump (first 8 bytes):
74 61 70 30 00 88 ff ff tap0....
backtrace:
[<000000004c159777>] kstrdup+0x35/0x70
[<00000000d8b496ad>] kstrdup_const+0x3d/0x50
[<00000000494e884a>] kvasprintf_const+0xf1/0x180
[<0000000097880a2b>] kobject_set_name_vargs+0x56/0x140
[<000000008fbdfc7b>] dev_set_name+0xab/0xe0
[<000000005b99e3b4>] netdev_register_kobject+0xc0/0x390
[<00000000602704fe>] register_netdevice+0xb61/0x1250
[<000000002b7ca244>] __tun_chr_ioctl+0x1cd1/0x3d70
[<000000001127ca24>] ksys_ioctl+0xe5/0x130
[<00000000b7d5e66a>] __x64_sys_ioctl+0x6f/0xb0
[<00000000e1023498>] do_syscall_64+0x56/0xa0
[<000000009ec0eb12>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
unreferenced object 0xffff88811886d800 (size 512):
comm "ip", pid 3048, jiffies 4294911734 (age 343.491s)
hex dump (first 32 bytes):
00 00 00 00 ad 4e ad de ff ff ff ff 00 00 00 00 .....N..........
ff ff ff ff ff ff ff ff c0 66 3d a3 ff ff ff ff .........f=.....
backtrace:
[<0000000050315800>] device_add+0x61e/0x1950
[<0000000021008dfb>] netdev_register_kobject+0x17e/0x390
[<00000000602704fe>] register_netdevice+0xb61/0x1250
[<000000002b7ca244>] __tun_chr_ioctl+0x1cd1/0x3d70
[<000000001127ca24>] ksys_ioctl+0xe5/0x130
[<00000000b7d5e66a>] __x64_sys_ioctl+0x6f/0xb0
[<00000000e1023498>] do_syscall_64+0x56/0xa0
[<000000009ec0eb12>] entry_SYSCALL_64_after_hwframe+0x44/0xa9If call_netdevice_notifiers() failed, then rollback_registered() calls netdev_unregister_kobject() which holds the kobject. The reference cannot be put because the netdev won't be add to todo list, so it will leads a memleak, we need put the reference to avoid memleak.
--- net/core/dev.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/core/dev.c +7 -0
@@ -9435,6 +9435,13 @@ int register_netdevice(struct net_device *dev)rcu_barrier (); dev->reg_state =NETREG_UNREGISTERED ; +/* We should put the kobject that hold in +* netdev_unregister_kobject(), otherwise +* the net device cannot be freed when +* driver calls free_netdev(), because the +* kobject is being hold. +*/ +kobject_put (&dev->dev.kobj); }/* * Prevent userspace races by waiting until the network
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 15/265 net: Fix the arp error in some cases
In reply to Sasha LevinFrom: guodeqing <[email protected]>
[ Upstream commit 5eea3a63ff4aba6a26002e657a6d21934b7e2b96 ]
ie.,
$ ifconfig eth0 6.6.6.6 netmask 255.255.255.0
$ ip rule add from 6.6.6.6 table 6666
$ ip route add 9.9.9.9 via 6.6.6.6
$ ping -I 6.6.6.6 9.9.9.9 PING 9.9.9.9 (9.9.9.9) from 6.6.6.6 : 56(84) bytes of data.
3 packets transmitted, 0 received, 100% packet loss, time 2079ms
$ arp Address HWtype HWaddress Flags Mask Iface 6.6.6.6 (incomplete) eth0
The arp request address is error, this is because fib_table_lookup in fib_check_nh lookup the destnation 9.9.9.9 nexthop, the scope of the fib result is RT_SCOPE_LINK,the correct scope is RT_SCOPE_HOST. Here I add a check of whether this is RT_TABLE_MAIN to solve this problem.
--- net/ipv4/fib_semantics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/fib_semantics.c +1 -1
@@ -1109,7 +1109,7 @@ static int fib_check_nh_v4_gw(struct net *net, struct fib_nh *nh, u32 table,if (fl4.flowi4_scope <RT_SCOPE_LINK ) fl4.flowi4_scope =RT_SCOPE_LINK ; -if (table) +if (table && table !=RT_TABLE_MAIN ) tbl =fib_get_table (net, table);if (tbl)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 16/265 net: increment xmit_recursion level in dev_direct_xmit()
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit 0ad6f6e767ec2f613418cbc7ebe5ec4c35af540c ]
Back in commit f60e5990d9c1 ("ipv6: protect skb->sk accesses from recursive dereference inside the stack") Hannes added code so that IPv6 stack would not trust skb->sk for typical cases where packet goes through 'standard' xmit path (__dev_queue_xmit())
Alas af_packet had a dev_direct_xmit() path that was not dealing yet with xmit_recursion level.
Also change sk_mc_loop() to dump a stack once only.
Without this patch, syzbot was able to trigger :
[1]
[ 153.567378] WARNING: CPU: 7 PID: 11273 at net/core/sock.c:721 sk_mc_loop+0x51/0x70 [ 153.567378] Modules linked in: nfnetlink ip6table_raw ip6table_filter iptable_raw iptable_nat nf_nat nf_conntrack nf_defrag_ipv4 nf_defrag_ipv6 iptable_filter macsec macvtap tap macvlan 8021q hsr wireguard libblake2s blake2s_x86_64 libblake2s_generic udp_tunnel ip6_udp_tunnel libchacha20poly1305 poly1305_x86_64 chacha_x86_64 libchacha curve25519_x86_64 libcurve25519_generic netdevsim batman_adv dummy team bridge stp llc w1_therm wire i2c_mux_pca954x i2c_mux cdc_acm ehci_pci ehci_hcd mlx4_en mlx4_ib ib_uverbs ib_core mlx4_core [ 153.567386] CPU: 7 PID: 11273 Comm: b159172088 Not tainted 5.8.0-smp-DEV #273 [ 153.567387] RIP: 0010:sk_mc_loop+0x51/0x70 [ 153.567388] Code: 66 83 f8 0a 75 24 0f b6 4f 12 b8 01 00 00 00 31 d2 d3 e0 a9 bf ef ff ff 74 07 48 8b 97 f0 02 00 00 0f b6 42 3a 83 e0 01 5d c3 <0f> 0b b8 01 00 00 00 5d c3 0f b6 87 18 03 00 00 5d c0 e8 04 83 e0 [ 153.567388] RSP: 0018:ffff95c69bb93990 EFLAGS: 00010212 [ 153.567388] RAX: 0000000000000011 RBX: ffff95c6e0ee3e00 RCX: 0000000000000007 [ 153.567389] RDX: ffff95c69ae50000 RSI: ffff95c6c30c3000 RDI: ffff95c6c30c3000 [ 153.567389] RBP: ffff95c69bb93990 R08: ffff95c69a77f000 R09: 0000000000000008 [ 153.567389] R10: 0000000000000040 R11: 00003e0e00026128 R12: ffff95c6c30c3000 [ 153.567390] R13: ffff95c6cc4fd500 R14: ffff95c6f84500c0 R15: ffff95c69aa13c00 [ 153.567390] FS: 00007fdc3a283700(0000) GS:ffff95c6ff9c0000(0000) knlGS:0000000000000000 [ 153.567390] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 153.567391] CR2: 00007ffee758e890 CR3: 0000001f9ba20003 CR4: 00000000001606e0 [ 153.567391] Call Trace: [ 153.567391] ip6_finish_output2+0x34e/0x550 [ 153.567391] __ip6_finish_output+0xe7/0x110 [ 153.567391] ip6_finish_output+0x2d/0xb0 [ 153.567392] ip6_output+0x77/0x120 [ 153.567392] ? __ip6_finish_output+0x110/0x110 [ 153.567392] ip6_local_out+0x3d/0x50 [ 153.567392] ipvlan_queue_xmit+0x56c/0x5e0 [ 153.567393] ? ksize+0x19/0x30 [ 153.567393] ipvlan_start_xmit+0x18/0x50 [ 153.567393] dev_direct_xmit+0xf3/0x1c0 [ 153.567393] packet_direct_xmit+0x69/0xa0 [ 153.567394] packet_sendmsg+0xbf0/0x19b0 [ 153.567394] ? plist_del+0x62/0xb0 [ 153.567394] sock_sendmsg+0x65/0x70 [ 153.567394] sock_write_iter+0x93/0xf0 [ 153.567394] new_sync_write+0x18e/0x1a0 [ 153.567395] __vfs_write+0x29/0x40 [ 153.567395] vfs_write+0xb9/0x1b0 [ 153.567395] ksys_write+0xb1/0xe0 [ 153.567395] __x64_sys_write+0x1a/0x20 [ 153.567395] do_syscall_64+0x43/0x70 [ 153.567396] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 153.567396] RIP: 0033:0x453549 [ 153.567396] Code: Bad RIP value. [ 153.567396] RSP: 002b:00007fdc3a282cc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 [ 153.567397] RAX: ffffffffffffffda RBX: 00000000004d32d0 RCX: 0000000000453549 [ 153.567397] RDX: 0000000000000020 RSI: 0000000020000300 RDI: 0000000000000003 [ 153.567398] RBP: 00000000004d32d8 R08: 0000000000000000 R09: 0000000000000000 [ 153.567398] R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004d32dc [ 153.567398] R13: 00007ffee742260f R14: 00007fdc3a282dc0 R15: 00007fdc3a283700 [ 153.567399] ---[ end trace c1d5ae2b1059ec62 ]---
f60e5990d9c1 ("ipv6: protect skb->sk accesses from recursive dereference inside the stack")
--- net/core/dev.c | 2 ++ net/core/sock.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
net/core/dev.c +2 -0
@@ -4109,10 +4109,12 @@ int dev_direct_xmit(struct sk_buff *skb, u16 queue_id)local_bh_disable (); +dev_xmit_recursion_inc ();HARD_TX_LOCK (dev, txq,smp_processor_id ());if (!netif_xmit_frozen_or_drv_stopped (txq)) ret =netdev_start_xmit (skb, dev, txq, false);HARD_TX_UNLOCK (dev, txq); +dev_xmit_recursion_dec ();local_bh_enable ();
net/core/sock.c +1 -1
@@ -707,7 +707,7 @@ bool sk_mc_loop(struct sock *sk)return inet6_sk (sk)->mc_loop;#endif } -WARN_ON (1 ); +WARN_ON_ONCE (1 );return true; }EXPORT_SYMBOL (sk_mc_loop);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 17/265 net: usb: ax88179_178a: fix packet alignment padding
In reply to Sasha LevinFrom: Jeremy Kerr <[email protected]>
[ Upstream commit e869e7a17798d85829fa7d4f9bbe1eebd4b2d3f6 ]
Using a AX88179 device (0b95:1790), I see two bytes of appended data on every RX packet. For example, this 48-byte ping, using 0xff as a payload byte:
04:20:22.528472 IP 192.168.1.1 > 192.168.1.2: ICMP echo request, id 2447, seq 1, length 64
0x0000: 000a cd35 ea50 000a cd35 ea4f 0800 4500 0x0010: 0054 c116 4000 4001 f63e c0a8 0101 c0a8 0x0020: 0102 0800 b633 098f 0001 87ea cd5e 0000 0x0030: 0000 dcf2 0600 0000 0000 ffff ffff ffff 0x0040: ffff ffff ffff ffff ffff ffff ffff ffff 0x0050: ffff ffff ffff ffff ffff ffff ffff ffff 0x0060: ffff 961f
Those last two bytes - 96 1f - aren't part of the original packet.
In the ax88179 RX path, the usbnet rx_fixup function trims a 2-byte 'alignment pseudo header' from the start of the packet, and sets the length from a per-packet field populated by hardware. It looks like that length field *includes* the 2-byte header; the current driver assumes that it's excluded.
This change trims the 2-byte alignment header after we've set the packet length, so the resulting packet length is correct. While we're moving the comment around, this also fixes the spelling of 'pseudo'.
--- drivers/net/usb/ax88179_178a.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/usb/ax88179_178a.c +6 -5
@@ -1414,10 +1414,10 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb) }if (pkt_cnt ==0 ) { -/* Skip IP alignment psudo header */ -skb_pull (skb,2 ); skb->len = pkt_len; -skb_set_tail_pointer (skb, pkt_len); +/* Skip IP alignment pseudo header */ +skb_pull (skb,2 ); +skb_set_tail_pointer (skb, skb->len); skb->truesize = pkt_len +sizeof (struct sk_buff );ax88179_rx_checksum (skb, pkt_hdr);return 1 ;
@@ -1426,8 +1426,9 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb) ax_skb =skb_clone (skb,GFP_ATOMIC );if (ax_skb) { ax_skb->len = pkt_len; - ax_skb->data = skb->data +2 ; -skb_set_tail_pointer (ax_skb, pkt_len); +/* Skip IP alignment pseudo header */ +skb_pull (ax_skb,2 ); +skb_set_tail_pointer (ax_skb, ax_skb->len); ax_skb->truesize = pkt_len +sizeof (struct sk_buff );ax88179_rx_checksum (ax_skb, pkt_hdr);usbnet_skb_return (dev, ax_skb);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 18/265 openvswitch: take into account de-fragmentation/gso_size in execute_check_pkt_len
In reply to Sasha LevinFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 17843655708e1941c0653af3cd61be6948e36f43 ]
ovs connection tracking module performs de-fragmentation on incoming fragmented traffic. Take info account if traffic has been de-fragmented in execute_check_pkt_len action otherwise we will perform the wrong nested action considering the original packet size. This issue typically occurs if ovs-vswitchd adds a rule in the pipeline that requires connection tracking (e.g. OVN stateful ACLs) before execute_check_pkt_len action. Moreover take into account GSO fragment size for GSO packet in execute_check_pkt_len routine
--- net/openvswitch/actions.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
net/openvswitch/actions.c +7 -2
@@ -1169,9 +1169,10 @@ static int execute_check_pkt_len(struct datapath *dp, struct sk_buff *skb,struct sw_flow_key *key, const struct nlattr *attr, bool last) { + struct ovs_skb_cb *ovs_cb = OVS_CB(skb);const struct nlattr *actions, *cpl_arg; +int len, max_len, rem =nla_len (attr);const struct check_pkt_len_arg *arg; -int rem =nla_len (attr);bool clone_flow_key;/* The first netlink attribute in 'attr' is always
@@ -1180,7 +1181,11 @@ static int execute_check_pkt_len(struct datapath *dp, struct sk_buff *skb, cpl_arg =nla_data (attr); arg =nla_data (cpl_arg); -if (skb->len <= arg->pkt_len) { + len = ovs_cb->mru ? ovs_cb->mru + skb->mac_len : skb->len; + max_len = arg->pkt_len; + +if ((skb_is_gso (skb) &&skb_gso_validate_mac_len (skb, max_len)) || + len <= max_len) {/* Second netlink attribute in 'attr' is always * 'OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_LESS_EQUAL'. */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 19/265 rocker: fix incorrect error handling in dma_rings_init
In reply to Sasha LevinFrom: Aditya Pakki <[email protected]>
[ Upstream commit 58d0c864e1a759a15c9df78f50ea5a5c32b3989e ]
In rocker_dma_rings_init, the goto blocks in case of errors caused by the functions rocker_dma_cmd_ring_waits_alloc() and rocker_dma_ring_create() are incorrect. The patch fixes the order consistent with cleanup in rocker_dma_rings_fini().
--- drivers/net/ethernet/rocker/rocker_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/rocker/rocker_main.c +2 -2
@@ -647,10 +647,10 @@ static int rocker_dma_rings_init(struct rocker *rocker) err_dma_event_ring_bufs_alloc:rocker_dma_ring_destroy (rocker, &rocker->event_ring); err_dma_event_ring_create: +rocker_dma_cmd_ring_waits_free (rocker); +err_dma_cmd_ring_waits_alloc:rocker_dma_ring_bufs_free (rocker, &rocker->cmd_ring,PCI_DMA_BIDIRECTIONAL ); -err_dma_cmd_ring_waits_alloc: -rocker_dma_cmd_ring_waits_free (rocker); err_dma_cmd_ring_bufs_alloc:rocker_dma_ring_destroy (rocker, &rocker->cmd_ring);return err;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 20/265 rxrpc: Fix notification call on completion of discarded calls
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit 0041cd5a50442db6e456b145892a0eaf2dff061f ]
When preallocated service calls are being discarded, they're passed to ->discard_new_call() to have the caller clean up any attached higher-layer preallocated pieces before being marked completed. However, the act of marking them completed now invokes the call's notification function - which causes a problem because that function might assume that the previously freed pieces of memory are still there.
Fix this by setting a dummy notification function on the socket after calling ->discard_new_call().
This results in the following kasan message when the kafs module is removed.
==================================================================
BUG: KASAN: use-after-free in afs_wake_up_async_call+0x6aa/0x770 fs/afs/rxrpc.c:707
Write of size 1 at addr ffff8880946c39e4 by task kworker/u4:1/21
CPU: 0 PID: 21 Comm: kworker/u4:1 Not tainted 5.8.0-rc1-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: netns cleanup_net
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x18f/0x20d lib/dump_stack.c:118
print_address_description.constprop.0.cold+0xd3/0x413 mm/kasan/report.c:383
__kasan_report mm/kasan/report.c:513 [inline]
kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
afs_wake_up_async_call+0x6aa/0x770 fs/afs/rxrpc.c:707
rxrpc_notify_socket+0x1db/0x5d0 net/rxrpc/recvmsg.c:40
__rxrpc_set_call_completion.part.0+0x172/0x410 net/rxrpc/recvmsg.c:76
__rxrpc_call_completed net/rxrpc/recvmsg.c:112 [inline]
rxrpc_call_completed+0xca/0xf0 net/rxrpc/recvmsg.c:111
rxrpc_discard_prealloc+0x781/0xab0 net/rxrpc/call_accept.c:233
rxrpc_listen+0x147/0x360 net/rxrpc/af_rxrpc.c:245
afs_close_socket+0x95/0x320 fs/afs/rxrpc.c:110
afs_net_exit+0x1bc/0x310 fs/afs/main.c:155
ops_exit_list.isra.0+0xa8/0x150 net/core/net_namespace.c:186
cleanup_net+0x511/0xa50 net/core/net_namespace.c:603
process_one_work+0x965/0x1690 kernel/workqueue.c:2269
worker_thread+0x96/0xe10 kernel/workqueue.c:2415
kthread+0x3b5/0x4a0 kernel/kthread.c:291
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:293
Allocated by task 6820:
save_stack+0x1b/0x40 mm/kasan/common.c:48
set_track mm/kasan/common.c:56 [inline]
__kasan_kmalloc mm/kasan/common.c:494 [inline]
__kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:467
kmem_cache_alloc_trace+0x153/0x7d0 mm/slab.c:3551
kmalloc include/linux/slab.h:555 [inline]
kzalloc include/linux/slab.h:669 [inline]
afs_alloc_call+0x55/0x630 fs/afs/rxrpc.c:141
afs_charge_preallocation+0xe9/0x2d0 fs/afs/rxrpc.c:757
afs_open_socket+0x292/0x360 fs/afs/rxrpc.c:92
afs_net_init+0xa6c/0xe30 fs/afs/main.c:125
ops_init+0xaf/0x420 net/core/net_namespace.c:151
setup_net+0x2de/0x860 net/core/net_namespace.c:341
copy_net_ns+0x293/0x590 net/core/net_namespace.c:482
create_new_namespaces+0x3fb/0xb30 kernel/nsproxy.c:110
unshare_nsproxy_namespaces+0xbd/0x1f0 kernel/nsproxy.c:231
ksys_unshare+0x43d/0x8e0 kernel/fork.c:2983
__do_sys_unshare kernel/fork.c:3051 [inline]
__se_sys_unshare kernel/fork.c:3049 [inline]
__x64_sys_unshare+0x2d/0x40 kernel/fork.c:3049
do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:359
entry_SYSCALL_64_after_hwframe+0x44/0xa9
Freed by task 21:
save_stack+0x1b/0x40 mm/kasan/common.c:48
set_track mm/kasan/common.c:56 [inline]
kasan_set_free_info mm/kasan/common.c:316 [inline]
__kasan_slab_free+0xf7/0x140 mm/kasan/common.c:455
__cache_free mm/slab.c:3426 [inline]
kfree+0x109/0x2b0 mm/slab.c:3757
afs_put_call+0x585/0xa40 fs/afs/rxrpc.c:190
rxrpc_discard_prealloc+0x764/0xab0 net/rxrpc/call_accept.c:230
rxrpc_listen+0x147/0x360 net/rxrpc/af_rxrpc.c:245
afs_close_socket+0x95/0x320 fs/afs/rxrpc.c:110
afs_net_exit+0x1bc/0x310 fs/afs/main.c:155
ops_exit_list.isra.0+0xa8/0x150 net/core/net_namespace.c:186
cleanup_net+0x511/0xa50 net/core/net_namespace.c:603
process_one_work+0x965/0x1690 kernel/workqueue.c:2269
worker_thread+0x96/0xe10 kernel/workqueue.c:2415
kthread+0x3b5/0x4a0 kernel/kthread.c:291
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:293
The buggy address belongs to the object at ffff8880946c3800
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 484 bytes inside of
1024-byte region [ffff8880946c3800, ffff8880946c3c00)
The buggy address belongs to the page:
page:ffffea000251b0c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea0002546508 ffffea00024fa248 ffff8880aa000c40
raw: 0000000000000000 ffff8880946c3000 0000000100000002 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8880946c3880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880946c3900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880946c3980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880946c3a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880946c3a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================--- net/rxrpc/call_accept.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/rxrpc/call_accept.c +7 -0
@@ -22,6 +22,11 @@#include <net/ip.h> #include "ar-internal.h" +static void rxrpc_dummy_notify (struct sock *sk,struct rxrpc_call *call, +unsigned long user_call_ID) +{ +} +/* * Preallocate a single service call, connection and peer and, if possible, * give them a user ID and attach the user's side of the ID to them.
@@ -228,6 +233,8 @@ void rxrpc_discard_prealloc(struct rxrpc_sock *rx)if (rx->discard_new_call) {_debug ("discard %lx" , call->user_call_ID); rx->discard_new_call (call, call->user_call_ID); +if (call->notify_rx) + call->notify_rx = rxrpc_dummy_notify;rxrpc_put_call (call, rxrpc_call_put_kernel); }rxrpc_call_completed (call);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 21/265 sctp: Don't advertise IPv4 addresses if ipv6only is set on the socket
In reply to Sasha LevinFrom: Marcelo Ricardo Leitner <[email protected]>
[ Upstream commit 471e39df96b9a4c4ba88a2da9e25a126624d7a9c ]
If a socket is set ipv6only, it will still send IPv4 addresses in the INIT and INIT_ACK packets. This potentially misleads the peer into using them, which then would cause association termination.
The fix is to not add IPv4 addresses to ipv6only sockets.
--- include/net/sctp/constants.h | 8 +++++--- net/sctp/associola.c | 5 ++++- net/sctp/bind_addr.c | 1 + net/sctp/protocol.c | 3 ++- 4 files changed, 12 insertions(+), 5 deletions(-)
include/net/sctp/constants.h +5 -3
@@ -353,11 +353,13 @@ enum { ipv4_is_anycast_6to4(a))/* Flags used for the bind address copy functions. */ -#define SCTP_ADDR6_ALLOWED 0x00000001/* IPv6 address is allowed by +#define SCTP_ADDR4_ALLOWED 0x00000001/* IPv4 address is allowed by local sock family */ -#define SCTP_ADDR4_PEERSUPP 0x00000002/* IPv4 address is supported by +#define SCTP_ADDR6_ALLOWED 0x00000002/* IPv6 address is allowed by +local sock family */ +#define SCTP_ADDR4_PEERSUPP 0x00000004/* IPv4 address is supported by peer */ -#define SCTP_ADDR6_PEERSUPP 0x00000004/* IPv6 address is supported by +#define SCTP_ADDR6_PEERSUPP 0x00000008/* IPv6 address is supported by peer */ /* Reasons to retransmit. */
net/sctp/associola.c +4 -1
@@ -1565,12 +1565,15 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned int len)int sctp_assoc_set_bind_addr_from_ep (struct sctp_association *asoc,enum sctp_scope scope,gfp_t gfp) { +struct sock *sk = asoc->base.sk;int flags;/* Use scoping rules to determine the subset of addresses from * the endpoint. */ - flags = (PF_INET6 == asoc->base.sk->sk_family) ?SCTP_ADDR6_ALLOWED :0 ; + flags = (PF_INET6 == sk->sk_family) ?SCTP_ADDR6_ALLOWED :0 ; +if (!inet_v6_ipv6only (sk)) + flags |=SCTP_ADDR4_ALLOWED ;if (asoc->peer.ipv4_address) flags |=SCTP_ADDR4_PEERSUPP ;if (asoc->peer.ipv6_address)
net/sctp/bind_addr.c +1 -0
@@ -461,6 +461,7 @@ static int sctp_copy_one_addr(struct net *net, struct sctp_bind_addr *dest,* well as the remote peer. */ if ((((AF_INET == addr->sa.sa_family) && + (flags & SCTP_ADDR4_ALLOWED) && (flags & SCTP_ADDR4_PEERSUPP))) || (((AF_INET6 == addr->sa.sa_family) && (flags & SCTP_ADDR6_ALLOWED) &&
net/sctp/protocol.c +2 -1
@@ -148,7 +148,8 @@ int sctp_copy_local_addr_list(struct net *net, struct sctp_bind_addr *bp,* sock as well as the remote peer. */ if (addr->a.sa.sa_family ==AF_INET && - !(copy_flags &SCTP_ADDR4_PEERSUPP )) + (!(copy_flags &SCTP_ADDR4_ALLOWED ) || + !(copy_flags &SCTP_ADDR4_PEERSUPP )))continue ; if (addr->a.sa.sa_family == AF_INET6 && (!(copy_flags & SCTP_ADDR6_ALLOWED) ||
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 22/265 tcp: don't ignore ECN CWR on pure ACK
In reply to Sasha LevinFrom: Denis Kirjanov <[email protected]>
[ Upstream commit 2570284060b48f3f79d8f1a2698792f36c385e9a ]
there is a problem with the CWR flag set in an incoming ACK segment and it leads to the situation when the ECE flag is latched forever
the following packetdrill script shows what happens:
// Stack receives incoming segments with CE set +0.1 <[ect0] . 11001:12001(1000) ack 1001 win 65535
+0.0 <[ce] . 12001:13001(1000) ack 1001 win 65535
+0.0 <[ect0] P. 13001:14001(1000) ack 1001 win 65535
// Stack repsonds with ECN ECHO
+0.0 >[noecn] . 1001:1001(0) ack 12001
+0.0 >[noecn] E. 1001:1001(0) ack 13001
+0.0 >[noecn] E. 1001:1001(0) ack 14001
// Write a packet
+0.1 write(3, ..., 1000) = 1000
+0.0 >[ect0] PE. 1001:2001(1000) ack 14001
// Pure ACK received
+0.01 <[noecn] W. 14001:14001(0) ack 2001 win 65535
// Since CWR was sent, this packet should NOT have ECE set
+0.1 write(3, ..., 1000) = 1000
+0.0 >[ect0] P. 2001:3001(1000) ack 14001
// but Linux will still keep ECE latched here, with packetdrill // flagging a missing ECE flag, expecting
// >[ect0] PE. 2001:3001(1000) ack 14001
// in the script
In the situation above we will continue to send ECN ECHO packets and trigger the peer to reduce the congestion window. To avoid that we can check CWR on pure ACKs received.
v3:
- Add a sequence check to avoid sending an ACK to an ACK
v2:
- Adjusted the comment
- move CWR check before checking for unacknowledged packets
--- net/ipv4/tcp_input.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
net/ipv4/tcp_input.c +11 -3
@@ -261,7 +261,8 @@ static void tcp_ecn_accept_cwr(struct sock *sk, const struct sk_buff *skb)* cwnd may be very low (even just 1 packet), so we should ACK * immediately. */ -inet_csk (sk)->icsk_ack.pending |=ICSK_ACK_NOW ; +if (TCP_SKB_CB (skb)->seq !=TCP_SKB_CB (skb)->end_seq) +inet_csk (sk)->icsk_ack.pending |=ICSK_ACK_NOW ; } }
@@ -3683,6 +3684,15 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)tcp_in_ack_event (sk, ack_ev_flags); } +/* This is a deviation from RFC3168 since it states that: +* "When the TCP data sender is ready to set the CWR bit after reducing +* the congestion window, it SHOULD set the CWR bit only on the first +* new data packet that it transmits." +* We accept CWR on pure ACKs to be more robust +* with widely-deployed TCP implementations that do this. +*/ +tcp_ecn_accept_cwr (sk, skb); +/* We passed data and got it acked, remove any soft error * log. Something worked... */
@@ -4780,8 +4790,6 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)skb_dst_drop (skb);__skb_pull (skb,tcp_hdr (skb)->doff *4 ); -tcp_ecn_accept_cwr (sk, skb); - tp->rx_opt.dsack =0 ;/* Queue data for delivery to the user.
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 23/265 tcp: grow window for OOO packets only for SACK flows
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit 662051215c758ae8545451628816204ed6cd372d ]
Back in 2013, we made a change that broke fast retransmit for non SACK flows.
Indeed, for these flows, a sender needs to receive three duplicate ACK before starting fast retransmit. Sending ACK with different receive window do not count.
Even if enabling SACK is strongly recommended these days, there still are some cases where it has to be disabled.
Not increasing the window seems better than having to rely on RTO.
After the fix, following packetdrill test gives :
// Initialize connection
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 +0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0
+0 < S 0:0(0) win 32792 <mss 1000,nop,wscale 7> +0 > S. 0:0(0) ack 1 <mss 1460,nop,wscale 8> +0 < . 1:1(0) ack 1 win 514
+0 accept(3, ..., ...) = 4
+0 < . 1:1001(1000) ack 1 win 514
// Quick ack
+0 > . 1:1(0) ack 1001 win 264
+0 < . 2001:3001(1000) ack 1 win 514
// DUPACK : Normally we should not change the window
+0 > . 1:1(0) ack 1001 win 264
+0 < . 3001:4001(1000) ack 1 win 514
// DUPACK : Normally we should not change the window
+0 > . 1:1(0) ack 1001 win 264
+0 < . 4001:5001(1000) ack 1 win 514
// DUPACK : Normally we should not change the window
+0 > . 1:1(0) ack 1001 win 264
+0 < . 1001:2001(1000) ack 1 win 514
// Hole is repaired.
+0 > . 1:1(0) ack 5001 win 272
--- net/ipv4/tcp_input.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
net/ipv4/tcp_input.c +10 -2
@@ -4603,7 +4603,11 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)if (tcp_ooo_try_coalesce (sk, tp->ooo_last_skb, skb, &fragstolen)) { coalesce_done: -tcp_grow_window (sk, skb); +/* For non sack flows, do not grow window to force DUPACK +* and trigger fast retransmit. +*/ +if (tcp_is_sack (tp)) +tcp_grow_window (sk, skb);kfree_skb_partial (skb, fragstolen); skb =NULL ; goto add_sack;
@@ -4687,7 +4691,11 @@ add_sack:tcp_sack_new_ofo_skb (sk, seq, end_seq); end:if (skb) { -tcp_grow_window (sk, skb); +/* For non sack flows, do not grow window to force DUPACK +* and trigger fast retransmit. +*/ +if (tcp_is_sack (tp)) +tcp_grow_window (sk, skb);skb_condense (skb);skb_set_owner_r (skb, sk); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 24/265 tg3: driver sleeps indefinitely when EEH errors exceed eeh_max_freezes
In reply to Sasha LevinFrom: David Christensen <[email protected]>
[ Upstream commit 3a2656a211caf35e56afc9425e6e518fa52f7fbc ]
The driver function tg3_io_error_detected() calls napi_disable twice, without an intervening napi_enable, when the number of EEH errors exceeds eeh_max_freezes, resulting in an indefinite sleep while holding rtnl_lock.
Add check for pcierr_recovery which skips code already executed for the "Frozen" state.
--- drivers/net/ethernet/broadcom/tg3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +2 -2
@@ -18170,8 +18170,8 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev,rtnl_lock (); -/* We probably don't have netdev yet */ -if (!netdev || !netif_running (netdev)) +/* Could be second call or maybe we don't have netdev yet */ +if (!netdev || tp->pcierr_recovery || !netif_running (netdev)) goto done;/* We needn't recover from permanent error */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 25/265 ip6_gre: fix use-after-free in ip6gre_tunnel_lookup()
In reply to Sasha LevinFrom: Taehee Yoo <[email protected]>
[ Upstream commit dafabb6590cb15f300b77c095d50312e2c7c8e0f ]
In the datapath, the ip6gre_tunnel_lookup() is used and it internally uses fallback tunnel device pointer, which is fb_tunnel_dev.
This pointer variable should be set to NULL when a fb interface is deleted. But there is no routine to set fb_tunnel_dev pointer to NULL. So, this pointer will be still used after interface is deleted and it eventually results in the use-after-free problem.
Test commands:
ip netns add A
ip netns add B
ip link add eth0 type veth peer name eth1
ip link set eth0 netns A
ip link set eth1 netns B
ip netns exec A ip link set lo up
ip netns exec A ip link set eth0 up
ip netns exec A ip link add ip6gre1 type ip6gre local fc:0::1 \
remote fc:0::2
ip netns exec A ip -6 a a fc:100::1/64 dev ip6gre1 ip netns exec A ip link set ip6gre1 up
ip netns exec A ip -6 a a fc:0::1/64 dev eth0
ip netns exec A ip link set ip6gre0 up
ip netns exec B ip link set lo up
ip netns exec B ip link set eth1 up
ip netns exec B ip link add ip6gre1 type ip6gre local fc:0::2 \
remote fc:0::1
ip netns exec B ip -6 a a fc:100::2/64 dev ip6gre1 ip netns exec B ip link set ip6gre1 up
ip netns exec B ip -6 a a fc:0::2/64 dev eth1
ip netns exec B ip link set ip6gre0 up
ip netns exec A ping fc:100::2 -s 60000 &
ip netns del B
Splat looks like:
[ 73.087285][ C1] BUG: KASAN: use-after-free in ip6gre_tunnel_lookup+0x1064/0x13f0 [ip6_gre] [ 73.088361][ C1] Read of size 4 at addr ffff888040559218 by task ping/1429 [ 73.089317][ C1] [ 73.089638][ C1] CPU: 1 PID: 1429 Comm: ping Not tainted 5.7.0+ #602 [ 73.090531][ C1] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 [ 73.091725][ C1] Call Trace: [ 73.092160][ C1] <IRQ> [ 73.092556][ C1] dump_stack+0x96/0xdb [ 73.093122][ C1] print_address_description.constprop.6+0x2cc/0x450 [ 73.094016][ C1] ? ip6gre_tunnel_lookup+0x1064/0x13f0 [ip6_gre] [ 73.094894][ C1] ? ip6gre_tunnel_lookup+0x1064/0x13f0 [ip6_gre] [ 73.095767][ C1] ? ip6gre_tunnel_lookup+0x1064/0x13f0 [ip6_gre] [ 73.096619][ C1] kasan_report+0x154/0x190 [ 73.097209][ C1] ? ip6gre_tunnel_lookup+0x1064/0x13f0 [ip6_gre] [ 73.097989][ C1] ip6gre_tunnel_lookup+0x1064/0x13f0 [ip6_gre] [ 73.098750][ C1] ? gre_del_protocol+0x60/0x60 [gre] [ 73.099500][ C1] gre_rcv+0x1c5/0x1450 [ip6_gre] [ 73.100199][ C1] ? ip6gre_header+0xf00/0xf00 [ip6_gre] [ 73.100985][ C1] ? rcu_read_lock_sched_held+0xc0/0xc0 [ 73.101830][ C1] ? ip6_input_finish+0x5/0xf0 [ 73.102483][ C1] ip6_protocol_deliver_rcu+0xcbb/0x1510 [ 73.103296][ C1] ip6_input_finish+0x5b/0xf0 [ 73.103920][ C1] ip6_input+0xcd/0x2c0 [ 73.104473][ C1] ? ip6_input_finish+0xf0/0xf0 [ 73.105115][ C1] ? rcu_read_lock_held+0x90/0xa0 [ 73.105783][ C1] ? rcu_read_lock_sched_held+0xc0/0xc0 [ 73.106548][ C1] ipv6_rcv+0x1f1/0x300
[ ... ]
--- net/ipv6/ip6_gre.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/ipv6/ip6_gre.c +6 -3
@@ -127,6 +127,7 @@ static struct ip6_tnl *ip6gre_tunnel_lookup(struct net_device *dev, gre_proto == htons(ETH_P_ERSPAN2)) ?ARPHRD_ETHER :ARPHRD_IP6GRE ;int score, cand_score =4 ; +struct net_device *ndev;for_each_ip_tunnel_rcu (t, ign->tunnels_r_l[h0 ^ h1]) { if (!ipv6_addr_equal(local, &t->parms.laddr) ||
@@ -238,9 +239,9 @@ static struct ip6_tnl *ip6gre_tunnel_lookup(struct net_device *dev,if (t && t->dev->flags &IFF_UP )return t; - dev = ign->fb_tunnel_dev; -if (dev && dev->flags &IFF_UP ) -return netdev_priv (dev); + ndev =READ_ONCE (ign->fb_tunnel_dev); +if (ndev && ndev->flags &IFF_UP ) +return netdev_priv (ndev);return NULL ; }
@@ -413,6 +414,8 @@ static void ip6gre_tunnel_uninit(struct net_device *dev)ip6gre_tunnel_unlink_md (ign, t);ip6gre_tunnel_unlink (ign, t); +if (ign->fb_tunnel_dev == dev) +WRITE_ONCE (ign->fb_tunnel_dev,NULL );dst_cache_reset (&t->dst_cache);dev_put (dev); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 26/265 net: phy: Check harder for errors in get_phy_id()
In reply to Sasha LevinFrom: Florian Fainelli <[email protected]>
[ Upstream commit b2ffc75e2e990b09903f9d15ccd53bc5f3a4217c ]
Commit 02a6efcab675 ("net: phy: allow scanning busses with missing phys") added a special condition to return -ENODEV in case -ENODEV or -EIO was returned from the first read of the MII_PHYSID1 register.
In case the MDIO bus data line pull-up is not strong enough, the MDIO bus controller will not flag this as a read error. This can happen when a pluggable daughter card is not connected and weak internal pull-ups are used (since that is the only option, otherwise the pins are floating).
The second read of MII_PHYSID2 will be correctly flagged an error though, but now we will return -EIO which will be treated as a hard error, thus preventing MDIO bus scanning loops to continue succesfully.
Apply the same logic to both register reads, thus allowing the scanning logic to proceed.
--- drivers/net/phy/phy_device.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/phy/phy_device.c +4 -2
@@ -798,8 +798,10 @@ static int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id,/* Grab the bits from PHYIR2, and put them in the lower half */ phy_reg =mdiobus_read (bus, addr,MII_PHYSID2 ); -if (phy_reg <0 ) -return -EIO ; +if (phy_reg <0 ) { +/* returning -ENODEV doesn't stop bus scanning */ +return (phy_reg == -EIO || phy_reg == -ENODEV ) ? -ENODEV : -EIO ; + } *phy_id |= phy_reg;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 27/265 ip_tunnel: fix use-after-free in ip_tunnel_lookup()
In reply to Sasha LevinFrom: Taehee Yoo <[email protected]>
[ Upstream commit ba61539c6ae57f4146284a5cb4f7b7ed8d42bf45 ]
In the datapath, the ip_tunnel_lookup() is used and it internally uses fallback tunnel device pointer, which is fb_tunnel_dev.
This pointer variable should be set to NULL when a fb interface is deleted. But there is no routine to set fb_tunnel_dev pointer to NULL. So, this pointer will be still used after interface is deleted and it eventually results in the use-after-free problem.
Test commands:
ip netns add A
ip netns add B
ip link add eth0 type veth peer name eth1
ip link set eth0 netns A
ip link set eth1 netns B
ip netns exec A ip link set lo up
ip netns exec A ip link set eth0 up
ip netns exec A ip link add gre1 type gre local 10.0.0.1 \
remote 10.0.0.2
ip netns exec A ip link set gre1 up
ip netns exec A ip a a 10.0.100.1/24 dev gre1
ip netns exec A ip a a 10.0.0.1/24 dev eth0
ip netns exec B ip link set lo up
ip netns exec B ip link set eth1 up
ip netns exec B ip link add gre1 type gre local 10.0.0.2 \
remote 10.0.0.1
ip netns exec B ip link set gre1 up
ip netns exec B ip a a 10.0.100.2/24 dev gre1
ip netns exec B ip a a 10.0.0.2/24 dev eth1
ip netns exec A hping3 10.0.100.2 -2 --flood -d 60000 & ip netns del B
Splat looks like:
[ 77.793450][ C3] ================================================================== [ 77.794702][ C3] BUG: KASAN: use-after-free in ip_tunnel_lookup+0xcc4/0xf30 [ 77.795573][ C3] Read of size 4 at addr ffff888060bd9c84 by task hping3/2905 [ 77.796398][ C3] [ 77.796664][ C3] CPU: 3 PID: 2905 Comm: hping3 Not tainted 5.8.0-rc1+ #616 [ 77.797474][ C3] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 [ 77.798453][ C3] Call Trace: [ 77.798815][ C3] <IRQ> [ 77.799142][ C3] dump_stack+0x9d/0xdb [ 77.799605][ C3] print_address_description.constprop.7+0x2cc/0x450 [ 77.800365][ C3] ? ip_tunnel_lookup+0xcc4/0xf30 [ 77.800908][ C3] ? ip_tunnel_lookup+0xcc4/0xf30 [ 77.801517][ C3] ? ip_tunnel_lookup+0xcc4/0xf30 [ 77.802145][ C3] kasan_report+0x154/0x190 [ 77.802821][ C3] ? ip_tunnel_lookup+0xcc4/0xf30 [ 77.803503][ C3] ip_tunnel_lookup+0xcc4/0xf30 [ 77.804165][ C3] __ipgre_rcv+0x1ab/0xaa0 [ip_gre] [ 77.804862][ C3] ? rcu_read_lock_sched_held+0xc0/0xc0 [ 77.805621][ C3] gre_rcv+0x304/0x1910 [ip_gre] [ 77.806293][ C3] ? lock_acquire+0x1a9/0x870 [ 77.806925][ C3] ? gre_rcv+0xfe/0x354 [gre] [ 77.807559][ C3] ? erspan_xmit+0x2e60/0x2e60 [ip_gre] [ 77.808305][ C3] ? rcu_read_lock_sched_held+0xc0/0xc0 [ 77.809032][ C3] ? rcu_read_lock_held+0x90/0xa0 [ 77.809713][ C3] gre_rcv+0x1b8/0x354 [gre]
[ ... ]
--- net/ipv4/ip_tunnel.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
net/ipv4/ip_tunnel.c +8 -6
@@ -85,9 +85,10 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn, __be32 remote, __be32 local, __be32 key) { - unsigned int hash; struct ip_tunnel *t, *cand = NULL;struct hlist_head *head; +struct net_device *ndev; +unsigned int hash; hash =ip_tunnel_hash (key, remote); head = &itn->tunnels[hash];
@@ -162,8 +163,9 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,if (t && t->dev->flags &IFF_UP )return t; -if (itn->fb_tunnel_dev && itn->fb_tunnel_dev->flags &IFF_UP ) -return netdev_priv (itn->fb_tunnel_dev); + ndev =READ_ONCE (itn->fb_tunnel_dev); +if (ndev && ndev->flags &IFF_UP ) +return netdev_priv (ndev);return NULL ; }
@@ -1245,9 +1247,9 @@ void ip_tunnel_uninit(struct net_device *dev)struct ip_tunnel_net *itn; itn =net_generic (net, tunnel->ip_tnl_net_id); -/* fb_tunnel_dev will be unregisted in net-exit call. */ -if (itn->fb_tunnel_dev != dev) -ip_tunnel_del (itn,netdev_priv (dev)); +ip_tunnel_del (itn,netdev_priv (dev)); +if (itn->fb_tunnel_dev == dev) +WRITE_ONCE (itn->fb_tunnel_dev,NULL );dst_cache_reset (&tunnel->dst_cache); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 28/265 bnxt_en: Store the running firmware version code.
In reply to Sasha LevinFrom: Michael Chan <[email protected]>
[ Upstream commit d0ad2ea2bc185835f8a749302ad07b70528d2a09 ]
We currently only store the firmware version as a string for ethtool and devlink info. Store it also as a version code. The next 2 patches will need to check the firmware major version to determine some workarounds.
We also use the 16-bit firmware version fields if the firmware is newer and provides the 16-bit fields.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 22 ++++++++++++++++++---- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 4 ++++ 2 files changed, 22 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +18 -4
@@ -7217,8 +7217,9 @@ static int __bnxt_hwrm_ver_get(struct bnxt *bp, bool silent)static int bnxt_hwrm_ver_get (struct bnxt *bp) {struct hwrm_ver_get_output *resp = bp->hwrm_cmd_resp_addr; +u16 fw_maj, fw_min, fw_bld, fw_rsv;u32 dev_caps_cfg, hwrm_ver; -int rc; +int rc, len; bp->hwrm_max_req_len =HWRM_MAX_REQ_LEN ;mutex_lock (&bp->hwrm_cmd_lock);
@@ -7250,9 +7251,22 @@ static int bnxt_hwrm_ver_get(struct bnxt *bp) resp->hwrm_intf_maj_8b, resp->hwrm_intf_min_8b, resp->hwrm_intf_upd_8b); -snprintf (bp->fw_ver_str,BC_HWRM_STR_LEN ,"%d.%d.%d.%d" , - resp->hwrm_fw_maj_8b, resp->hwrm_fw_min_8b, - resp->hwrm_fw_bld_8b, resp->hwrm_fw_rsvd_8b); + fw_maj =le16_to_cpu (resp->hwrm_fw_major); +if (bp->hwrm_spec_code >0x10803 && fw_maj) { + fw_min =le16_to_cpu (resp->hwrm_fw_minor); + fw_bld =le16_to_cpu (resp->hwrm_fw_build); + fw_rsv =le16_to_cpu (resp->hwrm_fw_patch); + len =FW_VER_STR_LEN ; + }else { + fw_maj = resp->hwrm_fw_maj_8b; + fw_min = resp->hwrm_fw_min_8b; + fw_bld = resp->hwrm_fw_bld_8b; + fw_rsv = resp->hwrm_fw_rsvd_8b; + len =BC_HWRM_STR_LEN ; + } + bp->fw_ver_code =BNXT_FW_VER_CODE (fw_maj, fw_min, fw_bld, fw_rsv); +snprintf (bp->fw_ver_str, len,"%d.%d.%d.%d" , fw_maj, fw_min, fw_bld, + fw_rsv);if (strlen (resp->active_pkg_name)) {int fw_ver_len =strlen (bp->fw_ver_str);
drivers/net/ethernet/broadcom/bnxt/bnxt.h +4 -0
@@ -1729,6 +1729,10 @@ struct bnxt {#define PHY_VER_STR_LEN (FW_VER_STR_LEN - BC_HWRM_STR_LEN)char fw_ver_str[FW_VER_STR_LEN ];char hwrm_ver_supp[FW_VER_STR_LEN ]; +u64 fw_ver_code; +#define BNXT_FW_VER_CODE (maj, min, bld, rsv) \ + ((u64)(maj) << 48 | (u64)(min) << 32 | (u64)(bld) << 16 | (rsv)) +__be16 vxlan_port;u8 vxlan_port_cnt;__le16 vxlan_fw_dst_port_id;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 29/265 bnxt_en: Do not enable legacy TX push on older firmware.
In reply to Sasha LevinFrom: Michael Chan <[email protected]>
[ Upstream commit fed7edd18143c68c63ea049999a7e861123de6de ]
Older firmware may not support legacy TX push properly and may not be disabling it. So we check certain firmware versions that may have this problem and disable legacy TX push unconditionally.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 -1
@@ -6953,7 +6953,8 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) bp->fw_cap |=BNXT_FW_CAP_ERR_RECOVER_RELOAD ; bp->tx_push_thresh =0 ; -if (flags &FUNC_QCAPS_RESP_FLAGS_PUSH_MODE_SUPPORTED ) +if ((flags &FUNC_QCAPS_RESP_FLAGS_PUSH_MODE_SUPPORTED ) && +BNXT_FW_MAJ (bp) >217 ) bp->tx_push_thresh =BNXT_TX_PUSH_THRESH ; hw_resc->max_rsscos_ctxs =le16_to_cpu (resp->max_rsscos_ctx);
drivers/net/ethernet/broadcom/bnxt/bnxt.h +1 -0
@@ -1732,6 +1732,7 @@ struct bnxt {u64 fw_ver_code;#define BNXT_FW_VER_CODE (maj, min, bld, rsv) \ ((u64)(maj) << 48 | (u64)(min) << 32 | (u64)(bld) << 16 | (rsv)) +#define BNXT_FW_MAJ (bp) ((bp)->fw_ver_code >> 48)__be16 vxlan_port;u8 vxlan_port_cnt;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 30/265 bnxt_en: Fix statistics counters issue during ifdown with older firmware.
In reply to Sasha LevinFrom: Michael Chan <[email protected]>
[ Upstream commit c2dec363feb41544a76c8083aca2378990e17166 ]
On older firmware, the hardware statistics are not cleared when the driver frees the hardware stats contexts during ifdown. The driver expects these stats to be cleared and saves a copy before freeing the stats contexts. During the next ifup, the driver will likely allocate the same hardware stats contexts and this will cause a big increase in the counters as the old counters are added back to the saved counters.
We fix it by making an additional firmware call to clear the counters before freeing the hw stats contexts when the firmware is the older 20.x firmware.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +7 -1
@@ -6293,6 +6293,7 @@ int bnxt_hwrm_set_coal(struct bnxt *bp)static void bnxt_hwrm_stat_ctx_free (struct bnxt *bp) { +struct hwrm_stat_ctx_clr_stats_input req0 = {0 };struct hwrm_stat_ctx_free_input req = {0 };int i;
@@ -6302,6 +6303,7 @@ static void bnxt_hwrm_stat_ctx_free(struct bnxt *bp)if (BNXT_CHIP_TYPE_NITRO_A0 (bp))return ; +bnxt_hwrm_cmd_hdr_init (bp, &req0,HWRM_STAT_CTX_CLR_STATS ,-1 ,-1 );bnxt_hwrm_cmd_hdr_init (bp, &req,HWRM_STAT_CTX_FREE ,-1 ,-1 );mutex_lock (&bp->hwrm_cmd_lock);
@@ -6311,7 +6313,11 @@ static void bnxt_hwrm_stat_ctx_free(struct bnxt *bp)if (cpr->hw_stats_ctx_id !=INVALID_STATS_CTX_ID ) { req.stat_ctx_id =cpu_to_le32 (cpr->hw_stats_ctx_id); - +if (BNXT_FW_MAJ (bp) <=20 ) { + req0.stat_ctx_id = req.stat_ctx_id; +_hwrm_send_message (bp, &req0,sizeof (req0), +HWRM_CMD_TIMEOUT ); + }_hwrm_send_message (bp, &req,sizeof (req),HWRM_CMD_TIMEOUT );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 31/265 bnxt_en: Read VPD info only for PFs
In reply to Sasha LevinFrom: Vasundhara Volam <[email protected]>
[ Upstream commit c55e28a8b43fcd7dc71868bd165705bc7741a7ca ]
Virtual functions does not have VPD information. This patch modifies calling bnxt_read_vpd_info() only for PFs and avoids an unnecessary error log.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 -1
@@ -11884,7 +11884,8 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) dev->ethtool_ops = &bnxt_ethtool_ops;pci_set_drvdata (pdev, dev); -bnxt_vpd_read_info (bp); +if (BNXT_PF (bp)) +bnxt_vpd_read_info (bp); rc =bnxt_alloc_hwrm_resources (bp);if (rc)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 32/265 net: phylink: fix ethtool -A with attached PHYs
In reply to Sasha LevinFrom: Russell King <[email protected]>
[ Upstream commit c718af2d00a37587b09e5958d142da7569f3d55b ]
Fix a phylink's ethtool set_pauseparam support deadlock caused by phylib interacting with phylink: we must not hold the state lock while calling phylib functions that may call into phylink_phy_change().
--- drivers/net/phy/phylink.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/net/phy/phylink.c +11 -9
@@ -1519,18 +1519,20 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl,linkmode_set_pause (config->advertising, pause->tx_pause, pause->rx_pause); -/* If we have a PHY, phylib will call our link state function if the -* mode has changed, which will trigger a resolve and update the MAC -* configuration. +if (!pl->phydev && !test_bit (PHYLINK_DISABLE_STOPPED , + &pl->phylink_disable_state)) +phylink_pcs_config (pl, true, &pl->link_config); + +mutex_unlock (&pl->state_mutex); + +/* If we have a PHY, a change of the pause frame advertisement will +* cause phylib to renegotiate (if AN is enabled) which will in turn +* call our phylink_phy_change() and trigger a resolve. Note that +* we can't hold our state mutex while calling phy_set_asym_pause(). */ -if (pl->phydev) { +if (pl->phydev)phy_set_asym_pause (pl->phydev, pause->rx_pause, pause->tx_pause); - }else if (!test_bit (PHYLINK_DISABLE_STOPPED , - &pl->phylink_disable_state)) { -phylink_pcs_config (pl, true, &pl->link_config); - } -mutex_unlock (&pl->state_mutex);return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 33/265 net: phylink: ensure manual pause mode configuration takes effect
In reply to Sasha LevinFrom: Russell King <[email protected]>
[ Upstream commit 2e919bc446faee429ac862a6cdb5e40017051f6b ]
We have been relying on link events and mac_config() when the manual pause modes are changed. With recent developments, such as moving the programming of link state to mac_link_up(), this no longer works.
To ensure that we update the MAC, we must generate a link-down followed by a link-up event; we can do that by setting mac_link_dropped and triggering a resolve.
--- drivers/net/phy/phylink.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-)
drivers/net/phy/phylink.c +22 -5
@@ -1480,6 +1480,8 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl, struct ethtool_pauseparam *pause) {struct phylink_link_state *config = &pl->link_config; +bool manual_changed; +int pause_state;ASSERT_RTNL ();
@@ -1494,15 +1496,15 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl, !pause->autoneg && pause->rx_pause != pause->tx_pause)return -EINVAL ; -mutex_lock (&pl->state_mutex); - config->pause =0 ; + pause_state =0 ;if (pause->autoneg) - config->pause |=MLO_PAUSE_AN ; + pause_state |=MLO_PAUSE_AN ;if (pause->rx_pause) - config->pause |=MLO_PAUSE_RX ; + pause_state |=MLO_PAUSE_RX ;if (pause->tx_pause) - config->pause |=MLO_PAUSE_TX ; + pause_state |=MLO_PAUSE_TX ; +mutex_lock (&pl->state_mutex);/* * See the comments for linkmode_set_pause(), wrt the deficiencies * with the current implementation. A solution to this issue would
@@ -1519,6 +1521,12 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl,linkmode_set_pause (config->advertising, pause->tx_pause, pause->rx_pause); + manual_changed = (config->pause ^ pause_state) &MLO_PAUSE_AN || + (!(pause_state &MLO_PAUSE_AN ) && + (config->pause ^ pause_state) &MLO_PAUSE_TXRX_MASK ); + + config->pause = pause_state; +if (!pl->phydev && !test_bit (PHYLINK_DISABLE_STOPPED , &pl->phylink_disable_state))phylink_pcs_config (pl, true, &pl->link_config);
@@ -1534,6 +1542,15 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl,phy_set_asym_pause (pl->phydev, pause->rx_pause, pause->tx_pause); +/* If the manual pause settings changed, make sure we trigger a +* resolve to update their state; we can not guarantee that the +* link will cycle. +*/ +if (manual_changed) { + pl->mac_link_dropped = true; +phylink_run_resolve (pl); + } +return 0 ; }EXPORT_SYMBOL_GPL (phylink_ethtool_set_pauseparam);
Signature · 1 line
2.25.1
Hi Sasha,
Quoted 6 lines · Sasha Levin
This is the start of the stable review cycle for the 5.7.7 release. There are 265 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 6 lines
Responses should be made by Wed 01 Jul 2020 03:14:48 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.7.y&id2=v5.7.6
Looks like patch naming convention has changed. My scripts look for the following convention Greg uses. Are you planning to use the above going forward? My scripts failed looking for the usual naming convention.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.7.6-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.7.y
and the diffstat can be found below.
thanks,
-- Shuah
Sasha Levin
maintainerQuoted 21 lines · Shuah Khan
Hi Sasha,
Quoted 6 lines · Sasha Levin
This is the start of the stable review cycle for the 5.7.7 release. There are 265 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 6 lines
Responses should be made by Wed 01 Jul 2020 03:14:48 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.7.y&id2=v5.7.6Looks like patch naming convention has changed. My scripts look for the following convention Greg uses. Are you planning to use the above going forward? My scripts failed looking for the usual naming convention.
Quoted 5 lines
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.7.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.7.y
and the diffstat can be found below.
Sorry for that. I was hoping to avoid using the signed upload mechanism Greg was using by simply pointing the links to automatically generated patches on cgit (the git.kernel.org interface).
Would it be ok to change the pattern matching here? Something like this should work for both Greg's format and my own (and whatever may come next):
grep -A1 "The whole patch series can be found in one patch at:" | tail -n1 | sed 's/\t//'
Signature · 2 lines
Thanks, Sasha
Greg Kroah-Hartman
maintainerQuoted 32 lines · Sasha Levin
Quoted 21 lines · Shuah Khan
Hi Sasha,
Quoted 6 lines · Sasha Levin
This is the start of the stable review cycle for the 5.7.7 release. There are 265 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 6 lines
Responses should be made by Wed 01 Jul 2020 03:14:48 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.7.y&id2=v5.7.6Looks like patch naming convention has changed. My scripts look for the following convention Greg uses. Are you planning to use the above going forward? My scripts failed looking for the usual naming convention.
Quoted 5 lines
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.7.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.7.y
and the diffstat can be found below.Sorry for that. I was hoping to avoid using the signed upload mechanism Greg was using by simply pointing the links to automatically generated patches on cgit (the git.kernel.org interface).
Quoted 5 lines
Would it be ok to change the pattern matching here? Something like this should work for both Greg's format and my own (and whatever may come next):
grep -A1 "The whole patch series can be found in one patch at:" | tail -n1 | sed 's/\t//'
If those don't work, I can still push out -rc1 patches.
It might be best given that the above -rc.git tree is unstable and can, and will, change, and patches stored on kernel.org will not.
thanks,
greg k-h
Sasha Levin
maintainerQuoted 37 lines · Greg Kroah-Hartman
Quoted 36 lines · Sasha Levin
Quoted 21 lines · Shuah Khan
Hi Sasha,
Quoted 6 lines · Sasha Levin
This is the start of the stable review cycle for the 5.7.7 release. There are 265 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 6 lines
Responses should be made by Wed 01 Jul 2020 03:14:48 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.7.y&id2=v5.7.6Looks like patch naming convention has changed. My scripts look for the following convention Greg uses. Are you planning to use the above going forward? My scripts failed looking for the usual naming convention.
Quoted 5 lines
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.7.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.7.y
and the diffstat can be found below.Sorry for that. I was hoping to avoid using the signed upload mechanism Greg was using by simply pointing the links to automatically generated patches on cgit (the git.kernel.org interface).
Would it be ok to change the pattern matching here? Something like this should work for both Greg's format and my own (and whatever may come next):
Quoted 6 lines
Quoted 1 line
grep -A1 "The whole patch series can be found in one patch at:" | tail -n1 | sed 's/\t//'
If those don't work, I can still push out -rc1 patches.
It might be best given that the above -rc.git tree is unstable and can, and will, change, and patches stored on kernel.org will not.
That's a good point. Maybe we should push tags for -rc releases too? that would allow us to keep stable links using the git.kernel.org interface.
Signature · 2 lines
Thanks, Sasha
Hello!
Quoted 39 lines · Sasha Levin
Quoted 37 lines · Greg Kroah-Hartman
Quoted 36 lines · Sasha Levin
Quoted 21 lines · Shuah Khan
Hi Sasha,
Quoted 6 lines · Sasha Levin
This is the start of the stable review cycle for the 5.7.7 release. There are 265 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 6 lines
Responses should be made by Wed 01 Jul 2020 03:14:48 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.7.y&id2=v5.7.6Looks like patch naming convention has changed. My scripts look for the following convention Greg uses. Are you planning to use the above going forward? My scripts failed looking for the usual naming convention.
Quoted 5 lines
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.7.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.7.y
and the diffstat can be found below.Sorry for that. I was hoping to avoid using the signed upload mechanism Greg was using by simply pointing the links to automatically generated patches on cgit (the git.kernel.org interface).
Would it be ok to change the pattern matching here? Something like this should work for both Greg's format and my own (and whatever may come next):
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
grep -A1 "The whole patch series can be found in one patch at:" | tail -n1 | sed 's/\t//'
If those don't work, I can still push out -rc1 patches.
It might be best given that the above -rc.git tree is unstable and can, and will, change, and patches stored on kernel.org will not.
That's a good point. Maybe we should push tags for -rc releases too?
That would be GREAT for those CI's or processes looking for a definite trigger to use.
Greetings!
Daniel Díaz
[email protected]
Greg Kroah-Hartman
maintainerQuoted 40 lines · Sasha Levin
Quoted 39 lines · Greg Kroah-Hartman
Quoted 37 lines · Sasha Levin
Quoted 21 lines · Shuah Khan
Hi Sasha,
Quoted 6 lines · Sasha Levin
This is the start of the stable review cycle for the 5.7.7 release. There are 265 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 6 lines
Responses should be made by Wed 01 Jul 2020 03:14:48 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.7.y&id2=v5.7.6Looks like patch naming convention has changed. My scripts look for the following convention Greg uses. Are you planning to use the above going forward? My scripts failed looking for the usual naming convention.
Quoted 5 lines
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.7.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.7.y
and the diffstat can be found below.Sorry for that. I was hoping to avoid using the signed upload mechanism Greg was using by simply pointing the links to automatically generated patches on cgit (the git.kernel.org interface).
Would it be ok to change the pattern matching here? Something like this should work for both Greg's format and my own (and whatever may come next):
grep -A1 "The whole patch series can be found in one patch at:" | tail -n1 | sed 's/\t//'
Quoted 8 lines
Quoted 4 lines
If those don't work, I can still push out -rc1 patches.
It might be best given that the above -rc.git tree is unstable and can, and will, change, and patches stored on kernel.org will not.
That's a good point. Maybe we should push tags for -rc releases too? that would allow us to keep stable links using the git.kernel.org interface.
If we really want to do this, then yes, we could. But that kind of goes against what we (well I) have been doing in the past with that tree...
thanks,
greg k-h
Sasha Levin
maintainerQuoted 46 lines · Greg Kroah-Hartman
Quoted 45 lines · Sasha Levin
Quoted 43 lines · Greg Kroah-Hartman
Quoted 32 lines · Sasha Levin
Quoted 21 lines · Shuah Khan
Hi Sasha,
Quoted 6 lines · Sasha Levin
This is the start of the stable review cycle for the 5.7.7 release. There are 265 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 6 lines
Responses should be made by Wed 01 Jul 2020 03:14:48 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.7.y&id2=v5.7.6Looks like patch naming convention has changed. My scripts look for the following convention Greg uses. Are you planning to use the above going forward? My scripts failed looking for the usual naming convention.
Quoted 5 lines
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.7.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.7.y
and the diffstat can be found below.Sorry for that. I was hoping to avoid using the signed upload mechanism Greg was using by simply pointing the links to automatically generated patches on cgit (the git.kernel.org interface).
Quoted 5 lines
Would it be ok to change the pattern matching here? Something like this should work for both Greg's format and my own (and whatever may come next):
grep -A1 "The whole patch series can be found in one patch at:" | tail -n1 | sed 's/\t//'
If those don't work, I can still push out -rc1 patches.
It might be best given that the above -rc.git tree is unstable and can, and will, change, and patches stored on kernel.org will not.
Quoted 6 lines
Quoted 3 lines
That's a good point. Maybe we should push tags for -rc releases too? that would allow us to keep stable links using the git.kernel.org interface.
If we really want to do this, then yes, we could. But that kind of goes against what we (well I) have been doing in the past with that tree...
We've been force pushing it, yes, but if we add tags it would just keep older version around so I don't think it would change much for our workflow, but it would make it easy to get to older versions.
Signature · 2 lines
Thanks, Sasha
Quoted 64 lines · Sasha Levin
Quoted 63 lines · Greg Kroah-Hartman
Quoted 61 lines · Sasha Levin
Quoted 7 lines · Greg Kroah-Hartman
Quoted 6 lines · Sasha Levin
Quoted 5 lines · Shuah Khan
Hi Sasha,
Quoted 2 lines · Sasha Levin
This is the start of the stable review cycle for the 5.7.7
release.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
There are 265 patches in this series, all will be posted as a
response
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
to this one. If anyone has any issues with these being
applied, please
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
let me know.
Responses should be made by Wed 01 Jul 2020 03:14:48 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 1 line
Looks like patch naming convention has changed. My scripts look for the following convention Greg uses. Are you planning to use the above going forward? My scripts failed looking for the usual naming convention.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.7.6-rc1.gz
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.7.yQuoted 3 lines
Quoted 3 lines
Quoted 1 line
and the diffstat can be found below.
Sorry for that. I was hoping to avoid using the signed upload
mechanism
Quoted 1 line
Quoted 1 line
Greg was using by simply pointing the links to automatically
generated
Quoted 3 lines
Quoted 3 lines
patches on cgit (the git.kernel.org interface).
Would it be ok to change the pattern matching here? Something
like this
Quoted 4 lines
Quoted 4 lines
should work for both Greg's format and my own (and whatever may come next):
grep -A1 "The whole patch series can be found in one patch
at:" | tail -n1 | sed 's/\t//'
Quoted 4 lines
If those don't work, I can still push out -rc1 patches.
It might be best given that the above -rc.git tree is unstable and
can,
Quoted 1 line
and will, change, and patches stored on kernel.org will not.
That's a good point. Maybe we should push tags for -rc releases too? that would allow us to keep stable links using the git.kernel.org interface.
Quoted 7 lines
Quoted 2 lines
If we really want to do this, then yes, we could. But that kind of goes against what we (well I) have been doing in the past with that tree...
We've been force pushing it, yes, but if we add tags it would just keep older version around so I don't think it would change much for our workflow, but it would make it easy to get to older versions.
I can make changes to my scripts as long as the process is consistent for stable releases. Let mw know what you come up with, I will make adjustments to my scripts.
thanks,
-- Shuah
Sasha Levin
maintainerPATCH 34/265 sch_cake: don't try to reallocate or unshare skb unconditionally
In reply to Sasha LevinFrom: Ilya Ponetayev <[email protected]>
[ Upstream commit 9208d2863ac689a563b92f2161d8d1e7127d0add ]
cake_handle_diffserv() tries to linearize mac and network header parts of skb and to make it writable unconditionally. In some cases it leads to full skb reallocation, which reduces throughput and increases CPU load. Some measurements of IPv4 forward + NAPT on MIPS router with 580 MHz single-core CPU was conducted. It appears that on kernel 4.9 skb_try_make_writable() reallocates skb, if skb was allocated in ethernet driver via so-called 'build skb' method from page cache (it was discovered by strange increase of kmalloc-2048 slab at first).
Obtain DSCP value via read-only skb_header_pointer() call, and leave linearization only for DSCP bleaching or ECN CE setting. And, as an additional optimisation, skip diffserv parsing entirely if it is not needed by the current configuration.
--- net/sched/sch_cake.c | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-)
net/sched/sch_cake.c +30 -11
@@ -1516,30 +1516,49 @@ static unsigned int cake_drop(struct Qdisc *sch, struct sk_buff **to_free)static u8 cake_handle_diffserv (struct sk_buff *skb,u16 wash) { -int wlen =skb_network_offset (skb); +const int offset =skb_network_offset (skb); +u16 *buf, buf_;u8 dscp;switch (tc_skb_protocol (skb)) {case htons (ETH_P_IP ): - wlen +=sizeof (struct iphdr ); -if (!pskb_may_pull (skb, wlen) || -skb_try_make_writable (skb, wlen)) + buf =skb_header_pointer (skb, offset,sizeof (buf_), &buf_); +if (unlikely (!buf))return 0 ; - dscp =ipv4_get_dsfield (ip_hdr (skb)) >>2 ; -if (wash && dscp) +/* ToS is in the second byte of iphdr */ + dscp =ipv4_get_dsfield ((struct iphdr *)buf) >>2 ; + +if (wash && dscp) { +const int wlen = offset +sizeof (struct iphdr ); + +if (!pskb_may_pull (skb, wlen) || +skb_try_make_writable (skb, wlen)) +return 0 ; +ipv4_change_dsfield (ip_hdr (skb),INET_ECN_MASK ,0 ); + } +return dscp;case htons (ETH_P_IPV6 ): - wlen +=sizeof (struct ipv6hdr ); -if (!pskb_may_pull (skb, wlen) || -skb_try_make_writable (skb, wlen)) + buf =skb_header_pointer (skb, offset,sizeof (buf_), &buf_); +if (unlikely (!buf))return 0 ; - dscp =ipv6_get_dsfield (ipv6_hdr (skb)) >>2 ; -if (wash && dscp) +/* Traffic class is in the first and second bytes of ipv6hdr */ + dscp =ipv6_get_dsfield ((struct ipv6hdr *)buf) >>2 ; + +if (wash && dscp) { +const int wlen = offset +sizeof (struct ipv6hdr ); + +if (!pskb_may_pull (skb, wlen) || +skb_try_make_writable (skb, wlen)) +return 0 ; +ipv6_change_dsfield (ipv6_hdr (skb),INET_ECN_MASK ,0 ); + } +return dscp;case htons (ETH_P_ARP ):
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 35/265 sch_cake: don't call diffserv parsing code when it is not needed
In reply to Sasha LevinFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 8c95eca0bb8c4bd2231a0d581f1ad0d50c90488c ]
As a further optimisation of the diffserv parsing codepath, we can skip it entirely if CAKE is configured to neither use diffserv-based classification, nor to zero out the diffserv bits.
--- net/sched/sch_cake.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
net/sched/sch_cake.c +9 -4
@@ -1514,7 +1514,7 @@ static unsigned int cake_drop(struct Qdisc *sch, struct sk_buff **to_free)return idx + (tin <<16 ); } -static u8 cake_handle_diffserv (struct sk_buff *skb,u16 wash) +static u8 cake_handle_diffserv (struct sk_buff *skb,bool wash) {const int offset =skb_network_offset (skb);u16 *buf, buf_;
@@ -1575,14 +1575,17 @@ static struct cake_tin_data *cake_select_tin(struct Qdisc *sch, {struct cake_sched_data *q =qdisc_priv (sch);u32 tin, mark; +bool wash;u8 dscp;/* Tin selection: Default to diffserv-based selection, allow overriding -* using firewall marks or skb->priority. +* using firewall marks or skb->priority. Call DSCP parsing early if +* wash is enabled, otherwise defer to below to skip unneeded parsing. */ - dscp =cake_handle_diffserv (skb, - q->rate_flags &CAKE_FLAG_WASH ); mark = (skb->mark & q->fwmark_mask) >> q->fwmark_shft; + wash = !!(q->rate_flags &CAKE_FLAG_WASH ); +if (wash) + dscp =cake_handle_diffserv (skb, wash);if (q->tin_mode ==CAKE_DIFFSERV_BESTEFFORT ) tin =0 ;
@@ -1596,6 +1599,8 @@ static struct cake_tin_data *cake_select_tin(struct Qdisc *sch, tin = q->tin_order[TC_H_MIN (skb->priority) -1 ]; else { +if (!wash) + dscp =cake_handle_diffserv (skb, wash); tin = q->tin_index[dscp];if (unlikely (tin >= q->tin_cnt))
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 36/265 sch_cake: fix a few style nits
In reply to Sasha LevinFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 3f608f0c41360b11b04c763f348b712f651c8bac ]
I spotted a few nits when comparing the in-tree version of sch_cake with the out-of-tree one: A redundant error variable declaration shadowing an outer declaration, and an indentation alignment issue. Fix both of these.
--- net/sched/sch_cake.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/sched/sch_cake.c +2 -2
@@ -2678,7 +2678,7 @@ static int cake_init(struct Qdisc *sch, struct nlattr *opt,qdisc_watchdog_init (&q->watchdog, sch);if (opt) { -int err =cake_change (sch, opt, extack); + err =cake_change (sch, opt, extack);if (err)return err;
@@ -2995,7 +2995,7 @@ static int cake_dump_class_stats(struct Qdisc *sch, unsigned long cl,PUT_STAT_S32 (BLUE_TIMER_US ,ktime_to_us (ktime_sub (now, - flow->cvars.blue_timer))); + flow->cvars.blue_timer))); }if (flow->cvars.dropping) { PUT_STAT_S32(DROP_NEXT_US,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 37/265 tcp_cubic: fix spurious HYSTART_DELAY exit upon drop in min RTT
In reply to Sasha LevinFrom: Neal Cardwell <[email protected]>
[ Upstream commit b344579ca8478598937215f7005d6c7b84d28aee ]
Mirja Kuehlewind reported a bug in Linux TCP CUBIC Hystart, where Hystart HYSTART_DELAY mechanism can exit Slow Start spuriously on an ACK when the minimum rtt of a connection goes down. From inspection it is clear from the existing code that this could happen in an example like the following:
o The first 8 RTT samples in a round trip are 150ms, resulting in a curr_rtt of 150ms and a delay_min of 150ms.
o The 9th RTT sample is 100ms. The curr_rtt does not change after the first 8 samples, so curr_rtt remains 150ms. But delay_min can be lowered at any time, so delay_min falls to 100ms. The code executes the HYSTART_DELAY comparison between curr_rtt of 150ms and delay_min of 100ms, and the curr_rtt is declared far enough above delay_min to force a (spurious) exit of Slow start.
The fix here is simple: allow every RTT sample in a round trip to lower the curr_rtt.
--- net/ipv4/tcp_cubic.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
net/ipv4/tcp_cubic.c +2 -3
@@ -432,10 +432,9 @@ static void hystart_update(struct sock *sk, u32 delay) if (hystart_detect & HYSTART_DELAY) { /* obtain the minimum delay of more than sampling packets */ + if (ca->curr_rtt > delay) + ca->curr_rtt = delay; if (ca->sample_cnt < HYSTART_MIN_SAMPLES) { - if (ca->curr_rtt > delay) - ca->curr_rtt = delay; - ca->sample_cnt++; } else { if (ca->curr_rtt > ca->delay_min +
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 38/265 bpf: tcp: bpf_cubic: fix spurious HYSTART_DELAY exit upon drop in min RTT
In reply to Sasha LevinFrom: Neal Cardwell <[email protected]>
[ Upstream commit 7d21d54d624777358ab6c7be7ff778808fef70ba ]
Apply the fix from:
"tcp_cubic: fix spurious HYSTART_DELAY exit upon drop in min RTT"
to the BPF implementation of TCP CUBIC congestion control.
Repeating the commit description here for completeness:
Mirja Kuehlewind reported a bug in Linux TCP CUBIC Hystart, where Hystart HYSTART_DELAY mechanism can exit Slow Start spuriously on an ACK when the minimum rtt of a connection goes down. From inspection it is clear from the existing code that this could happen in an example like the following:
o The first 8 RTT samples in a round trip are 150ms, resulting in a curr_rtt of 150ms and a delay_min of 150ms.
o The 9th RTT sample is 100ms. The curr_rtt does not change after the first 8 samples, so curr_rtt remains 150ms. But delay_min can be lowered at any time, so delay_min falls to 100ms. The code executes the HYSTART_DELAY comparison between curr_rtt of 150ms and delay_min of 100ms, and the curr_rtt is declared far enough above delay_min to force a (spurious) exit of Slow start.
The fix here is simple: allow every RTT sample in a round trip to lower the curr_rtt.
--- tools/testing/selftests/bpf/progs/bpf_cubic.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/progs/bpf_cubic.c +2 -3
@@ -480,10 +480,9 @@ static __always_inline void hystart_update(struct sock *sk, __u32 delay) if (hystart_detect & HYSTART_DELAY) { /* obtain the minimum delay of more than sampling packets */ + if (ca->curr_rtt > delay) + ca->curr_rtt = delay; if (ca->sample_cnt < HYSTART_MIN_SAMPLES) { - if (ca->curr_rtt > delay) - ca->curr_rtt = delay; - ca->sample_cnt++; } else { if (ca->curr_rtt > ca->delay_min +
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 39/265 net: macb: undo operations in case of failure
In reply to Sasha LevinFrom: Claudiu Beznea <[email protected]>
[ Upstream commit faa620876b01d6744f1599e279042bb8149247ab ]
Undo previously done operation in case macb_phylink_connect() fails. Since macb_reset_hw() is the 1st undo operation the napi_exit label was renamed to reset_hw.
--- drivers/net/ethernet/cadence/macb_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/cadence/macb_main.c +4 -2
@@ -2558,7 +2558,7 @@ static int macb_open(struct net_device *dev) err =macb_phylink_connect (bp);if (err) - goto napi_exit; + goto reset_hw;netif_tx_start_all_queues (dev);
@@ -2567,9 +2567,11 @@ static int macb_open(struct net_device *dev)return 0 ; -napi_exit: +reset_hw: +macb_reset_hw (bp);for (q =0 , queue = bp->queues; q < bp->num_queues; ++q, ++queue)napi_disable (&queue->napi); +macb_free_consistent (bp); pm_exit:pm_runtime_put_sync (&bp->pdev->dev);return err;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 40/265 r8169: fix firmware not resetting tp->ocp_base
In reply to Sasha LevinFrom: Heiner Kallweit <[email protected]>
[ Upstream commit 89fbd26cca7ec9e82ec4787a4b6e95939b57d073 ]
Typically the firmware takes care that tp->ocp_base is reset to its default value. That's not the case (at least) for RTL8117. As a result subsequent PHY access reads/writes the wrong page and the link is broken. Fix this be resetting tp->ocp_base explicitly.
--- drivers/net/ethernet/realtek/r8169_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/realtek/r8169_main.c +4 -1
@@ -2192,8 +2192,11 @@ static void rtl_release_firmware(struct rtl8169_private *tp)void r8169_apply_firmware (struct rtl8169_private *tp) {/* TODO: release firmware if rtl_fw_write_firmware signals failure. */ -if (tp->rtl_fw) +if (tp->rtl_fw) {rtl_fw_write_firmware (tp, tp->rtl_fw); +/* At least one firmware doesn't reset tp->ocp_base. */ + tp->ocp_base =OCP_STD_PHY_BASE ; + } }static void rtl8168_config_eee_mac (struct rtl8169_private *tp)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 41/265 mptcp: drop sndr_key in mptcp_syn_options
In reply to Sasha LevinFrom: Geliang Tang <[email protected]>
[ Upstream commit b562f58bbc12444219b74a5d6524977a3d87a022 ]
In RFC 8684, we don't need to send sndr_key in SYN package anymore, so drop it.
--- net/mptcp/options.c | 2 -- 1 file changed, 2 deletions(-)
net/mptcp/options.c +0 -2
@@ -336,9 +336,7 @@ bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb,*/ subflow->snd_isn =TCP_SKB_CB (skb)->end_seq;if (subflow->request_mptcp) { -pr_debug ("local_key=%llu" , subflow->local_key); opts->suboptions =OPTION_MPTCP_MPC_SYN ; - opts->sndr_key = subflow->local_key; *size =TCPOLEN_MPTCP_MPC_SYN ;return true; }else if (subflow->request_join) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 42/265 mptcp: fix memory leak in mptcp_subflow_create_socket()
In reply to Sasha LevinFrom: Wei Yongjun <[email protected]>
[ Upstream commit b8ad540dd4e40566c520dff491fc06c71ae6b989 ]
socket malloced by sock_create_kern() should be release before return in the error handling, otherwise it cause memory leak.
unreferenced object 0xffff88810910c000 (size 1216):
comm "00000003_test_m", pid 12238, jiffies 4295050289 (age 54.237s) hex dump (first 32 bytes):
01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 2f 30 0a 81 88 ff ff ........./0.....
backtrace:
[<00000000e877f89f>] sock_alloc_inode+0x18/0x1c0
[<0000000093d1dd51>] alloc_inode+0x63/0x1d0
[<000000005673fec6>] new_inode_pseudo+0x14/0xe0
[<00000000b5db6be8>] sock_alloc+0x3c/0x260
[<00000000e7e3cbb2>] __sock_create+0x89/0x620
[<0000000023e48593>] mptcp_subflow_create_socket+0xc0/0x5e0
[<00000000419795e4>] __mptcp_socket_create+0x1ad/0x3f0
[<00000000b2f942e8>] mptcp_stream_connect+0x281/0x4f0
[<00000000c80cd5cc>] __sys_connect_file+0x14d/0x190
[<00000000dc761f11>] __sys_connect+0x128/0x160
[<000000008b14e764>] __x64_sys_connect+0x6f/0xb0
[<000000007b4f93bd>] do_syscall_64+0xa1/0x530
[<00000000d3e770b6>] entry_SYSCALL_64_after_hwframe+0x49/0xb3--- net/mptcp/subflow.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/mptcp/subflow.c +3 -1
@@ -1015,8 +1015,10 @@ int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock) err =tcp_set_ulp (sf->sk,"mptcp" );release_sock (sf->sk); -if (err) +if (err) { +sock_release (sf);return err; + }/* the newly created socket really belongs to the owning MPTCP master * socket, even if for additional subflows the allocation is performed
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 43/265 net: ethtool: add missing NETIF_F_GSO_FRAGLIST feature string
In reply to Sasha LevinFrom: Alexander Lobakin <[email protected]>
[ Upstream commit eddbf5d0204e550ee59de02bdc19fe90d4203dd6 ]
Commit 3b33583265ed ("net: Add fraglist GRO/GSO feature flags") missed an entry for NETIF_F_GSO_FRAGLIST in netdev_features_strings array. As a result, fraglist GSO feature is not shown in 'ethtool -k' output and can't be toggled on/off.
The fix is trivial.
--- net/ethtool/common.c | 1 + 1 file changed, 1 insertion(+)
net/ethtool/common.c +1 -0
@@ -44,6 +44,7 @@ const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = { [NETIF_F_GSO_SCTP_BIT] = "tx-sctp-segmentation", [NETIF_F_GSO_ESP_BIT] = "tx-esp-segmentation", [NETIF_F_GSO_UDP_L4_BIT] = "tx-udp-segmentation", + [NETIF_F_GSO_FRAGLIST_BIT] = "tx-gso-list", [NETIF_F_FCOE_CRC_BIT] = "tx-checksum-fcoe-crc", [NETIF_F_SCTP_CRC_BIT] = "tx-checksum-sctp",
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 44/265 net: macb: call pm_runtime_put_sync on failure path
In reply to Sasha LevinFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 0eaf228d574bd82a9aed73e3953bfb81721f4227 ]
Call pm_runtime_put_sync() on failure path of at91ether_open.
--- drivers/net/ethernet/cadence/macb_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/cadence/macb_main.c +6 -2
@@ -3837,7 +3837,7 @@ static int at91ether_open(struct net_device *dev) ret =at91ether_start (dev);if (ret) -return ret; + goto pm_exit;/* Enable MAC interrupts */ macb_writel(lp, IER, MACB_BIT(RCOMP) |
@@ -3850,11 +3850,15 @@ static int at91ether_open(struct net_device *dev) ret =macb_phylink_connect (lp);if (ret) -return ret; + goto pm_exit;netif_start_queue (dev);return 0 ; + +pm_exit: +pm_runtime_put_sync (&lp->pdev->dev); +return ret; }/* Close the interface */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 45/265 net: phy: mscc: avoid skcipher API for single block AES encryption
In reply to Sasha LevinFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit 8acd2edbe0e8e36261d98d89ce91b810dd7f4b0d ]
The skcipher API dynamically instantiates the transformation object on request that implements the requested algorithm optimally on the given platform. This notion of optimality only matters for cases like bulk network or disk encryption, where performance can be a bottleneck, or in cases where the algorithm itself is not known at compile time.
In the mscc case, we are dealing with AES encryption of a single block, and so neither concern applies, and we are better off using the AES library interface, which is lightweight and safe for this kind of use.
Note that the scatterlist API does not permit references to buffers that are located on the stack, so the existing code is incorrect in any case, but avoiding the skcipher and scatterlist APIs entirely is the most straight-forward approach to fixing this.
--- drivers/net/phy/Kconfig | 3 +-- drivers/net/phy/mscc/mscc_macsec.c | 40 +++++++----------------------- 2 files changed, 10 insertions(+), 33 deletions(-)
drivers/net/phy/Kconfig +1 -2
@@ -461,8 +461,7 @@ config MICROCHIP_T1_PHY config MICROSEMI_PHY tristate "Microsemi PHYs" depends on MACSEC || MACSEC=n - select CRYPTO_AES - select CRYPTO_ECB + select CRYPTO_LIB_AES if MACSEC ---help--- Currently supports VSC8514, VSC8530, VSC8531, VSC8540 and VSC8541 PHYs
drivers/net/phy/mscc/mscc_macsec.c +9 -31
@@ -10,7 +10,7 @@#include <linux/phy.h> #include <dt-bindings/net/mscc-phy-vsc8531.h> -#include <crypto/skcipher.h> +#include <crypto/aes.h> #include <net/macsec.h>
@@ -500,39 +500,17 @@ static u32 vsc8584_macsec_flow_context_id(struct macsec_flow *flow)static int vsc8584_macsec_derive_key (const u8 key[MACSEC_KEYID_LEN ],u16 key_len,u8 hkey[16 ]) { -struct crypto_skcipher *tfm =crypto_alloc_skcipher ("ecb(aes)" ,0 ,0 ); -struct skcipher_request *req =NULL ; -struct scatterlist src, dst; -DECLARE_CRYPTO_WAIT (wait); -u32 input[4 ] = {0 }; +const u8 input[AES_BLOCK_SIZE ] = {0 }; +struct crypto_aes_ctx ctx;int ret; -if (IS_ERR (tfm)) -return PTR_ERR (tfm); - - req =skcipher_request_alloc (tfm,GFP_KERNEL ); -if (!req) { - ret = -ENOMEM ; - goto out; - } - -skcipher_request_set_callback (req,CRYPTO_TFM_REQ_MAY_BACKLOG | -CRYPTO_TFM_REQ_MAY_SLEEP , crypto_req_done, - &wait); - ret =crypto_skcipher_setkey (tfm, key, key_len); -if (ret <0 ) - goto out; - -sg_init_one (&src, input,16 ); -sg_init_one (&dst, hkey,16 ); -skcipher_request_set_crypt (req, &src, &dst,16 ,NULL ); - - ret =crypto_wait_req (crypto_skcipher_encrypt (req), &wait); + ret =aes_expandkey (&ctx, key, key_len); +if (ret) +return ret; -out: -skcipher_request_free (req); -crypto_free_skcipher (tfm); -return ret; +aes_encrypt (&ctx, hkey, input); +memzero_explicit (&ctx,sizeof (ctx)); +return 0 ; } static int vsc8584_macsec_transformation(struct phy_device *phydev,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 46/265 of: of_mdio: Correct loop scanning logic
In reply to Sasha LevinFrom: Florian Fainelli <[email protected]>
[ Upstream commit 5a8d7f126c97d04d893f5e5be2b286437a0d01b0 ]
Commit 209c65b61d94 ("drivers/of/of_mdio.c:fix of_mdiobus_register()") introduced a break of the loop on the premise that a successful registration should exit the loop. The premise is correct but not to code, because rc && rc != -ENODEV is just a special error condition, that means we would exit the loop even with rc == -ENODEV which is absolutely not correct since this is the error code to indicate to the MDIO bus layer that scanning should continue.
Fix this by explicitly checking for rc = 0 as the only valid condition to break out of the loop.
--- drivers/of/of_mdio.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/of/of_mdio.c +7 -2
@@ -303,10 +303,15 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) child, addr);if (of_mdiobus_child_is_phy (child)) { +/* -ENODEV is the return code that PHYLIB has +* standardized on to indicate that bus +* scanning should continue. +*/ rc =of_mdiobus_register_phy (mdio, child, addr); -if (rc && rc != -ENODEV ) +if (!rc) +break ; +if (rc != -ENODEV ) goto unregister; -break ; } } }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 47/265 wireguard: device: avoid circular netns references
In reply to Sasha LevinFrom: "Jason A. Donenfeld" <[email protected]>
[ Upstream commit 900575aa33a3eaaef802b31de187a85c4a4b4bd0 ]
Before, we took a reference to the creating netns if the new netns was different. This caused issues with circular references, with two wireguard interfaces swapping namespaces. The solution is to rather not take any extra references at all, but instead simply invalidate the creating netns pointer when that netns is deleted.
In order to prevent this from happening again, this commit improves the rough object leak tracking by allowing it to account for created and destroyed interfaces, aside from just peers and keys. That then makes it possible to check for the object leak when having two interfaces take a reference to each others' namespaces.
--- drivers/net/wireguard/device.c | 58 ++++++++++------------ drivers/net/wireguard/device.h | 3 +- drivers/net/wireguard/netlink.c | 14 ++++-- drivers/net/wireguard/socket.c | 25 +++++++--- tools/testing/selftests/wireguard/netns.sh | 13 ++++- 5 files changed, 67 insertions(+), 46 deletions(-)
drivers/net/wireguard/device.c +27 -31
@@ -45,17 +45,18 @@ static int wg_open(struct net_device *dev)if (dev_v6) dev_v6->cnf.addr_gen_mode =IN6_ADDR_GEN_MODE_NONE ; +mutex_lock (&wg->device_update_lock); ret =wg_socket_init (wg, wg->incoming_port);if (ret <0 ) -return ret; -mutex_lock (&wg->device_update_lock); + goto out;list_for_each_entry (peer, &wg->peer_list, peer_list) {wg_packet_send_staged_packets (peer);if (peer->persistent_keepalive_interval)wg_packet_send_keepalive (peer); } +out:mutex_unlock (&wg->device_update_lock); -return 0 ; +return ret; }#ifdef CONFIG_PM_SLEEP
@@ -225,6 +226,7 @@ static void wg_destruct(struct net_device *dev)list_del (&wg->device_list);rtnl_unlock ();mutex_lock (&wg->device_update_lock); +rcu_assign_pointer (wg->creating_net,NULL ); wg->incoming_port =0 ;wg_socket_reinit (wg,NULL ,NULL );/* The final references are cleared in the below calls to destroy_workqueue. */
@@ -240,13 +242,11 @@ static void wg_destruct(struct net_device *dev)skb_queue_purge (&wg->incoming_handshakes);free_percpu (dev->tstats);free_percpu (wg->incoming_handshakes_worker); -if (wg->have_creating_net_ref) -put_net (wg->creating_net);kvfree (wg->index_hashtable);kvfree (wg->peer_hashtable);mutex_unlock (&wg->device_update_lock); -pr_debug ("%s: Interface deleted\n" , dev->name); +pr_debug ("%s: Interface destroyed\n" , dev->name);free_netdev (dev); }
@@ -292,7 +292,7 @@ static int wg_newlink(struct net *src_net, struct net_device *dev,struct wg_device *wg =netdev_priv (dev);int ret = -ENOMEM ; - wg->creating_net = src_net; +rcu_assign_pointer (wg->creating_net, src_net);init_rwsem (&wg->static_identity.lock);mutex_init (&wg->socket_update_lock);mutex_init (&wg->device_update_lock);
@@ -393,30 +393,26 @@ static struct rtnl_link_ops link_ops __read_mostly = { .newlink = wg_newlink, }; -static int wg_netdevice_notification (struct notifier_block *nb, -unsigned long action,void *data) +static void wg_netns_pre_exit (struct net *net) { -struct net_device *dev = ((struct netdev_notifier_info *)data)->dev; -struct wg_device *wg =netdev_priv (dev); - -ASSERT_RTNL (); - -if (action !=NETDEV_REGISTER || dev->netdev_ops != &netdev_ops) -return 0 ; +struct wg_device *wg; -if (dev_net (dev) == wg->creating_net && wg->have_creating_net_ref) { -put_net (wg->creating_net); - wg->have_creating_net_ref = false; - }else if (dev_net (dev) != wg->creating_net && - !wg->have_creating_net_ref) { - wg->have_creating_net_ref = true; -get_net (wg->creating_net); +rtnl_lock (); +list_for_each_entry (wg, &device_list, device_list) { +if (rcu_access_pointer (wg->creating_net) == net) { +pr_debug ("%s: Creating namespace exiting\n" , wg->dev->name); +netif_carrier_off (wg->dev); +mutex_lock (&wg->device_update_lock); +rcu_assign_pointer (wg->creating_net,NULL ); +wg_socket_reinit (wg,NULL ,NULL ); +mutex_unlock (&wg->device_update_lock); + } } -return 0 ; +rtnl_unlock (); } -static struct notifier_block netdevice_notifier = { - .notifier_call = wg_netdevice_notification +static struct pernet_operations pernet_ops = { + .pre_exit = wg_netns_pre_exit };int __init wg_device_init (void )
@@ -429,18 +425,18 @@ int __init wg_device_init(void)return ret;#endif - ret =register_netdevice_notifier (&netdevice_notifier); + ret =register_pernet_device (&pernet_ops);if (ret) goto error_pm; ret =rtnl_link_register (&link_ops);if (ret) - goto error_netdevice; + goto error_pernet;return 0 ; -error_netdevice: -unregister_netdevice_notifier (&netdevice_notifier); +error_pernet: +unregister_pernet_device (&pernet_ops); error_pm:#ifdef CONFIG_PM_SLEEP unregister_pm_notifier (&pm_notifier);
@@ -451,7 +447,7 @@ error_pm:void wg_device_uninit (void ) {rtnl_link_unregister (&link_ops); -unregister_netdevice_notifier (&netdevice_notifier); +unregister_pernet_device (&pernet_ops);#ifdef CONFIG_PM_SLEEP unregister_pm_notifier (&pm_notifier);#endif
drivers/net/wireguard/device.h +1 -2
@@ -40,7 +40,7 @@ struct wg_device {struct net_device *dev;struct crypt_queue encrypt_queue, decrypt_queue;struct sock __rcu *sock4, *sock6; -struct net *creating_net; +struct net __rcu *creating_net;struct noise_static_identity static_identity;struct workqueue_struct *handshake_receive_wq, *handshake_send_wq;struct workqueue_struct *packet_crypt_wq;
@@ -56,7 +56,6 @@ struct wg_device {unsigned int num_peers, device_update_gen;u32 fwmark;u16 incoming_port; -bool have_creating_net_ref; };int wg_device_init (void );
drivers/net/wireguard/netlink.c +9 -5
@@ -511,11 +511,15 @@ static int wg_set_device(struct sk_buff *skb, struct genl_info *info)if (flags & ~__WGDEVICE_F_ALL) goto out; - ret = -EPERM ; -if ((info->attrs[WGDEVICE_A_LISTEN_PORT ] || - info->attrs[WGDEVICE_A_FWMARK ]) && - !ns_capable (wg->creating_net->user_ns,CAP_NET_ADMIN )) - goto out; +if (info->attrs[WGDEVICE_A_LISTEN_PORT ] || info->attrs[WGDEVICE_A_FWMARK ]) { +struct net *net; +rcu_read_lock (); + net =rcu_dereference (wg->creating_net); + ret = !net || !ns_capable (net->user_ns,CAP_NET_ADMIN ) ? -EPERM :0 ; +rcu_read_unlock (); +if (ret) + goto out; + } ++wg->device_update_gen;
drivers/net/wireguard/socket.c +18 -7
@@ -347,6 +347,7 @@ static void set_sock_opts(struct socket *sock)int wg_socket_init (struct wg_device *wg,u16 port) { +struct net *net;int ret;struct udp_tunnel_sock_cfg cfg = { .sk_user_data = wg,
@@ -371,37 +372,47 @@ int wg_socket_init(struct wg_device *wg, u16 port) };#endif +rcu_read_lock (); + net =rcu_dereference (wg->creating_net); + net = net ?maybe_get_net (net) :NULL ; +rcu_read_unlock (); +if (unlikely (!net)) +return -ENONET ; +#if IS_ENABLED (CONFIG_IPV6 ) retry:#endif - ret =udp_sock_create (wg->creating_net, &port4, &new4); + ret =udp_sock_create (net, &port4, &new4);if (ret <0 ) {pr_err ("%s: Could not create IPv4 socket\n" , wg->dev->name); -return ret; + goto out; }set_sock_opts (new4); -setup_udp_tunnel_sock (wg->creating_net, new4, &cfg); +setup_udp_tunnel_sock (net, new4, &cfg);#if IS_ENABLED (CONFIG_IPV6 )if (ipv6_mod_enabled ()) { port6.local_udp_port =inet_sk (new4->sk)->inet_sport; - ret =udp_sock_create (wg->creating_net, &port6, &new6); + ret =udp_sock_create (net, &port6, &new6);if (ret <0 ) {udp_tunnel_sock_release (new4);if (ret == -EADDRINUSE && !port && retries++ <100 ) goto retry;pr_err ("%s: Could not create IPv6 socket\n" , wg->dev->name); -return ret; + goto out; }set_sock_opts (new6); -setup_udp_tunnel_sock (wg->creating_net, new6, &cfg); +setup_udp_tunnel_sock (net, new6, &cfg); }#endif wg_socket_reinit (wg, new4->sk, new6 ? new6->sk :NULL ); -return 0 ; + ret =0 ; +out: +put_net (net); +return ret; } void wg_socket_reinit(struct wg_device *wg, struct sock *new4,
tools/testing/selftests/wireguard/netns.sh +12 -1
@@ -587,9 +587,20 @@ ip0 link set wg0 up kill $ncat_pid ip0 link del wg0 +# Ensure there aren't circular reference loops +ip1 link add wg1 type wireguard +ip2 link add wg2 type wireguard +ip1 link set wg1 netns $netns2 +ip2 link set wg2 netns $netns1 +pp ip netns delete $netns1 +pp ip netns delete $netns2 +pp ip netns add $netns1 +pp ip netns add $netns2 + +sleep 2 # Wait for cleanup and grace periods declare -A objects while read -t 0.1 -r line 2>/dev/null || [[ $? -ne 142 ]]; do - [[ $line =~ .*(wg[0-9]+:\ [A-Z][a-z]+\ [0-9]+)\ .*(created|destroyed).* ]] || continue + [[ $line =~ .*(wg[0-9]+:\ [A-Z][a-z]+\ ?[0-9]*)\ .*(created|destroyed).* ]] || continue objects["${BASH_REMATCH[1]}"]+="${BASH_REMATCH[2]}" done < /dev/kmsg alldeleted=1
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 48/265 bareudp: Fixed multiproto mode configuration
In reply to Sasha LevinFrom: Martin <[email protected]>
[ Upstream commit 4c98045c9b74feab837be58986c0517d3cc661f1 ]
Code to handle multiproto configuration is missing.
--- drivers/net/bareudp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/bareudp.c +3 -0
@@ -572,6 +572,9 @@ static int bareudp2info(struct nlattr *data[], struct bareudp_conf *conf,if (data[IFLA_BAREUDP_SRCPORT_MIN ]) conf->sport_min =nla_get_u16 (data[IFLA_BAREUDP_SRCPORT_MIN ]); +if (data[IFLA_BAREUDP_MULTIPROTO_MODE ]) + conf->multi_proto_mode = true; +return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 49/265 ionic: update the queue count on open
In reply to Sasha LevinFrom: Shannon Nelson <[email protected]>
[ Upstream commit fa48494cce5f6360b0f8683cdf258fb45c666287 ]
Let the network stack know the real number of queues that we are using.
v2: added error checking
--- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +8 -0
@@ -1653,6 +1653,14 @@ int ionic_open(struct net_device *netdev)if (err) goto err_out; + err =netif_set_real_num_tx_queues (netdev, lif->nxqs); +if (err) + goto err_txrx_deinit; + + err =netif_set_real_num_rx_queues (netdev, lif->nxqs); +if (err) + goto err_txrx_deinit; +/* don't start the queues until we have link */ if (netif_carrier_ok (netdev)) { err =ionic_start_queues (lif);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 50/265 net: dsa: bcm_sf2: Fix node reference count
In reply to Sasha LevinFrom: Florian Fainelli <[email protected]>
[ Upstream commit 8dbe4c5d5e40fe140221024f7b16bec9f310bf70 ]
of_find_node_by_name() will do an of_node_put() on the "from" argument. With CONFIG_OF_DYNAMIC enabled which checks for device_node reference counts, we would be getting a warning like this:
[ 6.347230] refcount_t: increment on 0; use-after-free. [ 6.352498] WARNING: CPU: 3 PID: 77 at lib/refcount.c:156 refcount_inc_checked+0x38/0x44 [ 6.360601] Modules linked in: [ 6.363661] CPU: 3 PID: 77 Comm: kworker/3:1 Tainted: G W 5.4.46-gb78b3e9956e6 #13 [ 6.372546] Hardware name: BCM97278SV (DT) [ 6.376649] Workqueue: events deferred_probe_work_func [ 6.381796] pstate: 60000005 (nZCv daif -PAN -UAO) [ 6.386595] pc : refcount_inc_checked+0x38/0x44 [ 6.391133] lr : refcount_inc_checked+0x38/0x44 ... [ 6.478791] Call trace: [ 6.481243] refcount_inc_checked+0x38/0x44 [ 6.485433] kobject_get+0x3c/0x4c [ 6.488840] of_node_get+0x24/0x34 [ 6.492247] of_irq_find_parent+0x3c/0xe0 [ 6.496263] of_irq_parse_one+0xe4/0x1d0 [ 6.500191] irq_of_parse_and_map+0x44/0x84 [ 6.504381] bcm_sf2_sw_probe+0x22c/0x844 [ 6.508397] platform_drv_probe+0x58/0xa8 [ 6.512413] really_probe+0x238/0x3fc [ 6.516081] driver_probe_device+0x11c/0x12c [ 6.520358] __device_attach_driver+0xa8/0x100 [ 6.524808] bus_for_each_drv+0xb4/0xd0 [ 6.528650] __device_attach+0xd0/0x164 [ 6.532493] device_initial_probe+0x24/0x30 [ 6.536682] bus_probe_device+0x38/0x98 [ 6.540524] deferred_probe_work_func+0xa8/0xd4 [ 6.545061] process_one_work+0x178/0x288 [ 6.549078] process_scheduled_works+0x44/0x48 [ 6.553529] worker_thread+0x218/0x270 [ 6.557285] kthread+0xdc/0xe4 [ 6.560344] ret_from_fork+0x10/0x18 [ 6.563925] ---[ end trace 68f65caf69bb152a ]---
Fix this by adding a of_node_get() to increment the reference count prior to the call.
--- drivers/net/dsa/bcm_sf2.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/dsa/bcm_sf2.c +2 -0
@@ -1147,6 +1147,8 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)set_bit (0 , priv->cfp.used);set_bit (0 , priv->cfp.unique); +/* Balance of_node_put() done by of_find_node_by_name() */ +of_node_get (dn); ports =of_find_node_by_name (dn,"ports" );if (ports) {bcm_sf2_identify_ports (priv, ports);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 51/265 net: phy: smsc: fix printing too many logs
In reply to Sasha LevinFrom: Dejin Zheng <[email protected]>
[ Upstream commit 6d61f483f148b856d47a6c96d5d84054d5a9f849 ]
Commit 7ae7ad2f11ef47 ("net: phy: smsc: use phy_read_poll_timeout() to simplify the code") will print a lot of logs as follows when Ethernet cable is not connected:
[ 4.473105] SMSC LAN8710/LAN8720 2188000.ethernet-1:00: lan87xx_read_status failed: -110
When wait 640 ms for check ENERGYON bit, the timeout should not be regarded as an actual error and an error message also should not be printed. due to a hardware bug in LAN87XX device, it leads to unstable detection of plugging in Ethernet cable when LAN87xx is in Energy Detect Power-Down mode. the workaround for it involves, when the link is down, and at each read_status() call:
- disable EDPD mode, forcing the PHY out of low-power mode
- waiting 640ms to see if we have any energy detected from the media
- re-enable entry to EDPD mode
This is presumably enough to allow the PHY to notice that a cable is connected, and resume normal operations to negotiate with the partner. The problem is that when no media is detected, the 640ms wait times out and this commit was modified to prints an error message. it is an inappropriate conversion by used phy_read_poll_timeout() to introduce this bug. so fix this issue by use read_poll_timeout() to replace phy_read_poll_timeout().
--- drivers/net/phy/smsc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/phy/smsc.c +7 -4
@@ -122,10 +122,13 @@ static int lan87xx_read_status(struct phy_device *phydev)if (rc <0 )return rc; -/* Wait max 640 ms to detect energy */ -phy_read_poll_timeout (phydev,MII_LAN83C185_CTRL_STATUS , rc, - rc &MII_LAN83C185_ENERGYON ,10000 , -640000 , true); +/* Wait max 640 ms to detect energy and the timeout is not +* an actual error. +*/ +read_poll_timeout (phy_read, rc, + rc &MII_LAN83C185_ENERGYON || rc <0 , +10000 ,640000 , true, phydev, +MII_LAN83C185_CTRL_STATUS );if (rc <0 )return rc;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 52/265 genetlink: clean up family attributes allocations
In reply to Sasha LevinFrom: Cong Wang <[email protected]>
[ Upstream commit b65ce380b754e77fbfdcfc83fd6e29c8ceedf431 ]
genl_family_rcv_msg_attrs_parse() and genl_family_rcv_msg_attrs_free() take a boolean parameter to determine whether allocate/free the family attrs. This is unnecessary as we can just check family->parallel_ops. More importantly, callers would not need to worry about pairing these parameters correctly after this patch.
And this fixes a memory leak, as after commit c36f05559104 ("genetlink: fix memory leaks in genl_family_rcv_msg_dumpit()") we call genl_family_rcv_msg_attrs_parse() for both parallel and non-parallel cases.
--- net/netlink/genetlink.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-)
net/netlink/genetlink.c +12 -16
@@ -474,8 +474,7 @@ genl_family_rcv_msg_attrs_parse(const struct genl_family *family,struct netlink_ext_ack *extack, const struct genl_ops *ops, int hdrlen, - enum genl_validate_flags no_strict_flag, - bool parallel) + enum genl_validate_flags no_strict_flag) { enum netlink_validation validate = ops->validate & no_strict_flag ? NL_VALIDATE_LIBERAL :
@@ -486,7 +485,7 @@ genl_family_rcv_msg_attrs_parse(const struct genl_family *family,if (!family->maxattr)return NULL ; -if (parallel) { +if (family->parallel_ops) { attrbuf =kmalloc_array (family->maxattr +1 ,sizeof (struct nlattr *),GFP_KERNEL );if (!attrbuf)
@@ -498,7 +497,7 @@ genl_family_rcv_msg_attrs_parse(const struct genl_family *family, err =__nlmsg_parse (nlh, hdrlen, attrbuf, family->maxattr, family->policy, validate, extack);if (err) { -if (parallel) +if (family->parallel_ops)kfree (attrbuf);return ERR_PTR (err); }
@@ -506,10 +505,9 @@ genl_family_rcv_msg_attrs_parse(const struct genl_family *family, }static void genl_family_rcv_msg_attrs_free (const struct genl_family *family, -struct nlattr **attrbuf, -bool parallel) +struct nlattr **attrbuf) { -if (parallel) +if (family->parallel_ops)kfree (attrbuf); }
@@ -537,15 +535,14 @@ static int genl_start(struct netlink_callback *cb) attrs =genl_family_rcv_msg_attrs_parse (ctx->family, ctx->nlh, ctx->extack, ops, ctx->hdrlen, -GENL_DONT_VALIDATE_DUMP_STRICT , - true); +GENL_DONT_VALIDATE_DUMP_STRICT );if (IS_ERR (attrs))return PTR_ERR (attrs); no_attrs: info =genl_dumpit_info_alloc ();if (!info) { -kfree (attrs); +genl_family_rcv_msg_attrs_free (ctx->family, attrs);return -ENOMEM ; } info->family = ctx->family;
@@ -562,7 +559,7 @@ no_attrs: }if (rc) { -kfree (attrs); +genl_family_rcv_msg_attrs_free (info->family, info->attrs);genl_dumpit_info_free (info); cb->data =NULL ; }
@@ -591,7 +588,7 @@ static int genl_lock_done(struct netlink_callback *cb) rc = ops->done (cb);genl_unlock (); } -genl_family_rcv_msg_attrs_free (info->family, info->attrs, false); +genl_family_rcv_msg_attrs_free (info->family, info->attrs);genl_dumpit_info_free (info);return rc; }
@@ -604,7 +601,7 @@ static int genl_parallel_done(struct netlink_callback *cb)if (ops->done) rc = ops->done (cb); -genl_family_rcv_msg_attrs_free (info->family, info->attrs, true); +genl_family_rcv_msg_attrs_free (info->family, info->attrs);genl_dumpit_info_free (info);return rc; }
@@ -671,8 +668,7 @@ static int genl_family_rcv_msg_doit(const struct genl_family *family, attrbuf =genl_family_rcv_msg_attrs_parse (family, nlh, extack, ops, hdrlen, -GENL_DONT_VALIDATE_STRICT , - family->parallel_ops); +GENL_DONT_VALIDATE_STRICT );if (IS_ERR (attrbuf))return PTR_ERR (attrbuf);
@@ -698,7 +694,7 @@ static int genl_family_rcv_msg_doit(const struct genl_family *family, family->post_doit (ops, skb, &info); out: -genl_family_rcv_msg_attrs_free (family, attrbuf, family->parallel_ops); +genl_family_rcv_msg_attrs_free (family, attrbuf);return err; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 53/265 nvmet: cleanups the loop in nvmet_async_events_process
In reply to Sasha LevinFrom: David Milburn <[email protected]>
[ Upstream commit 1cdf9f7670a7d74e27177d5c390c2f8b3b9ba338 ]
--- drivers/nvme/target/core.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/nvme/target/core.c +6 -9
@@ -134,15 +134,10 @@ static void nvmet_async_events_process(struct nvmet_ctrl *ctrl, u16 status)struct nvmet_async_event *aen;struct nvmet_req *req; -while (1 ) { -mutex_lock (&ctrl->lock); - aen =list_first_entry_or_null (&ctrl->async_events, - struct nvmet_async_event, entry); -if (!aen || !ctrl->nr_async_event_cmds) { -mutex_unlock (&ctrl->lock); -break ; - } - +mutex_lock (&ctrl->lock); +while (ctrl->nr_async_event_cmds && !list_empty (&ctrl->async_events)) { + aen =list_first_entry (&ctrl->async_events, + struct nvmet_async_event, entry); req = ctrl->async_event_cmds[--ctrl->nr_async_event_cmds];if (status ==0 )nvmet_set_result (req,nvmet_async_event_result (aen));
@@ -152,7 +147,9 @@ static void nvmet_async_events_process(struct nvmet_ctrl *ctrl, u16 status)mutex_unlock (&ctrl->lock);nvmet_req_complete (req, status); +mutex_lock (&ctrl->lock); } +mutex_unlock (&ctrl->lock); }static void nvmet_async_events_free (struct nvmet_ctrl *ctrl)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 54/265 nvmet: fail outstanding host posted AEN req
In reply to Sasha LevinFrom: Chaitanya Kulkarni <[email protected]>
[ Upstream commit 819f7b88b48fd2bce932cfe3a38bf8fcefbcabe7 ]
In function nvmet_async_event_process() we only process AENs iff there is an open slot on the ctrl->async_event_cmds[] && aen event list posted by the target is not empty. This keeps host posted AEN outstanding if target generated AEN list is empty. We do cleanup the target generated entries from the aen list in nvmet_ctrl_free()-> nvmet_async_events_free() but we don't process AEN posted by the host. This leads to following problem :-
When processing admin sq at the time of nvmet_sq_destroy() holds an extra percpu reference(atomic value = 1), so in the following code path after switching to atomic rcu, release function (nvmet_sq_free()) is not getting called which blocks the sq->free_done in nvmet_sq_destroy() :-
nvmet_sq_destroy()
percpu_ref_kill_and_confirm()
- __percpu_ref_switch_mode()
-- __percpu_ref_switch_to_atomic()
--- call_rcu() -> percpu_ref_switch_to_atomic_rcu()
---- /* calls switch callback */
- percpu_ref_put()
-- percpu_ref_put_many(ref, 1)
--- else if (unlikely(atomic_long_sub_and_test(nr, &ref->count)))
---- ref->release(ref); <---- Not called.
This results in indefinite hang:-
void nvmet_sq_destroy(struct nvmet_sq *sq)
...
if (ctrl && ctrl->sqs && ctrl->sqs[0] == sq) {
nvmet_async_events_process(ctrl, status);
percpu_ref_put(&sq->ref);
}
percpu_ref_kill_and_confirm(&sq->ref, nvmet_confirm_sq);
wait_for_completion(&sq->confirm_done);
wait_for_completion(&sq->free_done); <-- Hang hereWhich breaks the further disconnect sequence. This problem seems to be introduced after commit 64f5e9cdd711b ("nvmet: fix memory leak when removing namespaces and controllers concurrently").
This patch processes ctrl->async_event_cmds[] in the admin sq destroy() context irrespetive of aen_list. Also we get rid of the controller's aen_list processing in the nvmet_sq_destroy() context and just ignore ctrl->aen_list.
This results in nvmet_async_events_process() being called from workqueue context so we adjust the code accordingly.
--- drivers/nvme/target/core.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)
drivers/nvme/target/core.c +20 -7
@@ -129,7 +129,22 @@ static u32 nvmet_async_event_result(struct nvmet_async_event *aen)return aen->event_type | (aen->event_info <<8 ) | (aen->log_page <<16 ); } -static void nvmet_async_events_process (struct nvmet_ctrl *ctrl,u16 status) +static void nvmet_async_events_failall (struct nvmet_ctrl *ctrl) +{ +u16 status =NVME_SC_INTERNAL |NVME_SC_DNR ; +struct nvmet_req *req; + +mutex_lock (&ctrl->lock); +while (ctrl->nr_async_event_cmds) { + req = ctrl->async_event_cmds[--ctrl->nr_async_event_cmds]; +mutex_unlock (&ctrl->lock); +nvmet_req_complete (req, status); +mutex_lock (&ctrl->lock); + } +mutex_unlock (&ctrl->lock); +} + +static void nvmet_async_events_process (struct nvmet_ctrl *ctrl) {struct nvmet_async_event *aen;struct nvmet_req *req;
@@ -139,14 +154,13 @@ static void nvmet_async_events_process(struct nvmet_ctrl *ctrl, u16 status) aen =list_first_entry (&ctrl->async_events, struct nvmet_async_event, entry); req = ctrl->async_event_cmds[--ctrl->nr_async_event_cmds]; -if (status ==0 ) -nvmet_set_result (req,nvmet_async_event_result (aen)); +nvmet_set_result (req,nvmet_async_event_result (aen));list_del (&aen->entry);kfree (aen);mutex_unlock (&ctrl->lock); -nvmet_req_complete (req, status); +nvmet_req_complete (req,0 );mutex_lock (&ctrl->lock); }mutex_unlock (&ctrl->lock);
@@ -169,7 +183,7 @@ static void nvmet_async_event_work(struct work_struct *work)struct nvmet_ctrl *ctrl = container_of(work, struct nvmet_ctrl, async_event_work); -nvmet_async_events_process (ctrl,0 ); +nvmet_async_events_process (ctrl); } void nvmet_add_async_event(struct nvmet_ctrl *ctrl, u8 event_type,
@@ -752,7 +766,6 @@ static void nvmet_confirm_sq(struct percpu_ref *ref)void nvmet_sq_destroy (struct nvmet_sq *sq) { -u16 status =NVME_SC_INTERNAL |NVME_SC_DNR ;struct nvmet_ctrl *ctrl = sq->ctrl;/*
@@ -760,7 +773,7 @@ void nvmet_sq_destroy(struct nvmet_sq *sq)* queue doesn't have outstanding requests on it. */ if (ctrl && ctrl->sqs && ctrl->sqs[0 ] == sq) -nvmet_async_events_process (ctrl, status); +nvmet_async_events_failall (ctrl);percpu_ref_kill_and_confirm (&sq->ref, nvmet_confirm_sq);wait_for_completion (&sq->confirm_done);wait_for_completion (&sq->free_done);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 55/265 fix a braino in "sparc32: fix register window handling in genregs32_[gs]et()"
In reply to Sasha LevinFrom: Al Viro <[email protected]>
[ Upstream commit 9d964e1b82d8182184153b70174f445ea616f053 ]
lost npc in PTRACE_SETREGSET, breaking PTRACE_SETREGS as well
--- arch/sparc/kernel/ptrace_32.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/sparc/kernel/ptrace_32.c +7 -2
@@ -168,12 +168,17 @@ static int genregs32_set(struct task_struct *target,if (ret || !count)return ret; ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, - ®s->y, + ®s->npc,34 *sizeof (u32),35 *sizeof (u32));if (ret || !count)return ret; + ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, + ®s->y, +35 *sizeof (u32),36 *sizeof (u32)); +if (ret || !count) +return ret;return user_regset_copyin_ignore (&pos, &count, &kbuf, &ubuf, -35 *sizeof (u32),38 *sizeof (u32)); +36 *sizeof (u32),38 *sizeof (u32)); } static int fpregs32_get(struct task_struct *target,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 56/265 ALSA: usb-audio: Fix potential use-after-free of streams
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit ff58bbc7b9704a5869204176f804eff57307fef0 ]
With the recent full-duplex support of implicit feedback streams, an endpoint can be still running after closing the capture stream as long as the playback stream with the sync-endpoint is running. In such a state, the URBs are still be handled and they may call retire_data_urb callback, which tries to transfer the data from the PCM buffer. Since the PCM stream gets closed, this may lead to use-after-free.
This patch adds the proper clearance of the callback at stopping the capture stream for addressing the possible UAF above.
--- sound/usb/pcm.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/pcm.c +1 -0
@@ -1782,6 +1782,7 @@ static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substreamreturn 0 ;case SNDRV_PCM_TRIGGER_STOP :stop_endpoints (subs); + subs->data_endpoint->retire_data_urb =NULL ; subs->running =0 ;return 0 ;case SNDRV_PCM_TRIGGER_PAUSE_PUSH :
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 57/265 Revert "i2c: tegra: Fix suspending in active runtime PM state"
In reply to Sasha LevinFrom: Thierry Reding <[email protected]>
[ Upstream commit 78ad73421831247e46c31899a7bead02740e4bef ]
This reverts commit 9f42de8d4ec2304f10bbc51dc0484f3503d61196.
It's not safe to use pm_runtime_force_{suspend,resume}(), especially during the noirq phase of suspend. See also the guidance provided in commit 1e2ef05bb8cf ("PM: Limit race conditions between runtime PM and system sleep (v2)").
--- drivers/i2c/busses/i2c-tegra.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/i2c/busses/i2c-tegra.c +0 -9
@@ -1769,14 +1769,9 @@ static int tegra_i2c_remove(struct platform_device *pdev)static int __maybe_unused tegra_i2c_suspend (struct device *dev) {struct tegra_i2c_dev *i2c_dev =dev_get_drvdata (dev); -int err;i2c_mark_adapter_suspended (&i2c_dev->adapter); - err =pm_runtime_force_suspend (dev); -if (err <0 ) -return err; -return 0 ; }
@@ -1797,10 +1792,6 @@ static int __maybe_unused tegra_i2c_resume(struct device *dev)if (err)return err; - err =pm_runtime_force_resume (dev); -if (err <0 ) -return err; -i2c_mark_adapter_resumed (&i2c_dev->adapter);return 0 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 58/265 btrfs: fix a block group ref counter leak after failure to remove block group
In reply to Sasha LevinFrom: Filipe Manana <[email protected]>
[ Upstream commit 9fecd13202f520f3f25d5b1c313adb740fe19773 ]
When removing a block group, if we fail to delete the block group's item from the extent tree, we jump to the 'out' label and end up decrementing the block group's reference count once only (by 1), resulting in a counter leak because the block group at that point was already removed from the block group cache rbtree - so we have to decrement the reference count twice, once for the rbtree and once for our lookup at the start of the function.
There is a second bug where if removing the free space tree entries (the call to remove_block_group_free_space()) fails we end up jumping to the 'out_put_group' label but end up decrementing the reference count only once, when we should have done it twice, since we have already removed the block group from the block group cache rbtree. This happens because the reference count decrement for the rbtree reference happens after attempting to remove the free space tree entries, which is far away from the place where we remove the block group from the rbtree.
To make things less error prone, decrement the reference count for the rbtree immediately after removing the block group from it. This also eleminates the need for two different exit labels on error, renaming 'out_put_label' to just 'out' and removing the old 'out'.
--- fs/btrfs/block-group.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
fs/btrfs/block-group.c +9 -10
@@ -916,7 +916,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, path =btrfs_alloc_path ();if (!path) { ret = -ENOMEM ; - goto out_put_group; + goto out; }/*
@@ -954,7 +954,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, ret =btrfs_orphan_add (trans,BTRFS_I (inode));if (ret) {btrfs_add_delayed_iput (inode); - goto out_put_group; + goto out; }clear_nlink (inode);/* One for the block groups ref */
@@ -977,13 +977,13 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, ret =btrfs_search_slot (trans, tree_root, &key, path,-1 ,1 );if (ret <0 ) - goto out_put_group; + goto out;if (ret >0 )btrfs_release_path (path);if (ret ==0 ) { ret =btrfs_del_item (trans, tree_root, path);if (ret) - goto out_put_group; + goto out;btrfs_release_path (path); }
@@ -992,6 +992,9 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, &fs_info->block_group_cache_tree);RB_CLEAR_NODE (&block_group->cache_node); +/* Once for the block groups rbtree */ +btrfs_put_block_group (block_group); +if (fs_info->first_logical_byte == block_group->start) fs_info->first_logical_byte = (u64)-1 ;spin_unlock (&fs_info->block_group_cache_lock);
@@ -1102,10 +1105,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, ret =remove_block_group_free_space (trans, block_group);if (ret) - goto out_put_group; - -/* Once for the block groups rbtree */ -btrfs_put_block_group (block_group); + goto out; ret =btrfs_search_slot (trans, root, &key, path,-1 ,1 );if (ret >0 )
@@ -1128,10 +1128,9 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,free_extent_map (em); } -out_put_group: +out:/* Once for the lookup reference */ btrfs_put_block_group (block_group); -out:if (remove_rsv)btrfs_delayed_refs_rsv_release (fs_info,1 );btrfs_free_path (path);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 59/265 binder: fix null deref of proc->context
In reply to Sasha LevinFrom: Todd Kjos <[email protected]>
commit d35d3660e065b69fdb8bf512f3d899f350afce52 upstream.
The binder driver makes the assumption proc->context pointer is invariant after initialization (as documented in the kerneldoc header for struct proc). However, in commit f0fe2c0f050d ("binder: prevent UAF for binderfs devices II") proc->context is set to NULL during binder_deferred_release().
Another proc was in the middle of setting up a transaction to the dying process and crashed on a NULL pointer deref on "context" which is a local set to &proc->context:
new_ref->data.desc = (node == context->binder_context_mgr_node) ? 0 : 1;
Here's the stack:
[ 5237.855435] Call trace: [ 5237.855441] binder_get_ref_for_node_olocked+0x100/0x2ec [ 5237.855446] binder_inc_ref_for_node+0x140/0x280 [ 5237.855451] binder_translate_binder+0x1d0/0x388 [ 5237.855456] binder_transaction+0x2228/0x3730 [ 5237.855461] binder_thread_write+0x640/0x25bc [ 5237.855466] binder_ioctl_write_read+0xb0/0x464 [ 5237.855471] binder_ioctl+0x30c/0x96c [ 5237.855477] do_vfs_ioctl+0x3e0/0x700 [ 5237.855482] __arm64_sys_ioctl+0x78/0xa4 [ 5237.855488] el0_svc_common+0xb4/0x194 [ 5237.855493] el0_svc_handler+0x74/0x98 [ 5237.855497] el0_svc+0x8/0xc
The fix is to move the kfree of the binder_device to binder_free_proc() so the binder_device is freed when we know there are no references remaining on the binder_proc.
--- drivers/android/binder.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/android/binder.c +7 -7
@@ -4686,8 +4686,15 @@ static struct binder_thread *binder_get_thread(struct binder_proc *proc)static void binder_free_proc (struct binder_proc *proc) { +struct binder_device *device; +BUG_ON (!list_empty (&proc->todo));BUG_ON (!list_empty (&proc->delivered_death)); + device = container_of(proc->context, struct binder_device, context); +if (refcount_dec_and_test (&device->ref)) { +kfree (proc->context->name); +kfree (device); + }binder_alloc_deferred_release (&proc->alloc);put_task_struct (proc->tsk);binder_stats_deleted (BINDER_STAT_PROC );
@@ -5406,7 +5413,6 @@ static int binder_node_release(struct binder_node *node, int refs)static void binder_deferred_release (struct binder_proc *proc) {struct binder_context *context = proc->context; -struct binder_device *device;struct rb_node *n;int threads, nodes, incoming_refs, outgoing_refs, active_transactions;
@@ -5423,12 +5429,6 @@ static void binder_deferred_release(struct binder_proc *proc) context->binder_context_mgr_node =NULL ; }mutex_unlock (&context->context_mgr_node_lock); - device = container_of(proc->context, struct binder_device, context); -if (refcount_dec_and_test (&device->ref)) { -kfree (context->name); -kfree (device); - } - proc->context =NULL ;binder_inner_proc_lock (proc);/* * Make sure proc stays alive after we
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 60/265 mei: me: disable mei interface on Mehlow server platforms
In reply to Sasha LevinFrom: Tomas Winkler <[email protected]>
commit f76d77f50b343bc7f7d01e4c2771d43fb074f617 upstream.
For SPS firmware versions 5.0 and newer the way detection has changed. The detection is done now via PCI_CFG_HFS_3 register.
To prevent conflict the previous method will get sps_4 suffix Disable both CNP_H and CNP_H_3 interfaces. CNP_H_3 requires a separate configuration as it doesn't support DMA.
--- drivers/misc/mei/hw-me-regs.h | 2 ++ drivers/misc/mei/hw-me.c | 60 +++++++++++++++++++++++++++++++---- drivers/misc/mei/hw-me.h | 13 +++++--- drivers/misc/mei/pci-me.c | 16 +++++----- 4 files changed, 73 insertions(+), 18 deletions(-)
drivers/misc/mei/hw-me-regs.h +2 -0
@@ -107,6 +107,8 @@# define PCI_CFG_HFS_1_D0I3_MSK 0x80000000#define PCI_CFG_HFS_2 0x48#define PCI_CFG_HFS_3 0x60 +# define PCI_CFG_HFS_3_FW_SKU_MSK 0x00000070 +# define PCI_CFG_HFS_3_FW_SKU_SPS 0x00000060#define PCI_CFG_HFS_4 0x64#define PCI_CFG_HFS_5 0x68#define PCI_CFG_HFS_6 0x6C
drivers/misc/mei/hw-me.c +54 -6
95 lines not on this page · raw message
drivers/misc/mei/hw-me.h +9 -4
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 */ /* -* Copyright (c) 2012-2019, Intel Corporation. All rights reserved. +* Copyright (c) 2012-2020, Intel Corporation. All rights reserved. * Intel Management Engine Interface (Intel MEI) Linux driver */
@@ -76,11 +76,14 @@ struct mei_me_hw {* with quirk for Node Manager exclusion. * @MEI_ME_PCH8_CFG: Platform Controller Hub Gen8 and newer * client platforms. -* @MEI_ME_PCH8_SPS_CFG: Platform Controller Hub Gen8 and newer +* @MEI_ME_PCH8_SPS_4_CFG: Platform Controller Hub Gen8 and newer * servers platforms with quirk for * SPS firmware exclusion. * @MEI_ME_PCH12_CFG: Platform Controller Hub Gen12 and newer -* @MEI_ME_PCH12_SPS_CFG: Platform Controller Hub Gen12 and newer +* @MEI_ME_PCH12_SPS_4_CFG:Platform Controller Hub Gen12 up to 4.0 +* servers platforms with quirk for +* SPS firmware exclusion. +* @MEI_ME_PCH12_SPS_CFG: Platform Controller Hub Gen12 5.0 and newer * servers platforms with quirk for * SPS firmware exclusion. * @MEI_ME_PCH15_CFG: Platform Controller Hub Gen15 and newer
@@ -94,9 +97,11 @@ enum mei_cfg_idx {MEI_ME_PCH7_CFG ,MEI_ME_PCH_CPT_PBG_CFG ,MEI_ME_PCH8_CFG , -MEI_ME_PCH8_SPS_CFG , +MEI_ME_PCH8_SPS_4_CFG ,MEI_ME_PCH12_CFG , +MEI_ME_PCH12_SPS_4_CFG ,MEI_ME_PCH12_SPS_CFG , +MEI_ME_PCH12_SPS_NODMA_CFG ,MEI_ME_PCH15_CFG , MEI_ME_NUM_CFG, };
drivers/misc/mei/pci-me.c +8 -8
@@ -59,18 +59,18 @@ static const struct pci_device_id mei_me_pci_tbl[] = { {MEI_PCI_DEVICE(MEI_DEV_ID_PPT_1, MEI_ME_PCH7_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_PPT_2, MEI_ME_PCH7_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_PPT_3, MEI_ME_PCH7_CFG)}, - {MEI_PCI_DEVICE(MEI_DEV_ID_LPT_H, MEI_ME_PCH8_SPS_CFG)}, - {MEI_PCI_DEVICE(MEI_DEV_ID_LPT_W, MEI_ME_PCH8_SPS_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_LPT_H, MEI_ME_PCH8_SPS_4_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_LPT_W, MEI_ME_PCH8_SPS_4_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_LPT_LP, MEI_ME_PCH8_CFG)}, - {MEI_PCI_DEVICE(MEI_DEV_ID_LPT_HR, MEI_ME_PCH8_SPS_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_LPT_HR, MEI_ME_PCH8_SPS_4_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_WPT_LP, MEI_ME_PCH8_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_WPT_LP_2, MEI_ME_PCH8_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_SPT, MEI_ME_PCH8_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_2, MEI_ME_PCH8_CFG)}, - {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H, MEI_ME_PCH8_SPS_CFG)}, - {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H_2, MEI_ME_PCH8_SPS_CFG)}, - {MEI_PCI_DEVICE(MEI_DEV_ID_LBG, MEI_ME_PCH12_SPS_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H, MEI_ME_PCH8_SPS_4_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H_2, MEI_ME_PCH8_SPS_4_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_LBG, MEI_ME_PCH12_SPS_4_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_BXT_M, MEI_ME_PCH8_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_APL_I, MEI_ME_PCH8_CFG)},
@@ -84,8 +84,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = { {MEI_PCI_DEVICE(MEI_DEV_ID_CNP_LP, MEI_ME_PCH12_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_CNP_LP_3, MEI_ME_PCH8_CFG)}, - {MEI_PCI_DEVICE(MEI_DEV_ID_CNP_H, MEI_ME_PCH12_CFG)}, - {MEI_PCI_DEVICE(MEI_DEV_ID_CNP_H_3, MEI_ME_PCH8_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_CNP_H, MEI_ME_PCH12_SPS_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_CNP_H_3, MEI_ME_PCH12_SPS_NODMA_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_LP, MEI_ME_PCH12_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_LP_3, MEI_ME_PCH8_CFG)},
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 61/265 mei: me: add tiger lake point device ids for H platforms.
In reply to Sasha LevinFrom: Alexander Usyskin <[email protected]>
commit 8c289ea064165237891a7b4be77b74d5cba8fa99 upstream.
Add Tiger Lake device ids H for HECI1.TGH_H is also used in Tatlow SPS platform we need to disable the mei interface there.
--- drivers/misc/mei/hw-me-regs.h | 1 + drivers/misc/mei/hw-me.c | 10 ++++++++++ drivers/misc/mei/hw-me.h | 4 ++++ drivers/misc/mei/pci-me.c | 1 + 4 files changed, 16 insertions(+)
drivers/misc/mei/hw-me-regs.h +1 -0
@@ -94,6 +94,7 @@#define MEI_DEV_ID_JSP_N 0x4DE0/* Jasper Lake Point N */ #define MEI_DEV_ID_TGP_LP 0xA0E0/* Tiger Lake Point LP */ +#define MEI_DEV_ID_TGP_H 0x43E0/* Tiger Lake Point H */ #define MEI_DEV_ID_MCC 0x4B70/* Mule Creek Canyon (EHL) */ #define MEI_DEV_ID_MCC_4 0x4B75/* Mule Creek Canyon 4 (EHL) */
drivers/misc/mei/hw-me.c +10 -0
@@ -1526,6 +1526,15 @@ static const struct mei_cfg mei_me_pch15_cfg = { MEI_CFG_TRC, }; +/* Tiger Lake with quirk for SPS 5.0 and newer Firmware exclusion */ +static const struct mei_cfg mei_me_pch15_sps_cfg = { +MEI_CFG_PCH8_HFS , +MEI_CFG_FW_VER_SUPP , +MEI_CFG_DMA_128 , +MEI_CFG_TRC , +MEI_CFG_FW_SPS , +}; +/* * mei_cfg_list - A list of platform platform specific configurations. * Note: has to be synchronized with enum mei_cfg_idx.
@@ -1544,6 +1553,7 @@ static const struct mei_cfg *const mei_cfg_list[] = { [MEI_ME_PCH12_SPS_CFG] = &mei_me_pch12_sps_cfg, [MEI_ME_PCH12_SPS_NODMA_CFG] = &mei_me_pch12_nodma_sps_cfg, [MEI_ME_PCH15_CFG] = &mei_me_pch15_cfg, + [MEI_ME_PCH15_SPS_CFG] = &mei_me_pch15_sps_cfg, };const struct mei_cfg *mei_me_get_cfg (kernel_ulong_t idx)
drivers/misc/mei/hw-me.h +4 -0
@@ -87,6 +87,9 @@ struct mei_me_hw {* servers platforms with quirk for * SPS firmware exclusion. * @MEI_ME_PCH15_CFG: Platform Controller Hub Gen15 and newer +* @MEI_ME_PCH15_SPS_CFG: Platform Controller Hub Gen15 and newer +* servers platforms with quirk for +* SPS firmware exclusion. * @MEI_ME_NUM_CFG: Upper Sentinel. */ enum mei_cfg_idx {
@@ -103,6 +106,7 @@ enum mei_cfg_idx {MEI_ME_PCH12_SPS_CFG ,MEI_ME_PCH12_SPS_NODMA_CFG ,MEI_ME_PCH15_CFG , +MEI_ME_PCH15_SPS_CFG , MEI_ME_NUM_CFG, };
drivers/misc/mei/pci-me.c +1 -0
@@ -96,6 +96,7 @@ static const struct pci_device_id mei_me_pci_tbl[] = { {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_LP, MEI_ME_PCH12_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_TGP_LP, MEI_ME_PCH15_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_TGP_H, MEI_ME_PCH15_SPS_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_JSP_N, MEI_ME_PCH15_CFG)},
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 62/265 Revert "usb: dwc3: exynos: Add support for Exynos5422 suspend clk"
In reply to Sasha LevinFrom: Anand Moon <[email protected]>
commit ad38beb373a14e082f4e64b68c0b6e6b09764680 upstream.
This reverts commit 07f6842341abe978e6375078f84506ec3280ece5.
Since SCLK_SCLK_USBD300 suspend clock need to be configured for phy module, I wrongly mapped this clock to DWC3 code.
--- drivers/usb/dwc3/dwc3-exynos.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/usb/dwc3/dwc3-exynos.c +0 -9
@@ -162,12 +162,6 @@ static const struct dwc3_exynos_driverdata exynos5250_drvdata = { .suspend_clk_idx = -1, }; -static const struct dwc3_exynos_driverdata exynos5420_drvdata = { - .clk_names = {"usbdrd30" ,"usbdrd30_susp_clk" }, - .num_clks =2 , - .suspend_clk_idx =1 , -}; -static const struct dwc3_exynos_driverdata exynos5433_drvdata = { .clk_names = {"aclk" ,"susp_clk" ,"pipe_pclk" ,"phyclk" }, .num_clks =4 ,
@@ -184,9 +178,6 @@ static const struct of_device_id exynos_dwc3_match[] = { { .compatible = "samsung,exynos5250-dwusb3", .data = &exynos5250_drvdata, - }, { - .compatible = "samsung,exynos5420-dwusb3", - .data = &exynos5420_drvdata, }, { .compatible = "samsung,exynos5433-dwusb3", .data = &exynos5433_drvdata,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 63/265 USB: ohci-sm501: Add missed iounmap() in remove
In reply to Sasha LevinFrom: Chuhong Yuan <[email protected]>
commit 07c112fb09c86c0231f6ff0061a000ffe91c8eb9 upstream.
This driver misses calling iounmap() in remove to undo the ioremap() called in probe.
Add the missed call to fix it.
--- drivers/usb/host/ohci-sm501.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/ohci-sm501.c +1 -0
@@ -191,6 +191,7 @@ static int ohci_hcd_sm501_drv_remove(struct platform_device *pdev)struct resource *mem;usb_remove_hcd (hcd); +iounmap (hcd->regs);release_mem_region (hcd->rsrc_start, hcd->rsrc_len);usb_put_hcd (hcd); mem =platform_get_resource (pdev,IORESOURCE_MEM ,1 );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 64/265 usb: dwc2: Postponed gadget registration to the udc class driver
In reply to Sasha LevinFrom: Minas Harutyunyan <[email protected]>
commit 207324a321a866401b098cadf19e4a2dd6584622 upstream.
During dwc2 driver probe, after gadget registration to the udc class driver, if exist any builtin function driver it immediately bound to dwc2 and after init host side (dwc2_hcd_init()) stucked in host mode. Patch postpone gadget registration after host side initialization done.
--- drivers/usb/dwc2/gadget.c | 6 ------ drivers/usb/dwc2/platform.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 6 deletions(-)
drivers/usb/dwc2/gadget.c +0 -6
@@ -4920,12 +4920,6 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg) epnum, 0); } - ret =usb_add_gadget_udc (dev, &hsotg->gadget); -if (ret) { -dwc2_hsotg_ep_free_request (&hsotg->eps_out[0 ]->ep, - hsotg->ctrl_req); -return ret; - }dwc2_hsotg_dump (hsotg);return 0 ;
drivers/usb/dwc2/platform.c +11 -0
@@ -536,6 +536,17 @@ static int dwc2_driver_probe(struct platform_device *dev)if (hsotg->dr_mode ==USB_DR_MODE_PERIPHERAL )dwc2_lowlevel_hw_disable (hsotg); +#if IS_ENABLED (CONFIG_USB_DWC2_PERIPHERAL ) || \ +IS_ENABLED (CONFIG_USB_DWC2_DUAL_ROLE ) +/* Postponed adding a new gadget to the udc class driver list */ +if (hsotg->gadget_enabled) { + retval =usb_add_gadget_udc (hsotg->dev, &hsotg->gadget); +if (retval) { +dwc2_hsotg_remove (hsotg); + goto error_init; + } + } +#endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */ return 0 ; error_init:
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 65/265 usb: add USB_QUIRK_DELAY_INIT for Logitech C922
In reply to Sasha LevinFrom: Tomasz Meresiński <[email protected]>
commit 5d8021923e8a8cc37a421a64e27c7221f0fee33c upstream.
The Logitech C922, just like other Logitech webcams, needs the USB_QUIRK_DELAY_INIT or it will randomly not respond after device connection
--- drivers/usb/core/quirks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/core/quirks.c +2 -1
@@ -218,11 +218,12 @@ static const struct usb_device_id usb_quirk_list[] = {/* Logitech HD Webcam C270 */ { USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME }, - /* Logitech HD Pro Webcams C920, C920-C, C925e and C930e */ + /* Logitech HD Pro Webcams C920, C920-C, C922, C925e and C930e */ { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT }, { USB_DEVICE(0x046d, 0x0841), .driver_info = USB_QUIRK_DELAY_INIT }, { USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT }, { USB_DEVICE(0x046d, 0x085b), .driver_info = USB_QUIRK_DELAY_INIT }, + { USB_DEVICE(0x046d, 0x085c), .driver_info = USB_QUIRK_DELAY_INIT }, /* Logitech ConferenceCam CC3000e */ { USB_DEVICE(0x046d, 0x0847), .driver_info = USB_QUIRK_DELAY_INIT },
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 66/265 USB: ehci: reopen solution for Synopsys HC bug
In reply to Sasha LevinFrom: Longfang Liu <[email protected]>
commit 1ddcb71a3edf0e1682b6e056158e4c4b00325f66 upstream.
A Synopsys USB2.0 core used in Huawei Kunpeng920 SoC has a bug which might cause the host controller not issuing ping.
Bug description:
After indicating an Interrupt on Async Advance, the software uses the doorbell mechanism to delete the Next Link queue head of the last executed queue head. At this time, the host controller still references the removed queue head(the queue head is NULL). NULL reference causes the host controller to lose the USB device.
Solution:
After deleting the Next Link queue head, when has_synopsys_hc_bug set to 1,the software can write one of the valid queue head addresses to the ASYNCLISTADDR register to allow the host controller to get the valid queue head. in order to solve that problem, this patch set the flag for Huawei Kunpeng920
There are detailed instructions and solutions in this patch:
commit 2f7ac6c19997 ("USB: ehci: add workaround for Synopsys HC bug")
--- drivers/usb/host/ehci-pci.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/host/ehci-pci.c +7 -0
@@ -216,6 +216,13 @@ static int ehci_pci_setup(struct usb_hcd *hcd)ehci_info (ehci,"applying MosChip frame-index workaround\n" ); ehci->frame_index_bug =1 ;break ; +case PCI_VENDOR_ID_HUAWEI : +/* Synopsys HC bug */ +if (pdev->device ==0xa239 ) { +ehci_info (ehci,"applying Synopsys HC workaround\n" ); + ehci->has_synopsys_hc_bug =1 ; + } +break ; }/* optional debug port, normally in the first BAR */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 67/265 usb: host: xhci-mtk: avoid runtime suspend when removing hcd
In reply to Sasha LevinFrom: Macpaul Lin <[email protected]>
commit a24d5072e87457a14023ee1dd3fc8b1e76f899ef upstream.
When runtime suspend was enabled, runtime suspend might happen when xhci is removing hcd. This might cause kernel panic when hcd has been freed but runtime pm suspend related handle need to reference it.
--- drivers/usb/host/xhci-mtk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/host/xhci-mtk.c +3 -2
@@ -587,6 +587,9 @@ static int xhci_mtk_remove(struct platform_device *dev)struct xhci_hcd *xhci =hcd_to_xhci (hcd);struct usb_hcd *shared_hcd = xhci->shared_hcd; +pm_runtime_put_noidle (&dev->dev); +pm_runtime_disable (&dev->dev); +usb_remove_hcd (shared_hcd); xhci->shared_hcd =NULL ;device_init_wakeup (&dev->dev, false);
@@ -597,8 +600,6 @@ static int xhci_mtk_remove(struct platform_device *dev)xhci_mtk_sch_exit (mtk);xhci_mtk_clks_disable (mtk);xhci_mtk_ldos_disable (mtk); -pm_runtime_put_sync (&dev->dev); -pm_runtime_disable (&dev->dev);return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 68/265 xhci: Poll for U0 after disabling USB2 LPM
In reply to Sasha LevinFrom: Kai-Heng Feng <[email protected]>
commit b3d71abd135e6919ca0b6cab463738472653ddfb upstream.
USB2 devices with LPM enabled may interrupt the system suspend:
[ 932.510475] usb 1-7: usb suspend, wakeup 0 [ 932.510549] hub 1-0:1.0: hub_suspend [ 932.510581] usb usb1: bus suspend, wakeup 0 [ 932.510590] xhci_hcd 0000:00:14.0: port 9 not suspended [ 932.510593] xhci_hcd 0000:00:14.0: port 8 not suspended .. [ 932.520323] xhci_hcd 0000:00:14.0: Port change event, 1-7, id 7, portsc: 0x400e03 .. [ 932.591405] PM: pci_pm_suspend(): hcd_pci_suspend+0x0/0x30 returns -16 [ 932.591414] PM: dpm_run_callback(): pci_pm_suspend+0x0/0x160 returns -16 [ 932.591418] PM: Device 0000:00:14.0 failed to suspend async: error -16
During system suspend, USB core will let HC suspends the device if it doesn't have remote wakeup enabled and doesn't have any children. However, from the log above we can see that the usb 1-7 doesn't get bus suspended due to not in U0. After a while the port finished U2 -> U0 transition, interrupts the suspend process.
The observation is that after disabling LPM, port doesn't transit to U0 immediately and can linger in U2. xHCI spec 4.23.5.2 states that the maximum exit latency for USB2 LPM should be BESL + 10us. The BESL for the affected device is advertised as 400us, which is still not enough based on my testing result.
So let's use the maximum permitted latency, 10000, to poll for U0 status to solve the issue.
--- drivers/usb/host/xhci.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/host/xhci.c +3 -0
@@ -4471,6 +4471,9 @@ static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,mutex_lock (hcd->bandwidth_mutex);xhci_change_max_exit_latency (xhci, udev,0 );mutex_unlock (hcd->bandwidth_mutex); +readl_poll_timeout (ports[port_num]->addr, pm_val, + (pm_val &PORT_PLS_MASK ) ==XDEV_U0 , +100 ,10000 );return 0 ; } }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 69/265 usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()
In reply to Sasha LevinFrom: Tang Bin <[email protected]>
commit 44ed240d62736ad29943ec01e41e194b96f7c5e9 upstream.
If the function platform_get_irq() failed, the negative value returned will not be detected here. So fix error handling in exynos_ehci_probe(). And when get irq failed, the function platform_get_irq() logs an error message, so remove redundant message here.
--- drivers/usb/host/ehci-exynos.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-exynos.c +2 -3
@@ -203,9 +203,8 @@ static int exynos_ehci_probe(struct platform_device *pdev) hcd->rsrc_len =resource_size (res); irq =platform_get_irq (pdev,0 ); -if (!irq) { -dev_err (&pdev->dev,"Failed to get IRQ\n" ); - err = -ENODEV ; +if (irq <0 ) { + err = irq; goto fail_io; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 70/265 usb: typec: tcpci_rt1711h: avoid screaming irq causing boot hangs
In reply to Sasha LevinFrom: Li Jun <[email protected]>
commit 302c570bf36e997d55ad0d60628a2feec76954a4 upstream.
John reported screaming irq caused by rt1711h when system boot[1], this is because irq request is done before tcpci_register_port(), so the chip->tcpci has not been setup, irq handler is entered but can't do anything, this patch is to address this by moving the irq request after tcpci_register_port().
[1] https://lore.kernel.org/linux-usb/[email protected]
--- drivers/usb/typec/tcpm/tcpci_rt1711h.c | 31 +++++++++----------------- 1 file changed, 10 insertions(+), 21 deletions(-)
drivers/usb/typec/tcpm/tcpci_rt1711h.c +10 -21
@@ -179,26 +179,6 @@ out:return tcpci_irq (chip->tcpci); } -static int rt1711h_init_alert (struct rt1711h_chip *chip, -struct i2c_client *client) -{ -int ret; - -/* Disable chip interrupts before requesting irq */ - ret =rt1711h_write16 (chip,TCPC_ALERT_MASK ,0 ); -if (ret <0 ) -return ret; - - ret =devm_request_threaded_irq (chip->dev, client->irq,NULL , - rt1711h_irq, -IRQF_ONESHOT |IRQF_TRIGGER_LOW , -dev_name (chip->dev), chip); -if (ret <0 ) -return ret; -enable_irq_wake (client->irq); -return 0 ; -} -static int rt1711h_sw_reset (struct rt1711h_chip *chip) {int ret;
@@ -260,7 +240,8 @@ static int rt1711h_probe(struct i2c_client *client,if (ret <0 )return ret; - ret =rt1711h_init_alert (chip, client); +/* Disable chip interrupts before requesting irq */ + ret =rt1711h_write16 (chip,TCPC_ALERT_MASK ,0 );if (ret <0 )return ret;
@@ -271,6 +252,14 @@ static int rt1711h_probe(struct i2c_client *client,if (IS_ERR_OR_NULL (chip->tcpci))return PTR_ERR (chip->tcpci); + ret =devm_request_threaded_irq (chip->dev, client->irq,NULL , + rt1711h_irq, +IRQF_ONESHOT |IRQF_TRIGGER_LOW , +dev_name (chip->dev), chip); +if (ret <0 ) +return ret; +enable_irq_wake (client->irq); +return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 71/265 usb: typec: mux: intel_pmc_mux: Fix DP alternate mode entry
In reply to Sasha LevinFrom: Heikki Krogerus <[email protected]>
commit 130206a88683d859f63ed6d4a56ab5c2b4930c8e upstream.
The PMC needs to be notified separately about HPD (hotplug detected) signal being high after mode entry. There is a bit "HPD High" in the Alternate Mode Request that the driver already sets, but that bit is only valid when the DisplayPort Alternate Mode is directly entered from disconnected state.
--- drivers/usb/typec/mux/intel_pmc_mux.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/usb/typec/mux/intel_pmc_mux.c +11 -2
@@ -129,7 +129,8 @@ pmc_usb_mux_dp_hpd(struct pmc_usb_port *port, struct typec_mux_state *state) msg[0 ] =PMC_USB_DP_HPD ; msg[0 ] |= port->usb3_port <<PMC_USB_MSG_USB3_PORT_SHIFT ; - msg[1 ] =PMC_USB_DP_HPD_IRQ ; +if (data->status &DP_STATUS_IRQ_HPD ) + msg[1 ] =PMC_USB_DP_HPD_IRQ ;if (data->status &DP_STATUS_HPD_STATE ) msg[1 ] |=PMC_USB_DP_HPD_LVL ;
@@ -142,6 +143,7 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state) {struct typec_displayport_data *data = state->data;struct altmode_req req = { }; +int ret;if (data->status &DP_STATUS_IRQ_HPD )return pmc_usb_mux_dp_hpd (port, state);
@@ -161,7 +163,14 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state)if (data->status &DP_STATUS_HPD_STATE ) req.mode_data |=PMC_USB_ALTMODE_HPD_HIGH ; -return pmc_usb_command (port, (void *)&req,sizeof (req)); + ret =pmc_usb_command (port, (void *)&req,sizeof (req)); +if (ret) +return ret; + +if (data->status &DP_STATUS_HPD_STATE ) +return pmc_usb_mux_dp_hpd (port, state); + +return 0 ; } static int
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 72/265 ALSA: usb-audio: Add implicit feedback quirk for SSL2+.
In reply to Sasha LevinFrom: Laurence Tratt <[email protected]>
commit e7585db1b0b5b4e4eb1967bb1472df308f7ffcbf upstream.
This uses the same quirk as the Motu M2 and M4 to ensure the driver uses the audio interface's clock. Tested on an SSL2+.
--- sound/usb/pcm.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/pcm.c +1 -0
@@ -367,6 +367,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, ifnum =0 ; goto add_sync_ep_from_ifnum;case USB_ID (0x07fd ,0x0008 ):/* MOTU M Series */ +case USB_ID (0x31e9 ,0x0002 ):/* Solid State Logic SSL2+ */ ep =0x81 ; ifnum =2 ; goto add_sync_ep_from_ifnum;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 73/265 ALSA: usb-audio: add quirk for Denon DCD-1500RE
In reply to Sasha LevinFrom: "Yick W. Tse" <[email protected]>
commit c9808bbfed3cfc911ecb60fe8e80c0c27876c657 upstream.
fix error "clock source 41 is not valid, cannot use"
[] New USB device found, idVendor=154e, idProduct=1002, bcdDevice= 1.00 [] New USB device strings: Mfr=1, Product=2, SerialNumber=0 [] Product: DCD-1500RE
[] Manufacturer: D & M Holdings Inc.
[]
[] clock source 41 is not valid, cannot use
[] usbcore: registered new interface driver snd-usb-audio
--- sound/usb/quirks.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/quirks.c +1 -0
@@ -1505,6 +1505,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip)static bool is_itf_usb_dsd_dac (unsigned int id) {switch (id) { +case USB_ID (0x154e ,0x1002 ):/* Denon DCD-1500RE */ case USB_ID (0x154e ,0x1003 ):/* Denon DA-300USB */ case USB_ID (0x154e ,0x3005 ):/* Marantz HD-DAC1 */ case USB_ID (0x154e ,0x3006 ):/* Marantz SA-14S1 */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 74/265 ALSA: usb-audio: Set 48 kHz rate for Rodecaster
In reply to Sasha LevinFrom: Christopher Swenson <[email protected]>
commit 8abf41dcd1bcdda0d09905fb59d18f45c035c752 upstream.
Like the Line6 devices, the Rode Rodecaster Pro does not support UAC2_CS_RANGE and only supports a sample rate of 48 kHz.
Tested against a Rode Rodecaster Pro.
--- sound/usb/format.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/usb/format.c +4 -2
@@ -394,8 +394,9 @@ skip_rate:return nr_rates; } -/* Line6 Helix series don't support the UAC2_CS_RANGE usb function -* call. Return a static table of known clock rates. +/* Line6 Helix series and the Rode Rodecaster Pro don't support the +* UAC2_CS_RANGE usb function call. Return a static table of known +* clock rates. */ static int line6_parse_audio_format_rates_quirk (struct snd_usb_audio *chip,struct audioformat *fp)
@@ -408,6 +409,7 @@ static int line6_parse_audio_format_rates_quirk(struct snd_usb_audio *chip,case USB_ID (0x0e41 ,0x4248 ):/* Line6 Helix >= fw 2.82 */ case USB_ID (0x0e41 ,0x4249 ):/* Line6 Helix Rack >= fw 2.82 */ case USB_ID (0x0e41 ,0x424a ):/* Line6 Helix LT >= fw 2.82 */ +case USB_ID (0x19f7 ,0x0011 ):/* Rode Rodecaster Pro */ return set_fixed_rate (fp,48000 ,SNDRV_PCM_RATE_48000 ); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 75/265 ALSA: usb-audio: Add registration quirk for Kingston HyperX Cloud Flight S
In reply to Sasha LevinFrom: Christoffer Nielsen <[email protected]>
commit 73094608b8e214952444fb104651704c98a37aeb upstream.
Similar to the Kingston HyperX AMP, the Kingston HyperX Cloud Alpha S (0951:0x16ea) uses two interfaces, but only the second interface contains the capture stream. This patch delays the registration until the second interface appears.
--- sound/usb/quirks.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/quirks.c +1 -0
@@ -1844,6 +1844,7 @@ struct registration_quirk {static const struct registration_quirk registration_quirks[] = {REG_QUIRK_ENTRY (0x0951 ,0x16d8 ,2 ),/* Kingston HyperX AMP */ REG_QUIRK_ENTRY (0x0951 ,0x16ed ,2 ),/* Kingston HyperX Cloud Alpha S */ +REG_QUIRK_ENTRY (0x0951 ,0x16ea ,2 ),/* Kingston HyperX Cloud Flight S */ {0 }/* terminator */ };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 76/265 ALSA: usb-audio: add quirk for Samsung USBC Headset (AKG)
In reply to Sasha LevinFrom: Macpaul Lin <[email protected]>
commit a32a1fc99807244d920d274adc46ba04b538cc8a upstream.
We've found Samsung USBC Headset (AKG) (VID: 0x04e8, PID: 0xa051) need a tiny delay after each class compliant request. Otherwise the device might not be able to be recognized each times.
--- sound/usb/quirks.c | 8 ++++++++ 1 file changed, 8 insertions(+)
sound/usb/quirks.c +8 -0
@@ -1647,6 +1647,14 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, chip->usb_id == USB_ID(0x0951, 0x16ad)) && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)usleep_range (1000 ,2000 ); + +/* +* Samsung USBC Headset (AKG) need a tiny delay after each +* class compliant request. (Model number: AAM625R or AAM627R) +*/ +if (chip->usb_id ==USB_ID (0x04e8 ,0xa051 ) && + (requesttype &USB_TYPE_MASK ) ==USB_TYPE_CLASS ) +usleep_range (5000 ,6000 ); }/*
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 77/265 ALSA: usb-audio: Fix OOB access of mixer element list
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
commit 220345e98f1cdc768eeb6e3364a0fa7ab9647fe7 upstream.
The USB-audio mixer code holds a linked list of usb_mixer_elem_list, and several operations are performed for each mixer element. A few of them (snd_usb_mixer_notify_id() and snd_usb_mixer_interrupt_v2()) assume each mixer element being a usb_mixer_elem_info object that is a subclass of usb_mixer_elem_list, cast via container_of() and access it members. This may result in an out-of-bound access when a non-standard list element has been added, as spotted by syzkaller recently.
This patch adds a new field, is_std_info, in usb_mixer_elem_list to indicate that the element is the usb_mixer_elem_info type or not, and skip the access to such an element if needed.
--- sound/usb/mixer.c | 15 +++++++++++---- sound/usb/mixer.h | 9 +++++++-- sound/usb/mixer_quirks.c | 3 ++- 3 files changed, 20 insertions(+), 7 deletions(-)
sound/usb/mixer.c +11 -4
@@ -581,8 +581,9 @@ static int check_matrix_bitmap(unsigned char *bmap,* if failed, give up and free the control instance. */ -int snd_usb_mixer_add_control (struct usb_mixer_elem_list *list, -struct snd_kcontrol *kctl) +int snd_usb_mixer_add_list (struct usb_mixer_elem_list *list, +struct snd_kcontrol *kctl, +bool is_std_info) {struct usb_mixer_interface *mixer = list->mixer;int err;
@@ -596,6 +597,7 @@ int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list,return err; } list->kctl = kctl; + list->is_std_info = is_std_info; list->next_id_elem = mixer->id_elems[list->id]; mixer->id_elems[list->id] = list;return 0 ;
@@ -3234,8 +3236,11 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid) unitid =delegate_notify (mixer, unitid,NULL ,NULL );for_each_mixer_elem (list, mixer, unitid) { -struct usb_mixer_elem_info *info = -mixer_elem_list_to_info (list); +struct usb_mixer_elem_info *info; + +if (!list->is_std_info) +continue ; + info =mixer_elem_list_to_info (list);/* invalidate cache, so the value is read from the device */ info->cached =0 ; snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
@@ -3315,6 +3320,8 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer,if (!list->kctl)continue ; +if (!list->is_std_info) +continue ; info =mixer_elem_list_to_info (list);if (count >1 && info->control != control)
sound/usb/mixer.h +7 -2
@@ -66,6 +66,7 @@ struct usb_mixer_elem_list {struct usb_mixer_elem_list *next_id_elem;/* list of controls with same id */ struct snd_kcontrol *kctl;unsigned int id; +bool is_std_info;usb_mixer_elem_dump_func_t dump;usb_mixer_elem_resume_func_t resume; };
@@ -103,8 +104,12 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid);int snd_usb_mixer_set_ctl_value (struct usb_mixer_elem_info *cval,int request,int validx,int value_set); -int snd_usb_mixer_add_control (struct usb_mixer_elem_list *list, -struct snd_kcontrol *kctl); +int snd_usb_mixer_add_list (struct usb_mixer_elem_list *list, +struct snd_kcontrol *kctl, +bool is_std_info); + +#define snd_usb_mixer_add_control (list, kctl) \ + snd_usb_mixer_add_list(list, kctl, true) void snd_usb_mixer_elem_init_std(struct usb_mixer_elem_list *list, struct usb_mixer_interface *mixer,
sound/usb/mixer_quirks.c +2 -1
@@ -158,7 +158,8 @@ static int add_single_ctl_with_resume(struct usb_mixer_interface *mixer,return -ENOMEM ; } kctl->private_free = snd_usb_mixer_elem_free; -return snd_usb_mixer_add_control (list, kctl); +/* don't use snd_usb_mixer_add_control() here, this is a special list element */ +return snd_usb_mixer_add_list (list, kctl, false); }/*
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 78/265 usb: cdns3: trace: using correct dir value
In reply to Sasha LevinFrom: Peter Chen <[email protected]>
commit ba3a80fe0fb67d8790f62b7bc60df97406d89871 upstream.
It should use the correct direction value from register, not depends on previous software setting. It fixed the EP number wrong issue at trace when the TRBERR interrupt occurs for EP0IN.
When the EP0IN IOC has finished, software prepares the setup packet request, the expected direction is OUT, but at that time, the TRBERR for EP0IN may occur since it is DMULT mode, the DMA does not stop until TRBERR has met.
--- drivers/usb/cdns3/trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/cdns3/trace.h +1 -1
@@ -156,7 +156,7 @@ DECLARE_EVENT_CLASS(cdns3_log_ep0_irq,__dynamic_array (char, str,CDNS3_MSG_MAX ) ),TP_fast_assign ( - __entry->ep_dir = priv_dev->ep0_data_dir; + __entry->ep_dir = priv_dev->selected_ep; __entry->ep_sts = ep_sts; ), TP_printk("%s", cdns3_decode_ep0_irq(__get_str(str),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 79/265 usb: cdns3: ep0: fix the test mode set incorrectly
In reply to Sasha LevinFrom: Peter Chen <[email protected]>
commit b51e1cf64f93acebb6d8afbacd648a6ecefc39b4 upstream.
The 'tmode' is ctrl->wIndex, changing it as the real test mode value for register assignment.
--- drivers/usb/cdns3/ep0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/cdns3/ep0.c +2 -1
@@ -327,7 +327,8 @@ static int cdns3_ep0_feature_handle_device(struct cdns3_device *priv_dev,if (!set || (tmode &0xff ) !=0 )return -EINVAL ; -switch (tmode >>8 ) { + tmode >>=8 ; +switch (tmode) {case TEST_J :case TEST_K :case TEST_SE0_NAK :
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 80/265 usb: cdns3: ep0: add spinlock for cdns3_check_new_setup
In reply to Sasha LevinFrom: Peter Chen <[email protected]>
commit 2587a029fa2a877d0a8dda955ef1b24c94b4bd0e upstream.
The other thread may access other endpoints when the cdns3_check_new_setup is handling, add spinlock to protect it.
--- drivers/usb/cdns3/ep0.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/cdns3/ep0.c +4 -3
@@ -712,15 +712,17 @@ static int cdns3_gadget_ep0_queue(struct usb_ep *ep,int ret =0 ;u8 zlp =0 ; +spin_lock_irqsave (&priv_dev->lock, flags);trace_cdns3_ep0_queue (priv_dev, request);/* cancel the request if controller receive new SETUP packet. */ -if (cdns3_check_new_setup (priv_dev)) +if (cdns3_check_new_setup (priv_dev)) { +spin_unlock_irqrestore (&priv_dev->lock, flags);return -ECONNRESET ; + }/* send STATUS stage. Should be called only for SET_CONFIGURATION */ if (priv_dev->ep0_stage ==CDNS3_STATUS_STAGE ) { -spin_lock_irqsave (&priv_dev->lock, flags);cdns3_select_ep (priv_dev,0x00 ); erdy_sent = !priv_dev->hw_configured_flag;
@@ -745,7 +747,6 @@ static int cdns3_gadget_ep0_queue(struct usb_ep *ep,return 0 ; } -spin_lock_irqsave (&priv_dev->lock, flags);if (!list_empty (&priv_ep->pending_req_list)) {dev_err (priv_dev->dev,"can't handle multiple requests for ep0\n" );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 81/265 scsi: qla2xxx: Keep initiator ports after RSCN
In reply to Sasha LevinFrom: Roman Bolshakov <[email protected]>
commit 632f24f09d5b7c8a2f94932c3391ca957ae76cc4 upstream.
The driver performs SCR (state change registration) in all modes including pure target mode.
For each RSCN, scan_needed flag is set in qla2x00_handle_rscn() for the port mentioned in the RSCN and fabric rescan is scheduled. During the rescan, GNN_FT handler, qla24xx_async_gnnft_done() deletes session of the port that caused the RSCN.
In target mode, the session deletion has an impact on ATIO handler, qlt_24xx_atio_pkt(). Target responds with SAM STATUS BUSY to I/O incoming from the deleted session. qlt_handle_cmd_for_atio() and qlt_handle_task_mgmt() return -EFAULT if they are not able to find session of the command/TMF, and that results in invocation of qlt_send_busy():
qlt_24xx_atio_pkt_all_vps: qla_target(0): type 6 ox_id 0014 qla_target(0): Unable to send command to target, sending BUSY status
Such response causes command timeout on the initiator. Error handler thread on the initiator will be spawned to abort the commands:
scsi 23:0:0:0: tag#0 abort scheduled
scsi 23:0:0:0: tag#0 aborting command
qla2xxx [0000:af:00.0]-188c:23: Entered qla24xx_abort_command. qla2xxx [0000:af:00.0]-801c:23: Abort command issued nexus=23:0:0 -- 0 2003.
Command abort is rejected by target and fails (2003), error handler then tries to perform DEVICE RESET and TARGET RESET but they're also doomed to fail because TMFs are ignored for the deleted sessions.
Then initiator makes BUS RESET that resets the link via qla2x00_full_login_lip(). BUS RESET succeeds and brings initiator port up, SAN switch detects that and sends RSCN to the target port and it fails again the same way as described above. It never goes out of the loop.
The change breaks the RSCN loop by keeping initiator sessions mentioned in RSCN payload in all modes, including dual and pure target mode.
--- drivers/scsi/qla2xxx/qla_gs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_gs.c +3 -1
@@ -3496,7 +3496,9 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp)qla2x00_clear_loop_id (fcport); fcport->flags |=FCF_FABRIC_DEVICE ; }else if (fcport->d_id.b24 != rp->id.b24 || - fcport->scan_needed) { + (fcport->scan_needed && + fcport->port_type !=FCT_INITIATOR && + fcport->port_type !=FCT_NVME_INITIATOR )) {qlt_schedule_sess_for_deletion (fcport); } fcport->d_id.b24 = rp->id.b24;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 82/265 scsi: zfcp: Fix panic on ERP timeout for previously dismissed ERP action
In reply to Sasha LevinFrom: Steffen Maier <[email protected]>
commit 936e6b85da0476dd2edac7c51c68072da9fb4ba2 upstream.
Suppose that, for unrelated reasons, FSF requests on behalf of recovery are very slow and can run into the ERP timeout.
In the case at hand, we did adapter recovery to a large degree. However due to the slowness a LUN open is pending so the corresponding fc_rport remains blocked. After fast_io_fail_tmo we trigger close physical port recovery for the port under which the LUN should have been opened. The new higher order port recovery dismisses the pending LUN open ERP action and dismisses the pending LUN open FSF request. Such dismissal decouples the ERP action from the pending corresponding FSF request by setting zfcp_fsf_req->erp_action to NULL (among other things) [zfcp_erp_strategy_check_fsfreq()].
If now the ERP timeout for the pending open LUN request runs out, we must not use zfcp_fsf_req->erp_action in the ERP timeout handler. This is a problem since v4.15 commit 75492a51568b ("s390/scsi: Convert timers to use timer_setup()"). Before that we intentionally only passed zfcp_erp_action as context argument to zfcp_erp_timeout_handler().
Note: The lifetime of the corresponding zfcp_fsf_req object continues until a (late) response or an (unrelated) adapter recovery.
Just like the regular response path ignores dismissed requests [zfcp_fsf_req_complete() => zfcp_fsf_protstatus_eval() => return early] the ERP timeout handler now needs to ignore dismissed requests. So simply return early in the ERP timeout handler if the FSF request is marked as dismissed in its status flags. To protect against the race where zfcp_erp_strategy_check_fsfreq() dismisses and sets zfcp_fsf_req->erp_action to NULL after our previous status flag check, return early if zfcp_fsf_req->erp_action is NULL. After all, the former ERP action does not need to be woken up as that was already done as part of the dismissal above [zfcp_erp_action_dismiss()].
This fixes the following panic due to kernel page fault in IRQ context:
Unable to handle kernel pointer dereference in virtual kernel address space
Failing address: 0000000000000000 TEID: 0000000000000483
Fault in home space mode while using kernel ASCE.
AS:000009859238c00b R2:00000e3e7ffd000b R3:00000e3e7ffcc007 S:00000e3e7ffd7000 P:000000000000013d
Oops: 0004 ilc:2 [#1] SMP
Modules linked in: ...
CPU: 82 PID: 311273 Comm: stress Kdump: loaded Tainted: G E X ...
Hardware name: IBM 8561 T01 701 (LPAR)
Krnl PSW : 0404c00180000000 001fffff80549be0 (zfcp_erp_notify+0x40/0xc0 [zfcp])
R:0 T:1 IO:0 EX:0 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 RI:0 EA:3
Krnl GPRS: 0000000000000080 00000e3d00000000 00000000000000f0 0000000000030000
000000010028e700 000000000400a39c 000000010028e700 00000e3e7cf87e02
0000000010000000 0700098591cb67f0 0000000000000000 0000000000000000
0000033840e9a000 0000000000000000 001fffe008d6bc18 001fffe008d6bbc8
Krnl Code: 001fffff80549bd4: a7180000 lhi %r1,0
001fffff80549bd8: 4120a0f0 la %r2,240(%r10)
#001fffff80549bdc: a53e0003 llilh %r3,3
>001fffff80549be0: ba132000 cs %r1,%r3,0(%r2)
001fffff80549be4: a7740037 brc 7,1fffff80549c52
001fffff80549be8: e320b0180004 lg %r2,24(%r11)
001fffff80549bee: e31020e00004 lg %r1,224(%r2)
001fffff80549bf4: 412020e0 la %r2,224(%r2)
Call Trace:
[<001fffff80549be0>] zfcp_erp_notify+0x40/0xc0 [zfcp]
[<00000985915e26f0>] call_timer_fn+0x38/0x190
[<00000985915e2944>] expire_timers+0xfc/0x190
[<00000985915e2ac4>] run_timer_softirq+0xec/0x218
[<0000098591ca7c4c>] __do_softirq+0x144/0x398
[<00000985915110aa>] do_softirq_own_stack+0x72/0x88
[<0000098591551b58>] irq_exit+0xb0/0xb8
[<0000098591510c6a>] do_IRQ+0x82/0xb0
[<0000098591ca7140>] ext_int_handler+0x128/0x12c
[<0000098591722d98>] clear_subpage.constprop.13+0x38/0x60
([<000009859172ae4c>] clear_huge_page+0xec/0x250)
[<000009859177e7a2>] do_huge_pmd_anonymous_page+0x32a/0x768
[<000009859172a712>] __handle_mm_fault+0x88a/0x900
[<000009859172a860>] handle_mm_fault+0xd8/0x1b0
[<0000098591529ef6>] do_dat_exception+0x136/0x3e8
[<0000098591ca6d34>] pgm_check_handler+0x1c8/0x220
Last Breaking-Event-Address:
[<001fffff80549c88>] zfcp_erp_timeout_handler+0x10/0x18 [zfcp]
Kernel panic - not syncing: Fatal exception in interrupt--- drivers/s390/scsi/zfcp_erp.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/s390/scsi/zfcp_erp.c +11 -2
@@ -576,7 +576,10 @@ static void zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *act) ZFCP_STATUS_ERP_TIMEDOUT)) { req->status |=ZFCP_STATUS_FSFREQ_DISMISSED ;zfcp_dbf_rec_run ("erscf_1" , act); - req->erp_action =NULL ; +/* lock-free concurrent access with +* zfcp_erp_timeout_handler() +*/ +WRITE_ONCE (req->erp_action,NULL ); }if (act->status &ZFCP_STATUS_ERP_TIMEDOUT )zfcp_dbf_rec_run ("erscf_2" , act);
@@ -612,8 +615,14 @@ void zfcp_erp_notify(struct zfcp_erp_action *erp_action, unsigned long set_mask)void zfcp_erp_timeout_handler (struct timer_list *t) {struct zfcp_fsf_req *fsf_req =from_timer (fsf_req, t, timer); -struct zfcp_erp_action *act = fsf_req->erp_action; +struct zfcp_erp_action *act; +if (fsf_req->status &ZFCP_STATUS_FSFREQ_DISMISSED ) +return ; +/* lock-free concurrent access with zfcp_erp_strategy_check_fsfreq() */ + act =READ_ONCE (fsf_req->erp_action); +if (!act) +return ;zfcp_erp_notify (act,ZFCP_STATUS_ERP_TIMEDOUT ); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 83/265 cifs: Fix cached_fid refcnt leak in open_shroot
In reply to Sasha LevinFrom: Xiyu Yang <[email protected]>
commit 77577de64167aa0643d47ffbaacf3642632b321b upstream.
open_shroot() invokes kref_get(), which increases the refcount of the "tcon->crfid" object. When open_shroot() returns not zero, it means the open operation failed and close_shroot() will not be called to decrement the refcount of the "tcon->crfid".
The reference counting issue happens in one normal path of open_shroot(). When the cached root have been opened successfully in a concurrent process, the function increases the refcount and jump to "oshr_free" to return. However the current return value "rc" may not equal to 0, thus the increased refcount will not be balanced outside the function, causing a refcnt leak.
Fix this issue by setting the value of "rc" to 0 before jumping to "oshr_free" label.
--- fs/cifs/smb2ops.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/smb2ops.c +1 -0
@@ -759,6 +759,7 @@ int open_shroot(unsigned int xid, struct cifs_tcon *tcon,/* close extra handle outside of crit sec */ SMB2_close (xid, tcon, fid.persistent_fid, fid.volatile_fid); } + rc =0 ; goto oshr_free; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 84/265 cifs/smb3: Fix data inconsistent when punch hole
In reply to Sasha LevinFrom: Zhang Xiaoxu <[email protected]>
commit acc91c2d8de4ef46ed751c5f9df99ed9a109b100 upstream.
When punch hole success, we also can read old data from file:
# strace -e trace=pread64,fallocate xfs_io -f -c "pread 20 40" \
-c "fpunch 20 40" -c"pread 20 40" file
pread64(3, " version 5.8.0-rc1+"..., 40, 20) = 40
fallocate(3, FALLOC_FL_KEEP_SIZE|FALLOC_FL_PUNCH_HOLE, 20, 40) = 0
pread64(3, " version 5.8.0-rc1+"..., 40, 20) = 40CIFS implements the fallocate(FALLOCATE_FL_PUNCH_HOLE) with send SMB ioctl(FSCTL_SET_ZERO_DATA) to server. It just set the range of the remote file to zero, but local page caches not updated, then the local page caches inconsistent with server.
Also can be found by xfstests generic/316.
So, we need to remove the page caches before send the SMB ioctl(FSCTL_SET_ZERO_DATA) to server.
--- fs/cifs/smb2ops.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/cifs/smb2ops.c +6 -0
@@ -3211,6 +3211,12 @@ static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon,return rc; } +/* +* We implement the punch hole through ioctl, so we need remove the page +* caches first, otherwise the data may be inconsistent with the server. +*/ +truncate_pagecache_range (inode, offset, offset + len -1 ); +cifs_dbg (FYI ,"Offset %lld len %lld\n" , offset, len); fsctl_buf.FileOffset =cpu_to_le64 (offset);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 85/265 cifs/smb3: Fix data inconsistent when zero file range
In reply to Sasha LevinFrom: Zhang Xiaoxu <[email protected]>
commit 6b69040247e14b43419a520f841f2b3052833df9 upstream.
CIFS implements the fallocate(FALLOC_FL_ZERO_RANGE) with send SMB ioctl(FSCTL_SET_ZERO_DATA) to server. It just set the range of the remote file to zero, but local page cache not update, then the data inconsistent with server, which leads the xfstest generic/008 failed.
So we need to remove the local page caches before send SMB ioctl(FSCTL_SET_ZERO_DATA) to server. After next read, it will re-cache it.
--- fs/cifs/smb2ops.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/cifs/smb2ops.c +5 -0
@@ -3145,6 +3145,11 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,trace_smb3_zero_enter (xid, cfile->fid.persistent_fid, tcon->tid, ses->Suid, offset, len); +/* +* We zero the range through ioctl, so we need remove the page caches +* first, otherwise the data may be inconsistent with the server. +*/ +truncate_pagecache_range (inode, offset, offset + len -1 );/* if file not oplocked can't be sure whether asking to extend size */ if (!CIFS_CACHE_READ (cifsi))
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 86/265 xhci: Fix incorrect EP_STATE_MASK
In reply to Sasha LevinFrom: Mathias Nyman <[email protected]>
commit dceea67058fe22075db3aed62d5cb62092be5053 upstream.
EP_STATE_MASK should be 0x7 instead of 0xf
xhci spec 6.2.3 shows that the EP state field in the endpoint context data structure consist of bits [2:0].
The old value included a bit from the next field which fortunately is a
RsvdZ region. So hopefully this hasn't caused too much harm
--- drivers/usb/host/xhci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci.h +1 -1
@@ -716,7 +716,7 @@ struct xhci_ep_ctx {* 4 - TRB error * 5-7 - reserved */ -#define EP_STATE_MASK (0xf) +#define EP_STATE_MASK (0x7)#define EP_STATE_DISABLED 0#define EP_STATE_RUNNING 1#define EP_STATE_HALTED 2
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 87/265 xhci: Fix enumeration issue when setting max packet size for FS devices.
In reply to Sasha LevinFrom: Al Cooper <[email protected]>
commit a73d9d9cfc3cfceabd91fb0b0c13e4062b6dbcd7 upstream.
Unable to complete the enumeration of a USB TV Tuner device.
Per XHCI spec (4.6.5), the EP state field of the input context shall be cleared for a set address command. In the special case of an FS device that has "MaxPacketSize0 = 8", the Linux XHCI driver does not do this before evaluating the context. With an XHCI controller that checks the EP state field for parameter context error this causes a problem in cases such as the device getting reset again after enumeration.
When that field is cleared, the problem does not occur.
This was found and fixed by Sasi Kumar.
--- drivers/usb/host/xhci.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/xhci.c +1 -0
@@ -1430,6 +1430,7 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, xhci->devs[slot_id]->out_ctx, ep_index); ep_ctx =xhci_get_ep_ctx (xhci, command->in_ctx, ep_index); + ep_ctx->ep_info &=cpu_to_le32 (~EP_STATE_MASK );/* must clear */ ep_ctx->ep_info2 &=cpu_to_le32 (~MAX_PACKET_MASK ); ep_ctx->ep_info2 |=cpu_to_le32 (MAX_PACKET (max_packet_size));
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 88/265 xhci: Return if xHCI doesn't support LPM
In reply to Sasha LevinFrom: Kai-Heng Feng <[email protected]>
commit f0c472a6da51f9fac15e80fe2fd9c83b68754cff upstream.
Just return if xHCI is quirked to disable LPM. We can save some time from reading registers and doing spinlocks.
Add stable tag as we want this patch together with the next one, "Poll for U0 after disabling USB2 LPM" which fixes a suspend issue for some USB2 LPM devices
--- drivers/usb/host/xhci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/host/xhci.c +4 -1
@@ -4391,6 +4391,9 @@ static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,int hird, exit_latency;int ret; +if (xhci->quirks &XHCI_HW_LPM_DISABLE ) +return -EPERM ; +if (hcd->speed >=HCD_USB3 || !xhci->hw_lpm_support || !udev->lpm_capable)return -EPERM ;
@@ -4413,7 +4416,7 @@ static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,xhci_dbg (xhci,"%s port %d USB2 hardware LPM\n" , enable ?"enable" :"disable" , port_num +1 ); -if (enable && !(xhci->quirks &XHCI_HW_LPM_DISABLE )) { +if (enable) {/* Host supports BESL timeout instead of HIRD */ if (udev->usb2_hw_lpm_besl_capable) {/* if device doesn't have a preferred BESL value use a
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 89/265 cdc-acm: Add DISABLE_ECHO quirk for Microchip/SMSC chip
In reply to Sasha LevinFrom: Joakim Tjernlund <[email protected]>
commit 03894573f2913181ee5aae0089f333b2131f2d4b upstream.
USB_DEVICE(0x0424, 0x274e) can send data before cdc_acm is ready, causing garbage chars on the TTY causing stray input to the shell and/or login prompt.
--- drivers/usb/class/cdc-acm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/class/cdc-acm.c +2 -0
@@ -1689,6 +1689,8 @@ static int acm_pre_reset(struct usb_interface *intf)static const struct usb_device_id acm_ids[] = {/* quirky and broken devices */ + {USB_DEVICE (0x0424 ,0x274e ),/* Microchip Technology, Inc. (formerly SMSC) */ + .driver_info =DISABLE_ECHO , },/* DISABLE ECHO in termios flag */ {USB_DEVICE (0x076d ,0x0006 ),/* Denso Cradle CU-321 */ .driver_info =NO_UNION_NORMAL , },/* has no union descriptor */ {USB_DEVICE (0x17ef ,0x7000 ),/* Lenovo USB modem */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 90/265 loop: replace kill_bdev with invalidate_bdev
In reply to Sasha LevinFrom: Zheng Bin <[email protected]>
[ Upstream commit f4bd34b139a3fa2808c4205f12714c65e1548c6c ]
When a filesystem is mounted on a loop device and on a loop ioctl LOOP_SET_STATUS64, because of kill_bdev, buffer_head mappings are getting destroyed.kill_bdev
truncate_inode_pages
truncate_inode_pages_range
do_invalidatepage
block_invalidatepage
discard_buffer -->clear BH_Mapped flagsb_bread
__bread_gfp
bh = __getblk_gfp
-->discard_buffer clear BH_Mapped flag
__bread_slow
submit_bh
submit_bh_wbc
BUG_ON(!buffer_mapped(bh)) --> hit this BUG_ON--- drivers/block/loop.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/block/loop.c +4 -4
@@ -1289,7 +1289,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)if (lo->lo_offset != info->lo_offset || lo->lo_sizelimit != info->lo_sizelimit) {sync_blockdev (lo->lo_device); -kill_bdev (lo->lo_device); +invalidate_bdev (lo->lo_device); }/* I/O need to be drained during transfer transition */
@@ -1320,7 +1320,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)if (lo->lo_offset != info->lo_offset || lo->lo_sizelimit != info->lo_sizelimit) { -/* kill_bdev should have truncated all the pages */ +/* invalidate_bdev should have truncated all the pages */ if (lo->lo_device->bd_inode->i_mapping->nrpages) { err = -EAGAIN ; pr_warn("%s: loop%d (%s) has still dirty pages (nrpages=%lu)\n",
@@ -1565,11 +1565,11 @@ static int loop_set_block_size(struct loop_device *lo, unsigned long arg)return 0 ;sync_blockdev (lo->lo_device); -kill_bdev (lo->lo_device); +invalidate_bdev (lo->lo_device);blk_mq_freeze_queue (lo->lo_queue); -/* kill_bdev should have truncated all the pages */ +/* invalidate_bdev should have truncated all the pages */ if (lo->lo_device->bd_inode->i_mapping->nrpages) { err = -EAGAIN ; pr_warn("%s: loop%d (%s) has still dirty pages (nrpages=%lu)\n",
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 91/265 IB/mad: Fix use after free when destroying MAD agent
In reply to Sasha LevinFrom: Shay Drory <[email protected]>
commit 116a1b9f1cb769b83e5adff323f977a62b1dcb2e upstream.
Currently, when RMPP MADs are processed while the MAD agent is destroyed, it could result in use after free of rmpp_recv, as decribed below:
cpu-0 cpu-1 ----- -----
ib_mad_recv_done()
ib_mad_complete_recv()
ib_process_rmpp_recv_wc()
unregister_mad_agent()
ib_cancel_rmpp_recvs()
cancel_delayed_work()
process_rmpp_data()
start_rmpp()
queue_delayed_work(rmpp_recv->cleanup_work)
destroy_rmpp_recv()
free_rmpp_recv()
cleanup_work()[1]
spin_lock_irqsave(&rmpp_recv->agent->lock) <-- use after free[1] cleanup_work() == recv_cleanup_handler
Fix it by waiting for the MAD agent reference count becoming zero before calling to ib_cancel_rmpp_recvs().
--- drivers/infiniband/core/mad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/mad.c +1 -1
@@ -639,10 +639,10 @@ static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv)xa_erase (&ib_mad_clients, mad_agent_priv->agent.hi_tid);flush_workqueue (port_priv->wq); -ib_cancel_rmpp_recvs (mad_agent_priv);deref_mad_agent (mad_agent_priv);wait_for_completion (&mad_agent_priv->comp); +ib_cancel_rmpp_recvs (mad_agent_priv);ib_mad_agent_security_cleanup (&mad_agent_priv->agent);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 92/265 IB/hfi1: Fix module use count flaw due to leftover module put calls
In reply to Sasha LevinFrom: Dennis Dalessandro <[email protected]>
commit 822fbd37410639acdae368ea55477ddd3498651d upstream.
When the try_module_get calls were removed from opening and closing of the i2c debugfs file, the corresponding module_put calls were missed. This results in an inaccurate module use count that requires a power cycle to fix.
--- drivers/infiniband/hw/hfi1/debugfs.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/infiniband/hw/hfi1/debugfs.c +2 -17
@@ -985,15 +985,10 @@ static ssize_t qsfp2_debugfs_read(struct file *file, char __user *buf,static int __i2c_debugfs_open (struct inode *in,struct file *fp,u32 target) {struct hfi1_pportdata *ppd; -int ret; ppd =private2ppd (fp); - ret =acquire_chip_resource (ppd->dd,i2c_target (target),0 ); -if (ret)/* failed - release the module */ -module_put (THIS_MODULE ); - -return ret; +return acquire_chip_resource (ppd->dd,i2c_target (target),0 ); }static int i2c1_debugfs_open (struct inode *in,struct file *fp)
@@ -1013,7 +1008,6 @@ static int __i2c_debugfs_release(struct inode *in, struct file *fp, u32 target) ppd =private2ppd (fp);release_chip_resource (ppd->dd,i2c_target (target)); -module_put (THIS_MODULE );return 0 ; }
@@ -1031,18 +1025,10 @@ static int i2c2_debugfs_release(struct inode *in, struct file *fp)static int __qsfp_debugfs_open (struct inode *in,struct file *fp,u32 target) {struct hfi1_pportdata *ppd; -int ret; - -if (!try_module_get (THIS_MODULE )) -return -ENODEV ; ppd =private2ppd (fp); - ret =acquire_chip_resource (ppd->dd,i2c_target (target),0 ); -if (ret)/* failed - release the module */ -module_put (THIS_MODULE ); - -return ret; +return acquire_chip_resource (ppd->dd,i2c_target (target),0 ); }static int qsfp1_debugfs_open (struct inode *in,struct file *fp)
@@ -1062,7 +1048,6 @@ static int __qsfp_debugfs_release(struct inode *in, struct file *fp, u32 target) ppd =private2ppd (fp);release_chip_resource (ppd->dd,i2c_target (target)); -module_put (THIS_MODULE );return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 93/265 bus: ti-sysc: Flush posted write on enable and disable
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
[ Upstream commit 5ce8aee81be6c8bc19051d7c7b0d3cbb7ac5fc3f ]
Looks like we're missing flush of posted write after module enable and disable. I've seen occasional errors accessing various modules, and it is suspected that the lack of posted writes can also cause random reboots.
The errors we can see are similar to the one below from spi for example:
44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4CFG (Read): Data Access in User mode during Functional access
...mcspi_wait_for_reg_bitomap2_mcspi_transfer_onespi_transfer_one_message
...
We also want to also flush posted write for disable. The clkctrl clock disable happens after module disable, and we don't want to have the module potentially stay active while we're trying to disable the clock.
--- drivers/bus/ti-sysc.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/bus/ti-sysc.c +6 -0
@@ -991,6 +991,9 @@ set_autoidle:sysc_write_sysconfig (ddata, reg); } +/* Flush posted write */ +sysc_read (ddata, ddata->offsets[SYSC_SYSCONFIG ]); +if (ddata->module_enable_quirk) ddata->module_enable_quirk (ddata);
@@ -1071,6 +1074,9 @@ set_sidle: reg |=1 << regbits->autoidle_shift;sysc_write_sysconfig (ddata, reg); +/* Flush posted write */ +sysc_read (ddata, ddata->offsets[SYSC_SYSCONFIG ]); +return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 94/265 bus: ti-sysc: Use optional clocks on for enable and wait for softreset bit
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
[ Upstream commit d46f9fbec71997420e4fb83c04d9affdf423f879 ]
Some modules reset automatically when idled, and when re-enabled, we must wait for the automatic OCP softreset to complete. And if optional clocks are configured, we need to keep the clocks on while waiting for the reset to complete.
Let's fix the issue by moving the OCP softreset code to a separate function sysc_wait_softreset(), and call it also from sysc_enable_module() with the optional clocks enabled.
This is based on what we're already doing for legacy platform data booting in _enable_sysc().
--- drivers/bus/ti-sysc.c | 80 ++++++++++++++++++++++++++++++++----------- 1 file changed, 60 insertions(+), 20 deletions(-)
drivers/bus/ti-sysc.c +60 -20
@@ -221,6 +221,35 @@ static u32 sysc_read_sysstatus(struct sysc *ddata)return sysc_read (ddata, offset); } +/* Poll on reset status */ +static int sysc_wait_softreset (struct sysc *ddata) +{ +u32 sysc_mask, syss_done, rstval; +int syss_offset, error =0 ; + + syss_offset = ddata->offsets[SYSC_SYSSTATUS ]; + sysc_mask =BIT (ddata->cap->regbits->srst_shift); + +if (ddata->cfg.quirks &SYSS_QUIRK_RESETDONE_INVERTED ) + syss_done =0 ; +else + syss_done = ddata->cfg.syss_mask; + +if (syss_offset >=0 ) { + error =readx_poll_timeout (sysc_read_sysstatus, ddata, rstval, + (rstval & ddata->cfg.syss_mask) == + syss_done, +100 ,MAX_MODULE_SOFTRESET_WAIT ); + + }else if (ddata->cfg.quirks &SYSC_QUIRK_RESET_STATUS ) { + error =readx_poll_timeout (sysc_read_sysconfig, ddata, rstval, + !(rstval & sysc_mask), +100 ,MAX_MODULE_SOFTRESET_WAIT ); + } + +return error; +} +static int sysc_add_named_clock_from_child (struct sysc *ddata,const char *name,const char *optfck_name)
@@ -925,8 +954,34 @@ static int sysc_enable_module(struct device *dev)struct sysc *ddata;const struct sysc_regbits *regbits;u32 reg, idlemodes, best_mode; +int error; ddata =dev_get_drvdata (dev); + +/* +* Some modules like DSS reset automatically on idle. Enable optional +* reset clocks and wait for OCP softreset to complete. +*/ +if (ddata->cfg.quirks &SYSC_QUIRK_OPT_CLKS_IN_RESET ) { + error =sysc_enable_opt_clocks (ddata); +if (error) { +dev_err (ddata->dev, +"Optional clocks failed for enable: %i\n" , + error); +return error; + } + } + error =sysc_wait_softreset (ddata); +if (error) +dev_warn (ddata->dev,"OCP softreset timed out\n" ); +if (ddata->cfg.quirks &SYSC_QUIRK_OPT_CLKS_IN_RESET ) +sysc_disable_opt_clocks (ddata); + +/* +* Some subsystem private interconnects, like DSS top level module, +* need only the automatic OCP softreset handling with no sysconfig +* register bits to configure. +*/ if (ddata->offsets[SYSC_SYSCONFIG ] == -ENODEV )return 0 ;
@@ -1828,11 +1883,10 @@ static int sysc_legacy_init(struct sysc *ddata)*/ static int sysc_reset (struct sysc *ddata) { -int sysc_offset, syss_offset, sysc_val, rstval, error =0 ; -u32 sysc_mask, syss_done; +int sysc_offset, sysc_val, error; +u32 sysc_mask; sysc_offset = ddata->offsets[SYSC_SYSCONFIG ]; - syss_offset = ddata->offsets[SYSC_SYSSTATUS ]; if (ddata->legacy_mode || ddata->cap->regbits->srst_shift < 0 ||
@@ -1841,11 +1895,6 @@ static int sysc_reset(struct sysc *ddata) sysc_mask =BIT (ddata->cap->regbits->srst_shift); -if (ddata->cfg.quirks &SYSS_QUIRK_RESETDONE_INVERTED ) - syss_done =0 ; -else - syss_done = ddata->cfg.syss_mask; -if (ddata->pre_reset_quirk) ddata->pre_reset_quirk (ddata);
@@ -1862,18 +1911,9 @@ static int sysc_reset(struct sysc *ddata)if (ddata->post_reset_quirk) ddata->post_reset_quirk (ddata); -/* Poll on reset status */ -if (syss_offset >=0 ) { - error =readx_poll_timeout (sysc_read_sysstatus, ddata, rstval, - (rstval & ddata->cfg.syss_mask) == - syss_done, -100 ,MAX_MODULE_SOFTRESET_WAIT ); - - }else if (ddata->cfg.quirks &SYSC_QUIRK_RESET_STATUS ) { - error =readx_poll_timeout (sysc_read_sysconfig, ddata, rstval, - !(rstval & sysc_mask), -100 ,MAX_MODULE_SOFTRESET_WAIT ); - } + error =sysc_wait_softreset (ddata); +if (error) +dev_warn (ddata->dev,"OCP softreset timed out\n" );if (ddata->reset_done_quirk) ddata->reset_done_quirk (ddata);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 95/265 bus: ti-sysc: Ignore clockactivity unless specified as a quirk
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
[ Upstream commit 08b91dd6e547467fad61a7c201ff71080d7ad65a ]
We must ignore the clockactivity bit for most modules and not set it unless specified for the module with SYSC_QUIRK_USE_CLOCKACT. Otherwise the interface clock can be automatically gated constantly causing unexpected performance issues.
--- drivers/bus/ti-sysc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/bus/ti-sysc.c +6 -3
@@ -988,10 +988,13 @@ static int sysc_enable_module(struct device *dev) regbits = ddata->cap->regbits; reg =sysc_read (ddata, ddata->offsets[SYSC_SYSCONFIG ]); -/* Set CLOCKACTIVITY, we only use it for ick */ +/* +* Set CLOCKACTIVITY, we only use it for ick. And we only configure it +* based on the SYSC_QUIRK_USE_CLOCKACT flag, not based on the hardware +* capabilities. See the old HWMOD_SET_DEFAULT_CLOCKACT flag. +*/ if (regbits->clkact_shift >=0 && - (ddata->cfg.quirks &SYSC_QUIRK_USE_CLOCKACT || - ddata->cfg.sysc_val &BIT (regbits->clkact_shift))) + (ddata->cfg.quirks &SYSC_QUIRK_USE_CLOCKACT )) reg |=SYSC_CLOCACT_ICK << regbits->clkact_shift;/* Set SIDLE mode */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 96/265 bus: ti-sysc: Fix uninitialized framedonetv_irq
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
[ Upstream commit 085bc0e576a4bf53b67a917c54908f299a2fb949 ]
We are currently only setting the framedonetv_irq disabled for the SoCs that don't have it. But we are never setting it enabled for the SoCs that have it. Let's initialized it to true by default.
--- drivers/bus/ti-sysc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bus/ti-sysc.c +2 -1
@@ -1552,7 +1552,7 @@ static u32 sysc_quirk_dispc(struct sysc *ddata, int dispc_offset,bool lcd_en, digit_en, lcd2_en = false, lcd3_en = false;const int lcd_en_mask =BIT (0 ), digit_en_mask =BIT (1 );int manager_count; -bool framedonetv_irq; +bool framedonetv_irq = true;u32 val, irq_mask =0 ;switch (sysc_soc->soc) {
@@ -1569,6 +1569,7 @@ static u32 sysc_quirk_dispc(struct sysc *ddata, int dispc_offset,break ;case SOC_AM4 : manager_count =1 ; + framedonetv_irq = false;break ;case SOC_UNKNOWN :default :
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 97/265 ARM: OMAP2+: Fix legacy mode dss_reset
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
[ Upstream commit 77cad9dbc957f23a73169e8a8971186744296614 ]
We must check for "dss_core" instead of "dss" to avoid also matching also "dss_dispc". This only matters for the mixed case of data configured in device tree but with legacy booting ti,hwmods property still enabled.
--- arch/arm/mach-omap2/omap_hwmod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/omap_hwmod.c +1 -1
@@ -3489,7 +3489,7 @@ static const struct omap_hwmod_reset dra7_reset_quirks[] = { };static const struct omap_hwmod_reset omap_reset_quirks[] = { - { .match ="dss" , .len =3 , .reset = omap_dss_reset, }, + { .match ="dss_core" , .len =8 , .reset = omap_dss_reset, }, { .match ="hdq1w" , .len =5 , .reset = omap_hdq1w_reset, }, { .match ="i2c" , .len =3 , .reset = omap_i2c_reset, }, { .match ="wd_timer" , .len =8 , .reset = omap2_wd_timer_reset, },
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 98/265 xfrm: Fix double ESP trailer insertion in IPsec crypto offload.
In reply to Sasha LevinFrom: Huy Nguyen <[email protected]>
[ Upstream commit 94579ac3f6d0820adc83b5dc5358ead0158101e9 ]
During IPsec performance testing, we see bad ICMP checksum. The error packet has duplicated ESP trailer due to double validate_xmit_xfrm calls. The first call is from ip_output, but the packet cannot be sent because netif_xmit_frozen_or_stopped is true and the packet gets dev_requeue_skb. The second call is from NET_TX softirq. However after the first call, the packet already has the ESP trailer.
Fix by marking the skb with XFRM_XMIT bit after the packet is handled by validate_xmit_xfrm to avoid duplicate ESP trailer insertion.
--- include/net/xfrm.h | 1 + net/xfrm/xfrm_device.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)
include/net/xfrm.h +1 -0
@@ -1013,6 +1013,7 @@ struct xfrm_offload {#define XFRM_GRO 32#define XFRM_ESP_NO_TRAILER 64#define XFRM_DEV_RESUME 128 +#define XFRM_XMIT 256__u32 status;#define CRYPTO_SUCCESS 1
net/xfrm/xfrm_device.c +3 -1
@@ -108,7 +108,7 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featurstruct xfrm_offload *xo =xfrm_offload (skb);struct sec_path *sp; -if (!xo) +if (!xo || (xo->flags &XFRM_XMIT ))return skb;if (!(features &NETIF_F_HW_ESP ))
@@ -129,6 +129,8 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featurreturn skb; } + xo->flags |=XFRM_XMIT ; +if (skb_is_gso (skb)) {struct net_device *dev = skb->dev;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 99/265 ARM: dts: Fix am33xx.dtsi USB ranges length
In reply to Sasha LevinFrom: Oskar Holmlund <[email protected]>
[ Upstream commit 3f311e8993ed18fb7325373ec0f82a7f8e8be82e ]
AM335x TRM: Table 2-1 defines USBSS - USB Queue Manager in memory region 0x4740 0000 to 0x4740 7FFF.
Looks like the older TRM revisions list the range from 0x5000 to 0x8000 as reserved.
--- arch/arm/boot/dts/am33xx.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/am33xx.dtsi +1 -1
@@ -347,7 +347,7 @@ clock-names = "fck"; #address-cells = <1>; #size-cells = <1>; - ranges = <0x0 0x47400000 0x5000>; + ranges = <0x0 0x47400000 0x8000>; usb0_phy: usb-phy@1300 { compatible = "ti,am335x-usb-phy";
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 100/265 ARM: dts: Fix am33xx.dtsi ti,sysc-mask wrong softreset flag
In reply to Sasha LevinFrom: Oskar Holmlund <[email protected]>
[ Upstream commit 9f872f924545324a06fa216ad38132804c20f2db ]
AM335x TRM: Figure 16-23 define sysconfig register and soft_reset are in first position corresponding to SYSC_OMAP4_SOFTRESET defined in ti-sysc.h.
--- arch/arm/boot/dts/am33xx.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/am33xx.dtsi +1 -1
@@ -335,7 +335,7 @@ <0x47400010 0x4>; reg-names = "rev", "sysc"; ti,sysc-mask = <(SYSC_OMAP4_FREEEMU | - SYSC_OMAP2_SOFTRESET)>; + SYSC_OMAP4_SOFTRESET)>; ti,sysc-midle = <SYSC_IDLE_FORCE>, <SYSC_IDLE_NO>, <SYSC_IDLE_SMART>;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 101/265 ASoC: q6asm: handle EOS correctly
In reply to Sasha LevinFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit 6476b60f32866be49d05e2e0163f337374c55b06 ]
Successful send of EOS command does not indicate that EOS is actually finished, correct event to wait EOS is finished is EOS_RENDERED event. EOS_RENDERED means that the DSP has finished processing all the buffers for that particular session and stream.
This patch fixes EOS handling!
--- sound/soc/qcom/qdsp6/q6asm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
sound/soc/qcom/qdsp6/q6asm.c +4 -3
@@ -25,6 +25,7 @@#define ASM_STREAM_CMD_FLUSH 0x00010BCE#define ASM_SESSION_CMD_PAUSE 0x00010BD3#define ASM_DATA_CMD_EOS 0x00010BDB +#define ASM_DATA_EVENT_RENDERED_EOS 0x00010C1C#define ASM_NULL_POPP_TOPOLOGY 0x00010C68#define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09#define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10
@@ -622,9 +623,6 @@ static int32_t q6asm_stream_callback(struct apr_device *adev,case ASM_SESSION_CMD_SUSPEND : client_event =ASM_CLIENT_EVENT_CMD_SUSPEND_DONE ;break ; -case ASM_DATA_CMD_EOS : - client_event =ASM_CLIENT_EVENT_CMD_EOS_DONE ; -break ;case ASM_STREAM_CMD_FLUSH : client_event =ASM_CLIENT_EVENT_CMD_FLUSH_DONE ;break ;
@@ -727,6 +725,9 @@ static int32_t q6asm_stream_callback(struct apr_device *adev,spin_unlock_irqrestore (&ac->lock, flags); } +break ; +case ASM_DATA_EVENT_RENDERED_EOS : + client_event =ASM_CLIENT_EVENT_CMD_EOS_DONE ;break ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 102/265 regulator: da9063: fix LDO9 suspend and warning.
In reply to Sasha LevinFrom: Martin Fuzzey <[email protected]>
[ Upstream commit d7442ba13d62de9afc4e57344a676f9f4623dcaa ]
Commit 99f75ce66619 ("regulator: da9063: fix suspend") converted the regulators to use a common (corrected) suspend bit setting but one of regulators (LDO9) slipped through the crack.
This means that the original problem was not fixed for LDO9 and also leads to a warning found by the test robot.
da9063-regulator.c:515:3: warning: initialized field overwritten
Fix this by converting that regulator too like the others.
--- drivers/regulator/da9063-regulator.c | 1 - 1 file changed, 1 deletion(-)
drivers/regulator/da9063-regulator.c +0 -1
@@ -512,7 +512,6 @@ static const struct da9063_regulator_info da9063_regulator_info[] = { }, {DA9063_LDO (DA9063 ,LDO9 ,950 ,50 ,3600 ), - .suspend =BFIELD (DA9063_REG_LDO9_CONT ,DA9063_VLDO9_SEL ), }, { DA9063_LDO(DA9063, LDO11, 900, 50, 3600),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 103/265 ARM: dts: BCM5301X: Add missing memory "device_type" for Luxul XWC-2000
In reply to Sasha LevinFrom: Rafał Miłecki <[email protected]>
[ Upstream commit de1f6d9304c38e414552c3565d36286609ced0c1 ]
This property is needed since commit abe60a3a7afb ("ARM: dts: Kill off skeleton{64}.dtsi"). Without it booting silently hangs at:
[ 0.000000] Memory policy: Data cache writealloc
--- arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts +1 -0
@@ -17,6 +17,7 @@ }; memory { + device_type = "memory"; reg = <0x00000000 0x08000000 0x88000000 0x18000000>; };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 104/265 ARM: bcm: Select ARM_TIMER_SP804 for ARCH_BCM_NSP
In reply to Sasha LevinFrom: Matthew Hagan <[email protected]>
[ Upstream commit 0386e9ce5877ee73e07675529d5ae594d00f0900 ]
The NSP SoC includes an SP804 timer so should be enabled here.
--- arch/arm/mach-bcm/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-bcm/Kconfig +1 -0
@@ -53,6 +53,7 @@ config ARCH_BCM_NSP select ARM_ERRATA_754322 select ARM_ERRATA_775420 select ARM_ERRATA_764369 if SMP + select ARM_TIMER_SP804 select THERMAL select THERMAL_OF help
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 105/265 x86/cpu: Move resctrl CPUID code to resctrl/
In reply to Sasha LevinFrom: Reinette Chatre <[email protected]>
[ Upstream commit 0118ad82c2a64ebcf15d7565ed35361407efadfa ]
The function determining a platform's support and properties of cache occupancy and memory bandwidth monitoring (properties of X86_FEATURE_CQM_LLC) can be found among the common CPU code. After the feature's properties is populated in the per-CPU data the resctrl subsystem is the only consumer (via boot_cpu_data).
Move the function that obtains the CPU information used by resctrl to the resctrl subsystem and rename it from init_cqm() to resctrl_cpu_detect(). The function continues to be called from the common CPU code. This move is done in preparation of the addition of some vendor specific code.
No functional change.
--- arch/x86/include/asm/resctrl_sched.h | 3 +++ arch/x86/kernel/cpu/common.c | 27 ++------------------------- arch/x86/kernel/cpu/resctrl/core.c | 24 ++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 25 deletions(-)
arch/x86/include/asm/resctrl_sched.h +3 -0
@@ -84,9 +84,12 @@ static inline void resctrl_sched_in(void) __resctrl_sched_in(); } +void resctrl_cpu_detect (struct cpuinfo_x86 *c); +#else static inline void resctrl_sched_in (void ) {} +static inline void resctrl_cpu_detect (struct cpuinfo_x86 *c) {}#endif /* CONFIG_X86_CPU_RESCTRL */
arch/x86/kernel/cpu/common.c +2 -25
@@ -56,6 +56,7 @@#include <asm/intel-family.h> #include <asm/cpu_device_id.h> #include <asm/uv/uv.h> +#include <asm/resctrl_sched.h> #include "cpu.h"
@@ -854,30 +855,6 @@ static void init_speculation_control(struct cpuinfo_x86 *c) } } -static void init_cqm (struct cpuinfo_x86 *c) -{ -if (!cpu_has (c,X86_FEATURE_CQM_LLC )) { - c->x86_cache_max_rmid =-1 ; - c->x86_cache_occ_scale =-1 ; -return ; - } - -/* will be overridden if occupancy monitoring exists */ - c->x86_cache_max_rmid =cpuid_ebx (0xf ); - -if (cpu_has (c,X86_FEATURE_CQM_OCCUP_LLC ) || -cpu_has (c,X86_FEATURE_CQM_MBM_TOTAL ) || -cpu_has (c,X86_FEATURE_CQM_MBM_LOCAL )) { -u32 eax, ebx, ecx, edx; - -/* QoS sub-leaf, EAX=0Fh, ECX=1 */ -cpuid_count (0xf ,1 , &eax, &ebx, &ecx, &edx); - - c->x86_cache_max_rmid = ecx; - c->x86_cache_occ_scale = ebx; - } -} -void get_cpu_cap (struct cpuinfo_x86 *c) {u32 eax, ebx, ecx, edx;
@@ -945,7 +922,7 @@ void get_cpu_cap(struct cpuinfo_x86 *c)init_scattered_cpuid_features (c);init_speculation_control (c); -init_cqm (c); +resctrl_cpu_detect (c);/* * Clear/Set all flags overridden by options, after probe.
arch/x86/kernel/cpu/resctrl/core.c +24 -0
@@ -958,6 +958,30 @@ static __init void rdt_init_res_defs(void)static enum cpuhp_state rdt_online; +void resctrl_cpu_detect (struct cpuinfo_x86 *c) +{ +if (!cpu_has (c,X86_FEATURE_CQM_LLC )) { + c->x86_cache_max_rmid =-1 ; + c->x86_cache_occ_scale =-1 ; +return ; + } + +/* will be overridden if occupancy monitoring exists */ + c->x86_cache_max_rmid =cpuid_ebx (0xf ); + +if (cpu_has (c,X86_FEATURE_CQM_OCCUP_LLC ) || +cpu_has (c,X86_FEATURE_CQM_MBM_TOTAL ) || +cpu_has (c,X86_FEATURE_CQM_MBM_LOCAL )) { +u32 eax, ebx, ecx, edx; + +/* QoS sub-leaf, EAX=0Fh, ECX=1 */ +cpuid_count (0xf ,1 , &eax, &ebx, &ecx, &edx); + + c->x86_cache_max_rmid = ecx; + c->x86_cache_occ_scale = ebx; + } +} +static int __init resctrl_late_init (void ) {struct rdt_resource *r;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 106/265 x86/resctrl: Support CPUID enumeration of MBM counter width
In reply to Sasha LevinFrom: Reinette Chatre <[email protected]>
[ Upstream commit f3d44f18b0662327c42128b9d3604489bdb6e36f ]
The original Memory Bandwidth Monitoring (MBM) architectural definition defines counters of up to 62 bits in the IA32_QM_CTR MSR while the first-generation MBM implementation uses statically defined 24 bit counters.
Expand the MBM CPUID enumeration properties to include the MBM counter width. The previously undefined EAX output register contains, in bits [7:0], the MBM counter width encoded as an offset from 24 bits. Enumerating this property is only specified for Intel CPUs.
--- arch/x86/include/asm/processor.h | 3 ++- arch/x86/kernel/cpu/resctrl/core.c | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-)
arch/x86/include/asm/processor.h +2 -1
@@ -113,9 +113,10 @@ struct cpuinfo_x86 {/* in KB - valid for CPUS which support this call: */ unsigned int x86_cache_size;int x86_cache_alignment;/* In bytes */ -/* Cache QoS architectural values: */ +/* Cache QoS architectural values, valid only on the BSP: */ int x86_cache_max_rmid;/* max index */ int x86_cache_occ_scale;/* scale to bytes */ +int x86_cache_mbm_width_offset;int x86_power;unsigned long loops_per_jiffy;/* cpuid returned max cores value: */
arch/x86/kernel/cpu/resctrl/core.c +5 -0
@@ -963,6 +963,7 @@ void resctrl_cpu_detect(struct cpuinfo_x86 *c)if (!cpu_has (c,X86_FEATURE_CQM_LLC )) { c->x86_cache_max_rmid =-1 ; c->x86_cache_occ_scale =-1 ; + c->x86_cache_mbm_width_offset =-1 ;return ; }
@@ -979,6 +980,10 @@ void resctrl_cpu_detect(struct cpuinfo_x86 *c) c->x86_cache_max_rmid = ecx; c->x86_cache_occ_scale = ebx; +if (c->x86_vendor ==X86_VENDOR_INTEL ) + c->x86_cache_mbm_width_offset = eax &0xff ; +else + c->x86_cache_mbm_width_offset =-1 ; } }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 107/265 x86/resctrl: Fix memory bandwidth counter width for AMD
In reply to Sasha LevinFrom: Babu Moger <[email protected]>
[ Upstream commit 2c18bd525c47f882f033b0a813ecd09c93e1ecdf ]
Memory bandwidth is calculated reading the monitoring counter at two intervals and calculating the delta. It is the software’s responsibility to read the count often enough to avoid having the count roll over _twice_ between reads.
The current code hardcodes the bandwidth monitoring counter's width to 24 bits for AMD. This is due to default base counter width which is 24. Currently, AMD does not implement the CPUID 0xF.[ECX=1]:EAX to adjust the counter width. But, the AMD hardware supports much wider bandwidth counter with the default width of 44 bits.
Kernel reads these monitoring counters every 1 second and adjusts the counter value for overflow. With 24 bits and scale value of 64 for AMD, it can only measure up to 1GB/s without overflowing. For the rates above 1GB/s this will fail to measure the bandwidth.
Fix the issue setting the default width to 44 bits by adjusting the offset.
AMD future products will implement CPUID 0xF.[ECX=1]:EAX.
[ bp: Let the line stick out and drop {}-brackets around a single
statement. ]
--- arch/x86/kernel/cpu/resctrl/core.c | 8 ++++---- arch/x86/kernel/cpu/resctrl/internal.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/resctrl/core.c +4 -4
@@ -980,10 +980,10 @@ void resctrl_cpu_detect(struct cpuinfo_x86 *c) c->x86_cache_max_rmid = ecx; c->x86_cache_occ_scale = ebx; -if (c->x86_vendor ==X86_VENDOR_INTEL ) - c->x86_cache_mbm_width_offset = eax &0xff ; -else - c->x86_cache_mbm_width_offset =-1 ; + c->x86_cache_mbm_width_offset = eax &0xff ; + +if (c->x86_vendor ==X86_VENDOR_AMD && !c->x86_cache_mbm_width_offset) + c->x86_cache_mbm_width_offset =MBM_CNTR_WIDTH_OFFSET_AMD ; } }
arch/x86/kernel/cpu/resctrl/internal.h +1 -0
@@ -37,6 +37,7 @@#define MBA_IS_LINEAR 0x4#define MBA_MAX_MBPS U32_MAX#define MAX_MBA_BW_AMD 0x800 +#define MBM_CNTR_WIDTH_OFFSET_AMD 20#define RMID_VAL_ERROR BIT_ULL(63)#define RMID_VAL_UNAVAIL BIT_ULL(62)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 108/265 efi/tpm: Verify event log header before parsing
In reply to Sasha LevinFrom: Fabian Vogt <[email protected]>
[ Upstream commit 7dfc06a0f25b593a9f51992f540c0f80a57f3629 ]
It is possible that the first event in the event log is not actually a log header at all, but rather a normal event. This leads to the cast in __calc_tpm2_event_size being an invalid conversion, which means that the values read are effectively garbage. Depending on the first event's contents, this leads either to apparently normal behaviour, a crash or a freeze.
While this behaviour of the firmware is not in accordance with the TCG Client EFI Specification, this happens on a Dell Precision 5510 with the TPM enabled but hidden from the OS ("TPM On" disabled, state otherwise untouched). The EFI firmware claims that the TPM is present and active and that it supports the TCG 2.0 event log format.
Fortunately, this can be worked around by simply checking the header of the first event and the event log header signature itself.
Commit b4f1874c6216 ("tpm: check event log version before reading final events") addressed a similar issue also found on Dell models.
Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1165773
--- include/linux/tpm_eventlog.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
include/linux/tpm_eventlog.h +13 -1
@@ -81,6 +81,8 @@ struct tcg_efi_specid_event_algs {u16 digest_size; } __packed; +#define TCG_SPECID_SIG "Spec ID Event03" +struct tcg_efi_specid_event_head {u8 signature[16 ];u32 platform_class;
@@ -171,6 +173,7 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event,int i;int j;u32 count, event_type; +const u8 zero_digest[sizeof (event_header->digest)] = {0 }; marker = event; marker_start = marker;
@@ -198,10 +201,19 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, count =READ_ONCE (event->count); event_type =READ_ONCE (event->event_type); +/* Verify that it's the log header */ +if (event_header->pcr_idx !=0 || + event_header->event_type !=NO_ACTION || +memcmp (event_header->digest, zero_digest,sizeof (zero_digest))) { + size =0 ; + goto out; + } + efispecid = (struct tcg_efi_specid_event_head *)event_header->event;/* Check if event is malformed. */ -if (count > efispecid->num_algs) { +if (memcmp (efispecid->signature,TCG_SPECID_SIG , +sizeof (TCG_SPECID_SIG )) || count > efispecid->num_algs) { size =0 ; goto out; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 109/265 efi/esrt: Fix reference count leak in esre_create_sysfs_entry.
In reply to Sasha LevinFrom: Qiushi Wu <[email protected]>
[ Upstream commit 4ddf4739be6e375116c375f0a68bf3893ffcee21 ]
kobject_init_and_add() takes reference even when it fails. If this function returns an error, kobject_put() must be called to properly clean up the memory associated with the object. Previous commit "b8eb718348b8" fixed a similar problem.
--- drivers/firmware/efi/esrt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/esrt.c +1 -1
@@ -181,7 +181,7 @@ static int esre_create_sysfs_entry(void *esre, int entry_num) rc =kobject_init_and_add (&entry->kobj, &esre1_ktype,NULL ,"entry%d" , entry_num);if (rc) { -kfree (entry); +kobject_put (&entry->kobj);return rc; } }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 110/265 ASoC: soc-pcm: fix checks for multi-cpu FE dailinks
In reply to Sasha LevinFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 96bf62f018f40cb5d4e4bed95e50fd990a2354af ]
soc_dpcm_fe_runtime_update() is called for all dailinks, and we want to first discard all back-ends, then deal with front-ends.
The existing code first reports an error with multi-cpu front-ends, and that check needs to be moved after we know that we are dealing with a front-end.
--- sound/soc/soc-pcm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/soc-pcm.c +3 -3
@@ -2749,15 +2749,15 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new)int count, paths;int ret; +if (!fe->dai_link->dynamic) +return 0 ; +if (fe->num_cpus >1 ) {dev_err (fe->dev,"%s doesn't support Multi CPU yet\n" , __func__);return -EINVAL ; } -if (!fe->dai_link->dynamic) -return 0 ; -/* only check active links */ if (!fe->cpu_dai->active)return 0 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 111/265 ASoc: q6afe: add support to get port direction
In reply to Sasha LevinFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit 4a95737440d426e93441d49d11abf4c6526d4666 ]
This patch adds support to q6afe_is_rx_port() to get direction of DSP BE dai port, this is useful for setting dailink directions correctly.
--- sound/soc/qcom/qdsp6/q6afe.c | 8 ++++++++ sound/soc/qcom/qdsp6/q6afe.h | 1 + 2 files changed, 9 insertions(+)
sound/soc/qcom/qdsp6/q6afe.c +8 -0
@@ -800,6 +800,14 @@ int q6afe_get_port_id(int index) }EXPORT_SYMBOL_GPL (q6afe_get_port_id); +int q6afe_is_rx_port (int index) +{ +if (index <0 || index >=AFE_PORT_MAX ) +return -EINVAL ; + +return port_maps[index].is_rx; +} +EXPORT_SYMBOL_GPL (q6afe_is_rx_port);static int afe_apr_send_pkt (struct q6afe *afe,struct apr_pkt *pkt,struct q6afe_port *port) {
sound/soc/qcom/qdsp6/q6afe.h +1 -0
@@ -198,6 +198,7 @@ int q6afe_port_start(struct q6afe_port *port);int q6afe_port_stop (struct q6afe_port *port);void q6afe_port_put (struct q6afe_port *port);int q6afe_get_port_id (int index); +int q6afe_is_rx_port (int index);void q6afe_hdmi_port_prepare (struct q6afe_port *port,struct q6afe_hdmi_cfg *cfg); void q6afe_slim_port_prepare(struct q6afe_port *port,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 112/265 ASoC: qcom: common: set correct directions for dailinks
In reply to Sasha LevinFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit a2120089251f1fe221305e88df99af16f940e236 ]
Currently both FE and BE dai-links are configured bi-directional, However the DSP BE dais are only single directional,
so set the directions as supported by the BE dais.
--- sound/soc/qcom/common.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
sound/soc/qcom/common.c +12 -2
@@ -4,6 +4,7 @@#include <linux/module.h> #include "common.h" +#include "qdsp6/q6afe.h" int qcom_snd_parse_of (struct snd_soc_card *card) {
@@ -101,6 +102,15 @@ int qcom_snd_parse_of(struct snd_soc_card *card) } link->no_pcm =1 ; link->ignore_pmdown_time =1 ; + +if (q6afe_is_rx_port (link->id)) { + link->dpcm_playback =1 ; + link->dpcm_capture =0 ; + }else { + link->dpcm_playback =0 ; + link->dpcm_capture =1 ; + } + }else { dlc =devm_kzalloc (dev,sizeof (*dlc),GFP_KERNEL );if (!dlc)
@@ -113,12 +123,12 @@ int qcom_snd_parse_of(struct snd_soc_card *card) link->codecs->dai_name ="snd-soc-dummy-dai" ; link->codecs->name ="snd-soc-dummy" ; link->dynamic =1 ; + link->dpcm_playback =1 ; + link->dpcm_capture =1 ; } link->ignore_suspend =1 ; link->nonatomic =1 ; - link->dpcm_playback =1 ; - link->dpcm_capture =1 ; link->stream_name = link->name; link++;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 113/265 regualtor: pfuze100: correct sw1a/sw2 on pfuze3000
In reply to Sasha LevinFrom: Robin Gong <[email protected]>
[ Upstream commit 6f1cf5257acc6e6242ddf2f52bc7912aed77b79f ]
PFUZE100_SWB_REG is not proper for sw1a/sw2, because enable_mask/enable_reg is not correct. On PFUZE3000, sw1a/sw2 should be the same as sw1a/sw2 on pfuze100 except that voltages are not linear, so add new PFUZE3000_SW_REG and pfuze3000_sw_regulator_ops which like the non-linear PFUZE100_SW_REG and pfuze100_sw_regulator_ops.
--- drivers/regulator/pfuze100-regulator.c | 60 +++++++++++++++++--------- 1 file changed, 39 insertions(+), 21 deletions(-)
drivers/regulator/pfuze100-regulator.c +39 -21
@@ -209,6 +209,19 @@ static const struct regulator_ops pfuze100_swb_regulator_ops = { }; +static const struct regulator_ops pfuze3000_sw_regulator_ops = { + .enable = regulator_enable_regmap, + .disable = regulator_disable_regmap, + .is_enabled = regulator_is_enabled_regmap, + .list_voltage = regulator_list_voltage_table, + .map_voltage = regulator_map_voltage_ascend, + .set_voltage_sel = regulator_set_voltage_sel_regmap, + .get_voltage_sel = regulator_get_voltage_sel_regmap, + .set_voltage_time_sel = regulator_set_voltage_time_sel, + .set_ramp_delay = pfuze100_set_ramp_delay, + +}; +#define PFUZE100_FIXED_REG (_chip, _name, base, voltage) \ [_chip ## _ ## _name] = { \ .desc = { \
@@ -318,23 +331,28 @@ static const struct regulator_ops pfuze100_swb_regulator_ops = { .stby_mask = 0x20, \ } - -#define PFUZE3000_SW2_REG (_chip, _name, base, min, max, step) { \ - .desc = { \ - .name = #_name,\ - .n_voltages = ((max) - (min)) / (step) + 1, \ - .ops = &pfuze100_sw_regulator_ops, \ - .type = REGULATOR_VOLTAGE, \ - .id = _chip ## _ ## _name, \ - .owner = THIS_MODULE, \ - .min_uV = (min), \ - .uV_step = (step), \ - .vsel_reg = (base) + PFUZE100_VOL_OFFSET, \ - .vsel_mask = 0x7, \ - }, \ - .stby_reg = (base) + PFUZE100_STANDBY_OFFSET, \ - .stby_mask = 0x7, \ -} +/* No linar case for the some switches of PFUZE3000 */ +#define PFUZE3000_SW_REG (_chip, _name, base, mask, voltages) \ + [_chip ## _ ## _name] = { \ + .desc = { \ + .name = #_name, \ + .n_voltages = ARRAY_SIZE(voltages), \ + .ops = &pfuze3000_sw_regulator_ops, \ + .type = REGULATOR_VOLTAGE, \ + .id = _chip ## _ ## _name, \ + .owner = THIS_MODULE, \ + .volt_table = voltages, \ + .vsel_reg = (base) + PFUZE100_VOL_OFFSET, \ + .vsel_mask = (mask), \ + .enable_reg = (base) + PFUZE100_MODE_OFFSET, \ + .enable_mask = 0xf, \ + .enable_val = 0x8, \ + .enable_time = 500, \ + }, \ + .stby_reg = (base) + PFUZE100_STANDBY_OFFSET, \ + .stby_mask = (mask), \ + .sw_reg = true, \ + }#define PFUZE3000_SW3_REG (_chip, _name, base, min, max, step) { \ .desc = { \
@@ -391,9 +409,9 @@ static struct pfuze_regulator pfuze200_regulators[] = { };static struct pfuze_regulator pfuze3000_regulators[] = { -PFUZE100_SWB_REG (PFUZE3000 ,SW1A ,PFUZE100_SW1ABVOL ,0x1f , pfuze3000_sw1a), +PFUZE3000_SW_REG (PFUZE3000 ,SW1A ,PFUZE100_SW1ABVOL ,0x1f , pfuze3000_sw1a),PFUZE100_SW_REG (PFUZE3000 ,SW1B ,PFUZE100_SW1CVOL ,700000 ,1475000 ,25000 ), -PFUZE100_SWB_REG (PFUZE3000 ,SW2 ,PFUZE100_SW2VOL ,0x7 , pfuze3000_sw2lo), +PFUZE3000_SW_REG (PFUZE3000 ,SW2 ,PFUZE100_SW2VOL ,0x7 , pfuze3000_sw2lo),PFUZE3000_SW3_REG (PFUZE3000 ,SW3 ,PFUZE100_SW3AVOL ,900000 ,1650000 ,50000 ),PFUZE100_SWB_REG (PFUZE3000 ,SWBST ,PFUZE100_SWBSTCON1 ,0x3 , pfuze100_swbst),PFUZE100_SWB_REG (PFUZE3000 ,VSNVS ,PFUZE100_VSNVSVOL ,0x7 , pfuze100_vsnvs),
@@ -407,8 +425,8 @@ static struct pfuze_regulator pfuze3000_regulators[] = { };static struct pfuze_regulator pfuze3001_regulators[] = { -PFUZE100_SWB_REG (PFUZE3001 ,SW1 ,PFUZE100_SW1ABVOL ,0x1f , pfuze3000_sw1a), -PFUZE100_SWB_REG (PFUZE3001 ,SW2 ,PFUZE100_SW2VOL ,0x7 , pfuze3000_sw2lo), +PFUZE3000_SW_REG (PFUZE3001 ,SW1 ,PFUZE100_SW1ABVOL ,0x1f , pfuze3000_sw1a), +PFUZE3000_SW_REG (PFUZE3001 ,SW2 ,PFUZE100_SW2VOL ,0x7 , pfuze3000_sw2lo),PFUZE3000_SW3_REG (PFUZE3001 ,SW3 ,PFUZE100_SW3AVOL ,900000 ,1650000 ,50000 ),PFUZE100_SWB_REG (PFUZE3001 ,VSNVS ,PFUZE100_VSNVSVOL ,0x7 , pfuze100_vsnvs),PFUZE100_VGEN_REG (PFUZE3001 ,VLDO1 ,PFUZE100_VGEN1VOL ,1800000 ,3300000 ,100000 ),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 114/265 efi/libstub: Fix path separator regression
In reply to Sasha LevinFrom: Philipp Fent <[email protected]>
[ Upstream commit 7a88a6227dc7f2e723bba11ece05e57bd8dce8e4 ]
Commit 9302c1bb8e47 ("efi/libstub: Rewrite file I/O routine") introduced a regression that made a couple of (badly configured) systems fail to boot [1]: Until 5.6, we silently accepted Unix-style file separators in EFI paths, which might violate the EFI standard, but are an easy to make mistake. This fix restores the pre-5.7 behaviour.
[1] https://bbs.archlinux.org/viewtopic.php?id=256273
--- drivers/firmware/efi/libstub/file.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/firmware/efi/libstub/file.c +12 -4
@@ -104,12 +104,20 @@ static int find_file_option(const efi_char16_t *cmdline, int cmdline_len,if (!found)return 0 ; +/* Skip any leading slashes */ +while (cmdline[i] ==L'/' || cmdline[i] ==L'\\' ) + i++; +while (--result_len >0 && i < cmdline_len) { -if (cmdline[i] ==L'\0' || - cmdline[i] ==L'\n' || - cmdline[i] ==L' ' ) +efi_char16_t c = cmdline[i++]; + +if (c ==L'\0' || c ==L'\n' || c ==L' ' )break ; - *result++ = cmdline[i++]; +else if (c ==L'/' ) +/* Replace UNIX dir separators with EFI standard ones */ + *result++ =L'\\' ; +else + *result++ = c; } *result =L'\0' ;return i;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 115/265 RDMA/siw: Fix pointer-to-int-cast warning in siw_rx_pbl()
In reply to Sasha LevinFrom: Tom Seewald <[email protected]>
[ Upstream commit 6769b275a313c76ddcd7d94c632032326db5f759 ]
The variable buf_addr is type dma_addr_t, which may not be the same size as a pointer. To ensure it is the correct size, cast to a uintptr_t.
--- drivers/infiniband/sw/siw/siw_qp_rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/sw/siw/siw_qp_rx.c +2 -1
@@ -139,7 +139,8 @@ static int siw_rx_pbl(struct siw_rx_stream *srx, int *pbl_idx,break ; bytes =min (bytes, len); -if (siw_rx_kva (srx, (void *)buf_addr, bytes) == bytes) { +if (siw_rx_kva (srx, (void *)(uintptr_t )buf_addr, bytes) == + bytes) { copied += bytes; offset += bytes; len -= bytes;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 116/265 ARM: dts: NSP: Disable PL330 by default, add dma-coherent property
In reply to Sasha LevinFrom: Matthew Hagan <[email protected]>
[ Upstream commit b9dbe0101e344e8339406a11b7a91d4a0c50ad13 ]
Currently the PL330 is enabled by default. However if left in IDM reset, as is the case with the Meraki and Synology NSP devices, the system will hang when probing for the PL330's AMBA peripheral ID. We therefore should be able to disable it in these cases.
The PL330 is also included among of the list of peripherals put into coherent mode, so "dma-coherent" has been added here as well.
--- arch/arm/boot/dts/bcm-nsp.dtsi | 4 +++- arch/arm/boot/dts/bcm958522er.dts | 4 ++++ arch/arm/boot/dts/bcm958525er.dts | 4 ++++ arch/arm/boot/dts/bcm958525xmc.dts | 4 ++++ arch/arm/boot/dts/bcm958622hr.dts | 4 ++++ arch/arm/boot/dts/bcm958623hr.dts | 4 ++++ arch/arm/boot/dts/bcm958625hr.dts | 4 ++++ arch/arm/boot/dts/bcm958625k.dts | 4 ++++ 8 files changed, 31 insertions(+), 1 deletion(-)
arch/arm/boot/dts/bcm-nsp.dtsi +3 -1
@@ -200,7 +200,7 @@ status = "disabled"; }; - dma@20000 { + dma: dma@20000 { compatible = "arm,pl330", "arm,primecell"; reg = <0x20000 0x1000>; interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>,
@@ -215,6 +215,8 @@ clocks = <&iprocslow>; clock-names = "apb_pclk"; #dma-cells = <1>; + dma-coherent; + status = "disabled"; }; sdio: sdhci@21000 {
arch/arm/boot/dts/bcm958522er.dts +4 -0
@@ -58,6 +58,10 @@ /* USB 3 support needed to be complete */ +&dma { + status = "okay"; +}; + &amac0 { status = "okay"; };
arch/arm/boot/dts/bcm958525er.dts +4 -0
@@ -58,6 +58,10 @@ /* USB 3 support needed to be complete */ +&dma { + status = "okay"; +}; + &amac0 { status = "okay"; };
arch/arm/boot/dts/bcm958525xmc.dts +4 -0
@@ -58,6 +58,10 @@ /* XHCI support needed to be complete */ +&dma { + status = "okay"; +}; + &amac0 { status = "okay"; };
arch/arm/boot/dts/bcm958622hr.dts +4 -0
@@ -58,6 +58,10 @@ /* USB 3 and SLIC support needed to be complete */ +&dma { + status = "okay"; +}; + &amac0 { status = "okay"; };
arch/arm/boot/dts/bcm958623hr.dts +4 -0
@@ -58,6 +58,10 @@ /* USB 3 and SLIC support needed to be complete */ +&dma { + status = "okay"; +}; + &amac0 { status = "okay"; };
arch/arm/boot/dts/bcm958625hr.dts +4 -0
@@ -69,6 +69,10 @@ status = "okay"; }; +&dma { + status = "okay"; +}; + &amac0 { status = "okay"; };
arch/arm/boot/dts/bcm958625k.dts +4 -0
@@ -48,6 +48,10 @@ }; }; +&dma { + status = "okay"; +}; + &amac0 { status = "okay"; };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 117/265 ASoC: fsl_ssi: Fix bclk calculation for mono channel
In reply to Sasha LevinFrom: Shengjiu Wang <[email protected]>
[ Upstream commit ed1220df6e666500ebf58c4f2fccc681941646fb ]
For mono channel, SSI will switch to Normal mode.
In Normal mode and Network mode, the Word Length Control bits control the word length divider in clock generator, which is different with I2S Master mode (the word length is fixed to 32bit), it should be the value of params_width(hw_params).
The condition "slots == 2" is not good for I2S Master mode, because for Network mode and Normal mode, the slots can also be 2. Then we need to use (ssi->i2s_net & SSI_SCR_I2S_MODE_MASK) to check if it is I2S Master mode.
So we refine the formula for mono channel, otherwise there will be sound issue for S24_LE.
--- sound/soc/fsl/fsl_ssi.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
sound/soc/fsl/fsl_ssi.c +9 -4
@@ -678,8 +678,9 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,struct regmap *regs = ssi->regs;u32 pm =999 , div2, psr, stccr, mask, afreq, factor, i;unsigned long clkrate, baudrate, tmprate; -unsigned int slots =params_channels (hw_params); -unsigned int slot_width =32 ; +unsigned int channels =params_channels (hw_params); +unsigned int slot_width =params_width (hw_params); +unsigned int slots =2 ;u64 sub, savesub =100000 ;unsigned int freq;bool baudclk_is_used;
@@ -688,10 +689,14 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,/* Override slots and slot_width if being specifically set... */ if (ssi->slots) slots = ssi->slots; -/* ...but keep 32 bits if slots is 2 -- I2S Master mode */ -if (ssi->slot_width && slots !=2 ) +if (ssi->slot_width) slot_width = ssi->slot_width; +/* ...but force 32 bits for stereo audio using I2S Master Mode */ +if (channels ==2 && + (ssi->i2s_net &SSI_SCR_I2S_MODE_MASK ) ==SSI_SCR_I2S_MODE_MASTER ) + slot_width =32 ; +/* Generate bit clock based on the slot number and slot width */ freq = slots * slot_width *params_rate (hw_params);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 118/265 samples/bpf: xdp_redirect_cpu: Set MAX_CPUS according to NR_CPUS
In reply to Sasha LevinFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 6a09815428547657f3ffd2f5c31ac2a191e7fdf3 ]
xdp_redirect_cpu is currently failing in bpf_prog_load_xattr() allocating cpu_map map if CONFIG_NR_CPUS is less than 64 since cpu_map_alloc() requires max_entries to be less than NR_CPUS. Set cpu_map max_entries according to NR_CPUS in xdp_redirect_cpu_kern.c and get currently running cpus in xdp_redirect_cpu_user.c
--- samples/bpf/xdp_redirect_cpu_kern.c | 2 +- samples/bpf/xdp_redirect_cpu_user.c | 29 ++++++++++++++++------------- 2 files changed, 17 insertions(+), 14 deletions(-)
samples/bpf/xdp_redirect_cpu_kern.c +1 -1
@@ -15,7 +15,7 @@#include <bpf/bpf_helpers.h> #include "hash_func01.h" -#define MAX_CPUS 64/* WARNING - sync with _user.c */ +#define MAX_CPUS NR_CPUS/* Special map type that can XDP_REDIRECT frames to another CPU */ struct {
samples/bpf/xdp_redirect_cpu_user.c +16 -13
@@ -13,6 +13,7 @@ static const char *__doc__ =#include <unistd.h> #include <locale.h> #include <sys/resource.h> +#include <sys/sysinfo.h> #include <getopt.h> #include <net/if.h> #include <time.h>
@@ -24,8 +25,6 @@ static const char *__doc__ =#include <arpa/inet.h> #include <linux/if_link.h> -#define MAX_CPUS 64/* WARNING - sync with _kern.c */ -/* How many xdp_progs are defined in _kern.c */ #define MAX_PROG 6
@@ -40,6 +39,7 @@ static char *ifname;static __u32 prog_id;static __u32 xdp_flags =XDP_FLAGS_UPDATE_IF_NOEXIST ; +static int n_cpus;static int cpu_map_fd;static int rx_cnt_map_fd;static int redirect_err_cnt_map_fd;
@@ -170,7 +170,7 @@ struct stats_record {struct record redir_err;struct record kthread;struct record exception; -struct record enq[MAX_CPUS ]; +struct record enq[]; };static bool map_collect_percpu (int fd,__u32 key,struct record *rec)
@@ -225,10 +225,11 @@ static struct datarec *alloc_record_per_cpu(void)static struct stats_record *alloc_stats_record (void ) {struct stats_record *rec; -int i; +int i, size; - rec =malloc (sizeof (*rec)); -memset (rec,0 ,sizeof (*rec)); + size =sizeof (*rec) + n_cpus *sizeof (struct record ); + rec =malloc (size); +memset (rec,0 , size);if (!rec) {fprintf (stderr,"Mem alloc error\n" );exit (EXIT_FAIL_MEM );
@@ -237,7 +238,7 @@ static struct stats_record *alloc_stats_record(void) rec->redir_err.cpu =alloc_record_per_cpu (); rec->kthread.cpu =alloc_record_per_cpu (); rec->exception.cpu =alloc_record_per_cpu (); -for (i =0 ; i <MAX_CPUS ; i++) +for (i =0 ; i < n_cpus; i++) rec->enq[i].cpu =alloc_record_per_cpu ();return rec;
@@ -247,7 +248,7 @@ static void free_stats_record(struct stats_record *r) {int i; -for (i =0 ; i <MAX_CPUS ; i++) +for (i =0 ; i < n_cpus; i++)free (r->enq[i].cpu);free (r->exception.cpu);free (r->kthread.cpu);
@@ -350,7 +351,7 @@ static void stats_print(struct stats_record *stats_rec, }/* cpumap enqueue stats */ -for (to_cpu =0 ; to_cpu <MAX_CPUS ; to_cpu++) { +for (to_cpu =0 ; to_cpu < n_cpus; to_cpu++) {char *fmt ="%-15s %3d:%-3d %'-14.0f %'-11.0f %'-10.2f %s\n" ;char *fm2 ="%-15s %3s:%-3d %'-14.0f %'-11.0f %'-10.2f %s\n" ;char *errstr ="" ;
@@ -475,7 +476,7 @@ static void stats_collect(struct stats_record *rec)map_collect_percpu (fd,1 , &rec->redir_err); fd = cpumap_enqueue_cnt_map_fd; -for (i =0 ; i <MAX_CPUS ; i++) +for (i =0 ; i < n_cpus; i++)map_collect_percpu (fd, i, &rec->enq[i]); fd = cpumap_kthread_cnt_map_fd;
@@ -549,10 +550,10 @@ static int create_cpu_entry(__u32 cpu, __u32 queue_size,*/ static void mark_cpus_unavailable (void ) { -__u32 invalid_cpu =MAX_CPUS ; +__u32 invalid_cpu = n_cpus;int ret, i; -for (i =0 ; i <MAX_CPUS ; i++) { +for (i =0 ; i < n_cpus; i++) { ret =bpf_map_update_elem (cpus_available_map_fd, &i, &invalid_cpu,0 );if (ret) {
@@ -688,6 +689,8 @@ int main(int argc, char **argv)int prog_fd;__u32 qsize; + n_cpus =get_nprocs_conf (); +/* Notice: choosing he queue size is very important with the * ixgbe driver, because it's driver page recycling trick is * dependend on pages being returned quickly. The number of
@@ -757,7 +760,7 @@ int main(int argc, char **argv)case 'c' :/* Add multiple CPUs */ add_cpu =strtoul (optarg,NULL ,0 ); -if (add_cpu >=MAX_CPUS ) { +if (add_cpu >= n_cpus) {fprintf (stderr,"--cpu nr too large for cpumap err(%d):%s\n" , errno,strerror (errno));
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 119/265 bpf, xdp, samples: Fix null pointer dereference in *_user code
In reply to Sasha LevinFrom: Gaurav Singh <[email protected]>
[ Upstream commit 6903cdae9f9f08d61e49c16cbef11c293e33a615 ]
Memset on the pointer right after malloc can cause a NULL pointer deference if it failed to allocate memory. A simple fix is to replace malloc()/memset() pair with a simple call to calloc().
--- samples/bpf/xdp_monitor_user.c | 8 ++------ samples/bpf/xdp_redirect_cpu_user.c | 7 ++----- samples/bpf/xdp_rxq_info_user.c | 13 +++---------- 3 files changed, 7 insertions(+), 21 deletions(-)
samples/bpf/xdp_monitor_user.c +2 -6
@@ -509,11 +509,8 @@ static void *alloc_rec_per_cpu(int record_size) {unsigned int nr_cpus =bpf_num_possible_cpus ();void *array; -size_t size; - size = record_size * nr_cpus; - array =malloc (size); -memset (array,0 , size); + array =calloc (nr_cpus, record_size);if (!array) {fprintf (stderr,"Mem alloc error (nr_cpus:%u)\n" , nr_cpus);exit (EXIT_FAIL_MEM );
@@ -528,8 +525,7 @@ static struct stats_record *alloc_stats_record(void)int i;/* Alloc main stats_record structure */ - rec =malloc (sizeof (*rec)); -memset (rec,0 ,sizeof (*rec)); + rec =calloc (1 ,sizeof (*rec));if (!rec) {fprintf (stderr,"Mem alloc error\n" );exit (EXIT_FAIL_MEM );
samples/bpf/xdp_redirect_cpu_user.c +2 -5
@@ -210,11 +210,8 @@ static struct datarec *alloc_record_per_cpu(void) {unsigned int nr_cpus =bpf_num_possible_cpus ();struct datarec *array; -size_t size; - size =sizeof (struct datarec ) * nr_cpus; - array =malloc (size); -memset (array,0 , size); + array =calloc (nr_cpus,sizeof (struct datarec ));if (!array) {fprintf (stderr,"Mem alloc error (nr_cpus:%u)\n" , nr_cpus);exit (EXIT_FAIL_MEM );
@@ -229,11 +226,11 @@ static struct stats_record *alloc_stats_record(void) size =sizeof (*rec) + n_cpus *sizeof (struct record ); rec =malloc (size); -memset (rec,0 , size);if (!rec) {fprintf (stderr,"Mem alloc error\n" );exit (EXIT_FAIL_MEM ); } +memset (rec,0 , size); rec->rx_cnt.cpu =alloc_record_per_cpu (); rec->redir_err.cpu =alloc_record_per_cpu (); rec->kthread.cpu =alloc_record_per_cpu ();
samples/bpf/xdp_rxq_info_user.c +3 -10
@@ -198,11 +198,8 @@ static struct datarec *alloc_record_per_cpu(void) {unsigned int nr_cpus =bpf_num_possible_cpus ();struct datarec *array; -size_t size; - size =sizeof (struct datarec ) * nr_cpus; - array =malloc (size); -memset (array,0 , size); + array =calloc (nr_cpus,sizeof (struct datarec ));if (!array) {fprintf (stderr,"Mem alloc error (nr_cpus:%u)\n" , nr_cpus);exit (EXIT_FAIL_MEM );
@@ -214,11 +211,8 @@ static struct record *alloc_record_per_rxq(void) {unsigned int nr_rxqs =bpf_map__def (rx_queue_index_map)->max_entries;struct record *array; -size_t size; - size =sizeof (struct record ) * nr_rxqs; - array =malloc (size); -memset (array,0 , size); + array =calloc (nr_rxqs,sizeof (struct record ));if (!array) {fprintf (stderr,"Mem alloc error (nr_rxqs:%u)\n" , nr_rxqs);exit (EXIT_FAIL_MEM );
@@ -232,8 +226,7 @@ static struct stats_record *alloc_stats_record(void)struct stats_record *rec;int i; - rec =malloc (sizeof (*rec)); -memset (rec,0 ,sizeof (*rec)); + rec =calloc (1 ,sizeof (struct stats_record ));if (!rec) {fprintf (stderr,"Mem alloc error\n" );exit (EXIT_FAIL_MEM );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 120/265 ARM: dts: am335x-pocketbeagle: Fix mmc0 Write Protect
In reply to Sasha LevinFrom: Drew Fustini <[email protected]>
[ Upstream commit d7af722344e6dc52d87649100516515263e15c75 ]
AM3358 pin mcasp0_aclkr (ZCZ ball B13) [0] is routed to P1.31 header [1] Mode 4 of this pin is mmc0_sdwp (SD Write Protect). A signal connected to P1.31 may accidentally trigger mmc0 write protection. To avoid this situation, do not put mcasp0_aclkr in mode 4 (mmc0_sdwp) by default.
[0] http://www.ti.com/lit/ds/symlink/am3358.pdf
[1] https://github.com/beagleboard/pocketbeagle/wiki/System-Reference-Manual#531_Expansion_Headers
--- arch/arm/boot/dts/am335x-pocketbeagle.dts | 1 - 1 file changed, 1 deletion(-)
arch/arm/boot/dts/am335x-pocketbeagle.dts +0 -1
@@ -88,7 +88,6 @@ AM33XX_PADCONF(AM335X_PIN_MMC0_DAT3, PIN_INPUT_PULLUP, MUX_MODE0) AM33XX_PADCONF(AM335X_PIN_MMC0_CMD, PIN_INPUT_PULLUP, MUX_MODE0) AM33XX_PADCONF(AM335X_PIN_MMC0_CLK, PIN_INPUT_PULLUP, MUX_MODE0) - AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKR, PIN_INPUT, MUX_MODE4) /* (B12) mcasp0_aclkr.mmc0_sdwp */ >; };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 121/265 ARM: dts: Fix duovero smsc interrupt for suspend
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
[ Upstream commit 9cf28e41f9f768791f54ee18333239fda6927ed8 ]
While testing the recent suspend and resume regressions I noticed that duovero can still end up losing edge gpio interrupts on runtime suspend. This causes NFSroot easily stopping working after resume on duovero.
Let's fix the issue by using gpio level interrupts for smsc as then the gpio interrupt state is seen by the gpio controller on resume.
--- arch/arm/boot/dts/omap4-duovero-parlor.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/omap4-duovero-parlor.dts +1 -1
@@ -139,7 +139,7 @@ ethernet@gpmc { reg = <5 0 0xff>; interrupt-parent = <&gpio2>; - interrupts = <12 IRQ_TYPE_EDGE_FALLING>; /* gpio_44 */ + interrupts = <12 IRQ_TYPE_LEVEL_LOW>; /* gpio_44 */ phy-mode = "mii";
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 122/265 dma-direct: re-encrypt memory if dma_direct_alloc_pages() fails
In reply to Sasha LevinFrom: David Rientjes <[email protected]>
[ Upstream commit 96a539fa3bb71f443ae08e57b9f63d6e5bb2207c ]
If arch_dma_set_uncached() fails after memory has been decrypted, it needs to be re-encrypted before freeing.
--- kernel/dma/direct.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/dma/direct.c +6 -1
@@ -186,7 +186,7 @@ void *dma_direct_alloc_pages(struct device *dev, size_t size,arch_dma_prep_coherent (page, size); ret =arch_dma_set_uncached (ret, size);if (IS_ERR (ret)) - goto out_free_pages; + goto out_encrypt_pages; } done:if (force_dma_unencrypted (dev))
@@ -194,6 +194,11 @@ done:else *dma_handle =phys_to_dma (dev,page_to_phys (page));return ret; + +out_encrypt_pages: +if (force_dma_unencrypted (dev)) +set_memory_encrypted ((unsigned long )page_address (page), +1 <<get_order (size)); out_free_pages:dma_free_contiguous (dev, page, size);return NULL ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 123/265 dma-direct: check return value when encrypting or decrypting memory
In reply to Sasha LevinFrom: David Rientjes <[email protected]>
[ Upstream commit 56fccf21d1961a06e2a0c96ce446ebf036651062 ]
__change_page_attr() can fail which will cause set_memory_encrypted() and set_memory_decrypted() to return non-zero.
If the device requires unencrypted DMA memory and decryption fails, simply free the memory and fail.
If attempting to re-encrypt in the failure path and that encryption fails, there is no alternative other than to leak the memory.
--- kernel/dma/direct.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
kernel/dma/direct.c +14 -5
@@ -124,6 +124,7 @@ void *dma_direct_alloc_pages(struct device *dev, size_t size, {struct page *page;void *ret; +int err; if (IS_ENABLED(CONFIG_DMA_DIRECT_REMAP) && dma_alloc_need_uncached(dev, attrs) &&
@@ -176,8 +177,12 @@ void *dma_direct_alloc_pages(struct device *dev, size_t size, } ret =page_address (page); -if (force_dma_unencrypted (dev)) -set_memory_decrypted ((unsigned long )ret,1 <<get_order (size)); +if (force_dma_unencrypted (dev)) { + err =set_memory_decrypted ((unsigned long )ret, +1 <<get_order (size)); +if (err) + goto out_free_pages; + }memset (ret,0 , size);
@@ -196,9 +201,13 @@ done:return ret; out_encrypt_pages: -if (force_dma_unencrypted (dev)) -set_memory_encrypted ((unsigned long )page_address (page), -1 <<get_order (size)); +if (force_dma_unencrypted (dev)) { + err =set_memory_encrypted ((unsigned long )page_address (page), +1 <<get_order (size)); +/* If memory cannot be re-encrypted, it must be leaked */ +if (err) +return NULL ; + } out_free_pages:dma_free_contiguous (dev, page, size);return NULL ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 124/265 x86/resctrl: Fix a NULL vs IS_ERR() static checker warning in rdt_cdp_peer_get()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit cc5277fe66cf3ad68f41f1c539b2ef0d5e432974 ]
The callers don't expect *d_cdp to be set to an error pointer, they only check for NULL. This leads to a static checker warning:
arch/x86/kernel/cpu/resctrl/rdtgroup.c:2648 __init_one_rdt_domain()
warn: 'd_cdp' could be an error pointer
This would not trigger a bug in this specific case because __init_one_rdt_domain() calls it with a valid domain that would not have a negative id and thus not trigger the return of the ERR_PTR(). If this was a negative domain id then the call to rdt_find_domain() in domain_add_cpu() would have returned the ERR_PTR() much earlier and the creation of the domain with an invalid id would have been prevented.
Even though a bug is not triggered currently the right and safe thing to do is to set the pointer to NULL because that is what can be checked for when the caller is handling the CDP and non-CDP cases.
--- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/cpu/resctrl/rdtgroup.c +1 -0
@@ -1117,6 +1117,7 @@ static int rdt_cdp_peer_get(struct rdt_resource *r, struct rdt_domain *d, _d_cdp =rdt_find_domain (_r_cdp, d->id,NULL );if (WARN_ON (IS_ERR_OR_NULL (_d_cdp))) { _r_cdp =NULL ; + _d_cdp =NULL ; ret = -EINVAL ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 125/265 efi/x86: Setup stack correctly for efi_pe_entry
In reply to Sasha LevinFrom: Arvind Sankar <[email protected]>
[ Upstream commit 41d90b0c1108d1e46c48cf79964636c553844f4c ]
Commit
17054f492dfd ("efi/x86: Implement mixed mode boot without the handover protocol")
introduced a new entry point for the EFI stub to be booted in mixed mode on 32-bit firmware.
When entered via efi32_pe_entry, control is first transferred to startup_32 to setup for the switch to long mode, and then the EFI stub proper is entered via efi_pe_entry. efi_pe_entry is an MS ABI function, and the ABI requires 32 bytes of shadow stack space to be allocated by the caller, as well as the stack being aligned to 8 mod 16 on entry.
Allocate 40 bytes on the stack before switching to 64-bit mode when calling efi_pe_entry to account for this.
For robustness, explicitly align boot_stack_end to 16 bytes. It is currently implicitly aligned since .bss is cacheline-size aligned, head_64.o is the first object file with a .bss section, and the heap and boot sizes are aligned.
--- arch/x86/boot/compressed/head_64.S | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
arch/x86/boot/compressed/head_64.S +10 -1
@@ -213,7 +213,6 @@ SYM_FUNC_START(startup_32) * We place all of the values on our mini stack so lret can * used to perform that far jump. */ - pushl $__KERNEL_CS leal startup_64(%ebp), %eax #ifdef CONFIG_EFI_MIXED movl efi32_boot_args(%ebp), %edi
@@ -224,11 +223,20 @@ SYM_FUNC_START(startup_32) movl efi32_boot_args+8(%ebp), %edx // saved bootparams pointer cmpl $0, %edx jnz 1f + /* + * efi_pe_entry uses MS calling convention, which requires 32 bytes of + * shadow space on the stack even if all arguments are passed in + * registers. We also need an additional 8 bytes for the space that + * would be occupied by the return address, and this also results in + * the correct stack alignment for entry. + */ + subl $40, %esp leal efi_pe_entry(%ebp), %eax movl %edi, %ecx // MS calling convention movl %esi, %edx 1: #endif + pushl $__KERNEL_CS pushl %eax /* Enter paged protected Mode, activating Long Mode */
@@ -776,6 +784,7 @@ SYM_DATA_LOCAL(boot_heap, .fill BOOT_HEAP_SIZE, 1, 0) SYM_DATA_START_LOCAL(boot_stack) .fill BOOT_STACK_SIZE, 1, 0 + .balign 16 SYM_DATA_END_LABEL(boot_stack, SYM_L_LOCAL, boot_stack_end) /*
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 126/265 regmap: Fix memory leak from regmap_register_patch
In reply to Sasha LevinFrom: Charles Keepax <[email protected]>
[ Upstream commit 95b2c3ec4cb1689db2389c251d39f64490ba641c ]
When a register patch is registered the reg_sequence is copied but the memory allocated is never freed. Add a kfree in regmap_exit to clean it up.
--- drivers/base/regmap/regmap.c | 1 + 1 file changed, 1 insertion(+)
drivers/base/regmap/regmap.c +1 -0
@@ -1356,6 +1356,7 @@ void regmap_exit(struct regmap *map)if (map->hwlock)hwspin_lock_free (map->hwlock);kfree_const (map->name); +kfree (map->patch);kfree (map); }EXPORT_SYMBOL_GPL (regmap_exit);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 127/265 devmap: Use bpf_map_area_alloc() for allocating hash buckets
In reply to Sasha LevinFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 99c51064fb06146b3d494b745c947e438a10aaa7 ]
Syzkaller discovered that creating a hash of type devmap_hash with a large number of entries can hit the memory allocator limit for allocating contiguous memory regions. There's really no reason to use kmalloc_array() directly in the devmap code, so just switch it to the existing bpf_map_area_alloc() function that is used elsewhere.
--- kernel/bpf/devmap.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
kernel/bpf/devmap.c +6 -4
@@ -85,12 +85,13 @@ static DEFINE_PER_CPU(struct list_head, dev_flush_list);static DEFINE_SPINLOCK (dev_map_lock);static LIST_HEAD (dev_map_list); -static struct hlist_head *dev_map_create_hash (unsigned int entries) +static struct hlist_head *dev_map_create_hash (unsigned int entries, +int numa_node) {int i;struct hlist_head *hash; - hash =kmalloc_array (entries,sizeof (*hash),GFP_KERNEL ); + hash =bpf_map_area_alloc (entries *sizeof (*hash), numa_node);if (hash !=NULL )for (i =0 ; i < entries; i++)INIT_HLIST_HEAD (&hash[i]);
@@ -138,7 +139,8 @@ static int dev_map_init_map(struct bpf_dtab *dtab, union bpf_attr *attr)return -EINVAL ;if (attr->map_type ==BPF_MAP_TYPE_DEVMAP_HASH ) { - dtab->dev_index_head =dev_map_create_hash (dtab->n_buckets); + dtab->dev_index_head =dev_map_create_hash (dtab->n_buckets, + dtab->map.numa_node);if (!dtab->dev_index_head) goto free_charge;
@@ -223,7 +225,7 @@ static void dev_map_free(struct bpf_map *map) } } -kfree (dtab->dev_index_head); +bpf_map_area_free (dtab->dev_index_head); }else {for (i =0 ; i < dtab->map.max_entries; i++) {struct bpf_dtab_netdev *dev;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 128/265 bpf: Don't return EINVAL from {get,set}sockopt when optlen > PAGE_SIZE
In reply to Sasha LevinFrom: Stanislav Fomichev <[email protected]>
[ Upstream commit d8fe449a9c51a37d844ab607e14e2f5c657d3cf2 ]
Attaching to these hooks can break iptables because its optval is usually quite big, or at least bigger than the current PAGE_SIZE limit. David also mentioned some SCTP options can be big (around 256k).
For such optvals we expose only the first PAGE_SIZE bytes to the BPF program. BPF program has two options:
1. Set ctx->optlen to 0 to indicate that the BPF's optval should be ignored and the kernel should use original userspace value.
2. Set ctx->optlen to something that's smaller than the PAGE_SIZE.
v5:
* use ctx->optlen == 0 with trimmed buffer (Alexei Starovoitov)
* update the docs accordingly
v4:
* use temporary buffer to avoid optval == optval_end == NULL; this removes the corner case in the verifier that might assume non-zero PTR_TO_PACKET/PTR_TO_PACKET_END.
v3:
* don't increase the limit, bypass the argument
v2:
* proper comments formatting (Jakub Kicinski)
--- kernel/bpf/cgroup.c | 53 ++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 20 deletions(-)
kernel/bpf/cgroup.c +33 -20
@@ -1240,16 +1240,23 @@ static bool __cgroup_bpf_prog_array_is_empty(struct cgroup *cgrp,static int sockopt_alloc_buf (struct bpf_sockopt_kern *ctx,int max_optlen) { -if (unlikely (max_optlen >PAGE_SIZE ) || max_optlen <0 ) +if (unlikely (max_optlen <0 ))return -EINVAL ; +if (unlikely (max_optlen >PAGE_SIZE )) { +/* We don't expose optvals that are greater than PAGE_SIZE +* to the BPF program. +*/ + max_optlen =PAGE_SIZE ; + } + ctx->optval =kzalloc (max_optlen,GFP_USER );if (!ctx->optval)return -ENOMEM ; ctx->optval_end = ctx->optval + max_optlen; -return 0 ; +return max_optlen; }static void sockopt_free_buf (struct bpf_sockopt_kern *ctx)
@@ -1283,13 +1290,13 @@ int __cgroup_bpf_run_filter_setsockopt(struct sock *sk, int *level,*/ max_optlen =max_t (int,16 , *optlen); - ret =sockopt_alloc_buf (&ctx, max_optlen); -if (ret) -return ret; + max_optlen =sockopt_alloc_buf (&ctx, max_optlen); +if (max_optlen <0 ) +return max_optlen; ctx.optlen = *optlen; -if (copy_from_user (ctx.optval, optval, *optlen) !=0 ) { +if (copy_from_user (ctx.optval, optval,min (*optlen, max_optlen)) !=0 ) { ret = -EFAULT ; goto out; }
@@ -1317,8 +1324,14 @@ int __cgroup_bpf_run_filter_setsockopt(struct sock *sk, int *level,/* export any potential modifications */ *level = ctx.level; *optname = ctx.optname; - *optlen = ctx.optlen; - *kernel_optval = ctx.optval; + +/* optlen == 0 from BPF indicates that we should +* use original userspace data. +*/ +if (ctx.optlen !=0 ) { + *optlen = ctx.optlen; + *kernel_optval = ctx.optval; + } } out:
@@ -1350,12 +1363,12 @@ int __cgroup_bpf_run_filter_getsockopt(struct sock *sk, int level, __cgroup_bpf_prog_array_is_empty(cgrp, BPF_CGROUP_GETSOCKOPT))return retval; - ret =sockopt_alloc_buf (&ctx, max_optlen); -if (ret) -return ret; - ctx.optlen = max_optlen; + max_optlen =sockopt_alloc_buf (&ctx, max_optlen); +if (max_optlen <0 ) +return max_optlen; +if (!retval) {/* If kernel getsockopt finished successfully, * copy whatever was returned to the user back
@@ -1369,10 +1382,8 @@ int __cgroup_bpf_run_filter_getsockopt(struct sock *sk, int level, goto out; } -if (ctx.optlen > max_optlen) - ctx.optlen = max_optlen; - -if (copy_from_user (ctx.optval, optval, ctx.optlen) !=0 ) { +if (copy_from_user (ctx.optval, optval, +min (ctx.optlen, max_optlen)) !=0 ) { ret = -EFAULT ; goto out; }
@@ -1401,10 +1412,12 @@ int __cgroup_bpf_run_filter_getsockopt(struct sock *sk, int level, goto out; } -if (copy_to_user (optval, ctx.optval, ctx.optlen) || -put_user (ctx.optlen, optlen)) { - ret = -EFAULT ; - goto out; +if (ctx.optlen !=0 ) { +if (copy_to_user (optval, ctx.optval, ctx.optlen) || +put_user (ctx.optlen, optlen)) { + ret = -EFAULT ; + goto out; + } } ret = ctx.retval;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 129/265 ARM: dts: NSP: Correct FA2 mailbox node
In reply to Sasha LevinFrom: Matthew Hagan <[email protected]>
[ Upstream commit ac4e106d8934a5894811fc263f4b03fc8ed0fb7a ]
The FA2 mailbox is specified at 0x18025000 but should actually be 0x18025c00, length 0x400 according to socregs_nsp.h and board_bu.c. Also the interrupt was off by one and should be GIC SPI 151 instead of 150.
--- arch/arm/boot/dts/bcm-nsp.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/bcm-nsp.dtsi +3 -3
@@ -259,10 +259,10 @@ status = "disabled"; }; - mailbox: mailbox@25000 { + mailbox: mailbox@25c00 { compatible = "brcm,iproc-fa2-mbox"; - reg = <0x25000 0x445>; - interrupts = <GIC_SPI 150 IRQ_TYPE_LEVEL_HIGH>; + reg = <0x25c00 0x400>; + interrupts = <GIC_SPI 151 IRQ_TYPE_LEVEL_HIGH>; #mbox-cells = <1>; brcm,rx-status-len = <32>; brcm,use-bcm-hdr;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 130/265 rxrpc: Fix handling of rwind from an ACK packet
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit a2ad7c21ad8cf1ce4ad65e13df1c2a1c29b38ac5 ]
The handling of the receive window size (rwind) from a received ACK packet is not correct. The rxrpc_input_ackinfo() function currently checks the current Tx window size against the rwind from the ACK to see if it has changed, but then limits the rwind size before storing it in the tx_winsize member and, if it increased, wake up the transmitting process. This means that if rwind > RXRPC_RXTX_BUFF_SIZE - 1, this path will always be followed.
Fix this by limiting rwind before we compare it to tx_winsize.
The effect of this can be seen by enabling the rxrpc_rx_rwind_change tracepoint.
--- net/rxrpc/input.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
net/rxrpc/input.c +3 -4
@@ -723,13 +723,12 @@ static void rxrpc_input_ackinfo(struct rxrpc_call *call, struct sk_buff *skb,ntohl (ackinfo->rxMTU),ntohl (ackinfo->maxMTU), rwind, ntohl(ackinfo->jumbo_max)); +if (rwind >RXRPC_RXTX_BUFF_SIZE -1 ) + rwind =RXRPC_RXTX_BUFF_SIZE -1 ;if (call->tx_winsize != rwind) { -if (rwind >RXRPC_RXTX_BUFF_SIZE -1 ) - rwind =RXRPC_RXTX_BUFF_SIZE -1 ;if (rwind > call->tx_winsize) wake = true; -trace_rxrpc_rx_rwind_change (call, sp->hdr.serial, -ntohl (ackinfo->rwind), wake); +trace_rxrpc_rx_rwind_change (call, sp->hdr.serial, rwind, wake); call->tx_winsize = rwind; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 131/265 RDMA/rvt: Fix potential memory leak caused by rvt_alloc_rq
In reply to Sasha LevinFrom: Aditya Pakki <[email protected]>
[ Upstream commit 90a239ee25fa3a483facec3de7c144361a3d3a51 ]
In case of failure of alloc_ud_wq_attr(), the memory allocated by rvt_alloc_rq() is not freed. Fix it by calling rvt_free_rq() using the existing clean-up code.
--- drivers/infiniband/sw/rdmavt/qp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/sw/rdmavt/qp.c +4 -2
@@ -1196,7 +1196,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd, err =alloc_ud_wq_attr (qp, rdi->dparms.node);if (err) { ret = (ERR_PTR (err)); - goto bail_driver_priv; + goto bail_rq_rvt; } err = alloc_qpn(rdi, &rdi->qp_dev->qpn_table,
@@ -1300,9 +1300,11 @@ bail_qpn:rvt_free_qpn (&rdi->qp_dev->qpn_table, qp->ibqp.qp_num); bail_rq_wq: -rvt_free_rq (&qp->r_rq);free_ud_wq_attr (qp); +bail_rq_rvt: +rvt_free_rq (&qp->r_rq); + bail_driver_priv: rdi->driver_f.qp_priv_free (rdi, qp);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 132/265 RDMA/efa: Set maximum pkeys device attribute
In reply to Sasha LevinFrom: Gal Pressman <[email protected]>
[ Upstream commit 0133654d8eb8607eacc96badfe49bf992155f4cb ]
The max_pkeys device attribute was not set in query device verb, set it to one in order to account for the default pkey (0xffff). This information is exposed to userspace and can cause malfunction
--- drivers/infiniband/hw/efa/efa_verbs.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/efa/efa_verbs.c +1 -0
@@ -209,6 +209,7 @@ int efa_query_device(struct ib_device *ibdev, props->max_send_sge = dev_attr->max_sq_sge; props->max_recv_sge = dev_attr->max_rq_sge; props->max_sge_rd = dev_attr->max_wr_rdma_sge; + props->max_pkeys =1 ;if (udata && udata->outlen) { resp.max_sq_sge = dev_attr->max_sq_sge;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 133/265 RDMA/qedr: Fix KASAN: use-after-free in ucma_event_handler+0x532
In reply to Sasha LevinFrom: Michal Kalderon <[email protected]>
[ Upstream commit 0dfbd5ecf28cbcb81674c49d34ee97366db1be44 ]
Private data passed to iwarp_cm_handler is copied for connection request / response, but ignored otherwise. If junk is passed, it is stored in the event and used later in the event processing.
The driver passes an old junk pointer during connection close which leads to a use-after-free on event processing. Set private data to NULL for events that don 't have private data.
BUG: KASAN: use-after-free in ucma_event_handler+0x532/0x560 [rdma_ucm] kernel: Read of size 4 at addr ffff8886caa71200 by task kworker/u128:1/5250 kernel: kernel: Workqueue: iw_cm_wq cm_work_handler [iw_cm] kernel: Call Trace: kernel: dump_stack+0x8c/0xc0 kernel: print_address_description.constprop.0+0x1b/0x210 kernel: ? ucma_event_handler+0x532/0x560 [rdma_ucm] kernel: ? ucma_event_handler+0x532/0x560 [rdma_ucm] kernel: __kasan_report.cold+0x1a/0x33 kernel: ? ucma_event_handler+0x532/0x560 [rdma_ucm] kernel: kasan_report+0xe/0x20 kernel: check_memory_region+0x130/0x1a0 kernel: memcpy+0x20/0x50 kernel: ucma_event_handler+0x532/0x560 [rdma_ucm] kernel: ? __rpc_execute+0x608/0x620 [sunrpc] kernel: cma_iw_handler+0x212/0x330 [rdma_cm] kernel: ? iw_conn_req_handler+0x6e0/0x6e0 [rdma_cm] kernel: ? enqueue_timer+0x86/0x140 kernel: ? _raw_write_lock_irq+0xd0/0xd0 kernel: cm_work_handler+0xd3d/0x1070 [iw_cm]
--- drivers/infiniband/hw/qedr/qedr_iw_cm.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/infiniband/hw/qedr/qedr_iw_cm.c +11 -2
@@ -150,8 +150,17 @@ qedr_iw_issue_event(void *context,if (params->cm_info) { event.ird = params->cm_info->ird; event.ord = params->cm_info->ord; - event.private_data_len = params->cm_info->private_data_len; - event.private_data = (void *)params->cm_info->private_data; +/* Only connect_request and reply have valid private data +* the rest of the events this may be left overs from +* connection establishment. CONNECT_REQUEST is issued via +* qedr_iw_mpa_request +*/ +if (event_type ==IW_CM_EVENT_CONNECT_REPLY ) { + event.private_data_len = + params->cm_info->private_data_len; + event.private_data = + (void *)params->cm_info->private_data; + } }if (ep->cm_id)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 134/265 RDMA/cma: Protect bind_list and listen_list while finding matching cm id
In reply to Sasha LevinFrom: Mark Zhang <[email protected]>
[ Upstream commit 730c8912484186d4623d0c76509066d285c3a755 ]
The bind_list and listen_list must be accessed under a lock, add the missing locking around the access in cm_ib_id_from_event()
In addition add lockdep asserts to make it clearer what the locking semantic is here.
general protection fault: 0000 [#1] SMP NOPTI CPU: 226 PID: 126135 Comm: kworker/226:1 Tainted: G OE 4.12.14-150.47-default #1 SLE15 Hardware name: Cray Inc. Windom/Windom, BIOS 0.8.7 01-10-2020 Workqueue: ib_cm cm_work_handler [ib_cm] task: ffff9c5a60a1d2c0 task.stack: ffffc1d91f554000 RIP: 0010:cma_ib_req_handler+0x3f1/0x11b0 [rdma_cm] RSP: 0018:ffffc1d91f557b40 EFLAGS: 00010286 RAX: deacffffffffff30 RBX: 0000000000000001 RCX: ffff9c2af5bb6000 RDX: 00000000000000a9 RSI: ffff9c5aa4ed2f10 RDI: ffffc1d91f557b08 RBP: ffffc1d91f557d90 R08: ffff9c340cc80000 R09: ffff9c2c0f901900 R10: 0000000000000000 R11: 0000000000000001 R12: deacffffffffff30 R13: ffff9c5a48aeec00 R14: ffffc1d91f557c30 R15: ffff9c5c2eea3688 FS: 0000000000000000(0000) GS:ffff9c5c2fa80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00002b5cc03fa320 CR3: 0000003f8500a000 CR4: 00000000003406e0 Call Trace: ? rdma_addr_cancel+0xa0/0xa0 [ib_core] ? cm_process_work+0x28/0x140 [ib_cm] cm_process_work+0x28/0x140 [ib_cm] ? cm_get_bth_pkey.isra.44+0x34/0xa0 [ib_cm] cm_work_handler+0xa06/0x1a6f [ib_cm] ? __switch_to_asm+0x34/0x70 ? __switch_to_asm+0x34/0x70 ? __switch_to_asm+0x40/0x70 ? __switch_to_asm+0x34/0x70 ? __switch_to_asm+0x40/0x70 ? __switch_to_asm+0x34/0x70 ? __switch_to_asm+0x40/0x70 ? __switch_to+0x7c/0x4b0 ? __switch_to_asm+0x40/0x70 ? __switch_to_asm+0x34/0x70 process_one_work+0x1da/0x400 worker_thread+0x2b/0x3f0 ? process_one_work+0x400/0x400 kthread+0x118/0x140 ? kthread_create_on_node+0x40/0x40 ret_from_fork+0x22/0x40 Code: 00 66 83 f8 02 0f 84 ca 05 00 00 49 8b 84 24 d0 01 00 00 48 85 c0 0f 84 68 07 00 00 48 2d d0 01 00 00 49 89 c4 0f 84 59 07 00 00 <41> 0f b7 44 24 20 49 8b 77 50 66 83 f8 0a 75 9e 49 8b 7c 24 28
--- drivers/infiniband/core/cma.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/infiniband/core/cma.c +18 -0
@@ -1619,6 +1619,8 @@ static struct rdma_id_private *cma_find_listener( {struct rdma_id_private *id_priv, *id_priv_dev; +lockdep_assert_held (&lock); +if (!bind_list)return ERR_PTR (-EINVAL );
@@ -1665,6 +1667,7 @@ cma_ib_id_from_event(struct ib_cm_id *cm_id, } } +mutex_lock (&lock);/* * Net namespace might be getting deleted while route lookup, * cm_id lookup is in progress. Therefore, perform netdevice
@@ -1706,6 +1709,7 @@ cma_ib_id_from_event(struct ib_cm_id *cm_id, id_priv =cma_find_listener (bind_list, cm_id, ib_event, req, *net_dev); err:rcu_read_unlock (); +mutex_unlock (&lock);if (IS_ERR (id_priv) && *net_dev) {dev_put (*net_dev); *net_dev =NULL ;
@@ -2481,6 +2485,8 @@ static void cma_listen_on_dev(struct rdma_id_private *id_priv,struct net *net = id_priv->id.route.addr.dev_addr.net;int ret; +lockdep_assert_held (&lock); +if (cma_family (id_priv) ==AF_IB && !rdma_cap_ib_cm (cma_dev->device,1 ))return ;
@@ -3308,6 +3314,8 @@ static void cma_bind_port(struct rdma_bind_list *bind_list,u64 sid, mask;__be16 port; +lockdep_assert_held (&lock); + addr =cma_src_addr (id_priv); port =htons (bind_list->port);
@@ -3336,6 +3344,8 @@ static int cma_alloc_port(enum rdma_ucm_port_space ps,struct rdma_bind_list *bind_list;int ret; +lockdep_assert_held (&lock); + bind_list =kzalloc (sizeof *bind_list,GFP_KERNEL );if (!bind_list)return -ENOMEM ;
@@ -3362,6 +3372,8 @@ static int cma_port_is_unique(struct rdma_bind_list *bind_list,struct sockaddr *saddr =cma_src_addr (id_priv);__be16 dport =cma_port (daddr); +lockdep_assert_held (&lock); +hlist_for_each_entry (cur_id, &bind_list->owners, node) {struct sockaddr *cur_daddr =cma_dst_addr (cur_id);struct sockaddr *cur_saddr =cma_src_addr (cur_id);
@@ -3401,6 +3413,8 @@ static int cma_alloc_any_port(enum rdma_ucm_port_space ps,unsigned int rover;struct net *net = id_priv->id.route.addr.dev_addr.net; +lockdep_assert_held (&lock); +inet_get_local_port_range (net, &low, &high); remaining = (high - low) +1 ; rover =prandom_u32 () % remaining + low;
@@ -3448,6 +3462,8 @@ static int cma_check_port(struct rdma_bind_list *bind_list,struct rdma_id_private *cur_id;struct sockaddr *addr, *cur_addr; +lockdep_assert_held (&lock); + addr =cma_src_addr (id_priv);hlist_for_each_entry (cur_id, &bind_list->owners, node) {if (id_priv == cur_id)
@@ -3478,6 +3494,8 @@ static int cma_use_port(enum rdma_ucm_port_space ps,unsigned short snum;int ret; +lockdep_assert_held (&lock); + snum =ntohs (cma_port (cma_src_addr (id_priv)));if (snum <PROT_SOCK && !capable (CAP_NET_BIND_SERVICE ))return -EACCES ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 135/265 RDMA/core: Check that type_attrs is not NULL prior access
In reply to Sasha LevinFrom: Leon Romanovsky <[email protected]>
[ Upstream commit 4121fb0db68ed4de574f9bdc630b75fcc99b4835 ]
In disassociate flow, the type_attrs is set to be NULL, which is in an implicit way is checked in alloc_uobj() by "if (!attrs->context)".
Change the logic to rely on that check, to be consistent with other alloc_uobj() places that will fix the following kernel splat.
BUG: kernel NULL pointer dereference, address: 0000000000000018 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] SMP PTI CPU: 3 PID: 2743 Comm: python3 Not tainted 5.7.0-rc6-for-upstream-perf-2020-05-23_19-04-38-5 #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014 RIP: 0010:alloc_begin_fd_uobject+0x18/0xf0 [ib_uverbs] Code: 89 43 48 eb 97 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 41 55 49 89 f5 41 54 55 48 89 fd 53 48 83 ec 08 48 8b 1f <48> 8b 43 18 48 8b 80 80 00 00 00 48 3d 20 10 33 a0 74 1c 48 3d 30 RSP: 0018:ffffc90001127b70 EFLAGS: 00010282 RAX: ffffffffa0339fe0 RBX: 0000000000000000 RCX: 8000000000000007 RDX: fffffffffffffffb RSI: ffffc90001127d28 RDI: ffff88843fe1f600 RBP: ffff88843fe1f600 R08: ffff888461eb06d8 R09: ffff888461eb06f8 R10: ffff888461eb0700 R11: 0000000000000000 R12: ffff88846a5f6450 R13: ffffc90001127d28 R14: ffff88845d7d6ea0 R15: ffffc90001127cb8 FS: 00007f469bff1540(0000) GS:ffff88846f980000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000018 CR3: 0000000450018003 CR4: 0000000000760ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: ? xa_store+0x28/0x40 rdma_alloc_begin_uobject+0x4f/0x90 [ib_uverbs] ib_uverbs_create_comp_channel+0x87/0xf0 [ib_uverbs] ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0xb1/0xf0 [ib_uverbs] ib_uverbs_cmd_verbs.isra.8+0x96d/0xae0 [ib_uverbs] ? get_page_from_freelist+0x3bb/0xf70 ? _copy_to_user+0x22/0x30 ? uverbs_disassociate_api+0xd0/0xd0 [ib_uverbs] ? __wake_up_common_lock+0x87/0xc0 ib_uverbs_ioctl+0xbc/0x130 [ib_uverbs] ksys_ioctl+0x83/0xc0 ? ksys_write+0x55/0xd0 __x64_sys_ioctl+0x16/0x20 do_syscall_64+0x48/0x130 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f469ac43267
--- drivers/infiniband/core/rdma_core.c | 36 +++++++++++++++++------------ 1 file changed, 21 insertions(+), 15 deletions(-)
drivers/infiniband/core/rdma_core.c +21 -15
@@ -459,40 +459,46 @@ static struct ib_uobject * alloc_begin_fd_uobject(const struct uverbs_api_object *obj, struct uverbs_attr_bundle *attrs) { - const struct uverbs_obj_fd_type *fd_type = - container_of(obj->type_attrs, struct uverbs_obj_fd_type, type); + const struct uverbs_obj_fd_type *fd_type;int new_fd; -struct ib_uobject *uobj; +struct ib_uobject *uobj, *ret;struct file *filp; + uobj =alloc_uobj (attrs, obj); +if (IS_ERR (uobj)) +return uobj; + + fd_type = + container_of(obj->type_attrs, struct uverbs_obj_fd_type, type);if (WARN_ON (fd_type->fops->release != &uverbs_uobject_fd_release && - fd_type->fops->release != &uverbs_async_event_release)) -return ERR_PTR (-EINVAL ); + fd_type->fops->release != &uverbs_async_event_release)) { + ret =ERR_PTR (-EINVAL ); + goto err_fd; + } new_fd =get_unused_fd_flags (O_CLOEXEC ); -if (new_fd <0 ) -return ERR_PTR (new_fd); - - uobj =alloc_uobj (attrs, obj); -if (IS_ERR (uobj)) +if (new_fd <0 ) { + ret =ERR_PTR (new_fd); goto err_fd; + }/* Note that uverbs_uobject_fd_release() is called during abort */ filp =anon_inode_getfile (fd_type->name, fd_type->fops,NULL , fd_type->flags);if (IS_ERR (filp)) { -uverbs_uobject_put (uobj); - uobj =ERR_CAST (filp); - goto err_fd; + ret =ERR_CAST (filp); + goto err_getfile; } uobj->object = filp; uobj->id = new_fd;return uobj; -err_fd: +err_getfile:put_unused_fd (new_fd); -return uobj; +err_fd: +uverbs_uobject_put (uobj); +return ret; } struct ib_uobject *rdma_alloc_begin_uobject(const struct uverbs_api_object *obj,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 136/265 ASoC: rockchip: Fix a reference count leak.
In reply to Sasha LevinFrom: Qiushi Wu <[email protected]>
[ Upstream commit f141a422159a199f4c8dedb7e0df55b3b2cf16cd ]
Calling pm_runtime_get_sync increments the counter even in case of failure, causing incorrect ref count if pm_runtime_put is not called in error handling paths. Call pm_runtime_put if pm_runtime_get_sync fails.
--- sound/soc/rockchip/rockchip_pdm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/rockchip/rockchip_pdm.c +3 -1
@@ -590,8 +590,10 @@ static int rockchip_pdm_resume(struct device *dev)int ret; ret =pm_runtime_get_sync (dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put (dev);return ret; + } ret =regcache_sync (pdm->regmap);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 137/265 s390/qeth: fix error handling for isolation mode cmds
In reply to Sasha LevinFrom: Julian Wiedmann <[email protected]>
[ Upstream commit e2dfcfba00ba4a414617ef4c5a8501fe21567eb3 ]
Current(?) OSA devices also store their cmd-specific return codes for SET_ACCESS_CONTROL cmds into the top-level cmd->hdr.return_code. So once we added stricter checking for the top-level field a while ago, none of the error logic that rolls back the user's configuration to its old state is applied any longer.
For this specific cmd, go back to the old model where we peek into the cmd structure even though the top-level field indicated an error.
--- drivers/s390/net/qeth_core_main.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/s390/net/qeth_core_main.c +1 -4
@@ -4265,9 +4265,6 @@ static int qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card,int fallback = *(int *)reply->param;QETH_CARD_TEXT (card,4 ,"setaccb" ); -if (cmd->hdr.return_code) -return -EIO ; -qeth_setadpparms_inspect_rc (cmd); access_ctrl_req = &cmd->data.setadapterparms.data.set_access_ctrl; QETH_CARD_TEXT_(card, 2, "rc=%d",
@@ -4277,7 +4274,7 @@ static int qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card,QETH_DBF_MESSAGE (3 ,"ERR:SET_ACCESS_CTRL(%#x) on device %x: %#x\n" , access_ctrl_req->subcmd_code,CARD_DEVID (card), cmd->data.setadapterparms.hdr.return_code); -switch (cmd->data.setadapterparms.hdr.return_code) { +switch (qeth_setadpparms_inspect_rc (cmd)) {case SET_ACCESS_CTRL_RC_SUCCESS :if (card->options.isolation ==ISOLATION_MODE_NONE ) { dev_info(&card->gdev->dev,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 138/265 RDMA/mad: Fix possible memory leak in ib_mad_post_receive_mads()
In reply to Sasha LevinFrom: Fan Guo <[email protected]>
[ Upstream commit a17f4bed811c60712d8131883cdba11a105d0161 ]
If ib_dma_mapping_error() returns non-zero value, ib_mad_post_receive_mads() will jump out of loops and return -ENOMEM without freeing mad_priv. Fix this memory-leak problem by freeing mad_priv in this case.
--- drivers/infiniband/core/mad.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/core/mad.c +1 -0
@@ -2941,6 +2941,7 @@ static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info, DMA_FROM_DEVICE);if (unlikely (ib_dma_mapping_error (qp_info->port_priv->device, sg_list.addr))) { +kfree (mad_priv); ret = -ENOMEM ;break ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 139/265 selftests/net: report etf errors correctly
In reply to Sasha LevinFrom: Willem de Bruijn <[email protected]>
[ Upstream commit ca8826095e4d4afc0ccaead27bba6e4b623a12ae ]
The ETF qdisc can queue skbs that it could not pace on the errqueue.
Address a few issues in the selftest
- recv buffer size was too small, and incorrectly calculated
- compared errno to ee_code instead of ee_errno
- missed invalid request error type
v2:
- fix a few checkpatch --strict indentation warnings
--- tools/testing/selftests/net/so_txtime.c | 33 +++++++++++++++++++------ 1 file changed, 26 insertions(+), 7 deletions(-)
tools/testing/selftests/net/so_txtime.c +26 -7
@@ -15,8 +15,9 @@#include <inttypes.h> #include <linux/net_tstamp.h> #include <linux/errqueue.h> +#include <linux/if_ether.h> #include <linux/ipv6.h> -#include <linux/tcp.h> +#include <linux/udp.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h>
@@ -140,8 +141,8 @@ static void do_recv_errqueue_timeout(int fdt) {char control[CMSG_SPACE (sizeof (struct sock_extended_err )) +CMSG_SPACE (sizeof (struct sockaddr_in6 ))] = {0 }; -char data[sizeof (struct ipv6hdr ) + -sizeof (struct tcphdr ) +1 ]; +char data[sizeof (struct ethhdr ) +sizeof (struct ipv6hdr ) + +sizeof (struct udphdr ) +1 ];struct sock_extended_err *err;struct msghdr msg = {0 };struct iovec iov = {0 };
@@ -159,6 +160,8 @@ static void do_recv_errqueue_timeout(int fdt) msg.msg_controllen =sizeof (control);while (1 ) { +const char *reason; + ret =recvmsg (fdt, &msg,MSG_ERRQUEUE );if (ret ==-1 && errno ==EAGAIN )break ;
@@ -176,14 +179,30 @@ static void do_recv_errqueue_timeout(int fdt) err = (struct sock_extended_err *)CMSG_DATA (cm);if (err->ee_origin !=SO_EE_ORIGIN_TXTIME )error (1 ,0 ,"errqueue: origin 0x%x\n" , err->ee_origin); -if (err->ee_code !=ECANCELED ) -error (1 ,0 ,"errqueue: code 0x%x\n" , err->ee_code); + +switch (err->ee_errno) { +case ECANCELED : +if (err->ee_code !=SO_EE_CODE_TXTIME_MISSED ) +error (1 ,0 ,"errqueue: unknown ECANCELED %u\n" , + err->ee_code); + reason ="missed txtime" ; +break ; +case EINVAL : +if (err->ee_code !=SO_EE_CODE_TXTIME_INVALID_PARAM ) +error (1 ,0 ,"errqueue: unknown EINVAL %u\n" , + err->ee_code); + reason ="invalid txtime" ; +break ; +default : +error (1 ,0 ,"errqueue: errno %u code %u\n" , + err->ee_errno, err->ee_code); + }; tstamp = ((int64_t ) err->ee_data) <<32 | err->ee_info; tstamp -= (int64_t ) glob_tstart; tstamp /=1000 *1000 ; -fprintf (stderr,"send: pkt %c at %" PRId64"ms dropped\n" , - data[ret -1 ], tstamp); +fprintf (stderr,"send: pkt %c at %" PRId64"ms dropped: %s\n" , + data[ret -1 ], tstamp, reason); msg.msg_flags =0 ; msg.msg_controllen =sizeof (control);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 140/265 ionic: tame the watchdog timer on reconfig
In reply to Sasha LevinFrom: Shannon Nelson <[email protected]>
[ Upstream commit b59eabd23ee53e8c3492602722e1697f9a2f63ad ]
Even with moving netif_tx_disable() to an earlier point when taking down the queues for a reconfiguration, we still end up with the occasional netdev watchdog Tx Timeout complaint. The old method of using netif_trans_update() works fine for queue 0, but has no effect on the remaining queues. Using netif_device_detach() allows us to signal to the watchdog to ignore us for the moment.
--- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +7 -6
@@ -1682,8 +1682,8 @@ static void ionic_stop_queues(struct ionic_lif *lif)if (!test_and_clear_bit (IONIC_LIF_F_UP , lif->state))return ; -ionic_txrx_disable (lif);netif_tx_disable (lif->netdev); +ionic_txrx_disable (lif); }int ionic_stop (struct net_device *netdev)
@@ -1949,18 +1949,19 @@ int ionic_reset_queues(struct ionic_lif *lif)bool running;int err =0 ; -/* Put off the next watchdog timeout */ -netif_trans_update (lif->netdev); - err =ionic_wait_for_bit (lif,IONIC_LIF_F_QUEUE_RESET );if (err)return err; running =netif_running (lif->netdev); -if (running) +if (running) { +netif_device_detach (lif->netdev); err =ionic_stop (lif->netdev); -if (!err && running) + } +if (!err && running) {ionic_open (lif->netdev); +netif_device_attach (lif->netdev); + }clear_bit (IONIC_LIF_F_QUEUE_RESET , lif->state);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 141/265 Revert "KVM: VMX: Micro-optimize vmexit time when not exposing PMU"
In reply to Sasha LevinFrom: Vitaly Kuznetsov <[email protected]>
[ Upstream commit 49097762fa405cdc16f8f597f6d27c078d4a31e9 ]
Guest crashes are observed on a Cascade Lake system when 'perf top' is launched on the host, e.g.
BUG: unable to handle kernel paging request at fffffe0000073038 PGD 7ffa7067 P4D 7ffa7067 PUD 7ffa6067 PMD 7ffa5067 PTE ffffffffff120 Oops: 0000 [#1] SMP PTI CPU: 1 PID: 1 Comm: systemd Not tainted 4.18.0+ #380 ... Call Trace: serial8250_console_write+0xfe/0x1f0 call_console_drivers.constprop.0+0x9d/0x120 console_unlock+0x1ea/0x460
Call traces are different but the crash is imminent. The problem was blindly bisected to the commit 041bc42ce2d0 ("KVM: VMX: Micro-optimize vmexit time when not exposing PMU"). It was also confirmed that the issue goes away if PMU is exposed to the guest.
With some instrumentation of the guest we can see what is being switched (when we do atomic_switch_perf_msrs()):
vmx_vcpu_run: switching 2 msrs
vmx_vcpu_run: switching MSR38f guest: 70000000d host: 70000000f
vmx_vcpu_run: switching MSR3f1 guest: 0 host: 2
The current guess is that PEBS (MSR_IA32_PEBS_ENABLE, 0x3f1) is to blame. Regardless of whether PMU is exposed to the guest or not, PEBS needs to be disabled upon switch.
This reverts commit 041bc42ce2d0efac3b85bbb81dea8c74b81f4ef9.
Message-Id: <[email protected]>
--- arch/x86/kvm/vmx/vmx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kvm/vmx/vmx.c +1 -2
@@ -6575,8 +6575,7 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)pt_guest_enter (vmx); -if (vcpu_to_pmu (vcpu)->version) -atomic_switch_perf_msrs (vmx); +atomic_switch_perf_msrs (vmx);atomic_switch_umwait_control_msr (vmx);if (enable_preemption_timer)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 142/265 iommu/vt-d: Set U/S bit in first level page table by default
In reply to Sasha LevinFrom: Lu Baolu <[email protected]>
[ Upstream commit 16ecf10e815d70d11d2300243f4a3b4c7c5acac7 ]
When using first-level translation for IOVA, currently the U/S bit in the page table is cleared which implies DMA requests with user privilege are blocked. As the result, following error messages might be observed when passing through a device to user level:
DMAR: DRHD: handling fault status reg 3
DMAR: [DMA Read] Request device [41:00.0] PASID 1 fault addr 7ecdcd000
[fault reason 129] SM: U/S set 0 for first-level translation with user privilege
This fixes it by setting U/S bit in the first level page table and makes IOVA over first level compatible with previous second-level translation.
--- drivers/iommu/intel-iommu.c | 5 ++--- include/linux/intel-iommu.h | 1 + 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/iommu/intel-iommu.c +2 -3
@@ -943,7 +943,7 @@ static struct dma_pte *pfn_to_dma_pte(struct dmar_domain *domain,domain_flush_cache (domain, tmp_page,VTD_PAGE_SIZE ); pteval = ((uint64_t )virt_to_dma_pfn (tmp_page) <<VTD_PAGE_SHIFT ) |DMA_PTE_READ |DMA_PTE_WRITE ;if (domain_use_first_level (domain)) - pteval |=DMA_FL_PTE_XD ; + pteval |=DMA_FL_PTE_XD |DMA_FL_PTE_US ;if (cmpxchg64 (&pte->val,0ULL , pteval))/* Someone else set it while we were thinking; use theirs. */ free_pgtable_page (tmp_page);
@@ -2034,7 +2034,6 @@ static inline void context_set_sm_rid2pasid(struct context_entry *context, unsigned long pasid) { context->hi |= pasid & ((1 <<20 ) -1 ); - context->hi |= (1 <<20 ); }/*
@@ -2326,7 +2325,7 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, attr = prot & (DMA_PTE_READ |DMA_PTE_WRITE |DMA_PTE_SNP );if (domain_use_first_level (domain)) - attr |=DMA_FL_PTE_PRESENT |DMA_FL_PTE_XD ; + attr |=DMA_FL_PTE_PRESENT |DMA_FL_PTE_XD |DMA_FL_PTE_US ;if (!sg) { sg_res = nr_pages;
include/linux/intel-iommu.h +1 -0
@@ -40,6 +40,7 @@#define DMA_PTE_SNP BIT_ULL(11)#define DMA_FL_PTE_PRESENT BIT_ULL(0) +#define DMA_FL_PTE_US BIT_ULL(2)#define DMA_FL_PTE_XD BIT_ULL(63)#define CONTEXT_TT_MULTI_LEVEL 0
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 143/265 iommu/vt-d: Enable PCI ACS for platform opt in hint
In reply to Sasha LevinFrom: Lu Baolu <[email protected]>
[ Upstream commit 50310600ebda74b9988467e2e6128711c7ba56fc ]
PCI ACS is disabled if Intel IOMMU is off by default or intel_iommu=off is used in command line. Unfortunately, Intel IOMMU will be forced on if there're devices sitting on an external facing PCI port that is marked as untrusted (for example, thunderbolt peripherals). That means, PCI ACS is disabled while Intel IOMMU is forced on to isolate those devices. As the result, the devices of an MFD will be grouped by a single group even the ACS is supported on device.
[ 0.691263] pci 0000:00:07.1: Adding to iommu group 3 [ 0.691277] pci 0000:00:07.2: Adding to iommu group 3 [ 0.691292] pci 0000:00:07.3: Adding to iommu group 3
Fix it by requesting PCI ACS when Intel IOMMU is detected with platform opt in hint.
--- drivers/iommu/dmar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iommu/dmar.c +2 -1
@@ -898,7 +898,8 @@ int __init detect_intel_iommu(void)if (!ret) ret =dmar_walk_dmar_table ((struct acpi_table_dmar *)dmar_tbl, &validate_drhd_cb); -if (!ret && !no_iommu && !iommu_detected && !dmar_disabled) { +if (!ret && !no_iommu && !iommu_detected && + (!dmar_disabled ||dmar_platform_optin ())) { iommu_detected =1 ;/* Make sure ACS will be enabled */ pci_request_acs ();
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 144/265 iommu/vt-d: Update scalable mode paging structure coherency
In reply to Sasha LevinFrom: Lu Baolu <[email protected]>
[ Upstream commit 04c00956ee3cd138fd38560a91452a804a8c5550 ]
The Scalable-mode Page-walk Coherency (SMPWC) field in the VT-d extended capability register indicates the hardware coherency behavior on paging structures accessed through the pasid table entry. This is ignored in current code and using ECAP.C instead which is only valid in legacy mode. Fix this so that paging structure updates could be manually flushed from the cache line if hardware page walking is not snooped.
--- drivers/iommu/intel-iommu.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/iommu/intel-iommu.c +10 -3
@@ -634,6 +634,12 @@ struct intel_iommu *domain_get_iommu(struct dmar_domain *domain)return g_iommus[iommu_id]; } +static inline bool iommu_paging_structure_coherency (struct intel_iommu *iommu) +{ +return sm_supported (iommu) ? +ecap_smpwc (iommu->ecap) :ecap_coherent (iommu->ecap); +} +static void domain_update_iommu_coherency (struct dmar_domain *domain) {struct dmar_drhd_unit *drhd;
@@ -645,7 +651,7 @@ static void domain_update_iommu_coherency(struct dmar_domain *domain)for_each_domain_iommu (i, domain) { found = true; -if (!ecap_coherent (g_iommus[i]->ecap)) { +if (!iommu_paging_structure_coherency (g_iommus[i])) { domain->iommu_coherency =0 ;break ; }
@@ -656,7 +662,7 @@ static void domain_update_iommu_coherency(struct dmar_domain *domain)/* No hardware attached; use lowest common denominator */ rcu_read_lock ();for_each_active_iommu (iommu, drhd) { -if (!ecap_coherent (iommu->ecap)) { +if (!iommu_paging_structure_coherency (iommu)) { domain->iommu_coherency =0 ;break ; }
@@ -2177,7 +2183,8 @@ static int domain_context_mapping_one(struct dmar_domain *domain,context_set_fault_enable (context);context_set_present (context); -domain_flush_cache (domain, context,sizeof (*context)); +if (!ecap_coherent (iommu->ecap)) +clflush_cache_range (context,sizeof (*context));/* * It's a non-present to present mapping. If hardware doesn't cache
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 145/265 soc: imx8m: Correct i.MX8MP UID fuse offset
In reply to Sasha LevinFrom: Anson Huang <[email protected]>
[ Upstream commit c95c9693b112f312b59c5d100fd09a1349970fab ]
Correct i.MX8MP UID fuse offset according to fuse map:
UID_LOW: 0x420UID_HIGH: 0x430
--- drivers/soc/imx/soc-imx8m.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/soc/imx/soc-imx8m.c +6 -2
@@ -22,6 +22,8 @@#define OCOTP_UID_LOW 0x410#define OCOTP_UID_HIGH 0x420 +#define IMX8MP_OCOTP_UID_OFFSET 0x10 +/* Same as ANADIG_DIGPROG_IMX7D */ #define ANADIG_DIGPROG_IMX8MM 0x800
@@ -88,6 +90,8 @@ static void __init imx8mm_soc_uid(void) {void __iomem *ocotp_base;struct device_node *np; +u32 offset =of_machine_is_compatible ("fsl,imx8mp" ) ? +IMX8MP_OCOTP_UID_OFFSET :0 ; np =of_find_compatible_node (NULL ,NULL ,"fsl,imx8mm-ocotp" );if (!np)
@@ -96,9 +100,9 @@ static void __init imx8mm_soc_uid(void) ocotp_base =of_iomap (np,0 );WARN_ON (!ocotp_base); - soc_uid =readl_relaxed (ocotp_base +OCOTP_UID_HIGH ); + soc_uid =readl_relaxed (ocotp_base +OCOTP_UID_HIGH + offset); soc_uid <<=32 ; - soc_uid |=readl_relaxed (ocotp_base +OCOTP_UID_LOW ); + soc_uid |=readl_relaxed (ocotp_base +OCOTP_UID_LOW + offset);iounmap (ocotp_base);of_node_put (np);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 146/265 dma-direct: add missing set_memory_decrypted() for coherent mapping
In reply to Sasha LevinFrom: David Rientjes <[email protected]>
[ Upstream commit 1a2b3357e860d890f8045367b179c7e7e802cd71 ]
When a coherent mapping is created in dma_direct_alloc_pages(), it needs to be decrypted if the device requires unencrypted DMA before returning.
--- kernel/dma/direct.c | 6 ++++++ 1 file changed, 6 insertions(+)
kernel/dma/direct.c +6 -0
@@ -161,6 +161,12 @@ void *dma_direct_alloc_pages(struct device *dev, size_t size, __builtin_return_address(0));if (!ret) goto out_free_pages; +if (force_dma_unencrypted (dev)) { + err =set_memory_decrypted ((unsigned long )ret, +1 <<get_order (size)); +if (err) + goto out_free_pages; + }memset (ret,0 , size); goto done; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 147/265 net: qed: fix left elements count calculation
In reply to Sasha LevinFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 97dd1abd026ae4e6a82fa68645928404ad483409 ]
qed_chain_get_element_left{,_u32} returned 0 when the difference between producer and consumer page count was equal to the total page count.
Fix this by conditional expanding of producer value (vs unconditional). This allowed to eliminate normalizaton against total page count, which was the cause of this bug.
Misc: replace open-coded constants with common defines.
--- include/linux/qed/qed_chain.h | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
include/linux/qed/qed_chain.h +16 -10
@@ -207,28 +207,34 @@ static inline u32 qed_chain_get_cons_idx_u32(struct qed_chain *p_chain)static inline u16 qed_chain_get_elem_left (struct qed_chain *p_chain) { +u16 elem_per_page = p_chain->elem_per_page; +u32 prod = p_chain->u.chain16.prod_idx; +u32 cons = p_chain->u.chain16.cons_idx;u16 used; - used = (u16) (((u32 )0x10000 + - (u32 )p_chain->u.chain16.prod_idx) - - (u32 )p_chain->u.chain16.cons_idx); +if (prod < cons) + prod += (u32 )U16_MAX +1 ; + + used = (u16)(prod - cons);if (p_chain->mode ==QED_CHAIN_MODE_NEXT_PTR ) - used -= p_chain->u.chain16.prod_idx / p_chain->elem_per_page - - p_chain->u.chain16.cons_idx / p_chain->elem_per_page; + used -= prod / elem_per_page - cons / elem_per_page;return (u16)(p_chain->capacity - used); }static inline u32 qed_chain_get_elem_left_u32 (struct qed_chain *p_chain) { +u16 elem_per_page = p_chain->elem_per_page; +u64 prod = p_chain->u.chain32.prod_idx; +u64 cons = p_chain->u.chain32.cons_idx;u32 used; - used = (u32) (((u64 )0x100000000ULL + - (u64 )p_chain->u.chain32.prod_idx) - - (u64 )p_chain->u.chain32.cons_idx); +if (prod < cons) + prod += (u64 )U32_MAX +1 ; + + used = (u32)(prod - cons);if (p_chain->mode ==QED_CHAIN_MODE_NEXT_PTR ) - used -= p_chain->u.chain32.prod_idx / p_chain->elem_per_page - - p_chain->u.chain32.cons_idx / p_chain->elem_per_page; + used -= (u32)(prod / elem_per_page - cons / elem_per_page);return p_chain->capacity - used; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 148/265 net: qed: fix async event callbacks unregistering
In reply to Sasha LevinFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 31333c1a2521ff4b4ceb0c29de492549cd4a8de3 ]
qed_spq_unregister_async_cb() should be called before qed_rdma_info_free() to avoid crash-spawning uses-after-free. Instead of calling it from each subsystem exit code, do it in one place on PF down.
--- drivers/net/ethernet/qlogic/qed/qed_dev.c | 9 +++++++-- drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 2 -- drivers/net/ethernet/qlogic/qed/qed_roce.c | 1 - 3 files changed, 7 insertions(+), 5 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_dev.c +7 -2
@@ -1368,6 +1368,8 @@ static void qed_dbg_user_data_free(struct qed_hwfn *p_hwfn)void qed_resc_free (struct qed_dev *cdev) { +struct qed_rdma_info *rdma_info; +struct qed_hwfn *p_hwfn;int i;if (IS_VF (cdev)) {
@@ -1385,7 +1387,8 @@ void qed_resc_free(struct qed_dev *cdev)qed_llh_free (cdev);for_each_hwfn (cdev, i) { -struct qed_hwfn *p_hwfn = &cdev->hwfns[i]; + p_hwfn = cdev->hwfns + i; + rdma_info = p_hwfn->p_rdma_info;qed_cxt_mngr_free (p_hwfn);qed_qm_info_free (p_hwfn);
@@ -1404,8 +1407,10 @@ void qed_resc_free(struct qed_dev *cdev)qed_ooo_free (p_hwfn); } -if (QED_IS_RDMA_PERSONALITY (p_hwfn)) +if (QED_IS_RDMA_PERSONALITY (p_hwfn) && rdma_info) { +qed_spq_unregister_async_cb (p_hwfn, rdma_info->proto);qed_rdma_info_free (p_hwfn); + }qed_iov_free (p_hwfn);qed_l2_free (p_hwfn);
drivers/net/ethernet/qlogic/qed/qed_iwarp.c +0 -2
@@ -2836,8 +2836,6 @@ int qed_iwarp_stop(struct qed_hwfn *p_hwfn)if (rc)return rc; -qed_spq_unregister_async_cb (p_hwfn,PROTOCOLID_IWARP ); -return qed_iwarp_ll2_stop (p_hwfn); }
drivers/net/ethernet/qlogic/qed/qed_roce.c +0 -1
@@ -113,7 +113,6 @@ void qed_roce_stop(struct qed_hwfn *p_hwfn)break ; } } -qed_spq_unregister_async_cb (p_hwfn,PROTOCOLID_ROCE ); } static void qed_rdma_copy_gids(struct qed_rdma_qp *qp, __le32 *src_gid,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 149/265 net: qede: stop adding events on an already destroyed workqueue
In reply to Sasha LevinFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 4079c7f7a2a00ab403c177ce723b560de59139c3 ]
Set rdma_wq pointer to NULL after destroying the workqueue and check for it when adding new events to fix crashes on driver unload.
--- drivers/net/ethernet/qlogic/qede/qede_rdma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qede/qede_rdma.c +2 -1
@@ -105,6 +105,7 @@ static void qede_rdma_destroy_wq(struct qede_dev *edev)qede_rdma_cleanup_event (edev);destroy_workqueue (edev->rdma_info.rdma_wq); + edev->rdma_info.rdma_wq =NULL ; }int qede_rdma_dev_add (struct qede_dev *edev,bool recovery)
@@ -325,7 +326,7 @@ static void qede_rdma_add_event(struct qede_dev *edev,if (edev->rdma_info.exp_recovery)return ; -if (!edev->rdma_info.qedr_dev) +if (!edev->rdma_info.qedr_dev || !edev->rdma_info.rdma_wq)return ;/* We don't want the cleanup flow to start while we're allocating and
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 150/265 net: qed: fix NVMe login fails over VFs
In reply to Sasha LevinFrom: Alexander Lobakin <[email protected]>
[ Upstream commit ccd7c7ce167a21dbf2b698ffcf00f11d96d44f9b ]
25ms sleep cycles in waiting for PF response are excessive and may lead to different timeout failures.
Start to wait with short udelays, and in most cases polling will end here. If the time was not sufficient, switch to msleeps. usleep_range() may go far beyond 100us depending on platform and tick configuration, hence atomic udelays for consistency.
Also add explicit DMA barriers since 'done' always comes from a shared request-response DMA pool, and note that in the comment nearby.
--- drivers/net/ethernet/qlogic/qed/qed_vf.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_vf.c +18 -5
@@ -81,12 +81,17 @@ static void qed_vf_pf_req_end(struct qed_hwfn *p_hwfn, int req_status)mutex_unlock (&(p_hwfn->vf_iov_info->mutex)); } +#define QED_VF_CHANNEL_USLEEP_ITERATIONS 90 +#define QED_VF_CHANNEL_USLEEP_DELAY 100 +#define QED_VF_CHANNEL_MSLEEP_ITERATIONS 10 +#define QED_VF_CHANNEL_MSLEEP_DELAY 25 +static int qed_send_msg2pf (struct qed_hwfn *p_hwfn,u8 *done,u32 resp_size) {union vfpf_tlvs *p_req = p_hwfn->vf_iov_info->vf2pf_request;struct ustorm_trigger_vf_zone trigger;struct ustorm_vf_zone *zone_data; -int rc =0 , time =100 ; +int iter, rc =0 ; zone_data = (struct ustorm_vf_zone *)PXP_VF_BAR0_START_USDM_ZONE_B ;
@@ -126,11 +131,19 @@ static int qed_send_msg2pf(struct qed_hwfn *p_hwfn, u8 *done, u32 resp_size)REG_WR (p_hwfn, (uintptr_t )&zone_data->trigger, *((u32 *)&trigger));/* When PF would be done with the response, it would write back to the -* `done' address. Poll until then. +* `done' address from a coherent DMA zone. Poll until then. */ -while ((!*done) && time) { -msleep (25 ); - time--; + + iter =QED_VF_CHANNEL_USLEEP_ITERATIONS ; +while (!*done && iter--) { +udelay (QED_VF_CHANNEL_USLEEP_DELAY ); +dma_rmb (); + } + + iter =QED_VF_CHANNEL_MSLEEP_ITERATIONS ; +while (!*done && iter--) { +msleep (QED_VF_CHANNEL_MSLEEP_DELAY ); +dma_rmb (); }if (!*done) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 151/265 net: qed: fix excessive QM ILT lines consumption
In reply to Sasha LevinFrom: Alexander Lobakin <[email protected]>
[ Upstream commit d434d02f7e7c24c721365fd594ed781acb18e0da ]
This is likely a copy'n'paste mistake. The amount of ILT lines to reserve for a single VF was being multiplied by the total VFs count. This led to a huge redundancy in reservation and potential lines drainouts.
--- drivers/net/ethernet/qlogic/qed/qed_cxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qed/qed_cxt.c +1 -1
@@ -270,7 +270,7 @@ static void qed_cxt_qm_iids(struct qed_hwfn *p_hwfn, vf_tids += segs[NUM_TASK_PF_SEGMENTS ].count; } - iids->vf_cids += vf_cids * p_mngr->vf_count; + iids->vf_cids = vf_cids; iids->tids += vf_tids * p_mngr->vf_count; DP_VERBOSE(p_hwfn, QED_MSG_ILT,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 152/265 net: qede: fix PTP initialization on recovery
In reply to Sasha LevinFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 1c85f394c2206ea3835f43534d5675f0574e1b70 ]
Currently PTP cyclecounter and timecounter are initialized only on the first probing and are cleaned up during removal. This means that PTP becomes non-functional after device recovery.
Fix this by unconditional PTP initialization on probing and clearing Tx pending bit on exiting.
--- drivers/net/ethernet/qlogic/qede/qede_main.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_ptp.c | 31 ++++++++------------ drivers/net/ethernet/qlogic/qede/qede_ptp.h | 2 +- 3 files changed, 15 insertions(+), 20 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_main.c +1 -1
@@ -1158,7 +1158,7 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,/* PTP not supported on VFs */ if (!is_vf) -qede_ptp_enable (edev, (mode ==QEDE_PROBE_NORMAL )); +qede_ptp_enable (edev); edev->ops->register_ops (cdev, &qede_ll_ops, edev);
drivers/net/ethernet/qlogic/qede/qede_ptp.c +13 -18
@@ -412,6 +412,7 @@ void qede_ptp_disable(struct qede_dev *edev)if (ptp->tx_skb) {dev_kfree_skb_any (ptp->tx_skb); ptp->tx_skb =NULL ; +clear_bit_unlock (QEDE_FLAGS_PTP_TX_IN_PRORGESS , &edev->flags); }/* Disable PTP in HW */
@@ -423,7 +424,7 @@ void qede_ptp_disable(struct qede_dev *edev) edev->ptp =NULL ; } -static int qede_ptp_init (struct qede_dev *edev,bool init_tc) +static int qede_ptp_init (struct qede_dev *edev) {struct qede_ptp *ptp;int rc;
@@ -444,25 +445,19 @@ static int qede_ptp_init(struct qede_dev *edev, bool init_tc)/* Init work queue for Tx timestamping */ INIT_WORK (&ptp->work, qede_ptp_task); -/* Init cyclecounter and timecounter. This is done only in the first -* load. If done in every load, PTP application will fail when doing -* unload / load (e.g. MTU change) while it is running. -*/ -if (init_tc) { -memset (&ptp->cc,0 ,sizeof (ptp->cc)); - ptp->cc.read = qede_ptp_read_cc; - ptp->cc.mask =CYCLECOUNTER_MASK (64 ); - ptp->cc.shift =0 ; - ptp->cc.mult =1 ; - -timecounter_init (&ptp->tc, &ptp->cc, -ktime_to_ns (ktime_get_real ())); - } +/* Init cyclecounter and timecounter */ +memset (&ptp->cc,0 ,sizeof (ptp->cc)); + ptp->cc.read = qede_ptp_read_cc; + ptp->cc.mask =CYCLECOUNTER_MASK (64 ); + ptp->cc.shift =0 ; + ptp->cc.mult =1 ; -return rc; +timecounter_init (&ptp->tc, &ptp->cc,ktime_to_ns (ktime_get_real ())); + +return 0 ; } -int qede_ptp_enable (struct qede_dev *edev,bool init_tc) +int qede_ptp_enable (struct qede_dev *edev) {struct qede_ptp *ptp;int rc;
@@ -483,7 +478,7 @@ int qede_ptp_enable(struct qede_dev *edev, bool init_tc) edev->ptp = ptp; - rc =qede_ptp_init (edev, init_tc); + rc =qede_ptp_init (edev);if (rc) goto err1;
drivers/net/ethernet/qlogic/qede/qede_ptp.h +1 -1
@@ -41,7 +41,7 @@ void qede_ptp_rx_ts(struct qede_dev *edev, struct sk_buff *skb);void qede_ptp_tx_ts (struct qede_dev *edev,struct sk_buff *skb);int qede_ptp_hw_ts (struct qede_dev *edev,struct ifreq *req);void qede_ptp_disable (struct qede_dev *edev); -int qede_ptp_enable (struct qede_dev *edev,bool init_tc); +int qede_ptp_enable (struct qede_dev *edev);int qede_ptp_get_ts_info (struct qede_dev *edev,struct ethtool_ts_info *ts); static inline void qede_ptp_record_rx_ts(struct qede_dev *edev,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 153/265 net: qede: fix use-after-free on recovery and AER handling
In reply to Sasha LevinFrom: Alexander Lobakin <[email protected]>
[ Upstream commit ec6c80590bde6b5dfa4970fffa3572f1acd313ca ]
Set edev->cdev pointer to NULL after calling remove() callback to avoid using of already freed object.
--- drivers/net/ethernet/qlogic/qede/qede_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/qlogic/qede/qede_main.c +1 -0
@@ -1247,6 +1247,7 @@ static void __qede_remove(struct pci_dev *pdev, enum qede_remove_mode mode)if (system_state ==SYSTEM_POWER_OFF )return ; qed_ops->common->remove (cdev); + edev->cdev =NULL ;/* Since this can happen out-of-sync with other flows, * don't release the netdevice until after slowpath stop
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 154/265 net: qed: reset ILT block sizes before recomputing to fix crashes
In reply to Sasha LevinFrom: Alexander Lobakin <[email protected]>
[ Upstream commit c221dd1831732449f844e03631a34fd21c2b9429 ]
Sizes of all ILT blocks must be reset before ILT recomputing when disabling clients, or memory allocation may exceed ILT shadow array and provoke system crashes.
--- drivers/net/ethernet/qlogic/qed/qed_cxt.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/ethernet/qlogic/qed/qed_cxt.c +19 -0
@@ -442,6 +442,20 @@ static struct qed_ilt_cli_blk *qed_cxt_set_blk(struct qed_ilt_cli_blk *p_blk)return p_blk; } +static void qed_cxt_ilt_blk_reset (struct qed_hwfn *p_hwfn) +{ +struct qed_ilt_client_cfg *clients = p_hwfn->p_cxt_mngr->clients; +u32 cli_idx, blk_idx; + +for (cli_idx =0 ; cli_idx <MAX_ILT_CLIENTS ; cli_idx++) { +for (blk_idx =0 ; blk_idx <ILT_CLI_PF_BLOCKS ; blk_idx++) + clients[cli_idx].pf_blks[blk_idx].total_size =0 ; + +for (blk_idx =0 ; blk_idx <ILT_CLI_VF_BLOCKS ; blk_idx++) + clients[cli_idx].vf_blks[blk_idx].total_size =0 ; + } +} +int qed_cxt_cfg_ilt_compute (struct qed_hwfn *p_hwfn,u32 *line_count) {struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr;
@@ -461,6 +475,11 @@ int qed_cxt_cfg_ilt_compute(struct qed_hwfn *p_hwfn, u32 *line_count) p_mngr->pf_start_line =RESC_START (p_hwfn,QED_ILT ); +/* Reset all ILT blocks at the beginning of ILT computing in order +* to prevent memory allocation for irrelevant blocks afterwards. +*/ +qed_cxt_ilt_blk_reset (p_hwfn); +DP_VERBOSE (p_hwfn,QED_MSG_ILT ,"hwfn [%d] - Set context manager starting line to be 0x%08x\n" , p_hwfn->my_id, p_hwfn->p_cxt_mngr->pf_start_line);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 155/265 cxgb4: move handling L2T ARP failures to caller
In reply to Sasha LevinFrom: Rahul Lakkireddy <[email protected]>
[ Upstream commit 11d8cd5c9f3b46f397f889cefdb66795518aaebd ]
Move code handling L2T ARP failures to the only caller.
Fixes following sparse warning:
skbuff.h:2091:29: warning: context imbalance in
'handle_failed_resolution' - unexpected unlock
--- drivers/net/ethernet/chelsio/cxgb4/l2t.c | 52 +++++++++++------------- 1 file changed, 24 insertions(+), 28 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/l2t.c +24 -28
@@ -502,41 +502,20 @@ u64 cxgb4_select_ntuple(struct net_device *dev, }EXPORT_SYMBOL (cxgb4_select_ntuple); -/* -* Called when address resolution fails for an L2T entry to handle packets -* on the arpq head. If a packet specifies a failure handler it is invoked, -* otherwise the packet is sent to the device. -*/ -static void handle_failed_resolution (struct adapter *adap,struct l2t_entry *e) -{ -struct sk_buff *skb; - -while ((skb =__skb_dequeue (&e->arpq)) !=NULL ) { -const struct l2t_skb_cb *cb =L2T_SKB_CB (skb); - -spin_unlock (&e->lock); -if (cb->arp_err_handler) - cb->arp_err_handler (cb->handle, skb); -else -t4_ofld_send (adap, skb); -spin_lock (&e->lock); - } -} -/* * Called when the host's neighbor layer makes a change to some entry that is * loaded into the HW L2 table. */ void t4_l2t_update (struct adapter *adap,struct neighbour *neigh) { -struct l2t_entry *e; -struct sk_buff_head *arpq =NULL ; -struct l2t_data *d = adap->l2t;unsigned int addr_len = neigh->tbl->key_len;u32 *addr = (u32 *) neigh->primary_key; -int ifidx = neigh->dev->ifindex; -int hash =addr_hash (d, addr, addr_len, ifidx); +int hash, ifidx = neigh->dev->ifindex; +struct sk_buff_head *arpq =NULL ; +struct l2t_data *d = adap->l2t; +struct l2t_entry *e; + hash =addr_hash (d, addr, addr_len, ifidx);read_lock_bh (&d->lock);for (e = d->l2tab[hash].first; e; e = e->next)if (!addreq (e, addr) && e->ifindex == ifidx) {
@@ -569,8 +548,25 @@ void t4_l2t_update(struct adapter *adap, struct neighbour *neigh)write_l2e (adap, e,0 ); } -if (arpq) -handle_failed_resolution (adap, e); +if (arpq) { +struct sk_buff *skb; + +/* Called when address resolution fails for an L2T +* entry to handle packets on the arpq head. If a +* packet specifies a failure handler it is invoked, +* otherwise the packet is sent to the device. +*/ +while ((skb =__skb_dequeue (&e->arpq)) !=NULL ) { +const struct l2t_skb_cb *cb =L2T_SKB_CB (skb); + +spin_unlock (&e->lock); +if (cb->arp_err_handler) + cb->arp_err_handler (cb->handle, skb); +else +t4_ofld_send (adap, skb); +spin_lock (&e->lock); + } + }spin_unlock_bh (&e->lock); }
Signature · 1 line
2.25.1