4.19.256-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainercover 4.19.256-rc1 review
This is the start of the stable review cycle for the 4.19.256 release. There are 287 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 Thu, 25 Aug 2022 08:00:15 +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.256-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.256-rc1
Qu Wenruo <[email protected]>
btrfs: raid56: don't trust any cached sector in __raid56_parity_recover()
Qu Wenruo <[email protected]>
btrfs: only write the sectors in the vertical stripe which has data stripes
Steven Rostedt (Google) <[email protected]>
tracing/probes: Have kprobes and uprobes use $COMM too
Jens Wiklander <[email protected]>
tee: add overflow check in register_shm_helper()
Nathan Chancellor <[email protected]>
MIPS: tlbex: Explicitly compare _PAGE_NO_EXEC against 0
Zheyu Ma <[email protected]>
video: fbdev: i740fb: Check the argument of i740_calc_vclk()
Zhouyi Zhou <[email protected]>
powerpc/64: Init jump labels before parse_early_param()
Steve French <[email protected]>
smb3: check xattr value length earlier
Chao Yu <[email protected]>
f2fs: fix to avoid use f2fs_bug_on() in f2fs_new_node_page()
Takashi Iwai <[email protected]>
ALSA: timer: Use deferred fasync helper
Takashi Iwai <[email protected]>
ALSA: core: Add async signal helpers
Laurent Dufour <[email protected]>
watchdog: export lockup_detector_reconfigure
Xianting Tian <[email protected]>
RISC-V: Add fast call path of crash_kexec()
Celeste Liu <[email protected]>
riscv: mmap with PROT_WRITE but no PROT_READ is invalid
Liang He <[email protected]>
mips: cavium-octeon: Fix missing of_node_put() in octeon2_usb_clocks_start
Schspa Shi <[email protected]>
vfio: Clear the caps->buf to NULL after free
Liang He <[email protected]>
tty: serial: Fix refcount leak bug in ucc_uart.c
Guenter Roeck <[email protected]>
lib/list_debug.c: Detect uninitialized lists
Kiselev, Oleg <[email protected]>
ext4: avoid resizing to a partial cluster size
Ye Bin <[email protected]>
ext4: avoid remove directory when directory is corrupted
Wentao_Liang <[email protected]>
drivers:md:fix a potential use-after-free bug
Uwe Kleine-König <[email protected]>
dmaengine: sprd: Cleanup in .remove() after pm_runtime_get_sync() failed
Christophe JAILLET <[email protected]>
cxl: Fix a memory leak in an error handling path
Jozef Martiniak <[email protected]>
gadgetfs: ep_io - wait until IRQ finishes
Robert Marko <[email protected]>
clk: qcom: ipq8074: dont disable gcc_sleep_clk_src
Pascal Terjan <[email protected]>
vboxguest: Do not use devm for irq
Liang He <[email protected]>
usb: renesas: Fix refcount leak bug
Liang He <[email protected]>
usb: host: ohci-ppc-of: Fix refcount leak bug
Sai Prakash Ranjan <[email protected]>
irqchip/tegra: Fix overflow implicit truncation warnings
Pavan Chebbi <[email protected]>
PCI: Add ACS quirk for Broadcom BCM5750x NICs
Liang He <[email protected]>
drm/meson: Fix refcount bugs in meson_vpu_has_available_connectors()
Hector Martin <[email protected]>
locking/atomic: Make test_and_*_bit() ordered on failure
Andrew Donnellan <[email protected]>
gcc-plugins: Undefine LATENT_ENTROPY_PLUGIN when plugin disabled for a file
Lin Ma <[email protected]>
igb: Add lock to avoid data race
Csókás Bence <[email protected]>
fec: Fix timer capture timing in fec_ptp_enable_pps()
Alan Brady <[email protected]>
i40e: Fix to stop tx_timeout recovery if GLOBR fails
Michael Ellerman <[email protected]>
powerpc/pci: Fix get_phb_number() locking
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: really skip inactive sets when allocating name
Al Viro <[email protected]>
nios2: add force_successful_syscall_return()
Al Viro <[email protected]>
nios2: restarts apply only to the first sigframe we build...
Al Viro <[email protected]>
nios2: fix syscall restart checks
Al Viro <[email protected]>
nios2: traced syscall does need to check the syscall number
Al Viro <[email protected]>
nios2: don't leave NULLs in sys_call_table[]
Al Viro <[email protected]>
nios2: page fault et.al. are *not* restartable syscalls...
Duoming Zhou <[email protected]>
atm: idt77252: fix use-after-free bugs caused by tst_timer
Dan Carpenter <[email protected]>
xen/xenbus: fix return type in xenbus_file_read()
Dan Carpenter <[email protected]>
NTB: ntb_tool: uninitialized heap data in tool_fn_write()
Roberto Sassu <[email protected]>
tools build: Switch to new openssl API for test-libcrypto
Peilin Ye <[email protected]>
vsock: Set socket state back to SS_UNCONNECTED in vsock_connect_timeout()
Peilin Ye <[email protected]>
vsock: Fix memory leak in vsock_connect()
Matthias May <[email protected]>
geneve: do not use RT_TOS for IPv6 flowlabel
Sakari Ailus <[email protected]>
ACPI: property: Return type of acpi_add_nondev_subnodes() should be bool
Nikita Travkin <[email protected]>
pinctrl: qcom: msm8916: Allow CAMSS GP clocks to be muxed
Miaoqian Lin <[email protected]>
pinctrl: nomadik: Fix refcount leak in nmk_pinctrl_dt_subnode_to_map
Trond Myklebust <[email protected]>
SUNRPC: Reinitialise the backchannel request buffers before reuse
Trond Myklebust <[email protected]>
NFSv4/pnfs: Fix a use-after-free bug in open
Zhang Xianwei <[email protected]>
NFSv4.1: RECLAIM_COMPLETE must handle EACCES
Trond Myklebust <[email protected]>
NFSv4: Fix races in the legacy idmapper upcall
Xiu Jianfeng <[email protected]>
apparmor: Fix memleak in aa_simple_write_to_buffer()
Xin Xiong <[email protected]>
apparmor: fix reference count leak in aa_pivotroot()
John Johansen <[email protected]>
apparmor: fix overlapping attachment computation
Tom Rix <[email protected]>
apparmor: fix aa_label_asxprint return check
John Johansen <[email protected]>
apparmor: Fix failed mount permission check error message
John Johansen <[email protected]>
apparmor: fix absroot causing audited secids to begin with =
John Johansen <[email protected]>
apparmor: fix quiet_denied for file rules
Marc Kleine-Budde <[email protected]>
can: ems_usb: fix clang's -Wunaligned-access warning
Steven Rostedt (Google) <[email protected]>
tracing: Have filter accept "common_cpu" to be consistent
Filipe Manana <[email protected]>
btrfs: fix lost error handling when looking up extended ref on log replay
Christophe JAILLET <[email protected]>
mmc: pxamci: Fix an error handling path in pxamci_probe()
Christophe JAILLET <[email protected]>
mmc: pxamci: Fix another error handling path in pxamci_probe()
Damien Le Moal <[email protected]>
ata: libata-eh: Add missing command name
Mikulas Patocka <[email protected]>
rds: add missing barrier to release_refill
Amadeusz Sławiński <[email protected]>
ALSA: info: Fix llseek return value when using callback
Christophe Leroy <[email protected]>
powerpc/ptdump: Fix display of RW pages on FSL_BOOK3E
Christophe Leroy <[email protected]>
powerpc/mm: Split dump_pagelinuxtables flag_array table
Sudeep Holla <[email protected]>
firmware: arm_scpi: Ensure scpi_info is not assigned if the probe fails
Jamal Hadi Salim <[email protected]>
net_sched: cls_route: disallow handle of 0
Tyler Hicks <[email protected]>
net/9p: Initialize the iounit field during fid creation
Luiz Augusto von Dentz <[email protected]>
Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm regression
Jose Alonso <[email protected]>
Revert "net: usb: ax88179_178a needs FLAG_SEND_ZLP"
Tony Battersby <[email protected]>
scsi: sg: Allow waiting for commands to complete on removed device
Eric Dumazet <[email protected]>
tcp: fix over estimation in sk_forced_mem_schedule()
Vitaly Kuznetsov <[email protected]>
KVM: x86: Avoid theoretical NULL pointer dereference in kvm_irq_delivery_to_apic_fast()
Vitaly Kuznetsov <[email protected]>
KVM: x86: Check lapic_in_kernel() before attempting to set a SynIC irq
Sean Christopherson <[email protected]>
KVM: Add infrastructure and macro to mark VM as bugged
Qu Wenruo <[email protected]>
btrfs: reject log replay if there is unsupported RO compat flag
Thadeu Lima de Souza Cascardo <[email protected]>
net_sched: cls_route: remove from list when handle is 0
Rafael J. Wysocki <[email protected]>
ACPI: CPPC: Do not prevent CPPC from working in the future
Mikulas Patocka <[email protected]>
dm writecache: set a default MAX_WRITEBACK_JOBS
Mikulas Patocka <[email protected]>
dm raid: fix address sanitizer warning in raid_status
Mikulas Patocka <[email protected]>
dm raid: fix address sanitizer warning in raid_resume
Alexander Shishkin <[email protected]>
intel_th: pci: Add Meteor Lake-P support
Alexander Shishkin <[email protected]>
intel_th: pci: Add Raptor Lake-S PCH support
Alexander Shishkin <[email protected]>
intel_th: pci: Add Raptor Lake-S CPU support
Baokun Li <[email protected]>
ext4: correct the misjudgment in ext4_iget_extra_inode
Baokun Li <[email protected]>
ext4: correct max_inline_xattr_value_size computing
Eric Whitney <[email protected]>
ext4: fix extent status tree race in writeback error recovery path
Theodore Ts'o <[email protected]>
ext4: update s_overhead_clusters in the superblock during an on-line resize
Baokun Li <[email protected]>
ext4: fix use-after-free in ext4_xattr_set_entry
Lukas Czerner <[email protected]>
ext4: make sure ext4_append() always allocates new block
Baokun Li <[email protected]>
ext4: add EXT4_INODE_HAS_XATTR_SPACE macro in xattr.h
David Collins <[email protected]>
spmi: trace: fix stack-out-of-bound access in SPMI tracing functions
Alexander Lobakin <[email protected]>
x86/olpc: fix 'logical not is only applied to the left hand side'
Steffen Maier <[email protected]>
scsi: zfcp: Fix missing auto port scan and thus missing target ports
Zheyu Ma <[email protected]>
video: fbdev: s3fb: Check the size of screen before memset_io()
Zheyu Ma <[email protected]>
video: fbdev: arkfb: Check the size of screen before memset_io()
Zheyu Ma <[email protected]>
video: fbdev: vt8623fb: Check the size of screen before memset_io()
Florian Fainelli <[email protected]>
tools/thermal: Fix possible path truncations
Zheyu Ma <[email protected]>
video: fbdev: arkfb: Fix a divide-by-zero bug in ark_set_pixclock()
Siddh Raman Pant <[email protected]>
x86/numa: Use cpumask_available instead of hardcoded NULL check
Josh Poimboeuf <[email protected]>
scripts/faddr2line: Fix vmlinux detection on arm64
Arnaldo Carvalho de Melo <[email protected]>
genelf: Use HAVE_LIBCRYPTO_SUPPORT, not the never defined HAVE_LIBCRYPTO
Michael Ellerman <[email protected]>
powerpc/pci: Fix PHB numbering when using opal-phbid
Chen Zhongjin <[email protected]>
kprobes: Forbid probing on trampoline and BPF code areas
Miaoqian Lin <[email protected]>
powerpc/cell/axon_msi: Fix refcount leak in setup_msi_msg_address
Miaoqian Lin <[email protected]>
powerpc/xive: Fix refcount leak in xive_get_max_prio
Miaoqian Lin <[email protected]>
powerpc/spufs: Fix refcount leak in spufs_init_isolated_loader
Pali Rohár <[email protected]>
powerpc/pci: Prefer PCI domain assignment via DT 'linux,pci-domain' and alias
Christophe Leroy <[email protected]>
powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32
Rustam Subkhankulov <[email protected]>
video: fbdev: sis: fix typos in SiS_GetModeID()
Liang He <[email protected]>
video: fbdev: amba-clcd: Fix refcount leak bugs
Christophe JAILLET <[email protected]>
ASoC: qcom: q6dsp: Fix an off-by-one in q6adm_alloc_copp()
Alexander Gordeev <[email protected]>
s390/zcore: fix race when reading from hardware system area
Liang He <[email protected]>
iommu/arm-smmu: qcom_iommu: Add of_node_put() when breaking out of loop
Uwe Kleine-König <[email protected]>
mfd: t7l66xb: Drop platform disable callback
Dan Carpenter <[email protected]>
kfifo: fix kfifo_to_user() return type
Miaoqian Lin <[email protected]>
rpmsg: qcom_smd: Fix refcount leak in qcom_smd_parse_edge
Sam Protsenko <[email protected]>
iommu/exynos: Handle failed IOMMU device registration properly
Daniel Starke <[email protected]>
tty: n_gsm: fix missing corner cases in gsmld_poll()
Daniel Starke <[email protected]>
tty: n_gsm: fix DM command
Daniel Starke <[email protected]>
tty: n_gsm: fix wrong T1 retry count handling
Eric Farman <[email protected]>
vfio/ccw: Do not change FSM state in subchannel event
Sireesh Kodali <[email protected]>
remoteproc: qcom: wcnss: Fix handling of IRQs
Daniel Starke <[email protected]>
tty: n_gsm: fix race condition in gsmld_write()
Daniel Starke <[email protected]>
tty: n_gsm: fix packet re-transmission without open control channel
Daniel Starke <[email protected]>
tty: n_gsm: fix non flow control frames during mux flow off
Chen Zhongjin <[email protected]>
profiling: fix shift too large makes kernel panic
Ilpo Järvinen <[email protected]>
serial: 8250_dw: Store LSR into lsr_saved_flags in dw8250_tx_wait_empty()
Miaoqian Lin <[email protected]>
ASoC: mediatek: mt8173-rt5650: Fix refcount leak in mt8173_rt5650_dev_probe
Jiasheng Jiang <[email protected]>
ASoC: codecs: da7210: add check for i2c_add_driver
Miaoqian Lin <[email protected]>
ASoC: mt6797-mt6351: Fix refcount leak in mt6797_mt6351_dev_probe
Miaoqian Lin <[email protected]>
ASoC: mediatek: mt8173: Fix refcount leak in mt8173_rt5650_rt5676_dev_probe
Zhihao Cheng <[email protected]>
jbd2: fix assertion 'jh->b_frozen_data == NULL' failure when journal aborted
Li Lingfeng <[email protected]>
ext4: recover csum seed of tmp_inode after migrating to extents
Dan Carpenter <[email protected]>
null_blk: fix ida error handling in null_add_dev()
Zhu Yanjun <[email protected]>
RDMA/rxe: Fix error unwind in rxe_create_qp()
Miaohe Lin <[email protected]>
mm/mmap.c: fix missing call to vm_unacct_memory in mmap_region
Dan Carpenter <[email protected]>
platform/olpc: Fix uninitialized data in debugfs write
Johan Hovold <[email protected]>
USB: serial: fix tty-port initialized comments
Artem Borisov <[email protected]>
HID: alps: Declare U1_UNICORN_LEGACY support
Liang He <[email protected]>
mmc: cavium-thunderx: Add of_node_put() when breaking out of loop
Liang He <[email protected]>
mmc: cavium-octeon: Add of_node_put() when breaking out of loop
Liang He <[email protected]>
gpio: gpiolib-of: Fix refcount bugs in of_mm_gpiochip_add_data()
Jianglei Nie <[email protected]>
RDMA/hfi1: fix potential memory leak in setup_base_ctxt()
Randy Dunlap <[email protected]>
usb: gadget: udc: amd5536 depends on HAS_DMA
Mahesh Rajashekhara <[email protected]>
scsi: smartpqi: Fix DMA direction for RAID requests
Stefan Roese <[email protected]>
PCI/portdrv: Don't disable AER reporting in get_port_device_capability()
Eugen Hristev <[email protected]>
mmc: sdhci-of-at91: fix set_uhs_signaling rewriting of MC1R
Christophe JAILLET <[email protected]>
memstick/ms_block: Fix a memory leak
Christophe JAILLET <[email protected]>
memstick/ms_block: Fix some incorrect memory allocation
Miaoqian Lin <[email protected]>
mmc: sdhci-of-esdhc: Fix refcount leak in esdhc_signal_voltage_switch
Duoming Zhou <[email protected]>
staging: rtl8192u: Fix sleep in atomic context bug in dm_fsync_timer_callback
Pierre-Louis Bossart <[email protected]>
soundwire: bus_type: fix remove and shutdown support
Robert Marko <[email protected]>
clk: qcom: ipq8074: set BRANCH_HALT_DELAY flag for UBI clocks
Robert Marko <[email protected]>
clk: qcom: ipq8074: fix NSS port frequency tables
Christophe JAILLET <[email protected]>
misc: rtsx: Fix an error handling path in rtsx_pci_probe()
Miaoqian Lin <[email protected]>
usb: ohci-nxp: Fix refcount leak in ohci_hcd_nxp_probe
Miaoqian Lin <[email protected]>
usb: host: Fix refcount leak in ehci_hcd_ppc_of_probe
Marco Pagani <[email protected]>
fpga: altera-pr-ip: fix unsigned comparison with less than zero
Uwe Kleine-König <[email protected]>
mtd: st_spi_fsm: Add a clk_disable_unprepare() in .probe()'s error path
Duoming Zhou <[email protected]>
mtd: sm_ftl: Fix deadlock caused by cancel_work_sync in sm_release
Harshit Mogalapalli <[email protected]>
HID: cp2112: prevent a buffer overflow in cp2112_xfer()
Miaoqian Lin <[email protected]>
mtd: maps: Fix refcount leak in ap_flash_init
Miaoqian Lin <[email protected]>
mtd: maps: Fix refcount leak in of_flash_probe_versatile
Ralph Siemsen <[email protected]>
clk: renesas: r9a06g032: Fix UART clkgrp bitsel
Hangyu Hua <[email protected]>
dccp: put dccp_qpolicy_full() and dccp_qpolicy_push() in the same lock
Eric Dumazet <[email protected]>
net: rose: fix netdev reference changes
Jakub Kicinski <[email protected]>
netdevsim: Avoid allocation warnings triggered from user space
Maxim Mikityanskiy <[email protected]>
net/mlx5e: Fix the value of MLX5E_MAX_RQ_NUM_MTTS
Hangyu Hua <[email protected]>
wifi: libertas: Fix possible refcount leak in if_usb_probe()
Ammar Faizi <[email protected]>
wifi: wil6210: debugfs: fix uninitialized variable use in wil_write_file_wmi()
Liang He <[email protected]>
i2c: mux-gpmux: Add of_node_put() when breaking out of loop
Lars-Peter Clausen <[email protected]>
i2c: cadence: Support PEC for SMBus block read
Jiasheng Jiang <[email protected]>
Bluetooth: hci_intel: Add check for platform_driver_register
Vincent Mailhol <[email protected]>
can: pch_can: pch_can_error(): initialize errc before using it
Vincent Mailhol <[email protected]>
can: error: specify the values of data[5..7] of CAN error frames
Vincent Mailhol <[email protected]>
can: usb_8dev: do not report txerr and rxerr during bus-off
Vincent Mailhol <[email protected]>
can: kvaser_usb_leaf: do not report txerr and rxerr during bus-off
Vincent Mailhol <[email protected]>
can: kvaser_usb_hydra: do not report txerr and rxerr during bus-off
Vincent Mailhol <[email protected]>
can: sun4i_can: do not report txerr and rxerr during bus-off
Vincent Mailhol <[email protected]>
can: hi311x: do not report txerr and rxerr during bus-off
Vincent Mailhol <[email protected]>
can: sja1000: do not report txerr and rxerr during bus-off
Vincent Mailhol <[email protected]>
can: rcar_can: do not report txerr and rxerr during bus-off
Vincent Mailhol <[email protected]>
can: pch_can: do not report txerr and rxerr during bus-off
Rustam Subkhankulov <[email protected]>
wifi: p54: add missing parentheses in p54_flush()
Christophe JAILLET <[email protected]>
wifi: p54: Fix an error handling path in p54spi_probe()
Dan Carpenter <[email protected]>
wifi: wil6210: debugfs: fix info leak in wil_write_file_wmi()
Jason A. Donenfeld <[email protected]>
fs: check FMODE_LSEEK to control internal pipe splicing
Wolfram Sang <[email protected]>
selftests: timers: clocksource-switch: fix passing errors from child
Wolfram Sang <[email protected]>
selftests: timers: valid-adjtimex: build fix for newer toolchains
Anquan Wu <[email protected]>
libbpf: Fix the name of a reused map
Yonglong Li <[email protected]>
tcp: make retransmitted SKB fit into the send window
Liang He <[email protected]>
mediatek: mt76: mac80211: Fix missing of_node_put() in mt76_led_init()
AngeloGioacchino Del Regno <[email protected]>
media: platform: mtk-mdp: Fix mdp_ipi_comm structure alignment
Zhengchao Shao <[email protected]>
crypto: hisilicon - Kunpeng916 crypto driver don't sleep when in softirq
Rob Clark <[email protected]>
drm/msm/mdp5: Fix global state lock backoff
Hangyu Hua <[email protected]>
drm: bridge: sii8620: fix possible off-by-one
Bo-Chen Chen <[email protected]>
drm/mediatek: dpi: Remove output format of YUV
Brian Norris <[email protected]>
drm/rockchip: vop: Don't crash for invalid duplicate_state()
Dave Stevenson <[email protected]>
drm/vc4: dsi: Correct DSI divider calculations
Niels Dossche <[email protected]>
media: hdpvr: fix error value returns in hdpvr_read
Jiasheng Jiang <[email protected]>
drm: bridge: adv7511: Add check for mipi_dsi_driver_register
Alexey Kodanev <[email protected]>
wifi: iwlegacy: 4965: fix potential off-by-one overflow in il4965_rs_fill_link_cmd()
Pavel Skripkin <[email protected]>
ath9k: fix use-after-free in ath9k_hif_usb_rx_cb
Zheyu Ma <[email protected]>
media: tw686x: Register the irq at the end of probe
Xu Wang <[email protected]>
i2c: Fix a potential use after free
Xinlei Lee <[email protected]>
drm/mediatek: Add pull-down MIPI operation in mtk_dsi_poweroff function
Alexey Kodanev <[email protected]>
drm/radeon: fix potential buffer overflow in ni_set_mc_special_registers()
Dan Carpenter <[email protected]>
wifi: rtlwifi: fix error codes in rtl_debugfs_set_write_h2c()
Krzysztof Kozlowski <[email protected]>
ath10k: do not enforce interrupt trigger type
Mike Snitzer <[email protected]>
dm: return early from dm_pr_call() if DM device is suspended
Markus Mayer <[email protected]>
thermal/tools/tmon: Include pthread and time headers in tmon.h
Nicolas Saenz Julienne <[email protected]>
nohz/full, sched/rt: Fix missed tick-reenabling bug in dequeue_task_rt()
Liang He <[email protected]>
regulator: of: Fix refcount leak bug in of_get_regulation_constraints()
Sireesh Kodali <[email protected]>
arm64: dts: qcom: msm8916: Fix typo in pronto remoteproc node
Yang Yingliang <[email protected]>
bus: hisi_lpc: fix missing platform_device_put() in hisi_lpc_acpi_probe()
Krzysztof Kozlowski <[email protected]>
ARM: dts: qcom: pm8841: add required thermal-sensor-cells
Miaoqian Lin <[email protected]>
cpufreq: zynq: Fix refcount leak in zynq_get_revision
Miaoqian Lin <[email protected]>
ARM: OMAP2+: Fix refcount leak in omap3xxx_prm_late_init
Michael Walle <[email protected]>
soc: fsl: guts: machine variable might be unset
Krzysztof Kozlowski <[email protected]>
ARM: dts: ast2500-evb: fix board compatible
Johan Hovold <[email protected]>
x86/pmem: Fix platform-device leak in error path
Miaoqian Lin <[email protected]>
ARM: bcm: Fix refcount leak in bcm_kona_smc_init
Miaoqian Lin <[email protected]>
meson-mx-socinfo: Fix refcount leak in meson_mx_socinfo_init
Russell King (Oracle) <[email protected]>
ARM: findbit: fix overflowing offset
Xiu Jianfeng <[email protected]>
selinux: Add boundary check in put_entry()
Tetsuo Handa <[email protected]>
PM: hibernate: defer device probing when resuming from hibernation
Robert Marko <[email protected]>
arm64: dts: qcom: ipq8074: fix NAND node name
huhai <[email protected]>
ACPI: LPSS: Fix missing check in register_device_clock()
Manyi Li <[email protected]>
ACPI: PM: save NVS memory for Lenovo G40-45
Hans de Goede <[email protected]>
ACPI: EC: Remove duplicate ThinkPad X1 Carbon 6th entry from DMI quirks
Liang He <[email protected]>
ARM: OMAP2+: display: Fix refcount leak bug
Alexander Stein <[email protected]>
ARM: dts: imx6ul: fix qspi node compatible
Alexander Stein <[email protected]>
ARM: dts: imx6ul: fix lcdif node compatible
Alexander Stein <[email protected]>
ARM: dts: imx6ul: change operating-points to uint32-matrix
Alexander Stein <[email protected]>
ARM: dts: imx6ul: add missing properties for sram
Jan Kara <[email protected]>
ext2: Add more validity checks for inode counts
haibinzhang (张海斌) <[email protected]>
arm64: fix oops in concurrently setting insn_emulation sysctls
Francis Laniel <[email protected]>
arm64: Do not forget syscall when starting a new thread.
Florian Westphal <[email protected]>
netfilter: nf_tables: fix null deref due to zeroed list head
Thadeu Lima de Souza Cascardo <[email protected]>
netfilter: nf_tables: do not allow SET_ID to refer to another table
Weitao Wang <[email protected]>
USB: HCD: Fix URB giveback issue in tasklet function
Huacai Chen <[email protected]>
MIPS: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK
Michael Ellerman <[email protected]>
powerpc/powernv: Avoid crashing if rng is NULL
Pali Rohár <[email protected]>
powerpc/fsl-pci: Fix Class Code of PCIe Root Port
Pali Rohár <[email protected]>
PCI: Add defines for normal and subtractive PCI bridges
Alexander Lobakin <[email protected]>
ia64, processor: fix -Wincompatible-pointer-types in ia64_get_irr()
Mikulas Patocka <[email protected]>
md-raid10: fix KASAN warning
Narendra Hadke <[email protected]>
serial: mvebu-uart: uart2 error bits clearing
Miklos Szeredi <[email protected]>
fuse: limit nsec
Zheyu Ma <[email protected]>
iio: light: isl29028: Fix the warning in isl29028_remove()
Ovidiu Panait <[email protected]>
selftests/bpf: Fix "dubious pointer arithmetic" test
Ovidiu Panait <[email protected]>
selftests/bpf: Fix test_align verifier log patterns
Ovidiu Panait <[email protected]>
bpf: Verifer, adjust_scalar_min_max_vals to always call update_reg_bounds()
Leo Li <[email protected]>
drm/amdgpu: Check BO's requested pinning domains against its preferred_domains
Timur Tabi <[email protected]>
drm/nouveau: fix another off-by-one in nvbios_addr
Helge Deller <[email protected]>
parisc: Fix device names in /proc/iomem
Jiachen Zhang <[email protected]>
ovl: drop WARN_ON() dentry is NULL in ovl_encode_fh()
Lukas Wunner <[email protected]>
usbnet: Fix linkwatch use-after-free on disconnect
Helge Deller <[email protected]>
fbcon: Fix boundary checks for fbcon=vc:n1-n2 parameters
Rafael J. Wysocki <[email protected]>
thermal: sysfs: Fix cooling_device_stats_setup() error code path
Yang Xu <[email protected]>
fs: Add missing umask strip in vfs_tmpfile
David Howells <[email protected]>
vfs: Check the truncate maximum size in inode_newsize_ok()
Tetsuo Handa <[email protected]>
tty: vt: initialize unicode screen buffer
Allen Ballway <[email protected]>
ALSA: hda/cirrus - support for iMac 12,1 model
Meng Tang <[email protected]>
ALSA: hda/conexant: Add quirk for LENOVO 20149 Notebook model
Sean Christopherson <[email protected]>
KVM: x86: Set error code to segment selector on LLDT/LTR non-canonical #GP
Sean Christopherson <[email protected]>
KVM: x86: Mark TSS busy during LTR emulation _after_ all fault checks
Maciej S. Szmigiero <[email protected]>
KVM: SVM: Don't BUG if userspace injects an interrupt with GIF=0
Ping Cheng <[email protected]>
HID: wacom: Don't register pad_input for touch switch
Mikulas Patocka <[email protected]>
add barriers to buffer_uptodate and set_buffer_uptodate
Johannes Berg <[email protected]>
wifi: mac80211_hwsim: use 32-bit skb cookie
Johannes Berg <[email protected]>
wifi: mac80211_hwsim: add back erroneously removed cast
Jeongik Cha <[email protected]>
wifi: mac80211_hwsim: fix race condition in pending packet
Zheyu Ma <[email protected]>
ALSA: bcd2000: Fix a UAF bug on the error path of probing
Nick Desaulniers <[email protected]>
x86: link vdso and boot with -z noexecstack --no-warn-rwx-segments
Nick Desaulniers <[email protected]>
Makefile: link with -z noexecstack --no-warn-rwx-segments
-------------
Diffstat:
Documentation/atomic_bitops.txt | 2 +- Makefile | 7 +- arch/arm/boot/dts/aspeed-ast2500-evb.dts | 2 +- arch/arm/boot/dts/imx6ul.dtsi | 29 ++-- arch/arm/boot/dts/qcom-pm8841.dtsi | 1 + arch/arm/lib/findbit.S | 16 +-- arch/arm/mach-bcm/bcm_kona_smc.c | 1 + arch/arm/mach-omap2/display.c | 1 + arch/arm/mach-omap2/prm3xxx.c | 1 + arch/arm/mach-zynq/common.c | 1 + arch/arm64/boot/dts/qcom/ipq8074.dtsi | 2 +- arch/arm64/boot/dts/qcom/msm8916.dtsi | 4 +- arch/arm64/include/asm/processor.h | 3 +- arch/arm64/kernel/armv8_deprecated.c | 9 +- arch/ia64/include/asm/processor.h | 2 +- arch/mips/cavium-octeon/octeon-platform.c | 3 +- arch/mips/kernel/proc.c | 2 +- arch/mips/mm/tlbex.c | 4 +- arch/nios2/include/asm/entry.h | 3 +- arch/nios2/include/asm/ptrace.h | 2 + arch/nios2/kernel/entry.S | 22 ++- arch/nios2/kernel/signal.c | 3 +- arch/nios2/kernel/syscall_table.c | 1 + arch/parisc/kernel/drivers.c | 9 +- arch/powerpc/kernel/pci-common.c | 45 ++++-- arch/powerpc/kernel/prom.c | 7 + arch/powerpc/mm/Makefile | 7 + arch/powerpc/mm/dump_linuxpagetables-8xx.c | 82 +++++++++++ arch/powerpc/mm/dump_linuxpagetables-book3s64.c | 115 +++++++++++++++ arch/powerpc/mm/dump_linuxpagetables-generic.c | 82 +++++++++++ arch/powerpc/mm/dump_linuxpagetables.c | 155 +-------------------- arch/powerpc/mm/dump_linuxpagetables.h | 19 +++ arch/powerpc/platforms/Kconfig.cputype | 4 +- arch/powerpc/platforms/cell/axon_msi.c | 1 + arch/powerpc/platforms/cell/spufs/inode.c | 1 + arch/powerpc/platforms/powernv/rng.c | 2 + arch/powerpc/sysdev/fsl_pci.c | 8 ++ arch/powerpc/sysdev/fsl_pci.h | 1 + arch/powerpc/sysdev/xive/spapr.c | 1 + arch/riscv/kernel/sys_riscv.c | 5 +- arch/riscv/kernel/traps.c | 4 + arch/x86/boot/Makefile | 2 +- arch/x86/boot/compressed/Makefile | 4 + arch/x86/entry/vdso/Makefile | 2 +- arch/x86/kernel/pmem.c | 7 +- arch/x86/kvm/emulate.c | 23 ++- arch/x86/kvm/hyperv.c | 3 + arch/x86/kvm/lapic.c | 4 + arch/x86/kvm/svm.c | 2 - arch/x86/mm/numa.c | 4 +- arch/x86/platform/olpc/olpc-xo1-sci.c | 2 +- drivers/acpi/acpi_lpss.c | 3 + drivers/acpi/cppc_acpi.c | 54 ++++--- drivers/acpi/ec.c | 7 - drivers/acpi/property.c | 8 +- drivers/acpi/sleep.c | 8 ++ drivers/ata/libata-eh.c | 1 + drivers/atm/idt77252.c | 1 + drivers/block/null_blk_main.c | 14 +- drivers/bluetooth/hci_intel.c | 6 +- drivers/bus/hisi_lpc.c | 10 +- drivers/clk/qcom/gcc-ipq8074.c | 19 +++ drivers/clk/renesas/r9a06g032-clocks.c | 8 +- drivers/crypto/hisilicon/sec/sec_algs.c | 14 +- drivers/crypto/hisilicon/sec/sec_drv.h | 2 +- drivers/dma/sprd-dma.c | 5 +- drivers/firmware/arm_scpi.c | 61 ++++---- drivers/fpga/altera-pr-ip-core.c | 2 +- drivers/gpio/gpiolib-of.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 + drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 17 ++- drivers/gpu/drm/bridge/sil-sii8620.c | 4 +- drivers/gpu/drm/mediatek/mtk_dpi.c | 31 +---- drivers/gpu/drm/mediatek/mtk_dsi.c | 2 + drivers/gpu/drm/meson/meson_drv.c | 5 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c | 3 +- drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c | 2 +- drivers/gpu/drm/radeon/ni_dpm.c | 6 +- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 3 + drivers/gpu/drm/vc4/vc4_dsi.c | 6 +- drivers/hid/hid-alps.c | 2 + drivers/hid/hid-cp2112.c | 5 + drivers/hid/wacom_sys.c | 2 +- drivers/hid/wacom_wac.c | 43 +++--- drivers/hwtracing/intel_th/pci.c | 15 ++ drivers/i2c/busses/i2c-cadence.c | 10 +- drivers/i2c/i2c-core-base.c | 3 +- drivers/i2c/muxes/i2c-mux-gpmux.c | 1 + drivers/iio/light/isl29028.c | 2 +- drivers/infiniband/hw/hfi1/file_ops.c | 4 +- drivers/infiniband/sw/rxe/rxe_qp.c | 12 +- drivers/iommu/exynos-iommu.c | 6 +- drivers/iommu/qcom_iommu.c | 7 +- drivers/irqchip/irq-tegra.c | 10 +- drivers/md/dm-raid.c | 4 +- drivers/md/dm-writecache.c | 2 +- drivers/md/dm.c | 5 + drivers/md/raid10.c | 5 +- drivers/md/raid5.c | 2 +- drivers/media/pci/tw686x/tw686x-core.c | 18 ++- drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h | 2 + drivers/media/usb/hdpvr/hdpvr-video.c | 2 +- drivers/memstick/core/ms_block.c | 11 +- drivers/mfd/t7l66xb.c | 6 +- drivers/misc/cardreader/rtsx_pcr.c | 6 +- drivers/misc/cxl/irq.c | 1 + drivers/mmc/host/cavium-octeon.c | 1 + drivers/mmc/host/cavium-thunderx.c | 4 +- drivers/mmc/host/pxamci.c | 4 +- drivers/mmc/host/sdhci-of-at91.c | 9 +- drivers/mmc/host/sdhci-of-esdhc.c | 1 + drivers/mtd/devices/st_spi_fsm.c | 8 +- drivers/mtd/maps/physmap_of_versatile.c | 2 + drivers/mtd/sm_ftl.c | 2 +- drivers/net/can/pch_can.c | 8 +- drivers/net/can/rcar/rcar_can.c | 8 +- drivers/net/can/sja1000/sja1000.c | 7 +- drivers/net/can/spi/hi311x.c | 5 +- drivers/net/can/sun4i_can.c | 9 +- drivers/net/can/usb/ems_usb.c | 2 +- drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 12 +- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 6 +- drivers/net/can/usb/usb_8dev.c | 7 +- drivers/net/ethernet/freescale/fec_ptp.c | 6 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 4 +- drivers/net/ethernet/intel/igb/igb.h | 2 + drivers/net/ethernet/intel/igb/igb_main.c | 12 +- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- drivers/net/geneve.c | 3 +- drivers/net/netdevsim/bpf.c | 8 +- drivers/net/usb/ax88179_178a.c | 16 +-- drivers/net/usb/usbnet.c | 8 +- drivers/net/wireless/ath/ath10k/snoc.c | 5 +- drivers/net/wireless/ath/ath9k/htc.h | 10 +- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 3 +- drivers/net/wireless/ath/wil6210/debugfs.c | 18 +-- drivers/net/wireless/intel/iwlegacy/4965-rs.c | 5 +- drivers/net/wireless/intersil/p54/main.c | 2 +- drivers/net/wireless/intersil/p54/p54spi.c | 3 +- drivers/net/wireless/mac80211_hwsim.c | 14 +- drivers/net/wireless/marvell/libertas/if_usb.c | 1 + drivers/net/wireless/mediatek/mt76/mac80211.c | 1 + drivers/net/wireless/realtek/rtlwifi/debug.c | 8 +- drivers/ntb/test/ntb_tool.c | 8 +- drivers/pci/pcie/portdrv_core.c | 9 +- drivers/pci/quirks.c | 3 + drivers/pinctrl/nomadik/pinctrl-nomadik.c | 4 +- drivers/pinctrl/qcom/pinctrl-msm8916.c | 4 +- drivers/platform/olpc/olpc-ec.c | 2 +- drivers/regulator/of_regulator.c | 6 +- drivers/remoteproc/qcom_wcnss.c | 10 +- drivers/rpmsg/qcom_smd.c | 1 + drivers/s390/char/zcore.c | 11 +- drivers/s390/cio/vfio_ccw_drv.c | 14 +- drivers/s390/scsi/zfcp_fc.c | 29 ++-- drivers/s390/scsi/zfcp_fc.h | 6 +- drivers/s390/scsi/zfcp_fsf.c | 4 +- drivers/scsi/sg.c | 57 +++++--- drivers/scsi/smartpqi/smartpqi_init.c | 4 +- drivers/soc/amlogic/meson-mx-socinfo.c | 1 + drivers/soc/fsl/guts.c | 2 +- drivers/soundwire/bus_type.c | 8 +- drivers/staging/rtl8192u/r8192U.h | 2 +- drivers/staging/rtl8192u/r8192U_dm.c | 38 +++-- drivers/staging/rtl8192u/r8192U_dm.h | 2 +- drivers/tee/tee_core.c | 4 + drivers/thermal/thermal_sysfs.c | 10 +- drivers/tty/n_gsm.c | 90 ++++++++++-- drivers/tty/serial/8250/8250_dw.c | 3 + drivers/tty/serial/mvebu-uart.c | 11 ++ drivers/tty/serial/ucc_uart.c | 2 + drivers/tty/vt/vt.c | 2 +- drivers/usb/core/hcd.c | 26 ++-- drivers/usb/gadget/legacy/inode.c | 1 + drivers/usb/gadget/udc/Kconfig | 2 +- drivers/usb/host/ehci-ppc-of.c | 1 + drivers/usb/host/ohci-nxp.c | 1 + drivers/usb/host/ohci-ppc-of.c | 1 + drivers/usb/renesas_usbhs/rza.c | 4 + drivers/usb/serial/sierra.c | 3 +- drivers/usb/serial/usb-serial.c | 2 +- drivers/usb/serial/usb_wwan.c | 3 +- drivers/vfio/vfio.c | 1 + drivers/video/fbdev/amba-clcd.c | 24 +++- drivers/video/fbdev/arkfb.c | 9 +- drivers/video/fbdev/core/fbcon.c | 8 +- drivers/video/fbdev/i740fb.c | 9 +- drivers/video/fbdev/s3fb.c | 2 + drivers/video/fbdev/sis/init.c | 4 +- drivers/video/fbdev/vt8623fb.c | 2 + drivers/virt/vboxguest/vboxguest_linux.c | 9 +- drivers/xen/xenbus/xenbus_dev_frontend.c | 4 +- fs/attr.c | 2 + fs/btrfs/disk-io.c | 14 ++ fs/btrfs/raid56.c | 74 +++++++--- fs/btrfs/tree-log.c | 4 +- fs/cifs/smb2ops.c | 5 +- fs/ext2/super.c | 12 +- fs/ext4/inline.c | 3 + fs/ext4/inode.c | 10 +- fs/ext4/migrate.c | 4 +- fs/ext4/namei.c | 23 ++- fs/ext4/resize.c | 11 ++ fs/ext4/xattr.c | 6 +- fs/ext4/xattr.h | 13 ++ fs/f2fs/node.c | 6 +- fs/fuse/inode.c | 6 + fs/jbd2/transaction.c | 14 +- fs/namei.c | 2 + fs/nfs/nfs4idmap.c | 46 +++--- fs/nfs/nfs4proc.c | 14 +- fs/overlayfs/export.c | 2 +- fs/splice.c | 10 +- include/acpi/cppc_acpi.h | 2 +- include/asm-generic/bitops/atomic.h | 6 - include/linux/buffer_head.h | 25 +++- include/linux/kfifo.h | 2 +- include/linux/kvm_host.h | 28 +++- include/linux/mfd/t7l66xb.h | 1 - include/linux/nmi.h | 2 + include/linux/pci_ids.h | 2 + include/linux/usb/hcd.h | 1 + include/sound/core.h | 8 ++ include/trace/events/spmi.h | 12 +- include/uapi/linux/can/error.h | 5 +- kernel/bpf/verifier.c | 1 + kernel/kprobes.c | 3 +- kernel/power/user.c | 13 +- kernel/profile.c | 7 + kernel/sched/rt.c | 15 +- kernel/trace/trace_events.c | 1 + kernel/trace/trace_probe.c | 4 +- kernel/watchdog.c | 21 ++- lib/list_debug.c | 12 +- mm/mmap.c | 1 - net/9p/client.c | 5 +- net/bluetooth/l2cap_core.c | 13 +- net/dccp/proto.c | 10 +- net/ipv4/tcp_output.c | 30 ++-- net/netfilter/nf_tables_api.c | 7 +- net/rds/ib_recv.c | 1 + net/rose/af_rose.c | 11 +- net/rose/rose_route.c | 2 + net/sched/cls_route.c | 12 +- net/sunrpc/backchannel_rqst.c | 14 ++ net/vmw_vsock/af_vsock.c | 10 +- scripts/Makefile.gcc-plugins | 2 +- scripts/faddr2line | 4 +- security/apparmor/apparmorfs.c | 2 +- security/apparmor/audit.c | 2 +- security/apparmor/domain.c | 2 +- security/apparmor/include/lib.h | 5 + security/apparmor/include/policy.h | 2 +- security/apparmor/label.c | 13 +- security/apparmor/mount.c | 8 +- security/selinux/ss/policydb.h | 2 + sound/core/info.c | 6 +- sound/core/misc.c | 94 +++++++++++++ sound/core/timer.c | 11 +- sound/pci/hda/patch_cirrus.c | 1 + sound/pci/hda/patch_conexant.c | 11 +- sound/soc/codecs/da7210.c | 2 + sound/soc/mediatek/mt6797/mt6797-mt6351.c | 6 +- sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | 10 +- sound/soc/mediatek/mt8173/mt8173-rt5650.c | 9 +- sound/soc/qcom/qdsp6/q6adm.c | 2 +- sound/usb/bcd2000/bcd2000.c | 3 +- tools/build/feature/test-libcrypto.c | 15 +- tools/lib/bpf/libbpf.c | 9 +- tools/perf/util/genelf.c | 6 +- tools/testing/selftests/bpf/test_align.c | 41 +++--- .../testing/selftests/timers/clocksource-switch.c | 6 +- tools/testing/selftests/timers/valid-adjtimex.c | 2 +- tools/thermal/tmon/sysfs.c | 24 ++-- tools/thermal/tmon/tmon.h | 3 + virt/kvm/kvm_main.c | 10 +- 276 files changed, 1886 insertions(+), 902 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/287 Makefile: link with -z noexecstack --no-warn-rwx-segments
From: Nick Desaulniers <[email protected]>
commit 0d362be5b14200b77ecc2127936a5ff82fbffe41 upstream.
Users of GNU ld (BFD) from binutils 2.39+ will observe multiple instances of a new warning when linking kernels in the form:
ld: warning: vmlinux: missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld: warning: vmlinux has a LOAD segment with RWX permissions
Generally, we would like to avoid the stack being executable. Because there could be a need for the stack to be executable, assembler sources have to opt-in to this security feature via explicit creation of the .note.GNU-stack feature (which compilers create by default) or command line flag --noexecstack. Or we can simply tell the linker the production of such sections is irrelevant and to link the stack as --noexecstack.
LLVM's LLD linker defaults to -z noexecstack, so this flag isn't strictly necessary when linking with LLD, only BFD, but it doesn't hurt to be explicit here for all linkers IMO. --no-warn-rwx-segments is currently BFD specific and only available in the current latest release, so it's wrapped in an ld-option check.
While the kernel makes extensive usage of ELF sections, it doesn't use permissions from ELF segments.
--- Makefile | 3 +++ 1 file changed, 3 insertions(+)
Makefile +3 -0
@@ -876,6 +876,9 @@ LDFLAGS_BUILD_ID := $(call ld-option, -- KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID) LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID) +KBUILD_LDFLAGS += -z noexecstack +KBUILD_LDFLAGS += $(call ld-option,--no-warn-rwx-segments) + ifeq ($(CONFIG_STRIP_ASM_SYMS),y) LDFLAGS_vmlinux += $(call ld-option, -X,) endif
Greg Kroah-Hartman
maintainerPATCH 2/287 x86: link vdso and boot with -z noexecstack --no-warn-rwx-segments
In reply to Greg Kroah-HartmanFrom: Nick Desaulniers <[email protected]>
commit ffcf9c5700e49c0aee42dcba9a12ba21338e8136 upstream.
Users of GNU ld (BFD) from binutils 2.39+ will observe multiple instances of a new warning when linking kernels in the form:
ld: warning: arch/x86/boot/pmjump.o: missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld: warning: arch/x86/boot/compressed/vmlinux has a LOAD segment with RWX permissions
Generally, we would like to avoid the stack being executable. Because there could be a need for the stack to be executable, assembler sources have to opt-in to this security feature via explicit creation of the .note.GNU-stack feature (which compilers create by default) or command line flag --noexecstack. Or we can simply tell the linker the production of such sections is irrelevant and to link the stack as --noexecstack.
LLVM's LLD linker defaults to -z noexecstack, so this flag isn't strictly necessary when linking with LLD, only BFD, but it doesn't hurt to be explicit here for all linkers IMO. --no-warn-rwx-segments is currently BFD specific and only available in the current latest release, so it's wrapped in an ld-option check.
While the kernel makes extensive usage of ELF sections, it doesn't use permissions from ELF segments.
--- arch/x86/boot/Makefile | 2 +- arch/x86/boot/compressed/Makefile | 4 ++++ arch/x86/entry/vdso/Makefile | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-)
arch/x86/boot/Makefile +1 -1
@@ -100,7 +100,7 @@ $(obj)/zoffset.h: $(obj)/compressed/vmli AFLAGS_header.o += -I$(objtree)/$(obj) $(obj)/header.o: $(obj)/zoffset.h -LDFLAGS_setup.elf := -m elf_i386 -T +LDFLAGS_setup.elf := -m elf_i386 -z noexecstack -T $(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE $(call if_changed,ld)
arch/x86/boot/compressed/Makefile +4 -0
@@ -57,6 +57,10 @@ else KBUILD_LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \ && echo "-z noreloc-overflow -pie --no-dynamic-linker") endif + +KBUILD_LDFLAGS += -z noexecstack +KBUILD_LDFLAGS += $(call ld-option,--no-warn-rwx-segments) + LDFLAGS_vmlinux := -T hostprogs-y := mkpiggy
arch/x86/entry/vdso/Makefile +1 -1
@@ -172,7 +172,7 @@ quiet_cmd_vdso = VDSO $@ VDSO_LDFLAGS = -shared $(call ld-option, --hash-style=both) \ $(call ld-option, --build-id) $(call ld-option, --eh-frame-hdr) \ - -Bsymbolic + -Bsymbolic -z noexecstack GCOV_PROFILE := n #
Greg Kroah-Hartman
maintainerPATCH 3/287 ALSA: bcd2000: Fix a UAF bug on the error path of probing
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
commit ffb2759df7efbc00187bfd9d1072434a13a54139 upstream.
When the driver fails in snd_card_register() at probe time, it will free the 'bcd2k->midi_out_urb' before killing it, which may cause a UAF bug.
The following log can reveal it:
[ 50.727020] BUG: KASAN: use-after-free in bcd2000_input_complete+0x1f1/0x2e0 [snd_bcd2000] [ 50.727623] Read of size 8 at addr ffff88810fab0e88 by task swapper/4/0 [ 50.729530] Call Trace: [ 50.732899] bcd2000_input_complete+0x1f1/0x2e0 [snd_bcd2000]
Fix this by adding usb_kill_urb() before usb_free_urb().
--- sound/usb/bcd2000/bcd2000.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/usb/bcd2000/bcd2000.c +2 -1
@@ -357,7 +357,8 @@ static int bcd2000_init_midi(struct bcd2static void bcd2000_free_usb_related_resources (struct bcd2000 *bcd2k,struct usb_interface *interface) { -/* usb_kill_urb not necessary, urb is aborted automatically */ +usb_kill_urb (bcd2k->midi_out_urb); +usb_kill_urb (bcd2k->midi_in_urb);usb_free_urb (bcd2k->midi_out_urb);usb_free_urb (bcd2k->midi_in_urb);
Greg Kroah-Hartman
maintainerPATCH 4/287 wifi: mac80211_hwsim: fix race condition in pending packet
In reply to Greg Kroah-HartmanFrom: Jeongik Cha <[email protected]>
commit 4ee186fa7e40ae06ebbfbad77e249e3746e14114 upstream.
A pending packet uses a cookie as an unique key, but it can be duplicated because it didn't use atomic operators.
And also, a pending packet can be null in hwsim_tx_info_frame_received_nl due to race condition with mac80211_hwsim_stop.
For this,
* Use an atomic type and operator for a cookie
* Add a lock around the loop for pending packets
--- drivers/net/wireless/mac80211_hwsim.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/wireless/mac80211_hwsim.c +8 -6
@@ -552,7 +552,7 @@ struct mac80211_hwsim_data {bool ps_poll_pending;struct dentry *debugfs; -uintptr_t pending_cookie; +atomic64_t pending_cookie;struct sk_buff_head pending;/* packets pending */ /* * Only radios in the same group can communicate together (the
@@ -1067,7 +1067,7 @@ static void mac80211_hwsim_tx_frame_nl(sint i;struct hwsim_tx_rate tx_attempts[IEEE80211_TX_MAX_RATES ];struct hwsim_tx_rate_flag tx_attempts_flags[IEEE80211_TX_MAX_RATES ]; -uintptr_t cookie; +u64 cookie;if (data->ps !=PS_DISABLED ) hdr->frame_control |=cpu_to_le16 (IEEE80211_FCTL_PM );
@@ -1136,8 +1136,7 @@ static void mac80211_hwsim_tx_frame_nl(s goto nla_put_failure;/* We create a cookie to identify this skb */ - data->pending_cookie++; - cookie = data->pending_cookie; + cookie = (u64 )atomic64_inc_return (&data->pending_cookie); info->rate_driver_data[0 ] = (void *)cookie;if (nla_put_u64_64bit (skb,HWSIM_ATTR_COOKIE , cookie,HWSIM_ATTR_PAD )) goto nla_put_failure;
@@ -3120,6 +3119,7 @@ static int hwsim_tx_info_frame_received_const u8 *src;unsigned int hwsim_flags;int i; +unsigned long flags;bool found = false; if (!info->attrs[HWSIM_ATTR_ADDR_TRANSMITTER] ||
@@ -3144,18 +3144,20 @@ static int hwsim_tx_info_frame_received_ goto out;/* look for the skb matching the cookie passed back from user */ +spin_lock_irqsave (&data2->pending.lock, flags); skb_queue_walk_safe(&data2->pending, skb, tmp) {u64 skb_cookie; txi =IEEE80211_SKB_CB (skb); - skb_cookie = (u64 )(uintptr_t )txi->rate_driver_data[0 ]; + skb_cookie = (u64 )txi->rate_driver_data[0 ];if (skb_cookie == ret_skb_cookie) { -skb_unlink (skb, &data2->pending); +__skb_unlink (skb, &data2->pending); found = true;break ; } } +spin_unlock_irqrestore (&data2->pending.lock, flags);/* not found */ if (!found)
Greg Kroah-Hartman
maintainerPATCH 5/287 wifi: mac80211_hwsim: add back erroneously removed cast
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
commit 58b6259d820d63c2adf1c7541b54cce5a2ae6073 upstream.
The robots report that we're now casting to a differently sized integer, which is correct, and the previous patch had erroneously removed it.
--- drivers/net/wireless/mac80211_hwsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mac80211_hwsim.c +1 -1
@@ -3149,7 +3149,7 @@ static int hwsim_tx_info_frame_received_u64 skb_cookie; txi =IEEE80211_SKB_CB (skb); - skb_cookie = (u64 )txi->rate_driver_data[0 ]; + skb_cookie = (u64 )(uintptr_t )txi->rate_driver_data[0 ];if (skb_cookie == ret_skb_cookie) {__skb_unlink (skb, &data2->pending);
Greg Kroah-Hartman
maintainerPATCH 6/287 wifi: mac80211_hwsim: use 32-bit skb cookie
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
commit cc5250cdb43d444061412df7fae72d2b4acbdf97 upstream.
We won't really have enough skbs to need a 64-bit cookie, and on 32-bit platforms storing the 64-bit cookie into the void *rate_driver_data doesn't work anyway. Switch back to using just a 32-bit cookie and uintptr_t for the type to avoid compiler warnings about all this.
--- drivers/net/wireless/mac80211_hwsim.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/mac80211_hwsim.c +5 -5
@@ -552,7 +552,7 @@ struct mac80211_hwsim_data {bool ps_poll_pending;struct dentry *debugfs; -atomic64_t pending_cookie; +atomic_t pending_cookie;struct sk_buff_head pending;/* packets pending */ /* * Only radios in the same group can communicate together (the
@@ -1067,7 +1067,7 @@ static void mac80211_hwsim_tx_frame_nl(sint i;struct hwsim_tx_rate tx_attempts[IEEE80211_TX_MAX_RATES ];struct hwsim_tx_rate_flag tx_attempts_flags[IEEE80211_TX_MAX_RATES ]; -u64 cookie; +uintptr_t cookie;if (data->ps !=PS_DISABLED ) hdr->frame_control |=cpu_to_le16 (IEEE80211_FCTL_PM );
@@ -1136,7 +1136,7 @@ static void mac80211_hwsim_tx_frame_nl(s goto nla_put_failure;/* We create a cookie to identify this skb */ - cookie = (u64 )atomic64_inc_return (&data->pending_cookie); + cookie =atomic_inc_return (&data->pending_cookie); info->rate_driver_data[0 ] = (void *)cookie;if (nla_put_u64_64bit (skb,HWSIM_ATTR_COOKIE , cookie,HWSIM_ATTR_PAD )) goto nla_put_failure;
@@ -3146,10 +3146,10 @@ static int hwsim_tx_info_frame_received_/* look for the skb matching the cookie passed back from user */ spin_lock_irqsave (&data2->pending.lock, flags); skb_queue_walk_safe(&data2->pending, skb, tmp) { -u64 skb_cookie; +uintptr_t skb_cookie; txi =IEEE80211_SKB_CB (skb); - skb_cookie = (u64 )(uintptr_t )txi->rate_driver_data[0 ]; + skb_cookie = (uintptr_t )txi->rate_driver_data[0 ];if (skb_cookie == ret_skb_cookie) {__skb_unlink (skb, &data2->pending);
Greg Kroah-Hartman
maintainerPATCH 7/287 add barriers to buffer_uptodate and set_buffer_uptodate
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
commit d4252071b97d2027d246f6a82cbee4d52f618b47 upstream.
Let's have a look at this piece of code in __bread_slow:
get_bh(bh); bh->b_end_io = end_buffer_read_sync; submit_bh(REQ_OP_READ, 0, bh); wait_on_buffer(bh); if (buffer_uptodate(bh)) return bh;
Neither wait_on_buffer nor buffer_uptodate contain any memory barrier. Consequently, if someone calls sb_bread and then reads the buffer data, the read of buffer data may be executed before wait_on_buffer(bh) on architectures with weak memory ordering and it may return invalid data.
Fix this bug by adding a memory barrier to set_buffer_uptodate and an acquire barrier to buffer_uptodate (in a similar way as folio_test_uptodate and folio_mark_uptodate).
--- include/linux/buffer_head.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
include/linux/buffer_head.h +24 -1
@@ -117,7 +117,6 @@ static __always_inline int test_clear_bu* of the form "mark_buffer_foo()". These are higher-level functions which * do something in addition to setting a b_state bit. */ -BUFFER_FNS(Uptodate, uptodate) BUFFER_FNS(Dirty, dirty) TAS_BUFFER_FNS(Dirty, dirty)BUFFER_FNS (Lock, locked)
@@ -135,6 +134,30 @@ BUFFER_FNS(Meta, meta) BUFFER_FNS(Prio, prio) BUFFER_FNS(Defer_Completion, defer_completion) +static __always_inline void set_buffer_uptodate(struct buffer_head *bh) +{ +/* +* make it consistent with folio_mark_uptodate +* pairs with smp_load_acquire in buffer_uptodate +*/ +smp_mb__before_atomic (); +set_bit (BH_Uptodate, &bh->b_state); +} + +static __always_inline void clear_buffer_uptodate(struct buffer_head *bh) +{ +clear_bit (BH_Uptodate, &bh->b_state); +} + +static __always_inline int buffer_uptodate(const struct buffer_head *bh) +{ +/* +* make it consistent with folio_test_uptodate +* pairs with smp_mb__before_atomic in set_buffer_uptodate +*/ +return (smp_load_acquire (&bh->b_state) & (1UL << BH_Uptodate)) !=0 ; +} +#define bh_offset (bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK)/* If we *know* page->private refers to buffer_heads */
Greg Kroah-Hartman
maintainerPATCH 8/287 HID: wacom: Dont register pad_input for touch switch
In reply to Greg Kroah-HartmanFrom: Ping Cheng <[email protected]>
commit d6b675687a4ab4dba684716d97c8c6f81bf10905 upstream.
Touch switch state is received through WACOM_PAD_FIELD. However, it is reported by touch_input. Don't register pad_input if no other pad events require the interface.
--- drivers/hid/wacom_sys.c | 2 +- drivers/hid/wacom_wac.c | 43 +++++++++++++++++++++++++------------------ 2 files changed, 26 insertions(+), 19 deletions(-)
drivers/hid/wacom_sys.c +1 -1
@@ -2095,7 +2095,7 @@ static int wacom_register_inputs(struct error =wacom_setup_pad_input_capabilities (pad_input_dev, wacom_wac);if (error) { -/* no pad in use on this interface */ +/* no pad events using this interface */ input_free_device (pad_input_dev); wacom_wac->pad_input =NULL ; pad_input_dev =NULL ;
drivers/hid/wacom_wac.c +25 -18
67 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 9/287 KVM: SVM: Dont BUG if userspace injects an interrupt with GIF=0
In reply to Greg Kroah-HartmanFrom: Maciej S. Szmigiero <[email protected]>
commit f17c31c48e5cde9895a491d91c424eeeada3e134 upstream.
Don't BUG/WARN on interrupt injection due to GIF being cleared, since it's trivial for userspace to force the situation via KVM_SET_VCPU_EVENTS (even if having at least a WARN there would be correct for KVM internally generated injections).
kernel BUG at arch/x86/kvm/svm/svm.c:3386!
invalid opcode: 0000 [#1] SMP
CPU: 15 PID: 926 Comm: smm_test Not tainted 5.17.0-rc3+ #264 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 RIP: 0010:svm_inject_irq+0xab/0xb0 [kvm_amd] Code: <0f> 0b 0f 1f 00 0f 1f 44 00 00 80 3d ac b3 01 00 00 55 48 89 f5 53 RSP: 0018:ffffc90000b37d88 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff88810a234ac0 RCX: 0000000000000006 RDX: 0000000000000000 RSI: ffffc90000b37df7 RDI: ffff88810a234ac0 RBP: ffffc90000b37df7 R08: ffff88810a1fa410 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: ffff888109571000 R14: ffff88810a234ac0 R15: 0000000000000000 FS: 0000000001821380(0000) GS:ffff88846fdc0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f74fc550008 CR3: 000000010a6fe000 CR4: 0000000000350ea0 Call Trace: <TASK> inject_pending_event+0x2f7/0x4c0 [kvm] kvm_arch_vcpu_ioctl_run+0x791/0x17a0 [kvm] kvm_vcpu_ioctl+0x26d/0x650 [kvm] __x64_sys_ioctl+0x82/0xb0 do_syscall_64+0x3b/0xc0 entry_SYSCALL_64_after_hwframe+0x44/0xae </TASK>
Message-Id: <35426af6e123cbe91ec7ce5132ce72521f02b1b5.1651440202.git.maciej.szmigiero@oracle.com>
--- arch/x86/kvm/svm.c | 2 -- 1 file changed, 2 deletions(-)
arch/x86/kvm/svm.c +0 -2
@@ -5142,8 +5142,6 @@ static void svm_set_irq(struct kvm_vcpu {struct vcpu_svm *svm =to_svm (vcpu); -BUG_ON (!(gif_set (svm))); -trace_kvm_inj_virq (vcpu->arch.interrupt.nr); ++vcpu->stat.irq_injections;
Greg Kroah-Hartman
maintainerPATCH 10/287 KVM: x86: Mark TSS busy during LTR emulation _after_ all fault checks
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit ec6e4d863258d4bfb36d48d5e3ef68140234d688 upstream.
Wait to mark the TSS as busy during LTR emulation until after all fault checks for the LTR have passed. Specifically, don't mark the TSS busy if the new TSS base is non-canonical.
Opportunistically drop the one-off !seg_desc.PRESENT check for TR as the only reason for the early check was to avoid marking a !PRESENT TSS as busy, i.e. the common !PRESENT is now done before setting the busy bit.
--- arch/x86/kvm/emulate.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
arch/x86/kvm/emulate.c +9 -10
@@ -1708,16 +1708,6 @@ static int __load_segment_descriptor(strcase VCPU_SREG_TR :if (seg_desc.s || (seg_desc.type !=1 && seg_desc.type !=9 )) goto exception; -if (!seg_desc.p) { - err_vec =NP_VECTOR ; - goto exception; - } - old_desc = seg_desc; - seg_desc.type |=2 ;/* busy */ - ret = ctxt->ops->cmpxchg_emulated (ctxt, desc_addr, &old_desc, &seg_desc, -sizeof (seg_desc), &ctxt->exception); -if (ret !=X86EMUL_CONTINUE ) -return ret;break ;case VCPU_SREG_LDTR :if (seg_desc.s || seg_desc.type !=2 )
@@ -1758,6 +1748,15 @@ static int __load_segment_descriptor(str ((u64)base3 << 32), ctxt))return emulate_gp (ctxt,0 ); } + +if (seg ==VCPU_SREG_TR ) { + old_desc = seg_desc; + seg_desc.type |=2 ;/* busy */ + ret = ctxt->ops->cmpxchg_emulated (ctxt, desc_addr, &old_desc, &seg_desc, +sizeof (seg_desc), &ctxt->exception); +if (ret !=X86EMUL_CONTINUE ) +return ret; + } load: ctxt->ops->set_segment (ctxt, selector, &seg_desc, base3, seg);if (desc)
Greg Kroah-Hartman
maintainerPATCH 11/287 KVM: x86: Set error code to segment selector on LLDT/LTR non-canonical #GP
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit 2626206963ace9e8bf92b6eea5ff78dd674c555c upstream.
When injecting a #GP on LLDT/LTR due to a non-canonical LDT/TSS base, set the error code to the selector. Intel SDM's says nothing about the #GP, but AMD's APM explicitly states that both LLDT and LTR set the error code to the selector, not zero.
Note, a non-canonical memory operand on LLDT/LTR does generate a #GP(0), but the KVM code in question is specific to the base from the descriptor.
--- arch/x86/kvm/emulate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/emulate.c +2 -2
@@ -1745,8 +1745,8 @@ static int __load_segment_descriptor(strif (ret !=X86EMUL_CONTINUE )return ret;if (emul_is_noncanonical_address (get_desc_base (&seg_desc) | - ((u64 )base3 <<32 ), ctxt)) -return emulate_gp (ctxt,0 ); + ((u64 )base3 <<32 ), ctxt)) +return emulate_gp (ctxt, err_code); }if (seg ==VCPU_SREG_TR ) {
Greg Kroah-Hartman
maintainerPATCH 12/287 ALSA: hda/conexant: Add quirk for LENOVO 20149 Notebook model
In reply to Greg Kroah-HartmanFrom: Meng Tang <[email protected]>
commit f83bb2592482fe94c6eea07a8121763c80f36ce5 upstream.
There is another LENOVO 20149 (Type1Sku0) Notebook model with CX20590, the device PCI SSID is 17aa:3977, which headphones are not responding, that requires the quirk CXT_PINCFG_LENOVO_NOTEBOOK. Add the corresponding entry to the quirk table.
--- sound/pci/hda/patch_conexant.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
sound/pci/hda/patch_conexant.c +10 -1
@@ -210,6 +210,7 @@ enum {CXT_PINCFG_LEMOTE_A1205 ,CXT_PINCFG_COMPAQ_CQ60 ,CXT_FIXUP_STEREO_DMIC , +CXT_PINCFG_LENOVO_NOTEBOOK ,CXT_FIXUP_INC_MIC_BOOST ,CXT_FIXUP_HEADPHONE_MIC_PIN , CXT_FIXUP_HEADPHONE_MIC,
@@ -750,6 +751,14 @@ static const struct hda_fixup cxt_fixups .type = HDA_FIXUP_FUNC, .v.func = cxt_fixup_stereo_dmic, }, + [CXT_PINCFG_LENOVO_NOTEBOOK] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl []) { + {0x1a ,0x05d71030 }, + { } + }, + .chain_id = CXT_FIXUP_STEREO_DMIC, + }, [CXT_FIXUP_INC_MIC_BOOST] = { .type = HDA_FIXUP_FUNC, .v.func = cxt5066_increase_mic_boost,
@@ -943,7 +952,7 @@ static const struct snd_pci_quirk cxt506SND_PCI_QUIRK (0x17aa ,0x3905 ,"Lenovo G50-30" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x17aa ,0x390b ,"Lenovo G50-80" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x17aa ,0x3975 ,"Lenovo U300s" ,CXT_FIXUP_STEREO_DMIC ), -SND_PCI_QUIRK (0x17aa ,0x3977 ,"Lenovo IdeaPad U310" ,CXT_FIXUP_STEREO_DMIC ), +SND_PCI_QUIRK (0x17aa ,0x3977 ,"Lenovo IdeaPad U310" ,CXT_PINCFG_LENOVO_NOTEBOOK ),SND_PCI_QUIRK (0x17aa ,0x3978 ,"Lenovo G50-70" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x17aa ,0x397b ,"Lenovo S205" ,CXT_FIXUP_STEREO_DMIC ), SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", CXT_FIXUP_THINKPAD_ACPI),
Greg Kroah-Hartman
maintainerPATCH 13/287 ALSA: hda/cirrus - support for iMac 12,1 model
In reply to Greg Kroah-HartmanFrom: Allen Ballway <[email protected]>
commit 74bba640d69914cf832b87f6bbb700e5ba430672 upstream.
The 12,1 model requires the same configuration as the 12,2 model to enable headphones but has a different codec SSID. Adds 12,1 SSID for matching quirk.
[ re-sorted in SSID order by tiwai ]
--- sound/pci/hda/patch_cirrus.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_cirrus.c +1 -0
@@ -409,6 +409,7 @@ static const struct snd_pci_quirk cs420x/* codec SSID */ SND_PCI_QUIRK (0x106b ,0x0600 ,"iMac 14,1" ,CS420X_IMAC27_122 ), +SND_PCI_QUIRK (0x106b ,0x0900 ,"iMac 12,1" ,CS420X_IMAC27_122 ),SND_PCI_QUIRK (0x106b ,0x1c00 ,"MacBookPro 8,1" ,CS420X_MBP81 ),SND_PCI_QUIRK (0x106b ,0x2000 ,"iMac 12,2" ,CS420X_IMAC27_122 ), SND_PCI_QUIRK(0x106b, 0x2800, "MacBookPro 10,1", CS420X_MBP101),
Greg Kroah-Hartman
maintainerPATCH 14/287 tty: vt: initialize unicode screen buffer
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
commit af77c56aa35325daa2bc2bed5c2ebf169be61b86 upstream.
syzbot reports kernel infoleak at vcs_read() [1], for buffer can be read immediately after resize operation. Initialize buffer using kzalloc().
----------
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/fb.h>
int main(int argc, char *argv[])
{
struct fb_var_screeninfo var = { };
const int fb_fd = open("/dev/fb0", 3);
ioctl(fb_fd, FBIOGET_VSCREENINFO, &var);
var.yres = 0x21;
ioctl(fb_fd, FBIOPUT_VSCREENINFO, &var);
return read(open("/dev/vcsu", O_RDONLY), &var, sizeof(var)) == -1;
}
------------- drivers/tty/vt/vt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/vt/vt.c +1 -1
@@ -351,7 +351,7 @@ static struct uni_screen *vc_uniscr_allo/* allocate everything in one go */ memsize = cols * rows *sizeof (char32_t ); memsize += rows *sizeof (char32_t *); - p =vmalloc (memsize); + p =vzalloc (memsize);if (!p)return NULL ;
Greg Kroah-Hartman
maintainerPATCH 15/287 vfs: Check the truncate maximum size in inode_newsize_ok()
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
commit e2ebff9c57fe4eb104ce4768f6ebcccf76bef849 upstream.
If something manages to set the maximum file size to MAX_OFFSET+1, this can cause the xfs and ext4 filesystems at least to become corrupt.
Ordinarily, the kernel protects against userspace trying this by checking the value early in the truncate() and ftruncate() system calls calls - but there are at least two places that this check is bypassed:
(1) Cachefiles will round up the EOF of the backing file to DIO block size so as to allow DIO on the final block - but this might push the offset negative. It then calls notify_change(), but this inadvertently bypasses the checking. This can be triggered if someone puts an 8EiB-1 file on a server for someone else to try and access by, say, nfs.
(2) ksmbd doesn't check the value it is given in set_end_of_file_info() and then calls vfs_truncate() directly - which also bypasses the check.
In both cases, it is potentially possible for a network filesystem to cause a disk filesystem to be corrupted: cachefiles in the client's cache filesystem; ksmbd in the server's filesystem.
nfsd is okay as it checks the value, but we can then remove this check too.
Fix this by adding a check to inode_newsize_ok(), as called from setattr_prepare(), thereby catching the issue as filesystems set up to perform the truncate with minimal opportunity for bypassing the new check.
--- fs/attr.c | 2 ++ 1 file changed, 2 insertions(+)
fs/attr.c +2 -0
@@ -134,6 +134,8 @@ EXPORT_SYMBOL(setattr_prepare);*/ int inode_newsize_ok (const struct inode *inode,loff_t offset) { +if (offset <0 ) +return -EINVAL ;if (inode->i_size < offset) {unsigned long limit;
Greg Kroah-Hartman
maintainerPATCH 16/287 fs: Add missing umask strip in vfs_tmpfile
In reply to Greg Kroah-HartmanFrom: Yang Xu <[email protected]>
commit ac6800e279a22b28f4fc21439843025a0d5bf03e upstream.
All creation paths except for O_TMPFILE handle umask in the vfs directly if the filesystem doesn't support or enable POSIX ACLs. If the filesystem does then umask handling is deferred until posix_acl_create(). Because, O_TMPFILE misses umask handling in the vfs it will not honor umask settings. Fix this by adding the missing umask handling.
--- fs/namei.c | 2 ++ 1 file changed, 2 insertions(+)
fs/namei.c +2 -0
@@ -3453,6 +3453,8 @@ struct dentry *vfs_tmpfile(struct dentry child =d_alloc (dentry, &slash_name);if (unlikely (!child)) goto out_err; +if (!IS_POSIXACL (dir)) + mode &= ~current_umask (); error = dir->i_op->tmpfile (dir, child, mode);if (error) goto out_err;
Greg Kroah-Hartman
maintainerPATCH 17/287 thermal: sysfs: Fix cooling_device_stats_setup() error code path
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
commit d5a8aa5d7d80d21ab6b266f1bed4194b61746199 upstream.
If cooling_device_stats_setup() fails to create the stats object, it must clear the last slot in cooling_device_attr_groups that was initially empty (so as to make it possible to add stats attributes to the cooling device attribute groups).
Failing to do so may cause the stats attributes to be created by mistake for a device that doesn't have a stats object, because the slot in question might be populated previously during the registration of another cooling device.
--- drivers/thermal/thermal_sysfs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/thermal/thermal_sysfs.c +7 -3
@@ -909,12 +909,13 @@ static const struct attribute_group coolstatic void cooling_device_stats_setup (struct thermal_cooling_device *cdev) { +const struct attribute_group *stats_attr_group =NULL ;struct cooling_dev_stats *stats;unsigned long states;int var;if (cdev->ops->get_max_state (cdev, &states)) -return ; + goto out; states++;/* Total number of states is highest state + 1 */
@@ -924,7 +925,7 @@ static void cooling_device_stats_setup(s stats =kzalloc (var,GFP_KERNEL );if (!stats) -return ; + goto out; stats->time_in_state = (ktime_t *)(stats +1 ); stats->trans_table = (unsigned int *)(stats->time_in_state + states);
@@ -934,9 +935,12 @@ static void cooling_device_stats_setup(sspin_lock_init (&stats->lock); + stats_attr_group = &cooling_device_stats_attr_group; + +out:/* Fill the empty slot left in cooling_device_attr_groups */ var =ARRAY_SIZE (cooling_device_attr_groups) -2 ; - cooling_device_attr_groups[var] = &cooling_device_stats_attr_group; + cooling_device_attr_groups[var] = stats_attr_group; }static void cooling_device_stats_destroy (struct thermal_cooling_device *cdev)
Greg Kroah-Hartman
maintainerPATCH 18/287 fbcon: Fix boundary checks for fbcon=vc:n1-n2 parameters
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit cad564ca557f8d3bb3b1fa965d9a2b3f6490ec69 upstream.
The user may use the fbcon=vc:<n1>-<n2> option to tell fbcon to take over the given range (n1...n2) of consoles. The value for n1 and n2 needs to be a positive number and up to (MAX_NR_CONSOLES - 1). The given values were not fully checked against those boundaries yet.
To fix the issue, convert first_fb_vc and last_fb_vc to unsigned integers and check them against the upper boundary, and make sure that first_fb_vc is smaller than last_fb_vc.
--- drivers/video/fbdev/core/fbcon.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/video/fbdev/core/fbcon.c +5 -3
@@ -103,8 +103,8 @@ static int logo_lines;enums. */ static int logo_shown =FBCON_LOGO_CANSHOW ;/* console mappings */ -static int first_fb_vc; -static int last_fb_vc =MAX_NR_CONSOLES -1 ; +static unsigned int first_fb_vc; +static unsigned int last_fb_vc =MAX_NR_CONSOLES -1 ;static int fbcon_is_default =1 ;static int fbcon_has_exited;static int primary_device =-1 ;
@@ -456,10 +456,12 @@ static int __init fb_console_setup(char options +=3 ;if (*options) first_fb_vc =simple_strtoul (options, &options,10 ) -1 ; -if (first_fb_vc <0 ) +if (first_fb_vc >=MAX_NR_CONSOLES ) first_fb_vc =0 ;if (*options++ =='-' ) last_fb_vc =simple_strtoul (options, &options,10 ) -1 ; +if (last_fb_vc < first_fb_vc || last_fb_vc >=MAX_NR_CONSOLES ) + last_fb_vc =MAX_NR_CONSOLES -1 ; fbcon_is_default =0 ;continue ; }
Greg Kroah-Hartman
maintainerPATCH 19/287 usbnet: Fix linkwatch use-after-free on disconnect
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit a69e617e533edddf3fa3123149900f36e0a6dc74 upstream.
usbnet uses the work usbnet_deferred_kevent() to perform tasks which may sleep. On disconnect, completion of the work was originally awaited in ->ndo_stop(). But in 2003, that was moved to ->disconnect() by historic commit "[PATCH] USB: usbnet, prevent exotic rtnl deadlock":
https://git.kernel.org/tglx/history/c/0f138bbfd83c
The change was made because back then, the kernel's workqueue implementation did not allow waiting for a single work. One had to wait for completion of *all* work by calling flush_scheduled_work(), and that could deadlock when waiting for usbnet_deferred_kevent() with rtnl_mutex held in ->ndo_stop().
The commit solved one problem but created another: It causes a use-after-free in USB Ethernet drivers aqc111.c, asix_devices.c, ax88179_178a.c, ch9200.c and smsc75xx.c:
* If the drivers receive a link change interrupt immediately before disconnect, they raise EVENT_LINK_RESET in their (non-sleepable) ->status() callback and schedule usbnet_deferred_kevent().
* usbnet_deferred_kevent() invokes the driver's ->link_reset() callback, which calls netif_carrier_{on,off}().
* That in turn schedules the work linkwatch_event().
Because usbnet_deferred_kevent() is awaited after unregister_netdev(), netif_carrier_{on,off}() may operate on an unregistered netdev and linkwatch_event() may run after free_netdev(), causing a use-after-free.
In 2010, usbnet was changed to only wait for a single instance of usbnet_deferred_kevent() instead of *all* work by commit 23f333a2bfaf ("drivers/net: don't use flush_scheduled_work()").
Unfortunately the commit neglected to move the wait back to ->ndo_stop(). Rectify that omission at long last.
--- drivers/net/usb/usbnet.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/usb/usbnet.c +2 -6
@@ -845,13 +845,11 @@ int usbnet_stop (struct net_device *net) mpn = !test_and_clear_bit (EVENT_NO_RUNTIME_PM , &dev->flags); -/* deferred work (task, timer, softirq) must also stop. -* can't flush_scheduled_work() until we drop rtnl (later), -* else workers could deadlock; so make workers a NOP. -*/ +/* deferred work (timer, softirq, task) must also stop */ dev->flags =0 ;del_timer_sync (&dev->delay);tasklet_kill (&dev->bh); +cancel_work_sync (&dev->kevent);if (!pm)usb_autopm_put_interface (dev->intf);
@@ -1614,8 +1612,6 @@ void usbnet_disconnect (struct usb_inter net = dev->net;unregister_netdev (net); -cancel_work_sync (&dev->kevent); -usb_scuttle_anchored_urbs (&dev->deferred);if (dev->driver_info->unbind)
Greg Kroah-Hartman
maintainerPATCH 20/287 ovl: drop WARN_ON() dentry is NULL in ovl_encode_fh()
In reply to Greg Kroah-HartmanFrom: Jiachen Zhang <[email protected]>
commit dd524b7f317de8d31d638cbfdc7be4cf9b770e42 upstream.
Some code paths cannot guarantee the inode have any dentry alias. So WARN_ON() all !dentry may flood the kernel logs.
For example, when an overlayfs inode is watched by inotifywait (1), and someone is trying to read the /proc/$(pidof inotifywait)/fdinfo/INOTIFY_FD, at that time if the dentry has been reclaimed by kernel (such as echo 2 > /proc/sys/vm/drop_caches), there will be a WARN_ON(). The printed call stack would be like:
? show_mark_fhandle+0xf0/0xf0
show_mark_fhandle+0x4a/0xf0
? show_mark_fhandle+0xf0/0xf0
? seq_vprintf+0x30/0x50
? seq_printf+0x53/0x70
? show_mark_fhandle+0xf0/0xf0
inotify_fdinfo+0x70/0x90
show_fdinfo.isra.4+0x53/0x70
seq_show+0x130/0x170
seq_read+0x153/0x440
vfs_read+0x94/0x150
ksys_read+0x5f/0xe0
do_syscall_64+0x59/0x1e0
entry_SYSCALL_64_after_hwframe+0x44/0xa9So let's drop WARN_ON() to avoid kernel log flooding.
--- fs/overlayfs/export.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/overlayfs/export.c +1 -1
@@ -277,7 +277,7 @@ static int ovl_encode_fh(struct inode *ireturn FILEID_INVALID ; dentry =d_find_any_alias (inode); -if (WARN_ON (!dentry)) +if (!dentry)return FILEID_INVALID ; type =ovl_dentry_to_fh (dentry, fid, max_len);
Greg Kroah-Hartman
maintainerPATCH 21/287 parisc: Fix device names in /proc/iomem
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit cab56b51ec0e69128909cef4650e1907248d821b upstream.
Fix the output of /proc/iomem to show the real hardware device name including the pa_pathname, e.g. "Merlin 160 Core Centronics [8:16:0]". Up to now only the pa_pathname ("[8:16.0]") was shown.
--- arch/parisc/kernel/drivers.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
arch/parisc/kernel/drivers.c +4 -5
@@ -499,7 +499,6 @@ alloc_pa_dev(unsigned long hpa, struct h dev->id.hversion_rev = iodc_data[1 ] &0x0f ; dev->id.sversion = ((iodc_data[4 ] &0x0f ) <<16 ) | (iodc_data[5 ] <<8 ) | iodc_data[6 ]; - dev->hpa.name =parisc_pathname (dev); dev->hpa.start = hpa;/* This is awkward. The STI spec says that gfx devices may occupy * 32MB or 64MB. Unfortunately, we don't know how to tell whether
@@ -513,10 +512,10 @@ alloc_pa_dev(unsigned long hpa, struct h dev->hpa.end = hpa +0xfff ; } dev->hpa.flags =IORESOURCE_MEM ; - name =parisc_hardware_description (&dev->id); -if (name) { -strlcpy (dev->name, name,sizeof (dev->name)); - } + dev->hpa.name = dev->name; + name =parisc_hardware_description (&dev->id) ? :"unknown" ; +snprintf (dev->name,sizeof (dev->name),"%s [%s]" , + name,parisc_pathname (dev));/* Silently fail things like mouse ports which are subsumed within * the keyboard controller
Greg Kroah-Hartman
maintainerPATCH 22/287 drm/nouveau: fix another off-by-one in nvbios_addr
In reply to Greg Kroah-HartmanFrom: Timur Tabi <[email protected]>
commit c441d28945fb113220d48d6c86ebc0b090a2b677 upstream.
This check determines whether a given address is part of image 0 or image 1. Image 1 starts at offset image0_size, so that address should be included.
--- drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c +1 -1
@@ -33,7 +33,7 @@ nvbios_addr(struct nvkm_bios *bios, u32 {u32 p = *addr; -if (*addr > bios->image0_size && bios->imaged_addr) { +if (*addr >= bios->image0_size && bios->imaged_addr) { *addr -= bios->image0_size; *addr += bios->imaged_addr; }
Greg Kroah-Hartman
maintainerPATCH 23/287 drm/amdgpu: Check BOs requested pinning domains against its preferred_domains
In reply to Greg Kroah-HartmanFrom: Leo Li <[email protected]>
commit f5ba14043621f4afdf3ad5f92ee2d8dbebbe4340 upstream.
When pinning a buffer, we should check to see if there are any additional restrictions imposed by bo->preferred_domains. This will prevent the BO from being moved to an invalid domain when pinning.
For example, this can happen if the user requests to create a BO in GTT domain for display scanout. amdgpu_dm will allow pinning to either VRAM or GTT domains, since DCN can scanout from either or. However, in amdgpu_bo_pin_restricted(), pinning to VRAM is preferred if there is adequate carveout. This can lead to pinning to VRAM despite the user requesting GTT placement for the BO.
v2: Allow the kernel to override the domain, which can happen when
exporting a BO to a V4L camera (for example).
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4 -0
@@ -883,6 +883,10 @@ int amdgpu_bo_pin_restricted(struct amdgif (WARN_ON_ONCE (min_offset > max_offset))return -EINVAL ; +/* Check domain to be pinned to against preferred domains */ +if (bo->preferred_domains & domain) + domain = bo->preferred_domains & domain; +/* A shared bo cannot be migrated to VRAM */ if (bo->prime_shared_count) {if (domain &AMDGPU_GEM_DOMAIN_GTT )
Greg Kroah-Hartman
maintainerPATCH 24/287 bpf: Verifer, adjust_scalar_min_max_vals to always call update_reg_bounds()
In reply to Greg Kroah-HartmanFrom: Ovidiu Panait <[email protected]>
From: John Fastabend <[email protected]>
commit 294f2fc6da27620a506e6c050241655459ccd6bd upstream.
Currently, for all op verification we call __red_deduce_bounds() and __red_bound_offset() but we only call __update_reg_bounds() in bitwise ops. However, we could benefit from calling __update_reg_bounds() in BPF_ADD, BPF_SUB, and BPF_MUL cases as well.
For example, a register with state 'R1_w=invP0' when we subtract from it,
w1 -= 2
Before coerce we will now have an smin_value=S64_MIN, smax_value=U64_MAX and unsigned bounds umin_value=0, umax_value=U64_MAX. These will then be clamped to S32_MIN, U32_MAX values by coerce in the case of alu32 op as done in above example. However tnum will be a constant because the ALU op is done on a constant.
Without update_reg_bounds() we have a scenario where tnum is a const but our unsigned bounds do not reflect this. By calling update_reg_bounds after coerce to 32bit we further refine the umin_value to U64_MAX in the alu64 case or U32_MAX in the alu32 case above.
--- kernel/bpf/verifier.c | 1 + 1 file changed, 1 insertion(+)
kernel/bpf/verifier.c +1 -0
@@ -3496,6 +3496,7 @@ static int adjust_scalar_min_max_vals(stcoerce_reg_to_size (dst_reg,4 ); } +__update_reg_bounds (dst_reg);__reg_deduce_bounds (dst_reg);__reg_bound_offset (dst_reg);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 25/287 selftests/bpf: Fix test_align verifier log patterns
In reply to Greg Kroah-HartmanFrom: Ovidiu Panait <[email protected]>
From: Stanislav Fomichev <[email protected]>
commit 5366d2269139ba8eb6a906d73a0819947e3e4e0a upstream.
Commit 294f2fc6da27 ("bpf: Verifer, adjust_scalar_min_max_vals to always call update_reg_bounds()") changed the way verifier logs some of its state, adjust the test_align accordingly. Where possible, I tried to not copy-paste the entire log line and resorted to dropping the last closing brace instead.
--- tools/testing/selftests/bpf/test_align.c | 41 +++++++++++++++---------------- 1 file changed, 21 insertions(+), 20 deletions(-)
tools/testing/selftests/bpf/test_align.c +21 -20
@@ -359,15 +359,15 @@ static struct bpf_align_test tests[] = {* is still (4n), fixed offset is not changed. * Also, we create a new reg->id. */ - {29, "R5_w=pkt(id=4,off=18,r=0,umax_value=2040,var_off=(0x0; 0x7fc))"}, + {29, "R5_w=pkt(id=4,off=18,r=0,umax_value=2040,var_off=(0x0; 0x7fc)"},/* At the time the word size load is performed from R5, * its total fixed offset is NET_IP_ALIGN + reg->off (18) * which is 20. Then the variable offset is (4n), so * the total offset is 4-byte aligned and meets the * load's requirements. */ - {33, "R4=pkt(id=4,off=22,r=22,umax_value=2040,var_off=(0x0; 0x7fc))"}, - {33, "R5=pkt(id=4,off=18,r=22,umax_value=2040,var_off=(0x0; 0x7fc))"}, + {33, "R4=pkt(id=4,off=22,r=22,umax_value=2040,var_off=(0x0; 0x7fc)"}, + {33, "R5=pkt(id=4,off=18,r=22,umax_value=2040,var_off=(0x0; 0x7fc)"}, }, }, {
@@ -410,15 +410,15 @@ static struct bpf_align_test tests[] = {/* Adding 14 makes R6 be (4n+2) */ {9, "R6_w=inv(id=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"},/* Packet pointer has (4n+2) offset */ - {11, "R5_w=pkt(id=1,off=0,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"}, - {13, "R4=pkt(id=1,off=4,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"}, + {11, "R5_w=pkt(id=1,off=0,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc)"}, + {13, "R4=pkt(id=1,off=4,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc)"},/* At the time the word size load is performed from R5, * its total fixed offset is NET_IP_ALIGN + reg->off (0) * which is 2. Then the variable offset is (4n+2), so * the total offset is 4-byte aligned and meets the * load's requirements. */ - {15, "R5=pkt(id=1,off=0,r=4,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"}, + {15, "R5=pkt(id=1,off=0,r=4,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc)"},/* Newly read value in R6 was shifted left by 2, so has * known alignment of 4. */
@@ -426,15 +426,15 @@ static struct bpf_align_test tests[] = {/* Added (4n) to packet pointer's (4n+2) var_off, giving * another (4n+2). */ - {19, "R5_w=pkt(id=2,off=0,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc))"}, - {21, "R4=pkt(id=2,off=4,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc))"}, + {19, "R5_w=pkt(id=2,off=0,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc)"}, + {21, "R4=pkt(id=2,off=4,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc)"},/* At the time the word size load is performed from R5, * its total fixed offset is NET_IP_ALIGN + reg->off (0) * which is 2. Then the variable offset is (4n+2), so * the total offset is 4-byte aligned and meets the * load's requirements. */ - {23, "R5=pkt(id=2,off=0,r=4,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc))"}, + {23, "R5=pkt(id=2,off=0,r=4,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc)"}, }, }, {
@@ -469,16 +469,16 @@ static struct bpf_align_test tests[] = { .matches = { {4, "R5_w=pkt_end(id=0,off=0,imm=0)"},/* (ptr - ptr) << 2 == unknown, (4n) */ - {6, "R5_w=inv(id=0,smax_value=9223372036854775804,umax_value=18446744073709551612,var_off=(0x0; 0xfffffffffffffffc))"}, + {6, "R5_w=inv(id=0,smax_value=9223372036854775804,umax_value=18446744073709551612,var_off=(0x0; 0xfffffffffffffffc)"},/* (4n) + 14 == (4n+2). We blow our bounds, because * the add could overflow. */ - {7, "R5=inv(id=0,var_off=(0x2; 0xfffffffffffffffc))"}, + {7, "R5=inv(id=0,smin_value=-9223372036854775806,smax_value=9223372036854775806,umin_value=2,umax_value=18446744073709551614,var_off=(0x2; 0xfffffffffffffffc)"},/* Checked s>=0 */ - {9, "R5=inv(id=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"}, + {9, "R5=inv(id=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"},/* packet pointer + nonnegative (4n+2) */ - {11, "R6_w=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"}, - {13, "R4=pkt(id=1,off=4,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"}, + {11, "R6_w=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"}, + {13, "R4=pkt(id=1,off=4,r=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"},/* NET_IP_ALIGN + (4n+2) == (4n), alignment is fine. * We checked the bounds, but it might have been able * to overflow if the packet pointer started in the
@@ -486,7 +486,7 @@ static struct bpf_align_test tests[] = {* So we did not get a 'range' on R6, and the access * attempt will fail. */ - {15, "R6=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"}, + {15, "R6=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"}, } }, {
@@ -528,7 +528,7 @@ static struct bpf_align_test tests[] = {/* New unknown value in R7 is (4n) */ {11, "R7_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},/* Subtracting it from R6 blows our unsigned bounds */ - {12, "R6=inv(id=0,smin_value=-1006,smax_value=1034,var_off=(0x2; 0xfffffffffffffffc))"}, + {12, "R6=inv(id=0,smin_value=-1006,smax_value=1034,umin_value=2,umax_value=18446744073709551614,var_off=(0x2; 0xfffffffffffffffc)"},/* Checked s>= 0 */ {14, "R6=inv(id=0,umin_value=2,umax_value=1034,var_off=(0x2; 0x7fc))"},/* At the time the word size load is performed from R5,
@@ -537,7 +537,8 @@ static struct bpf_align_test tests[] = {* the total offset is 4-byte aligned and meets the * load's requirements. */ - {20, "R5=pkt(id=1,off=0,r=4,umin_value=2,umax_value=1034,var_off=(0x2; 0x7fc))"}, + {20, "R5=pkt(id=1,off=0,r=4,umin_value=2,umax_value=1034,var_off=(0x2; 0x7fc)"}, + }, }, {
@@ -579,18 +580,18 @@ static struct bpf_align_test tests[] = {/* Adding 14 makes R6 be (4n+2) */ {11, "R6_w=inv(id=0,umin_value=14,umax_value=74,var_off=(0x2; 0x7c))"},/* Subtracting from packet pointer overflows ubounds */ - {13, "R5_w=pkt(id=1,off=0,r=8,umin_value=18446744073709551542,umax_value=18446744073709551602,var_off=(0xffffffffffffff82; 0x7c))"}, + {13, "R5_w=pkt(id=1,off=0,r=8,umin_value=18446744073709551542,umax_value=18446744073709551602,var_off=(0xffffffffffffff82; 0x7c)"},/* New unknown value in R7 is (4n), >= 76 */ {15, "R7_w=inv(id=0,umin_value=76,umax_value=1096,var_off=(0x0; 0x7fc))"},/* Adding it to packet pointer gives nice bounds again */ - {16, "R5_w=pkt(id=2,off=0,r=0,umin_value=2,umax_value=1082,var_off=(0x2; 0x7fc))"}, + {16, "R5_w=pkt(id=2,off=0,r=0,umin_value=2,umax_value=1082,var_off=(0x2; 0xfffffffc)"},/* At the time the word size load is performed from R5, * its total fixed offset is NET_IP_ALIGN + reg->off (0) * which is 2. Then the variable offset is (4n+2), so * the total offset is 4-byte aligned and meets the * load's requirements. */ - {20, "R5=pkt(id=2,off=0,r=4,umin_value=2,umax_value=1082,var_off=(0x2; 0x7fc))"}, + {20, "R5=pkt(id=2,off=0,r=4,umin_value=2,umax_value=1082,var_off=(0x2; 0xfffffffc)"}, }, }, };
Re: [PATCH 4.19 025/287] selftests/bpf: Fix test_align verifier log patterns
Hi,
Quoted 11 lines · Greg Kroah-Hartman
From: Ovidiu Panait <[email protected]>
From: Stanislav Fomichev <[email protected]>
commit
5366d2269139ba8eb6a906d73a0819947e3e4e0aupstream.Commit
294f2fc6da27("bpf: Verifer,adjust_scalar_min_max_valsto always callupdate_reg_bounds()") changed the way verifier logs some of its state, adjust thetest_alignaccordingly. Where possible, I tried to not copy-paste the entire log line and resorted to dropping the last closing brace instead.
Quoted 7 lines
Fixes 294f2fc6da27 ("bpf: Verifer, adjust_scalar_min_max_vals to always call update_reg_bounds()")Signed-off-by Stanislav Fomichev <[email protected]>Signed-off-by Daniel Borkmann <[email protected]>[OP: adjust for 4.19 selftests]Signed-off-by Ovidiu Panait <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
I believe this one shouldn't be applied as-is either, only partially. See
https://lore.kernel.org/stable/[email protected]/
Ovidiu, do you want to resend this one with only the fixes for "bpf:
Verifer, adjust_scalar_min_max_vals to always call update_reg_bounds()"?
Thanks,
Jean
Quoted 138 lines
--- tools/testing/selftests/bpf/test_align.c | 41 +++++++++++++++---------------- 1 file changed, 21 insertions(+), 20 deletions(-)tools/testing/selftests/bpf/test_align.c +21
-20@@ -359,15 +359,15 @@ static struct bpf_align_test tests[] = {* is still (4n), fixed offset is not changed. * Also, we create a new reg->id. */ - {29, "R5_w=pkt(id=4,off=18,r=0,umax_value=2040,var_off=(0x0; 0x7fc))"}, + {29, "R5_w=pkt(id=4,off=18,r=0,umax_value=2040,var_off=(0x0; 0x7fc)"},/* At the time the word size load is performed from R5, * its total fixed offset is NET_IP_ALIGN + reg->off (18) * which is 20. Then the variable offset is (4n), so * the total offset is 4-byte aligned and meets the * load's requirements. */ - {33, "R4=pkt(id=4,off=22,r=22,umax_value=2040,var_off=(0x0; 0x7fc))"}, - {33, "R5=pkt(id=4,off=18,r=22,umax_value=2040,var_off=(0x0; 0x7fc))"}, + {33, "R4=pkt(id=4,off=22,r=22,umax_value=2040,var_off=(0x0; 0x7fc)"}, + {33, "R5=pkt(id=4,off=18,r=22,umax_value=2040,var_off=(0x0; 0x7fc)"}, }, }, {@@ -410,15 +410,15 @@ static struct bpf_align_test tests[] = {/* Adding 14 makes R6 be (4n+2) */ {9, "R6_w=inv(id=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"},/* Packet pointer has (4n+2) offset */ - {11, "R5_w=pkt(id=1,off=0,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"}, - {13, "R4=pkt(id=1,off=4,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"}, + {11, "R5_w=pkt(id=1,off=0,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc)"}, + {13, "R4=pkt(id=1,off=4,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc)"},/* At the time the word size load is performed from R5, * its total fixed offset is NET_IP_ALIGN + reg->off (0) * which is 2. Then the variable offset is (4n+2), so * the total offset is 4-byte aligned and meets the * load's requirements. */ - {15, "R5=pkt(id=1,off=0,r=4,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"}, + {15, "R5=pkt(id=1,off=0,r=4,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc)"},/* Newly read value in R6 was shifted left by 2, so has * known alignment of 4. */@@ -426,15 +426,15 @@ static struct bpf_align_test tests[] = {/* Added (4n) to packet pointer's (4n+2) var_off, giving * another (4n+2). */ - {19, "R5_w=pkt(id=2,off=0,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc))"}, - {21, "R4=pkt(id=2,off=4,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc))"}, + {19, "R5_w=pkt(id=2,off=0,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc)"}, + {21, "R4=pkt(id=2,off=4,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc)"},/* At the time the word size load is performed from R5, * its total fixed offset is NET_IP_ALIGN + reg->off (0) * which is 2. Then the variable offset is (4n+2), so * the total offset is 4-byte aligned and meets the * load's requirements. */ - {23, "R5=pkt(id=2,off=0,r=4,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc))"}, + {23, "R5=pkt(id=2,off=0,r=4,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc)"}, }, }, {@@ -469,16 +469,16 @@ static struct bpf_align_test tests[] = { .matches = { {4, "R5_w=pkt_end(id=0,off=0,imm=0)"},/* (ptr - ptr) << 2 == unknown, (4n) */ - {6, "R5_w=inv(id=0,smax_value=9223372036854775804,umax_value=18446744073709551612,var_off=(0x0; 0xfffffffffffffffc))"}, + {6, "R5_w=inv(id=0,smax_value=9223372036854775804,umax_value=18446744073709551612,var_off=(0x0; 0xfffffffffffffffc)"},/* (4n) + 14 == (4n+2). We blow our bounds, because * the add could overflow. */ - {7, "R5=inv(id=0,var_off=(0x2; 0xfffffffffffffffc))"}, + {7, "R5=inv(id=0,smin_value=-9223372036854775806,smax_value=9223372036854775806,umin_value=2,umax_value=18446744073709551614,var_off=(0x2; 0xfffffffffffffffc)"},/* Checked s>=0 */ - {9, "R5=inv(id=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"}, + {9, "R5=inv(id=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"},/* packet pointer + nonnegative (4n+2) */ - {11, "R6_w=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"}, - {13, "R4=pkt(id=1,off=4,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"}, + {11, "R6_w=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"}, + {13, "R4=pkt(id=1,off=4,r=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"},/* NET_IP_ALIGN + (4n+2) == (4n), alignment is fine. * We checked the bounds, but it might have been able * to overflow if the packet pointer started in the @@ -486,7 +486,7 @@ static struct bpf_align_test tests[] = {* So we did not get a 'range' on R6, and the access * attempt will fail. */ - {15, "R6=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"}, + {15, "R6=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"}, } }, {@@ -528,7 +528,7 @@ static struct bpf_align_test tests[] = {/* New unknown value in R7 is (4n) */ {11, "R7_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},/* Subtracting it from R6 blows our unsigned bounds */ - {12, "R6=inv(id=0,smin_value=-1006,smax_value=1034,var_off=(0x2; 0xfffffffffffffffc))"}, + {12, "R6=inv(id=0,smin_value=-1006,smax_value=1034,umin_value=2,umax_value=18446744073709551614,var_off=(0x2; 0xfffffffffffffffc)"},/* Checked s>= 0 */ {14, "R6=inv(id=0,umin_value=2,umax_value=1034,var_off=(0x2; 0x7fc))"},/* At the time the word size load is performed from R5, @@ -537,7 +537,8 @@ static struct bpf_align_test tests[] = {* the total offset is 4-byte aligned and meets the * load's requirements. */ - {20, "R5=pkt(id=1,off=0,r=4,umin_value=2,umax_value=1034,var_off=(0x2; 0x7fc))"}, + {20, "R5=pkt(id=1,off=0,r=4,umin_value=2,umax_value=1034,var_off=(0x2; 0x7fc)"}, + }, }, {@@ -579,18 +580,18 @@ static struct bpf_align_test tests[] = {/* Adding 14 makes R6 be (4n+2) */ {11, "R6_w=inv(id=0,umin_value=14,umax_value=74,var_off=(0x2; 0x7c))"},/* Subtracting from packet pointer overflows ubounds */ - {13, "R5_w=pkt(id=1,off=0,r=8,umin_value=18446744073709551542,umax_value=18446744073709551602,var_off=(0xffffffffffffff82; 0x7c))"}, + {13, "R5_w=pkt(id=1,off=0,r=8,umin_value=18446744073709551542,umax_value=18446744073709551602,var_off=(0xffffffffffffff82; 0x7c)"},/* New unknown value in R7 is (4n), >= 76 */ {15, "R7_w=inv(id=0,umin_value=76,umax_value=1096,var_off=(0x0; 0x7fc))"},/* Adding it to packet pointer gives nice bounds again */ - {16, "R5_w=pkt(id=2,off=0,r=0,umin_value=2,umax_value=1082,var_off=(0x2; 0x7fc))"}, + {16, "R5_w=pkt(id=2,off=0,r=0,umin_value=2,umax_value=1082,var_off=(0x2; 0xfffffffc)"},/* At the time the word size load is performed from R5, * its total fixed offset is NET_IP_ALIGN + reg->off (0) * which is 2. Then the variable offset is (4n+2), so * the total offset is 4-byte aligned and meets the * load's requirements. */ - {20, "R5=pkt(id=2,off=0,r=4,umin_value=2,umax_value=1082,var_off=(0x2; 0x7fc))"}, + {20, "R5=pkt(id=2,off=0,r=4,umin_value=2,umax_value=1082,var_off=(0x2; 0xfffffffc)"}, }, }, };
Greg Kroah-Hartman
maintainerRe: [PATCH 4.19 025/287] selftests/bpf: Fix test_align verifier log patterns
Quoted 22 lines · Jean-Philippe Brucker
Hi,
Quoted 11 lines · Greg Kroah-Hartman
From: Ovidiu Panait <[email protected]>
From: Stanislav Fomichev <[email protected]>
commit
5366d2269139ba8eb6a906d73a0819947e3e4e0aupstream.Commit
294f2fc6da27("bpf: Verifer,adjust_scalar_min_max_valsto always callupdate_reg_bounds()") changed the way verifier logs some of its state, adjust thetest_alignaccordingly. Where possible, I tried to not copy-paste the entire log line and resorted to dropping the last closing brace instead.Quoted 7 lines
Fixes 294f2fc6da27 ("bpf: Verifer, adjust_scalar_min_max_vals to always call update_reg_bounds()")Signed-off-by Stanislav Fomichev <[email protected]>Signed-off-by Daniel Borkmann <[email protected]>[OP: adjust for 4.19 selftests]Signed-off-by Ovidiu Panait <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 2 lines
I believe this one shouldn't be applied as-is either, only partially. See
https://lore.kernel.org/stable/[email protected]/
Now dropped, thanks
greg k-h
Re: [PATCH 4.19 025/287] selftests/bpf: Fix test_align verifier log patterns
In reply to Jean-Philippe BruckerHi Jean-Philippe,
Quoted 23 lines · Jean-Philippe Brucker
[Please note: This e-mail is from an EXTERNAL e-mail address]
Hi,
Quoted 11 lines · Greg Kroah-Hartman
From: Ovidiu Panait <[email protected]>
From: Stanislav Fomichev <[email protected]>
commit
5366d2269139ba8eb6a906d73a0819947e3e4e0aupstream.Commit
294f2fc6da27("bpf: Verifer,adjust_scalar_min_max_valsto always callupdate_reg_bounds()") changed the way verifier logs some of its state, adjust thetest_alignaccordingly. Where possible, I tried to not copy-paste the entire log line and resorted to dropping the last closing brace instead.Quoted 7 lines
Fixes 294f2fc6da27 ("bpf: Verifer, adjust_scalar_min_max_vals to always call update_reg_bounds()")Signed-off-by Stanislav Fomichev <[email protected]>Signed-off-by Daniel Borkmann <[email protected]>[OP: adjust for 4.19 selftests]Signed-off-by Ovidiu Panait <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 5 lines
I believe this one shouldn't be applied as-is either, only partially. See
https://lore.kernel.org/stable/[email protected]/Ovidiu, do you want to resend this one with only the fixes for "bpf:
Verifer,adjust_scalar_min_max_valsto always callupdate_reg_bounds()"?
Yes, I will resend the whole patchset with the selftests properly fixed.
Thanks,
Ovidiu
Quoted 142 lines
Thanks,
JeanQuoted 138 lines
--- tools/testing/selftests/bpf/test_align.c | 41 +++++++++++++++---------------- 1 file changed, 21 insertions(+), 20 deletions(-)tools/testing/selftests/bpf/test_align.c +21
-20@@ -359,15 +359,15 @@ static struct bpf_align_test tests[] = {* is still (4n), fixed offset is not changed. * Also, we create a new reg->id. */ - {29, "R5_w=pkt(id=4,off=18,r=0,umax_value=2040,var_off=(0x0; 0x7fc))"}, + {29, "R5_w=pkt(id=4,off=18,r=0,umax_value=2040,var_off=(0x0; 0x7fc)"},/* At the time the word size load is performed from R5, * its total fixed offset is NET_IP_ALIGN + reg->off (18) * which is 20. Then the variable offset is (4n), so * the total offset is 4-byte aligned and meets the * load's requirements. */ - {33, "R4=pkt(id=4,off=22,r=22,umax_value=2040,var_off=(0x0; 0x7fc))"}, - {33, "R5=pkt(id=4,off=18,r=22,umax_value=2040,var_off=(0x0; 0x7fc))"}, + {33, "R4=pkt(id=4,off=22,r=22,umax_value=2040,var_off=(0x0; 0x7fc)"}, + {33, "R5=pkt(id=4,off=18,r=22,umax_value=2040,var_off=(0x0; 0x7fc)"}, }, }, {@@ -410,15 +410,15 @@ static struct bpf_align_test tests[] = {/* Adding 14 makes R6 be (4n+2) */ {9, "R6_w=inv(id=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"},/* Packet pointer has (4n+2) offset */ - {11, "R5_w=pkt(id=1,off=0,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"}, - {13, "R4=pkt(id=1,off=4,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"}, + {11, "R5_w=pkt(id=1,off=0,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc)"}, + {13, "R4=pkt(id=1,off=4,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc)"},/* At the time the word size load is performed from R5, * its total fixed offset is NET_IP_ALIGN + reg->off (0) * which is 2. Then the variable offset is (4n+2), so * the total offset is 4-byte aligned and meets the * load's requirements. */ - {15, "R5=pkt(id=1,off=0,r=4,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"}, + {15, "R5=pkt(id=1,off=0,r=4,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc)"},/* Newly read value in R6 was shifted left by 2, so has * known alignment of 4. */@@ -426,15 +426,15 @@ static struct bpf_align_test tests[] = {/* Added (4n) to packet pointer's (4n+2) var_off, giving * another (4n+2). */ - {19, "R5_w=pkt(id=2,off=0,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc))"}, - {21, "R4=pkt(id=2,off=4,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc))"}, + {19, "R5_w=pkt(id=2,off=0,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc)"}, + {21, "R4=pkt(id=2,off=4,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc)"},/* At the time the word size load is performed from R5, * its total fixed offset is NET_IP_ALIGN + reg->off (0) * which is 2. Then the variable offset is (4n+2), so * the total offset is 4-byte aligned and meets the * load's requirements. */ - {23, "R5=pkt(id=2,off=0,r=4,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc))"}, + {23, "R5=pkt(id=2,off=0,r=4,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc)"}, }, }, {@@ -469,16 +469,16 @@ static struct bpf_align_test tests[] = { .matches = { {4, "R5_w=pkt_end(id=0,off=0,imm=0)"},/* (ptr - ptr) << 2 == unknown, (4n) */ - {6, "R5_w=inv(id=0,smax_value=9223372036854775804,umax_value=18446744073709551612,var_off=(0x0; 0xfffffffffffffffc))"}, + {6, "R5_w=inv(id=0,smax_value=9223372036854775804,umax_value=18446744073709551612,var_off=(0x0; 0xfffffffffffffffc)"},/* (4n) + 14 == (4n+2). We blow our bounds, because * the add could overflow. */ - {7, "R5=inv(id=0,var_off=(0x2; 0xfffffffffffffffc))"}, + {7, "R5=inv(id=0,smin_value=-9223372036854775806,smax_value=9223372036854775806,umin_value=2,umax_value=18446744073709551614,var_off=(0x2; 0xfffffffffffffffc)"},/* Checked s>=0 */ - {9, "R5=inv(id=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"}, + {9, "R5=inv(id=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"},/* packet pointer + nonnegative (4n+2) */ - {11, "R6_w=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"}, - {13, "R4=pkt(id=1,off=4,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"}, + {11, "R6_w=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"}, + {13, "R4=pkt(id=1,off=4,r=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"},/* NET_IP_ALIGN + (4n+2) == (4n), alignment is fine. * We checked the bounds, but it might have been able * to overflow if the packet pointer started in the @@ -486,7 +486,7 @@ static struct bpf_align_test tests[] = {* So we did not get a 'range' on R6, and the access * attempt will fail. */ - {15, "R6=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"}, + {15, "R6=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"}, } }, {@@ -528,7 +528,7 @@ static struct bpf_align_test tests[] = {/* New unknown value in R7 is (4n) */ {11, "R7_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},/* Subtracting it from R6 blows our unsigned bounds */ - {12, "R6=inv(id=0,smin_value=-1006,smax_value=1034,var_off=(0x2; 0xfffffffffffffffc))"}, + {12, "R6=inv(id=0,smin_value=-1006,smax_value=1034,umin_value=2,umax_value=18446744073709551614,var_off=(0x2; 0xfffffffffffffffc)"},/* Checked s>= 0 */ {14, "R6=inv(id=0,umin_value=2,umax_value=1034,var_off=(0x2; 0x7fc))"},/* At the time the word size load is performed from R5, @@ -537,7 +537,8 @@ static struct bpf_align_test tests[] = {* the total offset is 4-byte aligned and meets the * load's requirements. */ - {20, "R5=pkt(id=1,off=0,r=4,umin_value=2,umax_value=1034,var_off=(0x2; 0x7fc))"}, + {20, "R5=pkt(id=1,off=0,r=4,umin_value=2,umax_value=1034,var_off=(0x2; 0x7fc)"}, + }, }, {@@ -579,18 +580,18 @@ static struct bpf_align_test tests[] = {/* Adding 14 makes R6 be (4n+2) */ {11, "R6_w=inv(id=0,umin_value=14,umax_value=74,var_off=(0x2; 0x7c))"},/* Subtracting from packet pointer overflows ubounds */ - {13, "R5_w=pkt(id=1,off=0,r=8,umin_value=18446744073709551542,umax_value=18446744073709551602,var_off=(0xffffffffffffff82; 0x7c))"}, + {13, "R5_w=pkt(id=1,off=0,r=8,umin_value=18446744073709551542,umax_value=18446744073709551602,var_off=(0xffffffffffffff82; 0x7c)"},/* New unknown value in R7 is (4n), >= 76 */ {15, "R7_w=inv(id=0,umin_value=76,umax_value=1096,var_off=(0x0; 0x7fc))"},/* Adding it to packet pointer gives nice bounds again */ - {16, "R5_w=pkt(id=2,off=0,r=0,umin_value=2,umax_value=1082,var_off=(0x2; 0x7fc))"}, + {16, "R5_w=pkt(id=2,off=0,r=0,umin_value=2,umax_value=1082,var_off=(0x2; 0xfffffffc)"},/* At the time the word size load is performed from R5, * its total fixed offset is NET_IP_ALIGN + reg->off (0) * which is 2. Then the variable offset is (4n+2), so * the total offset is 4-byte aligned and meets the * load's requirements. */ - {20, "R5=pkt(id=2,off=0,r=4,umin_value=2,umax_value=1082,var_off=(0x2; 0x7fc))"}, + {20, "R5=pkt(id=2,off=0,r=4,umin_value=2,umax_value=1082,var_off=(0x2; 0xfffffffc)"}, }, }, };
Greg Kroah-Hartman
maintainerPATCH 26/287 selftests/bpf: Fix "dubious pointer arithmetic" test
In reply to Greg Kroah-HartmanFrom: Ovidiu Panait <[email protected]>
From: Jean-Philippe Brucker <[email protected]>
commit 3615bdf6d9b19db12b1589861609b4f1c6a8d303 upstream.
The verifier trace changed following a bugfix. After checking the 64-bit sign, only the upper bit mask is known, not bit 31. Update the test accordingly.
--- tools/testing/selftests/bpf/test_align.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/bpf/test_align.c +4 -4
@@ -475,10 +475,10 @@ static struct bpf_align_test tests[] = {*/ {7, "R5=inv(id=0,smin_value=-9223372036854775806,smax_value=9223372036854775806,umin_value=2,umax_value=18446744073709551614,var_off=(0x2; 0xfffffffffffffffc)"},/* Checked s>=0 */ - {9, "R5=inv(id=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"}, + {9, "R5=inv(id=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc)"},/* packet pointer + nonnegative (4n+2) */ - {11, "R6_w=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"}, - {13, "R4=pkt(id=1,off=4,r=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"}, + {11, "R6_w=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc)"}, + {13, "R4=pkt(id=1,off=4,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc)"},/* NET_IP_ALIGN + (4n+2) == (4n), alignment is fine. * We checked the bounds, but it might have been able * to overflow if the packet pointer started in the
@@ -486,7 +486,7 @@ static struct bpf_align_test tests[] = {* So we did not get a 'range' on R6, and the access * attempt will fail. */ - {15, "R6=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"}, + {15, "R6=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc)"}, } }, {
Re: [PATCH 4.19 026/287] selftests/bpf: Fix "dubious pointer arithmetic" test
Hi,
Quoted 5 lines · Greg Kroah-Hartman
From: Ovidiu Panait <[email protected]>
From: Jean-Philippe Brucker <[email protected]>
commit
3615bdf6d9b19db12b1589861609b4f1c6a8d303upstream.
This shouldn't be backported to 4.19, because it adjusts the selftest due to commit b02709587ea3 ("bpf: Fix propagation of 32-bit signed bounds from 64-bit bounds."), which wasn't backported further than 5.9.
See [1] for the report about these BPF backports to v5.4, which we are still trying to unravel. Given how painful building the BPF tests used to be even on 5.4, I'd rather not do the same on 4.19!
[1] https://lore.kernel.org/lkml/CAPXMrf-C5XEUfOJd3GCtgtHOkc8DxDGbLxE5=GFmr+Py0zKxJA@mail.gmail.com/
Thanks,
Jean
Quoted 42 lines
The verifier trace changed following a bugfix. After checking the 64-bit sign, only the upper bit mask is known, not bit 31. Update the test accordingly.
Signed-off-by Jean-Philippe Brucker <[email protected]>Acked-by John Fastabend <[email protected]>Signed-off-by Alexei Starovoitov <[email protected]>[OP: adjust for 4.19 selftests]Signed-off-by Ovidiu Panait <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- tools/testing/selftests/bpf/test_align.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)tools/testing/selftests/bpf/test_align.c +4
-4@@ -475,10 +475,10 @@ static struct bpf_align_test tests[] = {*/ {7, "R5=inv(id=0,smin_value=-9223372036854775806,smax_value=9223372036854775806,umin_value=2,umax_value=18446744073709551614,var_off=(0x2; 0xfffffffffffffffc)"},/* Checked s>=0 */ - {9, "R5=inv(id=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"}, + {9, "R5=inv(id=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc)"},/* packet pointer + nonnegative (4n+2) */ - {11, "R6_w=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"}, - {13, "R4=pkt(id=1,off=4,r=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"}, + {11, "R6_w=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc)"}, + {13, "R4=pkt(id=1,off=4,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc)"},/* NET_IP_ALIGN + (4n+2) == (4n), alignment is fine. * We checked the bounds, but it might have been able * to overflow if the packet pointer started in the @@ -486,7 +486,7 @@ static struct bpf_align_test tests[] = {* So we did not get a 'range' on R6, and the access * attempt will fail. */ - {15, "R6=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372034707292158,var_off=(0x2; 0x7fffffff7ffffffc)"}, + {15, "R6=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc)"}, } }, {
Greg Kroah-Hartman
maintainerRe: [PATCH 4.19 026/287] selftests/bpf: Fix "dubious pointer arithmetic" test
Quoted 13 lines · Jean-Philippe Brucker
Hi,
Quoted 5 lines · Greg Kroah-Hartman
From: Ovidiu Panait <[email protected]>
From: Jean-Philippe Brucker <[email protected]>
commit
3615bdf6d9b19db12b1589861609b4f1c6a8d303upstream.This shouldn't be backported to 4.19, because it adjusts the selftest due to commit
b02709587ea3("bpf: Fix propagation of 32-bit signed bounds from 64-bit bounds."), which wasn't backported further than 5.9.
Quoted 5 lines
See [1] for the report about these BPF backports to v5.4, which we are still trying to unravel. Given how painful building the BPF tests used to be even on 5.4, I'd rather not do the same on 4.19!
[1] https://lore.kernel.org/lkml/CAPXMrf-C5XEUfOJd3GCtgtHOkc8DxDGbLxE5=GFmr+Py0zKxJA@mail.gmail.com/
Thanks for letting me know, I've now dropped this from the 4.19-rc queue.
Ovidiu, please work on fixing this up in a way that everyone can agree on.
thanks,
greg k-h
Greg Kroah-Hartman
maintainerPATCH 27/287 iio: light: isl29028: Fix the warning in isl29028_remove()
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
commit 06674fc7c003b9d0aa1d37fef7ab2c24802cc6ad upstream.
The driver use the non-managed form of the register function in isl29028_remove(). To keep the release order as mirroring the ordering in probe, the driver should use non-managed form in probe, too.
The following log reveals it:
[ 32.374955] isl29028 0-0010: remove [ 32.376861] general protection fault, probably for non-canonical address 0xdffffc0000000006: 0000 [#1] PREEMPT SMP KASAN PTI [ 32.377676] KASAN: null-ptr-deref in range [0x0000000000000030-0x0000000000000037] [ 32.379432] RIP: 0010:kernfs_find_and_get_ns+0x28/0xe0 [ 32.385461] Call Trace: [ 32.385807] sysfs_unmerge_group+0x59/0x110 [ 32.386110] dpm_sysfs_remove+0x58/0xc0 [ 32.386391] device_del+0x296/0xe50 [ 32.386959] cdev_device_del+0x1d/0xd0 [ 32.387231] devm_iio_device_unreg+0x27/0xb0 [ 32.387542] devres_release_group+0x319/0x3d0 [ 32.388162] i2c_device_remove+0x93/0x1f0
--- drivers/iio/light/isl29028.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/isl29028.c +1 -1
@@ -639,7 +639,7 @@ static int isl29028_probe(struct i2c_cli ISL29028_POWER_OFF_DELAY_MS);pm_runtime_use_autosuspend (&client->dev); - ret =devm_iio_device_register (indio_dev->dev.parent, indio_dev); + ret =iio_device_register (indio_dev);if (ret <0 ) { dev_err(&client->dev, "%s(): iio registration failed with error %d\n",
Greg Kroah-Hartman
maintainerPATCH 28/287 fuse: limit nsec
In reply to Greg Kroah-HartmanFrom: Miklos Szeredi <[email protected]>
commit 47912eaa061a6a81e4aa790591a1874c650733c0 upstream.
Limit nanoseconds to 0..999999999.
--- fs/fuse/inode.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/fuse/inode.c +6 -0
@@ -174,6 +174,12 @@ void fuse_change_attributes_common(struc inode->i_uid =make_kuid (fc->user_ns, attr->uid); inode->i_gid =make_kgid (fc->user_ns, attr->gid); inode->i_blocks = attr->blocks; + +/* Sanitize nsecs */ + attr->atimensec =min_t (u32, attr->atimensec,NSEC_PER_SEC -1 ); + attr->mtimensec =min_t (u32, attr->mtimensec,NSEC_PER_SEC -1 ); + attr->ctimensec =min_t (u32, attr->ctimensec,NSEC_PER_SEC -1 ); + inode->i_atime.tv_sec = attr->atime; inode->i_atime.tv_nsec = attr->atimensec;/* mtime from server may be stale due to local buffered write */
Greg Kroah-Hartman
maintainerPATCH 29/287 serial: mvebu-uart: uart2 error bits clearing
In reply to Greg Kroah-HartmanFrom: Narendra Hadke <[email protected]>
commit a7209541239e5dd44d981289e5f9059222d40fd1 upstream.
For mvebu uart2, error bits are not cleared on buffer read. This causes interrupt loop and system hang.
--- drivers/tty/serial/mvebu-uart.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/tty/serial/mvebu-uart.c +11 -0
@@ -237,6 +237,7 @@ static void mvebu_uart_rx_chars(struct ustruct tty_port *tport = &port->state->port;unsigned char ch =0 ;char flag =0 ; +int ret; do { if (status & STAT_RX_RDY(port)) {
@@ -249,6 +250,16 @@ static void mvebu_uart_rx_chars(struct u port->icount.parity++; } +/* +* For UART2, error bits are not cleared on buffer read. +* This causes interrupt loop and system hang. +*/ +if (IS_EXTENDED (port) && (status &STAT_BRK_ERR )) { + ret =readl (port->membase +UART_STAT ); + ret |=STAT_BRK_ERR ; +writel (ret, port->membase +UART_STAT ); + } +if (status &STAT_BRK_DET ) { port->icount.brk++; status &= ~(STAT_FRM_ERR |STAT_PAR_ERR );
Greg Kroah-Hartman
maintainerPATCH 30/287 md-raid10: fix KASAN warning
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
commit d17f744e883b2f8d13cca252d71cfe8ace346f7d upstream.
There's a KASAN warning in raid10_remove_disk when running the lvm test lvconvert-raid-reshape.sh. We fix this warning by verifying that the value "number" is valid.
BUG: KASAN: slab-out-of-bounds in raid10_remove_disk+0x61/0x2a0 [raid10] Read of size 8 at addr ffff889108f3d300 by task mdX_raid10/124682 CPU: 3 PID: 124682 Comm: mdX_raid10 Not tainted 5.19.0-rc6 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x34/0x44 print_report.cold+0x45/0x57a ? __lock_text_start+0x18/0x18 ? raid10_remove_disk+0x61/0x2a0 [raid10] kasan_report+0xa8/0xe0 ? raid10_remove_disk+0x61/0x2a0 [raid10] raid10_remove_disk+0x61/0x2a0 [raid10] Buffer I/O error on dev dm-76, logical block 15344, async page read ? __mutex_unlock_slowpath.constprop.0+0x1e0/0x1e0 remove_and_add_spares+0x367/0x8a0 [md_mod] ? super_written+0x1c0/0x1c0 [md_mod] ? mutex_trylock+0xac/0x120 ? _raw_spin_lock+0x72/0xc0 ? _raw_spin_lock_bh+0xc0/0xc0 md_check_recovery+0x848/0x960 [md_mod] raid10d+0xcf/0x3360 [raid10] ? sched_clock_cpu+0x185/0x1a0 ? rb_erase+0x4d4/0x620 ? var_wake_function+0xe0/0xe0 ? psi_group_change+0x411/0x500 ? preempt_count_sub+0xf/0xc0 ? _raw_spin_lock_irqsave+0x78/0xc0 ? __lock_text_start+0x18/0x18 ? raid10_sync_request+0x36c0/0x36c0 [raid10] ? preempt_count_sub+0xf/0xc0 ? _raw_spin_unlock_irqrestore+0x19/0x40 ? del_timer_sync+0xa9/0x100 ? try_to_del_timer_sync+0xc0/0xc0 ? _raw_spin_lock_irqsave+0x78/0xc0 ? __lock_text_start+0x18/0x18 ? _raw_spin_unlock_irq+0x11/0x24 ? __list_del_entry_valid+0x68/0xa0 ? finish_wait+0xa3/0x100 md_thread+0x161/0x260 [md_mod] ? unregister_md_personality+0xa0/0xa0 [md_mod] ? _raw_spin_lock_irqsave+0x78/0xc0 ? prepare_to_wait_event+0x2c0/0x2c0 ? unregister_md_personality+0xa0/0xa0 [md_mod] kthread+0x148/0x180 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30 </TASK> Allocated by task 124495: kasan_save_stack+0x1e/0x40 __kasan_kmalloc+0x80/0xa0 setup_conf+0x140/0x5c0 [raid10] raid10_run+0x4cd/0x740 [raid10] md_run+0x6f9/0x1300 [md_mod] raid_ctr+0x2531/0x4ac0 [dm_raid] dm_table_add_target+0x2b0/0x620 [dm_mod] table_load+0x1c8/0x400 [dm_mod] ctl_ioctl+0x29e/0x560 [dm_mod] dm_compat_ctl_ioctl+0x7/0x20 [dm_mod] __do_compat_sys_ioctl+0xfa/0x160 do_syscall_64+0x90/0xc0 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Last potentially related work creation: kasan_save_stack+0x1e/0x40 __kasan_record_aux_stack+0x9e/0xc0 kvfree_call_rcu+0x84/0x480 timerfd_release+0x82/0x140 L __fput+0xfa/0x400 task_work_run+0x80/0xc0 exit_to_user_mode_prepare+0x155/0x160 syscall_exit_to_user_mode+0x12/0x40 do_syscall_64+0x42/0xc0 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Second to last potentially related work creation: kasan_save_stack+0x1e/0x40 __kasan_record_aux_stack+0x9e/0xc0 kvfree_call_rcu+0x84/0x480 timerfd_release+0x82/0x140 __fput+0xfa/0x400 task_work_run+0x80/0xc0 exit_to_user_mode_prepare+0x155/0x160 syscall_exit_to_user_mode+0x12/0x40 do_syscall_64+0x42/0xc0 entry_SYSCALL_64_after_hwframe+0x46/0xb0 The buggy address belongs to the object at ffff889108f3d200 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 0 bytes to the right of
256-byte region [ffff889108f3d200, ffff889108f3d300)
The buggy address belongs to the physical page:
page:000000007ef2a34c refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1108f3c
head:000000007ef2a34c order:2 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=2)
raw: 4000000000010200 0000000000000000 dead000000000001 ffff889100042b40
raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff889108f3d200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff889108f3d280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff889108f3d300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff889108f3d380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff889108f3d400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00--- drivers/md/raid10.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/md/raid10.c +4 -1
@@ -1863,9 +1863,12 @@ static int raid10_remove_disk(struct mddint err =0 ;int number = rdev->raid_disk;struct md_rdev **rdevp; -struct raid10_info *p = conf->mirrors + number; +struct raid10_info *p;print_conf (conf); +if (unlikely (number >= mddev->raid_disks)) +return 0 ; + p = conf->mirrors + number;if (rdev == p->rdev) rdevp = &p->rdev;else if (rdev == p->replacement)
Greg Kroah-Hartman
maintainerPATCH 31/287 ia64, processor: fix -Wincompatible-pointer-types in ia64_get_irr()
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
commit e5a16a5c4602c119262f350274021f90465f479d upstream.
test_bit(), as any other bitmap op, takes unsigned long * as a second argument (pointer to the actual bitmap), as any bitmap itself is an array of unsigned longs. However, the ia64_get_irr() code passes a ref to u64 as a second argument.
This works with the ia64 bitops implementation due to that they have void * as the second argument and then cast it later on. This works with the bitmap API itself due to that unsigned long has the same size on ia64 as u64 (unsigned long long), but from the compiler PoV those two are different.
Define @irr as unsigned long to fix that. That implies no functional changes. Has been hidden for 16 years!
--- arch/ia64/include/asm/processor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/ia64/include/asm/processor.h +1 -1
@@ -552,7 +552,7 @@ ia64_get_irr(unsigned int vector) {unsigned int reg = vector /64 ;unsigned int bit = vector %64 ; -u64 irr; +unsigned long irr;switch (reg) {case 0 : irr =ia64_getreg (_IA64_REG_CR_IRR0);break ;
Greg Kroah-Hartman
maintainerPATCH 32/287 PCI: Add defines for normal and subtractive PCI bridges
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 904b10fb189cc15376e9bfce1ef0282e68b0b004 upstream.
Add these PCI class codes to pci_ids.h:
PCI_CLASS_BRIDGE_PCI_NORMAL
PCI_CLASS_BRIDGE_PCI_SUBTRACTIVE
Use these defines in all kernel code for describing PCI class codes for normal and subtractive PCI bridges.
--- include/linux/pci_ids.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/pci_ids.h +2 -0
@@ -59,6 +59,8 @@#define PCI_CLASS_BRIDGE_EISA 0x0602#define PCI_CLASS_BRIDGE_MC 0x0603#define PCI_CLASS_BRIDGE_PCI 0x0604 +#define PCI_CLASS_BRIDGE_PCI_NORMAL 0x060400 +#define PCI_CLASS_BRIDGE_PCI_SUBTRACTIVE 0x060401#define PCI_CLASS_BRIDGE_PCMCIA 0x0605#define PCI_CLASS_BRIDGE_NUBUS 0x0606#define PCI_CLASS_BRIDGE_CARDBUS 0x0607
Greg Kroah-Hartman
maintainerPATCH 33/287 powerpc/fsl-pci: Fix Class Code of PCIe Root Port
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 0c551abfa004ce154d487d91777bf221c808a64f upstream.
By default old pre-3.0 Freescale PCIe controllers reports invalid PCI Class Code 0x0b20 for PCIe Root Port. It can be seen by lspci -b output on P2020 board which has this pre-3.0 controller:
$ lspci -bvnn
00:00.0 Power PC [0b20]: Freescale Semiconductor Inc P2020E [1957:0070] (rev 21)
!!! Invalid class 0b20 for header type 01
Capabilities: [4c] Express Root Port (Slot-), MSI 00Fix this issue by programming correct PCI Class Code 0x0604 for PCIe Root Port to the Freescale specific PCIe register 0x474.
With this change lspci -b output is:
$ lspci -bvnn
00:00.0 PCI bridge [0604]: Freescale Semiconductor Inc P2020E [1957:0070] (rev 21) (prog-if 00 [Normal decode])
Capabilities: [4c] Express Root Port (Slot-), MSI 00Without any "Invalid class" error. So class code was properly reflected into standard (read-only) PCI register 0x08.
Same fix is already implemented in U-Boot pcie_fsl.c driver in commit:
http://source.denx.de/u-boot/u-boot/-/commit/d18d06ac35229345a0af80977a408cfbe1d1015b
Fix activated by U-Boot stay active also after booting Linux kernel. But boards which use older U-Boot version without that fix are affected and still require this fix.
So implement this class code fix also in kernel fsl_pci.c driver.
--- arch/powerpc/sysdev/fsl_pci.c | 8 ++++++++ arch/powerpc/sysdev/fsl_pci.h | 1 + 2 files changed, 9 insertions(+)
arch/powerpc/sysdev/fsl_pci.c +8 -0
@@ -523,6 +523,7 @@ int fsl_add_bridge(struct platform_devicstruct resource rsrc;const int *bus_range;u8 hdr_type, progif; +u32 class_code;struct device_node *dev;struct ccsr_pci __iomem *pci;u16 temp;
@@ -596,6 +597,13 @@ int fsl_add_bridge(struct platform_devicPPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS ;if (fsl_pcie_check_link (hose)) hose->indirect_type |=PPC_INDIRECT_TYPE_NO_PCIE_LINK ; +/* Fix Class Code to PCI_CLASS_BRIDGE_PCI_NORMAL for pre-3.0 controller */ +if (in_be32 (&pci->block_rev1) <PCIE_IP_REV_3_0 ) { +early_read_config_dword (hose,0 ,0 ,PCIE_FSL_CSR_CLASSCODE , &class_code); + class_code &=0xff ; + class_code |=PCI_CLASS_BRIDGE_PCI_NORMAL <<8 ; +early_write_config_dword (hose,0 ,0 ,PCIE_FSL_CSR_CLASSCODE , class_code); + } }else {/* * Set PBFR(PCI Bus Function Register)[10] = 1 to
arch/powerpc/sysdev/fsl_pci.h +1 -0
@@ -23,6 +23,7 @@ struct platform_device;#define PCIE_LTSSM 0x0404/* PCIE Link Training and Status */ #define PCIE_LTSSM_L0 0x16/* L0 state */ +#define PCIE_FSL_CSR_CLASSCODE 0x474/* FSL GPEX CSR */ #define PCIE_IP_REV_2_2 0x02080202/* PCIE IP block version Rev2.2 */ #define PCIE_IP_REV_3_0 0x02080300/* PCIE IP block version Rev3.0 */ #define PIWAR_EN 0x80000000/* Enable */
Greg Kroah-Hartman
maintainerPATCH 34/287 powerpc/powernv: Avoid crashing if rng is NULL
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
commit 90b5d4fe0b3ba7f589c6723c6bfb559d9e83956a upstream.
On a bare-metal Power8 system that doesn't have an "ibm,power-rng", a malicious QEMU and guest that ignore the absence of the KVM_CAP_PPC_HWRNG flag, and calls H_RANDOM anyway, will dereference a NULL pointer.
In practice all Power8 machines have an "ibm,power-rng", but let's not rely on that, add a NULL check and early return in powernv_get_random_real_mode().
--- arch/powerpc/platforms/powernv/rng.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/platforms/powernv/rng.c +2 -0
@@ -67,6 +67,8 @@ int powernv_get_random_real_mode(unsignestruct powernv_rng *rng; rng =raw_cpu_read (powernv_rng); +if (!rng) +return 0 ; *v =rng_whiten (rng,__raw_rm_readq (rng->regs_real));
Greg Kroah-Hartman
maintainerPATCH 35/287 MIPS: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK
In reply to Greg Kroah-HartmanFrom: Huacai Chen <[email protected]>
commit e1a534f5d074db45ae5cbac41d8912b98e96a006 upstream.
When CONFIG_CPUMASK_OFFSTACK and CONFIG_DEBUG_PER_CPU_MAPS is selected, cpu_max_bits_warn() generates a runtime warning similar as below while we show /proc/cpuinfo. Fix this by using nr_cpu_ids (the runtime limit) instead of NR_CPUS to iterate CPUs.
[ 3.052463] ------------[ cut here ]------------ [ 3.059679] WARNING: CPU: 3 PID: 1 at include/linux/cpumask.h:108 show_cpuinfo+0x5e8/0x5f0 [ 3.070072] Modules linked in: efivarfs autofs4 [ 3.076257] CPU: 0 PID: 1 Comm: systemd Not tainted 5.19-rc5+ #1052 [ 3.084034] Hardware name: Loongson Loongson-3A4000-7A1000-1w-V0.1-CRB/Loongson-LS3A4000-7A1000-1w-EVB-V1.21, BIOS Loongson-UDK2018-V2.0.04082-beta7 04/27 [ 3.099465] Stack : 9000000100157b08 9000000000f18530 9000000000cf846c 9000000100154000 [ 3.109127] 9000000100157a50 0000000000000000 9000000100157a58 9000000000ef7430 [ 3.118774] 90000001001578e8 0000000000000040 0000000000000020 ffffffffffffffff [ 3.128412] 0000000000aaaaaa 1ab25f00eec96a37 900000010021de80 900000000101c890 [ 3.138056] 0000000000000000 0000000000000000 0000000000000000 0000000000aaaaaa [ 3.147711] ffff8000339dc220 0000000000000001 0000000006ab4000 0000000000000000 [ 3.157364] 900000000101c998 0000000000000004 9000000000ef7430 0000000000000000 [ 3.167012] 0000000000000009 000000000000006c 0000000000000000 0000000000000000 [ 3.176641] 9000000000d3de08 9000000001639390 90000000002086d8 00007ffff0080286 [ 3.186260] 00000000000000b0 0000000000000004 0000000000000000 0000000000071c1c [ 3.195868] ... [ 3.199917] Call Trace: [ 3.203941] [<98000000002086d8>] show_stack+0x38/0x14c [ 3.210666] [<9800000000cf846c>] dump_stack_lvl+0x60/0x88 [ 3.217625] [<980000000023d268>] __warn+0xd0/0x100 [ 3.223958] [<9800000000cf3c90>] warn_slowpath_fmt+0x7c/0xcc [ 3.231150] [<9800000000210220>] show_cpuinfo+0x5e8/0x5f0 [ 3.238080] [<98000000004f578c>] seq_read_iter+0x354/0x4b4 [ 3.245098] [<98000000004c2e90>] new_sync_read+0x17c/0x1c4 [ 3.252114] [<98000000004c5174>] vfs_read+0x138/0x1d0 [ 3.258694] [<98000000004c55f8>] ksys_read+0x70/0x100 [ 3.265265] [<9800000000cfde9c>] do_syscall+0x7c/0x94 [ 3.271820] [<9800000000202fe4>] handle_syscall+0xc4/0x160 [ 3.281824] ---[ end trace 8b484262b4b8c24c ]---
--- arch/mips/kernel/proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/kernel/proc.c +1 -1
@@ -168,7 +168,7 @@ static void *c_start(struct seq_file *m, {unsigned long i = *pos; -return i <NR_CPUS ? (void *) (i +1 ) :NULL ; +return i < nr_cpu_ids ? (void *) (i +1 ) :NULL ; }static void *c_next (struct seq_file *m,void *v,loff_t *pos)
Greg Kroah-Hartman
maintainerPATCH 36/287 USB: HCD: Fix URB giveback issue in tasklet function
In reply to Greg Kroah-HartmanFrom: Weitao Wang <[email protected]>
commit 26c6c2f8a907c9e3a2f24990552a4d77235791e6 upstream.
Usb core introduce the mechanism of giveback of URB in tasklet context to reduce hardware interrupt handling time. On some test situation(such as FIO with 4KB block size), when tasklet callback function called to giveback URB, interrupt handler add URB node to the bh->head list also. If check bh->head list again after finish all URB giveback of local_list, then it may introduce a "dynamic balance" between giveback URB and add URB to bh->head list. This tasklet callback function may not exit for a long time, which will cause other tasklet function calls to be delayed. Some real-time applications(such as KB and Mouse) will see noticeable lag.
In order to prevent the tasklet function from occupying the cpu for a long time at a time, new URBS will not be added to the local_list even though the bh->head list is not empty. But also need to ensure the left URB giveback to be processed in time, so add a member high_prio for structure giveback_urb_bh to prioritize tasklet and schelule this tasklet again if bh->head list is not empty.
At the same time, we are able to prioritize tasklet through structure member high_prio. So, replace the local high_prio_bh variable with this structure member in usb_hcd_giveback_urb.
--- drivers/usb/core/hcd.c | 26 +++++++++++++++----------- include/linux/usb/hcd.h | 1 + 2 files changed, 16 insertions(+), 11 deletions(-)
drivers/usb/core/hcd.c +15 -11
@@ -1805,7 +1805,6 @@ static void usb_giveback_urb_bh(unsignedspin_lock_irq (&bh->lock); bh->running = true; - restart:list_replace_init (&bh->head, &local_list);spin_unlock_irq (&bh->lock);
@@ -1819,10 +1818,17 @@ static void usb_giveback_urb_bh(unsigned bh->completing_ep =NULL ; } -/* check if there are new URBs to giveback */ +/* +* giveback new URBs next time to prevent this function +* from not exiting for a long time. +*/ spin_lock_irq (&bh->lock); -if (!list_empty (&bh->head)) - goto restart; +if (!list_empty (&bh->head)) { +if (bh->high_prio) +tasklet_hi_schedule (&bh->bh); +else +tasklet_schedule (&bh->bh); + } bh->running = false;spin_unlock_irq (&bh->lock); }
@@ -1847,7 +1853,7 @@ static void usb_giveback_urb_bh(unsignedvoid usb_hcd_giveback_urb (struct usb_hcd *hcd,struct urb *urb,int status) {struct giveback_urb_bh *bh; -bool running, high_prio_bh; +bool running;/* pass status to tasklet via unlinked */ if (likely (!urb->unlinked))
@@ -1858,13 +1864,10 @@ void usb_hcd_giveback_urb(struct usb_hcdreturn ; } -if (usb_pipeisoc (urb->pipe) ||usb_pipeint (urb->pipe)) { +if (usb_pipeisoc (urb->pipe) ||usb_pipeint (urb->pipe)) bh = &hcd->high_prio_bh; - high_prio_bh = true; - }else { +else bh = &hcd->low_prio_bh; - high_prio_bh = false; - }spin_lock (&bh->lock);list_add_tail (&urb->urb_list, &bh->head);
@@ -1873,7 +1876,7 @@ void usb_hcd_giveback_urb(struct usb_hcdif (running) ; -else if (high_prio_bh) +else if (bh->high_prio)tasklet_hi_schedule (&bh->bh);else tasklet_schedule (&bh->bh);
@@ -2881,6 +2884,7 @@ int usb_add_hcd(struct usb_hcd *hcd,/* initialize tasklets */ init_giveback_urb_bh (&hcd->high_prio_bh); + hcd->high_prio_bh.high_prio = true;init_giveback_urb_bh (&hcd->low_prio_bh);/* enable irqs just before we start the controller,
include/linux/usb/hcd.h +1 -0
@@ -66,6 +66,7 @@struct giveback_urb_bh {bool running; +bool high_prio;spinlock_t lock;struct list_head head;struct tasklet_struct bh;
Greg Kroah-Hartman
maintainerPATCH 37/287 netfilter: nf_tables: do not allow SET_ID to refer to another table
In reply to Greg Kroah-HartmanFrom: Thadeu Lima de Souza Cascardo <[email protected]>
commit 470ee20e069a6d05ae549f7d0ef2bdbcee6a81b2 upstream.
When doing lookups for sets on the same batch by using its ID, a set from a different table can be used.
Then, when the table is removed, a reference to the set may be kept after the set is freed, leading to a potential use-after-free.
When looking for sets by ID, use the table that was used for the lookup by name, and only return sets belonging to that same table.
This fixes CVE-2022-2586, also reported as ZDI-CAN-17470.
--- net/netfilter/nf_tables_api.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +3 -1
@@ -3039,6 +3039,7 @@ static struct nft_set *nft_set_lookup_by }static struct nft_set *nft_set_lookup_byid (const struct net *net, +const struct nft_table *table,const struct nlattr *nla,u8 genmask) {struct nft_trans *trans;
@@ -3049,6 +3050,7 @@ static struct nft_set *nft_set_lookup_bystruct nft_set *set =nft_trans_set (trans);if (id ==nft_trans_set_id (trans) && + set->table == table &&nft_active_genmask (set, genmask))return set; }
@@ -3069,7 +3071,7 @@ struct nft_set *nft_set_lookup_global(coif (!nla_set_id)return set; - set =nft_set_lookup_byid (net, nla_set_id, genmask); + set =nft_set_lookup_byid (net, table, nla_set_id, genmask); }return set; }
Greg Kroah-Hartman
maintainerPATCH 38/287 netfilter: nf_tables: fix null deref due to zeroed list head
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
commit 580077855a40741cf511766129702d97ff02f4d9 upstream.
In nf_tables_updtable, if nf_tables_table_enable returns an error, nft_trans_destroy is called to free the transaction object.
nft_trans_destroy() calls list_del(), but the transaction was never placed on a list -- the list head is all zeroes, this results in a null dereference:
BUG: KASAN: null-ptr-deref in nft_trans_destroy+0x26/0x59 Call Trace: nft_trans_destroy+0x26/0x59 nf_tables_newtable+0x4bc/0x9bc [..]
Its sane to assume that nft_trans_destroy() can be called on the transaction object returned by nft_trans_alloc(), so make sure the list head is initialised.
--- net/netfilter/nf_tables_api.c | 1 + 1 file changed, 1 insertion(+)
net/netfilter/nf_tables_api.c +1 -0
@@ -96,6 +96,7 @@ static struct nft_trans *nft_trans_allocif (trans ==NULL )return NULL ; +INIT_LIST_HEAD (&trans->list); trans->msg_type = msg_type; trans->ctx = *ctx;
Greg Kroah-Hartman
maintainerPATCH 39/287 arm64: Do not forget syscall when starting a new thread.
In reply to Greg Kroah-HartmanFrom: Francis Laniel <[email protected]>
[ Upstream commit de6921856f99c11d3986c6702d851e1328d4f7f6 ]
Enable tracing of the execve*() system calls with the syscalls:sys_exit_execve tracepoint by removing the call to forget_syscall() when starting a new thread and preserving the value of regs->syscallno across exec.
--- arch/arm64/include/asm/processor.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/include/asm/processor.h +2 -1
@@ -172,8 +172,9 @@ void tls_preserve_current_state(void);static inline void start_thread_common (struct pt_regs *regs,unsigned long pc) { +s32 previous_syscall = regs->syscallno;memset (regs,0 ,sizeof (*regs)); -forget_syscall (regs); + regs->syscallno = previous_syscall; regs->pc = pc; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 40/287 arm64: fix oops in concurrently setting insn_emulation sysctls
In reply to Greg Kroah-HartmanFrom: haibinzhang (张海斌) <[email protected]>
[ Upstream commit af483947d472eccb79e42059276c4deed76f99a6 ]
emulation_proc_handler() changes table->data for proc_dointvec_minmax and can generate the following Oops if called concurrently with itself:
| Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010 | Internal error: Oops: 96000006 [#1] SMP | Call trace: | update_insn_emulation_mode+0xc0/0x148 | emulation_proc_handler+0x64/0xb8 | proc_sys_call_handler+0x9c/0xf8 | proc_sys_write+0x18/0x20 | __vfs_write+0x20/0x48 | vfs_write+0xe4/0x1d0 | ksys_write+0x70/0xf8 | __arm64_sys_write+0x20/0x28 | el0_svc_common.constprop.0+0x7c/0x1c0 | el0_svc_handler+0x2c/0xa0 | el0_svc+0x8/0x200
To fix this issue, keep the table->data as &insn->current_mode and use container_of() to retrieve the insn pointer. Another mutex is used to protect against the current_mode update but not for retrieving insn_emulation as table->data is no longer changing.
--- arch/arm64/kernel/armv8_deprecated.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
arch/arm64/kernel/armv8_deprecated.c +5 -4
@@ -62,6 +62,7 @@ struct insn_emulation {static LIST_HEAD (insn_emulation);static int nr_insn_emulated__initdata ;static DEFINE_RAW_SPINLOCK (insn_emulation_lock); +static DEFINE_MUTEX (insn_emulation_mutex);static void register_emulation_hooks (struct insn_emulation_ops *ops) {
@@ -210,10 +211,10 @@ static int emulation_proc_handler(struct ctl_table *table, int write, loff_t *ppos) {int ret =0 ; -struct insn_emulation *insn = (struct insn_emulation *) table->data; + struct insn_emulation *insn = container_of(table->data, struct insn_emulation, current_mode);enum insn_emulation_mode prev_mode = insn->current_mode; - table->data = &insn->current_mode; +mutex_lock (&insn_emulation_mutex); ret =proc_dointvec_minmax (table, write, buffer, lenp, ppos);if (ret || !write || prev_mode == insn->current_mode)
@@ -226,7 +227,7 @@ static int emulation_proc_handler(struct ctl_table *table, int write,update_insn_emulation_mode (insn,INSN_UNDEF ); } ret: - table->data = insn; +mutex_unlock (&insn_emulation_mutex);return ret; }
@@ -250,7 +251,7 @@ static void __init register_insn_emulation_sysctl(void) sysctl->maxlen =sizeof (int ); sysctl->procname = insn->ops->name; - sysctl->data = insn; + sysctl->data = &insn->current_mode; sysctl->extra1 = &insn->min; sysctl->extra2 = &insn->max; sysctl->proc_handler = emulation_proc_handler;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 41/287 ext2: Add more validity checks for inode counts
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit fa78f336937240d1bc598db817d638086060e7e9 ]
Add checks verifying number of inodes stored in the superblock matches the number computed from number of inodes per group. Also verify we have at least one block worth of inodes per group. This prevents crashes on corrupted filesystems.
--- fs/ext2/super.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
fs/ext2/super.c +10 -2
@@ -1088,9 +1088,10 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) sbi->s_frags_per_group); goto failed_mount; } -if (sbi->s_inodes_per_group > sb->s_blocksize *8 ) { +if (sbi->s_inodes_per_group < sbi->s_inodes_per_block || + sbi->s_inodes_per_group > sb->s_blocksize *8 ) {ext2_msg (sb,KERN_ERR , -"error: #inodes per group too big: %lu" , +"error: invalid #inodes per group: %lu" , sbi->s_inodes_per_group); goto failed_mount; }
@@ -1100,6 +1101,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) sbi->s_groups_count = ((le32_to_cpu (es->s_blocks_count) -le32_to_cpu (es->s_first_data_block) -1 ) /EXT2_BLOCKS_PER_GROUP (sb)) +1 ; +if ((u64 )sbi->s_groups_count * sbi->s_inodes_per_group != +le32_to_cpu (es->s_inodes_count)) { +ext2_msg (sb,KERN_ERR ,"error: invalid #inodes: %u vs computed %llu" , +le32_to_cpu (es->s_inodes_count), + (u64 )sbi->s_groups_count * sbi->s_inodes_per_group); + goto failed_mount; + } db_count = (sbi->s_groups_count +EXT2_DESC_PER_BLOCK (sb) -1 ) /EXT2_DESC_PER_BLOCK (sb); sbi->s_group_desc = kmalloc_array (db_count,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 42/287 ARM: dts: imx6ul: add missing properties for sram
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit 5655699cf5cff9f4c4ee703792156bdd05d1addf ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6ul.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx6ul.dtsi +3 -0
@@ -169,6 +169,9 @@ soc { ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; }; dma_apbh: dma-apbh@1804000 {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 43/287 ARM: dts: imx6ul: change operating-points to uint32-matrix
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit edb67843983bbdf61b4c8c3c50618003d38bb4ae ]
operating-points is a uint32-matrix as per opp-v1.yaml. Change it accordingly. While at it, change fsl,soc-operating-points as well, although there is no bindings file (yet). But they should have the same format. Fixes the dt_binding_check warning:
cpu@0: operating-points:0: [696000, 1275000, 528000, 1175000, 396000, 1025000, 198000, 950000] is too long
cpu@0: operating-points:0: Additional items are not allowed (528000, 1175000, 396000, 1025000, 198000, 950000 were unexpected)
--- arch/arm/boot/dts/imx6ul.dtsi | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
arch/arm/boot/dts/imx6ul.dtsi +10 -12
@@ -61,20 +61,18 @@ cpu0: cpu@0 { reg = <0>; clock-latency = <61036>; /* two CLK32 periods */ #cooling-cells = <2>; - operating-points = < + operating-points = /* kHz uV */ - 696000 1275000 - 528000 1175000 - 396000 1025000 - 198000 950000 - >; - fsl,soc-operating-points = < + <696000 1275000>, + <528000 1175000>, + <396000 1025000>, + <198000 950000>; + fsl,soc-operating-points = /* KHz uV */ - 696000 1275000 - 528000 1175000 - 396000 1175000 - 198000 1175000 - >; + <696000 1275000>, + <528000 1175000>, + <396000 1175000>, + <198000 1175000>; clocks = <&clks IMX6UL_CLK_ARM>, <&clks IMX6UL_CLK_PLL2_BUS>, <&clks IMX6UL_CLK_PLL2_PFD2>,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 44/287 ARM: dts: imx6ul: fix lcdif node compatible
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit 1a884d17ca324531634cce82e9f64c0302bdf7de ]
In yaml binding "fsl,imx6ul-lcdif" is listed as compatible to imx6sx-lcdif, but not imx28-lcdif. Change the list accordingly. Fixes the dt_binding_check warning:
lcdif@21c8000: compatible: 'oneOf' conditional failed, one must be fixed:
['fsl,imx6ul-lcdif', 'fsl,imx28-lcdif'] is too long
Additional items are not allowed ('fsl,imx28-lcdif' was unexpected) 'fsl,imx6ul-lcdif' is not one of ['fsl,imx23-lcdif', 'fsl,imx28-lcdif', 'fsl,imx6sx-lcdif']
'fsl,imx6sx-lcdif' was expected
--- arch/arm/boot/dts/imx6ul.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx6ul.dtsi +1 -1
@@ -940,7 +940,7 @@ cpu_speed_grade: speed-grade@10 { }; lcdif: lcdif@21c8000 { - compatible = "fsl,imx6ul-lcdif", "fsl,imx28-lcdif"; + compatible = "fsl,imx6ul-lcdif", "fsl,imx6sx-lcdif"; reg = <0x021c8000 0x4000>; interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6UL_CLK_LCDIF_PIX>,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 45/287 ARM: dts: imx6ul: fix qspi node compatible
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit 0c6cf86e1ab433b2d421880fdd9c6e954f404948 ]
imx6ul is not compatible to imx6sx, both have different erratas. Fixes the dt_binding_check warning:
spi@21e0000: compatible: 'oneOf' conditional failed, one must be fixed:
['fsl,imx6ul-qspi', 'fsl,imx6sx-qspi'] is too long Additional items are not allowed ('fsl,imx6sx-qspi' was unexpected) 'fsl,imx6ul-qspi' is not one of ['fsl,ls1043a-qspi'] 'fsl,imx6ul-qspi' is not one of ['fsl,imx8mq-qspi'] 'fsl,ls1021a-qspi' was expected
'fsl,imx7d-qspi' was expected
--- arch/arm/boot/dts/imx6ul.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx6ul.dtsi +1 -1
@@ -953,7 +953,7 @@ lcdif: lcdif@21c8000 { qspi: qspi@21e0000 { #address-cells = <1>; #size-cells = <0>; - compatible = "fsl,imx6ul-qspi", "fsl,imx6sx-qspi"; + compatible = "fsl,imx6ul-qspi"; reg = <0x021e0000 0x4000>, <0x60000000 0x10000000>; reg-names = "QuadSPI", "QuadSPI-memory"; interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 46/287 ARM: OMAP2+: display: Fix refcount leak bug
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 50b87a32a79bca6e275918a711fb8cc55e16d739 ]
In omapdss_init_fbdev(), of_find_node_by_name() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore.
Message-Id: <[email protected]>
--- arch/arm/mach-omap2/display.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-omap2/display.c +1 -0
@@ -211,6 +211,7 @@ static int __init omapdss_init_fbdev(void) node =of_find_node_by_name (NULL ,"omap4_padconf_global" );if (node) omap4_dsi_mux_syscon =syscon_node_to_regmap (node); +of_node_put (node);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 47/287 ACPI: EC: Remove duplicate ThinkPad X1 Carbon 6th entry from DMI quirks
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 0dd6db359e5f206cbf1dd1fd40dd211588cd2725 ]
Somehow the "ThinkPad X1 Carbon 6th" entry ended up twice in the struct dmi_system_id acpi_ec_no_wakeup[] array. Remove one of the entries.
--- drivers/acpi/ec.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/acpi/ec.c +0 -7
@@ -2118,13 +2118,6 @@ static const struct dmi_system_id acpi_ec_no_wakeup[] = { DMI_MATCH(DMI_PRODUCT_FAMILY, "Thinkpad X1 Carbon 6th"), }, }, - { - .ident = "ThinkPad X1 Carbon 6th", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), - DMI_MATCH(DMI_PRODUCT_FAMILY, "ThinkPad X1 Carbon 6th"), - }, - }, { .ident = "ThinkPad X1 Yoga 3rd", .matches = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 48/287 ACPI: PM: save NVS memory for Lenovo G40-45
In reply to Greg Kroah-HartmanFrom: Manyi Li <[email protected]>
[ Upstream commit 4b7ef7b05afcde44142225c184bf43a0cd9e2178 ]
[821d6f0359b0614792ab8e2fb93b503e25a65079] is to make machines produced from 2012 to now not saving NVS region to accelerate S3.
But, Lenovo G40-45, a platform released in 2015, still needs NVS memory saving during S3. A quirk is introduced for this platform.
--- drivers/acpi/sleep.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/acpi/sleep.c +8 -0
@@ -359,6 +359,14 @@ static const struct dmi_system_id acpisleep_dmi_table[] __initconst = { DMI_MATCH(DMI_PRODUCT_NAME, "80E3"), }, }, + { + .callback = init_nvs_save_s3, + .ident = "Lenovo G40-45", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "80E1"), + }, + },/* * https://bugzilla.kernel.org/show_bug.cgi?id=196907 * Some Dell XPS13 9360 cannot do suspend-to-idle using the Low Power
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 49/287 ACPI: LPSS: Fix missing check in register_device_clock()
In reply to Greg Kroah-HartmanFrom: huhai <[email protected]>
[ Upstream commit b4f1f61ed5928b1128e60e38d0dffa16966f06dc ]
register_device_clock() misses a check for platform_device_register_simple(). Add a check to fix it.
--- drivers/acpi/acpi_lpss.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/acpi/acpi_lpss.c +3 -0
@@ -401,6 +401,9 @@ static int register_device_clock(struct acpi_device *adev,if (!lpss_clk_dev)lpt_register_clock_device (); +if (IS_ERR (lpss_clk_dev)) +return PTR_ERR (lpss_clk_dev); + clk_data =platform_get_drvdata (lpss_clk_dev);if (!clk_data)return -ENODEV ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 50/287 arm64: dts: qcom: ipq8074: fix NAND node name
In reply to Greg Kroah-HartmanFrom: Robert Marko <[email protected]>
[ Upstream commit b39961659ffc3c3a9e3d0d43b0476547b5f35d49 ]
Per schema it should be nand-controller@79b0000 instead of nand@79b0000. Fix it to match nand-controller.yaml requirements.
--- arch/arm64/boot/dts/qcom/ipq8074.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/ipq8074.dtsi +1 -1
@@ -261,7 +261,7 @@ qpic_bam: dma@7984000 { status = "disabled"; }; - qpic_nand: nand@79b0000 { + qpic_nand: nand-controller@79b0000 { compatible = "qcom,ipq8074-nand"; reg = <0x79b0000 0x10000>; #address-cells = <1>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 51/287 PM: hibernate: defer device probing when resuming from hibernation
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit 8386c414e27caba8501119948e9551e52b527f59 ]
syzbot is reporting hung task at misc_open() [1], for there is a race window of AB-BA deadlock which involves probe_count variable. Currently wait_for_device_probe() from snapshot_open() from misc_open() can sleep forever with misc_mtx held if probe_count cannot become 0.
When a device is probed by hub_event() work function, probe_count is incremented before the probe function starts, and probe_count is decremented after the probe function completed.
There are three cases that can prevent probe_count from dropping to 0.
(a) A device being probed stopped responding (i.e. broken/malicious hardware).
(b) A process emulating a USB device using /dev/raw-gadget interface stopped responding for some reason.
(c) New device probe requests keeps coming in before existing device probe requests complete.
The phenomenon syzbot is reporting is (b). A process which is holding system_transition_mutex and misc_mtx is waiting for probe_count to become 0 inside wait_for_device_probe(), but the probe function which is called
from hub_event() work function is waiting for the processes which are
blocked at mutex_lock(&misc_mtx) to respond via /dev/raw-gadget interface.
This patch mitigates (b) by deferring wait_for_device_probe() from snapshot_open() to snapshot_write() and snapshot_ioctl(). Please note that the possibility of (b) remains as long as any thread which is emulating a USB device via /dev/raw-gadget interface can be blocked by uninterruptible blocking operations (e.g. mutex_lock()).
Please also note that (a) and (c) are not addressed. Regarding (c), we should change the code to wait for only one device which contains the image for resuming from hibernation. I don't know how to address (a), for use of timeout for wait_for_device_probe() might result in loss of user data in the image. Maybe we should require the userland to wait for the image device before opening /dev/snapshot interface.
--- kernel/power/user.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
kernel/power/user.c +12 -1
@@ -29,6 +29,7 @@#include "power.h" +static bool need_wait;#define SNAPSHOT_MINOR 231
@@ -82,7 +83,7 @@ static int snapshot_open(struct inode *inode, struct file *filp)* Resuming. We may need to wait for the image device to * appear. */ -wait_for_device_probe (); + need_wait = true; data->swap =-1 ; data->mode =O_WRONLY ;
@@ -174,6 +175,11 @@ static ssize_t snapshot_write(struct file *filp, const char __user *buf,ssize_t res;loff_t pg_offp = *offp & ~PAGE_MASK ; +if (need_wait) { +wait_for_device_probe (); + need_wait = false; + } +lock_system_sleep (); data = filp->private_data;
@@ -209,6 +215,11 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,loff_t size;sector_t offset; +if (need_wait) { +wait_for_device_probe (); + need_wait = false; + } +if (_IOC_TYPE (cmd) !=SNAPSHOT_IOC_MAGIC )return -ENOTTY ;if (_IOC_NR (cmd) >SNAPSHOT_IOC_MAXNR )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 52/287 selinux: Add boundary check in put_entry()
In reply to Greg Kroah-HartmanFrom: Xiu Jianfeng <[email protected]>
[ Upstream commit 15ec76fb29be31df2bccb30fc09875274cba2776 ]
Just like next_entry(), boundary check is necessary to prevent memory out-of-bound access.
--- security/selinux/ss/policydb.h | 2 ++ 1 file changed, 2 insertions(+)
security/selinux/ss/policydb.h +2 -0
@@ -360,6 +360,8 @@ static inline int put_entry(const void *buf, size_t bytes, int num, struct polic {size_t len = bytes * num; +if (len > fp->len) +return -EINVAL ;memcpy (fp->data, buf, len); fp->data += len; fp->len -= len;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 53/287 ARM: findbit: fix overflowing offset
In reply to Greg Kroah-HartmanFrom: Russell King (Oracle) <[email protected]>
[ Upstream commit ec85bd369fd2bfaed6f45dd678706429d4f75b48 ]
When offset is larger than the size of the bit array, we should not attempt to access the array as we can perform an access beyond the end of the array. Fix this by changing the pre-condition.
Using "cmp r2, r1; bhs ..." covers us for the size == 0 case, since this will always take the branch when r1 is zero, irrespective of the value of r2. This means we can fix this bug without adding any additional code!
--- arch/arm/lib/findbit.S | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/arm/lib/findbit.S +8 -8
@@ -43,8 +43,8 @@ ENDPROC(_find_first_zero_bit_le) * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) */ ENTRY(_find_next_zero_bit_le) - teq r1, #0 - beq 3b + cmp r2, r1 + bhs 3b ands ip, r2, #7 beq 1b @ If new byte, goto old routine ARM( ldrb r3, [r0, r2, lsr #3] )
@@ -84,8 +84,8 @@ ENDPROC(_find_first_bit_le) * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) */ ENTRY(_find_next_bit_le) - teq r1, #0 - beq 3b + cmp r2, r1 + bhs 3b ands ip, r2, #7 beq 1b @ If new byte, goto old routine ARM( ldrb r3, [r0, r2, lsr #3] )
@@ -118,8 +118,8 @@ ENTRY(_find_first_zero_bit_be) ENDPROC(_find_first_zero_bit_be) ENTRY(_find_next_zero_bit_be) - teq r1, #0 - beq 3b + cmp r2, r1 + bhs 3b ands ip, r2, #7 beq 1b @ If new byte, goto old routine eor r3, r2, #0x18 @ big endian byte ordering
@@ -152,8 +152,8 @@ ENTRY(_find_first_bit_be) ENDPROC(_find_first_bit_be) ENTRY(_find_next_bit_be) - teq r1, #0 - beq 3b + cmp r2, r1 + bhs 3b ands ip, r2, #7 beq 1b @ If new byte, goto old routine eor r3, r2, #0x18 @ big endian byte ordering
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 54/287 meson-mx-socinfo: Fix refcount leak in meson_mx_socinfo_init
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit a2106f38077e78afcb4bf98fdda3e162118cfb3d ]
of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/soc/amlogic/meson-mx-socinfo.c | 1 + 1 file changed, 1 insertion(+)
drivers/soc/amlogic/meson-mx-socinfo.c +1 -0
@@ -126,6 +126,7 @@ static int __init meson_mx_socinfo_init(void) np =of_find_matching_node (NULL , meson_mx_socinfo_analog_top_ids);if (np) { analog_top_regmap =syscon_node_to_regmap (np); +of_node_put (np);if (IS_ERR (analog_top_regmap))return PTR_ERR (analog_top_regmap);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 55/287 ARM: bcm: Fix refcount leak in bcm_kona_smc_init
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit cb23389a2458c2e4bfd6c86a513cbbe1c4d35e76 ]
of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
--- arch/arm/mach-bcm/bcm_kona_smc.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-bcm/bcm_kona_smc.c +1 -0
@@ -54,6 +54,7 @@ int __init bcm_kona_smc_init(void)return -ENODEV ; prop_val =of_get_address (node,0 , &prop_size,NULL ); +of_node_put (node);if (!prop_val)return -EINVAL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 56/287 x86/pmem: Fix platform-device leak in error path
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
[ Upstream commit 229e73d46994f15314f58b2d39bf952111d89193 ]
Make sure to free the platform device in the unlikely event that registration fails.
--- arch/x86/kernel/pmem.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/kernel/pmem.c +6 -1
@@ -27,6 +27,11 @@ static __init int register_e820_pmem(void)* simply here to trigger the module to load on demand. */ pdev =platform_device_alloc ("e820_pmem" ,-1 ); -return platform_device_add (pdev); + + rc =platform_device_add (pdev); +if (rc) +platform_device_put (pdev); + +return rc; }device_initcall (register_e820_pmem);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 57/287 ARM: dts: ast2500-evb: fix board compatible
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 30b276fca5c0644f3cb17bceb1bd6a626c670184 ]
The AST2500 EVB board should have dedicated compatible.
--- arch/arm/boot/dts/aspeed-ast2500-evb.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/aspeed-ast2500-evb.dts +1 -1
@@ -5,7 +5,7 @@ / { model = "AST2500 EVB"; - compatible = "aspeed,ast2500"; + compatible = "aspeed,ast2500-evb", "aspeed,ast2500"; aliases { serial4 = &uart5;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 58/287 soc: fsl: guts: machine variable might be unset
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit ab3f045774f704c4e7b6a878102f4e9d4ae7bc74 ]
If both the model and the compatible properties are missing, then machine will not be set. Initialize it with NULL.
--- drivers/soc/fsl/guts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/fsl/guts.c +1 -1
@@ -136,7 +136,7 @@ static int fsl_guts_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;struct resource *res;const struct fsl_soc_die_attr *soc_die; -const char *machine; +const char *machine =NULL ;u32 svr;/* Initialize guts */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 59/287 ARM: OMAP2+: Fix refcount leak in omap3xxx_prm_late_init
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 942228fbf5d4901112178b93d41225be7c0dd9de ]
of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
Message-Id: <[email protected]>
--- arch/arm/mach-omap2/prm3xxx.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-omap2/prm3xxx.c +1 -0
@@ -711,6 +711,7 @@ static int omap3xxx_prm_late_init(void) } irq_num =of_irq_get (np,0 ); +of_node_put (np);if (irq_num == -EPROBE_DEFER )return irq_num;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 60/287 cpufreq: zynq: Fix refcount leak in zynq_get_revision
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit d1ff2559cef0f6f8d97fba6337b28adb10689e16 ]
of_find_compatible_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak.
--- arch/arm/mach-zynq/common.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-zynq/common.c +1 -0
@@ -84,6 +84,7 @@ static int __init zynq_get_revision(void) } zynq_devcfg_base =of_iomap (np,0 ); +of_node_put (np);if (!zynq_devcfg_base) {pr_err ("%s: Unable to map I/O memory\n" , __func__);return -1 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 61/287 ARM: dts: qcom: pm8841: add required thermal-sensor-cells
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit e2759fa0676c9a32bbddb9aff955b54bb35066ad ]
The PM8841 temperature sensor has to define thermal-sensor-cells.
--- arch/arm/boot/dts/qcom-pm8841.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/qcom-pm8841.dtsi +1 -0
@@ -25,6 +25,7 @@ temp-alarm@2400 { compatible = "qcom,spmi-temp-alarm"; reg = <0x2400>; interrupts = <4 0x24 0 IRQ_TYPE_EDGE_RISING>; + #thermal-sensor-cells = <0>; }; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 62/287 bus: hisi_lpc: fix missing platform_device_put() in hisi_lpc_acpi_probe()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 54872fea6a5ac967ec2272aea525d1438ac6735a ]
In error case in hisi_lpc_acpi_probe() after calling platform_device_add(), hisi_lpc_acpi_remove() can't release the failed 'pdev', so it will be leak, call platform_device_put() to fix this problem.
I'v constructed this error case and tested this patch on D05 board.
--- drivers/bus/hisi_lpc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/bus/hisi_lpc.c +6 -4
@@ -504,13 +504,13 @@ static int hisi_lpc_acpi_probe(struct device *hostdev) {struct acpi_device *adev =ACPI_COMPANION (hostdev);struct acpi_device *child; +struct platform_device *pdev;int ret;/* Only consider the children of the host */ list_for_each_entry (child, &adev->children, node) {const char *hid =acpi_device_hid (child);const struct hisi_lpc_acpi_cell *cell; -struct platform_device *pdev;const struct resource *res;bool found = false;int num_res;
@@ -573,22 +573,24 @@ static int hisi_lpc_acpi_probe(struct device *hostdev) ret =platform_device_add_resources (pdev, res, num_res);if (ret) - goto fail; + goto fail_put_device; ret =platform_device_add_data (pdev, cell->pdata, cell->pdata_size);if (ret) - goto fail; + goto fail_put_device; ret =platform_device_add (pdev);if (ret) - goto fail; + goto fail_put_device;acpi_device_set_enumerated (child); }return 0 ; +fail_put_device: +platform_device_put (pdev); fail:hisi_lpc_acpi_remove (hostdev);return ret;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 63/287 arm64: dts: qcom: msm8916: Fix typo in pronto remoteproc node
In reply to Greg Kroah-HartmanFrom: Sireesh Kodali <[email protected]>
[ Upstream commit 5458d6f2827cd30218570f266b8d238417461f2f ]
The smem-state properties for the pronto node were incorrectly labelled, reading qcom,state* rather than qcom,smem-state*. Fix that, allowing the stop state to be used.
--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +2 -2
@@ -1039,8 +1039,8 @@ pronto: wcnss@a21b000 { vddmx-supply = <&pm8916_l3>; vddpx-supply = <&pm8916_l7>; - qcom,state = <&wcnss_smp2p_out 0>; - qcom,state-names = "stop"; + qcom,smem-states = <&wcnss_smp2p_out 0>; + qcom,smem-state-names = "stop"; pinctrl-names = "default"; pinctrl-0 = <&wcnss_pin_a>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 64/287 regulator: of: Fix refcount leak bug in of_get_regulation_constraints()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 66efb665cd5ad69b27dca8571bf89fc6b9c628a4 ]
We should call the of_node_put() for the reference returned by of_get_child_by_name() which has increased the refcount.
--- drivers/regulator/of_regulator.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/regulator/of_regulator.c +5 -1
@@ -189,8 +189,12 @@ static void of_get_regulation_constraints(struct device_node *np, } suspend_np =of_get_child_by_name (np, regulator_states[i]); -if (!suspend_np || !suspend_state) +if (!suspend_np)continue ; +if (!suspend_state) { +of_node_put (suspend_np); +continue ; + }if (!of_property_read_u32 (suspend_np,"regulator-mode" , &pval)) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 65/287 nohz/full, sched/rt: Fix missed tick-reenabling bug in dequeue_task_rt()
In reply to Greg Kroah-HartmanFrom: Nicolas Saenz Julienne <[email protected]>
[ Upstream commit 5c66d1b9b30f737fcef85a0b75bfe0590e16b62a ]
dequeue_task_rt() only decrements 'rt_rq->rt_nr_running' after having called sched_update_tick_dependency() preventing it from re-enabling the tick on systems that no longer have pending SCHED_RT tasks but have multiple runnable SCHED_OTHER tasks:
dequeue_task_rt()
dequeue_rt_entity()
dequeue_rt_stack()
dequeue_top_rt_rq()
sub_nr_running() // decrements rq->nr_running
sched_update_tick_dependency()
sched_can_stop_tick() // checks rq->rt.rt_nr_running,
...
__dequeue_rt_entity()
dec_rt_tasks() // decrements rq->rt.rt_nr_running
...Every other scheduler class performs the operation in the opposite order, and sched_update_tick_dependency() expects the values to be updated as such. So avoid the misbehaviour by inverting the order in which the above operations are performed in the RT scheduler.
--- kernel/sched/rt.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
kernel/sched/rt.c +9 -6
@@ -434,7 +434,7 @@ static inline void rt_queue_push_tasks(struct rq *rq)#endif /* CONFIG_SMP */ static void enqueue_top_rt_rq (struct rt_rq *rt_rq); -static void dequeue_top_rt_rq (struct rt_rq *rt_rq); +static void dequeue_top_rt_rq (struct rt_rq *rt_rq,unsigned int count);static inline int on_rt_rq (struct sched_rt_entity *rt_se) {
@@ -516,7 +516,7 @@ static void sched_rt_rq_dequeue(struct rt_rq *rt_rq) rt_se = rt_rq->tg->rt_se[cpu];if (!rt_se) { -dequeue_top_rt_rq (rt_rq); +dequeue_top_rt_rq (rt_rq, rt_rq->rt_nr_running);/* Kick cpufreq (see the comment in kernel/sched/sched.h). */ cpufreq_update_util (rq_of_rt_rq (rt_rq),0 ); }
@@ -602,7 +602,7 @@ static inline void sched_rt_rq_enqueue(struct rt_rq *rt_rq)static inline void sched_rt_rq_dequeue (struct rt_rq *rt_rq) { -dequeue_top_rt_rq (rt_rq); +dequeue_top_rt_rq (rt_rq, rt_rq->rt_nr_running); }static inline int rt_rq_throttled (struct rt_rq *rt_rq)
@@ -1001,7 +1001,7 @@ static void update_curr_rt(struct rq *rq) }static void -dequeue_top_rt_rq (struct rt_rq *rt_rq) +dequeue_top_rt_rq (struct rt_rq *rt_rq,unsigned int count) {struct rq *rq =rq_of_rt_rq (rt_rq);
@@ -1012,7 +1012,7 @@ dequeue_top_rt_rq(struct rt_rq *rt_rq)BUG_ON (!rq->nr_running); -sub_nr_running (rq, rt_rq->rt_nr_running); +sub_nr_running (rq, count); rt_rq->rt_queued =0 ; }
@@ -1291,18 +1291,21 @@ static void __dequeue_rt_entity(struct sched_rt_entity *rt_se, unsigned int flagstatic void dequeue_rt_stack (struct sched_rt_entity *rt_se,unsigned int flags) {struct sched_rt_entity *back =NULL ; +unsigned int rt_nr_running;for_each_sched_rt_entity (rt_se) { rt_se->back = back; back = rt_se; } -dequeue_top_rt_rq (rt_rq_of_se (back)); + rt_nr_running =rt_rq_of_se (back)->rt_nr_running;for (rt_se = back; rt_se; rt_se = rt_se->back) {if (on_rt_rq (rt_se))__dequeue_rt_entity (rt_se, flags); } + +dequeue_top_rt_rq (rt_rq_of_se (back), rt_nr_running); }static void enqueue_rt_entity (struct sched_rt_entity *rt_se,unsigned int flags)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 66/287 thermal/tools/tmon: Include pthread and time headers in tmon.h
In reply to Greg Kroah-HartmanFrom: Markus Mayer <[email protected]>
[ Upstream commit 0cf51bfe999524377fbb71becb583b4ca6d07cfc ]
Include sys/time.h and pthread.h in tmon.h, so that types "pthread_mutex_t" and "struct timeval tv" are known when tmon.h references them.
Without these headers, compiling tmon against musl-libc will fail with these errors:
In file included from sysfs.c:31:0:
tmon.h:47:8: error: unknown type name 'pthread_mutex_t'
extern pthread_mutex_t input_lock;
^~~~~~~~~~~~~~~make[3]: *** [<builtin>: sysfs.o] Error 1 make[3]: *** Waiting for unfinished jobs.... In file included from tui.c:31:0:
tmon.h:54:17: error: field 'tv' has incomplete type
struct timeval tv;
^~make[3]: *** [<builtin>: tui.o] Error 1
make[2]: *** [Makefile:83: tmon] Error 2
--- tools/thermal/tmon/tmon.h | 3 +++ 1 file changed, 3 insertions(+)
tools/thermal/tmon/tmon.h +3 -0
@@ -36,6 +36,9 @@#define NR_LINES_TZDATA 1#define TMON_LOG_FILE "/var/tmp/tmon.log" +#include <sys/time.h> +#include <pthread.h> +extern unsigned long ticktime;extern double time_elapsed;extern unsigned long target_temp_user;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 67/287 dm: return early from dm_pr_call() if DM device is suspended
In reply to Greg Kroah-HartmanFrom: Mike Snitzer <[email protected]>
[ Upstream commit e120a5f1e78fab6223544e425015f393d90d6f0d ]
Otherwise PR ops may be issued while the broader DM device is being reconfigured, etc.
--- drivers/md/dm.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/md/dm.c +5 -0
@@ -3122,6 +3122,11 @@ static int dm_call_pr(struct block_device *bdev, iterate_devices_callout_fn fn, goto out; ti =dm_table_get_target (table,0 ); +if (dm_suspended_md (md)) { + ret = -EAGAIN ; + goto out; + } + ret = -EINVAL ;if (!ti->type->iterate_devices) goto out;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 68/287 ath10k: do not enforce interrupt trigger type
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 1ee6c5abebd3cacf2ac4378d0ed4f57fd4850421 ]
Interrupt line can be configured on different hardware in different way, even inverted. Therefore driver should not enforce specific trigger type - edge rising - but instead rely on Devicetree to configure it.
All Qualcomm DTSI with WCN3990 define the interrupt type as level high, so the mismatch between DTSI and driver causes rebind issues:
$ echo 18800000.wifi > /sys/bus/platform/drivers/ath10k_snoc/unbind $ echo 18800000.wifi > /sys/bus/platform/drivers/ath10k_snoc/bind [ 44.763114] irq: type mismatch, failed to map hwirq-446 for interrupt-controller@17a00000! [ 44.763130] ath10k_snoc 18800000.wifi: error -ENXIO: IRQ index 0 not found [ 44.763140] ath10k_snoc 18800000.wifi: failed to initialize resource: -6
Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.2.0.c8-00009-QCAHLSWSC8180XMTPLZ-1
Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.2.0-01387-QCAHLSWMTPLZ-1
--- drivers/net/wireless/ath/ath10k/snoc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/snoc.c +2 -3
@@ -879,13 +879,12 @@ static void ath10k_snoc_init_napi(struct ath10k *ar)static int ath10k_snoc_request_irq (struct ath10k *ar) {struct ath10k_snoc *ar_snoc =ath10k_snoc_priv (ar); -int irqflags =IRQF_TRIGGER_RISING ;int ret, id;for (id =0 ; id <CE_COUNT_MAX ; id++) { ret =request_irq (ar_snoc->ce_irqs[id].irq_line, - ath10k_snoc_per_engine_handler, - irqflags, ce_name[id], ar); + ath10k_snoc_per_engine_handler,0 , + ce_name[id], ar);if (ret) { ath10k_err(ar, "failed to register IRQ handler for CE %d: %d",
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 69/287 wifi: rtlwifi: fix error codes in rtl_debugfs_set_write_h2c()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit b88d28146c30a8e14f0f012d56ebf19b68a348f4 ]
If the copy_from_user() fails or the user gives invalid date then the correct thing to do is to return a negative error code. (Currently it returns success).
I made a copy additional related cleanups:
1) There is no need to check "buffer" for NULL. That's handled by copy_from_user().
2) The "h2c_len" variable cannot be negative because it is unsigned and because sscanf() does not return negative error codes.
--- drivers/net/wireless/realtek/rtlwifi/debug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtlwifi/debug.c +4 -4
@@ -370,8 +370,8 @@ static ssize_t rtl_debugfs_set_write_h2c(struct file *filp, tmp_len = (count >sizeof (tmp) -1 ?sizeof (tmp) -1 : count); -if (!buffer ||copy_from_user (tmp, buffer, tmp_len)) -return count; +if (copy_from_user (tmp, buffer, tmp_len)) +return -EFAULT ; tmp[tmp_len] ='\0' ;
@@ -381,8 +381,8 @@ static ssize_t rtl_debugfs_set_write_h2c(struct file *filp, &h2c_data[4 ], &h2c_data[5 ], &h2c_data[6], &h2c_data[7]); -if (h2c_len <=0 ) -return count; +if (h2c_len ==0 ) +return -EINVAL ;for (i =0 ; i < h2c_len; i++) h2c_data_packed[i] = (u8 )h2c_data[i];
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 70/287 drm/radeon: fix potential buffer overflow in ni_set_mc_special_registers()
In reply to Greg Kroah-HartmanFrom: Alexey Kodanev <[email protected]>
[ Upstream commit 136f614931a2bb73616b292cf542da3a18daefd5 ]
The last case label can write two buffers 'mc_reg_address[j]' and 'mc_data[j]' with 'j' offset equal to SMC_NISLANDS_MC_REGISTER_ARRAY_SIZE since there are no checks for this value in both case labels after the last 'j++'.
Instead of changing '>' to '>=' there, add the bounds check at the start of the second 'case' (the first one already has it).
Also, remove redundant last checks for 'j' index bigger than array size. The expression is always false. Moreover, before or after the patch 'table->last' can be equal to SMC_NISLANDS_MC_REGISTER_ARRAY_SIZE and it seems it can be a valid value.
Detected using the static analysis tool - Svace.
--- drivers/gpu/drm/radeon/ni_dpm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/ni_dpm.c +2 -4
@@ -2738,10 +2738,10 @@ static int ni_set_mc_special_registers(struct radeon_device *rdev, table->mc_reg_table_entry[k].mc_data[j] |=0x100 ; } j++; -if (j >SMC_NISLANDS_MC_REGISTER_ARRAY_SIZE ) -return -EINVAL ;break ;case MC_SEQ_RESERVE_M >>2 : +if (j >=SMC_NISLANDS_MC_REGISTER_ARRAY_SIZE ) +return -EINVAL ; temp_reg =RREG32 (MC_PMG_CMD_MRS1 ); table->mc_reg_address[j].s1 =MC_PMG_CMD_MRS1 >>2 ; table->mc_reg_address[j].s0 =MC_SEQ_PMG_CMD_MRS1_LP >>2 ;
@@ -2750,8 +2750,6 @@ static int ni_set_mc_special_registers(struct radeon_device *rdev, (temp_reg &0xffff0000 ) | (table->mc_reg_table_entry[k].mc_data[i] &0x0000ffff ); j++; -if (j >SMC_NISLANDS_MC_REGISTER_ARRAY_SIZE ) -return -EINVAL ;break ;default :break ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 71/287 drm/mediatek: Add pull-down MIPI operation in mtk_dsi_poweroff function
In reply to Greg Kroah-HartmanFrom: Xinlei Lee <[email protected]>
[ Upstream commit fa5d0a0205c34734c5b8daa77e39ac2817f63a10 ]
In the dsi_enable function, mtk_dsi_rxtx_control is to pull up the MIPI signal operation. Before dsi_disable, MIPI should also be pulled down by writing a register instead of disabling dsi.
If disable dsi without pulling the mipi signal low, the value of the register will still maintain the setting of the mipi signal being pulled high.
After resume, even if the mipi signal is not pulled high, it will still be in the high state.
--- drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/mediatek/mtk_dsi.c +2 -0
@@ -651,6 +651,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)mtk_dsi_reset_engine (dsi);mtk_dsi_lane0_ulp_mode_enter (dsi);mtk_dsi_clk_ulp_mode_enter (dsi); +/* set the lane number as 0 to pull down mipi */ +writel (0 , dsi->regs +DSI_TXRX_CTRL );mtk_dsi_disable (dsi);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 72/287 i2c: Fix a potential use after free
In reply to Greg Kroah-HartmanFrom: Xu Wang <[email protected]>
[ Upstream commit e4c72c06c367758a14f227c847f9d623f1994ecf ]
Free the adap structure only after we are done using it. This patch just moves the put_device() down a bit to avoid the use after free.
--- drivers/i2c/i2c-core-base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/i2c-core-base.c +2 -1
@@ -2273,8 +2273,9 @@ void i2c_put_adapter(struct i2c_adapter *adap)if (!adap)return ; -put_device (&adap->dev);module_put (adap->owner); +/* Should be last, otherwise we risk use-after-free with 'adap' */ +put_device (&adap->dev); }EXPORT_SYMBOL (i2c_put_adapter);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 73/287 media: tw686x: Register the irq at the end of probe
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit fb730334e0f759d00f72168fbc555e5a95e35210 ]
We got the following warning when booting the kernel:
[ 3.243674] INFO: trying to register non-static key. [ 3.243922] The code is fine but needs lockdep annotation, or maybe [ 3.244230] you didn't initialize this object before use? [ 3.245642] Call Trace: [ 3.247836] lock_acquire+0xff/0x2d0 [ 3.248727] tw686x_audio_irq+0x1a5/0xcc0 [tw686x] [ 3.249211] tw686x_irq+0x1f9/0x480 [tw686x]
The lock 'vc->qlock' will be initialized in tw686x_video_init(), but the driver registers the irq before calling the tw686x_video_init(), and we got the warning.
Fix this by registering the irq at the end of probe
--- drivers/media/pci/tw686x/tw686x-core.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
drivers/media/pci/tw686x/tw686x-core.c +8 -10
@@ -318,13 +318,6 @@ static int tw686x_probe(struct pci_dev *pci_dev,spin_lock_init (&dev->lock); - err =request_irq (pci_dev->irq, tw686x_irq,IRQF_SHARED , - dev->name, dev); -if (err <0 ) { -dev_err (&pci_dev->dev,"unable to request interrupt\n" ); - goto iounmap; - } -timer_setup (&dev->dma_delay_timer, tw686x_dma_delay,0 );/*
@@ -336,18 +329,23 @@ static int tw686x_probe(struct pci_dev *pci_dev, err =tw686x_video_init (dev);if (err) {dev_err (&pci_dev->dev,"can't register video\n" ); - goto free_irq; + goto iounmap; } err =tw686x_audio_init (dev);if (err)dev_warn (&pci_dev->dev,"can't register audio\n" ); + err =request_irq (pci_dev->irq, tw686x_irq,IRQF_SHARED , + dev->name, dev); +if (err <0 ) { +dev_err (&pci_dev->dev,"unable to request interrupt\n" ); + goto iounmap; + } +pci_set_drvdata (pci_dev, dev);return 0 ; -free_irq: -free_irq (pci_dev->irq, dev); iounmap:pci_iounmap (pci_dev, dev->mmio); free_region:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 74/287 ath9k: fix use-after-free in ath9k_hif_usb_rx_cb
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 0ac4827f78c7ffe8eef074bc010e7e34bc22f533 ]
Syzbot reported use-after-free Read in ath9k_hif_usb_rx_cb() [0]. The problem was in incorrect htc_handle->drv_priv initialization.
Probable call trace which can trigger use-after-free:
ath9k_htc_probe_device()
/* htc_handle->drv_priv = priv; */
ath9k_htc_wait_for_target() <--- Failed
ieee80211_free_hw() <--- priv pointer is freed
<IRQ>
...ath9k_hif_usb_rx_cb()
ath9k_hif_usb_rx_stream()
RX_STAT_INC() <--- htc_handle->drv_priv access
In order to not add fancy protection for drv_priv we can move htc_handle->drv_priv initialization at the end of the ath9k_htc_probe_device() and add helper macro to make
all *_STAT_* macros NULL safe, since syzbot has reported related NULL deref in that macros [1]
--- drivers/net/wireless/ath/ath9k/htc.h | 10 +++++----- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath9k/htc.h +5 -5
@@ -325,11 +325,11 @@ static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(struct sk_buff *skb) }#ifdef CONFIG_ATH9K_HTC_DEBUGFS - -#define TX_STAT_INC (c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) -#define TX_STAT_ADD (c, a) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a) -#define RX_STAT_INC (c) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c++) -#define RX_STAT_ADD (c, a) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c += a) +#define __STAT_SAFE (expr) (hif_dev->htc_handle->drv_priv ? (expr) : 0) +#define TX_STAT_INC (c) __STAT_SAFE(hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) +#define TX_STAT_ADD (c, a) __STAT_SAFE(hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a) +#define RX_STAT_INC (c) __STAT_SAFE(hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c++) +#define RX_STAT_ADD (c, a) __STAT_SAFE(hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c += a)#define CAB_STAT_INC priv->debug.tx_stats.cab_queued++#define TX_QSTAT_INC (q) (priv->debug.tx_stats.queue_stats[q]++)
drivers/net/wireless/ath/ath9k/htc_drv_init.c +2 -1
@@ -946,7 +946,6 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, priv->hw = hw; priv->htc = htc_handle; priv->dev = dev; - htc_handle->drv_priv = priv;SET_IEEE80211_DEV (hw, priv->dev); ret =ath9k_htc_wait_for_target (priv);
@@ -967,6 +966,8 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev,if (ret) goto err_init; + htc_handle->drv_priv = priv; +return 0 ; err_init:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 75/287 wifi: iwlegacy: 4965: fix potential off-by-one overflow in il4965_rs_fill_link_cmd()
In reply to Greg Kroah-HartmanFrom: Alexey Kodanev <[email protected]>
[ Upstream commit a8eb8e6f7159c7c20c0ddac428bde3d110890aa7 ]
As a result of the execution of the inner while loop, the value of 'idx' can be equal to LINK_QUAL_MAX_RETRY_NUM. However, this is not checked after the loop and 'idx' is used to write the LINK_QUAL_MAX_RETRY_NUM size array 'lq_cmd->rs_table[idx]' below in the outer loop.
The fix is to check the new value of 'idx' inside the nested loop, and break both loops if index equals the size. Checking it at the start is now pointless, so let's remove it.
Detected using the static analysis tool - Svace.
--- drivers/net/wireless/intel/iwlegacy/4965-rs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlegacy/4965-rs.c +4 -1
@@ -2422,7 +2422,7 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta,/* Repeat initial/next rate. * For legacy IL_NUMBER_TRY == 1, this loop will not execute. * For HT IL_HT_NUMBER_TRY == 3, this executes twice. */ -while (repeat_rate >0 && idx <LINK_QUAL_MAX_RETRY_NUM ) { +while (repeat_rate >0 ) {if (is_legacy (tbl_type.lq_type)) {if (ant_toggle_cnt <NUM_TRY_BEFORE_ANT_TOGGLE ) ant_toggle_cnt++;
@@ -2441,6 +2441,8 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta,cpu_to_le32 (new_rate); repeat_rate--; idx++; +if (idx >=LINK_QUAL_MAX_RETRY_NUM ) + goto out; } il4965_rs_get_tbl_info_from_mcs(new_rate, lq_sta->band,
@@ -2485,6 +2487,7 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta, repeat_rate--; } +out: lq_cmd->agg_params.agg_frame_cnt_limit =LINK_QUAL_AGG_FRAME_LIMIT_DEF ; lq_cmd->agg_params.agg_dis_start_th =LINK_QUAL_AGG_DISABLE_START_DEF ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 76/287 drm: bridge: adv7511: Add check for mipi_dsi_driver_register
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 831463667b5f4f1e5bce9c3b94e9e794d2bc8923 ]
As mipi_dsi_driver_register could return error if fails, it should be better to check the return value and return error if fails.
Moreover, if i2c_add_driver fails, mipi_dsi_driver_register should be reverted.
--- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +14 -3
@@ -1301,10 +1301,21 @@ static struct i2c_driver adv7511_driver = {static int __init adv7511_init (void ) { -if (IS_ENABLED (CONFIG_DRM_MIPI_DSI )) -mipi_dsi_driver_register (&adv7533_dsi_driver); +int ret; + +if (IS_ENABLED (CONFIG_DRM_MIPI_DSI )) { + ret =mipi_dsi_driver_register (&adv7533_dsi_driver); +if (ret) +return ret; + } -return i2c_add_driver (&adv7511_driver); + ret =i2c_add_driver (&adv7511_driver); +if (ret) { +if (IS_ENABLED (CONFIG_DRM_MIPI_DSI )) +mipi_dsi_driver_unregister (&adv7533_dsi_driver); + } + +return ret; }module_init (adv7511_init);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 77/287 media: hdpvr: fix error value returns in hdpvr_read
In reply to Greg Kroah-HartmanFrom: Niels Dossche <[email protected]>
[ Upstream commit 359c27c6ddbde404f44a9c0d3ec88ccd1e2042f2 ]
Error return values are supposed to be negative in hdpvr_read. Most error returns are currently handled via an unsigned integer "ret". When setting a negative error value to "ret", the value actually becomes a large positive value, because "ret" is unsigned. Later on, the "ret" value is returned. But as ssize_t is a 64-bit signed number, the error return value stays a large positive integer instead of a negative integer. This can cause an error value to be interpreted as the read size, which can cause a buffer overread for applications relying on the returned size.
--- drivers/media/usb/hdpvr/hdpvr-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/hdpvr/hdpvr-video.c +1 -1
@@ -413,7 +413,7 @@ static ssize_t hdpvr_read(struct file *file, char __user *buffer, size_t count,struct hdpvr_device *dev =video_drvdata (file);struct hdpvr_buffer *buf =NULL ;struct urb *urb; -unsigned int ret =0 ; +int ret =0 ;int rem, cnt;if (*pos)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 78/287 drm/vc4: dsi: Correct DSI divider calculations
In reply to Greg Kroah-HartmanFrom: Dave Stevenson <[email protected]>
[ Upstream commit 3b45eee87da171caa28f61240ddb5c21170cda53 ]
The divider calculations tried to find the divider just faster than the clock requested. However if it required a divider of 7 then the for loop aborted without handling the "error" case, and could end up with a clock lower than requested.
The integer divider from parent PLL to DSI clock is also capable of going up to /255, not just /7 that the driver was trying. This allows for slower link frequencies on the DSI bus where the resolution permits.
Correct the loop so that we always have a clock greater than requested, and covering the whole range of dividers.
--- drivers/gpu/drm/vc4/vc4_dsi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/vc4/vc4_dsi.c +2 -4
@@ -853,11 +853,9 @@ static bool vc4_dsi_encoder_mode_fixup(struct drm_encoder *encoder,/* Find what divider gets us a faster clock than the requested * pixel clock. */ -for (divider =1 ; divider <8 ; divider++) { -if (parent_rate / divider < pll_clock) { - divider--; +for (divider =1 ; divider <255 ; divider++) { +if (parent_rate / (divider +1 ) < pll_clock)break ; - } }/* Now that we've picked a PLL divider, calculate back to its
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 79/287 drm/rockchip: vop: Dont crash for invalid duplicate_state()
In reply to Greg Kroah-HartmanFrom: Brian Norris <[email protected]>
[ Upstream commit 1449110b0dade8b638d2c17ab7c5b0ff696bfccb ]
It's possible for users to try to duplicate the CRTC state even when the state doesn't exist. drm_atomic_helper_crtc_duplicate_state() (and other users of __drm_atomic_helper_crtc_duplicate_state()) already guard this with a WARN_ON() instead of crashing, so let's do that here too.
--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +3 -0
@@ -1088,6 +1088,9 @@ static struct drm_crtc_state *vop_crtc_duplicate_state(struct drm_crtc *crtc) {struct rockchip_crtc_state *rockchip_state; +if (WARN_ON (!crtc->state)) +return NULL ; + rockchip_state =kzalloc (sizeof (*rockchip_state),GFP_KERNEL );if (!rockchip_state)return NULL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 80/287 drm/mediatek: dpi: Remove output format of YUV
In reply to Greg Kroah-HartmanFrom: Bo-Chen Chen <[email protected]>
[ Upstream commit c9ed0713b3c35fc45677707ba47f432cad95da56 ]
DPI is not support output format as YUV, but there is the setting of configuring output YUV. Therefore, remove them in this patch.
--- drivers/gpu/drm/mediatek/mtk_dpi.c | 31 ++++++------------------------ 1 file changed, 6 insertions(+), 25 deletions(-)
drivers/gpu/drm/mediatek/mtk_dpi.c +6 -25
@@ -52,13 +52,7 @@ enum mtk_dpi_out_channel_swap { };enum mtk_dpi_out_color_format { -MTK_DPI_COLOR_FORMAT_RGB , -MTK_DPI_COLOR_FORMAT_RGB_FULL , -MTK_DPI_COLOR_FORMAT_YCBCR_444 , -MTK_DPI_COLOR_FORMAT_YCBCR_422 , -MTK_DPI_COLOR_FORMAT_XV_YCC , -MTK_DPI_COLOR_FORMAT_YCBCR_444_FULL , -MTK_DPI_COLOR_FORMAT_YCBCR_422_FULL +MTK_DPI_COLOR_FORMAT_RGB };struct mtk_dpi {
@@ -347,24 +341,11 @@ static void mtk_dpi_config_2n_h_fre(struct mtk_dpi *dpi)static void mtk_dpi_config_color_format (struct mtk_dpi *dpi,enum mtk_dpi_out_color_format format) { -if ((format ==MTK_DPI_COLOR_FORMAT_YCBCR_444 ) || - (format ==MTK_DPI_COLOR_FORMAT_YCBCR_444_FULL )) { -mtk_dpi_config_yuv422_enable (dpi, false); -mtk_dpi_config_csc_enable (dpi, true); -mtk_dpi_config_swap_input (dpi, false); -mtk_dpi_config_channel_swap (dpi,MTK_DPI_OUT_CHANNEL_SWAP_BGR ); - }else if ((format ==MTK_DPI_COLOR_FORMAT_YCBCR_422 ) || - (format ==MTK_DPI_COLOR_FORMAT_YCBCR_422_FULL )) { -mtk_dpi_config_yuv422_enable (dpi, true); -mtk_dpi_config_csc_enable (dpi, true); -mtk_dpi_config_swap_input (dpi, true); -mtk_dpi_config_channel_swap (dpi,MTK_DPI_OUT_CHANNEL_SWAP_RGB ); - }else { -mtk_dpi_config_yuv422_enable (dpi, false); -mtk_dpi_config_csc_enable (dpi, false); -mtk_dpi_config_swap_input (dpi, false); -mtk_dpi_config_channel_swap (dpi,MTK_DPI_OUT_CHANNEL_SWAP_RGB ); - } +/* only support RGB888 */ +mtk_dpi_config_yuv422_enable (dpi, false); +mtk_dpi_config_csc_enable (dpi, false); +mtk_dpi_config_swap_input (dpi, false); +mtk_dpi_config_channel_swap (dpi,MTK_DPI_OUT_CHANNEL_SWAP_RGB ); }static void mtk_dpi_power_off (struct mtk_dpi *dpi,enum mtk_dpi_power_ctl pctl)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 81/287 drm: bridge: sii8620: fix possible off-by-one
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
[ Upstream commit 21779cc21c732c5eff8ea1624be6590450baa30f ]
The next call to sii8620_burst_get_tx_buf will result in off-by-one When ctx->burst.tx_count + size == ARRAY_SIZE(ctx->burst.tx_buf). The same thing happens in sii8620_burst_get_rx_buf.
This patch also change tx_count and tx_buf to rx_count and rx_buf in sii8620_burst_get_rx_buf. It is unreasonable to check tx_buf's size and use rx_buf.
--- drivers/gpu/drm/bridge/sil-sii8620.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/sil-sii8620.c +2 -2
@@ -607,7 +607,7 @@ static void *sii8620_burst_get_tx_buf(struct sii8620 *ctx, int len)u8 *buf = &ctx->burst.tx_buf[ctx->burst.tx_count];int size = len +2 ; -if (ctx->burst.tx_count + size >ARRAY_SIZE (ctx->burst.tx_buf)) { +if (ctx->burst.tx_count + size >=ARRAY_SIZE (ctx->burst.tx_buf)) {dev_err (ctx->dev,"TX-BLK buffer exhausted\n" ); ctx->error = -EINVAL ;return NULL ;
@@ -624,7 +624,7 @@ static u8 *sii8620_burst_get_rx_buf(struct sii8620 *ctx, int len)u8 *buf = &ctx->burst.rx_buf[ctx->burst.rx_count];int size = len +1 ; -if (ctx->burst.tx_count + size >ARRAY_SIZE (ctx->burst.tx_buf)) { +if (ctx->burst.rx_count + size >=ARRAY_SIZE (ctx->burst.rx_buf)) {dev_err (ctx->dev,"RX-BLK buffer exhausted\n" ); ctx->error = -EINVAL ;return NULL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 82/287 drm/msm/mdp5: Fix global state lock backoff
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
[ Upstream commit 92ef86ab513593c6329d04146e61f9a670e72fc5 ]
We need to grab the lock after the early return for !hwpipe case. Otherwise, we could have hit contention yet still returned 0.
Fixes an issue that the new CONFIG_DRM_DEBUG_MODESET_LOCK stuff flagged in CI:
WARNING: CPU: 0 PID: 282 at drivers/gpu/drm/drm_modeset_lock.c:296 drm_modeset_lock+0xf8/0x154
Modules linked in:
CPU: 0 PID: 282 Comm: kms_cursor_lega Tainted: G W 5.19.0-rc2-15930-g875cc8bc536a #1
Hardware name: Qualcomm Technologies, Inc. DB820c (DT)
pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : drm_modeset_lock+0xf8/0x154
lr : drm_atomic_get_private_obj_state+0x84/0x170
sp : ffff80000cfab6a0
x29: ffff80000cfab6a0 x28: 0000000000000000 x27: ffff000083bc4d00
x26: 0000000000000038 x25: 0000000000000000 x24: ffff80000957ca58
x23: 0000000000000000 x22: ffff000081ace080 x21: 0000000000000001
x20: ffff000081acec18 x19: ffff80000cfabb80 x18: 0000000000000038
x17: 0000000000000000 x16: 0000000000000000 x15: fffffffffffea0d0
x14: 0000000000000000 x13: 284e4f5f4e524157 x12: 5f534b434f4c5f47
x11: ffff80000a386aa8 x10: 0000000000000029 x9 : ffff80000cfab610
x8 : 0000000000000029 x7 : 0000000000000014 x6 : 0000000000000000
x5 : 0000000000000001 x4 : ffff8000081ad904 x3 : 0000000000000029
x2 : ffff0000801db4c0 x1 : ffff80000cfabb80 x0 : ffff000081aceb58
Call trace:
drm_modeset_lock+0xf8/0x154
drm_atomic_get_private_obj_state+0x84/0x170
mdp5_get_global_state+0x54/0x6c
mdp5_pipe_release+0x2c/0xd4
mdp5_plane_atomic_check+0x2ec/0x414
drm_atomic_helper_check_planes+0xd8/0x210
drm_atomic_helper_check+0x54/0xb0
...
---[ end trace 0000000000000000 ]---
drm_modeset_lock attempting to lock a contended lock without backoff:
drm_modeset_lock+0x148/0x154
mdp5_get_global_state+0x30/0x6c
mdp5_pipe_release+0x2c/0xd4
mdp5_plane_atomic_check+0x290/0x414
drm_atomic_helper_check_planes+0xd8/0x210
drm_atomic_helper_check+0x54/0xb0
drm_atomic_check_only+0x4b0/0x8f4
drm_atomic_commit+0x68/0xe0Patchwork: https://patchwork.freedesktop.org/patch/492701/
--- drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c +2 -1
@@ -134,12 +134,13 @@ int mdp5_pipe_release(struct drm_atomic_state *s, struct mdp5_hw_pipe *hwpipe) {struct msm_drm_private *priv = s->dev->dev_private;struct mdp5_kms *mdp5_kms =to_mdp5_kms (to_mdp_kms (priv->kms)); -struct mdp5_global_state *state =mdp5_get_global_state (s); +struct mdp5_global_state *state;struct mdp5_hw_pipe_state *new_state;if (!hwpipe)return 0 ; + state =mdp5_get_global_state (s);if (IS_ERR (state))return PTR_ERR (state);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 83/287 crypto: hisilicon - Kunpeng916 crypto driver dont sleep when in softirq
In reply to Greg Kroah-HartmanFrom: Zhengchao Shao <[email protected]>
[ Upstream commit 68740ab505431f268dc1ee26a54b871e75f0ddaa ]
When kunpeng916 encryption driver is used to deencrypt and decrypt packets during the softirq, it is not allowed to use mutex lock.
--- drivers/crypto/hisilicon/sec/sec_algs.c | 14 +++++++------- drivers/crypto/hisilicon/sec/sec_drv.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/crypto/hisilicon/sec/sec_algs.c +7 -7
@@ -457,7 +457,7 @@ static void sec_skcipher_alg_callback(struct sec_bd_info *sec_resp,*/ } -mutex_lock (&ctx->queue->queuelock); +spin_lock_bh (&ctx->queue->queuelock);/* Put the IV in place for chained cases */ switch (ctx->cipher_alg) {case SEC_C_AES_CBC_128 :
@@ -517,7 +517,7 @@ static void sec_skcipher_alg_callback(struct sec_bd_info *sec_resp,list_del (&backlog_req->backlog_head); } } -mutex_unlock (&ctx->queue->queuelock); +spin_unlock_bh (&ctx->queue->queuelock);mutex_lock (&sec_req->lock);list_del (&sec_req_el->head);
@@ -806,7 +806,7 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq,*/ /* Grab a big lock for a long time to avoid concurrency issues */ -mutex_lock (&queue->queuelock); +spin_lock_bh (&queue->queuelock);/* * Can go on to queue if we have space in either:
@@ -822,15 +822,15 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, ret = -EBUSY ;if ((skreq->base.flags &CRYPTO_TFM_REQ_MAY_BACKLOG )) {list_add_tail (&sec_req->backlog_head, &ctx->backlog); -mutex_unlock (&queue->queuelock); +spin_unlock_bh (&queue->queuelock); goto out; } -mutex_unlock (&queue->queuelock); +spin_unlock_bh (&queue->queuelock); goto err_free_elements; } ret =sec_send_request (sec_req, queue); -mutex_unlock (&queue->queuelock); +spin_unlock_bh (&queue->queuelock);if (ret) goto err_free_elements;
@@ -889,7 +889,7 @@ static int sec_alg_skcipher_init(struct crypto_skcipher *tfm)if (IS_ERR (ctx->queue))return PTR_ERR (ctx->queue); -mutex_init (&ctx->queue->queuelock); +spin_lock_init (&ctx->queue->queuelock); ctx->queue->havesoftqueue = false;return 0 ;
drivers/crypto/hisilicon/sec/sec_drv.h +1 -1
@@ -347,7 +347,7 @@ struct sec_queue {DECLARE_BITMAP (unprocessed,SEC_QUEUE_LEN ); DECLARE_KFIFO_PTR(softqueue, typeof(struct sec_request_el *));bool havesoftqueue; -struct mutex queuelock; +spinlock_t queuelock;void *shadow[SEC_QUEUE_LEN ]; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 84/287 media: platform: mtk-mdp: Fix mdp_ipi_comm structure alignment
In reply to Greg Kroah-HartmanFrom: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit ab14c99c035da7156a3b66fa171171295bc4b89a ]
The mdp_ipi_comm structure defines a command that is either PROCESS (start processing) or DEINIT (destroy instance); we are using this one to send PROCESS or DEINIT commands from Linux to an MDP instance through a VPU write but, while the first wants us to stay 4-bytes aligned, the VPU instead requires an 8-bytes data alignment.
Keeping in mind that these commands are executed immediately after sending them (hence not chained with others before the VPU/MDP "actually" start executing), it is fine to simply add a padding of 4 bytes to this structure: this keeps the same performance as before, as we're still stack-allocating it, while avoiding hackery inside of mtk-vpu to ensure alignment bringing a definitely bigger performance impact.
--- drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h +2 -0
@@ -48,12 +48,14 @@ struct mdp_ipi_init {* @ipi_id : IPI_MDP * @ap_inst : AP mtk_mdp_vpu address * @vpu_inst_addr : VPU MDP instance address +* @padding : Alignment padding */ struct mdp_ipi_comm {uint32_t msg_id;uint32_t ipi_id;uint64_t ap_inst;uint32_t vpu_inst_addr; +uint32_t padding; };/**
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 85/287 mediatek: mt76: mac80211: Fix missing of_node_put() in mt76_led_init()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 0a14c1d0113f121151edf34333cdf212dd209190 ]
We should use of_node_put() for the reference 'np' returned by of_get_child_by_name() which will increase the refcount.
--- drivers/net/wireless/mediatek/mt76/mac80211.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/mac80211.c +1 -0
@@ -114,6 +114,7 @@ static int mt76_led_init(struct mt76_dev *dev)if (!of_property_read_u32 (np,"led-sources" , &led_pin)) dev->led_pin = led_pin; dev->led_al =of_property_read_bool (np,"led-active-low" ); +of_node_put (np); }return devm_led_classdev_register (dev->dev, &dev->led_cdev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 86/287 tcp: make retransmitted SKB fit into the send window
In reply to Greg Kroah-HartmanFrom: Yonglong Li <[email protected]>
[ Upstream commit 536a6c8e05f95e3d1118c40ae8b3022ee2d05d52 ]
current code of __tcp_retransmit_skb only check TCP_SKB_CB(skb)->seq in send window, and TCP_SKB_CB(skb)->seq_end maybe out of send window. If receiver has shrunk his window, and skb is out of new window, it should retransmit a smaller portion of the payload.
test packetdrill script:
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR)
+0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
+0 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) +0 > S 0:0(0) win 65535 <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
+.05 < S. 0:0(0) ack 1 win 6000 <mss 1000,nop,nop,sackOK>
+0 > . 1:1(0) ack 1
+0 write(3, ..., 10000) = 10000
+0 > . 1:2001(2000) ack 1 win 65535
+0 > . 2001:4001(2000) ack 1 win 65535
+0 > . 4001:6001(2000) ack 1 win 65535
+.05 < . 1:1(0) ack 4001 win 1001
and tcpdump show:
192.168.226.67.55 > 192.0.2.1.8080: Flags [.], seq 1:2001, ack 1, win 65535, length 2000 192.168.226.67.55 > 192.0.2.1.8080: Flags [.], seq 2001:4001, ack 1, win 65535, length 2000 192.168.226.67.55 > 192.0.2.1.8080: Flags [P.], seq 4001:5001, ack 1, win 65535, length 1000 192.168.226.67.55 > 192.0.2.1.8080: Flags [.], seq 5001:6001, ack 1, win 65535, length 1000 192.0.2.1.8080 > 192.168.226.67.55: Flags [.], ack 4001, win 1001, length 0 192.168.226.67.55 > 192.0.2.1.8080: Flags [.], seq 5001:6001, ack 1, win 65535, length 1000 192.168.226.67.55 > 192.0.2.1.8080: Flags [P.], seq 4001:5001, ack 1, win 65535, length 1000
when cient retract window to 1001, send window is [4001,5002], but TLP send 5001-6001 packet which is out of send window.
--- net/ipv4/tcp_output.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
net/ipv4/tcp_output.c +16 -7
@@ -2856,7 +2856,7 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs)struct tcp_sock *tp =tcp_sk (sk);unsigned int cur_mss;int diff, len, err; - +int avail_wnd;/* Inconclusive MTU probe */ if (icsk->icsk_mtup.probe_size)
@@ -2886,17 +2886,25 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs)return -EHOSTUNREACH ;/* Routing failure or similar. */ cur_mss =tcp_current_mss (sk); + avail_wnd =tcp_wnd_end (tp) -TCP_SKB_CB (skb)->seq;/* If receiver has shrunk his window, and skb is out of * new window, do not retransmit it. The exception is the * case, when window is shrunk to zero. In this case -* our retransmit serves as a zero window probe. +* our retransmit of one segment serves as a zero window probe. */ -if (!before (TCP_SKB_CB (skb)->seq,tcp_wnd_end (tp)) && -TCP_SKB_CB (skb)->seq != tp->snd_una) -return -EAGAIN ; +if (avail_wnd <=0 ) { +if (TCP_SKB_CB (skb)->seq != tp->snd_una) +return -EAGAIN ; + avail_wnd = cur_mss; + } len = cur_mss * segs; +if (len > avail_wnd) { + len =rounddown (avail_wnd, cur_mss); +if (!len) + len = avail_wnd; + }if (skb->len > len) {if (tcp_fragment (sk,TCP_FRAG_IN_RTX_QUEUE , skb, len, cur_mss,GFP_ATOMIC ))
@@ -2910,8 +2918,9 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs) diff -=tcp_skb_pcount (skb);if (diff)tcp_adjust_pcount (sk, skb, diff); -if (skb->len < cur_mss) -tcp_retrans_try_collapse (sk, skb, cur_mss); + avail_wnd =min_t (int, avail_wnd, cur_mss); +if (skb->len < avail_wnd) +tcp_retrans_try_collapse (sk, skb, avail_wnd); }/* RFC3168, section 6.1.1.1. ECN fallback */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 87/287 libbpf: Fix the name of a reused map
In reply to Greg Kroah-HartmanFrom: Anquan Wu <[email protected]>
[ Upstream commit bf3f00378524adae16628cbadbd11ba7211863bb ]
BPF map name is limited to BPF_OBJ_NAME_LEN.
A map name is defined as being longer than BPF_OBJ_NAME_LEN, it will be truncated to BPF_OBJ_NAME_LEN when a userspace program calls libbpf to create the map. A pinned map also generates a path in the /sys. If the previous program wanted to reuse the map, it can not get bpf_map by name, because the name of the map is only partially the same as the name which get from pinned path.
The syscall information below show that map name "process_pinned_map" is truncated to "process_pinned_".
bpf(BPF_OBJ_GET, {pathname="/sys/fs/bpf/process_pinned_map",
bpf_fd=0, file_flags=0}, 144) = -1 ENOENT (No such file or directory)
bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_HASH, key_size=4,
value_size=4,max_entries=1024, map_flags=0, inner_map_fd=0,
map_name="process_pinned_",map_ifindex=0, btf_fd=3, btf_key_type_id=6,
btf_value_type_id=10,btf_vmlinux_value_type_id=0}, 72) = 4This patch check that if the name of pinned map are the same as the actual name for the first (BPF_OBJ_NAME_LEN - 1),
bpf map still uses the name which is included in bpf object.
--- tools/lib/bpf/libbpf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tools/lib/bpf/libbpf.c +7 -2
@@ -1060,7 +1060,7 @@ static int bpf_map_find_btf_info(struct bpf_map *map, const struct btf *btf)int bpf_map__reuse_fd (struct bpf_map *map,int fd) {struct bpf_map_info info = {}; -__u32 len =sizeof (info); +__u32 len =sizeof (info), name_len;int new_fd, err;char *new_name;
@@ -1068,7 +1068,12 @@ int bpf_map__reuse_fd(struct bpf_map *map, int fd)if (err)return err; - new_name =strdup (info.name); + name_len =strlen (info.name); +if (name_len ==BPF_OBJ_NAME_LEN -1 &&strncmp (map->name, info.name, name_len) ==0 ) + new_name =strdup (map->name); +else + new_name =strdup (info.name); +if (!new_name)return -errno;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 88/287 selftests: timers: valid-adjtimex: build fix for newer toolchains
In reply to Greg Kroah-HartmanFrom: Wolfram Sang <[email protected]>
[ Upstream commit 9a162977d20436be5678a8e21a8e58eb4616d86a ]
Toolchains with an include file 'sys/timex.h' based on 3.18 will have a 'clock_adjtime' definition added, so it can't be static in the code:
valid-adjtimex.c:43:12: error: static declaration of ‘clock_adjtime’ follows non-static declaration
--- tools/testing/selftests/timers/valid-adjtimex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/timers/valid-adjtimex.c +1 -1
@@ -40,7 +40,7 @@#define ADJ_SETOFFSET 0x0100#include <sys/syscall.h> -static int clock_adjtime (clockid_t id,struct timex *tx) +int clock_adjtime (clockid_t id,struct timex *tx) {return syscall (__NR_clock_adjtime, id, tx); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 89/287 selftests: timers: clocksource-switch: fix passing errors from child
In reply to Greg Kroah-HartmanFrom: Wolfram Sang <[email protected]>
[ Upstream commit 4d8f52ac5fa9eede7b7aa2f2d67c841d9eeb655f ]
The return value from system() is a waitpid-style integer. Do not return it directly because with the implicit masking in exit() it will always return 0. Access it with appropriate macros to really pass on errors.
--- tools/testing/selftests/timers/clocksource-switch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/timers/clocksource-switch.c +3 -3
@@ -110,10 +110,10 @@ int run_tests(int secs)sprintf (buf,"./inconsistency-check -t %i" , secs); ret =system (buf); -if (ret) -return ret; +if (WIFEXITED (ret) &&WEXITSTATUS (ret)) +return WEXITSTATUS (ret); ret =system ("./nanosleep" ); -return ret; +return WIFEXITED (ret) ?WEXITSTATUS (ret) :0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 90/287 fs: check FMODE_LSEEK to control internal pipe splicing
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
[ Upstream commit 97ef77c52b789ec1411d360ed99dca1efe4b2c81 ]
The original direct splicing mechanism from Jens required the input to be a regular file because it was avoiding the special socket case. It also recognized blkdevs as being close enough to a regular file. But it forgot about chardevs, which behave the same way and work fine here.
This is an okayish heuristic, but it doesn't totally work. For example, a few chardevs should be spliceable here. And a few regular files shouldn't. This patch fixes this by instead checking whether FMODE_LSEEK is set, which represents decently enough what we need rewinding for when splicing to internal pipes.
--- fs/splice.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
fs/splice.c +4 -6
@@ -899,17 +899,15 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd, {struct pipe_inode_info *pipe;long ret, bytes; -umode_t i_mode;size_t len;int i, flags, more;/* -* We require the input being a regular file, as we don't want to -* randomly drop data for eg socket -> socket splicing. Use the -* piped splicing for that! +* We require the input to be seekable, as we don't want to randomly +* drop data for eg socket -> socket splicing. Use the piped splicing +* for that! */ - i_mode =file_inode (in)->i_mode; -if (unlikely (!S_ISREG (i_mode) && !S_ISBLK (i_mode))) +if (unlikely (!(in->f_mode &FMODE_LSEEK )))return -EINVAL ;/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 91/287 wifi: wil6210: debugfs: fix info leak in wil_write_file_wmi()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 7a4836560a6198d245d5732e26f94898b12eb760 ]
The simple_write_to_buffer() function will succeed if even a single byte is initialized. However, we need to initialize the whole buffer to prevent information leaks. Just use memdup_user().
--- drivers/net/wireless/ath/wil6210/debugfs.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/net/wireless/ath/wil6210/debugfs.c +4 -10
@@ -1004,18 +1004,12 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf,u16 cmdid;int rc, rc1; -if (cmdlen <0 ) +if (cmdlen <0 || *ppos !=0 )return -EINVAL ; - wmi =kmalloc (len,GFP_KERNEL ); -if (!wmi) -return -ENOMEM ; - - rc =simple_write_to_buffer (wmi, len, ppos, buf, len); -if (rc <0 ) { -kfree (wmi); -return rc; - } + wmi =memdup_user (buf, len); +if (IS_ERR (wmi)) +return PTR_ERR (wmi); cmd = (cmdlen >0 ) ? &wmi[1 ] :NULL ; cmdid =le16_to_cpu (wmi->command_id);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 92/287 wifi: p54: Fix an error handling path in p54spi_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 83781f0162d080fec7dcb911afd1bc2f5ad04471 ]
If an error occurs after a successful call to p54spi_request_firmware(), it must be undone by a corresponding release_firmware() as already done in the error handling path of p54spi_request_firmware() and in the .remove() function.
Add the missing call in the error handling path and remove it from p54spi_request_firmware() now that it is the responsibility of the caller to release the firmware
--- drivers/net/wireless/intersil/p54/p54spi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intersil/p54/p54spi.c +2 -1
@@ -177,7 +177,7 @@ static int p54spi_request_firmware(struct ieee80211_hw *dev) ret =p54_parse_firmware (dev, priv->firmware);if (ret) { -release_firmware (priv->firmware); +/* the firmware is released by the caller */ return ret; }
@@ -672,6 +672,7 @@ static int p54spi_probe(struct spi_device *spi)return 0 ; err_free_common: +release_firmware (priv->firmware);free_irq (gpio_to_irq (p54spi_gpio_irq), spi); err_free_gpio_irq:gpio_free (p54spi_gpio_irq);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 93/287 wifi: p54: add missing parentheses in p54_flush()
In reply to Greg Kroah-HartmanFrom: Rustam Subkhankulov <[email protected]>
[ Upstream commit bcfd9d7f6840b06d5988c7141127795cf405805e ]
The assignment of the value to the variable total in the loop condition must be enclosed in additional parentheses, since otherwise, in accordance with the precedence of the operators, the conjunction will be performed first, and only then the assignment.
Due to this error, a warning later in the function after the loop may not occur in the situation when it should.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/wireless/intersil/p54/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intersil/p54/main.c +1 -1
@@ -688,7 +688,7 @@ static void p54_flush(struct ieee80211_hw *dev, struct ieee80211_vif *vif,* queues have already been stopped and no new frames can sneak * up from behind. */ -while ((total =p54_flush_count (priv) && i--)) { +while ((total =p54_flush_count (priv)) && i--) {/* waste time */ msleep (20 ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 94/287 can: pch_can: do not report txerr and rxerr during bus-off
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit 3a5c7e4611ddcf0ef37a3a17296b964d986161a6 ]
During bus off, the error count is greater than 255 and can not fit in a u8.
--- drivers/net/can/pch_can.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/can/pch_can.c +3 -3
@@ -507,6 +507,9 @@ static void pch_can_error(struct net_device *ndev, u32 status) cf->can_id |=CAN_ERR_BUSOFF ; priv->can.can_stats.bus_off++;can_bus_off (ndev); + }else { + cf->data[6 ] = errc &PCH_TEC ; + cf->data[7 ] = (errc &PCH_REC ) >>8 ; } errc =ioread32 (&priv->regs->errc);
@@ -567,9 +570,6 @@ static void pch_can_error(struct net_device *ndev, u32 status)break ; } - cf->data[6 ] = errc &PCH_TEC ; - cf->data[7 ] = (errc &PCH_REC ) >>8 ; - priv->can.state = state;netif_receive_skb (skb);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 95/287 can: rcar_can: do not report txerr and rxerr during bus-off
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit a37b7245e831a641df360ca41db6a71c023d3746 ]
During bus off, the error count is greater than 255 and can not fit in a u8.
--- drivers/net/can/rcar/rcar_can.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/can/rcar/rcar_can.c +4 -4
@@ -233,11 +233,8 @@ static void rcar_can_error(struct net_device *ndev)if (eifr & (RCAR_CAN_EIFR_EWIF |RCAR_CAN_EIFR_EPIF )) { txerr =readb (&priv->regs->tecr); rxerr =readb (&priv->regs->recr); -if (skb) { +if (skb) cf->can_id |=CAN_ERR_CRTL ; - cf->data[6 ] = txerr; - cf->data[7 ] = rxerr; - } }if (eifr &RCAR_CAN_EIFR_BEIF ) {int rx_errors =0 , tx_errors =0 ;
@@ -337,6 +334,9 @@ static void rcar_can_error(struct net_device *ndev)can_bus_off (ndev);if (skb) cf->can_id |=CAN_ERR_BUSOFF ; + }else if (skb) { + cf->data[6 ] = txerr; + cf->data[7 ] = rxerr; }if (eifr &RCAR_CAN_EIFR_ORIF ) {netdev_dbg (priv->ndev,"Receive overrun error interrupt\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 96/287 can: sja1000: do not report txerr and rxerr during bus-off
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit 164d7cb2d5a30f1b3a5ab4fab1a27731fb1494a8 ]
During bus off, the error count is greater than 255 and can not fit in a u8.
--- drivers/net/can/sja1000/sja1000.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/can/sja1000/sja1000.c +4 -3
@@ -405,9 +405,6 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) txerr = priv->read_reg (priv,SJA1000_TXERR ); rxerr = priv->read_reg (priv,SJA1000_RXERR ); - cf->data[6 ] = txerr; - cf->data[7 ] = rxerr; -if (isrc &IRQ_DOI ) {/* data overrun interrupt */ netdev_dbg (dev,"data overrun interrupt\n" );
@@ -429,6 +426,10 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)else state =CAN_STATE_ERROR_ACTIVE ; } +if (state !=CAN_STATE_BUS_OFF ) { + cf->data[6 ] = txerr; + cf->data[7 ] = rxerr; + }if (isrc &IRQ_BEI ) {/* bus error interrupt */ priv->can.can_stats.bus_error++;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 97/287 can: hi311x: do not report txerr and rxerr during bus-off
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit a22bd630cfff496b270211745536e50e98eb3a45 ]
During bus off, the error count is greater than 255 and can not fit in a u8.
--- drivers/net/can/spi/hi311x.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/can/spi/hi311x.c +3 -2
@@ -688,8 +688,6 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id) txerr =hi3110_read (spi,HI3110_READ_TEC ); rxerr =hi3110_read (spi,HI3110_READ_REC ); - cf->data[6 ] = txerr; - cf->data[7 ] = rxerr; tx_state = txerr >= rxerr ? new_state :0 ; rx_state = txerr <= rxerr ? new_state :0 ;can_change_state (net, cf, tx_state, rx_state);
@@ -702,6 +700,9 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id)hi3110_hw_sleep (spi);break ; } + }else { + cf->data[6 ] = txerr; + cf->data[7 ] = rxerr; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 98/287 can: sun4i_can: do not report txerr and rxerr during bus-off
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit 0ac15a8f661b941519379831d09bfb12271b23ee ]
During bus off, the error count is greater than 255 and can not fit in a u8.
--- drivers/net/can/sun4i_can.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/can/sun4i_can.c +4 -5
@@ -525,11 +525,6 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status) rxerr = (errc >>16 ) &0xFF ; txerr = errc &0xFF ; -if (skb) { - cf->data[6 ] = txerr; - cf->data[7 ] = rxerr; - } -if (isrc &SUN4I_INT_DATA_OR ) {/* data overrun interrupt */ netdev_dbg (dev,"data overrun interrupt\n" );
@@ -560,6 +555,10 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status)else state =CAN_STATE_ERROR_ACTIVE ; } +if (skb && state !=CAN_STATE_BUS_OFF ) { + cf->data[6 ] = txerr; + cf->data[7 ] = rxerr; + }if (isrc &SUN4I_INT_BUS_ERR ) {/* bus error interrupt */ netdev_dbg (dev,"bus error interrupt\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 99/287 can: kvaser_usb_hydra: do not report txerr and rxerr during bus-off
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit 936e90595376e64b6247c72d3ea8b8b164b7ac96 ]
During bus off, the error count is greater than 255 and can not fit in a u8.
--- drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +8 -4
@@ -890,8 +890,10 @@ static void kvaser_usb_hydra_update_state(struct kvaser_usb_net_priv *priv, new_state < CAN_STATE_BUS_OFF) priv->can.can_stats.restarts++; - cf->data[6 ] = bec->txerr; - cf->data[7 ] = bec->rxerr; +if (new_state !=CAN_STATE_BUS_OFF ) { + cf->data[6 ] = bec->txerr; + cf->data[7 ] = bec->rxerr; + } stats = &netdev->stats; stats->rx_packets++;
@@ -1045,8 +1047,10 @@ kvaser_usb_hydra_error_frame(struct kvaser_usb_net_priv *priv, shhwtstamps->hwtstamp = hwtstamp; cf->can_id |=CAN_ERR_BUSERROR ; - cf->data[6 ] = bec.txerr; - cf->data[7 ] = bec.rxerr; +if (new_state !=CAN_STATE_BUS_OFF ) { + cf->data[6 ] = bec.txerr; + cf->data[7 ] = bec.rxerr; + } stats->rx_packets++; stats->rx_bytes += cf->can_dlc;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 100/287 can: kvaser_usb_leaf: do not report txerr and rxerr during bus-off
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit a57732084e06791d37ea1ea447cca46220737abd ]
During bus off, the error count is greater than 255 and can not fit in a u8.
--- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +4 -2
@@ -857,8 +857,10 @@ static void kvaser_usb_leaf_rx_error(const struct kvaser_usb *dev,break ; } - cf->data[6 ] = es->txerr; - cf->data[7 ] = es->rxerr; +if (new_state !=CAN_STATE_BUS_OFF ) { + cf->data[6 ] = es->txerr; + cf->data[7 ] = es->rxerr; + } stats->rx_packets++; stats->rx_bytes += cf->can_dlc;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 101/287 can: usb_8dev: do not report txerr and rxerr during bus-off
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit aebe8a2433cd090ccdc222861f44bddb75eb01de ]
During bus off, the error count is greater than 255 and can not fit in a u8.
--- drivers/net/can/usb/usb_8dev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/can/usb/usb_8dev.c +4 -3
@@ -453,9 +453,10 @@ static void usb_8dev_rx_err_msg(struct usb_8dev_priv *priv,if (rx_errors) stats->rx_errors++; - - cf->data[6 ] = txerr; - cf->data[7 ] = rxerr; +if (priv->can.state !=CAN_STATE_BUS_OFF ) { + cf->data[6 ] = txerr; + cf->data[7 ] = rxerr; + } priv->bec.txerr = txerr; priv->bec.rxerr = rxerr;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 102/287 can: error: specify the values of data[5..7] of CAN error frames
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit e70a3263a7eed768d5f947b8f2aff8d2a79c9d97 ]
Currently, data[5..7] of struct can_frame, when used as a CAN error frame, are defined as being "controller specific". Device specific behaviours are problematic because it prevents someone from writing code which is portable between devices.
As a matter of fact, data[5] is never used, data[6] is always used to report TX error counter and data[7] is always used to report RX error counter. can-utils also relies on this.
This patch updates the comment in the uapi header to specify that data[5] is reserved (and thus should not be used) and that data[6..7] are used for error counters.
--- include/uapi/linux/can/error.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/uapi/linux/can/error.h +4 -1
@@ -120,6 +120,9 @@#define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70/* 0111 0000 */ #define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80/* 1000 0000 */ -/* controller specific additional information / data[5..7] */ +/* data[5] is reserved (do not use) */ + +/* TX error counter / data[6] */ +/* RX error counter / data[7] */ #endif /* _UAPI_CAN_ERROR_H */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 103/287 can: pch_can: pch_can_error(): initialize errc before using it
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit 9950f11211331180269867aef848c7cf56861742 ]
After commit 3a5c7e4611dd, the variable errc is accessed before being initialized, c.f. below W=2 warning:
| In function 'pch_can_error', | inlined from 'pch_can_poll' at drivers/net/can/pch_can.c:739:4: | drivers/net/can/pch_can.c:501:29: warning: 'errc' may be used uninitialized [-Wmaybe-uninitialized] | 501 | cf->data[6] = errc & PCH_TEC; | | ^ | drivers/net/can/pch_can.c: In function 'pch_can_poll': | drivers/net/can/pch_can.c:484:13: note: 'errc' was declared here | 484 | u32 errc, lec; | | ^~~~
Moving errc initialization up solves this issue.
--- drivers/net/can/pch_can.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/pch_can.c +1 -1
@@ -500,6 +500,7 @@ static void pch_can_error(struct net_device *ndev, u32 status)if (!skb)return ; + errc =ioread32 (&priv->regs->errc);if (status &PCH_BUS_OFF ) {pch_can_set_tx_all (priv,0 );pch_can_set_rx_all (priv,0 );
@@ -512,7 +513,6 @@ static void pch_can_error(struct net_device *ndev, u32 status) cf->data[7 ] = (errc &PCH_REC ) >>8 ; } - errc =ioread32 (&priv->regs->errc);/* Warning interrupt. */ if (status &PCH_EWARN ) { state =CAN_STATE_ERROR_WARNING ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 104/287 Bluetooth: hci_intel: Add check for platform_driver_register
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit ab2d2a982ff721f4b029282d9a40602ea46a745e ]
As platform_driver_register() could fail, it should be better to deal with the return value in order to maintain the code consisitency.
--- drivers/bluetooth/hci_intel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_intel.c +5 -1
@@ -1253,7 +1253,11 @@ static struct platform_driver intel_driver = {int __init intel_init (void ) { -platform_driver_register (&intel_driver); +int err; + + err =platform_driver_register (&intel_driver); +if (err) +return err;return hci_uart_register_proto (&intel_proto); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 105/287 i2c: cadence: Support PEC for SMBus block read
In reply to Greg Kroah-HartmanFrom: Lars-Peter Clausen <[email protected]>
[ Upstream commit 9fdf6d97f03035ad5298e2d1635036c74c2090ed ]
SMBus packet error checking (PEC) is implemented by appending one additional byte of checksum data at the end of the message. This provides additional protection and allows to detect data corruption on the I2C bus.
SMBus block reads support variable length reads. The first byte in the read message is the number of available data bytes.
The combination of PEC and block read is currently not supported by the Cadence I2C driver.
* When PEC is enabled the maximum transfer length for block reads increases from 33 to 34 bytes.
* The I2C core smbus emulation layer relies on the driver updating the i2c_msg len field with the number of received bytes. The updated length is used when checking the PEC.
Add support to the Cadence I2C driver for handling SMBus block reads with PEC. To determine the maximum transfer length uses the initial len value of the i2c_msg. When PEC is enabled this will be 2, when it is disabled it will be 1.
Once a read transfer is done also increment the len field by the amount of received data bytes.
This change has been tested with a UCM90320 PMBus power monitor, which requires block reads to access certain data fields, but also has PEC enabled by default.
--- drivers/i2c/busses/i2c-cadence.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-cadence.c +9 -1
@@ -353,8 +353,13 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id) ctrl_reg =cdns_i2c_readreg (CDNS_I2C_CR_OFFSET ); ctrl_reg |=CDNS_I2C_CR_RW |CDNS_I2C_CR_CLR_FIFO ; +/* +* Receive up to I2C_SMBUS_BLOCK_MAX data bytes, plus one message length +* byte, plus one checksum byte if PEC is enabled. p_msg->len will be 2 if +* PEC is enabled, otherwise 1. +*/ if (id->p_msg->flags &I2C_M_RECV_LEN ) - id->recv_count =I2C_SMBUS_BLOCK_MAX +1 ; + id->recv_count =I2C_SMBUS_BLOCK_MAX + id->p_msg->len; id->curr_recv_count = id->recv_count;
@@ -540,6 +545,9 @@ static int cdns_i2c_process_msg(struct cdns_i2c *id, struct i2c_msg *msg,if (id->err_status &CDNS_I2C_IXR_ARB_LOST )return -EAGAIN ; +if (msg->flags &I2C_M_RECV_LEN ) + msg->len += min_t(unsigned int, msg->buf[0], I2C_SMBUS_BLOCK_MAX); +return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 106/287 i2c: mux-gpmux: Add of_node_put() when breaking out of loop
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 6435319c34704994e19b0767f6a4e6f37439867b ]
In i2c_mux_probe(), we should call of_node_put() when breaking out of for_each_child_of_node() which will automatically increase and decrease the refcount.
--- drivers/i2c/muxes/i2c-mux-gpmux.c | 1 + 1 file changed, 1 insertion(+)
drivers/i2c/muxes/i2c-mux-gpmux.c +1 -0
@@ -141,6 +141,7 @@ static int i2c_mux_probe(struct platform_device *pdev)return 0 ; err_children: +of_node_put (child);i2c_mux_del_adapters (muxc); err_parent:i2c_put_adapter (parent);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 107/287 wifi: wil6210: debugfs: fix uninitialized variable use in `wil_write_file_wmi()`
In reply to Greg Kroah-HartmanFrom: Ammar Faizi <[email protected]>
[ Upstream commit d578e0af3a003736f6c440188b156483d451b329 ]
Commit 7a4836560a61 changes simple_write_to_buffer() with memdup_user() but it forgets to change the value to be returned that came from simple_write_to_buffer() call. It results in the following warning:
warning: variable 'rc' is uninitialized when used here [-Wuninitialized]
return rc;
^~Remove rc variable and just return the passed in length if the memdup_user() succeeds.
--- drivers/net/wireless/ath/wil6210/debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/wil6210/debugfs.c +2 -2
@@ -1002,7 +1002,7 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf,void *cmd;int cmdlen = len -sizeof (struct wmi_cmd_hdr );u16 cmdid; -int rc, rc1; +int rc1;if (cmdlen <0 || *ppos !=0 )return -EINVAL ;
@@ -1019,7 +1019,7 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf,wil_info (wil,"0x%04x[%d] -> %d\n" , cmdid, cmdlen, rc1); -return rc; +return len; }static const struct file_operations fops_wmi = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 108/287 wifi: libertas: Fix possible refcount leak in if_usb_probe()
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
[ Upstream commit 6fd57e1d120bf13d4dc6c200a7cf914e6347a316 ]
usb_get_dev will be called before lbs_get_firmware_async which means that usb_put_dev need to be called when lbs_get_firmware_async fails.
--- drivers/net/wireless/marvell/libertas/if_usb.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/marvell/libertas/if_usb.c +1 -0
@@ -283,6 +283,7 @@ static int if_usb_probe(struct usb_interface *intf,return 0 ; err_get_fw: +usb_put_dev (udev);lbs_remove_card (priv); err_add_card:if_usb_reset_device (cardp);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 109/287 net/mlx5e: Fix the value of MLX5E_MAX_RQ_NUM_MTTS
In reply to Greg Kroah-HartmanFrom: Maxim Mikityanskiy <[email protected]>
[ Upstream commit 562696c3c62c7c23dd896e9447252ce9268cb812 ]
MLX5E_MAX_RQ_NUM_MTTS should be the maximum value, so that MLX5_MTT_OCTW(MLX5E_MAX_RQ_NUM_MTTS) fits into u16. The current value of 1 << 17 results in MLX5_MTT_OCTW(1 << 17) = 1 << 16, which doesn't fit into u16. This commit replaces it with the maximum value that still fits u16.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +1 -1
@@ -95,7 +95,7 @@ struct page_pool;#define MLX5E_LOG_ALIGNED_MPWQE_PPW (ilog2(MLX5E_REQUIRED_WQE_MTTS))#define MLX5E_REQUIRED_MTTS (wqes) (wqes * MLX5E_REQUIRED_WQE_MTTS)#define MLX5E_MAX_RQ_NUM_MTTS \ - ((1 << 16) * 2)/* So that MLX5_MTT_OCTW(num_mtts) fits into u16 */ + (ALIGN_DOWN(U16_MAX, 4) * 2)/* So that MLX5_MTT_OCTW(num_mtts) fits into u16 */ #define MLX5E_ORDER2_MAX_PACKET_MTU (order_base_2(10 * 1024))#define MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE_MPW \ (ilog2(MLX5E_MAX_RQ_NUM_MTTS / MLX5E_REQUIRED_WQE_MTTS))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 110/287 netdevsim: Avoid allocation warnings triggered from user space
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit d0b80a9edb1a029ff913e81b47540e57ad034329 ]
We need to suppress warnings from sily map sizes. Also switch from GFP_USER to GFP_KERNEL_ACCOUNT, I'm pretty sure I misunderstood the flags when writing this code.
--- drivers/net/netdevsim/bpf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/netdevsim/bpf.c +5 -3
@@ -330,10 +330,12 @@ nsim_map_alloc_elem(struct bpf_offloaded_map *offmap, unsigned int idx) {struct nsim_bpf_bound_map *nmap = offmap->dev_priv; - nmap->entry[idx].key =kmalloc (offmap->map.key_size,GFP_USER ); + nmap->entry[idx].key =kmalloc (offmap->map.key_size, +GFP_KERNEL_ACCOUNT | __GFP_NOWARN);if (!nmap->entry[idx].key)return -ENOMEM ; - nmap->entry[idx].value =kmalloc (offmap->map.value_size,GFP_USER ); + nmap->entry[idx].value =kmalloc (offmap->map.value_size, +GFP_KERNEL_ACCOUNT | __GFP_NOWARN);if (!nmap->entry[idx].value) {kfree (nmap->entry[idx].key); nmap->entry[idx].key =NULL ;
@@ -475,7 +477,7 @@ nsim_bpf_map_alloc(struct netdevsim *ns, struct bpf_offloaded_map *offmap)if (offmap->map.map_flags)return -EINVAL ; - nmap =kzalloc (sizeof (*nmap),GFP_USER ); + nmap =kzalloc (sizeof (*nmap),GFP_KERNEL_ACCOUNT );if (!nmap)return -ENOMEM ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 111/287 net: rose: fix netdev reference changes
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 931027820e4dafabc78aff82af59f8c1c4bd3128 ]
Bernard reported that trying to unload rose module would lead to infamous messages:
unregistered_netdevice: waiting for rose0 to become free. Usage count = xx
This patch solves the issue, by making sure each socket referring to a netdevice holds a reference count on it, and properly releases it in rose_release().
rose_dev_first() is also fixed to take a device reference before leaving the rcu_read_locked section.
Following patch will add ref_tracker annotations to ease future bug hunting.
--- net/rose/af_rose.c | 11 +++++++++-- net/rose/rose_route.c | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-)
net/rose/af_rose.c +9 -2
@@ -194,6 +194,7 @@ static void rose_kill_by_device(struct net_device *dev)rose_disconnect (s,ENETUNREACH ,ROSE_OUT_OF_ORDER ,0 );if (rose->neighbour) rose->neighbour->use--; +dev_put (rose->device); rose->device =NULL ; } }
@@ -594,6 +595,8 @@ static struct sock *rose_make_new(struct sock *osk) rose->idle = orose->idle; rose->defer = orose->defer; rose->device = orose->device; +if (rose->device) +dev_hold (rose->device); rose->qbitincl = orose->qbitincl;return sk;
@@ -647,6 +650,7 @@ static int rose_release(struct socket *sock)break ; } +dev_put (rose->device); sock->sk =NULL ;release_sock (sk);sock_put (sk);
@@ -721,7 +725,6 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_lestruct rose_sock *rose =rose_sk (sk);struct sockaddr_rose *addr = (struct sockaddr_rose *)uaddr;unsigned char cause, diagnostic; -struct net_device *dev;ax25_uid_assoc *user;int n, err =0 ;
@@ -778,9 +781,12 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le }if (sock_flag (sk,SOCK_ZAPPED )) {/* Must bind first - autobinding in this may or may not work */ +struct net_device *dev; +sock_reset_flag (sk,SOCK_ZAPPED ); -if ((dev =rose_dev_first ()) ==NULL ) { + dev =rose_dev_first (); +if (!dev) { err = -ENETUNREACH ; goto out_release; }
@@ -788,6 +794,7 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le user =ax25_findbyuid (current_euid ());if (!user) { err = -EINVAL ; +dev_put (dev); goto out_release; }
net/rose/rose_route.c +2 -0
@@ -616,6 +616,8 @@ struct net_device *rose_dev_first(void)if (first ==NULL ||strncmp (dev->name, first->name,3 ) <0 ) first = dev; } +if (first) +dev_hold (first);rcu_read_unlock ();return first;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 112/287 dccp: put dccp_qpolicy_full() and dccp_qpolicy_push() in the same lock
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
[ Upstream commit a41b17ff9dacd22f5f118ee53d82da0f3e52d5e3 ]
In the case of sk->dccps_qpolicy == DCCPQ_POLICY_PRIO, dccp_qpolicy_full will drop a skb when qpolicy is full. And the lock in dccp_sendmsg is released before sock_alloc_send_skb and then relocked after sock_alloc_send_skb. The following conditions may lead dccp_qpolicy_push to add skb to an already full sk_write_queue:
thread1--->lock
thread1--->dccp_qpolicy_full: queue is full. drop a skb thread1--->unlock
thread2--->lock
thread2--->dccp_qpolicy_full: queue is not full. no need to drop. thread2--->unlock
thread1--->lock
thread1--->dccp_qpolicy_push: add a skb. queue is full. thread1--->unlock
thread2--->lock
thread2--->dccp_qpolicy_push: add a skb! thread2--->unlock
Fix this by moving dccp_qpolicy_full.
--- net/dccp/proto.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/dccp/proto.c +5 -5
@@ -769,11 +769,6 @@ int dccp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)lock_sock (sk); -if (dccp_qpolicy_full (sk)) { - rc = -EAGAIN ; - goto out_release; - } - timeo =sock_sndtimeo (sk, noblock);/*
@@ -792,6 +787,11 @@ int dccp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)if (skb ==NULL ) goto out_release; +if (dccp_qpolicy_full (sk)) { + rc = -EAGAIN ; + goto out_discard; + } +if (sk->sk_state ==DCCP_CLOSED ) { rc = -ENOTCONN ; goto out_discard;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 113/287 clk: renesas: r9a06g032: Fix UART clkgrp bitsel
In reply to Greg Kroah-HartmanFrom: Ralph Siemsen <[email protected]>
[ Upstream commit 2dee50ab9e72a3cae75b65e5934c8dd3e9bf01bc ]
There are two UART clock groups, each having a mux to select its upstream clock source. The register/bit definitions for accessing these two muxes appear to have been reversed since introduction. Correct them so as to match the hardware manual.
--- drivers/clk/renesas/r9a06g032-clocks.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/renesas/r9a06g032-clocks.c +4 -4
@@ -277,8 +277,8 @@ static const struct r9a06g032_clkdesc r9a06g032_clocks[] __initconst = { .name = "uart_group_012", .type = K_BITSEL, .source = 1 + R9A06G032_DIV_UART, - /* R9A06G032_SYSCTRL_REG_PWRCTRL_PG1_PR2 */ - .dual.sel = ((0xec / 4) << 5) | 24, + /* R9A06G032_SYSCTRL_REG_PWRCTRL_PG0_0 */ + .dual.sel = ((0x34 / 4) << 5) | 30, .dual.group = 0, }, {
@@ -286,8 +286,8 @@ static const struct r9a06g032_clkdesc r9a06g032_clocks[] __initconst = { .name = "uart_group_34567", .type = K_BITSEL, .source = 1 + R9A06G032_DIV_P2_PG, -/* R9A06G032_SYSCTRL_REG_PWRCTRL_PG0_0 */ - .dual.sel = ((0x34 / 4) << 5) | 30, +/* R9A06G032_SYSCTRL_REG_PWRCTRL_PG1_PR2 */ + .dual.sel = ((0xec / 4) << 5) | 24, .dual.group =1 , }, D_UGATE(CLK_UART0, "clk_uart0", UART_GROUP_012, 0, 0, 0x1b2, 0x1b3, 0x1b4, 0x1b5),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 114/287 mtd: maps: Fix refcount leak in of_flash_probe_versatile
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 33ec82a6d2b119938f26e5c8040ed5d92378eb54 ]
of_find_matching_node_and_match() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/mtd/maps/physmap_of_versatile.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/maps/physmap_of_versatile.c +1 -0
@@ -221,6 +221,7 @@ int of_flash_probe_versatile(struct platform_device *pdev, versatile_flashprot = (enum versatile_flashprot )devid->data; rmap =syscon_node_to_regmap (sysnp); +of_node_put (sysnp);if (IS_ERR (rmap))return PTR_ERR (rmap);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 115/287 mtd: maps: Fix refcount leak in ap_flash_init
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 77087a04c8fd554134bddcb8a9ff87b21f357926 ]
of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/mtd/maps/physmap_of_versatile.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/maps/physmap_of_versatile.c +1 -0
@@ -107,6 +107,7 @@ static int ap_flash_init(struct platform_device *pdev)return -ENODEV ; } ebi_base =of_iomap (ebi,0 ); +of_node_put (ebi);if (!ebi_base)return -ENODEV ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 116/287 HID: cp2112: prevent a buffer overflow in cp2112_xfer()
In reply to Greg Kroah-HartmanFrom: Harshit Mogalapalli <[email protected]>
[ Upstream commit 381583845d19cb4bd21c8193449385f3fefa9caf ]
Smatch warnings:drivers/hid/hid-cp2112.c:793 cp2112_xfer() error: __memcpy() 'data->block[1]' too small (33 vs 255) drivers/hid/hid-cp2112.c:793 cp2112_xfer() error: __memcpy() 'buf' too small (64 vs 255)
The 'read_length' variable is provided by 'data->block[0]' which comes from user and it(read_length) can take a value between 0-255. Add an upper bound to 'read_length' variable to prevent a buffer overflow in memcpy().
--- drivers/hid/hid-cp2112.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hid/hid-cp2112.c +5 -0
@@ -794,6 +794,11 @@ static int cp2112_xfer(struct i2c_adapter *adap, u16 addr, data->word =le16_to_cpup ((__le16 *)buf);break ;case I2C_SMBUS_I2C_BLOCK_DATA : +if (read_length >I2C_SMBUS_BLOCK_MAX ) { + ret = -EINVAL ; + goto power_normal; + } +memcpy (data->block +1 , buf, read_length);break ;case I2C_SMBUS_BLOCK_DATA :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 117/287 mtd: sm_ftl: Fix deadlock caused by cancel_work_sync in sm_release
In reply to Greg Kroah-HartmanFrom: Duoming Zhou <[email protected]>
[ Upstream commit a61528d997619a518ee8c51cf0ef0513021afaff ]
There is a deadlock between sm_release and sm_cache_flush_work which is a work item. The cancel_work_sync in sm_release will not return until sm_cache_flush_work is finished. If we hold mutex_lock and use cancel_work_sync to wait the work item to finish, the work item also requires mutex_lock. As a result, the sm_release will be blocked forever. The race condition is shown below:
(Thread 1) | (Thread 2)
sm_release |
mutex_lock(&ftl->mutex) | sm_cache_flush_work
| mutex_lock(&ftl->mutex)
cancel_work_sync | ...This patch moves del_timer_sync and cancel_work_sync out of mutex_lock in order to mitigate deadlock.
--- drivers/mtd/sm_ftl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/sm_ftl.c +1 -1
@@ -1091,9 +1091,9 @@ static void sm_release(struct mtd_blktrans_dev *dev) {struct sm_ftl *ftl = dev->priv; -mutex_lock (&ftl->mutex);del_timer_sync (&ftl->timer);cancel_work_sync (&ftl->flush_work); +mutex_lock (&ftl->mutex);sm_cache_flush (ftl);mutex_unlock (&ftl->mutex); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 118/287 mtd: st_spi_fsm: Add a clk_disable_unprepare() in .probe()s error path
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 28607b426c3d050714f250d0faeb99d2e9106e90 ]
For all but one error path clk_disable_unprepare() is already there. Add it to the one location where it's missing.
--- drivers/mtd/devices/st_spi_fsm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/mtd/devices/st_spi_fsm.c +5 -3
@@ -2120,10 +2120,12 @@ static int stfsm_probe(struct platform_device *pdev) (long long )fsm->mtd.size, (long long )(fsm->mtd.size >>20 ), fsm->mtd.erasesize, (fsm->mtd.erasesize >> 10)); -return mtd_device_register (&fsm->mtd,NULL ,0 ); - + ret =mtd_device_register (&fsm->mtd,NULL ,0 ); +if (ret) { err_clk_unprepare: -clk_disable_unprepare (fsm->clk); +clk_disable_unprepare (fsm->clk); + } +return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 119/287 fpga: altera-pr-ip: fix unsigned comparison with less than zero
In reply to Greg Kroah-HartmanFrom: Marco Pagani <[email protected]>
[ Upstream commit 2df84a757d87fd62869fc401119d429735377ec5 ]
Fix the "comparison with less than zero" warning reported by cppcheck for the unsigned (size_t) parameter count of the alt_pr_fpga_write() function.
--- drivers/fpga/altera-pr-ip-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/altera-pr-ip-core.c +1 -1
@@ -108,7 +108,7 @@ static int alt_pr_fpga_write(struct fpga_manager *mgr, const char *buf,u32 *buffer_32 = (u32 *)buf;size_t i =0 ; -if (count <=0 ) +if (!count)return -EINVAL ;/* Write out the complete 32-bit chunks */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 120/287 usb: host: Fix refcount leak in ehci_hcd_ppc_of_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit b5c5b13cb45e2c88181308186b0001992cb41954 ]
of_find_compatible_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak.
--- drivers/usb/host/ehci-ppc-of.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/ehci-ppc-of.c +1 -0
@@ -148,6 +148,7 @@ static int ehci_hcd_ppc_of_probe(struct platform_device *op) }else { ehci->has_amcc_usb23 =1 ; } +of_node_put (np); }if (of_get_property (dn,"big-endian" ,NULL )) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 121/287 usb: ohci-nxp: Fix refcount leak in ohci_hcd_nxp_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 302970b4cad3ebfda2c05ce06c322ccdc447d17e ]
of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/usb/host/ohci-nxp.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/ohci-nxp.c +1 -0
@@ -153,6 +153,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev) } isp1301_i2c_client =isp1301_get_client (isp1301_node); +of_node_put (isp1301_node);if (!isp1301_i2c_client)return -EPROBE_DEFER ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 122/287 misc: rtsx: Fix an error handling path in rtsx_pci_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 44fd1917314e9d4f53dd95dd65df1c152f503d3a ]
If an error occurs after a successful idr_alloc() call, the corresponding resource must be released with idr_remove() as already done in the .remove function.
Update the error handling path to add the missing idr_remove() call.
--- drivers/misc/cardreader/rtsx_pcr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/misc/cardreader/rtsx_pcr.c +5 -1
@@ -1479,7 +1479,7 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, pcr->remap_addr =ioremap_nocache (base, len);if (!pcr->remap_addr) { ret = -ENOMEM ; - goto free_handle; + goto free_idr; } pcr->rtsx_resv_buf = dma_alloc_coherent(&(pcidev->dev),
@@ -1541,6 +1541,10 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, pcr->rtsx_resv_buf, pcr->rtsx_resv_buf_addr); unmap:iounmap (pcr->remap_addr); +free_idr: +spin_lock (&rtsx_pci_lock); +idr_remove (&rtsx_pci_idr, pcr->id); +spin_unlock (&rtsx_pci_lock); free_handle:kfree (handle); free_pcr:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 123/287 clk: qcom: ipq8074: fix NSS port frequency tables
In reply to Greg Kroah-HartmanFrom: Robert Marko <[email protected]>
[ Upstream commit 0e9e61a2815b5cd34f1b495b2d72e8127ce9b794 ]
NSS port 5 and 6 frequency tables are currently broken and are causing a wide ranges of issue like 1G not working at all on port 6 or port 5 being clocked with 312 instead of 125 MHz as UNIPHY1 gets selected.
So, update the frequency tables with the ones from the downstream QCA 5.4 based kernel which has already fixed this.
--- drivers/clk/qcom/gcc-ipq8074.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/clk/qcom/gcc-ipq8074.c +8 -0
@@ -1796,8 +1796,10 @@ static struct clk_regmap_div nss_port4_tx_div_clk_src = {static const struct freq_tbl ftbl_nss_port5_rx_clk_src[] = {F (19200000 ,P_XO ,1 ,0 ,0 ),F (25000000 ,P_UNIPHY1_RX ,12.5 ,0 ,0 ), +F (25000000 ,P_UNIPHY0_RX ,5 ,0 ,0 ),F (78125000 ,P_UNIPHY1_RX ,4 ,0 ,0 ),F (125000000 ,P_UNIPHY1_RX ,2.5 ,0 ,0 ), +F (125000000 ,P_UNIPHY0_RX ,1 ,0 ,0 ),F (156250000 ,P_UNIPHY1_RX ,2 ,0 ,0 ),F (312500000 ,P_UNIPHY1_RX ,1 ,0 ,0 ), { }
@@ -1836,8 +1838,10 @@ static struct clk_regmap_div nss_port5_rx_div_clk_src = {static const struct freq_tbl ftbl_nss_port5_tx_clk_src[] = {F (19200000 ,P_XO ,1 ,0 ,0 ),F (25000000 ,P_UNIPHY1_TX ,12.5 ,0 ,0 ), +F (25000000 ,P_UNIPHY0_TX ,5 ,0 ,0 ),F (78125000 ,P_UNIPHY1_TX ,4 ,0 ,0 ),F (125000000 ,P_UNIPHY1_TX ,2.5 ,0 ,0 ), +F (125000000 ,P_UNIPHY0_TX ,1 ,0 ,0 ),F (156250000 ,P_UNIPHY1_TX ,2 ,0 ,0 ),F (312500000 ,P_UNIPHY1_TX ,1 ,0 ,0 ), { }
@@ -1875,8 +1879,10 @@ static struct clk_regmap_div nss_port5_tx_div_clk_src = {static const struct freq_tbl ftbl_nss_port6_rx_clk_src[] = {F (19200000 ,P_XO ,1 ,0 ,0 ), +F (25000000 ,P_UNIPHY2_RX ,5 ,0 ,0 ),F (25000000 ,P_UNIPHY2_RX ,12.5 ,0 ,0 ),F (78125000 ,P_UNIPHY2_RX ,4 ,0 ,0 ), +F (125000000 ,P_UNIPHY2_RX ,1 ,0 ,0 ),F (125000000 ,P_UNIPHY2_RX ,2.5 ,0 ,0 ),F (156250000 ,P_UNIPHY2_RX ,2 ,0 ,0 ),F (312500000 ,P_UNIPHY2_RX ,1 ,0 ,0 ),
@@ -1915,8 +1921,10 @@ static struct clk_regmap_div nss_port6_rx_div_clk_src = {static const struct freq_tbl ftbl_nss_port6_tx_clk_src[] = {F (19200000 ,P_XO ,1 ,0 ,0 ), +F (25000000 ,P_UNIPHY2_TX ,5 ,0 ,0 ),F (25000000 ,P_UNIPHY2_TX ,12.5 ,0 ,0 ),F (78125000 ,P_UNIPHY2_TX ,4 ,0 ,0 ), +F (125000000 ,P_UNIPHY2_TX ,1 ,0 ,0 ),F (125000000 ,P_UNIPHY2_TX ,2.5 ,0 ,0 ),F (156250000 ,P_UNIPHY2_TX ,2 ,0 ,0 ),F (312500000 ,P_UNIPHY2_TX ,1 ,0 ,0 ),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 124/287 clk: qcom: ipq8074: set BRANCH_HALT_DELAY flag for UBI clocks
In reply to Greg Kroah-HartmanFrom: Robert Marko <[email protected]>
[ Upstream commit 2bd357e698207e2e65db03007e4be65bf9d6a7b3 ]
Currently, attempting to enable the UBI clocks will cause the stuck at off warning to be printed and clk_enable will fail.
[ 14.936694] gcc_ubi1_ahb_clk status stuck at 'off'
Downstream 5.4 QCA kernel has fixed this by seting the BRANCH_HALT_DELAY flag on UBI clocks, so lets do the same.
--- drivers/clk/qcom/gcc-ipq8074.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/clk/qcom/gcc-ipq8074.c +10 -0
@@ -3362,6 +3362,7 @@ static struct clk_branch gcc_nssnoc_ubi1_ahb_clk = {static struct clk_branch gcc_ubi0_ahb_clk = { .halt_reg =0x6820c , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x6820c , .enable_mask =BIT (0 ),
@@ -3379,6 +3380,7 @@ static struct clk_branch gcc_ubi0_ahb_clk = {static struct clk_branch gcc_ubi0_axi_clk = { .halt_reg =0x68200 , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x68200 , .enable_mask =BIT (0 ),
@@ -3396,6 +3398,7 @@ static struct clk_branch gcc_ubi0_axi_clk = {static struct clk_branch gcc_ubi0_nc_axi_clk = { .halt_reg =0x68204 , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x68204 , .enable_mask =BIT (0 ),
@@ -3413,6 +3416,7 @@ static struct clk_branch gcc_ubi0_nc_axi_clk = {static struct clk_branch gcc_ubi0_core_clk = { .halt_reg =0x68210 , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x68210 , .enable_mask =BIT (0 ),
@@ -3430,6 +3434,7 @@ static struct clk_branch gcc_ubi0_core_clk = {static struct clk_branch gcc_ubi0_mpt_clk = { .halt_reg =0x68208 , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x68208 , .enable_mask =BIT (0 ),
@@ -3447,6 +3452,7 @@ static struct clk_branch gcc_ubi0_mpt_clk = {static struct clk_branch gcc_ubi1_ahb_clk = { .halt_reg =0x6822c , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x6822c , .enable_mask =BIT (0 ),
@@ -3464,6 +3470,7 @@ static struct clk_branch gcc_ubi1_ahb_clk = {static struct clk_branch gcc_ubi1_axi_clk = { .halt_reg =0x68220 , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x68220 , .enable_mask =BIT (0 ),
@@ -3481,6 +3488,7 @@ static struct clk_branch gcc_ubi1_axi_clk = {static struct clk_branch gcc_ubi1_nc_axi_clk = { .halt_reg =0x68224 , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x68224 , .enable_mask =BIT (0 ),
@@ -3498,6 +3506,7 @@ static struct clk_branch gcc_ubi1_nc_axi_clk = {static struct clk_branch gcc_ubi1_core_clk = { .halt_reg =0x68230 , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x68230 , .enable_mask =BIT (0 ),
@@ -3515,6 +3524,7 @@ static struct clk_branch gcc_ubi1_core_clk = {static struct clk_branch gcc_ubi1_mpt_clk = { .halt_reg =0x68228 , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x68228 , .enable_mask =BIT (0 ),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 125/287 soundwire: bus_type: fix remove and shutdown support
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit df6407782964dc7e35ad84230abb38f46314b245 ]
The bus sdw_drv_remove() and sdw_drv_shutdown() helpers are used conditionally, if the driver provides these routines.
These helpers already test if the driver provides a .remove or .shutdown callback, so there's no harm in invoking the sdw_drv_remove() and sdw_drv_shutdown() unconditionally.
In addition, the current code is imbalanced with dev_pm_domain_attach() called from sdw_drv_probe(), but dev_pm_domain_detach() called from sdw_drv_remove() only if the driver provides a .remove callback.
--- drivers/soundwire/bus_type.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/soundwire/bus_type.c +2 -6
@@ -154,12 +154,8 @@ int __sdw_register_driver(struct sdw_driver *drv, struct module *owner) drv->driver.owner = owner; drv->driver.probe = sdw_drv_probe; - -if (drv->remove) - drv->driver.remove = sdw_drv_remove; - -if (drv->shutdown) - drv->driver.shutdown = sdw_drv_shutdown; + drv->driver.remove = sdw_drv_remove; + drv->driver.shutdown = sdw_drv_shutdown;return driver_register (&drv->driver); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 126/287 staging: rtl8192u: Fix sleep in atomic context bug in dm_fsync_timer_callback
In reply to Greg Kroah-HartmanFrom: Duoming Zhou <[email protected]>
[ Upstream commit 6a0c054930d554ad8f8044ef1fc856d9da391c81 ]
There are sleep in atomic context bugs when dm_fsync_timer_callback is executing. The root cause is that the memory allocation functions with GFP_KERNEL or GFP_NOIO parameters are called in dm_fsync_timer_callback which is a timer handler. The call paths that could trigger bugs are shown below:
(interrupt context)dm_fsync_timer_callback
write_nic_byte
kzalloc(sizeof(data), GFP_KERNEL); //may sleep usb_control_msg
kmalloc(.., GFP_NOIO); //may sleep
write_nic_dword
kzalloc(sizeof(data), GFP_KERNEL); //may sleep usb_control_msg
kmalloc(.., GFP_NOIO); //may sleep
This patch uses delayed work to replace timer and moves the operations that may sleep into the delayed work in order to mitigate bugs.
--- drivers/staging/rtl8192u/r8192U.h | 2 +- drivers/staging/rtl8192u/r8192U_dm.c | 38 +++++++++++++--------------- drivers/staging/rtl8192u/r8192U_dm.h | 2 +- 3 files changed, 20 insertions(+), 22 deletions(-)
drivers/staging/rtl8192u/r8192U.h +1 -1
@@ -1000,7 +1000,7 @@ typedef struct r8192_priv {bool bis_any_nonbepkts;bool bcurrent_turbo_EDCA;bool bis_cur_rdlstate; -struct timer_list fsync_timer; +struct delayed_work fsync_work;bool bfsync_processing;/* 500ms Fsync timer is active or not */ u32 rate_record;u32 rateCountDiffRecord;
drivers/staging/rtl8192u/r8192U_dm.c +18 -20
@@ -2627,19 +2627,20 @@ static void dm_init_fsync(struct net_device *dev) priv->ieee80211->fsync_seconddiff_ratethreshold =200 ; priv->ieee80211->fsync_state = Default_Fsync; priv->framesyncMonitor =1 ;/* current default 0xc38 monitor on */ -timer_setup (&priv->fsync_timer, dm_fsync_timer_callback,0 ); +INIT_DELAYED_WORK (&priv->fsync_work, dm_fsync_work_callback); }static void dm_deInit_fsync (struct net_device *dev) {struct r8192_priv *priv =ieee80211_priv (dev); -del_timer_sync (&priv->fsync_timer); +cancel_delayed_work_sync (&priv->fsync_work); } -void dm_fsync_timer_callback (struct timer_list *t) +void dm_fsync_work_callback (struct work_struct *work) { -struct r8192_priv *priv =from_timer (priv, t, fsync_timer); +struct r8192_priv *priv = + container_of(work, struct r8192_priv, fsync_work.work);struct net_device *dev = priv->ieee80211->dev;u32 rate_index, rate_count =0 , rate_count_diff =0 ;bool bSwitchFromCountDiff = false;
@@ -2706,17 +2707,16 @@ void dm_fsync_timer_callback(struct timer_list *t) } }if (bDoubleTimeInterval) { -if (timer_pending (&priv->fsync_timer)) -del_timer_sync (&priv->fsync_timer); - priv->fsync_timer.expires = jiffies + -msecs_to_jiffies (priv->ieee80211->fsync_time_interval*priv->ieee80211->fsync_multiple_timeinterval); -add_timer (&priv->fsync_timer); +cancel_delayed_work_sync (&priv->fsync_work); +schedule_delayed_work (&priv->fsync_work, +msecs_to_jiffies (priv + ->ieee80211->fsync_time_interval * + priv->ieee80211->fsync_multiple_timeinterval)); }else { -if (timer_pending (&priv->fsync_timer)) -del_timer_sync (&priv->fsync_timer); - priv->fsync_timer.expires = jiffies + -msecs_to_jiffies (priv->ieee80211->fsync_time_interval); -add_timer (&priv->fsync_timer); +cancel_delayed_work_sync (&priv->fsync_work); +schedule_delayed_work (&priv->fsync_work, +msecs_to_jiffies (priv + ->ieee80211->fsync_time_interval)); } }else {/* Let Register return to default value; */
@@ -2744,7 +2744,7 @@ static void dm_EndSWFsync(struct net_device *dev)struct r8192_priv *priv =ieee80211_priv (dev);RT_TRACE (COMP_HALDM ,"%s\n" , __func__); -del_timer_sync (&(priv->fsync_timer)); +cancel_delayed_work_sync (&priv->fsync_work);/* Let Register return to default value; */ if (priv->bswitch_fsync) {
@@ -2786,11 +2786,9 @@ static void dm_StartSWFsync(struct net_device *dev)if (priv->ieee80211->fsync_rate_bitmap & rateBitmap) priv->rate_record += priv->stats.received_rate_histogram[1 ][rateIndex]; } -if (timer_pending (&priv->fsync_timer)) -del_timer_sync (&priv->fsync_timer); - priv->fsync_timer.expires = jiffies + -msecs_to_jiffies (priv->ieee80211->fsync_time_interval); -add_timer (&priv->fsync_timer); +cancel_delayed_work_sync (&priv->fsync_work); +schedule_delayed_work (&priv->fsync_work, +msecs_to_jiffies (priv->ieee80211->fsync_time_interval));write_nic_dword (dev, rOFDM0_RxDetector2,0x465c12cd );
drivers/staging/rtl8192u/r8192U_dm.h +1 -1
@@ -167,7 +167,7 @@ void dm_force_tx_fw_info(struct net_device *dev,void dm_init_edca_turbo (struct net_device *dev);void dm_rf_operation_test_callback (unsigned long data);void dm_rf_pathcheck_workitemcallback (struct work_struct *work); -void dm_fsync_timer_callback (struct timer_list *t); +void dm_fsync_work_callback (struct work_struct *work);void dm_cck_txpower_adjust (struct net_device *dev,bool binch14);void dm_shadow_init (struct net_device *dev);void dm_initialize_txpower_tracking (struct net_device *dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 127/287 mmc: sdhci-of-esdhc: Fix refcount leak in esdhc_signal_voltage_switch
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit b5899a3e2f783a27b268e38d37f9b24c71bddf45 ]
of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. of_node_put() checks null pointer.
--- drivers/mmc/host/sdhci-of-esdhc.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/sdhci-of-esdhc.c +1 -0
@@ -704,6 +704,7 @@ static int esdhc_signal_voltage_switch(struct mmc_host *mmc, scfg_node =of_find_matching_node (NULL , scfg_device_ids);if (scfg_node) scfg_base =of_iomap (scfg_node,0 ); +of_node_put (scfg_node);if (scfg_base) { sdhciovselcr =SDHCIOVSELCR_TGLEN |SDHCIOVSELCR_VSELVAL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 128/287 memstick/ms_block: Fix some incorrect memory allocation
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 2e531bc3e0d86362fcd8a577b3278d9ef3cc2ba0 ]
Some functions of the bitmap API take advantage of the fact that a bitmap is an array of long.
So, to make sure this assertion is correct, allocate bitmaps with bitmap_zalloc() instead of kzalloc()+hand-computed number of bytes.
While at it, also use bitmap_free() instead of kfree() to keep the semantic.
--- drivers/memstick/core/ms_block.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/memstick/core/ms_block.c +5 -5
@@ -1339,17 +1339,17 @@ static int msb_ftl_initialize(struct msb_data *msb) msb->zone_count = msb->block_count /MS_BLOCKS_IN_ZONE ; msb->logical_block_count = msb->zone_count *496 -2 ; - msb->used_blocks_bitmap =kzalloc (msb->block_count /8 ,GFP_KERNEL ); - msb->erased_blocks_bitmap =kzalloc (msb->block_count /8 ,GFP_KERNEL ); + msb->used_blocks_bitmap =bitmap_zalloc (msb->block_count,GFP_KERNEL ); + msb->erased_blocks_bitmap =bitmap_zalloc (msb->block_count,GFP_KERNEL ); msb->lba_to_pba_table =kmalloc_array (msb->logical_block_count,sizeof (u16),GFP_KERNEL );if (!msb->used_blocks_bitmap || !msb->lba_to_pba_table || !msb->erased_blocks_bitmap) { -kfree (msb->used_blocks_bitmap); +bitmap_free (msb->used_blocks_bitmap); +bitmap_free (msb->erased_blocks_bitmap);kfree (msb->lba_to_pba_table); -kfree (msb->erased_blocks_bitmap);return -ENOMEM ; }
@@ -1961,7 +1961,7 @@ static int msb_bd_open(struct block_device *bdev, fmode_t mode)static void msb_data_clear (struct msb_data *msb) {kfree (msb->boot_page); -kfree (msb->used_blocks_bitmap); +bitmap_free (msb->used_blocks_bitmap);kfree (msb->lba_to_pba_table);kfree (msb->cache); msb->card =NULL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 129/287 memstick/ms_block: Fix a memory leak
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 54eb7a55be6779c4d0c25eaf5056498a28595049 ]
'erased_blocks_bitmap' is never freed. As it is allocated at the same time as 'used_blocks_bitmap', it is likely that it should be freed also at the same time.
Add the corresponding bitmap_free() in msb_data_clear().
--- drivers/memstick/core/ms_block.c | 1 + 1 file changed, 1 insertion(+)
drivers/memstick/core/ms_block.c +1 -0
@@ -1962,6 +1962,7 @@ static void msb_data_clear(struct msb_data *msb) {kfree (msb->boot_page);bitmap_free (msb->used_blocks_bitmap); +bitmap_free (msb->erased_blocks_bitmap);kfree (msb->lba_to_pba_table);kfree (msb->cache); msb->card =NULL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 130/287 mmc: sdhci-of-at91: fix set_uhs_signaling rewriting of MC1R
In reply to Greg Kroah-HartmanFrom: Eugen Hristev <[email protected]>
[ Upstream commit 5987e6ded29d52e42fc7b06aa575c60a25eee38e ]
In set_uhs_signaling, the DDR bit is being set by fully writing the MC1R register.
This can lead to accidental erase of certain bits in this register. Avoid this by doing a read-modify-write operation.
--- drivers/mmc/host/sdhci-of-at91.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-of-at91.c +7 -2
@@ -117,8 +117,13 @@ static void sdhci_at91_set_power(struct sdhci_host *host, unsigned char mode,static void sdhci_at91_set_uhs_signaling (struct sdhci_host *host,unsigned int timing) { -if (timing ==MMC_TIMING_MMC_DDR52 ) -sdhci_writeb (host,SDMMC_MC1R_DDR ,SDMMC_MC1R ); +u8 mc1r; + +if (timing ==MMC_TIMING_MMC_DDR52 ) { + mc1r =sdhci_readb (host,SDMMC_MC1R ); + mc1r |=SDMMC_MC1R_DDR ; +sdhci_writeb (host, mc1r,SDMMC_MC1R ); + }sdhci_set_uhs_signaling (host, timing); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 131/287 PCI/portdrv: Dont disable AER reporting in get_port_device_capability()
In reply to Greg Kroah-HartmanFrom: Stefan Roese <[email protected]>
[ Upstream commit 8795e182b02dc87e343c79e73af6b8b7f9c5e635 ]
AER reporting is currently disabled in the DevCtl registers of all non Root Port PCIe devices on systems using pcie_ports_native || host->native_aer, disabling AER completely in such systems. This is because 2bd50dd800b5 ("PCI: PCIe: Disable PCIe port services during port initialization"), added a call to pci_disable_pcie_error_reporting() *after* the AER setup was completed for the PCIe device tree.
Here a longer analysis about the current status of AER enabling / disabling upon bootup provided by Bjorn:
pcie_portdrv_probe
pcie_port_device_register
get_port_device_capability
pci_disable_pcie_error_reporting
clear CERE NFERE FERE URRE # <-- disable for RP USP DSP
pcie_device_init
device_register # new AER service device
aer_probe
aer_enable_rootport # RP only
set_downstream_devices_error_reporting
set_device_error_reporting # self (RP)
if (RP || USP || DSP)
pci_enable_pcie_error_reporting
set CERE NFERE FERE URRE # <-- enable for RP
pci_walk_bus
set_device_error_reporting
if (RP || USP || DSP)
pci_enable_pcie_error_reporting
set CERE NFERE FERE URRE # <-- enable for USP DSP
In a typical Root Port -> Endpoint hierarchy, the above:
- Disables Error Reporting for the Root Port,
- Enables Error Reporting for the Root Port,
- Does NOT enable Error Reporting for the Endpoint because it is not a Root Port or Switch Port.
In a deeper Root Port -> Upstream Switch Port -> Downstream Switch Port -> Endpoint hierarchy:
- Disables Error Reporting for the Root Port,
- Enables Error Reporting for the Root Port,
- Enables Error Reporting for both Switch Ports,
- Does NOT enable Error Reporting for the Endpoint because it is not a Root Port or Switch Port,
- Disables Error Reporting for the Switch Ports when pcie_portdrv_probe() claims them. AER does not re-enable it because these are not Root Ports.
Remove this call to pci_disable_pcie_error_reporting() from get_port_device_capability(), leaving the already enabled AER configuration intact. With this change, AER is enabled in the Root Port and the PCIe switch upstream and downstream ports. Only the PCIe Endpoints don't have AER enabled yet. A follow-up patch will take care of this Endpoint enabling.
--- drivers/pci/pcie/portdrv_core.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/pci/pcie/portdrv_core.c +1 -8
@@ -218,15 +218,8 @@ static int get_port_device_capability(struct pci_dev *dev)#ifdef CONFIG_PCIEAER if (dev->aer_cap &&pci_aer_available () && - (pcie_ports_native || host->native_aer)) { + (pcie_ports_native || host->native_aer)) services |=PCIE_PORT_SERVICE_AER ; - -/* -* Disable AER on this port in case it's been enabled by the -* BIOS (the AER service driver will enable it when necessary). -*/ -pci_disable_pcie_error_reporting (dev); - }#endif /*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 132/287 scsi: smartpqi: Fix DMA direction for RAID requests
In reply to Greg Kroah-HartmanFrom: Mahesh Rajashekhara <[email protected]>
[ Upstream commit 69695aeaa6621bc49cdd7a8e5a8d1042461e496e ]
Correct a SOP READ and WRITE DMA flags for some requests.
This update corrects DMA direction issues with SCSI commands removed from the controller's internal lookup table.
Currently, SCSI READ BLOCK LIMITS (0x5) was removed from the controller lookup table and exposed a DMA direction flag issue.
SCSI READ BLOCK LIMITS was recently removed from our controller lookup table so the controller uses the respective IU flag field to set the DMA data direction. Since the DMA direction is incorrect the FW never completes the request causing a hang.
Some SCSI commands which use SCSI READ BLOCK LIMITS
* sg_map
* mt -f /dev/stX status
After updating controller firmware, users may notice their tape units failing. This patch resolves the issue.
Also, the AIO path DMA direction is correct.
The DMA direction flag is a day-one bug with no reported BZ.
--- drivers/scsi/smartpqi/smartpqi_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/smartpqi/smartpqi_init.c +2 -2
@@ -4638,10 +4638,10 @@ static int pqi_raid_submit_scsi_cmd_with_io_request( }switch (scmd->sc_data_direction) { -case DMA_TO_DEVICE : +case DMA_FROM_DEVICE : request->data_direction =SOP_READ_FLAG ;break ; -case DMA_FROM_DEVICE : +case DMA_TO_DEVICE : request->data_direction =SOP_WRITE_FLAG ;break ;case DMA_NONE :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 133/287 usb: gadget: udc: amd5536 depends on HAS_DMA
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 8097cf2fb3b2205257f1c76f4808e3398d66b6d9 ]
USB_AMD5536UDC should depend on HAS_DMA since it selects USB_SNP_CORE, which depends on HAS_DMA and since 'select' does not follow any dependency chains.
Fixes this kconfig warning:
WARNING: unmet direct dependencies detected for USB_SNP_CORE
Depends on [n]: USB_SUPPORT [=y] && USB_GADGET [=y] && (USB_AMD5536UDC [=y] || USB_SNP_UDC_PLAT [=n]) && HAS_DMA [=n] Selected by [y]:
- USB_AMD5536UDC [=y] && USB_SUPPORT [=y] && USB_GADGET [=y] && USB_PCI [=y]
--- drivers/usb/gadget/udc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/Kconfig +1 -1
@@ -309,7 +309,7 @@ source "drivers/usb/gadget/udc/bdc/Kconfig" config USB_AMD5536UDC tristate "AMD5536 UDC" - depends on USB_PCI + depends on USB_PCI && HAS_DMA select USB_SNP_CORE help The AMD5536 UDC is part of the AMD Geode CS5536, an x86 southbridge.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 134/287 RDMA/hfi1: fix potential memory leak in setup_base_ctxt()
In reply to Greg Kroah-HartmanFrom: Jianglei Nie <[email protected]>
[ Upstream commit aa2a1df3a2c85f855af7d54466ac10bd48645d63 ]
setup_base_ctxt() allocates a memory chunk for uctxt->groups with hfi1_alloc_ctxt_rcv_groups(). When init_user_ctxt() fails, uctxt->groups is not released, which will lead to a memory leak.
We should release the uctxt->groups with hfi1_free_ctxt_rcv_groups() when init_user_ctxt() fails.
--- drivers/infiniband/hw/hfi1/file_ops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/hfi1/file_ops.c +3 -1
@@ -1222,8 +1222,10 @@ static int setup_base_ctxt(struct hfi1_filedata *fd, goto done; ret =init_user_ctxt (fd, uctxt); -if (ret) +if (ret) { +hfi1_free_ctxt_rcv_groups (uctxt); goto done; + }user_init (uctxt);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 135/287 gpio: gpiolib-of: Fix refcount bugs in of_mm_gpiochip_add_data()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 5d07a692f9562f9c06e62cce369e9dd108173a0f ]
We should use of_node_get() when a new reference of device_node is created. It is noted that the old reference stored in 'mm_gc->gc.of_node' should also be decreased.
This patch is based on the fact that there is a call site in function 'qe_add_gpiochips()' of src file 'drivers\soc\fsl\qe\gpio.c'. In this function, of_mm_gpiochip_add_data() is contained in an iteration of for_each_compatible_node() which will automatically increase and decrease the refcount. So we need additional of_node_get() for the reference escape in of_mm_gpiochip_add_data().
--- drivers/gpio/gpiolib-of.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/gpiolib-of.c +3 -1
@@ -476,7 +476,8 @@ int of_mm_gpiochip_add_data(struct device_node *np,if (mm_gc->save_regs) mm_gc->save_regs (mm_gc); - mm_gc->gc.of_node = np; +of_node_put (mm_gc->gc.of_node); + mm_gc->gc.of_node =of_node_get (np); ret =gpiochip_add_data (gc, data);if (ret)
@@ -484,6 +485,7 @@ int of_mm_gpiochip_add_data(struct device_node *np,return 0 ; err2: +of_node_put (np);iounmap (mm_gc->regs); err1:kfree (gc->label);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 136/287 mmc: cavium-octeon: Add of_node_put() when breaking out of loop
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 19bbb49acf8d7a03cb83e05624363741a4c3ec6f ]
In octeon_mmc_probe(), we should call of_node_put() when breaking out of for_each_child_of_node() which has increased and decreased the refcount during each iteration.
--- drivers/mmc/host/cavium-octeon.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/cavium-octeon.c +1 -0
@@ -288,6 +288,7 @@ static int octeon_mmc_probe(struct platform_device *pdev)if (ret) {dev_err (&pdev->dev,"Error populating slots\n" );octeon_mmc_set_shared_power (host,0 ); +of_node_put (cn); goto error; } i++;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 137/287 mmc: cavium-thunderx: Add of_node_put() when breaking out of loop
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 7ee480795e41db314f2c445c65ed854a5d6e8e32 ]
In thunder_mmc_probe(), we should call of_node_put() when breaking out of for_each_child_of_node() which has increased and decreased the refcount during each iteration.
--- drivers/mmc/host/cavium-thunderx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/cavium-thunderx.c +3 -1
@@ -138,8 +138,10 @@ static int thunder_mmc_probe(struct pci_dev *pdev,continue ; ret =cvm_mmc_of_slot_probe (&host->slot_pdev[i]->dev, host); -if (ret) +if (ret) { +of_node_put (child_node); goto error; + } } i++; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 138/287 HID: alps: Declare U1_UNICORN_LEGACY support
In reply to Greg Kroah-HartmanFrom: Artem Borisov <[email protected]>
[ Upstream commit 1117d182c5d72abd7eb8b7d5e7b8c3373181c3ab ]
U1_UNICORN_LEGACY id was added to the driver, but was not declared in the device id table, making it impossible to use.
--- drivers/hid/hid-alps.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hid/hid-alps.c +2 -0
@@ -835,6 +835,8 @@ static const struct hid_device_id alps_id[] = { USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1_DUAL) }, { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1) }, + { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, + USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY) }, { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_T4_BTNLESS) }, { }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 139/287 USB: serial: fix tty-port initialized comments
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
[ Upstream commit 688ee1d1785c1359f9040f615dd8e6054962bce2 ]
Fix up the tty-port initialized comments which got truncated and obfuscated when replacing the old ASYNCB_INITIALIZED flag.
--- drivers/usb/serial/sierra.c | 3 ++- drivers/usb/serial/usb-serial.c | 2 +- drivers/usb/serial/usb_wwan.c | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/usb/serial/sierra.c +2 -1
@@ -757,7 +757,8 @@ static void sierra_close(struct usb_serial_port *port)/* * Need to take susp_lock to make sure port is not already being -* resumed, but no need to hold it due to initialized +* resumed, but no need to hold it due to the tty-port initialized +* flag. */ spin_lock_irq (&intfdata->susp_lock);if (--intfdata->open_ports ==0 )
drivers/usb/serial/usb-serial.c +1 -1
@@ -251,7 +251,7 @@ static int serial_open(struct tty_struct *tty, struct file *filp)* * Shut down a USB serial port. Serialized against activate by the * tport mutex and kept to matching open/close pairs -* of calls by the initialized flag. +* of calls by the tty-port initialized flag. * * Not called if tty is console. */
drivers/usb/serial/usb_wwan.c +2 -1
@@ -463,7 +463,8 @@ void usb_wwan_close(struct usb_serial_port *port)/* * Need to take susp_lock to make sure port is not already being -* resumed, but no need to hold it due to initialized +* resumed, but no need to hold it due to the tty-port initialized +* flag. */ spin_lock_irq (&intfdata->susp_lock);if (--intfdata->open_ports ==0 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 140/287 platform/olpc: Fix uninitialized data in debugfs write
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 40ec787e1adf302c11668d4cc69838f4d584187d ]
The call to:
size = simple_write_to_buffer(cmdbuf, sizeof(cmdbuf), ppos, buf, size);
will succeed if at least one byte is written to the "cmdbuf" buffer. The "*ppos" value controls which byte is written. Another problem is that this code does not check for errors so it's possible for the entire buffer to be uninitialized.
Inintialize the struct to zero to prevent reading uninitialized stack data.
Debugfs is normally only writable by root so the impact of this bug is very minimal.
--- drivers/platform/olpc/olpc-ec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/olpc/olpc-ec.c +1 -1
@@ -170,7 +170,7 @@ static ssize_t ec_dbgfs_cmd_write(struct file *file, const char __user *buf,int i, m;unsigned char ec_cmd[EC_MAX_CMD_ARGS ];unsigned int ec_cmd_int[EC_MAX_CMD_ARGS ]; -char cmdbuf[64 ]; +char cmdbuf[64 ] ="" ;int ec_cmd_bytes;mutex_lock (&ec_dbgfs_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 141/287 mm/mmap.c: fix missing call to vm_unacct_memory in mmap_region
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit 7f82f922319ede486540e8746769865b9508d2c2 ]
Since the beginning, charged is set to 0 to avoid calling vm_unacct_memory twice because vm_unacct_memory will be called by above unmap_region. But since commit 4f74d2c8e827 ("vm: remove 'nr_accounted' calculations from the unmap_vmas() interfaces"), unmap_region doesn't call vm_unacct_memory anymore. So charged shouldn't be set to 0 now otherwise the calling to paired vm_unacct_memory will be missed and leads to imbalanced account.
--- mm/mmap.c | 1 - 1 file changed, 1 deletion(-)
mm/mmap.c +0 -1
@@ -1821,7 +1821,6 @@ unsigned long mmap_region(struct file *file, unsigned long addr,/* Undo any partial mapping done by a device driver. */ unmap_region (mm, vma, prev, vma->vm_start, vma->vm_end); - charged =0 ;if (vm_flags &VM_SHARED )mapping_unmap_writable (file->f_mapping); allow_write_and_free_vma:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 142/287 RDMA/rxe: Fix error unwind in rxe_create_qp()
In reply to Greg Kroah-HartmanFrom: Zhu Yanjun <[email protected]>
[ Upstream commit fd5382c5805c4bcb50fd25b7246247d3f7114733 ]
In the function rxe_create_qp(), rxe_qp_from_init() is called to initialize qp, internally things like the spin locks are not setup until rxe_qp_init_req().
If an error occures before this point then the unwind will call rxe_cleanup() and eventually to rxe_qp_do_cleanup()/rxe_cleanup_task() which will oops when trying to access the uninitialized spinlock.
Move the spinlock initializations earlier before any failures.
--- drivers/infiniband/sw/rxe/rxe_qp.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/infiniband/sw/rxe/rxe_qp.c +8 -4
@@ -210,6 +210,14 @@ static void rxe_qp_init_misc(struct rxe_dev *rxe, struct rxe_qp *qp,spin_lock_init (&qp->grp_lock);spin_lock_init (&qp->state_lock); +spin_lock_init (&qp->req.task.state_lock); +spin_lock_init (&qp->resp.task.state_lock); +spin_lock_init (&qp->comp.task.state_lock); + +spin_lock_init (&qp->sq.sq_lock); +spin_lock_init (&qp->rq.producer_lock); +spin_lock_init (&qp->rq.consumer_lock); +atomic_set (&qp->ssn,0 );atomic_set (&qp->skb_out,0 ); }
@@ -258,7 +266,6 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp, qp->req.opcode =-1 ; qp->comp.opcode =-1 ; -spin_lock_init (&qp->sq.sq_lock);skb_queue_head_init (&qp->req_pkts); rxe_init_task(rxe, &qp->req.task, qp,
@@ -308,9 +315,6 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp, } } -spin_lock_init (&qp->rq.producer_lock); -spin_lock_init (&qp->rq.consumer_lock); -skb_queue_head_init (&qp->resp_pkts); rxe_init_task(rxe, &qp->resp.task, qp,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 143/287 null_blk: fix ida error handling in null_add_dev()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit ee452a8d984f94fa8e894f003a52e776e4572881 ]
There needs to be some error checking if ida_simple_get() fails. Also call ida_free() if there are errors later.
--- drivers/block/null_blk_main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/block/null_blk_main.c +11 -3
@@ -1819,8 +1819,13 @@ static int null_add_dev(struct nullb_device *dev)blk_queue_flag_clear (QUEUE_FLAG_ADD_RANDOM , nullb->q);mutex_lock (&lock); - nullb->index =ida_simple_get (&nullb_indexes,0 ,0 ,GFP_KERNEL ); - dev->index = nullb->index; + rv =ida_simple_get (&nullb_indexes,0 ,0 ,GFP_KERNEL ); +if (rv <0 ) { +mutex_unlock (&lock); + goto out_cleanup_zone; + } + nullb->index = rv; + dev->index = rv;mutex_unlock (&lock);blk_queue_logical_block_size (nullb->q, dev->blocksize);
@@ -1832,13 +1837,16 @@ static int null_add_dev(struct nullb_device *dev) rv =null_gendisk_register (nullb);if (rv) - goto out_cleanup_zone; + goto out_ida_free;mutex_lock (&lock);list_add_tail (&nullb->list, &nullb_list);mutex_unlock (&lock);return 0 ; + +out_ida_free: +ida_free (&nullb_indexes, nullb->index); out_cleanup_zone:if (dev->zoned)null_zone_exit (dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 144/287 ext4: recover csum seed of tmp_inode after migrating to extents
In reply to Greg Kroah-HartmanFrom: Li Lingfeng <[email protected]>
[ Upstream commit 07ea7a617d6b278fb7acedb5cbe1a81ce2de7d0c ]
When migrating to extents, the checksum seed of temporary inode need to be replaced by inode's, otherwise the inode checksums will be incorrect when swapping the inodes data.
However, the temporary inode can not match it's checksum to itself since it has lost it's own checksum seed.
mkfs.ext4 -F /dev/sdc
mount /dev/sdc /mnt/sdcxfs_io -fc "pwrite 4k 4k" -c "fsync" /mnt/sdc/testfile chattr -e /mnt/sdc/testfile
chattr +e /mnt/sdc/testfile
umount /dev/sdc
fsck -fn /dev/sdc
========
...
Pass 1: Checking inodes, blocks, and sizes
Inode 13 passes checks, but checksum does not match inode. Fix? no
...
========
The fix is simple, save the checksum seed of temporary inode, and recover it after migrating to extents.
--- fs/ext4/migrate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/migrate.c +3 -1
@@ -435,7 +435,7 @@ int ext4_ext_migrate(struct inode *inode)struct inode *tmp_inode =NULL ;struct migrate_struct lb;unsigned long max_entries; -__u32 goal; +__u32 goal, tmp_csum_seed;uid_t owner[2 ];/*
@@ -483,6 +483,7 @@ int ext4_ext_migrate(struct inode *inode)* the migration. */ ei =EXT4_I (inode); + tmp_csum_seed =EXT4_I (tmp_inode)->i_csum_seed;EXT4_I (tmp_inode)->i_csum_seed = ei->i_csum_seed;i_size_write (tmp_inode,i_size_read (inode));/*
@@ -593,6 +594,7 @@ int ext4_ext_migrate(struct inode *inode)* the inode is not visible to user space. */ tmp_inode->i_blocks =0 ; +EXT4_I (tmp_inode)->i_csum_seed = tmp_csum_seed;/* Reset the extent details */ ext4_ext_tree_init (handle, tmp_inode);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 145/287 jbd2: fix assertion jh->b_frozen_data == NULL failure when journal aborted
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
[ Upstream commit 4a734f0869f970b8a9b65062ea40b09a5da9dba8 ]
Following process will fail assertion 'jh->b_frozen_data == NULL' in jbd2_journal_dirty_metadata():
jbd2_journal_commit_transaction
unlink(dir/a)
jh->b_transaction = trans1
jh->b_jlist = BJ_Metadata
journal->j_running_transaction = NULL
trans1->t_state = T_COMMITunlink(dir/b)
handle->h_trans = trans2
do_get_write_access
jh->b_modified = 0
jh->b_frozen_data = frozen_buffer
jh->b_next_transaction = trans2
jbd2_journal_dirty_metadata
is_handle_aborted
is_journal_aborted // return false
--> jbd2 abort <--
while (commit_transaction->t_buffers)
if (is_journal_aborted)
jbd2_journal_refile_buffer
__jbd2_journal_refile_buffer
WRITE_ONCE(jh->b_transaction,
jh->b_next_transaction)
WRITE_ONCE(jh->b_next_transaction, NULL)
__jbd2_journal_file_buffer(jh, BJ_Reserved)
J_ASSERT_JH(jh, jh->b_frozen_data == NULL) // assertion failure !The reproducer (See detail in [Link]) reports:
------------[ cut here ]------------ kernel BUG at fs/jbd2/transaction.c:1629! invalid opcode: 0000 [#1] PREEMPT SMP CPU: 2 PID: 584 Comm: unlink Tainted: G W 5.19.0-rc6-00115-g4a57a8400075-dirty #697 RIP: 0010:jbd2_journal_dirty_metadata+0x3c5/0x470 RSP: 0018:ffffc90000be7ce0 EFLAGS: 00010202 Call Trace: <TASK> __ext4_handle_dirty_metadata+0xa0/0x290 ext4_handle_dirty_dirblock+0x10c/0x1d0 ext4_delete_entry+0x104/0x200 __ext4_unlink+0x22b/0x360 ext4_unlink+0x275/0x390 vfs_unlink+0x20b/0x4c0 do_unlinkat+0x42f/0x4c0 __x64_sys_unlink+0x37/0x50 do_syscall_64+0x35/0x80
After journal aborting, __jbd2_journal_refile_buffer() is executed with holding @jh->b_state_lock, we can fix it by moving 'is_handle_aborted()' into the area protected by @jh->b_state_lock.
--- fs/jbd2/transaction.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
fs/jbd2/transaction.c +12 -2
@@ -1339,8 +1339,6 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)struct journal_head *jh;int ret =0 ; -if (is_handle_aborted (handle)) -return -EROFS ;if (!buffer_jbd (bh))return -EUCLEAN ;
@@ -1387,6 +1385,18 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) journal = transaction->t_journal;jbd_lock_bh_state (bh); +if (is_handle_aborted (handle)) { +/* +* Check journal aborting with @jh->b_state_lock locked, +* since 'jh->b_transaction' could be replaced with +* 'jh->b_next_transaction' during old transaction +* committing if journal aborted, which may fail +* assertion on 'jh->b_frozen_data == NULL'. +*/ + ret = -EROFS ; + goto out_unlock_bh; + } +if (jh->b_modified ==0 ) {/* * This buffer's got modified and becoming part
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 146/287 ASoC: mediatek: mt8173: Fix refcount leak in mt8173_rt5650_rt5676_dev_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit ae4f11c1ed2d67192fdf3d89db719ee439827c11 ]
of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Fix missing of_node_put() in error paths.
--- sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c +7 -3
@@ -245,14 +245,16 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev)if (!mt8173_rt5650_rt5676_codecs[0 ].of_node) {dev_err (&pdev->dev,"Property 'audio-codec' missing or invalid\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto put_node; } mt8173_rt5650_rt5676_codecs[1 ].of_node =of_parse_phandle (pdev->dev.of_node,"mediatek,audio-codec" ,1 );if (!mt8173_rt5650_rt5676_codecs[1 ].of_node) {dev_err (&pdev->dev,"Property 'audio-codec' missing or invalid\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto put_node; } mt8173_rt5650_rt5676_codec_conf[0 ].of_node = mt8173_rt5650_rt5676_codecs[1 ].of_node;
@@ -265,7 +267,8 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev)if (!mt8173_rt5650_rt5676_dais[DAI_LINK_HDMI_I2S ].codec_of_node) {dev_err (&pdev->dev,"Property 'audio-codec' missing or invalid\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto put_node; } card->dev = &pdev->dev;
@@ -275,6 +278,7 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev)dev_err (&pdev->dev,"%s snd_soc_register_card fail %d\n" , __func__, ret); +put_node:of_node_put (platform_node);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 147/287 ASoC: mt6797-mt6351: Fix refcount leak in mt6797_mt6351_dev_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 7472eb8d7dd12b6b9b1a4f4527719cc9c7f5965f ]
of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
--- sound/soc/mediatek/mt6797/mt6797-mt6351.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/mediatek/mt6797/mt6797-mt6351.c +5 -1
@@ -179,7 +179,8 @@ static int mt6797_mt6351_dev_probe(struct platform_device *pdev)if (!codec_node) {dev_err (&pdev->dev,"Property 'audio-codec' missing or invalid\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto put_platform_node; }for (i =0 ; i < card->num_links; i++) {if (mt6797_mt6351_dai_links[i].codec_name)
@@ -192,6 +193,9 @@ static int mt6797_mt6351_dev_probe(struct platform_device *pdev)dev_err (&pdev->dev,"%s snd_soc_register_card fail %d\n" , __func__, ret); +of_node_put (codec_node); +put_platform_node: +of_node_put (platform_node);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 148/287 ASoC: codecs: da7210: add check for i2c_add_driver
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 82fa8f581a954ddeec1602bed9f8b4a09d100e6e ]
As i2c_add_driver could return error if fails, it should be better to check the return value.
However, if the CONFIG_I2C and CONFIG_SPI_MASTER are both true, the return value of i2c_add_driver will be covered by spi_register_driver.
Therefore, it is necessary to add check and return error if fails.
--- sound/soc/codecs/da7210.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/codecs/da7210.c +2 -0
@@ -1333,6 +1333,8 @@ static int __init da7210_modinit(void)int ret =0 ;#if IS_ENABLED (CONFIG_I2C ) ret =i2c_add_driver (&da7210_i2c_driver); +if (ret) +return ret;#endif #if defined(CONFIG_SPI_MASTER ) ret =spi_register_driver (&da7210_spi_driver);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 149/287 ASoC: mediatek: mt8173-rt5650: Fix refcount leak in mt8173_rt5650_dev_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit efe2178d1a32492f99e7f1f2568eea5c88a85729 ]
of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Fix refcount leak in some error paths.
--- sound/soc/mediatek/mt8173/mt8173-rt5650.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
sound/soc/mediatek/mt8173/mt8173-rt5650.c +6 -3
@@ -260,7 +260,8 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev)if (!mt8173_rt5650_codecs[0 ].of_node) {dev_err (&pdev->dev,"Property 'audio-codec' missing or invalid\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto put_platform_node; } mt8173_rt5650_codecs[1 ].of_node = mt8173_rt5650_codecs[0 ].of_node;
@@ -272,7 +273,7 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev)dev_err (&pdev->dev,"%s codec_capture_dai name fail %d\n" , __func__, ret); -return ret; + goto put_platform_node; } mt8173_rt5650_codecs[1 ].dai_name = codec_capture_dai; }
@@ -293,7 +294,8 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev)if (!mt8173_rt5650_dais[DAI_LINK_HDMI_I2S ].codec_of_node) {dev_err (&pdev->dev,"Property 'audio-codec' missing or invalid\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto put_platform_node; } card->dev = &pdev->dev;
@@ -302,6 +304,7 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev)dev_err (&pdev->dev,"%s snd_soc_register_card fail %d\n" , __func__, ret); +put_platform_node:of_node_put (platform_node);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 150/287 serial: 8250_dw: Store LSR into lsr_saved_flags in dw8250_tx_wait_empty()
In reply to Greg Kroah-HartmanFrom: Ilpo Järvinen <[email protected]>
[ Upstream commit af14f3007e2dca0d112f10f6717ba43093f74e81 ]
Make sure LSR flags are preserved in dw8250_tx_wait_empty(). This function is called from a low-level out function and therefore cannot call serial_lsr_in() as it would lead to infinite recursion.
It is borderline if the flags need to be saved here at all since this code relates to writing LCR register which usually implies no important characters should be arriving.
--- drivers/tty/serial/8250/8250_dw.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/tty/serial/8250/8250_dw.c +3 -0
@@ -140,12 +140,15 @@ static void dw8250_check_lcr(struct uart_port *p, int value)/* Returns once the transmitter is empty or we run out of retries */ static void dw8250_tx_wait_empty (struct uart_port *p) { +struct uart_8250_port *up =up_to_u8250p (p);unsigned int tries =20000 ;unsigned int delay_threshold = tries -1000 ;unsigned int lsr;while (tries--) { lsr =readb (p->membase + (UART_LSR << p->regshift)); + up->lsr_saved_flags |= lsr &LSR_SAVE_FLAGS ; +if (lsr &UART_LSR_TEMT )break ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 151/287 profiling: fix shift too large makes kernel panic
In reply to Greg Kroah-HartmanFrom: Chen Zhongjin <[email protected]>
[ Upstream commit 0fe6ee8f123a4dfb529a5aff07536bb481f34043 ]
2d186afd04d6 ("profiling: fix shift-out-of-bounds bugs") limits shift value by [0, BITS_PER_LONG -1], which means [0, 63].
However, syzbot found that the max shift value should be the bit number of (_etext - _stext). If shift is outside of this, the "buffer_bytes" will be zero and will cause kzalloc(0). Then the kernel panics due to dereferencing the returned pointer 16.
This can be easily reproduced by passing a large number like 60 to enable profiling and then run readprofile.
LOGS:
BUG: kernel NULL pointer dereference, address: 0000000000000010 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page PGD 6148067 P4D 6148067 PUD 6142067 PMD 0 PREEMPT SMP CPU: 4 PID: 184 Comm: readprofile Not tainted 5.18.0+ #162 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014 RIP: 0010:read_profile+0x104/0x220 RSP: 0018:ffffc900006fbe80 EFLAGS: 00000202 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: ffff888006150000 RSI: 0000000000000001 RDI: ffffffff82aba4a0 RBP: 000000000188bb60 R08: 0000000000000010 R09: ffff888006151000 R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff82aba4a0 R13: 0000000000000000 R14: ffffc900006fbf08 R15: 0000000000020c30 FS: 000000000188a8c0(0000) GS:ffff88803ed00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000010 CR3: 0000000006144000 CR4: 00000000000006e0 Call Trace: <TASK> proc_reg_read+0x56/0x70 vfs_read+0x9a/0x1b0 ksys_read+0xa1/0xe0 ? fpregs_assert_state_consistent+0x1e/0x40 do_syscall_64+0x3a/0x80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 RIP: 0033:0x4d4b4e RSP: 002b:00007ffebb668d58 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 000000000188a8a0 RCX: 00000000004d4b4e RDX: 0000000000000400 RSI: 000000000188bb60 RDI: 0000000000000003 RBP: 0000000000000003 R08: 000000000000006e R09: 0000000000000000 R10: 0000000000000041 R11: 0000000000000246 R12: 000000000188bb60 R13: 0000000000000400 R14: 0000000000000000 R15: 000000000188bb60 </TASK> Modules linked in: CR2: 0000000000000010 Killed ---[ end trace 0000000000000000 ]---
Check prof_len in profile_init() to prevent it be zero.
--- kernel/profile.c | 7 +++++++ 1 file changed, 7 insertions(+)
kernel/profile.c +7 -0
@@ -108,6 +108,13 @@ int __ref profile_init(void)/* only text is profiled */ prof_len = (_etext - _stext) >> prof_shift; + +if (!prof_len) { +pr_warn ("profiling shift: %u too large\n" , prof_shift); + prof_on =0 ; +return -EINVAL ; + } + buffer_bytes = prof_len*sizeof (atomic_t);if (!alloc_cpumask_var (&prof_cpu_mask,GFP_KERNEL ))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 152/287 tty: n_gsm: fix non flow control frames during mux flow off
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
[ Upstream commit bec0224816d19abe4fe503586d16d51890540615 ]
n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010.
See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1516
The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to
the newer 27.010 here. Chapter 5.4.6.3.6 states that FCoff stops the
transmission on all channels except the control channel. This is already
implemented in gsm_data_kick(). However, chapter 5.4.8.1 explains that this
shall result in the same behavior as software flow control on the ldisc in
advanced option mode. That means only flow control frames shall be sent
during flow off. The current implementation does not consider this case.
Change gsm_data_kick() to send only flow control frames if constipated to abide the standard. gsm_read_ea_val() and gsm_is_flow_ctrl_msg() are introduced as helper functions for this.
It is planned to use gsm_read_ea_val() in later code cleanups for other functions, too.
--- drivers/tty/n_gsm.c | 54 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-)
drivers/tty/n_gsm.c +53 -1
@@ -410,6 +410,27 @@ static int gsm_read_ea(unsigned int *val, u8 c)return c &EA ; } +/** +* gsm_read_ea_val - read a value until EA +* @val: variable holding value +* @data: buffer of data +* @dlen: length of data +* +* Processes an EA value. Updates the passed variable and +* returns the processed data length. +*/ +static unsigned int gsm_read_ea_val (unsigned int *val,const u8 *data,int dlen) +{ +unsigned int len =0 ; + +for (; dlen >0 ; dlen--) { + len++; +if (gsm_read_ea (val, *data++)) +break ; + } +return len; +} +/** * gsm_encode_modem - encode modem data bits * @dlci: DLCI to encode from
@@ -657,6 +678,37 @@ static struct gsm_msg *gsm_data_alloc(struct gsm_mux *gsm, u8 addr, int len,return m; } +/** +* gsm_is_flow_ctrl_msg - checks if flow control message +* @msg: message to check +* +* Returns true if the given message is a flow control command of the +* control channel. False is returned in any other case. +*/ +static bool gsm_is_flow_ctrl_msg (struct gsm_msg *msg) +{ +unsigned int cmd; + +if (msg->addr >0 ) +return false; + +switch (msg->ctrl & ~PF ) { +case UI : +case UIH : + cmd =0 ; +if (gsm_read_ea_val (&cmd, msg->data +2 , msg->len -2 ) <1 ) +break ; +switch (cmd & ~PF ) { +case CMD_FCOFF : +case CMD_FCON : +return true; + } +break ; + } + +return false; +} +/** * gsm_data_kick - poke the queue * @gsm: GSM Mux
@@ -675,7 +727,7 @@ static void gsm_data_kick(struct gsm_mux *gsm, struct gsm_dlci *dlci)int len;list_for_each_entry_safe (msg, nmsg, &gsm->tx_list, list) { -if (gsm->constipated && msg->addr) +if (gsm->constipated && !gsm_is_flow_ctrl_msg (msg))continue ;if (gsm->encoding !=0 ) { gsm->txframe[0 ] =GSM1_SOF ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 153/287 tty: n_gsm: fix packet re-transmission without open control channel
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
[ Upstream commit 4fae831b3a71fc5a44cc5c7d0b8c1267ee7659f5 ]
In the current implementation control packets are re-transmitted even if the control channel closed down during T2. This is wrong. Check whether the control channel is open before re-transmitting any packets. Note that control channel open/close is handled by T1 and not T2 and remains unaffected by this.
--- drivers/tty/n_gsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/n_gsm.c +1 -1
@@ -1382,7 +1382,7 @@ static void gsm_control_retransmit(struct timer_list *t)spin_lock_irqsave (&gsm->control_lock, flags); ctrl = gsm->pending_cmd;if (ctrl) { -if (gsm->cretries ==0 ) { +if (gsm->cretries ==0 || !gsm->dlci[0 ] || gsm->dlci[0 ]->dead) { gsm->pending_cmd =NULL ; ctrl->error = -ETIMEDOUT ; ctrl->done =1 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 154/287 tty: n_gsm: fix race condition in gsmld_write()
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
[ Upstream commit 32dd59f96924f45e33bc79854f7a00679c0fa28e ]
The function may be used by the user directly and also by the n_gsm internal functions. They can lead into a race condition which results in interleaved frames if both are writing at the same time. The receiving side is not able to decode those interleaved frames correctly.
Add a lock around the low side tty write to avoid race conditions and frame interleaving between user originated writes and n_gsm writes.
--- drivers/tty/n_gsm.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/tty/n_gsm.c +17 -4
@@ -2519,11 +2519,24 @@ static ssize_t gsmld_read(struct tty_struct *tty, struct file *file,static ssize_t gsmld_write (struct tty_struct *tty,struct file *file,const unsigned char *buf,size_t nr) { -int space =tty_write_room (tty); +struct gsm_mux *gsm = tty->disc_data; +unsigned long flags; +int space; +int ret; + +if (!gsm) +return -ENODEV ; + + ret = -ENOBUFS ; +spin_lock_irqsave (&gsm->tx_lock, flags); + space =tty_write_room (tty);if (space >= nr) -return tty->ops->write (tty, buf, nr); -set_bit (TTY_DO_WRITE_WAKEUP , &tty->flags); -return -ENOBUFS ; + ret = tty->ops->write (tty, buf, nr); +else +set_bit (TTY_DO_WRITE_WAKEUP , &tty->flags); +spin_unlock_irqrestore (&gsm->tx_lock, flags); + +return ret; }/**
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 155/287 remoteproc: qcom: wcnss: Fix handling of IRQs
In reply to Greg Kroah-HartmanFrom: Sireesh Kodali <[email protected]>
[ Upstream commit bed0adac1ded4cb486ba19a3a7e730fbd9a1c9c6 ]
The wcnss_get_irq function is expected to return a value > 0 in the event that an IRQ is succssfully obtained, but it instead returns 0. This causes the stop and ready IRQs to never actually be used despite being defined in the device-tree. This patch fixes that.
--- drivers/remoteproc/qcom_wcnss.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/remoteproc/qcom_wcnss.c +8 -2
@@ -415,6 +415,7 @@ static int wcnss_request_irq(struct qcom_wcnss *wcnss, irq_handler_t thread_fn) {int ret; +int irq_number; ret =platform_get_irq_byname (pdev, name);if (ret <0 && optional) {
@@ -425,14 +426,19 @@ static int wcnss_request_irq(struct qcom_wcnss *wcnss,return ret; } + irq_number = ret; + ret =devm_request_threaded_irq (&pdev->dev, ret,NULL , thread_fn,IRQF_TRIGGER_RISING |IRQF_ONESHOT ,"wcnss" , wcnss); -if (ret) +if (ret) {dev_err (&pdev->dev,"request %s IRQ failed\n" , name); +return ret; + } -return ret; +/* Return the IRQ number if the IRQ was successfully acquired */ +return irq_number; }static int wcnss_alloc_memory_region (struct qcom_wcnss *wcnss)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 156/287 vfio/ccw: Do not change FSM state in subchannel event
In reply to Greg Kroah-HartmanFrom: Eric Farman <[email protected]>
[ Upstream commit cffcc109fd682075dee79bade3d60a07152a8fd1 ]
The routine vfio_ccw_sch_event() is tasked with handling subchannel events, specifically machine checks, on behalf of vfio-ccw. It correctly calls cio_update_schib(), and if that fails (meaning the subchannel is gone) it makes an FSM event call to mark the subchannel Not Operational.
If that worked, however, then it decides that if the FSM state was already Not Operational (implying the subchannel just came back), then it should simply change the FSM to partially- or fully-open.
Remove this trickery, since a subchannel returning will require more probing than simply "oh all is well again" to ensure it works correctly.
--- drivers/s390/cio/vfio_ccw_drv.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/s390/cio/vfio_ccw_drv.c +3 -11
@@ -205,19 +205,11 @@ static int vfio_ccw_sch_event(struct subchannel *sch, int process)if (work_pending (&sch->todo_work)) goto out_unlock; -if (cio_update_schib (sch)) { -vfio_ccw_fsm_event (private,VFIO_CCW_EVENT_NOT_OPER ); - rc =0 ; - goto out_unlock; - } - - private =dev_get_drvdata (&sch->dev); -if (private->state ==VFIO_CCW_STATE_NOT_OPER ) { - private->state = private->mdev ?VFIO_CCW_STATE_IDLE : -VFIO_CCW_STATE_STANDBY ; - } rc =0 ; +if (cio_update_schib (sch)) +vfio_ccw_fsm_event (private,VFIO_CCW_EVENT_NOT_OPER ); + out_unlock:spin_unlock_irqrestore (sch->lock, flags);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 157/287 tty: n_gsm: fix wrong T1 retry count handling
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
[ Upstream commit f30e10caa80aa1f35508bc17fc302dbbde9a833c ]
n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010.
See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1516
The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to
the newer 27.010 here. Chapter 5.7.3 states that the valid range for the
maximum number of retransmissions (N2) is from 0 to 255 (both including).gsm_dlci_t1() handles this number incorrectly by performing N2 - 1
retransmission attempts. Setting N2 to zero results in more than 255
retransmission attempts.
Fix gsm_dlci_t1() to comply with 3GPP 27.010.
--- drivers/tty/n_gsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/n_gsm.c +2 -2
@@ -1534,8 +1534,8 @@ static void gsm_dlci_t1(struct timer_list *t)switch (dlci->state) {case DLCI_OPENING : - dlci->retries--;if (dlci->retries) { + dlci->retries--;gsm_command (dlci->gsm, dlci->addr,SABM |PF );mod_timer (&dlci->t1, jiffies + gsm->t1 *HZ /100 ); }else if (!dlci->addr && gsm->control == (DM |PF )) {
@@ -1550,8 +1550,8 @@ static void gsm_dlci_t1(struct timer_list *t)break ;case DLCI_CLOSING : - dlci->retries--;if (dlci->retries) { + dlci->retries--;gsm_command (dlci->gsm, dlci->addr,DISC |PF );mod_timer (&dlci->t1, jiffies + gsm->t1 *HZ /100 ); }else
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 158/287 tty: n_gsm: fix DM command
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
[ Upstream commit 18a948c7d90995d127785e308fa7b701df4c499f ]
n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010.
See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1516
The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to
the newer 27.010 here. Chapter 5.3.3 defines the DM response. There exists
no DM command. However, the current implementation incorrectly sends DM as
command in case of unexpected UIH frames in gsm_queue().
Correct this behavior by always sending DM as response.
--- drivers/tty/n_gsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/n_gsm.c +1 -1
@@ -1892,7 +1892,7 @@ static void gsm_queue(struct gsm_mux *gsm) goto invalid;#endif if (dlci ==NULL || dlci->state !=DLCI_OPEN ) { -gsm_command (gsm, address,DM |PF ); +gsm_response (gsm, address,DM |PF );return ; } dlci->data (dlci, gsm->buf, gsm->len);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 159/287 tty: n_gsm: fix missing corner cases in gsmld_poll()
In reply to Greg Kroah-HartmanFrom: Daniel Starke <[email protected]>
[ Upstream commit 7e5b4322cde067e1d0f1bf8f490e93f664a7c843 ]
gsmld_poll() currently fails to handle the following corner cases correctly:
- remote party closed the associated tty
Add the missing checks and map those to EPOLLHUP. Reorder the checks to group them by their reaction.
--- drivers/tty/n_gsm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/tty/n_gsm.c +5 -2
@@ -2561,12 +2561,15 @@ static __poll_t gsmld_poll(struct tty_struct *tty, struct file *file,poll_wait (file, &tty->read_wait, wait);poll_wait (file, &tty->write_wait, wait); + +if (gsm->dead) + mask |=EPOLLHUP ;if (tty_hung_up_p (file)) mask |=EPOLLHUP ; +if (test_bit (TTY_OTHER_CLOSED , &tty->flags)) + mask |=EPOLLHUP ;if (!tty_is_writelocked (tty) &&tty_write_room (tty) >0 ) mask |=EPOLLOUT |EPOLLWRNORM ; -if (gsm->dead) - mask |=EPOLLHUP ;return mask; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 160/287 iommu/exynos: Handle failed IOMMU device registration properly
In reply to Greg Kroah-HartmanFrom: Sam Protsenko <[email protected]>
[ Upstream commit fce398d2d02c0a9a2bedf7c7201b123e153e8963 ]
If iommu_device_register() fails in exynos_sysmmu_probe(), the previous calls have to be cleaned up. In this case, the iommu_device_sysfs_add() should be cleaned up, by calling its remove counterpart call.
--- drivers/iommu/exynos-iommu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iommu/exynos-iommu.c +5 -1
@@ -640,7 +640,7 @@ static int __init exynos_sysmmu_probe(struct platform_device *pdev) ret =iommu_device_register (&data->iommu);if (ret) -return ret; + goto err_iommu_register;platform_set_drvdata (pdev, data);
@@ -667,6 +667,10 @@ static int __init exynos_sysmmu_probe(struct platform_device *pdev)pm_runtime_enable (dev);return 0 ; + +err_iommu_register: +iommu_device_sysfs_remove (&data->iommu); +return ret; }static int __maybe_unused exynos_sysmmu_suspend (struct device *dev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 161/287 rpmsg: qcom_smd: Fix refcount leak in qcom_smd_parse_edge
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 65382585f067d4256ba087934f30f85c9b6984de ]
of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when done.
--- drivers/rpmsg/qcom_smd.c | 1 + 1 file changed, 1 insertion(+)
drivers/rpmsg/qcom_smd.c +1 -0
@@ -1364,6 +1364,7 @@ static int qcom_smd_parse_edge(struct device *dev, } edge->ipc_regmap =syscon_node_to_regmap (syscon_np); +of_node_put (syscon_np);if (IS_ERR (edge->ipc_regmap)) { ret =PTR_ERR (edge->ipc_regmap); goto put_node;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 162/287 kfifo: fix kfifo_to_user() return type
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 045ed31e23aea840648c290dbde04797064960db ]
The kfifo_to_user() macro is supposed to return zero for success or negative error codes. Unfortunately, there is a signedness bug so it returns unsigned int. This only affects callers which try to save the result in ssize_t and as far as I can see the only place which does that is line6_hwdep_read().
TL;DR: s/_uint/_int/.
--- include/linux/kfifo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/kfifo.h +1 -1
@@ -629,7 +629,7 @@ __kfifo_uint_must_check_helper( \* writer, you don't need extra locking to use these macro. */ #define kfifo_to_user (fifo, to, len, copied) \ -__kfifo_uint_must_check_helper( \ +__kfifo_int_must_check_helper( \ ({ \ typeof((fifo) + 1) __tmp = (fifo); \ void __user *__to = (to); \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 163/287 mfd: t7l66xb: Drop platform disable callback
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 128ac294e1b437cb8a7f2ff8ede1cde9082bddbe ]
None of the in-tree instantiations of struct t7l66xb_platform_data provides a disable callback. So better don't dereference this function pointer unconditionally. As there is no user, drop it completely instead of calling it conditional.
This is a preparation for making platform remove callbacks return void.
--- drivers/mfd/t7l66xb.c | 6 +----- include/linux/mfd/t7l66xb.h | 1 - 2 files changed, 1 insertion(+), 6 deletions(-)
drivers/mfd/t7l66xb.c +1 -5
@@ -412,11 +412,8 @@ static int t7l66xb_probe(struct platform_device *dev)static int t7l66xb_remove (struct platform_device *dev) { -struct t7l66xb_platform_data *pdata =dev_get_platdata (&dev->dev);struct t7l66xb *t7l66xb =platform_get_drvdata (dev); -int ret; - ret = pdata->disable (dev);clk_disable_unprepare (t7l66xb->clk48m);clk_put (t7l66xb->clk48m);clk_disable_unprepare (t7l66xb->clk32k);
@@ -427,8 +424,7 @@ static int t7l66xb_remove(struct platform_device *dev)mfd_remove_devices (&dev->dev);kfree (t7l66xb); -return ret; - +return 0 ; }static struct platform_driver t7l66xb_platform_driver = {
include/linux/mfd/t7l66xb.h +0 -1
@@ -16,7 +16,6 @@struct t7l66xb_platform_data {int (*enable)(struct platform_device *dev); -int (*disable)(struct platform_device *dev);int (*suspend)(struct platform_device *dev);int (*resume)(struct platform_device *dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 164/287 iommu/arm-smmu: qcom_iommu: Add of_node_put() when breaking out of loop
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit a91eb6803c1c715738682fece095145cbd68fe0b ]
In qcom_iommu_has_secure_context(), we should call of_node_put() for the reference 'child' when breaking out of for_each_child_of_node() which will automatically increase and decrease the refcount.
--- drivers/iommu/qcom_iommu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/iommu/qcom_iommu.c +5 -2
@@ -767,9 +767,12 @@ static bool qcom_iommu_has_secure_context(struct qcom_iommu_dev *qcom_iommu) {struct device_node *child; -for_each_child_of_node (qcom_iommu->dev->of_node, child) -if (of_device_is_compatible (child,"qcom,msm-iommu-v1-sec" )) +for_each_child_of_node (qcom_iommu->dev->of_node, child) { +if (of_device_is_compatible (child,"qcom,msm-iommu-v1-sec" )) { +of_node_put (child);return true; + } + }return false; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 165/287 s390/zcore: fix race when reading from hardware system area
In reply to Greg Kroah-HartmanFrom: Alexander Gordeev <[email protected]>
[ Upstream commit 9ffed254d938c9e99eb7761c7f739294c84e0367 ]
Memory buffer used for reading out data from hardware system area is not protected against concurrent access.
--- drivers/s390/char/zcore.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/s390/char/zcore.c +10 -1
@@ -53,6 +53,7 @@ static struct dentry *zcore_reipl_file;static struct dentry *zcore_hsa_file;static struct ipl_parameter_block *ipl_block; +static DEFINE_MUTEX (hsa_buf_mutex);static char hsa_buf[PAGE_SIZE ]__aligned(PAGE_SIZE) ;/*
@@ -69,19 +70,24 @@ int memcpy_hsa_user(void __user *dest, unsigned long src, size_t count)if (!hsa_available)return -ENODATA ; +mutex_lock (&hsa_buf_mutex);while (count) {if (sclp_sdias_copy (hsa_buf, src /PAGE_SIZE +2 ,1 )) {TRACE ("sclp_sdias_copy() failed\n" ); +mutex_unlock (&hsa_buf_mutex);return -EIO ; } offset = src %PAGE_SIZE ; bytes =min (PAGE_SIZE - offset, count); -if (copy_to_user (dest, hsa_buf + offset, bytes)) +if (copy_to_user (dest, hsa_buf + offset, bytes)) { +mutex_unlock (&hsa_buf_mutex);return -EFAULT ; + } src += bytes; dest += bytes; count -= bytes; } +mutex_unlock (&hsa_buf_mutex);return 0 ; }
@@ -99,9 +105,11 @@ int memcpy_hsa_kernel(void *dest, unsigned long src, size_t count)if (!hsa_available)return -ENODATA ; +mutex_lock (&hsa_buf_mutex);while (count) {if (sclp_sdias_copy (hsa_buf, src /PAGE_SIZE +2 ,1 )) {TRACE ("sclp_sdias_copy() failed\n" ); +mutex_unlock (&hsa_buf_mutex);return -EIO ; } offset = src %PAGE_SIZE ;
@@ -111,6 +119,7 @@ int memcpy_hsa_kernel(void *dest, unsigned long src, size_t count) dest += bytes; count -= bytes; } +mutex_unlock (&hsa_buf_mutex);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 166/287 ASoC: qcom: q6dsp: Fix an off-by-one in q6adm_alloc_copp()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 673f58f62ca6fc98979d1cf3fe89c3ff33f29b2e ]
find_first_zero_bit() returns MAX_COPPS_PER_PORT at max here. So 'idx' should be tested with ">=" or the test can't match.
--- sound/soc/qcom/qdsp6/q6adm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/qcom/qdsp6/q6adm.c +1 -1
@@ -218,7 +218,7 @@ static struct q6copp *q6adm_alloc_copp(struct q6adm *adm, int port_idx) idx =find_first_zero_bit (&adm->copp_bitmap[port_idx],MAX_COPPS_PER_PORT ); -if (idx >MAX_COPPS_PER_PORT ) +if (idx >=MAX_COPPS_PER_PORT )return ERR_PTR (-EBUSY ); c =kzalloc (sizeof (*c),GFP_ATOMIC );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 167/287 video: fbdev: amba-clcd: Fix refcount leak bugs
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 26c2b7d9fac42eb8317f3ceefa4c1a9a9170ca69 ]
In clcdfb_of_init_display(), we should call of_node_put() for the references returned by of_graph_get_next_endpoint() and of_graph_get_remote_port_parent() which have increased the refcount.
Besides, we should call of_node_put() both in fail path or when the references are not used anymore.
--- drivers/video/fbdev/amba-clcd.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/video/fbdev/amba-clcd.c +18 -6
@@ -772,8 +772,10 @@ static int clcdfb_of_init_display(struct clcd_fb *fb)return -ENODEV ; panel =of_graph_get_remote_port_parent (endpoint); -if (!panel) -return -ENODEV ; +if (!panel) { + err = -ENODEV ; + goto out_endpoint_put; + }if (fb->vendor->init_panel) { err = fb->vendor->init_panel (fb, panel);
@@ -783,11 +785,11 @@ static int clcdfb_of_init_display(struct clcd_fb *fb) err =clcdfb_of_get_backlight (panel, fb->panel);if (err) -return err; + goto out_panel_put; err =clcdfb_of_get_mode (&fb->dev->dev, panel, fb->panel);if (err) -return err; + goto out_panel_put; err =of_property_read_u32 (fb->dev->dev.of_node,"max-memory-bandwidth" , &max_bandwidth);
@@ -816,11 +818,21 @@ static int clcdfb_of_init_display(struct clcd_fb *fb)if (of_property_read_u32_array (endpoint,"arm,pl11x,tft-r0g0b0-pads" , - tft_r0b0g0,ARRAY_SIZE (tft_r0b0g0)) !=0 ) -return -ENOENT ; + tft_r0b0g0,ARRAY_SIZE (tft_r0b0g0)) !=0 ) { + err = -ENOENT ; + goto out_panel_put; + } + +of_node_put (panel); +of_node_put (endpoint);return clcdfb_of_init_tft_panel (fb, tft_r0b0g0[0 ], tft_r0b0g0[1 ], tft_r0b0g0[2 ]); +out_panel_put: +of_node_put (panel); +out_endpoint_put: +of_node_put (endpoint); +return err; }static int clcdfb_of_vram_setup (struct clcd_fb *fb)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 168/287 video: fbdev: sis: fix typos in SiS_GetModeID()
In reply to Greg Kroah-HartmanFrom: Rustam Subkhankulov <[email protected]>
[ Upstream commit 3eb8fccc244bfb41a7961969e4db280d44911226 ]
The second operand of a '&&' operator has no impact on expression result for cases 400 and 512 in SiS_GetModeID().
Judging by the logic and the names of the variables, in both cases a typo was made.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/video/fbdev/sis/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/fbdev/sis/init.c +2 -2
@@ -355,12 +355,12 @@ SiS_GetModeID(int VGAEngine, unsigned int VBFlags, int HDisplay, int VDisplay, }break ;case 400 : -if ((!(VBFlags &CRT1_LCDA )) || ((LCDwidth >=800 ) && (LCDwidth >=600 ))) { +if ((!(VBFlags &CRT1_LCDA )) || ((LCDwidth >=800 ) && (LCDheight >=600 ))) {if (VDisplay ==300 ) ModeIndex = ModeIndex_400x300[Depth]; }break ;case 512 : -if ((!(VBFlags &CRT1_LCDA )) || ((LCDwidth >=1024 ) && (LCDwidth >=768 ))) { +if ((!(VBFlags &CRT1_LCDA )) || ((LCDwidth >=1024 ) && (LCDheight >=768 ))) {if (VDisplay ==384 ) ModeIndex = ModeIndex_512x384[Depth]; }break ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 169/287 powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 9be013b2a9ecb29b5168e4b9db0e48ed53acf37c ]
Commit 0e00a8c9fd92 ("powerpc: Allow CPU selection also on PPC32") enlarged the CPU selection logic to PPC32 by removing depend to PPC64, and failed to restrict that depend to E5500_CPU and E6500_CPU. Fortunately that got unnoticed because -mcpu=8540 will override the -mcpu=e500mc64 or -mpcu=e6500 as they are ealier, but that's fragile and may no be right in the future.
Add back the depend PPC64 on E5500_CPU and E6500_CPU.
--- arch/powerpc/platforms/Kconfig.cputype | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/platforms/Kconfig.cputype +2 -2
@@ -134,11 +134,11 @@ config POWER9_CPU config E5500_CPU bool "Freescale e5500" - depends on E500 + depends on PPC64 && E500 config E6500_CPU bool "Freescale e6500" - depends on E500 + depends on PPC64 && E500 config 860_CPU bool "8xx family"
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 170/287 powerpc/pci: Prefer PCI domain assignment via DT linux,pci-domain and alias
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 0fe1e96fef0a5c53b4c0d1500d356f3906000f81 ]
Other Linux architectures use DT property 'linux,pci-domain' for specifying fixed PCI domain of PCI controller specified in Device-Tree.
And lot of Freescale powerpc boards have defined numbered pci alias in Device-Tree for every PCIe controller which number specify preferred PCI domain.
So prefer usage of DT property 'linux,pci-domain' (via function of_get_pci_domain_nr()) and DT pci alias (via function of_alias_get_id()) on powerpc architecture for assigning PCI domain to PCI controller.
--- arch/powerpc/kernel/pci-common.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
arch/powerpc/kernel/pci-common.c +19 -8
@@ -82,16 +82,30 @@ EXPORT_SYMBOL(get_pci_dma_ops);static int get_phb_number (struct device_node *dn) {int ret, phb_id =-1 ; -u32 prop_32;u64 prop;/* * Try fixed PHB numbering first, by checking archs and reading -* the respective device-tree properties. Firstly, try powernv by -* reading "ibm,opal-phbid", only present in OPAL environment. +* the respective device-tree properties. Firstly, try reading +* standard "linux,pci-domain", then try reading "ibm,opal-phbid" +* (only present in powernv OPAL environment), then try device-tree +* alias and as the last try to use lower bits of "reg" property. */ - ret =of_property_read_u64 (dn,"ibm,opal-phbid" , &prop); + ret =of_get_pci_domain_nr (dn); +if (ret >=0 ) { + prop = ret; + ret =0 ; + } +if (ret) + ret =of_property_read_u64 (dn,"ibm,opal-phbid" , &prop); +if (ret) + ret =of_alias_get_id (dn,"pci" ); +if (ret >=0 ) { + prop = ret; + ret =0 ; + }if (ret) { +u32 prop_32; ret =of_property_read_u32_index (dn,"reg" ,1 , &prop_32); prop = prop_32; }
@@ -103,10 +117,7 @@ static int get_phb_number(struct device_node *dn)if ((phb_id >=0 ) && !test_and_set_bit (phb_id, phb_bitmap))return phb_id; -/* -* If not pseries nor powernv, or if fixed PHB numbering tried to add -* the same PHB number twice, then fallback to dynamic PHB numbering. -*/ +/* If everything fails then fallback to dynamic PHB numbering. */ phb_id =find_first_zero_bit (phb_bitmap,MAX_PHBS );BUG_ON (phb_id >=MAX_PHBS );set_bit (phb_id, phb_bitmap);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 171/287 powerpc/spufs: Fix refcount leak in spufs_init_isolated_loader
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 6ac059dacffa8ab2f7798f20e4bd3333890c541c ]
of_find_node_by_path() returns remote device nodepointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak.
--- arch/powerpc/platforms/cell/spufs/inode.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/cell/spufs/inode.c +1 -0
@@ -684,6 +684,7 @@ spufs_init_isolated_loader(void)return ; loader =of_get_property (dn,"loader" , &size); +of_node_put (dn);if (!loader)return ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 172/287 powerpc/xive: Fix refcount leak in xive_get_max_prio
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 255b650cbec6849443ce2e0cdd187fd5e61c218c ]
of_find_node_by_path() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak.
--- arch/powerpc/sysdev/xive/spapr.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/sysdev/xive/spapr.c +1 -0
@@ -631,6 +631,7 @@ static bool xive_get_max_prio(u8 *max_prio) } reg =of_get_property (rootdn,"ibm,plat-res-int-priorities" , &len); +of_node_put (rootdn);if (!reg) {pr_err ("Failed to read 'ibm,plat-res-int-priorities' property\n" );return false;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 173/287 powerpc/cell/axon_msi: Fix refcount leak in setup_msi_msg_address
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit df5d4b616ee76abc97e5bd348e22659c2b095b1c ]
of_get_next_parent() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() in the error path to avoid refcount leak.
--- arch/powerpc/platforms/cell/axon_msi.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/cell/axon_msi.c +1 -0
@@ -230,6 +230,7 @@ static int setup_msi_msg_address(struct pci_dev *dev, struct msi_msg *msg)if (!prop) {dev_dbg (&dev->dev,"axon_msi: no msi-address-(32|64) properties found\n" ); +of_node_put (dn);return -ENOENT ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 174/287 kprobes: Forbid probing on trampoline and BPF code areas
In reply to Greg Kroah-HartmanFrom: Chen Zhongjin <[email protected]>
[ Upstream commit 28f6c37a2910f565b4f5960df52b2eccae28c891 ]
kernel_text_address() treats ftrace_trampoline, kprobe_insn_slot and bpf_text_address as valid kprobe addresses - which is not ideal.
These text areas are removable and changeable without any notification to kprobes, and probing on them can trigger unexpected behavior:
https://lkml.org/lkml/2022/7/26/1148
Considering that jump_label and static_call text are already forbiden to probe, kernel_text_address() should be replaced with core_kernel_text() and is_module_text_address() to check other text areas which are unsafe to kprobe.
[ mingo: Rewrote the changelog. ]
--- kernel/kprobes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/kprobes.c +2 -1
@@ -1566,7 +1566,8 @@ static int check_kprobe_address_safe(struct kprobe *p,preempt_disable ();/* Ensure it is not in reserved area nor out of text */ -if (!kernel_text_address ((unsigned long ) p->addr) || +if (!(core_kernel_text ((unsigned long ) p->addr) || +is_module_text_address ((unsigned long ) p->addr)) ||within_kprobe_blacklist ((unsigned long ) p->addr) ||jump_label_text_reserved (p->addr, p->addr) ||find_bug ((unsigned long )p->addr)) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 175/287 powerpc/pci: Fix PHB numbering when using opal-phbid
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit f4b39e88b42d13366b831270306326b5c20971ca ]
The recent change to the PHB numbering logic has a logic error in the handling of "ibm,opal-phbid".
When an "ibm,opal-phbid" property is present, &prop is written to and ret is set to zero.
The following call to of_alias_get_id() is skipped because ret == 0.
But then the if (ret >= 0) is true, and the body of that if statement sets prop = ret which throws away the value that was just read from "ibm,opal-phbid".
Fix the logic by only doing the ret >= 0 check in the of_alias_get_id() case.
--- arch/powerpc/kernel/pci-common.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
arch/powerpc/kernel/pci-common.c +6 -4
@@ -98,11 +98,13 @@ static int get_phb_number(struct device_node *dn) }if (ret) ret =of_property_read_u64 (dn,"ibm,opal-phbid" , &prop); -if (ret) + +if (ret) { ret =of_alias_get_id (dn,"pci" ); -if (ret >=0 ) { - prop = ret; - ret =0 ; +if (ret >=0 ) { + prop = ret; + ret =0 ; + } }if (ret) {u32 prop_32;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 176/287 genelf: Use HAVE_LIBCRYPTO_SUPPORT, not the never defined HAVE_LIBCRYPTO
In reply to Greg Kroah-HartmanFrom: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 91cea6be90e436c55cde8770a15e4dac9d3032d0 ]
When genelf was introduced it tested for HAVE_LIBCRYPTO not HAVE_LIBCRYPTO_SUPPORT, which is the define the feature test for openssl defines, fix it.
This also adds disables the deprecation warning, someone has to fix this to build with openssl 3.0 before the warning becomes a hard error.
--- tools/perf/util/genelf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/util/genelf.c +5 -1
@@ -35,7 +35,11 @@#define BUILD_ID_URANDOM /* different uuid for each run */ -#ifdef HAVE_LIBCRYPTO +// FIXME, remove this and fix the deprecation warnings before its removed and +// We'll break for good here... +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#ifdef HAVE_LIBCRYPTO_SUPPORT #define BUILD_ID_MD5 #undef BUILD_ID_SHA/* does not seem to work well when linked with Java */
Signature · 1 line
2.35.1