4.19.268-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 4.19.268-rc1 review
This is the start of the stable review cycle for the 4.19.268 release. There are 105 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 07 Dec 2022 19:07:46 +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.268-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.268-rc1
Adrian Hunter <[email protected]>
mmc: sdhci: Fix voltage switch delay
Masahiro Yamada <[email protected]>
mmc: sdhci: use FIELD_GET for preset value bit masks
Michael Kelley <[email protected]>
x86/ioremap: Fix page aligned size calculation in __ioremap_caller()
Luiz Augusto von Dentz <[email protected]>
Bluetooth: L2CAP: Fix accepting connection request for invalid SPSM
Pawan Gupta <[email protected]>
x86/pm: Add enumeration check before spec MSRs save/restore setup
Pawan Gupta <[email protected]>
x86/tsx: Add a feature bit for TSX control MSR support
Keith Busch <[email protected]>
nvme: restrict management ioctls to admin
Kuniyuki Iwashima <[email protected]>
tcp/udp: Fix memory leak in ipv6_renew_options().
Lee Jones <[email protected]>
Kconfig.debug: provide a little extra FRAME_WARN leeway when KASAN is enabled
Helge Deller <[email protected]>
parisc: Increase FRAME_WARN to 2048 bytes on parisc
Guenter Roeck <[email protected]>
xtensa: increase size of gcc stack frame check
Helge Deller <[email protected]>
parisc: Increase size of gcc stack frame check
Xiongfeng Wang <[email protected]>
iommu/vt-d: Fix PCI device refcount leak in dmar_dev_scope_init()
Maxim Korotkov <[email protected]>
pinctrl: single: Fix potential division by zero
Mark Brown <[email protected]>
ASoC: ops: Fix bounds check for _sx controls
Nathan Chancellor <[email protected]>
mm: Fix '.data.once' orphan section warning
James Morse <[email protected]>
arm64: errata: Fix KVM Spectre-v2 mitigation selection for Cortex-A57/A72
James Morse <[email protected]>
arm64: Fix panic() when Spectre-v2 causes Spectre-BHB to re-allocate KVM vectors
Andy Shevchenko <[email protected]>
pinctrl: intel: Save and restore pins in "direct IRQ" mode
Pawan Gupta <[email protected]>
x86/bugs: Make sure MSR_SPEC_CTRL is updated properly upon resume from S3
ZhangPeng <[email protected]>
nilfs2: fix NULL pointer dereference in nilfs_palloc_commit_free_entry()
Tiezhu Yang <[email protected]>
tools/vm/slabinfo-gnuplot: use "grep -E" instead of "egrep"
Steven Rostedt (Google) <[email protected]>
error-injection: Add prompt for function error injection
ChenXiaoSong <[email protected]>
btrfs: qgroup: fix sleep from invalid context bug in btrfs_qgroup_inherit()
Yang Yingliang <[email protected]>
hwmon: (coretemp) fix pci device refcount leak in nv1a_ram_new()
Phil Auld <[email protected]>
hwmon: (coretemp) Check for null before removing sysfs attrs
Yoshihiro Shimoda <[email protected]>
net: ethernet: renesas: ravb: Fix promiscuous mode after system resumed
Willem de Bruijn <[email protected]>
packet: do not set TP_STATUS_CSUM_VALID on CHECKSUM_COMPLETE
Shigeru Yoshida <[email protected]>
net: tun: Fix use-after-free in tun_detach()
YueHaibing <[email protected]>
net: hsr: Fix potential use-after-free
Jerry Ray <[email protected]>
dsa: lan9303: Correct stat name
Wang Hai <[email protected]>
net/9p: Fix a potential socket leak in p9_socket_open
Yuan Can <[email protected]>
net: net_netdev: Fix error handling in ntb_netdev_init_module()
Yang Yingliang <[email protected]>
net: phy: fix null-ptr-deref while probe() failed
Duoming Zhou <[email protected]>
qlcnic: fix sleep-in-atomic-context bugs caused by msleep
Zhang Changzhong <[email protected]>
can: cc770: cc770_isa_probe(): add missing free_cc770dev()
Zhang Changzhong <[email protected]>
can: sja1000_isa: sja1000_isa_probe(): add missing free_sja1000dev()
YueHaibing <[email protected]>
net/mlx5: Fix uninitialized variable bug in outlen_write()
Yang Yingliang <[email protected]>
of: property: decrement node refcount in of_fwnode_get_reference_args()
Gaosheng Cui <[email protected]>
hwmon: (ibmpex) Fix possible UAF when ibmpex_register_bmc() fails
Yang Yingliang <[email protected]>
hwmon: (i5500_temp) fix missing pci_disable_device()
Srikar Dronamraju <[email protected]>
scripts/faddr2line: Fix regression in name resolution on ppc64le
Paul Gazzillo <[email protected]>
iio: light: rpr0521: add missing Kconfig dependencies
Wei Yongjun <[email protected]>
iio: health: afe4404: Fix oob read in afe4404_[read|write]_raw
Wei Yongjun <[email protected]>
iio: health: afe4403: Fix oob read in afe4403_read_raw
Sam James <[email protected]>
kbuild: fix -Wimplicit-function-declaration in license_is_gpl_compatible
Frieder Schrempf <[email protected]>
spi: spi-imx: Fix spi_bus_clk if requested clock is higher than input clock
Anand Jain <[email protected]>
btrfs: free btrfs_path before copying inodes to userspace
Christian König <[email protected]>
drm/amdgpu: always register an MMU notifier for userptr
Lyude Paul <[email protected]>
drm/amd/dc/dce120: Fix audio register mapping, stop triggering KASAN
Anand Jain <[email protected]>
btrfs: free btrfs_path before copying subvol info to userspace
Anand Jain <[email protected]>
btrfs: free btrfs_path before copying fspath to userspace
Josef Bacik <[email protected]>
btrfs: free btrfs_path before copying root refs to userspace
Mikulas Patocka <[email protected]>
dm integrity: flush the journal on suspend
Enrico Sau <[email protected]>
net: usb: qmi_wwan: add Telit 0x103a composition
Gleb Mazovetskiy <[email protected]>
tcp: configurable source port perturb table size
Kai-Heng Feng <[email protected]>
platform/x86: hp-wmi: Ignore Smart Experience App event
Hans de Goede <[email protected]>
platform/x86: acer-wmi: Enable SW_TABLET_MODE on Switch V 10 (SW5-017)
Xiongfeng Wang <[email protected]>
platform/x86: asus-wmi: add missing pci_dev_put() in asus_wmi_set_xusb2pr()
ruanjinjie <[email protected]>
xen/platform-pci: add missing free_irq() in error path
Lukas Wunner <[email protected]>
serial: 8250: 8250_omap: Avoid RS485 RTS glitch on ->set_termios()
Aman Dhoot <[email protected]>
Input: synaptics - switch touchpad on HP Laptop 15-da3001TU to RMI mode
Chen Zhongjin <[email protected]>
nilfs2: fix nilfs_sufile_mark_dirty() not set segment usage as dirty
Xiubo Li <[email protected]>
ceph: avoid putting the realm twice when decoding snaps fails
Xiubo Li <[email protected]>
ceph: do not update snapshot context when there is no new snapshot
Mitja Spes <[email protected]>
iio: pressure: ms5611: fixed value compensation bug
Lars-Peter Clausen <[email protected]>
iio: ms5611: Simplify IO callback parameters
Randy Dunlap <[email protected]>
nios2: add FORCE for vmlinuz.gz
Chen Zhongjin <[email protected]>
iio: core: Fix entry not deleted when iio_register_sw_trigger_type() fails
Alejandro Concepción Rodríguez <[email protected]>
iio: light: apds9960: fix wrong register for gesture gain
Jakob Unterwurzacher <[email protected]>
arm64: dts: rockchip: lower rk3399-puma-haikou SD controller clock frequency
Heiko Carstens <[email protected]>
s390/crashdump: fix TOD programmable field size
Yu Liao <[email protected]>
net: thunderx: Fix the ACPI memory leak
Martin Faltesek <[email protected]>
nfc: st-nci: fix memory leaks in EVT_TRANSACTION
Martin Faltesek <[email protected]>
nfc: st-nci: fix incorrect validating logic in EVT_TRANSACTION
Stefan Haberland <[email protected]>
s390/dasd: fix no record found for raw_track_access
Kuniyuki Iwashima <[email protected]>
dccp/tcp: Reset saddr on failure after inet6?_hash_connect().
Yang Yingliang <[email protected]>
bnx2x: fix pci device refcount leak in bnx2x_vf_is_pcie_pending()
Liu Shixin <[email protected]>
NFC: nci: fix memory leak in nci_rx_data_packet()
Chen Zhongjin <[email protected]>
xfrm: Fix ignored return value in xfrm6_init()
YueHaibing <[email protected]>
tipc: check skb_linearize() return value in tipc_disc_rcv()
Xin Long <[email protected]>
tipc: add an extra conn_get in tipc_conn_alloc
Xin Long <[email protected]>
tipc: set con sock in tipc_conn_alloc
Moshe Shemesh <[email protected]>
net/mlx5: Fix FW tracer timestamp calculation
Yang Yingliang <[email protected]>
Drivers: hv: vmbus: fix possible memory leak in vmbus_device_register()
Yang Yingliang <[email protected]>
Drivers: hv: vmbus: fix double free in the error path of vmbus_add_channel_work()
Yang Yingliang <[email protected]>
net: pch_gbe: fix pci device refcount leak while module exiting
Zhang Changzhong <[email protected]>
net/qla3xxx: fix potential memleak in ql3xxx_send()
Peter Kosyh <[email protected]>
net/mlx4: Check retval of mlx4_bitmap_init
Zheng Yongjun <[email protected]>
ARM: mxs: fix memory leak in mxs_machine_init()
Zhengchao Shao <[email protected]>
9p/fd: fix issue of list_del corruption in p9_fd_cancel()
Wang Hai <[email protected]>
net: pch_gbe: fix potential memleak in pch_gbe_tx_queue()
Lin Ma <[email protected]>
nfc/nci: fix race with opening and closing
Michael Grzeschik <[email protected]>
ARM: dts: at91: sam9g20ek: enable udc vbus gpio pinctrl
Samuel Holland <[email protected]>
bus: sunxi-rsb: Support atomic transfers
Detlev Casanova <[email protected]>
ASoC: sgtl5000: Reset the CHIP_CLK_CTRL reg on remove
Dominik Haller <[email protected]>
ARM: dts: am335x-pcm-953: Define fixed regulators in root node
Herbert Xu <[email protected]>
af_key: Fix send_acquire race with pfkey_register
Jason A. Donenfeld <[email protected]>
MIPS: pic32: treat port as signed integer
Nathan Chancellor <[email protected]>
RISC-V: vdso: Do not add missing symbols to version section in linker script
Hans de Goede <[email protected]>
drm: panel-orientation-quirks: Add quirk for Acer Switch V 10 (SW5-017)
Sean Nyekjaer <[email protected]>
spi: stm32: fix stm32_spi_prepare_mbr() that halves spi clk for every run
Nicolas Cavallari <[email protected]>
wifi: mac80211: Fix ack frame idr leak when mesh has no route
Gaosheng Cui <[email protected]>
audit: fix undefined behavior in bit shift for AUDIT_BIT
Jonas Jelonek <[email protected]>
wifi: mac80211_hwsim: fix debugfs attribute ps with rc table support
-------------
Diffstat:
Makefile | 4 +- arch/arm/boot/dts/am335x-pcm-953.dtsi | 28 ++++----- arch/arm/boot/dts/at91sam9g20ek_common.dtsi | 9 +++ arch/arm/mach-mxs/mach-mxs.c | 4 +- .../arm64/boot/dts/rockchip/rk3399-puma-haikou.dts | 2 +- arch/arm64/kernel/cpu_errata.c | 24 ++++++-- arch/mips/include/asm/fw/fw.h | 2 +- arch/mips/pic32/pic32mzda/early_console.c | 13 ++-- arch/mips/pic32/pic32mzda/init.c | 2 +- arch/nios2/boot/Makefile | 2 +- arch/riscv/kernel/vdso/Makefile | 3 + arch/riscv/kernel/vdso/vdso.lds.S | 2 + arch/s390/kernel/crash_dump.c | 2 +- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/include/asm/nospec-branch.h | 2 +- arch/x86/kernel/cpu/bugs.c | 21 ++++--- arch/x86/kernel/cpu/tsx.c | 33 +++++----- arch/x86/kernel/process.c | 2 +- arch/x86/mm/ioremap.c | 8 ++- arch/x86/power/cpu.c | 23 ++++--- drivers/bus/sunxi-rsb.c | 29 ++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 8 +-- .../drm/amd/display/dc/dce120/dce120_resource.c | 3 +- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++ drivers/hv/channel_mgmt.c | 6 +- drivers/hv/vmbus_drv.c | 1 + drivers/hwmon/coretemp.c | 9 ++- drivers/hwmon/i5500_temp.c | 2 +- drivers/hwmon/ibmpex.c | 1 + drivers/iio/health/afe4403.c | 5 +- drivers/iio/health/afe4404.c | 12 ++-- drivers/iio/industrialio-sw-trigger.c | 6 +- drivers/iio/light/Kconfig | 2 + drivers/iio/light/apds9960.c | 12 ++-- drivers/iio/pressure/ms5611.h | 18 +++--- drivers/iio/pressure/ms5611_core.c | 56 +++++++++-------- drivers/iio/pressure/ms5611_i2c.c | 11 ++-- drivers/iio/pressure/ms5611_spi.c | 17 +++--- drivers/input/mouse/synaptics.c | 1 + drivers/iommu/dmar.c | 1 + drivers/md/dm-integrity.c | 7 +-- drivers/mmc/host/sdhci.c | 71 ++++++++++++++++++---- drivers/mmc/host/sdhci.h | 12 ++-- drivers/net/can/cc770/cc770_isa.c | 10 +-- drivers/net/can/sja1000/sja1000_isa.c | 10 +-- drivers/net/dsa/lan9303-core.c | 2 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 12 ++-- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 4 +- drivers/net/ethernet/mellanox/mlx4/qp.c | 3 +- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 4 +- .../ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 2 +- .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 6 +- drivers/net/ethernet/qlogic/qla3xxx.c | 1 + .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 4 +- drivers/net/ethernet/renesas/ravb_main.c | 1 + drivers/net/ntb_netdev.c | 9 ++- drivers/net/phy/phy_device.c | 1 + drivers/net/tun.c | 4 +- drivers/net/usb/qmi_wwan.c | 1 + drivers/net/wireless/mac80211_hwsim.c | 5 ++ drivers/nfc/st-nci/se.c | 6 +- drivers/nvme/host/core.c | 6 ++ drivers/of/property.c | 4 +- drivers/pinctrl/intel/pinctrl-intel.c | 27 +++++++- drivers/pinctrl/pinctrl-single.c | 2 +- drivers/platform/x86/acer-wmi.c | 9 +++ drivers/platform/x86/asus-wmi.c | 2 + drivers/platform/x86/hp-wmi.c | 3 + drivers/s390/block/dasd_eckd.c | 6 +- drivers/spi/spi-imx.c | 3 +- drivers/spi/spi-stm32.c | 2 +- drivers/tty/serial/8250/8250_omap.c | 7 ++- drivers/xen/platform-pci.c | 7 ++- fs/btrfs/ioctl.c | 23 ++++--- fs/btrfs/qgroup.c | 9 +-- fs/ceph/snap.c | 31 +++++++--- fs/nilfs2/dat.c | 7 +++ fs/nilfs2/sufile.c | 8 +++ include/linux/license.h | 2 + include/linux/mmdebug.h | 2 +- include/uapi/linux/audit.h | 2 +- lib/Kconfig.debug | 14 ++++- net/9p/trans_fd.c | 6 +- net/bluetooth/l2cap_core.c | 13 ++++ net/dccp/ipv4.c | 2 + net/dccp/ipv6.c | 2 + net/hsr/hsr_forward.c | 5 +- net/ipv4/Kconfig | 10 +++ net/ipv4/inet_hashtables.c | 10 +-- net/ipv4/tcp_ipv4.c | 2 + net/ipv6/ipv6_sockglue.c | 7 +++ net/ipv6/tcp_ipv6.c | 2 + net/ipv6/xfrm6_policy.c | 6 +- net/key/af_key.c | 32 +++++++--- net/mac80211/mesh_pathtbl.c | 2 +- net/nfc/nci/core.c | 2 +- net/nfc/nci/data.c | 4 +- net/packet/af_packet.c | 6 +- net/tipc/discover.c | 5 +- net/tipc/topsrv.c | 20 +++--- scripts/faddr2line | 7 ++- sound/soc/codecs/sgtl5000.c | 1 + sound/soc/soc-ops.c | 2 +- tools/vm/slabinfo-gnuplot.sh | 4 +- 104 files changed, 596 insertions(+), 298 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/105 wifi: mac80211_hwsim: fix debugfs attribute ps with rc table support
From: Jonas Jelonek <[email protected]>
[ Upstream commit 69188df5f6e4cecc6b76b958979ba363cd5240e8 ]
Fixes a warning that occurs when rc table support is enabled (IEEE80211_HW_SUPPORTS_RC_TABLE) in mac80211_hwsim and the PS mode is changed via the exported debugfs attribute.
When the PS mode is changed, a packet is broadcasted via hwsim_send_nullfunc by creating and transmitting a plain skb with only header initialized. The ieee80211 rate array in the control buffer is zero-initialized. When ratetbl support is enabled, ieee80211_get_tx_rates is called for the skb with sta parameter set to NULL and thus no ratetbl can be used. The final rate array then looks like [-1,0; 0,0; 0,0; 0,0] which causes the warning in ieee80211_get_tx_rate.
The issue is fixed by setting the count of the first rate with idx '0' to 1 and hence ieee80211_get_tx_rates won't overwrite it with idx '-1'.
--- drivers/net/wireless/mac80211_hwsim.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/mac80211_hwsim.c +5 -0
@@ -686,6 +686,7 @@ static void hwsim_send_nullfunc(struct mac80211_hwsim_data *data, u8 *mac,struct hwsim_vif_priv *vp = (void *)vif->drv_priv;struct sk_buff *skb;struct ieee80211_hdr *hdr; +struct ieee80211_tx_info *cb;if (!vp->assoc)return ;
@@ -707,6 +708,10 @@ static void hwsim_send_nullfunc(struct mac80211_hwsim_data *data, u8 *mac,memcpy (hdr->addr2, mac,ETH_ALEN );memcpy (hdr->addr3, vp->bssid,ETH_ALEN ); + cb =IEEE80211_SKB_CB (skb); + cb->control.rates[0 ].count =1 ; + cb->control.rates[1 ].idx =-1 ; +rcu_read_lock ();mac80211_hwsim_tx_frame (data->hw, skb,rcu_dereference (vif->chanctx_conf)->def.chan);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 2/105 audit: fix undefined behavior in bit shift for AUDIT_BIT
In reply to Greg Kroah-HartmanFrom: Gaosheng Cui <[email protected]>
[ Upstream commit 986d93f55bdeab1cac858d1e47b41fac10b2d7f6 ]
Shifting signed 32-bit value by 31 bits is undefined, so changing significant bit to unsigned. The UBSAN warning calltrace like below:
UBSAN: shift-out-of-bounds in kernel/auditfilter.c:179:23 left shift of 1 by 31 places cannot be represented in type 'int' Call Trace: <TASK> dump_stack_lvl+0x7d/0xa5 dump_stack+0x15/0x1b ubsan_epilogue+0xe/0x4e __ubsan_handle_shift_out_of_bounds+0x1e7/0x20c audit_register_class+0x9d/0x137 audit_classes_init+0x4d/0xb8 do_one_initcall+0x76/0x430 kernel_init_freeable+0x3b3/0x422 kernel_init+0x24/0x1e0 ret_from_fork+0x1f/0x30 </TASK>
--- include/uapi/linux/audit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/audit.h +1 -1
@@ -177,7 +177,7 @@#define AUDIT_MAX_KEY_LEN 256#define AUDIT_BITMASK_SIZE 64#define AUDIT_WORD (nr) ((__u32)((nr)/32)) -#define AUDIT_BIT (nr) (1 << ((nr) - AUDIT_WORD(nr)*32)) +#define AUDIT_BIT (nr) (1U << ((nr) - AUDIT_WORD(nr)*32))#define AUDIT_SYSCALL_CLASSES 16#define AUDIT_CLASS_DIR_WRITE 0
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 3/105 wifi: mac80211: Fix ack frame idr leak when mesh has no route
In reply to Greg Kroah-HartmanFrom: Nicolas Cavallari <[email protected]>
[ Upstream commit 39e7b5de9853bd92ddbfa4b14165babacd7da0ba ]
When trying to transmit an data frame with tx_status to a destination that have no route in the mesh, then it is dropped without recrediting the ack_status_frames idr.
Once it is exhausted, wpa_supplicant starts failing to do SAE with NL80211_CMD_FRAME and logs "nl80211: Frame command failed".
Use ieee80211_free_txskb() instead of kfree_skb() to fix it.
--- net/mac80211/mesh_pathtbl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/mesh_pathtbl.c +1 -1
@@ -731,7 +731,7 @@ int mesh_path_send_to_gates(struct mesh_path *mpath)void mesh_path_discard_frame (struct ieee80211_sub_if_data *sdata,struct sk_buff *skb) { -kfree_skb (skb); +ieee80211_free_txskb (&sdata->local->hw, skb); sdata->u.mesh.mshstats.dropped_frames_no_route++; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 4/105 spi: stm32: fix stm32_spi_prepare_mbr() that halves spi clk for every run
In reply to Greg Kroah-HartmanFrom: Sean Nyekjaer <[email protected]>
[ Upstream commit 62aa1a344b0904549f6de7af958e8a1136fd5228 ]
When this driver is used with a driver that uses preallocated spi_transfer structs. The speed_hz is halved by every run. This results in:
spi_stm32 44004000.spi: SPI transfer setup failed
ads7846 spi0.0: SPI transfer failed: -22
Example when running with DIV_ROUND_UP():
- First run; speed_hz = 1000000, spi->clk_rate 125000000
div 125 -> mbrdiv = 7, cur_speed = 976562
- Second run; speed_hz = 976562
div 128,00007 (roundup to 129) -> mbrdiv = 8, cur_speed = 488281
- Third run; speed_hz = 488281
div 256,000131072067109 (roundup to 257) and then -EINVAL is returned.
Use DIV_ROUND_CLOSEST to allow to round down and allow us to keep the set speed.
--- drivers/spi/spi-stm32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-stm32.c +1 -1
@@ -255,7 +255,7 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz)u32 div, mbrdiv;/* Ensure spi->clk_rate is even */ - div =DIV_ROUND_UP (spi->clk_rate & ~0x1 , speed_hz); + div =DIV_ROUND_CLOSEST (spi->clk_rate & ~0x1 , speed_hz);/* * SPI framework set xfer->speed_hz to master->max_speed_hz if
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 5/105 drm: panel-orientation-quirks: Add quirk for Acer Switch V 10 (SW5-017)
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 653f2d94fcda200b02bd79cea2e0307b26c1b747 ]
Like the Acer Switch One 10 S1003, for which there already is a quirk, the Acer Switch V 10 (SW5-017) has a 800x1280 portrait screen mounted in the tablet part of a landscape oriented 2-in-1. Add a quirk for this.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -95,6 +95,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"), }, .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* Acer Switch V 10 (SW5-017) */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"Acer" ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "SW5-017"), + }, + .driver_data = (void *)&lcd800x1280_rightside_up, }, { /* Anbernic Win600 */ .matches = { DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Anbernic"),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 6/105 RISC-V: vdso: Do not add missing symbols to version section in linker script
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit fcae44fd36d052e956e69a64642fc03820968d78 ]
Recently, ld.lld moved from '--undefined-version' to '--no-undefined-version' as the default, which breaks the compat vDSO build:
ld.lld: error: version script assignment of 'LINUX_4.15' to symbol '__vdso_gettimeofday' failed: symbol not defined ld.lld: error: version script assignment of 'LINUX_4.15' to symbol '__vdso_clock_gettime' failed: symbol not defined ld.lld: error: version script assignment of 'LINUX_4.15' to symbol '__vdso_clock_getres' failed: symbol not defined
These symbols are not present in the compat vDSO or the regular vDSO for 32-bit but they are unconditionally included in the version section of the linker script, which is prohibited with '--no-undefined-version'.
Fix this issue by only including the symbols that are actually exported in the version section of the linker script.
--- arch/riscv/kernel/vdso/Makefile | 3 +++ arch/riscv/kernel/vdso/vdso.lds.S | 2 ++ 2 files changed, 5 insertions(+)
arch/riscv/kernel/vdso/Makefile +3 -0
@@ -17,6 +17,9 @@ obj-vdso := $(addprefix $(obj)/, $(obj-vdso)) obj-y += vdso.o vdso-syms.o CPPFLAGS_vdso.lds += -P -C -U$(ARCH) +ifneq ($(filter vgettimeofday, $(vdso-syms)),) +CPPFLAGS_vdso.lds += -DHAS_VGETTIMEOFDAY +endif # Disable gcov profiling for VDSO code GCOV_PROFILE := n
arch/riscv/kernel/vdso/vdso.lds.S +2 -0
@@ -70,9 +70,11 @@ VERSION LINUX_4.15 { global: __vdso_rt_sigreturn; +#ifdef HAS_VGETTIMEOFDAY __vdso_gettimeofday; __vdso_clock_gettime; __vdso_clock_getres; +#endif __vdso_getcpu; __vdso_flush_icache; local: *;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 7/105 MIPS: pic32: treat port as signed integer
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
[ Upstream commit 648060902aa302331b5d6e4f26d8ee0761d239ab ]
get_port_from_cmdline() returns an int, yet is assigned to a char, which is wrong in its own right, but also, with char becoming unsigned, this poses problems, because -1 is used as an error value. Further complicating things, fw_init_early_console() is only ever called with a -1 argument. Fix this up by removing the unused argument from fw_init_early_console() and treating port as a proper signed integer.
--- arch/mips/include/asm/fw/fw.h | 2 +- arch/mips/pic32/pic32mzda/early_console.c | 13 ++++++------- arch/mips/pic32/pic32mzda/init.c | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-)
arch/mips/include/asm/fw/fw.h +1 -1
@@ -26,6 +26,6 @@ extern char *fw_getcmdline(void);extern void fw_meminit (void );extern char *fw_getenv (char *name);extern unsigned long fw_getenvl (char *name); -extern void fw_init_early_console (char port); +extern void fw_init_early_console (void );#endif /* __ASM_FW_H_ */
arch/mips/pic32/pic32mzda/early_console.c +6 -7
@@ -35,7 +35,7 @@#define U_BRG (x) (UART_BASE(x) + 0x40)static void __iomem *uart_base; -static char console_port =-1 ; +static int console_port =-1 ;static int __init configure_uart_pins (int port) {
@@ -55,7 +55,7 @@ static int __init configure_uart_pins(int port)return 0 ; } -static void __init configure_uart (char port,int baud) +static void __init configure_uart (int port,int baud) {u32 pbclk;
@@ -68,7 +68,7 @@ static void __init configure_uart(char port, int baud) uart_base + PIC32_SET(U_STA(port))); } -static void __init setup_early_console (char port,int baud) +static void __init setup_early_console (int port,int baud) {if (configure_uart_pins (port))return ;
@@ -138,16 +138,15 @@ static int __init get_baud_from_cmdline(char *arch_cmdline)return baud; } -void __init fw_init_early_console (char port) +void __init fw_init_early_console (void ) {char *arch_cmdline =pic32_getcmdline (); -int baud =-1 ; +int baud, port; uart_base =ioremap_nocache (PIC32_BASE_UART ,0xc00 ); baud =get_baud_from_cmdline (arch_cmdline); -if (port ==-1 ) - port =get_port_from_cmdline (arch_cmdline); + port =get_port_from_cmdline (arch_cmdline);if (port ==-1 ) port =EARLY_CONSOLE_PORT ;
arch/mips/pic32/pic32mzda/init.c +1 -1
@@ -68,7 +68,7 @@ void __init plat_mem_setup(void)strlcpy (arcs_cmdline, boot_command_line,COMMAND_LINE_SIZE );#ifdef CONFIG_EARLY_PRINTK -fw_init_early_console (-1 ); +fw_init_early_console ();#endif pic32_config_init (); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 8/105 af_key: Fix send_acquire race with pfkey_register
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
[ Upstream commit 7f57f8165cb6d2c206e2b9ada53b9e2d6d8af42f ]
The function pfkey_send_acquire may race with pfkey_register (which could even be in a different name space). This may result in a buffer overrun.
Allocating the maximum amount of memory that could be used prevents this.
--- net/key/af_key.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-)
net/key/af_key.c +22 -10
@@ -2915,7 +2915,7 @@ static int count_ah_combs(const struct xfrm_tmpl *t)break ;if (!aalg->pfkey_supported)continue ; -if (aalg_tmpl_set (t, aalg) && aalg->available) +if (aalg_tmpl_set (t, aalg)) sz +=sizeof (struct sadb_comb ); }return sz +sizeof (struct sadb_prop );
@@ -2933,7 +2933,7 @@ static int count_esp_combs(const struct xfrm_tmpl *t)if (!ealg->pfkey_supported)continue ; -if (!(ealg_tmpl_set (t, ealg) && ealg->available)) +if (!(ealg_tmpl_set (t, ealg)))continue ;for (k =1 ; ; k++) {
@@ -2944,16 +2944,17 @@ static int count_esp_combs(const struct xfrm_tmpl *t)if (!aalg->pfkey_supported)continue ; -if (aalg_tmpl_set (t, aalg) && aalg->available) +if (aalg_tmpl_set (t, aalg)) sz +=sizeof (struct sadb_comb ); } }return sz +sizeof (struct sadb_prop ); } -static void dump_ah_combs (struct sk_buff *skb,const struct xfrm_tmpl *t) +static int dump_ah_combs (struct sk_buff *skb,const struct xfrm_tmpl *t) {struct sadb_prop *p; +int sz =0 ;int i; p =skb_put (skb,sizeof (struct sadb_prop ));
@@ -2981,13 +2982,17 @@ static void dump_ah_combs(struct sk_buff *skb, const struct xfrm_tmpl *t) c->sadb_comb_soft_addtime =20 *60 *60 ; c->sadb_comb_hard_usetime =8 *60 *60 ; c->sadb_comb_soft_usetime =7 *60 *60 ; + sz +=sizeof (*c); } } + +return sz +sizeof (*p); } -static void dump_esp_combs (struct sk_buff *skb,const struct xfrm_tmpl *t) +static int dump_esp_combs (struct sk_buff *skb,const struct xfrm_tmpl *t) {struct sadb_prop *p; +int sz =0 ;int i, k; p =skb_put (skb,sizeof (struct sadb_prop ));
@@ -3029,8 +3034,11 @@ static void dump_esp_combs(struct sk_buff *skb, const struct xfrm_tmpl *t) c->sadb_comb_soft_addtime =20 *60 *60 ; c->sadb_comb_hard_usetime =8 *60 *60 ; c->sadb_comb_soft_usetime =7 *60 *60 ; + sz +=sizeof (*c); } } + +return sz +sizeof (*p); }static int key_notify_policy_expire (struct xfrm_policy *xp,const struct km_event *c)
@@ -3160,6 +3168,7 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, structstruct sadb_x_sec_ctx *sec_ctx;struct xfrm_sec_ctx *xfrm_ctx;int ctx_size =0 ; +int alg_size =0 ; sockaddr_size =pfkey_sockaddr_size (x->props.family);if (!sockaddr_size)
@@ -3171,16 +3180,16 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, structsizeof (struct sadb_x_policy );if (x->id.proto ==IPPROTO_AH ) - size +=count_ah_combs (t); + alg_size =count_ah_combs (t);else if (x->id.proto ==IPPROTO_ESP ) - size +=count_esp_combs (t); + alg_size =count_esp_combs (t);if ((xfrm_ctx = x->security)) { ctx_size =PFKEY_ALIGN8 (xfrm_ctx->ctx_len); size +=sizeof (struct sadb_x_sec_ctx ) + ctx_size; } - skb =alloc_skb (size +16 ,GFP_ATOMIC ); + skb =alloc_skb (size + alg_size +16 ,GFP_ATOMIC );if (skb ==NULL )return -ENOMEM ;
@@ -3234,10 +3243,13 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct pol->sadb_x_policy_priority = xp->priority;/* Set sadb_comb's. */ + alg_size =0 ;if (x->id.proto ==IPPROTO_AH ) -dump_ah_combs (skb, t); + alg_size =dump_ah_combs (skb, t);else if (x->id.proto ==IPPROTO_ESP ) -dump_esp_combs (skb, t); + alg_size =dump_esp_combs (skb, t); + + hdr->sadb_msg_len += alg_size /8 ;/* security context */ if (xfrm_ctx) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 9/105 ARM: dts: am335x-pcm-953: Define fixed regulators in root node
In reply to Greg Kroah-HartmanFrom: Dominik Haller <[email protected]>
[ Upstream commit 8950f345a67d8046d2472dd6ea81fa18ef5b4844 ]
Remove the regulators node and define fixed regulators in the root node. Prevents the sdhci-omap driver from waiting in probe deferral forever because of the missing vmmc-supply and keeps am335x-pcm-953 consistent with the other Phytec AM335 boards.
Message-Id: <[email protected]>
--- arch/arm/boot/dts/am335x-pcm-953.dtsi | 28 +++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-)
arch/arm/boot/dts/am335x-pcm-953.dtsi +13 -15
@@ -15,22 +15,20 @@ / { compatible = "phytec,am335x-pcm-953", "phytec,am335x-phycore-som", "ti,am33xx"; /* Power */ - regulators { - vcc3v3: fixedregulator@1 { - compatible = "regulator-fixed"; - regulator-name = "vcc3v3"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - regulator-boot-on; - }; + vcc3v3: fixedregulator1 { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + }; - vcc1v8: fixedregulator@2 { - compatible = "regulator-fixed"; - regulator-name = "vcc1v8"; - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <1800000>; - regulator-boot-on; - }; + vcc1v8: fixedregulator2 { + compatible = "regulator-fixed"; + regulator-name = "vcc1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; }; /* User IO */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 10/105 ASoC: sgtl5000: Reset the CHIP_CLK_CTRL reg on remove
In reply to Greg Kroah-HartmanFrom: Detlev Casanova <[email protected]>
[ Upstream commit 0bb8e9b36b5b7f2e77892981ff6c27ee831d8026 ]
Since commit bf2aebccddef ("ASoC: sgtl5000: Fix noise on shutdown/remove"), the device power control registers are reset when the driver is removed/shutdown.
This is an issue when the device is configured to use the PLL clock. The device will stop responding if it is still configured to use the PLL clock but the PLL clock is powered down.
When rebooting linux, the probe function will show:
sgtl5000 0-000a: Error reading chip id -11
Make sure that the CHIP_CLK_CTRL is reset to its default value before powering down the device.
--- sound/soc/codecs/sgtl5000.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/sgtl5000.c +1 -0
@@ -1769,6 +1769,7 @@ static int sgtl5000_i2c_remove(struct i2c_client *client) {struct sgtl5000_priv *sgtl5000 =i2c_get_clientdata (client); +regmap_write (sgtl5000->regmap,SGTL5000_CHIP_CLK_CTRL ,SGTL5000_CHIP_CLK_CTRL_DEFAULT );regmap_write (sgtl5000->regmap,SGTL5000_CHIP_DIG_POWER ,SGTL5000_DIG_POWER_DEFAULT );regmap_write (sgtl5000->regmap,SGTL5000_CHIP_ANA_POWER ,SGTL5000_ANA_POWER_DEFAULT );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 11/105 bus: sunxi-rsb: Support atomic transfers
In reply to Greg Kroah-HartmanFrom: Samuel Holland <[email protected]>
[ Upstream commit 077686da0e2162c4ea5ae0df205849c2a7a84479 ]
When communicating with a PMIC during system poweroff (pm_power_off()), IRQs are disabled and we are in a RCU read-side critical section, so we cannot use wait_for_completion_io_timeout(). Instead, poll the status register for transfer completion.
--- drivers/bus/sunxi-rsb.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)
drivers/bus/sunxi-rsb.c +21 -8
@@ -268,6 +268,9 @@ EXPORT_SYMBOL_GPL(sunxi_rsb_driver_register);/* common code that starts a transfer */ static int _sunxi_rsb_run_xfer (struct sunxi_rsb *rsb) { +u32 int_mask, status; +bool timeout; +if (readl (rsb->regs +RSB_CTRL ) &RSB_CTRL_START_TRANS ) {dev_dbg (rsb->dev,"RSB transfer still in progress\n" );return -EBUSY ;
@@ -275,13 +278,23 @@ static int _sunxi_rsb_run_xfer(struct sunxi_rsb *rsb)reinit_completion (&rsb->complete); -writel (RSB_INTS_LOAD_BSY |RSB_INTS_TRANS_ERR |RSB_INTS_TRANS_OVER , - rsb->regs +RSB_INTE ); + int_mask =RSB_INTS_LOAD_BSY |RSB_INTS_TRANS_ERR |RSB_INTS_TRANS_OVER ; +writel (int_mask, rsb->regs +RSB_INTE );writel (RSB_CTRL_START_TRANS |RSB_CTRL_GLOBAL_INT_ENB , rsb->regs +RSB_CTRL ); -if (!wait_for_completion_io_timeout (&rsb->complete, -msecs_to_jiffies (100 ))) { +if (irqs_disabled ()) { + timeout =readl_poll_timeout_atomic (rsb->regs +RSB_INTS , + status, (status & int_mask), +10 ,100000 ); +writel (status, rsb->regs +RSB_INTS ); + }else { + timeout = !wait_for_completion_io_timeout (&rsb->complete, +msecs_to_jiffies (100 )); + status = rsb->status; + } + +if (timeout) {dev_dbg (rsb->dev,"RSB timeout\n" );/* abort the transfer */
@@ -293,18 +306,18 @@ static int _sunxi_rsb_run_xfer(struct sunxi_rsb *rsb)return -ETIMEDOUT ; } -if (rsb->status &RSB_INTS_LOAD_BSY ) { +if (status &RSB_INTS_LOAD_BSY ) {dev_dbg (rsb->dev,"RSB busy\n" );return -EBUSY ; } -if (rsb->status &RSB_INTS_TRANS_ERR ) { -if (rsb->status &RSB_INTS_TRANS_ERR_ACK ) { +if (status &RSB_INTS_TRANS_ERR ) { +if (status &RSB_INTS_TRANS_ERR_ACK ) {dev_dbg (rsb->dev,"RSB slave nack\n" );return -EINVAL ; } -if (rsb->status &RSB_INTS_TRANS_ERR_DATA ) { +if (status &RSB_INTS_TRANS_ERR_DATA ) {dev_dbg (rsb->dev,"RSB transfer data error\n" );return -EIO ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 12/105 ARM: dts: at91: sam9g20ek: enable udc vbus gpio pinctrl
In reply to Greg Kroah-HartmanFrom: Michael Grzeschik <[email protected]>
[ Upstream commit 40a2226e8bfacb79dd154dea68febeead9d847e9 ]
We set the PIOC to GPIO mode. This way the pin becomes an input signal will be usable by the controller. Without this change the udc on the 9g20ek does not work.
--- arch/arm/boot/dts/at91sam9g20ek_common.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm/boot/dts/at91sam9g20ek_common.dtsi +9 -0
@@ -39,6 +39,13 @@ pinctrl_pck0_as_mck: pck0_as_mck { }; + usb1 { + pinctrl_usb1_vbus_gpio: usb1_vbus_gpio { + atmel,pins = + <AT91_PIOC 5 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>; /* PC5 GPIO */ + }; + }; + mmc0_slot1 { pinctrl_board_mmc0_slot1: mmc0_slot1-board { atmel,pins =
@@ -84,6 +91,8 @@ macb0: ethernet@fffc4000 { }; usb1: gadget@fffa4000 { + pinctrl-0 = <&pinctrl_usb1_vbus_gpio>; + pinctrl-names = "default"; atmel,vbus-gpio = <&pioC 5 GPIO_ACTIVE_HIGH>; status = "okay"; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 13/105 nfc/nci: fix race with opening and closing
In reply to Greg Kroah-HartmanFrom: Lin Ma <[email protected]>
[ Upstream commit 0ad6bded175e829c2ca261529c9dce39a32a042d ]
Previously we leverage NCI_UNREG and the lock inside nci_close_device to prevent the race condition between opening a device and closing a device. However, it still has problem because a failed opening command will erase the NCI_UNREG flag and allow another opening command to bypass the status checking.
This fix corrects that by making sure the NCI_UNREG is held.
--- net/nfc/nci/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/nfc/nci/core.c +1 -1
@@ -542,7 +542,7 @@ static int nci_open_device(struct nci_dev *ndev)skb_queue_purge (&ndev->tx_q); ndev->ops->close (ndev); - ndev->flags =0 ; + ndev->flags &=BIT (NCI_UNREG ); } done:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 14/105 net: pch_gbe: fix potential memleak in pch_gbe_tx_queue()
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit 2360f9b8c4e81d242d4cbf99d630a2fffa681fab ]
In pch_gbe_xmit_frame(), NETDEV_TX_OK will be returned whether pch_gbe_tx_queue() sends data successfully or not, so pch_gbe_tx_queue() needs to free skb before returning. But pch_gbe_tx_queue() returns without freeing skb in case of dma_map_single() fails. Add dev_kfree_skb_any() to fix it.
--- drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +1 -0
@@ -1177,6 +1177,7 @@ static void pch_gbe_tx_queue(struct pch_gbe_adapter *adapter, buffer_info->dma =0 ; buffer_info->time_stamp =0 ; tx_ring->next_to_use = ring_num; +dev_kfree_skb_any (skb);return ; } buffer_info->mapped = true;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 15/105 9p/fd: fix issue of list_del corruption in p9_fd_cancel()
In reply to Greg Kroah-HartmanFrom: Zhengchao Shao <[email protected]>
[ Upstream commit 11c10956515b8ec44cf4f2a7b9d8bf8b9dc05ec4 ]
Syz reported the following issue:
kernel BUG at lib/list_debug.c:53!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
RIP: 0010:__list_del_entry_valid.cold+0x5c/0x72 Call Trace: <TASK> p9_fd_cancel+0xb1/0x270 p9_client_rpc+0x8ea/0xba0 p9_client_create+0x9c0/0xed0 v9fs_session_init+0x1e0/0x1620 v9fs_mount+0xba/0xb80 legacy_get_tree+0x103/0x200 vfs_get_tree+0x89/0x2d0 path_mount+0x4c0/0x1ac0 __x64_sys_mount+0x33b/0x430 do_syscall_64+0x35/0x80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 </TASK>
The process is as follows:
Thread A: Thread B:p9_poll_workfn() p9_client_create()
... ...
p9_conn_cancel() p9_fd_cancel()
list_del() ...
... list_del() //list_del
corruption
There is no lock protection when deleting list in p9_conn_cancel(). After deleting list in Thread A, thread B will delete the same list again. It will cause issue of list_del corruption.
Setting req->status to REQ_STATUS_ERROR under lock prevents other cleanup paths from trying to manipulate req_list.
The other thread can safely check req->status because it still holds a reference to req at this point.
--- net/9p/trans_fd.c | 2 ++ 1 file changed, 2 insertions(+)
net/9p/trans_fd.c +2 -0
@@ -215,9 +215,11 @@ static void p9_conn_cancel(struct p9_conn *m, int err)list_for_each_entry_safe (req, rtmp, &m->req_list, req_list) {list_move (&req->req_list, &cancel_list); + req->status =REQ_STATUS_ERROR ; }list_for_each_entry_safe (req, rtmp, &m->unsent_req_list, req_list) {list_move (&req->req_list, &cancel_list); + req->status =REQ_STATUS_ERROR ; }spin_unlock (&m->client->lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 16/105 ARM: mxs: fix memory leak in mxs_machine_init()
In reply to Greg Kroah-HartmanFrom: Zheng Yongjun <[email protected]>
[ Upstream commit f31e3c204d1844b8680a442a48868af5ac3d5481 ]
If of_property_read_string() failed, 'soc_dev_attr' should be freed before return. Otherwise there is a memory leak.
--- arch/arm/mach-mxs/mach-mxs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-mxs/mach-mxs.c +3 -1
@@ -393,8 +393,10 @@ static void __init mxs_machine_init(void) root =of_find_node_by_path ("/" ); ret =of_property_read_string (root,"model" , &soc_dev_attr->machine); -if (ret) +if (ret) { +kfree (soc_dev_attr);return ; + } soc_dev_attr->family ="Freescale MXS Family" ; soc_dev_attr->soc_id =mxs_get_soc_id ();
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 17/105 net/mlx4: Check retval of mlx4_bitmap_init
In reply to Greg Kroah-HartmanFrom: Peter Kosyh <[email protected]>
[ Upstream commit 594c61ffc77de0a197934aa0f1df9285c68801c6 ]
If mlx4_bitmap_init fails, mlx4_bitmap_alloc_range will dereference the NULL pointer (bitmap->table).
Make sure, that mlx4_bitmap_alloc_range called in no error case.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/mellanox/mlx4/qp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx4/qp.c +2 -1
@@ -697,7 +697,8 @@ static int mlx4_create_zones(struct mlx4_dev *dev, err =mlx4_bitmap_init (*bitmap + k,1 ,MLX4_QP_TABLE_RAW_ETH_SIZE -1 ,0 ,0 ); -mlx4_bitmap_alloc_range (*bitmap + k,1 ,1 ,0 ); +if (!err) +mlx4_bitmap_alloc_range (*bitmap + k,1 ,1 ,0 ); }if (err)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 18/105 net/qla3xxx: fix potential memleak in ql3xxx_send()
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
[ Upstream commit 62a7311fb96c61d281da9852dbee4712fc8c3277 ]
The ql3xxx_send() returns NETDEV_TX_OK without freeing skb in error handling case, add dev_kfree_skb_any() to fix it.
--- drivers/net/ethernet/qlogic/qla3xxx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/qlogic/qla3xxx.c +1 -0
@@ -2477,6 +2477,7 @@ static netdev_tx_t ql3xxx_send(struct sk_buff *skb, skb_shinfo(skb)->nr_frags);if (tx_cb->seg_count ==-1 ) {netdev_err (ndev,"%s: invalid segment count!\n" , __func__); +dev_kfree_skb_any (skb);return NETDEV_TX_OK ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 19/105 net: pch_gbe: fix pci device refcount leak while module exiting
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 5619537284f1017e9f6c7500b02b859b3830a06d ]
As comment of pci_get_domain_bus_and_slot() says, it returns a pci device with refcount increment, when finish using it, the caller must decrement the reference count by calling pci_dev_put().
In pch_gbe_probe(), pci_get_domain_bus_and_slot() is called, so in error path in probe() and remove() function, pci_dev_put() should be called to avoid refcount leak. Compile tested only.
--- drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +4 -1
@@ -2492,6 +2492,7 @@ static void pch_gbe_remove(struct pci_dev *pdev)unregister_netdev (netdev);pch_gbe_phy_hw_reset (&adapter->hw); +pci_dev_put (adapter->ptp_pdev);free_netdev (netdev); }
@@ -2573,7 +2574,7 @@ static int pch_gbe_probe(struct pci_dev *pdev,/* setup the private structure */ ret =pch_gbe_sw_init (adapter);if (ret) - goto err_free_netdev; + goto err_put_dev;/* Initialize PHY */ ret =pch_gbe_init_phy (adapter);
@@ -2631,6 +2632,8 @@ static int pch_gbe_probe(struct pci_dev *pdev, err_free_adapter:pch_gbe_phy_hw_reset (&adapter->hw); +err_put_dev: +pci_dev_put (adapter->ptp_pdev); err_free_netdev:free_netdev (netdev);return ret;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 20/105 Drivers: hv: vmbus: fix double free in the error path of vmbus_add_channel_work()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit f92a4b50f0bd7fd52391dc4bb9a309085d278f91 ]
In the error path of vmbus_device_register(), device_unregister() is called, which calls vmbus_device_release(). The latter frees the struct hv_device that was passed in to vmbus_device_register(). So remove the kfree() in vmbus_add_channel_work() to avoid a double free.
--- drivers/hv/channel_mgmt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/hv/channel_mgmt.c +5 -1
@@ -508,13 +508,17 @@ static void vmbus_add_channel_work(struct work_struct *work)* Add the new device to the bus. This will kick off device-driver * binding which eventually invokes the device driver's AddDevice() * method. +* +* If vmbus_device_register() fails, the 'device_obj' is freed in +* vmbus_device_release() as called by device_unregister() in the +* error path of vmbus_device_register(). In the outside error +* path, there's no need to free it. */ ret =vmbus_device_register (newchannel->device_obj);if (ret !=0 ) {pr_err ("unable to add child device object (relid %d)\n" , newchannel->offermsg.child_relid); -kfree (newchannel->device_obj); goto err_deq_chan; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 21/105 Drivers: hv: vmbus: fix possible memory leak in vmbus_device_register()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 25c94b051592c010abe92c85b0485f1faedc83f3 ]
If device_register() returns error in vmbus_device_register(), the name allocated by dev_set_name() must be freed. As comment of device_register() says, it should use put_device() to give up the reference in the error path. So fix this by calling put_device(), then the name can be freed in kobject_cleanup().
--- drivers/hv/vmbus_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/hv/vmbus_drv.c +1 -0
@@ -1634,6 +1634,7 @@ int vmbus_device_register(struct hv_device *child_device_obj) ret =device_register (&child_device_obj->device);if (ret) {pr_err ("Unable to register child device\n" ); +put_device (&child_device_obj->device);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 22/105 net/mlx5: Fix FW tracer timestamp calculation
In reply to Greg Kroah-HartmanFrom: Moshe Shemesh <[email protected]>
[ Upstream commit 61db3d7b99a367416e489ccf764cc5f9b00d62a1 ]
Fix a bug in calculation of FW tracer timestamp. Decreasing one in the calculation should effect only bits 52_7 and not effect bits 6_0 of the timestamp, otherwise bits 6_0 are always set in this calculation.
--- drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c +1 -1
@@ -600,7 +600,7 @@ static void mlx5_tracer_handle_timestamp_trace(struct mlx5_fw_tracer *tracer, trace_timestamp = (timestamp_event.timestamp &MASK_52_7 ) | (str_frmt->timestamp &MASK_6_0 ); else - trace_timestamp = ((timestamp_event.timestamp &MASK_52_7 ) -1 ) | + trace_timestamp = ((timestamp_event.timestamp -1 ) &MASK_52_7 ) | (str_frmt->timestamp &MASK_6_0 );mlx5_tracer_print_trace (str_frmt, dev, trace_timestamp);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 23/105 tipc: set con sock in tipc_conn_alloc
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 0e5d56c64afcd6fd2d132ea972605b66f8a7d3c4 ]
A crash was reported by Wei Chen:
BUG: kernel NULL pointer dereference, address: 0000000000000018 RIP: 0010:tipc_conn_close+0x12/0x100 Call Trace: tipc_topsrv_exit_net+0x139/0x320 ops_exit_list.isra.9+0x49/0x80 cleanup_net+0x31a/0x540 process_one_work+0x3fa/0x9f0 worker_thread+0x42/0x5c0
It was caused by !con->sock in tipc_conn_close(). In tipc_topsrv_accept(), con is allocated in conn_idr then its sock is set:
con = tipc_conn_alloc(); ... <----[1] con->sock = newsock;
If tipc_conn_close() is called in anytime of [1], the null-pointer-def is triggered by con->sock->sk due to con->sock is not yet set.
This patch fixes it by moving the con->sock setting to tipc_conn_alloc() under s->idr_lock. So that con->sock can never be NULL when getting the con from s->conn_idr. It will be also safer to move con->server and flag CF_CONNECTED setting under s->idr_lock, as they should all be set before tipc_conn_alloc() is called.
--- net/tipc/topsrv.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
net/tipc/topsrv.c +5 -6
@@ -184,7 +184,7 @@ static void tipc_conn_close(struct tipc_conn *con)conn_put (con); } -static struct tipc_conn *tipc_conn_alloc (struct tipc_topsrv *s) +static struct tipc_conn *tipc_conn_alloc (struct tipc_topsrv *s,struct socket *sock) {struct tipc_conn *con;int ret;
@@ -210,10 +210,11 @@ static struct tipc_conn *tipc_conn_alloc(struct tipc_topsrv *s) } con->conid = ret; s->idr_in_use++; -spin_unlock_bh (&s->idr_lock);set_bit (CF_CONNECTED , &con->flags); con->server = s; + con->sock = sock; +spin_unlock_bh (&s->idr_lock);return con; }
@@ -474,7 +475,7 @@ static void tipc_topsrv_accept(struct work_struct *work) ret =kernel_accept (lsock, &newsock,O_NONBLOCK );if (ret <0 )return ; - con =tipc_conn_alloc (srv); + con =tipc_conn_alloc (srv, newsock);if (IS_ERR (con)) { ret =PTR_ERR (con);sock_release (newsock);
@@ -486,7 +487,6 @@ static void tipc_topsrv_accept(struct work_struct *work) newsk->sk_data_ready = tipc_conn_data_ready; newsk->sk_write_space = tipc_conn_write_space; newsk->sk_user_data = con; - con->sock = newsock;write_unlock_bh (&newsk->sk_callback_lock);/* Wake up receive process in case of 'SYN+' message */
@@ -584,12 +584,11 @@ bool tipc_topsrv_kern_subscr(struct net *net, u32 port, u32 type, u32 lower, sub.filter = filter; *(u64 *)&sub.usr_handle = (u64 )port; - con =tipc_conn_alloc (tipc_topsrv (net)); + con =tipc_conn_alloc (tipc_topsrv (net),NULL );if (IS_ERR (con))return false; *conid = con->conid; - con->sock =NULL ; rc =tipc_conn_rcv_sub (tipc_topsrv (net), con, &sub);if (rc >=0 )return true;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 24/105 tipc: add an extra conn_get in tipc_conn_alloc
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit a7b42969d63f47320853a802efd879fbdc4e010e ]
One extra conn_get() is needed in tipc_conn_alloc(), as after tipc_conn_alloc() is called, tipc_conn_close() may free this con before deferencing it in tipc_topsrv_accept():
tipc_conn_alloc();
newsk = newsock->sk;
<---- tipc_conn_close();
write_lock_bh(&sk->sk_callback_lock);
newsk->sk_data_ready = tipc_conn_data_ready;Then an uaf issue can be triggered:
BUG: KASAN: use-after-free in tipc_topsrv_accept+0x1e7/0x370 [tipc] Call Trace: <TASK> dump_stack_lvl+0x33/0x46 print_report+0x178/0x4b0 kasan_report+0x8c/0x100 kasan_check_range+0x179/0x1e0 tipc_topsrv_accept+0x1e7/0x370 [tipc] process_one_work+0x6a3/0x1030 worker_thread+0x8a/0xdf0
This patch fixes it by holding it in tipc_conn_alloc(), then after all accessing in tipc_topsrv_accept() releasing it. Note when does this in tipc_topsrv_kern_subscr(), as tipc_conn_rcv_sub() returns 0 or -1 only, we don't need to check for "> 0".
--- net/tipc/topsrv.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/tipc/topsrv.c +6 -3
@@ -214,6 +214,7 @@ static struct tipc_conn *tipc_conn_alloc(struct tipc_topsrv *s, struct socket *sset_bit (CF_CONNECTED , &con->flags); con->server = s; con->sock = sock; +conn_get (con);spin_unlock_bh (&s->idr_lock);return con;
@@ -491,6 +492,7 @@ static void tipc_topsrv_accept(struct work_struct *work)/* Wake up receive process in case of 'SYN+' message */ newsk->sk_data_ready (newsk); +conn_put (con); } }
@@ -590,10 +592,11 @@ bool tipc_topsrv_kern_subscr(struct net *net, u32 port, u32 type, u32 lower, *conid = con->conid; rc =tipc_conn_rcv_sub (tipc_topsrv (net), con, &sub); -if (rc >=0 ) -return true; +if (rc) +conn_put (con); +conn_put (con); -return false; +return !rc; }void tipc_topsrv_kern_unsubscr (struct net *net,int conid)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 25/105 tipc: check skb_linearize() return value in tipc_disc_rcv()
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit cd0f6421162201e4b22ce757a1966729323185eb ]
If skb_linearize() fails in tipc_disc_rcv(), we need to free the skb instead of handle it.
--- net/tipc/discover.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/tipc/discover.c +4 -1
@@ -208,7 +208,10 @@ void tipc_disc_rcv(struct net *net, struct sk_buff *skb,u32 self;int err; -skb_linearize (skb); +if (skb_linearize (skb)) { +kfree_skb (skb); +return ; + } hdr =buf_msg (skb);if (caps &TIPC_NODE_ID128 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 26/105 xfrm: Fix ignored return value in xfrm6_init()
In reply to Greg Kroah-HartmanFrom: Chen Zhongjin <[email protected]>
[ Upstream commit 40781bfb836eda57d19c0baa37c7e72590e05fdc ]
When IPv6 module initializing in xfrm6_init(), register_pernet_subsys() is possible to fail but its return value is ignored.
If IPv6 initialization fails later and xfrm6_fini() is called, removing uninitialized list in xfrm6_net_ops will cause null-ptr-deref:
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] CPU: 1 PID: 330 Comm: insmod RIP: 0010:unregister_pernet_operations+0xc9/0x450 Call Trace: <TASK> unregister_pernet_subsys+0x31/0x3e xfrm6_fini+0x16/0x30 [ipv6] ip6_route_init+0xcd/0x128 [ipv6] inet6_init+0x29c/0x602 [ipv6] ...
Fix it by catching the error return value of register_pernet_subsys().
--- net/ipv6/xfrm6_policy.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/ipv6/xfrm6_policy.c +5 -1
@@ -416,9 +416,13 @@ int __init xfrm6_init(void)if (ret) goto out_state; -register_pernet_subsys (&xfrm6_net_ops); + ret =register_pernet_subsys (&xfrm6_net_ops); +if (ret) + goto out_protocol; out:return ret; +out_protocol: +xfrm6_protocol_fini (); out_state:xfrm6_state_fini (); out_policy:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 27/105 NFC: nci: fix memory leak in nci_rx_data_packet()
In reply to Greg Kroah-HartmanFrom: Liu Shixin <[email protected]>
[ Upstream commit 53270fb0fd77fe786d8c07a0793981d797836b93 ]
Syzbot reported a memory leak about skb:
unreferenced object 0xffff88810e144e00 (size 240):
comm "syz-executor284", pid 3701, jiffies 4294952403 (age 12.620s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff83ab79a9>] __alloc_skb+0x1f9/0x270 net/core/skbuff.c:497
[<ffffffff82a5cf64>] alloc_skb include/linux/skbuff.h:1267 [inline]
[<ffffffff82a5cf64>] virtual_ncidev_write+0x24/0xe0 drivers/nfc/virtual_ncidev.c:116
[<ffffffff815f6503>] do_loop_readv_writev fs/read_write.c:759 [inline]
[<ffffffff815f6503>] do_loop_readv_writev fs/read_write.c:743 [inline]
[<ffffffff815f6503>] do_iter_write+0x253/0x300 fs/read_write.c:863
[<ffffffff815f66ed>] vfs_writev+0xdd/0x240 fs/read_write.c:934
[<ffffffff815f68f6>] do_writev+0xa6/0x1c0 fs/read_write.c:977
[<ffffffff848802d5>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff848802d5>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84a00087>] entry_SYSCALL_64_after_hwframe+0x63/0xcdIn nci_rx_data_packet(), if we don't get a valid conn_info, we will return directly but forget to release the skb.
--- net/nfc/nci/data.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/nfc/nci/data.c +3 -1
@@ -291,8 +291,10 @@ void nci_rx_data_packet(struct nci_dev *ndev, struct sk_buff *skb) nci_plen(skb->data)); conn_info =nci_get_conn_info_by_conn_id (ndev,nci_conn_id (skb->data)); -if (!conn_info) +if (!conn_info) { +kfree_skb (skb);return ; + }/* strip the nci data header */ skb_pull (skb,NCI_DATA_HDR_SIZE );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 28/105 bnx2x: fix pci device refcount leak in bnx2x_vf_is_pcie_pending()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 3637a29ccbb6461b7268c5c5db525935d510afc6 ]
As comment of pci_get_domain_bus_and_slot() says, it returns a pci device with refcount increment, when finish using it, the caller must decrement the reference count by calling pci_dev_put(). Call pci_dev_put() before returning from bnx2x_vf_is_pcie_pending() to avoid refcount leak.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +8 -4
@@ -806,16 +806,20 @@ static void bnx2x_vf_enable_traffic(struct bnx2x *bp, struct bnx2x_virtf *vf)static u8 bnx2x_vf_is_pcie_pending (struct bnx2x *bp,u8 abs_vfid) { -struct pci_dev *dev;struct bnx2x_virtf *vf =bnx2x_vf_by_abs_fid (bp, abs_vfid); +struct pci_dev *dev; +bool pending;if (!vf)return false; dev =pci_get_domain_bus_and_slot (vf->domain, vf->bus, vf->devfn); -if (dev) -return bnx2x_is_pcie_pending (dev); -return false; +if (!dev) +return false; + pending =bnx2x_is_pcie_pending (dev); +pci_dev_put (dev); + +return pending; }int bnx2x_vf_flr_clnup_epilog (struct bnx2x *bp,u8 abs_vfid)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 29/105 dccp/tcp: Reset saddr on failure after inet6?_hash_connect().
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 77934dc6db0d2b111a8f2759e9ad2fb67f5cffa5 ]
When connect() is called on a socket bound to the wildcard address, we change the socket's saddr to a local address. If the socket fails to connect() to the destination, we have to reset the saddr.
However, when an error occurs after inet_hash6?_connect() in (dccp|tcp)_v[46]_conect(), we forget to reset saddr and leave the socket bound to the address.
Quoted 1 line
From the user's point of view, whether saddr is reset or not varies
with errno. Let's fix this inconsistent behaviour.
Note that after this patch, the repro [0] will trigger the WARN_ON() in inet_csk_get_port() again, but this patch is not buggy and rather fixes a bug papering over the bhash2's bug for which we need another fix.
For the record, the repro causes -EADDRNOTAVAIL in inet_hash6_connect() by this sequence:
s1 = socket()
s1.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) s1.bind(('127.0.0.1', 10000)) s1.sendto(b'hello', MSG_FASTOPEN, (('127.0.0.1', 10000)))
# or s1.connect(('127.0.0.1', 10000)) s2 = socket()
s2.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) s2.bind(('0.0.0.0', 10000)) s2.connect(('127.0.0.1', 10000)) # -EADDRNOTAVAIL
s2.listen(32) # WARN_ON(inet_csk(sk)->icsk_bind2_hash != tb2);
[0]: https://syzkaller.appspot.com/bug?extid=015d756bbd1f8b5c8f09
--- net/dccp/ipv4.c | 2 ++ net/dccp/ipv6.c | 2 ++ net/ipv4/tcp_ipv4.c | 2 ++ net/ipv6/tcp_ipv6.c | 2 ++ 4 files changed, 8 insertions(+)
net/dccp/ipv4.c +2 -0
@@ -134,6 +134,8 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)* This unhashes the socket and releases the local port, if necessary. */ dccp_set_state (sk,DCCP_CLOSED ); +if (!(sk->sk_userlocks &SOCK_BINDADDR_LOCK )) +inet_reset_saddr (sk);ip_rt_put (rt); sk->sk_route_caps =0 ; inet->inet_dport =0 ;
net/dccp/ipv6.c +2 -0
@@ -957,6 +957,8 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, late_failure:dccp_set_state (sk,DCCP_CLOSED ); +if (!(sk->sk_userlocks &SOCK_BINDADDR_LOCK )) +inet_reset_saddr (sk);__sk_dst_reset (sk); failure: inet->inet_dport =0 ;
net/ipv4/tcp_ipv4.c +2 -0
@@ -328,6 +328,8 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)* if necessary. */ tcp_set_state (sk,TCP_CLOSE ); +if (!(sk->sk_userlocks &SOCK_BINDADDR_LOCK )) +inet_reset_saddr (sk);ip_rt_put (rt); sk->sk_route_caps =0 ; inet->inet_dport =0 ;
net/ipv6/tcp_ipv6.c +2 -0
@@ -327,6 +327,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, late_failure:tcp_set_state (sk,TCP_CLOSE ); +if (!(sk->sk_userlocks &SOCK_BINDADDR_LOCK )) +inet_reset_saddr (sk); failure: inet->inet_dport =0 ; sk->sk_route_caps =0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 30/105 s390/dasd: fix no record found for raw_track_access
In reply to Greg Kroah-HartmanFrom: Stefan Haberland <[email protected]>
[ Upstream commit 590ce6d96d6a224b470a3862c33a483d5022bfdb ]
For DASD devices in raw_track_access mode only full track images are read and written.
For this purpose it is not necessary to do search operation in the locate record extended function. The documentation even states that this might fail if the searched record is not found on a track.
Currently the driver sets a value of 1 in the search field for the first record after record zero. This is the default for disks not in raw_track_access mode but record 1 might be missing on a completely empty track.
There has not been any problem with this on IBM storage servers but it might lead to errors with DASD devices on other vendors storage servers.
Fix this by setting the search field to 0. Record zero is always available even on a completely empty track.
--- drivers/s390/block/dasd_eckd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/s390/block/dasd_eckd.c +2 -4
@@ -3788,7 +3788,6 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_raw(struct dasd_device *startdev,struct dasd_device *basedev;struct req_iterator iter;struct dasd_ccw_req *cqr; -unsigned int first_offs;unsigned int trkcount;unsigned long *idaws;unsigned int size;
@@ -3822,7 +3821,6 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_raw(struct dasd_device *startdev, last_trk = (blk_rq_pos (req) +blk_rq_sectors (req) -1 ) /DASD_RAW_SECTORS_PER_TRACK ; trkcount = last_trk - first_trk +1 ; - first_offs =0 ;if (rq_data_dir (req) ==READ ) cmd =DASD_ECKD_CCW_READ_TRACK ;
@@ -3866,13 +3864,13 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_raw(struct dasd_device *startdev,if (use_prefix) {prefix_LRE (ccw++, data, first_trk, last_trk, cmd, basedev, - startdev,1 , first_offs +1 , trkcount,0 ,0 ); + startdev,1 ,0 , trkcount,0 ,0 ); }else {define_extent (ccw++, data, first_trk, last_trk, cmd, basedev,0 ); ccw[-1 ].flags |=CCW_FLAG_CC ; data +=sizeof (struct DE_eckd_data ); -locate_record_ext (ccw++, data, first_trk, first_offs +1 , +locate_record_ext (ccw++, data, first_trk,0 , trkcount, cmd, basedev,0 ,0 ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 31/105 nfc: st-nci: fix incorrect validating logic in EVT_TRANSACTION
In reply to Greg Kroah-HartmanFrom: Martin Faltesek <[email protected]>
[ Upstream commit c60c152230828825c06e62a8f1ce956d4b659266 ]
The first validation check for EVT_TRANSACTION has two different checks tied together with logical AND. One is a check for minimum packet length, and the other is for a valid aid_tag. If either condition is true (fails), then an error should be triggered. The fix is to change && to ||.
--- drivers/nfc/st-nci/se.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nfc/st-nci/se.c +1 -1
@@ -338,7 +338,7 @@ static int st_nci_hci_connectivity_event_received(struct nci_dev *ndev,* AID 81 5 to 16 * PARAMETERS 82 0 to 255 */ -if (skb->len <NFC_MIN_AID_LENGTH +2 && +if (skb->len <NFC_MIN_AID_LENGTH +2 || skb->data[0 ] !=NFC_EVT_TRANSACTION_AID_TAG )return -EPROTO ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 32/105 nfc: st-nci: fix memory leaks in EVT_TRANSACTION
In reply to Greg Kroah-HartmanFrom: Martin Faltesek <[email protected]>
[ Upstream commit 440f2ae9c9f06e26f5dcea697a53717fc61a318c ]
Error path does not free previously allocated memory. Add devm_kfree() to the failure path.
--- drivers/nfc/st-nci/se.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nfc/st-nci/se.c +3 -1
@@ -352,8 +352,10 @@ static int st_nci_hci_connectivity_event_received(struct nci_dev *ndev,/* Check next byte is PARAMETERS tag (82) */ if (skb->data[transaction->aid_len +2 ] != -NFC_EVT_TRANSACTION_PARAMS_TAG ) +NFC_EVT_TRANSACTION_PARAMS_TAG ) { +devm_kfree (dev, transaction);return -EPROTO ; + } transaction->params_len = skb->data[transaction->aid_len +3 ]; memcpy(transaction->params, skb->data +
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 33/105 net: thunderx: Fix the ACPI memory leak
In reply to Greg Kroah-HartmanFrom: Yu Liao <[email protected]>
[ Upstream commit 661e5ebbafd26d9d2e3c749f5cf591e55c7364f5 ]
The ACPI buffer memory (string.pointer) should be freed as the buffer is not used after returning from bgx_acpi_match_id(), free it to prevent memory leak.
--- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/cavium/thunder/thunder_bgx.c +3 -1
@@ -1447,8 +1447,10 @@ static acpi_status bgx_acpi_match_id(acpi_handle handle, u32 lvl,return AE_OK ; } -if (strncmp (string.pointer, bgx_sel,4 )) +if (strncmp (string.pointer, bgx_sel,4 )) { +kfree (string.pointer);return AE_OK ; + }acpi_walk_namespace (ACPI_TYPE_DEVICE , handle,1 , bgx_acpi_register_phy,NULL , bgx,NULL );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 34/105 s390/crashdump: fix TOD programmable field size
In reply to Greg Kroah-HartmanFrom: Heiko Carstens <[email protected]>
[ Upstream commit f44e07a8afdd713ddc1a8832c39372fe5dd86895 ]
The size of the TOD programmable field was incorrectly increased from four to eight bytes with commit 1a2c5840acf9 ("s390/dump: cleanup CPU save area handling").
This leads to an elf notes section NT_S390_TODPREG which has a size of eight instead of four bytes in case of kdump, however even worse is that the contents is incorrect: it is supposed to contain only the contents of the TOD programmable field, but in fact contains a mix of the TOD programmable field (32 bit upper bits) and parts of the CPU timer register (lower 32 bits).
Fix this by simply changing the size of the todpreg field within the save area structure. This will implicitly also fix the size of the corresponding elf notes sections.
This also gets rid of this compile time warning:
in function ‘fortify_memcpy_chk’,
inlined from ‘save_area_add_regs’ at arch/s390/kernel/crash_dump.c:99:2:./include/linux/fortify-string.h:413:25: error: call to ‘__read_overflow2_field’
declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror=attribute-warning]
413 | __read_overflow2_field(q_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- arch/s390/kernel/crash_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kernel/crash_dump.c +1 -1
@@ -45,7 +45,7 @@ struct save_area {u64 fprs[16 ];u32 fpc;u32 prefix; -u64 todpreg; +u32 todpreg;u64 timer;u64 todcmp;u64 vxrs_low[16 ];
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 35/105 arm64: dts: rockchip: lower rk3399-puma-haikou SD controller clock frequency
In reply to Greg Kroah-HartmanFrom: Jakob Unterwurzacher <[email protected]>
commit 91e8b74fe6381e083f8aa55217bb0562785ab398 upstream.
CRC errors (code -84 EILSEQ) have been observed for some SanDisk Ultra A1 cards when running at 50MHz.
Waveform analysis suggest that the level shifters that are used on the RK3399-Q7 module for voltage translation between 3.0 and 3.3V don't handle clock rates at or above 48MHz properly. Back off to 40MHz for some safety margin.
--- arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts +1 -1
@@ -203,7 +203,7 @@ cap-sd-highspeed; cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; disable-wp; - max-frequency = <150000000>; + max-frequency = <40000000>; pinctrl-names = "default"; pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; vmmc-supply = <&vcc3v3_baseboard>;
Greg Kroah-Hartman
maintainerPATCH 36/105 iio: light: apds9960: fix wrong register for gesture gain
In reply to Greg Kroah-HartmanFrom: Alejandro Concepción Rodríguez <[email protected]>
commit 0aa60ff5d996d4ecdd4a62699c01f6d00f798d59 upstream.
Gesture Gain Control is in REG_GCONF_2 (0xa3), not in REG_CONFIG_2 (0x90).
--- drivers/iio/light/apds9960.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/iio/light/apds9960.c +6 -6
@@ -55,9 +55,6 @@#define APDS9960_REG_CONTROL_PGAIN_MASK_SHIFT 2#define APDS9960_REG_CONFIG_2 0x90 -#define APDS9960_REG_CONFIG_2_GGAIN_MASK 0x60 -#define APDS9960_REG_CONFIG_2_GGAIN_MASK_SHIFT 5 -#define APDS9960_REG_ID 0x92#define APDS9960_REG_STATUS 0x93
@@ -78,6 +75,9 @@#define APDS9960_REG_GCONF_1_GFIFO_THRES_MASK_SHIFT 6#define APDS9960_REG_GCONF_2 0xa3 +#define APDS9960_REG_GCONF_2_GGAIN_MASK 0x60 +#define APDS9960_REG_GCONF_2_GGAIN_MASK_SHIFT 5 +#define APDS9960_REG_GOFFSET_U 0xa4#define APDS9960_REG_GOFFSET_D 0xa5#define APDS9960_REG_GPULSE 0xa6
@@ -396,9 +396,9 @@ static int apds9960_set_pxs_gain(struct } ret =regmap_update_bits (data->regmap, -APDS9960_REG_CONFIG_2 , -APDS9960_REG_CONFIG_2_GGAIN_MASK , - idx <<APDS9960_REG_CONFIG_2_GGAIN_MASK_SHIFT ); +APDS9960_REG_GCONF_2 , +APDS9960_REG_GCONF_2_GGAIN_MASK , + idx <<APDS9960_REG_GCONF_2_GGAIN_MASK_SHIFT );if (!ret) data->pxs_gain = idx;mutex_unlock (&data->lock);
Greg Kroah-Hartman
maintainerPATCH 37/105 iio: core: Fix entry not deleted when iio_register_sw_trigger_type() fails
In reply to Greg Kroah-HartmanFrom: Chen Zhongjin <[email protected]>
commit 4ad09d956f8eacff61e67e5b13ba8ebec3232f76 upstream.
In iio_register_sw_trigger_type(), configfs_register_default_group() is possible to fail, but the entry add to iio_trigger_types_list is not deleted.
This leaves wild in iio_trigger_types_list, which can cause page fault when module is loading again. So fix this by list_del(&t->list) in error path.
BUG: unable to handle page fault for address: fffffbfff81d7400 Call Trace: <TASK> iio_register_sw_trigger_type do_one_initcall do_init_module load_module ...
--- drivers/iio/industrialio-sw-trigger.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iio/industrialio-sw-trigger.c +5 -1
@@ -61,8 +61,12 @@ int iio_register_sw_trigger_type(struct t->group =configfs_register_default_group (iio_triggers_group, t->name, &iio_trigger_type_group_type); -if (IS_ERR (t->group)) +if (IS_ERR (t->group)) { +mutex_lock (&iio_trigger_types_lock); +list_del (&t->list); +mutex_unlock (&iio_trigger_types_lock); ret =PTR_ERR (t->group); + }return ret; }
Greg Kroah-Hartman
maintainerPATCH 38/105 nios2: add FORCE for vmlinuz.gz
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 869e4ae4cd2a23d625aaa14ae62dbebf768cb77d ]
Add FORCE to placate a warning from make:
arch/nios2/boot/Makefile:24: FORCE prerequisite is missing
--- arch/nios2/boot/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/nios2/boot/Makefile +1 -1
@@ -20,7 +20,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE $(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE $(call if_changed,gzip) -$(obj)/vmImage: $(obj)/vmlinux.gz +$(obj)/vmImage: $(obj)/vmlinux.gz FORCE $(call if_changed,uimage) @$(kecho) 'Kernel: $@ is ready'
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 39/105 iio: ms5611: Simplify IO callback parameters
In reply to Greg Kroah-HartmanFrom: Lars-Peter Clausen <[email protected]>
[ Upstream commit dc19fa63ad80a636fdbc1a02153d1ab140cb901f ]
The ms5611 passes &indio_dev->dev as a parameter to all its IO callbacks only to directly cast the struct device back to struct iio_dev. And the struct iio_dev is then only used to get the drivers state struct.
Simplify this a bit by passing the state struct directly. This makes it a bit easier to follow what the code is doing.
Stable-dep-of: 17f442e7e475 ("iio: pressure: ms5611: fixed value compensation bug")
--- drivers/iio/pressure/ms5611.h | 6 +++--- drivers/iio/pressure/ms5611_core.c | 7 +++---- drivers/iio/pressure/ms5611_i2c.c | 11 ++++------- drivers/iio/pressure/ms5611_spi.c | 17 +++++++---------- 4 files changed, 17 insertions(+), 24 deletions(-)
drivers/iio/pressure/ms5611.h +3 -3
@@ -53,9 +53,9 @@ struct ms5611_state {const struct ms5611_osr *pressure_osr;const struct ms5611_osr *temp_osr; -int (*reset)(struct device *dev); -int (*read_prom_word)(struct device *dev,int index,u16 *word); -int (*read_adc_temp_and_pressure)(struct device *dev, +int (*reset)(struct ms5611_state *st); +int (*read_prom_word)(struct ms5611_state *st,int index,u16 *word); +int (*read_adc_temp_and_pressure)(struct ms5611_state *st,s32 *temp,s32 *pressure);struct ms5611_chip_info *chip_info;
drivers/iio/pressure/ms5611_core.c +3 -4
@@ -88,8 +88,7 @@ static int ms5611_read_prom(struct iio_dev *indio_dev)struct ms5611_state *st =iio_priv (indio_dev);for (i =0 ; i <MS5611_PROM_WORDS_NB ; i++) { - ret = st->read_prom_word (&indio_dev->dev, - i, &st->chip_info->prom[i]); + ret = st->read_prom_word (st, i, &st->chip_info->prom[i]);if (ret <0 ) {dev_err (&indio_dev->dev,"failed to read prom at %d\n" , i);
@@ -111,7 +110,7 @@ static int ms5611_read_temp_and_pressure(struct iio_dev *indio_dev,int ret;struct ms5611_state *st =iio_priv (indio_dev); - ret = st->read_adc_temp_and_pressure (&indio_dev->dev, temp, pressure); + ret = st->read_adc_temp_and_pressure (st, temp, pressure);if (ret <0 ) {dev_err (&indio_dev->dev,"failed to read temperature and pressure\n" );
@@ -199,7 +198,7 @@ static int ms5611_reset(struct iio_dev *indio_dev)int ret;struct ms5611_state *st =iio_priv (indio_dev); - ret = st->reset (&indio_dev->dev); + ret = st->reset (st);if (ret <0 ) {dev_err (&indio_dev->dev,"failed to reset device\n" );return ret;
drivers/iio/pressure/ms5611_i2c.c +4 -7
@@ -21,17 +21,15 @@#include "ms5611.h" -static int ms5611_i2c_reset (struct device *dev) +static int ms5611_i2c_reset (struct ms5611_state *st) { -struct ms5611_state *st =iio_priv (dev_to_iio_dev (dev)); -return i2c_smbus_write_byte (st->client,MS5611_RESET ); } -static int ms5611_i2c_read_prom_word (struct device *dev,int index,u16 *word) +static int ms5611_i2c_read_prom_word (struct ms5611_state *st,int index, +u16 *word) {int ret; -struct ms5611_state *st =iio_priv (dev_to_iio_dev (dev)); ret =i2c_smbus_read_word_swapped (st->client,MS5611_READ_PROM_WORD + (index <<1 ));
@@ -58,11 +56,10 @@ static int ms5611_i2c_read_adc(struct ms5611_state *st, s32 *val)return 0 ; } -static int ms5611_i2c_read_adc_temp_and_pressure (struct device *dev, +static int ms5611_i2c_read_adc_temp_and_pressure (struct ms5611_state *st,s32 *temp,s32 *pressure) {int ret; -struct ms5611_state *st =iio_priv (dev_to_iio_dev (dev));const struct ms5611_osr *osr = st->temp_osr; ret =i2c_smbus_write_byte (st->client, osr->cmd);
drivers/iio/pressure/ms5611_spi.c +7 -10
@@ -16,18 +16,17 @@#include "ms5611.h" -static int ms5611_spi_reset (struct device *dev) +static int ms5611_spi_reset (struct ms5611_state *st) {u8 cmd =MS5611_RESET ; -struct ms5611_state *st =iio_priv (dev_to_iio_dev (dev));return spi_write_then_read (st->client, &cmd,1 ,NULL ,0 ); } -static int ms5611_spi_read_prom_word (struct device *dev,int index,u16 *word) +static int ms5611_spi_read_prom_word (struct ms5611_state *st,int index, +u16 *word) {int ret; -struct ms5611_state *st =iio_priv (dev_to_iio_dev (dev)); ret =spi_w8r16be (st->client,MS5611_READ_PROM_WORD + (index <<1 ));if (ret <0 )
@@ -38,11 +37,10 @@ static int ms5611_spi_read_prom_word(struct device *dev, int index, u16 *word)return 0 ; } -static int ms5611_spi_read_adc (struct device *dev,s32 *val) +static int ms5611_spi_read_adc (struct ms5611_state *st,s32 *val) {int ret;u8 buf[3 ] = {MS5611_READ_ADC }; -struct ms5611_state *st =iio_priv (dev_to_iio_dev (dev)); ret =spi_write_then_read (st->client, buf,1 , buf,3 );if (ret <0 )
@@ -53,11 +51,10 @@ static int ms5611_spi_read_adc(struct device *dev, s32 *val)return 0 ; } -static int ms5611_spi_read_adc_temp_and_pressure (struct device *dev, +static int ms5611_spi_read_adc_temp_and_pressure (struct ms5611_state *st,s32 *temp,s32 *pressure) {int ret; -struct ms5611_state *st =iio_priv (dev_to_iio_dev (dev));const struct ms5611_osr *osr = st->temp_osr;/*
@@ -69,7 +66,7 @@ static int ms5611_spi_read_adc_temp_and_pressure(struct device *dev,return ret;usleep_range (osr->conv_usec, osr->conv_usec + (osr->conv_usec /10UL )); - ret =ms5611_spi_read_adc (dev, temp); + ret =ms5611_spi_read_adc (st, temp);if (ret <0 )return ret;
@@ -79,7 +76,7 @@ static int ms5611_spi_read_adc_temp_and_pressure(struct device *dev,return ret;usleep_range (osr->conv_usec, osr->conv_usec + (osr->conv_usec /10UL )); -return ms5611_spi_read_adc (dev, pressure); +return ms5611_spi_read_adc (st, pressure); }static int ms5611_spi_probe (struct spi_device *spi)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 40/105 iio: pressure: ms5611: fixed value compensation bug
In reply to Greg Kroah-HartmanFrom: Mitja Spes <[email protected]>
[ Upstream commit 17f442e7e47579d3881fc4d47354eaef09302e6f ]
When using multiple instances of this driver the compensation PROM was overwritten by the last initialized sensor. Now each sensor has own PROM storage.
--- drivers/iio/pressure/ms5611.h | 12 +++---- drivers/iio/pressure/ms5611_core.c | 51 ++++++++++++++++-------------- 2 files changed, 31 insertions(+), 32 deletions(-)
drivers/iio/pressure/ms5611.h +4 -8
@@ -28,13 +28,6 @@ enum { MS5607, }; -struct ms5611_chip_info { -u16 prom[MS5611_PROM_WORDS_NB ]; - -int (*temp_and_pressure_compensate)(struct ms5611_chip_info *chip_info, -s32 *temp,s32 *pressure); -}; -/* * OverSampling Rate descriptor. * Warning: cmd MUST be kept aligned on a word boundary (see
@@ -53,12 +46,15 @@ struct ms5611_state {const struct ms5611_osr *pressure_osr;const struct ms5611_osr *temp_osr; +u16 prom[MS5611_PROM_WORDS_NB ]; +int (*reset)(struct ms5611_state *st);int (*read_prom_word)(struct ms5611_state *st,int index,u16 *word);int (*read_adc_temp_and_pressure)(struct ms5611_state *st,s32 *temp,s32 *pressure); -struct ms5611_chip_info *chip_info; +int (*compensate_temp_and_pressure)(struct ms5611_state *st,s32 *temp, +s32 *pressure);struct regulator *vdd; };
drivers/iio/pressure/ms5611_core.c +27 -24
101 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 41/105 ceph: do not update snapshot context when there is no new snapshot
In reply to Greg Kroah-HartmanFrom: Xiubo Li <[email protected]>
[ Upstream commit 2e586641c950e7f3e7e008404bd783a466b9b590 ]
We will only track the uppest parent snapshot realm from which we need to rebuild the snapshot contexts _downward_ in hierarchy. For all the others having no new snapshot we will do nothing.
This fix will avoid calling ceph_queue_cap_snap() on some inodes inappropriately. For example, with the code in mainline, suppose there are 2 directory hierarchies (with 6 directories total), like this:
/dir_X1/dir_X2/dir_X3/
/dir_Y1/dir_Y2/dir_Y3/
Firstly, make a snapshot under /dir_X1/dir_X2/.snap/snap_X2, then make a root snapshot under /.snap/root_snap. Every time we make snapshots under /dir_Y1/..., the kclient will always try to rebuild the snap context for snap_X2 realm and finally will always try to queue cap snaps for dir_Y2 and dir_Y3, which makes no sense.
That's because the snap_X2's seq is 2 and root_snap's seq is 3. So when creating a new snapshot under /dir_Y1/... the new seq will be 4, and the mds will send the kclient a snapshot backtrace in _downward_
order: seqs 4, 3.
When ceph_update_snap_trace() is called, it will always rebuild the from the last realm, that's the root_snap. So later when rebuilding the snap context, the current logic will always cause it to rebuild the snap_X2 realm and then try to queue cap snaps for all the inodes related in that realm, even though it's not necessary.
This is accompanied by a lot of these sorts of dout messages:
"ceph: queue_cap_snap 00000000a42b796b nothing dirty|writing"
Fix the logic to avoid this situation.
Also, the 'invalidate' word is not precise here. In actuality, it will cause a rebuild of the existing snapshot contexts or just build non-existent ones. Rename it to 'rebuild_snapcs'.
URL: https://tracker.ceph.com/issues/44100
Stable-dep-of: 51884d153f7e ("ceph: avoid putting the realm twice when decoding snaps fails")
--- fs/ceph/snap.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
fs/ceph/snap.c +19 -9
@@ -673,12 +673,14 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,__le64 *prior_parent_snaps;/* encoded */ struct ceph_snap_realm *realm =NULL ;struct ceph_snap_realm *first_realm =NULL ; -int invalidate =0 ; +struct ceph_snap_realm *realm_to_rebuild =NULL ; +int rebuild_snapcs;int err = -ENOMEM ;LIST_HEAD (dirty_realms);dout ("update_snap_trace deletion=%d\n" , deletion); more: + rebuild_snapcs =0 ;ceph_decode_need (&p, e,sizeof (*ri), bad); ri = p; p +=sizeof (*ri);
@@ -702,7 +704,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc, err =adjust_snap_realm_parent (mdsc, realm,le64_to_cpu (ri->parent));if (err <0 ) goto fail; - invalidate += err; + rebuild_snapcs += err;if (le64_to_cpu (ri->seq) > realm->seq) { dout("update_snap_trace updating %llx %p %lld -> %lld\n",
@@ -727,22 +729,30 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,if (realm->seq > mdsc->last_snap_seq) mdsc->last_snap_seq = realm->seq; - invalidate =1 ; + rebuild_snapcs =1 ; }else if (!realm->cached_context) {dout ("update_snap_trace %llx %p seq %lld new\n" , realm->ino, realm, realm->seq); - invalidate =1 ; + rebuild_snapcs =1 ; }else {dout ("update_snap_trace %llx %p seq %lld unchanged\n" , realm->ino, realm, realm->seq); } -dout ("done with %llx %p, invalidated=%d, %p %p\n" , realm->ino, - realm, invalidate, p, e); +dout ("done with %llx %p, rebuild_snapcs=%d, %p %p\n" , realm->ino, + realm, rebuild_snapcs, p, e); -/* invalidate when we reach the _end_ (root) of the trace */ -if (invalidate && p >= e) -rebuild_snap_realms (realm, &dirty_realms); +/* +* this will always track the uppest parent realm from which +* we need to rebuild the snapshot contexts _downward_ in +* hierarchy. +*/ +if (rebuild_snapcs) + realm_to_rebuild = realm; + +/* rebuild_snapcs when we reach the _end_ (root) of the trace */ +if (realm_to_rebuild && p >= e) +rebuild_snap_realms (realm_to_rebuild, &dirty_realms);if (!first_realm) first_realm = realm;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 42/105 ceph: avoid putting the realm twice when decoding snaps fails
In reply to Greg Kroah-HartmanFrom: Xiubo Li <[email protected]>
[ Upstream commit 51884d153f7ec85e18d607b2467820a90e0f4359 ]
When decoding the snaps fails it maybe leaving the 'first_realm' and 'realm' pointing to the same snaprealm memory. And then it'll put it twice and could cause random use-after-free, BUG_ON, etc issues.
--- fs/ceph/snap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ceph/snap.c +2 -1
@@ -671,7 +671,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,struct ceph_mds_snap_realm *ri;/* encoded */ __le64 *snaps;/* encoded */ __le64 *prior_parent_snaps;/* encoded */ -struct ceph_snap_realm *realm =NULL ; +struct ceph_snap_realm *realm;struct ceph_snap_realm *first_realm =NULL ;struct ceph_snap_realm *realm_to_rebuild =NULL ;int rebuild_snapcs;
@@ -680,6 +680,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,dout ("update_snap_trace deletion=%d\n" , deletion); more: + realm =NULL ; rebuild_snapcs =0 ;ceph_decode_need (&p, e,sizeof (*ri), bad); ri = p;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 43/105 nilfs2: fix nilfs_sufile_mark_dirty() not set segment usage as dirty
In reply to Greg Kroah-HartmanFrom: Chen Zhongjin <[email protected]>
commit 512c5ca01a3610ab14ff6309db363de51f1c13a6 upstream.
When extending segments, nilfs_sufile_alloc() is called to get an unassigned segment, then mark it as dirty to avoid accidentally allocating the same segment in the future.
But for some special cases such as a corrupted image it can be unreliable. If such corruption of the dirty state of the segment occurs, nilfs2 may reallocate a segment that is in use and pick the same segment for writing twice at the same time.
This will cause the problem reported by syzkaller:
https://syzkaller.appspot.com/bug?id=c7c4748e11ffcc367cef04f76e02e931833cbd24
This case started with segbuf1.segnum = 3, nextnum = 4 when constructed. It supposed segment 4 has already been allocated and marked as dirty.
However the dirty state was corrupted and segment 4 usage was not dirty. For the first time nilfs_segctor_extend_segments() segment 4 was allocated again, which made segbuf2 and next segbuf3 had same segment 4.
sb_getblk() will get same bh for segbuf2 and segbuf3, and this bh is added to both buffer lists of two segbuf. It makes the lists broken which causes NULL pointer dereference.
Fix the problem by setting usage as dirty every time in nilfs_sufile_mark_dirty(), which is called during constructing current segment to be written out and before allocating next segment.
--- fs/nilfs2/sufile.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/nilfs2/sufile.c +8 -0
@@ -498,14 +498,22 @@ void nilfs_sufile_do_free(struct inode *int nilfs_sufile_mark_dirty (struct inode *sufile,__u64 segnum) {struct buffer_head *bh; +void *kaddr; +struct nilfs_segment_usage *su;int ret; +down_write (&NILFS_MDT (sufile)->mi_sem); ret =nilfs_sufile_get_segment_usage_block (sufile, segnum,0 , &bh);if (!ret) {mark_buffer_dirty (bh);nilfs_mdt_mark_dirty (sufile); + kaddr =kmap_atomic (bh->b_page); + su =nilfs_sufile_block_get_segment_usage (sufile, segnum, bh, kaddr); +nilfs_segment_usage_set_dirty (su); +kunmap_atomic (kaddr);brelse (bh); } +up_write (&NILFS_MDT (sufile)->mi_sem);return ret; }
Greg Kroah-Hartman
maintainerPATCH 44/105 Input: synaptics - switch touchpad on HP Laptop 15-da3001TU to RMI mode
In reply to Greg Kroah-HartmanFrom: Aman Dhoot <[email protected]>
[ Upstream commit ac5408991ea6b06e29129b4d4861097c4c3e0d59 ]
The device works fine in native RMI mode, there is no reason to use legacy PS/2 mode with it.
--- drivers/input/mouse/synaptics.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/mouse/synaptics.c +1 -0
@@ -192,6 +192,7 @@ static const char * const smbus_pnp_ids[] = {"SYN3221" ,/* HP 15-ay000 */ "SYN323d" ,/* HP Spectre X360 13-w013dx */ "SYN3257" ,/* HP Envy 13-ad105ng */ +"SYN3286" ,/* HP Laptop 15-da3001TU */ NULL };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 45/105 serial: 8250: 8250_omap: Avoid RS485 RTS glitch on ->set_termios()
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
[ Upstream commit 038ee49fef18710bedd38b531d173ccd746b2d8d ]
RS485-enabled UART ports on TI Sitara SoCs with active-low polarity exhibit a Transmit Enable glitch on ->set_termios():
omap8250_restore_regs(), which is called from omap_8250_set_termios(), sets the TCRTLR bit in the MCR register and clears all other bits, including RTS. If RTS uses active-low polarity, it is now asserted for no reason.
The TCRTLR bit is subsequently cleared by writing up->mcr to the MCR register. That variable is always zero, so the RTS bit is still cleared (incorrectly so if RTS is active-high).
(up->mcr is not, as one might think, a cache of the MCR register's current value. Rather, it only caches a single bit of that register, the AFE bit. And it only does so if the UART supports the AFE bit, which OMAP does not. For details see serial8250_do_set_termios() and serial8250_do_set_mctrl().)
Finally at the end of omap8250_restore_regs(), the MCR register is restored (and RTS deasserted) by a call to up->port.ops->set_mctrl() (which equals serial8250_set_mctrl()) and serial8250_em485_stop_tx().
So there's an RTS glitch between setting TCRTLR and calling serial8250_em485_stop_tx(). Avoid by using a read-modify-write when setting TCRTLR.
While at it, drop a redundant initialization of up->mcr. As explained above, the variable isn't used by the driver and it is already initialized to zero because it is part of the static struct serial8250_ports[] declared in 8250_core.c. (Static structs are initialized to zero per section 6.7.8 nr. 10 of the C99 standard.)
--- drivers/tty/serial/8250/8250_omap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/tty/serial/8250/8250_omap.c +4 -3
@@ -244,6 +244,7 @@ static void omap8250_restore_regs(struct uart_8250_port *up) {struct omap8250_priv *priv = up->port.private_data;struct uart_8250_dma *dma = up->dma; +u8 mcr =serial8250_in_MCR (up);if (dma && dma->tx_running) {/*
@@ -260,7 +261,7 @@ static void omap8250_restore_regs(struct uart_8250_port *up)serial_out (up,UART_EFR ,UART_EFR_ECB );serial_out (up,UART_LCR ,UART_LCR_CONF_MODE_A ); -serial8250_out_MCR (up,UART_MCR_TCRTLR ); +serial8250_out_MCR (up, mcr |UART_MCR_TCRTLR );serial_out (up,UART_FCR , up->fcr);omap8250_update_scr (up, priv);
@@ -276,7 +277,8 @@ static void omap8250_restore_regs(struct uart_8250_port *up)serial_out (up,UART_LCR ,0 );/* drop TCR + TLR access, we setup XON/XOFF later */ -serial8250_out_MCR (up, up->mcr); +serial8250_out_MCR (up, mcr); +serial_out (up,UART_IER , up->ier);serial_out (up,UART_LCR ,UART_LCR_CONF_MODE_B );
@@ -585,7 +587,6 @@ static int omap_8250_startup(struct uart_port *port)pm_runtime_get_sync (port->dev); - up->mcr =0 ;serial_out (up,UART_FCR ,UART_FCR_CLEAR_RCVR |UART_FCR_CLEAR_XMIT );serial_out (up,UART_LCR ,UART_LCR_WLEN8 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 46/105 xen/platform-pci: add missing free_irq() in error path
In reply to Greg Kroah-HartmanFrom: ruanjinjie <[email protected]>
[ Upstream commit c53717e1e3f0d0f9129b2e0dbc6dcc5e0a8132e9 ]
free_irq() is missing in case of error in platform_pci_probe(), fix that.
--- drivers/xen/platform-pci.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/xen/platform-pci.c +5 -2
@@ -150,7 +150,7 @@ static int platform_pci_probe(struct pci_dev *pdev,if (ret) {dev_warn (&pdev->dev,"Unable to set the evtchn callback " "err=%d\n" , ret); - goto out; + goto irq_out; } }
@@ -158,13 +158,16 @@ static int platform_pci_probe(struct pci_dev *pdev, grant_frames =alloc_xen_mmio (PAGE_SIZE * max_nr_gframes); ret =gnttab_setup_auto_xlat_frames (grant_frames);if (ret) - goto out; + goto irq_out; ret =gnttab_init ();if (ret) goto grant_out;return 0 ; grant_out:gnttab_free_auto_xlat_frames (); +irq_out: +if (!xen_have_vector_callback) +free_irq (pdev->irq, pdev); out:pci_release_region (pdev,0 ); mem_out:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 47/105 platform/x86: asus-wmi: add missing pci_dev_put() in asus_wmi_set_xusb2pr()
In reply to Greg Kroah-HartmanFrom: Xiongfeng Wang <[email protected]>
[ Upstream commit d0cdd85046b15089df71a50548617ac1025300d0 ]
pci_get_device() will increase the reference count for the returned pci_dev. We need to use pci_dev_put() to decrease the reference count before asus_wmi_set_xusb2pr() returns.
--- drivers/platform/x86/asus-wmi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/platform/x86/asus-wmi.c +2 -0
@@ -1176,6 +1176,8 @@ static void asus_wmi_set_xusb2pr(struct asus_wmi *asus)pci_write_config_dword (xhci_pdev,USB_INTEL_XUSB2PR ,cpu_to_le32 (ports_available)); +pci_dev_put (xhci_pdev); +pr_info ("set USB_INTEL_XUSB2PR old: 0x%04x, new: 0x%04x\n" , orig_ports_available, ports_available); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 48/105 platform/x86: acer-wmi: Enable SW_TABLET_MODE on Switch V 10 (SW5-017)
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 1e817b889c7d8c14e7005258e15fec62edafe03c ]
Like the Acer Switch 10 (SW5-012) and Acer Switch 10 (S1003) models the Acer Switch V 10 (SW5-017) supports reporting SW_TABLET_MODE through acer-wmi.
Add a DMI quirk for the SW5-017 setting force_caps to ACER_CAP_KBD_DOCK (these devices have no other acer-wmi based functionality).
--- drivers/platform/x86/acer-wmi.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/acer-wmi.c +9 -0
@@ -550,6 +550,15 @@ static const struct dmi_system_id acer_quirks[] __initconst = { }, .driver_data = (void *)ACER_CAP_KBD_DOCK, }, + { + .callback = set_force_caps, + .ident = "Acer Aspire Switch V 10 SW5-017", + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"Acer" ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "SW5-017"), + }, + .driver_data = (void *)ACER_CAP_KBD_DOCK, + }, { .callback = set_force_caps, .ident = "Acer One 10 (S1003)",
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 49/105 platform/x86: hp-wmi: Ignore Smart Experience App event
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 8b9b6a044b408283b086702b1d9e3cf4ba45b426 ]
Sometimes hp-wmi driver complains on system resume:
[ 483.116451] hp_wmi: Unknown event_id - 33 - 0x0
According to HP it's a feature called "HP Smart Experience App" and it's safe to be ignored.
--- drivers/platform/x86/hp-wmi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/platform/x86/hp-wmi.c +3 -0
@@ -76,6 +76,7 @@ enum hp_wmi_event_ids {HPWMI_PEAKSHIFT_PERIOD =0x0F ,HPWMI_BATTERY_CHARGE_PERIOD =0x10 ,HPWMI_SANITIZATION_MODE =0x17 , + HPWMI_SMART_EXPERIENCE_APP = 0x21, }; struct bios_args {
@@ -634,6 +635,8 @@ static void hp_wmi_notify(u32 value, void *context)break ;case HPWMI_SANITIZATION_MODE :break ; +case HPWMI_SMART_EXPERIENCE_APP : +break ;default :pr_info ("Unknown event_id - %d - 0x%x\n" , event_id, event_data);break ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 50/105 tcp: configurable source port perturb table size
In reply to Greg Kroah-HartmanFrom: Gleb Mazovetskiy <[email protected]>
[ Upstream commit aeac4ec8f46d610a10adbaeff5e2edf6a88ffc62 ]
On embedded systems with little memory and no relevant security concerns, it is beneficial to reduce the size of the table.
Reducing the size from 2^16 to 2^8 saves 255 KiB of kernel RAM.
Makes the table size configurable as an expert option.
The size was previously increased from 2^8 to 2^16
in commit 4c2c8f03a5ab ("tcp: increase source port perturb table to 2^16").
--- net/ipv4/Kconfig | 10 ++++++++++ net/ipv4/inet_hashtables.c | 10 +++++----- 2 files changed, 15 insertions(+), 5 deletions(-)
net/ipv4/Kconfig +10 -0
@@ -388,6 +388,16 @@ config INET_IPCOMP If unsure, say Y. +config INET_TABLE_PERTURB_ORDER + int "INET: Source port perturbation table size (as power of 2)" if EXPERT + default 16 + help + Source port perturbation table size (as power of 2) for + RFC 6056 3.3.4. Algorithm 4: Double-Hash Port Selection Algorithm. + + The default is almost always what you want. + Only change this if you know what you are doing. + config INET_XFRM_TUNNEL tristate select INET_TUNNEL
net/ipv4/inet_hashtables.c +5 -5
@@ -718,13 +718,13 @@ EXPORT_SYMBOL_GPL(inet_unhash);* Note that we use 32bit integers (vs RFC 'short integers') * because 2^16 is not a multiple of num_ephemeral and this * property might be used by clever attacker. +* * RFC claims using TABLE_LENGTH=10 buckets gives an improvement, though -* attacks were since demonstrated, thus we use 65536 instead to really -* give more isolation and privacy, at the expense of 256kB of kernel -* memory. +* attacks were since demonstrated, thus we use 65536 by default instead +* to really give more isolation and privacy, at the expense of 256kB +* of kernel memory. */ -#define INET_TABLE_PERTURB_SHIFT 16 -#define INET_TABLE_PERTURB_SIZE (1 << INET_TABLE_PERTURB_SHIFT) +#define INET_TABLE_PERTURB_SIZE (1 << CONFIG_INET_TABLE_PERTURB_ORDER)static u32 *table_perturb; int __inet_hash_connect(struct inet_timewait_death_row *death_row,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 51/105 net: usb: qmi_wwan: add Telit 0x103a composition
In reply to Greg Kroah-HartmanFrom: Enrico Sau <[email protected]>
[ Upstream commit e103ba33998d0f25653cc8ebe745b68d1ee10cda ]
Add the following Telit LE910C4-WWX composition:
0x103a: rmnet
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -1317,6 +1317,7 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1031, 3)}, /* Telit LE910C1-EUX */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x103a, 0)}, /* Telit LE910C4-WWX */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1050, 2)}, /* Telit FN980 */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1060, 2)}, /* Telit LN920 */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 52/105 dm integrity: flush the journal on suspend
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
[ Upstream commit 5e5dab5ec763d600fe0a67837dd9155bdc42f961 ]
This commit flushes the journal on suspend. It is prerequisite for the next commit that enables activating dm integrity devices in read-only mode.
Note that we deliberately didn't flush the journal on suspend, so that the journal replay code would be tested. However, the dm-integrity code is 5 years old now, so that journal replay is well-tested, and we can make this change now.
--- drivers/md/dm-integrity.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/md/dm-integrity.c +1 -6
@@ -2116,10 +2116,6 @@ static void integrity_writer(struct work_struct *w)unsigned prev_free_sectors; -/* the following test is not needed, but it tests the replay code */ -if (unlikely (dm_post_suspending (ic->ti)) && !ic->meta_dev) -return ; -spin_lock_irq (&ic->endio_wait.lock); write_start = ic->committed_section; write_sections = ic->n_committed_sections;
@@ -2455,8 +2451,7 @@ static void dm_integrity_postsuspend(struct dm_target *ti)drain_workqueue (ic->commit_wq);if (ic->mode =='J' ) { -if (ic->meta_dev) -queue_work (ic->writer_wq, &ic->writer_work); +queue_work (ic->writer_wq, &ic->writer_work);drain_workqueue (ic->writer_wq);dm_integrity_flush_buffers (ic, true); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 53/105 btrfs: free btrfs_path before copying root refs to userspace
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit b740d806166979488e798e41743aaec051f2443f upstream.
Syzbot reported the following lockdep splat
======================================================
WARNING: possible circular locking dependency detected 6.0.0-rc7-syzkaller-18095-gbbed346d5a96 #0 Not tainted
------------------------------------------------------
syz-executor307/3029 is trying to acquire lock:ffff0000c02525d8 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0x54/0xb4 mm/memory.c:5576
but task is already holding lock:ffff0000c958a608 (btrfs-root-00){++++}-{3:3}, at: __btrfs_tree_read_lock fs/btrfs/locking.c:134 [inline] ffff0000c958a608 (btrfs-root-00){++++}-{3:3}, at: btrfs_tree_read_lock fs/btrfs/locking.c:140 [inline] ffff0000c958a608 (btrfs-root-00){++++}-{3:3}, at: btrfs_read_lock_root_node+0x13c/0x1c0 fs/btrfs/locking.c:279
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #3 (btrfs-root-00){++++}-{3:3}:
down_read_nested+0x64/0x84 kernel/locking/rwsem.c:1624
__btrfs_tree_read_lock fs/btrfs/locking.c:134 [inline]
btrfs_tree_read_lock fs/btrfs/locking.c:140 [inline]
btrfs_read_lock_root_node+0x13c/0x1c0 fs/btrfs/locking.c:279
btrfs_search_slot_get_root+0x74/0x338 fs/btrfs/ctree.c:1637
btrfs_search_slot+0x1b0/0xfd8 fs/btrfs/ctree.c:1944
btrfs_update_root+0x6c/0x5a0 fs/btrfs/root-tree.c:132
commit_fs_roots+0x1f0/0x33c fs/btrfs/transaction.c:1459
btrfs_commit_transaction+0x89c/0x12d8 fs/btrfs/transaction.c:2343
flush_space+0x66c/0x738 fs/btrfs/space-info.c:786
btrfs_async_reclaim_metadata_space+0x43c/0x4e0 fs/btrfs/space-info.c:1059
process_one_work+0x2d8/0x504 kernel/workqueue.c:2289
worker_thread+0x340/0x610 kernel/workqueue.c:2436
kthread+0x12c/0x158 kernel/kthread.c:376
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860-> #2 (&fs_info->reloc_mutex){+.+.}-{3:3}:
__mutex_lock_common+0xd4/0xca8 kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
btrfs_record_root_in_trans fs/btrfs/transaction.c:516 [inline]
start_transaction+0x248/0x944 fs/btrfs/transaction.c:752
btrfs_start_transaction+0x34/0x44 fs/btrfs/transaction.c:781
btrfs_create_common+0xf0/0x1b4 fs/btrfs/inode.c:6651
btrfs_create+0x8c/0xb0 fs/btrfs/inode.c:6697
lookup_open fs/namei.c:3413 [inline]
open_last_lookups fs/namei.c:3481 [inline]
path_openat+0x804/0x11c4 fs/namei.c:3688
do_filp_open+0xdc/0x1b8 fs/namei.c:3718
do_sys_openat2+0xb8/0x22c fs/open.c:1313
do_sys_open fs/open.c:1329 [inline]
__do_sys_openat fs/open.c:1345 [inline]
__se_sys_openat fs/open.c:1340 [inline]
__arm64_sys_openat+0xb0/0xe0 fs/open.c:1340
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581-> #1 (sb_internal#2){.+.+}-{0:0}:
percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
__sb_start_write include/linux/fs.h:1826 [inline]
sb_start_intwrite include/linux/fs.h:1948 [inline]
start_transaction+0x360/0x944 fs/btrfs/transaction.c:683
btrfs_join_transaction+0x30/0x40 fs/btrfs/transaction.c:795
btrfs_dirty_inode+0x50/0x140 fs/btrfs/inode.c:6103
btrfs_update_time+0x1c0/0x1e8 fs/btrfs/inode.c:6145
inode_update_time fs/inode.c:1872 [inline]
touch_atime+0x1f0/0x4a8 fs/inode.c:1945
file_accessed include/linux/fs.h:2516 [inline]
btrfs_file_mmap+0x50/0x88 fs/btrfs/file.c:2407
call_mmap include/linux/fs.h:2192 [inline]
mmap_region+0x7fc/0xc14 mm/mmap.c:1752
do_mmap+0x644/0x97c mm/mmap.c:1540
vm_mmap_pgoff+0xe8/0x1d0 mm/util.c:552
ksys_mmap_pgoff+0x1cc/0x278 mm/mmap.c:1586
__do_sys_mmap arch/arm64/kernel/sys.c:28 [inline]
__se_sys_mmap arch/arm64/kernel/sys.c:21 [inline]
__arm64_sys_mmap+0x58/0x6c arch/arm64/kernel/sys.c:21
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581-> #0 (&mm->mmap_lock){++++}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3095 [inline]
check_prevs_add kernel/locking/lockdep.c:3214 [inline]
validate_chain kernel/locking/lockdep.c:3829 [inline]
__lock_acquire+0x1530/0x30a4 kernel/locking/lockdep.c:5053
lock_acquire+0x100/0x1f8 kernel/locking/lockdep.c:5666
__might_fault+0x7c/0xb4 mm/memory.c:5577
_copy_to_user include/linux/uaccess.h:134 [inline]
copy_to_user include/linux/uaccess.h:160 [inline]
btrfs_ioctl_get_subvol_rootref+0x3a8/0x4bc fs/btrfs/ioctl.c:3203
btrfs_ioctl+0xa08/0xa64 fs/btrfs/ioctl.c:5556
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__arm64_sys_ioctl+0xd0/0x140 fs/ioctl.c:856
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581other info that might help us debug this:
Chain exists of: &mm->mmap_lock --> &fs_info->reloc_mutex --> btrfs-root-00 Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(btrfs-root-00);
lock(&fs_info->reloc_mutex);
lock(btrfs-root-00); lock(&mm->mmap_lock);
*** DEADLOCK ***
1 lock held by syz-executor307/3029:
#0: ffff0000c958a608 (btrfs-root-00){++++}-{3:3}, at: __btrfs_tree_read_lock fs/btrfs/locking.c:134 [inline] #0: ffff0000c958a608 (btrfs-root-00){++++}-{3:3}, at: btrfs_tree_read_lock fs/btrfs/locking.c:140 [inline] #0: ffff0000c958a608 (btrfs-root-00){++++}-{3:3}, at: btrfs_read_lock_root_node+0x13c/0x1c0 fs/btrfs/locking.c:279
stack backtrace: CPU: 0 PID: 3029 Comm: syz-executor307 Not tainted 6.0.0-rc7-syzkaller-18095-gbbed346d5a96 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/30/2022 Call trace: dump_backtrace+0x1c4/0x1f0 arch/arm64/kernel/stacktrace.c:156 show_stack+0x2c/0x54 arch/arm64/kernel/stacktrace.c:163 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x104/0x16c lib/dump_stack.c:106 dump_stack+0x1c/0x58 lib/dump_stack.c:113 print_circular_bug+0x2c4/0x2c8 kernel/locking/lockdep.c:2053 check_noncircular+0x14c/0x154 kernel/locking/lockdep.c:2175 check_prev_add kernel/locking/lockdep.c:3095 [inline] check_prevs_add kernel/locking/lockdep.c:3214 [inline] validate_chain kernel/locking/lockdep.c:3829 [inline] __lock_acquire+0x1530/0x30a4 kernel/locking/lockdep.c:5053 lock_acquire+0x100/0x1f8 kernel/locking/lockdep.c:5666 __might_fault+0x7c/0xb4 mm/memory.c:5577 _copy_to_user include/linux/uaccess.h:134 [inline] copy_to_user include/linux/uaccess.h:160 [inline] btrfs_ioctl_get_subvol_rootref+0x3a8/0x4bc fs/btrfs/ioctl.c:3203 btrfs_ioctl+0xa08/0xa64 fs/btrfs/ioctl.c:5556 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __arm64_sys_ioctl+0xd0/0x140 fs/ioctl.c:856 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall arch/arm64/kernel/syscall.c:52 [inline] el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206 el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
We do generally the right thing here, copying the references into a temporary buffer, however we are still holding the path when we do copy_to_user from the temporary buffer. Fix this by freeing the path before we copy to user space.
--- fs/btrfs/ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/ioctl.c +2 -1
@@ -2849,6 +2849,8 @@ static int btrfs_ioctl_get_subvol_rootre } out: +btrfs_free_path (path); +if (!ret || ret == -EOVERFLOW ) { rootrefs->num_items = found;/* update min_treeid for next search */
@@ -2860,7 +2862,6 @@ out: }kfree (rootrefs); -btrfs_free_path (path);return ret; }
Greg Kroah-Hartman
maintainerPATCH 54/105 btrfs: free btrfs_path before copying fspath to userspace
In reply to Greg Kroah-HartmanFrom: Anand Jain <[email protected]>
commit 8cf96b409d9b3946ece58ced13f92d0f775b0442 upstream.
btrfs_ioctl_ino_to_path() frees the search path after the userspace copy from the temp buffer @ipath->fspath. Which potentially can lead to a lock splat warning.
Fix this by freeing the path before we copy it to userspace.
--- fs/btrfs/ioctl.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/ioctl.c +2 -0
@@ -4887,6 +4887,8 @@ static long btrfs_ioctl_ino_to_path(stru ipath->fspath->val[i] = rel_ptr; } +btrfs_free_path (path); + path =NULL ; ret =copy_to_user ((void __user *)(unsigned long )ipa->fspath, ipath->fspath, size);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 55/105 btrfs: free btrfs_path before copying subvol info to userspace
In reply to Greg Kroah-HartmanFrom: Anand Jain <[email protected]>
commit 013c1c5585ebcfb19c88efe79063d0463b1b6159 upstream.
btrfs_ioctl_get_subvol_info() frees the search path after the userspace copy from the temp buffer @subvol_info. This can lead to a lock splat warning.
Fix this by freeing the path before we copy it to userspace.
--- fs/btrfs/ioctl.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/ioctl.c +2 -0
@@ -2759,6 +2759,8 @@ static int btrfs_ioctl_get_subvol_info(s } } +btrfs_free_path (path); + path =NULL ;if (copy_to_user (argp, subvol_info,sizeof (*subvol_info))) ret = -EFAULT ;
Greg Kroah-Hartman
maintainerPATCH 56/105 drm/amd/dc/dce120: Fix audio register mapping, stop triggering KASAN
In reply to Greg Kroah-HartmanFrom: Lyude Paul <[email protected]>
commit 44035ec2fde1114254ee465f9ba3bb246b0b6283 upstream.
There's been a very long running bug that seems to have been neglected for a while, where amdgpu consistently triggers a KASAN error at start:
BUG: KASAN: global-out-of-bounds in read_indirect_azalia_reg+0x1d4/0x2a0 [amdgpu] Read of size 4 at addr ffffffffc2274b28 by task modprobe/1889
After digging through amd's rather creative method for accessing registers, I eventually discovered the problem likely has to do with the fact that on my dce120 GPU there are supposedly 7 sets of audio registers. But we only define a register mapping for 6 sets.
So, fix this and fix the KASAN warning finally.
--- drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +2 -1
@@ -324,7 +324,8 @@ static const struct dce_audio_registersaudio_regs (2 ),audio_regs (3 ),audio_regs (4 ), - audio_regs(5) +audio_regs (5 ), + audio_regs(6), };#define DCE120_AUD_COMMON_MASK_SH_LIST (mask_sh)\
Greg Kroah-Hartman
maintainerPATCH 57/105 drm/amdgpu: always register an MMU notifier for userptr
In reply to Greg Kroah-HartmanFrom: Christian König <[email protected]>
commit b39df63b16b64a3af42695acb9bc567aad144776 upstream.
Since switching to HMM we always need that because we no longer grab references to the pages.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +3 -5
@@ -328,11 +328,9 @@ int amdgpu_gem_userptr_ioctl(struct drm_if (r) goto release_object; -if (args->flags &AMDGPU_GEM_USERPTR_REGISTER ) { - r =amdgpu_mn_register (bo, args->addr); -if (r) - goto release_object; - } + r =amdgpu_mn_register (bo, args->addr); +if (r) + goto release_object;if (args->flags &AMDGPU_GEM_USERPTR_VALIDATE ) { r = amdgpu_ttm_tt_get_user_pages(bo->tbo.ttm,
Greg Kroah-Hartman
maintainerPATCH 58/105 btrfs: free btrfs_path before copying inodes to userspace
In reply to Greg Kroah-HartmanFrom: Anand Jain <[email protected]>
[ Upstream commit 418ffb9e3cf6c4e2574d3a732b724916684bd133 ]
btrfs_ioctl_logical_to_ino() frees the search path after the userspace copy from the temp buffer @inodes. Which potentially can lead to a lock splat.
Fix this by freeing the path before we copy @inodes to userspace.
--- fs/btrfs/ioctl.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
fs/btrfs/ioctl.c +7 -9
@@ -4961,21 +4961,20 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_fs_info *fs_info, size =min_t (u32, loi->size,SZ_16M ); } - path =btrfs_alloc_path (); -if (!path) { - ret = -ENOMEM ; - goto out; - } - inodes =init_data_container (size);if (IS_ERR (inodes)) { ret =PTR_ERR (inodes); - inodes =NULL ; - goto out; + goto out_loi; } + path =btrfs_alloc_path (); +if (!path) { + ret = -ENOMEM ; + goto out; + } ret =iterate_inodes_from_logical (loi->logical, fs_info, path, build_ino_list, inodes, ignore_offset); +btrfs_free_path (path);if (ret == -EINVAL ) ret = -ENOENT ;if (ret <0 )
@@ -4987,7 +4986,6 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_fs_info *fs_info, ret = -EFAULT ; out: -btrfs_free_path (path);kvfree (inodes); out_loi:kfree (loi);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 59/105 spi: spi-imx: Fix spi_bus_clk if requested clock is higher than input clock
In reply to Greg Kroah-HartmanFrom: Frieder Schrempf <[email protected]>
[ Upstream commit db2d2dc9a0b58c6faefb6b002fdbed4f0362d1a4 ]
In case the requested bus clock is higher than the input clock, the correct dividers (pre = 0, post = 0) are returned from mx51_ecspi_clkdiv(), but *fres is left uninitialized and therefore contains an arbitrary value.
This causes trouble for the recently introduced PIO polling feature as the value in spi_imx->spi_bus_clk is used there to calculate for which transfers to enable PIO polling.
Fix this by setting *fres even if no clock dividers are in use.
This issue was observed on Kontron BL i.MX8MM with an SPI peripheral clock set to 50 MHz by default and a requested SPI bus clock of 80 MHz for the SPI NOR flash.
With the fix applied the debug message from mx51_ecspi_clkdiv() now prints the following:
spi_imx 30820000.spi: mx51_ecspi_clkdiv: fin: 50000000, fspi: 50000000,
post: 0, pre: 0
--- drivers/spi/spi-imx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/spi/spi-imx.c +1 -2
@@ -429,8 +429,7 @@ static unsigned int mx51_ecspi_clkdiv(struct spi_imx_data *spi_imx,unsigned int pre, post;unsigned int fin = spi_imx->spi_clk; -if (unlikely (fspi > fin)) -return 0 ; + fspi =min (fspi, fin); post =fls (fin) -fls (fspi);if (fin > fspi << post)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 60/105 kbuild: fix -Wimplicit-function-declaration in license_is_gpl_compatible
In reply to Greg Kroah-HartmanFrom: Sam James <[email protected]>
[ Upstream commit 50c697215a8cc22f0e58c88f06f2716c05a26e85 ]
Add missing <linux/string.h> include for strcmp.
Clang 16 makes -Wimplicit-function-declaration an error by default. Unfortunately, out of tree modules may use this in configure scripts, which means failure might cause silent miscompilation or misconfiguration.
For more information, see LWN.net [0] or LLVM's Discourse [1], gentoo-dev@ [2], or the (new) c-std-porting mailing list [3].
[0] https://lwn.net/Articles/913505/
[1] https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213
[2] https://archives.gentoo.org/gentoo-dev/message/dd9f2d3082b8b6f8dfbccb0639e6e240
[3] hosted at lists.linux.dev.
--- include/linux/license.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/license.h +2 -0
@@ -1,6 +1,8 @@#ifndef __LICENSE_H#define __LICENSE_H +#include <linux/string.h> +static inline int license_is_gpl_compatible (const char *license) { return (strcmp(license, "GPL") == 0
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 61/105 iio: health: afe4403: Fix oob read in afe4403_read_raw
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit 58143c1ed5882c138a3cd2251a336fc8755f23d9 ]
KASAN report out-of-bounds read as follows:
BUG: KASAN: global-out-of-bounds in afe4403_read_raw+0x42e/0x4c0 Read of size 4 at addr ffffffffc02ac638 by task cat/279 Call Trace: afe4403_read_raw iio_read_channel_info dev_attr_show The buggy address belongs to the variable: afe4403_channel_leds+0x18/0xffffffffffffe9e0
This issue can be reproduced by singe command:
$ cat /sys/bus/spi/devices/spi0.0/iio\:device0/in_intensity6_raw
The array size of afe4403_channel_leds is less than channels, so access with chan->address cause OOB read in afe4403_read_raw. Fix it by moving access before use it.
--- drivers/iio/health/afe4403.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/health/afe4403.c +3 -2
@@ -253,14 +253,14 @@ static int afe4403_read_raw(struct iio_dev *indio_dev, int *val, int *val2, long mask) { struct afe4403_data *afe = iio_priv(indio_dev); -unsigned int reg = afe4403_channel_values[chan->address]; -unsigned int field = afe4403_channel_leds[chan->address]; +unsigned int reg, field;int ret;switch (chan->type) {case IIO_INTENSITY :switch (mask) {case IIO_CHAN_INFO_RAW : + reg = afe4403_channel_values[chan->address]; ret =afe4403_read (afe, reg, val);if (ret)return ret;
@@ -270,6 +270,7 @@ static int afe4403_read_raw(struct iio_dev *indio_dev,case IIO_CURRENT :switch (mask) {case IIO_CHAN_INFO_RAW : + field = afe4403_channel_leds[chan->address]; ret =regmap_field_read (afe->fields[field], val);if (ret)return ret;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 62/105 iio: health: afe4404: Fix oob read in afe4404_[read|write]_raw
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit fc92d9e3de0b2d30a3ccc08048a5fad533e4672b ]
KASAN report out-of-bounds read as follows:
BUG: KASAN: global-out-of-bounds in afe4404_read_raw+0x2ce/0x380 Read of size 4 at addr ffffffffc00e4658 by task cat/278 Call Trace: afe4404_read_raw iio_read_channel_info dev_attr_show The buggy address belongs to the variable: afe4404_channel_leds+0x18/0xffffffffffffe9c0
This issue can be reproduce by singe command:
$ cat /sys/bus/i2c/devices/0-0058/iio\:device0/in_intensity6_raw
The array size of afe4404_channel_leds and afe4404_channel_offdacs are less than channels, so access with chan->address cause OOB read in afe4404_[read|write]_raw. Fix it by moving access before use them.
--- drivers/iio/health/afe4404.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/iio/health/afe4404.c +7 -5
@@ -258,20 +258,20 @@ static int afe4404_read_raw(struct iio_dev *indio_dev, int *val, int *val2, long mask) { struct afe4404_data *afe = iio_priv(indio_dev); -unsigned int value_reg = afe4404_channel_values[chan->address]; -unsigned int led_field = afe4404_channel_leds[chan->address]; -unsigned int offdac_field = afe4404_channel_offdacs[chan->address]; +unsigned int value_reg, led_field, offdac_field;int ret;switch (chan->type) {case IIO_INTENSITY :switch (mask) {case IIO_CHAN_INFO_RAW : + value_reg = afe4404_channel_values[chan->address]; ret =regmap_read (afe->regmap, value_reg, val);if (ret)return ret;return IIO_VAL_INT ;case IIO_CHAN_INFO_OFFSET : + offdac_field = afe4404_channel_offdacs[chan->address]; ret =regmap_field_read (afe->fields[offdac_field], val);if (ret)return ret;
@@ -281,6 +281,7 @@ static int afe4404_read_raw(struct iio_dev *indio_dev,case IIO_CURRENT :switch (mask) {case IIO_CHAN_INFO_RAW : + led_field = afe4404_channel_leds[chan->address]; ret =regmap_field_read (afe->fields[led_field], val);if (ret)return ret;
@@ -303,19 +304,20 @@ static int afe4404_write_raw(struct iio_dev *indio_dev, int val, int val2, long mask) { struct afe4404_data *afe = iio_priv(indio_dev); -unsigned int led_field = afe4404_channel_leds[chan->address]; -unsigned int offdac_field = afe4404_channel_offdacs[chan->address]; +unsigned int led_field, offdac_field;switch (chan->type) {case IIO_INTENSITY :switch (mask) {case IIO_CHAN_INFO_OFFSET : + offdac_field = afe4404_channel_offdacs[chan->address];return regmap_field_write (afe->fields[offdac_field], val); }break ;case IIO_CURRENT :switch (mask) {case IIO_CHAN_INFO_RAW : + led_field = afe4404_channel_leds[chan->address];return regmap_field_write (afe->fields[led_field], val); }break ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 63/105 iio: light: rpr0521: add missing Kconfig dependencies
In reply to Greg Kroah-HartmanFrom: Paul Gazzillo <[email protected]>
[ Upstream commit 6ac12303572ef9ace5603c2c07f5f1b00a33f580 ]
Fix an implicit declaration of function error for rpr0521 under some configs
When CONFIG_RPR0521 is enabled without CONFIG_IIO_TRIGGERED_BUFFER, the build results in "implicit declaration of function" errors, e.g.,
drivers/iio/light/rpr0521.c:434:3: error: implicit declaration of function
'iio_trigger_poll_chained' [-Werror=implicit-function-declaration]
434 | iio_trigger_poll_chained(data->drdy_trigger0);
| ^~~~~~~~~~~~~~~~~~~~~~~~This fix adds select dependencies to RPR0521's configuration declaration.
--- drivers/iio/light/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/light/Kconfig +2 -0
@@ -238,6 +238,8 @@ config RPR0521 tristate "ROHM RPR0521 ALS and proximity sensor driver" depends on I2C select REGMAP_I2C + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER help Say Y here if you want to build support for ROHM's RPR0521 ambient light and proximity sensor device.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 64/105 scripts/faddr2line: Fix regression in name resolution on ppc64le
In reply to Greg Kroah-HartmanFrom: Srikar Dronamraju <[email protected]>
[ Upstream commit 2d77de1581bb5b470486edaf17a7d70151131afd ]
Commit 1d1a0e7c5100 ("scripts/faddr2line: Fix overlapping text section failures") can cause faddr2line to fail on ppc64le on some distributions, while it works fine on other distributions. The failure can be attributed to differences in the readelf output.
$ ./scripts/faddr2line vmlinux find_busiest_group+0x00 no match for find_busiest_group+0x00
On ppc64le, readelf adds the localentry tag before the symbol name on some distributions, and adds the localentry tag after the symbol name on other distributions. This problem has been discussed previously:
https://lore.kernel.org/bpf/20191211160133.GB4580@calabresa/
This problem can be overcome by filtering out the localentry tags in the readelf output. Similar fixes are already present in the kernel by way of the following commits:
1fd6cee127e2 ("libbpf: Fix VERSIONED_SYM_COUNT number parsing") aa915931ac3e ("libbpf: Fix readelf output parsing for Fedora")
[jpoimboe: rework commit log]
--- scripts/faddr2line | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
scripts/faddr2line +4 -3
@@ -73,7 +73,8 @@ command -v ${ADDR2LINE} >/dev/null 2>&1 || die "${ADDR2LINE} isn't installed" find_dir_prefix() { local objfile=$1 - local start_kernel_addr=$(${READELF} --symbols --wide $objfile | ${AWK} '$8 == "start_kernel" {printf "0x%s", $2}') + local start_kernel_addr=$(${READELF} --symbols --wide $objfile | sed 's/\[.*\]//' | + ${AWK} '$8 == "start_kernel" {printf "0x%s", $2}') [[ -z $start_kernel_addr ]] && return local file_line=$(${ADDR2LINE} -e $objfile $start_kernel_addr)
@@ -177,7 +178,7 @@ __faddr2line() { found=2 break fi - done < <(${READELF} --symbols --wide $objfile | ${AWK} -v sec=$sym_sec '$7 == sec' | sort --key=2) + done < <(${READELF} --symbols --wide $objfile | sed 's/\[.*\]//' | ${AWK} -v sec=$sym_sec '$7 == sec' | sort --key=2) if [[ $found = 0 ]]; then warn "can't find symbol: sym_name: $sym_name sym_sec: $sym_sec sym_addr: $sym_addr sym_elf_size: $sym_elf_size"
@@ -258,7 +259,7 @@ __faddr2line() { DONE=1 - done < <(${READELF} --symbols --wide $objfile | ${AWK} -v fn=$sym_name '$4 == "FUNC" && $8 == fn') + done < <(${READELF} --symbols --wide $objfile | sed 's/\[.*\]//' | ${AWK} -v fn=$sym_name '$4 == "FUNC" && $8 == fn') } [[ $# -lt 2 ]] && usage
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 65/105 hwmon: (i5500_temp) fix missing pci_disable_device()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 3b7f98f237528c496ea0b689bace0e35eec3e060 ]
pci_disable_device() need be called while module exiting, switch to use pcim_enable(), pci_disable_device() will be called in pcim_release().
--- drivers/hwmon/i5500_temp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/i5500_temp.c +1 -1
@@ -117,7 +117,7 @@ static int i5500_temp_probe(struct pci_dev *pdev,u32 tstimer;s8 tsfsc; - err =pci_enable_device (pdev); + err =pcim_enable_device (pdev);if (err) {dev_err (&pdev->dev,"Failed to enable device\n" );return err;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 66/105 hwmon: (ibmpex) Fix possible UAF when ibmpex_register_bmc() fails
In reply to Greg Kroah-HartmanFrom: Gaosheng Cui <[email protected]>
[ Upstream commit e2a87785aab0dac190ac89be6a9ba955e2c634f2 ]
Smatch report warning as follows:
drivers/hwmon/ibmpex.c:509 ibmpex_register_bmc() warn:
'&data->list' not removed from list
If ibmpex_find_sensors() fails in ibmpex_register_bmc(), data will be freed, but data->list will not be removed from driver_data.bmc_data, then list traversal may cause UAF.
Fix by removeing it from driver_data.bmc_data before free().
--- drivers/hwmon/ibmpex.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/ibmpex.c +1 -0
@@ -517,6 +517,7 @@ static void ibmpex_register_bmc(int iface, struct device *dev)return ; out_register: +list_del (&data->list);hwmon_device_unregister (data->hwmon_dev); out_user:ipmi_destroy_user (data->user);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 67/105 of: property: decrement node refcount in of_fwnode_get_reference_args()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 60d865bd5a9b15a3961eb1c08bd4155682a3c81e ]
In of_fwnode_get_reference_args(), the refcount of of_args.np has been incremented in the case of successful return from of_parse_phandle_with_args() or of_parse_phandle_with_fixed_args().
Decrement the refcount if of_args is not returned to the caller of of_fwnode_get_reference_args().
--- drivers/of/property.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/of/property.c +3 -1
@@ -918,8 +918,10 @@ of_fwnode_get_reference_args(const struct fwnode_handle *fwnode, nargs, index, &of_args);if (ret <0 )return ret; -if (!args) +if (!args) { +of_node_put (of_args.np);return 0 ; + } args->nargs = of_args.args_count; args->fwnode =of_fwnode_handle (of_args.np);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 68/105 net/mlx5: Fix uninitialized variable bug in outlen_write()
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 3f5769a074c13d8f08455e40586600419e02a880 ]
If sscanf() return 0, outlen is uninitialized and used in kzalloc(), this is unexpected. We should return -EINVAL if the string is invalid.
--- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +2 -2
@@ -1324,8 +1324,8 @@ static ssize_t outlen_write(struct file *filp, const char __user *buf,return -EFAULT ; err =sscanf (outlen_str,"%d" , &outlen); -if (err <0 ) -return err; +if (err !=1 ) +return -EINVAL ; ptr =kzalloc (outlen,GFP_KERNEL );if (!ptr)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 69/105 can: sja1000_isa: sja1000_isa_probe(): add missing free_sja1000dev()
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
[ Upstream commit 92dfd9310a71d28cefe6a2d5174d43fab240e631 ]
Add the missing free_sja1000dev() before return from sja1000_isa_probe() in the register_sja1000dev() error handling case.
In addition, remove blanks before goto labels.
--- drivers/net/can/sja1000/sja1000_isa.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/can/sja1000/sja1000_isa.c +6 -4
@@ -213,22 +213,24 @@ static int sja1000_isa_probe(struct platform_device *pdev)if (err) {dev_err (&pdev->dev,"registering %s failed (err=%d)\n" ,DRV_NAME , err); - goto exit_unmap; + goto exit_free; }dev_info (&pdev->dev,"%s device registered (reg_base=0x%p, irq=%d)\n" ,DRV_NAME , priv->reg_base, dev->irq);return 0 ; - exit_unmap: +exit_free: +free_sja1000dev (dev); +exit_unmap:if (mem[idx])iounmap (base); - exit_release: +exit_release:if (mem[idx])release_mem_region (mem[idx], iosize);else release_region (port[idx], iosize); - exit: +exit:return err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 70/105 can: cc770: cc770_isa_probe(): add missing free_cc770dev()
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
[ Upstream commit 62ec89e74099a3d6995988ed9f2f996b368417ec ]
Add the missing free_cc770dev() before return from cc770_isa_probe() in the register_cc770dev() error handling case.
In addition, remove blanks before goto labels.
--- drivers/net/can/cc770/cc770_isa.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/can/cc770/cc770_isa.c +6 -4
@@ -272,22 +272,24 @@ static int cc770_isa_probe(struct platform_device *pdev)if (err) {dev_err (&pdev->dev,"couldn't register device (err=%d)\n" , err); - goto exit_unmap; + goto exit_free; }dev_info (&pdev->dev,"device registered (reg_base=0x%p, irq=%d)\n" , priv->reg_base, dev->irq);return 0 ; - exit_unmap: +exit_free: +free_cc770dev (dev); +exit_unmap:if (mem[idx])iounmap (base); - exit_release: +exit_release:if (mem[idx])release_mem_region (mem[idx], iosize);else release_region (port[idx], iosize); - exit: +exit:return err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 71/105 qlcnic: fix sleep-in-atomic-context bugs caused by msleep
In reply to Greg Kroah-HartmanFrom: Duoming Zhou <[email protected]>
[ Upstream commit 8dbd6e4ce1b9c527921643d9e34f188a10d4e893 ]
The watchdog timer is used to monitor whether the process of transmitting data is timeout. If we use qlcnic driver, the dev_watchdog() that is the timer handler of watchdog timer will call qlcnic_tx_timeout() to process the timeout. But the qlcnic_tx_timeout() calls msleep(), as a result, the sleep-in-atomic-context bugs will happen. The processes are shown below:
(atomic context)dev_watchdog
qlcnic_tx_timeout
qlcnic_83xx_idc_request_reset
qlcnic_83xx_lock_driver
msleep
---------------------------
(atomic context)dev_watchdog
qlcnic_tx_timeout
qlcnic_83xx_idc_request_reset
qlcnic_83xx_lock_driver
qlcnic_83xx_recover_driver_lock
msleep
Fix by changing msleep() to mdelay(), the mdelay() is busy-waiting and the bugs could be mitigated.
--- drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +2 -2
@@ -2993,7 +2993,7 @@ static void qlcnic_83xx_recover_driver_lock(struct qlcnic_adapter *adapter)QLCWRX (adapter->ahw,QLC_83XX_RECOVER_DRV_LOCK , val);dev_info (&adapter->pdev->dev,"%s: lock recovery initiated\n" , __func__); -msleep (QLC_83XX_DRV_LOCK_RECOVERY_DELAY ); +mdelay (QLC_83XX_DRV_LOCK_RECOVERY_DELAY ); val =QLCRDX (adapter->ahw,QLC_83XX_RECOVER_DRV_LOCK ); id = ((val >>2 ) &0xF );if (id == adapter->portnum) {
@@ -3029,7 +3029,7 @@ int qlcnic_83xx_lock_driver(struct qlcnic_adapter *adapter)if (status)break ; -msleep (QLC_83XX_DRV_LOCK_WAIT_DELAY ); +mdelay (QLC_83XX_DRV_LOCK_WAIT_DELAY ); i++;if (i ==1 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 72/105 net: phy: fix null-ptr-deref while probe() failed
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 369eb2c9f1f72adbe91e0ea8efb130f0a2ba11a6 ]
I got a null-ptr-deref report as following when doing fault injection test:
BUG: kernel NULL pointer dereference, address: 0000000000000058 Oops: 0000 [#1] PREEMPT SMP KASAN PTI CPU: 1 PID: 253 Comm: 507-spi-dm9051 Tainted: G B N 6.1.0-rc3+ Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 RIP: 0010:klist_put+0x2d/0xd0 Call Trace: <TASK> klist_remove+0xf1/0x1c0 device_release_driver_internal+0x23e/0x2d0 bus_remove_device+0x1bd/0x240 device_del+0x357/0x770 phy_device_remove+0x11/0x30 mdiobus_unregister+0xa5/0x140 release_nodes+0x6a/0xa0 devres_release_all+0xf8/0x150 device_unbind_cleanup+0x19/0xd0
//probe path:phy_device_register()
device_add()
phy_connect
phy_attach_direct() //set device driver
probe() //it's failed, driver is not bound device_bind_driver() // probe failed, it's not called
//remove path:phy_device_remove()
device_del()
device_release_driver_internal()
__device_release_driver() //dev->drv is not NULL
klist_remove() <- knode_driver is not added yet, cause null-ptr-deref
In phy_attach_direct(), after setting the 'dev->driver', probe() fails, device_bind_driver() is not called, so the knode_driver->n_klist is not set, then it causes null-ptr-deref in __device_release_driver() while deleting device. Fix this by setting dev->driver to NULL in the error path in phy_attach_direct().
--- drivers/net/phy/phy_device.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/phy/phy_device.c +1 -0
@@ -1083,6 +1083,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, error_module_put:module_put (d->driver->owner); + d->driver =NULL ; error_put_device:put_device (d);if (ndev_owner != bus->owner)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 73/105 net: net_netdev: Fix error handling in ntb_netdev_init_module()
In reply to Greg Kroah-HartmanFrom: Yuan Can <[email protected]>
[ Upstream commit b8f79dccd38edf7db4911c353d9cd792ab13a327 ]
The ntb_netdev_init_module() returns the ntb_transport_register_client() directly without checking its return value, if ntb_transport_register_client() failed, the NTB client device is not unregistered.
Fix by unregister NTB client device when ntb_transport_register_client() failed.
--- drivers/net/ntb_netdev.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ntb_netdev.c +8 -1
@@ -506,7 +506,14 @@ static int __init ntb_netdev_init_module(void) rc =ntb_transport_register_client_dev (KBUILD_MODNAME );if (rc)return rc; -return ntb_transport_register_client (&ntb_netdev_client); + + rc =ntb_transport_register_client (&ntb_netdev_client); +if (rc) { +ntb_transport_unregister_client_dev (KBUILD_MODNAME ); +return rc; + } + +return 0 ; }module_init (ntb_netdev_init_module);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 74/105 net/9p: Fix a potential socket leak in p9_socket_open
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit dcc14cfd7debe11b825cb077e75d91d2575b4cb8 ]
Both p9_fd_create_tcp() and p9_fd_create_unix() will call p9_socket_open(). If the creation of p9_trans_fd fails, p9_fd_create_tcp() and p9_fd_create_unix() will return an error directly instead of releasing the cscoket, which will result in a socket leak.
This patch adds sock_release() to fix the leak issue.
--- net/9p/trans_fd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/9p/trans_fd.c +3 -1
@@ -867,8 +867,10 @@ static int p9_socket_open(struct p9_client *client, struct socket *csocket)struct file *file; p =kzalloc (sizeof (struct p9_trans_fd ),GFP_KERNEL ); -if (!p) +if (!p) { +sock_release (csocket);return -ENOMEM ; + } csocket->sk->sk_allocation =GFP_NOIO ; file =sock_alloc_file (csocket,0 ,NULL );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 75/105 dsa: lan9303: Correct stat name
In reply to Greg Kroah-HartmanFrom: Jerry Ray <[email protected]>
[ Upstream commit 39f59bca275d2d819a8788c0f962e9e89843efc9 ]
This patch changes the reported ethtool statistics for the lan9303 family of parts covered by this driver.
The TxUnderRun statistic label is renamed to RxShort to accurately reflect what stat the device is reporting. I did not reorder the statistics as that might cause problems with existing user code that are expecting the stats at a certain offset.
--- drivers/net/dsa/lan9303-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/lan9303-core.c +1 -1
@@ -966,7 +966,7 @@ static const struct lan9303_mib_desc lan9303_mib[] = { { .offset = LAN9303_MAC_TX_BRDCST_CNT_0, .name = "TxBroad", }, { .offset = LAN9303_MAC_TX_PAUSE_CNT_0, .name = "TxPause", }, { .offset = LAN9303_MAC_TX_MULCST_CNT_0, .name = "TxMulti", }, - { .offset = LAN9303_MAC_RX_UNDSZE_CNT_0, .name = "TxUnderRun", }, + { .offset = LAN9303_MAC_RX_UNDSZE_CNT_0, .name = "RxShort", }, { .offset = LAN9303_MAC_TX_64_CNT_0, .name = "Tx64Byte", }, { .offset = LAN9303_MAC_TX_127_CNT_0, .name = "Tx128Byte", }, { .offset = LAN9303_MAC_TX_255_CNT_0, .name = "Tx256Byte", },
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 76/105 net: hsr: Fix potential use-after-free
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 7e177d32442b7ed08a9fa61b61724abc548cb248 ]
The skb is delivered to netif_rx() which may free it, after calling this, dereferencing skb may trigger use-after-free.
--- net/hsr/hsr_forward.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/hsr/hsr_forward.c +3 -2
@@ -207,17 +207,18 @@ static void hsr_deliver_master(struct sk_buff *skb, struct net_device *dev, struct hsr_node *node_src) {bool was_multicast_frame; -int res; +int res, recv_len; was_multicast_frame = (skb->pkt_type ==PACKET_MULTICAST );hsr_addr_subst_source (node_src, skb);skb_pull (skb,ETH_HLEN ); + recv_len = skb->len; res =netif_rx (skb);if (res ==NET_RX_DROP ) { dev->stats.rx_dropped++; }else { dev->stats.rx_packets++; - dev->stats.rx_bytes += skb->len; + dev->stats.rx_bytes += recv_len;if (was_multicast_frame) dev->stats.multicast++; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 77/105 net: tun: Fix use-after-free in tun_detach()
In reply to Greg Kroah-HartmanFrom: Shigeru Yoshida <[email protected]>
[ Upstream commit 5daadc86f27ea4d691e2131c04310d0418c6cd12 ]
syzbot reported use-after-free in tun_detach() [1]. This causes call trace like below:
==================================================================
BUG: KASAN: use-after-free in notifier_call_chain+0x1ee/0x200 kernel/notifier.c:75 Read of size 8 at addr ffff88807324e2a8 by task syz-executor.0/3673 CPU: 0 PID: 3673 Comm: syz-executor.0 Not tainted 6.1.0-rc5-syzkaller-00044-gcc675d22e422 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15e/0x461 mm/kasan/report.c:395 kasan_report+0xbf/0x1f0 mm/kasan/report.c:495 notifier_call_chain+0x1ee/0x200 kernel/notifier.c:75 call_netdevice_notifiers_info+0x86/0x130 net/core/dev.c:1942 call_netdevice_notifiers_extack net/core/dev.c:1983 [inline] call_netdevice_notifiers net/core/dev.c:1997 [inline] netdev_wait_allrefs_any net/core/dev.c:10237 [inline] netdev_run_todo+0xbc6/0x1100 net/core/dev.c:10351 tun_detach drivers/net/tun.c:704 [inline] tun_chr_close+0xe4/0x190 drivers/net/tun.c:3467 __fput+0x27c/0xa90 fs/file_table.c:320 task_work_run+0x16f/0x270 kernel/task_work.c:179 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xb3d/0x2a30 kernel/exit.c:820 do_group_exit+0xd4/0x2a0 kernel/exit.c:950 get_signal+0x21b1/0x2440 kernel/signal.c:2858 arch_do_signal_or_restart+0x86/0x2300 arch/x86/kernel/signal.c:869 exit_to_user_mode_loop kernel/entry/common.c:168 [inline] exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:296 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd
The cause of the issue is that sock_put() from __tun_detach() drops last reference count for struct net, and then notifier_call_chain() from netdev_state_change() accesses that struct net.
This patch fixes the issue by calling sock_put() from tun_detach() after all necessary accesses for the struct net has done.
--- drivers/net/tun.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/tun.c +3 -1
@@ -756,7 +756,6 @@ static void __tun_detach(struct tun_file *tfile, bool clean)if (tun)xdp_rxq_info_unreg (&tfile->xdp_rxq);ptr_ring_cleanup (&tfile->tx_ring, tun_ptr_free); -sock_put (&tfile->sk); } }
@@ -772,6 +771,9 @@ static void tun_detach(struct tun_file *tfile, bool clean)if (dev)netdev_state_change (dev);rtnl_unlock (); + +if (clean) +sock_put (&tfile->sk); }static void tun_detach_all (struct net_device *dev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 78/105 packet: do not set TP_STATUS_CSUM_VALID on CHECKSUM_COMPLETE
In reply to Greg Kroah-HartmanFrom: Willem de Bruijn <[email protected]>
[ Upstream commit b85f628aa158a653c006e9c1405a117baef8c868 ]
CHECKSUM_COMPLETE signals that skb->csum stores the sum over the entire packet. It does not imply that an embedded l4 checksum field has been validated.
--- net/packet/af_packet.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
net/packet/af_packet.c +2 -4
@@ -2209,8 +2209,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,if (skb->ip_summed ==CHECKSUM_PARTIAL ) status |=TP_STATUS_CSUMNOTREADY ;else if (skb->pkt_type !=PACKET_OUTGOING && - (skb->ip_summed ==CHECKSUM_COMPLETE || -skb_csum_unnecessary (skb))) +skb_csum_unnecessary (skb)) status |=TP_STATUS_CSUM_VALID ;if (snaplen > res)
@@ -3452,8 +3451,7 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,if (skb->ip_summed ==CHECKSUM_PARTIAL ) aux.tp_status |=TP_STATUS_CSUMNOTREADY ;else if (skb->pkt_type !=PACKET_OUTGOING && - (skb->ip_summed ==CHECKSUM_COMPLETE || -skb_csum_unnecessary (skb))) +skb_csum_unnecessary (skb)) aux.tp_status |=TP_STATUS_CSUM_VALID ; aux.tp_len = origlen;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 79/105 net: ethernet: renesas: ravb: Fix promiscuous mode after system resumed
In reply to Greg Kroah-HartmanFrom: Yoshihiro Shimoda <[email protected]>
[ Upstream commit d66233a312ec9013af3e37e4030b479a20811ec3 ]
After system resumed on some environment board, the promiscuous mode is disabled because the SoC turned off. So, call ravb_set_rx_mode() in the ravb_resume() to fix the issue.
--- drivers/net/ethernet/renesas/ravb_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/renesas/ravb_main.c +1 -0
@@ -2310,6 +2310,7 @@ static int __maybe_unused ravb_resume(struct device *dev) ret =ravb_open (ndev);if (ret <0 )return ret; +ravb_set_rx_mode (ndev);netif_device_attach (ndev); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 80/105 hwmon: (coretemp) Check for null before removing sysfs attrs
In reply to Greg Kroah-HartmanFrom: Phil Auld <[email protected]>
[ Upstream commit a89ff5f5cc64b9fe7a992cf56988fd36f56ca82a ]
If coretemp_add_core() gets an error then pdata->core_data[indx] is already NULL and has been kfreed. Don't pass that to sysfs_remove_group() as that will crash in sysfs_remove_group().
[Shortened for readability]
[91854.020159] sysfs: cannot create duplicate filename '/devices/platform/coretemp.0/hwmon/hwmon2/temp20_label' <cpu offline> [91855.126115] BUG: kernel NULL pointer dereference, address: 0000000000000188 [91855.165103] #PF: supervisor read access in kernel mode [91855.194506] #PF: error_code(0x0000) - not-present page [91855.224445] PGD 0 P4D 0 [91855.238508] Oops: 0000 [#1] PREEMPT SMP PTI ... [91855.342716] RIP: 0010:sysfs_remove_group+0xc/0x80 ... [91855.796571] Call Trace: [91855.810524] coretemp_cpu_offline+0x12b/0x1dd [coretemp] [91855.841738] ? coretemp_cpu_online+0x180/0x180 [coretemp] [91855.871107] cpuhp_invoke_callback+0x105/0x4b0 [91855.893432] cpuhp_thread_fun+0x8e/0x150
...
Fix this by checking for NULL first.
--- drivers/hwmon/coretemp.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/hwmon/coretemp.c +4 -0
@@ -546,6 +546,10 @@ static void coretemp_remove_core(struct platform_data *pdata, int indx) {struct temp_data *tdata = pdata->core_data[indx]; +/* if we errored on add then this is already gone */ +if (!tdata) +return ; +/* Remove the sysfs attributes */ sysfs_remove_group (&pdata->hwmon_dev->kobj, &tdata->attr_group);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 81/105 hwmon: (coretemp) fix pci device refcount leak in nv1a_ram_new()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 7dec14537c5906b8bf40fd6fd6d9c3850f8df11d ]
As comment of pci_get_domain_bus_and_slot() says, it returns a pci device with refcount increment, when finish using it, the caller must decrement the reference count by calling pci_dev_put(). So call it after using to avoid refcount leak.
--- drivers/hwmon/coretemp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/hwmon/coretemp.c +4 -1
@@ -255,10 +255,13 @@ static int adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)*/ if (host_bridge && host_bridge->vendor ==PCI_VENDOR_ID_INTEL ) {for (i =0 ; i <ARRAY_SIZE (tjmax_pci_table); i++) { -if (host_bridge->device == tjmax_pci_table[i].device) +if (host_bridge->device == tjmax_pci_table[i].device) { +pci_dev_put (host_bridge);return tjmax_pci_table[i].tjmax; + } } } +pci_dev_put (host_bridge);for (i =0 ; i <ARRAY_SIZE (tjmax_table); i++) {if (strstr (c->x86_model_id, tjmax_table[i].id))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 82/105 btrfs: qgroup: fix sleep from invalid context bug in btrfs_qgroup_inherit()
In reply to Greg Kroah-HartmanFrom: ChenXiaoSong <[email protected]>
[ Upstream commit f7e942b5bb35d8e3af54053d19a6bf04143a3955 ]
Syzkaller reported BUG as follows:
BUG: sleeping function called from invalid context at
include/linux/sched/mm.h:274
Call Trace:
<TASK>
dump_stack_lvl+0xcd/0x134
__might_resched.cold+0x222/0x26b
kmem_cache_alloc+0x2e7/0x3c0
update_qgroup_limit_item+0xe1/0x390
btrfs_qgroup_inherit+0x147b/0x1ee0
create_subvol+0x4eb/0x1710
btrfs_mksubvol+0xfe5/0x13f0
__btrfs_ioctl_snap_create+0x2b0/0x430
btrfs_ioctl_snap_create_v2+0x25a/0x520
btrfs_ioctl+0x2a1c/0x5ce0
__x64_sys_ioctl+0x193/0x200
do_syscall_64+0x35/0x80Fix this by calling qgroup_dirty() on @dstqgroup, and update limit item in btrfs_run_qgroups() later outside of the spinlock context.
--- fs/btrfs/qgroup.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
fs/btrfs/qgroup.c +1 -8
@@ -2368,14 +2368,7 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid, dstgroup->rsv_rfer = inherit->lim.rsv_rfer; dstgroup->rsv_excl = inherit->lim.rsv_excl; - ret =update_qgroup_limit_item (trans, dstgroup); -if (ret) { - fs_info->qgroup_flags |=BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT ; -btrfs_info (fs_info, -"unable to update quota limit for %llu" , - dstgroup->qgroupid); - goto unlock; - } +qgroup_dirty (fs_info, dstgroup); }if (srcid) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 83/105 error-injection: Add prompt for function error injection
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (Google) <[email protected]>
commit a4412fdd49dc011bcc2c0d81ac4cab7457092650 upstream.
The config to be able to inject error codes into any function annotated with ALLOW_ERROR_INJECTION() is enabled when FUNCTION_ERROR_INJECTION is enabled. But unfortunately, this is always enabled on x86 when KPROBES is enabled, and there's no way to turn it off.
As kprobes is useful for observability of the kernel, it is useful to have it enabled in production environments. But error injection should be avoided. Add a prompt to the config to allow it to be disabled even when kprobes is enabled, and get rid of the "def_bool y".
This is a kernel debug feature (it's in Kconfig.debug), and should have never been something enabled by default.
--- lib/Kconfig.debug | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
lib/Kconfig.debug +7 -1
@@ -1510,8 +1510,14 @@ config NETDEV_NOTIFIER_ERROR_INJECT If unsure, say N. config FUNCTION_ERROR_INJECTION - def_bool y + bool "Fault-injections of functions" depends on HAVE_FUNCTION_ERROR_INJECTION && KPROBES + help + Add fault injections into various functions that are annotated with + ALLOW_ERROR_INJECTION() in the kernel. BPF may also modify the return + value of theses functions. This is useful to test error paths of code. + + If unsure, say N config FAULT_INJECTION bool "Fault-injection framework"
Greg Kroah-Hartman
maintainerPATCH 84/105 tools/vm/slabinfo-gnuplot: use "grep -E" instead of "egrep"
In reply to Greg Kroah-HartmanFrom: Tiezhu Yang <[email protected]>
commit a435874bf626f55d7147026b059008c8de89fbb8 upstream.
The latest version of grep claims the egrep is now obsolete so the build now contains warnings that look like:
egrep: warning: egrep is obsolescent; using grep -E
fix this up by moving the related file to use "grep -E" instead.
sed -i "s/egrep/grep -E/g" grep egrep -rwl tools/vm
Here are the steps to install the latest grep:
wget http://ftp.gnu.org/gnu/grep/grep-3.8.tar.gz tar xf grep-3.8.tar.gz cd grep-3.8 && ./configure && make sudo make install export PATH=/usr/local/bin:$PATH
--- tools/vm/slabinfo-gnuplot.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/vm/slabinfo-gnuplot.sh +2 -2
@@ -157,7 +157,7 @@ do_preprocess() let lines=3 out=`basename "$in"`"-slabs-by-loss" `cat "$in" | grep -A "$lines" 'Slabs sorted by loss' |\ - egrep -iv '\-\-|Name|Slabs'\ + grep -E -iv '\-\-|Name|Slabs'\ | awk '{print $1" "$4+$2*$3" "$4}' > "$out"` if [ $? -eq 0 ]; then do_slabs_plotting "$out"
@@ -166,7 +166,7 @@ do_preprocess() let lines=3 out=`basename "$in"`"-slabs-by-size" `cat "$in" | grep -A "$lines" 'Slabs sorted by size' |\ - egrep -iv '\-\-|Name|Slabs'\ + grep -E -iv '\-\-|Name|Slabs'\ | awk '{print $1" "$4" "$4-$2*$3}' > "$out"` if [ $? -eq 0 ]; then do_slabs_plotting "$out"
Greg Kroah-Hartman
maintainerPATCH 85/105 nilfs2: fix NULL pointer dereference in nilfs_palloc_commit_free_entry()
In reply to Greg Kroah-HartmanFrom: ZhangPeng <[email protected]>
commit f0a0ccda18d6fd826d7c7e7ad48a6ed61c20f8b4 upstream.
Syzbot reported a null-ptr-deref bug:
NILFS (loop0): segctord starting. Construction interval = 5 seconds, CP frequency < 30 seconds
general protection fault, probably for non-canonical address 0xdffffc0000000002: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017] CPU: 1 PID: 3603 Comm: segctord Not tainted 6.1.0-rc2-syzkaller-00105-gb229b6ca5abb #0 Hardware name: Google Compute Engine/Google Compute Engine, BIOS Google 10/11/2022 RIP: 0010:nilfs_palloc_commit_free_entry+0xe5/0x6b0 fs/nilfs2/alloc.c:608 Code: 00 00 00 00 fc ff df 80 3c 02 00 0f 85 cd 05 00 00 48 b8 00 00 00 00 00 fc ff df 4c 8b 73 08 49 8d 7e 10 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 26 05 00 00 49 8b 46 10 be a6 00 00 00 48 c7 c7 RSP: 0018:ffffc90003dff830 EFLAGS: 00010212 RAX: dffffc0000000000 RBX: ffff88802594e218 RCX: 000000000000000d RDX: 0000000000000002 RSI: 0000000000002000 RDI: 0000000000000010 RBP: ffff888071880222 R08: 0000000000000005 R09: 000000000000003f R10: 000000000000000d R11: 0000000000000000 R12: ffff888071880158 R13: ffff88802594e220 R14: 0000000000000000 R15: 0000000000000004 FS: 0000000000000000(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fb1c08316a8 CR3: 0000000018560000 CR4: 0000000000350ee0 Call Trace: <TASK> nilfs_dat_commit_free fs/nilfs2/dat.c:114 [inline] nilfs_dat_commit_end+0x464/0x5f0 fs/nilfs2/dat.c:193 nilfs_dat_commit_update+0x26/0x40 fs/nilfs2/dat.c:236 nilfs_btree_commit_update_v+0x87/0x4a0 fs/nilfs2/btree.c:1940 nilfs_btree_commit_propagate_v fs/nilfs2/btree.c:2016 [inline] nilfs_btree_propagate_v fs/nilfs2/btree.c:2046 [inline] nilfs_btree_propagate+0xa00/0xd60 fs/nilfs2/btree.c:2088 nilfs_bmap_propagate+0x73/0x170 fs/nilfs2/bmap.c:337 nilfs_collect_file_data+0x45/0xd0 fs/nilfs2/segment.c:568 nilfs_segctor_apply_buffers+0x14a/0x470 fs/nilfs2/segment.c:1018 nilfs_segctor_scan_file+0x3f4/0x6f0 fs/nilfs2/segment.c:1067 nilfs_segctor_collect_blocks fs/nilfs2/segment.c:1197 [inline] nilfs_segctor_collect fs/nilfs2/segment.c:1503 [inline] nilfs_segctor_do_construct+0x12fc/0x6af0 fs/nilfs2/segment.c:2045 nilfs_segctor_construct+0x8e3/0xb30 fs/nilfs2/segment.c:2379 nilfs_segctor_thread_construct fs/nilfs2/segment.c:2487 [inline] nilfs_segctor_thread+0x3c3/0xf30 fs/nilfs2/segment.c:2570 kthread+0x2e4/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 </TASK> ...
If DAT metadata file is corrupted on disk, there is a case where req->pr_desc_bh is NULL and blocknr is 0 at nilfs_dat_commit_end() during a b-tree operation that cascadingly updates ancestor nodes of the b-tree, because nilfs_dat_commit_alloc() for a lower level block can initialize the blocknr on the same DAT entry between nilfs_dat_prepare_end() and nilfs_dat_commit_end().
If this happens, nilfs_dat_commit_end() calls nilfs_dat_commit_free() without valid buffer heads in req->pr_desc_bh and req->pr_bitmap_bh, and causes the NULL pointer dereference above in nilfs_palloc_commit_free_entry() function, which leads to a crash.
Fix this by adding a NULL check on req->pr_desc_bh and req->pr_bitmap_bh before nilfs_palloc_commit_free_entry() in nilfs_dat_commit_free().
This also calls nilfs_error() in that case to notify that there is a fatal flaw in the filesystem metadata and prevent further operations.
--- fs/nilfs2/dat.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/nilfs2/dat.c +7 -0
@@ -111,6 +111,13 @@ static void nilfs_dat_commit_free(structkunmap_atomic (kaddr);nilfs_dat_commit_entry (dat, req); + +if (unlikely (req->pr_desc_bh ==NULL || req->pr_bitmap_bh ==NULL )) { +nilfs_error (dat->i_sb, +"state inconsistency probably due to duplicate use of vblocknr = %llu" , + (unsigned long long )req->pr_entry_nr); +return ; + }nilfs_palloc_commit_free_entry (dat, req); }
Greg Kroah-Hartman
maintainerPATCH 86/105 x86/bugs: Make sure MSR_SPEC_CTRL is updated properly upon resume from S3
In reply to Greg Kroah-HartmanFrom: Pawan Gupta <[email protected]>
commit 66065157420c5b9b3f078f43d313c153e1ff7f83 upstream.
The "force" argument to write_spec_ctrl_current() is currently ambiguous as it does not guarantee the MSR write. This is due to the optimization that writes to the MSR happen only when the new value differs from the cached value.
This is fine in most cases, but breaks for S3 resume when the cached MSR value gets out of sync with the hardware MSR value due to S3 resetting it.
When x86_spec_ctrl_current is same as x86_spec_ctrl_base, the MSR write is skipped. Which results in SPEC_CTRL mitigations not getting restored.
Move the MSR write from write_spec_ctrl_current() to a new function that unconditionally writes to the MSR. Update the callers accordingly and rename functions.
[ bp: Rework a bit. ]
--- arch/x86/include/asm/nospec-branch.h | 2 +- arch/x86/kernel/cpu/bugs.c | 21 ++++++++++++++------- arch/x86/kernel/process.c | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-)
arch/x86/include/asm/nospec-branch.h +1 -1
@@ -317,7 +317,7 @@ static inline void indirect_branch_predi/* The Intel SPEC CTRL MSR base value cache */ extern u64 x86_spec_ctrl_base;DECLARE_PER_CPU (u64, x86_spec_ctrl_current); -extern void write_spec_ctrl_current (u64 val,bool force); +extern void update_spec_ctrl_cond (u64 val);extern u64 spec_ctrl_current (void );/*
arch/x86/kernel/cpu/bugs.c +14 -7
@@ -58,11 +58,18 @@ EXPORT_SYMBOL_GPL(x86_spec_ctrl_current)static DEFINE_MUTEX (spec_ctrl_mutex); +/* Update SPEC_CTRL MSR and its cached copy unconditionally */ +static void update_spec_ctrl (u64 val) +{ +this_cpu_write (x86_spec_ctrl_current, val); +wrmsrl (MSR_IA32_SPEC_CTRL , val); +} +/* * Keep track of the SPEC_CTRL MSR value for the current task, which may differ * from x86_spec_ctrl_base due to STIBP/SSB in __speculation_ctrl_update(). */ -void write_spec_ctrl_current (u64 val,bool force) +void update_spec_ctrl_cond (u64 val) {if (this_cpu_read (x86_spec_ctrl_current) == val)return ;
@@ -73,7 +80,7 @@ void write_spec_ctrl_current(u64 val, bo* When KERNEL_IBRS this MSR is written on return-to-user, unless * forced the update can be delayed until that time. */ -if (force || !cpu_feature_enabled (X86_FEATURE_KERNEL_IBRS )) +if (!cpu_feature_enabled (X86_FEATURE_KERNEL_IBRS ))wrmsrl (MSR_IA32_SPEC_CTRL , val); }
@@ -1194,7 +1201,7 @@ static void __init spec_ctrl_disable_kerif (ia32_cap &ARCH_CAP_RRSBA ) { x86_spec_ctrl_base |=SPEC_CTRL_RRSBA_DIS_S ; -write_spec_ctrl_current (x86_spec_ctrl_base, true); +update_spec_ctrl (x86_spec_ctrl_base); } }
@@ -1316,7 +1323,7 @@ static void __init spectre_v2_select_mitif (spectre_v2_in_ibrs_mode (mode)) { x86_spec_ctrl_base |=SPEC_CTRL_IBRS ; -write_spec_ctrl_current (x86_spec_ctrl_base, true); +update_spec_ctrl (x86_spec_ctrl_base); }switch (mode) {
@@ -1420,7 +1427,7 @@ static void __init spectre_v2_select_mitstatic void update_stibp_msr (void * __unused) {u64 val =spec_ctrl_current () | (x86_spec_ctrl_base &SPEC_CTRL_STIBP ); -write_spec_ctrl_current (val, true); +update_spec_ctrl (val); }/* Update x86_spec_ctrl_base in case SMT state changed. */
@@ -1653,7 +1660,7 @@ static enum ssb_mitigation __init __ssb_x86_amd_ssb_disable (); }else { x86_spec_ctrl_base |=SPEC_CTRL_SSBD ; -write_spec_ctrl_current (x86_spec_ctrl_base, true); +update_spec_ctrl (x86_spec_ctrl_base); } }
@@ -1858,7 +1865,7 @@ int arch_prctl_spec_ctrl_get(struct taskvoid x86_spec_ctrl_setup_ap (void ) {if (boot_cpu_has (X86_FEATURE_MSR_SPEC_CTRL )) -write_spec_ctrl_current (x86_spec_ctrl_base, true); +update_spec_ctrl (x86_spec_ctrl_base);if (ssb_mode ==SPEC_STORE_BYPASS_DISABLE )x86_amd_ssb_disable ();
arch/x86/kernel/process.c +1 -1
@@ -434,7 +434,7 @@ static __always_inline void __speculatio }if (updmsr) -write_spec_ctrl_current (msr, false); +update_spec_ctrl_cond (msr); }static unsigned long speculation_ctrl_update_tif (struct task_struct *tsk)
Greg Kroah-Hartman
maintainerPATCH 87/105 pinctrl: intel: Save and restore pins in "direct IRQ" mode
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
commit 6989ea4881c8944fbf04378418bb1af63d875ef8 upstream.
The firmware on some systems may configure GPIO pins to be an interrupt source in so called "direct IRQ" mode. In such cases the GPIO controller driver has no idea if those pins are being used or not. At the same time, there is a known bug in the firmwares that don't restore the pin settings correctly after suspend, i.e. by an unknown reason the Rx value becomes inverted.
Hence, let's save and restore the pins that are configured as GPIOs in the input mode with GPIROUTIOXAPIC bit set.
--- drivers/pinctrl/intel/pinctrl-intel.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/pinctrl/intel/pinctrl-intel.c +26 -1
@@ -423,9 +423,14 @@ static void __intel_gpio_set_direction(vwritel (value, padcfg0); } +static int __intel_gpio_get_gpio_mode (u32 value) +{ +return (value &PADCFG0_PMODE_MASK ) >>PADCFG0_PMODE_SHIFT ; +} +static int intel_gpio_get_gpio_mode (void __iomem *padcfg0) { -return (readl (padcfg0) &PADCFG0_PMODE_MASK ) >>PADCFG0_PMODE_SHIFT ; +return __intel_gpio_get_gpio_mode (readl (padcfg0)); }static void intel_gpio_set_gpio_mode (void __iomem *padcfg0)
@@ -1429,6 +1434,7 @@ EXPORT_SYMBOL_GPL(intel_pinctrl_probe);static bool intel_pinctrl_should_save (struct intel_pinctrl *pctrl,unsigned pin) {const struct pin_desc *pd =pin_desc_get (pctrl->pctldev, pin); +u32 value;if (!pd || !intel_pad_usable (pctrl, pin))return false;
@@ -1443,6 +1449,25 @@ static bool intel_pinctrl_should_save(st gpiochip_line_is_irq(&pctrl->chip, pin))return true; +/* +* The firmware on some systems may configure GPIO pins to be +* an interrupt source in so called "direct IRQ" mode. In such +* cases the GPIO controller driver has no idea if those pins +* are being used or not. At the same time, there is a known bug +* in the firmwares that don't restore the pin settings correctly +* after suspend, i.e. by an unknown reason the Rx value becomes +* inverted. +* +* Hence, let's save and restore the pins that are configured +* as GPIOs in the input mode with GPIROUTIOXAPIC bit set. +* +* See https://bugzilla.kernel.org/show_bug.cgi?id=214749. +*/ + value =readl (intel_get_padcfg (pctrl, pin,PADCFG0 )); +if ((value &PADCFG0_GPIROUTIOXAPIC ) && (value &PADCFG0_GPIOTXDIS ) && + (__intel_gpio_get_gpio_mode (value) ==PADCFG0_PMODE_GPIO )) +return true; +return false; }
Greg Kroah-Hartman
maintainerPATCH 88/105 arm64: Fix panic() when Spectre-v2 causes Spectre-BHB to re-allocate KVM vectors
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
Sami reports that linux panic()s when resuming from suspend to RAM. This is because when CPUs are brought back online, they re-enable any necessary mitigations.
The Spectre-v2 and Spectre-BHB mitigations interact as both need to done by KVM when exiting a guest. Slots KVM can use as vectors are allocated, and templates for the mitigation are patched into the vector.
This fails if a new slot needs to be allocated once the kernel has finished booting as it is no-longer possible to modify KVM's vectors:
| root@adam:/sys/devices/system/cpu/cpu1# echo 1 > online | Unable to handle kernel write to read-only memory at virtual add> | Mem abort info: | ESR = 0x9600004e | Exception class = DABT (current EL), IL = 32 bits | SET = 0, FnV = 0 | EA = 0, S1PTW = 0 | Data abort info: | ISV = 0, ISS = 0x0000004e | CM = 0, WnR = 1 | swapper pgtable: 4k pages, 48-bit VAs, pgdp = 000000000f07a71c | [ffff800000b4b800] pgd=00000009ffff8803, pud=00000009ffff7803, p> | Internal error: Oops: 9600004e [#1] PREEMPT SMP | Modules linked in: | Process swapper/1 (pid: 0, stack limit = 0x0000000063153c53) | CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.19.252-dirty #14 | Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno De> | pstate: 000001c5 (nzcv dAIF -PAN -UAO) | pc : __memcpy+0x48/0x180 | lr : __copy_hyp_vect_bpi+0x64/0x90
| Call trace: | __memcpy+0x48/0x180 | kvm_setup_bhb_slot+0x204/0x2a8 | spectre_bhb_enable_mitigation+0x1b8/0x1d0 | __verify_local_cpu_caps+0x54/0xf0 | check_local_cpu_capabilities+0xc4/0x184 | secondary_start_kernel+0xb0/0x170 | Code: b8404423 b80044c3 36180064 f8408423 (f80084c3) | ---[ end trace 859bcacb09555348 ]--- | Kernel panic - not syncing: Attempted to kill the idle task! | SMP: stopping secondary CPUs | Kernel Offset: disabled | CPU features: 0x10,25806086 | Memory Limit: none | ---[ end Kernel panic - not syncing: Attempted to kill the idle ]
This is only a problem on platforms where there is only one CPU that is vulnerable to both Spectre-v2 and Spectre-BHB.
The Spectre-v2 mitigation identifies the slot it can re-use by the CPU's 'fn'. It unconditionally writes the slot number and 'template_start' pointer. The Spectre-BHB mitigation identifies slots it can re-use by the CPU's template_start pointer, which was previously clobbered by the Spectre-v2 mitigation.
When there is only one CPU that is vulnerable to both issues, this causes Spectre-v2 to try to allocate a new slot, which fails.
Change both mitigations to check whether they are changing the slot this CPU uses before writing the percpu variables again.
This issue only exists in the stable backports for Spectre-BHB which have to use totally different infrastructure to mainline.
--- arch/arm64/kernel/cpu_errata.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
arch/arm64/kernel/cpu_errata.c +11 -5
@@ -142,9 +142,12 @@ static void install_bp_hardening_cb(bp_h __copy_hyp_vect_bpi(slot, hyp_vecs_start, hyp_vecs_end); } -__this_cpu_write (bp_hardening_data.hyp_vectors_slot, slot); -__this_cpu_write (bp_hardening_data.fn, fn); -__this_cpu_write (bp_hardening_data.template_start, hyp_vecs_start); +if (fn !=__this_cpu_read (bp_hardening_data.fn)) { +__this_cpu_write (bp_hardening_data.hyp_vectors_slot, slot); +__this_cpu_write (bp_hardening_data.fn, fn); +__this_cpu_write (bp_hardening_data.template_start, + hyp_vecs_start); + }spin_unlock (&bp_lock); }#else
@@ -1203,8 +1206,11 @@ static void kvm_setup_bhb_slot(const cha __copy_hyp_vect_bpi(slot, hyp_vecs_start, hyp_vecs_end); } -__this_cpu_write (bp_hardening_data.hyp_vectors_slot, slot); -__this_cpu_write (bp_hardening_data.template_start, hyp_vecs_start); +if (hyp_vecs_start !=__this_cpu_read (bp_hardening_data.template_start)) { +__this_cpu_write (bp_hardening_data.hyp_vectors_slot, slot); +__this_cpu_write (bp_hardening_data.template_start, + hyp_vecs_start); + }spin_unlock (&bp_lock); }#else
Greg Kroah-Hartman
maintainerPATCH 89/105 arm64: errata: Fix KVM Spectre-v2 mitigation selection for Cortex-A57/A72
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
Both the Spectre-v2 and Spectre-BHB mitigations involve running a sequence immediately after exiting a guest, before any branches. In the stable kernels these sequences are built by copying templates into an empty vector slot.
For Spectre-BHB, Cortex-A57 and A72 require the branchy loop with k=8. If Spectre-v2 needs mitigating at the same time, a firmware call to EL3 is needed. The work EL3 does at this point is also enough to mitigate Spectre-BHB.
When enabling the Spectre-BHB mitigation, spectre_bhb_enable_mitigation() should check if a slot has already been allocated for Spectre-v2, meaning no work is needed for Spectre-BHB.
This check was missed in the earlier backport, add it.
--- arch/arm64/kernel/cpu_errata.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/arm64/kernel/cpu_errata.c +7 -1
@@ -1246,7 +1246,13 @@ void spectre_bhb_enable_mitigation(const }else if (spectre_bhb_loop_affected (SCOPE_LOCAL_CPU )) {switch (spectre_bhb_loop_affected (SCOPE_SYSTEM )) {case 8 : -kvm_setup_bhb_slot (__spectre_bhb_loop_k8_start); +/* +* A57/A72-r0 will already have selected the +* spectre-indirect vector, which is sufficient +* for BHB too. +*/ +if (!__this_cpu_read (bp_hardening_data.fn)) +kvm_setup_bhb_slot (__spectre_bhb_loop_k8_start);break ;case 24 :kvm_setup_bhb_slot (__spectre_bhb_loop_k24_start);
Greg Kroah-Hartman
maintainerPATCH 90/105 mm: Fix .data.once orphan section warning
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
Portions of upstream commit a4055888629b ("mm/memcg: warning on !memcg after readahead page charged") were backported as commit cfe575954ddd ("mm: add VM_WARN_ON_ONCE_PAGE() macro"). Unfortunately, the backport did not account for the lack of commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo) to __section("foo")") in kernels prior to 5.10, resulting in the following orphan section warnings on PowerPC clang builds with CONFIG_DEBUG_VM=y:
powerpc64le-linux-gnu-ld: warning: orphan section ".data.once"' from mm/huge_memory.o' being placed in section `".data.once"'
powerpc64le-linux-gnu-ld: warning: orphan section ".data.once"' from mm/huge_memory.o' being placed in section `".data.once"'
powerpc64le-linux-gnu-ld: warning: orphan section ".data.once"' from mm/huge_memory.o' being placed in section `".data.once"'
This is a difference between how clang and gcc handle macro stringification, which was resolved for the kernel by not stringifying the argument to the __section() macro. Since that change was deemed not suitable for the stable kernels by commit 59f89518f510 ("once: fix section mismatch on clang builds"), do that same thing as that change and remove the quotes from the argument to __section().
--- include/linux/mmdebug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mmdebug.h +1 -1
@@ -38,7 +38,7 @@ void dump_mm(const struct mm_struct *mm) } \ } while (0)#define VM_WARN_ON_ONCE_PAGE (cond, page) ({ \ - static bool __section(".data.once") __warned; \ + static bool __section(.data.once) __warned; \ int __ret_warn_once = !!(cond); \ \ if (unlikely(__ret_warn_once && !__warned)) { \
Greg Kroah-Hartman
maintainerPATCH 91/105 ASoC: ops: Fix bounds check for _sx controls
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 698813ba8c580efb356ace8dbf55f61dac6063a8 ]
For _sx controls the semantics of the max field is not the usual one, max is the number of steps rather than the maximum value. This means that our check in snd_soc_put_volsw_sx() needs to just check against the maximum value.
--- sound/soc/soc-ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-ops.c +1 -1
@@ -445,7 +445,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, val = ucontrol->value.integer.value[0 ];if (mc->platform_max && val > mc->platform_max)return -EINVAL ; -if (val > max - min) +if (val > max)return -EINVAL ;if (val <0 )return -EINVAL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 92/105 pinctrl: single: Fix potential division by zero
In reply to Greg Kroah-HartmanFrom: Maxim Korotkov <[email protected]>
[ Upstream commit 64c150339e7f6c5cbbe8c17a56ef2b3902612798 ]
There is a possibility of dividing by zero due to the pcs->bits_per_pin if pcs->fmask() also has a value of zero and called fls
from asm-generic/bitops/builtin-fls.h or arch/x86/include/asm/bitops.h. The function pcs_probe() has the branch that assigned to fmask 0 before pcs_allocate_pin_table() was called
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/pinctrl/pinctrl-single.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-single.c +1 -1
@@ -703,7 +703,7 @@ static int pcs_allocate_pin_table(struct pcs_device *pcs) mux_bytes = pcs->width /BITS_PER_BYTE ; -if (pcs->bits_per_mux) { +if (pcs->bits_per_mux && pcs->fmask) { pcs->bits_per_pin =fls (pcs->fmask); nr_pins = (pcs->size *BITS_PER_BYTE ) / pcs->bits_per_pin; num_pins_in_register = pcs->width / pcs->bits_per_pin;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 93/105 iommu/vt-d: Fix PCI device refcount leak in dmar_dev_scope_init()
In reply to Greg Kroah-HartmanFrom: Xiongfeng Wang <[email protected]>
[ Upstream commit 4bedbbd782ebbe7287231fea862c158d4f08a9e3 ]
for_each_pci_dev() is implemented by pci_get_device(). The comment of pci_get_device() says that it will increase the reference count for the returned pci_dev and also decrease the reference count for the input pci_dev @from if it is not NULL.
If we break for_each_pci_dev() loop with pdev not NULL, we need to call pci_dev_put() to decrease the reference count. Add the missing pci_dev_put() for the error path to avoid reference count leak.
--- drivers/iommu/dmar.c | 1 + 1 file changed, 1 insertion(+)
drivers/iommu/dmar.c +1 -0
@@ -804,6 +804,7 @@ int __init dmar_dev_scope_init(void) info =dmar_alloc_pci_notify_info (dev,BUS_NOTIFY_ADD_DEVICE );if (!info) { +pci_dev_put (dev);return dmar_dev_scope_status; }else {dmar_pci_bus_add_dev (info);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 94/105 parisc: Increase size of gcc stack frame check
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
[ Upstream commit 55b70eed81cba1331773d4aaf5cba2bb07475cd8 ]
parisc uses much bigger frames than other architectures, so increase the stack frame check value to avoid compiler warnings.
Stable-dep-of: 152fe65f300e ("Kconfig.debug: provide a little extra FRAME_WARN leeway when KASAN is enabled")
--- lib/Kconfig.debug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/Kconfig.debug +1 -1
@@ -224,7 +224,7 @@ config FRAME_WARN range 0 8192 default 3072 if KASAN_EXTRA default 2048 if GCC_PLUGIN_LATENT_ENTROPY - default 1280 if (!64BIT && PARISC) + default 1536 if (!64BIT && PARISC) default 1024 if (!64BIT && !PARISC) default 2048 if 64BIT help
Signature · 1 line
2.35.1
Re: [PATCH 4.19 094/105] parisc: Increase size of gcc stack frame check
Quoted 6 lines · Greg Kroah-Hartman
From: Helge Deller <[email protected]>
[ Upstream commit
55b70eed81cba1331773d4aaf5cba2bb07475cd8]parisc uses much bigger frames than other architectures, so increase the stack frame check value to avoid compiler warnings.
I had not seen this one originally, commenting on it now:
lib/Kconfig.debug config FRAME_WARN · line 228
Quoted 10 lines
index
9ded3c1f68eb..556aae95d69b100644lib/Kconfig.debug +1
-1@@ -224,7 +224,7 @@ config FRAME_WARN range 0 8192 default 3072 if KASAN_EXTRA default 2048 if GCC_PLUGIN_LATENT_ENTROPY - default 1280 if (!64BIT && PARISC) + default 1536 if (!64BIT && PARISC) default 1024 if (!64BIT && !PARISC)
1536 is a /lot/ when we're dealing with 32-bit platforms. My understanding of the parisc overhead was that this was just based on a few bytes per function call, not something that makes everything bigger. We have a few functions that get close to the normal 1024 byte limit, everything else should be no more than a few hundred bytes on any architecture.
Could it be that this only happens when KASAN or some other feature is enabled?
If this happens for normal parisc builds without any special compilation options, that would indicate that the compiler is very broken.
Arnd
Re: [PATCH 4.19 094/105] parisc: Increase size of gcc stack frame check
Quoted 9 lines · Arnd Bergmann
Quoted 6 lines · Greg Kroah-Hartman
From: Helge Deller <[email protected]>
[ Upstream commit
55b70eed81cba1331773d4aaf5cba2bb07475cd8]parisc uses much bigger frames than other architectures, so increase the stack frame check value to avoid compiler warnings.
I had not seen this one originally, commenting on it now:
Hi Arnd,
Thanks for commenting!
By the way, those patches went in for 5.16 kernel, so I nearly forgot about them in the meantime and wonder why they pop up now... (they weren't tagged for stable, but I think it's ok to push them backwards).
Quoted 4 lines
Quoted 4 lines
index
9ded3c1f68eb..556aae95d69b100644lib/Kconfig.debug +0
-0@@ -224,7 +224,7 @@ config FRAME_WARN
Quoted 8 lines
lib/Kconfig.debug config FRAME_WARN · line 228
Quoted 6 lines
lib/Kconfig.debug +1
-1range 0 8192 default 3072 if KASAN_EXTRA default 2048 if GCC_PLUGIN_LATENT_ENTROPY - default 1280 if (!64BIT && PARISC) + default 1536 if (!64BIT && PARISC) default 1024 if (!64BIT && !PARISC)1536 is a /lot/ when we're dealing with 32-bit platforms.
True.
It's actually 2048 bytes in the meantime, see commit 8d192bec534bd5b778135769a12e5f04580771f7
Quoted 2 lines
My understanding of the parisc overhead was that this was just based on a few bytes per function call,
What exactly do you mean by a few bytes?
On parisc the frame size is a multiple of 64-bytes (on 32-bit) and 128 bytes (on 64bit).
For function calls with more than 5 (need to check exact number) parameters those will be put on the stack as well.
Quoted 3 lines
not something that makes everything bigger. We have a few functions that get close to the normal 1024 byte limit, everything else should be no more than a few hundred bytes on any architecture.
Sadly not on parisc.
Again, see commit message of 8d192bec534b, which mentions compile warnings from the kernel test robot for lib/xxhash.c.
Quoted 2 lines
Could it be that this only happens when KASAN or some other feature is enabled?
No, it happens even without KASAN or such.
Quoted 3 lines
If this happens for normal parisc builds without any special compilation options, that would indicate that the compiler is very broken.
No, it does a good job. It's the ABI which requires so big stacks. I see problems with some userspace apps as well which configure too small stacks.
By the way, since those patches are in I don't see any stack overflows any longer. Those happened rarely in the past though.
Helge
Re: [PATCH 4.19 094/105] parisc: Increase size of gcc stack frame check
Quoted 9 lines · Helge Deller
Quoted 8 lines · Arnd Bergmann
Quoted 6 lines · Greg Kroah-Hartman
From: Helge Deller <[email protected]>
[ Upstream commit
55b70eed81cba1331773d4aaf5cba2bb07475cd8]parisc uses much bigger frames than other architectures, so increase the stack frame check value to avoid compiler warnings.
Quoted 7 lines
Quoted 1 line
I had not seen this one originally, commenting on it now:
Hi Arnd,
Thanks for commenting!
By the way, those patches went in for 5.16 kernel, so I nearly forgot about them in the meantime and wonder why they pop up now... (they weren't tagged for stable, but I think it's ok to push them backwards).
Ok, got it, I misread this as being a result of the recent patch that increased the limit for KASAN.
Quoted 8 lines
Quoted 2 lines
My understanding of the parisc overhead was that this was just based on a few bytes per function call,
What exactly do you mean by a few bytes?
On parisc the frame size is a multiple of 64-bytes (on 32-bit) and 128 bytes (on 64bit).
For function calls with more than 5 (need to check exact number) parameters those will be put on the stack as well.
If the frame size gets rounded up to a multiple of 64 bytes, that would add 32 bytes (i.e. a few) on average, but it should not double the stack usage. Similarly limit of five register arguments is just one less than the typical six, so that only explains a few bytes of extra stack usage, but not the huge increase you see.
Quoted 7 lines
Quoted 3 lines
not something that makes everything bigger. We have a few functions that get close to the normal 1024 byte limit, everything else should be no more than a few hundred bytes on any architecture.
Sadly not on parisc.
Again, see commit message of8d192bec534b, which mentions compile warnings from the kernel test robot forlib/xxhash.c.
lib/xxhash.c is similar to some other ones that we've seen grow too much on some architecture/toolchain combinations, as compilers tend to struggle with register allocation for crypto code that looks like the compiler should be able to unroll it all into a simpler operation, but then ends up spilling registers to the stack, which is of course both slow and wasteful to the stack size.
Quoted 10 lines
Quoted 3 lines
If this happens for normal parisc builds without any special compilation options, that would indicate that the compiler is very broken.
No, it does a good job. It's the ABI which requires so big stacks. I see problems with some userspace apps as well which configure too small stacks.
By the way, since those patches are in I don't see any stack overflows any longer. Those happened rarely in the past though.
It certainly helps that you also have twice the THREAD_SIZE of most other architectures.
On a related note, we recently enabled CONFIG_VMAP_STACK on 32-bit arm, and this has already caught some stack overflows that would have otherwise resulted in silent data corruption.
Arnd
Re: [PATCH 4.19 094/105] parisc: Increase size of gcc stack frame check
In reply to Helge DellerQuoted 6 lines · Helge Deller
Quoted 2 lines
My understanding of the parisc overhead was that this was just based on a few bytes per function call,
What exactly do you mean by a few bytes?
On parisc the frame size is a multiple of 64-bytes (on 32-bit) and 128 bytes (on 64bit).
On 64bit, the frame size alignment is actually 16 bytes. The minimum frame size is 80 bytes. That's 16 bytes for the frame marker and 64 bytes for the register save area.
Dave
Signature · 1 line
John David Anglin [email protected]
Greg Kroah-Hartman
maintainerPATCH 95/105 xtensa: increase size of gcc stack frame check
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit 867050247e295cf20fce046a92a7e6491fcfe066 ]
xtensa frame size is larger than the frame size for almost all other architectures. This results in more than 50 "the frame size of <n> is larger than 1024 bytes" errors when trying to build xtensa:allmodconfig.
Increase frame size for xtensa to 1536 bytes to avoid compile errors due to frame size limits.
Stable-dep-of: 152fe65f300e ("Kconfig.debug: provide a little extra FRAME_WARN leeway when KASAN is enabled")
--- lib/Kconfig.debug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/Kconfig.debug +1 -1
@@ -224,7 +224,7 @@ config FRAME_WARN range 0 8192 default 3072 if KASAN_EXTRA default 2048 if GCC_PLUGIN_LATENT_ENTROPY - default 1536 if (!64BIT && PARISC) + default 1536 if (!64BIT && (PARISC || XTENSA)) default 1024 if (!64BIT && !PARISC) default 2048 if 64BIT help
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 96/105 parisc: Increase FRAME_WARN to 2048 bytes on parisc
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
[ Upstream commit 8d192bec534bd5b778135769a12e5f04580771f7 ]
PA-RISC uses a much bigger frame size for functions than other architectures. So increase it to 2048 for 32- and 64-bit kernels. This fixes e.g. a warning in lib/xxhash.c.
Stable-dep-of: 152fe65f300e ("Kconfig.debug: provide a little extra FRAME_WARN leeway when KASAN is enabled")
--- lib/Kconfig.debug | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
lib/Kconfig.debug +3 -2
@@ -224,8 +224,9 @@ config FRAME_WARN range 0 8192 default 3072 if KASAN_EXTRA default 2048 if GCC_PLUGIN_LATENT_ENTROPY - default 1536 if (!64BIT && (PARISC || XTENSA)) - default 1024 if (!64BIT && !PARISC) + default 2048 if PARISC + default 1536 if (!64BIT && XTENSA) + default 1024 if !64BIT default 2048 if 64BIT help Tell gcc to warn at build time for stack frames larger than this.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 97/105 Kconfig.debug: provide a little extra FRAME_WARN leeway when KASAN is enabled
In reply to Greg Kroah-HartmanFrom: Lee Jones <[email protected]>
[ Upstream commit 152fe65f300e1819d59b80477d3e0999b4d5d7d2 ]
When enabled, KASAN enlarges function's stack-frames. Pushing quite a few over the current threshold. This can mainly be seen on 32-bit architectures where the present limit (when !GCC) is a lowly 1024-Bytes.
--- lib/Kconfig.debug | 1 + 1 file changed, 1 insertion(+)
lib/Kconfig.debug +1 -0
@@ -226,6 +226,7 @@ config FRAME_WARN default 2048 if GCC_PLUGIN_LATENT_ENTROPY default 2048 if PARISC default 1536 if (!64BIT && XTENSA) + default 1280 if KASAN && !64BIT default 1024 if !64BIT default 2048 if 64BIT help
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 98/105 tcp/udp: Fix memory leak in ipv6_renew_options().
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
commit 3c52c6bb831f6335c176a0fc7214e26f43adbd11 upstream.
syzbot reported a memory leak [0] related to IPV6_ADDRFORM.
The scenario is that while one thread is converting an IPv6 socket into IPv4 with IPV6_ADDRFORM, another thread calls do_ipv6_setsockopt() and allocates memory to inet6_sk(sk)->XXX after conversion.
Then, the converted sk with (tcp|udp)_prot never frees the IPv6 resources, which inet6_destroy_sock() should have cleaned up.
setsockopt(IPV6_ADDRFORM) setsockopt(IPV6_DSTOPTS)
+-----------------------+ +----------------------+
- do_ipv6_setsockopt(sk, ...)
- sockopt_lock_sock(sk) - do_ipv6_setsockopt(sk, ...)
- lock_sock(sk) ^._ called via tcpv6_prot
- WRITE_ONCE(sk->sk_prot, &tcp_prot) before WRITE_ONCE()
- xchg(&np->opt, NULL)
- txopt_put(opt)
- sockopt_release_sock(sk)
- release_sock(sk) - sockopt_lock_sock(sk)
- lock_sock(sk)
- ipv6_set_opt_hdr(sk, ...)
- ipv6_update_options(sk, opt)
- xchg(&inet6_sk(sk)->opt, opt) ^._ opt is never freed.
- sockopt_release_sock(sk)
- release_sock(sk)
Since IPV6_DSTOPTS allocates options under lock_sock(), we can avoid this memory leak by testing whether sk_family is changed by IPV6_ADDRFORM after acquiring the lock.
This issue exists from the initial commit between IPV6_ADDRFORM and IPV6_PKTOPTIONS.
[0]:
BUG: memory leak
unreferenced object 0xffff888009ab9f80 (size 96):
comm "syz-executor583", pid 328, jiffies 4294916198 (age 13.034s)
hex dump (first 32 bytes):
01 00 00 00 48 00 00 00 08 00 00 00 00 00 00 00 ....H...........
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<000000002ee98ae1>] kmalloc include/linux/slab.h:605 [inline]
[<000000002ee98ae1>] sock_kmalloc+0xb3/0x100 net/core/sock.c:2566
[<0000000065d7b698>] ipv6_renew_options+0x21e/0x10b0 net/ipv6/exthdrs.c:1318
[<00000000a8c756d7>] ipv6_set_opt_hdr net/ipv6/ipv6_sockglue.c:354 [inline]
[<00000000a8c756d7>] do_ipv6_setsockopt.constprop.0+0x28b7/0x4350 net/ipv6/ipv6_sockglue.c:668
[<000000002854d204>] ipv6_setsockopt+0xdf/0x190 net/ipv6/ipv6_sockglue.c:1021
[<00000000e69fdcf8>] tcp_setsockopt+0x13b/0x2620 net/ipv4/tcp.c:3789
[<0000000090da4b9b>] __sys_setsockopt+0x239/0x620 net/socket.c:2252
[<00000000b10d192f>] __do_sys_setsockopt net/socket.c:2263 [inline]
[<00000000b10d192f>] __se_sys_setsockopt net/socket.c:2260 [inline]
[<00000000b10d192f>] __x64_sys_setsockopt+0xbe/0x160 net/socket.c:2260
[<000000000a80d7aa>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<000000000a80d7aa>] do_syscall_64+0x38/0x90 arch/x86/entry/common.c:80
[<000000004562b5c6>] entry_SYSCALL_64_after_hwframe+0x63/0xcd--- net/ipv6/ipv6_sockglue.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/ipv6/ipv6_sockglue.c +7 -0
@@ -166,6 +166,12 @@ static int do_ipv6_setsockopt(struct socrtnl_lock ();lock_sock (sk); +/* Another thread has converted the socket into IPv4 with +* IPV6_ADDRFORM concurrently. +*/ +if (unlikely (sk->sk_family !=AF_INET6 )) + goto unlock; +switch (optname) {case IPV6_ADDRFORM :
@@ -913,6 +919,7 @@ pref_skip_coa:break ; } +unlock:release_sock (sk);if (needs_rtnl)rtnl_unlock ();
Greg Kroah-Hartman
maintainerPATCH 99/105 nvme: restrict management ioctls to admin
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
commit 23e085b2dead13b51fe86d27069895b740f749c0 upstream.
The passthrough commands already have this restriction, but the other operations do not. Require the same capabilities for all users as all of these operations, which include resets and rescans, can be disruptive.
--- drivers/nvme/host/core.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/nvme/host/core.c +6 -0
@@ -2675,11 +2675,17 @@ static long nvme_dev_ioctl(struct file *case NVME_IOCTL_IO_CMD :return nvme_dev_user_cmd (ctrl, argp);case NVME_IOCTL_RESET : +if (!capable (CAP_SYS_ADMIN )) +return -EACCES ;dev_warn (ctrl->device,"resetting controller\n" );return nvme_reset_ctrl_sync (ctrl);case NVME_IOCTL_SUBSYS_RESET : +if (!capable (CAP_SYS_ADMIN )) +return -EACCES ;return nvme_reset_subsystem (ctrl);case NVME_IOCTL_RESCAN : +if (!capable (CAP_SYS_ADMIN )) +return -EACCES ;nvme_queue_scan (ctrl);return 0 ;default :
Greg Kroah-Hartman
maintainerPATCH 100/105 x86/tsx: Add a feature bit for TSX control MSR support
In reply to Greg Kroah-HartmanFrom: Pawan Gupta <[email protected]>
commit aaa65d17eec372c6a9756833f3964ba05b05ea14 upstream.
Support for the TSX control MSR is enumerated in MSR_IA32_ARCH_CAPABILITIES. This is different from how other CPU features are enumerated i.e. via CPUID. Currently, a call to tsx_ctrl_is_supported() is required for enumerating the feature. In the absence of a feature bit for TSX control, any code that relies on checking feature bits directly will not work.
In preparation for adding a feature bit check in MSR save/restore during suspend/resume, set a new feature bit X86_FEATURE_TSX_CTRL when MSR_IA32_TSX_CTRL is present.
[ bp: Remove tsx_ctrl_is_supported()]
[Pawan: Resolved conflicts in backport; Removed parts of commit message
referring to removed function tsx_ctrl_is_supported()]
--- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/tsx.c | 33 ++++++++++++++------------------- 2 files changed, 15 insertions(+), 19 deletions(-)
arch/x86/include/asm/cpufeatures.h +1 -0
@@ -292,6 +292,7 @@#define X86_FEATURE_RETPOLINE (11*32+12)/* "" Generic Retpoline mitigation for Spectre variant 2 */ #define X86_FEATURE_RETPOLINE_LFENCE (11*32+13)/* "" Use LFENCE for Spectre variant 2 */ #define X86_FEATURE_RSB_VMEXIT_LITE (11*32+17)/* "" Fill RSB on VM exit when EIBRS is enabled */ +#define X86_FEATURE_MSR_TSX_CTRL (11*32+18)/* "" MSR IA32_TSX_CTRL (Intel) implemented */ /* AMD-defined CPU features, CPUID level 0x80000008 (EBX), word 13 */ #define X86_FEATURE_CLZERO (13*32+ 0)/* CLZERO instruction */
arch/x86/kernel/cpu/tsx.c +14 -19
@@ -55,24 +55,6 @@ void tsx_enable(void)wrmsrl (MSR_IA32_TSX_CTRL , tsx); } -static bool __init tsx_ctrl_is_supported (void ) -{ -u64 ia32_cap =x86_read_arch_cap_msr (); - -/* -* TSX is controlled via MSR_IA32_TSX_CTRL. However, support for this -* MSR is enumerated by ARCH_CAP_TSX_MSR bit in MSR_IA32_ARCH_CAPABILITIES. -* -* TSX control (aka MSR_IA32_TSX_CTRL) is only available after a -* microcode update on CPUs that have their MSR_IA32_ARCH_CAPABILITIES -* bit MDS_NO=1. CPUs with MDS_NO=0 are not planned to get -* MSR_IA32_TSX_CTRL support even after a microcode update. Thus, -* tsx= cmdline requests will do nothing on CPUs without -* MSR_IA32_TSX_CTRL support. -*/ -return !!(ia32_cap &ARCH_CAP_TSX_CTRL_MSR ); -} -static enum tsx_ctrl_states x86_get_tsx_auto_mode (void ) {if (boot_cpu_has_bug (X86_BUG_TAA ))
@@ -86,9 +68,22 @@ void __init tsx_init(void)char arg[5 ] = {};int ret; -if (!tsx_ctrl_is_supported ()) +/* +* TSX is controlled via MSR_IA32_TSX_CTRL. However, support for this +* MSR is enumerated by ARCH_CAP_TSX_MSR bit in MSR_IA32_ARCH_CAPABILITIES. +* +* TSX control (aka MSR_IA32_TSX_CTRL) is only available after a +* microcode update on CPUs that have their MSR_IA32_ARCH_CAPABILITIES +* bit MDS_NO=1. CPUs with MDS_NO=0 are not planned to get +* MSR_IA32_TSX_CTRL support even after a microcode update. Thus, +* tsx= cmdline requests will do nothing on CPUs without +* MSR_IA32_TSX_CTRL support. +*/ +if (!(x86_read_arch_cap_msr () &ARCH_CAP_TSX_CTRL_MSR ))return ; +setup_force_cpu_cap (X86_FEATURE_MSR_TSX_CTRL ); + ret =cmdline_find_option (boot_command_line,"tsx" , arg,sizeof (arg));if (ret >=0 ) {if (!strcmp (arg,"on" )) {
Greg Kroah-Hartman
maintainerPATCH 101/105 x86/pm: Add enumeration check before spec MSRs save/restore setup
In reply to Greg Kroah-HartmanFrom: Pawan Gupta <[email protected]>
commit 50bcceb7724e471d9b591803889df45dcbb584bc upstream.
pm_save_spec_msr() keeps a list of all the MSRs which _might_ need to be saved and restored at hibernate and resume. However, it has zero awareness of CPU support for these MSRs. It mostly works by unconditionally attempting to manipulate these MSRs and relying on rdmsrl_safe() being able to handle a #GP on CPUs where the support is unavailable.
However, it's possible for reads (RDMSR) to be supported for a given MSR while writes (WRMSR) are not. In this case, msr_build_context() sees a successful read (RDMSR) and marks the MSR as valid. Then, later, a write (WRMSR) fails, producing a nasty (but harmless) error message. This causes restore_processor_state() to try and restore it, but writing this MSR is not allowed on the Intel Atom N2600 leading to:
unchecked MSR access error: WRMSR to 0x122 (tried to write 0x0000000000000002) \
at rIP: 0xffffffff8b07a574 (native_write_msr+0x4/0x20)
Call Trace:
<TASK>
restore_processor_state
x86_acpi_suspend_lowlevel
acpi_suspend_enter
suspend_devices_and_enter
pm_suspend.cold
state_store
kernfs_fop_write_iter
vfs_write
ksys_write
do_syscall_64
? do_syscall_64
? up_read
? lock_is_held_type
? asm_exc_page_fault
? lockdep_hardirqs_on
entry_SYSCALL_64_after_hwframeTo fix this, add the corresponding X86_FEATURE bit for each MSR. Avoid trying to manipulate the MSR when the feature bit is clear. This required adding a X86_FEATURE bit for MSRs that do not have one already, but it's a small price to pay.
[ bp: Move struct msr_enumeration inside the only function that uses it. ] [Pawan: Resolve build issue in backport]
--- arch/x86/power/cpu.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
arch/x86/power/cpu.c +15 -8
@@ -527,16 +527,23 @@ static int pm_cpu_check(const struct x86static void pm_save_spec_msr (void ) { -u32 spec_msr_id[] = { -MSR_IA32_SPEC_CTRL , -MSR_IA32_TSX_CTRL , -MSR_TSX_FORCE_ABORT , -MSR_IA32_MCU_OPT_CTRL , -MSR_AMD64_LS_CFG , -MSR_AMD64_DE_CFG , +struct msr_enumeration { +u32 msr_no; +u32 feature; + } msr_enum[] = { + {MSR_IA32_SPEC_CTRL ,X86_FEATURE_MSR_SPEC_CTRL }, + {MSR_IA32_TSX_CTRL ,X86_FEATURE_MSR_TSX_CTRL }, + {MSR_TSX_FORCE_ABORT ,X86_FEATURE_TSX_FORCE_ABORT }, + {MSR_IA32_MCU_OPT_CTRL ,X86_FEATURE_SRBDS_CTRL }, + {MSR_AMD64_LS_CFG ,X86_FEATURE_LS_CFG_SSBD }, + {MSR_AMD64_DE_CFG ,X86_FEATURE_LFENCE_RDTSC }, }; +int i; -msr_build_context (spec_msr_id,ARRAY_SIZE (spec_msr_id)); +for (i =0 ; i <ARRAY_SIZE (msr_enum); i++) { +if (boot_cpu_has (msr_enum[i].feature)) +msr_build_context (&msr_enum[i].msr_no,1 ); + } }static int pm_check_save_msr (void )
Greg Kroah-Hartman
maintainerPATCH 102/105 Bluetooth: L2CAP: Fix accepting connection request for invalid SPSM
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
commit 711f8c3fb3db61897080468586b970c87c61d9e4 upstream.
The Bluetooth spec states that the valid range for SPSM is from 0x0001-0x00ff so it is invalid to accept values outside of this range:
BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 3, Part A page 1059:
Table 4.15: L2CAP_LE_CREDIT_BASED_CONNECTION_REQ SPSM ranges
CVE: CVE-2022-42896
--- net/bluetooth/l2cap_core.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
net/bluetooth/l2cap_core.c +13 -0
@@ -5553,6 +5553,19 @@ static int l2cap_le_connect_req(struct lBT_DBG ("psm 0x%2.2x scid 0x%4.4x mtu %u mps %u" ,__le16_to_cpu (psm), scid, mtu, mps); +/* BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 3, Part A +* page 1059: +* +* Valid range: 0x0001-0x00ff +* +* Table 4.15: L2CAP_LE_CREDIT_BASED_CONNECTION_REQ SPSM ranges +*/ +if (!psm ||__le16_to_cpu (psm) >L2CAP_PSM_LE_DYN_END ) { + result =L2CAP_CR_BAD_PSM ; + chan =NULL ; + goto response; + } +/* Check if we have socket listening on psm */ pchan =l2cap_global_chan_by_psm (BT_LISTEN , psm, &conn->hcon->src, &conn->hcon->dst,LE_LINK );
Greg Kroah-Hartman
maintainerPATCH 103/105 x86/ioremap: Fix page aligned size calculation in __ioremap_caller()
In reply to Greg Kroah-HartmanFrom: Michael Kelley <[email protected]>
[ Upstream commit 4dbd6a3e90e03130973688fd79e19425f720d999 ]
Current code re-calculates the size after aligning the starting and ending physical addresses on a page boundary. But the re-calculation also embeds the masking of high order bits that exceed the size of the physical address space (via PHYSICAL_PAGE_MASK). If the masking removes any high order bits, the size calculation results in a huge value that is likely to immediately fail.
Fix this by re-calculating the page-aligned size first. Then mask any high order bits using PHYSICAL_PAGE_MASK.
--- arch/x86/mm/ioremap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/x86/mm/ioremap.c +7 -1
@@ -171,9 +171,15 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,* Mappings have to be page-aligned */ offset = phys_addr & ~PAGE_MASK ; - phys_addr &=PHYSICAL_PAGE_MASK ; + phys_addr &=PAGE_MASK ; size =PAGE_ALIGN (last_addr+1 ) - phys_addr; +/* +* Mask out any bits not part of the actual physical +* address, like memory encryption bits. +*/ + phys_addr &=PHYSICAL_PAGE_MASK ; + retval =reserve_memtype (phys_addr, (u64 )phys_addr + size, pcm, &new_pcm);if (retval) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 104/105 mmc: sdhci: use FIELD_GET for preset value bit masks
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit fa0910107a9fea170b817f31da2a65463e00e80e upstream.
Use the FIELD_GET macro to get access to the register fields. Delete the shift macros.
--- drivers/mmc/host/sdhci.c | 10 +++++----- drivers/mmc/host/sdhci.h | 10 ++++------ 2 files changed, 9 insertions(+), 11 deletions(-)
drivers/mmc/host/sdhci.c +5 -5
@@ -13,6 +13,7 @@* - JMicron (hardware and technical support) */ +#include <linux/bitfield.h> #include <linux/delay.h> #include <linux/ktime.h> #include <linux/highmem.h>
@@ -1418,10 +1419,9 @@ u16 sdhci_calc_clk(struct sdhci_host *ho clk =sdhci_readw (host,SDHCI_CLOCK_CONTROL ); pre_val =sdhci_get_preset_value (host); - div = (pre_val &SDHCI_PRESET_SDCLK_FREQ_MASK ) - >>SDHCI_PRESET_SDCLK_FREQ_SHIFT ; + div =FIELD_GET (SDHCI_PRESET_SDCLK_FREQ_MASK , pre_val);if (host->clk_mul && - (pre_val &SDHCI_PRESET_CLKGEN_SEL_MASK )) { + (pre_val &SDHCI_PRESET_CLKGEN_SEL )) { clk =SDHCI_PROG_CLOCK_MODE ; real_div = div +1 ; clk_mul = host->clk_mul;
@@ -1873,8 +1873,8 @@ void sdhci_set_ios(struct mmc_host *mmc,sdhci_enable_preset_value (host, true); preset =sdhci_get_preset_value (host); - ios->drv_type = (preset &SDHCI_PRESET_DRV_MASK ) - >>SDHCI_PRESET_DRV_SHIFT ; + ios->drv_type =FIELD_GET (SDHCI_PRESET_DRV_MASK , + preset); }/* Re-enable SD Clock */
drivers/mmc/host/sdhci.h +4 -6
@@ -13,6 +13,7 @@#ifndef __SDHCI_HW_H#define __SDHCI_HW_H +#include <linux/bits.h> #include <linux/scatterlist.h> #include <linux/compiler.h> #include <linux/types.h>
@@ -259,12 +260,9 @@#define SDHCI_PRESET_FOR_SDR104 0x6C#define SDHCI_PRESET_FOR_DDR50 0x6E#define SDHCI_PRESET_FOR_HS400 0x74/* Non-standard */ -#define SDHCI_PRESET_DRV_MASK 0xC000 -#define SDHCI_PRESET_DRV_SHIFT 14 -#define SDHCI_PRESET_CLKGEN_SEL_MASK 0x400 -#define SDHCI_PRESET_CLKGEN_SEL_SHIFT 10 -#define SDHCI_PRESET_SDCLK_FREQ_MASK 0x3FF -#define SDHCI_PRESET_SDCLK_FREQ_SHIFT 0 +#define SDHCI_PRESET_DRV_MASK GENMASK(15, 14) +#define SDHCI_PRESET_CLKGEN_SEL BIT(10) +#define SDHCI_PRESET_SDCLK_FREQ_MASK GENMASK(9, 0)#define SDHCI_SLOT_INT_STATUS 0xFC
Greg Kroah-Hartman
maintainerPATCH 105/105 mmc: sdhci: Fix voltage switch delay
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit c981cdfb9925f64a364f13c2b4f98f877308a408 upstream.
Commit 20b92a30b561 ("mmc: sdhci: update signal voltage switch code") removed voltage switch delays from sdhci because mmc core had been enhanced to support them. However that assumed that sdhci_set_ios() did a single clock change, which it did not, and so the delays in mmc core, which should have come after the first clock change, were not effective.
Fix by avoiding re-configuring UHS and preset settings when the clock is turning on and the settings have not changed. That then also avoids the associated clock changes, so that then sdhci_set_ios() does a single clock change when voltage switching, and the mmc core delays become effective.
To do that has meant keeping track of driver strength (host->drv_type), and cases of reinitialization (host->reinit_uhs).
Note also, the 'turning_on_clk' restriction should not be necessary but is done to minimize the impact of the change on stable kernels.
--- drivers/mmc/host/sdhci.c | 61 +++++++++++++++++++++++++++++++++++++++++------ drivers/mmc/host/sdhci.h | 2 + 2 files changed, 56 insertions(+), 7 deletions(-)
drivers/mmc/host/sdhci.c +54 -7
@@ -264,6 +264,7 @@ static void sdhci_init(struct sdhci_hostif (soft) {/* force clock reconfiguration */ host->clock =0 ; + host->reinit_uhs = true; mmc->ops->set_ios (mmc, &mmc->ios); } }
@@ -1736,11 +1737,46 @@ void sdhci_set_uhs_signaling(struct sdhc }EXPORT_SYMBOL_GPL (sdhci_set_uhs_signaling); +static bool sdhci_timing_has_preset (unsigned char timing) +{ +switch (timing) { +case MMC_TIMING_UHS_SDR12 : +case MMC_TIMING_UHS_SDR25 : +case MMC_TIMING_UHS_SDR50 : +case MMC_TIMING_UHS_SDR104 : +case MMC_TIMING_UHS_DDR50 : +case MMC_TIMING_MMC_DDR52 : +return true; + }; +return false; +} + +static bool sdhci_preset_needed (struct sdhci_host *host,unsigned char timing) +{ +return !(host->quirks2 &SDHCI_QUIRK2_PRESET_VALUE_BROKEN ) && +sdhci_timing_has_preset (timing); +} + +static bool sdhci_presetable_values_change (struct sdhci_host *host,struct mmc_ios *ios) +{ +/* +* Preset Values are: Driver Strength, Clock Generator and SDCLK/RCLK +* Frequency. Check if preset values need to be enabled, or the Driver +* Strength needs updating. Note, clock changes are handled separately. +*/ +return !host->preset_enabled && + (sdhci_preset_needed (host, ios->timing) || host->drv_type != ios->drv_type); +} +void sdhci_set_ios (struct mmc_host *mmc,struct mmc_ios *ios) {struct sdhci_host *host =mmc_priv (mmc); +bool reinit_uhs = host->reinit_uhs; +bool turning_on_clk = false;u8 ctrl; + host->reinit_uhs = false; +if (ios->power_mode ==MMC_POWER_UNDEFINED )return ;
@@ -1766,6 +1802,8 @@ void sdhci_set_ios(struct mmc_host *mmc,sdhci_enable_preset_value (host, false);if (!ios->clock || ios->clock != host->clock) { + turning_on_clk = ios->clock && !host->clock; + host->ops->set_clock (host, ios->clock); host->clock = ios->clock;
@@ -1792,6 +1830,17 @@ void sdhci_set_ios(struct mmc_host *mmc, host->ops->set_bus_width (host, ios->bus_width); +/* +* Special case to avoid multiple clock changes during voltage +* switching. +*/ +if (!reinit_uhs && + turning_on_clk && + host->timing == ios->timing && + host->version >=SDHCI_SPEC_300 && + !sdhci_presetable_values_change (host, ios)) +return ; + ctrl =sdhci_readb (host,SDHCI_HOST_CONTROL );if (!(host->quirks &SDHCI_QUIRK_NO_HISPD_BIT )) {
@@ -1835,6 +1884,7 @@ void sdhci_set_ios(struct mmc_host *mmc, }sdhci_writew (host, ctrl_2,SDHCI_HOST_CONTROL2 ); + host->drv_type = ios->drv_type; }else {/* * According to SDHC Spec v3.00, if the Preset Value
@@ -1862,19 +1912,14 @@ void sdhci_set_ios(struct mmc_host *mmc, host->ops->set_uhs_signaling (host, ios->timing); host->timing = ios->timing; -if (!(host->quirks2 &SDHCI_QUIRK2_PRESET_VALUE_BROKEN ) && - ((ios->timing ==MMC_TIMING_UHS_SDR12 ) || - (ios->timing ==MMC_TIMING_UHS_SDR25 ) || - (ios->timing ==MMC_TIMING_UHS_SDR50 ) || - (ios->timing ==MMC_TIMING_UHS_SDR104 ) || - (ios->timing ==MMC_TIMING_UHS_DDR50 ) || - (ios->timing ==MMC_TIMING_MMC_DDR52 ))) { +if (sdhci_preset_needed (host, ios->timing)) {u16 preset;sdhci_enable_preset_value (host, true); preset =sdhci_get_preset_value (host); ios->drv_type =FIELD_GET (SDHCI_PRESET_DRV_MASK , preset); + host->drv_type = ios->drv_type; }/* Re-enable SD Clock */
@@ -3128,6 +3173,7 @@ int sdhci_resume_host(struct sdhci_hostsdhci_init (host,0 ); host->pwr =0 ; host->clock =0 ; + host->reinit_uhs = true; mmc->ops->set_ios (mmc, &mmc->ios); }else {sdhci_init (host, (host->mmc->pm_flags &MMC_PM_KEEP_POWER ));
@@ -3191,6 +3237,7 @@ int sdhci_runtime_resume_host(struct sdh/* Force clock and power re-program */ host->pwr =0 ; host->clock =0 ; + host->reinit_uhs = true; mmc->ops->start_signal_voltage_switch (mmc, &mmc->ios); mmc->ops->set_ios (mmc, &mmc->ios);
drivers/mmc/host/sdhci.h +2 -0
@@ -501,6 +501,8 @@ struct sdhci_host {unsigned int clock;/* Current clock (MHz) */ u8 pwr;/* Current voltage */ +u8 drv_type;/* Current UHS-I driver type */ +bool reinit_uhs;/* Force UHS-related re-initialization */ bool runtime_suspended;/* Host is runtime suspended */ bool bus_on;/* Bus power prevents runtime suspend */
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.268 release. There are 105 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 07 Dec 2022 19:07:46 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.268-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 4.19.268 release. There are 105 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.
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-4.19.y
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany