4.19.307-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainercover 4.19.307-rc1 review
This is the start of the stable review cycle for the 4.19.307 release. There are 202 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, 23 Feb 2024 12:59:02 +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/v4.x/stable-review/patch-4.19.307-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-4.19.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.19.307-rc1
Dan Carpenter <[email protected]>
netfilter: nf_tables: fix pointer math issue in nft_byteorder_eval()
Alfred Piccioni <[email protected]>
lsm: new security_file_ioctl_compat() hook
Ryusuke Konishi <[email protected]>
nilfs2: replace WARN_ONs for invalid DAT metadata block requests
Ryusuke Konishi <[email protected]>
nilfs2: fix potential bug in end_buffer_async_write
Linus Torvalds <[email protected]>
sched/membarrier: reduce the ability to hammer on sys_membarrier
Junxiao Bi <[email protected]>
Revert "md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d"
Konrad Dybcio <[email protected]>
pmdomain: core: Move the unused cleanup to a _sync initcall
Doug Berger <[email protected]>
irqchip/irq-brcmstb-l2: Add write memory barrier before exit
Daniel Basilio <[email protected]>
nfp: use correct macro for LengthSelect in BAR config
Ryusuke Konishi <[email protected]>
nilfs2: fix hang in nilfs_lookup_dirty_data_buffers()
Ryusuke Konishi <[email protected]>
nilfs2: fix data corruption in dsync block recovery for small block sizes
bo liu <[email protected]>
ALSA: hda/conexant: Add quirk for SWS JS201D
Steve Wahl <[email protected]>
x86/mm/ident_map: Use gbpages only where full GB page should be mapped.
Aleksander Mazur <[email protected]>
x86/Kconfig: Transmeta Crusoe is CPU family 5, not 6
Hugo Villeneuve <[email protected]>
serial: max310x: improve crystal stable clock detection
Hugo Villeneuve <[email protected]>
serial: max310x: set default value when reading clock ready bit
Vincent Donnefort <[email protected]>
ring-buffer: Clean ring_buffer_poll_wait() error return
David Schiller <[email protected]>
staging: iio: ad5933: fix type mismatch regression
Baokun Li <[email protected]>
ext4: fix double-free of blocks due to wrong extents moved_len
Carlos Llamas <[email protected]>
binder: signal epoll threads of self-work
Jan Beulich <[email protected]>
xen-netback: properly sync TX responses
Fedor Pchelkin <[email protected]>
nfc: nci: free rx_data_reassembly skb on NCI device cleanup
Takashi Sakamoto <[email protected]>
firewire: core: correct documentation of fw_csr_string() kernel API
Lee Duncan <[email protected]>
scsi: Revert "scsi: fcoe: Fix potential deadlock on &fip->ctlr_lock"
yuan linyu <[email protected]>
usb: f_mass_storage: forbid async queue when shutdown happen
Oliver Neukum <[email protected]>
USB: hub: check for alternate port before enabling A_ALT_HNP_SUPPORT
Jason Gerecke <[email protected]>
HID: wacom: Do not register input devices until after hid_hw_start
Tatsunosuke Tobita <[email protected]>
HID: wacom: generic: Avoid reporting a serial of '0' to userspace
Zach O'Keefe <[email protected]>
mm/writeback: fix possible divide-by-zero in wb_dirty_limits(), again
Masami Hiramatsu (Google) <[email protected]>
tracing/trigger: Fix to return error if failed to alloc snapshot
Ivan Vecera <[email protected]>
i40e: Fix waiting for queues of all VSIs to be disabled
Guenter Roeck <[email protected]>
MIPS: Add 'memory' clobber to csum_ipv6_magic() inline assembler
Breno Leitao <[email protected]>
net: sysfs: Fix /sys/class/net/<iface> path for statistics
Julian Wiedmann <[email protected]>
Documentation: net-sysfs: describe missing statistics
Alexey Khoroshilov <[email protected]>
ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work()
Uwe Kleine-König <[email protected]>
spi: ppc4xx: Drop write-only variable
David Sterba <[email protected]>
btrfs: send: return EOPNOTSUPP on unknown flags
Boris Burkov <[email protected]>
btrfs: forbid creating subvol qgroups
Frederic Weisbecker <[email protected]>
hrtimer: Report offline hrtimer enqueue
Prathu Baronia <[email protected]>
vhost: use kzalloc() instead of kmalloc() followed by memset()
Hans de Goede <[email protected]>
Input: atkbd - skip ATKBD_CMD_SETLEDS when skipping ATKBD_CMD_GETID
Leonard Dallmayr <[email protected]>
USB: serial: cp210x: add ID for IMST iM871A-USB
Puliang Lu <[email protected]>
USB: serial: option: add Fibocom FM101-GL variant
JackBB Wu <[email protected]>
USB: serial: qcserial: add new usb-id for Dell Wireless DW5826e
Julian Wiedmann <[email protected]>
net/af_iucv: clean up a try_then_request_module()
Pablo Neira Ayuso <[email protected]>
netfilter: nft_compat: restrict match/target protocol to u16
Pablo Neira Ayuso <[email protected]>
netfilter: nft_compat: reject unused compat flag
Eric Dumazet <[email protected]>
ppp_async: limit MRU to 64K
Shigeru Yoshida <[email protected]>
tipc: Check the bearer type before calling tipc_udp_nl_bearer_add()
David Howells <[email protected]>
rxrpc: Fix response to PING RESPONSE ACKs to a dead call
Eric Dumazet <[email protected]>
inet: read sk->sk_family once in inet_recv_error()
Zhang Rui <[email protected]>
hwmon: (coretemp) Fix bogus core_id to attr name mapping
Zhang Rui <[email protected]>
hwmon: (coretemp) Fix out-of-bounds memory access
Loic Prylli <[email protected]>
hwmon: (aspeed-pwm-tacho) mutex for tach reading
Zhipeng Lu <[email protected]>
atm: idt77252: fix a memleak in open_card_ubr0
Tony Lindgren <[email protected]>
phy: ti: phy-omap-usb2: Fix NULL pointer dereference for SRP
Frank Li <[email protected]>
dmaengine: fix is_slave_direction() return false when DMA_DEV_TO_DEV
Zhengchao Shao <[email protected]>
bonding: remove print in bond_verify_device_path
Benjamin Berg <[email protected]>
HID: apple: Add 2021 magic keyboard FN key mapping
free5lot <[email protected]>
HID: apple: Swap the Fn and Left Control keys on Apple keyboards
Alex Henrie <[email protected]>
HID: apple: Add support for the 2021 Magic Keyboard
Breno Leitao <[email protected]>
net: sysfs: Fix /sys/class/net/<iface> path
Eric Dumazet <[email protected]>
af_unix: fix lockdep positive in sk_diag_dump_icons()
Zhipeng Lu <[email protected]>
net: ipv4: fix a memleak in ip_setup_cork
Pablo Neira Ayuso <[email protected]>
netfilter: nf_log: replace BUG_ON by WARN_ON_ONCE when putting logger
Eric Dumazet <[email protected]>
llc: call sock_orphan() at release time
Helge Deller <[email protected]>
ipv6: Ensure natural alignment of const ipv6 loopback and router addresses
Christophe JAILLET <[email protected]>
ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550()
Jedrzej Jagielski <[email protected]>
ixgbe: Refactor overtemp event handling
Jedrzej Jagielski <[email protected]>
ixgbe: Refactor returning internal error codes
Piotr Skajewski <[email protected]>
ixgbe: Remove non-inclusive language
Tom Rix <[email protected]>
net: remove unneeded break
Su Hui <[email protected]>
scsi: isci: Fix an error code problem in isci_io_request_build()
Edward Adam Davis <[email protected]>
wifi: cfg80211: fix RCU dereference in __cfg80211_bss_update
Srinivasan Shanmugam <[email protected]>
drm/amdgpu: Release 'adev->pm.fw' before return in 'amdgpu_device_need_post()'
Xiubo Li <[email protected]>
ceph: fix deadlock or deadcode of misusing dget()
Ming Lei <[email protected]>
blk-mq: fix IO hang from sbitmap wakeup race
Zhu Yanjun <[email protected]>
virtio_net: Fix "‘%d’ directive writing between 1 and 11 bytes into a region of size 10" warnings
Ian Rogers <[email protected]>
libsubcmd: Fix memory leak in uniq()
Hans de Goede <[email protected]>
misc: lis3lv02d_i2c: Add missing setting of the reg_ctrl callback
Hardik Gajjar <[email protected]>
usb: hub: Replace hardcoded quirk value with BIT() macro
Guilherme G. Piccoli <[email protected]>
PCI: Only override AMD USB controller if required
Peter Robinson <[email protected]>
mfd: ti_am335x_tscadc: Fix TI SoC dependencies
Nathan Chancellor <[email protected]>
um: net: Fix return type of uml_net_start_xmit()
Benjamin Berg <[email protected]>
um: Don't use vfprintf() for os_info()
Anton Ivanov <[email protected]>
um: Fix naming clash between UML and scheduler
Heiner Kallweit <[email protected]>
leds: trigger: panic: Don't register panic notifier if creating the trigger failed
Srinivasan Shanmugam <[email protected]>
drm/amdgpu: Drop 'fence' check in 'to_amdgpu_amdkfd_fence()'
Felix Kuehling <[email protected]>
drm/amdgpu: Let KFD sync with VM fences
Josip Pavic <[email protected]>
drm/amd/display: make flip_timestamp_in_us a 64-bit variable
Kuan-Wei Chiu <[email protected]>
clk: mmp: pxa168: Fix memory leak in pxa168_clk_init()
Kuan-Wei Chiu <[email protected]>
clk: hi3620: Fix memory leak in hi3620_mmc_clk_init()
Rob Clark <[email protected]>
drm/msm/dpu: Ratelimit framedone timeout msgs
Su Hui <[email protected]>
media: ddbridge: fix an error code problem in ddb_probe
Daniel Vacek <[email protected]>
IB/ipoib: Fix mcast list locking
Douglas Anderson <[email protected]>
drm/exynos: Call drm_atomic_helper_shutdown() at shutdown/unbind time
Pierre-Louis Bossart <[email protected]>
ALSA: hda: Intel: add HDA_ARL PCI ID support
Pierre-Louis Bossart <[email protected]>
PCI: add INTEL_HDA_ARL to pci_ids.h
Michael Tretter <[email protected]>
media: rockchip: rga: fix swizzling for RGB formats
Ghanshyam Agrawal <[email protected]>
media: stk1160: Fixed high volume of stk1160_dbg messages
Tomi Valkeinen <[email protected]>
drm/mipi-dsi: Fix detach call without attach
Tomi Valkeinen <[email protected]>
drm/framebuffer: Fix use of uninitialized variable
Tomi Valkeinen <[email protected]>
drm/drm_file: fix use of uninitialized variable
Jack Wang <[email protected]>
RDMA/IPoIB: Fix error code return in ipoib_mcast_join
Al Viro <[email protected]>
fast_dput(): handle underflows gracefully
Cristian Ciocaltea <[email protected]>
ASoC: doc: Fix undefined SND_SOC_DAPM_NOPM argument
Chao Yu <[email protected]>
f2fs: fix to check return value of f2fs_reserve_new_block()
Benjamin Berg <[email protected]>
wifi: cfg80211: free beacon_ies when overridden from hidden BSS
Su Hui <[email protected]>
wifi: rtlwifi: rtl8723{be,ae}: using calculate_bit_shift()
Zenm Chen <[email protected]>
wifi: rtl8xxxu: Add additional USB IDs for RTL8192EU devices
Alex Lyakas <[email protected]>
md: Whenassemble the array, consult the superblock of the freshest device
Fabio Estevam <[email protected]>
ARM: dts: imx23/28: Fix the DMA controller node name
Fabio Estevam <[email protected]>
ARM: dts: imx23-sansa: Use preferred i2c-gpios properties
Fabio Estevam <[email protected]>
ARM: dts: imx27-apf27dev: Fix LED name
Fabio Estevam <[email protected]>
ARM: dts: imx1: Fix sram node
Fabio Estevam <[email protected]>
ARM: dts: imx27: Fix sram node
Fabio Estevam <[email protected]>
ARM: dts: imx: Use flash@0,0 pattern
Fabio Estevam <[email protected]>
ARM: dts: imx25/27-eukrea: Fix RTC node name
Johan Jonker <[email protected]>
ARM: dts: rockchip: fix rk3036 hdmi ports node
Hannes Reinecke <[email protected]>
scsi: libfc: Fix up timeout error in fc_fcp_rec_error()
Hannes Reinecke <[email protected]>
scsi: libfc: Don't schedule abort twice
Hou Tao <[email protected]>
bpf: Add map and need_defer parameters to .map_fd_put_ptr()
Minsuk Kang <[email protected]>
wifi: ath9k: Fix potential array-index-out-of-bounds read in ath9k_htc_txstatus()
Alexander Stein <[email protected]>
ARM: dts: imx7s: Fix nand-controller #size-cells
Alexander Stein <[email protected]>
ARM: dts: imx7s: Fix lcdif compatible
Zhengchao Shao <[email protected]>
bonding: return -ENOMEM instead of BUG in alb_upper_dev_walk
Ido Schimmel <[email protected]>
PCI: Add no PM reset quirk for NVIDIA Spectrum devices
Justin Tee <[email protected]>
scsi: lpfc: Fix possible file string name overflow when updating firmware
Baokun Li <[email protected]>
ext4: avoid online resizing failures due to oversized flex bg
Baokun Li <[email protected]>
ext4: remove unnecessary check from alloc_flex_gd()
Baokun Li <[email protected]>
ext4: unify the type of flexbg_size to unsigned int
Ye Bin <[email protected]>
ext4: fix inconsistent between segment fstrim and full fstrim
Anna Schumaker <[email protected]>
SUNRPC: Fix a suspicious RCU usage warning
Heiko Carstens <[email protected]>
KVM: s390: fix setting of fpc register
Heiko Carstens <[email protected]>
s390/ptrace: handle setting of fpc register correctly
Edward Adam Davis <[email protected]>
jfs: fix array-index-out-of-bounds in diNewExt
Oleg Nesterov <[email protected]>
rxrpc_find_service_conn_rcu: fix the usage of read_seqbegin_or_lock()
Oleg Nesterov <[email protected]>
afs: fix the usage of read_seqbegin_or_lock() in afs_find_server*()
Thomas Bourgoin <[email protected]>
crypto: stm32/crc32 - fix parsing list of devices
Weichen Chen <[email protected]>
pstore/ram: Fix crash when setting number of cpus to an odd number
Edward Adam Davis <[email protected]>
jfs: fix uaf in jfs_evict_inode
Manas Ghandat <[email protected]>
jfs: fix array-index-out-of-bounds in dbAdjTree
Manas Ghandat <[email protected]>
jfs: fix slab-out-of-bounds Read in dtSearch
Osama Muhammad <[email protected]>
UBSAN: array-index-out-of-bounds in dtSplitRoot
Osama Muhammad <[email protected]>
FS:JFS:UBSAN:array-index-out-of-bounds in dbAdjTree
Prarit Bhargava <[email protected]>
ACPI: extlog: fix NULL pointer dereference check
Dmitry Antipov <[email protected]>
PNP: ACPI: fix fortify warning
Yuluo Qiu <[email protected]>
ACPI: video: Add quirk for the Colorful X15 AT 23 Laptop
Chris Riches <[email protected]>
audit: Send netlink ACK before setting connection in auditd_set
Naveen N Rao <[email protected]>
powerpc/lib: Validate size for vector operations
Michael Ellerman <[email protected]>
powerpc/mm: Fix build failures due to arch_reserved_kernel_pages()
Michael Ellerman <[email protected]>
powerpc: Fix build error due to is_valid_bugaddr()
Kunwu Chan <[email protected]>
powerpc/mm: Fix null-pointer dereference in pgtable_cache_add
Vinicius Costa Gomes <[email protected]>
net/sched: cbs: Fix not adding cbs instance to list
Richard Palethorpe <[email protected]>
x86/entry/ia32: Ensure s32 is sign extended to s64
Tim Chen <[email protected]>
tick/sched: Preserve number of idle sleeps across CPU hotplug events
Xi Ruoyao <[email protected]>
mips: Call lose_fpu(0) before initializing fcr31 in mips_set_personality_nan
Wenhua Lin <[email protected]>
gpio: eic-sprd: Clear interrupt after set the interrupt type
Fedor Pchelkin <[email protected]>
drm/exynos: gsc: minor fix for loop iteration in gsc_runtime_resume
Dan Carpenter <[email protected]>
drm/bridge: nxp-ptn3460: simplify some error checking
Dan Carpenter <[email protected]>
drm/bridge: nxp-ptn3460: fix i2c_master_send() error checking
Ville Syrjälä <[email protected]>
drm: Don't unref the same fb many times by mistake due to deadlock handling
Mario Limonciello <[email protected]>
gpiolib: acpi: Ignore touchpad wakeup on GPD G1619-04
Florian Westphal <[email protected]>
netfilter: nf_tables: reject QUEUE/DROP verdict parameters
Qu Wenruo <[email protected]>
btrfs: defrag: reject unknown flags of btrfs_ioctl_defrag_range_args
David Sterba <[email protected]>
btrfs: don't warn if discard range is not aligned to sector
Shenwei Wang <[email protected]>
net: fec: fix the unhandled context fault from smmu
Zhipeng Lu <[email protected]>
fjes: fix memleaks in fjes_hw_setup
Florian Westphal <[email protected]>
netfilter: nf_tables: restrict anonymous set and map names to 16 bytes
Zhipeng Lu <[email protected]>
net/mlx5e: fix a double-free in arfs_create_groups
Denis Efremov <[email protected]>
net/mlx5: Use kfree(ft->g) in arfs_create_groups()
Zhengchao Shao <[email protected]>
netlink: fix potential sleeping issue in mqueue_flush_file
Salvatore Dipietro <[email protected]>
tcp: Add memory barrier to tcp_push()
Petr Pavlu <[email protected]>
tracing: Ensure visibility when inserting an element into tracing_map
Sharath Srinivasan <[email protected]>
net/rds: Fix UBSAN: array-index-out-of-bounds in rds_cmsg_recv
Kuniyuki Iwashima <[email protected]>
llc: Drop support for ETH_P_TR_802_2.
Eric Dumazet <[email protected]>
llc: make llc_ui_sendmsg() more robust against bonding changes
Lin Ma <[email protected]>
vlan: skip nested type that is not IFLA_VLAN_QOS_MAPPING
Wen Gu <[email protected]>
net/smc: fix illegal rmb_desc access in SMC-D connection dump
Mauro Carvalho Chehab <[email protected]>
drivers: core: fix kernel-doc markup for dev_err_probe()
Michał Mirosław <[email protected]>
driver code: print symbolic error code
Greg Kroah-Hartman <[email protected]>
Revert "driver core: Annotate dev_err_probe() with __must_check"
Andy Shevchenko <[email protected]>
driver core: Annotate dev_err_probe() with __must_check
Maciej S. Szmigiero <[email protected]>
x86/CPU/AMD: Fix disabling XSAVES on AMD family 0x17 due to erratum
Nathan Chancellor <[email protected]>
powerpc: Use always instead of always-y in for crtsavres.o
Matthew Wilcox (Oracle) <[email protected]>
block: Remove special-casing of compound pages
Dave Airlie <[email protected]>
nouveau/vmm: don't set addr on the fail path to avoid warning
Helge Deller <[email protected]>
parisc/firmware: Fix F-extend for PDC addresses
Xiaolei Wang <[email protected]>
rpmsg: virtio: Free driver_override when rpmsg_remove()
Herbert Xu <[email protected]>
hwrng: core - Fix page fault dead lock on mmap-ed hwrng
Hongchen Zhang <[email protected]>
PM: hibernate: Enforce ordering during image compression/decompression
Herbert Xu <[email protected]>
crypto: api - Disallow identical driver names
Suraj Jitindar Singh <[email protected]>
ext4: allow for the last group to be marked as trimmed
Hugo Villeneuve <[email protected]>
serial: sc16is7xx: add check for unsupported SPI modes during probe
Oleksij Rempel <[email protected]>
spi: introduce SPI_MODE_X_MASK macro
Andrzej Hajda <[email protected]>
driver core: add device probe log helper
Hugo Villeneuve <[email protected]>
serial: sc16is7xx: set safe default SPI clock frequency
Daniel Lezcano <[email protected]>
units: add the HZ macros
Daniel Lezcano <[email protected]>
units: change from 'L' to 'UL'
Daniel Lezcano <[email protected]>
units: Add Watt units
Akinobu Mita <[email protected]>
include/linux/units.h: add helpers for kelvin to/from Celsius conversion
qizhong cheng <[email protected]>
PCI: mediatek: Clear interrupt status before dispatching handler
-------------
Diffstat:
Documentation/ABI/testing/sysfs-class-net-queues | 22 +-- .../ABI/testing/sysfs-class-net-statistics | 60 ++++--- Documentation/sound/soc/dapm.rst | 2 +- Makefile | 4 +- arch/arm/boot/dts/imx1-ads.dts | 2 +- arch/arm/boot/dts/imx1-apf9328.dts | 2 +- arch/arm/boot/dts/imx1.dtsi | 5 +- arch/arm/boot/dts/imx23-sansa.dts | 12 +- arch/arm/boot/dts/imx23.dtsi | 2 +- arch/arm/boot/dts/imx25-eukrea-cpuimx25.dtsi | 2 +- arch/arm/boot/dts/imx27-apf27dev.dts | 2 +- arch/arm/boot/dts/imx27-eukrea-cpuimx27.dtsi | 4 +- arch/arm/boot/dts/imx27-phytec-phycore-som.dtsi | 2 +- arch/arm/boot/dts/imx27.dtsi | 3 + arch/arm/boot/dts/imx28.dtsi | 2 +- arch/arm/boot/dts/imx7s.dtsi | 4 +- arch/arm/boot/dts/rk3036.dtsi | 14 +- arch/mips/include/asm/checksum.h | 3 +- arch/mips/kernel/elf.c | 6 + arch/parisc/kernel/firmware.c | 4 +- arch/powerpc/include/asm/mmu.h | 4 + arch/powerpc/include/asm/mmzone.h | 3 - arch/powerpc/kernel/traps.c | 2 + arch/powerpc/lib/Makefile | 4 +- arch/powerpc/lib/sstep.c | 10 ++ arch/powerpc/mm/init-common.c | 5 +- arch/s390/kernel/ptrace.c | 6 +- arch/s390/kvm/kvm-s390.c | 5 - arch/um/drivers/net_kern.c | 2 +- arch/um/include/shared/kern_util.h | 2 +- arch/um/kernel/process.c | 2 +- arch/um/os-Linux/helper.c | 6 +- arch/um/os-Linux/util.c | 19 ++- arch/x86/Kconfig.cpu | 2 +- arch/x86/include/asm/syscall_wrapper.h | 25 ++- arch/x86/kernel/cpu/amd.c | 20 +-- arch/x86/mm/ident_map.c | 23 ++- block/bio.c | 5 +- block/blk-mq.c | 16 ++ crypto/algapi.c | 1 + drivers/acpi/acpi_extlog.c | 5 +- drivers/acpi/acpi_video.c | 9 ++ drivers/android/binder.c | 10 ++ drivers/atm/idt77252.c | 2 + drivers/base/core.c | 44 +++++ drivers/base/power/domain.c | 2 +- drivers/char/hw_random/core.c | 36 +++-- drivers/clk/hisilicon/clk-hi3620.c | 4 +- drivers/clk/mmp/clk-of-pxa168.c | 3 + drivers/crypto/stm32/stm32_crc32.c | 2 +- drivers/firewire/core-device.c | 7 +- drivers/gpio/gpio-eic-sprd.c | 32 +++- drivers/gpio/gpiolib-acpi.c | 14 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 3 +- drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 2 +- drivers/gpu/drm/bridge/nxp-ptn3460.c | 6 +- drivers/gpu/drm/drm_file.c | 2 +- drivers/gpu/drm/drm_framebuffer.c | 2 +- drivers/gpu/drm/drm_mipi_dsi.c | 17 +- drivers/gpu/drm/drm_plane.c | 1 + drivers/gpu/drm/exynos/exynos_drm_drv.c | 11 ++ drivers/gpu/drm/exynos/exynos_drm_gsc.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 5 +- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 1 + drivers/gpu/drm/nouveau/nouveau_vmm.c | 3 + drivers/hid/hid-apple.c | 63 +++++++- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-quirks.c | 1 + drivers/hid/wacom_sys.c | 63 +++++--- drivers/hid/wacom_wac.c | 9 +- drivers/hwmon/aspeed-pwm-tacho.c | 7 + drivers/hwmon/coretemp.c | 40 ++--- drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 7 +- drivers/input/keyboard/atkbd.c | 13 +- drivers/irqchip/irq-brcmstb-l2.c | 3 + drivers/leds/trigger/ledtrig-panic.c | 5 +- drivers/md/md.c | 54 +++++-- drivers/md/raid5.c | 12 -- drivers/media/pci/ddbridge/ddbridge-main.c | 2 +- drivers/media/platform/rockchip/rga/rga.c | 15 +- drivers/media/usb/stk1160/stk1160-video.c | 5 +- drivers/mfd/Kconfig | 1 + drivers/misc/lis3lv02d/lis3lv02d_i2c.c | 1 + drivers/net/bonding/bond_alb.c | 3 +- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 1 - drivers/net/ethernet/cisco/enic/enic_ethtool.c | 1 - drivers/net/ethernet/freescale/fec_main.c | 2 + drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c | 36 ++--- drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c | 61 ++++--- drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 177 ++++++++++----------- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 44 +++-- drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.c | 34 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h | 1 - drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 105 ++++++------ drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 51 +----- drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c | 45 +++--- drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 149 ++++++++--------- drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c | 26 +-- .../ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c | 6 +- drivers/net/fjes/fjes_hw.c | 37 ++++- drivers/net/ppp/ppp_async.c | 4 + drivers/net/virtio_net.c | 9 +- drivers/net/wan/lmc/lmc_proto.c | 4 - drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 5 +- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 12 ++ .../net/wireless/realtek/rtlwifi/rtl8723ae/phy.c | 6 +- .../net/wireless/realtek/rtlwifi/rtl8723be/phy.c | 4 +- drivers/net/xen-netback/netback.c | 100 ++++++------ drivers/pci/controller/pcie-mediatek.c | 10 +- drivers/pci/quirks.c | 24 ++- drivers/phy/ti/phy-omap-usb2.c | 4 +- drivers/pnp/pnpacpi/rsparser.c | 12 +- drivers/rpmsg/virtio_rpmsg_bus.c | 1 + drivers/scsi/fcoe/fcoe_ctlr.c | 20 +-- drivers/scsi/isci/request.c | 2 +- drivers/scsi/libfc/fc_fcp.c | 18 ++- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_init.c | 4 +- drivers/spi/spi-ppc4xx.c | 5 - drivers/staging/iio/impedance-analyzer/ad5933.c | 2 +- drivers/tty/serial/max310x.c | 21 ++- drivers/tty/serial/sc16is7xx.c | 8 +- drivers/usb/core/hub.c | 34 ++-- drivers/usb/gadget/function/f_mass_storage.c | 20 ++- drivers/usb/serial/cp210x.c | 1 + drivers/usb/serial/option.c | 1 + drivers/usb/serial/qcserial.c | 2 + drivers/vhost/vhost.c | 5 +- fs/afs/server.c | 7 +- fs/btrfs/extent-tree.c | 3 +- fs/btrfs/ioctl.c | 9 ++ fs/btrfs/send.c | 2 +- fs/ceph/caps.c | 9 +- fs/compat_ioctl.c | 3 +- fs/dcache.c | 7 +- fs/ext4/mballoc.c | 26 ++- fs/ext4/move_extent.c | 6 +- fs/ext4/resize.c | 37 +++-- fs/f2fs/recovery.c | 23 ++- fs/jfs/jfs_dmap.c | 57 ++++--- fs/jfs/jfs_dtree.c | 7 +- fs/jfs/jfs_imap.c | 3 + fs/jfs/jfs_mount.c | 6 +- fs/nilfs2/dat.c | 27 ++-- fs/nilfs2/file.c | 8 +- fs/nilfs2/recovery.c | 7 +- fs/nilfs2/segment.c | 8 +- fs/pstore/ram.c | 1 + include/drm/drm_mipi_dsi.h | 2 + include/linux/bpf.h | 6 +- include/linux/device.h | 3 + include/linux/dmaengine.h | 3 +- include/linux/hrtimer.h | 4 +- include/linux/lsm_hooks.h | 9 ++ include/linux/pci_ids.h | 1 + include/linux/security.h | 9 ++ include/linux/spi/spi.h | 1 + include/linux/syscalls.h | 1 + include/linux/units.h | 92 +++++++++++ include/net/af_unix.h | 20 ++- include/net/llc_pdu.h | 6 +- include/uapi/linux/btrfs.h | 3 + include/uapi/linux/netfilter/nf_tables.h | 2 + kernel/audit.c | 31 +++- kernel/bpf/arraymap.c | 12 +- kernel/bpf/hashtab.c | 6 +- kernel/bpf/map_in_map.c | 2 +- kernel/bpf/map_in_map.h | 2 +- kernel/power/swap.c | 38 ++--- kernel/sched/membarrier.c | 6 + kernel/time/hrtimer.c | 3 + kernel/time/tick-sched.c | 5 + kernel/trace/ring_buffer.c | 2 +- kernel/trace/trace_events_trigger.c | 6 +- kernel/trace/tracing_map.c | 7 +- mm/page-writeback.c | 2 +- net/8021q/vlan_netlink.c | 4 + net/ipv4/af_inet.c | 6 +- net/ipv4/ip_output.c | 12 +- net/ipv4/tcp.c | 1 + net/ipv6/addrconf_core.c | 21 ++- net/iucv/af_iucv.c | 14 +- net/llc/af_llc.c | 26 ++- net/llc/llc_core.c | 7 - net/netfilter/nf_log.c | 7 +- net/netfilter/nf_tables_api.c | 20 +-- net/netfilter/nft_byteorder.c | 5 +- net/netfilter/nft_compat.c | 11 +- net/netlink/af_netlink.c | 2 +- net/nfc/nci/core.c | 4 + net/rds/af_rds.c | 2 +- net/rxrpc/conn_event.c | 8 + net/rxrpc/conn_service.c | 3 +- net/sched/sch_cbs.c | 30 ++-- net/smc/smc_diag.c | 2 +- net/sunrpc/xprtmultipath.c | 17 +- net/tipc/bearer.c | 6 + net/unix/af_unix.c | 14 +- net/unix/diag.c | 2 +- net/wireless/scan.c | 4 + security/security.c | 17 ++ security/selinux/hooks.c | 28 ++++ security/smack/smack_lsm.c | 1 + security/tomoyo/tomoyo.c | 1 + sound/pci/hda/hda_intel.c | 2 + sound/pci/hda/patch_conexant.c | 18 +++ sound/soc/codecs/rt5645.c | 1 + tools/lib/subcmd/help.c | 18 ++- 214 files changed, 1810 insertions(+), 1019 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/202 PCI: mediatek: Clear interrupt status before dispatching handler
4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: qizhong cheng <[email protected]>
[ Upstream commit 4e11c29873a8a296a20f99b3e03095e65ebf897d ]
We found a failure when using the iperf tool during WiFi performance testing, where some MSIs were received while clearing the interrupt status, and these MSIs cannot be serviced.
The interrupt status can be cleared even if the MSI status remains pending. As such, given the edge-triggered interrupt type, its status should be cleared before being dispatched to the handler of the underling device.
--- drivers/pci/controller/pcie-mediatek.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/pci/controller/pcie-mediatek.c +8 -2
@@ -605,14 +605,20 @@ static void mtk_pcie_intr_handler(struct irq_desc *desc)if (status &MSI_STATUS ){unsigned long imsi_status; +/* +* The interrupt status can be cleared even if the +* MSI status remains pending. As such, given the +* edge-triggered interrupt type, its status should +* be cleared before being dispatched to the +* handler of the underlying device. +*/ +writel (MSI_STATUS , port->base +PCIE_INT_STATUS );while ((imsi_status =readl (port->base +PCIE_IMSI_STATUS ))) {for_each_set_bit (bit, &imsi_status,MTK_MSI_IRQS_NUM ) { virq =irq_find_mapping (port->inner_domain, bit);generic_handle_irq (virq); } } -/* Clear MSI interrupt status */ -writel (MSI_STATUS , port->base +PCIE_INT_STATUS ); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 2/202 include/linux/units.h: add helpers for kelvin to/from Celsius conversion
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akinobu Mita <[email protected]>
[ Upstream commit 23331e4893614deb555c65cdf115c8a28ed32471 ]
Patch series "add header file for kelvin to/from Celsius conversion helpers", v4.
There are several helper macros to convert kelvin to/from Celsius in <linux/thermal.h> for thermal drivers. These are useful for any other drivers or subsystems, but it's odd to include <linux/thermal.h> just for the helpers.
This adds a new <linux/units.h> that provides the equivalent inline functions for any drivers or subsystems, and switches all the users of conversion helpers in <linux/thermal.h> to use <linux/units.h> helpers.
This patch (of 12):
There are several helper macros to convert kelvin to/from Celsius in <linux/thermal.h> for thermal drivers. These are useful for any other drivers or subsystems, but it's odd to include <linux/thermal.h> just for the helpers.
This adds a new <linux/units.h> that provides the equivalent inline functions for any drivers or subsystems. It is intended to replace the helpers in <linux/thermal.h>.
Stable-dep-of: 3ef79cd14122 ("serial: sc16is7xx: set safe default SPI clock frequency")
--- include/linux/units.h | 84 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 include/linux/units.h
include/linux/units.h new file +84 -0
@@ -0,0 +1,84 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_UNITS_H +#define _LINUX_UNITS_H + +#include <linux/kernel.h> + +#define ABSOLUTE_ZERO_MILLICELSIUS -273150 + +static inline long milli_kelvin_to_millicelsius (long t) +{ +return t +ABSOLUTE_ZERO_MILLICELSIUS ; +} + +static inline long millicelsius_to_milli_kelvin (long t) +{ +return t -ABSOLUTE_ZERO_MILLICELSIUS ; +} + +#define MILLIDEGREE_PER_DEGREE 1000 +#define MILLIDEGREE_PER_DECIDEGREE 100 + +static inline long kelvin_to_millicelsius (long t) +{ +return milli_kelvin_to_millicelsius (t *MILLIDEGREE_PER_DEGREE ); +} + +static inline long millicelsius_to_kelvin (long t) +{ + t =millicelsius_to_milli_kelvin (t); + +return DIV_ROUND_CLOSEST (t,MILLIDEGREE_PER_DEGREE ); +} + +static inline long deci_kelvin_to_celsius (long t) +{ + t =milli_kelvin_to_millicelsius (t *MILLIDEGREE_PER_DECIDEGREE ); + +return DIV_ROUND_CLOSEST (t,MILLIDEGREE_PER_DEGREE ); +} + +static inline long celsius_to_deci_kelvin (long t) +{ + t =millicelsius_to_milli_kelvin (t *MILLIDEGREE_PER_DEGREE ); + +return DIV_ROUND_CLOSEST (t,MILLIDEGREE_PER_DECIDEGREE ); +} + +/** +* deci_kelvin_to_millicelsius_with_offset - convert Kelvin to Celsius +* @t: temperature value in decidegrees Kelvin +* @offset: difference between Kelvin and Celsius in millidegrees +* +* Return: temperature value in millidegrees Celsius +*/ +static inline long deci_kelvin_to_millicelsius_with_offset (long t,long offset) +{ +return t *MILLIDEGREE_PER_DECIDEGREE - offset; +} + +static inline long deci_kelvin_to_millicelsius (long t) +{ +return milli_kelvin_to_millicelsius (t *MILLIDEGREE_PER_DECIDEGREE ); +} + +static inline long millicelsius_to_deci_kelvin (long t) +{ + t =millicelsius_to_milli_kelvin (t); + +return DIV_ROUND_CLOSEST (t,MILLIDEGREE_PER_DECIDEGREE ); +} + +static inline long kelvin_to_celsius (long t) +{ +return t +DIV_ROUND_CLOSEST (ABSOLUTE_ZERO_MILLICELSIUS , +MILLIDEGREE_PER_DEGREE ); +} + +static inline long celsius_to_kelvin (long t) +{ +return t -DIV_ROUND_CLOSEST (ABSOLUTE_ZERO_MILLICELSIUS , +MILLIDEGREE_PER_DEGREE ); +} + +#endif /* _LINUX_UNITS_H */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 3/202 units: Add Watt units
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Lezcano <[email protected]>
[ Upstream commit 2ee5f8f05949735fa2f4c463a5e13fcb3660c719 ]
As there are the temperature units, let's add the Watt macros definition.
Stable-dep-of: 3ef79cd14122 ("serial: sc16is7xx: set safe default SPI clock frequency")
--- include/linux/units.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/units.h +4 -0
@@ -4,6 +4,10 @@#include <linux/kernel.h> +#define MILLIWATT_PER_WATT 1000L +#define MICROWATT_PER_MILLIWATT 1000L +#define MICROWATT_PER_WATT 1000000L +#define ABSOLUTE_ZERO_MILLICELSIUS -273150static inline long milli_kelvin_to_millicelsius (long t)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 4/202 units: change from L to UL
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Lezcano <[email protected]>
[ Upstream commit c9221919a2d2df5741ab074dfec5bdfc6f1e043b ]
Patch series "Add Hz macros", v3.
There are multiple definitions of the HZ_PER_MHZ or HZ_PER_KHZ in the different drivers. Instead of duplicating this definition again and again, add one in the units.h header to be reused in all the place the redefiniton occurs.
At the same time, change the type of the Watts, as they can not be negative.
This patch (of 10):
The users of the macros are safe to be assigned with an unsigned instead of signed as the variables using them are themselves unsigned.
Stable-dep-of: 3ef79cd14122 ("serial: sc16is7xx: set safe default SPI clock frequency")
--- include/linux/units.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/linux/units.h +3 -3
@@ -4,9 +4,9 @@#include <linux/kernel.h> -#define MILLIWATT_PER_WATT 1000L -#define MICROWATT_PER_MILLIWATT 1000L -#define MICROWATT_PER_WATT 1000000L +#define MILLIWATT_PER_WATT 1000UL +#define MICROWATT_PER_MILLIWATT 1000UL +#define MICROWATT_PER_WATT 1000000UL#define ABSOLUTE_ZERO_MILLICELSIUS -273150
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 5/202 units: add the HZ macros
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Lezcano <[email protected]>
[ Upstream commit e2c77032fcbe515194107994d12cd72ddb77b022 ]
The macros for the unit conversion for frequency are duplicated in different places.
Provide these macros in the 'units' header, so they can be reused.
Stable-dep-of: 3ef79cd14122 ("serial: sc16is7xx: set safe default SPI clock frequency")
--- include/linux/units.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/units.h +4 -0
@@ -4,6 +4,10 @@#include <linux/kernel.h> +#define HZ_PER_KHZ 1000UL +#define KHZ_PER_MHZ 1000UL +#define HZ_PER_MHZ 1000000UL +#define MILLIWATT_PER_WATT 1000UL#define MICROWATT_PER_MILLIWATT 1000UL#define MICROWATT_PER_WATT 1000000UL
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 6/202 serial: sc16is7xx: set safe default SPI clock frequency
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugo Villeneuve <[email protected]>
[ Upstream commit 3ef79cd1412236d884ab0c46b4d1921380807b48 ]
15 MHz is supported only by 76x variants.
If the SPI clock frequency is not specified, use a safe default clock value of 4 MHz that is supported by all variants.
Also use HZ_PER_MHZ macro to improve readability.
--- drivers/tty/serial/sc16is7xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/serial/sc16is7xx.c +2 -1
@@ -24,6 +24,7 @@#include <linux/tty_flip.h> #include <linux/spi/spi.h> #include <linux/uaccess.h> +#include <linux/units.h> #include <uapi/linux/sched/types.h> #define SC16IS7XX_NAME "sc16is7xx"
@@ -1408,7 +1409,7 @@ static int sc16is7xx_spi_probe(struct spi_device *spi) spi->bits_per_word =8 ;/* only supports mode 0 on SC16IS762 */ spi->mode = spi->mode ? :SPI_MODE_0 ; - spi->max_speed_hz = spi->max_speed_hz ? :15000000 ; + spi->max_speed_hz = spi->max_speed_hz ? :4 *HZ_PER_MHZ ; ret =spi_setup (spi);if (ret)return ret;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 7/202 driver core: add device probe log helper
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrzej Hajda <[email protected]>
[ Upstream commit a787e5400a1ceeb0ef92d71ec43aeb35b1fa1334 ]
During probe every time driver gets resource it should usually check for error printk some message if it is not -EPROBE_DEFER and return the error. This pattern is simple but requires adding few lines after any resource acquisition code, as a result it is often omitted or implemented only partially.dev_err_probe helps to replace such code sequences with simple call, so code:
if (err != -EPROBE_DEFER) dev_err(dev, ...); return err; becomes: return dev_err_probe(dev, err, ...);
Stable-dep-of: 6d710b769c1f ("serial: sc16is7xx: add check for unsupported SPI modes during probe")
--- drivers/base/core.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/linux/device.h | 3 +++ 2 files changed, 45 insertions(+)
drivers/base/core.c +42 -0
@@ -3334,6 +3334,48 @@ define_dev_printk_level(_dev_info, KERN_INFO);#endif +/** +* dev_err_probe - probe error check and log helper +* @dev: the pointer to the struct device +* @err: error value to test +* @fmt: printf-style format string +* @...: arguments as specified in the format string +* +* This helper implements common pattern present in probe functions for error +* checking: print debug or error message depending if the error value is +* -EPROBE_DEFER and propagate error upwards. +* It replaces code sequence: +* if (err != -EPROBE_DEFER) +* dev_err(dev, ...); +* else +* dev_dbg(dev, ...); +* return err; +* with +* return dev_err_probe(dev, err, ...); +* +* Returns @err. +* +*/ +int dev_err_probe (const struct device *dev,int err,const char *fmt, ...) +{ +struct va_format vaf; +va_list args; + +va_start (args, fmt); + vaf.fmt = fmt; + vaf.va = &args; + +if (err != -EPROBE_DEFER ) +dev_err (dev,"error %d: %pV" , err, &vaf); +else +dev_dbg (dev,"error %d: %pV" , err, &vaf); + +va_end (args); + +return err; +} +EXPORT_SYMBOL_GPL (dev_err_probe); +static inline bool fwnode_is_primary (struct fwnode_handle *fwnode) {return fwnode && !IS_ERR (fwnode->secondary);
include/linux/device.h +3 -0
@@ -1581,6 +1581,9 @@ do { \ WARN_ONCE(condition, "%s %s: " format, \ dev_driver_string(dev), dev_name(dev), ## arg) +extern __printf(3, 4) +int dev_err_probe(const struct device *dev, int err, const char *fmt, ...); + /* Create alias, so I can be autoloaded. */ #define MODULE_ALIAS_CHARDEV(major,minor) \ MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 8/202 spi: introduce SPI_MODE_X_MASK macro
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleksij Rempel <[email protected]>
[ Upstream commit 029b42d8519cef70c4fb5fcaccd08f1053ed2bf0 ]
Provide a macro to filter all SPI_MODE_0,1,2,3 mode in one run.
The latest SPI framework will parse the devicetree in following call
sequence: of_register_spi_device() -> of_spi_parse_dt() So, driver do not need to pars the devicetree and will get prepared flags in the probe.
On one hand it is good far most drivers. On other hand some drivers need to filter flags provide by SPI framework and apply know to work flags. This drivers may use SPI_MODE_X_MASK to filter MODE flags and set own, known flags:
spi->flags &= ~SPI_MODE_X_MASK;
spi->flags |= SPI_MODE_0;
Stable-dep-of: 6d710b769c1f ("serial: sc16is7xx: add check for unsupported SPI modes during probe")
--- include/linux/spi/spi.h | 1 + 1 file changed, 1 insertion(+)
include/linux/spi/spi.h +1 -0
@@ -153,6 +153,7 @@ struct spi_device {#define SPI_MODE_1 (0|SPI_CPHA)#define SPI_MODE_2 (SPI_CPOL|0)#define SPI_MODE_3 (SPI_CPOL|SPI_CPHA) +#define SPI_MODE_X_MASK (SPI_CPOL|SPI_CPHA)#define SPI_CS_HIGH 0x04/* chipselect active high? */ #define SPI_LSB_FIRST 0x08/* per-word bits-on-wire */ #define SPI_3WIRE 0x10/* SI/SO signals shared */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 9/202 serial: sc16is7xx: add check for unsupported SPI modes during probe
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugo Villeneuve <[email protected]>
[ Upstream commit 6d710b769c1f5f0d55c9ad9bb49b7dce009ec103 ]
The original comment is confusing because it implies that variants other than the SC16IS762 supports other SPI modes beside SPI_MODE_0.
Extract from datasheet:
The SC16IS762 differs from the SC16IS752 in that it supports SPI clock speeds up to 15 Mbit/s instead of the 4 Mbit/s supported by the SC16IS752... In all other aspects, the SC16IS762 is functionally and electrically the same as the SC16IS752.
The same is also true of the SC16IS760 variant versus the SC16IS740 and SC16IS750 variants.
For all variants, only SPI mode 0 is supported.
Change comment and abort probing if the specified SPI mode is not SPI_MODE_0.
--- drivers/tty/serial/sc16is7xx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/tty/serial/sc16is7xx.c +4 -1
@@ -1407,7 +1407,10 @@ static int sc16is7xx_spi_probe(struct spi_device *spi)/* Setup SPI bus */ spi->bits_per_word =8 ; -/* only supports mode 0 on SC16IS762 */ +/* For all variants, only mode 0 is supported */ +if ((spi->mode &SPI_MODE_X_MASK ) !=SPI_MODE_0 ) +return dev_err_probe (&spi->dev, -EINVAL ,"Unsupported SPI mode\n" ); + spi->mode = spi->mode ? :SPI_MODE_0 ; spi->max_speed_hz = spi->max_speed_hz ? :4 *HZ_PER_MHZ ; ret =spi_setup (spi);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 10/202 ext4: allow for the last group to be marked as trimmed
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suraj Jitindar Singh <[email protected]>
commit 7c784d624819acbeefb0018bac89e632467cca5a upstream.
The ext4 filesystem tracks the trim status of blocks at the group level. When an entire group has been trimmed then it is marked as such and subsequent trim invocations with the same minimum trim size will not be attempted on that group unless it is marked as able to be trimmed again such as when a block is freed.
Currently the last group can't be marked as trimmed due to incorrect logic in ext4_last_grp_cluster(). ext4_last_grp_cluster() is supposed to return the zero based index of the last cluster in a group. This is then used by ext4_try_to_trim_range() to determine if the trim operation spans the entire group and as such if the trim status of the group should be recorded.
ext4_last_grp_cluster() takes a 0 based group index, thus the valid values for grp are 0..(ext4_get_groups_count - 1). Any group index less than (ext4_get_groups_count - 1) is not the last group and must have EXT4_CLUSTERS_PER_GROUP(sb) clusters. For the last group we need to calculate the number of clusters based on the number of blocks in the group. Finally subtract 1 from the number of clusters as zero based indexing is expected. Rearrange the function slightly to make it clear what we are calculating and returning.
Reproducer:
// Create file system where the last group has fewer blocks than // blocks per group
$ mkfs.ext4 -b 4096 -g 8192 /dev/nvme0n1 8191 $ mount /dev/nvme0n1 /mnt
Before Patch:
$ fstrim -v /mnt /mnt: 25.9 MiB (27156480 bytes) trimmed // Group not marked as trimmed so second invocation still discards blocks $ fstrim -v /mnt /mnt: 25.9 MiB (27156480 bytes) trimmed
After Patch:
fstrim -v /mnt
/mnt: 25.9 MiB (27156480 bytes) trimmed
// Group marked as trimmed so second invocation DOESN'T discard any blocks fstrim -v /mnt
/mnt: 0 B (0 bytes) trimmed
--- fs/ext4/mballoc.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
fs/ext4/mballoc.c +10 -5
@@ -5192,11 +5192,16 @@ __acquires(bitlock)static ext4_grpblk_t ext4_last_grp_cluster (struct super_block *sb,ext4_group_t grp) { -if (grp <ext4_get_groups_count (sb)) -return EXT4_CLUSTERS_PER_GROUP (sb) -1 ; -return (ext4_blocks_count (EXT4_SB (sb)->s_es) - -ext4_group_first_block_no (sb, grp) -1 ) >> -EXT4_CLUSTER_BITS (sb); +unsigned long nr_clusters_in_group; + +if (grp < (ext4_get_groups_count (sb) -1 )) + nr_clusters_in_group =EXT4_CLUSTERS_PER_GROUP (sb); +else + nr_clusters_in_group = (ext4_blocks_count (EXT4_SB (sb)->s_es) - +ext4_group_first_block_no (sb, grp)) + >>EXT4_CLUSTER_BITS (sb); + +return nr_clusters_in_group -1 ; }static bool ext4_trim_interrupted (void )
Greg Kroah-Hartman
maintainerPATCH 11/202 crypto: api - Disallow identical driver names
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
commit 27016f75f5ed47e2d8e0ca75a8ff1f40bc1a5e27 upstream.
Disallow registration of two algorithms with identical driver names.
--- crypto/algapi.c | 1 + 1 file changed, 1 insertion(+)
crypto/algapi.c +1 -0
@@ -231,6 +231,7 @@ static struct crypto_larval *__crypto_re }if (!strcmp (q->cra_driver_name, alg->cra_name) || + !strcmp (q->cra_driver_name, alg->cra_driver_name) || !strcmp (q->cra_name, alg->cra_driver_name)) goto err; }
Greg Kroah-Hartman
maintainerPATCH 12/202 PM: hibernate: Enforce ordering during image compression/decompression
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongchen Zhang <[email protected]>
commit 71cd7e80cfde548959952eac7063aeaea1f2e1c6 upstream.
An S4 (suspend to disk) test on the LoongArch 3A6000 platform sometimes fails with the following error messaged in the dmesg log:
Invalid LZO compressed length
That happens because when compressing/decompressing the image, the synchronization between the control thread and the compress/decompress/crc thread is based on a relaxed ordering interface, which is unreliable, and the following situation may occur:
CPU 0 CPU 1save_image_lzo lzo_compress_threadfn
atomic_set(&d->stop, 1);
atomic_read(&data[thr].stop)
data[thr].cmp = data[thr].cmp_len;
WRITE data[thr].cmp_len
Then CPU0 gets a stale cmp_len and writes it to disk. During resume from S4, wrong cmp_len is loaded.
To maintain data consistency between the two threads, use the acquire/release variants of atomic set and read operations.
--- kernel/power/swap.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-)
kernel/power/swap.c +19 -19
@@ -596,11 +596,11 @@ static int crc32_threadfn(void *data)unsigned i;while (1 ) { -wait_event (d->go,atomic_read (&d->ready) || +wait_event (d->go,atomic_read_acquire (&d->ready) ||kthread_should_stop ());if (kthread_should_stop ()) { d->thr =NULL ; -atomic_set (&d->stop,1 ); +atomic_set_release (&d->stop,1 );wake_up (&d->done);break ; }
@@ -609,7 +609,7 @@ static int crc32_threadfn(void *data)for (i =0 ; i < d->run_threads; i++) *d->crc32 =crc32_le (*d->crc32, d->unc[i], *d->unc_len[i]); -atomic_set (&d->stop,1 ); +atomic_set_release (&d->stop,1 );wake_up (&d->done); }return 0 ;
@@ -639,12 +639,12 @@ static int lzo_compress_threadfn(void *dstruct cmp_data *d = data;while (1 ) { -wait_event (d->go,atomic_read (&d->ready) || +wait_event (d->go,atomic_read_acquire (&d->ready) ||kthread_should_stop ());if (kthread_should_stop ()) { d->thr =NULL ; d->ret =-1 ; -atomic_set (&d->stop,1 ); +atomic_set_release (&d->stop,1 );wake_up (&d->done);break ; }
@@ -653,7 +653,7 @@ static int lzo_compress_threadfn(void *d d->ret =lzo1x_1_compress (d->unc, d->unc_len, d->cmp +LZO_HEADER , &d->cmp_len, d->wrk); -atomic_set (&d->stop,1 ); +atomic_set_release (&d->stop,1 );wake_up (&d->done); }return 0 ;
@@ -791,7 +791,7 @@ static int save_image_lzo(struct swap_ma data[thr].unc_len = off; -atomic_set (&data[thr].ready,1 ); +atomic_set_release (&data[thr].ready,1 );wake_up (&data[thr].go); }
@@ -799,12 +799,12 @@ static int save_image_lzo(struct swap_mabreak ; crc->run_threads = thr; -atomic_set (&crc->ready,1 ); +atomic_set_release (&crc->ready,1 );wake_up (&crc->go);for (run_threads = thr, thr =0 ; thr < run_threads; thr++) {wait_event (data[thr].done, -atomic_read (&data[thr].stop)); +atomic_read_acquire (&data[thr].stop));atomic_set (&data[thr].stop,0 ); ret = data[thr].ret;
@@ -843,7 +843,7 @@ static int save_image_lzo(struct swap_ma } } -wait_event (crc->done,atomic_read (&crc->stop)); +wait_event (crc->done,atomic_read_acquire (&crc->stop));atomic_set (&crc->stop,0 ); }
@@ -1124,12 +1124,12 @@ static int lzo_decompress_threadfn(voidstruct dec_data *d = data;while (1 ) { -wait_event (d->go,atomic_read (&d->ready) || +wait_event (d->go,atomic_read_acquire (&d->ready) ||kthread_should_stop ());if (kthread_should_stop ()) { d->thr =NULL ; d->ret =-1 ; -atomic_set (&d->stop,1 ); +atomic_set_release (&d->stop,1 );wake_up (&d->done);break ; }
@@ -1142,7 +1142,7 @@ static int lzo_decompress_threadfn(voidflush_icache_range ((unsigned long )d->unc, (unsigned long )d->unc + d->unc_len); -atomic_set (&d->stop,1 ); +atomic_set_release (&d->stop,1 );wake_up (&d->done); }return 0 ;
@@ -1330,7 +1330,7 @@ static int load_image_lzo(struct swap_ma }if (crc->run_threads) { -wait_event (crc->done,atomic_read (&crc->stop)); +wait_event (crc->done,atomic_read_acquire (&crc->stop));atomic_set (&crc->stop,0 ); crc->run_threads =0 ; }
@@ -1366,7 +1366,7 @@ static int load_image_lzo(struct swap_ma pg =0 ; } -atomic_set (&data[thr].ready,1 ); +atomic_set_release (&data[thr].ready,1 );wake_up (&data[thr].go); }
@@ -1385,7 +1385,7 @@ static int load_image_lzo(struct swap_mafor (run_threads = thr, thr =0 ; thr < run_threads; thr++) {wait_event (data[thr].done, -atomic_read (&data[thr].stop)); +atomic_read_acquire (&data[thr].stop));atomic_set (&data[thr].stop,0 ); ret = data[thr].ret;
@@ -1416,7 +1416,7 @@ static int load_image_lzo(struct swap_ma ret =snapshot_write_next (snapshot);if (ret <=0 ) { crc->run_threads = thr +1 ; -atomic_set (&crc->ready,1 ); +atomic_set_release (&crc->ready,1 );wake_up (&crc->go); goto out_finish; }
@@ -1424,13 +1424,13 @@ static int load_image_lzo(struct swap_ma } crc->run_threads = thr; -atomic_set (&crc->ready,1 ); +atomic_set_release (&crc->ready,1 );wake_up (&crc->go); } out_finish:if (crc->run_threads) { -wait_event (crc->done,atomic_read (&crc->stop)); +wait_event (crc->done,atomic_read_acquire (&crc->stop));atomic_set (&crc->stop,0 ); } stop =ktime_get ();
Greg Kroah-Hartman
maintainerPATCH 13/202 hwrng: core - Fix page fault dead lock on mmap-ed hwrng
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
commit 78aafb3884f6bc6636efcc1760c891c8500b9922 upstream.
There is a dead-lock in the hwrng device read path. This triggers when the user reads from /dev/hwrng into memory also mmap-ed from /dev/hwrng. The resulting page fault triggers a recursive read which then dead-locks.
Fix this by using a stack buffer when calling copy_to_user.
--- drivers/char/hw_random/core.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-)
drivers/char/hw_random/core.c +21 -13
@@ -24,10 +24,13 @@#include <linux/random.h> #include <linux/sched.h> #include <linux/slab.h> +#include <linux/string.h> #include <linux/uaccess.h> #define RNG_MODULE_NAME "hw_random" +#define RNG_BUFFER_SIZE (SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES) +static struct hwrng *current_rng;/* the current rng has been explicitly chosen by user via sysfs */ static int cur_rng_set_by_user;
@@ -59,7 +62,7 @@ static inline int rng_get_data(struct hwstatic size_t rng_buffer_size (void ) { -return SMP_CACHE_BYTES <32 ?32 :SMP_CACHE_BYTES ; +return RNG_BUFFER_SIZE ; }static void add_early_randomness (struct hwrng *rng)
@@ -202,6 +205,7 @@ static inline int rng_get_data(struct hwstatic ssize_t rng_dev_read (struct file *filp,char __user *buf,size_t size,loff_t *offp) { +u8 buffer[RNG_BUFFER_SIZE ];ssize_t ret =0 ;int err =0 ;int bytes_read, len;
@@ -229,34 +233,37 @@ static ssize_t rng_dev_read(struct fileif (bytes_read <0 ) { err = bytes_read; goto out_unlock_reading; + }else if (bytes_read ==0 && + (filp->f_flags &O_NONBLOCK )) { + err = -EAGAIN ; + goto out_unlock_reading; } + data_avail = bytes_read; } -if (!data_avail) { -if (filp->f_flags &O_NONBLOCK ) { - err = -EAGAIN ; - goto out_unlock_reading; - } - }else { - len = data_avail; + len = data_avail; +if (len) {if (len > size) len = size; data_avail -= len; -if (copy_to_user (buf + ret, rng_buffer + data_avail, - len)) { +memcpy (buffer, rng_buffer + data_avail, len); + } +mutex_unlock (&reading_mutex); +put_rng (rng); + +if (len) { +if (copy_to_user (buf + ret, buffer, len)) { err = -EFAULT ; - goto out_unlock_reading; + goto out; } size -= len; ret += len; } -mutex_unlock (&reading_mutex); -put_rng (rng);if (need_resched ())schedule_timeout_interruptible (1 );
@@ -267,6 +274,7 @@ static ssize_t rng_dev_read(struct file } } out: +memzero_explicit (buffer,sizeof (buffer));return ret ? : err; out_unlock_reading:
Greg Kroah-Hartman
maintainerPATCH 14/202 rpmsg: virtio: Free driver_override when rpmsg_remove()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaolei Wang <[email protected]>
commit d5362c37e1f8a40096452fc201c30e705750e687 upstream.
Free driver_override when rpmsg_remove(), otherwise the following memory leak will occur:
unreferenced object 0xffff0000d55d7080 (size 128):
comm "kworker/u8:2", pid 56, jiffies 4294893188 (age 214.272s) hex dump (first 32 bytes):
72 70 6d 73 67 5f 6e 73 00 00 00 00 00 00 00 00 rpmsg_ns........
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<000000009c94c9c1>] __kmem_cache_alloc_node+0x1f8/0x320
[<000000002300d89b>] __kmalloc_node_track_caller+0x44/0x70
[<00000000228a60c3>] kstrndup+0x4c/0x90
[<0000000077158695>] driver_set_override+0xd0/0x164
[<000000003e9c4ea5>] rpmsg_register_device_override+0x98/0x170
[<000000001c0c89a8>] rpmsg_ns_register_device+0x24/0x30
[<000000008bbf8fa2>] rpmsg_probe+0x2e0/0x3ec
[<00000000e65a68df>] virtio_dev_probe+0x1c0/0x280
[<00000000443331cc>] really_probe+0xbc/0x2dc
[<00000000391064b1>] __driver_probe_device+0x78/0xe0
[<00000000a41c9a5b>] driver_probe_device+0xd8/0x160
[<000000009c3bd5df>] __device_attach_driver+0xb8/0x140
[<0000000043cd7614>] bus_for_each_drv+0x7c/0xd4
[<000000003b929a36>] __device_attach+0x9c/0x19c
[<00000000a94e0ba8>] device_initial_probe+0x14/0x20
[<000000003c999637>] bus_probe_device+0xa0/0xac--- drivers/rpmsg/virtio_rpmsg_bus.c | 1 + 1 file changed, 1 insertion(+)
drivers/rpmsg/virtio_rpmsg_bus.c +1 -0
@@ -381,6 +381,7 @@ static void virtio_rpmsg_release_device(struct rpmsg_device *rpdev =to_rpmsg_device (dev);struct virtio_rpmsg_channel *vch =to_virtio_rpmsg_channel (rpdev); +kfree (rpdev->driver_override);kfree (vch); }
Greg Kroah-Hartman
maintainerPATCH 15/202 parisc/firmware: Fix F-extend for PDC addresses
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit 735ae74f73e55c191d48689bd11ff4a06ea0508f upstream.
When running with narrow firmware (64-bit kernel using a 32-bit firmware), extend PDC addresses into the 0xfffffff0.00000000 region instead of the 0xf0f0f0f0.00000000 region.
This fixes the power button on the C3700 machine in qemu (64-bit CPU with 32-bit firmware), and my assumption is that the previous code was really never used (because most 64-bit machines have a 64-bit firmware), or it just worked on very old machines because they may only decode 40-bit of virtual addresses.
--- arch/parisc/kernel/firmware.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/parisc/kernel/firmware.c +2 -2
@@ -127,10 +127,10 @@ static unsigned long f_extend(unsigned l#ifdef CONFIG_64BIT if (unlikely (parisc_narrow_firmware)) {if ((address &0xff000000 ) ==0xf0000000 ) -return 0xf0f0f0f000000000UL | (u32 )address; +return (0xfffffff0UL <<32 ) | (u32 )address;if ((address &0xf0000000 ) ==0xf0000000 ) -return 0xffffffff00000000UL | (u32 )address; +return (0xffffffffUL <<32 ) | (u32 )address; }#endif return address;
Greg Kroah-Hartman
maintainerPATCH 16/202 nouveau/vmm: dont set addr on the fail path to avoid warning
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit cacea81390fd8c8c85404e5eb2adeb83d87a912e upstream.
nvif_vmm_put gets called if addr is set, but if the allocation fails we don't need to call put, otherwise we get a warning like
[523232.435671] ------------[ cut here ]------------ [523232.435674] WARNING: CPU: 8 PID: 1505697 at drivers/gpu/drm/nouveau/nvif/vmm.c:68 nvif_vmm_put+0x72/0x80 [nouveau] [523232.435795] Modules linked in: uinput rfcomm snd_seq_dummy snd_hrtimer nf_conntrack_netbios_ns nf_conntrack_broadcast nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip_set nf_tables nfnetlink qrtr bnep sunrpc binfmt_misc intel_rapl_msr intel_rapl_common intel_uncore_frequency intel_uncore_frequency_common isst_if_common iwlmvm nfit libnvdimm vfat fat x86_pkg_temp_thermal intel_powerclamp mac80211 snd_soc_avs snd_soc_hda_codec coretemp snd_hda_ext_core snd_soc_core snd_hda_codec_realtek kvm_intel snd_hda_codec_hdmi snd_compress snd_hda_codec_generic ac97_bus snd_pcm_dmaengine snd_hda_intel libarc4 snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec kvm iwlwifi snd_hda_core btusb snd_hwdep btrtl snd_seq btintel irqbypass btbcm rapl snd_seq_device eeepc_wmi btmtk intel_cstate iTCO_wdt cfg80211 snd_pcm asus_wmi bluetooth intel_pmc_bxt iTCO_vendor_support snd_timer ledtrig_audio pktcdvd snd mei_me [523232.435828] sparse_keymap intel_uncore i2c_i801 platform_profile wmi_bmof mei pcspkr ioatdma soundcore i2c_smbus rfkill idma64 dca joydev acpi_tad loop zram nouveau drm_ttm_helper ttm video drm_exec drm_gpuvm gpu_sched crct10dif_pclmul i2c_algo_bit nvme crc32_pclmul crc32c_intel drm_display_helper polyval_clmulni nvme_core polyval_generic e1000e mxm_wmi cec ghash_clmulni_intel r8169 sha512_ssse3 nvme_common wmi pinctrl_sunrisepoint uas usb_storage ip6_tables ip_tables fuse [523232.435849] CPU: 8 PID: 1505697 Comm: gnome-shell Tainted: G W 6.6.0-rc7-nvk-uapi+ #12 [523232.435851] Hardware name: System manufacturer System Product Name/ROG STRIX X299-E GAMING II, BIOS 1301 09/24/2021 [523232.435852] RIP: 0010:nvif_vmm_put+0x72/0x80 [nouveau] [523232.435934] Code: 00 00 48 89 e2 be 02 00 00 00 48 c7 04 24 00 00 00 00 48 89 44 24 08 e8 fc bf ff ff 85 c0 75 0a 48 c7 43 08 00 00 00 00 eb b3 <0f> 0b eb f2 e8 f5 c9 b2 e6 0f 1f 44 00 00 90 90 90 90 90 90 90 90 [523232.435936] RSP: 0018:ffffc900077ffbd8 EFLAGS: 00010282 [523232.435937] RAX: 00000000fffffffe RBX: ffffc900077ffc00 RCX: 0000000000000010 [523232.435938] RDX: 0000000000000010 RSI: ffffc900077ffb38 RDI: ffffc900077ffbd8 [523232.435940] RBP: ffff888e1c4f2140 R08: 0000000000000000 R09: 0000000000000000 [523232.435940] R10: 0000000000000000 R11: 0000000000000000 R12: ffff888503811800 [523232.435941] R13: ffffc900077ffca0 R14: ffff888e1c4f2140 R15: ffff88810317e1e0 [523232.435942] FS: 00007f933a769640(0000) GS:ffff88905fa00000(0000) knlGS:0000000000000000 [523232.435943] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [523232.435944] CR2: 00007f930bef7000 CR3: 00000005d0322001 CR4: 00000000003706e0 [523232.435945] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [523232.435946] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [523232.435964] Call Trace: [523232.435965] <TASK> [523232.435966] ? nvif_vmm_put+0x72/0x80 [nouveau] [523232.436051] ? __warn+0x81/0x130 [523232.436055] ? nvif_vmm_put+0x72/0x80 [nouveau] [523232.436138] ? report_bug+0x171/0x1a0 [523232.436142] ? handle_bug+0x3c/0x80 [523232.436144] ? exc_invalid_op+0x17/0x70 [523232.436145] ? asm_exc_invalid_op+0x1a/0x20 [523232.436149] ? nvif_vmm_put+0x72/0x80 [nouveau] [523232.436230] ? nvif_vmm_put+0x64/0x80 [nouveau] [523232.436342] nouveau_vma_del+0x80/0xd0 [nouveau] [523232.436506] nouveau_vma_new+0x1a0/0x210 [nouveau] [523232.436671] nouveau_gem_object_open+0x1d0/0x1f0 [nouveau] [523232.436835] drm_gem_handle_create_tail+0xd1/0x180 [523232.436840] drm_prime_fd_to_handle_ioctl+0x12e/0x200 [523232.436844] ? __pfx_drm_prime_fd_to_handle_ioctl+0x10/0x10 [523232.436847] drm_ioctl_kernel+0xd3/0x180 [523232.436849] drm_ioctl+0x26d/0x4b0 [523232.436851] ? __pfx_drm_prime_fd_to_handle_ioctl+0x10/0x10 [523232.436855] nouveau_drm_ioctl+0x5a/0xb0 [nouveau] [523232.437032] __x64_sys_ioctl+0x94/0xd0 [523232.437036] do_syscall_64+0x5d/0x90 [523232.437040] ? syscall_exit_to_user_mode+0x2b/0x40 [523232.437044] ? do_syscall_64+0x6c/0x90 [523232.437046] entry_SYSCALL_64_after_hwframe+0x6e/0xd8
--- drivers/gpu/drm/nouveau/nouveau_vmm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/nouveau/nouveau_vmm.c +3 -0
@@ -107,6 +107,9 @@ nouveau_vma_new(struct nouveau_bo *nvbo, }else { ret =nvif_vmm_get (&vmm->vmm,PTES , false, mem->mem.page,0 , mem->mem.size, &tmp); +if (ret) + goto done; + vma->addr = tmp.addr; }
Greg Kroah-Hartman
maintainerPATCH 17/202 block: Remove special-casing of compound pages
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <[email protected]>
commit 1b151e2435fc3a9b10c8946c6aebe9f3e1938c55 upstream.
The special casing was originally added in pre-git history; reproducing the commit log here:
Quoted 9 lines
commit
a318a92567d77Author: Andrew Morton <[email protected]> Date: Sun Sep 21 01:42:22 2003 -0700[PATCH] Speed up direct-io hugetlbpage handling
This patch short-circuits all the direct-io page dirtying logic for higher-order pages. Without this, we pointlessly bounce BIOs up to keventd all the time.
In the last twenty years, compound pages have become used for more than just hugetlb. Rewrite these functions to operate on folios instead of pages and remove the special case for hugetlbfs; I don't think it's needed any more (and if it is, we can put it back in as a call to folio_test_hugetlb()).
This was found by inspection; as far as I can tell, this bug can lead to pages used as the destination of a direct I/O read not being marked as dirty. If those pages are then reclaimed by the MM without being dirtied for some other reason, they won't be written out. Then when they're faulted back in, they will not contain the data they should. It'll take a pretty unusual setup to produce this problem with several races all going the wrong way.
This problem predates the folio work; it could for example have been triggered by mmaping a THP in tmpfs and using that as the target of an O_DIRECT read.
--- block/bio.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
block/bio.c +2 -3
@@ -1592,8 +1592,7 @@ void bio_set_pages_dirty(struct bio *bioint i;bio_for_each_segment_all (bvec, bio, i) { -if (!PageCompound (bvec->bv_page)) -set_page_dirty_lock (bvec->bv_page); +set_page_dirty_lock (bvec->bv_page); } }EXPORT_SYMBOL_GPL (bio_set_pages_dirty);
@@ -1652,7 +1651,7 @@ void bio_check_pages_dirty(struct bio *bint i;bio_for_each_segment_all (bvec, bio, i) { -if (!PageDirty (bvec->bv_page) && !PageCompound (bvec->bv_page)) +if (!PageDirty (bvec->bv_page)) goto defer; }
Greg Kroah-Hartman
maintainerPATCH 18/202 powerpc: Use always instead of always-y in for crtsavres.o
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
This commit is for linux-4.19.y only, it has no direct upstream equivalent.
Prior to commit 5f2fb52fac15 ("kbuild: rename hostprogs-y/always to hostprogs/always-y"), always-y did not exist, making the backport of mainline commit 1b1e38002648 ("powerpc: add crtsavres.o to always-y instead of extra-y") to linux-4.19.y as commit b7b85ec5ec15 ("powerpc:
add crtsavres.o to always-y instead of extra-y") incorrect, breaking the build with linkers that need crtsavres.o:
ld.lld: error: cannot open arch/powerpc/lib/crtsavres.o: No such file or directory
Backporting the aforementioned kbuild commit is not suitable for stable due to its size and number of conflicts, so transform the always-y usage to an equivalent form using always, which resolves the build issues.
--- arch/powerpc/lib/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/lib/Makefile +2 -2
@@ -21,8 +21,8 @@ obj-$(CONFIG_PPC32) += div64.o copy_32.o # 64-bit linker creates .sfpr on demand for final link (vmlinux), # so it is only needed for modules, and only for older linkers which # do not support --save-restore-funcs -ifeq ($(call ld-ifversion, -lt, 225000000, y),y) -always-$(CONFIG_PPC64) += crtsavres.o +ifeq ($(call ld-ifversion, -lt, 225000000, y)$(CONFIG_PPC64),yy) +always += crtsavres.o endif obj-$(CONFIG_PPC_BOOK3S_64) += copyuser_power7.o copypage_power7.o \
Greg Kroah-Hartman
maintainerPATCH 19/202 x86/CPU/AMD: Fix disabling XSAVES on AMD family 0x17 due to erratum
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Maciej S. Szmigiero" <[email protected]>
The stable kernel version backport of the patch disabling XSAVES on AMD Zen family 0x17 applied this change to the wrong function (init_amd_k6()), one which isn't called for Zen CPUs.
Move the erratum to the init_amd_zn() function instead.
Add an explicit family 0x17 check to the erratum so nothing will break if someone naively makes this kernel version call init_amd_zn() also for family 0x19 in the future (as the current upstream code does).
--- arch/x86/kernel/cpu/amd.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
arch/x86/kernel/cpu/amd.c +11 -9
@@ -271,15 +271,6 @@ static void init_amd_k6(struct cpuinfo_x return; }#endif -/* -* Work around Erratum 1386. The XSAVES instruction malfunctions in -* certain circumstances on Zen1/2 uarch, and not all parts have had -* updated microcode at the time of writing (March 2023). -* -* Affected parts all have no supervisor XSAVE states, meaning that -* the XSAVEC instruction (which works fine) is equivalent. -*/ -clear_cpu_cap (c,X86_FEATURE_XSAVES ); }static void init_amd_k7 (struct cpuinfo_x86 *c)
@@ -979,6 +970,17 @@ static void init_amd_zn(struct cpuinfo_xif (c->x86 ==0x19 && !cpu_has (c,X86_FEATURE_BTC_NO ))set_cpu_cap (c,X86_FEATURE_BTC_NO ); } + +/* +* Work around Erratum 1386. The XSAVES instruction malfunctions in +* certain circumstances on Zen1/2 uarch, and not all parts have had +* updated microcode at the time of writing (March 2023). +* +* Affected parts all have no supervisor XSAVE states, meaning that +* the XSAVEC instruction (which works fine) is equivalent. +*/ +if (c->x86 ==0x17 ) +clear_cpu_cap (c,X86_FEATURE_XSAVES ); }static bool cpu_has_zenbleed_microcode (void )
Greg Kroah-Hartman
maintainerPATCH 20/202 driver core: Annotate dev_err_probe() with __must_check
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
commit e1f82a0dcf388d98bcc7ad195c03bd812405e6b2 upstream.
We have got already new users of this API which interpret it differently and miss the opportunity to optimize their code.
In order to avoid similar cases in the future, annotate dev_err_probe() with __must_check.
--- include/linux/device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/device.h +1 -1
@@ -1582,7 +1582,7 @@ do { \ dev_driver_string(dev), dev_name(dev), ## arg) extern __printf(3, 4) -int dev_err_probe (const struct device *dev,int err,const char *fmt, ...); +int __must_check dev_err_probe (const struct device *dev,int err,const char *fmt, ...);/* Create alias, so I can be autoloaded. */ #define MODULE_ALIAS_CHARDEV (major,minor) \
Greg Kroah-Hartman
maintainerPATCH 21/202 Revert "driver core: Annotate dev_err_probe() with __must_check"
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit f601e8f37c2c1c52f2923fffc48204a7f7dc023d upstream.
This reverts commit e1f82a0dcf388d98bcc7ad195c03bd812405e6b2 as it's already starting to cause build warnings in linux-next for things that are "obviously correct".
It's up to driver authors do "do the right thing" here with this function, and if they don't want to call it as the last line of a function, that's up to them, otherwise code that looks like:
ret = dev_err_probe(..., ret, ...);
does look really "odd".
--- include/linux/device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/device.h +1 -1
@@ -1582,7 +1582,7 @@ do { \ dev_driver_string(dev), dev_name(dev), ## arg) extern __printf(3, 4) -int __must_check dev_err_probe (const struct device *dev,int err,const char *fmt, ...); +int dev_err_probe (const struct device *dev,int err,const char *fmt, ...);/* Create alias, so I can be autoloaded. */ #define MODULE_ALIAS_CHARDEV (major,minor) \
Greg Kroah-Hartman
maintainerPATCH 22/202 driver code: print symbolic error code
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michał Mirosław <[email protected]>
commit 693a8e936590f93451e6f5a3d748616f5a59c80b upstream.
dev_err_probe() prepends the message with an error code. Let's make it more readable by translating the code to a more recognisable symbol.
--- drivers/base/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/base/core.c +2 -2
@@ -3366,9 +3366,9 @@ int dev_err_probe(const struct device *d vaf.va = &args;if (err != -EPROBE_DEFER ) -dev_err (dev,"error %d: %pV" , err, &vaf); +dev_err (dev,"error %pe: %pV" ,ERR_PTR (err), &vaf);else -dev_dbg (dev,"error %d: %pV" , err, &vaf); +dev_dbg (dev,"error %pe: %pV" ,ERR_PTR (err), &vaf);va_end (args);
Greg Kroah-Hartman
maintainerPATCH 23/202 drivers: core: fix kernel-doc markup for dev_err_probe()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 074b3aad307de6126fbac1fff4996d1034b48fee upstream.
There are two literal blocks there. Fix the markups, in order to produce the right html output and solve those warnings:
./drivers/base/core.c:4218: WARNING: Unexpected indentation. ./drivers/base/core.c:4222: WARNING: Definition list ends without a blank line; unexpected unindent. ./drivers/base/core.c:4223: WARNING: Block quote ends without a blank line; unexpected unindent.
--- drivers/base/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/base/core.c +4 -2
@@ -3344,13 +3344,15 @@ define_dev_printk_level(_dev_info, KERN_* This helper implements common pattern present in probe functions for error * checking: print debug or error message depending if the error value is * -EPROBE_DEFER and propagate error upwards. -* It replaces code sequence: +* It replaces code sequence:: * if (err != -EPROBE_DEFER) * dev_err(dev, ...); * else * dev_dbg(dev, ...); * return err; -* with +* +* with:: +* * return dev_err_probe(dev, err, ...); * * Returns @err.
Greg Kroah-Hartman
maintainerPATCH 24/202 net/smc: fix illegal rmb_desc access in SMC-D connection dump
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wen Gu <[email protected]>
[ Upstream commit dbc153fd3c142909e564bb256da087e13fbf239c ]
A crash was found when dumping SMC-D connections. It can be reproduced by following steps:
- run nginx/wrk test:
smc_run nginx
smc_run wrk -t 16 -c 1000 -d <duration> -H 'Connection: Close' <URL>
- continuously dump SMC-D connections in parallel:
watch -n 1 'smcss -D'
BUG: kernel NULL pointer dereference, address: 0000000000000030 CPU: 2 PID: 7204 Comm: smcss Kdump: loaded Tainted: G E 6.7.0+ #55 RIP: 0010:__smc_diag_dump.constprop.0+0x5e5/0x620 [smc_diag] Call Trace: <TASK> ? __die+0x24/0x70 ? page_fault_oops+0x66/0x150 ? exc_page_fault+0x69/0x140 ? asm_exc_page_fault+0x26/0x30 ? __smc_diag_dump.constprop.0+0x5e5/0x620 [smc_diag] ? __kmalloc_node_track_caller+0x35d/0x430 ? __alloc_skb+0x77/0x170 smc_diag_dump_proto+0xd0/0xf0 [smc_diag] smc_diag_dump+0x26/0x60 [smc_diag] netlink_dump+0x19f/0x320 __netlink_dump_start+0x1dc/0x300 smc_diag_handler_dump+0x6a/0x80 [smc_diag] ? __pfx_smc_diag_dump+0x10/0x10 [smc_diag] sock_diag_rcv_msg+0x121/0x140 ? __pfx_sock_diag_rcv_msg+0x10/0x10 netlink_rcv_skb+0x5a/0x110 sock_diag_rcv+0x28/0x40 netlink_unicast+0x22a/0x330 netlink_sendmsg+0x1f8/0x420 __sock_sendmsg+0xb0/0xc0 ____sys_sendmsg+0x24e/0x300 ? copy_msghdr_from_user+0x62/0x80 ___sys_sendmsg+0x7c/0xd0 ? __do_fault+0x34/0x160 ? do_read_fault+0x5f/0x100 ? do_fault+0xb0/0x110 ? __handle_mm_fault+0x2b0/0x6c0 __sys_sendmsg+0x4d/0x80 do_syscall_64+0x69/0x180 entry_SYSCALL_64_after_hwframe+0x6e/0x76
It is possible that the connection is in process of being established when we dump it. Assumed that the connection has been registered in a link group by smc_conn_create() but the rmb_desc has not yet been initialized by smc_buf_create(), thus causing the illegal access to conn->rmb_desc. So fix it by checking before dump.
--- net/smc/smc_diag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/smc/smc_diag.c +1 -1
@@ -167,7 +167,7 @@ static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb, }if (smc->conn.lgr && smc->conn.lgr->is_smcd && (req->diag_ext & (1 << (SMC_DIAG_DMBINFO -1 ))) && - !list_empty (&smc->conn.lgr->list)) { + !list_empty (&smc->conn.lgr->list) && smc->conn.rmb_desc) {struct smc_connection *conn = &smc->conn;struct smcd_diag_dmbinfo dinfo;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 25/202 vlan: skip nested type that is not IFLA_VLAN_QOS_MAPPING
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin Ma <[email protected]>
[ Upstream commit 6c21660fe221a15c789dee2bc2fd95516bc5aeaf ]
In the vlan_changelink function, a loop is used to parse the nested attributes IFLA_VLAN_EGRESS_QOS and IFLA_VLAN_INGRESS_QOS in order to obtain the struct ifla_vlan_qos_mapping. These two nested attributes are checked in the vlan_validate_qos_map function, which calls nla_validate_nested_deprecated with the vlan_map_policy.
However, this deprecated validator applies a LIBERAL strictness, allowing the presence of an attribute with the type IFLA_VLAN_QOS_UNSPEC. Consequently, the loop in vlan_changelink may parse an attribute of type IFLA_VLAN_QOS_UNSPEC and believe it carries a payload of struct ifla_vlan_qos_mapping, which is not necessarily true.
To address this issue and ensure compatibility, this patch introduces two type checks that skip attributes whose type is not IFLA_VLAN_QOS_MAPPING.
--- net/8021q/vlan_netlink.c | 4 ++++ 1 file changed, 4 insertions(+)
net/8021q/vlan_netlink.c +4 -0
@@ -120,12 +120,16 @@ static int vlan_changelink(struct net_device *dev, struct nlattr *tb[], }if (data[IFLA_VLAN_INGRESS_QOS ]) {nla_for_each_nested (attr, data[IFLA_VLAN_INGRESS_QOS ], rem) { +if (nla_type (attr) !=IFLA_VLAN_QOS_MAPPING ) +continue ; m =nla_data (attr);vlan_dev_set_ingress_priority (dev, m->to, m->from); } }if (data[IFLA_VLAN_EGRESS_QOS ]) {nla_for_each_nested (attr, data[IFLA_VLAN_EGRESS_QOS ], rem) { +if (nla_type (attr) !=IFLA_VLAN_QOS_MAPPING ) +continue ; m =nla_data (attr); err =vlan_dev_set_egress_priority (dev, m->from, m->to);if (err)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 26/202 llc: make llc_ui_sendmsg() more robust against bonding changes
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit dad555c816a50c6a6a8a86be1f9177673918c647 ]
syzbot was able to trick llc_ui_sendmsg(), allocating an skb with no headroom, but subsequently trying to push 14 bytes of Ethernet header [1]
Like some others, llc_ui_sendmsg() releases the socket lock before calling sock_alloc_send_skb().
Then it acquires it again, but does not redo all the sanity checks that were performed.
This fix:
- Uses LL_RESERVED_SPACE() to reserve space.
- Check all conditions again after socket lock is held again.
- Do not account Ethernet header for mtu limitation.
[1]
skbuff: skb_under_panic: text:ffff800088baa334 len:1514 put:14 head:ffff0000c9c37000 data:ffff0000c9c36ff2 tail:0x5dc end:0x6c0 dev:bond0
kernel BUG at net/core/skbuff.c:193 !
Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 6875 Comm: syz-executor.0 Not tainted 6.7.0-rc8-syzkaller-00101-g0802e17d9aca-dirty #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : skb_panic net/core/skbuff.c:189 [inline] pc : skb_under_panic+0x13c/0x140 net/core/skbuff.c:203 lr : skb_panic net/core/skbuff.c:189 [inline] lr : skb_under_panic+0x13c/0x140 net/core/skbuff.c:203
sp : ffff800096f97000
x29: ffff800096f97010 x28: ffff80008cc8d668 x27: dfff800000000000
x26: ffff0000cb970c90 x25: 00000000000005dc x24: ffff0000c9c36ff2
x23: ffff0000c9c37000 x22: 00000000000005ea x21: 00000000000006c0
x20: 000000000000000e x19: ffff800088baa334 x18: 1fffe000368261ce
x17: ffff80008e4ed000 x16: ffff80008a8310f8 x15: 0000000000000001
x14: 1ffff00012df2d58 x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000000001 x10: 0000000000ff0100 x9 : e28a51f1087e8400 x8 : e28a51f1087e8400 x7 : ffff80008028f8d0 x6 : 0000000000000000 x5 : 0000000000000001 x4 : 0000000000000001 x3 : ffff800082b78714 x2 : 0000000000000001 x1 : 0000000100000000 x0 : 0000000000000089
Call trace: skb_panic net/core/skbuff.c:189 [inline] skb_under_panic+0x13c/0x140 net/core/skbuff.c:203 skb_push+0xf0/0x108 net/core/skbuff.c:2451 eth_header+0x44/0x1f8 net/ethernet/eth.c:83 dev_hard_header include/linux/netdevice.h:3188 [inline] llc_mac_hdr_init+0x110/0x17c net/llc/llc_output.c:33 llc_sap_action_send_xid_c+0x170/0x344 net/llc/llc_s_ac.c:85 llc_exec_sap_trans_actions net/llc/llc_sap.c:153 [inline] llc_sap_next_state net/llc/llc_sap.c:182 [inline] llc_sap_state_process+0x1ec/0x774 net/llc/llc_sap.c:209 llc_build_and_send_xid_pkt+0x12c/0x1c0 net/llc/llc_sap.c:270 llc_ui_sendmsg+0x7bc/0xb1c net/llc/af_llc.c:997 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] sock_sendmsg+0x194/0x274 net/socket.c:767 splice_to_socket+0x7cc/0xd58 fs/splice.c:881 do_splice_from fs/splice.c:933 [inline] direct_splice_actor+0xe4/0x1c0 fs/splice.c:1142 splice_direct_to_actor+0x2a0/0x7e4 fs/splice.c:1088 do_splice_direct+0x20c/0x348 fs/splice.c:1194 do_sendfile+0x4bc/0xc70 fs/read_write.c:1254 __do_sys_sendfile64 fs/read_write.c:1322 [inline] __se_sys_sendfile64 fs/read_write.c:1308 [inline] __arm64_sys_sendfile64+0x160/0x3b4 fs/read_write.c:1308 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155 el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595 Code: aa1803e6 aa1903e7 a90023f5 94792f6a (d4210000)
--- net/llc/af_llc.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
net/llc/af_llc.c +16 -8
@@ -926,14 +926,15 @@ static int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,*/ static int llc_ui_sendmsg (struct socket *sock,struct msghdr *msg,size_t len) { + DECLARE_SOCKADDR(struct sockaddr_llc *, addr, msg->msg_name);struct sock *sk = sock->sk;struct llc_sock *llc =llc_sk (sk); - DECLARE_SOCKADDR(struct sockaddr_llc *, addr, msg->msg_name);int flags = msg->msg_flags;int noblock = flags &MSG_DONTWAIT ; +int rc = -EINVAL , copied =0 , hdrlen, hh_len;struct sk_buff *skb =NULL ; +struct net_device *dev;size_t size =0 ; -int rc = -EINVAL , copied =0 , hdrlen;dprintk ("%s: sending from %02X to %02X\n" , __func__, llc->laddr.lsap, llc->daddr.lsap);
@@ -953,22 +954,29 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)if (rc) goto out; } - hdrlen = llc->dev->hard_header_len +llc_ui_header_len (sk, addr); + dev = llc->dev; + hh_len =LL_RESERVED_SPACE (dev); + hdrlen =llc_ui_header_len (sk, addr); size = hdrlen + len; -if (size > llc->dev->mtu) - size = llc->dev->mtu; + size =min_t (size_t, size,READ_ONCE (dev->mtu)); copied = size - hdrlen; rc = -EINVAL ;if (copied <0 ) goto out;release_sock (sk); - skb =sock_alloc_send_skb (sk, size, noblock, &rc); + skb =sock_alloc_send_skb (sk, hh_len + size, noblock, &rc);lock_sock (sk);if (!skb) goto out; - skb->dev = llc->dev; +if (sock_flag (sk,SOCK_ZAPPED ) || + llc->dev != dev || + hdrlen !=llc_ui_header_len (sk, addr) || + hh_len !=LL_RESERVED_SPACE (dev) || + size >READ_ONCE (dev->mtu)) + goto out; + skb->dev = dev; skb->protocol =llc_proto_type (addr->sllc_arphrd); -skb_reserve (skb, hdrlen); +skb_reserve (skb, hh_len + hdrlen); rc =memcpy_from_msg (skb_put (skb, copied), msg, copied);if (rc) goto out;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 27/202 llc: Drop support for ETH_P_TR_802_2.
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit e3f9bed9bee261e3347131764e42aeedf1ffea61 ]
syzbot reported an uninit-value bug below. [0]
llc supports ETH_P_802_2 (0x0004) and used to support ETH_P_TR_802_2 (0x0011), and syzbot abused the latter to trigger the bug.
write$tun(r0, &(0x7f0000000040)={@val={0x0, 0x11}, @val, @mpls={[], @llc={@snap={0xaa, 0x1, ')', "90e5dd"}}}}, 0x16)
llc_conn_handler() initialises local variables {saddr,daddr}.mac based on skb in llc_pdu_decode_sa()/llc_pdu_decode_da() and passes them to __llc_lookup().
However, the initialisation is done only when skb->protocol is htons(ETH_P_802_2), otherwise, __llc_lookup_established() and __llc_lookup_listener() will read garbage.
The missing initialisation existed prior to commit 211ed865108e ("net: delete all instances of special processing for token ring").
It removed the part to kick out the token ring stuff but forgot to close the door allowing ETH_P_TR_802_2 packets to sneak into llc_rcv().
Let's remove llc_tr_packet_type and complete the deprecation.
[0]:
BUG: KMSAN: uninit-value in __llc_lookup_established+0xe9d/0xf90 __llc_lookup_established+0xe9d/0xf90 __llc_lookup net/llc/llc_conn.c:611 [inline] llc_conn_handler+0x4bd/0x1360 net/llc/llc_conn.c:791 llc_rcv+0xfbb/0x14a0 net/llc/llc_input.c:206 __netif_receive_skb_one_core net/core/dev.c:5527 [inline] __netif_receive_skb+0x1a6/0x5a0 net/core/dev.c:5641 netif_receive_skb_internal net/core/dev.c:5727 [inline] netif_receive_skb+0x58/0x660 net/core/dev.c:5786 tun_rx_batched+0x3ee/0x980 drivers/net/tun.c:1555 tun_get_user+0x53af/0x66d0 drivers/net/tun.c:2002 tun_chr_write_iter+0x3af/0x5d0 drivers/net/tun.c:2048 call_write_iter include/linux/fs.h:2020 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x8ef/0x1490 fs/read_write.c:584 ksys_write+0x20f/0x4c0 fs/read_write.c:637 __do_sys_write fs/read_write.c:649 [inline] __se_sys_write fs/read_write.c:646 [inline] __x64_sys_write+0x93/0xd0 fs/read_write.c:646 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b
Local variable daddr created at:
llc_conn_handler+0x53/0x1360 net/llc/llc_conn.c:783 llc_rcv+0xfbb/0x14a0 net/llc/llc_input.c:206 CPU: 1 PID: 5004 Comm: syz-executor994 Not tainted 6.6.0-syzkaller-14500-g1c41041124bd #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/09/2023
--- include/net/llc_pdu.h | 6 ++---- net/llc/llc_core.c | 7 ------- 2 files changed, 2 insertions(+), 11 deletions(-)
include/net/llc_pdu.h +2 -4
@@ -262,8 +262,7 @@ static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type,*/ static inline void llc_pdu_decode_sa (struct sk_buff *skb,u8 *sa) { -if (skb->protocol ==htons (ETH_P_802_2 )) -memcpy (sa,eth_hdr (skb)->h_source,ETH_ALEN ); +memcpy (sa,eth_hdr (skb)->h_source,ETH_ALEN ); }/**
@@ -275,8 +274,7 @@ static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa)*/ static inline void llc_pdu_decode_da (struct sk_buff *skb,u8 *da) { -if (skb->protocol ==htons (ETH_P_802_2 )) -memcpy (da,eth_hdr (skb)->h_dest,ETH_ALEN ); +memcpy (da,eth_hdr (skb)->h_dest,ETH_ALEN ); }/**
net/llc/llc_core.c +0 -7
@@ -135,22 +135,15 @@ static struct packet_type llc_packet_type __read_mostly = { .func = llc_rcv, }; -static struct packet_type llc_tr_packet_type__read_mostly = { - .type =cpu_to_be16 (ETH_P_TR_802_2 ), - .func = llc_rcv, -}; -static int __init llc_init (void ) {dev_add_pack (&llc_packet_type); -dev_add_pack (&llc_tr_packet_type);return 0 ; } static void __exit llc_exit(void) {dev_remove_pack (&llc_packet_type); -dev_remove_pack (&llc_tr_packet_type); }module_init (llc_init);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 28/202 net/rds: Fix UBSAN: array-index-out-of-bounds in rds_cmsg_recv
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sharath Srinivasan <[email protected]>
[ Upstream commit 13e788deb7348cc88df34bed736c3b3b9927ea52 ]
Syzcaller UBSAN crash occurs in rds_cmsg_recv(),
which reads inc->i_rx_lat_trace[j + 1] with index 4 (3 + 1), but with array size of 4 (RDS_RX_MAX_TRACES).
Here 'j' is assigned from rs->rs_rx_trace[i] and in-turn from trace.rx_trace_pos[i] in rds_recv_track_latency(),
with both arrays sized 3 (RDS_MSG_RX_DGRAM_TRACE_MAX). So fix the off-by-one bounds check in rds_recv_track_latency() to prevent a potential crash in rds_cmsg_recv().
Found by syzcaller:
=================================================================
UBSAN: array-index-out-of-bounds in net/rds/recv.c:585:39 index 4 is out of range for type 'u64 [4]' CPU: 1 PID: 8058 Comm: syz-executor228 Not tainted 6.6.0-gd2f51b3516da #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x136/0x150 lib/dump_stack.c:106 ubsan_epilogue lib/ubsan.c:217 [inline] __ubsan_handle_out_of_bounds+0xd5/0x130 lib/ubsan.c:348 rds_cmsg_recv+0x60d/0x700 net/rds/recv.c:585 rds_recvmsg+0x3fb/0x1610 net/rds/recv.c:716 sock_recvmsg_nosec net/socket.c:1044 [inline] sock_recvmsg+0xe2/0x160 net/socket.c:1066 __sys_recvfrom+0x1b6/0x2f0 net/socket.c:2246 __do_sys_recvfrom net/socket.c:2264 [inline] __se_sys_recvfrom net/socket.c:2260 [inline] __x64_sys_recvfrom+0xe0/0x1b0 net/socket.c:2260 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x40/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b ==================================================================
--- net/rds/af_rds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rds/af_rds.c +1 -1
@@ -385,7 +385,7 @@ static int rds_recv_track_latency(struct rds_sock *rs, char __user *optval, rs->rs_rx_traces = trace.rx_traces;for (i =0 ; i < rs->rs_rx_traces; i++) { -if (trace.rx_trace_pos[i] >RDS_MSG_RX_DGRAM_TRACE_MAX ) { +if (trace.rx_trace_pos[i] >=RDS_MSG_RX_DGRAM_TRACE_MAX ) { rs->rs_rx_traces =0 ;return -EFAULT ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 29/202 tracing: Ensure visibility when inserting an element into tracing_map
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Pavlu <[email protected]>
[ Upstream commit 2b44760609e9eaafc9d234a6883d042fc21132a7 ]
Running the following two commands in parallel on a multi-processor AArch64 machine can sporadically produce an unexpected warning about duplicate histogram entries:
$ while true; do
echo hist:key=id.syscall:val=hitcount > \
/sys/kernel/debug/tracing/events/raw_syscalls/sys_enter/trigger
cat /sys/kernel/debug/tracing/events/raw_syscalls/sys_enter/hist
sleep 0.001
done
$ stress-ng --sysbadaddr $(nproc)The warning looks as follows:
[ 2911.172474] ------------[ cut here ]------------ [ 2911.173111] Duplicates detected: 1 [ 2911.173574] WARNING: CPU: 2 PID: 12247 at kernel/trace/tracing_map.c:983 tracing_map_sort_entries+0x3e0/0x408 [ 2911.174702] Modules linked in: iscsi_ibft(E) iscsi_boot_sysfs(E) rfkill(E) af_packet(E) nls_iso8859_1(E) nls_cp437(E) vfat(E) fat(E) ena(E) tiny_power_button(E) qemu_fw_cfg(E) button(E) fuse(E) efi_pstore(E) ip_tables(E) x_tables(E) xfs(E) libcrc32c(E) aes_ce_blk(E) aes_ce_cipher(E) crct10dif_ce(E) polyval_ce(E) polyval_generic(E) ghash_ce(E) gf128mul(E) sm4_ce_gcm(E) sm4_ce_ccm(E) sm4_ce(E) sm4_ce_cipher(E) sm4(E) sm3_ce(E) sm3(E) sha3_ce(E) sha512_ce(E) sha512_arm64(E) sha2_ce(E) sha256_arm64(E) nvme(E) sha1_ce(E) nvme_core(E) nvme_auth(E) t10_pi(E) sg(E) scsi_mod(E) scsi_common(E) efivarfs(E) [ 2911.174738] Unloaded tainted modules: cppc_cpufreq(E):1 [ 2911.180985] CPU: 2 PID: 12247 Comm: cat Kdump: loaded Tainted: G E 6.7.0-default #2 1b58bbb22c97e4399dc09f92d309344f69c44a01 [ 2911.182398] Hardware name: Amazon EC2 c7g.8xlarge/, BIOS 1.0 11/1/2018 [ 2911.183208] pstate: 61400005 (nZCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--) [ 2911.184038] pc : tracing_map_sort_entries+0x3e0/0x408 [ 2911.184667] lr : tracing_map_sort_entries+0x3e0/0x408 [ 2911.185310] sp : ffff8000a1513900 [ 2911.185750] x29: ffff8000a1513900 x28: ffff0003f272fe80 x27: 0000000000000001 [ 2911.186600] x26: ffff0003f272fe80 x25: 0000000000000030 x24: 0000000000000008 [ 2911.187458] x23: ffff0003c5788000 x22: ffff0003c16710c8 x21: ffff80008017f180 [ 2911.188310] x20: ffff80008017f000 x19: ffff80008017f180 x18: ffffffffffffffff [ 2911.189160] x17: 0000000000000000 x16: 0000000000000000 x15: ffff8000a15134b8 [ 2911.190015] x14: 0000000000000000 x13: 205d373432323154 x12: 5b5d313131333731 [ 2911.190844] x11: 00000000fffeffff x10: 00000000fffeffff x9 : ffffd1b78274a13c [ 2911.191716] x8 : 000000000017ffe8 x7 : c0000000fffeffff x6 : 000000000057ffa8 [ 2911.192554] x5 : ffff0012f6c24ec0 x4 : 0000000000000000 x3 : ffff2e5b72b5d000 [ 2911.193404] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0003ff254480 [ 2911.194259] Call trace: [ 2911.194626] tracing_map_sort_entries+0x3e0/0x408 [ 2911.195220] hist_show+0x124/0x800 [ 2911.195692] seq_read_iter+0x1d4/0x4e8 [ 2911.196193] seq_read+0xe8/0x138 [ 2911.196638] vfs_read+0xc8/0x300 [ 2911.197078] ksys_read+0x70/0x108 [ 2911.197534] __arm64_sys_read+0x24/0x38 [ 2911.198046] invoke_syscall+0x78/0x108 [ 2911.198553] el0_svc_common.constprop.0+0xd0/0xf8 [ 2911.199157] do_el0_svc+0x28/0x40 [ 2911.199613] el0_svc+0x40/0x178 [ 2911.200048] el0t_64_sync_handler+0x13c/0x158 [ 2911.200621] el0t_64_sync+0x1a8/0x1b0 [ 2911.201115] ---[ end trace 0000000000000000 ]---
The problem appears to be caused by CPU reordering of writes issued from __tracing_map_insert().
The check for the presence of an element with a given key in this function is:
val = READ_ONCE(entry->val);
if (val && keys_match(key, val->key, map->key_size)) ...
The write of a new entry is:
elt = get_free_elt(map);
memcpy(elt->key, key, map->key_size);
entry->val = elt;
The "memcpy(elt->key, key, map->key_size);" and "entry->val = elt;" stores may become visible in the reversed order on another CPU. This second CPU might then incorrectly determine that a new key doesn't match an already present val->key and subsequently insert a new element, resulting in a duplicate.
Fix the problem by adding a write barrier between "memcpy(elt->key, key, map->key_size);" and "entry->val = elt;", and for good measure, also use WRITE_ONCE(entry->val, elt) for publishing the element. The sequence pairs with the mentioned "READ_ONCE(entry->val);" and the "val->key" check which has an address dependency.
The barrier is placed on a path executed when adding an element for a new key. Subsequent updates targeting the same key remain unaffected.
Quoted 1 line
From the user's perspective, the issue was introduced by commit
c193707dde77 ("tracing: Remove code which merges duplicates"), which followed commit cbf4100efb8f ("tracing: Add support to detect and avoid duplicates"). The previous code operated differently; it inherently expected potential races which result in duplicates but merged them later when they occurred.
--- kernel/trace/tracing_map.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/trace/tracing_map.c +6 -1
@@ -574,7 +574,12 @@ __tracing_map_insert(struct tracing_map *map, void *key, bool lookup_only) }memcpy (elt->key, key, map->key_size); - entry->val = elt; +/* +* Ensure the initialization is visible and +* publish the elt. +*/ +smp_wmb (); +WRITE_ONCE (entry->val, elt);atomic64_inc (&map->hits);return entry->val;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 30/202 tcp: Add memory barrier to tcp_push()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Salvatore Dipietro <[email protected]>
[ Upstream commit 7267e8dcad6b2f9fce05a6a06335d7040acbc2b6 ]
On CPUs with weak memory models, reads and updates performed by tcp_push to the sk variables can get reordered leaving the socket throttled when it should not. The tasklet running tcp_wfree() may also not observe the memory updates in time and will skip flushing any packets throttled by tcp_push(), delaying the sending. This can pathologically cause 40ms extra latency due to bad interactions with delayed acks.
Adding a memory barrier in tcp_push removes the bug, similarly to the previous commit bf06200e732d ("tcp: tsq: fix nonagle handling"). smp_mb__after_atomic() is used to not incur in unnecessary overhead on x86 since not affected.
Patch has been tested using an AWS c7g.2xlarge instance with Ubuntu 22.04 and Apache Tomcat 9.0.83 running the basic servlet below:
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class HelloWorldServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
OutputStreamWriter osw = new OutputStreamWriter(response.getOutputStream(),"UTF-8");
String s = "a".repeat(3096);
osw.write(s,0,s.length());
osw.flush();
}
}Load was applied using wrk2 (https://github.com/kinvolk/wrk2) from an AWS c6i.8xlarge instance. Before the patch an additional 40ms latency from P99.99+ values is observed while, with the patch, the extra latency disappears.
No patch and tcp_autocorking=1
./wrk -t32 -c128 -d40s --latency -R10000 http://172.31.60.173:8080/hello/hello
...
50.000% 0.91ms 75.000% 1.13ms 90.000% 1.46ms 99.000% 1.74ms 99.900% 1.89ms 99.990% 41.95ms <<< 40+ ms extra latency 99.999% 48.32ms 100.000% 48.96ms
With patch and tcp_autocorking=1
./wrk -t32 -c128 -d40s --latency -R10000 http://172.31.60.173:8080/hello/hello
...
50.000% 0.90ms 75.000% 1.13ms 90.000% 1.45ms 99.000% 1.72ms 99.900% 1.83ms 99.990% 2.11ms <<< no 40+ ms extra latency 99.999% 2.53ms 100.000% 2.62ms
Patch has been also tested on x86 (m7i.2xlarge instance) which it is not affected by this issue and the patch doesn't introduce any additional delay.
--- net/ipv4/tcp.c | 1 + 1 file changed, 1 insertion(+)
net/ipv4/tcp.c +1 -0
@@ -733,6 +733,7 @@ static void tcp_push(struct sock *sk, int flags, int mss_now,if (!test_bit (TSQ_THROTTLED , &sk->sk_tsq_flags)) {NET_INC_STATS (sock_net (sk),LINUX_MIB_TCPAUTOCORKING );set_bit (TSQ_THROTTLED , &sk->sk_tsq_flags); +smp_mb__after_atomic (); }/* It is possible TX completion already happened * before we set TSQ_THROTTLED.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 31/202 netlink: fix potential sleeping issue in mqueue_flush_file
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhengchao Shao <[email protected]>
[ Upstream commit 234ec0b6034b16869d45128b8cd2dc6ffe596f04 ]
I analyze the potential sleeping issue of the following processes:
Thread A Thread B ... netlink_create //ref = 1 do_mq_notify ... sock = netlink_getsockbyfilp ... //ref = 2 info->notify_sock = sock; ... ... netlink_sendmsg
... skb = netlink_alloc_large_skb //skb->head is vmalloced
... netlink_unicast
... sk = netlink_getsockbyportid //ref = 3
... netlink_sendskb
... __netlink_sendskb
... skb_queue_tail //put skb to sk_receive_queue
... sock_put //ref = 2
... ...
... netlink_release
... deferred_put_nlk_sk //ref = 1mqueue_flush_file
spin_lock
remove_notification
netlink_sendskb
sock_put //ref = 0
sk_free
...
__sk_destruct
netlink_sock_destruct
skb_queue_purge //get skb from sk_receive_queue
...
__skb_queue_purge_reason
kfree_skb_reason
__kfree_skb
...
skb_release_all
skb_release_head_state
netlink_skb_destructor
vfree(skb->head) //sleeping while holding spinlockIn netlink_sendmsg, if the memory pointed to by skb->head is allocated by vmalloc, and is put to sk_receive_queue queue, also the skb is not freed. When the mqueue executes flush, the sleeping bug will occur. Use vfree_atomic instead of vfree in netlink_skb_destructor to solve the issue.
--- net/netlink/af_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netlink/af_netlink.c +1 -1
@@ -374,7 +374,7 @@ static void netlink_skb_destructor(struct sk_buff *skb)if (is_vmalloc_addr (skb->head)) {if (!skb->cloned || !atomic_dec_return (&(skb_shinfo (skb)->dataref))) -vfree (skb->head); +vfree_atomic (skb->head); skb->head =NULL ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 32/202 net/mlx5: Use kfree(ft->g) in arfs_create_groups()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Denis Efremov <[email protected]>
[ Upstream commit 360000b26e37a75b3000bf0585b263809d96ffd3 ]
Use kfree() instead of kvfree() on ft->g in arfs_create_groups() because the memory is allocated with kcalloc().
Stable-dep-of: 3c6d5189246f ("net/mlx5e: fix a double-free in arfs_create_groups")
--- drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c +1 -1
@@ -229,7 +229,7 @@ static int arfs_create_groups(struct mlx5e_flow_table *ft, sizeof(*ft->g), GFP_KERNEL); in =kvzalloc (inlen,GFP_KERNEL );if (!in || !ft->g) { -kvfree (ft->g); +kfree (ft->g);kvfree (in);return -ENOMEM ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 33/202 net/mlx5e: fix a double-free in arfs_create_groups
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhipeng Lu <[email protected]>
[ Upstream commit 3c6d5189246f590e4e1f167991558bdb72a4738b ]
When in allocated by kvzalloc fails, arfs_create_groups will free ft->g and return an error. However, arfs_create_table, the only caller of arfs_create_groups, will hold this error and call to mlx5e_destroy_flow_table, in which the ft->g will be freed again.
--- .../net/ethernet/mellanox/mlx5/core/en_arfs.c | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c +15 -11
@@ -227,11 +227,13 @@ static int arfs_create_groups(struct mlx5e_flow_table *ft, ft->g =kcalloc (MLX5E_ARFS_NUM_GROUPS ,sizeof (*ft->g),GFP_KERNEL ); - in =kvzalloc (inlen,GFP_KERNEL ); -if (!in || !ft->g) { -kfree (ft->g); -kvfree (in); +if (!ft->g)return -ENOMEM ; + + in =kvzalloc (inlen,GFP_KERNEL ); +if (!in) { + err = -ENOMEM ; + goto err_free_g; } mc =MLX5_ADDR_OF (create_flow_group_in, in, match_criteria);
@@ -251,7 +253,7 @@ static int arfs_create_groups(struct mlx5e_flow_table *ft,break ;default : err = -EINVAL ; - goto out; + goto err_free_in; }switch (type) {
@@ -273,7 +275,7 @@ static int arfs_create_groups(struct mlx5e_flow_table *ft,break ;default : err = -EINVAL ; - goto out; + goto err_free_in; }MLX5_SET_CFG (in, match_criteria_enable,MLX5_MATCH_OUTER_HEADERS );
@@ -282,7 +284,7 @@ static int arfs_create_groups(struct mlx5e_flow_table *ft,MLX5_SET_CFG (in, end_flow_index, ix -1 ); ft->g[ft->num_groups] =mlx5_create_flow_group (ft->t, in);if (IS_ERR (ft->g[ft->num_groups])) - goto err; + goto err_clean_group; ft->num_groups++;memset (in,0 , inlen);
@@ -291,18 +293,20 @@ static int arfs_create_groups(struct mlx5e_flow_table *ft,MLX5_SET_CFG (in, end_flow_index, ix -1 ); ft->g[ft->num_groups] =mlx5_create_flow_group (ft->t, in);if (IS_ERR (ft->g[ft->num_groups])) - goto err; + goto err_clean_group; ft->num_groups++;kvfree (in);return 0 ; -err: +err_clean_group: err =PTR_ERR (ft->g[ft->num_groups]); ft->g[ft->num_groups] =NULL ; -out: +err_free_in:kvfree (in); - +err_free_g: +kfree (ft->g); + ft->g =NULL ;return err; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 34/202 netfilter: nf_tables: restrict anonymous set and map names to 16 bytes
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit b462579b2b86a8f5230543cadd3a4836be27baf7 ]
nftables has two types of sets/maps, one where userspace defines the name, and anonymous sets/maps, where userspace defines a template name.
For the latter, kernel requires presence of exactly one "%d". nftables uses "__set%d" and "__map%d" for this. The kernel will expand the format specifier and replaces it with the smallest unused number.
As-is, userspace could define a template name that allows to move the set name past the 256 bytes upperlimit (post-expansion).
I don't see how this could be a problem, but I would prefer if userspace cannot do this, so add a limit of 16 bytes for the '%d' template name.
16 bytes is the old total upper limit for set names that existed when nf_tables was merged initially.
--- net/netfilter/nf_tables_api.c | 4 ++++ 1 file changed, 4 insertions(+)
net/netfilter/nf_tables_api.c +4 -0
@@ -26,6 +26,7 @@#include <net/sock.h> #define NFT_MODULE_AUTOLOAD_LIMIT (MODULE_NAME_LEN - sizeof("nft-expr-255-")) +#define NFT_SET_MAX_ANONLEN 16unsigned int nf_tables_net_id__read_mostly ;
@@ -3184,6 +3185,9 @@ static int nf_tables_set_alloc_name(struct nft_ctx *ctx, struct nft_set *set,if (p[1 ] !='d' ||strchr (p +2 ,'%' ))return -EINVAL ; +if (strnlen (name,NFT_SET_MAX_ANONLEN ) >=NFT_SET_MAX_ANONLEN ) +return -EINVAL ; + inuse = (unsigned long *)get_zeroed_page (GFP_KERNEL );if (inuse ==NULL )return -ENOMEM ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 35/202 fjes: fix memleaks in fjes_hw_setup
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhipeng Lu <[email protected]>
[ Upstream commit f6cc4b6a3ae53df425771000e9c9540cce9b7bb1 ]
In fjes_hw_setup, it allocates several memory and delay the deallocation to the fjes_hw_exit in fjes_probe through the following call chain:
fjes_probe
|-> fjes_hw_init
|-> fjes_hw_setup
|-> fjes_hw_exit
However, when fjes_hw_setup fails, fjes_hw_exit won't be called and thus all the resources allocated in fjes_hw_setup will be leaked. In this patch, we free those resources in fjes_hw_setup and prevents such leaks.
--- drivers/net/fjes/fjes_hw.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-)
drivers/net/fjes/fjes_hw.c +30 -7
@@ -235,21 +235,25 @@ static int fjes_hw_setup(struct fjes_hw *hw) mem_size =FJES_DEV_REQ_BUF_SIZE (hw->max_epid); hw->hw_info.req_buf =kzalloc (mem_size,GFP_KERNEL ); -if (!(hw->hw_info.req_buf)) -return -ENOMEM ; +if (!(hw->hw_info.req_buf)) { + result = -ENOMEM ; + goto free_ep_info; + } hw->hw_info.req_buf_size = mem_size; mem_size =FJES_DEV_RES_BUF_SIZE (hw->max_epid); hw->hw_info.res_buf =kzalloc (mem_size,GFP_KERNEL ); -if (!(hw->hw_info.res_buf)) -return -ENOMEM ; +if (!(hw->hw_info.res_buf)) { + result = -ENOMEM ; + goto free_req_buf; + } hw->hw_info.res_buf_size = mem_size; result =fjes_hw_alloc_shared_status_region (hw);if (result) -return result; + goto free_res_buf; hw->hw_info.buffer_share_bit =0 ; hw->hw_info.buffer_unshare_reserve_bit =0 ;
@@ -260,11 +264,11 @@ static int fjes_hw_setup(struct fjes_hw *hw) result =fjes_hw_alloc_epbuf (&buf_pair->tx);if (result) -return result; + goto free_epbuf; result =fjes_hw_alloc_epbuf (&buf_pair->rx);if (result) -return result; + goto free_epbuf;spin_lock_irqsave (&hw->rx_status_lock, flags); fjes_hw_setup_epbuf(&buf_pair->tx, mac,
@@ -287,6 +291,25 @@ static int fjes_hw_setup(struct fjes_hw *hw)fjes_hw_init_command_registers (hw, ¶m);return 0 ; + +free_epbuf: +for (epidx =0 ; epidx < hw->max_epid ; epidx++) { +if (epidx == hw->my_epid) +continue ; +fjes_hw_free_epbuf (&hw->ep_shm_info[epidx].tx); +fjes_hw_free_epbuf (&hw->ep_shm_info[epidx].rx); + } +fjes_hw_free_shared_status_region (hw); +free_res_buf: +kfree (hw->hw_info.res_buf); + hw->hw_info.res_buf =NULL ; +free_req_buf: +kfree (hw->hw_info.req_buf); + hw->hw_info.req_buf =NULL ; +free_ep_info: +kfree (hw->ep_shm_info); + hw->ep_shm_info =NULL ; +return result; }static void fjes_hw_cleanup (struct fjes_hw *hw)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 36/202 net: fec: fix the unhandled context fault from smmu
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shenwei Wang <[email protected]>
[ Upstream commit 5e344807735023cd3a67c37a1852b849caa42620 ]
When repeatedly changing the interface link speed using the command below:
ethtool -s eth0 speed 100 duplex full
ethtool -s eth0 speed 1000 duplex full
The following errors may sometimes be reported by the ARM SMMU driver:
[ 5395.035364] fec 5b040000.ethernet eth0: Link is Down [ 5395.039255] arm-smmu 51400000.iommu: Unhandled context fault: fsr=0x402, iova=0x00000000, fsynr=0x100001, cbfrsynra=0x852, cb=2 [ 5398.108460] fec 5b040000.ethernet eth0: Link is Up - 100Mbps/Full -
flow control off
It is identified that the FEC driver does not properly stop the TX queue during the link speed transitions, and this results in the invalid virtual I/O address translations from the SMMU and causes the context faults.
--- drivers/net/ethernet/freescale/fec_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/freescale/fec_main.c +2 -0
@@ -1798,6 +1798,7 @@ static void fec_enet_adjust_link(struct/* if any of the above changed restart the FEC */ if (status_change) { +netif_stop_queue (ndev);napi_disable (&fep->napi);netif_tx_lock_bh (ndev);fec_restart (ndev);
@@ -1807,6 +1808,7 @@ static void fec_enet_adjust_link(struct } }else {if (fep->link) { +netif_stop_queue (ndev);napi_disable (&fep->napi);netif_tx_lock_bh (ndev);fec_stop (ndev);
Greg Kroah-Hartman
maintainerPATCH 37/202 btrfs: dont warn if discard range is not aligned to sector
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
commit a208b3f132b48e1f94f620024e66fea635925877 upstream.
There's a warning in btrfs_issue_discard() when the range is not aligned to 512 bytes, originally added in 4d89d377bbb0 ("btrfs:btrfs_issue_discard ensure offset/length are aligned to sector boundaries"). We can't do sub-sector writes anyway so the adjustment is the only thing that we can do and the warning is unnecessary.
--- fs/btrfs/extent-tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/extent-tree.c +2 -1
@@ -1899,7 +1899,8 @@ static int btrfs_issue_discard(struct blu64 bytes_left, end;u64 aligned_start =ALIGN (start,1 <<9 ); -if (WARN_ON (start != aligned_start)) { +/* Adjust the range to be aligned to 512B sectors if necessary. */ +if (start != aligned_start) { len -= aligned_start - start; len =round_down (len,1 <<9 ); start = aligned_start;
Greg Kroah-Hartman
maintainerPATCH 38/202 btrfs: defrag: reject unknown flags of btrfs_ioctl_defrag_range_args
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
commit 173431b274a9a54fc10b273b46e67f46bcf62d2e upstream.
Add extra sanity check for btrfs_ioctl_defrag_range_args::flags.
This is not really to enhance fuzzing tests, but as a preparation for future expansion on btrfs_ioctl_defrag_range_args.
In the future we're going to add new members, allowing more fine tuning for btrfs defrag. Without the -ENONOTSUPP error, there would be no way to detect if the kernel supports those new defrag features.
--- fs/btrfs/ioctl.c | 4 ++++ include/uapi/linux/btrfs.h | 3 +++ 2 files changed, 7 insertions(+)
fs/btrfs/ioctl.c +4 -0
@@ -3037,6 +3037,10 @@ static int btrfs_ioctl_defrag(struct filkfree (range); goto out; } +if (range->flags & ~BTRFS_DEFRAG_RANGE_FLAGS_SUPP ) { + ret = -EOPNOTSUPP ; + goto out; + }/* compression requires us to start the IO */ if ((range->flags &BTRFS_DEFRAG_RANGE_COMPRESS )) { range->flags |=BTRFS_DEFRAG_RANGE_START_IO ;
include/uapi/linux/btrfs.h +3 -0
@@ -538,6 +538,9 @@ struct btrfs_ioctl_clone_range_args {*/ #define BTRFS_DEFRAG_RANGE_COMPRESS 1#define BTRFS_DEFRAG_RANGE_START_IO 2 +#define BTRFS_DEFRAG_RANGE_FLAGS_SUPP (BTRFS_DEFRAG_RANGE_COMPRESS | \ + BTRFS_DEFRAG_RANGE_START_IO) +struct btrfs_ioctl_defrag_range_args {/* start of the defrag operation */ __u64 start;
Greg Kroah-Hartman
maintainerPATCH 39/202 netfilter: nf_tables: reject QUEUE/DROP verdict parameters
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit f342de4e2f33e0e39165d8639387aa6c19dff660 upstream.
This reverts commit e0abdadcc6e1.
core.c:nf_hook_slow assumes that the upper 16 bits of NF_DROP verdicts contain a valid errno, i.e. -EPERM, -EHOSTUNREACH or similar, or 0.
Due to the reverted commit, its possible to provide a positive value, e.g. NF_ACCEPT (1), which results in use-after-free.
Its not clear to me why this commit was made.
NF_QUEUE is not used by nftables; "queue" rules in nftables will result in use of "nft_queue" expression.
If we later need to allow specifiying errno values from userspace (do not know why), this has to call NF_DROP_GETERR and check that "err <= 0" holds true.
--- net/netfilter/nf_tables_api.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
net/netfilter/nf_tables_api.c +6 -10
@@ -7341,16 +7341,10 @@ static int nft_verdict_init(const struct data->verdict.code =ntohl (nla_get_be32 (tb[NFTA_VERDICT_CODE ]));switch (data->verdict.code) { -default : -switch (data->verdict.code &NF_VERDICT_MASK ) { -case NF_ACCEPT : -case NF_DROP : -case NF_QUEUE : -break ; -default : -return -EINVAL ; - } -/* fall through */ +case NF_ACCEPT : +case NF_DROP : +case NF_QUEUE : +break ;case NFT_CONTINUE :case NFT_BREAK :case NFT_RETURN :
@@ -7370,6 +7364,8 @@ static int nft_verdict_init(const struct data->verdict.chain = chain;break ; +default : +return -EINVAL ; } desc->len =sizeof (data->verdict);
Greg Kroah-Hartman
maintainerPATCH 40/202 gpiolib: acpi: Ignore touchpad wakeup on GPD G1619-04
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
commit 805c74eac8cb306dc69b87b6b066ab4da77ceaf1 upstream.
Spurious wakeups are reported on the GPD G1619-04 which can be absolved by programming the GPIO to ignore wakeups.
--- drivers/gpio/gpiolib-acpi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpio/gpiolib-acpi.c +14 -0
@@ -1427,6 +1427,20 @@ static const struct dmi_system_id gpioli .ignore_wake = "INT33FF:01@0", }, }, + { + /* + * Spurious wakeups from TP_ATTN# pin + * Found in BIOS 0.35 + * https://gitlab.freedesktop.org/drm/amd/-/issues/3073 + */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "GPD"), + DMI_MATCH(DMI_PRODUCT_NAME, "G1619-04"), + }, + .driver_data = &(struct acpi_gpiolib_dmi_quirk) { + .ignore_wake = "PNP0C50:00@8", + }, + }, {} /* Terminating entry */ };
Greg Kroah-Hartman
maintainerPATCH 41/202 drm: Dont unref the same fb many times by mistake due to deadlock handling
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ville Syrjälä <[email protected]>
commit cb4daf271302d71a6b9a7c01bd0b6d76febd8f0c upstream.
If we get a deadlock after the fb lookup in drm_mode_page_flip_ioctl() we proceed to unref the fb and then retry the whole thing from the top. But we forget to reset the fb pointer back to NULL, and so if we then get another error during the retry, before the fb lookup, we proceed the unref the same fb again without having gotten another reference. The end result is that the fb will (eventually) end up being freed while it's still in use.
Reset fb to NULL once we've unreffed it to avoid doing it again until we've done another fb lookup.
This turned out to be pretty easy to hit on a DG2 when doing async flips (and CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y). The first symptom I saw that drm_closefb() simply got stuck in a busy loop while walking the framebuffer list. Fortunately I was able to convince it to oops instead, and from there it was easier to track down the culprit.
--- drivers/gpu/drm/drm_plane.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/drm_plane.c +1 -0
@@ -1183,6 +1183,7 @@ retry: out:if (fb)drm_framebuffer_put (fb); + fb =NULL ;if (plane->old_fb)drm_framebuffer_put (plane->old_fb); plane->old_fb =NULL ;
Greg Kroah-Hartman
maintainerPATCH 42/202 drm/bridge: nxp-ptn3460: fix i2c_master_send() error checking
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 914437992876838662c968cb416f832110fb1093 upstream.
The i2c_master_send/recv() functions return negative error codes or the number of bytes that were able to be sent/received. This code has two problems. 1) Instead of checking if all the bytes were sent or received, it checks that at least one byte was sent or received.
2) If there was a partial send/receive then we should return a negative error code but this code returns success.
--- drivers/gpu/drm/bridge/nxp-ptn3460.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/bridge/nxp-ptn3460.c +5 -5
@@ -66,13 +66,13 @@ static int ptn3460_read_bytes(struct ptn ret =i2c_master_send (ptn_bridge->client, &addr,1 );if (ret <=0 ) {DRM_ERROR ("Failed to send i2c command, ret=%d\n" , ret); -return ret; +return ret ?: -EIO ; } ret =i2c_master_recv (ptn_bridge->client, buf, len); -if (ret <=0 ) { +if (ret != len) {DRM_ERROR ("Failed to recv i2c data, ret=%d\n" , ret); -return ret; +return ret <0 ? ret : -EIO ; }return 0 ;
@@ -88,9 +88,9 @@ static int ptn3460_write_byte(struct ptn buf[1 ] = val; ret =i2c_master_send (ptn_bridge->client, buf,ARRAY_SIZE (buf)); -if (ret <=0 ) { +if (ret !=ARRAY_SIZE (buf)) {DRM_ERROR ("Failed to send i2c command, ret=%d\n" , ret); -return ret; +return ret <0 ? ret : -EIO ; }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 43/202 drm/bridge: nxp-ptn3460: simplify some error checking
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 28d3d0696688154cc04983f343011d07bf0508e4 upstream.
The i2c_master_send/recv() functions return negative error codes or they return "len" on success. So the error handling here can be written as just normal checks for "if (ret < 0) return ret;". No need to complicate things.
Btw, in this code the "len" parameter can never be zero, but even if it were, then I feel like this would still be the best way to write it.
--- drivers/gpu/drm/bridge/nxp-ptn3460.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/nxp-ptn3460.c +6 -6
@@ -64,15 +64,15 @@ static int ptn3460_read_bytes(struct ptnint ret; ret =i2c_master_send (ptn_bridge->client, &addr,1 ); -if (ret <=0 ) { +if (ret <0 ) {DRM_ERROR ("Failed to send i2c command, ret=%d\n" , ret); -return ret ?: -EIO ; +return ret; } ret =i2c_master_recv (ptn_bridge->client, buf, len); -if (ret != len) { +if (ret <0 ) {DRM_ERROR ("Failed to recv i2c data, ret=%d\n" , ret); -return ret <0 ? ret : -EIO ; +return ret; }return 0 ;
@@ -88,9 +88,9 @@ static int ptn3460_write_byte(struct ptn buf[1 ] = val; ret =i2c_master_send (ptn_bridge->client, buf,ARRAY_SIZE (buf)); -if (ret !=ARRAY_SIZE (buf)) { +if (ret <0 ) {DRM_ERROR ("Failed to send i2c command, ret=%d\n" , ret); -return ret <0 ? ret : -EIO ; +return ret; }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 44/202 drm/exynos: gsc: minor fix for loop iteration in gsc_runtime_resume
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
[ Upstream commit 4050957c7c2c14aa795dbf423b4180d5ac04e113 ]
Do not forget to call clk_disable_unprepare() on the first element of ctx->clocks array.
Found by Linux Verification Center (linuxtesting.org).
--- drivers/gpu/drm/exynos/exynos_drm_gsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_gsc.c +1 -1
@@ -1322,7 +1322,7 @@ static int __maybe_unused gsc_runtime_resume(struct device *dev)for (i =0 ; i < ctx->num_clocks; i++) { ret =clk_prepare_enable (ctx->clocks[i]);if (ret) { -while (--i >0 ) +while (--i >=0 )clk_disable_unprepare (ctx->clocks[i]);return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 45/202 gpio: eic-sprd: Clear interrupt after set the interrupt type
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wenhua Lin <[email protected]>
[ Upstream commit 84aef4ed59705585d629e81d633a83b7d416f5fb ]
The raw interrupt status of eic maybe set before the interrupt is enabled, since the eic interrupt has a latch function, which would trigger the interrupt event once enabled it from user side. To solve this problem, interrupts generated before setting the interrupt trigger type are ignored.
--- drivers/gpio/gpio-eic-sprd.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-)
drivers/gpio/gpio-eic-sprd.c +28 -4
@@ -318,20 +318,27 @@ static int sprd_eic_irq_set_type(struct irq_data *data, unsigned int flow_type)switch (flow_type) {case IRQ_TYPE_LEVEL_HIGH :sprd_eic_update (chip, offset,SPRD_EIC_DBNC_IEV ,1 ); +sprd_eic_update (chip, offset,SPRD_EIC_DBNC_IC ,1 );break ;case IRQ_TYPE_LEVEL_LOW :sprd_eic_update (chip, offset,SPRD_EIC_DBNC_IEV ,0 ); +sprd_eic_update (chip, offset,SPRD_EIC_DBNC_IC ,1 );break ;case IRQ_TYPE_EDGE_RISING :case IRQ_TYPE_EDGE_FALLING :case IRQ_TYPE_EDGE_BOTH : state =sprd_eic_get (chip, offset); -if (state) +if (state) {sprd_eic_update (chip, offset,SPRD_EIC_DBNC_IEV ,0 ); -else +sprd_eic_update (chip, offset, +SPRD_EIC_DBNC_IC ,1 ); + }else {sprd_eic_update (chip, offset,SPRD_EIC_DBNC_IEV ,1 ); +sprd_eic_update (chip, offset, +SPRD_EIC_DBNC_IC ,1 ); + }break ;default :return -ENOTSUPP ;
@@ -343,20 +350,27 @@ static int sprd_eic_irq_set_type(struct irq_data *data, unsigned int flow_type)switch (flow_type) {case IRQ_TYPE_LEVEL_HIGH :sprd_eic_update (chip, offset,SPRD_EIC_LATCH_INTPOL ,0 ); +sprd_eic_update (chip, offset,SPRD_EIC_LATCH_INTCLR ,1 );break ;case IRQ_TYPE_LEVEL_LOW :sprd_eic_update (chip, offset,SPRD_EIC_LATCH_INTPOL ,1 ); +sprd_eic_update (chip, offset,SPRD_EIC_LATCH_INTCLR ,1 );break ;case IRQ_TYPE_EDGE_RISING :case IRQ_TYPE_EDGE_FALLING :case IRQ_TYPE_EDGE_BOTH : state =sprd_eic_get (chip, offset); -if (state) +if (state) {sprd_eic_update (chip, offset,SPRD_EIC_LATCH_INTPOL ,0 ); -else +sprd_eic_update (chip, offset, +SPRD_EIC_LATCH_INTCLR ,1 ); + }else {sprd_eic_update (chip, offset,SPRD_EIC_LATCH_INTPOL ,1 ); +sprd_eic_update (chip, offset, +SPRD_EIC_LATCH_INTCLR ,1 ); + }break ;default :return -ENOTSUPP ;
@@ -370,29 +384,34 @@ static int sprd_eic_irq_set_type(struct irq_data *data, unsigned int flow_type)sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTBOTH ,0 );sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTMODE ,0 );sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTPOL ,1 ); +sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTCLR ,1 );irq_set_handler_locked (data, handle_edge_irq);break ;case IRQ_TYPE_EDGE_FALLING :sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTBOTH ,0 );sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTMODE ,0 );sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTPOL ,0 ); +sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTCLR ,1 );irq_set_handler_locked (data, handle_edge_irq);break ;case IRQ_TYPE_EDGE_BOTH :sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTMODE ,0 );sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTBOTH ,1 ); +sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTCLR ,1 );irq_set_handler_locked (data, handle_edge_irq);break ;case IRQ_TYPE_LEVEL_HIGH :sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTBOTH ,0 );sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTMODE ,1 );sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTPOL ,1 ); +sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTCLR ,1 );irq_set_handler_locked (data, handle_level_irq);break ;case IRQ_TYPE_LEVEL_LOW :sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTBOTH ,0 );sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTMODE ,1 );sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTPOL ,0 ); +sprd_eic_update (chip, offset,SPRD_EIC_ASYNC_INTCLR ,1 );irq_set_handler_locked (data, handle_level_irq);break ;default :
@@ -405,29 +424,34 @@ static int sprd_eic_irq_set_type(struct irq_data *data, unsigned int flow_type)sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTBOTH ,0 );sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTMODE ,0 );sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTPOL ,1 ); +sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTCLR ,1 );irq_set_handler_locked (data, handle_edge_irq);break ;case IRQ_TYPE_EDGE_FALLING :sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTBOTH ,0 );sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTMODE ,0 );sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTPOL ,0 ); +sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTCLR ,1 );irq_set_handler_locked (data, handle_edge_irq);break ;case IRQ_TYPE_EDGE_BOTH :sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTMODE ,0 );sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTBOTH ,1 ); +sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTCLR ,1 );irq_set_handler_locked (data, handle_edge_irq);break ;case IRQ_TYPE_LEVEL_HIGH :sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTBOTH ,0 );sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTMODE ,1 );sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTPOL ,1 ); +sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTCLR ,1 );irq_set_handler_locked (data, handle_level_irq);break ;case IRQ_TYPE_LEVEL_LOW :sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTBOTH ,0 );sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTMODE ,1 );sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTPOL ,0 ); +sprd_eic_update (chip, offset,SPRD_EIC_SYNC_INTCLR ,1 );irq_set_handler_locked (data, handle_level_irq);break ;default :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 46/202 mips: Call lose_fpu(0) before initializing fcr31 in mips_set_personality_nan
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xi Ruoyao <[email protected]>
commit 59be5c35850171e307ca5d3d703ee9ff4096b948 upstream.
If we still own the FPU after initializing fcr31, when we are preempted the dirty value in the FPU will be read out and stored into fcr31, clobbering our setting. This can cause an improper floating-point environment after execve(). For example:
zsh% cat measure.c
#include <fenv.h>
int main() { return fetestexcept(FE_INEXACT); } zsh% cc measure.c -o measure -lm
zsh% echo $((1.0/3)) # raising FE_INEXACT 0.33333333333333331
zsh% while ./measure; do ; done (stopped in seconds)
Call lose_fpu(0) before setting fcr31 to prevent this.
--- arch/mips/kernel/elf.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/mips/kernel/elf.c +6 -0
@@ -15,6 +15,7 @@#include <asm/cpu-features.h> #include <asm/cpu-info.h> +#include <asm/fpu.h> /* Whether to accept legacy-NaN and 2008-NaN user binaries. */ bool mips_use_nan_legacy;
@@ -311,6 +312,11 @@ void mips_set_personality_nan(struct arcstruct cpuinfo_mips *c = &boot_cpu_data;struct task_struct *t = current; +/* Do this early so t->thread.fpu.fcr31 won't be clobbered in case +* we are preempted before the lose_fpu(0) in start_thread. +*/ +lose_fpu (0 ); + t->thread.fpu.fcr31 = c->fpu_csr31;switch (state->nan_2008) {case 0 :
Greg Kroah-Hartman
maintainerPATCH 47/202 tick/sched: Preserve number of idle sleeps across CPU hotplug events
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Chen <[email protected]>
commit 9a574ea9069be30b835a3da772c039993c43369b upstream.
Commit 71fee48f ("tick-sched: Fix idle and iowait sleeptime accounting vs CPU hotplug") preserved total idle sleep time and iowait sleeptime across CPU hotplug events.
Similar reasoning applies to the number of idle calls and idle sleeps to get the proper average of sleep time per idle invocation.
Preserve those fields too.
--- kernel/time/tick-sched.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/time/tick-sched.c +5 -0
@@ -1346,6 +1346,7 @@ void tick_cancel_sched_timer(int cpu) {struct tick_sched *ts = &per_cpu (tick_cpu_sched, cpu);ktime_t idle_sleeptime, iowait_sleeptime; +unsigned long idle_calls, idle_sleeps;# ifdef CONFIG_HIGH_RES_TIMERS if (ts->sched_timer.base)
@@ -1354,9 +1355,13 @@ void tick_cancel_sched_timer(int cpu) idle_sleeptime = ts->idle_sleeptime; iowait_sleeptime = ts->iowait_sleeptime; + idle_calls = ts->idle_calls; + idle_sleeps = ts->idle_sleeps;memset (ts,0 ,sizeof (*ts)); ts->idle_sleeptime = idle_sleeptime; ts->iowait_sleeptime = iowait_sleeptime; + ts->idle_calls = idle_calls; + ts->idle_sleeps = idle_sleeps; }#endif
Greg Kroah-Hartman
maintainerPATCH 48/202 x86/entry/ia32: Ensure s32 is sign extended to s64
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Palethorpe <[email protected]>
commit 56062d60f117dccfb5281869e0ab61e090baf864 upstream.
Presently ia32 registers stored in ptregs are unconditionally cast to unsigned int by the ia32 stub. They are then cast to long when passed to __se_sys*, but will not be sign extended.
This takes the sign of the syscall argument into account in the ia32 stub. It still casts to unsigned int to avoid implementation specific behavior. However then casts to int or unsigned int as necessary. So that the following cast to long sign extends the value.
This fixes the io_pgetevents02 LTP test when compiled with -m32. Presently the systemcall io_pgetevents_time64() unexpectedly accepts -1 for the maximum number of events.
It doesn't appear other systemcalls with signed arguments are effected because they all have compat variants defined and wired up.
--- arch/x86/include/asm/syscall_wrapper.h | 25 +++++++++++++++++++++---- include/linux/syscalls.h | 1 + 2 files changed, 22 insertions(+), 4 deletions(-)
arch/x86/include/asm/syscall_wrapper.h +21 -4
@@ -12,12 +12,29 @@ ,,regs->di,,regs->si,,regs->dx \ ,,regs->r10,,regs->r8,,regs->r9) \ + +/* SYSCALL_PT_ARGS is Adapted from s390x */ +#define SYSCALL_PT_ARG6 (m, t1, t2, t3, t4, t5, t6) \ + SYSCALL_PT_ARG5(m, t1, t2, t3, t4, t5), m(t6, (regs->bp)) +#define SYSCALL_PT_ARG5 (m, t1, t2, t3, t4, t5) \ + SYSCALL_PT_ARG4(m, t1, t2, t3, t4), m(t5, (regs->di)) +#define SYSCALL_PT_ARG4 (m, t1, t2, t3, t4) \ + SYSCALL_PT_ARG3(m, t1, t2, t3), m(t4, (regs->si)) +#define SYSCALL_PT_ARG3 (m, t1, t2, t3) \ + SYSCALL_PT_ARG2(m, t1, t2), m(t3, (regs->dx)) +#define SYSCALL_PT_ARG2 (m, t1, t2) \ + SYSCALL_PT_ARG1(m, t1), m(t2, (regs->cx)) +#define SYSCALL_PT_ARG1 (m, t1) m(t1, (regs->bx)) +#define SYSCALL_PT_ARGS (x, ...) SYSCALL_PT_ARG##x(__VA_ARGS__) + +#define __SC_COMPAT_CAST (t, a) \ + (__typeof(__builtin_choose_expr(__TYPE_IS_L(t), 0, 0U))) \ + (unsigned int)a +/* Mapping of registers to parameters for syscalls on i386 */ #define SC_IA32_REGS_TO_ARGS (x, ...) \ - __MAP(x,__SC_ARGS \ - ,,(unsigned int)regs->bx,,(unsigned int)regs->cx \ - ,,(unsigned int)regs->dx,,(unsigned int)regs->si \ - ,,(unsigned int)regs->di,,(unsigned int)regs->bp) + SYSCALL_PT_ARGS(x, __SC_COMPAT_CAST, \ + __MAP(x, __SC_TYPE, __VA_ARGS__)) \#ifdef CONFIG_IA32_EMULATION /*
include/linux/syscalls.h +1 -0
@@ -120,6 +120,7 @@ union bpf_attr;#define __TYPE_IS_LL (t) (__TYPE_AS(t, 0LL) || __TYPE_AS(t, 0ULL))#define __SC_LONG (t, a) __typeof(__builtin_choose_expr(__TYPE_IS_LL(t), 0LL, 0L)) a#define __SC_CAST (t, a) (__force t) a +#define __SC_TYPE (t, a) t#define __SC_ARGS (t, a) a#define __SC_TEST (t, a) (void)BUILD_BUG_ON_ZERO(!__TYPE_IS_LL(t) && sizeof(t) > sizeof(long))
Greg Kroah-Hartman
maintainerPATCH 49/202 net/sched: cbs: Fix not adding cbs instance to list
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinicius Costa Gomes <[email protected]>
commit 3e8b9bfa110896f95d602d8c98d5f9d67e41d78c upstream.
When removing a cbs instance when offloading is enabled, the crash below can be observed.
The problem happens because that when offloading is enabled, the cbs instance is not added to the list.
Also, the current code doesn't handle correctly the case when offload is disabled without removing the qdisc: if the link speed changes the credit calculations will be wrong. When we create the cbs instance with offloading enabled, it's not added to the notification list, when later we disable offloading, it's not in the list, so link speed changes will not affect it.
The solution for both issues is the same, add the cbs instance being created unconditionally to the global list, even if the link state notification isn't useful "right now".
Crash log:
[518758.189866] BUG: kernel NULL pointer dereference, address: 0000000000000000 [518758.189870] #PF: supervisor read access in kernel mode [518758.189871] #PF: error_code(0x0000) - not-present page [518758.189872] PGD 0 P4D 0 [518758.189874] Oops: 0000 [#1] SMP PTI [518758.189876] CPU: 3 PID: 4825 Comm: tc Not tainted 5.2.9 #1 [518758.189877] Hardware name: Gigabyte Technology Co., Ltd. Z390 AORUS ULTRA/Z390 AORUS ULTRA-CF, BIOS F7 03/14/2019 [518758.189881] RIP: 0010:__list_del_entry_valid+0x29/0xa0 [518758.189883] Code: 90 48 b8 00 01 00 00 00 00 ad de 55 48 8b 17 4c 8b 47 08 48 89 e5 48 39 c2 74 27 48 b8 00 02 00 00 00 00 ad de 49 39 c0 74 2d <49> 8b 30 48 39 fe 75 3d 48 8b 52 08 48 39 f2 75 4c b8 01 00 00 00 [518758.189885] RSP: 0018:ffffa27e43903990 EFLAGS: 00010207 [518758.189887] RAX: dead000000000200 RBX: ffff8bce69f0f000 RCX: 0000000000000000 [518758.189888] RDX: 0000000000000000 RSI: ffff8bce69f0f064 RDI: ffff8bce69f0f1e0 [518758.189890] RBP: ffffa27e43903990 R08: 0000000000000000 R09: ffff8bce69e788c0 [518758.189891] R10: ffff8bce62acd400 R11: 00000000000003cb R12: ffff8bce69e78000 [518758.189892] R13: ffff8bce69f0f140 R14: 0000000000000000 R15: 0000000000000000 [518758.189894] FS: 00007fa1572c8f80(0000) GS:ffff8bce6e0c0000(0000) knlGS:0000000000000000 [518758.189895] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [518758.189896] CR2: 0000000000000000 CR3: 000000040a398006 CR4: 00000000003606e0 [518758.189898] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [518758.189899] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [518758.189900] Call Trace: [518758.189904] cbs_destroy+0x32/0xa0 [sch_cbs] [518758.189906] qdisc_destroy+0x45/0x120 [518758.189907] qdisc_put+0x25/0x30 [518758.189908] qdisc_graft+0x2c1/0x450 [518758.189910] tc_get_qdisc+0x1c8/0x310 [518758.189912] ? get_page_from_freelist+0x91a/0xcb0 [518758.189914] rtnetlink_rcv_msg+0x293/0x360 [518758.189916] ? kmem_cache_alloc_node_trace+0x178/0x260 [518758.189918] ? __kmalloc_node_track_caller+0x38/0x50 [518758.189920] ? rtnl_calcit.isra.0+0xf0/0xf0 [518758.189922] netlink_rcv_skb+0x48/0x110 [518758.189923] rtnetlink_rcv+0x10/0x20 [518758.189925] netlink_unicast+0x15b/0x1d0 [518758.189926] netlink_sendmsg+0x1ea/0x380 [518758.189929] sock_sendmsg+0x2f/0x40 [518758.189930] ___sys_sendmsg+0x295/0x2f0 [518758.189932] ? ___sys_recvmsg+0x151/0x1e0 [518758.189933] ? do_wp_page+0x7e/0x450 [518758.189935] __sys_sendmsg+0x48/0x80 [518758.189937] __x64_sys_sendmsg+0x1a/0x20 [518758.189939] do_syscall_64+0x53/0x1f0 [518758.189941] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [518758.189942] RIP: 0033:0x7fa15755169a [518758.189944] Code: 48 c7 c0 ff ff ff ff eb be 0f 1f 80 00 00 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 18 b8 2e 00 00 00 c5 fc 77 0f 05 <48> 3d 00 f0 ff ff 77 5e c3 0f 1f 44 00 00 48 83 ec 28 89 54 24 1c [518758.189946] RSP: 002b:00007ffda58b60b8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e [518758.189948] RAX: ffffffffffffffda RBX: 000055e4b836d9a0 RCX: 00007fa15755169a [518758.189949] RDX: 0000000000000000 RSI: 00007ffda58b6128 RDI: 0000000000000003 [518758.189951] RBP: 00007ffda58b6190 R08: 0000000000000001 R09: 000055e4b9d848a0 [518758.189952] R10: 0000000000000000 R11: 0000000000000246 R12: 000000005d654b49 [518758.189953] R13: 0000000000000000 R14: 00007ffda58b6230 R15: 00007ffda58b6210 [518758.189955] Modules linked in: sch_cbs sch_etf sch_mqprio netlink_diag unix_diag e1000e igb intel_pch_thermal thermal video backlight pcc_cpufreq [518758.189960] CR2: 0000000000000000 [518758.189961] ---[ end trace 6a13f7aaf5376019 ]--- [518758.189963] RIP: 0010:__list_del_entry_valid+0x29/0xa0 [518758.189964] Code: 90 48 b8 00 01 00 00 00 00 ad de 55 48 8b 17 4c 8b 47 08 48 89 e5 48 39 c2 74 27 48 b8 00 02 00 00 00 00 ad de 49 39 c0 74 2d <49> 8b 30 48 39 fe 75 3d 48 8b 52 08 48 39 f2 75 4c b8 01 00 00 00 [518758.189967] RSP: 0018:ffffa27e43903990 EFLAGS: 00010207 [518758.189968] RAX: dead000000000200 RBX: ffff8bce69f0f000 RCX: 0000000000000000 [518758.189969] RDX: 0000000000000000 RSI: ffff8bce69f0f064 RDI: ffff8bce69f0f1e0 [518758.189971] RBP: ffffa27e43903990 R08: 0000000000000000 R09: ffff8bce69e788c0 [518758.189972] R10: ffff8bce62acd400 R11: 00000000000003cb R12: ffff8bce69e78000 [518758.189973] R13: ffff8bce69f0f140 R14: 0000000000000000 R15: 0000000000000000 [518758.189975] FS: 00007fa1572c8f80(0000) GS:ffff8bce6e0c0000(0000) knlGS:0000000000000000 [518758.189976] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [518758.189977] CR2: 0000000000000000 CR3: 000000040a398006 CR4: 00000000003606e0 [518758.189979] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [518758.189980] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
--- net/sched/sch_cbs.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)
net/sched/sch_cbs.c +13 -17
@@ -405,7 +405,6 @@ static int cbs_init(struct Qdisc *sch, s {struct cbs_sched_data *q =qdisc_priv (sch);struct net_device *dev =qdisc_dev (sch); -int err;if (!opt) {NL_SET_ERR_MSG (extack,"Missing CBS qdisc options which are mandatory" );
@@ -417,6 +416,10 @@ static int cbs_init(struct Qdisc *sch, sif (!q->qdisc)return -ENOMEM ; +spin_lock (&cbs_list_lock); +list_add (&q->cbs_list, &cbs_list); +spin_unlock (&cbs_list_lock); +qdisc_hash_add (q->qdisc, false); q->queue = sch->dev_queue -netdev_get_tx_queue (dev,0 );
@@ -426,17 +429,7 @@ static int cbs_init(struct Qdisc *sch, sqdisc_watchdog_init (&q->watchdog, sch); - err =cbs_change (sch, opt, extack); -if (err) -return err; - -if (!q->offload) { -spin_lock (&cbs_list_lock); -list_add (&q->cbs_list, &cbs_list); -spin_unlock (&cbs_list_lock); - } - -return 0 ; +return cbs_change (sch, opt, extack); }static void cbs_destroy (struct Qdisc *sch)
@@ -444,15 +437,18 @@ static void cbs_destroy(struct Qdisc *scstruct cbs_sched_data *q =qdisc_priv (sch);struct net_device *dev =qdisc_dev (sch); -spin_lock (&cbs_list_lock); -list_del (&q->cbs_list); -spin_unlock (&cbs_list_lock); +/* Nothing to do if we couldn't create the underlying qdisc */ +if (!q->qdisc) +return ;qdisc_watchdog_cancel (&q->watchdog);cbs_disable_offload (dev, q); -if (q->qdisc) -qdisc_put (q->qdisc); +spin_lock (&cbs_list_lock); +list_del (&q->cbs_list); +spin_unlock (&cbs_list_lock); + +qdisc_put (q->qdisc); }static int cbs_dump (struct Qdisc *sch,struct sk_buff *skb)
Greg Kroah-Hartman
maintainerPATCH 50/202 powerpc/mm: Fix null-pointer dereference in pgtable_cache_add
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kunwu Chan <[email protected]>
[ Upstream commit f46c8a75263f97bda13c739ba1c90aced0d3b071 ]
kasprintf() returns a pointer to dynamically allocated memory which can be NULL upon failure. Ensure the allocation was successful by checking the pointer validity.
--- arch/powerpc/mm/init-common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/mm/init-common.c +3 -2
@@ -65,7 +65,7 @@ void pgtable_cache_add(unsigned shift, void (*ctor)(void *))* as to leave enough 0 bits in the address to contain it. */ unsigned long minalign =max (MAX_PGTABLE_INDEX_SIZE +1 ,HUGEPD_SHIFT_MASK +1 ); -struct kmem_cache *new; +struct kmem_cache *new =NULL ;/* It would be nice if this was a BUILD_BUG_ON(), but at the * moment, gcc doesn't seem to recognize is_power_of_2 as a
@@ -78,7 +78,8 @@ void pgtable_cache_add(unsigned shift, void (*ctor)(void *)) align = max_t(unsigned long, align, minalign); name =kasprintf (GFP_KERNEL ,"pgtable-2^%d" , shift); - new =kmem_cache_create (name, table_size, align,0 , ctor); +if (name) + new =kmem_cache_create (name, table_size, align,0 , ctor);if (!new)panic ("Could not allocate pgtable cache for order %d" , shift);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 51/202 powerpc: Fix build error due to is_valid_bugaddr()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit f8d3555355653848082c351fa90775214fb8a4fa ]
With CONFIG_GENERIC_BUG=n the build fails with:
arch/powerpc/kernel/traps.c:1442:5: error: no previous prototype for ‘is_valid_bugaddr’ [-Werror=missing-prototypes] 1442 | int is_valid_bugaddr(unsigned long addr)
| ^~~~~~~~~~~~~~~~
The prototype is only defined, and the function is only needed, when CONFIG_GENERIC_BUG=y, so move the implementation under that.
--- arch/powerpc/kernel/traps.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/kernel/traps.c +2 -0
@@ -1341,10 +1341,12 @@ static int emulate_instruction(struct pt_regs *regs)return -EINVAL ; } +#ifdef CONFIG_GENERIC_BUG int is_valid_bugaddr (unsigned long addr) {return is_kernel_addr (addr); } +#endif #ifdef CONFIG_MATH_EMULATION static int emulate_math (struct pt_regs *regs)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 52/202 powerpc/mm: Fix build failures due to arch_reserved_kernel_pages()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit d8c3f243d4db24675b653f0568bb65dae34e6455 ]
With NUMA=n and FA_DUMP=y or PRESERVE_FA_DUMP=y the build fails with:
arch/powerpc/kernel/fadump.c:1739:22: error: no previous prototype for ‘arch_reserved_kernel_pages’ [-Werror=missing-prototypes] 1739 | unsigned long __init arch_reserved_kernel_pages(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
The prototype for arch_reserved_kernel_pages() is in include/linux/mm.h, but it's guarded by __HAVE_ARCH_RESERVED_KERNEL_PAGES. The powerpc headers define __HAVE_ARCH_RESERVED_KERNEL_PAGES in asm/mmzone.h, which is not included into the generic headers when NUMA=n.
Move the definition of __HAVE_ARCH_RESERVED_KERNEL_PAGES into asm/mmu.h which is included regardless of NUMA=n.
Additionally the ifdef around __HAVE_ARCH_RESERVED_KERNEL_PAGES needs to also check for CONFIG_PRESERVE_FA_DUMP.
--- arch/powerpc/include/asm/mmu.h | 4 ++++ arch/powerpc/include/asm/mmzone.h | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-)
arch/powerpc/include/asm/mmu.h +4 -0
@@ -330,5 +330,9 @@ static inline void mmu_early_init_devtree(void) { }#include <asm/nohash/mmu.h> #endif +#if defined(CONFIG_FA_DUMP ) || defined(CONFIG_PRESERVE_FA_DUMP ) +#define __HAVE_ARCH_RESERVED_KERNEL_PAGES +#endif +#endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_MMU_H_ */
arch/powerpc/include/asm/mmzone.h +0 -3
@@ -42,9 +42,6 @@ u64 memory_hotplug_max(void);#else #define memory_hotplug_max () memblock_end_of_DRAM()#endif /* CONFIG_NEED_MULTIPLE_NODES */ -#ifdef CONFIG_FA_DUMP -#define __HAVE_ARCH_RESERVED_KERNEL_PAGES -#endif #endif /* __KERNEL__ */ #endif /* _ASM_MMZONE_H_ */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 53/202 powerpc/lib: Validate size for vector operations
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naveen N Rao <[email protected]>
[ Upstream commit 8f9abaa6d7de0a70fc68acaedce290c1f96e2e59 ]
Some of the fp/vmx code in sstep.c assume a certain maximum size for the instructions being emulated. The size of those operations however is determined separately in analyse_instr().
Add a check to validate the assumption on the maximum size of the operations, so as to prevent any unintended kernel stack corruption.
--- arch/powerpc/lib/sstep.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/powerpc/lib/sstep.c +10 -0
@@ -473,6 +473,8 @@ static int do_fp_load(struct instruction_op *op, unsigned long ea, } u; nb =GETSIZE (op->type); +if (nb >sizeof (u)) +return -EINVAL ;if (!address_ok (regs, ea, nb))return -EFAULT ; rn = op->reg;
@@ -523,6 +525,8 @@ static int do_fp_store(struct instruction_op *op, unsigned long ea, } u; nb =GETSIZE (op->type); +if (nb >sizeof (u)) +return -EINVAL ;if (!address_ok (regs, ea, nb))return -EFAULT ; rn = op->reg;
@@ -567,6 +571,9 @@ static nokprobe_inline int do_vec_load(int rn, unsigned long ea,u8 b[sizeof (__vector128)]; } u = {}; +if (size >sizeof (u)) +return -EINVAL ; +if (!address_ok (regs, ea & ~0xfUL ,16 ))return -EFAULT ;/* align to multiple of size */
@@ -594,6 +601,9 @@ static nokprobe_inline int do_vec_store(int rn, unsigned long ea,u8 b[sizeof (__vector128)]; } u; +if (size >sizeof (u)) +return -EINVAL ; +if (!address_ok (regs, ea & ~0xfUL ,16 ))return -EFAULT ;/* align to multiple of size */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 54/202 audit: Send netlink ACK before setting connection in auditd_set
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Riches <[email protected]>
[ Upstream commit 022732e3d846e197539712e51ecada90ded0572a ]
When auditd_set sets the auditd_conn pointer, audit messages can immediately be put on the socket by other kernel threads. If the backlog is large or the rate is high, this can immediately fill the socket buffer. If the audit daemon requested an ACK for this operation, a full socket buffer causes the ACK to get dropped, also setting ENOBUFS on the socket.
To avoid this race and ensure ACKs get through, fast-track the ACK in this specific case to ensure it is sent before auditd_conn is set.
--- kernel/audit.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-)
kernel/audit.c +24 -7
@@ -498,15 +498,19 @@ static void auditd_conn_free(struct rcu_head *rcu)* @pid: auditd PID * @portid: auditd netlink portid * @net: auditd network namespace pointer +* @skb: the netlink command from the audit daemon +* @ack: netlink ack flag, cleared if ack'd here * * Description: * This function will obtain and drop network namespace references as * necessary. Returns zero on success, negative values on failure. */ -static int auditd_set (struct pid *pid,u32 portid,struct net *net) +static int auditd_set (struct pid *pid,u32 portid,struct net *net, +struct sk_buff *skb,bool *ack) {unsigned long flags;struct auditd_connection *ac_old, *ac_new; +struct nlmsghdr *nlh;if (!pid || !net)return -EINVAL ;
@@ -518,6 +522,13 @@ static int auditd_set(struct pid *pid, u32 portid, struct net *net) ac_new->portid = portid; ac_new->net =get_net (net); +/* send the ack now to avoid a race with the queue backlog */ +if (*ack) { + nlh =nlmsg_hdr (skb); +netlink_ack (skb, nlh,0 ,NULL ); + *ack = false; + } +spin_lock_irqsave (&auditd_conn_lock, flags); ac_old =rcu_dereference_protected (auditd_conn,lockdep_is_held (&auditd_conn_lock));
@@ -1204,7 +1215,8 @@ static int audit_replace(struct pid *pid)return auditd_send_unicast_skb (skb); } -static int audit_receive_msg (struct sk_buff *skb,struct nlmsghdr *nlh) +static int audit_receive_msg (struct sk_buff *skb,struct nlmsghdr *nlh, +bool *ack) {u32 seq;void *data;
@@ -1296,7 +1308,8 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)/* register a new auditd connection */ err =auditd_set (req_pid,NETLINK_CB (skb).portid, -sock_net (NETLINK_CB (skb).sk)); +sock_net (NETLINK_CB (skb).sk), + skb, ack);if (audit_enabled !=AUDIT_OFF ) audit_log_config_change("audit_pid", new_pid,
@@ -1529,9 +1542,10 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)* Parse the provided skb and deal with any messages that may be present, * malformed skbs are discarded. */ -static void audit_receive (struct sk_buff *skb) +static void audit_receive (struct sk_buff *skb) {struct nlmsghdr *nlh; +bool ack;/* * len MUST be signed for nlmsg_next to be able to dec it below 0 * if the nlmsg_len was not aligned
@@ -1544,9 +1558,12 @@ static void audit_receive(struct sk_buff *skb)audit_ctl_lock ();while (nlmsg_ok (nlh, len)) { - err =audit_receive_msg (skb, nlh); -/* if err or if this message says it wants a response */ -if (err || (nlh->nlmsg_flags &NLM_F_ACK )) + ack = nlh->nlmsg_flags &NLM_F_ACK ; + err =audit_receive_msg (skb, nlh, &ack); + +/* send an ack if the user asked for one and audit_receive_msg +* didn't already do it, or if there was an error. */ +if (ack || err)netlink_ack (skb, nlh, err,NULL ); nlh =nlmsg_next (nlh, &len);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 55/202 ACPI: video: Add quirk for the Colorful X15 AT 23 Laptop
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuluo Qiu <[email protected]>
[ Upstream commit 143176a46bdd3bfbe9ba2462bf94458e80d65ebf ]
The Colorful X15 AT 23 ACPI video-bus device report spurious ACPI_VIDEO_NOTIFY_CYCLE events resulting in spurious KEY_SWITCHVIDEOMODE events being reported to userspace (and causing trouble there) when an external screen plugged in.
Add a quirk setting the report_key_events mask to REPORT_BRIGHTNESS_KEY_EVENTS so that the ACPI_VIDEO_NOTIFY_CYCLE events will be ignored, while still reporting brightness up/down hotkey-presses to userspace normally.
--- drivers/acpi/acpi_video.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/acpi/acpi_video.c +9 -0
@@ -581,6 +581,15 @@ static const struct dmi_system_id video_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3350"), }, }, + { + .callback = video_set_report_key_events, + .driver_data = (void *)((uintptr_t)REPORT_BRIGHTNESS_KEY_EVENTS), + .ident = "COLORFUL X15 AT 23", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "COLORFUL"), + DMI_MATCH(DMI_PRODUCT_NAME, "X15 AT 23"), + }, + },/* * Some machines change the brightness themselves when a brightness * hotkey gets pressed, despite us telling them not to. In this case
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 56/202 PNP: ACPI: fix fortify warning
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit ba3f5058db437d919f8468db50483dd9028ff688 ]
When compiling with gcc version 14.0.0 20231126 (experimental) and CONFIG_FORTIFY_SOURCE=y, I've noticed the following:
In file included from ./include/linux/string.h:295,
from ./include/linux/bitmap.h:12,
from ./include/linux/cpumask.h:12,
from ./arch/x86/include/asm/paravirt.h:17,
from ./arch/x86/include/asm/cpuid.h:62,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:60,
from ./arch/x86/include/asm/preempt.h:9,
from ./include/linux/preempt.h:79,
from ./include/linux/spinlock.h:56,
from ./include/linux/mmzone.h:8,
from ./include/linux/gfp.h:7,
from ./include/linux/slab.h:16,
from ./include/linux/resource_ext.h:11,
from ./include/linux/acpi.h:13,
from drivers/pnp/pnpacpi/rsparser.c:11:In function 'fortify_memcpy_chk',
inlined from 'pnpacpi_parse_allocated_vendor' at drivers/pnp/pnpacpi/rsparser.c:158:3, inlined from 'pnpacpi_allocated_resource' at drivers/pnp/pnpacpi/rsparser.c:249:3:./include/linux/fortify-string.h:588:25: warning: call to '__read_overflow2_field' declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Wattribute-warning]
588 | __read_overflow2_field(q_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~According to the comments in include/linux/fortify-string.h, 'memcpy()', 'memmove()' and 'memset()' must not be used beyond individual struct members to ensure that the compiler can enforce protection against buffer overflows, and, IIUC, this also applies to partial copies from the particular member ('vendor->byte_data' in this case). So it should be better (and safer) to do both copies at once (and 'byte_data' of 'struct acpi_resource_vendor_typed' seems to be a good candidate for '__counted_by(byte_length)' as well).
--- drivers/pnp/pnpacpi/rsparser.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/pnp/pnpacpi/rsparser.c +6 -6
@@ -160,13 +160,13 @@ static int vendor_resource_matches(struct pnp_dev *dev,static void pnpacpi_parse_allocated_vendor (struct pnp_dev *dev,struct acpi_resource_vendor_typed *vendor) { -if (vendor_resource_matches (dev, vendor, &hp_ccsr_uuid,16 )) { -u64 start, length; +struct {u64 start, length; } range; -memcpy (&start, vendor->byte_data,sizeof (start)); -memcpy (&length, vendor->byte_data +8 ,sizeof (length)); - -pnp_add_mem_resource (dev, start, start + length -1 ,0 ); +if (vendor_resource_matches (dev, vendor, &hp_ccsr_uuid, +sizeof (range))) { +memcpy (&range, vendor->byte_data,sizeof (range)); +pnp_add_mem_resource (dev, range.start, range.start + + range.length -1 ,0 ); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 57/202 ACPI: extlog: fix NULL pointer dereference check
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prarit Bhargava <[email protected]>
[ Upstream commit 72d9b9747e78979510e9aafdd32eb99c7aa30dd1 ]
The gcc plugin -fanalyzer [1] tries to detect various patterns of incorrect behaviour. The tool reports:
drivers/acpi/acpi_extlog.c: In function ‘extlog_exit’:drivers/acpi/acpi_extlog.c:307:12: warning: check of ‘extlog_l1_addr’ for NULL after already dereferencing it [-Wanalyzer-deref-before-check]
|
| 306 | ((struct extlog_l1_head *)extlog_l1_addr)->flags &= ~FLAG_OS_OPTIN;
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
| | |
| | (1) pointer ‘extlog_l1_addr’ is dereferenced here
| 307 | if (extlog_l1_addr)
| | ~
| | |
| | (2) pointer ‘extlog_l1_addr’ is checked for NULL here but it was already dereferenced at (1)
|Fix the NULL pointer dereference check in extlog_exit().
--- drivers/acpi/acpi_extlog.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/acpi/acpi_extlog.c +3 -2
@@ -317,9 +317,10 @@ static void __exit extlog_exit(void) {edac_set_report_status (old_edac_report_status);mce_unregister_decode_chain (&extlog_mce_dec); - ((struct extlog_l1_head *)extlog_l1_addr)->flags &= ~FLAG_OS_OPTIN ; -if (extlog_l1_addr) +if (extlog_l1_addr) { + ((struct extlog_l1_head *)extlog_l1_addr)->flags &= ~FLAG_OS_OPTIN ;acpi_os_unmap_iomem (extlog_l1_addr, l1_size); + }if (elog_addr)acpi_os_unmap_iomem (elog_addr, elog_size);release_mem_region (elog_base, elog_size);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 58/202 FS:JFS:UBSAN:array-index-out-of-bounds in dbAdjTree
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Osama Muhammad <[email protected]>
[ Upstream commit 9862ec7ac1cbc6eb5ee4a045b5d5b8edbb2f7e68 ]
Syzkaller reported the following issue:
UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dmap.c:2867:6 index 196694 is out of range for type 's8[1365]' (aka 'signed char[1365]') CPU: 1 PID: 109 Comm: jfsCommit Not tainted 6.6.0-rc3-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 ubsan_epilogue lib/ubsan.c:217 [inline] __ubsan_handle_out_of_bounds+0x11c/0x150 lib/ubsan.c:348 dbAdjTree+0x474/0x4f0 fs/jfs/jfs_dmap.c:2867 dbJoin+0x210/0x2d0 fs/jfs/jfs_dmap.c:2834 dbFreeBits+0x4eb/0xda0 fs/jfs/jfs_dmap.c:2331 dbFreeDmap fs/jfs/jfs_dmap.c:2080 [inline] dbFree+0x343/0x650 fs/jfs/jfs_dmap.c:402 txFreeMap+0x798/0xd50 fs/jfs/jfs_txnmgr.c:2534 txUpdateMap+0x342/0x9e0 txLazyCommit fs/jfs/jfs_txnmgr.c:2664 [inline] jfs_lazycommit+0x47a/0xb70 fs/jfs/jfs_txnmgr.c:2732 kthread+0x2d3/0x370 kernel/kthread.c:388 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 </TASK> ================================================================================ Kernel panic - not syncing: UBSAN: panic_on_warn set ... CPU: 1 PID: 109 Comm: jfsCommit Not tainted 6.6.0-rc3-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 panic+0x30f/0x770 kernel/panic.c:340 check_panic_on_warn+0x82/0xa0 kernel/panic.c:236 ubsan_epilogue lib/ubsan.c:223 [inline] __ubsan_handle_out_of_bounds+0x13c/0x150 lib/ubsan.c:348 dbAdjTree+0x474/0x4f0 fs/jfs/jfs_dmap.c:2867 dbJoin+0x210/0x2d0 fs/jfs/jfs_dmap.c:2834 dbFreeBits+0x4eb/0xda0 fs/jfs/jfs_dmap.c:2331 dbFreeDmap fs/jfs/jfs_dmap.c:2080 [inline] dbFree+0x343/0x650 fs/jfs/jfs_dmap.c:402 txFreeMap+0x798/0xd50 fs/jfs/jfs_txnmgr.c:2534 txUpdateMap+0x342/0x9e0 txLazyCommit fs/jfs/jfs_txnmgr.c:2664 [inline] jfs_lazycommit+0x47a/0xb70 fs/jfs/jfs_txnmgr.c:2732 kthread+0x2d3/0x370 kernel/kthread.c:388 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 </TASK>
Kernel Offset: disabled
Rebooting in 86400 seconds..
The issue is caused when the value of lp becomes greater than CTLTREESIZE which is the max size of stree. Adding a simple check solves this issue.
Dave:
As the function returns a void, good error handling would require a more intrusive code reorganization, so I modified Osama's patch at use WARN_ON_ONCE for lack of a cleaner option.
The patch is tested via syzbot.
--- fs/jfs/jfs_dmap.c | 3 +++ 1 file changed, 3 insertions(+)
fs/jfs/jfs_dmap.c +3 -0
@@ -2948,6 +2948,9 @@ static void dbAdjTree(dmtree_t * tp, int leafno, int newval)/* is the current value the same as the old value ? if so, * there is nothing to do. */ +if (WARN_ON_ONCE (lp >=CTLTREESIZE )) +return ; +if (tp->dmt_stree[lp] == newval)return ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 59/202 UBSAN: array-index-out-of-bounds in dtSplitRoot
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Osama Muhammad <[email protected]>
[ Upstream commit 27e56f59bab5ddafbcfe69ad7a4a6ea1279c1b16 ]
Syzkaller reported the following issue:
oop0: detected capacity change from 0 to 32768
UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dtree.c:1971:9 index -2 is out of range for type 'struct dtslot [128]' CPU: 0 PID: 3613 Comm: syz-executor270 Not tainted 6.0.0-syzkaller-09423-g493ffd6605b2 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1b1/0x28e lib/dump_stack.c:106 ubsan_epilogue lib/ubsan.c:151 [inline] __ubsan_handle_out_of_bounds+0xdb/0x130 lib/ubsan.c:283 dtSplitRoot+0x8d8/0x1900 fs/jfs/jfs_dtree.c:1971 dtSplitUp fs/jfs/jfs_dtree.c:985 [inline] dtInsert+0x1189/0x6b80 fs/jfs/jfs_dtree.c:863 jfs_mkdir+0x757/0xb00 fs/jfs/namei.c:270 vfs_mkdir+0x3b3/0x590 fs/namei.c:4013 do_mkdirat+0x279/0x550 fs/namei.c:4038 __do_sys_mkdirat fs/namei.c:4053 [inline] __se_sys_mkdirat fs/namei.c:4051 [inline] __x64_sys_mkdirat+0x85/0x90 fs/namei.c:4051 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fcdc0113fd9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffeb8bc67d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000102 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fcdc0113fd9 RDX: 0000000000000000 RSI: 0000000020000340 RDI: 0000000000000003 RBP: 00007fcdc00d37a0 R08: 0000000000000000 R09: 00007fcdc00d37a0 R10: 00005555559a72c0 R11: 0000000000000246 R12: 00000000f8008000 R13: 0000000000000000 R14: 00083878000000f8 R15: 0000000000000000 </TASK>
The issue is caused when the value of fsi becomes less than -1. The check to break the loop when fsi value becomes -1 is present but syzbot was able to produce value less than -1 which cause the error. This patch simply add the change for the values less than 0.
The patch is tested via syzbot.
--- fs/jfs/jfs_dtree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jfs/jfs_dtree.c +1 -1
@@ -1983,7 +1983,7 @@ static int dtSplitRoot(tid_t tid,do { f = &rp->slot[fsi]; fsi = f->next; - }while (fsi !=-1 ); + }while (fsi >=0 ); f->next = n; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 60/202 jfs: fix slab-out-of-bounds Read in dtSearch
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manas Ghandat <[email protected]>
[ Upstream commit fa5492ee89463a7590a1449358002ff7ef63529f ]
Currently while searching for current page in the sorted entry table of the page there is a out of bound access. Added a bound check to fix the error.
Dave:
Set return code to -EIO
--- fs/jfs/jfs_dtree.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/jfs/jfs_dtree.c +5 -0
@@ -646,6 +646,11 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data,for (base =0 , lim = p->header.nextindex; lim; lim >>=1 ) { index = base + (lim >>1 ); +if (stbl[index] <0 ) { + rc = -EIO ; + goto out; + } +if (p->header.flag &BT_LEAF ) {/* uppercase leaf name to compare */ cmp =
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 61/202 jfs: fix array-index-out-of-bounds in dbAdjTree
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manas Ghandat <[email protected]>
[ Upstream commit 74ecdda68242b174920fe7c6133a856fb7d8559b ]
Currently there is a bound check missing in the dbAdjTree while accessing the dmt_stree. To add the required check added the bool is_ctl which is required to determine the size as suggest in the following commit.
https://lore.kernel.org/linux-kernel-mentees/[email protected]/
--- fs/jfs/jfs_dmap.c | 60 ++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 29 deletions(-)
fs/jfs/jfs_dmap.c +31 -29
@@ -76,10 +76,10 @@*/ static void dbAllocBits (struct bmap * bmp,struct dmap * dp,s64 blkno,int nblocks); -static void dbSplit (dmtree_t * tp,int leafno,int splitsz,int newval); -static int dbBackSplit (dmtree_t * tp,int leafno); -static int dbJoin (dmtree_t * tp,int leafno,int newval); -static void dbAdjTree (dmtree_t * tp,int leafno,int newval); +static void dbSplit (dmtree_t *tp,int leafno,int splitsz,int newval,bool is_ctl); +static int dbBackSplit (dmtree_t *tp,int leafno,bool is_ctl); +static int dbJoin (dmtree_t *tp,int leafno,int newval,bool is_ctl); +static void dbAdjTree (dmtree_t *tp,int leafno,int newval,bool is_ctl);static int dbAdjCtl (struct bmap * bmp,s64 blkno,int newval,int alloc,int level);static int dbAllocAny (struct bmap * bmp,s64 nblocks,int l2nb,s64 * results);
@@ -2184,7 +2184,7 @@ static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,* system. */ if (dp->tree.stree[word] ==NOFREE ) -dbBackSplit ((dmtree_t *) & dp->tree, word); +dbBackSplit ((dmtree_t *)&dp->tree, word, false);dbAllocBits (bmp, dp, blkno, nblocks); }
@@ -2270,7 +2270,7 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,* the binary system of the leaves if need be. */ dbSplit (tp, word,BUDMIN , -dbMaxBud ((u8 *) & dp->wmap[word])); +dbMaxBud ((u8 *)&dp->wmap[word]), false); word +=1 ; }else {
@@ -2310,7 +2310,7 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,* system of the leaves to reflect the current * allocation (size). */ -dbSplit (tp, word, size,NOFREE ); +dbSplit (tp, word, size,NOFREE , false);/* get the number of dmap words handled */ nw =BUDSIZE (size,BUDMIN );
@@ -2417,7 +2417,7 @@ static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,/* update the leaf for this dmap word. */ rc =dbJoin (tp, word, -dbMaxBud ((u8 *) & dp->wmap[word])); +dbMaxBud ((u8 *)&dp->wmap[word]), false);if (rc)return rc;
@@ -2450,7 +2450,7 @@ static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,/* update the leaf. */ - rc =dbJoin (tp, word, size); + rc =dbJoin (tp, word, size, false);if (rc)return rc;
@@ -2602,14 +2602,14 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)* that it is at the front of a binary buddy system. */ if (oldval ==NOFREE ) { - rc =dbBackSplit ((dmtree_t *) dcp, leafno); + rc =dbBackSplit ((dmtree_t *)dcp, leafno, true);if (rc)return rc; oldval = dcp->stree[ti]; } -dbSplit ((dmtree_t *) dcp, leafno, dcp->budmin, newval); +dbSplit ((dmtree_t *) dcp, leafno, dcp->budmin, newval, true); }else { - rc =dbJoin ((dmtree_t *) dcp, leafno, newval); + rc =dbJoin ((dmtree_t *) dcp, leafno, newval, true);if (rc)return rc; }
@@ -2638,7 +2638,7 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)*/ if (alloc) {dbJoin ((dmtree_t *) dcp, leafno, - oldval); + oldval, true); }else {/* the dbJoin() above might have * caused a larger binary buddy system
@@ -2648,9 +2648,9 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)*/ if (dcp->stree[ti] ==NOFREE )dbBackSplit ((dmtree_t *) - dcp, leafno); + dcp, leafno, true);dbSplit ((dmtree_t *) dcp, leafno, - dcp->budmin, oldval); + dcp->budmin, oldval, true); }/* release the buffer and return the error.
@@ -2698,7 +2698,7 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)* * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; */ -static void dbSplit (dmtree_t * tp,int leafno,int splitsz,int newval) +static void dbSplit (dmtree_t *tp,int leafno,int splitsz,int newval,bool is_ctl) {int budsz;int cursz;
@@ -2720,7 +2720,7 @@ static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval)while (cursz >= splitsz) {/* update the buddy's leaf with its new value. */ -dbAdjTree (tp, leafno ^ budsz, cursz); +dbAdjTree (tp, leafno ^ budsz, cursz, is_ctl);/* on to the next size and buddy. */
@@ -2732,7 +2732,7 @@ static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval)/* adjust the dmap tree to reflect the specified leaf's new * value. */ -dbAdjTree (tp, leafno, newval); +dbAdjTree (tp, leafno, newval, is_ctl); }
@@ -2763,7 +2763,7 @@ static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval)* * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; */ -static int dbBackSplit (dmtree_t * tp,int leafno) +static int dbBackSplit (dmtree_t *tp,int leafno,bool is_ctl) {int budsz, bud, w, bsz, size;int cursz;
@@ -2814,7 +2814,7 @@ static int dbBackSplit(dmtree_t * tp, int leafno)* system in two. */ cursz = leaf[bud] -1 ; -dbSplit (tp, bud, cursz, cursz); +dbSplit (tp, bud, cursz, cursz, is_ctl);break ; } }
@@ -2842,7 +2842,7 @@ static int dbBackSplit(dmtree_t * tp, int leafno)* * RETURN VALUES: none */ -static int dbJoin (dmtree_t * tp,int leafno,int newval) +static int dbJoin (dmtree_t *tp,int leafno,int newval,bool is_ctl) {int budsz, buddy;s8 *leaf;
@@ -2897,12 +2897,12 @@ static int dbJoin(dmtree_t * tp, int leafno, int newval)if (leafno < buddy) {/* leafno is the left buddy. */ -dbAdjTree (tp, buddy,NOFREE ); +dbAdjTree (tp, buddy,NOFREE , is_ctl); }else {/* buddy is the left buddy and becomes * leafno. */ -dbAdjTree (tp, leafno,NOFREE ); +dbAdjTree (tp, leafno,NOFREE , is_ctl); leafno = buddy; }
@@ -2915,7 +2915,7 @@ static int dbJoin(dmtree_t * tp, int leafno, int newval)/* update the leaf value. */ -dbAdjTree (tp, leafno, newval); +dbAdjTree (tp, leafno, newval, is_ctl);return 0 ; }
@@ -2936,21 +2936,23 @@ static int dbJoin(dmtree_t * tp, int leafno, int newval)* * RETURN VALUES: none */ -static void dbAdjTree (dmtree_t * tp,int leafno,int newval) +static void dbAdjTree (dmtree_t *tp,int leafno,int newval,bool is_ctl) {int lp, pp, k; -int max; +int max, size; + + size = is_ctl ?CTLTREESIZE :TREESIZE ;/* pick up the index of the leaf for this leafno. */ lp = leafno +le32_to_cpu (tp->dmt_leafidx); +if (WARN_ON_ONCE (lp >= size || lp <0 )) +return ; +/* is the current value the same as the old value ? if so, * there is nothing to do. */ -if (WARN_ON_ONCE (lp >=CTLTREESIZE )) -return ; -if (tp->dmt_stree[lp] == newval)return ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 62/202 jfs: fix uaf in jfs_evict_inode
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit e0e1958f4c365e380b17ccb35617345b31ef7bf3 ]
When the execution of diMount(ipimap) fails, the object ipimap that has been released may be accessed in diFreeSpecial(). Asynchronous ipimap release occurs when rcu_core() calls jfs_free_node().
Therefore, when diMount(ipimap) fails, sbi->ipimap should not be initialized as ipimap.
--- fs/jfs/jfs_mount.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/jfs/jfs_mount.c +3 -3
@@ -184,15 +184,15 @@ int jfs_mount(struct super_block *sb) }jfs_info ("jfs_mount: ipimap:0x%p" , ipimap); -/* map further access of per fileset inodes by the fileset inode */ - sbi->ipimap = ipimap; -/* initialize fileset inode allocation map */ if ((rc =diMount (ipimap))) {jfs_err ("jfs_mount: diMount failed w/rc = %d" , rc); goto err_ipimap; } +/* map further access of per fileset inodes by the fileset inode */ + sbi->ipimap = ipimap; +return rc;/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 63/202 pstore/ram: Fix crash when setting number of cpus to an odd number
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weichen Chen <[email protected]>
[ Upstream commit d49270a04623ce3c0afddbf3e984cb245aa48e9c ]
When the number of cpu cores is adjusted to 7 or other odd numbers, the zone size will become an odd number.
The address of the zone will become:
addr of zone0 = BASE
addr of zone1 = BASE + zone_size
addr of zone2 = BASE + zone_size*2
...
The address of zone1/3/5/7 will be mapped to non-alignment va. Eventually crashes will occur when accessing these va.
So, use ALIGN_DOWN() to make sure the zone size is even to avoid this bug.
--- fs/pstore/ram.c | 1 + 1 file changed, 1 insertion(+)
fs/pstore/ram.c +1 -0
@@ -590,6 +590,7 @@ static int ramoops_init_przs(const char *name, } zone_sz = mem_sz / *cnt; + zone_sz =ALIGN_DOWN (zone_sz,2 );if (!zone_sz) {dev_err (dev,"%s zone size == 0\n" , name); goto fail;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 64/202 crypto: stm32/crc32 - fix parsing list of devices
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Bourgoin <[email protected]>
[ Upstream commit 0eaef675b94c746900dcea7f6c41b9a103ed5d53 ]
smatch warnings:drivers/crypto/stm32/stm32-crc32.c:108 stm32_crc_get_next_crc() warn:
can 'crc' even be NULL?
Use list_first_entry_or_null instead of list_first_entry to retrieve the first device registered.
The function list_first_entry always return a non NULL pointer even if the list is empty. Hence checking if the pointer returned is NULL does not tell if the list is empty or not.
--- drivers/crypto/stm32/stm32_crc32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/stm32/stm32_crc32.c +1 -1
@@ -98,7 +98,7 @@ static struct stm32_crc *stm32_crc_get_next_crc(void)struct stm32_crc *crc;spin_lock_bh (&crc_list.lock); - crc = list_first_entry(&crc_list.dev_list, struct stm32_crc, list); + crc = list_first_entry_or_null(&crc_list.dev_list, struct stm32_crc, list);if (crc)list_move_tail (&crc->list, &crc_list.dev_list);spin_unlock_bh (&crc_list.lock);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 65/202 afs: fix the usage of read_seqbegin_or_lock() in afs_find_server*()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
[ Upstream commit 1702e0654ca9a7bcd7c7619c8a5004db58945b71 ]
David Howells says:
(5) afs_find_server().
There could be a lot of servers in the list and each server can have multiple addresses, so I think this would be better with an exclusive second pass.
The server list isn't likely to change all that often, but when it does change, there's a good chance several servers are going to be added/removed one after the other. Further, this is only going to be used for incoming cache management/callback requests from the server, which hopefully aren't going to happen too often - but it is remotely drivable.
(6) afs_find_server_by_uuid().
Similarly to (5), there could be a lot of servers to search through, but they are in a tree not a flat list, so it should be faster to process. Again, it's not likely to change that often and, again, when it does change it's likely to involve multiple changes. This can be driven remotely by an incoming cache management request but is mostly going to be driven by setting up or reconfiguring a volume's server list - something that also isn't likely to happen often.
Make the "seq" counter odd on the 2nd pass, otherwise read_seqbegin_or_lock() never takes the lock.
--- fs/afs/server.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/afs/server.c +4 -3
@@ -37,7 +37,7 @@ struct afs_server *afs_find_server(struct afs_net *net,const struct afs_addr_list *alist;struct afs_server *server =NULL ;unsigned int i; -int seq =0 , diff; +int seq =1 , diff;rcu_read_lock ();
@@ -45,6 +45,7 @@ struct afs_server *afs_find_server(struct afs_net *net,if (server)afs_put_server (net, server); server =NULL ; + seq++;/* 2 on the 1st/lockless path, otherwise odd */ read_seqbegin_or_lock (&net->fs_addr_lock, &seq);if (srx->transport.family ==AF_INET6 ) {
@@ -100,7 +101,7 @@ struct afs_server *afs_find_server_by_uuid(struct afs_net *net, const uuid_t *uu {struct afs_server *server =NULL ;struct rb_node *p; -int diff, seq =0 ; +int diff, seq =1 ;_enter ("%pU" , uuid);
@@ -112,7 +113,7 @@ struct afs_server *afs_find_server_by_uuid(struct afs_net *net, const uuid_t *uuif (server)afs_put_server (net, server); server =NULL ; - + seq++;/* 2 on the 1st/lockless path, otherwise odd */ read_seqbegin_or_lock (&net->fs_lock, &seq); p = net->fs_servers.rb_node;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 66/202 rxrpc_find_service_conn_rcu: fix the usage of read_seqbegin_or_lock()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
[ Upstream commit bad1a11c0f061aa073bab785389fe04f19ba02e1 ]
rxrpc_find_service_conn_rcu() should make the "seq" counter odd on the second pass, otherwise read_seqbegin_or_lock() never takes the lock.
--- net/rxrpc/conn_service.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/rxrpc/conn_service.c +2 -1
@@ -29,7 +29,7 @@ struct rxrpc_connection *rxrpc_find_service_conn_rcu(struct rxrpc_peer *peer,struct rxrpc_conn_proto k;struct rxrpc_skb_priv *sp =rxrpc_skb (skb);struct rb_node *p; -unsigned int seq =0 ; +unsigned int seq =1 ; k.epoch = sp->hdr.epoch; k.cid = sp->hdr.cid &RXRPC_CIDMASK ;
@@ -39,6 +39,7 @@ struct rxrpc_connection *rxrpc_find_service_conn_rcu(struct rxrpc_peer *peer,* under just the RCU read lock, so we have to check for * changes. */ + seq++;/* 2 on the 1st/lockless path, otherwise odd */ read_seqbegin_or_lock (&peer->service_conn_lock, &seq); p =rcu_dereference_raw (peer->service_conns.rb_node);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 67/202 jfs: fix array-index-out-of-bounds in diNewExt
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit 49f9637aafa6e63ba686c13cb8549bf5e6920402 ]
[Syz report]
UBSAN: array-index-out-of-bounds in fs/jfs/jfs_imap.c:2360:2 index -878706688 is out of range for type 'struct iagctl[128]' CPU: 1 PID: 5065 Comm: syz-executor282 Not tainted 6.7.0-rc4-syzkaller-00009-gbee0e7762ad2 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 ubsan_epilogue lib/ubsan.c:217 [inline] __ubsan_handle_out_of_bounds+0x11c/0x150 lib/ubsan.c:348 diNewExt+0x3cf3/0x4000 fs/jfs/jfs_imap.c:2360 diAllocExt fs/jfs/jfs_imap.c:1949 [inline] diAllocAG+0xbe8/0x1e50 fs/jfs/jfs_imap.c:1666 diAlloc+0x1d3/0x1760 fs/jfs/jfs_imap.c:1587 ialloc+0x8f/0x900 fs/jfs/jfs_inode.c:56 jfs_mkdir+0x1c5/0xb90 fs/jfs/namei.c:225 vfs_mkdir+0x2f1/0x4b0 fs/namei.c:4106 do_mkdirat+0x264/0x3a0 fs/namei.c:4129 __do_sys_mkdir fs/namei.c:4149 [inline] __se_sys_mkdir fs/namei.c:4147 [inline] __x64_sys_mkdir+0x6e/0x80 fs/namei.c:4147 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x45/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7fcb7e6a0b57 Code: ff ff 77 07 31 c0 c3 0f 1f 40 00 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 b8 53 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffd83023038 EFLAGS: 00000286 ORIG_RAX: 0000000000000053 RAX: ffffffffffffffda RBX: 00000000ffffffff RCX: 00007fcb7e6a0b57 RDX: 00000000000a1020 RSI: 00000000000001ff RDI: 0000000020000140 RBP: 0000000020000140 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000286 R12: 00007ffd830230d0 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[Analysis]
When the agstart is too large, it can cause agno overflow.
[Fix]
After obtaining agno, if the value is invalid, exit the subsequent process.
Modified the test from agno > MAXAG to agno >= MAXAG based on linux-next report by kernel test robot (Dan Carpenter).
--- fs/jfs/jfs_imap.c | 3 +++ 1 file changed, 3 insertions(+)
fs/jfs/jfs_imap.c +3 -0
@@ -2194,6 +2194,9 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)/* get the ag and iag numbers for this iag. */ agno =BLKTOAG (le64_to_cpu (iagp->agstart), sbi); +if (agno >=MAXAG || agno <0 ) +return -EIO ; + iagno =le32_to_cpu (iagp->iagnum);/* check if this is the last free extent within the
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 68/202 s390/ptrace: handle setting of fpc register correctly
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
[ Upstream commit 8b13601d19c541158a6e18b278c00ba69ae37829 ]
If the content of the floating point control (fpc) register of a traced process is modified with the ptrace interface the new value is tested for validity by temporarily loading it into the fpc register.
This may lead to corruption of the fpc register of the tracing process:
if an interrupt happens while the value is temporarily loaded into the fpc register, and within interrupt context floating point or vector registers are used, the current fp/vx registers are saved with save_fpu_regs() assuming they belong to user space and will be loaded into fp/vx registers when returning to user space.
test_fp_ctl() restores the original user space fpc register value, however it will be discarded, when returning to user space.
In result the tracer will incorrectly continue to run with the value that was supposed to be used for the traced process.
Fix this by saving fpu register contents with save_fpu_regs() before using test_fp_ctl().
--- arch/s390/kernel/ptrace.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/s390/kernel/ptrace.c +3 -3
@@ -414,6 +414,7 @@ static int __poke_user(struct task_struct *child, addr_t addr, addr_t data)/* * floating point control reg. is in the thread structure */ +save_fpu_regs ();if ((unsigned int ) data !=0 ||test_fp_ctl (data >> (BITS_PER_LONG -32 )))return -EINVAL ;
@@ -774,6 +775,7 @@ static int __poke_user_compat(struct task_struct *child,/* * floating point control reg. is in the thread structure */ +save_fpu_regs ();if (test_fp_ctl (tmp))return -EINVAL ; child->thread.fpu.fpc = data;
@@ -1002,9 +1004,7 @@ static int s390_fpregs_set(struct task_struct *target,int rc =0 ;freg_t fprs[__NUM_FPRS]; -if (target == current) -save_fpu_regs (); - +save_fpu_regs ();if (MACHINE_HAS_VX )convert_vx_to_fp (fprs, target->thread.fpu.vxrs);else
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 69/202 KVM: s390: fix setting of fpc register
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
[ Upstream commit b988b1bb0053c0dcd26187d29ef07566a565cf55 ]
kvm_arch_vcpu_ioctl_set_fpu() allows to set the floating point control (fpc) register of a guest cpu. The new value is tested for validity by temporarily loading it into the fpc register.
This may lead to corruption of the fpc register of the host process:
if an interrupt happens while the value is temporarily loaded into the fpc register, and within interrupt context floating point or vector registers are used, the current fp/vx registers are saved with save_fpu_regs() assuming they belong to user space and will be loaded into fp/vx registers when returning to user space.
test_fp_ctl() restores the original user space / host process fpc register value, however it will be discarded, when returning to user space.
In result the host process will incorrectly continue to run with the value that was supposed to be used for a guest cpu.
Fix this by simply removing the test. There is another test right before the SIE context is entered which will handles invalid values.
This results in a change of behaviour: invalid values will now be accepted instead of that the ioctl fails with -EINVAL. This seems to be acceptable, given that this interface is most likely not used anymore, and this is in addition the same behaviour implemented with the memory mapped interface (replace invalid values with zero) - see sync_regs() in kvm-s390.c.
--- arch/s390/kvm/kvm-s390.c | 5 ----- 1 file changed, 5 deletions(-)
arch/s390/kvm/kvm-s390.c +0 -5
@@ -2995,10 +2995,6 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)vcpu_load (vcpu); -if (test_fp_ctl (fpu->fpc)) { - ret = -EINVAL ; - goto out; - } vcpu->run->s.regs.fpc = fpu->fpc;if (MACHINE_HAS_VX ) convert_fp_to_vx((__vector128 *) vcpu->run->s.regs.vrs,
@@ -3006,7 +3002,6 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)else memcpy (vcpu->run->s.regs.fprs, &fpu->fprs,sizeof (fpu->fprs)); -out:vcpu_put (vcpu);return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 70/202 SUNRPC: Fix a suspicious RCU usage warning
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anna Schumaker <[email protected]>
[ Upstream commit 31b62908693c90d4d07db597e685d9f25a120073 ]
I received the following warning while running cthon against an ontap server running pNFS:
[ 57.202521] =============================
[ 57.202522] WARNING: suspicious RCU usage
[ 57.202523] 6.7.0-rc3-g2cc14f52aeb7 #41492 Not tainted
[ 57.202525] -----------------------------
[ 57.202525] net/sunrpc/xprtmultipath.c:349 RCU-list traversed in non-reader section!!
[ 57.202527]
other info that might help us debug this:[ 57.202528]
rcu_scheduler_active = 2, debug_locks = 1
[ 57.202529] no locks held by test5/3567.
[ 57.202530]
stack backtrace:
[ 57.202532] CPU: 0 PID: 3567 Comm: test5 Not tainted 6.7.0-rc3-g2cc14f52aeb7 #41492 5b09971b4965c0aceba19f3eea324a4a806e227e
[ 57.202534] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS unknown 2/2/2022
[ 57.202536] Call Trace:
[ 57.202537] <TASK>
[ 57.202540] dump_stack_lvl+0x77/0xb0
[ 57.202551] lockdep_rcu_suspicious+0x154/0x1a0
[ 57.202556] rpc_xprt_switch_has_addr+0x17c/0x190 [sunrpc ebe02571b9a8ceebf7d98e71675af20c19bdb1f6]
[ 57.202596] rpc_clnt_setup_test_and_add_xprt+0x50/0x180 [sunrpc ebe02571b9a8ceebf7d98e71675af20c19bdb1f6]
[ 57.202621] ? rpc_clnt_add_xprt+0x254/0x300 [sunrpc ebe02571b9a8ceebf7d98e71675af20c19bdb1f6]
[ 57.202646] rpc_clnt_add_xprt+0x27a/0x300 [sunrpc ebe02571b9a8ceebf7d98e71675af20c19bdb1f6]
[ 57.202671] ? __pfx_rpc_clnt_setup_test_and_add_xprt+0x10/0x10 [sunrpc ebe02571b9a8ceebf7d98e71675af20c19bdb1f6]
[ 57.202696] nfs4_pnfs_ds_connect+0x345/0x760 [nfsv4 c716d88496ded0ea6d289bbea684fa996f9b57a9]
[ 57.202728] ? __pfx_nfs4_test_session_trunk+0x10/0x10 [nfsv4 c716d88496ded0ea6d289bbea684fa996f9b57a9]
[ 57.202754] nfs4_fl_prepare_ds+0x75/0xc0 [nfs_layout_nfsv41_files e3a4187f18ae8a27b630f9feae6831b584a9360a]
[ 57.202760] filelayout_write_pagelist+0x4a/0x200 [nfs_layout_nfsv41_files e3a4187f18ae8a27b630f9feae6831b584a9360a]
[ 57.202765] pnfs_generic_pg_writepages+0xbe/0x230 [nfsv4 c716d88496ded0ea6d289bbea684fa996f9b57a9]
[ 57.202788] __nfs_pageio_add_request+0x3fd/0x520 [nfs 6c976fa593a7c2976f5a0aeb4965514a828e6902]
[ 57.202813] nfs_pageio_add_request+0x18b/0x390 [nfs 6c976fa593a7c2976f5a0aeb4965514a828e6902]
[ 57.202831] nfs_do_writepage+0x116/0x1e0 [nfs 6c976fa593a7c2976f5a0aeb4965514a828e6902]
[ 57.202849] nfs_writepages_callback+0x13/0x30 [nfs 6c976fa593a7c2976f5a0aeb4965514a828e6902]
[ 57.202866] write_cache_pages+0x265/0x450
[ 57.202870] ? __pfx_nfs_writepages_callback+0x10/0x10 [nfs 6c976fa593a7c2976f5a0aeb4965514a828e6902]
[ 57.202891] nfs_writepages+0x141/0x230 [nfs 6c976fa593a7c2976f5a0aeb4965514a828e6902]
[ 57.202913] do_writepages+0xd2/0x230
[ 57.202917] ? filemap_fdatawrite_wbc+0x5c/0x80
[ 57.202921] filemap_fdatawrite_wbc+0x67/0x80
[ 57.202924] filemap_write_and_wait_range+0xd9/0x170
[ 57.202930] nfs_wb_all+0x49/0x180 [nfs 6c976fa593a7c2976f5a0aeb4965514a828e6902]
[ 57.202947] nfs4_file_flush+0x72/0xb0 [nfsv4 c716d88496ded0ea6d289bbea684fa996f9b57a9]
[ 57.202969] __se_sys_close+0x46/0xd0
[ 57.202972] do_syscall_64+0x68/0x100
[ 57.202975] ? do_syscall_64+0x77/0x100
[ 57.202976] ? do_syscall_64+0x77/0x100
[ 57.202979] entry_SYSCALL_64_after_hwframe+0x6e/0x76
[ 57.202982] RIP: 0033:0x7fe2b12e4a94
[ 57.202985] Code: 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 80 3d d5 18 0e 00 00 74 13 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 44 c3 0f 1f 00 48 83 ec 18 89 7c 24 0c e8 c3
[ 57.202987] RSP: 002b:00007ffe857ddb38 EFLAGS: 00000202 ORIG_RAX: 0000000000000003
[ 57.202989] RAX: ffffffffffffffda RBX: 00007ffe857dfd68 RCX: 00007fe2b12e4a94
[ 57.202991] RDX: 0000000000002000 RSI: 00007ffe857ddc40 RDI: 0000000000000003
[ 57.202992] RBP: 00007ffe857dfc50 R08: 7fffffffffffffff R09: 0000000065650f49
[ 57.202993] R10: 00007fe2b11f8300 R11: 0000000000000202 R12: 0000000000000000
[ 57.202994] R13: 00007ffe857dfd80 R14: 00007fe2b1445000 R15: 0000000000000000
[ 57.202999] </TASK>The problem seems to be that two out of three callers aren't taking the rcu_read_lock() before calling the list_for_each_entry_rcu() function in rpc_xprt_switch_has_addr(). I fix this by having rpc_xprt_switch_has_addr() unconditionaly take the rcu_read_lock(), which is okay to do recursively in the case that the lock has already been taken by a caller.
--- net/sunrpc/xprtmultipath.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
net/sunrpc/xprtmultipath.c +15 -2
@@ -235,8 +235,9 @@ struct rpc_xprt *xprt_iter_current_entry(struct rpc_xprt_iter *xpi)return xprt_switch_find_current_entry (head, xpi->xpi_cursor); } -bool rpc_xprt_switch_has_addr (struct rpc_xprt_switch *xps, -const struct sockaddr *sap) +static +bool __rpc_xprt_switch_has_addr (struct rpc_xprt_switch *xps, +const struct sockaddr *sap) {struct list_head *head;struct rpc_xprt *pos;
@@ -255,6 +256,18 @@ bool rpc_xprt_switch_has_addr(struct rpc_xprt_switch *xps,return false; } +bool rpc_xprt_switch_has_addr (struct rpc_xprt_switch *xps, +const struct sockaddr *sap) +{ +bool res; + +rcu_read_lock (); + res =__rpc_xprt_switch_has_addr (xps, sap); +rcu_read_unlock (); + +return res; +} +static struct rpc_xprt *xprt_switch_find_next_entry (struct list_head *head,const struct rpc_xprt *cur)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 71/202 ext4: fix inconsistent between segment fstrim and full fstrim
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ye Bin <[email protected]>
[ Upstream commit 68da4c44b994aea797eb9821acb3a4a36015293e ]
Suppose we issue two FITRIM ioctls for ranges [0,15] and [16,31] with mininum length of trimmed range set to 8 blocks. If we have say a range of blocks 10-22 free, this range will not be trimmed because it straddles the boundary of the two FITRIM ranges and neither part is big enough. This is a bit surprising to some users that call FITRIM on smaller ranges of blocks to limit impact on the system. Also XFS trims all free space extents that overlap with the specified range so we are inconsistent among filesystems. Let's change ext4_try_to_trim_range() to consider for trimming the whole free space extent that straddles the end of specified range, not just the part of it within the range.
--- fs/ext4/mballoc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
fs/ext4/mballoc.c +8 -3
@@ -5213,13 +5213,15 @@ static int ext4_try_to_trim_range(struct super_block *sb, struct ext4_buddy *e4b, ext4_grpblk_t start, ext4_grpblk_t max, ext4_grpblk_t minblocks) { - ext4_grpblk_t next, count, free_count; + ext4_grpblk_t next, count, free_count, last, origin_start;bool set_trimmed = false;void *bitmap; + last =ext4_last_grp_cluster (sb, e4b->bd_group); bitmap = e4b->bd_bitmap; -if (start ==0 && max >=ext4_last_grp_cluster (sb, e4b->bd_group)) +if (start ==0 && max >= last) set_trimmed = true; + origin_start = start; start =max (e4b->bd_info->bb_first_free, start); count =0 ; free_count =0 ;
@@ -5228,7 +5230,10 @@ static int ext4_try_to_trim_range(struct super_block *sb, start =mb_find_next_zero_bit (bitmap, max +1 , start);if (start > max)break ; - next =mb_find_next_bit (bitmap, max +1 , start); + + next =mb_find_next_bit (bitmap, last +1 , start); +if (origin_start ==0 && next >= last) + set_trimmed = true;if ((next - start) >= minblocks) {int ret =ext4_trim_extent (sb, start, next - start, e4b);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 72/202 ext4: unify the type of flexbg_size to unsigned int
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
[ Upstream commit 658a52344fb139f9531e7543a6e0015b630feb38 ]
The maximum value of flexbg_size is 2^31, but the maximum value of int is (2^31 - 1), so overflow may occur when the type of flexbg_size is declared as int.
For example, when uninit_mask is initialized in ext4_alloc_group_tables(), if flexbg_size == 2^31, the initialized uninit_mask is incorrect, and this may causes set_flexbg_block_bitmap() to trigger a BUG_ON().
Therefore, the flexbg_size type is declared as unsigned int to avoid overflow and memory waste.
--- fs/ext4/resize.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
fs/ext4/resize.c +7 -6
@@ -237,7 +237,7 @@ struct ext4_new_flex_group_data {* * Returns NULL on failure otherwise address of the allocated structure. */ -static struct ext4_new_flex_group_data *alloc_flex_gd (unsigned long flexbg_size) +static struct ext4_new_flex_group_data *alloc_flex_gd (unsigned int flexbg_size) {struct ext4_new_flex_group_data *flex_gd;
@@ -292,7 +292,7 @@ static void free_flex_gd(struct ext4_new_flex_group_data *flex_gd)*/ static int ext4_alloc_group_tables (struct super_block *sb,struct ext4_new_flex_group_data *flex_gd, -int flexbg_size) +unsigned int flexbg_size) {struct ext4_new_group_data *group_data = flex_gd->groups;ext4_fsblk_t start_blk;
@@ -393,12 +393,12 @@ static int ext4_alloc_group_tables(struct super_block *sb, group = group_data[0 ].group;printk (KERN_DEBUG "EXT4-fs: adding a flex group with " -"%d groups, flexbg size is %d:\n" , flex_gd->count, +"%u groups, flexbg size is %u:\n" , flex_gd->count, flexbg_size);for (i =0 ; i < flex_gd->count; i++) { ext4_debug( - "adding %s group %u: %u blocks (%d free, %d mdata blocks)\n", + "adding %s group %u: %u blocks (%u free, %u mdata blocks)\n", ext4_bg_has_super(sb, group + i) ? "normal" : "no-super", group + i, group_data[i].blocks_count,
@@ -1585,7 +1585,7 @@ static int ext4_flex_group_add(struct super_block *sb,static int ext4_setup_next_flex_gd (struct super_block *sb,struct ext4_new_flex_group_data *flex_gd,ext4_fsblk_t n_blocks_count, -unsigned long flexbg_size) +unsigned int flexbg_size) {struct ext4_sb_info *sbi =EXT4_SB (sb);struct ext4_super_block *es = sbi->s_es;
@@ -1965,8 +1965,9 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count)ext4_fsblk_t o_blocks_count;ext4_fsblk_t n_blocks_count_retry =0 ;unsigned long last_update_time =0 ; -int err =0 , flexbg_size =1 << sbi->s_log_groups_per_flex; +int err =0 ;int meta_bg; +unsigned int flexbg_size =ext4_flex_bg_size (sbi);/* See if the device is actually as big as what was requested */ bh =sb_bread (sb, n_blocks_count -1 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 73/202 ext4: remove unnecessary check from alloc_flex_gd()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
[ Upstream commit b099eb87de105cf07cad731ded6fb40b2675108b ]
In commit 967ac8af4475 ("ext4: fix potential integer overflow in alloc_flex_gd()"), an overflow check is added to alloc_flex_gd() to prevent the allocated memory from being smaller than expected due to the overflow. However, after kmalloc() is replaced with kmalloc_array() in commit 6da2ec56059c ("treewide: kmalloc() -> kmalloc_array()"), the kmalloc_array() function has an overflow check, so the above problem will not occur. Therefore, the extra check is removed.
--- fs/ext4/resize.c | 3 --- 1 file changed, 3 deletions(-)
fs/ext4/resize.c +0 -3
@@ -245,10 +245,7 @@ static struct ext4_new_flex_group_data *alloc_flex_gd(unsigned int flexbg_size)if (flex_gd ==NULL ) goto out3; -if (flexbg_size >=UINT_MAX /sizeof (struct ext4_new_group_data )) - goto out2; flex_gd->count = flexbg_size; - flex_gd->groups =kmalloc_array (flexbg_size,sizeof (struct ext4_new_group_data ),GFP_NOFS );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 74/202 ext4: avoid online resizing failures due to oversized flex bg
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
[ Upstream commit 5d1935ac02ca5aee364a449a35e2977ea84509b0 ]
When we online resize an ext4 filesystem with a oversized flexbg_size,
mkfs.ext4 -F -G 67108864 $dev -b 4096 100M
mount $dev $dir
resize2fs $dev 16G
the following WARN_ON is triggered:
==================================================================
WARNING: CPU: 0 PID: 427 at mm/page_alloc.c:4402 __alloc_pages+0x411/0x550 Modules linked in: sg(E) CPU: 0 PID: 427 Comm: resize2fs Tainted: G E 6.6.0-rc5+ #314 RIP: 0010:__alloc_pages+0x411/0x550 Call Trace: <TASK> __kmalloc_large_node+0xa2/0x200 __kmalloc+0x16e/0x290 ext4_resize_fs+0x481/0xd80 __ext4_ioctl+0x1616/0x1d90 ext4_ioctl+0x12/0x20 __x64_sys_ioctl+0xf0/0x150 do_syscall_64+0x3b/0x90 ==================================================================
This is because flexbg_size is too large and the size of the new_group_data array to be allocated exceeds MAX_ORDER. Currently, the minimum value of MAX_ORDER is 8, the minimum value of PAGE_SIZE is 4096, the corresponding maximum number of groups that can be allocated is:
(PAGE_SIZE << MAX_ORDER) / sizeof(struct ext4_new_group_data) ≈ 21845
And the value that is down-aligned to the power of 2 is 16384. Therefore, this value is defined as MAX_RESIZE_BG, and the number of groups added each time does not exceed this value during resizing, and is added multiple times to complete the online resizing. The difference is that the metadata in a flex_bg may be more dispersed.
--- fs/ext4/resize.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
fs/ext4/resize.c +17 -8
@@ -227,10 +227,17 @@ struct ext4_new_flex_group_data {in the flex group */ __u16 *bg_flags;/* block group flags of groups in @groups */ +ext4_group_t resize_bg;/* number of allocated +new_group_data */ ext4_group_t count;/* number of groups in @groups */ }; +/* +* Avoiding memory allocation failures due to too many groups added each time. +*/ +#define MAX_RESIZE_BG 16384 +/* * alloc_flex_gd() allocates a ext4_new_flex_group_data with size of * @flexbg_size.
@@ -245,14 +252,18 @@ static struct ext4_new_flex_group_data *alloc_flex_gd(unsigned int flexbg_size)if (flex_gd ==NULL ) goto out3; - flex_gd->count = flexbg_size; - flex_gd->groups =kmalloc_array (flexbg_size, +if (unlikely (flexbg_size >MAX_RESIZE_BG )) + flex_gd->resize_bg =MAX_RESIZE_BG ; +else + flex_gd->resize_bg = flexbg_size; + + flex_gd->groups =kmalloc_array (flex_gd->resize_bg,sizeof (struct ext4_new_group_data ),GFP_NOFS );if (flex_gd->groups ==NULL ) goto out2; - flex_gd->bg_flags =kmalloc_array (flexbg_size,sizeof (__u16), + flex_gd->bg_flags =kmalloc_array (flex_gd->resize_bg,sizeof (__u16),GFP_NOFS );if (flex_gd->bg_flags ==NULL ) goto out1;
@@ -1581,8 +1592,7 @@ static int ext4_flex_group_add(struct super_block *sb,static int ext4_setup_next_flex_gd (struct super_block *sb,struct ext4_new_flex_group_data *flex_gd, -ext4_fsblk_t n_blocks_count, -unsigned int flexbg_size) +ext4_fsblk_t n_blocks_count) {struct ext4_sb_info *sbi =EXT4_SB (sb);struct ext4_super_block *es = sbi->s_es;
@@ -1606,7 +1616,7 @@ static int ext4_setup_next_flex_gd(struct super_block *sb,BUG_ON (last);ext4_get_group_no_and_offset (sb, n_blocks_count -1 , &n_group, &last); - last_group = group | (flexbg_size -1 ); + last_group = group | (flex_gd->resize_bg -1 );if (last_group > n_group) last_group = n_group;
@@ -2105,8 +2115,7 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count)/* Add flex groups. Note that a regular group is a * flex group with 1 group. */ -while (ext4_setup_next_flex_gd (sb, flex_gd, n_blocks_count, - flexbg_size)) { +while (ext4_setup_next_flex_gd (sb, flex_gd, n_blocks_count)) {if (jiffies - last_update_time >HZ *10 ) {if (last_update_time) ext4_msg(sb, KERN_INFO,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 75/202 scsi: lpfc: Fix possible file string name overflow when updating firmware
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Tee <[email protected]>
[ Upstream commit f5779b529240b715f0e358489ad0ed933bf77c97 ]
Because file_name and phba->ModelName are both declared a size 80 bytes, the extra ".grp" file extension could cause an overflow into file_name.
Define a ELX_FW_NAME_SIZE macro with value 84. 84 incorporates the 4 extra characters from ".grp". file_name is changed to be declared as a char and initialized to zeros i.e. null chars.
--- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_init.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc.h +1 -0
@@ -32,6 +32,7 @@struct lpfc_sli2_slim ;#define ELX_MODEL_NAME_SIZE 80 +#define ELX_FW_NAME_SIZE 84#define LPFC_PCI_DEV_LP 0x1#define LPFC_PCI_DEV_OC 0x2
drivers/scsi/lpfc/lpfc_init.c +2 -2
@@ -11428,7 +11428,7 @@ lpfc_write_firmware(const struct firmware *fw, void *context)int lpfc_sli4_request_firmware_update (struct lpfc_hba *phba,uint8_t fw_upgrade) { -uint8_t file_name[ELX_MODEL_NAME_SIZE ]; +char file_name[ELX_FW_NAME_SIZE ] = {0 };int ret;const struct firmware *fw;
@@ -11437,7 +11437,7 @@ lpfc_sli4_request_firmware_update(struct lpfc_hba *phba, uint8_t fw_upgrade) LPFC_SLI_INTF_IF_TYPE_2)return -EPERM ; -snprintf (file_name,ELX_MODEL_NAME_SIZE ,"%s.grp" , phba->ModelName); +scnprintf (file_name,sizeof (file_name),"%s.grp" , phba->ModelName);if (fw_upgrade ==INT_FW_UPGRADE ) { ret = request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 76/202 PCI: Add no PM reset quirk for NVIDIA Spectrum devices
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit 3ed48c80b28d8dcd584d6ddaf00c75b7673e1a05 ]
Spectrum-{1,2,3,4} devices report that a D3hot->D0 transition causes a reset (i.e., they advertise NoSoftRst-). However, this transition does not have any effect on the device: It continues to be operational and network ports remain up. Advertising this support makes it seem as if a PM reset is viable for these devices. Mark it as unavailable to skip it when testing reset methods.
Before:
# cat /sys/bus/pci/devices/0000\:03\:00.0/reset_method pm bus
After:
# cat /sys/bus/pci/devices/0000\:03\:00.0/reset_method bus
--- drivers/pci/quirks.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/pci/quirks.c +13 -0
@@ -3532,6 +3532,19 @@ static void quirk_no_pm_reset(struct pci_dev *dev)DECLARE_PCI_FIXUP_CLASS_HEADER (PCI_VENDOR_ID_ATI ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA ,8 , quirk_no_pm_reset); +/* +* Spectrum-{1,2,3,4} devices report that a D3hot->D0 transition causes a reset +* (i.e., they advertise NoSoftRst-). However, this transition does not have +* any effect on the device: It continues to be operational and network ports +* remain up. Advertising this support makes it seem as if a PM reset is viable +* for these devices. Mark it as unavailable to skip it when testing reset +* methods. +*/ +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MELLANOX ,0xcb84 , quirk_no_pm_reset); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MELLANOX ,0xcf6c , quirk_no_pm_reset); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MELLANOX ,0xcf70 , quirk_no_pm_reset); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MELLANOX ,0xcf80 , quirk_no_pm_reset); +/* * Thunderbolt controllers with broken MSI hotplug signaling: * Entire 1st generation (Light Ridge, Eagle Ridge, Light Peak) and part
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 77/202 bonding: return -ENOMEM instead of BUG in alb_upper_dev_walk
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhengchao Shao <[email protected]>
[ Upstream commit d6b83f1e3707c4d60acfa58afd3515e17e5d5384 ]
If failed to allocate "tags" or could not find the final upper device from start_dev's upper list in bond_verify_device_path(), only the loopback detection of the current upper device should be affected, and the system is no need to be panic.
So return -ENOMEM in alb_upper_dev_walk to stop walking, print some warn information when failed to allocate memory for vlan tags in bond_verify_device_path.
I also think that the following function callsnetdev_walk_all_upper_dev_rcu
---->>>alb_upper_dev_walk
---------->>>bond_verify_device_path
Quoted 1 line
From this way, "end device" can eventually be obtained from "start device"
in bond_verify_device_path, IS_ERR(tags) could be instead of IS_ERR_OR_NULL(tags) in alb_upper_dev_walk.
--- drivers/net/bonding/bond_alb.c | 3 ++- drivers/net/bonding/bond_main.c | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/bonding/bond_alb.c +2 -1
@@ -984,7 +984,8 @@ static int alb_upper_dev_walk(struct net_device *upper, void *_data)if (netif_is_macvlan (upper) && !strict_match) { tags =bond_verify_device_path (bond->dev, upper,0 );if (IS_ERR_OR_NULL (tags)) -BUG (); +return -ENOMEM ; +alb_send_lp_vid (slave, upper->dev_addr, tags[0 ].vlan_proto, tags[0 ].vlan_id);kfree (tags);
drivers/net/bonding/bond_main.c +4 -1
@@ -2460,8 +2460,11 @@ struct bond_vlan_tag *bond_verify_device_path(struct net_device *start_dev,if (start_dev == end_dev) { tags =kcalloc (level +1 ,sizeof (*tags),GFP_ATOMIC ); -if (!tags) +if (!tags) { +net_err_ratelimited ("%s: %s: Failed to allocate tags\n" , + __func__, start_dev->name);return ERR_PTR (-ENOMEM ); + } tags[level].vlan_proto =VLAN_N_VID ;return tags; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 78/202 ARM: dts: imx7s: Fix lcdif compatible
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Stein <[email protected]>
[ Upstream commit 5f55da4cc37051cda600ea870ce8cf29f1297715 ]
imx7d-lcdif is compatible to imx6sx-lcdif. MXSFB_V6 supports overlay by using LCDC_AS_CTRL register. This registers used by overlay plane:
* LCDC_AS_CTRL
* LCDC_AS_BUF
* LCDC_AS_NEXT_BUF
are listed in i.MX7D RM as well.
--- arch/arm/boot/dts/imx7s.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx7s.dtsi +1 -1
@@ -701,7 +701,7 @@ }; lcdif: lcdif@30730000 { - compatible = "fsl,imx7d-lcdif", "fsl,imx28-lcdif"; + compatible = "fsl,imx7d-lcdif", "fsl,imx6sx-lcdif"; reg = <0x30730000 0x10000>; interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX7D_LCDIF_PIXEL_ROOT_CLK>,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 79/202 ARM: dts: imx7s: Fix nand-controller #size-cells
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Stein <[email protected]>
[ Upstream commit 4aadb841ed49bada1415c48c44d21f5b69e01299 ]
nand-controller.yaml bindings says #size-cells shall be set to 0. Fixes the dtbs_check warning:arch/arm/boot/dts/nxp/imx/imx7s-mba7.dtb: nand-controller@33002000:
#size-cells:0:0: 0 was expected
from schema $id: http://devicetree.org/schemas/mtd/gpmi-nand.yaml#
--- arch/arm/boot/dts/imx7s.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx7s.dtsi +1 -1
@@ -1094,7 +1094,7 @@ gpmi: gpmi-nand@33002000{ compatible = "fsl,imx7d-gpmi-nand"; #address-cells = <1>; - #size-cells = <1>; + #size-cells = <0>; reg = <0x33002000 0x2000>, <0x33004000 0x4000>; reg-names = "gpmi-nand", "bch"; interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 80/202 wifi: ath9k: Fix potential array-index-out-of-bounds read in ath9k_htc_txstatus()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Minsuk Kang <[email protected]>
[ Upstream commit 2adc886244dff60f948497b59affb6c6ebb3c348 ]
Fix an array-index-out-of-bounds read in ath9k_htc_txstatus(). The bug occurs when txs->cnt, data from a URB provided by a USB device, is bigger than the size of the array txs->txstatus, which is HTC_MAX_TX_STATUS. WARN_ON() already checks it, but there is no bug handling code after the check. Make the function return if that is the case.
Found by a modified version of syzkaller.
UBSAN: array-index-out-of-bounds in htc_drv_txrx.c index 13 is out of range for type '__wmi_event_txstatus [12]' Call Trace: ath9k_htc_txstatus ath9k_wmi_event_tasklet tasklet_action_common __do_softirq irq_exit_rxu sysvec_apic_timer_interrupt
--- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +3 -2
@@ -647,9 +647,10 @@ void ath9k_htc_txstatus(struct ath9k_htc_priv *priv, void *wmi_event)struct ath9k_htc_tx_event *tx_pend;int i; -for (i =0 ; i < txs->cnt; i++) { -WARN_ON (txs->cnt >HTC_MAX_TX_STATUS ); +if (WARN_ON_ONCE (txs->cnt >HTC_MAX_TX_STATUS )) +return ; +for (i =0 ; i < txs->cnt; i++) { __txs = &txs->txstatus[i]; skb =ath9k_htc_tx_get_packet (priv, __txs);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 81/202 bpf: Add map and need_defer parameters to .map_fd_put_ptr()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
[ Upstream commit 20c20bd11a0702ce4dc9300c3da58acf551d9725 ]
map is the pointer of outer map, and need_defer needs some explanation. need_defer tells the implementation to defer the reference release of the passed element and ensure that the element is still alive before the bpf program, which may manipulate it, exits.
The following three cases will invoke map_fd_put_ptr() and different need_defer values will be passed to these callers:
1) release the reference of the old element in the map during map update or map deletion. The release must be deferred, otherwise the bpf program may incur use-after-free problem, so need_defer needs to be true.
2) release the reference of the to-be-added element in the error path of map update. The to-be-added element is not visible to any bpf program, so it is OK to pass false for need_defer parameter.
3) release the references of all elements in the map during map release. Any bpf program which has access to the map must have been exited and released, so need_defer=false will be OK.
These two parameters will be used by the following patches to fix the potential use-after-free problem for map-in-map.
--- include/linux/bpf.h | 6 +++++- kernel/bpf/arraymap.c | 12 +++++++----- kernel/bpf/hashtab.c | 6 +++--- kernel/bpf/map_in_map.c | 2 +- kernel/bpf/map_in_map.h | 2 +- 5 files changed, 17 insertions(+), 11 deletions(-)
include/linux/bpf.h +5 -1
@@ -44,7 +44,11 @@ struct bpf_map_ops {/* funcs called by prog_array and perf_event_array map */ void *(*map_fd_get_ptr)(struct bpf_map *map,struct file *map_file,int fd); -void (*map_fd_put_ptr)(void *ptr); +/* If need_defer is true, the implementation should guarantee that +* the to-be-put element is still alive before the bpf program, which +* may manipulate it, exists. +*/ +void (*map_fd_put_ptr)(struct bpf_map *map,void *ptr,bool need_defer);u32 (*map_gen_lookup)(struct bpf_map *map,struct bpf_insn *insn_buf);u32 (*map_fd_sys_lookup_elem)(void *ptr); void (*map_seq_show_elem)(struct bpf_map *map, void *key,
kernel/bpf/arraymap.c +7 -5
@@ -469,7 +469,7 @@ int bpf_fd_array_map_update_elem(struct bpf_map *map, struct file *map_file, old_ptr =xchg (array->ptrs + index, new_ptr);if (old_ptr) - map->ops->map_fd_put_ptr (old_ptr); + map->ops->map_fd_put_ptr (map, old_ptr, true);return 0 ; }
@@ -485,7 +485,7 @@ static int fd_array_map_delete_elem(struct bpf_map *map, void *key) old_ptr =xchg (array->ptrs + index,NULL );if (old_ptr) { - map->ops->map_fd_put_ptr (old_ptr); + map->ops->map_fd_put_ptr (map, old_ptr, true);return 0 ; }else {return -ENOENT ;
@@ -509,8 +509,9 @@ static void *prog_fd_array_get_ptr(struct bpf_map *map,return prog; } -static void prog_fd_array_put_ptr (void *ptr) +static void prog_fd_array_put_ptr (struct bpf_map *map,void *ptr,bool need_defer) { +/* bpf_prog is freed after one RCU or tasks trace grace period */ bpf_prog_put (ptr); }
@@ -598,8 +599,9 @@ static void *perf_event_fd_array_get_ptr(struct bpf_map *map,return ee; } -static void perf_event_fd_array_put_ptr (void *ptr) +static void perf_event_fd_array_put_ptr (struct bpf_map *map,void *ptr,bool need_defer) { +/* bpf_perf_event is freed after one RCU grace period */ bpf_event_entry_free_rcu (ptr); }
@@ -640,7 +642,7 @@ static void *cgroup_fd_array_get_ptr(struct bpf_map *map,return cgroup_get_from_fd (fd); } -static void cgroup_fd_array_put_ptr (void *ptr) +static void cgroup_fd_array_put_ptr (struct bpf_map *map,void *ptr,bool need_defer) {/* cgroup_put free cgrp after a rcu grace period */ cgroup_put (ptr);
kernel/bpf/hashtab.c +3 -3
@@ -677,7 +677,7 @@ static void htab_put_fd_value(struct bpf_htab *htab, struct htab_elem *l)if (map->ops->map_fd_put_ptr) { ptr =fd_htab_map_get_ptr (map, l); - map->ops->map_fd_put_ptr (ptr); + map->ops->map_fd_put_ptr (map, ptr, true); } }
@@ -1337,7 +1337,7 @@ static void fd_htab_map_free(struct bpf_map *map)hlist_nulls_for_each_entry_safe (l, n, head, hash_node) {void *ptr =fd_htab_map_get_ptr (map, l); - map->ops->map_fd_put_ptr (ptr); + map->ops->map_fd_put_ptr (map, ptr, false); } }
@@ -1378,7 +1378,7 @@ int bpf_fd_htab_map_update_elem(struct bpf_map *map, struct file *map_file, ret =htab_map_update_elem (map, key, &ptr, map_flags);if (ret) - map->ops->map_fd_put_ptr (ptr); + map->ops->map_fd_put_ptr (map, ptr, false);return ret; }
kernel/bpf/map_in_map.c +1 -1
@@ -102,7 +102,7 @@ void *bpf_map_fd_get_ptr(struct bpf_map *map,return inner_map; } -void bpf_map_fd_put_ptr (void *ptr) +void bpf_map_fd_put_ptr (struct bpf_map *map,void *ptr,bool need_defer) {/* ptr->ops->map_free() has to go through one * rcu grace period by itself.
kernel/bpf/map_in_map.h +1 -1
@@ -18,7 +18,7 @@ bool bpf_map_meta_equal(const struct bpf_map *meta0, const struct bpf_map *meta1);void *bpf_map_fd_get_ptr (struct bpf_map *map,struct file *map_file,int ufd); -void bpf_map_fd_put_ptr (void *ptr); +void bpf_map_fd_put_ptr (struct bpf_map *map,void *ptr,bool need_defer);u32 bpf_map_fd_sys_lookup_elem (void *ptr);#endif
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 82/202 scsi: libfc: Dont schedule abort twice
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Reinecke <[email protected]>
[ Upstream commit b57c4db5d23b9df0118a25e2441c9288edd73710 ]
The current FC error recovery is sending up to three REC (recovery) frames in 10 second intervals, and as a final step sending an ABTS after 30 seconds for the command itself. Unfortunately sending an ABTS is also the action for the SCSI abort handler, and the default timeout for SCSI commands is also 30 seconds. This causes two ABTS to be scheduled, with the libfc one slightly earlier. The ABTS scheduled by SCSI EH then sees the command to be already aborted, and will always return with a 'GOOD' status irrespective on the actual result from the first ABTS. This causes the SCSI EH abort handler to always succeed, and SCSI EH never to be engaged. Fix this by not issuing an ABTS when a SCSI command is present for the exchange, but rather wait for the abort scheduled from SCSI EH. And warn if an abort is already scheduled to avoid similar errors in the future.
--- drivers/scsi/libfc/fc_fcp.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/scsi/libfc/fc_fcp.c +11 -5
@@ -282,6 +282,11 @@ static int fc_fcp_send_abort(struct fc_fcp_pkt *fsp)if (!fsp->seq_ptr)return -EINVAL ; +if (fsp->state &FC_SRB_ABORT_PENDING ) { +FC_FCP_DBG (fsp,"abort already pending\n" ); +return -EBUSY ; + } +per_cpu_ptr (fsp->lp->stats,get_cpu ())->FcpPktAborts++;put_cpu ();
@@ -1710,11 +1715,12 @@ static void fc_fcp_recovery(struct fc_fcp_pkt *fsp, u8 code) fsp->status_code = code; fsp->cdb_status =0 ; fsp->io_status =0 ; -/* -* if this fails then we let the scsi command timer fire and -* scsi-ml escalate. -*/ -fc_fcp_send_abort (fsp); +if (!fsp->cmd) +/* +* Only abort non-scsi commands; otherwise let the +* scsi command timer fire and scsi-ml escalate. +*/ +fc_fcp_send_abort (fsp); }/**
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 83/202 scsi: libfc: Fix up timeout error in fc_fcp_rec_error()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Reinecke <[email protected]>
[ Upstream commit 53122a49f49796beb2c4a1bb702303b66347e29f ]
We should set the status to FC_TIMED_OUT when a timeout error is passed to fc_fcp_rec_error().
--- drivers/scsi/libfc/fc_fcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/libfc/fc_fcp.c +1 -1
@@ -1697,7 +1697,7 @@ static void fc_fcp_rec_error(struct fc_fcp_pkt *fsp, struct fc_frame *fp)if (fsp->recov_retry++ <FC_MAX_RECOV_RETRY )fc_fcp_rec (fsp);else -fc_fcp_recovery (fsp,FC_ERROR ); +fc_fcp_recovery (fsp,FC_TIMED_OUT );break ; }fc_fcp_unlock_pkt (fsp);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 84/202 ARM: dts: rockchip: fix rk3036 hdmi ports node
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Jonker <[email protected]>
[ Upstream commit 27ded76ef0fcfcf939914532aae575cf23c221b4 ]
Fix hdmi ports node so that it matches the
rockchip,inno-hdmi.yaml binding.
--- arch/arm/boot/dts/rk3036.dtsi | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
arch/arm/boot/dts/rk3036.dtsi +11 -3
@@ -336,12 +336,20 @@ pinctrl-0 = <&hdmi_ctl>; status = "disabled"; - hdmi_in: port { + ports { #address-cells = <1>; #size-cells = <0>; - hdmi_in_vop: endpoint@0 { + + hdmi_in: port@0 { reg = <0>; - remote-endpoint = <&vop_out_hdmi>; + + hdmi_in_vop: endpoint { + remote-endpoint = <&vop_out_hdmi>; + }; + }; + + hdmi_out: port@1 { + reg = <1>; }; }; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 85/202 ARM: dts: imx25/27-eukrea: Fix RTC node name
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
[ Upstream commit 68c711b882c262e36895547cddea2c2d56ce611d ]
Node names should be generic. Use 'rtc' as node name to fix the following dt-schema warning:
imx25-eukrea-mbimxsd25-baseboard.dtb: pcf8563@51: $nodename:0: 'pcf8563@51' does not match '^rtc(@.*|-([0-9]|[1-9][0-9]+))?$'
from schema $id: http://devicetree.org/schemas/rtc/nxp,pcf8563.yaml#
--- arch/arm/boot/dts/imx25-eukrea-cpuimx25.dtsi | 2 +- arch/arm/boot/dts/imx27-eukrea-cpuimx27.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/imx25-eukrea-cpuimx25.dtsi +1 -1
@@ -35,7 +35,7 @@ pinctrl-0 = <&pinctrl_i2c1>; status = "okay"; - pcf8563@51 { + rtc@51 { compatible = "nxp,pcf8563"; reg = <0x51>; };
arch/arm/boot/dts/imx27-eukrea-cpuimx27.dtsi +1 -1
@@ -39,7 +39,7 @@ pinctrl-0 = <&pinctrl_i2c1>; status = "okay"; - pcf8563@51 { + rtc@51 { compatible = "nxp,pcf8563"; reg = <0x51>; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 86/202 ARM: dts: imx: Use flash@0,0 pattern
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
[ Upstream commit 1e1d7cc478fb16816de09740e3c323c0c188d58f ]
Per mtd-physmap.yaml, 'nor@0,0' is not a valid node pattern.
Change it to 'flash@0,0' to fix the following dt-schema warning:
imx1-ads.dtb: nor@0,0: $nodename:0: 'nor@0,0' does not match '^(flash|.*sram|nand)(@.*)?$'
from schema $id: http://devicetree.org/schemas/mtd/mtd-physmap.yaml#
--- arch/arm/boot/dts/imx1-ads.dts | 2 +- arch/arm/boot/dts/imx1-apf9328.dts | 2 +- arch/arm/boot/dts/imx27-eukrea-cpuimx27.dtsi | 2 +- arch/arm/boot/dts/imx27-phytec-phycore-som.dtsi | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/imx1-ads.dts +1 -1
@@ -71,7 +71,7 @@ pinctrl-0 = <&pinctrl_weim>; status = "okay"; - nor: nor@0,0 { + nor: flash@0,0 { compatible = "cfi-flash"; reg = <0 0x00000000 0x02000000>; bank-width = <4>;
arch/arm/boot/dts/imx1-apf9328.dts +1 -1
@@ -51,7 +51,7 @@ pinctrl-0 = <&pinctrl_weim>; status = "okay"; - nor: nor@0,0 { + nor: flash@0,0 { compatible = "cfi-flash"; reg = <0 0x00000000 0x02000000>; bank-width = <2>;
arch/arm/boot/dts/imx27-eukrea-cpuimx27.dtsi +1 -1
@@ -96,7 +96,7 @@ &weim { status = "okay"; - nor: nor@0,0 { + nor: flash@0,0 { #address-cells = <1>; #size-cells = <1>; compatible = "cfi-flash";
arch/arm/boot/dts/imx27-phytec-phycore-som.dtsi +1 -1
@@ -328,7 +328,7 @@ &weim { status = "okay"; - nor: nor@0,0 { + nor: flash@0,0 { compatible = "cfi-flash"; reg = <0 0x00000000 0x02000000>; bank-width = <2>;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 87/202 ARM: dts: imx27: Fix sram node
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
[ Upstream commit 2fb7b2a2f06bb3f8321cf26c33e4e820c5b238b6 ]
Per sram.yaml, address-cells, size-cells and ranges are mandatory.
Pass them to fix the following dt-schema warnings:
--- arch/arm/boot/dts/imx27.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx27.dtsi +3 -0
@@ -588,6 +588,9 @@ iram: iram@ffff4c00 { compatible = "mmio-sram"; reg = <0xffff4c00 0xb400>; + ranges = <0 0xffff4c00 0xb400>; + #address-cells = <1>; + #size-cells = <1>; }; }; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 88/202 ARM: dts: imx1: Fix sram node
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
[ Upstream commit c248e535973088ba7071ff6f26ab7951143450af ]
Per sram.yaml, address-cells, size-cells and ranges are mandatory.
The node name should be sram.
Change the node name and pass the required properties to fix the following dt-schema warnings:
imx1-apf9328.dtb: esram@300000: $nodename:0: 'esram@300000' does not match '^sram(@.*)?'
from schema $id: http://devicetree.org/schemas/sram/sram.yaml#
imx1-apf9328.dtb: esram@300000: '#address-cells' is a required property
from schema $id: http://devicetree.org/schemas/sram/sram.yaml#
imx1-apf9328.dtb: esram@300000: '#size-cells' is a required property
from schema $id: http://devicetree.org/schemas/sram/sram.yaml#
imx1-apf9328.dtb: esram@300000: 'ranges' is a required property
from schema $id: http://devicetree.org/schemas/sram/sram.yaml#
--- arch/arm/boot/dts/imx1.dtsi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/boot/dts/imx1.dtsi +4 -1
@@ -268,9 +268,12 @@ status = "disabled"; }; - esram: esram@300000 { + esram: sram@300000 { compatible = "mmio-sram"; reg = <0x00300000 0x20000>; + ranges = <0 0x00300000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; }; }; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 89/202 ARM: dts: imx27-apf27dev: Fix LED name
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
[ Upstream commit dc35e253d032b959d92e12f081db5b00db26ae64 ]
Per leds-gpio.yaml, the led names should start with 'led'.
Change it to fix the following dt-schema warning:
imx27-apf27dev.dtb: leds: 'user' does not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/leds/leds-gpio.yaml#
--- arch/arm/boot/dts/imx27-apf27dev.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx27-apf27dev.dts +1 -1
@@ -53,7 +53,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_gpio_leds>; - user { + led-user { label = "Heartbeat"; gpios = <&gpio6 14 GPIO_ACTIVE_HIGH>; linux,default-trigger = "heartbeat";
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 90/202 ARM: dts: imx23-sansa: Use preferred i2c-gpios properties
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
[ Upstream commit e3aa1a82fb20ee97597022f6528823a8ab82bde6 ]
The 'gpios' property to describe the SDA and SCL GPIOs is considered deprecated according to i2c-gpio.yaml.
Switch to the preferred 'sda-gpios' and 'scl-gpios' properties.
This fixes the following schema warnings:
imx23-sansa.dtb: i2c-0: 'sda-gpios' is a required property
from schema $id: http://devicetree.org/schemas/i2c/i2c-gpio.yaml#
imx23-sansa.dtb: i2c-0: 'scl-gpios' is a required property
from schema $id: http://devicetree.org/schemas/i2c/i2c-gpio.yaml#
--- arch/arm/boot/dts/imx23-sansa.dts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
arch/arm/boot/dts/imx23-sansa.dts +4 -8
@@ -175,10 +175,8 @@ #address-cells = <1>; #size-cells = <0>; compatible = "i2c-gpio"; - gpios = < - &gpio1 24 0 /* SDA */ - &gpio1 22 0 /* SCL */ - >; + sda-gpios = <&gpio1 24 0>; + scl-gpios = <&gpio1 22 0>; i2c-gpio,delay-us = <2>; /* ~100 kHz */ };
@@ -186,10 +184,8 @@ #address-cells = <1>; #size-cells = <0>; compatible = "i2c-gpio"; - gpios = < - &gpio0 31 0 /* SDA */ - &gpio0 30 0 /* SCL */ - >; + sda-gpios = <&gpio0 31 0>; + scl-gpios = <&gpio0 30 0>; i2c-gpio,delay-us = <2>; /* ~100 kHz */ touch: touch@20 {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 91/202 ARM: dts: imx23/28: Fix the DMA controller node name
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
[ Upstream commit 858d83ca4b50bbc8693d95cc94310e6d791fb2e6 ]
Per fsl,mxs-dma.yaml, the node name should be 'dma-controller'.
Change it to fix the following dt-schema warning.
imx28-apf28.dtb: dma-apbx@80024000: $nodename:0: 'dma-apbx@80024000' does not match '^dma-controller(@.*)?$'
from schema $id: http://devicetree.org/schemas/dma/fsl,mxs-dma.yaml#
--- arch/arm/boot/dts/imx23.dtsi | 2 +- arch/arm/boot/dts/imx28.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/imx23.dtsi +1 -1
@@ -406,7 +406,7 @@ status = "disabled"; }; - dma_apbx: dma-apbx@80024000 { + dma_apbx: dma-controller@80024000 { compatible = "fsl,imx23-dma-apbx"; reg = <0x80024000 0x2000>; interrupts = <7 5 9 26
arch/arm/boot/dts/imx28.dtsi +1 -1
@@ -984,7 +984,7 @@ status = "disabled"; }; - dma_apbx: dma-apbx@80024000 { + dma_apbx: dma-controller@80024000 { compatible = "fsl,imx28-dma-apbx"; reg = <0x80024000 0x2000>; interrupts = <78 79 66 0
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 92/202 md: Whenassemble the array, consult the superblock of the freshest device
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Lyakas <[email protected]>
[ Upstream commit dc1cc22ed58f11d58d8553c5ec5f11cbfc3e3039 ]
Upon assembling the array, both kernel and mdadm allow the devices to have event counter difference of 1, and still consider them as up-to-date. However, a device whose event count is behind by 1, may in fact not be up-to-date, and array resync with such a device may cause data corruption.
To avoid this, consult the superblock of the freshest device about the status of a device, whose event counter is behind by 1.
--- drivers/md/md.c | 54 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 10 deletions(-)
drivers/md/md.c +44 -10
@@ -1034,6 +1034,7 @@ struct super_type {struct md_rdev *refdev, int minor_version);int (*validate_super)(struct mddev *mddev, +struct md_rdev *freshest,struct md_rdev *rdev);void (*sync_super)(struct mddev *mddev,struct md_rdev *rdev);
@@ -1160,8 +1161,9 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor/* * validate_super for 0.90.0 +* note: we are not using "freshest" for 0.9 superblock */ -static int super_90_validate (struct mddev *mddev,struct md_rdev *rdev) +static int super_90_validate (struct mddev *mddev,struct md_rdev *freshest,struct md_rdev *rdev) {mdp_disk_t *desc;mdp_super_t *sb =page_address (rdev->sb_page);
@@ -1665,7 +1667,7 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_return ret; } -static int super_1_validate (struct mddev *mddev,struct md_rdev *rdev) +static int super_1_validate (struct mddev *mddev,struct md_rdev *freshest,struct md_rdev *rdev) {struct mdp_superblock_1 *sb =page_address (rdev->sb_page);__u64 ev1 =le64_to_cpu (sb->events);
@@ -1761,13 +1763,15 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev) } }else if (mddev->pers ==NULL ) {/* Insist of good event counter while assembling, except for -* spares (which don't need an event count) */ - ++ev1; +* spares (which don't need an event count). +* Similar to mdadm, we allow event counter difference of 1 +* from the freshest device. +*/ if (rdev->desc_nr >=0 && rdev->desc_nr <le32_to_cpu (sb->max_dev) && (le16_to_cpu (sb->dev_roles[rdev->desc_nr]) <MD_DISK_ROLE_MAX ||le16_to_cpu (sb->dev_roles[rdev->desc_nr]) ==MD_DISK_ROLE_JOURNAL )) -if (ev1 < mddev->events) +if (ev1 +1 < mddev->events)return -EINVAL ; }else if (mddev->bitmap) {/* If adding to array with a bitmap, then we can accept an
@@ -1788,8 +1792,38 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev) rdev->desc_nr >= le32_to_cpu(sb->max_dev)) { role =MD_DISK_ROLE_SPARE ; rdev->desc_nr =-1 ; - } else + } else if (mddev->pers == NULL && freshest && ev1 < mddev->events) { +/* +* If we are assembling, and our event counter is smaller than the +* highest event counter, we cannot trust our superblock about the role. +* It could happen that our rdev was marked as Faulty, and all other +* superblocks were updated with +1 event counter. +* Then, before the next superblock update, which typically happens when +* remove_and_add_spares() removes the device from the array, there was +* a crash or reboot. +* If we allow current rdev without consulting the freshest superblock, +* we could cause data corruption. +* Note that in this case our event counter is smaller by 1 than the +* highest, otherwise, this rdev would not be allowed into array; +* both kernel and mdadm allow event counter difference of 1. +*/ +struct mdp_superblock_1 *freshest_sb =page_address (freshest->sb_page); +u32 freshest_max_dev =le32_to_cpu (freshest_sb->max_dev); + +if (rdev->desc_nr >= freshest_max_dev) { +/* this is unexpected, better not proceed */ +pr_warn ("md: %s: rdev[%pg]: desc_nr(%d) >= freshest(%pg)->sb->max_dev(%u)\n" , +mdname (mddev), rdev->bdev, rdev->desc_nr, + freshest->bdev, freshest_max_dev); +return -EUCLEAN ; + } + + role =le16_to_cpu (freshest_sb->dev_roles[rdev->desc_nr]); +pr_debug ("md: %s: rdev[%pg]: role=%d(0x%x) according to freshest %pg\n" , +mdname (mddev), rdev->bdev, role, role, freshest->bdev); + } else { role =le16_to_cpu (sb->dev_roles[rdev->desc_nr]); + }switch (role) {case MD_DISK_ROLE_SPARE :/* spare */ break ;
@@ -2691,7 +2725,7 @@ static int add_bound_rdev(struct md_rdev *rdev)* and should be added immediately. */ super_types[mddev->major_version]. -validate_super (mddev, rdev); +validate_super (mddev,NULL /*freshest*/ , rdev);if (add_journal)mddev_suspend (mddev); err = mddev->pers->hot_add_disk (mddev, rdev);
@@ -3593,7 +3627,7 @@ static void analyze_sbs(struct mddev *mddev) } super_types[mddev->major_version]. -validate_super (mddev, freshest); +validate_super (mddev,NULL /*freshest*/ , freshest); i =0 ;rdev_for_each_safe (rdev, tmp, mddev) {
@@ -3608,7 +3642,7 @@ static void analyze_sbs(struct mddev *mddev) }if (rdev != freshest) {if (super_types[mddev->major_version]. -validate_super (mddev, rdev)) { +validate_super (mddev, freshest, rdev)) {pr_warn ("md: kicking non-fresh %s from array!\n" ,bdevname (rdev->bdev,b));md_kick_rdev_from_array (rdev);
@@ -6453,7 +6487,7 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info) rdev->saved_raid_disk = rdev->raid_disk; }else super_types[mddev->major_version]. -validate_super (mddev, rdev); +validate_super (mddev,NULL /*freshest*/ , rdev);if ((info->state & (1 <<MD_DISK_SYNC )) && rdev->raid_disk != info->raid_disk) {/* This was a hot-add request, but events doesn't
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 93/202 wifi: rtl8xxxu: Add additional USB IDs for RTL8192EU devices
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zenm Chen <[email protected]>
[ Upstream commit 4e87ca403e2008b9e182239e1abbf6876a55eb33 ]
Add additional USB IDs found in the vendor driver from
https://github.com/Mange/rtl8192eu-linux-driver to support more RTL8192EU devices.
--- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +12 -0
@@ -6366,6 +6366,18 @@ static const struct usb_device_id dev_table[] = { .driver_info = (unsigned long)&rtl8192eu_fops}, {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x818c, 0xff, 0xff, 0xff), .driver_info = (unsigned long)&rtl8192eu_fops}, +/* D-Link DWA-131 rev C1 */ +{USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x3312, 0xff, 0xff, 0xff), + .driver_info = (unsigned long)&rtl8192eu_fops}, +/* TP-Link TL-WN8200ND V2 */ +{USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x0126, 0xff, 0xff, 0xff), + .driver_info = (unsigned long)&rtl8192eu_fops}, +/* Mercusys MW300UM */ +{USB_DEVICE_AND_INTERFACE_INFO(0x2c4e, 0x0100, 0xff, 0xff, 0xff), + .driver_info = (unsigned long)&rtl8192eu_fops}, +/* Mercusys MW300UH */ +{USB_DEVICE_AND_INTERFACE_INFO(0x2c4e, 0x0104, 0xff, 0xff, 0xff), + .driver_info = (unsigned long)&rtl8192eu_fops}, #endif { } };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 94/202 wifi: rtlwifi: rtl8723{be,ae}: using calculate_bit_shift()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Hui <[email protected]>
[ Upstream commit 5c16618bc06a41ad68fd8499a21d35ef57ca06c2 ]
Using calculate_bit_shift() to replace rtl8723_phy_calculate_bit_shift(). And fix an undefined bitwise shift behavior problem.
--- drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c | 6 +++--- drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c +3 -3
@@ -72,7 +72,7 @@ u32 rtl8723e_phy_query_rf_reg(struct ieee80211_hw *hw, rfpath, regaddr); } - bitshift =rtl8723_phy_calculate_bit_shift (bitmask); + bitshift =calculate_bit_shift (bitmask); readback_value = (original_value & bitmask) >> bitshift;spin_unlock_irqrestore (&rtlpriv->locks.rf_lock, flags);
@@ -104,7 +104,7 @@ void rtl8723e_phy_set_rf_reg(struct ieee80211_hw *hw, original_value =rtl8723_phy_rf_serial_read (hw, rfpath, regaddr); - bitshift =rtl8723_phy_calculate_bit_shift (bitmask); + bitshift =calculate_bit_shift (bitmask); data = ((original_value & (~bitmask)) | (data << bitshift));
@@ -113,7 +113,7 @@ void rtl8723e_phy_set_rf_reg(struct ieee80211_hw *hw,rtl8723_phy_rf_serial_write (hw, rfpath, regaddr, data); }else {if (bitmask !=RFREG_OFFSET_MASK ) { - bitshift =rtl8723_phy_calculate_bit_shift (bitmask); + bitshift =calculate_bit_shift (bitmask); data = ((original_value & (~bitmask)) | (data << bitshift));
drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c +2 -2
@@ -64,7 +64,7 @@ u32 rtl8723be_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,spin_lock_irqsave (&rtlpriv->locks.rf_lock, flags); original_value =rtl8723_phy_rf_serial_read (hw, rfpath, regaddr); - bitshift =rtl8723_phy_calculate_bit_shift (bitmask); + bitshift =calculate_bit_shift (bitmask); readback_value = (original_value & bitmask) >> bitshift;spin_unlock_irqrestore (&rtlpriv->locks.rf_lock, flags);
@@ -92,7 +92,7 @@ void rtl8723be_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path path,if (bitmask !=RFREG_OFFSET_MASK ) { original_value =rtl8723_phy_rf_serial_read (hw, path, regaddr); - bitshift =rtl8723_phy_calculate_bit_shift (bitmask); + bitshift =calculate_bit_shift (bitmask); data = ((original_value & (~bitmask)) | (data << bitshift)); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 95/202 wifi: cfg80211: free beacon_ies when overridden from hidden BSS
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Berg <[email protected]>
[ Upstream commit 32af9a9e1069e55bc02741fb00ac9d0ca1a2eaef ]
This is a more of a cosmetic fix. The branch will only be taken if proberesp_ies is set, which implies that beacon_ies is not set unless we are connected to an AP that just did a channel switch. And, in that case we should have found the BSS in the internal storage to begin with.
--- net/wireless/scan.c | 4 ++++ 1 file changed, 4 insertions(+)
net/wireless/scan.c +4 -0
@@ -1018,8 +1018,12 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev,list_add (&new->hidden_list, &hidden->hidden_list); hidden->refcount++; + + ies = (void *)rcu_dereference (new->pub.beacon_ies);rcu_assign_pointer (new->pub.beacon_ies, hidden->pub.beacon_ies); +if (ies) +kfree_rcu (ies, rcu_head); } }else {/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 96/202 f2fs: fix to check return value of f2fs_reserve_new_block()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 956fa1ddc132e028f3b7d4cf17e6bfc8cb36c7fd ]
Let's check return value of f2fs_reserve_new_block() in do_recover_data() rather than letting it fails silently.
Also refactoring check condition on return value of f2fs_reserve_new_block() as below:
- trigger f2fs_bug_on() only for ENOSPC case;
- use do-while statement to avoid redundant codes;
--- fs/f2fs/recovery.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
fs/f2fs/recovery.c +17 -6
@@ -548,7 +548,16 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode,*/ if (dest ==NEW_ADDR ) {f2fs_truncate_data_blocks_range (&dn,1 ); -f2fs_reserve_new_block (&dn); +do { + err =f2fs_reserve_new_block (&dn); +if (err == -ENOSPC ) { +f2fs_bug_on (sbi,1 ); +break ; + } + }while (err && +IS_ENABLED (CONFIG_F2FS_FAULT_INJECTION )); +if (err) + goto err;continue ; }
@@ -556,12 +565,14 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode,if (f2fs_is_valid_blkaddr (sbi, dest,META_POR )) {if (src ==NULL_ADDR ) { - err =f2fs_reserve_new_block (&dn); -while (err && -IS_ENABLED (CONFIG_F2FS_FAULT_INJECTION )) +do { err =f2fs_reserve_new_block (&dn); -/* We should not get -ENOSPC */ -f2fs_bug_on (sbi, err); +if (err == -ENOSPC ) { +f2fs_bug_on (sbi,1 ); +break ; + } + }while (err && +IS_ENABLED (CONFIG_F2FS_FAULT_INJECTION ));if (err) goto err; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 97/202 ASoC: doc: Fix undefined SND_SOC_DAPM_NOPM argument
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cristian Ciocaltea <[email protected]>
[ Upstream commit 67c7666fe808c3a7af3cc6f9d0a3dd3acfd26115 ]
The virtual widget example makes use of an undefined SND_SOC_DAPM_NOPM argument passed to SND_SOC_DAPM_MIXER(). Replace with the correct SND_SOC_NOPM definition.
--- Documentation/sound/soc/dapm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/sound/soc/dapm.rst +1 -1
@@ -234,7 +234,7 @@ corresponding soft power control. In this case it is necessary to create a virtual widget - a widget with no control bits e.g. :: - SND_SOC_DAPM_MIXER("AC97 Mixer", SND_SOC_DAPM_NOPM, 0, 0, NULL, 0), + SND_SOC_DAPM_MIXER("AC97 Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), This can be used to merge to signal paths together in software.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 98/202 fast_dput(): handle underflows gracefully
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit 504e08cebe1d4e1efe25f915234f646e74a364a8 ]
If refcount is less than 1, we should just warn, unlock dentry and return true, so that the caller doesn't try to do anything else.
Taking care of that leaves the rest of "lockref_put_return() has failed" case equivalent to "decrement refcount and rejoin the normal slow path after the point where we grab ->d_lock".
NOTE: lockref_put_return() is strictly a fastpath thing - unlike the rest of lockref primitives, it does not contain a fallback. Caller (and it looks like fast_dput() is the only legitimate one in the entire kernel) has to do that itself. Reasons for lockref_put_return() failures:
* ->d_lock held by somebody
* refcount <= 0
* ... or an architecture not supporting lockref use of
cmpxchg - sparc, anything non-SMP, config with spinlock debugging...
We could add a fallback, but it would be a clumsy API - we'd have to distinguish between:
(1) refcount > 1 - decremented, lock not held on return
(2) refcount < 1 - left alone, probably no sense to hold the lock
(3) refcount is 1, no cmphxcg - decremented, lock held on return
(4) refcount is 1, cmphxcg supported - decremented, lock *NOT* held on return.
We want to return with no lock held in case (4); that's the whole point of that thing. We very much do not want to have the fallback in case (3) return without a lock, since the caller might have to retake it in that case.
So it wouldn't be more convenient than doing the fallback in the caller and it would be very easy to screw up, especially since the test coverage would suck - no way to test (3) and (4) on the same kernel build.
--- fs/dcache.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/dcache.c +4 -3
@@ -727,12 +727,12 @@ static inline bool fast_dput(struct dentry *dentry)*/ if (unlikely (ret <0 )) {spin_lock (&dentry->d_lock); -if (dentry->d_lockref.count >1 ) { - dentry->d_lockref.count--; +if (WARN_ON_ONCE (dentry->d_lockref.count <=0 )) {spin_unlock (&dentry->d_lock);return true; } -return false; + dentry->d_lockref.count--; + goto locked; }/*
@@ -783,6 +783,7 @@ static inline bool fast_dput(struct dentry *dentry)* else could have killed it and marked it dead. Either way, we * don't need to do anything else. */ +locked:if (dentry->d_lockref.count) {spin_unlock (&dentry->d_lock);return true;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 99/202 RDMA/IPoIB: Fix error code return in ipoib_mcast_join
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Wang <[email protected]>
[ Upstream commit 753fff78f430704548f45eda52d6d55371a52c0f ]
Return the error code in case of ib_sa_join_multicast fail.
--- drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/ulp/ipoib/ipoib_multicast.c +1 -0
@@ -558,6 +558,7 @@ static int ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast)spin_unlock_irq (&priv->lock);complete (&mcast->done);spin_lock_irq (&priv->lock); +return ret; }return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 100/202 drm/drm_file: fix use of uninitialized variable
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
[ Upstream commit 1d3062fad9c7313fff9970a88e0538a24480ffb8 ]
smatch reports:
drivers/gpu/drm/drm_file.c:967 drm_show_memory_stats() error: uninitialized symbol 'supported_status'.
'supported_status' is only set in one code path. I'm not familiar with the code to say if that path will always be ran in real life, but whether that is the case or not, I think it is good to initialize 'supported_status' to 0 to silence the warning (and possibly fix a bug).
--- drivers/gpu/drm/drm_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_file.c +1 -1
@@ -299,7 +299,7 @@ int drm_open(struct inode *inode, struct file *filp) {struct drm_device *dev;struct drm_minor *minor; -int retcode; +int retcode =0 ;int need_setup =0 ; minor =drm_minor_acquire (iminor (inode));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 101/202 drm/framebuffer: Fix use of uninitialized variable
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
[ Upstream commit f9af8f0c1dc567a5a6a6318ff324c45d80d4a60f ]
smatch reports:
drivers/gpu/drm/drm_framebuffer.c:654 drm_mode_getfb2_ioctl() error: uninitialized symbol 'ret'.
'ret' is possibly not set when there are no errors, causing the error above. I can't say if that ever happens in real-life, but in any case I think it is good to initialize 'ret' to 0.
--- drivers/gpu/drm/drm_framebuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_framebuffer.c +1 -1
@@ -538,7 +538,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,struct drm_framebuffer *fb;unsigned flags;int num_clips; -int ret; +int ret =0 ;if (!drm_core_check_feature (dev,DRIVER_MODESET ))return -EINVAL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 102/202 drm/mipi-dsi: Fix detach call without attach
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
[ Upstream commit 90d50b8d85834e73536fdccd5aa913b30494fef0 ]
It's been reported that DSI host driver's detach can be called without the attach ever happening:
https://lore.kernel.org/all/[email protected]/
After reading the code, I think this is what happens:
We have a DSI host defined in the device tree and a DSI peripheral under that host (i.e. an i2c device using the DSI as data bus doesn't exhibit this behavior).
The host driver calls mipi_dsi_host_register(), which causes (via a few functions) mipi_dsi_device_add() to be called for the DSI peripheral. So now we have a DSI device under the host, but attach hasn't been called.
Normally the probing of the devices continues, and eventually the DSI peripheral's driver will call mipi_dsi_attach(), attaching the peripheral.
However, if the host driver's probe encounters an error after calling mipi_dsi_host_register(), and before the peripheral has called mipi_dsi_attach(), the host driver will do cleanups and return an error from its probe function. The cleanups include calling mipi_dsi_host_unregister().
mipi_dsi_host_unregister() will call two functions for all its DSI peripheral devices: mipi_dsi_detach() and mipi_dsi_device_unregister(). The latter makes sense, as the device exists, but the former may be wrong as attach has not necessarily been done.
To fix this, track the attached state of the peripheral, and only detach from mipi_dsi_host_unregister() if the peripheral was attached.
Note that I have only tested this with a board with an i2c DSI peripheral, not with a "pure" DSI peripheral.
However, slightly related, the unregister machinery still seems broken. E.g. if the DSI host driver is unbound, it'll detach and unregister the DSI peripherals. After that, when the DSI peripheral driver unbound it'll call detach either directly or using the devm variant, leading to a crash. And probably the driver will crash if it happens, for some reason, to try to send a message via the DSI bus.
But that's another topic.
--- drivers/gpu/drm/drm_mipi_dsi.c | 17 +++++++++++++++-- include/drm/drm_mipi_dsi.h | 2 ++ 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_mipi_dsi.c +15 -2
@@ -305,7 +305,8 @@ static int mipi_dsi_remove_device_fn(struct device *dev, void *priv) {struct mipi_dsi_device *dsi =to_mipi_dsi_device (dev); -mipi_dsi_detach (dsi); +if (dsi->attached) +mipi_dsi_detach (dsi);mipi_dsi_device_unregister (dsi);return 0 ;
@@ -328,11 +329,18 @@ EXPORT_SYMBOL(mipi_dsi_host_unregister);int mipi_dsi_attach (struct mipi_dsi_device *dsi) {const struct mipi_dsi_host_ops *ops = dsi->host->ops; +int ret;if (!ops || !ops->attach)return -ENOSYS ; -return ops->attach (dsi->host, dsi); + ret = ops->attach (dsi->host, dsi); +if (ret) +return ret; + + dsi->attached = true; + +return 0 ; }EXPORT_SYMBOL (mipi_dsi_attach);
@@ -344,9 +352,14 @@ int mipi_dsi_detach(struct mipi_dsi_device *dsi) {const struct mipi_dsi_host_ops *ops = dsi->host->ops; +if (WARN_ON (!dsi->attached)) +return -EINVAL ; +if (!ops || !ops->detach)return -ENOSYS ; + dsi->attached = false; +return ops->detach (dsi->host, dsi); }EXPORT_SYMBOL (mipi_dsi_detach);
include/drm/drm_mipi_dsi.h +2 -0
@@ -163,6 +163,7 @@ struct mipi_dsi_device_info {* struct mipi_dsi_device - DSI peripheral device * @host: DSI host for this peripheral * @dev: driver model device node for this peripheral +* @attached: the DSI device has been successfully attached * @name: DSI peripheral chip type * @channel: virtual channel assigned to the peripheral * @format: pixel format for video mode
@@ -172,6 +173,7 @@ struct mipi_dsi_device_info {struct mipi_dsi_device {struct mipi_dsi_host *host;struct device dev; +bool attached;char name[DSI_DEV_NAME_SIZE ];unsigned int channel;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 103/202 media: stk1160: Fixed high volume of stk1160_dbg messages
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ghanshyam Agrawal <[email protected]>
[ Upstream commit b3695e86d25aafbe175dd51f6aaf6f68d341d590 ]
The function stk1160_dbg gets called too many times, which causes the output to get flooded with messages. Since stk1160_dbg uses printk, it is now replaced with printk_ratelimited.
--- drivers/media/usb/stk1160/stk1160-video.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/media/usb/stk1160/stk1160-video.c +2 -3
@@ -117,8 +117,7 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len)/* * TODO: These stk1160_dbg are very spammy! -* We should 1) check why we are getting them -* and 2) add ratelimit. +* We should check why we are getting them. * * UPDATE: One of the reasons (the only one?) for getting these * is incorrect standard (mismatch between expected and configured).
@@ -161,7 +160,7 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len)/* Let the bug hunt begin! sanity checks! */ if (lencopy <0 ) { -stk1160_dbg ("copy skipped: negative lencopy\n" ); +printk_ratelimited (KERN_DEBUG "copy skipped: negative lencopy\n" );return ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 104/202 media: rockchip: rga: fix swizzling for RGB formats
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Tretter <[email protected]>
[ Upstream commit 9e7dc39260edac180c206bb6149595a40eabae3e ]
When using 32 bit RGB formats, the RGA on the rk3568 produces wrong colors as the wrong color channels are read or written. The reason is that the format description for the channel swizzeling is wrong and the wrong bits are configured. For example, when converting ARGB32 to NV12, the alpha channel is used as blue channel.. This doesn't happen if the color format is the same on both sides.
Fix the color_swap settings of the formats to correctly handle 32 bit RGB formats.
For RGA_COLOR_FMT_XBGR8888, the RGA_COLOR_ALPHA_SWAP bit doesn't have an effect. Thus, it isn't possible to handle the V4L2_PIX_FMT_XRGB32. Thus, it is removed from the list of supported formats.
--- drivers/media/platform/rockchip/rga/rga.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/media/platform/rockchip/rga/rga.c +3 -12
@@ -195,25 +195,16 @@ static int rga_setup_ctrls(struct rga_ctx *ctx)static struct rga_fmt formats[] = { { .fourcc =V4L2_PIX_FMT_ARGB32 , - .color_swap =RGA_COLOR_RB_SWAP , + .color_swap =RGA_COLOR_ALPHA_SWAP , .hw_format =RGA_COLOR_FMT_ABGR8888 , .depth =32 , .uv_factor =1 , .y_div =1 , .x_div =1 , }, - { - .fourcc =V4L2_PIX_FMT_XRGB32 , - .color_swap =RGA_COLOR_RB_SWAP , - .hw_format =RGA_COLOR_FMT_XBGR8888 , - .depth =32 , - .uv_factor =1 , - .y_div =1 , - .x_div =1 , - }, { .fourcc =V4L2_PIX_FMT_ABGR32 , - .color_swap =RGA_COLOR_ALPHA_SWAP , + .color_swap =RGA_COLOR_RB_SWAP , .hw_format =RGA_COLOR_FMT_ABGR8888 , .depth =32 , .uv_factor =1 ,
@@ -222,7 +213,7 @@ static struct rga_fmt formats[] = { }, { .fourcc = V4L2_PIX_FMT_XBGR32, - .color_swap = RGA_COLOR_ALPHA_SWAP, + .color_swap = RGA_COLOR_RB_SWAP, .hw_format = RGA_COLOR_FMT_XBGR8888, .depth = 32, .uv_factor = 1,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 105/202 PCI: add INTEL_HDA_ARL to pci_ids.h
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 5ec42bf04d72fd6d0a6855810cc779e0ee31dfd7 ]
The PCI ID insertion follows the increasing order in the table, but this hardware follows MTL (MeteorLake).
--- include/linux/pci_ids.h | 1 + 1 file changed, 1 insertion(+)
include/linux/pci_ids.h +1 -0
@@ -3004,6 +3004,7 @@#define PCI_DEVICE_ID_INTEL_82443GX_0 0x71a0#define PCI_DEVICE_ID_INTEL_82443GX_2 0x71a2#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601 +#define PCI_DEVICE_ID_INTEL_HDA_ARL 0x7728#define PCI_DEVICE_ID_INTEL_SCH_LPC 0x8119#define PCI_DEVICE_ID_INTEL_SCH_IDE 0x811a#define PCI_DEVICE_ID_INTEL_E6XX_CU 0x8183
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 106/202 ALSA: hda: Intel: add HDA_ARL PCI ID support
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pierre-Louis Bossart <[email protected]>
[ Upstream commit a31014ebad617868c246d3985ff80d891f03711e ]
Yet another PCI ID.
--- sound/pci/hda/hda_intel.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/hda_intel.c +2 -0
@@ -2615,6 +2615,8 @@ static const struct pci_device_id azx_ids[] = {/* Icelake */ { PCI_DEVICE(0x8086, 0x34c8), .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, +/* Arrow Lake */ + { PCI_DEVICE_DATA(INTEL, HDA_ARL, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE) },/* Broxton-P(Apollolake) */ { PCI_DEVICE(0x8086, 0x5a98), .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON },
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 107/202 drm/exynos: Call drm_atomic_helper_shutdown() at shutdown/unbind time
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit 16ac5b21b31b439f03cdf44c153c5f5af94fb3eb ]
Based on grepping through the source code this driver appears to be missing a call to drm_atomic_helper_shutdown() at system shutdown time and at driver unbind time. Among other things, this means that if a panel is in use that it won't be cleanly powered off at system shutdown time.
The fact that we should call drm_atomic_helper_shutdown() in the case of OS shutdown/restart and at driver remove (or unbind) time comes straight out of the kernel doc "driver instance overview" in drm_drv.c.
A few notes about this fix:
- When adding drm_atomic_helper_shutdown() to the unbind path, I added it after drm_kms_helper_poll_fini() since that's when other drivers seemed to have it.
- Technically with a previous patch, ("drm/atomic-helper:
drm_atomic_helper_shutdown(NULL) should be a noop"), we don't actually need to check to see if our "drm" pointer is NULL before calling drm_atomic_helper_shutdown(). We'll leave the "if" test in, though, so that this patch can land without any dependencies. It could potentially be removed later.
- This patch also makes sure to set the drvdata to NULL in the case of bind errors to make sure that shutdown can't access freed data.
--- drivers/gpu/drm/exynos/exynos_drm_drv.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_drv.c +11 -0
@@ -410,6 +410,7 @@ static int exynos_drm_bind(struct device *dev)drm_release_iommu_mapping (drm); err_free_private:kfree (private); +dev_set_drvdata (dev,NULL ); err_free_drm:drm_dev_put (drm);
@@ -424,6 +425,7 @@ static void exynos_drm_unbind(struct device *dev)exynos_drm_fbdev_fini (drm);drm_kms_helper_poll_fini (drm); +drm_atomic_helper_shutdown (drm);component_unbind_all (drm->dev, drm);drm_mode_config_cleanup (drm);
@@ -461,9 +463,18 @@ static int exynos_drm_platform_remove(struct platform_device *pdev)return 0 ; } +static void exynos_drm_platform_shutdown (struct platform_device *pdev) +{ +struct drm_device *drm =platform_get_drvdata (pdev); + +if (drm) +drm_atomic_helper_shutdown (drm); +} +static struct platform_driver exynos_drm_platform_driver = { .probe = exynos_drm_platform_probe, .remove = exynos_drm_platform_remove, + .shutdown = exynos_drm_platform_shutdown, .driver = { .name ="exynos-drm" , .pm = &exynos_drm_pm_ops,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 108/202 IB/ipoib: Fix mcast list locking
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vacek <[email protected]>
[ Upstream commit 4f973e211b3b1c6d36f7c6a19239d258856749f9 ]
Releasing the priv->lock while iterating the priv->multicast_list in ipoib_mcast_join_task() opens a window for ipoib_mcast_dev_flush() to remove the items while in the middle of iteration. If the mcast is removed while the lock was dropped, the for loop spins forever resulting in a hard lockup (as was reported on RHEL 4.18.0-372.75.1.el8_6 kernel):
Task A (kworker/u72:2 below) | Task B (kworker/u72:0 below)
-----------------------------------+-----------------------------------
ipoib_mcast_join_task(work) | ipoib_ib_dev_flush_light(work)
spin_lock_irq(&priv->lock) | __ipoib_ib_dev_flush(priv, ...)
list_for_each_entry(mcast, | ipoib_mcast_dev_flush(dev = priv->dev)
&priv->multicast_list, list) |
ipoib_mcast_join(dev, mcast) |
spin_unlock_irq(&priv->lock) |
| spin_lock_irqsave(&priv->lock, flags)
| list_for_each_entry_safe(mcast, tmcast,
| &priv->multicast_list, list)
| list_del(&mcast->list);
| list_add_tail(&mcast->list, &remove_list)
| spin_unlock_irqrestore(&priv->lock, flags)
spin_lock_irq(&priv->lock) |
| ipoib_mcast_remove_list(&remove_list)
(Here, `mcast` is no longer on the | list_for_each_entry_safe(mcast, tmcast,
`priv->multicast_list` and we keep | remove_list, list)
spinning on the `remove_list` of | >>> wait_for_completion(&mcast->done)
the other thread which is blocked |
and the list is still valid on |it's stack.)
Fix this by keeping the lock held and changing to GFP_ATOMIC to prevent eventual sleeps.
Unfortunately we could not reproduce the lockup and confirm this fix but based on the code review I think this fix should address such lockups.
crash> bc 31
PID: 747 TASK: ff1c6a1a007e8000 CPU: 31 COMMAND: "kworker/u72:2"
--
[exception RIP: ipoib_mcast_join_task+0x1b1]
RIP: ffffffffc0944ac1 RSP: ff646f199a8c7e00 RFLAGS: 00000002
RAX: 0000000000000000 RBX: ff1c6a1a04dc82f8 RCX: 0000000000000000
work (&priv->mcast_task{,.work})
RDX: ff1c6a192d60ac68 RSI: 0000000000000286 RDI: ff1c6a1a04dc8000
&mcast->list
RBP: ff646f199a8c7e90 R8: ff1c699980019420 R9: ff1c6a1920c9a000
R10: ff646f199a8c7e00 R11: ff1c6a191a7d9800 R12: ff1c6a192d60ac00
mcast
R13: ff1c6a1d82200000 R14: ff1c6a1a04dc8000 R15: ff1c6a1a04dc82d8
dev priv (&priv->lock) &priv->multicast_list (aka head)
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018--- drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_multicast.c +1 -5
@@ -543,21 +543,17 @@ static int ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast)/* SM supports sendonly-fullmember, otherwise fallback to full-member */ rec.join_state =SENDONLY_FULLMEMBER_JOIN ; } -spin_unlock_irq (&priv->lock); multicast =ib_sa_join_multicast (&ipoib_sa_client, priv->ca, priv->port, - &rec, comp_mask,GFP_KERNEL , + &rec, comp_mask,GFP_ATOMIC , ipoib_mcast_join_complete, mcast); -spin_lock_irq (&priv->lock);if (IS_ERR (multicast)) { ret =PTR_ERR (multicast);ipoib_warn (priv,"ib_sa_join_multicast failed, status %d\n" , ret);/* Requeue this join task with a backoff delay */ __ipoib_mcast_schedule_join_thread (priv, mcast,1 );clear_bit (IPOIB_MCAST_FLAG_BUSY , &mcast->flags); -spin_unlock_irq (&priv->lock);complete (&mcast->done); -spin_lock_irq (&priv->lock);return ret; }return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 109/202 media: ddbridge: fix an error code problem in ddb_probe
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Hui <[email protected]>
[ Upstream commit 09b4195021be69af1e1936cca995712a6d0f2562 ]
Error code is assigned to 'stat', return 'stat' rather than '-1'.
--- drivers/media/pci/ddbridge/ddbridge-main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/ddbridge/ddbridge-main.c +1 -1
@@ -247,7 +247,7 @@ static int ddb_probe(struct pci_dev *pdev,ddb_unmap (dev);pci_set_drvdata (pdev,NULL );pci_disable_device (pdev); -return -1 ; +return stat; }/****************************************************************************/
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 110/202 drm/msm/dpu: Ratelimit framedone timeout msgs
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <[email protected]>
[ Upstream commit 2b72e50c62de60ad2d6bcd86aa38d4ccbdd633f2 ]
When we start getting these, we get a *lot*. So ratelimit it to not flood dmesg.
Patchwork: https://patchwork.freedesktop.org/patch/571584/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 5 ++++- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +4 -1
@@ -53,6 +53,9 @@ (p) ? ((p)->hw_pp ? (p)->hw_pp->idx - PINGPONG_0 : -1) : -1, \ ##__VA_ARGS__) +#define DPU_ERROR_ENC_RATELIMITED (e, fmt, ...) DPU_ERROR_RATELIMITED("enc%d " fmt,\ + (e) ? (e)->base.base.id : -1, ##__VA_ARGS__) +/* * Two to anticipate panels that can do cmd/vid dynamic switching * plan is to create all possible physical encoder types, and switch between
@@ -2326,7 +2329,7 @@ static void dpu_encoder_frame_done_timeout(struct timer_list *t)return ; } -DPU_ERROR_ENC (dpu_enc,"frame done timeout\n" ); +DPU_ERROR_ENC_RATELIMITED (dpu_enc,"frame done timeout\n" ); event =DPU_ENCODER_FRAME_EVENT_ERROR ;trace_dpu_enc_frame_done_timeout (DRMID (drm_enc), event);
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +1 -0
@@ -61,6 +61,7 @@ } while (0)#define DPU_ERROR (fmt, ...) pr_err("[dpu error]" fmt, ##__VA_ARGS__) +#define DPU_ERROR_RATELIMITED (fmt, ...) pr_err_ratelimited("[dpu error]" fmt, ##__VA_ARGS__)/** * ktime_compare_safe - compare two ktime structures
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 111/202 clk: hi3620: Fix memory leak in hi3620_mmc_clk_init()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuan-Wei Chiu <[email protected]>
[ Upstream commit bfbea9e5667cfa9552c3d88f023386f017f6c308 ]
In cases where kcalloc() fails for the 'clk_data->clks' allocation, the code path does not handle the failure gracefully, potentially leading to a memory leak. This fix ensures proper cleanup by freeing the allocated memory for 'clk_data' before returning.
--- drivers/clk/hisilicon/clk-hi3620.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/hisilicon/clk-hi3620.c +3 -1
@@ -481,8 +481,10 @@ static void __init hi3620_mmc_clk_init(struct device_node *node)return ; clk_data->clks =kcalloc (num,sizeof (*clk_data->clks),GFP_KERNEL ); -if (!clk_data->clks) +if (!clk_data->clks) { +kfree (clk_data);return ; + }for (i =0 ; i < num; i++) {struct hisi_mmc_clock *mmc_clk = &hi3620_mmc_clks[i];
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 112/202 clk: mmp: pxa168: Fix memory leak in pxa168_clk_init()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuan-Wei Chiu <[email protected]>
[ Upstream commit 2fbabea626b6467eb4e6c4cb7a16523da12e43b4 ]
In cases where mapping of mpmu/apmu/apbc registers fails, the code path does not handle the failure gracefully, potentially leading to a memory leak. This fix ensures proper cleanup by freeing the allocated memory for 'pxa_unit' before returning.
--- drivers/clk/mmp/clk-of-pxa168.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/clk/mmp/clk-of-pxa168.c +3 -0
@@ -258,18 +258,21 @@ static void __init pxa168_clk_init(struct device_node *np) pxa_unit->mpmu_base =of_iomap (np,0 );if (!pxa_unit->mpmu_base) {pr_err ("failed to map mpmu registers\n" ); +kfree (pxa_unit);return ; } pxa_unit->apmu_base =of_iomap (np,1 );if (!pxa_unit->apmu_base) {pr_err ("failed to map apmu registers\n" ); +kfree (pxa_unit);return ; } pxa_unit->apbc_base =of_iomap (np,2 );if (!pxa_unit->apbc_base) {pr_err ("failed to map apbc registers\n" ); +kfree (pxa_unit);return ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 113/202 drm/amd/display: make flip_timestamp_in_us a 64-bit variable
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josip Pavic <[email protected]>
[ Upstream commit 6fb12518ca58412dc51054e2a7400afb41328d85 ]
[Why]
This variable currently overflows after about 71 minutes. This doesn't cause any known functional issues but it does make debugging more difficult.
[How]
Make it a 64-bit variable.
--- drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +1 -1
@@ -357,7 +357,7 @@ union dc_tiling_info { } gfx8;struct { -unsigned int num_pipes; +unsigned long long num_pipes;unsigned int num_banks;unsigned int pipe_interleave;unsigned int num_shader_engines;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 114/202 drm/amdgpu: Let KFD sync with VM fences
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Kuehling <[email protected]>
[ Upstream commit ec9ba4821fa52b5efdbc4cdf0a77497990655231 ]
Change the rules for amdgpu_sync_resv to let KFD synchronize with VM fences on page table reservations. This fixes intermittent memory corruption after evictions when using amdgpu_vm_handle_moved to update page tables for VM mappings managed through render nodes.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +2 -1
@@ -219,7 +219,8 @@ int amdgpu_sync_resv(struct amdgpu_device *adev,*/ fence_owner =amdgpu_sync_get_owner (f);if (fence_owner ==AMDGPU_FENCE_OWNER_KFD && - owner !=AMDGPU_FENCE_OWNER_UNDEFINED ) + owner !=AMDGPU_FENCE_OWNER_UNDEFINED && + owner !=AMDGPU_FENCE_OWNER_KFD )continue ;if (amdgpu_sync_same_dev (adev, f)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 115/202 drm/amdgpu: Drop fence check in to_amdgpu_amdkfd_fence()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivasan Shanmugam <[email protected]>
[ Upstream commit bf2ad4fb8adca89374b54b225d494e0b1956dbea ]
Return value of container_of(...) can't be null, so null check is not required for 'fence'. Hence drop its NULL check.
Fixes the below:drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c:93 to_amdgpu_amdkfd_fence() warn: can 'fence' even be NULL?
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c +1 -1
@@ -88,7 +88,7 @@ struct amdgpu_amdkfd_fence *to_amdgpu_amdkfd_fence(struct dma_fence *f)return NULL ; fence = container_of(f, struct amdgpu_amdkfd_fence, base); -if (fence && f->ops == &amdkfd_fence_ops) +if (f->ops == &amdkfd_fence_ops)return fence;return NULL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 116/202 leds: trigger: panic: Dont register panic notifier if creating the trigger failed
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiner Kallweit <[email protected]>
[ Upstream commit afacb21834bb02785ddb0c3ec197208803b74faa ]
It doesn't make sense to register the panic notifier if creating the panic trigger failed.
--- drivers/leds/trigger/ledtrig-panic.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/leds/trigger/ledtrig-panic.c +4 -1
@@ -67,10 +67,13 @@ static long led_panic_blink(int state)static int __init ledtrig_panic_init (void ) { +led_trigger_register_simple ("panic" , &trigger); +if (!trigger) +return -ENOMEM ; +atomic_notifier_chain_register (&panic_notifier_list, &led_trigger_panic_nb); -led_trigger_register_simple ("panic" , &trigger); panic_blink = led_panic_blink;return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 117/202 um: Fix naming clash between UML and scheduler
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Ivanov <[email protected]>
[ Upstream commit 541d4e4d435c8b9bfd29f70a1da4a2db97794e0a ]
__cant_sleep was already used and exported by the scheduler. The name had to be changed to a UML specific one.
--- arch/um/include/shared/kern_util.h | 2 +- arch/um/kernel/process.c | 2 +- arch/um/os-Linux/helper.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-)
arch/um/include/shared/kern_util.h +1 -1
@@ -49,7 +49,7 @@ extern void do_uml_exitcalls(void);* Are we disallowed to sleep? Used to choose between GFP_KERNEL and * GFP_ATOMIC. */ -extern int __cant_sleep (void ); +extern int __uml_cant_sleep (void );extern int get_current_pid (void );extern int copy_from_user_proc (void *to,void *from,int size);extern int cpu (void );
arch/um/kernel/process.c +1 -1
@@ -210,7 +210,7 @@ void arch_cpu_idle(void)local_irq_enable (); } -int __cant_sleep (void ) { +int __uml_cant_sleep (void ) {return in_atomic () ||irqs_disabled () ||in_interrupt ();/* Is in_interrupt() really needed? */ }
arch/um/os-Linux/helper.c +3 -3
@@ -45,7 +45,7 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv)unsigned long stack, sp;int pid, fds[2 ], ret, n; - stack =alloc_stack (0 ,__cant_sleep ()); + stack =alloc_stack (0 ,__uml_cant_sleep ());if (stack ==0 )return -ENOMEM ;
@@ -69,7 +69,7 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv) data.pre_data = pre_data; data.argv = argv; data.fd = fds[1 ]; - data.buf =__cant_sleep () ?uml_kmalloc (PATH_MAX ,UM_GFP_ATOMIC ) : + data.buf =__uml_cant_sleep () ?uml_kmalloc (PATH_MAX ,UM_GFP_ATOMIC ) :uml_kmalloc (PATH_MAX ,UM_GFP_KERNEL ); pid =clone (helper_child, (void *) sp,CLONE_VM , &data);if (pid <0 ) {
@@ -116,7 +116,7 @@ int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags,unsigned long stack, sp;int pid, status, err; - stack =alloc_stack (0 ,__cant_sleep ()); + stack =alloc_stack (0 ,__uml_cant_sleep ());if (stack ==0 )return -ENOMEM ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 118/202 um: Dont use vfprintf() for os_info()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Berg <[email protected]>
[ Upstream commit 236f9fe39b02c15fa5530b53e9cca48354394389 ]
The threads allocated inside the kernel have only a single page of stack. Unfortunately, the vfprintf function in standard glibc may use too much stack-space, overflowing it.
To make os_info safe to be used by helper threads, use the kernel vscnprintf function into a smallish buffer and write out the information to stderr.
--- arch/um/os-Linux/util.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
arch/um/os-Linux/util.c +17 -2
@@ -166,23 +166,38 @@ __uml_setup("quiet", quiet_cmd_param,"quiet\n" " Turns off information messages during boot.\n\n"); +/* +* The os_info/os_warn functions will be called by helper threads. These +* have a very limited stack size and using the libc formatting functions +* may overflow the stack. +* So pull in the kernel vscnprintf and use that instead with a fixed +* on-stack buffer. +*/ +int vscnprintf (char *buf,size_t size,const char *fmt,va_list args); +void os_info (const char *fmt, ...) { +char buf[256 ];va_list list; +int len;if (quiet_info)return ;va_start (list, fmt); -vfprintf (stderr, fmt, list); + len =vscnprintf (buf,sizeof (buf), fmt, list); +fwrite (buf, len,1 , stderr);va_end (list); }void os_warn (const char *fmt, ...) { +char buf[256 ];va_list list; +int len;va_start (list, fmt); -vfprintf (stderr, fmt, list); + len =vscnprintf (buf,sizeof (buf), fmt, list); +fwrite (buf, len,1 , stderr);va_end (list); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 119/202 um: net: Fix return type of uml_net_start_xmit()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
[ Upstream commit 7d748f60a4b82b50bf25fad1bd42d33f049f76aa ]
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed. A warning in clang aims to catch these at compile time, which reveals:
arch/um/drivers/net_kern.c:353:21: warning: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Wincompatible-function-pointer-types-strict]
353 | .ndo_start_xmit = uml_net_start_xmit,
| ^~~~~~~~~~~~~~~~~~
1 warning generated.
->ndo_start_xmit() in 'struct net_device_ops' expects a return type of 'netdev_tx_t', not 'int'. Adjust the return type of uml_net_start_xmit() to match the prototype's to resolve the warning. While UML does not currently implement support for kCFI, it could in the future, which means this warning becomes a fatal CFI failure at run time.
--- arch/um/drivers/net_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/drivers/net_kern.c +1 -1
@@ -206,7 +206,7 @@ static int uml_net_close(struct net_device *dev)return 0 ; } -static int uml_net_start_xmit (struct sk_buff *skb,struct net_device *dev) +static netdev_tx_t uml_net_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct uml_net_private *lp =netdev_priv (dev);unsigned long flags;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 120/202 mfd: ti_am335x_tscadc: Fix TI SoC dependencies
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Robinson <[email protected]>
[ Upstream commit 284d16c456e5d4b143f375b8ccc4038ab3f4ee0f ]
The ti_am335x_tscadc is specific to some TI SoCs, update the dependencies for those SoCs and compile testing.
--- drivers/mfd/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/Kconfig +1 -0
@@ -1247,6 +1247,7 @@ config MFD_DAVINCI_VOICECODEC config MFD_TI_AM335X_TSCADC tristate "TI ADC / Touch Screen chip support" + depends on ARCH_OMAP2PLUS || ARCH_K3 || COMPILE_TEST select MFD_CORE select REGMAP select REGMAP_MMIO
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 121/202 PCI: Only override AMD USB controller if required
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guilherme G. Piccoli <[email protected]>
[ Upstream commit e585a37e5061f6d5060517aed1ca4ccb2e56a34c ]
By running a Van Gogh device (Steam Deck), the following message was noticed in the kernel log:
pci 0000:04:00.3: PCI class overridden (0x0c03fe -> 0x0c03fe) so dwc3 driver can claim this instead of xhci
Effectively this means the quirk executed but changed nothing, since the class of this device was already the proper one (likely adjusted by newer firmware versions).
Check and perform the override only if necessary.
--- drivers/pci/quirks.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/pci/quirks.c +7 -4
@@ -611,10 +611,13 @@ static void quirk_amd_dwc_class(struct pci_dev *pdev) {u32 class = pdev->class; -/* Use "USB Device (not host controller)" class */ - pdev->class =PCI_CLASS_SERIAL_USB_DEVICE ; -pci_info (pdev,"PCI class overridden (%#08x -> %#08x) so dwc3 driver can claim this instead of xhci\n" , - class, pdev->class); +if (class !=PCI_CLASS_SERIAL_USB_DEVICE ) { +/* Use "USB Device (not host controller)" class */ + pdev->class =PCI_CLASS_SERIAL_USB_DEVICE ; +pci_info (pdev, +"PCI class overridden (%#08x -> %#08x) so dwc3 driver can claim this instead of xhci\n" , + class, pdev->class); + } }DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_AMD ,PCI_DEVICE_ID_AMD_NL_USB , quirk_amd_dwc_class);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 122/202 usb: hub: Replace hardcoded quirk value with BIT() macro
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hardik Gajjar <[email protected]>
[ Upstream commit 6666ea93d2c422ebeb8039d11e642552da682070 ]
This patch replaces the hardcoded quirk value in the macro with BIT().
--- drivers/usb/core/hub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/core/hub.c +2 -2
@@ -43,8 +43,8 @@#define USB_VENDOR_TEXAS_INSTRUMENTS 0x0451#define USB_PRODUCT_TUSB8041_USB3 0x8140#define USB_PRODUCT_TUSB8041_USB2 0x8142 -#define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND 0x01 -#define HUB_QUIRK_DISABLE_AUTOSUSPEND 0x02 +#define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND BIT(0) +#define HUB_QUIRK_DISABLE_AUTOSUSPEND BIT(1)#define USB_TP_TRANSMISSION_DELAY 40/* ns */ #define USB_TP_TRANSMISSION_DELAY_MAX 65535/* ns */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 123/202 misc: lis3lv02d_i2c: Add missing setting of the reg_ctrl callback
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit b1b9f7a494400c0c39f8cd83de3aaa6111c55087 ]
The lis3lv02d_i2c driver was missing a line to set the lis3_dev's reg_ctrl callback.
lis3_reg_ctrl(on) is called from the init callback, but due to the missing reg_ctrl callback the regulators where never turned off again leading to the following oops/backtrace when detaching the driver:
[ 82.313527] ------------[ cut here ]------------ [ 82.313546] WARNING: CPU: 1 PID: 1724 at drivers/regulator/core.c:2396 _regulator_put+0x219/0x230 ... [ 82.313695] RIP: 0010:_regulator_put+0x219/0x230 ... [ 82.314767] Call Trace: [ 82.314770] <TASK> [ 82.314772] ? _regulator_put+0x219/0x230 [ 82.314777] ? __warn+0x81/0x170 [ 82.314784] ? _regulator_put+0x219/0x230 [ 82.314791] ? report_bug+0x18d/0x1c0 [ 82.314801] ? handle_bug+0x3c/0x80 [ 82.314806] ? exc_invalid_op+0x13/0x60 [ 82.314812] ? asm_exc_invalid_op+0x16/0x20 [ 82.314845] ? _regulator_put+0x219/0x230 [ 82.314857] regulator_bulk_free+0x39/0x60 [ 82.314865] i2c_device_remove+0x22/0xb0
Add the missing setting of the callback so that the regulators properly get turned off again when not used.
--- drivers/misc/lis3lv02d/lis3lv02d_i2c.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/lis3lv02d/lis3lv02d_i2c.c +1 -0
@@ -164,6 +164,7 @@ static int lis3lv02d_i2c_probe(struct i2c_client *client, lis3_dev.init = lis3_i2c_init; lis3_dev.read = lis3_i2c_read; lis3_dev.write = lis3_i2c_write; + lis3_dev.reg_ctrl = lis3_reg_ctrl; lis3_dev.irq = client->irq; lis3_dev.ac = lis3lv02d_axis_map; lis3_dev.pm_dev = &client->dev;
Signature · 1 line
2.43.0
Re: [PATCH 4.19 123/202] misc: lis3lv02d_i2c: Add missing setting of the reg_ctrl callback
Hi Greg,
Quoted 1 line · Greg Kroah-Hartman
4.19-stable review patch. If anyone has any objections, please let me know.
This is known to cause a regression (WARN triggering on suspend, possible panic if panic-on-warn is set).
A fix for the regression is pending:
https://lore.kernel.org/regressions/[email protected]/T/#u
but it has not been merged yet, so please hold of on merging this patch until you can apply both at once.
I see that you are also planning to apply this to other stable branches. I'm not sure if this is necessary but to be safe I'll copy and paste this reply to the emails for the other stable branches.
Regards,
Hans
Quoted 55 lines
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit
b1b9f7a494400c0c39f8cd83de3aaa6111c55087]The
lis3lv02d_i2cdriver was missing a line to set the lis3_dev'sreg_ctrlcallback.
lis3_reg_ctrl(on)is called from the init callback, but due to the missingreg_ctrlcallback the regulators where never turned off again leading to the following oops/backtrace when detaching the driver:[ 82.313527] ------------[ cut here ]------------ [ 82.313546] WARNING: CPU: 1 PID: 1724 at drivers/regulator/core.c:2396 _regulator_put+0x219/0x230 ... [ 82.313695] RIP: 0010:_regulator_put+0x219/0x230 ... [ 82.314767] Call Trace: [ 82.314770] <TASK> [ 82.314772] ? _regulator_put+0x219/0x230 [ 82.314777] ? __warn+0x81/0x170 [ 82.314784] ? _regulator_put+0x219/0x230 [ 82.314791] ? report_bug+0x18d/0x1c0 [ 82.314801] ? handle_bug+0x3c/0x80 [ 82.314806] ? exc_invalid_op+0x13/0x60 [ 82.314812] ? asm_exc_invalid_op+0x16/0x20 [ 82.314845] ? _regulator_put+0x219/0x230 [ 82.314857] regulator_bulk_free+0x39/0x60 [ 82.314865] i2c_device_remove+0x22/0xb0Add the missing setting of the callback so that the regulators properly get turned off again when not used.
Signed-off-by Hans de Goede <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/misc/lis3lv02d/lis3lv02d_i2c.c | 1 + 1 file changed, 1 insertion(+)drivers/misc/lis3lv02d/lis3lv02d_i2c.c +1
-0@@ -164,6 +164,7 @@ static int lis3lv02d_i2c_probe(struct i2c_client *client, lis3_dev.init = lis3_i2c_init; lis3_dev.read = lis3_i2c_read; lis3_dev.write = lis3_i2c_write; + lis3_dev.reg_ctrl = lis3_reg_ctrl; lis3_dev.irq = client->irq; lis3_dev.ac = lis3lv02d_axis_map; lis3_dev.pm_dev = &client->dev;
Greg Kroah-Hartman
maintainerPATCH 124/202 libsubcmd: Fix memory leak in uniq()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit ad30469a841b50dbb541df4d6971d891f703c297 ]
uniq() will write one command name over another causing the overwritten string to be leaked. Fix by doing a pass that removes duplicates and a second that removes the holes.
--- tools/lib/subcmd/help.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
tools/lib/subcmd/help.c +14 -4
@@ -50,11 +50,21 @@ void uniq(struct cmdnames *cmds)if (!cmds->cnt)return ; -for (i = j =1 ; i < cmds->cnt; i++) -if (strcmp (cmds->names[i]->name, cmds->names[i-1 ]->name)) - cmds->names[j++] = cmds->names[i]; - +for (i =1 ; i < cmds->cnt; i++) { +if (!strcmp (cmds->names[i]->name, cmds->names[i-1 ]->name)) +zfree (&cmds->names[i -1 ]); + } +for (i =0 , j =0 ; i < cmds->cnt; i++) { +if (cmds->names[i]) { +if (i == j) + j++; +else + cmds->names[j++] = cmds->names[i]; + } + } cmds->cnt = j; +while (j < i) + cmds->names[j++] =NULL ; }void exclude_cmds (struct cmdnames *cmds,struct cmdnames *excludes)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 125/202 =?UTF-8?q?virtio=5Fnet:=20Fix=20"=E2=80=98%d=E2=80=99=20directive?= =?UTF-8?q?=20writing=20between=201=20and=2011=20bytes=20into=20a=20region?= =?UTF-8?q?=20of=20size=2010"=20warnings?=
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Yanjun <[email protected]>
[ Upstream commit e3fe8d28c67bf6c291e920c6d04fa22afa14e6e4 ]
Fix the warnings when building virtio_net driver.
"drivers/net/virtio_net.c: In function ‘init_vqs’:drivers/net/virtio_net.c:4551:48: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Wformat-overflow=]
4551 | sprintf(vi->rq[i].name, "input.%d", i);
| ^~
In function ‘virtnet_find_vqs’,
inlined from ‘init_vqs’ at drivers/net/virtio_net.c:4645:8:drivers/net/virtio_net.c:4551:41: note: directive argument in the range [-2147483643, 65534]
4551 | sprintf(vi->rq[i].name, "input.%d", i);
| ^~~~~~~~~~drivers/net/virtio_net.c:4551:17: note: ‘sprintf’ output between 8 and 18 bytes into a destination of size 16
4551 | sprintf(vi->rq[i].name, "input.%d", i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~drivers/net/virtio_net.c: In function ‘init_vqs’:drivers/net/virtio_net.c:4552:49: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 9 [-Wformat-overflow=]
4552 | sprintf(vi->sq[i].name, "output.%d", i);
| ^~
In function ‘virtnet_find_vqs’,
inlined from ‘init_vqs’ at drivers/net/virtio_net.c:4645:8:drivers/net/virtio_net.c:4552:41: note: directive argument in the range [-2147483643, 65534]
4552 | sprintf(vi->sq[i].name, "output.%d", i);
| ^~~~~~~~~~~drivers/net/virtio_net.c:4552:17: note: ‘sprintf’ output between 9 and 19 bytes into a destination of size 16
4552 | sprintf(vi->sq[i].name, "output.%d", i);
"
--- drivers/net/virtio_net.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/virtio_net.c +5 -4
@@ -2727,10 +2727,11 @@ static int virtnet_find_vqs(struct virtnet_info *vi) {vq_callback_t **callbacks;struct virtqueue **vqs; -int ret = -ENOMEM ; -int i, total_vqs;const char **names; +int ret = -ENOMEM ; +int total_vqs;bool *ctx; +u16 i;/* We expect 1 RX virtqueue followed by 1 TX virtqueue, followed by * possible N-1 RX/TX queue pairs used in multiqueue mode, followed by
@@ -2767,8 +2768,8 @@ static int virtnet_find_vqs(struct virtnet_info *vi)for (i =0 ; i < vi->max_queue_pairs; i++) { callbacks[rxq2vq (i)] = skb_recv_done; callbacks[txq2vq (i)] = skb_xmit_done; -sprintf (vi->rq[i].name,"input.%d" , i); -sprintf (vi->sq[i].name,"output.%d" , i); +sprintf (vi->rq[i].name,"input.%u" , i); +sprintf (vi->sq[i].name,"output.%u" , i); names[rxq2vq (i)] = vi->rq[i].name; names[txq2vq (i)] = vi->sq[i].name;if (ctx)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 126/202 blk-mq: fix IO hang from sbitmap wakeup race
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
[ Upstream commit 5266caaf5660529e3da53004b8b7174cab6374ed ]
In blk_mq_mark_tag_wait(), __add_wait_queue() may be re-ordered with the following blk_mq_get_driver_tag() in case of getting driver tag failure.
Then in __sbitmap_queue_wake_up(), waitqueue_active() may not observe the added waiter in blk_mq_mark_tag_wait() and wake up nothing, meantime blk_mq_mark_tag_wait() can't get driver tag successfully.
This issue can be reproduced by running the following test in loop, and fio hang can be observed in < 30min when running it on my test VM in laptop.
modprobe -r scsi_debug
modprobe scsi_debug delay=0 dev_size_mb=4096 max_queue=1 host_max_queue=1 submit_queues=4 dev=ls -d /sys/bus/pseudo/drivers/scsi_debug/adapter*/host*/target*/*/block/* | head -1 | xargs basename fio --filename=/dev/"$dev" --direct=1 --rw=randrw --bs=4k --iodepth=1 \
--runtime=100 --numjobs=40 --time_based --name=test \
--ioengine=libaio
Fix the issue by adding one explicit barrier in blk_mq_mark_tag_wait(), which is just fine in case of running out of tag.
--- block/blk-mq.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
block/blk-mq.c +16 -0
@@ -1064,6 +1064,22 @@ static bool blk_mq_mark_tag_wait(struct blk_mq_hw_ctx *hctx, wait->flags &= ~WQ_FLAG_EXCLUSIVE ;__add_wait_queue (wq, wait); +/* +* Add one explicit barrier since blk_mq_get_driver_tag() may +* not imply barrier in case of failure. +* +* Order adding us to wait queue and allocating driver tag. +* +* The pair is the one implied in sbitmap_queue_wake_up() which +* orders clearing sbitmap tag bits and waitqueue_active() in +* __sbitmap_queue_wake_up(), since waitqueue_active() is lockless +* +* Otherwise, re-order of adding wait queue and getting driver tag +* may cause __sbitmap_queue_wake_up() to wake up nothing because +* the waitqueue_active() may not observe us in wait queue. +*/ +smp_mb (); +/* * It's possible that a tag was freed in the window between the * allocation failure and adding the hardware queue to the wait
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 127/202 ceph: fix deadlock or deadcode of misusing dget()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiubo Li <[email protected]>
[ Upstream commit b493ad718b1f0357394d2cdecbf00a44a36fa085 ]
The lock order is incorrect between denty and its parent, we should always make sure that the parent get the lock first.
But since this deadcode is never used and the parent dir will always be set from the callers, let's just remove it.
--- fs/ceph/caps.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
fs/ceph/caps.c +3 -6
@@ -4216,12 +4216,14 @@ int ceph_encode_dentry_release(void **p, struct dentry *dentry,struct inode *dir, int mds, int drop, int unless) { - struct dentry *parent = NULL; struct ceph_mds_request_release *rel = *p;struct ceph_dentry_info *di =ceph_dentry (dentry);int force =0 ;int ret; +/* This shouldn't happen */ +BUG_ON (!dir); +/* * force an record for the directory caps if we have a dentry lease. * this is racy (can't take i_ceph_lock and d_lock together), but it
@@ -4231,14 +4233,9 @@ int ceph_encode_dentry_release(void **p, struct dentry *dentry,spin_lock (&dentry->d_lock);if (di->lease_session && di->lease_session->s_mds == mds) force =1 ; -if (!dir) { - parent =dget (dentry->d_parent); - dir =d_inode (parent); - }spin_unlock (&dentry->d_lock); ret =ceph_encode_inode_release (p, dir, mds, drop, unless, force); -dput (parent);spin_lock (&dentry->d_lock);if (ret && di->lease_session && di->lease_session->s_mds == mds) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 128/202 drm/amdgpu: Release adev->pm.fw before return in amdgpu_device_need_post()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivasan Shanmugam <[email protected]>
[ Upstream commit 8a44fdd3cf91debbd09b43bd2519ad2b2486ccf4 ]
In function 'amdgpu_device_need_post(struct amdgpu_device *adev)' - 'adev->pm.fw' may not be released before return.
Using the function release_firmware() to release adev->pm.fw.
Thus fixing the below:drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1571 amdgpu_device_need_post() warn: 'adev->pm.fw' from request_firmware() not released on lines: 1554.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
@@ -823,6 +823,7 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev)return true; fw_ver = *((uint32_t *)adev->pm.fw->data +69 ); +release_firmware (adev->pm.fw);if (fw_ver <0x00160e00 )return true; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 129/202 wifi: cfg80211: fix RCU dereference in __cfg80211_bss_update
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit 1184950e341c11b6f82bc5b59564411d9537ab27 ]
Replace rcu_dereference() with rcu_access_pointer() since we hold the lock here (and aren't in an RCU critical section).
--- net/wireless/scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/wireless/scan.c +1 -1
@@ -1019,7 +1019,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev, &hidden->hidden_list); hidden->refcount++; - ies = (void *)rcu_dereference (new->pub.beacon_ies); + ies = (void *)rcu_access_pointer (new->pub.beacon_ies);rcu_assign_pointer (new->pub.beacon_ies, hidden->pub.beacon_ies);if (ies)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 130/202 scsi: isci: Fix an error code problem in isci_io_request_build()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Hui <[email protected]>
[ Upstream commit 658365c6b0857e6a306436e315a8633937e3af42 ]
Clang static complains that Value stored to 'status' is never read. Return 'status' rather than 'SCI_SUCCESS'.
--- drivers/scsi/isci/request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/isci/request.c +1 -1
@@ -3398,7 +3398,7 @@ static enum sci_status isci_io_request_build(struct isci_host *ihost,return SCI_FAILURE ; } -return SCI_SUCCESS ; +return status; }static struct isci_request *isci_request_from_tag (struct isci_host *ihost,u16 tag)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 131/202 net: remove unneeded break
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tom Rix <[email protected]>
[ Upstream commit 7ebb9db011088f9bd357791f49cb7012e66f29e2 ]
A break is not needed if it is preceded by a return or goto
Stable-dep-of: bbc404d20d1b ("ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550()")
--- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 1 - drivers/net/ethernet/cisco/enic/enic_ethtool.c | 1 - drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c | 1 - drivers/net/wan/lmc/lmc_proto.c | 4 ---- 4 files changed, 7 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +0 -1
@@ -823,7 +823,6 @@ int aq_nic_set_link_ksettings(struct aq_nic_s *self,default : err =-1 ; goto err_exit; -break ; }if (!(self->aq_nic_cfg.aq_hw_caps->link_speed_msk & rate)) { err =-1 ;
drivers/net/ethernet/cisco/enic/enic_ethtool.c +0 -1
@@ -454,7 +454,6 @@ static int enic_grxclsrule(struct enic *enic, struct ethtool_rxnfc *cmd)break ;default :return -EINVAL ; -break ; } fsp->h_u.tcp_ip4_spec.ip4src =flow_get_u32_src (&n->keys);
drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c +0 -1
@@ -350,7 +350,6 @@ static s32 ixgbe_calc_eeprom_checksum_X540(struct ixgbe_hw *hw)if (ixgbe_read_eerd_generic (hw, pointer, &length)) {hw_dbg (hw,"EEPROM read failed\n" );return IXGBE_ERR_EEPROM ; -break ; }/* Skip pointer section if length is invalid. */
drivers/net/wan/lmc/lmc_proto.c +0 -4
@@ -103,17 +103,13 @@ __be16 lmc_proto_type(lmc_softc_t *sc, struct sk_buff *skb) /*FOLD00*/switch (sc->if_type){case LMC_PPP :return hdlc_type_trans (skb, sc->lmc_device); -break ;case LMC_NET :return htons (ETH_P_802_2 ); -break ;case LMC_RAW :/* Packet type for skbuff kind of useless */ return htons (ETH_P_802_2 ); -break ;default :printk (KERN_WARNING "%s: No protocol set for this interface, assuming 802.2 (which is wrong!!)\n" , sc->name);return htons (ETH_P_802_2 ); -break ; }lmc_trace (sc->lmc_device,"lmc_proto_tye out" );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 132/202 ixgbe: Remove non-inclusive language
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Piotr Skajewski <[email protected]>
[ Upstream commit 93b067f154b3edfd3d75a272fd9433bf787e2e1d ]
Remove non-inclusive language from the driver.
Additionally correct the duplication "from from"
reported by checkpatch after the changes above.
Stable-dep-of: bbc404d20d1b ("ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550()")
--- .../net/ethernet/intel/ixgbe/ixgbe_common.c | 36 +++++++++---------- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 +-- drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 10 +++--- 3 files changed, 25 insertions(+), 25 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +18 -18
@@ -30,7 +30,7 @@ static s32 ixgbe_write_eeprom_buffer_bit_bang(struct ixgbe_hw *hw, u16 offset, u16 words, u16 *data);static s32 ixgbe_detect_eeprom_page_size_generic (struct ixgbe_hw *hw,u16 offset); -static s32 ixgbe_disable_pcie_master (struct ixgbe_hw *hw); +static s32 ixgbe_disable_pcie_primary (struct ixgbe_hw *hw);/* Base table for registers values that change by MAC */ const u32 ixgbe_mvals_8259X[IXGBE_MVALS_IDX_LIMIT ] = {
@@ -746,10 +746,10 @@ s32 ixgbe_stop_adapter_generic(struct ixgbe_hw *hw)usleep_range (1000 ,2000 );/* -* Prevent the PCI-E bus from from hanging by disabling PCI-E master +* Prevent the PCI-E bus from hanging by disabling PCI-E primary * access and verify no pending requests */ -return ixgbe_disable_pcie_master (hw); +return ixgbe_disable_pcie_primary (hw); }/**
@@ -2506,15 +2506,15 @@ static u32 ixgbe_pcie_timeout_poll(struct ixgbe_hw *hw) }/** -* ixgbe_disable_pcie_master - Disable PCI-express master access +* ixgbe_disable_pcie_primary - Disable PCI-express primary access * @hw: pointer to hardware structure * -* Disables PCI-Express master access and verifies there are no pending -* requests. IXGBE_ERR_MASTER_REQUESTS_PENDING is returned if master disable -* bit hasn't caused the master requests to be disabled, else 0 -* is returned signifying master requests disabled. +* Disables PCI-Express primary access and verifies there are no pending +* requests. IXGBE_ERR_PRIMARY_REQUESTS_PENDING is returned if primary disable +* bit hasn't caused the primary requests to be disabled, else 0 +* is returned signifying primary requests disabled. **/ -static s32 ixgbe_disable_pcie_master (struct ixgbe_hw *hw) +static s32 ixgbe_disable_pcie_primary (struct ixgbe_hw *hw) {u32 i, poll;u16 value;
@@ -2523,23 +2523,23 @@ static s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw)IXGBE_WRITE_REG (hw,IXGBE_CTRL ,IXGBE_CTRL_GIO_DIS );/* Poll for bit to read as set */ -for (i =0 ; i <IXGBE_PCI_MASTER_DISABLE_TIMEOUT ; i++) { +for (i =0 ; i <IXGBE_PCI_PRIMARY_DISABLE_TIMEOUT ; i++) {if (IXGBE_READ_REG (hw,IXGBE_CTRL ) &IXGBE_CTRL_GIO_DIS )break ;usleep_range (100 ,120 ); } -if (i >=IXGBE_PCI_MASTER_DISABLE_TIMEOUT ) { +if (i >=IXGBE_PCI_PRIMARY_DISABLE_TIMEOUT ) {hw_dbg (hw,"GIO disable did not set - requesting resets\n" ); goto gio_disable_fail; } -/* Exit if master requests are blocked */ +/* Exit if primary requests are blocked */ if (!(IXGBE_READ_REG (hw,IXGBE_STATUS ) &IXGBE_STATUS_GIO ) ||ixgbe_removed (hw->hw_addr))return 0 ; -/* Poll for master request bit to clear */ -for (i =0 ; i <IXGBE_PCI_MASTER_DISABLE_TIMEOUT ; i++) { +/* Poll for primary request bit to clear */ +for (i =0 ; i <IXGBE_PCI_PRIMARY_DISABLE_TIMEOUT ; i++) {udelay (100 );if (!(IXGBE_READ_REG (hw,IXGBE_STATUS ) &IXGBE_STATUS_GIO ))return 0 ;
@@ -2547,13 +2547,13 @@ static s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw)/* * Two consecutive resets are required via CTRL.RST per datasheet -* 5.2.5.3.2 Master Disable. We set a flag to inform the reset routine -* of this need. The first reset prevents new master requests from +* 5.2.5.3.2 Primary Disable. We set a flag to inform the reset routine +* of this need. The first reset prevents new primary requests from * being issued by our device. We then must wait 1usec or more for any * remaining completions from the PCIe bus to trickle in, and then reset * again to clear out any effects they may have had on our device. */ -hw_dbg (hw,"GIO Master Disable bit didn't clear - requesting resets\n" ); +hw_dbg (hw,"GIO Primary Disable bit didn't clear - requesting resets\n" ); gio_disable_fail: hw->mac.flags |=IXGBE_FLAGS_DOUBLE_RESET_REQUIRED ;
@@ -2575,7 +2575,7 @@ static s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw) }hw_dbg (hw,"PCIe transaction pending bit also did not clear.\n" ); -return IXGBE_ERR_MASTER_REQUESTS_PENDING ; +return IXGBE_ERR_PRIMARY_REQUESTS_PENDING ; }/**
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -2
@@ -5885,8 +5885,8 @@ void ixgbe_reset(struct ixgbe_adapter *adapter)case IXGBE_ERR_SFP_NOT_PRESENT :case IXGBE_ERR_SFP_NOT_SUPPORTED :break ; -case IXGBE_ERR_MASTER_REQUESTS_PENDING : -e_dev_err ("master disable timed out\n" ); +case IXGBE_ERR_PRIMARY_REQUESTS_PENDING : +e_dev_err ("primary disable timed out\n" );break ;case IXGBE_ERR_EEPROM_VERSION :/* We are running on a pre-production device, log a warning */
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +5 -5
@@ -1243,7 +1243,7 @@ struct ixgbe_nvm_version {#define IXGBE_PSRTYPE_RQPL_SHIFT 29/* CTRL Bit Masks */ -#define IXGBE_CTRL_GIO_DIS 0x00000004/* Global IO Master Disable bit */ +#define IXGBE_CTRL_GIO_DIS 0x00000004/* Global IO Primary Disable bit */ #define IXGBE_CTRL_LNK_RST 0x00000008/* Link Reset. Resets everything. */ #define IXGBE_CTRL_RST 0x04000000/* Reset (SW) */ #define IXGBE_CTRL_RST_MASK (IXGBE_CTRL_LNK_RST | IXGBE_CTRL_RST)
@@ -1806,7 +1806,7 @@ enum {/* STATUS Bit Masks */ #define IXGBE_STATUS_LAN_ID 0x0000000C/* LAN ID */ #define IXGBE_STATUS_LAN_ID_SHIFT 2/* LAN ID Shift*/ -#define IXGBE_STATUS_GIO 0x00080000/* GIO Master Enable Status */ +#define IXGBE_STATUS_GIO 0x00080000/* GIO Primary Enable Status */ #define IXGBE_STATUS_LAN_ID_0 0x00000000/* LAN ID 0 */ #define IXGBE_STATUS_LAN_ID_1 0x00000004/* LAN ID 1 */
@@ -2188,8 +2188,8 @@ enum {#define IXGBE_PCIDEVCTRL2_4_8s 0xd#define IXGBE_PCIDEVCTRL2_17_34s 0xe -/* Number of 100 microseconds we wait for PCI Express master disable */ -#define IXGBE_PCI_MASTER_DISABLE_TIMEOUT 800 +/* Number of 100 microseconds we wait for PCI Express primary disable */ +#define IXGBE_PCI_PRIMARY_DISABLE_TIMEOUT 800/* RAH */ #define IXGBE_RAH_VIND_MASK 0x003C0000
@@ -3662,7 +3662,7 @@ struct ixgbe_info {#define IXGBE_ERR_ADAPTER_STOPPED -9#define IXGBE_ERR_INVALID_MAC_ADDR -10#define IXGBE_ERR_DEVICE_NOT_SUPPORTED -11 -#define IXGBE_ERR_MASTER_REQUESTS_PENDING -12 +#define IXGBE_ERR_PRIMARY_REQUESTS_PENDING -12#define IXGBE_ERR_INVALID_LINK_SETTINGS -13#define IXGBE_ERR_AUTONEG_NOT_COMPLETE -14#define IXGBE_ERR_RESET_FAILED -15
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 133/202 ixgbe: Refactor returning internal error codes
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jedrzej Jagielski <[email protected]>
[ Upstream commit 5795f533f30a80aa0473652876296ebc9129e33a ]
Change returning codes to the kernel ones instead of the internal ones for the entire ixgbe driver.
Stable-dep-of: bbc404d20d1b ("ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550()")
--- .../net/ethernet/intel/ixgbe/ixgbe_82598.c | 36 ++--- .../net/ethernet/intel/ixgbe/ixgbe_82599.c | 61 ++++---- .../net/ethernet/intel/ixgbe/ixgbe_common.c | 145 ++++++++---------- .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 26 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.c | 34 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h | 1 - drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 84 +++++----- .../net/ethernet/intel/ixgbe/ixgbe_sriov.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 39 ----- drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c | 44 +++--- drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 107 +++++++------ 12 files changed, 264 insertions(+), 317 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c +18 -18
@@ -123,14 +123,14 @@ static s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw)if (ret_val)return ret_val;if (hw->phy.sfp_type == ixgbe_sfp_type_unknown) -return IXGBE_ERR_SFP_NOT_SUPPORTED ; +return -EOPNOTSUPP ;/* Check to see if SFP+ module is supported */ ret_val =ixgbe_get_sfp_init_sequence_offsets (hw, &list_offset, &data_offset);if (ret_val) -return IXGBE_ERR_SFP_NOT_SUPPORTED ; +return -EOPNOTSUPP ;break ;default :break ;
@@ -213,7 +213,7 @@ static s32 ixgbe_get_link_capabilities_82598(struct ixgbe_hw *hw,break ;default : -return IXGBE_ERR_LINK_SETUP ; +return -EIO ; }return 0 ;
@@ -283,7 +283,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw)/* Validate the water mark configuration */ if (!hw->fc.pause_time) -return IXGBE_ERR_INVALID_LINK_SETTINGS ; +return -EINVAL ;/* Low water mark of zero causes XOFF floods */ for (i =0 ; i <MAX_TRAFFIC_CLASS ; i++) {
@@ -292,7 +292,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw)if (!hw->fc.low_water[i] || hw->fc.low_water[i] >= hw->fc.high_water[i]) {hw_dbg (hw,"Invalid water mark configuration\n" ); -return IXGBE_ERR_INVALID_LINK_SETTINGS ; +return -EINVAL ; } } }
@@ -369,7 +369,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw)break ;default :hw_dbg (hw,"Flow control param set incorrectly\n" ); -return IXGBE_ERR_CONFIG ; +return -EIO ; }/* Set 802.3x based flow control settings. */
@@ -438,7 +438,7 @@ static s32 ixgbe_start_mac_link_82598(struct ixgbe_hw *hw,msleep (100 ); }if (!(links_reg &IXGBE_LINKS_KX_AN_COMP )) { - status =IXGBE_ERR_AUTONEG_NOT_COMPLETE ; + status = -EIO ;hw_dbg (hw,"Autonegotiation did not complete.\n" ); } }
@@ -478,7 +478,7 @@ static s32 ixgbe_validate_link_ready(struct ixgbe_hw *hw)if (timeout ==IXGBE_VALIDATE_LINK_READY_TIMEOUT ) {hw_dbg (hw,"Link was indicated but link is down\n" ); -return IXGBE_ERR_LINK_SETUP ; +return -EIO ; }return 0 ;
@@ -594,7 +594,7 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw, speed &= link_capabilities;if (speed ==IXGBE_LINK_SPEED_UNKNOWN ) -return IXGBE_ERR_LINK_SETUP ; +return -EINVAL ;/* Set KX4/KX support according to speed requested */ else if (link_mode == IXGBE_AUTOC_LMS_KX4_AN ||
@@ -701,9 +701,9 @@ static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw)/* Init PHY and function pointers, perform SFP setup */ phy_status = hw->phy.ops.init (hw); -if (phy_status ==IXGBE_ERR_SFP_NOT_SUPPORTED ) +if (phy_status == -EOPNOTSUPP )return phy_status; -if (phy_status ==IXGBE_ERR_SFP_NOT_PRESENT ) +if (phy_status == -ENOENT ) goto mac_reset_top; hw->phy.ops.reset (hw);
@@ -727,7 +727,7 @@ static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw)udelay (1 ); }if (ctrl &IXGBE_CTRL_RST ) { - status =IXGBE_ERR_RESET_FAILED ; + status = -EIO ;hw_dbg (hw,"Reset polling failed to complete.\n" ); }
@@ -789,7 +789,7 @@ static s32 ixgbe_set_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)/* Make sure we are using a valid rar index range */ if (rar >= rar_entries) {hw_dbg (hw,"RAR index %d is out of range.\n" , rar); -return IXGBE_ERR_INVALID_ARGUMENT ; +return -EINVAL ; } rar_high =IXGBE_READ_REG (hw,IXGBE_RAH (rar));
@@ -814,7 +814,7 @@ static s32 ixgbe_clear_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)/* Make sure we are using a valid rar index range */ if (rar >= rar_entries) {hw_dbg (hw,"RAR index %d is out of range.\n" , rar); -return IXGBE_ERR_INVALID_ARGUMENT ; +return -EINVAL ; } rar_high =IXGBE_READ_REG (hw,IXGBE_RAH (rar));
@@ -845,7 +845,7 @@ static s32 ixgbe_set_vfta_82598(struct ixgbe_hw *hw, u32 vlan, u32 vind,u32 vftabyte;if (vlan >4095 ) -return IXGBE_ERR_PARAM ; +return -EINVAL ;/* Determine 32-bit word position in array */ regindex = (vlan >>5 ) &0x7F ;/* upper seven bits */
@@ -964,7 +964,7 @@ static s32 ixgbe_read_i2c_phy_82598(struct ixgbe_hw *hw, u8 dev_addr, gssr =IXGBE_GSSR_PHY0_SM ;if (hw->mac.ops.acquire_swfw_sync (hw, gssr) !=0 ) -return IXGBE_ERR_SWFW_SYNC ; +return -EBUSY ;if (hw->phy.type == ixgbe_phy_nl) {/*
@@ -993,7 +993,7 @@ static s32 ixgbe_read_i2c_phy_82598(struct ixgbe_hw *hw, u8 dev_addr,if (sfp_stat !=IXGBE_I2C_EEPROM_STATUS_PASS ) {hw_dbg (hw,"EEPROM read did not pass.\n" ); - status =IXGBE_ERR_SFP_NOT_PRESENT ; + status = -ENOENT ; goto out; }
@@ -1003,7 +1003,7 @@ static s32 ixgbe_read_i2c_phy_82598(struct ixgbe_hw *hw, u8 dev_addr, *eeprom_data = (u8)(sfp_data >>8 ); }else { - status =IXGBE_ERR_PHY ; + status = -EIO ; } out:
drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c +30 -31
232 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +67 -78
508 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +1 -1
@@ -3244,7 +3244,7 @@ static int ixgbe_get_module_eeprom(struct net_device *dev, {struct ixgbe_adapter *adapter =netdev_priv (dev);struct ixgbe_hw *hw = &adapter->hw; -s32 status =IXGBE_ERR_PHY_ADDR_INVALID ; +s32 status = -EFAULT ;u8 databyte =0xFF ;int i =0 ;
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +13 -13
@@ -5463,7 +5463,7 @@ static int ixgbe_non_sfp_link_config(struct ixgbe_hw *hw) {u32 speed;bool autoneg, link_up = false; -int ret =IXGBE_ERR_LINK_SETUP ; +int ret = -EIO ;if (hw->mac.ops.check_link) ret = hw->mac.ops.check_link (hw, &speed, &link_up, false);
@@ -5882,13 +5882,13 @@ void ixgbe_reset(struct ixgbe_adapter *adapter) err = hw->mac.ops.init_hw (hw);switch (err) {case 0 : -case IXGBE_ERR_SFP_NOT_PRESENT : -case IXGBE_ERR_SFP_NOT_SUPPORTED : +case -ENOENT : +case -EOPNOTSUPP :break ; -case IXGBE_ERR_PRIMARY_REQUESTS_PENDING : +case -EALREADY :e_dev_err ("primary disable timed out\n" );break ; -case IXGBE_ERR_EEPROM_VERSION : +case -EACCES :/* We are running on a pre-production device, log a warning */ e_dev_warn ("This device is a pre-production adapter/LOM. " "Please be aware there may be issues associated with "
@@ -7685,10 +7685,10 @@ static void ixgbe_sfp_detection_subtask(struct ixgbe_adapter *adapter) adapter->sfp_poll_time = jiffies +IXGBE_SFP_POLL_JIFFIES -1 ; err = hw->phy.ops.identify_sfp (hw); -if (err ==IXGBE_ERR_SFP_NOT_SUPPORTED ) +if (err == -EOPNOTSUPP ) goto sfp_out; -if (err ==IXGBE_ERR_SFP_NOT_PRESENT ) { +if (err == -ENOENT ) {/* If no cable is present, then we need to reset * the next time we find a good cable. */ adapter->flags2 |=IXGBE_FLAG2_SFP_NEEDS_RESET ;
@@ -7714,7 +7714,7 @@ static void ixgbe_sfp_detection_subtask(struct ixgbe_adapter *adapter)else err = hw->mac.ops.setup_sfp (hw); -if (err ==IXGBE_ERR_SFP_NOT_SUPPORTED ) +if (err == -EOPNOTSUPP ) goto sfp_out; adapter->flags |=IXGBE_FLAG_NEED_LINK_CONFIG ;
@@ -7723,8 +7723,8 @@ static void ixgbe_sfp_detection_subtask(struct ixgbe_adapter *adapter) sfp_out:clear_bit (__IXGBE_IN_SFP_INIT, &adapter->state); -if ((err ==IXGBE_ERR_SFP_NOT_SUPPORTED ) && - (adapter->netdev->reg_state ==NETREG_REGISTERED )) { +if (err == -EOPNOTSUPP && + adapter->netdev->reg_state ==NETREG_REGISTERED ) {e_dev_err ("failed to initialize because an unsupported " "SFP+ module type was detected.\n" ); e_dev_err("Reload the driver after installing a "
@@ -10635,9 +10635,9 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err = hw->mac.ops.reset_hw (hw); hw->phy.reset_if_overtemp = false;ixgbe_set_eee_capable (adapter); -if (err ==IXGBE_ERR_SFP_NOT_PRESENT ) { +if (err == -ENOENT ) { err =0 ; - }else if (err ==IXGBE_ERR_SFP_NOT_SUPPORTED ) { + }else if (err == -EOPNOTSUPP ) {e_dev_err ("failed to load because an unsupported SFP+ or QSFP module type was detected.\n" );e_dev_err ("Reload the driver after installing a supported module.\n" ); goto err_sw_init;
@@ -10849,7 +10849,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)/* reset the hardware with the new settings */ err = hw->mac.ops.start_hw (hw); -if (err ==IXGBE_ERR_EEPROM_VERSION ) { +if (err == -EACCES ) {/* We are running on a pre-production device, log a warning */ e_dev_warn ("This device is a pre-production adapter/LOM. " "Please be aware there may be issues associated "
drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.c +17 -17
@@ -24,7 +24,7 @@ s32 ixgbe_read_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id) size = mbx->size;if (!mbx->ops) -return IXGBE_ERR_MBX ; +return -EIO ;return mbx->ops->read (hw, msg, size, mbx_id); }
@@ -43,10 +43,10 @@ s32 ixgbe_write_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)struct ixgbe_mbx_info *mbx = &hw->mbx;if (size > mbx->size) -return IXGBE_ERR_MBX ; +return -EINVAL ;if (!mbx->ops) -return IXGBE_ERR_MBX ; +return -EIO ;return mbx->ops->write (hw, msg, size, mbx_id); }
@@ -63,7 +63,7 @@ s32 ixgbe_check_for_msg(struct ixgbe_hw *hw, u16 mbx_id)struct ixgbe_mbx_info *mbx = &hw->mbx;if (!mbx->ops) -return IXGBE_ERR_MBX ; +return -EIO ;return mbx->ops->check_for_msg (hw, mbx_id); }
@@ -80,7 +80,7 @@ s32 ixgbe_check_for_ack(struct ixgbe_hw *hw, u16 mbx_id)struct ixgbe_mbx_info *mbx = &hw->mbx;if (!mbx->ops) -return IXGBE_ERR_MBX ; +return -EIO ;return mbx->ops->check_for_ack (hw, mbx_id); }
@@ -97,7 +97,7 @@ s32 ixgbe_check_for_rst(struct ixgbe_hw *hw, u16 mbx_id)struct ixgbe_mbx_info *mbx = &hw->mbx;if (!mbx->ops) -return IXGBE_ERR_MBX ; +return -EIO ;return mbx->ops->check_for_rst (hw, mbx_id); }
@@ -115,12 +115,12 @@ static s32 ixgbe_poll_for_msg(struct ixgbe_hw *hw, u16 mbx_id)int countdown = mbx->timeout;if (!countdown || !mbx->ops) -return IXGBE_ERR_MBX ; +return -EIO ;while (mbx->ops->check_for_msg (hw, mbx_id)) { countdown--;if (!countdown) -return IXGBE_ERR_MBX ; +return -EIO ;udelay (mbx->usec_delay); }
@@ -140,12 +140,12 @@ static s32 ixgbe_poll_for_ack(struct ixgbe_hw *hw, u16 mbx_id)int countdown = mbx->timeout;if (!countdown || !mbx->ops) -return IXGBE_ERR_MBX ; +return -EIO ;while (mbx->ops->check_for_ack (hw, mbx_id)) { countdown--;if (!countdown) -return IXGBE_ERR_MBX ; +return -EIO ;udelay (mbx->usec_delay); }
@@ -169,7 +169,7 @@ static s32 ixgbe_read_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size,s32 ret_val;if (!mbx->ops) -return IXGBE_ERR_MBX ; +return -EIO ; ret_val =ixgbe_poll_for_msg (hw, mbx_id);if (ret_val)
@@ -197,7 +197,7 @@ static s32 ixgbe_write_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size,/* exit if either we can't write or there isn't a defined timeout */ if (!mbx->ops || !mbx->timeout) -return IXGBE_ERR_MBX ; +return -EIO ;/* send msg */ ret_val = mbx->ops->write (hw, msg, size, mbx_id);
@@ -217,7 +217,7 @@ static s32 ixgbe_check_for_bit_pf(struct ixgbe_hw *hw, u32 mask, s32 index)return 0 ; } -return IXGBE_ERR_MBX ; +return -EIO ; }/**
@@ -238,7 +238,7 @@ static s32 ixgbe_check_for_msg_pf(struct ixgbe_hw *hw, u16 vf_number)return 0 ; } -return IXGBE_ERR_MBX ; +return -EIO ; }/**
@@ -259,7 +259,7 @@ static s32 ixgbe_check_for_ack_pf(struct ixgbe_hw *hw, u16 vf_number)return 0 ; } -return IXGBE_ERR_MBX ; +return -EIO ; }/**
@@ -295,7 +295,7 @@ static s32 ixgbe_check_for_rst_pf(struct ixgbe_hw *hw, u16 vf_number)return 0 ; } -return IXGBE_ERR_MBX ; +return -EIO ; }/**
@@ -317,7 +317,7 @@ static s32 ixgbe_obtain_mbx_lock_pf(struct ixgbe_hw *hw, u16 vf_number)if (p2v_mailbox &IXGBE_PFMAILBOX_PFU )return 0 ; -return IXGBE_ERR_MBX ; +return -EIO ; }/**
drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h +0 -1
@@ -7,7 +7,6 @@#include "ixgbe_type.h" #define IXGBE_VFMAILBOX_SIZE 16/* 16 32 bit words - 64 bytes */ -#define IXGBE_ERR_MBX -100#define IXGBE_VFMAILBOX 0x002FC#define IXGBE_VFMBMEM 0x00200
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +42 -42
321 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +1 -1
@@ -1261,7 +1261,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)break ;default :e_err (drv,"Unhandled Msg %8.8x\n" , msgbuf[0 ]); - retval =IXGBE_ERR_MBX ; + retval = -EIO ;break ; }
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +0 -39
@@ -3649,45 +3649,6 @@ struct ixgbe_info {const u32 *mvals; }; - -/* Error Codes */ -#define IXGBE_ERR_EEPROM -1 -#define IXGBE_ERR_EEPROM_CHECKSUM -2 -#define IXGBE_ERR_PHY -3 -#define IXGBE_ERR_CONFIG -4 -#define IXGBE_ERR_PARAM -5 -#define IXGBE_ERR_MAC_TYPE -6 -#define IXGBE_ERR_UNKNOWN_PHY -7 -#define IXGBE_ERR_LINK_SETUP -8 -#define IXGBE_ERR_ADAPTER_STOPPED -9 -#define IXGBE_ERR_INVALID_MAC_ADDR -10 -#define IXGBE_ERR_DEVICE_NOT_SUPPORTED -11 -#define IXGBE_ERR_PRIMARY_REQUESTS_PENDING -12 -#define IXGBE_ERR_INVALID_LINK_SETTINGS -13 -#define IXGBE_ERR_AUTONEG_NOT_COMPLETE -14 -#define IXGBE_ERR_RESET_FAILED -15 -#define IXGBE_ERR_SWFW_SYNC -16 -#define IXGBE_ERR_PHY_ADDR_INVALID -17 -#define IXGBE_ERR_I2C -18 -#define IXGBE_ERR_SFP_NOT_SUPPORTED -19 -#define IXGBE_ERR_SFP_NOT_PRESENT -20 -#define IXGBE_ERR_SFP_NO_INIT_SEQ_PRESENT -21 -#define IXGBE_ERR_NO_SAN_ADDR_PTR -22 -#define IXGBE_ERR_FDIR_REINIT_FAILED -23 -#define IXGBE_ERR_EEPROM_VERSION -24 -#define IXGBE_ERR_NO_SPACE -25 -#define IXGBE_ERR_OVERTEMP -26 -#define IXGBE_ERR_FC_NOT_NEGOTIATED -27 -#define IXGBE_ERR_FC_NOT_SUPPORTED -28 -#define IXGBE_ERR_SFP_SETUP_NOT_COMPLETE -30 -#define IXGBE_ERR_PBA_SECTION -31 -#define IXGBE_ERR_INVALID_ARGUMENT -32 -#define IXGBE_ERR_HOST_INTERFACE_COMMAND -33 -#define IXGBE_ERR_FDIR_CMD_INCOMPLETE -38 -#define IXGBE_ERR_FW_RESP_INVALID -39 -#define IXGBE_ERR_TOKEN_RETRY -40 -#define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF -#define IXGBE_FUSES0_GROUP (_i) (0x11158 + ((_i) * 4))#define IXGBE_FUSES0_300MHZ BIT(5)#define IXGBE_FUSES0_REV_MASK (3u << 6)
drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c +22 -22
173 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +53 -54
409 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 134/202 ixgbe: Refactor overtemp event handling
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jedrzej Jagielski <[email protected]>
[ Upstream commit 6c1b4af8c1b20c70dde01e58381685d6a4a1d2c8 ]
Currently ixgbe driver is notified of overheating events via internal IXGBE_ERR_OVERTEMP error code.
Change the approach for handle_lasi() to use freshly introduced is_overtemp function parameter which set when such event occurs. Change check_overtemp() to bool and return true if overtemp event occurs.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 16 +++----- drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 21 +++++----- drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 4 +- drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 41 +++++++++++-------- 5 files changed, 43 insertions(+), 41 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +6 -10
@@ -2759,7 +2759,6 @@ static void ixgbe_check_overtemp_subtask(struct ixgbe_adapter *adapter) {struct ixgbe_hw *hw = &adapter->hw;u32 eicr = adapter->interrupt_event; -s32 rc;if (test_bit (__IXGBE_DOWN, &adapter->state))return ;
@@ -2793,14 +2792,13 @@ static void ixgbe_check_overtemp_subtask(struct ixgbe_adapter *adapter) }/* Check if this is not due to overtemp */ -if (hw->phy.ops.check_overtemp (hw) !=IXGBE_ERR_OVERTEMP ) +if (!hw->phy.ops.check_overtemp (hw))return ;break ;case IXGBE_DEV_ID_X550EM_A_1G_T :case IXGBE_DEV_ID_X550EM_A_1G_T_L : - rc = hw->phy.ops.check_overtemp (hw); -if (rc !=IXGBE_ERR_OVERTEMP ) +if (!hw->phy.ops.check_overtemp (hw))return ;break ;default :
@@ -7794,7 +7792,7 @@ static void ixgbe_service_timer(struct timer_list *t)static void ixgbe_phy_interrupt_subtask (struct ixgbe_adapter *adapter) {struct ixgbe_hw *hw = &adapter->hw; -u32 status; +bool overtemp;if (!(adapter->flags2 &IXGBE_FLAG2_PHY_INTERRUPT ))return ;
@@ -7804,11 +7802,9 @@ static void ixgbe_phy_interrupt_subtask(struct ixgbe_adapter *adapter)if (!hw->phy.ops.handle_lasi)return ; - status = hw->phy.ops.handle_lasi (&adapter->hw); -if (status !=IXGBE_ERR_OVERTEMP ) -return ; - -e_crit (drv,"%s\n" , ixgbe_overheat_msg); + hw->phy.ops.handle_lasi (&adapter->hw, &overtemp); +if (overtemp) +e_crit (drv,"%s\n" , ixgbe_overheat_msg); }static void ixgbe_reset_subtask (struct ixgbe_adapter *adapter)
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +11 -10
@@ -404,8 +404,7 @@ s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw)return status;/* Don't reset PHY if it's shut down due to overtemp. */ -if (!hw->phy.reset_if_overtemp && - (IXGBE_ERR_OVERTEMP == hw->phy.ops.check_overtemp (hw))) +if (!hw->phy.reset_if_overtemp && hw->phy.ops.check_overtemp (hw))return 0 ;/* Blocked by MNG FW so bail */
@@ -2315,22 +2314,24 @@ static void ixgbe_i2c_bus_clear(struct ixgbe_hw *hw)* @hw: pointer to hardware structure * * Checks if the LASI temp alarm status was triggered due to overtemp +* +* Return true when an overtemp event detected, otherwise false. **/ -s32 ixgbe_tn_check_overtemp (struct ixgbe_hw *hw) +bool ixgbe_tn_check_overtemp (struct ixgbe_hw *hw) {u16 phy_data =0 ; +u32 status;if (hw->device_id !=IXGBE_DEV_ID_82599_T3_LOM ) -return 0 ; +return false;/* Check that the LASI temp alarm status was triggered */ - hw->phy.ops.read_reg (hw,IXGBE_TN_LASI_STATUS_REG , -MDIO_MMD_PMAPMD , &phy_data); - -if (!(phy_data &IXGBE_TN_LASI_STATUS_TEMP_ALARM )) -return 0 ; + status = hw->phy.ops.read_reg (hw,IXGBE_TN_LASI_STATUS_REG , +MDIO_MMD_PMAPMD , &phy_data); +if (status) +return false; -return IXGBE_ERR_OVERTEMP ; +return !!(phy_data &IXGBE_TN_LASI_STATUS_TEMP_ALARM ); }/** ixgbe_set_copper_phy_power - Control power for copper phy
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h +1 -1
@@ -153,7 +153,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw);s32 ixgbe_get_sfp_init_sequence_offsets (struct ixgbe_hw *hw,u16 *list_offset,u16 *data_offset); -s32 ixgbe_tn_check_overtemp (struct ixgbe_hw *hw); +bool ixgbe_tn_check_overtemp (struct ixgbe_hw *hw);s32 ixgbe_read_i2c_byte_generic (struct ixgbe_hw *hw,u8 byte_offset,u8 dev_addr,u8 *data); s32 ixgbe_read_i2c_byte_generic_unlocked(struct ixgbe_hw *hw, u8 byte_offset,
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +2 -2
@@ -3493,10 +3493,10 @@ struct ixgbe_phy_operations {s32 (*read_i2c_sff8472)(struct ixgbe_hw *,u8 ,u8 *);s32 (*read_i2c_eeprom)(struct ixgbe_hw *,u8 ,u8 *);s32 (*write_i2c_eeprom)(struct ixgbe_hw *,u8 ,u8 ); -s32 (*check_overtemp)(struct ixgbe_hw *); +bool (*check_overtemp)(struct ixgbe_hw *);s32 (*set_phy_power)(struct ixgbe_hw *,bool on);s32 (*enter_lplu)(struct ixgbe_hw *); -s32 (*handle_lasi)(struct ixgbe_hw *hw); +s32 (*handle_lasi)(struct ixgbe_hw *hw,bool *);s32 (*read_i2c_byte_unlocked)(struct ixgbe_hw *,u8 offset,u8 addr,u8 *value); s32 (*write_i2c_byte_unlocked)(struct ixgbe_hw *, u8 offset, u8 addr,
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +23 -18
117 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 135/202 ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit bbc404d20d1b46d89b461918bc44587620eda200 ]
All error handling paths, except this one, go to 'out' where release_swfw_sync() is called.
This call balances the acquire_swfw_sync() call done at the beginning of the function.
Branch to the error handling path in order to correctly release some resources in case of error.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +2 -1
@@ -717,7 +717,8 @@ static s32 ixgbe_read_iosf_sb_reg_x550(struct ixgbe_hw *hw, u32 reg_addr, error = (command &IXGBE_SB_IOSF_CTRL_CMPL_ERR_MASK ) >>IXGBE_SB_IOSF_CTRL_CMPL_ERR_SHIFT ;hw_dbg (hw,"Failed to read, error %x\n" , error); -return -EIO ; + ret = -EIO ; + goto out; }if (!ret)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 136/202 ipv6: Ensure natural alignment of const ipv6 loopback and router addresses
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
[ Upstream commit 60365049ccbacd101654a66ddcb299abfabd4fc5 ]
On a parisc64 kernel I sometimes notice this kernel warning:
Kernel unaligned access to 0x40ff8814 at ndisc_send_skb+0xc0/0x4d8
The address 0x40ff8814 points to the in6addr_linklocal_allrouters variable and the warning simply means that some ipv6 function tries to read a 64-bit word directly from the not-64-bit aligned in6addr_linklocal_allrouters variable.
Unaligned accesses are non-critical as the architecture or exception handlers usually will fix it up at runtime. Nevertheless it may trigger a performance penality for some architectures. For details read the "unaligned-memory-access" kernel documentation.
The patch below ensures that the ipv6 loopback and router addresses will always be naturally aligned. This prevents the unaligned accesses for all architectures.
--- net/ipv6/addrconf_core.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
net/ipv6/addrconf_core.c +14 -7
@@ -180,19 +180,26 @@ const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) {EXPORT_SYMBOL_GPL (ipv6_stub);/* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */ -const struct in6_addr in6addr_loopback =IN6ADDR_LOOPBACK_INIT ; +const struct in6_addr in6addr_loopback__aligned(BITS_PER_LONG/8) + =IN6ADDR_LOOPBACK_INIT ;EXPORT_SYMBOL (in6addr_loopback); -const struct in6_addr in6addr_any =IN6ADDR_ANY_INIT ; +const struct in6_addr in6addr_any__aligned(BITS_PER_LONG/8) + =IN6ADDR_ANY_INIT ;EXPORT_SYMBOL (in6addr_any); -const struct in6_addr in6addr_linklocal_allnodes =IN6ADDR_LINKLOCAL_ALLNODES_INIT ; +const struct in6_addr in6addr_linklocal_allnodes__aligned(BITS_PER_LONG/8) + =IN6ADDR_LINKLOCAL_ALLNODES_INIT ;EXPORT_SYMBOL (in6addr_linklocal_allnodes); -const struct in6_addr in6addr_linklocal_allrouters =IN6ADDR_LINKLOCAL_ALLROUTERS_INIT ; +const struct in6_addr in6addr_linklocal_allrouters__aligned(BITS_PER_LONG/8) + =IN6ADDR_LINKLOCAL_ALLROUTERS_INIT ;EXPORT_SYMBOL (in6addr_linklocal_allrouters); -const struct in6_addr in6addr_interfacelocal_allnodes =IN6ADDR_INTERFACELOCAL_ALLNODES_INIT ; +const struct in6_addr in6addr_interfacelocal_allnodes__aligned(BITS_PER_LONG/8) + =IN6ADDR_INTERFACELOCAL_ALLNODES_INIT ;EXPORT_SYMBOL (in6addr_interfacelocal_allnodes); -const struct in6_addr in6addr_interfacelocal_allrouters =IN6ADDR_INTERFACELOCAL_ALLROUTERS_INIT ; +const struct in6_addr in6addr_interfacelocal_allrouters__aligned(BITS_PER_LONG/8) + =IN6ADDR_INTERFACELOCAL_ALLROUTERS_INIT ;EXPORT_SYMBOL (in6addr_interfacelocal_allrouters); -const struct in6_addr in6addr_sitelocal_allrouters =IN6ADDR_SITELOCAL_ALLROUTERS_INIT ; +const struct in6_addr in6addr_sitelocal_allrouters__aligned(BITS_PER_LONG/8) + =IN6ADDR_SITELOCAL_ALLROUTERS_INIT ;EXPORT_SYMBOL (in6addr_sitelocal_allrouters);static void snmp6_free_dev (struct inet6_dev *idev)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 137/202 llc: call sock_orphan() at release time
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit aa2b2eb3934859904c287bf5434647ba72e14c1c ]
syzbot reported an interesting trace [1] caused by a stale sk->sk_wq pointer in a closed llc socket.
In commit ff7b11aa481f ("net: socket: set sock->sk to NULL after calling proto_ops::release()") Eric Biggers hinted that some protocols are missing a sock_orphan(), we need to perform a full audit.
In net-next, I plan to clear sock->sk from sock_orphan() and amend Eric patch to add a warning.
[1]
BUG: KASAN: slab-use-after-free in list_empty include/linux/list.h:373 [inline] BUG: KASAN: slab-use-after-free in waitqueue_active include/linux/wait.h:127 [inline] BUG: KASAN: slab-use-after-free in sock_def_write_space_wfree net/core/sock.c:3384 [inline] BUG: KASAN: slab-use-after-free in sock_wfree+0x9a8/0x9d0 net/core/sock.c:2468 Read of size 8 at addr ffff88802f4fc880 by task ksoftirqd/1/27 CPU: 1 PID: 27 Comm: ksoftirqd/1 Not tainted 6.8.0-rc1-syzkaller-00049-g6098d87eaf31 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc4/0x620 mm/kasan/report.c:488 kasan_report+0xda/0x110 mm/kasan/report.c:601 list_empty include/linux/list.h:373 [inline] waitqueue_active include/linux/wait.h:127 [inline] sock_def_write_space_wfree net/core/sock.c:3384 [inline] sock_wfree+0x9a8/0x9d0 net/core/sock.c:2468 skb_release_head_state+0xa3/0x2b0 net/core/skbuff.c:1080 skb_release_all net/core/skbuff.c:1092 [inline] napi_consume_skb+0x119/0x2b0 net/core/skbuff.c:1404 e1000_unmap_and_free_tx_resource+0x144/0x200 drivers/net/ethernet/intel/e1000/e1000_main.c:1970 e1000_clean_tx_irq drivers/net/ethernet/intel/e1000/e1000_main.c:3860 [inline] e1000_clean+0x4a1/0x26e0 drivers/net/ethernet/intel/e1000/e1000_main.c:3801 __napi_poll.constprop.0+0xb4/0x540 net/core/dev.c:6576 napi_poll net/core/dev.c:6645 [inline] net_rx_action+0x956/0xe90 net/core/dev.c:6778 __do_softirq+0x21a/0x8de kernel/softirq.c:553 run_ksoftirqd kernel/softirq.c:921 [inline] run_ksoftirqd+0x31/0x60 kernel/softirq.c:913 smpboot_thread_fn+0x660/0xa10 kernel/smpboot.c:164 kthread+0x2c6/0x3a0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 </TASK> Allocated by task 5167: kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:314 [inline] __kasan_slab_alloc+0x81/0x90 mm/kasan/common.c:340 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3813 [inline] slab_alloc_node mm/slub.c:3860 [inline] kmem_cache_alloc_lru+0x142/0x6f0 mm/slub.c:3879 alloc_inode_sb include/linux/fs.h:3019 [inline] sock_alloc_inode+0x25/0x1c0 net/socket.c:308 alloc_inode+0x5d/0x220 fs/inode.c:260 new_inode_pseudo+0x16/0x80 fs/inode.c:1005 sock_alloc+0x40/0x270 net/socket.c:634 __sock_create+0xbc/0x800 net/socket.c:1535 sock_create net/socket.c:1622 [inline] __sys_socket_create net/socket.c:1659 [inline] __sys_socket+0x14c/0x260 net/socket.c:1706 __do_sys_socket net/socket.c:1720 [inline] __se_sys_socket net/socket.c:1718 [inline] __x64_sys_socket+0x72/0xb0 net/socket.c:1718 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd3/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b Freed by task 0: kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3f/0x60 mm/kasan/generic.c:640 poison_slab_object mm/kasan/common.c:241 [inline] __kasan_slab_free+0x121/0x1b0 mm/kasan/common.c:257 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2121 [inline] slab_free mm/slub.c:4299 [inline] kmem_cache_free+0x129/0x350 mm/slub.c:4363 i_callback+0x43/0x70 fs/inode.c:249 rcu_do_batch kernel/rcu/tree.c:2158 [inline] rcu_core+0x819/0x1680 kernel/rcu/tree.c:2433 __do_softirq+0x21a/0x8de kernel/softirq.c:553 Last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 __kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:586 __call_rcu_common.constprop.0+0x9a/0x7b0 kernel/rcu/tree.c:2683 destroy_inode+0x129/0x1b0 fs/inode.c:315 iput_final fs/inode.c:1739 [inline] iput.part.0+0x560/0x7b0 fs/inode.c:1765 iput+0x5c/0x80 fs/inode.c:1755 dentry_unlink_inode+0x292/0x430 fs/dcache.c:400 __dentry_kill+0x1ca/0x5f0 fs/dcache.c:603 dput.part.0+0x4ac/0x9a0 fs/dcache.c:845 dput+0x1f/0x30 fs/dcache.c:835 __fput+0x3b9/0xb70 fs/file_table.c:384 task_work_run+0x14d/0x240 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xa8a/0x2ad0 kernel/exit.c:871 do_group_exit+0xd4/0x2a0 kernel/exit.c:1020 __do_sys_exit_group kernel/exit.c:1031 [inline] __se_sys_exit_group kernel/exit.c:1029 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1029 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd3/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b The buggy address belongs to the object at ffff88802f4fc800 which belongs to the cache sock_inode_cache of size 1408
The buggy address is located 128 bytes inside of
freed 1408-byte region [ffff88802f4fc800, ffff88802f4fcd80)
The buggy address belongs to the physical page:
page:ffffea0000bd3e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2f4f8 head:ffffea0000bd3e00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)page_type: 0xffffffff()
raw: 00fff00000000840 ffff888013b06b40 0000000000000000 0000000000000001 raw: 0000000000000000 0000000080150015 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Reclaimable, gfp_mask 0xd20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_RECLAIMABLE), pid 4956, tgid 4956 (sshd), ts 31423924727, free_ts 0 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2d0/0x350 mm/page_alloc.c:1533 prep_new_page mm/page_alloc.c:1540 [inline] get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3311 __alloc_pages+0x22f/0x2440 mm/page_alloc.c:4567 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page mm/slub.c:2190 [inline] allocate_slab mm/slub.c:2354 [inline] new_slab+0xcc/0x3a0 mm/slub.c:2407 ___slab_alloc+0x4af/0x19a0 mm/slub.c:3540 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3625 __slab_alloc_node mm/slub.c:3678 [inline] slab_alloc_node mm/slub.c:3850 [inline] kmem_cache_alloc_lru+0x379/0x6f0 mm/slub.c:3879 alloc_inode_sb include/linux/fs.h:3019 [inline] sock_alloc_inode+0x25/0x1c0 net/socket.c:308 alloc_inode+0x5d/0x220 fs/inode.c:260 new_inode_pseudo+0x16/0x80 fs/inode.c:1005 sock_alloc+0x40/0x270 net/socket.c:634 __sock_create+0xbc/0x800 net/socket.c:1535 sock_create net/socket.c:1622 [inline] __sys_socket_create net/socket.c:1659 [inline] __sys_socket+0x14c/0x260 net/socket.c:1706 __do_sys_socket net/socket.c:1720 [inline] __se_sys_socket net/socket.c:1718 [inline] __x64_sys_socket+0x72/0xb0 net/socket.c:1718 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd3/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b
page_owner free stack trace missing
Memory state around the buggy address:
ffff88802f4fc780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88802f4fc800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88802f4fc880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88802f4fc900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88802f4fc980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb--- net/llc/af_llc.c | 2 ++ 1 file changed, 2 insertions(+)
net/llc/af_llc.c +2 -0
@@ -227,6 +227,8 @@ static int llc_ui_release(struct socket *sock)if (llc->dev)dev_put (llc->dev);sock_put (sk); +sock_orphan (sk); + sock->sk =NULL ;llc_sk_free (sk); out:return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 138/202 netfilter: nf_log: replace BUG_ON by WARN_ON_ONCE when putting logger
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 259eb32971e9eb24d1777a28d82730659f50fdcb ]
Module reference is bumped for each user, this should not ever happen.
But BUG_ON check should use rcu_access_pointer() instead.
If this ever happens, do WARN_ON_ONCE() instead of BUG_ON() and consolidate pointer check under the rcu read side lock section.
--- net/netfilter/nf_log.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/netfilter/nf_log.c +4 -3
@@ -202,11 +202,12 @@ void nf_logger_put(int pf, enum nf_log_type type)return ; } -BUG_ON (loggers[pf][type] ==NULL ); -rcu_read_lock (); logger =rcu_dereference (loggers[pf][type]); -module_put (logger->me); +if (!logger) +WARN_ON_ONCE (1 ); +else +module_put (logger->me);rcu_read_unlock (); }EXPORT_SYMBOL_GPL (nf_logger_put);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 139/202 net: ipv4: fix a memleak in ip_setup_cork
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhipeng Lu <[email protected]>
[ Upstream commit 5dee6d6923458e26966717f2a3eae7d09fc10bf6 ]
When inetdev_valid_mtu fails, cork->opt should be freed if it is allocated in ip_setup_cork. Otherwise there could be a memleak.
--- net/ipv4/ip_output.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
net/ipv4/ip_output.c +6 -6
@@ -1140,6 +1140,12 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork,if (unlikely (!rt))return -EFAULT ; + cork->fragsize =ip_sk_use_pmtu (sk) ? +dst_mtu (&rt->dst) :READ_ONCE (rt->dst.dev->mtu); + +if (!inetdev_valid_mtu (cork->fragsize)) +return -ENETUNREACH ; +/* * setup for corking. */
@@ -1156,12 +1162,6 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork, cork->addr = ipc->addr; } - cork->fragsize =ip_sk_use_pmtu (sk) ? -dst_mtu (&rt->dst) :READ_ONCE (rt->dst.dev->mtu); - -if (!inetdev_valid_mtu (cork->fragsize)) -return -ENETUNREACH ; - cork->gso_size = ipc->gso_size; cork->dst = &rt->dst;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 140/202 af_unix: fix lockdep positive in sk_diag_dump_icons()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 4d322dce82a1d44f8c83f0f54f95dd1b8dcf46c9 ]
syzbot reported a lockdep splat [1].
Blamed commit hinted about the possible lockdep
violation, and code used unix_state_lock_nested()
in an attempt to silence lockdep.
It is not sufficient, because unix_state_lock_nested() is already used from unix_state_double_lock().
We need to use a separate subclass.
This patch adds a distinct enumeration to make things more explicit.
Also use swap() in unix_state_double_lock() as a clean up.
v2: add a missing inline keyword to unix_state_lock_nested()
[1]
WARNING: possible circular locking dependency detected 6.8.0-rc1-syzkaller-00356-g8a696a29c690 #0 Not tainted
syz-executor.1/2542 is trying to acquire lock:
ffff88808b5df9e8 (rlock-AF_UNIX){+.+.}-{2:2}, at: skb_queue_tail+0x36/0x120 net/core/skbuff.c:3863
but task is already holding lock:
ffff88808b5dfe70 (&u->lock/1){+.+.}-{2:2}, at: unix_dgram_sendmsg+0xfc7/0x2200 net/unix/af_unix.c:2089
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&u->lock/1){+.+.}-{2:2}:
lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754
_raw_spin_lock_nested+0x31/0x40 kernel/locking/spinlock.c:378
sk_diag_dump_icons net/unix/diag.c:87 [inline]
sk_diag_fill+0x6ea/0xfe0 net/unix/diag.c:157
sk_diag_dump net/unix/diag.c:196 [inline]
unix_diag_dump+0x3e9/0x630 net/unix/diag.c:220
netlink_dump+0x5c1/0xcd0 net/netlink/af_netlink.c:2264
__netlink_dump_start+0x5d7/0x780 net/netlink/af_netlink.c:2370
netlink_dump_start include/linux/netlink.h:338 [inline]
unix_diag_handler_dump+0x1c3/0x8f0 net/unix/diag.c:319
sock_diag_rcv_msg+0xe3/0x400
netlink_rcv_skb+0x1df/0x430 net/netlink/af_netlink.c:2543
sock_diag_rcv+0x2a/0x40 net/core/sock_diag.c:280
netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline]
netlink_unicast+0x7e6/0x980 net/netlink/af_netlink.c:1367
netlink_sendmsg+0xa37/0xd70 net/netlink/af_netlink.c:1908
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
sock_write_iter+0x39a/0x520 net/socket.c:1160
call_write_iter include/linux/fs.h:2085 [inline]
new_sync_write fs/read_write.c:497 [inline]
vfs_write+0xa74/0xca0 fs/read_write.c:590
ksys_write+0x1a0/0x2c0 fs/read_write.c:643
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf5/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x63/0x6b-> #0 (rlock-AF_UNIX){+.+.}-{2:2}:
check_prev_add kernel/locking/lockdep.c:3134 [inline]
check_prevs_add kernel/locking/lockdep.c:3253 [inline]
validate_chain+0x1909/0x5ab0 kernel/locking/lockdep.c:3869
__lock_acquire+0x1345/0x1fd0 kernel/locking/lockdep.c:5137
lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162
skb_queue_tail+0x36/0x120 net/core/skbuff.c:3863
unix_dgram_sendmsg+0x15d9/0x2200 net/unix/af_unix.c:2112
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
____sys_sendmsg+0x592/0x890 net/socket.c:2584
___sys_sendmsg net/socket.c:2638 [inline]
__sys_sendmmsg+0x3b2/0x730 net/socket.c:2724
__do_sys_sendmmsg net/socket.c:2753 [inline]
__se_sys_sendmmsg net/socket.c:2750 [inline]
__x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2750
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf5/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x63/0x6bother info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&u->lock/1);
lock(rlock-AF_UNIX);
lock(&u->lock/1); lock(rlock-AF_UNIX);
*** DEADLOCK ***
1 lock held by syz-executor.1/2542:
#0: ffff88808b5dfe70 (&u->lock/1){+.+.}-{2:2}, at: unix_dgram_sendmsg+0xfc7/0x2200 net/unix/af_unix.c:2089
stack backtrace: CPU: 1 PID: 2542 Comm: syz-executor.1 Not tainted 6.8.0-rc1-syzkaller-00356-g8a696a29c690 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 check_noncircular+0x366/0x490 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain+0x1909/0x5ab0 kernel/locking/lockdep.c:3869 __lock_acquire+0x1345/0x1fd0 kernel/locking/lockdep.c:5137 lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162 skb_queue_tail+0x36/0x120 net/core/skbuff.c:3863 unix_dgram_sendmsg+0x15d9/0x2200 net/unix/af_unix.c:2112 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] ____sys_sendmsg+0x592/0x890 net/socket.c:2584 ___sys_sendmsg net/socket.c:2638 [inline] __sys_sendmmsg+0x3b2/0x730 net/socket.c:2724 __do_sys_sendmmsg net/socket.c:2753 [inline] __se_sys_sendmmsg net/socket.c:2750 [inline] __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2750 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7f26d887cda9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f26d95a60c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000133 RAX: ffffffffffffffda RBX: 00007f26d89abf80 RCX: 00007f26d887cda9 RDX: 000000000000003e RSI: 00000000200bd000 RDI: 0000000000000004 RBP: 00007f26d88c947a R08: 0000000000000000 R09: 0000000000000000 R10: 00000000000008c0 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f26d89abf80 R15: 00007ffcfe081a68
--- include/net/af_unix.h | 20 ++++++++++++++------ net/unix/af_unix.c | 14 ++++++-------- net/unix/diag.c | 2 +- 3 files changed, 21 insertions(+), 15 deletions(-)
include/net/af_unix.h +14 -6
@@ -43,12 +43,6 @@ struct unix_skb_parms {#define UNIXCB (skb) (*(struct unix_skb_parms *)&((skb)->cb)) -#define unix_state_lock (s) spin_lock(&unix_sk(s)->lock) -#define unix_state_unlock (s) spin_unlock(&unix_sk(s)->lock) -#define unix_state_lock_nested (s) \ - spin_lock_nested(&unix_sk(s)->lock, \ - SINGLE_DEPTH_NESTING) -/* The AF_UNIX socket */ struct unix_sock {/* WARNING: sk has to be the first member */
@@ -72,6 +66,20 @@ static inline struct unix_sock *unix_sk(const struct sock *sk)return (struct unix_sock *)sk; } +#define unix_state_lock (s) spin_lock(&unix_sk(s)->lock) +#define unix_state_unlock (s) spin_unlock(&unix_sk(s)->lock) +enum unix_socket_lock_class { +U_LOCK_NORMAL , +U_LOCK_SECOND ,/* for double locking, see unix_state_double_lock(). */ +U_LOCK_DIAG ,/* used while dumping icons, see sk_diag_dump_icons(). */ +}; + +static inline void unix_state_lock_nested (struct sock *sk, +enum unix_socket_lock_class subclass) +{ +spin_lock_nested (&unix_sk (sk)->lock, subclass); +} +#define peer_wait peer_wq.waitlong unix_inq_len (struct sock *sk);
net/unix/af_unix.c +6 -8
@@ -1123,13 +1123,11 @@ static void unix_state_double_lock(struct sock *sk1, struct sock *sk2)unix_state_lock (sk1);return ; } -if (sk1 < sk2) { -unix_state_lock (sk1); -unix_state_lock_nested (sk2); - }else { -unix_state_lock (sk2); -unix_state_lock_nested (sk1); - } +if (sk1 > sk2) +swap (sk1, sk2); + +unix_state_lock (sk1); +unix_state_lock_nested (sk2,U_LOCK_SECOND ); }static void unix_state_double_unlock (struct sock *sk1,struct sock *sk2)
@@ -1348,7 +1346,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr, goto out_unlock; } -unix_state_lock_nested (sk); +unix_state_lock_nested (sk,U_LOCK_SECOND );if (sk->sk_state != st) {unix_state_unlock (sk);
net/unix/diag.c +1 -1
@@ -80,7 +80,7 @@ static int sk_diag_dump_icons(struct sock *sk, struct sk_buff *nlskb)* queue lock. With the other's queue locked it's * OK to lock the state. */ -unix_state_lock_nested (req); +unix_state_lock_nested (req,U_LOCK_DIAG ); peer =unix_sk (req)->peer; buf[i++] = (peer ?sock_i_ino (peer) :0 );unix_state_unlock (req);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 141/202 net: sysfs: Fix /sys/class/net/<iface> path
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit ae3f4b44641dfff969604735a0dcbf931f383285 ]
The documentation is pointing to the wrong path for the interface. Documentation is pointing to /sys/class/<iface>, instead of /sys/class/net/<iface>.
Fix it by adding the net/ directory before the interface.
--- .../ABI/testing/sysfs-class-net-queues | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-)
Documentation/ABI/testing/sysfs-class-net-queues +11 -11
@@ -1,4 +1,4 @@ -What: /sys/class/<iface>/queues/rx-<queue>/rps_cpus +What: /sys/class/net/<iface>/queues/rx-<queue>/rps_cpus Date: March 2010 KernelVersion: 2.6.35 Contact: [email protected]
@@ -8,7 +8,7 @@ Description: network device queue. Possible values depend on the number of available CPU(s) in the system. -What: /sys/class/<iface>/queues/rx-<queue>/rps_flow_cnt +What: /sys/class/net/<iface>/queues/rx-<queue>/rps_flow_cnt Date: April 2010 KernelVersion: 2.6.35 Contact: [email protected]
@@ -16,7 +16,7 @@ Description: Number of Receive Packet Steering flows being currently processed by this particular network device receive queue. -What: /sys/class/<iface>/queues/tx-<queue>/tx_timeout +What: /sys/class/net/<iface>/queues/tx-<queue>/tx_timeout Date: November 2011 KernelVersion: 3.3 Contact: [email protected]
@@ -24,7 +24,7 @@ Description: Indicates the number of transmit timeout events seen by this network interface transmit queue. -What: /sys/class/<iface>/queues/tx-<queue>/tx_maxrate +What: /sys/class/net/<iface>/queues/tx-<queue>/tx_maxrate Date: March 2015 KernelVersion: 4.1 Contact: [email protected]
@@ -32,7 +32,7 @@ Description: A Mbps max-rate set for the queue, a value of zero means disabled, default is disabled. -What: /sys/class/<iface>/queues/tx-<queue>/xps_cpus +What: /sys/class/net/<iface>/queues/tx-<queue>/xps_cpus Date: November 2010 KernelVersion: 2.6.38 Contact: [email protected]
@@ -42,7 +42,7 @@ Description: network device transmit queue. Possible vaules depend on the number of available CPU(s) in the system. -What: /sys/class/<iface>/queues/tx-<queue>/xps_rxqs +What: /sys/class/net/<iface>/queues/tx-<queue>/xps_rxqs Date: June 2018 KernelVersion: 4.18.0 Contact: [email protected]
@@ -53,7 +53,7 @@ Description: number of available receive queue(s) in the network device. Default is disabled. -What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/hold_time +What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/hold_time Date: November 2011 KernelVersion: 3.3 Contact: [email protected]
@@ -62,7 +62,7 @@ Description: of this particular network device transmit queue. Default value is 1000. -What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/inflight +What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/inflight Date: November 2011 KernelVersion: 3.3 Contact: [email protected]
@@ -70,7 +70,7 @@ Description: Indicates the number of bytes (objects) in flight on this network device transmit queue. -What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/limit +What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/limit Date: November 2011 KernelVersion: 3.3 Contact: [email protected]
@@ -79,7 +79,7 @@ Description: on this network device transmit queue. This value is clamped to be within the bounds defined by limit_max and limit_min. -What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/limit_max +What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/limit_max Date: November 2011 KernelVersion: 3.3 Contact: [email protected]
@@ -88,7 +88,7 @@ Description: queued on this network device transmit queue. See include/linux/dynamic_queue_limits.h for the default value. -What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/limit_min +What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/limit_min Date: November 2011 KernelVersion: 3.3 Contact: [email protected]
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 142/202 HID: apple: Add support for the 2021 Magic Keyboard
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Henrie <[email protected]>
commit 0cd3be51733febb4f8acb92bcf55b75fe824dd05 upstream.
--- drivers/hid/hid-apple.c | 4 ++++ drivers/hid/hid-ids.h | 1 + drivers/hid/hid-quirks.c | 1 + 3 files changed, 6 insertions(+)
drivers/hid/hid-apple.c +4 -0
@@ -599,6 +599,10 @@ static const struct hid_device_id apple_ .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021), + .driver_data = APPLE_HAS_FN }, + { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021), + .driver_data = APPLE_HAS_FN }, { } };
drivers/hid/hid-ids.h +1 -0
@@ -176,6 +176,7 @@#define USB_DEVICE_ID_APPLE_IRCONTROL3 0x8241#define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242#define USB_DEVICE_ID_APPLE_IRCONTROL5 0x8243 +#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021 0x029c#define USB_VENDOR_ID_ASUS 0x0486#define USB_DEVICE_ID_ASUS_T91MT 0x0185
drivers/hid/hid-quirks.c +1 -0
@@ -301,6 +301,7 @@ static const struct hid_device_id hid_ha { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021) }, #endif #if IS_ENABLED(CONFIG_HID_APPLEIR) { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) },
Greg Kroah-Hartman
maintainerPATCH 143/202 HID: apple: Swap the Fn and Left Control keys on Apple keyboards
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: free5lot <[email protected]>
commit 346338ef00d35bf8338ded171f9abeb9b10b43df upstream.
This patch allows users to swap the Fn and left Control keys on all Apple
keyboards: internal (e.g. Macbooks) and external (both wired and wireless). The patch adds a new hid-apple module param: swap_fn_leftctrl (off by default).
--- drivers/hid/hid-apple.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-)
drivers/hid/hid-apple.c +28 -2
@@ -54,6 +54,12 @@ MODULE_PARM_DESC(swap_opt_cmd, "Swap the"(For people who want to keep Windows PC keyboard muscle memory. " "[0] = as-is, Mac layout. 1 = swapped, Windows layout.)"); +static unsigned int swap_fn_leftctrl; +module_param (swap_fn_leftctrl, uint,0644 ); +MODULE_PARM_DESC (swap_fn_leftctrl,"Swap the Fn and left Control keys. " +"(For people who want to keep PC keyboard muscle memory. " +"[0] = as-is, Mac layout, 1 = swapped, PC layout)" ); +struct apple_sc {unsigned long quirks;unsigned int fn_on;
@@ -166,6 +172,11 @@ static const struct apple_key_translatio { } }; +static const struct apple_key_translation swapped_fn_leftctrl_keys[] = { + {KEY_FN ,KEY_LEFTCTRL }, + { } +}; +static const struct apple_key_translation *apple_find_translation (const struct apple_key_translation *table,u16 from) {
@@ -187,9 +198,11 @@ static int hidinput_apple_event(struct hbool do_translate;u16 code =0 ; -if (usage->code ==KEY_FN ) { +u16 fn_keycode = (swap_fn_leftctrl) ? (KEY_LEFTCTRL ) : (KEY_FN ); + +if (usage->code == fn_keycode) { asc->fn_on = !!value; -input_event (input, usage->type, usage->code, value); +input_event (input, usage->type,KEY_FN , value);return 1 ; }
@@ -274,6 +287,14 @@ static int hidinput_apple_event(struct h } } +if (swap_fn_leftctrl) { + trans =apple_find_translation (swapped_fn_leftctrl_keys, usage->code); +if (trans) { +input_event (input, usage->type, trans->to, value); +return 1 ; + } + } +return 0 ; }
@@ -344,6 +365,11 @@ static void apple_setup_input(struct inpfor (trans = apple_iso_keyboard; trans->from; trans++)set_bit (trans->to, input->keybit); + +if (swap_fn_leftctrl) { +for (trans = swapped_fn_leftctrl_keys; trans->from; trans++) +set_bit (trans->to, input->keybit); + } } static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi,
Greg Kroah-Hartman
maintainerPATCH 144/202 HID: apple: Add 2021 magic keyboard FN key mapping
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Berg <[email protected]>
commit 531cb56972f2773c941499fcfb639cd5128dfb27 upstream.
The new 2021 apple models have a different FN key assignment. Add a new translation table and use that for the 2021 magic keyboard.
--- drivers/hid/hid-apple.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
drivers/hid/hid-apple.c +28 -1
@@ -73,6 +73,28 @@ struct apple_key_translation {u8 flags; }; +static const struct apple_key_translation apple2021_fn_keys[] = { + {KEY_BACKSPACE ,KEY_DELETE }, + {KEY_ENTER ,KEY_INSERT }, + {KEY_F1 ,KEY_BRIGHTNESSDOWN ,APPLE_FLAG_FKEY }, + {KEY_F2 ,KEY_BRIGHTNESSUP ,APPLE_FLAG_FKEY }, + {KEY_F3 ,KEY_SCALE ,APPLE_FLAG_FKEY }, + {KEY_F4 ,KEY_SEARCH ,APPLE_FLAG_FKEY }, + {KEY_F5 ,KEY_MICMUTE ,APPLE_FLAG_FKEY }, + {KEY_F6 ,KEY_SLEEP ,APPLE_FLAG_FKEY }, + {KEY_F7 ,KEY_PREVIOUSSONG ,APPLE_FLAG_FKEY }, + {KEY_F8 ,KEY_PLAYPAUSE ,APPLE_FLAG_FKEY }, + {KEY_F9 ,KEY_NEXTSONG ,APPLE_FLAG_FKEY }, + {KEY_F10 ,KEY_MUTE ,APPLE_FLAG_FKEY }, + {KEY_F11 ,KEY_VOLUMEDOWN ,APPLE_FLAG_FKEY }, + {KEY_F12 ,KEY_VOLUMEUP ,APPLE_FLAG_FKEY }, + {KEY_UP ,KEY_PAGEUP }, + {KEY_DOWN ,KEY_PAGEDOWN }, + {KEY_LEFT ,KEY_HOME }, + {KEY_RIGHT ,KEY_END }, + { } +}; +static const struct apple_key_translation macbookair_fn_keys[] = { {KEY_BACKSPACE ,KEY_DELETE }, {KEY_ENTER ,KEY_INSERT },
@@ -207,7 +229,9 @@ static int hidinput_apple_event(struct h }if (fnmode) { -if (hid->product >=USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI && +if (hid->product ==USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021 ) + table = apple2021_fn_keys; +else if (hid->product >=USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI && hid->product <=USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS ) table = macbookair_fn_keys;else if (hid->product <0x21d || hid->product >=0x300 )
@@ -366,6 +390,9 @@ static void apple_setup_input(struct inpfor (trans = apple_iso_keyboard; trans->from; trans++)set_bit (trans->to, input->keybit); +for (trans = apple2021_fn_keys; trans->from; trans++) +set_bit (trans->to, input->keybit); +if (swap_fn_leftctrl) {for (trans = swapped_fn_leftctrl_keys; trans->from; trans++)set_bit (trans->to, input->keybit);
Greg Kroah-Hartman
maintainerPATCH 145/202 bonding: remove print in bond_verify_device_path
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhengchao Shao <[email protected]>
commit 486058f42a4728053ae69ebbf78e9731d8ce6f8b upstream.
As suggested by Paolo in link[1], if the memory allocation fails, the mm layer will emit a lot warning comprising the backtrace, so remove the print.
[1] https://lore.kernel.org/all/[email protected]/
--- drivers/net/bonding/bond_main.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/bonding/bond_main.c +1 -4
@@ -2460,11 +2460,8 @@ struct bond_vlan_tag *bond_verify_deviceif (start_dev == end_dev) { tags =kcalloc (level +1 ,sizeof (*tags),GFP_ATOMIC ); -if (!tags) { -net_err_ratelimited ("%s: %s: Failed to allocate tags\n" , - __func__, start_dev->name); +if (!tags)return ERR_PTR (-ENOMEM ); - } tags[level].vlan_proto =VLAN_N_VID ;return tags; }
Greg Kroah-Hartman
maintainerPATCH 146/202 dmaengine: fix is_slave_direction() return false when DMA_DEV_TO_DEV
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
[ Upstream commit a22fe1d6dec7e98535b97249fdc95c2be79120bb ]
is_slave_direction() should return true when direction is DMA_DEV_TO_DEV.
--- include/linux/dmaengine.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/dmaengine.h +2 -1
@@ -827,7 +827,8 @@ static inline int dmaengine_slave_config(struct dma_chan *chan,static inline bool is_slave_direction (enum dma_transfer_direction direction) { -return (direction ==DMA_MEM_TO_DEV ) || (direction ==DMA_DEV_TO_MEM ); +return (direction ==DMA_MEM_TO_DEV ) || (direction ==DMA_DEV_TO_MEM ) || + (direction ==DMA_DEV_TO_DEV ); } static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 147/202 phy: ti: phy-omap-usb2: Fix NULL pointer dereference for SRP
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Lindgren <[email protected]>
[ Upstream commit 7104ba0f1958adb250319e68a15eff89ec4fd36d ]
If the external phy working together with phy-omap-usb2 does not implement send_srp(), we may still attempt to call it. This can happen on an idle Ethernet gadget triggering a wakeup for example:
configfs-gadget.g1 gadget.0: ECM Suspend configfs-gadget.g1 gadget.0: Port suspended. Triggering wakeup
...
Unable to handle kernel NULL pointer dereference at virtual address
00000000 when execute
...
PC is at 0x0
LR is at musb_gadget_wakeup+0x1d4/0x254 [musb_hdrc]
...musb_gadget_wakeup [musb_hdrc] from usb_gadget_wakeup+0x1c/0x3c [udc_core] usb_gadget_wakeup [udc_core] from eth_start_xmit+0x3b0/0x3d4 [u_ether] eth_start_xmit [u_ether] from dev_hard_start_xmit+0x94/0x24c dev_hard_start_xmit from sch_direct_xmit+0x104/0x2e4 sch_direct_xmit from __dev_queue_xmit+0x334/0xd88 __dev_queue_xmit from arp_solicit+0xf0/0x268arp_solicit from neigh_probe+0x54/0x7cneigh_probe from __neigh_event_send+0x22c/0x47c __neigh_event_send from neigh_resolve_output+0x14c/0x1c0 neigh_resolve_output from ip_finish_output2+0x1c8/0x628 ip_finish_output2 from ip_send_skb+0x40/0xd8ip_send_skb from udp_send_skb+0x124/0x340udp_send_skb from udp_sendmsg+0x780/0x984udp_sendmsg from __sys_sendto+0xd8/0x158__sys_sendto from ret_fast_syscall+0x0/0x58
Let's fix the issue by checking for send_srp() and set_vbus() before calling them. For USB peripheral only cases these both could be NULL.
--- drivers/phy/ti/phy-omap-usb2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/ti/phy-omap-usb2.c +2 -2
@@ -64,7 +64,7 @@ static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled) {struct omap_usb *phy =phy_to_omapusb (otg->usb_phy); -if (!phy->comparator) +if (!phy->comparator || !phy->comparator->set_vbus)return -ENODEV ;return phy->comparator->set_vbus (phy->comparator, enabled);
@@ -74,7 +74,7 @@ static int omap_usb_start_srp(struct usb_otg *otg) {struct omap_usb *phy =phy_to_omapusb (otg->usb_phy); -if (!phy->comparator) +if (!phy->comparator || !phy->comparator->start_srp)return -ENODEV ;return phy->comparator->start_srp (phy->comparator);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 148/202 atm: idt77252: fix a memleak in open_card_ubr0
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhipeng Lu <[email protected]>
[ Upstream commit f3616173bf9be9bf39d131b120d6eea4e6324cb5 ]
When alloc_scq fails, card->vcs[0] (i.e. vc) should be freed. Otherwise, in the following call chain:
idt77252_init_one
|-> idt77252_dev_open
|-> open_card_ubr0
|-> alloc_scq [failed]
|-> deinit_card
|-> vfree(card->vcs);card->vcs is freed and card->vcs[0] is leaked.
--- drivers/atm/idt77252.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/atm/idt77252.c +2 -0
@@ -2936,6 +2936,8 @@ open_card_ubr0(struct idt77252_dev *card) vc->scq =alloc_scq (card, vc->class);if (!vc->scq) {printk ("%s: can't get SCQ.\n" , card->name); +kfree (card->vcs[0 ]); + card->vcs[0 ] =NULL ;return -ENOMEM ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 149/202 hwmon: (aspeed-pwm-tacho) mutex for tach reading
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Loic Prylli <[email protected]>
[ Upstream commit 1168491e7f53581ba7b6014a39a49cfbbb722feb ]
the ASPEED_PTCR_RESULT Register can only hold the result for a single fan input. Adding a mutex to protect the register until the reading is done.
--- drivers/hwmon/aspeed-pwm-tacho.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/hwmon/aspeed-pwm-tacho.c +7 -0
@@ -197,6 +197,8 @@ struct aspeed_pwm_tacho_data {u8 fan_tach_ch_source[16 ];struct aspeed_cooling_device *cdev[8 ];const struct attribute_group *groups[3 ]; +/* protects access to shared ASPEED_PTCR_RESULT */ +struct mutex tach_lock; };enum type {TYPEM ,TYPEN ,TYPEO };
@@ -531,6 +533,8 @@ static int aspeed_get_fan_tach_ch_rpm(struct aspeed_pwm_tacho_data *priv,u8 fan_tach_ch_source, type, mode, both;int ret; +mutex_lock (&priv->tach_lock); +regmap_write (priv->regmap,ASPEED_PTCR_TRIGGER ,0 );regmap_write (priv->regmap,ASPEED_PTCR_TRIGGER ,0x1 << fan_tach_ch);
@@ -548,6 +552,8 @@ static int aspeed_get_fan_tach_ch_rpm(struct aspeed_pwm_tacho_data *priv,ASPEED_RPM_STATUS_SLEEP_USEC , usec); +mutex_unlock (&priv->tach_lock); +/* return -ETIMEDOUT if we didn't get an answer. */ if (ret)return ret;
@@ -938,6 +944,7 @@ static int aspeed_pwm_tacho_probe(struct platform_device *pdev) priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ; +mutex_init (&priv->tach_lock); priv->regmap =devm_regmap_init (dev,NULL , (__force void *)regs, &aspeed_pwm_tacho_regmap_config);if (IS_ERR (priv->regmap))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 150/202 hwmon: (coretemp) Fix out-of-bounds memory access
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Rui <[email protected]>
[ Upstream commit 4e440abc894585a34c2904a32cd54af1742311b3 ]
Fix a bug that pdata->cpu_map[] is set before out-of-bounds check. The problem might be triggered on systems with more than 128 cores per package.
Stable-dep-of: fdaf0c8629d4 ("hwmon: (coretemp) Fix bogus core_id to attr name mapping")
--- drivers/hwmon/coretemp.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/hwmon/coretemp.c +2 -6
@@ -480,18 +480,14 @@ static int create_core_data(struct platform_device *pdev, unsigned int cpu,if (pkg_flag) { attr_no =PKG_SYSFS_ATTR_NO ; }else { - index =ida_alloc (&pdata->ida,GFP_KERNEL ); + index =ida_alloc_max (&pdata->ida,NUM_REAL_CORES -1 ,GFP_KERNEL );if (index <0 )return index; + pdata->cpu_map[index] =topology_core_id (cpu); attr_no = index +BASE_SYSFS_ATTR_NO ; } -if (attr_no >MAX_CORE_DATA -1 ) { - err = -ERANGE ; - goto ida_free; - } - tdata =init_temp_data (cpu, pkg_flag);if (!tdata) { err = -ENOMEM ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 151/202 hwmon: (coretemp) Fix bogus core_id to attr name mapping
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Rui <[email protected]>
[ Upstream commit fdaf0c8629d4524a168cb9e4ad4231875749b28c ]
Before commit 7108b80a542b ("hwmon/coretemp: Handle large core ID value"), there is a fixed mapping between
1. cpu_core_id
2. the index in pdata->core_data[] array
3. the sysfs attr name, aka "tempX_"
The later two always equal cpu_core_id + 2.
After the commit, pdata->core_data[] index is got from ida so that it can handle sparse core ids and support more cores within a package.
However, the commit erroneously maps the sysfs attr name to pdata->core_data[] index instead of cpu_core_id + 2.
As a result, the code is not aligned with the comments, and brings user visible changes in hwmon sysfs on systems with sparse core id.
For example, before commit 7108b80a542b ("hwmon/coretemp: Handle large core ID value"),
/sys/class/hwmon/hwmon2/temp2_label:Core 0 /sys/class/hwmon/hwmon2/temp3_label:Core 1 /sys/class/hwmon/hwmon2/temp4_label:Core 2 /sys/class/hwmon/hwmon2/temp5_label:Core 3 /sys/class/hwmon/hwmon2/temp6_label:Core 4 /sys/class/hwmon/hwmon3/temp10_label:Core 8 /sys/class/hwmon/hwmon3/temp11_label:Core 9
after commit,
/sys/class/hwmon/hwmon2/temp2_label:Core 0 /sys/class/hwmon/hwmon2/temp3_label:Core 1 /sys/class/hwmon/hwmon2/temp4_label:Core 2 /sys/class/hwmon/hwmon2/temp5_label:Core 3 /sys/class/hwmon/hwmon2/temp6_label:Core 4 /sys/class/hwmon/hwmon2/temp7_label:Core 8 /sys/class/hwmon/hwmon2/temp8_label:Core 9
Restore the previous behavior and rework the code, comments and variable names to avoid future confusions.
--- drivers/hwmon/coretemp.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-)
drivers/hwmon/coretemp.c +19 -13
@@ -393,7 +393,7 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) }static int create_core_attrs (struct temp_data *tdata,struct device *dev, -int attr_no) +int index) {int i; static ssize_t (*const rd_ptr[TOTAL_ATTRS]) (struct device *dev,
@@ -405,13 +405,20 @@ static int create_core_attrs(struct temp_data *tdata, struct device *dev, };for (i =0 ; i < tdata->attr_size; i++) { +/* +* We map the attr number to core id of the CPU +* The attr number is always core id + 2 +* The Pkgtemp will always show up as temp1_*, if available +*/ +int attr_no = tdata->is_pkg_data ?1 : tdata->cpu_core_id +2 ; +snprintf (tdata->attr_name[i],CORETEMP_NAME_LENGTH ,"temp%d_%s" , attr_no, suffixes[i]);sysfs_attr_init (&tdata->sd_attrs[i].dev_attr.attr); tdata->sd_attrs[i].dev_attr.attr.name = tdata->attr_name[i]; tdata->sd_attrs[i].dev_attr.attr.mode =S_IRUGO ; tdata->sd_attrs[i].dev_attr.show = rd_ptr[i]; - tdata->sd_attrs[i].index = attr_no; + tdata->sd_attrs[i].index = index; tdata->attrs[i] = &tdata->sd_attrs[i].dev_attr.attr; } tdata->attr_group.attrs = tdata->attrs;
@@ -469,23 +476,22 @@ static int create_core_data(struct platform_device *pdev, unsigned int cpu,struct platform_data *pdata =platform_get_drvdata (pdev);struct cpuinfo_x86 *c = &cpu_data (cpu);u32 eax, edx; -int err, index, attr_no; +int err, index;/* -* Find attr number for sysfs: -* We map the attr number to core id of the CPU -* The attr number is always core id + 2 -* The Pkgtemp will always show up as temp1_*, if available +* Get the index of tdata in pdata->core_data[] +* tdata for package: pdata->core_data[1] +* tdata for core: pdata->core_data[2] .. pdata->core_data[NUM_REAL_CORES + 1] */ if (pkg_flag) { - attr_no =PKG_SYSFS_ATTR_NO ; + index =PKG_SYSFS_ATTR_NO ; }else { index =ida_alloc_max (&pdata->ida,NUM_REAL_CORES -1 ,GFP_KERNEL );if (index <0 )return index; pdata->cpu_map[index] =topology_core_id (cpu); - attr_no = index +BASE_SYSFS_ATTR_NO ; + index +=BASE_SYSFS_ATTR_NO ; } tdata =init_temp_data (cpu, pkg_flag);
@@ -517,20 +523,20 @@ static int create_core_data(struct platform_device *pdev, unsigned int cpu, } } - pdata->core_data[attr_no] = tdata; + pdata->core_data[index] = tdata;/* Create sysfs interfaces */ - err =create_core_attrs (tdata, pdata->hwmon_dev, attr_no); + err =create_core_attrs (tdata, pdata->hwmon_dev, index);if (err) goto exit_free;return 0 ; exit_free: - pdata->core_data[attr_no] =NULL ; + pdata->core_data[index] =NULL ;kfree (tdata); ida_free:if (!pkg_flag) -ida_free (&pdata->ida, index); +ida_free (&pdata->ida, index -BASE_SYSFS_ATTR_NO );return err; }
Signature · 1 line
2.43.0