5.18.6-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainercover 5.18.6-rc1 review
This is the start of the stable review cycle for the 5.18.6 release. There are 141 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, 22 Jun 2022 12:47:02 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.18.6-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.18.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.18.6-rc1
Peng Fan <[email protected]>
clk: imx8mp: fix usb_root_clk parent
Christoph Hellwig <[email protected]>
dm: fix bio_set allocation
Mauro Carvalho Chehab <[email protected]>
dt-bindings: interrupt-controller: update brcm,l2-intc.yaml reference
Mauro Carvalho Chehab <[email protected]>
dt-bindings: mfd: bd9571mwv: update rohm,bd9571mwv.yaml reference
Masahiro Yamada <[email protected]>
powerpc/book3e: get rid of #include <generated/compile.h>
Dan Carpenter <[email protected]>
bpf: Use safer kvmalloc_array() where possible
Jani Nikula <[email protected]>
drm/i915/uc: remove accidental static from a local variable
David Howells <[email protected]>
netfs: Fix gcc-12 warning by embedding vfs inode in netfs_i_context
Murilo Opsfelder Araujo <[email protected]>
virtio-pci: Remove wrong address verification in vp_del_vqs()
Marc Zyngier <[email protected]>
KVM: arm64: Don't read a HW interrupt pending state in user context
Marc Zyngier <[email protected]>
KVM: arm64: Always start with clearing SVE flag on load
Zhang Yi <[email protected]>
ext4: add reserved GDT blocks check
Ding Xiang <[email protected]>
ext4: make variable "count" signed
Baokun Li <[email protected]>
ext4: fix bug_on ext4_mb_use_inode_pa
Ye Bin <[email protected]>
ext4: fix super block checksum incorrect after mount
Christian Göttsche <[email protected]>
selinux: free contexts previously transferred in selinux_add_opt()
Christian Brauner <[email protected]>
fs: account for group membership
Sami Tolvanen <[email protected]>
cfi: Fix __cfi_slowpath_diag RCU usage with cpuidle
Christian Göttsche <[email protected]>
audit: free module name
Roman Li <[email protected]>
drm/amd/display: Cap OLED brightness per max frame-average luminance
Michel Dänzer <[email protected]>
drm/amdgpu: Fix GTT size reporting in amdgpu_ioctl
Mikulas Patocka <[email protected]>
dm mirror log: round up region bitmap size to BITS_PER_LONG
Benjamin Marzinski <[email protected]>
dm: fix race in dm_start_io_acct
Logan Gunthorpe <[email protected]>
md/raid5-ppl: Fix argument order in bio_alloc_bioset()
Shin'ichiro Kawasaki <[email protected]>
bus: fsl-mc-bus: fix KASAN use-after-free in fsl_mc_bus_remove()
Ilpo Järvinen <[email protected]>
serial: 8250: Store to lsr_save_flags after lsr read
Tony Lindgren <[email protected]>
tty: n_gsm: Debug output allocation must use GFP_ATOMIC
Linyu Yuan <[email protected]>
usb: gadget: f_fs: change ep->ep safe in ffs_epfile_io()
Linyu Yuan <[email protected]>
usb: gadget: f_fs: change ep->status safe in ffs_epfile_io()
Miaoqian Lin <[email protected]>
usb: gadget: lpc32xx_udc: Fix refcount leak in lpc32xx_udc_probe
Marian Postevca <[email protected]>
usb: gadget: u_ether: fix regression in setting fixed MAC address
Stephan Gerhold <[email protected]>
usb: dwc3: pci: Restore line lost in merge conflict resolution
Wesley Cheng <[email protected]>
usb: dwc3: gadget: Fix IN endpoint max packet size allocation
Jing Leng <[email protected]>
usb: cdnsp: Fixed setting last_trb incorrectly
Miaoqian Lin <[email protected]>
usb: dwc2: Fix memory leak in dwc2_hcd_init
Will Deacon <[email protected]>
arm64: mm: Don't invalidate FROM_DEVICE buffers at start of DMA transfer
Robert Eckelmann <[email protected]>
USB: serial: io_ti: add Agilent E5805A support
Slark Xiao <[email protected]>
USB: serial: option: add support for Cinterion MV31 with new baseline
Jason A. Donenfeld <[email protected]>
crypto: memneq - move into lib/
Ian Abbott <[email protected]>
comedi: vmk80xx: fix expression for tx buffer size
Alexander Usyskin <[email protected]>
mei: me: add raptor lake point S DID
Alexander Usyskin <[email protected]>
mei: hbm: drop capability response on early shutdown
Christophe JAILLET <[email protected]>
i2c: mediatek: Fix an error handling path in mtk_i2c_probe()
Serge Semin <[email protected]>
i2c: designware: Use standard optional ref clock implementation
Peter Zijlstra <[email protected]>
sched: Fix balance_push() vs __sched_setscheduler()
Miaoqian Lin <[email protected]>
irqchip/realtek-rtl: Fix refcount leak in map_interrupts
Miaoqian Lin <[email protected]>
irqchip/gic-v3: Fix refcount leak in gic_populate_ppi_partitions
Miaoqian Lin <[email protected]>
irqchip/gic-v3: Fix error handling in gic_populate_ppi_partitions
Miaoqian Lin <[email protected]>
irqchip/apple-aic: Fix refcount leak in aic_of_ic_init
Miaoqian Lin <[email protected]>
irqchip/apple-aic: Fix refcount leak in build_fiq_affinity
Miaoqian Lin <[email protected]>
irqchip/gic/realview: Fix refcount leak in realview_gic_of_init
Jiasheng Jiang <[email protected]>
i2c: npcm7xx: Add check for platform_driver_register
Josh Poimboeuf <[email protected]>
x86/ftrace: Remove OBJECT_FILES_NON_STANDARD usage
Josh Poimboeuf <[email protected]>
faddr2line: Fix overlapping text section failures, the sequel
Bart Van Assche <[email protected]>
block: Fix handling of offline queues in blk_mq_alloc_request_hctx()
Jan Kara <[email protected]>
init: Initialize noop_backing_dev_info early
Masahiro Yamada <[email protected]>
certs/blacklist_hashes.c: fix const confusion in certs blacklist
Mark Rutland <[email protected]>
arm64: ftrace: consistently handle PLTs.
Mark Rutland <[email protected]>
arm64: ftrace: fix branch range checks
Duoming Zhou <[email protected]>
net: ax25: Fix deadlock caused by skb_recv_datagram in ax25_recvmsg
Oliver Hartkopp <[email protected]>
net: remove noblock parameter from skb_recv_datagram()
Christophe JAILLET <[email protected]>
net: bgmac: Fix an erroneous kfree() in bgmac_remove()
Przemyslaw Patynowski <[email protected]>
ice: Fix memory corruption in VF driver
Przemyslaw Patynowski <[email protected]>
ice: Fix queue config fail handling
Roman Storozhenko <[email protected]>
ice: Sync VLAN filtering features for DVM
Michal Michalik <[email protected]>
ice: Fix PTP TX timestamp offset calculation
Petr Machata <[email protected]>
mlxsw: spectrum_cnt: Reorder counter pools
Thomas Weißschuh <[email protected]>
nvme: add device name to warning in uuid_show()
Guangbin Huang <[email protected]>
net: hns3: fix tm port shapping of fibre port is incorrect after driver initialization
Jie Wang <[email protected]>
net: hns3: fix PF rss size initialization bug
Guangbin Huang <[email protected]>
net: hns3: restore tm priority/qset to default settings when tc disabled
Jian Shen <[email protected]>
net: hns3: don't push link state to VF if unalive
Guangbin Huang <[email protected]>
net: hns3: set port base vlan tbl_sta to false before removing old vlan
Alan Previn <[email protected]>
drm/i915/reset: Fix error_state_read ptr + offset use
Pavel Begunkov <[email protected]>
io_uring: fix races with buffer table unregister
Pavel Begunkov <[email protected]>
io_uring: fix races with file table unregister
Conor Dooley <[email protected]>
riscv: dts: microchip: re-add pdma to mpfs device tree
Miaoqian Lin <[email protected]>
misc: atmel-ssc: Fix IRQ check in ssc_probe
Vincent Whitchurch <[email protected]>
tty: goldfish: Fix free_irq() on remove
Saurabh Sengar <[email protected]>
Drivers: hv: vmbus: Release cpu lock in error case
Michal Wilczynski <[email protected]>
iavf: Fix issue with MAC address of VF shown as zero
Aleksandr Loktionov <[email protected]>
i40e: Fix call trace in setup_tx_descriptors
Grzegorz Szczurek <[email protected]>
i40e: Fix calculating the number of queue pairs
Grzegorz Szczurek <[email protected]>
i40e: Fix adding ADQ filter to TC0
Masahiro Yamada <[email protected]>
clocksource: hyper-v: unexport __init-annotated hv_init_clocksource()
Scott Mayhew <[email protected]>
sunrpc: set cl_max_connect when cloning an rpc_clnt
Trond Myklebust <[email protected]>
pNFS: Avoid a live lock condition in pnfs_update_layout()
Trond Myklebust <[email protected]>
pNFS: Don't keep retrying if the server replied NFS4ERR_LAYOUTUNAVAILABLE
Larry Finger <[email protected]>
staging: r8188eu: Fix warning of array overflow in ioctl_linux.c
Phillip Potter <[email protected]>
staging: r8188eu: fix rtw_alloc_hwxmits error detection for now
Duke Lee <[email protected]>
platform/x86/intel: hid: Add Surface Go to VGBS allow list
August Wikerfors <[email protected]>
platform/x86: gigabyte-wmi: Add support for B450M DS3H-CF
Piotr Chmura <[email protected]>
platform/x86: gigabyte-wmi: Add Z690M AORUS ELITE AX DDR4 support
George D Sworo <[email protected]>
platform/x86/intel: pmc: Support Intel Raptorlake P
David Arcari <[email protected]>
platform/x86/intel: Fix pmt_crashlog array reference
Serge Semin <[email protected]>
gpio: dwapb: Don't print error on -EPROBE_DEFER
Jason A. Donenfeld <[email protected]>
random: credit cpu and bootloader seeds by default
Yupeng Li <[email protected]>
MIPS: Loongson-3: fix compile mips cpu_hwmon as module build error.
Linus Torvalds <[email protected]>
netfs: gcc-12: temporarily disable '-Wattribute-warning' for now
Linus Torvalds <[email protected]>
gcc-12: disable '-Warray-bounds' universally for now
Linus Torvalds <[email protected]>
mellanox: mlx5: avoid uninitialized variable warning with gcc-12
Linus Torvalds <[email protected]>
gcc-12: disable '-Wdangling-pointer' warning for now
Chen Lin <[email protected]>
net: ethernet: mtk_eth_soc: fix misuse of mem alloc interface netdev[napi]_alloc_frag
Wang Yufen <[email protected]>
ipv6: Fix signed integer overflow in l2tp_ip6_sendmsg
Wang Yufen <[email protected]>
ipv6: Fix signed integer overflow in __ip6_append_data
Xiaohui Zhang <[email protected]>
nfc: nfcmrvl: Fix memory leak in nfcmrvl_play_deferred
chengkaitao <[email protected]>
virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed
huangwenhui <[email protected]>
ALSA: hda/realtek - Add HW8326 support
Chengguang Xu <[email protected]>
scsi: pmcraid: Fix missing resource cleanup in error case
Chengguang Xu <[email protected]>
scsi: ipr: Fix missing/incorrect resource cleanup in error case
Helge Deller <[email protected]>
scsi: mpt3sas: Fix out-of-bounds compiler warning
James Smart <[email protected]>
scsi: lpfc: Allow reduced polling rate for nvme_admin_async_event cmd completion
James Smart <[email protected]>
scsi: lpfc: Fix port stuck in bypassed state after LIP in PT2PT topology
James Smart <[email protected]>
scsi: lpfc: Resolve NULL ptr dereference after an ELS LOGO is aborted
Wentao Wang <[email protected]>
scsi: vmw_pvscsi: Expand vcpuHint to 16 bits
Marius Hoch <[email protected]>
Input: soc_button_array - also add Lenovo Yoga Tablet2 1051F to dmi_use_low_level_irq
Yong Zhi <[email protected]>
ALSA: hda: MTL: add HD Audio PCI ID and HDMI codec vendor ID
Mark Brown <[email protected]>
ASoC: wm_adsp: Fix event generation for wm_adsp_fw_put()
Mark Brown <[email protected]>
ASoC: es8328: Fix event generation for deemphasis control
Adam Ford <[email protected]>
ASoC: wm8962: Fix suspend while playing music
Matthew Wilcox (Oracle) <[email protected]>
quota: Prevent memory allocation recursion while holding dq_lock
Sergey Shtylyov <[email protected]>
ata: libata-core: fix NULL pointer deref in ata_host_alloc_pinfo()
Lang Yu <[email protected]>
drm/amdkfd: add pinned BOs to kfd_bo_list
Charles Keepax <[email protected]>
ASoC: cs42l51: Correct minimum value for SX volume control
Charles Keepax <[email protected]>
ASoC: cs42l56: Correct typo in minimum level for SX volume controls
Charles Keepax <[email protected]>
ASoC: cs42l52: Correct TLV for Bypass Volume
Charles Keepax <[email protected]>
ASoC: cs53l30: Correct number of volume levels on SX controls
Charles Keepax <[email protected]>
ASoC: cs35l36: Update digital volume TLV
Charles Keepax <[email protected]>
ASoC: cs42l52: Fix TLV scales for mixer controls
xliu <[email protected]>
ASoC: Intel: cirrus-common: fix incorrect channel mapping
Rob Clark <[email protected]>
dma-debug: make things less spammy under memory pressure
Philip Yang <[email protected]>
drm/amdkfd: Use mmget_not_zero in MMU notifier
Candice Li <[email protected]>
drm/amdgpu: Resolve RAS GFX error count issue after cold boot on Arcturus
Sherry Wang <[email protected]>
drm/amd/display: Read Golden Settings Table from VBIOS
Srinivasa Rao Mandadapu <[email protected]>
ASoC: qcom: lpass-platform: Update VMA access permissions in mmap callback
Hui Wang <[email protected]>
ASoC: nau8822: Add operation for internal PLL off and on
He Ying <[email protected]>
powerpc/kasan: Silence KASAN warnings in __get_wchan()
Jens Axboe <[email protected]>
io_uring: reinstate the inflight tracking
Adam Ford <[email protected]>
arm64: dts: imx8mn-beacon: Enable RTS-CTS on UART3
Adam Ford <[email protected]>
arm64: dts: imx8mm-beacon: Enable RTS-CTS on UART3
Stylon Wang <[email protected]>
Revert "drm/amd/display: Fix DCN3 B0 DP Alt Mapping"
-------------
Diffstat:
.../ABI/testing/sysfs-driver-bd9571mwv-regulator | 2 +-
.../bindings/cpufreq/brcm,stb-avs-cpu-freq.txt | 2 +-
Documentation/filesystems/netfs_library.rst | 37 +++---
Makefile | 8 +-
.../dts/freescale/imx8mm-beacon-baseboard.dtsi | 3 +
.../dts/freescale/imx8mn-beacon-baseboard.dtsi | 3 +
arch/arm64/kernel/ftrace.c | 137 ++++++++++-----------
arch/arm64/kvm/fpsimd.c | 1 +
arch/arm64/kvm/vgic/vgic-mmio-v2.c | 4 +-
arch/arm64/kvm/vgic/vgic-mmio.c | 19 ++-
arch/arm64/kvm/vgic/vgic-mmio.h | 3 +
arch/arm64/mm/cache.S | 2 -
arch/powerpc/kernel/process.c | 4 +-
arch/powerpc/mm/nohash/kaslr_booke.c | 8 +-
arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi | 9 ++
arch/s390/Kconfig | 1 +
arch/s390/Makefile | 10 +-
arch/x86/kernel/Makefile | 4 -
arch/x86/kernel/ftrace_64.S | 11 +-
block/blk-mq.c | 2 +
certs/blacklist_hashes.c | 2 +-
crypto/Kconfig | 1 +
crypto/Makefile | 2 +-
drivers/ata/libata-core.c | 4 +-
drivers/base/init.c | 2 +
drivers/bus/fsl-mc/fsl-mc-bus.c | 6 +-
drivers/char/Kconfig | 50 +++++---
drivers/clk/imx/clk-imx8mp.c | 2 +-
drivers/clocksource/hyperv_timer.c | 1 -
drivers/comedi/drivers/vmk80xx.c | 2 +-
drivers/gpio/gpio-dwapb.c | 7 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 13 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 9 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 -
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 27 +++-
drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 3 +
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 +-
.../amd/display/dc/dcn31/dcn31_dio_link_encoder.c | 4 +-
.../gpu/drm/amd/display/dc/dcn31/dcn31_resource.c | 6 -
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 2 +-
drivers/gpu/drm/i915/i915_sysfs.c | 15 ++-
drivers/hv/channel_mgmt.c | 1 +
drivers/i2c/busses/i2c-designware-common.c | 3 -
drivers/i2c/busses/i2c-designware-platdrv.c | 13 +-
drivers/i2c/busses/i2c-mt65xx.c | 9 +-
drivers/i2c/busses/i2c-npcm7xx.c | 3 +-
drivers/input/misc/soc_button_array.c | 4 +-
drivers/irqchip/irq-apple-aic.c | 2 +
drivers/irqchip/irq-gic-realview.c | 1 +
drivers/irqchip/irq-gic-v3.c | 7 +-
drivers/irqchip/irq-realtek-rtl.c | 2 +-
drivers/isdn/mISDN/socket.c | 2 +-
drivers/md/dm-core.h | 11 +-
drivers/md/dm-log.c | 3 +-
drivers/md/dm-rq.c | 2 +-
drivers/md/dm-table.c | 11 --
drivers/md/dm.c | 87 +++++--------
drivers/md/dm.h | 2 -
drivers/md/raid5-ppl.c | 4 +-
drivers/misc/atmel-ssc.c | 4 +-
drivers/misc/mei/hbm.c | 3 +-
drivers/misc/mei/hw-me-regs.h | 2 +
drivers/misc/mei/pci-me.c | 2 +
drivers/net/ethernet/broadcom/bgmac-bcma.c | 1 -
drivers/net/ethernet/hisilicon/hns3/hnae3.h | 1 +
.../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 18 ++-
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 101 ++++++++++-----
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h | 1 +
drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 25 ++--
drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 +-
drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +-
drivers/net/ethernet/intel/ice/ice_main.c | 49 +++++---
drivers/net/ethernet/intel/ice/ice_ptp.c | 2 +-
drivers/net/ethernet/intel/ice/ice_ptp.h | 31 +++++
drivers/net/ethernet/intel/ice/ice_vf_lib.c | 5 +
drivers/net/ethernet/intel/ice/ice_virtchnl.c | 53 ++++----
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 21 +++-
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 2 +-
drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.h | 2 +-
drivers/net/ppp/pppoe.c | 3 +-
drivers/nfc/nfcmrvl/usb.c | 16 ++-
drivers/nvme/host/core.c | 4 +-
drivers/platform/mips/Kconfig | 2 +-
drivers/platform/x86/gigabyte-wmi.c | 2 +
drivers/platform/x86/intel/hid.c | 6 +
drivers/platform/x86/intel/pmc/core.c | 1 +
drivers/platform/x86/intel/pmt/crashlog.c | 2 +-
drivers/scsi/ipr.c | 4 +-
drivers/scsi/lpfc/lpfc_els.c | 18 +--
drivers/scsi/lpfc/lpfc_hw4.h | 3 +
drivers/scsi/lpfc/lpfc_nportdisc.c | 3 +-
drivers/scsi/lpfc/lpfc_nvme.c | 11 +-
drivers/scsi/mpt3sas/mpt3sas_base.c | 23 ++--
drivers/scsi/pmcraid.c | 2 +-
drivers/scsi/vmw_pvscsi.h | 4 +-
drivers/staging/r8188eu/core/rtw_xmit.c | 20 +--
drivers/staging/r8188eu/os_dep/ioctl_linux.c | 2 +-
drivers/tty/goldfish.c | 2 +-
drivers/tty/n_gsm.c | 2 +-
drivers/tty/serial/8250/8250_port.c | 2 +
drivers/usb/cdns3/cdnsp-ring.c | 19 +--
drivers/usb/dwc2/hcd.c | 2 +-
drivers/usb/dwc3/dwc3-pci.c | 1 +
drivers/usb/dwc3/gadget.c | 26 ++--
drivers/usb/gadget/function/f_fs.c | 40 +++---
drivers/usb/gadget/function/u_ether.c | 12 +-
drivers/usb/gadget/udc/lpc32xx_udc.c | 1 +
drivers/usb/serial/io_ti.c | 2 +
drivers/usb/serial/io_usbvend.h | 1 +
drivers/usb/serial/option.c | 6 +
drivers/virtio/virtio_mmio.c | 1 +
drivers/virtio/virtio_pci_common.c | 3 +-
fs/9p/cache.c | 4 +-
fs/9p/v9fs.c | 2 +-
fs/9p/v9fs.h | 10 +-
fs/9p/vfs_addr.c | 2 +-
fs/9p/vfs_inode.c | 4 +-
fs/afs/callback.c | 2 +-
fs/afs/dir.c | 32 ++---
fs/afs/dir_edit.c | 10 +-
fs/afs/dir_silly.c | 4 +-
fs/afs/dynroot.c | 2 +-
fs/afs/file.c | 4 +-
fs/afs/fs_operation.c | 6 +-
fs/afs/inode.c | 38 +++---
fs/afs/internal.h | 23 ++--
fs/afs/super.c | 6 +-
fs/afs/write.c | 21 ++--
fs/attr.c | 26 +++-
fs/ceph/addr.c | 4 +-
fs/ceph/cache.c | 4 +-
fs/ceph/cache.h | 2 +-
fs/ceph/caps.c | 104 ++++++++--------
fs/ceph/file.c | 2 +-
fs/ceph/inode.c | 10 +-
fs/ceph/mds_client.c | 4 +-
fs/ceph/snap.c | 8 +-
fs/ceph/super.c | 2 +-
fs/ceph/super.h | 10 +-
fs/ceph/xattr.c | 14 +--
fs/cifs/cifsfs.c | 8 +-
fs/cifs/cifsglob.h | 12 +-
fs/cifs/file.c | 8 +-
fs/cifs/fscache.c | 8 +-
fs/cifs/fscache.h | 8 +-
fs/cifs/inode.c | 4 +-
fs/cifs/misc.c | 4 +-
fs/cifs/smb2ops.c | 8 +-
fs/ext4/mballoc.c | 9 ++
fs/ext4/namei.c | 3 +-
fs/ext4/resize.c | 10 ++
fs/ext4/super.c | 16 +--
fs/io_uring.c | 97 +++++++++++----
fs/netfs/buffered_read.c | 6 +-
fs/netfs/internal.h | 2 +-
fs/netfs/objects.c | 2 +-
fs/nfs/callback_proc.c | 1 +
fs/nfs/pnfs.c | 21 +++-
fs/nfs/pnfs.h | 1 +
fs/quota/dquot.c | 10 ++
include/linux/backing-dev.h | 2 +
include/linux/netfs.h | 41 +++---
include/linux/objtool.h | 6 +
include/linux/skbuff.h | 3 +-
include/net/ipv6.h | 4 +-
init/Kconfig | 9 ++
kernel/auditsc.c | 2 +-
kernel/cfi.c | 22 +++-
kernel/dma/debug.c | 2 +-
kernel/sched/core.c | 36 +++++-
kernel/sched/sched.h | 5 +
kernel/trace/bpf_trace.c | 4 +-
lib/Kconfig | 3 +
lib/Makefile | 1 +
lib/crypto/Kconfig | 1 +
{crypto => lib}/memneq.c | 0
mm/backing-dev.c | 11 +-
net/appletalk/ddp.c | 3 +-
net/atm/common.c | 2 +-
net/ax25/af_ax25.c | 34 ++++-
net/bluetooth/af_bluetooth.c | 3 +-
net/bluetooth/hci_sock.c | 3 +-
net/caif/caif_socket.c | 2 +-
net/can/bcm.c | 5 +-
net/can/isotp.c | 4 +-
net/can/j1939/socket.c | 2 +-
net/can/raw.c | 6 +-
net/core/datagram.c | 5 +-
net/ieee802154/socket.c | 6 +-
net/ipv4/ping.c | 3 +-
net/ipv4/raw.c | 3 +-
net/ipv6/ip6_output.c | 6 +-
net/ipv6/raw.c | 3 +-
net/iucv/af_iucv.c | 3 +-
net/key/af_key.c | 2 +-
net/l2tp/l2tp_ip.c | 3 +-
net/l2tp/l2tp_ip6.c | 8 +-
net/l2tp/l2tp_ppp.c | 3 +-
net/mctp/af_mctp.c | 2 +-
net/mctp/test/route-test.c | 8 +-
net/netlink/af_netlink.c | 3 +-
net/netrom/af_netrom.c | 3 +-
net/nfc/llcp_sock.c | 3 +-
net/nfc/rawsock.c | 3 +-
net/packet/af_packet.c | 2 +-
net/phonet/datagram.c | 3 +-
net/phonet/pep.c | 6 +-
net/qrtr/af_qrtr.c | 3 +-
net/rose/af_rose.c | 3 +-
net/sunrpc/clnt.c | 1 +
net/unix/af_unix.c | 5 +-
net/vmw_vsock/vmci_transport.c | 5 +-
net/x25/af_x25.c | 3 +-
scripts/faddr2line | 45 +++++--
security/selinux/hooks.c | 11 +-
sound/hda/hdac_device.c | 1 +
sound/pci/hda/hda_intel.c | 3 +
sound/pci/hda/patch_hdmi.c | 1 +
sound/pci/hda/patch_realtek.c | 14 +++
sound/soc/codecs/cs35l36.c | 3 +-
sound/soc/codecs/cs42l51.c | 2 +-
sound/soc/codecs/cs42l52.c | 8 +-
sound/soc/codecs/cs42l56.c | 4 +-
sound/soc/codecs/cs53l30.c | 16 +--
sound/soc/codecs/es8328.c | 5 +-
sound/soc/codecs/nau8822.c | 4 +
sound/soc/codecs/nau8822.h | 3 +
sound/soc/codecs/wm8962.c | 1 +
sound/soc/codecs/wm_adsp.c | 2 +-
sound/soc/intel/boards/sof_cirrus_common.c | 40 +++++-
sound/soc/qcom/lpass-platform.c | 2 +-
tools/include/linux/objtool.h | 6 +
233 files changed, 1364 insertions(+), 902 deletions(-)Greg Kroah-Hartman
maintainerPATCH 1/141 Revert "drm/amd/display: Fix DCN3 B0 DP Alt Mapping"
From: Stylon Wang <[email protected]>
commit 1039188806d4cfdf9c412bb4ddb51b4d8cd15478 upstream.
This reverts commit 4b7786d87fb3adf3e534c4f1e4f824d8700b786b.
Commit 4b7786d87fb3 ("drm/amd/display: Fix DCN3 B0 DP Alt Mapping") is causing 2nd USB-C display not lighting up.
Phy id remapping is done differently than is assumed in this patch.
--- drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +0 -6
@@ -1392,12 +1392,6 @@ static struct stream_encoder *dcn31_strereturn NULL ; } -if (ctx->asic_id.chip_family ==FAMILY_YELLOW_CARP && - ctx->asic_id.hw_internal_rev ==YELLOW_CARP_B0 ) { -if ((eng_id ==ENGINE_ID_DIGC ) || (eng_id ==ENGINE_ID_DIGD )) - eng_id = eng_id +3 ;// For B0 only. C->F, D->G. - } - dcn30_dio_stream_encoder_construct(enc1, ctx, ctx->dc_bios, eng_id, vpg, afmt, &stream_enc_regs[eng_id],
Greg Kroah-Hartman
maintainerPATCH 2/141 arm64: dts: imx8mm-beacon: Enable RTS-CTS on UART3
In reply to Greg Kroah-HartmanFrom: Adam Ford <[email protected]>
commit 4ce01ce36d77137cf60776b320babed89de6bd4c upstream.
There is a header for a DB9 serial port, but any attempts to use hardware handshaking fail. Enable RTS and CTS pin muxing and enable handshaking in the uart node.
--- arch/arm64/boot/dts/freescale/imx8mm-beacon-baseboard.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/freescale/imx8mm-beacon-baseboard.dtsi +3 -0
@@ -278,6 +278,7 @@ pinctrl-0 = <&pinctrl_uart3>; assigned-clocks = <&clk IMX8MM_CLK_UART3>; assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_80M>; + uart-has-rtscts; status = "okay"; };
@@ -386,6 +387,8 @@ fsl,pins = < MX8MM_IOMUXC_ECSPI1_SCLK_UART3_DCE_RX 0x40 MX8MM_IOMUXC_ECSPI1_MOSI_UART3_DCE_TX 0x40 + MX8MM_IOMUXC_ECSPI1_MISO_UART3_DCE_CTS_B 0x40 + MX8MM_IOMUXC_ECSPI1_SS0_UART3_DCE_RTS_B 0x40 >; };
Greg Kroah-Hartman
maintainerPATCH 3/141 arm64: dts: imx8mn-beacon: Enable RTS-CTS on UART3
In reply to Greg Kroah-HartmanFrom: Adam Ford <[email protected]>
commit 5446ff1a67160ad92d9aae9530846aa54750be36 upstream.
There is a header for a DB9 serial port, but any attempts to use hardware handshaking fail. Enable RTS and CTS pin muxing and enable handshaking in the uart node.
--- arch/arm64/boot/dts/freescale/imx8mn-beacon-baseboard.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/freescale/imx8mn-beacon-baseboard.dtsi +3 -0
@@ -175,6 +175,7 @@ pinctrl-0 = <&pinctrl_uart3>; assigned-clocks = <&clk IMX8MN_CLK_UART3>; assigned-clock-parents = <&clk IMX8MN_SYS_PLL1_80M>; + uart-has-rtscts; status = "okay"; };
@@ -258,6 +259,8 @@ fsl,pins = < MX8MN_IOMUXC_ECSPI1_SCLK_UART3_DCE_RX 0x40 MX8MN_IOMUXC_ECSPI1_MOSI_UART3_DCE_TX 0x40 + MX8MN_IOMUXC_ECSPI1_MISO_UART3_DCE_CTS_B 0x40 + MX8MN_IOMUXC_ECSPI1_SS0_UART3_DCE_RTS_B 0x40 >; };
Greg Kroah-Hartman
maintainerPATCH 4/141 io_uring: reinstate the inflight tracking
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
commit 9cae36a094e7e9d6e5fe8b6dcd4642138b3eb0c7 upstream.
After some debugging, it was realized that we really do still need the old inflight tracking for any file type that has io_uring_fops assigned. If we don't, then trivial circular references will mean that we never get the ctx cleaned up and hence it'll leak.
Just bring back the inflight tracking, which then also means we can eliminate the conditional dropping of the file when task_work is queued.
--- fs/io_uring.c | 82 +++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 26 deletions(-)
fs/io_uring.c +56 -26
@@ -111,7 +111,8 @@ IOSQE_IO_DRAIN | IOSQE_CQE_SKIP_SUCCESS)#define IO_REQ_CLEAN_FLAGS (REQ_F_BUFFER_SELECTED | REQ_F_NEED_CLEANUP | \ - REQ_F_POLLED | REQ_F_CREDS | REQ_F_ASYNC_DATA) + REQ_F_POLLED | REQ_F_INFLIGHT | REQ_F_CREDS | \ + REQ_F_ASYNC_DATA)#define IO_TCTX_REFS_CACHE_NR (1U << 10)
@@ -493,6 +494,7 @@ struct io_uring_task {const struct io_ring_ctx *last;struct io_wq *io_wq;struct percpu_counter inflight; +atomic_t inflight_tracked;atomic_t in_idle;spinlock_t task_lock;
@@ -1186,8 +1188,6 @@ static void io_clean_op(struct io_kiocbstatic inline struct file *io_file_get_fixed (struct io_kiocb *req,int fd,unsigned issue_flags);static inline struct file *io_file_get_normal (struct io_kiocb *req,int fd); -static void io_drop_inflight_file (struct io_kiocb *req); -static bool io_assign_file (struct io_kiocb *req,unsigned int issue_flags);static void __io_queue_sqe (struct io_kiocb *req);static void io_rsrc_put_work (struct work_struct *work);
@@ -1435,9 +1435,29 @@ static bool io_match_task(struct io_kioc bool cancel_all) __must_hold(&req->ctx->timeout_lock) { +struct io_kiocb *req; +if (task && head->task != task)return false; -return cancel_all; +if (cancel_all) +return true; + +io_for_each_link (req, head) { +if (req->flags &REQ_F_INFLIGHT ) +return true; + } +return false; +} + +static bool io_match_linked (struct io_kiocb *head) +{ +struct io_kiocb *req; + +io_for_each_link (req, head) { +if (req->flags &REQ_F_INFLIGHT ) +return true; + } +return false; }/*
@@ -1447,9 +1467,24 @@ static bool io_match_task(struct io_kiocstatic bool io_match_task_safe (struct io_kiocb *head,struct task_struct *task,bool cancel_all) { +bool matched; +if (task && head->task != task)return false; -return cancel_all; +if (cancel_all) +return true; + +if (head->flags &REQ_F_LINK_TIMEOUT ) { +struct io_ring_ctx *ctx = head->ctx; + +/* protect against races with linked timeouts */ +spin_lock_irq (&ctx->timeout_lock); + matched =io_match_linked (head); +spin_unlock_irq (&ctx->timeout_lock); + }else { + matched =io_match_linked (head); + } +return matched; }static inline bool req_has_async_data (struct io_kiocb *req)
@@ -1608,6 +1643,14 @@ static inline bool io_req_ffs_set(structreturn req->flags &REQ_F_FIXED_FILE ; } +static inline void io_req_track_inflight (struct io_kiocb *req) +{ +if (!(req->flags &REQ_F_INFLIGHT )) { + req->flags |=REQ_F_INFLIGHT ; +atomic_inc (¤t->io_uring->inflight_tracked); + } +} +static struct io_kiocb *__io_prep_linked_timeout (struct io_kiocb *req) {if (WARN_ON_ONCE (!req->link))
@@ -2516,8 +2559,6 @@ static void io_req_task_work_add(structWARN_ON_ONCE (!tctx); -io_drop_inflight_file (req); -spin_lock_irqsave (&tctx->task_lock, flags);if (priority)wq_list_add_tail (&req->io_task_work.node, &tctx->prior_task_list);
@@ -5869,10 +5910,6 @@ static int io_poll_check_events(struct iif (!req->result) {struct poll_table_struct pt = { ._key = req->apoll_events }; -unsigned flags = locked ?0 :IO_URING_F_UNLOCKED ; - -if (unlikely (!io_assign_file (req, flags))) -return -EBADF ; req->result =vfs_poll (req->file, &pt) & req->apoll_events; }
@@ -7097,6 +7134,11 @@ static void io_clean_op(struct io_kiocbkfree (req->apoll); req->apoll =NULL ; } +if (req->flags &REQ_F_INFLIGHT ) { +struct io_uring_task *tctx = req->task->io_uring; + +atomic_dec (&tctx->inflight_tracked); + }if (req->flags &REQ_F_CREDS )put_cred (req->creds);if (req->flags &REQ_F_ASYNC_DATA ) {
@@ -7393,19 +7435,6 @@ out:return file; } -/* -* Drop the file for requeue operations. Only used of req->file is the -* io_uring descriptor itself. -*/ -static void io_drop_inflight_file (struct io_kiocb *req) -{ -if (unlikely (req->flags &REQ_F_INFLIGHT )) { -fput (req->file); - req->file =NULL ; - req->flags &= ~REQ_F_INFLIGHT ; - } -} -static struct file *io_file_get_normal (struct io_kiocb *req,int fd) {struct file *file =fget (fd);
@@ -7414,7 +7443,7 @@ static struct file *io_file_get_normal(s/* we don't allow fixed io_uring files */ if (file && file->f_op == &io_uring_fops) - req->flags |=REQ_F_INFLIGHT ; +io_req_track_inflight (req);return file; }
@@ -9211,6 +9240,7 @@ static __cold int io_uring_alloc_task_coxa_init (&tctx->xa);init_waitqueue_head (&tctx->wait);atomic_set (&tctx->in_idle,0 ); +atomic_set (&tctx->inflight_tracked,0 ); task->io_uring = tctx;spin_lock_init (&tctx->task_lock);INIT_WQ_LIST (&tctx->task_list);
@@ -10402,7 +10432,7 @@ static __cold void io_uring_clean_tctx(sstatic s64 tctx_inflight (struct io_uring_task *tctx,bool tracked) {if (tracked) -return 0 ; +return atomic_read (&tctx->inflight_tracked);return percpu_counter_sum (&tctx->inflight); }
Greg Kroah-Hartman
maintainerPATCH 5/141 powerpc/kasan: Silence KASAN warnings in __get_wchan()
In reply to Greg Kroah-HartmanFrom: He Ying <[email protected]>
[ Upstream commit a1b29ba2f2c171b9bea73be993bfdf0a62d37d15 ]
The following KASAN warning was reported in our kernel.
BUG: KASAN: stack-out-of-bounds in get_wchan+0x188/0x250
Read of size 4 at addr d216f958 by task ps/14437
CPU: 3 PID: 14437 Comm: ps Tainted: G O 5.10.0 #1
Call Trace:
[daa63858] [c0654348] dump_stack+0x9c/0xe4 (unreliable)
[daa63888] [c035cf0c] print_address_description.constprop.3+0x8c/0x570
[daa63908] [c035d6bc] kasan_report+0x1ac/0x218
[daa63948] [c00496e8] get_wchan+0x188/0x250
[daa63978] [c0461ec8] do_task_stat+0xce8/0xe60
[daa63b98] [c0455ac8] proc_single_show+0x98/0x170
[daa63bc8] [c03cab8c] seq_read_iter+0x1ec/0x900
[daa63c38] [c03cb47c] seq_read+0x1dc/0x290
[daa63d68] [c037fc94] vfs_read+0x164/0x510
[daa63ea8] [c03808e4] ksys_read+0x144/0x1d0
[daa63f38] [c005b1dc] ret_from_syscall+0x0/0x38
--- interrupt: c00 at 0x8fa8f4
LR = 0x8fa8cc
The buggy address belongs to the page:
page:98ebcdd2 refcount:0 mapcount:0 mapping:00000000 index:0x2 pfn:0x1216f
flags: 0x0()
raw: 00000000 00000000 01010122 00000000 00000002 00000000 ffffffff 00000000
raw: 00000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
d216f800: 00 00 00 00 00 f1 f1 f1 f1 00 00 00 00 00 00 00
d216f880: f2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>d216f900: 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00
^
d216f980: f2 f2 f2 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00
d216fa00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00After looking into this issue, I find the buggy address belongs to the task stack region. It seems KASAN has something wrong. I look into the code of __get_wchan in x86 architecture and find the same issue has been resolved by the commit f7d27c35ddff ("x86/mm, kasan: Silence KASAN warnings in get_wchan()"). The solution could be applied to powerpc architecture too.
As Andrey Ryabinin said, get_wchan() is racy by design, it may access volatile stack of running task, thus it may access redzone in a stack frame and cause KASAN to warn about this.
Use READ_ONCE_NOCHECK() to silence these warnings.
--- arch/powerpc/kernel/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/process.c +2 -2
@@ -2160,12 +2160,12 @@ static unsigned long ___get_wchan(struct task_struct *p)return 0 ; do { - sp = *(unsigned long *)sp; + sp = READ_ONCE_NOCHECK(*(unsigned long *)sp); if (!validate_sp(sp, p, STACK_FRAME_OVERHEAD) || task_is_running(p)) return 0; if (count > 0) { - ip = ((unsigned long *)sp)[STACK_FRAME_LR_SAVE]; + ip = READ_ONCE_NOCHECK(((unsigned long *)sp)[STACK_FRAME_LR_SAVE]); if (!in_sched_functions(ip)) return ip; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 6/141 ASoC: nau8822: Add operation for internal PLL off and on
In reply to Greg Kroah-HartmanFrom: Hui Wang <[email protected]>
[ Upstream commit aeca8a3295022bcec46697f16e098140423d8463 ]
We tried to enable the audio on an imx6sx EVB with the codec nau8822, after setting the internal PLL fractional parameters, the audio still couldn't work and the there was no sdma irq at all.
After checking with the section "8.1.1 Phase Locked Loop (PLL) Design Example" of "NAU88C22 Datasheet Rev 0.6", we found we need to turn off the PLL before programming fractional parameters and turn on the PLL after programming.
After this change, the audio driver could record and play sound and the sdma's irq is triggered when playing or recording.
--- sound/soc/codecs/nau8822.c | 4 ++++ sound/soc/codecs/nau8822.h | 3 +++ 2 files changed, 7 insertions(+)
sound/soc/codecs/nau8822.c +4 -0
@@ -740,6 +740,8 @@ static int nau8822_set_pll(struct snd_soc_dai *dai, int pll_id, int source, pll_param->pll_int, pll_param->pll_frac, pll_param->mclk_scaler, pll_param->pre_factor); +snd_soc_component_update_bits (component, +NAU8822_REG_POWER_MANAGEMENT_1 ,NAU8822_PLL_EN_MASK ,NAU8822_PLL_OFF ); snd_soc_component_update_bits(component, NAU8822_REG_PLL_N, NAU8822_PLLMCLK_DIV2 | NAU8822_PLLN_MASK, (pll_param->pre_factor ? NAU8822_PLLMCLK_DIV2 : 0) |
@@ -757,6 +759,8 @@ static int nau8822_set_pll(struct snd_soc_dai *dai, int pll_id, int source, pll_param->mclk_scaler << NAU8822_MCLKSEL_SFT);snd_soc_component_update_bits (component,NAU8822_REG_CLOCKING ,NAU8822_CLKM_MASK ,NAU8822_CLKM_PLL ); +snd_soc_component_update_bits (component, +NAU8822_REG_POWER_MANAGEMENT_1 ,NAU8822_PLL_EN_MASK ,NAU8822_PLL_ON );return 0 ; }
sound/soc/codecs/nau8822.h +3 -0
@@ -90,6 +90,9 @@#define NAU8822_REFIMP_3K 0x3#define NAU8822_IOBUF_EN (0x1 << 2)#define NAU8822_ABIAS_EN (0x1 << 3) +#define NAU8822_PLL_EN_MASK (0x1 << 5) +#define NAU8822_PLL_ON (0x1 << 5) +#define NAU8822_PLL_OFF (0x0 << 5)/* NAU8822_REG_AUDIO_INTERFACE (0x4) */ #define NAU8822_AIFMT_MASK (0x3 << 3)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 7/141 ASoC: qcom: lpass-platform: Update VMA access permissions in mmap callback
In reply to Greg Kroah-HartmanFrom: Srinivasa Rao Mandadapu <[email protected]>
[ Upstream commit ef8d89b83bf453ea9cc3c4873a84b50ff334f797 ]
Replace page protection permissions from noncashed to writecombine, in lpass codec DMA path mmp callabck, to support 64 bit chromeOS. Avoid SIGBUS error in userspace caused by noncached permissions in 64 bit chromeOS.
--- sound/soc/qcom/lpass-platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/qcom/lpass-platform.c +1 -1
@@ -898,7 +898,7 @@ static int lpass_platform_cdc_dma_mmap(struct snd_pcm_substream *substream,struct snd_pcm_runtime *runtime = substream->runtime;unsigned long size, offset; - vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot); + vma->vm_page_prot =pgprot_writecombine (vma->vm_page_prot); size = vma->vm_end - vma->vm_start; offset = vma->vm_pgoff <<PAGE_SHIFT ; return io_remap_pfn_range(vma, vma->vm_start,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 8/141 drm/amd/display: Read Golden Settings Table from VBIOS
In reply to Greg Kroah-HartmanFrom: Sherry Wang <[email protected]>
[ Upstream commit 4b81dd2cc6f4f4e8cea0ed6ee8d5193a8ae14a72 ]
[Why]
Dmub read AUX_DPHY_RX_CONTROL0 from Golden Setting Table, but driver will set it to default value 0x103d1110, which causes issue in some case
[How]
Remove the driver code, use the value set by dmub in dp_aux_init
--- drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dio_link_encoder.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dio_link_encoder.c +1 -3
@@ -230,9 +230,7 @@ static void enc31_hw_init(struct link_encoder *enc)AUX_RX_PHASE_DETECT_LEN, [21,20] = 0x3 default is 3 AUX_RX_DETECTION_THRESHOLD [30:28] = 1 */ -AUX_REG_WRITE (AUX_DPHY_RX_CONTROL0 ,0x103d1110 ); - -AUX_REG_WRITE (AUX_DPHY_TX_CONTROL ,0x21c7a ); +// dmub will read AUX_DPHY_RX_CONTROL0/AUX_DPHY_TX_CONTROL from vbios table in dp_aux_init //AUX_DPHY_TX_REF_CONTROL'AUX_TX_REF_DIV HW default is 0x32; // Set AUX_TX_REF_DIV Divider to generate 2 MHz reference from refclk
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 9/141 drm/amdgpu: Resolve RAS GFX error count issue after cold boot on Arcturus
In reply to Greg Kroah-HartmanFrom: Candice Li <[email protected]>
[ Upstream commit 2a460963350ec6b1534d28d7f943b5f84815aff2 ]
Adjust the sequence for ras late init and separate ras reset error status from query status.
v2: squash in fix from Candice
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 9 ++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 27 ++++++++++++++++++++----- 2 files changed, 28 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +6 -3
@@ -625,17 +625,20 @@ int amdgpu_get_gfx_off_status(struct amdgpu_device *adev, uint32_t *value)int amdgpu_gfx_ras_late_init (struct amdgpu_device *adev,struct ras_common_if *ras_block) {int r; - r =amdgpu_ras_block_late_init (adev, ras_block); -if (r) -return r;if (amdgpu_ras_is_supported (adev, ras_block->block)) {if (!amdgpu_persistent_edc_harvesting_supported (adev))amdgpu_ras_reset_error_status (adev,AMDGPU_RAS_BLOCK__GFX ); + r =amdgpu_ras_block_late_init (adev, ras_block); +if (r) +return r; + r =amdgpu_irq_get (adev, &adev->gfx.cp_ecc_error_irq,0 );if (r) goto late_fini; + }else { +amdgpu_ras_feature_enable_on_boot (adev, ras_block,0 ); }return 0 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +22 -5
@@ -195,6 +195,13 @@ static ssize_t amdgpu_ras_debugfs_read(struct file *f, char __user *buf,if (amdgpu_ras_query_error_status (obj->adev, &info))return -EINVAL ; +/* Hardware counter will be reset automatically after the query on Vega20 and Arcturus */ +if (obj->adev->ip_versions[MP0_HWIP ][0 ] !=IP_VERSION (11 ,0 ,2 ) && + obj->adev->ip_versions[MP0_HWIP ][0 ] !=IP_VERSION (11 ,0 ,4 )) { +if (amdgpu_ras_reset_error_status (obj->adev, info.head.block)) +dev_warn (obj->adev->dev,"Failed to reset error counter and error status" ); + } + s =snprintf (val,sizeof (val),"%s: %lu\n%s: %lu\n" ,"ue" , info.ue_count,"ce" , info.ce_count);
@@ -548,9 +555,10 @@ static ssize_t amdgpu_ras_sysfs_read(struct device *dev,if (amdgpu_ras_query_error_status (obj->adev, &info))return -EINVAL ; -if (obj->adev->asic_type ==CHIP_ALDEBARAN ) { +if (obj->adev->ip_versions[MP0_HWIP ][0 ] !=IP_VERSION (11 ,0 ,2 ) && + obj->adev->ip_versions[MP0_HWIP ][0 ] !=IP_VERSION (11 ,0 ,4 )) {if (amdgpu_ras_reset_error_status (obj->adev, info.head.block)) -DRM_WARN ("Failed to reset error counter and error status" ); +dev_warn (obj->adev->dev,"Failed to reset error counter and error status" ); } return sysfs_emit(buf, "%s: %lu\n%s: %lu\n", "ue", info.ue_count,
@@ -1023,9 +1031,6 @@ int amdgpu_ras_query_error_status(struct amdgpu_device *adev, } } -if (!amdgpu_persistent_edc_harvesting_supported (adev)) -amdgpu_ras_reset_error_status (adev, info->head.block); -return 0 ; }
@@ -1145,6 +1150,12 @@ int amdgpu_ras_query_error_count(struct amdgpu_device *adev,if (res)return res; +if (adev->ip_versions[MP0_HWIP ][0 ] !=IP_VERSION (11 ,0 ,2 ) && + adev->ip_versions[MP0_HWIP ][0 ] !=IP_VERSION (11 ,0 ,4 )) { +if (amdgpu_ras_reset_error_status (adev, info.head.block)) +dev_warn (adev->dev,"Failed to reset error counter and error status" ); + } + ce += info.ce_count; ue += info.ue_count; }
@@ -1705,6 +1716,12 @@ static void amdgpu_ras_log_on_err_counter(struct amdgpu_device *adev)continue ;amdgpu_ras_query_error_status (adev, &info); + +if (adev->ip_versions[MP0_HWIP ][0 ] !=IP_VERSION (11 ,0 ,2 ) && + adev->ip_versions[MP0_HWIP ][0 ] !=IP_VERSION (11 ,0 ,4 )) { +if (amdgpu_ras_reset_error_status (adev, info.head.block)) +dev_warn (adev->dev,"Failed to reset error counter and error status" ); + } } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 10/141 drm/amdkfd: Use mmget_not_zero in MMU notifier
In reply to Greg Kroah-HartmanFrom: Philip Yang <[email protected]>
[ Upstream commit fa582c6f3684ac0098a9d02ddf0ed52a02b37127 ]
MMU notifier callback may pass in mm with mm->mm_users==0 when process is exiting, use mmget_no_zero to avoid accessing invalid mm in deferred list work after mm is gone.
--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +3 -0
@@ -2286,6 +2286,8 @@ svm_range_cpu_invalidate_pagetables(struct mmu_interval_notifier *mni,if (range->event ==MMU_NOTIFY_RELEASE )return true; +if (!mmget_not_zero (mni->mm)) +return true; start = mni->interval_tree.start; last = mni->interval_tree.last;
@@ -2312,6 +2314,7 @@ svm_range_cpu_invalidate_pagetables(struct mmu_interval_notifier *mni, }svm_range_unlock (prange); +mmput (mni->mm);return true; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 11/141 dma-debug: make things less spammy under memory pressure
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
[ Upstream commit e19f8fa6ce1ca9b8b934ba7d2e8f34c95abc6e60 ]
Limit the error msg to avoid flooding the console. If you have a lot of threads hitting this at once, they could have already gotten passed the dma_debug_disabled() check before they get to the point of allocation failure, resulting in quite a lot of this error message spamming the log. Use pr_err_once() to limit that.
--- kernel/dma/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/debug.c +1 -1
@@ -564,7 +564,7 @@ static void add_dma_entry(struct dma_debug_entry *entry, unsigned long attrs) rc =active_cacheline_insert (entry);if (rc == -ENOMEM ) { -pr_err ("cacheline tracking ENOMEM, dma-debug disabled\n" ); +pr_err_once ("cacheline tracking ENOMEM, dma-debug disabled\n" ); global_disable = true; }else if (rc == -EEXIST && !(attrs &DMA_ATTR_SKIP_CPU_SYNC )) { err_printk(entry->dev, entry,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 12/141 ASoC: Intel: cirrus-common: fix incorrect channel mapping
In reply to Greg Kroah-HartmanFrom: xliu <[email protected]>
[ Upstream commit d69a155555c9d57463b788c400f6b452d976bacd ]
The default mapping of ASPRX1 (DAC source) is slot 0. Change the slot mapping of right amplifiers (WR and TR) to slot 1 to receive right channel data. Also update the ACPI instance ID mapping according to HW configuration.
--- sound/soc/intel/boards/sof_cirrus_common.c | 40 +++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-)
sound/soc/intel/boards/sof_cirrus_common.c +36 -4
@@ -54,22 +54,29 @@ static struct snd_soc_dai_link_component cs35l41_components[] = { }, }; +/* +* Mapping between ACPI instance id and speaker position. +* +* Four speakers: +* 0: Tweeter left, 1: Woofer left +* 2: Tweeter right, 3: Woofer right +*/ static struct snd_soc_codec_conf cs35l41_codec_conf[] = { { .dlc =COMP_CODEC_CONF (CS35L41_DEV0_NAME ), - .name_prefix ="WL" , + .name_prefix ="TL" , }, { .dlc =COMP_CODEC_CONF (CS35L41_DEV1_NAME ), - .name_prefix ="WR" , + .name_prefix ="WL" , }, { .dlc =COMP_CODEC_CONF (CS35L41_DEV2_NAME ), - .name_prefix ="TL" , + .name_prefix ="TR" , }, { .dlc =COMP_CODEC_CONF (CS35L41_DEV3_NAME ), - .name_prefix ="TR" , + .name_prefix ="WR" , }, };
@@ -101,6 +108,21 @@ static int cs35l41_init(struct snd_soc_pcm_runtime *rtd)return ret; } +/* +* Channel map: +* +* TL/WL: ASPRX1 on slot 0, ASPRX2 on slot 1 (default) +* TR/WR: ASPRX1 on slot 1, ASPRX2 on slot 0 +*/ +static const struct { +unsigned int rx[2 ]; +} cs35l41_channel_map[] = { + {.rx = {0 ,1 }},/* TL */ + {.rx = {0 ,1 }},/* WL */ + {.rx = {1 ,0 }},/* TR */ + {.rx = {1 ,0 }},/* WR */ +}; +static int cs35l41_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params) {
@@ -134,6 +156,16 @@ static int cs35l41_hw_params(struct snd_pcm_substream *substream, ret);return ret; } + +/* setup channel map */ + ret =snd_soc_dai_set_channel_map (codec_dai,0 ,NULL , +ARRAY_SIZE (cs35l41_channel_map[i].rx), + (unsigned int *)cs35l41_channel_map[i].rx); +if (ret <0 ) { +dev_err (codec_dai->dev,"fail to set channel map, ret %d\n" , + ret); +return ret; + } }return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 13/141 ASoC: cs42l52: Fix TLV scales for mixer controls
In reply to Greg Kroah-HartmanFrom: Charles Keepax <[email protected]>
[ Upstream commit 8bf5aabf524eec61013e506f764a0b2652dc5665 ]
The datasheet specifies the range of the mixer volumes as between -51.5dB and 12dB with a 0.5dB step. Update the TLVs for this.
--- sound/soc/codecs/cs42l52.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/cs42l52.c +2 -2
@@ -137,7 +137,7 @@ static DECLARE_TLV_DB_SCALE(mic_tlv, 1600, 100, 0); static DECLARE_TLV_DB_SCALE(pga_tlv, -600, 50, 0); -static DECLARE_TLV_DB_SCALE(mix_tlv, -50, 50, 0); +static DECLARE_TLV_DB_SCALE(mix_tlv, -5150, 50, 0); static DECLARE_TLV_DB_SCALE(beep_tlv, -56, 200, 0);
@@ -364,7 +364,7 @@ static const struct snd_kcontrol_new cs42l52_snd_controls[] = { CS42L52_ADCB_VOL, 0, 0xA0, 0x78, ipd_tlv),SOC_DOUBLE_R_SX_TLV ("ADC Mixer Volume" ,CS42L52_ADCA_MIXER_VOL ,CS42L52_ADCB_MIXER_VOL , -0 ,0x19 ,0x7F , ipd_tlv), +0 ,0x19 ,0x7F , mix_tlv), SOC_DOUBLE("ADC Switch", CS42L52_ADC_MISC_CTL, 0, 1, 1, 0),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 14/141 ASoC: cs35l36: Update digital volume TLV
In reply to Greg Kroah-HartmanFrom: Charles Keepax <[email protected]>
[ Upstream commit 5005a2345825eb8346546d99bfe669f73111b5c5 ]
The digital volume TLV specifies the step as 0.25dB but the actual step of the control is 0.125dB. Update the TLV to correct this.
--- sound/soc/codecs/cs35l36.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/codecs/cs35l36.c +2 -1
@@ -444,7 +444,8 @@ static bool cs35l36_volatile_reg(struct device *dev, unsigned int reg) } } -static DECLARE_TLV_DB_SCALE(dig_vol_tlv, -10200, 25, 0); +static const DECLARE_TLV_DB_RANGE(dig_vol_tlv, 0, 912, + TLV_DB_MINMAX_ITEM(-10200, 1200)); static DECLARE_TLV_DB_SCALE(amp_gain_tlv, 0, 1, 1);static const char *const cs35l36_pcm_sftramp_text[] = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 15/141 ASoC: cs53l30: Correct number of volume levels on SX controls
In reply to Greg Kroah-HartmanFrom: Charles Keepax <[email protected]>
[ Upstream commit 7fbd6dd68127927e844912a16741016d432a0737 ]
This driver specified the maximum value rather than the number of volume levels on the SX controls, this is incorrect, so correct them.
--- sound/soc/codecs/cs53l30.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
sound/soc/codecs/cs53l30.c +8 -8
@@ -348,22 +348,22 @@ static const struct snd_kcontrol_new cs53l30_snd_controls[] = {SOC_ENUM ("ADC2 NG Delay" , adc2_ng_delay_enum),SOC_SINGLE_SX_TLV ("ADC1A PGA Volume" , -CS53L30_ADC1A_AFE_CTL ,0 ,0x34 ,0x18 , pga_tlv), +CS53L30_ADC1A_AFE_CTL ,0 ,0x34 ,0x24 , pga_tlv),SOC_SINGLE_SX_TLV ("ADC1B PGA Volume" , -CS53L30_ADC1B_AFE_CTL ,0 ,0x34 ,0x18 , pga_tlv), +CS53L30_ADC1B_AFE_CTL ,0 ,0x34 ,0x24 , pga_tlv),SOC_SINGLE_SX_TLV ("ADC2A PGA Volume" , -CS53L30_ADC2A_AFE_CTL ,0 ,0x34 ,0x18 , pga_tlv), +CS53L30_ADC2A_AFE_CTL ,0 ,0x34 ,0x24 , pga_tlv),SOC_SINGLE_SX_TLV ("ADC2B PGA Volume" , -CS53L30_ADC2B_AFE_CTL ,0 ,0x34 ,0x18 , pga_tlv), +CS53L30_ADC2B_AFE_CTL ,0 ,0x34 ,0x24 , pga_tlv),SOC_SINGLE_SX_TLV ("ADC1A Digital Volume" , -CS53L30_ADC1A_DIG_VOL ,0 ,0xA0 ,0x0C , dig_tlv), +CS53L30_ADC1A_DIG_VOL ,0 ,0xA0 ,0x6C , dig_tlv),SOC_SINGLE_SX_TLV ("ADC1B Digital Volume" , -CS53L30_ADC1B_DIG_VOL ,0 ,0xA0 ,0x0C , dig_tlv), +CS53L30_ADC1B_DIG_VOL ,0 ,0xA0 ,0x6C , dig_tlv),SOC_SINGLE_SX_TLV ("ADC2A Digital Volume" , -CS53L30_ADC2A_DIG_VOL ,0 ,0xA0 ,0x0C , dig_tlv), +CS53L30_ADC2A_DIG_VOL ,0 ,0xA0 ,0x6C , dig_tlv),SOC_SINGLE_SX_TLV ("ADC2B Digital Volume" , - CS53L30_ADC2B_DIG_VOL, 0, 0xA0, 0x0C, dig_tlv), + CS53L30_ADC2B_DIG_VOL, 0, 0xA0, 0x6C, dig_tlv), }; static const struct snd_soc_dapm_widget cs53l30_dapm_widgets[] = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 16/141 ASoC: cs42l52: Correct TLV for Bypass Volume
In reply to Greg Kroah-HartmanFrom: Charles Keepax <[email protected]>
[ Upstream commit 91e90c712fade0b69cdff7cc6512f6099bd18ae5 ]
The Bypass Volume is accidentally using a -6dB minimum TLV rather than the correct -60dB minimum. Add a new TLV to correct this.
--- sound/soc/codecs/cs42l52.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/codecs/cs42l52.c +3 -1
@@ -137,6 +137,8 @@ static DECLARE_TLV_DB_SCALE(mic_tlv, 1600, 100, 0); static DECLARE_TLV_DB_SCALE(pga_tlv, -600, 50, 0); +static DECLARE_TLV_DB_SCALE(pass_tlv, -6000, 50, 0); + static DECLARE_TLV_DB_SCALE(mix_tlv, -5150, 50, 0); static DECLARE_TLV_DB_SCALE(beep_tlv, -56, 200, 0);
@@ -351,7 +353,7 @@ static const struct snd_kcontrol_new cs42l52_snd_controls[] = { CS42L52_SPKB_VOL, 0, 0x40, 0xC0, hl_tlv),SOC_DOUBLE_R_SX_TLV ("Bypass Volume" ,CS42L52_PASSTHRUA_VOL , -CS42L52_PASSTHRUB_VOL ,0 ,0x88 ,0x90 , pga_tlv), +CS42L52_PASSTHRUB_VOL ,0 ,0x88 ,0x90 , pass_tlv), SOC_DOUBLE("Bypass Mute", CS42L52_MISC_CTL, 4, 5, 1, 0),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 17/141 ASoC: cs42l56: Correct typo in minimum level for SX volume controls
In reply to Greg Kroah-HartmanFrom: Charles Keepax <[email protected]>
[ Upstream commit a8928ada9b96944cadd8b65d191e33199fd38782 ]
A couple of the SX volume controls specify 0x84 as the lowest volume value, however the correct value from the datasheet is 0x44. The datasheet don't include spaces in the value it displays as binary so this was almost certainly just a typo reading 1000100.
--- sound/soc/codecs/cs42l56.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/cs42l56.c +2 -2
@@ -391,9 +391,9 @@ static const struct snd_kcontrol_new cs42l56_snd_controls[] = {SOC_DOUBLE ("ADC Boost Switch" ,CS42L56_GAIN_BIAS_CTL ,3 ,2 ,1 ,1 ),SOC_DOUBLE_R_SX_TLV ("Headphone Volume" ,CS42L56_HPA_VOLUME , -CS42L56_HPB_VOLUME ,0 ,0x84 ,0x48 , hl_tlv), +CS42L56_HPB_VOLUME ,0 ,0x44 ,0x48 , hl_tlv),SOC_DOUBLE_R_SX_TLV ("LineOut Volume" ,CS42L56_LOA_VOLUME , -CS42L56_LOB_VOLUME ,0 ,0x84 ,0x48 , hl_tlv), +CS42L56_LOB_VOLUME ,0 ,0x44 ,0x48 , hl_tlv),SOC_SINGLE_TLV ("Bass Shelving Volume" ,CS42L56_TONE_CTL , 0, 0x00, 1, tone_tlv),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 18/141 ASoC: cs42l51: Correct minimum value for SX volume control
In reply to Greg Kroah-HartmanFrom: Charles Keepax <[email protected]>
[ Upstream commit fcb3b5a58926d16d9a338841b74af06d4c29be15 ]
The minimum value for the PGA Volume is given as 0x1A, however the values from there to 0x19 are all the same volume and this is not represented in the TLV structure. The number of volumes given is correct so this leads to all the volumes being shifted. Move the minimum value up to 0x19 to fix this.
--- sound/soc/codecs/cs42l51.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/cs42l51.c +1 -1
@@ -146,7 +146,7 @@ static const struct snd_kcontrol_new cs42l51_snd_controls[] = { 0, 0xA0, 96, adc_att_tlv),SOC_DOUBLE_R_SX_TLV ("PGA Volume" ,CS42L51_ALC_PGA_CTL ,CS42L51_ALC_PGB_CTL , -0 ,0x1A ,30 , pga_tlv), +0 ,0x19 ,30 , pga_tlv),SOC_SINGLE ("Playback Deemphasis Switch" ,CS42L51_DAC_CTL ,3 ,1 ,0 ),SOC_SINGLE ("Auto-Mute Switch" ,CS42L51_DAC_CTL ,2 ,1 ,0 ), SOC_SINGLE("Soft Ramp Switch", CS42L51_DAC_CTL, 1, 1, 0),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 19/141 drm/amdkfd: add pinned BOs to kfd_bo_list
In reply to Greg Kroah-HartmanFrom: Lang Yu <[email protected]>
[ Upstream commit 4fac4fcf4500bce515b0f32195e7bb86aa0246c6 ]
The kfd_bo_list is used to restore process BOs after evictions. As page tables could be destroyed during evictions, we should also update pinned BOs' page tables during restoring to make sure they are valid.
So for pinned BOs,
1, Validate them and update their page tables. 2, Don't add eviction fence for them.
v2:
- Don't handle pinned ones specially in BO validation.(Felix)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +6 -7
@@ -1955,9 +1955,6 @@ int amdgpu_amdkfd_gpuvm_map_gtt_bo_to_kernel(struct amdgpu_device *adev,return -EINVAL ; } -/* delete kgd_mem from kfd_bo_list to avoid re-validating -* this BO in BO's restoring after eviction. -*/ mutex_lock (&mem->process_info->lock); ret =amdgpu_bo_reserve (bo, true);
@@ -1980,7 +1977,6 @@ int amdgpu_amdkfd_gpuvm_map_gtt_bo_to_kernel(struct amdgpu_device *adev,amdgpu_amdkfd_remove_eviction_fence ( bo, mem->process_info->eviction_fence); -list_del_init (&mem->validate_list.head);if (size) *size =amdgpu_bo_size (bo);
@@ -2544,12 +2540,15 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info, struct dma_fence **ef) process_info->eviction_fence = new_fence; *ef =dma_fence_get (&new_fence->base); -/* Attach new eviction fence to all BOs */ +/* Attach new eviction fence to all BOs except pinned ones */ list_for_each_entry (mem, &process_info->kfd_bo_list, - validate_list.head) + validate_list.head) { +if (mem->bo->tbo.pin_count) +continue ; +amdgpu_bo_fence (mem->bo, &process_info->eviction_fence->base, true); - + }/* Attach eviction fence to PD / PT BOs */ list_for_each_entry (peer_vm, &process_info->vm_list_head, vm_list_node) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 20/141 ata: libata-core: fix NULL pointer deref in ata_host_alloc_pinfo()
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit bf476fe22aa1851bab4728e0c49025a6a0bea307 ]
In an unlikely (and probably wrong?) case that the 'ppi' parameter of ata_host_alloc_pinfo() points to an array starting with a NULL pointer, there's going to be a kernel oops as the 'pi' local variable won't get reassigned from the initial value of NULL. Initialize 'pi' instead to '&ata_dummy_port_info' to fix the possible kernel oops for good...
Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool.
--- drivers/ata/libata-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ata/libata-core.c +2 -2
@@ -5506,7 +5506,7 @@ struct ata_host *ata_host_alloc_pinfo(struct device *dev, const struct ata_port_info * const * ppi, int n_ports) { -const struct ata_port_info *pi; +const struct ata_port_info *pi = &ata_dummy_port_info;struct ata_host *host;int i, j;
@@ -5514,7 +5514,7 @@ struct ata_host *ata_host_alloc_pinfo(struct device *dev,if (!host)return NULL ; -for (i =0 , j =0 , pi =NULL ; i < host->n_ports; i++) { +for (i =0 , j =0 ; i < host->n_ports; i++) {struct ata_port *ap = host->ports[i];if (ppi[j])
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 21/141 quota: Prevent memory allocation recursion while holding dq_lock
In reply to Greg Kroah-HartmanFrom: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit 537e11cdc7a6b3ce94fa25ed41306193df9677b7 ]
As described in commit 02117b8ae9c0 ("f2fs: Set GF_NOFS in read_cache_page_gfp while doing f2fs_quota_read"), we must not enter filesystem reclaim while holding the dq_lock. Prevent this more generally by using memalloc_nofs_save() while holding the lock.
--- fs/quota/dquot.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/quota/dquot.c +10 -0
@@ -79,6 +79,7 @@#include <linux/capability.h> #include <linux/quotaops.h> #include <linux/blkdev.h> +#include <linux/sched/mm.h> #include "../internal.h" /* ugh */ #include <linux/uaccess.h>
@@ -425,9 +426,11 @@ EXPORT_SYMBOL(mark_info_dirty);int dquot_acquire (struct dquot *dquot) {int ret =0 , ret2 =0 ; +unsigned int memalloc;struct quota_info *dqopt =sb_dqopt (dquot->dq_sb);mutex_lock (&dquot->dq_lock); + memalloc =memalloc_nofs_save ();if (!test_bit (DQ_READ_B , &dquot->dq_flags)) { ret = dqopt->ops[dquot->dq_id.type]->read_dqblk (dquot);if (ret <0 )
@@ -458,6 +461,7 @@ int dquot_acquire(struct dquot *dquot)smp_mb__before_atomic ();set_bit (DQ_ACTIVE_B , &dquot->dq_flags); out_iolock: +memalloc_nofs_restore (memalloc);mutex_unlock (&dquot->dq_lock);return ret; }
@@ -469,9 +473,11 @@ EXPORT_SYMBOL(dquot_acquire);int dquot_commit (struct dquot *dquot) {int ret =0 ; +unsigned int memalloc;struct quota_info *dqopt =sb_dqopt (dquot->dq_sb);mutex_lock (&dquot->dq_lock); + memalloc =memalloc_nofs_save ();if (!clear_dquot_dirty (dquot)) goto out_lock;/* Inactive dquot can be only if there was error during read/init
@@ -481,6 +487,7 @@ int dquot_commit(struct dquot *dquot)else ret = -EIO ; out_lock: +memalloc_nofs_restore (memalloc);mutex_unlock (&dquot->dq_lock);return ret; }
@@ -492,9 +499,11 @@ EXPORT_SYMBOL(dquot_commit);int dquot_release (struct dquot *dquot) {int ret =0 , ret2 =0 ; +unsigned int memalloc;struct quota_info *dqopt =sb_dqopt (dquot->dq_sb);mutex_lock (&dquot->dq_lock); + memalloc =memalloc_nofs_save ();/* Check whether we are not racing with some other dqget() */ if (dquot_is_busy (dquot)) goto out_dqlock;
@@ -510,6 +519,7 @@ int dquot_release(struct dquot *dquot) }clear_bit (DQ_ACTIVE_B , &dquot->dq_flags); out_dqlock: +memalloc_nofs_restore (memalloc);mutex_unlock (&dquot->dq_lock);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 22/141 ASoC: wm8962: Fix suspend while playing music
In reply to Greg Kroah-HartmanFrom: Adam Ford <[email protected]>
[ Upstream commit d1f5272c0f7d2e53c6f2480f46725442776f5f78 ]
If the audio CODEC is playing sound when the system is suspended, it can be left in a state which throws the following error:
wm8962 3-001a: ASoC: error at soc_component_read_no_lock on wm8962.3-001a: -16
Once this error has occurred, the audio will not work again until rebooted.
Fix this by configuring SET_SYSTEM_SLEEP_PM_OPS.
--- sound/soc/codecs/wm8962.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/wm8962.c +1 -0
@@ -3871,6 +3871,7 @@ static int wm8962_runtime_suspend(struct device *dev)#endif static const struct dev_pm_ops wm8962_pm = { + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)SET_RUNTIME_PM_OPS (wm8962_runtime_suspend, wm8962_runtime_resume,NULL ) };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 23/141 ASoC: es8328: Fix event generation for deemphasis control
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 8259610c2ec01c5cbfb61882ae176aabacac9c19 ]
Currently the put() method for the deemphasis control returns 0 when a new value is written to the control even if the value changed, meaning events are not generated. Fix this, skip the work of updating the value when it is unchanged and then return 1 after having done so.
--- sound/soc/codecs/es8328.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/codecs/es8328.c +4 -1
@@ -161,13 +161,16 @@ static int es8328_put_deemph(struct snd_kcontrol *kcontrol,if (deemph >1 )return -EINVAL ; +if (es8328->deemph == deemph) +return 0 ; + ret =es8328_set_deemph (component);if (ret <0 )return ret; es8328->deemph = deemph; -return 0 ; +return 1 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 24/141 ASoC: wm_adsp: Fix event generation for wm_adsp_fw_put()
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 2abdf9f80019e8244d3806ed0e1c9f725e50b452 ]
Currently wm_adsp_fw_put() returns 0 rather than 1 when updating the value of the control, meaning that no event is generated to userspace. Fix this by setting the default return value to 1, the code already exits early with a return value of 0 if the value is unchanged.
--- sound/soc/codecs/wm_adsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm_adsp.c +1 -1
@@ -333,7 +333,7 @@ int wm_adsp_fw_put(struct snd_kcontrol *kcontrol,struct snd_soc_component *component =snd_soc_kcontrol_component (kcontrol);struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;struct wm_adsp *dsp =snd_soc_component_get_drvdata (component); -int ret =0 ; +int ret =1 ;if (ucontrol->value.enumerated.item[0 ] == dsp[e->shift_l].fw)return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 25/141 ALSA: hda: MTL: add HD Audio PCI ID and HDMI codec vendor ID
In reply to Greg Kroah-HartmanFrom: Yong Zhi <[email protected]>
[ Upstream commit 2e45f2185283a2d927ef2cdbdc246cd65740c8df ]
Add HD Audio PCI ID for Intel Meteorlake platform.
[ corrected the hex number to lower letters by tiwai ]
--- sound/pci/hda/hda_intel.c | 3 +++ sound/pci/hda/patch_hdmi.c | 1 + 2 files changed, 4 insertions(+)
sound/pci/hda/hda_intel.c +3 -0
@@ -2525,6 +2525,9 @@ static const struct pci_device_id azx_ids[] = { .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, { PCI_DEVICE(0x8086, 0x51cf), .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, + /* Meteorlake-P */ + { PCI_DEVICE(0x8086, 0x7e28), + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, /* Broxton-P(Apollolake) */ { PCI_DEVICE(0x8086, 0x5a98), .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON },
sound/pci/hda/patch_hdmi.c +1 -0
@@ -4554,6 +4554,7 @@ HDA_CODEC_ENTRY(0x8086281a, "Jasperlake HDMI", patch_i915_icl_hdmi),HDA_CODEC_ENTRY (0x8086281b ,"Elkhartlake HDMI" , patch_i915_icl_hdmi),HDA_CODEC_ENTRY (0x8086281c ,"Alderlake-P HDMI" , patch_i915_adlp_hdmi),HDA_CODEC_ENTRY (0x8086281f ,"Raptorlake-P HDMI" , patch_i915_adlp_hdmi), +HDA_CODEC_ENTRY (0x8086281d ,"Meteorlake HDMI" , patch_i915_adlp_hdmi),HDA_CODEC_ENTRY (0x80862880 ,"CedarTrail HDMI" , patch_generic_hdmi),HDA_CODEC_ENTRY (0x80862882 ,"Valleyview2 HDMI" , patch_i915_byt_hdmi), HDA_CODEC_ENTRY(0x80862883, "Braswell HDMI", patch_i915_byt_hdmi),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 26/141 Input: soc_button_array - also add Lenovo Yoga Tablet2 1051F to dmi_use_low_level_irq
In reply to Greg Kroah-HartmanFrom: Marius Hoch <[email protected]>
[ Upstream commit 6ab2e51898cd4343bbdf8587af8ce8fbabddbcb5 ]
Commit 223f61b8c5ad ("Input: soc_button_array - add Lenovo Yoga Tablet2 1051L to the dmi_use_low_level_irq list") added the 1051L to this list already, but the same problem applies to the 1051F. As there are no further 1051 variants (just the F/L), we can just DMI match 1051.
Tested on a Lenovo Yoga Tablet2 1051F: Without this patch the home-button stops working after a wakeup from suspend.
--- drivers/input/misc/soc_button_array.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/misc/soc_button_array.c +2 -2
@@ -85,13 +85,13 @@ static const struct dmi_system_id dmi_use_low_level_irq[] = { }, { /* - * Lenovo Yoga Tab2 1051L, something messes with the home-button + * Lenovo Yoga Tab2 1051F/1051L, something messes with the home-button * IRQ settings, leading to a non working home-button. */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "60073"), - DMI_MATCH(DMI_PRODUCT_VERSION, "1051L"), + DMI_MATCH(DMI_PRODUCT_VERSION, "1051"), }, }, {} /* Terminating entry */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 27/141 scsi: vmw_pvscsi: Expand vcpuHint to 16 bits
In reply to Greg Kroah-HartmanFrom: Wentao Wang <[email protected]>
[ Upstream commit cf71d59c2eceadfcde0fb52e237990a0909880d7 ]
vcpuHint has been expanded to 16 bit on host to enable routing to more CPUs. Guest side should align with the change. This change has been tested with hosts with 8-bit and 16-bit vcpuHint, on both platforms host side can get correct value.
--- drivers/scsi/vmw_pvscsi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/vmw_pvscsi.h +2 -2
@@ -331,8 +331,8 @@ struct PVSCSIRingReqDesc {u8 tag;u8 bus;u8 target; -u8 vcpuHint; -u8 unused[59 ]; +u16 vcpuHint; +u8 unused[58 ]; } __packed;/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 28/141 scsi: lpfc: Resolve NULL ptr dereference after an ELS LOGO is aborted
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit b1b3440f437b75fb2a9b0cfe58df461e40eca474 ]
A use-after-free crash can occur after an ELS LOGO is aborted.
Specifically, a nodelist structure is freed and then ndlp->vport->cfg_log_verbose is dereferenced in lpfc_nlp_get() when the discovery state machine is mistakenly called a second time with NLP_EVT_DEVICE_RM argument.
Rework lpfc_cmpl_els_logo() to prevent the duplicate calls to release a nodelist structure.
--- drivers/scsi/lpfc/lpfc_els.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +9 -9
@@ -3035,18 +3035,10 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,spin_unlock_irq (&ndlp->lock);lpfc_disc_state_machine (vport, ndlp, cmdiocb,NLP_EVT_DEVICE_RM ); -lpfc_els_free_iocb (phba, cmdiocb); -lpfc_nlp_put (ndlp); - -/* Presume the node was released. */ -return ; + goto out_rsrc_free; } out: -/* Driver is done with the IO. */ -lpfc_els_free_iocb (phba, cmdiocb); -lpfc_nlp_put (ndlp); -/* At this point, the LOGO processing is complete. NOTE: For a * pt2pt topology, we are assuming the NPortID will only change * on link up processing. For a LOGO / PLOGI initiated by the
@@ -3073,6 +3065,10 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ndlp->nlp_DID, ulp_status, ulp_word4, tmo, vport->num_disc_nodes); + +lpfc_els_free_iocb (phba, cmdiocb); +lpfc_nlp_put (ndlp); +lpfc_disc_start (vport);return ; }
@@ -3089,6 +3085,10 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,lpfc_disc_state_machine (vport, ndlp, cmdiocb,NLP_EVT_DEVICE_RM ); } +out_rsrc_free: +/* Driver is done with the I/O. */ +lpfc_els_free_iocb (phba, cmdiocb); +lpfc_nlp_put (ndlp); }/**
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 29/141 scsi: lpfc: Fix port stuck in bypassed state after LIP in PT2PT topology
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit 336d63615466b4c06b9401c987813fd19bdde39b ]
After issuing a LIP, a specific target vendor does not ACC the FLOGI that lpfc sends. However, it does send its own FLOGI that lpfc ACCs. The target then establishes the port IDs by sending a PLOGI. lpfc PLOGI_ACCs and starts the RPI registration for DID 0x000001. The target then sends a LOGO to the fabric DID. lpfc is currently treating the LOGO from the fabric DID as a link down and cleans up all the ndlps. The ndlp for DID 0x000001 is put back into NPR and discovery stops, leaving the port in stuck in bypassed mode.
Change lpfc behavior such that if a LOGO is received for the fabric DID in PT2PT topology skip the lpfc_linkdown_port() routine and just move the fabric DID back to NPR.
--- drivers/scsi/lpfc/lpfc_nportdisc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_nportdisc.c +2 -1
@@ -835,7 +835,8 @@ lpfc_rcv_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,lpfc_nvmet_invalidate_host (phba, ndlp);if (ndlp->nlp_DID == Fabric_DID) { -if (vport->port_state <=LPFC_FDISC ) +if (vport->port_state <=LPFC_FDISC || + vport->fc_flag &FC_PT2PT ) goto out;lpfc_linkdown_port (vport);spin_lock_irq (shost->host_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 30/141 scsi: lpfc: Allow reduced polling rate for nvme_admin_async_event cmd completion
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit 2e7e9c0c1ec05f18d320ecc8a31eec59d2af1af9 ]
NVMe Asynchronous Event Request commands have no command timeout value per specifications.
Set WQE option to allow a reduced FLUSH polling rate for I/O error detection specifically for nvme_admin_async_event commands.
--- drivers/scsi/lpfc/lpfc_hw4.h | 3 +++ drivers/scsi/lpfc/lpfc_nvme.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_hw4.h +3 -0
@@ -4488,6 +4488,9 @@ struct wqe_common {#define wqe_sup_SHIFT 6#define wqe_sup_MASK 0x00000001#define wqe_sup_WORD word11 +#define wqe_ffrq_SHIFT 6 +#define wqe_ffrq_MASK 0x00000001 +#define wqe_ffrq_WORD word11#define wqe_wqec_SHIFT 7#define wqe_wqec_MASK 0x00000001#define wqe_wqec_WORD word11
drivers/scsi/lpfc/lpfc_nvme.c +9 -2
@@ -1194,7 +1194,8 @@ lpfc_nvme_prep_io_cmd(struct lpfc_vport *vport, {struct lpfc_hba *phba = vport->phba;struct nvmefc_fcp_req *nCmd = lpfc_ncmd->nvmeCmd; -struct lpfc_iocbq *pwqeq = &(lpfc_ncmd->cur_iocbq); +struct nvme_common_command *sqe; +struct lpfc_iocbq *pwqeq = &lpfc_ncmd->cur_iocbq;union lpfc_wqe128 *wqe = &pwqeq->wqe;uint32_t req_len;
@@ -1251,8 +1252,14 @@ lpfc_nvme_prep_io_cmd(struct lpfc_vport *vport, cstat->control_requests++; } -if (pnode->nlp_nvme_info &NLP_NVME_NSLER ) +if (pnode->nlp_nvme_info &NLP_NVME_NSLER ) {bf_set (wqe_erp, &wqe->generic.wqe_com,1 ); + sqe = &((struct nvme_fc_cmd_iu *) + nCmd->cmdaddr)->sqe.common; +if (sqe->opcode == nvme_admin_async_event) +bf_set (wqe_ffrq, &wqe->generic.wqe_com,1 ); + } +/* * Finish initializing those WQE fields that are independent * of the nvme_cmnd request_buffer
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 31/141 scsi: mpt3sas: Fix out-of-bounds compiler warning
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
[ Upstream commit 120f1d95efb1cdb6fe023c84e38ba06d8f78cd03 ]
I'm facing this warning when building for the parisc64 architecture:
drivers/scsi/mpt3sas/mpt3sas_base.c: In function ‘_base_make_ioc_operational’:drivers/scsi/mpt3sas/mpt3sas_base.c:5396:40: warning: array subscript ‘Mpi2SasIOUnitPage1_t {aka struct _MPI2_CONFIG_PAGE_SASIOUNIT_1}[0]’ is partly outside array bounds of ‘unsigned char[20]’ [-Warray-bounds]
5396 | (le16_to_cpu(sas_iounit_pg1->SASWideMaxQueueDepth)) ?drivers/scsi/mpt3sas/mpt3sas_base.c:5382:26: note: referencing an object of size 20 allocated by ‘kzalloc’
5382 | sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
| ^~~~~~~~~~~~~~~~~~~~~~~The problem is, that only 20 bytes are allocated with kmalloc(), which is sufficient to hold the bytes which are needed. Nevertheless, gcc complains because the whole Mpi2SasIOUnitPage1_t struct is 32 bytes in size and thus doesn't fit into those 20 bytes.
This patch simply allocates all 32 bytes (instead of 20) and thus avoids the warning. There is no functional change introduced by this patch.
While touching the code I cleaned up to calculation of max_wideport_qd, max_narrowport_qd and max_sata_qd to make it easier readable.
Test successfully tested on a HP C8000 PA-RISC workstation with 64-bit kernel.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +12 -11
@@ -5368,6 +5368,7 @@ static int _base_assign_fw_reported_qd(struct MPT3SAS_ADAPTER *ioc)Mpi2ConfigReply_t mpi_reply;Mpi2SasIOUnitPage1_t *sas_iounit_pg1 =NULL ;Mpi26PCIeIOUnitPage1_t pcie_iounit_pg1; +u16 depth;int sz;int rc =0 ;
@@ -5379,7 +5380,7 @@ static int _base_assign_fw_reported_qd(struct MPT3SAS_ADAPTER *ioc) goto out;/* sas iounit page 1 */ sz = offsetof(Mpi2SasIOUnitPage1_t , PhyData); - sas_iounit_pg1 =kzalloc (sz,GFP_KERNEL ); + sas_iounit_pg1 =kzalloc (sizeof (Mpi2SasIOUnitPage1_t),GFP_KERNEL );if (!sas_iounit_pg1) {pr_err ("%s: failure at %s:%d/%s()!\n" , ioc->name, __FILE__, __LINE__, __func__);
@@ -5392,16 +5393,16 @@ static int _base_assign_fw_reported_qd(struct MPT3SAS_ADAPTER *ioc) ioc->name, __FILE__, __LINE__, __func__); goto out; } - ioc->max_wideport_qd = - (le16_to_cpu (sas_iounit_pg1->SASWideMaxQueueDepth)) ? -le16_to_cpu (sas_iounit_pg1->SASWideMaxQueueDepth) : -MPT3SAS_SAS_QUEUE_DEPTH ; - ioc->max_narrowport_qd = - (le16_to_cpu (sas_iounit_pg1->SASNarrowMaxQueueDepth)) ? -le16_to_cpu (sas_iounit_pg1->SASNarrowMaxQueueDepth) : -MPT3SAS_SAS_QUEUE_DEPTH ; - ioc->max_sata_qd = (sas_iounit_pg1->SATAMaxQDepth) ? - sas_iounit_pg1->SATAMaxQDepth :MPT3SAS_SATA_QUEUE_DEPTH ; + + depth =le16_to_cpu (sas_iounit_pg1->SASWideMaxQueueDepth); + ioc->max_wideport_qd = (depth ? depth :MPT3SAS_SAS_QUEUE_DEPTH ); + + depth =le16_to_cpu (sas_iounit_pg1->SASNarrowMaxQueueDepth); + ioc->max_narrowport_qd = (depth ? depth :MPT3SAS_SAS_QUEUE_DEPTH ); + + depth = sas_iounit_pg1->SATAMaxQDepth; + ioc->max_sata_qd = (depth ? depth :MPT3SAS_SATA_QUEUE_DEPTH ); +/* pcie iounit page 1 */ rc =mpt3sas_config_get_pcie_iounit_pg1 (ioc, &mpi_reply, &pcie_iounit_pg1,sizeof (Mpi26PCIeIOUnitPage1_t));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 32/141 scsi: ipr: Fix missing/incorrect resource cleanup in error case
In reply to Greg Kroah-HartmanFrom: Chengguang Xu <[email protected]>
[ Upstream commit d64c491911322af1dcada98e5b9ee0d87e8c8fee ]
Fix missing resource cleanup (when '(--i) == 0') for error case in ipr_alloc_mem() and skip incorrect resource cleanup (when '(--i) == 0') for error case in ipr_request_other_msi_irqs() because variable i started from 1.
--- drivers/scsi/ipr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/ipr.c +2 -2
@@ -9795,7 +9795,7 @@ static int ipr_alloc_mem(struct ipr_ioa_cfg *ioa_cfg) GFP_KERNEL);if (!ioa_cfg->hrrq[i].host_rrq) { -while (--i >0 ) +while (--i >=0 ) dma_free_coherent(&pdev->dev, sizeof(u32) * ioa_cfg->hrrq[i].size, ioa_cfg->hrrq[i].host_rrq,
@@ -10068,7 +10068,7 @@ static int ipr_request_other_msi_irqs(struct ipr_ioa_cfg *ioa_cfg, ioa_cfg->vectors_info[i].desc, &ioa_cfg->hrrq[i]);if (rc) { -while (--i >=0 ) +while (--i >0 )free_irq (pci_irq_vector (pdev, i), &ioa_cfg->hrrq[i]);return rc;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 33/141 scsi: pmcraid: Fix missing resource cleanup in error case
In reply to Greg Kroah-HartmanFrom: Chengguang Xu <[email protected]>
[ Upstream commit ec1e8adcbdf661c57c395bca342945f4f815add7 ]
Fix missing resource cleanup (when '(--i) == 0') for error case in pmcraid_register_interrupt_handler().
--- drivers/scsi/pmcraid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/pmcraid.c +1 -1
@@ -4031,7 +4031,7 @@ pmcraid_register_interrupt_handler(struct pmcraid_instance *pinstance)return 0 ; out_unwind: -while (--i >0 ) +while (--i >=0 )free_irq (pci_irq_vector (pdev, i), &pinstance->hrrq_vector[i]);pci_free_irq_vectors (pdev);return rc;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 34/141 ALSA: hda/realtek - Add HW8326 support
In reply to Greg Kroah-HartmanFrom: huangwenhui <[email protected]>
[ Upstream commit 527f4643e03c298c1e3321cfa27866b1374a55e1 ]
Added the support of new Huawei codec HW8326. The HW8326 is developed by Huawei with Realtek's IP Core, and it's compatible with ALC256.
--- sound/hda/hdac_device.c | 1 + sound/pci/hda/patch_realtek.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+)
sound/hda/hdac_device.c +1 -0
@@ -660,6 +660,7 @@ static const struct hda_vendor_id hda_vendor_ids[] = { { 0x14f1, "Conexant" }, { 0x17e8, "Chrontel" }, { 0x1854, "LG" }, + { 0x19e5, "Huawei" }, { 0x1aec, "Wolfson Microelectronics" }, { 0x1af4, "QEMU" }, { 0x434d, "C-Media" },
sound/pci/hda/patch_realtek.c +14 -0
@@ -443,6 +443,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)case 0x10ec0245 :case 0x10ec0255 :case 0x10ec0256 : +case 0x19e58326 :case 0x10ec0257 :case 0x10ec0282 :case 0x10ec0283 :
@@ -580,6 +581,7 @@ static void alc_shutup_pins(struct hda_codec *codec)switch (codec->core.vendor_id) {case 0x10ec0236 :case 0x10ec0256 : +case 0x19e58326 :case 0x10ec0283 :case 0x10ec0286 :case 0x10ec0288 :
@@ -3247,6 +3249,7 @@ static void alc_disable_headset_jack_key(struct hda_codec *codec)case 0x10ec0230 :case 0x10ec0236 :case 0x10ec0256 : +case 0x19e58326 :alc_write_coef_idx (codec,0x48 ,0x0 );alc_update_coef_idx (codec,0x49 ,0x0045 ,0x0 );break ;
@@ -3275,6 +3278,7 @@ static void alc_enable_headset_jack_key(struct hda_codec *codec)case 0x10ec0230 :case 0x10ec0236 :case 0x10ec0256 : +case 0x19e58326 :alc_write_coef_idx (codec,0x48 ,0xd011 );alc_update_coef_idx (codec,0x49 ,0x007f ,0x0045 );break ;
@@ -4910,6 +4914,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)case 0x10ec0230 :case 0x10ec0236 :case 0x10ec0256 : +case 0x19e58326 :alc_process_coef_fw (codec, coef0256);break ;case 0x10ec0234 :
@@ -5025,6 +5030,7 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,case 0x10ec0230 :case 0x10ec0236 :case 0x10ec0256 : +case 0x19e58326 :alc_write_coef_idx (codec,0x45 ,0xc489 );snd_hda_set_pin_ctl_cache (codec, hp_pin,0 );alc_process_coef_fw (codec, coef0256);
@@ -5175,6 +5181,7 @@ static void alc_headset_mode_default(struct hda_codec *codec)case 0x10ec0230 :case 0x10ec0236 :case 0x10ec0256 : +case 0x19e58326 :alc_write_coef_idx (codec,0x1b ,0x0e4b );alc_write_coef_idx (codec,0x45 ,0xc089 );msleep (50 );
@@ -5274,6 +5281,7 @@ static void alc_headset_mode_ctia(struct hda_codec *codec)case 0x10ec0230 :case 0x10ec0236 :case 0x10ec0256 : +case 0x19e58326 :alc_process_coef_fw (codec, coef0256);break ;case 0x10ec0234 :
@@ -5388,6 +5396,7 @@ static void alc_headset_mode_omtp(struct hda_codec *codec)case 0x10ec0230 :case 0x10ec0236 :case 0x10ec0256 : +case 0x19e58326 :alc_process_coef_fw (codec, coef0256);break ;case 0x10ec0234 :
@@ -5489,6 +5498,7 @@ static void alc_determine_headset_type(struct hda_codec *codec)case 0x10ec0230 :case 0x10ec0236 :case 0x10ec0256 : +case 0x19e58326 :alc_write_coef_idx (codec,0x1b ,0x0e4b );alc_write_coef_idx (codec,0x06 ,0x6104 );alc_write_coefex_idx (codec,0x57 ,0x3 ,0x09a3 );
@@ -5783,6 +5793,7 @@ static void alc255_set_default_jack_type(struct hda_codec *codec)case 0x10ec0230 :case 0x10ec0236 :case 0x10ec0256 : +case 0x19e58326 :alc_process_coef_fw (codec, alc256fw);break ; }
@@ -6385,6 +6396,7 @@ static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)case 0x10ec0236 :case 0x10ec0255 :case 0x10ec0256 : +case 0x19e58326 :alc_update_coef_idx (codec,0x1b ,0x8000 ,1 <<15 );/* Reset HP JD */ alc_update_coef_idx (codec,0x1b ,0x8000 ,0 <<15 );break ;
@@ -10149,6 +10161,7 @@ static int patch_alc269(struct hda_codec *codec)case 0x10ec0230 :case 0x10ec0236 :case 0x10ec0256 : +case 0x19e58326 : spec->codec_variant =ALC269_TYPE_ALC256 ; spec->shutup = alc256_shutup; spec->init_hook = alc256_init;
@@ -11599,6 +11612,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = {HDA_CODEC_ENTRY (0x10ec0b00 ,"ALCS1200A" , patch_alc882),HDA_CODEC_ENTRY (0x10ec1168 ,"ALC1220" , patch_alc882),HDA_CODEC_ENTRY (0x10ec1220 ,"ALC1220" , patch_alc882), + HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269), {} /* terminator */ };MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_realtek);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 35/141 virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed
In reply to Greg Kroah-HartmanFrom: chengkaitao <[email protected]>
[ Upstream commit a58a7f97ba11391d2d0d408e0b24f38d86ae748e ]
The reference must be released when device_register(&vm_cmdline_parent) failed. Add the corresponding 'put_device()' in the error handling path.
Message-Id: <[email protected]>
--- drivers/virtio/virtio_mmio.c | 1 + 1 file changed, 1 insertion(+)
drivers/virtio/virtio_mmio.c +1 -0
@@ -688,6 +688,7 @@ static int vm_cmdline_set(const char *device,if (!vm_cmdline_parent_registered) { err =device_register (&vm_cmdline_parent);if (err) { +put_device (&vm_cmdline_parent);pr_err ("Failed to register parent device!\n" );return err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 36/141 nfc: nfcmrvl: Fix memory leak in nfcmrvl_play_deferred
In reply to Greg Kroah-HartmanFrom: Xiaohui Zhang <[email protected]>
[ Upstream commit 8a4d480702b71184fabcf379b80bf7539716752e ]
Similar to the handling of play_deferred in commit 19cfe912c37b ("Bluetooth: btusb: Fix memory leak in play_deferred"), we thought a patch might be needed here as well.
Currently usb_submit_urb is called directly to submit deferred tx urbs after unanchor them.
So the usb_giveback_urb_bh would failed to unref it in usb_unanchor_urb and cause memory leak.
Put those urbs in tx_anchor to avoid the leak, and also fix the error handling.
--- drivers/nfc/nfcmrvl/usb.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/nfc/nfcmrvl/usb.c +14 -2
@@ -388,13 +388,25 @@ static void nfcmrvl_play_deferred(struct nfcmrvl_usb_drv_data *drv_data)int err;while ((urb =usb_get_from_anchor (&drv_data->deferred))) { +usb_anchor_urb (urb, &drv_data->tx_anchor); + err =usb_submit_urb (urb,GFP_ATOMIC ); -if (err) +if (err) { +kfree (urb->setup_packet); +usb_unanchor_urb (urb); +usb_free_urb (urb);break ; + } drv_data->tx_in_flight++; +usb_free_urb (urb); + } + +/* Cleanup the rest deferred urbs. */ +while ((urb =usb_get_from_anchor (&drv_data->deferred))) { +kfree (urb->setup_packet); +usb_free_urb (urb); } -usb_scuttle_anchored_urbs (&drv_data->deferred); }static int nfcmrvl_resume (struct usb_interface *intf)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 37/141 ipv6: Fix signed integer overflow in __ip6_append_data
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit f93431c86b631bbca5614c66f966bf3ddb3c2803 ]
Resurrect ubsan overflow checks and ubsan report this warning, fix it by change the variable [length] type to size_t.
UBSAN: signed-integer-overflow in net/ipv6/ip6_output.c:1489:19 2147479552 + 8567 cannot be represented in type 'int' CPU: 0 PID: 253 Comm: err Not tainted 5.16.0+ #1 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0x214/0x230 show_stack+0x30/0x78 dump_stack_lvl+0xf8/0x118 dump_stack+0x18/0x30 ubsan_epilogue+0x18/0x60 handle_overflow+0xd0/0xf0 __ubsan_handle_add_overflow+0x34/0x44 __ip6_append_data.isra.48+0x1598/0x1688 ip6_append_data+0x128/0x260 udpv6_sendmsg+0x680/0xdd0 inet6_sendmsg+0x54/0x90 sock_sendmsg+0x70/0x88 ____sys_sendmsg+0xe8/0x368 ___sys_sendmsg+0x98/0xe0 __sys_sendmmsg+0xf4/0x3b8 __arm64_sys_sendmmsg+0x34/0x48 invoke_syscall+0x64/0x160 el0_svc_common.constprop.4+0x124/0x300 do_el0_svc+0x44/0xc8 el0_svc+0x3c/0x1e8 el0t_64_sync_handler+0x88/0xb0 el0t_64_sync+0x16c/0x170
Changes since v1:
-Change the variable [length] type to unsigned, as Eric Dumazet suggested. Changes since v2:
-Don't change exthdrlen type in ip6_make_skb, as Paolo Abeni suggested. Changes since v3:
-Don't change ulen type in udpv6_sendmsg and l2tp_ip6_sendmsg, as Jakub Kicinski suggested.
--- include/net/ipv6.h | 4 ++-- net/ipv6/ip6_output.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
include/net/ipv6.h +2 -2
@@ -1019,7 +1019,7 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr);int ip6_append_data (struct sock *sk,int getfrag (void *from,char *to,int offset,int len,int odd,struct sk_buff *skb), -void *from,int length,int transhdrlen, +void *from,size_t length,int transhdrlen,struct ipcm6_cookie *ipc6,struct flowi6 *fl6,struct rt6_info *rt,unsigned int flags);
@@ -1035,7 +1035,7 @@ struct sk_buff *__ip6_make_skb(struct sock *sk, struct sk_buff_head *queue,struct sk_buff *ip6_make_skb (struct sock *sk,int getfrag (void *from,char *to,int offset,int len,int odd,struct sk_buff *skb), -void *from,int length,int transhdrlen, +void *from,size_t length,int transhdrlen,struct ipcm6_cookie *ipc6,struct rt6_info *rt,unsigned int flags,struct inet_cork_full *cork);
net/ipv6/ip6_output.c +3 -3
@@ -1428,7 +1428,7 @@ static int __ip6_append_data(struct sock *sk,struct page_frag *pfrag, int getfrag(void *from, char *to, int offset,int len,int odd,struct sk_buff *skb), - void *from, int length, int transhdrlen, + void *from, size_t length, int transhdrlen, unsigned int flags, struct ipcm6_cookie *ipc6) { struct sk_buff *skb, *skb_prev = NULL;
@@ -1776,7 +1776,7 @@ static int __ip6_append_data(struct sock *sk,int ip6_append_data (struct sock *sk,int getfrag (void *from,char *to,int offset,int len,int odd,struct sk_buff *skb), -void *from,int length,int transhdrlen, +void *from,size_t length,int transhdrlen,struct ipcm6_cookie *ipc6,struct flowi6 *fl6,struct rt6_info *rt,unsigned int flags) {
@@ -1973,7 +1973,7 @@ EXPORT_SYMBOL_GPL(ip6_flush_pending_frames);struct sk_buff *ip6_make_skb (struct sock *sk,int getfrag (void *from,char *to,int offset,int len,int odd,struct sk_buff *skb), -void *from,int length,int transhdrlen, +void *from,size_t length,int transhdrlen,struct ipcm6_cookie *ipc6,struct rt6_info *rt,unsigned int flags,struct inet_cork_full *cork) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 38/141 ipv6: Fix signed integer overflow in l2tp_ip6_sendmsg
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit f638a84afef3dfe10554c51820c16e39a278c915 ]
When len >= INT_MAX - transhdrlen, ulen = len + transhdrlen will be overflow. To fix, we can follow what udpv6 does and subtract the transhdrlen from the max.
--- net/l2tp/l2tp_ip6.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/l2tp/l2tp_ip6.c +3 -2
@@ -502,14 +502,15 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)struct ipcm6_cookie ipc6;int addr_len = msg->msg_namelen;int transhdrlen =4 ;/* zero session-id */ -int ulen = len + transhdrlen; +int ulen;int err;/* Rough check on arithmetic overflow, * better check is made in ip6_append_data(). */ -if (len >INT_MAX ) +if (len >INT_MAX - transhdrlen)return -EMSGSIZE ; + ulen = len + transhdrlen;/* Mirror BSD error message compatibility */ if (msg->msg_flags &MSG_OOB )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 39/141 net: ethernet: mtk_eth_soc: fix misuse of mem alloc interface netdev[napi]_alloc_frag
In reply to Greg Kroah-HartmanFrom: Chen Lin <[email protected]>
[ Upstream commit 2f2c0d2919a14002760f89f4e02960c735a316d2 ]
When rx_flag == MTK_RX_FLAGS_HWLRO,rx_data_len = MTK_MAX_LRO_RX_LENGTH(4096 * 3) > PAGE_SIZE. netdev_alloc_frag is for alloction of page fragment only. Reference to other drivers and Documentation/vm/page_frags.rst
Branch to use __get_free_pages when ring->frag_size > PAGE_SIZE.
--- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +19 -2
@@ -778,6 +778,17 @@ static inline bool mtk_rx_get_desc(struct mtk_rx_dma *rxd,return true; } +static void *mtk_max_lro_buf_alloc (gfp_t gfp_mask) +{ +unsigned int size =mtk_max_frag_size (MTK_MAX_LRO_RX_LENGTH ); +unsigned long data; + + data =__get_free_pages (gfp_mask | __GFP_COMP | __GFP_NOWARN, +get_order (size)); + +return (void *)data; +} +/* the qdma core needs scratch memory to be setup */ static int mtk_init_fq_dma (struct mtk_eth *eth) {
@@ -1269,7 +1280,10 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, goto release_desc;/* alloc new buffer */ - new_data =napi_alloc_frag (ring->frag_size); +if (ring->frag_size <=PAGE_SIZE ) + new_data =napi_alloc_frag (ring->frag_size); +else + new_data =mtk_max_lro_buf_alloc (GFP_ATOMIC );if (unlikely (!new_data)) { netdev->stats.rx_dropped++; goto release_desc;
@@ -1683,7 +1697,10 @@ static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag)return -ENOMEM ;for (i =0 ; i < rx_dma_size; i++) { - ring->data[i] =netdev_alloc_frag (ring->frag_size); +if (ring->frag_size <=PAGE_SIZE ) + ring->data[i] =netdev_alloc_frag (ring->frag_size); +else + ring->data[i] =mtk_max_lro_buf_alloc (GFP_KERNEL );if (!ring->data[i])return -ENOMEM ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 40/141 gcc-12: disable -Wdangling-pointer warning for now
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
[ Upstream commit 49beadbd47c270a00754c107a837b4f29df4c822 ]
While the concept of checking for dangling pointers to local variables at function exit is really interesting, the gcc-12 implementation is not compatible with reality, and results in false positives.
For example, gcc sees us putting things on a local list head allocated on the stack, which involves exactly those kinds of pointers to the local stack entry:
In function ‘__list_add’,
inlined from ‘list_add_tail’ at include/linux/list.h:102:2,
inlined from ‘rebuild_snap_realms’ at fs/ceph/snap.c:434:2:
include/linux/list.h:74:19: warning: storing the address of local variable ‘realm_queue’ in ‘*&realm_27(D)->rebuild_item.prev’ [-Wdangling-pointer=]
74 | new->prev = prev;
| ~~~~~~~~~~^~~~~~But then gcc - understandably - doesn't really understand the big picture how the doubly linked list works, so doesn't see how we then end up emptying said list head in a loop and the pointer we added has been removed.
Gcc also complains about us (intentionally) using this as a way to store a kind of fake stack trace, eg
drivers/acpi/acpica/utdebug.c:40:38: warning: storing the address of local variable ‘current_sp’ in ‘acpi_gbl_entry_stack_pointer’ [-Wdangling-pointer=]
40 | acpi_gbl_entry_stack_pointer = ¤t_sp;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~which is entirely reasonable from a compiler standpoint, and we may want to change those kinds of patterns, but not not.
So this is one of those "it would be lovely if the compiler were to complain about us leaving dangling pointers to the stack", but not this way.
--- Makefile | 3 +++ 1 file changed, 3 insertions(+)
Makefile +3 -0
@@ -804,6 +804,9 @@ endif KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) +# These result in bogus false positives +KBUILD_CFLAGS += $(call cc-disable-warning, dangling-pointer) + ifdef CONFIG_FRAME_POINTER KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls else
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 41/141 mellanox: mlx5: avoid uninitialized variable warning with gcc-12
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
[ Upstream commit 842c3b3ddc5f4d17275edbaa09e23d712bf8b915 ]
gcc-12 started warning about 'tracker' being used uninitialized:
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c: In function ‘mlx5_do_bond’:
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c:786:28: warning: ‘tracker’ is used uninitialized [-Wuninitialized]
786 | struct lag_tracker tracker;
| ^~~~~~~which seems to be because it doesn't track how the use (and initialization) is bound by the 'do_bond' flag.
But admittedly that 'do_bond' usage is fairly complicated, and involves passing it around as an argument to helper functions, so it's somewhat understandable that gcc doesn't see how that all works.
This function could be rewritten to make the use of that tracker variable more obviously safe, but for now I'm just adding the forced initialization of it.
--- drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +1 -1
@@ -561,7 +561,7 @@ static void mlx5_do_bond(struct mlx5_lag *ldev) {struct mlx5_core_dev *dev0 = ldev->pf[MLX5_LAG_P1 ].dev;struct mlx5_core_dev *dev1 = ldev->pf[MLX5_LAG_P2 ].dev; -struct lag_tracker tracker; +struct lag_tracker tracker = { };bool do_bond, roce_lag;int err;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 42/141 gcc-12: disable -Warray-bounds universally for now
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
[ Upstream commit f0be87c42cbd341d436d06da4792e6b0c83c3aeb ]
In commit 8b202ee21839 ("s390: disable -Warray-bounds") the s390 people disabled the '-Warray-bounds' warning for gcc-12, because the new logic in gcc would cause warnings for their use of the S390_lowcore macro, which accesses absolute pointers.
It turns out gcc-12 has many other issues in this area, so this takes that s390 warning disable logic, and turns it into a kernel build config entry instead.
Part of the intent is that we can make this all much more targeted, and use this conflig flag to disable it in only particular configurations that cause problems, with the s390 case as an example:
select GCC12_NO_ARRAY_BOUNDS
and we could do that for other configuration cases that cause issues.
Or we could possibly use the CONFIG_CC_NO_ARRAY_BOUNDS thing in a more targeted way, and disable the warning only for particular uses: again the s390 case as an example:
KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_CC_NO_ARRAY_BOUNDS),-Wno-array-bounds)
but this ends up just doing it globally in the top-level Makefile, since the current issues are spread fairly widely all over:
KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds
We'll try to limit this later, since the gcc-12 problems are rare enough that *much* of the kernel can be built with it without disabling this warning.
--- Makefile | 1 + arch/s390/Kconfig | 1 + arch/s390/Makefile | 10 +--------- init/Kconfig | 9 +++++++++ 4 files changed, 12 insertions(+), 9 deletions(-)
Makefile +1 -0
@@ -787,6 +787,7 @@ stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) := -fstack-protector-strong KBUILD_CFLAGS += $(stackp-flags-y) KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror +KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH) ifdef CONFIG_CC_IS_CLANG
arch/s390/Kconfig +1 -0
@@ -125,6 +125,7 @@ config S390 select CLONE_BACKWARDS2 select DMA_OPS if PCI select DYNAMIC_FTRACE if FUNCTION_TRACER + select GCC12_NO_ARRAY_BOUNDS select GENERIC_ALLOCATOR select GENERIC_CPU_AUTOPROBE select GENERIC_CPU_VULNERABILITIES
arch/s390/Makefile +1 -9
@@ -30,15 +30,7 @@ KBUILD_CFLAGS_DECOMPRESSOR += -fno-stack-protector KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning, address-of-packed-member) KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g) KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,)) - -ifdef CONFIG_CC_IS_GCC - ifeq ($(call cc-ifversion, -ge, 1200, y), y) - ifeq ($(call cc-ifversion, -lt, 1300, y), y) - KBUILD_CFLAGS += $(call cc-disable-warning, array-bounds) - KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning, array-bounds) - endif - endif -endif +KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_CC_NO_ARRAY_BOUNDS),-Wno-array-bounds) UTS_MACHINE := s390x STACK_SIZE := $(if $(CONFIG_KASAN),65536,16384)
init/Kconfig +9 -0
@@ -899,6 +899,15 @@ config CC_IMPLICIT_FALLTHROUGH default "-Wimplicit-fallthrough=5" if CC_IS_GCC && $(cc-option,-Wimplicit-fallthrough=5) default "-Wimplicit-fallthrough" if CC_IS_CLANG && $(cc-option,-Wunreachable-code-fallthrough) +# Currently, disable gcc-12 array-bounds globally. +# We may want to target only particular configurations some day. +config GCC12_NO_ARRAY_BOUNDS + def_bool y + +config CC_NO_ARRAY_BOUNDS + bool + default y if CC_IS_GCC && GCC_VERSION >= 120000 && GCC_VERSION < 130000 && GCC12_NO_ARRAY_BOUNDS + # # For architectures that know their GCC __int128 support is sound #
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 43/141 netfs: gcc-12: temporarily disable -Wattribute-warning for now
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
[ Upstream commit 507160f46c55913955d272ebf559d63809a8e560 ]
This is a pure band-aid so that I can continue merging stuff from people while some of the gcc-12 fallout gets sorted out.
In particular, gcc-12 is very unhappy about the kinds of pointer arithmetic tricks that netfs does, and that makes the fortify checks trigger in afs and ceph:
In function ‘fortify_memset_chk’,
inlined from ‘netfs_i_context_init’ at include/linux/netfs.h:327:2,
inlined from ‘afs_set_netfs_context’ at fs/afs/inode.c:61:2,
inlined from ‘afs_root_iget’ at fs/afs/inode.c:543:2:
include/linux/fortify-string.h:258:25: warning: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]
258 | __write_overflow_field(p_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~and the reason is that netfs_i_context_init() is passed a 'struct inode' pointer, and then it does
struct netfs_i_context *ctx = netfs_i_context(inode);
memset(ctx, 0, sizeof(*ctx));where that netfs_i_context() function just does pointer arithmetic on the inode pointer, knowing that the netfs_i_context is laid out immediately after it in memory.
This is all truly disgusting, since the whole "netfs_i_context is laid out immediately after it in memory" is not actually remotely true in general, but is just made to be that way for afs and ceph.
See for example fs/cifs/cifsglob.h:
struct cifsInodeInfo {
struct {
/* These must be contiguous */
struct inode vfs_inode; /* the VFS's inode record */
struct netfs_i_context netfs_ctx; /* Netfslib context */
};
[...]and realize that this is all entirely wrong, and the pointer arithmetic that netfs_i_context() is doing is also very very wrong and wouldn't give the right answer if netfs_ctx had different alignment rules from a 'struct inode', for example).
Anyway, that's just a long-winded way to say "the gcc-12 warning is actually quite reasonable, and our code happens to work but is pretty disgusting".
This is getting fixed properly, but for now I made the mistake of thinking "the week right after the merge window tends to be calm for me as people take a breather" and I did a sustem upgrade. And I got gcc-12 as a result, so to continue merging fixes from people and not have the end result drown in warnings, I am fixing all these gcc-12 issues I hit.
Including with these kinds of temporary fixes.
--- fs/afs/inode.c | 3 +++ fs/ceph/inode.c | 3 +++ 2 files changed, 6 insertions(+)
fs/afs/inode.c +3 -0
@@ -25,6 +25,9 @@#include "internal.h" #include "afs_fs.h" +// Temporary: netfs does disgusting things with inode pointers +#pragma GCC diagnostic ignored "-Wattribute-warning" +static const struct inode_operations afs_symlink_inode_operations = { .get_link = page_get_link, };
fs/ceph/inode.c +3 -0
@@ -20,6 +20,9 @@#include "cache.h" #include <linux/ceph/decode.h> +// Temporary: netfs does disgusting things with inode pointers +#pragma GCC diagnostic ignored "-Wattribute-warning" +/* * Ceph inode operations *
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 44/141 MIPS: Loongson-3: fix compile mips cpu_hwmon as module build error.
In reply to Greg Kroah-HartmanFrom: Yupeng Li <[email protected]>
[ Upstream commit 41e456400212803704e82691716e1d7b0865114a ]
set cpu_hwmon as a module build with loongson_sysconf, loongson_chiptemp undefined error,fix cpu_hwmon compile options to be bool.Some kernel compilation error information is as follows:
Checking missing-syscalls for N32
CALL scripts/checksyscalls.sh
Checking missing-syscalls for O32
CALL scripts/checksyscalls.sh CALL scripts/checksyscalls.sh CHK include/generated/compile.h CC [M] drivers/platform/mips/cpu_hwmon.o
Building modules, stage 2.
MODPOST 200 modules
ERROR: "loongson_sysconf" [drivers/platform/mips/cpu_hwmon.ko] undefined!
ERROR: "loongson_chiptemp" [drivers/platform/mips/cpu_hwmon.ko] undefined! make[1]: *** [scripts/Makefile.modpost:92:__modpost] 错误 1
make: *** [Makefile:1261:modules] 错误 2
--- drivers/platform/mips/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/mips/Kconfig +1 -1
@@ -17,7 +17,7 @@ menuconfig MIPS_PLATFORM_DEVICES if MIPS_PLATFORM_DEVICES config CPU_HWMON - tristate "Loongson-3 CPU HWMon Driver" + bool "Loongson-3 CPU HWMon Driver" depends on MACH_LOONGSON64 select HWMON default y
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 45/141 random: credit cpu and bootloader seeds by default
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
[ Upstream commit 846bb97e131d7938847963cca00657c995b1fce1 ]
This commit changes the default Kconfig values of RANDOM_TRUST_CPU and RANDOM_TRUST_BOOTLOADER to be Y by default. It does not change any existing configs or change any kernel behavior. The reason for this is several fold.
As background, I recently had an email thread with the kernel maintainers of Fedora/RHEL, Debian, Ubuntu, Gentoo, Arch, NixOS, Alpine, SUSE, and Void as recipients. I noted that some distros trust RDRAND, some trust EFI, and some trust both, and I asked why or why not. There wasn't really much of a "debate" but rather an interesting discussion of what the historical reasons have been for this, and it came up that some distros just missed the introduction of the bootloader Kconfig knob, while another didn't want to enable it until there was a boot time switch to turn it off for more concerned users (which has since been added). The result of the rather uneventful discussion is that every major Linux distro enables these two options by default.
While I didn't have really too strong of an opinion going into this thread -- and I mostly wanted to learn what the distros' thinking was one way or another -- ultimately I think their choice was a decent enough one for a default option (which can be disabled at boot time). I'll try to summarize the pros and cons:
Pros:
- The RNG machinery gets initialized super quickly, and there's no messing around with subsequent blocking behavior.
- The bootloader mechanism is used by kexec in order for the prior kernel to initialize the RNG of the next kernel, which increases the entropy available to early boot daemons of the next kernel.
- Previous objections related to backdoors centered around Dual_EC_DRBG-like kleptographic systems, in which observing some amount of the output stream enables an adversary holding the right key to determine the entire output stream.
This used to be a partially justified concern, because RDRAND output was mixed into the output stream in varying ways, some of which may have lacked pre-image resistance (e.g. XOR or an LFSR).
But this is no longer the case. Now, all usage of RDRAND and bootloader seeds go through a cryptographic hash function. This means that the CPU would have to compute a hash pre-image, which is not considered to be feasible (otherwise the hash function would be terribly broken).
- More generally, if the CPU is backdoored, the RNG is probably not the realistic vector of choice for an attacker.
- These CPU or bootloader seeds are far from being the only source of entropy. Rather, there is generally a pretty huge amount of entropy, not all of which is credited, especially on CPUs that support instructions like RDRAND. In other words, assuming RDRAND outputs all zeros, an attacker would *still* have to accurately model every single other entropy source also in use.
- The RNG now reseeds itself quite rapidly during boot, starting at 2 seconds, then 4, then 8, then 16, and so forth, so that other sources of entropy get used without much delay.
- Paranoid users can set random.trust_{cpu,bootloader}=no in the kernel command line, and paranoid system builders can set the Kconfig options to N, so there's no reduction or restriction of optionality.
- It's a practical default.
- All the distros have it set this way. Microsoft and Apple trust it too. Bandwagon.
Cons:
- RDRAND *could* still be backdoored with something like a fixed key or limited space serial number seed or another indexable scheme like that. (However, it's hard to imagine threat models where the CPU is backdoored like this, yet people are still okay making *any* computations with it or connecting it to networks, etc.)
- RDRAND *could* be defective, rather than backdoored, and produce garbage that is in one way or another insufficient for crypto.
- Suggesting a *reduction* in paranoia, as this commit effectively does, may cause some to question my personal integrity as a "security person".
- Bootloader seeds and RDRAND are generally very difficult if not all together impossible to audit.
Keep in mind that this doesn't actually change any behavior. This is just a change in the default Kconfig value. The distros already are shipping kernels that set things this way.
Ard made an additional argument in [1]:
We're at the mercy of firmware and micro-architecture anyway, given that we are also relying on it to ensure that every instruction in the kernel's executable image has been faithfully copied to memory, and that the CPU implements those instructions as documented. So I don't think firmware or ISA bugs related to RNGs deserve special treatment - if they are broken, we should quirk around them like we usually do. So enabling these by default is a step in the right direction IMHO.
In [2], Phil pointed out that having this disabled masked a bug that CI otherwise would have caught:
A clean 5.15.45 boots cleanly, whereas a downstream kernel shows the static key warning (but it does go on to boot). The significant difference is that our defconfigs set CONFIG_RANDOM_TRUST_BOOTLOADER=y defining that on top of multi_v7_defconfig demonstrates the issue on a clean 5.15.45. Conversely, not setting that option in a downstream kernel build avoids the warning
[1] https://lore.kernel.org/lkml/CAMj1kXGi+ieviFjXv9zQBSaGyyzeGW_VpMpTLJK8PJb2QHEQ-w@mail.gmail.com/
[2] https://lore.kernel.org/lkml/[email protected]/
--- drivers/char/Kconfig | 50 +++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 19 deletions(-)
drivers/char/Kconfig +31 -19
@@ -428,28 +428,40 @@ config ADI driver include crash and makedumpfile. config RANDOM_TRUST_CPU - bool "Trust the CPU manufacturer to initialize Linux's CRNG" + bool "Initialize RNG using CPU RNG instructions" + default y depends on ARCH_RANDOM - default n help - Assume that CPU manufacturer (e.g., Intel or AMD for RDSEED or - RDRAND, IBM for the S390 and Power PC architectures) is trustworthy - for the purposes of initializing Linux's CRNG. Since this is not - something that can be independently audited, this amounts to trusting - that CPU manufacturer (perhaps with the insistence or mandate - of a Nation State's intelligence or law enforcement agencies) - has not installed a hidden back door to compromise the CPU's - random number generation facilities. This can also be configured - at boot with "random.trust_cpu=on/off". + Initialize the RNG using random numbers supplied by the CPU's + RNG instructions (e.g. RDRAND), if supported and available. These + random numbers are never used directly, but are rather hashed into + the main input pool, and this happens regardless of whether or not + this option is enabled. Instead, this option controls whether the + they are credited and hence can initialize the RNG. Additionally, + other sources of randomness are always used, regardless of this + setting. Enabling this implies trusting that the CPU can supply high + quality and non-backdoored random numbers. + + Say Y here unless you have reason to mistrust your CPU or believe + its RNG facilities may be faulty. This may also be configured at + boot time with "random.trust_cpu=on/off". config RANDOM_TRUST_BOOTLOADER - bool "Trust the bootloader to initialize Linux's CRNG" - help - Some bootloaders can provide entropy to increase the kernel's initial - device randomness. Say Y here to assume the entropy provided by the - booloader is trustworthy so it will be added to the kernel's entropy - pool. Otherwise, say N here so it will be regarded as device input that - only mixes the entropy pool. This can also be configured at boot with - "random.trust_bootloader=on/off". + bool "Initialize RNG using bootloader-supplied seed" + default y + help + Initialize the RNG using a seed supplied by the bootloader or boot + environment (e.g. EFI or a bootloader-generated device tree). This + seed is not used directly, but is rather hashed into the main input + pool, and this happens regardless of whether or not this option is + enabled. Instead, this option controls whether the seed is credited + and hence can initialize the RNG. Additionally, other sources of + randomness are always used, regardless of this setting. Enabling + this implies trusting that the bootloader can supply high quality and + non-backdoored seeds. + + Say Y here unless you have reason to mistrust your bootloader or + believe its RNG facilities may be faulty. This may also be configured + at boot time with "random.trust_bootloader=on/off". endmenu
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 46/141 gpio: dwapb: Dont print error on -EPROBE_DEFER
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 77006f6edc0e0f58617eb25e53731f78641e820d ]
Currently if the APB or Debounce clocks aren't yet ready to be requested the DW GPIO driver will correctly handle that by deferring the probe procedure, but the error is still printed to the system log. It needlessly pollutes the log since there was no real error but a request to postpone the clock request procedure since the clocks subsystem hasn't been fully initialized yet. Let's fix that by using the dev_err_probe method to print the APB/clock request error status. It will correctly handle the deferred probe situation and print the error if it actually happens.
--- drivers/gpio/gpio-dwapb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpio/gpio-dwapb.c +3 -4
@@ -652,10 +652,9 @@ static int dwapb_get_clks(struct dwapb_gpio *gpio) gpio->clks[1 ].id ="db" ; err =devm_clk_bulk_get_optional (gpio->dev,DWAPB_NR_CLOCKS , gpio->clks); -if (err) { -dev_err (gpio->dev,"Cannot get APB/Debounce clocks\n" ); -return err; - } +if (err) +return dev_err_probe (gpio->dev, err, +"Cannot get APB/Debounce clocks\n" ); err =clk_bulk_prepare_enable (DWAPB_NR_CLOCKS , gpio->clks);if (err) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 47/141 platform/x86/intel: Fix pmt_crashlog array reference
In reply to Greg Kroah-HartmanFrom: David Arcari <[email protected]>
[ Upstream commit 66cb3a2d7ad0d0e9af4d3430a4f2a32ffb9ac098 ]
The probe function pmt_crashlog_probe() may incorrectly reference the 'priv->entry array' as it uses 'i' to reference the array instead of 'priv->num_entries' as it should. This is similar to the problem that was addressed in pmt_telemetry_probe via commit 2cdfa0c20d58 ("platform/x86/intel: Fix 'rmmod pmt_telemetry' panic").
--- drivers/platform/x86/intel/pmt/crashlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/intel/pmt/crashlog.c +1 -1
@@ -282,7 +282,7 @@ static int pmt_crashlog_probe(struct auxiliary_device *auxdev,auxiliary_set_drvdata (auxdev, priv);for (i =0 ; i < intel_vsec_dev->num_resources; i++) { -struct intel_pmt_entry *entry = &priv->entry[i].entry; +struct intel_pmt_entry *entry = &priv->entry[priv->num_entries].entry; ret =intel_pmt_dev_create (entry, &pmt_crashlog_ns, intel_vsec_dev, i);if (ret <0 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 48/141 platform/x86/intel: pmc: Support Intel Raptorlake P
In reply to Greg Kroah-HartmanFrom: George D Sworo <[email protected]>
[ Upstream commit 552f3b801de6eb062b225a76e140995483a0609c ]
Add Raptorlake P to the list of the platforms that intel_pmc_core driver supports for pmc_core device. Raptorlake P PCH is based on Alderlake P PCH.
--- drivers/platform/x86/intel/pmc/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/intel/pmc/core.c +1 -0
@@ -1912,6 +1912,7 @@ static const struct x86_cpu_id intel_pmc_core_ids[] = {X86_MATCH_INTEL_FAM6_MODEL (ROCKETLAKE , &tgl_reg_map),X86_MATCH_INTEL_FAM6_MODEL (ALDERLAKE_L , &tgl_reg_map),X86_MATCH_INTEL_FAM6_MODEL (ALDERLAKE , &adl_reg_map), + X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, &tgl_reg_map), {} };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 49/141 platform/x86: gigabyte-wmi: Add Z690M AORUS ELITE AX DDR4 support
In reply to Greg Kroah-HartmanFrom: Piotr Chmura <[email protected]>
[ Upstream commit 8a041afe3e774bedd3e0a9b96f65e48a1299a595 ]
Add dmi_system_id of Gigabyte Z690M AORUS ELITE AX DDR4 board. Tested on my PC.
--- drivers/platform/x86/gigabyte-wmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/gigabyte-wmi.c +1 -0
@@ -154,6 +154,7 @@ static const struct dmi_system_id gigabyte_wmi_known_working_platforms[] = {DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME ("X570 GAMING X" ),DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME ("X570 I AORUS PRO WIFI" ),DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME ("X570 UD" ), + DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("Z690M AORUS ELITE AX DDR4"), { } };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 50/141 platform/x86: gigabyte-wmi: Add support for B450M DS3H-CF
In reply to Greg Kroah-HartmanFrom: August Wikerfors <[email protected]>
[ Upstream commit c6bc7e8ee90845556a90faf8b043cbefd77b8903 ]
Tested and works on my system.
--- drivers/platform/x86/gigabyte-wmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/gigabyte-wmi.c +1 -0
@@ -140,6 +140,7 @@ static u8 gigabyte_wmi_detect_sensor_usability(struct wmi_device *wdev) }}static const struct dmi_system_id gigabyte_wmi_known_working_platforms[] = { +DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME ("B450M DS3H-CF" ),DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME ("B450M S2H V2" ),DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME ("B550 AORUS ELITE AX V2" ),DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME ("B550 AORUS ELITE" ),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 51/141 platform/x86/intel: hid: Add Surface Go to VGBS allow list
In reply to Greg Kroah-HartmanFrom: Duke Lee <[email protected]>
[ Upstream commit d4fe9cc4ff8656704b58cfd9363d7c3c9d65e519 ]
The Surface Go reports Chassis Type 9 (Laptop,) so the device needs to be added to dmi_vgbs_allow_list to enable tablet mode when an attached Type Cover is folded back.
--- drivers/platform/x86/intel/hid.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/platform/x86/intel/hid.c +6 -0
@@ -122,6 +122,12 @@ static const struct dmi_system_id dmi_vgbs_allow_list[] = { DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x360 Convertible 15-df0xxx"), }, }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), + DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go"), + }, + }, { } };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 52/141 staging: r8188eu: fix rtw_alloc_hwxmits error detection for now
In reply to Greg Kroah-HartmanFrom: Phillip Potter <[email protected]>
[ Upstream commit 5b7419ae1d208cab1e2826d473d8dab045aa75c7 ]
In _rtw_init_xmit_priv, we use the res variable to store the error return from the newly converted rtw_alloc_hwxmits function. Sadly, the calling function interprets res using _SUCCESS and _FAIL still, meaning we change the semantics of the variable, even in the success case.
This leads to the following on boot:
r8188eu 1-2:1.0: _rtw_init_xmit_priv failed
In the long term, we should reverse these semantics, but for now, this fixes the driver. Also, inside rtw_alloc_hwxmits remove the if blocks, as HWXMIT_ENTRY is always 4.
--- drivers/staging/r8188eu/core/rtw_xmit.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-)
drivers/staging/r8188eu/core/rtw_xmit.c +5 -15
@@ -178,8 +178,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter) pxmitpriv->free_xmit_extbuf_cnt = num_xmit_extbuf; - res =rtw_alloc_hwxmits (padapter); -if (res) { +if (rtw_alloc_hwxmits (padapter)) { res = _FAIL; goto exit; }
@@ -1492,19 +1491,10 @@ int rtw_alloc_hwxmits(struct adapter *padapter) hwxmits = pxmitpriv->hwxmits; -if (pxmitpriv->hwxmit_entry ==5 ) { - hwxmits[0 ] .sta_queue = &pxmitpriv->bm_pending; - hwxmits[1 ] .sta_queue = &pxmitpriv->vo_pending; - hwxmits[2 ] .sta_queue = &pxmitpriv->vi_pending; - hwxmits[3 ] .sta_queue = &pxmitpriv->bk_pending; - hwxmits[4 ] .sta_queue = &pxmitpriv->be_pending; - }else if (pxmitpriv->hwxmit_entry ==4 ) { - hwxmits[0 ] .sta_queue = &pxmitpriv->vo_pending; - hwxmits[1 ] .sta_queue = &pxmitpriv->vi_pending; - hwxmits[2 ] .sta_queue = &pxmitpriv->be_pending; - hwxmits[3 ] .sta_queue = &pxmitpriv->bk_pending; - }else { - } + hwxmits[0 ].sta_queue = &pxmitpriv->vo_pending; + hwxmits[1 ].sta_queue = &pxmitpriv->vi_pending; + hwxmits[2 ].sta_queue = &pxmitpriv->be_pending; + hwxmits[3 ].sta_queue = &pxmitpriv->bk_pending;return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 53/141 staging: r8188eu: Fix warning of array overflow in ioctl_linux.c
In reply to Greg Kroah-HartmanFrom: Larry Finger <[email protected]>
[ Upstream commit 96f0a54e8e65a765b3a4ad4b53751581f23279f3 ]
Building with -Warray-bounds results in the following warning plus others related to the same problem:
CC [M] drivers/staging/r8188eu/os_dep/ioctl_linux.o
In function ‘wpa_set_encryption’,
inlined from ‘rtw_wx_set_enc_ext’ at drivers/staging/r8188eu/os_dep/ioctl_linux.c:1868:9:drivers/staging/r8188eu/os_dep/ioctl_linux.c:412:41: warning: array subscript ‘struct ndis_802_11_wep[0]’ is partly outside array bounds of ‘void[25]’ [-Warray-bounds]
412 | pwep->KeyLength = wep_key_len;
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
In file included from drivers/staging/r8188eu/os_dep/../include/osdep_service.h:19,
from drivers/staging/r8188eu/os_dep/ioctl_linux.c:4:In function ‘kmalloc’,
inlined from ‘kzalloc’ at ./include/linux/slab.h:733:9,
inlined from ‘wpa_set_encryption’ at drivers/staging/r8188eu/os_dep/ioctl_linux.c:408:11, inlined from ‘rtw_wx_set_enc_ext’ at drivers/staging/r8188eu/os_dep/ioctl_linux.c:1868:9:./include/linux/slab.h:605:16: note: object of size [17, 25] allocated by ‘__kmalloc’
605 | return __kmalloc(size, flags);
| ^~~~~~~~~~~~~~~~~~~~~~
./include/linux/slab.h:600:24: note: object of size [17, 25] allocated by ‘kmem_cache_alloc_trace’
600 | return kmem_cache_alloc_trace(
| ^~~~~~~~~~~~~~~~~~~~~~~
601 | kmalloc_caches[kmalloc_type(flags)][index],
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
602 | flags, size);
| ~~~~~~~~~~~~Although it is unlikely that anyone is still using WEP encryption, the size of the allocation needs to be increased just in case.
Fixes commit 2b42bd58b321 ("staging: r8188eu: introduce new os_dep dir for RTL8188eu driver")
--- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/os_dep/ioctl_linux.c +1 -1
@@ -404,7 +404,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,if (wep_key_len >0 ) { wep_key_len = wep_key_len <=5 ?5 :13 ; - wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial); + wep_total_len = wep_key_len +sizeof (*pwep); pwep =kzalloc (wep_total_len,GFP_KERNEL );if (!pwep) goto exit;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 54/141 pNFS: Dont keep retrying if the server replied NFS4ERR_LAYOUTUNAVAILABLE
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit fe44fb23d6ccde4c914c44ef74ab8d9d9ba02bea ]
If the server tells us that a pNFS layout is not available for a specific file, then we should not keep pounding it with further layoutget requests.
--- fs/nfs/pnfs.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/nfs/pnfs.c +6 -0
@@ -2152,6 +2152,12 @@ pnfs_update_layout(struct inode *ino,case -ERECALLCONFLICT :case -EAGAIN :break ; +case -ENODATA : +/* The server returned NFS4ERR_LAYOUTUNAVAILABLE */ +pnfs_layout_set_fail_bit ( + lo,pnfs_iomode_to_fail_bit (iomode)); + lseg =NULL ; + goto out_put_layout_hdr;default :if (!nfs_error_is_fatal (PTR_ERR (lseg))) {pnfs_layout_clear_fail_bit (lo,pnfs_iomode_to_fail_bit (iomode));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 55/141 pNFS: Avoid a live lock condition in pnfs_update_layout()
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit 880265c77ac415090090d1fe72a188fee71cb458 ]
If we're about to send the first layoutget for an empty layout, we want to make sure that we drain out the existing pending layoutget calls first. The reason is that these layouts may have been already implicitly returned to the server by a recall to which the client gave a NFS4ERR_NOMATCHING_LAYOUT response.
The problem is that wait_var_event_killable() could in principle see the plh_outstanding count go back to '1' when the first process to wake up starts sending a new layoutget. If it fails to get a layout, then this loop can continue ad infinitum...
--- fs/nfs/callback_proc.c | 1 + fs/nfs/pnfs.c | 15 +++++++++------ fs/nfs/pnfs.h | 1 + 3 files changed, 11 insertions(+), 6 deletions(-)
fs/nfs/callback_proc.c +1 -0
@@ -288,6 +288,7 @@ static u32 initiate_file_draining(struct nfs_client *clp, rv =NFS4_OK ;break ;case -ENOENT : +set_bit (NFS_LAYOUT_DRAIN , &lo->plh_flags);/* Embrace your forgetfulness! */ rv =NFS4ERR_NOMATCHING_LAYOUT ;
fs/nfs/pnfs.c +9 -6
@@ -469,6 +469,7 @@ pnfs_mark_layout_stateid_invalid(struct pnfs_layout_hdr *lo,pnfs_clear_lseg_state (lseg, lseg_list);pnfs_clear_layoutreturn_info (lo);pnfs_free_returned_lsegs (lo, lseg_list, &range,0 ); +set_bit (NFS_LAYOUT_DRAIN , &lo->plh_flags);if (test_bit (NFS_LAYOUT_RETURN , &lo->plh_flags) && !test_and_set_bit (NFS_LAYOUT_RETURN_LOCK , &lo->plh_flags))pnfs_clear_layoutreturn_waitbit (lo);
@@ -1917,8 +1918,9 @@ static void nfs_layoutget_begin(struct pnfs_layout_hdr *lo)static void nfs_layoutget_end (struct pnfs_layout_hdr *lo) { -if (atomic_dec_and_test (&lo->plh_outstanding)) -wake_up_var (&lo->plh_outstanding); +if (atomic_dec_and_test (&lo->plh_outstanding) && +test_and_clear_bit (NFS_LAYOUT_DRAIN , &lo->plh_flags)) +wake_up_bit (&lo->plh_flags,NFS_LAYOUT_DRAIN ); }static bool pnfs_is_first_layoutget (struct pnfs_layout_hdr *lo)
@@ -2025,11 +2027,11 @@ pnfs_update_layout(struct inode *ino,* If the layout segment list is empty, but there are outstanding * layoutget calls, then they might be subject to a layoutrecall. */ -if ((list_empty (&lo->plh_segs) || !pnfs_layout_is_valid (lo)) && +if (test_bit (NFS_LAYOUT_DRAIN , &lo->plh_flags) &&atomic_read (&lo->plh_outstanding) !=0 ) {spin_unlock (&ino->i_lock); - lseg =ERR_PTR (wait_var_event_killable (&lo->plh_outstanding, - !atomic_read (&lo->plh_outstanding))); + lseg =ERR_PTR (wait_on_bit (&lo->plh_flags,NFS_LAYOUT_DRAIN , +TASK_KILLABLE ));if (IS_ERR (lseg)) goto out_put_layout_hdr;pnfs_put_layout_hdr (lo);
@@ -2413,7 +2415,8 @@ pnfs_layout_process(struct nfs4_layoutget *lgp) goto out_forget; } -if (!pnfs_layout_is_valid (lo) && !pnfs_is_first_layoutget (lo)) +if (test_bit (NFS_LAYOUT_DRAIN , &lo->plh_flags) && + !pnfs_is_first_layoutget (lo)) goto out_forget;if (nfs4_stateid_match_other (&lo->plh_stateid, &res->stateid)) {
fs/nfs/pnfs.h +1 -0
@@ -105,6 +105,7 @@ enum {NFS_LAYOUT_FIRST_LAYOUTGET ,/* Serialize first layoutget */ NFS_LAYOUT_INODE_FREEING ,/* The inode is being freed */ NFS_LAYOUT_HASHED ,/* The layout visible */ + NFS_LAYOUT_DRAIN, }; enum layoutdriver_policy_flags {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 56/141 sunrpc: set cl_max_connect when cloning an rpc_clnt
In reply to Greg Kroah-HartmanFrom: Scott Mayhew <[email protected]>
[ Upstream commit 304791255a2dc1c9be7e7c8a6cbdb31b6847b0e5 ]
If the initial attempt at trunking detection using the krb5i auth flavor fails with -EACCES, -NFS4ERR_CLID_INUSE, or -NFS4ERR_WRONGSEC, then the NFS client tries again using auth_sys, cloning the rpc_clnt in the process. If this second attempt at trunking detection succeeds, then the resulting nfs_client->cl_rpcclient winds up having cl_max_connect=0 and subsequent attempts to add additional transport connections to the rpc_clnt will fail with a message similar to the following being logged:
[502044.312640] SUNRPC: reached max allowed number (0) did not add
transport to server: 192.168.122.3
--- net/sunrpc/clnt.c | 1 + 1 file changed, 1 insertion(+)
net/sunrpc/clnt.c +1 -0
@@ -651,6 +651,7 @@ static struct rpc_clnt *__rpc_clone_client(struct rpc_create_args *args, new->cl_discrtry = clnt->cl_discrtry; new->cl_chatty = clnt->cl_chatty; new->cl_principal = clnt->cl_principal; + new->cl_max_connect = clnt->cl_max_connect;return new; out_err:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 57/141 clocksource: hyper-v: unexport __init-annotated hv_init_clocksource()
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 245b993d8f6c4e25f19191edfbd8080b645e12b1 ]
EXPORT_SYMBOL and __init is a bad combination because the .init.text section is freed up after the initialization. Hence, modules cannot use symbols annotated __init. The access to a freed symbol may end up with kernel panic.
modpost used to detect it, but it has been broken for a decade.
Recently, I fixed modpost so it started to warn it again, then this showed up in linux-next builds.
There are two ways to fix it:
- Remove __init
- Remove EXPORT_SYMBOL
I chose the latter for this case because the only in-tree call-site, arch/x86/kernel/cpu/mshyperv.c is never compiled as modular. (CONFIG_HYPERVISOR_GUEST is boolean)
--- drivers/clocksource/hyperv_timer.c | 1 - 1 file changed, 1 deletion(-)
drivers/clocksource/hyperv_timer.c +0 -1
@@ -565,4 +565,3 @@ void __init hv_init_clocksource(void) hv_sched_clock_offset =hv_read_reference_counter ();hv_setup_sched_clock (read_hv_sched_clock_msr); } -EXPORT_SYMBOL_GPL (hv_init_clocksource);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 58/141 i40e: Fix adding ADQ filter to TC0
In reply to Greg Kroah-HartmanFrom: Grzegorz Szczurek <[email protected]>
[ Upstream commit c3238d36c3a2be0a29a9d848d6c51e1b14be6692 ]
Procedure of configure tc flower filters erroneously allows to create filters on TC0 where unfiltered packets are also directed by default. Issue was caused by insufficient checks of hw_tc parameter specifying the hardware traffic class to pass matching packets to.
Fix checking hw_tc parameter which blocks creation of filters on TC0.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +5 -0
@@ -8537,6 +8537,11 @@ static int i40e_configure_clsflower(struct i40e_vsi *vsi,return -EOPNOTSUPP ; } +if (!tc) { +dev_err (&pf->pdev->dev,"Unable to add filter because of invalid destination" ); +return -EINVAL ; + } +if (test_bit (__I40E_RESET_RECOVERY_PENDING, pf->state) ||test_bit (__I40E_RESET_INTR_RECEIVED, pf->state))return -EBUSY ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 59/141 i40e: Fix calculating the number of queue pairs
In reply to Greg Kroah-HartmanFrom: Grzegorz Szczurek <[email protected]>
[ Upstream commit 0bb050670ac90a167ecfa3f9590f92966c9a3677 ]
If ADQ is enabled for a VF, then actual number of queue pair is a number of currently available traffic classes for this VF.
Without this change the configuration of the Rx/Tx queues fails with error.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1 -1
@@ -2282,7 +2282,7 @@ static int i40e_vc_config_queues_msg(struct i40e_vf *vf, u8 *msg) }if (vf->adq_enabled) { -for (i =0 ; i <I40E_MAX_VF_VSI ; i++) +for (i =0 ; i < vf->num_tc; i++) num_qps_all += vf->ch[i].num_qps;if (num_qps_all != qci->num_queue_pairs) { aq_ret =I40E_ERR_PARAM ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 60/141 i40e: Fix call trace in setup_tx_descriptors
In reply to Greg Kroah-HartmanFrom: Aleksandr Loktionov <[email protected]>
[ Upstream commit fd5855e6b1358e816710afee68a1d2bc685176ca ]
After PF reset and ethtool -t there was call trace in dmesg sometimes leading to panic. When there was some time, around 5 seconds, between reset and test there were no errors.
Problem was that pf reset calls i40e_vsi_close in prep_for_reset and ethtool -t calls i40e_vsi_close in diag_test. If there was not enough time between those commands the second i40e_vsi_close starts before previous i40e_vsi_close was done which leads to crash.
Add check to diag_test if pf is in reset and don't start offline tests if it is true.
Add netif_info("testing failed") into unhappy path of i40e_diag_test()
--- .../net/ethernet/intel/i40e/i40e_ethtool.c | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +17 -8
@@ -2584,15 +2584,16 @@ static void i40e_diag_test(struct net_device *netdev,set_bit (__I40E_TESTING, pf->state); +if (test_bit (__I40E_RESET_RECOVERY_PENDING, pf->state) || +test_bit (__I40E_RESET_INTR_RECEIVED, pf->state)) { +dev_warn (&pf->pdev->dev, +"Cannot start offline testing when PF is in reset state.\n" ); + goto skip_ol_tests; + } +if (i40e_active_vfs (pf) ||i40e_active_vmdqs (pf)) {dev_warn (&pf->pdev->dev,"Please take active VFs and Netqueues offline and restart the adapter before running NIC diagnostics\n" ); - data[I40E_ETH_TEST_REG ] =1 ; - data[I40E_ETH_TEST_EEPROM ] =1 ; - data[I40E_ETH_TEST_INTR ] =1 ; - data[I40E_ETH_TEST_LINK ] =1 ; - eth_test->flags |=ETH_TEST_FL_FAILED ; -clear_bit (__I40E_TESTING, pf->state); goto skip_ol_tests; }
@@ -2639,9 +2640,17 @@ static void i40e_diag_test(struct net_device *netdev, data[I40E_ETH_TEST_INTR ] =0 ; } -skip_ol_tests: -netif_info (pf, drv, netdev,"testing finished\n" ); +return ; + +skip_ol_tests: + data[I40E_ETH_TEST_REG ] =1 ; + data[I40E_ETH_TEST_EEPROM ] =1 ; + data[I40E_ETH_TEST_INTR ] =1 ; + data[I40E_ETH_TEST_LINK ] =1 ; + eth_test->flags |=ETH_TEST_FL_FAILED ; +clear_bit (__I40E_TESTING, pf->state); +netif_info (pf, drv, netdev,"testing failed\n" ); } static void i40e_get_wol(struct net_device *netdev,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 61/141 iavf: Fix issue with MAC address of VF shown as zero
In reply to Greg Kroah-HartmanFrom: Michal Wilczynski <[email protected]>
[ Upstream commit 645603844270b69175899268be68b871295764fe ]
After reinitialization of iavf, ice driver gets VIRTCHNL_OP_ADD_ETH_ADDR message with incorrectly set type of MAC address. Hardware address should have is_primary flag set as true. This way ice driver knows what it has to set as a MAC address.
Check if the address is primary in iavf_add_filter function and set flag accordingly.
To test set all-zero MAC on a VF. This triggers iavf re-initialization and VIRTCHNL_OP_ADD_ETH_ADDR message gets sent to PF.
For example:
ip link set dev ens785 vf 0 mac 00:00:00:00:00:00
This triggers re-initialization of iavf. New MAC should be assigned. Now check if MAC is non-zero:
ip link show dev ens785
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
@@ -984,7 +984,7 @@ struct iavf_mac_filter *iavf_add_filter(struct iavf_adapter *adapter,list_add_tail (&f->list, &adapter->mac_filter_list); f->add = true; f->is_new_mac = true; - f->is_primary = false; + f->is_primary =ether_addr_equal (macaddr, adapter->hw.mac.addr); adapter->aq_required |=IAVF_FLAG_AQ_ADD_MAC_FILTER ; }else { f->remove = false;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 62/141 Drivers: hv: vmbus: Release cpu lock in error case
In reply to Greg Kroah-HartmanFrom: Saurabh Sengar <[email protected]>
[ Upstream commit 656c5ba50b7172a0ea25dc1b37606bd51d01fe8d ]
In case of invalid sub channel, release cpu lock before returning.
--- drivers/hv/channel_mgmt.c | 1 + 1 file changed, 1 insertion(+)
drivers/hv/channel_mgmt.c +1 -0
@@ -637,6 +637,7 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)*/ if (newchannel->offermsg.offer.sub_channel_index ==0 ) {mutex_unlock (&vmbus_connection.channel_mutex); +cpus_read_unlock ();/* * Don't call free_channel(), because newchannel->kobj * is not initialized yet.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 63/141 tty: goldfish: Fix free_irq() on remove
In reply to Greg Kroah-HartmanFrom: Vincent Whitchurch <[email protected]>
[ Upstream commit 499e13aac6c762e1e828172b0f0f5275651d6512 ]
Pass the correct dev_id to free_irq() to fix this splat when the driver is unbound:
WARNING: CPU: 0 PID: 30 at kernel/irq/manage.c:1895 free_irq Trying to free already-free IRQ 65 Call Trace: warn_slowpath_fmt free_irq goldfish_tty_remove platform_remove device_remove device_release_driver_internal device_driver_detach unbind_store drv_attr_store ...
--- drivers/tty/goldfish.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/goldfish.c +1 -1
@@ -426,7 +426,7 @@ static int goldfish_tty_remove(struct platform_device *pdev)tty_unregister_device (goldfish_tty_driver, qtty->console.index);iounmap (qtty->base); qtty->base =NULL ; -free_irq (qtty->irq, pdev); +free_irq (qtty->irq, qtty);tty_port_destroy (&qtty->port); goldfish_tty_current_line_count--;if (goldfish_tty_current_line_count ==0 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 64/141 misc: atmel-ssc: Fix IRQ check in ssc_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 1c245358ce0b13669f6d1625f7a4e05c41f28980 ]
platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example:
int irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;Fix the check of return value to catch errors correctly.
--- drivers/misc/atmel-ssc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/atmel-ssc.c +2 -2
@@ -232,9 +232,9 @@ static int ssc_probe(struct platform_device *pdev)clk_disable_unprepare (ssc->clk); ssc->irq =platform_get_irq (pdev,0 ); -if (!ssc->irq) { +if (ssc->irq <0 ) {dev_dbg (&pdev->dev,"could not get irq\n" ); -return -ENXIO ; +return ssc->irq; }mutex_lock (&user_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 65/141 riscv: dts: microchip: re-add pdma to mpfs device tree
In reply to Greg Kroah-HartmanFrom: Conor Dooley <[email protected]>
[ Upstream commit 5e757deddd918edb8cb2fdb56eb79656ffc6dade ]
PolarFire SoC /does/ have a SiFive pdma, despite what I suggested as a conflict resolution to Zong. Somehow the entry fell through the cracks between versions of my dt patches, so re-add it with Zong's updated compatible & dma-channels property.
--- arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi +9 -0
@@ -188,6 +188,15 @@ riscv,ndev = <186>; }; + pdma: dma-controller@3000000 { + compatible = "sifive,fu540-c000-pdma", "sifive,pdma0"; + reg = <0x0 0x3000000 0x0 0x8000>; + interrupt-parent = <&plic>; + interrupts = <5 6>, <7 8>, <9 10>, <11 12>; + dma-channels = <4>; + #dma-cells = <1>; + }; + clkcfg: clkcfg@20002000 { compatible = "microchip,mpfs-clkcfg"; reg = <0x0 0x20002000 0x0 0x1000>, <0x0 0x3E001000 0x0 0x1000>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 66/141 io_uring: fix races with file table unregister
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
[ Upstream commit b0380bf6dad4601d92025841e2b7a135d566c6e3 ]
Fixed file table quiesce might unlock ->uring_lock, potentially letting new requests to be submitted, don't allow those requests to use the table as they will race with unregistration.
--- fs/io_uring.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/io_uring.c +8 -0
@@ -8508,11 +8508,19 @@ static void __io_sqe_files_unregister(struct io_ring_ctx *ctx)static int io_sqe_files_unregister (struct io_ring_ctx *ctx) { +unsigned nr = ctx->nr_user_files;int ret;if (!ctx->file_data)return -ENXIO ; + +/* +* Quiesce may unlock ->uring_lock, and while it's not held +* prevent new requests using the table. +*/ + ctx->nr_user_files =0 ; ret =io_rsrc_ref_quiesce (ctx->file_data, ctx); + ctx->nr_user_files = nr;if (!ret)__io_sqe_files_unregister (ctx);return ret;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 67/141 io_uring: fix races with buffer table unregister
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
[ Upstream commit d11d31fc5d8a96f707facee0babdcffaafa38de2 ]
Fixed buffer table quiesce might unlock ->uring_lock, potentially letting new requests to be submitted, don't allow those requests to use the table as they will race with unregistration.
--- fs/io_uring.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/io_uring.c +7 -0
@@ -9495,12 +9495,19 @@ static void __io_sqe_buffers_unregister(struct io_ring_ctx *ctx)static int io_sqe_buffers_unregister (struct io_ring_ctx *ctx) { +unsigned nr = ctx->nr_user_bufs;int ret;if (!ctx->buf_data)return -ENXIO ; +/* +* Quiesce may unlock ->uring_lock, and while it's not held +* prevent new requests using the table. +*/ + ctx->nr_user_bufs =0 ; ret =io_rsrc_ref_quiesce (ctx->buf_data, ctx); + ctx->nr_user_bufs = nr;if (!ret)__io_sqe_buffers_unregister (ctx);return ret;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 68/141 drm/i915/reset: Fix error_state_read ptr + offset use
In reply to Greg Kroah-HartmanFrom: Alan Previn <[email protected]>
[ Upstream commit c9b576d0c7bf55aeae1a736da7974fa202c4394d ]
Fix our pointer offset usage in error_state_read
when there is no i915_gpu_coredump but buf offset
is non-zero.
This fixes a kernel page fault can happen when multiple tests are running concurrently in a loop and one is producing engine resets and consuming the i915 error_state dump while the other is forcing full GT resets. (takes a while to trigger).
The dmesg call trace:
[ 5590.803000] BUG: unable to handle page fault for address:
ffffffffa0b0e000
[ 5590.803009] #PF: supervisor read access in kernel mode
[ 5590.803013] #PF: error_code(0x0000) - not-present page
[ 5590.803016] PGD 5814067 P4D 5814067 PUD 5815063 PMD 109de4067
PTE 0
[ 5590.803022] Oops: 0000 [#1] PREEMPT SMP NOPTI
[ 5590.803026] CPU: 5 PID: 13656 Comm: i915_hangman Tainted: G U
5.17.0-rc5-ups69-guc-err-capt-rev6+ #136
[ 5590.803033] Hardware name: Intel Corporation Alder Lake Client
Platform/AlderLake-M LP4x RVP, BIOS ADLPFWI1.R00.
3031.A02.2201171222 01/17/2022
[ 5590.803039] RIP: 0010:memcpy_erms+0x6/0x10
[ 5590.803045] Code: fe ff ff cc eb 1e 0f 1f 00 48 89 f8 48 89 d1
48 c1 e9 03 83 e2 07 f3 48 a5 89 d1 f3 a4 c3
66 0f 1f 44 00 00 48 89 f8 48 89 d1 <f3> a4
c3 0f 1f 80 00 00 00 00 48 89 f8 48 83 fa 20
72 7e 40 38 fe
[ 5590.803054] RSP: 0018:ffffc90003a8fdf0 EFLAGS: 00010282
[ 5590.803057] RAX: ffff888107ee9000 RBX: ffff888108cb1a00
RCX: 0000000000000f8f
[ 5590.803061] RDX: 0000000000001000 RSI: ffffffffa0b0e000
RDI: ffff888107ee9071
[ 5590.803065] RBP: 0000000000000000 R08: 0000000000000001
R09: 0000000000000001
[ 5590.803069] R10: 0000000000000001 R11: 0000000000000002
R12: 0000000000000019
[ 5590.803073] R13: 0000000000174fff R14: 0000000000001000
R15: ffff888107ee9000
[ 5590.803077] FS: 00007f62a99bee80(0000) GS:ffff88849f880000(0000)
knlGS:0000000000000000
[ 5590.803082] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 5590.803085] CR2: ffffffffa0b0e000 CR3: 000000010a1a8004
CR4: 0000000000770ee0
[ 5590.803089] PKRU: 55555554
[ 5590.803091] Call Trace:
[ 5590.803093] <TASK>
[ 5590.803096] error_state_read+0xa1/0xd0 [i915]
[ 5590.803175] kernfs_fop_read_iter+0xb2/0x1b0
[ 5590.803180] new_sync_read+0x116/0x1a0
[ 5590.803185] vfs_read+0x114/0x1b0
[ 5590.803189] ksys_read+0x63/0xe0
[ 5590.803193] do_syscall_64+0x38/0xc0
[ 5590.803197] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 5590.803201] RIP: 0033:0x7f62aaea5912
[ 5590.803204] Code: c0 e9 b2 fe ff ff 50 48 8d 3d 5a b9 0c 00 e8 05
19 02 00 0f 1f 44 00 00 f3 0f 1e fa 64 8b 04 25
18 00 00 00 85 c0 75 10 0f 05 <48> 3d 00 f0 ff
ff 77 56 c3 0f 1f 44 00 00 48 83 ec 28 48 89 54 24
[ 5590.803213] RSP: 002b:00007fff5b659ae8 EFLAGS: 00000246
ORIG_RAX: 0000000000000000
[ 5590.803218] RAX: ffffffffffffffda RBX: 0000000000100000
RCX: 00007f62aaea5912
[ 5590.803221] RDX: 000000000008b000 RSI: 00007f62a8c4000f
RDI: 0000000000000006
[ 5590.803225] RBP: 00007f62a8bcb00f R08: 0000000000200010
R09: 0000000000101000
[ 5590.803229] R10: 0000000000000001 R11: 0000000000000246
R12: 0000000000000006
[ 5590.803233] R13: 0000000000075000 R14: 00007f62a8acb010
R15: 0000000000200000
[ 5590.803238] </TASK>
[ 5590.803240] Modules linked in: i915 ttm drm_buddy drm_dp_helper
drm_kms_helper syscopyarea sysfillrect sysimgblt
fb_sys_fops prime_numbers nfnetlink br_netfilter
overlay mei_pxp mei_hdcp x86_pkg_temp_thermal
coretemp kvm_intel snd_hda_codec_hdmi snd_hda_intel
snd_intel_dspcfg snd_hda_codec snd_hwdep
snd_hda_core snd_pcm mei_me mei fuse ip_tables
x_tables crct10dif_pclmul e1000e crc32_pclmul ptp
i2c_i801 ghash_clmulni_intel i2c_smbus pps_core
[last unloa ded: ttm]
[ 5590.803277] CR2: ffffffffa0b0e000
[ 5590.803280] ---[ end trace 0000000000000000 ]------ drivers/gpu/drm/i915/i915_sysfs.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_sysfs.c +12 -3
@@ -432,7 +432,14 @@ static ssize_t error_state_read(struct file *filp, struct kobject *kobj,struct device *kdev =kobj_to_dev (kobj);struct drm_i915_private *i915 =kdev_minor_to_i915 (kdev);struct i915_gpu_coredump *gpu; -ssize_t ret; +ssize_t ret =0 ; + +/* +* FIXME: Concurrent clients triggering resets and reading + clearing +* dumps can cause inconsistent sysfs reads when a user calls in with a +* non-zero offset to complete a prior partial read but the +* gpu_coredump has been cleared or replaced. +*/ gpu =i915_first_error_state (i915);if (IS_ERR (gpu)) {
@@ -444,8 +451,10 @@ static ssize_t error_state_read(struct file *filp, struct kobject *kobj,const char *str ="No error state collected\n" ;size_t len =strlen (str); - ret =min_t (size_t, count, len - off); -memcpy (buf, str + off, ret); +if (off < len) { + ret =min_t (size_t, count, len - off); +memcpy (buf, str + off, ret); + } }return ret;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 69/141 net: hns3: set port base vlan tbl_sta to false before removing old vlan
In reply to Greg Kroah-HartmanFrom: Guangbin Huang <[email protected]>
[ Upstream commit 9eda7d8bcbdb6909f202edeedff51948f1cad1e5 ]
When modify port base vlan, the port base vlan tbl_sta needs to set to false before removing old vlan, to indicate this operation is not finish.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +1 -0
@@ -10136,6 +10136,7 @@ static int hclge_modify_port_base_vlan_tag(struct hclge_vport *vport,if (ret)return ret; + vport->port_base_vlan_cfg.tbl_sta = false;/* remove old VLAN tag */ if (old_info->vlan_tag ==0 ) ret = hclge_set_vf_vlan_common(hdev, vport->vport_id,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 70/141 net: hns3: dont push link state to VF if unalive
In reply to Greg Kroah-HartmanFrom: Jian Shen <[email protected]>
[ Upstream commit 283847e3ef6dbf79bf67083b5ce7b8033e8b6f34 ]
It's unnecessary to push link state to unalive VF, and the VF will query link state from PF when it being start works.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +6 -0
@@ -3384,6 +3384,12 @@ static int hclge_set_vf_link_state(struct hnae3_handle *handle, int vf, link_state_old = vport->vf_info.link_state; vport->vf_info.link_state = link_state; +/* return success directly if the VF is unalive, VF will +* query link state itself when it starts work. +*/ +if (!test_bit (HCLGE_VPORT_STATE_ALIVE , &vport->state)) +return 0 ; + ret =hclge_push_vf_link_status (vport);if (ret) { vport->vf_info.link_state = link_state_old;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 71/141 net: hns3: restore tm priority/qset to default settings when tc disabled
In reply to Greg Kroah-HartmanFrom: Guangbin Huang <[email protected]>
[ Upstream commit e93530ae0e5d8fcf2d908933d206e0c93bc3c09b ]
Currently, settings parameters of schedule mode, dwrr, shaper of tm priority or qset of one tc are only be set when tc is enabled, they are not restored to the default settings when tc is disabled. It confuses users when they cat tm_priority or tm_qset files of debugfs. So this patch fixes it.
--- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 1 + .../ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 95 +++++++++++++------ 2 files changed, 65 insertions(+), 31 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hnae3.h +1 -0
@@ -765,6 +765,7 @@ struct hnae3_tc_info {u8 prio_tc[HNAE3_MAX_USER_PRIO ];/* TC indexed by prio */ u16 tqp_count[HNAE3_MAX_TC ];u16 tqp_offset[HNAE3_MAX_TC ]; +u8 max_tc;/* Total number of TCs */ u8 num_tc;/* Total number of enabled TCs */ bool mqprio_active; };
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +64 -31
192 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 72/141 net: hns3: fix PF rss size initialization bug
In reply to Greg Kroah-HartmanFrom: Jie Wang <[email protected]>
[ Upstream commit 71b215f36dca1a3d5d1c576b2099e6d7ea03047e ]
Currently hns3 driver misuses the VF rss size to initialize the PF rss size in hclge_tm_vport_tc_info_update. So this patch fix it by checking the vport id before initialization.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +3 -1
@@ -681,7 +681,9 @@ static void hclge_tm_vport_tc_info_update(struct hclge_vport *vport) kinfo->num_tqps =hclge_vport_get_tqp_num (vport); vport->dwrr =100 ;/* 100 percent as init */ vport->bw_limit = hdev->tm_info.pg_info[0 ].bw_limit; - hdev->rss_cfg.rss_size = kinfo->rss_size; + +if (vport->vport_id ==PF_VPORT_ID ) + hdev->rss_cfg.rss_size = kinfo->rss_size;/* when enable mqprio, the tc_info has been updated. */ if (kinfo->tc_info.mqprio_active)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 73/141 net: hns3: fix tm port shapping of fibre port is incorrect after driver initialization
In reply to Greg Kroah-HartmanFrom: Guangbin Huang <[email protected]>
[ Upstream commit 12a3670887725df364cc3e030cf3bede6f13b364 ]
Currently in driver initialization process, driver will set shapping parameters of tm port to default speed read from firmware. However, the speed of SFP module may not be default speed, so shapping parameters of tm port may be incorrect.
To fix this problem, driver sets new shapping parameters for tm port after getting exact speed of SFP module in this case.
--- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 11 ++++++++--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h | 1 + 3 files changed, 10 insertions(+), 4 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +8 -3
@@ -3276,7 +3276,7 @@ static int hclge_tp_port_init(struct hclge_dev *hdev)static int hclge_update_port_info (struct hclge_dev *hdev) {struct hclge_mac *mac = &hdev->hw.mac; -int speed =HCLGE_MAC_SPEED_UNKNOWN ; +int speed;int ret;/* get the port info from SFP cmd if not copper port */
@@ -3287,10 +3287,13 @@ static int hclge_update_port_info(struct hclge_dev *hdev)if (!hdev->support_sfp_query)return 0 ; -if (hdev->ae_dev->dev_version >=HNAE3_DEVICE_VERSION_V2 ) +if (hdev->ae_dev->dev_version >=HNAE3_DEVICE_VERSION_V2 ) { + speed = mac->speed; ret =hclge_get_sfp_info (hdev, mac); -else + }else { + speed =HCLGE_MAC_SPEED_UNKNOWN ; ret =hclge_get_sfp_speed (hdev, &speed); + }if (ret == -EOPNOTSUPP ) { hdev->support_sfp_query = false;
@@ -3302,6 +3305,8 @@ static int hclge_update_port_info(struct hclge_dev *hdev)if (hdev->ae_dev->dev_version >=HNAE3_DEVICE_VERSION_V2 ) {if (mac->speed_type ==QUERY_ACTIVE_SPEED ) {hclge_update_port_capability (hdev, mac); +if (mac->speed != speed) + (void )hclge_tm_port_shaper_cfg (hdev);return 0 ; } return hclge_cfg_mac_speed_dup(hdev, mac->speed,
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +1 -1
@@ -420,7 +420,7 @@ static int hclge_tm_pg_shapping_cfg(struct hclge_dev *hdev,return hclge_cmd_send (&hdev->hw, &desc,1 ); } -static int hclge_tm_port_shaper_cfg (struct hclge_dev *hdev) +int hclge_tm_port_shaper_cfg (struct hclge_dev *hdev) {struct hclge_port_shapping_cmd *shap_cfg_cmd;struct hclge_shaper_ir_para ir_para;
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h +1 -0
@@ -237,6 +237,7 @@ int hclge_pause_addr_cfg(struct hclge_dev *hdev, const u8 *mac_addr);void hclge_pfc_rx_stats_get (struct hclge_dev *hdev,u64 *stats);void hclge_pfc_tx_stats_get (struct hclge_dev *hdev,u64 *stats);int hclge_tm_qs_shaper_cfg (struct hclge_vport *vport,int max_tx_rate); +int hclge_tm_port_shaper_cfg (struct hclge_dev *hdev);int hclge_tm_get_qset_num (struct hclge_dev *hdev,u16 *qset_num);int hclge_tm_get_pri_num (struct hclge_dev *hdev,u8 *pri_num); int hclge_tm_get_qset_map_pri(struct hclge_dev *hdev, u16 qset_id, u8 *priority,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 74/141 nvme: add device name to warning in uuid_show()
In reply to Greg Kroah-HartmanFrom: Thomas Weißschuh <[email protected]>
[ Upstream commit 1fc766b5c08417248e0008bca14c3572ac0f1c26 ]
This provides more context to users.
Old message:
[ 00.000000] No UUID available providing old NGUID
New message:
[ 00.000000] block nvme0n1: No UUID available providing old NGUID
--- drivers/nvme/host/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/core.c +2 -2
@@ -3226,8 +3226,8 @@ static ssize_t uuid_show(struct device *dev, struct device_attribute *attr,* we have no UUID set */ if (uuid_is_null (&ids->uuid)) { -printk_ratelimited (KERN_WARNING -"No UUID available providing old NGUID\n" ); +dev_warn_ratelimited (dev, +"No UUID available providing old NGUID\n" );return sysfs_emit (buf,"%pU\n" , ids->nguid); }return sysfs_emit (buf,"%pU\n" , &ids->uuid);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 75/141 mlxsw: spectrum_cnt: Reorder counter pools
In reply to Greg Kroah-HartmanFrom: Petr Machata <[email protected]>
[ Upstream commit 4b7a632ac4e7101ceefee8484d5c2ca505d347b3 ]
Both RIF and ACL flow counters use a 24-bit SW-managed counter address to communicate which counter they want to bind.
In a number of Spectrum FW releases, binding a RIF counter is broken and slices the counter index to 16 bits. As a result, on Spectrum-2 and above, no more than about 410 RIF counters can be effectively used. This translates to 205 netdevices for which L3 HW stats can be enabled. (This does not happen on Spectrum-1, because there are fewer counters available overall and the counter index never exceeds 16 bits.)
Binding counters to ACLs does not have this issue. Therefore reorder the counter allocation scheme so that RIF counters come first and therefore get lower indices that are below the 16-bit barrier.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.h +1 -1
@@ -8,8 +8,8 @@#include "spectrum.h" enum mlxsw_sp_counter_sub_pool_id { -MLXSW_SP_COUNTER_SUB_POOL_FLOW ,MLXSW_SP_COUNTER_SUB_POOL_RIF , +MLXSW_SP_COUNTER_SUB_POOL_FLOW , }; int mlxsw_sp_counter_alloc(struct mlxsw_sp *mlxsw_sp,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 76/141 ice: Fix PTP TX timestamp offset calculation
In reply to Greg Kroah-HartmanFrom: Michal Michalik <[email protected]>
[ Upstream commit 71a579f0d3777a704355e6f1572dfba92a9b58b2 ]
The offset was being incorrectly calculated for E822 - that led to collisions in choosing TX timestamp register location when more than one port was trying to use timestamping mechanism.
In E822 one quad is being logically split between ports, so quad 0 is having trackers for ports 0-3, quad 1 ports 4-7 etc. Each port should have separate memory location for tracking timestamps. Due to error for example ports 1 and 2 had been assigned to quad 0 with same offset (0), while port 1 should have offset 0 and 1 offset 16.
Fix it by correctly calculating quad offset.
--- drivers/net/ethernet/intel/ice/ice_ptp.c | 2 +- drivers/net/ethernet/intel/ice/ice_ptp.h | 31 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_ptp.c +1 -1
@@ -2271,7 +2271,7 @@ static int ice_ptp_init_tx_e822(struct ice_pf *pf, struct ice_ptp_tx *tx, u8 port) { tx->quad = port / ICE_PORTS_PER_QUAD; - tx->quad_offset = tx->quad *INDEX_PER_PORT ; + tx->quad_offset = (port %ICE_PORTS_PER_QUAD ) *INDEX_PER_PORT ; tx->len =INDEX_PER_PORT ;return ice_ptp_alloc_tx_tracker (tx);
drivers/net/ethernet/intel/ice/ice_ptp.h +31 -0
@@ -49,6 +49,37 @@ struct ice_perout_channel {* To allow multiple ports to access the shared register block independently, * the blocks are split up so that indexes are assigned to each port based on * hardware logical port number. +* +* The timestamp blocks are handled differently for E810- and E822-based +* devices. In E810 devices, each port has its own block of timestamps, while in +* E822 there is a need to logically break the block of registers into smaller +* chunks based on the port number to avoid collisions. +* +* Example for port 5 in E810: +* +--------+--------+--------+--------+--------+--------+--------+--------+ +* |register|register|register|register|register|register|register|register| +* | block | block | block | block | block | block | block | block | +* | for | for | for | for | for | for | for | for | +* | port 0 | port 1 | port 2 | port 3 | port 4 | port 5 | port 6 | port 7 | +* +--------+--------+--------+--------+--------+--------+--------+--------+ +* ^^ +* || +* |--- quad offset is always 0 +* ---- quad number +* +* Example for port 5 in E822: +* +-----------------------------+-----------------------------+ +* | register block for quad 0 | register block for quad 1 | +* |+------+------+------+------+|+------+------+------+------+| +* ||port 0|port 1|port 2|port 3|||port 0|port 1|port 2|port 3|| +* |+------+------+------+------+|+------+------+------+------+| +* +-----------------------------+-------^---------------------+ +* ^ | +* | --- quad offset* +* ---- quad number +* +* * PHY port 5 is port 1 in quad 1 +* */ /**
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 77/141 ice: Sync VLAN filtering features for DVM
In reply to Greg Kroah-HartmanFrom: Roman Storozhenko <[email protected]>
[ Upstream commit 9542ef4fba8c73e176b8aa18a8adf04aecb889e5 ]
VLAN filtering features, that is C-Tag and S-Tag, in DVM mode must be both enabled or disabled.
In case of turning off/on only one of the features, another feature must be turned off/on automatically with issuing an appropriate message to the kernel log.
--- drivers/net/ethernet/intel/ice/ice_main.c | 49 ++++++++++++++--------- 1 file changed, 31 insertions(+), 18 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +31 -18
@@ -5746,25 +5746,38 @@ static netdev_features_t ice_fix_features(struct net_device *netdev, netdev_features_t features) {struct ice_netdev_priv *np =netdev_priv (netdev); -netdev_features_t supported_vlan_filtering; -netdev_features_t requested_vlan_filtering; -struct ice_vsi *vsi = np->vsi; - - requested_vlan_filtering = features &NETIF_VLAN_FILTERING_FEATURES ; - -/* make sure supported_vlan_filtering works for both SVM and DVM */ - supported_vlan_filtering =NETIF_F_HW_VLAN_CTAG_FILTER ; -if (ice_is_dvm_ena (&vsi->back->hw)) - supported_vlan_filtering |=NETIF_F_HW_VLAN_STAG_FILTER ; - -if (requested_vlan_filtering && - requested_vlan_filtering != supported_vlan_filtering) { -if (requested_vlan_filtering &NETIF_F_HW_VLAN_CTAG_FILTER ) { -netdev_warn (netdev,"cannot support requested VLAN filtering settings, enabling all supported VLAN filtering settings\n" ); - features |= supported_vlan_filtering; +netdev_features_t req_vlan_fltr, cur_vlan_fltr; +bool cur_ctag, cur_stag, req_ctag, req_stag; + + cur_vlan_fltr = netdev->features &NETIF_VLAN_FILTERING_FEATURES ; + cur_ctag = cur_vlan_fltr &NETIF_F_HW_VLAN_CTAG_FILTER ; + cur_stag = cur_vlan_fltr &NETIF_F_HW_VLAN_STAG_FILTER ; + + req_vlan_fltr = features &NETIF_VLAN_FILTERING_FEATURES ; + req_ctag = req_vlan_fltr &NETIF_F_HW_VLAN_CTAG_FILTER ; + req_stag = req_vlan_fltr &NETIF_F_HW_VLAN_STAG_FILTER ; + +if (req_vlan_fltr != cur_vlan_fltr) { +if (ice_is_dvm_ena (&np->vsi->back->hw)) { +if (req_ctag && req_stag) { + features |=NETIF_VLAN_FILTERING_FEATURES ; + }else if (!req_ctag && !req_stag) { + features &= ~NETIF_VLAN_FILTERING_FEATURES ; + }else if ((!cur_ctag && req_ctag && !cur_stag) || + (!cur_stag && req_stag && !cur_ctag)) { + features |=NETIF_VLAN_FILTERING_FEATURES ; +netdev_warn (netdev,"802.1Q and 802.1ad VLAN filtering must be either both on or both off. VLAN filtering has been enabled for both types.\n" ); + }else if ((cur_ctag && !req_ctag && cur_stag) || + (cur_stag && !req_stag && cur_ctag)) { + features &= ~NETIF_VLAN_FILTERING_FEATURES ; +netdev_warn (netdev,"802.1Q and 802.1ad VLAN filtering must be either both on or both off. VLAN filtering has been disabled for both types.\n" ); + } }else { -netdev_warn (netdev,"cannot support requested VLAN filtering settings, clearing all supported VLAN filtering settings\n" ); - features &= ~supported_vlan_filtering; +if (req_vlan_fltr &NETIF_F_HW_VLAN_STAG_FILTER ) +netdev_warn (netdev,"cannot support requested 802.1ad filtering setting in SVM mode\n" ); + +if (req_vlan_fltr &NETIF_F_HW_VLAN_CTAG_FILTER ) + features |=NETIF_F_HW_VLAN_CTAG_FILTER ; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 78/141 ice: Fix queue config fail handling
In reply to Greg Kroah-HartmanFrom: Przemyslaw Patynowski <[email protected]>
[ Upstream commit be2af71496a54a7195ac62caba6fab49cfe5006c ]
Disable VF's RX/TX queues, when VIRTCHNL_OP_CONFIG_VSI_QUEUES fail. Not disabling them might lead to scenario, where PF driver leaves VF queues enabled, when VF's VSI failed queue config.
In this scenario VF should not have RX/TX queues enabled. If PF failed to set up VF's queues, VF will reset due to TX timeouts in VF driver. Initialize iterator 'i' to -1, so if error happens prior to configuring queues then error path code will not disable queue 0. Loop that configures queues will is using same iterator, so error path code will only disable queues that were configured.
--- drivers/net/ethernet/intel/ice/ice_virtchnl.c | 53 +++++++++---------- 1 file changed, 26 insertions(+), 27 deletions(-)
drivers/net/ethernet/intel/ice/ice_virtchnl.c +26 -27
@@ -1587,35 +1587,27 @@ static int ice_vc_cfg_irq_map_msg(struct ice_vf *vf, u8 *msg)*/ static int ice_vc_cfg_qs_msg (struct ice_vf *vf,u8 *msg) { -enum virtchnl_status_code v_ret =VIRTCHNL_STATUS_SUCCESS ;struct virtchnl_vsi_queue_config_info *qci = (struct virtchnl_vsi_queue_config_info *)msg;struct virtchnl_queue_pair_info *qpi;struct ice_pf *pf = vf->pf;struct ice_vsi *vsi; -int i, q_idx; +int i =-1 , q_idx; -if (!test_bit (ICE_VF_STATE_ACTIVE , vf->vf_states)) { - v_ret =VIRTCHNL_STATUS_ERR_PARAM ; +if (!test_bit (ICE_VF_STATE_ACTIVE , vf->vf_states)) goto error_param; - } -if (!ice_vc_isvalid_vsi_id (vf, qci->vsi_id)) { - v_ret =VIRTCHNL_STATUS_ERR_PARAM ; +if (!ice_vc_isvalid_vsi_id (vf, qci->vsi_id)) goto error_param; - } vsi =ice_get_vf_vsi (vf); -if (!vsi) { - v_ret =VIRTCHNL_STATUS_ERR_PARAM ; +if (!vsi) goto error_param; - }if (qci->num_queue_pairs >ICE_MAX_RSS_QS_PER_VF || qci->num_queue_pairs >min_t (u16, vsi->alloc_txq, vsi->alloc_rxq)) {dev_err (ice_pf_to_dev (pf),"VF-%d requesting more than supported number of queues: %d\n" , vf->vf_id,min_t (u16, vsi->alloc_txq, vsi->alloc_rxq)); - v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param; }
@@ -1628,7 +1620,6 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) !ice_vc_isvalid_ring_len(qpi->txq.ring_len) || !ice_vc_isvalid_ring_len(qpi->rxq.ring_len) || !ice_vc_isvalid_q_id(vf, qci->vsi_id, qpi->txq.queue_id)) { - v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param; }
@@ -1638,7 +1629,6 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)* for selected "vsi" */ if (q_idx >= vsi->alloc_txq || q_idx >= vsi->alloc_rxq) { - v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param; }
@@ -1648,14 +1638,13 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) vsi->tx_rings[i]->count = qpi->txq.ring_len;/* Disable any existing queue first */ -if (ice_vf_vsi_dis_single_txq (vf, vsi, q_idx)) { - v_ret =VIRTCHNL_STATUS_ERR_PARAM ; +if (ice_vf_vsi_dis_single_txq (vf, vsi, q_idx)) goto error_param; - }/* Configure a queue with the requested settings */ if (ice_vsi_cfg_single_txq (vsi, vsi->tx_rings, q_idx)) { - v_ret =VIRTCHNL_STATUS_ERR_PARAM ; +dev_warn (ice_pf_to_dev (pf),"VF-%d failed to configure TX queue %d\n" , + vf->vf_id, i); goto error_param; } }
@@ -1669,17 +1658,13 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)if (qpi->rxq.databuffer_size !=0 && (qpi->rxq.databuffer_size > ((16 *1024 ) -128 ) || - qpi->rxq.databuffer_size <1024 )) { - v_ret =VIRTCHNL_STATUS_ERR_PARAM ; + qpi->rxq.databuffer_size <1024 )) goto error_param; - } vsi->rx_buf_len = qpi->rxq.databuffer_size; vsi->rx_rings[i]->rx_buf_len = vsi->rx_buf_len;if (qpi->rxq.max_pkt_size > max_frame_size || - qpi->rxq.max_pkt_size <64 ) { - v_ret =VIRTCHNL_STATUS_ERR_PARAM ; + qpi->rxq.max_pkt_size <64 ) goto error_param; - } vsi->max_frame = qpi->rxq.max_pkt_size;/* add space for the port VLAN since the VF driver is
@@ -1690,16 +1675,30 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) vsi->max_frame +=VLAN_HLEN ;if (ice_vsi_cfg_single_rxq (vsi, q_idx)) { - v_ret =VIRTCHNL_STATUS_ERR_PARAM ; +dev_warn (ice_pf_to_dev (pf),"VF-%d failed to configure RX queue %d\n" , + vf->vf_id, i); goto error_param; } } } +/* send the response to the VF */ +return ice_vc_send_msg_to_vf (vf,VIRTCHNL_OP_CONFIG_VSI_QUEUES , +VIRTCHNL_STATUS_SUCCESS ,NULL ,0 ); error_param: +/* disable whatever we can */ +for (; i >=0 ; i--) { +if (ice_vsi_ctrl_one_rx_ring (vsi, false, i, true)) +dev_err (ice_pf_to_dev (pf),"VF-%d could not disable RX queue %d\n" , + vf->vf_id, i); +if (ice_vf_vsi_dis_single_txq (vf, vsi, i)) +dev_err (ice_pf_to_dev (pf),"VF-%d could not disable TX queue %d\n" , + vf->vf_id, i); + } +/* send the response to the VF */ -return ice_vc_send_msg_to_vf (vf,VIRTCHNL_OP_CONFIG_VSI_QUEUES , v_ret, -NULL ,0 ); +return ice_vc_send_msg_to_vf (vf,VIRTCHNL_OP_CONFIG_VSI_QUEUES , +VIRTCHNL_STATUS_ERR_PARAM ,NULL ,0 ); }/**
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 79/141 ice: Fix memory corruption in VF driver
In reply to Greg Kroah-HartmanFrom: Przemyslaw Patynowski <[email protected]>
[ Upstream commit efe41860008e57fb6b69855b4b93fdf34bc42798 ]
Disable VF's RX/TX queues, when it's disabled. VF can have queues enabled, when it requests a reset. If PF driver assumes that VF is disabled, while VF still has queues configured, VF may unmap DMA resources. In such scenario device still can map packets to memory, which ends up silently corrupting it.
Previously, VF driver could experience memory corruption, which lead to crash:
[ 5119.170157] BUG: unable to handle kernel paging request at 00001b9780003237 [ 5119.170166] PGD 0 P4D 0 [ 5119.170173] Oops: 0002 [#1] PREEMPT_RT SMP PTI [ 5119.170181] CPU: 30 PID: 427592 Comm: kworker/u96:2 Kdump: loaded Tainted: G W I --------- - - 4.18.0-372.9.1.rt7.166.el8.x86_64 #1 [ 5119.170189] Hardware name: Dell Inc. PowerEdge R740/014X06, BIOS 2.3.10 08/15/2019 [ 5119.170193] Workqueue: iavf iavf_adminq_task [iavf] [ 5119.170219] RIP: 0010:__page_frag_cache_drain+0x5/0x30 [ 5119.170238] Code: 0f 0f b6 77 51 85 f6 74 07 31 d2 e9 05 df ff ff e9 90 fe ff ff 48 8b 05 49 db 33 01 eb b4 0f 1f 80 00 00 00 00 0f 1f 44 00 00 <f0> 29 77 34 74 01 c3 48 8b 07 f6 c4 80 74 0f 0f b6 77 51 85 f6 74 [ 5119.170244] RSP: 0018:ffffa43b0bdcfd78 EFLAGS: 00010282 [ 5119.170250] RAX: ffffffff896b3e40 RBX: ffff8fb282524000 RCX: 0000000000000002 [ 5119.170254] RDX: 0000000049000000 RSI: 0000000000000000 RDI: 00001b9780003203 [ 5119.170259] RBP: ffff8fb248217b00 R08: 0000000000000022 R09: 0000000000000009 [ 5119.170262] R10: 2b849d6300000000 R11: 0000000000000020 R12: 0000000000000000 [ 5119.170265] R13: 0000000000001000 R14: 0000000000000009 R15: 0000000000000000 [ 5119.170269] FS: 0000000000000000(0000) GS:ffff8fb1201c0000(0000) knlGS:0000000000000000 [ 5119.170274] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 5119.170279] CR2: 00001b9780003237 CR3: 00000008f3e1a003 CR4: 00000000007726e0 [ 5119.170283] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 5119.170286] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 5119.170290] PKRU: 55555554 [ 5119.170292] Call Trace: [ 5119.170298] iavf_clean_rx_ring+0xad/0x110 [iavf] [ 5119.170324] iavf_free_rx_resources+0xe/0x50 [iavf] [ 5119.170342] iavf_free_all_rx_resources.part.51+0x30/0x40 [iavf] [ 5119.170358] iavf_virtchnl_completion+0xd8a/0x15b0 [iavf] [ 5119.170377] ? iavf_clean_arq_element+0x210/0x280 [iavf] [ 5119.170397] iavf_adminq_task+0x126/0x2e0 [iavf] [ 5119.170416] process_one_work+0x18f/0x420 [ 5119.170429] worker_thread+0x30/0x370 [ 5119.170437] ? process_one_work+0x420/0x420 [ 5119.170445] kthread+0x151/0x170 [ 5119.170452] ? set_kthread_struct+0x40/0x40 [ 5119.170460] ret_from_fork+0x35/0x40 [ 5119.170477] Modules linked in: iavf sctp ip6_udp_tunnel udp_tunnel mlx4_en mlx4_core nfp tls vhost_net vhost vhost_iotlb tap tun xt_CHECKSUM ipt_MASQUERADE xt_conntrack ipt_REJECT nf_reject_ipv4 nft_compat nft_counter nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables nfnetlink bridge stp llc rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache sunrpc intel_rapl_msr iTCO_wdt iTCO_vendor_support dell_smbios wmi_bmof dell_wmi_descriptor dcdbas kvm_intel kvm irqbypass intel_rapl_common isst_if_common skx_edac irdma nfit libnvdimm x86_pkg_temp_thermal i40e intel_powerclamp coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_intel ib_uverbs rapl ipmi_ssif intel_cstate intel_uncore mei_me pcspkr acpi_ipmi ib_core mei lpc_ich i2c_i801 ipmi_si ipmi_devintf wmi ipmi_msghandler acpi_power_meter xfs libcrc32c sd_mod t10_pi sg mgag200 drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ice ahci drm libahci crc32c_intel libata tg3 megaraid_sas [ 5119.170613] i2c_algo_bit dm_mirror dm_region_hash dm_log dm_mod fuse [last unloaded: iavf] [ 5119.170627] CR2: 00001b9780003237
--- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/intel/ice/ice_vf_lib.c +5 -0
@@ -504,6 +504,11 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags) }if (ice_is_vf_disabled (vf)) { + vsi =ice_get_vf_vsi (vf); +if (WARN_ON (!vsi)) +return -EINVAL ; +ice_vsi_stop_lan_tx_rings (vsi,ICE_NO_RESET , vf->vf_id); +ice_vsi_stop_all_rx_rings (vsi);dev_dbg (dev,"VF is already disabled, there is no need for resetting it, telling VM, all is fine %d\n" , vf->vf_id);return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 80/141 net: bgmac: Fix an erroneous kfree() in bgmac_remove()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit d7dd6eccfbc95ac47a12396f84e7e1b361db654b ]
'bgmac' is part of a managed resource allocated with bgmac_alloc(). It should not be freed explicitly.
Remove the erroneous kfree() from the .remove() function.
--- drivers/net/ethernet/broadcom/bgmac-bcma.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/broadcom/bgmac-bcma.c +0 -1
@@ -332,7 +332,6 @@ static void bgmac_remove(struct bcma_device *core)bcma_mdio_mii_unregister (bgmac->mii_bus);bgmac_enet_remove (bgmac);bcma_set_drvdata (core,NULL ); -kfree (bgmac); }static struct bcma_driver bgmac_bcma_driver = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 81/141 net: remove noblock parameter from skb_recv_datagram()
In reply to Greg Kroah-HartmanFrom: Oliver Hartkopp <[email protected]>
[ Upstream commit f4b41f062c424209e3939a81e6da022e049a45f2 ]
skb_recv_datagram() has two parameters 'flags' and 'noblock' that are merged inside skb_recv_datagram() by 'flags | (noblock ? MSG_DONTWAIT : 0)'
As 'flags' may contain MSG_DONTWAIT as value most callers split the 'flags' into 'flags' and 'noblock' with finally obsolete bit operations like this:
skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, flags & MSG_DONTWAIT, &rc);
And this is not even done consistently with the 'flags' parameter.
This patch removes the obsolete and costly splitting into two parameters and only performs bit operations when really needed on the caller side.
One missing conversion thankfully reported by kernel test robot. I missed to enable kunit tests to build the mctp code.
--- drivers/isdn/mISDN/socket.c | 2 +- drivers/net/ppp/pppoe.c | 3 +-- include/linux/skbuff.h | 3 +-- net/appletalk/ddp.c | 3 +-- net/atm/common.c | 2 +- net/ax25/af_ax25.c | 3 +-- net/bluetooth/af_bluetooth.c | 3 +-- net/bluetooth/hci_sock.c | 3 +-- net/caif/caif_socket.c | 2 +- net/can/bcm.c | 5 +---- net/can/isotp.c | 4 +--- net/can/j1939/socket.c | 2 +- net/can/raw.c | 6 +----- net/core/datagram.c | 5 ++--- net/ieee802154/socket.c | 6 ++++-- net/ipv4/ping.c | 3 ++- net/ipv4/raw.c | 3 ++- net/ipv6/raw.c | 3 ++- net/iucv/af_iucv.c | 3 +-- net/key/af_key.c | 2 +- net/l2tp/l2tp_ip.c | 3 ++- net/l2tp/l2tp_ip6.c | 3 ++- net/l2tp/l2tp_ppp.c | 3 +-- net/mctp/af_mctp.c | 2 +- net/mctp/test/route-test.c | 8 ++++---- net/netlink/af_netlink.c | 3 +-- net/netrom/af_netrom.c | 3 ++- net/nfc/llcp_sock.c | 3 +-- net/nfc/rawsock.c | 3 +-- net/packet/af_packet.c | 2 +- net/phonet/datagram.c | 3 ++- net/phonet/pep.c | 6 ++++-- net/qrtr/af_qrtr.c | 3 +-- net/rose/af_rose.c | 3 ++- net/unix/af_unix.c | 5 +++-- net/vmw_vsock/vmci_transport.c | 5 +---- net/x25/af_x25.c | 3 +-- 37 files changed, 57 insertions(+), 70 deletions(-)
drivers/isdn/mISDN/socket.c +1 -1
@@ -121,7 +121,7 @@ mISDN_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,if (sk->sk_state ==MISDN_CLOSED )return 0 ; - skb =skb_recv_datagram (sk, flags, flags &MSG_DONTWAIT , &err); + skb =skb_recv_datagram (sk, flags, &err);if (!skb)return err;
drivers/net/ppp/pppoe.c +1 -2
@@ -1012,8 +1012,7 @@ static int pppoe_recvmsg(struct socket *sock, struct msghdr *m, goto end; } - skb =skb_recv_datagram (sk, flags & ~MSG_DONTWAIT , - flags &MSG_DONTWAIT , &error); + skb =skb_recv_datagram (sk, flags, &error);if (error <0 ) goto end;
include/linux/skbuff.h +1 -2
@@ -3836,8 +3836,7 @@ struct sk_buff *__skb_try_recv_datagram(struct sock *sk,struct sk_buff *__skb_recv_datagram (struct sock *sk,struct sk_buff_head *sk_queue,unsigned int flags,int *off,int *err); -struct sk_buff *skb_recv_datagram (struct sock *sk,unsigned flags,int noblock, -int *err); +struct sk_buff *skb_recv_datagram (struct sock *sk,unsigned int flags,int *err);__poll_t datagram_poll (struct file *file,struct socket *sock,struct poll_table_struct *wait); int skb_copy_datagram_iter(const struct sk_buff *from, int offset,
net/appletalk/ddp.c +1 -2
@@ -1753,8 +1753,7 @@ static int atalk_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,int err =0 ;struct sk_buff *skb; - skb =skb_recv_datagram (sk, flags & ~MSG_DONTWAIT , - flags &MSG_DONTWAIT , &err); + skb =skb_recv_datagram (sk, flags, &err);lock_sock (sk);if (!skb)
net/atm/common.c +1 -1
@@ -540,7 +540,7 @@ int vcc_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, !test_bit(ATM_VF_READY, &vcc->flags))return 0 ; - skb =skb_recv_datagram (sk, flags, flags &MSG_DONTWAIT , &error); + skb =skb_recv_datagram (sk, flags, &error);if (!skb)return error;
net/ax25/af_ax25.c +1 -2
@@ -1676,8 +1676,7 @@ static int ax25_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, }/* Now we can treat all alike */ - skb =skb_recv_datagram (sk, flags & ~MSG_DONTWAIT , - flags &MSG_DONTWAIT , &err); + skb =skb_recv_datagram (sk, flags, &err);if (skb ==NULL ) goto out;
net/bluetooth/af_bluetooth.c +1 -2
@@ -251,7 +251,6 @@ EXPORT_SYMBOL(bt_accept_dequeue);int bt_sock_recvmsg (struct socket *sock,struct msghdr *msg,size_t len,int flags) { -int noblock = flags &MSG_DONTWAIT ;struct sock *sk = sock->sk;struct sk_buff *skb;size_t copied;
@@ -263,7 +262,7 @@ int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,if (flags &MSG_OOB )return -EOPNOTSUPP ; - skb =skb_recv_datagram (sk, flags, noblock, &err); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) {if (sk->sk_shutdown &RCV_SHUTDOWN )return 0 ;
net/bluetooth/hci_sock.c +1 -2
@@ -1453,7 +1453,6 @@ static void hci_sock_cmsg(struct sock *sk, struct msghdr *msg,static int hci_sock_recvmsg (struct socket *sock,struct msghdr *msg,size_t len,int flags) { -int noblock = flags &MSG_DONTWAIT ;struct sock *sk = sock->sk;struct sk_buff *skb;int copied, err;
@@ -1470,7 +1469,7 @@ static int hci_sock_recvmsg(struct socket *sock, struct msghdr *msg,if (sk->sk_state ==BT_CLOSED )return 0 ; - skb =skb_recv_datagram (sk, flags, noblock, &err); + skb =skb_recv_datagram (sk, flags, &err);if (!skb)return err;
net/caif/caif_socket.c +1 -1
@@ -282,7 +282,7 @@ static int caif_seqpkt_recvmsg(struct socket *sock, struct msghdr *m,if (flags &MSG_OOB ) goto read_error; - skb =skb_recv_datagram (sk, flags,0 , &ret); + skb =skb_recv_datagram (sk, flags, &ret);if (!skb) goto read_error; copylen = skb->len;
net/can/bcm.c +1 -4
@@ -1632,12 +1632,9 @@ static int bcm_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,struct sock *sk = sock->sk;struct sk_buff *skb;int error =0 ; -int noblock;int err; - noblock = flags &MSG_DONTWAIT ; - flags &= ~MSG_DONTWAIT ; - skb =skb_recv_datagram (sk, flags, noblock, &error); + skb =skb_recv_datagram (sk, flags, &error);if (!skb)return error;
net/can/isotp.c +1 -3
@@ -1055,7 +1055,6 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,struct sock *sk = sock->sk;struct sk_buff *skb;struct isotp_sock *so =isotp_sk (sk); -int noblock = flags &MSG_DONTWAIT ;int ret =0 ;if (flags & ~(MSG_DONTWAIT |MSG_TRUNC |MSG_PEEK ))
@@ -1064,8 +1063,7 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,if (!so->bound)return -EADDRNOTAVAIL ; - flags &= ~MSG_DONTWAIT ; - skb =skb_recv_datagram (sk, flags, noblock, &ret); + skb =skb_recv_datagram (sk, flags, &ret);if (!skb)return ret;
net/can/j1939/socket.c +1 -1
@@ -802,7 +802,7 @@ static int j1939_sk_recvmsg(struct socket *sock, struct msghdr *msg,return sock_recv_errqueue (sock->sk, msg, size,SOL_CAN_J1939 ,SCM_J1939_ERRQUEUE ); - skb =skb_recv_datagram (sk, flags,0 , &ret); + skb =skb_recv_datagram (sk, flags, &ret);if (!skb)return ret;
net/can/raw.c +1 -5
@@ -846,16 +846,12 @@ static int raw_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,struct sock *sk = sock->sk;struct sk_buff *skb;int err =0 ; -int noblock; - - noblock = flags &MSG_DONTWAIT ; - flags &= ~MSG_DONTWAIT ;if (flags &MSG_ERRQUEUE )return sock_recv_errqueue (sk, msg, size,SOL_CAN_RAW ,SCM_CAN_RAW_ERRQUEUE ); - skb =skb_recv_datagram (sk, flags, noblock, &err); + skb =skb_recv_datagram (sk, flags, &err);if (!skb)return err;
net/core/datagram.c +2 -3
@@ -310,12 +310,11 @@ struct sk_buff *__skb_recv_datagram(struct sock *sk,EXPORT_SYMBOL (__skb_recv_datagram);struct sk_buff *skb_recv_datagram (struct sock *sk,unsigned int flags, -int noblock,int *err) +int *err) {int off =0 ; -return __skb_recv_datagram (sk, &sk->sk_receive_queue, - flags | (noblock ?MSG_DONTWAIT :0 ), +return __skb_recv_datagram (sk, &sk->sk_receive_queue, flags, &off, err); }EXPORT_SYMBOL (skb_recv_datagram);
net/ieee802154/socket.c +4 -2
@@ -314,7 +314,8 @@ static int raw_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,int err = -EOPNOTSUPP ;struct sk_buff *skb; - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags |= (noblock ?MSG_DONTWAIT :0 ); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) goto out;
@@ -703,7 +704,8 @@ static int dgram_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,struct dgram_sock *ro =dgram_sk (sk); DECLARE_SOCKADDR(struct sockaddr_ieee802154 *, saddr, msg->msg_name); - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags |= (noblock ?MSG_DONTWAIT :0 ); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) goto out;
net/ipv4/ping.c +2 -1
@@ -871,7 +871,8 @@ int ping_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock,if (flags &MSG_ERRQUEUE )return inet_recv_error (sk, msg, len, addr_len); - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags |= (noblock ?MSG_DONTWAIT :0 ); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) goto out;
net/ipv4/raw.c +2 -1
@@ -769,7 +769,8 @@ static int raw_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, goto out; } - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags |= (noblock ?MSG_DONTWAIT :0 ); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) goto out;
net/ipv6/raw.c +2 -1
@@ -477,7 +477,8 @@ static int rawv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,if (np->rxpmtu && np->rxopt.bits.rxpmtu)return ipv6_recv_rxpmtu (sk, msg, len, addr_len); - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags |= (noblock ?MSG_DONTWAIT :0 ); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) goto out;
net/iucv/af_iucv.c +1 -2
@@ -1223,7 +1223,6 @@ static void iucv_process_message_q(struct sock *sk)static int iucv_sock_recvmsg (struct socket *sock,struct msghdr *msg,size_t len,int flags) { -int noblock = flags &MSG_DONTWAIT ;struct sock *sk = sock->sk;struct iucv_sock *iucv =iucv_sk (sk);unsigned int copied, rlen;
@@ -1242,7 +1241,7 @@ static int iucv_sock_recvmsg(struct socket *sock, struct msghdr *msg,/* receive/dequeue next skb: * the function understands MSG_PEEK and, thus, does not dequeue skb */ - skb =skb_recv_datagram (sk, flags, noblock, &err); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) {if (sk->sk_shutdown &RCV_SHUTDOWN )return 0 ;
net/key/af_key.c +1 -1
@@ -3700,7 +3700,7 @@ static int pfkey_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,if (flags & ~(MSG_PEEK |MSG_DONTWAIT |MSG_TRUNC |MSG_CMSG_COMPAT )) goto out; - skb =skb_recv_datagram (sk, flags, flags &MSG_DONTWAIT , &err); + skb =skb_recv_datagram (sk, flags, &err);if (skb ==NULL ) goto out;
net/l2tp/l2tp_ip.c +2 -1
@@ -526,7 +526,8 @@ static int l2tp_ip_recvmsg(struct sock *sk, struct msghdr *msg,if (flags &MSG_OOB ) goto out; - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags |= (noblock ?MSG_DONTWAIT :0 ); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) goto out;
net/l2tp/l2tp_ip6.c +2 -1
@@ -672,7 +672,8 @@ static int l2tp_ip6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,if (flags &MSG_ERRQUEUE )return ipv6_recv_error (sk, msg, len, addr_len); - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags |= (noblock ?MSG_DONTWAIT :0 ); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) goto out;
net/l2tp/l2tp_ppp.c +1 -2
@@ -191,8 +191,7 @@ static int pppol2tp_recvmsg(struct socket *sock, struct msghdr *msg, goto end; err =0 ; - skb =skb_recv_datagram (sk, flags & ~MSG_DONTWAIT , - flags &MSG_DONTWAIT , &err); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) goto end;
net/mctp/af_mctp.c +1 -1
@@ -216,7 +216,7 @@ static int mctp_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,if (flags & ~(MSG_DONTWAIT |MSG_TRUNC |MSG_PEEK ))return -EOPNOTSUPP ; - skb =skb_recv_datagram (sk, flags, flags &MSG_DONTWAIT , &rc); + skb =skb_recv_datagram (sk, flags, &rc);if (!skb)return rc;
net/mctp/test/route-test.c +4 -4
@@ -352,7 +352,7 @@ static void mctp_test_route_input_sk(struct kunit *test)if (params->deliver) {KUNIT_EXPECT_EQ (test, rc,0 ); - skb2 =skb_recv_datagram (sock->sk,0 ,1 , &rc); + skb2 =skb_recv_datagram (sock->sk,MSG_DONTWAIT , &rc);KUNIT_EXPECT_NOT_ERR_OR_NULL (test, skb2);KUNIT_EXPECT_EQ (test, skb->len,1 );
@@ -360,7 +360,7 @@ static void mctp_test_route_input_sk(struct kunit *test) }else {KUNIT_EXPECT_NE (test, rc,0 ); - skb2 =skb_recv_datagram (sock->sk,0 ,1 , &rc); + skb2 =skb_recv_datagram (sock->sk,MSG_DONTWAIT , &rc);KUNIT_EXPECT_PTR_EQ (test, skb2,NULL ); }
@@ -423,7 +423,7 @@ static void mctp_test_route_input_sk_reasm(struct kunit *test) rc =mctp_route_input (&rt->rt, skb); } - skb2 =skb_recv_datagram (sock->sk,0 ,1 , &rc); + skb2 =skb_recv_datagram (sock->sk,MSG_DONTWAIT , &rc);if (params->rx_len) {KUNIT_EXPECT_NOT_ERR_OR_NULL (test, skb2);
@@ -582,7 +582,7 @@ static void mctp_test_route_input_sk_keys(struct kunit *test) rc =mctp_route_input (&rt->rt, skb);/* (potentially) receive message */ - skb2 =skb_recv_datagram (sock->sk,0 ,1 , &rc); + skb2 =skb_recv_datagram (sock->sk,MSG_DONTWAIT , &rc);if (params->deliver)KUNIT_EXPECT_NOT_ERR_OR_NULL (test, skb2);
net/netlink/af_netlink.c +1 -2
@@ -1931,7 +1931,6 @@ static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,struct scm_cookie scm;struct sock *sk = sock->sk;struct netlink_sock *nlk =nlk_sk (sk); -int noblock = flags &MSG_DONTWAIT ;size_t copied;struct sk_buff *skb, *data_skb;int err, ret;
@@ -1941,7 +1940,7 @@ static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, copied =0 ; - skb =skb_recv_datagram (sk, flags, noblock, &err); + skb =skb_recv_datagram (sk, flags, &err);if (skb ==NULL ) goto out;
net/netrom/af_netrom.c +2 -1
@@ -1159,7 +1159,8 @@ static int nr_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, }/* Now we can treat all alike */ -if ((skb =skb_recv_datagram (sk, flags & ~MSG_DONTWAIT , flags &MSG_DONTWAIT , &er)) ==NULL ) { + skb =skb_recv_datagram (sk, flags, &er); +if (!skb) {release_sock (sk);return er; }
net/nfc/llcp_sock.c +1 -2
@@ -821,7 +821,6 @@ static int llcp_sock_sendmsg(struct socket *sock, struct msghdr *msg,static int llcp_sock_recvmsg (struct socket *sock,struct msghdr *msg,size_t len,int flags) { -int noblock = flags &MSG_DONTWAIT ;struct sock *sk = sock->sk;unsigned int copied, rlen;struct sk_buff *skb, *cskb;
@@ -842,7 +841,7 @@ static int llcp_sock_recvmsg(struct socket *sock, struct msghdr *msg,if (flags & (MSG_OOB ))return -EOPNOTSUPP ; - skb =skb_recv_datagram (sk, flags, noblock, &err); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) {pr_err ("Recv datagram failed state %d %d %d" , sk->sk_state, err,sock_error (sk));
net/nfc/rawsock.c +1 -2
@@ -238,7 +238,6 @@ static int rawsock_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)static int rawsock_recvmsg (struct socket *sock,struct msghdr *msg,size_t len,int flags) { -int noblock = flags &MSG_DONTWAIT ;struct sock *sk = sock->sk;struct sk_buff *skb;int copied;
@@ -246,7 +245,7 @@ static int rawsock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,pr_debug ("sock=%p sk=%p len=%zu flags=%d\n" , sock, sk, len, flags); - skb =skb_recv_datagram (sk, flags, noblock, &rc); + skb =skb_recv_datagram (sk, flags, &rc);if (!skb)return rc;
net/packet/af_packet.c +1 -1
@@ -3426,7 +3426,7 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,* but then it will block. */ - skb =skb_recv_datagram (sk, flags, flags &MSG_DONTWAIT , &err); + skb =skb_recv_datagram (sk, flags, &err);/* * An error occurred so return it. Because skb_recv_datagram()
net/phonet/datagram.c +2 -1
@@ -123,7 +123,8 @@ static int pn_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, MSG_CMSG_COMPAT)) goto out_nofree; - skb =skb_recv_datagram (sk, flags, noblock, &rval); + flags |= (noblock ?MSG_DONTWAIT :0 ); + skb =skb_recv_datagram (sk, flags, &rval);if (skb ==NULL ) goto out_nofree;
net/phonet/pep.c +4 -2
@@ -772,7 +772,8 @@ static struct sock *pep_sock_accept(struct sock *sk, int flags, int *errp,u8 pipe_handle, enabled, n_sb;u8 aligned =0 ; - skb =skb_recv_datagram (sk,0 , flags &O_NONBLOCK , errp); + skb =skb_recv_datagram (sk, (flags &O_NONBLOCK ) ?MSG_DONTWAIT :0 , + errp);if (!skb)return NULL ;
@@ -1267,7 +1268,8 @@ static int pep_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,return -EINVAL ; } - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags |= (noblock ?MSG_DONTWAIT :0 ); + skb =skb_recv_datagram (sk, flags, &err);lock_sock (sk);if (skb ==NULL ) {if (err == -ENOTCONN && sk->sk_state ==TCP_CLOSE_WAIT )
net/qrtr/af_qrtr.c +1 -2
@@ -1035,8 +1035,7 @@ static int qrtr_recvmsg(struct socket *sock, struct msghdr *msg,return -EADDRNOTAVAIL ; } - skb =skb_recv_datagram (sk, flags & ~MSG_DONTWAIT , - flags &MSG_DONTWAIT , &rc); + skb =skb_recv_datagram (sk, flags, &rc);if (!skb) {release_sock (sk);return rc;
net/rose/af_rose.c +2 -1
@@ -1230,7 +1230,8 @@ static int rose_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,return -ENOTCONN ;/* Now we can treat all alike */ -if ((skb =skb_recv_datagram (sk, flags & ~MSG_DONTWAIT , flags &MSG_DONTWAIT , &er)) ==NULL ) + skb =skb_recv_datagram (sk, flags, &er); +if (!skb)return er; qbit = (skb->data[0 ] &ROSE_Q_BIT ) ==ROSE_Q_BIT ;
net/unix/af_unix.c +3 -2
@@ -1643,7 +1643,8 @@ static int unix_accept(struct socket *sock, struct socket *newsock, int flags,* so that no locks are necessary. */ - skb =skb_recv_datagram (sk,0 , flags&O_NONBLOCK , &err); + skb =skb_recv_datagram (sk, (flags &O_NONBLOCK ) ?MSG_DONTWAIT :0 , + &err);if (!skb) {/* This means receive shutdown. */ if (err ==0 )
@@ -2500,7 +2501,7 @@ static int unix_read_sock(struct sock *sk, read_descriptor_t *desc,int used, err;mutex_lock (&u->iolock); - skb =skb_recv_datagram (sk,0 ,1 , &err); + skb =skb_recv_datagram (sk,MSG_DONTWAIT , &err);mutex_unlock (&u->iolock);if (!skb)return err;
net/vmw_vsock/vmci_transport.c +1 -4
@@ -1732,19 +1732,16 @@ static int vmci_transport_dgram_dequeue(struct vsock_sock *vsk, int flags) {int err; -int noblock;struct vmci_datagram *dg;size_t payload_len;struct sk_buff *skb; - noblock = flags &MSG_DONTWAIT ; -if (flags &MSG_OOB || flags &MSG_ERRQUEUE )return -EOPNOTSUPP ;/* Retrieve the head sk_buff from the socket's receive queue. */ err =0 ; - skb =skb_recv_datagram (&vsk->sk, flags, noblock, &err); + skb =skb_recv_datagram (&vsk->sk, flags, &err);if (!skb)return err;
net/x25/af_x25.c +1 -2
@@ -1315,8 +1315,7 @@ static int x25_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, }else {/* Now we can treat all alike */ release_sock (sk); - skb =skb_recv_datagram (sk, flags & ~MSG_DONTWAIT , - flags &MSG_DONTWAIT , &rc); + skb =skb_recv_datagram (sk, flags, &rc);lock_sock (sk);if (!skb) goto out;
Signature · 1 line
2.35.1
Re: [PATCH 5.18 081/141] net: remove noblock parameter from skb_recv_datagram()
Hello Greg,
as already answered to Sascha:
---
Hello Sasha,
this patch is some kind of improvement/simplification to reduce and clean up the number of variables passed through skb_recv_datagram() call.
There is no functional change and therefore no need to backport this patch IMO.
The 'Reported-by:' tag just came from the kernel test robot when posting the original patch and getting direct feedback on some missing calling sites.
Best regards,
Oliver
Quoted 708 lines · Greg Kroah-Hartman
From: Oliver Hartkopp <[email protected]>
[ Upstream commit
f4b41f062c424209e3939a81e6da022e049a45f2]
skb_recv_datagram()has two parameters 'flags' and 'noblock' that are merged insideskb_recv_datagram()by 'flags | (noblock ?MSG_DONTWAIT: 0)'As 'flags' may contain
MSG_DONTWAITas value most callers split the 'flags' into 'flags' and 'noblock' with finally obsolete bit operations like this:
skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, flags & MSG_DONTWAIT, &rc);And this is not even done consistently with the 'flags' parameter.
This patch removes the obsolete and costly splitting into two parameters and only performs bit operations when really needed on the caller side.
One missing conversion thankfully reported by kernel test robot. I missed to enable kunit tests to build the mctp code.
Reported-by kernel test robot <[email protected]>Signed-off-by Oliver Hartkopp <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/isdn/mISDN/socket.c | 2 +- drivers/net/ppp/pppoe.c | 3 +-- include/linux/skbuff.h | 3 +-- net/appletalk/ddp.c | 3 +-- net/atm/common.c | 2 +- net/ax25/af_ax25.c | 3 +-- net/bluetooth/af_bluetooth.c | 3 +-- net/bluetooth/hci_sock.c | 3 +-- net/caif/caif_socket.c | 2 +- net/can/bcm.c | 5 +---- net/can/isotp.c | 4 +--- net/can/j1939/socket.c | 2 +- net/can/raw.c | 6 +----- net/core/datagram.c | 5 ++--- net/ieee802154/socket.c | 6 ++++-- net/ipv4/ping.c | 3 ++- net/ipv4/raw.c | 3 ++- net/ipv6/raw.c | 3 ++- net/iucv/af_iucv.c | 3 +-- net/key/af_key.c | 2 +- net/l2tp/l2tp_ip.c | 3 ++- net/l2tp/l2tp_ip6.c | 3 ++- net/l2tp/l2tp_ppp.c | 3 +-- net/mctp/af_mctp.c | 2 +- net/mctp/test/route-test.c | 8 ++++---- net/netlink/af_netlink.c | 3 +-- net/netrom/af_netrom.c | 3 ++- net/nfc/llcp_sock.c | 3 +-- net/nfc/rawsock.c | 3 +-- net/packet/af_packet.c | 2 +- net/phonet/datagram.c | 3 ++- net/phonet/pep.c | 6 ++++-- net/qrtr/af_qrtr.c | 3 +-- net/rose/af_rose.c | 3 ++- net/unix/af_unix.c | 5 +++-- net/vmw_vsock/vmci_transport.c | 5 +---- net/x25/af_x25.c | 3 +-- 37 files changed, 57 insertions(+), 70 deletions(-)drivers/isdn/mISDN/socket.c +1
-1@@ -121,7 +121,7 @@ mISDN_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,if (sk->sk_state ==MISDN_CLOSED )return 0 ; - skb =skb_recv_datagram (sk, flags, flags &MSG_DONTWAIT , &err); + skb =skb_recv_datagram (sk, flags, &err);if (!skb)return err;drivers/net/ppp/pppoe.c +1
-2@@ -1012,8 +1012,7 @@ static int pppoe_recvmsg(struct socket *sock, struct msghdr *m, goto end; } - skb =skb_recv_datagram (sk, flags & ~MSG_DONTWAIT , - flags &MSG_DONTWAIT , &error); + skb =skb_recv_datagram (sk, flags, &error);if (error <0 ) goto end;include/linux/skbuff.h +1
-2@@ -3836,8 +3836,7 @@ struct sk_buff *__skb_try_recv_datagram(struct sock *sk,struct sk_buff *__skb_recv_datagram (struct sock *sk,struct sk_buff_head *sk_queue,unsigned int flags,int *off,int *err); -struct sk_buff *skb_recv_datagram (struct sock *sk,unsigned flags,int noblock, -int *err); +struct sk_buff *skb_recv_datagram (struct sock *sk,unsigned int flags,int *err);__poll_t datagram_poll (struct file *file,struct socket *sock,struct poll_table_struct *wait); int skb_copy_datagram_iter(const struct sk_buff *from, int offset,net/appletalk/ddp.c +1
-2@@ -1753,8 +1753,7 @@ static int atalk_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,int err =0 ;struct sk_buff *skb; - skb =skb_recv_datagram (sk, flags & ~MSG_DONTWAIT , - flags &MSG_DONTWAIT , &err); + skb =skb_recv_datagram (sk, flags, &err);lock_sock (sk);if (!skb)net/atm/common.c +1
-1@@ -540,7 +540,7 @@ int vcc_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, !test_bit(ATM_VF_READY, &vcc->flags))return 0 ; - skb =skb_recv_datagram (sk, flags, flags &MSG_DONTWAIT , &error); + skb =skb_recv_datagram (sk, flags, &error);if (!skb)return error;net/ax25/af_ax25.c +1
-2@@ -1676,8 +1676,7 @@ static int ax25_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, }/* Now we can treat all alike */ - skb =skb_recv_datagram (sk, flags & ~MSG_DONTWAIT , - flags &MSG_DONTWAIT , &err); + skb =skb_recv_datagram (sk, flags, &err);if (skb ==NULL ) goto out;net/bluetooth/af_bluetooth.c +1
-2@@ -251,7 +251,6 @@ EXPORT_SYMBOL(bt_accept_dequeue);int bt_sock_recvmsg (struct socket *sock,struct msghdr *msg,size_t len,int flags) { -int noblock = flags &MSG_DONTWAIT ;struct sock *sk = sock->sk;struct sk_buff *skb;size_t copied;@@ -263,7 +262,7 @@ int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,if (flags &MSG_OOB )return -EOPNOTSUPP ; - skb =skb_recv_datagram (sk, flags, noblock, &err); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) {if (sk->sk_shutdown &RCV_SHUTDOWN )return 0 ;net/bluetooth/hci_sock.c +1
-2@@ -1453,7 +1453,6 @@ static void hci_sock_cmsg(struct sock *sk, struct msghdr *msg,static int hci_sock_recvmsg (struct socket *sock,struct msghdr *msg,size_t len,int flags) { -int noblock = flags &MSG_DONTWAIT ;struct sock *sk = sock->sk;struct sk_buff *skb;int copied, err;@@ -1470,7 +1469,7 @@ static int hci_sock_recvmsg(struct socket *sock, struct msghdr *msg,if (sk->sk_state ==BT_CLOSED )return 0 ; - skb =skb_recv_datagram (sk, flags, noblock, &err); + skb =skb_recv_datagram (sk, flags, &err);if (!skb)return err;net/caif/caif_socket.c +1
-1@@ -282,7 +282,7 @@ static int caif_seqpkt_recvmsg(struct socket *sock, struct msghdr *m,if (flags &MSG_OOB ) goto read_error; - skb =skb_recv_datagram (sk, flags,0 , &ret); + skb =skb_recv_datagram (sk, flags, &ret);if (!skb) goto read_error; copylen = skb->len;net/can/bcm.c +1
-4@@ -1632,12 +1632,9 @@ static int bcm_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,struct sock *sk = sock->sk;struct sk_buff *skb;int error =0 ; -int noblock;int err; - noblock = flags &MSG_DONTWAIT ; - flags &= ~MSG_DONTWAIT ; - skb =skb_recv_datagram (sk, flags, noblock, &error); + skb =skb_recv_datagram (sk, flags, &error);if (!skb)return error;net/can/isotp.c +1
-3@@ -1055,7 +1055,6 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,struct sock *sk = sock->sk;struct sk_buff *skb;struct isotp_sock *so =isotp_sk (sk); -int noblock = flags &MSG_DONTWAIT ;int ret =0 ;if (flags & ~(MSG_DONTWAIT |MSG_TRUNC |MSG_PEEK ))@@ -1064,8 +1063,7 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,if (!so->bound)return -EADDRNOTAVAIL ; - flags &= ~MSG_DONTWAIT ; - skb =skb_recv_datagram (sk, flags, noblock, &ret); + skb =skb_recv_datagram (sk, flags, &ret);if (!skb)return ret;net/can/j1939/socket.c +1
-1@@ -802,7 +802,7 @@ static int j1939_sk_recvmsg(struct socket *sock, struct msghdr *msg,return sock_recv_errqueue (sock->sk, msg, size,SOL_CAN_J1939 ,SCM_J1939_ERRQUEUE ); - skb =skb_recv_datagram (sk, flags,0 , &ret); + skb =skb_recv_datagram (sk, flags, &ret);if (!skb)return ret;net/can/raw.c +1
-5@@ -846,16 +846,12 @@ static int raw_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,struct sock *sk = sock->sk;struct sk_buff *skb;int err =0 ; -int noblock; - - noblock = flags &MSG_DONTWAIT ; - flags &= ~MSG_DONTWAIT ;if (flags &MSG_ERRQUEUE )return sock_recv_errqueue (sk, msg, size,SOL_CAN_RAW ,SCM_CAN_RAW_ERRQUEUE ); - skb =skb_recv_datagram (sk, flags, noblock, &err); + skb =skb_recv_datagram (sk, flags, &err);if (!skb)return err;net/core/datagram.c +2
-3@@ -310,12 +310,11 @@ struct sk_buff *__skb_recv_datagram(struct sock *sk,EXPORT_SYMBOL (__skb_recv_datagram);struct sk_buff *skb_recv_datagram (struct sock *sk,unsigned int flags, -int noblock,int *err) +int *err) {int off =0 ; -return __skb_recv_datagram (sk, &sk->sk_receive_queue, - flags | (noblock ?MSG_DONTWAIT :0 ), +return __skb_recv_datagram (sk, &sk->sk_receive_queue, flags, &off, err); }EXPORT_SYMBOL (skb_recv_datagram);net/ieee802154/socket.c +4
-2@@ -314,7 +314,8 @@ static int raw_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,int err = -EOPNOTSUPP ;struct sk_buff *skb; - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags |= (noblock ?MSG_DONTWAIT :0 ); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) goto out;@@ -703,7 +704,8 @@ static int dgram_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,struct dgram_sock *ro =dgram_sk (sk); DECLARE_SOCKADDR(struct sockaddr_ieee802154 *, saddr, msg->msg_name); - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags |= (noblock ?MSG_DONTWAIT :0 ); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) goto out;net/ipv4/ping.c +2
-1@@ -871,7 +871,8 @@ int ping_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock,if (flags &MSG_ERRQUEUE )return inet_recv_error (sk, msg, len, addr_len); - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags |= (noblock ?MSG_DONTWAIT :0 ); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) goto out;net/ipv4/raw.c +2
-1@@ -769,7 +769,8 @@ static int raw_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, goto out; } - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags |= (noblock ?MSG_DONTWAIT :0 ); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) goto out;net/ipv6/raw.c +2
-1@@ -477,7 +477,8 @@ static int rawv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,if (np->rxpmtu && np->rxopt.bits.rxpmtu)return ipv6_recv_rxpmtu (sk, msg, len, addr_len); - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags |= (noblock ?MSG_DONTWAIT :0 ); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) goto out;net/iucv/af_iucv.c +1
-2@@ -1223,7 +1223,6 @@ static void iucv_process_message_q(struct sock *sk)static int iucv_sock_recvmsg (struct socket *sock,struct msghdr *msg,size_t len,int flags) { -int noblock = flags &MSG_DONTWAIT ;struct sock *sk = sock->sk;struct iucv_sock *iucv =iucv_sk (sk);unsigned int copied, rlen;@@ -1242,7 +1241,7 @@ static int iucv_sock_recvmsg(struct socket *sock, struct msghdr *msg,/* receive/dequeue next skb: * the function understands MSG_PEEK and, thus, does not dequeue skb */ - skb =skb_recv_datagram (sk, flags, noblock, &err); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) {if (sk->sk_shutdown &RCV_SHUTDOWN )return 0 ;net/key/af_key.c +1
-1@@ -3700,7 +3700,7 @@ static int pfkey_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,if (flags & ~(MSG_PEEK |MSG_DONTWAIT |MSG_TRUNC |MSG_CMSG_COMPAT )) goto out; - skb =skb_recv_datagram (sk, flags, flags &MSG_DONTWAIT , &err); + skb =skb_recv_datagram (sk, flags, &err);if (skb ==NULL ) goto out;net/l2tp/l2tp_ip.c +2
-1@@ -526,7 +526,8 @@ static int l2tp_ip_recvmsg(struct sock *sk, struct msghdr *msg,if (flags &MSG_OOB ) goto out; - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags |= (noblock ?MSG_DONTWAIT :0 ); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) goto out;net/l2tp/l2tp_ip6.c +2
-1@@ -672,7 +672,8 @@ static int l2tp_ip6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,if (flags &MSG_ERRQUEUE )return ipv6_recv_error (sk, msg, len, addr_len); - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags |= (noblock ?MSG_DONTWAIT :0 ); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) goto out;net/l2tp/l2tp_ppp.c +1
-2@@ -191,8 +191,7 @@ static int pppol2tp_recvmsg(struct socket *sock, struct msghdr *msg, goto end; err =0 ; - skb =skb_recv_datagram (sk, flags & ~MSG_DONTWAIT , - flags &MSG_DONTWAIT , &err); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) goto end;net/mctp/af_mctp.c +1
-1@@ -216,7 +216,7 @@ static int mctp_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,if (flags & ~(MSG_DONTWAIT |MSG_TRUNC |MSG_PEEK ))return -EOPNOTSUPP ; - skb =skb_recv_datagram (sk, flags, flags &MSG_DONTWAIT , &rc); + skb =skb_recv_datagram (sk, flags, &rc);if (!skb)return rc;net/mctp/test/route-test.c +4
-4@@ -352,7 +352,7 @@ static void mctp_test_route_input_sk(struct kunit *test)if (params->deliver) {KUNIT_EXPECT_EQ (test, rc,0 ); - skb2 =skb_recv_datagram (sock->sk,0 ,1 , &rc); + skb2 =skb_recv_datagram (sock->sk,MSG_DONTWAIT , &rc);KUNIT_EXPECT_NOT_ERR_OR_NULL (test, skb2);KUNIT_EXPECT_EQ (test, skb->len,1 );@@ -360,7 +360,7 @@ static void mctp_test_route_input_sk(struct kunit *test) }else {KUNIT_EXPECT_NE (test, rc,0 ); - skb2 =skb_recv_datagram (sock->sk,0 ,1 , &rc); + skb2 =skb_recv_datagram (sock->sk,MSG_DONTWAIT , &rc);KUNIT_EXPECT_PTR_EQ (test, skb2,NULL ); }@@ -423,7 +423,7 @@ static void mctp_test_route_input_sk_reasm(struct kunit *test) rc =mctp_route_input (&rt->rt, skb); } - skb2 =skb_recv_datagram (sock->sk,0 ,1 , &rc); + skb2 =skb_recv_datagram (sock->sk,MSG_DONTWAIT , &rc);if (params->rx_len) {KUNIT_EXPECT_NOT_ERR_OR_NULL (test, skb2);@@ -582,7 +582,7 @@ static void mctp_test_route_input_sk_keys(struct kunit *test) rc =mctp_route_input (&rt->rt, skb);/* (potentially) receive message */ - skb2 =skb_recv_datagram (sock->sk,0 ,1 , &rc); + skb2 =skb_recv_datagram (sock->sk,MSG_DONTWAIT , &rc);if (params->deliver)KUNIT_EXPECT_NOT_ERR_OR_NULL (test, skb2);net/netlink/af_netlink.c +1
-2@@ -1931,7 +1931,6 @@ static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,struct scm_cookie scm;struct sock *sk = sock->sk;struct netlink_sock *nlk =nlk_sk (sk); -int noblock = flags &MSG_DONTWAIT ;size_t copied;struct sk_buff *skb, *data_skb;int err, ret;@@ -1941,7 +1940,7 @@ static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, copied =0 ; - skb =skb_recv_datagram (sk, flags, noblock, &err); + skb =skb_recv_datagram (sk, flags, &err);if (skb ==NULL ) goto out;net/netrom/af_netrom.c +2
-1@@ -1159,7 +1159,8 @@ static int nr_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, }/* Now we can treat all alike */ -if ((skb =skb_recv_datagram (sk, flags & ~MSG_DONTWAIT , flags &MSG_DONTWAIT , &er)) ==NULL ) { + skb =skb_recv_datagram (sk, flags, &er); +if (!skb) {release_sock (sk);return er; }net/nfc/llcp_sock.c +1
-2@@ -821,7 +821,6 @@ static int llcp_sock_sendmsg(struct socket *sock, struct msghdr *msg,static int llcp_sock_recvmsg (struct socket *sock,struct msghdr *msg,size_t len,int flags) { -int noblock = flags &MSG_DONTWAIT ;struct sock *sk = sock->sk;unsigned int copied, rlen;struct sk_buff *skb, *cskb;@@ -842,7 +841,7 @@ static int llcp_sock_recvmsg(struct socket *sock, struct msghdr *msg,if (flags & (MSG_OOB ))return -EOPNOTSUPP ; - skb =skb_recv_datagram (sk, flags, noblock, &err); + skb =skb_recv_datagram (sk, flags, &err);if (!skb) {pr_err ("Recv datagram failed state %d %d %d" , sk->sk_state, err,sock_error (sk));net/nfc/rawsock.c +1
-2@@ -238,7 +238,6 @@ static int rawsock_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)static int rawsock_recvmsg (struct socket *sock,struct msghdr *msg,size_t len,int flags) { -int noblock = flags &MSG_DONTWAIT ;struct sock *sk = sock->sk;struct sk_buff *skb;int copied;@@ -246,7 +245,7 @@ static int rawsock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,pr_debug ("sock=%p sk=%p len=%zu flags=%d\n" , sock, sk, len, flags); - skb =skb_recv_datagram (sk, flags, noblock, &rc); + skb =skb_recv_datagram (sk, flags, &rc);if (!skb)return rc;net/packet/af_packet.c +1
-1@@ -3426,7 +3426,7 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,* but then it will block. */ - skb =skb_recv_datagram (sk, flags, flags &MSG_DONTWAIT , &err); + skb =skb_recv_datagram (sk, flags, &err);/* * An error occurred so return it. Because skb_recv_datagram() net/phonet/datagram.c +2
-1@@ -123,7 +123,8 @@ static int pn_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, MSG_CMSG_COMPAT)) goto out_nofree; - skb =skb_recv_datagram (sk, flags, noblock, &rval); + flags |= (noblock ?MSG_DONTWAIT :0 ); + skb =skb_recv_datagram (sk, flags, &rval);if (skb ==NULL ) goto out_nofree;net/phonet/pep.c +4
-2@@ -772,7 +772,8 @@ static struct sock *pep_sock_accept(struct sock *sk, int flags, int *errp,u8 pipe_handle, enabled, n_sb;u8 aligned =0 ; - skb =skb_recv_datagram (sk,0 , flags &O_NONBLOCK , errp); + skb =skb_recv_datagram (sk, (flags &O_NONBLOCK ) ?MSG_DONTWAIT :0 , + errp);if (!skb)return NULL ;@@ -1267,7 +1268,8 @@ static int pep_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,return -EINVAL ; } - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags |= (noblock ?MSG_DONTWAIT :0 ); + skb =skb_recv_datagram (sk, flags, &err);lock_sock (sk);if (skb ==NULL ) {if (err == -ENOTCONN && sk->sk_state ==TCP_CLOSE_WAIT )net/qrtr/af_qrtr.c +1
-2@@ -1035,8 +1035,7 @@ static int qrtr_recvmsg(struct socket *sock, struct msghdr *msg,return -EADDRNOTAVAIL ; } - skb =skb_recv_datagram (sk, flags & ~MSG_DONTWAIT , - flags &MSG_DONTWAIT , &rc); + skb =skb_recv_datagram (sk, flags, &rc);if (!skb) {release_sock (sk);return rc;net/rose/af_rose.c +2
-1@@ -1230,7 +1230,8 @@ static int rose_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,return -ENOTCONN ;/* Now we can treat all alike */ -if ((skb =skb_recv_datagram (sk, flags & ~MSG_DONTWAIT , flags &MSG_DONTWAIT , &er)) ==NULL ) + skb =skb_recv_datagram (sk, flags, &er); +if (!skb)return er; qbit = (skb->data[0 ] &ROSE_Q_BIT ) ==ROSE_Q_BIT ;net/unix/af_unix.c +3
-2@@ -1643,7 +1643,8 @@ static int unix_accept(struct socket *sock, struct socket *newsock, int flags,* so that no locks are necessary. */ - skb =skb_recv_datagram (sk,0 , flags&O_NONBLOCK , &err); + skb =skb_recv_datagram (sk, (flags &O_NONBLOCK ) ?MSG_DONTWAIT :0 , + &err);if (!skb) {/* This means receive shutdown. */ if (err ==0 )@@ -2500,7 +2501,7 @@ static int unix_read_sock(struct sock *sk, read_descriptor_t *desc,int used, err;mutex_lock (&u->iolock); - skb =skb_recv_datagram (sk,0 ,1 , &err); + skb =skb_recv_datagram (sk,MSG_DONTWAIT , &err);mutex_unlock (&u->iolock);if (!skb)return err;net/vmw_vsock/vmci_transport.c +1
-4@@ -1732,19 +1732,16 @@ static int vmci_transport_dgram_dequeue(struct vsock_sock *vsk, int flags) {int err; -int noblock;struct vmci_datagram *dg;size_t payload_len;struct sk_buff *skb; - noblock = flags &MSG_DONTWAIT ; -if (flags &MSG_OOB || flags &MSG_ERRQUEUE )return -EOPNOTSUPP ;/* Retrieve the head sk_buff from the socket's receive queue. */ err =0 ; - skb =skb_recv_datagram (&vsk->sk, flags, noblock, &err); + skb =skb_recv_datagram (&vsk->sk, flags, &err);if (!skb)return err;net/x25/af_x25.c +1
-2@@ -1315,8 +1315,7 @@ static int x25_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, }else {/* Now we can treat all alike */ release_sock (sk); - skb =skb_recv_datagram (sk, flags & ~MSG_DONTWAIT , - flags &MSG_DONTWAIT , &rc); + skb =skb_recv_datagram (sk, flags, &rc);lock_sock (sk);if (!skb) goto out;
Greg Kroah-Hartman
maintainerRe: [PATCH 5.18 081/141] net: remove noblock parameter from skb_recv_datagram()
Quoted 6 lines · Oliver Hartkopp
Hello Greg,
as already answered to Sascha:
---
Quoted 7 lines
Hello Sasha,
this patch is some kind of improvement/simplification to reduce and clean up the number of variables passed through
skb_recv_datagram()call.There is no functional change and therefore no need to backport this patch IMO.
It is needed by a follow-on patch that fixes a real issue.
thanks,
greg k-h
Re: [PATCH 5.18 081/141] net: remove noblock parameter from skb_recv_datagram()
Quoted 9 lines · Greg Kroah-Hartman
Quoted 8 lines · Oliver Hartkopp
Hello Greg,
as already answered to Sascha:
---
Hello Sasha,
Quoted 7 lines
Quoted 5 lines
this patch is some kind of improvement/simplification to reduce and clean up the number of variables passed through
skb_recv_datagram()call.There is no functional change and therefore no need to backport this patch IMO.
It is needed by a follow-on patch that fixes a real issue.
Ah, ok! Wasn't aware of that follow-on patch.
Sorry for the noise ;-)
Many thanks,
Oliver
Greg Kroah-Hartman
maintainerRe: [PATCH 5.18 081/141] net: remove noblock parameter from skb_recv_datagram()
Quoted 15 lines · Oliver Hartkopp
Quoted 12 lines · Greg Kroah-Hartman
Quoted 11 lines · Oliver Hartkopp
Hello Greg,
as already answered to Sascha:
---
Hello Sasha,
this patch is some kind of improvement/simplification to reduce and clean up the number of variables passed through
skb_recv_datagram()call.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
There is no functional change and therefore no need to backport this patch IMO.
It is needed by a follow-on patch that fixes a real issue.
Ah, ok! Wasn't aware of that follow-on patch.
Sorry for the noise ;-)
Not noise at all, thanks for the review,that's always appreciated.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 82/141 net: ax25: Fix deadlock caused by skb_recv_datagram in ax25_recvmsg
In reply to Greg Kroah-HartmanFrom: Duoming Zhou <[email protected]>
[ Upstream commit 219b51a6f040fa5367adadd7d58c4dda0896a01d ]
The skb_recv_datagram() in ax25_recvmsg() will hold lock_sock and block until it receives a packet from the remote. If the client doesn`t connect to server and calls read() directly, it will not receive any packets forever. As a result, the deadlock will happen.
The fail log caused by deadlock is shown below:
[ 369.606973] INFO: task ax25_deadlock:157 blocked for more than 245 seconds. [ 369.608919] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 369.613058] Call Trace: [ 369.613315] <TASK> [ 369.614072] __schedule+0x2f9/0xb20 [ 369.615029] schedule+0x49/0xb0 [ 369.615734] __lock_sock+0x92/0x100 [ 369.616763] ? destroy_sched_domains_rcu+0x20/0x20 [ 369.617941] lock_sock_nested+0x6e/0x70 [ 369.618809] ax25_bind+0xaa/0x210 [ 369.619736] __sys_bind+0xca/0xf0 [ 369.620039] ? do_futex+0xae/0x1b0 [ 369.620387] ? __x64_sys_futex+0x7c/0x1c0 [ 369.620601] ? fpregs_assert_state_consistent+0x19/0x40 [ 369.620613] __x64_sys_bind+0x11/0x20 [ 369.621791] do_syscall_64+0x3b/0x90 [ 369.622423] entry_SYSCALL_64_after_hwframe+0x46/0xb0 [ 369.623319] RIP: 0033:0x7f43c8aa8af7 [ 369.624301] RSP: 002b:00007f43c8197ef8 EFLAGS: 00000246 ORIG_RAX: 0000000000000031 [ 369.625756] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f43c8aa8af7 [ 369.626724] RDX: 0000000000000010 RSI: 000055768e2021d0 RDI: 0000000000000005 [ 369.628569] RBP: 00007f43c8197f00 R08: 0000000000000011 R09: 00007f43c8198700 [ 369.630208] R10: 0000000000000000 R11: 0000000000000246 R12: 00007fff845e6afe [ 369.632240] R13: 00007fff845e6aff R14: 00007f43c8197fc0 R15: 00007f43c8198700
This patch replaces skb_recv_datagram() with an open-coded variant of it releasing the socket lock before the __skb_wait_for_more_packets() call and re-acquiring it after such call in order that other functions that need socket lock could be executed.
what's more, the socket lock will be released only when recvmsg() will block and that should produce nicer overall behavior.
--- net/ax25/af_ax25.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-)
net/ax25/af_ax25.c +28 -5
@@ -1661,9 +1661,12 @@ static int ax25_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, int flags) {struct sock *sk = sock->sk; -struct sk_buff *skb; +struct sk_buff *skb, *last; +struct sk_buff_head *sk_queue;int copied;int err =0 ; +int off =0 ; +long timeo;lock_sock (sk);/*
@@ -1675,10 +1678,29 @@ static int ax25_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, goto out; } -/* Now we can treat all alike */ - skb =skb_recv_datagram (sk, flags, &err); -if (skb ==NULL ) - goto out; +/* We need support for non-blocking reads. */ + sk_queue = &sk->sk_receive_queue; + skb =__skb_try_recv_datagram (sk, sk_queue, flags, &off, &err, &last); +/* If no packet is available, release_sock(sk) and try again. */ +if (!skb) { +if (err != -EAGAIN ) + goto out; +release_sock (sk); + timeo =sock_rcvtimeo (sk, flags &MSG_DONTWAIT ); +while (timeo && !__skb_wait_for_more_packets (sk, sk_queue, &err, + &timeo, last)) { + skb =__skb_try_recv_datagram (sk, sk_queue, flags, &off, + &err, &last); +if (skb) +break ; + +if (err != -EAGAIN ) + goto done; + } +if (!skb) + goto done; +lock_sock (sk); + }if (!sk_to_ax25 (sk)->pidincl)skb_pull (skb,1 );/* Remove PID */
@@ -1725,6 +1747,7 @@ static int ax25_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, out:release_sock (sk); +done:return err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 83/141 arm64: ftrace: fix branch range checks
In reply to Greg Kroah-HartmanFrom: Mark Rutland <[email protected]>
[ Upstream commit 3eefdf9d1e406f3da47470b2854347009ffcb6fa ]
The branch range checks in ftrace_make_call() and ftrace_make_nop() are incorrect, erroneously permitting a forwards branch of 128M and erroneously rejecting a backwards branch of 128M.
This is because both functions calculate the offset backwards, calculating the offset *from* the target *to* the branch, rather than the other way around as the later comparisons expect.
If an out-of-range branch were erroeously permitted, this would later be rejected by aarch64_insn_gen_branch_imm() as branch_imm_common() checks the bounds correctly, resulting in warnings and the placement of a BRK instruction. Note that this can only happen for a forwards branch of exactly 128M, and so the caller would need to be exactly 128M bytes below the relevant ftrace trampoline.
If an in-range branch were erroeously rejected, then:
* For modules when CONFIG_ARM64_MODULE_PLTS=y, this would result in the use of a PLT entry, which is benign.
Note that this is the common case, as this is selected by CONFIG_RANDOMIZE_BASE (and therefore RANDOMIZE_MODULE_REGION_FULL), which distributions typically seelct. This is also selected by CONFIG_ARM64_ERRATUM_843419.
* For modules when CONFIG_ARM64_MODULE_PLTS=n, this would result in internal ftrace failures.
* For core kernel text, this would result in internal ftrace failues.
Note that for this to happen, the kernel text would need to be at least 128M bytes in size, and typical configurations are smaller tha this.
Fix this by calculating the offset *from* the branch *to* the target in both functions.
--- arch/arm64/kernel/ftrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kernel/ftrace.c +2 -2
@@ -84,7 +84,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) {unsigned long pc = rec->ip;u32 old, new; -long offset = (long )pc - (long )addr; +long offset = (long )addr - (long )pc;if (offset < -SZ_128M || offset >=SZ_128M ) {struct module *mod;
@@ -183,7 +183,7 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec,unsigned long pc = rec->ip;bool validate = true;u32 old =0 , new; -long offset = (long )pc - (long )addr; +long offset = (long )addr - (long )pc;if (offset < -SZ_128M || offset >=SZ_128M ) {u32 replaced;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 84/141 arm64: ftrace: consistently handle PLTs.
In reply to Greg Kroah-HartmanFrom: Mark Rutland <[email protected]>
[ Upstream commit a6253579977e4c6f7818eeb05bf2bc65678a7187 ]
Sometimes it is necessary to use a PLT entry to call an ftrace trampoline. This is handled by ftrace_make_call() and ftrace_make_nop(), with each having *almost* identical logic, but this is not handled by ftrace_modify_call() since its introduction in commit:
3b23e4991fb66f6d ("arm64: implement ftrace with regs")
Due to this, if we ever were to call ftrace_modify_call() for a callsite which requires a PLT entry for a trampoline, then either:
a) If the old addr requires a trampoline, ftrace_modify_call() will use an out-of-range address to generate the 'old' branch instruction. This will result in warnings from aarch64_insn_gen_branch_imm() and ftrace_modify_code(), and no instructions will be modified. As ftrace_modify_call() will return an error, this will result in subsequent internal ftrace errors.
b) If the old addr does not require a trampoline, but the new addr does, ftrace_modify_call() will use an out-of-range address to generate the 'new' branch instruction. This will result in warnings from aarch64_insn_gen_branch_imm(), and ftrace_modify_code() will replace the 'old' branch with a BRK. This will result in a kernel panic when this BRK is later executed.
Practically speaking, case (a) is vastly more likely than case (b), and typically this will result in internal ftrace errors that don't necessarily affect the rest of the system. This can be demonstrated with an out-of-tree test module which triggers ftrace_modify_call(), e.g.
| # insmod test_ftrace.ko | test_ftrace: Function test_function raw=0xffffb3749399201c, callsite=0xffffb37493992024 | branch_imm_common: offset out of range | branch_imm_common: offset out of range | ------------[ ftrace bug ]------------ | ftrace failed to modify | [<ffffb37493992024>] test_function+0x8/0x38 [test_ftrace] | actual: 1d:00:00:94 | Updating ftrace call site to call a different ftrace function | ftrace record flags: e0000002 | (2) R | expected tramp: ffffb374ae42ed54 | ------------[ cut here ]------------ | WARNING: CPU: 0 PID: 165 at kernel/trace/ftrace.c:2085 ftrace_bug+0x280/0x2b0 | Modules linked in: test_ftrace(+) | CPU: 0 PID: 165 Comm: insmod Not tainted 5.19.0-rc2-00002-g4d9ead8b45ce #13 | Hardware name: linux,dummy-virt (DT) | pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) | pc : ftrace_bug+0x280/0x2b0 | lr : ftrace_bug+0x280/0x2b0 | sp : ffff80000839ba00 | x29: ffff80000839ba00 x28: 0000000000000000 x27: ffff80000839bcf0 | x26: ffffb37493994180 x25: ffffb374b0991c28 x24: ffffb374b0d70000 | x23: 00000000ffffffea x22: ffffb374afcc33b0 x21: ffffb374b08f9cc8 | x20: ffff572b8462c000 x19: ffffb374b08f9000 x18: ffffffffffffffff | x17: 6c6c6163202c6331 x16: ffffb374ae5ad110 x15: ffffb374b0d51ee4 | x14: 0000000000000000 x13: 3435646532346561 x12: 3437336266666666 | x11: 203a706d61727420 x10: 6465746365707865 x9 : ffffb374ae5149e8 | x8 : 336266666666203a x7 : 706d617274206465 x6 : 00000000fffff167 | x5 : ffff572bffbc4a08 x4 : 00000000fffff167 x3 : 0000000000000000 | x2 : 0000000000000000 x1 : ffff572b84461e00 x0 : 0000000000000022 | Call trace: | ftrace_bug+0x280/0x2b0 | ftrace_replace_code+0x98/0xa0 | ftrace_modify_all_code+0xe0/0x144 | arch_ftrace_update_code+0x14/0x20 | ftrace_startup+0xf8/0x1b0 | register_ftrace_function+0x38/0x90 | test_ftrace_init+0xd0/0x1000 [test_ftrace] | do_one_initcall+0x50/0x2b0 | do_init_module+0x50/0x1f0 | load_module+0x17c8/0x1d64 | __do_sys_finit_module+0xa8/0x100 | __arm64_sys_finit_module+0x2c/0x3c | invoke_syscall+0x50/0x120 | el0_svc_common.constprop.0+0xdc/0x100 | do_el0_svc+0x3c/0xd0 | el0_svc+0x34/0xb0 | el0t_64_sync_handler+0xbc/0x140 | el0t_64_sync+0x18c/0x190 | ---[ end trace 0000000000000000 ]---
We can solve this by consistently determining whether to use a PLT entry for an address.
Note that since (the earlier) commit:
f1a54ae9af0da4d7 ("arm64: module/ftrace: intialize PLT at load time")
... we can consistently determine the PLT address that a given callsite will use, and therefore ftrace_make_nop() does not need to skip validation when a PLT is in use.
This patch factors the existing logic out of ftrace_make_call() and ftrace_make_nop() into a common ftrace_find_callable_addr() helper function, which is used by ftrace_make_call(), ftrace_make_nop(), and ftrace_modify_call(). In ftrace_make_nop() the patching is consistently validated by ftrace_modify_code() as we can always determine what the old instruction should have been.
--- arch/arm64/kernel/ftrace.c | 137 ++++++++++++++++++------------------- 1 file changed, 66 insertions(+), 71 deletions(-)
arch/arm64/kernel/ftrace.c +66 -71
@@ -78,47 +78,76 @@ static struct plt_entry *get_ftrace_plt(struct module *mod, unsigned long addr) }/* -* Turn on the call to ftrace_caller() in instrumented function +* Find the address the callsite must branch to in order to reach '*addr'. +* +* Due to the limited range of 'BL' instructions, modules may be placed too far +* away to branch directly and must use a PLT. +* +* Returns true when '*addr' contains a reachable target address, or has been +* modified to contain a PLT address. Returns false otherwise. */ -int ftrace_make_call (struct dyn_ftrace *rec,unsigned long addr) +static bool ftrace_find_callable_addr (struct dyn_ftrace *rec, +struct module *mod, +unsigned long *addr) {unsigned long pc = rec->ip; -u32 old, new; -long offset = (long )addr - (long )pc; +long offset = (long )*addr - (long )pc; +struct plt_entry *plt; -if (offset < -SZ_128M || offset >=SZ_128M ) { -struct module *mod; -struct plt_entry *plt; +/* +* When the target is within range of the 'BL' instruction, use 'addr' +* as-is and branch to that directly. +*/ +if (offset >= -SZ_128M && offset <SZ_128M ) +return true; -if (!IS_ENABLED (CONFIG_ARM64_MODULE_PLTS )) -return -EINVAL ; +/* +* When the target is outside of the range of a 'BL' instruction, we +* must use a PLT to reach it. We can only place PLTs for modules, and +* only when module PLT support is built-in. +*/ +if (!IS_ENABLED (CONFIG_ARM64_MODULE_PLTS )) +return false; -/* -* On kernels that support module PLTs, the offset between the -* branch instruction and its target may legally exceed the -* range of an ordinary relative 'bl' opcode. In this case, we -* need to branch via a trampoline in the module. -* -* NOTE: __module_text_address() must be called with preemption -* disabled, but we can rely on ftrace_lock to ensure that 'mod' -* retains its validity throughout the remainder of this code. -*/ +/* +* 'mod' is only set at module load time, but if we end up +* dealing with an out-of-range condition, we can assume it +* is due to a module being loaded far away from the kernel. +* +* NOTE: __module_text_address() must be called with preemption +* disabled, but we can rely on ftrace_lock to ensure that 'mod' +* retains its validity throughout the remainder of this code. +*/ +if (!mod) {preempt_disable (); mod =__module_text_address (pc);preempt_enable (); + } -if (WARN_ON (!mod)) -return -EINVAL ; +if (WARN_ON (!mod)) +return false; - plt =get_ftrace_plt (mod, addr); -if (!plt) { -pr_err ("ftrace: no module PLT for %ps\n" , (void *)addr); -return -EINVAL ; - } - - addr = (unsigned long )plt; + plt =get_ftrace_plt (mod, *addr); +if (!plt) { +pr_err ("ftrace: no module PLT for %ps\n" , (void *)*addr); +return false; } + *addr = (unsigned long )plt; +return true; +} + +/* +* Turn on the call to ftrace_caller() in instrumented function +*/ +int ftrace_make_call (struct dyn_ftrace *rec,unsigned long addr) +{ +unsigned long pc = rec->ip; +u32 old, new; + +if (!ftrace_find_callable_addr (rec,NULL , &addr)) +return -EINVAL ; + old =aarch64_insn_gen_nop (); new =aarch64_insn_gen_branch_imm (pc, addr,AARCH64_INSN_BRANCH_LINK );
@@ -132,6 +161,11 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,unsigned long pc = rec->ip;u32 old, new; +if (!ftrace_find_callable_addr (rec,NULL , &old_addr)) +return -EINVAL ; +if (!ftrace_find_callable_addr (rec,NULL , &addr)) +return -EINVAL ; + old =aarch64_insn_gen_branch_imm (pc, old_addr,AARCH64_INSN_BRANCH_LINK ); new =aarch64_insn_gen_branch_imm (pc, addr,AARCH64_INSN_BRANCH_LINK );
@@ -181,54 +215,15 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec, unsigned long addr) {unsigned long pc = rec->ip; -bool validate = true;u32 old =0 , new; -long offset = (long )addr - (long )pc; -if (offset < -SZ_128M || offset >=SZ_128M ) { -u32 replaced; - -if (!IS_ENABLED (CONFIG_ARM64_MODULE_PLTS )) -return -EINVAL ; - -/* -* 'mod' is only set at module load time, but if we end up -* dealing with an out-of-range condition, we can assume it -* is due to a module being loaded far away from the kernel. -*/ -if (!mod) { -preempt_disable (); - mod =__module_text_address (pc); -preempt_enable (); - -if (WARN_ON (!mod)) -return -EINVAL ; - } - -/* -* The instruction we are about to patch may be a branch and -* link instruction that was redirected via a PLT entry. In -* this case, the normal validation will fail, but we can at -* least check that we are dealing with a branch and link -* instruction that points into the right module. -*/ -if (aarch64_insn_read ((void *)pc, &replaced)) -return -EFAULT ; - -if (!aarch64_insn_is_bl (replaced) || - !within_module (pc +aarch64_get_branch_offset (replaced), - mod)) -return -EINVAL ; - - validate = false; - }else { - old =aarch64_insn_gen_branch_imm (pc, addr, -AARCH64_INSN_BRANCH_LINK ); - } +if (!ftrace_find_callable_addr (rec, mod, &addr)) +return -EINVAL ; + old =aarch64_insn_gen_branch_imm (pc, addr,AARCH64_INSN_BRANCH_LINK ); new =aarch64_insn_gen_nop (); -return ftrace_modify_code (pc, old, new, validate); +return ftrace_modify_code (pc, old, new, true); }void arch_ftrace_update_code (int command)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 85/141 certs/blacklist_hashes.c: fix const confusion in certs blacklist
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 6a1c3767d82ed8233de1263aa7da81595e176087 ]
This file fails to compile as follows:
CC certs/blacklist_hashes.ocerts/blacklist_hashes.c:4:1: error: ignoring attribute ‘section (".init.data")’ because it conflicts with previous ‘section (".init.rodata")’ [-Werror=attributes]
4 | const char __initdata *const blacklist_hashes[] = {
| ^~~~~
In file included from certs/blacklist_hashes.c:2:
certs/blacklist.h:5:38: note: previous declaration here
5 | extern const char __initconst *const blacklist_hashes[];
| ^~~~~~~~~~~~~~~~Apply the same fix as commit 2be04df5668d ("certs/blacklist_nohashes.c:
fix const confusion in certs blacklist").
--- certs/blacklist_hashes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
certs/blacklist_hashes.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0 #include "blacklist.h" -const char __initdata *const blacklist_hashes[] = { +const char __initconst *const blacklist_hashes[] = { #include CONFIG_SYSTEM_BLACKLIST_HASH_LIST ,NULL };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 86/141 init: Initialize noop_backing_dev_info early
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit 4bca7e80b6455772b4bf3f536dcbc19aac424d6a ]
noop_backing_dev_info is used by superblocks of various pseudofilesystems such as kdevtmpfs. After commit 10e14073107d ("writeback: Fix inode->i_io_list not be protected by inode->i_lock error") this broke because __mark_inode_dirty() started to access more fields from noop_backing_dev_info and this led to crashes inside locked_inode_to_wb_and_lock_list() called from __mark_inode_dirty(). Fix the problem by initializing noop_backing_dev_info before the filesystems get mounted.
--- drivers/base/init.c | 2 ++ include/linux/backing-dev.h | 2 ++ mm/backing-dev.c | 11 ++--------- 3 files changed, 6 insertions(+), 9 deletions(-)
drivers/base/init.c +2 -0
@@ -8,6 +8,7 @@#include <linux/init.h> #include <linux/memory.h> #include <linux/of.h> +#include <linux/backing-dev.h> #include "base.h"
@@ -20,6 +21,7 @@void __init driver_init (void ) {/* These are the core pieces */ +bdi_init (&noop_backing_dev_info);devtmpfs_init ();devices_init ();buses_init ();
include/linux/backing-dev.h +2 -0
@@ -121,6 +121,8 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);extern struct backing_dev_info noop_backing_dev_info; +int bdi_init (struct backing_dev_info *bdi); +/** * writeback_in_progress - determine whether there is writeback in progress * @wb: bdi_writeback of interest
mm/backing-dev.c +2 -9
@@ -230,20 +230,13 @@ static __init int bdi_class_init(void) }postcore_initcall (bdi_class_init); -static int bdi_init (struct backing_dev_info *bdi); -static int __init default_bdi_init (void ) { -int err; - bdi_wq =alloc_workqueue ("writeback" ,WQ_MEM_RECLAIM |WQ_UNBOUND |WQ_SYSFS ,0 );if (!bdi_wq)return -ENOMEM ; - - err =bdi_init (&noop_backing_dev_info); - -return err; +return 0 ; }subsys_initcall (default_bdi_init);
@@ -782,7 +775,7 @@ static void cgwb_remove_from_bdi_list(struct bdi_writeback *wb)#endif /* CONFIG_CGROUP_WRITEBACK */ -static int bdi_init (struct backing_dev_info *bdi) +int bdi_init (struct backing_dev_info *bdi) {int ret;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 87/141 block: Fix handling of offline queues in blk_mq_alloc_request_hctx()
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit 14dc7a18abbe4176f5626c13c333670da8e06aa1 ]
This patch prevents that test nvme/004 triggers the following:
UBSAN: array-index-out-of-bounds in block/blk-mq.h:135:9 index 512 is out of range for type 'long unsigned int [512]' Call Trace: show_stack+0x52/0x58 dump_stack_lvl+0x49/0x5e dump_stack+0x10/0x12 ubsan_epilogue+0x9/0x3b __ubsan_handle_out_of_bounds.cold+0x44/0x49 blk_mq_alloc_request_hctx+0x304/0x310 __nvme_submit_sync_cmd+0x70/0x200 [nvme_core] nvmf_connect_io_queue+0x23e/0x2a0 [nvme_fabrics] nvme_loop_connect_io_queues+0x8d/0xb0 [nvme_loop] nvme_loop_create_ctrl+0x58e/0x7d0 [nvme_loop] nvmf_create_ctrl+0x1d7/0x4d0 [nvme_fabrics] nvmf_dev_write+0xae/0x111 [nvme_fabrics] vfs_write+0x144/0x560 ksys_write+0xb7/0x140 __x64_sys_write+0x42/0x50 do_syscall_64+0x35/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae
--- block/blk-mq.c | 2 ++ 1 file changed, 2 insertions(+)
block/blk-mq.c +2 -0
@@ -579,6 +579,8 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q,if (!blk_mq_hw_queue_mapped (data.hctx)) goto out_queue_exit; cpu =cpumask_first_and (data.hctx->cpumask, cpu_online_mask); +if (cpu >= nr_cpu_ids) + goto out_queue_exit; data.ctx =__blk_mq_get_ctx (q, cpu);if (!q->elevator)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 88/141 faddr2line: Fix overlapping text section failures, the sequel
In reply to Greg Kroah-HartmanFrom: Josh Poimboeuf <[email protected]>
[ Upstream commit dcea997beed694cbd8705100ca1a6eb0d886de69 ]
If a function lives in a section other than .text, but .text also exists in the object, faddr2line may wrongly assume .text. This can result in comically wrong output. For example:
$ scripts/faddr2line vmlinux.o enter_from_user_mode+0x1c enter_from_user_mode+0x1c/0x30: find_next_bit at /home/jpoimboe/git/linux/./include/linux/find.h:40 (inlined by) perf_clear_dirty_counters at /home/jpoimboe/git/linux/arch/x86/events/core.c:2504
Fix it by passing the section name to addr2line, unless the object file is vmlinux, in which case the symbol table uses absolute addresses.
--- scripts/faddr2line | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-)
scripts/faddr2line +34 -11
@@ -95,17 +95,25 @@ __faddr2line() { local print_warnings=$4 local sym_name=${func_addr%+*} - local offset=${func_addr#*+} - offset=${offset%/*} + local func_offset=${func_addr#*+} + func_offset=${func_offset%/*} local user_size= + local file_type + local is_vmlinux=0 [[ $func_addr =~ "/" ]] && user_size=${func_addr#*/} - if [[ -z $sym_name ]] || [[ -z $offset ]] || [[ $sym_name = $func_addr ]]; then + if [[ -z $sym_name ]] || [[ -z $func_offset ]] || [[ $sym_name = $func_addr ]]; then warn "bad func+offset $func_addr" DONE=1 return fi + # vmlinux uses absolute addresses in the section table rather than + # section offsets. + local file_type=$(${READELF} --file-header $objfile | + ${AWK} '$1 == "Type:" { print $2; exit }') + [[ $file_type = "EXEC" ]] && is_vmlinux=1 + # Go through each of the object's symbols which match the func name. # In rare cases there might be duplicates, in which case we print all # matches.
@@ -114,9 +122,11 @@ __faddr2line() { local sym_addr=0x${fields[1]} local sym_elf_size=${fields[2]} local sym_sec=${fields[6]} + local sec_size + local sec_name # Get the section size: - local sec_size=$(${READELF} --section-headers --wide $objfile | + sec_size=$(${READELF} --section-headers --wide $objfile | sed 's/\[ /\[/' | ${AWK} -v sec=$sym_sec '$1 == "[" sec "]" { print "0x" $6; exit }')
@@ -126,6 +136,17 @@ __faddr2line() { return fi + # Get the section name: + sec_name=$(${READELF} --section-headers --wide $objfile | + sed 's/\[ /\[/' | + ${AWK} -v sec=$sym_sec '$1 == "[" sec "]" { print $2; exit }') + + if [[ -z $sec_name ]]; then + warn "bad section name: section: $sym_sec" + DONE=1 + return + fi + # Calculate the symbol size. # # Unfortunately we can't use the ELF size, because kallsyms
@@ -174,10 +195,10 @@ __faddr2line() { sym_size=0x$(printf %x $sym_size) - # Calculate the section address from user-supplied offset: - local addr=$(($sym_addr + $offset)) + # Calculate the address from user-supplied offset: + local addr=$(($sym_addr + $func_offset)) if [[ -z $addr ]] || [[ $addr = 0 ]]; then - warn "bad address: $sym_addr + $offset" + warn "bad address: $sym_addr + $func_offset" DONE=1 return fi
@@ -191,9 +212,9 @@ __faddr2line() { fi # Make sure the provided offset is within the symbol's range: - if [[ $offset -gt $sym_size ]]; then + if [[ $func_offset -gt $sym_size ]]; then [[ $print_warnings = 1 ]] && - echo "skipping $sym_name address at $addr due to size mismatch ($offset > $sym_size)" + echo "skipping $sym_name address at $addr due to size mismatch ($func_offset > $sym_size)" continue fi
@@ -202,11 +223,13 @@ __faddr2line() { [[ $FIRST = 0 ]] && echo FIRST=0 - echo "$sym_name+$offset/$sym_size:" + echo "$sym_name+$func_offset/$sym_size:" # Pass section address to addr2line and strip absolute paths # from the output: - local output=$(${ADDR2LINE} -fpie $objfile $addr | sed "s; $dir_prefix\(\./\)*; ;") + local args="--functions --pretty-print --inlines --exe=$objfile" + [[ $is_vmlinux = 0 ]] && args="$args --section=$sec_name" + local output=$(${ADDR2LINE} $args $addr | sed "s; $dir_prefix\(\./\)*; ;") [[ -z $output ]] && continue # Default output (non --list):
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 89/141 x86/ftrace: Remove OBJECT_FILES_NON_STANDARD usage
In reply to Greg Kroah-HartmanFrom: Josh Poimboeuf <[email protected]>
[ Upstream commit 7b6c7a877cc616bc7dc9cd39646fe454acbed48b ]
The file-wide OBJECT_FILES_NON_STANDARD annotation is used with CONFIG_FRAME_POINTER to tell objtool to skip the entire file when frame pointers are enabled. However that annotation is now deprecated because it doesn't work with IBT, where objtool runs on vmlinux.o instead of individual translation units.
Instead, use more fine-grained function-specific annotations:
- The 'save_mcount_regs' macro does funny things with the frame pointer. Use STACK_FRAME_NON_STANDARD_FP to tell objtool to ignore the functions using it.
- The return_to_handler() "function" isn't actually a callable function. Instead of being called, it's returned to. The real return address isn't on the stack, so unwinding is already doomed no matter which unwinder is used. So just remove the STT_FUNC annotation, telling objtool to ignore it. That also removes the implicit ANNOTATE_NOENDBR, which now needs to be made explicit.
Fixes the following warning:
vmlinux.o: warning: objtool: __fentry__+0x16: return with modified stack frame
--- arch/x86/kernel/Makefile | 4 ---- arch/x86/kernel/ftrace_64.S | 11 ++++++++--- include/linux/objtool.h | 6 ++++++ tools/include/linux/objtool.h | 6 ++++++ 4 files changed, 20 insertions(+), 7 deletions(-)
arch/x86/kernel/Makefile +0 -4
@@ -36,10 +36,6 @@ KCSAN_SANITIZE := n OBJECT_FILES_NON_STANDARD_test_nx.o := y -ifdef CONFIG_FRAME_POINTER -OBJECT_FILES_NON_STANDARD_ftrace_$(BITS).o := y -endif - # If instrumentation of this dir is enabled, boot hangs during first second. # Probably could be more selective here, but note that files related to irqs, # boot, dumpstack/stacktrace, etc are either non-interesting or can lead to
arch/x86/kernel/ftrace_64.S +8 -3
@@ -175,6 +175,7 @@ SYM_INNER_LABEL(ftrace_caller_end, SYM_L_GLOBAL) jmp ftrace_epilogue SYM_FUNC_END(ftrace_caller); +STACK_FRAME_NON_STANDARD_FP(ftrace_caller) SYM_FUNC_START(ftrace_epilogue) /*
@@ -282,6 +283,7 @@ SYM_INNER_LABEL(ftrace_regs_caller_end, SYM_L_GLOBAL) jmp ftrace_epilogue SYM_FUNC_END(ftrace_regs_caller) +STACK_FRAME_NON_STANDARD_FP(ftrace_regs_caller) #else /* ! CONFIG_DYNAMIC_FTRACE */
@@ -311,10 +313,14 @@ trace: jmp ftrace_stub SYM_FUNC_END(__fentry__) EXPORT_SYMBOL(__fentry__) +STACK_FRAME_NON_STANDARD_FP(__fentry__) + #endif /* CONFIG_DYNAMIC_FTRACE */ #ifdef CONFIG_FUNCTION_GRAPH_TRACER -SYM_FUNC_START(return_to_handler) +SYM_CODE_START(return_to_handler) + UNWIND_HINT_EMPTY + ANNOTATE_NOENDBR subq $16, %rsp /* Save the return values */
@@ -339,7 +345,6 @@ SYM_FUNC_START(return_to_handler) int3 .Ldo_rop: mov %rdi, (%rsp) - UNWIND_HINT_FUNC RET -SYM_FUNC_END(return_to_handler) +SYM_CODE_END(return_to_handler) #endif
include/linux/objtool.h +6 -0
@@ -141,6 +141,12 @@ struct unwind_hint { .popsection .endm +.macro STACK_FRAME_NON_STANDARD_FP func:req +#ifdef CONFIG_FRAME_POINTER + STACK_FRAME_NON_STANDARD \func +#endif +.endm + .macro ANNOTATE_NOENDBR .Lhere_\@: .pushsection .discard.noendbr
tools/include/linux/objtool.h +6 -0
@@ -141,6 +141,12 @@ struct unwind_hint { .popsection .endm +.macro STACK_FRAME_NON_STANDARD_FP func:req +#ifdef CONFIG_FRAME_POINTER + STACK_FRAME_NON_STANDARD \func +#endif +.endm + .macro ANNOTATE_NOENDBR .Lhere_\@: .pushsection .discard.noendbr
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 90/141 i2c: npcm7xx: Add check for platform_driver_register
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 6ba12b56b9b844b83ed54fb7ed59fb0eb41e4045 ]
As platform_driver_register() could fail, it should be better to deal with the return value in order to maintain the code consisitency.
--- drivers/i2c/busses/i2c-npcm7xx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/i2c/busses/i2c-npcm7xx.c +1 -2
@@ -2369,8 +2369,7 @@ static struct platform_driver npcm_i2c_bus_driver = {static int __init npcm_i2c_init (void ) { npcm_i2c_debugfs_dir =debugfs_create_dir ("npcm_i2c" ,NULL ); -platform_driver_register (&npcm_i2c_bus_driver); -return 0 ; +return platform_driver_register (&npcm_i2c_bus_driver); }module_init (npcm_i2c_init);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 91/141 irqchip/gic/realview: Fix refcount leak in realview_gic_of_init
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit f4b98e314888cc51486421bcf6d52852452ea48b ]
of_find_matching_node_and_match() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/irqchip/irq-gic-realview.c | 1 + 1 file changed, 1 insertion(+)
drivers/irqchip/irq-gic-realview.c +1 -0
@@ -57,6 +57,7 @@ realview_gic_of_init(struct device_node *node, struct device_node *parent)/* The PB11MPCore GIC needs to be configured in the syscon */ map =syscon_node_to_regmap (np); +of_node_put (np);if (!IS_ERR (map)) {/* new irq mode with no DCC */ regmap_write(map, REALVIEW_SYS_LOCK_OFFSET,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 92/141 irqchip/apple-aic: Fix refcount leak in build_fiq_affinity
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit b1ac803f47cb1615468f35cf1ccb553c52087301 ]
of_find_node_by_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/irqchip/irq-apple-aic.c | 1 + 1 file changed, 1 insertion(+)
drivers/irqchip/irq-apple-aic.c +1 -0
@@ -1035,6 +1035,7 @@ static void build_fiq_affinity(struct aic_irq_chip *ic, struct device_node *aff)continue ; cpu =of_cpu_node_to_id (cpu_node); +of_node_put (cpu_node);if (WARN_ON (cpu <0 ))continue ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 93/141 irqchip/apple-aic: Fix refcount leak in aic_of_ic_init
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 3d45670fab3c25a7452721e4588cc95c51cda134 ]
of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/irqchip/irq-apple-aic.c | 1 + 1 file changed, 1 insertion(+)
drivers/irqchip/irq-apple-aic.c +1 -0
@@ -1144,6 +1144,7 @@ static int __init aic_of_ic_init(struct device_node *node, struct device_node *pfor_each_child_of_node (affs, chld)build_fiq_affinity (irqc, chld); } +of_node_put (affs);set_handle_irq (aic_handle_irq);set_handle_fiq (aic_handle_fiq);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 94/141 irqchip/gic-v3: Fix error handling in gic_populate_ppi_partitions
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit ec8401a429ffee34ccf38cebf3443f8d5ae6cb0d ]
of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. When kcalloc fails, it missing of_node_put() and results in refcount leak. Fix this by goto out_put_node label.
--- drivers/irqchip/irq-gic-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-v3.c +1 -1
@@ -1922,7 +1922,7 @@ static void __init gic_populate_ppi_partitions(struct device_node *gic_node) gic_data.ppi_descs =kcalloc (gic_data.ppi_nr,sizeof (*gic_data.ppi_descs),GFP_KERNEL );if (!gic_data.ppi_descs) -return ; + goto out_put_node; nr_parts =of_get_child_count (parts_node);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 95/141 irqchip/gic-v3: Fix refcount leak in gic_populate_ppi_partitions
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit fa1ad9d4cc47ca2470cd904ad4519f05d7e43a2b ]
of_find_node_by_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/irqchip/irq-gic-v3.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/irqchip/irq-gic-v3.c +4 -1
@@ -1963,12 +1963,15 @@ static void __init gic_populate_ppi_partitions(struct device_node *gic_node)continue ; cpu =of_cpu_node_to_id (cpu_node); -if (WARN_ON (cpu <0 )) +if (WARN_ON (cpu <0 )) { +of_node_put (cpu_node);continue ; + }pr_cont ("%pOF[%d] " , cpu_node, cpu);cpumask_set_cpu (cpu, &part->mask); +of_node_put (cpu_node); }pr_cont ("}\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 96/141 irqchip/realtek-rtl: Fix refcount leak in map_interrupts
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit eff4780f83d0ae3e5b6c02ff5d999dc4c1c5c8ce ]
of_find_node_by_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. This function doesn't call of_node_put() in error path. Call of_node_put() directly after of_property_read_u32() to cover both normal path and error path.
--- drivers/irqchip/irq-realtek-rtl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-realtek-rtl.c +1 -1
@@ -134,9 +134,9 @@ static int __init map_interrupts(struct device_node *node, struct irq_domain *doif (!cpu_ictl)return -EINVAL ; ret =of_property_read_u32 (cpu_ictl,"#interrupt-cells" , &tmp); +of_node_put (cpu_ictl);if (ret || tmp !=1 )return -EINVAL ; -of_node_put (cpu_ictl); cpu_int =be32_to_cpup (imap +2 );if (cpu_int >7 || cpu_int <2 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 97/141 sched: Fix balance_push() vs __sched_setscheduler()
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 04193d590b390ec7a0592630f46d559ec6564ba1 ]
The purpose of balance_push() is to act as a filter on task selection in the case of CPU hotplug, specifically when taking the CPU out.
It does this by (ab)using the balance callback infrastructure, with the express purpose of keeping all the unlikely/odd cases in a single place.
In order to serve its purpose, the balance_push_callback needs to be (exclusively) on the callback list at all times (noting that the callback always places itself back on the list the moment it runs, also noting that when the CPU goes down, regular balancing concerns are moot, so ignoring them is fine).
And here-in lies the problem, __sched_setscheduler()'s use of splice_balance_callbacks() takes the callbacks off the list across a lock-break, making it possible for, an interleaving, __schedule() to see an empty list and not get filtered.
--- kernel/sched/core.c | 36 +++++++++++++++++++++++++++++++++--- kernel/sched/sched.h | 5 +++++ 2 files changed, 38 insertions(+), 3 deletions(-)
kernel/sched/core.c +33 -3
@@ -4755,25 +4755,55 @@ static void do_balance_callbacks(struct rq *rq, struct callback_head *head)static void balance_push (struct rq *rq); +/* +* balance_push_callback is a right abuse of the callback interface and plays +* by significantly different rules. +* +* Where the normal balance_callback's purpose is to be ran in the same context +* that queued it (only later, when it's safe to drop rq->lock again), +* balance_push_callback is specifically targeted at __schedule(). +* +* This abuse is tolerated because it places all the unlikely/odd cases behind +* a single test, namely: rq->balance_callback == NULL. +*/ struct callback_head balance_push_callback = { .next =NULL , .func = (void (*)(struct callback_head *))balance_push, }; -static inline struct callback_head *splice_balance_callbacks (struct rq *rq) +static inline struct callback_head * +__splice_balance_callbacks (struct rq *rq,bool split) {struct callback_head *head = rq->balance_callback; +if (likely (!head)) +return NULL ; +lockdep_assert_rq_held (rq); -if (head) +/* +* Must not take balance_push_callback off the list when +* splice_balance_callbacks() and balance_callbacks() are not +* in the same rq->lock section. +* +* In that case it would be possible for __schedule() to interleave +* and observe the list empty. +*/ +if (split && head == &balance_push_callback) + head =NULL ; +else rq->balance_callback =NULL ;return head; } +static inline struct callback_head *splice_balance_callbacks (struct rq *rq) +{ +return __splice_balance_callbacks (rq, true); +} +static void __balance_callbacks (struct rq *rq) { -do_balance_callbacks (rq,splice_balance_callbacks (rq)); +do_balance_callbacks (rq,__splice_balance_callbacks (rq, false)); }static inline void balance_callbacks (struct rq *rq,struct callback_head *head)
kernel/sched/sched.h +5 -0
@@ -1686,6 +1686,11 @@ queue_balance_callback(struct rq *rq, {lockdep_assert_rq_held (rq); +/* +* Don't (re)queue an already queued item; nor queue anything when +* balance_push() is active, see the comment with +* balance_push_callback. +*/ if (unlikely (head->next || rq->balance_callback == &balance_push_callback))return ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 98/141 i2c: designware: Use standard optional ref clock implementation
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 27071b5cbca59d8e8f8750c199a6cbf8c9799963 ]
Even though the DW I2C controller reference clock source is requested by the method devm_clk_get() with non-optional clock requirement the way the clock handler is used afterwards has a pure optional clock semantic (though in some circumstances we can get a warning about the clock missing printed in the system console). There is no point in reimplementing that functionality seeing the kernel clock framework already supports the optional interface from scratch. Thus let's convert the platform driver to using it.
Note by providing this commit we get to fix two problems. The first one was introduced in commit c62ebb3d5f0d ("i2c: designware: Add support for an interface clock"). It causes not having the interface clock (pclk) enabled/disabled in case if the reference clock isn't provided. The second problem was first introduced in commit b33af11de236 ("i2c: designware: Do not require clock when SSCN and FFCN are provided"). Since that modification the deferred probe procedure has been unsupported in case if the interface clock isn't ready.
--- drivers/i2c/busses/i2c-designware-common.c | 3 --- drivers/i2c/busses/i2c-designware-platdrv.c | 13 +++++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-designware-common.c +0 -3
@@ -477,9 +477,6 @@ int i2c_dw_prepare_clk(struct dw_i2c_dev *dev, bool prepare) {int ret; -if (IS_ERR (dev->clk)) -return PTR_ERR (dev->clk); -if (prepare) {/* Optional interface clock */ ret =clk_prepare_enable (dev->pclk);
drivers/i2c/busses/i2c-designware-platdrv.c +11 -2
@@ -320,8 +320,17 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) goto exit_reset; } - dev->clk =devm_clk_get (&pdev->dev,NULL ); -if (!i2c_dw_prepare_clk (dev, true)) { + dev->clk =devm_clk_get_optional (&pdev->dev,NULL ); +if (IS_ERR (dev->clk)) { + ret =PTR_ERR (dev->clk); + goto exit_reset; + } + + ret =i2c_dw_prepare_clk (dev, true); +if (ret) + goto exit_reset; + +if (dev->clk) {u64 clk_khz; dev->get_clk_rate_khz = i2c_dw_get_clk_rate_khz;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 99/141 i2c: mediatek: Fix an error handling path in mtk_i2c_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit de87b603b0919e31578c8fa312a3541f1fb37e1c ]
The clsk are prepared, enabled, then disabled. So if an error occurs after the disable step, they are still prepared.
Add an error handling path to unprepare the clks in such a case, as already done in the .remove function.
--- drivers/i2c/busses/i2c-mt65xx.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-mt65xx.c +7 -2
@@ -1420,17 +1420,22 @@ static int mtk_i2c_probe(struct platform_device *pdev)if (ret <0 ) {dev_err (&pdev->dev,"Request I2C IRQ %d fail\n" , irq); -return ret; + goto err_bulk_unprepare; }i2c_set_adapdata (&i2c->adap, i2c); ret =i2c_add_adapter (&i2c->adap);if (ret) -return ret; + goto err_bulk_unprepare;platform_set_drvdata (pdev, i2c);return 0 ; + +err_bulk_unprepare: +clk_bulk_unprepare (I2C_MT65XX_CLK_MAX , i2c->clocks); + +return ret; }static int mtk_i2c_remove (struct platform_device *pdev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 100/141 mei: hbm: drop capability response on early shutdown
In reply to Greg Kroah-HartmanFrom: Alexander Usyskin <[email protected]>
commit 68553650bc9c57c7e530c84e5b2945e9dfe1a560 upstream.
Drop HBM responses also in the early shutdown phase where the usual traffic is allowed.
Extend the rule that drop HBM responses received during the shutdown phase by also in MEI_DEV_POWERING_DOWN state.
This resolves the stall if the driver is stopping in the middle of the link initialization or link reset.
Drop the capabilities response on early shutdown.
--- drivers/misc/mei/hbm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/misc/mei/hbm.c +2 -1
@@ -1351,7 +1351,8 @@ int mei_hbm_dispatch(struct mei_device *if (dev->dev_state !=MEI_DEV_INIT_CLIENTS || dev->hbm_state !=MEI_HBM_CAP_SETUP ) { -if (dev->dev_state ==MEI_DEV_POWER_DOWN ) { +if (dev->dev_state ==MEI_DEV_POWER_DOWN || + dev->dev_state ==MEI_DEV_POWERING_DOWN ) {dev_dbg (dev->dev,"hbm: capabilities response: on shutdown, ignoring\n" );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 101/141 mei: me: add raptor lake point S DID
In reply to Greg Kroah-HartmanFrom: Alexander Usyskin <[email protected]>
commit 3ed8c7d39cfef831fe508fc1308f146912fa72e6 upstream.
Add Raptor (Point) Lake S device id.
--- drivers/misc/mei/hw-me-regs.h | 2 ++ drivers/misc/mei/pci-me.c | 2 ++ 2 files changed, 4 insertions(+)
drivers/misc/mei/hw-me-regs.h +2 -0
@@ -109,6 +109,8 @@#define MEI_DEV_ID_ADP_P 0x51E0/* Alder Lake Point P */ #define MEI_DEV_ID_ADP_N 0x54E0/* Alder Lake Point N */ +#define MEI_DEV_ID_RPL_S 0x7A68/* Raptor Lake Point S */ +/* * MEI HW Section */
drivers/misc/mei/pci-me.c +2 -0
@@ -116,6 +116,8 @@ static const struct pci_device_id mei_me {MEI_PCI_DEVICE(MEI_DEV_ID_ADP_P, MEI_ME_PCH15_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_ADP_N, MEI_ME_PCH15_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_RPL_S, MEI_ME_PCH15_CFG)}, +/* required last entry */ {0, } };
Greg Kroah-Hartman
maintainerPATCH 102/141 comedi: vmk80xx: fix expression for tx buffer size
In reply to Greg Kroah-HartmanFrom: Ian Abbott <[email protected]>
commit 242439f7e279d86b3f73b5de724bc67b2f8aeb07 upstream.
The expression for setting the size of the allocated bulk TX buffer (devpriv->usb_tx_buf) is calling usb_endpoint_maxp(devpriv->ep_rx), which is using the wrong endpoint (should be devpriv->ep_tx). Fix it.
--- drivers/comedi/drivers/vmk80xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/comedi/drivers/vmk80xx.c +1 -1
@@ -684,7 +684,7 @@ static int vmk80xx_alloc_usb_buffers(strif (!devpriv->usb_rx_buf)return -ENOMEM ; - size =max (usb_endpoint_maxp (devpriv->ep_rx),MIN_BUF_SIZE ); + size =max (usb_endpoint_maxp (devpriv->ep_tx),MIN_BUF_SIZE ); devpriv->usb_tx_buf =kzalloc (size,GFP_KERNEL );if (!devpriv->usb_tx_buf)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 103/141 crypto: memneq - move into lib/
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
commit abfed87e2a12bd246047d78c01d81eb9529f1d06 upstream.
This is used by code that doesn't need CONFIG_CRYPTO, so move this into lib/ with a Kconfig option so that it can be selected by whatever needs it.
This fixes a linker error Zheng pointed out when
CRYPTO_MANAGER_DISABLE_TESTS!=y and CRYPTO=m:
lib/crypto/curve25519-selftest.o: In function `curve25519_selftest':
curve25519-selftest.c:(.init.text+0x60): undefined reference to __crypto_memneq' curve25519-selftest.c:(.init.text+0xec): undefined reference to __crypto_memneq' curve25519-selftest.c:(.init.text+0x114): undefined reference to __crypto_memneq' curve25519-selftest.c:(.init.text+0x154): undefined reference to __crypto_memneq'
---
crypto/Kconfig | 1 +
crypto/Makefile | 2 +-
lib/Kconfig | 3 +++
lib/Makefile | 1 +
lib/crypto/Kconfig | 1 +
{crypto => lib}/memneq.c | 0
crypto/Kconfig | 1
crypto/Makefile | 2
crypto/memneq.c | 176 -----------------------------------------------------
lib/Kconfig | 3
lib/Makefile | 1
lib/crypto/Kconfig | 1
lib/memneq.c | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 183 insertions(+), 177 deletions(-)
rename {crypto => lib}/memneq.c (100%)crypto/Kconfig +1 -0
@@ -15,6 +15,7 @@ source "crypto/async_tx/Kconfig" # menuconfig CRYPTO tristate "Cryptographic API" + select LIB_MEMNEQ help This option provides the core Cryptographic API.
crypto/Makefile +1 -1
@@ -4,7 +4,7 @@ # obj-$(CONFIG_CRYPTO) += crypto.o -crypto-y := api.o cipher.o compress.o memneq.o +crypto-y := api.o cipher.o compress.o obj-$(CONFIG_CRYPTO_ENGINE) += crypto_engine.o obj-$(CONFIG_CRYPTO_FIPS) += fips.o
crypto/memneq.c deleted +0 -176
176 lines not on this page · raw message
lib/Kconfig +3 -0
@@ -120,6 +120,9 @@ config INDIRECT_IOMEM_FALLBACK source "lib/crypto/Kconfig" +config LIB_MEMNEQ + bool + config CRC_CCITT tristate "CRC-CCITT functions" help
lib/Makefile +1 -0
@@ -251,6 +251,7 @@ obj-$(CONFIG_DIMLIB) += dim/ obj-$(CONFIG_SIGNATURE) += digsig.o lib-$(CONFIG_CLZ_TAB) += clz_tab.o +lib-$(CONFIG_LIB_MEMNEQ) += memneq.o obj-$(CONFIG_GENERIC_STRNCPY_FROM_USER) += strncpy_from_user.o obj-$(CONFIG_GENERIC_STRNLEN_USER) += strnlen_user.o
lib/crypto/Kconfig +1 -0
@@ -71,6 +71,7 @@ config CRYPTO_LIB_CURVE25519 tristate "Curve25519 scalar multiplication library" depends on CRYPTO_ARCH_HAVE_LIB_CURVE25519 || !CRYPTO_ARCH_HAVE_LIB_CURVE25519 select CRYPTO_LIB_CURVE25519_GENERIC if CRYPTO_ARCH_HAVE_LIB_CURVE25519=n + select LIB_MEMNEQ help Enable the Curve25519 library interface. This interface may be fulfilled by either the generic implementation or an arch-specific
lib/memneq.c new file +176 -0
176 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 104/141 USB: serial: option: add support for Cinterion MV31 with new baseline
In reply to Greg Kroah-HartmanFrom: Slark Xiao <[email protected]>
commit 158f7585bfcea4aae0ad4128d032a80fec550df1 upstream.
Adding support for Cinterion device MV31 with Qualcomm new baseline. Use different PIDs to separate it from previous base line products.
All interfaces settings keep same as previous.
Below is test evidence:
T: Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 6 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=1e2d ProdID=00b8 Rev=04.14 S: Manufacturer=Cinterion S: Product=Cinterion PID 0x00B8 USB Mobile Broadband S: SerialNumber=90418e79 C: #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA I: If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim I: If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim I: If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option I: If#=0x3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) I: If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option I: If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
T: Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 7 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=1e2d ProdID=00b9 Rev=04.14 S: Manufacturer=Cinterion S: Product=Cinterion PID 0x00B9 USB Mobile Broadband S: SerialNumber=90418e79 C: #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA I: If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan I: If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option I: If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option I: If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
For PID 00b8, interface 3 is GNSS port which don't use serial driver.
--- drivers/usb/serial/option.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/serial/option.c +6 -0
@@ -432,6 +432,8 @@ static void option_instat_callback(struc#define CINTERION_PRODUCT_CLS8 0x00b0#define CINTERION_PRODUCT_MV31_MBIM 0x00b3#define CINTERION_PRODUCT_MV31_RMNET 0x00b7 +#define CINTERION_PRODUCT_MV31_2_MBIM 0x00b8 +#define CINTERION_PRODUCT_MV31_2_RMNET 0x00b9#define CINTERION_PRODUCT_MV32_WA 0x00f1#define CINTERION_PRODUCT_MV32_WB 0x00f2
@@ -1979,6 +1981,10 @@ static const struct usb_device_id option .driver_info = RSVD(3)}, { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV31_RMNET, 0xff), .driver_info = RSVD(0)}, + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV31_2_MBIM, 0xff), + .driver_info = RSVD(3)}, + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV31_2_RMNET, 0xff), + .driver_info = RSVD(0)}, { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WA, 0xff), .driver_info = RSVD(3)}, { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WB, 0xff),
Greg Kroah-Hartman
maintainerPATCH 105/141 USB: serial: io_ti: add Agilent E5805A support
In reply to Greg Kroah-HartmanFrom: Robert Eckelmann <[email protected]>
commit 908e698f2149c3d6a67d9ae15c75545a3f392559 upstream.
Add support for Agilent E5805A (rebranded ION Edgeport/4) to io_ti.
--- drivers/usb/serial/io_ti.c | 2 ++ drivers/usb/serial/io_usbvend.h | 1 + 2 files changed, 3 insertions(+)
drivers/usb/serial/io_ti.c +2 -0
@@ -166,6 +166,7 @@ static const struct usb_device_id edgepo { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_8S) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_416) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_416B) }, + { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_E5805A) }, { } };
@@ -204,6 +205,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_8S) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_416) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_416B) }, + { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_E5805A) }, { } };
drivers/usb/serial/io_usbvend.h +1 -0
@@ -212,6 +212,7 @@// // Definitions for other product IDs #define ION_DEVICE_ID_MT4X56USB 0x1403 // OEM device +#define ION_DEVICE_ID_E5805A 0x1A01 // OEM device (rebranded Edgeport/4)#define GENERATION_ID_FROM_USB_PRODUCT_ID (ProductId) \
Greg Kroah-Hartman
maintainerPATCH 106/141 arm64: mm: Dont invalidate FROM_DEVICE buffers at start of DMA transfer
In reply to Greg Kroah-HartmanFrom: Will Deacon <[email protected]>
commit c50f11c6196f45c92ca48b16a5071615d4ae0572 upstream.
Invalidating the buffer memory in arch_sync_dma_for_device() for FROM_DEVICE transfers
When using the streaming DMA API to map a buffer prior to inbound non-coherent DMA (i.e. DMA_FROM_DEVICE), we invalidate any dirty CPU cachelines so that they will not be written back during the transfer and corrupt the buffer contents written by the DMA. This, however, poses two potential problems:
(1) If the DMA transfer does not write to every byte in the buffer, then the unwritten bytes will contain stale data once the transfer has completed.
(2) If the buffer has a virtual alias in userspace, then stale data may be visible via this alias during the period between performing the cache invalidation and the DMA writes landing in memory.
Address both of these issues by cleaning (aka writing-back) the dirty lines in arch_sync_dma_for_device(DMA_FROM_DEVICE) instead of discarding them using invalidation.
--- arch/arm64/mm/cache.S | 2 -- 1 file changed, 2 deletions(-)
arch/arm64/mm/cache.S +0 -2
@@ -218,8 +218,6 @@ SYM_FUNC_ALIAS(__dma_flush_area, __pi___ */ SYM_FUNC_START(__pi___dma_map_area) add x1, x0, x1 - cmp w2, #DMA_FROM_DEVICE - b.eq __pi_dcache_inval_poc b __pi_dcache_clean_poc SYM_FUNC_END(__pi___dma_map_area) SYM_FUNC_ALIAS(__dma_map_area, __pi___dma_map_area)
Greg Kroah-Hartman
maintainerPATCH 107/141 usb: dwc2: Fix memory leak in dwc2_hcd_init
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
commit 3755278f078460b021cd0384562977bf2039a57a upstream.
usb_create_hcd will alloc memory for hcd, and we should call usb_put_hcd to free it when platform_get_resource() fails to prevent memory leak.
goto error2 label instead error1 to fix this.
--- drivers/usb/dwc2/hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc2/hcd.c +1 -1
@@ -5190,7 +5190,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hso res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!res) { retval = -EINVAL ; - goto error1; + goto error2; } hcd->rsrc_start = res->start; hcd->rsrc_len =resource_size (res);
Greg Kroah-Hartman
maintainerPATCH 108/141 usb: cdnsp: Fixed setting last_trb incorrectly
In reply to Greg Kroah-HartmanFrom: Jing Leng <[email protected]>
commit 5c7578c39c3fffe85b7d15ca1cf8cf7ac38ec0c1 upstream.
When ZLP occurs in bulk transmission, currently cdnsp will set last_trb for the last two TRBs, it will trigger an error "ERROR Transfer event TRB DMA ptr not part of current TD ...".
--- drivers/usb/cdns3/cdnsp-ring.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/usb/cdns3/cdnsp-ring.c +11 -8
@@ -1941,13 +1941,16 @@ int cdnsp_queue_bulk_tx(struct cdnsp_dev }if (enqd_len + trb_buff_len >= full_len) { -if (need_zero_pkt) - zero_len_trb = !zero_len_trb; - - field &= ~TRB_CHAIN ; - field |=TRB_IOC ; - more_trbs_coming = false; - preq->td.last_trb = ring->enqueue; +if (need_zero_pkt && !zero_len_trb) { + zero_len_trb = true; + }else { + zero_len_trb = false; + field &= ~TRB_CHAIN ; + field |=TRB_IOC ; + more_trbs_coming = false; + need_zero_pkt = false; + preq->td.last_trb = ring->enqueue; + } }/* Only set interrupt on short packet for OUT endpoints. */
@@ -1962,7 +1965,7 @@ int cdnsp_queue_bulk_tx(struct cdnsp_dev length_field =TRB_LEN (trb_buff_len) |TRB_TD_SIZE (remainder) |TRB_INTR_TARGET (0 ); - cdnsp_queue_trb(pdev, ring, more_trbs_coming | zero_len_trb, + cdnsp_queue_trb(pdev, ring, more_trbs_coming, lower_32_bits(send_addr), upper_32_bits(send_addr), length_field,
Greg Kroah-Hartman
maintainerPATCH 109/141 usb: dwc3: gadget: Fix IN endpoint max packet size allocation
In reply to Greg Kroah-HartmanFrom: Wesley Cheng <[email protected]>
commit 9c1e916960c1192e746bf615e4dae25423473a64 upstream.
The current logic to assign the max packet limit for IN endpoints attempts to take the default HW value and apply the optimal endpoint settings based on it. However, if the default value reports a TxFIFO size large enough for only one max packet, it will divide the value and assign a smaller ep max packet limit.
For example, if the default TxFIFO size fits 1024B, current logic will assign 1024/3 = 341B to ep max packet size. If function drivers attempt to request for an endpoint with a wMaxPacketSize of 1024B (SS BULK max packet size) then it will fail, as the gadget is unable to find an endpoint which can fit the requested size.
Functionally, if the TxFIFO has enough space to fit one max packet, it will be sufficient, at least when initializing the endpoints.
--- drivers/usb/dwc3/gadget.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/usb/dwc3/gadget.c +15 -11
@@ -2984,6 +2984,7 @@ static int dwc3_gadget_init_in_endpoint(struct dwc3 *dwc = dep->dwc;u32 mdwidth;int size; +int maxpacket; mdwidth =dwc3_mdwidth (dwc);
@@ -2996,21 +2997,24 @@ static int dwc3_gadget_init_in_endpoint(else size =DWC31_GTXFIFOSIZ_TXFDEP (size); -/* FIFO Depth is in MDWDITH bytes. Multiply */ - size *= mdwidth; -/* -* To meet performance requirement, a minimum TxFIFO size of 3x -* MaxPacketSize is recommended for endpoints that support burst and a -* minimum TxFIFO size of 2x MaxPacketSize for endpoints that don't -* support burst. Use those numbers and we can calculate the max packet -* limit as below. +* maxpacket size is determined as part of the following, after assuming +* a mult value of one maxpacket: +* DWC3 revision 280A and prior: +* fifo_size = mult * (max_packet / mdwidth) + 1; +* maxpacket = mdwidth * (fifo_size - 1); +* +* DWC3 revision 290A and onwards: +* fifo_size = mult * ((max_packet + mdwidth)/mdwidth + 1) + 1 +* maxpacket = mdwidth * ((fifo_size - 1) - 1) - mdwidth; */ -if (dwc->maximum_speed >=USB_SPEED_SUPER ) - size /=3 ; + if (DWC3_VER_IS_PRIOR(DWC3, 290A)) + maxpacket = mdwidth * (size -1 );else - size /=2 ; + maxpacket = mdwidth * ((size -1 ) -1 ) - mdwidth; +/* Functionally, space for one max packet is sufficient */ + size =min_t (int, maxpacket,1024 );usb_ep_set_maxpacket_limit (&dep->endpoint, size); dep->endpoint.max_streams =16 ;
Greg Kroah-Hartman
maintainerPATCH 110/141 usb: dwc3: pci: Restore line lost in merge conflict resolution
In reply to Greg Kroah-HartmanFrom: Stephan Gerhold <[email protected]>
commit 7ddda2614d62ef7fdef7fd85f5151cdf665b22d8 upstream.
Commit 582ab24e096f ("usb: dwc3: pci: Set "linux,phy_charger_detect" property on some Bay Trail boards") added a new swnode similar to the existing ones for boards where the PHY handles charger detection.
Unfortunately, the "linux,sysdev_is_parent" property got lost in the merge conflict resolution of commit ca9400ef7f67 ("Merge 5.17-rc6 into usb-next"). Now dwc3_pci_intel_phy_charger_detect_properties is the only swnode in dwc3-pci that is missing "linux,sysdev_is_parent".
It does not seem to cause any obvious functional issues, but it's certainly unintended so restore the line to make the properties consistent again.
--- drivers/usb/dwc3/dwc3-pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/dwc3/dwc3-pci.c +1 -0
@@ -127,6 +127,7 @@ static const struct property_entry dwc3_PROPERTY_ENTRY_STRING ("dr_mode" ,"peripheral" ),PROPERTY_ENTRY_BOOL ("snps,dis_u2_susphy_quirk" ),PROPERTY_ENTRY_BOOL ("linux,phy_charger_detect" ), + PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), {} };
Greg Kroah-Hartman
maintainerPATCH 111/141 usb: gadget: u_ether: fix regression in setting fixed MAC address
In reply to Greg Kroah-HartmanFrom: Marian Postevca <[email protected]>
commit b337af3a4d6147000b7ca6b3438bf5c820849b37 upstream.
In systemd systems setting a fixed MAC address through the "dev_addr" module argument fails systematically. When checking the MAC address after the interface is created it always has the same but different MAC address to the one supplied as argument.
This is partially caused by systemd which by default will set an internally generated permanent MAC address for interfaces that are marked as having a randomly generated address.
Commit 890d5b40908bfd1a ("usb: gadget: u_ether: fix race in setting MAC address in setup phase") didn't take into account the fact that the interface must be marked as having a set MAC address when it's set as module argument.
Fixed by marking the interface with NET_ADDR_SET when the "dev_addr" module argument is supplied.
--- drivers/usb/gadget/function/u_ether.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/u_ether.c +10 -2
@@ -775,9 +775,13 @@ struct eth_dev *gether_setup_name(struct dev->qmult = qmult;snprintf (net->name,sizeof (net->name),"%s%%d" , netname); -if (get_ether_addr (dev_addr, addr)) +if (get_ether_addr (dev_addr, addr)) { + net->addr_assign_type =NET_ADDR_RANDOM ;dev_warn (&g->dev,"using random %s ethernet address\n" ,"self" ); + }else { + net->addr_assign_type =NET_ADDR_SET ; + }eth_hw_addr_set (net, addr);if (get_ether_addr (host_addr, dev->host_mac)) dev_warn(&g->dev,
@@ -844,6 +848,10 @@ struct net_device *gether_setup_name_defeth_random_addr (dev->dev_mac);pr_warn ("using random %s ethernet address\n" ,"self" ); + +/* by default we always have a random MAC address */ + net->addr_assign_type =NET_ADDR_RANDOM ; +eth_random_addr (dev->host_mac);pr_warn ("using random %s ethernet address\n" ,"host" );
@@ -871,7 +879,6 @@ int gether_register_netdev(struct net_de dev =netdev_priv (net); g = dev->gadget; - net->addr_assign_type =NET_ADDR_RANDOM ;eth_hw_addr_set (net, dev->dev_mac); status =register_netdev (net);
@@ -912,6 +919,7 @@ int gether_set_dev_addr(struct net_devicif (get_ether_addr (dev_addr, new_addr))return -EINVAL ;memcpy (dev->dev_mac, new_addr,ETH_ALEN ); + net->addr_assign_type =NET_ADDR_SET ;return 0 ; }EXPORT_SYMBOL_GPL (gether_set_dev_addr);
Greg Kroah-Hartman
maintainerPATCH 112/141 usb: gadget: lpc32xx_udc: Fix refcount leak in lpc32xx_udc_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
commit 4757c9ade34178b351580133771f510b5ffcf9c8 upstream.
of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. of_node_put() will check NULL pointer.
--- drivers/usb/gadget/udc/lpc32xx_udc.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/udc/lpc32xx_udc.c +1 -0
@@ -3016,6 +3016,7 @@ static int lpc32xx_udc_probe(struct plat } udc->isp1301_i2c_client =isp1301_get_client (isp1301_node); +of_node_put (isp1301_node);if (!udc->isp1301_i2c_client) {return -EPROBE_DEFER ; }
Greg Kroah-Hartman
maintainerPATCH 113/141 usb: gadget: f_fs: change ep->status safe in ffs_epfile_io()
In reply to Greg Kroah-HartmanFrom: Linyu Yuan <[email protected]>
commit fb1f16d74e263baa4ad11e31e28b68f144aa55ed upstream.
If a task read/write data in blocking mode, it will wait the completion in ffs_epfile_io(), if function unbind occurs, ffs_func_unbind() will kfree ffs ep, once the task wake up, it still dereference the ffs ep to obtain the request status.
Fix it by moving the request status to io_data which is stack-safe.
--- drivers/usb/gadget/function/f_fs.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-)
drivers/usb/gadget/function/f_fs.c +19 -15
@@ -122,8 +122,6 @@ struct ffs_ep {struct usb_endpoint_descriptor *descs[3 ];u8 num; - -int status;/* P: epfile->mutex */ };struct ffs_epfile {
@@ -227,6 +225,9 @@ struct ffs_io_data {bool use_sg;struct ffs_data *ffs; + +int status; +struct completion done; };struct ffs_desc_helper {
@@ -707,12 +708,15 @@ static const struct file_operations ffs_static void ffs_epfile_io_complete (struct usb_ep *_ep,struct usb_request *req) { +struct ffs_io_data *io_data = req->context; +ENTER (); -if (req->context) { -struct ffs_ep *ep = _ep->driver_data; - ep->status = req->status ? req->status : req->actual; -complete (req->context); - } +if (req->status) + io_data->status = req->status; +else + io_data->status = req->actual; + +complete (&io_data->done); }static ssize_t ffs_copy_to_iter (void *data,int data_len,struct iov_iter *iter)
@@ -1050,7 +1054,6 @@ static ssize_t ffs_epfile_io(struct fileWARN (1 ,"%s: data_len == -EINVAL\n" , __func__); ret = -EINVAL ; }else if (!io_data->aio) { -DECLARE_COMPLETION_ONSTACK (done);bool interrupted = false; req = ep->req;
@@ -1066,7 +1069,8 @@ static ssize_t ffs_epfile_io(struct file io_data->buf = data; - req->context = &done; +init_completion (&io_data->done); + req->context = io_data; req->complete = ffs_epfile_io_complete; ret =usb_ep_queue (ep->ep, req,GFP_ATOMIC );
@@ -1075,7 +1079,7 @@ static ssize_t ffs_epfile_io(struct filespin_unlock_irq (&epfile->ffs->eps_lock); -if (wait_for_completion_interruptible (&done)) { +if (wait_for_completion_interruptible (&io_data->done)) {/* * To avoid race condition with ffs_epfile_io_complete, * dequeue the request first then check
@@ -1083,17 +1087,17 @@ static ssize_t ffs_epfile_io(struct file* condition with req->complete callback. */ usb_ep_dequeue (ep->ep, req); -wait_for_completion (&done); - interrupted = ep->status <0 ; +wait_for_completion (&io_data->done); + interrupted = io_data->status <0 ; }if (interrupted) ret = -EINTR ; -else if (io_data->read && ep->status >0 ) - ret =__ffs_epfile_read_data (epfile, data, ep->status, +else if (io_data->read && io_data->status >0 ) + ret =__ffs_epfile_read_data (epfile, data, io_data->status, &io_data->data);else - ret = ep->status; + ret = io_data->status; goto error_mutex; }else if (!(req =usb_ep_alloc_request (ep->ep,GFP_ATOMIC ))) { ret = -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 114/141 usb: gadget: f_fs: change ep->ep safe in ffs_epfile_io()
In reply to Greg Kroah-HartmanFrom: Linyu Yuan <[email protected]>
commit 0698f0209d8032e8869525aeb68f65ee7fde12ad upstream.
In ffs_epfile_io(), when read/write data in blocking mode, it will wait the completion in interruptible mode, if task receive a signal, it will terminate the wait, at same time, if function unbind occurs, ffs_func_unbind() will kfree all eps, ffs_epfile_io() still try to dequeue request by dereferencing ep which may become invalid.
Fix it by add ep spinlock and will not dereference ep if it is not valid.
--- drivers/usb/gadget/function/f_fs.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/gadget/function/f_fs.c +6 -0
@@ -1080,6 +1080,11 @@ static ssize_t ffs_epfile_io(struct filespin_unlock_irq (&epfile->ffs->eps_lock);if (wait_for_completion_interruptible (&io_data->done)) { +spin_lock_irq (&epfile->ffs->eps_lock); +if (epfile->ep != ep) { + ret = -ESHUTDOWN ; + goto error_lock; + }/* * To avoid race condition with ffs_epfile_io_complete, * dequeue the request first then check
@@ -1087,6 +1092,7 @@ static ssize_t ffs_epfile_io(struct file* condition with req->complete callback. */ usb_ep_dequeue (ep->ep, req); +spin_unlock_irq (&epfile->ffs->eps_lock);wait_for_completion (&io_data->done); interrupted = io_data->status <0 ; }
Greg Kroah-Hartman
maintainerPATCH 115/141 tty: n_gsm: Debug output allocation must use GFP_ATOMIC
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
commit e74024b2eccbb784824a0f9feaeaaa3b47514b79 upstream.
Dan Carpenter <[email protected]> reported the following Smatch warning:
drivers/tty/n_gsm.c:720 gsm_data_kick()
warn: sleeping in atomic context
This is because gsm_control_message() is holding a spin lock so gsm_hex_dump_bytes() needs to use GFP_ATOMIC instead of GFP_KERNEL.
--- drivers/tty/n_gsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/n_gsm.c +1 -1
@@ -455,7 +455,7 @@ static void gsm_hex_dump_bytes(const chareturn ; } - prefix =kasprintf (GFP_KERNEL ,"%s: " , fname); + prefix =kasprintf (GFP_ATOMIC ,"%s: " , fname);if (!prefix)return ; print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_OFFSET, 16, 1, data, len,
Greg Kroah-Hartman
maintainerPATCH 116/141 serial: 8250: Store to lsr_save_flags after lsr read
In reply to Greg Kroah-HartmanFrom: Ilpo Järvinen <[email protected]>
commit be03b0651ffd8bab69dfd574c6818b446c0753ce upstream.
Not all LSR register flags are preserved across reads. Therefore, LSR readers must store the non-preserved bits into lsr_save_flags.
This fix was initially mixed into feature commit f6f586102add ("serial:
8250: Handle UART without interrupt on TEMT using em485"). However, that feature change had a flaw and it was reverted to make room for simpler approach providing the same feature. The embedded fix got reverted with the feature change.
Re-add the lsr_save_flags fix and properly mark it's a fix.
--- drivers/tty/serial/8250/8250_port.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/8250/8250_port.c +2 -0
@@ -1535,6 +1535,8 @@ static inline void __stop_tx(struct uartif (em485) {unsigned char lsr =serial_in (p,UART_LSR ); + p->lsr_saved_flags |= lsr &LSR_SAVE_FLAGS ; +/* * To provide required timeing and allow FIFO transfer, * __stop_tx_rs485() must be called only when both FIFO and
Greg Kroah-Hartman
maintainerPATCH 117/141 bus: fsl-mc-bus: fix KASAN use-after-free in fsl_mc_bus_remove()
In reply to Greg Kroah-HartmanFrom: Shin'ichiro Kawasaki <[email protected]>
commit 928ea98252ad75118950941683893cf904541da9 upstream.
In fsl_mc_bus_remove(), mc->root_mc_bus_dev->mc_io is passed to fsl_destroy_mc_io(). However, mc->root_mc_bus_dev is already freed in fsl_mc_device_remove(). Then reference to mc->root_mc_bus_dev->mc_io triggers KASAN use-after-free. To avoid the use-after-free, keep the reference to mc->root_mc_bus_dev->mc_io in a local variable and pass to fsl_destroy_mc_io().
This patch needs rework to apply to kernels older than v5.15.
--- drivers/bus/fsl-mc/fsl-mc-bus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/bus/fsl-mc/fsl-mc-bus.c +3 -3
@@ -1236,14 +1236,14 @@ error_cleanup_mc_io:static int fsl_mc_bus_remove (struct platform_device *pdev) {struct fsl_mc *mc =platform_get_drvdata (pdev); +struct fsl_mc_io *mc_io;if (!fsl_mc_is_root_dprc (&mc->root_mc_bus_dev->dev))return -EINVAL ; + mc_io = mc->root_mc_bus_dev->mc_io;fsl_mc_device_remove (mc->root_mc_bus_dev); - -fsl_destroy_mc_io (mc->root_mc_bus_dev->mc_io); - mc->root_mc_bus_dev->mc_io =NULL ; +fsl_destroy_mc_io (mc_io);bus_unregister_notifier (&fsl_mc_bus_type, &fsl_mc_nb);
Greg Kroah-Hartman
maintainerPATCH 118/141 md/raid5-ppl: Fix argument order in bio_alloc_bioset()
In reply to Greg Kroah-HartmanFrom: Logan Gunthorpe <[email protected]>
commit f34fdcd4a0e7a0b92340ad7e48e7bcff9393fab5 upstream.
bio_alloc_bioset() takes a block device, number of vectors, the OP flags, the GFP mask and the bio set. However when the prototype was changed, the callisite in ppl_do_flush() had the OP flags and the GFP flags reversed. This introduced some sparse error:
drivers/md/raid5-ppl.c:632:57: warning: incorrect type in argument 3
(different base types)
drivers/md/raid5-ppl.c:632:57: expected unsigned int opf
drivers/md/raid5-ppl.c:632:57: got restricted gfp_t [usertype]
drivers/md/raid5-ppl.c:633:61: warning: incorrect type in argument 4
(different base types)
drivers/md/raid5-ppl.c:633:61: expected restricted gfp_t [usertype]
gfp_mask
drivers/md/raid5-ppl.c:633:61: got unsigned long long
The sparse error introduction may not have been reported correctly by 0day due to other work that was cleaning up other sparse errors in this area.
--- drivers/md/raid5-ppl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/md/raid5-ppl.c +2 -2
@@ -629,9 +629,9 @@ static void ppl_do_flush(struct ppl_io_uif (bdev) {struct bio *bio; - bio =bio_alloc_bioset (bdev,0 ,GFP_NOIO , + bio =bio_alloc_bioset (bdev,0 ,REQ_OP_WRITE |REQ_PREFLUSH , - &ppl_conf->flush_bs); +GFP_NOIO , &ppl_conf->flush_bs); bio->bi_private = io; bio->bi_end_io = ppl_flush_endio;
Greg Kroah-Hartman
maintainerPATCH 119/141 dm: fix race in dm_start_io_acct
In reply to Greg Kroah-HartmanFrom: Benjamin Marzinski <[email protected]>
commit 10eb3a0d517fcc83eeea4242c149461205675eb4 upstream.
After commit 82f6cdcc3676c ("dm: switch dm_io booleans over to proper flags") dm_start_io_acct stopped atomically checking and setting was_accounted, which turned into the DM_IO_ACCOUNTED flag. This opened the possibility for a race where IO accounting is started twice for duplicate bios. To remove the race, check the flag while holding the io->lock.
--- drivers/md/dm.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/md/dm.c +4 -0
@@ -551,6 +551,10 @@ static void dm_start_io_acct(struct dm_ireturn ;/* Can afford locking given DM_TIO_IS_DUPLICATE_BIO */ spin_lock_irqsave (&io->lock, flags); +if (dm_io_flagged (io,DM_IO_ACCOUNTED )) { +spin_unlock_irqrestore (&io->lock, flags); +return ; + }dm_io_set_flag (io,DM_IO_ACCOUNTED );spin_unlock_irqrestore (&io->lock, flags); }
Greg Kroah-Hartman
maintainerPATCH 120/141 dm mirror log: round up region bitmap size to BITS_PER_LONG
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
commit 85e123c27d5cbc22cfdc01de1e2ca1d9003a02d0 upstream.
The code in dm-log rounds up bitset_size to 32 bits. It then uses find_next_zero_bit_le on the allocated region. find_next_zero_bit_le accesses the bitmap using unsigned long pointers. So, on 64-bit architectures, it may access 4 bytes beyond the allocated size.
Fix this bug by rounding up bitset_size to BITS_PER_LONG.
This bug was found by running the lvm2 testsuite with kasan.
--- drivers/md/dm-log.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/md/dm-log.c +1 -2
@@ -415,8 +415,7 @@ static int create_log_context(struct dm_/* * Work out how many "unsigned long"s we need to hold the bitset. */ - bitset_size =dm_round_up (region_count, -sizeof (*lc->clean_bits) <<BYTE_SHIFT ); + bitset_size =dm_round_up (region_count,BITS_PER_LONG ); bitset_size >>=BYTE_SHIFT ; lc->bitset_uint32_count = bitset_size /sizeof (*lc->clean_bits);
Greg Kroah-Hartman
maintainerPATCH 121/141 drm/amdgpu: Fix GTT size reporting in amdgpu_ioctl
In reply to Greg Kroah-HartmanFrom: Michel Dänzer <[email protected]>
commit c904e3acbab3fd97649cd4ab1ff7f1521ad3a255 upstream.
The commit below changed the TTM manager size unit from pages to bytes, but failed to adjust the corresponding calculations in amdgpu_ioctl.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -2
@@ -634,7 +634,6 @@ int amdgpu_info_ioctl(struct drm_deviceatomic64_read (&adev->visible_pin_size), vram_gtt.vram_size); vram_gtt.gtt_size =ttm_manager_type (&adev->mman.bdev,TTM_PL_TT )->size; - vram_gtt.gtt_size *=PAGE_SIZE ; vram_gtt.gtt_size -=atomic64_read (&adev->gart_pin_size);return copy_to_user (out, &vram_gtt,min ((size_t )size,sizeof (vram_gtt))) ? -EFAULT :0 ;
@@ -667,7 +666,6 @@ int amdgpu_info_ioctl(struct drm_device mem.cpu_accessible_vram.usable_heap_size *3 /4 ; mem.gtt.total_heap_size = gtt_man->size; - mem.gtt.total_heap_size *=PAGE_SIZE ; mem.gtt.usable_heap_size = mem.gtt.total_heap_size -atomic64_read (&adev->gart_pin_size); mem.gtt.heap_usage =ttm_resource_manager_usage (gtt_man);
Greg Kroah-Hartman
maintainerPATCH 122/141 drm/amd/display: Cap OLED brightness per max frame-average luminance
In reply to Greg Kroah-HartmanFrom: Roman Li <[email protected]>
commit 4fd17f2ac0aa4e48823ac2ede5b050fb70300bf4 upstream.
[Why]
For OLED eDP the Display Manager uses max_cll value as a limit for brightness control.max_cll defines the content light luminance for individual pixel. Whereas max_fall defines frame-average level luminance. The user may not observe the difference in brightness in between max_fall and max_cll.
That negatively impacts the user experience.
[How]
Use max_fall value instead of max_cll as a limit for brightness control.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -4
@@ -2835,7 +2835,7 @@ static struct drm_mode_config_helper_funstatic void update_connector_ext_caps (struct amdgpu_dm_connector *aconnector) { -u32 max_cll, min_cll, max, min, q, r; +u32 max_avg, min_cll, max, min, q, r;struct amdgpu_dm_backlight_caps *caps;struct amdgpu_display_manager *dm;struct drm_connector *conn_base;
@@ -2865,7 +2865,7 @@ static void update_connector_ext_caps(st caps = &dm->backlight_caps[i]; caps->ext_caps = &aconnector->dc_link->dpcd_sink_ext_caps; caps->aux_support = false; - max_cll = conn_base->hdr_sink_metadata.hdmi_type1.max_cll; + max_avg = conn_base->hdr_sink_metadata.hdmi_type1.max_fall; min_cll = conn_base->hdr_sink_metadata.hdmi_type1.min_cll;if (caps->ext_caps->bits.oled ==1 /*||
@@ -2893,8 +2893,8 @@ static void update_connector_ext_caps(st* The results of the above expressions can be verified at * pre_computed_values. */ - q = max_cll >>5 ; - r = max_cll %32 ; + q = max_avg >>5 ; + r = max_avg %32 ; max = (1 << q) * pre_computed_values[r];// min luminance: maxLum * (CV/255)^2 / 100
Greg Kroah-Hartman
maintainerPATCH 123/141 audit: free module name
In reply to Greg Kroah-HartmanFrom: Christian Göttsche <[email protected]>
commit ef79c396c664be99d0c5660dc75fe863c1e20315 upstream.
Reset the type of the record last as the helper audit_free_module() depends on it.
unreferenced object 0xffff888153b707f0 (size 16):
comm "modprobe", pid 1319, jiffies 4295110033 (age 1083.016s)
hex dump (first 16 bytes):
62 69 6e 66 6d 74 5f 6d 69 73 63 00 6b 6b 6b a5 binfmt_misc.kkk.
backtrace:
[<ffffffffa07dbf9b>] kstrdup+0x2b/0x50
[<ffffffffa04b0a9d>] __audit_log_kern_module+0x4d/0xf0
[<ffffffffa03b6664>] load_module+0x9d4/0x2e10
[<ffffffffa03b8f44>] __do_sys_finit_module+0x114/0x1b0
[<ffffffffa1f47124>] do_syscall_64+0x34/0x80
[<ffffffffa200007e>] entry_SYSCALL_64_after_hwframe+0x46/0xb0--- kernel/auditsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/auditsc.c +1 -1
@@ -1014,10 +1014,10 @@ static void audit_reset_context(struct a ctx->target_comm[0 ] ='\0' ;unroll_tree_refs (ctx,NULL ,0 );WARN_ON (!list_empty (&ctx->killed_trees)); - ctx->type =0 ;audit_free_module (ctx); ctx->fds[0 ] =-1 ;audit_proctitle_free (ctx); + ctx->type =0 ;/* reset last for audit_free_*() */ }static inline struct audit_context *audit_alloc_context (enum audit_state state)
Greg Kroah-Hartman
maintainerPATCH 124/141 cfi: Fix __cfi_slowpath_diag RCU usage with cpuidle
In reply to Greg Kroah-HartmanFrom: Sami Tolvanen <[email protected]>
commit 57cd6d157eb479f0a8e820fd36b7240845c8a937 upstream.
RCU_NONIDLE usage during __cfi_slowpath_diag can result in an invalid RCU state in the cpuidle code path:
WARNING: CPU: 1 PID: 0 at kernel/rcu/tree.c:613 rcu_eqs_enter+0xe4/0x138
...
Call trace:
rcu_eqs_enter+0xe4/0x138
rcu_idle_enter+0xa8/0x100
cpuidle_enter_state+0x154/0x3a8
cpuidle_enter+0x3c/0x58
do_idle.llvm.6590768638138871020+0x1f4/0x2ec
cpu_startup_entry+0x28/0x2c
secondary_start_kernel+0x1b8/0x220
__secondary_switched+0x94/0x98Instead, call rcu_irq_enter/exit to wake up RCU only when needed and disable interrupts for the entire CFI shadow/module check when we do.
--- kernel/cfi.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
kernel/cfi.c +16 -6
@@ -281,6 +281,8 @@ static inline cfi_check_fn find_module_cstatic inline cfi_check_fn find_check_fn (unsigned long ptr) {cfi_check_fn fn =NULL ; +unsigned long flags; +bool rcu_idle;if (is_kernel_text (ptr))return __cfi_check;
@@ -290,13 +292,21 @@ static inline cfi_check_fn find_check_fn* the shadow and __module_address use RCU, so we need to wake it * up if necessary. */ -RCU_NONIDLE ({ -if (IS_ENABLED (CONFIG_CFI_CLANG_SHADOW )) - fn =find_shadow_check_fn (ptr); + rcu_idle = !rcu_is_watching (); +if (rcu_idle) { +local_irq_save (flags); +rcu_irq_enter (); + } -if (!fn) - fn =find_module_check_fn (ptr); - }); +if (IS_ENABLED (CONFIG_CFI_CLANG_SHADOW )) + fn =find_shadow_check_fn (ptr); +if (!fn) + fn =find_module_check_fn (ptr); + +if (rcu_idle) { +rcu_irq_exit (); +local_irq_restore (flags); + }return fn; }
Greg Kroah-Hartman
maintainerPATCH 125/141 fs: account for group membership
In reply to Greg Kroah-HartmanFrom: Christian Brauner <[email protected]>
commit 168f912893407a5acb798a4a58613b5f1f98c717 upstream.
When calling setattr_prepare() to determine the validity of the attributes the ia_{g,u}id fields contain the value that will be written to inode->i_{g,u}id. This is exactly the same for idmapped and non-idmapped mounts and allows callers to pass in the values they want to see written to inode->i_{g,u}id.
When group ownership is changed a caller whose fsuid owns the inode can change the group of the inode to any group they are a member of. When searching through the caller's groups we need to use the gid mapped according to the idmapped mount otherwise we will fail to change ownership for unprivileged users.
Consider a caller running with fsuid and fsgid 1000 using an idmapped mount that maps id 65534 to 1000 and 65535 to 1001. Consequently, a file owned by 65534:65535 in the filesystem will be owned by 1000:1001 in the idmapped mount.
The caller now requests the gid of the file to be changed to 1000 going through the idmapped mount. In the vfs we will immediately map the requested gid to the value that will need to be written to inode->i_gid and place it in attr->ia_gid. Since this idmapped mount maps 65534 to 1000 we place 65534 in attr->ia_gid.
When we check whether the caller is allowed to change group ownership we first validate that their fsuid matches the inode's uid. The inode->i_uid is 65534 which is mapped to uid 1000 in the idmapped mount. Since the caller's fsuid is 1000 we pass the check.
We now check whether the caller is allowed to change inode->i_gid to the requested gid by calling in_group_p(). This will compare the passed in gid to the caller's fsgid and search the caller's additional groups.
Since we're dealing with an idmapped mount we need to pass in the gid mapped according to the idmapped mount. This is akin to checking whether a caller is privileged over the future group the inode is owned by. And that needs to take the idmapped mount into account. Note, all helpers are nops without idmapped mounts.
New regression test sent to xfstests.
--- fs/attr.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
fs/attr.c +20 -6
@@ -61,9 +61,15 @@ static bool chgrp_ok(struct user_namespa const struct inode *inode, kgid_t gid) {kgid_t kgid =i_gid_into_mnt (mnt_userns, inode); -if (uid_eq (current_fsuid (),i_uid_into_mnt (mnt_userns, inode)) && - (in_group_p (gid) ||gid_eq (gid, inode->i_gid))) -return true; +if (uid_eq (current_fsuid (),i_uid_into_mnt (mnt_userns, inode))) { +kgid_t mapped_gid; + +if (gid_eq (gid, inode->i_gid)) +return true; + mapped_gid =mapped_kgid_fs (mnt_userns,i_user_ns (inode), gid); +if (in_group_p (mapped_gid)) +return true; + }if (capable_wrt_inode_uidgid (mnt_userns, inode,CAP_CHOWN ))return true; if (gid_eq(kgid, INVALID_GID) &&
@@ -123,12 +129,20 @@ int setattr_prepare(struct user_namespac/* Make sure a caller can chmod. */ if (ia_valid &ATTR_MODE ) { +kgid_t mapped_gid; +if (!inode_owner_or_capable (mnt_userns, inode))return -EPERM ; + +if (ia_valid &ATTR_GID ) + mapped_gid =mapped_kgid_fs (mnt_userns, +i_user_ns (inode), attr->ia_gid); +else + mapped_gid =i_gid_into_mnt (mnt_userns, inode); +/* Also check the setgid bit! */ -if (!in_group_p ((ia_valid &ATTR_GID ) ? attr->ia_gid : -i_gid_into_mnt (mnt_userns, inode)) && - !capable_wrt_inode_uidgid (mnt_userns, inode,CAP_FSETID )) +if (!in_group_p (mapped_gid) && + !capable_wrt_inode_uidgid (mnt_userns, inode,CAP_FSETID )) attr->ia_mode &= ~S_ISGID ; }
Greg Kroah-Hartman
maintainerPATCH 126/141 selinux: free contexts previously transferred in selinux_add_opt()
In reply to Greg Kroah-HartmanFrom: Christian Göttsche <[email protected]>
commit cad140d00899e7a9cb6fe93b282051df589e671c upstream.
selinux_add_opt() stopped taking ownership of the passed context since commit 70f4169ab421 ("selinux: parse contexts for mount options early").
unreferenced object 0xffff888114dfd140 (size 64):
comm "mount", pid 15182, jiffies 4295687028 (age 796.340s)
hex dump (first 32 bytes):
73 79 73 74 65 6d 5f 75 3a 6f 62 6a 65 63 74 5f system_u:object_
72 3a 74 65 73 74 5f 66 69 6c 65 73 79 73 74 65 r:test_filesyste
backtrace:
[<ffffffffa07dbef4>] kmemdup_nul+0x24/0x80
[<ffffffffa0d34253>] selinux_sb_eat_lsm_opts+0x293/0x560
[<ffffffffa0d13f08>] security_sb_eat_lsm_opts+0x58/0x80
[<ffffffffa0af1eb2>] generic_parse_monolithic+0x82/0x180
[<ffffffffa0a9c1a5>] do_new_mount+0x1f5/0x550
[<ffffffffa0a9eccb>] path_mount+0x2ab/0x1570
[<ffffffffa0aa019e>] __x64_sys_mount+0x20e/0x280
[<ffffffffa1f47124>] do_syscall_64+0x34/0x80
[<ffffffffa200007e>] entry_SYSCALL_64_after_hwframe+0x46/0xb0
unreferenced object 0xffff888108e71640 (size 64):
comm "fsmount", pid 7607, jiffies 4295044974 (age 1601.016s)
hex dump (first 32 bytes):
73 79 73 74 65 6d 5f 75 3a 6f 62 6a 65 63 74 5f system_u:object_
72 3a 74 65 73 74 5f 66 69 6c 65 73 79 73 74 65 r:test_filesyste
backtrace:
[<ffffffff861dc2b1>] memdup_user+0x21/0x90
[<ffffffff861dc367>] strndup_user+0x47/0xa0
[<ffffffff864f6965>] __do_sys_fsconfig+0x485/0x9f0
[<ffffffff87940124>] do_syscall_64+0x34/0x80
[<ffffffff87a0007e>] entry_SYSCALL_64_after_hwframe+0x46/0xb0--- security/selinux/hooks.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
security/selinux/hooks.c +4 -7
@@ -2600,8 +2600,9 @@ static int selinux_sb_eat_lsm_opts(char } } rc =selinux_add_opt (token, arg, mnt_opts); +kfree (arg); + arg =NULL ;if (unlikely (rc)) { -kfree (arg); goto free_opt; } }else {
@@ -2792,17 +2793,13 @@ static int selinux_fs_context_parse_para struct fs_parameter *param) {struct fs_parse_result result; -int opt, rc; +int opt; opt =fs_parse (fc, selinux_fs_parameters, param, &result);if (opt <0 )return opt; - rc =selinux_add_opt (opt, param->string, &fc->security); -if (!rc) - param->string =NULL ; - -return rc; +return selinux_add_opt (opt, param->string, &fc->security); }/* inode security operations */
Greg Kroah-Hartman
maintainerPATCH 127/141 ext4: fix super block checksum incorrect after mount
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
commit 9b6641dd95a0c441b277dd72ba22fed8d61f76ad upstream.
We got issue as follows:
[home]# mount /dev/sda test
EXT4-fs (sda): warning: mounting fs with errors, running e2fsck is recommended [home]# dmesg
EXT4-fs (sda): warning: mounting fs with errors, running e2fsck is recommended EXT4-fs (sda): Errors on filesystem, clearing orphan list. EXT4-fs (sda): recovery complete
EXT4-fs (sda): mounted filesystem with ordered data mode. Quota mode: none. [home]# debugfs /dev/sda
debugfs 1.46.5 (30-Dec-2021)
Checksum errors in superblock! Retrying...
Reason is ext4_orphan_cleanup will reset ‘s_last_orphan’ but not update super block checksum.
To solve above issue, defer update super block checksum after ext4_orphan_cleanup.
--- fs/ext4/super.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/ext4/super.c +8 -8
@@ -5422,14 +5422,6 @@ no_journal: err =percpu_counter_init (&sbi->s_freeinodes_counter, freei,GFP_KERNEL ); } -/* -* Update the checksum after updating free space/inode -* counters. Otherwise the superblock can have an incorrect -* checksum in the buffer cache until it is written out and -* e2fsprogs programs trying to open a file system immediately -* after it is mounted can fail. -*/ -ext4_superblock_csum_set (sb);if (!err) err =percpu_counter_init (&sbi->s_dirs_counter,ext4_count_dirs (sb),GFP_KERNEL );
@@ -5487,6 +5479,14 @@ no_journal:EXT4_SB (sb)->s_mount_state |=EXT4_ORPHAN_FS ;ext4_orphan_cleanup (sb, es);EXT4_SB (sb)->s_mount_state &= ~EXT4_ORPHAN_FS ; +/* +* Update the checksum after updating free space/inode counters and +* ext4_orphan_cleanup. Otherwise the superblock can have an incorrect +* checksum in the buffer cache until it is written out and +* e2fsprogs programs trying to open a file system immediately +* after it is mounted can fail. +*/ +ext4_superblock_csum_set (sb);if (needs_recovery) {ext4_msg (sb,KERN_INFO ,"recovery complete" ); err =ext4_mark_recovery_complete (sb, es);
Greg Kroah-Hartman
maintainerPATCH 128/141 ext4: fix bug_on ext4_mb_use_inode_pa
In reply to Greg Kroah-HartmanFrom: Baokun Li <[email protected]>
commit a08f789d2ab5242c07e716baf9a835725046be89 upstream.
Hulk Robot reported a BUG_ON:
==================================================================
kernel BUG at fs/ext4/mballoc.c:3211!
[...]
RIP: 0010:ext4_mb_mark_diskspace_used.cold+0x85/0x136f [...] Call Trace: ext4_mb_new_blocks+0x9df/0x5d30 ext4_ext_map_blocks+0x1803/0x4d80 ext4_map_blocks+0x3a4/0x1a10 ext4_writepages+0x126d/0x2c30 do_writepages+0x7f/0x1b0 __filemap_fdatawrite_range+0x285/0x3b0 file_write_and_wait_range+0xb1/0x140 ext4_sync_file+0x1aa/0xca0 vfs_fsync_range+0xfb/0x260 do_fsync+0x48/0xa0
[...]
==================================================================
Above issue may happen as follows:
-------------------------------------do_fsync
vfs_fsync_range
ext4_sync_file
file_write_and_wait_range
__filemap_fdatawrite_range
do_writepages
ext4_writepages
mpage_map_and_submit_extent
mpage_map_one_extent
ext4_map_blocks
ext4_mb_new_blocks
ext4_mb_normalize_request
>>> start + size <= ac->ac_o_ex.fe_logical
ext4_mb_regular_allocator
ext4_mb_simple_scan_group
ext4_mb_use_best_found
ext4_mb_new_preallocation
ext4_mb_new_inode_pa
ext4_mb_use_inode_pa
>>> set ac->ac_b_ex.fe_len <= 0
ext4_mb_mark_diskspace_used
>>> BUG_ON(ac->ac_b_ex.fe_len <= 0);we can easily reproduce this problem with the following commands:
`fallocate -l100M disk` `mkfs.ext4 -b 1024 -g 256 disk` `mount disk /mnt` `fsstress -d /mnt -l 0 -n 1000 -p 1`
The size must be smaller than or equal to EXT4_BLOCKS_PER_GROUP. Therefore, "start + size <= ac->ac_o_ex.fe_logical" may occur when the size is truncated. So start should be the start position of the group where ac_o_ex.fe_logical is located after alignment. In addition, when the value of fe_logical or EXT4_BLOCKS_PER_GROUP is very large, the value calculated by start_off is more accurate.
--- fs/ext4/mballoc.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/ext4/mballoc.c +9 -0
@@ -4107,6 +4107,15 @@ ext4_mb_normalize_request(struct ext4_al size = size >> bsbits; start = start_off >> bsbits; +/* +* For tiny groups (smaller than 8MB) the chosen allocation +* alignment may be larger than group size. Make sure the +* alignment does not move allocation to a different group which +* makes mballoc fail assertions later. +*/ + start =max (start,rounddown (ac->ac_o_ex.fe_logical, + (ext4_lblk_t )EXT4_BLOCKS_PER_GROUP (ac->ac_sb))); +/* don't cover already allocated blocks in selected range */ if (ar->pleft && start <= ar->lleft) { size -= ar->lleft +1 - start;
Greg Kroah-Hartman
maintainerPATCH 129/141 ext4: make variable "count" signed
In reply to Greg Kroah-HartmanFrom: Ding Xiang <[email protected]>
commit bc75a6eb856cb1507fa907bf6c1eda91b3fef52f upstream.
Since dx_make_map() may return -EFSCORRUPTED now, so change "count" to be a signed integer so we can correctly check for an error code returned by dx_make_map().
--- fs/ext4/namei.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ext4/namei.c +2 -1
@@ -1929,7 +1929,8 @@ static struct ext4_dir_entry_2 *do_split struct dx_hash_info *hinfo) {unsigned blocksize = dir->i_sb->s_blocksize; -unsigned count, continued; +unsigned continued; +int count;struct buffer_head *bh2;ext4_lblk_t newblock;u32 hash2;
Greg Kroah-Hartman
maintainerPATCH 130/141 ext4: add reserved GDT blocks check
In reply to Greg Kroah-HartmanFrom: Zhang Yi <[email protected]>
commit b55c3cd102a6f48b90e61c44f7f3dda8c290c694 upstream.
We capture a NULL pointer issue when resizing a corrupt ext4 image which is freshly clear resize_inode feature (not run e2fsck). It could be simply reproduced by following steps. The problem is because of the resize_inode feature was cleared, and it will convert the filesystem to meta_bg mode in ext4_resize_fs(), but the es->s_reserved_gdt_blocks was not reduced to zero, so could we mistakenly call reserve_backup_gdb() and passing an uninitialized resize_inode to it when adding new group descriptors.
mkfs.ext4 /dev/sda 3G
tune2fs -O ^resize_inode /dev/sda #forget to run requested e2fsck mount /dev/sda /mnt
resize2fs /dev/sda 8G
========
BUG: kernel NULL pointer dereference, address: 0000000000000028 CPU: 19 PID: 3243 Comm: resize2fs Not tainted 5.18.0-rc7-00001-gfde086c5ebfd #748 ... RIP: 0010:ext4_flex_group_add+0xe08/0x2570 ... Call Trace: <TASK> ext4_resize_fs+0xbec/0x1660 __ext4_ioctl+0x1749/0x24e0 ext4_ioctl+0x12/0x20 __x64_sys_ioctl+0xa6/0x110 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f2dd739617b ========
The fix is simple, add a check in ext4_resize_begin() to make sure that the es->s_reserved_gdt_blocks is zero when the resize_inode feature is disabled.
--- fs/ext4/resize.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/ext4/resize.c +10 -0
@@ -54,6 +54,16 @@ int ext4_resize_begin(struct super_blockreturn -EPERM ;/* +* If the reserved GDT blocks is non-zero, the resize_inode feature +* should always be set. +*/ +if (EXT4_SB (sb)->s_es->s_reserved_gdt_blocks && + !ext4_has_feature_resize_inode (sb)) { +ext4_error (sb,"resize_inode disabled but reserved GDT blocks non-zero" ); +return -EFSCORRUPTED ; + } + +/* * If we are not using the primary superblock/GDT copy don't resize, * because the user tools have no way of handling this. Probably a * bad time to do it anyways.
Greg Kroah-Hartman
maintainerPATCH 131/141 KVM: arm64: Always start with clearing SVE flag on load
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
commit d52d165d67c5aa26c8c89909003c94a66492d23d upstream.
On each vcpu load, we set the KVM_ARM64_HOST_SVE_ENABLED flag if SVE is enabled for EL0 on the host. This is used to restore the correct state on vpcu put.
However, it appears that nothing ever clears this flag. Once set, it will stick until the vcpu is destroyed, which has the potential to spuriously enable SVE for userspace.
We probably never saw the issue because no VMM uses SVE, but that's still pretty bad. Unconditionally clearing the flag on vcpu load addresses the issue.
--- arch/arm64/kvm/fpsimd.c | 1 + 1 file changed, 1 insertion(+)
arch/arm64/kvm/fpsimd.c +1 -0
@@ -80,6 +80,7 @@ void kvm_arch_vcpu_load_fp(struct kvm_vc vcpu->arch.flags &= ~KVM_ARM64_FP_ENABLED ; vcpu->arch.flags |=KVM_ARM64_FP_HOST ; + vcpu->arch.flags &= ~KVM_ARM64_HOST_SVE_ENABLED ;if (read_sysreg (cpacr_el1) &CPACR_EL1_ZEN_EL0EN ) vcpu->arch.flags |=KVM_ARM64_HOST_SVE_ENABLED ; }
Greg Kroah-Hartman
maintainerPATCH 132/141 KVM: arm64: Dont read a HW interrupt pending state in user context
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
commit 2cdea19a34c2340b3aa69508804efe4e3750fcec upstream.
Since 5bfa685e62e9 ("KVM: arm64: vgic: Read HW interrupt pending state from the HW"), we're able to source the pending bit for an interrupt that is stored either on the physical distributor or on a device.
However, this state is only available when the vcpu is loaded, and is not intended to be accessed from userspace. Unfortunately, the GICv2 emulation doesn't provide specific userspace accessors, and we fallback with the ones that are intended for the guest, with fatal consequences.
Add a new vgic_uaccess_read_pending() accessor for userspace to use, build on top of the existing vgic_mmio_read_pending().
--- arch/arm64/kvm/vgic/vgic-mmio-v2.c | 4 ++-- arch/arm64/kvm/vgic/vgic-mmio.c | 19 ++++++++++++++++--- arch/arm64/kvm/vgic/vgic-mmio.h | 3 +++ 3 files changed, 21 insertions(+), 5 deletions(-)
arch/arm64/kvm/vgic/vgic-mmio-v2.c +2 -2
@@ -417,11 +417,11 @@ static const struct vgic_register_region VGIC_ACCESS_32bit),REGISTER_DESC_WITH_BITS_PER_IRQ (GIC_DIST_PENDING_SET , vgic_mmio_read_pending, vgic_mmio_write_spending, -NULL , vgic_uaccess_write_spending,1 , + vgic_uaccess_read_pending, vgic_uaccess_write_spending,1 , VGIC_ACCESS_32bit),REGISTER_DESC_WITH_BITS_PER_IRQ (GIC_DIST_PENDING_CLEAR , vgic_mmio_read_pending, vgic_mmio_write_cpending, -NULL , vgic_uaccess_write_cpending,1 , + vgic_uaccess_read_pending, vgic_uaccess_write_cpending,1 , VGIC_ACCESS_32bit), REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_ACTIVE_SET, vgic_mmio_read_active, vgic_mmio_write_sactive,
arch/arm64/kvm/vgic/vgic-mmio.c +16 -3
@@ -226,8 +226,9 @@ int vgic_uaccess_write_cenable(struct kvreturn 0 ; } -unsigned long vgic_mmio_read_pending (struct kvm_vcpu *vcpu, -gpa_t addr,unsigned int len) +static unsigned long __read_pending (struct kvm_vcpu *vcpu, +gpa_t addr,unsigned int len, +bool is_user) {u32 intid =VGIC_ADDR_TO_INTID (addr,1 );u32 value =0 ;
@@ -248,7 +249,7 @@ unsigned long vgic_mmio_read_pending(strIRQCHIP_STATE_PENDING , &val);WARN_RATELIMIT (err,"IRQ %d" , irq->host_irq); - }else if (vgic_irq_is_mapped_level (irq)) { + }else if (!is_user &&vgic_irq_is_mapped_level (irq)) { val =vgic_get_phys_line_level (irq); }else { val =irq_is_pending (irq);
@@ -263,6 +264,18 @@ unsigned long vgic_mmio_read_pending(strreturn value; } +unsigned long vgic_mmio_read_pending (struct kvm_vcpu *vcpu, +gpa_t addr,unsigned int len) +{ +return __read_pending (vcpu, addr, len, false); +} + +unsigned long vgic_uaccess_read_pending (struct kvm_vcpu *vcpu, +gpa_t addr,unsigned int len) +{ +return __read_pending (vcpu, addr, len, true); +} +static bool is_vgic_v2_sgi (struct kvm_vcpu *vcpu,struct vgic_irq *irq) { return (vgic_irq_is_sgi(irq->intid) &&
arch/arm64/kvm/vgic/vgic-mmio.h +3 -0
@@ -149,6 +149,9 @@ int vgic_uaccess_write_cenable(struct kvunsigned long vgic_mmio_read_pending (struct kvm_vcpu *vcpu,gpa_t addr,unsigned int len); +unsigned long vgic_uaccess_read_pending (struct kvm_vcpu *vcpu, +gpa_t addr,unsigned int len); +void vgic_mmio_write_spending (struct kvm_vcpu *vcpu,gpa_t addr,unsigned int len,unsigned long val);
Greg Kroah-Hartman
maintainerPATCH 133/141 virtio-pci: Remove wrong address verification in vp_del_vqs()
In reply to Greg Kroah-HartmanFrom: Murilo Opsfelder Araujo <[email protected]>
commit 7e415282b41bf0d15c6e0fe268f822d9b083f2f7 upstream.
GCC 12 enhanced -Waddress when comparing array address to null [0], which warns:
drivers/virtio/virtio_pci_common.c: In function ‘vp_del_vqs’:
drivers/virtio/virtio_pci_common.c:257:29: warning: the comparison will always evaluate as ‘true’ for the pointer operand in ‘vp_dev->msix_affinity_masks + (sizetype)((long unsigned int)i * 256)’ must not be NULL [-Waddress]
257 | if (vp_dev->msix_affinity_masks[i])
| ^~~~~~In fact, the verification is comparing the result of a pointer arithmetic, the address "msix_affinity_masks + i", which will always evaluate to true.
Under the hood, free_cpumask_var() calls kfree(), which is safe to pass NULL, not requiring non-null verification. So remove the verification to make compiler happy (happy compiler, happy life).
[0] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102103
Message-Id: <[email protected]>
--- drivers/virtio/virtio_pci_common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/virtio/virtio_pci_common.c +1 -2
@@ -254,8 +254,7 @@ void vp_del_vqs(struct virtio_device *vdif (vp_dev->msix_affinity_masks) {for (i =0 ; i < vp_dev->msix_vectors; i++) -if (vp_dev->msix_affinity_masks[i]) -free_cpumask_var (vp_dev->msix_affinity_masks[i]); +free_cpumask_var (vp_dev->msix_affinity_masks[i]); }if (vp_dev->msix_enabled) {
Greg Kroah-Hartman
maintainerPATCH 134/141 netfs: Fix gcc-12 warning by embedding vfs inode in netfs_i_context
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
commit 874c8ca1e60b2c564a48f7e7acc40d328d5c8733 upstream.
While randstruct was satisfied with using an open-coded "void *" offset cast for the netfs_i_context <-> inode casting, __builtin_object_size() as used by FORTIFY_SOURCE was not as easily fooled. This was causing the following complaint[1] from gcc v12:
In file included from include/linux/string.h:253,
from include/linux/ceph/ceph_debug.h:7,
from fs/ceph/inode.c:2:
In function 'fortify_memset_chk',
inlined from 'netfs_i_context_init' at include/linux/netfs.h:326:2,
inlined from 'ceph_alloc_inode' at fs/ceph/inode.c:463:2:
include/linux/fortify-string.h:242:25: warning: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]
242 | __write_overflow_field(p_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Fix this by embedding a struct inode into struct netfs_i_context (which should perhaps be renamed to struct netfs_inode). The struct inode vfs_inode fields are then removed from the 9p, afs, ceph and cifs inode structs and vfs_inode is then simply changed to "netfs.inode" in those filesystems.
Further, rename netfs_i_context to netfs_inode, get rid of the netfs_inode() function that converted a netfs_i_context pointer to an inode pointer (that can now be done with &ctx->inode) and rename the netfs_i_context() function to netfs_inode() (which is now a wrapper around container_of()).
Most of the changes were done with:
perl -p -i -e 's/vfs_inode/netfs.inode/'g \
`git grep -l 'vfs_inode' -- fs/{9p,afs,ceph,cifs}/*.[ch]`Kees suggested doing it with a pair structure[2] and a special declarator to insert that into the network filesystem's inode wrapper[3], but I think it's cleaner to embed it - and then it doesn't matter if struct randomisation reorders things.
Dave Chinner suggested using a filesystem-specific VFS_I() function in each filesystem to convert that filesystem's own inode wrapper struct into the VFS inode struct[4].
Version #2:
- Fix a couple of missed name changes due to a disabled cifs option.
- Rename nfs_i_context to nfs_inode
- Use "netfs" instead of "nic" as the member name in per-fs inode wrapper structs.
[ This also undoes commit 507160f46c55 ("netfs: gcc-12: temporarily
disable '-Wattribute-warning' for now") that is no longer needed ]
--- Documentation/filesystems/netfs_library.rst | 37 ++++----- fs/9p/cache.c | 4 - fs/9p/v9fs.c | 2 fs/9p/v9fs.h | 10 -- fs/9p/vfs_addr.c | 2 fs/9p/vfs_inode.c | 4 - fs/afs/callback.c | 2 fs/afs/dir.c | 32 ++++---- fs/afs/dir_edit.c | 10 +- fs/afs/dir_silly.c | 4 - fs/afs/dynroot.c | 2 fs/afs/file.c | 4 - fs/afs/fs_operation.c | 6 - fs/afs/inode.c | 41 +++++------ fs/afs/internal.h | 23 ++---- fs/afs/super.c | 6 - fs/afs/write.c | 21 ++--- fs/ceph/addr.c | 4 - fs/ceph/cache.c | 4 - fs/ceph/cache.h | 2 fs/ceph/caps.c | 104 ++++++++++++++-------------- fs/ceph/file.c | 2 fs/ceph/inode.c | 13 +-- fs/ceph/mds_client.c | 4 - fs/ceph/snap.c | 8 +- fs/ceph/super.c | 2 fs/ceph/super.h | 10 -- fs/ceph/xattr.c | 14 +-- fs/cifs/cifsfs.c | 8 +- fs/cifs/cifsglob.h | 12 +-- fs/cifs/file.c | 8 +- fs/cifs/fscache.c | 8 +- fs/cifs/fscache.h | 8 +- fs/cifs/inode.c | 4 - fs/cifs/misc.c | 4 - fs/cifs/smb2ops.c | 8 +- fs/netfs/buffered_read.c | 6 - fs/netfs/internal.h | 2 fs/netfs/objects.c | 2 include/linux/netfs.h | 41 ++++------- 40 files changed, 227 insertions(+), 261 deletions(-)
Documentation/filesystems/netfs_library.rst +18 -19
@@ -37,30 +37,31 @@ The network filesystem helper library ne its use on each netfs inode it is helping to manage. To this end, a context structure is defined:: - struct netfs_i_context { + struct netfs_inode { + struct inode inode; const struct netfs_request_ops *ops; - struct fscache_cookie *cache; + struct fscache_cookie *cache; }; -A network filesystem that wants to use netfs lib must place one of these -directly after the VFS ``struct inode`` it allocates, usually as part of its -own struct. This can be done in a way similar to the following:: +A network filesystem that wants to use netfs lib must place one of these in its +inode wrapper struct instead of the VFS ``struct inode``. This can be done in +a way similar to the following:: struct my_inode { - struct { - /* These must be contiguous */ - struct inode vfs_inode; - struct netfs_i_context netfs_ctx; - }; + struct netfs_inode netfs; /* Netfslib context and vfs inode */ ... }; -This allows netfslib to find its state by simple offset from the inode pointer, -thereby allowing the netfslib helper functions to be pointed to directly by the -VFS/VM operation tables. +This allows netfslib to find its state by using ``container_of()`` from the +inode pointer, thereby allowing the netfslib helper functions to be pointed to +directly by the VFS/VM operation tables. The structure contains the following fields: + * ``inode`` + + The VFS inode structure. + * ``ops`` The set of operations provided by the network filesystem to netfslib.
@@ -78,14 +79,12 @@ To help deal with the per-inode context, provided. Firstly, a function to perform basic initialisation on a context and set the operations table pointer:: - void netfs_i_context_init(struct inode *inode, - const struct netfs_request_ops *ops); + void netfs_inode_init(struct inode *inode, + const struct netfs_request_ops *ops); -then two functions to cast between the VFS inode structure and the netfs -context:: +then a function to cast from the VFS inode structure to the netfs context:: - struct netfs_i_context *netfs_i_context(struct inode *inode); - struct inode *netfs_inode(struct netfs_i_context *ctx); + struct netfs_inode *netfs_node(struct inode *inode); and finally, a function to get the cache cookie pointer from the context attached to an inode (or NULL if fscache is disabled)::
fs/9p/cache.c +2 -2
@@ -62,12 +62,12 @@ void v9fs_cache_inode_get_cookie(struct version =cpu_to_le32 (v9inode->qid.version); path =cpu_to_le64 (v9inode->qid.path); v9ses =v9fs_inode2v9ses (inode); - v9inode->netfs_ctx.cache = + v9inode->netfs.cache =fscache_acquire_cookie (v9fs_session_cache (v9ses),0 , &path,sizeof (path), &version,sizeof (version), -i_size_read (&v9inode->vfs_inode)); +i_size_read (&v9inode->netfs.inode));p9_debug (P9_DEBUG_FSC ,"inode %p get cookie %p\n" , inode,v9fs_inode_cookie (v9inode));
fs/9p/v9fs.c +1 -1
@@ -625,7 +625,7 @@ static void v9fs_inode_init_once(void *fstruct v9fs_inode *v9inode = (struct v9fs_inode *)foo;memset (&v9inode->qid,0 ,sizeof (v9inode->qid)); -inode_init_once (&v9inode->vfs_inode); +inode_init_once (&v9inode->netfs.inode); }/**
fs/9p/v9fs.h +3 -7
@@ -109,11 +109,7 @@ struct v9fs_session_info {#define V9FS_INO_INVALID_ATTR 0x01struct v9fs_inode { -struct { -/* These must be contiguous */ -struct inode vfs_inode;/* the VFS's inode record */ -struct netfs_i_context netfs_ctx;/* Netfslib context */ - }; +struct netfs_inode netfs;/* Netfslib context and vfs inode */ struct p9_qid qid;unsigned int cache_validity;struct p9_fid *writeback_fid;
@@ -122,13 +118,13 @@ struct v9fs_inode {static inline struct v9fs_inode *V9FS_I (const struct inode *inode) { - return container_of(inode, struct v9fs_inode, vfs_inode); + return container_of(inode, struct v9fs_inode, netfs.inode); }static inline struct fscache_cookie *v9fs_inode_cookie (struct v9fs_inode *v9inode) {#ifdef CONFIG_9P_FSCACHE -return netfs_i_cookie (&v9inode->vfs_inode); +return netfs_i_cookie (&v9inode->netfs.inode);#else return NULL ;#endif
fs/9p/vfs_addr.c +1 -1
@@ -141,7 +141,7 @@ static void v9fs_write_to_cache_done(voi transferred_or_error != -ENOBUFS) { version =cpu_to_le32 (v9inode->qid.version);fscache_invalidate (v9fs_inode_cookie (v9inode), &version, -i_size_read (&v9inode->vfs_inode),0 ); +i_size_read (&v9inode->netfs.inode),0 ); } }
fs/9p/vfs_inode.c +2 -2
@@ -234,7 +234,7 @@ struct inode *v9fs_alloc_inode(struct su v9inode->writeback_fid =NULL ; v9inode->cache_validity =0 ;mutex_init (&v9inode->v_mutex); -return &v9inode->vfs_inode; +return &v9inode->netfs.inode; }/**
@@ -252,7 +252,7 @@ void v9fs_free_inode(struct inode *inode*/ static void v9fs_set_netfs_context (struct inode *inode) { -netfs_i_context_init (inode, &v9fs_req_ops); +netfs_inode_init (inode, &v9fs_req_ops); } int v9fs_init_inode(struct v9fs_session_info *v9ses,
fs/afs/callback.c +1 -1
@@ -30,7 +30,7 @@ void afs_invalidate_mmap_work(struct wor { struct afs_vnode *vnode = container_of(work, struct afs_vnode, cb_work); -unmap_mapping_pages (vnode->vfs_inode.i_mapping,0 ,0 , false); +unmap_mapping_pages (vnode->netfs.inode.i_mapping,0 ,0 , false); }void afs_server_init_callback_work (struct work_struct *work)
fs/afs/dir.c +16 -16
@@ -109,7 +109,7 @@ struct afs_lookup_cookie {*/ static void afs_dir_read_cleanup (struct afs_read *req) { -struct address_space *mapping = req->vnode->vfs_inode.i_mapping; +struct address_space *mapping = req->vnode->netfs.inode.i_mapping;struct folio *folio;pgoff_t last = req->nr_pages -1 ;
@@ -153,7 +153,7 @@ static bool afs_dir_check_folio(struct a block =kmap_local_folio (folio, offset);if (block->hdr.magic !=AFS_DIR_MAGIC ) {printk ("kAFS: %s(%lx): [%llx] bad magic %zx/%zx is %04hx\n" , - __func__, dvnode->vfs_inode.i_ino, + __func__, dvnode->netfs.inode.i_ino, pos, offset, size,ntohs (block->hdr.magic));trace_afs_dir_check_failed (dvnode, pos + offset, i_size);kunmap_local (block);
@@ -183,7 +183,7 @@ error:static void afs_dir_dump (struct afs_vnode *dvnode,struct afs_read *req) {union afs_xdr_dir_block *block; -struct address_space *mapping = dvnode->vfs_inode.i_mapping; +struct address_space *mapping = dvnode->netfs.inode.i_mapping;struct folio *folio;pgoff_t last = req->nr_pages -1 ;size_t offset, size;
@@ -217,7 +217,7 @@ static void afs_dir_dump(struct afs_vnod*/ static int afs_dir_check (struct afs_vnode *dvnode,struct afs_read *req) { -struct address_space *mapping = dvnode->vfs_inode.i_mapping; +struct address_space *mapping = dvnode->netfs.inode.i_mapping;struct folio *folio;pgoff_t last = req->nr_pages -1 ;int ret =0 ;
@@ -269,7 +269,7 @@ static int afs_dir_open(struct inode *instatic struct afs_read *afs_read_dir (struct afs_vnode *dvnode,struct key *key) __acquires(&dvnode->validate_lock) { -struct address_space *mapping = dvnode->vfs_inode.i_mapping; +struct address_space *mapping = dvnode->netfs.inode.i_mapping;struct afs_read *req;loff_t i_size;int nr_pages, i;
@@ -287,7 +287,7 @@ static struct afs_read *afs_read_dir(str req->cleanup = afs_dir_read_cleanup; expand: - i_size =i_size_read (&dvnode->vfs_inode); + i_size =i_size_read (&dvnode->netfs.inode);if (i_size <2048 ) { ret =afs_bad (dvnode, afs_file_error_dir_small); goto error;
@@ -305,7 +305,7 @@ expand: req->actual_len = i_size;/* May change */ req->len = nr_pages *PAGE_SIZE ;/* We can ask for more than there is */ req->data_version = dvnode->status.data_version;/* May change */ -iov_iter_xarray (&req->def_iter,READ , &dvnode->vfs_inode.i_mapping->i_pages, +iov_iter_xarray (&req->def_iter,READ , &dvnode->netfs.inode.i_mapping->i_pages,0 , i_size); req->iter = &req->def_iter;
@@ -897,7 +897,7 @@ static struct inode *afs_do_lookup(struc out_op:if (op->error ==0 ) { - inode = &op->file[1 ].vnode->vfs_inode; + inode = &op->file[1 ].vnode->netfs.inode; op->file[1 ].vnode =NULL ; }
@@ -1139,7 +1139,7 @@ static int afs_d_revalidate(struct dentrafs_stat_v (dir, n_reval);/* search the directory for this vnode */ - ret =afs_do_lookup_one (&dir->vfs_inode, dentry, &fid, key, &dir_version); + ret =afs_do_lookup_one (&dir->netfs.inode, dentry, &fid, key, &dir_version);switch (ret) {case 0 :/* the filename maps to something */
@@ -1170,7 +1170,7 @@ static int afs_d_revalidate(struct dentr_debug ("%pd: file deleted (uq %u -> %u I:%u)" , dentry, fid.unique, vnode->fid.unique, - vnode->vfs_inode.i_generation); + vnode->netfs.inode.i_generation); goto not_found; } goto out_valid;
@@ -1368,7 +1368,7 @@ static void afs_dir_remove_subdir(structif (d_really_is_positive (dentry)) {struct afs_vnode *vnode =AFS_FS_I (d_inode (dentry)); -clear_nlink (&vnode->vfs_inode); +clear_nlink (&vnode->netfs.inode);set_bit (AFS_VNODE_DELETED , &vnode->flags);clear_bit (AFS_VNODE_CB_PROMISED , &vnode->flags);clear_bit (AFS_VNODE_DIR_VALID , &vnode->flags);
@@ -1487,8 +1487,8 @@ static void afs_dir_remove_link(struct a/* Already done */ }else if (test_bit (AFS_VNODE_DIR_VALID , &dvnode->flags)) {write_seqlock (&vnode->cb_lock); -drop_nlink (&vnode->vfs_inode); -if (vnode->vfs_inode.i_nlink ==0 ) { +drop_nlink (&vnode->netfs.inode); +if (vnode->netfs.inode.i_nlink ==0 ) {set_bit (AFS_VNODE_DELETED , &vnode->flags);__afs_break_callback (vnode, afs_cb_break_for_unlink); }
@@ -1504,7 +1504,7 @@ static void afs_dir_remove_link(struct a op->error = ret; } -_debug ("nlink %d [val %d]" , vnode->vfs_inode.i_nlink, op->error); +_debug ("nlink %d [val %d]" , vnode->netfs.inode.i_nlink, op->error); }static void afs_unlink_success (struct afs_operation *op)
@@ -1680,8 +1680,8 @@ static void afs_link_success(struct afs_afs_update_dentry_version (op, dvp, op->dentry);if (op->dentry_2->d_parent == op->dentry->d_parent)afs_update_dentry_version (op, dvp, op->dentry_2); -ihold (&vp->vnode->vfs_inode); -d_instantiate (op->dentry, &vp->vnode->vfs_inode); +ihold (&vp->vnode->netfs.inode); +d_instantiate (op->dentry, &vp->vnode->netfs.inode); }static void afs_link_put (struct afs_operation *op)
fs/afs/dir_edit.c +5 -5
@@ -109,7 +109,7 @@ static void afs_clear_contig_bits(union*/ static struct folio *afs_dir_get_folio (struct afs_vnode *vnode,pgoff_t index) { -struct address_space *mapping = vnode->vfs_inode.i_mapping; +struct address_space *mapping = vnode->netfs.inode.i_mapping;struct folio *folio; folio = __filemap_get_folio(mapping, index,
@@ -216,7 +216,7 @@ void afs_edit_dir_add(struct afs_vnode *_enter (",,{%d,%s}," , name->len, name->name); - i_size =i_size_read (&vnode->vfs_inode); + i_size =i_size_read (&vnode->netfs.inode);if (i_size >AFS_DIR_BLOCK_SIZE *AFS_DIR_MAX_BLOCKS || (i_size & (AFS_DIR_BLOCK_SIZE -1 ))) {clear_bit (AFS_VNODE_DIR_VALID , &vnode->flags);
@@ -336,7 +336,7 @@ found_space:if (b <AFS_DIR_BLOCKS_WITH_CTR ) meta->meta.alloc_ctrs[b] -= need_slots; -inode_inc_iversion_raw (&vnode->vfs_inode); +inode_inc_iversion_raw (&vnode->netfs.inode);afs_stat_v (vnode, n_dir_cr);_debug ("Insert %s in %u[%u]" , name->name, b, slot);
@@ -383,7 +383,7 @@ void afs_edit_dir_remove(struct afs_vnod_enter (",,{%d,%s}," , name->len, name->name); - i_size =i_size_read (&vnode->vfs_inode); + i_size =i_size_read (&vnode->netfs.inode);if (i_size <AFS_DIR_BLOCK_SIZE || i_size >AFS_DIR_BLOCK_SIZE *AFS_DIR_MAX_BLOCKS || (i_size & (AFS_DIR_BLOCK_SIZE -1 ))) {
@@ -463,7 +463,7 @@ found_dirent:if (b <AFS_DIR_BLOCKS_WITH_CTR ) meta->meta.alloc_ctrs[b] += need_slots; -inode_set_iversion_raw (&vnode->vfs_inode, vnode->status.data_version); +inode_set_iversion_raw (&vnode->netfs.inode, vnode->status.data_version);afs_stat_v (vnode, n_dir_rm);_debug ("Remove %s from %u[%u]" , name->name, b, slot);
fs/afs/dir_silly.c +2 -2
@@ -131,7 +131,7 @@ int afs_sillyrename(struct afs_vnode *dv goto out; }while (!d_is_negative (sdentry)); -ihold (&vnode->vfs_inode); +ihold (&vnode->netfs.inode); ret =afs_do_silly_rename (dvnode, vnode, dentry, sdentry, key);switch (ret) {
@@ -148,7 +148,7 @@ int afs_sillyrename(struct afs_vnode *dvd_drop (sdentry); } -iput (&vnode->vfs_inode); +iput (&vnode->netfs.inode);dput (sdentry); out:_leave (" = %d" , ret);
fs/afs/dynroot.c +1 -1
@@ -76,7 +76,7 @@ struct inode *afs_iget_pseudo_dir(struct/* there shouldn't be an existing inode */ BUG_ON (!(inode->i_state &I_NEW )); -netfs_i_context_init (inode,NULL ); +netfs_inode_init (inode,NULL ); inode->i_size =0 ; inode->i_mode =S_IFDIR |S_IRUGO |S_IXUGO ;if (root) {
fs/afs/file.c +2 -2
@@ -194,7 +194,7 @@ int afs_release(struct inode *inode, strafs_put_wb_key (af->wb);if ((file->f_mode &FMODE_WRITE )) { - i_size =i_size_read (&vnode->vfs_inode); + i_size =i_size_read (&vnode->netfs.inode);afs_set_cache_aux (vnode, &aux);fscache_unuse_cookie (afs_vnode_cache (vnode), &aux, &i_size); }else {
@@ -325,7 +325,7 @@ static void afs_issue_read(struct netfs_ fsreq->iter = &fsreq->def_iter;iov_iter_xarray (&fsreq->def_iter,READ , - &fsreq->vnode->vfs_inode.i_mapping->i_pages, + &fsreq->vnode->netfs.inode.i_mapping->i_pages, fsreq->pos, fsreq->len);afs_fetch_data (fsreq->vnode, fsreq);
fs/afs/fs_operation.c +3 -3
@@ -232,14 +232,14 @@ int afs_put_operation(struct afs_operatiif (op->file[1 ].modification && op->file[1 ].vnode != op->file[0 ].vnode)clear_bit (AFS_VNODE_MODIFYING , &op->file[1 ].vnode->flags);if (op->file[0 ].put_vnode) -iput (&op->file[0 ].vnode->vfs_inode); +iput (&op->file[0 ].vnode->netfs.inode);if (op->file[1 ].put_vnode) -iput (&op->file[1 ].vnode->vfs_inode); +iput (&op->file[1 ].vnode->netfs.inode);if (op->more_files) {for (i =0 ; i < op->nr_files -2 ; i++)if (op->more_files[i].put_vnode) -iput (&op->more_files[i].vnode->vfs_inode); +iput (&op->more_files[i].vnode->netfs.inode);kfree (op->more_files); }
fs/afs/inode.c +19 -22
138 lines not on this page · raw message
fs/afs/internal.h +9 -14
@@ -619,12 +619,7 @@ enum afs_lock_state {* leak from one inode to another. */ struct afs_vnode { -struct { -/* These must be contiguous */ -struct inode vfs_inode;/* the VFS's inode record */ -struct netfs_i_context netfs_ctx;/* Netfslib context */ - }; - +struct netfs_inode netfs;/* Netfslib context and vfs inode */ struct afs_volume *volume;/* volume on which vnode resides */ struct afs_fid fid;/* the file identifier for this inode */ struct afs_file_status status;/* AFS status info for this file */
@@ -675,7 +670,7 @@ struct afs_vnode {static inline struct fscache_cookie *afs_vnode_cache (struct afs_vnode *vnode) {#ifdef CONFIG_AFS_FSCACHE -return netfs_i_cookie (&vnode->vfs_inode); +return netfs_i_cookie (&vnode->netfs.inode);#else return NULL ;#endif
@@ -685,7 +680,7 @@ static inline void afs_vnode_set_cache(s struct fscache_cookie *cookie) {#ifdef CONFIG_AFS_FSCACHE - vnode->netfs_ctx.cache = cookie; + vnode->netfs.cache = cookie;#endif }
@@ -892,7 +887,7 @@ static inline void afs_invalidate_cache(afs_set_cache_aux (vnode, &aux);fscache_invalidate (afs_vnode_cache (vnode), &aux, -i_size_read (&vnode->vfs_inode), flags); +i_size_read (&vnode->netfs.inode), flags); }/*
@@ -1217,7 +1212,7 @@ static inline struct afs_net *afs_i2net(static inline struct afs_net *afs_v2net (struct afs_vnode *vnode) { -return afs_i2net (&vnode->vfs_inode); +return afs_i2net (&vnode->netfs.inode); }static inline struct afs_net *afs_sock2net (struct sock *sk)
@@ -1593,12 +1588,12 @@ extern void yfs_fs_store_opaque_acl2(str*/ static inline struct afs_vnode *AFS_FS_I (struct inode *inode) { - return container_of(inode, struct afs_vnode, vfs_inode); + return container_of(inode, struct afs_vnode, netfs.inode); }static inline struct inode *AFS_VNODE_TO_I (struct afs_vnode *vnode) { -return &vnode->vfs_inode; +return &vnode->netfs.inode; }/*
@@ -1621,8 +1616,8 @@ static inline void afs_update_dentry_ver*/ static inline void afs_set_i_size (struct afs_vnode *vnode,u64 size) { -i_size_write (&vnode->vfs_inode, size); - vnode->vfs_inode.i_blocks = ((size +1023 ) >>10 ) <<1 ; +i_size_write (&vnode->netfs.inode, size); + vnode->netfs.inode.i_blocks = ((size +1023 ) >>10 ) <<1 ; }/*
fs/afs/super.c +3 -3
@@ -659,7 +659,7 @@ static void afs_i_init_once(void *_vnodestruct afs_vnode *vnode = _vnode;memset (vnode,0 ,sizeof (*vnode)); -inode_init_once (&vnode->vfs_inode); +inode_init_once (&vnode->netfs.inode);mutex_init (&vnode->io_lock);init_rwsem (&vnode->validate_lock);spin_lock_init (&vnode->wb_lock);
@@ -700,8 +700,8 @@ static struct inode *afs_alloc_inode(strinit_rwsem (&vnode->rmdir_lock);INIT_WORK (&vnode->cb_work, afs_invalidate_mmap_work); -_leave (" = %p" , &vnode->vfs_inode); -return &vnode->vfs_inode; +_leave (" = %p" , &vnode->netfs.inode); +return &vnode->netfs.inode; }static void afs_free_inode (struct inode *inode)
fs/afs/write.c +10 -11
@@ -146,10 +146,10 @@ int afs_write_end(struct file *file, str write_end_pos = pos + copied; - i_size =i_size_read (&vnode->vfs_inode); + i_size =i_size_read (&vnode->netfs.inode);if (write_end_pos > i_size) {write_seqlock (&vnode->cb_lock); - i_size =i_size_read (&vnode->vfs_inode); + i_size =i_size_read (&vnode->netfs.inode);if (write_end_pos > i_size)afs_set_i_size (vnode, write_end_pos);write_sequnlock (&vnode->cb_lock);
@@ -257,7 +257,7 @@ static void afs_redirty_pages(struct wri*/ static void afs_pages_written_back (struct afs_vnode *vnode,loff_t start,unsigned int len) { -struct address_space *mapping = vnode->vfs_inode.i_mapping; +struct address_space *mapping = vnode->netfs.inode.i_mapping;struct folio *folio;pgoff_t end;
@@ -354,7 +354,6 @@ static const struct afs_operation_ops afstatic int afs_store_data (struct afs_vnode *vnode,struct iov_iter *iter,loff_t pos,bool laundering) { -struct netfs_i_context *ictx = &vnode->netfs_ctx;struct afs_operation *op;struct afs_wb_key *wbk =NULL ;loff_t size =iov_iter_count (iter);
@@ -385,9 +384,9 @@ static int afs_store_data(struct afs_vno op->store.write_iter = iter; op->store.pos = pos; op->store.size = size; - op->store.i_size =max (pos + size, ictx->remote_i_size); + op->store.i_size =max (pos + size, vnode->netfs.remote_i_size); op->store.laundering = laundering; - op->mtime = vnode->vfs_inode.i_mtime; + op->mtime = vnode->netfs.inode.i_mtime; op->flags |=AFS_OPERATION_UNINTR ; op->ops = &afs_store_data_operation;
@@ -554,7 +553,7 @@ static ssize_t afs_write_back_from_lockestruct iov_iter iter;unsigned long priv;unsigned int offset, to, len, max_len; -loff_t i_size =i_size_read (&vnode->vfs_inode); +loff_t i_size =i_size_read (&vnode->netfs.inode);bool new_content =test_bit (AFS_VNODE_NEW_CONTENT , &vnode->flags);bool caching =fscache_cookie_enabled (afs_vnode_cache (vnode));long count = wbc->nr_to_write;
@@ -845,7 +844,7 @@ ssize_t afs_file_write(struct kiocb *ioc_enter ("{%llx:%llu},{%zu}," , vnode->fid.vid, vnode->fid.vnode, count); -if (IS_SWAPFILE (&vnode->vfs_inode)) { +if (IS_SWAPFILE (&vnode->netfs.inode)) {printk (KERN_INFO "AFS: Attempt to write to active swap file!\n" );return -EBUSY ;
@@ -958,8 +957,8 @@ void afs_prune_wb_keys(struct afs_vnode/* Discard unused keys */ spin_lock (&vnode->wb_lock); -if (!mapping_tagged (&vnode->vfs_inode.i_data,PAGECACHE_TAG_WRITEBACK ) && - !mapping_tagged (&vnode->vfs_inode.i_data,PAGECACHE_TAG_DIRTY )) { +if (!mapping_tagged (&vnode->netfs.inode.i_data,PAGECACHE_TAG_WRITEBACK ) && + !mapping_tagged (&vnode->netfs.inode.i_data,PAGECACHE_TAG_DIRTY )) {list_for_each_entry_safe (wbk, tmp, &vnode->wb_keys, vnode_link) {if (refcount_read (&wbk->usage) ==1 )list_move (&wbk->vnode_link, &graveyard);
@@ -1034,6 +1033,6 @@ static void afs_write_to_cache(struct af bool caching) {fscache_write_to_cache (afs_vnode_cache (vnode), - vnode->vfs_inode.i_mapping, start, len, i_size, + vnode->netfs.inode.i_mapping, start, len, i_size, afs_write_to_cache_done, vnode, caching); }
fs/ceph/addr.c +2 -2
@@ -1795,7 +1795,7 @@ enum {static int __ceph_pool_perm_get (struct ceph_inode_info *ci,s64 pool,struct ceph_string *pool_ns) { -struct ceph_fs_client *fsc =ceph_inode_to_client (&ci->vfs_inode); +struct ceph_fs_client *fsc =ceph_inode_to_client (&ci->netfs.inode);struct ceph_mds_client *mdsc = fsc->mdsc;struct ceph_osd_request *rd_req =NULL , *wr_req =NULL ;struct rb_node **p, *parent;
@@ -1910,7 +1910,7 @@ static int __ceph_pool_perm_get(struct c 0, false, true); err =ceph_osdc_start_request (&fsc->client->osdc, rd_req, false); - wr_req->r_mtime = ci->vfs_inode.i_mtime; + wr_req->r_mtime = ci->netfs.inode.i_mtime; err2 =ceph_osdc_start_request (&fsc->client->osdc, wr_req, false);if (!err)
fs/ceph/cache.c +2 -2
@@ -29,9 +29,9 @@ void ceph_fscache_register_inode_cookie(if (!(inode->i_state &I_NEW ))return ; -WARN_ON_ONCE (ci->netfs_ctx.cache); +WARN_ON_ONCE (ci->netfs.cache); - ci->netfs_ctx.cache = + ci->netfs.cache = fscache_acquire_cookie(fsc->fscache, 0, &ci->i_vino, sizeof(ci->i_vino), &ci->i_version, sizeof(ci->i_version),
fs/ceph/cache.h +1 -1
@@ -28,7 +28,7 @@ void ceph_fscache_invalidate(struct inodstatic inline struct fscache_cookie *ceph_fscache_cookie (struct ceph_inode_info *ci) { -return netfs_i_cookie (&ci->vfs_inode); +return netfs_i_cookie (&ci->netfs.inode); }static inline void ceph_fscache_resize (struct inode *inode,loff_t to)
fs/ceph/caps.c +52 -52
380 lines not on this page · raw message
fs/ceph/file.c +1 -1
@@ -205,7 +205,7 @@ static int ceph_init_file_info(struct in {struct ceph_inode_info *ci =ceph_inode (inode);struct ceph_mount_options *opt = -ceph_inode_to_client (&ci->vfs_inode)->mount_options; +ceph_inode_to_client (&ci->netfs.inode)->mount_options;struct ceph_file_info *fi;int ret;
fs/ceph/inode.c +5 -8
@@ -20,9 +20,6 @@#include "cache.h" #include <linux/ceph/decode.h> -// Temporary: netfs does disgusting things with inode pointers -#pragma GCC diagnostic ignored "-Wattribute-warning" -/* * Ceph inode operations *
@@ -179,7 +176,7 @@ static struct ceph_inode_frag *__get_or_rb_insert_color (&frag->node, &ci->i_fragtree);dout ("get_or_create_frag added %llx.%llx frag %x\n" , -ceph_vinop (&ci->vfs_inode), f); +ceph_vinop (&ci->netfs.inode), f);return frag; }
@@ -460,10 +457,10 @@ struct inode *ceph_alloc_inode(struct suif (!ci)return NULL ; -dout ("alloc_inode %p\n" , &ci->vfs_inode); +dout ("alloc_inode %p\n" , &ci->netfs.inode);/* Set parameters for the netfs library */ -netfs_i_context_init (&ci->vfs_inode, &ceph_netfs_ops); +netfs_inode_init (&ci->netfs.inode, &ceph_netfs_ops);spin_lock_init (&ci->i_ceph_lock);
@@ -550,7 +547,7 @@ struct inode *ceph_alloc_inode(struct suINIT_WORK (&ci->i_work, ceph_inode_work); ci->i_work_mask =0 ;memset (&ci->i_btime,'\0' ,sizeof (ci->i_btime)); -return &ci->vfs_inode; +return &ci->netfs.inode; }void ceph_free_inode (struct inode *inode)
@@ -1980,7 +1977,7 @@ static void ceph_inode_work(struct work_ { struct ceph_inode_info *ci = container_of(work, struct ceph_inode_info, i_work); -struct inode *inode = &ci->vfs_inode; +struct inode *inode = &ci->netfs.inode;if (test_and_clear_bit (CEPH_I_WORK_WRITEBACK , &ci->i_work_mask)) {dout ("writeback %p\n" , inode);
fs/ceph/mds_client.c +2 -2
@@ -1564,7 +1564,7 @@ int ceph_iterate_session_caps(struct cep p = session->s_caps.next;while (p != &session->s_caps) { cap = list_entry(p, struct ceph_cap, session_caps); - inode =igrab (&cap->ci->vfs_inode); + inode =igrab (&cap->ci->netfs.inode);if (!inode) { p = p->next;continue ;
@@ -1622,7 +1622,7 @@ static int remove_session_caps_cb(structint iputs;dout ("removing cap %p, ci is %p, inode is %p\n" , - cap, ci, &ci->vfs_inode); + cap, ci, &ci->netfs.inode);spin_lock (&ci->i_ceph_lock); iputs =ceph_purge_inode_cap (inode, cap, &invalidate);spin_unlock (&ci->i_ceph_lock);
fs/ceph/snap.c +4 -4
@@ -521,7 +521,7 @@ static bool has_new_snaps(struct ceph_snstatic void ceph_queue_cap_snap (struct ceph_inode_info *ci,struct ceph_cap_snap **pcapsnap) { -struct inode *inode = &ci->vfs_inode; +struct inode *inode = &ci->netfs.inode;struct ceph_snap_context *old_snapc, *new_snapc;struct ceph_cap_snap *capsnap = *pcapsnap;struct ceph_buffer *old_blob =NULL ;
@@ -652,7 +652,7 @@ update_snapc:int __ceph_finish_cap_snap (struct ceph_inode_info *ci,struct ceph_cap_snap *capsnap) { -struct inode *inode = &ci->vfs_inode; +struct inode *inode = &ci->netfs.inode;struct ceph_mds_client *mdsc =ceph_sb_to_mdsc (inode->i_sb);BUG_ON (capsnap->writing);
@@ -712,7 +712,7 @@ static void queue_realm_cap_snaps(structspin_lock (&realm->inodes_with_caps_lock);list_for_each_entry (ci, &realm->inodes_with_caps, i_snap_realm_item) { -struct inode *inode =igrab (&ci->vfs_inode); +struct inode *inode =igrab (&ci->netfs.inode);if (!inode)continue ;spin_unlock (&realm->inodes_with_caps_lock);
@@ -904,7 +904,7 @@ static void flush_snaps(struct ceph_mds_while (!list_empty (&mdsc->snap_flush_list)) { ci =list_first_entry (&mdsc->snap_flush_list, struct ceph_inode_info, i_snap_flush_item); - inode = &ci->vfs_inode; + inode = &ci->netfs.inode;ihold (inode);spin_unlock (&mdsc->snap_flush_lock);ceph_flush_snaps (ci, &session);
fs/ceph/super.c +1 -1
@@ -876,7 +876,7 @@ mempool_t *ceph_wb_pagevec_pool;static void ceph_inode_init_once (void *foo) {struct ceph_inode_info *ci = foo; -inode_init_once (&ci->vfs_inode); +inode_init_once (&ci->netfs.inode); }static int __init init_caches (void )
fs/ceph/super.h +3 -7
@@ -316,11 +316,7 @@ struct ceph_inode_xattrs_info {* Ceph inode. */ struct ceph_inode_info { -struct { -/* These must be contiguous */ -struct inode vfs_inode; -struct netfs_i_context netfs_ctx;/* Netfslib context */ - }; +struct netfs_inode netfs;/* Netfslib context and vfs inode */ struct ceph_vino i_vino;/* ceph ino + snap */ spinlock_t i_ceph_lock;
@@ -436,7 +432,7 @@ struct ceph_inode_info {static inline struct ceph_inode_info *ceph_inode (const struct inode *inode) { - return container_of(inode, struct ceph_inode_info, vfs_inode); + return container_of(inode, struct ceph_inode_info, netfs.inode); } static inline struct ceph_fs_client *
@@ -1295,7 +1291,7 @@ static inline void __ceph_update_quota(s has_quota =__ceph_has_any_quota (ci);if (had_quota != has_quota) -ceph_adjust_quota_realms_count (&ci->vfs_inode, has_quota); +ceph_adjust_quota_realms_count (&ci->netfs.inode, has_quota); } extern void ceph_handle_quota(struct ceph_mds_client *mdsc,
fs/ceph/xattr.c +7 -7
@@ -57,7 +57,7 @@ static bool ceph_vxattrcb_layout_exists(static ssize_t ceph_vxattrcb_layout (struct ceph_inode_info *ci,char *val,size_t size) { -struct ceph_fs_client *fsc =ceph_sb_to_client (ci->vfs_inode.i_sb); +struct ceph_fs_client *fsc =ceph_sb_to_client (ci->netfs.inode.i_sb);struct ceph_osd_client *osdc = &fsc->client->osdc;struct ceph_string *pool_ns;s64 pool = ci->i_layout.pool_id;
@@ -69,7 +69,7 @@ static ssize_t ceph_vxattrcb_layout(stru pool_ns =ceph_try_get_string (ci->i_layout.pool_ns); -dout ("ceph_vxattrcb_layout %p\n" , &ci->vfs_inode); +dout ("ceph_vxattrcb_layout %p\n" , &ci->netfs.inode);down_read (&osdc->lock); pool_name =ceph_pg_pool_name_by_id (osdc->osdmap, pool);if (pool_name) {
@@ -161,7 +161,7 @@ static ssize_t ceph_vxattrcb_layout_pool char *val, size_t size) { ssize_t ret; -struct ceph_fs_client *fsc =ceph_sb_to_client (ci->vfs_inode.i_sb); +struct ceph_fs_client *fsc =ceph_sb_to_client (ci->netfs.inode.i_sb);struct ceph_osd_client *osdc = &fsc->client->osdc;s64 pool = ci->i_layout.pool_id;const char *pool_name;
@@ -313,7 +313,7 @@ static ssize_t ceph_vxattrcb_snap_btime(static ssize_t ceph_vxattrcb_cluster_fsid (struct ceph_inode_info *ci,char *val,size_t size) { -struct ceph_fs_client *fsc =ceph_sb_to_client (ci->vfs_inode.i_sb); +struct ceph_fs_client *fsc =ceph_sb_to_client (ci->netfs.inode.i_sb);return ceph_fmt_xattr (val, size,"%pU" , &fsc->client->fsid); }
@@ -321,7 +321,7 @@ static ssize_t ceph_vxattrcb_cluster_fsistatic ssize_t ceph_vxattrcb_client_id (struct ceph_inode_info *ci,char *val,size_t size) { -struct ceph_fs_client *fsc =ceph_sb_to_client (ci->vfs_inode.i_sb); +struct ceph_fs_client *fsc =ceph_sb_to_client (ci->netfs.inode.i_sb);return ceph_fmt_xattr (val, size,"client%lld" ,ceph_client_gid (fsc->client));
@@ -629,7 +629,7 @@ static int __set_xattr(struct ceph_inode }dout ("__set_xattr_val added %llx.%llx xattr %p %.*s=%.*s\n" , -ceph_vinop (&ci->vfs_inode), xattr, name_len, name, val_len, val); +ceph_vinop (&ci->netfs.inode), xattr, name_len, name, val_len, val);return 0 ; }
@@ -871,7 +871,7 @@ struct ceph_buffer *__ceph_build_xattrs_struct ceph_buffer *old_blob =NULL ;void *dest; -dout ("__build_xattrs_blob %p\n" , &ci->vfs_inode); +dout ("__build_xattrs_blob %p\n" , &ci->netfs.inode);if (ci->i_xattrs.dirty) {int need =__get_required_blob_size (ci,0 ,0 );
fs/cifs/cifsfs.c +4 -4
@@ -377,7 +377,7 @@ cifs_alloc_inode(struct super_block *sb) cifs_inode->flags =0 ;spin_lock_init (&cifs_inode->writers_lock); cifs_inode->writers =0 ; - cifs_inode->vfs_inode.i_blkbits =14 ;/* 2**14 = CIFS_MAX_MSGSIZE */ + cifs_inode->netfs.inode.i_blkbits =14 ;/* 2**14 = CIFS_MAX_MSGSIZE */ cifs_inode->server_eof =0 ; cifs_inode->uniqueid =0 ; cifs_inode->createtime =0 ;
@@ -389,12 +389,12 @@ cifs_alloc_inode(struct super_block *sb)* Can not set i_flags here - they get immediately overwritten to zero * by the VFS. */ -/* cifs_inode->vfs_inode.i_flags = S_NOATIME | S_NOCMTIME; */ +/* cifs_inode->netfs.inode.i_flags = S_NOATIME | S_NOCMTIME; */ INIT_LIST_HEAD (&cifs_inode->openFileList);INIT_LIST_HEAD (&cifs_inode->llist);INIT_LIST_HEAD (&cifs_inode->deferred_closes);spin_lock_init (&cifs_inode->deferred_lock); -return &cifs_inode->vfs_inode; +return &cifs_inode->netfs.inode; } static void
@@ -1416,7 +1416,7 @@ cifs_init_once(void *inode) {struct cifsInodeInfo *cifsi = inode; -inode_init_once (&cifsi->vfs_inode); +inode_init_once (&cifsi->netfs.inode);init_rwsem (&cifsi->lock_sem); }
fs/cifs/cifsglob.h +4 -8
@@ -1414,20 +1414,16 @@ void cifsFileInfo_put(struct cifsFileInf#define CIFS_CACHE_RW_FLG (CIFS_CACHE_READ_FLG | CIFS_CACHE_WRITE_FLG)#define CIFS_CACHE_RHW_FLG (CIFS_CACHE_RW_FLG | CIFS_CACHE_HANDLE_FLG) -#define CIFS_CACHE_READ (cinode) ((cinode->oplock & CIFS_CACHE_READ_FLG) || (CIFS_SB(cinode->vfs_inode.i_sb)->mnt_cifs_flags & CIFS_MOUNT_RO_CACHE)) +#define CIFS_CACHE_READ (cinode) ((cinode->oplock & CIFS_CACHE_READ_FLG) || (CIFS_SB(cinode->netfs.inode.i_sb)->mnt_cifs_flags & CIFS_MOUNT_RO_CACHE))#define CIFS_CACHE_HANDLE (cinode) (cinode->oplock & CIFS_CACHE_HANDLE_FLG) -#define CIFS_CACHE_WRITE (cinode) ((cinode->oplock & CIFS_CACHE_WRITE_FLG) || (CIFS_SB(cinode->vfs_inode.i_sb)->mnt_cifs_flags & CIFS_MOUNT_RW_CACHE)) +#define CIFS_CACHE_WRITE (cinode) ((cinode->oplock & CIFS_CACHE_WRITE_FLG) || (CIFS_SB(cinode->netfs.inode.i_sb)->mnt_cifs_flags & CIFS_MOUNT_RW_CACHE))/* * One of these for each file inode */ struct cifsInodeInfo { -struct { -/* These must be contiguous */ -struct inode vfs_inode;/* the VFS's inode record */ -struct netfs_i_context netfs_ctx;/* Netfslib context */ - }; +struct netfs_inode netfs;/* Netfslib context and vfs inode */ bool can_cache_brlcks;struct list_head llist;/* locks helb by this inode */ /*
@@ -1466,7 +1462,7 @@ struct cifsInodeInfo {static inline struct cifsInodeInfo *CIFS_I (struct inode *inode) { - return container_of(inode, struct cifsInodeInfo, vfs_inode); + return container_of(inode, struct cifsInodeInfo, netfs.inode); } static inline struct cifs_sb_info *
fs/cifs/file.c +4 -4
@@ -2004,7 +2004,7 @@ struct cifsFileInfo *find_readable_file( bool fsuid_only) {struct cifsFileInfo *open_file =NULL ; -struct cifs_sb_info *cifs_sb =CIFS_SB (cifs_inode->vfs_inode.i_sb); +struct cifs_sb_info *cifs_sb =CIFS_SB (cifs_inode->netfs.inode.i_sb);/* only filter by fsuid on multiuser mounts */ if (!(cifs_sb->mnt_cifs_flags &CIFS_MOUNT_MULTIUSER ))
@@ -2060,7 +2060,7 @@ cifs_get_writable_file(struct cifsInodeIreturn rc; } - cifs_sb =CIFS_SB (cifs_inode->vfs_inode.i_sb); + cifs_sb =CIFS_SB (cifs_inode->netfs.inode.i_sb);/* only filter by fsuid on multiuser mounts */ if (!(cifs_sb->mnt_cifs_flags &CIFS_MOUNT_MULTIUSER ))
@@ -4665,14 +4665,14 @@ bool is_size_safe_to_change(struct cifsI/* This inode is open for write at least once */ struct cifs_sb_info *cifs_sb; - cifs_sb =CIFS_SB (cifsInode->vfs_inode.i_sb); + cifs_sb =CIFS_SB (cifsInode->netfs.inode.i_sb);if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_DIRECT_IO ) {/* since no page cache to corrupt on directio we can change size safely */ return true; } -if (i_size_read (&cifsInode->vfs_inode) < end_of_file) +if (i_size_read (&cifsInode->netfs.inode) < end_of_file)return true;return false;
fs/cifs/fscache.c +4 -4
@@ -101,13 +101,13 @@ void cifs_fscache_get_inode_cookie(strucstruct cifs_sb_info *cifs_sb =CIFS_SB (inode->i_sb);struct cifs_tcon *tcon =cifs_sb_master_tcon (cifs_sb); -cifs_fscache_fill_coherency (&cifsi->vfs_inode, &cd); +cifs_fscache_fill_coherency (&cifsi->netfs.inode, &cd); - cifsi->netfs_ctx.cache = + cifsi->netfs.cache =fscache_acquire_cookie (tcon->fscache,0 , &cifsi->uniqueid,sizeof (cifsi->uniqueid), &cd,sizeof (cd), -i_size_read (&cifsi->vfs_inode)); +i_size_read (&cifsi->netfs.inode)); }void cifs_fscache_unuse_inode_cookie (struct inode *inode,bool update)
@@ -131,7 +131,7 @@ void cifs_fscache_release_inode_cookie(sif (cookie) {cifs_dbg (FYI ,"%s: (0x%p)\n" , __func__, cookie);fscache_relinquish_cookie (cookie, false); - cifsi->netfs_ctx.cache =NULL ; + cifsi->netfs.cache =NULL ; } }
fs/cifs/fscache.h +4 -4
@@ -52,10 +52,10 @@ void cifs_fscache_fill_coherency(structstruct cifsInodeInfo *cifsi =CIFS_I (inode);memset (cd,0 ,sizeof (*cd)); - cd->last_write_time_sec =cpu_to_le64 (cifsi->vfs_inode.i_mtime.tv_sec); - cd->last_write_time_nsec =cpu_to_le32 (cifsi->vfs_inode.i_mtime.tv_nsec); - cd->last_change_time_sec =cpu_to_le64 (cifsi->vfs_inode.i_ctime.tv_sec); - cd->last_change_time_nsec =cpu_to_le32 (cifsi->vfs_inode.i_ctime.tv_nsec); + cd->last_write_time_sec =cpu_to_le64 (cifsi->netfs.inode.i_mtime.tv_sec); + cd->last_write_time_nsec =cpu_to_le32 (cifsi->netfs.inode.i_mtime.tv_nsec); + cd->last_change_time_sec =cpu_to_le64 (cifsi->netfs.inode.i_ctime.tv_sec); + cd->last_change_time_nsec =cpu_to_le32 (cifsi->netfs.inode.i_ctime.tv_nsec); }
fs/cifs/inode.c +2 -2
@@ -115,7 +115,7 @@ cifs_revalidate_cache(struct inode *inod __func__, cifs_i->uniqueid);set_bit (CIFS_INO_INVALID_MAPPING , &cifs_i->flags);/* Invalidate fscache cookie */ -cifs_fscache_fill_coherency (&cifs_i->vfs_inode, &cd); +cifs_fscache_fill_coherency (&cifs_i->netfs.inode, &cd);fscache_invalidate (cifs_inode_cookie (inode), &cd,i_size_read (inode),0 ); }
@@ -2499,7 +2499,7 @@ int cifs_fiemap(struct inode *inode, str u64 len) {struct cifsInodeInfo *cifs_i =CIFS_I (inode); -struct cifs_sb_info *cifs_sb =CIFS_SB (cifs_i->vfs_inode.i_sb); +struct cifs_sb_info *cifs_sb =CIFS_SB (cifs_i->netfs.inode.i_sb);struct cifs_tcon *tcon =cifs_sb_master_tcon (cifs_sb);struct TCP_Server_Info *server = tcon->ses->server;struct cifsFileInfo *cfile;
fs/cifs/misc.c +2 -2
@@ -535,11 +535,11 @@ void cifs_set_oplock_level(struct cifsInif (oplock ==OPLOCK_EXCLUSIVE ) { cinode->oplock =CIFS_CACHE_WRITE_FLG |CIFS_CACHE_READ_FLG ;cifs_dbg (FYI ,"Exclusive Oplock granted on inode %p\n" , - &cinode->vfs_inode); + &cinode->netfs.inode); }else if (oplock ==OPLOCK_READ ) { cinode->oplock =CIFS_CACHE_READ_FLG ;cifs_dbg (FYI ,"Level II Oplock granted on inode %p\n" , - &cinode->vfs_inode); + &cinode->netfs.inode); }else cinode->oplock =0 ; }
fs/cifs/smb2ops.c +4 -4
@@ -4241,15 +4241,15 @@ smb2_set_oplock_level(struct cifsInodeInif (oplock ==SMB2_OPLOCK_LEVEL_BATCH ) { cinode->oplock =CIFS_CACHE_RHW_FLG ;cifs_dbg (FYI ,"Batch Oplock granted on inode %p\n" , - &cinode->vfs_inode); + &cinode->netfs.inode); }else if (oplock ==SMB2_OPLOCK_LEVEL_EXCLUSIVE ) { cinode->oplock =CIFS_CACHE_RW_FLG ;cifs_dbg (FYI ,"Exclusive Oplock granted on inode %p\n" , - &cinode->vfs_inode); + &cinode->netfs.inode); }else if (oplock ==SMB2_OPLOCK_LEVEL_II ) { cinode->oplock =CIFS_CACHE_READ_FLG ;cifs_dbg (FYI ,"Level II Oplock granted on inode %p\n" , - &cinode->vfs_inode); + &cinode->netfs.inode); }else cinode->oplock =0 ; }
@@ -4288,7 +4288,7 @@ smb21_set_oplock_level(struct cifsInodeI cinode->oplock = new_oplock;cifs_dbg (FYI ,"%s Lease granted on inode %p\n" , message, - &cinode->vfs_inode); + &cinode->netfs.inode); } static void
fs/netfs/buffered_read.c +3 -3
@@ -155,7 +155,7 @@ static void netfs_rreq_expand(struct netvoid netfs_readahead (struct readahead_control *ractl) {struct netfs_io_request *rreq; -struct netfs_i_context *ctx =netfs_i_context (ractl->mapping->host); +struct netfs_inode *ctx =netfs_inode (ractl->mapping->host);int ret;_enter ("%lx,%x" ,readahead_index (ractl),readahead_count (ractl));
@@ -216,7 +216,7 @@ int netfs_readpage(struct file *file, ststruct folio *folio =page_folio (subpage);struct address_space *mapping =folio_file_mapping (folio);struct netfs_io_request *rreq; -struct netfs_i_context *ctx =netfs_i_context (mapping->host); +struct netfs_inode *ctx =netfs_inode (mapping->host);int ret;_enter ("%lx" ,folio_index (folio));
@@ -333,7 +333,7 @@ int netfs_write_begin(struct file *file, struct folio **_folio, void **_fsdata) { struct netfs_io_request *rreq; -struct netfs_i_context *ctx =netfs_i_context (file_inode (file )); +struct netfs_inode *ctx =netfs_inode (file_inode (file ));struct folio *folio;unsigned int fgp_flags;pgoff_t index = pos >>PAGE_SHIFT ;
fs/netfs/internal.h +1 -1
@@ -91,7 +91,7 @@ static inline void netfs_stat_d(atomic_t/* * Miscellaneous functions. */ -static inline bool netfs_is_cache_enabled (struct netfs_i_context *ctx) +static inline bool netfs_is_cache_enabled (struct netfs_inode *ctx) {#if IS_ENABLED (CONFIG_FSCACHE )struct fscache_cookie *cookie = ctx->cache;
fs/netfs/objects.c +1 -1
@@ -18,7 +18,7 @@ struct netfs_io_request *netfs_alloc_req {static atomic_t debug_ids;struct inode *inode = file ?file_inode (file) : mapping->host; -struct netfs_i_context *ctx =netfs_i_context (inode); +struct netfs_inode *ctx =netfs_inode (inode);struct netfs_io_request *rreq;int ret;
include/linux/netfs.h +16 -25
91 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 135/141 drm/i915/uc: remove accidental static from a local variable
In reply to Greg Kroah-HartmanFrom: Jani Nikula <[email protected]>
commit 2636e008112465ca54559ac4898da5a2515e118a upstream.
The arrays are static const, but the pointer shouldn't be static.
--- drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +1 -1
@@ -154,7 +154,7 @@ __uc_fw_auto_select(struct drm_i915_priv [INTEL_UC_FW_TYPE_GUC] = { blobs_guc, ARRAY_SIZE(blobs_guc) }, [INTEL_UC_FW_TYPE_HUC] = { blobs_huc, ARRAY_SIZE(blobs_huc) }, }; -static const struct uc_fw_platform_requirement *fw_blobs; +const struct uc_fw_platform_requirement *fw_blobs;enum intel_platform p =INTEL_INFO (i915)->platform;u32 fw_count;u8 rev =INTEL_REVID (i915);
Greg Kroah-Hartman
maintainerPATCH 136/141 bpf: Use safer kvmalloc_array() where possible
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit fd58f7df2415ef747782e01f94880fefad1247cf upstream.
The kvmalloc_array() function is safer because it has a check for integer overflows. These sizes come from the user and I was not able to see any bounds checking so an integer overflow seems like a realistic concern.
--- kernel/trace/bpf_trace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/bpf_trace.c +2 -2
@@ -2433,7 +2433,7 @@ int bpf_kprobe_multi_link_attach(const ureturn -EINVAL ; size = cnt *sizeof (*addrs); - addrs =kvmalloc (size,GFP_KERNEL ); + addrs =kvmalloc_array (cnt,sizeof (*addrs),GFP_KERNEL );if (!addrs)return -ENOMEM ;
@@ -2450,7 +2450,7 @@ int bpf_kprobe_multi_link_attach(const u ucookies =u64_to_user_ptr (attr->link_create.kprobe_multi.cookies);if (ucookies) { - cookies =kvmalloc (size,GFP_KERNEL ); + cookies =kvmalloc_array (cnt,sizeof (*addrs),GFP_KERNEL );if (!cookies) { err = -ENOMEM ; goto error;
Greg Kroah-Hartman
maintainerPATCH 137/141 powerpc/book3e: get rid of #include <generated/compile.h>
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit 7ad4bd887d27c6b6ffbef216f19c19f8fe2b8f52 upstream.
You cannot include <generated/compile.h> here because it is generated in init/Makefile but there is no guarantee that it happens before arch/powerpc/mm/nohash/kaslr_booke.c is compiled for parallel builds.
The places where you can reliably include <generated/compile.h> are:
- init/ (because init/Makefile can specify the dependency)
- arch/*/boot/ (because it is compiled after vmlinux)
Commit f231e4333312 ("hexagon: get rid of #include <generated/compile.h>") fixed the last breakage at that time, but powerpc re-added this.
<generated/compile.h> was unneeded because 'build_str' is almost the same as 'linux_banner' defined in init/version.c
Let's copy the solution from MIPS. (get_random_boot() in arch/mips/kernel/relocate.c)
--- arch/powerpc/mm/nohash/kaslr_booke.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
arch/powerpc/mm/nohash/kaslr_booke.c +2 -6
@@ -18,7 +18,6 @@#include <asm/prom.h> #include <asm/kdump.h> #include <mm/mmu_decl.h> -#include <generated/compile.h> #include <generated/utsrelease.h> struct regions {
@@ -36,10 +35,6 @@ struct regions {int reserved_mem_size_cells; }; -/* Simplified build-specific string for starting entropy. */ -static const char build_str[] =UTS_RELEASE " (" LINUX_COMPILE_BY "@" -LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION ; -struct regions __initdata regions;static __init void kaslr_get_cmdline (void *fdt)
@@ -70,7 +65,8 @@ static unsigned long __init get_boot_see {unsigned long hash =0 ; - hash =rotate_xor (hash, build_str,sizeof (build_str)); +/* build-specific string for starting entropy. */ + hash =rotate_xor (hash, linux_banner,strlen (linux_banner)); hash =rotate_xor (hash, fdt,fdt_totalsize (fdt));return hash;