5.15.81-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 5.15.81-rc1 review
This is the start of the stable review cycle for the 5.15.81 release. There are 206 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 Fri, 02 Dec 2022 18:05:05 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.81-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.15.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.15.81-rc1
Andrzej Hajda <[email protected]>
drm/i915: fix TLB invalidation for Gen12 video and compute engines
Christian König <[email protected]>
drm/amdgpu: always register an MMU notifier for userptr
Ramesh Errabolu <[email protected]>
drm/amdgpu: Enable Aldebaran devices to report CU Occupancy
Tsung-hua Lin <[email protected]>
drm/amd/display: No display after resume from WB/CB
Lyude Paul <[email protected]>
drm/amd/dc/dce120: Fix audio register mapping, stop triggering KASAN
Zhen Lei <[email protected]>
btrfs: sysfs: normalize the error handling branch in btrfs_init_sysfs()
Christoph Hellwig <[email protected]>
btrfs: use kvcalloc in btrfs_get_dev_zone_info
Christoph Hellwig <[email protected]>
btrfs: zoned: fix missing endianness conversion in sb_write_pointer
Anand Jain <[email protected]>
btrfs: free btrfs_path before copying subvol info to userspace
Anand Jain <[email protected]>
btrfs: free btrfs_path before copying fspath to userspace
Josef Bacik <[email protected]>
btrfs: free btrfs_path before copying root refs to userspace
Luiz Capitulino <[email protected]>
genirq: Take the proposed affinity at face value if force==true
Luiz Capitulino <[email protected]>
irqchip/gic-v3: Always trust the managed affinity provided by the core code
Luiz Capitulino <[email protected]>
genirq: Always limit the affinity to online CPUs
Luiz Capitulino <[email protected]>
genirq/msi: Shutdown managed interrupts with unsatifiable affinities
Phil Turnbull <[email protected]>
wifi: wilc1000: validate number of channels
Phil Turnbull <[email protected]>
wifi: wilc1000: validate length of IEEE80211_P2P_ATTR_CHANNEL_LIST attribute
Phil Turnbull <[email protected]>
wifi: wilc1000: validate length of IEEE80211_P2P_ATTR_OPER_CHANNEL attribute
Phil Turnbull <[email protected]>
wifi: wilc1000: validate pairwise and authentication suite offsets
Miklos Szeredi <[email protected]>
fuse: lock inode unconditionally in fuse_fallocate()
Mikulas Patocka <[email protected]>
dm integrity: clear the journal on suspend
Mikulas Patocka <[email protected]>
dm integrity: flush the journal on suspend
Robin Murphy <[email protected]>
gpu: host1x: Avoid trying to use GART on Tegra20
Zhou Guanghui <[email protected]>
scsi: iscsi: Fix possible memory leak when device_register() failed
Enrico Sau <[email protected]>
net: usb: qmi_wwan: add Telit 0x103a composition
Gleb Mazovetskiy <[email protected]>
tcp: configurable source port perturb table size
Arnav Rawat <[email protected]>
platform/x86: ideapad-laptop: Fix interrupt storm on fn-lock toggle on some Yoga laptops
Kai-Heng Feng <[email protected]>
platform/x86: hp-wmi: Ignore Smart Experience App event
Damien Le Moal <[email protected]>
zonefs: fix zone report size in __zonefs_io_error()
Guchun Chen <[email protected]>
drm/amdgpu: disable BACO support on more cards
Hans de Goede <[email protected]>
platform/x86: acer-wmi: Enable SW_TABLET_MODE on Switch V 10 (SW5-017)
Xiongfeng Wang <[email protected]>
platform/x86: asus-wmi: add missing pci_dev_put() in asus_wmi_set_xusb2pr()
ruanjinjie <[email protected]>
xen/platform-pci: add missing free_irq() in error path
Marek Marczykowski-Górecki <[email protected]>
xen-pciback: Allow setting PCI_MSIX_FLAGS_MASKALL too
Olivier Moysan <[email protected]>
ASoC: stm32: dfsdm: manage cb buffers cleanup
Takashi Iwai <[email protected]>
Input: i8042 - apply probe defer to more ASUS ZenBook models
Hans de Goede <[email protected]>
Input: soc_button_array - add Acer Switch V 10 to dmi_use_low_level_irq[]
Hans de Goede <[email protected]>
Input: soc_button_array - add use_low_level_irq module parameter
Hans de Goede <[email protected]>
Input: goodix - try resetting the controller when no config is set
Lukas Wunner <[email protected]>
serial: 8250: 8250_omap: Avoid RS485 RTS glitch on ->set_termios()
Matti Vaittinen <[email protected]>
tools: iio: iio_generic_buffer: Fix read size
Hans de Goede <[email protected]>
ASoC: Intel: bytcht_es8316: Add quirk for the Nanote UMPC-01
Aman Dhoot <[email protected]>
Input: synaptics - switch touchpad on HP Laptop 15-da3001TU to RMI mode
Michael Kelley <[email protected]>
x86/ioremap: Fix page aligned size calculation in __ioremap_caller()
Pawan Gupta <[email protected]>
x86/pm: Add enumeration check before spec MSRs save/restore setup
Pawan Gupta <[email protected]>
x86/tsx: Add a feature bit for TSX control MSR support
Maxim Levitsky <[email protected]>
KVM: x86: remove exit_int_info warning in svm_handle_exit
Maxim Levitsky <[email protected]>
KVM: x86: add kvm_leave_nested
Maxim Levitsky <[email protected]>
KVM: x86: nSVM: harden svm_free_nested against freeing vmcb02 while still in use
Maxim Levitsky <[email protected]>
KVM: x86: forcibly leave nested mode on vCPU reset
Maxim Levitsky <[email protected]>
KVM: x86: nSVM: leave nested mode on vCPU free
Johannes Weiner <[email protected]>
mm: vmscan: fix extreme overreclaim and swap floods
Mukesh Ojha <[email protected]>
gcov: clang: fix the buffer overflow issue
Chen Zhongjin <[email protected]>
nilfs2: fix nilfs_sufile_mark_dirty() not set segment usage as dirty
Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Clear ep descriptor last
Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Return -ESHUTDOWN on ep disable
Michael Grzeschik <[email protected]>
usb: dwc3: gadget: conditionally remove requests
Linus Walleij <[email protected]>
bus: ixp4xx: Don't touch bit 7 on IXP42x
Chen Zhongjin <[email protected]>
iio: core: Fix entry not deleted when iio_register_sw_trigger_type() fails
Alejandro Concepción Rodríguez <[email protected]>
iio: light: apds9960: fix wrong register for gesture gain
Sam James <[email protected]>
kbuild: fix -Wimplicit-function-declaration in license_is_gpl_compatible
Jakob Unterwurzacher <[email protected]>
arm64: dts: rockchip: lower rk3399-puma-haikou SD controller clock frequency
Baokun Li <[email protected]>
ext4: fix use-after-free in ext4_ext_shift_extents
Pawel Laszczak <[email protected]>
usb: cdnsp: fix issue with ZLP - added TD_SIZE = 1
Pawel Laszczak <[email protected]>
usb: cdnsp: Fix issue with Clear Feature Halt Endpoint
Marek Szyprowski <[email protected]>
usb: dwc3: exynos: Fix remove() function
Marc Zyngier <[email protected]>
KVM: arm64: pkvm: Fixup boot mode to reflect that the kernel resumes from EL1
Brian Norris <[email protected]>
mmc: sdhci-brcmstb: Fix SDHCI_RESET_ALL for CQHCI
Al Cooper <[email protected]>
mmc: sdhci-brcmstb: Enable Clock Gating to save power
Al Cooper <[email protected]>
mmc: sdhci-brcmstb: Re-organize flags
Randy Dunlap <[email protected]>
nios2: add FORCE for vmlinuz.gz
Alexandre Belloni <[email protected]>
init/Kconfig: fix CC_HAS_ASM_GOTO_TIED_OUTPUT test with dash
Greg Kroah-Hartman <[email protected]>
lib/vdso: use "grep -E" instead of "egrep"
Heiko Carstens <[email protected]>
s390/crashdump: fix TOD programmable field size
Yu Liao <[email protected]>
net: thunderx: Fix the ACPI memory leak
Xiongfeng Wang <[email protected]>
octeontx2-af: Fix reference count issue in rvu_sdp_init()
Jiasheng Jiang <[email protected]>
octeontx2-pf: Add check for devm_kcalloc
Vladimir Oltean <[email protected]>
net: enetc: preserve TX ring priority across reconfiguration
Vladimir Oltean <[email protected]>
net: enetc: cache accesses to &priv->si->hw
Vladimir Oltean <[email protected]>
net: enetc: manage ENETC_F_QBV in priv->active_offloads only when enabled
Martin Faltesek <[email protected]>
nfc: st-nci: fix incorrect sizing calculations in EVT_TRANSACTION
Martin Faltesek <[email protected]>
nfc: st-nci: fix memory leaks in EVT_TRANSACTION
Martin Faltesek <[email protected]>
nfc: st-nci: fix incorrect validating logic in EVT_TRANSACTION
Stefan Haberland <[email protected]>
s390/dasd: fix no record found for raw_track_access
Wang Hai <[email protected]>
arcnet: fix potential memory leak in com20020_probe()
Ziyang Xuan <[email protected]>
ipv4: Fix error return code in fib_table_insert()
Kuniyuki Iwashima <[email protected]>
dccp/tcp: Reset saddr on failure after inet6?_hash_connect().
Svyatoslav Feldsherov <[email protected]>
fs: do not update freeing inode i_io_list
Felix Fietkau <[email protected]>
netfilter: flowtable_offload: add missing locking
Jozsef Kadlecsik <[email protected]>
netfilter: ipset: restore allowing 64 clashing elements in hash:net,iface
Dawei Li <[email protected]>
dma-buf: fix racing conflict of dma_heap_add()
Yang Yingliang <[email protected]>
bnx2x: fix pci device refcount leak in bnx2x_vf_is_pcie_pending()
Andreas Kemnade <[email protected]>
regulator: twl6030: re-add TWL6032_SUBCLASS
Liu Shixin <[email protected]>
NFC: nci: fix memory leak in nci_rx_data_packet()
Xin Long <[email protected]>
net: sched: allow act_ct to be built without NF_NAT
Liu Jian <[email protected]>
net: sparx5: fix error handling in sparx5_port_open()
Zhang Changzhong <[email protected]>
sfc: fix potential memleak in __ef100_hard_start_xmit()
Wang ShaoBo <[email protected]>
net: wwan: iosm: use ACPI_FREE() but not kfree() in ipc_pcie_read_bios_cfg()
Chen Zhongjin <[email protected]>
xfrm: Fix ignored return value in xfrm6_init()
Thomas Jarosch <[email protected]>
xfrm: Fix oops in __xfrm_state_delete()
YueHaibing <[email protected]>
tipc: check skb_linearize() return value in tipc_disc_rcv()
Xin Long <[email protected]>
tipc: add an extra conn_get in tipc_conn_alloc
Xin Long <[email protected]>
tipc: set con sock in tipc_conn_alloc
Moshe Shemesh <[email protected]>
net/mlx5: Fix handling of entry refcount when command is not issued to FW
Moshe Shemesh <[email protected]>
net/mlx5: Fix FW tracer timestamp calculation
Roy Novich <[email protected]>
net/mlx5: Do not query pci info while pci disabled
Vishwanath Pai <[email protected]>
netfilter: ipset: regression in ip_set_hash_ip.c
Yang Yingliang <[email protected]>
Drivers: hv: vmbus: fix possible memory leak in vmbus_device_register()
Yang Yingliang <[email protected]>
Drivers: hv: vmbus: fix double free in the error path of vmbus_add_channel_work()
YueHaibing <[email protected]>
macsec: Fix invalid error code set
Jaco Coetzee <[email protected]>
nfp: add port from netdev validation for EEPROM access
Diana Wang <[email protected]>
nfp: fill splittable of devlink_port_attrs correctly
Yang Yingliang <[email protected]>
net: pch_gbe: fix pci device refcount leak while module exiting
Yang Yingliang <[email protected]>
octeontx2-af: debugsfs: fix pci device refcount leak
Zhang Changzhong <[email protected]>
net/qla3xxx: fix potential memleak in ql3xxx_send()
Hui Tang <[email protected]>
net: mvpp2: fix possible invalid pointer dereference
Peter Kosyh <[email protected]>
net/mlx4: Check retval of mlx4_bitmap_init
Liu Jian <[email protected]>
net: ethernet: mtk_eth_soc: fix error handling in mtk_open()
Fabio Estevam <[email protected]>
ARM: dts: imx6q-prti6q: Fix ref/tcxo-clock-frequency properties
Zheng Yongjun <[email protected]>
ARM: mxs: fix memory leak in mxs_machine_init()
Slawomir Laba <[email protected]>
iavf: Fix race condition between iavf_shutdown and iavf_remove
Ivan Vecera <[email protected]>
iavf: Do not restart Tx queues after reset task failure
Ivan Vecera <[email protected]>
iavf: Fix a crash during reset task
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: do not set up extensions for end interval
Daniel Xu <[email protected]>
netfilter: conntrack: Fix data-races around ct mark
Zhengchao Shao <[email protected]>
9p/fd: fix issue of list_del corruption in p9_fd_cancel()
Wang Hai <[email protected]>
net: pch_gbe: fix potential memleak in pch_gbe_tx_queue()
Lin Ma <[email protected]>
nfc/nci: fix race with opening and closing
Vladimir Oltean <[email protected]>
net: dsa: sja1105: disallow C45 transactions on the BASE-TX MDIO bus
David Howells <[email protected]>
rxrpc: Fix race between conn bundle lookup and bundle removal [ZDI-CAN-15975]
David Howells <[email protected]>
rxrpc: Use refcount_t rather than atomic_t
David Howells <[email protected]>
rxrpc: Allow list of in-use local UDP endpoints to be viewed in /proc
Leon Romanovsky <[email protected]>
net: liquidio: simplify if expression
Matthieu Baerts <[email protected]>
selftests: mptcp: fix mibit vs mbit mix up
Paolo Abeni <[email protected]>
selftests: mptcp: more stable simult_flows tests
Michael Grzeschik <[email protected]>
ARM: dts: at91: sam9g20ek: enable udc vbus gpio pinctrl
Yang Yingliang <[email protected]>
tee: optee: fix possible memory leak in optee_register_device()
Samuel Holland <[email protected]>
bus: sunxi-rsb: Support atomic transfers
Samuel Holland <[email protected]>
bus: sunxi-rsb: Remove the shutdown callback
Yang Yingliang <[email protected]>
regulator: core: fix UAF in destroy_regulator()
Xiongfeng Wang <[email protected]>
spi: dw-dma: decrease reference count in dw_spi_dma_init_mfld()
Zeng Heng <[email protected]>
regulator: core: fix kobject release warning and memory leak in regulator_register()
Jiasheng Jiang <[email protected]>
ASoC: max98373: Add checks for devm_kcalloc
Michael Kelley <[email protected]>
scsi: storvsc: Fix handling of srb_status and capacity change events
Vitaly Kuznetsov <[email protected]>
x86/hyperv: Restore VP assist page after cpu offlining/onlining
Richard Fitzgerald <[email protected]>
ASoC: soc-pcm: Don't zero TDM masks in __soc_pcm_open()
Detlev Casanova <[email protected]>
ASoC: sgtl5000: Reset the CHIP_CLK_CTRL reg on remove
Junxiao Chang <[email protected]>
ASoC: hdac_hda: fix hda pcm buffer overflow issue
Dominik Haller <[email protected]>
ARM: dts: am335x-pcm-953: Define fixed regulators in root node
Herbert Xu <[email protected]>
af_key: Fix send_acquire race with pfkey_register
Christian Langrock <[email protected]>
xfrm: replay: Fix ESN wrap around for GSO
Eyal Birger <[email protected]>
xfrm: fix "disable_policy" on ipv4 early demux
Jason A. Donenfeld <[email protected]>
MIPS: pic32: treat port as signed integer
Nathan Chancellor <[email protected]>
RISC-V: vdso: Do not add missing symbols to version section in linker script
Ai Chao <[email protected]>
ALSA: usb-audio: add quirk to fix Hamedal C20 disconnect issue
Asher Song <[email protected]>
Revert "drm/amdgpu: Revert "drm/amdgpu: getting fan speed pwm for vega10 properly""
Aleksandr Miloserdov <[email protected]>
nvmet: fix memory leak in nvmet_subsys_attr_model_store_locked
Kuniyuki Iwashima <[email protected]>
arm64/syscall: Include asm/ptrace.h in syscall_wrapper header.
Yu Kuai <[email protected]>
block, bfq: fix null pointer dereference in bfq_bio_bfqg()
Hans de Goede <[email protected]>
drm: panel-orientation-quirks: Add quirk for Acer Switch V 10 (SW5-017)
Bart Van Assche <[email protected]>
scsi: scsi_debug: Make the READ CAPACITY response compliant with ZBC
Brian King <[email protected]>
scsi: ibmvfc: Avoid path failures during live migration
Ivan Hu <[email protected]>
platform/x86/intel/hid: Add some ACPI device IDs
David E. Box <[email protected]>
platform/x86/intel/pmt: Sapphire Rapids PMT errata fix
Hans de Goede <[email protected]>
platform/x86: touchscreen_dmi: Add info for the RCA Cambio W101 v2 2-in-1
Manyi Li <[email protected]>
platform/x86: ideapad-laptop: Disable touchpad_switch
Sabrina Dubroca <[email protected]>
Revert "net: macsec: report real_dev features when HW offloading is enabled"
Youlin Li <[email protected]>
selftests/bpf: Add verifier test for release_reference()
Sean Nyekjaer <[email protected]>
spi: stm32: fix stm32_spi_prepare_mbr() that halves spi clk for every run
Tyler J. Stachecki <[email protected]>
wifi: ath11k: Fix QCN9074 firmware boot on x86
Nicolas Cavallari <[email protected]>
wifi: mac80211: Fix ack frame idr leak when mesh has no route
Jason A. Donenfeld <[email protected]>
wifi: airo: do not assign -1 to unsigned char
Gaosheng Cui <[email protected]>
audit: fix undefined behavior in bit shift for AUDIT_BIT
Emil Renner Berthing <[email protected]>
riscv: dts: sifive unleashed: Add PWM controlled LEDs
Jonas Jelonek <[email protected]>
wifi: mac80211_hwsim: fix debugfs attribute ps with rc table support
taozhang <[email protected]>
wifi: mac80211: fix memory free error when registering wiphy fail
Xiubo Li <[email protected]>
ceph: fix NULL pointer dereference for req->r_session
Kenneth Lee <[email protected]>
ceph: Use kcalloc for allocating multiple elements
Carlos Llamas <[email protected]>
binder: validate alloc->mm in ->mmap() handler
Borys Popławski <[email protected]>
x86/sgx: Add overflow check in sgx_validate_offset_length()
Reinette Chatre <[email protected]>
x86/sgx: Create utility to validate user provided offset and length
Xiubo Li <[email protected]>
ceph: avoid putting the realm twice when decoding snaps fails
Xiubo Li <[email protected]>
ceph: do not update snapshot context when there is no new snapshot
Mitja Spes <[email protected]>
iio: pressure: ms5611: fixed value compensation bug
Lars-Peter Clausen <[email protected]>
iio: ms5611: Simplify IO callback parameters
Đoàn Trần Công Danh <[email protected]>
speakup: replace utils' u_char with unsigned char
Samuel Thibault <[email protected]>
speakup: Generate speakupmap.h automatically
Tiago Dias Ferreira <[email protected]>
nvme-pci: add NVME_QUIRK_BOGUS_NID for Netac NV7000
Xander Li <[email protected]>
nvme-pci: disable write zeroes on various Kingston SSD
Christoph Hellwig <[email protected]>
nvme-pci: disable namespace identifiers for the MAXIO MAP1001
Bean Huo <[email protected]>
nvme-pci: add NVME_QUIRK_BOGUS_NID for Micron Nitro
Leo Savernik <[email protected]>
nvme: add a bogus subsystem NQN quirk for Micron MTFDKBA2T0TFH
Simon Rettberg <[email protected]>
drm/display: Don't assume dual mode adaptors support i2c sub-addressing
Niklas Cassel <[email protected]>
ata: libata-core: do not issue non-internal commands once EH is pending
Wenchao Hao <[email protected]>
ata: libata-scsi: simplify __ata_scsi_queuecmd()
Zhang Xiaoxu <[email protected]>
cifs: Fix connections leak when tlink setup failed
Paulo Alcantara <[email protected]>
cifs: support nested dfs links over reconnect
Paulo Alcantara <[email protected]>
cifs: split out dfs code from cifs_reconnect()
Paulo Alcantara <[email protected]>
cifs: introduce new helper for cifs_reconnect()
Xin Long <[email protected]>
sctp: clear out_curr if all frag chunks of current msg are pruned
Xin Long <[email protected]>
sctp: remove the unnecessary sinfo_stream check in sctp_prsctp_prune_unsent
Sherry Sun <[email protected]>
tty: serial: fsl_lpuart: don't break the on-going transfer when global reset
Ilpo Järvinen <[email protected]>
serial: fsl_lpuart: Fill in rs485_supported
Ilpo Järvinen <[email protected]>
serial: Add rs485_supported to uart_port
Maarten Zanders <[email protected]>
ASoC: fsl_asrc fsl_esai fsl_sai: allow CONFIG_PM=N
Marco Felsch <[email protected]>
ASoC: fsl_sai: use local device pointer
-------------
Diffstat:
Makefile | 4 +- arch/arm/boot/dts/am335x-pcm-953.dtsi | 28 +- arch/arm/boot/dts/at91sam9g20ek_common.dtsi | 9 + arch/arm/boot/dts/imx6q-prti6q.dts | 4 +- arch/arm/mach-mxs/mach-mxs.c | 4 +- .../arm64/boot/dts/rockchip/rk3399-puma-haikou.dts | 2 +- arch/arm64/include/asm/syscall_wrapper.h | 2 +- arch/arm64/kvm/arm.c | 11 + arch/mips/include/asm/fw/fw.h | 2 +- arch/mips/pic32/pic32mzda/early_console.c | 13 +- arch/mips/pic32/pic32mzda/init.c | 2 +- arch/nios2/boot/Makefile | 2 +- .../riscv/boot/dts/sifive/hifive-unleashed-a00.dts | 38 + arch/riscv/kernel/vdso/Makefile | 3 + arch/riscv/kernel/vdso/vdso.lds.S | 2 + arch/s390/kernel/crash_dump.c | 2 +- arch/x86/hyperv/hv_init.c | 54 +- arch/x86/include/asm/cpufeatures.h | 3 + arch/x86/kernel/cpu/sgx/ioctl.c | 31 +- arch/x86/kernel/cpu/tsx.c | 38 +- arch/x86/kvm/svm/nested.c | 6 +- arch/x86/kvm/svm/svm.c | 16 +- arch/x86/kvm/vmx/nested.c | 3 - arch/x86/kvm/x86.c | 18 +- arch/x86/mm/ioremap.c | 8 +- arch/x86/power/cpu.c | 23 +- block/bfq-cgroup.c | 4 + drivers/accessibility/speakup/.gitignore | 4 + drivers/accessibility/speakup/Makefile | 28 + drivers/accessibility/speakup/genmap.c | 162 +++ drivers/accessibility/speakup/makemapdata.c | 125 ++ drivers/accessibility/speakup/speakupmap.h | 66 - drivers/accessibility/speakup/utils.h | 102 ++ drivers/android/binder_alloc.c | 7 + drivers/ata/libata-scsi.c | 55 +- drivers/bus/intel-ixp4xx-eb.c | 9 +- drivers/bus/sunxi-rsb.c | 38 +- drivers/dma-buf/dma-heap.c | 28 +- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_aldebaran.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 8 +- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 37 + .../drm/amd/display/dc/dce120/dce120_resource.c | 3 +- .../drm/amd/pm/powerplay/hwmgr/vega10_thermal.c | 25 +- .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 4 + drivers/gpu/drm/drm_dp_dual_mode_helper.c | 51 +- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 + drivers/gpu/drm/i915/gt/intel_gt.c | 4 + drivers/gpu/drm/tegra/drm.c | 4 + drivers/gpu/host1x/dev.c | 4 + drivers/hv/channel_mgmt.c | 6 +- drivers/hv/vmbus_drv.c | 1 + drivers/iio/industrialio-sw-trigger.c | 6 +- drivers/iio/light/apds9960.c | 12 +- drivers/iio/pressure/ms5611.h | 18 +- drivers/iio/pressure/ms5611_core.c | 56 +- drivers/iio/pressure/ms5611_i2c.c | 11 +- drivers/iio/pressure/ms5611_spi.c | 17 +- drivers/input/misc/soc_button_array.c | 14 +- drivers/input/mouse/synaptics.c | 1 + drivers/input/serio/i8042-x86ia64io.h | 8 +- drivers/input/touchscreen/goodix.c | 11 + drivers/irqchip/irq-gic-v3-its.c | 2 +- drivers/md/dm-integrity.c | 20 +- drivers/mmc/host/sdhci-brcmstb.c | 68 +- drivers/net/arcnet/com20020_cs.c | 11 +- drivers/net/dsa/sja1105/sja1105_mdio.c | 6 + drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 12 +- drivers/net/ethernet/cavium/liquidio/lio_main.c | 4 +- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 4 +- drivers/net/ethernet/freescale/enetc/enetc.c | 32 +- drivers/net/ethernet/freescale/enetc/enetc.h | 10 +- drivers/net/ethernet/freescale/enetc/enetc_pf.c | 6 +- drivers/net/ethernet/freescale/enetc/enetc_qos.c | 83 +- drivers/net/ethernet/intel/iavf/iavf_main.c | 33 +- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 8 +- .../ethernet/marvell/octeontx2/af/rvu_debugfs.c | 3 + .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 2 + .../net/ethernet/marvell/octeontx2/af/rvu_sdp.c | 7 +- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 +- drivers/net/ethernet/mellanox/mlx4/qp.c | 3 +- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 6 +- .../ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/main.c | 9 +- .../net/ethernet/microchip/sparx5/sparx5_netdev.c | 14 +- drivers/net/ethernet/netronome/nfp/nfp_devlink.c | 2 +- .../net/ethernet/netronome/nfp/nfp_net_ethtool.c | 3 + .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 6 +- drivers/net/ethernet/qlogic/qla3xxx.c | 1 + drivers/net/ethernet/sfc/ef100_netdev.c | 1 + drivers/net/macsec.c | 28 +- drivers/net/usb/qmi_wwan.c | 1 + drivers/net/wireless/ath/ath11k/qmi.h | 2 +- drivers/net/wireless/cisco/airo.c | 18 +- drivers/net/wireless/mac80211_hwsim.c | 5 + drivers/net/wireless/microchip/wilc1000/cfg80211.c | 40 +- drivers/net/wireless/microchip/wilc1000/hif.c | 21 +- drivers/net/wwan/iosm/iosm_ipc_pcie.c | 2 +- drivers/nfc/st-nci/se.c | 49 +- drivers/nvme/host/pci.c | 18 + drivers/nvme/target/configfs.c | 7 +- drivers/platform/x86/acer-wmi.c | 9 + drivers/platform/x86/asus-wmi.c | 2 + drivers/platform/x86/hp-wmi.c | 3 + drivers/platform/x86/ideapad-laptop.c | 42 +- drivers/platform/x86/intel/hid.c | 3 + drivers/platform/x86/intel/pmt/class.c | 31 +- drivers/platform/x86/touchscreen_dmi.c | 25 + drivers/regulator/core.c | 8 +- drivers/regulator/twl6030-regulator.c | 2 + drivers/s390/block/dasd_eckd.c | 6 +- drivers/scsi/ibmvscsi/ibmvfc.c | 14 +- drivers/scsi/scsi_debug.c | 7 + drivers/scsi/scsi_transport_iscsi.c | 31 +- drivers/scsi/storvsc_drv.c | 69 +- drivers/spi/spi-dw-dma.c | 3 + drivers/spi/spi-stm32.c | 2 +- drivers/tee/optee/device.c | 2 +- drivers/tty/serial/8250/8250_core.c | 1 + drivers/tty/serial/8250/8250_omap.c | 7 +- drivers/tty/serial/fsl_lpuart.c | 82 +- drivers/usb/cdns3/cdnsp-gadget.c | 12 +- drivers/usb/cdns3/cdnsp-ring.c | 17 +- drivers/usb/dwc3/dwc3-exynos.c | 11 +- drivers/usb/dwc3/gadget.c | 22 +- drivers/xen/platform-pci.c | 7 +- drivers/xen/xen-pciback/conf_space_capability.c | 9 +- fs/btrfs/ioctl.c | 7 +- fs/btrfs/sysfs.c | 7 +- fs/btrfs/zoned.c | 9 +- fs/ceph/caps.c | 50 +- fs/ceph/snap.c | 31 +- fs/cifs/cifs_dfs_ref.c | 59 +- fs/cifs/cifs_fs_sb.h | 5 - fs/cifs/cifsglob.h | 24 +- fs/cifs/cifsproto.h | 5 +- fs/cifs/connect.c | 1358 ++++++++++---------- fs/cifs/dfs_cache.c | 44 +- fs/cifs/misc.c | 62 +- fs/cifs/smb2ops.c | 10 +- fs/cifs/smb2pdu.c | 6 +- fs/ext4/extents.c | 18 +- fs/fs-writeback.c | 30 +- fs/fuse/file.c | 37 +- fs/nilfs2/sufile.c | 8 + fs/zonefs/super.c | 37 +- include/linux/license.h | 2 + include/linux/serial_core.h | 1 + include/trace/events/rxrpc.h | 2 +- include/uapi/linux/audit.h | 2 +- init/Kconfig | 2 +- kernel/gcov/clang.c | 2 + kernel/irq/manage.c | 31 +- kernel/irq/msi.c | 7 + lib/vdso/Makefile | 2 +- mm/vmscan.c | 10 +- net/9p/trans_fd.c | 2 + net/core/flow_dissector.c | 2 +- net/dccp/ipv4.c | 2 + net/dccp/ipv6.c | 2 + net/ipv4/Kconfig | 10 + net/ipv4/esp4_offload.c | 3 + net/ipv4/fib_trie.c | 4 +- net/ipv4/inet_hashtables.c | 10 +- net/ipv4/ip_input.c | 5 + net/ipv4/netfilter/ipt_CLUSTERIP.c | 4 +- net/ipv4/tcp_ipv4.c | 2 + net/ipv6/esp6_offload.c | 3 + net/ipv6/tcp_ipv6.c | 2 + net/ipv6/xfrm6_policy.c | 6 +- net/key/af_key.c | 34 +- net/mac80211/main.c | 8 +- net/mac80211/mesh_pathtbl.c | 2 +- net/netfilter/ipset/ip_set_hash_gen.h | 2 +- net/netfilter/ipset/ip_set_hash_ip.c | 8 +- net/netfilter/nf_conntrack_core.c | 2 +- net/netfilter/nf_conntrack_netlink.c | 24 +- net/netfilter/nf_conntrack_standalone.c | 2 +- net/netfilter/nf_flow_table_offload.c | 4 + net/netfilter/nf_tables_api.c | 6 +- net/netfilter/nft_ct.c | 6 +- net/netfilter/xt_connmark.c | 18 +- net/nfc/nci/core.c | 2 +- net/nfc/nci/data.c | 4 +- net/openvswitch/conntrack.c | 8 +- net/rxrpc/af_rxrpc.c | 2 +- net/rxrpc/ar-internal.h | 24 +- net/rxrpc/call_accept.c | 4 +- net/rxrpc/call_object.c | 44 +- net/rxrpc/conn_client.c | 66 +- net/rxrpc/conn_object.c | 49 +- net/rxrpc/conn_service.c | 8 +- net/rxrpc/input.c | 4 +- net/rxrpc/local_object.c | 68 +- net/rxrpc/net_ns.c | 5 +- net/rxrpc/peer_object.c | 40 +- net/rxrpc/proc.c | 75 +- net/rxrpc/skbuff.c | 1 - net/sched/Kconfig | 2 +- net/sched/act_connmark.c | 4 +- net/sched/act_ct.c | 8 +- net/sched/act_ctinfo.c | 6 +- net/sctp/outqueue.c | 13 +- net/tipc/discover.c | 5 +- net/tipc/topsrv.c | 20 +- net/xfrm/xfrm_device.c | 15 +- net/xfrm/xfrm_replay.c | 2 +- sound/soc/codecs/hdac_hda.h | 4 +- sound/soc/codecs/max98373-i2c.c | 4 + sound/soc/codecs/sgtl5000.c | 1 + sound/soc/fsl/fsl_asrc.c | 2 +- sound/soc/fsl/fsl_esai.c | 2 +- sound/soc/fsl/fsl_sai.c | 55 +- sound/soc/intel/boards/bytcht_es8316.c | 7 + sound/soc/soc-pcm.c | 5 - sound/soc/stm/stm32_adfsdm.c | 11 + sound/usb/endpoint.c | 3 +- sound/usb/quirks.c | 2 + sound/usb/usbaudio.h | 3 + tools/iio/iio_generic_buffer.c | 4 +- .../testing/selftests/bpf/verifier/ref_tracking.c | 36 + tools/testing/selftests/net/mptcp/mptcp_connect.c | 72 +- tools/testing/selftests/net/mptcp/simult_flows.sh | 37 +- 222 files changed, 3131 insertions(+), 1881 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/206 ASoC: fsl_sai: use local device pointer
From: Marco Felsch <[email protected]>
[ Upstream commit f53f50ee21d46094a8c48970e95e38a4deaa128e ]
Use a local variable to dereference the device pointer once and use the local variable in further calls. No functional changes.
Stable-dep-of: 6a564338a23c ("ASoC: fsl_asrc fsl_esai fsl_sai: allow CONFIG_PM=N")
--- sound/soc/fsl/fsl_sai.c | 53 +++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 26 deletions(-)
sound/soc/fsl/fsl_sai.c +27 -26
@@ -1000,6 +1000,7 @@ static int fsl_sai_runtime_resume(struct device *dev);static int fsl_sai_probe (struct platform_device *pdev) {struct device_node *np = pdev->dev.of_node; +struct device *dev = &pdev->dev;struct fsl_sai *sai;struct regmap *gpr;struct resource *res;
@@ -1008,12 +1009,12 @@ static int fsl_sai_probe(struct platform_device *pdev)int irq, ret, i;int index; - sai =devm_kzalloc (&pdev->dev,sizeof (*sai),GFP_KERNEL ); + sai =devm_kzalloc (dev,sizeof (*sai),GFP_KERNEL );if (!sai)return -ENOMEM ; sai->pdev = pdev; - sai->soc_data =of_device_get_match_data (&pdev->dev); + sai->soc_data =of_device_get_match_data (dev); sai->is_lsb_first =of_property_read_bool (np,"lsb-first" );
@@ -1028,18 +1029,18 @@ static int fsl_sai_probe(struct platform_device *pdev)ARRAY_SIZE (fsl_sai_reg_defaults_ofs8); } - sai->regmap =devm_regmap_init_mmio (&pdev->dev, base, &fsl_sai_regmap_config); + sai->regmap =devm_regmap_init_mmio (dev, base, &fsl_sai_regmap_config);if (IS_ERR (sai->regmap)) { -dev_err (&pdev->dev,"regmap init failed\n" ); +dev_err (dev,"regmap init failed\n" );return PTR_ERR (sai->regmap); } - sai->bus_clk =devm_clk_get (&pdev->dev,"bus" ); + sai->bus_clk =devm_clk_get (dev,"bus" );/* Compatible with old DTB cases */ if (IS_ERR (sai->bus_clk) &&PTR_ERR (sai->bus_clk) != -EPROBE_DEFER ) - sai->bus_clk =devm_clk_get (&pdev->dev,"sai" ); + sai->bus_clk =devm_clk_get (dev,"sai" );if (IS_ERR (sai->bus_clk)) { -dev_err (&pdev->dev,"failed to get bus clock: %ld\n" , +dev_err (dev,"failed to get bus clock: %ld\n" ,PTR_ERR (sai->bus_clk));/* -EPROBE_DEFER */ return PTR_ERR (sai->bus_clk);
@@ -1047,9 +1048,9 @@ static int fsl_sai_probe(struct platform_device *pdev)for (i =1 ; i <FSL_SAI_MCLK_MAX ; i++) {sprintf (tmp,"mclk%d" , i); - sai->mclk_clk[i] =devm_clk_get (&pdev->dev, tmp); + sai->mclk_clk[i] =devm_clk_get (dev, tmp);if (IS_ERR (sai->mclk_clk[i])) { -dev_err (&pdev->dev,"failed to get mclk%d clock: %ld\n" , +dev_err (dev,"failed to get mclk%d clock: %ld\n" , i +1 ,PTR_ERR (sai->mclk_clk[i])); sai->mclk_clk[i] =NULL ; }
@@ -1064,10 +1065,10 @@ static int fsl_sai_probe(struct platform_device *pdev)if (irq <0 )return irq; - ret =devm_request_irq (&pdev->dev, irq, fsl_sai_isr,IRQF_SHARED , + ret =devm_request_irq (dev, irq, fsl_sai_isr,IRQF_SHARED , np->name, sai);if (ret) { -dev_err (&pdev->dev,"failed to claim irq %u\n" , irq); +dev_err (dev,"failed to claim irq %u\n" , irq);return ret; }
@@ -1084,7 +1085,7 @@ static int fsl_sai_probe(struct platform_device *pdev)if (of_find_property (np,"fsl,sai-synchronous-rx" ,NULL ) &&of_find_property (np,"fsl,sai-asynchronous" ,NULL )) {/* error out if both synchronous and asynchronous are present */ -dev_err (&pdev->dev,"invalid binding for synchronous mode\n" ); +dev_err (dev,"invalid binding for synchronous mode\n" );return -EINVAL ; }
@@ -1105,7 +1106,7 @@ static int fsl_sai_probe(struct platform_device *pdev) of_device_is_compatible(np, "fsl,imx6ul-sai")) { gpr =syscon_regmap_lookup_by_compatible ("fsl,imx6ul-iomuxc-gpr" );if (IS_ERR (gpr)) { -dev_err (&pdev->dev,"cannot find iomuxc registers\n" ); +dev_err (dev,"cannot find iomuxc registers\n" );return PTR_ERR (gpr); }
@@ -1123,23 +1124,23 @@ static int fsl_sai_probe(struct platform_device *pdev) sai->dma_params_tx.maxburst =FSL_SAI_MAXBURST_TX ;platform_set_drvdata (pdev, sai); -pm_runtime_enable (&pdev->dev); -if (!pm_runtime_enabled (&pdev->dev)) { - ret =fsl_sai_runtime_resume (&pdev->dev); +pm_runtime_enable (dev); +if (!pm_runtime_enabled (dev)) { + ret =fsl_sai_runtime_resume (dev);if (ret) goto err_pm_disable; } - ret =pm_runtime_get_sync (&pdev->dev); + ret =pm_runtime_get_sync (dev);if (ret <0 ) { -pm_runtime_put_noidle (&pdev->dev); +pm_runtime_put_noidle (dev); goto err_pm_get_sync; }/* Get sai version */ - ret =fsl_sai_check_version (&pdev->dev); + ret =fsl_sai_check_version (dev);if (ret <0 ) -dev_warn (&pdev->dev,"Error reading SAI version: %d\n" , ret); +dev_warn (dev,"Error reading SAI version: %d\n" , ret);/* Select MCLK direction */ if (of_find_property(np, "fsl,sai-mclk-direction-output", NULL) &&
@@ -1148,7 +1149,7 @@ static int fsl_sai_probe(struct platform_device *pdev) FSL_SAI_MCTL_MCLK_EN, FSL_SAI_MCTL_MCLK_EN); } - ret =pm_runtime_put_sync (&pdev->dev); + ret =pm_runtime_put_sync (dev);if (ret <0 ) goto err_pm_get_sync;
@@ -1161,12 +1162,12 @@ static int fsl_sai_probe(struct platform_device *pdev)if (ret) goto err_pm_get_sync; }else { - ret =devm_snd_dmaengine_pcm_register (&pdev->dev,NULL ,0 ); + ret =devm_snd_dmaengine_pcm_register (dev,NULL ,0 );if (ret) goto err_pm_get_sync; } - ret =devm_snd_soc_register_component (&pdev->dev, &fsl_component, + ret =devm_snd_soc_register_component (dev, &fsl_component, &sai->cpu_dai_drv,1 );if (ret) goto err_pm_get_sync;
@@ -1174,10 +1175,10 @@ static int fsl_sai_probe(struct platform_device *pdev)return ret; err_pm_get_sync: -if (!pm_runtime_status_suspended (&pdev->dev)) -fsl_sai_runtime_suspend (&pdev->dev); +if (!pm_runtime_status_suspended (dev)) +fsl_sai_runtime_suspend (dev); err_pm_disable: -pm_runtime_disable (&pdev->dev); +pm_runtime_disable (dev);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 2/206 ASoC: fsl_asrc fsl_esai fsl_sai: allow CONFIG_PM=N
In reply to Greg Kroah-HartmanFrom: Maarten Zanders <[email protected]>
[ Upstream commit 6a564338a23cefcfc29c4a535b98402d13efdda6 ]
When CONFIG_PM=N, pm_runtime_put_sync() returns -ENOSYS which breaks the probe function of these drivers.
Other users of pm_runtime_put_sync() typically don't check the return value. In order to keep the program flow as intended, check for -ENOSYS.
This commit is similar to commit 0434d3f (omap-mailbox.c).
--- sound/soc/fsl/fsl_asrc.c | 2 +- sound/soc/fsl/fsl_esai.c | 2 +- sound/soc/fsl/fsl_sai.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
sound/soc/fsl/fsl_asrc.c +1 -1
@@ -1226,7 +1226,7 @@ static int fsl_asrc_probe(struct platform_device *pdev) } ret =pm_runtime_put_sync (&pdev->dev); -if (ret <0 ) +if (ret <0 && ret != -ENOSYS ) goto err_pm_get_sync; ret = devm_snd_soc_register_component(&pdev->dev, &fsl_asrc_component,
sound/soc/fsl/fsl_esai.c +1 -1
@@ -1070,7 +1070,7 @@ static int fsl_esai_probe(struct platform_device *pdev)regmap_write (esai_priv->regmap,REG_ESAI_RSMB ,0 ); ret =pm_runtime_put_sync (&pdev->dev); -if (ret <0 ) +if (ret <0 && ret != -ENOSYS ) goto err_pm_get_sync;/*
sound/soc/fsl/fsl_sai.c +1 -1
@@ -1150,7 +1150,7 @@ static int fsl_sai_probe(struct platform_device *pdev) } ret =pm_runtime_put_sync (dev); -if (ret <0 ) +if (ret <0 && ret != -ENOSYS ) goto err_pm_get_sync;/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 3/206 serial: Add rs485_supported to uart_port
In reply to Greg Kroah-HartmanFrom: Ilpo Järvinen <[email protected]>
[ Upstream commit 8925c31c1ac2f1e05da988581f2a70a2a8c4d638 ]
Preparing to move serial_rs485 struct sanitization into serial core, each driver has to provide what fields/flags it supports. This information is pointed into by rs485_supported.
Stable-dep-of: 76bad3f88750 ("tty: serial: fsl_lpuart: don't break the on-going transfer when global reset")
--- drivers/tty/serial/8250/8250_core.c | 1 + include/linux/serial_core.h | 1 + 2 files changed, 2 insertions(+)
drivers/tty/serial/8250/8250_core.c +1 -0
@@ -1016,6 +1016,7 @@ int serial8250_register_8250_port(const struct uart_8250_port *up) uart->port.throttle = up->port.throttle; uart->port.unthrottle = up->port.unthrottle; uart->port.rs485_config = up->port.rs485_config; + uart->port.rs485_supported = up->port.rs485_supported; uart->port.rs485 = up->port.rs485; uart->rs485_start_tx = up->rs485_start_tx; uart->rs485_stop_tx = up->rs485_stop_tx;
include/linux/serial_core.h +1 -0
@@ -254,6 +254,7 @@ struct uart_port {struct attribute_group *attr_group;/* port specific attributes */ const struct attribute_group **tty_groups;/* all attributes (serial core use only) */ struct serial_rs485 rs485; +const struct serial_rs485 *rs485_supported;/* Supported mask for serial_rs485 */ struct gpio_desc *rs485_term_gpio;/* enable RS485 bus termination */ struct serial_iso7816 iso7816;void *private_data;/* generic platform data pointer */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 4/206 serial: fsl_lpuart: Fill in rs485_supported
In reply to Greg Kroah-HartmanFrom: Ilpo Järvinen <[email protected]>
[ Upstream commit 07481f448b635d7cebb92d5940f5bea5c4395a26 ]
Add information on supported serial_rs485 features.
Stable-dep-of: 76bad3f88750 ("tty: serial: fsl_lpuart: don't break the on-going transfer when global reset")
--- drivers/tty/serial/fsl_lpuart.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/tty/serial/fsl_lpuart.c +6 -0
@@ -2644,6 +2644,11 @@ static struct uart_driver lpuart_reg = { .cons = LPUART_CONSOLE, }; +static const struct serial_rs485 lpuart_rs485_supported = { + .flags =SER_RS485_ENABLED |SER_RS485_RTS_ON_SEND |SER_RS485_RTS_AFTER_SEND , +/* delay_rts_* and RX_DURING_TX are not supported */ +}; +static int lpuart_probe (struct platform_device *pdev) {const struct lpuart_soc_data *sdata =of_device_get_match_data (&pdev->dev);
@@ -2683,6 +2688,7 @@ static int lpuart_probe(struct platform_device *pdev) sport->port.rs485_config = lpuart32_config_rs485; else sport->port.rs485_config = lpuart_config_rs485; + sport->port.rs485_supported = &lpuart_rs485_supported; sport->ipg_clk =devm_clk_get (&pdev->dev,"ipg" );if (IS_ERR (sport->ipg_clk)) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 5/206 tty: serial: fsl_lpuart: dont break the on-going transfer when global reset
In reply to Greg Kroah-HartmanFrom: Sherry Sun <[email protected]>
[ Upstream commit 76bad3f88750f8cc465c489e6846249e0bc3d8f5 ]
lpuart_global_reset() shouldn't break the on-going transmit engine, need to recover the on-going data transfer after reset.
This can help earlycon here, since commit 60f361722ad2 ("serial:fsl_lpuart: Reset prior to registration") moved lpuart_global_reset() before uart_add_one_port(), earlycon is writing during global reset, as global reset will disable the TX and clear the baud rate register, which caused the earlycon cannot work any more after reset, needs to restore the baud rate and re-enable the transmitter to recover the earlycon write.
Also move the lpuart_global_reset() down, then we can reuse the lpuart32_tx_empty() without declaration.
--- drivers/tty/serial/fsl_lpuart.c | 76 +++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 27 deletions(-)
drivers/tty/serial/fsl_lpuart.c +49 -27
@@ -12,6 +12,7 @@#include <linux/dmaengine.h> #include <linux/dmapool.h> #include <linux/io.h> +#include <linux/iopoll.h> #include <linux/irq.h> #include <linux/module.h> #include <linux/of.h>
@@ -395,33 +396,6 @@ static unsigned int lpuart_get_baud_clk_rate(struct lpuart_port *sport)#define lpuart_enable_clks (x) __lpuart_enable_clks(x, true)#define lpuart_disable_clks (x) __lpuart_enable_clks(x, false) -static int lpuart_global_reset (struct lpuart_port *sport) -{ -struct uart_port *port = &sport->port; -void __iomem *global_addr; -int ret; - -if (uart_console (port)) -return 0 ; - - ret =clk_prepare_enable (sport->ipg_clk); -if (ret) { -dev_err (sport->port.dev,"failed to enable uart ipg clk: %d\n" , ret); -return ret; - } - -if (is_imx7ulp_lpuart (sport) ||is_imx8qxp_lpuart (sport)) { - global_addr = port->membase +UART_GLOBAL -IMX_REG_OFF ; -writel (UART_GLOBAL_RST , global_addr); -usleep_range (GLOBAL_RST_MIN_US ,GLOBAL_RST_MAX_US ); -writel (0 , global_addr); -usleep_range (GLOBAL_RST_MIN_US ,GLOBAL_RST_MAX_US ); - } - -clk_disable_unprepare (sport->ipg_clk); -return 0 ; -} -static void lpuart_stop_tx (struct uart_port *port) {unsigned char temp;
@@ -2649,6 +2623,54 @@ static const struct serial_rs485 lpuart_rs485_supported = {/* delay_rts_* and RX_DURING_TX are not supported */ }; +static int lpuart_global_reset (struct lpuart_port *sport) +{ +struct uart_port *port = &sport->port; +void __iomem *global_addr; +unsigned long ctrl, bd; +unsigned int val =0 ; +int ret; + + ret =clk_prepare_enable (sport->ipg_clk); +if (ret) { +dev_err (sport->port.dev,"failed to enable uart ipg clk: %d\n" , ret); +return ret; + } + +if (is_imx7ulp_lpuart (sport) ||is_imx8qxp_lpuart (sport)) { +/* +* If the transmitter is used by earlycon, wait for transmit engine to +* complete and then reset. +*/ + ctrl =lpuart32_read (port,UARTCTRL ); +if (ctrl &UARTCTRL_TE ) { + bd =lpuart32_read (&sport->port,UARTBAUD ); +if (read_poll_timeout (lpuart32_tx_empty, val, val,1 ,100000 , false, + port)) { +dev_warn (sport->port.dev, +"timeout waiting for transmit engine to complete\n" ); +clk_disable_unprepare (sport->ipg_clk); +return 0 ; + } + } + + global_addr = port->membase +UART_GLOBAL -IMX_REG_OFF ; +writel (UART_GLOBAL_RST , global_addr); +usleep_range (GLOBAL_RST_MIN_US ,GLOBAL_RST_MAX_US ); +writel (0 , global_addr); +usleep_range (GLOBAL_RST_MIN_US ,GLOBAL_RST_MAX_US ); + +/* Recover the transmitter for earlycon. */ +if (ctrl &UARTCTRL_TE ) { +lpuart32_write (port, bd,UARTBAUD ); +lpuart32_write (port, ctrl,UARTCTRL ); + } + } + +clk_disable_unprepare (sport->ipg_clk); +return 0 ; +} +static int lpuart_probe (struct platform_device *pdev) {const struct lpuart_soc_data *sdata =of_device_get_match_data (&pdev->dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 6/206 sctp: remove the unnecessary sinfo_stream check in sctp_prsctp_prune_unsent
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 9f0b773210c27a8f5d98ddb2fc4ba60a42a3285f ]
Since commit 5bbbbe32a431 ("sctp: introduce stream scheduler foundations"), sctp_stream_outq_migrate() has been called in sctp_stream_init/update to removes those chunks to streams higher than the new max. There is no longer need to do such check in sctp_prsctp_prune_unsent().
Stable-dep-of: 2f201ae14ae0 ("sctp: clear out_curr if all frag chunks of current msg are pruned")
--- net/sctp/outqueue.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
net/sctp/outqueue.c +3 -5
@@ -384,6 +384,7 @@ static int sctp_prsctp_prune_unsent(struct sctp_association *asoc, {struct sctp_outq *q = &asoc->outqueue;struct sctp_chunk *chk, *temp; +struct sctp_stream_out *sout; q->sched->unsched_all (&asoc->stream);
@@ -398,12 +399,9 @@ static int sctp_prsctp_prune_unsent(struct sctp_association *asoc,sctp_sched_dequeue_common (q, chk); asoc->sent_cnt_removable--; asoc->abandoned_unsent[SCTP_PR_INDEX (PRIO )]++; -if (chk->sinfo.sinfo_stream < asoc->stream.outcnt) { -struct sctp_stream_out *streamout = -SCTP_SO (&asoc->stream, chk->sinfo.sinfo_stream); - streamout->ext->abandoned_unsent[SCTP_PR_INDEX (PRIO )]++; - } + sout =SCTP_SO (&asoc->stream, chk->sinfo.sinfo_stream); + sout->ext->abandoned_unsent[SCTP_PR_INDEX (PRIO )]++; msg_len -= chk->skb->truesize +sizeof (struct sctp_chunk );sctp_chunk_free (chk);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 7/206 sctp: clear out_curr if all frag chunks of current msg are pruned
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 2f201ae14ae0f91dbf1cffea7bb1e29e81d4d108 ]
A crash was reported by Zhen Chen:
list_del corruption, ffffa035ddf01c18->next is NULL
WARNING: CPU: 1 PID: 250682 at lib/list_debug.c:49 __list_del_entry_valid+0x59/0xe0 RIP: 0010:__list_del_entry_valid+0x59/0xe0 Call Trace: sctp_sched_dequeue_common+0x17/0x70 [sctp] sctp_sched_fcfs_dequeue+0x37/0x50 [sctp] sctp_outq_flush_data+0x85/0x360 [sctp] sctp_outq_uncork+0x77/0xa0 [sctp] sctp_cmd_interpreter.constprop.0+0x164/0x1450 [sctp] sctp_side_effects+0x37/0xe0 [sctp] sctp_do_sm+0xd0/0x230 [sctp] sctp_primitive_SEND+0x2f/0x40 [sctp] sctp_sendmsg_to_asoc+0x3fa/0x5c0 [sctp] sctp_sendmsg+0x3d5/0x440 [sctp] sock_sendmsg+0x5b/0x70
and in sctp_sched_fcfs_dequeue() it dequeued a chunk from stream out_curr outq while this outq was empty.
Normally stream->out_curr must be set to NULL once all frag chunks of current msg are dequeued, as we can see in sctp_sched_dequeue_done(). However, in sctp_prsctp_prune_unsent() as it is not a proper dequeue, sctp_sched_dequeue_done() is not called to do this.
This patch is to fix it by simply setting out_curr to NULL when the last frag chunk of current msg is dequeued from out_curr stream in sctp_prsctp_prune_unsent().
--- net/sctp/outqueue.c | 5 +++++ 1 file changed, 5 insertions(+)
net/sctp/outqueue.c +5 -0
@@ -403,6 +403,11 @@ static int sctp_prsctp_prune_unsent(struct sctp_association *asoc, sout =SCTP_SO (&asoc->stream, chk->sinfo.sinfo_stream); sout->ext->abandoned_unsent[SCTP_PR_INDEX (PRIO )]++; +/* clear out_curr if all frag chunks are pruned */ +if (asoc->stream.out_curr == sout && +list_is_last (&chk->frag_list, &chk->msg->chunks)) + asoc->stream.out_curr =NULL ; + msg_len -= chk->skb->truesize +sizeof (struct sctp_chunk );sctp_chunk_free (chk);if (msg_len <=0 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 8/206 cifs: introduce new helper for cifs_reconnect()
In reply to Greg Kroah-HartmanFrom: Paulo Alcantara <[email protected]>
[ Upstream commit 43b459aa5e222cb6610dac8723b40c19532ea00d ]
Create cifs_mark_tcp_ses_conns_for_reconnect() helper to mark all sessions and tcons for reconnect when reconnecting tcp server.
Stable-dep-of: 1dcdf5f5b213 ("cifs: Fix connections leak when tlink setup failed")
--- fs/cifs/connect.c | 139 +++++++++++++++++++++++++--------------------- 1 file changed, 75 insertions(+), 64 deletions(-)
fs/cifs/connect.c +75 -64
@@ -199,80 +199,29 @@ static inline int reconn_setup_dfs_targets(struct cifs_sb_info *cifs_sb, }#endif -/* -* cifs tcp session reconnection +/** +* Mark all sessions and tcons for reconnect. * -* mark tcp session as reconnecting so temporarily locked -* mark all smb sessions as reconnecting for tcp session -* reconnect tcp session -* wake up waiters on reconnection? - (not needed currently) +* @server needs to be previously set to CifsNeedReconnect. */ -int -cifs_reconnect (struct TCP_Server_Info *server) +static void cifs_mark_tcp_ses_conns_for_reconnect (struct TCP_Server_Info *server) { -int rc =0 ;struct list_head *tmp, *tmp2;struct cifs_ses *ses;struct cifs_tcon *tcon;struct mid_q_entry *mid_entry;struct list_head retry_list; -#ifdef CONFIG_CIFS_DFS_UPCALL -struct super_block *sb =NULL ; -struct cifs_sb_info *cifs_sb =NULL ; -struct dfs_cache_tgt_list tgt_list =DFS_CACHE_TGT_LIST_INIT (tgt_list); -struct dfs_cache_tgt_iterator *tgt_it =NULL ; -#endif -spin_lock (&GlobalMid_Lock); - server->nr_targets =1 ; -#ifdef CONFIG_CIFS_DFS_UPCALL -spin_unlock (&GlobalMid_Lock); - sb =cifs_get_tcp_super (server); -if (IS_ERR (sb)) { - rc =PTR_ERR (sb); -cifs_dbg (FYI ,"%s: will not do DFS failover: rc = %d\n" , - __func__, rc); - sb =NULL ; - }else { - cifs_sb =CIFS_SB (sb); - rc =reconn_setup_dfs_targets (cifs_sb, &tgt_list); -if (rc) { - cifs_sb =NULL ; -if (rc != -EOPNOTSUPP ) { -cifs_server_dbg (VFS ,"%s: no target servers for DFS failover\n" , - __func__); - } - }else { - server->nr_targets =dfs_cache_get_nr_tgts (&tgt_list); - } - } -cifs_dbg (FYI ,"%s: will retry %d target(s)\n" , __func__, - server->nr_targets); -spin_lock (&GlobalMid_Lock); -#endif -if (server->tcpStatus == CifsExiting) { -/* the demux thread will exit normally -next time through the loop */ -spin_unlock (&GlobalMid_Lock); -#ifdef CONFIG_CIFS_DFS_UPCALL -dfs_cache_free_tgts (&tgt_list); -cifs_put_tcp_super (sb); -#endif -wake_up (&server->response_q); -return rc; - }else - server->tcpStatus = CifsNeedReconnect; -spin_unlock (&GlobalMid_Lock); server->maxBuf =0 ; server->max_read =0 ;cifs_dbg (FYI ,"Mark tcp session as need reconnect\n" );trace_smb3_reconnect (server->CurrentMid, server->conn_id, server->hostname); - -/* before reconnecting the tcp session, mark the smb session (uid) -and the tid bad so they are not used until reconnected */ -cifs_dbg (FYI ,"%s: marking sessions and tcons for reconnect\n" , - __func__); +/* +* before reconnecting the tcp session, mark the smb session (uid) and the tid bad so they +* are not used until reconnected. +*/ +cifs_dbg (FYI ,"%s: marking sessions and tcons for reconnect\n" , __func__);spin_lock (&cifs_tcp_ses_lock);list_for_each (tmp, &server->smb_ses_list) { ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
@@ -290,11 +239,11 @@ cifs_reconnect(struct TCP_Server_Info *server)cifs_dbg (FYI ,"%s: tearing down socket\n" , __func__);mutex_lock (&server->srv_mutex);if (server->ssocket) { -cifs_dbg (FYI ,"State: 0x%x Flags: 0x%lx\n" , - server->ssocket->state, server->ssocket->flags); +cifs_dbg (FYI ,"State: 0x%x Flags: 0x%lx\n" , server->ssocket->state, + server->ssocket->flags);kernel_sock_shutdown (server->ssocket,SHUT_WR ); -cifs_dbg (FYI ,"Post shutdown state: 0x%x Flags: 0x%lx\n" , - server->ssocket->state, server->ssocket->flags); +cifs_dbg (FYI ,"Post shutdown state: 0x%x Flags: 0x%lx\n" , server->ssocket->state, + server->ssocket->flags);sock_release (server->ssocket); server->ssocket =NULL ; }
@@ -333,6 +282,68 @@ cifs_reconnect(struct TCP_Server_Info *server)smbd_destroy (server);mutex_unlock (&server->srv_mutex); } +} + +/* +* cifs tcp session reconnection +* +* mark tcp session as reconnecting so temporarily locked +* mark all smb sessions as reconnecting for tcp session +* reconnect tcp session +* wake up waiters on reconnection? - (not needed currently) +*/ +int +cifs_reconnect (struct TCP_Server_Info *server) +{ +int rc =0 ; +#ifdef CONFIG_CIFS_DFS_UPCALL +struct super_block *sb =NULL ; +struct cifs_sb_info *cifs_sb =NULL ; +struct dfs_cache_tgt_list tgt_list =DFS_CACHE_TGT_LIST_INIT (tgt_list); +struct dfs_cache_tgt_iterator *tgt_it =NULL ; +#endif + +spin_lock (&GlobalMid_Lock); + server->nr_targets =1 ; +#ifdef CONFIG_CIFS_DFS_UPCALL +spin_unlock (&GlobalMid_Lock); + sb =cifs_get_tcp_super (server); +if (IS_ERR (sb)) { + rc =PTR_ERR (sb); +cifs_dbg (FYI ,"%s: will not do DFS failover: rc = %d\n" , + __func__, rc); + sb =NULL ; + }else { + cifs_sb =CIFS_SB (sb); + rc =reconn_setup_dfs_targets (cifs_sb, &tgt_list); +if (rc) { + cifs_sb =NULL ; +if (rc != -EOPNOTSUPP ) { +cifs_server_dbg (VFS ,"%s: no target servers for DFS failover\n" , + __func__); + } + }else { + server->nr_targets =dfs_cache_get_nr_tgts (&tgt_list); + } + } +cifs_dbg (FYI ,"%s: will retry %d target(s)\n" , __func__, + server->nr_targets); +spin_lock (&GlobalMid_Lock); +#endif +if (server->tcpStatus == CifsExiting) { +/* the demux thread will exit normally next time through the loop */ +spin_unlock (&GlobalMid_Lock); +#ifdef CONFIG_CIFS_DFS_UPCALL +dfs_cache_free_tgts (&tgt_list); +cifs_put_tcp_super (sb); +#endif +wake_up (&server->response_q); +return rc; + }else + server->tcpStatus = CifsNeedReconnect; +spin_unlock (&GlobalMid_Lock); + +cifs_mark_tcp_ses_conns_for_reconnect (server); do { try_to_freeze();
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 9/206 cifs: split out dfs code from cifs_reconnect()
In reply to Greg Kroah-HartmanFrom: Paulo Alcantara <[email protected]>
[ Upstream commit bbcce368044572d0802c3bbb8ef3fe98f581d803 ]
Make two separate functions that handle dfs and non-dfs reconnect logics since cifs_reconnect() became way too complex to handle both. While at it, add some documentation.
Stable-dep-of: 1dcdf5f5b213 ("cifs: Fix connections leak when tlink setup failed")
--- fs/cifs/connect.c | 295 +++++++++++++++++++++++++--------------------- 1 file changed, 162 insertions(+), 133 deletions(-)
fs/cifs/connect.c +162 -133
@@ -148,57 +148,6 @@ static void cifs_resolve_server(struct work_struct *work)mutex_unlock (&server->srv_mutex); } -#ifdef CONFIG_CIFS_DFS_UPCALL -/* These functions must be called with server->srv_mutex held */ -static void reconn_set_next_dfs_target (struct TCP_Server_Info *server, -struct cifs_sb_info *cifs_sb, -struct dfs_cache_tgt_list *tgt_list, -struct dfs_cache_tgt_iterator **tgt_it) -{ -const char *name; -int rc; - -if (!cifs_sb || !cifs_sb->origin_fullpath) -return ; - -if (!*tgt_it) { - *tgt_it =dfs_cache_get_tgt_iterator (tgt_list); - }else { - *tgt_it =dfs_cache_get_next_tgt (tgt_list, *tgt_it); -if (!*tgt_it) - *tgt_it =dfs_cache_get_tgt_iterator (tgt_list); - } - -cifs_dbg (FYI ,"%s: UNC: %s\n" , __func__, cifs_sb->origin_fullpath); - - name =dfs_cache_get_tgt_name (*tgt_it); - -kfree (server->hostname); - - server->hostname =extract_hostname (name); -if (IS_ERR (server->hostname)) { -cifs_dbg (FYI , -"%s: failed to extract hostname from target: %ld\n" , - __func__,PTR_ERR (server->hostname)); -return ; - } - - rc =reconn_set_ipaddr_from_hostname (server); -if (rc) { -cifs_dbg (FYI ,"%s: failed to resolve hostname: %d\n" , - __func__, rc); - } -} - -static inline int reconn_setup_dfs_targets (struct cifs_sb_info *cifs_sb, -struct dfs_cache_tgt_list *tl) -{ -if (!cifs_sb->origin_fullpath) -return -EOPNOTSUPP ; -return dfs_cache_noreq_find (cifs_sb->origin_fullpath +1 ,NULL , tl); -} -#endif -/** * Mark all sessions and tcons for reconnect. *
@@ -284,6 +233,21 @@ static void cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server } } +static bool cifs_tcp_ses_needs_reconnect (struct TCP_Server_Info *server,int num_targets) +{ +spin_lock (&GlobalMid_Lock); + server->nr_targets = num_targets; +if (server->tcpStatus == CifsExiting) { +/* the demux thread will exit normally next time through the loop */ +spin_unlock (&GlobalMid_Lock); +wake_up (&server->response_q); +return false; + } + server->tcpStatus = CifsNeedReconnect; +spin_unlock (&GlobalMid_Lock); +return true; +} +/* * cifs tcp session reconnection *
@@ -292,90 +256,23 @@ static void cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server* reconnect tcp session * wake up waiters on reconnection? - (not needed currently) */ -int -cifs_reconnect (struct TCP_Server_Info *server) +static int __cifs_reconnect (struct TCP_Server_Info *server) {int rc =0 ; -#ifdef CONFIG_CIFS_DFS_UPCALL -struct super_block *sb =NULL ; -struct cifs_sb_info *cifs_sb =NULL ; -struct dfs_cache_tgt_list tgt_list =DFS_CACHE_TGT_LIST_INIT (tgt_list); -struct dfs_cache_tgt_iterator *tgt_it =NULL ; -#endif -spin_lock (&GlobalMid_Lock); - server->nr_targets =1 ; -#ifdef CONFIG_CIFS_DFS_UPCALL -spin_unlock (&GlobalMid_Lock); - sb =cifs_get_tcp_super (server); -if (IS_ERR (sb)) { - rc =PTR_ERR (sb); -cifs_dbg (FYI ,"%s: will not do DFS failover: rc = %d\n" , - __func__, rc); - sb =NULL ; - }else { - cifs_sb =CIFS_SB (sb); - rc =reconn_setup_dfs_targets (cifs_sb, &tgt_list); -if (rc) { - cifs_sb =NULL ; -if (rc != -EOPNOTSUPP ) { -cifs_server_dbg (VFS ,"%s: no target servers for DFS failover\n" , - __func__); - } - }else { - server->nr_targets =dfs_cache_get_nr_tgts (&tgt_list); - } - } -cifs_dbg (FYI ,"%s: will retry %d target(s)\n" , __func__, - server->nr_targets); -spin_lock (&GlobalMid_Lock); -#endif -if (server->tcpStatus == CifsExiting) { -/* the demux thread will exit normally next time through the loop */ -spin_unlock (&GlobalMid_Lock); -#ifdef CONFIG_CIFS_DFS_UPCALL -dfs_cache_free_tgts (&tgt_list); -cifs_put_tcp_super (sb); -#endif -wake_up (&server->response_q); -return rc; - }else - server->tcpStatus = CifsNeedReconnect; -spin_unlock (&GlobalMid_Lock); +if (!cifs_tcp_ses_needs_reconnect (server,1 )) +return 0 ;cifs_mark_tcp_ses_conns_for_reconnect (server); do { try_to_freeze(); - mutex_lock(&server->srv_mutex); - if (!cifs_swn_set_server_dstaddr(server)) { -#ifdef CONFIG_CIFS_DFS_UPCALL - if (cifs_sb && cifs_sb->origin_fullpath) - /* - * Set up next DFS target server (if any) for reconnect. If DFS - * feature is disabled, then we will retry last server we - * connected to before. - */ - reconn_set_next_dfs_target(server, cifs_sb, &tgt_list, &tgt_it); - else { -#endif - /* - * Resolve the hostname again to make sure that IP address is up-to-date. - */ + /* resolve the hostname again to make sure that IP address is up-to-date */ rc = reconn_set_ipaddr_from_hostname(server); - if (rc) { - cifs_dbg(FYI, "%s: failed to resolve hostname: %d\n", - __func__, rc); - } - -#ifdef CONFIG_CIFS_DFS_UPCALL - } -#endif - - + cifs_dbg(FYI, "%s: reconn_set_ipaddr_from_hostname: rc=%d\n", __func__, rc); } if (cifs_rdma_enabled(server))
@@ -383,8 +280,8 @@ cifs_reconnect(struct TCP_Server_Info *server)else rc =generic_ip_connect (server);if (rc) { -cifs_dbg (FYI ,"reconnect error %d\n" , rc);mutex_unlock (&server->srv_mutex); +cifs_dbg (FYI ,"%s: reconnect error %d\n" , __func__, rc);msleep (3000 ); }else {atomic_inc (&tcpSesReconnectCount);
@@ -398,19 +295,109 @@ cifs_reconnect(struct TCP_Server_Info *server) } }while (server->tcpStatus == CifsNeedReconnect); +if (server->tcpStatus == CifsNeedNegotiate) +mod_delayed_work (cifsiod_wq, &server->echo,0 ); + +wake_up (&server->response_q); +return rc; +} +#ifdef CONFIG_CIFS_DFS_UPCALL -if (tgt_it) { - rc =dfs_cache_noreq_update_tgthint (cifs_sb->origin_fullpath +1 , - tgt_it); +static int reconnect_dfs_server (struct TCP_Server_Info *server,struct cifs_sb_info *cifs_sb) +{ +int rc =0 ; +const char *refpath = cifs_sb->origin_fullpath +1 ; +struct dfs_cache_tgt_list tl =DFS_CACHE_TGT_LIST_INIT (tl); +struct dfs_cache_tgt_iterator *tit =NULL ; +int num_targets =1 ; +char *hostname; + +/* +* Determine the number of dfs targets the referral path in @cifs_sb resolves to. +* +* smb2_reconnect() needs to know how long it should wait based upon the number of dfs +* targets (server->nr_targets). It's also possible that the cached referral was cleared +* through /proc/fs/cifs/dfscache or the target list is empty due to server settings after +* refreshing the referral, so, in this case, default it to 1. +*/ +if (!dfs_cache_noreq_find (refpath,NULL , &tl)) { + num_targets =dfs_cache_get_nr_tgts (&tl); +if (!num_targets) + num_targets =1 ; + } + +if (!cifs_tcp_ses_needs_reconnect (server, num_targets)) +return 0 ; + +cifs_mark_tcp_ses_conns_for_reconnect (server); + +do { +/* Get next dfs target from target list (if any) */ +if (!tit) + tit =dfs_cache_get_tgt_iterator (&tl); +else + tit =dfs_cache_get_next_tgt (&tl, tit); + +try_to_freeze (); +mutex_lock (&server->srv_mutex); + +if (!cifs_swn_set_server_dstaddr (server)) { +/* +* If any dfs target was selected, then update @server with either a +* hostname or an address. +*/ +if (tit) { + hostname =extract_hostname (dfs_cache_get_tgt_name (tit)); +if (!IS_ERR (hostname)) { +kfree (server->hostname); + server->hostname = hostname; + }else { +cifs_dbg (FYI ,"%s: couldn't extract hostname or address from dfs target: %ld\n" , + __func__,PTR_ERR (hostname)); +cifs_dbg (FYI ,"%s: default to last target server: %s\n" , + __func__, server->hostname); + } + } +/* resolve the hostname again to make sure that IP address is up-to-date. */ + rc =reconn_set_ipaddr_from_hostname (server); +cifs_dbg (FYI ,"%s: reconn_set_ipaddr_from_hostname: rc=%d\n" , __func__, rc); + } + +/* Reconnect the socket */ +if (cifs_rdma_enabled (server)) + rc =smbd_reconnect (server); +else + rc =generic_ip_connect (server); +if (rc) { -cifs_server_dbg (VFS ,"%s: failed to update DFS target hint: rc = %d\n" , - __func__, rc); +/* Failed to reconnect socket. Retry next dfs target. */ +mutex_unlock (&server->srv_mutex); +cifs_dbg (FYI ,"%s: reconnect error %d\n" , __func__, rc); +msleep (3000 ); +continue ; } -dfs_cache_free_tgts (&tgt_list); - } -cifs_put_tcp_super (sb); -#endif +/* +* Socket was created. Update tcp session status to CifsNeedNegotiate so that a +* process waiting for reconnect will know it needs to re-establish session and tcon +* through the reconnected target server. +*/ +atomic_inc (&tcpSesReconnectCount); +set_credits (server,1 ); +spin_lock (&GlobalMid_Lock); +if (server->tcpStatus != CifsExiting) + server->tcpStatus = CifsNeedNegotiate; +spin_unlock (&GlobalMid_Lock); +cifs_swn_reset_server_dstaddr (server); +mutex_unlock (&server->srv_mutex); + }while (server->tcpStatus == CifsNeedReconnect); + +if (tit) +dfs_cache_noreq_update_tgthint (refpath, tit); + +dfs_cache_free_tgts (&tl); + +/* Need to set up echo worker again once connection has been established */ if (server->tcpStatus == CifsNeedNegotiate)mod_delayed_work (cifsiod_wq, &server->echo,0 );
@@ -418,6 +405,48 @@ cifs_reconnect(struct TCP_Server_Info *server)return rc; } +int cifs_reconnect (struct TCP_Server_Info *server) +{ +int rc; +struct super_block *sb; +struct cifs_sb_info *cifs_sb; + +/* +* If tcp session is not an dfs connection or it is a channel, then reconnect to last target +* server. +*/ +spin_lock (&cifs_tcp_ses_lock); +if (!server->is_dfs_conn || server->is_channel) { +spin_unlock (&cifs_tcp_ses_lock); +return __cifs_reconnect (server); + } +spin_unlock (&cifs_tcp_ses_lock); + +/* If no superblock, then it might be an ipc connection */ + sb =cifs_get_tcp_super (server); +if (IS_ERR (sb)) +return __cifs_reconnect (server); + +/* +* Check for a referral path to look up in superblock. If unset, then simply reconnect to +* last target server. +*/ + cifs_sb =CIFS_SB (sb); +if (!cifs_sb->origin_fullpath || !cifs_sb->origin_fullpath[0 ]) + rc =__cifs_reconnect (server); +else + rc =reconnect_dfs_server (server, cifs_sb); + +cifs_put_tcp_super (sb); +return rc; +} +#else +int cifs_reconnect (struct TCP_Server_Info *server) +{ +return __cifs_reconnect (server); +} +#endif +static void cifs_echo_request (struct work_struct *work) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 10/206 cifs: support nested dfs links over reconnect
In reply to Greg Kroah-HartmanFrom: Paulo Alcantara <[email protected]>
[ Upstream commit c88f7dcd6d6429197fc2fd87b54a894ffcd48e8e ]
Mounting a dfs link that has nested links was already supported at mount(2), so make it work over reconnect as well.
Make the following case work:
* mount //root/dfs/link /mnt -o ...
- final share: /server/share
* in server settings
- change target folder of /root/dfs/link3 to /server/share2
- change target folder of /root/dfs/link2 to /root/dfs/link3
- change target folder of /root/dfs/link to /root/dfs/link2
* mount -o remount,... /mnt
- refresh all dfs referrals
- mark current connection for failover
- cifs_reconnect() reconnects to root server
- tree_connect()
* checks that /root/dfs/link2 is a link, then chase it
* checks that root/dfs/link3 is a link, then chase it
* finally tree connect to /server/share2
If the mounted share is no longer accessible and a reconnect had been triggered, the client will retry it from both last referral path (/root/dfs/link3) and original referral path (/root/dfs/link).
Any new referral paths found while chasing dfs links over reconnect, it will be updated to TCP_Server_Info::leaf_fullpath, accordingly.
Stable-dep-of: 1dcdf5f5b213 ("cifs: Fix connections leak when tlink setup failed")
--- fs/cifs/cifs_dfs_ref.c | 59 +-- fs/cifs/cifs_fs_sb.h | 5 - fs/cifs/cifsglob.h | 24 +- fs/cifs/cifsproto.h | 5 +- fs/cifs/connect.c | 1138 ++++++++++++++++++++-------------------- fs/cifs/dfs_cache.c | 44 +- fs/cifs/misc.c | 62 +-- fs/cifs/smb2ops.c | 10 +- fs/cifs/smb2pdu.c | 6 +- 9 files changed, 660 insertions(+), 693 deletions(-)
fs/cifs/cifs_dfs_ref.c +2 -57
@@ -307,12 +307,8 @@ static struct vfsmount *cifs_dfs_do_mount(struct dentry *mntpt,static struct vfsmount *cifs_dfs_do_automount (struct dentry *mntpt) {struct cifs_sb_info *cifs_sb; -struct cifs_ses *ses; -struct cifs_tcon *tcon;void *page; -char *full_path, *root_path; -unsigned int xid; -int rc; +char *full_path;struct vfsmount *mnt;cifs_dbg (FYI ,"in %s\n" , __func__);
@@ -324,8 +320,6 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt)* the double backslashes usually used in the UNC. This function * gives us the latter, so we must adjust the result. */ - mnt =ERR_PTR (-ENOMEM ); - cifs_sb =CIFS_SB (mntpt->d_sb);if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_NO_DFS ) { mnt =ERR_PTR (-EREMOTE );
@@ -341,60 +335,11 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt) }convert_delimiter (full_path,'\\' ); -cifs_dbg (FYI ,"%s: full_path: %s\n" , __func__, full_path); -if (!cifs_sb_master_tlink (cifs_sb)) { -cifs_dbg (FYI ,"%s: master tlink is NULL\n" , __func__); - goto free_full_path; - } - - tcon =cifs_sb_master_tcon (cifs_sb); -if (!tcon) { -cifs_dbg (FYI ,"%s: master tcon is NULL\n" , __func__); - goto free_full_path; - } - - root_path =kstrdup (tcon->treeName,GFP_KERNEL ); -if (!root_path) { - mnt =ERR_PTR (-ENOMEM ); - goto free_full_path; - } -cifs_dbg (FYI ,"%s: root path: %s\n" , __func__, root_path); - - ses = tcon->ses; - xid =get_xid (); - -/* -* If DFS root has been expired, then unconditionally fetch it again to -* refresh DFS referral cache. -*/ - rc =dfs_cache_find (xid, ses, cifs_sb->local_nls,cifs_remap (cifs_sb), - root_path +1 ,NULL ,NULL ); -if (!rc) { - rc =dfs_cache_find (xid, ses, cifs_sb->local_nls, -cifs_remap (cifs_sb), full_path +1 , -NULL ,NULL ); - } - -free_xid (xid); - -if (rc) { - mnt =ERR_PTR (rc); - goto free_root_path; - } -/* -* OK - we were able to get and cache a referral for @full_path. -* -* Now, pass it down to cifs_mount() and it will retry every available -* node server in case of failures - no need to do it here. -*/ mnt =cifs_dfs_do_mount (mntpt, cifs_sb, full_path); -cifs_dbg (FYI ,"%s: cifs_dfs_do_mount:%s , mnt:%p\n" , __func__, - full_path +1 , mnt); +cifs_dbg (FYI ,"%s: cifs_dfs_do_mount:%s , mnt:%p\n" , __func__, full_path +1 , mnt); -free_root_path: -kfree (root_path); free_full_path:free_dentry_path (page); cdda_exit:
fs/cifs/cifs_fs_sb.h +0 -5
@@ -61,11 +61,6 @@ struct cifs_sb_info {/* only used when CIFS_MOUNT_USE_PREFIX_PATH is set */ char *prepath; -/* -* Canonical DFS path initially provided by the mount call. We might connect to something -* different via DFS but we want to keep it to do failover properly. -*/ -char *origin_fullpath;/* \\HOST\SHARE\[OPTIONAL PATH] */ /* randomly generated 128-bit number for indexing dfs mount groups in referral cache */ uuid_t dfs_mount_id;/*
fs/cifs/cifsglob.h +23 -1
@@ -693,6 +693,19 @@ struct TCP_Server_Info {#endif #ifdef CONFIG_CIFS_DFS_UPCALL bool is_dfs_conn;/* if a dfs connection */ +struct mutex refpath_lock;/* protects leaf_fullpath */ +/* +* Canonical DFS full paths that were used to chase referrals in mount and reconnect. +* +* origin_fullpath: first or original referral path +* leaf_fullpath: last referral path (might be changed due to nested links in reconnect) +* +* current_fullpath: pointer to either origin_fullpath or leaf_fullpath +* NOTE: cannot be accessed outside cifs_reconnect() and smb2_reconnect() +* +* format: \\HOST\SHARE\[OPTIONAL PATH] +*/ +char *origin_fullpath, *leaf_fullpath, *current_fullpath;#endif };
@@ -1097,7 +1110,6 @@ struct cifs_tcon {struct cached_fid crfid;/* Cached root fid */ /* BB add field for back pointer to sb struct(s)? */ #ifdef CONFIG_CIFS_DFS_UPCALL -char *dfs_path;/* canonical DFS path */ struct list_head ulist;/* cache update list */ #endif };
@@ -1950,4 +1962,14 @@ static inline bool is_tcon_dfs(struct cifs_tcon *tcon) tcon->share_flags & (SHI1005_FLAGS_DFS | SHI1005_FLAGS_DFS_ROOT); } +static inline bool cifs_is_referral_server (struct cifs_tcon *tcon, +const struct dfs_info3_param *ref) +{ +/* +* Check if all targets are capable of handling DFS referrals as per +* MS-DFSC 2.2.4 RESP_GET_DFS_REFERRAL. +*/ +return is_tcon_dfs (tcon) || (ref && (ref->flags &DFSREF_REFERRAL_SERVER )); +} +#endif /* _CIFS_GLOB_H */
fs/cifs/cifsproto.h +4 -1
@@ -607,7 +607,7 @@ int smb2_parse_query_directory(struct cifs_tcon *tcon, struct kvec *rsp_iov,struct super_block *cifs_get_tcp_super (struct TCP_Server_Info *server);void cifs_put_tcp_super (struct super_block *sb); -int update_super_prepath (struct cifs_tcon *tcon,char *prefix); +int cifs_update_super_prepath (struct cifs_sb_info *cifs_sb,char *prefix);char *extract_hostname (const char *unc);char *extract_sharename (const char *unc);
@@ -634,4 +634,7 @@ static inline int cifs_create_options(struct cifs_sb_info *cifs_sb, int options) return options; } +struct super_block *cifs_get_tcon_super (struct cifs_tcon *tcon); +void cifs_put_tcon_super (struct super_block *sb); +#endif /* _CIFSPROTO_H */
fs/cifs/connect.c +578 -560
1,426 lines not on this page · raw message
fs/cifs/dfs_cache.c +36 -8
94 lines not on this page · raw message
fs/cifs/misc.c +5 -57
83 lines not on this page · raw message
fs/cifs/smb2ops.c +7 -3
@@ -2869,6 +2869,7 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,struct fsctl_get_dfs_referral_req *dfs_req =NULL ;struct get_dfs_referral_rsp *dfs_rsp =NULL ;u32 dfs_req_size =0 , dfs_rsp_size =0 ; +int retry_count =0 ;cifs_dbg (FYI ,"%s: path: %s\n" , __func__, search_name);
@@ -2920,11 +2921,14 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses, true/* is_fsctl */ , (char *)dfs_req, dfs_req_size, CIFSMaxBufSize, (char **)&dfs_rsp, &dfs_rsp_size); - }while (rc == -EAGAIN ); +if (!is_retryable_error (rc)) +break ; +usleep_range (512 ,2048 ); + }while (++retry_count <5 );if (rc) { -if ((rc != -ENOENT ) && (rc != -EOPNOTSUPP )) -cifs_tcon_dbg (VFS ,"ioctl error in %s rc=%d\n" , __func__, rc); +if (!is_retryable_error (rc) && rc != -ENOENT && rc != -EOPNOTSUPP ) +cifs_tcon_dbg (VFS ,"%s: ioctl error: rc=%d\n" , __func__, rc); goto out; }
fs/cifs/smb2pdu.c +5 -1
@@ -156,7 +156,11 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,if (tcon ==NULL )return 0 ; -if (smb2_command ==SMB2_TREE_CONNECT ) +/* +* Need to also skip SMB2_IOCTL because it is used for checking nested dfs links in +* cifs_tree_connect(). +*/ +if (smb2_command ==SMB2_TREE_CONNECT || smb2_command ==SMB2_IOCTL )return 0 ;if (tcon->tidStatus == CifsExiting) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 11/206 cifs: Fix connections leak when tlink setup failed
In reply to Greg Kroah-HartmanFrom: Zhang Xiaoxu <[email protected]>
[ Upstream commit 1dcdf5f5b2137185cbdd5385f29949ab3da4f00c ]
If the tlink setup failed, lost to put the connections, then the module refcnt leak since the cifsd kthread not exit.
Also leak the fscache info, and for next mount with fsc, it will print the follow errors:
CIFS: Cache volume key already in use (cifs,127.0.0.1:445,TEST)
Let's check the result of tlink setup, and do some cleanup.
--- fs/cifs/connect.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
fs/cifs/connect.c +11 -3
@@ -3550,9 +3550,13 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)uuid_copy (&cifs_sb->dfs_mount_id, &mnt_ctx.mount_id); out: -free_xid (mnt_ctx.xid);cifs_try_adding_channels (cifs_sb, mnt_ctx.ses); -return mount_setup_tlink (cifs_sb, mnt_ctx.ses, mnt_ctx.tcon); + rc =mount_setup_tlink (cifs_sb, mnt_ctx.ses, mnt_ctx.tcon); +if (rc) + goto error; + +free_xid (mnt_ctx.xid); +return rc; error:dfs_cache_put_refsrv_sessions (&mnt_ctx.mount_id);
@@ -3579,8 +3583,12 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx) goto error; } + rc =mount_setup_tlink (cifs_sb, mnt_ctx.ses, mnt_ctx.tcon); +if (rc) + goto error; +free_xid (mnt_ctx.xid); -return mount_setup_tlink (cifs_sb, mnt_ctx.ses, mnt_ctx.tcon); +return rc; error:mount_put_conns (&mnt_ctx);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 12/206 ata: libata-scsi: simplify __ata_scsi_queuecmd()
In reply to Greg Kroah-HartmanFrom: Wenchao Hao <[email protected]>
[ Upstream commit 84eac327af543f03172085d5ef9f98ea25a51191 ]
This patch cleans up the code of __ata_scsi_queuecmd(). Since each branch of the "if" condition check that scmd->cmd_len is not zero, move this check out of the "if" to simplify the conditions being checked in the "else" branch.
While at it, avoid the if-else-if-else structure using if-else if structure and remove the redundant rc local variable.
This patch does not change the function logic.
Stable-dep-of: e20e81a24a4d ("ata: libata-core: do not issue non-internal commands once EH is pending")
--- drivers/ata/libata-scsi.c | 45 ++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 24 deletions(-)
drivers/ata/libata-scsi.c +21 -24
@@ -3990,42 +3990,39 @@ int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, struct ata_device *dev) {u8 scsi_op = scmd->cmnd[0 ];ata_xlat_func_t xlat_func; -int rc =0 ; + +if (unlikely (!scmd->cmd_len)) + goto bad_cdb_len;if (dev->class ==ATA_DEV_ATA || dev->class ==ATA_DEV_ZAC ) { -if (unlikely (!scmd->cmd_len || scmd->cmd_len > dev->cdb_len)) +if (unlikely (scmd->cmd_len > dev->cdb_len)) goto bad_cdb_len; xlat_func =ata_get_xlat_func (dev, scsi_op); - }else { -if (unlikely (!scmd->cmd_len)) - goto bad_cdb_len; + }else if (likely ((scsi_op !=ATA_16 ) || !atapi_passthru16)) { +/* relay SCSI command to ATAPI device */ +int len =COMMAND_SIZE (scsi_op); - xlat_func =NULL ; -if (likely ((scsi_op !=ATA_16 ) || !atapi_passthru16)) { -/* relay SCSI command to ATAPI device */ -int len =COMMAND_SIZE (scsi_op); -if (unlikely (len > scmd->cmd_len || - len > dev->cdb_len || - scmd->cmd_len >ATAPI_CDB_LEN )) - goto bad_cdb_len; +if (unlikely (len > scmd->cmd_len || + len > dev->cdb_len || + scmd->cmd_len >ATAPI_CDB_LEN )) + goto bad_cdb_len; - xlat_func = atapi_xlat; - }else { -/* ATA_16 passthru, treat as an ATA command */ -if (unlikely (scmd->cmd_len >16 )) - goto bad_cdb_len; + xlat_func = atapi_xlat; + }else { +/* ATA_16 passthru, treat as an ATA command */ +if (unlikely (scmd->cmd_len >16 )) + goto bad_cdb_len; - xlat_func =ata_get_xlat_func (dev, scsi_op); - } + xlat_func =ata_get_xlat_func (dev, scsi_op); }if (xlat_func) - rc =ata_scsi_translate (dev, scmd, xlat_func); -else -ata_scsi_simulate (dev, scmd); +return ata_scsi_translate (dev, scmd, xlat_func); -return rc; +ata_scsi_simulate (dev, scmd); + +return 0 ; bad_cdb_len: DPRINTK("bad CDB len=%u, scsi_op=0x%02x, max=%u\n",
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 13/206 ata: libata-core: do not issue non-internal commands once EH is pending
In reply to Greg Kroah-HartmanFrom: Niklas Cassel <[email protected]>
[ Upstream commit e20e81a24a4d58744a29715aac2f795cd1651955 ]
While the ATA specification states that a device should return command aborted for all commands queued after the device has entered error state, since ATA only keeps the sense data for the latest command (in non-NCQ case), we really don't want to send block layer commands to the device after it has entered error state. (Only ATA EH commands should be sent, to read the sense data etc.)
Currently, scsi_queue_rq() will check if scsi_host_in_recovery() (state is SHOST_RECOVERY), and if so, it will _not_ issue a command via:scsi_dispatch_cmd() -> host->hostt->queuecommand() (ata_scsi_queuecmd()) -> __ata_scsi_queuecmd() -> ata_scsi_translate() -> ata_qc_issue()
Before commit e494f6a72839 ("[SCSI] improved eh timeout handler"), when receiving a TFES error IRQ, the call chain looked like this:ahci_error_intr() -> ata_port_abort() -> ata_do_link_abort() -> ata_qc_complete() -> ata_qc_schedule_eh() -> blk_abort_request() -> blk_rq_timed_out() -> q->rq_timed_out_fn() (scsi_times_out()) -> scsi_eh_scmd_add() -> scsi_host_set_state(shost, SHOST_RECOVERY)
Which meant that as soon as an error IRQ was serviced, SHOST_RECOVERY would be set.
However, after commit e494f6a72839 ("[SCSI] improved eh timeout handler"), scsi_times_out() will instead call scsi_abort_command() which will queue delayed work, and the worker function scmd_eh_abort_handler() will call scsi_eh_scmd_add(), which calls scsi_host_set_state(shost, SHOST_RECOVERY).
So now, after the TFES error IRQ has been serviced, we need to wait for the SCSI workqueue to run its work before SHOST_RECOVERY gets set.
It is worth noting that, even before commit e494f6a72839 ("[SCSI] improved eh timeout handler"), we could receive an error IRQ from the time when scsi_queue_rq() checks scsi_host_in_recovery(), to the time when ata_scsi_queuecmd() is actually called.
In order to handle both the delayed setting of SHOST_RECOVERY and the window where we can receive an error IRQ, add a check against ATA_PFLAG_EH_PENDING (which gets set when servicing the error IRQ), inside ata_scsi_queuecmd() itself, while holding the ap->lock. (Since the ap->lock is held while servicing IRQs.)
--- drivers/ata/libata-scsi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/ata/libata-scsi.c +10 -0
@@ -3988,9 +3988,19 @@ void ata_scsi_dump_cdb(struct ata_port *ap, struct scsi_cmnd *cmd)int __ata_scsi_queuecmd (struct scsi_cmnd *scmd,struct ata_device *dev) { +struct ata_port *ap = dev->link->ap;u8 scsi_op = scmd->cmnd[0 ];ata_xlat_func_t xlat_func; +/* +* scsi_queue_rq() will defer commands if scsi_host_in_recovery(). +* However, this check is done without holding the ap->lock (a libata +* specific lock), so we can have received an error irq since then, +* therefore we must check if EH is pending, while holding ap->lock. +*/ +if (ap->pflags & (ATA_PFLAG_EH_PENDING |ATA_PFLAG_EH_IN_PROGRESS )) +return SCSI_MLQUEUE_DEVICE_BUSY ; +if (unlikely (!scmd->cmd_len)) goto bad_cdb_len;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 14/206 drm/display: Dont assume dual mode adaptors support i2c sub-addressing
In reply to Greg Kroah-HartmanFrom: Simon Rettberg <[email protected]>
[ Upstream commit 5954acbacbd1946b96ce8ee799d309cb0cd3cb9d ]
Current dual mode adaptor ("DP++") detection code assumes that all adaptors support i2c sub-addressing for read operations from the DP-HDMI adaptor ID buffer. It has been observed that multiple adaptors do not in fact support this, and always return data starting at register 0. On affected adaptors, the code fails to read the proper registers that would identify the device as a type 2 adaptor, and handles those as type 1, limiting the TMDS clock to 165MHz, even if the according register would announce a higher TMDS clock. Fix this by always reading the ID buffer starting from offset 0, and discarding any bytes before the actual offset of interest.
We tried finding authoritative documentation on whether or not this is allowed behaviour, but since all the official VESA docs are paywalled, the best we could come up with was the spec sheet for Texas Instruments' SNx5DP149 chip family.[1] It explicitly mentions that sub-addressing is supported for register writes, but *not* for reads (See NOTE in section 8.5.3). Unless TI openly decided to violate the VESA spec, one could take that as a hint that sub-addressing is in fact not mandated by VESA.
The other two adaptors affected used the PS8409(A) and the LT8611, according to the data returned from their ID buffers.
[1] https://www.ti.com/lit/ds/symlink/sn75dp149.pdf
--- drivers/gpu/drm/drm_dp_dual_mode_helper.c | 51 +++++++++++++---------- 1 file changed, 29 insertions(+), 22 deletions(-)
drivers/gpu/drm/drm_dp_dual_mode_helper.c +29 -22
@@ -63,23 +63,45 @@ssize_t drm_dp_dual_mode_read (struct i2c_adapter *adapter,u8 offset,void *buffer,size_t size) { +u8 zero =0 ; +char *tmpbuf =NULL ; +/* +* As sub-addressing is not supported by all adaptors, +* always explicitly read from the start and discard +* any bytes that come before the requested offset. +* This way, no matter whether the adaptor supports it +* or not, we'll end up reading the proper data. +*/ struct i2c_msg msgs[] = { { .addr =DP_DUAL_MODE_SLAVE_ADDRESS , .flags =0 , .len =1 , - .buf = &offset, + .buf = &zero, }, { .addr =DP_DUAL_MODE_SLAVE_ADDRESS , .flags =I2C_M_RD , - .len = size, + .len = size + offset, .buf = buffer, }, };int ret; +if (offset) { + tmpbuf =kmalloc (size + offset,GFP_KERNEL ); +if (!tmpbuf) +return -ENOMEM ; + + msgs[1 ].buf = tmpbuf; + } + ret =i2c_transfer (adapter, msgs,ARRAY_SIZE (msgs)); +if (tmpbuf) +memcpy (buffer, tmpbuf + offset, size); + +kfree (tmpbuf); +if (ret <0 )return ret;if (ret !=ARRAY_SIZE (msgs))
@@ -208,18 +230,6 @@ enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(const struct drm_device *dev,if (ret)return DRM_DP_DUAL_MODE_UNKNOWN ; -/* -* Sigh. Some (maybe all?) type 1 adaptors are broken and ack -* the offset but ignore it, and instead they just always return -* data from the start of the HDMI ID buffer. So for a broken -* type 1 HDMI adaptor a single byte read will always give us -* 0x44, and for a type 1 DVI adaptor it should give 0x00 -* (assuming it implements any registers). Fortunately neither -* of those values will match the type 2 signature of the -* DP_DUAL_MODE_ADAPTOR_ID register so we can proceed with -* the type 2 adaptor detection safely even in the presence -* of broken type 1 adaptors. -*/ ret =drm_dp_dual_mode_read (adapter,DP_DUAL_MODE_ADAPTOR_ID , &adaptor_id,sizeof (adaptor_id));drm_dbg_kms (dev,"DP dual mode adaptor ID: %02x (err %zd)\n" , adaptor_id, ret);
@@ -233,11 +243,10 @@ enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(const struct drm_device *dev,return DRM_DP_DUAL_MODE_TYPE2_DVI ; }/* -* If neither a proper type 1 ID nor a broken type 1 adaptor -* as described above, assume type 1, but let the user know -* that we may have misdetected the type. +* If not a proper type 1 ID, still assume type 1, but let +* the user know that we may have misdetected the type. */ -if (!is_type1_adaptor (adaptor_id) && adaptor_id != hdmi_id[0 ]) +if (!is_type1_adaptor (adaptor_id))drm_err (dev,"Unexpected DP dual mode adaptor ID %02x\n" , adaptor_id); }
@@ -343,10 +352,8 @@ EXPORT_SYMBOL(drm_dp_dual_mode_get_tmds_output);* @enable: enable (as opposed to disable) the TMDS output buffers * * Set the state of the TMDS output buffers in the adaptor. For -* type2 this is set via the DP_DUAL_MODE_TMDS_OEN register. As -* some type 1 adaptors have problems with registers (see comments -* in drm_dp_dual_mode_detect()) we avoid touching the register, -* making this function a no-op on type 1 adaptors. +* type2 this is set via the DP_DUAL_MODE_TMDS_OEN register. +* Type1 adaptors do not support any register writes. * * Returns: * 0 on success, negative error code on failure
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 15/206 nvme: add a bogus subsystem NQN quirk for Micron MTFDKBA2T0TFH
In reply to Greg Kroah-HartmanFrom: Leo Savernik <[email protected]>
[ Upstream commit 41f38043f884c66af4114a7109cf540d6222f450 ]
The Micron MTFDKBA2T0TFH device reports the same subsysem NQN for all devices. Add a quick to ignore it.
Stable-dep-of: d5ceb4d1c507 ("nvme-pci: add NVME_QUIRK_BOGUS_NID for Micron Nitro")
--- drivers/nvme/host/pci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nvme/host/pci.c +2 -0
@@ -3351,6 +3351,8 @@ static const struct pci_device_id nvme_id_table[] = { { PCI_DEVICE(0x1cc1, 0x8201), /* ADATA SX8200PNP 512GB */ .driver_data =NVME_QUIRK_NO_DEEPEST_PS | NVME_QUIRK_IGNORE_DEV_SUBNQN, }, + { PCI_DEVICE(0x1344, 0x5407), /* Micron Technology Inc NVMe SSD */ + .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN }, { PCI_DEVICE(0x1c5c, 0x1504), /* SK Hynix PC400 */ .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, { PCI_DEVICE(0x15b7, 0x2001), /* Sandisk Skyhawk */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 16/206 nvme-pci: add NVME_QUIRK_BOGUS_NID for Micron Nitro
In reply to Greg Kroah-HartmanFrom: Bean Huo <[email protected]>
[ Upstream commit d5ceb4d1c50786d21de3d4b06c3f43109ec56dd8 ]
Added a quirk to fix Micron Nitro NVMe reporting duplicate NGUIDs.
--- drivers/nvme/host/pci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nvme/host/pci.c +2 -0
@@ -3353,6 +3353,8 @@ static const struct pci_device_id nvme_id_table[] = { NVME_QUIRK_IGNORE_DEV_SUBNQN, }, { PCI_DEVICE(0x1344, 0x5407), /* Micron Technology Inc NVMe SSD */ .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN }, + { PCI_DEVICE(0x1344, 0x6001), /* Micron Nitro NVMe */ + .driver_data = NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(0x1c5c, 0x1504), /* SK Hynix PC400 */ .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, { PCI_DEVICE(0x15b7, 0x2001), /* Sandisk Skyhawk */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 17/206 nvme-pci: disable namespace identifiers for the MAXIO MAP1001
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 70ce3455345d056b5fc427c3bb4a3ff4d126b6d5 ]
The MAXIO MAP1001 controllers reports completely bogus Namespace identifiers that even change after suspend cycles. Disable using the Identifiers entirely.
Stable-dep-of: 8d6e38f636ac ("nvme-pci: add NVME_QUIRK_BOGUS_NID for Netac NV7000")
--- drivers/nvme/host/pci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nvme/host/pci.c +2 -0
@@ -3365,6 +3365,8 @@ static const struct pci_device_id nvme_id_table[] = { .driver_data = NVME_QUIRK_NO_DEEPEST_PS, }, { PCI_DEVICE(0x2646, 0x2263), /* KINGSTON A2000 NVMe SSD */ .driver_data = NVME_QUIRK_NO_DEEPEST_PS, }, + { PCI_DEVICE(0x1e4B, 0x1001), /* MAXIO MAP1001 */ + .driver_data = NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(0x1e4B, 0x1002), /* MAXIO MAP1002 */ .driver_data = NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(0x1e4B, 0x1202), /* MAXIO MAP1202 */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 18/206 nvme-pci: disable write zeroes on various Kingston SSD
In reply to Greg Kroah-HartmanFrom: Xander Li <[email protected]>
[ Upstream commit ac9b57d4e1e3ecf0122e915bbba1bd4c90ec3031 ]
Kingston SSDs do support NVMe Write_Zeroes cmd but take long time to process. The firmware version is locked by these SSDs, we can not expect firmware improvement, so disable Write_Zeroes cmd.
Stable-dep-of: 8d6e38f636ac ("nvme-pci: add NVME_QUIRK_BOGUS_NID for Netac NV7000")
--- drivers/nvme/host/pci.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/nvme/host/pci.c +10 -0
@@ -3365,6 +3365,16 @@ static const struct pci_device_id nvme_id_table[] = { .driver_data = NVME_QUIRK_NO_DEEPEST_PS, }, { PCI_DEVICE(0x2646, 0x2263), /* KINGSTON A2000 NVMe SSD */ .driver_data = NVME_QUIRK_NO_DEEPEST_PS, }, + { PCI_DEVICE(0x2646, 0x5018), /* KINGSTON OM8SFP4xxxxP OS21012 NVMe SSD */ + .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, + { PCI_DEVICE(0x2646, 0x5016), /* KINGSTON OM3PGP4xxxxP OS21011 NVMe SSD */ + .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, + { PCI_DEVICE(0x2646, 0x501A), /* KINGSTON OM8PGP4xxxxP OS21005 NVMe SSD */ + .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, + { PCI_DEVICE(0x2646, 0x501B), /* KINGSTON OM8PGP4xxxxQ OS21005 NVMe SSD */ + .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, + { PCI_DEVICE(0x2646, 0x501E), /* KINGSTON OM3PGP4xxxxQ OS21011 NVMe SSD */ + .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, { PCI_DEVICE(0x1e4B, 0x1001), /* MAXIO MAP1001 */ .driver_data = NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(0x1e4B, 0x1002), /* MAXIO MAP1002 */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 19/206 nvme-pci: add NVME_QUIRK_BOGUS_NID for Netac NV7000
In reply to Greg Kroah-HartmanFrom: Tiago Dias Ferreira <[email protected]>
[ Upstream commit 8d6e38f636ac063e8062a21e7616f7d9bf0df5d8 ]
Added a quirk to fix the Netac NV7000 SSD reporting duplicate NGUIDs.
--- drivers/nvme/host/pci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nvme/host/pci.c +2 -0
@@ -3375,6 +3375,8 @@ static const struct pci_device_id nvme_id_table[] = { .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, { PCI_DEVICE(0x2646, 0x501E), /* KINGSTON OM3PGP4xxxxQ OS21011 NVMe SSD */ .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, + { PCI_DEVICE(0x1f40, 0x5236), /* Netac Technologies Co. NV7000 NVMe SSD */ + .driver_data = NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(0x1e4B, 0x1001), /* MAXIO MAP1001 */ .driver_data = NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(0x1e4B, 0x1002), /* MAXIO MAP1002 */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 20/206 speakup: Generate speakupmap.h automatically
In reply to Greg Kroah-HartmanFrom: Samuel Thibault <[email protected]>
[ Upstream commit 6646b95aab5f62c049f1416a3801dec5432c348b ]
speakupmap.h was not actually intended to be source code, speakupmap.map is.
This resurrects the makemapdata.c and genmap.c tools to generate speakupmap.h automatically from the input and speakup headers, and the speakupmap.map keyboard mapping source file.
Stable-dep-of: 92ca969ff881 ("speakup: replace utils' u_char with unsigned char")
--- drivers/accessibility/speakup/.gitignore | 4 + drivers/accessibility/speakup/Makefile | 28 ++++ drivers/accessibility/speakup/genmap.c | 162 ++++++++++++++++++++ drivers/accessibility/speakup/makemapdata.c | 125 +++++++++++++++ drivers/accessibility/speakup/speakupmap.h | 66 -------- drivers/accessibility/speakup/utils.h | 102 ++++++++++++ 6 files changed, 421 insertions(+), 66 deletions(-) create mode 100644 drivers/accessibility/speakup/.gitignore create mode 100644 drivers/accessibility/speakup/genmap.c create mode 100644 drivers/accessibility/speakup/makemapdata.c delete mode 100644 drivers/accessibility/speakup/speakupmap.h create mode 100644 drivers/accessibility/speakup/utils.h
drivers/accessibility/speakup/.gitignore new file +4 -0
@@ -0,0 +1,4 @@ +/makemapdata +/mapdata.h +/genmap +/speakupmap.h
drivers/accessibility/speakup/Makefile +28 -0
@@ -30,3 +30,31 @@ speakup-y := \ thread.o \ varhandlers.o speakup-$(CONFIG_SPEAKUP_SERIALIO) += serialio.o + + +clean-files := mapdata.h speakupmap.h + + +# Generate mapdata.h from headers +hostprogs += makemapdata +makemapdata-objs := makemapdata.o + +quiet_cmd_mkmap = MKMAP $@ + cmd_mkmap = TOPDIR=$(srctree) $(obj)/makemapdata > $@ + +$(obj)/mapdata.h: $(obj)/makemapdata + $(call cmd,mkmap) + + +# Generate speakupmap.h from mapdata.h +hostprogs += genmap +genmap-objs := genmap.o +$(obj)/genmap.o: $(obj)/mapdata.h + +quiet_cmd_genmap = GENMAP $@ + cmd_genmap = $(obj)/genmap $< > $@ + +$(obj)/speakupmap.h: $(src)/speakupmap.map $(obj)/genmap + $(call cmd,genmap) + +$(obj)/main.o: $(obj)/speakupmap.h
drivers/accessibility/speakup/genmap.c new file +162 -0
162 lines not on this page · raw message
drivers/accessibility/speakup/makemapdata.c new file +125 -0
125 lines not on this page · raw message
drivers/accessibility/speakup/speakupmap.h deleted +0 -66
66 lines not on this page · raw message
drivers/accessibility/speakup/utils.h new file +102 -0
102 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 21/206 speakup: replace utils u_char with unsigned char
In reply to Greg Kroah-HartmanFrom: Đoàn Trần Công Danh <[email protected]>
[ Upstream commit 92ca969ff8815f3feef2645199bd39bf594e5eeb ]
drivers/accessibility/speakup/utils.h will be used to compile host tool to generate metadata.
"u_char" is a non-standard type, which is defined to "unsigned char" on glibc but not defined by some libc, e.g. musl.
Let's replace "u_char" with "unsigned char"
--- drivers/accessibility/speakup/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accessibility/speakup/utils.h +1 -1
@@ -54,7 +54,7 @@ static inline int oops(const char *msg, const char *info)static inline struct st_key *hash_name (char *name) { -u_char *pn = (u_char *)name; +unsigned char *pn = (unsigned char *)name;int hash =0 ;while (*pn) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 22/206 iio: ms5611: Simplify IO callback parameters
In reply to Greg Kroah-HartmanFrom: Lars-Peter Clausen <[email protected]>
[ Upstream commit dc19fa63ad80a636fdbc1a02153d1ab140cb901f ]
The ms5611 passes &indio_dev->dev as a parameter to all its IO callbacks only to directly cast the struct device back to struct iio_dev. And the struct iio_dev is then only used to get the drivers state struct.
Simplify this a bit by passing the state struct directly. This makes it a bit easier to follow what the code is doing.
Stable-dep-of: 17f442e7e475 ("iio: pressure: ms5611: fixed value compensation bug")
--- drivers/iio/pressure/ms5611.h | 6 +++--- drivers/iio/pressure/ms5611_core.c | 7 +++---- drivers/iio/pressure/ms5611_i2c.c | 11 ++++------- drivers/iio/pressure/ms5611_spi.c | 17 +++++++---------- 4 files changed, 17 insertions(+), 24 deletions(-)
drivers/iio/pressure/ms5611.h +3 -3
@@ -50,9 +50,9 @@ struct ms5611_state {const struct ms5611_osr *pressure_osr;const struct ms5611_osr *temp_osr; -int (*reset)(struct device *dev); -int (*read_prom_word)(struct device *dev,int index,u16 *word); -int (*read_adc_temp_and_pressure)(struct device *dev, +int (*reset)(struct ms5611_state *st); +int (*read_prom_word)(struct ms5611_state *st,int index,u16 *word); +int (*read_adc_temp_and_pressure)(struct ms5611_state *st,s32 *temp,s32 *pressure);struct ms5611_chip_info *chip_info;
drivers/iio/pressure/ms5611_core.c +3 -4
@@ -85,8 +85,7 @@ static int ms5611_read_prom(struct iio_dev *indio_dev)struct ms5611_state *st =iio_priv (indio_dev);for (i =0 ; i <MS5611_PROM_WORDS_NB ; i++) { - ret = st->read_prom_word (&indio_dev->dev, - i, &st->chip_info->prom[i]); + ret = st->read_prom_word (st, i, &st->chip_info->prom[i]);if (ret <0 ) {dev_err (&indio_dev->dev,"failed to read prom at %d\n" , i);
@@ -108,7 +107,7 @@ static int ms5611_read_temp_and_pressure(struct iio_dev *indio_dev,int ret;struct ms5611_state *st =iio_priv (indio_dev); - ret = st->read_adc_temp_and_pressure (&indio_dev->dev, temp, pressure); + ret = st->read_adc_temp_and_pressure (st, temp, pressure);if (ret <0 ) {dev_err (&indio_dev->dev,"failed to read temperature and pressure\n" );
@@ -196,7 +195,7 @@ static int ms5611_reset(struct iio_dev *indio_dev)int ret;struct ms5611_state *st =iio_priv (indio_dev); - ret = st->reset (&indio_dev->dev); + ret = st->reset (st);if (ret <0 ) {dev_err (&indio_dev->dev,"failed to reset device\n" );return ret;
drivers/iio/pressure/ms5611_i2c.c +4 -7
@@ -20,17 +20,15 @@#include "ms5611.h" -static int ms5611_i2c_reset (struct device *dev) +static int ms5611_i2c_reset (struct ms5611_state *st) { -struct ms5611_state *st =iio_priv (dev_to_iio_dev (dev)); -return i2c_smbus_write_byte (st->client,MS5611_RESET ); } -static int ms5611_i2c_read_prom_word (struct device *dev,int index,u16 *word) +static int ms5611_i2c_read_prom_word (struct ms5611_state *st,int index, +u16 *word) {int ret; -struct ms5611_state *st =iio_priv (dev_to_iio_dev (dev)); ret =i2c_smbus_read_word_swapped (st->client,MS5611_READ_PROM_WORD + (index <<1 ));
@@ -57,11 +55,10 @@ static int ms5611_i2c_read_adc(struct ms5611_state *st, s32 *val)return 0 ; } -static int ms5611_i2c_read_adc_temp_and_pressure (struct device *dev, +static int ms5611_i2c_read_adc_temp_and_pressure (struct ms5611_state *st,s32 *temp,s32 *pressure) {int ret; -struct ms5611_state *st =iio_priv (dev_to_iio_dev (dev));const struct ms5611_osr *osr = st->temp_osr; ret =i2c_smbus_write_byte (st->client, osr->cmd);
drivers/iio/pressure/ms5611_spi.c +7 -10
@@ -15,18 +15,17 @@#include "ms5611.h" -static int ms5611_spi_reset (struct device *dev) +static int ms5611_spi_reset (struct ms5611_state *st) {u8 cmd =MS5611_RESET ; -struct ms5611_state *st =iio_priv (dev_to_iio_dev (dev));return spi_write_then_read (st->client, &cmd,1 ,NULL ,0 ); } -static int ms5611_spi_read_prom_word (struct device *dev,int index,u16 *word) +static int ms5611_spi_read_prom_word (struct ms5611_state *st,int index, +u16 *word) {int ret; -struct ms5611_state *st =iio_priv (dev_to_iio_dev (dev)); ret =spi_w8r16be (st->client,MS5611_READ_PROM_WORD + (index <<1 ));if (ret <0 )
@@ -37,11 +36,10 @@ static int ms5611_spi_read_prom_word(struct device *dev, int index, u16 *word)return 0 ; } -static int ms5611_spi_read_adc (struct device *dev,s32 *val) +static int ms5611_spi_read_adc (struct ms5611_state *st,s32 *val) {int ret;u8 buf[3 ] = {MS5611_READ_ADC }; -struct ms5611_state *st =iio_priv (dev_to_iio_dev (dev)); ret =spi_write_then_read (st->client, buf,1 , buf,3 );if (ret <0 )
@@ -52,11 +50,10 @@ static int ms5611_spi_read_adc(struct device *dev, s32 *val)return 0 ; } -static int ms5611_spi_read_adc_temp_and_pressure (struct device *dev, +static int ms5611_spi_read_adc_temp_and_pressure (struct ms5611_state *st,s32 *temp,s32 *pressure) {int ret; -struct ms5611_state *st =iio_priv (dev_to_iio_dev (dev));const struct ms5611_osr *osr = st->temp_osr;/*
@@ -68,7 +65,7 @@ static int ms5611_spi_read_adc_temp_and_pressure(struct device *dev,return ret;usleep_range (osr->conv_usec, osr->conv_usec + (osr->conv_usec /10UL )); - ret =ms5611_spi_read_adc (dev, temp); + ret =ms5611_spi_read_adc (st, temp);if (ret <0 )return ret;
@@ -78,7 +75,7 @@ static int ms5611_spi_read_adc_temp_and_pressure(struct device *dev,return ret;usleep_range (osr->conv_usec, osr->conv_usec + (osr->conv_usec /10UL )); -return ms5611_spi_read_adc (dev, pressure); +return ms5611_spi_read_adc (st, pressure); }static int ms5611_spi_probe (struct spi_device *spi)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 23/206 iio: pressure: ms5611: fixed value compensation bug
In reply to Greg Kroah-HartmanFrom: Mitja Spes <[email protected]>
[ Upstream commit 17f442e7e47579d3881fc4d47354eaef09302e6f ]
When using multiple instances of this driver the compensation PROM was overwritten by the last initialized sensor. Now each sensor has own PROM storage.
--- drivers/iio/pressure/ms5611.h | 12 +++---- drivers/iio/pressure/ms5611_core.c | 51 ++++++++++++++++-------------- 2 files changed, 31 insertions(+), 32 deletions(-)
drivers/iio/pressure/ms5611.h +4 -8
@@ -25,13 +25,6 @@ enum { MS5607, }; -struct ms5611_chip_info { -u16 prom[MS5611_PROM_WORDS_NB ]; - -int (*temp_and_pressure_compensate)(struct ms5611_chip_info *chip_info, -s32 *temp,s32 *pressure); -}; -/* * OverSampling Rate descriptor. * Warning: cmd MUST be kept aligned on a word boundary (see
@@ -50,12 +43,15 @@ struct ms5611_state {const struct ms5611_osr *pressure_osr;const struct ms5611_osr *temp_osr; +u16 prom[MS5611_PROM_WORDS_NB ]; +int (*reset)(struct ms5611_state *st);int (*read_prom_word)(struct ms5611_state *st,int index,u16 *word);int (*read_adc_temp_and_pressure)(struct ms5611_state *st,s32 *temp,s32 *pressure); -struct ms5611_chip_info *chip_info; +int (*compensate_temp_and_pressure)(struct ms5611_state *st,s32 *temp, +s32 *pressure);struct regulator *vdd; };
drivers/iio/pressure/ms5611_core.c +27 -24
101 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 24/206 ceph: do not update snapshot context when there is no new snapshot
In reply to Greg Kroah-HartmanFrom: Xiubo Li <[email protected]>
[ Upstream commit 2e586641c950e7f3e7e008404bd783a466b9b590 ]
We will only track the uppest parent snapshot realm from which we need to rebuild the snapshot contexts _downward_ in hierarchy. For all the others having no new snapshot we will do nothing.
This fix will avoid calling ceph_queue_cap_snap() on some inodes inappropriately. For example, with the code in mainline, suppose there are 2 directory hierarchies (with 6 directories total), like this:
/dir_X1/dir_X2/dir_X3/
/dir_Y1/dir_Y2/dir_Y3/
Firstly, make a snapshot under /dir_X1/dir_X2/.snap/snap_X2, then make a root snapshot under /.snap/root_snap. Every time we make snapshots under /dir_Y1/..., the kclient will always try to rebuild the snap context for snap_X2 realm and finally will always try to queue cap snaps for dir_Y2 and dir_Y3, which makes no sense.
That's because the snap_X2's seq is 2 and root_snap's seq is 3. So when creating a new snapshot under /dir_Y1/... the new seq will be 4, and the mds will send the kclient a snapshot backtrace in _downward_
order: seqs 4, 3.
When ceph_update_snap_trace() is called, it will always rebuild the from the last realm, that's the root_snap. So later when rebuilding the snap context, the current logic will always cause it to rebuild the snap_X2 realm and then try to queue cap snaps for all the inodes related in that realm, even though it's not necessary.
This is accompanied by a lot of these sorts of dout messages:
"ceph: queue_cap_snap 00000000a42b796b nothing dirty|writing"
Fix the logic to avoid this situation.
Also, the 'invalidate' word is not precise here. In actuality, it will cause a rebuild of the existing snapshot contexts or just build non-existent ones. Rename it to 'rebuild_snapcs'.
URL: https://tracker.ceph.com/issues/44100
Stable-dep-of: 51884d153f7e ("ceph: avoid putting the realm twice when decoding snaps fails")
--- fs/ceph/snap.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
fs/ceph/snap.c +19 -9
@@ -707,7 +707,8 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,__le64 *prior_parent_snaps;/* encoded */ struct ceph_snap_realm *realm =NULL ;struct ceph_snap_realm *first_realm =NULL ; -int invalidate =0 ; +struct ceph_snap_realm *realm_to_rebuild =NULL ; +int rebuild_snapcs;int err = -ENOMEM ;LIST_HEAD (dirty_realms);
@@ -715,6 +716,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,dout ("update_snap_trace deletion=%d\n" , deletion); more: + rebuild_snapcs =0 ;ceph_decode_need (&p, e,sizeof (*ri), bad); ri = p; p +=sizeof (*ri);
@@ -738,7 +740,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc, err =adjust_snap_realm_parent (mdsc, realm,le64_to_cpu (ri->parent));if (err <0 ) goto fail; - invalidate += err; + rebuild_snapcs += err;if (le64_to_cpu (ri->seq) > realm->seq) { dout("update_snap_trace updating %llx %p %lld -> %lld\n",
@@ -763,22 +765,30 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,if (realm->seq > mdsc->last_snap_seq) mdsc->last_snap_seq = realm->seq; - invalidate =1 ; + rebuild_snapcs =1 ; }else if (!realm->cached_context) {dout ("update_snap_trace %llx %p seq %lld new\n" , realm->ino, realm, realm->seq); - invalidate =1 ; + rebuild_snapcs =1 ; }else {dout ("update_snap_trace %llx %p seq %lld unchanged\n" , realm->ino, realm, realm->seq); } -dout ("done with %llx %p, invalidated=%d, %p %p\n" , realm->ino, - realm, invalidate, p, e); +dout ("done with %llx %p, rebuild_snapcs=%d, %p %p\n" , realm->ino, + realm, rebuild_snapcs, p, e); -/* invalidate when we reach the _end_ (root) of the trace */ -if (invalidate && p >= e) -rebuild_snap_realms (realm, &dirty_realms); +/* +* this will always track the uppest parent realm from which +* we need to rebuild the snapshot contexts _downward_ in +* hierarchy. +*/ +if (rebuild_snapcs) + realm_to_rebuild = realm; + +/* rebuild_snapcs when we reach the _end_ (root) of the trace */ +if (realm_to_rebuild && p >= e) +rebuild_snap_realms (realm_to_rebuild, &dirty_realms);if (!first_realm) first_realm = realm;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 25/206 ceph: avoid putting the realm twice when decoding snaps fails
In reply to Greg Kroah-HartmanFrom: Xiubo Li <[email protected]>
[ Upstream commit 51884d153f7ec85e18d607b2467820a90e0f4359 ]
When decoding the snaps fails it maybe leaving the 'first_realm' and 'realm' pointing to the same snaprealm memory. And then it'll put it twice and could cause random use-after-free, BUG_ON, etc issues.
--- fs/ceph/snap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ceph/snap.c +2 -1
@@ -705,7 +705,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,struct ceph_mds_snap_realm *ri;/* encoded */ __le64 *snaps;/* encoded */ __le64 *prior_parent_snaps;/* encoded */ -struct ceph_snap_realm *realm =NULL ; +struct ceph_snap_realm *realm;struct ceph_snap_realm *first_realm =NULL ;struct ceph_snap_realm *realm_to_rebuild =NULL ;int rebuild_snapcs;
@@ -716,6 +716,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,dout ("update_snap_trace deletion=%d\n" , deletion); more: + realm =NULL ; rebuild_snapcs =0 ;ceph_decode_need (&p, e,sizeof (*ri), bad); ri = p;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 26/206 x86/sgx: Create utility to validate user provided offset and length
In reply to Greg Kroah-HartmanFrom: Reinette Chatre <[email protected]>
[ Upstream commit dda03e2c331b9fc7bbc8fc0de12a6d92d8c18661 ]
User provided offset and length is validated when parsing the parameters of the SGX_IOC_ENCLAVE_ADD_PAGES ioctl(). Extract this validation (with consistent use of IS_ALIGNED) into a utility that can be used by the SGX2 ioctl()s that will also provide these values.
Stable-dep-of: f0861f49bd94 ("x86/sgx: Add overflow check in sgx_validate_offset_length()")
--- arch/x86/kernel/cpu/sgx/ioctl.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-)
arch/x86/kernel/cpu/sgx/ioctl.c +22 -6
@@ -372,6 +372,26 @@ static int sgx_encl_add_page(struct sgx_encl *encl, unsigned long src,return ret; } +/* +* Ensure user provided offset and length values are valid for +* an enclave. +*/ +static int sgx_validate_offset_length (struct sgx_encl *encl, +unsigned long offset, +unsigned long length) +{ +if (!IS_ALIGNED (offset,PAGE_SIZE )) +return -EINVAL ; + +if (!length || !IS_ALIGNED (length,PAGE_SIZE )) +return -EINVAL ; + +if (offset + length -PAGE_SIZE >= encl->size) +return -EINVAL ; + +return 0 ; +} +/** * sgx_ioc_enclave_add_pages() - The handler for %SGX_IOC_ENCLAVE_ADD_PAGES * @encl: an enclave pointer
@@ -425,14 +445,10 @@ static long sgx_ioc_enclave_add_pages(struct sgx_encl *encl, void __user *arg)if (copy_from_user (&add_arg, arg,sizeof (add_arg)))return -EFAULT ; -if (!IS_ALIGNED (add_arg.offset,PAGE_SIZE ) || - !IS_ALIGNED (add_arg.src,PAGE_SIZE )) -return -EINVAL ; - -if (!add_arg.length || add_arg.length & (PAGE_SIZE -1 )) +if (!IS_ALIGNED (add_arg.src,PAGE_SIZE ))return -EINVAL ; -if (add_arg.offset + add_arg.length -PAGE_SIZE >= encl->size) +if (sgx_validate_offset_length (encl, add_arg.offset, add_arg.length))return -EINVAL ; if (copy_from_user(&secinfo, (void __user *)add_arg.secinfo,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 27/206 x86/sgx: Add overflow check in sgx_validate_offset_length()
In reply to Greg Kroah-HartmanFrom: Borys Popławski <[email protected]>
[ Upstream commit f0861f49bd946ff94fce4f82509c45e167f63690 ]
sgx_validate_offset_length() function verifies "offset" and "length" arguments provided by userspace, but was missing an overflow check on their addition. Add it.
--- arch/x86/kernel/cpu/sgx/ioctl.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kernel/cpu/sgx/ioctl.c +3 -0
@@ -386,6 +386,9 @@ static int sgx_validate_offset_length(struct sgx_encl *encl,if (!length || !IS_ALIGNED (length,PAGE_SIZE ))return -EINVAL ; +if (offset + length < offset) +return -EINVAL ; +if (offset + length -PAGE_SIZE >= encl->size)return -EINVAL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 28/206 binder: validate alloc->mm in ->mmap() handler
In reply to Greg Kroah-HartmanFrom: Carlos Llamas <[email protected]>
[ Upstream commit 3ce00bb7e91cf57d723905371507af57182c37ef ]
Since commit 1da52815d5f1 ("binder: fix alloc->vma_vm_mm null-ptr dereference") binder caches a pointer to the current->mm during open(). This fixes a null-ptr dereference reported by syzkaller. Unfortunately, it also opens the door for a process to update its mm after the open(), (e.g. via execve) making the cached alloc->mm pointer invalid.
Things get worse when the process continues to mmap() a vma. From this point forward, binder will attempt to find this vma using an obsolete alloc->mm reference. Such as in binder_update_page_range(), where the wrong vma is obtained via vma_lookup(), yet binder proceeds to happily insert new pages into it.
To avoid this issue fail the ->mmap() callback if we detect a mismatch between the vma->vm_mm and the original alloc->mm pointer. This prevents alloc->vm_addr from getting set, so that any subsequent vma_lookup() calls fail as expected.
--- drivers/android/binder_alloc.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/android/binder_alloc.c +7 -0
@@ -753,6 +753,12 @@ int binder_alloc_mmap_handler(struct binder_alloc *alloc,const char *failure_string;struct binder_buffer *buffer; +if (unlikely (vma->vm_mm != alloc->vma_vm_mm)) { + ret = -EINVAL ; + failure_string ="invalid vma->vm_mm" ; + goto err_invalid_mm; + } +mutex_lock (&binder_alloc_mmap_lock);if (alloc->buffer_size) { ret = -EBUSY ;
@@ -799,6 +805,7 @@ int binder_alloc_mmap_handler(struct binder_alloc *alloc, alloc->buffer_size =0 ; err_already_mapped:mutex_unlock (&binder_alloc_mmap_lock); +err_invalid_mm: binder_alloc_debug(BINDER_DEBUG_USER_ERROR, "%s: %d %lx-%lx %s failed %d\n", __func__, alloc->pid, vma->vm_start, vma->vm_end,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 29/206 ceph: Use kcalloc for allocating multiple elements
In reply to Greg Kroah-HartmanFrom: Kenneth Lee <[email protected]>
[ Upstream commit aa1d627207cace003163dee24d1c06fa4e910c6b ]
Prefer using kcalloc(a, b) over kzalloc(a * b) as this improves semantics since kcalloc is intended for allocating an array of memory.
Stable-dep-of: 5bd76b8de5b7 ("ceph: fix NULL pointer dereference for req->r_session")
--- fs/ceph/caps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/caps.c +1 -1
@@ -2255,7 +2255,7 @@ static int unsafe_request_wait(struct inode *inode)struct ceph_mds_request *req;int i; - sessions =kzalloc (max_sessions *sizeof (s),GFP_KERNEL ); + sessions =kcalloc (max_sessions,sizeof (s),GFP_KERNEL );if (!sessions) { err = -ENOMEM ; goto out;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 30/206 ceph: fix NULL pointer dereference for req->r_session
In reply to Greg Kroah-HartmanFrom: Xiubo Li <[email protected]>
[ Upstream commit 5bd76b8de5b74fa941a6eafee87728a0fe072267 ]
The request's r_session maybe changed when it was forwarded or resent. Both the forwarding and resending cases the requests will be protected by the mdsc->mutex.
--- fs/ceph/caps.c | 48 ++++++++++++------------------------------------ 1 file changed, 12 insertions(+), 36 deletions(-)
fs/ceph/caps.c +12 -36
@@ -2217,7 +2217,6 @@ static int unsafe_request_wait(struct inode *inode)struct ceph_mds_client *mdsc =ceph_sb_to_client (inode->i_sb)->mdsc;struct ceph_inode_info *ci =ceph_inode (inode);struct ceph_mds_request *req1 =NULL , *req2 =NULL ; -unsigned int max_sessions;int ret, err =0 ;spin_lock (&ci->i_unsafe_lock);
@@ -2235,28 +2234,24 @@ static int unsafe_request_wait(struct inode *inode) }spin_unlock (&ci->i_unsafe_lock); -/* -* The mdsc->max_sessions is unlikely to be changed -* mostly, here we will retry it by reallocating the -* sessions array memory to get rid of the mdsc->mutex -* lock. -*/ -retry: - max_sessions = mdsc->max_sessions; -/* * Trigger to flush the journal logs in all the relevant MDSes * manually, or in the worst case we must wait at most 5 seconds * to wait the journal logs to be flushed by the MDSes periodically. */ -if ((req1 || req2) &&likely (max_sessions)) { -struct ceph_mds_session **sessions =NULL ; -struct ceph_mds_session *s; +if (req1 || req2) {struct ceph_mds_request *req; +struct ceph_mds_session **sessions; +struct ceph_mds_session *s; +unsigned int max_sessions;int i; +mutex_lock (&mdsc->mutex); + max_sessions = mdsc->max_sessions; + sessions =kcalloc (max_sessions,sizeof (s),GFP_KERNEL );if (!sessions) { +mutex_unlock (&mdsc->mutex); err = -ENOMEM ; goto out; }
@@ -2268,16 +2263,6 @@ static int unsafe_request_wait(struct inode *inode) s = req->r_session;if (!s)continue ; -if (unlikely (s->s_mds >= max_sessions)) { -spin_unlock (&ci->i_unsafe_lock); -for (i =0 ; i < max_sessions; i++) { - s = sessions[i]; -if (s) -ceph_put_mds_session (s); - } -kfree (sessions); - goto retry; - }if (!sessions[s->s_mds]) { s =ceph_get_mds_session (s); sessions[s->s_mds] = s;
@@ -2290,16 +2275,6 @@ static int unsafe_request_wait(struct inode *inode) s = req->r_session;if (!s)continue ; -if (unlikely (s->s_mds >= max_sessions)) { -spin_unlock (&ci->i_unsafe_lock); -for (i =0 ; i < max_sessions; i++) { - s = sessions[i]; -if (s) -ceph_put_mds_session (s); - } -kfree (sessions); - goto retry; - }if (!sessions[s->s_mds]) { s =ceph_get_mds_session (s); sessions[s->s_mds] = s;
@@ -2311,11 +2286,12 @@ static int unsafe_request_wait(struct inode *inode)/* the auth MDS */ spin_lock (&ci->i_ceph_lock);if (ci->i_auth_cap) { - s = ci->i_auth_cap->session; -if (!sessions[s->s_mds]) - sessions[s->s_mds] =ceph_get_mds_session (s); + s = ci->i_auth_cap->session; +if (!sessions[s->s_mds]) + sessions[s->s_mds] =ceph_get_mds_session (s); }spin_unlock (&ci->i_ceph_lock); +mutex_unlock (&mdsc->mutex);/* send flush mdlog request to MDSes */ for (i =0 ; i < max_sessions; i++) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 31/206 wifi: mac80211: fix memory free error when registering wiphy fail
In reply to Greg Kroah-HartmanFrom: taozhang <[email protected]>
[ Upstream commit 50b2e8711462409cd368c41067405aa446dfa2af ]
ieee80211_register_hw free the allocated cipher suites when registering wiphy fail, and ieee80211_free_hw will re-free it.
set wiphy_ciphers_allocated to false after freeing allocated cipher suites.
--- net/mac80211/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/mac80211/main.c +6 -2
@@ -1357,8 +1357,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)ieee80211_led_exit (local);destroy_workqueue (local->workqueue); fail_workqueue: -if (local->wiphy_ciphers_allocated) +if (local->wiphy_ciphers_allocated) {kfree (local->hw.wiphy->cipher_suites); + local->wiphy_ciphers_allocated = false; + }kfree (local->int_scan_req);return result; }
@@ -1426,8 +1428,10 @@ void ieee80211_free_hw(struct ieee80211_hw *hw)mutex_destroy (&local->iflist_mtx);mutex_destroy (&local->mtx); -if (local->wiphy_ciphers_allocated) +if (local->wiphy_ciphers_allocated) {kfree (local->hw.wiphy->cipher_suites); + local->wiphy_ciphers_allocated = false; + }idr_for_each (&local->ack_status_frames, ieee80211_free_ack_frame,NULL );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 32/206 wifi: mac80211_hwsim: fix debugfs attribute ps with rc table support
In reply to Greg Kroah-HartmanFrom: Jonas Jelonek <[email protected]>
[ Upstream commit 69188df5f6e4cecc6b76b958979ba363cd5240e8 ]
Fixes a warning that occurs when rc table support is enabled (IEEE80211_HW_SUPPORTS_RC_TABLE) in mac80211_hwsim and the PS mode is changed via the exported debugfs attribute.
When the PS mode is changed, a packet is broadcasted via hwsim_send_nullfunc by creating and transmitting a plain skb with only header initialized. The ieee80211 rate array in the control buffer is zero-initialized. When ratetbl support is enabled, ieee80211_get_tx_rates is called for the skb with sta parameter set to NULL and thus no ratetbl can be used. The final rate array then looks like [-1,0; 0,0; 0,0; 0,0] which causes the warning in ieee80211_get_tx_rate.
The issue is fixed by setting the count of the first rate with idx '0' to 1 and hence ieee80211_get_tx_rates won't overwrite it with idx '-1'.
--- drivers/net/wireless/mac80211_hwsim.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/mac80211_hwsim.c +5 -0
@@ -845,6 +845,7 @@ static void hwsim_send_nullfunc(struct mac80211_hwsim_data *data, u8 *mac,struct hwsim_vif_priv *vp = (void *)vif->drv_priv;struct sk_buff *skb;struct ieee80211_hdr *hdr; +struct ieee80211_tx_info *cb;if (!vp->assoc)return ;
@@ -866,6 +867,10 @@ static void hwsim_send_nullfunc(struct mac80211_hwsim_data *data, u8 *mac,memcpy (hdr->addr2, mac,ETH_ALEN );memcpy (hdr->addr3, vp->bssid,ETH_ALEN ); + cb =IEEE80211_SKB_CB (skb); + cb->control.rates[0 ].count =1 ; + cb->control.rates[1 ].idx =-1 ; +rcu_read_lock ();mac80211_hwsim_tx_frame (data->hw, skb,rcu_dereference (vif->chanctx_conf)->def.chan);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 33/206 riscv: dts: sifive unleashed: Add PWM controlled LEDs
In reply to Greg Kroah-HartmanFrom: Emil Renner Berthing <[email protected]>
[ Upstream commit 8bc8824d30193eb7755043d5bb65fa7f0d11a595 ]
This adds the 4 PWM controlled green LEDs to the HiFive Unleashed device tree. The schematic doesn't specify any special function for the LEDs, so they're added here without any default triggers and named d1, d2, d3 and d4 just like in the schematic.
--- .../boot/dts/sifive/hifive-unleashed-a00.dts | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+)
arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts +38 -0
@@ -3,6 +3,8 @@ #include "fu540-c000.dtsi" #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/leds/common.h> +#include <dt-bindings/pwm/pwm.h> /* Clock frequency (in Hz) of the PCB crystal for rtcclk */ #define RTCCLK_FREQ 1000000
@@ -46,6 +48,42 @@ gpio-restart { compatible = "gpio-restart"; gpios = <&gpio 10 GPIO_ACTIVE_LOW>; }; + + led-controller { + compatible = "pwm-leds"; + + led-d1 { + pwms = <&pwm0 0 7812500 PWM_POLARITY_INVERTED>; + active-low; + color = <LED_COLOR_ID_GREEN>; + max-brightness = <255>; + label = "d1"; + }; + + led-d2 { + pwms = <&pwm0 1 7812500 PWM_POLARITY_INVERTED>; + active-low; + color = <LED_COLOR_ID_GREEN>; + max-brightness = <255>; + label = "d2"; + }; + + led-d3 { + pwms = <&pwm0 2 7812500 PWM_POLARITY_INVERTED>; + active-low; + color = <LED_COLOR_ID_GREEN>; + max-brightness = <255>; + label = "d3"; + }; + + led-d4 { + pwms = <&pwm0 3 7812500 PWM_POLARITY_INVERTED>; + active-low; + color = <LED_COLOR_ID_GREEN>; + max-brightness = <255>; + label = "d4"; + }; + }; }; &uart0 {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 34/206 audit: fix undefined behavior in bit shift for AUDIT_BIT
In reply to Greg Kroah-HartmanFrom: Gaosheng Cui <[email protected]>
[ Upstream commit 986d93f55bdeab1cac858d1e47b41fac10b2d7f6 ]
Shifting signed 32-bit value by 31 bits is undefined, so changing significant bit to unsigned. The UBSAN warning calltrace like below:
UBSAN: shift-out-of-bounds in kernel/auditfilter.c:179:23 left shift of 1 by 31 places cannot be represented in type 'int' Call Trace: <TASK> dump_stack_lvl+0x7d/0xa5 dump_stack+0x15/0x1b ubsan_epilogue+0xe/0x4e __ubsan_handle_shift_out_of_bounds+0x1e7/0x20c audit_register_class+0x9d/0x137 audit_classes_init+0x4d/0xb8 do_one_initcall+0x76/0x430 kernel_init_freeable+0x3b3/0x422 kernel_init+0x24/0x1e0 ret_from_fork+0x1f/0x30 </TASK>
--- include/uapi/linux/audit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/audit.h +1 -1
@@ -182,7 +182,7 @@#define AUDIT_MAX_KEY_LEN 256#define AUDIT_BITMASK_SIZE 64#define AUDIT_WORD (nr) ((__u32)((nr)/32)) -#define AUDIT_BIT (nr) (1 << ((nr) - AUDIT_WORD(nr)*32)) +#define AUDIT_BIT (nr) (1U << ((nr) - AUDIT_WORD(nr)*32))#define AUDIT_SYSCALL_CLASSES 16#define AUDIT_CLASS_DIR_WRITE 0
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 35/206 wifi: airo: do not assign -1 to unsigned char
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
[ Upstream commit e6cb8769452e8236b52134e5cb4a18b8f5986932 ]
With char becoming unsigned by default, and with char alone being ambiguous and based on architecture, we get a warning when assigning the unchecked output of hex_to_bin() to that unsigned char. Mark key as a u8, which matches the struct's type, and then check each call to hex_to_bin() before casting.
--- drivers/net/wireless/cisco/airo.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/net/wireless/cisco/airo.c +14 -4
@@ -5233,7 +5233,7 @@ static int get_wep_tx_idx(struct airo_info *ai)return -1 ; } -static int set_wep_key (struct airo_info *ai,u16 index,const char *key, +static int set_wep_key (struct airo_info *ai,u16 index,const u8 *key,u16 keylen,int perm,int lock) {static const unsigned char macaddr[ETH_ALEN ] = {0x01 ,0 ,0 ,0 ,0 ,0 };
@@ -5284,7 +5284,7 @@ static void proc_wepkey_on_close(struct inode *inode, struct file *file)struct net_device *dev =PDE_DATA (inode);struct airo_info *ai = dev->ml_priv;int i, rc; -char key[16 ]; +u8 key[16 ];u16 index =0 ;int j =0 ;
@@ -5312,12 +5312,22 @@ static void proc_wepkey_on_close(struct inode *inode, struct file *file) }for (i =0 ; i <16 *3 && data->wbuffer[i+j]; i++) { +int val; + +if (i %3 ==2 ) +continue ; + + val =hex_to_bin (data->wbuffer[i+j]); +if (val <0 ) { +airo_print_err (ai->dev->name,"WebKey passed invalid key hex" ); +return ; + }switch (i%3 ) {case 0 : - key[i/3 ] =hex_to_bin (data->wbuffer[i+j])<<4 ; + key[i/3 ] = (u8 )val <<4 ;break ;case 1 : - key[i/3 ] |=hex_to_bin (data->wbuffer[i+j]); + key[i/3 ] |= (u8 )val;break ; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 36/206 wifi: mac80211: Fix ack frame idr leak when mesh has no route
In reply to Greg Kroah-HartmanFrom: Nicolas Cavallari <[email protected]>
[ Upstream commit 39e7b5de9853bd92ddbfa4b14165babacd7da0ba ]
When trying to transmit an data frame with tx_status to a destination that have no route in the mesh, then it is dropped without recrediting the ack_status_frames idr.
Once it is exhausted, wpa_supplicant starts failing to do SAE with NL80211_CMD_FRAME and logs "nl80211: Frame command failed".
Use ieee80211_free_txskb() instead of kfree_skb() to fix it.
--- net/mac80211/mesh_pathtbl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/mesh_pathtbl.c +1 -1
@@ -710,7 +710,7 @@ int mesh_path_send_to_gates(struct mesh_path *mpath)void mesh_path_discard_frame (struct ieee80211_sub_if_data *sdata,struct sk_buff *skb) { -kfree_skb (skb); +ieee80211_free_txskb (&sdata->local->hw, skb); sdata->u.mesh.mshstats.dropped_frames_no_route++; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 37/206 wifi: ath11k: Fix QCN9074 firmware boot on x86
In reply to Greg Kroah-HartmanFrom: Tyler J. Stachecki <[email protected]>
[ Upstream commit 3a89b6dec9920026eaa90fe8457f4348d3388a98 ]
The 2.7.0 series of QCN9074's firmware requests 5 segments of memory instead of 3 (as in the 2.5.0 series).
The first segment (11M) is too large to be kalloc'd in one go on x86 and requires piecemeal 1MB allocations, as was the case with the prior public firmware (2.5.0, 15M).
Since f6f92968e1e5, ath11k will break the memory requests, but only if there were fewer than 3 segments requested by the firmware. It seems that 5 segments works fine and allows QCN9074 to boot on x86 with firmware 2.7.0, so change things accordingly.
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.16
--- drivers/net/wireless/ath/ath11k/qmi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/qmi.h +1 -1
@@ -27,7 +27,7 @@#define ATH11K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01 52#define ATH11K_QMI_CALDB_SIZE 0x480000#define ATH11K_QMI_BDF_EXT_STR_LENGTH 0x20 -#define ATH11K_QMI_FW_MEM_REQ_SEGMENT_CNT 3 +#define ATH11K_QMI_FW_MEM_REQ_SEGMENT_CNT 5#define QMI_WLFW_REQUEST_MEM_IND_V01 0x0035#define QMI_WLFW_FW_MEM_READY_IND_V01 0x0037
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 38/206 spi: stm32: fix stm32_spi_prepare_mbr() that halves spi clk for every run
In reply to Greg Kroah-HartmanFrom: Sean Nyekjaer <[email protected]>
[ Upstream commit 62aa1a344b0904549f6de7af958e8a1136fd5228 ]
When this driver is used with a driver that uses preallocated spi_transfer structs. The speed_hz is halved by every run. This results in:
spi_stm32 44004000.spi: SPI transfer setup failed
ads7846 spi0.0: SPI transfer failed: -22
Example when running with DIV_ROUND_UP():
- First run; speed_hz = 1000000, spi->clk_rate 125000000
div 125 -> mbrdiv = 7, cur_speed = 976562
- Second run; speed_hz = 976562
div 128,00007 (roundup to 129) -> mbrdiv = 8, cur_speed = 488281
- Third run; speed_hz = 488281
div 256,000131072067109 (roundup to 257) and then -EINVAL is returned.
Use DIV_ROUND_CLOSEST to allow to round down and allow us to keep the set speed.
--- drivers/spi/spi-stm32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-stm32.c +1 -1
@@ -434,7 +434,7 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz,u32 div, mbrdiv;/* Ensure spi->clk_rate is even */ - div =DIV_ROUND_UP (spi->clk_rate & ~0x1 , speed_hz); + div =DIV_ROUND_CLOSEST (spi->clk_rate & ~0x1 , speed_hz);/* * SPI framework set xfer->speed_hz to master->max_speed_hz if
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 39/206 selftests/bpf: Add verifier test for release_reference()
In reply to Greg Kroah-HartmanFrom: Youlin Li <[email protected]>
[ Upstream commit 475244f5e06beeda7b557d9dde46a5f439bf3379 ]
Add a test case to ensure that released pointer registers will not be leaked into the map.
Before fix:
./test_verifier 984
984/u reference tracking: try to leak released ptr reg FAIL Unexpected success to load!
verification time 67 usec
stack depth 4
processed 23 insns (limit 1000000) max_states_per_insn 0 total_states 2 peak_states 2 mark_read 1
984/p reference tracking: try to leak released ptr reg OK
Summary: 1 PASSED, 0 SKIPPED, 1 FAILED
After fix:
./test_verifier 984
984/u reference tracking: try to leak released ptr reg OK 984/p reference tracking: try to leak released ptr reg OK
Summary: 2 PASSED, 0 SKIPPED, 0 FAILED
--- .../selftests/bpf/verifier/ref_tracking.c | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+)
tools/testing/selftests/bpf/verifier/ref_tracking.c +36 -0
@@ -905,3 +905,39 @@ .result_unpriv = REJECT, .errstr_unpriv = "unknown func", }, +{ + "reference tracking: try to leak released ptr reg", + .insns = { +BPF_MOV64_IMM (BPF_REG_0 ,0 ), +BPF_STX_MEM (BPF_W ,BPF_REG_10 ,BPF_REG_0 ,-4 ), +BPF_MOV64_REG (BPF_REG_2 ,BPF_REG_10 ), +BPF_ALU64_IMM (BPF_ADD ,BPF_REG_2 ,-4 ), +BPF_LD_MAP_FD (BPF_REG_1 ,0 ), +BPF_EMIT_CALL (BPF_FUNC_map_lookup_elem), +BPF_JMP_IMM (BPF_JNE ,BPF_REG_0 ,0 ,1 ), +BPF_EXIT_INSN (), +BPF_MOV64_REG (BPF_REG_9 ,BPF_REG_0 ), + +BPF_MOV64_IMM (BPF_REG_0 ,0 ), +BPF_LD_MAP_FD (BPF_REG_1 ,0 ), +BPF_MOV64_IMM (BPF_REG_2 ,8 ), +BPF_MOV64_IMM (BPF_REG_3 ,0 ), +BPF_EMIT_CALL (BPF_FUNC_ringbuf_reserve), +BPF_JMP_IMM (BPF_JNE ,BPF_REG_0 ,0 ,1 ), +BPF_EXIT_INSN (), +BPF_MOV64_REG (BPF_REG_8 ,BPF_REG_0 ), + +BPF_MOV64_REG (BPF_REG_1 ,BPF_REG_8 ), +BPF_MOV64_IMM (BPF_REG_2 ,0 ), +BPF_EMIT_CALL (BPF_FUNC_ringbuf_discard), +BPF_MOV64_IMM (BPF_REG_0 ,0 ), + +BPF_STX_MEM (BPF_DW ,BPF_REG_9 ,BPF_REG_8 ,0 ), +BPF_EXIT_INSN () + }, + .fixup_map_array_48b = { 4 }, + .fixup_map_ringbuf = { 11 }, + .result = ACCEPT, + .result_unpriv = REJECT, + .errstr_unpriv = "R8 !read_ok" +},
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 40/206 Revert "net: macsec: report real_dev features when HW offloading is enabled"
In reply to Greg Kroah-HartmanFrom: Sabrina Dubroca <[email protected]>
[ Upstream commit 8bcd560ae8784da57c610d857118c5d6576b1a8f ]
This reverts commit c850240b6c4132574a00f2da439277ab94265b66.
That commit tried to improve the performance of macsec offload by taking advantage of some of the NIC's features, but in doing so, broke macsec offload when the lower device supports both macsec and ipsec offload, as the ipsec offload feature flags (mainly NETIF_F_HW_ESP) were copied from the real device. Since the macsec device doesn't provide xdo_* ops, the XFRM core rejects the registration of the new macsec device in xfrm_api_check.
Example perf trace when running
ip link add link eni1np1 type macsec port 4 offload mac
ip 737 [003] 795.477676: probe:xfrm_dev_event__REGISTER name="macsec0" features=0x1c000080014869
xfrm_dev_event+0x3a
notifier_call_chain+0x47
register_netdevice+0x846
macsec_newlink+0x25a
ip 737 [003] 795.477687: probe:xfrm_dev_event__return ret=0x8002 (NOTIFY_BAD)
notifier_call_chain+0x47
register_netdevice+0x846
macsec_newlink+0x25adev->features includes NETIF_F_HW_ESP (0x04000000000000), so xfrm_api_check returns NOTIFY_BAD because we don't have dev->xfrmdev_ops on the macsec device.
We could probably propagate GSO and a few other features from the lower device, similar to macvlan. This will be done in a future patch.
--- drivers/net/macsec.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-)
drivers/net/macsec.c +4 -23
@@ -2644,11 +2644,6 @@ static int macsec_upd_offload(struct sk_buff *skb, struct genl_info *info)if (ret) goto rollback; -/* Force features update, since they are different for SW MACSec and -* HW offloading cases. -*/ -netdev_update_features (dev); -rtnl_unlock ();return 0 ;
@@ -3416,16 +3411,9 @@ static netdev_tx_t macsec_start_xmit(struct sk_buff *skb,return ret; } -#define SW_MACSEC_FEATURES \ +#define MACSEC_FEATURES \ (NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST) -/* If h/w offloading is enabled, use real device features save for -* VLAN_FEATURES - they require additional ops -* HW_MACSEC - no reason to report it -*/ -#define REAL_DEV_FEATURES (dev) \ - ((dev)->features & ~(NETIF_F_VLAN_FEATURES | NETIF_F_HW_MACSEC)) -static int macsec_dev_init (struct net_device *dev) {struct macsec_dev *macsec =macsec_priv (dev);
@@ -3442,12 +3430,8 @@ static int macsec_dev_init(struct net_device *dev)return err; } -if (macsec_is_offloaded (macsec)) { - dev->features =REAL_DEV_FEATURES (real_dev); - }else { - dev->features = real_dev->features &SW_MACSEC_FEATURES ; - dev->features |=NETIF_F_LLTX |NETIF_F_GSO_SOFTWARE ; - } + dev->features = real_dev->features &MACSEC_FEATURES ; + dev->features |=NETIF_F_LLTX |NETIF_F_GSO_SOFTWARE ; dev->needed_headroom = real_dev->needed_headroom +MACSEC_NEEDED_HEADROOM ;
@@ -3476,10 +3460,7 @@ static netdev_features_t macsec_fix_features(struct net_device *dev,struct macsec_dev *macsec =macsec_priv (dev);struct net_device *real_dev = macsec->real_dev; -if (macsec_is_offloaded (macsec)) -return REAL_DEV_FEATURES (real_dev); - - features &= (real_dev->features &SW_MACSEC_FEATURES ) | + features &= (real_dev->features &MACSEC_FEATURES ) |NETIF_F_GSO_SOFTWARE |NETIF_F_SOFT_FEATURES ; features |=NETIF_F_LLTX ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 41/206 platform/x86: ideapad-laptop: Disable touchpad_switch
In reply to Greg Kroah-HartmanFrom: Manyi Li <[email protected]>
[ Upstream commit a231224a601c1924b9df620281ad04472900d75f ]
Ideapads for "Lenovo Yoga 3 Pro 1370" and "ZhaoYang K4e-IML" do not use EC to switch touchpad.
Reading VPCCMD_R_TOUCHPAD will return zero thus touchpad may be blocked unexpectedly.
--- drivers/platform/x86/ideapad-laptop.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/platform/x86/ideapad-laptop.c +24 -1
@@ -1499,6 +1499,24 @@ static const struct dmi_system_id hw_rfkill_list[] = { {} }; +static const struct dmi_system_id no_touchpad_switch_list[] = { + { + .ident ="Lenovo Yoga 3 Pro 1370" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), +DMI_MATCH (DMI_PRODUCT_VERSION ,"Lenovo YOGA 3" ), + }, + }, + { + .ident ="ZhaoYang K4e-IML" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), +DMI_MATCH (DMI_PRODUCT_VERSION ,"ZhaoYang K4e-IML" ), + }, + }, + {} +}; +static void ideapad_check_features (struct ideapad_private *priv) {acpi_handle handle = priv->adev->handle;
@@ -1507,7 +1525,12 @@ static void ideapad_check_features(struct ideapad_private *priv) priv->features.hw_rfkill_switch =dmi_check_system (hw_rfkill_list);/* Most ideapads with ELAN0634 touchpad don't use EC touchpad switch */ - priv->features.touchpad_ctrl_via_ec = !acpi_dev_present ("ELAN0634" ,NULL ,-1 ); +if (acpi_dev_present ("ELAN0634" ,NULL ,-1 )) + priv->features.touchpad_ctrl_via_ec =0 ; +else if (dmi_check_system (no_touchpad_switch_list)) + priv->features.touchpad_ctrl_via_ec =0 ; +else + priv->features.touchpad_ctrl_via_ec =1 ;if (!read_ec_data (handle,VPCCMD_R_FAN , &val)) priv->features.fan_mode = true;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 42/206 platform/x86: touchscreen_dmi: Add info for the RCA Cambio W101 v2 2-in-1
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 0df044b34bf33e7e35c32b3bf6747fde6279c162 ]
Add touchscreen info for the RCA Cambio W101 v2 2-in-1.
--- drivers/platform/x86/touchscreen_dmi.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/platform/x86/touchscreen_dmi.c +25 -0
@@ -773,6 +773,22 @@ static const struct ts_dmi_data predia_basic_data = { .properties = predia_basic_props, }; +static const struct property_entry rca_cambio_w101_v2_props[] = { +PROPERTY_ENTRY_U32 ("touchscreen-min-x" ,4 ), +PROPERTY_ENTRY_U32 ("touchscreen-min-y" ,20 ), +PROPERTY_ENTRY_U32 ("touchscreen-size-x" ,1644 ), +PROPERTY_ENTRY_U32 ("touchscreen-size-y" ,874 ), +PROPERTY_ENTRY_BOOL ("touchscreen-swapped-x-y" ), +PROPERTY_ENTRY_STRING ("firmware-name" ,"gsl1680-rca-cambio-w101-v2.fw" ), +PROPERTY_ENTRY_U32 ("silead,max-fingers" ,10 ), + { } +}; + +static const struct ts_dmi_data rca_cambio_w101_v2_data = { + .acpi_name ="MSSL1680:00" , + .properties = rca_cambio_w101_v2_props, +}; +static const struct property_entry rwc_nanote_p8_props[] = {PROPERTY_ENTRY_U32 ("touchscreen-min-y" ,46 ),PROPERTY_ENTRY_U32 ("touchscreen-size-x" ,1728 ),
@@ -1394,6 +1410,15 @@ const struct dmi_system_id touchscreen_dmi_table[] = { DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"), }, }, + { +/* RCA Cambio W101 v2 */ +/* https://github.com/onitake/gsl-firmware/discussions/193 */ + .driver_data = (void *)&rca_cambio_w101_v2_data, + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"RCA" ), + DMI_MATCH(DMI_PRODUCT_NAME, "W101SA23T1"), + }, + }, {/* RWC NANOTE P8 */ .driver_data = (void *)&rwc_nanote_p8_data,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 43/206 platform/x86/intel/pmt: Sapphire Rapids PMT errata fix
In reply to Greg Kroah-HartmanFrom: David E. Box <[email protected]>
[ Upstream commit bcdfa1f77ea7f67368d20384932a9d1e3047ddd2 ]
On Sapphire Rapids, due to a hardware issue affecting the PUNIT telemetry region, reads that are not done in QWORD quantities and alignment may return incorrect data. Use a custom 64-bit copy for this region.
--- drivers/platform/x86/intel/pmt/class.c | 31 +++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-)
drivers/platform/x86/intel/pmt/class.c +30 -1
@@ -9,6 +9,7 @@*/ #include <linux/kernel.h> +#include <linux/io-64-nonatomic-lo-hi.h> #include <linux/module.h> #include <linux/mm.h> #include <linux/pci.h>
@@ -18,6 +19,7 @@#define PMT_XA_START 0#define PMT_XA_MAX INT_MAX#define PMT_XA_LIMIT XA_LIMIT(PMT_XA_START, PMT_XA_MAX) +#define GUID_SPR_PUNIT 0x9956f43f/* * Early implementations of PMT on client platforms have some
@@ -41,6 +43,29 @@ bool intel_pmt_is_early_client_hw(struct device *dev) }EXPORT_SYMBOL_GPL (intel_pmt_is_early_client_hw); +static inline int +pmt_memcpy64_fromio (void *to,const u64 __iomem *from,size_t count) +{ +int i, remain; +u64 *buf = to; + +if (!IS_ALIGNED ((unsigned long )from,8 )) +return -EFAULT ; + +for (i =0 ; i < count/8 ; i++) + buf[i] =readq (&from[i]); + +/* Copy any remaining bytes */ + remain = count %8 ; +if (remain) { +u64 tmp =readq (&from[i]); + +memcpy (&buf[i], &tmp, remain); + } + +return count; +} +/* * sysfs */
@@ -62,7 +87,11 @@ intel_pmt_read(struct file *filp, struct kobject *kobj,if (count > entry->size - off) count = entry->size - off; -memcpy_fromio (buf, entry->base + off, count); +if (entry->guid ==GUID_SPR_PUNIT ) +/* PUNIT on SPR only supports aligned 64-bit read */ + count =pmt_memcpy64_fromio (buf, entry->base + off, count); +else +memcpy_fromio (buf, entry->base + off, count);return count; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 44/206 platform/x86/intel/hid: Add some ACPI device IDs
In reply to Greg Kroah-HartmanFrom: Ivan Hu <[email protected]>
[ Upstream commit a977ece5773b6746b814aac410da4776023db239 ]
Add INTC1076 (JasonLake), INTC1077 (MeteorLake) and INTC1078 (RaptorLake) devices IDs.
--- drivers/platform/x86/intel/hid.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/platform/x86/intel/hid.c +3 -0
@@ -27,6 +27,9 @@ static const struct acpi_device_id intel_hid_ids[] = { {"INTC1051", 0}, {"INTC1054", 0}, {"INTC1070", 0}, + {"INTC1076", 0}, + {"INTC1077", 0}, + {"INTC1078", 0}, {"", 0}, };MODULE_DEVICE_TABLE (acpi, intel_hid_ids);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 45/206 scsi: ibmvfc: Avoid path failures during live migration
In reply to Greg Kroah-HartmanFrom: Brian King <[email protected]>
[ Upstream commit 62fa3ce05d5d73c5eccc40b2db493f55fecfc446 ]
Fix an issue reported when performing a live migration when multipath is configured with a short fast fail timeout of 5 seconds and also to have no_path_retry set to fail. In this scenario, all paths would go into the devloss state while the ibmvfc driver went through discovery to log back in. On a loaded system, the discovery might take longer than 5 seconds, which was resulting in all paths being marked failed, which then resulted in a read only filesystem.
This patch changes the migration code in ibmvfc to avoid deleting rports at all in this scenario, so we avoid losing all paths.
--- drivers/scsi/ibmvscsi/ibmvfc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/scsi/ibmvscsi/ibmvfc.c +11 -3
@@ -708,8 +708,13 @@ static void ibmvfc_init_host(struct ibmvfc_host *vhost)memset (vhost->async_crq.msgs.async,0 ,PAGE_SIZE ); vhost->async_crq.cur =0 ; -list_for_each_entry (tgt, &vhost->targets, queue) -ibmvfc_del_tgt (tgt); +list_for_each_entry (tgt, &vhost->targets, queue) { +if (vhost->client_migrated) + tgt->need_login =1 ; +else +ibmvfc_del_tgt (tgt); + } +scsi_block_requests (vhost->host);ibmvfc_set_host_action (vhost,IBMVFC_HOST_ACTION_INIT ); vhost->job_step = ibmvfc_npiv_login;
@@ -3235,9 +3240,12 @@ static void ibmvfc_handle_crq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost,/* We need to re-setup the interpartition connection */ dev_info (vhost->dev,"Partition migrated, Re-enabling adapter\n" ); vhost->client_migrated =1 ; + +scsi_block_requests (vhost->host);ibmvfc_purge_requests (vhost,DID_REQUEUE ); -ibmvfc_link_down (vhost,IBMVFC_LINK_DOWN ); +ibmvfc_set_host_state (vhost,IBMVFC_LINK_DOWN );ibmvfc_set_host_action (vhost,IBMVFC_HOST_ACTION_REENABLE ); +wake_up (&vhost->work_wait_q); }else if (crq->format ==IBMVFC_PARTNER_FAILED || crq->format ==IBMVFC_PARTNER_DEREGISTER ) {dev_err (vhost->dev,"Host partner adapter deregistered or failed (rc=%d)\n" , crq->format);ibmvfc_purge_requests (vhost,DID_ERROR );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 46/206 scsi: scsi_debug: Make the READ CAPACITY response compliant with ZBC
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit ecb8c2580d37dbb641451049376d80c8afaa387f ]
Quoted 1 line
From ZBC-1:
- RC BASIS = 0: The RETURNED LOGICAL BLOCK ADDRESS field indicates the highest LBA of a contiguous range of zones that are not sequential write required zones starting with the first zone.
- RC BASIS = 1: The RETURNED LOGICAL BLOCK ADDRESS field indicates the LBA of the last logical block on the logical unit.
The current scsi_debug READ CAPACITY response does not comply with the above if there are one or more sequential write required zones. SCSI initiators need a way to retrieve the largest valid LBA from SCSI devices. Reporting the largest valid LBA if there are one or more sequential zones requires to set the RC BASIS field in the READ CAPACITY response to one. Hence this patch.
--- drivers/scsi/scsi_debug.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/scsi/scsi_debug.c +7 -0
@@ -1879,6 +1879,13 @@ static int resp_readcap16(struct scsi_cmnd *scp, arr[14 ] |=0x40 ; } +/* +* Since the scsi_debug READ CAPACITY implementation always reports the +* total disk capacity, set RC BASIS = 1 for host-managed ZBC devices. +*/ +if (devip->zmodel ==BLK_ZONED_HM ) + arr[12 ] |=1 <<4 ; + arr[15 ] = sdebug_lowest_aligned &0xff ;if (have_dif_prot) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 47/206 drm: panel-orientation-quirks: Add quirk for Acer Switch V 10 (SW5-017)
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 653f2d94fcda200b02bd79cea2e0307b26c1b747 ]
Like the Acer Switch One 10 S1003, for which there already is a quirk, the Acer Switch V 10 (SW5-017) has a 800x1280 portrait screen mounted in the tablet part of a landscape oriented 2-in-1. Add a quirk for this.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -128,6 +128,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"), }, .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* Acer Switch V 10 (SW5-017) */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"Acer" ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "SW5-017"), + }, + .driver_data = (void *)&lcd800x1280_rightside_up, }, { /* Anbernic Win600 */ .matches = { DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Anbernic"),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 48/206 block, bfq: fix null pointer dereference in bfq_bio_bfqg()
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit f02be9002c480cd3ec0fcf184ad27cf531bd6ece ]
Out test found a following problem in kernel 5.10, and the same problem should exist in mainline:
BUG: kernel NULL pointer dereference, address: 0000000000000094 PGD 0 P4D 0 Oops: 0000 [#1] SMP CPU: 7 PID: 155 Comm: kworker/7:1 Not tainted 5.10.0-01932-g19e0ace2ca1d-dirty 4 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_073836-b4 Workqueue: kthrotld blk_throtl_dispatch_work_fn RIP: 0010:bfq_bio_bfqg+0x52/0xc0 Code: 94 00 00 00 00 75 2e 48 8b 40 30 48 83 05 35 06 c8 0b 01 48 85 c0 74 3d 4b RSP: 0018:ffffc90001a1fba0 EFLAGS: 00010002 RAX: ffff888100d60400 RBX: ffff8881132e7000 RCX: 0000000000000000 RDX: 0000000000000017 RSI: ffff888103580a18 RDI: ffff888103580a18 RBP: ffff8881132e7000 R08: 0000000000000000 R09: ffffc90001a1fe10 R10: 0000000000000a20 R11: 0000000000034320 R12: 0000000000000000 R13: ffff888103580a18 R14: ffff888114447000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff88881fdc0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000094 CR3: 0000000100cdb000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: bfq_bic_update_cgroup+0x3c/0x350 ? ioc_create_icq+0x42/0x270 bfq_init_rq+0xfd/0x1060 bfq_insert_requests+0x20f/0x1cc0 ? ioc_create_icq+0x122/0x270 blk_mq_sched_insert_requests+0x86/0x1d0 blk_mq_flush_plug_list+0x193/0x2a0 blk_flush_plug_list+0x127/0x170 blk_finish_plug+0x31/0x50 blk_throtl_dispatch_work_fn+0x151/0x190 process_one_work+0x27c/0x5f0 worker_thread+0x28b/0x6b0 ? rescuer_thread+0x590/0x590 kthread+0x153/0x1b0 ? kthread_flush_work+0x170/0x170 ret_from_fork+0x1f/0x30 Modules linked in: CR2: 0000000000000094 ---[ end trace e2e59ac014314547 ]--- RIP: 0010:bfq_bio_bfqg+0x52/0xc0 Code: 94 00 00 00 00 75 2e 48 8b 40 30 48 83 05 35 06 c8 0b 01 48 85 c0 74 3d 4b RSP: 0018:ffffc90001a1fba0 EFLAGS: 00010002 RAX: ffff888100d60400 RBX: ffff8881132e7000 RCX: 0000000000000000 RDX: 0000000000000017 RSI: ffff888103580a18 RDI: ffff888103580a18 RBP: ffff8881132e7000 R08: 0000000000000000 R09: ffffc90001a1fe10 R10: 0000000000000a20 R11: 0000000000034320 R12: 0000000000000000 R13: ffff888103580a18 R14: ffff888114447000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff88881fdc0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000094 CR3: 0000000100cdb000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Root cause is quite complex:
1) use bfq elevator for the test device.
2) create a cgroup CG
3) config blk throtl in CG
blkg_conf_prep
blkg_create
4) create a thread T1 and issue async io in CG:
bio_init
bio_associate_blkg
...
submit_bio
submit_bio_noacct
blk_throtl_bio -> io is throttled
// io submit is done5) switch elevator:
bfq_exit_queue
blkcg_deactivate_policy
list_for_each_entry(blkg, &q->blkg_list, q_node)
blkg->pd[] = NULL
// bfq policy is removed5) thread t1 exist, then remove the cgroup CG:
blkcg_unpin_online
blkcg_destroy_blkgs
blkg_destroy
list_del_init(&blkg->q_node)
// blkg is removed from queue list6) switch elevator back to bfq
bfq_init_queue
bfq_create_group_hierarchy
blkcg_activate_policy
list_for_each_entry_reverse(blkg, &q->blkg_list)
// blkg is removed from list, hence bfq policy is still NULL7) throttled io is dispatched to bfq:
bfq_insert_requests
bfq_init_rq
bfq_bic_update_cgroup
bfq_bio_bfqg
bfqg = blkg_to_bfqg(blkg)
// bfqg is NULL because bfq policy is NULL
The problem is only possible in bfq because only bfq can be deactivated and activated while queue is online, while others can only be deactivated while the device is removed.
Fix the problem in bfq by checking if blkg is online before calling blkg_to_bfqg().
--- block/bfq-cgroup.c | 4 ++++ 1 file changed, 4 insertions(+)
block/bfq-cgroup.c +4 -0
@@ -613,6 +613,10 @@ struct bfq_group *bfq_bio_bfqg(struct bfq_data *bfqd, struct bio *bio)struct bfq_group *bfqg;while (blkg) { +if (!blkg->online) { + blkg = blkg->parent; +continue ; + } bfqg =blkg_to_bfqg (blkg);if (bfqg->online) {bio_associate_blkg_from_css (bio, &blkg->blkcg->css);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 49/206 arm64/syscall: Include asm/ptrace.h in syscall_wrapper header.
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit acfc35cfcee5df419391671ef1a631f43feee4e3 ]
Add the same change for ARM64 as done in the commit 9440c4294160 ("x86/syscall: Include asm/ptrace.h in syscall_wrapper header") to make sure all syscalls see 'struct pt_regs' definition and resulted BTF for '__arm64_sys_*(struct pt_regs *regs)' functions point to actual struct.
Without this patch, the BPF verifier refuses to load a tracing prog which accesses pt_regs.
bpf(BPF_PROG_LOAD, {prog_type=0x1a, ...}, 128) = -1 EACCES
With this patch, we can see the correct error, which saves us time in debugging the prog.
bpf(BPF_PROG_LOAD, {prog_type=0x1a, ...}, 128) = 4 bpf(BPF_RAW_TRACEPOINT_OPEN, {raw_tracepoint={name=NULL, prog_fd=4}}, 128) = -1 ENOTSUPP
--- arch/arm64/include/asm/syscall_wrapper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/include/asm/syscall_wrapper.h +1 -1
@@ -8,7 +8,7 @@#ifndef __ASM_SYSCALL_WRAPPER_H#define __ASM_SYSCALL_WRAPPER_H -struct pt_regs ; +#include <asm/ptrace.h> #define SC_ARM64_REGS_TO_ARGS (x, ...) \ __MAP(x,__SC_ARGS \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 50/206 nvmet: fix memory leak in nvmet_subsys_attr_model_store_locked
In reply to Greg Kroah-HartmanFrom: Aleksandr Miloserdov <[email protected]>
[ Upstream commit becc4cac309dc867571f0080fde4426a6c2222e0 ]
Since model_number is allocated before it needs to be freed before kmemdump_nul.
--- drivers/nvme/target/configfs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/nvme/target/configfs.c +5 -2
@@ -1189,6 +1189,7 @@ static ssize_t nvmet_subsys_attr_model_store_locked(struct nvmet_subsys *subsys, const char *page, size_t count) { int pos = 0, len; +char *val;if (subsys->subsys_discovered) { pr_err("Can't set model number. %s is already assigned\n",
@@ -1211,9 +1212,11 @@ static ssize_t nvmet_subsys_attr_model_store_locked(struct nvmet_subsys *subsys,return -EINVAL ; } - subsys->model_number =kmemdup_nul (page, len,GFP_KERNEL ); -if (!subsys->model_number) + val =kmemdup_nul (page, len,GFP_KERNEL ); +if (!val)return -ENOMEM ; +kfree (subsys->model_number); + subsys->model_number = val;return count; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 51/206 Revert "drm/amdgpu: Revert "drm/amdgpu: getting fan speed pwm for vega10 properly""
In reply to Greg Kroah-HartmanFrom: Asher Song <[email protected]>
[ Upstream commit 30b8e7b8ee3be003e0df85c857c5cd0e0bd58b82 ]
This reverts commit 4545ae2ed3f2f7c3f615a53399c9c8460ee5bca7.
The origin patch "drm/amdgpu: getting fan speed pwm for vega10 properly" works fine. Test failure is caused by test case self.
--- .../amd/pm/powerplay/hwmgr/vega10_thermal.c | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.c +12 -13
@@ -67,22 +67,21 @@ int vega10_fan_ctrl_get_fan_speed_info(struct pp_hwmgr *hwmgr,int vega10_fan_ctrl_get_fan_speed_pwm (struct pp_hwmgr *hwmgr,uint32_t *speed) { -uint32_t current_rpm; -uint32_t percent =0 ; - -if (hwmgr->thermal_controller.fanInfo.bNoFan) -return 0 ; +struct amdgpu_device *adev = hwmgr->adev; +uint32_t duty100, duty; +uint64_t tmp64; -if (vega10_get_current_rpm (hwmgr, ¤t_rpm)) -return -1 ; + duty100 =REG_GET_FIELD (RREG32_SOC15 (THM ,0 , mmCG_FDO_CTRL1), +CG_FDO_CTRL1 ,FMAX_DUTY100 ); + duty =REG_GET_FIELD (RREG32_SOC15 (THM ,0 , mmCG_THERMAL_STATUS), +CG_THERMAL_STATUS ,FDO_PWM_DUTY ); -if (hwmgr->thermal_controller. - advanceFanControlParameters.usMaxFanRPM !=0 ) - percent = current_rpm *255 / - hwmgr->thermal_controller. - advanceFanControlParameters.usMaxFanRPM; +if (!duty100) +return -EINVAL ; - *speed =MIN (percent,255 ); + tmp64 = (uint64_t )duty *255 ; +do_div (tmp64, duty100); + *speed =MIN ((uint32_t )tmp64,255 );return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 52/206 ALSA: usb-audio: add quirk to fix Hamedal C20 disconnect issue
In reply to Greg Kroah-HartmanFrom: Ai Chao <[email protected]>
[ Upstream commit bf990c10231937c0f51e5da5558e08cf5adc6a78 ]
For Hamedal C20, the current rate is different from the runtime rate, snd_usb_endpoint stop and close endpoint to resetting rate. if snd_usb_endpoint close the endpoint, sometimes usb will disconnect the device.
--- sound/usb/endpoint.c | 3 ++- sound/usb/quirks.c | 2 ++ sound/usb/usbaudio.h | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-)
sound/usb/endpoint.c +2 -1
@@ -887,7 +887,8 @@ void snd_usb_endpoint_close(struct snd_usb_audio *chip,usb_audio_dbg (chip,"Closing EP 0x%x (count %d)\n" , ep->ep_num, ep->opened); -if (!--ep->iface_ref->opened) +if (!--ep->iface_ref->opened && + !(chip->quirk_flags &QUIRK_FLAG_IFACE_SKIP_CLOSE ))endpoint_set_interface (chip, ep, false);if (!--ep->opened) {
sound/usb/quirks.c +2 -0
@@ -1884,6 +1884,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_GENERIC_IMPLICIT_FB),DEVICE_FLG (0x2b53 ,0x0031 ,/* Fiero SC-01 (firmware v1.1.0) */ QUIRK_FLAG_GENERIC_IMPLICIT_FB ), +DEVICE_FLG (0x0525 ,0xa4ad ,/* Hamedal C20 usb camero */ +QUIRK_FLAG_IFACE_SKIP_CLOSE ),/* Vendor matches */ VENDOR_FLG(0x045e, /* MS Lifecam */
sound/usb/usbaudio.h +3 -0
@@ -169,6 +169,8 @@ extern bool snd_usb_skip_validation;* Apply the generic implicit feedback sync mode (same as implicit_fb=1 option) * QUIRK_FLAG_SKIP_IMPLICIT_FB * Don't apply implicit feedback sync mode +* QUIRK_FLAG_IFACE_SKIP_CLOSE +* Don't closed interface during setting sample rate */ #define QUIRK_FLAG_GET_SAMPLE_RATE (1U << 0)
@@ -190,5 +192,6 @@ extern bool snd_usb_skip_validation;#define QUIRK_FLAG_SET_IFACE_FIRST (1U << 16)#define QUIRK_FLAG_GENERIC_IMPLICIT_FB (1U << 17)#define QUIRK_FLAG_SKIP_IMPLICIT_FB (1U << 18) +#define QUIRK_FLAG_IFACE_SKIP_CLOSE (1U << 19)#endif /* __USBAUDIO_H */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 53/206 RISC-V: vdso: Do not add missing symbols to version section in linker script
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit fcae44fd36d052e956e69a64642fc03820968d78 ]
Recently, ld.lld moved from '--undefined-version' to '--no-undefined-version' as the default, which breaks the compat vDSO build:
ld.lld: error: version script assignment of 'LINUX_4.15' to symbol '__vdso_gettimeofday' failed: symbol not defined ld.lld: error: version script assignment of 'LINUX_4.15' to symbol '__vdso_clock_gettime' failed: symbol not defined ld.lld: error: version script assignment of 'LINUX_4.15' to symbol '__vdso_clock_getres' failed: symbol not defined
These symbols are not present in the compat vDSO or the regular vDSO for 32-bit but they are unconditionally included in the version section of the linker script, which is prohibited with '--no-undefined-version'.
Fix this issue by only including the symbols that are actually exported in the version section of the linker script.
--- arch/riscv/kernel/vdso/Makefile | 3 +++ arch/riscv/kernel/vdso/vdso.lds.S | 2 ++ 2 files changed, 5 insertions(+)
arch/riscv/kernel/vdso/Makefile +3 -0
@@ -28,6 +28,9 @@ obj-vdso := $(addprefix $(obj)/, $(obj-vdso)) obj-y += vdso.o CPPFLAGS_vdso.lds += -P -C -U$(ARCH) +ifneq ($(filter vgettimeofday, $(vdso-syms)),) +CPPFLAGS_vdso.lds += -DHAS_VGETTIMEOFDAY +endif # Disable -pg to prevent insert call site CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE)
arch/riscv/kernel/vdso/vdso.lds.S +2 -0
@@ -65,9 +65,11 @@ VERSION LINUX_4.15 { global: __vdso_rt_sigreturn; +#ifdef HAS_VGETTIMEOFDAY __vdso_gettimeofday; __vdso_clock_gettime; __vdso_clock_getres; +#endif __vdso_getcpu; __vdso_flush_icache; local: *;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 54/206 MIPS: pic32: treat port as signed integer
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
[ Upstream commit 648060902aa302331b5d6e4f26d8ee0761d239ab ]
get_port_from_cmdline() returns an int, yet is assigned to a char, which is wrong in its own right, but also, with char becoming unsigned, this poses problems, because -1 is used as an error value. Further complicating things, fw_init_early_console() is only ever called with a -1 argument. Fix this up by removing the unused argument from fw_init_early_console() and treating port as a proper signed integer.
--- arch/mips/include/asm/fw/fw.h | 2 +- arch/mips/pic32/pic32mzda/early_console.c | 13 ++++++------- arch/mips/pic32/pic32mzda/init.c | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-)
arch/mips/include/asm/fw/fw.h +1 -1
@@ -26,6 +26,6 @@ extern char *fw_getcmdline(void);extern void fw_meminit (void );extern char *fw_getenv (char *name);extern unsigned long fw_getenvl (char *name); -extern void fw_init_early_console (char port); +extern void fw_init_early_console (void );#endif /* __ASM_FW_H_ */
arch/mips/pic32/pic32mzda/early_console.c +6 -7
@@ -27,7 +27,7 @@#define U_BRG (x) (UART_BASE(x) + 0x40)static void __iomem *uart_base; -static char console_port =-1 ; +static int console_port =-1 ;static int __init configure_uart_pins (int port) {
@@ -47,7 +47,7 @@ static int __init configure_uart_pins(int port)return 0 ; } -static void __init configure_uart (char port,int baud) +static void __init configure_uart (int port,int baud) {u32 pbclk;
@@ -60,7 +60,7 @@ static void __init configure_uart(char port, int baud) uart_base + PIC32_SET(U_STA(port))); } -static void __init setup_early_console (char port,int baud) +static void __init setup_early_console (int port,int baud) {if (configure_uart_pins (port))return ;
@@ -130,16 +130,15 @@ static int __init get_baud_from_cmdline(char *arch_cmdline)return baud; } -void __init fw_init_early_console (char port) +void __init fw_init_early_console (void ) {char *arch_cmdline =pic32_getcmdline (); -int baud =-1 ; +int baud, port; uart_base =ioremap (PIC32_BASE_UART ,0xc00 ); baud =get_baud_from_cmdline (arch_cmdline); -if (port ==-1 ) - port =get_port_from_cmdline (arch_cmdline); + port =get_port_from_cmdline (arch_cmdline);if (port ==-1 ) port =EARLY_CONSOLE_PORT ;
arch/mips/pic32/pic32mzda/init.c +1 -1
@@ -47,7 +47,7 @@ void __init plat_mem_setup(void)strlcpy (arcs_cmdline, boot_command_line,COMMAND_LINE_SIZE );#ifdef CONFIG_EARLY_PRINTK -fw_init_early_console (-1 ); +fw_init_early_console ();#endif pic32_config_init (); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 55/206 xfrm: fix "disable_policy" on ipv4 early demux
In reply to Greg Kroah-HartmanFrom: Eyal Birger <[email protected]>
[ Upstream commit 3a5913183aa1b14148c723bda030e6102ad73008 ]
The commit in the "Fixes" tag tried to avoid a case where policy check is ignored due to dst caching in next hops.
However, when the traffic is locally consumed, the dst may be cached in a local TCP or UDP socket as part of early demux. In this case the "disable_policy" flag is not checked as ip_route_input_noref() was only called before caching, and thus, packets after the initial packet in a flow will be dropped if not matching policies.
Fix by checking the "disable_policy" flag also when a valid dst is already available.
----
v2: use dev instead of skb->dev
--- net/ipv4/ip_input.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ipv4/ip_input.c +5 -0
@@ -364,6 +364,11 @@ static int ip_rcv_finish_core(struct net *net, struct sock *sk, iph->tos, dev);if (unlikely (err)) goto drop_error; + }else { +struct in_device *in_dev =__in_dev_get_rcu (dev); + +if (in_dev &&IN_DEV_ORCONF (in_dev,NOPOLICY )) +IPCB (skb)->flags |=IPSKB_NOPOLICY ; }#ifdef CONFIG_IP_ROUTE_CLASSID
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 56/206 xfrm: replay: Fix ESN wrap around for GSO
In reply to Greg Kroah-HartmanFrom: Christian Langrock <[email protected]>
[ Upstream commit 4b549ccce941798703f159b227aa28c716aa78fa ]
When using GSO it can happen that the wrong seq_hi is used for the last packets before the wrap around. This can lead to double usage of a sequence number. To avoid this, we should serialize this last GSO packet.
--- net/ipv4/esp4_offload.c | 3 +++ net/ipv6/esp6_offload.c | 3 +++ net/xfrm/xfrm_device.c | 15 ++++++++++++++- net/xfrm/xfrm_replay.c | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-)
net/ipv4/esp4_offload.c +3 -0
@@ -311,6 +311,9 @@ static int esp_xmit(struct xfrm_state *x, struct sk_buff *skb, netdev_features_ xo->seq.low +=skb_shinfo (skb)->gso_segs; } +if (xo->seq.low < seq) + xo->seq.hi++; + esp.seqno =cpu_to_be64 (seq + ((u64 )xo->seq.hi <<32 ));ip_hdr (skb)->tot_len =htons (skb->len);
net/ipv6/esp6_offload.c +3 -0
@@ -343,6 +343,9 @@ static int esp6_xmit(struct xfrm_state *x, struct sk_buff *skb, netdev_features xo->seq.low +=skb_shinfo (skb)->gso_segs; } +if (xo->seq.low < seq) + xo->seq.hi++; + esp.seqno =cpu_to_be64 (xo->seq.low + ((u64 )xo->seq.hi <<32 )); len = skb->len -sizeof (struct ipv6hdr );
net/xfrm/xfrm_device.c +14 -1
@@ -97,6 +97,18 @@ static void xfrm_outer_mode_prep(struct xfrm_state *x, struct sk_buff *skb) } } +static inline bool xmit_xfrm_check_overflow (struct sk_buff *skb) +{ +struct xfrm_offload *xo =xfrm_offload (skb); +__u32 seq = xo->seq.low; + + seq +=skb_shinfo (skb)->gso_segs; +if (unlikely (seq < xo->seq.low)) +return true; + +return false; +} +struct sk_buff *validate_xmit_xfrm (struct sk_buff *skb,netdev_features_t features,bool *again) {int err;
@@ -134,7 +146,8 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featurreturn skb; } -if (skb_is_gso (skb) &&unlikely (x->xso.dev != dev)) { +if (skb_is_gso (skb) && (unlikely (x->xso.dev != dev) || +unlikely (xmit_xfrm_check_overflow (skb)))) {struct sk_buff *segs;/* Packet got rerouted, fixup features and segment it. */
net/xfrm/xfrm_replay.c +1 -1
@@ -714,7 +714,7 @@ static int xfrm_replay_overflow_offload_esn(struct xfrm_state *x, struct sk_buff oseq +=skb_shinfo (skb)->gso_segs; } -if (unlikely (oseq < replay_esn->oseq)) { +if (unlikely (xo->seq.low < replay_esn->oseq)) {XFRM_SKB_CB (skb)->seq.output.hi = ++oseq_hi; xo->seq.hi = oseq_hi; replay_esn->oseq_hi = oseq_hi;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 57/206 af_key: Fix send_acquire race with pfkey_register
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
[ Upstream commit 7f57f8165cb6d2c206e2b9ada53b9e2d6d8af42f ]
The function pfkey_send_acquire may race with pfkey_register (which could even be in a different name space). This may result in a buffer overrun.
Allocating the maximum amount of memory that could be used prevents this.
--- net/key/af_key.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-)
net/key/af_key.c +22 -10
@@ -2905,7 +2905,7 @@ static int count_ah_combs(const struct xfrm_tmpl *t)break ;if (!aalg->pfkey_supported)continue ; -if (aalg_tmpl_set (t, aalg) && aalg->available) +if (aalg_tmpl_set (t, aalg)) sz +=sizeof (struct sadb_comb ); }return sz +sizeof (struct sadb_prop );
@@ -2923,7 +2923,7 @@ static int count_esp_combs(const struct xfrm_tmpl *t)if (!ealg->pfkey_supported)continue ; -if (!(ealg_tmpl_set (t, ealg) && ealg->available)) +if (!(ealg_tmpl_set (t, ealg)))continue ;for (k =1 ; ; k++) {
@@ -2934,16 +2934,17 @@ static int count_esp_combs(const struct xfrm_tmpl *t)if (!aalg->pfkey_supported)continue ; -if (aalg_tmpl_set (t, aalg) && aalg->available) +if (aalg_tmpl_set (t, aalg)) sz +=sizeof (struct sadb_comb ); } }return sz +sizeof (struct sadb_prop ); } -static void dump_ah_combs (struct sk_buff *skb,const struct xfrm_tmpl *t) +static int dump_ah_combs (struct sk_buff *skb,const struct xfrm_tmpl *t) {struct sadb_prop *p; +int sz =0 ;int i; p =skb_put (skb,sizeof (struct sadb_prop ));
@@ -2971,13 +2972,17 @@ static void dump_ah_combs(struct sk_buff *skb, const struct xfrm_tmpl *t) c->sadb_comb_soft_addtime =20 *60 *60 ; c->sadb_comb_hard_usetime =8 *60 *60 ; c->sadb_comb_soft_usetime =7 *60 *60 ; + sz +=sizeof (*c); } } + +return sz +sizeof (*p); } -static void dump_esp_combs (struct sk_buff *skb,const struct xfrm_tmpl *t) +static int dump_esp_combs (struct sk_buff *skb,const struct xfrm_tmpl *t) {struct sadb_prop *p; +int sz =0 ;int i, k; p =skb_put (skb,sizeof (struct sadb_prop ));
@@ -3019,8 +3024,11 @@ static void dump_esp_combs(struct sk_buff *skb, const struct xfrm_tmpl *t) c->sadb_comb_soft_addtime =20 *60 *60 ; c->sadb_comb_hard_usetime =8 *60 *60 ; c->sadb_comb_soft_usetime =7 *60 *60 ; + sz +=sizeof (*c); } } + +return sz +sizeof (*p); }static int key_notify_policy_expire (struct xfrm_policy *xp,const struct km_event *c)
@@ -3150,6 +3158,7 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, structstruct sadb_x_sec_ctx *sec_ctx;struct xfrm_sec_ctx *xfrm_ctx;int ctx_size =0 ; +int alg_size =0 ; sockaddr_size =pfkey_sockaddr_size (x->props.family);if (!sockaddr_size)
@@ -3161,16 +3170,16 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, structsizeof (struct sadb_x_policy );if (x->id.proto ==IPPROTO_AH ) - size +=count_ah_combs (t); + alg_size =count_ah_combs (t);else if (x->id.proto ==IPPROTO_ESP ) - size +=count_esp_combs (t); + alg_size =count_esp_combs (t);if ((xfrm_ctx = x->security)) { ctx_size =PFKEY_ALIGN8 (xfrm_ctx->ctx_len); size +=sizeof (struct sadb_x_sec_ctx ) + ctx_size; } - skb =alloc_skb (size +16 ,GFP_ATOMIC ); + skb =alloc_skb (size + alg_size +16 ,GFP_ATOMIC );if (skb ==NULL )return -ENOMEM ;
@@ -3224,10 +3233,13 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct pol->sadb_x_policy_priority = xp->priority;/* Set sadb_comb's. */ + alg_size =0 ;if (x->id.proto ==IPPROTO_AH ) -dump_ah_combs (skb, t); + alg_size =dump_ah_combs (skb, t);else if (x->id.proto ==IPPROTO_ESP ) -dump_esp_combs (skb, t); + alg_size =dump_esp_combs (skb, t); + + hdr->sadb_msg_len += alg_size /8 ;/* security context */ if (xfrm_ctx) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 58/206 ARM: dts: am335x-pcm-953: Define fixed regulators in root node
In reply to Greg Kroah-HartmanFrom: Dominik Haller <[email protected]>
[ Upstream commit 8950f345a67d8046d2472dd6ea81fa18ef5b4844 ]
Remove the regulators node and define fixed regulators in the root node. Prevents the sdhci-omap driver from waiting in probe deferral forever because of the missing vmmc-supply and keeps am335x-pcm-953 consistent with the other Phytec AM335 boards.
Message-Id: <[email protected]>
--- arch/arm/boot/dts/am335x-pcm-953.dtsi | 28 +++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-)
arch/arm/boot/dts/am335x-pcm-953.dtsi +13 -15
@@ -12,22 +12,20 @@ / { compatible = "phytec,am335x-pcm-953", "phytec,am335x-phycore-som", "ti,am33xx"; /* Power */ - regulators { - vcc3v3: fixedregulator@1 { - compatible = "regulator-fixed"; - regulator-name = "vcc3v3"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - regulator-boot-on; - }; + vcc3v3: fixedregulator1 { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + }; - vcc1v8: fixedregulator@2 { - compatible = "regulator-fixed"; - regulator-name = "vcc1v8"; - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <1800000>; - regulator-boot-on; - }; + vcc1v8: fixedregulator2 { + compatible = "regulator-fixed"; + regulator-name = "vcc1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; }; /* User IO */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 59/206 ASoC: hdac_hda: fix hda pcm buffer overflow issue
In reply to Greg Kroah-HartmanFrom: Junxiao Chang <[email protected]>
[ Upstream commit 37882100cd0629d830db430a8cee0b724fe1fea3 ]
When KASAN is enabled, below log might be dumped with Intel EHL hardware:
[ 48.583597] ================================================================== [ 48.585921] BUG: KASAN: slab-out-of-bounds in hdac_hda_dai_hw_params+0x20a/0x22b [snd_soc_hdac_hda] [ 48.587995] Write of size 4 at addr ffff888103489708 by task pulseaudio/759
[ 48.589237] CPU: 2 PID: 759 Comm: pulseaudio Tainted: G U E 5.15.71-intel-ese-standard-lts #9 [ 48.591272] Hardware name: Intel Corporation Elkhart Lake Embedded Platform/ElkhartLake LPDDR4x T3 CRB, BIOS EHLSFWI1.R00.4251.A01.2206130432 06/13/2022 [ 48.593010] Call Trace: [ 48.593648] <TASK> [ 48.593852] dump_stack_lvl+0x34/0x48 [ 48.594404] print_address_description.constprop.0+0x1f/0x140 [ 48.595174] ? hdac_hda_dai_hw_params+0x20a/0x22b [snd_soc_hdac_hda] [ 48.595868] ? hdac_hda_dai_hw_params+0x20a/0x22b [snd_soc_hdac_hda] [ 48.596519] kasan_report.cold+0x7f/0x11b [ 48.597003] ? hdac_hda_dai_hw_params+0x20a/0x22b [snd_soc_hdac_hda] [ 48.597885] hdac_hda_dai_hw_params+0x20a/0x22b [snd_soc_hdac_hda]
HDAC_LAST_DAI_ID is last index id, pcm buffer array size should be +1 to avoid out of bound access.
--- sound/soc/codecs/hdac_hda.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/hdac_hda.h +2 -2
@@ -14,7 +14,7 @@ enum {HDAC_HDMI_1_DAI_ID ,HDAC_HDMI_2_DAI_ID ,HDAC_HDMI_3_DAI_ID , - HDAC_LAST_DAI_ID = HDAC_HDMI_3_DAI_ID, +HDAC_DAI_ID_NUM }; struct hdac_hda_pcm {
@@ -24,7 +24,7 @@ struct hdac_hda_pcm {struct hdac_hda_priv {struct hda_codec codec; -struct hdac_hda_pcm pcm[HDAC_LAST_DAI_ID ]; +struct hdac_hda_pcm pcm[HDAC_DAI_ID_NUM ];bool need_display_power; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 60/206 ASoC: sgtl5000: Reset the CHIP_CLK_CTRL reg on remove
In reply to Greg Kroah-HartmanFrom: Detlev Casanova <[email protected]>
[ Upstream commit 0bb8e9b36b5b7f2e77892981ff6c27ee831d8026 ]
Since commit bf2aebccddef ("ASoC: sgtl5000: Fix noise on shutdown/remove"), the device power control registers are reset when the driver is removed/shutdown.
This is an issue when the device is configured to use the PLL clock. The device will stop responding if it is still configured to use the PLL clock but the PLL clock is powered down.
When rebooting linux, the probe function will show:
sgtl5000 0-000a: Error reading chip id -11
Make sure that the CHIP_CLK_CTRL is reset to its default value before powering down the device.
--- sound/soc/codecs/sgtl5000.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/sgtl5000.c +1 -0
@@ -1797,6 +1797,7 @@ static int sgtl5000_i2c_remove(struct i2c_client *client) {struct sgtl5000_priv *sgtl5000 =i2c_get_clientdata (client); +regmap_write (sgtl5000->regmap,SGTL5000_CHIP_CLK_CTRL ,SGTL5000_CHIP_CLK_CTRL_DEFAULT );regmap_write (sgtl5000->regmap,SGTL5000_CHIP_DIG_POWER ,SGTL5000_DIG_POWER_DEFAULT );regmap_write (sgtl5000->regmap,SGTL5000_CHIP_ANA_POWER ,SGTL5000_ANA_POWER_DEFAULT );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 61/206 ASoC: soc-pcm: Dont zero TDM masks in __soc_pcm_open()
In reply to Greg Kroah-HartmanFrom: Richard Fitzgerald <[email protected]>
[ Upstream commit 39bd801d6908900e9ab0cdc2655150f95ddd4f1a ]
The DAI tx_mask and rx_mask are set by snd_soc_dai_set_tdm_slot() and used by later code that depends on the TDM settings. So __soc_pcm_open() should not be obliterating those mask values.
The code in __soc_pcm_hw_params() uses these masks to calculate the active channels so that only the AIF_IN/AIF_OUT widgets for the active TDM slots are enabled. The zeroing of the masks in __soc_pcm_open() disables this functionality so all AIF widgets were enabled even for channels that are not assigned to a TDM slot.
--- sound/soc/soc-pcm.c | 5 ----- 1 file changed, 5 deletions(-)
sound/soc/soc-pcm.c +0 -5
@@ -759,11 +759,6 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ret =snd_soc_dai_startup (dai, substream);if (ret <0 ) goto err; - -if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) - dai->tx_mask =0 ; -else - dai->rx_mask =0 ; }/* Dynamic PCM DAI links compat checks use dynamic capabilities */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 62/206 x86/hyperv: Restore VP assist page after cpu offlining/onlining
In reply to Greg Kroah-HartmanFrom: Vitaly Kuznetsov <[email protected]>
[ Upstream commit ee6815416380bc069b7dcbdff0682d4c53617527 ]
Commit e5d9b714fe40 ("x86/hyperv: fix root partition faults when writing to VP assist page MSR") moved 'wrmsrl(HV_X64_MSR_VP_ASSIST_PAGE)' under 'if (*hvp)' condition. This works for root partition as hv_cpu_die() does memunmap() and sets 'hv_vp_assist_page[cpu]' to NULL but breaks non-root partitions as hv_cpu_die() doesn't free 'hv_vp_assist_page[cpu]' for them. This causes VP assist page to remain unset after CPU offline/online cycle:
$ rdmsr -p 24 0x40000073 10212f001 $ echo 0 > /sys/devices/system/cpu/cpu24/online $ echo 1 > /sys/devices/system/cpu/cpu24/online $ rdmsr -p 24 0x40000073 0
Fix the issue by always writing to HV_X64_MSR_VP_ASSIST_PAGE in hv_cpu_init(). Note, checking 'if (!*hvp)', for root partition is pointless as hv_cpu_die() always sets 'hv_vp_assist_page[cpu]' to NULL (and it's also NULL initially).
Note: the fact that 'hv_vp_assist_page[cpu]' is reset to NULL may present a (potential) issue for KVM. While Hyper-V uses CPUHP_AP_ONLINE_DYN stage in CPU hotplug, KVM uses CPUHP_AP_KVM_STARTING which comes earlier in CPU teardown sequence. It is theoretically possible that Enlightened VMCS is still in use. It is unclear if the issue is real and if using KVM with Hyper-V root partition is even possible.
While on it, drop the unneeded smp_processor_id() call from hv_cpu_init().
--- arch/x86/hyperv/hv_init.c | 54 +++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 28 deletions(-)
arch/x86/hyperv/hv_init.c +26 -28
@@ -45,7 +45,7 @@ EXPORT_SYMBOL_GPL(hv_vp_assist_page);static int hv_cpu_init (unsigned int cpu) {union hv_vp_assist_msr_contents msr = {0 }; -struct hv_vp_assist_page **hvp = &hv_vp_assist_page[smp_processor_id ()]; +struct hv_vp_assist_page **hvp = &hv_vp_assist_page[cpu];int ret; ret =hv_common_cpu_init (cpu);
@@ -55,34 +55,32 @@ static int hv_cpu_init(unsigned int cpu)if (!hv_vp_assist_page)return 0 ; -if (!*hvp) { -if (hv_root_partition) { -/* -* For root partition we get the hypervisor provided VP assist -* page, instead of allocating a new page. -*/ -rdmsrl (HV_X64_MSR_VP_ASSIST_PAGE , msr.as_uint64); - *hvp =memremap (msr.pfn << -HV_X64_MSR_VP_ASSIST_PAGE_ADDRESS_SHIFT , -PAGE_SIZE ,MEMREMAP_WB ); - }else { -/* -* The VP assist page is an "overlay" page (see Hyper-V TLFS's -* Section 5.2.1 "GPA Overlay Pages"). Here it must be zeroed -* out to make sure we always write the EOI MSR in -* hv_apic_eoi_write() *after* the EOI optimization is disabled -* in hv_cpu_die(), otherwise a CPU may not be stopped in the -* case of CPU offlining and the VM will hang. -*/ +if (hv_root_partition) { +/* +* For root partition we get the hypervisor provided VP assist +* page, instead of allocating a new page. +*/ +rdmsrl (HV_X64_MSR_VP_ASSIST_PAGE , msr.as_uint64); + *hvp =memremap (msr.pfn <<HV_X64_MSR_VP_ASSIST_PAGE_ADDRESS_SHIFT , +PAGE_SIZE ,MEMREMAP_WB ); + }else { +/* +* The VP assist page is an "overlay" page (see Hyper-V TLFS's +* Section 5.2.1 "GPA Overlay Pages"). Here it must be zeroed +* out to make sure we always write the EOI MSR in +* hv_apic_eoi_write() *after* the EOI optimization is disabled +* in hv_cpu_die(), otherwise a CPU may not be stopped in the +* case of CPU offlining and the VM will hang. +*/ +if (!*hvp) *hvp =__vmalloc (PAGE_SIZE ,GFP_KERNEL | __GFP_ZERO); -if (*hvp) - msr.pfn =vmalloc_to_pfn (*hvp); - } -WARN_ON (!(*hvp)); -if (*hvp) { - msr.enable =1 ; -wrmsrl (HV_X64_MSR_VP_ASSIST_PAGE , msr.as_uint64); - } +if (*hvp) + msr.pfn =vmalloc_to_pfn (*hvp); + + } +if (!WARN_ON (!(*hvp))) { + msr.enable =1 ; +wrmsrl (HV_X64_MSR_VP_ASSIST_PAGE , msr.as_uint64); }return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 63/206 scsi: storvsc: Fix handling of srb_status and capacity change events
In reply to Greg Kroah-HartmanFrom: Michael Kelley <[email protected]>
[ Upstream commit b8a5376c321b4669f7ffabc708fd30c3970f3084 ]
Current handling of the srb_status is incorrect. Commit 52e1b3b3daa9 ("scsi: storvsc: Correctly handle multiple flags in srb_status") is based on srb_status being a set of flags, when in fact only the 2 high order bits are flags and the remaining 6 bits are an integer status. Because the integer values of interest mostly look like flags, the code actually works when treated that way.
But in the interest of correctness going forward, fix this by treating the low 6 bits of srb_status as an integer status code. Add handling for SRB_STATUS_INVALID_REQUEST, which was the original intent of commit 52e1b3b3daa9. Furthermore, treat the ERROR, ABORTED, and INVALID_REQUEST srb status codes as essentially equivalent for the cases we care about. There's no harm in doing so, and it isn't always clear which status code current or older versions of Hyper-V report for particular conditions.
Treating the srb status codes as equivalent has the additional benefit of ensuring that capacity change events result in an immediate rescan so that the new size is known to Linux. Existing code checks SCSI sense data for capacity change events when the srb status is ABORTED. But capacity change events are also being observed when Hyper-V reports the srb status as ERROR. Without the immediate rescan, the new size isn't known until something else causes a rescan (such as running fdisk to expand a partition), and in the meantime, tools such as "lsblk" continue to report the old size.
--- drivers/scsi/storvsc_drv.c | 69 +++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 35 deletions(-)
drivers/scsi/storvsc_drv.c +34 -35
@@ -344,16 +344,21 @@ enum storvsc_request_type { };/* -* SRB status codes and masks; a subset of the codes used here. +* SRB status codes and masks. In the 8-bit field, the two high order bits +* are flags, while the remaining 6 bits are an integer status code. The +* definitions here include only the subset of the integer status codes that +* are tested for in this driver. */ -#define SRB_STATUS_AUTOSENSE_VALID 0x80#define SRB_STATUS_QUEUE_FROZEN 0x40 -#define SRB_STATUS_INVALID_LUN 0x20 -#define SRB_STATUS_SUCCESS 0x01 -#define SRB_STATUS_ABORTED 0x02 -#define SRB_STATUS_ERROR 0x04 -#define SRB_STATUS_DATA_OVERRUN 0x12 + +/* SRB status integer codes */ +#define SRB_STATUS_SUCCESS 0x01 +#define SRB_STATUS_ABORTED 0x02 +#define SRB_STATUS_ERROR 0x04 +#define SRB_STATUS_INVALID_REQUEST 0x06 +#define SRB_STATUS_DATA_OVERRUN 0x12 +#define SRB_STATUS_INVALID_LUN 0x20#define SRB_STATUS (status) \ (status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN))
@@ -1032,38 +1037,25 @@ static void storvsc_handle_error(struct vmscsi_request *vm_srb,void (*process_err_fn)(struct work_struct *work);struct hv_host_device *host_dev =shost_priv (host); -/* -* In some situations, Hyper-V sets multiple bits in the -* srb_status, such as ABORTED and ERROR. So process them -* individually, with the most specific bits first. -*/ - -if (vm_srb->srb_status &SRB_STATUS_INVALID_LUN ) { -set_host_byte (scmnd,DID_NO_CONNECT ); - process_err_fn = storvsc_remove_lun; - goto do_work; - } +switch (SRB_STATUS (vm_srb->srb_status)) { +case SRB_STATUS_ERROR : +case SRB_STATUS_ABORTED : +case SRB_STATUS_INVALID_REQUEST : +if (vm_srb->srb_status &SRB_STATUS_AUTOSENSE_VALID ) { +/* Check for capacity change */ +if ((asc ==0x2a ) && (ascq ==0x9 )) { + process_err_fn = storvsc_device_scan; +/* Retry the I/O that triggered this. */ +set_host_byte (scmnd,DID_REQUEUE ); + goto do_work; + } -if (vm_srb->srb_status &SRB_STATUS_ABORTED ) { -if (vm_srb->srb_status &SRB_STATUS_AUTOSENSE_VALID && -/* Capacity data has changed */ - (asc ==0x2a ) && (ascq ==0x9 )) { - process_err_fn = storvsc_device_scan;/* -* Retry the I/O that triggered this. +* Otherwise, let upper layer deal with the +* error when sense message is present */ -set_host_byte (scmnd,DID_REQUEUE ); - goto do_work; - } - } - -if (vm_srb->srb_status &SRB_STATUS_ERROR ) { -/* -* Let upper layer deal with error when -* sense message is present. -*/ -if (vm_srb->srb_status &SRB_STATUS_AUTOSENSE_VALID )return ; + }/* * If there is an error; offline the device since all
@@ -1086,6 +1078,13 @@ static void storvsc_handle_error(struct vmscsi_request *vm_srb,default :set_host_byte (scmnd,DID_ERROR ); } +return ; + +case SRB_STATUS_INVALID_LUN : +set_host_byte (scmnd,DID_NO_CONNECT ); + process_err_fn = storvsc_remove_lun; + goto do_work; + }return ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 64/206 ASoC: max98373: Add checks for devm_kcalloc
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 60591bbf6d5eb44f275eb733943b7757325c1b60 ]
As the devm_kcalloc may return NULL pointer,
it should be better to check the return value
in order to avoid NULL poineter dereference.
--- sound/soc/codecs/max98373-i2c.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/soc/codecs/max98373-i2c.c +4 -0
@@ -551,6 +551,10 @@ static int max98373_i2c_probe(struct i2c_client *i2c, max98373->cache =devm_kcalloc (&i2c->dev, max98373->cache_num,sizeof (*max98373->cache),GFP_KERNEL ); +if (!max98373->cache) { + ret = -ENOMEM ; +return ret; + }for (i =0 ; i < max98373->cache_num; i++) max98373->cache[i].reg = max98373_i2c_cache_reg[i];
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 65/206 regulator: core: fix kobject release warning and memory leak in regulator_register()
In reply to Greg Kroah-HartmanFrom: Zeng Heng <[email protected]>
[ Upstream commit 5f4b204b6b8153923d5be8002c5f7082985d153f ]
Here is a warning report about lack of registered release() from kobject lib:
Device '(null)' does not have a release() function, it is broken and must be fixed.
WARNING: CPU: 0 PID: 48430 at drivers/base/core.c:2332 device_release+0x104/0x120 Call Trace: kobject_put+0xdc/0x180 put_device+0x1b/0x30 regulator_register+0x651/0x1170 devm_regulator_register+0x4f/0xb0
When regulator_register() returns fail and directly goto clean symbol, rdev->dev has not registered release() function yet (which is registered by regulator_class in the following), so rdev needs to be freed manually. If rdev->dev.of_node is not NULL, which means the of_node has gotten by regulator_of_get_init_data(), it needs to call of_node_put() to avoid refcount leak.
Otherwise, only calling put_device() would lead memory leak of rdev in further:
unreferenced object 0xffff88810d0b1000 (size 2048):
comm "107-i2c-rtq6752", pid 48430, jiffies 4342258431 (age 1341.780s) backtrace:
kmalloc_trace+0x22/0x110
regulator_register+0x184/0x1170
devm_regulator_register+0x4f/0xb0When regulator_register() returns fail and goto wash symbol, rdev->dev has registered release() function, so directly call put_device() to cleanup everything.
--- drivers/regulator/core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/regulator/core.c +5 -1
@@ -5549,11 +5549,15 @@ regulator_register(const struct regulator_desc *regulator_desc,mutex_lock (®ulator_list_mutex);regulator_ena_gpio_free (rdev);mutex_unlock (®ulator_list_mutex); +put_device (&rdev->dev); + rdev =NULL ; clean:if (dangling_of_gpiod)gpiod_put (config->ena_gpiod); +if (rdev && rdev->dev.of_node) +of_node_put (rdev->dev.of_node); +kfree (rdev);kfree (config); -put_device (&rdev->dev); rinse:if (dangling_cfg_gpiod)gpiod_put (cfg->ena_gpiod);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 66/206 spi: dw-dma: decrease reference count in dw_spi_dma_init_mfld()
In reply to Greg Kroah-HartmanFrom: Xiongfeng Wang <[email protected]>
[ Upstream commit 804313b64e412a81b0b3389a10e7622452004aa6 ]
pci_get_device() will increase the reference count for the returned pci_dev. Since 'dma_dev' is only used to filter the channel in dw_spi_dma_chan_filer() after using it we need to call pci_dev_put() to decrease the reference count. Also add pci_dev_put() for the error case.
--- drivers/spi/spi-dw-dma.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/spi/spi-dw-dma.c +3 -0
@@ -127,12 +127,15 @@ static int dw_spi_dma_init_mfld(struct device *dev, struct dw_spi *dws)dw_spi_dma_sg_burst_init (dws); +pci_dev_put (dma_dev); +return 0 ; free_rxchan:dma_release_channel (dws->rxchan); dws->rxchan =NULL ; err_exit: +pci_dev_put (dma_dev);return -EBUSY ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 67/206 regulator: core: fix UAF in destroy_regulator()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 1f386d6894d0f1b7de8ef640c41622ddd698e7ab ]
I got a UAF report as following:
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x935/0x2060 Read of size 8 at addr ffff88810e838220 by task python3/268 Call Trace: <TASK> dump_stack_lvl+0x67/0x83 print_report+0x178/0x4b0 kasan_report+0x90/0x190 __lock_acquire+0x935/0x2060 lock_acquire+0x156/0x400 _raw_spin_lock+0x2a/0x40 lockref_get+0x11/0x30 simple_recursive_removal+0x41/0x440 debugfs_remove.part.12+0x32/0x50 debugfs_remove+0x29/0x30 _regulator_put.cold.54+0x3e/0x27f regulator_put+0x1f/0x30 release_nodes+0x6a/0xa0 devres_release_all+0xf8/0x150 Allocated by task 37: kasan_save_stack+0x1c/0x40 kasan_set_track+0x21/0x30 __kasan_slab_alloc+0x5d/0x70 slab_post_alloc_hook+0x62/0x510 kmem_cache_alloc_lru+0x222/0x5a0 __d_alloc+0x31/0x440 d_alloc+0x30/0xf0 d_alloc_parallel+0xc4/0xd20 __lookup_slow+0x15e/0x2f0 lookup_one_len+0x13a/0x150 start_creating+0xea/0x190 debugfs_create_dir+0x1e/0x210 create_regulator+0x254/0x4e0 _regulator_get+0x2a1/0x467 _devm_regulator_get+0x5a/0xb0 regulator_virtual_probe+0xb9/0x1a0 Freed by task 30: kasan_save_stack+0x1c/0x40 kasan_set_track+0x21/0x30 kasan_save_free_info+0x2a/0x50 __kasan_slab_free+0x102/0x190 kmem_cache_free+0xf6/0x600 rcu_core+0x54c/0x12b0 __do_softirq+0xf2/0x5e3 Last potentially related work creation: kasan_save_stack+0x1c/0x40 __kasan_record_aux_stack+0x98/0xb0 call_rcu+0x42/0x700 dentry_free+0x6c/0xd0 __dentry_kill+0x23b/0x2d0 dput.part.31+0x431/0x780 simple_recursive_removal+0xa9/0x440 debugfs_remove.part.12+0x32/0x50 debugfs_remove+0x29/0x30 regulator_unregister+0xe3/0x230 release_nodes+0x6a/0xa0
==================================================================
Here is how happened:
processor A processor Bregulator_register()
rdev_init_debugfs()
rdev->debugfs = debugfs_create_dir() devm_regulator_get() rdev = regulator_dev_lookup() create_regulator(rdev) // using rdev->debugfs as parent debugfs_create_dir(rdev->debugfs)
mfd_remove_devices_fn()
release_nodes()
regulator_unregister()
// free rdev->debugfs
debugfs_remove_recursive(rdev->debugfs)
release_nodes()
destroy_regulator()
debugfs_remove_recursive() <- causes UAFIn devm_regulator_get(), after getting rdev, the refcount is get, so fix this by moving debugfs_remove_recursive() to regulator_dev_release(), then it can be proctected by the refcount, the 'rdev->debugfs' can not be freed until the refcount is 0.
--- drivers/regulator/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/core.c +1 -1
@@ -5071,6 +5071,7 @@ static void regulator_dev_release(struct device *dev) {struct regulator_dev *rdev =dev_get_drvdata (dev); +debugfs_remove_recursive (rdev->debugfs);kfree (rdev->constraints);of_node_put (rdev->dev.of_node);kfree (rdev);
@@ -5586,7 +5587,6 @@ void regulator_unregister(struct regulator_dev *rdev)mutex_lock (®ulator_list_mutex); -debugfs_remove_recursive (rdev->debugfs);WARN_ON (rdev->open_count);regulator_remove_coupling (rdev);unset_regulator_supplies (rdev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 68/206 bus: sunxi-rsb: Remove the shutdown callback
In reply to Greg Kroah-HartmanFrom: Samuel Holland <[email protected]>
[ Upstream commit 5f4696ddca4b8a0bbbc36bd46829f97aab5a4552 ]
Shutting down the RSB controller prevents communicating with a PMIC inside pm_power_off(), since that gets called after device_shutdown(), so it breaks system poweroff on some boards.
--- drivers/bus/sunxi-rsb.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/bus/sunxi-rsb.c +0 -9
@@ -816,14 +816,6 @@ static int sunxi_rsb_remove(struct platform_device *pdev)return 0 ; } -static void sunxi_rsb_shutdown (struct platform_device *pdev) -{ -struct sunxi_rsb *rsb =platform_get_drvdata (pdev); - -pm_runtime_disable (&pdev->dev); -sunxi_rsb_hw_exit (rsb); -} -static const struct dev_pm_ops sunxi_rsb_dev_pm_ops = {SET_RUNTIME_PM_OPS (sunxi_rsb_runtime_suspend, sunxi_rsb_runtime_resume,NULL )
@@ -839,7 +831,6 @@ MODULE_DEVICE_TABLE(of, sunxi_rsb_of_match_table);static struct platform_driver sunxi_rsb_driver = { .probe = sunxi_rsb_probe, .remove = sunxi_rsb_remove, - .shutdown = sunxi_rsb_shutdown, .driver = { .name =RSB_CTRL_NAME , .of_match_table = sunxi_rsb_of_match_table,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 69/206 bus: sunxi-rsb: Support atomic transfers
In reply to Greg Kroah-HartmanFrom: Samuel Holland <[email protected]>
[ Upstream commit 077686da0e2162c4ea5ae0df205849c2a7a84479 ]
When communicating with a PMIC during system poweroff (pm_power_off()), IRQs are disabled and we are in a RCU read-side critical section, so we cannot use wait_for_completion_io_timeout(). Instead, poll the status register for transfer completion.
--- drivers/bus/sunxi-rsb.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)
drivers/bus/sunxi-rsb.c +21 -8
@@ -271,6 +271,9 @@ EXPORT_SYMBOL_GPL(sunxi_rsb_driver_register);/* common code that starts a transfer */ static int _sunxi_rsb_run_xfer (struct sunxi_rsb *rsb) { +u32 int_mask, status; +bool timeout; +if (readl (rsb->regs +RSB_CTRL ) &RSB_CTRL_START_TRANS ) {dev_dbg (rsb->dev,"RSB transfer still in progress\n" );return -EBUSY ;
@@ -278,13 +281,23 @@ static int _sunxi_rsb_run_xfer(struct sunxi_rsb *rsb)reinit_completion (&rsb->complete); -writel (RSB_INTS_LOAD_BSY |RSB_INTS_TRANS_ERR |RSB_INTS_TRANS_OVER , - rsb->regs +RSB_INTE ); + int_mask =RSB_INTS_LOAD_BSY |RSB_INTS_TRANS_ERR |RSB_INTS_TRANS_OVER ; +writel (int_mask, rsb->regs +RSB_INTE );writel (RSB_CTRL_START_TRANS |RSB_CTRL_GLOBAL_INT_ENB , rsb->regs +RSB_CTRL ); -if (!wait_for_completion_io_timeout (&rsb->complete, -msecs_to_jiffies (100 ))) { +if (irqs_disabled ()) { + timeout =readl_poll_timeout_atomic (rsb->regs +RSB_INTS , + status, (status & int_mask), +10 ,100000 ); +writel (status, rsb->regs +RSB_INTS ); + }else { + timeout = !wait_for_completion_io_timeout (&rsb->complete, +msecs_to_jiffies (100 )); + status = rsb->status; + } + +if (timeout) {dev_dbg (rsb->dev,"RSB timeout\n" );/* abort the transfer */
@@ -296,18 +309,18 @@ static int _sunxi_rsb_run_xfer(struct sunxi_rsb *rsb)return -ETIMEDOUT ; } -if (rsb->status &RSB_INTS_LOAD_BSY ) { +if (status &RSB_INTS_LOAD_BSY ) {dev_dbg (rsb->dev,"RSB busy\n" );return -EBUSY ; } -if (rsb->status &RSB_INTS_TRANS_ERR ) { -if (rsb->status &RSB_INTS_TRANS_ERR_ACK ) { +if (status &RSB_INTS_TRANS_ERR ) { +if (status &RSB_INTS_TRANS_ERR_ACK ) {dev_dbg (rsb->dev,"RSB slave nack\n" );return -EINVAL ; } -if (rsb->status &RSB_INTS_TRANS_ERR_DATA ) { +if (status &RSB_INTS_TRANS_ERR_DATA ) {dev_dbg (rsb->dev,"RSB transfer data error\n" );return -EIO ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 70/206 tee: optee: fix possible memory leak in optee_register_device()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit cce616e012c215d65c15e5d1afa73182dea49389 ]
If device_register() returns error in optee_register_device(), the name allocated by dev_set_name() need be freed. As comment of device_register() says, it should use put_device() to give up the reference in the error path. So fix this by calling put_device(), then the name can be freed in kobject_cleanup(), and optee_device is freed in optee_release_device().
--- drivers/tee/optee/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tee/optee/device.c +1 -1
@@ -80,7 +80,7 @@ static int optee_register_device(const uuid_t *device_uuid) rc =device_register (&optee_device->dev);if (rc) {pr_err ("device registration failed, err: %d\n" , rc); -kfree (optee_device); +put_device (&optee_device->dev); }return rc;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 71/206 ARM: dts: at91: sam9g20ek: enable udc vbus gpio pinctrl
In reply to Greg Kroah-HartmanFrom: Michael Grzeschik <[email protected]>
[ Upstream commit 40a2226e8bfacb79dd154dea68febeead9d847e9 ]
We set the PIOC to GPIO mode. This way the pin becomes an input signal will be usable by the controller. Without this change the udc on the 9g20ek does not work.
--- arch/arm/boot/dts/at91sam9g20ek_common.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm/boot/dts/at91sam9g20ek_common.dtsi +9 -0
@@ -39,6 +39,13 @@ pinctrl_pck0_as_mck: pck0_as_mck { }; + usb1 { + pinctrl_usb1_vbus_gpio: usb1_vbus_gpio { + atmel,pins = + <AT91_PIOC 5 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>; /* PC5 GPIO */ + }; + }; + mmc0_slot1 { pinctrl_board_mmc0_slot1: mmc0_slot1-board { atmel,pins =
@@ -84,6 +91,8 @@ macb0: ethernet@fffc4000 { }; usb1: gadget@fffa4000 { + pinctrl-0 = <&pinctrl_usb1_vbus_gpio>; + pinctrl-names = "default"; atmel,vbus-gpio = <&pioC 5 GPIO_ACTIVE_HIGH>; status = "okay"; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 72/206 selftests: mptcp: more stable simult_flows tests
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit b6ab64b074f29b42ff272793806efc913f7cc742 ]
Currently the simult_flows.sh self-tests are not very stable, especially when running on slow VMs.
The tests measure runtime for transfers on multiple subflows and check that the time is near the theoretical maximum.
The current test infra introduces a bit of jitter in test runtime, due to multiple explicit delays. Additionally the runtime is measured by the shell script wrapper. On a slow VM, the script overhead is measurable and subject to relevant jitter.
One solution to make the test more stable would be adding more slack to the expected time; that could possibly hide real regressions. Instead move the measurement inside the command doing the transfer, and drop most unneeded sleeps.
Stable-dep-of: 3de88b95c4d4 ("selftests: mptcp: fix mibit vs mbit mix up")
--- .../selftests/net/mptcp/mptcp_connect.c | 72 +++++++++++++++---- .../selftests/net/mptcp/simult_flows.sh | 36 ++++------ 2 files changed, 72 insertions(+), 36 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.c +58 -14
@@ -14,6 +14,7 @@#include <strings.h> #include <signal.h> #include <unistd.h> +#include <time.h> #include <sys/poll.h> #include <sys/sendfile.h>
@@ -64,6 +65,7 @@ static int cfg_sndbuf;static int cfg_rcvbuf;static bool cfg_join;static bool cfg_remove; +static unsigned int cfg_time;static unsigned int cfg_do_w;static int cfg_wait;static uint32_t cfg_mark;
@@ -78,9 +80,10 @@ static struct cfg_cmsg_types cfg_cmsg_types;static void die_usage (void ) {fprintf (stderr,"Usage: mptcp_connect [-6] [-u] [-s MPTCP|TCP] [-p port] [-m mode]" -"[-l] [-w sec] connect_address\n" ); +"[-l] [-w sec] [-t num] [-T num] connect_address\n" );fprintf (stderr,"\t-6 use ipv6\n" );fprintf (stderr,"\t-t num -- set poll timeout to num\n" ); +fprintf (stderr,"\t-T num -- set expected runtime to num ms\n" );fprintf (stderr,"\t-S num -- set SO_SNDBUF to num\n" );fprintf (stderr,"\t-R num -- set SO_RCVBUF to num\n" );fprintf (stderr,"\t-p num -- use port num\n" );
@@ -448,7 +451,7 @@ static void set_nonblock(int fd)fcntl (fd,F_SETFL , flags |O_NONBLOCK ); } -static int copyfd_io_poll (int infd,int peerfd,int outfd) +static int copyfd_io_poll (int infd,int peerfd,int outfd,bool *in_closed_after_out) {struct pollfd fds = { .fd = peerfd,
@@ -487,9 +490,11 @@ static int copyfd_io_poll(int infd, int peerfd, int outfd)*/ fds.events &= ~POLLIN ; -if ((fds.events &POLLOUT ) ==0 ) +if ((fds.events &POLLOUT ) ==0 ) { + *in_closed_after_out = true;/* and nothing more to send */ break ; + }/* Else, still have data to transmit */ }else if (len <0 ) {
@@ -547,7 +552,7 @@ static int copyfd_io_poll(int infd, int peerfd, int outfd) }/* leave some time for late join/announce */ -if (cfg_join || cfg_remove) +if (cfg_remove)usleep (cfg_wait);close (peerfd);
@@ -646,7 +651,7 @@ static int do_sendfile(int infd, int outfd, unsigned int count) }static int copyfd_io_mmap (int infd,int peerfd,int outfd, -unsigned int size) +unsigned int size,bool *in_closed_after_out) {int err;
@@ -664,13 +669,14 @@ static int copyfd_io_mmap(int infd, int peerfd, int outfd,shutdown (peerfd,SHUT_WR ); err =do_recvfile (peerfd, outfd); + *in_closed_after_out = true; }return err; }static int copyfd_io_sendfile (int infd,int peerfd,int outfd, -unsigned int size) +unsigned int size,bool *in_closed_after_out) {int err;
@@ -685,6 +691,7 @@ static int copyfd_io_sendfile(int infd, int peerfd, int outfd,if (err)return err; err =do_recvfile (peerfd, outfd); + *in_closed_after_out = true; }return err;
@@ -692,27 +699,62 @@ static int copyfd_io_sendfile(int infd, int peerfd, int outfd,static int copyfd_io (int infd,int peerfd,int outfd) { +bool in_closed_after_out = false; +struct timespec start, end;int file_size; +int ret; + +if (cfg_time && (clock_gettime (CLOCK_MONOTONIC , &start) <0 )) +xerror ("can not fetch start time %d" , errno);switch (cfg_mode) {case CFG_MODE_POLL : -return copyfd_io_poll (infd, peerfd, outfd); + ret =copyfd_io_poll (infd, peerfd, outfd, &in_closed_after_out); +break ; +case CFG_MODE_MMAP : file_size =get_infd_size (infd);if (file_size <0 )return file_size; -return copyfd_io_mmap (infd, peerfd, outfd, file_size); + ret =copyfd_io_mmap (infd, peerfd, outfd, file_size, &in_closed_after_out); +break ; +case CFG_MODE_SENDFILE : file_size =get_infd_size (infd);if (file_size <0 )return file_size; -return copyfd_io_sendfile (infd, peerfd, outfd, file_size); + ret =copyfd_io_sendfile (infd, peerfd, outfd, file_size, &in_closed_after_out); +break ; + +default : +fprintf (stderr,"Invalid mode %d\n" , cfg_mode); + +die_usage (); +return 1 ; } -fprintf (stderr,"Invalid mode %d\n" , cfg_mode); +if (ret) +return ret; -die_usage (); -return 1 ; +if (cfg_time) { +unsigned int delta_ms; + +if (clock_gettime (CLOCK_MONOTONIC , &end) <0 ) +xerror ("can not fetch end time %d" , errno); + delta_ms = (end.tv_sec - start.tv_sec) *1000 + (end.tv_nsec - start.tv_nsec) /1000000 ; +if (delta_ms > cfg_time) { +xerror ("transfer slower than expected! runtime %d ms, expected %d ms" , + delta_ms, cfg_time); + } + +/* show the runtime only if this end shutdown(wr) before receiving the EOF, +* (that is, if this end got the longer runtime) +*/ +if (in_closed_after_out) +fprintf (stderr,"%d" , delta_ms); + } + +return 0 ; } static void check_sockaddr(int pf, struct sockaddr_storage *ss,
@@ -1005,12 +1047,11 @@ static void parse_opts(int argc, char **argv) {int c; -while ((c =getopt (argc, argv,"6jr:lp:s:hut:m:S:R:w:M:P:c:" )) !=-1 ) { +while ((c =getopt (argc, argv,"6jr:lp:s:hut:T:m:S:R:w:M:P:c:" )) !=-1 ) {switch (c) {case 'j' : cfg_join = true; cfg_mode =CFG_MODE_POLL ; - cfg_wait =400000 ;break ;case 'r' : cfg_remove = true;
@@ -1043,6 +1084,9 @@ static void parse_opts(int argc, char **argv)if (poll_timeout <=0 ) poll_timeout =-1 ;break ; +case 'T' : + cfg_time =atoi (optarg); +break ;case 'm' : cfg_mode =parse_mode (optarg);break ;
tools/testing/selftests/net/mptcp/simult_flows.sh +14 -22
@@ -51,7 +51,7 @@ setup() sout=$(mktemp) cout=$(mktemp) capout=$(mktemp) - size=$((2048 * 4096)) + size=$((2 * 2048 * 4096)) dd if=/dev/zero of=$small bs=4096 count=20 >/dev/null 2>&1 dd if=/dev/zero of=$large bs=4096 count=$((size / 4096)) >/dev/null 2>&1
@@ -161,17 +161,15 @@ do_transfer() timeout ${timeout_test} \ ip netns exec ${ns3} \ - ./mptcp_connect -jt ${timeout_poll} -l -p $port \ + ./mptcp_connect -jt ${timeout_poll} -l -p $port -T $time \ 0.0.0.0 < "$sin" > "$sout" & local spid=$! wait_local_port_listen "${ns3}" "${port}" - local start - start=$(date +%s%3N) timeout ${timeout_test} \ ip netns exec ${ns1} \ - ./mptcp_connect -jt ${timeout_poll} -p $port \ + ./mptcp_connect -jt ${timeout_poll} -p $port -T $time \ 10.0.3.3 < "$cin" > "$cout" & local cpid=$!
@@ -180,27 +178,20 @@ do_transfer() wait $spid local rets=$? - local stop - stop=$(date +%s%3N) - if $capture; then sleep 1 kill ${cappid_listener} kill ${cappid_connector} fi - local duration - duration=$((stop-start)) - cmp $sin $cout > /dev/null 2>&1 local cmps=$? cmp $cin $sout > /dev/null 2>&1 local cmpc=$? - printf "%16s" "$duration max $max_time " + printf "%-16s" " max $max_time " if [ $retc -eq 0 ] && [ $rets -eq 0 ] && \ - [ $cmpc -eq 0 ] && [ $cmps -eq 0 ] && \ - [ $duration -lt $max_time ]; then + [ $cmpc -eq 0 ] && [ $cmps -eq 0 ]; then echo "[ OK ]" cat "$capout" return 0
@@ -244,23 +235,24 @@ run_test() tc -n $ns2 qdisc add dev ns2eth1 root netem rate ${rate1}mbit $delay1 tc -n $ns2 qdisc add dev ns2eth2 root netem rate ${rate2}mbit $delay2 - # time is measure in ms - local time=$((size * 8 * 1000 / (( $rate1 + $rate2) * 1024 *1024) )) + # time is measured in ms, account for transfer size, affegated link speed + # and header overhead (10%) + local time=$((size * 8 * 1000 * 10 / (( $rate1 + $rate2) * 1024 *1024 * 9) )) # mptcp_connect will do some sleeps to allow the mp_join handshake - # completion - time=$((time + 1350)) + # completion (see mptcp_connect): 200ms on each side, add some slack + time=$((time + 450)) - printf "%-50s" "$msg" - do_transfer $small $large $((time * 11 / 10)) + printf "%-60s" "$msg" + do_transfer $small $large $time lret=$? if [ $lret -ne 0 ]; then ret=$lret [ $bail -eq 0 ] || exit $ret fi - printf "%-50s" "$msg - reverse direction" - do_transfer $large $small $((time * 11 / 10)) + printf "%-60s" "$msg - reverse direction" + do_transfer $large $small $time lret=$? if [ $lret -ne 0 ]; then ret=$lret
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 73/206 selftests: mptcp: fix mibit vs mbit mix up
In reply to Greg Kroah-HartmanFrom: Matthieu Baerts <[email protected]>
[ Upstream commit 3de88b95c4d436d78afc0266a0bed76c35ddeb62 ]
The estimated time was supposing the rate was expressed in mibit (bit * 1024^2) but it is in mbit (bit * 1000^2).
This makes the threshold higher but in a more realistic way to avoid false positives reported by CI instances.
Before this patch, the thresholds were at 7561/4005ms and now they are at 7906/4178ms.
While at it, also fix a typo in the linked comment, spotted by Mat.
--- tools/testing/selftests/net/mptcp/simult_flows.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/net/mptcp/simult_flows.sh +3 -2
@@ -235,9 +235,10 @@ run_test() tc -n $ns2 qdisc add dev ns2eth1 root netem rate ${rate1}mbit $delay1 tc -n $ns2 qdisc add dev ns2eth2 root netem rate ${rate2}mbit $delay2 - # time is measured in ms, account for transfer size, affegated link speed + # time is measured in ms, account for transfer size, aggregated link speed # and header overhead (10%) - local time=$((size * 8 * 1000 * 10 / (( $rate1 + $rate2) * 1024 *1024 * 9) )) + # ms byte -> bit 10% mbit -> kbit -> bit 10% + local time=$((1000 * size * 8 * 10 / ((rate1 + rate2) * 1000 * 1000 * 9) )) # mptcp_connect will do some sleeps to allow the mp_join handshake # completion (see mptcp_connect): 200ms on each side, add some slack
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 74/206 net: liquidio: simplify if expression
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit 733d4bbf9514890eb53ebe75827bf1fb4fd25ebe ]
Fix the warning reported by kbuild:
cocci warnings: (new ones prefixed by >>)
Quoted 1 line
Quoted 1 line
drivers/net/ethernet/cavium/liquidio/lio_main.c:1797:54-56: WARNING !A || A && B is equivalent to !A || B
drivers/net/ethernet/cavium/liquidio/lio_main.c:1827:54-56: WARNING !A || A && B is equivalent to !A || B
--- drivers/net/ethernet/cavium/liquidio/lio_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/cavium/liquidio/lio_main.c +2 -2
@@ -1798,7 +1798,7 @@ static int liquidio_open(struct net_device *netdev)ifstate_set (lio,LIO_IFSTATE_RUNNING ); -if (!OCTEON_CN23XX_PF (oct) || (OCTEON_CN23XX_PF (oct) && !oct->msix_on)) { +if (!OCTEON_CN23XX_PF (oct) || !oct->msix_on) { ret =setup_tx_poll_fn (netdev);if (ret) goto err_poll;
@@ -1828,7 +1828,7 @@ static int liquidio_open(struct net_device *netdev)return 0 ; err_rx_ctrl: -if (!OCTEON_CN23XX_PF (oct) || (OCTEON_CN23XX_PF (oct) && !oct->msix_on)) +if (!OCTEON_CN23XX_PF (oct) || !oct->msix_on)cleanup_tx_poll_fn (netdev); err_poll:if (lio->ptp_clock) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 75/206 rxrpc: Allow list of in-use local UDP endpoints to be viewed in /proc
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 33912c2639ad76660988c8ca97e4d18fca89b668 ]
Allow the list of in-use local UDP endpoints in the current network namespace to be viewed in /proc.
To aid with this, the endpoint list is converted to an hlist and RCU-safe manipulation is used so that the list can be read with only the RCU read lock held.
Stable-dep-of: 3bcd6c7eaa53 ("rxrpc: Fix race between conn bundle lookup and bundle removal [ZDI-CAN-15975]")
--- net/rxrpc/ar-internal.h | 5 +-- net/rxrpc/local_object.c | 37 +++++++++++---------- net/rxrpc/net_ns.c | 5 ++- net/rxrpc/proc.c | 69 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 22 deletions(-)
net/rxrpc/ar-internal.h +3 -2
@@ -88,7 +88,7 @@ struct rxrpc_net {struct work_struct client_conn_reaper;struct timer_list client_conn_reap_timer; -struct list_head local_endpoints; +struct hlist_head local_endpoints;struct mutex local_mutex;/* Lock for ->local_endpoints */ DECLARE_HASHTABLE (peer_hash,10 );
@@ -281,7 +281,7 @@ struct rxrpc_local {atomic_t active_users;/* Number of users of the local endpoint */ atomic_t usage;/* Number of references to the structure */ struct rxrpc_net *rxnet;/* The network ns in which this resides */ -struct list_head link; +struct hlist_node link;struct socket *socket;/* my UDP socket */ struct work_struct processor;struct rxrpc_sock __rcu *service;/* Service(s) listening on this endpoint */
@@ -1016,6 +1016,7 @@ void rxrpc_put_peer_locked(struct rxrpc_peer *);extern const struct seq_operations rxrpc_call_seq_ops;extern const struct seq_operations rxrpc_connection_seq_ops;extern const struct seq_operations rxrpc_peer_seq_ops; +extern const struct seq_operations rxrpc_local_seq_ops;/* * recvmsg.c
net/rxrpc/local_object.c +18 -19
@@ -82,7 +82,7 @@ static struct rxrpc_local *rxrpc_alloc_local(struct rxrpc_net *rxnet,atomic_set (&local->usage,1 );atomic_set (&local->active_users,1 ); local->rxnet = rxnet; -INIT_LIST_HEAD (&local->link); +INIT_HLIST_NODE (&local->link);INIT_WORK (&local->processor, rxrpc_local_processor);init_rwsem (&local->defrag_sem);skb_queue_head_init (&local->reject_queue);
@@ -181,7 +181,7 @@ struct rxrpc_local *rxrpc_lookup_local(struct net *net, {struct rxrpc_local *local;struct rxrpc_net *rxnet =rxrpc_net (net); -struct list_head *cursor; +struct hlist_node *cursor;const char *age;long diff;int ret;
@@ -191,16 +191,12 @@ struct rxrpc_local *rxrpc_lookup_local(struct net *net,mutex_lock (&rxnet->local_mutex); -for (cursor = rxnet->local_endpoints.next; - cursor != &rxnet->local_endpoints; - cursor = cursor->next) { - local = list_entry(cursor, struct rxrpc_local, link); +hlist_for_each (cursor, &rxnet->local_endpoints) { + local = hlist_entry(cursor, struct rxrpc_local, link); diff =rxrpc_local_cmp_key (local, srx); -if (diff <0 ) +if (diff !=0 )continue ; -if (diff >0 ) -break ;/* Services aren't allowed to share transport sockets, so * reject that here. It is possible that the object is dying -
@@ -212,9 +208,10 @@ struct rxrpc_local *rxrpc_lookup_local(struct net *net, goto addr_in_use; } -/* Found a match. We replace a dying object. Attempting to -* bind the transport socket may still fail if we're attempting -* to use a local address that the dying object is still using. +/* Found a match. We want to replace a dying object. +* Attempting to bind the transport socket may still fail if +* we're attempting to use a local address that the dying +* object is still using. */ if (!rxrpc_use_local (local))break ;
@@ -231,10 +228,12 @@ struct rxrpc_local *rxrpc_lookup_local(struct net *net,if (ret <0 ) goto sock_error; -if (cursor != &rxnet->local_endpoints) -list_replace_init (cursor, &local->link); -else -list_add_tail (&local->link, cursor); +if (cursor) { +hlist_replace_rcu (cursor, &local->link); + cursor->pprev =NULL ; + }else { +hlist_add_head_rcu (&local->link, &rxnet->local_endpoints); + } age ="new" ; found:
@@ -375,7 +374,7 @@ static void rxrpc_local_destroyer(struct rxrpc_local *local) local->dead = true;mutex_lock (&rxnet->local_mutex); -list_del_init (&local->link); +hlist_del_init_rcu (&local->link);mutex_unlock (&rxnet->local_mutex);rxrpc_clean_up_local_conns (local);
@@ -462,9 +461,9 @@ void rxrpc_destroy_all_locals(struct rxrpc_net *rxnet)flush_workqueue (rxrpc_workqueue); -if (!list_empty (&rxnet->local_endpoints)) { +if (!hlist_empty (&rxnet->local_endpoints)) {mutex_lock (&rxnet->local_mutex); -list_for_each_entry (local, &rxnet->local_endpoints, link) { +hlist_for_each_entry (local, &rxnet->local_endpoints, link) {pr_err ("AF_RXRPC: Leaked local %p {%d}\n" , local,atomic_read (&local->usage)); }
net/rxrpc/net_ns.c +4 -1
@@ -72,7 +72,7 @@ static __net_init int rxrpc_init_net(struct net *net)timer_setup (&rxnet->client_conn_reap_timer, rxrpc_client_conn_reap_timeout,0 ); -INIT_LIST_HEAD (&rxnet->local_endpoints); +INIT_HLIST_HEAD (&rxnet->local_endpoints);mutex_init (&rxnet->local_mutex);hash_init (rxnet->peer_hash);
@@ -98,6 +98,9 @@ static __net_init int rxrpc_init_net(struct net *net)proc_create_net ("peers" ,0444 , rxnet->proc_net, &rxrpc_peer_seq_ops,sizeof (struct seq_net_private )); +proc_create_net ("locals" ,0444 , rxnet->proc_net, + &rxrpc_local_seq_ops, +sizeof (struct seq_net_private ));return 0 ; err_proc:
net/rxrpc/proc.c +69 -0
72 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 76/206 rxrpc: Use refcount_t rather than atomic_t
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit a05754295e01f006a651eec759c5dbe682ef6cef ]
Move to using refcount_t rather than atomic_t for refcounts in rxrpc.
Stable-dep-of: 3bcd6c7eaa53 ("rxrpc: Fix race between conn bundle lookup and bundle removal [ZDI-CAN-15975]")
--- include/trace/events/rxrpc.h | 2 +- net/rxrpc/af_rxrpc.c | 2 +- net/rxrpc/ar-internal.h | 18 ++++--------- net/rxrpc/call_accept.c | 4 +-- net/rxrpc/call_object.c | 44 ++++++++++++++++---------------- net/rxrpc/conn_client.c | 30 +++++++++++----------- net/rxrpc/conn_object.c | 49 ++++++++++++++++++------------------ net/rxrpc/conn_service.c | 8 +++--- net/rxrpc/input.c | 4 +-- net/rxrpc/local_object.c | 31 ++++++++++++----------- net/rxrpc/peer_object.c | 40 +++++++++++++++-------------- net/rxrpc/proc.c | 8 +++--- net/rxrpc/skbuff.c | 1 - 13 files changed, 119 insertions(+), 122 deletions(-)
include/trace/events/rxrpc.h +1 -1
@@ -583,7 +583,7 @@ TRACE_EVENT(rxrpc_client,TP_fast_assign ( __entry->conn = conn ? conn->debug_id : 0; __entry->channel = channel; - __entry->usage = conn ?atomic_read (&conn->usage) :-2 ; + __entry->usage = conn ?refcount_read (&conn->ref) :-2 ; __entry->op = op; __entry->cid = conn ? conn->proto.cid :0 ; ),
net/rxrpc/af_rxrpc.c +1 -1
@@ -351,7 +351,7 @@ static void rxrpc_dummy_notify_rx(struct sock *sk, struct rxrpc_call *rxcall,*/ void rxrpc_kernel_end_call (struct socket *sock,struct rxrpc_call *call) { -_enter ("%d{%d}" , call->debug_id,atomic_read (&call->usage)); +_enter ("%d{%d}" , call->debug_id,refcount_read (&call->ref));mutex_lock (&call->user_mutex);rxrpc_release_call (rxrpc_sk (sock->sk), call);
net/rxrpc/ar-internal.h +5 -13
@@ -15,14 +15,6 @@#include <keys/rxrpc-type.h> #include "protocol.h" -#if 0 -#define CHECK_SLAB_OKAY (X ) \ - BUG_ON(atomic_read((X)) >> (sizeof(atomic_t) - 2) == \ - (POISON_FREE << 8 | POISON_FREE)) -#else -#define CHECK_SLAB_OKAY (X ) do {} while (0) -#endif -#define FCRYPT_BSIZE 8 struct rxrpc_crypt { union {
@@ -279,7 +271,7 @@ struct rxrpc_security {struct rxrpc_local {struct rcu_head rcu;atomic_t active_users;/* Number of users of the local endpoint */ -atomic_t usage;/* Number of references to the structure */ +refcount_t ref;/* Number of references to the structure */ struct rxrpc_net *rxnet;/* The network ns in which this resides */ struct hlist_node link;struct socket *socket;/* my UDP socket */
@@ -304,7 +296,7 @@ struct rxrpc_local {*/ struct rxrpc_peer {struct rcu_head rcu;/* This must be first */ -atomic_t usage; +refcount_t ref;unsigned long hash_key;struct hlist_node hash_link;struct rxrpc_local *local;
@@ -406,7 +398,7 @@ enum rxrpc_conn_proto_state {*/ struct rxrpc_bundle {struct rxrpc_conn_parameters params; -atomic_t usage; +refcount_t ref;unsigned int debug_id;bool try_upgrade;/* True if the bundle is attempting upgrade */ bool alloc_conn;/* True if someone's getting a conn */
@@ -427,7 +419,7 @@ struct rxrpc_connection {struct rxrpc_conn_proto proto;struct rxrpc_conn_parameters params; -atomic_t usage; +refcount_t ref;struct rcu_head rcu;struct list_head cache_link;
@@ -609,7 +601,7 @@ struct rxrpc_call {int error;/* Local error incurred */ enum rxrpc_call_state state;/* current state of call */ enum rxrpc_call_completion completion;/* Call completion condition */ -atomic_t usage; +refcount_t ref;u16 service_id;/* service ID */ u8 security_ix;/* Security type */ enum rxrpc_interruptibility interruptibility;/* At what point call may be interrupted */
net/rxrpc/call_accept.c +2 -2
@@ -91,7 +91,7 @@ static int rxrpc_service_prealloc_one(struct rxrpc_sock *rx, (head + 1) & (size - 1));trace_rxrpc_conn (conn->debug_id, rxrpc_conn_new_service, -atomic_read (&conn->usage), here); +refcount_read (&conn->ref), here); }/* Now it gets complicated, because calls get registered with the
@@ -104,7 +104,7 @@ static int rxrpc_service_prealloc_one(struct rxrpc_sock *rx, call->state =RXRPC_CALL_SERVER_PREALLOC ;trace_rxrpc_call (call->debug_id, rxrpc_call_new_service, -atomic_read (&call->usage), +refcount_read (&call->ref), here, (const void *)user_call_ID);write_lock (&rx->call_lock);
net/rxrpc/call_object.c +23 -21
138 lines not on this page · raw message
net/rxrpc/conn_client.c +16 -14
@@ -102,7 +102,7 @@ void rxrpc_destroy_client_conn_ids(void)if (!idr_is_empty (&rxrpc_client_conn_ids)) {idr_for_each_entry (&rxrpc_client_conn_ids, conn, id) {pr_err ("AF_RXRPC: Leaked client conn %p {%d}\n" , - conn,atomic_read (&conn->usage)); + conn,refcount_read (&conn->ref)); }BUG (); }
@@ -122,7 +122,7 @@ static struct rxrpc_bundle *rxrpc_alloc_bundle(struct rxrpc_conn_parameters *cp,if (bundle) { bundle->params = *cp;rxrpc_get_peer (bundle->params.peer); -atomic_set (&bundle->usage,1 ); +refcount_set (&bundle->ref,1 );spin_lock_init (&bundle->channel_lock);INIT_LIST_HEAD (&bundle->waiting_calls); }
@@ -131,7 +131,7 @@ static struct rxrpc_bundle *rxrpc_alloc_bundle(struct rxrpc_conn_parameters *cp,struct rxrpc_bundle *rxrpc_get_bundle (struct rxrpc_bundle *bundle) { -atomic_inc (&bundle->usage); +refcount_inc (&bundle->ref);return bundle; }
@@ -144,10 +144,13 @@ static void rxrpc_free_bundle(struct rxrpc_bundle *bundle)void rxrpc_put_bundle (struct rxrpc_bundle *bundle) {unsigned int d = bundle->debug_id; -unsigned int u =atomic_dec_return (&bundle->usage); +bool dead; +int r; -_debug ("PUT B=%x %u" , d, u); -if (u ==0 ) + dead =__refcount_dec_and_test (&bundle->ref, &r); + +_debug ("PUT B=%x %d" , d, r); +if (dead)rxrpc_free_bundle (bundle); }
@@ -169,7 +172,7 @@ rxrpc_alloc_client_connection(struct rxrpc_bundle *bundle, gfp_t gfp)return ERR_PTR (-ENOMEM ); } -atomic_set (&conn->usage,1 ); +refcount_set (&conn->ref,1 ); conn->bundle = bundle; conn->params = bundle->params; conn->out_clientflag =RXRPC_CLIENT_INITIATED ;
@@ -195,7 +198,7 @@ rxrpc_alloc_client_connection(struct rxrpc_bundle *bundle, gfp_t gfp)key_get (conn->params.key);trace_rxrpc_conn (conn->debug_id, rxrpc_conn_new_client, -atomic_read (&conn->usage), +refcount_read (&conn->ref),__builtin_return_address (0 ));atomic_inc (&rxnet->nr_client_conns);
@@ -966,14 +969,13 @@ void rxrpc_put_client_conn(struct rxrpc_connection *conn) {const void *here =__builtin_return_address (0 );unsigned int debug_id = conn->debug_id; -int n; +bool dead; +int r; - n =atomic_dec_return (&conn->usage); -trace_rxrpc_conn (debug_id, rxrpc_conn_put_client, n, here); -if (n <=0 ) { - ASSERTCMP(n, >=, 0); + dead =__refcount_dec_and_test (&conn->ref, &r); +trace_rxrpc_conn (debug_id, rxrpc_conn_put_client, r -1 , here); +if (dead)rxrpc_kill_client_conn (conn); - } }/*
net/rxrpc/conn_object.c +25 -24
134 lines not on this page · raw message
net/rxrpc/conn_service.c +4 -4
@@ -9,7 +9,7 @@#include "ar-internal.h" static struct rxrpc_bundle rxrpc_service_dummy_bundle = { - .usage =ATOMIC_INIT (1 ), + .ref =REFCOUNT_INIT (1 ), .debug_id =UINT_MAX , .channel_lock =__SPIN_LOCK_UNLOCKED (&rxrpc_service_dummy_bundle.channel_lock), };
@@ -99,7 +99,7 @@ static void rxrpc_publish_service_conn(struct rxrpc_peer *peer,return ; found_extant_conn: -if (atomic_read (&cursor->usage) ==0 ) +if (refcount_read (&cursor->ref) ==0 ) goto replace_old_connection;write_sequnlock_bh (&peer->service_conn_lock);/* We should not be able to get here. rxrpc_incoming_connection() is
@@ -132,7 +132,7 @@ struct rxrpc_connection *rxrpc_prealloc_service_connection(struct rxrpc_net *rxn* the rxrpc_connections list. */ conn->state =RXRPC_CONN_SERVICE_PREALLOC ; -atomic_set (&conn->usage,2 ); +refcount_set (&conn->ref,2 ); conn->bundle =rxrpc_get_bundle (&rxrpc_service_dummy_bundle);atomic_inc (&rxnet->nr_conns);
@@ -142,7 +142,7 @@ struct rxrpc_connection *rxrpc_prealloc_service_connection(struct rxrpc_net *rxnwrite_unlock (&rxnet->conn_lock);trace_rxrpc_conn (conn->debug_id, rxrpc_conn_new_service, -atomic_read (&conn->usage), +refcount_read (&conn->ref),__builtin_return_address (0 )); }
net/rxrpc/input.c +1 -3
@@ -1190,8 +1190,6 @@ static void rxrpc_post_packet_to_local(struct rxrpc_local *local,*/ static void rxrpc_reject_packet (struct rxrpc_local *local,struct sk_buff *skb) { -CHECK_SLAB_OKAY (&local->usage); -if (rxrpc_get_local_maybe (local)) {skb_queue_tail (&local->reject_queue, skb);rxrpc_queue_local (local);
@@ -1449,7 +1447,7 @@ int rxrpc_input_packet(struct sock *udp_sk, struct sk_buff *skb) } } -if (!call ||atomic_read (&call->usage) ==0 ) { +if (!call ||refcount_read (&call->ref) ==0 ) {if (rxrpc_to_client (sp) || sp->hdr.type !=RXRPC_PACKET_TYPE_DATA ) goto bad_message;
net/rxrpc/local_object.c +16 -15
@@ -79,7 +79,7 @@ static struct rxrpc_local *rxrpc_alloc_local(struct rxrpc_net *rxnet, local =kzalloc (sizeof (struct rxrpc_local ),GFP_KERNEL );if (local) { -atomic_set (&local->usage,1 ); +refcount_set (&local->ref,1 );atomic_set (&local->active_users,1 ); local->rxnet = rxnet;INIT_HLIST_NODE (&local->link);
@@ -266,10 +266,10 @@ struct rxrpc_local *rxrpc_lookup_local(struct net *net,struct rxrpc_local *rxrpc_get_local (struct rxrpc_local *local) {const void *here =__builtin_return_address (0 ); -int n; +int r; - n =atomic_inc_return (&local->usage); -trace_rxrpc_local (local->debug_id, rxrpc_local_got, n, here); +__refcount_inc (&local->ref, &r); +trace_rxrpc_local (local->debug_id, rxrpc_local_got, r +1 , here);return local; }
@@ -279,12 +279,12 @@ struct rxrpc_local *rxrpc_get_local(struct rxrpc_local *local)struct rxrpc_local *rxrpc_get_local_maybe (struct rxrpc_local *local) {const void *here =__builtin_return_address (0 ); +int r;if (local) { -int n =atomic_fetch_add_unless (&local->usage,1 ,0 ); -if (n >0 ) +if (__refcount_inc_not_zero (&local->ref, &r))trace_rxrpc_local (local->debug_id, rxrpc_local_got, - n +1 , here); + r +1 , here);else local =NULL ; }
@@ -298,10 +298,10 @@ void rxrpc_queue_local(struct rxrpc_local *local) {const void *here =__builtin_return_address (0 );unsigned int debug_id = local->debug_id; -int n =atomic_read (&local->usage); +int r =refcount_read (&local->ref);if (rxrpc_queue_work (&local->processor)) -trace_rxrpc_local (debug_id, rxrpc_local_queued, n, here); +trace_rxrpc_local (debug_id, rxrpc_local_queued, r +1 , here);else rxrpc_put_local (local); }
@@ -313,15 +313,16 @@ void rxrpc_put_local(struct rxrpc_local *local) {const void *here =__builtin_return_address (0 );unsigned int debug_id; -int n; +bool dead; +int r;if (local) { debug_id = local->debug_id; - n =atomic_dec_return (&local->usage); -trace_rxrpc_local (debug_id, rxrpc_local_put, n, here); + dead =__refcount_dec_and_test (&local->ref, &r); +trace_rxrpc_local (debug_id, rxrpc_local_put, r, here); -if (n ==0 ) +if (dead)call_rcu (&local->rcu, rxrpc_local_rcu); } }
@@ -409,7 +410,7 @@ static void rxrpc_local_processor(struct work_struct *work)return ;trace_rxrpc_local (local->debug_id, rxrpc_local_processing, -atomic_read (&local->usage),NULL ); +refcount_read (&local->ref),NULL ); do { again = false;
@@ -465,7 +466,7 @@ void rxrpc_destroy_all_locals(struct rxrpc_net *rxnet)mutex_lock (&rxnet->local_mutex);hlist_for_each_entry (local, &rxnet->local_endpoints, link) {pr_err ("AF_RXRPC: Leaked local %p {%d}\n" , - local,atomic_read (&local->usage)); + local,refcount_read (&local->ref)); }mutex_unlock (&rxnet->local_mutex);BUG ();
net/rxrpc/peer_object.c +21 -19
@@ -121,7 +121,7 @@ static struct rxrpc_peer *__rxrpc_lookup_peer_rcu(hash_for_each_possible_rcu (rxnet->peer_hash, peer, hash_link, hash_key) {if (rxrpc_peer_cmp_key (peer, local, srx, hash_key) ==0 && -atomic_read (&peer->usage) >0 ) +refcount_read (&peer->ref) >0 )return peer; }
@@ -140,7 +140,7 @@ struct rxrpc_peer *rxrpc_lookup_peer_rcu(struct rxrpc_local *local, peer =__rxrpc_lookup_peer_rcu (local, srx, hash_key);if (peer) {_net ("PEER %d {%pISp}" , peer->debug_id, &peer->srx.transport); -_leave (" = %p {u=%d}" , peer,atomic_read (&peer->usage)); +_leave (" = %p {u=%d}" , peer,refcount_read (&peer->ref)); }return peer; }
@@ -216,7 +216,7 @@ struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *local, gfp_t gfp) peer =kzalloc (sizeof (struct rxrpc_peer ), gfp);if (peer) { -atomic_set (&peer->usage,1 ); +refcount_set (&peer->ref,1 ); peer->local =rxrpc_get_local (local);INIT_HLIST_HEAD (&peer->error_targets); peer->service_conns =RB_ROOT ;
@@ -378,7 +378,7 @@ struct rxrpc_peer *rxrpc_lookup_peer(struct rxrpc_sock *rx,_net ("PEER %d {%pISp}" , peer->debug_id, &peer->srx.transport); -_leave (" = %p {u=%d}" , peer,atomic_read (&peer->usage)); +_leave (" = %p {u=%d}" , peer,refcount_read (&peer->ref));return peer; }
@@ -388,10 +388,10 @@ struct rxrpc_peer *rxrpc_lookup_peer(struct rxrpc_sock *rx,struct rxrpc_peer *rxrpc_get_peer (struct rxrpc_peer *peer) {const void *here =__builtin_return_address (0 ); -int n; +int r; - n =atomic_inc_return (&peer->usage); -trace_rxrpc_peer (peer->debug_id, rxrpc_peer_got, n, here); +__refcount_inc (&peer->ref, &r); +trace_rxrpc_peer (peer->debug_id, rxrpc_peer_got, r +1 , here);return peer; }
@@ -401,11 +401,11 @@ struct rxrpc_peer *rxrpc_get_peer(struct rxrpc_peer *peer)struct rxrpc_peer *rxrpc_get_peer_maybe (struct rxrpc_peer *peer) {const void *here =__builtin_return_address (0 ); +int r;if (peer) { -int n =atomic_fetch_add_unless (&peer->usage,1 ,0 ); -if (n >0 ) -trace_rxrpc_peer (peer->debug_id, rxrpc_peer_got, n +1 , here); +if (__refcount_inc_not_zero (&peer->ref, &r)) +trace_rxrpc_peer (peer->debug_id, rxrpc_peer_got, r +1 , here);else peer =NULL ; }
@@ -436,13 +436,14 @@ void rxrpc_put_peer(struct rxrpc_peer *peer) {const void *here =__builtin_return_address (0 );unsigned int debug_id; -int n; +bool dead; +int r;if (peer) { debug_id = peer->debug_id; - n =atomic_dec_return (&peer->usage); -trace_rxrpc_peer (debug_id, rxrpc_peer_put, n, here); -if (n ==0 ) + dead =__refcount_dec_and_test (&peer->ref, &r); +trace_rxrpc_peer (debug_id, rxrpc_peer_put, r -1 , here); +if (dead)__rxrpc_put_peer (peer); } }
@@ -455,11 +456,12 @@ void rxrpc_put_peer_locked(struct rxrpc_peer *peer) {const void *here =__builtin_return_address (0 );unsigned int debug_id = peer->debug_id; -int n; +bool dead; +int r; - n =atomic_dec_return (&peer->usage); -trace_rxrpc_peer (debug_id, rxrpc_peer_put, n, here); -if (n ==0 ) { + dead =__refcount_dec_and_test (&peer->ref, &r); +trace_rxrpc_peer (debug_id, rxrpc_peer_put, r -1 , here); +if (dead) {hash_del_rcu (&peer->hash_link);list_del_init (&peer->keepalive_link);rxrpc_free_peer (peer);
@@ -481,7 +483,7 @@ void rxrpc_destroy_all_peers(struct rxrpc_net *rxnet)hlist_for_each_entry (peer, &rxnet->peer_hash[i], hash_link) {pr_err ("Leaked peer %u {%u} %pISp\n" , peer->debug_id, -atomic_read (&peer->usage), +refcount_read (&peer->ref), &peer->srx.transport); } }
net/rxrpc/proc.c +4 -4
@@ -101,7 +101,7 @@ static int rxrpc_call_seq_show(struct seq_file *seq, void *v) call->cid, call->call_id,rxrpc_is_service_call (call) ?"Svc" :"Clt" , -atomic_read (&call->usage), +refcount_read (&call->ref), rxrpc_call_states[call->state], call->abort_code, call->debug_id,
@@ -183,7 +183,7 @@ static int rxrpc_connection_seq_show(struct seq_file *seq, void *v) conn->service_id, conn->proto.cid,rxrpc_conn_is_service (conn) ?"Svc" :"Clt" , -atomic_read (&conn->usage), +refcount_read (&conn->ref), rxrpc_conn_states[conn->state],key_serial (conn->params.key), atomic_read(&conn->serial),
@@ -233,7 +233,7 @@ static int rxrpc_peer_seq_show(struct seq_file *seq, void *v)" %3u %5u %6llus %8u %8u\n" , lbuff, rbuff, -atomic_read (&peer->usage), +refcount_read (&peer->ref), peer->cong_cwnd, peer->mtu, now - peer->last_tx_at,
@@ -351,7 +351,7 @@ static int rxrpc_local_seq_show(struct seq_file *seq, void *v)seq_printf (seq,"UDP %-47.47s %3u %3u\n" , lbuff, -atomic_read (&local->usage), +refcount_read (&local->ref),atomic_read (&local->active_users));return 0 ;
net/rxrpc/skbuff.c +0 -1
@@ -71,7 +71,6 @@ void rxrpc_free_skb(struct sk_buff *skb, enum rxrpc_skb_trace op)const void *here =__builtin_return_address (0 );if (skb) {int n; -CHECK_SLAB_OKAY (&skb->users); n =atomic_dec_return (select_skb_count (skb));trace_rxrpc_skb (skb, op,refcount_read (&skb->users), n,rxrpc_skb (skb)->rx_flags, here);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 77/206 rxrpc: Fix race between conn bundle lookup and bundle removal [ZDI-CAN-15975]
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 3bcd6c7eaa53b56c3f584da46a1f7652e759d0e5 ]
After rxrpc_unbundle_conn() has removed a connection from a bundle, it checks to see if there are any conns with available channels and, if not, removes and attempts to destroy the bundle.
Whilst it does check after grabbing client_bundles_lock that there are no connections attached, this races with rxrpc_look_up_bundle() retrieving the bundle, but not attaching a connection for the connection to be attached later.
There is therefore a window in which the bundle can get destroyed before we manage to attach a new connection to it.
Fix this by adding an "active" counter to struct rxrpc_bundle:
(1) rxrpc_connect_call() obtains an active count by prepping/looking up a bundle and ditches it before returning.
(2) If, during rxrpc_connect_call(), a connection is added to the bundle, this obtains an active count, which is held until the connection is discarded.
(3) rxrpc_deactivate_bundle() is created to drop an active count on a bundle and destroy it when the active count reaches 0. The active count is checked inside client_bundles_lock() to prevent a race with rxrpc_look_up_bundle().
(4) rxrpc_unbundle_conn() then calls rxrpc_deactivate_bundle().
--- net/rxrpc/ar-internal.h | 1 + net/rxrpc/conn_client.c | 38 +++++++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 15 deletions(-)
net/rxrpc/ar-internal.h +1 -0
@@ -399,6 +399,7 @@ enum rxrpc_conn_proto_state {struct rxrpc_bundle {struct rxrpc_conn_parameters params;refcount_t ref; +atomic_t active;/* Number of active users */ unsigned int debug_id;bool try_upgrade;/* True if the bundle is attempting upgrade */ bool alloc_conn;/* True if someone's getting a conn */
net/rxrpc/conn_client.c +23 -15
@@ -40,6 +40,8 @@ __read_mostly unsigned long rxrpc_conn_idle_client_fast_expiry = 2 * HZ;DEFINE_IDR (rxrpc_client_conn_ids);static DEFINE_SPINLOCK (rxrpc_conn_id_lock); +static void rxrpc_deactivate_bundle (struct rxrpc_bundle *bundle); +/* * Get a connection ID and epoch for a client connection from the global pool. * The connection struct pointer is then recorded in the idr radix tree. The
@@ -123,6 +125,7 @@ static struct rxrpc_bundle *rxrpc_alloc_bundle(struct rxrpc_conn_parameters *cp, bundle->params = *cp;rxrpc_get_peer (bundle->params.peer);refcount_set (&bundle->ref,1 ); +atomic_set (&bundle->active,1 );spin_lock_init (&bundle->channel_lock);INIT_LIST_HEAD (&bundle->waiting_calls); }
@@ -149,7 +152,7 @@ void rxrpc_put_bundle(struct rxrpc_bundle *bundle) dead =__refcount_dec_and_test (&bundle->ref, &r); -_debug ("PUT B=%x %d" , d, r); +_debug ("PUT B=%x %d" , d, r -1 );if (dead)rxrpc_free_bundle (bundle); }
@@ -338,6 +341,7 @@ static struct rxrpc_bundle *rxrpc_look_up_bundle(struct rxrpc_conn_parameters *crxrpc_free_bundle (candidate); found_bundle:rxrpc_get_bundle (bundle); +atomic_inc (&bundle->active);spin_unlock (&local->client_bundles_lock);_leave (" = %u [found]" , bundle->debug_id);return bundle;
@@ -435,6 +439,7 @@ static void rxrpc_add_conn_to_bundle(struct rxrpc_bundle *bundle, gfp_t gfp)if (old)trace_rxrpc_client (old,-1 , rxrpc_client_replace); candidate->bundle_shift = shift; +atomic_inc (&bundle->active); bundle->conns[i] = candidate;for (j =0 ; j <RXRPC_MAXCALLS ; j++)set_bit (shift + j, &bundle->avail_chans);
@@ -725,6 +730,7 @@ int rxrpc_connect_call(struct rxrpc_sock *rx,smp_rmb (); out_put_bundle: +rxrpc_deactivate_bundle (bundle);rxrpc_put_bundle (bundle); out:_leave (" = %d" , ret);
@@ -900,9 +906,8 @@ void rxrpc_disconnect_client_call(struct rxrpc_bundle *bundle, struct rxrpc_callstatic void rxrpc_unbundle_conn (struct rxrpc_connection *conn) {struct rxrpc_bundle *bundle = conn->bundle; -struct rxrpc_local *local = bundle->params.local;unsigned int bindex; -bool need_drop = false, need_put = false; +bool need_drop = false;int i;_enter ("C=%x" , conn->debug_id);
@@ -921,15 +926,22 @@ static void rxrpc_unbundle_conn(struct rxrpc_connection *conn) }spin_unlock (&bundle->channel_lock); -/* If there are no more connections, remove the bundle */ -if (!bundle->avail_chans) { -_debug ("maybe unbundle" ); -spin_lock (&local->client_bundles_lock); +if (need_drop) { +rxrpc_deactivate_bundle (bundle); +rxrpc_put_connection (conn); + } +} -for (i =0 ; i <ARRAY_SIZE (bundle->conns); i++) -if (bundle->conns[i]) -break ; -if (i ==ARRAY_SIZE (bundle->conns) && !bundle->params.exclusive) { +/* +* Drop the active count on a bundle. +*/ +static void rxrpc_deactivate_bundle (struct rxrpc_bundle *bundle) +{ +struct rxrpc_local *local = bundle->params.local; +bool need_put = false; + +if (atomic_dec_and_lock (&bundle->active, &local->client_bundles_lock)) { +if (!bundle->params.exclusive) {_debug ("erase bundle" );rb_erase (&bundle->local_node, &local->client_bundles); need_put = true;
@@ -939,10 +951,6 @@ static void rxrpc_unbundle_conn(struct rxrpc_connection *conn)if (need_put)rxrpc_put_bundle (bundle); } - -if (need_drop) -rxrpc_put_connection (conn); -_leave ("" ); }/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 78/206 net: dsa: sja1105: disallow C45 transactions on the BASE-TX MDIO bus
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 24deec6b9e4a051635f75777844ffc184644fec9 ]
You'd think people know that the internal 100BASE-TX PHY on the SJA1110 responds only to clause 22 MDIO transactions, but they don't :)
When a clause 45 transaction is attempted, sja1105_base_tx_mdio_read() and sja1105_base_tx_mdio_write() don't expect "reg" to contain bit 30 set (MII_ADDR_C45) and pack this value into the SPI transaction buffer.
But the field in the SPI buffer has a width smaller than 30 bits, so we see this confusing message from the packing() API rather than a proper rejection of C45 transactions:
Call trace: dump_stack+0x1c/0x38 sja1105_pack+0xbc/0xc0 [sja1105] sja1105_xfer+0x114/0x2b0 [sja1105] sja1105_xfer_u32+0x44/0xf4 [sja1105] sja1105_base_tx_mdio_read+0x44/0x7c [sja1105] mdiobus_read+0x44/0x80 get_phy_c45_ids+0x70/0x234 get_phy_device+0x68/0x15c fwnode_mdiobus_register_phy+0x74/0x240 of_mdiobus_register+0x13c/0x380 sja1105_mdiobus_register+0x368/0x490 [sja1105] sja1105_setup+0x94/0x119c [sja1105]
Cannot store 401d2405 inside bits 24-4 (would truncate)
--- drivers/net/dsa/sja1105/sja1105_mdio.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/dsa/sja1105/sja1105_mdio.c +6 -0
@@ -256,6 +256,9 @@ static int sja1105_base_tx_mdio_read(struct mii_bus *bus, int phy, int reg)u32 tmp;int rc; +if (reg &MII_ADDR_C45 ) +return -EOPNOTSUPP ; + rc =sja1105_xfer_u32 (priv,SPI_READ , regs->mdio_100base_tx + reg, &tmp,NULL );if (rc <0 )
@@ -272,6 +275,9 @@ static int sja1105_base_tx_mdio_write(struct mii_bus *bus, int phy, int reg,const struct sja1105_regs *regs = priv->info->regs;u32 tmp = val; +if (reg &MII_ADDR_C45 ) +return -EOPNOTSUPP ; +return sja1105_xfer_u32 (priv,SPI_WRITE , regs->mdio_100base_tx + reg, &tmp,NULL ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 79/206 nfc/nci: fix race with opening and closing
In reply to Greg Kroah-HartmanFrom: Lin Ma <[email protected]>
[ Upstream commit 0ad6bded175e829c2ca261529c9dce39a32a042d ]
Previously we leverage NCI_UNREG and the lock inside nci_close_device to prevent the race condition between opening a device and closing a device. However, it still has problem because a failed opening command will erase the NCI_UNREG flag and allow another opening command to bypass the status checking.
This fix corrects that by making sure the NCI_UNREG is held.
--- net/nfc/nci/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/nfc/nci/core.c +1 -1
@@ -542,7 +542,7 @@ static int nci_open_device(struct nci_dev *ndev)skb_queue_purge (&ndev->tx_q); ndev->ops->close (ndev); - ndev->flags =0 ; + ndev->flags &=BIT (NCI_UNREG ); } done:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 80/206 net: pch_gbe: fix potential memleak in pch_gbe_tx_queue()
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit 2360f9b8c4e81d242d4cbf99d630a2fffa681fab ]
In pch_gbe_xmit_frame(), NETDEV_TX_OK will be returned whether pch_gbe_tx_queue() sends data successfully or not, so pch_gbe_tx_queue() needs to free skb before returning. But pch_gbe_tx_queue() returns without freeing skb in case of dma_map_single() fails. Add dev_kfree_skb_any() to fix it.
--- drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +1 -0
@@ -1148,6 +1148,7 @@ static void pch_gbe_tx_queue(struct pch_gbe_adapter *adapter, buffer_info->dma =0 ; buffer_info->time_stamp =0 ; tx_ring->next_to_use = ring_num; +dev_kfree_skb_any (skb);return ; } buffer_info->mapped = true;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 81/206 9p/fd: fix issue of list_del corruption in p9_fd_cancel()
In reply to Greg Kroah-HartmanFrom: Zhengchao Shao <[email protected]>
[ Upstream commit 11c10956515b8ec44cf4f2a7b9d8bf8b9dc05ec4 ]
Syz reported the following issue:
kernel BUG at lib/list_debug.c:53!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
RIP: 0010:__list_del_entry_valid.cold+0x5c/0x72 Call Trace: <TASK> p9_fd_cancel+0xb1/0x270 p9_client_rpc+0x8ea/0xba0 p9_client_create+0x9c0/0xed0 v9fs_session_init+0x1e0/0x1620 v9fs_mount+0xba/0xb80 legacy_get_tree+0x103/0x200 vfs_get_tree+0x89/0x2d0 path_mount+0x4c0/0x1ac0 __x64_sys_mount+0x33b/0x430 do_syscall_64+0x35/0x80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 </TASK>
The process is as follows:
Thread A: Thread B:p9_poll_workfn() p9_client_create()
... ...
p9_conn_cancel() p9_fd_cancel()
list_del() ...
... list_del() //list_del
corruption
There is no lock protection when deleting list in p9_conn_cancel(). After deleting list in Thread A, thread B will delete the same list again. It will cause issue of list_del corruption.
Setting req->status to REQ_STATUS_ERROR under lock prevents other cleanup paths from trying to manipulate req_list.
The other thread can safely check req->status because it still holds a reference to req at this point.
--- net/9p/trans_fd.c | 2 ++ 1 file changed, 2 insertions(+)
net/9p/trans_fd.c +2 -0
@@ -204,9 +204,11 @@ static void p9_conn_cancel(struct p9_conn *m, int err)list_for_each_entry_safe (req, rtmp, &m->req_list, req_list) {list_move (&req->req_list, &cancel_list); + req->status =REQ_STATUS_ERROR ; }list_for_each_entry_safe (req, rtmp, &m->unsent_req_list, req_list) {list_move (&req->req_list, &cancel_list); + req->status =REQ_STATUS_ERROR ; }spin_unlock (&m->req_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 82/206 netfilter: conntrack: Fix data-races around ct mark
In reply to Greg Kroah-HartmanFrom: Daniel Xu <[email protected]>
[ Upstream commit 52d1aa8b8249ff477aaa38b6f74a8ced780d079c ]
nf_conn:mark can be read from and written to in parallel. Use READ_ONCE()/WRITE_ONCE() for reads and writes to prevent unwanted compiler optimizations.
--- net/core/flow_dissector.c | 2 +- net/ipv4/netfilter/ipt_CLUSTERIP.c | 4 ++-- net/netfilter/nf_conntrack_core.c | 2 +- net/netfilter/nf_conntrack_netlink.c | 24 ++++++++++++++---------- net/netfilter/nf_conntrack_standalone.c | 2 +- net/netfilter/nft_ct.c | 6 +++--- net/netfilter/xt_connmark.c | 18 ++++++++++-------- net/openvswitch/conntrack.c | 8 ++++---- net/sched/act_connmark.c | 4 ++-- net/sched/act_ct.c | 8 ++++---- net/sched/act_ctinfo.c | 6 +++--- 11 files changed, 45 insertions(+), 39 deletions(-)
net/core/flow_dissector.c +1 -1
@@ -270,7 +270,7 @@ skb_flow_dissect_ct(const struct sk_buff *skb, key->ct_zone = ct->zone.id;#endif #if IS_ENABLED (CONFIG_NF_CONNTRACK_MARK ) - key->ct_mark = ct->mark; + key->ct_mark =READ_ONCE (ct->mark);#endif cl =nf_ct_labels_find (ct);
net/ipv4/netfilter/ipt_CLUSTERIP.c +2 -2
@@ -435,7 +435,7 @@ clusterip_tg(struct sk_buff *skb, const struct xt_action_param *par)switch (ctinfo) {case IP_CT_NEW : - ct->mark = hash; +WRITE_ONCE (ct->mark, hash);break ;case IP_CT_RELATED :case IP_CT_RELATED_REPLY :
@@ -452,7 +452,7 @@ clusterip_tg(struct sk_buff *skb, const struct xt_action_param *par)#ifdef DEBUG nf_ct_dump_tuple_ip (&ct->tuplehash[IP_CT_DIR_ORIGINAL ].tuple);#endif -pr_debug ("hash=%u ct_hash=%u " , hash, ct->mark); +pr_debug ("hash=%u ct_hash=%u " , hash,READ_ONCE (ct->mark));if (!clusterip_responsible (cipinfo->config, hash)) {pr_debug ("not responsible\n" );return NF_DROP ;
net/netfilter/nf_conntrack_core.c +1 -1
@@ -1735,7 +1735,7 @@ init_conntrack(struct net *net, struct nf_conn *tmpl, }#ifdef CONFIG_NF_CONNTRACK_MARK - ct->mark = exp->master->mark; + ct->mark =READ_ONCE (exp->master->mark);#endif #ifdef CONFIG_NF_CONNTRACK_SECMARK ct->secmark = exp->master->secmark;
net/netfilter/nf_conntrack_netlink.c +14 -10
@@ -322,9 +322,9 @@ ctnetlink_dump_timestamp(struct sk_buff *skb, const struct nf_conn *ct) }#ifdef CONFIG_NF_CONNTRACK_MARK -static int ctnetlink_dump_mark (struct sk_buff *skb,const struct nf_conn *ct) +static int ctnetlink_dump_mark (struct sk_buff *skb,u32 mark) { -if (nla_put_be32 (skb,CTA_MARK ,htonl (ct->mark))) +if (nla_put_be32 (skb,CTA_MARK ,htonl (mark))) goto nla_put_failure;return 0 ;
@@ -537,7 +537,7 @@ static int ctnetlink_dump_extinfo(struct sk_buff *skb,static int ctnetlink_dump_info (struct sk_buff *skb,struct nf_conn *ct) { if (ctnetlink_dump_status(skb, ct) < 0 || - ctnetlink_dump_mark(skb, ct) < 0 || + ctnetlink_dump_mark(skb, READ_ONCE(ct->mark)) < 0 || ctnetlink_dump_secctx(skb, ct) < 0 || ctnetlink_dump_id(skb, ct) < 0 || ctnetlink_dump_use(skb, ct) < 0 ||
@@ -716,6 +716,7 @@ ctnetlink_conntrack_event(unsigned int events, const struct nf_ct_event *item)struct sk_buff *skb;unsigned int type;unsigned int flags =0 , group; +u32 mark;int err;if (events & (1 <<IPCT_DESTROY )) {
@@ -820,8 +821,9 @@ ctnetlink_conntrack_event(unsigned int events, const struct nf_ct_event *item) }#ifdef CONFIG_NF_CONNTRACK_MARK -if ((events & (1 <<IPCT_MARK ) || ct->mark) - &&ctnetlink_dump_mark (skb, ct) <0 ) + mark =READ_ONCE (ct->mark); +if ((events & (1 <<IPCT_MARK ) || mark) && +ctnetlink_dump_mark (skb, mark) <0 ) goto nla_put_failure;#endif nlmsg_end (skb, nlh);
@@ -1148,7 +1150,7 @@ static int ctnetlink_filter_match(struct nf_conn *ct, void *data) }#ifdef CONFIG_NF_CONNTRACK_MARK -if ((ct->mark & filter->mark.mask) != filter->mark.val) +if ((READ_ONCE (ct->mark) & filter->mark.mask) != filter->mark.val) goto ignore_entry;#endif status = (u32 )READ_ONCE (ct->status);
@@ -2016,9 +2018,9 @@ static void ctnetlink_change_mark(struct nf_conn *ct, mask = ~ntohl (nla_get_be32 (cda[CTA_MARK_MASK ])); mark =ntohl (nla_get_be32 (cda[CTA_MARK ])); - newmark = (ct->mark & mask) ^ mark; -if (newmark != ct->mark) - ct->mark = newmark; + newmark = (READ_ONCE (ct->mark) & mask) ^ mark; +if (newmark !=READ_ONCE (ct->mark)) + WRITE_ONCE(ct->mark, newmark); }#endif
@@ -2690,6 +2692,7 @@ static int __ctnetlink_glue_build(struct sk_buff *skb, struct nf_conn *ct) {const struct nf_conntrack_zone *zone;struct nlattr *nest_parms; +u32 mark; zone =nf_ct_zone (ct);
@@ -2751,7 +2754,8 @@ static int __ctnetlink_glue_build(struct sk_buff *skb, struct nf_conn *ct) goto nla_put_failure;#ifdef CONFIG_NF_CONNTRACK_MARK -if (ct->mark &&ctnetlink_dump_mark (skb, ct) <0 ) + mark =READ_ONCE (ct->mark); +if (mark &&ctnetlink_dump_mark (skb, mark) <0 ) goto nla_put_failure;#endif if (ctnetlink_dump_labels (skb, ct) <0 )
net/netfilter/nf_conntrack_standalone.c +1 -1
@@ -363,7 +363,7 @@ static int ct_seq_show(struct seq_file *s, void *v) goto release;#if defined(CONFIG_NF_CONNTRACK_MARK ) -seq_printf (s,"mark=%u " , ct->mark); +seq_printf (s,"mark=%u " ,READ_ONCE (ct->mark));#endif ct_show_secctx (s, ct);
net/netfilter/nft_ct.c +3 -3
@@ -97,7 +97,7 @@ static void nft_ct_get_eval(const struct nft_expr *expr,return ;#ifdef CONFIG_NF_CONNTRACK_MARK case NFT_CT_MARK : - *dest = ct->mark; + *dest =READ_ONCE (ct->mark);return ;#endif #ifdef CONFIG_NF_CONNTRACK_SECMARK
@@ -296,8 +296,8 @@ static void nft_ct_set_eval(const struct nft_expr *expr,switch (priv->key) {#ifdef CONFIG_NF_CONNTRACK_MARK case NFT_CT_MARK : -if (ct->mark != value) { - ct->mark = value; +if (READ_ONCE (ct->mark) != value) { +WRITE_ONCE (ct->mark, value);nf_conntrack_event_cache (IPCT_MARK , ct); }break ;
net/netfilter/xt_connmark.c +10 -8
@@ -30,6 +30,7 @@ connmark_tg_shift(struct sk_buff *skb, const struct xt_connmark_tginfo2 *info)u_int32_t new_targetmark;struct nf_conn *ct;u_int32_t newmark; +u_int32_t oldmark; ct =nf_ct_get (skb, &ctinfo);if (ct ==NULL )
@@ -37,14 +38,15 @@ connmark_tg_shift(struct sk_buff *skb, const struct xt_connmark_tginfo2 *info)switch (info->mode) {case XT_CONNMARK_SET : - newmark = (ct->mark & ~info->ctmask) ^ info->ctmark; + oldmark =READ_ONCE (ct->mark); + newmark = (oldmark & ~info->ctmask) ^ info->ctmark;if (info->shift_dir ==D_SHIFT_RIGHT ) newmark >>= info->shift_bits;else newmark <<= info->shift_bits; -if (ct->mark != newmark) { - ct->mark = newmark; +if (READ_ONCE (ct->mark) != newmark) { +WRITE_ONCE (ct->mark, newmark);nf_conntrack_event_cache (IPCT_MARK , ct); }break ;
@@ -55,15 +57,15 @@ connmark_tg_shift(struct sk_buff *skb, const struct xt_connmark_tginfo2 *info)else new_targetmark <<= info->shift_bits; - newmark = (ct->mark & ~info->ctmask) ^ + newmark = (READ_ONCE (ct->mark) & ~info->ctmask) ^ new_targetmark; -if (ct->mark != newmark) { - ct->mark = newmark; +if (READ_ONCE (ct->mark) != newmark) { +WRITE_ONCE (ct->mark, newmark);nf_conntrack_event_cache (IPCT_MARK , ct); }break ;case XT_CONNMARK_RESTORE : - new_targetmark = (ct->mark & info->ctmask); + new_targetmark = (READ_ONCE (ct->mark) & info->ctmask);if (info->shift_dir ==D_SHIFT_RIGHT ) new_targetmark >>= info->shift_bits;else
@@ -126,7 +128,7 @@ connmark_mt(const struct sk_buff *skb, struct xt_action_param *par)if (ct ==NULL )return false; -return ((ct->mark & info->mask) == info->mark) ^ info->invert; +return ((READ_ONCE (ct->mark) & info->mask) == info->mark) ^ info->invert; }static int connmark_mt_check (const struct xt_mtchk_param *par)
net/openvswitch/conntrack.c +4 -4
@@ -150,7 +150,7 @@ static u8 ovs_ct_get_state(enum ip_conntrack_info ctinfo)static u32 ovs_ct_get_mark (const struct nf_conn *ct) {#if IS_ENABLED (CONFIG_NF_CONNTRACK_MARK ) -return ct ? ct->mark :0 ; +return ct ?READ_ONCE (ct->mark) :0 ;#else return 0 ;#endif
@@ -338,9 +338,9 @@ static int ovs_ct_set_mark(struct nf_conn *ct, struct sw_flow_key *key,#if IS_ENABLED (CONFIG_NF_CONNTRACK_MARK )u32 new_mark; - new_mark = ct_mark | (ct->mark & ~(mask)); -if (ct->mark != new_mark) { - ct->mark = new_mark; + new_mark = ct_mark | (READ_ONCE (ct->mark) & ~(mask)); +if (READ_ONCE (ct->mark) != new_mark) { +WRITE_ONCE (ct->mark, new_mark);if (nf_ct_is_confirmed (ct))nf_conntrack_event_cache (IPCT_MARK , ct); key->ct.mark = new_mark;
net/sched/act_connmark.c +2 -2
@@ -62,7 +62,7 @@ static int tcf_connmark_act(struct sk_buff *skb, const struct tc_action *a, c =nf_ct_get (skb, &ctinfo);if (c) { - skb->mark = c->mark; + skb->mark =READ_ONCE (c->mark);/* using overlimits stats to count how many packets marked */ ca->tcf_qstats.overlimits++; goto out;
@@ -82,7 +82,7 @@ static int tcf_connmark_act(struct sk_buff *skb, const struct tc_action *a, c =nf_ct_tuplehash_to_ctrack (thash);/* using overlimits stats to count how many packets marked */ ca->tcf_qstats.overlimits++; - skb->mark = c->mark; + skb->mark =READ_ONCE (c->mark);nf_ct_put (c); out:
net/sched/act_ct.c +4 -4
@@ -177,7 +177,7 @@ static void tcf_ct_flow_table_add_action_meta(struct nf_conn *ct, entry =tcf_ct_flow_table_flow_action_get_next (action); entry->id =FLOW_ACTION_CT_METADATA ;#if IS_ENABLED (CONFIG_NF_CONNTRACK_MARK ) - entry->ct_metadata.mark = ct->mark; + entry->ct_metadata.mark =READ_ONCE (ct->mark);#endif ctinfo = dir ==IP_CT_DIR_ORIGINAL ?IP_CT_ESTABLISHED :IP_CT_ESTABLISHED_REPLY ;
@@ -856,9 +856,9 @@ static void tcf_ct_act_set_mark(struct nf_conn *ct, u32 mark, u32 mask)if (!mask)return ; - new_mark = mark | (ct->mark & ~(mask)); -if (ct->mark != new_mark) { - ct->mark = new_mark; + new_mark = mark | (READ_ONCE (ct->mark) & ~(mask)); +if (READ_ONCE (ct->mark) != new_mark) { +WRITE_ONCE (ct->mark, new_mark);if (nf_ct_is_confirmed (ct))nf_conntrack_event_cache (IPCT_MARK , ct); }
net/sched/act_ctinfo.c +3 -3
@@ -33,7 +33,7 @@ static void tcf_ctinfo_dscp_set(struct nf_conn *ct, struct tcf_ctinfo *ca, {u8 dscp, newdscp; - newdscp = (((ct->mark & cp->dscpmask) >> cp->dscpmaskshift) <<2 ) & + newdscp = (((READ_ONCE (ct->mark) & cp->dscpmask) >> cp->dscpmaskshift) <<2 ) & ~INET_ECN_MASK ;switch (proto) {
@@ -73,7 +73,7 @@ static void tcf_ctinfo_cpmark_set(struct nf_conn *ct, struct tcf_ctinfo *ca, struct sk_buff *skb) { ca->stats_cpmark_set++; - skb->mark = ct->mark & cp->cpmarkmask; + skb->mark =READ_ONCE (ct->mark) & cp->cpmarkmask; } static int tcf_ctinfo_act(struct sk_buff *skb, const struct tc_action *a,
@@ -131,7 +131,7 @@ static int tcf_ctinfo_act(struct sk_buff *skb, const struct tc_action *a, }if (cp->mode &CTINFO_MODE_DSCP ) -if (!cp->dscpstatemask || (ct->mark & cp->dscpstatemask)) +if (!cp->dscpstatemask || (READ_ONCE (ct->mark) & cp->dscpstatemask))tcf_ctinfo_dscp_set (ct, ca, cp, skb, wlen, proto);if (cp->mode &CTINFO_MODE_CPMARK )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 83/206 netfilter: nf_tables: do not set up extensions for end interval
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 33c7aba0b4ffd6d7cdab862a034eb582a5120a38 ]
Elements with an end interval flag set on do not store extensions. The global set definition is currently setting on the timeout and stateful expression for end interval elements.
This leads to skipping end interval elements from the set->ops->walk() path as the expired check bogusly reports true.
Moreover, do not set up stateful expressions for elements with end interval flag set on since this is never used.
--- net/netfilter/nf_tables_api.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/netfilter/nf_tables_api.c +4 -2
@@ -5813,7 +5813,8 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set, &timeout);if (err)return err; - }else if (set->flags &NFT_SET_TIMEOUT ) { + }else if (set->flags &NFT_SET_TIMEOUT && + !(flags &NFT_SET_ELEM_INTERVAL_END )) { timeout = set->timeout; }
@@ -5879,7 +5880,8 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set, err = -EOPNOTSUPP ; goto err_set_elem_expr; } - }else if (set->num_exprs >0 ) { + }else if (set->num_exprs >0 && + !(flags &NFT_SET_ELEM_INTERVAL_END )) { err =nft_set_elem_expr_clone (ctx, set, expr_array);if (err <0 ) goto err_set_elem_expr_clone;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 84/206 iavf: Fix a crash during reset task
In reply to Greg Kroah-HartmanFrom: Ivan Vecera <[email protected]>
[ Upstream commit c678669d6b13b77de3b99b97526aaf23c3088d0a ]
Recent commit aa626da947e9 ("iavf: Detach device during reset task") removed netif_tx_stop_all_queues() with an assumption that Tx queues are already stopped by netif_device_detach() in the beginning of reset task. This assumption is incorrect because during reset task a potential link event can start Tx queues again. Revert this change to fix this issue.
Reproducer:
1. Run some Tx traffic (e.g. iperf3) over iavf interface
2. Switch MTU of this interface in a loop
[root@host ~]# cat repro.sh
IF=enp2s0f0v0
iperf3 -c 192.168.0.1 -t 600 --logfile /dev/null & sleep 2
while :; do
for i in 1280 1500 2000 900 ; do
ip link set $IF mtu $i
sleep 2
done
done
[root@host ~]# ./repro.sh
Result:
[ 306.199917] iavf 0000:02:02.0 enp2s0f0v0: NIC Link is Up Speed is 40 Gbps Full Duplex [ 308.205944] iavf 0000:02:02.0 enp2s0f0v0: NIC Link is Up Speed is 40 Gbps Full Duplex [ 310.103223] BUG: kernel NULL pointer dereference, address: 0000000000000008 [ 310.110179] #PF: supervisor write access in kernel mode [ 310.115396] #PF: error_code(0x0002) - not-present page [ 310.120526] PGD 0 P4D 0 [ 310.123057] Oops: 0002 [#1] PREEMPT SMP NOPTI [ 310.127408] CPU: 24 PID: 183 Comm: kworker/u64:9 Kdump: loaded Not tainted 6.1.0-rc3+ #2 [ 310.135485] Hardware name: Abacus electric, s.r.o. - [email protected] Super Server/H12SSW-iN, BIOS 2.4 04/13/2022 [ 310.145728] Workqueue: iavf iavf_reset_task [iavf] [ 310.150520] RIP: 0010:iavf_xmit_frame_ring+0xd1/0xf70 [iavf] [ 310.156180] Code: d0 0f 86 da 00 00 00 83 e8 01 0f b7 fa 29 f8 01 c8 39 c6 0f 8f a0 08 00 00 48 8b 45 20 48 8d 14 92 bf 01 00 00 00 4c 8d 3c d0 <49> 89 5f 08 8b 43 70 66 41 89 7f 14 41 89 47 10 f6 83 82 00 00 00 [ 310.174918] RSP: 0018:ffffbb5f0082caa0 EFLAGS: 00010293 [ 310.180137] RAX: 0000000000000000 RBX: ffff92345471a6e8 RCX: 0000000000000200 [ 310.187259] RDX: 0000000000000000 RSI: 000000000000000d RDI: 0000000000000001 [ 310.194385] RBP: ffff92341d249000 R08: ffff92434987fcac R09: 0000000000000001 [ 310.201509] R10: 0000000011f683b9 R11: 0000000011f50641 R12: 0000000000000008 [ 310.208631] R13: ffff923447500000 R14: 0000000000000000 R15: 0000000000000000 [ 310.215756] FS: 0000000000000000(0000) GS:ffff92434ee00000(0000) knlGS:0000000000000000 [ 310.223835] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 310.229572] CR2: 0000000000000008 CR3: 0000000fbc210004 CR4: 0000000000770ee0 [ 310.236696] PKRU: 55555554 [ 310.239399] Call Trace: [ 310.241844] <IRQ> [ 310.243855] ? dst_alloc+0x5b/0xb0 [ 310.247260] dev_hard_start_xmit+0x9e/0x1f0 [ 310.251439] sch_direct_xmit+0xa0/0x370 [ 310.255276] __qdisc_run+0x13e/0x580 [ 310.258848] __dev_queue_xmit+0x431/0xd00 [ 310.262851] ? selinux_ip_postroute+0x147/0x3f0 [ 310.267377] ip_finish_output2+0x26c/0x540
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -0
@@ -2381,6 +2381,7 @@ static void iavf_reset_task(struct work_struct *work)if (running) {netif_carrier_off (netdev); +netif_tx_stop_all_queues (netdev); adapter->link_up = false;iavf_napi_disable_all (adapter); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 85/206 iavf: Do not restart Tx queues after reset task failure
In reply to Greg Kroah-HartmanFrom: Ivan Vecera <[email protected]>
[ Upstream commit 08f1c147b7265245d67321585c68a27e990e0c4b ]
After commit aa626da947e9 ("iavf: Detach device during reset task") the device is detached during reset task and re-attached at its end. The problem occurs when reset task fails because Tx queues are restarted during device re-attach and this leads later to a crash.
To resolve this issue properly close the net device in cause of failure in reset task to avoid restarting of tx queues at the end. Also replace the hacky manipulation with IFF_UP flag by device close that clears properly both IFF_UP and __LINK_STATE_START flags. In these case iavf_close() does not do anything because the adapter state is already __IAVF_DOWN.
Reproducer:
1) Run some Tx traffic (e.g. iperf3) over iavf interface
2) Set VF trusted / untrusted in loop
[root@host ~]# cat repro.sh
PF=enp65s0f0
IF=${PF}v0
ip link set up $IF
ip addr add 192.168.0.2/24 dev $IF
sleep 1
iperf3 -c 192.168.0.1 -t 600 --logfile /dev/null & sleep 2
while :; do
ip link set $PF vf 0 trust on
ip link set $PF vf 0 trust off
done
[root@host ~]# ./repro.sh
Result:
[ 2006.650969] iavf 0000:41:01.0: Failed to init adminq: -53 [ 2006.675662] ice 0000:41:00.0: VF 0 is now trusted [ 2006.689997] iavf 0000:41:01.0: Reset task did not complete, VF disabled [ 2006.696611] iavf 0000:41:01.0: failed to allocate resources during reinit [ 2006.703209] ice 0000:41:00.0: VF 0 is now untrusted [ 2006.737011] ice 0000:41:00.0: VF 0 is now trusted [ 2006.764536] ice 0000:41:00.0: VF 0 is now untrusted [ 2006.768919] BUG: kernel NULL pointer dereference, address: 0000000000000b4a [ 2006.776358] #PF: supervisor read access in kernel mode [ 2006.781488] #PF: error_code(0x0000) - not-present page [ 2006.786620] PGD 0 P4D 0 [ 2006.789152] Oops: 0000 [#1] PREEMPT SMP NOPTI [ 2006.792903] ice 0000:41:00.0: VF 0 is now trusted [ 2006.793501] CPU: 4 PID: 0 Comm: swapper/4 Kdump: loaded Not tainted 6.1.0-rc3+ #2 [ 2006.805668] Hardware name: Abacus electric, s.r.o. - [email protected] Super Server/H12SSW-iN, BIOS 2.4 04/13/2022 [ 2006.815915] RIP: 0010:iavf_xmit_frame_ring+0x96/0xf70 [iavf] [ 2006.821028] ice 0000:41:00.0: VF 0 is now untrusted [ 2006.821572] Code: 48 83 c1 04 48 c1 e1 04 48 01 f9 48 83 c0 10 6b 50 f8 55 c1 ea 14 45 8d 64 14 01 48 39 c8 75 eb 41 83 fc 07 0f 8f e9 08 00 00 <0f> b7 45 4a 0f b7 55 48 41 8d 74 24 05 31 c9 66 39 d0 0f 86 da 00 [ 2006.845181] RSP: 0018:ffffb253004bc9e8 EFLAGS: 00010293 [ 2006.850397] RAX: ffff9d154de45b00 RBX: ffff9d15497d52e8 RCX: ffff9d154de45b00 [ 2006.856327] ice 0000:41:00.0: VF 0 is now trusted [ 2006.857523] RDX: 0000000000000000 RSI: 00000000000005a8 RDI: ffff9d154de45ac0 [ 2006.857525] RBP: 0000000000000b00 R08: ffff9d159cb010ac R09: 0000000000000001 [ 2006.857526] R10: ffff9d154de45940 R11: 0000000000000000 R12: 0000000000000002 [ 2006.883600] R13: ffff9d1770838dc0 R14: 0000000000000000 R15: ffffffffc07b8380 [ 2006.885840] ice 0000:41:00.0: VF 0 is now untrusted [ 2006.890725] FS: 0000000000000000(0000) GS:ffff9d248e900000(0000) knlGS:0000000000000000 [ 2006.890727] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2006.909419] CR2: 0000000000000b4a CR3: 0000000c39c10002 CR4: 0000000000770ee0 [ 2006.916543] PKRU: 55555554 [ 2006.918254] ice 0000:41:00.0: VF 0 is now trusted [ 2006.919248] Call Trace: [ 2006.919250] <IRQ> [ 2006.919252] dev_hard_start_xmit+0x9e/0x1f0 [ 2006.932587] sch_direct_xmit+0xa0/0x370 [ 2006.936424] __dev_queue_xmit+0x7af/0xd00 [ 2006.940429] ip_finish_output2+0x26c/0x540 [ 2006.944519] ip_output+0x71/0x110 [ 2006.947831] ? __ip_finish_output+0x2b0/0x2b0 [ 2006.952180] __ip_queue_xmit+0x16d/0x400 [ 2006.952721] ice 0000:41:00.0: VF 0 is now untrusted [ 2006.956098] __tcp_transmit_skb+0xa96/0xbf0 [ 2006.965148] __tcp_retransmit_skb+0x174/0x860 [ 2006.969499] ? cubictcp_cwnd_event+0x40/0x40 [ 2006.973769] tcp_retransmit_skb+0x14/0xb0
...
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +15 -1
@@ -2270,7 +2270,6 @@ static void iavf_disable_vf(struct iavf_adapter *adapter)iavf_free_queues (adapter);memset (adapter->vf_res,0 ,IAVF_VIRTCHNL_VF_RESOURCE_SIZE );iavf_shutdown_adminq (&adapter->hw); - adapter->netdev->flags &= ~IFF_UP ; adapter->flags &= ~IAVF_FLAG_RESET_PENDING ;iavf_change_state (adapter, __IAVF_DOWN);wake_up (&adapter->down_waitqueue);
@@ -2369,6 +2368,11 @@ static void iavf_reset_task(struct work_struct *work)iavf_disable_vf (adapter);mutex_unlock (&adapter->client_lock);mutex_unlock (&adapter->crit_lock); +if (netif_running (netdev)) { +rtnl_lock (); +dev_close (netdev); +rtnl_unlock (); + }return ;/* Do not attempt to reinit. It's dead, Jim. */ }
@@ -2504,6 +2508,16 @@ static void iavf_reset_task(struct work_struct *work)mutex_unlock (&adapter->client_lock);mutex_unlock (&adapter->crit_lock); + +if (netif_running (netdev)) { +/* Close device to ensure that Tx queues will not be started +* during netif_device_attach() at the end of the reset task. +*/ +rtnl_lock (); +dev_close (netdev); +rtnl_unlock (); + } +dev_err (&adapter->pdev->dev,"failed to allocate resources during reinit\n" ); reset_finish:rtnl_lock ();
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 86/206 iavf: Fix race condition between iavf_shutdown and iavf_remove
In reply to Greg Kroah-HartmanFrom: Slawomir Laba <[email protected]>
[ Upstream commit a8417330f8a57275ed934293e832982b6d882713 ]
Fix a deadlock introduced by commit974578017fc1 ("iavf: Add waiting so the port is initialized in remove") due to race condition between iavf_shutdown and iavf_remove, where iavf_remove stucks forever in while loop since iavf_shutdown already set __IAVF_REMOVE adapter state.
Fix this by checking if the __IAVF_IN_REMOVE_TASK has already been set and return if so.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +7 -9
@@ -4189,23 +4189,21 @@ static int __maybe_unused iavf_resume(struct device *dev_d)static void iavf_remove (struct pci_dev *pdev) {struct iavf_adapter *adapter =iavf_pdev_to_adapter (pdev); -struct net_device *netdev = adapter->netdev;struct iavf_fdir_fltr *fdir, *fdirtmp;struct iavf_vlan_filter *vlf, *vlftmp; +struct iavf_cloud_filter *cf, *cftmp;struct iavf_adv_rss *rss, *rsstmp;struct iavf_mac_filter *f, *ftmp; -struct iavf_cloud_filter *cf, *cftmp; -struct iavf_hw *hw = &adapter->hw; +struct net_device *netdev; +struct iavf_hw *hw;int err; -/* When reboot/shutdown is in progress no need to do anything -* as the adapter is already REMOVE state that was set during -* iavf_shutdown() callback. -*/ -if (adapter->state == __IAVF_REMOVE) + netdev = adapter->netdev; + hw = &adapter->hw; + +if (test_and_set_bit (__IAVF_IN_REMOVE_TASK, &adapter->crit_section))return ; -set_bit (__IAVF_IN_REMOVE_TASK, &adapter->crit_section);/* Wait until port initialization is complete. * There are flows where register/unregister netdev may race. */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 87/206 ARM: mxs: fix memory leak in mxs_machine_init()
In reply to Greg Kroah-HartmanFrom: Zheng Yongjun <[email protected]>
[ Upstream commit f31e3c204d1844b8680a442a48868af5ac3d5481 ]
If of_property_read_string() failed, 'soc_dev_attr' should be freed before return. Otherwise there is a memory leak.
--- arch/arm/mach-mxs/mach-mxs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-mxs/mach-mxs.c +3 -1
@@ -393,8 +393,10 @@ static void __init mxs_machine_init(void) root =of_find_node_by_path ("/" ); ret =of_property_read_string (root,"model" , &soc_dev_attr->machine); -if (ret) +if (ret) { +kfree (soc_dev_attr);return ; + } soc_dev_attr->family ="Freescale MXS Family" ; soc_dev_attr->soc_id =mxs_get_soc_id ();
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 88/206 ARM: dts: imx6q-prti6q: Fix ref/tcxo-clock-frequency properties
In reply to Greg Kroah-HartmanFrom: Fabio Estevam <[email protected]>
[ Upstream commit e68be7b39f21d8a9291a5a3019787cd3ca999dd7 ]
make dtbs_check gives the following errors:
ref-clock-frequency: size (9) error for type uint32
tcxo-clock-frequency: size (9) error for type uint32
Fix it by passing the frequencies inside < > as documented in Documentation/devicetree/bindings/net/wireless/ti,wlcore.yaml.
--- arch/arm/boot/dts/imx6q-prti6q.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/imx6q-prti6q.dts +2 -2
@@ -364,8 +364,8 @@ wifi { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_wifi>; interrupts-extended = <&gpio1 30 IRQ_TYPE_LEVEL_HIGH>; - ref-clock-frequency = "38400000"; - tcxo-clock-frequency = "19200000"; + ref-clock-frequency = <38400000>; + tcxo-clock-frequency = <19200000>; }; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 89/206 net: ethernet: mtk_eth_soc: fix error handling in mtk_open()
In reply to Greg Kroah-HartmanFrom: Liu Jian <[email protected]>
[ Upstream commit f70074140524c59a0935947b06dd6cb6e1ea642d ]
If mtk_start_dma() fails, invoke phylink_disconnect_phy() to perform cleanup. phylink_disconnect_phy() contains the put_device action. If phylink_disconnect_phy is not performed, the Kref of netdev will leak.
--- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +3 -1
@@ -2327,8 +2327,10 @@ static int mtk_open(struct net_device *dev)int err; err =mtk_start_dma (eth); -if (err) +if (err) { +phylink_disconnect_phy (mac->phylink);return err; + }if (eth->soc->offload_version &&mtk_ppe_start (ð->ppe) ==0 ) gdm_config =MTK_GDMA_TO_PPE ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 90/206 net/mlx4: Check retval of mlx4_bitmap_init
In reply to Greg Kroah-HartmanFrom: Peter Kosyh <[email protected]>
[ Upstream commit 594c61ffc77de0a197934aa0f1df9285c68801c6 ]
If mlx4_bitmap_init fails, mlx4_bitmap_alloc_range will dereference the NULL pointer (bitmap->table).
Make sure, that mlx4_bitmap_alloc_range called in no error case.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/mellanox/mlx4/qp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx4/qp.c +2 -1
@@ -697,7 +697,8 @@ static int mlx4_create_zones(struct mlx4_dev *dev, err =mlx4_bitmap_init (*bitmap + k,1 ,MLX4_QP_TABLE_RAW_ETH_SIZE -1 ,0 ,0 ); -mlx4_bitmap_alloc_range (*bitmap + k,1 ,1 ,0 ); +if (!err) +mlx4_bitmap_alloc_range (*bitmap + k,1 ,1 ,0 ); }if (err)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 91/206 net: mvpp2: fix possible invalid pointer dereference
In reply to Greg Kroah-HartmanFrom: Hui Tang <[email protected]>
[ Upstream commit cbe867685386af1f0a2648f5279f6e4c74bfd17f ]
It will cause invalid pointer dereference to priv->cm3_base behind, if PTR_ERR(priv->cm3_base) in mvpp2_get_sram().
--- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +6 -2
@@ -7356,6 +7356,7 @@ static int mvpp2_get_sram(struct platform_device *pdev, struct mvpp2 *priv) {struct resource *res; +void __iomem *base; res =platform_get_resource (pdev,IORESOURCE_MEM ,2 );if (!res) {
@@ -7366,9 +7367,12 @@ static int mvpp2_get_sram(struct platform_device *pdev,return 0 ; } - priv->cm3_base =devm_ioremap_resource (&pdev->dev, res); + base =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (base)) +return PTR_ERR (base); -return PTR_ERR_OR_ZERO (priv->cm3_base); + priv->cm3_base = base; +return 0 ; }static int mvpp2_probe (struct platform_device *pdev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 92/206 net/qla3xxx: fix potential memleak in ql3xxx_send()
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
[ Upstream commit 62a7311fb96c61d281da9852dbee4712fc8c3277 ]
The ql3xxx_send() returns NETDEV_TX_OK without freeing skb in error handling case, add dev_kfree_skb_any() to fix it.
--- drivers/net/ethernet/qlogic/qla3xxx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/qlogic/qla3xxx.c +1 -0
@@ -2469,6 +2469,7 @@ static netdev_tx_t ql3xxx_send(struct sk_buff *skb, skb_shinfo(skb)->nr_frags);if (tx_cb->seg_count ==-1 ) {netdev_err (ndev,"%s: invalid segment count!\n" , __func__); +dev_kfree_skb_any (skb);return NETDEV_TX_OK ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 93/206 octeontx2-af: debugsfs: fix pci device refcount leak
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit d66608803aa2ffb9e475623343f69996305771ae ]
As comment of pci_get_domain_bus_and_slot() says, it returns a pci device with refcount increment, when finish using it, the caller must decrement the reference count by calling pci_dev_put().
So before returning from rvu_dbg_rvu_pf_cgx_map_display() or cgx_print_dmac_flt(), pci_dev_put() is called to avoid refcount leak.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +3 -0
@@ -441,6 +441,8 @@ static int rvu_dbg_rvu_pf_cgx_map_display(struct seq_file *filp, void *unused)sprintf (lmac,"LMAC%d" , lmac_id);seq_printf (filp,"%s\t0x%x\t\tNIX%d\t\t%s\t%s\n" ,dev_name (&pdev->dev), pcifunc, blkid, cgx, lmac); + +pci_dev_put (pdev); }return 0 ; }
@@ -2127,6 +2129,7 @@ static int cgx_print_dmac_flt(struct seq_file *s, int lmac_id) } } +pci_dev_put (pdev);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 94/206 net: pch_gbe: fix pci device refcount leak while module exiting
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 5619537284f1017e9f6c7500b02b859b3830a06d ]
As comment of pci_get_domain_bus_and_slot() says, it returns a pci device with refcount increment, when finish using it, the caller must decrement the reference count by calling pci_dev_put().
In pch_gbe_probe(), pci_get_domain_bus_and_slot() is called, so in error path in probe() and remove() function, pci_dev_put() should be called to avoid refcount leak. Compile tested only.
--- drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +4 -1
@@ -2465,6 +2465,7 @@ static void pch_gbe_remove(struct pci_dev *pdev)unregister_netdev (netdev);pch_gbe_phy_hw_reset (&adapter->hw); +pci_dev_put (adapter->ptp_pdev);free_netdev (netdev); }
@@ -2540,7 +2541,7 @@ static int pch_gbe_probe(struct pci_dev *pdev,/* setup the private structure */ ret =pch_gbe_sw_init (adapter);if (ret) - goto err_free_netdev; + goto err_put_dev;/* Initialize PHY */ ret =pch_gbe_init_phy (adapter);
@@ -2598,6 +2599,8 @@ static int pch_gbe_probe(struct pci_dev *pdev, err_free_adapter:pch_gbe_phy_hw_reset (&adapter->hw); +err_put_dev: +pci_dev_put (adapter->ptp_pdev); err_free_netdev:free_netdev (netdev);return ret;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 95/206 nfp: fill splittable of devlink_port_attrs correctly
In reply to Greg Kroah-HartmanFrom: Diana Wang <[email protected]>
[ Upstream commit 4abd9600b9d15d3d92a9ac25cf200422a4c415ee ]
The error is reflected in that it shows wrong splittable status of port when executing "devlink port show".
The reason which leads the error is that the assigned operation of splittable is just a simple negation operation of split and it does not consider port lanes quantity. A splittable port should have several lanes that can be split(lanes quantity > 1).
If without the judgement, it will show wrong message for some firmware, such as 2x25G, 2x10G.
--- drivers/net/ethernet/netronome/nfp/nfp_devlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/netronome/nfp/nfp_devlink.c +1 -1
@@ -363,7 +363,7 @@ int nfp_devlink_port_register(struct nfp_app *app, struct nfp_port *port)return ret; attrs.split = eth_port.is_split; - attrs.splittable = !attrs.split; + attrs.splittable = eth_port.port_lanes >1 && !attrs.split; attrs.lanes = eth_port.port_lanes; attrs.flavour =DEVLINK_PORT_FLAVOUR_PHYSICAL ; attrs.phys.port_number = eth_port.label_port;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 96/206 nfp: add port from netdev validation for EEPROM access
In reply to Greg Kroah-HartmanFrom: Jaco Coetzee <[email protected]>
[ Upstream commit 0873016d46f6dfafd1bdf4d9b935b3331b226f7c ]
Setting of the port flag NFP_PORT_CHANGED, introduced to ensure the correct reading of EEPROM data, causes a fatal kernel NULL pointer dereference in cases where the target netdev type cannot be determined.
Add validation of port struct pointer before attempting to set the NFP_PORT_CHANGED flag. Return that operation is not supported if the netdev type cannot be determined.
--- drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c +3 -0
@@ -1219,6 +1219,9 @@ nfp_port_get_module_info(struct net_device *netdev,u8 data; port =nfp_port_from_netdev (netdev); +if (!port) +return -EOPNOTSUPP ; +/* update port state to get latest interface */ set_bit (NFP_PORT_CHANGED , &port->flags); eth_port =nfp_port_get_eth_port (port);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 97/206 macsec: Fix invalid error code set
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 7cef6b73fba96abef731a53501924fc3c4a0f947 ]
'ret' is defined twice in macsec_changelink(), when it is set in macsec_is_offloaded case, it will be invalid before return.
--- drivers/net/macsec.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/macsec.c +0 -1
@@ -3808,7 +3808,6 @@ static int macsec_changelink(struct net_device *dev, struct nlattr *tb[],if (macsec_is_offloaded (macsec)) {const struct macsec_ops *ops;struct macsec_context ctx; -int ret; ops =macsec_get_ops (netdev_priv (dev), &ctx);if (!ops) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 98/206 Drivers: hv: vmbus: fix double free in the error path of vmbus_add_channel_work()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit f92a4b50f0bd7fd52391dc4bb9a309085d278f91 ]
In the error path of vmbus_device_register(), device_unregister() is called, which calls vmbus_device_release(). The latter frees the struct hv_device that was passed in to vmbus_device_register(). So remove the kfree() in vmbus_add_channel_work() to avoid a double free.
--- drivers/hv/channel_mgmt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/hv/channel_mgmt.c +5 -1
@@ -531,13 +531,17 @@ static void vmbus_add_channel_work(struct work_struct *work)* Add the new device to the bus. This will kick off device-driver * binding which eventually invokes the device driver's AddDevice() * method. +* +* If vmbus_device_register() fails, the 'device_obj' is freed in +* vmbus_device_release() as called by device_unregister() in the +* error path of vmbus_device_register(). In the outside error +* path, there's no need to free it. */ ret =vmbus_device_register (newchannel->device_obj);if (ret !=0 ) {pr_err ("unable to add child device object (relid %d)\n" , newchannel->offermsg.child_relid); -kfree (newchannel->device_obj); goto err_deq_chan; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 99/206 Drivers: hv: vmbus: fix possible memory leak in vmbus_device_register()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 25c94b051592c010abe92c85b0485f1faedc83f3 ]
If device_register() returns error in vmbus_device_register(), the name allocated by dev_set_name() must be freed. As comment of device_register() says, it should use put_device() to give up the reference in the error path. So fix this by calling put_device(), then the name can be freed in kobject_cleanup().
--- drivers/hv/vmbus_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/hv/vmbus_drv.c +1 -0
@@ -2109,6 +2109,7 @@ int vmbus_device_register(struct hv_device *child_device_obj) ret =device_register (&child_device_obj->device);if (ret) {pr_err ("Unable to register child device\n" ); +put_device (&child_device_obj->device);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 100/206 netfilter: ipset: regression in ip_set_hash_ip.c
In reply to Greg Kroah-HartmanFrom: Vishwanath Pai <[email protected]>
[ Upstream commit c7aa1a76d4a0a3c401025b60c401412bbb60f8c6 ]
This patch introduced a regression: commit 48596a8ddc46 ("netfilter:
ipset: Fix adding an IPv4 range containing more than 2^31 addresses")
The variable e.ip is passed to adtfn() function which finally adds the ip address to the set. The patch above refactored the for loop and moved e.ip = htonl(ip) to the end of the for loop.
What this means is that if the value of "ip" changes between the first assignement of e.ip and the forloop, then e.ip is pointing to a different ip address than "ip".
Test case:
$ ipset create jdtest_tmp hash:ip family inet hashsize 2048 maxelem 100000 $ ipset add jdtest_tmp 10.0.1.1/31 ipset v6.21.1: Element cannot be added to the set: it's already added
The value of ip gets updated inside the "else if (tb[IPSET_ATTR_CIDR])" block but e.ip is still pointing to the old value.
--- net/netfilter/ipset/ip_set_hash_ip.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
net/netfilter/ipset/ip_set_hash_ip.c +3 -5
@@ -151,18 +151,16 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *tb[],if (((u64 )ip_to - ip +1 ) >> (32 - h->netmask) >IPSET_MAX_RANGE )return -ERANGE ; -if (retried) { +if (retried) ip =ntohl (h->next.ip); - e.ip =htonl (ip); - }for (; ip <= ip_to;) { + e.ip =htonl (ip); ret =adtfn (set, &e, &ext, &ext, flags);if (ret && !ip_set_eexist (ret, flags))return ret; ip += hosts; - e.ip =htonl (ip); -if (e.ip ==0 ) +if (ip ==0 )return 0 ; ret =0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 101/206 net/mlx5: Do not query pci info while pci disabled
In reply to Greg Kroah-HartmanFrom: Roy Novich <[email protected]>
[ Upstream commit 394164f9d5a3020a7fd719d228386d48d544ec67 ]
The driver should not interact with PCI while PCI is disabled. Trying to do so may result in being unable to get vital signs during PCI reset, driver gets timed out and fails to recover.
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +6 -3
@@ -1608,7 +1608,8 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev, res = state == pci_channel_io_perm_failure ?PCI_ERS_RESULT_DISCONNECT :PCI_ERS_RESULT_NEED_RESET ; -mlx5_pci_trace (dev,"Exit, result = %d, %s\n" , res,result2str (res)); +mlx5_core_info (dev,"%s Device state = %d pci_status: %d. Exit, result = %d, %s\n" , + __func__, dev->state, dev->pci_status, res,result2str (res));return res; }
@@ -1647,7 +1648,8 @@ static pci_ers_result_t mlx5_pci_slot_reset(struct pci_dev *pdev)struct mlx5_core_dev *dev =pci_get_drvdata (pdev);int err; -mlx5_pci_trace (dev,"Enter\n" ); +mlx5_core_info (dev,"%s Device state = %d pci_status: %d. Enter\n" , + __func__, dev->state, dev->pci_status); err =mlx5_pci_enable_device (dev);if (err) {
@@ -1669,7 +1671,8 @@ static pci_ers_result_t mlx5_pci_slot_reset(struct pci_dev *pdev) res =PCI_ERS_RESULT_RECOVERED ; out: -mlx5_pci_trace (dev,"Exit, err = %d, result = %d, %s\n" , err, res,result2str (res)); +mlx5_core_info (dev,"%s Device state = %d pci_status: %d. Exit, err = %d, result = %d, %s\n" , + __func__, dev->state, dev->pci_status, err, res,result2str (res));return res; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 102/206 net/mlx5: Fix FW tracer timestamp calculation
In reply to Greg Kroah-HartmanFrom: Moshe Shemesh <[email protected]>
[ Upstream commit 61db3d7b99a367416e489ccf764cc5f9b00d62a1 ]
Fix a bug in calculation of FW tracer timestamp. Decreasing one in the calculation should effect only bits 52_7 and not effect bits 6_0 of the timestamp, otherwise bits 6_0 are always set in this calculation.
--- drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c +1 -1
@@ -638,7 +638,7 @@ static void mlx5_tracer_handle_timestamp_trace(struct mlx5_fw_tracer *tracer, trace_timestamp = (timestamp_event.timestamp &MASK_52_7 ) | (str_frmt->timestamp &MASK_6_0 ); else - trace_timestamp = ((timestamp_event.timestamp &MASK_52_7 ) -1 ) | + trace_timestamp = ((timestamp_event.timestamp -1 ) &MASK_52_7 ) | (str_frmt->timestamp &MASK_6_0 );mlx5_tracer_print_trace (str_frmt, dev, trace_timestamp);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 103/206 net/mlx5: Fix handling of entry refcount when command is not issued to FW
In reply to Greg Kroah-HartmanFrom: Moshe Shemesh <[email protected]>
[ Upstream commit aaf2e65cac7f2e1ae729c2fbc849091df9699f96 ]
In case command interface is down, or the command is not allowed, driver did not increment the entry refcount, but might have decrement as part of forced completion handling.
Fix that by always increment and decrement the refcount to make it symmetric for all flows.
--- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +3 -3
@@ -971,6 +971,7 @@ static void cmd_work_handler(struct work_struct *work)cmd_ent_get (ent);set_bit (MLX5_CMD_ENT_STATE_PENDING_COMP , &ent->state); +cmd_ent_get (ent);/* for the _real_ FW event on completion */ /* Skip sending command to fw if internal error */ if (mlx5_cmd_is_down (dev) || !opcode_allowed (&dev->cmd, ent->op)) {u8 status =0 ;
@@ -984,7 +985,6 @@ static void cmd_work_handler(struct work_struct *work)return ; } -cmd_ent_get (ent);/* for the _real_ FW event on completion */ /* ring doorbell after the descriptor is valid */ mlx5_core_dbg (dev,"writing 0x%x to command doorbell\n" ,1 << ent->idx);wmb ();
@@ -1598,8 +1598,8 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool forcecmd_ent_put (ent);/* timeout work was canceled */ if (!forced ||/* Real FW completion */ -pci_channel_offline (dev->pdev) ||/* FW is inaccessible */ - dev->state ==MLX5_DEVICE_STATE_INTERNAL_ERROR ) +mlx5_cmd_is_down (dev) ||/* No real FW completion is expected */ + !opcode_allowed (cmd, ent->op))cmd_ent_put (ent); ent->ts2 =ktime_get_ns ();
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 104/206 tipc: set con sock in tipc_conn_alloc
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 0e5d56c64afcd6fd2d132ea972605b66f8a7d3c4 ]
A crash was reported by Wei Chen:
BUG: kernel NULL pointer dereference, address: 0000000000000018 RIP: 0010:tipc_conn_close+0x12/0x100 Call Trace: tipc_topsrv_exit_net+0x139/0x320 ops_exit_list.isra.9+0x49/0x80 cleanup_net+0x31a/0x540 process_one_work+0x3fa/0x9f0 worker_thread+0x42/0x5c0
It was caused by !con->sock in tipc_conn_close(). In tipc_topsrv_accept(), con is allocated in conn_idr then its sock is set:
con = tipc_conn_alloc(); ... <----[1] con->sock = newsock;
If tipc_conn_close() is called in anytime of [1], the null-pointer-def is triggered by con->sock->sk due to con->sock is not yet set.
This patch fixes it by moving the con->sock setting to tipc_conn_alloc() under s->idr_lock. So that con->sock can never be NULL when getting the con from s->conn_idr. It will be also safer to move con->server and flag CF_CONNECTED setting under s->idr_lock, as they should all be set before tipc_conn_alloc() is called.
--- net/tipc/topsrv.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
net/tipc/topsrv.c +5 -6
@@ -176,7 +176,7 @@ static void tipc_conn_close(struct tipc_conn *con)conn_put (con); } -static struct tipc_conn *tipc_conn_alloc (struct tipc_topsrv *s) +static struct tipc_conn *tipc_conn_alloc (struct tipc_topsrv *s,struct socket *sock) {struct tipc_conn *con;int ret;
@@ -202,10 +202,11 @@ static struct tipc_conn *tipc_conn_alloc(struct tipc_topsrv *s) } con->conid = ret; s->idr_in_use++; -spin_unlock_bh (&s->idr_lock);set_bit (CF_CONNECTED , &con->flags); con->server = s; + con->sock = sock; +spin_unlock_bh (&s->idr_lock);return con; }
@@ -467,7 +468,7 @@ static void tipc_topsrv_accept(struct work_struct *work) ret =kernel_accept (lsock, &newsock,O_NONBLOCK );if (ret <0 )return ; - con =tipc_conn_alloc (srv); + con =tipc_conn_alloc (srv, newsock);if (IS_ERR (con)) { ret =PTR_ERR (con);sock_release (newsock);
@@ -479,7 +480,6 @@ static void tipc_topsrv_accept(struct work_struct *work) newsk->sk_data_ready = tipc_conn_data_ready; newsk->sk_write_space = tipc_conn_write_space; newsk->sk_user_data = con; - con->sock = newsock;write_unlock_bh (&newsk->sk_callback_lock);/* Wake up receive process in case of 'SYN+' message */
@@ -577,12 +577,11 @@ bool tipc_topsrv_kern_subscr(struct net *net, u32 port, u32 type, u32 lower, sub.filter = filter; *(u64 *)&sub.usr_handle = (u64 )port; - con =tipc_conn_alloc (tipc_topsrv (net)); + con =tipc_conn_alloc (tipc_topsrv (net),NULL );if (IS_ERR (con))return false; *conid = con->conid; - con->sock =NULL ; rc =tipc_conn_rcv_sub (tipc_topsrv (net), con, &sub);if (rc >=0 )return true;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 105/206 tipc: add an extra conn_get in tipc_conn_alloc
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit a7b42969d63f47320853a802efd879fbdc4e010e ]
One extra conn_get() is needed in tipc_conn_alloc(), as after tipc_conn_alloc() is called, tipc_conn_close() may free this con before deferencing it in tipc_topsrv_accept():
tipc_conn_alloc();
newsk = newsock->sk;
<---- tipc_conn_close();
write_lock_bh(&sk->sk_callback_lock);
newsk->sk_data_ready = tipc_conn_data_ready;Then an uaf issue can be triggered:
BUG: KASAN: use-after-free in tipc_topsrv_accept+0x1e7/0x370 [tipc] Call Trace: <TASK> dump_stack_lvl+0x33/0x46 print_report+0x178/0x4b0 kasan_report+0x8c/0x100 kasan_check_range+0x179/0x1e0 tipc_topsrv_accept+0x1e7/0x370 [tipc] process_one_work+0x6a3/0x1030 worker_thread+0x8a/0xdf0
This patch fixes it by holding it in tipc_conn_alloc(), then after all accessing in tipc_topsrv_accept() releasing it. Note when does this in tipc_topsrv_kern_subscr(), as tipc_conn_rcv_sub() returns 0 or -1 only, we don't need to check for "> 0".
--- net/tipc/topsrv.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/tipc/topsrv.c +6 -3
@@ -206,6 +206,7 @@ static struct tipc_conn *tipc_conn_alloc(struct tipc_topsrv *s, struct socket *sset_bit (CF_CONNECTED , &con->flags); con->server = s; con->sock = sock; +conn_get (con);spin_unlock_bh (&s->idr_lock);return con;
@@ -484,6 +485,7 @@ static void tipc_topsrv_accept(struct work_struct *work)/* Wake up receive process in case of 'SYN+' message */ newsk->sk_data_ready (newsk); +conn_put (con); } }
@@ -583,10 +585,11 @@ bool tipc_topsrv_kern_subscr(struct net *net, u32 port, u32 type, u32 lower, *conid = con->conid; rc =tipc_conn_rcv_sub (tipc_topsrv (net), con, &sub); -if (rc >=0 ) -return true; +if (rc) +conn_put (con); +conn_put (con); -return false; +return !rc; }void tipc_topsrv_kern_unsubscr (struct net *net,int conid)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 106/206 tipc: check skb_linearize() return value in tipc_disc_rcv()
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit cd0f6421162201e4b22ce757a1966729323185eb ]
If skb_linearize() fails in tipc_disc_rcv(), we need to free the skb instead of handle it.
--- net/tipc/discover.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/tipc/discover.c +4 -1
@@ -211,7 +211,10 @@ void tipc_disc_rcv(struct net *net, struct sk_buff *skb,u32 self;int err; -skb_linearize (skb); +if (skb_linearize (skb)) { +kfree_skb (skb); +return ; + } hdr =buf_msg (skb);if (caps &TIPC_NODE_ID128 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 107/206 xfrm: Fix oops in __xfrm_state_delete()
In reply to Greg Kroah-HartmanFrom: Thomas Jarosch <[email protected]>
[ Upstream commit b97df039a68b2f3e848e238df5d5d06343ea497b ]
Kernel 5.14 added a new "byseq" index to speed up xfrm_state lookups by sequence number in commit fe9f1d8779cb ("xfrm: add state hashtable keyed by seq")
While the patch was thorough, the function pfkey_send_new_mapping() in net/af_key.c also modifies x->km.seq and never added the current xfrm_state to the "byseq" index.
This leads to the following kernel Ooops:
BUG: kernel NULL pointer dereference, address: 0000000000000000
..
RIP: 0010:__xfrm_state_delete+0xc9/0x1c0
..
Call Trace:
<TASK>
xfrm_state_delete+0x1e/0x40
xfrm_del_sa+0xb0/0x110 [xfrm_user]
xfrm_user_rcv_msg+0x12d/0x270 [xfrm_user]
? remove_entity_load_avg+0x8a/0xa0
? copy_to_user_state_extra+0x580/0x580 [xfrm_user]
netlink_rcv_skb+0x51/0x100
xfrm_netlink_rcv+0x30/0x50 [xfrm_user]
netlink_unicast+0x1a6/0x270
netlink_sendmsg+0x22a/0x480
__sys_sendto+0x1a6/0x1c0
? __audit_syscall_entry+0xd8/0x130
? __audit_syscall_exit+0x249/0x2b0
__x64_sys_sendto+0x23/0x30
do_syscall_64+0x3a/0x90
entry_SYSCALL_64_after_hwframe+0x61/0xcbExact location of the crash in __xfrm_state_delete():
if (x->km.seq)
hlist_del_rcu(&x->byseq);The hlist_node "byseq" was never populated.
The bug only triggers if a new NAT traversal mapping (changed IP or port) is detected in esp_input_done2() / esp6_input_done2(), which in turn indirectly calls pfkey_send_new_mapping() *if* the kernel is compiled with CONFIG_NET_KEY and "af_key" is active.
The PF_KEYv2 message SADB_X_NAT_T_NEW_MAPPING is not part of RFC 2367. Various implementations have been examined how they handle the "sadb_msg_seq" header field:
- racoon (Android): does not process SADB_X_NAT_T_NEW_MAPPING
- strongswan: does not care about sadb_msg_seq
- openswan: does not care about sadb_msg_seq
There is no standard how PF_KEYv2 sadb_msg_seq should be populated for SADB_X_NAT_T_NEW_MAPPING and it's not used in popular implementations either. Herbert Xu suggested we should just use the current km.seq value as is. This fixes the root cause of the oops since we no longer modify km.seq itself.
The update of "km.seq" looks like a copy'n'paste error
from pfkey_send_acquire(). SADB_ACQUIRE must indeed assign a unique km.seq number according to RFC 2367. It has been verified that code paths involving pfkey_send_acquire() don't cause the same Oops.
PF_KEYv2 SADB_X_NAT_T_NEW_MAPPING support was originally added here:
https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git
commit cbc3488685b20e7b2a98ad387a1a816aada569d8
Author: Derek Atkins <[email protected]>
AuthorDate: Wed Apr 2 13:21:02 2003 -0800
[IPSEC]: Implement UDP Encapsulation framework.
In particular, implement ESPinUDP encapsulation for IPsec Nat Traversal.
A note on triggering the bug: I was not able to trigger it using VMs. There is one VPN using a high latency link on our production VPN server that triggered it like once a day though.
--- net/key/af_key.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/key/af_key.c +1 -1
@@ -3394,7 +3394,7 @@ static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, hdr->sadb_msg_len = size /sizeof (uint64_t ); hdr->sadb_msg_errno =0 ; hdr->sadb_msg_reserved =0 ; - hdr->sadb_msg_seq = x->km.seq =get_acqseq (); + hdr->sadb_msg_seq = x->km.seq; hdr->sadb_msg_pid =0 ;/* SA */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 108/206 xfrm: Fix ignored return value in xfrm6_init()
In reply to Greg Kroah-HartmanFrom: Chen Zhongjin <[email protected]>
[ Upstream commit 40781bfb836eda57d19c0baa37c7e72590e05fdc ]
When IPv6 module initializing in xfrm6_init(), register_pernet_subsys() is possible to fail but its return value is ignored.
If IPv6 initialization fails later and xfrm6_fini() is called, removing uninitialized list in xfrm6_net_ops will cause null-ptr-deref:
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] CPU: 1 PID: 330 Comm: insmod RIP: 0010:unregister_pernet_operations+0xc9/0x450 Call Trace: <TASK> unregister_pernet_subsys+0x31/0x3e xfrm6_fini+0x16/0x30 [ipv6] ip6_route_init+0xcd/0x128 [ipv6] inet6_init+0x29c/0x602 [ipv6] ...
Fix it by catching the error return value of register_pernet_subsys().
--- net/ipv6/xfrm6_policy.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/ipv6/xfrm6_policy.c +5 -1
@@ -289,9 +289,13 @@ int __init xfrm6_init(void)if (ret) goto out_state; -register_pernet_subsys (&xfrm6_net_ops); + ret =register_pernet_subsys (&xfrm6_net_ops); +if (ret) + goto out_protocol; out:return ret; +out_protocol: +xfrm6_protocol_fini (); out_state:xfrm6_state_fini (); out_policy:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 109/206 net: wwan: iosm: use ACPI_FREE() but not kfree() in ipc_pcie_read_bios_cfg()
In reply to Greg Kroah-HartmanFrom: Wang ShaoBo <[email protected]>
[ Upstream commit e541dd7763fc34aec2f93f652a396cc2e7b92d8d ]
acpi_evaluate_dsm() should be coupled with ACPI_FREE() to free the ACPI memory, because we need to track the allocation of acpi_object when ACPI_DBG_TRACK_ALLOCATIONS enabled, so use ACPI_FREE() instead of kfree().
--- drivers/net/wwan/iosm/iosm_ipc_pcie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wwan/iosm/iosm_ipc_pcie.c +1 -1
@@ -249,7 +249,7 @@ static enum ipc_pcie_sleep_state ipc_pcie_read_bios_cfg(struct device *dev)if (object->integer.value ==3 ) sleep_state =IPC_PCIE_D3L2 ; -kfree (object); +ACPI_FREE (object); default_ret:return sleep_state;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 110/206 sfc: fix potential memleak in __ef100_hard_start_xmit()
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
[ Upstream commit aad98abd5cb8133507f22654f56bcb443aaa2d89 ]
The __ef100_hard_start_xmit() returns NETDEV_TX_OK without freeing skb in error handling case, add dev_kfree_skb_any() to fix it.
--- drivers/net/ethernet/sfc/ef100_netdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/sfc/ef100_netdev.c +1 -0
@@ -200,6 +200,7 @@ static netdev_tx_t ef100_hard_start_xmit(struct sk_buff *skb, skb->len, skb->data_len, channel->channel);if (!efx->n_channels || !efx->n_tx_channels || !channel) {netif_stop_queue (net_dev); +dev_kfree_skb_any (skb); goto err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 111/206 net: sparx5: fix error handling in sparx5_port_open()
In reply to Greg Kroah-HartmanFrom: Liu Jian <[email protected]>
[ Upstream commit 4305fe232b8aa59af3761adc9fe6b6aa40913960 ]
If phylink_of_phy_connect() fails, the port should be disabled. If sparx5_serdes_set()/phy_power_on() fails, the port should be disabled and the phylink should be stopped and disconnected.
--- .../net/ethernet/microchip/sparx5/sparx5_netdev.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c +12 -2
@@ -83,7 +83,7 @@ static int sparx5_port_open(struct net_device *ndev) err =phylink_of_phy_connect (port->phylink, port->of_node,0 );if (err) {netdev_err (ndev,"Could not attach to PHY\n" ); -return err; + goto err_connect; }phylink_start (port->phylink);
@@ -95,10 +95,20 @@ static int sparx5_port_open(struct net_device *ndev) err =sparx5_serdes_set (port->sparx5, port, &port->conf); else err =phy_power_on (port->serdes); -if (err) +if (err) {netdev_err (ndev,"%s failed\n" , __func__); + goto out_power; + } } +return 0 ; + +out_power: +phylink_stop (port->phylink); +phylink_disconnect_phy (port->phylink); +err_connect: +sparx5_port_enable (port, false); +return err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 112/206 net: sched: allow act_ct to be built without NF_NAT
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 8427fd100c7b7793650e212a81e42f1cf124613d ]
In commit f11fe1dae1c4 ("net/sched: Make NET_ACT_CT depends on NF_NAT"), it fixed the build failure when NF_NAT is m and NET_ACT_CT is y by adding depends on NF_NAT for NET_ACT_CT. However, it would also cause NET_ACT_CT cannot be built without NF_NAT, which is not expected. This patch fixes it by changing to use "(!NF_NAT || NF_NAT)" as the depend.
--- net/sched/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/Kconfig +1 -1
@@ -976,7 +976,7 @@ config NET_ACT_TUNNEL_KEY config NET_ACT_CT tristate "connection tracking tc action" - depends on NET_CLS_ACT && NF_CONNTRACK && NF_NAT && NF_FLOW_TABLE + depends on NET_CLS_ACT && NF_CONNTRACK && (!NF_NAT || NF_NAT) && NF_FLOW_TABLE help Say Y here to allow sending the packets to conntrack module.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 113/206 NFC: nci: fix memory leak in nci_rx_data_packet()
In reply to Greg Kroah-HartmanFrom: Liu Shixin <[email protected]>
[ Upstream commit 53270fb0fd77fe786d8c07a0793981d797836b93 ]
Syzbot reported a memory leak about skb:
unreferenced object 0xffff88810e144e00 (size 240):
comm "syz-executor284", pid 3701, jiffies 4294952403 (age 12.620s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff83ab79a9>] __alloc_skb+0x1f9/0x270 net/core/skbuff.c:497
[<ffffffff82a5cf64>] alloc_skb include/linux/skbuff.h:1267 [inline]
[<ffffffff82a5cf64>] virtual_ncidev_write+0x24/0xe0 drivers/nfc/virtual_ncidev.c:116
[<ffffffff815f6503>] do_loop_readv_writev fs/read_write.c:759 [inline]
[<ffffffff815f6503>] do_loop_readv_writev fs/read_write.c:743 [inline]
[<ffffffff815f6503>] do_iter_write+0x253/0x300 fs/read_write.c:863
[<ffffffff815f66ed>] vfs_writev+0xdd/0x240 fs/read_write.c:934
[<ffffffff815f68f6>] do_writev+0xa6/0x1c0 fs/read_write.c:977
[<ffffffff848802d5>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff848802d5>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84a00087>] entry_SYSCALL_64_after_hwframe+0x63/0xcdIn nci_rx_data_packet(), if we don't get a valid conn_info, we will return directly but forget to release the skb.
--- net/nfc/nci/data.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/nfc/nci/data.c +3 -1
@@ -279,8 +279,10 @@ void nci_rx_data_packet(struct nci_dev *ndev, struct sk_buff *skb) nci_plen(skb->data)); conn_info =nci_get_conn_info_by_conn_id (ndev,nci_conn_id (skb->data)); -if (!conn_info) +if (!conn_info) { +kfree_skb (skb);return ; + }/* strip the nci data header */ skb_pull (skb,NCI_DATA_HDR_SIZE );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 114/206 regulator: twl6030: re-add TWL6032_SUBCLASS
In reply to Greg Kroah-HartmanFrom: Andreas Kemnade <[email protected]>
[ Upstream commit 3d6c982b26db94cc21bc9f7784f63e8286b7be62 ]
In former times, info->feature was populated via the parent driver by pdata/regulator_init_data->driver_data for all regulators when USB_PRODUCT_ID_LSB indicates a TWL6032.
Today, the information is not set, so re-add it at the regulator definitions.
--- drivers/regulator/twl6030-regulator.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/regulator/twl6030-regulator.c +2 -0
@@ -530,6 +530,7 @@ static const struct twlreg_info TWL6030_INFO_##label = { \#define TWL6032_ADJUSTABLE_LDO (label, offset) \ static const struct twlreg_info TWL6032_INFO_##label = { \ .base = offset, \ + .features = TWL6032_SUBCLASS, \ .desc = { \ .name = #label, \ .id = TWL6032_REG_##label, \
@@ -562,6 +563,7 @@ static const struct twlreg_info TWLFIXED_INFO_##label = { \#define TWL6032_ADJUSTABLE_SMPS (label, offset) \ static const struct twlreg_info TWLSMPS_INFO_##label = { \ .base = offset, \ + .features = TWL6032_SUBCLASS, \ .desc = { \ .name = #label, \ .id = TWL6032_REG_##label, \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 115/206 bnx2x: fix pci device refcount leak in bnx2x_vf_is_pcie_pending()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 3637a29ccbb6461b7268c5c5db525935d510afc6 ]
As comment of pci_get_domain_bus_and_slot() says, it returns a pci device with refcount increment, when finish using it, the caller must decrement the reference count by calling pci_dev_put(). Call pci_dev_put() before returning from bnx2x_vf_is_pcie_pending() to avoid refcount leak.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +8 -4
@@ -795,16 +795,20 @@ static void bnx2x_vf_enable_traffic(struct bnx2x *bp, struct bnx2x_virtf *vf)static u8 bnx2x_vf_is_pcie_pending (struct bnx2x *bp,u8 abs_vfid) { -struct pci_dev *dev;struct bnx2x_virtf *vf =bnx2x_vf_by_abs_fid (bp, abs_vfid); +struct pci_dev *dev; +bool pending;if (!vf)return false; dev =pci_get_domain_bus_and_slot (vf->domain, vf->bus, vf->devfn); -if (dev) -return bnx2x_is_pcie_pending (dev); -return false; +if (!dev) +return false; + pending =bnx2x_is_pcie_pending (dev); +pci_dev_put (dev); + +return pending; }int bnx2x_vf_flr_clnup_epilog (struct bnx2x *bp,u8 abs_vfid)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 116/206 dma-buf: fix racing conflict of dma_heap_add()
In reply to Greg Kroah-HartmanFrom: Dawei Li <[email protected]>
[ Upstream commit 432e25902b9651622578c6248e549297d03caf66 ]
Racing conflict could be:
task A task Blist_for_each_entrystrcmp(h->name))
list_for_each_entry
strcmp(h->name)
kzalloc kzalloc
...... .....
device_create device_createlist_add
list_add
The root cause is that task B has no idea about the fact someone else(A) has inserted heap with same name when it calls list_add, so a potential collision occurs.
--- drivers/dma-buf/dma-heap.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
drivers/dma-buf/dma-heap.c +15 -13
@@ -233,18 +233,6 @@ struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info)return ERR_PTR (-EINVAL ); } -/* check the name is unique */ -mutex_lock (&heap_list_lock); -list_for_each_entry (h, &heap_list, list) { -if (!strcmp (h->name, exp_info->name)) { -mutex_unlock (&heap_list_lock); -pr_err ("dma_heap: Already registered heap named %s\n" , - exp_info->name); -return ERR_PTR (-EINVAL ); - } - } -mutex_unlock (&heap_list_lock); - heap =kzalloc (sizeof (*heap),GFP_KERNEL );if (!heap)return ERR_PTR (-ENOMEM );
@@ -283,13 +271,27 @@ struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info) err_ret =ERR_CAST (dev_ret); goto err2; } -/* Add heap to the list */ +mutex_lock (&heap_list_lock); +/* check the name is unique */ +list_for_each_entry (h, &heap_list, list) { +if (!strcmp (h->name, exp_info->name)) { +mutex_unlock (&heap_list_lock); +pr_err ("dma_heap: Already registered heap named %s\n" , + exp_info->name); + err_ret =ERR_PTR (-EINVAL ); + goto err3; + } + } + +/* Add heap to the list */ list_add (&heap->list, &heap_list);mutex_unlock (&heap_list_lock);return heap; +err3: +device_destroy (dma_heap_class, heap->heap_devt); err2:cdev_del (&heap->heap_cdev); err1:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 117/206 netfilter: ipset: restore allowing 64 clashing elements in hash:net,iface
In reply to Greg Kroah-HartmanFrom: Jozsef Kadlecsik <[email protected]>
[ Upstream commit 6a66ce44a51bdfc47721f0c591137df2d4b21247 ]
The commit 510841da1fcc ("netfilter: ipset: enforce documented limit to prevent allocating huge memory") was too strict and prevented to add up to 64 clashing elements to a hash:net,iface type of set. This patch fixes the issue and now the type behaves as documented.
--- net/netfilter/ipset/ip_set_hash_gen.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/ipset/ip_set_hash_gen.h +1 -1
@@ -916,7 +916,7 @@ mtype_add(struct ip_set *set, void *value, const struct ip_set_ext *ext,#ifdef IP_SET_HASH_WITH_MULTI if (h->bucketsize >=AHASH_MAX_TUNED ) goto set_full; -else if (h->bucketsize < multi) +else if (h->bucketsize <= multi) h->bucketsize +=AHASH_INIT_SIZE ;#endif if (n->size >=AHASH_MAX (h)) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 118/206 netfilter: flowtable_offload: add missing locking
In reply to Greg Kroah-HartmanFrom: Felix Fietkau <[email protected]>
[ Upstream commit bcd9e3c1656d0f7dd9743598c65c3ae24efb38d0 ]
nf_flow_table_block_setup and the driver TC_SETUP_FT call can modify the flow block cb list while they are being traversed elsewhere, causing a crash. Add a write lock around the calls to protect readers
--- net/netfilter/nf_flow_table_offload.c | 4 ++++ 1 file changed, 4 insertions(+)
net/netfilter/nf_flow_table_offload.c +4 -0
@@ -1074,6 +1074,7 @@ static int nf_flow_table_block_setup(struct nf_flowtable *flowtable,struct flow_block_cb *block_cb, *next;int err =0 ; +down_write (&flowtable->flow_block_lock);switch (cmd) {case FLOW_BLOCK_BIND :list_splice (&bo->cb_list, &flowtable->flow_block.cb_list);
@@ -1088,6 +1089,7 @@ static int nf_flow_table_block_setup(struct nf_flowtable *flowtable,WARN_ON_ONCE (1 ); err = -EOPNOTSUPP ; } +up_write (&flowtable->flow_block_lock);return err; }
@@ -1144,7 +1146,9 @@ static int nf_flow_table_offload_cmd(struct flow_block_offload *bo,nf_flow_table_block_offload_init (bo,dev_net (dev), cmd, flowtable, extack); +down_write (&flowtable->flow_block_lock); err = dev->netdev_ops->ndo_setup_tc (dev,TC_SETUP_FT , bo); +up_write (&flowtable->flow_block_lock);if (err <0 )return err;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 119/206 fs: do not update freeing inode i_io_list
In reply to Greg Kroah-HartmanFrom: Svyatoslav Feldsherov <[email protected]>
[ Upstream commit 4e3c51f4e805291b057d12f5dda5aeb50a538dc4 ]
After commit cbfecb927f42 ("fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE") writeback_single_inode can push inode with I_DIRTY_TIME set to b_dirty_time list. In case of freeing inode with I_DIRTY_TIME set this can happen after deletion of inode from i_io_list at evict. Stack trace is following.
evictfat_evict_inodefat_truncate_blocksfat_flush_inodeswriteback_inodesync_inode_metadata(inode, sync=0) writeback_single_inode(inode, wbc) <- wbc->sync_mode == WB_SYNC_NONE
This will lead to use after free in flusher thread.
Similar issue can be triggered if writeback_single_inode in the stack trace update inode->i_io_list. Add explicit check to avoid it.
--- fs/fs-writeback.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
fs/fs-writeback.c +19 -11
@@ -1739,18 +1739,26 @@ static int writeback_single_inode(struct inode *inode, wb =inode_to_wb_and_lock_list (inode);spin_lock (&inode->i_lock);/* -* If the inode is now fully clean, then it can be safely removed from -* its writeback list (if any). Otherwise the flusher threads are -* responsible for the writeback lists. +* If the inode is freeing, its i_io_list shoudn't be updated +* as it can be finally deleted at this moment. */ -if (!(inode->i_state &I_DIRTY_ALL )) -inode_cgwb_move_to_attached (inode, wb); -else if (!(inode->i_state &I_SYNC_QUEUED )) { -if ((inode->i_state &I_DIRTY )) -redirty_tail_locked (inode, wb); -else if (inode->i_state &I_DIRTY_TIME ) { - inode->dirtied_when = jiffies; -inode_io_list_move_locked (inode, wb, &wb->b_dirty_time); +if (!(inode->i_state &I_FREEING )) { +/* +* If the inode is now fully clean, then it can be safely +* removed from its writeback list (if any). Otherwise the +* flusher threads are responsible for the writeback lists. +*/ +if (!(inode->i_state &I_DIRTY_ALL )) +inode_cgwb_move_to_attached (inode, wb); +else if (!(inode->i_state &I_SYNC_QUEUED )) { +if ((inode->i_state &I_DIRTY )) +redirty_tail_locked (inode, wb); +else if (inode->i_state &I_DIRTY_TIME ) { + inode->dirtied_when = jiffies; +inode_io_list_move_locked (inode, + wb, + &wb->b_dirty_time); + } } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 120/206 dccp/tcp: Reset saddr on failure after inet6?_hash_connect().
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 77934dc6db0d2b111a8f2759e9ad2fb67f5cffa5 ]
When connect() is called on a socket bound to the wildcard address, we change the socket's saddr to a local address. If the socket fails to connect() to the destination, we have to reset the saddr.
However, when an error occurs after inet_hash6?_connect() in (dccp|tcp)_v[46]_conect(), we forget to reset saddr and leave the socket bound to the address.
Quoted 1 line
From the user's point of view, whether saddr is reset or not varies
with errno. Let's fix this inconsistent behaviour.
Note that after this patch, the repro [0] will trigger the WARN_ON() in inet_csk_get_port() again, but this patch is not buggy and rather fixes a bug papering over the bhash2's bug for which we need another fix.
For the record, the repro causes -EADDRNOTAVAIL in inet_hash6_connect() by this sequence:
s1 = socket()
s1.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) s1.bind(('127.0.0.1', 10000)) s1.sendto(b'hello', MSG_FASTOPEN, (('127.0.0.1', 10000)))
# or s1.connect(('127.0.0.1', 10000)) s2 = socket()
s2.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) s2.bind(('0.0.0.0', 10000)) s2.connect(('127.0.0.1', 10000)) # -EADDRNOTAVAIL
s2.listen(32) # WARN_ON(inet_csk(sk)->icsk_bind2_hash != tb2);
[0]: https://syzkaller.appspot.com/bug?extid=015d756bbd1f8b5c8f09
--- net/dccp/ipv4.c | 2 ++ net/dccp/ipv6.c | 2 ++ net/ipv4/tcp_ipv4.c | 2 ++ net/ipv6/tcp_ipv6.c | 2 ++ 4 files changed, 8 insertions(+)
net/dccp/ipv4.c +2 -0
@@ -137,6 +137,8 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)* This unhashes the socket and releases the local port, if necessary. */ dccp_set_state (sk,DCCP_CLOSED ); +if (!(sk->sk_userlocks &SOCK_BINDADDR_LOCK )) +inet_reset_saddr (sk);ip_rt_put (rt); sk->sk_route_caps =0 ; inet->inet_dport =0 ;
net/dccp/ipv6.c +2 -0
@@ -967,6 +967,8 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, late_failure:dccp_set_state (sk,DCCP_CLOSED ); +if (!(sk->sk_userlocks &SOCK_BINDADDR_LOCK )) +inet_reset_saddr (sk);__sk_dst_reset (sk); failure: inet->inet_dport =0 ;
net/ipv4/tcp_ipv4.c +2 -0
@@ -324,6 +324,8 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)* if necessary. */ tcp_set_state (sk,TCP_CLOSE ); +if (!(sk->sk_userlocks &SOCK_BINDADDR_LOCK )) +inet_reset_saddr (sk);ip_rt_put (rt); sk->sk_route_caps =0 ; inet->inet_dport =0 ;
net/ipv6/tcp_ipv6.c +2 -0
@@ -339,6 +339,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, late_failure:tcp_set_state (sk,TCP_CLOSE ); +if (!(sk->sk_userlocks &SOCK_BINDADDR_LOCK )) +inet_reset_saddr (sk); failure: inet->inet_dport =0 ; sk->sk_route_caps =0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 121/206 ipv4: Fix error return code in fib_table_insert()
In reply to Greg Kroah-HartmanFrom: Ziyang Xuan <[email protected]>
[ Upstream commit 568fe84940ac0e4e0b2cd7751b8b4911f7b9c215 ]
In fib_table_insert(), if the alias was already inserted, but node not exist, the error code should be set before return from error handling path.
--- net/ipv4/fib_trie.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv4/fib_trie.c +3 -1
@@ -1375,8 +1375,10 @@ int fib_table_insert(struct net *net, struct fib_table *tb,/* The alias was already inserted, so the node must exist. */ l = l ? l :fib_find_node (t, &tp, key); -if (WARN_ON_ONCE (!l)) +if (WARN_ON_ONCE (!l)) { + err = -ENOENT ; goto out_free_new_fa; + }if (fib_find_alias (&l->leaf, new_fa->fa_slen,0 ,0 , tb->tb_id, true) == new_fa) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 122/206 arcnet: fix potential memory leak in com20020_probe()
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit 1c40cde6b5171d9c8dfc69be00464fd1c75e210b ]
In com20020_probe(), if com20020_config() fails, dev and info will not be freed, which will lead to a memory leak.
This patch adds freeing dev and info after com20020_config() fails to fix this bug.
Compile tested only.
--- drivers/net/arcnet/com20020_cs.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/arcnet/com20020_cs.c +9 -2
@@ -113,6 +113,7 @@ static int com20020_probe(struct pcmcia_device *p_dev)struct com20020_dev *info;struct net_device *dev;struct arcnet_local *lp; +int ret = -ENOMEM ;dev_dbg (&p_dev->dev,"com20020_attach()\n" );
@@ -142,12 +143,18 @@ static int com20020_probe(struct pcmcia_device *p_dev) info->dev = dev; p_dev->priv = info; -return com20020_config (p_dev); + ret =com20020_config (p_dev); +if (ret) + goto fail_config; + +return 0 ; +fail_config: +free_arcdev (dev); fail_alloc_dev:kfree (info); fail_alloc_info: -return -ENOMEM ; +return ret; }/* com20020_attach */ static void com20020_detach (struct pcmcia_device *link)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 123/206 s390/dasd: fix no record found for raw_track_access
In reply to Greg Kroah-HartmanFrom: Stefan Haberland <[email protected]>
[ Upstream commit 590ce6d96d6a224b470a3862c33a483d5022bfdb ]
For DASD devices in raw_track_access mode only full track images are read and written.
For this purpose it is not necessary to do search operation in the locate record extended function. The documentation even states that this might fail if the searched record is not found on a track.
Currently the driver sets a value of 1 in the search field for the first record after record zero. This is the default for disks not in raw_track_access mode but record 1 might be missing on a completely empty track.
There has not been any problem with this on IBM storage servers but it might lead to errors with DASD devices on other vendors storage servers.
Fix this by setting the search field to 0. Record zero is always available even on a completely empty track.
--- drivers/s390/block/dasd_eckd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/s390/block/dasd_eckd.c +2 -4
@@ -4696,7 +4696,6 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_raw(struct dasd_device *startdev,struct dasd_device *basedev;struct req_iterator iter;struct dasd_ccw_req *cqr; -unsigned int first_offs;unsigned int trkcount;unsigned long *idaws;unsigned int size;
@@ -4730,7 +4729,6 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_raw(struct dasd_device *startdev, last_trk = (blk_rq_pos (req) +blk_rq_sectors (req) -1 ) /DASD_RAW_SECTORS_PER_TRACK ; trkcount = last_trk - first_trk +1 ; - first_offs =0 ;if (rq_data_dir (req) ==READ ) cmd =DASD_ECKD_CCW_READ_TRACK ;
@@ -4774,13 +4772,13 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_raw(struct dasd_device *startdev,if (use_prefix) {prefix_LRE (ccw++, data, first_trk, last_trk, cmd, basedev, - startdev,1 , first_offs +1 , trkcount,0 ,0 ); + startdev,1 ,0 , trkcount,0 ,0 ); }else {define_extent (ccw++, data, first_trk, last_trk, cmd, basedev,0 ); ccw[-1 ].flags |=CCW_FLAG_CC ; data +=sizeof (struct DE_eckd_data ); -locate_record_ext (ccw++, data, first_trk, first_offs +1 , +locate_record_ext (ccw++, data, first_trk,0 , trkcount, cmd, basedev,0 ,0 ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 124/206 nfc: st-nci: fix incorrect validating logic in EVT_TRANSACTION
In reply to Greg Kroah-HartmanFrom: Martin Faltesek <[email protected]>
[ Upstream commit c60c152230828825c06e62a8f1ce956d4b659266 ]
The first validation check for EVT_TRANSACTION has two different checks tied together with logical AND. One is a check for minimum packet length, and the other is for a valid aid_tag. If either condition is true (fails), then an error should be triggered. The fix is to change && to ||.
--- drivers/nfc/st-nci/se.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nfc/st-nci/se.c +1 -1
@@ -326,7 +326,7 @@ static int st_nci_hci_connectivity_event_received(struct nci_dev *ndev,* AID 81 5 to 16 * PARAMETERS 82 0 to 255 */ -if (skb->len <NFC_MIN_AID_LENGTH +2 && +if (skb->len <NFC_MIN_AID_LENGTH +2 || skb->data[0 ] !=NFC_EVT_TRANSACTION_AID_TAG )return -EPROTO ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 125/206 nfc: st-nci: fix memory leaks in EVT_TRANSACTION
In reply to Greg Kroah-HartmanFrom: Martin Faltesek <[email protected]>
[ Upstream commit 440f2ae9c9f06e26f5dcea697a53717fc61a318c ]
Error path does not free previously allocated memory. Add devm_kfree() to the failure path.
--- drivers/nfc/st-nci/se.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nfc/st-nci/se.c +3 -1
@@ -339,8 +339,10 @@ static int st_nci_hci_connectivity_event_received(struct nci_dev *ndev,/* Check next byte is PARAMETERS tag (82) */ if (skb->data[transaction->aid_len +2 ] != -NFC_EVT_TRANSACTION_PARAMS_TAG ) +NFC_EVT_TRANSACTION_PARAMS_TAG ) { +devm_kfree (dev, transaction);return -EPROTO ; + } transaction->params_len = skb->data[transaction->aid_len +3 ]; memcpy(transaction->params, skb->data +
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 126/206 nfc: st-nci: fix incorrect sizing calculations in EVT_TRANSACTION
In reply to Greg Kroah-HartmanFrom: Martin Faltesek <[email protected]>
[ Upstream commit 0254f31a7df3bb3b90c2d9dd2d4052f7b95eb287 ]
The transaction buffer is allocated by using the size of the packet buf, and subtracting two which seems intended to remove the two tags which are not present in the target structure. This calculation leads to under counting memory because of differences between the packet contents and the target structure. The aid_len field is a u8 in the packet, but a u32 in the structure, resulting in at least 3 bytes always being under counted. Further, the aid data is a variable length field in the packet, but fixed in the structure, so if this field is less than the max, the difference is added to the under counting.
To fix, perform validation checks progressively to safely reach the next field, to determine the size of both buffers and verify both tags. Once all validation checks pass, allocate the buffer and copy the data. This eliminates freeing memory on the error path, as validation checks are moved ahead of memory allocation.
--- drivers/nfc/st-nci/se.c | 51 +++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 15 deletions(-)
drivers/nfc/st-nci/se.c +36 -15
@@ -312,6 +312,8 @@ static int st_nci_hci_connectivity_event_received(struct nci_dev *ndev,int r =0 ;struct device *dev = &ndev->nfc_dev->dev;struct nfc_evt_transaction *transaction; +u32 aid_len; +u8 params_len;pr_debug ("connectivity gate event: %x\n" , event);
@@ -325,28 +327,47 @@ static int st_nci_hci_connectivity_event_received(struct nci_dev *ndev,* Description Tag Length * AID 81 5 to 16 * PARAMETERS 82 0 to 255 +* +* The key differences are aid storage length is variably sized +* in the packet, but fixed in nfc_evt_transaction, and that +* the aid_len is u8 in the packet, but u32 in the structure, +* and the tags in the packet are not included in +* nfc_evt_transaction. +* +* size(b): 1 1 5-16 1 1 0-255 +* offset: 0 1 2 aid_len + 2 aid_len + 3 aid_len + 4 +* mem name: aid_tag(M) aid_len aid params_tag(M) params_len params +* example: 0x81 5-16 X 0x82 0-255 X */ -if (skb->len <NFC_MIN_AID_LENGTH +2 || - skb->data[0 ] !=NFC_EVT_TRANSACTION_AID_TAG ) +if (skb->len <2 || skb->data[0 ] !=NFC_EVT_TRANSACTION_AID_TAG )return -EPROTO ; - transaction =devm_kzalloc (dev, skb->len -2 ,GFP_KERNEL ); -if (!transaction) -return -ENOMEM ; + aid_len = skb->data[1 ]; - transaction->aid_len = skb->data[1 ]; -memcpy (transaction->aid, &skb->data[2 ], transaction->aid_len); +if (skb->len < aid_len +4 || + aid_len >sizeof (transaction->aid)) +return -EPROTO ; -/* Check next byte is PARAMETERS tag (82) */ -if (skb->data[transaction->aid_len +2 ] != -NFC_EVT_TRANSACTION_PARAMS_TAG ) { -devm_kfree (dev, transaction); + params_len = skb->data[aid_len +3 ]; + +/* Verify PARAMETERS tag is (82), and final check that there is +* enough space in the packet to read everything. +*/ +if (skb->data[aid_len +2 ] !=NFC_EVT_TRANSACTION_PARAMS_TAG || + skb->len < aid_len +4 + params_len)return -EPROTO ; - } - transaction->params_len = skb->data[transaction->aid_len +3 ]; -memcpy (transaction->params, skb->data + - transaction->aid_len +4 , transaction->params_len); + transaction =devm_kzalloc (dev,sizeof (*transaction) + + params_len,GFP_KERNEL ); +if (!transaction) +return -ENOMEM ; + + transaction->aid_len = aid_len; + transaction->params_len = params_len; + +memcpy (transaction->aid, &skb->data[2 ], aid_len); +memcpy (transaction->params, &skb->data[aid_len +4 ], + params_len); r =nfc_se_transaction (ndev->nfc_dev, host, transaction);break ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 127/206 net: enetc: manage ENETC_F_QBV in priv->active_offloads only when enabled
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 32bf8e1f6fb9f6dc334b2b98dffc2e5dcd51e513 ]
Future work in this driver would like to look at priv->active_offloads & ENETC_F_QBV to determine whether a tc-taprio qdisc offload was installed, but this does not produce the intended effect.
All the other flags in priv->active_offloads are managed dynamically, except ENETC_F_QBV which is set statically based on the probed SI capability.
This change makes priv->active_offloads & ENETC_F_QBV really track the presence of a tc-taprio schedule on the port.
Some existing users, like the enetc_sched_speed_set() call from phylink_mac_link_up(), are best kept using the old logic: the tc-taprio offload does not re-trigger another link mode resolve, so the scheduler needs to be functional from the get go, as long as Qbv is supported at all on the port. So to preserve functionality there, look at the static station interface capability from pf->si->hw_features instead.
Stable-dep-of: 290b5fe096e7 ("net: enetc: preserve TX ring priority across reconfiguration")
--- drivers/net/ethernet/freescale/enetc/enetc_pf.c | 6 ++---- drivers/net/ethernet/freescale/enetc/enetc_qos.c | 6 ++++++ 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc_pf.c +2 -4
@@ -800,9 +800,6 @@ static void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, ndev->priv_flags |=IFF_UNICAST_FLT ; -if (si->hw_features &ENETC_SI_F_QBV ) - priv->active_offloads |=ENETC_F_QBV ; -if (si->hw_features &ENETC_SI_F_PSFP && !enetc_psfp_enable (priv)) { priv->active_offloads |=ENETC_F_QCI ; ndev->features |=NETIF_F_HW_TC ;
@@ -1053,7 +1050,8 @@ static void enetc_pl_mac_link_up(struct phylink_config *config,int idx; priv =netdev_priv (pf->si->ndev); -if (priv->active_offloads &ENETC_F_QBV ) + +if (pf->si->hw_features &ENETC_SI_F_QBV )enetc_sched_speed_set (priv, speed); if (!phylink_autoneg_inband(mode) &&
drivers/net/ethernet/freescale/enetc/enetc_qos.c +6 -0
@@ -71,6 +71,9 @@ static int enetc_setup_taprio(struct net_device *ndev,enetc_wr (&priv->si->hw,ENETC_QBV_PTGCR_OFFSET , tge & (~ENETC_QBV_TGE )); + + priv->active_offloads &= ~ENETC_F_QBV ; +return 0 ; }
@@ -136,6 +139,9 @@ static int enetc_setup_taprio(struct net_device *ndev,dma_free_coherent (&priv->si->pdev->dev, data_size +ENETC_QOS_ALIGN , tmp, dma); +if (!err) + priv->active_offloads |=ENETC_F_QBV ; +return err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 128/206 net: enetc: cache accesses to &priv->si->hw
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 715bf2610f1d1adf3d4f9b7b3dd729984ec4270a ]
The &priv->si->hw construct dereferences 2 pointers and makes lines longer than they need to be, in turn making the code harder to read.
Replace &priv->si->hw accesses with a "hw" variable when there are 2 or more accesses within a function that dereference this. This includes loops, since &priv->si->hw is a loop invariant.
Stable-dep-of: 290b5fe096e7 ("net: enetc: preserve TX ring priority across reconfiguration")
--- drivers/net/ethernet/freescale/enetc/enetc.c | 28 +++++---- drivers/net/ethernet/freescale/enetc/enetc.h | 9 +-- .../net/ethernet/freescale/enetc/enetc_qos.c | 60 +++++++++---------- 3 files changed, 49 insertions(+), 48 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc.c +17 -11
@@ -1831,13 +1831,14 @@ static void enetc_setup_rxbdr(struct enetc_hw *hw, struct enetc_bdr *rx_ring)static void enetc_setup_bdrs (struct enetc_ndev_priv *priv) { +struct enetc_hw *hw = &priv->si->hw;int i;for (i =0 ; i < priv->num_tx_rings; i++) -enetc_setup_txbdr (&priv->si->hw, priv->tx_ring[i]); +enetc_setup_txbdr (hw, priv->tx_ring[i]);for (i =0 ; i < priv->num_rx_rings; i++) -enetc_setup_rxbdr (&priv->si->hw, priv->rx_ring[i]); +enetc_setup_rxbdr (hw, priv->rx_ring[i]); }static void enetc_clear_rxbdr (struct enetc_hw *hw,struct enetc_bdr *rx_ring)
@@ -1870,13 +1871,14 @@ static void enetc_clear_txbdr(struct enetc_hw *hw, struct enetc_bdr *tx_ring)static void enetc_clear_bdrs (struct enetc_ndev_priv *priv) { +struct enetc_hw *hw = &priv->si->hw;int i;for (i =0 ; i < priv->num_tx_rings; i++) -enetc_clear_txbdr (&priv->si->hw, priv->tx_ring[i]); +enetc_clear_txbdr (hw, priv->tx_ring[i]);for (i =0 ; i < priv->num_rx_rings; i++) -enetc_clear_rxbdr (&priv->si->hw, priv->rx_ring[i]); +enetc_clear_rxbdr (hw, priv->rx_ring[i]);udelay (1 ); }
@@ -1884,13 +1886,13 @@ static void enetc_clear_bdrs(struct enetc_ndev_priv *priv)static int enetc_setup_irqs (struct enetc_ndev_priv *priv) {struct pci_dev *pdev = priv->si->pdev; +struct enetc_hw *hw = &priv->si->hw;int i, j, err;for (i =0 ; i < priv->bdr_int_num; i++) {int irq =pci_irq_vector (pdev,ENETC_BDR_INT_BASE_IDX + i);struct enetc_int_vector *v = priv->int_vector[i];int entry =ENETC_BDR_INT_BASE_IDX + i; -struct enetc_hw *hw = &priv->si->hw;snprintf (v->name,sizeof (v->name),"%s-rxtx%d" , priv->ndev->name, i);
@@ -1978,13 +1980,14 @@ static void enetc_setup_interrupts(struct enetc_ndev_priv *priv)static void enetc_clear_interrupts (struct enetc_ndev_priv *priv) { +struct enetc_hw *hw = &priv->si->hw;int i;for (i =0 ; i < priv->num_tx_rings; i++) -enetc_txbdr_wr (&priv->si->hw, i,ENETC_TBIER ,0 ); +enetc_txbdr_wr (hw, i,ENETC_TBIER ,0 );for (i =0 ; i < priv->num_rx_rings; i++) -enetc_rxbdr_wr (&priv->si->hw, i,ENETC_RBIER ,0 ); +enetc_rxbdr_wr (hw, i,ENETC_RBIER ,0 ); }static int enetc_phylink_connect (struct net_device *ndev)
@@ -2151,6 +2154,7 @@ int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) {struct enetc_ndev_priv *priv =netdev_priv (ndev);struct tc_mqprio_qopt *mqprio = type_data; +struct enetc_hw *hw = &priv->si->hw;struct enetc_bdr *tx_ring;int num_stack_tx_queues;u8 num_tc;
@@ -2167,7 +2171,7 @@ int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data)/* Reset all ring priorities to 0 */ for (i =0 ; i < priv->num_tx_rings; i++) { tx_ring = priv->tx_ring[i]; -enetc_set_bdr_prio (&priv->si->hw, tx_ring->index,0 ); +enetc_set_bdr_prio (hw, tx_ring->index,0 ); }return 0 ;
@@ -2186,7 +2190,7 @@ int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data)*/ for (i =0 ; i < num_tc; i++) { tx_ring = priv->tx_ring[i]; -enetc_set_bdr_prio (&priv->si->hw, tx_ring->index, i); +enetc_set_bdr_prio (hw, tx_ring->index, i); }/* Reset the number of netdev queues based on the TC count */
@@ -2296,19 +2300,21 @@ static int enetc_set_rss(struct net_device *ndev, int en)static void enetc_enable_rxvlan (struct net_device *ndev,bool en) {struct enetc_ndev_priv *priv =netdev_priv (ndev); +struct enetc_hw *hw = &priv->si->hw;int i;for (i =0 ; i < priv->num_rx_rings; i++) -enetc_bdr_enable_rxvlan (&priv->si->hw, i, en); +enetc_bdr_enable_rxvlan (hw, i, en); }static void enetc_enable_txvlan (struct net_device *ndev,bool en) {struct enetc_ndev_priv *priv =netdev_priv (ndev); +struct enetc_hw *hw = &priv->si->hw;int i;for (i =0 ; i < priv->num_tx_rings; i++) -enetc_bdr_enable_txvlan (&priv->si->hw, i, en); +enetc_bdr_enable_txvlan (hw, i, en); }void enetc_set_features (struct net_device *ndev,netdev_features_t features)
drivers/net/ethernet/freescale/enetc/enetc.h +5 -4
@@ -423,19 +423,20 @@ int enetc_set_psfp(struct net_device *ndev, bool en);static inline void enetc_get_max_cap (struct enetc_ndev_priv *priv) { +struct enetc_hw *hw = &priv->si->hw;u32 reg; - reg =enetc_port_rd (&priv->si->hw,ENETC_PSIDCAPR ); + reg =enetc_port_rd (hw,ENETC_PSIDCAPR ); priv->psfp_cap.max_streamid = reg &ENETC_PSIDCAPR_MSK ;/* Port stream filter capability */ - reg =enetc_port_rd (&priv->si->hw,ENETC_PSFCAPR ); + reg =enetc_port_rd (hw,ENETC_PSFCAPR ); priv->psfp_cap.max_psfp_filter = reg &ENETC_PSFCAPR_MSK ;/* Port stream gate capability */ - reg =enetc_port_rd (&priv->si->hw,ENETC_PSGCAPR ); + reg =enetc_port_rd (hw,ENETC_PSGCAPR ); priv->psfp_cap.max_psfp_gate = (reg &ENETC_PSGCAPR_SGIT_MSK ); priv->psfp_cap.max_psfp_gatelist = (reg &ENETC_PSGCAPR_GCL_MSK ) >>16 ;/* Port flow meter capability */ - reg =enetc_port_rd (&priv->si->hw,ENETC_PFMCAPR ); + reg =enetc_port_rd (hw,ENETC_PFMCAPR ); priv->psfp_cap.max_psfp_meter = reg &ENETC_PFMCAPR_MSK ; }
drivers/net/ethernet/freescale/enetc/enetc_qos.c +27 -33
180 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 129/206 net: enetc: preserve TX ring priority across reconfiguration
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 290b5fe096e7dd0aad730d1af4f7f2d9fea43e11 ]
In the blamed commit, a rudimentary reallocation procedure for RX buffer descriptors was implemented, for the situation when their format changes between normal (no PTP) and extended (PTP).
enetc_hwtstamp_set() calls enetc_close() and enetc_open() in a sequence, and this sequence loses information which was previously configured in the TX BDR Mode Register, specifically via the enetc_set_bdr_prio() call. The TX ring priority is configured by tc-mqprio and tc-taprio, and affects important things for TSN such as the TX time of packets. The issue manifests itself most visibly by the fact that isochron --txtime reports premature packet transmissions when PTP is first enabled on an enetc interface.
Save the TX ring priority in a new field in struct enetc_bdr (occupies a 2 byte hole on arm64) in order to make this survive a ring reconfiguration.
--- drivers/net/ethernet/freescale/enetc/enetc.c | 8 ++++--- drivers/net/ethernet/freescale/enetc/enetc.h | 1 + .../net/ethernet/freescale/enetc/enetc_qos.c | 21 ++++++++++++------- 3 files changed, 19 insertions(+), 11 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc.c +5 -3
@@ -1768,7 +1768,7 @@ static void enetc_setup_txbdr(struct enetc_hw *hw, struct enetc_bdr *tx_ring)/* enable Tx ints by setting pkt thr to 1 */ enetc_txbdr_wr (hw, idx,ENETC_TBICR0 ,ENETC_TBICR0_ICEN |0x1 ); - tbmr =ENETC_TBMR_EN ; + tbmr =ENETC_TBMR_EN |ENETC_TBMR_SET_PRIO (tx_ring->prio);if (tx_ring->ndev->features &NETIF_F_HW_VLAN_CTAG_TX ) tbmr |=ENETC_TBMR_VIH ;
@@ -2171,7 +2171,8 @@ int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data)/* Reset all ring priorities to 0 */ for (i =0 ; i < priv->num_tx_rings; i++) { tx_ring = priv->tx_ring[i]; -enetc_set_bdr_prio (hw, tx_ring->index,0 ); + tx_ring->prio =0 ; +enetc_set_bdr_prio (hw, tx_ring->index, tx_ring->prio); }return 0 ;
@@ -2190,7 +2191,8 @@ int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data)*/ for (i =0 ; i < num_tc; i++) { tx_ring = priv->tx_ring[i]; -enetc_set_bdr_prio (hw, tx_ring->index, i); + tx_ring->prio = i; +enetc_set_bdr_prio (hw, tx_ring->index, tx_ring->prio); }/* Reset the number of netdev queues based on the TC count */
drivers/net/ethernet/freescale/enetc/enetc.h +1 -0
@@ -91,6 +91,7 @@ struct enetc_bdr {void __iomem *rcir; };u16 index; +u16 prio;int bd_count;/* # of BDs */ int next_to_use;int next_to_clean;
drivers/net/ethernet/freescale/enetc/enetc_qos.c +13 -8
@@ -145,6 +145,7 @@ int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data)struct tc_taprio_qopt_offload *taprio = type_data;struct enetc_ndev_priv *priv =netdev_priv (ndev);struct enetc_hw *hw = &priv->si->hw; +struct enetc_bdr *tx_ring;int err;int i;
@@ -153,16 +154,20 @@ int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data)if (priv->tx_ring[i]->tsd_enable)return -EBUSY ; -for (i =0 ; i < priv->num_tx_rings; i++) -enetc_set_bdr_prio (hw, priv->tx_ring[i]->index, - taprio->enable ? i :0 ); +for (i =0 ; i < priv->num_tx_rings; i++) { + tx_ring = priv->tx_ring[i]; + tx_ring->prio = taprio->enable ? i :0 ; +enetc_set_bdr_prio (hw, tx_ring->index, tx_ring->prio); + } err =enetc_setup_taprio (ndev, taprio); - -if (err) -for (i =0 ; i < priv->num_tx_rings; i++) -enetc_set_bdr_prio (hw, priv->tx_ring[i]->index, - taprio->enable ?0 : i); +if (err) { +for (i =0 ; i < priv->num_tx_rings; i++) { + tx_ring = priv->tx_ring[i]; + tx_ring->prio = taprio->enable ?0 : i; +enetc_set_bdr_prio (hw, tx_ring->index, tx_ring->prio); + } + }return err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 130/206 octeontx2-pf: Add check for devm_kcalloc
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit cd07eadd5147ffdae11b6fd28b77a3872f2a2484 ]
As the devm_kcalloc may return NULL pointer,
it should be better to add check for the return
value, as same as the others.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +2 -0
@@ -4832,6 +4832,8 @@ static int nix_setup_ipolicers(struct rvu *rvu, ipolicer->ref_count =devm_kcalloc (rvu->dev, ipolicer->band_prof.max,sizeof (u16),GFP_KERNEL ); +if (!ipolicer->ref_count) +return -ENOMEM ; }/* Set policer timeunit to 2us ie (19 + 1) * 100 nsec = 2us */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 131/206 octeontx2-af: Fix reference count issue in rvu_sdp_init()
In reply to Greg Kroah-HartmanFrom: Xiongfeng Wang <[email protected]>
[ Upstream commit ad17c2a3f11b0f6b122e7842d8f7d9a5fcc7ac63 ]
pci_get_device() will decrease the reference count for the *from* parameter. So we don't need to call put_device() to decrease the reference. Let's remove the put_device() in the loop and only decrease the reference count of the returned 'pdev' for the last loop because it will not be passed to pci_get_device() as input parameter. We don't need to check if 'pdev' is NULL because it is already checked inside pci_dev_put(). Also add pci_dev_put() for the error path.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu_sdp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_sdp.c +5 -2
@@ -62,15 +62,18 @@ int rvu_sdp_init(struct rvu *rvu) pfvf->sdp_info =devm_kzalloc (rvu->dev,sizeof (struct sdp_node_info ),GFP_KERNEL ); -if (!pfvf->sdp_info) +if (!pfvf->sdp_info) { +pci_dev_put (pdev);return -ENOMEM ; + }dev_info (rvu->dev,"SDP PF number:%d\n" , sdp_pf_num[i]); -put_device (&pdev->dev); i++; } +pci_dev_put (pdev); +return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 132/206 net: thunderx: Fix the ACPI memory leak
In reply to Greg Kroah-HartmanFrom: Yu Liao <[email protected]>
[ Upstream commit 661e5ebbafd26d9d2e3c749f5cf591e55c7364f5 ]
The ACPI buffer memory (string.pointer) should be freed as the buffer is not used after returning from bgx_acpi_match_id(), free it to prevent memory leak.
--- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/cavium/thunder/thunder_bgx.c +3 -1
@@ -1435,8 +1435,10 @@ static acpi_status bgx_acpi_match_id(acpi_handle handle, u32 lvl,return AE_OK ; } -if (strncmp (string.pointer, bgx_sel,4 )) +if (strncmp (string.pointer, bgx_sel,4 )) { +kfree (string.pointer);return AE_OK ; + }acpi_walk_namespace (ACPI_TYPE_DEVICE , handle,1 , bgx_acpi_register_phy,NULL , bgx,NULL );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 133/206 s390/crashdump: fix TOD programmable field size
In reply to Greg Kroah-HartmanFrom: Heiko Carstens <[email protected]>
[ Upstream commit f44e07a8afdd713ddc1a8832c39372fe5dd86895 ]
The size of the TOD programmable field was incorrectly increased from four to eight bytes with commit 1a2c5840acf9 ("s390/dump: cleanup CPU save area handling").
This leads to an elf notes section NT_S390_TODPREG which has a size of eight instead of four bytes in case of kdump, however even worse is that the contents is incorrect: it is supposed to contain only the contents of the TOD programmable field, but in fact contains a mix of the TOD programmable field (32 bit upper bits) and parts of the CPU timer register (lower 32 bits).
Fix this by simply changing the size of the todpreg field within the save area structure. This will implicitly also fix the size of the corresponding elf notes sections.
This also gets rid of this compile time warning:
in function ‘fortify_memcpy_chk’,
inlined from ‘save_area_add_regs’ at arch/s390/kernel/crash_dump.c:99:2:./include/linux/fortify-string.h:413:25: error: call to ‘__read_overflow2_field’
declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror=attribute-warning]
413 | __read_overflow2_field(q_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- arch/s390/kernel/crash_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kernel/crash_dump.c +1 -1
@@ -44,7 +44,7 @@ struct save_area {u64 fprs[16 ];u32 fpc;u32 prefix; -u64 todpreg; +u32 todpreg;u64 timer;u64 todcmp;u64 vxrs_low[16 ];
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 134/206 lib/vdso: use "grep -E" instead of "egrep"
In reply to Greg Kroah-HartmanFrom: Greg Kroah-Hartman <[email protected]>
commit 8ac3b5cd3e0521d92f9755e90d140382fc292510 upstream.
The latest version of grep claims the egrep is now obsolete so the build now contains warnings that look like:
egrep: warning: egrep is obsolescent; using grep -E
fix this up by moving the vdso Makefile to use "grep -E" instead.
--- lib/vdso/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/vdso/Makefile +1 -1
@@ -17,6 +17,6 @@ $(error ARCH_REL_TYPE_ABS is not set) endif quiet_cmd_vdso_check = VDSOCHK $@ - cmd_vdso_check = if $(OBJDUMP) -R $@ | egrep -h "$(ARCH_REL_TYPE_ABS)"; \ + cmd_vdso_check = if $(OBJDUMP) -R $@ | grep -E -h "$(ARCH_REL_TYPE_ABS)"; \ then (echo >&2 "$@: dynamic relocations are not supported"; \ rm -f $@; /bin/false); fi
Greg Kroah-Hartman
maintainerPATCH 135/206 init/Kconfig: fix CC_HAS_ASM_GOTO_TIED_OUTPUT test with dash
In reply to Greg Kroah-HartmanFrom: Alexandre Belloni <[email protected]>
[ Upstream commit 534bd70374d646f17e2cebe0e6e4cdd478ce4f0c ]
When using dash as /bin/sh, the CC_HAS_ASM_GOTO_TIED_OUTPUT test fails with a syntax error which is not the one we are looking for:
<stdin>: In function ‘foo’:
<stdin>:1:29: warning: missing terminating " character <stdin>:1:29: error: missing terminating " character <stdin>:2:5: error: expected ‘:’ before ‘+’ token <stdin>:2:7: warning: missing terminating " character <stdin>:2:7: error: missing terminating " character <stdin>:2:5: error: expected declaration or statement at end of input
Removing '\n' solves this.
--- init/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
init/Kconfig +1 -1
@@ -80,7 +80,7 @@ config CC_HAS_ASM_GOTO_OUTPUT config CC_HAS_ASM_GOTO_TIED_OUTPUT depends on CC_HAS_ASM_GOTO_OUTPUT # Detect buggy gcc and clang, fixed in gcc-11 clang-14. - def_bool $(success,echo 'int foo(int *x) { asm goto (".long (%l[bar]) - .\n": "+m"(*x) ::: bar); return *x; bar: return 0; }' | $CC -x c - -c -o /dev/null) + def_bool $(success,echo 'int foo(int *x) { asm goto (".long (%l[bar]) - .": "+m"(*x) ::: bar); return *x; bar: return 0; }' | $CC -x c - -c -o /dev/null) config TOOLS_SUPPORT_RELR def_bool $(success,env "CC=$(CC)" "LD=$(LD)" "NM=$(NM)" "OBJCOPY=$(OBJCOPY)" $(srctree)/scripts/tools-support-relr.sh)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 136/206 nios2: add FORCE for vmlinuz.gz
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 869e4ae4cd2a23d625aaa14ae62dbebf768cb77d ]
Add FORCE to placate a warning from make:
arch/nios2/boot/Makefile:24: FORCE prerequisite is missing
--- arch/nios2/boot/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/nios2/boot/Makefile +1 -1
@@ -20,7 +20,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE $(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE $(call if_changed,gzip) -$(obj)/vmImage: $(obj)/vmlinux.gz +$(obj)/vmImage: $(obj)/vmlinux.gz FORCE $(call if_changed,uimage) @$(kecho) 'Kernel: $@ is ready'
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 137/206 mmc: sdhci-brcmstb: Re-organize flags
In reply to Greg Kroah-HartmanFrom: Al Cooper <[email protected]>
[ Upstream commit f3a70f991dd07330225ea11e158e1d07ad5733fb ]
Re-organize the flags by basing the bit names on the flag that they apply to. Also change the "flags" member in the "brcmstb_match_priv" struct to const.
Stable-dep-of: 56baa208f910 ("mmc: sdhci-brcmstb: Fix SDHCI_RESET_ALL for CQHCI")
--- drivers/mmc/host/sdhci-brcmstb.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/mmc/host/sdhci-brcmstb.c +16 -16
@@ -18,20 +18,22 @@#define SDHCI_VENDOR 0x78#define SDHCI_VENDOR_ENHANCED_STRB 0x1 -#define BRCMSTB_PRIV_FLAGS_NO_64BIT BIT(0) -#define BRCMSTB_PRIV_FLAGS_BROKEN_TIMEOUT BIT(1) +#define BRCMSTB_MATCH_FLAGS_NO_64BIT BIT(0) +#define BRCMSTB_MATCH_FLAGS_BROKEN_TIMEOUT BIT(1) + +#define BRCMSTB_PRIV_FLAGS_HAS_CQE BIT(0)#define SDHCI_ARASAN_CQE_BASE_ADDR 0x200struct sdhci_brcmstb_priv {void __iomem *cfg_regs; -bool has_cqe; +unsigned int flags; };struct brcmstb_match_priv {void (*hs400es)(struct mmc_host *mmc,struct mmc_ios *ios);struct sdhci_ops *ops; -unsigned int flags; +const unsigned int flags; };static void sdhci_brcmstb_hs400es (struct mmc_host *mmc,struct mmc_ios *ios)
@@ -134,13 +136,13 @@ static struct sdhci_ops sdhci_brcmstb_ops_7216 = { };static struct brcmstb_match_priv match_priv_7425 = { - .flags =BRCMSTB_PRIV_FLAGS_NO_64BIT | -BRCMSTB_PRIV_FLAGS_BROKEN_TIMEOUT , + .flags =BRCMSTB_MATCH_FLAGS_NO_64BIT | +BRCMSTB_MATCH_FLAGS_BROKEN_TIMEOUT , .ops = &sdhci_brcmstb_ops, };static struct brcmstb_match_priv match_priv_7445 = { - .flags =BRCMSTB_PRIV_FLAGS_BROKEN_TIMEOUT , + .flags =BRCMSTB_MATCH_FLAGS_BROKEN_TIMEOUT , .ops = &sdhci_brcmstb_ops, };
@@ -176,7 +178,7 @@ static int sdhci_brcmstb_add_host(struct sdhci_host *host,bool dma64;int ret; -if (!priv->has_cqe) +if ((priv->flags &BRCMSTB_PRIV_FLAGS_HAS_CQE ) ==0 )return sdhci_add_host (host);dev_dbg (mmc_dev (host->mmc),"CQE is enabled\n" );
@@ -225,7 +227,6 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)struct sdhci_brcmstb_priv *priv;struct sdhci_host *host;struct resource *iomem; -bool has_cqe = false;struct clk *clk;int res;
@@ -244,10 +245,6 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)return res;memset (&brcmstb_pdata,0 ,sizeof (brcmstb_pdata)); -if (device_property_read_bool (&pdev->dev,"supports-cqe" )) { - has_cqe = true; - match_priv->ops->irq = sdhci_brcmstb_cqhci_irq; - } brcmstb_pdata.ops = match_priv->ops; host =sdhci_pltfm_init (pdev, &brcmstb_pdata,sizeof (struct sdhci_brcmstb_priv ));
@@ -258,7 +255,10 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev) pltfm_host =sdhci_priv (host); priv =sdhci_pltfm_priv (pltfm_host); - priv->has_cqe = has_cqe; +if (device_property_read_bool (&pdev->dev,"supports-cqe" )) { + priv->flags |=BRCMSTB_PRIV_FLAGS_HAS_CQE ; + match_priv->ops->irq = sdhci_brcmstb_cqhci_irq; + }/* Map in the non-standard CFG registers */ iomem =platform_get_resource (pdev,IORESOURCE_MEM ,1 );
@@ -287,14 +287,14 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)* properties through mmc_of_parse(). */ host->caps =sdhci_readl (host,SDHCI_CAPABILITIES ); -if (match_priv->flags &BRCMSTB_PRIV_FLAGS_NO_64BIT ) +if (match_priv->flags &BRCMSTB_MATCH_FLAGS_NO_64BIT ) host->caps &= ~SDHCI_CAN_64BIT ; host->caps1 =sdhci_readl (host,SDHCI_CAPABILITIES_1 ); host->caps1 &= ~(SDHCI_SUPPORT_SDR50 |SDHCI_SUPPORT_SDR104 |SDHCI_SUPPORT_DDR50 ); host->quirks |=SDHCI_QUIRK_MISSING_CAPS ; -if (match_priv->flags &BRCMSTB_PRIV_FLAGS_BROKEN_TIMEOUT ) +if (match_priv->flags &BRCMSTB_MATCH_FLAGS_BROKEN_TIMEOUT ) host->quirks |=SDHCI_QUIRK_BROKEN_TIMEOUT_VAL ; res =sdhci_brcmstb_add_host (host, priv);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 138/206 mmc: sdhci-brcmstb: Enable Clock Gating to save power
In reply to Greg Kroah-HartmanFrom: Al Cooper <[email protected]>
[ Upstream commit 6bcc55fe648b860ef0c2b8dc23adc05bcddb93c2 ]
Enabling this feature will allow the controller to stop the bus clock when the bus is idle. The feature is not part of the standard and is unique to newer Arasan cores and is enabled with a bit in a vendor specific register. This feature will only be enabled for non-removable devices because they don't switch the voltage and clock gating breaks SD Card volatge switching.
Stable-dep-of: 56baa208f910 ("mmc: sdhci-brcmstb: Fix SDHCI_RESET_ALL for CQHCI")
--- drivers/mmc/host/sdhci-brcmstb.c | 35 +++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-brcmstb.c +34 -1
@@ -17,11 +17,14 @@#define SDHCI_VENDOR 0x78#define SDHCI_VENDOR_ENHANCED_STRB 0x1 +#define SDHCI_VENDOR_GATE_SDCLK_EN 0x2#define BRCMSTB_MATCH_FLAGS_NO_64BIT BIT(0)#define BRCMSTB_MATCH_FLAGS_BROKEN_TIMEOUT BIT(1) +#define BRCMSTB_MATCH_FLAGS_HAS_CLOCK_GATE BIT(2)#define BRCMSTB_PRIV_FLAGS_HAS_CQE BIT(0) +#define BRCMSTB_PRIV_FLAGS_GATE_CLOCK BIT(1)#define SDHCI_ARASAN_CQE_BASE_ADDR 0x200
@@ -36,6 +39,27 @@ struct brcmstb_match_priv {const unsigned int flags; }; +static inline void enable_clock_gating (struct sdhci_host *host) +{ +u32 reg; + + reg =sdhci_readl (host,SDHCI_VENDOR ); + reg |=SDHCI_VENDOR_GATE_SDCLK_EN ; +sdhci_writel (host, reg,SDHCI_VENDOR ); +} + +void brcmstb_reset (struct sdhci_host *host,u8 mask) +{ +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +struct sdhci_brcmstb_priv *priv =sdhci_pltfm_priv (pltfm_host); + +sdhci_reset (host, mask); + +/* Reset will clear this, so re-enable it */ +if (priv->flags &BRCMSTB_PRIV_FLAGS_GATE_CLOCK ) +enable_clock_gating (host); +} +static void sdhci_brcmstb_hs400es (struct mmc_host *mmc,struct mmc_ios *ios) {struct sdhci_host *host =mmc_priv (mmc);
@@ -131,7 +155,7 @@ static struct sdhci_ops sdhci_brcmstb_ops = {static struct sdhci_ops sdhci_brcmstb_ops_7216 = { .set_clock = sdhci_brcmstb_set_clock, .set_bus_width = sdhci_set_bus_width, - .reset = sdhci_reset, + .reset = brcmstb_reset, .set_uhs_signaling = sdhci_brcmstb_set_uhs_signaling, };
@@ -147,6 +171,7 @@ static struct brcmstb_match_priv match_priv_7445 = { };static const struct brcmstb_match_priv match_priv_7216 = { + .flags =BRCMSTB_MATCH_FLAGS_HAS_CLOCK_GATE , .hs400es = sdhci_brcmstb_hs400es, .ops = &sdhci_brcmstb_ops_7216, };
@@ -273,6 +298,14 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)if (res) goto err; +/* +* Automatic clock gating does not work for SD cards that may +* voltage switch so only enable it for non-removable devices. +*/ +if ((match_priv->flags &BRCMSTB_MATCH_FLAGS_HAS_CLOCK_GATE ) && + (host->mmc->caps &MMC_CAP_NONREMOVABLE )) + priv->flags |=BRCMSTB_PRIV_FLAGS_GATE_CLOCK ; +/* * If the chip has enhanced strobe and it's enabled, add * callback
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 139/206 mmc: sdhci-brcmstb: Fix SDHCI_RESET_ALL for CQHCI
In reply to Greg Kroah-HartmanFrom: Brian Norris <[email protected]>
[ Upstream commit 56baa208f91061ff27ec2d93fbc483f624d373b4 ]
[[ NOTE: this is completely untested by the author, but included solely
because, as noted in commit df57d73276b8 ("mmc: sdhci-pci: Fix SDHCI_RESET_ALL for CQHCI for Intel GLK-based controllers"), "other drivers using CQHCI might benefit from a similar change, if they also have CQHCI reset by SDHCI_RESET_ALL." We've now seen the same bug on at least MSM, Arasan, and Intel hardware. ]]
SDHCI_RESET_ALL resets will reset the hardware CQE state, but we aren't tracking that properly in software. When out of sync, we may trigger various timeouts.
It's not typical to perform resets while CQE is enabled, but this may occur in some suspend or error recovery scenarios.
Include this fix by way of the new sdhci_and_cqhci_reset() helper.
I only patch the bcm7216 variant even though others potentially *could* provide the 'supports-cqe' property (and thus enable CQHCI), because d46ba2d17f90 ("mmc: sdhci-brcmstb: Add support for Command Queuing (CQE)") and some Broadcom folks confirm that only the 7216 variant actually supports it.
This patch depends on (and should not compile without) the patch entitled "mmc: cqhci: Provide helper for resetting both SDHCI and CQHCI".
--- drivers/mmc/host/sdhci-brcmstb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-brcmstb.c +2 -1
@@ -12,6 +12,7 @@#include <linux/bitops.h> #include <linux/delay.h> +#include "sdhci-cqhci.h" #include "sdhci-pltfm.h" #include "cqhci.h"
@@ -53,7 +54,7 @@ void brcmstb_reset(struct sdhci_host *host, u8 mask)struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host);struct sdhci_brcmstb_priv *priv =sdhci_pltfm_priv (pltfm_host); -sdhci_reset (host, mask); +sdhci_and_cqhci_reset (host, mask);/* Reset will clear this, so re-enable it */ if (priv->flags &BRCMSTB_PRIV_FLAGS_GATE_CLOCK )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 140/206 KVM: arm64: pkvm: Fixup boot mode to reflect that the kernel resumes from EL1
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
The kernel has an awfully complicated boot sequence in order to cope with the various EL2 configurations, including those that "enhanced" the architecture. We go from EL2 to EL1, then back to EL2, staying at EL2 if VHE capable and otherwise go back to EL1.
Here's a paracetamol tablet for you.
The cpu_resume path follows the same logic, because coming up with two versions of a square wheel is hard.
However, things aren't this straightforward with pKVM, as the host resume path is always proxied by the hypervisor, which means that the kernel is always entered at EL1. Which contradicts what the __boot_cpu_mode[] array contains (it obviously says EL2).
This thus triggers a HVC call from EL1 to EL2 in a vain attempt to upgrade from EL1 to EL2 VHE, which we are, funnily enough, reluctant to grant to the host kernel. This is also completely unexpected, and puzzles your average EL2 hacker.
Address it by fixing up the boot mode at the point the host gets deprivileged. is_hyp_mode_available() and co already have a static branch to deal with this, making it pretty safe.
This stable fix doesn't have an upstream version. The entire bootflow has been reworked from 6.0 and that fixed the boot mode at the same time, from commit 005e12676af0 ("arm64: head: record CPU boot mode after enabling the MMU") to be precise. However, the latter is part of a 20 patches long series and can't be simply cherry-pick'ed.
--- arch/arm64/kvm/arm.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm64/kvm/arm.c +11 -0
@@ -2000,6 +2000,17 @@ static int pkvm_drop_host_privileges(voi* once the host stage 2 is installed. */ static_branch_enable (&kvm_protected_mode_initialized); + +/* +* Fixup the boot mode so that we don't take spurious round +* trips via EL2 on cpu_resume. Flush to the PoC for a good +* measure, so that it can be observed by a CPU coming out of +* suspend with the MMU off. +*/ + __boot_cpu_mode[0 ] = __boot_cpu_mode[1 ] =BOOT_CPU_MODE_EL1 ; +dcache_clean_poc ((unsigned long )__boot_cpu_mode, + (unsigned long )(__boot_cpu_mode +2 )); +on_each_cpu (_kvm_host_prot_finalize, &ret,1 );return ret; }
Greg Kroah-Hartman
maintainerPATCH 141/206 usb: dwc3: exynos: Fix remove() function
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
commit e0481e5b3cc12ea7ccf4552d41518c89d3509004 upstream.
The core DWC3 device node was not properly removed by the custom dwc3_exynos_remove_child() function. Replace it with generic of_platform_depopulate() which does that job right.
--- drivers/usb/dwc3/dwc3-exynos.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/usb/dwc3/dwc3-exynos.c +1 -10
@@ -37,15 +37,6 @@ struct dwc3_exynos {struct regulator *vdd10; }; -static int dwc3_exynos_remove_child (struct device *dev,void *unused) -{ -struct platform_device *pdev =to_platform_device (dev); - -platform_device_unregister (pdev); - -return 0 ; -} -static int dwc3_exynos_probe (struct platform_device *pdev) {struct dwc3_exynos *exynos;
@@ -142,7 +133,7 @@ static int dwc3_exynos_remove(struct plastruct dwc3_exynos *exynos =platform_get_drvdata (pdev);int i; -device_for_each_child (&pdev->dev,NULL , dwc3_exynos_remove_child); +of_platform_depopulate (&pdev->dev);for (i = exynos->num_clks -1 ; i >=0 ; i--)clk_disable_unprepare (exynos->clks[i]);
Greg Kroah-Hartman
maintainerPATCH 142/206 usb: cdnsp: Fix issue with Clear Feature Halt Endpoint
In reply to Greg Kroah-HartmanFrom: Pawel Laszczak <[email protected]>
commit b25264f22b498dff3fa5c70c9bea840e83fff0d1 upstream.
During handling Clear Halt Endpoint Feature request, driver invokes Reset Endpoint command. Because this command has some issue with transition endpoint from Running to Idle state the driver must stop the endpoint by using Stop Endpoint command.
--- drivers/usb/cdns3/cdnsp-gadget.c | 12 ++++-------- drivers/usb/cdns3/cdnsp-ring.c | 3 ++- 2 files changed, 6 insertions(+), 9 deletions(-)
drivers/usb/cdns3/cdnsp-gadget.c +4 -8
@@ -600,11 +600,11 @@ int cdnsp_halt_endpoint(struct cdnsp_devtrace_cdnsp_ep_halt (value ?"Set" :"Clear" ); -if (value) { - ret =cdnsp_cmd_stop_ep (pdev, pep); -if (ret) -return ret; + ret =cdnsp_cmd_stop_ep (pdev, pep); +if (ret) +return ret; +if (value) {if (GET_EP_CTX_STATE (pep->out_ctx) ==EP_STATE_STOPPED ) {cdnsp_queue_halt_endpoint (pdev, pep->idx);cdnsp_ring_cmd_db (pdev);
@@ -613,10 +613,6 @@ int cdnsp_halt_endpoint(struct cdnsp_dev pep->ep_state |=EP_HALTED ; }else { -/* -* In device mode driver can call reset endpoint command -* from any endpoint state. -*/ cdnsp_queue_reset_ep (pdev, pep->idx);cdnsp_ring_cmd_db (pdev); ret =cdnsp_wait_for_cmd_compl (pdev);
drivers/usb/cdns3/cdnsp-ring.c +2 -1
@@ -2076,7 +2076,8 @@ int cdnsp_cmd_stop_ep(struct cdnsp_devicu32 ep_state =GET_EP_CTX_STATE (pep->out_ctx);int ret =0 ; -if (ep_state ==EP_STATE_STOPPED || ep_state ==EP_STATE_DISABLED ) { +if (ep_state ==EP_STATE_STOPPED || ep_state ==EP_STATE_DISABLED || + ep_state ==EP_STATE_HALTED ) {trace_cdnsp_ep_stopped_or_disabled (pep->out_ctx); goto ep_stopped; }