All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5.10 000/172] 5.10.122-rc1 review
@ 2022-06-13 10:09 Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 001/172] pcmcia: db1xxx_ss: restrict to MIPS_DB1XXX boards Greg Kroah-Hartman
                   ` (172 more replies)
  0 siblings, 173 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, torvalds, akpm, linux, shuah,
	patches, lkft-triage, pavel, jonathanh, f.fainelli,
	sudipm.mukherjee, slade

This is the start of the stable review cycle for the 5.10.122 release.
There are 172 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Wed, 15 Jun 2022 09:47:08 +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.122-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 <gregkh@linuxfoundation.org>
    Linux 5.10.122-rc1

Damien Le Moal <damien.lemoal@opensource.wdc.com>
    zonefs: fix handling of explicit_open option on mount

Johan Hovold <johan+linaro@kernel.org>
    PCI: qcom: Fix pipe clock imbalance

Pascal Hambourg <pascal@plouf.fr.eu.org>
    md/raid0: Ignore RAID0 layout if the second zone has only one device

Stephen Boyd <swboyd@chromium.org>
    interconnect: Restore sync state by ignoring ipa-virt in provider count

Stephen Boyd <swboyd@chromium.org>
    interconnect: qcom: sc7180: Drop IP0 interconnects

Alexey Kardashevskiy <aik@ozlabs.ru>
    powerpc/mm: Switch obsolete dssall to .long

Michael Ellerman <mpe@ellerman.id.au>
    powerpc/32: Fix overread/overwrite of thread_struct via ptrace

Brian Norris <briannorris@chromium.org>
    drm/atomic: Force bridge self-refresh-exit on CRTC switch

Brian Norris <briannorris@chromium.org>
    drm/bridge: analogix_dp: Support PSR-exit to disable transition

Mathias Nyman <mathias.nyman@linux.intel.com>
    Input: bcm5974 - set missing URB_NO_TRANSFER_DMA_MAP urb flag

Olivier Matz <olivier.matz@6wind.com>
    ixgbe: fix unexpected VLAN Rx in promisc mode on VF

Olivier Matz <olivier.matz@6wind.com>
    ixgbe: fix bcast packets Rx on VF after promisc removal

Martin Faltesek <mfaltesek@google.com>
    nfc: st21nfca: fix incorrect sizing calculations in EVT_TRANSACTION

Martin Faltesek <mfaltesek@google.com>
    nfc: st21nfca: fix memory leaks in EVT_TRANSACTION handling

Martin Faltesek <mfaltesek@google.com>
    nfc: st21nfca: fix incorrect validating logic in EVT_TRANSACTION

Tan Tee Min <tee.min.tan@linux.intel.com>
    net: phy: dp83867: retrigger SGMII AN when link change

Adrian Hunter <adrian.hunter@intel.com>
    mmc: block: Fix CQE recovery reset success

Sergey Shtylyov <s.shtylyov@omp.ru>
    ata: libata-transport: fix {dma|pio|xfer}_mode sysfs files

Paulo Alcantara <pc@cjr.nz>
    cifs: fix reconnect on smb3 mount types

Shyam Prasad N <sprasad@microsoft.com>
    cifs: return errors during session setup during reconnects

Cameron Berkenpas <cam@neo-zeon.de>
    ALSA: hda/realtek: Fix for quirk to enable speaker output on the Lenovo Yoga DuetITL 2021

huangwenhui <huangwenhuia@uniontech.com>
    ALSA: hda/conexant - Fix loopback issue with CX20632

Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
    scripts/gdb: change kernel config dumping method

Xie Yongji <xieyongji@bytedance.com>
    vringh: Fix loop descriptors check in the indirect cases

Kees Cook <keescook@chromium.org>
    nodemask: Fix return values to be unsigned

Steve French <stfrench@microsoft.com>
    cifs: version operations for smb20 unneeded when legacy support disabled

Christian Borntraeger <borntraeger@linux.ibm.com>
    s390/gmap: voluntarily schedule during key setting

Yu Kuai <yukuai3@huawei.com>
    nbd: fix io hung while disconnecting device

Yu Kuai <yukuai3@huawei.com>
    nbd: fix race between nbd_alloc_config() and module removal

Yu Kuai <yukuai3@huawei.com>
    nbd: call genl_unregister_family() first in nbd_cleanup()

Peter Zijlstra <peterz@infradead.org>
    jump_label,noinstr: Avoid instrumentation for JUMP_LABEL=n builds

Peter Zijlstra <peterz@infradead.org>
    x86/cpu: Elide KCSAN for cpu_has() and friends

Masahiro Yamada <masahiroy@kernel.org>
    modpost: fix undefined behavior of is_arm_mapping_symbol()

Gong Yuanjun <ruc_gongyuanjun@163.com>
    drm/radeon: fix a possible null pointer dereference

Venky Shankar <vshankar@redhat.com>
    ceph: allow ceph.dir.rctime xattr to be updatable

Michal Kubecek <mkubecek@suse.cz>
    Revert "net: af_key: add check for pfkey_broadcast in function pfkey_process"

Hannes Reinecke <hare@suse.de>
    scsi: myrb: Fix up null pointer access on myrb_cleanup()

Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
    md: protect md_unregister_thread from reentrancy

Liu Xinpeng <liuxp11@chinatelecom.cn>
    watchdog: wdat_wdt: Stop watchdog when rebooting the system

Hao Luo <haoluo@google.com>
    kernfs: Separate kernfs_pr_cont_buf and rename_lock.

John Ogness <john.ogness@linutronix.de>
    serial: msm_serial: disable interrupts in __msm_console_write()

Wang Cheng <wanngchenng@gmail.com>
    staging: rtl8712: fix uninit-value in r871xu_drv_init()

Wang Cheng <wanngchenng@gmail.com>
    staging: rtl8712: fix uninit-value in usb_read8() and friends

Andre Przywara <andre.przywara@arm.com>
    clocksource/drivers/sp804: Avoid error on multiple instances

bumwoo lee <bw365.lee@samsung.com>
    extcon: Modify extcon device to be created after driver data is set

Shuah Khan <skhan@linuxfoundation.org>
    misc: rtsx: set NULL intfdata when probe fails

Marek Szyprowski <m.szyprowski@samsung.com>
    usb: dwc2: gadget: don't reset gadget's driver->bus

Changbin Du <changbin.du@intel.com>
    sysrq: do not omit current cpu when showing backtrace of all active CPUs

Evan Green <evgreen@chromium.org>
    USB: hcd-pci: Fully suspend across freeze/thaw cycle

Duoming Zhou <duoming@zju.edu.cn>
    drivers: usb: host: Fix deadlock in oxu_bus_suspend()

Duoming Zhou <duoming@zju.edu.cn>
    drivers: tty: serial: Fix deadlock in sa1100_set_termios()

Zhen Ni <nizhen@uniontech.com>
    USB: host: isp116x: check return value after calling platform_get_resource()

Duoming Zhou <duoming@zju.edu.cn>
    drivers: staging: rtl8192e: Fix deadlock in rtllib_beacons_stop()

Duoming Zhou <duoming@zju.edu.cn>
    drivers: staging: rtl8192u: Fix deadlock in ieee80211_beacons_stop()

Huang Guobin <huangguobin4@huawei.com>
    tty: Fix a possible resource leak in icom_probe

Zheyu Ma <zheyuma97@gmail.com>
    tty: synclink_gt: Fix null-pointer-dereference in slgt_clean()

Kees Cook <keescook@chromium.org>
    lkdtm/usercopy: Expand size of "out of frame" object

Miquel Raynal <miquel.raynal@bootlin.com>
    iio: st_sensors: Add a local lock for protecting odr

Xiaoke Wang <xkernel.wang@foxmail.com>
    staging: rtl8712: fix a potential memory leak in r871xu_drv_init()

Xiaoke Wang <xkernel.wang@foxmail.com>
    iio: dummy: iio_simple_dummy: check the return value of kstrdup()

Linus Torvalds <torvalds@linux-foundation.org>
    drm: imx: fix compiler warning with gcc-12

Miaoqian Lin <linmq006@gmail.com>
    net: altera: Fix refcount leak in altera_tse_mdio_create

Willem de Bruijn <willemb@google.com>
    ip_gre: test csum_start instead of transport header

Mark Bloch <mbloch@nvidia.com>
    net/mlx5: fs, fail conflicting actions

Feras Daoud <ferasda@nvidia.com>
    net/mlx5: Rearm the FW tracer after each tracer event

Masahiro Yamada <masahiroy@kernel.org>
    net: ipv6: unexport __init-annotated seg6_hmac_init()

Masahiro Yamada <masahiroy@kernel.org>
    net: xfrm: unexport __init-annotated xfrm4_protocol_init()

Masahiro Yamada <masahiroy@kernel.org>
    net: mdio: unexport __init-annotated mdio_bus_init()

Chuck Lever <chuck.lever@oracle.com>
    SUNRPC: Fix the calculation of xdr->end in xdr_get_next_encode_buffer()

Gal Pressman <gal@nvidia.com>
    net/mlx4_en: Fix wrong return value on ioctl EEPROM query failure

Miaoqian Lin <linmq006@gmail.com>
    net: dsa: lantiq_gswip: Fix refcount leak in gswip_gphy_fw_list

Eric Dumazet <edumazet@google.com>
    bpf, arm64: Clear prog->jited_len along prog->jited

Kuniyuki Iwashima <kuniyu@amazon.com>
    af_unix: Fix a data-race in unix_dgram_peer_wake_me().

Masahiro Yamada <masahiroy@kernel.org>
    xen: unexport __init-annotated xen_xlate_map_ballooned_pages()

Pablo Neira Ayuso <pablo@netfilter.org>
    netfilter: nf_tables: bail out early if hardware offload is not supported

Pablo Neira Ayuso <pablo@netfilter.org>
    netfilter: nf_tables: memleak flow rule from commit path

Pablo Neira Ayuso <pablo@netfilter.org>
    netfilter: nf_tables: release new hooks on unsupported flowtable flags

Miaoqian Lin <linmq006@gmail.com>
    ata: pata_octeon_cf: Fix refcount leak in octeon_cf_probe

Pablo Neira Ayuso <pablo@netfilter.org>
    netfilter: nf_tables: always initialize flowtable hook list in transaction

Michael Ellerman <mpe@ellerman.id.au>
    powerpc/kasan: Force thread size increase with KASAN

Pablo Neira Ayuso <pablo@netfilter.org>
    netfilter: nf_tables: delete flowtable hooks via transaction list

Florian Westphal <fw@strlen.de>
    netfilter: nat: really support inet nat without l3 address

Kinglong Mee <kinglongmee@gmail.com>
    xprtrdma: treat all calls not a bcall when bc_serv is NULL

Yang Yingliang <yangyingliang@huawei.com>
    video: fbdev: pxa3xx-gcu: release the resources correctly in pxa3xx_gcu_probe/remove()

Saurabh Sengar <ssengar@linux.microsoft.com>
    video: fbdev: hyperv_fb: Allow resolutions with size > 64 MB for Gen1

Trond Myklebust <trond.myklebust@hammerspace.com>
    NFSv4: Don't hold the layoutget locks across multiple RPC calls

Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
    dmaengine: zynqmp_dma: In struct zynqmp_dma_chan fix desc_size data type

Greg Ungerer <gerg@linux-m68k.org>
    m68knommu: fix undefined reference to `_init_sp'

Greg Ungerer <gerg@linux-m68k.org>
    m68knommu: set ZERO_PAGE() to the allocated zeroed page

Lucas Tanure <tanureal@opensource.cirrus.com>
    i2c: cadence: Increase timeout per message if necessary

Dongliang Mu <mudongliangabcd@gmail.com>
    f2fs: remove WARN_ON in f2fs_is_valid_blkaddr

Yang Yingliang <yangyingliang@huawei.com>
    iommu/arm-smmu-v3: check return value after calling platform_get_resource()

Yang Yingliang <yangyingliang@huawei.com>
    iommu/arm-smmu: fix possible null-ptr-deref in arm_smmu_device_probe()

Mark-PK Tsai <mark-pk.tsai@mediatek.com>
    tracing: Avoid adding tracer option before update_tracer_options

Jun Miao <jun.miao@intel.com>
    tracing: Fix sleeping function called from invalid context on RT kernel

Masami Hiramatsu <mhiramat@kernel.org>
    bootconfig: Make the bootconfig.o as a normal object file

Gong Yuanjun <ruc_gongyuanjun@163.com>
    mips: cpc: Fix refcount leak in mips_cpc_default_phys_base

Dave Jiang <dave.jiang@intel.com>
    dmaengine: idxd: set DMA_INTERRUPT cap bit

Leo Yan <leo.yan@linaro.org>
    perf c2c: Fix sorting in percent_rmt_hitm_cmp()

Saravana Kannan <saravanak@google.com>
    driver core: Fix wait_for_device_probe() & deferred_probe_timeout interaction

Hoang Le <hoang.h.le@dektech.com.au>
    tipc: check attribute length for bearer name

Damien Le Moal <damien.lemoal@opensource.wdc.com>
    scsi: sd: Fix potential NULL pointer dereference

David Howells <dhowells@redhat.com>
    afs: Fix infinite loop found by xfstest generic/676

Haibo Chen <haibo.chen@nxp.com>
    gpio: pca953x: use the correct register address to do regcache sync

Eric Dumazet <edumazet@google.com>
    tcp: tcp_rtx_synack() can be called from process context

Guoju Fang <gjfang@linux.alibaba.com>
    net: sched: add barrier to fix packet stuck problem for lockless qdisc

Maxim Mikityanskiy <maximmi@nvidia.com>
    net/mlx5e: Update netdev features after changing XDP state

Changcheng Liu <jerrliu@nvidia.com>
    net/mlx5: correct ECE offset in query qp output

Leon Romanovsky <leon@kernel.org>
    net/mlx5: Don't use already freed action pointer

Íñigo Huguet <ihuguet@redhat.com>
    sfc: fix wrong tx channel offset with efx_separate_tx_channels

Martin Habets <habetsm.xilinx@gmail.com>
    sfc: fix considering that all channels have TX queues

Yu Xiao <yu.xiao@corigine.com>
    nfp: only report pause frame configuration for physical device

Guangguan Wang <guangguan.wang@linux.alibaba.com>
    net/smc: fixes for converting from "struct smc_cdc_tx_pend **" to "struct smc_wr_tx_pend_priv *"

Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
    riscv: read-only pages should not be writable

Menglong Dong <imagedong@tencent.com>
    bpf: Fix probe read error in ___bpf_prog_run()

Zhihao Cheng <chengzhihao1@huawei.com>
    ubi: ubi_create_volume: Fix use-after-free when volume creation failed

Zhihao Cheng <chengzhihao1@huawei.com>
    ubi: fastmap: Fix high cpu usage of ubi_bgt by making sure wl_pool not empty

Baokun Li <libaokun1@huawei.com>
    jffs2: fix memory leak in jffs2_do_fill_super

Alexander Lobakin <alexandr.lobakin@intel.com>
    modpost: fix removing numeric suffixes

Miaoqian Lin <linmq006@gmail.com>
    net: dsa: mv88e6xxx: Fix refcount leak in mv88e6xxx_mdios_register

Miaoqian Lin <linmq006@gmail.com>
    net: ethernet: ti: am65-cpsw-nuss: Fix some refcount leaks

Dan Carpenter <dan.carpenter@oracle.com>
    net: ethernet: mtk_eth_soc: out of bounds read in mtk_hwlro_get_fdir_entry()

Vincent Ray <vray@kalrayinc.com>
    net: sched: fixed barrier to prevent skbuff sticking in qdisc backlog

Jann Horn <jannh@google.com>
    s390/crypto: fix scatterwalk_unmap() callers in AES-GCM

Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    clocksource/drivers/oxnas-rps: Fix irq_of_parse_and_map() return value

Shengjiu Wang <shengjiu.wang@nxp.com>
    ASoC: fsl_sai: Fix FSL_SAI_xDR/xFR definition

Miaoqian Lin <linmq006@gmail.com>
    watchdog: ts4800_wdt: Fix refcount leak in ts4800_wdt_probe

Miaoqian Lin <linmq006@gmail.com>
    watchdog: rti-wdt: Fix pm_runtime_get_sync() error checking

Zhang Wensheng <zhangwensheng5@huawei.com>
    driver core: fix deadlock in __device_attach

Schspa Shi <schspa@gmail.com>
    driver: base: fix UAF when driver_attach failed

Tony Lindgren <tony@atomide.com>
    bus: ti-sysc: Fix warnings for unbind for serial

Miaoqian Lin <linmq006@gmail.com>
    firmware: dmi-sysfs: Fix memory leak in dmi_sysfs_register_handle

Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    serial: stm32-usart: Correct CSIZE, bits, and parity

Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    serial: st-asc: Sanitize CSIZE and correct PARENB for CS7

Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    serial: sifive: Sanitize CSIZE and c_iflag

Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    serial: sh-sci: Don't allow CS5-6

Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    serial: txx9: Don't allow CS5-6

Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    serial: rda-uart: Don't allow CS5-6

Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    serial: digicolor-usart: Don't allow CS5-6

Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    serial: 8250_fintek: Check SER_RS485_RTS_* only with RS485

John Ogness <john.ogness@linutronix.de>
    serial: meson: acquire port->lock in startup()

Yang Yingliang <yangyingliang@huawei.com>
    rtc: mt6397: check return value after calling platform_get_resource()

Samuel Holland <samuel@sholland.org>
    clocksource/drivers/riscv: Events are stopped during CPU suspend

Miaoqian Lin <linmq006@gmail.com>
    soc: rockchip: Fix refcount leak in rockchip_grf_init

Li Jun <jun.li@nxp.com>
    extcon: ptn5150: Add queue work sync before driver release

Guilherme G. Piccoli <gpiccoli@igalia.com>
    coresight: cpu-debug: Replace mutex with mutex_trylock on panic notifier

Maciej W. Rozycki <macro@orcam.me.uk>
    serial: sifive: Report actual baud base rather than fixed 115200

Johan Hovold <johan+linaro@kernel.org>
    phy: qcom-qmp: fix pipe-clock imbalance on power-on failure

Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    rpmsg: qcom_smd: Fix returning 0 if irq_of_parse_and_map() fails

Cixi Geng <cixi.geng1@unisoc.com>
    iio: adc: sc27xx: Fine tune the scale calibration values

Cixi Geng <cixi.geng1@unisoc.com>
    iio: adc: sc27xx: fix read big scale voltage not right

Miaoqian Lin <linmq006@gmail.com>
    iio: proximity: vl53l0x: Fix return value check of wait_for_completion_timeout

Miaoqian Lin <linmq006@gmail.com>
    iio: adc: stmpe-adc: Fix wait_for_completion_timeout return value check

Bjorn Andersson <bjorn.andersson@linaro.org>
    usb: typec: mux: Check dev_set_name() return value

Xiaomeng Tong <xiam0nd.tong@gmail.com>
    firmware: stratix10-svc: fix a missing check on list iterator

Xiaomeng Tong <xiam0nd.tong@gmail.com>
    misc: fastrpc: fix an incorrect NULL check on list iterator

Zheng Yongjun <zhengyongjun3@huawei.com>
    usb: dwc3: pci: Fix pm_runtime_get_sync() error checking

Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    rpmsg: qcom_smd: Fix irq_of_parse_and_map() return value

Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    pwm: lp3943: Fix duty calculation in case period was clamped

Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    staging: fieldbus: Fix the error handling path in anybuss_host_common_probe()

Miaoqian Lin <linmq006@gmail.com>
    usb: musb: Fix missing of_node_put() in omap2430_probe

Lin Ma <linma@zju.edu.cn>
    USB: storage: karma: fix rio_karma_init return

Niels Dossche <dossche.niels@gmail.com>
    usb: usbip: add missing device lock on tweak configuration cmd

Hangyu Hua <hbh25y@gmail.com>
    usb: usbip: fix a refcount leak in stub_probe()

Sherry Sun <sherry.sun@nxp.com>
    tty: serial: fsl_lpuart: fix potential bug when using both of_alias_get_id and ida_simple_get

Daniel Gibson <daniel@gibson.sh>
    tty: n_tty: Restore EOF push handling behavior

Miaoqian Lin <linmq006@gmail.com>
    tty: serial: owl: Fix missing clk_disable_unprepare() in owl_uart_probe

Wang Weiyang <wangweiyang2@huawei.com>
    tty: goldfish: Use tty_port_destroy() to destroy port

Jiasheng Jiang <jiasheng@iscas.ac.cn>
    lkdtm/bugs: Check for the NULL pointer after calling kmalloc

Alexandru Tachici <alexandru.tachici@analog.com>
    iio: adc: ad7124: Remove shift from scan_type

Jakob Koschel <jakobkoschel@gmail.com>
    staging: greybus: codecs: fix type confusion of list iterator variable

Randy Dunlap <rdunlap@infradead.org>
    pcmcia: db1xxx_ss: restrict to MIPS_DB1XXX boards


-------------

Diffstat:

 Documentation/ABI/testing/sysfs-ata                | 11 ++--
 Makefile                                           |  4 +-
 arch/arm64/net/bpf_jit_comp.c                      |  1 +
 arch/m68k/Kconfig.machine                          |  1 +
 arch/m68k/include/asm/pgtable_no.h                 |  3 +-
 arch/mips/kernel/mips-cpc.c                        |  1 +
 arch/powerpc/Kconfig                               |  1 -
 arch/powerpc/include/asm/ppc-opcode.h              |  2 +
 arch/powerpc/include/asm/thread_info.h             | 10 +++-
 arch/powerpc/kernel/idle.c                         |  2 +-
 arch/powerpc/kernel/idle_6xx.S                     |  2 +-
 arch/powerpc/kernel/l2cr_6xx.S                     |  6 +-
 arch/powerpc/kernel/ptrace/ptrace.c                | 21 +++++--
 arch/powerpc/kernel/swsusp_32.S                    |  2 +-
 arch/powerpc/kernel/swsusp_asm64.S                 |  2 +-
 arch/powerpc/mm/mmu_context.c                      |  2 +-
 arch/powerpc/platforms/powermac/cache.S            |  4 +-
 arch/riscv/kernel/efi.c                            |  2 +-
 arch/s390/crypto/aes_s390.c                        |  4 +-
 arch/s390/mm/gmap.c                                | 14 +++++
 arch/x86/include/asm/cpufeature.h                  |  2 +-
 drivers/ata/libata-transport.c                     |  2 +-
 drivers/ata/pata_octeon_cf.c                       |  3 +
 drivers/base/bus.c                                 |  4 +-
 drivers/base/dd.c                                  | 10 ++--
 drivers/block/nbd.c                                | 37 ++++++++----
 drivers/bus/ti-sysc.c                              |  4 +-
 drivers/clocksource/timer-oxnas-rps.c              |  2 +-
 drivers/clocksource/timer-riscv.c                  |  2 +-
 drivers/clocksource/timer-sp804.c                  | 10 ++--
 drivers/dma/idxd/dma.c                             |  1 +
 drivers/dma/xilinx/zynqmp_dma.c                    |  5 +-
 drivers/extcon/extcon-ptn5150.c                    | 11 ++++
 drivers/extcon/extcon.c                            | 29 +++++----
 drivers/firmware/dmi-sysfs.c                       |  2 +-
 drivers/firmware/stratix10-svc.c                   | 12 ++--
 drivers/gpio/gpio-pca953x.c                        | 19 +++---
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 42 +++++++++++--
 drivers/gpu/drm/drm_atomic_helper.c                | 16 ++++-
 drivers/gpu/drm/imx/ipuv3-crtc.c                   |  2 +-
 drivers/gpu/drm/radeon/radeon_connectors.c         |  4 ++
 drivers/hwtracing/coresight/coresight-cpu-debug.c  |  7 ++-
 drivers/i2c/busses/i2c-cadence.c                   | 12 +++-
 drivers/iio/adc/ad7124.c                           |  1 -
 drivers/iio/adc/sc27xx_adc.c                       | 20 +++----
 drivers/iio/adc/stmpe-adc.c                        |  8 +--
 drivers/iio/common/st_sensors/st_sensors_core.c    | 24 ++++++--
 drivers/iio/dummy/iio_simple_dummy.c               | 20 ++++---
 drivers/iio/proximity/vl53l0x-i2c.c                |  7 +--
 drivers/input/mouse/bcm5974.c                      |  7 ++-
 drivers/interconnect/core.c                        |  7 ++-
 drivers/interconnect/qcom/sc7180.c                 | 21 -------
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c        |  2 +
 drivers/iommu/arm/arm-smmu/arm-smmu.c              |  5 +-
 drivers/md/md.c                                    | 15 +++--
 drivers/md/raid0.c                                 | 31 +++++-----
 drivers/misc/cardreader/rtsx_usb.c                 |  1 +
 drivers/misc/fastrpc.c                             |  9 +--
 drivers/misc/lkdtm/bugs.c                          |  5 ++
 drivers/misc/lkdtm/usercopy.c                      | 17 +++++-
 drivers/mmc/core/block.c                           |  3 +-
 drivers/mtd/ubi/fastmap-wl.c                       | 69 ++++++++++++++--------
 drivers/mtd/ubi/fastmap.c                          | 11 ----
 drivers/mtd/ubi/ubi.h                              |  4 +-
 drivers/mtd/ubi/vmt.c                              |  1 -
 drivers/mtd/ubi/wl.c                               | 19 +++---
 drivers/net/dsa/lantiq_gswip.c                     |  4 +-
 drivers/net/dsa/mv88e6xxx/chip.c                   |  1 +
 drivers/net/ethernet/altera/altera_tse_main.c      |  6 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c     |  8 +--
 drivers/net/ethernet/mediatek/mtk_eth_soc.c        |  3 +
 drivers/net/ethernet/mellanox/mlx4/en_ethtool.c    |  2 +-
 .../ethernet/mellanox/mlx5/core/diag/fw_tracer.c   |  7 ++-
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  |  5 ++
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c  | 35 ++++++++++-
 .../ethernet/mellanox/mlx5/core/steering/fs_dr.c   |  9 ++-
 .../net/ethernet/netronome/nfp/nfp_net_ethtool.c   |  4 +-
 drivers/net/ethernet/sfc/efx_channels.c            |  6 +-
 drivers/net/ethernet/sfc/net_driver.h              |  2 +-
 drivers/net/ethernet/ti/am65-cpsw-nuss.c           |  3 +-
 drivers/net/phy/dp83867.c                          | 29 +++++++++
 drivers/net/phy/mdio_bus.c                         |  1 -
 drivers/nfc/st21nfca/se.c                          | 53 +++++++++--------
 drivers/pci/controller/dwc/pcie-qcom.c             |  6 --
 drivers/pcmcia/Kconfig                             |  2 +-
 drivers/phy/qualcomm/phy-qcom-qmp.c                |  2 +-
 drivers/pwm/pwm-lp3943.c                           |  1 +
 drivers/rpmsg/qcom_smd.c                           |  4 +-
 drivers/rtc/rtc-mt6397.c                           |  2 +
 drivers/scsi/myrb.c                                | 11 +++-
 drivers/scsi/sd.c                                  |  1 -
 drivers/soc/rockchip/grf.c                         |  2 +
 drivers/staging/fieldbus/anybuss/host.c            |  2 +-
 drivers/staging/greybus/audio_codec.c              |  4 +-
 drivers/staging/rtl8192e/rtllib_softmac.c          |  2 +-
 .../staging/rtl8192u/ieee80211/ieee80211_softmac.c |  2 +-
 drivers/staging/rtl8712/os_intfs.c                 |  1 -
 drivers/staging/rtl8712/usb_intf.c                 | 12 ++--
 drivers/staging/rtl8712/usb_ops.c                  | 27 ++++++---
 drivers/tty/goldfish.c                             |  2 +
 drivers/tty/n_tty.c                                | 38 +++++++++++-
 drivers/tty/serial/8250/8250_fintek.c              |  8 +--
 drivers/tty/serial/digicolor-usart.c               |  2 +
 drivers/tty/serial/fsl_lpuart.c                    | 24 ++------
 drivers/tty/serial/icom.c                          |  2 +-
 drivers/tty/serial/meson_uart.c                    | 13 ++++
 drivers/tty/serial/msm_serial.c                    |  5 ++
 drivers/tty/serial/owl-uart.c                      |  1 +
 drivers/tty/serial/rda-uart.c                      |  2 +
 drivers/tty/serial/sa1100.c                        |  4 +-
 drivers/tty/serial/serial_txx9.c                   |  2 +
 drivers/tty/serial/sh-sci.c                        |  6 +-
 drivers/tty/serial/sifive.c                        |  8 ++-
 drivers/tty/serial/st-asc.c                        |  4 ++
 drivers/tty/serial/stm32-usart.c                   | 15 ++++-
 drivers/tty/synclink_gt.c                          |  2 +
 drivers/tty/sysrq.c                                | 13 ++--
 drivers/usb/core/hcd-pci.c                         |  4 +-
 drivers/usb/dwc2/gadget.c                          |  1 -
 drivers/usb/dwc3/dwc3-pci.c                        |  2 +-
 drivers/usb/host/isp116x-hcd.c                     |  6 +-
 drivers/usb/host/oxu210hp-hcd.c                    |  2 +
 drivers/usb/musb/omap2430.c                        |  1 +
 drivers/usb/storage/karma.c                        | 15 ++---
 drivers/usb/typec/mux.c                            | 14 +++--
 drivers/usb/usbip/stub_dev.c                       |  2 +-
 drivers/usb/usbip/stub_rx.c                        |  2 +
 drivers/vhost/vringh.c                             | 10 +++-
 drivers/video/fbdev/hyperv_fb.c                    | 19 +-----
 drivers/video/fbdev/pxa3xx-gcu.c                   | 12 ++--
 drivers/watchdog/rti_wdt.c                         |  2 +-
 drivers/watchdog/ts4800_wdt.c                      |  5 +-
 drivers/watchdog/wdat_wdt.c                        |  1 +
 drivers/xen/xlate_mmu.c                            |  1 -
 fs/afs/dir.c                                       |  5 +-
 fs/ceph/xattr.c                                    | 10 +++-
 fs/cifs/cifsfs.c                                   |  2 +-
 fs/cifs/cifsfs.h                                   |  2 +-
 fs/cifs/cifsglob.h                                 |  4 +-
 fs/cifs/misc.c                                     | 27 +++++----
 fs/cifs/smb2ops.c                                  |  7 ++-
 fs/cifs/smb2pdu.c                                  |  3 +
 fs/f2fs/checkpoint.c                               |  4 +-
 fs/jffs2/fs.c                                      |  1 +
 fs/kernfs/dir.c                                    | 31 ++++++----
 fs/nfs/nfs4proc.c                                  |  4 ++
 fs/zonefs/super.c                                  | 11 ++--
 include/linux/iio/common/st_sensors.h              |  3 +
 include/linux/jump_label.h                         |  4 +-
 include/linux/mlx5/mlx5_ifc.h                      |  5 +-
 include/linux/nodemask.h                           | 38 ++++++------
 include/net/flow_offload.h                         |  1 +
 include/net/netfilter/nf_tables.h                  |  1 -
 include/net/netfilter/nf_tables_offload.h          |  2 +-
 include/net/sch_generic.h                          | 42 +++++--------
 kernel/bpf/core.c                                  | 14 ++---
 kernel/trace/trace.c                               | 13 +++-
 lib/Makefile                                       |  2 +-
 lib/nodemask.c                                     |  4 +-
 net/core/flow_offload.c                            |  6 ++
 net/ipv4/ip_gre.c                                  | 11 ++--
 net/ipv4/tcp_output.c                              |  4 +-
 net/ipv4/xfrm4_protocol.c                          |  1 -
 net/ipv6/seg6_hmac.c                               |  1 -
 net/key/af_key.c                                   | 10 ++--
 net/netfilter/nf_tables_api.c                      | 52 +++++++---------
 net/netfilter/nf_tables_offload.c                  | 23 +++++++-
 net/netfilter/nft_nat.c                            |  3 +-
 net/smc/smc_cdc.c                                  |  2 +-
 net/sunrpc/xdr.c                                   |  6 +-
 net/sunrpc/xprtrdma/rpc_rdma.c                     |  5 ++
 net/tipc/bearer.c                                  |  3 +-
 net/unix/af_unix.c                                 |  2 +-
 scripts/gdb/linux/config.py                        |  6 +-
 scripts/mod/modpost.c                              |  5 +-
 sound/pci/hda/patch_conexant.c                     |  7 +++
 sound/pci/hda/patch_realtek.c                      |  1 +
 sound/soc/fsl/fsl_sai.h                            |  4 +-
 tools/perf/builtin-c2c.c                           |  4 +-
 tools/testing/selftests/netfilter/nft_nat.sh       | 43 ++++++++++++++
 180 files changed, 1022 insertions(+), 566 deletions(-)



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 001/172] pcmcia: db1xxx_ss: restrict to MIPS_DB1XXX boards
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 002/172] staging: greybus: codecs: fix type confusion of list iterator variable Greg Kroah-Hartman
                   ` (171 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Randy Dunlap, kernel test robot,
	Arnd Bergmann, Daniel Vetter, Kees Cook, Thomas Bogendoerfer,
	linux-mips, Manuel Lauss, Dominik Brodowski, Sasha Levin

From: Randy Dunlap <rdunlap@infradead.org>

[ Upstream commit 3928cf08334ed895a31458cbebd8d4ec6d84c080 ]

When the MIPS_ALCHEMY board selection is MIPS_XXS1500 instead of
MIPS_DB1XXX, the PCMCIA driver 'db1xxx_ss' has build errors due
to missing DB1XXX symbols. The PCMCIA driver should be restricted
to MIPS_DB1XXX instead of MIPS_ALCHEMY to fix this build error.

ERROR: modpost: "bcsr_read" [drivers/pcmcia/db1xxx_ss.ko] undefined!
ERROR: modpost: "bcsr_mod" [drivers/pcmcia/db1xxx_ss.ko] undefined!

Fixes: 42a4f17dc356 ("MIPS: Alchemy: remove SOC_AU1X00 in favor of MIPS_ALCHEMY")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Kees Cook <keescook@chromium.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: linux-mips@vger.kernel.org
Acked-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/pcmcia/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig
index 82d10b6661c7..73508fca520c 100644
--- a/drivers/pcmcia/Kconfig
+++ b/drivers/pcmcia/Kconfig
@@ -151,7 +151,7 @@ config TCIC
 
 config PCMCIA_ALCHEMY_DEVBOARD
 	tristate "Alchemy Db/Pb1xxx PCMCIA socket services"
-	depends on MIPS_ALCHEMY && PCMCIA
+	depends on MIPS_DB1XXX && PCMCIA
 	help
 	  Enable this driver of you want PCMCIA support on your Alchemy
 	  Db1000, Db/Pb1100, Db/Pb1500, Db/Pb1550, Db/Pb1200, DB1300
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 002/172] staging: greybus: codecs: fix type confusion of list iterator variable
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 001/172] pcmcia: db1xxx_ss: restrict to MIPS_DB1XXX boards Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 003/172] iio: adc: ad7124: Remove shift from scan_type Greg Kroah-Hartman
                   ` (170 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Vaibhav Agarwal,
	Mark Greer, Jakob Koschel, Sasha Levin

From: Jakob Koschel <jakobkoschel@gmail.com>

[ Upstream commit 84ef256550196bc06e6849a34224c998b45bd557 ]

If the list does not exit early then data == NULL and 'module' does not
point to a valid list element.
Using 'module' in such a case is not valid and was therefore removed.

Fixes: 6dd67645f22c ("greybus: audio: Use single codec driver registration")
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Vaibhav Agarwal <vaibhav.sr@gmail.com>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
Link: https://lore.kernel.org/r/20220321123626.3068639-1-jakobkoschel@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/staging/greybus/audio_codec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
index 42ce6c88ea75..4ed29f852c23 100644
--- a/drivers/staging/greybus/audio_codec.c
+++ b/drivers/staging/greybus/audio_codec.c
@@ -621,8 +621,8 @@ static int gbcodec_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
 			break;
 	}
 	if (!data) {
-		dev_err(dai->dev, "%s:%s DATA connection missing\n",
-			dai->name, module->name);
+		dev_err(dai->dev, "%s DATA connection missing\n",
+			dai->name);
 		mutex_unlock(&codec->lock);
 		return -ENODEV;
 	}
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 003/172] iio: adc: ad7124: Remove shift from scan_type
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 001/172] pcmcia: db1xxx_ss: restrict to MIPS_DB1XXX boards Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 002/172] staging: greybus: codecs: fix type confusion of list iterator variable Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 004/172] lkdtm/bugs: Check for the NULL pointer after calling kmalloc Greg Kroah-Hartman
                   ` (169 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alexandru Tachici, Jonathan Cameron,
	Sasha Levin

From: Alexandru Tachici <alexandru.tachici@analog.com>

[ Upstream commit fe78ccf79b0e29fd6d8dc2e2c3b0dbeda4ce3ad8 ]

The 24 bits data is stored in 32 bits in BE. There
is no need to shift it. This confuses user-space apps.

Fixes: b3af341bbd966 ("iio: adc: Add ad7124 support")
Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Link: https://lore.kernel.org/r/20220322105029.86389-2-alexandru.tachici@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/iio/adc/ad7124.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c
index bd3500995037..19ab7d7251bc 100644
--- a/drivers/iio/adc/ad7124.c
+++ b/drivers/iio/adc/ad7124.c
@@ -170,7 +170,6 @@ static const struct iio_chan_spec ad7124_channel_template = {
 		.sign = 'u',
 		.realbits = 24,
 		.storagebits = 32,
-		.shift = 8,
 		.endianness = IIO_BE,
 	},
 };
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 004/172] lkdtm/bugs: Check for the NULL pointer after calling kmalloc
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 003/172] iio: adc: ad7124: Remove shift from scan_type Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 005/172] tty: goldfish: Use tty_port_destroy() to destroy port Greg Kroah-Hartman
                   ` (168 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jiasheng Jiang, Dan Carpenter,
	Kees Cook, Sasha Levin

From: Jiasheng Jiang <jiasheng@iscas.ac.cn>

[ Upstream commit 4a9800c81d2f34afb66b4b42e0330ae8298019a2 ]

As the possible failure of the kmalloc(), the not_checked and checked
could be NULL pointer.
Therefore, it should be better to check it in order to avoid the
dereference of the NULL pointer.
Also, we need to kfree the 'not_checked' and 'checked' to avoid
the memory leak if fails.
And since it is just a test, it may directly return without error
number.

Fixes: ae2e1aad3e48 ("drivers/misc/lkdtm/bugs.c: add arithmetic overflow and array bounds checks")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220120092936.1874264-1-jiasheng@iscas.ac.cn
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/misc/lkdtm/bugs.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/misc/lkdtm/bugs.c b/drivers/misc/lkdtm/bugs.c
index a337f97b30e2..d39b8139b096 100644
--- a/drivers/misc/lkdtm/bugs.c
+++ b/drivers/misc/lkdtm/bugs.c
@@ -231,6 +231,11 @@ void lkdtm_ARRAY_BOUNDS(void)
 
 	not_checked = kmalloc(sizeof(*not_checked) * 2, GFP_KERNEL);
 	checked = kmalloc(sizeof(*checked) * 2, GFP_KERNEL);
+	if (!not_checked || !checked) {
+		kfree(not_checked);
+		kfree(checked);
+		return;
+	}
 
 	pr_info("Array access within bounds ...\n");
 	/* For both, touch all bytes in the actual member size. */
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 005/172] tty: goldfish: Use tty_port_destroy() to destroy port
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 004/172] lkdtm/bugs: Check for the NULL pointer after calling kmalloc Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 006/172] tty: serial: owl: Fix missing clk_disable_unprepare() in owl_uart_probe Greg Kroah-Hartman
                   ` (167 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jiri Slaby, Wang Weiyang, Sasha Levin

From: Wang Weiyang <wangweiyang2@huawei.com>

[ Upstream commit 507b05063d1b7a1fcb9f7d7c47586fc4f3508f98 ]

In goldfish_tty_probe(), the port initialized through tty_port_init()
should be destroyed in error paths.In goldfish_tty_remove(), qtty->port
also should be destroyed or else might leak resources.

Fix the above by calling tty_port_destroy().

Fixes: 666b7793d4bf ("goldfish: tty driver")
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Wang Weiyang <wangweiyang2@huawei.com>
Link: https://lore.kernel.org/r/20220328115844.86032-1-wangweiyang2@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/goldfish.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/goldfish.c b/drivers/tty/goldfish.c
index c8c5cdfc5e19..abc84d84f638 100644
--- a/drivers/tty/goldfish.c
+++ b/drivers/tty/goldfish.c
@@ -407,6 +407,7 @@ static int goldfish_tty_probe(struct platform_device *pdev)
 err_tty_register_device_failed:
 	free_irq(irq, qtty);
 err_dec_line_count:
+	tty_port_destroy(&qtty->port);
 	goldfish_tty_current_line_count--;
 	if (goldfish_tty_current_line_count == 0)
 		goldfish_tty_delete_driver();
@@ -428,6 +429,7 @@ static int goldfish_tty_remove(struct platform_device *pdev)
 	iounmap(qtty->base);
 	qtty->base = NULL;
 	free_irq(qtty->irq, pdev);
+	tty_port_destroy(&qtty->port);
 	goldfish_tty_current_line_count--;
 	if (goldfish_tty_current_line_count == 0)
 		goldfish_tty_delete_driver();
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 006/172] tty: serial: owl: Fix missing clk_disable_unprepare() in owl_uart_probe
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 005/172] tty: goldfish: Use tty_port_destroy() to destroy port Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 007/172] tty: n_tty: Restore EOF push handling behavior Greg Kroah-Hartman
                   ` (166 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Miaoqian Lin, Sasha Levin

From: Miaoqian Lin <linmq006@gmail.com>

[ Upstream commit bcea0f547ec1a2ee44d429aaf0334633e386e67c ]

Fix the missing clk_disable_unprepare() before return
from owl_uart_probe() in the error handling case.

Fixes: abf42d2f333b ("tty: serial: owl: add "much needed" clk_prepare_enable()")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220307105135.11698-1-linmq006@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/owl-uart.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tty/serial/owl-uart.c b/drivers/tty/serial/owl-uart.c
index c149f8c30007..a0d4bffe70bd 100644
--- a/drivers/tty/serial/owl-uart.c
+++ b/drivers/tty/serial/owl-uart.c
@@ -695,6 +695,7 @@ static int owl_uart_probe(struct platform_device *pdev)
 	owl_port->port.uartclk = clk_get_rate(owl_port->clk);
 	if (owl_port->port.uartclk == 0) {
 		dev_err(&pdev->dev, "clock rate is zero\n");
+		clk_disable_unprepare(owl_port->clk);
 		return -EINVAL;
 	}
 	owl_port->port.flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_LOW_LATENCY;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 007/172] tty: n_tty: Restore EOF push handling behavior
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (5 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 006/172] tty: serial: owl: Fix missing clk_disable_unprepare() in owl_uart_probe Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 008/172] tty: serial: fsl_lpuart: fix potential bug when using both of_alias_get_id and ida_simple_get Greg Kroah-Hartman
                   ` (165 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Peter Hurley, Jiri Slaby,
	Linus Torvalds, Daniel Gibson, Sasha Levin

From: Daniel Gibson <daniel@gibson.sh>

[ Upstream commit 65a8b287023da68c4550deab5c764e6891cf1caf ]

TTYs in ICANON mode have a special case that allows "pushing" a line
without a regular EOL character (like newline), by using EOF (the EOT
character - ASCII 0x4) as a pseudo-EOL. It is silently discarded, so
the reader of the PTS will receive the line *without* EOF or any other
terminating character.

This special case has an edge case: What happens if the readers buffer
is the same size as the line (without EOF)? Will they be able to tell
if the whole line is received, i.e. if the next read() will return more
of the same line or the next line?

There are two possibilities,  that both have (dis)advantages:

1. The next read() returns 0. FreeBSD (13.0) and OSX (10.11) do this.
   Advantage: The reader can interpret this as "the line is over".
   Disadvantage: read() returning 0 means EOF, the reader could also
   interpret it as "there's no more data" and stop reading or even
   close the PT.

2. The next read() returns the next line, the EOF is silently discarded.
   Solaris (or at least OpenIndiana 2021.10) does this, Linux has done
   do this since commit 40d5e0905a03 ("n_tty: Fix EOF push handling");
   this behavior was recently broken by commit 359303076163 ("tty:
   n_tty: do not look ahead for EOL character past the end of the buffer").
   Advantage: read() won't return 0 (EOF), reader less likely to be
   confused (and things like `while(read(..)>0)` don't break)
   Disadvantage: The reader can't really know if the read() continues
   the last line (that filled the whole read buffer) or starts a
   new line.

As both options are defensible (and are used by other Unix-likes), it's
best to stick to the "old" behavior since "n_tty: Fix EOF push handling"
of 2013, i.e. silently discard that EOF.

This patch - that I actually got from Linus for testing and only
modified slightly - restores that behavior by skipping an EOF
character if it's the next character after reading is done.

Based on a patch from Linus Torvalds.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=215611
Fixes: 359303076163 ("tty: n_tty: do not look ahead for EOL character past the end of the buffer")
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jirislaby@kernel.org>
Reviewed-and-tested-by: Daniel Gibson <daniel@gibson.sh>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Daniel Gibson <daniel@gibson.sh>
Link: https://lore.kernel.org/r/20220329235810.452513-2-daniel@gibson.sh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/n_tty.c | 38 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 58190135efb7..12dde01e576b 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -2073,6 +2073,35 @@ static bool canon_copy_from_read_buf(struct tty_struct *tty,
 	return ldata->read_tail != canon_head;
 }
 
+/*
+ * If we finished a read at the exact location of an
+ * EOF (special EOL character that's a __DISABLED_CHAR)
+ * in the stream, silently eat the EOF.
+ */
+static void canon_skip_eof(struct tty_struct *tty)
+{
+	struct n_tty_data *ldata = tty->disc_data;
+	size_t tail, canon_head;
+
+	canon_head = smp_load_acquire(&ldata->canon_head);
+	tail = ldata->read_tail;
+
+	// No data?
+	if (tail == canon_head)
+		return;
+
+	// See if the tail position is EOF in the circular buffer
+	tail &= (N_TTY_BUF_SIZE - 1);
+	if (!test_bit(tail, ldata->read_flags))
+		return;
+	if (read_buf(ldata, tail) != __DISABLED_CHAR)
+		return;
+
+	// Clear the EOL bit, skip the EOF char.
+	clear_bit(tail, ldata->read_flags);
+	smp_store_release(&ldata->read_tail, ldata->read_tail + 1);
+}
+
 /**
  *	job_control		-	check job control
  *	@tty: tty
@@ -2142,7 +2171,14 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file,
 	 */
 	if (*cookie) {
 		if (ldata->icanon && !L_EXTPROC(tty)) {
-			if (canon_copy_from_read_buf(tty, &kb, &nr))
+			/*
+			 * If we have filled the user buffer, see
+			 * if we should skip an EOF character before
+			 * releasing the lock and returning done.
+			 */
+			if (!nr)
+				canon_skip_eof(tty);
+			else if (canon_copy_from_read_buf(tty, &kb, &nr))
 				return kb - kbuf;
 		} else {
 			if (copy_from_read_buf(tty, &kb, &nr))
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 008/172] tty: serial: fsl_lpuart: fix potential bug when using both of_alias_get_id and ida_simple_get
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (6 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 007/172] tty: n_tty: Restore EOF push handling behavior Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 009/172] usb: usbip: fix a refcount leak in stub_probe() Greg Kroah-Hartman
                   ` (164 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Sherry Sun, Sasha Levin

From: Sherry Sun <sherry.sun@nxp.com>

[ Upstream commit f398e0aa325c61fa20903833a5b534ecb8e6e418 ]

Now fsl_lpuart driver use both of_alias_get_id() and ida_simple_get() in
.probe(), which has the potential bug. For example, when remove the
lpuart7 alias in dts, of_alias_get_id() will return error, then call
ida_simple_get() to allocate the id 0 for lpuart7, this may confilct
with the lpuart4 which has alias 0.

    aliases {
	...
        serial0 = &lpuart4;
        serial1 = &lpuart5;
        serial2 = &lpuart6;
        serial3 = &lpuart7;
    }

So remove the ida_simple_get() in .probe(), return an error directly
when calling of_alias_get_id() fails, which is consistent with other
uart drivers behavior.

Fixes: 3bc3206e1c0f ("serial: fsl_lpuart: Remove the alias node dependence")
Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Link: https://lore.kernel.org/r/20220321112211.8895-1-sherry.sun@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/fsl_lpuart.c | 24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index b9f8add284e3..52a603a6f9b8 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -229,8 +229,6 @@
 /* IMX lpuart has four extra unused regs located at the beginning */
 #define IMX_REG_OFF	0x10
 
-static DEFINE_IDA(fsl_lpuart_ida);
-
 enum lpuart_type {
 	VF610_LPUART,
 	LS1021A_LPUART,
@@ -265,7 +263,6 @@ struct lpuart_port {
 	int			rx_dma_rng_buf_len;
 	unsigned int		dma_tx_nents;
 	wait_queue_head_t	dma_wait;
-	bool			id_allocated;
 };
 
 struct lpuart_soc_data {
@@ -2638,23 +2635,18 @@ static int lpuart_probe(struct platform_device *pdev)
 
 	ret = of_alias_get_id(np, "serial");
 	if (ret < 0) {
-		ret = ida_simple_get(&fsl_lpuart_ida, 0, UART_NR, GFP_KERNEL);
-		if (ret < 0) {
-			dev_err(&pdev->dev, "port line is full, add device failed\n");
-			return ret;
-		}
-		sport->id_allocated = true;
+		dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
+		return ret;
 	}
 	if (ret >= ARRAY_SIZE(lpuart_ports)) {
 		dev_err(&pdev->dev, "serial%d out of range\n", ret);
-		ret = -EINVAL;
-		goto failed_out_of_range;
+		return -EINVAL;
 	}
 	sport->port.line = ret;
 
 	ret = lpuart_enable_clks(sport);
 	if (ret)
-		goto failed_clock_enable;
+		return ret;
 	sport->port.uartclk = lpuart_get_baud_clk_rate(sport);
 
 	lpuart_ports[sport->port.line] = sport;
@@ -2697,10 +2689,6 @@ static int lpuart_probe(struct platform_device *pdev)
 failed_attach_port:
 failed_irq_request:
 	lpuart_disable_clks(sport);
-failed_clock_enable:
-failed_out_of_range:
-	if (sport->id_allocated)
-		ida_simple_remove(&fsl_lpuart_ida, sport->port.line);
 	return ret;
 }
 
@@ -2710,9 +2698,6 @@ static int lpuart_remove(struct platform_device *pdev)
 
 	uart_remove_one_port(&lpuart_reg, &sport->port);
 
-	if (sport->id_allocated)
-		ida_simple_remove(&fsl_lpuart_ida, sport->port.line);
-
 	lpuart_disable_clks(sport);
 
 	if (sport->dma_tx_chan)
@@ -2842,7 +2827,6 @@ static int __init lpuart_serial_init(void)
 
 static void __exit lpuart_serial_exit(void)
 {
-	ida_destroy(&fsl_lpuart_ida);
 	platform_driver_unregister(&lpuart_driver);
 	uart_unregister_driver(&lpuart_reg);
 }
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 009/172] usb: usbip: fix a refcount leak in stub_probe()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (7 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 008/172] tty: serial: fsl_lpuart: fix potential bug when using both of_alias_get_id and ida_simple_get Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 010/172] usb: usbip: add missing device lock on tweak configuration cmd Greg Kroah-Hartman
                   ` (163 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Shuah Khan, Hangyu Hua, Sasha Levin

From: Hangyu Hua <hbh25y@gmail.com>

[ Upstream commit 9ec4cbf1cc55d126759051acfe328d489c5d6e60 ]

usb_get_dev() is called in stub_device_alloc(). When stub_probe() fails
after that, usb_put_dev() needs to be called to release the reference.

Fix this by moving usb_put_dev() to sdev_free error path handling.

Find this by code review.

Fixes: 3ff67445750a ("usbip: fix error handling in stub_probe()")
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
Link: https://lore.kernel.org/r/20220412020257.9767-1-hbh25y@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/usbip/stub_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c
index d8d3892e5a69..3c6d452e3bf4 100644
--- a/drivers/usb/usbip/stub_dev.c
+++ b/drivers/usb/usbip/stub_dev.c
@@ -393,7 +393,6 @@ static int stub_probe(struct usb_device *udev)
 
 err_port:
 	dev_set_drvdata(&udev->dev, NULL);
-	usb_put_dev(udev);
 
 	/* we already have busid_priv, just lock busid_lock */
 	spin_lock(&busid_priv->busid_lock);
@@ -408,6 +407,7 @@ static int stub_probe(struct usb_device *udev)
 	put_busid_priv(busid_priv);
 
 sdev_free:
+	usb_put_dev(udev);
 	stub_device_free(sdev);
 
 	return rc;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 010/172] usb: usbip: add missing device lock on tweak configuration cmd
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (8 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 009/172] usb: usbip: fix a refcount leak in stub_probe() Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 011/172] USB: storage: karma: fix rio_karma_init return Greg Kroah-Hartman
                   ` (162 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Shuah Khan, Niels Dossche, Sasha Levin

From: Niels Dossche <dossche.niels@gmail.com>

[ Upstream commit d088fabace2ca337b275d1d4b36db4fe7771e44f ]

The function documentation of usb_set_configuration says that its
callers should hold the device lock. This lock is held for all
callsites except tweak_set_configuration_cmd. The code path can be
executed for example when attaching a remote USB device.
The solution is to surround the call by the device lock.

This bug was found using my experimental own-developed static analysis
tool, which reported the missing lock on v5.17.2. I manually verified
this bug report by doing code review as well. I runtime checked that
the required lock is not held. I compiled and runtime tested this on
x86_64 with a USB mouse. After applying this patch, my analyser no
longer reports this potential bug.

Fixes: 2c8c98158946 ("staging: usbip: let client choose device configuration")
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
Link: https://lore.kernel.org/r/20220412165055.257113-1-dossche.niels@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/usbip/stub_rx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/usbip/stub_rx.c b/drivers/usb/usbip/stub_rx.c
index 325c22008e53..5dd41e8215e0 100644
--- a/drivers/usb/usbip/stub_rx.c
+++ b/drivers/usb/usbip/stub_rx.c
@@ -138,7 +138,9 @@ static int tweak_set_configuration_cmd(struct urb *urb)
 	req = (struct usb_ctrlrequest *) urb->setup_packet;
 	config = le16_to_cpu(req->wValue);
 
+	usb_lock_device(sdev->udev);
 	err = usb_set_configuration(sdev->udev, config);
+	usb_unlock_device(sdev->udev);
 	if (err && err != -ENODEV)
 		dev_err(&sdev->udev->dev, "can't set config #%d, error %d\n",
 			config, err);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 011/172] USB: storage: karma: fix rio_karma_init return
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (9 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 010/172] usb: usbip: add missing device lock on tweak configuration cmd Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 012/172] usb: musb: Fix missing of_node_put() in omap2430_probe Greg Kroah-Hartman
                   ` (161 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Alan Stern, Lin Ma, Sasha Levin

From: Lin Ma <linma@zju.edu.cn>

[ Upstream commit b92ffb1eddd9a66a90defc556dcbf65a43c196c7 ]

The function rio_karam_init() should return -ENOMEM instead of
value 0 (USB_STOR_TRANSPORT_GOOD) when allocation fails.

Similarly, it should return -EIO when rio_karma_send_command() fails.

Fixes: dfe0d3ba20e8 ("USB Storage: add rio karma eject support")
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Lin Ma <linma@zju.edu.cn>
Link: https://lore.kernel.org/r/20220412144359.28447-1-linma@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/storage/karma.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/storage/karma.c b/drivers/usb/storage/karma.c
index 05cec81dcd3f..38ddfedef629 100644
--- a/drivers/usb/storage/karma.c
+++ b/drivers/usb/storage/karma.c
@@ -174,24 +174,25 @@ static void rio_karma_destructor(void *extra)
 
 static int rio_karma_init(struct us_data *us)
 {
-	int ret = 0;
 	struct karma_data *data = kzalloc(sizeof(struct karma_data), GFP_NOIO);
 
 	if (!data)
-		goto out;
+		return -ENOMEM;
 
 	data->recv = kmalloc(RIO_RECV_LEN, GFP_NOIO);
 	if (!data->recv) {
 		kfree(data);
-		goto out;
+		return -ENOMEM;
 	}
 
 	us->extra = data;
 	us->extra_destructor = rio_karma_destructor;
-	ret = rio_karma_send_command(RIO_ENTER_STORAGE, us);
-	data->in_storage = (ret == 0);
-out:
-	return ret;
+	if (rio_karma_send_command(RIO_ENTER_STORAGE, us))
+		return -EIO;
+
+	data->in_storage = 1;
+
+	return 0;
 }
 
 static struct scsi_host_template karma_host_template;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 012/172] usb: musb: Fix missing of_node_put() in omap2430_probe
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (10 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 011/172] USB: storage: karma: fix rio_karma_init return Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 013/172] staging: fieldbus: Fix the error handling path in anybuss_host_common_probe() Greg Kroah-Hartman
                   ` (160 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Miaoqian Lin, Sasha Levin

From: Miaoqian Lin <linmq006@gmail.com>

[ Upstream commit 424bef51fa530389b0b9008c9e144e40c10e8458 ]

The device_node pointer is returned by of_parse_phandle() with refcount
incremented. We should use of_node_put() on it when done.

Fixes: 8934d3e4d0e7 ("usb: musb: omap2430: Don't use omap_get_control_dev()")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220309111033.24487-1-linmq006@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/musb/omap2430.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 4232f1ce3fbf..1d435e4ee857 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -360,6 +360,7 @@ static int omap2430_probe(struct platform_device *pdev)
 	control_node = of_parse_phandle(np, "ctrl-module", 0);
 	if (control_node) {
 		control_pdev = of_find_device_by_node(control_node);
+		of_node_put(control_node);
 		if (!control_pdev) {
 			dev_err(&pdev->dev, "Failed to get control device\n");
 			ret = -EINVAL;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 013/172] staging: fieldbus: Fix the error handling path in anybuss_host_common_probe()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (11 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 012/172] usb: musb: Fix missing of_node_put() in omap2430_probe Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 014/172] pwm: lp3943: Fix duty calculation in case period was clamped Greg Kroah-Hartman
                   ` (159 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Christophe JAILLET, Sasha Levin

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

[ Upstream commit 7079b3483a17be2cfba64cbd4feb1b7ae07f1ea7 ]

If device_register() fails, device_unregister() should not be called
because it will free some resources that are not allocated.
put_device() should be used instead.

Fixes: 308ee87a2f1e ("staging: fieldbus: anybus-s: support HMS Anybus-S bus")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/5401a519608d6e1a4e7435c20f4f20b0c5c36c23.1650610082.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/staging/fieldbus/anybuss/host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fieldbus/anybuss/host.c b/drivers/staging/fieldbus/anybuss/host.c
index 549cb7d51af8..2a20a1767d77 100644
--- a/drivers/staging/fieldbus/anybuss/host.c
+++ b/drivers/staging/fieldbus/anybuss/host.c
@@ -1384,7 +1384,7 @@ anybuss_host_common_probe(struct device *dev,
 		goto err_device;
 	return cd;
 err_device:
-	device_unregister(&cd->client->dev);
+	put_device(&cd->client->dev);
 err_kthread:
 	kthread_stop(cd->qthread);
 err_reset:
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 014/172] pwm: lp3943: Fix duty calculation in case period was clamped
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (12 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 013/172] staging: fieldbus: Fix the error handling path in anybuss_host_common_probe() Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 015/172] rpmsg: qcom_smd: Fix irq_of_parse_and_map() return value Greg Kroah-Hartman
                   ` (158 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Uwe Kleine-König,
	Thierry Reding, Sasha Levin

From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

[ Upstream commit 5e3b07ca5cc78cd4a987e78446849e41288d87cb ]

The hardware only supports periods <= 1.6 ms and if a bigger period is
requested it is clamped to 1.6 ms. In this case duty_cycle might be bigger
than 1.6 ms and then the duty cycle register is written with a value
bigger than LP3943_MAX_DUTY. So clamp duty_cycle accordingly.

Fixes: af66b3c0934e ("pwm: Add LP3943 PWM driver")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/pwm/pwm-lp3943.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pwm/pwm-lp3943.c b/drivers/pwm/pwm-lp3943.c
index bf3f14fb5f24..05e4120fd702 100644
--- a/drivers/pwm/pwm-lp3943.c
+++ b/drivers/pwm/pwm-lp3943.c
@@ -125,6 +125,7 @@ static int lp3943_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
 	if (err)
 		return err;
 
+	duty_ns = min(duty_ns, period_ns);
 	val = (u8)(duty_ns * LP3943_MAX_DUTY / period_ns);
 
 	return lp3943_write_byte(lp3943, reg_duty, val);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 015/172] rpmsg: qcom_smd: Fix irq_of_parse_and_map() return value
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (13 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 014/172] pwm: lp3943: Fix duty calculation in case period was clamped Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 016/172] usb: dwc3: pci: Fix pm_runtime_get_sync() error checking Greg Kroah-Hartman
                   ` (157 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Krzysztof Kozlowski, Bjorn Andersson,
	Sasha Levin

From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

[ Upstream commit 1a358d35066487d228a68303d808bc4721c6b1b9 ]

The irq_of_parse_and_map() returns 0 on failure, not a negative ERRNO.

Fixes: 53e2822e56c7 ("rpmsg: Introduce Qualcomm SMD backend")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220422105326.78713-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/rpmsg/qcom_smd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c
index 19903de6268d..db5f6009fb49 100644
--- a/drivers/rpmsg/qcom_smd.c
+++ b/drivers/rpmsg/qcom_smd.c
@@ -1388,7 +1388,7 @@ static int qcom_smd_parse_edge(struct device *dev,
 		edge->name = node->name;
 
 	irq = irq_of_parse_and_map(node, 0);
-	if (irq < 0) {
+	if (!irq) {
 		dev_err(dev, "required smd interrupt missing\n");
 		ret = irq;
 		goto put_node;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 016/172] usb: dwc3: pci: Fix pm_runtime_get_sync() error checking
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (14 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 015/172] rpmsg: qcom_smd: Fix irq_of_parse_and_map() return value Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 017/172] misc: fastrpc: fix an incorrect NULL check on list iterator Greg Kroah-Hartman
                   ` (156 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Zheng Yongjun, Sasha Levin

From: Zheng Yongjun <zhengyongjun3@huawei.com>

[ Upstream commit a03e2ddab8e735e2cc315609b297b300e9cc60d2 ]

If the device is already in a runtime PM enabled state
pm_runtime_get_sync() will return 1, so a test for negative
value should be used to check for errors.

Fixes: 8eed00b237a28 ("usb: dwc3: pci: Runtime resume child device from wq")
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Link: https://lore.kernel.org/r/20220422062652.10575-1-zhengyongjun3@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/dwc3/dwc3-pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index 98df8d52c765..a5a8c5712bce 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -213,7 +213,7 @@ static void dwc3_pci_resume_work(struct work_struct *work)
 	int ret;
 
 	ret = pm_runtime_get_sync(&dwc3->dev);
-	if (ret) {
+	if (ret < 0) {
 		pm_runtime_put_sync_autosuspend(&dwc3->dev);
 		return;
 	}
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 017/172] misc: fastrpc: fix an incorrect NULL check on list iterator
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (15 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 016/172] usb: dwc3: pci: Fix pm_runtime_get_sync() error checking Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 018/172] firmware: stratix10-svc: fix a missing " Greg Kroah-Hartman
                   ` (155 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Xiaomeng Tong, Sasha Levin

From: Xiaomeng Tong <xiam0nd.tong@gmail.com>

[ Upstream commit 5ac11fe03a0a83042d1a040dbce4fa2fb5521e23 ]

The bug is here:
	if (!buf) {

The list iterator value 'buf' will *always* be set and non-NULL
by list_for_each_entry(), so it is incorrect to assume that the
iterator value will be NULL if the list is empty (in this case, the
check 'if (!buf) {' will always be false and never exit expectly).

To fix the bug, use a new variable 'iter' as the list iterator,
while use the original variable 'buf' as a dedicated pointer to
point to the found element.

Fixes: 2419e55e532de ("misc: fastrpc: add mmap/unmap support")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Link: https://lore.kernel.org/r/20220327062202.5720-1-xiam0nd.tong@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/misc/fastrpc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index d0471fec37fb..65f24b6150aa 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -1349,17 +1349,18 @@ static int fastrpc_req_munmap_impl(struct fastrpc_user *fl,
 				   struct fastrpc_req_munmap *req)
 {
 	struct fastrpc_invoke_args args[1] = { [0] = { 0 } };
-	struct fastrpc_buf *buf, *b;
+	struct fastrpc_buf *buf = NULL, *iter, *b;
 	struct fastrpc_munmap_req_msg req_msg;
 	struct device *dev = fl->sctx->dev;
 	int err;
 	u32 sc;
 
 	spin_lock(&fl->lock);
-	list_for_each_entry_safe(buf, b, &fl->mmaps, node) {
-		if ((buf->raddr == req->vaddrout) && (buf->size == req->size))
+	list_for_each_entry_safe(iter, b, &fl->mmaps, node) {
+		if ((iter->raddr == req->vaddrout) && (iter->size == req->size)) {
+			buf = iter;
 			break;
-		buf = NULL;
+		}
 	}
 	spin_unlock(&fl->lock);
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 018/172] firmware: stratix10-svc: fix a missing check on list iterator
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (16 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 017/172] misc: fastrpc: fix an incorrect NULL check on list iterator Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 019/172] usb: typec: mux: Check dev_set_name() return value Greg Kroah-Hartman
                   ` (154 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Xiaomeng Tong, Sasha Levin

From: Xiaomeng Tong <xiam0nd.tong@gmail.com>

[ Upstream commit 5a0793ac66ac0e254d292f129a4d6c526f9f2aff ]

The bug is here:
	pmem->vaddr = NULL;

The list iterator 'pmem' will point to a bogus position containing
HEAD if the list is empty or no element is found. This case must
be checked before any use of the iterator, otherwise it will
lead to a invalid memory access.

To fix this bug, just gen_pool_free/set NULL/list_del() and return
when found, otherwise list_del HEAD and return;

Fixes: 7ca5ce896524f ("firmware: add Intel Stratix10 service layer driver")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Link: https://lore.kernel.org/r/20220414035609.2239-1-xiam0nd.tong@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/firmware/stratix10-svc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c
index 53c7e3f8cfde..7dd0ac1a0cfc 100644
--- a/drivers/firmware/stratix10-svc.c
+++ b/drivers/firmware/stratix10-svc.c
@@ -941,17 +941,17 @@ EXPORT_SYMBOL_GPL(stratix10_svc_allocate_memory);
 void stratix10_svc_free_memory(struct stratix10_svc_chan *chan, void *kaddr)
 {
 	struct stratix10_svc_data_mem *pmem;
-	size_t size = 0;
 
 	list_for_each_entry(pmem, &svc_data_mem, node)
 		if (pmem->vaddr == kaddr) {
-			size = pmem->size;
-			break;
+			gen_pool_free(chan->ctrl->genpool,
+				       (unsigned long)kaddr, pmem->size);
+			pmem->vaddr = NULL;
+			list_del(&pmem->node);
+			return;
 		}
 
-	gen_pool_free(chan->ctrl->genpool, (unsigned long)kaddr, size);
-	pmem->vaddr = NULL;
-	list_del(&pmem->node);
+	list_del(&svc_data_mem);
 }
 EXPORT_SYMBOL_GPL(stratix10_svc_free_memory);
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 019/172] usb: typec: mux: Check dev_set_name() return value
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (17 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 018/172] firmware: stratix10-svc: fix a missing " Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 020/172] iio: adc: stmpe-adc: Fix wait_for_completion_timeout return value check Greg Kroah-Hartman
                   ` (153 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andy Shevchenko, Andy Shevchenko,
	Heikki Krogerus, Bjorn Andersson, Sasha Levin

From: Bjorn Andersson <bjorn.andersson@linaro.org>

[ Upstream commit b9fa0292490db39d6542f514117333d366ec0011 ]

It's possible that dev_set_name() returns -ENOMEM, catch and handle this.

Fixes: 3370db35193b ("usb: typec: Registering real device entries for the muxes")
Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220422222351.1297276-4-bjorn.andersson@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/typec/mux.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c
index b9035c3407b5..a6e5028105d4 100644
--- a/drivers/usb/typec/mux.c
+++ b/drivers/usb/typec/mux.c
@@ -127,8 +127,11 @@ typec_switch_register(struct device *parent,
 	sw->dev.class = &typec_mux_class;
 	sw->dev.type = &typec_switch_dev_type;
 	sw->dev.driver_data = desc->drvdata;
-	dev_set_name(&sw->dev, "%s-switch",
-		     desc->name ? desc->name : dev_name(parent));
+	ret = dev_set_name(&sw->dev, "%s-switch", desc->name ? desc->name : dev_name(parent));
+	if (ret) {
+		put_device(&sw->dev);
+		return ERR_PTR(ret);
+	}
 
 	ret = device_add(&sw->dev);
 	if (ret) {
@@ -331,8 +334,11 @@ typec_mux_register(struct device *parent, const struct typec_mux_desc *desc)
 	mux->dev.class = &typec_mux_class;
 	mux->dev.type = &typec_mux_dev_type;
 	mux->dev.driver_data = desc->drvdata;
-	dev_set_name(&mux->dev, "%s-mux",
-		     desc->name ? desc->name : dev_name(parent));
+	ret = dev_set_name(&mux->dev, "%s-mux", desc->name ? desc->name : dev_name(parent));
+	if (ret) {
+		put_device(&mux->dev);
+		return ERR_PTR(ret);
+	}
 
 	ret = device_add(&mux->dev);
 	if (ret) {
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 020/172] iio: adc: stmpe-adc: Fix wait_for_completion_timeout return value check
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (18 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 019/172] usb: typec: mux: Check dev_set_name() return value Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 021/172] iio: proximity: vl53l0x: Fix return value check of wait_for_completion_timeout Greg Kroah-Hartman
                   ` (152 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Miaoqian Lin, Philippe Schenker,
	Jonathan Cameron, Sasha Levin

From: Miaoqian Lin <linmq006@gmail.com>

[ Upstream commit d345b23200bcdbd2bd3582213d738c258b77718f ]

wait_for_completion_timeout() returns unsigned long not long.
it returns 0 if timed out, and positive if completed.
The check for <= 0 is ambiguous and should be == 0 here
indicating timeout which is the only error case

Fixes: e813dde6f833 ("iio: stmpe-adc: Use wait_for_completion_timeout")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Philippe Schenker <philippe.schenker@toradex.com>
Link: https://lore.kernel.org/r/20220412065150.14486-1-linmq006@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/iio/adc/stmpe-adc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c
index fba659bfdb40..64305d9fa560 100644
--- a/drivers/iio/adc/stmpe-adc.c
+++ b/drivers/iio/adc/stmpe-adc.c
@@ -61,7 +61,7 @@ struct stmpe_adc {
 static int stmpe_read_voltage(struct stmpe_adc *info,
 		struct iio_chan_spec const *chan, int *val)
 {
-	long ret;
+	unsigned long ret;
 
 	mutex_lock(&info->lock);
 
@@ -79,7 +79,7 @@ static int stmpe_read_voltage(struct stmpe_adc *info,
 
 	ret = wait_for_completion_timeout(&info->completion, STMPE_ADC_TIMEOUT);
 
-	if (ret <= 0) {
+	if (ret == 0) {
 		stmpe_reg_write(info->stmpe, STMPE_REG_ADC_INT_STA,
 				STMPE_ADC_CH(info->channel));
 		mutex_unlock(&info->lock);
@@ -96,7 +96,7 @@ static int stmpe_read_voltage(struct stmpe_adc *info,
 static int stmpe_read_temp(struct stmpe_adc *info,
 		struct iio_chan_spec const *chan, int *val)
 {
-	long ret;
+	unsigned long ret;
 
 	mutex_lock(&info->lock);
 
@@ -114,7 +114,7 @@ static int stmpe_read_temp(struct stmpe_adc *info,
 
 	ret = wait_for_completion_timeout(&info->completion, STMPE_ADC_TIMEOUT);
 
-	if (ret <= 0) {
+	if (ret == 0) {
 		mutex_unlock(&info->lock);
 		return -ETIMEDOUT;
 	}
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 021/172] iio: proximity: vl53l0x: Fix return value check of wait_for_completion_timeout
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (19 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 020/172] iio: adc: stmpe-adc: Fix wait_for_completion_timeout return value check Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 022/172] iio: adc: sc27xx: fix read big scale voltage not right Greg Kroah-Hartman
                   ` (151 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Miaoqian Lin, Jonathan Cameron, Sasha Levin

From: Miaoqian Lin <linmq006@gmail.com>

[ Upstream commit 50f2959113cb6756ffd73c4fedc712cf2661f711 ]

wait_for_completion_timeout() returns unsigned long not int.
It returns 0 if timed out, and positive if completed.
The check for <= 0 is ambiguous and should be == 0 here
indicating timeout which is the only error case.

Fixes: 3cef2e31b54b ("iio: proximity: vl53l0x: Add IRQ support")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220412064210.10734-1-linmq006@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/iio/proximity/vl53l0x-i2c.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/proximity/vl53l0x-i2c.c b/drivers/iio/proximity/vl53l0x-i2c.c
index 235e125aeb3a..3d3ab86423ee 100644
--- a/drivers/iio/proximity/vl53l0x-i2c.c
+++ b/drivers/iio/proximity/vl53l0x-i2c.c
@@ -104,6 +104,7 @@ static int vl53l0x_read_proximity(struct vl53l0x_data *data,
 	u16 tries = 20;
 	u8 buffer[12];
 	int ret;
+	unsigned long time_left;
 
 	ret = i2c_smbus_write_byte_data(client, VL_REG_SYSRANGE_START, 1);
 	if (ret < 0)
@@ -112,10 +113,8 @@ static int vl53l0x_read_proximity(struct vl53l0x_data *data,
 	if (data->client->irq) {
 		reinit_completion(&data->completion);
 
-		ret = wait_for_completion_timeout(&data->completion, HZ/10);
-		if (ret < 0)
-			return ret;
-		else if (ret == 0)
+		time_left = wait_for_completion_timeout(&data->completion, HZ/10);
+		if (time_left == 0)
 			return -ETIMEDOUT;
 
 		vl53l0x_clear_irq(data);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 022/172] iio: adc: sc27xx: fix read big scale voltage not right
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (20 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 021/172] iio: proximity: vl53l0x: Fix return value check of wait_for_completion_timeout Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 023/172] iio: adc: sc27xx: Fine tune the scale calibration values Greg Kroah-Hartman
                   ` (150 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Cixi Geng, Baolin Wang,
	Jonathan Cameron, Sasha Levin

From: Cixi Geng <cixi.geng1@unisoc.com>

[ Upstream commit ad930a75613282400179361e220e58b87386b8c7 ]

Fix wrong configuration value of SC27XX_ADC_SCALE_MASK and
SC27XX_ADC_SCALE_SHIFT by spec documetation.

Fixes: 5df362a6cf49c (iio: adc: Add Spreadtrum SC27XX PMICs ADC support)
Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>
Link: https://lore.kernel.org/r/20220419142458.884933-3-gengcixi@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/iio/adc/sc27xx_adc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/sc27xx_adc.c b/drivers/iio/adc/sc27xx_adc.c
index aa32a1f385e2..2c0d0d1634c8 100644
--- a/drivers/iio/adc/sc27xx_adc.c
+++ b/drivers/iio/adc/sc27xx_adc.c
@@ -36,8 +36,8 @@
 
 /* Bits and mask definition for SC27XX_ADC_CH_CFG register */
 #define SC27XX_ADC_CHN_ID_MASK		GENMASK(4, 0)
-#define SC27XX_ADC_SCALE_MASK		GENMASK(10, 8)
-#define SC27XX_ADC_SCALE_SHIFT		8
+#define SC27XX_ADC_SCALE_MASK		GENMASK(10, 9)
+#define SC27XX_ADC_SCALE_SHIFT		9
 
 /* Bits definitions for SC27XX_ADC_INT_EN registers */
 #define SC27XX_ADC_IRQ_EN		BIT(0)
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 023/172] iio: adc: sc27xx: Fine tune the scale calibration values
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (21 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 022/172] iio: adc: sc27xx: fix read big scale voltage not right Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 024/172] rpmsg: qcom_smd: Fix returning 0 if irq_of_parse_and_map() fails Greg Kroah-Hartman
                   ` (149 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Cixi Geng, Jonathan Cameron, Sasha Levin

From: Cixi Geng <cixi.geng1@unisoc.com>

[ Upstream commit 5a7a184b11c6910f47600ff5cbbee34168f701a8 ]

Small adjustment the scale calibration value for the sc2731,
use new name sc2731_[big|small]_scale_graph_calib, and remove
the origin [big|small]_scale_graph_calib struct for unused.

Fixes: 8ba0dbfd07a35 (iio: adc: sc27xx: Add ADC scale calibration)
Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
Link: https://lore.kernel.org/r/20220419142458.884933-4-gengcixi@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/iio/adc/sc27xx_adc.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/adc/sc27xx_adc.c b/drivers/iio/adc/sc27xx_adc.c
index 2c0d0d1634c8..2b463e1cf1c7 100644
--- a/drivers/iio/adc/sc27xx_adc.c
+++ b/drivers/iio/adc/sc27xx_adc.c
@@ -103,14 +103,14 @@ static struct sc27xx_adc_linear_graph small_scale_graph = {
 	100, 341,
 };
 
-static const struct sc27xx_adc_linear_graph big_scale_graph_calib = {
-	4200, 856,
-	3600, 733,
+static const struct sc27xx_adc_linear_graph sc2731_big_scale_graph_calib = {
+	4200, 850,
+	3600, 728,
 };
 
-static const struct sc27xx_adc_linear_graph small_scale_graph_calib = {
-	1000, 833,
-	100, 80,
+static const struct sc27xx_adc_linear_graph sc2731_small_scale_graph_calib = {
+	1000, 838,
+	100, 84,
 };
 
 static int sc27xx_adc_get_calib_data(u32 calib_data, int calib_adc)
@@ -130,11 +130,11 @@ static int sc27xx_adc_scale_calibration(struct sc27xx_adc_data *data,
 	size_t len;
 
 	if (big_scale) {
-		calib_graph = &big_scale_graph_calib;
+		calib_graph = &sc2731_big_scale_graph_calib;
 		graph = &big_scale_graph;
 		cell_name = "big_scale_calib";
 	} else {
-		calib_graph = &small_scale_graph_calib;
+		calib_graph = &sc2731_small_scale_graph_calib;
 		graph = &small_scale_graph;
 		cell_name = "small_scale_calib";
 	}
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 024/172] rpmsg: qcom_smd: Fix returning 0 if irq_of_parse_and_map() fails
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (22 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 023/172] iio: adc: sc27xx: Fine tune the scale calibration values Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 025/172] phy: qcom-qmp: fix pipe-clock imbalance on power-on failure Greg Kroah-Hartman
                   ` (148 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Krzysztof Kozlowski, Bjorn Andersson,
	Sasha Levin

From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

[ Upstream commit 59d6f72f6f9c92fec8757d9e29527da828e9281f ]

irq_of_parse_and_map() returns 0 on failure, so this should not be
passed further as error return code.

Fixes: 1a358d350664 ("rpmsg: qcom_smd: Fix irq_of_parse_and_map() return value")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220423093932.32136-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/rpmsg/qcom_smd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c
index db5f6009fb49..a4db9f6100d2 100644
--- a/drivers/rpmsg/qcom_smd.c
+++ b/drivers/rpmsg/qcom_smd.c
@@ -1390,7 +1390,7 @@ static int qcom_smd_parse_edge(struct device *dev,
 	irq = irq_of_parse_and_map(node, 0);
 	if (!irq) {
 		dev_err(dev, "required smd interrupt missing\n");
-		ret = irq;
+		ret = -EINVAL;
 		goto put_node;
 	}
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 025/172] phy: qcom-qmp: fix pipe-clock imbalance on power-on failure
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (23 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 024/172] rpmsg: qcom_smd: Fix returning 0 if irq_of_parse_and_map() fails Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 026/172] serial: sifive: Report actual baud base rather than fixed 115200 Greg Kroah-Hartman
                   ` (147 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Evan Green, Johan Hovold, Vinod Koul,
	Sasha Levin

From: Johan Hovold <johan+linaro@kernel.org>

[ Upstream commit 5e73b2d9867998278479ccc065a8a8227a5513ef ]

Make sure to disable the pipe clock also if ufs-reset deassertion fails
during power on.

Note that the ufs-reset is asserted in qcom_qmp_phy_com_exit().

Fixes: c9b589791fc1 ("phy: qcom: Utilize UFS reset controller")
Cc: Evan Green <evgreen@chromium.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20220502133130.4125-2-johan+linaro@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/phy/qualcomm/phy-qcom-qmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
index ea46950c5d2a..afcc82ab3202 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
@@ -3141,7 +3141,7 @@ static int qcom_qmp_phy_power_on(struct phy *phy)
 
 	ret = reset_control_deassert(qmp->ufs_reset);
 	if (ret)
-		goto err_lane_rst;
+		goto err_pcs_ready;
 
 	qcom_qmp_phy_configure(pcs_misc, cfg->regs, cfg->pcs_misc_tbl,
 			       cfg->pcs_misc_tbl_num);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 026/172] serial: sifive: Report actual baud base rather than fixed 115200
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (24 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 025/172] phy: qcom-qmp: fix pipe-clock imbalance on power-on failure Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 027/172] coresight: cpu-debug: Replace mutex with mutex_trylock on panic notifier Greg Kroah-Hartman
                   ` (146 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Maciej W. Rozycki, Sasha Levin

From: Maciej W. Rozycki <macro@orcam.me.uk>

[ Upstream commit 0a7ff843d507ce2cca2c3b7e169ee56e28133530 ]

The base baud value reported is supposed to be the highest baud rate
that can be set for a serial port.  The SiFive FU740-C000 SOC's on-chip
UART supports baud rates of up to 1/16 of the input clock rate, which is
the bus clock `tlclk'[1], often at 130MHz in the case of the HiFive
Unmatched board.

However the sifive UART driver reports a fixed value of 115200 instead:

10010000.serial: ttySIF0 at MMIO 0x10010000 (irq = 1, base_baud = 115200) is a SiFive UART v0
10011000.serial: ttySIF1 at MMIO 0x10011000 (irq = 2, base_baud = 115200) is a SiFive UART v0

even though we already support setting higher baud rates, e.g.:

$ tty
/dev/ttySIF1
$ stty speed
230400

The baud base value is computed by the serial core by dividing the UART
clock recorded in `struct uart_port' by 16, which is also the minimum
value of the clock divider supported, so correct the baud base value
reported by setting the UART clock recorded to the input clock rate
rather than 115200:

10010000.serial: ttySIF0 at MMIO 0x10010000 (irq = 1, base_baud = 8125000) is a SiFive UART v0
10011000.serial: ttySIF1 at MMIO 0x10011000 (irq = 2, base_baud = 8125000) is a SiFive UART v0


[1] "SiFive FU740-C000 Manual", v1p3, SiFive, Inc., August 13, 2021,
    Section 16.9 "Baud Rate Divisor Register (div)", pp.143-144

Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
Fixes: 1f1496a923b6 ("riscv: Fix sifive serial driver")
Link: https://lore.kernel.org/r/alpine.DEB.2.21.2204291656280.9383@angie.orcam.me.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/sifive.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c
index 214bf3086c68..24036a02a424 100644
--- a/drivers/tty/serial/sifive.c
+++ b/drivers/tty/serial/sifive.c
@@ -999,7 +999,7 @@ static int sifive_serial_probe(struct platform_device *pdev)
 	/* Set up clock divider */
 	ssp->clkin_rate = clk_get_rate(ssp->clk);
 	ssp->baud_rate = SIFIVE_DEFAULT_BAUD_RATE;
-	ssp->port.uartclk = ssp->baud_rate * 16;
+	ssp->port.uartclk = ssp->clkin_rate;
 	__ssp_update_div(ssp);
 
 	platform_set_drvdata(pdev, ssp);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 027/172] coresight: cpu-debug: Replace mutex with mutex_trylock on panic notifier
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (25 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 026/172] serial: sifive: Report actual baud base rather than fixed 115200 Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 028/172] extcon: ptn5150: Add queue work sync before driver release Greg Kroah-Hartman
                   ` (145 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Leo Yan, Mathieu Poirier, Mike Leach,
	Suzuki K Poulose, Guilherme G. Piccoli, Sasha Levin

From: Guilherme G. Piccoli <gpiccoli@igalia.com>

[ Upstream commit 1adff542d67a2ed1120955cb219bfff8a9c53f59 ]

The panic notifier infrastructure executes registered callbacks when
a panic event happens - such callbacks are executed in atomic context,
with interrupts and preemption disabled in the running CPU and all other
CPUs disabled. That said, mutexes in such context are not a good idea.

This patch replaces a regular mutex with a mutex_trylock safer approach;
given the nature of the mutex used in the driver, it should be pretty
uncommon being unable to acquire such mutex in the panic path, hence
no functional change should be observed (and if it is, that would be
likely a deadlock with the regular mutex).

Fixes: 2227b7c74634 ("coresight: add support for CPU debug module")
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20220427224924.592546-10-gpiccoli@igalia.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/hwtracing/coresight/coresight-cpu-debug.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c
index 2dcf13de751f..1e98562f4287 100644
--- a/drivers/hwtracing/coresight/coresight-cpu-debug.c
+++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
@@ -379,9 +379,10 @@ static int debug_notifier_call(struct notifier_block *self,
 	int cpu;
 	struct debug_drvdata *drvdata;
 
-	mutex_lock(&debug_lock);
+	/* Bail out if we can't acquire the mutex or the functionality is off */
+	if (!mutex_trylock(&debug_lock))
+		return NOTIFY_DONE;
 
-	/* Bail out if the functionality is disabled */
 	if (!debug_enable)
 		goto skip_dump;
 
@@ -400,7 +401,7 @@ static int debug_notifier_call(struct notifier_block *self,
 
 skip_dump:
 	mutex_unlock(&debug_lock);
-	return 0;
+	return NOTIFY_DONE;
 }
 
 static struct notifier_block debug_notifier = {
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 028/172] extcon: ptn5150: Add queue work sync before driver release
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (26 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 027/172] coresight: cpu-debug: Replace mutex with mutex_trylock on panic notifier Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 029/172] soc: rockchip: Fix refcount leak in rockchip_grf_init Greg Kroah-Hartman
                   ` (144 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Krzysztof Kozlowski, Li Jun,
	Chanwoo Choi, Sasha Levin

From: Li Jun <jun.li@nxp.com>

[ Upstream commit 782cd939cbe0f569197cd1c9b0477ee213167f04 ]

Add device managed action to sync pending queue work, otherwise
the queued work may run after the work is destroyed.

Fixes: 4ed754de2d66 ("extcon: Add support for ptn5150 extcon driver")
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/extcon/extcon-ptn5150.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/extcon/extcon-ptn5150.c b/drivers/extcon/extcon-ptn5150.c
index 5b9a3cf8df26..2a7874108df8 100644
--- a/drivers/extcon/extcon-ptn5150.c
+++ b/drivers/extcon/extcon-ptn5150.c
@@ -194,6 +194,13 @@ static int ptn5150_init_dev_type(struct ptn5150_info *info)
 	return 0;
 }
 
+static void ptn5150_work_sync_and_put(void *data)
+{
+	struct ptn5150_info *info = data;
+
+	cancel_work_sync(&info->irq_work);
+}
+
 static int ptn5150_i2c_probe(struct i2c_client *i2c)
 {
 	struct device *dev = &i2c->dev;
@@ -284,6 +291,10 @@ static int ptn5150_i2c_probe(struct i2c_client *i2c)
 	if (ret)
 		return -EINVAL;
 
+	ret = devm_add_action_or_reset(dev, ptn5150_work_sync_and_put, info);
+	if (ret)
+		return ret;
+
 	/*
 	 * Update current extcon state if for example OTG connection was there
 	 * before the probe
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 029/172] soc: rockchip: Fix refcount leak in rockchip_grf_init
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (27 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 028/172] extcon: ptn5150: Add queue work sync before driver release Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 030/172] clocksource/drivers/riscv: Events are stopped during CPU suspend Greg Kroah-Hartman
                   ` (143 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Miaoqian Lin, Heiko Stuebner, Sasha Levin

From: Miaoqian Lin <linmq006@gmail.com>

[ Upstream commit 9b59588d8be91c96bfb0371e912ceb4f16315dbf ]

of_find_matching_node_and_match returns a node pointer with refcount
incremented, we should use of_node_put() on it when done.
Add missing of_node_put() to avoid refcount leak.

Fixes: 4c58063d4258 ("soc: rockchip: add driver handling grf setup")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220516072013.19731-1-linmq006@gmail.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/soc/rockchip/grf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/soc/rockchip/grf.c b/drivers/soc/rockchip/grf.c
index 494cf2b5bf7b..343ff61ccccb 100644
--- a/drivers/soc/rockchip/grf.c
+++ b/drivers/soc/rockchip/grf.c
@@ -148,12 +148,14 @@ static int __init rockchip_grf_init(void)
 		return -ENODEV;
 	if (!match || !match->data) {
 		pr_err("%s: missing grf data\n", __func__);
+		of_node_put(np);
 		return -EINVAL;
 	}
 
 	grf_info = match->data;
 
 	grf = syscon_node_to_regmap(np);
+	of_node_put(np);
 	if (IS_ERR(grf)) {
 		pr_err("%s: could not get grf syscon\n", __func__);
 		return PTR_ERR(grf);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 030/172] clocksource/drivers/riscv: Events are stopped during CPU suspend
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (28 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 029/172] soc: rockchip: Fix refcount leak in rockchip_grf_init Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 031/172] rtc: mt6397: check return value after calling platform_get_resource() Greg Kroah-Hartman
                   ` (142 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Samuel Holland, Anup Patel,
	Daniel Lezcano, Sasha Levin

From: Samuel Holland <samuel@sholland.org>

[ Upstream commit 232ccac1bd9b5bfe73895f527c08623e7fa0752d ]

Some implementations of the SBI time extension depend on hart-local
state (for example, CSRs) that are lost or hardware that is powered
down when a CPU is suspended. To be safe, the clockevents driver
cannot assume that timer IRQs will be received during CPU suspend.

Fixes: 62b019436814 ("clocksource: new RISC-V SBI timer driver")
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20220509012121.40031-1-samuel@sholland.org
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/clocksource/timer-riscv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c
index c51c5ed15aa7..0e7748df4be3 100644
--- a/drivers/clocksource/timer-riscv.c
+++ b/drivers/clocksource/timer-riscv.c
@@ -32,7 +32,7 @@ static int riscv_clock_next_event(unsigned long delta,
 static unsigned int riscv_clock_event_irq;
 static DEFINE_PER_CPU(struct clock_event_device, riscv_clock_event) = {
 	.name			= "riscv_timer_clockevent",
-	.features		= CLOCK_EVT_FEAT_ONESHOT,
+	.features		= CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_C3STOP,
 	.rating			= 100,
 	.set_next_event		= riscv_clock_next_event,
 };
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 031/172] rtc: mt6397: check return value after calling platform_get_resource()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (29 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 030/172] clocksource/drivers/riscv: Events are stopped during CPU suspend Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 032/172] serial: meson: acquire port->lock in startup() Greg Kroah-Hartman
                   ` (141 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yang Yingliang,
	AngeloGioacchino Del Regno, Alexandre Belloni, Sasha Levin

From: Yang Yingliang <yangyingliang@huawei.com>

[ Upstream commit d3b43eb505bffb8e4cdf6800c15660c001553fe6 ]

It will cause null-ptr-deref if platform_get_resource() returns NULL,
we need check the return value.

Fixes: fc2979118f3f ("rtc: mediatek: Add MT6397 RTC driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220505125043.1594771-1-yangyingliang@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/rtc/rtc-mt6397.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
index 1894aded4c85..acfcb378767d 100644
--- a/drivers/rtc/rtc-mt6397.c
+++ b/drivers/rtc/rtc-mt6397.c
@@ -269,6 +269,8 @@ static int mtk_rtc_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -EINVAL;
 	rtc->addr_base = res->start;
 
 	rtc->data = of_device_get_match_data(&pdev->dev);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 032/172] serial: meson: acquire port->lock in startup()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (30 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 031/172] rtc: mt6397: check return value after calling platform_get_resource() Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 033/172] serial: 8250_fintek: Check SER_RS485_RTS_* only with RS485 Greg Kroah-Hartman
                   ` (140 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Marek Szyprowski, Petr Mladek,
	Jiri Slaby, Neil Armstrong, John Ogness, Sasha Levin

From: John Ogness <john.ogness@linutronix.de>

[ Upstream commit 589f892ac8ef244e47c5a00ffd8605daa1eaef8e ]

The uart_ops startup() callback is called without interrupts
disabled and without port->lock locked, relatively late during the
boot process (from the call path of console_on_rootfs()). If the
device is a console, it was already previously registered and could
be actively printing messages.

Since the startup() callback is reading/writing registers used by
the console write() callback (AML_UART_CONTROL), its access must
be synchronized using the port->lock. Currently it is not.

The startup() callback is the only function that explicitly enables
interrupts. Without the synchronization, it is possible that
interrupts become accidentally permanently disabled.

CPU0                           CPU1
meson_serial_console_write     meson_uart_startup
--------------------------     ------------------
spin_lock(port->lock)
val = readl(AML_UART_CONTROL)
uart_console_write()
                               writel(INT_EN, AML_UART_CONTROL)
writel(val, AML_UART_CONTROL)
spin_unlock(port->lock)

Add port->lock synchronization to meson_uart_startup() to avoid
racing with meson_serial_console_write().

Also add detailed comments to meson_uart_reset() explaining why it
is *not* using port->lock synchronization.

Link: https://lore.kernel.org/lkml/2a82eae7-a256-f70c-fd82-4e510750906e@samsung.com
Fixes: ff7693d079e5 ("ARM: meson: serial: add MesonX SoC on-chip uart driver")
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Link: https://lore.kernel.org/r/20220508103547.626355-1-john.ogness@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/meson_uart.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
index d2c08b760f83..91b7359b79a2 100644
--- a/drivers/tty/serial/meson_uart.c
+++ b/drivers/tty/serial/meson_uart.c
@@ -255,6 +255,14 @@ static const char *meson_uart_type(struct uart_port *port)
 	return (port->type == PORT_MESON) ? "meson_uart" : NULL;
 }
 
+/*
+ * This function is called only from probe() using a temporary io mapping
+ * in order to perform a reset before setting up the device. Since the
+ * temporarily mapped region was successfully requested, there can be no
+ * console on this port at this time. Hence it is not necessary for this
+ * function to acquire the port->lock. (Since there is no console on this
+ * port at this time, the port->lock is not initialized yet.)
+ */
 static void meson_uart_reset(struct uart_port *port)
 {
 	u32 val;
@@ -269,9 +277,12 @@ static void meson_uart_reset(struct uart_port *port)
 
 static int meson_uart_startup(struct uart_port *port)
 {
+	unsigned long flags;
 	u32 val;
 	int ret = 0;
 
+	spin_lock_irqsave(&port->lock, flags);
+
 	val = readl(port->membase + AML_UART_CONTROL);
 	val |= AML_UART_CLEAR_ERR;
 	writel(val, port->membase + AML_UART_CONTROL);
@@ -287,6 +298,8 @@ static int meson_uart_startup(struct uart_port *port)
 	val = (AML_UART_RECV_IRQ(1) | AML_UART_XMIT_IRQ(port->fifosize / 2));
 	writel(val, port->membase + AML_UART_MISC);
 
+	spin_unlock_irqrestore(&port->lock, flags);
+
 	ret = request_irq(port->irq, meson_uart_interrupt, 0,
 			  port->name, port);
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 033/172] serial: 8250_fintek: Check SER_RS485_RTS_* only with RS485
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (31 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 032/172] serial: meson: acquire port->lock in startup() Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 034/172] serial: digicolor-usart: Dont allow CS5-6 Greg Kroah-Hartman
                   ` (139 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ricardo Ribalda Delgado,
	Ilpo Järvinen, Sasha Levin

From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

[ Upstream commit af0179270977508df6986b51242825d7edd59caf ]

SER_RS485_RTS_ON_SEND and SER_RS485_RTS_AFTER_SEND relate to behavior
within RS485 operation. The driver checks if they have the same value
which is not possible to realize with the hardware. The check is taken
regardless of SER_RS485_ENABLED flag and -EINVAL is returned when the
check fails, which creates problems.

This check makes it unnecessarily complicated to turn RS485 mode off as
simple zeroed serial_rs485 struct will trigger that equal values check.
In addition, the driver itself memsets its rs485 structure to zero when
RS485 is disabled but if userspace would try to make an TIOCSRS485
ioctl() call with the very same struct, it would end up failing with
-EINVAL which doesn't make much sense.

Resolve the problem by moving the check inside SER_RS485_ENABLED block.

Fixes: 7ecc77011c6f ("serial: 8250_fintek: Return -EINVAL on invalid configuration")
Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/035c738-8ea5-8b17-b1d7-84a7b3aeaa51@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/8250/8250_fintek.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_fintek.c b/drivers/tty/serial/8250/8250_fintek.c
index 251f0018ae8c..dba5950b8d0e 100644
--- a/drivers/tty/serial/8250/8250_fintek.c
+++ b/drivers/tty/serial/8250/8250_fintek.c
@@ -200,12 +200,12 @@ static int fintek_8250_rs485_config(struct uart_port *port,
 	if (!pdata)
 		return -EINVAL;
 
-	/* Hardware do not support same RTS level on send and receive */
-	if (!(rs485->flags & SER_RS485_RTS_ON_SEND) ==
-			!(rs485->flags & SER_RS485_RTS_AFTER_SEND))
-		return -EINVAL;
 
 	if (rs485->flags & SER_RS485_ENABLED) {
+		/* Hardware do not support same RTS level on send and receive */
+		if (!(rs485->flags & SER_RS485_RTS_ON_SEND) ==
+		    !(rs485->flags & SER_RS485_RTS_AFTER_SEND))
+			return -EINVAL;
 		memset(rs485->padding, 0, sizeof(rs485->padding));
 		config |= RS485_URA;
 	} else {
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 034/172] serial: digicolor-usart: Dont allow CS5-6
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (32 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 033/172] serial: 8250_fintek: Check SER_RS485_RTS_* only with RS485 Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 035/172] serial: rda-uart: " Greg Kroah-Hartman
                   ` (138 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Baruch Siach, Ilpo Järvinen,
	Sasha Levin

From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

[ Upstream commit fd63031b8c0763addcecdefe0e0c59d49646204e ]

Only CS7 and CS8 seem supported but CSIZE is not sanitized to CS8 in
the default: block.

Set CSIZE correctly so that userspace knows the effective value.
Incorrect CSIZE also results in miscalculation of the frame bits in
tty_get_char_size() or in its predecessor where the roughly the same
code is directly within uart_update_timeout().

Fixes: 5930cb3511df (serial: driver for Conexant Digicolor USART)
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220519081808.3776-3-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/digicolor-usart.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/digicolor-usart.c b/drivers/tty/serial/digicolor-usart.c
index c7f81aa1ce91..5fea9bf86e85 100644
--- a/drivers/tty/serial/digicolor-usart.c
+++ b/drivers/tty/serial/digicolor-usart.c
@@ -309,6 +309,8 @@ static void digicolor_uart_set_termios(struct uart_port *port,
 	case CS8:
 	default:
 		config |= UA_CONFIG_CHAR_LEN;
+		termios->c_cflag &= ~CSIZE;
+		termios->c_cflag |= CS8;
 		break;
 	}
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 035/172] serial: rda-uart: Dont allow CS5-6
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (33 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 034/172] serial: digicolor-usart: Dont allow CS5-6 Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 036/172] serial: txx9: " Greg Kroah-Hartman
                   ` (137 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Manivannan Sadhasivam,
	Ilpo Järvinen, Sasha Levin

From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

[ Upstream commit 098333a9c7d12bb3ce44c82f08b4d810c44d31b0 ]

Only CS7 and CS8 are supported but CSIZE is not sanitized after
fallthrough from CS5 or CS6 to CS7.

Set CSIZE correctly so that userspace knows the effective value.
Incorrect CSIZE also results in miscalculation of the frame bits in
tty_get_char_size() or in its predecessor where the roughly the same
code is directly within uart_update_timeout().

Fixes: c10b13325ced (tty: serial: Add RDA8810PL UART driver)
Cc: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220519081808.3776-4-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/rda-uart.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/rda-uart.c b/drivers/tty/serial/rda-uart.c
index 85366e059258..a45069e7ebea 100644
--- a/drivers/tty/serial/rda-uart.c
+++ b/drivers/tty/serial/rda-uart.c
@@ -262,6 +262,8 @@ static void rda_uart_set_termios(struct uart_port *port,
 		fallthrough;
 	case CS7:
 		ctrl &= ~RDA_UART_DBITS_8;
+		termios->c_cflag &= ~CSIZE;
+		termios->c_cflag |= CS7;
 		break;
 	default:
 		ctrl |= RDA_UART_DBITS_8;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 036/172] serial: txx9: Dont allow CS5-6
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (34 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 035/172] serial: rda-uart: " Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 037/172] serial: sh-sci: " Greg Kroah-Hartman
                   ` (136 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ilpo Järvinen, Sasha Levin

From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

[ Upstream commit 79ac88655dc0551e3571ad16bdabdbe65d61553e ]

Only CS7 and CS8 are supported but CSIZE is not sanitized with
CS5 or CS6 to CS8.

Set CSIZE correctly so that userspace knows the effective value.
Incorrect CSIZE also results in miscalculation of the frame bits in
tty_get_char_size() or in its predecessor where the roughly the same
code is directly within uart_update_timeout().

Fixes: 1da177e4c3f4 (Linux-2.6.12-rc2)
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220519081808.3776-5-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/serial_txx9.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c
index 7a07e7272de1..7beec331010c 100644
--- a/drivers/tty/serial/serial_txx9.c
+++ b/drivers/tty/serial/serial_txx9.c
@@ -644,6 +644,8 @@ serial_txx9_set_termios(struct uart_port *port, struct ktermios *termios,
 	case CS6:	/* not supported */
 	case CS8:
 		cval |= TXX9_SILCR_UMODE_8BIT;
+		termios->c_cflag &= ~CSIZE;
+		termios->c_cflag |= CS8;
 		break;
 	}
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 037/172] serial: sh-sci: Dont allow CS5-6
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (35 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 036/172] serial: txx9: " Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 038/172] serial: sifive: Sanitize CSIZE and c_iflag Greg Kroah-Hartman
                   ` (135 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ilpo Järvinen, Sasha Levin

From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

[ Upstream commit 9b87162de8be26bf3156460b37deee6399fd0fcb ]

Only CS7 and CS8 seem supported but CSIZE is not sanitized from
CS5 or CS6 to CS8.

Set CSIZE correctly so that userspace knows the effective value.
Incorrect CSIZE also results in miscalculation of the frame bits in
tty_get_char_size() or in its predecessor where the roughly the same
code is directly within uart_update_timeout().

Fixes: 1da177e4c3f4 (Linux-2.6.12-rc2)
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220519081808.3776-6-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/sh-sci.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index f700bfaef129..8d924727d6f0 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2392,8 +2392,12 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
 	int best_clk = -1;
 	unsigned long flags;
 
-	if ((termios->c_cflag & CSIZE) == CS7)
+	if ((termios->c_cflag & CSIZE) == CS7) {
 		smr_val |= SCSMR_CHR;
+	} else {
+		termios->c_cflag &= ~CSIZE;
+		termios->c_cflag |= CS8;
+	}
 	if (termios->c_cflag & PARENB)
 		smr_val |= SCSMR_PE;
 	if (termios->c_cflag & PARODD)
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 038/172] serial: sifive: Sanitize CSIZE and c_iflag
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (36 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 037/172] serial: sh-sci: " Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:09 ` [PATCH 5.10 039/172] serial: st-asc: Sanitize CSIZE and correct PARENB for CS7 Greg Kroah-Hartman
                   ` (134 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Paul Walmsley, Ilpo Järvinen,
	Sasha Levin

From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

[ Upstream commit c069d2756c01ed36121fae6a42c14fdf1325c71d ]

Only CS8 is supported but CSIZE was not sanitized to CS8.

Set CSIZE correctly so that userspace knows the effective value.
Incorrect CSIZE also results in miscalculation of the frame bits in
tty_get_char_size() or in its predecessor where the roughly the same
code is directly within uart_update_timeout().

Similarly, INPCK, PARMRK, and BRKINT are reported textually unsupported
but were not cleared in termios c_iflag which is the machine-readable
format.

Fixes: 45c054d0815b (tty: serial: add driver for the SiFive UART)
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220519081808.3776-7-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/sifive.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c
index 24036a02a424..91952be01074 100644
--- a/drivers/tty/serial/sifive.c
+++ b/drivers/tty/serial/sifive.c
@@ -667,12 +667,16 @@ static void sifive_serial_set_termios(struct uart_port *port,
 	int rate;
 	char nstop;
 
-	if ((termios->c_cflag & CSIZE) != CS8)
+	if ((termios->c_cflag & CSIZE) != CS8) {
 		dev_err_once(ssp->port.dev, "only 8-bit words supported\n");
+		termios->c_cflag &= ~CSIZE;
+		termios->c_cflag |= CS8;
+	}
 	if (termios->c_iflag & (INPCK | PARMRK))
 		dev_err_once(ssp->port.dev, "parity checking not supported\n");
 	if (termios->c_iflag & BRKINT)
 		dev_err_once(ssp->port.dev, "BREAK detection not supported\n");
+	termios->c_iflag &= ~(INPCK|PARMRK|BRKINT);
 
 	/* Set number of stop bits */
 	nstop = (termios->c_cflag & CSTOPB) ? 2 : 1;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 039/172] serial: st-asc: Sanitize CSIZE and correct PARENB for CS7
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (37 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 038/172] serial: sifive: Sanitize CSIZE and c_iflag Greg Kroah-Hartman
@ 2022-06-13 10:09 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 040/172] serial: stm32-usart: Correct CSIZE, bits, and parity Greg Kroah-Hartman
                   ` (133 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Srinivas Kandagatla,
	Ilpo Järvinen, Sasha Levin

From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

[ Upstream commit 52bb1cb7118564166b04d52387bd8403632f5190 ]

Only CS7 and CS8 seem supported but CSIZE is not sanitized from CS5 or
CS6 to CS8. In addition, ASC_CTL_MODE_7BIT_PAR suggests that CS7 has
to have parity, thus add PARENB.

Incorrect CSIZE results in miscalculation of the frame bits in
tty_get_char_size() or in its predecessor where the roughly the same
code is directly within uart_update_timeout().

Fixes: c4b058560762 (serial:st-asc: Add ST ASC driver.)
Cc: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220519081808.3776-8-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/st-asc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
index e7048515a79c..97d36f870f64 100644
--- a/drivers/tty/serial/st-asc.c
+++ b/drivers/tty/serial/st-asc.c
@@ -535,10 +535,14 @@ static void asc_set_termios(struct uart_port *port, struct ktermios *termios,
 	/* set character length */
 	if ((cflag & CSIZE) == CS7) {
 		ctrl_val |= ASC_CTL_MODE_7BIT_PAR;
+		cflag |= PARENB;
 	} else {
 		ctrl_val |= (cflag & PARENB) ?  ASC_CTL_MODE_8BIT_PAR :
 						ASC_CTL_MODE_8BIT;
+		cflag &= ~CSIZE;
+		cflag |= CS8;
 	}
+	termios->c_cflag = cflag;
 
 	/* set stop bit */
 	ctrl_val |= (cflag & CSTOPB) ? ASC_CTL_STOP_2BIT : ASC_CTL_STOP_1BIT;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 040/172] serial: stm32-usart: Correct CSIZE, bits, and parity
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (38 preceding siblings ...)
  2022-06-13 10:09 ` [PATCH 5.10 039/172] serial: st-asc: Sanitize CSIZE and correct PARENB for CS7 Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 041/172] firmware: dmi-sysfs: Fix memory leak in dmi_sysfs_register_handle Greg Kroah-Hartman
                   ` (132 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Erwan Le Ray, Ilpo Järvinen,
	Sasha Levin

From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

[ Upstream commit 1deeda8d2877c18bc2b9eeee10dd6d2628852848 ]

Add CSIZE sanitization for unsupported CSIZE configurations. In
addition, if parity is asked for but CSx was unsupported, the sensible
result is CS8+parity which requires setting USART_CR1_M0 like with 9
bits.

Incorrect CSIZE results in miscalculation of the frame bits in
tty_get_char_size() or in its predecessor where the roughly the same
code is directly within uart_update_timeout().

Fixes: c8a9d043947b (serial: stm32: fix word length configuration)
Cc: Erwan Le Ray <erwan.leray@st.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220519081808.3776-9-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/stm32-usart.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index 6afae051ba8d..8cd9e5b077b6 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -810,13 +810,22 @@ static void stm32_usart_set_termios(struct uart_port *port,
 	 * CS8 or (CS7 + parity), 8 bits word aka [M1:M0] = 0b00
 	 * M0 and M1 already cleared by cr1 initialization.
 	 */
-	if (bits == 9)
+	if (bits == 9) {
 		cr1 |= USART_CR1_M0;
-	else if ((bits == 7) && cfg->has_7bits_data)
+	} else if ((bits == 7) && cfg->has_7bits_data) {
 		cr1 |= USART_CR1_M1;
-	else if (bits != 8)
+	} else if (bits != 8) {
 		dev_dbg(port->dev, "Unsupported data bits config: %u bits\n"
 			, bits);
+		cflag &= ~CSIZE;
+		cflag |= CS8;
+		termios->c_cflag = cflag;
+		bits = 8;
+		if (cflag & PARENB) {
+			bits++;
+			cr1 |= USART_CR1_M0;
+		}
+	}
 
 	if (ofs->rtor != UNDEF_REG && (stm32_port->rx_ch ||
 				       stm32_port->fifoen)) {
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 041/172] firmware: dmi-sysfs: Fix memory leak in dmi_sysfs_register_handle
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (39 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 040/172] serial: stm32-usart: Correct CSIZE, bits, and parity Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 042/172] bus: ti-sysc: Fix warnings for unbind for serial Greg Kroah-Hartman
                   ` (131 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Miaoqian Lin, Sasha Levin

From: Miaoqian Lin <linmq006@gmail.com>

[ Upstream commit 660ba678f9998aca6db74f2dd912fa5124f0fa31 ]

kobject_init_and_add() takes reference even when it fails.
According to the doc of kobject_init_and_add()

   If this function returns an error, kobject_put() must be called to
   properly clean up the memory associated with the object.

Fix this issue by calling kobject_put().

Fixes: 948af1f0bbc8 ("firmware: Basic dmi-sysfs support")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220511071421.9769-1-linmq006@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/firmware/dmi-sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/dmi-sysfs.c b/drivers/firmware/dmi-sysfs.c
index 8b8127fa8955..4a93fb490cb4 100644
--- a/drivers/firmware/dmi-sysfs.c
+++ b/drivers/firmware/dmi-sysfs.c
@@ -603,7 +603,7 @@ static void __init dmi_sysfs_register_handle(const struct dmi_header *dh,
 				    "%d-%d", dh->type, entry->instance);
 
 	if (*ret) {
-		kfree(entry);
+		kobject_put(&entry->kobj);
 		return;
 	}
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 042/172] bus: ti-sysc: Fix warnings for unbind for serial
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (40 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 041/172] firmware: dmi-sysfs: Fix memory leak in dmi_sysfs_register_handle Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 043/172] driver: base: fix UAF when driver_attach failed Greg Kroah-Hartman
                   ` (130 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Romain Naour, Tony Lindgren, Sasha Levin

From: Tony Lindgren <tony@atomide.com>

[ Upstream commit c337125b8834f9719dfda0e40b25eaa266f1b8cf ]

We can get "failed to disable" clock_unprepare warnings on unbind at least
for the serial console device if the unbind is done before the device has
been idled.

As some devices are using deferred idle, we must check the status for
pending idle work to idle the device.

Fixes: 76f0f772e469 ("bus: ti-sysc: Improve handling for no-reset-on-init and no-idle-on-init")
Cc: Romain Naour <romain.naour@smile.fr>
Reviewed-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20220512053021.61650-1-tony@atomide.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/bus/ti-sysc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
index ac559c262033..4ee20be76508 100644
--- a/drivers/bus/ti-sysc.c
+++ b/drivers/bus/ti-sysc.c
@@ -3291,7 +3291,9 @@ static int sysc_remove(struct platform_device *pdev)
 	struct sysc *ddata = platform_get_drvdata(pdev);
 	int error;
 
-	cancel_delayed_work_sync(&ddata->idle_work);
+	/* Device can still be enabled, see deferred idle quirk in probe */
+	if (cancel_delayed_work_sync(&ddata->idle_work))
+		ti_sysc_idle(&ddata->idle_work.work);
 
 	error = pm_runtime_get_sync(ddata->dev);
 	if (error < 0) {
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 043/172] driver: base: fix UAF when driver_attach failed
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (41 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 042/172] bus: ti-sysc: Fix warnings for unbind for serial Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 044/172] driver core: fix deadlock in __device_attach Greg Kroah-Hartman
                   ` (129 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Schspa Shi, Sasha Levin

From: Schspa Shi <schspa@gmail.com>

[ Upstream commit 310862e574001a97ad02272bac0fd13f75f42a27 ]

When driver_attach(drv); failed, the driver_private will be freed.
But it has been added to the bus, which caused a UAF.

To fix it, we need to delete it from the bus when failed.

Fixes: 190888ac01d0 ("driver core: fix possible missing of device probe")
Signed-off-by: Schspa Shi <schspa@gmail.com>
Link: https://lore.kernel.org/r/20220513112444.45112-1-schspa@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/base/bus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index a9c23ecebc7c..df85e928b97f 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -621,7 +621,7 @@ int bus_add_driver(struct device_driver *drv)
 	if (drv->bus->p->drivers_autoprobe) {
 		error = driver_attach(drv);
 		if (error)
-			goto out_unregister;
+			goto out_del_list;
 	}
 	module_add_driver(drv->owner, drv);
 
@@ -648,6 +648,8 @@ int bus_add_driver(struct device_driver *drv)
 
 	return 0;
 
+out_del_list:
+	klist_del(&priv->knode_bus);
 out_unregister:
 	kobject_put(&priv->kobj);
 	/* drv->p is freed in driver_release()  */
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 044/172] driver core: fix deadlock in __device_attach
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (42 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 043/172] driver: base: fix UAF when driver_attach failed Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 045/172] watchdog: rti-wdt: Fix pm_runtime_get_sync() error checking Greg Kroah-Hartman
                   ` (128 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Zhang Wensheng, Sasha Levin

From: Zhang Wensheng <zhangwensheng5@huawei.com>

[ Upstream commit b232b02bf3c205b13a26dcec08e53baddd8e59ed ]

In __device_attach function, The lock holding logic is as follows:
...
__device_attach
device_lock(dev)      // get lock dev
  async_schedule_dev(__device_attach_async_helper, dev); // func
    async_schedule_node
      async_schedule_node_domain(func)
        entry = kzalloc(sizeof(struct async_entry), GFP_ATOMIC);
	/* when fail or work limit, sync to execute func, but
	   __device_attach_async_helper will get lock dev as
	   well, which will lead to A-A deadlock.  */
	if (!entry || atomic_read(&entry_count) > MAX_WORK) {
	  func;
	else
	  queue_work_node(node, system_unbound_wq, &entry->work)
  device_unlock(dev)

As shown above, when it is allowed to do async probes, because of
out of memory or work limit, async work is not allowed, to do
sync execute instead. it will lead to A-A deadlock because of
__device_attach_async_helper getting lock dev.

To fix the deadlock, move the async_schedule_dev outside device_lock,
as we can see, in async_schedule_node_domain, the parameter of
queue_work_node is system_unbound_wq, so it can accept concurrent
operations. which will also not change the code logic, and will
not lead to deadlock.

Fixes: 765230b5f084 ("driver-core: add asynchronous probing support for drivers")
Signed-off-by: Zhang Wensheng <zhangwensheng5@huawei.com>
Link: https://lore.kernel.org/r/20220518074516.1225580-1-zhangwensheng5@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/base/dd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 2728223c1fbc..4f4e8aedbd2c 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -897,6 +897,7 @@ static void __device_attach_async_helper(void *_dev, async_cookie_t cookie)
 static int __device_attach(struct device *dev, bool allow_async)
 {
 	int ret = 0;
+	bool async = false;
 
 	device_lock(dev);
 	if (dev->p->dead) {
@@ -935,7 +936,7 @@ static int __device_attach(struct device *dev, bool allow_async)
 			 */
 			dev_dbg(dev, "scheduling asynchronous probe\n");
 			get_device(dev);
-			async_schedule_dev(__device_attach_async_helper, dev);
+			async = true;
 		} else {
 			pm_request_idle(dev);
 		}
@@ -945,6 +946,8 @@ static int __device_attach(struct device *dev, bool allow_async)
 	}
 out_unlock:
 	device_unlock(dev);
+	if (async)
+		async_schedule_dev(__device_attach_async_helper, dev);
 	return ret;
 }
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 045/172] watchdog: rti-wdt: Fix pm_runtime_get_sync() error checking
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (43 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 044/172] driver core: fix deadlock in __device_attach Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 046/172] watchdog: ts4800_wdt: Fix refcount leak in ts4800_wdt_probe Greg Kroah-Hartman
                   ` (127 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Miaoqian Lin, Guenter Roeck,
	Wim Van Sebroeck, Sasha Levin

From: Miaoqian Lin <linmq006@gmail.com>

[ Upstream commit b3ac0c58fa8934926360268f3d89ec7680644d7b ]

If the device is already in a runtime PM enabled state
pm_runtime_get_sync() will return 1, so a test for negative
value should be used to check for errors.

Fixes: 2d63908bdbfb ("watchdog: Add K3 RTI watchdog support")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20220412070824.23708-1-linmq006@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/watchdog/rti_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c
index ae7f9357bb87..46c2a4bd9ebe 100644
--- a/drivers/watchdog/rti_wdt.c
+++ b/drivers/watchdog/rti_wdt.c
@@ -227,7 +227,7 @@ static int rti_wdt_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(dev);
 	ret = pm_runtime_get_sync(dev);
-	if (ret) {
+	if (ret < 0) {
 		pm_runtime_put_noidle(dev);
 		pm_runtime_disable(&pdev->dev);
 		return dev_err_probe(dev, ret, "runtime pm failed\n");
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 046/172] watchdog: ts4800_wdt: Fix refcount leak in ts4800_wdt_probe
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (44 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 045/172] watchdog: rti-wdt: Fix pm_runtime_get_sync() error checking Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 047/172] ASoC: fsl_sai: Fix FSL_SAI_xDR/xFR definition Greg Kroah-Hartman
                   ` (126 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Miaoqian Lin, Guenter Roeck,
	Wim Van Sebroeck, Sasha Levin

From: Miaoqian Lin <linmq006@gmail.com>

[ Upstream commit 5d24df3d690809952528e7a19a43d84bc5b99d44 ]

of_parse_phandle() returns a node pointer with refcount
incremented, we should use of_node_put() on it when done.
Add  missing of_node_put() in some error paths.

Fixes: bf9006399939 ("watchdog: ts4800: add driver for TS-4800 watchdog")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20220511114203.47420-1-linmq006@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/watchdog/ts4800_wdt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/ts4800_wdt.c b/drivers/watchdog/ts4800_wdt.c
index c137ad2bd5c3..0ea554c7cda5 100644
--- a/drivers/watchdog/ts4800_wdt.c
+++ b/drivers/watchdog/ts4800_wdt.c
@@ -125,13 +125,16 @@ static int ts4800_wdt_probe(struct platform_device *pdev)
 	ret = of_property_read_u32_index(np, "syscon", 1, &reg);
 	if (ret < 0) {
 		dev_err(dev, "no offset in syscon\n");
+		of_node_put(syscon_np);
 		return ret;
 	}
 
 	/* allocate memory for watchdog struct */
 	wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
-	if (!wdt)
+	if (!wdt) {
+		of_node_put(syscon_np);
 		return -ENOMEM;
+	}
 
 	/* set regmap and offset to know where to write */
 	wdt->feed_offset = reg;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 047/172] ASoC: fsl_sai: Fix FSL_SAI_xDR/xFR definition
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (45 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 046/172] watchdog: ts4800_wdt: Fix refcount leak in ts4800_wdt_probe Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 048/172] clocksource/drivers/oxnas-rps: Fix irq_of_parse_and_map() return value Greg Kroah-Hartman
                   ` (125 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Shengjiu Wang, Mark Brown, Sasha Levin

From: Shengjiu Wang <shengjiu.wang@nxp.com>

[ Upstream commit e4dd748dc87cf431af7b3954963be0d9f6150217 ]

There are multiple xDR and xFR registers, the index is
from 0 to 7. FSL_SAI_xDR and FSL_SAI_xFR is abandoned,
replace them with FSL_SAI_xDR0 and FSL_SAI_xFR0.

Fixes: 4f7a0728b530 ("ASoC: fsl_sai: Add support for SAI new version")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1653284661-18964-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/fsl/fsl_sai.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h
index 4bbcd0dbe8f1..8923c680f0e0 100644
--- a/sound/soc/fsl/fsl_sai.h
+++ b/sound/soc/fsl/fsl_sai.h
@@ -80,8 +80,8 @@
 #define FSL_SAI_xCR3(tx, ofs)	(tx ? FSL_SAI_TCR3(ofs) : FSL_SAI_RCR3(ofs))
 #define FSL_SAI_xCR4(tx, ofs)	(tx ? FSL_SAI_TCR4(ofs) : FSL_SAI_RCR4(ofs))
 #define FSL_SAI_xCR5(tx, ofs)	(tx ? FSL_SAI_TCR5(ofs) : FSL_SAI_RCR5(ofs))
-#define FSL_SAI_xDR(tx, ofs)	(tx ? FSL_SAI_TDR(ofs) : FSL_SAI_RDR(ofs))
-#define FSL_SAI_xFR(tx, ofs)	(tx ? FSL_SAI_TFR(ofs) : FSL_SAI_RFR(ofs))
+#define FSL_SAI_xDR0(tx)	(tx ? FSL_SAI_TDR0 : FSL_SAI_RDR0)
+#define FSL_SAI_xFR0(tx)	(tx ? FSL_SAI_TFR0 : FSL_SAI_RFR0)
 #define FSL_SAI_xMR(tx)		(tx ? FSL_SAI_TMR : FSL_SAI_RMR)
 
 /* SAI Transmit/Receive Control Register */
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 048/172] clocksource/drivers/oxnas-rps: Fix irq_of_parse_and_map() return value
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (46 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 047/172] ASoC: fsl_sai: Fix FSL_SAI_xDR/xFR definition Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 049/172] s390/crypto: fix scatterwalk_unmap() callers in AES-GCM Greg Kroah-Hartman
                   ` (124 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Krzysztof Kozlowski, Neil Armstrong,
	Daniel Lezcano, Sasha Levin

From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

[ Upstream commit 9c04a8ff03def4df3f81219ffbe1ec9b44ff5348 ]

The irq_of_parse_and_map() returns 0 on failure, not a negative ERRNO.

Fixes: 89355274e1f7 ("clocksource/drivers/oxnas-rps: Add Oxford Semiconductor RPS Dual Timer")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://lore.kernel.org/r/20220422104101.55754-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/clocksource/timer-oxnas-rps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-oxnas-rps.c b/drivers/clocksource/timer-oxnas-rps.c
index 56c0cc32d0ac..d514b44e67dd 100644
--- a/drivers/clocksource/timer-oxnas-rps.c
+++ b/drivers/clocksource/timer-oxnas-rps.c
@@ -236,7 +236,7 @@ static int __init oxnas_rps_timer_init(struct device_node *np)
 	}
 
 	rps->irq = irq_of_parse_and_map(np, 0);
-	if (rps->irq < 0) {
+	if (!rps->irq) {
 		ret = -EINVAL;
 		goto err_iomap;
 	}
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 049/172] s390/crypto: fix scatterwalk_unmap() callers in AES-GCM
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (47 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 048/172] clocksource/drivers/oxnas-rps: Fix irq_of_parse_and_map() return value Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 050/172] net: sched: fixed barrier to prevent skbuff sticking in qdisc backlog Greg Kroah-Hartman
                   ` (123 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jann Horn, Harald Freudenberger,
	Heiko Carstens, Sasha Levin

From: Jann Horn <jannh@google.com>

[ Upstream commit bd52cd5e23f134019b23f0c389db0f9a436e4576 ]

The argument of scatterwalk_unmap() is supposed to be the void* that was
returned by the previous scatterwalk_map() call.
The s390 AES-GCM implementation was instead passing the pointer to the
struct scatter_walk.

This doesn't actually break anything because scatterwalk_unmap() only uses
its argument under CONFIG_HIGHMEM and ARCH_HAS_FLUSH_ON_KUNMAP.

Fixes: bf7fa038707c ("s390/crypto: add s390 platform specific aes gcm support.")
Signed-off-by: Jann Horn <jannh@google.com>
Acked-by: Harald Freudenberger <freude@linux.ibm.com>
Link: https://lore.kernel.org/r/20220517143047.3054498-1-jannh@google.com
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/s390/crypto/aes_s390.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
index 73044634d342..812730e6bfff 100644
--- a/arch/s390/crypto/aes_s390.c
+++ b/arch/s390/crypto/aes_s390.c
@@ -700,7 +700,7 @@ static inline void _gcm_sg_unmap_and_advance(struct gcm_sg_walk *gw,
 					     unsigned int nbytes)
 {
 	gw->walk_bytes_remain -= nbytes;
-	scatterwalk_unmap(&gw->walk);
+	scatterwalk_unmap(gw->walk_ptr);
 	scatterwalk_advance(&gw->walk, nbytes);
 	scatterwalk_done(&gw->walk, 0, gw->walk_bytes_remain);
 	gw->walk_ptr = NULL;
@@ -775,7 +775,7 @@ static int gcm_out_walk_go(struct gcm_sg_walk *gw, unsigned int minbytesneeded)
 		goto out;
 	}
 
-	scatterwalk_unmap(&gw->walk);
+	scatterwalk_unmap(gw->walk_ptr);
 	gw->walk_ptr = NULL;
 
 	gw->ptr = gw->buf;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 050/172] net: sched: fixed barrier to prevent skbuff sticking in qdisc backlog
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (48 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 049/172] s390/crypto: fix scatterwalk_unmap() callers in AES-GCM Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 051/172] net: ethernet: mtk_eth_soc: out of bounds read in mtk_hwlro_get_fdir_entry() Greg Kroah-Hartman
                   ` (122 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Vincent Ray, Eric Dumazet,
	Jakub Kicinski, Sasha Levin

From: Vincent Ray <vray@kalrayinc.com>

[ Upstream commit a54ce3703613e41fe1d98060b62ec09a3984dc28 ]

In qdisc_run_begin(), smp_mb__before_atomic() used before test_bit()
does not provide any ordering guarantee as test_bit() is not an atomic
operation. This, added to the fact that the spin_trylock() call at
the beginning of qdisc_run_begin() does not guarantee acquire
semantics if it does not grab the lock, makes it possible for the
following statement :

if (test_bit(__QDISC_STATE_MISSED, &qdisc->state))

to be executed before an enqueue operation called before
qdisc_run_begin().

As a result the following race can happen :

           CPU 1                             CPU 2

      qdisc_run_begin()               qdisc_run_begin() /* true */
        set(MISSED)                            .
      /* returns false */                      .
          .                            /* sees MISSED = 1 */
          .                            /* so qdisc not empty */
          .                            __qdisc_run()
          .                                    .
          .                              pfifo_fast_dequeue()
 ----> /* may be done here */                  .
|         .                                clear(MISSED)
|         .                                    .
|         .                                smp_mb __after_atomic();
|         .                                    .
|         .                                /* recheck the queue */
|         .                                /* nothing => exit   */
|   enqueue(skb1)
|         .
|   qdisc_run_begin()
|         .
|     spin_trylock() /* fail */
|         .
|     smp_mb__before_atomic() /* not enough */
|         .
 ---- if (test_bit(MISSED))
        return false;   /* exit */

In the above scenario, CPU 1 and CPU 2 both try to grab the
qdisc->seqlock at the same time. Only CPU 2 succeeds and enters the
bypass code path, where it emits its skb then calls __qdisc_run().

CPU1 fails, sets MISSED and goes down the traditionnal enqueue() +
dequeue() code path. But when executing qdisc_run_begin() for the
second time, after enqueuing its skbuff, it sees the MISSED bit still
set (by itself) and consequently chooses to exit early without setting
it again nor trying to grab the spinlock again.

Meanwhile CPU2 has seen MISSED = 1, cleared it, checked the queue
and found it empty, so it returned.

At the end of the sequence, we end up with skb1 enqueued in the
backlog, both CPUs out of __dev_xmit_skb(), the MISSED bit not set,
and no __netif_schedule() called made. skb1 will now linger in the
qdisc until somebody later performs a full __qdisc_run(). Associated
to the bypass capacity of the qdisc, and the ability of the TCP layer
to avoid resending packets which it knows are still in the qdisc, this
can lead to serious traffic "holes" in a TCP connection.

We fix this by replacing the smp_mb__before_atomic() / test_bit() /
set_bit() / smp_mb__after_atomic() sequence inside qdisc_run_begin()
by a single test_and_set_bit() call, which is more concise and
enforces the needed memory barriers.

Fixes: 89837eb4b246 ("net: sched: add barrier to ensure correct ordering for lockless qdisc")
Signed-off-by: Vincent Ray <vray@kalrayinc.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20220526001746.2437669-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/net/sch_generic.h | 36 ++++++++----------------------------
 1 file changed, 8 insertions(+), 28 deletions(-)

diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 1042c449e7db..769764bda7a8 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -163,37 +163,17 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc)
 		if (spin_trylock(&qdisc->seqlock))
 			goto nolock_empty;
 
-		/* Paired with smp_mb__after_atomic() to make sure
-		 * STATE_MISSED checking is synchronized with clearing
-		 * in pfifo_fast_dequeue().
+		/* No need to insist if the MISSED flag was already set.
+		 * Note that test_and_set_bit() also gives us memory ordering
+		 * guarantees wrt potential earlier enqueue() and below
+		 * spin_trylock(), both of which are necessary to prevent races
 		 */
-		smp_mb__before_atomic();
-
-		/* If the MISSED flag is set, it means other thread has
-		 * set the MISSED flag before second spin_trylock(), so
-		 * we can return false here to avoid multi cpus doing
-		 * the set_bit() and second spin_trylock() concurrently.
-		 */
-		if (test_bit(__QDISC_STATE_MISSED, &qdisc->state))
+		if (test_and_set_bit(__QDISC_STATE_MISSED, &qdisc->state))
 			return false;
 
-		/* Set the MISSED flag before the second spin_trylock(),
-		 * if the second spin_trylock() return false, it means
-		 * other cpu holding the lock will do dequeuing for us
-		 * or it will see the MISSED flag set after releasing
-		 * lock and reschedule the net_tx_action() to do the
-		 * dequeuing.
-		 */
-		set_bit(__QDISC_STATE_MISSED, &qdisc->state);
-
-		/* spin_trylock() only has load-acquire semantic, so use
-		 * smp_mb__after_atomic() to ensure STATE_MISSED is set
-		 * before doing the second spin_trylock().
-		 */
-		smp_mb__after_atomic();
-
-		/* Retry again in case other CPU may not see the new flag
-		 * after it releases the lock at the end of qdisc_run_end().
+		/* Try to take the lock again to make sure that we will either
+		 * grab it or the CPU that still has it will see MISSED set
+		 * when testing it in qdisc_run_end()
 		 */
 		if (!spin_trylock(&qdisc->seqlock))
 			return false;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 051/172] net: ethernet: mtk_eth_soc: out of bounds read in mtk_hwlro_get_fdir_entry()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (49 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 050/172] net: sched: fixed barrier to prevent skbuff sticking in qdisc backlog Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 052/172] net: ethernet: ti: am65-cpsw-nuss: Fix some refcount leaks Greg Kroah-Hartman
                   ` (121 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, David S. Miller, Sasha Levin

From: Dan Carpenter <dan.carpenter@oracle.com>

[ Upstream commit e7e7104e2d5ddf3806a28695670f21bef471f1e1 ]

The "fsp->location" variable comes from user via ethtool_get_rxnfc().
Check that it is valid to prevent an out of bounds read.

Fixes: 7aab747e5563 ("net: ethernet: mediatek: add ethtool functions to configure RX flows of HW LRO")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 7d7dc0754a3a..789642647cd3 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1966,6 +1966,9 @@ static int mtk_hwlro_get_fdir_entry(struct net_device *dev,
 	struct ethtool_rx_flow_spec *fsp =
 		(struct ethtool_rx_flow_spec *)&cmd->fs;
 
+	if (fsp->location >= ARRAY_SIZE(mac->hwlro_ip))
+		return -EINVAL;
+
 	/* only tcp dst ipv4 is meaningful, others are meaningless */
 	fsp->flow_type = TCP_V4_FLOW;
 	fsp->h_u.tcp_ip4_spec.ip4dst = ntohl(mac->hwlro_ip[fsp->location]);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 052/172] net: ethernet: ti: am65-cpsw-nuss: Fix some refcount leaks
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (50 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 051/172] net: ethernet: mtk_eth_soc: out of bounds read in mtk_hwlro_get_fdir_entry() Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 053/172] net: dsa: mv88e6xxx: Fix refcount leak in mv88e6xxx_mdios_register Greg Kroah-Hartman
                   ` (120 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Miaoqian Lin, David S. Miller, Sasha Levin

From: Miaoqian Lin <linmq006@gmail.com>

[ Upstream commit 5dd89d2fc438457811cbbec07999ce0d80051ff5 ]

of_get_child_by_name() returns a node pointer with refcount
incremented, we should use of_node_put() on it when not need anymore.
am65_cpsw_init_cpts() and am65_cpsw_nuss_probe() don't release
the refcount in error case.
Add missing of_node_put() to avoid refcount leak.

Fixes: b1f66a5bee07 ("net: ethernet: ti: am65-cpsw-nuss: enable packet timestamping support")
Fixes: 93a76530316a ("net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/ti/am65-cpsw-nuss.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
index 0805edef5625..059d68d48f1e 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
@@ -1716,6 +1716,7 @@ static int am65_cpsw_init_cpts(struct am65_cpsw_common *common)
 	if (IS_ERR(cpts)) {
 		int ret = PTR_ERR(cpts);
 
+		of_node_put(node);
 		if (ret == -EOPNOTSUPP) {
 			dev_info(dev, "cpts disabled\n");
 			return 0;
@@ -2064,9 +2065,9 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
 	if (!node)
 		return -ENOENT;
 	common->port_num = of_get_child_count(node);
+	of_node_put(node);
 	if (common->port_num < 1 || common->port_num > AM65_CPSW_MAX_PORTS)
 		return -ENOENT;
-	of_node_put(node);
 
 	if (common->port_num != 1)
 		return -EOPNOTSUPP;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 053/172] net: dsa: mv88e6xxx: Fix refcount leak in mv88e6xxx_mdios_register
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (51 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 052/172] net: ethernet: ti: am65-cpsw-nuss: Fix some refcount leaks Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 054/172] modpost: fix removing numeric suffixes Greg Kroah-Hartman
                   ` (119 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Miaoqian Lin, Marek Behún,
	David S. Miller, Sasha Levin

From: Miaoqian Lin <linmq006@gmail.com>

[ Upstream commit 02ded5a173619b11728b8bf75a3fd995a2c1ff28 ]

of_get_child_by_name() returns a node pointer with refcount
incremented, we should use of_node_put() on it when done.

mv88e6xxx_mdio_register() pass the device node to of_mdiobus_register().
We don't need the device node after it.

Add missing of_node_put() to avoid refcount leak.

Fixes: a3c53be55c95 ("net: dsa: mv88e6xxx: Support multiple MDIO busses")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Marek Behún <kabel@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/dsa/mv88e6xxx/chip.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index e79a808375fc..7b7a8a74405d 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3148,6 +3148,7 @@ static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip,
 	 */
 	child = of_get_child_by_name(np, "mdio");
 	err = mv88e6xxx_mdio_register(chip, child, false);
+	of_node_put(child);
 	if (err)
 		return err;
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 054/172] modpost: fix removing numeric suffixes
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (52 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 053/172] net: dsa: mv88e6xxx: Fix refcount leak in mv88e6xxx_mdios_register Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 055/172] jffs2: fix memory leak in jffs2_do_fill_super Greg Kroah-Hartman
                   ` (118 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alexander Lobakin, Petr Mladek,
	Masahiro Yamada, Sasha Levin

From: Alexander Lobakin <alexandr.lobakin@intel.com>

[ Upstream commit b5beffa20d83c4e15306c991ffd00de0d8628338 ]

With the `-z unique-symbol` linker flag or any similar mechanism,
it is possible to trigger the following:

ERROR: modpost: "param_set_uint.0" [vmlinux] is a static EXPORT_SYMBOL

The reason is that for now the condition from remove_dot():

if (m && (s[n + m] == '.' || s[n + m] == 0))

which was designed to test if it's a dot or a '\0' after the suffix
is never satisfied.
This is due to that `s[n + m]` always points to the last digit of a
numeric suffix, not on the symbol next to it (from a custom debug
print added to modpost):

param_set_uint.0, s[n + m] is '0', s[n + m + 1] is '\0'

So it's off-by-one and was like that since 2014.

Fix this for the sake of any potential upcoming features, but don't
bother stable-backporting, as it's well hidden -- apart from that
LD flag, it can be triggered only with GCC LTO which never landed
upstream.

Fixes: fcd38ed0ff26 ("scripts: modpost: fix compilation warning")
Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 scripts/mod/modpost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index e08f75aed429..a21aa74b4948 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1982,7 +1982,7 @@ static char *remove_dot(char *s)
 
 	if (n && s[n]) {
 		size_t m = strspn(s + n + 1, "0123456789");
-		if (m && (s[n + m] == '.' || s[n + m] == 0))
+		if (m && (s[n + m + 1] == '.' || s[n + m + 1] == 0))
 			s[n] = 0;
 	}
 	return s;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 055/172] jffs2: fix memory leak in jffs2_do_fill_super
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (53 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 054/172] modpost: fix removing numeric suffixes Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 056/172] ubi: fastmap: Fix high cpu usage of ubi_bgt by making sure wl_pool not empty Greg Kroah-Hartman
                   ` (117 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Baokun Li, Richard Weinberger, Sasha Levin

From: Baokun Li <libaokun1@huawei.com>

[ Upstream commit c14adb1cf70a984ed081c67e9d27bc3caad9537c ]

If jffs2_iget() or d_make_root() in jffs2_do_fill_super() returns
an error, we can observe the following kmemleak report:

--------------------------------------------
unreferenced object 0xffff888105a65340 (size 64):
  comm "mount", pid 710, jiffies 4302851558 (age 58.239s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff859c45e5>] kmem_cache_alloc_trace+0x475/0x8a0
    [<ffffffff86160146>] jffs2_sum_init+0x96/0x1a0
    [<ffffffff86140e25>] jffs2_do_mount_fs+0x745/0x2120
    [<ffffffff86149fec>] jffs2_do_fill_super+0x35c/0x810
    [<ffffffff8614aae9>] jffs2_fill_super+0x2b9/0x3b0
    [...]
unreferenced object 0xffff8881bd7f0000 (size 65536):
  comm "mount", pid 710, jiffies 4302851558 (age 58.239s)
  hex dump (first 32 bytes):
    bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb  ................
    bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb  ................
  backtrace:
    [<ffffffff858579ba>] kmalloc_order+0xda/0x110
    [<ffffffff85857a11>] kmalloc_order_trace+0x21/0x130
    [<ffffffff859c2ed1>] __kmalloc+0x711/0x8a0
    [<ffffffff86160189>] jffs2_sum_init+0xd9/0x1a0
    [<ffffffff86140e25>] jffs2_do_mount_fs+0x745/0x2120
    [<ffffffff86149fec>] jffs2_do_fill_super+0x35c/0x810
    [<ffffffff8614aae9>] jffs2_fill_super+0x2b9/0x3b0
    [...]
--------------------------------------------

This is because the resources allocated in jffs2_sum_init() are not
released. Call jffs2_sum_exit() to release these resources to solve
the problem.

Fixes: e631ddba5887 ("[JFFS2] Add erase block summary support (mount time improvement)")
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/jffs2/fs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 7170de78cd26..db210989784d 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -603,6 +603,7 @@ int jffs2_do_fill_super(struct super_block *sb, struct fs_context *fc)
 	jffs2_free_raw_node_refs(c);
 	kvfree(c->blocks);
 	jffs2_clear_xattr_subsystem(c);
+	jffs2_sum_exit(c);
  out_inohash:
 	kfree(c->inocache_list);
  out_wbuf:
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 056/172] ubi: fastmap: Fix high cpu usage of ubi_bgt by making sure wl_pool not empty
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (54 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 055/172] jffs2: fix memory leak in jffs2_do_fill_super Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 057/172] ubi: ubi_create_volume: Fix use-after-free when volume creation failed Greg Kroah-Hartman
                   ` (116 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Zhihao Cheng, Richard Weinberger,
	Sasha Levin

From: Zhihao Cheng <chengzhihao1@huawei.com>

[ Upstream commit d09e9a2bddba6c48e0fddb16c4383172ac593251 ]

There at least 6 PEBs reserved on UBI device:
1. EBA_RESERVED_PEBS[1]
2. WL_RESERVED_PEBS[1]
3. UBI_LAYOUT_VOLUME_EBS[2]
4. MIN_FASTMAP_RESERVED_PEBS[2]

When all ubi volumes take all their PEBs, there are 3 (EBA_RESERVED_PEBS +
WL_RESERVED_PEBS + MIN_FASTMAP_RESERVED_PEBS - MIN_FASTMAP_TAKEN_PEBS[1])
free PEBs. Since commit f9c34bb529975fe ("ubi: Fix producing anchor PEBs")
and commit 4b68bf9a69d22dd ("ubi: Select fastmap anchor PEBs considering
wear level rules") applied, there is only 1 (3 - FASTMAP_ANCHOR_PEBS[1] -
FASTMAP_NEXT_ANCHOR_PEBS[1]) free PEB to fill pool and wl_pool, after
filling pool, wl_pool is always empty. So, UBI could be stuck in an
infinite loop:

	ubi_thread	   system_wq
wear_leveling_worker <--------------------------------------------------
  get_peb_for_wl							|
    // fm_wl_pool, used = size = 0					|
    schedule_work(&ubi->fm_work)					|
									|
		    update_fastmap_work_fn				|
		      ubi_update_fastmap				|
			ubi_refill_pools				|
			// ubi->free_count - ubi->beb_rsvd_pebs < 5	|
			// wl_pool is not filled with any PEBs		|
			schedule_erase(old_fm_anchor)			|
			ubi_ensure_anchor_pebs				|
			  __schedule_ubi_work(wear_leveling_worker)	|
									|
__erase_worker								|
  ensure_wear_leveling							|
    __schedule_ubi_work(wear_leveling_worker) --------------------------

, which cause high cpu usage of ubi_bgt:
top - 12:10:42 up 5 min,  2 users,  load average: 1.76, 0.68, 0.27
Tasks: 123 total,   3 running,  54 sleeping,   0 stopped,   0 zombie

  PID USER PR   NI VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 1589 root 20   0   0      0      0 R  45.0  0.0   0:38.86 ubi_bgt0d
  319 root 20   0   0      0      0 I  15.2  0.0   0:15.29 kworker/0:3-eve
  371 root 20   0   0      0      0 I  14.9  0.0   0:12.85 kworker/3:3-eve
   20 root 20   0   0      0      0 I  11.3  0.0   0:05.33 kworker/1:0-eve
  202 root 20   0   0      0      0 I  11.3  0.0   0:04.93 kworker/2:3-eve

In commit 4b68bf9a69d22dd ("ubi: Select fastmap anchor PEBs considering
wear level rules"), there are three key changes:
  1) Choose the fastmap anchor when the most free PEBs are available.
  2) Enable anchor move within the anchor area again as it is useful
     for distributing wear.
  3) Import a candidate fm anchor and check this PEB's erase count during
     wear leveling. If the wear leveling limit is exceeded, use the used
     anchor area PEB with the lowest erase count to replace it.

The anchor candidate can be removed, we can check fm_anchor PEB's erase
count during wear leveling. Fix it by:
  1) Removing 'fm_next_anchor' and check 'fm_anchor' during wear leveling.
  2) Preferentially filling one free peb into fm_wl_pool in condition of
     ubi->free_count > ubi->beb_rsvd_pebs, then try to reserve enough
     free count for fastmap non anchor pebs after the above prerequisites
     are met.
Then, there are at least 1 PEB in pool and 1 PEB in wl_pool after calling
ubi_refill_pools() with all erase works done.

Fetch a reproducer in [Link].

Fixes: 4b68bf9a69d22dd ("ubi: Select fastmap anchor PEBs ... rules")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=215407
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/mtd/ubi/fastmap-wl.c | 69 ++++++++++++++++++++++++------------
 drivers/mtd/ubi/fastmap.c    | 11 ------
 drivers/mtd/ubi/ubi.h        |  4 +--
 drivers/mtd/ubi/wl.c         | 19 +++++-----
 4 files changed, 57 insertions(+), 46 deletions(-)

diff --git a/drivers/mtd/ubi/fastmap-wl.c b/drivers/mtd/ubi/fastmap-wl.c
index 28f55f9cf715..053ab52668e8 100644
--- a/drivers/mtd/ubi/fastmap-wl.c
+++ b/drivers/mtd/ubi/fastmap-wl.c
@@ -97,6 +97,33 @@ struct ubi_wl_entry *ubi_wl_get_fm_peb(struct ubi_device *ubi, int anchor)
 	return e;
 }
 
+/*
+ * has_enough_free_count - whether ubi has enough free pebs to fill fm pools
+ * @ubi: UBI device description object
+ * @is_wl_pool: whether UBI is filling wear leveling pool
+ *
+ * This helper function checks whether there are enough free pebs (deducted
+ * by fastmap pebs) to fill fm_pool and fm_wl_pool, above rule works after
+ * there is at least one of free pebs is filled into fm_wl_pool.
+ * For wear leveling pool, UBI should also reserve free pebs for bad pebs
+ * handling, because there maybe no enough free pebs for user volumes after
+ * producing new bad pebs.
+ */
+static bool has_enough_free_count(struct ubi_device *ubi, bool is_wl_pool)
+{
+	int fm_used = 0;	// fastmap non anchor pebs.
+	int beb_rsvd_pebs;
+
+	if (!ubi->free.rb_node)
+		return false;
+
+	beb_rsvd_pebs = is_wl_pool ? ubi->beb_rsvd_pebs : 0;
+	if (ubi->fm_wl_pool.size > 0 && !(ubi->ro_mode || ubi->fm_disabled))
+		fm_used = ubi->fm_size / ubi->leb_size - 1;
+
+	return ubi->free_count - beb_rsvd_pebs > fm_used;
+}
+
 /**
  * ubi_refill_pools - refills all fastmap PEB pools.
  * @ubi: UBI device description object
@@ -120,21 +147,17 @@ void ubi_refill_pools(struct ubi_device *ubi)
 		wl_tree_add(ubi->fm_anchor, &ubi->free);
 		ubi->free_count++;
 	}
-	if (ubi->fm_next_anchor) {
-		wl_tree_add(ubi->fm_next_anchor, &ubi->free);
-		ubi->free_count++;
-	}
 
-	/* All available PEBs are in ubi->free, now is the time to get
+	/*
+	 * All available PEBs are in ubi->free, now is the time to get
 	 * the best anchor PEBs.
 	 */
 	ubi->fm_anchor = ubi_wl_get_fm_peb(ubi, 1);
-	ubi->fm_next_anchor = ubi_wl_get_fm_peb(ubi, 1);
 
 	for (;;) {
 		enough = 0;
 		if (pool->size < pool->max_size) {
-			if (!ubi->free.rb_node)
+			if (!has_enough_free_count(ubi, false))
 				break;
 
 			e = wl_get_wle(ubi);
@@ -147,8 +170,7 @@ void ubi_refill_pools(struct ubi_device *ubi)
 			enough++;
 
 		if (wl_pool->size < wl_pool->max_size) {
-			if (!ubi->free.rb_node ||
-			   (ubi->free_count - ubi->beb_rsvd_pebs < 5))
+			if (!has_enough_free_count(ubi, true))
 				break;
 
 			e = find_wl_entry(ubi, &ubi->free, WL_FREE_MAX_DIFF);
@@ -286,20 +308,26 @@ static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi)
 int ubi_ensure_anchor_pebs(struct ubi_device *ubi)
 {
 	struct ubi_work *wrk;
+	struct ubi_wl_entry *anchor;
 
 	spin_lock(&ubi->wl_lock);
 
-	/* Do we have a next anchor? */
-	if (!ubi->fm_next_anchor) {
-		ubi->fm_next_anchor = ubi_wl_get_fm_peb(ubi, 1);
-		if (!ubi->fm_next_anchor)
-			/* Tell wear leveling to produce a new anchor PEB */
-			ubi->fm_do_produce_anchor = 1;
+	/* Do we already have an anchor? */
+	if (ubi->fm_anchor) {
+		spin_unlock(&ubi->wl_lock);
+		return 0;
 	}
 
-	/* Do wear leveling to get a new anchor PEB or check the
-	 * existing next anchor candidate.
-	 */
+	/* See if we can find an anchor PEB on the list of free PEBs */
+	anchor = ubi_wl_get_fm_peb(ubi, 1);
+	if (anchor) {
+		ubi->fm_anchor = anchor;
+		spin_unlock(&ubi->wl_lock);
+		return 0;
+	}
+
+	ubi->fm_do_produce_anchor = 1;
+	/* No luck, trigger wear leveling to produce a new anchor PEB. */
 	if (ubi->wl_scheduled) {
 		spin_unlock(&ubi->wl_lock);
 		return 0;
@@ -381,11 +409,6 @@ static void ubi_fastmap_close(struct ubi_device *ubi)
 		ubi->fm_anchor = NULL;
 	}
 
-	if (ubi->fm_next_anchor) {
-		return_unused_peb(ubi, ubi->fm_next_anchor);
-		ubi->fm_next_anchor = NULL;
-	}
-
 	if (ubi->fm) {
 		for (i = 0; i < ubi->fm->used_blocks; i++)
 			kfree(ubi->fm->e[i]);
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 6b5f1ffd961b..6e95c4b1473e 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -1230,17 +1230,6 @@ static int ubi_write_fastmap(struct ubi_device *ubi,
 		fm_pos += sizeof(*fec);
 		ubi_assert(fm_pos <= ubi->fm_size);
 	}
-	if (ubi->fm_next_anchor) {
-		fec = (struct ubi_fm_ec *)(fm_raw + fm_pos);
-
-		fec->pnum = cpu_to_be32(ubi->fm_next_anchor->pnum);
-		set_seen(ubi, ubi->fm_next_anchor->pnum, seen_pebs);
-		fec->ec = cpu_to_be32(ubi->fm_next_anchor->ec);
-
-		free_peb_count++;
-		fm_pos += sizeof(*fec);
-		ubi_assert(fm_pos <= ubi->fm_size);
-	}
 	fmh->free_peb_count = cpu_to_be32(free_peb_count);
 
 	ubi_for_each_used_peb(ubi, wl_e, tmp_rb) {
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
index c2da77163f94..da0bee13fe7f 100644
--- a/drivers/mtd/ubi/ubi.h
+++ b/drivers/mtd/ubi/ubi.h
@@ -491,8 +491,7 @@ struct ubi_debug_info {
  * @fm_work: fastmap work queue
  * @fm_work_scheduled: non-zero if fastmap work was scheduled
  * @fast_attach: non-zero if UBI was attached by fastmap
- * @fm_anchor: The new anchor PEB used during fastmap update
- * @fm_next_anchor: An anchor PEB candidate for the next time fastmap is updated
+ * @fm_anchor: The next anchor PEB to use for fastmap
  * @fm_do_produce_anchor: If true produce an anchor PEB in wl
  *
  * @used: RB-tree of used physical eraseblocks
@@ -603,7 +602,6 @@ struct ubi_device {
 	int fm_work_scheduled;
 	int fast_attach;
 	struct ubi_wl_entry *fm_anchor;
-	struct ubi_wl_entry *fm_next_anchor;
 	int fm_do_produce_anchor;
 
 	/* Wear-leveling sub-system's stuff */
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 7847de75a74c..820b5c1c8e8e 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -688,16 +688,16 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,
 
 #ifdef CONFIG_MTD_UBI_FASTMAP
 	e1 = find_anchor_wl_entry(&ubi->used);
-	if (e1 && ubi->fm_next_anchor &&
-	    (ubi->fm_next_anchor->ec - e1->ec >= UBI_WL_THRESHOLD)) {
+	if (e1 && ubi->fm_anchor &&
+	    (ubi->fm_anchor->ec - e1->ec >= UBI_WL_THRESHOLD)) {
 		ubi->fm_do_produce_anchor = 1;
-		/* fm_next_anchor is no longer considered a good anchor
-		 * candidate.
+		/*
+		 * fm_anchor is no longer considered a good anchor.
 		 * NULL assignment also prevents multiple wear level checks
 		 * of this PEB.
 		 */
-		wl_tree_add(ubi->fm_next_anchor, &ubi->free);
-		ubi->fm_next_anchor = NULL;
+		wl_tree_add(ubi->fm_anchor, &ubi->free);
+		ubi->fm_anchor = NULL;
 		ubi->free_count++;
 	}
 
@@ -1086,12 +1086,13 @@ static int __erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk)
 	if (!err) {
 		spin_lock(&ubi->wl_lock);
 
-		if (!ubi->fm_disabled && !ubi->fm_next_anchor &&
+		if (!ubi->fm_disabled && !ubi->fm_anchor &&
 		    e->pnum < UBI_FM_MAX_START) {
-			/* Abort anchor production, if needed it will be
+			/*
+			 * Abort anchor production, if needed it will be
 			 * enabled again in the wear leveling started below.
 			 */
-			ubi->fm_next_anchor = e;
+			ubi->fm_anchor = e;
 			ubi->fm_do_produce_anchor = 0;
 		} else {
 			wl_tree_add(e, &ubi->free);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 057/172] ubi: ubi_create_volume: Fix use-after-free when volume creation failed
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (55 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 056/172] ubi: fastmap: Fix high cpu usage of ubi_bgt by making sure wl_pool not empty Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 058/172] bpf: Fix probe read error in ___bpf_prog_run() Greg Kroah-Hartman
                   ` (115 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Zhihao Cheng, Richard Weinberger,
	Sasha Levin

From: Zhihao Cheng <chengzhihao1@huawei.com>

[ Upstream commit 8c03a1c21d72210f81cb369cc528e3fde4b45411 ]

There is an use-after-free problem for 'eba_tbl' in ubi_create_volume()'s
error handling path:

  ubi_eba_replace_table(vol, eba_tbl)
    vol->eba_tbl = tbl
out_mapping:
  ubi_eba_destroy_table(eba_tbl)   // Free 'eba_tbl'
out_unlock:
  put_device(&vol->dev)
    vol_release
      kfree(tbl->entries)	  // UAF

Fix it by removing redundant 'eba_tbl' releasing.
Fetch a reproducer in [Link].

Fixes: 493cfaeaa0c9b ("mtd: utilize new cdev_device_add helper function")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=215965
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/mtd/ubi/vmt.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index 1bc7b3a05604..6ea95ade4ca6 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -309,7 +309,6 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
 	ubi->volumes[vol_id] = NULL;
 	ubi->vol_count -= 1;
 	spin_unlock(&ubi->volumes_lock);
-	ubi_eba_destroy_table(eba_tbl);
 out_acc:
 	spin_lock(&ubi->volumes_lock);
 	ubi->rsvd_pebs -= vol->reserved_pebs;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 058/172] bpf: Fix probe read error in ___bpf_prog_run()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (56 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 057/172] ubi: ubi_create_volume: Fix use-after-free when volume creation failed Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 059/172] riscv: read-only pages should not be writable Greg Kroah-Hartman
                   ` (114 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Menglong Dong, Daniel Borkmann,
	Jiang Biao, Hao Peng, Ilya Leoshkevich, Sasha Levin

From: Menglong Dong <imagedong@tencent.com>

[ Upstream commit caff1fa4118cec4dfd4336521ebd22a6408a1e3e ]

I think there is something wrong with BPF_PROBE_MEM in ___bpf_prog_run()
in big-endian machine. Let's make a test and see what will happen if we
want to load a 'u16' with BPF_PROBE_MEM.

Let's make the src value '0x0001', the value of dest register will become
0x0001000000000000, as the value will be loaded to the first 2 byte of
DST with following code:

  bpf_probe_read_kernel(&DST, SIZE, (const void *)(long) (SRC + insn->off));

Obviously, the value in DST is not correct. In fact, we can compare
BPF_PROBE_MEM with LDX_MEM_H:

  DST = *(SIZE *)(unsigned long) (SRC + insn->off);

If the memory load is done by LDX_MEM_H, the value in DST will be 0x1 now.

And I think this error results in the test case 'test_bpf_sk_storage_map'
failing:

  test_bpf_sk_storage_map:PASS:bpf_iter_bpf_sk_storage_map__open_and_load 0 nsec
  test_bpf_sk_storage_map:PASS:socket 0 nsec
  test_bpf_sk_storage_map:PASS:map_update 0 nsec
  test_bpf_sk_storage_map:PASS:socket 0 nsec
  test_bpf_sk_storage_map:PASS:map_update 0 nsec
  test_bpf_sk_storage_map:PASS:socket 0 nsec
  test_bpf_sk_storage_map:PASS:map_update 0 nsec
  test_bpf_sk_storage_map:PASS:attach_iter 0 nsec
  test_bpf_sk_storage_map:PASS:create_iter 0 nsec
  test_bpf_sk_storage_map:PASS:read 0 nsec
  test_bpf_sk_storage_map:FAIL:ipv6_sk_count got 0 expected 3
  $10/26 bpf_iter/bpf_sk_storage_map:FAIL

The code of the test case is simply, it will load sk->sk_family to the
register with BPF_PROBE_MEM and check if it is AF_INET6. With this patch,
now the test case 'bpf_iter' can pass:

  $10  bpf_iter:OK

Fixes: 2a02759ef5f8 ("bpf: Add support for BTF pointers to interpreter")
Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Jiang Biao <benbjiang@tencent.com>
Reviewed-by: Hao Peng <flyingpeng@tencent.com>
Cc: Ilya Leoshkevich <iii@linux.ibm.com>
Link: https://lore.kernel.org/bpf/20220524021228.533216-1-imagedong@tencent.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/bpf/core.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index d3a1f25f8ec2..845a4c052433 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -1653,6 +1653,11 @@ static u64 ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn, u64 *stack)
 		CONT;							\
 	LDX_MEM_##SIZEOP:						\
 		DST = *(SIZE *)(unsigned long) (SRC + insn->off);	\
+		CONT;							\
+	LDX_PROBE_MEM_##SIZEOP:						\
+		bpf_probe_read_kernel(&DST, sizeof(SIZE),		\
+				      (const void *)(long) (SRC + insn->off));	\
+		DST = *((SIZE *)&DST);					\
 		CONT;
 
 	LDST(B,   u8)
@@ -1660,15 +1665,6 @@ static u64 ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn, u64 *stack)
 	LDST(W,  u32)
 	LDST(DW, u64)
 #undef LDST
-#define LDX_PROBE(SIZEOP, SIZE)							\
-	LDX_PROBE_MEM_##SIZEOP:							\
-		bpf_probe_read_kernel(&DST, SIZE, (const void *)(long) (SRC + insn->off));	\
-		CONT;
-	LDX_PROBE(B,  1)
-	LDX_PROBE(H,  2)
-	LDX_PROBE(W,  4)
-	LDX_PROBE(DW, 8)
-#undef LDX_PROBE
 
 	STX_XADD_W: /* lock xadd *(u32 *)(dst_reg + off16) += src_reg */
 		atomic_add((u32) SRC, (atomic_t *)(unsigned long)
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 059/172] riscv: read-only pages should not be writable
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (57 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 058/172] bpf: Fix probe read error in ___bpf_prog_run() Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 060/172] net/smc: fixes for converting from "struct smc_cdc_tx_pend **" to "struct smc_wr_tx_pend_priv *" Greg Kroah-Hartman
                   ` (113 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Heinrich Schuchardt, Ard Biesheuvel,
	Sasha Levin

From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

[ Upstream commit 630f972d76d6460235e84e1aa034ee06f9c8c3a9 ]

If EFI pages are marked as read-only,
we should remove the _PAGE_WRITE flag.

The current code overwrites an unused value.

Fixes: b91540d52a08b ("RISC-V: Add EFI runtime services")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Link: https://lore.kernel.org/r/20220528014132.91052-1-heinrich.schuchardt@canonical.com
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/riscv/kernel/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/efi.c b/arch/riscv/kernel/efi.c
index 024159298231..1aa540350abd 100644
--- a/arch/riscv/kernel/efi.c
+++ b/arch/riscv/kernel/efi.c
@@ -65,7 +65,7 @@ static int __init set_permissions(pte_t *ptep, unsigned long addr, void *data)
 
 	if (md->attribute & EFI_MEMORY_RO) {
 		val = pte_val(pte) & ~_PAGE_WRITE;
-		val = pte_val(pte) | _PAGE_READ;
+		val |= _PAGE_READ;
 		pte = __pte(val);
 	}
 	if (md->attribute & EFI_MEMORY_XP) {
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 060/172] net/smc: fixes for converting from "struct smc_cdc_tx_pend **" to "struct smc_wr_tx_pend_priv *"
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (58 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 059/172] riscv: read-only pages should not be writable Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 061/172] nfp: only report pause frame configuration for physical device Greg Kroah-Hartman
                   ` (112 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Guangguan Wang, David S. Miller, Sasha Levin

From: Guangguan Wang <guangguan.wang@linux.alibaba.com>

[ Upstream commit e225c9a5a74b12e9ef8516f30a3db2c7eb866ee1 ]

"struct smc_cdc_tx_pend **" can not directly convert
to "struct smc_wr_tx_pend_priv *".

Fixes: 2bced6aefa3d ("net/smc: put slot when connection is killed")
Signed-off-by: Guangguan Wang <guangguan.wang@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/smc/smc_cdc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c
index 0c490cdde6a4..94503f36b9a6 100644
--- a/net/smc/smc_cdc.c
+++ b/net/smc/smc_cdc.c
@@ -72,7 +72,7 @@ int smc_cdc_get_free_slot(struct smc_connection *conn,
 		/* abnormal termination */
 		if (!rc)
 			smc_wr_tx_put_slot(link,
-					   (struct smc_wr_tx_pend_priv *)pend);
+					   (struct smc_wr_tx_pend_priv *)(*pend));
 		rc = -EPIPE;
 	}
 	return rc;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 061/172] nfp: only report pause frame configuration for physical device
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (59 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 060/172] net/smc: fixes for converting from "struct smc_cdc_tx_pend **" to "struct smc_wr_tx_pend_priv *" Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 062/172] sfc: fix considering that all channels have TX queues Greg Kroah-Hartman
                   ` (111 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yu Xiao, Simon Horman,
	David S. Miller, Sasha Levin

From: Yu Xiao <yu.xiao@corigine.com>

[ Upstream commit 0649e4d63420ebc8cbebef3e9d39e12ffc5eb9fa ]

Only report pause frame configuration for physical device. Logical
port of both PCI PF and PCI VF do not support it.

Fixes: 9fdc5d85a8fe ("nfp: update ethtool reporting of pauseframe control")
Signed-off-by: Yu Xiao <yu.xiao@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
index cd0c9623f7dd..e0b801d10739 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
@@ -286,8 +286,6 @@ nfp_net_get_link_ksettings(struct net_device *netdev,
 
 	/* Init to unknowns */
 	ethtool_link_ksettings_add_link_mode(cmd, supported, FIBRE);
-	ethtool_link_ksettings_add_link_mode(cmd, supported, Pause);
-	ethtool_link_ksettings_add_link_mode(cmd, advertising, Pause);
 	cmd->base.port = PORT_OTHER;
 	cmd->base.speed = SPEED_UNKNOWN;
 	cmd->base.duplex = DUPLEX_UNKNOWN;
@@ -295,6 +293,8 @@ nfp_net_get_link_ksettings(struct net_device *netdev,
 	port = nfp_port_from_netdev(netdev);
 	eth_port = nfp_port_get_eth_port(port);
 	if (eth_port) {
+		ethtool_link_ksettings_add_link_mode(cmd, supported, Pause);
+		ethtool_link_ksettings_add_link_mode(cmd, advertising, Pause);
 		cmd->base.autoneg = eth_port->aneg != NFP_ANEG_DISABLED ?
 			AUTONEG_ENABLE : AUTONEG_DISABLE;
 		nfp_net_set_fec_link_mode(eth_port, cmd);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 062/172] sfc: fix considering that all channels have TX queues
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (60 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 061/172] nfp: only report pause frame configuration for physical device Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 063/172] sfc: fix wrong tx channel offset with efx_separate_tx_channels Greg Kroah-Hartman
                   ` (110 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Tianhao Zhao, Martin Habets,
	Íñigo Huguet, David S. Miller, Sasha Levin

From: Martin Habets <habetsm.xilinx@gmail.com>

[ Upstream commit 2e102b53f8a778f872dc137f4c7ac548705817aa ]

Normally, all channels have RX and TX queues, but this is not true if
modparam efx_separate_tx_channels=1 is used. In that cases, some
channels only have RX queues and others only TX queues (or more
preciselly, they have them allocated, but not initialized).

Fix efx_channel_has_tx_queues to return the correct value for this case
too.

Messages shown at probe time before the fix:
 sfc 0000:03:00.0 ens6f0np0: MC command 0x82 inlen 544 failed rc=-22 (raw=0) arg=0
 ------------[ cut here ]------------
 netdevice: ens6f0np0: failed to initialise TXQ -1
 WARNING: CPU: 1 PID: 626 at drivers/net/ethernet/sfc/ef10.c:2393 efx_ef10_tx_init+0x201/0x300 [sfc]
 [...] stripped
 RIP: 0010:efx_ef10_tx_init+0x201/0x300 [sfc]
 [...] stripped
 Call Trace:
  efx_init_tx_queue+0xaa/0xf0 [sfc]
  efx_start_channels+0x49/0x120 [sfc]
  efx_start_all+0x1f8/0x430 [sfc]
  efx_net_open+0x5a/0xe0 [sfc]
  __dev_open+0xd0/0x190
  __dev_change_flags+0x1b3/0x220
  dev_change_flags+0x21/0x60
 [...] stripped

Messages shown at remove time before the fix:
 sfc 0000:03:00.0 ens6f0np0: failed to flush 10 queues
 sfc 0000:03:00.0 ens6f0np0: failed to flush queues

Fixes: 8700aff08984 ("sfc: fix channel allocation with brute force")
Reported-by: Tianhao Zhao <tizhao@redhat.com>
Signed-off-by: Martin Habets <habetsm.xilinx@gmail.com>
Tested-by: Íñigo Huguet <ihuguet@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/sfc/net_driver.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 9f7dfdf708cf..8aecb4bd2c0d 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -1522,7 +1522,7 @@ static inline bool efx_channel_is_xdp_tx(struct efx_channel *channel)
 
 static inline bool efx_channel_has_tx_queues(struct efx_channel *channel)
 {
-	return true;
+	return channel && channel->channel >= channel->efx->tx_channel_offset;
 }
 
 static inline unsigned int efx_channel_num_tx_queues(struct efx_channel *channel)
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 063/172] sfc: fix wrong tx channel offset with efx_separate_tx_channels
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (61 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 062/172] sfc: fix considering that all channels have TX queues Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 064/172] net/mlx5: Dont use already freed action pointer Greg Kroah-Hartman
                   ` (109 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Tianhao Zhao, Íñigo Huguet,
	David S. Miller, Sasha Levin

From: Íñigo Huguet <ihuguet@redhat.com>

[ Upstream commit c308dfd1b43ef0d4c3e57b741bb3462eb7a7f4a2 ]

tx_channel_offset is calculated in efx_allocate_msix_channels, but it is
also calculated again in efx_set_channels because it was originally done
there, and when efx_allocate_msix_channels was introduced it was
forgotten to be removed from efx_set_channels.

Moreover, the old calculation is wrong when using
efx_separate_tx_channels because now we can have XDP channels after the
TX channels, so n_channels - n_tx_channels doesn't point to the first TX
channel.

Remove the old calculation from efx_set_channels, and add the
initialization of this variable if MSI or legacy interrupts are used,
next to the initialization of the rest of the related variables, where
it was missing.

Fixes: 3990a8fffbda ("sfc: allocate channels for XDP tx queues")
Reported-by: Tianhao Zhao <tizhao@redhat.com>
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/sfc/efx_channels.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/sfc/efx_channels.c b/drivers/net/ethernet/sfc/efx_channels.c
index 2ab8571ef1cc..d0f1b2dc7dff 100644
--- a/drivers/net/ethernet/sfc/efx_channels.c
+++ b/drivers/net/ethernet/sfc/efx_channels.c
@@ -287,6 +287,7 @@ int efx_probe_interrupts(struct efx_nic *efx)
 		efx->n_channels = 1;
 		efx->n_rx_channels = 1;
 		efx->n_tx_channels = 1;
+		efx->tx_channel_offset = 0;
 		efx->n_xdp_channels = 0;
 		efx->xdp_channel_offset = efx->n_channels;
 		rc = pci_enable_msi(efx->pci_dev);
@@ -307,6 +308,7 @@ int efx_probe_interrupts(struct efx_nic *efx)
 		efx->n_channels = 1 + (efx_separate_tx_channels ? 1 : 0);
 		efx->n_rx_channels = 1;
 		efx->n_tx_channels = 1;
+		efx->tx_channel_offset = 1;
 		efx->n_xdp_channels = 0;
 		efx->xdp_channel_offset = efx->n_channels;
 		efx->legacy_irq = efx->pci_dev->irq;
@@ -858,10 +860,6 @@ int efx_set_channels(struct efx_nic *efx)
 	int xdp_queue_number;
 	int rc;
 
-	efx->tx_channel_offset =
-		efx_separate_tx_channels ?
-		efx->n_channels - efx->n_tx_channels : 0;
-
 	if (efx->xdp_tx_queue_count) {
 		EFX_WARN_ON_PARANOID(efx->xdp_tx_queues);
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 064/172] net/mlx5: Dont use already freed action pointer
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (62 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 063/172] sfc: fix wrong tx channel offset with efx_separate_tx_channels Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 065/172] net/mlx5: correct ECE offset in query qp output Greg Kroah-Hartman
                   ` (108 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Leon Romanovsky,
	Saeed Mahameed, Sasha Levin

From: Leon Romanovsky <leonro@nvidia.com>

[ Upstream commit 80b2bd737d0e833e6a2b77e482e5a714a79c86a4 ]

The call to mlx5dr_action_destroy() releases "action" memory. That
pointer is set to miss_action later and generates the following smatch
error:

 drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c:53 set_miss_action()
 warn: 'action' was already freed.

Make sure that the pointer is always valid by setting NULL after destroy.

Fixes: 6a48faeeca10 ("net/mlx5: Add direct rule fs_cmd implementation")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c
index 96c39a17d026..b227fa9ada46 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c
@@ -43,11 +43,10 @@ static int set_miss_action(struct mlx5_flow_root_namespace *ns,
 	err = mlx5dr_table_set_miss_action(ft->fs_dr_table.dr_table, action);
 	if (err && action) {
 		err = mlx5dr_action_destroy(action);
-		if (err) {
-			action = NULL;
-			mlx5_core_err(ns->dev, "Failed to destroy action (%d)\n",
-				      err);
-		}
+		if (err)
+			mlx5_core_err(ns->dev,
+				      "Failed to destroy action (%d)\n", err);
+		action = NULL;
 	}
 	ft->fs_dr_table.miss_action = action;
 	if (old_miss_action) {
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 065/172] net/mlx5: correct ECE offset in query qp output
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (63 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 064/172] net/mlx5: Dont use already freed action pointer Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 066/172] net/mlx5e: Update netdev features after changing XDP state Greg Kroah-Hartman
                   ` (107 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Changcheng Liu, Saeed Mahameed, Sasha Levin

From: Changcheng Liu <jerrliu@nvidia.com>

[ Upstream commit 3fc2a9e89b3508a5cc0c324f26d7b4740ba8c456 ]

ECE field should be after opt_param_mask in query qp output.

Fixes: 6b646a7e4af6 ("net/mlx5: Add ability to read and write ECE options")
Signed-off-by: Changcheng Liu <jerrliu@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/linux/mlx5/mlx5_ifc.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index eba1f1cbc9fb..6ca97729b54a 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -4877,12 +4877,11 @@ struct mlx5_ifc_query_qp_out_bits {
 
 	u8         syndrome[0x20];
 
-	u8         reserved_at_40[0x20];
-	u8         ece[0x20];
+	u8         reserved_at_40[0x40];
 
 	u8         opt_param_mask[0x20];
 
-	u8         reserved_at_a0[0x20];
+	u8         ece[0x20];
 
 	struct mlx5_ifc_qpc_bits qpc;
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 066/172] net/mlx5e: Update netdev features after changing XDP state
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (64 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 065/172] net/mlx5: correct ECE offset in query qp output Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 067/172] net: sched: add barrier to fix packet stuck problem for lockless qdisc Greg Kroah-Hartman
                   ` (106 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Maxim Mikityanskiy, Tariq Toukan,
	Saeed Mahameed, Sasha Levin

From: Maxim Mikityanskiy <maximmi@nvidia.com>

[ Upstream commit f6279f113ad593971999c877eb69dc3d36a75894 ]

Some features (LRO, HW GRO) conflict with XDP. If there is an attempt to
enable such features while XDP is active, they will be set to `off
[requested on]`. In order to activate these features after XDP is turned
off, the driver needs to call netdev_update_features(). This commit adds
this missing call after XDP state changes.

Fixes: cf6e34c8c22f ("net/mlx5e: Properly block LRO when XDP is enabled")
Fixes: b0617e7b3500 ("net/mlx5e: Properly block HW GRO when XDP is enabled")
Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index d9cc0ed6c5f7..cfc3bfcb04a2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -4576,6 +4576,11 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)
 
 unlock:
 	mutex_unlock(&priv->state_lock);
+
+	/* Need to fix some features. */
+	if (!err)
+		netdev_update_features(netdev);
+
 	return err;
 }
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 067/172] net: sched: add barrier to fix packet stuck problem for lockless qdisc
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (65 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 066/172] net/mlx5e: Update netdev features after changing XDP state Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 068/172] tcp: tcp_rtx_synack() can be called from process context Greg Kroah-Hartman
                   ` (105 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Guoju Fang, Jakub Kicinski, Sasha Levin

From: Guoju Fang <gjfang@linux.alibaba.com>

[ Upstream commit 2e8728c955ce0624b958eee6e030a37aca3a5d86 ]

In qdisc_run_end(), the spin_unlock() only has store-release semantic,
which guarantees all earlier memory access are visible before it. But
the subsequent test_bit() has no barrier semantics so may be reordered
ahead of the spin_unlock(). The store-load reordering may cause a packet
stuck problem.

The concurrent operations can be described as below,
         CPU 0                      |          CPU 1
   qdisc_run_end()                  |     qdisc_run_begin()
          .                         |           .
 ----> /* may be reorderd here */   |           .
|         .                         |           .
|     spin_unlock()                 |         set_bit()
|         .                         |         smp_mb__after_atomic()
 ---- test_bit()                    |         spin_trylock()
          .                         |          .

Consider the following sequence of events:
    CPU 0 reorder test_bit() ahead and see MISSED = 0
    CPU 1 calls set_bit()
    CPU 1 calls spin_trylock() and return fail
    CPU 0 executes spin_unlock()

At the end of the sequence, CPU 0 calls spin_unlock() and does nothing
because it see MISSED = 0. The skb on CPU 1 has beed enqueued but no one
take it, until the next cpu pushing to the qdisc (if ever ...) will
notice and dequeue it.

This patch fix this by adding one explicit barrier. As spin_unlock() and
test_bit() ordering is a store-load ordering, a full memory barrier
smp_mb() is needed here.

Fixes: a90c57f2cedd ("net: sched: fix packet stuck problem for lockless qdisc")
Signed-off-by: Guoju Fang <gjfang@linux.alibaba.com>
Link: https://lore.kernel.org/r/20220528101628.120193-1-gjfang@linux.alibaba.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/net/sch_generic.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 769764bda7a8..bed2387af456 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -197,6 +197,12 @@ static inline void qdisc_run_end(struct Qdisc *qdisc)
 	if (qdisc->flags & TCQ_F_NOLOCK) {
 		spin_unlock(&qdisc->seqlock);
 
+		/* spin_unlock() only has store-release semantic. The unlock
+		 * and test_bit() ordering is a store-load ordering, so a full
+		 * memory barrier is needed here.
+		 */
+		smp_mb();
+
 		if (unlikely(test_bit(__QDISC_STATE_MISSED,
 				      &qdisc->state))) {
 			clear_bit(__QDISC_STATE_MISSED, &qdisc->state);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 068/172] tcp: tcp_rtx_synack() can be called from process context
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (66 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 067/172] net: sched: add barrier to fix packet stuck problem for lockless qdisc Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 069/172] gpio: pca953x: use the correct register address to do regcache sync Greg Kroah-Hartman
                   ` (104 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Eric Dumazet, Laurent Fasnacht,
	Neal Cardwell, Jakub Kicinski, Sasha Levin

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 0a375c822497ed6ad6b5da0792a12a6f1af10c0b ]

Laurent reported the enclosed report [1]

This bug triggers with following coditions:

0) Kernel built with CONFIG_DEBUG_PREEMPT=y

1) A new passive FastOpen TCP socket is created.
   This FO socket waits for an ACK coming from client to be a complete
   ESTABLISHED one.
2) A socket operation on this socket goes through lock_sock()
   release_sock() dance.
3) While the socket is owned by the user in step 2),
   a retransmit of the SYN is received and stored in socket backlog.
4) At release_sock() time, the socket backlog is processed while
   in process context.
5) A SYNACK packet is cooked in response of the SYN retransmit.
6) -> tcp_rtx_synack() is called in process context.

Before blamed commit, tcp_rtx_synack() was always called from BH handler,
from a timer handler.

Fix this by using TCP_INC_STATS() & NET_INC_STATS()
which do not assume caller is in non preemptible context.

[1]
BUG: using __this_cpu_add() in preemptible [00000000] code: epollpep/2180
caller is tcp_rtx_synack.part.0+0x36/0xc0
CPU: 10 PID: 2180 Comm: epollpep Tainted: G           OE     5.16.0-0.bpo.4-amd64 #1  Debian 5.16.12-1~bpo11+1
Hardware name: Supermicro SYS-5039MC-H8TRF/X11SCD-F, BIOS 1.7 11/23/2021
Call Trace:
 <TASK>
 dump_stack_lvl+0x48/0x5e
 check_preemption_disabled+0xde/0xe0
 tcp_rtx_synack.part.0+0x36/0xc0
 tcp_rtx_synack+0x8d/0xa0
 ? kmem_cache_alloc+0x2e0/0x3e0
 ? apparmor_file_alloc_security+0x3b/0x1f0
 inet_rtx_syn_ack+0x16/0x30
 tcp_check_req+0x367/0x610
 tcp_rcv_state_process+0x91/0xf60
 ? get_nohz_timer_target+0x18/0x1a0
 ? lock_timer_base+0x61/0x80
 ? preempt_count_add+0x68/0xa0
 tcp_v4_do_rcv+0xbd/0x270
 __release_sock+0x6d/0xb0
 release_sock+0x2b/0x90
 sock_setsockopt+0x138/0x1140
 ? __sys_getsockname+0x7e/0xc0
 ? aa_sk_perm+0x3e/0x1a0
 __sys_setsockopt+0x198/0x1e0
 __x64_sys_setsockopt+0x21/0x30
 do_syscall_64+0x38/0xc0
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Fixes: 168a8f58059a ("tcp: TCP Fast Open Server - main code path")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Laurent Fasnacht <laurent.fasnacht@proton.ch>
Acked-by: Neal Cardwell <ncardwell@google.com>
Link: https://lore.kernel.org/r/20220530213713.601888-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ipv4/tcp_output.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index e37ad0b3645c..8634a5c853f5 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -4115,8 +4115,8 @@ int tcp_rtx_synack(const struct sock *sk, struct request_sock *req)
 	res = af_ops->send_synack(sk, NULL, &fl, req, NULL, TCP_SYNACK_NORMAL,
 				  NULL);
 	if (!res) {
-		__TCP_INC_STATS(sock_net(sk), TCP_MIB_RETRANSSEGS);
-		__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSYNRETRANS);
+		TCP_INC_STATS(sock_net(sk), TCP_MIB_RETRANSSEGS);
+		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSYNRETRANS);
 		if (unlikely(tcp_passive_fastopen(sk)))
 			tcp_sk(sk)->total_retrans++;
 		trace_tcp_retransmit_synack(sk, req);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 069/172] gpio: pca953x: use the correct register address to do regcache sync
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (67 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 068/172] tcp: tcp_rtx_synack() can be called from process context Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 070/172] afs: Fix infinite loop found by xfstest generic/676 Greg Kroah-Hartman
                   ` (103 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Haibo Chen, Bartosz Golaszewski, Sasha Levin

From: Haibo Chen <haibo.chen@nxp.com>

[ Upstream commit 43624eda86c98b0de726d0b6f2516ccc3ef7313f ]

For regcache_sync_region, need to use pca953x_recalc_addr() to get
the real register address.

Fixes: b76574300504 ("gpio: pca953x: Restore registers after suspend/resume cycle")
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpio/gpio-pca953x.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index e936e1eb1f95..bb4ca064447e 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -1107,20 +1107,21 @@ static int pca953x_regcache_sync(struct device *dev)
 {
 	struct pca953x_chip *chip = dev_get_drvdata(dev);
 	int ret;
+	u8 regaddr;
 
 	/*
 	 * The ordering between direction and output is important,
 	 * sync these registers first and only then sync the rest.
 	 */
-	ret = regcache_sync_region(chip->regmap, chip->regs->direction,
-				   chip->regs->direction + NBANK(chip));
+	regaddr = pca953x_recalc_addr(chip, chip->regs->direction, 0);
+	ret = regcache_sync_region(chip->regmap, regaddr, regaddr + NBANK(chip));
 	if (ret) {
 		dev_err(dev, "Failed to sync GPIO dir registers: %d\n", ret);
 		return ret;
 	}
 
-	ret = regcache_sync_region(chip->regmap, chip->regs->output,
-				   chip->regs->output + NBANK(chip));
+	regaddr = pca953x_recalc_addr(chip, chip->regs->output, 0);
+	ret = regcache_sync_region(chip->regmap, regaddr, regaddr + NBANK(chip));
 	if (ret) {
 		dev_err(dev, "Failed to sync GPIO out registers: %d\n", ret);
 		return ret;
@@ -1128,16 +1129,18 @@ static int pca953x_regcache_sync(struct device *dev)
 
 #ifdef CONFIG_GPIO_PCA953X_IRQ
 	if (chip->driver_data & PCA_PCAL) {
-		ret = regcache_sync_region(chip->regmap, PCAL953X_IN_LATCH,
-					   PCAL953X_IN_LATCH + NBANK(chip));
+		regaddr = pca953x_recalc_addr(chip, PCAL953X_IN_LATCH, 0);
+		ret = regcache_sync_region(chip->regmap, regaddr,
+					   regaddr + NBANK(chip));
 		if (ret) {
 			dev_err(dev, "Failed to sync INT latch registers: %d\n",
 				ret);
 			return ret;
 		}
 
-		ret = regcache_sync_region(chip->regmap, PCAL953X_INT_MASK,
-					   PCAL953X_INT_MASK + NBANK(chip));
+		regaddr = pca953x_recalc_addr(chip, PCAL953X_INT_MASK, 0);
+		ret = regcache_sync_region(chip->regmap, regaddr,
+					   regaddr + NBANK(chip));
 		if (ret) {
 			dev_err(dev, "Failed to sync INT mask registers: %d\n",
 				ret);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 070/172] afs: Fix infinite loop found by xfstest generic/676
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (68 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 069/172] gpio: pca953x: use the correct register address to do regcache sync Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 071/172] scsi: sd: Fix potential NULL pointer dereference Greg Kroah-Hartman
                   ` (102 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, David Howells, Marc Dionne,
	linux-afs, Linus Torvalds, Sasha Levin

From: David Howells <dhowells@redhat.com>

[ Upstream commit 17eabd42560f4636648ad65ba5b20228071e2363 ]

In AFS, a directory is handled as a file that the client downloads and
parses locally for the purposes of performing lookup and getdents
operations.  The in-kernel afs filesystem has a number of functions that
do this.

A directory file is arranged as a series of 2K blocks divided into
32-byte slots, where a directory entry occupies one or more slots, plus
each block starts with one or more metadata blocks.

When parsing a block, if the last slots are occupied by a dirent that
occupies more than a single slot and the file position points at a slot
that's not the initial one, the logic in afs_dir_iterate_block() that
skips over it won't advance the file pointer to the end of it.  This
will cause an infinite loop in getdents() as it will keep retrying that
block and failing to advance beyond the final entry.

Fix this by advancing the file pointer if the next entry will be beyond
it when we skip a block.

This was found by the generic/676 xfstest but can also be triggered with
something like:

	~/xfstests-dev/src/t_readdir_3 /xfstest.test/z 4000 1

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Marc Dionne <marc.dionne@auristor.com>
Tested-by: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Link: http://lore.kernel.org/r/165391973497.110268.2939296942213894166.stgit@warthog.procyon.org.uk/
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/afs/dir.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index 262c0ae505af..159795059547 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -412,8 +412,11 @@ static int afs_dir_iterate_block(struct afs_vnode *dvnode,
 		}
 
 		/* skip if starts before the current position */
-		if (offset < curr)
+		if (offset < curr) {
+			if (next > curr)
+				ctx->pos = blkoff + next * sizeof(union afs_xdr_dirent);
 			continue;
+		}
 
 		/* found the next entry */
 		if (!dir_emit(ctx, dire->u.name, nlen,
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 071/172] scsi: sd: Fix potential NULL pointer dereference
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (69 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 070/172] afs: Fix infinite loop found by xfstest generic/676 Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 072/172] tipc: check attribute length for bearer name Greg Kroah-Hartman
                   ` (101 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dongliang Mu, Christoph Hellwig,
	Damien Le Moal, Martin K. Petersen, Sasha Levin

From: Damien Le Moal <damien.lemoal@opensource.wdc.com>

[ Upstream commit 05fbde3a77a4f1d62e4c4428f384288c1f1a0be5 ]

If sd_probe() sees an early error before sdkp->device is initialized,
sd_zbc_release_disk() is called. This causes a NULL pointer dereference
when sd_is_zoned() is called inside that function. Avoid this by removing
the call to sd_zbc_release_disk() in sd_probe() error path.

This change is safe and does not result in zone information memory leakage
because the zone information for a zoned disk is allocated only when
sd_revalidate_disk() is called, at which point sdkp->disk_dev is fully set,
resulting in sd_disk_release() being called when needed to cleanup a disk
zone information using sd_zbc_release_disk().

Link: https://lore.kernel.org/r/20220601062544.905141-2-damien.lemoal@opensource.wdc.com
Fixes: 89d947561077 ("sd: Implement support for ZBC devices")
Reported-by: Dongliang Mu <mudongliangabcd@gmail.com>
Suggested-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/sd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 56e291708587..bd068d3bb455 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3511,7 +3511,6 @@ static int sd_probe(struct device *dev)
  out_put:
 	put_disk(gd);
  out_free:
-	sd_zbc_release_disk(sdkp);
 	kfree(sdkp);
  out:
 	scsi_autopm_put_device(sdp);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 072/172] tipc: check attribute length for bearer name
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (70 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 071/172] scsi: sd: Fix potential NULL pointer dereference Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 073/172] driver core: Fix wait_for_device_probe() & deferred_probe_timeout interaction Greg Kroah-Hartman
                   ` (100 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, syzbot+e820fdc8ce362f2dea51,
	Jon Maloy, Hoang Le, Jakub Kicinski, Sasha Levin

From: Hoang Le <hoang.h.le@dektech.com.au>

[ Upstream commit 7f36f798f89bf32c0164049cb0e3fd1af613d0bb ]

syzbot reported uninit-value:
=====================================================
BUG: KMSAN: uninit-value in string_nocheck lib/vsprintf.c:644 [inline]
BUG: KMSAN: uninit-value in string+0x4f9/0x6f0 lib/vsprintf.c:725
 string_nocheck lib/vsprintf.c:644 [inline]
 string+0x4f9/0x6f0 lib/vsprintf.c:725
 vsnprintf+0x2222/0x3650 lib/vsprintf.c:2806
 vprintk_store+0x537/0x2150 kernel/printk/printk.c:2158
 vprintk_emit+0x28b/0xab0 kernel/printk/printk.c:2256
 vprintk_default+0x86/0xa0 kernel/printk/printk.c:2283
 vprintk+0x15f/0x180 kernel/printk/printk_safe.c:50
 _printk+0x18d/0x1cf kernel/printk/printk.c:2293
 tipc_enable_bearer net/tipc/bearer.c:371 [inline]
 __tipc_nl_bearer_enable+0x2022/0x22a0 net/tipc/bearer.c:1033
 tipc_nl_bearer_enable+0x6c/0xb0 net/tipc/bearer.c:1042
 genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline]

- Do sanity check the attribute length for TIPC_NLA_BEARER_NAME.
- Do not use 'illegal name' in printing message.

Reported-by: syzbot+e820fdc8ce362f2dea51@syzkaller.appspotmail.com
Fixes: cb30a63384bc ("tipc: refactor function tipc_enable_bearer()")
Acked-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
Link: https://lore.kernel.org/r/20220602063053.5892-1-hoang.h.le@dektech.com.au
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/tipc/bearer.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 6911f1cab206..72c31ef985eb 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -249,9 +249,8 @@ static int tipc_enable_bearer(struct net *net, const char *name,
 	u32 i;
 
 	if (!bearer_name_validate(name, &b_names)) {
-		errstr = "illegal name";
 		NL_SET_ERR_MSG(extack, "Illegal name");
-		goto rejected;
+		return res;
 	}
 
 	if (prio > TIPC_MAX_LINK_PRI && prio != TIPC_MEDIA_LINK_PRI) {
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 073/172] driver core: Fix wait_for_device_probe() & deferred_probe_timeout interaction
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (71 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 072/172] tipc: check attribute length for bearer name Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 074/172] perf c2c: Fix sorting in percent_rmt_hitm_cmp() Greg Kroah-Hartman
                   ` (99 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, John Stultz, David S. Miller,
	Alexey Kuznetsov, Hideaki YOSHIFUJI, Jakub Kicinski, Rob Herring,
	Geert Uytterhoeven, Yoshihiro Shimoda, Robin Murphy,
	Andy Shevchenko, Sudeep Holla, Andy Shevchenko, Naresh Kamboju,
	Basil Eljuse, Ferry Toth, Arnd Bergmann, Anders Roxell, linux-pm,
	Nathan Chancellor, Sebastian Andrzej Siewior, Geert Uytterhoeven,
	Saravana Kannan, Rafael J. Wysocki, Linus Torvalds, Sasha Levin

From: Saravana Kannan <saravanak@google.com>

[ Upstream commit 5ee76c256e928455212ab759c51d198fedbe7523 ]

Mounting NFS rootfs was timing out when deferred_probe_timeout was
non-zero [1].  This was because ip_auto_config() initcall times out
waiting for the network interfaces to show up when
deferred_probe_timeout was non-zero. While ip_auto_config() calls
wait_for_device_probe() to make sure any currently running deferred
probe work or asynchronous probe finishes, that wasn't sufficient to
account for devices being deferred until deferred_probe_timeout.

Commit 35a672363ab3 ("driver core: Ensure wait_for_device_probe() waits
until the deferred_probe_timeout fires") tried to fix that by making
sure wait_for_device_probe() waits for deferred_probe_timeout to expire
before returning.

However, if wait_for_device_probe() is called from the kernel_init()
context:

- Before deferred_probe_initcall() [2], it causes the boot process to
  hang due to a deadlock.

- After deferred_probe_initcall() [3], it blocks kernel_init() from
  continuing till deferred_probe_timeout expires and beats the point of
  deferred_probe_timeout that's trying to wait for userspace to load
  modules.

Neither of this is good. So revert the changes to
wait_for_device_probe().

[1] - https://lore.kernel.org/lkml/TYAPR01MB45443DF63B9EF29054F7C41FD8C60@TYAPR01MB4544.jpnprd01.prod.outlook.com/
[2] - https://lore.kernel.org/lkml/YowHNo4sBjr9ijZr@dev-arch.thelio-3990X/
[3] - https://lore.kernel.org/lkml/Yo3WvGnNk3LvLb7R@linutronix.de/

Fixes: 35a672363ab3 ("driver core: Ensure wait_for_device_probe() waits until the deferred_probe_timeout fires")
Cc: John Stultz <jstultz@google.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Naresh Kamboju <naresh.kamboju@linaro.org>
Cc: Basil Eljuse <Basil.Eljuse@arm.com>
Cc: Ferry Toth <fntoth@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Anders Roxell <anders.roxell@linaro.org>
Cc: linux-pm@vger.kernel.org
Reported-by: Nathan Chancellor <nathan@kernel.org>
Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: John Stultz <jstultz@google.com>
Signed-off-by: Saravana Kannan <saravanak@google.com>
Link: https://lore.kernel.org/r/20220526034609.480766-2-saravanak@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/base/dd.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 4f4e8aedbd2c..f9d9f1ad9215 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -250,7 +250,6 @@ DEFINE_SHOW_ATTRIBUTE(deferred_devs);
 
 int driver_deferred_probe_timeout;
 EXPORT_SYMBOL_GPL(driver_deferred_probe_timeout);
-static DECLARE_WAIT_QUEUE_HEAD(probe_timeout_waitqueue);
 
 static int __init deferred_probe_timeout_setup(char *str)
 {
@@ -302,7 +301,6 @@ static void deferred_probe_timeout_work_func(struct work_struct *work)
 	list_for_each_entry(p, &deferred_probe_pending_list, deferred_probe)
 		dev_info(p->device, "deferred probe pending\n");
 	mutex_unlock(&deferred_probe_mutex);
-	wake_up_all(&probe_timeout_waitqueue);
 }
 static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_work_func);
 
@@ -706,9 +704,6 @@ int driver_probe_done(void)
  */
 void wait_for_device_probe(void)
 {
-	/* wait for probe timeout */
-	wait_event(probe_timeout_waitqueue, !driver_deferred_probe_timeout);
-
 	/* wait for the deferred probe workqueue to finish */
 	flush_work(&deferred_probe_work);
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 074/172] perf c2c: Fix sorting in percent_rmt_hitm_cmp()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (72 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 073/172] driver core: Fix wait_for_device_probe() & deferred_probe_timeout interaction Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 075/172] dmaengine: idxd: set DMA_INTERRUPT cap bit Greg Kroah-Hartman
                   ` (98 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Leo Yan, Namhyung Kim,
	Alexander Shishkin, Ingo Molnar, Jiri Olsa, Joe Mario,
	Mark Rutland, Peter Zijlstra, Arnaldo Carvalho de Melo,
	Sasha Levin

From: Leo Yan <leo.yan@linaro.org>

[ Upstream commit b24192a17337abbf3f44aaa75e15df14a2d0016e ]

The function percent_rmt_hitm_cmp() wrongly uses local HITMs for
sorting remote HITMs.

Since this function is to sort cache lines for remote HITMs, this patch
changes to use 'rmt_hitm' field for correct sorting.

Fixes: 9cb3500afc0980c5 ("perf c2c report: Add hitm/store percent related sort keys")
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Joe Mario <jmario@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220530084253.750190-1-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 tools/perf/builtin-c2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 7f7111d4b3ad..fb7d01f3961b 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -918,8 +918,8 @@ percent_rmt_hitm_cmp(struct perf_hpp_fmt *fmt __maybe_unused,
 	double per_left;
 	double per_right;
 
-	per_left  = PERCENT(left, lcl_hitm);
-	per_right = PERCENT(right, lcl_hitm);
+	per_left  = PERCENT(left, rmt_hitm);
+	per_right = PERCENT(right, rmt_hitm);
 
 	return per_left - per_right;
 }
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 075/172] dmaengine: idxd: set DMA_INTERRUPT cap bit
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (73 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 074/172] perf c2c: Fix sorting in percent_rmt_hitm_cmp() Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 076/172] mips: cpc: Fix refcount leak in mips_cpc_default_phys_base Greg Kroah-Hartman
                   ` (97 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ben Walker, Dave Jiang, Vinod Koul,
	Sasha Levin

From: Dave Jiang <dave.jiang@intel.com>

[ Upstream commit 4e5a4eb20393b851590b4465f1197a8041c2076b ]

Even though idxd driver has always supported interrupt, it never actually
set the DMA_INTERRUPT cap bit. Rectify this mistake so the interrupt
capability is advertised.

Reported-by: Ben Walker <benjamin.walker@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/164971497859.2201379.17925303210723708961.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/dma/idxd/dma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/idxd/dma.c b/drivers/dma/idxd/dma.c
index aa7435555de9..d53ce22b4b8f 100644
--- a/drivers/dma/idxd/dma.c
+++ b/drivers/dma/idxd/dma.c
@@ -188,6 +188,7 @@ int idxd_register_dma_device(struct idxd_device *idxd)
 	INIT_LIST_HEAD(&dma->channels);
 	dma->dev = dev;
 
+	dma_cap_set(DMA_INTERRUPT, dma->cap_mask);
 	dma_cap_set(DMA_PRIVATE, dma->cap_mask);
 	dma_cap_set(DMA_COMPLETION_NO_ORDER, dma->cap_mask);
 	dma->device_release = idxd_dma_release;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 076/172] mips: cpc: Fix refcount leak in mips_cpc_default_phys_base
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (74 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 075/172] dmaengine: idxd: set DMA_INTERRUPT cap bit Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 077/172] bootconfig: Make the bootconfig.o as a normal object file Greg Kroah-Hartman
                   ` (96 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Gong Yuanjun, Serge Semin,
	Thomas Bogendoerfer, Sasha Levin

From: Gong Yuanjun <ruc_gongyuanjun@163.com>

[ Upstream commit 4107fa700f314592850e2c64608f6ede4c077476 ]

Add the missing of_node_put() to release the refcount incremented
by of_find_compatible_node().

Signed-off-by: Gong Yuanjun <ruc_gongyuanjun@163.com>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/mips/kernel/mips-cpc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/kernel/mips-cpc.c b/arch/mips/kernel/mips-cpc.c
index 8d2535123f11..d005be84c482 100644
--- a/arch/mips/kernel/mips-cpc.c
+++ b/arch/mips/kernel/mips-cpc.c
@@ -27,6 +27,7 @@ phys_addr_t __weak mips_cpc_default_phys_base(void)
 	cpc_node = of_find_compatible_node(of_root, NULL, "mti,mips-cpc");
 	if (cpc_node) {
 		err = of_address_to_resource(cpc_node, 0, &res);
+		of_node_put(cpc_node);
 		if (!err)
 			return res.start;
 	}
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 077/172] bootconfig: Make the bootconfig.o as a normal object file
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (75 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 076/172] mips: cpc: Fix refcount leak in mips_cpc_default_phys_base Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 078/172] tracing: Fix sleeping function called from invalid context on RT kernel Greg Kroah-Hartman
                   ` (95 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Padmanabha Srinivasaiah,
	Jonathan Corbet, Randy Dunlap, Nick Desaulniers, Sami Tolvanen,
	Nathan Chancellor, Linux Kbuild mailing list, Masahiro Yamada,
	Masami Hiramatsu, Steven Rostedt (Google),
	Sasha Levin

From: Masami Hiramatsu <mhiramat@kernel.org>

[ Upstream commit 6014a23638cdee63a71ef13c51d7c563eb5829ee ]

Since the APIs defined in the bootconfig.o are not individually used,
it is meaningless to build it as library by lib-y. Use obj-y for that.

Link: https://lkml.kernel.org/r/164921225875.1090670.15565363126983098971.stgit@devnote2

Cc: Padmanabha Srinivasaiah <treasure4paddy@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Sami Tolvanen <samitolvanen@google.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>
Reported-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 lib/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Makefile b/lib/Makefile
index d415fc7067c5..69b8217652ed 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -274,7 +274,7 @@ $(foreach file, $(libfdt_files), \
 	$(eval CFLAGS_$(file) = -I $(srctree)/scripts/dtc/libfdt))
 lib-$(CONFIG_LIBFDT) += $(libfdt_files)
 
-lib-$(CONFIG_BOOT_CONFIG) += bootconfig.o
+obj-$(CONFIG_BOOT_CONFIG) += bootconfig.o
 
 obj-$(CONFIG_RBTREE_TEST) += rbtree_test.o
 obj-$(CONFIG_INTERVAL_TREE_TEST) += interval_tree_test.o
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 078/172] tracing: Fix sleeping function called from invalid context on RT kernel
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (76 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 077/172] bootconfig: Make the bootconfig.o as a normal object file Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 079/172] tracing: Avoid adding tracer option before update_tracer_options Greg Kroah-Hartman
                   ` (94 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jun Miao, Steven Rostedt (Google),
	Sasha Levin

From: Jun Miao <jun.miao@intel.com>

[ Upstream commit 12025abdc8539ed9d5014e2d647a3fd1bd3de5cd ]

When setting bootparams="trace_event=initcall:initcall_start tp_printk=1" in the
cmdline, the output_printk() was called, and the spin_lock_irqsave() was called in the
atomic and irq disable interrupt context suitation. On the PREEMPT_RT kernel,
these locks are replaced with sleepable rt-spinlock, so the stack calltrace will
be triggered.
Fix it by raw_spin_lock_irqsave when PREEMPT_RT and "trace_event=initcall:initcall_start
tp_printk=1" enabled.

 BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:46
 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1, name: swapper/0
 preempt_count: 2, expected: 0
 RCU nest depth: 0, expected: 0
 Preemption disabled at:
 [<ffffffff8992303e>] try_to_wake_up+0x7e/0xba0
 CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.17.1-rt17+ #19 34c5812404187a875f32bee7977f7367f9679ea7
 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
 Call Trace:
  <TASK>
  dump_stack_lvl+0x60/0x8c
  dump_stack+0x10/0x12
  __might_resched.cold+0x11d/0x155
  rt_spin_lock+0x40/0x70
  trace_event_buffer_commit+0x2fa/0x4c0
  ? map_vsyscall+0x93/0x93
  trace_event_raw_event_initcall_start+0xbe/0x110
  ? perf_trace_initcall_finish+0x210/0x210
  ? probe_sched_wakeup+0x34/0x40
  ? ttwu_do_wakeup+0xda/0x310
  ? trace_hardirqs_on+0x35/0x170
  ? map_vsyscall+0x93/0x93
  do_one_initcall+0x217/0x3c0
  ? trace_event_raw_event_initcall_level+0x170/0x170
  ? push_cpu_stop+0x400/0x400
  ? cblist_init_generic+0x241/0x290
  kernel_init_freeable+0x1ac/0x347
  ? _raw_spin_unlock_irq+0x65/0x80
  ? rest_init+0xf0/0xf0
  kernel_init+0x1e/0x150
  ret_from_fork+0x22/0x30
  </TASK>

Link: https://lkml.kernel.org/r/20220419013910.894370-1-jun.miao@intel.com

Signed-off-by: Jun Miao <jun.miao@intel.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/trace/trace.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 953dd9568dd7..124e3e25e155 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2784,7 +2784,7 @@ trace_event_buffer_lock_reserve(struct trace_buffer **current_rb,
 }
 EXPORT_SYMBOL_GPL(trace_event_buffer_lock_reserve);
 
-static DEFINE_SPINLOCK(tracepoint_iter_lock);
+static DEFINE_RAW_SPINLOCK(tracepoint_iter_lock);
 static DEFINE_MUTEX(tracepoint_printk_mutex);
 
 static void output_printk(struct trace_event_buffer *fbuffer)
@@ -2812,14 +2812,14 @@ static void output_printk(struct trace_event_buffer *fbuffer)
 
 	event = &fbuffer->trace_file->event_call->event;
 
-	spin_lock_irqsave(&tracepoint_iter_lock, flags);
+	raw_spin_lock_irqsave(&tracepoint_iter_lock, flags);
 	trace_seq_init(&iter->seq);
 	iter->ent = fbuffer->entry;
 	event_call->event.funcs->trace(iter, 0, event);
 	trace_seq_putc(&iter->seq, 0);
 	printk("%s", iter->seq.buffer);
 
-	spin_unlock_irqrestore(&tracepoint_iter_lock, flags);
+	raw_spin_unlock_irqrestore(&tracepoint_iter_lock, flags);
 }
 
 int tracepoint_printk_sysctl(struct ctl_table *table, int write,
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 079/172] tracing: Avoid adding tracer option before update_tracer_options
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (77 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 078/172] tracing: Fix sleeping function called from invalid context on RT kernel Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 080/172] iommu/arm-smmu: fix possible null-ptr-deref in arm_smmu_device_probe() Greg Kroah-Hartman
                   ` (93 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, kernel test robot, Mark-PK Tsai,
	Steven Rostedt (Google),
	Sasha Levin

From: Mark-PK Tsai <mark-pk.tsai@mediatek.com>

[ Upstream commit ef9188bcc6ca1d8a2ad83e826b548e6820721061 ]

To prepare for support asynchronous tracer_init_tracefs initcall,
avoid calling create_trace_option_files before __update_tracer_options.
Otherwise, create_trace_option_files will show warning because
some tracers in trace_types list are already in tr->topts.

For example, hwlat_tracer call register_tracer in late_initcall,
and global_trace.dir is already created in tracing_init_dentry,
hwlat_tracer will be put into tr->topts.
Then if the __update_tracer_options is executed after hwlat_tracer
registered, create_trace_option_files find that hwlat_tracer is
already in tr->topts.

Link: https://lkml.kernel.org/r/20220426122407.17042-2-mark-pk.tsai@mediatek.com

Link: https://lore.kernel.org/lkml/20220322133339.GA32582@xsang-OptiPlex-9020/
Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/trace/trace.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 124e3e25e155..50200898410d 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -5907,12 +5907,18 @@ static void tracing_set_nop(struct trace_array *tr)
 	tr->current_trace = &nop_trace;
 }
 
+static bool tracer_options_updated;
+
 static void add_tracer_options(struct trace_array *tr, struct tracer *t)
 {
 	/* Only enable if the directory has been created already. */
 	if (!tr->dir)
 		return;
 
+	/* Only create trace option files after update_tracer_options finish */
+	if (!tracer_options_updated)
+		return;
+
 	create_trace_option_files(tr, t);
 }
 
@@ -8649,6 +8655,7 @@ static void __update_tracer_options(struct trace_array *tr)
 static void update_tracer_options(struct trace_array *tr)
 {
 	mutex_lock(&trace_types_lock);
+	tracer_options_updated = true;
 	__update_tracer_options(tr);
 	mutex_unlock(&trace_types_lock);
 }
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 080/172] iommu/arm-smmu: fix possible null-ptr-deref in arm_smmu_device_probe()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (78 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 079/172] tracing: Avoid adding tracer option before update_tracer_options Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 081/172] iommu/arm-smmu-v3: check return value after calling platform_get_resource() Greg Kroah-Hartman
                   ` (92 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yang Yingliang, Will Deacon, Sasha Levin

From: Yang Yingliang <yangyingliang@huawei.com>

[ Upstream commit d9ed8af1dee37f181096631fb03729ece98ba816 ]

It will cause null-ptr-deref when using 'res', if platform_get_resource()
returns NULL, so move using 'res' after devm_ioremap_resource() that
will check it to avoid null-ptr-deref.
And use devm_platform_get_and_ioremap_resource() to simplify code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20220425114136.2649310-1-yangyingliang@huawei.com
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/iommu/arm/arm-smmu/arm-smmu.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c
index df24bbe3ea4f..6b41fe229a05 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
@@ -2123,11 +2123,10 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
 	if (err)
 		return err;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ioaddr = res->start;
-	smmu->base = devm_ioremap_resource(dev, res);
+	smmu->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 	if (IS_ERR(smmu->base))
 		return PTR_ERR(smmu->base);
+	ioaddr = res->start;
 	/*
 	 * The resource size should effectively match the value of SMMU_TOP;
 	 * stash that temporarily until we know PAGESIZE to validate it with.
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 081/172] iommu/arm-smmu-v3: check return value after calling platform_get_resource()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (79 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 080/172] iommu/arm-smmu: fix possible null-ptr-deref in arm_smmu_device_probe() Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 082/172] f2fs: remove WARN_ON in f2fs_is_valid_blkaddr Greg Kroah-Hartman
                   ` (91 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yang Yingliang, Will Deacon, Sasha Levin

From: Yang Yingliang <yangyingliang@huawei.com>

[ Upstream commit b131fa8c1d2afd05d0b7598621114674289c2fbb ]

It will cause null-ptr-deref if platform_get_resource() returns NULL,
we need check the return value.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20220425114525.2651143-1-yangyingliang@huawei.com
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 483c1362cc4a..bc4cbc7542ce 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -3512,6 +3512,8 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
 
 	/* Base address */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -EINVAL;
 	if (resource_size(res) < arm_smmu_resource_size(smmu)) {
 		dev_err(dev, "MMIO region too small (%pr)\n", res);
 		return -EINVAL;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 082/172] f2fs: remove WARN_ON in f2fs_is_valid_blkaddr
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (80 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 081/172] iommu/arm-smmu-v3: check return value after calling platform_get_resource() Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 083/172] i2c: cadence: Increase timeout per message if necessary Greg Kroah-Hartman
                   ` (90 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, syzbot+763ae12a2ede1d99d4dc,
	Dongliang Mu, Chao Yu, Jaegeuk Kim, Sasha Levin

From: Dongliang Mu <mudongliangabcd@gmail.com>

[ Upstream commit dc2f78e2d4cc844a1458653d57ce1b54d4a29f21 ]

Syzbot triggers two WARNs in f2fs_is_valid_blkaddr and
__is_bitmap_valid. For example, in f2fs_is_valid_blkaddr,
if type is DATA_GENERIC_ENHANCE or DATA_GENERIC_ENHANCE_READ,
it invokes WARN_ON if blkaddr is not in the right range.
The call trace is as follows:

 f2fs_get_node_info+0x45f/0x1070
 read_node_page+0x577/0x1190
 __get_node_page.part.0+0x9e/0x10e0
 __get_node_page
 f2fs_get_node_page+0x109/0x180
 do_read_inode
 f2fs_iget+0x2a5/0x58b0
 f2fs_fill_super+0x3b39/0x7ca0

Fix these two WARNs by replacing WARN_ON with dump_stack.

Reported-by: syzbot+763ae12a2ede1d99d4dc@syzkaller.appspotmail.com
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/f2fs/checkpoint.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 77f30320f862..1c49b9959b32 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -148,7 +148,7 @@ static bool __is_bitmap_valid(struct f2fs_sb_info *sbi, block_t blkaddr,
 		f2fs_err(sbi, "Inconsistent error blkaddr:%u, sit bitmap:%d",
 			 blkaddr, exist);
 		set_sbi_flag(sbi, SBI_NEED_FSCK);
-		WARN_ON(1);
+		dump_stack();
 	}
 	return exist;
 }
@@ -186,7 +186,7 @@ bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
 			f2fs_warn(sbi, "access invalid blkaddr:%u",
 				  blkaddr);
 			set_sbi_flag(sbi, SBI_NEED_FSCK);
-			WARN_ON(1);
+			dump_stack();
 			return false;
 		} else {
 			return __is_bitmap_valid(sbi, blkaddr, type);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 083/172] i2c: cadence: Increase timeout per message if necessary
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (81 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 082/172] f2fs: remove WARN_ON in f2fs_is_valid_blkaddr Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 084/172] m68knommu: set ZERO_PAGE() to the allocated zeroed page Greg Kroah-Hartman
                   ` (89 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Lucas Tanure, Michal Simek,
	Wolfram Sang, Sasha Levin

From: Lucas Tanure <tanureal@opensource.cirrus.com>

[ Upstream commit 96789dce043f5bff8b7d62aa28d52a7c59403a84 ]

Timeout as 1 second sets an upper limit on the length
of the transfer executed, but there is no maximum length
of a write or read message set in i2c_adapter_quirks for
this controller.

This upper limit affects devices that require sending
large firmware blobs over I2C.

To remove that limitation, calculate the minimal time
necessary, plus some wiggle room, for every message and
use it instead of the default one second, if more than
one second.

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/i2c/busses/i2c-cadence.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
index c1bbc4caeb5c..50e3ddba52ba 100644
--- a/drivers/i2c/busses/i2c-cadence.c
+++ b/drivers/i2c/busses/i2c-cadence.c
@@ -724,7 +724,7 @@ static void cdns_i2c_master_reset(struct i2c_adapter *adap)
 static int cdns_i2c_process_msg(struct cdns_i2c *id, struct i2c_msg *msg,
 		struct i2c_adapter *adap)
 {
-	unsigned long time_left;
+	unsigned long time_left, msg_timeout;
 	u32 reg;
 
 	id->p_msg = msg;
@@ -749,8 +749,16 @@ static int cdns_i2c_process_msg(struct cdns_i2c *id, struct i2c_msg *msg,
 	else
 		cdns_i2c_msend(id);
 
+	/* Minimal time to execute this message */
+	msg_timeout = msecs_to_jiffies((1000 * msg->len * BITS_PER_BYTE) / id->i2c_clk);
+	/* Plus some wiggle room */
+	msg_timeout += msecs_to_jiffies(500);
+
+	if (msg_timeout < adap->timeout)
+		msg_timeout = adap->timeout;
+
 	/* Wait for the signal of completion */
-	time_left = wait_for_completion_timeout(&id->xfer_done, adap->timeout);
+	time_left = wait_for_completion_timeout(&id->xfer_done, msg_timeout);
 	if (time_left == 0) {
 		cdns_i2c_master_reset(adap);
 		dev_err(id->adap.dev.parent,
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 084/172] m68knommu: set ZERO_PAGE() to the allocated zeroed page
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (82 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 083/172] i2c: cadence: Increase timeout per message if necessary Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 085/172] m68knommu: fix undefined reference to `_init_sp Greg Kroah-Hartman
                   ` (88 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Hugh Dickens, Greg Ungerer, Sasha Levin

From: Greg Ungerer <gerg@linux-m68k.org>

[ Upstream commit dc068f46217970d9516f16cd37972a01d50dc055 ]

The non-MMU m68k pagetable ZERO_PAGE() macro is being set to the
somewhat non-sensical value of "virt_to_page(0)". The zeroth page
is not in any way guaranteed to be a page full of "0". So the result
is that ZERO_PAGE() will almost certainly contain random values.

We already allocate a real "empty_zero_page" in the mm setup code shared
between MMU m68k and non-MMU m68k. It is just not hooked up to the
ZERO_PAGE() macro for the non-MMU m68k case.

Fix ZERO_PAGE() to use the allocated "empty_zero_page" pointer.

I am not aware of any specific issues caused by the old code.

Link: https://lore.kernel.org/linux-m68k/2a462b23-5b8e-bbf4-ec7d-778434a3b9d7@google.com/T/#t
Reported-by: Hugh Dickens <hughd@google.com>
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/m68k/include/asm/pgtable_no.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/m68k/include/asm/pgtable_no.h b/arch/m68k/include/asm/pgtable_no.h
index 87151d67d91e..bce5ca56c388 100644
--- a/arch/m68k/include/asm/pgtable_no.h
+++ b/arch/m68k/include/asm/pgtable_no.h
@@ -42,7 +42,8 @@ extern void paging_init(void);
  * ZERO_PAGE is a global shared page that is always zero: used
  * for zero-mapped memory areas etc..
  */
-#define ZERO_PAGE(vaddr)	(virt_to_page(0))
+extern void *empty_zero_page;
+#define ZERO_PAGE(vaddr)	(virt_to_page(empty_zero_page))
 
 /*
  * All 32bit addresses are effectively valid for vmalloc...
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 085/172] m68knommu: fix undefined reference to `_init_sp
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (83 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 084/172] m68knommu: set ZERO_PAGE() to the allocated zeroed page Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 086/172] dmaengine: zynqmp_dma: In struct zynqmp_dma_chan fix desc_size data type Greg Kroah-Hartman
                   ` (87 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, kernel test robot,
	Geert Uytterhoeven, Greg Ungerer, Sasha Levin

From: Greg Ungerer <gerg@linux-m68k.org>

[ Upstream commit a71b9e66fee47c59b3ec34e652b5c23bc6550794 ]

When configuring a nommu classic m68k system enabling the uboot parameter
passing support (CONFIG_UBOOT) will produce the following compile error:

   m68k-linux-ld: arch/m68k/kernel/uboot.o: in function `process_uboot_commandline':
   uboot.c:(.init.text+0x32): undefined reference to `_init_sp'

The logic to support this option is only used on ColdFire based platforms
(in its head.S startup code). So make the selection of this option
depend on building for a ColdFire based platform.

Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/m68k/Kconfig.machine | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine
index 51a878803fb6..16730561d166 100644
--- a/arch/m68k/Kconfig.machine
+++ b/arch/m68k/Kconfig.machine
@@ -321,6 +321,7 @@ comment "Machine Options"
 
 config UBOOT
 	bool "Support for U-Boot command line parameters"
+	depends on COLDFIRE
 	help
 	  If you say Y here kernel will try to collect command
 	  line parameters from the initial u-boot stack.
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 086/172] dmaengine: zynqmp_dma: In struct zynqmp_dma_chan fix desc_size data type
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (84 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 085/172] m68knommu: fix undefined reference to `_init_sp Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 087/172] NFSv4: Dont hold the layoutget locks across multiple RPC calls Greg Kroah-Hartman
                   ` (86 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Radhey Shyam Pandey, Vinod Koul, Sasha Levin

From: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>

[ Upstream commit f9a9f43a62a04ec3183fb0da9226c7706eed0115 ]

In zynqmp_dma_alloc/free_chan_resources functions there is a
potential overflow in the below expressions.

dma_alloc_coherent(chan->dev, (2 * chan->desc_size *
		   ZYNQMP_DMA_NUM_DESCS),
		   &chan->desc_pool_p, GFP_KERNEL);

dma_free_coherent(chan->dev,(2 * ZYNQMP_DMA_DESC_SIZE(chan) *
                 ZYNQMP_DMA_NUM_DESCS),
                chan->desc_pool_v, chan->desc_pool_p);

The arguments desc_size and ZYNQMP_DMA_NUM_DESCS were 32 bit. Though
this overflow condition is not observed but it is a potential problem
in the case of 32-bit multiplication. Hence fix it by changing the
desc_size data type to size_t.

In addition to coverity fix it also reuse ZYNQMP_DMA_DESC_SIZE macro in
dma_alloc_coherent API argument.

Addresses-Coverity: Event overflow_before_widen.
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Link: https://lore.kernel.org/r/1652166762-18317-2-git-send-email-radhey.shyam.pandey@xilinx.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/dma/xilinx/zynqmp_dma.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index 5fecf5aa6e85..7e6be076e9d3 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -232,7 +232,7 @@ struct zynqmp_dma_chan {
 	bool is_dmacoherent;
 	struct tasklet_struct tasklet;
 	bool idle;
-	u32 desc_size;
+	size_t desc_size;
 	bool err;
 	u32 bus_width;
 	u32 src_burst_len;
@@ -490,7 +490,8 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
 	}
 
 	chan->desc_pool_v = dma_alloc_coherent(chan->dev,
-					       (2 * chan->desc_size * ZYNQMP_DMA_NUM_DESCS),
+					       (2 * ZYNQMP_DMA_DESC_SIZE(chan) *
+					       ZYNQMP_DMA_NUM_DESCS),
 					       &chan->desc_pool_p, GFP_KERNEL);
 	if (!chan->desc_pool_v)
 		return -ENOMEM;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 087/172] NFSv4: Dont hold the layoutget locks across multiple RPC calls
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (85 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 086/172] dmaengine: zynqmp_dma: In struct zynqmp_dma_chan fix desc_size data type Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 088/172] video: fbdev: hyperv_fb: Allow resolutions with size > 64 MB for Gen1 Greg Kroah-Hartman
                   ` (85 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Trond Myklebust, Anna Schumaker, Sasha Levin

From: Trond Myklebust <trond.myklebust@hammerspace.com>

[ Upstream commit 6949493884fe88500de4af182588e071cf1544ee ]

When doing layoutget as part of the open() compound, we have to be
careful to release the layout locks before we can call any further RPC
calls, such as setattr(). The reason is that those calls could trigger
a recall, which could deadlock.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/nfs/nfs4proc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index b6d60e69043a..b22da4e3165b 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3086,6 +3086,10 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
 	}
 
 out:
+	if (opendata->lgp) {
+		nfs4_lgopen_release(opendata->lgp);
+		opendata->lgp = NULL;
+	}
 	if (!opendata->cancelled)
 		nfs4_sequence_free_slot(&opendata->o_res.seq_res);
 	return ret;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 088/172] video: fbdev: hyperv_fb: Allow resolutions with size > 64 MB for Gen1
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (86 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 087/172] NFSv4: Dont hold the layoutget locks across multiple RPC calls Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 089/172] video: fbdev: pxa3xx-gcu: release the resources correctly in pxa3xx_gcu_probe/remove() Greg Kroah-Hartman
                   ` (84 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Saurabh Sengar, Dexuan Cui,
	Helge Deller, Sasha Levin

From: Saurabh Sengar <ssengar@linux.microsoft.com>

[ Upstream commit c4b4d7047f16a8d138ce76da65faefb7165736f2 ]

This patch fixes a bug where GEN1 VMs doesn't allow resolutions greater
than 64 MB size (eg 7680x4320). Unnecessary PCI check limits Gen1 VRAM
to legacy PCI BAR size only (ie 64MB). Thus any, resolution requesting
greater then 64MB (eg 7680x4320) would fail. MMIO region assigning this
memory shouldn't be limited by PCI bar size.

Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
Reviewed-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/video/fbdev/hyperv_fb.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
index 3c309ab20887..40baa79f8046 100644
--- a/drivers/video/fbdev/hyperv_fb.c
+++ b/drivers/video/fbdev/hyperv_fb.c
@@ -1008,7 +1008,6 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
 	struct pci_dev *pdev  = NULL;
 	void __iomem *fb_virt;
 	int gen2vm = efi_enabled(EFI_BOOT);
-	resource_size_t pot_start, pot_end;
 	phys_addr_t paddr;
 	int ret;
 
@@ -1059,23 +1058,7 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
 	dio_fb_size =
 		screen_width * screen_height * screen_depth / 8;
 
-	if (gen2vm) {
-		pot_start = 0;
-		pot_end = -1;
-	} else {
-		if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM) ||
-		    pci_resource_len(pdev, 0) < screen_fb_size) {
-			pr_err("Resource not available or (0x%lx < 0x%lx)\n",
-			       (unsigned long) pci_resource_len(pdev, 0),
-			       (unsigned long) screen_fb_size);
-			goto err1;
-		}
-
-		pot_end = pci_resource_end(pdev, 0);
-		pot_start = pot_end - screen_fb_size + 1;
-	}
-
-	ret = vmbus_allocate_mmio(&par->mem, hdev, pot_start, pot_end,
+	ret = vmbus_allocate_mmio(&par->mem, hdev, 0, -1,
 				  screen_fb_size, 0x100000, true);
 	if (ret != 0) {
 		pr_err("Unable to allocate framebuffer memory\n");
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 089/172] video: fbdev: pxa3xx-gcu: release the resources correctly in pxa3xx_gcu_probe/remove()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (87 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 088/172] video: fbdev: hyperv_fb: Allow resolutions with size > 64 MB for Gen1 Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 090/172] xprtrdma: treat all calls not a bcall when bc_serv is NULL Greg Kroah-Hartman
                   ` (83 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yang Yingliang, Helge Deller, Sasha Levin

From: Yang Yingliang <yangyingliang@huawei.com>

[ Upstream commit d87ad457f7e1b8d2492ca5b1531eb35030a1cc8f ]

In pxa3xx_gcu_probe(), the sequence of error lable is wrong, it will
leads some resource leaked, so adjust the sequence to handle the error
correctly, and if pxa3xx_gcu_add_buffer() fails, pxa3xx_gcu_free_buffers()
need be called.
In pxa3xx_gcu_remove(), add missing clk_disable_unpreprare().

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/video/fbdev/pxa3xx-gcu.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/video/fbdev/pxa3xx-gcu.c b/drivers/video/fbdev/pxa3xx-gcu.c
index 4279e13a3b58..9421d14d0eb0 100644
--- a/drivers/video/fbdev/pxa3xx-gcu.c
+++ b/drivers/video/fbdev/pxa3xx-gcu.c
@@ -650,6 +650,7 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev)
 	for (i = 0; i < 8; i++) {
 		ret = pxa3xx_gcu_add_buffer(dev, priv);
 		if (ret) {
+			pxa3xx_gcu_free_buffers(dev, priv);
 			dev_err(dev, "failed to allocate DMA memory\n");
 			goto err_disable_clk;
 		}
@@ -666,15 +667,15 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev)
 			SHARED_SIZE, irq);
 	return 0;
 
-err_free_dma:
-	dma_free_coherent(dev, SHARED_SIZE,
-			priv->shared, priv->shared_phys);
+err_disable_clk:
+	clk_disable_unprepare(priv->clk);
 
 err_misc_deregister:
 	misc_deregister(&priv->misc_dev);
 
-err_disable_clk:
-	clk_disable_unprepare(priv->clk);
+err_free_dma:
+	dma_free_coherent(dev, SHARED_SIZE,
+			  priv->shared, priv->shared_phys);
 
 	return ret;
 }
@@ -687,6 +688,7 @@ static int pxa3xx_gcu_remove(struct platform_device *pdev)
 	pxa3xx_gcu_wait_idle(priv);
 	misc_deregister(&priv->misc_dev);
 	dma_free_coherent(dev, SHARED_SIZE, priv->shared, priv->shared_phys);
+	clk_disable_unprepare(priv->clk);
 	pxa3xx_gcu_free_buffers(dev, priv);
 
 	return 0;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 090/172] xprtrdma: treat all calls not a bcall when bc_serv is NULL
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (88 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 089/172] video: fbdev: pxa3xx-gcu: release the resources correctly in pxa3xx_gcu_probe/remove() Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 091/172] netfilter: nat: really support inet nat without l3 address Greg Kroah-Hartman
                   ` (82 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Kinglong Mee, Chuck Lever,
	Anna Schumaker, Sasha Levin

From: Kinglong Mee <kinglongmee@gmail.com>

[ Upstream commit 11270e7ca268e8d61b5d9e5c3a54bd1550642c9c ]

When a rdma server returns a fault format reply, nfs v3 client may
treats it as a bcall when bc service is not exist.

The debug message at rpcrdma_bc_receive_call are,

[56579.837169] RPC:       rpcrdma_bc_receive_call: callback XID
00000001, length=20
[56579.837174] RPC:       rpcrdma_bc_receive_call: 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 04

After that, rpcrdma_bc_receive_call will meets NULL pointer as,

[  226.057890] BUG: unable to handle kernel NULL pointer dereference at
00000000000000c8
...
[  226.058704] RIP: 0010:_raw_spin_lock+0xc/0x20
...
[  226.059732] Call Trace:
[  226.059878]  rpcrdma_bc_receive_call+0x138/0x327 [rpcrdma]
[  226.060011]  __ib_process_cq+0x89/0x170 [ib_core]
[  226.060092]  ib_cq_poll_work+0x26/0x80 [ib_core]
[  226.060257]  process_one_work+0x1a7/0x360
[  226.060367]  ? create_worker+0x1a0/0x1a0
[  226.060440]  worker_thread+0x30/0x390
[  226.060500]  ? create_worker+0x1a0/0x1a0
[  226.060574]  kthread+0x116/0x130
[  226.060661]  ? kthread_flush_work_fn+0x10/0x10
[  226.060724]  ret_from_fork+0x35/0x40
...

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/sunrpc/xprtrdma/rpc_rdma.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
index ca267a855a12..b8174c77dfe1 100644
--- a/net/sunrpc/xprtrdma/rpc_rdma.c
+++ b/net/sunrpc/xprtrdma/rpc_rdma.c
@@ -1137,6 +1137,7 @@ static bool
 rpcrdma_is_bcall(struct rpcrdma_xprt *r_xprt, struct rpcrdma_rep *rep)
 #if defined(CONFIG_SUNRPC_BACKCHANNEL)
 {
+	struct rpc_xprt *xprt = &r_xprt->rx_xprt;
 	struct xdr_stream *xdr = &rep->rr_stream;
 	__be32 *p;
 
@@ -1160,6 +1161,10 @@ rpcrdma_is_bcall(struct rpcrdma_xprt *r_xprt, struct rpcrdma_rep *rep)
 	if (*p != cpu_to_be32(RPC_CALL))
 		return false;
 
+	/* No bc service. */
+	if (xprt->bc_serv == NULL)
+		return false;
+
 	/* Now that we are sure this is a backchannel call,
 	 * advance to the RPC header.
 	 */
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 091/172] netfilter: nat: really support inet nat without l3 address
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (89 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 090/172] xprtrdma: treat all calls not a bcall when bc_serv is NULL Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 092/172] netfilter: nf_tables: delete flowtable hooks via transaction list Greg Kroah-Hartman
                   ` (81 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yi Chen, Florian Westphal,
	Pablo Neira Ayuso, Sasha Levin

From: Florian Westphal <fw@strlen.de>

[ Upstream commit 282e5f8fe907dc3f2fbf9f2103b0e62ffc3a68a5 ]

When no l3 address is given, priv->family is set to NFPROTO_INET and
the evaluation function isn't called.

Call it too so l4-only rewrite can work.
Also add a test case for this.

Fixes: a33f387ecd5aa ("netfilter: nft_nat: allow to specify layer 4 protocol NAT only")
Reported-by: Yi Chen <yiche@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/netfilter/nft_nat.c                      |  3 +-
 tools/testing/selftests/netfilter/nft_nat.sh | 43 ++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/nft_nat.c b/net/netfilter/nft_nat.c
index ea53fd999f46..6a4a5ac88db7 100644
--- a/net/netfilter/nft_nat.c
+++ b/net/netfilter/nft_nat.c
@@ -341,7 +341,8 @@ static void nft_nat_inet_eval(const struct nft_expr *expr,
 {
 	const struct nft_nat *priv = nft_expr_priv(expr);
 
-	if (priv->family == nft_pf(pkt))
+	if (priv->family == nft_pf(pkt) ||
+	    priv->family == NFPROTO_INET)
 		nft_nat_eval(expr, regs, pkt);
 }
 
diff --git a/tools/testing/selftests/netfilter/nft_nat.sh b/tools/testing/selftests/netfilter/nft_nat.sh
index d7e07f4c3d7f..4e15e8167310 100755
--- a/tools/testing/selftests/netfilter/nft_nat.sh
+++ b/tools/testing/selftests/netfilter/nft_nat.sh
@@ -374,6 +374,45 @@ EOF
 	return $lret
 }
 
+test_local_dnat_portonly()
+{
+	local family=$1
+	local daddr=$2
+	local lret=0
+	local sr_s
+	local sr_r
+
+ip netns exec "$ns0" nft -f /dev/stdin <<EOF
+table $family nat {
+	chain output {
+		type nat hook output priority 0; policy accept;
+		meta l4proto tcp dnat to :2000
+
+	}
+}
+EOF
+	if [ $? -ne 0 ]; then
+		if [ $family = "inet" ];then
+			echo "SKIP: inet port test"
+			test_inet_nat=false
+			return
+		fi
+		echo "SKIP: Could not add $family dnat hook"
+		return
+	fi
+
+	echo SERVER-$family | ip netns exec "$ns1" timeout 5 socat -u STDIN TCP-LISTEN:2000 &
+	sc_s=$!
+
+	result=$(ip netns exec "$ns0" timeout 1 socat TCP:$daddr:2000 STDOUT)
+
+	if [ "$result" = "SERVER-inet" ];then
+		echo "PASS: inet port rewrite without l3 address"
+	else
+		echo "ERROR: inet port rewrite"
+		ret=1
+	fi
+}
 
 test_masquerade6()
 {
@@ -841,6 +880,10 @@ fi
 reset_counters
 test_local_dnat ip
 test_local_dnat6 ip6
+
+reset_counters
+test_local_dnat_portonly inet 10.0.1.99
+
 reset_counters
 $test_inet_nat && test_local_dnat inet
 $test_inet_nat && test_local_dnat6 inet
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 092/172] netfilter: nf_tables: delete flowtable hooks via transaction list
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (90 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 091/172] netfilter: nat: really support inet nat without l3 address Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 093/172] powerpc/kasan: Force thread size increase with KASAN Greg Kroah-Hartman
                   ` (80 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Pablo Neira Ayuso, Sasha Levin

From: Pablo Neira Ayuso <pablo@netfilter.org>

[ Upstream commit b6d9014a3335194590abdd2a2471ef5147a67645 ]

Remove inactive bool field in nft_hook object that was introduced in
abadb2f865d7 ("netfilter: nf_tables: delete devices from flowtable").
Move stale flowtable hooks to transaction list instead.

Deleting twice the same device does not result in ENOENT.

Fixes: abadb2f865d7 ("netfilter: nf_tables: delete devices from flowtable")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/net/netfilter/nf_tables.h |  1 -
 net/netfilter/nf_tables_api.c     | 31 ++++++-------------------------
 2 files changed, 6 insertions(+), 26 deletions(-)

diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 76bfb6cd5815..b7907385a02f 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -1013,7 +1013,6 @@ struct nft_stats {
 
 struct nft_hook {
 	struct list_head	list;
-	bool			inactive;
 	struct nf_hook_ops	ops;
 	struct rcu_head		rcu;
 };
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index ea162e36e0e4..a5779790e337 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -1733,7 +1733,6 @@ static struct nft_hook *nft_netdev_hook_alloc(struct net *net,
 		goto err_hook_dev;
 	}
 	hook->ops.dev = dev;
-	hook->inactive = false;
 
 	return hook;
 
@@ -6880,6 +6879,7 @@ static int nft_delflowtable_hook(struct nft_ctx *ctx,
 {
 	const struct nlattr * const *nla = ctx->nla;
 	struct nft_flowtable_hook flowtable_hook;
+	LIST_HEAD(flowtable_del_list);
 	struct nft_hook *this, *hook;
 	struct nft_trans *trans;
 	int err;
@@ -6895,7 +6895,7 @@ static int nft_delflowtable_hook(struct nft_ctx *ctx,
 			err = -ENOENT;
 			goto err_flowtable_del_hook;
 		}
-		hook->inactive = true;
+		list_move(&hook->list, &flowtable_del_list);
 	}
 
 	trans = nft_trans_alloc(ctx, NFT_MSG_DELFLOWTABLE,
@@ -6908,6 +6908,7 @@ static int nft_delflowtable_hook(struct nft_ctx *ctx,
 	nft_trans_flowtable(trans) = flowtable;
 	nft_trans_flowtable_update(trans) = true;
 	INIT_LIST_HEAD(&nft_trans_flowtable_hooks(trans));
+	list_splice(&flowtable_del_list, &nft_trans_flowtable_hooks(trans));
 	nft_flowtable_hook_release(&flowtable_hook);
 
 	list_add_tail(&trans->list, &ctx->net->nft.commit_list);
@@ -6915,13 +6916,7 @@ static int nft_delflowtable_hook(struct nft_ctx *ctx,
 	return 0;
 
 err_flowtable_del_hook:
-	list_for_each_entry(this, &flowtable_hook.list, list) {
-		hook = nft_hook_list_find(&flowtable->hook_list, this);
-		if (!hook)
-			break;
-
-		hook->inactive = false;
-	}
+	list_splice(&flowtable_del_list, &flowtable->hook_list);
 	nft_flowtable_hook_release(&flowtable_hook);
 
 	return err;
@@ -7771,17 +7766,6 @@ void nft_chain_del(struct nft_chain *chain)
 	list_del_rcu(&chain->list);
 }
 
-static void nft_flowtable_hooks_del(struct nft_flowtable *flowtable,
-				    struct list_head *hook_list)
-{
-	struct nft_hook *hook, *next;
-
-	list_for_each_entry_safe(hook, next, &flowtable->hook_list, list) {
-		if (hook->inactive)
-			list_move(&hook->list, hook_list);
-	}
-}
-
 static void nf_tables_module_autoload_cleanup(struct net *net)
 {
 	struct nft_module_request *req, *next;
@@ -8045,8 +8029,6 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
 			break;
 		case NFT_MSG_DELFLOWTABLE:
 			if (nft_trans_flowtable_update(trans)) {
-				nft_flowtable_hooks_del(nft_trans_flowtable(trans),
-							&nft_trans_flowtable_hooks(trans));
 				nf_tables_flowtable_notify(&trans->ctx,
 							   nft_trans_flowtable(trans),
 							   &nft_trans_flowtable_hooks(trans),
@@ -8124,7 +8106,6 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
 {
 	struct nft_trans *trans, *next;
 	struct nft_trans_elem *te;
-	struct nft_hook *hook;
 
 	if (action == NFNL_ABORT_VALIDATE &&
 	    nf_tables_validate(net) < 0)
@@ -8242,8 +8223,8 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
 			break;
 		case NFT_MSG_DELFLOWTABLE:
 			if (nft_trans_flowtable_update(trans)) {
-				list_for_each_entry(hook, &nft_trans_flowtable(trans)->hook_list, list)
-					hook->inactive = false;
+				list_splice(&nft_trans_flowtable_hooks(trans),
+					    &nft_trans_flowtable(trans)->hook_list);
 			} else {
 				trans->ctx.table->use++;
 				nft_clear(trans->ctx.net, nft_trans_flowtable(trans));
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 093/172] powerpc/kasan: Force thread size increase with KASAN
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (91 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 092/172] netfilter: nf_tables: delete flowtable hooks via transaction list Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 094/172] netfilter: nf_tables: always initialize flowtable hook list in transaction Greg Kroah-Hartman
                   ` (79 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Erhard Furtner, Christophe Leroy,
	Michael Ellerman, Sasha Levin

From: Michael Ellerman <mpe@ellerman.id.au>

[ Upstream commit 3e8635fb2e072672cbc650989ffedf8300ad67fb ]

KASAN causes increased stack usage, which can lead to stack overflows.

The logic in Kconfig to suggest a larger default doesn't work if a user
has CONFIG_EXPERT enabled and has an existing .config with a smaller
value.

Follow the lead of x86 and arm64, and force the thread size to be
increased when KASAN is enabled.

That also has the effect of enlarging the stack for 64-bit KASAN builds,
which is also desirable.

Fixes: edbadaf06710 ("powerpc/kasan: Fix stack overflow by increasing THREAD_SHIFT")
Reported-by: Erhard Furtner <erhard_f@mailbox.org>
Reported-by: Christophe Leroy <christophe.leroy@csgroup.eu>
[mpe: Use MIN_THREAD_SHIFT as suggested by Christophe]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220601143114.133524-1-mpe@ellerman.id.au
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/Kconfig                   |  1 -
 arch/powerpc/include/asm/thread_info.h | 10 ++++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 5afa0ebd78ca..78dd6be8b31d 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -786,7 +786,6 @@ config THREAD_SHIFT
 	range 13 15
 	default "15" if PPC_256K_PAGES
 	default "14" if PPC64
-	default "14" if KASAN
 	default "13"
 	help
 	  Used to define the stack size. The default is almost always what you
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index 46a210b03d2b..6de3517bea94 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -14,10 +14,16 @@
 
 #ifdef __KERNEL__
 
-#if defined(CONFIG_VMAP_STACK) && CONFIG_THREAD_SHIFT < PAGE_SHIFT
+#ifdef CONFIG_KASAN
+#define MIN_THREAD_SHIFT	(CONFIG_THREAD_SHIFT + 1)
+#else
+#define MIN_THREAD_SHIFT	CONFIG_THREAD_SHIFT
+#endif
+
+#if defined(CONFIG_VMAP_STACK) && MIN_THREAD_SHIFT < PAGE_SHIFT
 #define THREAD_SHIFT		PAGE_SHIFT
 #else
-#define THREAD_SHIFT		CONFIG_THREAD_SHIFT
+#define THREAD_SHIFT		MIN_THREAD_SHIFT
 #endif
 
 #define THREAD_SIZE		(1 << THREAD_SHIFT)
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 094/172] netfilter: nf_tables: always initialize flowtable hook list in transaction
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (92 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 093/172] powerpc/kasan: Force thread size increase with KASAN Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 095/172] ata: pata_octeon_cf: Fix refcount leak in octeon_cf_probe Greg Kroah-Hartman
                   ` (78 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Pablo Neira Ayuso, Sasha Levin

From: Pablo Neira Ayuso <pablo@netfilter.org>

[ Upstream commit 2c9e4559773c261900c674a86b8e455911675d71 ]

The hook list is used if nft_trans_flowtable_update(trans) == true. However,
initialize this list for other cases for safety reasons.

Fixes: 78d9f48f7f44 ("netfilter: nf_tables: add devices to existing flowtable")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/netfilter/nf_tables_api.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index a5779790e337..b90e45f1ffa0 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -481,6 +481,7 @@ static int nft_trans_flowtable_add(struct nft_ctx *ctx, int msg_type,
 	if (msg_type == NFT_MSG_NEWFLOWTABLE)
 		nft_activate_next(ctx->net, flowtable);
 
+	INIT_LIST_HEAD(&nft_trans_flowtable_hooks(trans));
 	nft_trans_flowtable(trans) = flowtable;
 	list_add_tail(&trans->list, &ctx->net->nft.commit_list);
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 095/172] ata: pata_octeon_cf: Fix refcount leak in octeon_cf_probe
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (93 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 094/172] netfilter: nf_tables: always initialize flowtable hook list in transaction Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 096/172] netfilter: nf_tables: release new hooks on unsupported flowtable flags Greg Kroah-Hartman
                   ` (77 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Miaoqian Lin, Sergey Shtylyov,
	Damien Le Moal, Sasha Levin

From: Miaoqian Lin <linmq006@gmail.com>

[ Upstream commit 10d6bdf532902be1d8aa5900b3c03c5671612aa2 ]

of_find_device_by_node() takes reference, we should use put_device()
to release it when not need anymore.
Add missing put_device() to avoid refcount leak.

Fixes: 43f01da0f279 ("MIPS/OCTEON/ata: Convert pata_octeon_cf.c to use device tree.")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/ata/pata_octeon_cf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
index b5a3f710d76d..4cc8a1027888 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -888,12 +888,14 @@ static int octeon_cf_probe(struct platform_device *pdev)
 				int i;
 				res_dma = platform_get_resource(dma_dev, IORESOURCE_MEM, 0);
 				if (!res_dma) {
+					put_device(&dma_dev->dev);
 					of_node_put(dma_node);
 					return -EINVAL;
 				}
 				cf_port->dma_base = (u64)devm_ioremap(&pdev->dev, res_dma->start,
 									 resource_size(res_dma));
 				if (!cf_port->dma_base) {
+					put_device(&dma_dev->dev);
 					of_node_put(dma_node);
 					return -EINVAL;
 				}
@@ -903,6 +905,7 @@ static int octeon_cf_probe(struct platform_device *pdev)
 					irq = i;
 					irq_handler = octeon_cf_interrupt;
 				}
+				put_device(&dma_dev->dev);
 			}
 			of_node_put(dma_node);
 		}
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 096/172] netfilter: nf_tables: release new hooks on unsupported flowtable flags
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (94 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 095/172] ata: pata_octeon_cf: Fix refcount leak in octeon_cf_probe Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 097/172] netfilter: nf_tables: memleak flow rule from commit path Greg Kroah-Hartman
                   ` (76 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Pablo Neira Ayuso, Sasha Levin

From: Pablo Neira Ayuso <pablo@netfilter.org>

[ Upstream commit c271cc9febaaa1bcbc0842d1ee30466aa6148ea8 ]

Release the list of new hooks that are pending to be registered in case
that unsupported flowtable flags are provided.

Fixes: 78d9f48f7f44 ("netfilter: nf_tables: add devices to existing flowtable")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/netfilter/nf_tables_api.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index b90e45f1ffa0..2872722488c9 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -6694,11 +6694,15 @@ static int nft_flowtable_update(struct nft_ctx *ctx, const struct nlmsghdr *nlh,
 
 	if (nla[NFTA_FLOWTABLE_FLAGS]) {
 		flags = ntohl(nla_get_be32(nla[NFTA_FLOWTABLE_FLAGS]));
-		if (flags & ~NFT_FLOWTABLE_MASK)
-			return -EOPNOTSUPP;
+		if (flags & ~NFT_FLOWTABLE_MASK) {
+			err = -EOPNOTSUPP;
+			goto err_flowtable_update_hook;
+		}
 		if ((flowtable->data.flags & NFT_FLOWTABLE_HW_OFFLOAD) ^
-		    (flags & NFT_FLOWTABLE_HW_OFFLOAD))
-			return -EOPNOTSUPP;
+		    (flags & NFT_FLOWTABLE_HW_OFFLOAD)) {
+			err = -EOPNOTSUPP;
+			goto err_flowtable_update_hook;
+		}
 	} else {
 		flags = flowtable->data.flags;
 	}
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 097/172] netfilter: nf_tables: memleak flow rule from commit path
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (95 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 096/172] netfilter: nf_tables: release new hooks on unsupported flowtable flags Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 098/172] netfilter: nf_tables: bail out early if hardware offload is not supported Greg Kroah-Hartman
                   ` (75 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Pablo Neira Ayuso, Sasha Levin

From: Pablo Neira Ayuso <pablo@netfilter.org>

[ Upstream commit 9dd732e0bdf538b1b76dc7c157e2b5e560ff30d3 ]

Abort path release flow rule object, however, commit path does not.
Update code to destroy these objects before releasing the transaction.

Fixes: c9626a2cbdb2 ("netfilter: nf_tables: add hardware offload support")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/netfilter/nf_tables_api.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 2872722488c9..8507c1bdd736 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -7587,6 +7587,9 @@ static void nft_commit_release(struct nft_trans *trans)
 		nf_tables_chain_destroy(&trans->ctx);
 		break;
 	case NFT_MSG_DELRULE:
+		if (trans->ctx.chain->flags & NFT_CHAIN_HW_OFFLOAD)
+			nft_flow_rule_destroy(nft_trans_flow_rule(trans));
+
 		nf_tables_rule_destroy(&trans->ctx, nft_trans_rule(trans));
 		break;
 	case NFT_MSG_DELSET:
@@ -7946,6 +7949,9 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
 			nf_tables_rule_notify(&trans->ctx,
 					      nft_trans_rule(trans),
 					      NFT_MSG_NEWRULE);
+			if (trans->ctx.chain->flags & NFT_CHAIN_HW_OFFLOAD)
+				nft_flow_rule_destroy(nft_trans_flow_rule(trans));
+
 			nft_trans_destroy(trans);
 			break;
 		case NFT_MSG_DELRULE:
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 098/172] netfilter: nf_tables: bail out early if hardware offload is not supported
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (96 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 097/172] netfilter: nf_tables: memleak flow rule from commit path Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:10 ` [PATCH 5.10 099/172] xen: unexport __init-annotated xen_xlate_map_ballooned_pages() Greg Kroah-Hartman
                   ` (74 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Pablo Neira Ayuso, Sasha Levin

From: Pablo Neira Ayuso <pablo@netfilter.org>

[ Upstream commit 3a41c64d9c1185a2f3a184015e2a9b78bfc99c71 ]

If user requests for NFT_CHAIN_HW_OFFLOAD, then check if either device
provides the .ndo_setup_tc interface or there is an indirect flow block
that has been registered. Otherwise, bail out early from the preparation
phase. Moreover, validate that family == NFPROTO_NETDEV and hook is
NF_NETDEV_INGRESS.

Fixes: c9626a2cbdb2 ("netfilter: nf_tables: add hardware offload support")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/net/flow_offload.h                |  1 +
 include/net/netfilter/nf_tables_offload.h |  2 +-
 net/core/flow_offload.c                   |  6 ++++++
 net/netfilter/nf_tables_api.c             |  2 +-
 net/netfilter/nf_tables_offload.c         | 23 ++++++++++++++++++++++-
 5 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h
index 010d58159887..9a58274e6217 100644
--- a/include/net/flow_offload.h
+++ b/include/net/flow_offload.h
@@ -568,5 +568,6 @@ int flow_indr_dev_setup_offload(struct net_device *dev, struct Qdisc *sch,
 				enum tc_setup_type type, void *data,
 				struct flow_block_offload *bo,
 				void (*cleanup)(struct flow_block_cb *block_cb));
+bool flow_indr_dev_exists(void);
 
 #endif /* _NET_FLOW_OFFLOAD_H */
diff --git a/include/net/netfilter/nf_tables_offload.h b/include/net/netfilter/nf_tables_offload.h
index 7a453a35a41d..1058f38e2aca 100644
--- a/include/net/netfilter/nf_tables_offload.h
+++ b/include/net/netfilter/nf_tables_offload.h
@@ -91,7 +91,7 @@ int nft_flow_rule_offload_commit(struct net *net);
 	NFT_OFFLOAD_MATCH(__key, __base, __field, __len, __reg)		\
 	memset(&(__reg)->mask, 0xff, (__reg)->len);
 
-int nft_chain_offload_priority(struct nft_base_chain *basechain);
+bool nft_chain_offload_support(const struct nft_base_chain *basechain);
 
 int nft_offload_init(void);
 void nft_offload_exit(void);
diff --git a/net/core/flow_offload.c b/net/core/flow_offload.c
index e3f0d5906811..8d958290b7d2 100644
--- a/net/core/flow_offload.c
+++ b/net/core/flow_offload.c
@@ -566,3 +566,9 @@ int flow_indr_dev_setup_offload(struct net_device *dev,	struct Qdisc *sch,
 	return list_empty(&bo->cb_list) ? -EOPNOTSUPP : 0;
 }
 EXPORT_SYMBOL(flow_indr_dev_setup_offload);
+
+bool flow_indr_dev_exists(void)
+{
+	return !list_empty(&flow_block_indr_dev_list);
+}
+EXPORT_SYMBOL(flow_indr_dev_exists);
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 8507c1bdd736..0c56a90c3f08 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -1963,7 +1963,7 @@ static int nft_basechain_init(struct nft_base_chain *basechain, u8 family,
 	chain->flags |= NFT_CHAIN_BASE | flags;
 	basechain->policy = NF_ACCEPT;
 	if (chain->flags & NFT_CHAIN_HW_OFFLOAD &&
-	    nft_chain_offload_priority(basechain) < 0)
+	    !nft_chain_offload_support(basechain))
 		return -EOPNOTSUPP;
 
 	flow_block_init(&basechain->flow_block);
diff --git a/net/netfilter/nf_tables_offload.c b/net/netfilter/nf_tables_offload.c
index 839fd09f1bb4..4e99b1731b3f 100644
--- a/net/netfilter/nf_tables_offload.c
+++ b/net/netfilter/nf_tables_offload.c
@@ -208,7 +208,7 @@ static int nft_setup_cb_call(enum tc_setup_type type, void *type_data,
 	return 0;
 }
 
-int nft_chain_offload_priority(struct nft_base_chain *basechain)
+static int nft_chain_offload_priority(const struct nft_base_chain *basechain)
 {
 	if (basechain->ops.priority <= 0 ||
 	    basechain->ops.priority > USHRT_MAX)
@@ -217,6 +217,27 @@ int nft_chain_offload_priority(struct nft_base_chain *basechain)
 	return 0;
 }
 
+bool nft_chain_offload_support(const struct nft_base_chain *basechain)
+{
+	struct net_device *dev;
+	struct nft_hook *hook;
+
+	if (nft_chain_offload_priority(basechain) < 0)
+		return false;
+
+	list_for_each_entry(hook, &basechain->hook_list, list) {
+		if (hook->ops.pf != NFPROTO_NETDEV ||
+		    hook->ops.hooknum != NF_NETDEV_INGRESS)
+			return false;
+
+		dev = hook->ops.dev;
+		if (!dev->netdev_ops->ndo_setup_tc && !flow_indr_dev_exists())
+			return false;
+	}
+
+	return true;
+}
+
 static void nft_flow_cls_offload_setup(struct flow_cls_offload *cls_flow,
 				       const struct nft_base_chain *basechain,
 				       const struct nft_rule *rule,
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 099/172] xen: unexport __init-annotated xen_xlate_map_ballooned_pages()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (97 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 098/172] netfilter: nf_tables: bail out early if hardware offload is not supported Greg Kroah-Hartman
@ 2022-06-13 10:10 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 100/172] af_unix: Fix a data-race in unix_dgram_peer_wake_me() Greg Kroah-Hartman
                   ` (73 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Stephen Rothwell, Masahiro Yamada,
	Oleksandr Tyshchenko, Stefano Stabellini, Juergen Gross,
	Sasha Levin

From: Masahiro Yamada <masahiroy@kernel.org>

[ Upstream commit dbac14a5a05ff8e1ce7c0da0e1f520ce39ec62ea ]

EXPORT_SYMBOL and __init is a bad combination because the .init.text
section is freed up after the initialization. Hence, modules cannot
use symbols annotated __init. The access to a freed symbol may end up
with kernel panic.

modpost used to detect it, but it has been broken for a decade.

Recently, I fixed modpost so it started to warn it again, then this
showed up in linux-next builds.

There are two ways to fix it:

  - Remove __init
  - Remove EXPORT_SYMBOL

I chose the latter for this case because none of the in-tree call-sites
(arch/arm/xen/enlighten.c, arch/x86/xen/grant-table.c) is compiled as
modular.

Fixes: 243848fc018c ("xen/grant-table: Move xlated_setup_gnttab_pages to common place")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
Link: https://lore.kernel.org/r/20220606045920.4161881-1-masahiroy@kernel.org
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/xen/xlate_mmu.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/xen/xlate_mmu.c b/drivers/xen/xlate_mmu.c
index 34742c6e189e..f17c4c03db30 100644
--- a/drivers/xen/xlate_mmu.c
+++ b/drivers/xen/xlate_mmu.c
@@ -261,7 +261,6 @@ int __init xen_xlate_map_ballooned_pages(xen_pfn_t **gfns, void **virt,
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(xen_xlate_map_ballooned_pages);
 
 struct remap_pfn {
 	struct mm_struct *mm;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 100/172] af_unix: Fix a data-race in unix_dgram_peer_wake_me().
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (98 preceding siblings ...)
  2022-06-13 10:10 ` [PATCH 5.10 099/172] xen: unexport __init-annotated xen_xlate_map_ballooned_pages() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 101/172] bpf, arm64: Clear prog->jited_len along prog->jited Greg Kroah-Hartman
                   ` (72 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Kuniyuki Iwashima, Paolo Abeni, Sasha Levin

From: Kuniyuki Iwashima <kuniyu@amazon.com>

[ Upstream commit 662a80946ce13633ae90a55379f1346c10f0c432 ]

unix_dgram_poll() calls unix_dgram_peer_wake_me() without `other`'s
lock held and check if its receive queue is full.  Here we need to
use unix_recvq_full_lockless() instead of unix_recvq_full(), otherwise
KCSAN will report a data-race.

Fixes: 7d267278a9ec ("unix: avoid use-after-free in ep_remove_wait_queue")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/r/20220605232325.11804-1-kuniyu@amazon.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/unix/af_unix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index b7edca89e0ba..28721e9575b7 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -438,7 +438,7 @@ static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other)
 	 * -ECONNREFUSED. Otherwise, if we haven't queued any skbs
 	 * to other and its full, we will hang waiting for POLLOUT.
 	 */
-	if (unix_recvq_full(other) && !sock_flag(other, SOCK_DEAD))
+	if (unix_recvq_full_lockless(other) && !sock_flag(other, SOCK_DEAD))
 		return 1;
 
 	if (connected)
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 101/172] bpf, arm64: Clear prog->jited_len along prog->jited
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (99 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 100/172] af_unix: Fix a data-race in unix_dgram_peer_wake_me() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 102/172] net: dsa: lantiq_gswip: Fix refcount leak in gswip_gphy_fw_list Greg Kroah-Hartman
                   ` (71 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, syzbot, Eric Dumazet,
	Daniel Borkmann, Song Liu, Alexei Starovoitov, Sasha Levin

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 10f3b29c65bb2fe0d47c2945cd0b4087be1c5218 ]

syzbot reported an illegal copy_to_user() attempt
from bpf_prog_get_info_by_fd() [1]

There was no repro yet on this bug, but I think
that commit 0aef499f3172 ("mm/usercopy: Detect vmalloc overruns")
is exposing a prior bug in bpf arm64.

bpf_prog_get_info_by_fd() looks at prog->jited_len
to determine if the JIT image can be copied out to user space.

My theory is that syzbot managed to get a prog where prog->jited_len
has been set to 43, while prog->bpf_func has ben cleared.

It is not clear why copy_to_user(uinsns, NULL, ulen) is triggering
this particular warning.

I thought find_vma_area(NULL) would not find a vm_struct.
As we do not hold vmap_area_lock spinlock, it might be possible
that the found vm_struct was garbage.

[1]
usercopy: Kernel memory exposure attempt detected from vmalloc (offset 792633534417210172, size 43)!
kernel BUG at mm/usercopy.c:101!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 25002 Comm: syz-executor.1 Not tainted 5.18.0-syzkaller-10139-g8291eaafed36 #0
Hardware name: linux,dummy-virt (DT)
pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : usercopy_abort+0x90/0x94 mm/usercopy.c:101
lr : usercopy_abort+0x90/0x94 mm/usercopy.c:89
sp : ffff80000b773a20
x29: ffff80000b773a30 x28: faff80000b745000 x27: ffff80000b773b48
x26: 0000000000000000 x25: 000000000000002b x24: 0000000000000000
x23: 00000000000000e0 x22: ffff80000b75db67 x21: 0000000000000001
x20: 000000000000002b x19: ffff80000b75db3c x18: 00000000fffffffd
x17: 2820636f6c6c616d x16: 76206d6f72662064 x15: 6574636574656420
x14: 74706d6574746120 x13: 2129333420657a69 x12: 73202c3237313031
x11: 3237313434333533 x10: 3336323937207465 x9 : 657275736f707865
x8 : ffff80000a30c550 x7 : ffff80000b773830 x6 : ffff80000b773830
x5 : 0000000000000000 x4 : ffff00007fbbaa10 x3 : 0000000000000000
x2 : 0000000000000000 x1 : f7ff000028fc0000 x0 : 0000000000000064
Call trace:
 usercopy_abort+0x90/0x94 mm/usercopy.c:89
 check_heap_object mm/usercopy.c:186 [inline]
 __check_object_size mm/usercopy.c:252 [inline]
 __check_object_size+0x198/0x36c mm/usercopy.c:214
 check_object_size include/linux/thread_info.h:199 [inline]
 check_copy_size include/linux/thread_info.h:235 [inline]
 copy_to_user include/linux/uaccess.h:159 [inline]
 bpf_prog_get_info_by_fd.isra.0+0xf14/0xfdc kernel/bpf/syscall.c:3993
 bpf_obj_get_info_by_fd+0x12c/0x510 kernel/bpf/syscall.c:4253
 __sys_bpf+0x900/0x2150 kernel/bpf/syscall.c:4956
 __do_sys_bpf kernel/bpf/syscall.c:5021 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5019 [inline]
 __arm64_sys_bpf+0x28/0x40 kernel/bpf/syscall.c:5019
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x48/0x114 arch/arm64/kernel/syscall.c:52
 el0_svc_common.constprop.0+0x44/0xec arch/arm64/kernel/syscall.c:142
 do_el0_svc+0xa0/0xc0 arch/arm64/kernel/syscall.c:206
 el0_svc+0x44/0xb0 arch/arm64/kernel/entry-common.c:624
 el0t_64_sync_handler+0x1ac/0x1b0 arch/arm64/kernel/entry-common.c:642
 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:581
Code: aa0003e3 d00038c0 91248000 97fff65f (d4210000)

Fixes: db496944fdaa ("bpf: arm64: add JIT support for multi-function programs")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20220531215113.1100754-1-eric.dumazet@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm64/net/bpf_jit_comp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
index 9c6cab71ba98..18627cbd6da4 100644
--- a/arch/arm64/net/bpf_jit_comp.c
+++ b/arch/arm64/net/bpf_jit_comp.c
@@ -1111,6 +1111,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
 			bpf_jit_binary_free(header);
 			prog->bpf_func = NULL;
 			prog->jited = 0;
+			prog->jited_len = 0;
 			goto out_off;
 		}
 		bpf_jit_binary_lock_ro(header);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 102/172] net: dsa: lantiq_gswip: Fix refcount leak in gswip_gphy_fw_list
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (100 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 101/172] bpf, arm64: Clear prog->jited_len along prog->jited Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 103/172] net/mlx4_en: Fix wrong return value on ioctl EEPROM query failure Greg Kroah-Hartman
                   ` (70 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Miaoqian Lin, Jakub Kicinski, Sasha Levin

From: Miaoqian Lin <linmq006@gmail.com>

[ Upstream commit 0737e018a05e2aa352828c52bdeed3b02cff2930 ]

Every iteration of for_each_available_child_of_node() decrements
the reference count of the previous node.
when breaking early from a for_each_available_child_of_node() loop,
we need to explicitly call of_node_put() on the gphy_fw_np.
Add missing of_node_put() to avoid refcount leak.

Fixes: 14fceff4771e ("net: dsa: Add Lantiq / Intel DSA driver for vrx200")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220605072335.11257-1-linmq006@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/dsa/lantiq_gswip.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
index 4abae06499a9..70895e480683 100644
--- a/drivers/net/dsa/lantiq_gswip.c
+++ b/drivers/net/dsa/lantiq_gswip.c
@@ -1981,8 +1981,10 @@ static int gswip_gphy_fw_list(struct gswip_priv *priv,
 	for_each_available_child_of_node(gphy_fw_list_np, gphy_fw_np) {
 		err = gswip_gphy_fw_probe(priv, &priv->gphy_fw[i],
 					  gphy_fw_np, i);
-		if (err)
+		if (err) {
+			of_node_put(gphy_fw_np);
 			goto remove_gphy;
+		}
 		i++;
 	}
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 103/172] net/mlx4_en: Fix wrong return value on ioctl EEPROM query failure
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (101 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 102/172] net: dsa: lantiq_gswip: Fix refcount leak in gswip_gphy_fw_list Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 104/172] SUNRPC: Fix the calculation of xdr->end in xdr_get_next_encode_buffer() Greg Kroah-Hartman
                   ` (69 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Gal Pressman, Tariq Toukan,
	Jakub Kicinski, Sasha Levin

From: Gal Pressman <gal@nvidia.com>

[ Upstream commit f5826c8c9d57210a17031af5527056eefdc2b7eb ]

The ioctl EEPROM query wrongly returns success on read failures, fix
that by returning the appropriate error code.

Fixes: 7202da8b7f71 ("ethtool, net/mlx4_en: Cable info, get_module_info/eeprom ethtool support")
Signed-off-by: Gal Pressman <gal@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://lore.kernel.org/r/20220606115718.14233-1-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index 01275c376721..962851000ace 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -2099,7 +2099,7 @@ static int mlx4_en_get_module_eeprom(struct net_device *dev,
 			en_err(priv,
 			       "mlx4_get_module_info i(%d) offset(%d) bytes_to_read(%d) - FAILED (0x%x)\n",
 			       i, offset, ee->len - i, ret);
-			return 0;
+			return ret;
 		}
 
 		i += ret;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 104/172] SUNRPC: Fix the calculation of xdr->end in xdr_get_next_encode_buffer()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (102 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 103/172] net/mlx4_en: Fix wrong return value on ioctl EEPROM query failure Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 105/172] net: mdio: unexport __init-annotated mdio_bus_init() Greg Kroah-Hartman
                   ` (68 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Chuck Lever, NeilBrown,
	J. Bruce Fields, Sasha Levin

From: Chuck Lever <chuck.lever@oracle.com>

[ Upstream commit 6c254bf3b637dd4ef4f78eb78c7447419c0161d7 ]

I found that NFSD's new NFSv3 READDIRPLUS XDR encoder was screwing up
right at the end of the page array. xdr_get_next_encode_buffer() does
not compute the value of xdr->end correctly:

 * The check to see if we're on the final available page in xdr->buf
   needs to account for the space consumed by @nbytes.

 * The new xdr->end value needs to account for the portion of @nbytes
   that is to be encoded into the previous buffer.

Fixes: 2825a7f90753 ("nfsd4: allow encoding across page boundaries")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: NeilBrown <neilb@suse.de>
Reviewed-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/sunrpc/xdr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index 71e03b930b70..c8ed6d3d5762 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -752,7 +752,11 @@ static __be32 *xdr_get_next_encode_buffer(struct xdr_stream *xdr,
 	 */
 	xdr->p = (void *)p + frag2bytes;
 	space_left = xdr->buf->buflen - xdr->buf->len;
-	xdr->end = (void *)p + min_t(int, space_left, PAGE_SIZE);
+	if (space_left - nbytes >= PAGE_SIZE)
+		xdr->end = (void *)p + PAGE_SIZE;
+	else
+		xdr->end = (void *)p + space_left - frag1bytes;
+
 	xdr->buf->page_len += frag2bytes;
 	xdr->buf->len += nbytes;
 	return p;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 105/172] net: mdio: unexport __init-annotated mdio_bus_init()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (103 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 104/172] SUNRPC: Fix the calculation of xdr->end in xdr_get_next_encode_buffer() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 106/172] net: xfrm: unexport __init-annotated xfrm4_protocol_init() Greg Kroah-Hartman
                   ` (67 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Stephen Rothwell, Masahiro Yamada,
	Florian Fainelli, Russell King (Oracle),
	Jakub Kicinski, Sasha Levin

From: Masahiro Yamada <masahiroy@kernel.org>

[ Upstream commit 35b42dce619701f1300fb8498dae82c9bb1f0263 ]

EXPORT_SYMBOL and __init is a bad combination because the .init.text
section is freed up after the initialization. Hence, modules cannot
use symbols annotated __init. The access to a freed symbol may end up
with kernel panic.

modpost used to detect it, but it has been broken for a decade.

Recently, I fixed modpost so it started to warn it again, then this
showed up in linux-next builds.

There are two ways to fix it:

  - Remove __init
  - Remove EXPORT_SYMBOL

I chose the latter for this case because the only in-tree call-site,
drivers/net/phy/phy_device.c is never compiled as modular.
(CONFIG_PHYLIB is boolean)

Fixes: 90eff9096c01 ("net: phy: Allow splitting MDIO bus/device support from PHYs")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/phy/mdio_bus.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index c416ab1d2b00..c1cbdac4b376 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -1008,7 +1008,6 @@ int __init mdio_bus_init(void)
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(mdio_bus_init);
 
 #if IS_ENABLED(CONFIG_PHYLIB)
 void mdio_bus_exit(void)
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 106/172] net: xfrm: unexport __init-annotated xfrm4_protocol_init()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (104 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 105/172] net: mdio: unexport __init-annotated mdio_bus_init() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 107/172] net: ipv6: unexport __init-annotated seg6_hmac_init() Greg Kroah-Hartman
                   ` (66 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Stephen Rothwell, Masahiro Yamada,
	Steffen Klassert, Jakub Kicinski, Sasha Levin

From: Masahiro Yamada <masahiroy@kernel.org>

[ Upstream commit 4a388f08d8784af48f352193d2b72aaf167a57a1 ]

EXPORT_SYMBOL and __init is a bad combination because the .init.text
section is freed up after the initialization. Hence, modules cannot
use symbols annotated __init. The access to a freed symbol may end up
with kernel panic.

modpost used to detect it, but it has been broken for a decade.

Recently, I fixed modpost so it started to warn it again, then this
showed up in linux-next builds.

There are two ways to fix it:

  - Remove __init
  - Remove EXPORT_SYMBOL

I chose the latter for this case because the only in-tree call-site,
net/ipv4/xfrm4_policy.c is never compiled as modular.
(CONFIG_XFRM is boolean)

Fixes: 2f32b51b609f ("xfrm: Introduce xfrm_input_afinfo to access the the callbacks properly")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ipv4/xfrm4_protocol.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/ipv4/xfrm4_protocol.c b/net/ipv4/xfrm4_protocol.c
index ea595c8549c7..cfd46222ef91 100644
--- a/net/ipv4/xfrm4_protocol.c
+++ b/net/ipv4/xfrm4_protocol.c
@@ -307,4 +307,3 @@ void __init xfrm4_protocol_init(void)
 {
 	xfrm_input_register_afinfo(&xfrm4_input_afinfo);
 }
-EXPORT_SYMBOL(xfrm4_protocol_init);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 107/172] net: ipv6: unexport __init-annotated seg6_hmac_init()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (105 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 106/172] net: xfrm: unexport __init-annotated xfrm4_protocol_init() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 108/172] net/mlx5: Rearm the FW tracer after each tracer event Greg Kroah-Hartman
                   ` (65 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Stephen Rothwell, Masahiro Yamada,
	Jakub Kicinski, Sasha Levin

From: Masahiro Yamada <masahiroy@kernel.org>

[ Upstream commit 5801f064e35181c71857a80ff18af4dbec3c5f5c ]

EXPORT_SYMBOL and __init is a bad combination because the .init.text
section is freed up after the initialization. Hence, modules cannot
use symbols annotated __init. The access to a freed symbol may end up
with kernel panic.

modpost used to detect it, but it has been broken for a decade.

Recently, I fixed modpost so it started to warn it again, then this
showed up in linux-next builds.

There are two ways to fix it:

  - Remove __init
  - Remove EXPORT_SYMBOL

I chose the latter for this case because the caller (net/ipv6/seg6.c)
and the callee (net/ipv6/seg6_hmac.c) belong to the same module.
It seems an internal function call in ipv6.ko.

Fixes: bf355b8d2c30 ("ipv6: sr: add core files for SR HMAC support")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ipv6/seg6_hmac.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c
index 85dddfe3a2c6..b9179708e3c1 100644
--- a/net/ipv6/seg6_hmac.c
+++ b/net/ipv6/seg6_hmac.c
@@ -400,7 +400,6 @@ int __init seg6_hmac_init(void)
 {
 	return seg6_hmac_init_algo();
 }
-EXPORT_SYMBOL(seg6_hmac_init);
 
 int __net_init seg6_hmac_net_init(struct net *net)
 {
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 108/172] net/mlx5: Rearm the FW tracer after each tracer event
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (106 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 107/172] net: ipv6: unexport __init-annotated seg6_hmac_init() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 109/172] net/mlx5: fs, fail conflicting actions Greg Kroah-Hartman
                   ` (64 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Feras Daoud, Roy Novich,
	Moshe Shemesh, Saeed Mahameed, Sasha Levin

From: Feras Daoud <ferasda@nvidia.com>

[ Upstream commit 8bf94e6414c9481bfa28269022688ab445d0081d ]

The current design does not arm the tracer if traces are available before
the tracer string database is fully loaded, leading to an unfunctional tracer.
This fix will rearm the tracer every time the FW triggers tracer event
regardless of the tracer strings database status.

Fixes: c71ad41ccb0c ("net/mlx5: FW tracer, events handling")
Signed-off-by: Feras Daoud <ferasda@nvidia.com>
Signed-off-by: Roy Novich <royno@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c b/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c
index 857be86b4a11..e8a4adccd2b2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c
@@ -675,6 +675,9 @@ static void mlx5_fw_tracer_handle_traces(struct work_struct *work)
 	if (!tracer->owner)
 		return;
 
+	if (unlikely(!tracer->str_db.loaded))
+		goto arm;
+
 	block_count = tracer->buff.size / TRACER_BLOCK_SIZE_BYTE;
 	start_offset = tracer->buff.consumer_index * TRACER_BLOCK_SIZE_BYTE;
 
@@ -732,6 +735,7 @@ static void mlx5_fw_tracer_handle_traces(struct work_struct *work)
 						      &tmp_trace_block[TRACES_PER_BLOCK - 1]);
 	}
 
+arm:
 	mlx5_fw_tracer_arm(dev);
 }
 
@@ -1138,8 +1142,7 @@ static int fw_tracer_event(struct notifier_block *nb, unsigned long action, void
 			queue_work(tracer->work_queue, &tracer->ownership_change_work);
 		break;
 	case MLX5_TRACER_SUBTYPE_TRACES_AVAILABLE:
-		if (likely(tracer->str_db.loaded))
-			queue_work(tracer->work_queue, &tracer->handle_traces_work);
+		queue_work(tracer->work_queue, &tracer->handle_traces_work);
 		break;
 	default:
 		mlx5_core_dbg(dev, "FWTracer: Event with unrecognized subtype: sub_type %d\n",
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 109/172] net/mlx5: fs, fail conflicting actions
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (107 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 108/172] net/mlx5: Rearm the FW tracer after each tracer event Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 110/172] ip_gre: test csum_start instead of transport header Greg Kroah-Hartman
                   ` (63 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mark Bloch, Maor Gottlieb,
	Saeed Mahameed, Sasha Levin

From: Mark Bloch <mbloch@nvidia.com>

[ Upstream commit 8fa5e7b20e01042b14f8cd684d2da9b638460c74 ]

When combining two steering rules into one check
not only do they share the same actions but those
actions are also the same. This resolves an issue where
when creating two different rules with the same match
the actions are overwritten and one of the rules is deleted
a FW syndrome can be seen in dmesg.

mlx5_core 0000:03:00.0: mlx5_cmd_check:819:(pid 2105): DEALLOC_MODIFY_HEADER_CONTEXT(0x941) op_mod(0x0) failed, status bad resource state(0x9), syndrome (0x1ab444)

Fixes: 0d235c3fabb7 ("net/mlx5: Add hash table to search FTEs in a flow-group")
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Reviewed-by: Maor Gottlieb <maorg@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 .../net/ethernet/mellanox/mlx5/core/fs_core.c | 35 +++++++++++++++++--
 1 file changed, 32 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index 15472fb15d7d..4bdcceffe9d3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -1520,9 +1520,22 @@ static struct mlx5_flow_rule *find_flow_rule(struct fs_fte *fte,
 	return NULL;
 }
 
-static bool check_conflicting_actions(u32 action1, u32 action2)
+static bool check_conflicting_actions_vlan(const struct mlx5_fs_vlan *vlan0,
+					   const struct mlx5_fs_vlan *vlan1)
 {
-	u32 xored_actions = action1 ^ action2;
+	return vlan0->ethtype != vlan1->ethtype ||
+	       vlan0->vid != vlan1->vid ||
+	       vlan0->prio != vlan1->prio;
+}
+
+static bool check_conflicting_actions(const struct mlx5_flow_act *act1,
+				      const struct mlx5_flow_act *act2)
+{
+	u32 action1 = act1->action;
+	u32 action2 = act2->action;
+	u32 xored_actions;
+
+	xored_actions = action1 ^ action2;
 
 	/* if one rule only wants to count, it's ok */
 	if (action1 == MLX5_FLOW_CONTEXT_ACTION_COUNT ||
@@ -1539,6 +1552,22 @@ static bool check_conflicting_actions(u32 action1, u32 action2)
 			     MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2))
 		return true;
 
+	if (action1 & MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT &&
+	    act1->pkt_reformat != act2->pkt_reformat)
+		return true;
+
+	if (action1 & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR &&
+	    act1->modify_hdr != act2->modify_hdr)
+		return true;
+
+	if (action1 & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH &&
+	    check_conflicting_actions_vlan(&act1->vlan[0], &act2->vlan[0]))
+		return true;
+
+	if (action1 & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2 &&
+	    check_conflicting_actions_vlan(&act1->vlan[1], &act2->vlan[1]))
+		return true;
+
 	return false;
 }
 
@@ -1546,7 +1575,7 @@ static int check_conflicting_ftes(struct fs_fte *fte,
 				  const struct mlx5_flow_context *flow_context,
 				  const struct mlx5_flow_act *flow_act)
 {
-	if (check_conflicting_actions(flow_act->action, fte->action.action)) {
+	if (check_conflicting_actions(flow_act, &fte->action)) {
 		mlx5_core_warn(get_dev(&fte->node),
 			       "Found two FTEs with conflicting actions\n");
 		return -EEXIST;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 110/172] ip_gre: test csum_start instead of transport header
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (108 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 109/172] net/mlx5: fs, fail conflicting actions Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 111/172] net: altera: Fix refcount leak in altera_tse_mdio_create Greg Kroah-Hartman
                   ` (62 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, syzbot, Willem de Bruijn,
	Eric Dumazet, Alexander Duyck, Jakub Kicinski, Sasha Levin

From: Willem de Bruijn <willemb@google.com>

[ Upstream commit 8d21e9963bec1aad2280cdd034c8993033ef2948 ]

GRE with TUNNEL_CSUM will apply local checksum offload on
CHECKSUM_PARTIAL packets.

ipgre_xmit must validate csum_start after an optional skb_pull,
else lco_csum may trigger an overflow. The original check was

	if (csum && skb_checksum_start(skb) < skb->data)
		return -EINVAL;

This had false positives when skb_checksum_start is undefined:
when ip_summed is not CHECKSUM_PARTIAL. A discussed refinement
was straightforward

	if (csum && skb->ip_summed == CHECKSUM_PARTIAL &&
	    skb_checksum_start(skb) < skb->data)
		return -EINVAL;

But was eventually revised more thoroughly:
- restrict the check to the only branch where needed, in an
  uncommon GRE path that uses header_ops and calls skb_pull.
- test skb_transport_header, which is set along with csum_start
  in skb_partial_csum_set in the normal header_ops datapath.

Turns out skbs can arrive in this branch without the transport
header set, e.g., through BPF redirection.

Revise the check back to check csum_start directly, and only if
CHECKSUM_PARTIAL. Do leave the check in the updated location.
Check field regardless of whether TUNNEL_CSUM is configured.

Link: https://lore.kernel.org/netdev/YS+h%2FtqCJJiQei+W@shredder/
Link: https://lore.kernel.org/all/20210902193447.94039-2-willemdebruijn.kernel@gmail.com/T/#u
Fixes: 8a0ed250f911 ("ip_gre: validate csum_start only on pull")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Link: https://lore.kernel.org/r/20220606132107.3582565-1-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ipv4/ip_gre.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 2a80038575d2..a7e32be8714f 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -624,21 +624,20 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb,
 	}
 
 	if (dev->header_ops) {
-		const int pull_len = tunnel->hlen + sizeof(struct iphdr);
-
 		if (skb_cow_head(skb, 0))
 			goto free_skb;
 
 		tnl_params = (const struct iphdr *)skb->data;
 
-		if (pull_len > skb_transport_offset(skb))
-			goto free_skb;
-
 		/* Pull skb since ip_tunnel_xmit() needs skb->data pointing
 		 * to gre header.
 		 */
-		skb_pull(skb, pull_len);
+		skb_pull(skb, tunnel->hlen + sizeof(struct iphdr));
 		skb_reset_mac_header(skb);
+
+		if (skb->ip_summed == CHECKSUM_PARTIAL &&
+		    skb_checksum_start(skb) < skb->data)
+			goto free_skb;
 	} else {
 		if (skb_cow_head(skb, dev->needed_headroom))
 			goto free_skb;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 111/172] net: altera: Fix refcount leak in altera_tse_mdio_create
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (109 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 110/172] ip_gre: test csum_start instead of transport header Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 112/172] drm: imx: fix compiler warning with gcc-12 Greg Kroah-Hartman
                   ` (61 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Miaoqian Lin, Jakub Kicinski, Sasha Levin

From: Miaoqian Lin <linmq006@gmail.com>

[ Upstream commit 11ec18b1d8d92b9df307d31950dcba0b3dd7283c ]

Every iteration of for_each_child_of_node() decrements
the reference count of the previous node.
When break from a for_each_child_of_node() loop,
we need to explicitly call of_node_put() on the child node when
not need anymore.
Add missing of_node_put() to avoid refcount leak.

Fixes: bbd2190ce96d ("Altera TSE: Add main and header file for Altera Ethernet Driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220607041144.7553-1-linmq006@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/altera/altera_tse_main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
index a7d8d45e0e94..b779f3adbc56 100644
--- a/drivers/net/ethernet/altera/altera_tse_main.c
+++ b/drivers/net/ethernet/altera/altera_tse_main.c
@@ -163,7 +163,8 @@ static int altera_tse_mdio_create(struct net_device *dev, unsigned int id)
 	mdio = mdiobus_alloc();
 	if (mdio == NULL) {
 		netdev_err(dev, "Error allocating MDIO bus\n");
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto put_node;
 	}
 
 	mdio->name = ALTERA_TSE_RESOURCE_NAME;
@@ -180,6 +181,7 @@ static int altera_tse_mdio_create(struct net_device *dev, unsigned int id)
 			   mdio->id);
 		goto out_free_mdio;
 	}
+	of_node_put(mdio_node);
 
 	if (netif_msg_drv(priv))
 		netdev_info(dev, "MDIO bus %s: created\n", mdio->id);
@@ -189,6 +191,8 @@ static int altera_tse_mdio_create(struct net_device *dev, unsigned int id)
 out_free_mdio:
 	mdiobus_free(mdio);
 	mdio = NULL;
+put_node:
+	of_node_put(mdio_node);
 	return ret;
 }
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 112/172] drm: imx: fix compiler warning with gcc-12
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (110 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 111/172] net: altera: Fix refcount leak in altera_tse_mdio_create Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 113/172] iio: dummy: iio_simple_dummy: check the return value of kstrdup() Greg Kroah-Hartman
                   ` (60 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Philipp Zabel, Linus Torvalds, Sasha Levin

From: Linus Torvalds <torvalds@linux-foundation.org>

[ Upstream commit 7aefd8b53815274f3ef398d370a3c9b27dd9f00c ]

Gcc-12 correctly warned about this code using a non-NULL pointer as a
truth value:

  drivers/gpu/drm/imx/ipuv3-crtc.c: In function ‘ipu_crtc_disable_planes’:
  drivers/gpu/drm/imx/ipuv3-crtc.c:72:21: error: the comparison will always evaluate as ‘true’ for the address of ‘plane’ will never be NULL [-Werror=address]
     72 |                 if (&ipu_crtc->plane[1] && plane == &ipu_crtc->plane[1]->base)
        |                     ^

due to the extraneous '&' address-of operator.

Philipp Zabel points out that The mistake had no adverse effect since
the following condition doesn't actually dereference the NULL pointer,
but the intent of the code was obviously to check for it, not to take
the address of the member.

Fixes: eb8c88808c83 ("drm/imx: add deferred plane disabling")
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/imx/ipuv3-crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
index d412fc265395..fd9d8e51837f 100644
--- a/drivers/gpu/drm/imx/ipuv3-crtc.c
+++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
@@ -68,7 +68,7 @@ static void ipu_crtc_disable_planes(struct ipu_crtc *ipu_crtc,
 	drm_atomic_crtc_state_for_each_plane(plane, old_crtc_state) {
 		if (plane == &ipu_crtc->plane[0]->base)
 			disable_full = true;
-		if (&ipu_crtc->plane[1] && plane == &ipu_crtc->plane[1]->base)
+		if (ipu_crtc->plane[1] && plane == &ipu_crtc->plane[1]->base)
 			disable_partial = true;
 	}
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 113/172] iio: dummy: iio_simple_dummy: check the return value of kstrdup()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (111 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 112/172] drm: imx: fix compiler warning with gcc-12 Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 114/172] staging: rtl8712: fix a potential memory leak in r871xu_drv_init() Greg Kroah-Hartman
                   ` (59 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Xiaoke Wang, Jonathan Cameron, Sasha Levin

From: Xiaoke Wang <xkernel.wang@foxmail.com>

[ Upstream commit ba93642188a6fed754bf7447f638bc410e05a929 ]

kstrdup() is also a memory allocation-related function, it returns NULL
when some memory errors happen. So it is better to check the return
value of it so to catch the memory error in time. Besides, there should
have a kfree() to clear up the allocation if we get a failure later in
this function to prevent memory leak.

Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Link: https://lore.kernel.org/r/tencent_C920CFCC33B9CC1C63141FE1334A39FF8508@qq.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/iio/dummy/iio_simple_dummy.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/dummy/iio_simple_dummy.c b/drivers/iio/dummy/iio_simple_dummy.c
index c0b7ef900735..c24f609c2ade 100644
--- a/drivers/iio/dummy/iio_simple_dummy.c
+++ b/drivers/iio/dummy/iio_simple_dummy.c
@@ -575,10 +575,9 @@ static struct iio_sw_device *iio_dummy_probe(const char *name)
 	 */
 
 	swd = kzalloc(sizeof(*swd), GFP_KERNEL);
-	if (!swd) {
-		ret = -ENOMEM;
-		goto error_kzalloc;
-	}
+	if (!swd)
+		return ERR_PTR(-ENOMEM);
+
 	/*
 	 * Allocate an IIO device.
 	 *
@@ -590,7 +589,7 @@ static struct iio_sw_device *iio_dummy_probe(const char *name)
 	indio_dev = iio_device_alloc(parent, sizeof(*st));
 	if (!indio_dev) {
 		ret = -ENOMEM;
-		goto error_ret;
+		goto error_free_swd;
 	}
 
 	st = iio_priv(indio_dev);
@@ -616,6 +615,10 @@ static struct iio_sw_device *iio_dummy_probe(const char *name)
 	 *    indio_dev->name = spi_get_device_id(spi)->name;
 	 */
 	indio_dev->name = kstrdup(name, GFP_KERNEL);
+	if (!indio_dev->name) {
+		ret = -ENOMEM;
+		goto error_free_device;
+	}
 
 	/* Provide description of available channels */
 	indio_dev->channels = iio_dummy_channels;
@@ -632,7 +635,7 @@ static struct iio_sw_device *iio_dummy_probe(const char *name)
 
 	ret = iio_simple_dummy_events_register(indio_dev);
 	if (ret < 0)
-		goto error_free_device;
+		goto error_free_name;
 
 	ret = iio_simple_dummy_configure_buffer(indio_dev);
 	if (ret < 0)
@@ -649,11 +652,12 @@ static struct iio_sw_device *iio_dummy_probe(const char *name)
 	iio_simple_dummy_unconfigure_buffer(indio_dev);
 error_unregister_events:
 	iio_simple_dummy_events_unregister(indio_dev);
+error_free_name:
+	kfree(indio_dev->name);
 error_free_device:
 	iio_device_free(indio_dev);
-error_ret:
+error_free_swd:
 	kfree(swd);
-error_kzalloc:
 	return ERR_PTR(ret);
 }
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 114/172] staging: rtl8712: fix a potential memory leak in r871xu_drv_init()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (112 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 113/172] iio: dummy: iio_simple_dummy: check the return value of kstrdup() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 115/172] iio: st_sensors: Add a local lock for protecting odr Greg Kroah-Hartman
                   ` (58 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Xiaoke Wang, Sasha Levin

From: Xiaoke Wang <xkernel.wang@foxmail.com>

[ Upstream commit 7288ff561de650d4139fab80e9cb0da9b5b32434 ]

In r871xu_drv_init(), if r8712_init_drv_sw() fails, then the memory
allocated by r8712_alloc_io_queue() in r8712_usb_dvobj_init() is not
properly released as there is no action will be performed by
r8712_usb_dvobj_deinit().
To properly release it, we should call r8712_free_io_queue() in
r8712_usb_dvobj_deinit().

Besides, in r871xu_dev_remove(), r8712_usb_dvobj_deinit() will be called
by r871x_dev_unload() under condition `padapter->bup` and
r8712_free_io_queue() is called by r8712_free_drv_sw().
However, r8712_usb_dvobj_deinit() does not rely on `padapter->bup` and
calling r8712_free_io_queue() in r8712_free_drv_sw() is negative for
better understading the code.
So I move r8712_usb_dvobj_deinit() into r871xu_dev_remove(), and remove
r8712_free_io_queue() from r8712_free_drv_sw().

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Link: https://lore.kernel.org/r/tencent_B8048C592777830380A23A7C4409F9DF1305@qq.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/staging/rtl8712/os_intfs.c | 1 -
 drivers/staging/rtl8712/usb_intf.c | 6 +++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c
index 2214aca09730..daa3180dfde3 100644
--- a/drivers/staging/rtl8712/os_intfs.c
+++ b/drivers/staging/rtl8712/os_intfs.c
@@ -332,7 +332,6 @@ void r8712_free_drv_sw(struct _adapter *padapter)
 	r8712_free_evt_priv(&padapter->evtpriv);
 	r8712_DeInitSwLeds(padapter);
 	r8712_free_mlme_priv(&padapter->mlmepriv);
-	r8712_free_io_queue(padapter);
 	_free_xmit_priv(&padapter->xmitpriv);
 	_r8712_free_sta_priv(&padapter->stapriv);
 	_r8712_free_recv_priv(&padapter->recvpriv);
diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c
index fed96d4251bf..77f090bdd36e 100644
--- a/drivers/staging/rtl8712/usb_intf.c
+++ b/drivers/staging/rtl8712/usb_intf.c
@@ -266,6 +266,7 @@ static uint r8712_usb_dvobj_init(struct _adapter *padapter)
 
 static void r8712_usb_dvobj_deinit(struct _adapter *padapter)
 {
+	r8712_free_io_queue(padapter);
 }
 
 void rtl871x_intf_stop(struct _adapter *padapter)
@@ -303,9 +304,6 @@ void r871x_dev_unload(struct _adapter *padapter)
 			rtl8712_hal_deinit(padapter);
 		}
 
-		/*s6.*/
-		if (padapter->dvobj_deinit)
-			padapter->dvobj_deinit(padapter);
 		padapter->bup = false;
 	}
 }
@@ -610,6 +608,8 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf)
 	/* Stop driver mlme relation timer */
 	r8712_stop_drv_timers(padapter);
 	r871x_dev_unload(padapter);
+	if (padapter->dvobj_deinit)
+		padapter->dvobj_deinit(padapter);
 	r8712_free_drv_sw(padapter);
 	free_netdev(pnetdev);
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 115/172] iio: st_sensors: Add a local lock for protecting odr
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (113 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 114/172] staging: rtl8712: fix a potential memory leak in r871xu_drv_init() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 116/172] lkdtm/usercopy: Expand size of "out of frame" object Greg Kroah-Hartman
                   ` (57 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jonathan Cameron, Denis Ciocca,
	Miquel Raynal, Jonathan Cameron, Sasha Levin

From: Miquel Raynal <miquel.raynal@bootlin.com>

[ Upstream commit 474010127e2505fc463236470908e1ff5ddb3578 ]

Right now the (framework) mlock lock is (ab)used for multiple purposes:
1- protecting concurrent accesses over the odr local cache
2- avoid changing samplig frequency whilst buffer is running

Let's start by handling situation #1 with a local lock.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20220207143840.707510-7-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 .../iio/common/st_sensors/st_sensors_core.c   | 24 ++++++++++++++-----
 include/linux/iio/common/st_sensors.h         |  3 +++
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 7a69c1be7393..56206fdbceb9 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -70,16 +70,18 @@ static int st_sensors_match_odr(struct st_sensor_settings *sensor_settings,
 
 int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr)
 {
-	int err;
+	int err = 0;
 	struct st_sensor_odr_avl odr_out = {0, 0};
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
 
+	mutex_lock(&sdata->odr_lock);
+
 	if (!sdata->sensor_settings->odr.mask)
-		return 0;
+		goto unlock_mutex;
 
 	err = st_sensors_match_odr(sdata->sensor_settings, odr, &odr_out);
 	if (err < 0)
-		goto st_sensors_match_odr_error;
+		goto unlock_mutex;
 
 	if ((sdata->sensor_settings->odr.addr ==
 					sdata->sensor_settings->pw.addr) &&
@@ -102,7 +104,9 @@ int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr)
 	if (err >= 0)
 		sdata->odr = odr_out.hz;
 
-st_sensors_match_odr_error:
+unlock_mutex:
+	mutex_unlock(&sdata->odr_lock);
+
 	return err;
 }
 EXPORT_SYMBOL(st_sensors_set_odr);
@@ -364,6 +368,8 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
 	struct st_sensors_platform_data *of_pdata;
 	int err = 0;
 
+	mutex_init(&sdata->odr_lock);
+
 	/* If OF/DT pdata exists, it will take precedence of anything else */
 	of_pdata = st_sensors_dev_probe(indio_dev->dev.parent, pdata);
 	if (IS_ERR(of_pdata))
@@ -557,18 +563,24 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev,
 		err = -EBUSY;
 		goto out;
 	} else {
+		mutex_lock(&sdata->odr_lock);
 		err = st_sensors_set_enable(indio_dev, true);
-		if (err < 0)
+		if (err < 0) {
+			mutex_unlock(&sdata->odr_lock);
 			goto out;
+		}
 
 		msleep((sdata->sensor_settings->bootime * 1000) / sdata->odr);
 		err = st_sensors_read_axis_data(indio_dev, ch, val);
-		if (err < 0)
+		if (err < 0) {
+			mutex_unlock(&sdata->odr_lock);
 			goto out;
+		}
 
 		*val = *val >> ch->scan_type.shift;
 
 		err = st_sensors_set_enable(indio_dev, false);
+		mutex_unlock(&sdata->odr_lock);
 	}
 out:
 	mutex_unlock(&indio_dev->mlock);
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 33e939977444..c16a9dda3ad5 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -228,6 +228,7 @@ struct st_sensor_settings {
  * @hw_irq_trigger: if we're using the hardware interrupt on the sensor.
  * @hw_timestamp: Latest timestamp from the interrupt handler, when in use.
  * @buffer_data: Data used by buffer part.
+ * @odr_lock: Local lock for preventing concurrent ODR accesses/changes
  */
 struct st_sensor_data {
 	struct device *dev;
@@ -253,6 +254,8 @@ struct st_sensor_data {
 	s64 hw_timestamp;
 
 	char buffer_data[ST_SENSORS_MAX_BUFFER_SIZE] ____cacheline_aligned;
+
+	struct mutex odr_lock;
 };
 
 #ifdef CONFIG_IIO_BUFFER
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 116/172] lkdtm/usercopy: Expand size of "out of frame" object
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (114 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 115/172] iio: st_sensors: Add a local lock for protecting odr Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 117/172] tty: synclink_gt: Fix null-pointer-dereference in slgt_clean() Greg Kroah-Hartman
                   ` (56 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Muhammad Usama Anjum, Arnd Bergmann,
	Kees Cook, Sasha Levin

From: Kees Cook <keescook@chromium.org>

[ Upstream commit f387e86d3a74407bdd9c5815820ac9d060962840 ]

To be sufficiently out of range for the usercopy test to see the lifetime
mismatch, expand the size of the "bad" buffer, which will let it be
beyond current_stack_pointer regardless of stack growth direction.
Paired with the recent addition of stack depth checking under
CONFIG_HARDENED_USERCOPY=y, this will correctly start tripping again.

Reported-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Link: https://lore.kernel.org/lkml/762faf1b-0443-5ddf-4430-44a20cf2ec4d@collabora.com/
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/misc/lkdtm/usercopy.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/lkdtm/usercopy.c b/drivers/misc/lkdtm/usercopy.c
index 109e8d4302c1..cde2655487ff 100644
--- a/drivers/misc/lkdtm/usercopy.c
+++ b/drivers/misc/lkdtm/usercopy.c
@@ -30,12 +30,12 @@ static const unsigned char test_text[] = "This is a test.\n";
  */
 static noinline unsigned char *trick_compiler(unsigned char *stack)
 {
-	return stack + 0;
+	return stack + unconst;
 }
 
 static noinline unsigned char *do_usercopy_stack_callee(int value)
 {
-	unsigned char buf[32];
+	unsigned char buf[128];
 	int i;
 
 	/* Exercise stack to avoid everything living in registers. */
@@ -43,7 +43,12 @@ static noinline unsigned char *do_usercopy_stack_callee(int value)
 		buf[i] = value & 0xff;
 	}
 
-	return trick_compiler(buf);
+	/*
+	 * Put the target buffer in the middle of stack allocation
+	 * so that we don't step on future stack users regardless
+	 * of stack growth direction.
+	 */
+	return trick_compiler(&buf[(128/2)-32]);
 }
 
 static noinline void do_usercopy_stack(bool to_user, bool bad_frame)
@@ -66,6 +71,12 @@ static noinline void do_usercopy_stack(bool to_user, bool bad_frame)
 		bad_stack -= sizeof(unsigned long);
 	}
 
+#ifdef ARCH_HAS_CURRENT_STACK_POINTER
+	pr_info("stack     : %px\n", (void *)current_stack_pointer);
+#endif
+	pr_info("good_stack: %px-%px\n", good_stack, good_stack + sizeof(good_stack));
+	pr_info("bad_stack : %px-%px\n", bad_stack, bad_stack + sizeof(good_stack));
+
 	user_addr = vm_mmap(NULL, 0, PAGE_SIZE,
 			    PROT_READ | PROT_WRITE | PROT_EXEC,
 			    MAP_ANONYMOUS | MAP_PRIVATE, 0);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 117/172] tty: synclink_gt: Fix null-pointer-dereference in slgt_clean()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (115 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 116/172] lkdtm/usercopy: Expand size of "out of frame" object Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 118/172] tty: Fix a possible resource leak in icom_probe Greg Kroah-Hartman
                   ` (55 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jiri Slaby, Zheyu Ma, Sasha Levin

From: Zheyu Ma <zheyuma97@gmail.com>

[ Upstream commit 689ca31c542687709ba21ec2195c1fbce34fd029 ]

When the driver fails at alloc_hdlcdev(), and then we remove the driver
module, we will get the following splat:

[   25.065966] general protection fault, probably for non-canonical address 0xdffffc0000000182: 0000 [#1] PREEMPT SMP KASAN PTI
[   25.066914] KASAN: null-ptr-deref in range [0x0000000000000c10-0x0000000000000c17]
[   25.069262] RIP: 0010:detach_hdlc_protocol+0x2a/0x3e0
[   25.077709] Call Trace:
[   25.077924]  <TASK>
[   25.078108]  unregister_hdlc_device+0x16/0x30
[   25.078481]  slgt_cleanup+0x157/0x9f0 [synclink_gt]

Fix this by checking whether the 'info->netdev' is a null pointer first.

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Link: https://lore.kernel.org/r/20220410114814.3920474-1-zheyuma97@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/synclink_gt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c
index 1a0c7beec101..0569d5949133 100644
--- a/drivers/tty/synclink_gt.c
+++ b/drivers/tty/synclink_gt.c
@@ -1749,6 +1749,8 @@ static int hdlcdev_init(struct slgt_info *info)
  */
 static void hdlcdev_exit(struct slgt_info *info)
 {
+	if (!info->netdev)
+		return;
 	unregister_hdlc_device(info->netdev);
 	free_netdev(info->netdev);
 	info->netdev = NULL;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 118/172] tty: Fix a possible resource leak in icom_probe
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (116 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 117/172] tty: synclink_gt: Fix null-pointer-dereference in slgt_clean() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 119/172] drivers: staging: rtl8192u: Fix deadlock in ieee80211_beacons_stop() Greg Kroah-Hartman
                   ` (54 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jiri Slaby, Huang Guobin, Sasha Levin

From: Huang Guobin <huangguobin4@huawei.com>

[ Upstream commit ee157a79e7c82b01ae4c25de0ac75899801f322c ]

When pci_read_config_dword failed, call pci_release_regions() and
pci_disable_device() to recycle the resource previously allocated.

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Huang Guobin <huangguobin4@huawei.com>
Link: https://lore.kernel.org/r/20220331091005.3290753-1-huangguobin4@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/icom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/icom.c b/drivers/tty/serial/icom.c
index 94c8281ddb5f..74b325c344da 100644
--- a/drivers/tty/serial/icom.c
+++ b/drivers/tty/serial/icom.c
@@ -1503,7 +1503,7 @@ static int icom_probe(struct pci_dev *dev,
 	retval = pci_read_config_dword(dev, PCI_COMMAND, &command_reg);
 	if (retval) {
 		dev_err(&dev->dev, "PCI Config read FAILED\n");
-		return retval;
+		goto probe_exit0;
 	}
 
 	pci_write_config_dword(dev, PCI_COMMAND,
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 119/172] drivers: staging: rtl8192u: Fix deadlock in ieee80211_beacons_stop()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (117 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 118/172] tty: Fix a possible resource leak in icom_probe Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 120/172] drivers: staging: rtl8192e: Fix deadlock in rtllib_beacons_stop() Greg Kroah-Hartman
                   ` (53 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Duoming Zhou, Sasha Levin

From: Duoming Zhou <duoming@zju.edu.cn>

[ Upstream commit 806c7b53414934ba2a39449b31fd1a038e500273 ]

There is a deadlock in ieee80211_beacons_stop(), which is shown below:

   (Thread 1)              |      (Thread 2)
                           | ieee80211_send_beacon()
ieee80211_beacons_stop()   |  mod_timer()
 spin_lock_irqsave() //(1) |  (wait a time)
 ...                       | ieee80211_send_beacon_cb()
 del_timer_sync()          |  spin_lock_irqsave() //(2)
 (wait timer to stop)      |  ...

We hold ieee->beacon_lock in position (1) of thread 1 and use
del_timer_sync() to wait timer to stop, but timer handler
also need ieee->beacon_lock in position (2) of thread 2.
As a result, ieee80211_beacons_stop() will block forever.

This patch extracts del_timer_sync() from the protection of
spin_lock_irqsave(), which could let timer handler to obtain
the needed lock.

Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/20220417135407.109536-1-duoming@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index 690b664df8fa..56a447651644 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -528,9 +528,9 @@ static void ieee80211_beacons_stop(struct ieee80211_device *ieee)
 	spin_lock_irqsave(&ieee->beacon_lock, flags);
 
 	ieee->beacon_txing = 0;
-	del_timer_sync(&ieee->beacon_timer);
 
 	spin_unlock_irqrestore(&ieee->beacon_lock, flags);
+	del_timer_sync(&ieee->beacon_timer);
 }
 
 void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 120/172] drivers: staging: rtl8192e: Fix deadlock in rtllib_beacons_stop()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (118 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 119/172] drivers: staging: rtl8192u: Fix deadlock in ieee80211_beacons_stop() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 121/172] USB: host: isp116x: check return value after calling platform_get_resource() Greg Kroah-Hartman
                   ` (52 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Duoming Zhou, Sasha Levin

From: Duoming Zhou <duoming@zju.edu.cn>

[ Upstream commit 9b6bdbd9337de3917945847bde262a34a87a6303 ]

There is a deadlock in rtllib_beacons_stop(), which is shown
below:

   (Thread 1)              |      (Thread 2)
                           | rtllib_send_beacon()
rtllib_beacons_stop()      |  mod_timer()
 spin_lock_irqsave() //(1) |  (wait a time)
 ...                       | rtllib_send_beacon_cb()
 del_timer_sync()          |  spin_lock_irqsave() //(2)
 (wait timer to stop)      |  ...

We hold ieee->beacon_lock in position (1) of thread 1 and
use del_timer_sync() to wait timer to stop, but timer handler
also need ieee->beacon_lock in position (2) of thread 2.
As a result, rtllib_beacons_stop() will block forever.

This patch extracts del_timer_sync() from the protection of
spin_lock_irqsave(), which could let timer handler to obtain
the needed lock.

Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/20220417141641.124388-1-duoming@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/staging/rtl8192e/rtllib_softmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index e8e72f79ca00..aeb6f015fdda 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -651,9 +651,9 @@ static void rtllib_beacons_stop(struct rtllib_device *ieee)
 	spin_lock_irqsave(&ieee->beacon_lock, flags);
 
 	ieee->beacon_txing = 0;
-	del_timer_sync(&ieee->beacon_timer);
 
 	spin_unlock_irqrestore(&ieee->beacon_lock, flags);
+	del_timer_sync(&ieee->beacon_timer);
 
 }
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 121/172] USB: host: isp116x: check return value after calling platform_get_resource()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (119 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 120/172] drivers: staging: rtl8192e: Fix deadlock in rtllib_beacons_stop() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 122/172] drivers: tty: serial: Fix deadlock in sa1100_set_termios() Greg Kroah-Hartman
                   ` (51 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Zhen Ni, Sasha Levin

From: Zhen Ni <nizhen@uniontech.com>

[ Upstream commit 134a3408c2d3f7e23eb0e4556e0a2d9f36c2614e ]

It will cause null-ptr-deref if platform_get_resource() returns NULL,
we need check the return value.

Signed-off-by: Zhen Ni <nizhen@uniontech.com>
Link: https://lore.kernel.org/r/20220302033716.31272-1-nizhen@uniontech.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/host/isp116x-hcd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 3055d9abfec3..3e5c54742bef 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -1541,10 +1541,12 @@ static int isp116x_remove(struct platform_device *pdev)
 
 	iounmap(isp116x->data_reg);
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	release_mem_region(res->start, 2);
+	if (res)
+		release_mem_region(res->start, 2);
 	iounmap(isp116x->addr_reg);
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	release_mem_region(res->start, 2);
+	if (res)
+		release_mem_region(res->start, 2);
 
 	usb_put_hcd(hcd);
 	return 0;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 122/172] drivers: tty: serial: Fix deadlock in sa1100_set_termios()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (120 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 121/172] USB: host: isp116x: check return value after calling platform_get_resource() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 123/172] drivers: usb: host: Fix deadlock in oxu_bus_suspend() Greg Kroah-Hartman
                   ` (50 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Duoming Zhou, Sasha Levin

From: Duoming Zhou <duoming@zju.edu.cn>

[ Upstream commit 62b2caef400c1738b6d22f636c628d9f85cd4c4c ]

There is a deadlock in sa1100_set_termios(), which is shown
below:

   (Thread 1)              |      (Thread 2)
                           | sa1100_enable_ms()
sa1100_set_termios()       |  mod_timer()
 spin_lock_irqsave() //(1) |  (wait a time)
 ...                       | sa1100_timeout()
 del_timer_sync()          |  spin_lock_irqsave() //(2)
 (wait timer to stop)      |  ...

We hold sport->port.lock in position (1) of thread 1 and
use del_timer_sync() to wait timer to stop, but timer handler
also need sport->port.lock in position (2) of thread 2. As a result,
sa1100_set_termios() will block forever.

This patch moves del_timer_sync() before spin_lock_irqsave()
in order to prevent the deadlock.

Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/20220417111626.7802-1-duoming@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/sa1100.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/sa1100.c b/drivers/tty/serial/sa1100.c
index f5fab1dd96bc..aa1cf2ae17a9 100644
--- a/drivers/tty/serial/sa1100.c
+++ b/drivers/tty/serial/sa1100.c
@@ -448,6 +448,8 @@ sa1100_set_termios(struct uart_port *port, struct ktermios *termios,
 	baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); 
 	quot = uart_get_divisor(port, baud);
 
+	del_timer_sync(&sport->timer);
+
 	spin_lock_irqsave(&sport->port.lock, flags);
 
 	sport->port.read_status_mask &= UTSR0_TO_SM(UTSR0_TFS);
@@ -478,8 +480,6 @@ sa1100_set_termios(struct uart_port *port, struct ktermios *termios,
 				UTSR1_TO_SM(UTSR1_ROR);
 	}
 
-	del_timer_sync(&sport->timer);
-
 	/*
 	 * Update the per-port timeout.
 	 */
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 123/172] drivers: usb: host: Fix deadlock in oxu_bus_suspend()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (121 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 122/172] drivers: tty: serial: Fix deadlock in sa1100_set_termios() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 124/172] USB: hcd-pci: Fully suspend across freeze/thaw cycle Greg Kroah-Hartman
                   ` (49 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Duoming Zhou, Sasha Levin

From: Duoming Zhou <duoming@zju.edu.cn>

[ Upstream commit 4d378f2ae58138d4c55684e1d274e7dd94aa6524 ]

There is a deadlock in oxu_bus_suspend(), which is shown below:

   (Thread 1)              |      (Thread 2)
                           | timer_action()
oxu_bus_suspend()          |  mod_timer()
 spin_lock_irq() //(1)     |  (wait a time)
 ...                       | oxu_watchdog()
 del_timer_sync()          |  spin_lock_irq() //(2)
 (wait timer to stop)      |  ...

We hold oxu->lock in position (1) of thread 1, and use
del_timer_sync() to wait timer to stop, but timer handler
also need oxu->lock in position (2) of thread 2. As a result,
oxu_bus_suspend() will block forever.

This patch extracts del_timer_sync() from the protection of
spin_lock_irq(), which could let timer handler to obtain
the needed lock.

Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/20220417120305.64577-1-duoming@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/host/oxu210hp-hcd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
index e832909a924f..6df2881cd7b9 100644
--- a/drivers/usb/host/oxu210hp-hcd.c
+++ b/drivers/usb/host/oxu210hp-hcd.c
@@ -3908,8 +3908,10 @@ static int oxu_bus_suspend(struct usb_hcd *hcd)
 		}
 	}
 
+	spin_unlock_irq(&oxu->lock);
 	/* turn off now-idle HC */
 	del_timer_sync(&oxu->watchdog);
+	spin_lock_irq(&oxu->lock);
 	ehci_halt(oxu);
 	hcd->state = HC_STATE_SUSPENDED;
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 124/172] USB: hcd-pci: Fully suspend across freeze/thaw cycle
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (122 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 123/172] drivers: usb: host: Fix deadlock in oxu_bus_suspend() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 125/172] sysrq: do not omit current cpu when showing backtrace of all active CPUs Greg Kroah-Hartman
                   ` (48 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alan Stern, Evan Green, Sasha Levin

From: Evan Green <evgreen@chromium.org>

[ Upstream commit 63acaa8e9c65dc34dc249440216f8e977f5d2748 ]

The documentation for the freeze() method says that it "should quiesce
the device so that it doesn't generate IRQs or DMA". The unspoken
consequence of not doing this is that MSIs aimed at non-boot CPUs may
get fully lost if they're sent during the period where the target CPU is
offline.

The current callbacks for USB HCD do not fully quiesce interrupts,
specifically on XHCI. Change to use the full suspend/resume flow for
freeze/thaw to ensure interrupts are fully quiesced. This fixes issues
where USB devices fail to thaw during hibernation because XHCI misses
its interrupt and cannot recover.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Evan Green <evgreen@chromium.org>
Link: https://lore.kernel.org/r/20220421103751.v3.2.I8226c7fdae88329ef70957b96a39b346c69a914e@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/core/hcd-pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index ec0d6c50610c..eee78cbfaa72 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -614,10 +614,10 @@ const struct dev_pm_ops usb_hcd_pci_pm_ops = {
 	.suspend_noirq	= hcd_pci_suspend_noirq,
 	.resume_noirq	= hcd_pci_resume_noirq,
 	.resume		= hcd_pci_resume,
-	.freeze		= check_root_hub_suspended,
+	.freeze		= hcd_pci_suspend,
 	.freeze_noirq	= check_root_hub_suspended,
 	.thaw_noirq	= NULL,
-	.thaw		= NULL,
+	.thaw		= hcd_pci_resume,
 	.poweroff	= hcd_pci_suspend,
 	.poweroff_noirq	= hcd_pci_suspend_noirq,
 	.restore_noirq	= hcd_pci_resume_noirq,
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 125/172] sysrq: do not omit current cpu when showing backtrace of all active CPUs
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (123 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 124/172] USB: hcd-pci: Fully suspend across freeze/thaw cycle Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 126/172] usb: dwc2: gadget: dont reset gadgets driver->bus Greg Kroah-Hartman
                   ` (47 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Changbin Du, Sasha Levin

From: Changbin Du <changbin.du@gmail.com>

[ Upstream commit 5390e7f46b9d5546d45a83e6463bc656678b1d0e ]

The backtrace of current CPU also should be printed as it is active. This
change add stack trace for current CPU and print a hint for idle CPU for
the generic workqueue based printing. (x86 already does this)

Now it looks like below:
[  279.401567] sysrq: Show backtrace of all active CPUs
[  279.407234] sysrq: CPU5:
[  279.407505] Call Trace:
[  279.408789] [<ffffffff8000606c>] dump_backtrace+0x2c/0x3a
[  279.411698] [<ffffffff800060ac>] show_stack+0x32/0x3e
[  279.411809] [<ffffffff80542258>] sysrq_handle_showallcpus+0x4c/0xc6
[  279.411929] [<ffffffff80542f16>] __handle_sysrq+0x106/0x26c
[  279.412034] [<ffffffff805436a8>] write_sysrq_trigger+0x64/0x74
[  279.412139] [<ffffffff8029cd48>] proc_reg_write+0x8e/0xe2
[  279.412252] [<ffffffff8021a8f8>] vfs_write+0x90/0x2be
[  279.412362] [<ffffffff8021acd2>] ksys_write+0xa6/0xce
[  279.412467] [<ffffffff8021ad24>] sys_write+0x2a/0x38
[  279.412689] [<ffffffff80003ff8>] ret_from_syscall+0x0/0x2
[  279.417173] sysrq: CPU6: backtrace skipped as idling
[  279.417185] sysrq: CPU4: backtrace skipped as idling
[  279.417187] sysrq: CPU0: backtrace skipped as idling
[  279.417181] sysrq: CPU7: backtrace skipped as idling
[  279.417190] sysrq: CPU1: backtrace skipped as idling
[  279.417193] sysrq: CPU3: backtrace skipped as idling
[  279.417219] sysrq: CPU2:
[  279.419179] Call Trace:
[  279.419440] [<ffffffff8000606c>] dump_backtrace+0x2c/0x3a
[  279.419782] [<ffffffff800060ac>] show_stack+0x32/0x3e
[  279.420015] [<ffffffff80542b30>] showacpu+0x5c/0x96
[  279.420317] [<ffffffff800ba71c>] flush_smp_call_function_queue+0xd6/0x218
[  279.420569] [<ffffffff800bb438>] generic_smp_call_function_single_interrupt+0x14/0x1c
[  279.420798] [<ffffffff800079ae>] handle_IPI+0xaa/0x13a
[  279.421024] [<ffffffff804dcb92>] riscv_intc_irq+0x56/0x70
[  279.421274] [<ffffffff80a05b70>] generic_handle_arch_irq+0x6a/0xfa
[  279.421518] [<ffffffff80004006>] ret_from_exception+0x0/0x10
[  279.421750] [<ffffffff80096492>] rcu_idle_enter+0x16/0x1e

Signed-off-by: Changbin Du <changbin.du@gmail.com>
Link: https://lore.kernel.org/r/20220117154300.2808-1-changbin.du@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/sysrq.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 959f9e121cc6..7ca209d4e088 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -231,8 +231,10 @@ static void showacpu(void *dummy)
 	unsigned long flags;
 
 	/* Idle CPUs have no interesting backtrace. */
-	if (idle_cpu(smp_processor_id()))
+	if (idle_cpu(smp_processor_id())) {
+		pr_info("CPU%d: backtrace skipped as idling\n", smp_processor_id());
 		return;
+	}
 
 	raw_spin_lock_irqsave(&show_lock, flags);
 	pr_info("CPU%d:\n", smp_processor_id());
@@ -259,10 +261,13 @@ static void sysrq_handle_showallcpus(int key)
 
 		if (in_irq())
 			regs = get_irq_regs();
-		if (regs) {
-			pr_info("CPU%d:\n", smp_processor_id());
+
+		pr_info("CPU%d:\n", smp_processor_id());
+		if (regs)
 			show_regs(regs);
-		}
+		else
+			show_stack(NULL, NULL, KERN_INFO);
+
 		schedule_work(&sysrq_showallcpus);
 	}
 }
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 126/172] usb: dwc2: gadget: dont reset gadgets driver->bus
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (124 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 125/172] sysrq: do not omit current cpu when showing backtrace of all active CPUs Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 127/172] misc: rtsx: set NULL intfdata when probe fails Greg Kroah-Hartman
                   ` (46 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Marek Szyprowski, Sasha Levin

From: Marek Szyprowski <m.szyprowski@samsung.com>

[ Upstream commit 3120aac6d0ecd9accf56894aeac0e265f74d3d5a ]

UDC driver should not touch gadget's driver internals, especially it
should not reset driver->bus. This wasn't harmful so far, but since
commit fc274c1e9973 ("USB: gadget: Add a new bus for gadgets") gadget
subsystem got it's own bus and messing with ->bus triggers the
following NULL pointer dereference:

dwc2 12480000.hsotg: bound driver g_ether
8<--- cut here ---
Unable to handle kernel NULL pointer dereference at virtual address 00000000
[00000000] *pgd=00000000
Internal error: Oops: 5 [#1] SMP ARM
Modules linked in: ...
CPU: 0 PID: 620 Comm: modprobe Not tainted 5.18.0-rc5-next-20220504 #11862
Hardware name: Samsung Exynos (Flattened Device Tree)
PC is at module_add_driver+0x44/0xe8
LR is at sysfs_do_create_link_sd+0x84/0xe0
...
Process modprobe (pid: 620, stack limit = 0x(ptrval))
...
 module_add_driver from bus_add_driver+0xf4/0x1e4
 bus_add_driver from driver_register+0x78/0x10c
 driver_register from usb_gadget_register_driver_owner+0x40/0xb4
 usb_gadget_register_driver_owner from do_one_initcall+0x44/0x1e0
 do_one_initcall from do_init_module+0x44/0x1c8
 do_init_module from load_module+0x19b8/0x1b9c
 load_module from sys_finit_module+0xdc/0xfc
 sys_finit_module from ret_fast_syscall+0x0/0x54
Exception stack(0xf1771fa8 to 0xf1771ff0)
...
dwc2 12480000.hsotg: new device is high-speed
---[ end trace 0000000000000000 ]---

Fix this by removing driver->bus entry reset.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20220505104618.22729-1-m.szyprowski@samsung.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/dwc2/gadget.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index ec54971063f8..64485f82dc5b 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -4518,7 +4518,6 @@ static int dwc2_hsotg_udc_start(struct usb_gadget *gadget,
 
 	WARN_ON(hsotg->driver);
 
-	driver->driver.bus = NULL;
 	hsotg->driver = driver;
 	hsotg->gadget.dev.of_node = hsotg->dev->of_node;
 	hsotg->gadget.speed = USB_SPEED_UNKNOWN;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 127/172] misc: rtsx: set NULL intfdata when probe fails
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (125 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 126/172] usb: dwc2: gadget: dont reset gadgets driver->bus Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 128/172] extcon: Modify extcon device to be created after driver data is set Greg Kroah-Hartman
                   ` (45 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Shuah Khan, Sasha Levin

From: Shuah Khan <skhan@linuxfoundation.org>

[ Upstream commit f861d36e021e1ac4a0a2a1f6411d623809975d63 ]

rtsx_usb_probe() doesn't call usb_set_intfdata() to null out the
interface pointer when probe fails. This leaves a stale pointer.
Noticed the missing usb_set_intfdata() while debugging an unrelated
invalid DMA mapping problem.

Fix it with a call to usb_set_intfdata(..., NULL).

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20220429210913.46804-1-skhan@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/misc/cardreader/rtsx_usb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/misc/cardreader/rtsx_usb.c b/drivers/misc/cardreader/rtsx_usb.c
index 59eda55d92a3..1ef9b61077c4 100644
--- a/drivers/misc/cardreader/rtsx_usb.c
+++ b/drivers/misc/cardreader/rtsx_usb.c
@@ -667,6 +667,7 @@ static int rtsx_usb_probe(struct usb_interface *intf,
 	return 0;
 
 out_init_fail:
+	usb_set_intfdata(ucr->pusb_intf, NULL);
 	usb_free_coherent(ucr->pusb_dev, IOBUF_SIZE, ucr->iobuf,
 			ucr->iobuf_dma);
 	return ret;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 128/172] extcon: Modify extcon device to be created after driver data is set
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (126 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 127/172] misc: rtsx: set NULL intfdata when probe fails Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 129/172] clocksource/drivers/sp804: Avoid error on multiple instances Greg Kroah-Hartman
                   ` (44 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, bumwoo lee, Chanwoo Choi, Sasha Levin

From: bumwoo lee <bw365.lee@samsung.com>

[ Upstream commit 5dcc2afe716d69f5112ce035cb14f007461ff189 ]

Currently, someone can invoke the sysfs such as state_show()
intermittently before dev_set_drvdata() is done.
And it can be a cause of kernel Oops because of edev is Null at that time.
So modified the driver registration to after setting drviver data.

- Oops's backtrace.

Backtrace:
[<c067865c>] (state_show) from [<c05222e8>] (dev_attr_show)
[<c05222c0>] (dev_attr_show) from [<c02c66e0>] (sysfs_kf_seq_show)
[<c02c6648>] (sysfs_kf_seq_show) from [<c02c496c>] (kernfs_seq_show)
[<c02c4938>] (kernfs_seq_show) from [<c025e2a0>] (seq_read)
[<c025e11c>] (seq_read) from [<c02c50a0>] (kernfs_fop_read)
[<c02c5064>] (kernfs_fop_read) from [<c0231cac>] (__vfs_read)
[<c0231c5c>] (__vfs_read) from [<c0231ee0>] (vfs_read)
[<c0231e34>] (vfs_read) from [<c0232464>] (ksys_read)
[<c02323f0>] (ksys_read) from [<c02324fc>] (sys_read)
[<c02324e4>] (sys_read) from [<c00091d0>] (__sys_trace_return)

Signed-off-by: bumwoo lee <bw365.lee@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/extcon/extcon.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index e7a9561a826d..356610404bb4 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -1230,19 +1230,14 @@ int extcon_dev_register(struct extcon_dev *edev)
 		edev->dev.type = &edev->extcon_dev_type;
 	}
 
-	ret = device_register(&edev->dev);
-	if (ret) {
-		put_device(&edev->dev);
-		goto err_dev;
-	}
-
 	spin_lock_init(&edev->lock);
-	edev->nh = devm_kcalloc(&edev->dev, edev->max_supported,
-				sizeof(*edev->nh), GFP_KERNEL);
-	if (!edev->nh) {
-		ret = -ENOMEM;
-		device_unregister(&edev->dev);
-		goto err_dev;
+	if (edev->max_supported) {
+		edev->nh = kcalloc(edev->max_supported, sizeof(*edev->nh),
+				GFP_KERNEL);
+		if (!edev->nh) {
+			ret = -ENOMEM;
+			goto err_alloc_nh;
+		}
 	}
 
 	for (index = 0; index < edev->max_supported; index++)
@@ -1253,6 +1248,12 @@ int extcon_dev_register(struct extcon_dev *edev)
 	dev_set_drvdata(&edev->dev, edev);
 	edev->state = 0;
 
+	ret = device_register(&edev->dev);
+	if (ret) {
+		put_device(&edev->dev);
+		goto err_dev;
+	}
+
 	mutex_lock(&extcon_dev_list_lock);
 	list_add(&edev->entry, &extcon_dev_list);
 	mutex_unlock(&extcon_dev_list_lock);
@@ -1260,6 +1261,9 @@ int extcon_dev_register(struct extcon_dev *edev)
 	return 0;
 
 err_dev:
+	if (edev->max_supported)
+		kfree(edev->nh);
+err_alloc_nh:
 	if (edev->max_supported)
 		kfree(edev->extcon_dev_type.groups);
 err_alloc_groups:
@@ -1320,6 +1324,7 @@ void extcon_dev_unregister(struct extcon_dev *edev)
 	if (edev->max_supported) {
 		kfree(edev->extcon_dev_type.groups);
 		kfree(edev->cables);
+		kfree(edev->nh);
 	}
 
 	put_device(&edev->dev);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 129/172] clocksource/drivers/sp804: Avoid error on multiple instances
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (127 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 128/172] extcon: Modify extcon device to be created after driver data is set Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 130/172] staging: rtl8712: fix uninit-value in usb_read8() and friends Greg Kroah-Hartman
                   ` (43 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andre Przywara, Robin Murphy,
	Daniel Lezcano, Sasha Levin

From: Andre Przywara <andre.przywara@arm.com>

[ Upstream commit a98399cbc1e05f7b977419f03905501d566cf54e ]

When a machine sports more than one SP804 timer instance, we only bring
up the first one, since multiple timers of the same kind are not useful
to Linux. As this is intentional behaviour, we should not return an
error message, as we do today:
===============
[    0.000800] Failed to initialize '/bus@8000000/motherboard-bus@8000000/iofpga-bus@300000000/timer@120000': -22
===============

Replace the -EINVAL return with a debug message and return 0 instead.

Also we do not reach the init function anymore if the DT node is
disabled (as this is now handled by OF_DECLARE), so remove the explicit
check for that case.

This fixes a long standing bogus error when booting ARM's fastmodels.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/20220506162522.3675399-1-andre.przywara@arm.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/clocksource/timer-sp804.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/clocksource/timer-sp804.c b/drivers/clocksource/timer-sp804.c
index 6e8ad4a4ea3c..bedd3570474b 100644
--- a/drivers/clocksource/timer-sp804.c
+++ b/drivers/clocksource/timer-sp804.c
@@ -274,6 +274,11 @@ static int __init sp804_of_init(struct device_node *np, struct sp804_timer *time
 	struct clk *clk1, *clk2;
 	const char *name = of_get_property(np, "compatible", NULL);
 
+	if (initialized) {
+		pr_debug("%pOF: skipping further SP804 timer device\n", np);
+		return 0;
+	}
+
 	base = of_iomap(np, 0);
 	if (!base)
 		return -ENXIO;
@@ -285,11 +290,6 @@ static int __init sp804_of_init(struct device_node *np, struct sp804_timer *time
 	writel(0, timer1_base + timer->ctrl);
 	writel(0, timer2_base + timer->ctrl);
 
-	if (initialized || !of_device_is_available(np)) {
-		ret = -EINVAL;
-		goto err;
-	}
-
 	clk1 = of_clk_get(np, 0);
 	if (IS_ERR(clk1))
 		clk1 = NULL;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 130/172] staging: rtl8712: fix uninit-value in usb_read8() and friends
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (128 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 129/172] clocksource/drivers/sp804: Avoid error on multiple instances Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 131/172] staging: rtl8712: fix uninit-value in r871xu_drv_init() Greg Kroah-Hartman
                   ` (42 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, syzbot+6f5ecd144854c0d8580b,
	Dan Carpenter, Wang Cheng, Sasha Levin

From: Wang Cheng <wanngchenng@gmail.com>

[ Upstream commit d1b57669732d09da7e13ef86d058dab0cd57f6e0 ]

When r8712_usbctrl_vendorreq() returns negative, 'data' in
usb_read{8,16,32} will not be initialized.

BUG: KMSAN: uninit-value in string_nocheck lib/vsprintf.c:643 [inline]
BUG: KMSAN: uninit-value in string+0x4ec/0x6f0 lib/vsprintf.c:725
 string_nocheck lib/vsprintf.c:643 [inline]
 string+0x4ec/0x6f0 lib/vsprintf.c:725
 vsnprintf+0x2222/0x3650 lib/vsprintf.c:2806
 va_format lib/vsprintf.c:1704 [inline]
 pointer+0x18e6/0x1f70 lib/vsprintf.c:2443
 vsnprintf+0x1a9b/0x3650 lib/vsprintf.c:2810
 vprintk_store+0x537/0x2150 kernel/printk/printk.c:2158
 vprintk_emit+0x28b/0xab0 kernel/printk/printk.c:2256
 dev_vprintk_emit+0x5ef/0x6d0 drivers/base/core.c:4604
 dev_printk_emit+0x1dd/0x21f drivers/base/core.c:4615
 __dev_printk+0x3be/0x440 drivers/base/core.c:4627
 _dev_info+0x1ea/0x22f drivers/base/core.c:4673
 r871xu_drv_init+0x1929/0x3070 drivers/staging/rtl8712/usb_intf.c:401
 usb_probe_interface+0xf19/0x1600 drivers/usb/core/driver.c:396
 really_probe+0x6c7/0x1350 drivers/base/dd.c:621
 __driver_probe_device+0x3e9/0x530 drivers/base/dd.c:752
 driver_probe_device drivers/base/dd.c:782 [inline]
 __device_attach_driver+0x79f/0x1120 drivers/base/dd.c:899
 bus_for_each_drv+0x2d6/0x3f0 drivers/base/bus.c:427
 __device_attach+0x593/0x8e0 drivers/base/dd.c:970
 device_initial_probe+0x4a/0x60 drivers/base/dd.c:1017
 bus_probe_device+0x17b/0x3e0 drivers/base/bus.c:487
 device_add+0x1fff/0x26e0 drivers/base/core.c:3405
 usb_set_configuration+0x37e9/0x3ed0 drivers/usb/core/message.c:2170
 usb_generic_driver_probe+0x13c/0x300 drivers/usb/core/generic.c:238
 usb_probe_device+0x309/0x570 drivers/usb/core/driver.c:293
 really_probe+0x6c7/0x1350 drivers/base/dd.c:621
 __driver_probe_device+0x3e9/0x530 drivers/base/dd.c:752
 driver_probe_device drivers/base/dd.c:782 [inline]
 __device_attach_driver+0x79f/0x1120 drivers/base/dd.c:899
 bus_for_each_drv+0x2d6/0x3f0 drivers/base/bus.c:427
 __device_attach+0x593/0x8e0 drivers/base/dd.c:970
 device_initial_probe+0x4a/0x60 drivers/base/dd.c:1017
 bus_probe_device+0x17b/0x3e0 drivers/base/bus.c:487
 device_add+0x1fff/0x26e0 drivers/base/core.c:3405
 usb_new_device+0x1b91/0x2950 drivers/usb/core/hub.c:2566
 hub_port_connect drivers/usb/core/hub.c:5363 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5507 [inline]
 port_event drivers/usb/core/hub.c:5665 [inline]
 hub_event+0x58e3/0x89e0 drivers/usb/core/hub.c:5747
 process_one_work+0xdb6/0x1820 kernel/workqueue.c:2289
 worker_thread+0x10d0/0x2240 kernel/workqueue.c:2436
 kthread+0x3c7/0x500 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30

Local variable data created at:
 usb_read8+0x5d/0x130 drivers/staging/rtl8712/usb_ops.c:33
 r8712_read8+0xa5/0xd0 drivers/staging/rtl8712/rtl8712_io.c:29

KMSAN: uninit-value in r871xu_drv_init
https://syzkaller.appspot.com/bug?id=3cd92b1d85428b128503bfa7a250294c9ae00bd8

Reported-by: <syzbot+6f5ecd144854c0d8580b@syzkaller.appspotmail.com>
Tested-by: <syzbot+6f5ecd144854c0d8580b@syzkaller.appspotmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Wang Cheng <wanngchenng@gmail.com>
Link: https://lore.kernel.org/r/b9b7a6ee02c02aa28054f5cf16129977775f3cd9.1652618244.git.wanngchenng@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/staging/rtl8712/usb_ops.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8712/usb_ops.c b/drivers/staging/rtl8712/usb_ops.c
index e64845e6adf3..af9966d03979 100644
--- a/drivers/staging/rtl8712/usb_ops.c
+++ b/drivers/staging/rtl8712/usb_ops.c
@@ -29,7 +29,8 @@ static u8 usb_read8(struct intf_hdl *intfhdl, u32 addr)
 	u16 wvalue;
 	u16 index;
 	u16 len;
-	__le32 data;
+	int status;
+	__le32 data = 0;
 	struct intf_priv *intfpriv = intfhdl->pintfpriv;
 
 	request = 0x05;
@@ -37,8 +38,10 @@ static u8 usb_read8(struct intf_hdl *intfhdl, u32 addr)
 	index = 0;
 	wvalue = (u16)(addr & 0x0000ffff);
 	len = 1;
-	r8712_usbctrl_vendorreq(intfpriv, request, wvalue, index, &data, len,
-				requesttype);
+	status = r8712_usbctrl_vendorreq(intfpriv, request, wvalue, index,
+					 &data, len, requesttype);
+	if (status < 0)
+		return 0;
 	return (u8)(le32_to_cpu(data) & 0x0ff);
 }
 
@@ -49,7 +52,8 @@ static u16 usb_read16(struct intf_hdl *intfhdl, u32 addr)
 	u16 wvalue;
 	u16 index;
 	u16 len;
-	__le32 data;
+	int status;
+	__le32 data = 0;
 	struct intf_priv *intfpriv = intfhdl->pintfpriv;
 
 	request = 0x05;
@@ -57,8 +61,10 @@ static u16 usb_read16(struct intf_hdl *intfhdl, u32 addr)
 	index = 0;
 	wvalue = (u16)(addr & 0x0000ffff);
 	len = 2;
-	r8712_usbctrl_vendorreq(intfpriv, request, wvalue, index, &data, len,
-				requesttype);
+	status = r8712_usbctrl_vendorreq(intfpriv, request, wvalue, index,
+					 &data, len, requesttype);
+	if (status < 0)
+		return 0;
 	return (u16)(le32_to_cpu(data) & 0xffff);
 }
 
@@ -69,7 +75,8 @@ static u32 usb_read32(struct intf_hdl *intfhdl, u32 addr)
 	u16 wvalue;
 	u16 index;
 	u16 len;
-	__le32 data;
+	int status;
+	__le32 data = 0;
 	struct intf_priv *intfpriv = intfhdl->pintfpriv;
 
 	request = 0x05;
@@ -77,8 +84,10 @@ static u32 usb_read32(struct intf_hdl *intfhdl, u32 addr)
 	index = 0;
 	wvalue = (u16)(addr & 0x0000ffff);
 	len = 4;
-	r8712_usbctrl_vendorreq(intfpriv, request, wvalue, index, &data, len,
-				requesttype);
+	status = r8712_usbctrl_vendorreq(intfpriv, request, wvalue, index,
+					 &data, len, requesttype);
+	if (status < 0)
+		return 0;
 	return le32_to_cpu(data);
 }
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 131/172] staging: rtl8712: fix uninit-value in r871xu_drv_init()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (129 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 130/172] staging: rtl8712: fix uninit-value in usb_read8() and friends Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 132/172] serial: msm_serial: disable interrupts in __msm_console_write() Greg Kroah-Hartman
                   ` (41 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, syzbot+6f5ecd144854c0d8580b,
	Dan Carpenter, Wang Cheng, Sasha Levin

From: Wang Cheng <wanngchenng@gmail.com>

[ Upstream commit 0458e5428e5e959d201a40ffe71d762a79ecedc4 ]

When 'tmpU1b' returns from r8712_read8(padapter, EE_9346CR) is 0,
'mac[6]' will not be initialized.

BUG: KMSAN: uninit-value in r871xu_drv_init+0x2d54/0x3070 drivers/staging/rtl8712/usb_intf.c:541
 r871xu_drv_init+0x2d54/0x3070 drivers/staging/rtl8712/usb_intf.c:541
 usb_probe_interface+0xf19/0x1600 drivers/usb/core/driver.c:396
 really_probe+0x653/0x14b0 drivers/base/dd.c:596
 __driver_probe_device+0x3e9/0x530 drivers/base/dd.c:752
 driver_probe_device drivers/base/dd.c:782 [inline]
 __device_attach_driver+0x79f/0x1120 drivers/base/dd.c:899
 bus_for_each_drv+0x2d6/0x3f0 drivers/base/bus.c:427
 __device_attach+0x593/0x8e0 drivers/base/dd.c:970
 device_initial_probe+0x4a/0x60 drivers/base/dd.c:1017
 bus_probe_device+0x17b/0x3e0 drivers/base/bus.c:487
 device_add+0x1fff/0x26e0 drivers/base/core.c:3405
 usb_set_configuration+0x37e9/0x3ed0 drivers/usb/core/message.c:2170
 usb_generic_driver_probe+0x13c/0x300 drivers/usb/core/generic.c:238
 usb_probe_device+0x309/0x570 drivers/usb/core/driver.c:293
 really_probe+0x653/0x14b0 drivers/base/dd.c:596
 __driver_probe_device+0x3e9/0x530 drivers/base/dd.c:752
 driver_probe_device drivers/base/dd.c:782 [inline]
 __device_attach_driver+0x79f/0x1120 drivers/base/dd.c:899
 bus_for_each_drv+0x2d6/0x3f0 drivers/base/bus.c:427
 __device_attach+0x593/0x8e0 drivers/base/dd.c:970
 device_initial_probe+0x4a/0x60 drivers/base/dd.c:1017
 bus_probe_device+0x17b/0x3e0 drivers/base/bus.c:487
 device_add+0x1fff/0x26e0 drivers/base/core.c:3405
 usb_new_device+0x1b8e/0x2950 drivers/usb/core/hub.c:2566
 hub_port_connect drivers/usb/core/hub.c:5358 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5502 [inline]
 port_event drivers/usb/core/hub.c:5660 [inline]
 hub_event+0x58e3/0x89e0 drivers/usb/core/hub.c:5742
 process_one_work+0xdb6/0x1820 kernel/workqueue.c:2307
 worker_thread+0x10b3/0x21e0 kernel/workqueue.c:2454
 kthread+0x3c7/0x500 kernel/kthread.c:377
 ret_from_fork+0x1f/0x30

Local variable mac created at:
 r871xu_drv_init+0x1771/0x3070 drivers/staging/rtl8712/usb_intf.c:394
 usb_probe_interface+0xf19/0x1600 drivers/usb/core/driver.c:396

KMSAN: uninit-value in r871xu_drv_init
https://syzkaller.appspot.com/bug?id=3cd92b1d85428b128503bfa7a250294c9ae00bd8

Reported-by: <syzbot+6f5ecd144854c0d8580b@syzkaller.appspotmail.com>
Tested-by: <syzbot+6f5ecd144854c0d8580b@syzkaller.appspotmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Wang Cheng <wanngchenng@gmail.com>
Link: https://lore.kernel.org/r/14c3886173dfa4597f0704547c414cfdbcd11d16.1652618244.git.wanngchenng@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/staging/rtl8712/usb_intf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c
index 77f090bdd36e..68d66c3ce2c8 100644
--- a/drivers/staging/rtl8712/usb_intf.c
+++ b/drivers/staging/rtl8712/usb_intf.c
@@ -539,13 +539,13 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
 		} else {
 			AutoloadFail = false;
 		}
-		if (((mac[0] == 0xff) && (mac[1] == 0xff) &&
+		if ((!AutoloadFail) ||
+		    ((mac[0] == 0xff) && (mac[1] == 0xff) &&
 		     (mac[2] == 0xff) && (mac[3] == 0xff) &&
 		     (mac[4] == 0xff) && (mac[5] == 0xff)) ||
 		    ((mac[0] == 0x00) && (mac[1] == 0x00) &&
 		     (mac[2] == 0x00) && (mac[3] == 0x00) &&
-		     (mac[4] == 0x00) && (mac[5] == 0x00)) ||
-		     (!AutoloadFail)) {
+		     (mac[4] == 0x00) && (mac[5] == 0x00))) {
 			mac[0] = 0x00;
 			mac[1] = 0xe0;
 			mac[2] = 0x4c;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 132/172] serial: msm_serial: disable interrupts in __msm_console_write()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (130 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 131/172] staging: rtl8712: fix uninit-value in r871xu_drv_init() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 133/172] kernfs: Separate kernfs_pr_cont_buf and rename_lock Greg Kroah-Hartman
                   ` (40 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Marek Szyprowski, Petr Mladek,
	John Ogness, Sasha Levin

From: John Ogness <john.ogness@linutronix.de>

[ Upstream commit aabdbb1b7a5819e18c403334a31fb0cc2c06ad41 ]

__msm_console_write() assumes that interrupts are disabled, but
with threaded console printers it is possible that the write()
callback of the console is called with interrupts enabled.

Explicitly disable interrupts using local_irq_save() to preserve
the assumed context.

Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Link: https://lore.kernel.org/r/20220506213324.470461-1-john.ogness@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/msm_serial.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index 26bcbec5422e..27023a56f3ac 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -1593,6 +1593,7 @@ static inline struct uart_port *msm_get_port_from_line(unsigned int line)
 static void __msm_console_write(struct uart_port *port, const char *s,
 				unsigned int count, bool is_uartdm)
 {
+	unsigned long flags;
 	int i;
 	int num_newlines = 0;
 	bool replaced = false;
@@ -1610,6 +1611,8 @@ static void __msm_console_write(struct uart_port *port, const char *s,
 			num_newlines++;
 	count += num_newlines;
 
+	local_irq_save(flags);
+
 	if (port->sysrq)
 		locked = 0;
 	else if (oops_in_progress)
@@ -1655,6 +1658,8 @@ static void __msm_console_write(struct uart_port *port, const char *s,
 
 	if (locked)
 		spin_unlock(&port->lock);
+
+	local_irq_restore(flags);
 }
 
 static void msm_console_write(struct console *co, const char *s,
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 133/172] kernfs: Separate kernfs_pr_cont_buf and rename_lock.
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (131 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 132/172] serial: msm_serial: disable interrupts in __msm_console_write() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 134/172] watchdog: wdat_wdt: Stop watchdog when rebooting the system Greg Kroah-Hartman
                   ` (39 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Tejun Heo, Hao Luo, Sasha Levin

From: Hao Luo <haoluo@google.com>

[ Upstream commit 1a702dc88e150487c9c173a249b3d236498b9183 ]

Previously the protection of kernfs_pr_cont_buf was piggy backed by
rename_lock, which means that pr_cont() needs to be protected under
rename_lock. This can cause potential circular lock dependencies.

If there is an OOM, we have the following call hierarchy:

 -> cpuset_print_current_mems_allowed()
   -> pr_cont_cgroup_name()
     -> pr_cont_kernfs_name()

pr_cont_kernfs_name() will grab rename_lock and call printk. So we have
the following lock dependencies:

 kernfs_rename_lock -> console_sem

Sometimes, printk does a wakeup before releasing console_sem, which has
the dependence chain:

 console_sem -> p->pi_lock -> rq->lock

Now, imagine one wants to read cgroup_name under rq->lock, for example,
printing cgroup_name in a tracepoint in the scheduler code. They will
be holding rq->lock and take rename_lock:

 rq->lock -> kernfs_rename_lock

Now they will deadlock.

A prevention to this circular lock dependency is to separate the
protection of pr_cont_buf from rename_lock. In principle, rename_lock
is to protect the integrity of cgroup name when copying to buf. Once
pr_cont_buf has got its content, rename_lock can be dropped. So it's
safe to drop rename_lock after kernfs_name_locked (and
kernfs_path_from_node_locked) and rely on a dedicated pr_cont_lock
to protect pr_cont_buf.

Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Hao Luo <haoluo@google.com>
Link: https://lore.kernel.org/r/20220516190951.3144144-1-haoluo@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/kernfs/dir.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 9aec80b9d7c6..afb39e1bbe3b 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -19,7 +19,15 @@
 
 DEFINE_MUTEX(kernfs_mutex);
 static DEFINE_SPINLOCK(kernfs_rename_lock);	/* kn->parent and ->name */
-static char kernfs_pr_cont_buf[PATH_MAX];	/* protected by rename_lock */
+/*
+ * Don't use rename_lock to piggy back on pr_cont_buf. We don't want to
+ * call pr_cont() while holding rename_lock. Because sometimes pr_cont()
+ * will perform wakeups when releasing console_sem. Holding rename_lock
+ * will introduce deadlock if the scheduler reads the kernfs_name in the
+ * wakeup path.
+ */
+static DEFINE_SPINLOCK(kernfs_pr_cont_lock);
+static char kernfs_pr_cont_buf[PATH_MAX];	/* protected by pr_cont_lock */
 static DEFINE_SPINLOCK(kernfs_idr_lock);	/* root->ino_idr */
 
 #define rb_to_kn(X) rb_entry((X), struct kernfs_node, rb)
@@ -230,12 +238,12 @@ void pr_cont_kernfs_name(struct kernfs_node *kn)
 {
 	unsigned long flags;
 
-	spin_lock_irqsave(&kernfs_rename_lock, flags);
+	spin_lock_irqsave(&kernfs_pr_cont_lock, flags);
 
-	kernfs_name_locked(kn, kernfs_pr_cont_buf, sizeof(kernfs_pr_cont_buf));
+	kernfs_name(kn, kernfs_pr_cont_buf, sizeof(kernfs_pr_cont_buf));
 	pr_cont("%s", kernfs_pr_cont_buf);
 
-	spin_unlock_irqrestore(&kernfs_rename_lock, flags);
+	spin_unlock_irqrestore(&kernfs_pr_cont_lock, flags);
 }
 
 /**
@@ -249,10 +257,10 @@ void pr_cont_kernfs_path(struct kernfs_node *kn)
 	unsigned long flags;
 	int sz;
 
-	spin_lock_irqsave(&kernfs_rename_lock, flags);
+	spin_lock_irqsave(&kernfs_pr_cont_lock, flags);
 
-	sz = kernfs_path_from_node_locked(kn, NULL, kernfs_pr_cont_buf,
-					  sizeof(kernfs_pr_cont_buf));
+	sz = kernfs_path_from_node(kn, NULL, kernfs_pr_cont_buf,
+				   sizeof(kernfs_pr_cont_buf));
 	if (sz < 0) {
 		pr_cont("(error)");
 		goto out;
@@ -266,7 +274,7 @@ void pr_cont_kernfs_path(struct kernfs_node *kn)
 	pr_cont("%s", kernfs_pr_cont_buf);
 
 out:
-	spin_unlock_irqrestore(&kernfs_rename_lock, flags);
+	spin_unlock_irqrestore(&kernfs_pr_cont_lock, flags);
 }
 
 /**
@@ -864,13 +872,12 @@ static struct kernfs_node *kernfs_walk_ns(struct kernfs_node *parent,
 
 	lockdep_assert_held(&kernfs_mutex);
 
-	/* grab kernfs_rename_lock to piggy back on kernfs_pr_cont_buf */
-	spin_lock_irq(&kernfs_rename_lock);
+	spin_lock_irq(&kernfs_pr_cont_lock);
 
 	len = strlcpy(kernfs_pr_cont_buf, path, sizeof(kernfs_pr_cont_buf));
 
 	if (len >= sizeof(kernfs_pr_cont_buf)) {
-		spin_unlock_irq(&kernfs_rename_lock);
+		spin_unlock_irq(&kernfs_pr_cont_lock);
 		return NULL;
 	}
 
@@ -882,7 +889,7 @@ static struct kernfs_node *kernfs_walk_ns(struct kernfs_node *parent,
 		parent = kernfs_find_ns(parent, name, ns);
 	}
 
-	spin_unlock_irq(&kernfs_rename_lock);
+	spin_unlock_irq(&kernfs_pr_cont_lock);
 
 	return parent;
 }
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 134/172] watchdog: wdat_wdt: Stop watchdog when rebooting the system
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (132 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 133/172] kernfs: Separate kernfs_pr_cont_buf and rename_lock Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 135/172] md: protect md_unregister_thread from reentrancy Greg Kroah-Hartman
                   ` (38 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Liu Xinpeng, Guenter Roeck,
	Wim Van Sebroeck, Sasha Levin

From: Liu Xinpeng <liuxp11@chinatelecom.cn>

[ Upstream commit 27fdf84510a1374748904db43f6755f912736d92 ]

Executing reboot command several times on the machine "Dell
PowerEdge R740", UEFI security detection stopped machine
with the following prompt:

UEFI0082: The system was reset due to a timeout from the watchdog
timer. Check the System Event Log (SEL) or crash dumps from
Operating Sysstem to identify the source that triggered the
watchdog timer reset. Update the firmware or driver for the
identified device.

iDRAC has warning event: "The watchdog timer reset the system".

This patch fixes this issue by adding the reboot notifier.

Signed-off-by: Liu Xinpeng <liuxp11@chinatelecom.cn>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/1650984810-6247-3-git-send-email-liuxp11@chinatelecom.cn
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/watchdog/wdat_wdt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c
index 3065dd670a18..c60723f5ed99 100644
--- a/drivers/watchdog/wdat_wdt.c
+++ b/drivers/watchdog/wdat_wdt.c
@@ -462,6 +462,7 @@ static int wdat_wdt_probe(struct platform_device *pdev)
 		return ret;
 
 	watchdog_set_nowayout(&wdat->wdd, nowayout);
+	watchdog_stop_on_reboot(&wdat->wdd);
 	return devm_watchdog_register_device(dev, &wdat->wdd);
 }
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 135/172] md: protect md_unregister_thread from reentrancy
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (133 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 134/172] watchdog: wdat_wdt: Stop watchdog when rebooting the system Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 136/172] scsi: myrb: Fix up null pointer access on myrb_cleanup() Greg Kroah-Hartman
                   ` (37 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Donald Buczek, Guoqing Jiang,
	Song Liu, Sasha Levin

From: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>

[ Upstream commit 1e267742283a4b5a8ca65755c44166be27e9aa0f ]

Generally, the md_unregister_thread is called with reconfig_mutex, but
raid_message in dm-raid doesn't hold reconfig_mutex to unregister thread,
so md_unregister_thread can be called simulitaneously from two call sites
in theory.

Then after previous commit which remove the protection of reconfig_mutex
for md_unregister_thread completely, the potential issue could be worse
than before.

Let's take pers_lock at the beginning of function to ensure reentrancy.

Reported-by: Donald Buczek <buczek@molgen.mpg.de>
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/md/md.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 7a9701adee73..5bd1edbb415b 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7970,17 +7970,22 @@ EXPORT_SYMBOL(md_register_thread);
 
 void md_unregister_thread(struct md_thread **threadp)
 {
-	struct md_thread *thread = *threadp;
-	if (!thread)
-		return;
-	pr_debug("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk));
-	/* Locking ensures that mddev_unlock does not wake_up a
+	struct md_thread *thread;
+
+	/*
+	 * Locking ensures that mddev_unlock does not wake_up a
 	 * non-existent thread
 	 */
 	spin_lock(&pers_lock);
+	thread = *threadp;
+	if (!thread) {
+		spin_unlock(&pers_lock);
+		return;
+	}
 	*threadp = NULL;
 	spin_unlock(&pers_lock);
 
+	pr_debug("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk));
 	kthread_stop(thread->tsk);
 	kfree(thread);
 }
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 136/172] scsi: myrb: Fix up null pointer access on myrb_cleanup()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (134 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 135/172] md: protect md_unregister_thread from reentrancy Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 137/172] Revert "net: af_key: add check for pfkey_broadcast in function pfkey_process" Greg Kroah-Hartman
                   ` (36 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Zheyu Ma, Hannes Reinecke,
	Martin K. Petersen, Sasha Levin

From: Hannes Reinecke <hare@suse.de>

[ Upstream commit f9f0a46141e2e39bedb4779c88380d1b5f018c14 ]

When myrb_probe() fails the callback might not be set, so we need to
validate the 'disable_intr' callback in myrb_cleanup() to not cause a null
pointer exception. And while at it do not call myrb_cleanup() if we cannot
enable the PCI device at all.

Link: https://lore.kernel.org/r/20220523120244.99515-1-hare@suse.de
Reported-by: Zheyu Ma <zheyuma97@gmail.com>
Tested-by: Zheyu Ma <zheyuma97@gmail.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/myrb.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/myrb.c b/drivers/scsi/myrb.c
index 5fa0f4ed6565..ad17c2beaaca 100644
--- a/drivers/scsi/myrb.c
+++ b/drivers/scsi/myrb.c
@@ -1241,7 +1241,8 @@ static void myrb_cleanup(struct myrb_hba *cb)
 	myrb_unmap(cb);
 
 	if (cb->mmio_base) {
-		cb->disable_intr(cb->io_base);
+		if (cb->disable_intr)
+			cb->disable_intr(cb->io_base);
 		iounmap(cb->mmio_base);
 	}
 	if (cb->irq)
@@ -3515,9 +3516,13 @@ static struct myrb_hba *myrb_detect(struct pci_dev *pdev,
 	mutex_init(&cb->dcmd_mutex);
 	mutex_init(&cb->dma_mutex);
 	cb->pdev = pdev;
+	cb->host = shost;
 
-	if (pci_enable_device(pdev))
-		goto failure;
+	if (pci_enable_device(pdev)) {
+		dev_err(&pdev->dev, "Failed to enable PCI device\n");
+		scsi_host_put(shost);
+		return NULL;
+	}
 
 	if (privdata->hw_init == DAC960_PD_hw_init ||
 	    privdata->hw_init == DAC960_P_hw_init) {
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 137/172] Revert "net: af_key: add check for pfkey_broadcast in function pfkey_process"
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (135 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 136/172] scsi: myrb: Fix up null pointer access on myrb_cleanup() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 138/172] ceph: allow ceph.dir.rctime xattr to be updatable Greg Kroah-Hartman
                   ` (35 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Michal Kubecek, Steffen Klassert,
	Sasha Levin

From: Michal Kubecek <mkubecek@suse.cz>

[ Upstream commit 9c90c9b3e50e16d03c7f87d63e9db373974781e0 ]

This reverts commit 4dc2a5a8f6754492180741facf2a8787f2c415d7.

A non-zero return value from pfkey_broadcast() does not necessarily mean
an error occurred as this function returns -ESRCH when no registered
listener received the message. In particular, a call with
BROADCAST_PROMISC_ONLY flag and null one_sk argument can never return
zero so that this commit in fact prevents processing any PF_KEY message.
One visible effect is that racoon daemon fails to find encryption
algorithms like aes and refuses to start.

Excluding -ESRCH return value would fix this but it's not obvious that
we really want to bail out here and most other callers of
pfkey_broadcast() also ignore the return value. Also, as pointed out by
Steffen Klassert, PF_KEY is kind of deprecated and newer userspace code
should use netlink instead so that we should only disturb the code for
really important fixes.

v2: add a comment explaining why is the return value ignored

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/key/af_key.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/key/af_key.c b/net/key/af_key.c
index 6b7ed5568c09..2aa16a171285 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -2830,10 +2830,12 @@ static int pfkey_process(struct sock *sk, struct sk_buff *skb, const struct sadb
 	void *ext_hdrs[SADB_EXT_MAX];
 	int err;
 
-	err = pfkey_broadcast(skb_clone(skb, GFP_KERNEL), GFP_KERNEL,
-			      BROADCAST_PROMISC_ONLY, NULL, sock_net(sk));
-	if (err)
-		return err;
+	/* Non-zero return value of pfkey_broadcast() does not always signal
+	 * an error and even on an actual error we may still want to process
+	 * the message so rather ignore the return value.
+	 */
+	pfkey_broadcast(skb_clone(skb, GFP_KERNEL), GFP_KERNEL,
+			BROADCAST_PROMISC_ONLY, NULL, sock_net(sk));
 
 	memset(ext_hdrs, 0, sizeof(ext_hdrs));
 	err = parse_exthdrs(skb, hdr, ext_hdrs);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 138/172] ceph: allow ceph.dir.rctime xattr to be updatable
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (136 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 137/172] Revert "net: af_key: add check for pfkey_broadcast in function pfkey_process" Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 139/172] drm/radeon: fix a possible null pointer dereference Greg Kroah-Hartman
                   ` (34 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Venky Shankar, Xiubo Li,
	Ilya Dryomov, Sasha Levin

From: Venky Shankar <vshankar@redhat.com>

[ Upstream commit d7a2dc523085f8b8c60548ceedc696934aefeb0e ]

`rctime' has been a pain point in cephfs due to its buggy
nature - inconsistent values reported and those sorts.
Fixing rctime is non-trivial needing an overall redesign
of the entire nested statistics infrastructure.

As a workaround, PR

     http://github.com/ceph/ceph/pull/37938

allows this extended attribute to be manually set. This allows
users to "fixup" inconsistent rctime values. While this sounds
messy, its probably the wisest approach allowing users/scripts
to workaround buggy rctime values.

The above PR enables Ceph MDS to allow manually setting
rctime extended attribute with the corresponding user-land
changes. We may as well allow the same to be done via kclient
for parity.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/ceph/xattr.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index 197cb1234341..76322c0f6e5f 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -317,6 +317,14 @@ static ssize_t ceph_vxattrcb_snap_btime(struct ceph_inode_info *ci, char *val,
 	}
 #define XATTR_RSTAT_FIELD(_type, _name)			\
 	XATTR_NAME_CEPH(_type, _name, VXATTR_FLAG_RSTAT)
+#define XATTR_RSTAT_FIELD_UPDATABLE(_type, _name)			\
+	{								\
+		.name = CEPH_XATTR_NAME(_type, _name),			\
+		.name_size = sizeof (CEPH_XATTR_NAME(_type, _name)),	\
+		.getxattr_cb = ceph_vxattrcb_ ## _type ## _ ## _name,	\
+		.exists_cb = NULL,					\
+		.flags = VXATTR_FLAG_RSTAT,				\
+	}
 #define XATTR_LAYOUT_FIELD(_type, _name, _field)			\
 	{								\
 		.name = CEPH_XATTR_NAME2(_type, _name, _field),	\
@@ -354,7 +362,7 @@ static struct ceph_vxattr ceph_dir_vxattrs[] = {
 	XATTR_RSTAT_FIELD(dir, rfiles),
 	XATTR_RSTAT_FIELD(dir, rsubdirs),
 	XATTR_RSTAT_FIELD(dir, rbytes),
-	XATTR_RSTAT_FIELD(dir, rctime),
+	XATTR_RSTAT_FIELD_UPDATABLE(dir, rctime),
 	{
 		.name = "ceph.dir.pin",
 		.name_size = sizeof("ceph.dir.pin"),
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 139/172] drm/radeon: fix a possible null pointer dereference
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (137 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 138/172] ceph: allow ceph.dir.rctime xattr to be updatable Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 140/172] modpost: fix undefined behavior of is_arm_mapping_symbol() Greg Kroah-Hartman
                   ` (33 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Gong Yuanjun, Alex Deucher, Sasha Levin

From: Gong Yuanjun <ruc_gongyuanjun@163.com>

[ Upstream commit a2b28708b645c5632dc93669ab06e97874c8244f ]

In radeon_fp_native_mode(), the return value of drm_mode_duplicate()
is assigned to mode, which will lead to a NULL pointer dereference
on failure of drm_mode_duplicate(). Add a check to avoid npd.

The failure status of drm_cvt_mode() on the other path is checked too.

Signed-off-by: Gong Yuanjun <ruc_gongyuanjun@163.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/radeon/radeon_connectors.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index e30834434442..ef111d460be2 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -473,6 +473,8 @@ static struct drm_display_mode *radeon_fp_native_mode(struct drm_encoder *encode
 	    native_mode->vdisplay != 0 &&
 	    native_mode->clock != 0) {
 		mode = drm_mode_duplicate(dev, native_mode);
+		if (!mode)
+			return NULL;
 		mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER;
 		drm_mode_set_name(mode);
 
@@ -487,6 +489,8 @@ static struct drm_display_mode *radeon_fp_native_mode(struct drm_encoder *encode
 		 * simpler.
 		 */
 		mode = drm_cvt_mode(dev, native_mode->hdisplay, native_mode->vdisplay, 60, true, false, false);
+		if (!mode)
+			return NULL;
 		mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER;
 		DRM_DEBUG_KMS("Adding cvt approximation of native panel mode %s\n", mode->name);
 	}
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 140/172] modpost: fix undefined behavior of is_arm_mapping_symbol()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (138 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 139/172] drm/radeon: fix a possible null pointer dereference Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 141/172] x86/cpu: Elide KCSAN for cpu_has() and friends Greg Kroah-Hartman
                   ` (32 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Masahiro Yamada, Nick Desaulniers,
	Sasha Levin

From: Masahiro Yamada <masahiroy@kernel.org>

[ Upstream commit d6b732666a1bae0df3c3ae06925043bba34502b1 ]

The return value of is_arm_mapping_symbol() is unpredictable when "$"
is passed in.

strchr(3) says:
  The strchr() and strrchr() functions return a pointer to the matched
  character or NULL if the character is not found. The terminating null
  byte is considered part of the string, so that if c is specified as
  '\0', these functions return a pointer to the terminator.

When str[1] is '\0', strchr("axtd", str[1]) is not NULL, and str[2] is
referenced (i.e. buffer overrun).

Test code
---------

  char str1[] = "abc";
  char str2[] = "ab";

  strcpy(str1, "$");
  strcpy(str2, "$");

  printf("test1: %d\n", is_arm_mapping_symbol(str1));
  printf("test2: %d\n", is_arm_mapping_symbol(str2));

Result
------

  test1: 0
  test2: 1

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 scripts/mod/modpost.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index a21aa74b4948..79aef50ede17 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1271,7 +1271,8 @@ static int secref_whitelist(const struct sectioncheck *mismatch,
 
 static inline int is_arm_mapping_symbol(const char *str)
 {
-	return str[0] == '$' && strchr("axtd", str[1])
+	return str[0] == '$' &&
+	       (str[1] == 'a' || str[1] == 'd' || str[1] == 't' || str[1] == 'x')
 	       && (str[2] == '\0' || str[2] == '.');
 }
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 141/172] x86/cpu: Elide KCSAN for cpu_has() and friends
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (139 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 140/172] modpost: fix undefined behavior of is_arm_mapping_symbol() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 142/172] jump_label,noinstr: Avoid instrumentation for JUMP_LABEL=n builds Greg Kroah-Hartman
                   ` (31 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, kernel test robot,
	Peter Zijlstra (Intel),
	Sasha Levin

From: Peter Zijlstra <peterz@infradead.org>

[ Upstream commit a6a5eb269f6f3a2fe392f725a8d9052190c731e2 ]

As x86 uses the <asm-generic/bitops/instrumented-*.h> headers, the
regular forms of all bitops are instrumented with explicit calls to
KASAN and KCSAN checks. As these are explicit calls, these are not
suppressed by the noinstr function attribute.

This can result in calls to those check functions in noinstr code, which
objtool warns about:

vmlinux.o: warning: objtool: enter_from_user_mode+0x24: call to __kcsan_check_access() leaves .noinstr.text section
vmlinux.o: warning: objtool: syscall_enter_from_user_mode+0x28: call to __kcsan_check_access() leaves .noinstr.text section
vmlinux.o: warning: objtool: syscall_enter_from_user_mode_prepare+0x24: call to __kcsan_check_access() leaves .noinstr.text section
vmlinux.o: warning: objtool: irqentry_enter_from_user_mode+0x24: call to __kcsan_check_access() leaves .noinstr.text section

Prevent this by using the arch_*() bitops, which are the underlying
bitops without explciit instrumentation.

[null: Changelog]
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220502111216.290518605@infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/x86/include/asm/cpufeature.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 59bf91c57aa8..619c1f80a2ab 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -49,7 +49,7 @@ extern const char * const x86_power_flags[32];
 extern const char * const x86_bug_flags[NBUGINTS*32];
 
 #define test_cpu_cap(c, bit)						\
-	 test_bit(bit, (unsigned long *)((c)->x86_capability))
+	 arch_test_bit(bit, (unsigned long *)((c)->x86_capability))
 
 /*
  * There are 32 bits/features in each mask word.  The high bits
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 142/172] jump_label,noinstr: Avoid instrumentation for JUMP_LABEL=n builds
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (140 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 141/172] x86/cpu: Elide KCSAN for cpu_has() and friends Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 143/172] nbd: call genl_unregister_family() first in nbd_cleanup() Greg Kroah-Hartman
                   ` (30 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, kernel test robot,
	Peter Zijlstra (Intel),
	Sasha Levin

From: Peter Zijlstra <peterz@infradead.org>

[ Upstream commit 656d054e0a15ec327bd82801ccd58201e59f6896 ]

When building x86_64 with JUMP_LABEL=n it's possible for
instrumentation to sneak into noinstr:

vmlinux.o: warning: objtool: exit_to_user_mode+0x14: call to static_key_count.constprop.0() leaves .noinstr.text section
vmlinux.o: warning: objtool: syscall_exit_to_user_mode+0x2d: call to static_key_count.constprop.0() leaves .noinstr.text section
vmlinux.o: warning: objtool: irqentry_exit_to_user_mode+0x1b: call to static_key_count.constprop.0() leaves .noinstr.text section

Switch to arch_ prefixed atomic to avoid the explicit instrumentation.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/linux/jump_label.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 32809624d422..e67ee4d7318f 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -249,9 +249,9 @@ extern void static_key_disable_cpuslocked(struct static_key *key);
 #include <linux/atomic.h>
 #include <linux/bug.h>
 
-static inline int static_key_count(struct static_key *key)
+static __always_inline int static_key_count(struct static_key *key)
 {
-	return atomic_read(&key->enabled);
+	return arch_atomic_read(&key->enabled);
 }
 
 static __always_inline void jump_label_init(void)
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 143/172] nbd: call genl_unregister_family() first in nbd_cleanup()
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (141 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 142/172] jump_label,noinstr: Avoid instrumentation for JUMP_LABEL=n builds Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 144/172] nbd: fix race between nbd_alloc_config() and module removal Greg Kroah-Hartman
                   ` (29 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Hou Tao, Yu Kuai, Josef Bacik,
	Jens Axboe, Sasha Levin

From: Yu Kuai <yukuai3@huawei.com>

[ Upstream commit 06c4da89c24e7023ea448cadf8e9daf06a0aae6e ]

Otherwise there may be race between module removal and the handling of
netlink command, which can lead to the oops as shown below:

  BUG: kernel NULL pointer dereference, address: 0000000000000098
  Oops: 0002 [#1] SMP PTI
  CPU: 1 PID: 31299 Comm: nbd-client Tainted: G            E     5.14.0-rc4
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
  RIP: 0010:down_write+0x1a/0x50
  Call Trace:
   start_creating+0x89/0x130
   debugfs_create_dir+0x1b/0x130
   nbd_start_device+0x13d/0x390 [nbd]
   nbd_genl_connect+0x42f/0x748 [nbd]
   genl_family_rcv_msg_doit.isra.0+0xec/0x150
   genl_rcv_msg+0xe5/0x1e0
   netlink_rcv_skb+0x55/0x100
   genl_rcv+0x29/0x40
   netlink_unicast+0x1a8/0x250
   netlink_sendmsg+0x21b/0x430
   ____sys_sendmsg+0x2a4/0x2d0
   ___sys_sendmsg+0x81/0xc0
   __sys_sendmsg+0x62/0xb0
   __x64_sys_sendmsg+0x1f/0x30
   do_syscall_64+0x3b/0xc0
   entry_SYSCALL_64_after_hwframe+0x44/0xae
  Modules linked in: nbd(E-)

Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Link: https://lore.kernel.org/r/20220521073749.3146892-2-yukuai3@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/block/nbd.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index ecde800ba210..1ca326c66521 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -2461,6 +2461,12 @@ static void __exit nbd_cleanup(void)
 	struct nbd_device *nbd;
 	LIST_HEAD(del_list);
 
+	/*
+	 * Unregister netlink interface prior to waiting
+	 * for the completion of netlink commands.
+	 */
+	genl_unregister_family(&nbd_genl_family);
+
 	nbd_dbg_close();
 
 	mutex_lock(&nbd_index_mutex);
@@ -2476,7 +2482,6 @@ static void __exit nbd_cleanup(void)
 	}
 
 	idr_destroy(&nbd_index_idr);
-	genl_unregister_family(&nbd_genl_family);
 	unregister_blkdev(NBD_MAJOR, "nbd");
 }
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 144/172] nbd: fix race between nbd_alloc_config() and module removal
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (142 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 143/172] nbd: call genl_unregister_family() first in nbd_cleanup() Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 145/172] nbd: fix io hung while disconnecting device Greg Kroah-Hartman
                   ` (28 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Hou Tao, Yu Kuai, Josef Bacik,
	Jens Axboe, Sasha Levin

From: Yu Kuai <yukuai3@huawei.com>

[ Upstream commit c55b2b983b0fa012942c3eb16384b2b722caa810 ]

When nbd module is being removing, nbd_alloc_config() may be
called concurrently by nbd_genl_connect(), although try_module_get()
will return false, but nbd_alloc_config() doesn't handle it.

The race may lead to the leak of nbd_config and its related
resources (e.g, recv_workq) and oops in nbd_read_stat() due
to the unload of nbd module as shown below:

  BUG: kernel NULL pointer dereference, address: 0000000000000040
  Oops: 0000 [#1] SMP PTI
  CPU: 5 PID: 13840 Comm: kworker/u17:33 Not tainted 5.14.0+ #1
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
  Workqueue: knbd16-recv recv_work [nbd]
  RIP: 0010:nbd_read_stat.cold+0x130/0x1a4 [nbd]
  Call Trace:
   recv_work+0x3b/0xb0 [nbd]
   process_one_work+0x1ed/0x390
   worker_thread+0x4a/0x3d0
   kthread+0x12a/0x150
   ret_from_fork+0x22/0x30

Fixing it by checking the return value of try_module_get()
in nbd_alloc_config(). As nbd_alloc_config() may return ERR_PTR(-ENODEV),
assign nbd->config only when nbd_alloc_config() succeeds to ensure
the value of nbd->config is binary (valid or NULL).

Also adding a debug message to check the reference counter
of nbd_config during module removal.

Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Link: https://lore.kernel.org/r/20220521073749.3146892-3-yukuai3@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/block/nbd.c | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 1ca326c66521..74afa50c7864 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1472,15 +1472,20 @@ static struct nbd_config *nbd_alloc_config(void)
 {
 	struct nbd_config *config;
 
+	if (!try_module_get(THIS_MODULE))
+		return ERR_PTR(-ENODEV);
+
 	config = kzalloc(sizeof(struct nbd_config), GFP_NOFS);
-	if (!config)
-		return NULL;
+	if (!config) {
+		module_put(THIS_MODULE);
+		return ERR_PTR(-ENOMEM);
+	}
+
 	atomic_set(&config->recv_threads, 0);
 	init_waitqueue_head(&config->recv_wq);
 	init_waitqueue_head(&config->conn_wait);
 	config->blksize = NBD_DEF_BLKSIZE;
 	atomic_set(&config->live_connections, 0);
-	try_module_get(THIS_MODULE);
 	return config;
 }
 
@@ -1507,12 +1512,13 @@ static int nbd_open(struct block_device *bdev, fmode_t mode)
 			mutex_unlock(&nbd->config_lock);
 			goto out;
 		}
-		config = nbd->config = nbd_alloc_config();
-		if (!config) {
-			ret = -ENOMEM;
+		config = nbd_alloc_config();
+		if (IS_ERR(config)) {
+			ret = PTR_ERR(config);
 			mutex_unlock(&nbd->config_lock);
 			goto out;
 		}
+		nbd->config = config;
 		refcount_set(&nbd->config_refs, 1);
 		refcount_inc(&nbd->refs);
 		mutex_unlock(&nbd->config_lock);
@@ -1934,13 +1940,14 @@ static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info)
 		nbd_put(nbd);
 		return -EINVAL;
 	}
-	config = nbd->config = nbd_alloc_config();
-	if (!nbd->config) {
+	config = nbd_alloc_config();
+	if (IS_ERR(config)) {
 		mutex_unlock(&nbd->config_lock);
 		nbd_put(nbd);
 		printk(KERN_ERR "nbd: couldn't allocate config\n");
-		return -ENOMEM;
+		return PTR_ERR(config);
 	}
+	nbd->config = config;
 	refcount_set(&nbd->config_refs, 1);
 	set_bit(NBD_RT_BOUND, &config->runtime_flags);
 
@@ -2476,6 +2483,9 @@ static void __exit nbd_cleanup(void)
 	while (!list_empty(&del_list)) {
 		nbd = list_first_entry(&del_list, struct nbd_device, list);
 		list_del_init(&nbd->list);
+		if (refcount_read(&nbd->config_refs))
+			printk(KERN_ERR "nbd: possibly leaking nbd_config (ref %d)\n",
+					refcount_read(&nbd->config_refs));
 		if (refcount_read(&nbd->refs) != 1)
 			printk(KERN_ERR "nbd: possibly leaking a device\n");
 		nbd_put(nbd);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 145/172] nbd: fix io hung while disconnecting device
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (143 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 144/172] nbd: fix race between nbd_alloc_config() and module removal Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 146/172] s390/gmap: voluntarily schedule during key setting Greg Kroah-Hartman
                   ` (27 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yu Kuai, Josef Bacik, Jens Axboe,
	Sasha Levin

From: Yu Kuai <yukuai3@huawei.com>

[ Upstream commit 09dadb5985023e27d4740ebd17e6fea4640110e5 ]

In our tests, "qemu-nbd" triggers a io hung:

INFO: task qemu-nbd:11445 blocked for more than 368 seconds.
      Not tainted 5.18.0-rc3-next-20220422-00003-g2176915513ca #884
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:qemu-nbd        state:D stack:    0 pid:11445 ppid:     1 flags:0x00000000
Call Trace:
 <TASK>
 __schedule+0x480/0x1050
 ? _raw_spin_lock_irqsave+0x3e/0xb0
 schedule+0x9c/0x1b0
 blk_mq_freeze_queue_wait+0x9d/0xf0
 ? ipi_rseq+0x70/0x70
 blk_mq_freeze_queue+0x2b/0x40
 nbd_add_socket+0x6b/0x270 [nbd]
 nbd_ioctl+0x383/0x510 [nbd]
 blkdev_ioctl+0x18e/0x3e0
 __x64_sys_ioctl+0xac/0x120
 do_syscall_64+0x35/0x80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7fd8ff706577
RSP: 002b:00007fd8fcdfebf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000040000000 RCX: 00007fd8ff706577
RDX: 000000000000000d RSI: 000000000000ab00 RDI: 000000000000000f
RBP: 000000000000000f R08: 000000000000fbe8 R09: 000055fe497c62b0
R10: 00000002aff20000 R11: 0000000000000246 R12: 000000000000006d
R13: 0000000000000000 R14: 00007ffe82dc5e70 R15: 00007fd8fcdff9c0

"qemu-ndb -d" will call ioctl 'NBD_DISCONNECT' first, however, following
message was found:

block nbd0: Send disconnect failed -32

Which indicate that something is wrong with the server. Then,
"qemu-nbd -d" will call ioctl 'NBD_CLEAR_SOCK', however ioctl can't clear
requests after commit 2516ab1543fd("nbd: only clear the queue on device
teardown"). And in the meantime, request can't complete through timeout
because nbd_xmit_timeout() will always return 'BLK_EH_RESET_TIMER', which
means such request will never be completed in this situation.

Now that the flag 'NBD_CMD_INFLIGHT' can make sure requests won't
complete multiple times, switch back to call nbd_clear_sock() in
nbd_clear_sock_ioctl(), so that inflight requests can be cleared.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Link: https://lore.kernel.org/r/20220521073749.3146892-5-yukuai3@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/block/nbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 74afa50c7864..4a6b82d434ee 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1359,7 +1359,7 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd, struct block_device *b
 static void nbd_clear_sock_ioctl(struct nbd_device *nbd,
 				 struct block_device *bdev)
 {
-	sock_shutdown(nbd);
+	nbd_clear_sock(nbd);
 	__invalidate_device(bdev, true);
 	nbd_bdev_reset(bdev);
 	if (test_and_clear_bit(NBD_RT_HAS_CONFIG_REF,
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 146/172] s390/gmap: voluntarily schedule during key setting
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (144 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 145/172] nbd: fix io hung while disconnecting device Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 147/172] cifs: version operations for smb20 unneeded when legacy support disabled Greg Kroah-Hartman
                   ` (26 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christian Borntraeger,
	Alexander Gordeev, Claudio Imbrenda, Heiko Carstens, Sasha Levin

From: Christian Borntraeger <borntraeger@linux.ibm.com>

[ Upstream commit 6d5946274df1fff539a7eece458a43be733d1db8 ]

With large and many guest with storage keys it is possible to create
large latencies or stalls during initial key setting:

rcu: INFO: rcu_sched self-detected stall on CPU
rcu:   18-....: (2099 ticks this GP) idle=54e/1/0x4000000000000002 softirq=35598716/35598716 fqs=998
       (t=2100 jiffies g=155867385 q=20879)
Task dump for CPU 18:
CPU 1/KVM       R  running task        0 1030947 256019 0x06000004
Call Trace:
sched_show_task
rcu_dump_cpu_stacks
rcu_sched_clock_irq
update_process_times
tick_sched_handle
tick_sched_timer
__hrtimer_run_queues
hrtimer_interrupt
do_IRQ
ext_int_handler
ptep_zap_key

The mmap lock is held during the page walking but since this is a
semaphore scheduling is still possible. Same for the kvm srcu.
To minimize overhead do this on every segment table entry or large page.

Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Link: https://lore.kernel.org/r/20220530092706.11637-2-borntraeger@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/s390/mm/gmap.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
index f2d19d40272c..2db097c14cec 100644
--- a/arch/s390/mm/gmap.c
+++ b/arch/s390/mm/gmap.c
@@ -2596,6 +2596,18 @@ static int __s390_enable_skey_pte(pte_t *pte, unsigned long addr,
 	return 0;
 }
 
+/*
+ * Give a chance to schedule after setting a key to 256 pages.
+ * We only hold the mm lock, which is a rwsem and the kvm srcu.
+ * Both can sleep.
+ */
+static int __s390_enable_skey_pmd(pmd_t *pmd, unsigned long addr,
+				  unsigned long next, struct mm_walk *walk)
+{
+	cond_resched();
+	return 0;
+}
+
 static int __s390_enable_skey_hugetlb(pte_t *pte, unsigned long addr,
 				      unsigned long hmask, unsigned long next,
 				      struct mm_walk *walk)
@@ -2618,12 +2630,14 @@ static int __s390_enable_skey_hugetlb(pte_t *pte, unsigned long addr,
 	end = start + HPAGE_SIZE - 1;
 	__storage_key_init_range(start, end);
 	set_bit(PG_arch_1, &page->flags);
+	cond_resched();
 	return 0;
 }
 
 static const struct mm_walk_ops enable_skey_walk_ops = {
 	.hugetlb_entry		= __s390_enable_skey_hugetlb,
 	.pte_entry		= __s390_enable_skey_pte,
+	.pmd_entry		= __s390_enable_skey_pmd,
 };
 
 int s390_enable_skey(void)
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 147/172] cifs: version operations for smb20 unneeded when legacy support disabled
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (145 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 146/172] s390/gmap: voluntarily schedule during key setting Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 148/172] nodemask: Fix return values to be unsigned Greg Kroah-Hartman
                   ` (25 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ronnie Sahlberg, Steve French, Sasha Levin

From: Steve French <stfrench@microsoft.com>

[ Upstream commit 7ef93ffccd55fb0ba000ed16ef6a81cd7dee07b5 ]

We should not be including unused smb20 specific code when legacy
support is disabled (CONFIG_CIFS_ALLOW_INSECURE_LEGACY turned
off).  For example smb2_operations and smb2_values aren't used
in that case.  Over time we can move more and more SMB1/CIFS and SMB2.0
code into the insecure legacy ifdefs

Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/cifs/cifsglob.h | 4 +++-
 fs/cifs/smb2ops.c  | 7 ++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 6599069be690..196285b0fe46 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -1982,11 +1982,13 @@ extern mempool_t *cifs_mid_poolp;
 
 /* Operations for different SMB versions */
 #define SMB1_VERSION_STRING	"1.0"
+#define SMB20_VERSION_STRING    "2.0"
+#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
 extern struct smb_version_operations smb1_operations;
 extern struct smb_version_values smb1_values;
-#define SMB20_VERSION_STRING	"2.0"
 extern struct smb_version_operations smb20_operations;
 extern struct smb_version_values smb20_values;
+#endif /* CIFS_ALLOW_INSECURE_LEGACY */
 #define SMB21_VERSION_STRING	"2.1"
 extern struct smb_version_operations smb21_operations;
 extern struct smb_version_values smb21_values;
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 7fea94ebda57..b855abfaaf87 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -4032,11 +4032,13 @@ smb3_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock,
 	}
 }
 
+#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
 static bool
 smb2_is_read_op(__u32 oplock)
 {
 	return oplock == SMB2_OPLOCK_LEVEL_II;
 }
+#endif /* CIFS_ALLOW_INSECURE_LEGACY */
 
 static bool
 smb21_is_read_op(__u32 oplock)
@@ -5122,7 +5124,7 @@ smb2_make_node(unsigned int xid, struct inode *inode,
 	return rc;
 }
 
-
+#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
 struct smb_version_operations smb20_operations = {
 	.compare_fids = smb2_compare_fids,
 	.setup_request = smb2_setup_request,
@@ -5220,6 +5222,7 @@ struct smb_version_operations smb20_operations = {
 	.llseek = smb3_llseek,
 	.is_status_io_timeout = smb2_is_status_io_timeout,
 };
+#endif /* CIFS_ALLOW_INSECURE_LEGACY */
 
 struct smb_version_operations smb21_operations = {
 	.compare_fids = smb2_compare_fids,
@@ -5548,6 +5551,7 @@ struct smb_version_operations smb311_operations = {
 	.is_status_io_timeout = smb2_is_status_io_timeout,
 };
 
+#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
 struct smb_version_values smb20_values = {
 	.version_string = SMB20_VERSION_STRING,
 	.protocol_id = SMB20_PROT_ID,
@@ -5568,6 +5572,7 @@ struct smb_version_values smb20_values = {
 	.signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED,
 	.create_lease_size = sizeof(struct create_lease),
 };
+#endif /* ALLOW_INSECURE_LEGACY */
 
 struct smb_version_values smb21_values = {
 	.version_string = SMB21_VERSION_STRING,
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 148/172] nodemask: Fix return values to be unsigned
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (146 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 147/172] cifs: version operations for smb20 unneeded when legacy support disabled Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 149/172] vringh: Fix loop descriptors check in the indirect cases Greg Kroah-Hartman
                   ` (24 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christophe de Dinechin,
	Alexey Dobriyan, Yury Norov, Andy Shevchenko, Rasmus Villemoes,
	Andrew Morton, Zhen Lei, Kees Cook, Sasha Levin

From: Kees Cook <keescook@chromium.org>

[ Upstream commit 0dfe54071d7c828a02917b595456bfde1afdddc9 ]

The nodemask routines had mixed return values that provided potentially
signed return values that could never happen. This was leading to the
compiler getting confusing about the range of possible return values
(it was thinking things could be negative where they could not be). Fix
all the nodemask routines that should be returning unsigned
(or bool) values. Silences:

 mm/swapfile.c: In function ‘setup_swap_info’:
 mm/swapfile.c:2291:47: error: array subscript -1 is below array bounds of ‘struct plist_node[]’ [-Werror=array-bounds]
  2291 |                                 p->avail_lists[i].prio = 1;
       |                                 ~~~~~~~~~~~~~~^~~
 In file included from mm/swapfile.c:16:
 ./include/linux/swap.h:292:27: note: while referencing ‘avail_lists’
   292 |         struct plist_node avail_lists[]; /*
       |                           ^~~~~~~~~~~

Reported-by: Christophe de Dinechin <dinechin@redhat.com>
Link: https://lore.kernel.org/lkml/20220414150855.2407137-3-dinechin@redhat.com/
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Yury Norov <yury.norov@gmail.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Yury Norov <yury.norov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/linux/nodemask.h | 38 +++++++++++++++++++-------------------
 lib/nodemask.c           |  4 ++--
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 843678bfc364..2a63ef05a6cc 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -42,11 +42,11 @@
  * void nodes_shift_right(dst, src, n)	Shift right
  * void nodes_shift_left(dst, src, n)	Shift left
  *
- * int first_node(mask)			Number lowest set bit, or MAX_NUMNODES
- * int next_node(node, mask)		Next node past 'node', or MAX_NUMNODES
- * int next_node_in(node, mask)		Next node past 'node', or wrap to first,
+ * unsigned int first_node(mask)	Number lowest set bit, or MAX_NUMNODES
+ * unsigend int next_node(node, mask)	Next node past 'node', or MAX_NUMNODES
+ * unsigned int next_node_in(node, mask) Next node past 'node', or wrap to first,
  *					or MAX_NUMNODES
- * int first_unset_node(mask)		First node not set in mask, or 
+ * unsigned int first_unset_node(mask)	First node not set in mask, or
  *					MAX_NUMNODES
  *
  * nodemask_t nodemask_of_node(node)	Return nodemask with bit 'node' set
@@ -153,7 +153,7 @@ static inline void __nodes_clear(nodemask_t *dstp, unsigned int nbits)
 
 #define node_test_and_set(node, nodemask) \
 			__node_test_and_set((node), &(nodemask))
-static inline int __node_test_and_set(int node, nodemask_t *addr)
+static inline bool __node_test_and_set(int node, nodemask_t *addr)
 {
 	return test_and_set_bit(node, addr->bits);
 }
@@ -200,7 +200,7 @@ static inline void __nodes_complement(nodemask_t *dstp,
 
 #define nodes_equal(src1, src2) \
 			__nodes_equal(&(src1), &(src2), MAX_NUMNODES)
-static inline int __nodes_equal(const nodemask_t *src1p,
+static inline bool __nodes_equal(const nodemask_t *src1p,
 					const nodemask_t *src2p, unsigned int nbits)
 {
 	return bitmap_equal(src1p->bits, src2p->bits, nbits);
@@ -208,7 +208,7 @@ static inline int __nodes_equal(const nodemask_t *src1p,
 
 #define nodes_intersects(src1, src2) \
 			__nodes_intersects(&(src1), &(src2), MAX_NUMNODES)
-static inline int __nodes_intersects(const nodemask_t *src1p,
+static inline bool __nodes_intersects(const nodemask_t *src1p,
 					const nodemask_t *src2p, unsigned int nbits)
 {
 	return bitmap_intersects(src1p->bits, src2p->bits, nbits);
@@ -216,20 +216,20 @@ static inline int __nodes_intersects(const nodemask_t *src1p,
 
 #define nodes_subset(src1, src2) \
 			__nodes_subset(&(src1), &(src2), MAX_NUMNODES)
-static inline int __nodes_subset(const nodemask_t *src1p,
+static inline bool __nodes_subset(const nodemask_t *src1p,
 					const nodemask_t *src2p, unsigned int nbits)
 {
 	return bitmap_subset(src1p->bits, src2p->bits, nbits);
 }
 
 #define nodes_empty(src) __nodes_empty(&(src), MAX_NUMNODES)
-static inline int __nodes_empty(const nodemask_t *srcp, unsigned int nbits)
+static inline bool __nodes_empty(const nodemask_t *srcp, unsigned int nbits)
 {
 	return bitmap_empty(srcp->bits, nbits);
 }
 
 #define nodes_full(nodemask) __nodes_full(&(nodemask), MAX_NUMNODES)
-static inline int __nodes_full(const nodemask_t *srcp, unsigned int nbits)
+static inline bool __nodes_full(const nodemask_t *srcp, unsigned int nbits)
 {
 	return bitmap_full(srcp->bits, nbits);
 }
@@ -260,15 +260,15 @@ static inline void __nodes_shift_left(nodemask_t *dstp,
           > MAX_NUMNODES, then the silly min_ts could be dropped. */
 
 #define first_node(src) __first_node(&(src))
-static inline int __first_node(const nodemask_t *srcp)
+static inline unsigned int __first_node(const nodemask_t *srcp)
 {
-	return min_t(int, MAX_NUMNODES, find_first_bit(srcp->bits, MAX_NUMNODES));
+	return min_t(unsigned int, MAX_NUMNODES, find_first_bit(srcp->bits, MAX_NUMNODES));
 }
 
 #define next_node(n, src) __next_node((n), &(src))
-static inline int __next_node(int n, const nodemask_t *srcp)
+static inline unsigned int __next_node(int n, const nodemask_t *srcp)
 {
-	return min_t(int,MAX_NUMNODES,find_next_bit(srcp->bits, MAX_NUMNODES, n+1));
+	return min_t(unsigned int, MAX_NUMNODES, find_next_bit(srcp->bits, MAX_NUMNODES, n+1));
 }
 
 /*
@@ -276,7 +276,7 @@ static inline int __next_node(int n, const nodemask_t *srcp)
  * the first node in src if needed.  Returns MAX_NUMNODES if src is empty.
  */
 #define next_node_in(n, src) __next_node_in((n), &(src))
-int __next_node_in(int node, const nodemask_t *srcp);
+unsigned int __next_node_in(int node, const nodemask_t *srcp);
 
 static inline void init_nodemask_of_node(nodemask_t *mask, int node)
 {
@@ -296,9 +296,9 @@ static inline void init_nodemask_of_node(nodemask_t *mask, int node)
 })
 
 #define first_unset_node(mask) __first_unset_node(&(mask))
-static inline int __first_unset_node(const nodemask_t *maskp)
+static inline unsigned int __first_unset_node(const nodemask_t *maskp)
 {
-	return min_t(int,MAX_NUMNODES,
+	return min_t(unsigned int, MAX_NUMNODES,
 			find_first_zero_bit(maskp->bits, MAX_NUMNODES));
 }
 
@@ -435,11 +435,11 @@ static inline int num_node_state(enum node_states state)
 
 #define first_online_node	first_node(node_states[N_ONLINE])
 #define first_memory_node	first_node(node_states[N_MEMORY])
-static inline int next_online_node(int nid)
+static inline unsigned int next_online_node(int nid)
 {
 	return next_node(nid, node_states[N_ONLINE]);
 }
-static inline int next_memory_node(int nid)
+static inline unsigned int next_memory_node(int nid)
 {
 	return next_node(nid, node_states[N_MEMORY]);
 }
diff --git a/lib/nodemask.c b/lib/nodemask.c
index 3aa454c54c0d..e22647f5181b 100644
--- a/lib/nodemask.c
+++ b/lib/nodemask.c
@@ -3,9 +3,9 @@
 #include <linux/module.h>
 #include <linux/random.h>
 
-int __next_node_in(int node, const nodemask_t *srcp)
+unsigned int __next_node_in(int node, const nodemask_t *srcp)
 {
-	int ret = __next_node(node, srcp);
+	unsigned int ret = __next_node(node, srcp);
 
 	if (ret == MAX_NUMNODES)
 		ret = __first_node(srcp);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 149/172] vringh: Fix loop descriptors check in the indirect cases
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (147 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 148/172] nodemask: Fix return values to be unsigned Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 150/172] scripts/gdb: change kernel config dumping method Greg Kroah-Hartman
                   ` (23 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Xie Yongji, Fam Zheng,
	Michael S. Tsirkin, Jason Wang, Sasha Levin

From: Xie Yongji <xieyongji@bytedance.com>

[ Upstream commit dbd29e0752286af74243cf891accf472b2f3edd8 ]

We should use size of descriptor chain to test loop condition
in the indirect case. And another statistical count is also introduced
for indirect descriptors to avoid conflict with the statistical count
of direct descriptors.

Fixes: f87d0fbb5798 ("vringh: host-side implementation of virtio rings.")
Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Signed-off-by: Fam Zheng <fam.zheng@bytedance.com>
Message-Id: <20220505100910.137-1-xieyongji@bytedance.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/vhost/vringh.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
index 0bd7e64331f0..5a0340c85dc6 100644
--- a/drivers/vhost/vringh.c
+++ b/drivers/vhost/vringh.c
@@ -274,7 +274,7 @@ __vringh_iov(struct vringh *vrh, u16 i,
 	     int (*copy)(const struct vringh *vrh,
 			 void *dst, const void *src, size_t len))
 {
-	int err, count = 0, up_next, desc_max;
+	int err, count = 0, indirect_count = 0, up_next, desc_max;
 	struct vring_desc desc, *descs;
 	struct vringh_range range = { -1ULL, 0 }, slowrange;
 	bool slow = false;
@@ -331,7 +331,12 @@ __vringh_iov(struct vringh *vrh, u16 i,
 			continue;
 		}
 
-		if (count++ == vrh->vring.num) {
+		if (up_next == -1)
+			count++;
+		else
+			indirect_count++;
+
+		if (count > vrh->vring.num || indirect_count > desc_max) {
 			vringh_bad("Descriptor loop in %p", descs);
 			err = -ELOOP;
 			goto fail;
@@ -393,6 +398,7 @@ __vringh_iov(struct vringh *vrh, u16 i,
 				i = return_from_indirect(vrh, &up_next,
 							 &descs, &desc_max);
 				slow = false;
+				indirect_count = 0;
 			} else
 				break;
 		}
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 150/172] scripts/gdb: change kernel config dumping method
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (148 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 149/172] vringh: Fix loop descriptors check in the indirect cases Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 151/172] ALSA: hda/conexant - Fix loopback issue with CX20632 Greg Kroah-Hartman
                   ` (22 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Kuan-Ying Lee, Masahiro Yamada, Sasha Levin

From: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>

[ Upstream commit 1f7a6cf6b07c74a17343c2559cd5f5018a245961 ]

MAGIC_START("IKCFG_ST") and MAGIC_END("IKCFG_ED") are moved out
from the kernel_config_data variable.

Thus, we parse kernel_config_data directly instead of considering
offset of MAGIC_START and MAGIC_END.

Fixes: 13610aa908dc ("kernel/configs: use .incbin directive to embed config_data.gz")
Signed-off-by: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 scripts/gdb/linux/config.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/gdb/linux/config.py b/scripts/gdb/linux/config.py
index 90e1565b1967..8843ab3cbadd 100644
--- a/scripts/gdb/linux/config.py
+++ b/scripts/gdb/linux/config.py
@@ -24,9 +24,9 @@ class LxConfigDump(gdb.Command):
             filename = arg
 
         try:
-            py_config_ptr = gdb.parse_and_eval("kernel_config_data + 8")
-            py_config_size = gdb.parse_and_eval(
-                    "sizeof(kernel_config_data) - 1 - 8 * 2")
+            py_config_ptr = gdb.parse_and_eval("&kernel_config_data")
+            py_config_ptr_end = gdb.parse_and_eval("&kernel_config_data_end")
+            py_config_size = py_config_ptr_end - py_config_ptr
         except gdb.error as e:
             raise gdb.GdbError("Can't find config, enable CONFIG_IKCONFIG?")
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 174+ messages in thread

* [PATCH 5.10 151/172] ALSA: hda/conexant - Fix loopback issue with CX20632
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (149 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 150/172] scripts/gdb: change kernel config dumping method Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 152/172] ALSA: hda/realtek: Fix for quirk to enable speaker output on the Lenovo Yoga DuetITL 2021 Greg Kroah-Hartman
                   ` (21 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, huangwenhui, Takashi Iwai

From: huangwenhui <huangwenhuia@uniontech.com>

commit d5ea7544c32ba27c2c5826248e4ff58bd50a2518 upstream.

On a machine with CX20632, Alsamixer doesn't have 'Loopback
Mixing' and 'Line'.

Signed-off-by: huangwenhui <huangwenhuia@uniontech.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220607065631.10708-1-huangwenhuia@uniontech.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/pci/hda/patch_conexant.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -1045,6 +1045,13 @@ static int patch_conexant_auto(struct hd
 		snd_hda_pick_fixup(codec, cxt5051_fixup_models,
 				   cxt5051_fixups, cxt_fixups);
 		break;
+	case 0x14f15098:
+		codec->pin_amp_workaround = 1;
+		spec->gen.mixer_nid = 0x22;
+		spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
+		snd_hda_pick_fixup(codec, cxt5066_fixup_models,
+				   cxt5066_fixups, cxt_fixups);
+		break;
 	case 0x14f150f2:
 		codec->power_save_node = 1;
 		fallthrough;



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 152/172] ALSA: hda/realtek: Fix for quirk to enable speaker output on the Lenovo Yoga DuetITL 2021
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (150 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 151/172] ALSA: hda/conexant - Fix loopback issue with CX20632 Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 153/172] cifs: return errors during session setup during reconnects Greg Kroah-Hartman
                   ` (20 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Cameron Berkenpas, Takashi Iwai, Songine

From: Cameron Berkenpas <cam@neo-zeon.de>

commit 85743a847caeab696dafc4ce1a7e1e2b7e29a0f6 upstream.

Enables the ALC287_FIXUP_YOGA7_14ITL_SPEAKERS quirk for the Lenovo
Yoga DuetITL 2021 laptop to fix speaker output.

[ re-sorted in the SSID order by tiwai ]

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=208555
Signed-off-by: Cameron Berkenpas <cam@neo-zeon.de>
Co-authored-by: Songine <donglingluoying@gmail.com>
Cc: stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220606002329.215330-1-cam@neo-zeon.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/pci/hda/patch_realtek.c |    1 +
 1 file changed, 1 insertion(+)

--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -8977,6 +8977,7 @@ static const struct snd_pci_quirk alc269
 	SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
 	SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
 	SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
+	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
 	SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
 	SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
 	SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 153/172] cifs: return errors during session setup during reconnects
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (151 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 152/172] ALSA: hda/realtek: Fix for quirk to enable speaker output on the Lenovo Yoga DuetITL 2021 Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 154/172] cifs: fix reconnect on smb3 mount types Greg Kroah-Hartman
                   ` (19 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Shyam Prasad N, Enzo Matsumiya, Steve French

From: Shyam Prasad N <sprasad@microsoft.com>

commit 8ea21823aa584b55ba4b861307093b78054b0c1b upstream.

During reconnects, we check the return value from
cifs_negotiate_protocol, and have handlers for both success
and failures. But if that passes, and cifs_setup_session
returns any errors other than -EACCES, we do not handle
that. This fix adds a handler for that, so that we don't
go ahead and try a tree_connect on a failed session.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Reviewed-by: Enzo Matsumiya <ematsumiya@suse.de>
Cc: stable@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/cifs/smb2pdu.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -281,6 +281,9 @@ smb2_reconnect(__le16 smb2_command, stru
 			ses->binding_chan = NULL;
 			mutex_unlock(&tcon->ses->session_mutex);
 			goto failed;
+		} else if (rc) {
+			mutex_unlock(&ses->session_mutex);
+			goto out;
 		}
 	}
 	/*



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 154/172] cifs: fix reconnect on smb3 mount types
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (152 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 153/172] cifs: return errors during session setup during reconnects Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 155/172] ata: libata-transport: fix {dma|pio|xfer}_mode sysfs files Greg Kroah-Hartman
                   ` (18 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Satadru Pramanik,
	Paulo Alcantara (SUSE),
	Steve French

From: Paulo Alcantara <pc@cjr.nz>

commit c36ee7dab7749f7be21f7a72392744490b2a9a2b upstream.

cifs.ko defines two file system types: cifs & smb3, and
__cifs_get_super() was not including smb3 file system type when
looking up superblocks, therefore failing to reconnect tcons in
cifs_tree_connect().

Fix this by calling iterate_supers_type() on both file system types.

Link: https://lore.kernel.org/r/CAFrh3J9soC36+BVuwHB=g9z_KB5Og2+p2_W+BBoBOZveErz14w@mail.gmail.com
Cc: stable@vger.kernel.org
Tested-by: Satadru Pramanik <satadru@gmail.com>
Reported-by: Satadru Pramanik <satadru@gmail.com>
Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/cifs/cifsfs.c |    2 +-
 fs/cifs/cifsfs.h |    2 +-
 fs/cifs/misc.c   |   27 ++++++++++++++++-----------
 3 files changed, 18 insertions(+), 13 deletions(-)

--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -1033,7 +1033,7 @@ struct file_system_type cifs_fs_type = {
 };
 MODULE_ALIAS_FS("cifs");
 
-static struct file_system_type smb3_fs_type = {
+struct file_system_type smb3_fs_type = {
 	.owner = THIS_MODULE,
 	.name = "smb3",
 	.mount = smb3_do_mount,
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -51,7 +51,7 @@ static inline unsigned long cifs_get_tim
 	return (unsigned long) dentry->d_fsdata;
 }
 
-extern struct file_system_type cifs_fs_type;
+extern struct file_system_type cifs_fs_type, smb3_fs_type;
 extern const struct address_space_operations cifs_addr_ops;
 extern const struct address_space_operations cifs_addr_ops_smallbuf;
 
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -1053,18 +1053,23 @@ static struct super_block *__cifs_get_su
 		.data = data,
 		.sb = NULL,
 	};
+	struct file_system_type **fs_type = (struct file_system_type *[]) {
+		&cifs_fs_type, &smb3_fs_type, NULL,
+	};
 
-	iterate_supers_type(&cifs_fs_type, f, &sd);
-
-	if (!sd.sb)
-		return ERR_PTR(-EINVAL);
-	/*
-	 * Grab an active reference in order to prevent automounts (DFS links)
-	 * of expiring and then freeing up our cifs superblock pointer while
-	 * we're doing failover.
-	 */
-	cifs_sb_active(sd.sb);
-	return sd.sb;
+	for (; *fs_type; fs_type++) {
+		iterate_supers_type(*fs_type, f, &sd);
+		if (sd.sb) {
+			/*
+			 * Grab an active reference in order to prevent automounts (DFS links)
+			 * of expiring and then freeing up our cifs superblock pointer while
+			 * we're doing failover.
+			 */
+			cifs_sb_active(sd.sb);
+			return sd.sb;
+		}
+	}
+	return ERR_PTR(-EINVAL);
 }
 
 static void __cifs_put_super(struct super_block *sb)



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 155/172] ata: libata-transport: fix {dma|pio|xfer}_mode sysfs files
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (153 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 154/172] cifs: fix reconnect on smb3 mount types Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 156/172] mmc: block: Fix CQE recovery reset success Greg Kroah-Hartman
                   ` (17 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Sergey Shtylyov, Damien Le Moal

From: Sergey Shtylyov <s.shtylyov@omp.ru>

commit 72aad489f992871e908ff6d9055b26c6366fb864 upstream.

The {dma|pio}_mode sysfs files are incorrectly documented as having a
list of the supported DMA/PIO transfer modes, while the corresponding
fields of the *struct* ata_device hold the transfer mode IDs, not masks.

To match these docs, the {dma|pio}_mode (and even xfer_mode!) sysfs
files are handled by the ata_bitfield_name_match() macro which leads to
reading such kind of nonsense from them:

$ cat /sys/class/ata_device/dev3.0/pio_mode
XFER_UDMA_7, XFER_UDMA_6, XFER_UDMA_5, XFER_UDMA_4, XFER_MW_DMA_4,
XFER_PIO_6, XFER_PIO_5, XFER_PIO_4, XFER_PIO_3, XFER_PIO_2, XFER_PIO_1,
XFER_PIO_0

Using the correct ata_bitfield_name_search() macro fixes that:

$ cat /sys/class/ata_device/dev3.0/pio_mode
XFER_PIO_4

While fixing the file documentation, somewhat reword the {dma|pio}_mode
file doc and add a note about being mostly useful for PATA devices to
the xfer_mode file doc...

Fixes: d9027470b886 ("[libata] Add ATA transport class")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 Documentation/ABI/testing/sysfs-ata |   11 ++++++-----
 drivers/ata/libata-transport.c      |    2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

--- a/Documentation/ABI/testing/sysfs-ata
+++ b/Documentation/ABI/testing/sysfs-ata
@@ -107,13 +107,14 @@ Description:
 				described in ATA8 7.16 and 7.17. Only valid if
 				the device is not a PM.
 
-		pio_mode:	(RO) Transfer modes supported by the device when
-				in PIO mode. Mostly used by PATA device.
+		pio_mode:	(RO) PIO transfer mode used by the device.
+				Mostly used by PATA devices.
 
-		xfer_mode:	(RO) Current transfer mode
+		xfer_mode:	(RO) Current transfer mode. Mostly used by
+				PATA devices.
 
-		dma_mode:	(RO) Transfer modes supported by the device when
-				in DMA mode. Mostly used by PATA device.
+		dma_mode:	(RO) DMA transfer mode used by the device.
+				Mostly used by PATA devices.
 
 		class:		(RO) Device class. Can be "ata" for disk,
 				"atapi" for packet device, "pmp" for PM, or
--- a/drivers/ata/libata-transport.c
+++ b/drivers/ata/libata-transport.c
@@ -196,7 +196,7 @@ static struct {
 	{ XFER_PIO_0,			"XFER_PIO_0" },
 	{ XFER_PIO_SLOW,		"XFER_PIO_SLOW" }
 };
-ata_bitfield_name_match(xfer,ata_xfer_names)
+ata_bitfield_name_search(xfer, ata_xfer_names)
 
 /*
  * ATA Port attributes



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 156/172] mmc: block: Fix CQE recovery reset success
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (154 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 155/172] ata: libata-transport: fix {dma|pio|xfer}_mode sysfs files Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 157/172] net: phy: dp83867: retrigger SGMII AN when link change Greg Kroah-Hartman
                   ` (16 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Adrian Hunter, Ulf Hansson

From: Adrian Hunter <adrian.hunter@intel.com>

commit a051246b786af7e4a9d9219cc7038a6e8a411531 upstream.

The intention of the use of mmc_blk_reset_success() in
mmc_blk_cqe_recovery() was to prevent repeated resets when retrying and
getting the same error. However, that may not be the case - any amount
of time and I/O may pass before another recovery is needed, in which
case there would be no reason to deny it the opportunity to recover via
a reset if necessary. CQE recovery is expected seldom and failure to
recover (if the clear tasks command fails), even more seldom, so it is
better to allow the reset always, which can be done by calling
mmc_blk_reset_success() always.

Fixes: 1e8e55b67030c6 ("mmc: block: Add CQE support")
Cc: stable@vger.kernel.org
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20220531171922.76080-1-adrian.hunter@intel.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/mmc/core/block.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -1442,8 +1442,7 @@ void mmc_blk_cqe_recovery(struct mmc_que
 	err = mmc_cqe_recovery(host);
 	if (err)
 		mmc_blk_reset(mq->blkdata, host, MMC_BLK_CQE_RECOVERY);
-	else
-		mmc_blk_reset_success(mq->blkdata, MMC_BLK_CQE_RECOVERY);
+	mmc_blk_reset_success(mq->blkdata, MMC_BLK_CQE_RECOVERY);
 
 	pr_debug("%s: CQE recovery done\n", mmc_hostname(host));
 }



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 157/172] net: phy: dp83867: retrigger SGMII AN when link change
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (155 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 156/172] mmc: block: Fix CQE recovery reset success Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 158/172] nfc: st21nfca: fix incorrect validating logic in EVT_TRANSACTION Greg Kroah-Hartman
                   ` (15 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sit, Michael Wei Hong, Voon Weifeng,
	Tan Tee Min, Andrew Lunn, Jakub Kicinski, Sit

From: Tan Tee Min <tee.min.tan@linux.intel.com>

commit c76acfb7e19dcc3a0964e0563770b1d11b8d4540 upstream.

There is a limitation in TI DP83867 PHY device where SGMII AN is only
triggered once after the device is booted up. Even after the PHY TPI is
down and up again, SGMII AN is not triggered and hence no new in-band
message from PHY to MAC side SGMII.

This could cause an issue during power up, when PHY is up prior to MAC.
At this condition, once MAC side SGMII is up, MAC side SGMII wouldn`t
receive new in-band message from TI PHY with correct link status, speed
and duplex info.

As suggested by TI, implemented a SW solution here to retrigger SGMII
Auto-Neg whenever there is a link change.

v2: Add Fixes tag in commit message.

Fixes: 2a10154abcb7 ("net: phy: dp83867: Add TI dp83867 phy")
Cc: <stable@vger.kernel.org> # 5.4.x
Signed-off-by: Sit, Michael Wei Hong <michael.wei.hong.sit@intel.com>
Reviewed-by: Voon Weifeng <weifeng.voon@intel.com>
Signed-off-by: Tan Tee Min <tee.min.tan@linux.intel.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20220526090347.128742-1-tee.min.tan@linux.intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/phy/dp83867.c |   29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -137,6 +137,7 @@
 #define DP83867_DOWNSHIFT_2_COUNT	2
 #define DP83867_DOWNSHIFT_4_COUNT	4
 #define DP83867_DOWNSHIFT_8_COUNT	8
+#define DP83867_SGMII_AUTONEG_EN	BIT(7)
 
 /* CFG3 bits */
 #define DP83867_CFG3_INT_OE			BIT(7)
@@ -802,6 +803,32 @@ static int dp83867_phy_reset(struct phy_
 			 DP83867_PHYCR_FORCE_LINK_GOOD, 0);
 }
 
+static void dp83867_link_change_notify(struct phy_device *phydev)
+{
+	/* There is a limitation in DP83867 PHY device where SGMII AN is
+	 * only triggered once after the device is booted up. Even after the
+	 * PHY TPI is down and up again, SGMII AN is not triggered and
+	 * hence no new in-band message from PHY to MAC side SGMII.
+	 * This could cause an issue during power up, when PHY is up prior
+	 * to MAC. At this condition, once MAC side SGMII is up, MAC side
+	 * SGMII wouldn`t receive new in-band message from TI PHY with
+	 * correct link status, speed and duplex info.
+	 * Thus, implemented a SW solution here to retrigger SGMII Auto-Neg
+	 * whenever there is a link change.
+	 */
+	if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
+		int val = 0;
+
+		val = phy_clear_bits(phydev, DP83867_CFG2,
+				     DP83867_SGMII_AUTONEG_EN);
+		if (val < 0)
+			return;
+
+		phy_set_bits(phydev, DP83867_CFG2,
+			     DP83867_SGMII_AUTONEG_EN);
+	}
+}
+
 static struct phy_driver dp83867_driver[] = {
 	{
 		.phy_id		= DP83867_PHY_ID,
@@ -826,6 +853,8 @@ static struct phy_driver dp83867_driver[
 
 		.suspend	= genphy_suspend,
 		.resume		= genphy_resume,
+
+		.link_change_notify = dp83867_link_change_notify,
 	},
 };
 module_phy_driver(dp83867_driver);



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 158/172] nfc: st21nfca: fix incorrect validating logic in EVT_TRANSACTION
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (156 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 157/172] net: phy: dp83867: retrigger SGMII AN when link change Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:11 ` [PATCH 5.10 159/172] nfc: st21nfca: fix memory leaks in EVT_TRANSACTION handling Greg Kroah-Hartman
                   ` (14 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Martin Faltesek, Guenter Roeck,
	Krzysztof Kozlowski, Jakub Kicinski

From: Martin Faltesek <mfaltesek@google.com>

commit 77e5fe8f176a525523ae091d6fd0fbb8834c156d upstream.

The first validation check for EVT_TRANSACTION has two different checks
tied together with logical AND. One is a check for minimum packet length,
and the other is for a valid aid_tag. If either condition is true (fails),
then an error should be triggered.  The fix is to change && to ||.

Fixes: 26fc6c7f02cb ("NFC: st21nfca: Add HCI transaction event support")
Cc: stable@vger.kernel.org
Signed-off-by: Martin Faltesek <mfaltesek@google.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/nfc/st21nfca/se.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/nfc/st21nfca/se.c
+++ b/drivers/nfc/st21nfca/se.c
@@ -319,7 +319,7 @@ int st21nfca_connectivity_event_received
 		 * AID		81	5 to 16
 		 * PARAMETERS	82	0 to 255
 		 */
-		if (skb->len < NFC_MIN_AID_LENGTH + 2 &&
+		if (skb->len < NFC_MIN_AID_LENGTH + 2 ||
 		    skb->data[0] != NFC_EVT_TRANSACTION_AID_TAG)
 			return -EPROTO;
 



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 159/172] nfc: st21nfca: fix memory leaks in EVT_TRANSACTION handling
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (157 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 158/172] nfc: st21nfca: fix incorrect validating logic in EVT_TRANSACTION Greg Kroah-Hartman
@ 2022-06-13 10:11 ` Greg Kroah-Hartman
  2022-06-13 10:12 ` [PATCH 5.10 160/172] nfc: st21nfca: fix incorrect sizing calculations in EVT_TRANSACTION Greg Kroah-Hartman
                   ` (13 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Martin Faltesek, Guenter Roeck,
	Krzysztof Kozlowski, Jakub Kicinski

From: Martin Faltesek <mfaltesek@google.com>

commit 996419e0594abb311fb958553809f24f38e7abbe upstream.

Error paths do not free previously allocated memory. Add devm_kfree() to
those failure paths.

Fixes: 26fc6c7f02cb ("NFC: st21nfca: Add HCI transaction event support")
Fixes: 4fbcc1a4cb20 ("nfc: st21nfca: Fix potential buffer overflows in EVT_TRANSACTION")
Cc: stable@vger.kernel.org
Signed-off-by: Martin Faltesek <mfaltesek@google.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/nfc/st21nfca/se.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

--- a/drivers/nfc/st21nfca/se.c
+++ b/drivers/nfc/st21nfca/se.c
@@ -330,22 +330,29 @@ int st21nfca_connectivity_event_received
 		transaction->aid_len = skb->data[1];
 
 		/* Checking if the length of the AID is valid */
-		if (transaction->aid_len > sizeof(transaction->aid))
+		if (transaction->aid_len > sizeof(transaction->aid)) {
+			devm_kfree(dev, transaction);
 			return -EINVAL;
+		}
 
 		memcpy(transaction->aid, &skb->data[2],
 		       transaction->aid_len);
 
 		/* Check next byte is PARAMETERS tag (82) */
 		if (skb->data[transaction->aid_len + 2] !=
-		    NFC_EVT_TRANSACTION_PARAMS_TAG)
+		    NFC_EVT_TRANSACTION_PARAMS_TAG) {
+			devm_kfree(dev, transaction);
 			return -EPROTO;
+		}
 
 		transaction->params_len = skb->data[transaction->aid_len + 3];
 
 		/* Total size is allocated (skb->len - 2) minus fixed array members */
-		if (transaction->params_len > ((skb->len - 2) - sizeof(struct nfc_evt_transaction)))
+		if (transaction->params_len > ((skb->len - 2) -
+		    sizeof(struct nfc_evt_transaction))) {
+			devm_kfree(dev, transaction);
 			return -EINVAL;
+		}
 
 		memcpy(transaction->params, skb->data +
 		       transaction->aid_len + 4, transaction->params_len);



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 160/172] nfc: st21nfca: fix incorrect sizing calculations in EVT_TRANSACTION
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (158 preceding siblings ...)
  2022-06-13 10:11 ` [PATCH 5.10 159/172] nfc: st21nfca: fix memory leaks in EVT_TRANSACTION handling Greg Kroah-Hartman
@ 2022-06-13 10:12 ` Greg Kroah-Hartman
  2022-06-13 10:12 ` [PATCH 5.10 161/172] ixgbe: fix bcast packets Rx on VF after promisc removal Greg Kroah-Hartman
                   ` (12 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Martin Faltesek, Guenter Roeck,
	Krzysztof Kozlowski, Jakub Kicinski

From: Martin Faltesek <mfaltesek@google.com>

commit f2e19b36593caed4c977c2f55aeba7408aeb2132 upstream.

The transaction buffer is allocated by using the size of the packet buf,
and subtracting two which seem intended to remove the two tags which are
not present in the target structure. This calculation leads to under
counting memory because of differences between the packet contents and the
target structure. The aid_len field is a u8 in the packet, but a u32 in
the structure, resulting in at least 3 bytes always being under counted.
Further, the aid data is a variable length field in the packet, but fixed
in the structure, so if this field is less than the max, the difference is
added to the under counting.

The last validation check for transaction->params_len is also incorrect
since it employs the same accounting error.

To fix, perform validation checks progressively to safely reach the
next field, to determine the size of both buffers and verify both tags.
Once all validation checks pass, allocate the buffer and copy the data.
This eliminates freeing memory on the error path, as those checks are
moved ahead of memory allocation.

Fixes: 26fc6c7f02cb ("NFC: st21nfca: Add HCI transaction event support")
Fixes: 4fbcc1a4cb20 ("nfc: st21nfca: Fix potential buffer overflows in EVT_TRANSACTION")
Cc: stable@vger.kernel.org
Signed-off-by: Martin Faltesek <mfaltesek@google.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/nfc/st21nfca/se.c |   62 +++++++++++++++++++++++-----------------------
 1 file changed, 31 insertions(+), 31 deletions(-)

--- a/drivers/nfc/st21nfca/se.c
+++ b/drivers/nfc/st21nfca/se.c
@@ -304,6 +304,8 @@ int st21nfca_connectivity_event_received
 	int r = 0;
 	struct device *dev = &hdev->ndev->dev;
 	struct nfc_evt_transaction *transaction;
+	u32 aid_len;
+	u8 params_len;
 
 	pr_debug("connectivity gate event: %x\n", event);
 
@@ -312,50 +314,48 @@ int st21nfca_connectivity_event_received
 		r = nfc_se_connectivity(hdev->ndev, host);
 	break;
 	case ST21NFCA_EVT_TRANSACTION:
-		/*
-		 * According to specification etsi 102 622
+		/* According to specification etsi 102 622
 		 * 11.2.2.4 EVT_TRANSACTION Table 52
 		 * Description	Tag	Length
 		 * AID		81	5 to 16
 		 * PARAMETERS	82	0 to 255
+		 *
+		 * The key differences are aid storage length is variably sized
+		 * in the packet, but fixed in nfc_evt_transaction, and that the aid_len
+		 * is u8 in the packet, but u32 in the structure, and the tags in
+		 * the packet are not included in nfc_evt_transaction.
+		 *
+		 * size in bytes: 1          1       5-16 1             1           0-255
+		 * offset:        0          1       2    aid_len + 2   aid_len + 3 aid_len + 4
+		 * member name:   aid_tag(M) aid_len aid  params_tag(M) params_len  params
+		 * example:       0x81       5-16    X    0x82 0-255    X
 		 */
-		if (skb->len < NFC_MIN_AID_LENGTH + 2 ||
-		    skb->data[0] != NFC_EVT_TRANSACTION_AID_TAG)
+		if (skb->len < 2 || skb->data[0] != NFC_EVT_TRANSACTION_AID_TAG)
 			return -EPROTO;
 
-		transaction = devm_kzalloc(dev, skb->len - 2, GFP_KERNEL);
-		if (!transaction)
-			return -ENOMEM;
+		aid_len = skb->data[1];
+
+		if (skb->len < aid_len + 4 || aid_len > sizeof(transaction->aid))
+			return -EPROTO;
 
-		transaction->aid_len = skb->data[1];
+		params_len = skb->data[aid_len + 3];
 
-		/* Checking if the length of the AID is valid */
-		if (transaction->aid_len > sizeof(transaction->aid)) {
-			devm_kfree(dev, transaction);
-			return -EINVAL;
-		}
-
-		memcpy(transaction->aid, &skb->data[2],
-		       transaction->aid_len);
-
-		/* Check next byte is PARAMETERS tag (82) */
-		if (skb->data[transaction->aid_len + 2] !=
-		    NFC_EVT_TRANSACTION_PARAMS_TAG) {
-			devm_kfree(dev, transaction);
+		/* Verify PARAMETERS tag is (82), and final check that there is enough
+		 * space in the packet to read everything.
+		 */
+		if ((skb->data[aid_len + 2] != NFC_EVT_TRANSACTION_PARAMS_TAG) ||
+		    (skb->len < aid_len + 4 + params_len))
 			return -EPROTO;
-		}
 
-		transaction->params_len = skb->data[transaction->aid_len + 3];
+		transaction = devm_kzalloc(dev, sizeof(*transaction) + params_len, GFP_KERNEL);
+		if (!transaction)
+			return -ENOMEM;
 
-		/* Total size is allocated (skb->len - 2) minus fixed array members */
-		if (transaction->params_len > ((skb->len - 2) -
-		    sizeof(struct nfc_evt_transaction))) {
-			devm_kfree(dev, transaction);
-			return -EINVAL;
-		}
+		transaction->aid_len = aid_len;
+		transaction->params_len = params_len;
 
-		memcpy(transaction->params, skb->data +
-		       transaction->aid_len + 4, transaction->params_len);
+		memcpy(transaction->aid, &skb->data[2], aid_len);
+		memcpy(transaction->params, &skb->data[aid_len + 4], params_len);
 
 		r = nfc_se_transaction(hdev->ndev, host, transaction);
 	break;



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 161/172] ixgbe: fix bcast packets Rx on VF after promisc removal
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (159 preceding siblings ...)
  2022-06-13 10:12 ` [PATCH 5.10 160/172] nfc: st21nfca: fix incorrect sizing calculations in EVT_TRANSACTION Greg Kroah-Hartman
@ 2022-06-13 10:12 ` Greg Kroah-Hartman
  2022-06-13 10:12 ` [PATCH 5.10 162/172] ixgbe: fix unexpected VLAN Rx in promisc mode on VF Greg Kroah-Hartman
                   ` (11 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Nicolas Dichtel, Olivier Matz,
	Konrad Jankowski, Tony Nguyen

From: Olivier Matz <olivier.matz@6wind.com>

commit 803e9895ea2b0fe80bc85980ae2d7a7e44037914 upstream.

After a VF requested to remove the promiscuous flag on an interface, the
broadcast packets are not received anymore. This breaks some protocols
like ARP.

In ixgbe_update_vf_xcast_mode(), we should keep the IXGBE_VMOLR_BAM
bit (Broadcast Accept) on promiscuous removal.

This flag is already set by default in ixgbe_set_vmolr() on VF reset.

Fixes: 8443c1a4b192 ("ixgbe, ixgbevf: Add new mbox API xcast mode")
Cc: stable@vger.kernel.org
Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -1157,9 +1157,9 @@ static int ixgbe_update_vf_xcast_mode(st
 
 	switch (xcast_mode) {
 	case IXGBEVF_XCAST_MODE_NONE:
-		disable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
+		disable = IXGBE_VMOLR_ROMPE |
 			  IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
-		enable = 0;
+		enable = IXGBE_VMOLR_BAM;
 		break;
 	case IXGBEVF_XCAST_MODE_MULTI:
 		disable = IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 162/172] ixgbe: fix unexpected VLAN Rx in promisc mode on VF
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (160 preceding siblings ...)
  2022-06-13 10:12 ` [PATCH 5.10 161/172] ixgbe: fix bcast packets Rx on VF after promisc removal Greg Kroah-Hartman
@ 2022-06-13 10:12 ` Greg Kroah-Hartman
  2022-06-13 10:12 ` [PATCH 5.10 163/172] Input: bcm5974 - set missing URB_NO_TRANSFER_DMA_MAP urb flag Greg Kroah-Hartman
                   ` (10 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Nicolas Dichtel, Olivier Matz,
	Konrad Jankowski, Tony Nguyen

From: Olivier Matz <olivier.matz@6wind.com>

commit 7bb0fb7c63df95d6027dc50d6af3bc3bbbc25483 upstream.

When the promiscuous mode is enabled on a VF, the IXGBE_VMOLR_VPE
bit (VLAN Promiscuous Enable) is set. This means that the VF will
receive packets whose VLAN is not the same than the VLAN of the VF.

For instance, in this situation:

┌────────┐    ┌────────┐    ┌────────┐
│        │    │        │    │        │
│        │    │        │    │        │
│     VF0├────┤VF1  VF2├────┤VF3     │
│        │    │        │    │        │
└────────┘    └────────┘    └────────┘
   VM1           VM2           VM3

vf 0:  vlan 1000
vf 1:  vlan 1000
vf 2:  vlan 1001
vf 3:  vlan 1001

If we tcpdump on VF3, we see all the packets, even those transmitted
on vlan 1000.

This behavior prevents to bridge VF1 and VF2 in VM2, because it will
create a loop: packets transmitted on VF1 will be received by VF2 and
vice-versa, and bridged again through the software bridge.

This patch remove the activation of VLAN Promiscuous when a VF enables
the promiscuous mode. However, the IXGBE_VMOLR_UPE bit (Unicast
Promiscuous) is kept, so that a VF receives all packets that has the
same VLAN, whatever the destination MAC address.

Fixes: 8443c1a4b192 ("ixgbe, ixgbevf: Add new mbox API xcast mode")
Cc: stable@vger.kernel.org
Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -1181,9 +1181,9 @@ static int ixgbe_update_vf_xcast_mode(st
 			return -EPERM;
 		}
 
-		disable = 0;
+		disable = IXGBE_VMOLR_VPE;
 		enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE |
-			 IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE;
+			 IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE;
 		break;
 	default:
 		return -EOPNOTSUPP;



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 163/172] Input: bcm5974 - set missing URB_NO_TRANSFER_DMA_MAP urb flag
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (161 preceding siblings ...)
  2022-06-13 10:12 ` [PATCH 5.10 162/172] ixgbe: fix unexpected VLAN Rx in promisc mode on VF Greg Kroah-Hartman
@ 2022-06-13 10:12 ` Greg Kroah-Hartman
  2022-06-13 10:12 ` [PATCH 5.10 164/172] drm/bridge: analogix_dp: Support PSR-exit to disable transition Greg Kroah-Hartman
                   ` (9 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Mathias Nyman, Dmitry Torokhov

From: Mathias Nyman <mathias.nyman@linux.intel.com>

commit c42e65664390be7c1ef3838cd84956d3a2739d60 upstream.

The bcm5974 driver does the allocation and dma mapping of the usb urb
data buffer, but driver does not set the URB_NO_TRANSFER_DMA_MAP flag
to let usb core know the buffer is already mapped.

usb core tries to map the already mapped buffer, causing a warning:
"xhci_hcd 0000:00:14.0: rejecting DMA map of vmalloc memory"

Fix this by setting the URB_NO_TRANSFER_DMA_MAP, letting usb core
know buffer is already mapped by bcm5974 driver

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Cc: stable@vger.kernel.org
Link: https://bugzilla.kernel.org/show_bug.cgi?id=215890
Link: https://lore.kernel.org/r/20220606113636.588955-1-mathias.nyman@linux.intel.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/input/mouse/bcm5974.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -942,17 +942,22 @@ static int bcm5974_probe(struct usb_inte
 	if (!dev->tp_data)
 		goto err_free_bt_buffer;
 
-	if (dev->bt_urb)
+	if (dev->bt_urb) {
 		usb_fill_int_urb(dev->bt_urb, udev,
 				 usb_rcvintpipe(udev, cfg->bt_ep),
 				 dev->bt_data, dev->cfg.bt_datalen,
 				 bcm5974_irq_button, dev, 1);
 
+		dev->bt_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+	}
+
 	usb_fill_int_urb(dev->tp_urb, udev,
 			 usb_rcvintpipe(udev, cfg->tp_ep),
 			 dev->tp_data, dev->cfg.tp_datalen,
 			 bcm5974_irq_trackpad, dev, 1);
 
+	dev->tp_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+
 	/* create bcm5974 device */
 	usb_make_path(udev, dev->phys, sizeof(dev->phys));
 	strlcat(dev->phys, "/input0", sizeof(dev->phys));



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 164/172] drm/bridge: analogix_dp: Support PSR-exit to disable transition
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (162 preceding siblings ...)
  2022-06-13 10:12 ` [PATCH 5.10 163/172] Input: bcm5974 - set missing URB_NO_TRANSFER_DMA_MAP urb flag Greg Kroah-Hartman
@ 2022-06-13 10:12 ` Greg Kroah-Hartman
  2022-06-13 10:12 ` [PATCH 5.10 165/172] drm/atomic: Force bridge self-refresh-exit on CRTC switch Greg Kroah-Hartman
                   ` (8 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Brian Norris, Sean Paul, Douglas Anderson

From: Brian Norris <briannorris@chromium.org>

commit ca871659ec1606d33b1e76de8d4cf924cf627e34 upstream.

Most eDP panel functions only work correctly when the panel is not in
self-refresh. In particular, analogix_dp_bridge_disable() tends to hit
AUX channel errors if the panel is in self-refresh.

Given the above, it appears that so far, this driver assumes that we are
never in self-refresh when it comes time to fully disable the bridge.
Prior to commit 846c7dfc1193 ("drm/atomic: Try to preserve the crtc
enabled state in drm_atomic_remove_fb, v2."), this tended to be true,
because we would automatically disable the pipe when framebuffers were
removed, and so we'd typically disable the bridge shortly after the last
display activity.

However, that is not guaranteed: an idle (self-refresh) display pipe may
be disabled, e.g., when switching CRTCs. We need to exit PSR first.

Stable notes: this is definitely a bugfix, and the bug has likely
existed in some form for quite a while. It may predate the "PSR helpers"
refactor, but the code looked very different before that, and it's
probably not worth rewriting the fix.

Cc: <stable@vger.kernel.org>
Fixes: 6c836d965bad ("drm/rockchip: Use the helpers for PSR")
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220228122522.v2.1.I161904be17ba14526f78536ccd78b85818449b51@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |   42 +++++++++++++++++++--
 1 file changed, 38 insertions(+), 4 deletions(-)

--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -1269,6 +1269,25 @@ static int analogix_dp_bridge_attach(str
 }
 
 static
+struct drm_crtc *analogix_dp_get_old_crtc(struct analogix_dp_device *dp,
+					  struct drm_atomic_state *state)
+{
+	struct drm_encoder *encoder = dp->encoder;
+	struct drm_connector *connector;
+	struct drm_connector_state *conn_state;
+
+	connector = drm_atomic_get_old_connector_for_encoder(state, encoder);
+	if (!connector)
+		return NULL;
+
+	conn_state = drm_atomic_get_old_connector_state(state, connector);
+	if (!conn_state)
+		return NULL;
+
+	return conn_state->crtc;
+}
+
+static
 struct drm_crtc *analogix_dp_get_new_crtc(struct analogix_dp_device *dp,
 					  struct drm_atomic_state *state)
 {
@@ -1448,14 +1467,16 @@ analogix_dp_bridge_atomic_disable(struct
 {
 	struct drm_atomic_state *old_state = old_bridge_state->base.state;
 	struct analogix_dp_device *dp = bridge->driver_private;
-	struct drm_crtc *crtc;
+	struct drm_crtc *old_crtc, *new_crtc;
+	struct drm_crtc_state *old_crtc_state = NULL;
 	struct drm_crtc_state *new_crtc_state = NULL;
+	int ret;
 
-	crtc = analogix_dp_get_new_crtc(dp, old_state);
-	if (!crtc)
+	new_crtc = analogix_dp_get_new_crtc(dp, old_state);
+	if (!new_crtc)
 		goto out;
 
-	new_crtc_state = drm_atomic_get_new_crtc_state(old_state, crtc);
+	new_crtc_state = drm_atomic_get_new_crtc_state(old_state, new_crtc);
 	if (!new_crtc_state)
 		goto out;
 
@@ -1464,6 +1485,19 @@ analogix_dp_bridge_atomic_disable(struct
 		return;
 
 out:
+	old_crtc = analogix_dp_get_old_crtc(dp, old_state);
+	if (old_crtc) {
+		old_crtc_state = drm_atomic_get_old_crtc_state(old_state,
+							       old_crtc);
+
+		/* When moving from PSR to fully disabled, exit PSR first. */
+		if (old_crtc_state && old_crtc_state->self_refresh_active) {
+			ret = analogix_dp_disable_psr(dp);
+			if (ret)
+				DRM_ERROR("Failed to disable psr (%d)\n", ret);
+		}
+	}
+
 	analogix_dp_bridge_disable(bridge);
 }
 



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 165/172] drm/atomic: Force bridge self-refresh-exit on CRTC switch
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (163 preceding siblings ...)
  2022-06-13 10:12 ` [PATCH 5.10 164/172] drm/bridge: analogix_dp: Support PSR-exit to disable transition Greg Kroah-Hartman
@ 2022-06-13 10:12 ` Greg Kroah-Hartman
  2022-06-13 10:12 ` [PATCH 5.10 166/172] powerpc/32: Fix overread/overwrite of thread_struct via ptrace Greg Kroah-Hartman
                   ` (7 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Liu Ying, Brian Norris, Sean Paul,
	Douglas Anderson

From: Brian Norris <briannorris@chromium.org>

commit e54a4424925a27ed94dff046db3ce5caf4b1e748 upstream.

It's possible to change which CRTC is in use for a given
connector/encoder/bridge while we're in self-refresh without fully
disabling the connector/encoder/bridge along the way. This can confuse
the bridge encoder/bridge, because
(a) it needs to track the SR state (trying to perform "active"
    operations while the panel is still in SR can be Bad(TM)); and
(b) it tracks the SR state via the CRTC state (and after the switch, the
    previous SR state is lost).

Thus, we need to either somehow carry the self-refresh state over to the
new CRTC, or else force an encoder/bridge self-refresh transition during
such a switch.

I choose the latter, so we disable the encoder (and exit PSR) before
attaching it to the new CRTC (where we can continue to assume a clean
(non-self-refresh) state).

This fixes PSR issues seen on Rockchip RK3399 systems with
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c.

Change in v2:

- Drop "->enable" condition; this could possibly be "->active" to
  reflect the intended hardware state, but it also is a little
  over-specific. We want to make a transition through "disabled" any
  time we're exiting PSR at the same time as a CRTC switch.
  (Thanks Liu Ying)

Cc: Liu Ying <victor.liu@oss.nxp.com>
Cc: <stable@vger.kernel.org>
Fixes: 1452c25b0e60 ("drm: Add helpers to kick off self refresh mode in drivers")
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220228122522.v2.2.Ic15a2ef69c540aee8732703103e2cff51fb9c399@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/gpu/drm/drm_atomic_helper.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -996,9 +996,19 @@ crtc_needs_disable(struct drm_crtc_state
 		return drm_atomic_crtc_effectively_active(old_state);
 
 	/*
-	 * We need to run through the crtc_funcs->disable() function if the CRTC
-	 * is currently on, if it's transitioning to self refresh mode, or if
-	 * it's in self refresh mode and needs to be fully disabled.
+	 * We need to disable bridge(s) and CRTC if we're transitioning out of
+	 * self-refresh and changing CRTCs at the same time, because the
+	 * bridge tracks self-refresh status via CRTC state.
+	 */
+	if (old_state->self_refresh_active &&
+	    old_state->crtc != new_state->crtc)
+		return true;
+
+	/*
+	 * We also need to run through the crtc_funcs->disable() function if
+	 * the CRTC is currently on, if it's transitioning to self refresh
+	 * mode, or if it's in self refresh mode and needs to be fully
+	 * disabled.
 	 */
 	return old_state->active ||
 	       (old_state->self_refresh_active && !new_state->enable) ||



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 166/172] powerpc/32: Fix overread/overwrite of thread_struct via ptrace
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (164 preceding siblings ...)
  2022-06-13 10:12 ` [PATCH 5.10 165/172] drm/atomic: Force bridge self-refresh-exit on CRTC switch Greg Kroah-Hartman
@ 2022-06-13 10:12 ` Greg Kroah-Hartman
  2022-06-13 10:12 ` [PATCH 5.10 167/172] powerpc/mm: Switch obsolete dssall to .long Greg Kroah-Hartman
                   ` (6 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ariel Miculas, Christophe Leroy,
	Michael Ellerman

From: Michael Ellerman <mpe@ellerman.id.au>

commit 8e1278444446fc97778a5e5c99bca1ce0bbc5ec9 upstream.

The ptrace PEEKUSR/POKEUSR (aka PEEKUSER/POKEUSER) API allows a process
to read/write registers of another process.

To get/set a register, the API takes an index into an imaginary address
space called the "USER area", where the registers of the process are
laid out in some fashion.

The kernel then maps that index to a particular register in its own data
structures and gets/sets the value.

The API only allows a single machine-word to be read/written at a time.
So 4 bytes on 32-bit kernels and 8 bytes on 64-bit kernels.

The way floating point registers (FPRs) are addressed is somewhat
complicated, because double precision float values are 64-bit even on
32-bit CPUs. That means on 32-bit kernels each FPR occupies two
word-sized locations in the USER area. On 64-bit kernels each FPR
occupies one word-sized location in the USER area.

Internally the kernel stores the FPRs in an array of u64s, or if VSX is
enabled, an array of pairs of u64s where one half of each pair stores
the FPR. Which half of the pair stores the FPR depends on the kernel's
endianness.

To handle the different layouts of the FPRs depending on VSX/no-VSX and
big/little endian, the TS_FPR() macro was introduced.

Unfortunately the TS_FPR() macro does not take into account the fact
that the addressing of each FPR differs between 32-bit and 64-bit
kernels. It just takes the index into the "USER area" passed from
userspace and indexes into the fp_state.fpr array.

On 32-bit there are 64 indexes that address FPRs, but only 32 entries in
the fp_state.fpr array, meaning the user can read/write 256 bytes past
the end of the array. Because the fp_state sits in the middle of the
thread_struct there are various fields than can be overwritten,
including some pointers. As such it may be exploitable.

It has also been observed to cause systems to hang or otherwise
misbehave when using gdbserver, and is probably the root cause of this
report which could not be easily reproduced:
  https://lore.kernel.org/linuxppc-dev/dc38afe9-6b78-f3f5-666b-986939e40fc6@keymile.com/

Rather than trying to make the TS_FPR() macro even more complicated to
fix the bug, or add more macros, instead add a special-case for 32-bit
kernels. This is more obvious and hopefully avoids a similar bug
happening again in future.

Note that because 32-bit kernels never have VSX enabled the code doesn't
need to consider TS_FPRWIDTH/OFFSET at all. Add a BUILD_BUG_ON() to
ensure that 32-bit && VSX is never enabled.

Fixes: 87fec0514f61 ("powerpc: PTRACE_PEEKUSR/PTRACE_POKEUSER of FPR registers in little endian builds")
Cc: stable@vger.kernel.org # v3.13+
Reported-by: Ariel Miculas <ariel.miculas@belden.com>
Tested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220609133245.573565-1-mpe@ellerman.id.au
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/powerpc/kernel/ptrace/ptrace.c |   21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

--- a/arch/powerpc/kernel/ptrace/ptrace.c
+++ b/arch/powerpc/kernel/ptrace/ptrace.c
@@ -75,8 +75,13 @@ long arch_ptrace(struct task_struct *chi
 
 			flush_fp_to_thread(child);
 			if (fpidx < (PT_FPSCR - PT_FPR0))
-				memcpy(&tmp, &child->thread.TS_FPR(fpidx),
-				       sizeof(long));
+				if (IS_ENABLED(CONFIG_PPC32)) {
+					// On 32-bit the index we are passed refers to 32-bit words
+					tmp = ((u32 *)child->thread.fp_state.fpr)[fpidx];
+				} else {
+					memcpy(&tmp, &child->thread.TS_FPR(fpidx),
+					       sizeof(long));
+				}
 			else
 				tmp = child->thread.fp_state.fpscr;
 		}
@@ -108,8 +113,13 @@ long arch_ptrace(struct task_struct *chi
 
 			flush_fp_to_thread(child);
 			if (fpidx < (PT_FPSCR - PT_FPR0))
-				memcpy(&child->thread.TS_FPR(fpidx), &data,
-				       sizeof(long));
+				if (IS_ENABLED(CONFIG_PPC32)) {
+					// On 32-bit the index we are passed refers to 32-bit words
+					((u32 *)child->thread.fp_state.fpr)[fpidx] = data;
+				} else {
+					memcpy(&child->thread.TS_FPR(fpidx), &data,
+					       sizeof(long));
+				}
 			else
 				child->thread.fp_state.fpscr = data;
 			ret = 0;
@@ -478,4 +488,7 @@ void __init pt_regs_check(void)
 	 * real registers.
 	 */
 	BUILD_BUG_ON(PT_DSCR < sizeof(struct user_pt_regs) / sizeof(unsigned long));
+
+	// ptrace_get/put_fpr() rely on PPC32 and VSX being incompatible
+	BUILD_BUG_ON(IS_ENABLED(CONFIG_PPC32) && IS_ENABLED(CONFIG_VSX));
 }



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 167/172] powerpc/mm: Switch obsolete dssall to .long
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (165 preceding siblings ...)
  2022-06-13 10:12 ` [PATCH 5.10 166/172] powerpc/32: Fix overread/overwrite of thread_struct via ptrace Greg Kroah-Hartman
@ 2022-06-13 10:12 ` Greg Kroah-Hartman
  2022-06-13 10:12 ` [PATCH 5.10 168/172] interconnect: qcom: sc7180: Drop IP0 interconnects Greg Kroah-Hartman
                   ` (5 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alexey Kardashevskiy, Michael Ellerman

From: Alexey Kardashevskiy <aik@ozlabs.ru>

commit d51f86cfd8e378d4907958db77da3074f6dce3ba upstream.

The dssall ("Data Stream Stop All") instruction is obsolete altogether
with other Data Cache Instructions since ISA 2.03 (year 2006).

LLVM IAS does not support it but PPC970 seems to be using it.
This switches dssall to .long as there is no much point in fixing LLVM.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211221055904.555763-6-aik@ozlabs.ru
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/powerpc/include/asm/ppc-opcode.h   |    2 ++
 arch/powerpc/kernel/idle.c              |    2 +-
 arch/powerpc/kernel/idle_6xx.S          |    2 +-
 arch/powerpc/kernel/l2cr_6xx.S          |    6 +++---
 arch/powerpc/kernel/swsusp_32.S         |    2 +-
 arch/powerpc/kernel/swsusp_asm64.S      |    2 +-
 arch/powerpc/mm/mmu_context.c           |    2 +-
 arch/powerpc/platforms/powermac/cache.S |    4 ++--
 8 files changed, 12 insertions(+), 10 deletions(-)

--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -212,6 +212,7 @@
 #define PPC_INST_COPY			0x7c20060c
 #define PPC_INST_DCBA			0x7c0005ec
 #define PPC_INST_DCBA_MASK		0xfc0007fe
+#define PPC_INST_DSSALL			0x7e00066c
 #define PPC_INST_ISEL			0x7c00001e
 #define PPC_INST_ISEL_MASK		0xfc00003e
 #define PPC_INST_LSWI			0x7c0004aa
@@ -517,6 +518,7 @@
 #define	PPC_DCBZL(a, b)		stringify_in_c(.long PPC_RAW_DCBZL(a, b))
 #define	PPC_DIVDE(t, a, b)	stringify_in_c(.long PPC_RAW_DIVDE(t, a, b))
 #define	PPC_DIVDEU(t, a, b)	stringify_in_c(.long PPC_RAW_DIVDEU(t, a, b))
+#define PPC_DSSALL		stringify_in_c(.long PPC_INST_DSSALL)
 #define PPC_LQARX(t, a, b, eh)	stringify_in_c(.long PPC_RAW_LQARX(t, a, b, eh))
 #define PPC_LDARX(t, a, b, eh)	stringify_in_c(.long PPC_RAW_LDARX(t, a, b, eh))
 #define PPC_LWARX(t, a, b, eh)	stringify_in_c(.long PPC_RAW_LWARX(t, a, b, eh))
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -82,7 +82,7 @@ void power4_idle(void)
 		return;
 
 	if (cpu_has_feature(CPU_FTR_ALTIVEC))
-		asm volatile("DSSALL ; sync" ::: "memory");
+		asm volatile(PPC_DSSALL " ; sync" ::: "memory");
 
 	power4_idle_nap();
 
--- a/arch/powerpc/kernel/idle_6xx.S
+++ b/arch/powerpc/kernel/idle_6xx.S
@@ -129,7 +129,7 @@ BEGIN_FTR_SECTION
 END_FTR_SECTION_IFCLR(CPU_FTR_NO_DPM)
 	mtspr	SPRN_HID0,r4
 BEGIN_FTR_SECTION
-	DSSALL
+	PPC_DSSALL
 	sync
 END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
 	lwz	r8,TI_LOCAL_FLAGS(r2)	/* set napping bit */
--- a/arch/powerpc/kernel/l2cr_6xx.S
+++ b/arch/powerpc/kernel/l2cr_6xx.S
@@ -96,7 +96,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_L2CR)
 
 	/* Stop DST streams */
 BEGIN_FTR_SECTION
-	DSSALL
+	PPC_DSSALL
 	sync
 END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
 
@@ -292,7 +292,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_L3CR)
 	isync
 
 	/* Stop DST streams */
-	DSSALL
+	PPC_DSSALL
 	sync
 
 	/* Get the current enable bit of the L3CR into r4 */
@@ -401,7 +401,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_L3CR)
 _GLOBAL(__flush_disable_L1)
 	/* Stop pending alitvec streams and memory accesses */
 BEGIN_FTR_SECTION
-	DSSALL
+	PPC_DSSALL
 END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
  	sync
 
--- a/arch/powerpc/kernel/swsusp_32.S
+++ b/arch/powerpc/kernel/swsusp_32.S
@@ -181,7 +181,7 @@ _GLOBAL(swsusp_arch_resume)
 #ifdef CONFIG_ALTIVEC
 	/* Stop pending alitvec streams and memory accesses */
 BEGIN_FTR_SECTION
-	DSSALL
+	PPC_DSSALL
 END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
 #endif
  	sync
--- a/arch/powerpc/kernel/swsusp_asm64.S
+++ b/arch/powerpc/kernel/swsusp_asm64.S
@@ -142,7 +142,7 @@ END_FW_FTR_SECTION_IFCLR(FW_FEATURE_LPAR
 _GLOBAL(swsusp_arch_resume)
 	/* Stop pending alitvec streams and memory accesses */
 BEGIN_FTR_SECTION
-	DSSALL
+	PPC_DSSALL
 END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
 	sync
 
--- a/arch/powerpc/mm/mmu_context.c
+++ b/arch/powerpc/mm/mmu_context.c
@@ -79,7 +79,7 @@ void switch_mm_irqs_off(struct mm_struct
 	 * context
 	 */
 	if (cpu_has_feature(CPU_FTR_ALTIVEC))
-		asm volatile ("dssall");
+		asm volatile (PPC_DSSALL);
 
 	if (new_on_cpu)
 		radix_kvm_prefetch_workaround(next);
--- a/arch/powerpc/platforms/powermac/cache.S
+++ b/arch/powerpc/platforms/powermac/cache.S
@@ -48,7 +48,7 @@ flush_disable_75x:
 
 	/* Stop DST streams */
 BEGIN_FTR_SECTION
-	DSSALL
+	PPC_DSSALL
 	sync
 END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
 
@@ -197,7 +197,7 @@ flush_disable_745x:
 	isync
 
 	/* Stop prefetch streams */
-	DSSALL
+	PPC_DSSALL
 	sync
 
 	/* Disable L2 prefetching */



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 168/172] interconnect: qcom: sc7180: Drop IP0 interconnects
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (166 preceding siblings ...)
  2022-06-13 10:12 ` [PATCH 5.10 167/172] powerpc/mm: Switch obsolete dssall to .long Greg Kroah-Hartman
@ 2022-06-13 10:12 ` Greg Kroah-Hartman
  2022-06-13 10:12 ` [PATCH 5.10 169/172] interconnect: Restore sync state by ignoring ipa-virt in provider count Greg Kroah-Hartman
                   ` (4 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:12 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, Alex Elder, Bjorn Andersson, Taniya Das,
	Mike Tipton, Stephen Boyd, Georgi Djakov

From: Stephen Boyd <swboyd@chromium.org>

commit 2f3724930eb4bba74f7d10bc3bef5bb22dd323df upstream.

The IPA BCM resource ("IP0") on sc7180 was moved to the clk-rpmh driver
in commit bcd63d222b60 ("clk: qcom: rpmh: Add IPA clock for SC7180") and
modeled as a clk, but this interconnect driver still had it modeled as
an interconnect. This was mostly OK because nobody used the interconnect
definition, until the interconnect framework started dropping bandwidth
requests on interconnects that aren't used via the sync_state callback
in commit 7d3b0b0d8184 ("interconnect: qcom: Use icc_sync_state"). Once
that patch was applied the IP0 resource was going to be controlled from
two places, the clk framework and the interconnect framework.

Even then, things were probably going to be OK, because commit
b95b668eaaa2 ("interconnect: qcom: icc-rpmh: Add BCMs to commit list in
pre_aggregate") was needed to actually drop bandwidth requests on unused
interconnects, of which the IPA was one of the interconnect that wasn't
getting dropped to zero. Combining the three commits together leads to
bad behavior where the interconnect framework is disabling the IP0
resource because it has no users while the clk framework thinks the IP0
resource is on because the only user, the IPA driver, has turned it on
via clk_prepare_enable(). Depending on when sync_state is called, we can
get into a situation like below:

  IPA driver probes
  IPA driver gets notified modem started
   runtime PM get()
    IPA clk enabled -> IP0 resource is ON
  sync_state runs
   interconnect zeroes out the IP0 resource -> IP0 resource is off
  IPA driver tries to access a register and blows up

The crash is an unclocked access that manifest as an SError.

 SError Interrupt on CPU0, code 0xbe000011 -- SError
 CPU: 0 PID: 3595 Comm: mmdata_mgr Not tainted 5.17.1+ #166
 Hardware name: Google Lazor (rev1 - 2) with LTE (DT)
 pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
 pc : mutex_lock+0x4c/0x80
 lr : mutex_lock+0x30/0x80
 sp : ffffffc00da9b9c0
 x29: ffffffc00da9b9c0 x28: 0000000000000000 x27: 0000000000000000
 x26: ffffffc00da9bc90 x25: ffffff80c2024010 x24: ffffff80c2024000
 x23: ffffff8083100000 x22: ffffff80831000d0 x21: ffffff80831000a8
 x20: ffffff80831000a8 x19: ffffff8083100070 x18: 00000000ffff0a00
 x17: 000000002f7254f1 x16: 0000000000000100 x15: 0000000000000000
 x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000
 x11: 000000000001f0b8 x10: ffffffc00931f0b8 x9 : 0000000000000000
 x8 : 0000000000000000 x7 : fefefefefeff2f60 x6 : 0000808080808080
 x5 : 0000000000000000 x4 : 8080808080800000 x3 : ffffff80d2d4ee28
 x2 : ffffff808c1d6e40 x1 : 0000000000000000 x0 : ffffff8083100070
 Kernel panic - not syncing: Asynchronous SError Interrupt
 CPU: 0 PID: 3595 Comm: mmdata_mgr Not tainted 5.17.1+ #166
 Hardware name: Google Lazor (rev1 - 2) with LTE (DT)
 Call trace:
  dump_backtrace+0xf4/0x114
  show_stack+0x24/0x30
  dump_stack_lvl+0x64/0x7c
  dump_stack+0x18/0x38
  panic+0x150/0x38c
  nmi_panic+0x88/0xa0
  arm64_serror_panic+0x74/0x80
  do_serror+0x0/0x80
  do_serror+0x58/0x80
  el1h_64_error_handler+0x34/0x4c
  el1h_64_error+0x78/0x7c
  mutex_lock+0x4c/0x80
  __gsi_channel_start+0x50/0x17c
  gsi_channel_start+0x54/0x90
  ipa_endpoint_enable_one+0x34/0xc0
  ipa_open+0x4c/0x120

Remove all IP0 resource management from the interconnect driver so that
clk-rpmh is the sole owner. This fixes the issue by preventing the
interconnect driver from overwriting the IP0 resource data that the
clk-rpmh driver wrote.

Cc: Alex Elder <elder@linaro.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Taniya Das <quic_tdas@quicinc.com>
Cc: Mike Tipton <quic_mdtipton@quicinc.com>
Cc: <stable@vger.kernel.org>	# 5.10.x
Fixes: b95b668eaaa2 ("interconnect: qcom: icc-rpmh: Add BCMs to commit list in pre_aggregate")
Fixes: bcd63d222b60 ("clk: qcom: rpmh: Add IPA clock for SC7180")
Fixes: 7d3b0b0d8184 ("interconnect: qcom: Use icc_sync_state")
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Tested-by: Alex Elder <elder@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220412220033.1273607-2-swboyd@chromium.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/interconnect/qcom/sc7180.c |   21 ---------------------
 1 file changed, 21 deletions(-)

--- a/drivers/interconnect/qcom/sc7180.c
+++ b/drivers/interconnect/qcom/sc7180.c
@@ -47,7 +47,6 @@ DEFINE_QNODE(qnm_mnoc_sf, SC7180_MASTER_
 DEFINE_QNODE(qnm_snoc_gc, SC7180_MASTER_SNOC_GC_MEM_NOC, 1, 8, SC7180_SLAVE_LLCC);
 DEFINE_QNODE(qnm_snoc_sf, SC7180_MASTER_SNOC_SF_MEM_NOC, 1, 16, SC7180_SLAVE_LLCC);
 DEFINE_QNODE(qxm_gpu, SC7180_MASTER_GFX3D, 2, 32, SC7180_SLAVE_GEM_NOC_SNOC, SC7180_SLAVE_LLCC);
-DEFINE_QNODE(ipa_core_master, SC7180_MASTER_IPA_CORE, 1, 8, SC7180_SLAVE_IPA_CORE);
 DEFINE_QNODE(llcc_mc, SC7180_MASTER_LLCC, 2, 4, SC7180_SLAVE_EBI1);
 DEFINE_QNODE(qhm_mnoc_cfg, SC7180_MASTER_CNOC_MNOC_CFG, 1, 4, SC7180_SLAVE_SERVICE_MNOC);
 DEFINE_QNODE(qxm_camnoc_hf0, SC7180_MASTER_CAMNOC_HF0, 2, 32, SC7180_SLAVE_MNOC_HF_MEM_NOC);
@@ -129,7 +128,6 @@ DEFINE_QNODE(qhs_mdsp_ms_mpu_cfg, SC7180
 DEFINE_QNODE(qns_gem_noc_snoc, SC7180_SLAVE_GEM_NOC_SNOC, 1, 8, SC7180_MASTER_GEM_NOC_SNOC);
 DEFINE_QNODE(qns_llcc, SC7180_SLAVE_LLCC, 1, 16, SC7180_MASTER_LLCC);
 DEFINE_QNODE(srvc_gemnoc, SC7180_SLAVE_SERVICE_GEM_NOC, 1, 4);
-DEFINE_QNODE(ipa_core_slave, SC7180_SLAVE_IPA_CORE, 1, 8);
 DEFINE_QNODE(ebi, SC7180_SLAVE_EBI1, 2, 4);
 DEFINE_QNODE(qns_mem_noc_hf, SC7180_SLAVE_MNOC_HF_MEM_NOC, 1, 32, SC7180_MASTER_MNOC_HF_MEM_NOC);
 DEFINE_QNODE(qns_mem_noc_sf, SC7180_SLAVE_MNOC_SF_MEM_NOC, 1, 32, SC7180_MASTER_MNOC_SF_MEM_NOC);
@@ -160,7 +158,6 @@ DEFINE_QBCM(bcm_mc0, "MC0", true, &ebi);
 DEFINE_QBCM(bcm_sh0, "SH0", true, &qns_llcc);
 DEFINE_QBCM(bcm_mm0, "MM0", false, &qns_mem_noc_hf);
 DEFINE_QBCM(bcm_ce0, "CE0", false, &qxm_crypto);
-DEFINE_QBCM(bcm_ip0, "IP0", false, &ipa_core_slave);
 DEFINE_QBCM(bcm_cn0, "CN0", true, &qnm_snoc, &xm_qdss_dap, &qhs_a1_noc_cfg, &qhs_a2_noc_cfg, &qhs_ahb2phy0, &qhs_aop, &qhs_aoss, &qhs_boot_rom, &qhs_camera_cfg, &qhs_camera_nrt_throttle_cfg, &qhs_camera_rt_throttle_cfg, &qhs_clk_ctl, &qhs_cpr_cx, &qhs_cpr_mx, &qhs_crypto0_cfg, &qhs_dcc_cfg, &qhs_ddrss_cfg, &qhs_display_cfg, &qhs_display_rt_throttle_cfg, &qhs_display_throttle_cfg, &qhs_glm, &qhs_gpuss_cfg, &qhs_imem_cfg, &qhs_ipa, &qhs_mnoc_cfg, &qhs_mss_cfg, &qhs_npu_cfg, &qhs_npu_dma_throttle_cfg, &qhs_npu_dsp_throttle_cfg, &qhs_pimem_cfg, &qhs_prng, &qhs_qdss_cfg, &qhs_qm_cfg, &qhs_qm_mpu_cfg, &qhs_qup0, &qhs_qup1, &qhs_security, &qhs_snoc_cfg, &qhs_tcsr, &qhs_tlmm_1, &qhs_tlmm_2, &qhs_tlmm_3, &qhs_ufs_mem_cfg, &qhs_usb3, &qhs_venus_cfg, &qhs_venus_throttle_cfg, &qhs_vsense_ctrl_cfg, &srvc_cnoc);
 DEFINE_QBCM(bcm_mm1, "MM1", false, &qxm_camnoc_hf0_uncomp, &qxm_camnoc_hf1_uncomp, &qxm_camnoc_sf_uncomp, &qhm_mnoc_cfg, &qxm_mdp0, &qxm_rot, &qxm_venus0, &qxm_venus_arm9);
 DEFINE_QBCM(bcm_sh2, "SH2", false, &acm_sys_tcu);
@@ -372,22 +369,6 @@ static struct qcom_icc_desc sc7180_gem_n
 	.num_bcms = ARRAY_SIZE(gem_noc_bcms),
 };
 
-static struct qcom_icc_bcm *ipa_virt_bcms[] = {
-	&bcm_ip0,
-};
-
-static struct qcom_icc_node *ipa_virt_nodes[] = {
-	[MASTER_IPA_CORE] = &ipa_core_master,
-	[SLAVE_IPA_CORE] = &ipa_core_slave,
-};
-
-static struct qcom_icc_desc sc7180_ipa_virt = {
-	.nodes = ipa_virt_nodes,
-	.num_nodes = ARRAY_SIZE(ipa_virt_nodes),
-	.bcms = ipa_virt_bcms,
-	.num_bcms = ARRAY_SIZE(ipa_virt_bcms),
-};
-
 static struct qcom_icc_bcm *mc_virt_bcms[] = {
 	&bcm_acv,
 	&bcm_mc0,
@@ -611,8 +592,6 @@ static const struct of_device_id qnoc_of
 	  .data = &sc7180_dc_noc},
 	{ .compatible = "qcom,sc7180-gem-noc",
 	  .data = &sc7180_gem_noc},
-	{ .compatible = "qcom,sc7180-ipa-virt",
-	  .data = &sc7180_ipa_virt},
 	{ .compatible = "qcom,sc7180-mc-virt",
 	  .data = &sc7180_mc_virt},
 	{ .compatible = "qcom,sc7180-mmss-noc",



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 169/172] interconnect: Restore sync state by ignoring ipa-virt in provider count
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (167 preceding siblings ...)
  2022-06-13 10:12 ` [PATCH 5.10 168/172] interconnect: qcom: sc7180: Drop IP0 interconnects Greg Kroah-Hartman
@ 2022-06-13 10:12 ` Greg Kroah-Hartman
  2022-06-13 10:12 ` [PATCH 5.10 170/172] md/raid0: Ignore RAID0 layout if the second zone has only one device Greg Kroah-Hartman
                   ` (3 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:12 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, Bjorn Andersson, Doug Anderson, Alex Elder,
	Taniya Das, Mike Tipton, Stephen Boyd, Georgi Djakov

From: Stephen Boyd <swboyd@chromium.org>

commit 20ce30fb4750f2ffc130cdcb26232b1dd87cd0a5 upstream.

Ignore compatible strings for the IPA virt drivers that were removed in
commits 2fb251c26560 ("interconnect: qcom: sdx55: Drop IP0
interconnects") and 2f3724930eb4 ("interconnect: qcom: sc7180: Drop IP0
interconnects") so that the sync state logic can kick in again.
Otherwise all the interconnects in the system will stay pegged at max
speeds because 'providers_count' is always going to be one larger than
the number of drivers that will ever probe on sc7180 or sdx55. This
fixes suspend on sc7180 and sdx55 devices when you don't have a
devicetree patch to remove the ipa-virt compatible node.

Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Doug Anderson <dianders@chromium.org>
Cc: Alex Elder <elder@linaro.org>
Cc: Taniya Das <quic_tdas@quicinc.com>
Cc: Mike Tipton <quic_mdtipton@quicinc.com>
Cc: <stable@vger.kernel.org>	# 5.10.x
Fixes: 2fb251c26560 ("interconnect: qcom: sdx55: Drop IP0 interconnects")
Fixes: 2f3724930eb4 ("interconnect: qcom: sc7180: Drop IP0 interconnects")
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20220427013226.341209-1-swboyd@chromium.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/interconnect/core.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/drivers/interconnect/core.c
+++ b/drivers/interconnect/core.c
@@ -1084,9 +1084,14 @@ static int of_count_icc_providers(struct
 {
 	struct device_node *child;
 	int count = 0;
+	const struct of_device_id __maybe_unused ignore_list[] = {
+		{ .compatible = "qcom,sc7180-ipa-virt" },
+		{}
+	};
 
 	for_each_available_child_of_node(np, child) {
-		if (of_property_read_bool(child, "#interconnect-cells"))
+		if (of_property_read_bool(child, "#interconnect-cells") &&
+		    likely(!of_match_node(ignore_list, child)))
 			count++;
 		count += of_count_icc_providers(child);
 	}



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 170/172] md/raid0: Ignore RAID0 layout if the second zone has only one device
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (168 preceding siblings ...)
  2022-06-13 10:12 ` [PATCH 5.10 169/172] interconnect: Restore sync state by ignoring ipa-virt in provider count Greg Kroah-Hartman
@ 2022-06-13 10:12 ` Greg Kroah-Hartman
  2022-06-13 10:12 ` [PATCH 5.10 171/172] PCI: qcom: Fix pipe clock imbalance Greg Kroah-Hartman
                   ` (2 subsequent siblings)
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, NeilBrown, Pascal Hambourg, Song Liu

From: Pascal Hambourg <pascal@plouf.fr.eu.org>

commit ea23994edc4169bd90d7a9b5908c6ccefd82fa40 upstream.

The RAID0 layout is irrelevant if all members have the same size so the
array has only one zone. It is *also* irrelevant if the array has two
zones and the second zone has only one device, for example if the array
has two members of different sizes.

So in that case it makes sense to allow assembly even when the layout is
undefined, like what is done when the array has only one zone.

Reviewed-by: NeilBrown <neilb@suse.de>
Signed-off-by: Pascal Hambourg <pascal@plouf.fr.eu.org>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/md/raid0.c |   31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -128,21 +128,6 @@ static int create_strip_zones(struct mdd
 	pr_debug("md/raid0:%s: FINAL %d zones\n",
 		 mdname(mddev), conf->nr_strip_zones);
 
-	if (conf->nr_strip_zones == 1) {
-		conf->layout = RAID0_ORIG_LAYOUT;
-	} else if (mddev->layout == RAID0_ORIG_LAYOUT ||
-		   mddev->layout == RAID0_ALT_MULTIZONE_LAYOUT) {
-		conf->layout = mddev->layout;
-	} else if (default_layout == RAID0_ORIG_LAYOUT ||
-		   default_layout == RAID0_ALT_MULTIZONE_LAYOUT) {
-		conf->layout = default_layout;
-	} else {
-		pr_err("md/raid0:%s: cannot assemble multi-zone RAID0 with default_layout setting\n",
-		       mdname(mddev));
-		pr_err("md/raid0: please set raid0.default_layout to 1 or 2\n");
-		err = -ENOTSUPP;
-		goto abort;
-	}
 	/*
 	 * now since we have the hard sector sizes, we can make sure
 	 * chunk size is a multiple of that sector size
@@ -273,6 +258,22 @@ static int create_strip_zones(struct mdd
 			 (unsigned long long)smallest->sectors);
 	}
 
+	if (conf->nr_strip_zones == 1 || conf->strip_zone[1].nb_dev == 1) {
+		conf->layout = RAID0_ORIG_LAYOUT;
+	} else if (mddev->layout == RAID0_ORIG_LAYOUT ||
+		   mddev->layout == RAID0_ALT_MULTIZONE_LAYOUT) {
+		conf->layout = mddev->layout;
+	} else if (default_layout == RAID0_ORIG_LAYOUT ||
+		   default_layout == RAID0_ALT_MULTIZONE_LAYOUT) {
+		conf->layout = default_layout;
+	} else {
+		pr_err("md/raid0:%s: cannot assemble multi-zone RAID0 with default_layout setting\n",
+		       mdname(mddev));
+		pr_err("md/raid0: please set raid0.default_layout to 1 or 2\n");
+		err = -EOPNOTSUPP;
+		goto abort;
+	}
+
 	pr_debug("md/raid0:%s: done.\n", mdname(mddev));
 	*private_conf = conf;
 



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 171/172] PCI: qcom: Fix pipe clock imbalance
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (169 preceding siblings ...)
  2022-06-13 10:12 ` [PATCH 5.10 170/172] md/raid0: Ignore RAID0 layout if the second zone has only one device Greg Kroah-Hartman
@ 2022-06-13 10:12 ` Greg Kroah-Hartman
  2022-06-13 10:12 ` [PATCH 5.10 172/172] zonefs: fix handling of explicit_open option on mount Greg Kroah-Hartman
  2022-06-13 11:59 ` [PATCH 5.10 000/172] 5.10.122-rc1 review Pavel Machek
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Johan Hovold, Lorenzo Pieralisi,
	Bjorn Helgaas, Bjorn Andersson

From: Johan Hovold <johan+linaro@kernel.org>

commit fdf6a2f533115ec5d4d9629178f8196331f1ac50 upstream.

Fix a clock imbalance introduced by ed8cc3b1fc84 ("PCI: qcom: Add support
for SDM845 PCIe controller"), which enables the pipe clock both in init()
and in post_init() but only disables in post_deinit().

Note that the pipe clock was also never disabled in the init() error
paths and that enabling the clock before powering up the PHY looks
questionable.

Link: https://lore.kernel.org/r/20220401133351.10113-1-johan+linaro@kernel.org
Fixes: ed8cc3b1fc84 ("PCI: qcom: Add support for SDM845 PCIe controller")
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: stable@vger.kernel.org      # 5.6
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/pci/controller/dwc/pcie-qcom.c |    6 ------
 1 file changed, 6 deletions(-)

--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1192,12 +1192,6 @@ static int qcom_pcie_init_2_7_0(struct q
 		goto err_disable_clocks;
 	}
 
-	ret = clk_prepare_enable(res->pipe_clk);
-	if (ret) {
-		dev_err(dev, "cannot prepare/enable pipe clock\n");
-		goto err_disable_clocks;
-	}
-
 	/* configure PCIe to RC mode */
 	writel(DEVICE_TYPE_RC, pcie->parf + PCIE20_PARF_DEVICE_TYPE);
 



^ permalink raw reply	[flat|nested] 174+ messages in thread

* [PATCH 5.10 172/172] zonefs: fix handling of explicit_open option on mount
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (170 preceding siblings ...)
  2022-06-13 10:12 ` [PATCH 5.10 171/172] PCI: qcom: Fix pipe clock imbalance Greg Kroah-Hartman
@ 2022-06-13 10:12 ` Greg Kroah-Hartman
  2022-06-13 11:59 ` [PATCH 5.10 000/172] 5.10.122-rc1 review Pavel Machek
  172 siblings, 0 replies; 174+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-13 10:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Damien Le Moal, Christoph Hellwig,
	Johannes Thumshirn

From: Damien Le Moal <damien.lemoal@opensource.wdc.com>

commit a2a513be7139b279f1b5b2cee59c6c4950c34346 upstream.

Ignoring the explicit_open mount option on mount for devices that do not
have a limit on the number of open zones must be done after the mount
options are parsed and set in s_mount_opts. Move the check to ignore
the explicit_open option after the call to zonefs_parse_options() in
zonefs_fill_super().

Fixes: b5c00e975779 ("zonefs: open/close zone on file open/close")
Cc: <stable@vger.kernel.org>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/zonefs/super.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

--- a/fs/zonefs/super.c
+++ b/fs/zonefs/super.c
@@ -1706,11 +1706,6 @@ static int zonefs_fill_super(struct supe
 	sbi->s_mount_opts = ZONEFS_MNTOPT_ERRORS_RO;
 	sbi->s_max_open_zones = bdev_max_open_zones(sb->s_bdev);
 	atomic_set(&sbi->s_open_zones, 0);
-	if (!sbi->s_max_open_zones &&
-	    sbi->s_mount_opts & ZONEFS_MNTOPT_EXPLICIT_OPEN) {
-		zonefs_info(sb, "No open zones limit. Ignoring explicit_open mount option\n");
-		sbi->s_mount_opts &= ~ZONEFS_MNTOPT_EXPLICIT_OPEN;
-	}
 
 	ret = zonefs_read_super(sb);
 	if (ret)
@@ -1729,6 +1724,12 @@ static int zonefs_fill_super(struct supe
 	zonefs_info(sb, "Mounting %u zones",
 		    blkdev_nr_zones(sb->s_bdev->bd_disk));
 
+	if (!sbi->s_max_open_zones &&
+	    sbi->s_mount_opts & ZONEFS_MNTOPT_EXPLICIT_OPEN) {
+		zonefs_info(sb, "No open zones limit. Ignoring explicit_open mount option\n");
+		sbi->s_mount_opts &= ~ZONEFS_MNTOPT_EXPLICIT_OPEN;
+	}
+
 	/* Create root directory inode */
 	ret = -ENOMEM;
 	inode = new_inode(sb);



^ permalink raw reply	[flat|nested] 174+ messages in thread

* Re: [PATCH 5.10 000/172] 5.10.122-rc1 review
  2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
                   ` (171 preceding siblings ...)
  2022-06-13 10:12 ` [PATCH 5.10 172/172] zonefs: fix handling of explicit_open option on mount Greg Kroah-Hartman
@ 2022-06-13 11:59 ` Pavel Machek
  172 siblings, 0 replies; 174+ messages in thread
From: Pavel Machek @ 2022-06-13 11:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, stable, torvalds, akpm, linux, shuah, patches,
	lkft-triage, pavel, jonathanh, f.fainelli, sudipm.mukherjee,
	slade

[-- Attachment #1: Type: text/plain, Size: 664 bytes --]

Hi!

> This is the start of the stable review cycle for the 5.10.122 release.
> There are 172 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.

CIP testing did not find any problems here:

https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-5.10.y

Tested-by: Pavel Machek (CIP) <pavel@denx.de>

Best regards,
                                                                Pavel

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 174+ messages in thread

end of thread, other threads:[~2022-06-13 14:57 UTC | newest]

Thread overview: 174+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-13 10:09 [PATCH 5.10 000/172] 5.10.122-rc1 review Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 001/172] pcmcia: db1xxx_ss: restrict to MIPS_DB1XXX boards Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 002/172] staging: greybus: codecs: fix type confusion of list iterator variable Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 003/172] iio: adc: ad7124: Remove shift from scan_type Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 004/172] lkdtm/bugs: Check for the NULL pointer after calling kmalloc Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 005/172] tty: goldfish: Use tty_port_destroy() to destroy port Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 006/172] tty: serial: owl: Fix missing clk_disable_unprepare() in owl_uart_probe Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 007/172] tty: n_tty: Restore EOF push handling behavior Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 008/172] tty: serial: fsl_lpuart: fix potential bug when using both of_alias_get_id and ida_simple_get Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 009/172] usb: usbip: fix a refcount leak in stub_probe() Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 010/172] usb: usbip: add missing device lock on tweak configuration cmd Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 011/172] USB: storage: karma: fix rio_karma_init return Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 012/172] usb: musb: Fix missing of_node_put() in omap2430_probe Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 013/172] staging: fieldbus: Fix the error handling path in anybuss_host_common_probe() Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 014/172] pwm: lp3943: Fix duty calculation in case period was clamped Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 015/172] rpmsg: qcom_smd: Fix irq_of_parse_and_map() return value Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 016/172] usb: dwc3: pci: Fix pm_runtime_get_sync() error checking Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 017/172] misc: fastrpc: fix an incorrect NULL check on list iterator Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 018/172] firmware: stratix10-svc: fix a missing " Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 019/172] usb: typec: mux: Check dev_set_name() return value Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 020/172] iio: adc: stmpe-adc: Fix wait_for_completion_timeout return value check Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 021/172] iio: proximity: vl53l0x: Fix return value check of wait_for_completion_timeout Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 022/172] iio: adc: sc27xx: fix read big scale voltage not right Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 023/172] iio: adc: sc27xx: Fine tune the scale calibration values Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 024/172] rpmsg: qcom_smd: Fix returning 0 if irq_of_parse_and_map() fails Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 025/172] phy: qcom-qmp: fix pipe-clock imbalance on power-on failure Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 026/172] serial: sifive: Report actual baud base rather than fixed 115200 Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 027/172] coresight: cpu-debug: Replace mutex with mutex_trylock on panic notifier Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 028/172] extcon: ptn5150: Add queue work sync before driver release Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 029/172] soc: rockchip: Fix refcount leak in rockchip_grf_init Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 030/172] clocksource/drivers/riscv: Events are stopped during CPU suspend Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 031/172] rtc: mt6397: check return value after calling platform_get_resource() Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 032/172] serial: meson: acquire port->lock in startup() Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 033/172] serial: 8250_fintek: Check SER_RS485_RTS_* only with RS485 Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 034/172] serial: digicolor-usart: Dont allow CS5-6 Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 035/172] serial: rda-uart: " Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 036/172] serial: txx9: " Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 037/172] serial: sh-sci: " Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 038/172] serial: sifive: Sanitize CSIZE and c_iflag Greg Kroah-Hartman
2022-06-13 10:09 ` [PATCH 5.10 039/172] serial: st-asc: Sanitize CSIZE and correct PARENB for CS7 Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 040/172] serial: stm32-usart: Correct CSIZE, bits, and parity Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 041/172] firmware: dmi-sysfs: Fix memory leak in dmi_sysfs_register_handle Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 042/172] bus: ti-sysc: Fix warnings for unbind for serial Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 043/172] driver: base: fix UAF when driver_attach failed Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 044/172] driver core: fix deadlock in __device_attach Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 045/172] watchdog: rti-wdt: Fix pm_runtime_get_sync() error checking Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 046/172] watchdog: ts4800_wdt: Fix refcount leak in ts4800_wdt_probe Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 047/172] ASoC: fsl_sai: Fix FSL_SAI_xDR/xFR definition Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 048/172] clocksource/drivers/oxnas-rps: Fix irq_of_parse_and_map() return value Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 049/172] s390/crypto: fix scatterwalk_unmap() callers in AES-GCM Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 050/172] net: sched: fixed barrier to prevent skbuff sticking in qdisc backlog Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 051/172] net: ethernet: mtk_eth_soc: out of bounds read in mtk_hwlro_get_fdir_entry() Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 052/172] net: ethernet: ti: am65-cpsw-nuss: Fix some refcount leaks Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 053/172] net: dsa: mv88e6xxx: Fix refcount leak in mv88e6xxx_mdios_register Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 054/172] modpost: fix removing numeric suffixes Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 055/172] jffs2: fix memory leak in jffs2_do_fill_super Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 056/172] ubi: fastmap: Fix high cpu usage of ubi_bgt by making sure wl_pool not empty Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 057/172] ubi: ubi_create_volume: Fix use-after-free when volume creation failed Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 058/172] bpf: Fix probe read error in ___bpf_prog_run() Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 059/172] riscv: read-only pages should not be writable Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 060/172] net/smc: fixes for converting from "struct smc_cdc_tx_pend **" to "struct smc_wr_tx_pend_priv *" Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 061/172] nfp: only report pause frame configuration for physical device Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 062/172] sfc: fix considering that all channels have TX queues Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 063/172] sfc: fix wrong tx channel offset with efx_separate_tx_channels Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 064/172] net/mlx5: Dont use already freed action pointer Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 065/172] net/mlx5: correct ECE offset in query qp output Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 066/172] net/mlx5e: Update netdev features after changing XDP state Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 067/172] net: sched: add barrier to fix packet stuck problem for lockless qdisc Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 068/172] tcp: tcp_rtx_synack() can be called from process context Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 069/172] gpio: pca953x: use the correct register address to do regcache sync Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 070/172] afs: Fix infinite loop found by xfstest generic/676 Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 071/172] scsi: sd: Fix potential NULL pointer dereference Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 072/172] tipc: check attribute length for bearer name Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 073/172] driver core: Fix wait_for_device_probe() & deferred_probe_timeout interaction Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 074/172] perf c2c: Fix sorting in percent_rmt_hitm_cmp() Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 075/172] dmaengine: idxd: set DMA_INTERRUPT cap bit Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 076/172] mips: cpc: Fix refcount leak in mips_cpc_default_phys_base Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 077/172] bootconfig: Make the bootconfig.o as a normal object file Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 078/172] tracing: Fix sleeping function called from invalid context on RT kernel Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 079/172] tracing: Avoid adding tracer option before update_tracer_options Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 080/172] iommu/arm-smmu: fix possible null-ptr-deref in arm_smmu_device_probe() Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 081/172] iommu/arm-smmu-v3: check return value after calling platform_get_resource() Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 082/172] f2fs: remove WARN_ON in f2fs_is_valid_blkaddr Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 083/172] i2c: cadence: Increase timeout per message if necessary Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 084/172] m68knommu: set ZERO_PAGE() to the allocated zeroed page Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 085/172] m68knommu: fix undefined reference to `_init_sp Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 086/172] dmaengine: zynqmp_dma: In struct zynqmp_dma_chan fix desc_size data type Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 087/172] NFSv4: Dont hold the layoutget locks across multiple RPC calls Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 088/172] video: fbdev: hyperv_fb: Allow resolutions with size > 64 MB for Gen1 Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 089/172] video: fbdev: pxa3xx-gcu: release the resources correctly in pxa3xx_gcu_probe/remove() Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 090/172] xprtrdma: treat all calls not a bcall when bc_serv is NULL Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 091/172] netfilter: nat: really support inet nat without l3 address Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 092/172] netfilter: nf_tables: delete flowtable hooks via transaction list Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 093/172] powerpc/kasan: Force thread size increase with KASAN Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 094/172] netfilter: nf_tables: always initialize flowtable hook list in transaction Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 095/172] ata: pata_octeon_cf: Fix refcount leak in octeon_cf_probe Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 096/172] netfilter: nf_tables: release new hooks on unsupported flowtable flags Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 097/172] netfilter: nf_tables: memleak flow rule from commit path Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 098/172] netfilter: nf_tables: bail out early if hardware offload is not supported Greg Kroah-Hartman
2022-06-13 10:10 ` [PATCH 5.10 099/172] xen: unexport __init-annotated xen_xlate_map_ballooned_pages() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 100/172] af_unix: Fix a data-race in unix_dgram_peer_wake_me() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 101/172] bpf, arm64: Clear prog->jited_len along prog->jited Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 102/172] net: dsa: lantiq_gswip: Fix refcount leak in gswip_gphy_fw_list Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 103/172] net/mlx4_en: Fix wrong return value on ioctl EEPROM query failure Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 104/172] SUNRPC: Fix the calculation of xdr->end in xdr_get_next_encode_buffer() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 105/172] net: mdio: unexport __init-annotated mdio_bus_init() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 106/172] net: xfrm: unexport __init-annotated xfrm4_protocol_init() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 107/172] net: ipv6: unexport __init-annotated seg6_hmac_init() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 108/172] net/mlx5: Rearm the FW tracer after each tracer event Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 109/172] net/mlx5: fs, fail conflicting actions Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 110/172] ip_gre: test csum_start instead of transport header Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 111/172] net: altera: Fix refcount leak in altera_tse_mdio_create Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 112/172] drm: imx: fix compiler warning with gcc-12 Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 113/172] iio: dummy: iio_simple_dummy: check the return value of kstrdup() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 114/172] staging: rtl8712: fix a potential memory leak in r871xu_drv_init() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 115/172] iio: st_sensors: Add a local lock for protecting odr Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 116/172] lkdtm/usercopy: Expand size of "out of frame" object Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 117/172] tty: synclink_gt: Fix null-pointer-dereference in slgt_clean() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 118/172] tty: Fix a possible resource leak in icom_probe Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 119/172] drivers: staging: rtl8192u: Fix deadlock in ieee80211_beacons_stop() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 120/172] drivers: staging: rtl8192e: Fix deadlock in rtllib_beacons_stop() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 121/172] USB: host: isp116x: check return value after calling platform_get_resource() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 122/172] drivers: tty: serial: Fix deadlock in sa1100_set_termios() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 123/172] drivers: usb: host: Fix deadlock in oxu_bus_suspend() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 124/172] USB: hcd-pci: Fully suspend across freeze/thaw cycle Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 125/172] sysrq: do not omit current cpu when showing backtrace of all active CPUs Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 126/172] usb: dwc2: gadget: dont reset gadgets driver->bus Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 127/172] misc: rtsx: set NULL intfdata when probe fails Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 128/172] extcon: Modify extcon device to be created after driver data is set Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 129/172] clocksource/drivers/sp804: Avoid error on multiple instances Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 130/172] staging: rtl8712: fix uninit-value in usb_read8() and friends Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 131/172] staging: rtl8712: fix uninit-value in r871xu_drv_init() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 132/172] serial: msm_serial: disable interrupts in __msm_console_write() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 133/172] kernfs: Separate kernfs_pr_cont_buf and rename_lock Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 134/172] watchdog: wdat_wdt: Stop watchdog when rebooting the system Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 135/172] md: protect md_unregister_thread from reentrancy Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 136/172] scsi: myrb: Fix up null pointer access on myrb_cleanup() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 137/172] Revert "net: af_key: add check for pfkey_broadcast in function pfkey_process" Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 138/172] ceph: allow ceph.dir.rctime xattr to be updatable Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 139/172] drm/radeon: fix a possible null pointer dereference Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 140/172] modpost: fix undefined behavior of is_arm_mapping_symbol() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 141/172] x86/cpu: Elide KCSAN for cpu_has() and friends Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 142/172] jump_label,noinstr: Avoid instrumentation for JUMP_LABEL=n builds Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 143/172] nbd: call genl_unregister_family() first in nbd_cleanup() Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 144/172] nbd: fix race between nbd_alloc_config() and module removal Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 145/172] nbd: fix io hung while disconnecting device Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 146/172] s390/gmap: voluntarily schedule during key setting Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 147/172] cifs: version operations for smb20 unneeded when legacy support disabled Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 148/172] nodemask: Fix return values to be unsigned Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 149/172] vringh: Fix loop descriptors check in the indirect cases Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 150/172] scripts/gdb: change kernel config dumping method Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 151/172] ALSA: hda/conexant - Fix loopback issue with CX20632 Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 152/172] ALSA: hda/realtek: Fix for quirk to enable speaker output on the Lenovo Yoga DuetITL 2021 Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 153/172] cifs: return errors during session setup during reconnects Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 154/172] cifs: fix reconnect on smb3 mount types Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 155/172] ata: libata-transport: fix {dma|pio|xfer}_mode sysfs files Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 156/172] mmc: block: Fix CQE recovery reset success Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 157/172] net: phy: dp83867: retrigger SGMII AN when link change Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 158/172] nfc: st21nfca: fix incorrect validating logic in EVT_TRANSACTION Greg Kroah-Hartman
2022-06-13 10:11 ` [PATCH 5.10 159/172] nfc: st21nfca: fix memory leaks in EVT_TRANSACTION handling Greg Kroah-Hartman
2022-06-13 10:12 ` [PATCH 5.10 160/172] nfc: st21nfca: fix incorrect sizing calculations in EVT_TRANSACTION Greg Kroah-Hartman
2022-06-13 10:12 ` [PATCH 5.10 161/172] ixgbe: fix bcast packets Rx on VF after promisc removal Greg Kroah-Hartman
2022-06-13 10:12 ` [PATCH 5.10 162/172] ixgbe: fix unexpected VLAN Rx in promisc mode on VF Greg Kroah-Hartman
2022-06-13 10:12 ` [PATCH 5.10 163/172] Input: bcm5974 - set missing URB_NO_TRANSFER_DMA_MAP urb flag Greg Kroah-Hartman
2022-06-13 10:12 ` [PATCH 5.10 164/172] drm/bridge: analogix_dp: Support PSR-exit to disable transition Greg Kroah-Hartman
2022-06-13 10:12 ` [PATCH 5.10 165/172] drm/atomic: Force bridge self-refresh-exit on CRTC switch Greg Kroah-Hartman
2022-06-13 10:12 ` [PATCH 5.10 166/172] powerpc/32: Fix overread/overwrite of thread_struct via ptrace Greg Kroah-Hartman
2022-06-13 10:12 ` [PATCH 5.10 167/172] powerpc/mm: Switch obsolete dssall to .long Greg Kroah-Hartman
2022-06-13 10:12 ` [PATCH 5.10 168/172] interconnect: qcom: sc7180: Drop IP0 interconnects Greg Kroah-Hartman
2022-06-13 10:12 ` [PATCH 5.10 169/172] interconnect: Restore sync state by ignoring ipa-virt in provider count Greg Kroah-Hartman
2022-06-13 10:12 ` [PATCH 5.10 170/172] md/raid0: Ignore RAID0 layout if the second zone has only one device Greg Kroah-Hartman
2022-06-13 10:12 ` [PATCH 5.10 171/172] PCI: qcom: Fix pipe clock imbalance Greg Kroah-Hartman
2022-06-13 10:12 ` [PATCH 5.10 172/172] zonefs: fix handling of explicit_open option on mount Greg Kroah-Hartman
2022-06-13 11:59 ` [PATCH 5.10 000/172] 5.10.122-rc1 review Pavel Machek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.