5.10.138-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainercover 5.10.138-rc1 review
This is the start of the stable review cycle for the 5.10.138 release. There are 158 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 25 Aug 2022 08:00:15 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.138-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.10.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.10.138-rc1
Tadeusz Struk <[email protected]>
bpf: Fix KASAN use-after-free Read in compute_effective_progs
Matthew Wilcox (Oracle) <[email protected]>
qrtr: Convert qrtr_ports from IDR to XArray
Keith Busch <[email protected]>
PCI/ERR: Retain status from error notification
Fedor Pchelkin <[email protected]>
can: j1939: j1939_session_destroy(): fix memory leak of skbs
Fedor Pchelkin <[email protected]>
can: j1939: j1939_sk_queue_activate_next_locked(): replace WARN_ON_ONCE with netdev_warn_once()
Steven Rostedt (Google) <[email protected]>
tracing/probes: Have kprobes and uprobes use $COMM too
Dongliang Mu <[email protected]>
netfilter: nf_tables: fix audit memory leak in nf_tables_commit
Dan Carpenter <[email protected]>
netfilter: nftables: fix a warning message in nf_tables_commit_audit_collect()
Nathan Chancellor <[email protected]>
MIPS: tlbex: Explicitly compare _PAGE_NO_EXEC against 0
Zheyu Ma <[email protected]>
video: fbdev: i740fb: Check the argument of i740_calc_vclk()
Zhouyi Zhou <[email protected]>
powerpc/64: Init jump labels before parse_early_param()
Steve French <[email protected]>
smb3: check xattr value length earlier
Chao Yu <[email protected]>
f2fs: fix to do sanity check on segment type in build_sit_entries()
Chao Yu <[email protected]>
f2fs: fix to avoid use f2fs_bug_on() in f2fs_new_node_page()
Takashi Iwai <[email protected]>
ALSA: control: Use deferred fasync helper
Takashi Iwai <[email protected]>
ALSA: timer: Use deferred fasync helper
Takashi Iwai <[email protected]>
ALSA: core: Add async signal helpers
Christophe Leroy <[email protected]>
powerpc/32: Don't always pass -mcpu=powerpc to the compiler
Laurent Dufour <[email protected]>
watchdog: export lockup_detector_reconfigure
Xianting Tian <[email protected]>
RISC-V: Add fast call path of crash_kexec()
Celeste Liu <[email protected]>
riscv: mmap with PROT_WRITE but no PROT_READ is invalid
Conor Dooley <[email protected]>
riscv: dts: sifive: Add fu540 topology information
Helge Deller <[email protected]>
modules: Ensure natural alignment for .altinstructions and __bug_table sections
Liang He <[email protected]>
mips: cavium-octeon: Fix missing of_node_put() in octeon2_usb_clocks_start
Schspa Shi <[email protected]>
vfio: Clear the caps->buf to NULL after free
Liang He <[email protected]>
tty: serial: Fix refcount leak bug in ucc_uart.c
Guenter Roeck <[email protected]>
lib/list_debug.c: Detect uninitialized lists
Kiselev, Oleg <[email protected]>
ext4: avoid resizing to a partial cluster size
Ye Bin <[email protected]>
ext4: avoid remove directory when directory is corrupted
Wentao_Liang <[email protected]>
drivers:md:fix a potential use-after-free bug
Sagi Grimberg <[email protected]>
nvmet-tcp: fix lockdep complaint on nvmet_tcp_wq flush during queue teardown
Logan Gunthorpe <[email protected]>
md: Notify sysfs sync_completed in md_reap_sync_thread()
Uwe Kleine-König <[email protected]>
dmaengine: sprd: Cleanup in .remove() after pm_runtime_get_sync() failed
Steven Rostedt (Google) <[email protected]>
selftests/kprobe: Do not test for GRP/ without event failures
Liao Chang <[email protected]>
csky/kprobe: reclaim insn_slot on kprobe unregistration
Bob Pearson <[email protected]>
RDMA/rxe: Limit the number of calls to each tasklet
Jason A. Donenfeld <[email protected]>
um: add "noreboot" command line option for PANIC_TIMEOUT=-1 setups
Huacai Chen <[email protected]>
PCI/ACPI: Guard ARM64-specific mcfg_quirks
Christophe JAILLET <[email protected]>
cxl: Fix a memory leak in an error handling path
Andy Shevchenko <[email protected]>
pinctrl: intel: Check against matching data instead of ACPI companion
Jozef Martiniak <[email protected]>
gadgetfs: ep_io - wait until IRQ finishes
James Smart <[email protected]>
scsi: lpfc: Prevent buffer overflow crashes in debugfs with malformed user input
Vladimir Zapolskiy <[email protected]>
clk: qcom: clk-alpha-pll: fix clk_trion_pll_configure description
Sergey Senozhatsky <[email protected]>
zram: do not lookup algorithm in backends table
Jean-Philippe Brucker <[email protected]>
uacce: Handle parent device removal or parent driver module rmmod
Robert Marko <[email protected]>
clk: qcom: ipq8074: dont disable gcc_sleep_clk_src
Pascal Terjan <[email protected]>
vboxguest: Do not use devm for irq
Amelie Delaunay <[email protected]>
usb: dwc2: gadget: remove D+ pull-up while no vbus with usb-role-switch
Liang He <[email protected]>
usb: renesas: Fix refcount leak bug
Liang He <[email protected]>
usb: host: ohci-ppc-of: Fix refcount leak bug
Tony Lindgren <[email protected]>
clk: ti: Stop using legacy clkctrl names for omap4 and 5
Sai Prakash Ranjan <[email protected]>
drm/meson: Fix overflow implicit truncation warnings
Sai Prakash Ranjan <[email protected]>
irqchip/tegra: Fix overflow implicit truncation warnings
Michael Grzeschik <[email protected]>
usb: gadget: uvc: call uvc uvcg_warn on completed status instead of uvcg_info
Frank Li <[email protected]>
usb: cdns3 fix use-after-free at workaround 2
Tzung-Bi Shih <[email protected]>
platform/chrome: cros_ec_proto: don't show MKBP version if unsupported
Pavan Chebbi <[email protected]>
PCI: Add ACS quirk for Broadcom BCM5750x NICs
Samuel Holland <[email protected]>
drm/sun4i: dsi: Prevent underflow when computing packet sizes
Pablo Neira Ayuso <[email protected]>
netfilter: add helper function to set up the nfnetlink header and use it
Pablo Neira Ayuso <[email protected]>
netfilter: nftables: add helper function to set the base sequence number
Richard Guy Briggs <[email protected]>
audit: log nftables configuration change events once per table
Liang He <[email protected]>
drm/meson: Fix refcount bugs in meson_vpu_has_available_connectors()
Bard Liao <[email protected]>
ASoC: SOF: intel: move sof_intel_dsp_desc() forward
Hector Martin <[email protected]>
locking/atomic: Make test_and_*_bit() ordered on failure
Andrew Donnellan <[email protected]>
gcc-plugins: Undefine LATENT_ENTROPY_PLUGIN when plugin disabled for a file
Masahiro Yamada <[email protected]>
kbuild: fix the modules order between drivers and libs
Lin Ma <[email protected]>
igb: Add lock to avoid data race
Christophe JAILLET <[email protected]>
stmmac: intel: Add a missing clk_disable_unprepare() call in intel_eth_pci_remove()
Csókás Bence <[email protected]>
fec: Fix timer capture timing in fec_ptp_enable_pps()
Alan Brady <[email protected]>
i40e: Fix to stop tx_timeout recovery if GLOBR fails
Frieder Schrempf <[email protected]>
regulator: pca9450: Remove restrictions for regulator-name
Uwe Kleine-König <[email protected]>
i2c: imx: Make sure to unregister adapter on remove()
Grzegorz Siwik <[email protected]>
ice: Ignore EEXIST when setting promisc mode
Rustam Subkhankulov <[email protected]>
net: dsa: sja1105: fix buffer overflow in sja1105_setup_devlink_regions()
Jakub Kicinski <[email protected]>
net: genl: fix error path memory leak in policy dumping
Vladimir Oltean <[email protected]>
net: dsa: felix: fix ethtool 256-511 and 512-1023 TX packet counters
Arun Ramadoss <[email protected]>
net: dsa: microchip: ksz9477: fix fdb_dump last invalid entry
Sergei Antonov <[email protected]>
net: moxa: pass pdev instead of ndev to DMA functions
Sergei Antonov <[email protected]>
net: dsa: mv88e6060: prevent crash on an unused port
Neil Armstrong <[email protected]>
spi: meson-spicc: add local pow2 clock ops to preserve rate between messages
Michael Ellerman <[email protected]>
powerpc/pci: Fix get_phb_number() locking
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: check NFT_SET_CONCAT flag if field_count is specified
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: validate NFTA_SET_ELEM_OBJREF based on NFT_SET_OBJECT flag
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: really skip inactive sets when allocating name
Martin Povišer <[email protected]>
ASoC: tas2770: Fix handling of mute/unmute
Martin Povišer <[email protected]>
ASoC: tas2770: Drop conflicting set_bias_level power setting
Martin Povišer <[email protected]>
ASoC: tas2770: Allow mono streams
Martin Povišer <[email protected]>
ASoC: tas2770: Set correct FSYNC polarity
Przemyslaw Patynowski <[email protected]>
iavf: Fix adminq error handling
Al Viro <[email protected]>
nios2: add force_successful_syscall_return()
Al Viro <[email protected]>
nios2: restarts apply only to the first sigframe we build...
Al Viro <[email protected]>
nios2: fix syscall restart checks
Al Viro <[email protected]>
nios2: traced syscall does need to check the syscall number
Al Viro <[email protected]>
nios2: don't leave NULLs in sys_call_table[]
Al Viro <[email protected]>
nios2: page fault et.al. are *not* restartable syscalls...
Chen Lin <[email protected]>
dpaa2-eth: trace the allocated address instead of page struct
Christophe JAILLET <[email protected]>
perf probe: Fix an error handling path in 'parse_perf_probe_command()'
Matthias May <[email protected]>
geneve: fix TOS inheriting for ipv4
Duoming Zhou <[email protected]>
atm: idt77252: fix use-after-free bugs caused by tst_timer
Dan Carpenter <[email protected]>
xen/xenbus: fix return type in xenbus_file_read()
Yu Xiao <[email protected]>
nfp: ethtool: fix the display error of ethtool -m DEVNAME
Dan Carpenter <[email protected]>
NTB: ntb_tool: uninitialized heap data in tool_fn_write()
Roberto Sassu <[email protected]>
tools build: Switch to new openssl API for test-libcrypto
Ondrej Mosnacek <[email protected]>
kbuild: dummy-tools: avoid tmpdir leak in dummy gcc
Jeff Layton <[email protected]>
ceph: don't leak snap_rwsem in handle_cap_grant
Yuanzheng Song <[email protected]>
tools/vm/slabinfo: use alphabetic order when two values are equal
Luís Henriques <[email protected]>
ceph: use correct index when encoding client supported features
Dmitry Baryshkov <[email protected]>
dt-bindings: clock: qcom,gcc-msm8996: add more GCC clock sources
Krzysztof Kozlowski <[email protected]>
dt-bindings: arm: qcom: fix MSM8916 MTP compatibles
Peilin Ye <[email protected]>
vsock: Set socket state back to SS_UNCONNECTED in vsock_connect_timeout()
Peilin Ye <[email protected]>
vsock: Fix memory leak in vsock_connect()
Florian Westphal <[email protected]>
plip: avoid rcu debug splat
Matthias May <[email protected]>
ipv6: do not use RT_TOS for IPv6 flowlabel
Matthias May <[email protected]>
geneve: do not use RT_TOS for IPv6 flowlabel
Sakari Ailus <[email protected]>
ACPI: property: Return type of acpi_add_nondev_subnodes() should be bool
Peter Zijlstra <[email protected]>
um: Add missing apply_returns()
Jianhua Lu <[email protected]>
pinctrl: qcom: sm8250: Fix PDC map
Samuel Holland <[email protected]>
pinctrl: sunxi: Add I/O bias setting for H6 R-PIO
Nikita Travkin <[email protected]>
pinctrl: qcom: msm8916: Allow CAMSS GP clocks to be muxed
Miaoqian Lin <[email protected]>
pinctrl: nomadik: Fix refcount leak in nmk_pinctrl_dt_subnode_to_map
Sandor Bodo-Merle <[email protected]>
net: bgmac: Fix a BUG triggered by wrong bytes_compl
Ido Schimmel <[email protected]>
devlink: Fix use-after-free after a failed reload
Xuan Zhuo <[email protected]>
virtio_net: fix memory leak inside XPD_TX with mergeable
Trond Myklebust <[email protected]>
SUNRPC: Reinitialise the backchannel request buffers before reuse
Dan Aloni <[email protected]>
sunrpc: fix expiry of auth creds
Chia-Lin Kao (AceLan) <[email protected]>
net: atlantic: fix aq_vec index out of range error
Sebastian Würl <[email protected]>
can: mcp251x: Fix race condition on receive interrupt
Hou Tao <[email protected]>
bpf: Check the validity of max_rdwr_access for sock local storage map iterator
Hou Tao <[email protected]>
bpf: Acquire map uref in .init_seq_private for sock{map,hash} iterator
Hou Tao <[email protected]>
bpf: Acquire map uref in .init_seq_private for sock local storage map iterator
Hou Tao <[email protected]>
bpf: Acquire map uref in .init_seq_private for hash map iterator
Hou Tao <[email protected]>
bpf: Acquire map uref in .init_seq_private for array map iterator
Trond Myklebust <[email protected]>
NFSv4/pnfs: Fix a use-after-free bug in open
Zhang Xianwei <[email protected]>
NFSv4.1: RECLAIM_COMPLETE must handle EACCES
Trond Myklebust <[email protected]>
NFSv4: Fix races in the legacy idmapper upcall
Trond Myklebust <[email protected]>
NFSv4.1: Handle NFS4ERR_DELAY replies to OP_SEQUENCE correctly
Trond Myklebust <[email protected]>
NFSv4.1: Don't decrease the value of seq_nr_highest_sent
Qifu Zhang <[email protected]>
Documentation: ACPI: EINJ: Fix obsolete example
Xiu Jianfeng <[email protected]>
apparmor: Fix memleak in aa_simple_write_to_buffer()
Xin Xiong <[email protected]>
apparmor: fix reference count leak in aa_pivotroot()
John Johansen <[email protected]>
apparmor: fix overlapping attachment computation
John Johansen <[email protected]>
apparmor: fix setting unconfined mode on a loaded profile
Tom Rix <[email protected]>
apparmor: fix aa_label_asxprint return check
John Johansen <[email protected]>
apparmor: Fix failed mount permission check error message
John Johansen <[email protected]>
apparmor: fix absroot causing audited secids to begin with =
John Johansen <[email protected]>
apparmor: fix quiet_denied for file rules
Marc Kleine-Budde <[email protected]>
can: ems_usb: fix clang's -Wunaligned-access warning
Takashi Iwai <[email protected]>
ALSA: usb-audio: More comprehensive mixer map for ASUS ROG Zenith II
Steven Rostedt (Google) <[email protected]>
tracing: Have filter accept "common_cpu" to be consistent
Filipe Manana <[email protected]>
btrfs: fix lost error handling when looking up extended ref on log replay
Christophe JAILLET <[email protected]>
mmc: meson-gx: Fix an error handling path in meson_mmc_probe()
Christophe JAILLET <[email protected]>
mmc: pxamci: Fix an error handling path in pxamci_probe()
Christophe JAILLET <[email protected]>
mmc: pxamci: Fix another error handling path in pxamci_probe()
Damien Le Moal <[email protected]>
ata: libata-eh: Add missing command name
Mikulas Patocka <[email protected]>
rds: add missing barrier to release_refill
Aaron Lu <[email protected]>
x86/mm: Use proper mask when setting PUD mapping
Christoffer Sandberg <[email protected]>
ALSA: hda/realtek: Add quirk for Clevo NS50PU, NS70PU
Amadeusz Sławiński <[email protected]>
ALSA: info: Fix llseek return value when using callback
-------------
Diffstat:
Documentation/atomic_bitops.txt | 2 +- Documentation/devicetree/bindings/arm/qcom.yaml | 2 +- .../bindings/clock/qcom,gcc-msm8996.yaml | 16 + .../bindings/regulator/nxp,pca9450-regulator.yaml | 11 - Documentation/firmware-guide/acpi/apei/einj.rst | 2 +- Makefile | 10 +- arch/csky/kernel/probes/kprobes.c | 4 + arch/mips/cavium-octeon/octeon-platform.c | 3 +- arch/mips/mm/tlbex.c | 4 +- arch/nios2/include/asm/entry.h | 3 +- arch/nios2/include/asm/ptrace.h | 2 + arch/nios2/kernel/entry.S | 22 +- arch/nios2/kernel/signal.c | 3 +- arch/nios2/kernel/syscall_table.c | 1 + arch/powerpc/Makefile | 26 +- arch/powerpc/kernel/pci-common.c | 16 +- arch/powerpc/kernel/prom.c | 7 + arch/powerpc/platforms/Kconfig.cputype | 21 +- arch/riscv/boot/dts/sifive/fu540-c000.dtsi | 24 ++ arch/riscv/kernel/sys_riscv.c | 5 +- arch/riscv/kernel/traps.c | 4 + arch/um/kernel/um_arch.c | 4 + arch/um/os-Linux/skas/process.c | 17 +- arch/x86/mm/init_64.c | 2 +- drivers/acpi/pci_mcfg.c | 3 + drivers/acpi/property.c | 8 +- drivers/ata/libata-eh.c | 1 + drivers/atm/idt77252.c | 1 + drivers/block/zram/zcomp.c | 11 +- drivers/clk/qcom/clk-alpha-pll.c | 2 +- drivers/clk/qcom/gcc-ipq8074.c | 1 + drivers/clk/ti/clk-44xx.c | 210 ++++++------- drivers/clk/ti/clk-54xx.c | 160 +++++----- drivers/clk/ti/clkctrl.c | 4 - drivers/dma/sprd-dma.c | 5 +- drivers/gpu/drm/meson/meson_drv.c | 5 +- drivers/gpu/drm/meson/meson_viu.c | 22 +- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 10 +- drivers/i2c/busses/i2c-imx.c | 20 +- drivers/infiniband/sw/rxe/rxe_param.h | 6 + drivers/infiniband/sw/rxe/rxe_task.c | 16 +- drivers/irqchip/irq-tegra.c | 10 +- drivers/md/md.c | 1 + drivers/md/raid5.c | 2 +- drivers/misc/cxl/irq.c | 1 + drivers/misc/uacce/uacce.c | 133 ++++++--- drivers/mmc/host/meson-gx-mmc.c | 6 +- drivers/mmc/host/pxamci.c | 4 +- drivers/net/can/spi/mcp251x.c | 18 +- drivers/net/can/usb/ems_usb.c | 2 +- drivers/net/dsa/microchip/ksz9477.c | 3 + drivers/net/dsa/mv88e6060.c | 3 + drivers/net/dsa/ocelot/felix_vsc9959.c | 3 +- drivers/net/dsa/sja1105/sja1105_devlink.c | 2 +- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 21 +- drivers/net/ethernet/broadcom/bgmac.c | 2 +- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 +- drivers/net/ethernet/freescale/fec_ptp.c | 6 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 4 +- drivers/net/ethernet/intel/iavf/iavf_adminq.c | 15 +- drivers/net/ethernet/intel/ice/ice_switch.c | 2 +- drivers/net/ethernet/intel/igb/igb.h | 2 + drivers/net/ethernet/intel/igb/igb_main.c | 12 +- drivers/net/ethernet/moxa/moxart_ether.c | 20 +- .../net/ethernet/netronome/nfp/nfp_net_ethtool.c | 2 + drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 1 + drivers/net/geneve.c | 15 +- drivers/net/plip/plip.c | 2 +- drivers/net/virtio_net.c | 5 +- drivers/ntb/test/ntb_tool.c | 8 +- drivers/nvme/target/tcp.c | 3 +- drivers/pci/pcie/err.c | 3 +- drivers/pci/quirks.c | 3 + drivers/pinctrl/intel/pinctrl-intel.c | 14 +- drivers/pinctrl/nomadik/pinctrl-nomadik.c | 4 +- drivers/pinctrl/qcom/pinctrl-msm8916.c | 4 +- drivers/pinctrl/qcom/pinctrl-sm8250.c | 2 +- drivers/pinctrl/sunxi/pinctrl-sun50i-h6-r.c | 1 + drivers/pinctrl/sunxi/pinctrl-sunxi.c | 7 +- drivers/platform/chrome/cros_ec_proto.c | 8 +- drivers/scsi/lpfc/lpfc_debugfs.c | 20 +- drivers/spi/spi-meson-spicc.c | 129 ++++++-- drivers/tty/serial/ucc_uart.c | 2 + drivers/usb/cdns3/gadget.c | 2 +- drivers/usb/dwc2/gadget.c | 3 +- drivers/usb/gadget/function/uvc_video.c | 2 +- drivers/usb/gadget/legacy/inode.c | 1 + drivers/usb/host/ohci-ppc-of.c | 1 + drivers/usb/renesas_usbhs/rza.c | 4 + drivers/vfio/vfio.c | 1 + drivers/video/fbdev/i740fb.c | 9 +- drivers/virt/vboxguest/vboxguest_linux.c | 9 +- drivers/xen/xenbus/xenbus_dev_frontend.c | 4 +- fs/btrfs/tree-log.c | 4 +- fs/ceph/caps.c | 27 +- fs/ceph/mds_client.c | 7 +- fs/ceph/mds_client.h | 6 - fs/cifs/smb2ops.c | 5 +- fs/ext4/namei.c | 7 +- fs/ext4/resize.c | 10 + fs/f2fs/node.c | 6 +- fs/f2fs/segment.c | 13 + fs/nfs/nfs4idmap.c | 46 +-- fs/nfs/nfs4proc.c | 20 +- include/asm-generic/bitops/atomic.h | 6 - include/linux/netfilter/nfnetlink.h | 27 ++ include/linux/nmi.h | 2 + include/linux/uacce.h | 6 +- include/sound/control.h | 2 +- include/sound/core.h | 8 + kernel/bpf/arraymap.c | 6 + kernel/bpf/cgroup.c | 70 ++++- kernel/bpf/hashtab.c | 2 + kernel/trace/trace_events.c | 1 + kernel/trace/trace_probe.c | 5 +- kernel/watchdog.c | 21 +- lib/list_debug.c | 12 +- net/can/j1939/socket.c | 5 +- net/can/j1939/transport.c | 8 +- net/core/bpf_sk_storage.c | 12 +- net/core/devlink.c | 4 +- net/core/sock_map.c | 20 +- net/ipv6/ip6_output.c | 3 +- net/netfilter/ipset/ip_set_core.c | 17 +- net/netfilter/nf_conntrack_netlink.c | 77 ++--- net/netfilter/nf_tables_api.c | 325 ++++++++++----------- net/netfilter/nf_tables_trace.c | 9 +- net/netfilter/nfnetlink_acct.c | 11 +- net/netfilter/nfnetlink_cthelper.c | 11 +- net/netfilter/nfnetlink_cttimeout.c | 22 +- net/netfilter/nfnetlink_log.c | 11 +- net/netfilter/nfnetlink_queue.c | 12 +- net/netfilter/nft_compat.c | 11 +- net/netlink/genetlink.c | 6 +- net/netlink/policy.c | 14 +- net/qrtr/qrtr.c | 42 +-- net/rds/ib_recv.c | 1 + net/sunrpc/auth.c | 2 +- net/sunrpc/backchannel_rqst.c | 14 + net/vmw_vsock/af_vsock.c | 10 +- scripts/Makefile.gcc-plugins | 2 +- scripts/dummy-tools/gcc | 8 +- scripts/module.lds.S | 2 + security/apparmor/apparmorfs.c | 2 +- security/apparmor/audit.c | 2 +- security/apparmor/domain.c | 2 +- security/apparmor/include/lib.h | 5 + security/apparmor/include/policy.h | 2 +- security/apparmor/label.c | 13 +- security/apparmor/mount.c | 8 +- security/apparmor/policy_unpack.c | 12 +- sound/core/control.c | 7 +- sound/core/info.c | 6 +- sound/core/misc.c | 94 ++++++ sound/core/timer.c | 11 +- sound/pci/hda/patch_realtek.c | 1 + sound/soc/codecs/tas2770.c | 98 +++---- sound/soc/codecs/tas2770.h | 5 + sound/soc/sof/intel/hda.c | 22 +- sound/usb/card.c | 8 + sound/usb/mixer_maps.c | 34 ++- tools/build/feature/test-libcrypto.c | 15 +- tools/perf/util/probe-event.c | 6 +- .../ftrace/test.d/kprobe/kprobe_syntax_errors.tc | 1 - tools/vm/slabinfo.c | 32 +- 165 files changed, 1565 insertions(+), 1040 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/158 ALSA: info: Fix llseek return value when using callback
From: Amadeusz Sławiński <[email protected]>
commit 9be080edcca330be4af06b19916c35227891e8bc upstream.
When using callback there was a flow of
ret = -EINVAL
if (callback) {
offset = callback();
goto out;
}
...
offset = some other value in case of no callback;
ret = offset;
out:
return ret;which causes the snd_info_entry_llseek() to return -EINVAL when there is callback handler. Fix this by setting "ret" directly to callback return value before jumping to "out".
--- sound/core/info.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/core/info.c +3 -3
@@ -112,9 +112,9 @@ static loff_t snd_info_entry_llseek(stru entry = data->entry;mutex_lock (&entry->access);if (entry->c.ops->llseek) { - offset = entry->c.ops->llseek (entry, - data->file_private_data, - file, offset, orig); + ret = entry->c.ops->llseek (entry, + data->file_private_data, + file, offset, orig); goto out; }
Greg Kroah-Hartman
maintainerPATCH 2/158 ALSA: hda/realtek: Add quirk for Clevo NS50PU, NS70PU
In reply to Greg Kroah-HartmanFrom: Christoffer Sandberg <[email protected]>
commit 90d74fdbd8059bf041ac797092c9b1d461555280 upstream.
Fixes headset microphone detection on Clevo NS50PU and NS70PU.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -8963,6 +8963,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1558 ,0x70f4 ,"Clevo NH77EPY" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1558 ,0x70f6 ,"Clevo NH77DPQ-Y" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1558 ,0x7716 ,"Clevo NS50PU" ,ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1558 ,0x7717 ,"Clevo NS70PU" ,ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1558 ,0x7718 ,"Clevo L140PU" ,ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1558 ,0x8228 ,"Clevo NR40BU" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Greg Kroah-Hartman
maintainerPATCH 3/158 x86/mm: Use proper mask when setting PUD mapping
In reply to Greg Kroah-HartmanFrom: Aaron Lu <[email protected]>
commit 88e0a74902f894fbbc55ad3ad2cb23b4bfba555c upstream.
Commit c164fbb40c43f("x86/mm: thread pgprot_t through init_memory_mapping()") mistakenly used __pgprot() which doesn't respect __default_kernel_pte_mask when setting PUD mapping.
Fix it by only setting the one bit we actually need (PSE) and leaving the other bits (that have been properly masked) alone.
--- arch/x86/mm/init_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/init_64.c +1 -1
@@ -645,7 +645,7 @@ phys_pud_init(pud_t *pud_page, unsigned pages++;spin_lock (&init_mm.page_table_lock); - prot =__pgprot (pgprot_val (prot) | __PAGE_KERNEL_LARGE); + prot =__pgprot (pgprot_val (prot) | _PAGE_PSE); set_pte_init((pte_t *)pud, pfn_pte((paddr & PUD_MASK) >> PAGE_SHIFT,
Greg Kroah-Hartman
maintainerPATCH 4/158 rds: add missing barrier to release_refill
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
commit 9f414eb409daf4f778f011cf8266d36896bb930b upstream.
The functions clear_bit and set_bit do not imply a memory barrier, thus it may be possible that the waitqueue_active function (which does not take any locks) is moved before clear_bit and it could miss a wakeup event.
Fix this bug by adding a memory barrier after clear_bit.
--- net/rds/ib_recv.c | 1 + 1 file changed, 1 insertion(+)
net/rds/ib_recv.c +1 -0
@@ -363,6 +363,7 @@ static int acquire_refill(struct rds_constatic void release_refill (struct rds_connection *conn) {clear_bit (RDS_RECV_REFILL , &conn->c_flags); +smp_mb__after_atomic ();/* We don't use wait_on_bit()/wake_up_bit() because our waking is in a * hot path and finding waiters is very rare. We don't want to walk
Greg Kroah-Hartman
maintainerPATCH 5/158 ata: libata-eh: Add missing command name
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
commit d3122bf9aa4c974f5e2c0112f799757b3a2779da upstream.
Add the missing command name for ATA_CMD_NCQ_NON_DATA to ata_get_cmd_name().
--- drivers/ata/libata-eh.c | 1 + 1 file changed, 1 insertion(+)
drivers/ata/libata-eh.c +1 -0
@@ -2131,6 +2131,7 @@ const char *ata_get_cmd_descript(u8 comm { ATA_CMD_WRITE_QUEUED_FUA_EXT, "WRITE DMA QUEUED FUA EXT" }, { ATA_CMD_FPDMA_READ, "READ FPDMA QUEUED" }, { ATA_CMD_FPDMA_WRITE, "WRITE FPDMA QUEUED" }, + { ATA_CMD_NCQ_NON_DATA, "NCQ NON-DATA" }, { ATA_CMD_FPDMA_SEND, "SEND FPDMA QUEUED" }, { ATA_CMD_FPDMA_RECV, "RECEIVE FPDMA QUEUED" }, { ATA_CMD_PIO_READ, "READ SECTOR(S)" },
Greg Kroah-Hartman
maintainerPATCH 6/158 mmc: pxamci: Fix another error handling path in pxamci_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
commit b886f54c300d31c109d2e4336b22922b64e7ba7d upstream.
The commit in Fixes: has introduced an new error handling without branching to the existing error handling path.
Update it now and release some resources if pxamci_init_ocr() fails.
--- drivers/mmc/host/pxamci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/pxamci.c +1 -1
@@ -672,7 +672,7 @@ static int pxamci_probe(struct platform_ ret =pxamci_init_ocr (host);if (ret <0 ) -return ret; + goto out; mmc->caps =0 ; host->cmdat =0 ;
Greg Kroah-Hartman
maintainerPATCH 7/158 mmc: pxamci: Fix an error handling path in pxamci_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
commit 98d7c5e5792b8ce3e1352196dac7f404bb1b46ec upstream.
The commit in Fixes: has moved some code around without updating gotos to the error handling path.
Update it now and release some resources if pxamci_of_init() fails.
--- drivers/mmc/host/pxamci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/pxamci.c +1 -1
@@ -648,7 +648,7 @@ static int pxamci_probe(struct platform_ ret =pxamci_of_init (pdev, mmc);if (ret) -return ret; + goto out; host =mmc_priv (mmc); host->mmc = mmc;
Greg Kroah-Hartman
maintainerPATCH 8/158 mmc: meson-gx: Fix an error handling path in meson_mmc_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
commit b3e1cf31154136da855f3cb6117c17eb0b6bcfb4 upstream.
The commit in Fixes has introduced a new error handling which should goto the existing error handling path.
Otherwise some resources leak.
--- drivers/mmc/host/meson-gx-mmc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/host/meson-gx-mmc.c +4 -2
@@ -1161,8 +1161,10 @@ static int meson_mmc_probe(struct platfo } ret =device_reset_optional (&pdev->dev); -if (ret) -return dev_err_probe (&pdev->dev, ret,"device reset failed\n" ); +if (ret) { +dev_err_probe (&pdev->dev, ret,"device reset failed\n" ); + goto free_host; + } res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); host->regs =devm_ioremap_resource (&pdev->dev, res);
Greg Kroah-Hartman
maintainerPATCH 9/158 btrfs: fix lost error handling when looking up extended ref on log replay
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 7a6b75b79902e47f46328b57733f2604774fa2d9 upstream.
During log replay, when processing inode references, if we get an error when looking up for an extended reference at __add_inode_ref(), we ignore it and proceed, returning success (0) if no other error happens after the lookup. This is obviously wrong because in case an extended reference exists and it encodes some name not in the log, we need to unlink it, otherwise the filesystem state will not match the state it had after the last fsync.
So just make __add_inode_ref() return an error it gets from the extended reference lookup.
--- fs/btrfs/tree-log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/tree-log.c +3 -1
@@ -1075,7 +1075,9 @@ again: extref =btrfs_lookup_inode_extref (NULL , root, path, name, namelen, inode_objectid, parent_objectid,0 ,0 ); -if (!IS_ERR_OR_NULL (extref)) { +if (IS_ERR (extref)) { +return PTR_ERR (extref); + }else if (extref) {u32 item_size;u32 cur_offset =0 ;unsigned long base;
Greg Kroah-Hartman
maintainerPATCH 10/158 tracing: Have filter accept "common_cpu" to be consistent
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (Google) <[email protected]>
commit b2380577d4fe1c0ef3fa50417f1e441c016e4cbe upstream.
Make filtering consistent with histograms. As "cpu" can be a field of an event, allow for "common_cpu" to keep it from being confused with the "cpu" field of the event.
--- kernel/trace/trace_events.c | 1 + 1 file changed, 1 insertion(+)
kernel/trace/trace_events.c +1 -0
@@ -168,6 +168,7 @@ static int trace_define_generic_fields(v__generic_field (int,CPU ,FILTER_CPU );__generic_field (int, cpu,FILTER_CPU ); +__generic_field (int, common_cpu,FILTER_CPU ); __generic_field(char *, COMM, FILTER_COMM); __generic_field(char *, comm, FILTER_COMM);
Greg Kroah-Hartman
maintainerPATCH 11/158 ALSA: usb-audio: More comprehensive mixer map for ASUS ROG Zenith II
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 6bc2906253e723d1ab1acc652b55b83e286bfec2 upstream.
ASUS ROG Zenith II has two USB interfaces, one for the front headphone and another for the rest I/O. Currently we provided the mixer mapping for the latter but with an incomplete form.
This patch corrects and provides more comprehensive mixer mapping, as well as providing the proper device names for both the front headphone and main audio.
--- sound/usb/card.c | 8 ++++++++ sound/usb/mixer_maps.c | 34 +++++++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 9 deletions(-)
sound/usb/card.c +8 -0
@@ -379,6 +379,14 @@ static const struct usb_audio_device_namDEVICE_NAME (0x046d ,0x0990 ,"Logitech, Inc." ,"QuickCam Pro 9000" ), +/* ASUS ROG Zenith II: this machine has also two devices, one for +* the front headphone and another for the rest +*/ +PROFILE_NAME (0x0b05 ,0x1915 ,"ASUS" ,"Zenith II Front Headphone" , +"Zenith-II-Front-Headphone" ), +PROFILE_NAME (0x0b05 ,0x1916 ,"ASUS" ,"Zenith II Main Audio" , +"Zenith-II-Main-Audio" ), +/* ASUS ROG Strix */ PROFILE_NAME (0x0b05 ,0x1917 , "Realtek", "ALC1220-VB-DT", "Realtek-ALC1220-VB-Desktop"),
sound/usb/mixer_maps.c +25 -9
@@ -367,13 +367,28 @@ static const struct usbmix_name_map cors { 0 } }; -/* Some mobos shipped with a dummy HD-audio show the invalid GET_MIN/GET_MAX -* response for Input Gain Pad (id=19, control=12) and the connector status -* for SPDIF terminal (id=18). Skip them. -*/ -static const struct usbmix_name_map asus_rog_map[] = { - {18 ,NULL },/* OT, connector control */ - {19 ,NULL ,12 },/* FU, Input Gain Pad */ +/* ASUS ROG Zenith II with Realtek ALC1220-VB */ +static const struct usbmix_name_map asus_zenith_ii_map[] = { + {19 ,NULL ,12 },/* FU, Input Gain Pad - broken response, disabled */ + {16 ,"Speaker" },/* OT */ + {22 ,"Speaker Playback" },/* FU */ + {7 ,"Line" },/* IT */ + {19 ,"Line Capture" },/* FU */ + {8 ,"Mic" },/* IT */ + {20 ,"Mic Capture" },/* FU */ + {9 ,"Front Mic" },/* IT */ + {21 ,"Front Mic Capture" },/* FU */ + {17 ,"IEC958" },/* OT */ + {23 ,"IEC958 Playback" },/* FU */ + {} +}; + +static const struct usbmix_connector_map asus_zenith_ii_connector_map[] = { + {10 ,16 },/* (Back) Speaker */ + {11 ,17 },/* SPDIF */ + {13 ,7 },/* Line */ + {14 ,8 },/* Mic */ + {15 ,9 },/* Front Mic */ {} };
@@ -590,9 +605,10 @@ static const struct usbmix_ctl_map usbmi .map = trx40_mobo_map, .connector_map = trx40_mobo_connector_map, }, - {/* ASUS ROG Zenith II */ + {/* ASUS ROG Zenith II (main audio) */ .id = USB_ID(0x0b05, 0x1916), - .map = asus_rog_map, + .map = asus_zenith_ii_map, + .connector_map = asus_zenith_ii_connector_map, }, {/* ASUS ROG Strix */ .id = USB_ID(0x0b05, 0x1917),
Greg Kroah-Hartman
maintainerPATCH 12/158 can: ems_usb: fix clangs -Wunaligned-access warning
In reply to Greg Kroah-HartmanFrom: Marc Kleine-Budde <[email protected]>
commit a4cb6e62ea4d36e53fb3c0f18ea4503d7b76674f upstream.
clang emits a -Wunaligned-access warning on struct __packed ems_cpc_msg.
The reason is that the anonymous union msg (not declared as packed) is being packed right after some non naturally aligned variables (3*8 bits + 2*32) inside a packed struct:
| struct __packed ems_cpc_msg {
| u8 type; /* type of message */
| u8 length; /* length of data within union 'msg' */
| u8 msgid; /* confirmation handle */
| __le32 ts_sec; /* timestamp in seconds */
| __le32 ts_nsec; /* timestamp in nano seconds */
| /* ^ not naturally aligned */
|
| union {
| /* ^ not declared as packed */
| u8 generic[64];
| struct cpc_can_msg can_msg;
| struct cpc_can_params can_params;
| struct cpc_confirm confirmation;
| struct cpc_overrun overrun;
| struct cpc_can_error error;
| struct cpc_can_err_counter err_counter;
| u8 can_state;
| } msg;
| };Starting from LLVM 14, having an unpacked struct nested in a packed struct triggers a warning. c.f. [1].
Fix the warning by marking the anonymous union as packed.
[1] https://github.com/llvm/llvm-project/issues/55520
--- drivers/net/can/usb/ems_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/usb/ems_usb.c +1 -1
@@ -194,7 +194,7 @@ struct __packed ems_cpc_msg {__le32 ts_sec;/* timestamp in seconds */ __le32 ts_nsec;/* timestamp in nano seconds */ -union { +union __packed {u8 generic[64 ];struct cpc_can_msg can_msg;struct cpc_can_params can_params;
Greg Kroah-Hartman
maintainerPATCH 13/158 apparmor: fix quiet_denied for file rules
In reply to Greg Kroah-HartmanFrom: John Johansen <[email protected]>
commit 68ff8540cc9e4ab557065b3f635c1ff4c96e1f1c upstream.
Global quieting of denied AppArmor generated file events is not handled correctly. Unfortunately the is checking if quieting of all audit events is set instead of just denied events.
--- security/apparmor/audit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/audit.c +1 -1
@@ -137,7 +137,7 @@ int aa_audit(int type, struct aa_profile }if (AUDIT_MODE (profile) ==AUDIT_QUIET || (type ==AUDIT_APPARMOR_DENIED && -AUDIT_MODE (profile) ==AUDIT_QUIET )) +AUDIT_MODE (profile) ==AUDIT_QUIET_DENIED ))return aad (sa)->error;if (KILL_MODE (profile) && type ==AUDIT_APPARMOR_DENIED )
Greg Kroah-Hartman
maintainerPATCH 14/158 apparmor: fix absroot causing audited secids to begin with =
In reply to Greg Kroah-HartmanFrom: John Johansen <[email protected]>
commit 511f7b5b835726e844a5fc7444c18e4b8672edfd upstream.
AppArmor is prefixing secids that are converted to secctx with the = to indicate the secctx should only be parsed from an absolute root POV. This allows catching errors where secctx are reparsed back into internal labels.
Unfortunately because audit is using secid to secctx conversion this means that subject and object labels can result in a very unfortunate == that can break audit parsing.
eg. the subj==unconfined term in the below audit message
type=USER_LOGIN msg=audit(1639443365.233:160): pid=1633 uid=0 auid=1000 ses=3 subj==unconfined msg='op=login id=1000 exe="/usr/sbin/sshd" hostname=192.168.122.1 addr=192.168.122.1 terminal=/dev/pts/1 res=success'
Fix this by switch the prepending of = to a _. This still works as a special character to flag this case without breaking audit. Also move this check behind debug as it should not be needed during normal operqation.
--- security/apparmor/include/lib.h | 5 +++++ security/apparmor/label.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-)
security/apparmor/include/lib.h +5 -0
@@ -22,6 +22,11 @@*/ #define DEBUG_ON (aa_g_debug) +/* +* split individual debug cases out in preparation for finer grained +* debug controls in the future. +*/ +#define AA_DEBUG_LABEL DEBUG_ON #define dbg_printk(__fmt, __args...) pr_debug(__fmt, ##__args) #define AA_DEBUG(fmt, args...) \ do { \
security/apparmor/label.c +4 -3
@@ -1632,9 +1632,9 @@ int aa_label_snxprint(char *str, size_tAA_BUG (!str && size !=0 );AA_BUG (!label); -if (flags &FLAG_ABS_ROOT ) { +if (AA_DEBUG_LABEL && (flags &FLAG_ABS_ROOT )) { ns = root_ns; - len =snprintf (str, size,"=" ); + len =snprintf (str, size,"_" );update_for_len (total, len, size, str); }else if (!ns) { ns =labels_ns (label);
@@ -1896,7 +1896,8 @@ struct aa_label *aa_label_strn_parse(strAA_BUG (!str); str =skipn_spaces (str, n); -if (str ==NULL || (*str =='=' && base != &root_ns->unconfined->label)) +if (str ==NULL || (AA_DEBUG_LABEL && *str =='_' && + base != &root_ns->unconfined->label))return ERR_PTR (-EINVAL ); len =label_count_strn_entries (str, end - str);
Greg Kroah-Hartman
maintainerPATCH 15/158 apparmor: Fix failed mount permission check error message
In reply to Greg Kroah-HartmanFrom: John Johansen <[email protected]>
commit ec240b5905bbb09a03dccffee03062cf39e38dc2 upstream.
When the mount check fails due to a permission check failure instead of explicitly at one of the subcomponent checks, AppArmor is reporting a failure in the flags match. However this is not true and AppArmor can not attribute the error at this point to any particular component, and should only indicate the mount failed due to missing permissions.
--- security/apparmor/mount.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
security/apparmor/mount.c +4 -3
@@ -229,7 +229,8 @@ static const char * const mnt_info_table"failed srcname match" ,"failed type match" ,"failed flags match" , - "failed data match" +"failed data match" , + "failed perms check" };/*
@@ -284,8 +285,8 @@ static int do_match_mnt(struct aa_dfa *dreturn 0 ; } -/* failed at end of flags match */ -return 4 ; +/* failed at perms check, don't confuse with flags match */ +return 6 ; }
Greg Kroah-Hartman
maintainerPATCH 16/158 apparmor: fix aa_label_asxprint return check
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
commit 3e2a3a0830a2090e766d0d887d52c67de2a6f323 upstream.
Clang static analysis reports this issue label.c:1802:3: warning: 2nd function call argument
is an uninitialized value
pr_info("%s", str);
^~~~~~~~~~~~~~~~~~
str is set from a successful call to aa_label_asxprint(&str, ...) On failure a negative value is returned, not a -1. So change the check.
--- security/apparmor/label.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
security/apparmor/label.c +3 -3
@@ -1745,7 +1745,7 @@ void aa_label_xaudit(struct audit_bufferif (!use_label_hname (ns, label, flags) ||display_mode (ns, label, flags)) { len =aa_label_asxprint (&name, ns, label, flags, gfp); -if (len ==-1 ) { +if (len <0 ) {AA_DEBUG ("label print error" );return ; }
@@ -1773,7 +1773,7 @@ void aa_label_seq_xprint(struct seq_fileint len; len =aa_label_asxprint (&str, ns, label, flags, gfp); -if (len ==-1 ) { +if (len <0 ) {AA_DEBUG ("label print error" );return ; }
@@ -1796,7 +1796,7 @@ void aa_label_xprintk(struct aa_ns *ns,int len; len =aa_label_asxprint (&str, ns, label, flags, gfp); -if (len ==-1 ) { +if (len <0 ) {AA_DEBUG ("label print error" );return ; }
Greg Kroah-Hartman
maintainerPATCH 17/158 apparmor: fix setting unconfined mode on a loaded profile
In reply to Greg Kroah-HartmanFrom: John Johansen <[email protected]>
commit 3bbb7b2e9bbcd22e539e23034da753898fe3b4dc upstream.
When loading a profile that is set to unconfined mode, that label flag is not set when it should be. Ensure it is set so that when used in a label the unconfined check will be applied correctly.
--- security/apparmor/policy_unpack.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
security/apparmor/policy_unpack.c +7 -5
@@ -746,16 +746,18 @@ static struct aa_profile *unpack_profile profile->label.flags |=FLAG_HAT ;if (!unpack_u32 (e, &tmp,NULL )) goto fail; -if (tmp ==PACKED_MODE_COMPLAIN || (e->version &FORCE_COMPLAIN_FLAG )) +if (tmp ==PACKED_MODE_COMPLAIN || (e->version &FORCE_COMPLAIN_FLAG )) { profile->mode =APPARMOR_COMPLAIN ; -else if (tmp ==PACKED_MODE_ENFORCE ) + }else if (tmp ==PACKED_MODE_ENFORCE ) { profile->mode =APPARMOR_ENFORCE ; -else if (tmp ==PACKED_MODE_KILL ) + }else if (tmp ==PACKED_MODE_KILL ) { profile->mode =APPARMOR_KILL ; -else if (tmp ==PACKED_MODE_UNCONFINED ) + }else if (tmp ==PACKED_MODE_UNCONFINED ) { profile->mode =APPARMOR_UNCONFINED ; -else + profile->label.flags |=FLAG_UNCONFINED ; + }else { goto fail; + }if (!unpack_u32 (e, &tmp,NULL )) goto fail;if (tmp)
Greg Kroah-Hartman
maintainerPATCH 18/158 apparmor: fix overlapping attachment computation
In reply to Greg Kroah-HartmanFrom: John Johansen <[email protected]>
commit 2504db207146543736e877241f3b3de005cbe056 upstream.
When finding the profile via patterned attachments, the longest left match is being set to the static compile time value and not using the runtime computed value.
Fix this by setting the candidate value to the greater of the precomputed value or runtime computed value.
--- security/apparmor/domain.c | 2 +- security/apparmor/include/policy.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
security/apparmor/domain.c +1 -1
@@ -465,7 +465,7 @@ restart:* xattrs, or a longer match */ candidate = profile; - candidate_len = profile->xmatch_len; + candidate_len =max (count, profile->xmatch_len); candidate_xattrs = ret; conflict = false; }
security/apparmor/include/policy.h +1 -1
@@ -135,7 +135,7 @@ struct aa_profile {const char *attach;struct aa_dfa *xmatch; -int xmatch_len; +unsigned int xmatch_len;enum audit_mode audit;long mode;u32 path_flags;
Greg Kroah-Hartman
maintainerPATCH 19/158 apparmor: fix reference count leak in aa_pivotroot()
In reply to Greg Kroah-HartmanFrom: Xin Xiong <[email protected]>
commit 11c3627ec6b56c1525013f336f41b79a983b4d46 upstream.
The aa_pivotroot() function has a reference counting bug in a specific path. When aa_replace_current_label() returns on success, the function forgets to decrement the reference count of “target”, which is increased earlier by build_pivotroot(), causing a reference leak.
Fix it by decreasing the refcount of “target” in that path.
--- security/apparmor/mount.c | 1 + 1 file changed, 1 insertion(+)
security/apparmor/mount.c +1 -0
@@ -719,6 +719,7 @@ int aa_pivotroot(struct aa_label *label,aa_put_label (target); goto out; } +aa_put_label (target); }else /* already audited error */ error =PTR_ERR (target);
Greg Kroah-Hartman
maintainerPATCH 20/158 apparmor: Fix memleak in aa_simple_write_to_buffer()
In reply to Greg Kroah-HartmanFrom: Xiu Jianfeng <[email protected]>
commit 417ea9fe972d2654a268ad66e89c8fcae67017c3 upstream.
When copy_from_user failed, the memory is freed by kvfree. however the management struct and data blob are allocated independently, so only kvfree(data) cause a memleak issue here. Use aa_put_loaddata(data) to fix this issue.
--- security/apparmor/apparmorfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/apparmorfs.c +1 -1
@@ -401,7 +401,7 @@ static struct aa_loaddata *aa_simple_wri data->size = copy_size;if (copy_from_user (data->data, userbuf, copy_size)) { -kvfree (data); +aa_put_loaddata (data);return ERR_PTR (-EFAULT ); }
Greg Kroah-Hartman
maintainerPATCH 21/158 Documentation: ACPI: EINJ: Fix obsolete example
In reply to Greg Kroah-HartmanFrom: Qifu Zhang <[email protected]>
commit 9066e151c37950af92c3be6a7270daa8e8063db9 upstream.
Since commit 488dac0c9237 ("libfs: fix error cast of negative value in simple_attr_write()"), the EINJ debugfs interface no longer accepts negative values as input. Attempt to do so will result in EINVAL.
--- Documentation/firmware-guide/acpi/apei/einj.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/firmware-guide/acpi/apei/einj.rst +1 -1
@@ -168,7 +168,7 @@ An error injection example:: 0x00000008 Memory Correctable 0x00000010 Memory Uncorrectable non-fatal # echo 0x12345000 > param1 # Set memory address for injection - # echo $((-1 << 12)) > param2 # Mask 0xfffffffffffff000 - anywhere in this page + # echo 0xfffffffffffff000 > param2 # Mask - anywhere in this page # echo 0x8 > error_type # Choose correctable memory error # echo 1 > error_inject # Inject now
Greg Kroah-Hartman
maintainerPATCH 22/158 NFSv4.1: Dont decrease the value of seq_nr_highest_sent
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
commit f07a5d2427fc113dc50c5c818eba8929bc27b8ca upstream.
When we're trying to figure out what the server may or may not have seen in terms of request numbers, do not assume that requests with a larger number were missed, just because we saw a reply to a request with a smaller number.
--- fs/nfs/nfs4proc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/nfs/nfs4proc.c +2 -3
@@ -790,10 +790,9 @@ static void nfs4_slot_sequence_record_seif ((s32)(seqnr - slot->seq_nr_highest_sent) >0 ) slot->seq_nr_highest_sent = seqnr; } -static void nfs4_slot_sequence_acked (struct nfs4_slot *slot, -u32 seqnr) +static void nfs4_slot_sequence_acked (struct nfs4_slot *slot,u32 seqnr) { - slot->seq_nr_highest_sent = seqnr; +nfs4_slot_sequence_record_sent (slot, seqnr); slot->seq_nr_last_acked = seqnr; }
Greg Kroah-Hartman
maintainerPATCH 23/158 NFSv4.1: Handle NFS4ERR_DELAY replies to OP_SEQUENCE correctly
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
commit 7ccafd4b2b9f34e6d8185f796f151c47424e273e upstream.
Don't assume that the NFS4ERR_DELAY means that the server is processing this slot id.
--- fs/nfs/nfs4proc.c | 1 - 1 file changed, 1 deletion(-)
fs/nfs/nfs4proc.c +0 -1
@@ -859,7 +859,6 @@ static int nfs41_sequence_process(struct __func__, slot->slot_nr, slot->seq_nr); -nfs4_slot_sequence_acked (slot, slot->seq_nr); goto out_retry;case -NFS4ERR_RETRY_UNCACHED_REP :case -NFS4ERR_SEQ_FALSE_RETRY :
Greg Kroah-Hartman
maintainerPATCH 24/158 NFSv4: Fix races in the legacy idmapper upcall
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
commit 51fd2eb52c0ca8275a906eed81878ef50ae94eb0 upstream.
nfs_idmap_instantiate() will cause the process that is waiting in request_key_with_auxdata() to wake up and exit. If there is a second process waiting for the idmap->idmap_mutex, then it may wake up and start a new call to request_key_with_auxdata(). If the call to idmap_pipe_downcall() from the first process has not yet finished calling nfs_idmap_complete_pipe_upcall_locked(), then we may end up triggering the WARN_ON_ONCE() in nfs_idmap_prepare_pipe_upcall().
The fix is to ensure that we clear idmap->idmap_upcall_data before calling nfs_idmap_instantiate().
--- fs/nfs/nfs4idmap.c | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-)
fs/nfs/nfs4idmap.c +24 -22
@@ -561,22 +561,20 @@ nfs_idmap_prepare_pipe_upcall(struct idmreturn true; } -static void -nfs_idmap_complete_pipe_upcall_locked (struct idmap *idmap,int ret) +static void nfs_idmap_complete_pipe_upcall (struct idmap_legacy_upcalldata *data, +int ret) { -struct key *authkey = idmap->idmap_upcall_data->authkey; - -kfree (idmap->idmap_upcall_data); - idmap->idmap_upcall_data =NULL ; -complete_request_key (authkey, ret); -key_put (authkey); +complete_request_key (data->authkey, ret); +key_put (data->authkey); +kfree (data); } -static void -nfs_idmap_abort_pipe_upcall (struct idmap *idmap,int ret) +static void nfs_idmap_abort_pipe_upcall (struct idmap *idmap, +struct idmap_legacy_upcalldata *data, +int ret) { -if (idmap->idmap_upcall_data !=NULL ) -nfs_idmap_complete_pipe_upcall_locked (idmap, ret); +if (cmpxchg (&idmap->idmap_upcall_data, data,NULL ) == data) +nfs_idmap_complete_pipe_upcall (data, ret); }static int nfs_idmap_legacy_upcall (struct key *authkey,void *aux)
@@ -613,7 +611,7 @@ static int nfs_idmap_legacy_upcall(struc ret =rpc_queue_upcall (idmap->idmap_pipe, msg);if (ret <0 ) -nfs_idmap_abort_pipe_upcall (idmap, ret); +nfs_idmap_abort_pipe_upcall (idmap, data, ret);return ret; out2:
@@ -669,6 +667,7 @@ idmap_pipe_downcall(struct file *filp, cstruct request_key_auth *rka;struct rpc_inode *rpci =RPC_I (file_inode (filp));struct idmap *idmap = (struct idmap *)rpci->private; +struct idmap_legacy_upcalldata *data;struct key *authkey;struct idmap_msg im;size_t namelen_in;
@@ -678,10 +677,11 @@ idmap_pipe_downcall(struct file *filp, c* will have been woken up and someone else may now have used * idmap_key_cons - so after this point we may no longer touch it. */ -if (idmap->idmap_upcall_data ==NULL ) + data =xchg (&idmap->idmap_upcall_data,NULL ); +if (data ==NULL ) goto out_noupcall; - authkey = idmap->idmap_upcall_data->authkey; + authkey = data->authkey; rka =get_request_key_auth (authkey);if (mlen !=sizeof (im)) {
@@ -703,18 +703,17 @@ idmap_pipe_downcall(struct file *filp, cif (namelen_in ==0 || namelen_in ==IDMAP_NAMESZ ) { ret = -EINVAL ; goto out; -} + } - ret =nfs_idmap_read_and_verify_message (&im, - &idmap->idmap_upcall_data->idmap_msg, - rka->target_key, authkey); + ret =nfs_idmap_read_and_verify_message (&im, &data->idmap_msg, + rka->target_key, authkey);if (ret >=0 ) {key_set_timeout (rka->target_key, nfs_idmap_cache_timeout); ret = mlen; } out: -nfs_idmap_complete_pipe_upcall_locked (idmap, ret); +nfs_idmap_complete_pipe_upcall (data, ret); out_noupcall:return ret; }
@@ -728,7 +727,7 @@ idmap_pipe_destroy_msg(struct rpc_pipe_mstruct idmap *idmap = data->idmap;if (msg->errno) -nfs_idmap_abort_pipe_upcall (idmap, msg->errno); +nfs_idmap_abort_pipe_upcall (idmap, data, msg->errno); } static void
@@ -736,8 +735,11 @@ idmap_release_pipe(struct inode *inode) {struct rpc_inode *rpci =RPC_I (inode);struct idmap *idmap = (struct idmap *)rpci->private; +struct idmap_legacy_upcalldata *data; -nfs_idmap_abort_pipe_upcall (idmap, -EPIPE ); + data =xchg (&idmap->idmap_upcall_data,NULL ); +if (data) +nfs_idmap_complete_pipe_upcall (data, -EPIPE ); }int nfs_map_name_to_uid (const struct nfs_server *server,const char *name,size_t namelen,kuid_t *uid)
Greg Kroah-Hartman
maintainerPATCH 25/158 NFSv4.1: RECLAIM_COMPLETE must handle EACCES
In reply to Greg Kroah-HartmanFrom: Zhang Xianwei <[email protected]>
commit e35a5e782f67ed76a65ad0f23a484444a95f000f upstream.
A client should be able to handle getting an EACCES error while doing a mount operation to reclaim state due to NFS4CLNT_RECLAIM_REBOOT being set. If the server returns RPC_AUTH_BADCRED because authentication failed when we execute "exportfs -au", then RECLAIM_COMPLETE will go a wrong way. After mount succeeds, all OPEN call will fail due to an NFS4ERR_GRACE error being returned. This patch is to fix it by resending a RPC request.
--- fs/nfs/nfs4proc.c | 3 +++ 1 file changed, 3 insertions(+)
fs/nfs/nfs4proc.c +3 -0
@@ -9273,6 +9273,9 @@ static int nfs41_reclaim_complete_handlerpc_delay (task,NFS4_POLL_RETRY_MAX ); fallthrough;case -NFS4ERR_RETRY_UNCACHED_REP : +case -EACCES : +dprintk ("%s: failed to reclaim complete error %d for server %s, retrying\n" , + __func__, task->tk_status, clp->cl_hostname);return -EAGAIN ;case -NFS4ERR_BADSESSION :case -NFS4ERR_DEADSESSION :
Greg Kroah-Hartman
maintainerPATCH 26/158 NFSv4/pnfs: Fix a use-after-free bug in open
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
commit 2135e5d56278ffdb1c2e6d325dc6b87f669b9dac upstream.
If someone cancels the open RPC call, then we must not try to free either the open slot or the layoutget operation arguments, since they are likely still in use by the hung RPC call.
--- fs/nfs/nfs4proc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
fs/nfs/nfs4proc.c +6 -5
@@ -3084,12 +3084,13 @@ static int _nfs4_open_and_get_state(stru } out: -if (opendata->lgp) { -nfs4_lgopen_release (opendata->lgp); - opendata->lgp =NULL ; - } -if (!opendata->cancelled) +if (!opendata->cancelled) { +if (opendata->lgp) { +nfs4_lgopen_release (opendata->lgp); + opendata->lgp =NULL ; + }nfs4_sequence_free_slot (&opendata->o_res.seq_res); + }return ret; }
Greg Kroah-Hartman
maintainerPATCH 27/158 bpf: Acquire map uref in .init_seq_private for array map iterator
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
commit f76fa6b338055054f80c72b29c97fb95c1becadc upstream.
bpf_iter_attach_map() acquires a map uref, and the uref may be released before or in the middle of iterating map elements. For example, the uref could be released in bpf_iter_detach_map() as part of bpf_link_release(), or could be released in bpf_map_put_with_uref() as part of bpf_map_release().
Alternative fix is acquiring an extra bpf_link reference just like a pinned map iterator does, but it introduces unnecessary dependency on bpf_link instead of bpf_map.
So choose another fix: acquiring an extra map uref in .init_seq_private for array map iterator.
--- kernel/bpf/arraymap.c | 6 ++++++ 1 file changed, 6 insertions(+)
kernel/bpf/arraymap.c +6 -0
@@ -616,6 +616,11 @@ static int bpf_iter_init_array_map(void seq_info->percpu_value_buf = value_buf; } +/* bpf_iter_attach_map() acquires a map uref, and the uref may be +* released before or in the middle of iterating map elements, so +* acquire an extra map uref for iterator. +*/ +bpf_map_inc_with_uref (map); seq_info->map = map;return 0 ; }
@@ -624,6 +629,7 @@ static void bpf_iter_fini_array_map(void {struct bpf_iter_seq_array_map_info *seq_info = priv_data; +bpf_map_put_with_uref (seq_info->map);kfree (seq_info->percpu_value_buf); }
Greg Kroah-Hartman
maintainerPATCH 28/158 bpf: Acquire map uref in .init_seq_private for hash map iterator
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
commit ef1e93d2eeb58a1f08c37b22a2314b94bc045f15 upstream.
bpf_iter_attach_map() acquires a map uref, and the uref may be released before or in the middle of iterating map elements. For example, the uref could be released in bpf_iter_detach_map() as part of bpf_link_release(), or could be released in bpf_map_put_with_uref() as part of bpf_map_release().
So acquiring an extra map uref in bpf_iter_init_hash_map() and releasing it in bpf_iter_fini_hash_map().
--- kernel/bpf/hashtab.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/bpf/hashtab.c +2 -0
@@ -1801,6 +1801,7 @@ static int bpf_iter_init_hash_map(void * seq_info->percpu_value_buf = value_buf; } +bpf_map_inc_with_uref (map); seq_info->map = map; seq_info->htab = container_of(map, struct bpf_htab, map);return 0 ;
@@ -1810,6 +1811,7 @@ static void bpf_iter_fini_hash_map(void {struct bpf_iter_seq_hash_map_info *seq_info = priv_data; +bpf_map_put_with_uref (seq_info->map);kfree (seq_info->percpu_value_buf); }
Greg Kroah-Hartman
maintainerPATCH 29/158 bpf: Acquire map uref in .init_seq_private for sock local storage map iterator
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
commit 3c5f6e698b5c538bbb23cd453b22e1e4922cffd8 upstream.
bpf_iter_attach_map() acquires a map uref, and the uref may be released before or in the middle of iterating map elements. For example, the uref could be released in bpf_iter_detach_map() as part of bpf_link_release(), or could be released in bpf_map_put_with_uref() as part of bpf_map_release().
So acquiring an extra map uref in bpf_iter_init_sk_storage_map() and releasing it in bpf_iter_fini_sk_storage_map().
--- net/core/bpf_sk_storage.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
net/core/bpf_sk_storage.c +9 -1
@@ -794,10 +794,18 @@ static int bpf_iter_init_sk_storage_map( {struct bpf_iter_seq_sk_storage_map_info *seq_info = priv_data; +bpf_map_inc_with_uref (aux->map); seq_info->map = aux->map;return 0 ; } +static void bpf_iter_fini_sk_storage_map (void *priv_data) +{ +struct bpf_iter_seq_sk_storage_map_info *seq_info = priv_data; + +bpf_map_put_with_uref (seq_info->map); +} +static int bpf_iter_attach_map (struct bpf_prog *prog,union bpf_iter_link_info *linfo,struct bpf_iter_aux_info *aux)
@@ -843,7 +851,7 @@ static const struct seq_operations bpf_sstatic const struct bpf_iter_seq_info iter_seq_info = { .seq_ops = &bpf_sk_storage_map_seq_ops, .init_seq_private = bpf_iter_init_sk_storage_map, - .fini_seq_private =NULL , + .fini_seq_private = bpf_iter_fini_sk_storage_map, .seq_priv_size =sizeof (struct bpf_iter_seq_sk_storage_map_info ), };
Greg Kroah-Hartman
maintainerPATCH 30/158 bpf: Acquire map uref in .init_seq_private for sock{map,hash} iterator
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
commit f0d2b2716d71778d0b0c8eaa433c073287d69d93 upstream.
sock_map_iter_attach_target() acquires a map uref, and the uref may be released before or in the middle of iterating map elements. For example, the uref could be released in sock_map_iter_detach_target() as part of bpf_link_release(), or could be released in bpf_map_put_with_uref() as part of bpf_map_release().
Fixing it by acquiring an extra map uref in .init_seq_private and releasing it in .fini_seq_private.
--- net/core/sock_map.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
net/core/sock_map.c +19 -1
@@ -815,13 +815,22 @@ static int sock_map_init_seq_private(voi {struct sock_map_seq_info *info = priv_data; +bpf_map_inc_with_uref (aux->map); info->map = aux->map;return 0 ; } +static void sock_map_fini_seq_private (void *priv_data) +{ +struct sock_map_seq_info *info = priv_data; + +bpf_map_put_with_uref (info->map); +} +static const struct bpf_iter_seq_info sock_map_iter_seq_info = { .seq_ops = &sock_map_seq_ops, .init_seq_private = sock_map_init_seq_private, + .fini_seq_private = sock_map_fini_seq_private, .seq_priv_size =sizeof (struct sock_map_seq_info ), };
@@ -1422,18 +1431,27 @@ static const struct seq_operations sock_ };static int sock_hash_init_seq_private (void *priv_data, -struct bpf_iter_aux_info *aux) +struct bpf_iter_aux_info *aux) {struct sock_hash_seq_info *info = priv_data; +bpf_map_inc_with_uref (aux->map); info->map = aux->map; info->htab = container_of(aux->map, struct bpf_shtab, map);return 0 ; } +static void sock_hash_fini_seq_private (void *priv_data) +{ +struct sock_hash_seq_info *info = priv_data; + +bpf_map_put_with_uref (info->map); +} +static const struct bpf_iter_seq_info sock_hash_iter_seq_info = { .seq_ops = &sock_hash_seq_ops, .init_seq_private = sock_hash_init_seq_private, + .fini_seq_private = sock_hash_fini_seq_private, .seq_priv_size =sizeof (struct sock_hash_seq_info ), };
Greg Kroah-Hartman
maintainerPATCH 31/158 bpf: Check the validity of max_rdwr_access for sock local storage map iterator
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
commit 52bd05eb7c88e1ad8541a48873188ccebca9da26 upstream.
The value of sock local storage map is writable in map iterator, so check max_rdwr_access instead of max_rdonly_access.
--- net/core/bpf_sk_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/bpf_sk_storage.c +1 -1
@@ -823,7 +823,7 @@ static int bpf_iter_attach_map(struct bpif (map->map_type !=BPF_MAP_TYPE_SK_STORAGE ) goto put_map; -if (prog->aux->max_rdonly_access > map->value_size) { +if (prog->aux->max_rdwr_access > map->value_size) { err = -EACCES ; goto put_map; }
Greg Kroah-Hartman
maintainerPATCH 32/158 can: mcp251x: Fix race condition on receive interrupt
In reply to Greg Kroah-HartmanFrom: Sebastian Würl <[email protected]>
commit d80d60b0db6ff3dd2e29247cc2a5166d7e9ae37e upstream.
The mcp251x driver uses both receiving mailboxes of the CAN controller chips. For retrieving the CAN frames from the controller via SPI, it checks once per interrupt which mailboxes have been filled and will retrieve the messages accordingly.
This introduces a race condition, as another CAN frame can enter mailbox 1 while mailbox 0 is emptied. If now another CAN frame enters mailbox 0 until the interrupt handler is called next, mailbox 0 is emptied before mailbox 1, leading to out-of-order CAN frames in the network device.
This is fixed by checking the interrupt flags once again after freeing mailbox 0, to correctly also empty mailbox 1 before leaving the handler.
For reproducing the bug I created the following setup:
- Two CAN devices, one Raspberry Pi with MCP2515, the other can be any.
- Setup CAN to 1 MHz
- Spam bursts of 5 CAN-messages with increasing CAN-ids
- Continue sending the bursts while sleeping a second between the bursts
- Check on the RPi whether the received messages have increasing CAN-ids
- Without this patch, every burst of messages will contain a flipped pair
v3: https://lore.kernel.org/all/[email protected]
v2: https://lore.kernel.org/all/[email protected]
v1: https://lore.kernel.org/all/[email protected]
--- drivers/net/can/spi/mcp251x.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/net/can/spi/mcp251x.c +15 -3
@@ -1074,9 +1074,6 @@ static irqreturn_t mcp251x_can_ist(int imcp251x_read_2regs (spi,CANINTF , &intf, &eflag); -/* mask out flags we don't care about */ - intf &=CANINTF_RX |CANINTF_TX |CANINTF_ERR ; -/* receive buffer 0 */ if (intf &CANINTF_RX0IF ) {mcp251x_hw_rx (spi,0 );
@@ -1086,6 +1083,18 @@ static irqreturn_t mcp251x_can_ist(int iif (mcp251x_is_2510 (spi))mcp251x_write_bits (spi,CANINTF ,CANINTF_RX0IF ,0x00 ); + +/* check if buffer 1 is already known to be full, no need to re-read */ +if (!(intf &CANINTF_RX1IF )) { +u8 intf1, eflag1; + +/* intf needs to be read again to avoid a race condition */ +mcp251x_read_2regs (spi,CANINTF , &intf1, &eflag1); + +/* combine flags from both operations for error handling */ + intf |= intf1; + eflag |= eflag1; + } }/* receive buffer 1 */
@@ -1096,6 +1105,9 @@ static irqreturn_t mcp251x_can_ist(int i clear_intf |=CANINTF_RX1IF ; } +/* mask out flags we don't care about */ + intf &=CANINTF_RX |CANINTF_TX |CANINTF_ERR ; +/* any error or tx interrupt we need to clear? */ if (intf & (CANINTF_ERR |CANINTF_TX )) clear_intf |= intf & (CANINTF_ERR |CANINTF_TX );
Greg Kroah-Hartman
maintainerPATCH 33/158 net: atlantic: fix aq_vec index out of range error
In reply to Greg Kroah-HartmanFrom: Chia-Lin Kao (AceLan) <[email protected]>
commit 2ba5e47fb75fbb8fab45f5c1bc8d5c33d8834bd3 upstream.
The final update statement of the for loop exceeds the array range, the dereference of self->aq_vec[i] is not checked and then leads to the index out of range error.
Also fixed this kind of coding style in other for loop.
[ 97.937604] UBSAN: array-index-out-of-bounds in drivers/net/ethernet/aquantia/atlantic/aq_nic.c:1404:48 [ 97.937607] index 8 is out of range for type 'aq_vec_s *[8]' [ 97.937608] CPU: 38 PID: 3767 Comm: kworker/u256:18 Not tainted 5.19.0+ #2 [ 97.937610] Hardware name: Dell Inc. Precision 7865 Tower/, BIOS 1.0.0 06/12/2022 [ 97.937611] Workqueue: events_unbound async_run_entry_fn [ 97.937616] Call Trace: [ 97.937617] <TASK> [ 97.937619] dump_stack_lvl+0x49/0x63 [ 97.937624] dump_stack+0x10/0x16 [ 97.937626] ubsan_epilogue+0x9/0x3f [ 97.937627] __ubsan_handle_out_of_bounds.cold+0x44/0x49 [ 97.937629] ? __scm_send+0x348/0x440 [ 97.937632] ? aq_vec_stop+0x72/0x80 [atlantic] [ 97.937639] aq_nic_stop+0x1b6/0x1c0 [atlantic] [ 97.937644] aq_suspend_common+0x88/0x90 [atlantic] [ 97.937648] aq_pm_suspend_poweroff+0xe/0x20 [atlantic] [ 97.937653] pci_pm_suspend+0x7e/0x1a0 [ 97.937655] ? pci_pm_suspend_noirq+0x2b0/0x2b0 [ 97.937657] dpm_run_callback+0x54/0x190 [ 97.937660] __device_suspend+0x14c/0x4d0 [ 97.937661] async_suspend+0x23/0x70 [ 97.937663] async_run_entry_fn+0x33/0x120 [ 97.937664] process_one_work+0x21f/0x3f0 [ 97.937666] worker_thread+0x4a/0x3c0 [ 97.937668] ? process_one_work+0x3f0/0x3f0 [ 97.937669] kthread+0xf0/0x120 [ 97.937671] ? kthread_complete_and_exit+0x20/0x20 [ 97.937672] ret_from_fork+0x22/0x30 [ 97.937676] </TASK>
v2. fixed "warning: variable 'aq_vec' set but not used"
v3. simplified a for loop
--- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +8 -13
@@ -265,12 +265,10 @@ static void aq_nic_service_timer_cb(strustatic void aq_nic_polling_timer_cb (struct timer_list *t) {struct aq_nic_s *self =from_timer (self, t, polling_timer); -struct aq_vec_s *aq_vec =NULL ;unsigned int i =0U ; -for (i =0U , aq_vec = self->aq_vec[0 ]; - self->aq_vecs > i; ++i, aq_vec = self->aq_vec[i]) -aq_vec_isr (i, (void *)aq_vec); +for (i =0U ; self->aq_vecs > i; ++i) +aq_vec_isr (i, (void *)self->aq_vec[i]);mod_timer (&self->polling_timer, jiffies +AQ_CFG_POLLING_TIMER_INTERVAL );
@@ -872,7 +870,6 @@ int aq_nic_get_regs_count(struct aq_nic_u64 *aq_nic_get_stats (struct aq_nic_s *self,u64 *data) { -struct aq_vec_s *aq_vec =NULL ;struct aq_stats_s *stats;unsigned int count =0U ;unsigned int i =0U ;
@@ -922,11 +919,11 @@ u64 *aq_nic_get_stats(struct aq_nic_s *s data += i;for (tc =0U ; tc < self->aq_nic_cfg.tcs; tc++) { -for (i =0U , aq_vec = self->aq_vec[0 ]; - aq_vec && self->aq_vecs > i; - ++i, aq_vec = self->aq_vec[i]) { +for (i =0U ; self->aq_vecs > i; ++i) { +if (!self->aq_vec[i]) +break ; data += count; - count =aq_vec_get_sw_stats (aq_vec, tc, data); + count =aq_vec_get_sw_stats (self->aq_vec[i], tc, data); } }
@@ -1240,7 +1237,6 @@ int aq_nic_set_loopback(struct aq_nic_sint aq_nic_stop (struct aq_nic_s *self) { -struct aq_vec_s *aq_vec =NULL ;unsigned int i =0U ;netif_tx_disable (self->ndev);
@@ -1258,9 +1254,8 @@ int aq_nic_stop(struct aq_nic_s *self)aq_ptp_irq_free (self); -for (i =0U , aq_vec = self->aq_vec[0 ]; - self->aq_vecs > i; ++i, aq_vec = self->aq_vec[i]) -aq_vec_stop (aq_vec); +for (i =0U ; self->aq_vecs > i; ++i) +aq_vec_stop (self->aq_vec[i]);aq_ptp_ring_stop (self);
Greg Kroah-Hartman
maintainerPATCH 34/158 sunrpc: fix expiry of auth creds
In reply to Greg Kroah-HartmanFrom: Dan Aloni <[email protected]>
commit f1bafa7375c01ff71fb7cb97c06caadfcfe815f3 upstream.
Before this commit, with a large enough LRU of expired items (100), the loop skipped all the expired items and was entirely ineffectual in trimming the LRU list.
--- net/sunrpc/auth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/auth.c +1 -1
@@ -445,7 +445,7 @@ rpcauth_prune_expired(struct list_head ** Enforce a 60 second garbage collection moratorium * Note that the cred_unused list must be time-ordered. */ -if (!time_in_range (cred->cr_expire, expired, jiffies)) +if (time_in_range (cred->cr_expire, expired, jiffies))continue ;if (!rpcauth_unhash_cred (cred))continue ;
Greg Kroah-Hartman
maintainerPATCH 35/158 SUNRPC: Reinitialise the backchannel request buffers before reuse
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
commit 6622e3a73112fc336c1c2c582428fb5ef18e456a upstream.
When we're reusing the backchannel requests instead of freeing them, then we should reinitialise any values of the send/receive xdr_bufs so that they reflect the available space.
--- net/sunrpc/backchannel_rqst.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
net/sunrpc/backchannel_rqst.c +14 -0
@@ -64,6 +64,17 @@ static void xprt_free_allocation(structkfree (req); } +static void xprt_bc_reinit_xdr_buf (struct xdr_buf *buf) +{ + buf->head[0 ].iov_len =PAGE_SIZE ; + buf->tail[0 ].iov_len =0 ; + buf->pages =NULL ; + buf->page_len =0 ; + buf->flags =0 ; + buf->len =0 ; + buf->buflen =PAGE_SIZE ; +} +static int xprt_alloc_xdr_buf (struct xdr_buf *buf,gfp_t gfp_flags) {struct page *page;
@@ -292,6 +303,9 @@ void xprt_free_bc_rqst(struct rpc_rqst **/ spin_lock_bh (&xprt->bc_pa_lock);if (xprt_need_to_requeue (xprt)) { +xprt_bc_reinit_xdr_buf (&req->rq_snd_buf); +xprt_bc_reinit_xdr_buf (&req->rq_rcv_buf); + req->rq_rcv_buf.len =PAGE_SIZE ;list_add_tail (&req->rq_bc_pa_list, &xprt->bc_pa_list); xprt->bc_alloc_count++;atomic_inc (&xprt->bc_slot_count);
Greg Kroah-Hartman
maintainerPATCH 36/158 virtio_net: fix memory leak inside XPD_TX with mergeable
In reply to Greg Kroah-HartmanFrom: Xuan Zhuo <[email protected]>
commit 7a542bee27c6a57e45c33cbbdc963325fd6493af upstream.
When we call xdp_convert_buff_to_frame() to get xdpf, if it returns NULL, we should check if xdp_page was allocated by xdp_linearize_page(). If it is newly allocated, it should be freed here alone. Just like any other "goto err_xdp".
--- drivers/net/virtio_net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/virtio_net.c +4 -1
@@ -968,8 +968,11 @@ static struct sk_buff *receive_mergeablecase XDP_TX : stats->xdp_tx++; xdpf =xdp_convert_buff_to_frame (&xdp); -if (unlikely (!xdpf)) +if (unlikely (!xdpf)) { +if (unlikely (xdp_page != page)) +put_page (xdp_page); goto err_xdp; + } err =virtnet_xdp_xmit (dev,1 , &xdpf,0 );if (unlikely (err <0 )) {trace_xdp_exception (vi->dev, xdp_prog, act);
Greg Kroah-Hartman
maintainerPATCH 37/158 devlink: Fix use-after-free after a failed reload
In reply to Greg Kroah-HartmanFrom: Ido Schimmel <[email protected]>
commit 6b4db2e528f650c7fb712961aac36455468d5902 upstream.
After a failed devlink reload, devlink parameters are still registered, which means user space can set and get their values. In the case of the mlxsw "acl_region_rehash_interval" parameter, these operations will trigger a use-after-free [1].
Fix this by rejecting set and get operations while in the failed state. Return the "-EOPNOTSUPP" error code which does not abort the parameters dump, but instead causes it to skip over the problematic parameter.
Another possible fix is to perform these checks in the mlxsw parameter callbacks, but other drivers might be affected by the same problem and I am not aware of scenarios where these stricter checks will cause a regression.
[1]mlxsw_spectrum3 0000:00:10.0: Port 125: Failed to register netdev mlxsw_spectrum3 0000:00:10.0: Failed to create ports
==================================================================
BUG: KASAN: use-after-free in mlxsw_sp_acl_tcam_vregion_rehash_intrvl_get+0xbd/0xd0 drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c:904
Read of size 4 at addr ffff8880099dcfd8 by task kworker/u4:4/777
CPU: 1 PID: 777 Comm: kworker/u4:4 Not tainted 5.19.0-rc7-custom-126601-gfe26f28c586d #1
Hardware name: QEMU MSN4700, BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
Workqueue: netns cleanup_net
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x92/0xbd lib/dump_stack.c:106
print_address_description mm/kasan/report.c:313 [inline]
print_report.cold+0x5e/0x5cf mm/kasan/report.c:429
kasan_report+0xb9/0xf0 mm/kasan/report.c:491
__asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:306
mlxsw_sp_acl_tcam_vregion_rehash_intrvl_get+0xbd/0xd0 drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c:904
mlxsw_sp_acl_region_rehash_intrvl_get+0x49/0x60 drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c:1106
mlxsw_sp_params_acl_region_rehash_intrvl_get+0x33/0x80 drivers/net/ethernet/mellanox/mlxsw/spectrum.c:3854
devlink_param_get net/core/devlink.c:4981 [inline]
devlink_nl_param_fill+0x238/0x12d0 net/core/devlink.c:5089
devlink_param_notify+0xe5/0x230 net/core/devlink.c:5168
devlink_ns_change_notify net/core/devlink.c:4417 [inline]
devlink_ns_change_notify net/core/devlink.c:4396 [inline]
devlink_reload+0x15f/0x700 net/core/devlink.c:4507
devlink_pernet_pre_exit+0x112/0x1d0 net/core/devlink.c:12272
ops_pre_exit_list net/core/net_namespace.c:152 [inline]
cleanup_net+0x494/0xc00 net/core/net_namespace.c:582
process_one_work+0x9fc/0x1710 kernel/workqueue.c:2289
worker_thread+0x675/0x10b0 kernel/workqueue.c:2436
kthread+0x30c/0x3d0 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
</TASK>
The buggy address belongs to the physical page:
page:ffffea0000267700 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x99dc
flags: 0x100000000000000(node=0|zone=1)
raw: 0100000000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8880099dce80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff8880099dcf00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8880099dcf80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff8880099dd000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff8880099dd080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================--- net/core/devlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/devlink.c +2 -2
@@ -3620,7 +3620,7 @@ static int devlink_param_get(struct devl const struct devlink_param *param, struct devlink_param_gset_ctx *ctx) { - if (!param->get) + if (!param->get || devlink->reload_failed) return -EOPNOTSUPP;return param->get (devlink, param->id, ctx); }
@@ -3629,7 +3629,7 @@ static int devlink_param_set(struct devl const struct devlink_param *param, struct devlink_param_gset_ctx *ctx) { - if (!param->set) + if (!param->set || devlink->reload_failed) return -EOPNOTSUPP;return param->set (devlink, param->id, ctx); }
Greg Kroah-Hartman
maintainerPATCH 38/158 net: bgmac: Fix a BUG triggered by wrong bytes_compl
In reply to Greg Kroah-HartmanFrom: Sandor Bodo-Merle <[email protected]>
commit 1b7680c6c1f6de9904f1d9b05c952f0c64a03350 upstream.
On one of our machines we got:
kernel BUG at lib/dynamic_queue_limits.c:27!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM CPU: 0 PID: 1166 Comm: irq/41-bgmac Tainted: G W O 4.14.275-rt132 #1 Hardware name: BRCM XGS iProc task: ee3415c0 task.stack: ee32a000 PC is at dql_completed+0x168/0x178 LR is at bgmac_poll+0x18c/0x6d8 pc : [<c03b9430>] lr : [<c04b5a18>] psr: 800a0313
sp : ee32be14 ip : 000005ea fp : 00000bd4
r10: ee558500 r9 : c0116298 r8 : 00000002
r7 : 00000000 r6 : ef128810 r5 : 01993267 r4 : 01993851 r3 : ee558000 r2 : 000070e1 r1 : 00000bd4 r0 : ee52c180
Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
Control: 12c5387d Table: 8e88c04a DAC: 00000051 Process irq/41-bgmac (pid: 1166, stack limit = 0xee32a210)
Stack: (0xee32be14 to 0xee32c000)
be00: ee558520 ee52c100 ef128810
be20: 00000000 00000002 c0116298 c04b5a18 00000000 c0a0c8c4 c0951780 00000040
be40: c0701780 ee558500 ee55d520 ef05b340 ef6f9780 ee558520 00000001 00000040
be60: ffffe000 c0a56878 ef6fa040 c0952040 0000012c c0528744 ef6f97b0 fffcfb6a
be80: c0a04104 2eda8000 c0a0c4ec c0a0d368 ee32bf44 c0153534 ee32be98 ee32be98
bea0: ee32bea0 ee32bea0 ee32bea8 ee32bea8 00000000 c01462e4 ffffe000 ef6f22a8
bec0: ffffe000 00000008 ee32bee4 c0147430 ffffe000 c094a2a8 00000003 ffffe000
bee0: c0a54528 00208040 0000000c c0a0c8c4 c0a65980 c0124d3c 00000008 ee558520
bf00: c094a23c c0a02080 00000000 c07a9910 ef136970 ef136970 ee30a440 ef136900
bf20: ee30a440 00000001 ef136900 ee30a440 c016d990 00000000 c0108db0 c012500c
bf40: ef136900 c016da14 ee30a464 ffffe000 00000001 c016dd14 00000000 c016db28
bf60: ffffe000 ee21a080 ee30a400 00000000 ee32a000 ee30a440 c016dbfc ee25fd70
bf80: ee21a09c c013edcc ee32a000 ee30a400 c013ec7c 00000000 00000000 00000000
bfa0: 00000000 00000000 00000000 c0108470 00000000 00000000 00000000 00000000
bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000 [<c03b9430>] (dql_completed) from [<c04b5a18>] (bgmac_poll+0x18c/0x6d8) [<c04b5a18>] (bgmac_poll) from [<c0528744>] (net_rx_action+0x1c4/0x494) [<c0528744>] (net_rx_action) from [<c0124d3c>] (do_current_softirqs+0x1ec/0x43c) [<c0124d3c>] (do_current_softirqs) from [<c012500c>] (__local_bh_enable+0x80/0x98) [<c012500c>] (__local_bh_enable) from [<c016da14>] (irq_forced_thread_fn+0x84/0x98) [<c016da14>] (irq_forced_thread_fn) from [<c016dd14>] (irq_thread+0x118/0x1c0) [<c016dd14>] (irq_thread) from [<c013edcc>] (kthread+0x150/0x158) [<c013edcc>] (kthread) from [<c0108470>] (ret_from_fork+0x14/0x24)
Code: a83f15e0 0200001a 0630a0e1 c3ffffea (f201f0e7)
The issue seems similar to commit 90b3b339364c ("net: hisilicon: Fix a BUG trigered by wrong bytes_compl") and potentially introduced by commit b38c83dd0866 ("bgmac: simplify tx ring index handling").
If there is an RX interrupt between setting ring->end
and netdev_sent_queue() we can hit the BUG_ON as bgmac_dma_tx_free() can miscalculate the queue size while called from bgmac_poll().
The machine which triggered the BUG runs a v4.14 RT kernel - but the issue seems present in mainline too.
--- drivers/net/ethernet/broadcom/bgmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bgmac.c +1 -1
@@ -189,8 +189,8 @@ static netdev_tx_t bgmac_dma_tx_add(stru } slot->skb = skb; - ring->end += nr_frags +1 ;netdev_sent_queue (net_dev, skb->len); + ring->end += nr_frags +1 ;wmb ();
Greg Kroah-Hartman
maintainerPATCH 39/158 pinctrl: nomadik: Fix refcount leak in nmk_pinctrl_dt_subnode_to_map
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
commit 4b32e054335ea0ce50967f63a7bfd4db058b14b9 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."
--- drivers/pinctrl/nomadik/pinctrl-nomadik.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pinctrl/nomadik/pinctrl-nomadik.c +3 -1
@@ -1421,8 +1421,10 @@ static int nmk_pinctrl_dt_subnode_to_map has_config =nmk_pinctrl_dt_get_config (np, &configs); np_config =of_parse_phandle (np,"ste,config" ,0 ); -if (np_config) +if (np_config) { has_config |=nmk_pinctrl_dt_get_config (np_config, &configs); +of_node_put (np_config); + }if (has_config) {const char *gpio_name;const char *pin;
Greg Kroah-Hartman
maintainerPATCH 40/158 pinctrl: qcom: msm8916: Allow CAMSS GP clocks to be muxed
In reply to Greg Kroah-HartmanFrom: Nikita Travkin <[email protected]>
commit 44339391c666e46cba522d19c65a6ad1071c68b7 upstream.
GPIO 31, 32 can be muxed to GCC_CAMSS_GP(1,2)_CLK respectively but the function was never assigned to the pingroup (even though the function exists already).
Add this mode to the related pins.
--- drivers/pinctrl/qcom/pinctrl-msm8916.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/qcom/pinctrl-msm8916.c +2 -2
@@ -844,8 +844,8 @@ static const struct msm_pingroup msm8916PINGROUP (28 , pwr_modem_enabled_a,NA ,NA ,NA ,NA ,NA , qdss_tracedata_b,NA , atest_combodac),PINGROUP (29 , cci_i2c,NA ,NA ,NA ,NA ,NA , qdss_tracedata_b,NA , atest_combodac),PINGROUP (30 , cci_i2c,NA ,NA ,NA ,NA ,NA ,NA ,NA , qdss_tracedata_b), -PINGROUP (31 , cci_timer0,NA ,NA ,NA ,NA ,NA ,NA ,NA ,NA ), -PINGROUP (32 , cci_timer1,NA ,NA ,NA ,NA ,NA ,NA ,NA ,NA ), +PINGROUP (31 , cci_timer0, flash_strobe,NA ,NA ,NA ,NA ,NA ,NA ,NA ), +PINGROUP (32 , cci_timer1, flash_strobe,NA ,NA ,NA ,NA ,NA ,NA ,NA ),PINGROUP (33 , cci_async,NA ,NA ,NA ,NA ,NA ,NA ,NA , qdss_tracedata_b),PINGROUP (34 , pwr_nav_enabled_a,NA ,NA ,NA ,NA ,NA ,NA ,NA , qdss_tracedata_b), PINGROUP(35, pwr_crypto_enabled_a, NA, NA, NA, NA, NA, NA, NA, qdss_tracedata_b),
Greg Kroah-Hartman
maintainerPATCH 41/158 pinctrl: sunxi: Add I/O bias setting for H6 R-PIO
In reply to Greg Kroah-HartmanFrom: Samuel Holland <[email protected]>
commit fc153c8f283bf5925615195fc9d4056414d7b168 upstream.
H6 requires I/O bias configuration on both of its PIO devices. Previously it was only done for the main PIO.
The setting for Port L is at bit 0, so the bank calculation needs to account for the pin base. Otherwise the wrong bit is used.
--- drivers/pinctrl/sunxi/pinctrl-sun50i-h6-r.c | 1 + drivers/pinctrl/sunxi/pinctrl-sunxi.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/pinctrl/sunxi/pinctrl-sun50i-h6-r.c +1 -0
@@ -105,6 +105,7 @@ static const struct sunxi_pinctrl_desc s .npins = ARRAY_SIZE(sun50i_h6_r_pins), .pin_base = PL_BASE, .irq_banks = 2, + .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_SEL, };static int sun50i_h6_r_pinctrl_probe (struct platform_device *pdev)
drivers/pinctrl/sunxi/pinctrl-sunxi.c +4 -3
@@ -624,7 +624,7 @@ static int sunxi_pinctrl_set_io_bias_cfgunsigned pin, struct regulator *supply) { - unsigned short bank = pin / PINS_PER_BANK; + unsigned short bank;unsigned long flags;u32 val, reg;int uV;
@@ -640,6 +640,9 @@ static int sunxi_pinctrl_set_io_bias_cfgif (uV ==0 )return 0 ; + pin -= pctl->desc->pin_base; + bank = pin /PINS_PER_BANK ; +switch (pctl->desc->io_bias_cfg_variant) {case BIAS_VOLTAGE_GRP_CONFIG :/*
@@ -657,8 +660,6 @@ static int sunxi_pinctrl_set_io_bias_cfgelse val =0xD ;/* 3.3V */ - pin -= pctl->desc->pin_base; - reg =readl (pctl->membase +sunxi_grp_config_reg (pin)); reg &= ~IO_BIAS_MASK ;writel (reg | val, pctl->membase +sunxi_grp_config_reg (pin));
Greg Kroah-Hartman
maintainerPATCH 42/158 pinctrl: qcom: sm8250: Fix PDC map
In reply to Greg Kroah-HartmanFrom: Jianhua Lu <[email protected]>
commit 4b759ca15a4914f96ea204ea9200ceeb01d70666 upstream.
Fix the PDC mapping for SM8250, gpio39 is mapped to irq73(not irq37).
--- drivers/pinctrl/qcom/pinctrl-sm8250.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/qcom/pinctrl-sm8250.c +1 -1
@@ -1316,7 +1316,7 @@ static const struct msm_pingroup sm8250_groups[] = {static const struct msm_gpio_wakeirq_map sm8250_pdc_map[] = { {0 ,79 }, {1 ,84 }, {2 ,80 }, {3 ,82 }, {4 ,107 }, {7 ,43 }, {11 ,42 }, {14 ,44 }, {15 ,52 }, {19 ,67 }, {23 ,68 }, {24 ,105 }, - {27 ,92 }, {28 ,106 }, {31 ,69 }, {35 ,70 }, {39 ,37 }, + {27 ,92 }, {28 ,106 }, {31 ,69 }, {35 ,70 }, {39 ,73 }, {40 ,108 }, {43 ,71 }, {45 ,72 }, {47 ,83 }, {51 ,74 }, {55 ,77 }, {59 ,78 }, {63 ,75 }, {64 ,81 }, {65 ,87 }, {66 ,88 }, {67 ,89 }, {68 ,54 }, {70 ,85 }, {77 ,46 }, {80 ,90 }, {81 ,91 }, {83 ,97 },
Signature · 1 line
2.37.2
Greg Kroah-Hartman
maintainerPATCH 43/158 um: Add missing apply_returns()
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
commit 637285e7f8d6da70a70c64e7895cb0672357a1f7 upstream.
Implement apply_returns() stub for UM, just like all the other patching routines.
--- arch/um/kernel/um_arch.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/um/kernel/um_arch.c +4 -0
@@ -367,6 +367,10 @@ void apply_returns(s32 *start, s32 *end) { } +void apply_returns (s32 *start,s32 *end) +{ +} +void apply_alternatives (struct alt_instr *start,struct alt_instr *end) { }
Greg Kroah-Hartman
maintainerPATCH 44/158 ACPI: property: Return type of acpi_add_nondev_subnodes() should be bool
In reply to Greg Kroah-HartmanFrom: Sakari Ailus <[email protected]>
commit 85140ef275f577f64e8a2c5789447222dfc14fc4 upstream.
The value acpi_add_nondev_subnodes() returns is bool so change the return type of the function to match that.
--- drivers/acpi/property.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/acpi/property.c +4 -4
@@ -155,10 +155,10 @@ static bool acpi_nondev_subnode_ok(acpi_return acpi_nondev_subnode_data_ok (handle, link, list, parent); } -static int acpi_add_nondev_subnodes (acpi_handle scope, -const union acpi_object *links, -struct list_head *list, -struct fwnode_handle *parent) +static bool acpi_add_nondev_subnodes (acpi_handle scope, +const union acpi_object *links, +struct list_head *list, +struct fwnode_handle *parent) {bool ret = false;int i;
Greg Kroah-Hartman
maintainerPATCH 45/158 geneve: do not use RT_TOS for IPv6 flowlabel
In reply to Greg Kroah-HartmanFrom: Matthias May <[email protected]>
commit ca2bb69514a8bc7f83914122f0d596371352416c upstream.
According to Guillaume Nault RT_TOS should never be used for IPv6.
Quote:RT_TOS() is an old macro used to interprete IPv4 TOS as described in the obsolete RFC 1349. It's conceptually wrong to use it even in IPv4 code, although, given the current state of the code, most of the existing calls have no consequence.
But using RT_TOS() in IPv6 code is always a bug: IPv6 never had a "TOS" field to be interpreted the RFC 1349 way. There's no historical compatibility to worry about.
--- drivers/net/geneve.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/geneve.c +1 -2
@@ -850,8 +850,7 @@ static struct dst_entry *geneve_get_v6_d use_cache = false; } - fl6->flowlabel =ip6_make_flowinfo (RT_TOS (prio), - info->key.label); + fl6->flowlabel =ip6_make_flowinfo (prio, info->key.label); dst_cache = (struct dst_cache *)&info->dst_cache;if (use_cache) { dst =dst_cache_get_ip6 (dst_cache, &fl6->saddr);
Greg Kroah-Hartman
maintainerPATCH 46/158 ipv6: do not use RT_TOS for IPv6 flowlabel
In reply to Greg Kroah-HartmanFrom: Matthias May <[email protected]>
commit ab7e2e0dfa5d37540ab1dc5376e9a2cb9188925d upstream.
According to Guillaume Nault RT_TOS should never be used for IPv6.
Quote:RT_TOS() is an old macro used to interprete IPv4 TOS as described in the obsolete RFC 1349. It's conceptually wrong to use it even in IPv4 code, although, given the current state of the code, most of the existing calls have no consequence.
But using RT_TOS() in IPv6 code is always a bug: IPv6 never had a "TOS" field to be interpreted the RFC 1349 way. There's no historical compatibility to worry about.
--- net/ipv6/ip6_output.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/ipv6/ip6_output.c +1 -2
@@ -1313,8 +1313,7 @@ struct dst_entry *ip6_dst_lookup_tunnel( fl6.daddr = info->key.u.ipv6.dst; fl6.saddr = info->key.u.ipv6.src; prio = info->key.tos; - fl6.flowlabel =ip6_make_flowinfo (RT_TOS (prio), - info->key.label); + fl6.flowlabel =ip6_make_flowinfo (prio, info->key.label); dst = ipv6_stub->ipv6_dst_lookup_flow (net, sock->sk, &fl6,NULL );
Greg Kroah-Hartman
maintainerPATCH 47/158 plip: avoid rcu debug splat
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
commit bc3c8fe3c79bcdae4d90e3726054fac5cca8ac32 upstream.
WARNING: suspicious RCU usage 5.2.0-rc2-00605-g2638eb8b50cfc #1 Not tainted drivers/net/plip/plip.c:1110 suspicious rcu_dereference_check() usage!
plip_open is called with RTNL held, switch to the correct helper.
--- drivers/net/plip/plip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/plip/plip.c +1 -1
@@ -1103,7 +1103,7 @@ plip_open(struct net_device *dev)/* Any address will do - we take the first. We already have the first two bytes filled with 0xfc, from plip_init_dev(). */ -const struct in_ifaddr *ifa =rcu_dereference (in_dev->ifa_list); +const struct in_ifaddr *ifa =rtnl_dereference (in_dev->ifa_list);if (ifa !=NULL ) {memcpy (dev->dev_addr+2 , &ifa->ifa_local,4 ); }
Greg Kroah-Hartman
maintainerPATCH 48/158 vsock: Fix memory leak in vsock_connect()
In reply to Greg Kroah-HartmanFrom: Peilin Ye <[email protected]>
commit 7e97cfed9929eaabc41829c395eb0d1350fccb9d upstream.
An O_NONBLOCK vsock_connect() request may try to reschedule @connect_work. Imagine the following sequence of vsock_connect() requests:
1. The 1st, non-blocking request schedules @connect_work, which will
expire after 200 jiffies. Socket state is now SS_CONNECTING;
2. Later, the 2nd, blocking request gets interrupted by a signal after a few jiffies while waiting for the connection to be established. Socket state is back to SS_UNCONNECTED, but @connect_work is still pending, and will expire after 100 jiffies.
3. Now, the 3rd, non-blocking request tries to schedule @connect_work again. Since @connect_work is already scheduled, schedule_delayed_work() silently returns. sock_hold() is called twice, but sock_put() will only be called once in vsock_connect_timeout(), causing a memory leak reported by syzbot:
BUG: memory leak
unreferenced object 0xffff88810ea56a40 (size 1232):
comm "syz-executor756", pid 3604, jiffies 4294947681 (age 12.350s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
28 00 07 40 00 00 00 00 00 00 00 00 00 00 00 00 (..@............
backtrace:
[<ffffffff837c830e>] sk_prot_alloc+0x3e/0x1b0 net/core/sock.c:1930
[<ffffffff837cbe22>] sk_alloc+0x32/0x2e0 net/core/sock.c:1989
[<ffffffff842ccf68>] __vsock_create.constprop.0+0x38/0x320 net/vmw_vsock/af_vsock.c:734
[<ffffffff842ce8f1>] vsock_create+0xc1/0x2d0 net/vmw_vsock/af_vsock.c:2203
[<ffffffff837c0cbb>] __sock_create+0x1ab/0x2b0 net/socket.c:1468
[<ffffffff837c3acf>] sock_create net/socket.c:1519 [inline]
[<ffffffff837c3acf>] __sys_socket+0x6f/0x140 net/socket.c:1561
[<ffffffff837c3bba>] __do_sys_socket net/socket.c:1570 [inline]
[<ffffffff837c3bba>] __se_sys_socket net/socket.c:1568 [inline]
[<ffffffff837c3bba>] __x64_sys_socket+0x1a/0x20 net/socket.c:1568
[<ffffffff84512815>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff84512815>] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae
<...>Use mod_delayed_work() instead: if @connect_work is already scheduled, reschedule it, and undo sock_hold() to keep the reference count balanced.
--- net/vmw_vsock/af_vsock.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/vmw_vsock/af_vsock.c +8 -1
@@ -1347,7 +1347,14 @@ static int vsock_stream_connect(struct s* timeout fires. */ sock_hold (sk); -schedule_delayed_work (&vsk->connect_work, timeout); + +/* If the timeout function is already scheduled, +* reschedule it, then ungrab the socket refcount to +* keep it balanced. +*/ +if (mod_delayed_work (system_wq, &vsk->connect_work, + timeout)) +sock_put (sk);/* Skip ahead to preserve error code set above. */ goto out_wait;
Greg Kroah-Hartman
maintainerPATCH 49/158 vsock: Set socket state back to SS_UNCONNECTED in vsock_connect_timeout()
In reply to Greg Kroah-HartmanFrom: Peilin Ye <[email protected]>
commit a3e7b29e30854ed67be0d17687e744ad0c769c4b upstream.
Imagine two non-blocking vsock_connect() requests on the same socket. The first request schedules @connect_work, and after it times out, vsock_connect_timeout() sets *sock* state back to TCP_CLOSE, but keeps *socket* state as SS_CONNECTING.
Later, the second request returns -EALREADY, meaning the socket "already has a pending connection in progress", even though the first request has already timed out.
As suggested by Stefano, fix it by setting *socket* state back to SS_UNCONNECTED, so that the second request will return -ETIMEDOUT.
--- net/vmw_vsock/af_vsock.c | 1 + 1 file changed, 1 insertion(+)
net/vmw_vsock/af_vsock.c +1 -0
@@ -1242,6 +1242,7 @@ static void vsock_connect_timeout(structif (sk->sk_state ==TCP_SYN_SENT && (sk->sk_shutdown !=SHUTDOWN_MASK )) { sk->sk_state =TCP_CLOSE ; + sk->sk_socket->state =SS_UNCONNECTED ; sk->sk_err =ETIMEDOUT ; sk->sk_error_report (sk);vsock_transport_cancel_pkt (vsk);
Greg Kroah-Hartman
maintainerPATCH 50/158 dt-bindings: arm: qcom: fix MSM8916 MTP compatibles
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit bb35fe1efbae4114bd288fae0f56070f563adcfc upstream.
The order of compatibles for MSM8916 MTP board is different:
msm8916-mtp.dtb: /: compatible: 'oneOf' conditional failed, one must be fixed:
['qcom,msm8916-mtp', 'qcom,msm8916-mtp/1', 'qcom,msm8916'] is too long
--- Documentation/devicetree/bindings/arm/qcom.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/arm/qcom.yaml +1 -1
@@ -123,8 +123,8 @@ properties: - const: qcom,msm8974 - items: - - const: qcom,msm8916-mtp/1 - const: qcom,msm8916-mtp + - const: qcom,msm8916-mtp/1 - const: qcom,msm8916 - items:
Greg Kroah-Hartman
maintainerPATCH 51/158 dt-bindings: clock: qcom,gcc-msm8996: add more GCC clock sources
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
commit 2b4e75a7a7c8d3531a40ebb103b92f88ff693f79 upstream.
Add additional GCC clock sources. This includes PCIe and USB PIPE and UFS symbol clocks.
--- Documentation/devicetree/bindings/clock/qcom,gcc-msm8996.yaml | 16 ++++++++++ 1 file changed, 16 insertions(+)
Documentation/devicetree/bindings/clock/qcom,gcc-msm8996.yaml +16 -0
@@ -22,16 +22,32 @@ properties: const: qcom,gcc-msm8996 clocks: + minItems: 3 items: - description: XO source - description: Second XO source - description: Sleep clock source + - description: PCIe 0 PIPE clock (optional) + - description: PCIe 1 PIPE clock (optional) + - description: PCIe 2 PIPE clock (optional) + - description: USB3 PIPE clock (optional) + - description: UFS RX symbol 0 clock (optional) + - description: UFS RX symbol 1 clock (optional) + - description: UFS TX symbol 0 clock (optional) clock-names: + minItems: 3 items: - const: cxo - const: cxo2 - const: sleep_clk + - const: pcie_0_pipe_clk_src + - const: pcie_1_pipe_clk_src + - const: pcie_2_pipe_clk_src + - const: usb3_phy_pipe_clk_src + - const: ufs_rx_symbol_0_clk_src + - const: ufs_rx_symbol_1_clk_src + - const: ufs_tx_symbol_0_clk_src '#clock-cells': const: 1
Greg Kroah-Hartman
maintainerPATCH 52/158 ceph: use correct index when encoding client supported features
In reply to Greg Kroah-HartmanFrom: Luís Henriques <[email protected]>
commit fea013e020e6ecc7be75bea0d61697b7e916b44d upstream.
Feature bits have to be encoded into the correct locations. This hasn't been an issue so far because the only hole in the feature bits was in bit 10 (CEPHFS_FEATURE_RECLAIM_CLIENT), which is located in the 2nd byte. When adding more bits that go beyond the this 2nd byte, the bug will show up.
[xiubli: remove incorrect comment for CEPHFS_FEATURES_CLIENT_SUPPORTED]
--- fs/ceph/mds_client.c | 7 +++++-- fs/ceph/mds_client.h | 6 ------ 2 files changed, 5 insertions(+), 8 deletions(-)
fs/ceph/mds_client.c +5 -2
@@ -1184,14 +1184,17 @@ static int encode_supported_features(voiif (count >0 ) {size_t i;size_t size =FEATURE_BYTES (count); +unsigned long bit;if (WARN_ON_ONCE (*p +4 + size > end))return -ERANGE ;ceph_encode_32 (p, size);memset (*p,0 , size); -for (i =0 ; i < count; i++) - ((unsigned char *)(*p))[i /8 ] |=BIT (feature_bits[i] %8 ); +for (i =0 ; i < count; i++) { + bit = feature_bits[i]; + ((unsigned char *)(*p))[bit /8 ] |=BIT (bit %8 ); + } *p += size; }else {if (WARN_ON_ONCE (*p +4 > end))
fs/ceph/mds_client.h +0 -6
@@ -33,10 +33,6 @@ enum ceph_feature_type { CEPHFS_FEATURE_MAX = CEPHFS_FEATURE_METRIC_COLLECT, }; -/* -* This will always have the highest feature bit value -* as the last element of the array. -*/ #define CEPHFS_FEATURES_CLIENT_SUPPORTED { \ 0, 1, 2, 3, 4, 5, 6, 7, \ CEPHFS_FEATURE_MIMIC, \
@@ -45,8 +41,6 @@ enum ceph_feature_type {CEPHFS_FEATURE_MULTI_RECONNECT , \CEPHFS_FEATURE_DELEG_INO , \CEPHFS_FEATURE_METRIC_COLLECT , \ - \ -CEPHFS_FEATURE_MAX , \ } #define CEPHFS_FEATURES_CLIENT_REQUIRED {}
Greg Kroah-Hartman
maintainerPATCH 53/158 tools/vm/slabinfo: use alphabetic order when two values are equal
In reply to Greg Kroah-HartmanFrom: Yuanzheng Song <[email protected]>
commit 4f5ceb8851f0081af54313abbf56de1615911faf upstream.
When the number of partial slabs in each cache is the same (e.g., the value are 0), the results of the slabinfo -X -N5 and slabinfo -P -N5 are different.
/ # slabinfo -X -N5
...
Slabs sorted by number of partial slabs
---------------------------------------
Name Objects Objsize Space Slabs/Part/Cpu O/S O %Fr %Ef Flg
inode_cache 15180 392 6217728 758/0/1 20 1 0 95 a kernfs_node_cache 22494 88 2002944 488/0/1 46 0 0 98 shmem_inode_cache 663 464 319488 38/0/1 17 1 0 96 biovec-max 50 3072 163840 4/0/1 10 3 0 93 A dentry 19050 136 2600960 633/0/2 30 0 0 99 a
/ # slabinfo -P -N5
Name Objects Objsize Space Slabs/Part/Cpu O/S O %Fr %Ef Flg bdev_cache 32 984 32.7K 1/0/1 16 2 0 96 Aa ext4_inode_cache 42 752 32.7K 1/0/1 21 2 0 96 a dentry 19050 136 2.6M 633/0/2 30 0 0 99 a TCPv6 17 1840 32.7K 0/0/1 17 3 0 95 A RAWv6 18 856 16.3K 0/0/1 18 2 0 94 A
This problem is caused by the sort_slabs(). So let's use alphabetic order when two values are equal in the sort_slabs().
By the way, the content of the slabinfo -h is not aligned because the
-P|--partial Sort by number of partial slabs
uses tabs instead of spaces. So let's use spaces instead of tabs to fix it.
--- tools/vm/slabinfo.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-)
tools/vm/slabinfo.c +22 -10
@@ -125,7 +125,7 @@ static void usage(void)"-n|--numa Show NUMA information\n" "-N|--lines=K Show the first K slabs\n" "-o|--ops Show kmem_cache_ops\n" -"-P|--partial Sort by number of partial slabs\n" +"-P|--partial Sort by number of partial slabs\n" "-r|--report Detailed report on single slabs\n" "-s|--shrink Shrink slabs\n" "-S|--Size Sort by size\n"
@@ -1045,15 +1045,27 @@ static void sort_slabs(void)for (s2 = s1 +1 ; s2 < slabinfo + slabs; s2++) {int result; -if (sort_size) - result =slab_size (s1) <slab_size (s2); -else if (sort_active) - result =slab_activity (s1) <slab_activity (s2); -else if (sort_loss) - result =slab_waste (s1) <slab_waste (s2); -else if (sort_partial) - result = s1->partial < s2->partial; -else +if (sort_size) { +if (slab_size (s1) ==slab_size (s2)) + result =strcasecmp (s1->name, s2->name); +else + result =slab_size (s1) <slab_size (s2); + }else if (sort_active) { +if (slab_activity (s1) ==slab_activity (s2)) + result =strcasecmp (s1->name, s2->name); +else + result =slab_activity (s1) <slab_activity (s2); + }else if (sort_loss) { +if (slab_waste (s1) ==slab_waste (s2)) + result =strcasecmp (s1->name, s2->name); +else + result =slab_waste (s1) <slab_waste (s2); + }else if (sort_partial) { +if (s1->partial == s2->partial) + result =strcasecmp (s1->name, s2->name); +else + result = s1->partial < s2->partial; + }else result =strcasecmp (s1->name, s2->name);if (show_inverted)
Greg Kroah-Hartman
maintainerPATCH 54/158 ceph: dont leak snap_rwsem in handle_cap_grant
In reply to Greg Kroah-HartmanFrom: Jeff Layton <[email protected]>
commit 58dd4385577ed7969b80cdc9e2a31575aba6c712 upstream.
When handle_cap_grant is called on an IMPORT op, then the snap_rwsem is held and the function is expected to release it before returning. It currently fails to do that in all cases which could lead to a deadlock.
--- fs/ceph/caps.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)
fs/ceph/caps.c +13 -14
@@ -3501,24 +3501,23 @@ static void handle_cap_grant(struct inod fill_inline = true; } -if (ci->i_auth_cap == cap && -le32_to_cpu (grant->op) ==CEPH_CAP_OP_IMPORT ) { -if (newcaps & ~extra_info->issued) - wake = true; +if (le32_to_cpu (grant->op) ==CEPH_CAP_OP_IMPORT ) { +if (ci->i_auth_cap == cap) { +if (newcaps & ~extra_info->issued) + wake = true; -if (ci->i_requested_max_size > max_size || - !(le32_to_cpu (grant->wanted) &CEPH_CAP_ANY_FILE_WR )) { -/* re-request max_size if necessary */ - ci->i_requested_max_size =0 ; - wake = true; - } +if (ci->i_requested_max_size > max_size || + !(le32_to_cpu (grant->wanted) &CEPH_CAP_ANY_FILE_WR )) { +/* re-request max_size if necessary */ + ci->i_requested_max_size =0 ; + wake = true; + } -ceph_kick_flushing_inode_caps (session, ci); -spin_unlock (&ci->i_ceph_lock); +ceph_kick_flushing_inode_caps (session, ci); + }up_read (&session->s_mdsc->snap_rwsem); - }else { -spin_unlock (&ci->i_ceph_lock); } +spin_unlock (&ci->i_ceph_lock);if (fill_inline) ceph_fill_inline_data(inode, NULL, extra_info->inline_data,
Greg Kroah-Hartman
maintainerPATCH 55/158 kbuild: dummy-tools: avoid tmpdir leak in dummy gcc
In reply to Greg Kroah-HartmanFrom: Ondrej Mosnacek <[email protected]>
commit aac289653fa5adf9e9985e4912c1d24a3e8cbab2 upstream.
When passed -print-file-name=plugin, the dummy gcc script creates a temporary directory that is never cleaned up. To avoid cluttering $TMPDIR, instead use a static directory included in the source tree.
--- .../dummy-tools/dummy-plugin-dir/include/plugin-version.h | 0 scripts/dummy-tools/gcc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) create mode 100644 scripts/dummy-tools/dummy-plugin-dir/include/plugin-version.h
scripts/dummy-tools/gcc +2 -6
@@ -77,12 +77,8 @@ fi # To set GCC_PLUGINS if arg_contain -print-file-name=plugin "$@"; then - plugin_dir=$(mktemp -d) - - mkdir -p $plugin_dir/include - touch $plugin_dir/include/plugin-version.h - - echo $plugin_dir + # Use $0 to find the in-tree dummy directory + echo "$(dirname "$(readlink -f "$0")")/dummy-plugin-dir" exit 0 fi
Greg Kroah-Hartman
maintainerPATCH 56/158 tools build: Switch to new openssl API for test-libcrypto
In reply to Greg Kroah-HartmanFrom: Roberto Sassu <[email protected]>
commit 5b245985a6de5ac18b5088c37068816d413fb8ed upstream.
Switch to new EVP API for detecting libcrypto, as Fedora 36 returns an error when it encounters the deprecated function MD5_Init() and the others.
The error would be interpreted as missing libcrypto, while in reality it is not.
--- tools/build/feature/test-libcrypto.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
tools/build/feature/test-libcrypto.c +11 -4
@@ -1,16 +1,23 @@// SPDX-License-Identifier: GPL-2.0 +#include <openssl/evp.h> #include <openssl/sha.h> #include <openssl/md5.h> int main (void ) { -MD5_CTX context; +EVP_MD_CTX *mdctx;unsigned char md[MD5_DIGEST_LENGTH +SHA_DIGEST_LENGTH ];unsigned char dat[] ="12345" ; +unsigned int digest_len; -MD5_Init (&context); -MD5_Update (&context, &dat[0 ],sizeof (dat)); -MD5_Final (&md[0 ], &context); + mdctx =EVP_MD_CTX_new (); +if (!mdctx) +return 0 ; + +EVP_DigestInit_ex (mdctx,EVP_md5 (),NULL ); +EVP_DigestUpdate (mdctx, &dat[0 ],sizeof (dat)); +EVP_DigestFinal_ex (mdctx, &md[0 ], &digest_len); +EVP_MD_CTX_free (mdctx);SHA1 (&dat[0 ],sizeof (dat), &md[0 ]);
Greg Kroah-Hartman
maintainerPATCH 57/158 NTB: ntb_tool: uninitialized heap data in tool_fn_write()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 45e1058b77feade4e36402828bfe3e0d3363177b upstream.
The call to:
ret = simple_write_to_buffer(buf, size, offp, ubuf, size);
will return success if it is able to write even one byte to "buf". The value of "*offp" controls which byte. This could result in reading uninitialized data when we do the sscanf() on the next line.
This code is not really desigined to handle partial writes where *offp is non-zero and the "buf" is preserved and re-used between writes. Just ban partial writes and replace the simple_write_to_buffer() with copy_from_user().
--- drivers/ntb/test/ntb_tool.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/ntb/test/ntb_tool.c +5 -3
@@ -367,14 +367,16 @@ static ssize_t tool_fn_write(struct toolu64 bits;int n; +if (*offp) +return 0 ; + buf =kmalloc (size +1 ,GFP_KERNEL );if (!buf)return -ENOMEM ; - ret =simple_write_to_buffer (buf, size, offp, ubuf, size); -if (ret <0 ) { +if (copy_from_user (buf, ubuf, size)) {kfree (buf); -return ret; +return -EFAULT ; } buf[size] =0 ;
Greg Kroah-Hartman
maintainerPATCH 58/158 nfp: ethtool: fix the display error of `ethtool -m DEVNAME`
In reply to Greg Kroah-HartmanFrom: Yu Xiao <[email protected]>
commit 4ae97cae07e15d41e5c0ebabba64c6eefdeb0bbe upstream.
The port flag isn't set to NFP_PORT_CHANGED when using ethtool -m DEVNAME before, so the port state (e.g. interface) cannot be updated. Therefore, it caused that ethtool -m DEVNAME sometimes cannot read the correct information.
E.g. ethtool -m DEVNAME cannot work when load driver before plug in optical module, as the port interface is still NONE without port update.
Now update the port state before sending info to NIC to ensure that port interface is correct (latest state).
--- drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c +2 -0
@@ -1225,6 +1225,8 @@ nfp_port_get_module_info(struct net_deviu8 data; port =nfp_port_from_netdev (netdev); +/* update port state to get latest interface */ +set_bit (NFP_PORT_CHANGED , &port->flags); eth_port =nfp_port_get_eth_port (port);if (!eth_port)return -EOPNOTSUPP ;
Greg Kroah-Hartman
maintainerPATCH 59/158 xen/xenbus: fix return type in xenbus_file_read()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 32ad11127b95236dfc52375f3707853194a7f4b4 upstream.
This code tries to store -EFAULT in an unsigned int. The xenbus_file_read() function returns type ssize_t so the negative value is returned as a positive value to the user.
This change forces another change to the min() macro. Originally, the min() macro used "unsigned" type which checkpatch complains about. Also unsigned type would break if "len" were not capped at MAX_RW_COUNT. Use size_t for the min(). (No effect on runtime for the min_t() change).
--- drivers/xen/xenbus/xenbus_dev_frontend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/xen/xenbus/xenbus_dev_frontend.c +2 -2
@@ -128,7 +128,7 @@ static ssize_t xenbus_file_read(struct f {struct xenbus_file_priv *u = filp->private_data;struct read_buffer *rb; -unsigned i; +ssize_t i;int ret;mutex_lock (&u->reply_mutex);
@@ -148,7 +148,7 @@ again: rb = list_entry(u->read_buffers.next, struct read_buffer, list); i =0 ;while (i < len) { -unsigned sz =min ((unsigned )len - i, rb->len - rb->cons); +size_t sz =min_t (size_t, len - i, rb->len - rb->cons); ret =copy_to_user (ubuf + i, &rb->msg[rb->cons], sz);
Greg Kroah-Hartman
maintainerPATCH 60/158 atm: idt77252: fix use-after-free bugs caused by tst_timer
In reply to Greg Kroah-HartmanFrom: Duoming Zhou <[email protected]>
commit 3f4093e2bf4673f218c0bf17d8362337c400e77b upstream.
There are use-after-free bugs caused by tst_timer. The root cause is that there are no functions to stop tst_timer in idt77252_exit(). One of the possible race conditions is shown below:
(thread 1) | (thread 2)
| idt77252_init_one
| init_card
| fill_tst
| mod_timer(&card->tst_timer, ...)
idt77252_exit | (wait a time)
| tst_timer
|
| ...
kfree(card) // FREE |
| card->soft_tst[e] // USEThe idt77252_dev is deallocated in idt77252_exit() and used in timer handler.
This patch adds del_timer_sync() in idt77252_exit() in order that the timer handler could be stopped before the idt77252_dev is deallocated.
--- drivers/atm/idt77252.c | 1 + 1 file changed, 1 insertion(+)
drivers/atm/idt77252.c +1 -0
@@ -3767,6 +3767,7 @@ static void __exit idt77252_exit(void) card = idt77252_chain; dev = card->atmdev; idt77252_chain = card->next; +del_timer_sync (&card->tst_timer);if (dev->phy->stop) dev->phy->stop (dev);
Greg Kroah-Hartman
maintainerPATCH 61/158 geneve: fix TOS inheriting for ipv4
In reply to Greg Kroah-HartmanFrom: Matthias May <[email protected]>
commit b4ab94d6adaa5cf842b68bd28f4b50bc774496bd upstream.
The current code retrieves the TOS field after the lookup on the ipv4 routing table. The routing process currently only allows routing based on the original 3 TOS bits, and not on the full 6 DSCP bits.
As a result the retrieved TOS is cut to the 3 bits. However for inheriting purposes the full 6 bits should be used.
Extract the full 6 bits before the route lookup and use that instead of the cut off 3 TOS bits.
--- drivers/net/geneve.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/geneve.c +8 -4
@@ -772,7 +772,8 @@ static struct rtable *geneve_get_v4_rt(sstruct geneve_sock *gs4, struct flowi4 *fl4, const struct ip_tunnel_info *info, - __be16 dport, __be16 sport) + __be16 dport, __be16 sport, + __u8 *full_tos) { bool use_cache = ip_tunnel_dst_cache_usable(skb, info);struct geneve_dev *geneve =netdev_priv (dev);
@@ -797,6 +798,8 @@ static struct rtable *geneve_get_v4_rt(s use_cache = false; } fl4->flowi4_tos =RT_TOS (tos); +if (full_tos) + *full_tos = tos; dst_cache = (struct dst_cache *)&info->dst_cache;if (use_cache) {
@@ -884,6 +887,7 @@ static int geneve_xmit_skb(struct sk_bufconst struct ip_tunnel_key *key = &info->key;struct rtable *rt;struct flowi4 fl4; +__u8 full_tos;__u8 tos, ttl;__be16 df =0 ;__be16 sport;
@@ -894,7 +898,7 @@ static int geneve_xmit_skb(struct sk_buf sport =udp_flow_src_port (geneve->net, skb,1 ,USHRT_MAX , true); rt =geneve_get_v4_rt (skb, dev, gs4, &fl4, info, - geneve->cfg.info.key.tp_dst, sport); + geneve->cfg.info.key.tp_dst, sport, &full_tos);if (IS_ERR (rt))return PTR_ERR (rt);
@@ -938,7 +942,7 @@ static int geneve_xmit_skb(struct sk_buf df = key->tun_flags &TUNNEL_DONT_FRAGMENT ?htons (IP_DF ) :0 ; }else { - tos =ip_tunnel_ecn_encap (fl4.flowi4_tos,ip_hdr (skb), skb); + tos =ip_tunnel_ecn_encap (full_tos,ip_hdr (skb), skb);if (geneve->cfg.ttl_inherit) ttl =ip_tunnel_get_ttl (ip_hdr (skb), skb);else
@@ -1120,7 +1124,7 @@ static int geneve_fill_metadata_dst(stru 1, USHRT_MAX, true); rt =geneve_get_v4_rt (skb, dev, gs4, &fl4, info, - geneve->cfg.info.key.tp_dst, sport); + geneve->cfg.info.key.tp_dst, sport,NULL );if (IS_ERR (rt))return PTR_ERR (rt);
Greg Kroah-Hartman
maintainerPATCH 62/158 perf probe: Fix an error handling path in parse_perf_probe_command()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
commit 4bf6dcaa93bcd083a13c278a91418fe10e6d23a0 upstream.
If a memory allocation fail, we should branch to the error handling path in order to free some resources allocated a few lines above.
--- tools/perf/util/probe-event.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/perf/util/probe-event.c +4 -2
@@ -1760,8 +1760,10 @@ int parse_perf_probe_command(const charif (!pev->event && pev->point.function && pev->point.line && !pev->point.lazy_line && !pev->point.offset) {if (asprintf (&pev->event,"%s_L%d" , pev->point.function, - pev->point.line) <0 ) -return -ENOMEM ; + pev->point.line) <0 ) { + ret = -ENOMEM ; + goto out; + } }/* Copy arguments and ensure return probe has no C argument */
Greg Kroah-Hartman
maintainerPATCH 63/158 dpaa2-eth: trace the allocated address instead of page struct
In reply to Greg Kroah-HartmanFrom: Chen Lin <[email protected]>
commit e34f49348f8b7a53205b6f77707a3a6a40cf420b upstream.
We should trace the allocated address instead of page struct.
--- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +2 -2
@@ -1349,8 +1349,8 @@ static int dpaa2_eth_add_bufs(struct dpa buf_array[i] = addr;/* tracing point */ -trace_dpaa2_eth_buf_seed (priv->net_dev, - page,DPAA2_ETH_RX_BUF_RAW_SIZE , +trace_dpaa2_eth_buf_seed (priv->net_dev,page_address (page), +DPAA2_ETH_RX_BUF_RAW_SIZE , addr, priv->rx_buf_size, bpid); }
Greg Kroah-Hartman
maintainerPATCH 64/158 nios2: page fault et.al. are *not* restartable syscalls...
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
commit 8535c239ac674f7ead0f2652932d35c52c4123b2 upstream.
make sure that ->orig_r2 is negative for everything except the syscalls.
--- arch/nios2/include/asm/entry.h | 3 ++- arch/nios2/kernel/entry.S | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-)
arch/nios2/include/asm/entry.h +2 -1
@@ -50,7 +50,8 @@ stw r13, PT_R13(sp) stw r14, PT_R14(sp) stw r15, PT_R15(sp) - stw r2, PT_ORIG_R2(sp) + movi r24, -1 + stw r24, PT_ORIG_R2(sp) stw r7, PT_ORIG_R7(sp) stw ra, PT_RA(sp)
arch/nios2/kernel/entry.S +1 -3
@@ -185,6 +185,7 @@ ENTRY(handle_system_call) ldw r5, PT_R5(sp) local_restart: + stw r2, PT_ORIG_R2(sp) /* Check that the requested system call is within limits */ movui r1, __NR_syscalls bgeu r2, r1, ret_invsyscall
@@ -336,9 +337,6 @@ external_interrupt: /* skip if no interrupt is pending */ beq r12, r0, ret_from_interrupt - movi r24, -1 - stw r24, PT_ORIG_R2(sp) - /* * Process an external hardware interrupt. */
Greg Kroah-Hartman
maintainerPATCH 65/158 nios2: dont leave NULLs in sys_call_table[]
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
commit 45ec746c65097c25e77d24eae8fee0def5b6cc5d upstream.
fill the gaps in there with sys_ni_syscall, as everyone does...
--- arch/nios2/kernel/entry.S | 1 - arch/nios2/kernel/syscall_table.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
arch/nios2/kernel/entry.S +0 -1
@@ -193,7 +193,6 @@ local_restart: movhi r11, %hiadj(sys_call_table) add r1, r1, r11 ldw r1, %lo(sys_call_table)(r1) - beq r1, r0, ret_invsyscall /* Check if we are being traced */ GET_THREAD_INFO r11
arch/nios2/kernel/syscall_table.c +1 -0
@@ -13,5 +13,6 @@#define __SYSCALL (nr, call) [nr] = (call),void *sys_call_table[__NR_syscalls] = { + [0 ... __NR_syscalls-1 ] = sys_ni_syscall, #include <asm/unistd.h> };
Greg Kroah-Hartman
maintainerPATCH 66/158 nios2: traced syscall does need to check the syscall number
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
commit 25ba820ef36bdbaf9884adeac69b6e1821a7df76 upstream.
all checks done before letting the tracer modify the register state are worthless...
--- arch/nios2/kernel/entry.S | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
arch/nios2/kernel/entry.S +8 -3
@@ -255,9 +255,9 @@ traced_system_call: ldw r6, PT_R6(sp) ldw r7, PT_R7(sp) - /* Fetch the syscall function, we don't need to check the boundaries - * since this is already done. - */ + /* Fetch the syscall function. */ + movui r1, __NR_syscalls + bgeu r2, r1, traced_invsyscall slli r1, r2, 2 movhi r11,%hiadj(sys_call_table) add r1, r1, r11
@@ -287,6 +287,11 @@ end_translate_rc_and_ret2: RESTORE_SWITCH_STACK br ret_from_exception + /* If the syscall number was invalid return ENOSYS */ +traced_invsyscall: + movi r2, -ENOSYS + br translate_rc_and_ret2 + Luser_return: GET_THREAD_INFO r11 /* get thread_info pointer */ ldw r10, TI_FLAGS(r11) /* get thread_info->flags */
Greg Kroah-Hartman
maintainerPATCH 67/158 nios2: fix syscall restart checks
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
commit 2d631bd58fe0ea3e3350212e23c9aba1fb606514 upstream.
sys_foo() returns -512 (aka -ERESTARTSYS) => do_signal() sees 512 in r2 and 1 in r1.
sys_foo() returns 512 => do_signal() sees 512 in r2 and 0 in r1.
The former is restart-worthy; the latter obviously isn't.
--- arch/nios2/kernel/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/nios2/kernel/signal.c +1 -1
@@ -242,7 +242,7 @@ static int do_signal(struct pt_regs *reg/* * If we were from a system call, check for system call restarting... */ -if (regs->orig_r2 >=0 ) { +if (regs->orig_r2 >=0 && regs->r1) { continue_addr = regs->ea; restart_addr = continue_addr -4 ; retval = regs->r2;
Greg Kroah-Hartman
maintainerPATCH 68/158 nios2: restarts apply only to the first sigframe we build...
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
commit 411a76b7219555c55867466c82d70ce928d6c9e1 upstream.
--- arch/nios2/kernel/signal.c | 1 + 1 file changed, 1 insertion(+)
arch/nios2/kernel/signal.c +1 -0
@@ -264,6 +264,7 @@ static int do_signal(struct pt_regs *reg regs->ea = restart_addr;break ; } + regs->orig_r2 =-1 ; }if (get_signal (&ksig)) {
Greg Kroah-Hartman
maintainerPATCH 69/158 nios2: add force_successful_syscall_return()
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
commit fd0c153daad135d0ec1a53c5dbe6936a724d6ae1 upstream.
If we use the ancient SysV syscall ABI, we'd better have tell the kernel how to claim that a negative return value is a success. Use ->orig_r2 for that - it's inaccessible via ptrace, so it's a fair game for changes and it's normally[*] non-negative on return from syscall. Set to -1; syscall is not going to be restart-worthy by definition, so we won't interfere with that use either.
[*] the only exception is rt_sigreturn(), where we skip the entire messing with r1/r2 anyway.
--- arch/nios2/include/asm/ptrace.h | 2 ++ arch/nios2/kernel/entry.S | 6 ++++++ 2 files changed, 8 insertions(+)
arch/nios2/include/asm/ptrace.h +2 -0
@@ -74,6 +74,8 @@ extern void show_regs(struct pt_regs *); ((struct pt_regs *)((unsigned long )current_thread_info () +THREAD_SIZE )\ - 1) +#define force_successful_syscall_return () (current_pt_regs()->orig_r2 = -1) +int do_syscall_trace_enter (void );void do_syscall_trace_exit (void );#endif /* __ASSEMBLY__ */
arch/nios2/kernel/entry.S +6 -0
@@ -213,6 +213,9 @@ local_restart: translate_rc_and_ret: movi r1, 0 bge r2, zero, 3f + ldw r1, PT_ORIG_R2(sp) + addi r1, r1, 1 + beq r1, zero, 3f sub r2, zero, r2 movi r1, 1 3:
@@ -276,6 +279,9 @@ traced_system_call: translate_rc_and_ret2: movi r1, 0 bge r2, zero, 4f + ldw r1, PT_ORIG_R2(sp) + addi r1, r1, 1 + beq r1, zero, 4f sub r2, zero, r2 movi r1, 1 4:
Greg Kroah-Hartman
maintainerPATCH 70/158 iavf: Fix adminq error handling
In reply to Greg Kroah-HartmanFrom: Przemyslaw Patynowski <[email protected]>
commit 419831617ed349992c84344dbd9e627f9e68f842 upstream.
iavf_alloc_asq_bufs/iavf_alloc_arq_bufs allocates with dma_alloc_coherent
memory for VF mailbox.
Free DMA regions for both ASQ and ARQ in case error happens during
configuration of ASQ/ARQ registers.
Without this change it is possible to see when unloading interface:
74626.583369: dma_debug_device_change: device driver has pending DMA allocations while released from device [count=32] One of leaked entries details: [device address=0x0000000b27ff9000] [size=4096 bytes] [mapped with DMA_BIDIRECTIONAL] [mapped as coherent]
--- drivers/net/ethernet/intel/iavf/iavf_adminq.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_adminq.c +13 -2
@@ -324,6 +324,7 @@ static enum iavf_status iavf_config_arq_static enum iavf_status iavf_init_asq (struct iavf_hw *hw) {enum iavf_status ret_code =0 ; +int i;if (hw->aq.asq.count >0 ) {/* queue already initialized */
@@ -354,12 +355,17 @@ static enum iavf_status iavf_init_asq(st/* initialize base registers */ ret_code =iavf_config_asq_regs (hw);if (ret_code) - goto init_adminq_free_rings; + goto init_free_asq_bufs;/* success! */ hw->aq.asq.count = hw->aq.num_asq_entries; goto init_adminq_exit; +init_free_asq_bufs: +for (i =0 ; i < hw->aq.num_asq_entries; i++) +iavf_free_dma_mem (hw, &hw->aq.asq.r.asq_bi[i]); +iavf_free_virt_mem (hw, &hw->aq.asq.dma_head); + init_adminq_free_rings:iavf_free_adminq_asq (hw);
@@ -383,6 +389,7 @@ init_adminq_exit:static enum iavf_status iavf_init_arq (struct iavf_hw *hw) {enum iavf_status ret_code =0 ; +int i;if (hw->aq.arq.count >0 ) {/* queue already initialized */
@@ -413,12 +420,16 @@ static enum iavf_status iavf_init_arq(st/* initialize base registers */ ret_code =iavf_config_arq_regs (hw);if (ret_code) - goto init_adminq_free_rings; + goto init_free_arq_bufs;/* success! */ hw->aq.arq.count = hw->aq.num_arq_entries; goto init_adminq_exit; +init_free_arq_bufs: +for (i =0 ; i < hw->aq.num_arq_entries; i++) +iavf_free_dma_mem (hw, &hw->aq.arq.r.arq_bi[i]); +iavf_free_virt_mem (hw, &hw->aq.arq.dma_head); init_adminq_free_rings:iavf_free_adminq_arq (hw);
Greg Kroah-Hartman
maintainerPATCH 71/158 ASoC: tas2770: Set correct FSYNC polarity
In reply to Greg Kroah-HartmanFrom: Martin Povišer <[email protected]>
commit e9ac31f0a5d0e246b046c20348954519f91a297f upstream.
Fix setting of FSYNC polarity for DAI formats other than I2S. Also add support for polarity inversion.
--- sound/soc/codecs/tas2770.c | 20 +++++++++++++++++++- sound/soc/codecs/tas2770.h | 3 +++ 2 files changed, 22 insertions(+), 1 deletion(-)
sound/soc/codecs/tas2770.c +19 -1
@@ -337,7 +337,7 @@ static int tas2770_set_fmt(struct snd_sostruct snd_soc_component *component = dai->component;struct tas2770_priv *tas2770 =snd_soc_component_get_drvdata (component); -u8 tdm_rx_start_slot =0 , asi_cfg_1 =0 ; +u8 tdm_rx_start_slot =0 , invert_fpol =0 , fpol_preinv =0 , asi_cfg_1 =0 ;int ret;switch (fmt &SND_SOC_DAIFMT_MASTER_MASK ) {
@@ -349,9 +349,15 @@ static int tas2770_set_fmt(struct snd_so }switch (fmt &SND_SOC_DAIFMT_INV_MASK ) { +case SND_SOC_DAIFMT_NB_IF : + invert_fpol =1 ; + fallthrough;case SND_SOC_DAIFMT_NB_NF : asi_cfg_1 |=TAS2770_TDM_CFG_REG1_RX_RSING ;break ; +case SND_SOC_DAIFMT_IB_IF : + invert_fpol =1 ; + fallthrough;case SND_SOC_DAIFMT_IB_NF : asi_cfg_1 |=TAS2770_TDM_CFG_REG1_RX_FALING ;break ;
@@ -369,15 +375,19 @@ static int tas2770_set_fmt(struct snd_soswitch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {case SND_SOC_DAIFMT_I2S : tdm_rx_start_slot =1 ; + fpol_preinv =0 ;break ;case SND_SOC_DAIFMT_DSP_A : tdm_rx_start_slot =0 ; + fpol_preinv =1 ;break ;case SND_SOC_DAIFMT_DSP_B : tdm_rx_start_slot =1 ; + fpol_preinv =1 ;break ;case SND_SOC_DAIFMT_LEFT_J : tdm_rx_start_slot =0 ; + fpol_preinv =1 ;break ;default : dev_err(tas2770->dev,
@@ -391,6 +401,14 @@ static int tas2770_set_fmt(struct snd_soif (ret <0 )return ret; + ret =snd_soc_component_update_bits (component,TAS2770_TDM_CFG_REG0 , +TAS2770_TDM_CFG_REG0_FPOL_MASK , + (fpol_preinv ^ invert_fpol) + ?TAS2770_TDM_CFG_REG0_FPOL_RSING + :TAS2770_TDM_CFG_REG0_FPOL_FALING ); +if (ret <0 ) +return ret; +return 0 ; }
sound/soc/codecs/tas2770.h +3 -0
@@ -41,6 +41,9 @@#define TAS2770_TDM_CFG_REG0_31_44_1_48KHZ 0x6#define TAS2770_TDM_CFG_REG0_31_88_2_96KHZ 0x8#define TAS2770_TDM_CFG_REG0_31_176_4_192KHZ 0xa +#define TAS2770_TDM_CFG_REG0_FPOL_MASK BIT(0) +#define TAS2770_TDM_CFG_REG0_FPOL_RSING 0 +#define TAS2770_TDM_CFG_REG0_FPOL_FALING 1/* TDM Configuration Reg1 */ #define TAS2770_TDM_CFG_REG1 TAS2770_REG(0X0, 0x0B)#define TAS2770_TDM_CFG_REG1_MASK GENMASK(5, 1)
Greg Kroah-Hartman
maintainerPATCH 72/158 ASoC: tas2770: Allow mono streams
In reply to Greg Kroah-HartmanFrom: Martin Povišer <[email protected]>
commit bf54d97a835dfe62d4d29e245e170c63d0089be7 upstream.
The part is a mono speaker amp, but it can do downmix and switch between left and right channel, so the right channel range is 1 to 2.
--- sound/soc/codecs/tas2770.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/tas2770.c +1 -1
@@ -507,7 +507,7 @@ static struct snd_soc_dai_driver tas2770 .id = 0, .playback = { .stream_name = "ASI1 Playback", - .channels_min = 2, + .channels_min = 1, .channels_max = 2, .rates = TAS2770_RATES, .formats = TAS2770_FORMATS,
Greg Kroah-Hartman
maintainerPATCH 73/158 ASoC: tas2770: Drop conflicting set_bias_level power setting
In reply to Greg Kroah-HartmanFrom: Martin Povišer <[email protected]>
commit 482c23fbc7e9bf5a7a74defd0735d5346215db58 upstream.
The driver is setting the PWR_CTRL field in both the set_bias_level callback and on DAPM events of the DAC widget (and also in the mute_stream method). Drop the set_bias_level callback altogether as the power setting it does is in conflict with the other code paths.
--- sound/soc/codecs/tas2770.c | 33 --------------------------------- 1 file changed, 33 deletions(-)
sound/soc/codecs/tas2770.c +0 -33
@@ -46,38 +46,6 @@ static void tas2770_reset(struct tas2770usleep_range (1000 ,2000 ); } -static int tas2770_set_bias_level (struct snd_soc_component *component, -enum snd_soc_bias_level level) -{ -struct tas2770_priv *tas2770 = -snd_soc_component_get_drvdata (component); - -switch (level) { -case SND_SOC_BIAS_ON : -snd_soc_component_update_bits (component,TAS2770_PWR_CTRL , -TAS2770_PWR_CTRL_MASK , -TAS2770_PWR_CTRL_ACTIVE ); -break ; -case SND_SOC_BIAS_STANDBY : -case SND_SOC_BIAS_PREPARE : -snd_soc_component_update_bits (component,TAS2770_PWR_CTRL , -TAS2770_PWR_CTRL_MASK , -TAS2770_PWR_CTRL_MUTE ); -break ; -case SND_SOC_BIAS_OFF : -snd_soc_component_update_bits (component,TAS2770_PWR_CTRL , -TAS2770_PWR_CTRL_MASK , -TAS2770_PWR_CTRL_SHUTDOWN ); -break ; - -default : -dev_err (tas2770->dev,"wrong power level setting %d\n" , level); -return -EINVAL ; - } - -return 0 ; -} -#ifdef CONFIG_PM static int tas2770_codec_suspend (struct snd_soc_component *component) {
@@ -555,7 +523,6 @@ static const struct snd_soc_component_dr .probe = tas2770_codec_probe, .suspend = tas2770_codec_suspend, .resume = tas2770_codec_resume, - .set_bias_level = tas2770_set_bias_level, .controls = tas2770_snd_controls, .num_controls = ARRAY_SIZE(tas2770_snd_controls), .dapm_widgets = tas2770_dapm_widgets,
Greg Kroah-Hartman
maintainerPATCH 74/158 ASoC: tas2770: Fix handling of mute/unmute
In reply to Greg Kroah-HartmanFrom: Martin Povišer <[email protected]>
commit 1e5907bcb3a3b569be0a03ebe668bba2ed320a50 upstream.
Because the PWR_CTRL field is modeled as the power state of the DAC widget, and at the same time it is used to implement mute/unmute, we need some additional book-keeping to have the right end result no matter the sequence of calls. Without this fix, one can mute an ongoing stream by toggling a speaker pin control.
--- sound/soc/codecs/tas2770.c | 57 +++++++++++++++++++++++---------------------- sound/soc/codecs/tas2770.h | 2 + 2 files changed, 32 insertions(+), 27 deletions(-)
sound/soc/codecs/tas2770.c +30 -27
@@ -46,6 +46,26 @@ static void tas2770_reset(struct tas2770usleep_range (1000 ,2000 ); } +static int tas2770_update_pwr_ctrl (struct tas2770_priv *tas2770) +{ +struct snd_soc_component *component = tas2770->component; +unsigned int val; +int ret; + +if (tas2770->dac_powered) + val = tas2770->unmuted ? +TAS2770_PWR_CTRL_ACTIVE :TAS2770_PWR_CTRL_MUTE ; +else + val =TAS2770_PWR_CTRL_SHUTDOWN ; + + ret =snd_soc_component_update_bits (component,TAS2770_PWR_CTRL , +TAS2770_PWR_CTRL_MASK , val); +if (ret <0 ) +return ret; + +return 0 ; +} +#ifdef CONFIG_PM static int tas2770_codec_suspend (struct snd_soc_component *component) {
@@ -82,9 +102,7 @@ static int tas2770_codec_resume(struct sgpiod_set_value_cansleep (tas2770->sdz_gpio,1 );usleep_range (1000 ,2000 ); }else { - ret =snd_soc_component_update_bits (component,TAS2770_PWR_CTRL , -TAS2770_PWR_CTRL_MASK , -TAS2770_PWR_CTRL_ACTIVE ); + ret =tas2770_update_pwr_ctrl (tas2770);if (ret <0 )return ret; }
@@ -120,24 +138,19 @@ static int tas2770_dac_event(struct snd_switch (event) {case SND_SOC_DAPM_POST_PMU : - ret =snd_soc_component_update_bits (component,TAS2770_PWR_CTRL , -TAS2770_PWR_CTRL_MASK , -TAS2770_PWR_CTRL_MUTE ); + tas2770->dac_powered =1 ; + ret =tas2770_update_pwr_ctrl (tas2770);break ;case SND_SOC_DAPM_PRE_PMD : - ret =snd_soc_component_update_bits (component,TAS2770_PWR_CTRL , -TAS2770_PWR_CTRL_MASK , -TAS2770_PWR_CTRL_SHUTDOWN ); + tas2770->dac_powered =0 ; + ret =tas2770_update_pwr_ctrl (tas2770);break ;default :dev_err (tas2770->dev,"Not supported evevt\n" );return -EINVAL ; } -if (ret <0 ) -return ret; - -return 0 ; +return ret; } static const struct snd_kcontrol_new isense_switch =
@@ -171,21 +184,11 @@ static const struct snd_soc_dapm_route tstatic int tas2770_mute (struct snd_soc_dai *dai,int mute,int direction) {struct snd_soc_component *component = dai->component; -int ret; - -if (mute) - ret =snd_soc_component_update_bits (component,TAS2770_PWR_CTRL , -TAS2770_PWR_CTRL_MASK , -TAS2770_PWR_CTRL_MUTE ); -else - ret =snd_soc_component_update_bits (component,TAS2770_PWR_CTRL , -TAS2770_PWR_CTRL_MASK , -TAS2770_PWR_CTRL_ACTIVE ); - -if (ret <0 ) -return ret; +struct tas2770_priv *tas2770 = +snd_soc_component_get_drvdata (component); -return 0 ; + tas2770->unmuted = !mute; +return tas2770_update_pwr_ctrl (tas2770); }static int tas2770_set_bitwidth (struct tas2770_priv *tas2770,int bitwidth)
sound/soc/codecs/tas2770.h +2 -0
@@ -138,6 +138,8 @@ struct tas2770_priv {struct device *dev;int v_sense_slot;int i_sense_slot; +bool dac_powered; + bool unmuted; };#endif /* __TAS2770__ */
Greg Kroah-Hartman
maintainerPATCH 75/158 netfilter: nf_tables: really skip inactive sets when allocating name
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
commit 271c5ca826e0c3c53e0eb4032f8eaedea1ee391c upstream.
While looping to build the bitmap of used anonymous set names, check the current set in the iteration, instead of the one that is being created.
--- net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +1 -1
@@ -3702,7 +3702,7 @@ cont:list_for_each_entry (i, &ctx->table->sets, list) {int tmp; -if (!nft_is_active_next (ctx->net, set)) +if (!nft_is_active_next (ctx->net, i))continue ;if (!sscanf (i->name, name, &tmp))continue ;
Greg Kroah-Hartman
maintainerPATCH 76/158 netfilter: nf_tables: validate NFTA_SET_ELEM_OBJREF based on NFT_SET_OBJECT flag
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
commit 5a2f3dc31811e93be15522d9eb13ed61460b76c8 upstream.
If the NFTA_SET_ELEM_OBJREF netlink attribute is present and NFT_SET_OBJECT flag is set on, report EINVAL.
Move existing sanity check earlier to validate that NFT_SET_OBJECT requires NFTA_SET_ELEM_OBJREF.
--- net/netfilter/nf_tables_api.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
net/netfilter/nf_tables_api.c +9 -4
@@ -5245,6 +5245,15 @@ static int nft_add_set_elem(struct nft_creturn -EINVAL ; } +if (set->flags &NFT_SET_OBJECT ) { +if (!nla[NFTA_SET_ELEM_OBJREF ] && + !(flags &NFT_SET_ELEM_INTERVAL_END )) +return -EINVAL ; + }else { +if (nla[NFTA_SET_ELEM_OBJREF ]) +return -EINVAL ; + } + if ((flags & NFT_SET_ELEM_INTERVAL_END) && (nla[NFTA_SET_ELEM_DATA] || nla[NFTA_SET_ELEM_OBJREF] ||
@@ -5322,10 +5331,6 @@ static int nft_add_set_elem(struct nft_c expr->ops->size);if (nla[NFTA_SET_ELEM_OBJREF ] !=NULL ) { -if (!(set->flags &NFT_SET_OBJECT )) { - err = -EINVAL ; - goto err_parse_key_end; - } obj =nft_obj_lookup (ctx->net, ctx->table, nla[NFTA_SET_ELEM_OBJREF ], set->objtype, genmask);
Greg Kroah-Hartman
maintainerPATCH 77/158 netfilter: nf_tables: check NFT_SET_CONCAT flag if field_count is specified
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
commit 1b6345d4160ecd3d04bd8cd75df90c67811e8cc9 upstream.
Since f3a2181e16f1 ("netfilter: nf_tables: Support for sets with multiple ranged fields"), it possible to combine intervals and concatenations. Later on, ef516e8625dd ("netfilter: nf_tables:
reintroduce the NFT_SET_CONCAT flag") provides the NFT_SET_CONCAT flag for userspace to report that the set stores a concatenation.
Make sure NFT_SET_CONCAT is set on if field_count is specified for consistency. Otherwise, if NFT_SET_CONCAT is specified with no field_count, bail out with EINVAL.
--- net/netfilter/nf_tables_api.c | 5 +++++ 1 file changed, 5 insertions(+)
net/netfilter/nf_tables_api.c +5 -0
@@ -4241,6 +4241,11 @@ static int nf_tables_newset(struct net * err =nf_tables_set_desc_parse (&desc, nla[NFTA_SET_DESC ]);if (err <0 )return err; + +if (desc.field_count >1 && !(flags &NFT_SET_CONCAT )) +return -EINVAL ; + }else if (flags &NFT_SET_CONCAT ) { +return -EINVAL ; }if (nla[NFTA_SET_EXPR ])
Greg Kroah-Hartman
maintainerPATCH 78/158 powerpc/pci: Fix get_phb_number() locking
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
commit 8d48562a2729742f767b0fdd994d6b2a56a49c63 upstream.
The recent change to get_phb_number() causes a DEBUG_ATOMIC_SLEEP warning on some systems:
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:580
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1, name: swapper
preempt_count: 1, expected: 0
RCU nest depth: 0, expected: 0
1 lock held by swapper/1:
#0: c157efb0 (hose_spinlock){+.+.}-{2:2}, at: pcibios_alloc_controller+0x64/0x220
Preemption disabled at:
[<00000000>] 0x0
CPU: 0 PID: 1 Comm: swapper Not tainted 5.19.0-yocto-standard+ #1
Call Trace:
[d101dc90] [c073b264] dump_stack_lvl+0x50/0x8c (unreliable)
[d101dcb0] [c0093b70] __might_resched+0x258/0x2a8
[d101dcd0] [c0d3e634] __mutex_lock+0x6c/0x6ec
[d101dd50] [c0a84174] of_alias_get_id+0x50/0xf4
[d101dd80] [c002ec78] pcibios_alloc_controller+0x1b8/0x220
[d101ddd0] [c140c9dc] pmac_pci_init+0x198/0x784
[d101de50] [c140852c] discover_phbs+0x30/0x4c
[d101de60] [c0007fd4] do_one_initcall+0x94/0x344
[d101ded0] [c1403b40] kernel_init_freeable+0x1a8/0x22c
[d101df10] [c00086e0] kernel_init+0x34/0x160
[d101df30] [c001b334] ret_from_kernel_thread+0x5c/0x64This is because pcibios_alloc_controller() holds hose_spinlock but of_alias_get_id() takes of_mutex which can sleep.
The hose_spinlock protects the phb_bitmap, and also the hose_list, but it doesn't need to be held while get_phb_number() calls the OF routines, because those are only looking up information in the device tree.
So fix it by having get_phb_number() take the hose_spinlock itself, only where required, and then dropping the lock before returning. pcibios_alloc_controller() then needs to take the lock again before the list_add() but that's safe, the order of the list is not important.
--- arch/powerpc/kernel/pci-common.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
arch/powerpc/kernel/pci-common.c +10 -6
@@ -66,10 +66,6 @@ void set_pci_dma_ops(const struct dma_ma pci_dma_ops = dma_ops; } -/* -* This function should run under locking protection, specifically -* hose_spinlock. -*/ static int get_phb_number (struct device_node *dn) {int ret, phb_id =-1 ;
@@ -106,15 +102,20 @@ static int get_phb_number(struct device_if (!ret) phb_id = (int )(prop & (MAX_PHBS -1 )); +spin_lock (&hose_spinlock); +/* We need to be sure to not use the same PHB number twice. */ if ((phb_id >=0 ) && !test_and_set_bit (phb_id, phb_bitmap)) -return phb_id; + goto out_unlock;/* If everything fails then fallback to dynamic PHB numbering. */ phb_id =find_first_zero_bit (phb_bitmap,MAX_PHBS );BUG_ON (phb_id >=MAX_PHBS );set_bit (phb_id, phb_bitmap); +out_unlock: +spin_unlock (&hose_spinlock); +return phb_id; }
@@ -125,10 +126,13 @@ struct pci_controller *pcibios_alloc_con phb =zalloc_maybe_bootmem (sizeof (struct pci_controller ),GFP_KERNEL );if (phb ==NULL )return NULL ; -spin_lock (&hose_spinlock); + phb->global_number =get_phb_number (dev); + +spin_lock (&hose_spinlock);list_add_tail (&phb->list_node, &hose_list);spin_unlock (&hose_spinlock); + phb->dn = dev; phb->is_dynamic =slab_is_available ();#ifdef CONFIG_PPC64
Greg Kroah-Hartman
maintainerPATCH 79/158 spi: meson-spicc: add local pow2 clock ops to preserve rate between messages
In reply to Greg Kroah-HartmanFrom: Neil Armstrong <[email protected]>
commit 09992025dacd258c823f50e82db09d7ef06cdac4 upstream.
At the end of a message, the HW gets a reset in meson_spicc_unprepare_transfer(), this resets the SPICC_CONREG register and notably the value set by the Common Clock Framework.
This is problematic because:
- the register value CCF can be different from the corresponding CCF cached rate
- CCF is allowed to change the clock rate whenever the HW state
This introduces:
- local pow2 clock ops checking the HW state before allowing a clock operation
- separation of legacy pow2 clock patch and new enhanced clock path
- SPICC_CONREG datarate value is now value kepts across messages
It has been checked that:
- SPICC_CONREG datarate value is kept across messages
- CCF is only allowed to change the SPICC_CONREG datarate value when busy
- SPICC_CONREG datarate value is correct for each transfer
This didn't appear before commit 3e0cf4d3fc29 ("spi: meson-spicc: add a linear clock divider support") because we recalculated and wrote the rate for each xfer.
--- drivers/spi/spi-meson-spicc.c | 129 ++++++++++++++++++++++++++++++++---------- 1 file changed, 101 insertions(+), 28 deletions(-)
drivers/spi/spi-meson-spicc.c +101 -28
@@ -156,6 +156,7 @@ struct meson_spicc_device {void __iomem *base;struct clk *core;struct clk *pclk; +struct clk_divider pow2_div;struct clk *clk;struct spi_message *message;struct spi_transfer *xfer;
@@ -168,6 +169,8 @@ struct meson_spicc_device {unsigned long xfer_remain; }; +#define pow2_clk_to_spicc (_div) container_of(_div, struct meson_spicc_device, pow2_div) +static void meson_spicc_oen_enable (struct meson_spicc_device *spicc) {u32 conf;
@@ -421,7 +424,7 @@ static int meson_spicc_prepare_message(s {struct meson_spicc_device *spicc =spi_master_get_devdata (master);struct spi_device *spi = message->spi; -u32 conf =0 ; +u32 conf =readl_relaxed (spicc->base +SPICC_CONREG ) &SPICC_DATARATE_MASK ;/* Store current message */ spicc->message = message;
@@ -458,8 +461,6 @@ static int meson_spicc_prepare_message(s/* Select CS */ conf |=FIELD_PREP (SPICC_CS_MASK , spi->chip_select); -/* Default Clock rate core/4 */ -/* Default 8bit word */ conf |=FIELD_PREP (SPICC_BITLENGTH_MASK ,8 -1 );
@@ -476,12 +477,16 @@ static int meson_spicc_prepare_message(sstatic int meson_spicc_unprepare_transfer (struct spi_master *master) {struct meson_spicc_device *spicc =spi_master_get_devdata (master); +u32 conf =readl_relaxed (spicc->base +SPICC_CONREG ) &SPICC_DATARATE_MASK ;/* Disable all IRQs */ writel (0 , spicc->base +SPICC_INTREG );device_reset_optional (&spicc->pdev->dev); +/* Set default configuration, keeping datarate field */ +writel_relaxed (conf, spicc->base +SPICC_CONREG ); +return 0 ; }
@@ -518,14 +523,60 @@ static void meson_spicc_cleanup(struct s* Clk path for G12A series: * pclk -> pow2 fixed div -> pow2 div -> mux -> out * pclk -> enh fixed div -> enh div -> mux -> out +* +* The pow2 divider is tied to the controller HW state, and the +* divider is only valid when the controller is initialized. +* +* A set of clock ops is added to make sure we don't read/set this +* clock rate while the controller is in an unknown state. */ -static int meson_spicc_clk_init (struct meson_spicc_device *spicc) +static unsigned long meson_spicc_pow2_recalc_rate (struct clk_hw *hw, +unsigned long parent_rate) +{ +struct clk_divider *divider =to_clk_divider (hw); +struct meson_spicc_device *spicc =pow2_clk_to_spicc (divider); + +if (!spicc->master->cur_msg || !spicc->master->busy) +return 0 ; + +return clk_divider_ops.recalc_rate (hw, parent_rate); +} + +static int meson_spicc_pow2_determine_rate (struct clk_hw *hw, +struct clk_rate_request *req) +{ +struct clk_divider *divider =to_clk_divider (hw); +struct meson_spicc_device *spicc =pow2_clk_to_spicc (divider); + +if (!spicc->master->cur_msg || !spicc->master->busy) +return -EINVAL ; + +return clk_divider_ops.determine_rate (hw, req); +} + +static int meson_spicc_pow2_set_rate (struct clk_hw *hw,unsigned long rate, +unsigned long parent_rate) +{ +struct clk_divider *divider =to_clk_divider (hw); +struct meson_spicc_device *spicc =pow2_clk_to_spicc (divider); + +if (!spicc->master->cur_msg || !spicc->master->busy) +return -EINVAL ; + +return clk_divider_ops.set_rate (hw, rate, parent_rate); +} + +const struct clk_ops meson_spicc_pow2_clk_ops = { + .recalc_rate = meson_spicc_pow2_recalc_rate, + .determine_rate = meson_spicc_pow2_determine_rate, + .set_rate = meson_spicc_pow2_set_rate, +}; + +static int meson_spicc_pow2_clk_init (struct meson_spicc_device *spicc) {struct device *dev = &spicc->pdev->dev; -struct clk_fixed_factor *pow2_fixed_div, *enh_fixed_div; -struct clk_divider *pow2_div, *enh_div; -struct clk_mux *mux; +struct clk_fixed_factor *pow2_fixed_div;struct clk_init_data init;struct clk *clk;struct clk_parent_data parent_data[2 ];
@@ -560,31 +611,45 @@ static int meson_spicc_clk_init(struct mif (WARN_ON (IS_ERR (clk)))return PTR_ERR (clk); - pow2_div =devm_kzalloc (dev,sizeof (*pow2_div),GFP_KERNEL ); -if (!pow2_div) -return -ENOMEM ; -snprintf (name,sizeof (name),"%s#pow2_div" ,dev_name (dev)); init.name = name; - init.ops = &clk_divider_ops; - init.flags =CLK_SET_RATE_PARENT ; + init.ops = &meson_spicc_pow2_clk_ops; +/* +* Set NOCACHE here to make sure we read the actual HW value +* since we reset the HW after each transfer. +*/ + init.flags =CLK_SET_RATE_PARENT |CLK_GET_RATE_NOCACHE ; parent_data[0 ].hw = &pow2_fixed_div->hw; init.num_parents =1 ; - pow2_div->shift =16 , - pow2_div->width =3 , - pow2_div->flags =CLK_DIVIDER_POWER_OF_TWO , - pow2_div->reg = spicc->base +SPICC_CONREG ; - pow2_div->hw.init = &init; + spicc->pow2_div.shift =16 , + spicc->pow2_div.width =3 , + spicc->pow2_div.flags =CLK_DIVIDER_POWER_OF_TWO , + spicc->pow2_div.reg = spicc->base +SPICC_CONREG ; + spicc->pow2_div.hw.init = &init; - clk =devm_clk_register (dev, &pow2_div->hw); -if (WARN_ON (IS_ERR (clk))) -return PTR_ERR (clk); + spicc->clk =devm_clk_register (dev, &spicc->pow2_div.hw); +if (WARN_ON (IS_ERR (spicc->clk))) +return PTR_ERR (spicc->clk); -if (!spicc->data->has_enhance_clk_div) { - spicc->clk = clk; -return 0 ; - } +return 0 ; +} + +static int meson_spicc_enh_clk_init (struct meson_spicc_device *spicc) +{ +struct device *dev = &spicc->pdev->dev; +struct clk_fixed_factor *enh_fixed_div; +struct clk_divider *enh_div; +struct clk_mux *mux; +struct clk_init_data init; +struct clk *clk; +struct clk_parent_data parent_data[2 ]; +char name[64 ]; + +memset (&init,0 ,sizeof (init)); +memset (&parent_data,0 ,sizeof (parent_data)); + + init.parent_data = parent_data;/* algorithm for enh div: rate = freq / 2 / (N + 1) */
@@ -637,7 +702,7 @@ static int meson_spicc_clk_init(struct msnprintf (name,sizeof (name),"%s#sel" ,dev_name (dev)); init.name = name; init.ops = &clk_mux_ops; - parent_data[0 ].hw = &pow2_div->hw; + parent_data[0 ].hw = &spicc->pow2_div.hw; parent_data[1 ].hw = &enh_div->hw; init.num_parents =2 ; init.flags =CLK_SET_RATE_PARENT ;
@@ -754,12 +819,20 @@ static int meson_spicc_probe(struct platmeson_spicc_oen_enable (spicc); - ret =meson_spicc_clk_init (spicc); + ret =meson_spicc_pow2_clk_init (spicc);if (ret) { -dev_err (&pdev->dev,"clock registration failed\n" ); +dev_err (&pdev->dev,"pow2 clock registration failed\n" ); goto out_clk; } +if (spicc->data->has_enhance_clk_div) { + ret =meson_spicc_enh_clk_init (spicc); +if (ret) { +dev_err (&pdev->dev,"clock registration failed\n" ); + goto out_clk; + } + } + ret =devm_spi_register_master (&pdev->dev, master);if (ret) {dev_err (&pdev->dev,"spi master registration failed\n" );
Greg Kroah-Hartman
maintainerPATCH 80/158 net: dsa: mv88e6060: prevent crash on an unused port
In reply to Greg Kroah-HartmanFrom: Sergei Antonov <[email protected]>
commit 246bbf2f977ea36aaf41f5d24370fef433250728 upstream.
If the port isn't a CPU port nor a user port, 'cpu_dp' is a null pointer and a crash happened on dereferencing it in mv88e6060_setup_port():
[ 9.575872] Unable to handle kernel NULL pointer dereference at virtual address 00000014 ... [ 9.942216] mv88e6060_setup from dsa_register_switch+0x814/0xe84 [ 9.948616] dsa_register_switch from mdio_probe+0x2c/0x54 [ 9.954433] mdio_probe from really_probe.part.0+0x98/0x2a0 [ 9.960375] really_probe.part.0 from driver_probe_device+0x30/0x10c [ 9.967029] driver_probe_device from __device_attach_driver+0xb8/0x13c [ 9.973946] __device_attach_driver from bus_for_each_drv+0x90/0xe0 [ 9.980509] bus_for_each_drv from __device_attach+0x110/0x184 [ 9.986632] __device_attach from bus_probe_device+0x8c/0x94 [ 9.992577] bus_probe_device from deferred_probe_work_func+0x78/0xa8 [ 9.999311] deferred_probe_work_func from process_one_work+0x290/0x73c [ 10.006292] process_one_work from worker_thread+0x30/0x4b8 [ 10.012155] worker_thread from kthread+0xd4/0x10c [ 10.017238] kthread from ret_from_fork+0x14/0x3c
--- drivers/net/dsa/mv88e6060.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/dsa/mv88e6060.c +3 -0
@@ -118,6 +118,9 @@ static int mv88e6060_setup_port(struct mint addr =REG_PORT (p);int ret; +if (dsa_is_unused_port (priv->ds, p)) +return 0 ; +/* Do not force flow control, disable Ingress and Egress * Header tagging, disable VLAN tunneling, and set the port * state to Forwarding. Additionally, if this is the CPU
Greg Kroah-Hartman
maintainerPATCH 81/158 net: moxa: pass pdev instead of ndev to DMA functions
In reply to Greg Kroah-HartmanFrom: Sergei Antonov <[email protected]>
commit 3a12df22a8f68954a4ba48435c06b3d1791c87c4 upstream.
dma_map_single() calls fail in moxart_mac_setup_desc_ring() and moxart_mac_start_xmit() which leads to an incessant output of this:
[ 16.043925] moxart-ethernet 92000000.mac eth0: DMA mapping error [ 16.050957] moxart-ethernet 92000000.mac eth0: DMA mapping error [ 16.058229] moxart-ethernet 92000000.mac eth0: DMA mapping error
Passing pdev to DMA is a common approach among net drivers.
--- drivers/net/ethernet/moxa/moxart_ether.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/net/ethernet/moxa/moxart_ether.c +10 -10
@@ -77,7 +77,7 @@ static void moxart_mac_free_memory(strucint i;for (i =0 ; i <RX_DESC_NUM ; i++) -dma_unmap_single (&ndev->dev, priv->rx_mapping[i], +dma_unmap_single (&priv->pdev->dev, priv->rx_mapping[i], priv->rx_buf_size,DMA_FROM_DEVICE );if (priv->tx_desc_base)
@@ -147,11 +147,11 @@ static void moxart_mac_setup_desc_ring(s desc + RX_REG_OFFSET_DESC1); priv->rx_buf[i] = priv->rx_buf_base + priv->rx_buf_size * i; - priv->rx_mapping[i] =dma_map_single (&ndev->dev, + priv->rx_mapping[i] =dma_map_single (&priv->pdev->dev, priv->rx_buf[i], priv->rx_buf_size,DMA_FROM_DEVICE ); -if (dma_mapping_error (&ndev->dev, priv->rx_mapping[i])) +if (dma_mapping_error (&priv->pdev->dev, priv->rx_mapping[i]))netdev_err (ndev,"DMA mapping error\n" ); moxart_desc_write(priv->rx_mapping[i],
@@ -240,7 +240,7 @@ static int moxart_rx_poll(struct napi_stif (len >RX_BUF_SIZE ) len =RX_BUF_SIZE ; -dma_sync_single_for_cpu (&ndev->dev, +dma_sync_single_for_cpu (&priv->pdev->dev, priv->rx_mapping[rx_head], priv->rx_buf_size,DMA_FROM_DEVICE ); skb =netdev_alloc_skb_ip_align (ndev, len);
@@ -294,7 +294,7 @@ static void moxart_tx_finished(struct neunsigned int tx_tail = priv->tx_tail;while (tx_tail != tx_head) { -dma_unmap_single (&ndev->dev, priv->tx_mapping[tx_tail], +dma_unmap_single (&priv->pdev->dev, priv->tx_mapping[tx_tail], priv->tx_len[tx_tail],DMA_TO_DEVICE ); ndev->stats.tx_packets++;
@@ -358,9 +358,9 @@ static netdev_tx_t moxart_mac_start_xmit len = skb->len >TX_BUF_SIZE ?TX_BUF_SIZE : skb->len; - priv->tx_mapping[tx_head] =dma_map_single (&ndev->dev, skb->data, + priv->tx_mapping[tx_head] =dma_map_single (&priv->pdev->dev, skb->data, len,DMA_TO_DEVICE ); -if (dma_mapping_error (&ndev->dev, priv->tx_mapping[tx_head])) { +if (dma_mapping_error (&priv->pdev->dev, priv->tx_mapping[tx_head])) {netdev_err (ndev,"DMA mapping error\n" ); goto out_unlock; }
@@ -379,7 +379,7 @@ static netdev_tx_t moxart_mac_start_xmit len =ETH_ZLEN ; } -dma_sync_single_for_device (&ndev->dev, priv->tx_mapping[tx_head], +dma_sync_single_for_device (&priv->pdev->dev, priv->tx_mapping[tx_head], priv->tx_buf_size,DMA_TO_DEVICE ); txdes1 =TX_DESC1_LTS |TX_DESC1_FTS | (len &TX_DESC1_BUF_SIZE_MASK );
@@ -494,7 +494,7 @@ static int moxart_mac_probe(struct platf priv->tx_buf_size =TX_BUF_SIZE ; priv->rx_buf_size =RX_BUF_SIZE ; - priv->tx_desc_base =dma_alloc_coherent (&pdev->dev,TX_REG_DESC_SIZE * + priv->tx_desc_base =dma_alloc_coherent (p_dev,TX_REG_DESC_SIZE *TX_DESC_NUM , &priv->tx_base,GFP_DMA |GFP_KERNEL );if (!priv->tx_desc_base) {
@@ -502,7 +502,7 @@ static int moxart_mac_probe(struct platf goto init_fail; } - priv->rx_desc_base =dma_alloc_coherent (&pdev->dev,RX_REG_DESC_SIZE * + priv->rx_desc_base =dma_alloc_coherent (p_dev,RX_REG_DESC_SIZE *RX_DESC_NUM , &priv->rx_base,GFP_DMA |GFP_KERNEL );if (!priv->rx_desc_base) {
Greg Kroah-Hartman
maintainerPATCH 82/158 net: dsa: microchip: ksz9477: fix fdb_dump last invalid entry
In reply to Greg Kroah-HartmanFrom: Arun Ramadoss <[email protected]>
commit 36c0d935015766bf20d621c18313f17691bda5e3 upstream.
In the ksz9477_fdb_dump function it reads the ALU control register and exit from the timeout loop if there is valid entry or search is complete. After exiting the loop, it reads the alu entry and report to the user space irrespective of entry is valid. It works till the valid entry. If the loop exited when search is complete, it reads the alu table. The table returns all ones and it is reported to user space. So bridge fdb show gives ff:ff:ff:ff:ff:ff as last entry for every port. To fix it, after exiting the loop the entry is reported only if it is valid one.
--- drivers/net/dsa/microchip/ksz9477.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/dsa/microchip/ksz9477.c +3 -0
@@ -762,6 +762,9 @@ static int ksz9477_port_fdb_dump(struct goto exit; } +if (!(ksz_data &ALU_VALID )) +continue ; +/* read ALU table */ ksz9477_read_table (dev, alu_table);
Greg Kroah-Hartman
maintainerPATCH 83/158 net: dsa: felix: fix ethtool 256-511 and 512-1023 TX packet counters
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
commit 40d21c4565bce064c73a03b79a157a3493c518b9 upstream.
What the driver actually reports as 256-511 is in fact 512-1023, and the TX packets in the 256-511 bucket are not reported. Fix that.
--- drivers/net/dsa/ocelot/felix_vsc9959.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/dsa/ocelot/felix_vsc9959.c +2 -1
@@ -578,7 +578,8 @@ static const struct ocelot_stat_layout v { .offset = 0x87, .name = "tx_frames_below_65_octets", }, { .offset = 0x88, .name = "tx_frames_65_to_127_octets", }, { .offset = 0x89, .name = "tx_frames_128_255_octets", }, - { .offset = 0x8B, .name = "tx_frames_256_511_octets", }, + { .offset = 0x8A, .name = "tx_frames_256_511_octets", }, + { .offset = 0x8B, .name = "tx_frames_512_1023_octets", }, { .offset = 0x8C, .name = "tx_frames_1024_1526_octets", }, { .offset = 0x8D, .name = "tx_frames_over_1526_octets", }, { .offset = 0x8E, .name = "tx_yellow_prio_0", },
Greg Kroah-Hartman
maintainerPATCH 84/158 net: genl: fix error path memory leak in policy dumping
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
commit 249801360db3dec4f73768c502192020bfddeacc upstream.
If construction of the array of policies fails when recording non-first policy we need to unwind.
netlink_policy_dump_add_policy() itself also needs fixing as it currently gives up on error without recording the allocated pointer in the pstate pointer.
--- net/netlink/genetlink.c | 6 +++++- net/netlink/policy.c | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-)
net/netlink/genetlink.c +5 -1
@@ -1182,13 +1182,17 @@ static int ctrl_dumppolicy_start(struct op.policy, op.maxattr);if (err) -return err; + goto err_free_state; } }if (!ctx->state)return -ENODATA ;return 0 ; + +err_free_state: +netlink_policy_dump_free (ctx->state); +return err; } static void *ctrl_dumppolicy_prep(struct sk_buff *skb,
net/netlink/policy.c +12 -2
@@ -144,7 +144,7 @@ int netlink_policy_dump_add_policy(struc err =add_policy (&state, policy, maxtype);if (err) -return err; + goto err_try_undo; for (policy_idx = 0; policy_idx < state->n_alloc && state->policies[policy_idx].policy;
@@ -164,7 +164,7 @@ int netlink_policy_dump_add_policy(struc policy[type].nested_policy, policy[type].len);if (err) -return err; + goto err_try_undo;break ;default :break ;
@@ -174,6 +174,16 @@ int netlink_policy_dump_add_policy(struc *pstate = state;return 0 ; + +err_try_undo: +/* Try to preserve reasonable unwind semantics - if we're starting from +* scratch clean up fully, otherwise record what we got and caller will. +*/ +if (!*pstate) +netlink_policy_dump_free (state); +else + *pstate = state; +return err; } static bool
Greg Kroah-Hartman
maintainerPATCH 85/158 net: dsa: sja1105: fix buffer overflow in sja1105_setup_devlink_regions()
In reply to Greg Kroah-HartmanFrom: Rustam Subkhankulov <[email protected]>
commit fd8e899cdb5ecaf8e8ee73854a99e10807eef1de upstream.
If an error occurs in dsa_devlink_region_create(), then 'priv->regions' array will be accessed by negative index '-1'.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/dsa/sja1105/sja1105_devlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/sja1105/sja1105_devlink.c +1 -1
@@ -93,7 +93,7 @@ static int sja1105_setup_devlink_regions(struct dsa_switch *ds) region =dsa_devlink_region_create (ds, ops,1 , size);if (IS_ERR (region)) { -while (i-- >=0 ) +while (--i >=0 )dsa_devlink_region_destroy (priv->regions[i]);return PTR_ERR (region); }
Signature · 1 line
2.37.2
Greg Kroah-Hartman
maintainerPATCH 86/158 ice: Ignore EEXIST when setting promisc mode
In reply to Greg Kroah-HartmanFrom: Grzegorz Siwik <[email protected]>
commit 11e551a2efa4481bd4f616ab75374a2710b480e9 upstream.
Ignore EEXIST error when setting promiscuous mode. This fix is needed because the driver could set promiscuous mode when it still has not cleared properly.
Promiscuous mode could be set only once, so setting it second time will be rejected.
--- drivers/net/ethernet/intel/ice/ice_switch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_switch.c +1 -1
@@ -2590,7 +2590,7 @@ ice_set_vlan_vsi_promisc(struct ice_hw *else status =ice_set_vsi_promisc (hw, vsi_handle, promisc_mask, vlan_id); -if (status) +if (status && status != -EEXIST )break ; }
Greg Kroah-Hartman
maintainerPATCH 87/158 i2c: imx: Make sure to unregister adapter on remove()
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
commit d98bdd3a5b50446d8e010be5b04ce81c4eabf728 upstream.
If for whatever reasons pm_runtime_resume_and_get() fails and .remove() is exited early, the i2c adapter stays around and the irq still calls its handler, while the driver data and the register mapping go away. So if later the i2c adapter is accessed or the irq triggers this results in havoc accessing freed memory and unmapped registers.
So unregister the software resources even if resume failed, and only skip the hardware access in that case.
--- drivers/i2c/busses/i2c-imx.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/i2c/busses/i2c-imx.c +11 -9
@@ -1280,9 +1280,7 @@ static int i2c_imx_remove(struct platforstruct imx_i2c_struct *i2c_imx =platform_get_drvdata (pdev);int irq, ret; - ret =pm_runtime_resume_and_get (&pdev->dev); -if (ret <0 ) -return ret; + ret =pm_runtime_get_sync (&pdev->dev);/* remove adapter */ dev_dbg (&i2c_imx->adapter.dev,"adapter removed\n" );
@@ -1291,17 +1289,21 @@ static int i2c_imx_remove(struct platforif (i2c_imx->dma)i2c_imx_dma_free (i2c_imx); -/* setup chip registers to defaults */ -imx_i2c_write_reg (0 , i2c_imx,IMX_I2C_IADR ); -imx_i2c_write_reg (0 , i2c_imx,IMX_I2C_IFDR ); -imx_i2c_write_reg (0 , i2c_imx,IMX_I2C_I2CR ); -imx_i2c_write_reg (0 , i2c_imx,IMX_I2C_I2SR ); +if (ret ==0 ) { +/* setup chip registers to defaults */ +imx_i2c_write_reg (0 , i2c_imx,IMX_I2C_IADR ); +imx_i2c_write_reg (0 , i2c_imx,IMX_I2C_IFDR ); +imx_i2c_write_reg (0 , i2c_imx,IMX_I2C_I2CR ); +imx_i2c_write_reg (0 , i2c_imx,IMX_I2C_I2SR ); +clk_disable (i2c_imx->clk); + }clk_notifier_unregister (i2c_imx->clk, &i2c_imx->clk_change_nb); irq =platform_get_irq (pdev,0 );if (irq >=0 )free_irq (irq, i2c_imx); -clk_disable_unprepare (i2c_imx->clk); + +clk_unprepare (i2c_imx->clk);pm_runtime_put_noidle (&pdev->dev);pm_runtime_disable (&pdev->dev);
Greg Kroah-Hartman
maintainerPATCH 88/158 regulator: pca9450: Remove restrictions for regulator-name
In reply to Greg Kroah-HartmanFrom: Frieder Schrempf <[email protected]>
commit b0de7fa706506bf0591037908376351beda8c5d6 upstream.
The device bindings shouldn't put any constraints on the regulator-name property specified in the generic bindings. This allows using arbitrary and descriptive names for the regulators.
--- .../bindings/regulator/nxp,pca9450-regulator.yaml | 11 ----------- 1 file changed, 11 deletions(-)
Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml +0 -11
@@ -47,12 +47,6 @@ properties: description: Properties for single LDO regulator. - properties: - regulator-name: - pattern: "^LDO[1-5]$" - description: - should be "LDO1", ..., "LDO5" - unevaluatedProperties: false "^BUCK[1-6]$":
@@ -62,11 +56,6 @@ properties: Properties for single BUCK regulator. properties: - regulator-name: - pattern: "^BUCK[1-6]$" - description: - should be "BUCK1", ..., "BUCK6" - nxp,dvs-run-voltage: $ref: "/schemas/types.yaml#/definitions/uint32" minimum: 600000
Signature · 1 line
2.37.2
Greg Kroah-Hartman
maintainerPATCH 89/158 i40e: Fix to stop tx_timeout recovery if GLOBR fails
In reply to Greg Kroah-HartmanFrom: Alan Brady <[email protected]>
commit 57c942bc3bef0970f0b21f8e0998e76a900ea80d upstream.
When a tx_timeout fires, the PF attempts to recover by incrementally resetting. First we try a PFR, then CORER and finally a GLOBR. If the GLOBR fails, then we keep hitting the tx_timeout and incrementing the recovery level and issuing dmesgs, which is both annoying to the user and accomplishes nothing.
If the GLOBR fails, then we're pretty much totally hosed, and there's not much else we can do to recover, so this makes it such that we just kill the VSI and stop hitting the tx_timeout in such a case.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -1
@@ -382,7 +382,9 @@ static void i40e_tx_timeout(struct net_dset_bit (__I40E_GLOBAL_RESET_REQUESTED, pf->state);break ;default : -netdev_err (netdev,"tx_timeout recovery unsuccessful\n" ); +netdev_err (netdev,"tx_timeout recovery unsuccessful, device is in non-recoverable state.\n" ); +set_bit (__I40E_DOWN_REQUESTED, pf->state); +set_bit (__I40E_VSI_DOWN_REQUESTED, vsi->state);break ; }
Greg Kroah-Hartman
maintainerPATCH 90/158 fec: Fix timer capture timing in `fec_ptp_enable_pps()`
In reply to Greg Kroah-HartmanFrom: Csókás Bence <[email protected]>
commit 61d5e2a251fb20c2c5e998c3f1d52ed6d5360319 upstream.
Code reimplements functionality already in fec_ptp_read(), but misses check for FEC_QUIRK_BUG_CAPTURE. Replace with function call.
--- drivers/net/ethernet/freescale/fec_ptp.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/net/ethernet/freescale/fec_ptp.c +1 -5
@@ -136,11 +136,7 @@ static int fec_ptp_enable_pps(struct fec* NSEC_PER_SEC - ts.tv_nsec. Add the remaining nanoseconds * to current timer would be next second. */ - tempval =readl (fep->hwp +FEC_ATIME_CTRL ); - tempval |=FEC_T_CTRL_CAPTURE ; -writel (tempval, fep->hwp +FEC_ATIME_CTRL ); - - tempval =readl (fep->hwp +FEC_ATIME ); + tempval = fep->cc.read (&fep->cc);/* Convert the ptp local counter to 1588 timestamp */ ns =timecounter_cyc2time (&fep->tc, tempval); ts =ns_to_timespec64 (ns);
Greg Kroah-Hartman
maintainerPATCH 91/158 stmmac: intel: Add a missing clk_disable_unprepare() call in intel_eth_pci_remove()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
commit 5c23d6b717e4e956376f3852b90f58e262946b50 upstream.
Commit 09f012e64e4b ("stmmac: intel: Fix clock handling on error and remove paths") removed this clk_disable_unprepare()
This was partly revert by commit ac322f86b56c ("net: stmmac: Fix clock handling on remove path") which removed this clk_disable_unprepare() because:
"
While unloading the dwmac-intel driver, clk_disable_unprepare() is being called twice in stmmac_dvr_remove() and intel_eth_pci_remove(). This causes kernel panic on the second call.
"
However later on, commit 5ec55823438e8 ("net: stmmac: add clocks management for gmac driver") has updated stmmac_dvr_remove() which do not call clk_disable_unprepare() anymore.
So this call should now be called from intel_eth_pci_remove().
--- drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +1 -0
@@ -669,6 +669,7 @@ static void intel_eth_pci_remove(structpci_free_irq_vectors (pdev); +clk_disable_unprepare (priv->plat->stmmac_clk);clk_unregister_fixed_rate (priv->plat->stmmac_clk);pcim_iounmap_regions (pdev,BIT (0 ));
Greg Kroah-Hartman
maintainerPATCH 92/158 igb: Add lock to avoid data race
In reply to Greg Kroah-HartmanFrom: Lin Ma <[email protected]>
commit 6faee3d4ee8be0f0367d0c3d826afb3571b7a5e0 upstream.
The commit c23d92b80e0b ("igb: Teardown SR-IOV before unregister_netdev()") places the unregister_netdev() call after the igb_disable_sriov() call to avoid functionality issue.
However, it introduces several race conditions when detaching a device. For example, when .remove() is called, the below interleaving leads to use-after-free.
(FREE from device detaching) | (USE from netdev core)
igb_remove | igb_ndo_get_vf_config
igb_disable_sriov | vf >= adapter->vfs_allocated_count?
kfree(adapter->vf_data) |
adapter->vfs_allocated_count = 0 |
| memcpy(... adapter->vf_data[vf]Moreover, the igb_disable_sriov() also suffers from data race with the requests from VF driver.
(FREE from device detaching) | (USE from requests) igb_remove | igb_msix_other igb_disable_sriov | igb_msg_task kfree(adapter->vf_data) | vf < adapter->vfs_allocated_count adapter->vfs_allocated_count = 0 |
To this end, this commit first eliminates the data races from netdev core by using rtnl_lock (similar to commit 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink")). And then adds a spinlock to eliminate races from driver requests. (similar to commit 1e53834ce541 ("ixgbe: Add locking to prevent panic when setting sriov_numvfs to zero")
--- drivers/net/ethernet/intel/igb/igb.h | 2 ++ drivers/net/ethernet/intel/igb/igb_main.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/igb/igb.h +2 -0
@@ -664,6 +664,8 @@ struct igb_adapter {struct igb_mac_addr *mac_table;struct vf_mac_filter vf_macs;struct vf_mac_filter *vf_mac_list; +/* lock for VF resources */ +spinlock_t vfs_lock; };/* flags controlling PTP/1588 function */
drivers/net/ethernet/intel/igb/igb_main.c +11 -1
@@ -3638,6 +3638,7 @@ static int igb_disable_sriov(struct pci_struct net_device *netdev =pci_get_drvdata (pdev);struct igb_adapter *adapter =netdev_priv (netdev);struct e1000_hw *hw = &adapter->hw; +unsigned long flags;/* reclaim resources allocated to VFs */ if (adapter->vf_data) {
@@ -3650,12 +3651,13 @@ static int igb_disable_sriov(struct pci_pci_disable_sriov (pdev);msleep (500 ); } - +spin_lock_irqsave (&adapter->vfs_lock, flags);kfree (adapter->vf_mac_list); adapter->vf_mac_list =NULL ;kfree (adapter->vf_data); adapter->vf_data =NULL ; adapter->vfs_allocated_count =0 ; +spin_unlock_irqrestore (&adapter->vfs_lock, flags);wr32 (E1000_IOVCTL ,E1000_IOVCTL_REUSE_VFQ );wrfl ();msleep (100 );
@@ -3815,7 +3817,9 @@ static void igb_remove(struct pci_dev *pigb_release_hw_control (adapter);#ifdef CONFIG_PCI_IOV +rtnl_lock ();igb_disable_sriov (pdev); +rtnl_unlock ();#endif unregister_netdev (netdev);
@@ -3975,6 +3979,9 @@ static int igb_sw_init(struct igb_adaptespin_lock_init (&adapter->nfc_lock);spin_lock_init (&adapter->stats64_lock); + +/* init spinlock to avoid concurrency of VF resources */ +spin_lock_init (&adapter->vfs_lock);#ifdef CONFIG_PCI_IOV switch (hw->mac.type) {case e1000_82576:
@@ -7852,8 +7859,10 @@ unlock:static void igb_msg_task (struct igb_adapter *adapter) {struct e1000_hw *hw = &adapter->hw; +unsigned long flags;u32 vf; +spin_lock_irqsave (&adapter->vfs_lock, flags);for (vf =0 ; vf < adapter->vfs_allocated_count; vf++) {/* process any reset requests */ if (!igb_check_for_rst (hw, vf))
@@ -7867,6 +7876,7 @@ static void igb_msg_task(struct igb_adapif (!igb_check_for_ack (hw, vf))igb_rcv_ack_from_vf (adapter, vf); } +spin_unlock_irqrestore (&adapter->vfs_lock, flags); }/**
Greg Kroah-Hartman
maintainerPATCH 93/158 kbuild: fix the modules order between drivers and libs
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit 113147510b48e764e624e3d0e6707a1e48bc05a9 upstream.
Commit b2c885549122 ("kbuild: update modules.order only when contained modules are updated") accidentally changed the modules order.
Prior to that commit, the modules order was determined based on vmlinux-dirs, which lists core-y/m, drivers-y/m, libs-y/m, in this order.
Now, subdir-modorder lists them in a different order: core-y/m, libs-y/m, drivers-y/m.
Presumably, there was no practical issue because the modules in drivers and libs are orthogonal, but there is no reason to have this distortion.
Get back to the original order.
--- Makefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Makefile +2 -4
@@ -1133,13 +1133,11 @@ vmlinux-alldirs := $(sort $(vmlinux-dirs $(patsubst %/,%,$(filter %/, $(core-) \ $(drivers-) $(libs-)))) -subdir-modorder := $(addsuffix modules.order,$(filter %/, \ - $(core-y) $(core-m) $(libs-y) $(libs-m) \ - $(drivers-y) $(drivers-m))) - build-dirs := $(vmlinux-dirs) clean-dirs := $(vmlinux-alldirs) +subdir-modorder := $(addsuffix /modules.order, $(build-dirs)) + # Externally visible symbols (used by link-vmlinux.sh) KBUILD_VMLINUX_OBJS := $(head-y) $(patsubst %/,%/built-in.a, $(core-y)) KBUILD_VMLINUX_OBJS += $(addsuffix built-in.a, $(filter %/, $(libs-y)))
Greg Kroah-Hartman
maintainerPATCH 94/158 gcc-plugins: Undefine LATENT_ENTROPY_PLUGIN when plugin disabled for a file
In reply to Greg Kroah-HartmanFrom: Andrew Donnellan <[email protected]>
commit 012e8d2034f1bda8863435cd589636e618d6a659 upstream.
Commit 36d4b36b6959 ("lib/nodemask: inline next_node_in() and node_random()") refactored some code by moving node_random() from lib/nodemask.c to include/linux/nodemask.h, thus requiring nodemask.h to include random.h, which conditionally defines add_latent_entropy() depending on whether the macro LATENT_ENTROPY_PLUGIN is defined.
This broke the build on powerpc, where nodemask.h is indirectly included in arch/powerpc/kernel/prom_init.c, part of the early boot machinery that is excluded from the latent entropy plugin using DISABLE_LATENT_ENTROPY_PLUGIN. It turns out that while we add a gcc flag to disable the actual plugin, we don't undefine LATENT_ENTROPY_PLUGIN.
This leads to the following:
CC arch/powerpc/kernel/prom_init.o
In file included from ./include/linux/nodemask.h:97,
from ./include/linux/mmzone.h:17,
from ./include/linux/gfp.h:7,
from ./include/linux/xarray.h:15,
from ./include/linux/radix-tree.h:21,
from ./include/linux/idr.h:15,
from ./include/linux/kernfs.h:12,
from ./include/linux/sysfs.h:16,
from ./include/linux/kobject.h:20,
from ./include/linux/pci.h:35,
from arch/powerpc/kernel/prom_init.c:24:
./include/linux/random.h: In function 'add_latent_entropy':
./include/linux/random.h:25:46: error: 'latent_entropy' undeclared (first use in this function); did you mean 'add_latent_entropy'?
25 | add_device_randomness((const void *)&latent_entropy, sizeof(latent_entropy));
| ^~~~~~~~~~~~~~
| add_latent_entropy ./include/linux/random.h:25:46: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [scripts/Makefile.build:249: arch/powerpc/kernel/prom_init.o] Fehler 1
make[1]: *** [scripts/Makefile.build:465: arch/powerpc/kernel] Fehler 2
make: *** [Makefile:1855: arch/powerpc] Error 2
Change the DISABLE_LATENT_ENTROPY_PLUGIN flags to undefine LATENT_ENTROPY_PLUGIN for files where the plugin is disabled.
--- scripts/Makefile.gcc-plugins | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.gcc-plugins +1 -1
@@ -6,7 +6,7 @@ gcc-plugin-$(CONFIG_GCC_PLUGIN_LATENT_EN gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) \ += -DLATENT_ENTROPY_PLUGIN ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY - DISABLE_LATENT_ENTROPY_PLUGIN += -fplugin-arg-latent_entropy_plugin-disable + DISABLE_LATENT_ENTROPY_PLUGIN += -fplugin-arg-latent_entropy_plugin-disable -ULATENT_ENTROPY_PLUGIN endif export DISABLE_LATENT_ENTROPY_PLUGIN
Greg Kroah-Hartman
maintainerPATCH 95/158 locking/atomic: Make test_and_*_bit() ordered on failure
In reply to Greg Kroah-HartmanFrom: Hector Martin <[email protected]>
commit 415d832497098030241605c52ea83d4e2cfa7879 upstream.
These operations are documented as always ordered in include/asm-generic/bitops/instrumented-atomic.h, and producer-consumer type use cases where one side needs to ensure a flag is left pending after some shared data was updated rely on this ordering, even in the failure case.
This is the case with the workqueue code, which currently suffers from a reproducible ordering violation on Apple M1 platforms (which are notoriously out-of-order) that ends up causing the TTY layer to fail to deliver data to userspace properly under the right conditions. This change fixes that bug.
Change the documentation to restrict the "no order on failure" story to the _lock() variant (for which it makes sense), and remove the early-exit from the generic implementation, which is what causes the missing barrier semantics in that case. Without this, the remaining atomic op is fully ordered (including on ARM64 LSE, as of recent versions of the architecture spec).
--- Documentation/atomic_bitops.txt | 2 +- include/asm-generic/bitops/atomic.h | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-)
Documentation/atomic_bitops.txt +1 -1
@@ -59,7 +59,7 @@ Like with atomic_t, the rule of thumb is - RMW operations that have a return value are fully ordered. - RMW operations that are conditional are unordered on FAILURE, - otherwise the above rules apply. In the case of test_and_{}_bit() operations, + otherwise the above rules apply. In the case of test_and_set_bit_lock(), if the bit in memory is unchanged by the operation then it is deemed to have failed.
include/asm-generic/bitops/atomic.h +0 -6
@@ -35,9 +35,6 @@ static inline int test_and_set_bit(unsigunsigned long mask =BIT_MASK (nr); p +=BIT_WORD (nr); -if (READ_ONCE (*p) & mask) -return 1 ; - old =atomic_long_fetch_or (mask, (atomic_long_t *)p);return !!(old & mask); }
@@ -48,9 +45,6 @@ static inline int test_and_clear_bit(unsunsigned long mask =BIT_MASK (nr); p +=BIT_WORD (nr); -if (!(READ_ONCE (*p) & mask)) -return 0 ; - old =atomic_long_fetch_andnot (mask, (atomic_long_t *)p);return !!(old & mask); }
Greg Kroah-Hartman
maintainerPATCH 96/158 ASoC: SOF: intel: move sof_intel_dsp_desc() forward
In reply to Greg Kroah-HartmanFrom: Bard Liao <[email protected]>
[ Upstream commit 2f1315ae94b46bf0d5b4be29be15cc3641364404 ]
sof_intel_dsp_desc() will be used by hda_dsp_check_sdw_irq() in the following commit.
--- sound/soc/sof/intel/hda.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
sound/soc/sof/intel/hda.c +11 -11
@@ -39,6 +39,17 @@#define EXCEPT_MAX_HDR_SIZE 0x400#define HDA_EXT_ROM_STATUS_SIZE 8 +static const struct sof_intel_dsp_desc + *get_chip_info (struct snd_sof_pdata *pdata) +{ +const struct sof_dev_desc *desc = pdata->desc; +const struct sof_intel_dsp_desc *chip_info; + + chip_info = desc->chip_info; + +return chip_info; +} +#if IS_ENABLED (CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE )/*
@@ -674,17 +685,6 @@ static int hda_init_caps(struct snd_sof_dev *sdev)return 0 ; } -static const struct sof_intel_dsp_desc - *get_chip_info (struct snd_sof_pdata *pdata) -{ -const struct sof_dev_desc *desc = pdata->desc; -const struct sof_intel_dsp_desc *chip_info; - - chip_info = desc->chip_info; - -return chip_info; -} -static irqreturn_t hda_dsp_interrupt_handler (int irq,void *context) {struct snd_sof_dev *sdev = context;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 97/158 drm/meson: Fix refcount bugs in meson_vpu_has_available_connectors()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 91b3c8dbe898df158fd2a84675f3a284ff6666f7 ]
In this function, there are two refcount leak bugs:
(1) when breaking out of for_each_endpoint_of_node(), we need call the of_node_put() for the 'ep';
(2) we should call of_node_put() for the reference returned by of_graph_get_remote_port() when it is not used anymore.
--- drivers/gpu/drm/meson/meson_drv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/meson/meson_drv.c +4 -1
@@ -116,8 +116,11 @@ static bool meson_vpu_has_available_connectors(struct device *dev)for_each_endpoint_of_node (dev->of_node, ep) {/* If the endpoint node exists, consider it enabled */ remote =of_graph_get_remote_port (ep); -if (remote) +if (remote) { +of_node_put (remote); +of_node_put (ep);return true; + } }return false;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 98/158 audit: log nftables configuration change events once per table
In reply to Greg Kroah-HartmanFrom: Richard Guy Briggs <[email protected]>
[ Upstream commit c520292f29b8047285bcfbc2322fa2a9bf02521a ]
Reduce logging of nftables events to a level similar to iptables. Restore the table field to list the table, adding the generation.
Indicate the op as the most significant operation in the event.
A couple of sample events:
type=PROCTITLE msg=audit(2021-03-18 09:30:49.801:143) : proctitle=/usr/bin/python3 -s /usr/sbin/firewalld --nofork --nopid
type=SYSCALL msg=audit(2021-03-18 09:30:49.801:143) : arch=x86_64 syscall=sendmsg success=yes exit=172 a0=0x6 a1=0x7ffdcfcbe650 a2=0x0 a3=0x7ffdcfcbd52c items=0 ppid=1 pid=367 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=roo t sgid=root fsgid=root tty=(none) ses=unset comm=firewalld exe=/usr/bin/python3.9 subj=system_u:system_r:firewalld_t:s0 key=(null)
type=NETFILTER_CFG msg=audit(2021-03-18 09:30:49.801:143) : table=firewalld:2 family=ipv6 entries=1 op=nft_register_table pid=367 subj=system_u:system_r:firewalld_t:s0 comm=firewalld
type=NETFILTER_CFG msg=audit(2021-03-18 09:30:49.801:143) : table=firewalld:2 family=ipv4 entries=1 op=nft_register_table pid=367 subj=system_u:system_r:firewalld_t:s0 comm=firewalld
type=NETFILTER_CFG msg=audit(2021-03-18 09:30:49.801:143) : table=firewalld:2 family=inet entries=1 op=nft_register_table pid=367 subj=system_u:system_r:firewalld_t:s0 comm=firewalld
type=PROCTITLE msg=audit(2021-03-18 09:30:49.839:144) : proctitle=/usr/bin/python3 -s /usr/sbin/firewalld --nofork --nopid
type=SYSCALL msg=audit(2021-03-18 09:30:49.839:144) : arch=x86_64 syscall=sendmsg success=yes exit=22792 a0=0x6 a1=0x7ffdcfcbe650 a2=0x0 a3=0x7ffdcfcbd52c items=0 ppid=1 pid=367 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=r oot sgid=root fsgid=root tty=(none) ses=unset comm=firewalld exe=/usr/bin/python3.9 subj=system_u:system_r:firewalld_t:s0 key=(null)
type=NETFILTER_CFG msg=audit(2021-03-18 09:30:49.839:144) : table=firewalld:3 family=ipv6 entries=30 op=nft_register_chain pid=367 subj=system_u:system_r:firewalld_t:s0 comm=firewalld
type=NETFILTER_CFG msg=audit(2021-03-18 09:30:49.839:144) : table=firewalld:3 family=ipv4 entries=30 op=nft_register_chain pid=367 subj=system_u:system_r:firewalld_t:s0 comm=firewalld
type=NETFILTER_CFG msg=audit(2021-03-18 09:30:49.839:144) : table=firewalld:3 family=inet entries=165 op=nft_register_chain pid=367 subj=system_u:system_r:firewalld_t:s0 comm=firewalld
The issue was originally documented in
https://github.com/linux-audit/audit-kernel/issues/124
--- net/netfilter/nf_tables_api.c | 186 +++++++++++++++++++--------------- 1 file changed, 103 insertions(+), 83 deletions(-)
net/netfilter/nf_tables_api.c +103 -83
@@ -66,6 +66,41 @@ static const struct rhashtable_params nft_objname_ht_params = { .automatic_shrinking = true, }; +struct nft_audit_data { +struct nft_table *table; +int entries; +int op; +struct list_head list; +}; + +static const u8 nft2audit_op[NFT_MSG_MAX ] = {// enum nf_tables_msg_types + [NFT_MSG_NEWTABLE ] =AUDIT_NFT_OP_TABLE_REGISTER , + [NFT_MSG_GETTABLE ] =AUDIT_NFT_OP_INVALID , + [NFT_MSG_DELTABLE ] =AUDIT_NFT_OP_TABLE_UNREGISTER , + [NFT_MSG_NEWCHAIN ] =AUDIT_NFT_OP_CHAIN_REGISTER , + [NFT_MSG_GETCHAIN ] =AUDIT_NFT_OP_INVALID , + [NFT_MSG_DELCHAIN ] =AUDIT_NFT_OP_CHAIN_UNREGISTER , + [NFT_MSG_NEWRULE ] =AUDIT_NFT_OP_RULE_REGISTER , + [NFT_MSG_GETRULE ] =AUDIT_NFT_OP_INVALID , + [NFT_MSG_DELRULE ] =AUDIT_NFT_OP_RULE_UNREGISTER , + [NFT_MSG_NEWSET ] =AUDIT_NFT_OP_SET_REGISTER , + [NFT_MSG_GETSET ] =AUDIT_NFT_OP_INVALID , + [NFT_MSG_DELSET ] =AUDIT_NFT_OP_SET_UNREGISTER , + [NFT_MSG_NEWSETELEM ] =AUDIT_NFT_OP_SETELEM_REGISTER , + [NFT_MSG_GETSETELEM ] =AUDIT_NFT_OP_INVALID , + [NFT_MSG_DELSETELEM ] =AUDIT_NFT_OP_SETELEM_UNREGISTER , + [NFT_MSG_NEWGEN ] =AUDIT_NFT_OP_GEN_REGISTER , + [NFT_MSG_GETGEN ] =AUDIT_NFT_OP_INVALID , + [NFT_MSG_TRACE ] =AUDIT_NFT_OP_INVALID , + [NFT_MSG_NEWOBJ ] =AUDIT_NFT_OP_OBJ_REGISTER , + [NFT_MSG_GETOBJ ] =AUDIT_NFT_OP_INVALID , + [NFT_MSG_DELOBJ ] =AUDIT_NFT_OP_OBJ_UNREGISTER , + [NFT_MSG_GETOBJ_RESET ] =AUDIT_NFT_OP_OBJ_RESET , + [NFT_MSG_NEWFLOWTABLE ] =AUDIT_NFT_OP_FLOWTABLE_REGISTER , + [NFT_MSG_GETFLOWTABLE ] =AUDIT_NFT_OP_INVALID , + [NFT_MSG_DELFLOWTABLE ] =AUDIT_NFT_OP_FLOWTABLE_UNREGISTER , +}; +static void nft_validate_state_update (struct net *net,u8 new_validate_state) {switch (net->nft.validate_state) {
@@ -710,17 +745,6 @@ static void nf_tables_table_notify(const struct nft_ctx *ctx, int event) {struct sk_buff *skb;int err; -char *buf =kasprintf (GFP_KERNEL ,"%s:%llu;?:0" , - ctx->table->name, ctx->table->handle); - -audit_log_nfcfg (buf, - ctx->family, - ctx->table->use, - event ==NFT_MSG_NEWTABLE ? -AUDIT_NFT_OP_TABLE_REGISTER : -AUDIT_NFT_OP_TABLE_UNREGISTER , -GFP_KERNEL ); -kfree (buf);if (!ctx->report && !nfnetlink_has_listeners (ctx->net,NFNLGRP_NFTABLES ))
@@ -1477,18 +1501,6 @@ static void nf_tables_chain_notify(const struct nft_ctx *ctx, int event) {struct sk_buff *skb;int err; -char *buf =kasprintf (GFP_KERNEL ,"%s:%llu;%s:%llu" , - ctx->table->name, ctx->table->handle, - ctx->chain->name, ctx->chain->handle); - -audit_log_nfcfg (buf, - ctx->family, - ctx->chain->use, - event ==NFT_MSG_NEWCHAIN ? -AUDIT_NFT_OP_CHAIN_REGISTER : -AUDIT_NFT_OP_CHAIN_UNREGISTER , -GFP_KERNEL ); -kfree (buf);if (!ctx->report && !nfnetlink_has_listeners (ctx->net,NFNLGRP_NFTABLES ))
@@ -2844,18 +2856,6 @@ static void nf_tables_rule_notify(const struct nft_ctx *ctx, {struct sk_buff *skb;int err; -char *buf =kasprintf (GFP_KERNEL ,"%s:%llu;%s:%llu" , - ctx->table->name, ctx->table->handle, - ctx->chain->name, ctx->chain->handle); - -audit_log_nfcfg (buf, - ctx->family, - rule->handle, - event ==NFT_MSG_NEWRULE ? -AUDIT_NFT_OP_RULE_REGISTER : -AUDIT_NFT_OP_RULE_UNREGISTER , -GFP_KERNEL ); -kfree (buf);if (!ctx->report && !nfnetlink_has_listeners (ctx->net,NFNLGRP_NFTABLES ))
@@ -3882,18 +3882,6 @@ static void nf_tables_set_notify(const struct nft_ctx *ctx,struct sk_buff *skb;u32 portid = ctx->portid;int err; -char *buf =kasprintf (gfp_flags,"%s:%llu;%s:%llu" , - ctx->table->name, ctx->table->handle, - set->name, set->handle); - -audit_log_nfcfg (buf, - ctx->family, - set->field_count, - event ==NFT_MSG_NEWSET ? -AUDIT_NFT_OP_SET_REGISTER : -AUDIT_NFT_OP_SET_UNREGISTER , - gfp_flags); -kfree (buf);if (!ctx->report && !nfnetlink_has_listeners (ctx->net,NFNLGRP_NFTABLES ))
@@ -5035,18 +5023,6 @@ static void nf_tables_setelem_notify(const struct nft_ctx *ctx,u32 portid = ctx->portid;struct sk_buff *skb;int err; -char *buf =kasprintf (GFP_KERNEL ,"%s:%llu;%s:%llu" , - ctx->table->name, ctx->table->handle, - set->name, set->handle); - -audit_log_nfcfg (buf, - ctx->family, - set->handle, - event ==NFT_MSG_NEWSETELEM ? -AUDIT_NFT_OP_SETELEM_REGISTER : -AUDIT_NFT_OP_SETELEM_UNREGISTER , -GFP_KERNEL ); -kfree (buf);if (!ctx->report && !nfnetlink_has_listeners (net,NFNLGRP_NFTABLES ))return ;
@@ -6180,12 +6156,11 @@ static int nf_tables_dump_obj(struct sk_buff *skb, struct netlink_callback *cb) filter->type != NFT_OBJECT_UNSPEC && obj->ops->type->type != filter->type) goto cont; -if (reset) {char *buf =kasprintf (GFP_ATOMIC , -"%s:%llu;?:0" , +"%s:%u" , table->name, - table->handle); + net->nft.base_seq); audit_log_nfcfg(buf, family,
@@ -6306,8 +6281,8 @@ static int nf_tables_getobj(struct net *net, struct sock *nlsk, reset = true;if (reset) { -char *buf =kasprintf (GFP_ATOMIC ,"%s:%llu;?:0" , - table->name, table->handle); +char *buf =kasprintf (GFP_ATOMIC ,"%s:%u" , + table->name, net->nft.base_seq); audit_log_nfcfg(buf, family,
@@ -6394,15 +6369,15 @@ void nft_obj_notify(struct net *net, const struct nft_table *table, {struct sk_buff *skb;int err; -char *buf =kasprintf (gfp,"%s:%llu;?:0" , - table->name, table->handle); +char *buf =kasprintf (gfp,"%s:%u" , + table->name, net->nft.base_seq);audit_log_nfcfg (buf, family, obj->handle, event ==NFT_MSG_NEWOBJ ? -AUDIT_NFT_OP_OBJ_REGISTER : -AUDIT_NFT_OP_OBJ_UNREGISTER , +AUDIT_NFT_OP_OBJ_REGISTER : +AUDIT_NFT_OP_OBJ_UNREGISTER , gfp);kfree (buf);
@@ -7220,18 +7195,6 @@ static void nf_tables_flowtable_notify(struct nft_ctx *ctx, {struct sk_buff *skb;int err; -char *buf =kasprintf (GFP_KERNEL ,"%s:%llu;%s:%llu" , - flowtable->table->name, flowtable->table->handle, - flowtable->name, flowtable->handle); - -audit_log_nfcfg (buf, - ctx->family, - flowtable->hooknum, - event ==NFT_MSG_NEWFLOWTABLE ? -AUDIT_NFT_OP_FLOWTABLE_REGISTER : -AUDIT_NFT_OP_FLOWTABLE_UNREGISTER , -GFP_KERNEL ); -kfree (buf);if (!ctx->report && !nfnetlink_has_listeners (ctx->net,NFNLGRP_NFTABLES ))
@@ -7352,9 +7315,6 @@ static void nf_tables_gen_notify(struct net *net, struct sk_buff *skb,struct sk_buff *skb2;int err; -audit_log_nfcfg ("?:0;?:0" ,0 , net->nft.base_seq, -AUDIT_NFT_OP_GEN_REGISTER ,GFP_KERNEL ); -if (!nlmsg_report (nlh) && !nfnetlink_has_listeners (net,NFNLGRP_NFTABLES ))return ;
@@ -7885,12 +7845,64 @@ static void nft_commit_notify(struct net *net, u32 portid)WARN_ON_ONCE (!list_empty (&net->nft.notify_list)); } +static int nf_tables_commit_audit_alloc (struct list_head *adl, +struct nft_table *table) +{ +struct nft_audit_data *adp; + +list_for_each_entry (adp, adl, list) { +if (adp->table == table) +return 0 ; + } + adp =kzalloc (sizeof (*adp),GFP_KERNEL ); +if (!adp) +return -ENOMEM ; + adp->table = table; +list_add (&adp->list, adl); +return 0 ; +} + +static void nf_tables_commit_audit_collect (struct list_head *adl, +struct nft_table *table,u32 op) +{ +struct nft_audit_data *adp; + +list_for_each_entry (adp, adl, list) { +if (adp->table == table) + goto found; + } +WARN_ONCE ("table=%s not expected in commit list" , table->name); +return ; +found: + adp->entries++; +if (!adp->op || adp->op > op) + adp->op = op; +} + +#define AUNFTABLENAMELEN (NFT_TABLE_MAXNAMELEN + 22) + +static void nf_tables_commit_audit_log (struct list_head *adl,u32 generation) +{ +struct nft_audit_data *adp, *adn; +char aubuf[AUNFTABLENAMELEN ]; + +list_for_each_entry_safe (adp, adn, adl, list) { +snprintf (aubuf,AUNFTABLENAMELEN ,"%s:%u" , adp->table->name, + generation); +audit_log_nfcfg (aubuf, adp->table->family, adp->entries, + nft2audit_op[adp->op],GFP_KERNEL ); +list_del (&adp->list); +kfree (adp); + } +} +static int nf_tables_commit (struct net *net,struct sk_buff *skb) {struct nft_trans *trans, *next;struct nft_trans_elem *te;struct nft_chain *chain;struct nft_table *table; +LIST_HEAD (adl);int err;if (list_empty (&net->nft.commit_list)) {
@@ -7910,6 +7922,11 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)list_for_each_entry_safe (trans, next, &net->nft.commit_list, list) {int ret; + ret =nf_tables_commit_audit_alloc (&adl, trans->ctx.table); +if (ret) { +nf_tables_commit_chain_prepare_cancel (net); +return ret; + }if (trans->msg_type ==NFT_MSG_NEWRULE || trans->msg_type ==NFT_MSG_DELRULE ) { chain = trans->ctx.chain;
@@ -7938,6 +7955,8 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb) net->nft.gencursor =nft_gencursor_next (net);list_for_each_entry_safe (trans, next, &net->nft.commit_list, list) { +nf_tables_commit_audit_collect (&adl, trans->ctx.table, + trans->msg_type);switch (trans->msg_type) {case NFT_MSG_NEWTABLE :if (nft_trans_table_update (trans)) {
@@ -8092,6 +8111,7 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)nft_commit_notify (net,NETLINK_CB (skb).portid);nf_tables_gen_notify (net, skb,NFT_MSG_NEWGEN ); +nf_tables_commit_audit_log (&adl, net->nft.base_seq);nf_tables_commit_release (net);return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 99/158 netfilter: nftables: add helper function to set the base sequence number
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 802b805162a1b7d8391c40ac8a878e9e63287aff ]
This patch adds a helper function to calculate the base sequence number field that is stored in the nfnetlink header. Use the helper function whenever possible.
--- net/netfilter/nf_tables_api.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
net/netfilter/nf_tables_api.c +14 -9
@@ -683,6 +683,11 @@ nf_tables_chain_type_lookup(struct net *net, const struct nlattr *nla,return ERR_PTR (-ENOENT ); } +static __be16 nft_base_seq (const struct net *net) +{ +return htons (net->nft.base_seq &0xffff ); +} +static const struct nla_policy nft_table_policy[NFTA_TABLE_MAX +1 ] = { [NFTA_TABLE_NAME ] = { .type =NLA_STRING , .len =NFT_TABLE_MAXNAMELEN -1 },
@@ -707,7 +712,7 @@ static int nf_tables_fill_table_info(struct sk_buff *skb, struct net *net, nfmsg =nlmsg_data (nlh); nfmsg->nfgen_family = family; nfmsg->version =NFNETLINK_V0 ; - nfmsg->res_id =htons (net->nft.base_seq &0xffff ); + nfmsg->res_id =nft_base_seq (net); if (nla_put_string(skb, NFTA_TABLE_NAME, table->name) || nla_put_be32(skb, NFTA_TABLE_FLAGS, htonl(table->flags)) ||
@@ -1448,7 +1453,7 @@ static int nf_tables_fill_chain_info(struct sk_buff *skb, struct net *net, nfmsg =nlmsg_data (nlh); nfmsg->nfgen_family = family; nfmsg->version =NFNETLINK_V0 ; - nfmsg->res_id =htons (net->nft.base_seq &0xffff ); + nfmsg->res_id =nft_base_seq (net);if (nla_put_string (skb,NFTA_CHAIN_TABLE , table->name)) goto nla_put_failure;
@@ -2810,7 +2815,7 @@ static int nf_tables_fill_rule_info(struct sk_buff *skb, struct net *net, nfmsg =nlmsg_data (nlh); nfmsg->nfgen_family = family; nfmsg->version =NFNETLINK_V0 ; - nfmsg->res_id =htons (net->nft.base_seq &0xffff ); + nfmsg->res_id =nft_base_seq (net);if (nla_put_string (skb,NFTA_RULE_TABLE , table->name)) goto nla_put_failure;
@@ -3801,7 +3806,7 @@ static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx, nfmsg =nlmsg_data (nlh); nfmsg->nfgen_family = ctx->family; nfmsg->version =NFNETLINK_V0 ; - nfmsg->res_id =htons (ctx->net->nft.base_seq &0xffff ); + nfmsg->res_id =nft_base_seq (ctx->net);if (nla_put_string (skb,NFTA_SET_TABLE , ctx->table->name)) goto nla_put_failure;
@@ -4751,7 +4756,7 @@ static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb) nfmsg =nlmsg_data (nlh); nfmsg->nfgen_family = table->family; nfmsg->version =NFNETLINK_V0 ; - nfmsg->res_id =htons (net->nft.base_seq &0xffff ); + nfmsg->res_id =nft_base_seq (net);if (nla_put_string (skb,NFTA_SET_ELEM_LIST_TABLE , table->name)) goto nla_put_failure;
@@ -4823,7 +4828,7 @@ static int nf_tables_fill_setelem_info(struct sk_buff *skb, nfmsg =nlmsg_data (nlh); nfmsg->nfgen_family = ctx->family; nfmsg->version =NFNETLINK_V0 ; - nfmsg->res_id =htons (ctx->net->nft.base_seq &0xffff ); + nfmsg->res_id =nft_base_seq (ctx->net);if (nla_put_string (skb,NFTA_SET_TABLE , ctx->table->name)) goto nla_put_failure;
@@ -6092,7 +6097,7 @@ static int nf_tables_fill_obj_info(struct sk_buff *skb, struct net *net, nfmsg =nlmsg_data (nlh); nfmsg->nfgen_family = family; nfmsg->version =NFNETLINK_V0 ; - nfmsg->res_id =htons (net->nft.base_seq &0xffff ); + nfmsg->res_id =nft_base_seq (net); if (nla_put_string(skb, NFTA_OBJ_TABLE, table->name) || nla_put_string(skb, NFTA_OBJ_NAME, obj->key.name) ||
@@ -7004,7 +7009,7 @@ static int nf_tables_fill_flowtable_info(struct sk_buff *skb, struct net *net, nfmsg =nlmsg_data (nlh); nfmsg->nfgen_family = family; nfmsg->version =NFNETLINK_V0 ; - nfmsg->res_id =htons (net->nft.base_seq &0xffff ); + nfmsg->res_id =nft_base_seq (net); if (nla_put_string(skb, NFTA_FLOWTABLE_TABLE, flowtable->table->name) || nla_put_string(skb, NFTA_FLOWTABLE_NAME, flowtable->name) ||
@@ -7249,7 +7254,7 @@ static int nf_tables_fill_gen_info(struct sk_buff *skb, struct net *net, nfmsg =nlmsg_data (nlh); nfmsg->nfgen_family =AF_UNSPEC ; nfmsg->version =NFNETLINK_V0 ; - nfmsg->res_id =htons (net->nft.base_seq &0xffff ); + nfmsg->res_id =nft_base_seq (net); if (nla_put_be32(skb, NFTA_GEN_ID, htonl(net->nft.base_seq)) || nla_put_be32(skb, NFTA_GEN_PROC_PID, htonl(task_pid_nr(current))) ||
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 100/158 netfilter: add helper function to set up the nfnetlink header and use it
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 19c28b1374fb1073a9ec873a6c10bf5f16b10b9d ]
This patch adds a helper function to set up the netlink and nfnetlink headers. Update existing codebase to use it.
--- include/linux/netfilter/nfnetlink.h | 27 +++++++ net/netfilter/ipset/ip_set_core.c | 17 +---- net/netfilter/nf_conntrack_netlink.c | 77 ++++++-------------- net/netfilter/nf_tables_api.c | 102 +++++++-------------------- net/netfilter/nf_tables_trace.c | 9 +-- net/netfilter/nfnetlink_acct.c | 11 +-- net/netfilter/nfnetlink_cthelper.c | 11 +-- net/netfilter/nfnetlink_cttimeout.c | 22 ++---- net/netfilter/nfnetlink_log.c | 11 +-- net/netfilter/nfnetlink_queue.c | 12 ++-- net/netfilter/nft_compat.c | 11 +-- 11 files changed, 102 insertions(+), 208 deletions(-)
include/linux/netfilter/nfnetlink.h +27 -0
@@ -57,6 +57,33 @@ static inline u16 nfnl_msg_type(u8 subsys, u8 msg_type)return subsys <<8 | msg_type; } +static inline void nfnl_fill_hdr (struct nlmsghdr *nlh,u8 family,u8 version, +__be16 res_id) +{ +struct nfgenmsg *nfmsg; + + nfmsg =nlmsg_data (nlh); + nfmsg->nfgen_family = family; + nfmsg->version = version; + nfmsg->res_id = res_id; +} + +static inline struct nlmsghdr *nfnl_msg_put (struct sk_buff *skb,u32 portid, +u32 seq,int type,int flags, +u8 family,u8 version, +__be16 res_id) +{ +struct nlmsghdr *nlh; + + nlh =nlmsg_put (skb, portid, seq, type,sizeof (struct nfgenmsg ), flags); +if (!nlh) +return NULL ; + +nfnl_fill_hdr (nlh, family, version, res_id); + +return nlh; +} +void nfnl_lock (__u8 subsys_id);void nfnl_unlock (__u8 subsys_id);#ifdef CONFIG_PROVE_LOCKING
net/netfilter/ipset/ip_set_core.c +3 -14
@@ -963,20 +963,9 @@ static struct nlmsghdr * start_msg(struct sk_buff *skb, u32 portid, u32 seq, unsigned int flags, enum ipset_cmd cmd) { - struct nlmsghdr *nlh; -struct nfgenmsg *nfmsg; - - nlh =nlmsg_put (skb, portid, seq,nfnl_msg_type (NFNL_SUBSYS_IPSET , cmd), -sizeof (*nfmsg), flags); -if (!nlh) -return NULL ; - - nfmsg =nlmsg_data (nlh); - nfmsg->nfgen_family =NFPROTO_IPV4 ; - nfmsg->version =NFNETLINK_V0 ; - nfmsg->res_id =0 ; - -return nlh; + return nfnl_msg_put(skb, portid, seq, + nfnl_msg_type(NFNL_SUBSYS_IPSET ,cmd ), flags, + NFPROTO_IPV4, NFNETLINK_V0, 0); }/* Create a set */
net/netfilter/nf_conntrack_netlink.c +21 -56
166 lines not on this page · raw message
net/netfilter/nf_tables_api.c +27 -75
209 lines not on this page · raw message
net/netfilter/nf_tables_trace.c +2 -7
@@ -183,7 +183,6 @@ static bool nft_trace_have_verdict_chain(struct nft_traceinfo *info)void nft_trace_notify (struct nft_traceinfo *info) {const struct nft_pktinfo *pkt = info->pkt; -struct nfgenmsg *nfmsg;struct nlmsghdr *nlh;struct sk_buff *skb;unsigned int size;
@@ -219,15 +218,11 @@ void nft_trace_notify(struct nft_traceinfo *info)return ; event =nfnl_msg_type (NFNL_SUBSYS_NFTABLES ,NFT_MSG_TRACE ); - nlh =nlmsg_put (skb,0 ,0 , event,sizeof (struct nfgenmsg ),0 ); + nlh =nfnl_msg_put (skb,0 ,0 , event,0 , info->basechain->type->family, +NFNETLINK_V0 ,0 );if (!nlh) goto nla_put_failure; - nfmsg =nlmsg_data (nlh); - nfmsg->nfgen_family = info->basechain->type->family; - nfmsg->version =NFNETLINK_V0 ; - nfmsg->res_id =0 ; -if (nla_put_be32 (skb,NFTA_TRACE_NFPROTO ,htonl (nft_pf (pkt)))) goto nla_put_failure;
net/netfilter/nfnetlink_acct.c +3 -8
@@ -132,21 +132,16 @@ nfnl_acct_fill_info(struct sk_buff *skb, u32 portid, u32 seq, u32 type, int event, struct nf_acct *acct) { struct nlmsghdr *nlh; -struct nfgenmsg *nfmsg;unsigned int flags = portid ?NLM_F_MULTI :0 ;u64 pkts, bytes;u32 old_flags; event =nfnl_msg_type (NFNL_SUBSYS_ACCT , event); - nlh =nlmsg_put (skb, portid, seq, event,sizeof (*nfmsg), flags); -if (nlh ==NULL ) + nlh =nfnl_msg_put (skb, portid, seq, event, flags,AF_UNSPEC , +NFNETLINK_V0 ,0 ); +if (!nlh) goto nlmsg_failure; - nfmsg =nlmsg_data (nlh); - nfmsg->nfgen_family =AF_UNSPEC ; - nfmsg->version =NFNETLINK_V0 ; - nfmsg->res_id =0 ; -if (nla_put_string (skb,NFACCT_NAME , acct->name)) goto nla_put_failure;
net/netfilter/nfnetlink_cthelper.c +3 -8
@@ -530,20 +530,15 @@ nfnl_cthelper_fill_info(struct sk_buff *skb, u32 portid, u32 seq, u32 type, int event, struct nf_conntrack_helper *helper) { struct nlmsghdr *nlh; -struct nfgenmsg *nfmsg;unsigned int flags = portid ?NLM_F_MULTI :0 ;int status; event =nfnl_msg_type (NFNL_SUBSYS_CTHELPER , event); - nlh =nlmsg_put (skb, portid, seq, event,sizeof (*nfmsg), flags); -if (nlh ==NULL ) + nlh =nfnl_msg_put (skb, portid, seq, event, flags,AF_UNSPEC , +NFNETLINK_V0 ,0 ); +if (!nlh) goto nlmsg_failure; - nfmsg =nlmsg_data (nlh); - nfmsg->nfgen_family =AF_UNSPEC ; - nfmsg->version =NFNETLINK_V0 ; - nfmsg->res_id =0 ; -if (nla_put_string (skb,NFCTH_NAME , helper->name)) goto nla_put_failure;
net/netfilter/nfnetlink_cttimeout.c +6 -16
@@ -160,22 +160,17 @@ ctnl_timeout_fill_info(struct sk_buff *skb, u32 portid, u32 seq, u32 type, int event, struct ctnl_timeout *timeout) { struct nlmsghdr *nlh; -struct nfgenmsg *nfmsg;unsigned int flags = portid ?NLM_F_MULTI :0 ;const struct nf_conntrack_l4proto *l4proto = timeout->timeout.l4proto;struct nlattr *nest_parms;int ret; event =nfnl_msg_type (NFNL_SUBSYS_CTNETLINK_TIMEOUT , event); - nlh =nlmsg_put (skb, portid, seq, event,sizeof (*nfmsg), flags); -if (nlh ==NULL ) + nlh =nfnl_msg_put (skb, portid, seq, event, flags,AF_UNSPEC , +NFNETLINK_V0 ,0 ); +if (!nlh) goto nlmsg_failure; - nfmsg =nlmsg_data (nlh); - nfmsg->nfgen_family =AF_UNSPEC ; - nfmsg->version =NFNETLINK_V0 ; - nfmsg->res_id =0 ; - if (nla_put_string(skb, CTA_TIMEOUT_NAME, timeout->name) || nla_put_be16(skb, CTA_TIMEOUT_L3PROTO, htons(timeout->timeout.l3num)) ||
@@ -382,21 +377,16 @@ cttimeout_default_fill_info(struct net *net, struct sk_buff *skb, u32 portid, const unsigned int *timeouts) {struct nlmsghdr *nlh; -struct nfgenmsg *nfmsg;unsigned int flags = portid ?NLM_F_MULTI :0 ;struct nlattr *nest_parms;int ret; event =nfnl_msg_type (NFNL_SUBSYS_CTNETLINK_TIMEOUT , event); - nlh =nlmsg_put (skb, portid, seq, event,sizeof (*nfmsg), flags); -if (nlh ==NULL ) + nlh =nfnl_msg_put (skb, portid, seq, event, flags,AF_UNSPEC , +NFNETLINK_V0 ,0 ); +if (!nlh) goto nlmsg_failure; - nfmsg =nlmsg_data (nlh); - nfmsg->nfgen_family =AF_UNSPEC ; - nfmsg->version =NFNETLINK_V0 ; - nfmsg->res_id =0 ; -if (nla_put_be16 (skb,CTA_TIMEOUT_L3PROTO ,htons (l3num)) ||nla_put_u8 (skb,CTA_TIMEOUT_L4PROTO , l4proto->l4proto)) goto nla_put_failure;
net/netfilter/nfnetlink_log.c +3 -8
@@ -452,20 +452,15 @@ __build_packet_message(struct nfnl_log_net *log, {struct nfulnl_msg_packet_hdr pmsg;struct nlmsghdr *nlh; -struct nfgenmsg *nfmsg;sk_buff_data_t old_tail = inst->skb->tail;struct sock *sk;const unsigned char *hwhdrp; - nlh =nlmsg_put (inst->skb,0 ,0 , -nfnl_msg_type (NFNL_SUBSYS_ULOG ,NFULNL_MSG_PACKET ), -sizeof (struct nfgenmsg ),0 ); + nlh =nfnl_msg_put (inst->skb,0 ,0 , +nfnl_msg_type (NFNL_SUBSYS_ULOG ,NFULNL_MSG_PACKET ), +0 , pf,NFNETLINK_V0 ,htons (inst->group_num));if (!nlh)return -1 ; - nfmsg =nlmsg_data (nlh); - nfmsg->nfgen_family = pf; - nfmsg->version =NFNETLINK_V0 ; - nfmsg->res_id =htons (inst->group_num);memset (&pmsg,0 ,sizeof (pmsg)); pmsg.hw_protocol = skb->protocol;
net/netfilter/nfnetlink_queue.c +4 -8
@@ -383,7 +383,6 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,struct nlattr *nla;struct nfqnl_msg_packet_hdr *pmsg;struct nlmsghdr *nlh; -struct nfgenmsg *nfmsg;struct sk_buff *entskb = entry->skb;struct net_device *indev;struct net_device *outdev;
@@ -469,18 +468,15 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue, goto nlmsg_failure; } - nlh =nlmsg_put (skb,0 ,0 , -nfnl_msg_type (NFNL_SUBSYS_QUEUE ,NFQNL_MSG_PACKET ), -sizeof (struct nfgenmsg ),0 ); + nlh =nfnl_msg_put (skb,0 ,0 , +nfnl_msg_type (NFNL_SUBSYS_QUEUE ,NFQNL_MSG_PACKET ), +0 , entry->state.pf,NFNETLINK_V0 , +htons (queue->queue_num));if (!nlh) {skb_tx_error (entskb);kfree_skb (skb); goto nlmsg_failure; } - nfmsg =nlmsg_data (nlh); - nfmsg->nfgen_family = entry->state.pf; - nfmsg->version =NFNETLINK_V0 ; - nfmsg->res_id =htons (queue->queue_num); nla =__nla_reserve (skb,NFQA_PACKET_HDR ,sizeof (*pmsg)); pmsg =nla_data (nla);
net/netfilter/nft_compat.c +3 -8
@@ -591,19 +591,14 @@ nfnl_compat_fill_info(struct sk_buff *skb, u32 portid, u32 seq, u32 type, int rev, int target) {struct nlmsghdr *nlh; -struct nfgenmsg *nfmsg;unsigned int flags = portid ?NLM_F_MULTI :0 ; event =nfnl_msg_type (NFNL_SUBSYS_NFT_COMPAT , event); - nlh =nlmsg_put (skb, portid, seq, event,sizeof (*nfmsg), flags); -if (nlh ==NULL ) + nlh =nfnl_msg_put (skb, portid, seq, event, flags, family, +NFNETLINK_V0 ,0 ); +if (!nlh) goto nlmsg_failure; - nfmsg =nlmsg_data (nlh); - nfmsg->nfgen_family = family; - nfmsg->version =NFNETLINK_V0 ; - nfmsg->res_id =0 ; -if (nla_put_string (skb,NFTA_COMPAT_NAME , name) ||nla_put_be32 (skb,NFTA_COMPAT_REV ,htonl (rev)) ||nla_put_be32 (skb,NFTA_COMPAT_TYPE ,htonl (target)))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 101/158 drm/sun4i: dsi: Prevent underflow when computing packet sizes
In reply to Greg Kroah-HartmanFrom: Samuel Holland <[email protected]>
[ Upstream commit 82a1356a933d8443139f8886f11b63c974a09a67 ]
Currently, the packet overhead is subtracted using unsigned arithmetic. With a short sync pulse, this could underflow and wrap around to near the maximal u16 value. Fix this by using signed subtraction. The call to max() will correctly handle any negative numbers that are produced.
Apply the same fix to the other timings, even though those subtractions are less likely to underflow.
--- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +5 -5
@@ -531,7 +531,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, struct drm_display_mode *mode) {struct mipi_dsi_device *device = dsi->device; -unsigned int Bpp =mipi_dsi_pixel_format_to_bpp (device->format) /8 ; +int Bpp =mipi_dsi_pixel_format_to_bpp (device->format) /8 ;u16 hbp =0 , hfp =0 , hsa =0 , hblk =0 , vblk =0 ;u32 basic_ctl =0 ;size_t bytes;
@@ -555,7 +555,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi,* (4 bytes). Its minimal size is therefore 10 bytes */ #define HSA_PACKET_OVERHEAD 10 - hsa =max ((unsigned int )HSA_PACKET_OVERHEAD , + hsa =max (HSA_PACKET_OVERHEAD , (mode->hsync_end - mode->hsync_start) * Bpp -HSA_PACKET_OVERHEAD );/*
@@ -564,7 +564,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi,* therefore 6 bytes */ #define HBP_PACKET_OVERHEAD 6 - hbp =max ((unsigned int )HBP_PACKET_OVERHEAD , + hbp =max (HBP_PACKET_OVERHEAD , (mode->htotal - mode->hsync_end) * Bpp -HBP_PACKET_OVERHEAD );/*
@@ -574,7 +574,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi,* 16 bytes */ #define HFP_PACKET_OVERHEAD 16 - hfp =max ((unsigned int )HFP_PACKET_OVERHEAD , + hfp =max (HFP_PACKET_OVERHEAD , (mode->hsync_start - mode->hdisplay) * Bpp -HFP_PACKET_OVERHEAD );/*
@@ -583,7 +583,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi,* bytes). Its minimal size is therefore 10 bytes. */ #define HBLK_PACKET_OVERHEAD 10 - hblk =max ((unsigned int )HBLK_PACKET_OVERHEAD , + hblk =max (HBLK_PACKET_OVERHEAD , (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp -HBLK_PACKET_OVERHEAD );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 102/158 PCI: Add ACS quirk for Broadcom BCM5750x NICs
In reply to Greg Kroah-HartmanFrom: Pavan Chebbi <[email protected]>
[ Upstream commit afd306a65cedb9589564bdb23a0c368abc4215fd ]
The Broadcom BCM5750x NICs may be multi-function devices. They do not advertise ACS capability. Peer-to-peer transactions are not possible between the individual functions, so it is safe to treat them as fully isolated.
Add an ACS quirk for these devices so the functions can be in independent IOMMU groups and attached individually to userspace applications using VFIO.
--- drivers/pci/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pci/quirks.c +3 -0
@@ -4897,6 +4897,9 @@ static const struct pci_dev_acs_enabled { { PCI_VENDOR_ID_AMPERE, 0xE00C, pci_quirk_xgene_acs },/* Broadcom multi-function device */ { PCI_VENDOR_ID_BROADCOM, 0x16D7, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_BROADCOM, 0x1750, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_BROADCOM, 0x1751, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_BROADCOM, 0x1752, pci_quirk_mf_endpoint_acs }, { PCI_VENDOR_ID_BROADCOM, 0xD714, pci_quirk_brcm_acs },/* Amazon Annapurna Labs */ { PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031, pci_quirk_al_acs },
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 103/158 platform/chrome: cros_ec_proto: dont show MKBP version if unsupported
In reply to Greg Kroah-HartmanFrom: Tzung-Bi Shih <[email protected]>
[ Upstream commit b36f0643ff14a2fb281b105418e4e73c9d7c11d0 ]
It wrongly showed the following message when it doesn't support MKBP:
"MKBP support version 4294967295".
Fix it.
--- drivers/platform/chrome/cros_ec_proto.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/platform/chrome/cros_ec_proto.c +4 -4
@@ -507,13 +507,13 @@ int cros_ec_query_all(struct cros_ec_device *ec_dev) ret =cros_ec_get_host_command_version_mask (ec_dev,EC_CMD_GET_NEXT_EVENT , &ver_mask); -if (ret <0 || ver_mask ==0 ) +if (ret <0 || ver_mask ==0 ) { ec_dev->mkbp_event_supported =0 ; -else + }else { ec_dev->mkbp_event_supported =fls (ver_mask); -dev_dbg (ec_dev->dev,"MKBP support version %u\n" , - ec_dev->mkbp_event_supported -1 ); +dev_dbg (ec_dev->dev,"MKBP support version %u\n" , ec_dev->mkbp_event_supported -1 ); + }/* Probe if host sleep v1 is supported for S0ix failure detection. */ ret = cros_ec_get_host_command_version_mask(ec_dev,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 104/158 usb: cdns3 fix use-after-free at workaround 2
In reply to Greg Kroah-HartmanFrom: Frank Li <[email protected]>
[ Upstream commit 7d602f30149a117eea260208b1661bc404c21dfd ]
BUG: KFENCE: use-after-free read in __list_del_entry_valid+0x10/0xac
cdns3_wa2_remove_old_request()
{
...
kfree(priv_req->request.buf);
cdns3_gadget_ep_free_request(&priv_ep->endpoint, &priv_req->request);
list_del_init(&priv_req->list);
^^^ use after free
...
}cdns3_gadget_ep_free_request() free the space pointed by priv_req, but priv_req is used in the following list_del_init().
This patch move list_del_init() before cdns3_gadget_ep_free_request().
--- drivers/usb/cdns3/gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/cdns3/gadget.c +1 -1
@@ -655,9 +655,9 @@ static void cdns3_wa2_remove_old_request(struct cdns3_endpoint *priv_ep)trace_cdns3_wa2 (priv_ep,"removes eldest request" );kfree (priv_req->request.buf); +list_del_init (&priv_req->list);cdns3_gadget_ep_free_request (&priv_ep->endpoint, &priv_req->request); -list_del_init (&priv_req->list); --priv_ep->wa2_counter;if (!chain)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 105/158 usb: gadget: uvc: call uvc uvcg_warn on completed status instead of uvcg_info
In reply to Greg Kroah-HartmanFrom: Michael Grzeschik <[email protected]>
[ Upstream commit a725d0f6dfc5d3739d6499f30ec865305ba3544d ]
Likewise to the uvcvideo hostside driver, this patch is changing the usb_request message of an non zero completion handler call from dev_info to dev_warn.
--- drivers/usb/gadget/function/uvc_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/function/uvc_video.c +1 -1
@@ -159,7 +159,7 @@ uvc_video_complete(struct usb_ep *ep, struct usb_request *req)break ;default : -uvcg_info (&video->uvc->func, +uvcg_warn (&video->uvc->func,"VS request completed with status %d.\n" , req->status);uvcg_queue_cancel (queue,0 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 106/158 irqchip/tegra: Fix overflow implicit truncation warnings
In reply to Greg Kroah-HartmanFrom: Sai Prakash Ranjan <[email protected]>
[ Upstream commit 443685992bda9bb4f8b17fc02c9f6c60e62b1461 ]
Fix -Woverflow warnings for tegra irqchip driver which is a result of moving arm64 custom MMIO accessor macros to asm-generic function implementations giving a bonus type-checking now and uncovering these overflow warnings.
drivers/irqchip/irq-tegra.c: In function ‘tegra_ictlr_suspend’:drivers/irqchip/irq-tegra.c:151:18: warning: large integer implicitly truncated to unsigned type [-Woverflow]
writel_relaxed(~0ul, ictlr + ICTLR_COP_IER_CLR);
^--- drivers/irqchip/irq-tegra.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/irqchip/irq-tegra.c +5 -5
@@ -148,10 +148,10 @@ static int tegra_ictlr_suspend(void) lic->cop_iep[i] =readl_relaxed (ictlr +ICTLR_COP_IEP_CLASS );/* Disable COP interrupts */ -writel_relaxed (~0ul , ictlr +ICTLR_COP_IER_CLR ); +writel_relaxed (GENMASK (31 ,0 ), ictlr +ICTLR_COP_IER_CLR );/* Disable CPU interrupts */ -writel_relaxed (~0ul , ictlr +ICTLR_CPU_IER_CLR ); +writel_relaxed (GENMASK (31 ,0 ), ictlr +ICTLR_CPU_IER_CLR );/* Enable the wakeup sources of ictlr */ writel_relaxed (lic->ictlr_wake_mask[i], ictlr +ICTLR_CPU_IER_SET );
@@ -172,12 +172,12 @@ static void tegra_ictlr_resume(void)writel_relaxed (lic->cpu_iep[i], ictlr +ICTLR_CPU_IEP_CLASS ); -writel_relaxed (~0ul , ictlr +ICTLR_CPU_IER_CLR ); +writel_relaxed (GENMASK (31 ,0 ), ictlr +ICTLR_CPU_IER_CLR );writel_relaxed (lic->cpu_ier[i], ictlr +ICTLR_CPU_IER_SET );writel_relaxed (lic->cop_iep[i], ictlr +ICTLR_COP_IEP_CLASS ); -writel_relaxed (~0ul , ictlr +ICTLR_COP_IER_CLR ); +writel_relaxed (GENMASK (31 ,0 ), ictlr +ICTLR_COP_IER_CLR );writel_relaxed (lic->cop_ier[i], ictlr +ICTLR_COP_IER_SET ); }
@@ -312,7 +312,7 @@ static int __init tegra_ictlr_init(struct device_node *node, lic->base[i] = base;/* Disable all interrupts */ -writel_relaxed (~0UL , base +ICTLR_CPU_IER_CLR ); +writel_relaxed (GENMASK (31 ,0 ), base +ICTLR_CPU_IER_CLR );/* All interrupts target IRQ */ writel_relaxed (0 , base +ICTLR_CPU_IEP_CLASS );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 107/158 drm/meson: Fix overflow implicit truncation warnings
In reply to Greg Kroah-HartmanFrom: Sai Prakash Ranjan <[email protected]>
[ Upstream commit 98692f52c588225034cbff458622c2c06dfcb544 ]
Fix -Woverflow warnings for drm/meson driver which is a result of moving arm64 custom MMIO accessor macros to asm-generic function implementations giving a bonus type-checking now and uncovering these overflow warnings.
drivers/gpu/drm/meson/meson_viu.c: In function ‘meson_viu_init’:drivers/gpu/drm/meson/meson_registers.h:1826:48: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
#define VIU_OSD_BLEND_REORDER(dest, src) ((src) << (dest * 4))
^
drivers/gpu/drm/meson/meson_viu.c:472:18: note: in expansion of macro ‘VIU_OSD_BLEND_REORDER’
writel_relaxed(VIU_OSD_BLEND_REORDER(0, 1) |
^~~~~~~~~~~~~~~~~~~~~--- drivers/gpu/drm/meson/meson_viu.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/meson/meson_viu.c +11 -11
@@ -469,17 +469,17 @@ void meson_viu_init(struct meson_drm *priv) priv->io_base + _REG(VD2_IF0_LUMA_FIFO_SIZE));if (meson_vpu_is_compatible (priv,VPU_COMPATIBLE_G12A )) { -writel_relaxed (VIU_OSD_BLEND_REORDER (0 ,1 ) | -VIU_OSD_BLEND_REORDER (1 ,0 ) | -VIU_OSD_BLEND_REORDER (2 ,0 ) | -VIU_OSD_BLEND_REORDER (3 ,0 ) | -VIU_OSD_BLEND_DIN_EN (1 ) | -VIU_OSD_BLEND1_DIN3_BYPASS_TO_DOUT1 | -VIU_OSD_BLEND1_DOUT_BYPASS_TO_BLEND2 | -VIU_OSD_BLEND_DIN0_BYPASS_TO_DOUT0 | -VIU_OSD_BLEND_BLEN2_PREMULT_EN (1 ) | -VIU_OSD_BLEND_HOLD_LINES (4 ), - priv->io_base +_REG (VIU_OSD_BLEND_CTRL )); +u32 val = (u32 )VIU_OSD_BLEND_REORDER (0 ,1 ) | + (u32 )VIU_OSD_BLEND_REORDER (1 ,0 ) | + (u32 )VIU_OSD_BLEND_REORDER (2 ,0 ) | + (u32 )VIU_OSD_BLEND_REORDER (3 ,0 ) | + (u32 )VIU_OSD_BLEND_DIN_EN (1 ) | + (u32 )VIU_OSD_BLEND1_DIN3_BYPASS_TO_DOUT1 | + (u32 )VIU_OSD_BLEND1_DOUT_BYPASS_TO_BLEND2 | + (u32 )VIU_OSD_BLEND_DIN0_BYPASS_TO_DOUT0 | + (u32 )VIU_OSD_BLEND_BLEN2_PREMULT_EN (1 ) | + (u32 )VIU_OSD_BLEND_HOLD_LINES (4 ); +writel_relaxed (val, priv->io_base +_REG (VIU_OSD_BLEND_CTRL ));writel_relaxed (OSD_BLEND_PATH_SEL_ENABLE , priv->io_base +_REG (OSD1_BLEND_SRC_CTRL ));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 108/158 clk: ti: Stop using legacy clkctrl names for omap4 and 5
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 255584b138343d4a28c6d25bd82d04b09460d672 ]
With the addition of clock-output-names, we can now unify the internal clock naming for omap4 and 5 to follow the other TI SoCs.
We are still using legacy clkctrl names for omap4 and 5 based on the clock manager name which is wrong. Instead, we want to use the clkctrl clock based naming.
We must now also drop the legacy TI_CLK_CLKCTRL_COMPAT quirk for the clkctrl clock.
This change will allow further devicetree warning cleanup as already done for am3/4 and dra7.
--- drivers/clk/ti/clk-44xx.c | 210 +++++++++++++++++++------------------- drivers/clk/ti/clk-54xx.c | 160 ++++++++++++++--------------- drivers/clk/ti/clkctrl.c | 4 - 3 files changed, 185 insertions(+), 189 deletions(-)
drivers/clk/ti/clk-44xx.c +105 -105
@@ -56,7 +56,7 @@ static const struct omap_clkctrl_bit_data omap4_aess_bit_data[] __initconst = { };static const char *const omap4_func_dmic_abe_gfclk_parents[]__initconst = { -"abe_cm:clk:0018:26" , +"abe-clkctrl:0018:26" ,"pad_clks_ck" ,"slimbus_clk" ,NULL ,
@@ -76,7 +76,7 @@ static const struct omap_clkctrl_bit_data omap4_dmic_bit_data[] __initconst = { };static const char *const omap4_func_mcasp_abe_gfclk_parents[]__initconst = { -"abe_cm:clk:0020:26" , +"abe-clkctrl:0020:26" ,"pad_clks_ck" ,"slimbus_clk" ,NULL ,
@@ -89,7 +89,7 @@ static const struct omap_clkctrl_bit_data omap4_mcasp_bit_data[] __initconst = { };static const char *const omap4_func_mcbsp1_gfclk_parents[]__initconst = { -"abe_cm:clk:0028:26" , +"abe-clkctrl:0028:26" ,"pad_clks_ck" ,"slimbus_clk" ,NULL ,
@@ -102,7 +102,7 @@ static const struct omap_clkctrl_bit_data omap4_mcbsp1_bit_data[] __initconst = };static const char *const omap4_func_mcbsp2_gfclk_parents[]__initconst = { -"abe_cm:clk:0030:26" , +"abe-clkctrl:0030:26" ,"pad_clks_ck" ,"slimbus_clk" ,NULL ,
@@ -115,7 +115,7 @@ static const struct omap_clkctrl_bit_data omap4_mcbsp2_bit_data[] __initconst = };static const char *const omap4_func_mcbsp3_gfclk_parents[]__initconst = { -"abe_cm:clk:0038:26" , +"abe-clkctrl:0038:26" ,"pad_clks_ck" ,"slimbus_clk" ,NULL ,
@@ -183,18 +183,18 @@ static const struct omap_clkctrl_bit_data omap4_timer8_bit_data[] __initconst =static const struct omap_clkctrl_reg_data omap4_abe_clkctrl_regs[]__initconst = { {OMAP4_L4_ABE_CLKCTRL ,NULL ,0 ,"ocp_abe_iclk" }, - {OMAP4_AESS_CLKCTRL , omap4_aess_bit_data,CLKF_SW_SUP ,"abe_cm:clk:0008:24" }, + {OMAP4_AESS_CLKCTRL , omap4_aess_bit_data,CLKF_SW_SUP ,"abe-clkctrl:0008:24" }, {OMAP4_MCPDM_CLKCTRL ,NULL ,CLKF_SW_SUP ,"pad_clks_ck" }, - {OMAP4_DMIC_CLKCTRL , omap4_dmic_bit_data,CLKF_SW_SUP ,"abe_cm:clk:0018:24" }, - {OMAP4_MCASP_CLKCTRL , omap4_mcasp_bit_data,CLKF_SW_SUP ,"abe_cm:clk:0020:24" }, - {OMAP4_MCBSP1_CLKCTRL , omap4_mcbsp1_bit_data,CLKF_SW_SUP ,"abe_cm:clk:0028:24" }, - {OMAP4_MCBSP2_CLKCTRL , omap4_mcbsp2_bit_data,CLKF_SW_SUP ,"abe_cm:clk:0030:24" }, - {OMAP4_MCBSP3_CLKCTRL , omap4_mcbsp3_bit_data,CLKF_SW_SUP ,"abe_cm:clk:0038:24" }, - {OMAP4_SLIMBUS1_CLKCTRL , omap4_slimbus1_bit_data,CLKF_SW_SUP ,"abe_cm:clk:0040:8" }, - {OMAP4_TIMER5_CLKCTRL , omap4_timer5_bit_data,CLKF_SW_SUP ,"abe_cm:clk:0048:24" }, - {OMAP4_TIMER6_CLKCTRL , omap4_timer6_bit_data,CLKF_SW_SUP ,"abe_cm:clk:0050:24" }, - {OMAP4_TIMER7_CLKCTRL , omap4_timer7_bit_data,CLKF_SW_SUP ,"abe_cm:clk:0058:24" }, - {OMAP4_TIMER8_CLKCTRL , omap4_timer8_bit_data,CLKF_SW_SUP ,"abe_cm:clk:0060:24" }, + {OMAP4_DMIC_CLKCTRL , omap4_dmic_bit_data,CLKF_SW_SUP ,"abe-clkctrl:0018:24" }, + {OMAP4_MCASP_CLKCTRL , omap4_mcasp_bit_data,CLKF_SW_SUP ,"abe-clkctrl:0020:24" }, + {OMAP4_MCBSP1_CLKCTRL , omap4_mcbsp1_bit_data,CLKF_SW_SUP ,"abe-clkctrl:0028:24" }, + {OMAP4_MCBSP2_CLKCTRL , omap4_mcbsp2_bit_data,CLKF_SW_SUP ,"abe-clkctrl:0030:24" }, + {OMAP4_MCBSP3_CLKCTRL , omap4_mcbsp3_bit_data,CLKF_SW_SUP ,"abe-clkctrl:0038:24" }, + {OMAP4_SLIMBUS1_CLKCTRL , omap4_slimbus1_bit_data,CLKF_SW_SUP ,"abe-clkctrl:0040:8" }, + {OMAP4_TIMER5_CLKCTRL , omap4_timer5_bit_data,CLKF_SW_SUP ,"abe-clkctrl:0048:24" }, + {OMAP4_TIMER6_CLKCTRL , omap4_timer6_bit_data,CLKF_SW_SUP ,"abe-clkctrl:0050:24" }, + {OMAP4_TIMER7_CLKCTRL , omap4_timer7_bit_data,CLKF_SW_SUP ,"abe-clkctrl:0058:24" }, + {OMAP4_TIMER8_CLKCTRL , omap4_timer8_bit_data,CLKF_SW_SUP ,"abe-clkctrl:0060:24" }, {OMAP4_WD_TIMER3_CLKCTRL ,NULL ,CLKF_SW_SUP ,"sys_32k_ck" }, {0 }, };
@@ -287,7 +287,7 @@ static const struct omap_clkctrl_bit_data omap4_fdif_bit_data[] __initconst = {static const struct omap_clkctrl_reg_data omap4_iss_clkctrl_regs[]__initconst = { {OMAP4_ISS_CLKCTRL , omap4_iss_bit_data,CLKF_SW_SUP ,"ducati_clk_mux_ck" }, - {OMAP4_FDIF_CLKCTRL , omap4_fdif_bit_data,CLKF_SW_SUP ,"iss_cm:clk:0008:24" }, + {OMAP4_FDIF_CLKCTRL , omap4_fdif_bit_data,CLKF_SW_SUP ,"iss-clkctrl:0008:24" }, {0 }, };
@@ -320,7 +320,7 @@ static const struct omap_clkctrl_bit_data omap4_dss_core_bit_data[] __initconst };static const struct omap_clkctrl_reg_data omap4_l3_dss_clkctrl_regs[]__initconst = { - {OMAP4_DSS_CORE_CLKCTRL , omap4_dss_core_bit_data,CLKF_SW_SUP ,"l3_dss_cm:clk:0000:8" }, + {OMAP4_DSS_CORE_CLKCTRL , omap4_dss_core_bit_data,CLKF_SW_SUP ,"l3-dss-clkctrl:0000:8" }, {0 }, };
@@ -336,7 +336,7 @@ static const struct omap_clkctrl_bit_data omap4_gpu_bit_data[] __initconst = { };static const struct omap_clkctrl_reg_data omap4_l3_gfx_clkctrl_regs[]__initconst = { - {OMAP4_GPU_CLKCTRL , omap4_gpu_bit_data,CLKF_SW_SUP ,"l3_gfx_cm:clk:0000:24" }, + {OMAP4_GPU_CLKCTRL , omap4_gpu_bit_data,CLKF_SW_SUP ,"l3-gfx-clkctrl:0000:24" }, {0 }, };
@@ -372,12 +372,12 @@ static const struct omap_clkctrl_bit_data omap4_hsi_bit_data[] __initconst = { };static const char *const omap4_usb_host_hs_utmi_p1_clk_parents[]__initconst = { -"l3_init_cm:clk:0038:24" , +"l3-init-clkctrl:0038:24" ,NULL , };static const char *const omap4_usb_host_hs_utmi_p2_clk_parents[]__initconst = { -"l3_init_cm:clk:0038:25" , +"l3-init-clkctrl:0038:25" ,NULL , };
@@ -418,7 +418,7 @@ static const struct omap_clkctrl_bit_data omap4_usb_host_hs_bit_data[] __initcon };static const char *const omap4_usb_otg_hs_xclk_parents[]__initconst = { -"l3_init_cm:clk:0040:24" , +"l3-init-clkctrl:0040:24" ,NULL , };
@@ -452,14 +452,14 @@ static const struct omap_clkctrl_bit_data omap4_ocp2scp_usb_phy_bit_data[] __ini };static const struct omap_clkctrl_reg_data omap4_l3_init_clkctrl_regs[]__initconst = { - {OMAP4_MMC1_CLKCTRL , omap4_mmc1_bit_data,CLKF_SW_SUP ,"l3_init_cm:clk:0008:24" }, - {OMAP4_MMC2_CLKCTRL , omap4_mmc2_bit_data,CLKF_SW_SUP ,"l3_init_cm:clk:0010:24" }, - {OMAP4_HSI_CLKCTRL , omap4_hsi_bit_data,CLKF_HW_SUP ,"l3_init_cm:clk:0018:24" }, + {OMAP4_MMC1_CLKCTRL , omap4_mmc1_bit_data,CLKF_SW_SUP ,"l3-init-clkctrl:0008:24" }, + {OMAP4_MMC2_CLKCTRL , omap4_mmc2_bit_data,CLKF_SW_SUP ,"l3-init-clkctrl:0010:24" }, + {OMAP4_HSI_CLKCTRL , omap4_hsi_bit_data,CLKF_HW_SUP ,"l3-init-clkctrl:0018:24" }, {OMAP4_USB_HOST_HS_CLKCTRL , omap4_usb_host_hs_bit_data,CLKF_SW_SUP ,"init_60m_fclk" }, {OMAP4_USB_OTG_HS_CLKCTRL , omap4_usb_otg_hs_bit_data,CLKF_HW_SUP ,"l3_div_ck" }, {OMAP4_USB_TLL_HS_CLKCTRL , omap4_usb_tll_hs_bit_data,CLKF_HW_SUP ,"l4_div_ck" }, {OMAP4_USB_HOST_FS_CLKCTRL ,NULL ,CLKF_SW_SUP ,"func_48mc_fclk" }, - {OMAP4_OCP2SCP_USB_PHY_CLKCTRL , omap4_ocp2scp_usb_phy_bit_data,CLKF_HW_SUP ,"l3_init_cm:clk:00c0:8" }, + {OMAP4_OCP2SCP_USB_PHY_CLKCTRL , omap4_ocp2scp_usb_phy_bit_data,CLKF_HW_SUP ,"l3-init-clkctrl:00c0:8" }, {0 }, };
@@ -530,7 +530,7 @@ static const struct omap_clkctrl_bit_data omap4_gpio6_bit_data[] __initconst = { };static const char *const omap4_per_mcbsp4_gfclk_parents[]__initconst = { -"l4_per_cm:clk:00c0:26" , +"l4-per-clkctrl:00c0:26" ,"pad_clks_ck" ,NULL , };
@@ -570,12 +570,12 @@ static const struct omap_clkctrl_bit_data omap4_slimbus2_bit_data[] __initconst };static const struct omap_clkctrl_reg_data omap4_l4_per_clkctrl_regs[]__initconst = { - {OMAP4_TIMER10_CLKCTRL , omap4_timer10_bit_data,CLKF_SW_SUP ,"l4_per_cm:clk:0008:24" }, - {OMAP4_TIMER11_CLKCTRL , omap4_timer11_bit_data,CLKF_SW_SUP ,"l4_per_cm:clk:0010:24" }, - {OMAP4_TIMER2_CLKCTRL , omap4_timer2_bit_data,CLKF_SW_SUP ,"l4_per_cm:clk:0018:24" }, - {OMAP4_TIMER3_CLKCTRL , omap4_timer3_bit_data,CLKF_SW_SUP ,"l4_per_cm:clk:0020:24" }, - {OMAP4_TIMER4_CLKCTRL , omap4_timer4_bit_data,CLKF_SW_SUP ,"l4_per_cm:clk:0028:24" }, - {OMAP4_TIMER9_CLKCTRL , omap4_timer9_bit_data,CLKF_SW_SUP ,"l4_per_cm:clk:0030:24" }, + {OMAP4_TIMER10_CLKCTRL , omap4_timer10_bit_data,CLKF_SW_SUP ,"l4-per-clkctrl:0008:24" }, + {OMAP4_TIMER11_CLKCTRL , omap4_timer11_bit_data,CLKF_SW_SUP ,"l4-per-clkctrl:0010:24" }, + {OMAP4_TIMER2_CLKCTRL , omap4_timer2_bit_data,CLKF_SW_SUP ,"l4-per-clkctrl:0018:24" }, + {OMAP4_TIMER3_CLKCTRL , omap4_timer3_bit_data,CLKF_SW_SUP ,"l4-per-clkctrl:0020:24" }, + {OMAP4_TIMER4_CLKCTRL , omap4_timer4_bit_data,CLKF_SW_SUP ,"l4-per-clkctrl:0028:24" }, + {OMAP4_TIMER9_CLKCTRL , omap4_timer9_bit_data,CLKF_SW_SUP ,"l4-per-clkctrl:0030:24" }, {OMAP4_ELM_CLKCTRL ,NULL ,0 ,"l4_div_ck" }, {OMAP4_GPIO2_CLKCTRL , omap4_gpio2_bit_data,CLKF_HW_SUP ,"l4_div_ck" }, {OMAP4_GPIO3_CLKCTRL , omap4_gpio3_bit_data,CLKF_HW_SUP ,"l4_div_ck" },
@@ -588,14 +588,14 @@ static const struct omap_clkctrl_reg_data omap4_l4_per_clkctrl_regs[] __initcons { OMAP4_I2C3_CLKCTRL, NULL, CLKF_SW_SUP, "func_96m_fclk" }, { OMAP4_I2C4_CLKCTRL, NULL, CLKF_SW_SUP, "func_96m_fclk" }, { OMAP4_L4_PER_CLKCTRL, NULL, 0, "l4_div_ck" }, - { OMAP4_MCBSP4_CLKCTRL, omap4_mcbsp4_bit_data, CLKF_SW_SUP, "l4_per_cm:clk:00c0:24" }, + { OMAP4_MCBSP4_CLKCTRL, omap4_mcbsp4_bit_data, CLKF_SW_SUP, "l4-per-clkctrl:00c0:24" }, { OMAP4_MCSPI1_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_MCSPI2_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_MCSPI3_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_MCSPI4_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_MMC3_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_MMC4_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, - { OMAP4_SLIMBUS2_CLKCTRL, omap4_slimbus2_bit_data, CLKF_SW_SUP, "l4_per_cm:clk:0118:8" }, + { OMAP4_SLIMBUS2_CLKCTRL, omap4_slimbus2_bit_data, CLKF_SW_SUP, "l4-per-clkctrl:0118:8" }, { OMAP4_UART1_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_UART2_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_UART3_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" },
@@ -630,7 +630,7 @@ static const struct omap_clkctrl_reg_data omap4_l4_wkup_clkctrl_regs[] __initcon { OMAP4_L4_WKUP_CLKCTRL, NULL, 0, "l4_wkup_clk_mux_ck" }, { OMAP4_WD_TIMER2_CLKCTRL, NULL, CLKF_SW_SUP, "sys_32k_ck" }, { OMAP4_GPIO1_CLKCTRL, omap4_gpio1_bit_data, CLKF_HW_SUP, "l4_wkup_clk_mux_ck" }, - { OMAP4_TIMER1_CLKCTRL, omap4_timer1_bit_data, CLKF_SW_SUP, "l4_wkup_cm:clk:0020:24" }, + { OMAP4_TIMER1_CLKCTRL, omap4_timer1_bit_data, CLKF_SW_SUP, "l4-wkup-clkctrl:0020:24" }, { OMAP4_COUNTER_32K_CLKCTRL, NULL, 0, "sys_32k_ck" }, { OMAP4_KBD_CLKCTRL, NULL, CLKF_SW_SUP, "sys_32k_ck" }, { 0 },
@@ -644,7 +644,7 @@ static const char * const omap4_pmd_stm_clock_mux_ck_parents[] __initconst = { };static const char *const omap4_trace_clk_div_div_ck_parents[]__initconst = { -"emu_sys_cm:clk:0000:22" , +"emu-sys-clkctrl:0000:22" ,NULL , };
@@ -662,7 +662,7 @@ static const struct omap_clkctrl_div_data omap4_trace_clk_div_div_ck_data __init };static const char *const omap4_stm_clk_div_ck_parents[]__initconst = { -"emu_sys_cm:clk:0000:20" , +"emu-sys-clkctrl:0000:20" ,NULL , };
@@ -716,73 +716,73 @@ static struct ti_dt_clk omap44xx_clks[] = {* hwmod support. Once hwmod is removed, these can be removed * also. */ -DT_CLK (NULL ,"aess_fclk" ,"abe_cm:0008:24" ), -DT_CLK (NULL ,"cm2_dm10_mux" ,"l4_per_cm:0008:24" ), -DT_CLK (NULL ,"cm2_dm11_mux" ,"l4_per_cm:0010:24" ), -DT_CLK (NULL ,"cm2_dm2_mux" ,"l4_per_cm:0018:24" ), -DT_CLK (NULL ,"cm2_dm3_mux" ,"l4_per_cm:0020:24" ), -DT_CLK (NULL ,"cm2_dm4_mux" ,"l4_per_cm:0028:24" ), -DT_CLK (NULL ,"cm2_dm9_mux" ,"l4_per_cm:0030:24" ), -DT_CLK (NULL ,"dmic_sync_mux_ck" ,"abe_cm:0018:26" ), -DT_CLK (NULL ,"dmt1_clk_mux" ,"l4_wkup_cm:0020:24" ), -DT_CLK (NULL ,"dss_48mhz_clk" ,"l3_dss_cm:0000:9" ), -DT_CLK (NULL ,"dss_dss_clk" ,"l3_dss_cm:0000:8" ), -DT_CLK (NULL ,"dss_sys_clk" ,"l3_dss_cm:0000:10" ), -DT_CLK (NULL ,"dss_tv_clk" ,"l3_dss_cm:0000:11" ), -DT_CLK (NULL ,"fdif_fck" ,"iss_cm:0008:24" ), -DT_CLK (NULL ,"func_dmic_abe_gfclk" ,"abe_cm:0018:24" ), -DT_CLK (NULL ,"func_mcasp_abe_gfclk" ,"abe_cm:0020:24" ), -DT_CLK (NULL ,"func_mcbsp1_gfclk" ,"abe_cm:0028:24" ), -DT_CLK (NULL ,"func_mcbsp2_gfclk" ,"abe_cm:0030:24" ), -DT_CLK (NULL ,"func_mcbsp3_gfclk" ,"abe_cm:0038:24" ), -DT_CLK (NULL ,"gpio1_dbclk" ,"l4_wkup_cm:0018:8" ), -DT_CLK (NULL ,"gpio2_dbclk" ,"l4_per_cm:0040:8" ), -DT_CLK (NULL ,"gpio3_dbclk" ,"l4_per_cm:0048:8" ), -DT_CLK (NULL ,"gpio4_dbclk" ,"l4_per_cm:0050:8" ), -DT_CLK (NULL ,"gpio5_dbclk" ,"l4_per_cm:0058:8" ), -DT_CLK (NULL ,"gpio6_dbclk" ,"l4_per_cm:0060:8" ), -DT_CLK (NULL ,"hsi_fck" ,"l3_init_cm:0018:24" ), -DT_CLK (NULL ,"hsmmc1_fclk" ,"l3_init_cm:0008:24" ), -DT_CLK (NULL ,"hsmmc2_fclk" ,"l3_init_cm:0010:24" ), -DT_CLK (NULL ,"iss_ctrlclk" ,"iss_cm:0000:8" ), -DT_CLK (NULL ,"mcasp_sync_mux_ck" ,"abe_cm:0020:26" ), -DT_CLK (NULL ,"mcbsp1_sync_mux_ck" ,"abe_cm:0028:26" ), -DT_CLK (NULL ,"mcbsp2_sync_mux_ck" ,"abe_cm:0030:26" ), -DT_CLK (NULL ,"mcbsp3_sync_mux_ck" ,"abe_cm:0038:26" ), -DT_CLK (NULL ,"mcbsp4_sync_mux_ck" ,"l4_per_cm:00c0:26" ), -DT_CLK (NULL ,"ocp2scp_usb_phy_phy_48m" ,"l3_init_cm:00c0:8" ), -DT_CLK (NULL ,"otg_60m_gfclk" ,"l3_init_cm:0040:24" ), -DT_CLK (NULL ,"per_mcbsp4_gfclk" ,"l4_per_cm:00c0:24" ), -DT_CLK (NULL ,"pmd_stm_clock_mux_ck" ,"emu_sys_cm:0000:20" ), -DT_CLK (NULL ,"pmd_trace_clk_mux_ck" ,"emu_sys_cm:0000:22" ), -DT_CLK (NULL ,"sgx_clk_mux" ,"l3_gfx_cm:0000:24" ), -DT_CLK (NULL ,"slimbus1_fclk_0" ,"abe_cm:0040:8" ), -DT_CLK (NULL ,"slimbus1_fclk_1" ,"abe_cm:0040:9" ), -DT_CLK (NULL ,"slimbus1_fclk_2" ,"abe_cm:0040:10" ), -DT_CLK (NULL ,"slimbus1_slimbus_clk" ,"abe_cm:0040:11" ), -DT_CLK (NULL ,"slimbus2_fclk_0" ,"l4_per_cm:0118:8" ), -DT_CLK (NULL ,"slimbus2_fclk_1" ,"l4_per_cm:0118:9" ), -DT_CLK (NULL ,"slimbus2_slimbus_clk" ,"l4_per_cm:0118:10" ), -DT_CLK (NULL ,"stm_clk_div_ck" ,"emu_sys_cm:0000:27" ), -DT_CLK (NULL ,"timer5_sync_mux" ,"abe_cm:0048:24" ), -DT_CLK (NULL ,"timer6_sync_mux" ,"abe_cm:0050:24" ), -DT_CLK (NULL ,"timer7_sync_mux" ,"abe_cm:0058:24" ), -DT_CLK (NULL ,"timer8_sync_mux" ,"abe_cm:0060:24" ), -DT_CLK (NULL ,"trace_clk_div_div_ck" ,"emu_sys_cm:0000:24" ), -DT_CLK (NULL ,"usb_host_hs_func48mclk" ,"l3_init_cm:0038:15" ), -DT_CLK (NULL ,"usb_host_hs_hsic480m_p1_clk" ,"l3_init_cm:0038:13" ), -DT_CLK (NULL ,"usb_host_hs_hsic480m_p2_clk" ,"l3_init_cm:0038:14" ), -DT_CLK (NULL ,"usb_host_hs_hsic60m_p1_clk" ,"l3_init_cm:0038:11" ), -DT_CLK (NULL ,"usb_host_hs_hsic60m_p2_clk" ,"l3_init_cm:0038:12" ), -DT_CLK (NULL ,"usb_host_hs_utmi_p1_clk" ,"l3_init_cm:0038:8" ), -DT_CLK (NULL ,"usb_host_hs_utmi_p2_clk" ,"l3_init_cm:0038:9" ), -DT_CLK (NULL ,"usb_host_hs_utmi_p3_clk" ,"l3_init_cm:0038:10" ), -DT_CLK (NULL ,"usb_otg_hs_xclk" ,"l3_init_cm:0040:8" ), -DT_CLK (NULL ,"usb_tll_hs_usb_ch0_clk" ,"l3_init_cm:0048:8" ), -DT_CLK (NULL ,"usb_tll_hs_usb_ch1_clk" ,"l3_init_cm:0048:9" ), -DT_CLK (NULL ,"usb_tll_hs_usb_ch2_clk" ,"l3_init_cm:0048:10" ), -DT_CLK (NULL ,"utmi_p1_gfclk" ,"l3_init_cm:0038:24" ), -DT_CLK (NULL ,"utmi_p2_gfclk" ,"l3_init_cm:0038:25" ), +DT_CLK (NULL ,"aess_fclk" ,"abe-clkctrl:0008:24" ), +DT_CLK (NULL ,"cm2_dm10_mux" ,"l4-per-clkctrl:0008:24" ), +DT_CLK (NULL ,"cm2_dm11_mux" ,"l4-per-clkctrl:0010:24" ), +DT_CLK (NULL ,"cm2_dm2_mux" ,"l4-per-clkctrl:0018:24" ), +DT_CLK (NULL ,"cm2_dm3_mux" ,"l4-per-clkctrl:0020:24" ), +DT_CLK (NULL ,"cm2_dm4_mux" ,"l4-per-clkctrl:0028:24" ), +DT_CLK (NULL ,"cm2_dm9_mux" ,"l4-per-clkctrl:0030:24" ), +DT_CLK (NULL ,"dmic_sync_mux_ck" ,"abe-clkctrl:0018:26" ), +DT_CLK (NULL ,"dmt1_clk_mux" ,"l4-wkup-clkctrl:0020:24" ), +DT_CLK (NULL ,"dss_48mhz_clk" ,"l3-dss-clkctrl:0000:9" ), +DT_CLK (NULL ,"dss_dss_clk" ,"l3-dss-clkctrl:0000:8" ), +DT_CLK (NULL ,"dss_sys_clk" ,"l3-dss-clkctrl:0000:10" ), +DT_CLK (NULL ,"dss_tv_clk" ,"l3-dss-clkctrl:0000:11" ), +DT_CLK (NULL ,"fdif_fck" ,"iss-clkctrl:0008:24" ), +DT_CLK (NULL ,"func_dmic_abe_gfclk" ,"abe-clkctrl:0018:24" ), +DT_CLK (NULL ,"func_mcasp_abe_gfclk" ,"abe-clkctrl:0020:24" ), +DT_CLK (NULL ,"func_mcbsp1_gfclk" ,"abe-clkctrl:0028:24" ), +DT_CLK (NULL ,"func_mcbsp2_gfclk" ,"abe-clkctrl:0030:24" ), +DT_CLK (NULL ,"func_mcbsp3_gfclk" ,"abe-clkctrl:0038:24" ), +DT_CLK (NULL ,"gpio1_dbclk" ,"l4-wkup-clkctrl:0018:8" ), +DT_CLK (NULL ,"gpio2_dbclk" ,"l4-per-clkctrl:0040:8" ), +DT_CLK (NULL ,"gpio3_dbclk" ,"l4-per-clkctrl:0048:8" ), +DT_CLK (NULL ,"gpio4_dbclk" ,"l4-per-clkctrl:0050:8" ), +DT_CLK (NULL ,"gpio5_dbclk" ,"l4-per-clkctrl:0058:8" ), +DT_CLK (NULL ,"gpio6_dbclk" ,"l4-per-clkctrl:0060:8" ), +DT_CLK (NULL ,"hsi_fck" ,"l3-init-clkctrl:0018:24" ), +DT_CLK (NULL ,"hsmmc1_fclk" ,"l3-init-clkctrl:0008:24" ), +DT_CLK (NULL ,"hsmmc2_fclk" ,"l3-init-clkctrl:0010:24" ), +DT_CLK (NULL ,"iss_ctrlclk" ,"iss-clkctrl:0000:8" ), +DT_CLK (NULL ,"mcasp_sync_mux_ck" ,"abe-clkctrl:0020:26" ), +DT_CLK (NULL ,"mcbsp1_sync_mux_ck" ,"abe-clkctrl:0028:26" ), +DT_CLK (NULL ,"mcbsp2_sync_mux_ck" ,"abe-clkctrl:0030:26" ), +DT_CLK (NULL ,"mcbsp3_sync_mux_ck" ,"abe-clkctrl:0038:26" ), +DT_CLK (NULL ,"mcbsp4_sync_mux_ck" ,"l4-per-clkctrl:00c0:26" ), +DT_CLK (NULL ,"ocp2scp_usb_phy_phy_48m" ,"l3-init-clkctrl:00c0:8" ), +DT_CLK (NULL ,"otg_60m_gfclk" ,"l3-init-clkctrl:0040:24" ), +DT_CLK (NULL ,"per_mcbsp4_gfclk" ,"l4-per-clkctrl:00c0:24" ), +DT_CLK (NULL ,"pmd_stm_clock_mux_ck" ,"emu-sys-clkctrl:0000:20" ), +DT_CLK (NULL ,"pmd_trace_clk_mux_ck" ,"emu-sys-clkctrl:0000:22" ), +DT_CLK (NULL ,"sgx_clk_mux" ,"l3-gfx-clkctrl:0000:24" ), +DT_CLK (NULL ,"slimbus1_fclk_0" ,"abe-clkctrl:0040:8" ), +DT_CLK (NULL ,"slimbus1_fclk_1" ,"abe-clkctrl:0040:9" ), +DT_CLK (NULL ,"slimbus1_fclk_2" ,"abe-clkctrl:0040:10" ), +DT_CLK (NULL ,"slimbus1_slimbus_clk" ,"abe-clkctrl:0040:11" ), +DT_CLK (NULL ,"slimbus2_fclk_0" ,"l4-per-clkctrl:0118:8" ), +DT_CLK (NULL ,"slimbus2_fclk_1" ,"l4-per-clkctrl:0118:9" ), +DT_CLK (NULL ,"slimbus2_slimbus_clk" ,"l4-per-clkctrl:0118:10" ), +DT_CLK (NULL ,"stm_clk_div_ck" ,"emu-sys-clkctrl:0000:27" ), +DT_CLK (NULL ,"timer5_sync_mux" ,"abe-clkctrl:0048:24" ), +DT_CLK (NULL ,"timer6_sync_mux" ,"abe-clkctrl:0050:24" ), +DT_CLK (NULL ,"timer7_sync_mux" ,"abe-clkctrl:0058:24" ), +DT_CLK (NULL ,"timer8_sync_mux" ,"abe-clkctrl:0060:24" ), +DT_CLK (NULL ,"trace_clk_div_div_ck" ,"emu-sys-clkctrl:0000:24" ), +DT_CLK (NULL ,"usb_host_hs_func48mclk" ,"l3-init-clkctrl:0038:15" ), +DT_CLK (NULL ,"usb_host_hs_hsic480m_p1_clk" ,"l3-init-clkctrl:0038:13" ), +DT_CLK (NULL ,"usb_host_hs_hsic480m_p2_clk" ,"l3-init-clkctrl:0038:14" ), +DT_CLK (NULL ,"usb_host_hs_hsic60m_p1_clk" ,"l3-init-clkctrl:0038:11" ), +DT_CLK (NULL ,"usb_host_hs_hsic60m_p2_clk" ,"l3-init-clkctrl:0038:12" ), +DT_CLK (NULL ,"usb_host_hs_utmi_p1_clk" ,"l3-init-clkctrl:0038:8" ), +DT_CLK (NULL ,"usb_host_hs_utmi_p2_clk" ,"l3-init-clkctrl:0038:9" ), +DT_CLK (NULL ,"usb_host_hs_utmi_p3_clk" ,"l3_init-clkctrl:0038:10" ), +DT_CLK (NULL ,"usb_otg_hs_xclk" ,"l3-init-clkctrl:0040:8" ), +DT_CLK (NULL ,"usb_tll_hs_usb_ch0_clk" ,"l3-init-clkctrl:0048:8" ), +DT_CLK (NULL ,"usb_tll_hs_usb_ch1_clk" ,"l3-init-clkctrl:0048:9" ), +DT_CLK (NULL ,"usb_tll_hs_usb_ch2_clk" ,"l3-init-clkctrl:0048:10" ), +DT_CLK (NULL ,"utmi_p1_gfclk" ,"l3-init-clkctrl:0038:24" ), +DT_CLK (NULL ,"utmi_p2_gfclk" ,"l3-init-clkctrl:0038:25" ), { .node_name = NULL }, };
drivers/clk/ti/clk-54xx.c +80 -80
249 lines not on this page · raw message
drivers/clk/ti/clkctrl.c +0 -4
@@ -511,10 +511,6 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)char *c;u16 soc_mask =0 ; -if (!(ti_clk_get_features ()->flags &TI_CLK_CLKCTRL_COMPAT ) && -of_node_name_eq (node,"clk" )) - ti_clk_features.flags |=TI_CLK_CLKCTRL_COMPAT ; - addrp =of_get_address (node,0 ,NULL ,NULL ); addr = (u32 )of_translate_address (node, addrp);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 109/158 usb: host: ohci-ppc-of: Fix refcount leak bug
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 40a959d7042bb7711e404ad2318b30e9f92c6b9b ]
In ohci_hcd_ppc_of_probe(), of_find_compatible_node() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore.
--- drivers/usb/host/ohci-ppc-of.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/ohci-ppc-of.c +1 -0
@@ -169,6 +169,7 @@ static int ohci_hcd_ppc_of_probe(struct platform_device *op)release_mem_region (res.start,0x4 ); }else pr_debug ("%s: cannot get ehci offset from fdt\n" , __FILE__); +of_node_put (np); }irq_dispose_mapping (irq);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 110/158 usb: renesas: Fix refcount leak bug
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 9d6d5303c39b8bc182475b22f45504106a07f086 ]
In usbhs_rza1_hardware_init(), of_find_node_by_name() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore.
--- drivers/usb/renesas_usbhs/rza.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/renesas_usbhs/rza.c +4 -0
@@ -23,6 +23,10 @@ static int usbhs_rza1_hardware_init(struct platform_device *pdev) extal_clk =of_find_node_by_name (NULL ,"extal" );of_property_read_u32 (usb_x1_clk,"clock-frequency" , &freq_usb);of_property_read_u32 (extal_clk,"clock-frequency" , &freq_extal); + +of_node_put (usb_x1_clk); +of_node_put (extal_clk); +if (freq_usb ==0 ) {if (freq_extal ==12000000 ) {/* Select 12MHz XTAL */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 111/158 usb: dwc2: gadget: remove D+ pull-up while no vbus with usb-role-switch
In reply to Greg Kroah-HartmanFrom: Amelie Delaunay <[email protected]>
[ Upstream commit db638c6500abaffb8f7770b2a69c40d003d54ae1 ]
When using usb-role-switch, D+ pull-up is set as soon as DTCL_SFTDISCON is cleared, whatever the vbus valid signal state is. The pull-up should not be set when vbus isn't present (this is determined by the drd controller).
This patch ensures that B-Session (so Peripheral role + vbus valid signal) is valid before clearing the DCTL_SFTDISCON bit when role switch is used. Keep original behavior when usb-role-switch isn't used.
--- drivers/usb/dwc2/gadget.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc2/gadget.c +2 -1
@@ -3593,7 +3593,8 @@ void dwc2_hsotg_core_disconnect(struct dwc2_hsotg *hsotg)void dwc2_hsotg_core_connect (struct dwc2_hsotg *hsotg) {/* remove the soft-disconnect and let's go */ -dwc2_clear_bit (hsotg,DCTL ,DCTL_SFTDISCON ); +if (!hsotg->role_sw || (dwc2_readl (hsotg,GOTGCTL ) &GOTGCTL_BSESVLD )) +dwc2_clear_bit (hsotg,DCTL ,DCTL_SFTDISCON ); }/**
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 112/158 vboxguest: Do not use devm for irq
In reply to Greg Kroah-HartmanFrom: Pascal Terjan <[email protected]>
[ Upstream commit 6169525b76764acb81918aa387ac168fb9a55575 ]
When relying on devm it doesn't get freed early enough which causes the following warning when unloading the module:
[249348.837181] remove_proc_entry: removing non-empty directory 'irq/20', leaking at least 'vboxguest' [249348.837219] WARNING: CPU: 0 PID: 6708 at fs/proc/generic.c:715 remove_proc_entry+0x119/0x140
[249348.837379] Call Trace: [249348.837385] unregister_irq_proc+0xbd/0xe0 [249348.837392] free_desc+0x23/0x60 [249348.837396] irq_free_descs+0x4a/0x70 [249348.837401] irq_domain_free_irqs+0x160/0x1a0 [249348.837452] mp_unmap_irq+0x5c/0x60 [249348.837458] acpi_unregister_gsi_ioapic+0x29/0x40 [249348.837463] acpi_unregister_gsi+0x17/0x30 [249348.837467] acpi_pci_irq_disable+0xbf/0xe0 [249348.837473] pcibios_disable_device+0x20/0x30 [249348.837478] pci_disable_device+0xef/0x120 [249348.837482] vbg_pci_remove+0x6c/0x70 [vboxguest]
--- drivers/virt/vboxguest/vboxguest_linux.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/virt/vboxguest/vboxguest_linux.c +6 -3
@@ -356,8 +356,8 @@ static int vbg_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) goto err_vbg_core_exit; } - ret =devm_request_irq (dev, pci->irq, vbg_core_isr,IRQF_SHARED , -DEVICE_NAME , gdev); + ret =request_irq (pci->irq, vbg_core_isr,IRQF_SHARED ,DEVICE_NAME , + gdev);if (ret) {vbg_err ("vboxguest: Error requesting irq: %d\n" , ret); goto err_vbg_core_exit;
@@ -367,7 +367,7 @@ static int vbg_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)if (ret) {vbg_err ("vboxguest: Error misc_register %s failed: %d\n" ,DEVICE_NAME , ret); - goto err_vbg_core_exit; + goto err_free_irq; } ret =misc_register (&gdev->misc_device_user);
@@ -403,6 +403,8 @@ static int vbg_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)misc_deregister (&gdev->misc_device_user); err_unregister_misc_device:misc_deregister (&gdev->misc_device); +err_free_irq: +free_irq (pci->irq, gdev); err_vbg_core_exit:vbg_core_exit (gdev); err_disable_pcidev:
@@ -419,6 +421,7 @@ static void vbg_pci_remove(struct pci_dev *pci) vbg_gdev =NULL ;mutex_unlock (&vbg_gdev_mutex); +free_irq (pci->irq, gdev);device_remove_file (gdev->dev, &dev_attr_host_features);device_remove_file (gdev->dev, &dev_attr_host_version);misc_deregister (&gdev->misc_device_user);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 113/158 clk: qcom: ipq8074: dont disable gcc_sleep_clk_src
In reply to Greg Kroah-HartmanFrom: Robert Marko <[email protected]>
[ Upstream commit 1bf7305e79aab095196131bdc87a97796e0e3fac ]
Once the usb sleep clocks are disabled, clock framework is trying to disable the sleep clock source also.
However, it seems that it cannot be disabled and trying to do so produces:
[ 245.436390] ------------[ cut here ]------------ [ 245.441233] gcc_sleep_clk_src status stuck at 'on' [ 245.441254] WARNING: CPU: 2 PID: 223 at clk_branch_wait+0x130/0x140 [ 245.450435] Modules linked in: xhci_plat_hcd xhci_hcd dwc3 dwc3_qcom leds_gpio [ 245.456601] CPU: 2 PID: 223 Comm: sh Not tainted 5.18.0-rc4 #215 [ 245.463889] Hardware name: Xiaomi AX9000 (DT) [ 245.470050] pstate: 204000c5 (nzCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 245.474307] pc : clk_branch_wait+0x130/0x140 [ 245.481073] lr : clk_branch_wait+0x130/0x140 [ 245.485588] sp : ffffffc009f2bad0 [ 245.489838] x29: ffffffc009f2bad0 x28: ffffff8003e6c800 x27: 0000000000000000 [ 245.493057] x26: 0000000000000000 x25: 0000000000000000 x24: ffffff800226ef20 [ 245.500175] x23: ffffffc0089ff550 x22: 0000000000000000 x21: ffffffc008476ad0 [ 245.507294] x20: 0000000000000000 x19: ffffffc00965ac70 x18: fffffffffffc51a7 [ 245.514413] x17: 68702e3030303837 x16: 3a6d726f6674616c x15: ffffffc089f2b777 [ 245.521531] x14: ffffffc0095c9d18 x13: 0000000000000129 x12: 0000000000000129 [ 245.528649] x11: 00000000ffffffea x10: ffffffc009621d18 x9 : 0000000000000001 [ 245.535767] x8 : 0000000000000001 x7 : 0000000000017fe8 x6 : 0000000000000001 [ 245.542885] x5 : ffffff803fdca6d8 x4 : 0000000000000000 x3 : 0000000000000027 [ 245.550002] x2 : 0000000000000027 x1 : 0000000000000023 x0 : 0000000000000026 [ 245.557122] Call trace: [ 245.564229] clk_branch_wait+0x130/0x140 [ 245.566490] clk_branch2_disable+0x2c/0x40 [ 245.570656] clk_core_disable+0x60/0xb0 [ 245.574561] clk_core_disable+0x68/0xb0 [ 245.578293] clk_disable+0x30/0x50 [ 245.582113] dwc3_qcom_remove+0x60/0xc0 [dwc3_qcom] [ 245.585588] platform_remove+0x28/0x60 [ 245.590361] device_remove+0x4c/0x80 [ 245.594179] device_release_driver_internal+0x1dc/0x230 [ 245.597914] device_driver_detach+0x18/0x30 [ 245.602861] unbind_store+0xec/0x110 [ 245.607027] drv_attr_store+0x24/0x40 [ 245.610847] sysfs_kf_write+0x44/0x60 [ 245.614405] kernfs_fop_write_iter+0x128/0x1c0 [ 245.618052] new_sync_write+0xc0/0x130 [ 245.622391] vfs_write+0x1d4/0x2a0 [ 245.626123] ksys_write+0x58/0xe0 [ 245.629508] __arm64_sys_write+0x1c/0x30 [ 245.632895] invoke_syscall.constprop.0+0x5c/0x110 [ 245.636890] do_el0_svc+0xa0/0x150 [ 245.641488] el0_svc+0x18/0x60 [ 245.644872] el0t_64_sync_handler+0xa4/0x130 [ 245.647914] el0t_64_sync+0x174/0x178 [ 245.652340] ---[ end trace 0000000000000000 ]---
So, add CLK_IS_CRITICAL flag to the clock so that the kernel won't try to disable the sleep clock.
--- drivers/clk/qcom/gcc-ipq8074.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/qcom/gcc-ipq8074.c +1 -0
@@ -662,6 +662,7 @@ static struct clk_branch gcc_sleep_clk_src = { }, .num_parents = 1, .ops = &clk_branch2_ops, + .flags = CLK_IS_CRITICAL, }, }, };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 114/158 uacce: Handle parent device removal or parent driver module rmmod
In reply to Greg Kroah-HartmanFrom: Jean-Philippe Brucker <[email protected]>
[ Upstream commit 80fc671bcc0173836e9032b0c698ea74c13b9d7c ]
The uacce driver must deal with a possible removal of the parent device or parent driver module rmmod at any time.
Although uacce_remove(), called on device removal and on driver unbind, prevents future use of the uacce fops by removing the cdev, fops that were called before that point may still be running.
Serialize uacce_fops_open() and uacce_remove() with uacce->mutex. Serialize other fops against uacce_remove() with q->mutex. Since we need to protect uacce_fops_poll() which gets called on the fast path, replace uacce->queues_lock with q->mutex to improve scalability. The other fops are only used during setup.
uacce_queue_is_valid(), checked under q->mutex or uacce->mutex, denotes whether uacce_remove() has disabled all queues. If that is the case, don't go any further since the parent device is being removed and uacce->ops should not be called anymore.
--- drivers/misc/uacce/uacce.c | 133 ++++++++++++++++++++++++------------- include/linux/uacce.h | 6 +- 2 files changed, 91 insertions(+), 48 deletions(-)
drivers/misc/uacce/uacce.c +87 -46
@@ -9,43 +9,38 @@static struct class *uacce_class;static dev_t uacce_devt; -static DEFINE_MUTEX (uacce_mutex);static DEFINE_XARRAY_ALLOC (uacce_xa); -static int uacce_start_queue (struct uacce_queue *q) +/* +* If the parent driver or the device disappears, the queue state is invalid and +* ops are not usable anymore. +*/ +static bool uacce_queue_is_valid (struct uacce_queue *q) { -int ret =0 ; +return q->state ==UACCE_Q_INIT || q->state ==UACCE_Q_STARTED ; +} -mutex_lock (&uacce_mutex); +static int uacce_start_queue (struct uacce_queue *q) +{ +int ret; -if (q->state !=UACCE_Q_INIT ) { - ret = -EINVAL ; - goto out_with_lock; - } +if (q->state !=UACCE_Q_INIT ) +return -EINVAL ;if (q->uacce->ops->start_queue) { ret = q->uacce->ops->start_queue (q);if (ret <0 ) - goto out_with_lock; +return ret; } q->state =UACCE_Q_STARTED ; - -out_with_lock: -mutex_unlock (&uacce_mutex); - -return ret; +return 0 ; }static int uacce_put_queue (struct uacce_queue *q) {struct uacce_device *uacce = q->uacce; -mutex_lock (&uacce_mutex); - -if (q->state ==UACCE_Q_ZOMBIE ) - goto out; -if ((q->state ==UACCE_Q_STARTED ) && uacce->ops->stop_queue) uacce->ops->stop_queue (q);
@@ -54,8 +49,6 @@ static int uacce_put_queue(struct uacce_queue *q) uacce->ops->put_queue (q); q->state =UACCE_Q_ZOMBIE ; -out: -mutex_unlock (&uacce_mutex);return 0 ; }
@@ -65,20 +58,36 @@ static long uacce_fops_unl_ioctl(struct file *filep, {struct uacce_queue *q = filep->private_data;struct uacce_device *uacce = q->uacce; +long ret = -ENXIO ; + +/* +* uacce->ops->ioctl() may take the mmap_lock when copying arg to/from +* user. Avoid a circular lock dependency with uacce_fops_mmap(), which +* gets called with mmap_lock held, by taking uacce->mutex instead of +* q->mutex. Doing this in uacce_fops_mmap() is not possible because +* uacce_fops_open() calls iommu_sva_bind_device(), which takes +* mmap_lock, while holding uacce->mutex. +*/ +mutex_lock (&uacce->mutex); +if (!uacce_queue_is_valid (q)) + goto out_unlock;switch (cmd) {case UACCE_CMD_START_Q : -return uacce_start_queue (q); - + ret =uacce_start_queue (q); +break ;case UACCE_CMD_PUT_Q : -return uacce_put_queue (q); - + ret =uacce_put_queue (q); +break ;default : -if (!uacce->ops->ioctl) -return -EINVAL ; - -return uacce->ops->ioctl (q, cmd, arg); +if (uacce->ops->ioctl) + ret = uacce->ops->ioctl (q, cmd, arg); +else + ret = -EINVAL ; } +out_unlock: +mutex_unlock (&uacce->mutex); +return ret; }#ifdef CONFIG_COMPAT
@@ -136,6 +145,13 @@ static int uacce_fops_open(struct inode *inode, struct file *filep)if (!q)return -ENOMEM ; +mutex_lock (&uacce->mutex); + +if (!uacce->parent) { + ret = -EINVAL ; + goto out_with_mem; + } + ret =uacce_bind_queue (uacce, q);if (ret) goto out_with_mem;
@@ -152,10 +168,9 @@ static int uacce_fops_open(struct inode *inode, struct file *filep) filep->private_data = q; uacce->inode = inode; q->state =UACCE_Q_INIT ; - -mutex_lock (&uacce->queues_lock); +mutex_init (&q->mutex);list_add (&q->list, &uacce->queues); -mutex_unlock (&uacce->queues_lock); +mutex_unlock (&uacce->mutex);return 0 ;
@@ -163,18 +178,20 @@ static int uacce_fops_open(struct inode *inode, struct file *filep)uacce_unbind_queue (q); out_with_mem:kfree (q); +mutex_unlock (&uacce->mutex);return ret; }static int uacce_fops_release (struct inode *inode,struct file *filep) {struct uacce_queue *q = filep->private_data; +struct uacce_device *uacce = q->uacce; -mutex_lock (&q->uacce->queues_lock); -list_del (&q->list); -mutex_unlock (&q->uacce->queues_lock); +mutex_lock (&uacce->mutex);uacce_put_queue (q);uacce_unbind_queue (q); +list_del (&q->list); +mutex_unlock (&uacce->mutex);kfree (q);return 0 ;
@@ -217,10 +234,9 @@ static int uacce_fops_mmap(struct file *filep, struct vm_area_struct *vma) vma->vm_private_data = q; qfr->type = type; -mutex_lock (&uacce_mutex); - -if (q->state !=UACCE_Q_INIT && q->state !=UACCE_Q_STARTED ) { - ret = -EINVAL ; +mutex_lock (&q->mutex); +if (!uacce_queue_is_valid (q)) { + ret = -ENXIO ; goto out_with_lock; }
@@ -259,12 +275,12 @@ static int uacce_fops_mmap(struct file *filep, struct vm_area_struct *vma) } q->qfrs[type] = qfr; -mutex_unlock (&uacce_mutex); +mutex_unlock (&q->mutex);return ret; out_with_lock: -mutex_unlock (&uacce_mutex); +mutex_unlock (&q->mutex);kfree (qfr);return ret; }
@@ -273,12 +289,20 @@ static __poll_t uacce_fops_poll(struct file *file, poll_table *wait) {struct uacce_queue *q = file->private_data;struct uacce_device *uacce = q->uacce; +__poll_t ret =0 ; + +mutex_lock (&q->mutex); +if (!uacce_queue_is_valid (q)) + goto out_unlock;poll_wait (file, &q->wait, wait); +if (uacce->ops->is_q_updated && uacce->ops->is_q_updated (q)) -return EPOLLIN |EPOLLRDNORM ; + ret =EPOLLIN |EPOLLRDNORM ; -return 0 ; +out_unlock: +mutex_unlock (&q->mutex); +return ret; }static const struct file_operations uacce_fops = {
@@ -431,7 +455,7 @@ struct uacce_device *uacce_alloc(struct device *parent, goto err_with_uacce;INIT_LIST_HEAD (&uacce->queues); -mutex_init (&uacce->queues_lock); +mutex_init (&uacce->mutex);device_initialize (&uacce->dev); uacce->dev.devt =MKDEV (MAJOR (uacce_devt), uacce->dev_id); uacce->dev.class = uacce_class;
@@ -489,13 +513,23 @@ void uacce_remove(struct uacce_device *uacce)if (uacce->inode)unmap_mapping_range (uacce->inode->i_mapping,0 ,0 ,1 ); +/* +* uacce_fops_open() may be running concurrently, even after we remove +* the cdev. Holding uacce->mutex ensures that open() does not obtain a +* removed uacce device. +*/ +mutex_lock (&uacce->mutex);/* ensure no open queue remains */ -mutex_lock (&uacce->queues_lock);list_for_each_entry_safe (q, next_q, &uacce->queues, list) { +/* +* Taking q->mutex ensures that fops do not use the defunct +* uacce->ops after the queue is disabled. +*/ +mutex_lock (&q->mutex);uacce_put_queue (q); +mutex_unlock (&q->mutex);uacce_unbind_queue (q); } -mutex_unlock (&uacce->queues_lock);/* disable sva now since no opened queues */ if (uacce->flags &UACCE_DEV_SVA )
@@ -504,6 +538,13 @@ void uacce_remove(struct uacce_device *uacce)if (uacce->cdev)cdev_device_del (uacce->cdev, &uacce->dev);xa_erase (&uacce_xa, uacce->dev_id); +/* +* uacce exists as long as there are open fds, but ops will be freed +* now. Ensure that bugs cause NULL deref rather than use-after-free. +*/ + uacce->ops =NULL ; + uacce->parent =NULL ; +mutex_unlock (&uacce->mutex);put_device (&uacce->dev); }EXPORT_SYMBOL_GPL (uacce_remove);
include/linux/uacce.h +4 -2
@@ -70,6 +70,7 @@ enum uacce_q_state {* @wait: wait queue head * @list: index into uacce queues list * @qfrs: pointer of qfr regions +* @mutex: protects queue state * @state: queue state machine * @pasid: pasid associated to the mm * @handle: iommu_sva handle returned by iommu_sva_bind_device()
@@ -80,6 +81,7 @@ struct uacce_queue {wait_queue_head_t wait;struct list_head list;struct uacce_qfile_region *qfrs[UACCE_MAX_REGION ]; +struct mutex mutex;enum uacce_q_state state;u32 pasid;struct iommu_sva *handle;
@@ -97,9 +99,9 @@ struct uacce_queue {* @dev_id: id of the uacce device * @cdev: cdev of the uacce * @dev: dev of the uacce +* @mutex: protects uacce operation * @priv: private pointer of the uacce * @queues: list of queues -* @queues_lock: lock for queues list * @inode: core vfs */ struct uacce_device {
@@ -113,9 +115,9 @@ struct uacce_device {u32 dev_id;struct cdev *cdev;struct device dev; +struct mutex mutex;void *priv;struct list_head queues; -struct mutex queues_lock;struct inode *inode; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 115/158 zram: do not lookup algorithm in backends table
In reply to Greg Kroah-HartmanFrom: Sergey Senozhatsky <[email protected]>
[ Upstream commit dc89997264de565999a1cb55db3f295d3a8e457b ]
Always use crypto_has_comp() so that crypto can lookup module, call usermodhelper to load the modules, wait for usermodhelper to finish and so on. Otherwise crypto will do all of these steps under CPU hot-plug lock and this looks like too much stuff to handle under the CPU hot-plug lock. Besides this can end up in a deadlock when usermodhelper triggers a code path that attempts to lock the CPU hot-plug lock, that zram already holds.
An example of such deadlock:
- path A. zram grabs CPU hot-plug lock, execs /sbin/modprobe from crypto and waits for modprobe to finish
disksize_store
zcomp_create
__cpuhp_state_add_instance
__cpuhp_state_add_instance_cpuslocked
zcomp_cpu_up_prepare
crypto_alloc_base
crypto_alg_mod_lookup
call_usermodehelper_exec
wait_for_completion_killable
do_wait_for_common
schedule
- path B. async work kthread that brings in scsi device. It wants to register CPUHP states at some point, and it needs the CPU hot-plug lock for that, which is owned by zram.
async_run_entry_fn
scsi_probe_and_add_lun
scsi_mq_alloc_queue
blk_mq_init_queue
blk_mq_init_allocated_queue
blk_mq_realloc_hw_ctxs
__cpuhp_state_add_instance
__cpuhp_state_add_instance_cpuslocked
mutex_lock
schedule
- path C. modprobe sleeps, waiting for all aync works to finish.
load_module
do_init_module
async_synchronize_full
async_synchronize_cookie_domain
schedule
--- drivers/block/zram/zcomp.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/block/zram/zcomp.c +5 -6
@@ -61,12 +61,6 @@ static int zcomp_strm_init(struct zcomp_strm *zstrm, struct zcomp *comp)bool zcomp_available_algorithm (const char *comp) { -int i; - - i =sysfs_match_string (backends, comp); -if (i >=0 ) -return true; -/* * Crypto does not ignore a trailing new line symbol, * so make sure you don't supply a string containing
@@ -215,6 +209,11 @@ struct zcomp *zcomp_create(const char *compress)struct zcomp *comp;int error; +/* +* Crypto API will execute /sbin/modprobe if the compression module +* is not loaded yet. We must do it here, otherwise we are about to +* call /sbin/modprobe under CPU hot-plug lock. +*/ if (!zcomp_available_algorithm (compress))return ERR_PTR (-EINVAL );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 116/158 clk: qcom: clk-alpha-pll: fix clk_trion_pll_configure description
In reply to Greg Kroah-HartmanFrom: Vladimir Zapolskiy <[email protected]>
[ Upstream commit 94bed9bb05c7850ff5d80b87cc29004901f37956 ]
After merging lucid and trion pll functions in commit 0b01489475c6 ("clk: qcom: clk-alpha-pll: same regs and ops for trion and lucid") the function clk_trion_pll_configure() is left with an old description header, which results in a W=2 compile time warning, fix it.
--- drivers/clk/qcom/clk-alpha-pll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/clk-alpha-pll.c +1 -1
@@ -1379,7 +1379,7 @@ const struct clk_ops clk_alpha_pll_postdiv_fabia_ops = {EXPORT_SYMBOL_GPL (clk_alpha_pll_postdiv_fabia_ops);/** -* clk_lucid_pll_configure - configure the lucid pll +* clk_trion_pll_configure - configure the trion pll * * @pll: clk alpha pll * @regmap: register map
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 117/158 scsi: lpfc: Prevent buffer overflow crashes in debugfs with malformed user input
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit f8191d40aa612981ce897e66cda6a88db8df17bb ]
Malformed user input to debugfs results in buffer overflow crashes. Adapt input string lengths to fit within internal buffers, leaving space for NULL terminators.
--- drivers/scsi/lpfc/lpfc_debugfs.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/scsi/lpfc/lpfc_debugfs.c +10 -10
@@ -2609,8 +2609,8 @@ lpfc_debugfs_multixripools_write(struct file *file, const char __user *buf,struct lpfc_sli4_hdw_queue *qp;struct lpfc_multixri_pool *multixri_pool; -if (nbytes >64 ) - nbytes =64 ; +if (nbytes >sizeof (mybuf) -1 ) + nbytes =sizeof (mybuf) -1 ;memset (mybuf,0 ,sizeof (mybuf));
@@ -2690,8 +2690,8 @@ lpfc_debugfs_nvmestat_write(struct file *file, const char __user *buf,if (!phba->targetport)return -ENXIO ; -if (nbytes >64 ) - nbytes =64 ; +if (nbytes >sizeof (mybuf) -1 ) + nbytes =sizeof (mybuf) -1 ;memset (mybuf,0 ,sizeof (mybuf));
@@ -2828,8 +2828,8 @@ lpfc_debugfs_ioktime_write(struct file *file, const char __user *buf,char mybuf[64 ];char *pbuf; -if (nbytes >64 ) - nbytes =64 ; +if (nbytes >sizeof (mybuf) -1 ) + nbytes =sizeof (mybuf) -1 ;memset (mybuf,0 ,sizeof (mybuf));
@@ -2956,8 +2956,8 @@ lpfc_debugfs_nvmeio_trc_write(struct file *file, const char __user *buf,char mybuf[64 ];char *pbuf; -if (nbytes >63 ) - nbytes =63 ; +if (nbytes >sizeof (mybuf) -1 ) + nbytes =sizeof (mybuf) -1 ;memset (mybuf,0 ,sizeof (mybuf));
@@ -3062,8 +3062,8 @@ lpfc_debugfs_hdwqstat_write(struct file *file, const char __user *buf,char *pbuf;int i; -if (nbytes >64 ) - nbytes =64 ; +if (nbytes >sizeof (mybuf) -1 ) + nbytes =sizeof (mybuf) -1 ;memset (mybuf,0 ,sizeof (mybuf));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 118/158 gadgetfs: ep_io - wait until IRQ finishes
In reply to Greg Kroah-HartmanFrom: Jozef Martiniak <[email protected]>
[ Upstream commit 04cb742d4d8f30dc2e83b46ac317eec09191c68e ]
after usb_ep_queue() if wait_for_completion_interruptible() is interrupted we need to wait until IRQ gets finished.
Otherwise complete() from epio_complete() can corrupt stack.
--- drivers/usb/gadget/legacy/inode.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/legacy/inode.c +1 -0
@@ -362,6 +362,7 @@ ep_io (struct ep_data *epdata, void *buf, unsigned len)spin_unlock_irq (&epdata->dev->lock);DBG (epdata->dev,"endpoint gone\n" ); +wait_for_completion (&done); epdata->status = -ENODEV ; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 119/158 pinctrl: intel: Check against matching data instead of ACPI companion
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit c551bd81d198bf1dcd4398d5454acdc0309dbe77 ]
In some cases we may get a platform device that has ACPI companion which is different to the pin control described in the ACPI tables. This is primarily happens when device is instantiated by board file.
In order to allow this device being enumerated, refactor intel_pinctrl_get_soc_data() to check the matching data instead of ACPI companion.
--- drivers/pinctrl/intel/pinctrl-intel.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/pinctrl/intel/pinctrl-intel.c +6 -8
@@ -1571,16 +1571,14 @@ EXPORT_SYMBOL_GPL(intel_pinctrl_probe_by_uid);const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data (struct platform_device *pdev) { +const struct intel_pinctrl_soc_data *const *table;const struct intel_pinctrl_soc_data *data =NULL ; -const struct intel_pinctrl_soc_data **table; -struct acpi_device *adev; -unsigned int i; - adev =ACPI_COMPANION (&pdev->dev); -if (adev) { -const void *match =device_get_match_data (&pdev->dev); + table =device_get_match_data (&pdev->dev); +if (table) { +struct acpi_device *adev =ACPI_COMPANION (&pdev->dev); +unsigned int i; - table = (const struct intel_pinctrl_soc_data **)match;for (i =0 ; table[i]; i++) {if (!strcmp (adev->pnp.unique_id, table[i]->uid)) { data = table[i];
@@ -1594,7 +1592,7 @@ const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data(struct platform_if (!id)return ERR_PTR (-ENODEV ); - table = (const struct intel_pinctrl_soc_data **)id->driver_data; + table = (const struct intel_pinctrl_soc_data *const *)id->driver_data; data = table[pdev->id]; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 120/158 cxl: Fix a memory leak in an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 3a15b45b5454da862376b5d69a4967f5c6fa1368 ]
A bitmap_zalloc() must be balanced by a corresponding bitmap_free() in the error handling path of afu_allocate_irqs().
--- drivers/misc/cxl/irq.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/cxl/irq.c +1 -0
@@ -349,6 +349,7 @@ int afu_allocate_irqs(struct cxl_context *ctx, u32 count) out: cxl_ops->release_irq_ranges (&ctx->irqs, ctx->afu->adapter); +bitmap_free (ctx->irq_bitmap);afu_irq_name_free (ctx);return -ENOMEM ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 121/158 PCI/ACPI: Guard ARM64-specific mcfg_quirks
In reply to Greg Kroah-HartmanFrom: Huacai Chen <[email protected]>
[ Upstream commit 40a6cc141b4b9580de140bcb3e893445708acc5d ]
Guard ARM64-specific quirks with CONFIG_ARM64 to avoid build errors, since mcfg_quirks will be shared by more than one architectures.
--- drivers/acpi/pci_mcfg.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/acpi/pci_mcfg.c +3 -0
@@ -41,6 +41,8 @@ struct mcfg_fixup { static struct mcfg_fixup mcfg_quirks[] = {/* { OEM_ID, OEM_TABLE_ID, REV, SEGMENT, BUS_RANGE, ops, cfgres }, */ +#ifdef CONFIG_ARM64 +#define AL_ECAM (table_id, rev, seg, ops) \ { "AMAZON", table_id, rev, seg, MCFG_BUS_ANY, ops }
@@ -162,6 +164,7 @@ static struct mcfg_fixup mcfg_quirks[] = {ALTRA_ECAM_QUIRK (1 ,13 ),ALTRA_ECAM_QUIRK (1 ,14 ), ALTRA_ECAM_QUIRK(1, 15), +#endif /* ARM64 */ };static char mcfg_oem_id[ACPI_OEM_ID_SIZE ];
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 122/158 um: add "noreboot" command line option for PANIC_TIMEOUT=-1 setups
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
[ Upstream commit dda520d07b95072a0b63f6c52a8eb566d08ea897 ]
QEMU has a -no-reboot option, which halts instead of reboots when the guest asks to reboot. This is invaluable when used with CONFIG_PANIC_TIMEOUT=-1 (and panic_on_warn), because it allows panics and warnings to be caught immediately in CI. Implement this in UML too, by way of a basic setup param.
--- arch/um/os-Linux/skas/process.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
arch/um/os-Linux/skas/process.c +16 -1
@@ -5,6 +5,7 @@*/ #include <stdlib.h> +#include <stdbool.h> #include <unistd.h> #include <sched.h> #include <errno.h>
@@ -644,10 +645,24 @@ void halt_skas(void)UML_LONGJMP (&initial_jmpbuf,INIT_JMP_HALT ); } +static bool noreboot; + +static int __init noreboot_cmd_param (char *str,int *add) +{ + noreboot = true; +return 0 ; +} + +__uml_setup ("noreboot" , noreboot_cmd_param, +"noreboot\n" +" Rather than rebooting, exit always, akin to QEMU's -no-reboot option.\n" +" This is useful if you're using CONFIG_PANIC_TIMEOUT in order to catch\n" +" crashes in CI\n" ); +void reboot_skas (void ) {block_signals_trace (); -UML_LONGJMP (&initial_jmpbuf,INIT_JMP_REBOOT ); +UML_LONGJMP (&initial_jmpbuf, noreboot ?INIT_JMP_HALT :INIT_JMP_REBOOT ); }void __switch_mm (struct mm_id *mm_idp)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 123/158 RDMA/rxe: Limit the number of calls to each tasklet
In reply to Greg Kroah-HartmanFrom: Bob Pearson <[email protected]>
[ Upstream commit eff6d998ca297cb0b2e53b032a56cf8e04dd8b17 ]
Limit the maximum number of calls to each tasklet from rxe_do_task() before yielding the cpu. When the limit is reached reschedule the tasklet and exit the calling loop. This patch prevents one tasklet from consuming 100% of a cpu core and causing a deadlock or soft lockup.
--- drivers/infiniband/sw/rxe/rxe_param.h | 6 ++++++ drivers/infiniband/sw/rxe/rxe_task.c | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-)
drivers/infiniband/sw/rxe/rxe_param.h +6 -0
@@ -98,6 +98,12 @@ enum rxe_device_param {RXE_INFLIGHT_SKBS_PER_QP_HIGH =64 ,RXE_INFLIGHT_SKBS_PER_QP_LOW =16 , +/* Max number of interations of each tasklet +* before yielding the cpu to let other +* work make progress +*/ +RXE_MAX_ITERATIONS =1024 , +/* Delay before calling arbiter timer */ RXE_NSEC_ARB_TIMER_DELAY = 200,
drivers/infiniband/sw/rxe/rxe_task.c +12 -4
@@ -8,7 +8,7 @@#include <linux/interrupt.h> #include <linux/hardirq.h> -#include "rxe_task.h" +#include "rxe.h" int __rxe_do_task (struct rxe_task *task)
@@ -34,6 +34,7 @@ void rxe_do_task(struct tasklet_struct *t)int ret;unsigned long flags;struct rxe_task *task =from_tasklet (task, t, tasklet); +unsigned int iterations =RXE_MAX_ITERATIONS ;spin_lock_irqsave (&task->state_lock, flags);switch (task->state) {
@@ -62,13 +63,20 @@ void rxe_do_task(struct tasklet_struct *t)spin_lock_irqsave (&task->state_lock, flags);switch (task->state) {case TASK_STATE_BUSY : -if (ret) +if (ret) { task->state =TASK_STATE_START ; -else + }else if (iterations--) { cont =1 ; + }else { +/* reschedule the tasklet and exit +* the loop to give up the cpu +*/ +tasklet_schedule (&task->tasklet); + task->state =TASK_STATE_START ; + }break ; -/* soneone tried to run the task since the last time we called +/* someone tried to run the task since the last time we called * func, so we will call one more time regardless of the * return value */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 124/158 csky/kprobe: reclaim insn_slot on kprobe unregistration
In reply to Greg Kroah-HartmanFrom: Liao Chang <[email protected]>
[ Upstream commit a2310c74d418deca0f1d749c45f1f43162510f51 ]
On kprobe registration kernel allocate one insn_slot for new kprobe, but it forget to reclaim the insn_slot on unregistration, leading to a potential leakage.
--- arch/csky/kernel/probes/kprobes.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/csky/kernel/probes/kprobes.c +4 -0
@@ -124,6 +124,10 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)void __kprobes arch_remove_kprobe (struct kprobe *p) { +if (p->ainsn.api.insn) { +free_insn_slot (p->ainsn.api.insn,0 ); + p->ainsn.api.insn =NULL ; + } }static void __kprobes save_previous_kprobe (struct kprobe_ctlblk *kcb)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 125/158 selftests/kprobe: Do not test for GRP/ without event failures
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (Google) <[email protected]>
[ Upstream commit f5eab65ff2b76449286d18efc7fee3e0b72f7d9b ]
A new feature is added where kprobes (and other probes) do not need to explicitly state the event name when creating a probe. The event name will come from what is being attached.
That is:
# echo 'p:foo/ vfs_read' > kprobe_events
Will no longer error, but instead create an event:
# cat kprobe_events p:foo/p_vfs_read_0 vfs_read
This should not be tested as an error case anymore. Remove it from the selftest as now this feature "breaks" the selftest as it no longer fails as expected.
--- .../selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc | 1 - 1 file changed, 1 deletion(-)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +0 -1
@@ -21,7 +21,6 @@ check_error 'p:^/bar vfs_read' # NO_GROUP_NAME check_error 'p:^12345678901234567890123456789012345678901234567890123456789012345/bar vfs_read' # GROUP_TOO_LONG check_error 'p:^foo.1/bar vfs_read' # BAD_GROUP_NAME -check_error 'p:foo/^ vfs_read' # NO_EVENT_NAME check_error 'p:foo/^12345678901234567890123456789012345678901234567890123456789012345 vfs_read' # EVENT_TOO_LONG check_error 'p:foo/^bar.1 vfs_read' # BAD_EVENT_NAME
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 126/158 dmaengine: sprd: Cleanup in .remove() after pm_runtime_get_sync() failed
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 1e42f82cbec7b2cc4873751e7791e6611901c5fc ]
It's not allowed to quit remove early without cleaning up completely. Otherwise this results in resource leaks that probably yield graver problems later. Here for example some tasklets might survive the lifetime of the sprd-dma device and access sdev which is freed after .remove() returns.
As none of the device freeing requires an active device, just ignore the return value of pm_runtime_get_sync().
--- drivers/dma/sprd-dma.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/dma/sprd-dma.c +1 -4
@@ -1236,11 +1236,8 @@ static int sprd_dma_remove(struct platform_device *pdev) {struct sprd_dma_dev *sdev =platform_get_drvdata (pdev);struct sprd_dma_chn *c, *cn; -int ret; - ret =pm_runtime_get_sync (&pdev->dev); -if (ret <0 ) -return ret; +pm_runtime_get_sync (&pdev->dev);/* explicitly free the irq */ if (sdev->irq >0 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 127/158 md: Notify sysfs sync_completed in md_reap_sync_thread()
In reply to Greg Kroah-HartmanFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit 9973f0fa7d20269fe6fefe6333997fb5914449c1 ]
The mdadm test 07layouts randomly produces a kernel hung task deadlock. The deadlock is caused by the suspend_lo/suspend_hi files being set by the mdadm background process during reshape and not being cleared because the process hangs. (Leaving aside the issue of the fragility of freezing kernel tasks by buggy userspace processes...)
When the background mdadm process hangs it, is waiting (without a timeout) on a change to the sync_completed file signalling that the reshape has completed. The process is woken up a couple times when the reshape finishes but it is woken up before MD_RECOVERY_RUNNING is cleared so sync_completed_show() reports 0 instead of "none".
To fix this, notify the sysfs file in md_reap_sync_thread() after MD_RECOVERY_RUNNING has been cleared. This wakes up mdadm and causes it to continue and write to suspend_lo/suspend_hi to allow IO to continue.
--- drivers/md/md.c | 1 + 1 file changed, 1 insertion(+)
drivers/md/md.c +1 -0
@@ -9424,6 +9424,7 @@ void md_reap_sync_thread(struct mddev *mddev)wake_up (&resync_wait);/* flag recovery needed just to double check */ set_bit (MD_RECOVERY_NEEDED , &mddev->recovery); +sysfs_notify_dirent_safe (mddev->sysfs_completed);sysfs_notify_dirent_safe (mddev->sysfs_action);md_new_event (mddev);if (mddev->event_work.func)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 128/158 nvmet-tcp: fix lockdep complaint on nvmet_tcp_wq flush during queue teardown
In reply to Greg Kroah-HartmanFrom: Sagi Grimberg <[email protected]>
[ Upstream commit 533d2e8b4d5e4c89772a0adce913525fb86cbbee ]
We probably need nvmet_tcp_wq to have MEM_RECLAIM as we are sending/receiving for the socket from works on this workqueue. Also this eliminates lockdep complaints:
--
[ 6174.010200] workqueue: WQ_MEM_RECLAIM nvmet-wq:nvmet_tcp_release_queue_work [nvmet_tcp] is flushing !WQ_MEM_RECLAIM nvmet_tcp_wq:nvmet_tcp_io_work [nvmet_tcp] [ 6174.010216] WARNING: CPU: 20 PID: 14456 at kernel/workqueue.c:2628
check_flush_dependency+0x110/0x14c
--- drivers/nvme/target/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/target/tcp.c +2 -1
@@ -1802,7 +1802,8 @@ static int __init nvmet_tcp_init(void) {int ret; - nvmet_tcp_wq =alloc_workqueue ("nvmet_tcp_wq" ,WQ_HIGHPRI ,0 ); + nvmet_tcp_wq =alloc_workqueue ("nvmet_tcp_wq" , +WQ_MEM_RECLAIM |WQ_HIGHPRI ,0 );if (!nvmet_tcp_wq)return -ENOMEM ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 129/158 drivers:md:fix a potential use-after-free bug
In reply to Greg Kroah-HartmanFrom: Wentao_Liang <[email protected]>
[ Upstream commit 104212471b1c1817b311771d817fb692af983173 ]
In line 2884, "raid5_release_stripe(sh);" drops the reference to sh and may cause sh to be released. However, sh is subsequently used in lines 2886 "if (sh->batch_head && sh != sh->batch_head)". This may result in an use-after-free bug.
It can be fixed by moving "raid5_release_stripe(sh);" to the bottom of the function.
--- drivers/md/raid5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid5.c +1 -1
@@ -2864,10 +2864,10 @@ static void raid5_end_write_request(struct bio *bi)if (!test_and_clear_bit (R5_DOUBLE_LOCKED , &sh->dev[i].flags))clear_bit (R5_LOCKED , &sh->dev[i].flags);set_bit (STRIPE_HANDLE , &sh->state); -raid5_release_stripe (sh);if (sh->batch_head && sh != sh->batch_head)raid5_release_stripe (sh->batch_head); +raid5_release_stripe (sh); }static void raid5_error (struct mddev *mddev,struct md_rdev *rdev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 130/158 ext4: avoid remove directory when directory is corrupted
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
[ Upstream commit b24e77ef1c6d4dbf42749ad4903c97539cc9755a ]
Now if check directoy entry is corrupted, ext4_empty_dir may return true then directory will be removed when file system mounted with "errors=continue". In order not to make things worse just return false when directory is corrupted.
--- fs/ext4/namei.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
fs/ext4/namei.c +2 -5
@@ -2961,11 +2961,8 @@ bool ext4_empty_dir(struct inode *inode) de = (struct ext4_dir_entry_2 *) (bh->b_data + (offset & (sb->s_blocksize -1 )));if (ext4_check_dir_entry (inode,NULL , de, bh, - bh->b_data, bh->b_size, offset)) { - offset = (offset | (sb->s_blocksize -1 )) +1 ; -continue ; - } -if (le32_to_cpu (de->inode)) { + bh->b_data, bh->b_size, offset) || +le32_to_cpu (de->inode)) {brelse (bh);return false; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 131/158 ext4: avoid resizing to a partial cluster size
In reply to Greg Kroah-HartmanFrom: Kiselev, Oleg <[email protected]>
[ Upstream commit 69cb8e9d8cd97cdf5e293b26d70a9dee3e35e6bd ]
This patch avoids an attempt to resize the filesystem to an unaligned cluster boundary. An online resize to a size that is not integral to cluster size results in the last iteration attempting to grow the fs by a negative amount, which trips a BUG_ON and leaves the fs with a corrupted in-memory superblock.
--- fs/ext4/resize.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/ext4/resize.c +10 -0
@@ -1957,6 +1957,16 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count) }brelse (bh); +/* +* For bigalloc, trim the requested size to the nearest cluster +* boundary to avoid creating an unusable filesystem. We do this +* silently, instead of returning an error, to avoid breaking +* callers that blindly resize the filesystem to the full size of +* the underlying block device. +*/ +if (ext4_has_feature_bigalloc (sb)) + n_blocks_count &= ~((1 <<EXT4_CLUSTER_BITS (sb)) -1 ); + retry: o_blocks_count =ext4_blocks_count (es);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 132/158 lib/list_debug.c: Detect uninitialized lists
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit 0cc011c576aaa4de505046f7a6c90933d7c749a9 ]
In some circumstances, attempts are made to add entries to or to remove entries from an uninitialized list. A prime example is amdgpu_bo_vm_destroy(): It is indirectly called from ttm_bo_init_reserved() if that function fails, and tries to remove an entry from a list. However, that list is only initialized in amdgpu_bo_create_vm() after the call to ttm_bo_init_reserved() returned success. This results in crashes such as
BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP NOPTI CPU: 1 PID: 1479 Comm: chrome Not tainted 5.10.110-15768-g29a72e65dae5 Hardware name: Google Grunt/Grunt, BIOS Google_Grunt.11031.149.0 07/15/2020 RIP: 0010:__list_del_entry_valid+0x26/0x7d ... Call Trace: amdgpu_bo_vm_destroy+0x48/0x8b ttm_bo_init_reserved+0x1d7/0x1e0 amdgpu_bo_create+0x212/0x476 ? amdgpu_bo_user_destroy+0x23/0x23 ? kmem_cache_alloc+0x60/0x271 amdgpu_bo_create_vm+0x40/0x7d amdgpu_vm_pt_create+0xe8/0x24b ...
Check if the list's prev and next pointers are NULL to catch such problems.
--- lib/list_debug.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
lib/list_debug.c +10 -2
@@ -20,7 +20,11 @@ bool __list_add_valid(struct list_head *new, struct list_head *prev, struct list_head *next) { - if (CHECK_DATA_CORRUPTION(next->prev != prev, + if (CHECK_DATA_CORRUPTION(prev == NULL, + "list_add corruption. prev is NULL.\n") || + CHECK_DATA_CORRUPTION(next == NULL, + "list_add corruption. next is NULL.\n") || + CHECK_DATA_CORRUPTION(next->prev != prev, "list_add corruption. next->prev should be prev (%px), but was %px. (next=%px).\n", prev, next->prev, next) || CHECK_DATA_CORRUPTION(prev->next != next,
@@ -42,7 +46,11 @@ bool __list_del_entry_valid(struct list_head *entry) prev = entry->prev; next = entry->next; -if (CHECK_DATA_CORRUPTION (next ==LIST_POISON1 , +if (CHECK_DATA_CORRUPTION (next ==NULL , +"list_del corruption, %px->next is NULL\n" , entry) || +CHECK_DATA_CORRUPTION (prev ==NULL , +"list_del corruption, %px->prev is NULL\n" , entry) || +CHECK_DATA_CORRUPTION (next ==LIST_POISON1 ,"list_del corruption, %px->next is LIST_POISON1 (%px)\n" , entry,LIST_POISON1 ) || CHECK_DATA_CORRUPTION(prev == LIST_POISON2,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 133/158 tty: serial: Fix refcount leak bug in ucc_uart.c
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit d24d7bb2cd947676f9b71fb944d045e09b8b282f ]
In soc_info(), of_find_node_by_type() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore.
--- drivers/tty/serial/ucc_uart.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/ucc_uart.c +2 -0
@@ -1137,6 +1137,8 @@ static unsigned int soc_info(unsigned int *rev_h, unsigned int *rev_l)/* No compatible property, so try the name. */ soc_string = np->name; +of_node_put (np); +/* Extract the SOC number from the "PowerPC," string */ if ((sscanf (soc_string,"PowerPC,%u" , &soc) !=1 ) || !soc)return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 134/158 vfio: Clear the caps->buf to NULL after free
In reply to Greg Kroah-HartmanFrom: Schspa Shi <[email protected]>
[ Upstream commit 6641085e8d7b3f061911517f79a2a15a0a21b97b ]
On buffer resize failure, vfio_info_cap_add() will free the buffer, report zero for the size, and return -ENOMEM. As additional hardening, also clear the buffer pointer to prevent any chance of a double free.
--- drivers/vfio/vfio.c | 1 + 1 file changed, 1 insertion(+)
drivers/vfio/vfio.c +1 -0
@@ -1783,6 +1783,7 @@ struct vfio_info_cap_header *vfio_info_cap_add(struct vfio_info_cap *caps, buf =krealloc (caps->buf, caps->size + size,GFP_KERNEL );if (!buf) {kfree (caps->buf); + caps->buf =NULL ; caps->size =0 ;return ERR_PTR (-ENOMEM ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 135/158 mips: cavium-octeon: Fix missing of_node_put() in octeon2_usb_clocks_start
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 7a9f743ceead60ed454c46fbc3085ee9a79cbebb ]
We should call of_node_put() for the reference 'uctl_node' returned by of_get_parent() which will increase the refcount. Otherwise, there will be a refcount leak bug.
--- arch/mips/cavium-octeon/octeon-platform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/mips/cavium-octeon/octeon-platform.c +2 -1
@@ -86,11 +86,12 @@ static void octeon2_usb_clocks_start(struct device *dev) "refclk-frequency", &clock_rate);if (i) {dev_err (dev,"No UCTL \"refclk-frequency\"\n" ); +of_node_put (uctl_node); goto exit; } i =of_property_read_string (uctl_node,"refclk-type" , &clock_type); - +of_node_put (uctl_node);if (!i &&strcmp ("crystal" , clock_type) ==0 ) is_crystal_clock = true; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 136/158 modules: Ensure natural alignment for .altinstructions and __bug_table sections
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
[ Upstream commit 87c482bdfa79f378297d92af49cdf265be199df5 ]
In the kernel image vmlinux.lds.S linker scripts the .altinstructions and __bug_table sections are 4- or 8-byte aligned because they hold 32- and/or 64-bit values.
Most architectures use altinstructions and BUG() or WARN() in modules as well, but in the module linker script (module.lds.S) those sections are currently missing. As consequence the linker will store their content byte-aligned by default, which then can lead to unnecessary unaligned memory accesses by the CPU when those tables are processed at runtime.
Usually unaligned memory accesses are unnoticed, because either the hardware (as on x86 CPUs) or in-kernel exception handlers (e.g. on parisc or sparc) emulate and fix them up at runtime. Nevertheless, such unaligned accesses introduce a performance penalty and can even crash the kernel if there is a bug in the unalignment exception handlers (which happened once to me on the parisc architecture and which is why I noticed that issue at all).
This patch fixes a non-critical issue and might be backported at any time. It's trivial and shouldn't introduce any regression because it simply tells the linker to use a different (8-byte alignment) for those sections by default.
--- scripts/module.lds.S | 2 ++ 1 file changed, 2 insertions(+)
scripts/module.lds.S +2 -0
@@ -22,6 +22,8 @@ SECTIONS { .init_array 0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) } + .altinstructions 0 : ALIGN(8) { KEEP(*(.altinstructions)) } + __bug_table 0 : ALIGN(8) { KEEP(*(__bug_table)) } __jump_table 0 : ALIGN(8) { KEEP(*(__jump_table)) } __patchable_function_entries : { *(__patchable_function_entries) }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 137/158 riscv: dts: sifive: Add fu540 topology information
In reply to Greg Kroah-HartmanFrom: Conor Dooley <[email protected]>
[ Upstream commit af8f260abc608c06e4466a282b53f1e2dc09f042 ]
The fu540 has no cpu-map node, so tools like hwloc cannot correctly parse the topology. Add the node using the existing node labels.
--- arch/riscv/boot/dts/sifive/fu540-c000.dtsi | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+)
arch/riscv/boot/dts/sifive/fu540-c000.dtsi +24 -0
@@ -133,6 +133,30 @@ interrupt-controller; }; }; + + cpu-map { + cluster0 { + core0 { + cpu = <&cpu0>; + }; + + core1 { + cpu = <&cpu1>; + }; + + core2 { + cpu = <&cpu2>; + }; + + core3 { + cpu = <&cpu3>; + }; + + core4 { + cpu = <&cpu4>; + }; + }; + }; }; soc { #address-cells = <2>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 138/158 riscv: mmap with PROT_WRITE but no PROT_READ is invalid
In reply to Greg Kroah-HartmanFrom: Celeste Liu <[email protected]>
[ Upstream commit 2139619bcad7ac44cc8f6f749089120594056613 ]
As mentioned in Table 4.5 in RISC-V spec Volume 2 Section 4.3, write but not read is "Reserved for future use.". For now, they are not valid. In the current code, -wx is marked as invalid, but -w- is not marked as invalid.
This patch refines that judgment.
--- arch/riscv/kernel/sys_riscv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/riscv/kernel/sys_riscv.c +2 -3
@@ -18,9 +18,8 @@ static long riscv_sys_mmap(unsigned long addr, unsigned long len,if (unlikely (offset & (~PAGE_MASK >> page_shift_offset)))return -EINVAL ; -if ((prot &PROT_WRITE ) && (prot &PROT_EXEC )) -if (unlikely (!(prot &PROT_READ ))) -return -EINVAL ; +if (unlikely ((prot &PROT_WRITE ) && !(prot &PROT_READ ))) +return -EINVAL ;return ksys_mmap_pgoff (addr, len, prot, flags, fd, offset >> (PAGE_SHIFT - page_shift_offset));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 139/158 RISC-V: Add fast call path of crash_kexec()
In reply to Greg Kroah-HartmanFrom: Xianting Tian <[email protected]>
[ Upstream commit 3f1901110a89b0e2e13adb2ac8d1a7102879ea98 ]
Currently, almost all archs (x86, arm64, mips...) support fast call of crash_kexec() when "regs && kexec_should_crash()" is true. But RISC-V not, it can only enter crash system via panic(). However panic() doesn't pass the regs of the real accident scene to crash_kexec(), it caused we can't get accurate backtrace via gdb,
$ riscv64-linux-gnu-gdb vmlinux vmcore Reading symbols from vmlinux... [New LWP 95] #0 console_unlock () at kernel/printk/printk.c:2557 2557 if (do_cond_resched) (gdb) bt #0 console_unlock () at kernel/printk/printk.c:2557 #1 0x0000000000000000 in ?? ()
With the patch we can get the accurate backtrace,
$ riscv64-linux-gnu-gdb vmlinux vmcore Reading symbols from vmlinux... [New LWP 95] #0 0xffffffe00063a4e0 in test_thread (data=<optimized out>) at drivers/test_crash.c:81 81 *(int *)p = 0xdead; (gdb) (gdb) bt #0 0xffffffe00064d5c0 in test_thread (data=<optimized out>) at drivers/test_crash.c:81 #1 0x0000000000000000 in ?? ()
Test code to produce NULL address dereference in test_crash.c,
void *p = NULL; *(int *)p = 0xdead;
--- arch/riscv/kernel/traps.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/riscv/kernel/traps.c +4 -0
@@ -15,6 +15,7 @@#include <linux/mm.h> #include <linux/module.h> #include <linux/irq.h> +#include <linux/kexec.h> #include <asm/processor.h> #include <asm/ptrace.h>
@@ -43,6 +44,9 @@ void die(struct pt_regs *regs, const char *str) ret =notify_die (DIE_OOPS , str, regs,0 , regs->cause,SIGSEGV ); +if (regs &&kexec_should_crash (current)) +crash_kexec (regs); +bust_spinlocks (0 );add_taint (TAINT_DIE ,LOCKDEP_NOW_UNRELIABLE );spin_unlock_irq (&die_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 140/158 watchdog: export lockup_detector_reconfigure
In reply to Greg Kroah-HartmanFrom: Laurent Dufour <[email protected]>
[ Upstream commit 7c56a8733d0a2a4be2438a7512566e5ce552fccf ]
In some circumstances it may be interesting to reconfigure the watchdog from inside the kernel.
On PowerPC, this may helpful before and after a LPAR migration (LPM) is initiated, because it implies some latencies, watchdog, and especially NMI watchdog is expected to be triggered during this operation. Reconfiguring the watchdog with a factor, would prevent it to happen too frequently during LPM.
Rename lockup_detector_reconfigure() as __lockup_detector_reconfigure() and create a new function lockup_detector_reconfigure() calling __lockup_detector_reconfigure() under the protection of watchdog_mutex.
--- include/linux/nmi.h | 2 ++ kernel/watchdog.c | 21 ++++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-)
include/linux/nmi.h +2 -0
@@ -122,6 +122,8 @@ int watchdog_nmi_probe(void);int watchdog_nmi_enable (unsigned int cpu);void watchdog_nmi_disable (unsigned int cpu); +void lockup_detector_reconfigure (void ); +/** * touch_nmi_watchdog - restart NMI watchdog timeout. *
kernel/watchdog.c +16 -5
@@ -518,7 +518,7 @@ int lockup_detector_offline_cpu(unsigned int cpu)return 0 ; } -static void lockup_detector_reconfigure (void ) +static void __lockup_detector_reconfigure (void ) {cpus_read_lock ();watchdog_nmi_stop ();
@@ -538,6 +538,13 @@ static void lockup_detector_reconfigure(void)__lockup_detector_cleanup (); } +void lockup_detector_reconfigure (void ) +{ +mutex_lock (&watchdog_mutex); +__lockup_detector_reconfigure (); +mutex_unlock (&watchdog_mutex); +} +/* * Create the watchdog thread infrastructure and configure the detector(s). *
@@ -558,13 +565,13 @@ static __init void lockup_detector_setup(void)return ;mutex_lock (&watchdog_mutex); -lockup_detector_reconfigure (); +__lockup_detector_reconfigure (); softlockup_initialized = true; mutex_unlock(&watchdog_mutex); }#else /* CONFIG_SOFTLOCKUP_DETECTOR */ -static void lockup_detector_reconfigure (void ) +static void __lockup_detector_reconfigure (void ) {cpus_read_lock ();watchdog_nmi_stop ();
@@ -572,9 +579,13 @@ static void lockup_detector_reconfigure(void)watchdog_nmi_start (); cpus_read_unlock(); } +void lockup_detector_reconfigure (void ) +{ +__lockup_detector_reconfigure (); +}static inline void lockup_detector_setup (void ) { -lockup_detector_reconfigure (); +__lockup_detector_reconfigure (); }#endif /* !CONFIG_SOFTLOCKUP_DETECTOR */
@@ -614,7 +625,7 @@ static void proc_watchdog_update(void) {/* Remove impossible cpus to keep sysctl output clean. */ cpumask_and (&watchdog_cpumask, &watchdog_cpumask, cpu_possible_mask); -lockup_detector_reconfigure (); +__lockup_detector_reconfigure (); }/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 141/158 powerpc/32: Dont always pass -mcpu=powerpc to the compiler
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 446cda1b21d9a6b3697fe399c6a3a00ff4a285f5 ]
Since commit 4bf4f42a2feb ("powerpc/kbuild: Set default generic machine type for 32-bit compile"), when building a 32 bits kernel with a bi-arch version of GCC, or when building a book3s/32 kernel, the option -mcpu=powerpc is passed to GCC at all time, relying on it being eventually overriden by a subsequent -mcpu=xxxx.
But when building the same kernel with a 32 bits only version of GCC, that is not done, relying on gcc being built with the expected default CPU.
This logic has two problems. First, it is a bit fragile to rely on whether the GCC version is bi-arch or not, because today we can have bi-arch versions of GCC configured with a 32 bits default. Second, there are some versions of GCC which don't support -mcpu=powerpc, for instance for e500 SPE-only versions.
So, stop relying on this approximative logic and allow the user to decide whether he/she wants to use the toolchain's default CPU or if he/she wants to set one, and allow only possible CPUs based on the selected target.
--- arch/powerpc/Makefile | 26 +------------------------- arch/powerpc/platforms/Kconfig.cputype | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 28 deletions(-)
arch/powerpc/Makefile +1 -25
@@ -17,23 +17,6 @@ HAS_BIARCH := $(call cc-option-yn, -m32) # Set default 32 bits cross compilers for vdso and boot wrapper CROSS32_COMPILE ?= -ifeq ($(HAS_BIARCH),y) -ifeq ($(CROSS32_COMPILE),) -ifdef CONFIG_PPC32 -# These options will be overridden by any -mcpu option that the CPU -# or platform code sets later on the command line, but they are needed -# to set a sane 32-bit cpu target for the 64-bit cross compiler which -# may default to the wrong ISA. -KBUILD_CFLAGS += -mcpu=powerpc -KBUILD_AFLAGS += -mcpu=powerpc -endif -endif -endif - -ifdef CONFIG_PPC_BOOK3S_32 -KBUILD_CFLAGS += -mcpu=powerpc -endif - # If we're on a ppc/ppc64/ppc64le machine use that defconfig, otherwise just use # ppc64_defconfig because we have nothing better to go on. uname := $(shell uname -m)
@@ -190,6 +173,7 @@ endif endif CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU)) +AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU)) # Altivec option not allowed with e500mc64 in GCC. ifdef CONFIG_ALTIVEC
@@ -200,14 +184,6 @@ endif CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU) CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU)) -ifdef CONFIG_PPC32 -ifdef CONFIG_PPC_E500MC -CFLAGS-y += $(call cc-option,-mcpu=e500mc,-mcpu=powerpc) -else -CFLAGS-$(CONFIG_E500) += $(call cc-option,-mcpu=8540 -msoft-float,-mcpu=powerpc) -endif -endif - asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1) KBUILD_CPPFLAGS += -I $(srctree)/arch/$(ARCH) $(asinstr)
arch/powerpc/platforms/Kconfig.cputype +18 -3
@@ -119,9 +119,9 @@ config GENERIC_CPU depends on PPC64 && CPU_LITTLE_ENDIAN select ARCH_HAS_FAST_MULTIPLIER -config GENERIC_CPU +config POWERPC_CPU bool "Generic 32 bits powerpc" - depends on PPC32 && !PPC_8xx + depends on PPC32 && !PPC_8xx && !PPC_85xx config CELL_CPU bool "Cell Broadband Engine"
@@ -175,11 +175,23 @@ config G4_CPU depends on PPC_BOOK3S_32 select ALTIVEC +config E500_CPU + bool "e500 (8540)" + depends on PPC_85xx && !PPC_E500MC + +config E500MC_CPU + bool "e500mc" + depends on PPC_85xx && PPC_E500MC + +config TOOLCHAIN_DEFAULT_CPU + bool "Rely on the toolchain's implicit default CPU" + depends on PPC32 + endchoice config TARGET_CPU_BOOL bool - default !GENERIC_CPU + default !GENERIC_CPU && !TOOLCHAIN_DEFAULT_CPU config TARGET_CPU string
@@ -194,6 +206,9 @@ config TARGET_CPU default "e300c2" if E300C2_CPU default "e300c3" if E300C3_CPU default "G4" if G4_CPU + default "8540" if E500_CPU + default "e500mc" if E500MC_CPU + default "powerpc" if POWERPC_CPU config PPC_BOOK3S def_bool y
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 142/158 ALSA: core: Add async signal helpers
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit ef34a0ae7a2654bc9e58675e36898217fb2799d8 ]
Currently the call of kill_fasync() from an interrupt handler might lead to potential spin deadlocks, as spotted by syzkaller. Unfortunately, it's not so trivial to fix this lock chain as it's involved with the tasklist_lock that is touched in allover places.
As a temporary workaround, this patch provides the way to defer the async signal notification in a work. The new helper functions, snd_fasync_helper() and snd_kill_faync() are replacements for fasync_helper() and kill_fasync(), respectively. In addition, snd_fasync_free() needs to be called at the destructor of the relevant file object.
--- include/sound/core.h | 8 ++++ sound/core/misc.c | 94 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+)
include/sound/core.h +8 -0
@@ -446,4 +446,12 @@ snd_pci_quirk_lookup_id(u16 vendor, u16 device, }#endif +/* async signal helpers */ +struct snd_fasync ; + +int snd_fasync_helper (int fd,struct file *file,int on, +struct snd_fasync **fasyncp); +void snd_kill_fasync (struct snd_fasync *fasync,int signal,int poll); +void snd_fasync_free (struct snd_fasync *fasync); +#endif /* __SOUND_CORE_H */
sound/core/misc.c +94 -0
103 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 143/158 ALSA: timer: Use deferred fasync helper
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 95cc637c1afd83fb7dd3d7c8a53710488f4caf9c ]
For avoiding the potential deadlock via kill_fasync() call, use the new fasync helpers to defer the invocation from PCI API. Note that it's merely a workaround.
--- sound/core/timer.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
sound/core/timer.c +6 -5
@@ -83,7 +83,7 @@ struct snd_timer_user {unsigned int filter;struct timespec64 tstamp;/* trigger tstamp */ wait_queue_head_t qchange_sleep; -struct fasync_struct *fasync; +struct snd_fasync *fasync;struct mutex ioctl_lock; };
@@ -1345,7 +1345,7 @@ static void snd_timer_user_interrupt(struct snd_timer_instance *timeri, } __wake:spin_unlock (&tu->qlock); -kill_fasync (&tu->fasync,SIGIO ,POLL_IN ); +snd_kill_fasync (tu->fasync,SIGIO ,POLL_IN );wake_up (&tu->qchange_sleep); }
@@ -1383,7 +1383,7 @@ static void snd_timer_user_ccallback(struct snd_timer_instance *timeri,spin_lock_irqsave (&tu->qlock, flags);snd_timer_user_append_to_tqueue (tu, &r1);spin_unlock_irqrestore (&tu->qlock, flags); -kill_fasync (&tu->fasync,SIGIO ,POLL_IN ); +snd_kill_fasync (tu->fasync,SIGIO ,POLL_IN );wake_up (&tu->qchange_sleep); }
@@ -1453,7 +1453,7 @@ static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri,spin_unlock (&tu->qlock);if (append ==0 )return ; -kill_fasync (&tu->fasync,SIGIO ,POLL_IN ); +snd_kill_fasync (tu->fasync,SIGIO ,POLL_IN );wake_up (&tu->qchange_sleep); }
@@ -1521,6 +1521,7 @@ static int snd_timer_user_release(struct inode *inode, struct file *file)snd_timer_instance_free (tu->timeri); }mutex_unlock (&tu->ioctl_lock); +snd_fasync_free (tu->fasync);kfree (tu->queue);kfree (tu->tqueue);kfree (tu);
@@ -2135,7 +2136,7 @@ static int snd_timer_user_fasync(int fd, struct file * file, int on)struct snd_timer_user *tu; tu = file->private_data; -return fasync_helper (fd, file, on, &tu->fasync); +return snd_fasync_helper (fd, file, on, &tu->fasync); } static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 144/158 ALSA: control: Use deferred fasync helper
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 4a971e84a7ae10a38d875cd2d4e487c8d1682ca3 ]
For avoiding the potential deadlock via kill_fasync() call, use the new fasync helpers to defer the invocation from the control API. Note that it's merely a workaround.
Another note: although we haven't received reports about the deadlock with the control API, the deadlock is still potentially possible, and it's better to align the behavior with other core APIs (PCM and timer); so let's move altogether.
--- include/sound/control.h | 2 +- sound/core/control.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-)
include/sound/control.h +1 -1
@@ -103,7 +103,7 @@ struct snd_ctl_file {int preferred_subdevice[SND_CTL_SUBDEV_ITEMS ];wait_queue_head_t change_sleep;spinlock_t read_lock; -struct fasync_struct *fasync; +struct snd_fasync *fasync;int subscribed;/* read interface is activated */ struct list_head events;/* waiting events for read */ };
sound/core/control.c +4 -3
@@ -121,6 +121,7 @@ static int snd_ctl_release(struct inode *inode, struct file *file)if (control->vd[idx].owner == ctl) control->vd[idx].owner =NULL ;up_write (&card->controls_rwsem); +snd_fasync_free (ctl->fasync);snd_ctl_empty_read_queue (ctl);put_pid (ctl->pid);kfree (ctl);
@@ -175,7 +176,7 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask, _found:wake_up (&ctl->change_sleep);spin_unlock (&ctl->read_lock); -kill_fasync (&ctl->fasync,SIGIO ,POLL_IN ); +snd_kill_fasync (ctl->fasync,SIGIO ,POLL_IN ); }read_unlock_irqrestore (&card->ctl_files_rwlock, flags); }
@@ -1941,7 +1942,7 @@ static int snd_ctl_fasync(int fd, struct file * file, int on)struct snd_ctl_file *ctl; ctl = file->private_data; -return fasync_helper (fd, file, on, &ctl->fasync); +return snd_fasync_helper (fd, file, on, &ctl->fasync); }/* return the preferred subdevice number if already assigned;
@@ -2015,7 +2016,7 @@ static int snd_ctl_dev_disconnect(struct snd_device *device)read_lock_irqsave (&card->ctl_files_rwlock, flags);list_for_each_entry (ctl, &card->ctl_files, list) {wake_up (&ctl->change_sleep); -kill_fasync (&ctl->fasync,SIGIO ,POLL_ERR ); +snd_kill_fasync (ctl->fasync,SIGIO ,POLL_ERR ); }read_unlock_irqrestore (&card->ctl_files_rwlock, flags);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 145/158 f2fs: fix to avoid use f2fs_bug_on() in f2fs_new_node_page()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit 141170b759e03958f296033bb7001be62d1d363b ]
As Dipanjan Das <[email protected]> reported, syzkaller found a f2fs bug as below:
RIP: 0010:f2fs_new_node_page+0x19ac/0x1fc0 fs/f2fs/node.c:1295 Call Trace: write_all_xattrs fs/f2fs/xattr.c:487 [inline] __f2fs_setxattr+0xe76/0x2e10 fs/f2fs/xattr.c:743 f2fs_setxattr+0x233/0xab0 fs/f2fs/xattr.c:790 f2fs_xattr_generic_set+0x133/0x170 fs/f2fs/xattr.c:86 __vfs_setxattr+0x115/0x180 fs/xattr.c:182 __vfs_setxattr_noperm+0x125/0x5f0 fs/xattr.c:216 __vfs_setxattr_locked+0x1cf/0x260 fs/xattr.c:277 vfs_setxattr+0x13f/0x330 fs/xattr.c:303 setxattr+0x146/0x160 fs/xattr.c:611 path_setxattr+0x1a7/0x1d0 fs/xattr.c:630 __do_sys_lsetxattr fs/xattr.c:653 [inline] __se_sys_lsetxattr fs/xattr.c:649 [inline] __x64_sys_lsetxattr+0xbd/0x150 fs/xattr.c:649 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x46/0xb0
NAT entry and nat bitmap can be inconsistent, e.g. one nid is free in nat bitmap, and blkaddr in its NAT entry is not NULL_ADDR, it may trigger BUG_ON() in f2fs_new_node_page(), fix it.
--- fs/f2fs/node.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/f2fs/node.c +5 -1
@@ -1238,7 +1238,11 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs)dec_valid_node_count (sbi, dn->inode, !ofs); goto fail; } -f2fs_bug_on (sbi, new_ni.blk_addr !=NULL_ADDR ); +if (unlikely (new_ni.blk_addr !=NULL_ADDR )) { + err = -EFSCORRUPTED ; +set_sbi_flag (sbi,SBI_NEED_FSCK ); + goto fail; + }#endif new_ni.nid = dn->nid; new_ni.ino = dn->inode->i_ino;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 146/158 f2fs: fix to do sanity check on segment type in build_sit_entries()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit 09beadf289d6e300553e60d6e76f13c0427ecab3 ]
As Wenqing Liu <[email protected]> reported in bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=216285
RIP: 0010:memcpy_erms+0x6/0x10 f2fs_update_meta_page+0x84/0x570 [f2fs] change_curseg.constprop.0+0x159/0xbd0 [f2fs] f2fs_do_replace_block+0x5c7/0x18a0 [f2fs] f2fs_replace_block+0xeb/0x180 [f2fs] recover_data+0x1abd/0x6f50 [f2fs] f2fs_recover_fsync_data+0x12ce/0x3250 [f2fs] f2fs_fill_super+0x4459/0x6190 [f2fs] mount_bdev+0x2cf/0x3b0 legacy_get_tree+0xed/0x1d0 vfs_get_tree+0x81/0x2b0 path_mount+0x47e/0x19d0 do_mount+0xce/0xf0 __x64_sys_mount+0x12c/0x1a0 do_syscall_64+0x38/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd
The root cause is segment type is invalid, so in f2fs_do_replace_block(), f2fs accesses f2fs_sm_info::curseg_array with out-of-range segment type, result in accessing invalid curseg->sum_blk during memcpy in f2fs_update_meta_page(). Fix this by adding sanity check on segment type in build_sit_entries().
--- fs/f2fs/segment.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
fs/f2fs/segment.c +13 -0
@@ -4449,6 +4449,12 @@ static int build_sit_entries(struct f2fs_sb_info *sbi)return err;seg_info_from_raw_sit (se, &sit); +if (se->type >=NR_PERSISTENT_LOG ) { +f2fs_err (sbi,"Invalid segment type: %u, segno: %u" , + se->type, start); +return -EFSCORRUPTED ; + } + sit_valid_blocks[SE_PAGETYPE (se)] += se->valid_blocks;/* build discard map only one time */
@@ -4495,6 +4501,13 @@ static int build_sit_entries(struct f2fs_sb_info *sbi)break ;seg_info_from_raw_sit (se, &sit); +if (se->type >=NR_PERSISTENT_LOG ) { +f2fs_err (sbi,"Invalid segment type: %u, segno: %u" , + se->type, start); + err = -EFSCORRUPTED ; +break ; + } + sit_valid_blocks[SE_PAGETYPE (se)] += se->valid_blocks;if (is_set_ckpt_flags (sbi,CP_TRIMMED_FLAG )) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 147/158 smb3: check xattr value length earlier
In reply to Greg Kroah-HartmanFrom: Steve French <[email protected]>
[ Upstream commit 5fa2cffba0b82336a2244d941322eb1627ff787b ]
Coverity complains about assigning a pointer based on value length before checking that value length goes beyond the end of the SMB. Although this is even more unlikely as value length is a single byte, and the pointer is not dereferenced until laterm, it is clearer to check the lengths first.
Addresses-Coverity: 1467704 ("Speculative execution data leak")
--- fs/cifs/smb2ops.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/cifs/smb2ops.c +3 -2
@@ -1000,9 +1000,7 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size,size_t name_len, value_len, user_name_len;while (src_size >0 ) { - name = &src->ea_data[0 ]; name_len = (size_t )src->ea_name_length; - value = &src->ea_data[src->ea_name_length +1 ]; value_len = (size_t )le16_to_cpu (src->ea_value_length);if (name_len ==0 )
@@ -1014,6 +1012,9 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size, goto out; } + name = &src->ea_data[0 ]; + value = &src->ea_data[src->ea_name_length +1 ]; +if (ea_name) {if (ea_name_len == name_len &&memcmp (ea_name, name, name_len) ==0 ) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 148/158 powerpc/64: Init jump labels before parse_early_param()
In reply to Greg Kroah-HartmanFrom: Zhouyi Zhou <[email protected]>
[ Upstream commit ca829e05d3d4f728810cc5e4b468d9ebc7745eb3 ]
On 64-bit, calling jump_label_init() in setup_feature_keys() is too late because static keys may be used in subroutines of parse_early_param() which is again subroutine of early_init_devtree().
For example booting with "threadirqs":
static_key_enable_cpuslocked(): static key '0xc000000002953260' used before call to jump_label_init()
WARNING: CPU: 0 PID: 0 at kernel/jump_label.c:166 static_key_enable_cpuslocked+0xfc/0x120
...
NIP static_key_enable_cpuslocked+0xfc/0x120
LR static_key_enable_cpuslocked+0xf8/0x120
Call Trace:
static_key_enable_cpuslocked+0xf8/0x120 (unreliable)
static_key_enable+0x30/0x50
setup_forced_irqthreads+0x28/0x40
do_early_param+0xa0/0x108
parse_args+0x290/0x4e0
parse_early_options+0x48/0x5c
parse_early_param+0x58/0x84
early_init_devtree+0xd4/0x518
early_setup+0xb4/0x214So call jump_label_init() just before parse_early_param() in early_init_devtree().
--- arch/powerpc/kernel/prom.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/powerpc/kernel/prom.c +7 -0
@@ -750,6 +750,13 @@ void __init early_init_devtree(void *params)of_scan_flat_dt (early_init_dt_scan_root,NULL );of_scan_flat_dt (early_init_dt_scan_memory_ppc,NULL ); +/* +* As generic code authors expect to be able to use static keys +* in early_param() handlers, we initialize the static keys just +* before parsing early params (it's fine to call jump_label_init() +* more than once). +*/ +jump_label_init ();parse_early_param ();/* make sure we've parsed cmdline for mem= before this */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 149/158 video: fbdev: i740fb: Check the argument of i740_calc_vclk()
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 40bf722f8064f50200b8c4f8946cd625b441dda9 ]
Since the user can control the arguments of the ioctl() from the user space, under special arguments that may result in a divide-by-zero bug.
If the user provides an improper 'pixclock' value that makes the argumet of i740_calc_vclk() less than 'I740_RFREQ_FIX', it will cause a divide-by-zero bug in:
drivers/video/fbdev/i740fb.c:353 p_best = min(15, ilog2(I740_MAX_VCO_FREQ / (freq / I740_RFREQ_FIX)));
The following log can reveal it:
divide error: 0000 [#1] PREEMPT SMP KASAN PTI
RIP: 0010:i740_calc_vclk drivers/video/fbdev/i740fb.c:353 [inline] RIP: 0010:i740fb_decode_var drivers/video/fbdev/i740fb.c:646 [inline] RIP: 0010:i740fb_set_par+0x163f/0x3b70 drivers/video/fbdev/i740fb.c:742 Call Trace: fb_set_var+0x604/0xeb0 drivers/video/fbdev/core/fbmem.c:1034 do_fb_ioctl+0x234/0x670 drivers/video/fbdev/core/fbmem.c:1110 fb_ioctl+0xdd/0x130 drivers/video/fbdev/core/fbmem.c:1189
Fix this by checking the argument of i740_calc_vclk() first.
--- drivers/video/fbdev/i740fb.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/video/fbdev/i740fb.c +7 -2
@@ -400,7 +400,7 @@ static int i740fb_decode_var(const struct fb_var_screeninfo *var,u32 xres, right, hslen, left, xtotal;u32 yres, lower, vslen, upper, ytotal;u32 vxres, xoffset, vyres, yoffset; -u32 bpp, base, dacspeed24, mem; +u32 bpp, base, dacspeed24, mem, freq;u8 r7;int i;
@@ -643,7 +643,12 @@ static int i740fb_decode_var(const struct fb_var_screeninfo *var, par->atc[VGA_ATC_OVERSCAN ] =0 ;/* Calculate VCLK that most closely matches the requested dot clock */ -i740_calc_vclk ((((u32 )1e9 ) / var->pixclock) * (u32)(1e3 ), par); + freq = (((u32 )1e9 ) / var->pixclock) * (u32)(1e3 ); +if (freq <I740_RFREQ_FIX ) { +fb_dbg (info,"invalid pixclock\n" ); + freq =I740_RFREQ_FIX ; + } +i740_calc_vclk (freq, par);/* Since we program the clocks ourselves, always use VCLK2. */ par->misc |=0x0C ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 150/158 MIPS: tlbex: Explicitly compare _PAGE_NO_EXEC against 0
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 74de14fe05dd6b151d73cb0c73c8ec874cbdcde6 ]
When CONFIG_XPA is enabled, Clang warns:
arch/mips/mm/tlbex.c:629:24: error: converting the result of '<<' to a boolean; did you mean '(1 << _PAGE_NO_EXEC_SHIFT) != 0'? [-Werror,-Wint-in-bool-context]
if (cpu_has_rixi && !!_PAGE_NO_EXEC) {
^
arch/mips/include/asm/pgtable-bits.h:174:28: note: expanded from macro '_PAGE_NO_EXEC'
# define _PAGE_NO_EXEC (1 << _PAGE_NO_EXEC_SHIFT)
^
arch/mips/mm/tlbex.c:2568:24: error: converting the result of '<<' to a boolean; did you mean '(1 << _PAGE_NO_EXEC_SHIFT) != 0'? [-Werror,-Wint-in-bool-context]
if (!cpu_has_rixi || !_PAGE_NO_EXEC) {
^
arch/mips/include/asm/pgtable-bits.h:174:28: note: expanded from macro '_PAGE_NO_EXEC'
# define _PAGE_NO_EXEC (1 << _PAGE_NO_EXEC_SHIFT)
^
2 errors generated._PAGE_NO_EXEC can be '0' or '1 << _PAGE_NO_EXEC_SHIFT' depending on the build and runtime configuration, which is what the negation operators are trying to convey. To silence the warning, explicitly compare against 0 so the result of the '<<' operator is not implicitly converted to a boolean.
According to its documentation, GCC enables -Wint-in-bool-context with -Wall but this warning is not visible when building the same configuration with GCC. It appears GCC only warns when compiling C++, not C, although the documentation makes no note of this:
https://godbolt.org/z/x39q3brxf
--- arch/mips/mm/tlbex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/mm/tlbex.c +2 -2
@@ -633,7 +633,7 @@ static __maybe_unused void build_convert_pte_to_entrylo(u32 **p,return ; } -if (cpu_has_rixi && !!_PAGE_NO_EXEC) { +if (cpu_has_rixi && _PAGE_NO_EXEC !=0 ) {if (fill_includes_sw_bits) {UASM_i_ROTR (p, reg, reg,ilog2 (_PAGE_GLOBAL)); }else {
@@ -2572,7 +2572,7 @@ static void check_pabits(void)unsigned long entry;unsigned pabits, fillbits; -if (!cpu_has_rixi || !_PAGE_NO_EXEC) { +if (!cpu_has_rixi || _PAGE_NO_EXEC ==0 ) {/* * We'll only be making use of the fact that we can rotate bits * into the fill if the CPU supports RIXI, so don't bother
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 151/158 netfilter: nftables: fix a warning message in nf_tables_commit_audit_collect()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit dadf33c9f6b5f694e842d224a4d071f59ac665ee upstream.
The first argument of a WARN_ONCE() is a condition. This WARN_ONCE() will only print the table name, and is potentially problematic if the table name has a %s in it.
--- net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +1 -1
@@ -7828,7 +7828,7 @@ static void nf_tables_commit_audit_colleif (adp->table == table) goto found; } -WARN_ONCE ("table=%s not expected in commit list" , table->name); +WARN_ONCE (1 ,"table=%s not expected in commit list" , table->name);return ; found: adp->entries++;
Greg Kroah-Hartman
maintainerPATCH 152/158 netfilter: nf_tables: fix audit memory leak in nf_tables_commit
In reply to Greg Kroah-HartmanFrom: Dongliang Mu <[email protected]>
commit cfbe3650dd3ef2ea9a4420ca89d9a4df98af3fb6 upstream.
In nf_tables_commit, if nf_tables_commit_audit_alloc fails, it does not free the adp variable.
Fix this by adding nf_tables_commit_audit_free which frees the linked list with the head node adl.
backtrace:
kmalloc include/linux/slab.h:591 [inline] kzalloc include/linux/slab.h:721 [inline] nf_tables_commit_audit_alloc net/netfilter/nf_tables_api.c:8439 [inline] nf_tables_commit+0x16e/0x1760 net/netfilter/nf_tables_api.c:8508 nfnetlink_rcv_batch+0x512/0xa80 net/netfilter/nfnetlink.c:562 nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:634 [inline] nfnetlink_rcv+0x1fa/0x220 net/netfilter/nfnetlink.c:652 netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline] netlink_unicast+0x2c7/0x3e0 net/netlink/af_netlink.c:1340 netlink_sendmsg+0x36b/0x6b0 net/netlink/af_netlink.c:1929 sock_sendmsg_nosec net/socket.c:702 [inline] sock_sendmsg+0x56/0x80 net/socket.c:722
--- net/netfilter/nf_tables_api.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
net/netfilter/nf_tables_api.c +12 -0
@@ -7819,6 +7819,16 @@ static int nf_tables_commit_audit_alloc(return 0 ; } +static void nf_tables_commit_audit_free (struct list_head *adl) +{ +struct nft_audit_data *adp, *adn; + +list_for_each_entry_safe (adp, adn, adl, list) { +list_del (&adp->list); +kfree (adp); + } +} +static void nf_tables_commit_audit_collect (struct list_head *adl,struct nft_table *table,u32 op) {
@@ -7882,6 +7892,7 @@ static int nf_tables_commit(struct net * ret =nf_tables_commit_audit_alloc (&adl, trans->ctx.table);if (ret) {nf_tables_commit_chain_prepare_cancel (net); +nf_tables_commit_audit_free (&adl);return ret; } if (trans->msg_type == NFT_MSG_NEWRULE ||
@@ -7891,6 +7902,7 @@ static int nf_tables_commit(struct net * ret =nf_tables_commit_chain_prepare (net, chain);if (ret <0 ) {nf_tables_commit_chain_prepare_cancel (net); +nf_tables_commit_audit_free (&adl);return ret; } }
Greg Kroah-Hartman
maintainerPATCH 153/158 tracing/probes: Have kprobes and uprobes use $COMM too
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (Google) <[email protected]>
commit ab8384442ee512fc0fc72deeb036110843d0e7ff upstream.
Both $comm and $COMM can be used to get current->comm in eprobes and the filtering and histogram logic. Make kprobes and uprobes consistent in this regard and allow both $comm and $COMM as well. Currently kprobes and uprobes only handle $comm, which is inconsistent with the other utilities, and can be confusing to users.
--- kernel/trace/trace_probe.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/trace/trace_probe.c +3 -2
@@ -300,7 +300,7 @@ static int parse_probe_vars(char *arg, c } }else goto inval_var; - }else if (strcmp (arg,"comm" ) ==0 ) { + }else if (strcmp (arg,"comm" ) ==0 ||strcmp (arg,"COMM" ) ==0 ) { code->op =FETCH_OP_COMM ; #ifdef CONFIG_HAVE_FUNCTION_ARG_ACCESS_API } else if (((flags & TPARG_FL_MASK) ==
@@ -595,7 +595,8 @@ static int traceprobe_parse_probe_arg_bo* Since $comm and immediate string can not be dereferred, * we can find those by strcmp. */ -if (strcmp (arg,"$comm" ) ==0 ||strncmp (arg,"\\\"" ,2 ) ==0 ) { +if (strcmp (arg,"$comm" ) ==0 ||strcmp (arg,"$COMM" ) ==0 || +strncmp (arg,"\\\"" ,2 ) ==0 ) {/* The type of $comm must be "string", and not an array. */ if (parg->count || (t &&strcmp (t,"string" )))return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 154/158 can: j1939: j1939_sk_queue_activate_next_locked(): replace WARN_ON_ONCE with netdev_warn_once()
In reply to Greg Kroah-HartmanFrom: Fedor Pchelkin <[email protected]>
commit 8ef49f7f8244424adcf4a546dba4cbbeb0b09c09 upstream.
We should warn user-space that it is doing something wrong when trying to activate sessions with identical parameters but WARN_ON_ONCE macro can not be used here as it serves a different purpose.
So it would be good to replace it with netdev_warn_once() message.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- net/can/j1939/socket.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/can/j1939/socket.c +4 -1
@@ -178,7 +178,10 @@ activate_next:if (!first)return ; -if (WARN_ON_ONCE (j1939_session_activate (first))) { +if (j1939_session_activate (first)) { +netdev_warn_once (first->priv->ndev, +"%s: 0x%p: Identical session is already activated.\n" , + __func__, first); first->err = -EBUSY ; goto activate_next; }else {
Greg Kroah-Hartman
maintainerPATCH 155/158 can: j1939: j1939_session_destroy(): fix memory leak of skbs
In reply to Greg Kroah-HartmanFrom: Fedor Pchelkin <[email protected]>
commit 8c21c54a53ab21842f5050fa090f26b03c0313d6 upstream.
We need to drop skb references taken in j1939_session_skb_queue() when destroying a session in j1939_session_destroy(). Otherwise those skbs would be lost.
Link to Syzkaller info and repro: https://forge.ispras.ru/issues/11743.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
V1: https://lore.kernel.org/all/[email protected]
--- net/can/j1939/transport.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/can/j1939/transport.c +7 -1
@@ -260,6 +260,8 @@ static void __j1939_session_drop(structstatic void j1939_session_destroy (struct j1939_session *session) { +struct sk_buff *skb; +if (session->err)j1939_sk_errqueue (session,J1939_ERRQUEUE_ABORT );else
@@ -270,7 +272,11 @@ static void j1939_session_destroy(structWARN_ON_ONCE (!list_empty (&session->sk_session_queue_entry));WARN_ON_ONCE (!list_empty (&session->active_session_list_entry)); -skb_queue_purge (&session->skb_queue); +while ((skb =skb_dequeue (&session->skb_queue)) !=NULL ) { +/* drop ref taken in j1939_session_skb_queue() */ +skb_unref (skb); +kfree_skb (skb); + }__j1939_session_drop (session);j1939_priv_put (session->priv);kfree (session);
Greg Kroah-Hartman
maintainerPATCH 156/158 PCI/ERR: Retain status from error notification
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
commit 387c72cdd7fb6bef650fb078d0f6ae9682abf631 upstream.
Overwriting the frozen detected status with the result of the link reset loses the NEED_RESET result that drivers are depending on for error handling to report the .slot_reset() callback. Retain this status so that subsequent error handling has the correct flow.
--- drivers/pci/pcie/err.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pci/pcie/err.c +1 -2
@@ -196,8 +196,7 @@ pci_ers_result_t pcie_do_recovery(structpci_dbg (bridge,"broadcast error_detected message\n" );if (state == pci_channel_io_frozen) {pci_walk_bridge (bridge, report_frozen_detected, &status); - status =reset_subordinates (bridge); -if (status !=PCI_ERS_RESULT_RECOVERED ) { +if (reset_subordinates (bridge) !=PCI_ERS_RESULT_RECOVERED ) {pci_warn (bridge,"subordinate device reset failed\n" ); goto failed; }
Greg Kroah-Hartman
maintainerPATCH 157/158 qrtr: Convert qrtr_ports from IDR to XArray
In reply to Greg Kroah-HartmanFrom: Matthew Wilcox (Oracle) <[email protected]>
commit 3cbf7530a163d048a6376cd22fecb9cdcb23b192 upstream.
The XArray interface is easier for this driver to use. Also fixes a bug reported by the improper use of GFP_ATOMIC.
--- net/qrtr/qrtr.c | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-)
net/qrtr/qrtr.c +14 -28
@@ -20,6 +20,8 @@/* auto-bind range */ #define QRTR_MIN_EPH_SOCKET 0x4000#define QRTR_MAX_EPH_SOCKET 0x7fff +#define QRTR_EPH_PORT_RANGE \ + XA_LIMIT(QRTR_MIN_EPH_SOCKET, QRTR_MAX_EPH_SOCKET)/** * struct qrtr_hdr_v1 - (I|R)PCrouter packet header version 1
@@ -106,8 +108,7 @@ static LIST_HEAD(qrtr_all_nodes);static DEFINE_MUTEX (qrtr_node_lock);/* local port allocation management */ -static DEFINE_IDR (qrtr_ports); -static DEFINE_MUTEX (qrtr_port_lock); +static DEFINE_XARRAY_ALLOC (qrtr_ports);/** * struct qrtr_node - endpoint node
@@ -635,7 +636,7 @@ static struct qrtr_sock *qrtr_port_looku port =0 ;rcu_read_lock (); - ipc =idr_find (&qrtr_ports, port); + ipc =xa_load (&qrtr_ports, port);if (ipc)sock_hold (&ipc->sk);rcu_read_unlock ();
@@ -677,9 +678,7 @@ static void qrtr_port_remove(struct qrtr__sock_put (&ipc->sk); -mutex_lock (&qrtr_port_lock); -idr_remove (&qrtr_ports, port); -mutex_unlock (&qrtr_port_lock); +xa_erase (&qrtr_ports, port);/* Ensure that if qrtr_port_lookup() did enter the RCU read section we * wait for it to up increment the refcount */
@@ -698,29 +697,20 @@ static void qrtr_port_remove(struct qrtr*/ static int qrtr_port_assign (struct qrtr_sock *ipc,int *port) { -u32 min_port;int rc; -mutex_lock (&qrtr_port_lock);if (!*port) { - min_port =QRTR_MIN_EPH_SOCKET ; - rc =idr_alloc_u32 (&qrtr_ports, ipc, &min_port,QRTR_MAX_EPH_SOCKET ,GFP_ATOMIC ); -if (!rc) - *port = min_port; + rc =xa_alloc (&qrtr_ports, port, ipc,QRTR_EPH_PORT_RANGE , +GFP_KERNEL ); }else if (*port <QRTR_MIN_EPH_SOCKET && !capable (CAP_NET_ADMIN )) { rc = -EACCES ; }else if (*port ==QRTR_PORT_CTRL ) { - min_port =0 ; - rc =idr_alloc_u32 (&qrtr_ports, ipc, &min_port,0 ,GFP_ATOMIC ); + rc =xa_insert (&qrtr_ports,0 , ipc,GFP_KERNEL ); }else { - min_port = *port; - rc =idr_alloc_u32 (&qrtr_ports, ipc, &min_port, *port,GFP_ATOMIC ); -if (!rc) - *port = min_port; + rc =xa_insert (&qrtr_ports, *port, ipc,GFP_KERNEL ); } -mutex_unlock (&qrtr_port_lock); -if (rc == -ENOSPC ) +if (rc == -EBUSY )return -EADDRINUSE ;else if (rc <0 )return rc;
@@ -734,20 +724,16 @@ static int qrtr_port_assign(struct qrtr_static void qrtr_reset_ports (void ) {struct qrtr_sock *ipc; -int id; - -mutex_lock (&qrtr_port_lock); -idr_for_each_entry (&qrtr_ports, ipc, id) { -/* Don't reset control port */ -if (id ==0 ) -continue ; +unsigned long index; +rcu_read_lock (); +xa_for_each_start (&qrtr_ports, index, ipc,1 ) {sock_hold (&ipc->sk); ipc->sk.sk_err =ENETRESET ; ipc->sk.sk_error_report (&ipc->sk);sock_put (&ipc->sk); } -mutex_unlock (&qrtr_port_lock); +rcu_read_unlock (); }/* Bind socket to address.
Greg Kroah-Hartman
maintainerPATCH 158/158 bpf: Fix KASAN use-after-free Read in compute_effective_progs
In reply to Greg Kroah-HartmanFrom: Tadeusz Struk <[email protected]>
commit 4c46091ee985ae84c60c5e95055d779fcd291d87 upstream.
Syzbot found a Use After Free bug in compute_effective_progs(). The reproducer creates a number of BPF links, and causes a fault injected alloc to fail, while calling bpf_link_detach on them. Link detach triggers the link to be freed by bpf_link_free(), which calls __cgroup_bpf_detach() and update_effective_progs(). If the memory allocation in this function fails, the function restores the pointer to the bpf_cgroup_link on the cgroup list, but the memory gets freed just after it returns. After this, every subsequent call to update_effective_progs() causes this already deallocated pointer to be dereferenced in prog_list_length(), and triggers KASAN UAF error.
To fix this issue don't preserve the pointer to the prog or link in the list, but remove it and replace it with a dummy prog without shrinking the table. The subsequent call to __cgroup_bpf_detach() or __cgroup_bpf_detach() will correct it.
--- kernel/bpf/cgroup.c | 70 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 60 insertions(+), 10 deletions(-)
kernel/bpf/cgroup.c +60 -10
@@ -654,6 +654,60 @@ static struct bpf_prog_list *find_detach }/** +* purge_effective_progs() - After compute_effective_progs fails to alloc new +* cgrp->bpf.inactive table we can recover by +* recomputing the array in place. +* +* @cgrp: The cgroup which descendants to travers +* @prog: A program to detach or NULL +* @link: A link to detach or NULL +* @type: Type of detach operation +*/ +static void purge_effective_progs (struct cgroup *cgrp,struct bpf_prog *prog, +struct bpf_cgroup_link *link, +enum bpf_attach_type type) +{ +struct cgroup_subsys_state *css; +struct bpf_prog_array *progs; +struct bpf_prog_list *pl; +struct list_head *head; +struct cgroup *cg; +int pos; + +/* recompute effective prog array in place */ +css_for_each_descendant_pre (css, &cgrp->self) { + struct cgroup *desc = container_of(css, struct cgroup, self); + +if (percpu_ref_is_zero (&desc->bpf.refcnt)) +continue ; + +/* find position of link or prog in effective progs array */ +for (pos =0 , cg = desc; cg; cg =cgroup_parent (cg)) { +if (pos && !(cg->bpf.flags[type] &BPF_F_ALLOW_MULTI )) +continue ; + + head = &cg->bpf.progs[type]; +list_for_each_entry (pl, head, node) { +if (!prog_list_prog (pl)) +continue ; +if (pl->prog == prog && pl->link == link) + goto found; + pos++; + } + } +found: +BUG_ON (!cg); + progs =rcu_dereference_protected ( + desc->bpf.effective[type], +lockdep_is_held (&cgroup_mutex)); + +/* Remove the program from the array */ +WARN_ONCE (bpf_prog_array_delete_safe_at (progs, pos), +"Failed to purge a prog from array at index %d" , pos); + } +} + +/** * __cgroup_bpf_detach() - Detach the program or link from a cgroup, and * propagate the change to descendants * @cgrp: The cgroup which descendants to traverse
@@ -671,7 +725,6 @@ int __cgroup_bpf_detach(struct cgroup *cu32 flags = cgrp->bpf.flags[type];struct bpf_prog_list *pl;struct bpf_prog *old_prog; -int err;if (prog && link)/* only one of prog or link can be specified */
@@ -686,9 +739,12 @@ int __cgroup_bpf_detach(struct cgroup *c pl->prog =NULL ; pl->link =NULL ; - err =update_effective_progs (cgrp, type); -if (err) - goto cleanup; +if (update_effective_progs (cgrp, type)) { +/* if update effective array failed replace the prog with a dummy prog*/ + pl->prog = old_prog; + pl->link = link; +purge_effective_progs (cgrp, old_prog, link, type); + }/* now can actually delete it from this cgroup list */ list_del (&pl->node);
@@ -700,12 +756,6 @@ int __cgroup_bpf_detach(struct cgroup *cbpf_prog_put (old_prog);static_branch_dec (&cgroup_bpf_enabled_key);return 0 ; - -cleanup: -/* restore back prog or link */ - pl->prog = old_prog; - pl->link = link; -return err; }/* Must be called with cgroup_mutex held to avoid races. */