All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4.19 000/247] 4.19.178-rc1 review
@ 2021-03-01 16:10 Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 001/247] HID: make arrays usage and value to be the same Greg Kroah-Hartman
                   ` (249 more replies)
  0 siblings, 250 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, torvalds, akpm, linux, shuah, patches,
	lkft-triage, pavel, jonathanh, f.fainelli, stable

This is the start of the stable review cycle for the 4.19.178 release.
There are 247 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, 03 Mar 2021 16:09:49 +0000.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
	https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.178-rc1.gz
or in the git tree and branch at:
	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.19.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Linux 4.19.178-rc1

Takeshi Misawa <jeliantsurux@gmail.com>
    net: qrtr: Fix memory leak in qrtr_tun_open

Nikos Tsironis <ntsironis@arrikto.com>
    dm era: Update in-core bitset after committing the metadata

Jason A. Donenfeld <Jason@zx2c4.com>
    net: icmp: pass zeroed opts from icmp{,v6}_ndo_send before sending

Leon Romanovsky <leonro@nvidia.com>
    ipv6: silence compilation warning for non-IPV6 builds

Eric Dumazet <edumazet@google.com>
    ipv6: icmp6: avoid indirect call for icmpv6_send()

Jason A. Donenfeld <Jason@zx2c4.com>
    xfrm: interface: use icmp_ndo_send helper

Jason A. Donenfeld <Jason@zx2c4.com>
    sunvnet: use icmp_ndo_send helper

Jason A. Donenfeld <Jason@zx2c4.com>
    gtp: use icmp_ndo_send helper

Jason A. Donenfeld <Jason@zx2c4.com>
    icmp: introduce helper for nat'd source address in network device context

Nikos Tsironis <ntsironis@arrikto.com>
    dm era: only resize metadata in preresume

Nikos Tsironis <ntsironis@arrikto.com>
    dm era: Reinitialize bitset cache before digesting a new writeset

Nikos Tsironis <ntsironis@arrikto.com>
    dm era: Use correct value size in equality function of writeset tree

Nikos Tsironis <ntsironis@arrikto.com>
    dm era: Fix bitset memory leaks

Nikos Tsironis <ntsironis@arrikto.com>
    dm era: Verify the data block size hasn't changed

Nikos Tsironis <ntsironis@arrikto.com>
    dm era: Recover committed writeset after crash

Mikulas Patocka <mpatocka@redhat.com>
    dm: fix deadlock when swapping to encrypted device

Bob Peterson <rpeterso@redhat.com>
    gfs2: Don't skip dlm unlock if glock has an lvb

Al Viro <viro@zeniv.linux.org.uk>
    sparc32: fix a user-triggerable oops in clear_user()

Chao Yu <yuchao0@huawei.com>
    f2fs: fix out-of-repair __setattr_copy()

Chen Yu <yu.c.chen@intel.com>
    cpufreq: intel_pstate: Get per-CPU max freq via MSR_HWP_CAPABILITIES if available

Muchun Song <songmuchun@bytedance.com>
    printk: fix deadlock when kernel panic

Maxim Kiselev <bigunclemax@gmail.com>
    gpio: pcf857x: Fix missing first interrupt

Frank Li <Frank.Li@nxp.com>
    mmc: sdhci-esdhc-imx: fix kernel panic when remove module

Fangrui Song <maskray@google.com>
    module: Ignore _GLOBAL_OFFSET_TABLE_ when warning for undefined symbols

Suzuki K Poulose <suzuki.poulose@arm.com>
    arm64: Extend workaround for erratum 1024718 to all versions of Cortex-A55

Dan Williams <dan.j.williams@intel.com>
    libnvdimm/dimm: Avoid race between probe and available_slots_show()

Mike Kravetz <mike.kravetz@oracle.com>
    hugetlb: fix copy_huge_page_from_user contig page struct assumption

NeilBrown <neilb@suse.de>
    x86: fix seq_file iteration for pat/memtype.c

NeilBrown <neilb@suse.de>
    seq_file: document how per-entry resources are managed.

Pan Bian <bianpan2016@163.com>
    fs/affs: release old buffer head on error path

Pan Bian <bianpan2016@163.com>
    mtd: spi-nor: hisi-sfc: Put child node np on error path

Alexander Usyskin <alexander.usyskin@intel.com>
    watchdog: mei_wdt: request stop on unregister

He Zhe <zhe.he@windriver.com>
    arm64: uprobe: Return EOPNOTSUPP for AARCH32 instruction probing

Jiri Kosina <jkosina@suse.cz>
    floppy: reintroduce O_NDELAY fix

Sean Christopherson <seanjc@google.com>
    x86/reboot: Force all cpus to exit VMX root if VMX is supported

Pavel Machek <pavel@denx.de>
    media: ipu3-cio2: Fix mbus_code processing in cio2_subdev_set_fmt()

Martin Kaiser <martin@kaiser.cx>
    staging: rtl8188eu: Add Edimax EW-7811UN V2 to device table

Amey Narkhede <ameynarkhede03@gmail.com>
    staging: gdm724x: Fix DMA from stack

Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
    staging/mt7621-dma: mtk-hsdma.c->hsdma-mt7621.c

Frank Wunderlich <frank-w@public-files.de>
    dts64: mt7622: fix slow sd card access

Jiri Bohac <jbohac@suse.cz>
    pstore: Fix typo in compression option name

Sabyrzhan Tasbolatov <snovitoll@gmail.com>
    drivers/misc/vmw_vmci: restrict too big queue size in qp_host_alloc_queue

Ricky Wu <ricky_wu@realtek.com>
    misc: rtsx: init of rts522a add OCP power off when no card is present

Paul Cercueil <paul@crapouillou.net>
    seccomp: Add missing return in non-void function

Corentin Labbe <clabbe@baylibre.com>
    crypto: sun4i-ss - handle BigEndian for cipher

Corentin Labbe <clabbe@baylibre.com>
    crypto: sun4i-ss - IV register does not work on A10 and A13

Corentin Labbe <clabbe@baylibre.com>
    crypto: sun4i-ss - checking sg length is not sufficient

Ard Biesheuvel <ardb@kernel.org>
    crypto: arm64/sha - add missing module aliases

Filipe Manana <fdmanana@suse.com>
    btrfs: fix extent buffer leak on failure to copy root

Josef Bacik <josef@toxicpanda.com>
    btrfs: fix reloc root leak with 0 ref reloc roots on recovery

Josef Bacik <josef@toxicpanda.com>
    btrfs: abort the transaction if we fail to inc ref in btrfs_copy_root

Jarkko Sakkinen <jarkko@kernel.org>
    KEYS: trusted: Fix migratable=1 failing

James Bottomley <James.Bottomley@HansenPartnership.com>
    tpm_tis: Clean up locality release

James Bottomley <James.Bottomley@HansenPartnership.com>
    tpm_tis: Fix check_locality for correct locality acquisition

PeiSen Hou <pshou@realtek.com>
    ALSA: hda/realtek: modify EAPD in the ALC886

Dan Carpenter <dan.carpenter@oracle.com>
    USB: serial: mos7720: fix error code in mos7720_write()

Dan Carpenter <dan.carpenter@oracle.com>
    USB: serial: mos7840: fix error code in mos7840_write()

Johan Hovold <johan@kernel.org>
    USB: serial: ftdi_sio: fix FTX sub-integer prescaler

Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    usb: dwc3: gadget: Fix dep->interval for fullspeed interrupt

Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    usb: dwc3: gadget: Fix setting of DEPCFG.bInterval_m1

Paul Cercueil <paul@crapouillou.net>
    usb: musb: Fix runtime PM race in musb_queue_resume_work

Lech Perczak <lech.perczak@gmail.com>
    USB: serial: option: update interface mapping for ZTE P685M

Marcos Paulo de Souza <mpdesouza@suse.com>
    Input: i8042 - add ASUS Zenbook Flip to noselftest list

Dan Carpenter <dan.carpenter@oracle.com>
    Input: joydev - prevent potential read overflow in ioctl

Olivier Crête <olivier.crete@ocrete.ca>
    Input: xpad - add support for PowerA Enhanced Wired Controller for Xbox Series X|S

jeffrey.lin <jeffrey.lin@rad-ic.com>
    Input: raydium_ts_i2c - do not send zero length

Jason Gerecke <killertofu@gmail.com>
    HID: wacom: Ignore attempts to overwrite the touch_max value from HID

Qinglang Miao <miaoqinglang@huawei.com>
    ACPI: configfs: add missing check after configfs_register_default_group()

Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    ACPI: property: Fix fwnode string properties matching

Mikulas Patocka <mpatocka@redhat.com>
    blk-settings: align max_sectors on "logical_block_size" boundary

Randy Dunlap <rdunlap@infradead.org>
    scsi: bnx2fc: Fix Kconfig warning & CNIC build errors

Miaohe Lin <linmiaohe@huawei.com>
    mm/rmap: fix potential pte_unmap on an not mapped pte

Maxime Ripard <maxime@cerno.tech>
    i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition

Marc Zyngier <maz@kernel.org>
    arm64: Add missing ISB after invalidating TLB in __primary_switch

Heiner Kallweit <hkallweit1@gmail.com>
    r8169: fix jumbo packet handling on RTL8168e

Miaohe Lin <linmiaohe@huawei.com>
    mm/hugetlb: fix potential double free in hugetlb_register_node() error path

Miaohe Lin <linmiaohe@huawei.com>
    mm/memory.c: fix potential pte_unmap_unlock pte error

Dan Carpenter <dan.carpenter@oracle.com>
    ocfs2: fix a use after free on error

Taehee Yoo <ap420073@gmail.com>
    vxlan: move debug check after netdev unregister

Chuhong Yuan <hslester96@gmail.com>
    net/mlx4_core: Add missed mlx4_free_cmd_mailbox()

Mateusz Palczewski <mateusz.palczewski@intel.com>
    i40e: Fix add TC filter for IPv6

Jann Horn <jannh@google.com>
    Take mmap lock in cacheflush syscall

Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
    i40e: Fix VFs not created

Mateusz Palczewski <mateusz.palczewski@intel.com>
    i40e: Fix overwriting flow control settings during driver loading

Mateusz Palczewski <mateusz.palczewski@intel.com>
    i40e: Add zero-initialization of AQ command structures

Slawomir Laba <slawomirx.laba@intel.com>
    i40e: Fix flow for IPv6 next header (extension header)

Bard Liao <yung-chuan.liao@linux.intel.com>
    regmap: sdw: use _no_pm functions in regmap_read/write

Theodore Ts'o <tytso@mit.edu>
    ext4: fix potential htree index checksum corruption

Konrad Dybcio <konrad.dybcio@somainline.org>
    drm/msm/dsi: Correct io_start for MSM8994 (20nm PHY)

Heiner Kallweit <hkallweit1@gmail.com>
    PCI: Align checking of syscall user config accessors

Jorgen Hansen <jhansen@vmware.com>
    VMCI: Use set_page_dirty_lock() when unregistering guest memory

Simon South <simon@simonsouth.net>
    pwm: rockchip: rockchip_pwm_probe(): Remove superfluous clk_unprepare()

Aswath Govindraju <a-govindraju@ti.com>
    misc: eeprom_93xx46: Add module alias to avoid breaking support for non device tree users

Aswath Govindraju <a-govindraju@ti.com>
    misc: eeprom_93xx46: Fix module alias to enable module autoprobe

Randy Dunlap <rdunlap@infradead.org>
    sparc64: only select COMPAT_BINFMT_ELF if BINFMT_ELF is set

Dan Carpenter <dan.carpenter@oracle.com>
    Input: elo - fix an error code in elo_connect()

Namhyung Kim <namhyung@kernel.org>
    perf test: Fix unaligned access in sample parsing test

Adrian Hunter <adrian.hunter@intel.com>
    perf intel-pt: Fix missing CYC processing in PSB

Dan Carpenter <dan.carpenter@oracle.com>
    Input: sur40 - fix an error code in sur40_probe()

Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    spi: pxa2xx: Fix the controller numbering for Wildcat Point

AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
    clk: qcom: gcc-msm8998: Fix Alpha PLL type for all GPLLs

Christophe Leroy <christophe.leroy@csgroup.eu>
    powerpc/8xx: Fix software emulation interrupt

Nathan Lynch <nathanl@linux.ibm.com>
    powerpc/pseries/dlpar: handle ibm, configure-connector delay status

Dan Carpenter <dan.carpenter@oracle.com>
    mfd: wm831x-auxadc: Prevent use after free in wm831x_auxadc_read_irq()

Alain Volmat <alain.volmat@foss.st.com>
    spi: stm32: properly handle 0 byte transfer

Bob Pearson <rpearsonhpe@gmail.com>
    RDMA/rxe: Correct skb on loopback path

Bob Pearson <rpearsonhpe@gmail.com>
    RDMA/rxe: Fix coding error in rxe_recv.c

Arnaldo Carvalho de Melo <acme@redhat.com>
    perf tools: Fix DSO filtering when not finding a map for a sampled address

Steven Rostedt (VMware) <rostedt@goodmis.org>
    tracepoint: Do not fail unregistering a probe due to memory failure

Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    amba: Fix resource leak for drivers without .remove

Vladimir Murzin <vladimir.murzin@arm.com>
    ARM: 9046/1: decompressor: Do not clear SCTLR.nTLSMD for ARMv7+ cores

Takeshi Saito <takeshi.saito.xv@renesas.com>
    mmc: renesas_sdhi_internal_dmac: Fix DMA buffer alignment from 8 to 128-bytes

Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    mmc: usdhi6rol0: Fix a resource leak in the error handling path of the probe

Christophe Leroy <christophe.leroy@csgroup.eu>
    powerpc/47x: Disable 256k page size

Cédric Le Goater <clg@kaod.org>
    KVM: PPC: Make the VMX instruction emulation routines static

Shay Drory <shayd@nvidia.com>
    IB/umad: Return EPOLLERR in case of when device disassociated

Shay Drory <shayd@nvidia.com>
    IB/umad: Return EIO in case of when device disassociated

Geert Uytterhoeven <geert@linux-m68k.org>
    auxdisplay: ht16k33: Fix refresh rate handling

Pan Bian <bianpan2016@163.com>
    isofs: release buffer head before return

Krzysztof Kozlowski <krzk@kernel.org>
    regulator: s5m8767: Drop regulators OF node reference

Pan Bian <bianpan2016@163.com>
    spi: atmel: Put allocated master before return

David Howells <dhowells@redhat.com>
    certs: Fix blacklist flag type confusion

Pan Bian <bianpan2016@163.com>
    regulator: axp20x: Fix reference cout leak

Andre Przywara <andre.przywara@arm.com>
    clk: sunxi-ng: h6: Fix clock divider range on some clocks

Yishai Hadas <yishaih@nvidia.com>
    RDMA/mlx5: Use the correct obj_id upon DEVX TIR creation

Tom Rix <trix@redhat.com>
    clocksource/drivers/mxs_timer: Add missing semicolon when DEBUG is defined

Bartosz Golaszewski <bgolaszewski@baylibre.com>
    rtc: s5m: select REGMAP_I2C

Claudiu Beznea <claudiu.beznea@microchip.com>
    power: reset: at91-sama5d2_shdwc: fix wkupdbc mask

Nicolas Boichat <drinkcat@chromium.org>
    of/fdt: Make sure no-map does not remove already reserved regions

KarimAllah Ahmed <karahmed@amazon.de>
    fdt: Properly handle "no-map" field in the memory region

Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    mfd: bd9571mwv: Use devm_mfd_add_devices()

Ferry Toth <ftoth@exalondelft.nl>
    dmaengine: hsu: disable spurious interrupt

Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    dmaengine: owl-dma: Fix a resource leak in the remove function

Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    dmaengine: fsldma: Fix a resource leak in an error handling path of the probe function

Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    dmaengine: fsldma: Fix a resource leak in the remove function

Randy Dunlap <rdunlap@infradead.org>
    HID: core: detect and skip invalid inputs to snto32()

Andre Przywara <andre.przywara@arm.com>
    clk: sunxi-ng: h6: Fix CEC clock

Pratyush Yadav <p.yadav@ti.com>
    spi: cadence-quadspi: Abort read if dummy cycles required are too many

Jan Kara <jack@suse.cz>
    quota: Fix memory leak when handling corrupted quota file

Martin Blumenstingl <martin.blumenstingl@googlemail.com>
    clk: meson: clk-pll: fix initializing the old rate (fallback) for a PLL

Eric W. Biederman <ebiederm@xmission.com>
    capabilities: Don't allow writing ambiguous v3 file capabilities

Tom Rix <trix@redhat.com>
    jffs2: fix use after free in jffs2_sum_write_data()

Colin Ian King <colin.king@canonical.com>
    fs/jfs: fix potential integer overflow on shift of a int

Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
    ima: Free IMA measurement buffer after kexec syscall

Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
    ima: Free IMA measurement buffer on error

Daniele Alessandrelli <daniele.alessandrelli@intel.com>
    crypto: ecdh_helper - Ensure 'len >= secret.len' in decode_key()

Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de>
    hwrng: timeriomem - Fix cooldown period calculation

Zhihao Cheng <chengzhihao1@huawei.com>
    btrfs: clarify error returns values in __load_free_space_cache

Andrea Parri (Microsoft) <parri.andrea@gmail.com>
    Drivers: hv: vmbus: Avoid use-after-free in vmbus_onoffer_rescind()

Dan Carpenter <dan.carpenter@oracle.com>
    drm/amdgpu: Prevent shift wrapping in amdgpu_read_mask()

Yi Chen <chenyi77@huawei.com>
    f2fs: fix to avoid inconsistent quota data

Sebastian Reichel <sre@kernel.org>
    ASoC: cpcap: fix microphone timeslot mask

Florian Fainelli <f.fainelli@gmail.com>
    ata: ahci_brcm: Add back regulators management

Christophe Leroy <christophe.leroy@csgroup.eu>
    crypto: talitos - Work around SEC6 ERRATA (AES-CTR mode data size error)

Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    media: uvcvideo: Accept invalid bFormatIndex and bFrameIndex values

Tom Rix <trix@redhat.com>
    media: pxa_camera: declare variable when DEBUG is defined

Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    media: cx25821: Fix a bug when reallocating some dma memory

Luo Meng <luomeng12@huawei.com>
    media: qm1d1c0042: fix error return code in qm1d1c0042_init()

Joe Perches <joe@perches.com>
    media: lmedm04: Fix misuse of comma

Mario Kleiner <mario.kleiner.de@gmail.com>
    drm/amd/display: Fix 10/12 bpc setup in DCE output bit depth reduction.

Jiri Olsa <jolsa@kernel.org>
    crypto: bcm - Rename struct device_private to bcm_device_private

Dan Carpenter <dan.carpenter@oracle.com>
    ASoC: cs42l56: fix up error handling in probe

Dinghao Liu <dinghao.liu@zju.edu.cn>
    media: tm6000: Fix memleak in tm6000_start_stream

Dinghao Liu <dinghao.liu@zju.edu.cn>
    media: media/pci: Fix memleak in empress_init

Dinghao Liu <dinghao.liu@zju.edu.cn>
    media: em28xx: Fix use-after-free in em28xx_alloc_urbs

Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    media: vsp1: Fix an error handling path in the probe function

Dan Carpenter <dan.carpenter@oracle.com>
    media: camss: missing error code in msm_video_register()

Jacopo Mondi <jacopo@jmondi.org>
    media: i2c: ov5670: Fix PIXEL_RATE minimum value

Nathan Chancellor <natechancellor@gmail.com>
    MIPS: lantiq: Explicitly compare LTQ_EBU_PCC_ISTAT against 0

Nathan Chancellor <natechancellor@gmail.com>
    MIPS: c-r4k: Fix section mismatch for loongson2_sc_init

Chenyang Li <lichenyang@loongson.cn>
    drm/amdgpu: Fix macro name _AMDGPU_TRACE_H_ in preprocessor if condition

Corentin Labbe <clabbe@baylibre.com>
    crypto: sun4i-ss - fix kmap usage

Dan Carpenter <dan.carpenter@oracle.com>
    gma500: clean up error handling in init

Jialin Zhang <zhangjialin11@huawei.com>
    drm/gma500: Fix error return code in psb_driver_load()

Randy Dunlap <rdunlap@infradead.org>
    fbdev: aty: SPARC64 requires FB_ATY_CT

Maxime Chevallier <maxime.chevallier@bootlin.com>
    net: mvneta: Remove per-cpu queue mapping for Armada 3700

Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
    net: amd-xgbe: Fix network fluctuations when using 1G BELFUSE SFP

Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
    net: amd-xgbe: Reset link when the link never comes back

Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
    net: amd-xgbe: Fix NETDEV WATCHDOG transmit queue timeout warning

Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
    net: amd-xgbe: Reset the PHY rx data path when mailbox command timeout

Lijun Pan <ljp@linux.ibm.com>
    ibmvnic: skip send_request_unmap for timeout reset

Lijun Pan <ljp@linux.ibm.com>
    ibmvnic: add memory barrier to protect long term buffer

Colin Ian King <colin.king@canonical.com>
    b43: N-PHY: Fix the update of coef for the PHY revision >= 3case

Ayush Sawal <ayush.sawal@chelsio.com>
    cxgb4/chtls/cxgbit: Keeping the max ofld immediate data size same in cxgb4 and ulds

Eric Dumazet <edumazet@google.com>
    tcp: fix SO_RCVLOWAT related hangs under mem pressure

Jesper Dangaard Brouer <brouer@redhat.com>
    bpf: Fix bpf_fib_lookup helper MTU check for SKB ctx

Colin Ian King <colin.king@canonical.com>
    mac80211: fix potential overflow when multiplying to u32 integers

Juergen Gross <jgross@suse.com>
    xen/netback: fix spurious event detection for common event case

Edwin Peer <edwin.peer@broadcom.com>
    bnxt_en: reverse order of TX disable and carrier off

Sukadev Bhattiprolu <sukadev@linux.ibm.com>
    ibmvnic: Set to CLOSED state even on error

Linus Lüssing <ll@simonwunderlich.de>
    ath9k: fix data bus crash when setting nf_override via debugfs

Marco Elver <elver@google.com>
    bpf_lru_list: Read double-checked variable once without lock

Jae Hyun Yoo <jae.hyun.yoo@intel.com>
    soc: aspeed: snoop: Add clock control logic

Arnd Bergmann <arnd@arndb.de>
    ARM: s3c: fix fiq for clang IAS

Vincent Knecht <vincent.knecht@mailoo.org>
    arm64: dts: msm8916: Fix reserved and rfsa nodes unit address

Rosen Penev <rosenp@gmail.com>
    ARM: dts: armada388-helios4: assign pinctrl to each fan

Rosen Penev <rosenp@gmail.com>
    ARM: dts: armada388-helios4: assign pinctrl to LEDs

Chen-Yu Tsai <wens@csie.org>
    staging: rtl8723bs: wifi_regd.c: Fix incorrect number of regulatory rules

Guenter Roeck <linux@roeck-us.net>
    usb: dwc2: Make "trimming xfer length" a debug message

Guenter Roeck <linux@roeck-us.net>
    usb: dwc2: Abort transaction after errors with unknown reason

Guenter Roeck <linux@roeck-us.net>
    usb: dwc2: Do not update data length if it is 0 on inbound transfers

Tony Lindgren <tony@atomide.com>
    ARM: dts: Configure missing thermal interrupt for 4430

Pan Bian <bianpan2016@163.com>
    memory: ti-aemif: Drop child node when jumping out loop

Pan Bian <bianpan2016@163.com>
    Bluetooth: Put HCI device if inquiry procedure interrupts

Pan Bian <bianpan2016@163.com>
    Bluetooth: drop HCI device reference before return

Jack Pham <jackp@codeaurora.org>
    usb: gadget: u_audio: Free requests only after callback

Maximilian Luz <luzmaximilian@gmail.com>
    ACPICA: Fix exception code class checks

Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    cpufreq: brcmstb-avs-cpufreq: Fix resource leaks in ->remove()

Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    cpufreq: brcmstb-avs-cpufreq: Free resources in error path

Andre Przywara <andre.przywara@arm.com>
    arm64: dts: allwinner: A64: Limit MMC2 bus frequency to 150 MHz

Andre Przywara <andre.przywara@arm.com>
    arm64: dts: allwinner: Drop non-removable from SoPine/LTS SD card

Andre Przywara <andre.przywara@arm.com>
    arm64: dts: allwinner: A64: properly connect USB PHY to port 0

Andrii Nakryiko <andrii@kernel.org>
    bpf: Avoid warning when re-casting __bpf_call_base into __bpf_call_base_args

Krzysztof Kozlowski <krzk@kernel.org>
    arm64: dts: exynos: correct PMIC interrupt trigger level on Espresso

Krzysztof Kozlowski <krzk@kernel.org>
    arm64: dts: exynos: correct PMIC interrupt trigger level on TM2

Krzysztof Kozlowski <krzk@kernel.org>
    ARM: dts: exynos: correct PMIC interrupt trigger level on Odroid XU3 family

Krzysztof Kozlowski <krzk@kernel.org>
    ARM: dts: exynos: correct PMIC interrupt trigger level on Arndale Octa

Krzysztof Kozlowski <krzk@kernel.org>
    ARM: dts: exynos: correct PMIC interrupt trigger level on Spring

Krzysztof Kozlowski <krzk@kernel.org>
    ARM: dts: exynos: correct PMIC interrupt trigger level on Rinato

Krzysztof Kozlowski <krzk@kernel.org>
    ARM: dts: exynos: correct PMIC interrupt trigger level on Monk

Krzysztof Kozlowski <krzk@kernel.org>
    ARM: dts: exynos: correct PMIC interrupt trigger level on Artik 5

Christopher William Snowhill <chris@kode54.net>
    Bluetooth: Fix initializing response id after clearing struct

Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Bluetooth: btqcomsmd: Fix a resource leak in error handling paths in the probe function

Rakesh Pillai <pillair@codeaurora.org>
    ath10k: Fix error handling in case of CE pipe init failure

Eric Biggers <ebiggers@google.com>
    random: fix the RNDRESEEDCRNG ioctl

Alexander Lobakin <alobakin@pm.me>
    MIPS: vmlinux.lds.S: add missing PAGE_ALIGNED_DATA() section

Takashi Iwai <tiwai@suse.de>
    ALSA: usb-audio: Fix PCM buffer allocation in non-vmalloc mode

Jan Kara <jack@suse.cz>
    bfq: Avoid false bfq queue merging

Ansuel Smith <ansuelsmth@gmail.com>
    PCI: qcom: Use PHY_REFCLK_USE_PAD only for ipq8064

Sumit Garg <sumit.garg@linaro.org>
    kdb: Make memory allocations more robust

Nick Desaulniers <ndesaulniers@google.com>
    vmlinux.lds.h: add DWARF v5 sections

Peter Zijlstra <peterz@infradead.org>
    locking/static_key: Fix false positive warnings on concurrent dec/inc

Peter Zijlstra <peterz@infradead.org>
    jump_label/lockdep: Assert we hold the hotplug lock for _cpuslocked() operations

Rong Chen <rong.a.chen@intel.com>
    scripts/recordmcount.pl: support big endian for ARCH sh

Shyam Prasad N <sprasad@microsoft.com>
    cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.

Christoph Schemmel <christoph.schemmel@gmail.com>
    NET: usb: qmi_wwan: Adding support for Cinterion MV31

Ming Lei <ming.lei@redhat.com>
    block: don't release queue's sysfs lock during switching elevator

Ming Lei <ming.lei@redhat.com>
    block: fix race between switching elevator and removing queues

Ming Lei <ming.lei@redhat.com>
    block: split .sysfs_lock into two locks

Ming Lei <ming.lei@redhat.com>
    block: add helper for checking if queue is registered

Rolf Eike Beer <eb@emlix.com>
    scripts: set proper OpenSSL include dir also for sign-file

Rolf Eike Beer <eb@emlix.com>
    scripts: use pkg-config to locate libcrypto

Sameer Pujar <spujar@nvidia.com>
    arm64: tegra: Add power-domain for Tegra210 HDA

Rustam Kovhaev <rkovhaev@gmail.com>
    ntfs: check for valid standard information attribute

Stefan Ursella <stefan.ursella@wolfvision.net>
    usb: quirks: add quirk to start video capture on ELMO L-12F document camera reliable

Johan Hovold <johan@kernel.org>
    USB: quirks: sort quirk entries

Will McVicker <willmcvicker@google.com>
    HID: make arrays usage and value to be the same


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

Diffstat:

 Documentation/filesystems/seq_file.txt             |   6 +
 Makefile                                           |   4 +-
 arch/arm/boot/compressed/head.S                    |   4 +-
 arch/arm/boot/dts/armada-388-helios4.dts           |  28 +++-
 arch/arm/boot/dts/exynos3250-artik5.dtsi           |   2 +-
 arch/arm/boot/dts/exynos3250-monk.dts              |   2 +-
 arch/arm/boot/dts/exynos3250-rinato.dts            |   2 +-
 arch/arm/boot/dts/exynos5250-spring.dts            |   2 +-
 arch/arm/boot/dts/exynos5420-arndale-octa.dts      |   2 +-
 arch/arm/boot/dts/exynos5422-odroid-core.dtsi      |   2 +-
 arch/arm/boot/dts/omap443x.dtsi                    |   2 +
 arch/arm64/Kconfig                                 |   2 +-
 .../boot/dts/allwinner/sun50i-a64-pinebook.dts     |   5 +-
 .../boot/dts/allwinner/sun50i-a64-sopine.dtsi      |   1 -
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi      |   6 +-
 .../boot/dts/exynos/exynos5433-tm2-common.dtsi     |   2 +-
 arch/arm64/boot/dts/exynos/exynos7-espresso.dts    |   2 +-
 arch/arm64/boot/dts/mediatek/mt7622.dtsi           |   2 +
 arch/arm64/boot/dts/nvidia/tegra210.dtsi           |   1 +
 arch/arm64/boot/dts/qcom/msm8916.dtsi              |   4 +-
 arch/arm64/crypto/sha1-ce-glue.c                   |   1 +
 arch/arm64/crypto/sha2-ce-glue.c                   |   2 +
 arch/arm64/crypto/sha3-ce-glue.c                   |   4 +
 arch/arm64/crypto/sha512-ce-glue.c                 |   2 +
 arch/arm64/kernel/cpufeature.c                     |   2 +-
 arch/arm64/kernel/head.S                           |   1 +
 arch/arm64/kernel/probes/uprobes.c                 |   2 +-
 arch/mips/kernel/vmlinux.lds.S                     |   1 +
 arch/mips/lantiq/irq.c                             |   2 +-
 arch/mips/mm/c-r4k.c                               |   2 +-
 arch/nios2/kernel/sys_nios2.c                      |  11 +-
 arch/powerpc/Kconfig                               |   2 +-
 arch/powerpc/kernel/head_8xx.S                     |   2 +-
 arch/powerpc/kvm/powerpc.c                         |   8 +-
 arch/powerpc/platforms/pseries/dlpar.c             |   7 +-
 arch/sparc/Kconfig                                 |   2 +-
 arch/sparc/lib/memset.S                            |   1 +
 arch/x86/kernel/reboot.c                           |  29 ++--
 arch/x86/mm/pat.c                                  |   3 +-
 block/bfq-iosched.c                                |   1 +
 block/blk-core.c                                   |   1 +
 block/blk-mq-sysfs.c                               |  12 +-
 block/blk-settings.c                               |  12 ++
 block/blk-sysfs.c                                  |  49 ++++---
 block/blk-wbt.c                                    |   2 +-
 block/blk.h                                        |   2 +-
 block/elevator.c                                   |  30 ++--
 certs/blacklist.c                                  |   2 +-
 crypto/ecdh_helper.c                               |   3 +
 drivers/acpi/acpi_configfs.c                       |   7 +-
 drivers/acpi/property.c                            |  44 ++++--
 drivers/amba/bus.c                                 |  20 +--
 drivers/ata/ahci_brcm.c                            |  14 +-
 drivers/auxdisplay/ht16k33.c                       |   3 +-
 drivers/base/regmap/regmap-sdw.c                   |   4 +-
 drivers/block/floppy.c                             |  27 ++--
 drivers/bluetooth/btqcomsmd.c                      |  27 ++--
 drivers/char/hw_random/timeriomem-rng.c            |   2 +-
 drivers/char/random.c                              |   2 +-
 drivers/char/tpm/tpm_tis_core.c                    |  50 +------
 drivers/clk/meson/clk-pll.c                        |   2 +-
 drivers/clk/qcom/gcc-msm8998.c                     | 100 ++++++-------
 drivers/clk/sunxi-ng/ccu-sun50i-h6.c               |  10 +-
 drivers/clocksource/mxs_timer.c                    |   5 +-
 drivers/cpufreq/brcmstb-avs-cpufreq.c              |  24 +++-
 drivers/cpufreq/intel_pstate.c                     |   5 +-
 drivers/crypto/bcm/cipher.c                        |   2 +-
 drivers/crypto/bcm/cipher.h                        |   4 +-
 drivers/crypto/bcm/util.c                          |   2 +-
 drivers/crypto/chelsio/chtls/chtls_cm.h            |   3 -
 drivers/crypto/sunxi-ss/sun4i-ss-cipher.c          | 159 +++++++++++++--------
 drivers/crypto/talitos.c                           |  28 ++--
 drivers/crypto/talitos.h                           |   1 +
 drivers/dma/fsldma.c                               |   6 +
 drivers/dma/hsu/pci.c                              |  21 +--
 drivers/dma/owl-dma.c                              |   1 +
 drivers/gpio/gpio-pcf857x.c                        |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |   6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h          |   2 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.c |   8 +-
 drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c         |  22 +--
 drivers/gpu/drm/gma500/psb_drv.c                   |   2 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c         |   2 +-
 drivers/hid/hid-core.c                             |   9 +-
 drivers/hid/wacom_wac.c                            |   7 +-
 drivers/hv/channel_mgmt.c                          |   3 +-
 drivers/i2c/busses/i2c-brcmstb.c                   |   2 +-
 drivers/infiniband/core/user_mad.c                 |  17 ++-
 drivers/infiniband/hw/mlx5/devx.c                  |   4 +-
 drivers/infiniband/sw/rxe/rxe_net.c                |   5 +
 drivers/infiniband/sw/rxe/rxe_recv.c               |  11 +-
 drivers/input/joydev.c                             |   7 +-
 drivers/input/joystick/xpad.c                      |   1 +
 drivers/input/serio/i8042-x86ia64io.h              |   4 +
 drivers/input/touchscreen/elo.c                    |   4 +-
 drivers/input/touchscreen/raydium_i2c_ts.c         |   3 +-
 drivers/input/touchscreen/sur40.c                  |   1 +
 drivers/md/dm-core.h                               |   4 +
 drivers/md/dm-crypt.c                              |   1 +
 drivers/md/dm-era-target.c                         |  93 +++++++-----
 drivers/md/dm.c                                    |  60 ++++++++
 drivers/media/i2c/ov5670.c                         |   3 +-
 drivers/media/pci/cx25821/cx25821-core.c           |   4 +-
 drivers/media/pci/intel/ipu3/ipu3-cio2.c           |   2 +-
 drivers/media/pci/saa7134/saa7134-empress.c        |   5 +-
 drivers/media/platform/pxa_camera.c                |   3 +
 drivers/media/platform/qcom/camss/camss-video.c    |   1 +
 drivers/media/platform/vsp1/vsp1_drv.c             |   4 +-
 drivers/media/tuners/qm1d1c0042.c                  |   4 +-
 drivers/media/usb/dvb-usb-v2/lmedm04.c             |   2 +-
 drivers/media/usb/em28xx/em28xx-core.c             |   6 +-
 drivers/media/usb/tm6000/tm6000-dvb.c              |   4 +
 drivers/media/usb/uvc/uvc_v4l2.c                   |  18 +--
 drivers/memory/ti-aemif.c                          |   8 +-
 drivers/mfd/bd9571mwv.c                            |   6 +-
 drivers/mfd/wm831x-auxadc.c                        |   3 +-
 drivers/misc/aspeed-lpc-snoop.c                    |  30 +++-
 drivers/misc/cardreader/rts5227.c                  |   5 +
 drivers/misc/eeprom/eeprom_93xx46.c                |   1 +
 drivers/misc/vmw_vmci/vmci_queue_pair.c            |   5 +-
 drivers/mmc/host/renesas_sdhi_internal_dmac.c      |   4 +-
 drivers/mmc/host/sdhci-esdhc-imx.c                 |   3 +-
 drivers/mmc/host/usdhi6rol0.c                      |   4 +-
 drivers/mtd/spi-nor/cadence-quadspi.c              |   2 +-
 drivers/mtd/spi-nor/hisi-sfc.c                     |   4 +-
 drivers/net/ethernet/amd/xgbe/xgbe-common.h        |  14 ++
 drivers/net/ethernet/amd/xgbe/xgbe-drv.c           |   1 +
 drivers/net/ethernet/amd/xgbe/xgbe-mdio.c          |   3 +-
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c        |  39 ++++-
 drivers/net/ethernet/broadcom/bnxt/bnxt.c          |   3 +-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h     |   3 +
 drivers/net/ethernet/chelsio/cxgb4/sge.c           |  11 +-
 drivers/net/ethernet/ibm/ibmvnic.c                 |  16 ++-
 drivers/net/ethernet/intel/i40e/i40e_main.c        |  41 ++----
 drivers/net/ethernet/intel/i40e/i40e_txrx.c        |   9 +-
 drivers/net/ethernet/marvell/mvneta.c              |   9 +-
 .../net/ethernet/mellanox/mlx4/resource_tracker.c  |   1 +
 drivers/net/ethernet/realtek/r8169.c               |   4 +-
 drivers/net/ethernet/sun/sunvnet_common.c          |  23 +--
 drivers/net/gtp.c                                  |   5 +-
 drivers/net/usb/qmi_wwan.c                         |   1 +
 drivers/net/vxlan.c                                |  11 +-
 drivers/net/wireless/ath/ath10k/snoc.c             |   5 +-
 drivers/net/wireless/ath/ath9k/debug.c             |   5 +-
 drivers/net/wireless/broadcom/b43/phy_n.c          |   2 +-
 drivers/net/xen-netback/interface.c                |   8 +-
 drivers/nvdimm/dimm_devs.c                         |  18 ++-
 drivers/of/fdt.c                                   |  12 +-
 drivers/pci/controller/dwc/pcie-qcom.c             |   4 +-
 drivers/pci/syscall.c                              |  10 +-
 drivers/power/reset/at91-sama5d2_shdwc.c           |   2 +-
 drivers/pwm/pwm-rockchip.c                         |   1 -
 drivers/regulator/axp20x-regulator.c               |   7 +-
 drivers/regulator/s5m8767.c                        |   8 +-
 drivers/rtc/Kconfig                                |   1 +
 drivers/scsi/bnx2fc/Kconfig                        |   1 +
 drivers/spi/spi-atmel.c                            |   2 +-
 drivers/spi/spi-pxa2xx-pci.c                       |  27 ++--
 drivers/spi/spi-s3c24xx-fiq.S                      |   9 +-
 drivers/spi/spi-stm32.c                            |   4 +
 drivers/staging/gdm724x/gdm_usb.c                  |  10 +-
 drivers/staging/mt7621-dma/Makefile                |   2 +-
 .../mt7621-dma/{mtk-hsdma.c => hsdma-mt7621.c}     |   2 +-
 drivers/staging/rtl8188eu/os_dep/usb_intf.c        |   1 +
 drivers/staging/rtl8723bs/os_dep/wifi_regd.c       |   2 +-
 drivers/target/iscsi/cxgbit/cxgbit_target.c        |   3 +-
 drivers/usb/core/quirks.c                          |   9 +-
 drivers/usb/dwc2/hcd.c                             |  15 +-
 drivers/usb/dwc2/hcd_intr.c                        |  14 +-
 drivers/usb/dwc3/gadget.c                          |  19 ++-
 drivers/usb/gadget/function/u_audio.c              |  17 ++-
 drivers/usb/musb/musb_core.c                       |  31 ++--
 drivers/usb/serial/ftdi_sio.c                      |   5 +-
 drivers/usb/serial/mos7720.c                       |   4 +-
 drivers/usb/serial/mos7840.c                       |   4 +-
 drivers/usb/serial/option.c                        |   3 +-
 drivers/video/fbdev/Kconfig                        |   2 +-
 drivers/watchdog/mei_wdt.c                         |   1 +
 fs/affs/namei.c                                    |   4 +-
 fs/btrfs/ctree.c                                   |   7 +-
 fs/btrfs/free-space-cache.c                        |   6 +-
 fs/btrfs/relocation.c                              |   4 +-
 fs/cifs/connect.c                                  |   1 +
 fs/ext4/namei.c                                    |   7 +-
 fs/f2fs/file.c                                     |   7 +-
 fs/f2fs/inline.c                                   |   4 +
 fs/gfs2/lock_dlm.c                                 |   8 +-
 fs/isofs/dir.c                                     |   1 +
 fs/isofs/namei.c                                   |   1 +
 fs/jffs2/summary.c                                 |   3 +
 fs/jfs/jfs_dmap.c                                  |   2 +-
 fs/ntfs/inode.c                                    |   6 +
 fs/ocfs2/cluster/heartbeat.c                       |   8 +-
 fs/pstore/platform.c                               |   4 +-
 fs/quota/quota_v2.c                                |  11 +-
 include/acpi/acexcep.h                             |  10 +-
 include/asm-generic/vmlinux.lds.h                  |   7 +-
 include/linux/blkdev.h                             |   2 +
 include/linux/device-mapper.h                      |   5 +
 include/linux/filter.h                             |   2 +-
 include/linux/icmpv6.h                             |  44 +++++-
 include/linux/ipv6.h                               |   2 +-
 include/linux/kexec.h                              |   5 +
 include/linux/key.h                                |   1 +
 include/linux/rmap.h                               |   3 +-
 include/net/icmp.h                                 |  10 ++
 include/net/tcp.h                                  |   9 +-
 kernel/bpf/bpf_lru_list.c                          |   7 +-
 kernel/debug/kdb/kdb_private.h                     |   2 +-
 kernel/jump_label.c                                |  26 ++--
 kernel/kexec_file.c                                |   5 +
 kernel/module.c                                    |  21 ++-
 kernel/printk/printk_safe.c                        |  16 ++-
 kernel/seccomp.c                                   |   2 +
 kernel/tracepoint.c                                |  80 ++++++++---
 mm/hugetlb.c                                       |   4 +-
 mm/memory.c                                        |  16 ++-
 net/bluetooth/a2mp.c                               |   3 +-
 net/bluetooth/hci_core.c                           |   6 +-
 net/core/filter.c                                  |  13 +-
 net/ipv4/icmp.c                                    |  34 +++++
 net/ipv6/icmp.c                                    |  19 +--
 net/ipv6/ip6_icmp.c                                |  46 +++++-
 net/mac80211/mesh_hwmp.c                           |   2 +-
 net/qrtr/tun.c                                     |  12 +-
 net/xfrm/xfrm_interface.c                          |   6 +-
 scripts/Makefile                                   |   9 +-
 scripts/recordmcount.pl                            |   6 +-
 security/commoncap.c                               |  12 +-
 security/integrity/ima/ima_kexec.c                 |   3 +
 security/integrity/ima/ima_mok.c                   |   5 +-
 security/keys/key.c                                |   2 +
 security/keys/trusted.c                            |   2 +-
 sound/pci/hda/patch_realtek.c                      |  11 ++
 sound/soc/codecs/cpcap.c                           |  12 +-
 sound/soc/codecs/cs42l56.c                         |   3 +-
 sound/usb/pcm.c                                    |   2 +-
 tools/perf/tests/sample-parsing.c                  |   2 +-
 tools/perf/util/event.c                            |   2 +
 .../perf/util/intel-pt-decoder/intel-pt-decoder.c  |   3 +
 240 files changed, 1568 insertions(+), 737 deletions(-)



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

* [PATCH 4.19 001/247] HID: make arrays usage and value to be the same
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 002/247] USB: quirks: sort quirk entries Greg Kroah-Hartman
                   ` (248 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Will McVicker, Jiri Kosina

From: Will McVicker <willmcvicker@google.com>

commit ed9be64eefe26d7d8b0b5b9fa3ffdf425d87a01f upstream.

The HID subsystem allows an "HID report field" to have a different
number of "values" and "usages" when it is allocated. When a field
struct is created, the size of the usage array is guaranteed to be at
least as large as the values array, but it may be larger. This leads to
a potential out-of-bounds write in
__hidinput_change_resolution_multipliers() and an out-of-bounds read in
hidinput_count_leds().

To fix this, let's make sure that both the usage and value arrays are
the same size.

Cc: stable@vger.kernel.org
Signed-off-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hid/hid-core.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -93,7 +93,7 @@ EXPORT_SYMBOL_GPL(hid_register_report);
  * Register a new field for this report.
  */
 
-static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values)
+static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages)
 {
 	struct hid_field *field;
 
@@ -104,7 +104,7 @@ static struct hid_field *hid_register_fi
 
 	field = kzalloc((sizeof(struct hid_field) +
 			 usages * sizeof(struct hid_usage) +
-			 values * sizeof(unsigned)), GFP_KERNEL);
+			 usages * sizeof(unsigned)), GFP_KERNEL);
 	if (!field)
 		return NULL;
 
@@ -300,7 +300,7 @@ static int hid_add_field(struct hid_pars
 	usages = max_t(unsigned, parser->local.usage_index,
 				 parser->global.report_count);
 
-	field = hid_register_field(report, usages, parser->global.report_count);
+	field = hid_register_field(report, usages);
 	if (!field)
 		return 0;
 



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

* [PATCH 4.19 002/247] USB: quirks: sort quirk entries
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 001/247] HID: make arrays usage and value to be the same Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 003/247] usb: quirks: add quirk to start video capture on ELMO L-12F document camera reliable Greg Kroah-Hartman
                   ` (247 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

From: Johan Hovold <johan@kernel.org>

commit 43861d29c0810a70792bf69d37482efb7bb6677d upstream.

Move the last entry to its proper place to maintain the VID/PID sort
order.

Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20210210111746.13360-1-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/core/quirks.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -415,6 +415,9 @@ static const struct usb_device_id usb_qu
 	{ USB_DEVICE(0x10d6, 0x2200), .driver_info =
 			USB_QUIRK_STRING_FETCH_255 },
 
+	/* novation SoundControl XL */
+	{ USB_DEVICE(0x1235, 0x0061), .driver_info = USB_QUIRK_RESET_RESUME },
+
 	/* Huawei 4G LTE module */
 	{ USB_DEVICE(0x12d1, 0x15bb), .driver_info =
 			USB_QUIRK_DISCONNECT_SUSPEND },
@@ -495,9 +498,6 @@ static const struct usb_device_id usb_qu
 	/* INTEL VALUE SSD */
 	{ USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
 
-	/* novation SoundControl XL */
-	{ USB_DEVICE(0x1235, 0x0061), .driver_info = USB_QUIRK_RESET_RESUME },
-
 	{ }  /* terminating entry must be last */
 };
 



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

* [PATCH 4.19 003/247] usb: quirks: add quirk to start video capture on ELMO L-12F document camera reliable
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 001/247] HID: make arrays usage and value to be the same Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 002/247] USB: quirks: sort quirk entries Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 004/247] ntfs: check for valid standard information attribute Greg Kroah-Hartman
                   ` (246 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Stefan Ursella

From: Stefan Ursella <stefan.ursella@wolfvision.net>

commit 1ebe718bb48278105816ba03a0408ecc2d6cf47f upstream.

Without this quirk starting a video capture from the device often fails with

kernel: uvcvideo: Failed to set UVC probe control : -110 (exp. 34).

Signed-off-by: Stefan Ursella <stefan.ursella@wolfvision.net>
Link: https://lore.kernel.org/r/20210210140713.18711-1-stefan.ursella@wolfvision.net
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/core/quirks.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -391,6 +391,9 @@ static const struct usb_device_id usb_qu
 	/* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */
 	{ USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF },
 
+	/* ELMO L-12F document camera */
+	{ USB_DEVICE(0x09a1, 0x0028), .driver_info = USB_QUIRK_DELAY_CTRL_MSG },
+
 	/* Broadcom BCM92035DGROM BT dongle */
 	{ USB_DEVICE(0x0a5c, 0x2021), .driver_info = USB_QUIRK_RESET_RESUME },
 



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

* [PATCH 4.19 004/247] ntfs: check for valid standard information attribute
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 003/247] usb: quirks: add quirk to start video capture on ELMO L-12F document camera reliable Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 005/247] arm64: tegra: Add power-domain for Tegra210 HDA Greg Kroah-Hartman
                   ` (245 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Rustam Kovhaev,
	syzbot+c584225dabdea2f71969, Anton Altaparmakov, Andrew Morton,
	Linus Torvalds

From: Rustam Kovhaev <rkovhaev@gmail.com>

commit 4dfe6bd94959222e18d512bdf15f6bf9edb9c27c upstream.

Mounting a corrupted filesystem with NTFS resulted in a kernel crash.

We should check for valid STANDARD_INFORMATION attribute offset and length
before trying to access it

Link: https://lkml.kernel.org/r/20210217155930.1506815-1-rkovhaev@gmail.com
Link: https://syzkaller.appspot.com/bug?extid=c584225dabdea2f71969
Signed-off-by: Rustam Kovhaev <rkovhaev@gmail.com>
Reported-by: syzbot+c584225dabdea2f71969@syzkaller.appspotmail.com
Tested-by: syzbot+c584225dabdea2f71969@syzkaller.appspotmail.com
Acked-by: Anton Altaparmakov <anton@tuxera.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/ntfs/inode.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -654,6 +654,12 @@ static int ntfs_read_locked_inode(struct
 	}
 	a = ctx->attr;
 	/* Get the standard information attribute value. */
+	if ((u8 *)a + le16_to_cpu(a->data.resident.value_offset)
+			+ le32_to_cpu(a->data.resident.value_length) >
+			(u8 *)ctx->mrec + vol->mft_record_size) {
+		ntfs_error(vi->i_sb, "Corrupt standard information attribute in inode.");
+		goto unm_err_out;
+	}
 	si = (STANDARD_INFORMATION*)((u8*)a +
 			le16_to_cpu(a->data.resident.value_offset));
 



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

* [PATCH 4.19 005/247] arm64: tegra: Add power-domain for Tegra210 HDA
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 004/247] ntfs: check for valid standard information attribute Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 006/247] scripts: use pkg-config to locate libcrypto Greg Kroah-Hartman
                   ` (244 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sameer Pujar, Jon Hunter, Thierry Reding

From: Sameer Pujar <spujar@nvidia.com>

commit 1e0ca5467445bc1f41a9e403d6161a22f313dae7 upstream.

HDA initialization is failing occasionally on Tegra210 and following
print is observed in the boot log. Because of this probe() fails and
no sound card is registered.

  [16.800802] tegra-hda 70030000.hda: no codecs found!

Codecs request a state change and enumeration by the controller. In
failure cases this does not seem to happen as STATETS register reads 0.

The problem seems to be related to the HDA codec dependency on SOR
power domain. If it is gated during HDA probe then the failure is
observed. Building Tegra HDA driver into kernel image avoids this
failure but does not completely address the dependency part. Fix this
problem by adding 'power-domains' DT property for Tegra210 HDA. Note
that Tegra186 and Tegra194 HDA do this already.

Fixes: 742af7e7a0a1 ("arm64: tegra: Add Tegra210 support")
Depends-on: 96d1f078ff0 ("arm64: tegra: Add SOR power-domain for Tegra210")
Cc: <stable@vger.kernel.org>
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arm64/boot/dts/nvidia/tegra210.dtsi |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm64/boot/dts/nvidia/tegra210.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra210.dtsi
@@ -826,6 +826,7 @@
 			 <&tegra_car 128>, /* hda2hdmi */
 			 <&tegra_car 111>; /* hda2codec_2x */
 		reset-names = "hda", "hda2hdmi", "hda2codec_2x";
+		power-domains = <&pd_sor>;
 		status = "disabled";
 	};
 



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

* [PATCH 4.19 006/247] scripts: use pkg-config to locate libcrypto
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 005/247] arm64: tegra: Add power-domain for Tegra210 HDA Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 007/247] scripts: set proper OpenSSL include dir also for sign-file Greg Kroah-Hartman
                   ` (243 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Rolf Eike Beer, Masahiro Yamada

From: Rolf Eike Beer <eb@emlix.com>

commit 2cea4a7a1885bd0c765089afc14f7ff0eb77864e upstream.

Otherwise build fails if the headers are not in the default location. While at
it also ask pkg-config for the libs, with fallback to the existing value.

Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Cc: stable@vger.kernel.org # 5.6.x
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 scripts/Makefile |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -10,6 +10,9 @@
 
 HOST_EXTRACFLAGS += -I$(srctree)/tools/include
 
+CRYPTO_LIBS = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto)
+CRYPTO_CFLAGS = $(shell pkg-config --cflags libcrypto 2> /dev/null)
+
 hostprogs-$(CONFIG_BUILD_BIN2C)  += bin2c
 hostprogs-$(CONFIG_KALLSYMS)     += kallsyms
 hostprogs-$(CONFIG_LOGO)         += pnmtologo
@@ -23,8 +26,9 @@ hostprogs-$(CONFIG_SYSTEM_EXTRA_CERTIFIC
 
 HOSTCFLAGS_sortextable.o = -I$(srctree)/tools/include
 HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
-HOSTLDLIBS_sign-file = -lcrypto
-HOSTLDLIBS_extract-cert = -lcrypto
+HOSTLDLIBS_sign-file = $(CRYPTO_LIBS)
+HOSTCFLAGS_extract-cert.o = $(CRYPTO_CFLAGS)
+HOSTLDLIBS_extract-cert = $(CRYPTO_LIBS)
 
 always		:= $(hostprogs-y) $(hostprogs-m)
 



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

* [PATCH 4.19 007/247] scripts: set proper OpenSSL include dir also for sign-file
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (5 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 006/247] scripts: use pkg-config to locate libcrypto Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 008/247] block: add helper for checking if queue is registered Greg Kroah-Hartman
                   ` (242 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Rolf Eike Beer, Masahiro Yamada

From: Rolf Eike Beer <eb@emlix.com>

commit fe968c41ac4f4ec9ffe3c4cf16b72285f5e9674f upstream.

Fixes: 2cea4a7a1885 ("scripts: use pkg-config to locate libcrypto")
Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Cc: stable@vger.kernel.org # 5.6.x
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 scripts/Makefile |    1 +
 1 file changed, 1 insertion(+)

--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -26,6 +26,7 @@ hostprogs-$(CONFIG_SYSTEM_EXTRA_CERTIFIC
 
 HOSTCFLAGS_sortextable.o = -I$(srctree)/tools/include
 HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
+HOSTCFLAGS_sign-file.o = $(CRYPTO_CFLAGS)
 HOSTLDLIBS_sign-file = $(CRYPTO_LIBS)
 HOSTCFLAGS_extract-cert.o = $(CRYPTO_CFLAGS)
 HOSTLDLIBS_extract-cert = $(CRYPTO_LIBS)



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

* [PATCH 4.19 008/247] block: add helper for checking if queue is registered
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (6 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 007/247] scripts: set proper OpenSSL include dir also for sign-file Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 009/247] block: split .sysfs_lock into two locks Greg Kroah-Hartman
                   ` (241 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christoph Hellwig, Hannes Reinecke,
	Mike Snitzer, Bart Van Assche, Ming Lei, Jens Axboe, Jack Wang

From: Ming Lei <ming.lei@redhat.com>

commit 58c898ba370e68d39470cd0d932b524682c1f9be upstream.

There are 4 users which check if queue is registered, so add one helper
to check it.

Cc: Christoph Hellwig <hch@infradead.org>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 block/blk-sysfs.c      |    4 ++--
 block/blk-wbt.c        |    2 +-
 block/elevator.c       |    2 +-
 include/linux/blkdev.h |    1 +
 4 files changed, 5 insertions(+), 4 deletions(-)

--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -896,7 +896,7 @@ int blk_register_queue(struct gendisk *d
 	if (WARN_ON(!q))
 		return -ENXIO;
 
-	WARN_ONCE(test_bit(QUEUE_FLAG_REGISTERED, &q->queue_flags),
+	WARN_ONCE(blk_queue_registered(q),
 		  "%s is registering an already registered queue\n",
 		  kobject_name(&dev->kobj));
 	queue_flag_set_unlocked(QUEUE_FLAG_REGISTERED, q);
@@ -973,7 +973,7 @@ void blk_unregister_queue(struct gendisk
 		return;
 
 	/* Return early if disk->queue was never registered. */
-	if (!test_bit(QUEUE_FLAG_REGISTERED, &q->queue_flags))
+	if (!blk_queue_registered(q))
 		return;
 
 	/*
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -708,7 +708,7 @@ void wbt_enable_default(struct request_q
 		return;
 
 	/* Queue not registered? Maybe shutting down... */
-	if (!test_bit(QUEUE_FLAG_REGISTERED, &q->queue_flags))
+	if (!blk_queue_registered(q))
 		return;
 
 	if ((q->mq_ops && IS_ENABLED(CONFIG_BLK_WBT_MQ)) ||
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -1083,7 +1083,7 @@ static int __elevator_change(struct requ
 	struct elevator_type *e;
 
 	/* Make sure queue is not in the middle of being removed */
-	if (!test_bit(QUEUE_FLAG_REGISTERED, &q->queue_flags))
+	if (!blk_queue_registered(q))
 		return -ENOENT;
 
 	/*
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -743,6 +743,7 @@ bool blk_queue_flag_test_and_clear(unsig
 #define blk_queue_quiesced(q)	test_bit(QUEUE_FLAG_QUIESCED, &(q)->queue_flags)
 #define blk_queue_pm_only(q)	atomic_read(&(q)->pm_only)
 #define blk_queue_fua(q)	test_bit(QUEUE_FLAG_FUA, &(q)->queue_flags)
+#define blk_queue_registered(q)	test_bit(QUEUE_FLAG_REGISTERED, &(q)->queue_flags)
 
 extern void blk_set_pm_only(struct request_queue *q);
 extern void blk_clear_pm_only(struct request_queue *q);



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

* [PATCH 4.19 009/247] block: split .sysfs_lock into two locks
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (7 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 008/247] block: add helper for checking if queue is registered Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 010/247] block: fix race between switching elevator and removing queues Greg Kroah-Hartman
                   ` (240 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christoph Hellwig, Hannes Reinecke,
	Mike Snitzer, Bart Van Assche, Ming Lei, Jens Axboe, Jack Wang

From: Ming Lei <ming.lei@redhat.com>

commit cecf5d87ff2035127bb5a9ee054d0023a4a7cad3 upstream.

The kernfs built-in lock of 'kn->count' is held in sysfs .show/.store
path. Meantime, inside block's .show/.store callback, q->sysfs_lock is
required.

However, when mq & iosched kobjects are removed via
blk_mq_unregister_dev() & elv_unregister_queue(), q->sysfs_lock is held
too. This way causes AB-BA lock because the kernfs built-in lock of
'kn-count' is required inside kobject_del() too, see the lockdep warning[1].

On the other hand, it isn't necessary to acquire q->sysfs_lock for
both blk_mq_unregister_dev() & elv_unregister_queue() because
clearing REGISTERED flag prevents storing to 'queue/scheduler'
from being happened. Also sysfs write(store) is exclusive, so no
necessary to hold the lock for elv_unregister_queue() when it is
called in switching elevator path.

So split .sysfs_lock into two: one is still named as .sysfs_lock for
covering sync .store, the other one is named as .sysfs_dir_lock
for covering kobjects and related status change.

sysfs itself can handle the race between add/remove kobjects and
showing/storing attributes under kobjects. For switching scheduler
via storing to 'queue/scheduler', we use the queue flag of
QUEUE_FLAG_REGISTERED with .sysfs_lock for avoiding the race, then
we can avoid to hold .sysfs_lock during removing/adding kobjects.

[1]  lockdep warning
    ======================================================
    WARNING: possible circular locking dependency detected
    5.3.0-rc3-00044-g73277fc75ea0 #1380 Not tainted
    ------------------------------------------------------
    rmmod/777 is trying to acquire lock:
    00000000ac50e981 (kn->count#202){++++}, at: kernfs_remove_by_name_ns+0x59/0x72

    but task is already holding lock:
    00000000fb16ae21 (&q->sysfs_lock){+.+.}, at: blk_unregister_queue+0x78/0x10b

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #1 (&q->sysfs_lock){+.+.}:
           __lock_acquire+0x95f/0xa2f
           lock_acquire+0x1b4/0x1e8
           __mutex_lock+0x14a/0xa9b
           blk_mq_hw_sysfs_show+0x63/0xb6
           sysfs_kf_seq_show+0x11f/0x196
           seq_read+0x2cd/0x5f2
           vfs_read+0xc7/0x18c
           ksys_read+0xc4/0x13e
           do_syscall_64+0xa7/0x295
           entry_SYSCALL_64_after_hwframe+0x49/0xbe

    -> #0 (kn->count#202){++++}:
           check_prev_add+0x5d2/0xc45
           validate_chain+0xed3/0xf94
           __lock_acquire+0x95f/0xa2f
           lock_acquire+0x1b4/0x1e8
           __kernfs_remove+0x237/0x40b
           kernfs_remove_by_name_ns+0x59/0x72
           remove_files+0x61/0x96
           sysfs_remove_group+0x81/0xa4
           sysfs_remove_groups+0x3b/0x44
           kobject_del+0x44/0x94
           blk_mq_unregister_dev+0x83/0xdd
           blk_unregister_queue+0xa0/0x10b
           del_gendisk+0x259/0x3fa
           null_del_dev+0x8b/0x1c3 [null_blk]
           null_exit+0x5c/0x95 [null_blk]
           __se_sys_delete_module+0x204/0x337
           do_syscall_64+0xa7/0x295
           entry_SYSCALL_64_after_hwframe+0x49/0xbe

    other info that might help us debug this:

     Possible unsafe locking scenario:

           CPU0                    CPU1
           ----                    ----
      lock(&q->sysfs_lock);
                                   lock(kn->count#202);
                                   lock(&q->sysfs_lock);
      lock(kn->count#202);

     *** DEADLOCK ***

    2 locks held by rmmod/777:
     #0: 00000000e69bd9de (&lock){+.+.}, at: null_exit+0x2e/0x95 [null_blk]
     #1: 00000000fb16ae21 (&q->sysfs_lock){+.+.}, at: blk_unregister_queue+0x78/0x10b

    stack backtrace:
    CPU: 0 PID: 777 Comm: rmmod Not tainted 5.3.0-rc3-00044-g73277fc75ea0 #1380
    Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS ?-20180724_192412-buildhw-07.phx4
    Call Trace:
     dump_stack+0x9a/0xe6
     check_noncircular+0x207/0x251
     ? print_circular_bug+0x32a/0x32a
     ? find_usage_backwards+0x84/0xb0
     check_prev_add+0x5d2/0xc45
     validate_chain+0xed3/0xf94
     ? check_prev_add+0xc45/0xc45
     ? mark_lock+0x11b/0x804
     ? check_usage_forwards+0x1ca/0x1ca
     __lock_acquire+0x95f/0xa2f
     lock_acquire+0x1b4/0x1e8
     ? kernfs_remove_by_name_ns+0x59/0x72
     __kernfs_remove+0x237/0x40b
     ? kernfs_remove_by_name_ns+0x59/0x72
     ? kernfs_next_descendant_post+0x7d/0x7d
     ? strlen+0x10/0x23
     ? strcmp+0x22/0x44
     kernfs_remove_by_name_ns+0x59/0x72
     remove_files+0x61/0x96
     sysfs_remove_group+0x81/0xa4
     sysfs_remove_groups+0x3b/0x44
     kobject_del+0x44/0x94
     blk_mq_unregister_dev+0x83/0xdd
     blk_unregister_queue+0xa0/0x10b
     del_gendisk+0x259/0x3fa
     ? disk_events_poll_msecs_store+0x12b/0x12b
     ? check_flags+0x1ea/0x204
     ? mark_held_locks+0x1f/0x7a
     null_del_dev+0x8b/0x1c3 [null_blk]
     null_exit+0x5c/0x95 [null_blk]
     __se_sys_delete_module+0x204/0x337
     ? free_module+0x39f/0x39f
     ? blkcg_maybe_throttle_current+0x8a/0x718
     ? rwlock_bug+0x62/0x62
     ? __blkcg_punt_bio_submit+0xd0/0xd0
     ? trace_hardirqs_on_thunk+0x1a/0x20
     ? mark_held_locks+0x1f/0x7a
     ? do_syscall_64+0x4c/0x295
     do_syscall_64+0xa7/0x295
     entry_SYSCALL_64_after_hwframe+0x49/0xbe
    RIP: 0033:0x7fb696cdbe6b
    Code: 73 01 c3 48 8b 0d 1d 20 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 008
    RSP: 002b:00007ffec9588788 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
    RAX: ffffffffffffffda RBX: 0000559e589137c0 RCX: 00007fb696cdbe6b
    RDX: 000000000000000a RSI: 0000000000000800 RDI: 0000559e58913828
    RBP: 0000000000000000 R08: 00007ffec9587701 R09: 0000000000000000
    R10: 00007fb696d4eae0 R11: 0000000000000206 R12: 00007ffec95889b0
    R13: 00007ffec95896b3 R14: 0000559e58913260 R15: 0000559e589137c0

Cc: Christoph Hellwig <hch@infradead.org>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Mike Snitzer <snitzer@redhat.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(jwang:cherry picked from commit cecf5d87ff2035127bb5a9ee054d0023a4a7cad3,
adjust ctx for 4,19)
Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 block/blk-core.c       |    1 
 block/blk-mq-sysfs.c   |   12 ++++-----
 block/blk-sysfs.c      |   44 +++++++++++++++++++++++-------------
 block/blk.h            |    2 -
 block/elevator.c       |   59 ++++++++++++++++++++++++++++++++++++++++---------
 include/linux/blkdev.h |    1 
 6 files changed, 86 insertions(+), 33 deletions(-)

--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1059,6 +1059,7 @@ struct request_queue *blk_alloc_queue_no
 	mutex_init(&q->blk_trace_mutex);
 #endif
 	mutex_init(&q->sysfs_lock);
+	mutex_init(&q->sysfs_dir_lock);
 	spin_lock_init(&q->__queue_lock);
 
 	if (!q->mq_ops)
--- a/block/blk-mq-sysfs.c
+++ b/block/blk-mq-sysfs.c
@@ -264,7 +264,7 @@ void blk_mq_unregister_dev(struct device
 	struct blk_mq_hw_ctx *hctx;
 	int i;
 
-	lockdep_assert_held(&q->sysfs_lock);
+	lockdep_assert_held(&q->sysfs_dir_lock);
 
 	queue_for_each_hw_ctx(q, hctx, i)
 		blk_mq_unregister_hctx(hctx);
@@ -312,7 +312,7 @@ int __blk_mq_register_dev(struct device
 	int ret, i;
 
 	WARN_ON_ONCE(!q->kobj.parent);
-	lockdep_assert_held(&q->sysfs_lock);
+	lockdep_assert_held(&q->sysfs_dir_lock);
 
 	ret = kobject_add(&q->mq_kobj, kobject_get(&dev->kobj), "%s", "mq");
 	if (ret < 0)
@@ -358,7 +358,7 @@ void blk_mq_sysfs_unregister(struct requ
 	struct blk_mq_hw_ctx *hctx;
 	int i;
 
-	mutex_lock(&q->sysfs_lock);
+	mutex_lock(&q->sysfs_dir_lock);
 	if (!q->mq_sysfs_init_done)
 		goto unlock;
 
@@ -366,7 +366,7 @@ void blk_mq_sysfs_unregister(struct requ
 		blk_mq_unregister_hctx(hctx);
 
 unlock:
-	mutex_unlock(&q->sysfs_lock);
+	mutex_unlock(&q->sysfs_dir_lock);
 }
 
 int blk_mq_sysfs_register(struct request_queue *q)
@@ -374,7 +374,7 @@ int blk_mq_sysfs_register(struct request
 	struct blk_mq_hw_ctx *hctx;
 	int i, ret = 0;
 
-	mutex_lock(&q->sysfs_lock);
+	mutex_lock(&q->sysfs_dir_lock);
 	if (!q->mq_sysfs_init_done)
 		goto unlock;
 
@@ -385,7 +385,7 @@ int blk_mq_sysfs_register(struct request
 	}
 
 unlock:
-	mutex_unlock(&q->sysfs_lock);
+	mutex_unlock(&q->sysfs_dir_lock);
 
 	return ret;
 }
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -892,6 +892,7 @@ int blk_register_queue(struct gendisk *d
 	int ret;
 	struct device *dev = disk_to_dev(disk);
 	struct request_queue *q = disk->queue;
+	bool has_elevator = false;
 
 	if (WARN_ON(!q))
 		return -ENXIO;
@@ -899,7 +900,6 @@ int blk_register_queue(struct gendisk *d
 	WARN_ONCE(blk_queue_registered(q),
 		  "%s is registering an already registered queue\n",
 		  kobject_name(&dev->kobj));
-	queue_flag_set_unlocked(QUEUE_FLAG_REGISTERED, q);
 
 	/*
 	 * SCSI probing may synchronously create and destroy a lot of
@@ -920,8 +920,7 @@ int blk_register_queue(struct gendisk *d
 	if (ret)
 		return ret;
 
-	/* Prevent changes through sysfs until registration is completed. */
-	mutex_lock(&q->sysfs_lock);
+	mutex_lock(&q->sysfs_dir_lock);
 
 	ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue");
 	if (ret < 0) {
@@ -934,26 +933,36 @@ int blk_register_queue(struct gendisk *d
 		blk_mq_debugfs_register(q);
 	}
 
-	kobject_uevent(&q->kobj, KOBJ_ADD);
-
-	wbt_enable_default(q);
-
-	blk_throtl_register_queue(q);
-
+	/*
+	 * The flag of QUEUE_FLAG_REGISTERED isn't set yet, so elevator
+	 * switch won't happen at all.
+	 */
 	if (q->request_fn || (q->mq_ops && q->elevator)) {
-		ret = elv_register_queue(q);
+		ret = elv_register_queue(q, false);
 		if (ret) {
-			mutex_unlock(&q->sysfs_lock);
-			kobject_uevent(&q->kobj, KOBJ_REMOVE);
+			mutex_unlock(&q->sysfs_dir_lock);
 			kobject_del(&q->kobj);
 			blk_trace_remove_sysfs(dev);
 			kobject_put(&dev->kobj);
 			return ret;
 		}
+		has_elevator = true;
 	}
+
+	mutex_lock(&q->sysfs_lock);
+	blk_queue_flag_set(QUEUE_FLAG_REGISTERED, q);
+	wbt_enable_default(q);
+	blk_throtl_register_queue(q);
+
+	/* Now everything is ready and send out KOBJ_ADD uevent */
+	kobject_uevent(&q->kobj, KOBJ_ADD);
+	if (has_elevator)
+		kobject_uevent(&q->elevator->kobj, KOBJ_ADD);
+	mutex_unlock(&q->sysfs_lock);
+
 	ret = 0;
 unlock:
-	mutex_unlock(&q->sysfs_lock);
+	mutex_unlock(&q->sysfs_dir_lock);
 	return ret;
 }
 EXPORT_SYMBOL_GPL(blk_register_queue);
@@ -968,6 +977,7 @@ EXPORT_SYMBOL_GPL(blk_register_queue);
 void blk_unregister_queue(struct gendisk *disk)
 {
 	struct request_queue *q = disk->queue;
+	bool has_elevator;
 
 	if (WARN_ON(!q))
 		return;
@@ -982,25 +992,27 @@ void blk_unregister_queue(struct gendisk
 	 * concurrent elv_iosched_store() calls.
 	 */
 	mutex_lock(&q->sysfs_lock);
-
 	blk_queue_flag_clear(QUEUE_FLAG_REGISTERED, q);
+	has_elevator = !!q->elevator;
+	mutex_unlock(&q->sysfs_lock);
 
+	mutex_lock(&q->sysfs_dir_lock);
 	/*
 	 * Remove the sysfs attributes before unregistering the queue data
 	 * structures that can be modified through sysfs.
 	 */
 	if (q->mq_ops)
 		blk_mq_unregister_dev(disk_to_dev(disk), q);
-	mutex_unlock(&q->sysfs_lock);
 
 	kobject_uevent(&q->kobj, KOBJ_REMOVE);
 	kobject_del(&q->kobj);
 	blk_trace_remove_sysfs(disk_to_dev(disk));
 
 	mutex_lock(&q->sysfs_lock);
-	if (q->request_fn || (q->mq_ops && q->elevator))
+	if (q->request_fn || has_elevator)
 		elv_unregister_queue(q);
 	mutex_unlock(&q->sysfs_lock);
+	mutex_unlock(&q->sysfs_dir_lock);
 
 	kobject_put(&disk_to_dev(disk)->kobj);
 }
--- a/block/blk.h
+++ b/block/blk.h
@@ -244,7 +244,7 @@ int elevator_init_mq(struct request_queu
 int elevator_switch_mq(struct request_queue *q,
 			      struct elevator_type *new_e);
 void elevator_exit(struct request_queue *, struct elevator_queue *);
-int elv_register_queue(struct request_queue *q);
+int elv_register_queue(struct request_queue *q, bool uevent);
 void elv_unregister_queue(struct request_queue *q);
 
 struct hd_struct *__disk_get_part(struct gendisk *disk, int partno);
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -833,13 +833,16 @@ static struct kobj_type elv_ktype = {
 	.release	= elevator_release,
 };
 
-int elv_register_queue(struct request_queue *q)
+/*
+ * elv_register_queue is called from either blk_register_queue or
+ * elevator_switch, elevator switch is prevented from being happen
+ * in the two paths, so it is safe to not hold q->sysfs_lock.
+ */
+int elv_register_queue(struct request_queue *q, bool uevent)
 {
 	struct elevator_queue *e = q->elevator;
 	int error;
 
-	lockdep_assert_held(&q->sysfs_lock);
-
 	error = kobject_add(&e->kobj, &q->kobj, "%s", "iosched");
 	if (!error) {
 		struct elv_fs_entry *attr = e->type->elevator_attrs;
@@ -850,26 +853,36 @@ int elv_register_queue(struct request_qu
 				attr++;
 			}
 		}
-		kobject_uevent(&e->kobj, KOBJ_ADD);
+		if (uevent)
+			kobject_uevent(&e->kobj, KOBJ_ADD);
+
+		mutex_lock(&q->sysfs_lock);
 		e->registered = 1;
 		if (!e->uses_mq && e->type->ops.sq.elevator_registered_fn)
 			e->type->ops.sq.elevator_registered_fn(q);
+		mutex_unlock(&q->sysfs_lock);
 	}
 	return error;
 }
 
+/*
+ * elv_unregister_queue is called from either blk_unregister_queue or
+ * elevator_switch, elevator switch is prevented from being happen
+ * in the two paths, so it is safe to not hold q->sysfs_lock.
+ */
 void elv_unregister_queue(struct request_queue *q)
 {
-	lockdep_assert_held(&q->sysfs_lock);
-
 	if (q) {
 		struct elevator_queue *e = q->elevator;
 
 		kobject_uevent(&e->kobj, KOBJ_REMOVE);
 		kobject_del(&e->kobj);
+
+		mutex_lock(&q->sysfs_lock);
 		e->registered = 0;
 		/* Re-enable throttling in case elevator disabled it */
 		wbt_enable_default(q);
+		mutex_unlock(&q->sysfs_lock);
 	}
 }
 
@@ -940,10 +953,32 @@ int elevator_switch_mq(struct request_qu
 	lockdep_assert_held(&q->sysfs_lock);
 
 	if (q->elevator) {
-		if (q->elevator->registered)
+		if (q->elevator->registered) {
+			mutex_unlock(&q->sysfs_lock);
+
+			/*
+			 * Concurrent elevator switch can't happen becasue
+			 * sysfs write is always exclusively on same file.
+			 *
+			 * Also the elevator queue won't be freed after
+			 * sysfs_lock is released becasue kobject_del() in
+			 * blk_unregister_queue() waits for completion of
+			 * .store & .show on its attributes.
+			 */
 			elv_unregister_queue(q);
+
+			mutex_lock(&q->sysfs_lock);
+		}
 		ioc_clear_queue(q);
 		elevator_exit(q, q->elevator);
+
+		/*
+		 * sysfs_lock may be dropped, so re-check if queue is
+		 * unregistered. If yes, don't switch to new elevator
+		 * any more
+		 */
+		if (!blk_queue_registered(q))
+			return 0;
 	}
 
 	ret = blk_mq_init_sched(q, new_e);
@@ -951,7 +986,11 @@ int elevator_switch_mq(struct request_qu
 		goto out;
 
 	if (new_e) {
-		ret = elv_register_queue(q);
+		mutex_unlock(&q->sysfs_lock);
+
+		ret = elv_register_queue(q, true);
+
+		mutex_lock(&q->sysfs_lock);
 		if (ret) {
 			elevator_exit(q, q->elevator);
 			goto out;
@@ -1047,7 +1086,7 @@ static int elevator_switch(struct reques
 	if (err)
 		goto fail_init;
 
-	err = elv_register_queue(q);
+	err = elv_register_queue(q, true);
 	if (err)
 		goto fail_register;
 
@@ -1067,7 +1106,7 @@ fail_init:
 	/* switch failed, restore and re-register old elevator */
 	if (old) {
 		q->elevator = old;
-		elv_register_queue(q);
+		elv_register_queue(q, true);
 		blk_queue_bypass_end(q);
 	}
 
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -637,6 +637,7 @@ struct request_queue {
 	struct delayed_work	requeue_work;
 
 	struct mutex		sysfs_lock;
+	struct mutex		sysfs_dir_lock;
 
 	int			bypass_depth;
 	atomic_t		mq_freeze_depth;



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

* [PATCH 4.19 010/247] block: fix race between switching elevator and removing queues
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (8 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 009/247] block: split .sysfs_lock into two locks Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 011/247] block: dont release queues sysfs lock during switching elevator Greg Kroah-Hartman
                   ` (239 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christoph Hellwig, Hannes Reinecke,
	Mike Snitzer, Bart Van Assche, Ming Lei, Jens Axboe, Jack Wang

From: Ming Lei <ming.lei@redhat.com>

commit 0a67b5a926e63ff5492c3c675eab5900580d056d upstream.

cecf5d87ff20 ("block: split .sysfs_lock into two locks") starts to
release & actuire sysfs_lock again during switching elevator. So it
isn't enough to prevent switching elevator from happening by simply
clearing QUEUE_FLAG_REGISTERED with holding sysfs_lock, because
in-progress switch still can move on after re-acquiring the lock,
meantime the flag of QUEUE_FLAG_REGISTERED won't get checked.

Fixes this issue by checking 'q->elevator' directly & locklessly after
q->kobj is removed in blk_unregister_queue(), this way is safe because
q->elevator can't be changed at that time.

Fixes: cecf5d87ff20 ("block: split .sysfs_lock into two locks")
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 block/blk-sysfs.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -977,7 +977,6 @@ EXPORT_SYMBOL_GPL(blk_register_queue);
 void blk_unregister_queue(struct gendisk *disk)
 {
 	struct request_queue *q = disk->queue;
-	bool has_elevator;
 
 	if (WARN_ON(!q))
 		return;
@@ -993,7 +992,6 @@ void blk_unregister_queue(struct gendisk
 	 */
 	mutex_lock(&q->sysfs_lock);
 	blk_queue_flag_clear(QUEUE_FLAG_REGISTERED, q);
-	has_elevator = !!q->elevator;
 	mutex_unlock(&q->sysfs_lock);
 
 	mutex_lock(&q->sysfs_dir_lock);
@@ -1009,7 +1007,11 @@ void blk_unregister_queue(struct gendisk
 	blk_trace_remove_sysfs(disk_to_dev(disk));
 
 	mutex_lock(&q->sysfs_lock);
-	if (q->request_fn || has_elevator)
+	/*
+	 * q->kobj has been removed, so it is safe to check if elevator
+	 * exists without holding q->sysfs_lock.
+	 */
+	if (q->request_fn || q->elevator)
 		elv_unregister_queue(q);
 	mutex_unlock(&q->sysfs_lock);
 	mutex_unlock(&q->sysfs_dir_lock);



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

* [PATCH 4.19 011/247] block: dont release queues sysfs lock during switching elevator
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (9 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 010/247] block: fix race between switching elevator and removing queues Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 012/247] NET: usb: qmi_wwan: Adding support for Cinterion MV31 Greg Kroah-Hartman
                   ` (238 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christoph Hellwig, Hannes Reinecke,
	Mike Snitzer, Bart Van Assche, Ming Lei, Jens Axboe, Jack Wang

From: Ming Lei <ming.lei@redhat.com>

commit b89f625e28d44552083f43752f62d8621ded0a04 upstream.

cecf5d87ff20 ("block: split .sysfs_lock into two locks") starts to
release & acquire sysfs_lock before registering/un-registering elevator
queue during switching elevator for avoiding potential deadlock from
showing & storing 'queue/iosched' attributes and removing elevator's
kobject.

Turns out there isn't such deadlock because 'q->sysfs_lock' isn't
required in .show & .store of queue/iosched's attributes, and just
elevator's sysfs lock is acquired in elv_iosched_store() and
elv_iosched_show(). So it is safe to hold queue's sysfs lock when
registering/un-registering elevator queue.

The biggest issue is that commit cecf5d87ff20 assumes that concurrent
write on 'queue/scheduler' can't happen. However, this assumption isn't
true, because kernfs_fop_write() only guarantees that concurrent write
aren't called on the same open file, but the write could be from
different open on the file. So we can't release & re-acquire queue's
sysfs lock during switching elevator, otherwise use-after-free on
elevator could be triggered.

Fixes the issue by not releasing queue's sysfs lock during switching
elevator.

Fixes: cecf5d87ff20 ("block: split .sysfs_lock into two locks")
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Mike Snitzer <snitzer@redhat.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(jwang: adjust ctx for 4.19)
Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 block/blk-sysfs.c |    3 ++-
 block/elevator.c  |   31 +------------------------------
 2 files changed, 3 insertions(+), 31 deletions(-)

--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -933,6 +933,7 @@ int blk_register_queue(struct gendisk *d
 		blk_mq_debugfs_register(q);
 	}
 
+	mutex_lock(&q->sysfs_lock);
 	/*
 	 * The flag of QUEUE_FLAG_REGISTERED isn't set yet, so elevator
 	 * switch won't happen at all.
@@ -940,6 +941,7 @@ int blk_register_queue(struct gendisk *d
 	if (q->request_fn || (q->mq_ops && q->elevator)) {
 		ret = elv_register_queue(q, false);
 		if (ret) {
+			mutex_unlock(&q->sysfs_lock);
 			mutex_unlock(&q->sysfs_dir_lock);
 			kobject_del(&q->kobj);
 			blk_trace_remove_sysfs(dev);
@@ -949,7 +951,6 @@ int blk_register_queue(struct gendisk *d
 		has_elevator = true;
 	}
 
-	mutex_lock(&q->sysfs_lock);
 	blk_queue_flag_set(QUEUE_FLAG_REGISTERED, q);
 	wbt_enable_default(q);
 	blk_throtl_register_queue(q);
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -856,11 +856,9 @@ int elv_register_queue(struct request_qu
 		if (uevent)
 			kobject_uevent(&e->kobj, KOBJ_ADD);
 
-		mutex_lock(&q->sysfs_lock);
 		e->registered = 1;
 		if (!e->uses_mq && e->type->ops.sq.elevator_registered_fn)
 			e->type->ops.sq.elevator_registered_fn(q);
-		mutex_unlock(&q->sysfs_lock);
 	}
 	return error;
 }
@@ -878,11 +876,9 @@ void elv_unregister_queue(struct request
 		kobject_uevent(&e->kobj, KOBJ_REMOVE);
 		kobject_del(&e->kobj);
 
-		mutex_lock(&q->sysfs_lock);
 		e->registered = 0;
 		/* Re-enable throttling in case elevator disabled it */
 		wbt_enable_default(q);
-		mutex_unlock(&q->sysfs_lock);
 	}
 }
 
@@ -953,32 +949,11 @@ int elevator_switch_mq(struct request_qu
 	lockdep_assert_held(&q->sysfs_lock);
 
 	if (q->elevator) {
-		if (q->elevator->registered) {
-			mutex_unlock(&q->sysfs_lock);
-
-			/*
-			 * Concurrent elevator switch can't happen becasue
-			 * sysfs write is always exclusively on same file.
-			 *
-			 * Also the elevator queue won't be freed after
-			 * sysfs_lock is released becasue kobject_del() in
-			 * blk_unregister_queue() waits for completion of
-			 * .store & .show on its attributes.
-			 */
+		if (q->elevator->registered)
 			elv_unregister_queue(q);
 
-			mutex_lock(&q->sysfs_lock);
-		}
 		ioc_clear_queue(q);
 		elevator_exit(q, q->elevator);
-
-		/*
-		 * sysfs_lock may be dropped, so re-check if queue is
-		 * unregistered. If yes, don't switch to new elevator
-		 * any more
-		 */
-		if (!blk_queue_registered(q))
-			return 0;
 	}
 
 	ret = blk_mq_init_sched(q, new_e);
@@ -986,11 +961,7 @@ int elevator_switch_mq(struct request_qu
 		goto out;
 
 	if (new_e) {
-		mutex_unlock(&q->sysfs_lock);
-
 		ret = elv_register_queue(q, true);
-
-		mutex_lock(&q->sysfs_lock);
 		if (ret) {
 			elevator_exit(q, q->elevator);
 			goto out;



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

* [PATCH 4.19 012/247] NET: usb: qmi_wwan: Adding support for Cinterion MV31
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (10 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 011/247] block: dont release queues sysfs lock during switching elevator Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath Greg Kroah-Hartman
                   ` (237 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christoph Schemmel, Jakub Kicinski,
	Sasha Levin

From: Christoph Schemmel <christoph.schemmel@gmail.com>

[ Upstream commit a4dc7eee9106a9d2a6e08b442db19677aa9699c7 ]

Adding support for Cinterion MV31 with PID 0x00B7.

T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 11 Spd=5000 MxCh= 0
D:  Ver= 3.20 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs=  1
P:  Vendor=1e2d ProdID=00b7 Rev=04.14
S:  Manufacturer=Cinterion
S:  Product=Cinterion USB Mobile Broadband
S:  SerialNumber=b3246eed
C:  #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=896mA
I:  If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
I:  If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option

Signed-off-by: Christoph Schemmel <christoph.schemmel@gmail.com>
Link: https://lore.kernel.org/r/20210202084523.4371-1-christoph.schemmel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/usb/qmi_wwan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index bdfe88c754dfe..d2e5f5b7adf18 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -1291,6 +1291,7 @@ static const struct usb_device_id products[] = {
 	{QMI_FIXED_INTF(0x1e2d, 0x0082, 5)},	/* Cinterion PHxx,PXxx (2 RmNet) */
 	{QMI_FIXED_INTF(0x1e2d, 0x0083, 4)},	/* Cinterion PHxx,PXxx (1 RmNet + USB Audio)*/
 	{QMI_QUIRK_SET_DTR(0x1e2d, 0x00b0, 4)},	/* Cinterion CLS8 */
+	{QMI_FIXED_INTF(0x1e2d, 0x00b7, 0)},	/* Cinterion MV31 RmNet */
 	{QMI_FIXED_INTF(0x413c, 0x81a2, 8)},	/* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */
 	{QMI_FIXED_INTF(0x413c, 0x81a3, 8)},	/* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */
 	{QMI_FIXED_INTF(0x413c, 0x81a4, 8)},	/* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */
-- 
2.27.0




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

* [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (11 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 012/247] NET: usb: qmi_wwan: Adding support for Cinterion MV31 Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-04-06 11:38   ` Salvatore Bonaccorso
  2021-03-01 16:10 ` [PATCH 4.19 014/247] scripts/recordmcount.pl: support big endian for ARCH sh Greg Kroah-Hartman
                   ` (236 subsequent siblings)
  249 siblings, 1 reply; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Shyam Prasad N, Aurelien Aptel,
	Steve French, Sasha Levin

From: Shyam Prasad N <sprasad@microsoft.com>

[ Upstream commit a738c93fb1c17e386a09304b517b1c6b2a6a5a8b ]

While debugging another issue today, Steve and I noticed that if a
subdir for a file share is already mounted on the client, any new
mount of any other subdir (or the file share root) of the same share
results in sharing the cifs superblock, which e.g. can result in
incorrect device name.

While setting prefix path for the root of a cifs_sb,
CIFS_MOUNT_USE_PREFIX_PATH flag should also be set.
Without it, prepath is not even considered in some places,
and output of "mount" and various /proc/<>/*mount* related
options can be missing part of the device name.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/cifs/connect.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 6285085195c15..632249ce61eba 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3882,6 +3882,7 @@ int cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
 		cifs_sb->prepath = kstrdup(pvolume_info->prepath, GFP_KERNEL);
 		if (cifs_sb->prepath == NULL)
 			return -ENOMEM;
+		cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_USE_PREFIX_PATH;
 	}
 
 	return 0;
-- 
2.27.0




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

* [PATCH 4.19 014/247] scripts/recordmcount.pl: support big endian for ARCH sh
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (12 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 015/247] jump_label/lockdep: Assert we hold the hotplug lock for _cpuslocked() operations Greg Kroah-Hartman
                   ` (235 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Rong Chen, kernel test robot,
	Yoshinori Sato, Rich Felker, Andrew Morton, Linus Torvalds,
	Sasha Levin

From: Rong Chen <rong.a.chen@intel.com>

[ Upstream commit 93ca696376dd3d44b9e5eae835ffbc84772023ec ]

The kernel test robot reported the following issue:

    CC [M]  drivers/soc/litex/litex_soc_ctrl.o
  sh4-linux-objcopy: Unable to change endianness of input file(s)
  sh4-linux-ld: cannot find drivers/soc/litex/.tmp_gl_litex_soc_ctrl.o: No such file or directory
  sh4-linux-objcopy: 'drivers/soc/litex/.tmp_mx_litex_soc_ctrl.o': No such file

The problem is that the format of input file is elf32-shbig-linux, but
sh4-linux-objcopy wants to output a file which format is elf32-sh-linux:

  $ sh4-linux-objdump -d drivers/soc/litex/litex_soc_ctrl.o | grep format
  drivers/soc/litex/litex_soc_ctrl.o:     file format elf32-shbig-linux

Link: https://lkml.kernel.org/r/20210210150435.2171567-1-rong.a.chen@intel.com
Link: https://lore.kernel.org/linux-mm/202101261118.GbbYSlHu-lkp@intel.com
Signed-off-by: Rong Chen <rong.a.chen@intel.com>
Reported-by: kernel test robot <lkp@intel.com>
Cc: Yoshinori Sato <ysato@users.osdn.me>
Cc: Rich Felker <dalias@libc.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 scripts/recordmcount.pl |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -263,7 +263,11 @@ if ($arch eq "x86_64") {
 
     # force flags for this arch
     $ld .= " -m shlelf_linux";
-    $objcopy .= " -O elf32-sh-linux";
+    if ($endian eq "big") {
+        $objcopy .= " -O elf32-shbig-linux";
+    } else {
+        $objcopy .= " -O elf32-sh-linux";
+    }
 
 } elsif ($arch eq "powerpc") {
     my $ldemulation;



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

* [PATCH 4.19 015/247] jump_label/lockdep: Assert we hold the hotplug lock for _cpuslocked() operations
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (13 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 014/247] scripts/recordmcount.pl: support big endian for ARCH sh Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 016/247] locking/static_key: Fix false positive warnings on concurrent dec/inc Greg Kroah-Hartman
                   ` (234 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Peter Zijlstra (Intel),
	Linus Torvalds, Thomas Gleixner, Ingo Molnar, Will McVicker

From: Peter Zijlstra <peterz@infradead.org>

commit cb538267ea1e9e025ec692577c9ae75797261889 upstream.

Weirdly we seem to have forgotten this...

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/jump_label.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -83,6 +83,7 @@ void static_key_slow_inc_cpuslocked(stru
 	int v, v1;
 
 	STATIC_KEY_CHECK_USE(key);
+	lockdep_assert_cpus_held();
 
 	/*
 	 * Careful if we get concurrent static_key_slow_inc() calls;
@@ -128,6 +129,7 @@ EXPORT_SYMBOL_GPL(static_key_slow_inc);
 void static_key_enable_cpuslocked(struct static_key *key)
 {
 	STATIC_KEY_CHECK_USE(key);
+	lockdep_assert_cpus_held();
 
 	if (atomic_read(&key->enabled) > 0) {
 		WARN_ON_ONCE(atomic_read(&key->enabled) != 1);
@@ -158,6 +160,7 @@ EXPORT_SYMBOL_GPL(static_key_enable);
 void static_key_disable_cpuslocked(struct static_key *key)
 {
 	STATIC_KEY_CHECK_USE(key);
+	lockdep_assert_cpus_held();
 
 	if (atomic_read(&key->enabled) != 1) {
 		WARN_ON_ONCE(atomic_read(&key->enabled) != 0);
@@ -183,6 +186,8 @@ static void __static_key_slow_dec_cpuslo
 					   unsigned long rate_limit,
 					   struct delayed_work *work)
 {
+	lockdep_assert_cpus_held();
+
 	/*
 	 * The negative count check is valid even when a negative
 	 * key->enabled is in use by static_key_slow_inc(); a



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

* [PATCH 4.19 016/247] locking/static_key: Fix false positive warnings on concurrent dec/inc
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (14 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 015/247] jump_label/lockdep: Assert we hold the hotplug lock for _cpuslocked() operations Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 017/247] vmlinux.lds.h: add DWARF v5 sections Greg Kroah-Hartman
                   ` (233 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jakub Kicinski,
	Peter Zijlstra (Intel),
	Andrew Morton, Linus Torvalds, Paul E. McKenney, Thomas Gleixner,
	Will Deacon, ard.biesheuvel, oss-drivers, pbonzini, Ingo Molnar,
	Will McVicker

From: Peter Zijlstra <peterz@infradead.org>

commit a1247d06d01045d7ab2882a9c074fbf21137c690 upstream.

Even though the atomic_dec_and_mutex_lock() in
__static_key_slow_dec_cpuslocked() can never see a negative value in
key->enabled the subsequent sanity check is re-reading key->enabled, which may
have been set to -1 in the meantime by static_key_slow_inc_cpuslocked().

                CPU  A                               CPU B

 __static_key_slow_dec_cpuslocked():          static_key_slow_inc_cpuslocked():
                               # enabled = 1
   atomic_dec_and_mutex_lock()
                               # enabled = 0
                                              atomic_read() == 0
                                              atomic_set(-1)
                               # enabled = -1
   val = atomic_read()
   # Oops - val == -1!

The test case is TCP's clean_acked_data_enable() / clean_acked_data_disable()
as tickled by KTLS (net/ktls).

Suggested-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reported-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Tested-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Cc: ard.biesheuvel@linaro.org
Cc: oss-drivers@netronome.com
Cc: pbonzini@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/jump_label.c |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -186,6 +186,8 @@ static void __static_key_slow_dec_cpuslo
 					   unsigned long rate_limit,
 					   struct delayed_work *work)
 {
+	int val;
+
 	lockdep_assert_cpus_held();
 
 	/*
@@ -195,17 +197,20 @@ static void __static_key_slow_dec_cpuslo
 	 * returns is unbalanced, because all other static_key_slow_inc()
 	 * instances block while the update is in progress.
 	 */
-	if (!atomic_dec_and_mutex_lock(&key->enabled, &jump_label_mutex)) {
-		WARN(atomic_read(&key->enabled) < 0,
-		     "jump label: negative count!\n");
+	val = atomic_fetch_add_unless(&key->enabled, -1, 1);
+	if (val != 1) {
+		WARN(val < 0, "jump label: negative count!\n");
 		return;
 	}
 
-	if (rate_limit) {
-		atomic_inc(&key->enabled);
-		schedule_delayed_work(work, rate_limit);
-	} else {
-		jump_label_update(key);
+	jump_label_lock();
+	if (atomic_dec_and_test(&key->enabled)) {
+		if (rate_limit) {
+			atomic_inc(&key->enabled);
+			schedule_delayed_work(work, rate_limit);
+		} else {
+			jump_label_update(key);
+		}
 	}
 	jump_label_unlock();
 }



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

* [PATCH 4.19 017/247] vmlinux.lds.h: add DWARF v5 sections
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (15 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 016/247] locking/static_key: Fix false positive warnings on concurrent dec/inc Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 018/247] kdb: Make memory allocations more robust Greg Kroah-Hartman
                   ` (232 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Chris Murphy, Fangrui Song,
	Nathan Chancellor, Mark Wielaard, Sedat Dilek, Nick Desaulniers,
	Masahiro Yamada

From: Nick Desaulniers <ndesaulniers@google.com>

commit 3c4fa46b30c551b1df2fb1574a684f68bc22067c upstream.

We expect toolchains to produce these new debug info sections as part of
DWARF v5. Add explicit placements to prevent the linker warnings from
--orphan-section=warn.

Compilers may produce such sections with explicit -gdwarf-5, or based on
the implicit default version of DWARF when -g is used via DEBUG_INFO.
This implicit default changes over time, and has changed to DWARF v5
with GCC 11.

.debug_sup was mentioned in review, but without compilers producing it
today, let's wait to add it until it becomes necessary.

Cc: stable@vger.kernel.org
Link: https://bugzilla.redhat.com/show_bug.cgi?id=1922707
Reported-by: Chris Murphy <lists@colorremedies.com>
Suggested-by: Fangrui Song <maskray@google.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Mark Wielaard <mark@klomp.org>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 include/asm-generic/vmlinux.lds.h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -701,8 +701,13 @@
 		/* DWARF 4 */						\
 		.debug_types	0 : { *(.debug_types) }			\
 		/* DWARF 5 */						\
+		.debug_addr	0 : { *(.debug_addr) }			\
+		.debug_line_str	0 : { *(.debug_line_str) }		\
+		.debug_loclists	0 : { *(.debug_loclists) }		\
 		.debug_macro	0 : { *(.debug_macro) }			\
-		.debug_addr	0 : { *(.debug_addr) }
+		.debug_names	0 : { *(.debug_names) }			\
+		.debug_rnglists	0 : { *(.debug_rnglists) }		\
+		.debug_str_offsets	0 : { *(.debug_str_offsets) }
 
 		/* Stabs debugging sections.  */
 #define STABS_DEBUG							\



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

* [PATCH 4.19 018/247] kdb: Make memory allocations more robust
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (16 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 017/247] vmlinux.lds.h: add DWARF v5 sections Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 019/247] PCI: qcom: Use PHY_REFCLK_USE_PAD only for ipq8064 Greg Kroah-Hartman
                   ` (231 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Sumit Garg, Daniel Thompson

From: Sumit Garg <sumit.garg@linaro.org>

commit 93f7a6d818deef69d0ba652d46bae6fbabbf365c upstream.

Currently kdb uses in_interrupt() to determine whether its library
code has been called from the kgdb trap handler or from a saner calling
context such as driver init. This approach is broken because
in_interrupt() alone isn't able to determine kgdb trap handler entry from
normal task context. This can happen during normal use of basic features
such as breakpoints and can also be trivially reproduced using:
echo g > /proc/sysrq-trigger

We can improve this by adding check for in_dbg_master() instead which
explicitly determines if we are running in debugger context.

Cc: stable@vger.kernel.org
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Link: https://lore.kernel.org/r/1611313556-4004-1-git-send-email-sumit.garg@linaro.org
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/debug/kdb/kdb_private.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/debug/kdb/kdb_private.h
+++ b/kernel/debug/kdb/kdb_private.h
@@ -233,7 +233,7 @@ extern struct task_struct *kdb_curr_task
 #define	kdb_do_each_thread(g, p) do_each_thread(g, p)
 #define	kdb_while_each_thread(g, p) while_each_thread(g, p)
 
-#define GFP_KDB (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL)
+#define GFP_KDB (in_dbg_master() ? GFP_ATOMIC : GFP_KERNEL)
 
 extern void *debug_kmalloc(size_t size, gfp_t flags);
 extern void debug_kfree(void *);



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

* [PATCH 4.19 019/247] PCI: qcom: Use PHY_REFCLK_USE_PAD only for ipq8064
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (17 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 018/247] kdb: Make memory allocations more robust Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 020/247] bfq: Avoid false bfq queue merging Greg Kroah-Hartman
                   ` (230 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ilia Mirkin, Ansuel Smith,
	Lorenzo Pieralisi, Bjorn Helgaas, Stanimir Varbanov

From: Ansuel Smith <ansuelsmth@gmail.com>

commit 2cfef1971aea6119ee27429181d6cb3383031ac2 upstream.

The use of PHY_REFCLK_USE_PAD introduced a regression for apq8064 devices.
It was tested that while apq doesn't require the padding, ipq SoC must use
it or the kernel hangs on boot.

Link: https://lore.kernel.org/r/20201019165555.8269-1-ansuelsmth@gmail.com
Fixes: de3c4bf64897 ("PCI: qcom: Add support for tx term offset for rev 2.1.0")
Reported-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Stanimir Varbanov <svarbanov@mm-sol.com>
Cc: stable@vger.kernel.org	# v4.19+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/pci/controller/dwc/pcie-qcom.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -371,7 +371,9 @@ static int qcom_pcie_init_2_1_0(struct q
 
 	/* enable external reference clock */
 	val = readl(pcie->parf + PCIE20_PARF_PHY_REFCLK);
-	val &= ~PHY_REFCLK_USE_PAD;
+	/* USE_PAD is required only for ipq806x */
+	if (!of_device_is_compatible(node, "qcom,pcie-apq8064"))
+		val &= ~PHY_REFCLK_USE_PAD;
 	val |= PHY_REFCLK_SSP_EN;
 	writel(val, pcie->parf + PCIE20_PARF_PHY_REFCLK);
 



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

* [PATCH 4.19 020/247] bfq: Avoid false bfq queue merging
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (18 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 019/247] PCI: qcom: Use PHY_REFCLK_USE_PAD only for ipq8064 Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 021/247] ALSA: usb-audio: Fix PCM buffer allocation in non-vmalloc mode Greg Kroah-Hartman
                   ` (229 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jan Kara, Paolo Valente, Jens Axboe

From: Jan Kara <jack@suse.cz>

commit 41e76c85660c022c6bf5713bfb6c21e64a487cec upstream.

bfq_setup_cooperator() uses bfqd->in_serv_last_pos so detect whether it
makes sense to merge current bfq queue with the in-service queue.
However if the in-service queue is freshly scheduled and didn't dispatch
any requests yet, bfqd->in_serv_last_pos is stale and contains value
from the previously scheduled bfq queue which can thus result in a bogus
decision that the two queues should be merged. This bug can be observed
for example with the following fio jobfile:

[global]
direct=0
ioengine=sync
invalidate=1
size=1g
rw=read

[reader]
numjobs=4
directory=/mnt

where the 4 processes will end up in the one shared bfq queue although
they do IO to physically very distant files (for some reason I was able to
observe this only with slice_idle=1ms setting).

Fix the problem by invalidating bfqd->in_serv_last_pos when switching
in-service queue.

Fixes: 058fdecc6de7 ("block, bfq: fix in-service-queue check for queue merging")
CC: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Acked-by: Paolo Valente <paolo.valente@linaro.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 block/bfq-iosched.c |    1 +
 1 file changed, 1 insertion(+)

--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -2478,6 +2478,7 @@ static void __bfq_set_in_service_queue(s
 	}
 
 	bfqd->in_service_queue = bfqq;
+	bfqd->in_serv_last_pos = 0;
 }
 
 /*



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

* [PATCH 4.19 021/247] ALSA: usb-audio: Fix PCM buffer allocation in non-vmalloc mode
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (19 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 020/247] bfq: Avoid false bfq queue merging Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 022/247] MIPS: vmlinux.lds.S: add missing PAGE_ALIGNED_DATA() section Greg Kroah-Hartman
                   ` (228 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Takashi Iwai

From: Takashi Iwai <tiwai@suse.de>

commit fb3c293b82c31a9a68fbcf4e7a45fadd8a47ea2b upstream.

The commit f274baa49be6 ("ALSA: usb-audio: Allow non-vmalloc buffer
for PCM buffers") introduced the mode to allocate coherent pages for
PCM buffers, and it used bus->controller device as its DMA device.
It turned out, however, that bus->sysdev is a more appropriate device
to be used for DMA mapping in HCD code.

This patch corrects the device reference accordingly.

Note that, on most platforms, both point to the very same device,
hence this patch doesn't change anything practically.  But on
platforms like xhcd-plat hcd, the change becomes effective.

Fixes: f274baa49be6 ("ALSA: usb-audio: Allow non-vmalloc buffer for PCM buffers")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210205144559.29555-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/usb/pcm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -1853,7 +1853,7 @@ void snd_usb_preallocate_buffer(struct s
 {
 	struct snd_pcm *pcm = subs->stream->pcm;
 	struct snd_pcm_substream *s = pcm->streams[subs->direction].substream;
-	struct device *dev = subs->dev->bus->controller;
+	struct device *dev = subs->dev->bus->sysdev;
 
 	if (!snd_usb_use_vmalloc)
 		snd_pcm_lib_preallocate_pages(s, SNDRV_DMA_TYPE_DEV_SG,



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

* [PATCH 4.19 022/247] MIPS: vmlinux.lds.S: add missing PAGE_ALIGNED_DATA() section
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (20 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 021/247] ALSA: usb-audio: Fix PCM buffer allocation in non-vmalloc mode Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 023/247] random: fix the RNDRESEEDCRNG ioctl Greg Kroah-Hartman
                   ` (227 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alexander Lobakin, Kees Cook,
	Nathan Chancellor, Thomas Bogendoerfer

From: Alexander Lobakin <alobakin@pm.me>

commit 8ac7c87acdcac156670f9920c8acbd84308ff4b1 upstream.

MIPS uses its own declaration of rwdata, and thus it should be kept
in sync with the asm-generic one. Currently PAGE_ALIGNED_DATA() is
missing from the linker script, which emits the following ld
warnings:

mips-alpine-linux-musl-ld: warning: orphan section
`.data..page_aligned' from `arch/mips/kernel/vdso.o' being placed
in section `.data..page_aligned'
mips-alpine-linux-musl-ld: warning: orphan section
`.data..page_aligned' from `arch/mips/vdso/vdso-image.o' being placed
in section `.data..page_aligned'

Add the necessary declaration, so the mentioned structures will be
placed in vmlinux as intended:

ffffffff80630580 D __end_once
ffffffff80630580 D __start___dyndbg
ffffffff80630580 D __start_once
ffffffff80630580 D __stop___dyndbg
ffffffff80634000 d mips_vdso_data
ffffffff80638000 d vdso_data
ffffffff80638580 D _gp
ffffffff8063c000 T __init_begin
ffffffff8063c000 D _edata
ffffffff8063c000 T _sinittext

->

ffffffff805a4000 D __end_init_task
ffffffff805a4000 D __nosave_begin
ffffffff805a4000 D __nosave_end
ffffffff805a4000 d mips_vdso_data
ffffffff805a8000 d vdso_data
ffffffff805ac000 D mmlist_lock
ffffffff805ac080 D tasklist_lock

Fixes: ebb5e78cc634 ("MIPS: Initial implementation of a VDSO")
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Cc: stable@vger.kernel.org # 4.4+
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/mips/kernel/vmlinux.lds.S |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -93,6 +93,7 @@ SECTIONS
 
 		INIT_TASK_DATA(THREAD_SIZE)
 		NOSAVE_DATA
+		PAGE_ALIGNED_DATA(PAGE_SIZE)
 		CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
 		READ_MOSTLY_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
 		DATA_DATA



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

* [PATCH 4.19 023/247] random: fix the RNDRESEEDCRNG ioctl
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (21 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 022/247] MIPS: vmlinux.lds.S: add missing PAGE_ALIGNED_DATA() section Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 024/247] ath10k: Fix error handling in case of CE pipe init failure Greg Kroah-Hartman
                   ` (226 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, linux-crypto, Andy Lutomirski,
	Jann Horn, Theodore Tso, Ard Biesheuvel, Eric Biggers

From: Eric Biggers <ebiggers@google.com>

commit 11a0b5e0ec8c13bef06f7414f9e914506140d5cb upstream.

The RNDRESEEDCRNG ioctl reseeds the primary_crng from itself, which
doesn't make sense.  Reseed it from the input_pool instead.

Fixes: d848e5f8e1eb ("random: add new ioctl RNDRESEEDCRNG")
Cc: stable@vger.kernel.org
Cc: linux-crypto@vger.kernel.org
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Jann Horn <jannh@google.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jann Horn <jannh@google.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20210112192818.69921-1-ebiggers@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/char/random.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -2071,7 +2071,7 @@ static long random_ioctl(struct file *f,
 			return -EPERM;
 		if (crng_init < 2)
 			return -ENODATA;
-		crng_reseed(&primary_crng, NULL);
+		crng_reseed(&primary_crng, &input_pool);
 		crng_global_init_time = jiffies - 1;
 		return 0;
 	default:



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

* [PATCH 4.19 024/247] ath10k: Fix error handling in case of CE pipe init failure
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (22 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 023/247] random: fix the RNDRESEEDCRNG ioctl Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 025/247] Bluetooth: btqcomsmd: Fix a resource leak in error handling paths in the probe function Greg Kroah-Hartman
                   ` (225 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Rakesh Pillai, Brian Norris,
	Kalle Valo, Sasha Levin

From: Rakesh Pillai <pillair@codeaurora.org>

[ Upstream commit 31561e8557cd1eeba5806ac9ce820f8323b2201b ]

Currently if the copy engine pipe init fails for snoc based
chipsets, the rri is not freed.

Fix this error handling for copy engine pipe init
failure.

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1

Fixes: 4945af5b264f ("ath10k: enable SRRI/DRRI support on ddr for WCN3990")
Signed-off-by: Rakesh Pillai <pillair@codeaurora.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1607713210-18320-1-git-send-email-pillair@codeaurora.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/wireless/ath/ath10k/snoc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c
index e2d78f77edb70..241e6f0e1dfe2 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -789,13 +789,14 @@ static int ath10k_snoc_hif_power_up(struct ath10k *ar)
 	ret = ath10k_snoc_init_pipes(ar);
 	if (ret) {
 		ath10k_err(ar, "failed to initialize CE: %d\n", ret);
-		goto err_wlan_enable;
+		goto err_free_rri;
 	}
 
 	napi_enable(&ar->napi);
 	return 0;
 
-err_wlan_enable:
+err_free_rri:
+	ath10k_ce_free_rri(ar);
 	ath10k_snoc_wlan_disable(ar);
 
 	return ret;
-- 
2.27.0




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

* [PATCH 4.19 025/247] Bluetooth: btqcomsmd: Fix a resource leak in error handling paths in the probe function
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (23 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 024/247] ath10k: Fix error handling in case of CE pipe init failure Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 026/247] Bluetooth: Fix initializing response id after clearing struct Greg Kroah-Hartman
                   ` (224 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christophe JAILLET, Marcel Holtmann,
	Sasha Levin

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

[ Upstream commit 9a39a927be01d89e53f04304ab99a8761e08910d ]

Some resource should be released in the error handling path of the probe
function, as already done in the remove function.

The remove function was fixed in commit 5052de8deff5 ("soc: qcom: smd:
Transition client drivers from smd to rpmsg")

Fixes: 1511cc750c3d ("Bluetooth: Introduce Qualcomm WCNSS SMD based HCI driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/bluetooth/btqcomsmd.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/drivers/bluetooth/btqcomsmd.c b/drivers/bluetooth/btqcomsmd.c
index 7df3eed1ef5e9..874172aa8e417 100644
--- a/drivers/bluetooth/btqcomsmd.c
+++ b/drivers/bluetooth/btqcomsmd.c
@@ -166,8 +166,10 @@ static int btqcomsmd_probe(struct platform_device *pdev)
 
 	btq->cmd_channel = qcom_wcnss_open_channel(wcnss, "APPS_RIVA_BT_CMD",
 						   btqcomsmd_cmd_callback, btq);
-	if (IS_ERR(btq->cmd_channel))
-		return PTR_ERR(btq->cmd_channel);
+	if (IS_ERR(btq->cmd_channel)) {
+		ret = PTR_ERR(btq->cmd_channel);
+		goto destroy_acl_channel;
+	}
 
 	/* The local-bd-address property is usually injected by the
 	 * bootloader which has access to the allocated BD address.
@@ -179,8 +181,10 @@ static int btqcomsmd_probe(struct platform_device *pdev)
 	}
 
 	hdev = hci_alloc_dev();
-	if (!hdev)
-		return -ENOMEM;
+	if (!hdev) {
+		ret = -ENOMEM;
+		goto destroy_cmd_channel;
+	}
 
 	hci_set_drvdata(hdev, btq);
 	btq->hdev = hdev;
@@ -194,14 +198,21 @@ static int btqcomsmd_probe(struct platform_device *pdev)
 	hdev->set_bdaddr = qca_set_bdaddr_rome;
 
 	ret = hci_register_dev(hdev);
-	if (ret < 0) {
-		hci_free_dev(hdev);
-		return ret;
-	}
+	if (ret < 0)
+		goto hci_free_dev;
 
 	platform_set_drvdata(pdev, btq);
 
 	return 0;
+
+hci_free_dev:
+	hci_free_dev(hdev);
+destroy_cmd_channel:
+	rpmsg_destroy_ept(btq->cmd_channel);
+destroy_acl_channel:
+	rpmsg_destroy_ept(btq->acl_channel);
+
+	return ret;
 }
 
 static int btqcomsmd_remove(struct platform_device *pdev)
-- 
2.27.0




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

* [PATCH 4.19 026/247] Bluetooth: Fix initializing response id after clearing struct
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (24 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 025/247] Bluetooth: btqcomsmd: Fix a resource leak in error handling paths in the probe function Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 027/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Artik 5 Greg Kroah-Hartman
                   ` (223 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christopher William Snowhill,
	Marcel Holtmann, Sasha Levin

From: Christopher William Snowhill <chris@kode54.net>

[ Upstream commit a5687c644015a097304a2e47476c0ecab2065734 ]

Looks like this was missed when patching the source to clear the structures
throughout, causing this one instance to clear the struct after the response
id is assigned.

Fixes: eddb7732119d ("Bluetooth: A2MP: Fix not initializing all members")
Signed-off-by: Christopher William Snowhill <chris@kode54.net>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/bluetooth/a2mp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index be9640e9ca006..888813342cfc8 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -388,9 +388,9 @@ static int a2mp_getampassoc_req(struct amp_mgr *mgr, struct sk_buff *skb,
 	hdev = hci_dev_get(req->id);
 	if (!hdev || hdev->amp_type == AMP_TYPE_BREDR || tmp) {
 		struct a2mp_amp_assoc_rsp rsp;
-		rsp.id = req->id;
 
 		memset(&rsp, 0, sizeof(rsp));
+		rsp.id = req->id;
 
 		if (tmp) {
 			rsp.status = A2MP_STATUS_COLLISION_OCCURED;
-- 
2.27.0




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

* [PATCH 4.19 027/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Artik 5
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (25 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 026/247] Bluetooth: Fix initializing response id after clearing struct Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 028/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Monk Greg Kroah-Hartman
                   ` (222 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Krzysztof Kozlowski,
	Marek Szyprowski, Sasha Levin

From: Krzysztof Kozlowski <krzk@kernel.org>

[ Upstream commit cb31334687db31c691901269d65074a7ffaecb18 ]

The Samsung PMIC datasheets describe the interrupt line as active low
with a requirement of acknowledge from the CPU.  Without specifying the
interrupt type in Devicetree, kernel might apply some fixed
configuration, not necessarily working for this hardware.

Fixes: b004a34bd0ff ("ARM: dts: exynos: Add exynos3250-artik5 dtsi file for ARTIK5 module")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20201210212903.216728-1-krzk@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/boot/dts/exynos3250-artik5.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/exynos3250-artik5.dtsi b/arch/arm/boot/dts/exynos3250-artik5.dtsi
index 7c22cbf6f3d41..6e30db644c83a 100644
--- a/arch/arm/boot/dts/exynos3250-artik5.dtsi
+++ b/arch/arm/boot/dts/exynos3250-artik5.dtsi
@@ -68,7 +68,7 @@
 	s2mps14_pmic@66 {
 		compatible = "samsung,s2mps14-pmic";
 		interrupt-parent = <&gpx3>;
-		interrupts = <5 IRQ_TYPE_NONE>;
+		interrupts = <5 IRQ_TYPE_LEVEL_LOW>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&s2mps14_irq>;
 		reg = <0x66>;
-- 
2.27.0




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

* [PATCH 4.19 028/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Monk
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (26 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 027/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Artik 5 Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 029/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Rinato Greg Kroah-Hartman
                   ` (221 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Krzysztof Kozlowski, Sasha Levin

From: Krzysztof Kozlowski <krzk@kernel.org>

[ Upstream commit 8528cda2b7c667e9cd173aef1a677c71b7d5a096 ]

The Samsung PMIC datasheets describe the interrupt line as active low
with a requirement of acknowledge from the CPU.  Without specifying the
interrupt type in Devicetree, kernel might apply some fixed
configuration, not necessarily working for this hardware.

Fixes: e0cefb3f79d3 ("ARM: dts: add board dts file for Exynos3250-based Monk board")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20201210212903.216728-2-krzk@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/boot/dts/exynos3250-monk.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/exynos3250-monk.dts b/arch/arm/boot/dts/exynos3250-monk.dts
index 6ffedf4ed9f2b..d343dc13ceecd 100644
--- a/arch/arm/boot/dts/exynos3250-monk.dts
+++ b/arch/arm/boot/dts/exynos3250-monk.dts
@@ -188,7 +188,7 @@
 	s2mps14_pmic@66 {
 		compatible = "samsung,s2mps14-pmic";
 		interrupt-parent = <&gpx0>;
-		interrupts = <7 IRQ_TYPE_NONE>;
+		interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
 		reg = <0x66>;
 		wakeup-source;
 
-- 
2.27.0




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

* [PATCH 4.19 029/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Rinato
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (27 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 028/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Monk Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 030/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Spring Greg Kroah-Hartman
                   ` (220 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Krzysztof Kozlowski,
	Marek Szyprowski, Sasha Levin

From: Krzysztof Kozlowski <krzk@kernel.org>

[ Upstream commit 437ae60947716bb479e2f32466f49445c0509b1e ]

The Samsung PMIC datasheets describe the interrupt line as active low
with a requirement of acknowledge from the CPU.  Without specifying the
interrupt type in Devicetree, kernel might apply some fixed
configuration, not necessarily working for this hardware.

Fixes: faaf348ef468 ("ARM: dts: Add board dts file for exynos3250-rinato")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20201210212903.216728-3-krzk@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/boot/dts/exynos3250-rinato.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/exynos3250-rinato.dts b/arch/arm/boot/dts/exynos3250-rinato.dts
index 2a6b828c01b7c..29df4cfa9165f 100644
--- a/arch/arm/boot/dts/exynos3250-rinato.dts
+++ b/arch/arm/boot/dts/exynos3250-rinato.dts
@@ -253,7 +253,7 @@
 	s2mps14_pmic@66 {
 		compatible = "samsung,s2mps14-pmic";
 		interrupt-parent = <&gpx0>;
-		interrupts = <7 IRQ_TYPE_NONE>;
+		interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
 		reg = <0x66>;
 		wakeup-source;
 
-- 
2.27.0




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

* [PATCH 4.19 030/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Spring
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (28 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 029/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Rinato Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 031/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Arndale Octa Greg Kroah-Hartman
                   ` (219 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Krzysztof Kozlowski, Sasha Levin

From: Krzysztof Kozlowski <krzk@kernel.org>

[ Upstream commit 77e6a5467cb8657cf8b5e610a30a4c502085e4f9 ]

The Samsung PMIC datasheets describe the interrupt line as active low
with a requirement of acknowledge from the CPU.  Without specifying the
interrupt type in Devicetree, kernel might apply some fixed
configuration, not necessarily working for this hardware.

Fixes: 53dd4138bb0a ("ARM: dts: Add exynos5250-spring device tree")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20201210212903.216728-4-krzk@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/boot/dts/exynos5250-spring.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/exynos5250-spring.dts b/arch/arm/boot/dts/exynos5250-spring.dts
index 3d501926c2278..2355c53164840 100644
--- a/arch/arm/boot/dts/exynos5250-spring.dts
+++ b/arch/arm/boot/dts/exynos5250-spring.dts
@@ -108,7 +108,7 @@
 		compatible = "samsung,s5m8767-pmic";
 		reg = <0x66>;
 		interrupt-parent = <&gpx3>;
-		interrupts = <2 IRQ_TYPE_NONE>;
+		interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&s5m8767_irq &s5m8767_dvs &s5m8767_ds>;
 		wakeup-source;
-- 
2.27.0




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

* [PATCH 4.19 031/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Arndale Octa
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (29 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 030/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Spring Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 032/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Odroid XU3 family Greg Kroah-Hartman
                   ` (218 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Krzysztof Kozlowski,
	Marek Szyprowski, Sasha Levin

From: Krzysztof Kozlowski <krzk@kernel.org>

[ Upstream commit 1ac8893c4fa3d4a34915dc5cdab568a39db5086c ]

The Samsung PMIC datasheets describe the interrupt line as active low
with a requirement of acknowledge from the CPU.  The falling edge
interrupt will mostly work but it's not correct.

Fixes: 1fed2252713e ("ARM: dts: fix pinctrl for s2mps11-irq on exynos5420-arndale-octa")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20201210212903.216728-5-krzk@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/boot/dts/exynos5420-arndale-octa.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/exynos5420-arndale-octa.dts b/arch/arm/boot/dts/exynos5420-arndale-octa.dts
index a370857beac0d..fbaca74cbaea4 100644
--- a/arch/arm/boot/dts/exynos5420-arndale-octa.dts
+++ b/arch/arm/boot/dts/exynos5420-arndale-octa.dts
@@ -84,7 +84,7 @@
 		reg = <0x66>;
 
 		interrupt-parent = <&gpx3>;
-		interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
+		interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&s2mps11_irq>;
 
-- 
2.27.0




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

* [PATCH 4.19 032/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Odroid XU3 family
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (30 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 031/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Arndale Octa Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 033/247] arm64: dts: exynos: correct PMIC interrupt trigger level on TM2 Greg Kroah-Hartman
                   ` (217 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Krzysztof Kozlowski,
	Marek Szyprowski, Sasha Levin

From: Krzysztof Kozlowski <krzk@kernel.org>

[ Upstream commit 3e7d9a583a24f7582c6bc29a0d4d624feedbc2f9 ]

The Samsung PMIC datasheets describe the interrupt line as active low
with a requirement of acknowledge from the CPU.  The falling edge
interrupt will mostly work but it's not correct.

Fixes: aac4e0615341 ("ARM: dts: odroidxu3: Enable wake alarm of S2MPS11 RTC")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20201210212903.216728-6-krzk@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/boot/dts/exynos5422-odroid-core.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/exynos5422-odroid-core.dtsi b/arch/arm/boot/dts/exynos5422-odroid-core.dtsi
index d476ba0f07b6b..ba7187a74be36 100644
--- a/arch/arm/boot/dts/exynos5422-odroid-core.dtsi
+++ b/arch/arm/boot/dts/exynos5422-odroid-core.dtsi
@@ -136,7 +136,7 @@
 		samsung,s2mps11-acokb-ground;
 
 		interrupt-parent = <&gpx0>;
-		interrupts = <4 IRQ_TYPE_EDGE_FALLING>;
+		interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&s2mps11_irq>;
 
-- 
2.27.0




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

* [PATCH 4.19 033/247] arm64: dts: exynos: correct PMIC interrupt trigger level on TM2
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (31 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 032/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Odroid XU3 family Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 034/247] arm64: dts: exynos: correct PMIC interrupt trigger level on Espresso Greg Kroah-Hartman
                   ` (216 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Krzysztof Kozlowski,
	Marek Szyprowski, Sasha Levin

From: Krzysztof Kozlowski <krzk@kernel.org>

[ Upstream commit e98e2367dfb4b6d7a80c8ce795c644124eff5f36 ]

The Samsung PMIC datasheets describe the interrupt line as active low
with a requirement of acknowledge from the CPU.  Without specifying the
interrupt type in Devicetree, kernel might apply some fixed
configuration, not necessarily working for this hardware.

Fixes: 01e5d2352152 ("arm64: dts: exynos: Add dts file for Exynos5433-based TM2 board")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20201210212903.216728-7-krzk@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi b/arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
index a1e3194b74837..d64f97d97c350 100644
--- a/arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
+++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
@@ -378,7 +378,7 @@
 	s2mps13-pmic@66 {
 		compatible = "samsung,s2mps13-pmic";
 		interrupt-parent = <&gpa0>;
-		interrupts = <7 IRQ_TYPE_NONE>;
+		interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
 		reg = <0x66>;
 		samsung,s2mps11-wrstbi-ground;
 
-- 
2.27.0




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

* [PATCH 4.19 034/247] arm64: dts: exynos: correct PMIC interrupt trigger level on Espresso
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (32 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 033/247] arm64: dts: exynos: correct PMIC interrupt trigger level on TM2 Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 035/247] bpf: Avoid warning when re-casting __bpf_call_base into __bpf_call_base_args Greg Kroah-Hartman
                   ` (215 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Krzysztof Kozlowski, Sasha Levin

From: Krzysztof Kozlowski <krzk@kernel.org>

[ Upstream commit 1fea2eb2f5bbd3fbbe2513d2386b5f6e6db17fd7 ]

The Samsung PMIC datasheets describe the interrupt line as active low
with a requirement of acknowledge from the CPU.  Without specifying the
interrupt type in Devicetree, kernel might apply some fixed
configuration, not necessarily working for this hardware.

Fixes: 9589f7721e16 ("arm64: dts: Add S2MPS15 PMIC node on exynos7-espresso")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20201210212903.216728-8-krzk@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm64/boot/dts/exynos/exynos7-espresso.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/exynos/exynos7-espresso.dts b/arch/arm64/boot/dts/exynos/exynos7-espresso.dts
index d991eae5202f2..2ba62118ae906 100644
--- a/arch/arm64/boot/dts/exynos/exynos7-espresso.dts
+++ b/arch/arm64/boot/dts/exynos/exynos7-espresso.dts
@@ -85,7 +85,7 @@
 	s2mps15_pmic@66 {
 		compatible = "samsung,s2mps15-pmic";
 		reg = <0x66>;
-		interrupts = <2 IRQ_TYPE_NONE>;
+		interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
 		interrupt-parent = <&gpa0>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&pmic_irq>;
-- 
2.27.0




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

* [PATCH 4.19 035/247] bpf: Avoid warning when re-casting __bpf_call_base into __bpf_call_base_args
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (33 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 034/247] arm64: dts: exynos: correct PMIC interrupt trigger level on Espresso Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 036/247] arm64: dts: allwinner: A64: properly connect USB PHY to port 0 Greg Kroah-Hartman
                   ` (214 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, kernel test robot, Andrii Nakryiko,
	Alexei Starovoitov, Yonghong Song, Sasha Levin

From: Andrii Nakryiko <andrii@kernel.org>

[ Upstream commit 6943c2b05bf09fd5c5729f7d7d803bf3f126cb9a ]

BPF interpreter uses extra input argument, so re-casts __bpf_call_base into
__bpf_call_base_args. Avoid compiler warning about incompatible function
prototypes by casting to void * first.

Fixes: 1ea47e01ad6e ("bpf: add support for bpf_call to interpreter")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20210112075520.4103414-3-andrii@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/linux/filter.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/filter.h b/include/linux/filter.h
index d61dc72ebb960..117f9380069a8 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -746,7 +746,7 @@ void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp);
 u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5);
 #define __bpf_call_base_args \
 	((u64 (*)(u64, u64, u64, u64, u64, const struct bpf_insn *)) \
-	 __bpf_call_base)
+	 (void *)__bpf_call_base)
 
 struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog);
 void bpf_jit_compile(struct bpf_prog *prog);
-- 
2.27.0




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

* [PATCH 4.19 036/247] arm64: dts: allwinner: A64: properly connect USB PHY to port 0
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (34 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 035/247] bpf: Avoid warning when re-casting __bpf_call_base into __bpf_call_base_args Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 037/247] arm64: dts: allwinner: Drop non-removable from SoPine/LTS SD card Greg Kroah-Hartman
                   ` (213 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andre Przywara, Chen-Yu Tsai,
	Maxime Ripard, Sasha Levin

From: Andre Przywara <andre.przywara@arm.com>

[ Upstream commit cc72570747e43335f4933a24dd74d5653639176a ]

In recent Allwinner SoCs the first USB host controller (HCI0) shares
the first PHY with the MUSB controller. Probably to make this sharing
work, we were avoiding to declare this in the DT. This has two
shortcomings:
- U-Boot (which uses the same .dts) cannot use this port in host mode
  without a PHY linked, so we were loosing one USB port there.
- It requires the MUSB driver to be enabled and loaded, although we
  don't actually use it.

To avoid those issues, let's add this PHY link to the A64 .dtsi file.
After all PHY port 0 *is* connected to HCI0, so we should describe
it as this. Remove the part from the Pinebook DTS which already had
this property.

This makes it work in U-Boot, also improves compatiblity when no MUSB
driver is loaded (for instance in distribution installers).

Fixes: dc03a047df1d ("arm64: allwinner: a64: add EHCI0/OHCI0 nodes to A64 DTSI")
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20210113152630.28810-2-andre.przywara@arm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts | 4 ----
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi         | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
index 897e60cbe38d1..b2f0729d92d2c 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
@@ -67,8 +67,6 @@
 };
 
 &ehci0 {
-	phys = <&usbphy 0>;
-	phy-names = "usb";
 	status = "okay";
 };
 
@@ -115,8 +113,6 @@
 };
 
 &ohci0 {
-	phys = <&usbphy 0>;
-	phy-names = "usb";
 	status = "okay";
 };
 
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index 7abc4ea305410..47949f14c49f4 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -312,6 +312,8 @@
 				 <&ccu CLK_USB_OHCI0>;
 			resets = <&ccu RST_BUS_OHCI0>,
 				 <&ccu RST_BUS_EHCI0>;
+			phys = <&usbphy 0>;
+			phy-names = "usb";
 			status = "disabled";
 		};
 
@@ -322,6 +324,8 @@
 			clocks = <&ccu CLK_BUS_OHCI0>,
 				 <&ccu CLK_USB_OHCI0>;
 			resets = <&ccu RST_BUS_OHCI0>;
+			phys = <&usbphy 0>;
+			phy-names = "usb";
 			status = "disabled";
 		};
 
-- 
2.27.0




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

* [PATCH 4.19 037/247] arm64: dts: allwinner: Drop non-removable from SoPine/LTS SD card
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (35 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 036/247] arm64: dts: allwinner: A64: properly connect USB PHY to port 0 Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 038/247] arm64: dts: allwinner: A64: Limit MMC2 bus frequency to 150 MHz Greg Kroah-Hartman
                   ` (212 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andre Przywara, Chen-Yu Tsai,
	Maxime Ripard, Sasha Levin

From: Andre Przywara <andre.przywara@arm.com>

[ Upstream commit 941432d007689f3774646e41a1439228b6c6ee0e ]

The SD card on the SoPine SoM module is somewhat concealed, so was
originally defined as "non-removable".
However there is a working card-detect pin (tested on two different
SoM versions), and in certain SoM base boards it might be actually
accessible at runtime.
Also the Pine64-LTS shares the SoPine base .dtsi, so inherited the
non-removable flag, even though the SD card slot is perfectly accessible
and usable there. (It turns out that just *my* board has a broken card
detect switch, so I originally thought CD wouldn't work on the LTS.)

Drop the "non-removable" flag to describe the SD card slot properly.

Fixes: c3904a269891 ("arm64: allwinner: a64: add DTSI file for SoPine SoM")
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20210113152630.28810-5-andre.przywara@arm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi
index 6723b8695e0bb..ca39084fddc0b 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi
@@ -51,7 +51,6 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins>;
 	vmmc-supply = <&reg_dcdc1>;
-	non-removable;
 	disable-wp;
 	bus-width = <4>;
 	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
-- 
2.27.0




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

* [PATCH 4.19 038/247] arm64: dts: allwinner: A64: Limit MMC2 bus frequency to 150 MHz
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (36 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 037/247] arm64: dts: allwinner: Drop non-removable from SoPine/LTS SD card Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 039/247] cpufreq: brcmstb-avs-cpufreq: Free resources in error path Greg Kroah-Hartman
                   ` (211 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andre Przywara, Chen-Yu Tsai,
	Maxime Ripard, Sasha Levin

From: Andre Przywara <andre.przywara@arm.com>

[ Upstream commit 948c657cc45e8ce48cb533d4e2106145fa765759 ]

In contrast to the H6 (and later) manuals, the A64 datasheet does not
specify any limitations in the maximum possible frequency for eMMC
controllers.
However experimentation has found that a 150 MHz limit similar to other
SoCs and also the MMC0 and MMC1 controllers on the A64 seems to exist
for the MMC2 controller.

Limit the frequency for the MMC2 controller to 150 MHz in the SoC .dtsi.
The Pinebook seems to be the an odd exception, since it apparently seems
to work with 200 MHz as well, so overwrite this in its board .dts file.

Tested on a Pine64-LTS: 200 MHz HS-200 fails, 150 MHz HS-200 works.

Fixes: 22be992faea7 ("arm64: allwinner: a64: Increase the MMC max frequency")
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20210113152630.28810-7-andre.przywara@arm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts | 1 +
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi         | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
index b2f0729d92d2c..ecb3e10c85e07 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
@@ -105,6 +105,7 @@
 	pinctrl-0 = <&mmc2_pins>;
 	vmmc-supply = <&reg_dcdc1>;
 	vqmmc-supply = <&reg_eldo1>;
+	max-frequency = <200000000>;
 	bus-width = <8>;
 	non-removable;
 	cap-mmc-hw-reset;
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index 47949f14c49f4..30cc2e83a288e 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -264,7 +264,7 @@
 			resets = <&ccu RST_BUS_MMC2>;
 			reset-names = "ahb";
 			interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
-			max-frequency = <200000000>;
+			max-frequency = <150000000>;
 			status = "disabled";
 			#address-cells = <1>;
 			#size-cells = <0>;
-- 
2.27.0




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

* [PATCH 4.19 039/247] cpufreq: brcmstb-avs-cpufreq: Free resources in error path
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (37 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 038/247] arm64: dts: allwinner: A64: Limit MMC2 bus frequency to 150 MHz Greg Kroah-Hartman
@ 2021-03-01 16:10 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 040/247] cpufreq: brcmstb-avs-cpufreq: Fix resource leaks in ->remove() Greg Kroah-Hartman
                   ` (210 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christophe JAILLET, Viresh Kumar,
	Sasha Levin

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

[ Upstream commit 05f456286fd489558c72a4711d22a5612c965685 ]

If 'cpufreq_register_driver()' fails, we must release the resources
allocated in 'brcm_avs_prepare_init()' as already done in the remove
function.

To do that, introduce a new function 'brcm_avs_prepare_uninit()' in order
to avoid code duplication. This also makes the code more readable (IMHO).

Fixes: de322e085995 ("cpufreq: brcmstb-avs-cpufreq: AVS CPUfreq driver for Broadcom STB SoCs")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
[ Viresh: Updated Subject ]
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/cpufreq/brcmstb-avs-cpufreq.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmstb-avs-cpufreq.c
index 77b0e5d0fb134..1514c9846c5d5 100644
--- a/drivers/cpufreq/brcmstb-avs-cpufreq.c
+++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c
@@ -566,6 +566,16 @@ unmap_base:
 	return ret;
 }
 
+static void brcm_avs_prepare_uninit(struct platform_device *pdev)
+{
+	struct private_data *priv;
+
+	priv = platform_get_drvdata(pdev);
+
+	iounmap(priv->avs_intr_base);
+	iounmap(priv->base);
+}
+
 static int brcm_avs_cpufreq_init(struct cpufreq_policy *policy)
 {
 	struct cpufreq_frequency_table *freq_table;
@@ -701,21 +711,22 @@ static int brcm_avs_cpufreq_probe(struct platform_device *pdev)
 
 	brcm_avs_driver.driver_data = pdev;
 
-	return cpufreq_register_driver(&brcm_avs_driver);
+	ret = cpufreq_register_driver(&brcm_avs_driver);
+	if (ret)
+		brcm_avs_prepare_uninit(pdev);
+
+	return ret;
 }
 
 static int brcm_avs_cpufreq_remove(struct platform_device *pdev)
 {
-	struct private_data *priv;
 	int ret;
 
 	ret = cpufreq_unregister_driver(&brcm_avs_driver);
 	if (ret)
 		return ret;
 
-	priv = platform_get_drvdata(pdev);
-	iounmap(priv->base);
-	iounmap(priv->avs_intr_base);
+	brcm_avs_prepare_uninit(pdev);
 
 	return 0;
 }
-- 
2.27.0




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

* [PATCH 4.19 040/247] cpufreq: brcmstb-avs-cpufreq: Fix resource leaks in ->remove()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (38 preceding siblings ...)
  2021-03-01 16:10 ` [PATCH 4.19 039/247] cpufreq: brcmstb-avs-cpufreq: Free resources in error path Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 041/247] ACPICA: Fix exception code class checks Greg Kroah-Hartman
                   ` (209 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christophe JAILLET, Viresh Kumar,
	Sasha Levin

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

[ Upstream commit 3657f729b6fb5f2c0bf693742de2dcd49c572aa1 ]

If 'cpufreq_unregister_driver()' fails, just WARN and continue, so that
other resources are freed.

Fixes: de322e085995 ("cpufreq: brcmstb-avs-cpufreq: AVS CPUfreq driver for Broadcom STB SoCs")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
[ Viresh: Updated Subject ]
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/cpufreq/brcmstb-avs-cpufreq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmstb-avs-cpufreq.c
index 1514c9846c5d5..a3c82f530d608 100644
--- a/drivers/cpufreq/brcmstb-avs-cpufreq.c
+++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c
@@ -723,8 +723,7 @@ static int brcm_avs_cpufreq_remove(struct platform_device *pdev)
 	int ret;
 
 	ret = cpufreq_unregister_driver(&brcm_avs_driver);
-	if (ret)
-		return ret;
+	WARN_ON(ret);
 
 	brcm_avs_prepare_uninit(pdev);
 
-- 
2.27.0




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

* [PATCH 4.19 041/247] ACPICA: Fix exception code class checks
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (39 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 040/247] cpufreq: brcmstb-avs-cpufreq: Fix resource leaks in ->remove() Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2022-03-02 15:52   ` Moore, Robert
  2021-03-01 16:11 ` [PATCH 4.19 042/247] usb: gadget: u_audio: Free requests only after callback Greg Kroah-Hartman
                   ` (208 subsequent siblings)
  249 siblings, 1 reply; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Maximilian Luz, Bob Moore,
	Erik Kaneda, Rafael J. Wysocki, Sasha Levin

From: Maximilian Luz <luzmaximilian@gmail.com>

[ Upstream commit 3dfaea3811f8b6a89a347e8da9ab862cdf3e30fe ]

ACPICA commit 1a3a549286ea9db07d7ec700e7a70dd8bcc4354e

The macros to classify different AML exception codes are broken. For
instance,

  ACPI_ENV_EXCEPTION(Status)

will always evaluate to zero due to

  #define AE_CODE_ENVIRONMENTAL      0x0000
  #define ACPI_ENV_EXCEPTION(Status) (Status & AE_CODE_ENVIRONMENTAL)

Similarly, ACPI_AML_EXCEPTION(Status) will evaluate to a non-zero
value for error codes of type AE_CODE_PROGRAMMER, AE_CODE_ACPI_TABLES,
as well as AE_CODE_AML, and not just AE_CODE_AML as the name suggests.

This commit fixes those checks.

Fixes: d46b6537f0ce ("ACPICA: AML Parser: ignore all exceptions resulting from incorrect AML during table load")
Link: https://github.com/acpica/acpica/commit/1a3a5492
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/acpi/acexcep.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 856c56ef01431..878b8e26c6c50 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -59,11 +59,11 @@ struct acpi_exception_info {
 
 #define AE_OK                           (acpi_status) 0x0000
 
-#define ACPI_ENV_EXCEPTION(status)      (status & AE_CODE_ENVIRONMENTAL)
-#define ACPI_AML_EXCEPTION(status)      (status & AE_CODE_AML)
-#define ACPI_PROG_EXCEPTION(status)     (status & AE_CODE_PROGRAMMER)
-#define ACPI_TABLE_EXCEPTION(status)    (status & AE_CODE_ACPI_TABLES)
-#define ACPI_CNTL_EXCEPTION(status)     (status & AE_CODE_CONTROL)
+#define ACPI_ENV_EXCEPTION(status)      (((status) & AE_CODE_MASK) == AE_CODE_ENVIRONMENTAL)
+#define ACPI_AML_EXCEPTION(status)      (((status) & AE_CODE_MASK) == AE_CODE_AML)
+#define ACPI_PROG_EXCEPTION(status)     (((status) & AE_CODE_MASK) == AE_CODE_PROGRAMMER)
+#define ACPI_TABLE_EXCEPTION(status)    (((status) & AE_CODE_MASK) == AE_CODE_ACPI_TABLES)
+#define ACPI_CNTL_EXCEPTION(status)     (((status) & AE_CODE_MASK) == AE_CODE_CONTROL)
 
 /*
  * Environmental exceptions
-- 
2.27.0




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

* [PATCH 4.19 042/247] usb: gadget: u_audio: Free requests only after callback
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (40 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 041/247] ACPICA: Fix exception code class checks Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 043/247] Bluetooth: drop HCI device reference before return Greg Kroah-Hartman
                   ` (207 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Felipe Balbi, Jack Pham,
	Jerome Brunet, Sasha Levin, Ferry Toth, Peter Chen

From: Jack Pham <jackp@codeaurora.org>

[ Upstream commit 7de8681be2cde9f6953d3be1fa6ce05f9fe6e637 ]

As per the kernel doc for usb_ep_dequeue(), it states that "this
routine is asynchronous, that is, it may return before the completion
routine runs". And indeed since v5.0 the dwc3 gadget driver updated
its behavior to place dequeued requests on to a cancelled list to be
given back later after the endpoint is stopped.

The free_ep() was incorrectly assuming that a request was ready to
be freed after calling dequeue which results in a use-after-free
in dwc3 when it traverses its cancelled list. Fix this by moving
the usb_ep_free_request() call to the callback itself in case the
ep is disabled.

Fixes: eb9fecb9e69b0 ("usb: gadget: f_uac2: split out audio core")
Reported-and-tested-by: Ferry Toth <fntoth@gmail.com>
Reviewed-and-tested-by: Peter Chen <peter.chen@nxp.com>
Acked-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20210118084642.322510-2-jbrunet@baylibre.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/gadget/function/u_audio.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c
index fb5ed97572e5f..0cb0c638fd131 100644
--- a/drivers/usb/gadget/function/u_audio.c
+++ b/drivers/usb/gadget/function/u_audio.c
@@ -89,7 +89,12 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)
 	struct snd_uac_chip *uac = prm->uac;
 
 	/* i/f shutting down */
-	if (!prm->ep_enabled || req->status == -ESHUTDOWN)
+	if (!prm->ep_enabled) {
+		usb_ep_free_request(ep, req);
+		return;
+	}
+
+	if (req->status == -ESHUTDOWN)
 		return;
 
 	/*
@@ -351,8 +356,14 @@ static inline void free_ep(struct uac_rtd_params *prm, struct usb_ep *ep)
 
 	for (i = 0; i < params->req_number; i++) {
 		if (prm->ureq[i].req) {
-			usb_ep_dequeue(ep, prm->ureq[i].req);
-			usb_ep_free_request(ep, prm->ureq[i].req);
+			if (usb_ep_dequeue(ep, prm->ureq[i].req))
+				usb_ep_free_request(ep, prm->ureq[i].req);
+			/*
+			 * If usb_ep_dequeue() cannot successfully dequeue the
+			 * request, the request will be freed by the completion
+			 * callback.
+			 */
+
 			prm->ureq[i].req = NULL;
 		}
 	}
-- 
2.27.0




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

* [PATCH 4.19 043/247] Bluetooth: drop HCI device reference before return
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (41 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 042/247] usb: gadget: u_audio: Free requests only after callback Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 044/247] Bluetooth: Put HCI device if inquiry procedure interrupts Greg Kroah-Hartman
                   ` (206 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pan Bian, Marcel Holtmann, Sasha Levin

From: Pan Bian <bianpan2016@163.com>

[ Upstream commit 5a3ef03afe7e12982dc3b978f4c5077c907f7501 ]

Call hci_dev_put() to decrement reference count of HCI device hdev if
fails to duplicate memory.

Fixes: 0b26ab9dce74 ("Bluetooth: AMP: Handle Accept phylink command status evt")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/bluetooth/a2mp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index 888813342cfc8..e09ea78356c36 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -519,6 +519,7 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb,
 		assoc = kmemdup(req->amp_assoc, assoc_len, GFP_KERNEL);
 		if (!assoc) {
 			amp_ctrl_put(ctrl);
+			hci_dev_put(hdev);
 			return -ENOMEM;
 		}
 
-- 
2.27.0




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

* [PATCH 4.19 044/247] Bluetooth: Put HCI device if inquiry procedure interrupts
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (42 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 043/247] Bluetooth: drop HCI device reference before return Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 045/247] memory: ti-aemif: Drop child node when jumping out loop Greg Kroah-Hartman
                   ` (205 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pan Bian, Marcel Holtmann, Sasha Levin

From: Pan Bian <bianpan2016@163.com>

[ Upstream commit 28a758c861ff290e39d4f1ee0aa5df0f0b9a45ee ]

Jump to the label done to decrement the reference count of HCI device
hdev on path that the Inquiry procedure is interrupted.

Fixes: 3e13fa1e1fab ("Bluetooth: Fix hci_inquiry ioctl usage")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/bluetooth/hci_core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index e03faca84919e..04d6f50798c98 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1316,8 +1316,10 @@ int hci_inquiry(void __user *arg)
 		 * cleared). If it is interrupted by a signal, return -EINTR.
 		 */
 		if (wait_on_bit(&hdev->flags, HCI_INQUIRY,
-				TASK_INTERRUPTIBLE))
-			return -EINTR;
+				TASK_INTERRUPTIBLE)) {
+			err = -EINTR;
+			goto done;
+		}
 	}
 
 	/* for unlimited number of responses we will use buffer with
-- 
2.27.0




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

* [PATCH 4.19 045/247] memory: ti-aemif: Drop child node when jumping out loop
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (43 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 044/247] Bluetooth: Put HCI device if inquiry procedure interrupts Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 046/247] ARM: dts: Configure missing thermal interrupt for 4430 Greg Kroah-Hartman
                   ` (204 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pan Bian, Krzysztof Kozlowski, Sasha Levin

From: Pan Bian <bianpan2016@163.com>

[ Upstream commit 94e9dd43cf327366388c8f146bccdc6322c0d999 ]

Call of_node_put() to decrement the reference count of the child node
child_np when jumping out of the loop body of
for_each_available_child_of_node(), which is a macro that increments and
decrements the reference count of child node. If the loop is broken, the
reference of the child node should be dropped manually.

Fixes: 5a7c81547c1d ("memory: ti-aemif: introduce AEMIF driver")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Link: https://lore.kernel.org/r/20210121090359.61763-1-bianpan2016@163.com
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/memory/ti-aemif.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c
index 475e5b3790edb..be3d978648f57 100644
--- a/drivers/memory/ti-aemif.c
+++ b/drivers/memory/ti-aemif.c
@@ -381,8 +381,10 @@ static int aemif_probe(struct platform_device *pdev)
 		 */
 		for_each_available_child_of_node(np, child_np) {
 			ret = of_aemif_parse_abus_config(pdev, child_np);
-			if (ret < 0)
+			if (ret < 0) {
+				of_node_put(child_np);
 				goto error;
+			}
 		}
 	} else if (pdata && pdata->num_abus_data > 0) {
 		for (i = 0; i < pdata->num_abus_data; i++, aemif->num_cs++) {
@@ -408,8 +410,10 @@ static int aemif_probe(struct platform_device *pdev)
 		for_each_available_child_of_node(np, child_np) {
 			ret = of_platform_populate(child_np, NULL,
 						   dev_lookup, dev);
-			if (ret < 0)
+			if (ret < 0) {
+				of_node_put(child_np);
 				goto error;
+			}
 		}
 	} else if (pdata) {
 		for (i = 0; i < pdata->num_sub_devices; i++) {
-- 
2.27.0




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

* [PATCH 4.19 046/247] ARM: dts: Configure missing thermal interrupt for 4430
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (44 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 045/247] memory: ti-aemif: Drop child node when jumping out loop Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 047/247] usb: dwc2: Do not update data length if it is 0 on inbound transfers Greg Kroah-Hartman
                   ` (203 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Carl Philipp Klemm, Daniel Lezcano,
	Eduardo Valentin, Merlijn Wajer, Pavel Machek, Peter Ujfalusi,
	Sebastian Reichel, Tony Lindgren, Sasha Levin

From: Tony Lindgren <tony@atomide.com>

[ Upstream commit 44f416879a442600b006ef7dec3a6dc98bcf59c6 ]

We have gpio_86 wired internally to the bandgap thermal shutdown
interrupt on 4430 like we have it on 4460 according to the TRM.
This can be found easily by searching for TSHUT.

For some reason the thermal shutdown interrupt was never added
for 4430, let's add it. I believe this is needed for the thermal
shutdown interrupt handler ti_bandgap_tshut_irq_handler() to call
orderly_poweroff().

Fixes: aa9bb4bb8878 ("arm: dts: add omap4430 thermal data")
Cc: Carl Philipp Klemm <philipp@uvos.xyz>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Merlijn Wajer <merlijn@wizzup.org>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Cc: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/boot/dts/omap443x.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/omap443x.dtsi b/arch/arm/boot/dts/omap443x.dtsi
index 86b9caf461dfa..6e320efd9fc1d 100644
--- a/arch/arm/boot/dts/omap443x.dtsi
+++ b/arch/arm/boot/dts/omap443x.dtsi
@@ -33,10 +33,12 @@
 	};
 
 	ocp {
+		/* 4430 has only gpio_86 tshut and no talert interrupt */
 		bandgap: bandgap@4a002260 {
 			reg = <0x4a002260 0x4
 			       0x4a00232C 0x4>;
 			compatible = "ti,omap4430-bandgap";
+			gpios = <&gpio3 22 GPIO_ACTIVE_HIGH>;
 
 			#thermal-sensor-cells = <0>;
 		};
-- 
2.27.0




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

* [PATCH 4.19 047/247] usb: dwc2: Do not update data length if it is 0 on inbound transfers
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (45 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 046/247] ARM: dts: Configure missing thermal interrupt for 4430 Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 048/247] usb: dwc2: Abort transaction after errors with unknown reason Greg Kroah-Hartman
                   ` (202 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Nicolas Saenz Julienne,
	Douglas Anderson, Guenter Roeck, Sasha Levin

From: Guenter Roeck <linux@roeck-us.net>

[ Upstream commit 415fa1c7305dedbb345e2cc8ac91769bc1c83f1a ]

The DWC2 documentation states that transfers with zero data length should
set the number of packets to 1 and the transfer length to 0. This is not
currently the case for inbound transfers: the transfer length is set to
the maximum packet length. This can have adverse effects if the chip
actually does transfer data as it is programmed to do. Follow chip
documentation and keep the transfer length set to 0 in that situation.

Fixes: 56f5b1cff22a1 ("staging: Core files for the DWC2 driver")
Tested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20210113112052.17063-2-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/dwc2/hcd.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index a5c8329fd4625..56a35e0160392 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -1512,19 +1512,20 @@ static void dwc2_hc_start_transfer(struct dwc2_hsotg *hsotg,
 			if (num_packets > max_hc_pkt_count) {
 				num_packets = max_hc_pkt_count;
 				chan->xfer_len = num_packets * chan->max_packet;
+			} else if (chan->ep_is_in) {
+				/*
+				 * Always program an integral # of max packets
+				 * for IN transfers.
+				 * Note: This assumes that the input buffer is
+				 * aligned and sized accordingly.
+				 */
+				chan->xfer_len = num_packets * chan->max_packet;
 			}
 		} else {
 			/* Need 1 packet for transfer length of 0 */
 			num_packets = 1;
 		}
 
-		if (chan->ep_is_in)
-			/*
-			 * Always program an integral # of max packets for IN
-			 * transfers
-			 */
-			chan->xfer_len = num_packets * chan->max_packet;
-
 		if (chan->ep_type == USB_ENDPOINT_XFER_INT ||
 		    chan->ep_type == USB_ENDPOINT_XFER_ISOC)
 			/*
-- 
2.27.0




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

* [PATCH 4.19 048/247] usb: dwc2: Abort transaction after errors with unknown reason
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (46 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 047/247] usb: dwc2: Do not update data length if it is 0 on inbound transfers Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 049/247] usb: dwc2: Make "trimming xfer length" a debug message Greg Kroah-Hartman
                   ` (201 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Boris ARZUR, Douglas Anderson,
	Nicolas Saenz Julienne, Guenter Roeck, Sasha Levin

From: Guenter Roeck <linux@roeck-us.net>

[ Upstream commit f74b68c61cbc4b2245022fcce038509333d63f6f ]

In some situations, the following error messages are reported.

dwc2 ff540000.usb: dwc2_hc_chhltd_intr_dma: Channel 1 - ChHltd set, but reason is unknown
dwc2 ff540000.usb: hcint 0x00000002, intsts 0x04000021

This is sometimes followed by:

dwc2 ff540000.usb: dwc2_update_urb_state_abn(): trimming xfer length

and then:

WARNING: CPU: 0 PID: 0 at kernel/v4.19/drivers/usb/dwc2/hcd.c:2913
			dwc2_assign_and_init_hc+0x98c/0x990

The warning suggests that an odd buffer address is to be used for DMA.

After an error is observed, the receive buffer may be full
(urb->actual_length >= urb->length). However, the urb is still left in
the queue unless three errors were observed in a row. When it is queued
again, the dwc2 hcd code translates this into a 1-block transfer.
If urb->actual_length (ie the total expected receive length) is not
DMA-aligned, the buffer pointer programmed into the chip will be
unaligned. This results in the observed warning.

To solve the problem, abort input transactions after an error with
unknown cause if the entire packet was already received. This may be
a bit drastic, but we don't really know why the transfer was aborted
even though the entire packet was received. Aborting the transfer in
this situation is less risky than accepting a potentially corrupted
packet.

With this patch in place, the 'ChHltd set' and 'trimming xfer length'
messages are still observed, but there are no more transfer attempts
with odd buffer addresses.

Fixes: 151d0cbdbe860 ("usb: dwc2: make the scheduler handle excessive NAKs better")
Cc: Boris ARZUR <boris@konbu.org>
Cc: Douglas Anderson <dianders@chromium.org>
Tested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20210113112052.17063-3-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/dwc2/hcd_intr.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c
index a052d39b4375e..12819e019e13c 100644
--- a/drivers/usb/dwc2/hcd_intr.c
+++ b/drivers/usb/dwc2/hcd_intr.c
@@ -1977,6 +1977,18 @@ error:
 		qtd->error_count++;
 		dwc2_update_urb_state_abn(hsotg, chan, chnum, qtd->urb,
 					  qtd, DWC2_HC_XFER_XACT_ERR);
+		/*
+		 * We can get here after a completed transaction
+		 * (urb->actual_length >= urb->length) which was not reported
+		 * as completed. If that is the case, and we do not abort
+		 * the transfer, a transfer of size 0 will be enqueued
+		 * subsequently. If urb->actual_length is not DMA-aligned,
+		 * the buffer will then point to an unaligned address, and
+		 * the resulting behavior is undefined. Bail out in that
+		 * situation.
+		 */
+		if (qtd->urb->actual_length >= qtd->urb->length)
+			qtd->error_count = 3;
 		dwc2_hcd_save_data_toggle(hsotg, chan, chnum, qtd);
 		dwc2_halt_channel(hsotg, chan, qtd, DWC2_HC_XFER_XACT_ERR);
 	}
-- 
2.27.0




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

* [PATCH 4.19 049/247] usb: dwc2: Make "trimming xfer length" a debug message
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (47 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 048/247] usb: dwc2: Abort transaction after errors with unknown reason Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 050/247] staging: rtl8723bs: wifi_regd.c: Fix incorrect number of regulatory rules Greg Kroah-Hartman
                   ` (200 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Nicolas Saenz Julienne,
	Douglas Anderson, Guenter Roeck, Sasha Levin

From: Guenter Roeck <linux@roeck-us.net>

[ Upstream commit 1a9e38cabd80356ffb98c2c88fec528ea9644fd5 ]

With some USB network adapters, such as DM96xx, the following message
is seen for each maximum size receive packet.

dwc2 ff540000.usb: dwc2_update_urb_state(): trimming xfer length

This happens because the packet size requested by the driver is 1522
bytes, wMaxPacketSize is 64, the dwc2 driver configures the chip to
receive 24*64 = 1536 bytes, and the chip does indeed send more than
1522 bytes of data. Since the event does not indicate an error condition,
the message is just noise. Demote it to debug level.

Fixes: 7359d482eb4d3 ("staging: HCD files for the DWC2 driver")
Tested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20210113112052.17063-4-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/dwc2/hcd_intr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c
index 12819e019e13c..d5f4ec1b73b15 100644
--- a/drivers/usb/dwc2/hcd_intr.c
+++ b/drivers/usb/dwc2/hcd_intr.c
@@ -500,7 +500,7 @@ static int dwc2_update_urb_state(struct dwc2_hsotg *hsotg,
 						      &short_read);
 
 	if (urb->actual_length + xfer_length > urb->length) {
-		dev_warn(hsotg->dev, "%s(): trimming xfer length\n", __func__);
+		dev_dbg(hsotg->dev, "%s(): trimming xfer length\n", __func__);
 		xfer_length = urb->length - urb->actual_length;
 	}
 
-- 
2.27.0




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

* [PATCH 4.19 050/247] staging: rtl8723bs: wifi_regd.c: Fix incorrect number of regulatory rules
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (48 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 049/247] usb: dwc2: Make "trimming xfer length" a debug message Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 051/247] ARM: dts: armada388-helios4: assign pinctrl to LEDs Greg Kroah-Hartman
                   ` (199 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Chen-Yu Tsai, Sasha Levin

From: Chen-Yu Tsai <wens@csie.org>

[ Upstream commit 61834c967a929f6b4b7fcb91f43fa225cc29aa19 ]

The custom regulatory ruleset in the rtl8723bs driver lists an incorrect
number of rules: one too many. This results in an out-of-bounds access,
as detected by KASAN. This was possible thanks to the newly added support
for KASAN on ARMv7.

Fix this by filling in the correct number of rules given.

KASAN report:

==================================================================
BUG: KASAN: global-out-of-bounds in cfg80211_does_bw_fit_range+0x14/0x4c [cfg80211]
Read of size 4 at addr bf20c254 by task ip/971

CPU: 2 PID: 971 Comm: ip Tainted: G         C        5.11.0-rc2-00020-gf7fe528a7ebe #1
Hardware name: Allwinner sun8i Family
[<c0113338>] (unwind_backtrace) from [<c010e8a4>] (show_stack+0x10/0x14)
[<c010e8a4>] (show_stack) from [<c0e0f868>] (dump_stack+0x9c/0xb4)
[<c0e0f868>] (dump_stack) from [<c0388284>] (print_address_description.constprop.2+0x1dc/0x2dc)
[<c0388284>] (print_address_description.constprop.2) from [<c03885cc>] (kasan_report+0x1a8/0x1c4)
[<c03885cc>] (kasan_report) from [<bf00a354>] (cfg80211_does_bw_fit_range+0x14/0x4c [cfg80211])
[<bf00a354>] (cfg80211_does_bw_fit_range [cfg80211]) from [<bf00b41c>] (freq_reg_info_regd.part.6+0x108/0x124 [>
[<bf00b41c>] (freq_reg_info_regd.part.6 [cfg80211]) from [<bf00df00>] (handle_channel_custom.constprop.12+0x48/>
[<bf00df00>] (handle_channel_custom.constprop.12 [cfg80211]) from [<bf00e150>] (wiphy_apply_custom_regulatory+0>
[<bf00e150>] (wiphy_apply_custom_regulatory [cfg80211]) from [<bf1fb9e8>] (rtw_regd_init+0x60/0x70 [r8723bs])
[<bf1fb9e8>] (rtw_regd_init [r8723bs]) from [<bf1ee5a8>] (rtw_cfg80211_init_wiphy+0x164/0x1e8 [r8723bs])
[<bf1ee5a8>] (rtw_cfg80211_init_wiphy [r8723bs]) from [<bf1f8d50>] (_netdev_open+0xe4/0x28c [r8723bs])
[<bf1f8d50>] (_netdev_open [r8723bs]) from [<bf1f8f58>] (netdev_open+0x60/0x88 [r8723bs])
[<bf1f8f58>] (netdev_open [r8723bs]) from [<c0bb3730>] (__dev_open+0x178/0x220)
[<c0bb3730>] (__dev_open) from [<c0bb3cdc>] (__dev_change_flags+0x258/0x2c4)
[<c0bb3cdc>] (__dev_change_flags) from [<c0bb3d88>] (dev_change_flags+0x40/0x80)
[<c0bb3d88>] (dev_change_flags) from [<c0bc86fc>] (do_setlink+0x538/0x1160)
[<c0bc86fc>] (do_setlink) from [<c0bcf9e8>] (__rtnl_newlink+0x65c/0xad8)
[<c0bcf9e8>] (__rtnl_newlink) from [<c0bcfeb0>] (rtnl_newlink+0x4c/0x6c)
[<c0bcfeb0>] (rtnl_newlink) from [<c0bc67c8>] (rtnetlink_rcv_msg+0x1f8/0x454)
[<c0bc67c8>] (rtnetlink_rcv_msg) from [<c0c330e4>] (netlink_rcv_skb+0xc4/0x1e0)
[<c0c330e4>] (netlink_rcv_skb) from [<c0c32478>] (netlink_unicast+0x2c8/0x3c4)
[<c0c32478>] (netlink_unicast) from [<c0c32894>] (netlink_sendmsg+0x320/0x5f0)
[<c0c32894>] (netlink_sendmsg) from [<c0b75eb0>] (____sys_sendmsg+0x320/0x3e0)
[<c0b75eb0>] (____sys_sendmsg) from [<c0b78394>] (___sys_sendmsg+0xe8/0x12c)
[<c0b78394>] (___sys_sendmsg) from [<c0b78a50>] (__sys_sendmsg+0xc0/0x120)
[<c0b78a50>] (__sys_sendmsg) from [<c0100060>] (ret_fast_syscall+0x0/0x58)
Exception stack(0xc5693fa8 to 0xc5693ff0)
3fa0:                   00000074 c7a39800 00000003 b6cee648 00000000 00000000
3fc0: 00000074 c7a39800 00000001 00000128 78d18349 00000000 b6ceeda0 004f7cb0
3fe0: 00000128 b6cee5e8 aeca151f aec1d746

The buggy address belongs to the variable:
 rtw_drv_halt+0xf908/0x6b4 [r8723bs]

Memory state around the buggy address:
 bf20c100: 00 00 00 00 00 00 00 00 00 00 04 f9 f9 f9 f9 f9
 bf20c180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>bf20c200: 00 00 00 00 00 00 00 00 00 00 04 f9 f9 f9 f9 f9
                                         ^
 bf20c280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 bf20c300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/r/20210108141401.31741-1-wens@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/staging/rtl8723bs/os_dep/wifi_regd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c
index aa2f62acc994d..4dd6f3fb59060 100644
--- a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c
+++ b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c
@@ -39,7 +39,7 @@
 	NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_OFDM)
 
 static const struct ieee80211_regdomain rtw_regdom_rd = {
-	.n_reg_rules = 3,
+	.n_reg_rules = 2,
 	.alpha2 = "99",
 	.reg_rules = {
 		RTW_2GHZ_CH01_11,
-- 
2.27.0




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

* [PATCH 4.19 051/247] ARM: dts: armada388-helios4: assign pinctrl to LEDs
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (49 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 050/247] staging: rtl8723bs: wifi_regd.c: Fix incorrect number of regulatory rules Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 052/247] ARM: dts: armada388-helios4: assign pinctrl to each fan Greg Kroah-Hartman
                   ` (198 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Rosen Penev, Gregory CLEMENT, Sasha Levin

From: Rosen Penev <rosenp@gmail.com>

[ Upstream commit e011c9025a4691b5c734029577a920bd6c320994 ]

Split up the pins to match earlier definitions. Allows LEDs to flash
properly.

Fixes: ced8025b569e ("ARM: dts: armada388-helios4")

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/boot/dts/armada-388-helios4.dts | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/armada-388-helios4.dts b/arch/arm/boot/dts/armada-388-helios4.dts
index 705adfa8c680f..e0fa1391948c1 100644
--- a/arch/arm/boot/dts/armada-388-helios4.dts
+++ b/arch/arm/boot/dts/armada-388-helios4.dts
@@ -70,6 +70,9 @@
 
 	system-leds {
 		compatible = "gpio-leds";
+		pinctrl-names = "default";
+		pinctrl-0 = <&helios_system_led_pins>;
+
 		status-led {
 			label = "helios4:green:status";
 			gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
@@ -86,6 +89,9 @@
 
 	io-leds {
 		compatible = "gpio-leds";
+		pinctrl-names = "default";
+		pinctrl-0 = <&helios_io_led_pins>;
+
 		sata1-led {
 			label = "helios4:green:ata1";
 			gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
@@ -291,9 +297,12 @@
 						       "mpp39", "mpp40";
 					marvell,function = "sd0";
 				};
-				helios_led_pins: helios-led-pins {
-					marvell,pins = "mpp24", "mpp25",
-						       "mpp49", "mpp50",
+				helios_system_led_pins: helios-system-led-pins {
+					marvell,pins = "mpp24", "mpp25";
+					marvell,function = "gpio";
+				};
+				helios_io_led_pins: helios-io-led-pins {
+					marvell,pins = "mpp49", "mpp50",
 						       "mpp52", "mpp53",
 						       "mpp54";
 					marvell,function = "gpio";
-- 
2.27.0




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

* [PATCH 4.19 052/247] ARM: dts: armada388-helios4: assign pinctrl to each fan
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (50 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 051/247] ARM: dts: armada388-helios4: assign pinctrl to LEDs Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 053/247] arm64: dts: msm8916: Fix reserved and rfsa nodes unit address Greg Kroah-Hartman
                   ` (197 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Rosen Penev, Gregory CLEMENT, Sasha Levin

From: Rosen Penev <rosenp@gmail.com>

[ Upstream commit 46ecdfc1830eaa40a11d7f832089c82b0e67ea96 ]

Split up the pins for each fan. This is needed in order to control them

Fixes: ced8025b569e ("ARM: dts: armada388-helios4")

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/boot/dts/armada-388-helios4.dts | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/armada-388-helios4.dts b/arch/arm/boot/dts/armada-388-helios4.dts
index e0fa1391948c1..a94758090fb0d 100644
--- a/arch/arm/boot/dts/armada-388-helios4.dts
+++ b/arch/arm/boot/dts/armada-388-helios4.dts
@@ -127,11 +127,15 @@
 	fan1: j10-pwm {
 		compatible = "pwm-fan";
 		pwms = <&gpio1 9 40000>;	/* Target freq:25 kHz */
+		pinctrl-names = "default";
+		pinctrl-0 = <&helios_fan1_pins>;
 	};
 
 	fan2: j17-pwm {
 		compatible = "pwm-fan";
 		pwms = <&gpio1 23 40000>;	/* Target freq:25 kHz */
+		pinctrl-names = "default";
+		pinctrl-0 = <&helios_fan2_pins>;
 	};
 
 	usb2_phy: usb2-phy {
@@ -307,9 +311,12 @@
 						       "mpp54";
 					marvell,function = "gpio";
 				};
-				helios_fan_pins: helios-fan-pins {
-					marvell,pins = "mpp41", "mpp43",
-						       "mpp48", "mpp55";
+				helios_fan1_pins: helios_fan1_pins {
+					marvell,pins = "mpp41", "mpp43";
+					marvell,function = "gpio";
+				};
+				helios_fan2_pins: helios_fan2_pins {
+					marvell,pins = "mpp48", "mpp55";
 					marvell,function = "gpio";
 				};
 				microsom_spi1_cs_pins: spi1-cs-pins {
-- 
2.27.0




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

* [PATCH 4.19 053/247] arm64: dts: msm8916: Fix reserved and rfsa nodes unit address
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (51 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 052/247] ARM: dts: armada388-helios4: assign pinctrl to each fan Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 054/247] ARM: s3c: fix fiq for clang IAS Greg Kroah-Hartman
                   ` (196 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Vincent Knecht, Bjorn Andersson, Sasha Levin

From: Vincent Knecht <vincent.knecht@mailoo.org>

[ Upstream commit d5ae2528b0b56cf054b27d48b0cb85330900082f ]

Fix `reserved` and `rfsa` unit address according to their reg address

Fixes: 7258e10e6a0b ("ARM: dts: msm8916: Update reserved-memory")

Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org>
Link: https://lore.kernel.org/r/20210123104417.518105-1-vincent.knecht@mailoo.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm64/boot/dts/qcom/msm8916.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi
index 2c5193ae20277..ba42c62399226 100644
--- a/arch/arm64/boot/dts/qcom/msm8916.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi
@@ -64,7 +64,7 @@
 			no-map;
 		};
 
-		reserved@8668000 {
+		reserved@86680000 {
 			reg = <0x0 0x86680000 0x0 0x80000>;
 			no-map;
 		};
@@ -77,7 +77,7 @@
 			qcom,client-id = <1>;
 		};
 
-		rfsa@867e00000 {
+		rfsa@867e0000 {
 			reg = <0x0 0x867e0000 0x0 0x20000>;
 			no-map;
 		};
-- 
2.27.0




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

* [PATCH 4.19 054/247] ARM: s3c: fix fiq for clang IAS
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (52 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 053/247] arm64: dts: msm8916: Fix reserved and rfsa nodes unit address Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 055/247] soc: aspeed: snoop: Add clock control logic Greg Kroah-Hartman
                   ` (195 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Stefan Agner, Arnd Bergmann,
	Nick Desaulniers, Nathan Chancellor, Krzysztof Kozlowski,
	Sasha Levin

From: Arnd Bergmann <arnd@arndb.de>

[ Upstream commit 7f9942c61fa60eda7cc8e42f04bd25b7d175876e ]

Building with the clang integrated assembler produces a couple of
errors for the s3c24xx fiq support:

  arch/arm/mach-s3c/irq-s3c24xx-fiq.S:52:2: error: instruction 'subne' can not set flags, but 's' suffix specified
    subnes pc, lr, #4 @@ return, still have work to do

  arch/arm/mach-s3c/irq-s3c24xx-fiq.S:64:1: error: invalid symbol redefinition
    s3c24xx_spi_fiq_txrx:

There are apparently two problems: one with extraneous or duplicate
labels, and one with old-style opcode mnemonics. Stefan Agner has
previously fixed other problems like this, but missed this particular
file.

Fixes: bec0806cfec6 ("spi_s3c24xx: add FIQ pseudo-DMA support")
Cc: Stefan Agner <stefan@agner.ch>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20210204162416.3030114-1-arnd@kernel.org
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/spi/spi-s3c24xx-fiq.S | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi-s3c24xx-fiq.S b/drivers/spi/spi-s3c24xx-fiq.S
index 059f2dc1fda2d..1565c792da079 100644
--- a/drivers/spi/spi-s3c24xx-fiq.S
+++ b/drivers/spi/spi-s3c24xx-fiq.S
@@ -36,7 +36,6 @@
 	@ and an offset to the irq acknowledgment word
 
 ENTRY(s3c24xx_spi_fiq_rx)
-s3c24xx_spi_fix_rx:
 	.word	fiq_rx_end - fiq_rx_start
 	.word	fiq_rx_irq_ack - fiq_rx_start
 fiq_rx_start:
@@ -50,7 +49,7 @@ fiq_rx_start:
 	strb	fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
 
 	subs	fiq_rcount, fiq_rcount, #1
-	subnes	pc, lr, #4		@@ return, still have work to do
+	subsne	pc, lr, #4		@@ return, still have work to do
 
 	@@ set IRQ controller so that next op will trigger IRQ
 	mov	fiq_rtmp, #0
@@ -62,7 +61,6 @@ fiq_rx_irq_ack:
 fiq_rx_end:
 
 ENTRY(s3c24xx_spi_fiq_txrx)
-s3c24xx_spi_fiq_txrx:
 	.word	fiq_txrx_end - fiq_txrx_start
 	.word	fiq_txrx_irq_ack - fiq_txrx_start
 fiq_txrx_start:
@@ -77,7 +75,7 @@ fiq_txrx_start:
 	strb	fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
 
 	subs	fiq_rcount, fiq_rcount, #1
-	subnes	pc, lr, #4		@@ return, still have work to do
+	subsne	pc, lr, #4		@@ return, still have work to do
 
 	mov	fiq_rtmp, #0
 	str	fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD  - S3C24XX_VA_IRQ ]
@@ -89,7 +87,6 @@ fiq_txrx_irq_ack:
 fiq_txrx_end:
 
 ENTRY(s3c24xx_spi_fiq_tx)
-s3c24xx_spi_fix_tx:
 	.word	fiq_tx_end - fiq_tx_start
 	.word	fiq_tx_irq_ack - fiq_tx_start
 fiq_tx_start:
@@ -102,7 +99,7 @@ fiq_tx_start:
 	strb	fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
 
 	subs	fiq_rcount, fiq_rcount, #1
-	subnes	pc, lr, #4		@@ return, still have work to do
+	subsne	pc, lr, #4		@@ return, still have work to do
 
 	mov	fiq_rtmp, #0
 	str	fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD  - S3C24XX_VA_IRQ ]
-- 
2.27.0




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

* [PATCH 4.19 055/247] soc: aspeed: snoop: Add clock control logic
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (53 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 054/247] ARM: s3c: fix fiq for clang IAS Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 22:44   ` Joel Stanley
  2021-03-01 16:11 ` [PATCH 4.19 056/247] bpf_lru_list: Read double-checked variable once without lock Greg Kroah-Hartman
                   ` (194 subsequent siblings)
  249 siblings, 1 reply; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jae Hyun Yoo, Vernon Mauery,
	John Wang, Joel Stanley, Sasha Levin

From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>

[ Upstream commit 3f94cf15583be554df7aaa651b8ff8e1b68fbe51 ]

If LPC SNOOP driver is registered ahead of lpc-ctrl module, LPC
SNOOP block will be enabled without heart beating of LCLK until
lpc-ctrl enables the LCLK. This issue causes improper handling on
host interrupts when the host sends interrupt in that time frame.
Then kernel eventually forcibly disables the interrupt with
dumping stack and printing a 'nobody cared this irq' message out.

To prevent this issue, all LPC sub-nodes should enable LCLK
individually so this patch adds clock control logic into the LPC
SNOOP driver.

Fixes: 3772e5da4454 ("drivers/misc: Aspeed LPC snoop output using misc chardev")
Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
Signed-off-by: John Wang <wangzhiqiang.bj@bytedance.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Link: https://lore.kernel.org/r/20201208091748.1920-1-wangzhiqiang.bj@bytedance.com
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/misc/aspeed-lpc-snoop.c | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/aspeed-lpc-snoop.c b/drivers/misc/aspeed-lpc-snoop.c
index c10be21a1663d..b4a776bf44bc5 100644
--- a/drivers/misc/aspeed-lpc-snoop.c
+++ b/drivers/misc/aspeed-lpc-snoop.c
@@ -15,6 +15,7 @@
  */
 
 #include <linux/bitops.h>
+#include <linux/clk.h>
 #include <linux/interrupt.h>
 #include <linux/fs.h>
 #include <linux/kfifo.h>
@@ -71,6 +72,7 @@ struct aspeed_lpc_snoop_channel {
 struct aspeed_lpc_snoop {
 	struct regmap		*regmap;
 	int			irq;
+	struct clk		*clk;
 	struct aspeed_lpc_snoop_channel chan[NUM_SNOOP_CHANNELS];
 };
 
@@ -286,22 +288,42 @@ static int aspeed_lpc_snoop_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
+	lpc_snoop->clk = devm_clk_get(dev, NULL);
+	if (IS_ERR(lpc_snoop->clk)) {
+		rc = PTR_ERR(lpc_snoop->clk);
+		if (rc != -EPROBE_DEFER)
+			dev_err(dev, "couldn't get clock\n");
+		return rc;
+	}
+	rc = clk_prepare_enable(lpc_snoop->clk);
+	if (rc) {
+		dev_err(dev, "couldn't enable clock\n");
+		return rc;
+	}
+
 	rc = aspeed_lpc_snoop_config_irq(lpc_snoop, pdev);
 	if (rc)
-		return rc;
+		goto err;
 
 	rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 0, port);
 	if (rc)
-		return rc;
+		goto err;
 
 	/* Configuration of 2nd snoop channel port is optional */
 	if (of_property_read_u32_index(dev->of_node, "snoop-ports",
 				       1, &port) == 0) {
 		rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 1, port);
-		if (rc)
+		if (rc) {
 			aspeed_lpc_disable_snoop(lpc_snoop, 0);
+			goto err;
+		}
 	}
 
+	return 0;
+
+err:
+	clk_disable_unprepare(lpc_snoop->clk);
+
 	return rc;
 }
 
@@ -313,6 +335,8 @@ static int aspeed_lpc_snoop_remove(struct platform_device *pdev)
 	aspeed_lpc_disable_snoop(lpc_snoop, 0);
 	aspeed_lpc_disable_snoop(lpc_snoop, 1);
 
+	clk_disable_unprepare(lpc_snoop->clk);
+
 	return 0;
 }
 
-- 
2.27.0




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

* [PATCH 4.19 056/247] bpf_lru_list: Read double-checked variable once without lock
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (54 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 055/247] soc: aspeed: snoop: Add clock control logic Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 057/247] ath9k: fix data bus crash when setting nf_override via debugfs Greg Kroah-Hartman
                   ` (193 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, syzbot+3536db46dfa58c573458,
	syzbot+516acdb03d3e27d91bcd, Marco Elver, Andrii Nakryiko,
	Martin KaFai Lau, Sasha Levin

From: Marco Elver <elver@google.com>

[ Upstream commit 6df8fb83301d68ea0a0c0e1cbcc790fcc333ed12 ]

For double-checked locking in bpf_common_lru_push_free(), node->type is
read outside the critical section and then re-checked under the lock.
However, concurrent writes to node->type result in data races.

For example, the following concurrent access was observed by KCSAN:

  write to 0xffff88801521bc22 of 1 bytes by task 10038 on cpu 1:
   __bpf_lru_node_move_in        kernel/bpf/bpf_lru_list.c:91
   __local_list_flush            kernel/bpf/bpf_lru_list.c:298
   ...
  read to 0xffff88801521bc22 of 1 bytes by task 10043 on cpu 0:
   bpf_common_lru_push_free      kernel/bpf/bpf_lru_list.c:507
   bpf_lru_push_free             kernel/bpf/bpf_lru_list.c:555
   ...

Fix the data races where node->type is read outside the critical section
(for double-checked locking) by marking the access with READ_ONCE() as
well as ensuring the variable is only accessed once.

Fixes: 3a08c2fd7634 ("bpf: LRU List")
Reported-by: syzbot+3536db46dfa58c573458@syzkaller.appspotmail.com
Reported-by: syzbot+516acdb03d3e27d91bcd@syzkaller.appspotmail.com
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20210209112701.3341724-1-elver@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/bpf/bpf_lru_list.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/bpf/bpf_lru_list.c b/kernel/bpf/bpf_lru_list.c
index e6ef4401a1380..9b5eeff72fd37 100644
--- a/kernel/bpf/bpf_lru_list.c
+++ b/kernel/bpf/bpf_lru_list.c
@@ -505,13 +505,14 @@ struct bpf_lru_node *bpf_lru_pop_free(struct bpf_lru *lru, u32 hash)
 static void bpf_common_lru_push_free(struct bpf_lru *lru,
 				     struct bpf_lru_node *node)
 {
+	u8 node_type = READ_ONCE(node->type);
 	unsigned long flags;
 
-	if (WARN_ON_ONCE(node->type == BPF_LRU_LIST_T_FREE) ||
-	    WARN_ON_ONCE(node->type == BPF_LRU_LOCAL_LIST_T_FREE))
+	if (WARN_ON_ONCE(node_type == BPF_LRU_LIST_T_FREE) ||
+	    WARN_ON_ONCE(node_type == BPF_LRU_LOCAL_LIST_T_FREE))
 		return;
 
-	if (node->type == BPF_LRU_LOCAL_LIST_T_PENDING) {
+	if (node_type == BPF_LRU_LOCAL_LIST_T_PENDING) {
 		struct bpf_lru_locallist *loc_l;
 
 		loc_l = per_cpu_ptr(lru->common_lru.local_list, node->cpu);
-- 
2.27.0




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

* [PATCH 4.19 057/247] ath9k: fix data bus crash when setting nf_override via debugfs
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (55 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 056/247] bpf_lru_list: Read double-checked variable once without lock Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 058/247] ibmvnic: Set to CLOSED state even on error Greg Kroah-Hartman
                   ` (192 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Simon Wunderlich, Linus Lüssing,
	Kalle Valo, Sasha Levin

From: Linus Lüssing <ll@simonwunderlich.de>

[ Upstream commit 12c8f3d1cdd84f01ee777b756db9dddc1f1c9d17 ]

When trying to set the noise floor via debugfs, a "data bus error"
crash like the following can happen:

[   88.433133] Data bus error, epc == 80221c28, ra == 83314e60
[   88.438895] Oops[#1]:
[   88.441246] CPU: 0 PID: 7263 Comm: sh Not tainted 4.14.195 #0
[   88.447174] task: 838a1c20 task.stack: 82d5e000
[   88.451847] $ 0   : 00000000 00000030 deadc0de 83141de4
[   88.457248] $ 4   : b810a2c4 0000a2c4 83230fd4 00000000
[   88.462652] $ 8   : 0000000a 00000000 00000001 00000000
[   88.468055] $12   : 7f8ef318 00000000 00000000 77f802a0
[   88.473457] $16   : 83230080 00000002 0000001b 83230080
[   88.478861] $20   : 83a1c3f8 00841000 77f7adb0 ffffff92
[   88.484263] $24   : 00000fa4 77edd860
[   88.489665] $28   : 82d5e000 82d5fda8 00000000 83314e60
[   88.495070] Hi    : 00000000
[   88.498044] Lo    : 00000000
[   88.501040] epc   : 80221c28 ioread32+0x8/0x10
[   88.505671] ra    : 83314e60 ath9k_hw_loadnf+0x88/0x520 [ath9k_hw]
[   88.512049] Status: 1000fc03 KERNEL EXL IE
[   88.516369] Cause : 5080801c (ExcCode 07)
[   88.520508] PrId  : 00019374 (MIPS 24Kc)
[   88.524556] Modules linked in: ath9k ath9k_common pppoe ppp_async l2tp_ppp cdc_mbim batman_adv ath9k_hw ath sr9700 smsc95xx sierra_net rndis_host qmi_wwan pppox ppp_generic pl2303 nf_conntrack_ipv6 mcs7830 mac80211 kalmia iptable_nat ipt_REJECT ipt_MASQUERADE huawei_cdc_ncm ftdi_sio dm9601 cfg80211 cdc_subset cdc_ncm cdc_ether cdc_eem ax88179_178a asix xt_time xt_tcpudp xt_tcpmss xt_statistic xt_state xt_nat xt_multiport xt_mark xt_mac xt_limit xt_length xt_hl xt_ecn xt_dscp xt_conntrack xt_comment xt_TCPMSS xt_REDIRECT xt_NETMAP xt_LOG xt_HL xt_FLOWOFFLOAD xt_DSCP xt_CLASSIFY usbserial usbnet usbhid slhc rtl8150 r8152 pegasus nf_reject_ipv4 nf_nat_redirect nf_nat_masquerade_ipv4 nf_conntrack_ipv4 nf_nat_ipv4 nf_nat nf_log_ipv4 nf_flow_table_hw nf_flow_table nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrack
[   88.597894]  libcrc32c kaweth iptable_mangle iptable_filter ipt_ECN ipheth ip_tables hso hid_generic crc_ccitt compat cdc_wdm cdc_acm br_netfilter hid evdev input_core nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables ip6t_REJECT x_tables nf_reject_ipv6 l2tp_netlink l2tp_core udp_tunnel ip6_udp_tunnel xfrm6_mode_tunnel xfrm6_mode_transport xfrm6_mode_beet ipcomp6 xfrm6_tunnel esp6 ah6 xfrm4_tunnel xfrm4_mode_tunnel xfrm4_mode_transport xfrm4_mode_beet ipcomp esp4 ah4 tunnel6 tunnel4 tun xfrm_user xfrm_ipcomp af_key xfrm_algo sha256_generic sha1_generic jitterentropy_rng drbg md5 hmac echainiv des_generic deflate zlib_inflate zlib_deflate cbc authenc crypto_acompress ehci_platform ehci_hcd gpio_button_hotplug usbcore nls_base usb_common crc16 mii aead crypto_null cryptomgr crc32c_generic
[   88.671671]  crypto_hash
[   88.674292] Process sh (pid: 7263, threadinfo=82d5e000, task=838a1c20, tls=77f81efc)
[   88.682279] Stack : 00008060 00000008 00000200 00000000 00000000 00000000 00000000 00000002
[   88.690916]         80500000 83230080 82d5fe22 00841000 77f7adb0 00000000 00000000 83156858
[   88.699553]         00000000 8352fa00 83ad62b0 835302a8 00000000 300a00f8 00000003 82d5fe38
[   88.708190]         82d5fef4 00000001 77f54dc4 77f80000 77f7adb0 c79fe901 00000000 00000000
[   88.716828]         80510000 00000002 00841000 77f54dc4 77f80000 801ce4cc 0000000b 41824292
[   88.725465]         ...
[   88.727994] Call Trace:
[   88.730532] [<80221c28>] ioread32+0x8/0x10
[   88.734765] Code: 00000000  8c820000  0000000f <03e00008> 00000000  08088708  00000000  aca40000  03e00008
[   88.744846]
[   88.746464] ---[ end trace db226b2de1b69b9e ]---
[   88.753477] Kernel panic - not syncing: Fatal exception
[   88.759981] Rebooting in 3 seconds..

The "REG_READ(ah, AR_PHY_AGC_CONTROL)" in ath9k_hw_loadnf() does not
like being called when the hardware is asleep, leading to this crash.

The easiest way to reproduce this is trying to set nf_override while
the hardware is down:

  $ ip link set down dev wlan0
  $ echo "-85" > /sys/kernel/debug/ieee80211/phy0/ath9k/nf_override

Fixing this crash by waking the hardware up before trying to set the
noise floor. Similar to what other ath9k debugfs files do.

Tested on a Lima board from 8devices, which has a QCA 4531 chipset.

Fixes: b90189759a7f ("ath9k: add noise floor override option")
Cc: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Linus Lüssing <ll@simonwunderlich.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210209184352.4272-1-linus.luessing@c0d3.blue
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/wireless/ath/ath9k/debug.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 0a6eb8a8c1ed0..84fe686709496 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1236,8 +1236,11 @@ static ssize_t write_file_nf_override(struct file *file,
 
 	ah->nf_override = val;
 
-	if (ah->curchan)
+	if (ah->curchan) {
+		ath9k_ps_wakeup(sc);
 		ath9k_hw_loadnf(ah, ah->curchan);
+		ath9k_ps_restore(sc);
+	}
 
 	return count;
 }
-- 
2.27.0




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

* [PATCH 4.19 058/247] ibmvnic: Set to CLOSED state even on error
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (56 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 057/247] ath9k: fix data bus crash when setting nf_override via debugfs Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 059/247] bnxt_en: reverse order of TX disable and carrier off Greg Kroah-Hartman
                   ` (191 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sukadev Bhattiprolu, Abdul Haleem,
	David S. Miller, Sasha Levin

From: Sukadev Bhattiprolu <sukadev@linux.ibm.com>

[ Upstream commit d4083d3c00f60a09ad82e3bf17ff57fec69c8aa6 ]

If set_link_state() fails for any reason, we still cleanup the adapter
state and cannot recover from a partial close anyway. So set the adapter
to CLOSED state. That way if a new soft/hard reset is processed, the
adapter will remain in the CLOSED state until the next ibmvnic_open().

Fixes: 01d9bd792d16 ("ibmvnic: Reorganize device close")
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Reported-by: Abdul Haleem <abdhalee@in.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 68d5971c200a1..5518b56c2a967 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1257,10 +1257,8 @@ static int __ibmvnic_close(struct net_device *netdev)
 
 	adapter->state = VNIC_CLOSING;
 	rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_DN);
-	if (rc)
-		return rc;
 	adapter->state = VNIC_CLOSED;
-	return 0;
+	return rc;
 }
 
 static int ibmvnic_close(struct net_device *netdev)
-- 
2.27.0




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

* [PATCH 4.19 059/247] bnxt_en: reverse order of TX disable and carrier off
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (57 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 058/247] ibmvnic: Set to CLOSED state even on error Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 060/247] xen/netback: fix spurious event detection for common event case Greg Kroah-Hartman
                   ` (190 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Edwin Peer, Michael Chan,
	David S. Miller, Sasha Levin

From: Edwin Peer <edwin.peer@broadcom.com>

[ Upstream commit 132e0b65dc2b8bfa9721bfce834191f24fd1d7ed ]

A TX queue can potentially immediately timeout after it is stopped
and the last TX timestamp on that queue was more than 5 seconds ago with
carrier still up.  Prevent these intermittent false TX timeouts
by bringing down carrier first before calling netif_tx_disable().

Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.")
Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index db1a23b8d531d..44ed2f6e2d96c 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -6298,9 +6298,10 @@ void bnxt_tx_disable(struct bnxt *bp)
 			txr->dev_state = BNXT_DEV_STATE_CLOSING;
 		}
 	}
+	/* Drop carrier first to prevent TX timeout */
+	netif_carrier_off(bp->dev);
 	/* Stop all TX queues */
 	netif_tx_disable(bp->dev);
-	netif_carrier_off(bp->dev);
 }
 
 void bnxt_tx_enable(struct bnxt *bp)
-- 
2.27.0




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

* [PATCH 4.19 060/247] xen/netback: fix spurious event detection for common event case
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (58 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 059/247] bnxt_en: reverse order of TX disable and carrier off Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 061/247] mac80211: fix potential overflow when multiplying to u32 integers Greg Kroah-Hartman
                   ` (189 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Juergen Gross, Jan Beulich,
	Paul Durrant, Wei Liu, David S. Miller, Sasha Levin

From: Juergen Gross <jgross@suse.com>

[ Upstream commit a3daf3d39132b405781be8d9ede0c449b244b64e ]

In case of a common event for rx and tx queue the event should be
regarded to be spurious if no rx and no tx requests are pending.

Unfortunately the condition for testing that is wrong causing to
decide a event being spurious if no rx OR no tx requests are
pending.

Fix that plus using local variables for rx/tx pending indicators in
order to split function calls and if condition.

Fixes: 23025393dbeb3b ("xen/netback: use lateeoi irq binding")
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul@xen.org>
Reviewed-by: Wei Liu <wl@xen.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/xen-netback/interface.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
index c960cb7e3251f..3b5fdb24ef1b9 100644
--- a/drivers/net/xen-netback/interface.c
+++ b/drivers/net/xen-netback/interface.c
@@ -162,13 +162,15 @@ irqreturn_t xenvif_interrupt(int irq, void *dev_id)
 {
 	struct xenvif_queue *queue = dev_id;
 	int old;
+	bool has_rx, has_tx;
 
 	old = atomic_fetch_or(NETBK_COMMON_EOI, &queue->eoi_pending);
 	WARN(old, "Interrupt while EOI pending\n");
 
-	/* Use bitwise or as we need to call both functions. */
-	if ((!xenvif_handle_tx_interrupt(queue) |
-	     !xenvif_handle_rx_interrupt(queue))) {
+	has_tx = xenvif_handle_tx_interrupt(queue);
+	has_rx = xenvif_handle_rx_interrupt(queue);
+
+	if (!has_rx && !has_tx) {
 		atomic_andnot(NETBK_COMMON_EOI, &queue->eoi_pending);
 		xen_irq_lateeoi(irq, XEN_EOI_FLAG_SPURIOUS);
 	}
-- 
2.27.0




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

* [PATCH 4.19 061/247] mac80211: fix potential overflow when multiplying to u32 integers
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (59 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 060/247] xen/netback: fix spurious event detection for common event case Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 062/247] bpf: Fix bpf_fib_lookup helper MTU check for SKB ctx Greg Kroah-Hartman
                   ` (188 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Colin Ian King, Johannes Berg, Sasha Levin

From: Colin Ian King <colin.king@canonical.com>

[ Upstream commit 6194f7e6473be78acdc5d03edd116944bdbb2c4e ]

The multiplication of the u32 variables tx_time and estimated_retx is
performed using a 32 bit multiplication and the result is stored in
a u64 result. This has a potential u32 overflow issue, so avoid this
by casting tx_time to a u64 to force a 64 bit multiply.

Addresses-Coverity: ("Unintentional integer overflow")
Fixes: 050ac52cbe1f ("mac80211: code for on-demand Hybrid Wireless Mesh Protocol")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210205175352.208841-1-colin.king@canonical.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/mac80211/mesh_hwmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 6219b6b0c7e17..18158855d98c4 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -355,7 +355,7 @@ static u32 airtime_link_metric_get(struct ieee80211_local *local,
 	 */
 	tx_time = (device_constant + 10 * test_frame_len / rate);
 	estimated_retx = ((1 << (2 * ARITH_SHIFT)) / (s_unit - err));
-	result = (tx_time * estimated_retx) >> (2 * ARITH_SHIFT);
+	result = ((u64)tx_time * estimated_retx) >> (2 * ARITH_SHIFT);
 	return (u32)result;
 }
 
-- 
2.27.0




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

* [PATCH 4.19 062/247] bpf: Fix bpf_fib_lookup helper MTU check for SKB ctx
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (60 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 061/247] mac80211: fix potential overflow when multiplying to u32 integers Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 063/247] tcp: fix SO_RCVLOWAT related hangs under mem pressure Greg Kroah-Hartman
                   ` (187 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Carlo Carraro,
	Jesper Dangaard Brouer, Daniel Borkmann, Sasha Levin

From: Jesper Dangaard Brouer <brouer@redhat.com>

[ Upstream commit 2c0a10af688c02adcf127aad29e923e0056c6b69 ]

BPF end-user on Cilium slack-channel (Carlo Carraro) wants to use
bpf_fib_lookup for doing MTU-check, but *prior* to extending packet size,
by adjusting fib_params 'tot_len' with the packet length plus the expected
encap size. (Just like the bpf_check_mtu helper supports). He discovered
that for SKB ctx the param->tot_len was not used, instead skb->len was used
(via MTU check in is_skb_forwardable() that checks against netdev MTU).

Fix this by using fib_params 'tot_len' for MTU check. If not provided (e.g.
zero) then keep existing TC behaviour intact. Notice that 'tot_len' for MTU
check is done like XDP code-path, which checks against FIB-dst MTU.

V16:
- Revert V13 optimization, 2nd lookup is against egress/resulting netdev

V13:
- Only do ifindex lookup one time, calling dev_get_by_index_rcu().

V10:
- Use same method as XDP for 'tot_len' MTU check

Fixes: 4c79579b44b1 ("bpf: Change bpf_fib_lookup to return lookup status")
Reported-by: Carlo Carraro <colrack@gmail.com>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/161287789444.790810.15247494756551413508.stgit@firesoul
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/core/filter.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/net/core/filter.c b/net/core/filter.c
index 557bd5cc8f94c..bbf5dbb95644d 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -4500,6 +4500,7 @@ BPF_CALL_4(bpf_skb_fib_lookup, struct sk_buff *, skb,
 {
 	struct net *net = dev_net(skb->dev);
 	int rc = -EAFNOSUPPORT;
+	bool check_mtu = false;
 
 	if (plen < sizeof(*params))
 		return -EINVAL;
@@ -4507,22 +4508,28 @@ BPF_CALL_4(bpf_skb_fib_lookup, struct sk_buff *, skb,
 	if (flags & ~(BPF_FIB_LOOKUP_DIRECT | BPF_FIB_LOOKUP_OUTPUT))
 		return -EINVAL;
 
+	if (params->tot_len)
+		check_mtu = true;
+
 	switch (params->family) {
 #if IS_ENABLED(CONFIG_INET)
 	case AF_INET:
-		rc = bpf_ipv4_fib_lookup(net, params, flags, false);
+		rc = bpf_ipv4_fib_lookup(net, params, flags, check_mtu);
 		break;
 #endif
 #if IS_ENABLED(CONFIG_IPV6)
 	case AF_INET6:
-		rc = bpf_ipv6_fib_lookup(net, params, flags, false);
+		rc = bpf_ipv6_fib_lookup(net, params, flags, check_mtu);
 		break;
 #endif
 	}
 
-	if (!rc) {
+	if (rc == BPF_FIB_LKUP_RET_SUCCESS && !check_mtu) {
 		struct net_device *dev;
 
+		/* When tot_len isn't provided by user, check skb
+		 * against MTU of FIB lookup resulting net_device
+		 */
 		dev = dev_get_by_index_rcu(net, params->ifindex);
 		if (!is_skb_forwardable(dev, skb))
 			rc = BPF_FIB_LKUP_RET_FRAG_NEEDED;
-- 
2.27.0




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

* [PATCH 4.19 063/247] tcp: fix SO_RCVLOWAT related hangs under mem pressure
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (61 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 062/247] bpf: Fix bpf_fib_lookup helper MTU check for SKB ctx Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 064/247] cxgb4/chtls/cxgbit: Keeping the max ofld immediate data size same in cxgb4 and ulds Greg Kroah-Hartman
                   ` (186 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Eric Dumazet, Arjun Roy, Wei Wang,
	David S. Miller, Sasha Levin

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit f969dc5a885736842c3511ecdea240fbb02d25d9 ]

While commit 24adbc1676af ("tcp: fix SO_RCVLOWAT hangs with fat skbs")
fixed an issue vs too small sk_rcvbuf for given sk_rcvlowat constraint,
it missed to address issue caused by memory pressure.

1) If we are under memory pressure and socket receive queue is empty.
First incoming packet is allowed to be queued, after commit
76dfa6082032 ("tcp: allow one skb to be received per socket under memory pressure")

But we do not send EPOLLIN yet, in case tcp_data_ready() sees sk_rcvlowat
is bigger than skb length.

2) Then, when next packet comes, it is dropped, and we directly
call sk->sk_data_ready().

3) If application is using poll(), tcp_poll() will then use
tcp_stream_is_readable() and decide the socket receive queue is
not yet filled, so nothing will happen.

Even when sender retransmits packets, phases 2) & 3) repeat
and flow is effectively frozen, until memory pressure is off.

Fix is to consider tcp_under_memory_pressure() to take care
of global memory pressure or memcg pressure.

Fixes: 24adbc1676af ("tcp: fix SO_RCVLOWAT hangs with fat skbs")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Arjun Roy <arjunroy@google.com>
Suggested-by: Wei Wang <weiwan@google.com>
Reviewed-by: Wei Wang <weiwan@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/net/tcp.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index afbe1d3991f21..4fe3ab47b4803 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1380,8 +1380,13 @@ static inline int tcp_full_space(const struct sock *sk)
  */
 static inline bool tcp_rmem_pressure(const struct sock *sk)
 {
-	int rcvbuf = READ_ONCE(sk->sk_rcvbuf);
-	int threshold = rcvbuf - (rcvbuf >> 3);
+	int rcvbuf, threshold;
+
+	if (tcp_under_memory_pressure(sk))
+		return true;
+
+	rcvbuf = READ_ONCE(sk->sk_rcvbuf);
+	threshold = rcvbuf - (rcvbuf >> 3);
 
 	return atomic_read(&sk->sk_rmem_alloc) > threshold;
 }
-- 
2.27.0




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

* [PATCH 4.19 064/247] cxgb4/chtls/cxgbit: Keeping the max ofld immediate data size same in cxgb4 and ulds
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (62 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 063/247] tcp: fix SO_RCVLOWAT related hangs under mem pressure Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 065/247] b43: N-PHY: Fix the update of coef for the PHY revision >= 3case Greg Kroah-Hartman
                   ` (185 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ayush Sawal, Jakub Kicinski,
	David S. Miller, Sasha Levin

From: Ayush Sawal <ayush.sawal@chelsio.com>

[ Upstream commit 2355a6773a2cb0d2dce13432dde78497f1d6617b ]

The Max imm data size in cxgb4 is not similar to the max imm data size
in the chtls. This caused an mismatch in output of is_ofld_imm() of
cxgb4 and chtls. So fixed this by keeping the max wreq size of imm data
same in both chtls and cxgb4 as MAX_IMM_OFLD_TX_DATA_WR_LEN.

As cxgb4's max imm. data value for ofld packets is changed to
MAX_IMM_OFLD_TX_DATA_WR_LEN. Using the same in cxgbit also.

Fixes: 36bedb3f2e5b8 ("crypto: chtls - Inline TLS record Tx")
Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/crypto/chelsio/chtls/chtls_cm.h        |  3 ---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h |  3 +++
 drivers/net/ethernet/chelsio/cxgb4/sge.c       | 11 ++++++++---
 drivers/target/iscsi/cxgbit/cxgbit_target.c    |  3 +--
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/crypto/chelsio/chtls/chtls_cm.h b/drivers/crypto/chelsio/chtls/chtls_cm.h
index 4282d8a4eae48..ef72610724348 100644
--- a/drivers/crypto/chelsio/chtls/chtls_cm.h
+++ b/drivers/crypto/chelsio/chtls/chtls_cm.h
@@ -53,9 +53,6 @@
 #define MIN_RCV_WND (24 * 1024U)
 #define LOOPBACK(x)     (((x) & htonl(0xff000000)) == htonl(0x7f000000))
 
-/* ulp_mem_io + ulptx_idata + payload + padding */
-#define MAX_IMM_ULPTX_WR_LEN (32 + 8 + 256 + 8)
-
 /* for TX: a skb must have a headroom of at least TX_HEADER_LEN bytes */
 #define TX_HEADER_LEN \
 	(sizeof(struct fw_ofld_tx_data_wr) + sizeof(struct sge_opaque_hdr))
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
index de9ad311dacd8..ea0758de8ac89 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
@@ -44,6 +44,9 @@
 
 #define MAX_ULD_QSETS 16
 
+/* ulp_mem_io + ulptx_idata + payload + padding */
+#define MAX_IMM_ULPTX_WR_LEN (32 + 8 + 256 + 8)
+
 /* CPL message priority levels */
 enum {
 	CPL_PRIORITY_DATA     = 0,  /* data messages */
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index 7801f2aeeb30e..0a2d10a000ca4 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -2084,17 +2084,22 @@ int t4_mgmt_tx(struct adapter *adap, struct sk_buff *skb)
  *	@skb: the packet
  *
  *	Returns true if a packet can be sent as an offload WR with immediate
- *	data.  We currently use the same limit as for Ethernet packets.
+ *	data.
+ *	FW_OFLD_TX_DATA_WR limits the payload to 255 bytes due to 8-bit field.
+ *      However, FW_ULPTX_WR commands have a 256 byte immediate only
+ *      payload limit.
  */
 static inline int is_ofld_imm(const struct sk_buff *skb)
 {
 	struct work_request_hdr *req = (struct work_request_hdr *)skb->data;
 	unsigned long opcode = FW_WR_OP_G(ntohl(req->wr_hi));
 
-	if (opcode == FW_CRYPTO_LOOKASIDE_WR)
+	if (unlikely(opcode == FW_ULPTX_WR))
+		return skb->len <= MAX_IMM_ULPTX_WR_LEN;
+	else if (opcode == FW_CRYPTO_LOOKASIDE_WR)
 		return skb->len <= SGE_MAX_WR_LEN;
 	else
-		return skb->len <= MAX_IMM_TX_PKT_LEN;
+		return skb->len <= MAX_IMM_OFLD_TX_DATA_WR_LEN;
 }
 
 /**
diff --git a/drivers/target/iscsi/cxgbit/cxgbit_target.c b/drivers/target/iscsi/cxgbit/cxgbit_target.c
index 25eb3891e34b8..56bfb30b0ef58 100644
--- a/drivers/target/iscsi/cxgbit/cxgbit_target.c
+++ b/drivers/target/iscsi/cxgbit/cxgbit_target.c
@@ -89,8 +89,7 @@ static int cxgbit_is_ofld_imm(const struct sk_buff *skb)
 	if (likely(cxgbit_skcb_flags(skb) & SKCBF_TX_ISO))
 		length += sizeof(struct cpl_tx_data_iso);
 
-#define MAX_IMM_TX_PKT_LEN	256
-	return length <= MAX_IMM_TX_PKT_LEN;
+	return length <= MAX_IMM_OFLD_TX_DATA_WR_LEN;
 }
 
 /*
-- 
2.27.0




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

* [PATCH 4.19 065/247] b43: N-PHY: Fix the update of coef for the PHY revision >= 3case
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (63 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 064/247] cxgb4/chtls/cxgbit: Keeping the max ofld immediate data size same in cxgb4 and ulds Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 066/247] ibmvnic: add memory barrier to protect long term buffer Greg Kroah-Hartman
                   ` (184 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Colin Ian King, Larry Finger,
	David S. Miller, Sasha Levin

From: Colin Ian King <colin.king@canonical.com>

[ Upstream commit 4773acf3d4b50768bf08e9e97a204819e9ea0895 ]

The documentation for the PHY update [1] states:

Loop 4 times with index i

    If PHY Revision >= 3
        Copy table[i] to coef[i]
    Otherwise
        Set coef[i] to 0

the copy of the table to coef is currently implemented the wrong way
around, table is being updated from uninitialized values in coeff.
Fix this by swapping the assignment around.

[1] https://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal/

Fixes: 2f258b74d13c ("b43: N-PHY: implement restoring general configuration")
Addresses-Coverity: ("Uninitialized scalar variable")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/wireless/broadcom/b43/phy_n.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/broadcom/b43/phy_n.c b/drivers/net/wireless/broadcom/b43/phy_n.c
index 44ab080d65182..88446258e7751 100644
--- a/drivers/net/wireless/broadcom/b43/phy_n.c
+++ b/drivers/net/wireless/broadcom/b43/phy_n.c
@@ -5320,7 +5320,7 @@ static void b43_nphy_restore_cal(struct b43_wldev *dev)
 
 	for (i = 0; i < 4; i++) {
 		if (dev->phy.rev >= 3)
-			table[i] = coef[i];
+			coef[i] = table[i];
 		else
 			coef[i] = 0;
 	}
-- 
2.27.0




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

* [PATCH 4.19 066/247] ibmvnic: add memory barrier to protect long term buffer
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (64 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 065/247] b43: N-PHY: Fix the update of coef for the PHY revision >= 3case Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 067/247] ibmvnic: skip send_request_unmap for timeout reset Greg Kroah-Hartman
                   ` (183 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Lijun Pan, Thomas Falcon,
	David S. Miller, Sasha Levin

From: Lijun Pan <ljp@linux.ibm.com>

[ Upstream commit 42557dab78edc8235aba5b441f2eb35f725a0ede ]

dma_rmb() barrier is added to load the long term buffer before copying
it to socket buffer; and dma_wmb() barrier is added to update the
long term buffer before it being accessed by VIOS (virtual i/o server).

Fixes: 032c5e82847a ("Driver for IBM System i/p VNIC protocol")
Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
Acked-by: Thomas Falcon <tlfalcon@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 5518b56c2a967..788d944b3b51b 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1521,6 +1521,9 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
 		skb_copy_from_linear_data(skb, dst, skb->len);
 	}
 
+	/* post changes to long_term_buff *dst before VIOS accessing it */
+	dma_wmb();
+
 	tx_pool->consumer_index =
 	    (tx_pool->consumer_index + 1) % tx_pool->num_buffers;
 
@@ -2186,6 +2189,8 @@ restart_poll:
 		offset = be16_to_cpu(next->rx_comp.off_frame_data);
 		flags = next->rx_comp.flags;
 		skb = rx_buff->skb;
+		/* load long_term_buff before copying to skb */
+		dma_rmb();
 		skb_copy_to_linear_data(skb, rx_buff->data + offset,
 					length);
 
-- 
2.27.0




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

* [PATCH 4.19 067/247] ibmvnic: skip send_request_unmap for timeout reset
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (65 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 066/247] ibmvnic: add memory barrier to protect long term buffer Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 068/247] net: amd-xgbe: Reset the PHY rx data path when mailbox command timeout Greg Kroah-Hartman
                   ` (182 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Lijun Pan, David S. Miller, Sasha Levin

From: Lijun Pan <ljp@linux.ibm.com>

[ Upstream commit 7d3a7b9ea59ddb223aec59b45fa1713c633aaed4 ]

Timeout reset will trigger the VIOS to unmap it automatically,
similarly as FAILVOER and MOBILITY events. If we unmap it
in the linux side, we will see errors like
"30000003: Error 4 in REQUEST_UNMAP_RSP".
So, don't call send_request_unmap for timeout reset.

Fixes: ed651a10875f ("ibmvnic: Updated reset handling")
Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 788d944b3b51b..0c7c0206b1be5 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -212,8 +212,13 @@ static void free_long_term_buff(struct ibmvnic_adapter *adapter,
 	if (!ltb->buff)
 		return;
 
+	/* VIOS automatically unmaps the long term buffer at remote
+	 * end for the following resets:
+	 * FAILOVER, MOBILITY, TIMEOUT.
+	 */
 	if (adapter->reset_reason != VNIC_RESET_FAILOVER &&
-	    adapter->reset_reason != VNIC_RESET_MOBILITY)
+	    adapter->reset_reason != VNIC_RESET_MOBILITY &&
+	    adapter->reset_reason != VNIC_RESET_TIMEOUT)
 		send_request_unmap(adapter, ltb->map_id);
 	dma_free_coherent(dev, ltb->size, ltb->buff, ltb->addr);
 }
-- 
2.27.0




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

* [PATCH 4.19 068/247] net: amd-xgbe: Reset the PHY rx data path when mailbox command timeout
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (66 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 067/247] ibmvnic: skip send_request_unmap for timeout reset Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 069/247] net: amd-xgbe: Fix NETDEV WATCHDOG transmit queue timeout warning Greg Kroah-Hartman
                   ` (181 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sudheesh Mavila, Shyam Sundar S K,
	Tom Lendacky, David S. Miller, Sasha Levin

From: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>

[ Upstream commit 30b7edc82ec82578f4f5e6706766f0a9535617d3 ]

Sometimes mailbox commands timeout when the RX data path becomes
unresponsive. This prevents the submission of new mailbox commands to DXIO.
This patch identifies the timeout and resets the RX data path so that the
next message can be submitted properly.

Fixes: 549b32af9f7c ("amd-xgbe: Simplify mailbox interface rate change code")
Co-developed-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
Signed-off-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/amd/xgbe/xgbe-common.h | 14 +++++++++++
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 28 ++++++++++++++++++++-
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-common.h b/drivers/net/ethernet/amd/xgbe/xgbe-common.h
index b40d4377cc71d..b2cd3bdba9f89 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-common.h
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-common.h
@@ -1279,10 +1279,18 @@
 #define MDIO_PMA_10GBR_FECCTRL		0x00ab
 #endif
 
+#ifndef MDIO_PMA_RX_CTRL1
+#define MDIO_PMA_RX_CTRL1		0x8051
+#endif
+
 #ifndef MDIO_PCS_DIG_CTRL
 #define MDIO_PCS_DIG_CTRL		0x8000
 #endif
 
+#ifndef MDIO_PCS_DIGITAL_STAT
+#define MDIO_PCS_DIGITAL_STAT		0x8010
+#endif
+
 #ifndef MDIO_AN_XNP
 #define MDIO_AN_XNP			0x0016
 #endif
@@ -1358,6 +1366,8 @@
 #define XGBE_KR_TRAINING_ENABLE		BIT(1)
 
 #define XGBE_PCS_CL37_BP		BIT(12)
+#define XGBE_PCS_PSEQ_STATE_MASK	0x1c
+#define XGBE_PCS_PSEQ_STATE_POWER_GOOD	0x10
 
 #define XGBE_AN_CL37_INT_CMPLT		BIT(0)
 #define XGBE_AN_CL37_INT_MASK		0x01
@@ -1375,6 +1385,10 @@
 #define XGBE_PMA_CDR_TRACK_EN_OFF	0x00
 #define XGBE_PMA_CDR_TRACK_EN_ON	0x01
 
+#define XGBE_PMA_RX_RST_0_MASK		BIT(4)
+#define XGBE_PMA_RX_RST_0_RESET_ON	0x10
+#define XGBE_PMA_RX_RST_0_RESET_OFF	0x00
+
 /* Bit setting and getting macros
  *  The get macro will extract the current bit field value from within
  *  the variable
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
index 3ceb4f95ca7ca..828d12bf523fe 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
@@ -1942,6 +1942,27 @@ static void xgbe_phy_set_redrv_mode(struct xgbe_prv_data *pdata)
 	xgbe_phy_put_comm_ownership(pdata);
 }
 
+static void xgbe_phy_rx_reset(struct xgbe_prv_data *pdata)
+{
+	int reg;
+
+	reg = XMDIO_READ_BITS(pdata, MDIO_MMD_PCS, MDIO_PCS_DIGITAL_STAT,
+			      XGBE_PCS_PSEQ_STATE_MASK);
+	if (reg == XGBE_PCS_PSEQ_STATE_POWER_GOOD) {
+		/* Mailbox command timed out, reset of RX block is required.
+		 * This can be done by asseting the reset bit and wait for
+		 * its compeletion.
+		 */
+		XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_RX_CTRL1,
+				 XGBE_PMA_RX_RST_0_MASK, XGBE_PMA_RX_RST_0_RESET_ON);
+		ndelay(20);
+		XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_RX_CTRL1,
+				 XGBE_PMA_RX_RST_0_MASK, XGBE_PMA_RX_RST_0_RESET_OFF);
+		usleep_range(40, 50);
+		netif_err(pdata, link, pdata->netdev, "firmware mailbox reset performed\n");
+	}
+}
+
 static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
 					unsigned int cmd, unsigned int sub_cmd)
 {
@@ -1949,9 +1970,11 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
 	unsigned int wait;
 
 	/* Log if a previous command did not complete */
-	if (XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS))
+	if (XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS)) {
 		netif_dbg(pdata, link, pdata->netdev,
 			  "firmware mailbox not ready for command\n");
+		xgbe_phy_rx_reset(pdata);
+	}
 
 	/* Construct the command */
 	XP_SET_BITS(s0, XP_DRIVER_SCRATCH_0, COMMAND, cmd);
@@ -1973,6 +1996,9 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
 
 	netif_dbg(pdata, link, pdata->netdev,
 		  "firmware mailbox command did not complete\n");
+
+	/* Reset on error */
+	xgbe_phy_rx_reset(pdata);
 }
 
 static void xgbe_phy_rrc(struct xgbe_prv_data *pdata)
-- 
2.27.0




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

* [PATCH 4.19 069/247] net: amd-xgbe: Fix NETDEV WATCHDOG transmit queue timeout warning
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (67 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 068/247] net: amd-xgbe: Reset the PHY rx data path when mailbox command timeout Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 070/247] net: amd-xgbe: Reset link when the link never comes back Greg Kroah-Hartman
                   ` (180 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sudheesh Mavila, Shyam Sundar S K,
	Tom Lendacky, David S. Miller, Sasha Levin

From: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>

[ Upstream commit 186edbb510bd60e748f93975989ccba25ee99c50 ]

The current driver calls netif_carrier_off() late in the link tear down
which can result in a netdev watchdog timeout.

Calling netif_carrier_off() immediately after netif_tx_stop_all_queues()
avoids the warning.

 ------------[ cut here ]------------
 NETDEV WATCHDOG: enp3s0f2 (amd-xgbe): transmit queue 0 timed out
 WARNING: CPU: 3 PID: 0 at net/sched/sch_generic.c:461 dev_watchdog+0x20d/0x220
 Modules linked in: amd_xgbe(E)  amd-xgbe 0000:03:00.2 enp3s0f2: Link is Down
 CPU: 3 PID: 0 Comm: swapper/3 Tainted: G            E
 Hardware name: AMD Bilby-RV2/Bilby-RV2, BIOS RBB1202A 10/18/2019
 RIP: 0010:dev_watchdog+0x20d/0x220
 Code: 00 49 63 4e e0 eb 92 4c 89 e7 c6 05 c6 e2 c1 00 01 e8 e7 ce fc ff 89 d9 48
 RSP: 0018:ffff90cfc28c3e88 EFLAGS: 00010286
 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000006
 RDX: 0000000000000007 RSI: 0000000000000086 RDI: ffff90cfc28d63c0
 RBP: ffff90cfb977845c R08: 0000000000000050 R09: 0000000000196018
 R10: ffff90cfc28c3ef8 R11: 0000000000000000 R12: ffff90cfb9778000
 R13: 0000000000000003 R14: ffff90cfb9778480 R15: 0000000000000010
 FS:  0000000000000000(0000) GS:ffff90cfc28c0000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 00007f240ff2d9d0 CR3: 00000001e3e0a000 CR4: 00000000003406e0
 Call Trace:
  <IRQ>
  ? pfifo_fast_reset+0x100/0x100
  call_timer_fn+0x2b/0x130
  run_timer_softirq+0x3e8/0x440
  ? enqueue_hrtimer+0x39/0x90

Fixes: e722ec82374b ("amd-xgbe: Update the BelFuse quirk to support SGMII")
Co-developed-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
Signed-off-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/amd/xgbe/xgbe-drv.c  | 1 +
 drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
index 5519eff584417..80cf6af822f72 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
@@ -1444,6 +1444,7 @@ static void xgbe_stop(struct xgbe_prv_data *pdata)
 		return;
 
 	netif_tx_stop_all_queues(netdev);
+	netif_carrier_off(pdata->netdev);
 
 	xgbe_stop_timers(pdata);
 	flush_workqueue(pdata->dev_workqueue);
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
index 8a3a60bb26888..4d5506d928973 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
@@ -1396,7 +1396,6 @@ static void xgbe_phy_stop(struct xgbe_prv_data *pdata)
 	pdata->phy_if.phy_impl.stop(pdata);
 
 	pdata->phy.link = 0;
-	netif_carrier_off(pdata->netdev);
 
 	xgbe_phy_adjust_link(pdata);
 }
-- 
2.27.0




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

* [PATCH 4.19 070/247] net: amd-xgbe: Reset link when the link never comes back
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (68 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 069/247] net: amd-xgbe: Fix NETDEV WATCHDOG transmit queue timeout warning Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 071/247] net: amd-xgbe: Fix network fluctuations when using 1G BELFUSE SFP Greg Kroah-Hartman
                   ` (179 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sudheesh Mavila, Shyam Sundar S K,
	Tom Lendacky, David S. Miller, Sasha Levin

From: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>

[ Upstream commit 84fe68eb67f9499309cffd97c1ba269de125ff14 ]

Normally, auto negotiation and reconnect should be automatically done by
the hardware. But there seems to be an issue where auto negotiation has
to be restarted manually. This happens because of link training and so
even though still connected to the partner the link never "comes back".
This needs an auto-negotiation restart.

Also, a change in xgbe-mdio is needed to get ethtool to recognize the
link down and get the link change message. This change is only
required in a backplane connection mode.

Fixes: abf0a1c2b26a ("amd-xgbe: Add support for SFP+ modules")
Co-developed-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
Signed-off-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/amd/xgbe/xgbe-mdio.c   | 2 +-
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
index 4d5506d928973..156a0bc8ab01d 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
@@ -1345,7 +1345,7 @@ static void xgbe_phy_status(struct xgbe_prv_data *pdata)
 							     &an_restart);
 	if (an_restart) {
 		xgbe_phy_config_aneg(pdata);
-		return;
+		goto adjust_link;
 	}
 
 	if (pdata->phy.link) {
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
index 828d12bf523fe..1a617d6d2bf86 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
@@ -2595,6 +2595,14 @@ static int xgbe_phy_link_status(struct xgbe_prv_data *pdata, int *an_restart)
 	if (reg & MDIO_STAT1_LSTATUS)
 		return 1;
 
+	if (pdata->phy.autoneg == AUTONEG_ENABLE &&
+	    phy_data->port_mode == XGBE_PORT_MODE_BACKPLANE) {
+		if (!test_bit(XGBE_LINK_INIT, &pdata->dev_state)) {
+			netif_carrier_off(pdata->netdev);
+			*an_restart = 1;
+		}
+	}
+
 	/* No link, attempt a receiver reset cycle */
 	if (phy_data->rrc_count++ > XGBE_RRC_FREQUENCY) {
 		phy_data->rrc_count = 0;
-- 
2.27.0




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

* [PATCH 4.19 071/247] net: amd-xgbe: Fix network fluctuations when using 1G BELFUSE SFP
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (69 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 070/247] net: amd-xgbe: Reset link when the link never comes back Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 072/247] net: mvneta: Remove per-cpu queue mapping for Armada 3700 Greg Kroah-Hartman
                   ` (178 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sudheesh Mavila, Shyam Sundar S K,
	Tom Lendacky, David S. Miller, Sasha Levin

From: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>

[ Upstream commit 9eab3fdb419916f66a72d1572f68d82cd9b3f963 ]

Frequent link up/down events can happen when a Bel Fuse SFP part is
connected to the amd-xgbe device. Try to avoid the frequent link
issues by resetting the PHY as documented in Bel Fuse SFP datasheets.

Fixes: e722ec82374b ("amd-xgbe: Update the BelFuse quirk to support SGMII")
Co-developed-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
Signed-off-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
index 1a617d6d2bf86..54753c8a6a9d7 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
@@ -912,6 +912,9 @@ static bool xgbe_phy_belfuse_phy_quirks(struct xgbe_prv_data *pdata)
 	if ((phy_id & 0xfffffff0) != 0x03625d10)
 		return false;
 
+	/* Reset PHY - wait for self-clearing reset bit to clear */
+	genphy_soft_reset(phy_data->phydev);
+
 	/* Disable RGMII mode */
 	phy_write(phy_data->phydev, 0x18, 0x7007);
 	reg = phy_read(phy_data->phydev, 0x18);
-- 
2.27.0




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

* [PATCH 4.19 072/247] net: mvneta: Remove per-cpu queue mapping for Armada 3700
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (70 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 071/247] net: amd-xgbe: Fix network fluctuations when using 1G BELFUSE SFP Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11   ` Greg Kroah-Hartman
                   ` (177 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Maxime Chevallier, David S. Miller,
	Sasha Levin

From: Maxime Chevallier <maxime.chevallier@bootlin.com>

[ Upstream commit cf9bf871280d9e0a8869d98c2602d29caf69dfa3 ]

According to Errata #23 "The per-CPU GbE interrupt is limited to Core
0", we can't use the per-cpu interrupt mechanism on the Armada 3700
familly.

This is correctly checked for RSS configuration, but the initial queue
mapping is still done by having the queues spread across all the CPUs in
the system, both in the init path and in the cpu_hotplug path.

Fixes: 2636ac3cc2b4 ("net: mvneta: Add network support for Armada 3700 SoC")
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/marvell/mvneta.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 30a16cf796c7a..fda5dd8c71ebd 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -3022,7 +3022,9 @@ static int mvneta_txq_sw_init(struct mvneta_port *pp,
 	}
 
 	/* Setup XPS mapping */
-	if (txq_number > 1)
+	if (pp->neta_armada3700)
+		cpu = 0;
+	else if (txq_number > 1)
 		cpu = txq->id % num_present_cpus();
 	else
 		cpu = pp->rxq_def % num_present_cpus();
@@ -3667,6 +3669,11 @@ static int mvneta_cpu_online(unsigned int cpu, struct hlist_node *node)
 						  node_online);
 	struct mvneta_pcpu_port *port = per_cpu_ptr(pp->ports, cpu);
 
+	/* Armada 3700's per-cpu interrupt for mvneta is broken, all interrupts
+	 * are routed to CPU 0, so we don't need all the cpu-hotplug support
+	 */
+	if (pp->neta_armada3700)
+		return 0;
 
 	spin_lock(&pp->lock);
 	/*
-- 
2.27.0




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

* [PATCH 4.19 073/247] fbdev: aty: SPARC64 requires FB_ATY_CT
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 001/247] HID: make arrays usage and value to be the same Greg Kroah-Hartman
@ 2021-03-01 16:11   ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 003/247] usb: quirks: add quirk to start video capture on ELMO L-12F document camera reliable Greg Kroah-Hartman
                     ` (247 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Geert Uytterhoeven, Randy Dunlap,
	David S. Miller, sparclinux, Tomi Valkeinen, dri-devel,
	linux-fbdev, Daniel Vetter, David Airlie,
	Bartlomiej Zolnierkiewicz, Geert Uytterhoeven, Sasha Levin

From: Randy Dunlap <rdunlap@infradead.org>

[ Upstream commit c6c90c70db4d9a0989111d6b994d545659410f7a ]

It looks like SPARC64 requires FB_ATY_CT to build without errors,
so have FB_ATY select FB_ATY_CT if both SPARC64 and PCI are enabled
instead of using "default y if SPARC64 && PCI", which is not strong
enough to prevent build errors.

As it currently is, FB_ATY_CT can be disabled, resulting in build
errors:

ERROR: modpost: "aty_postdividers" [drivers/video/fbdev/aty/atyfb.ko] undefined!
ERROR: modpost: "aty_ld_pll_ct" [drivers/video/fbdev/aty/atyfb.ko] undefined!

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Fixes: f7018c213502 ("video: move fbdev to drivers/video/fbdev")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-fbdev@vger.kernel.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201127031752.10371-1-rdunlap@infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/video/fbdev/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index f99558d006bf4..97c4319797d5c 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -1303,6 +1303,7 @@ config FB_ATY
 	select FB_CFB_IMAGEBLIT
 	select FB_BACKLIGHT if FB_ATY_BACKLIGHT
 	select FB_MACMODES if PPC
+	select FB_ATY_CT if SPARC64 && PCI
 	help
 	  This driver supports graphics boards with the ATI Mach64 chips.
 	  Say Y if you have such a graphics board.
@@ -1313,7 +1314,6 @@ config FB_ATY
 config FB_ATY_CT
 	bool "Mach64 CT/VT/GT/LT (incl. 3D RAGE) support"
 	depends on PCI && FB_ATY
-	default y if SPARC64 && PCI
 	help
 	  Say Y here to support use of ATI's 64-bit Rage boards (or other
 	  boards based on the Mach64 CT, VT, GT, and LT chipsets) as a
-- 
2.27.0




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

* [PATCH 4.19 073/247] fbdev: aty: SPARC64 requires FB_ATY_CT
@ 2021-03-01 16:11   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Sasha Levin, linux-fbdev, Geert Uytterhoeven,
	Bartlomiej Zolnierkiewicz, David Airlie, Greg Kroah-Hartman,
	Randy Dunlap, stable, Tomi Valkeinen, Geert Uytterhoeven,
	dri-devel, Daniel Vetter, sparclinux, David S. Miller

From: Randy Dunlap <rdunlap@infradead.org>

[ Upstream commit c6c90c70db4d9a0989111d6b994d545659410f7a ]

It looks like SPARC64 requires FB_ATY_CT to build without errors,
so have FB_ATY select FB_ATY_CT if both SPARC64 and PCI are enabled
instead of using "default y if SPARC64 && PCI", which is not strong
enough to prevent build errors.

As it currently is, FB_ATY_CT can be disabled, resulting in build
errors:

ERROR: modpost: "aty_postdividers" [drivers/video/fbdev/aty/atyfb.ko] undefined!
ERROR: modpost: "aty_ld_pll_ct" [drivers/video/fbdev/aty/atyfb.ko] undefined!

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Fixes: f7018c213502 ("video: move fbdev to drivers/video/fbdev")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-fbdev@vger.kernel.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201127031752.10371-1-rdunlap@infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/video/fbdev/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index f99558d006bf4..97c4319797d5c 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -1303,6 +1303,7 @@ config FB_ATY
 	select FB_CFB_IMAGEBLIT
 	select FB_BACKLIGHT if FB_ATY_BACKLIGHT
 	select FB_MACMODES if PPC
+	select FB_ATY_CT if SPARC64 && PCI
 	help
 	  This driver supports graphics boards with the ATI Mach64 chips.
 	  Say Y if you have such a graphics board.
@@ -1313,7 +1314,6 @@ config FB_ATY
 config FB_ATY_CT
 	bool "Mach64 CT/VT/GT/LT (incl. 3D RAGE) support"
 	depends on PCI && FB_ATY
-	default y if SPARC64 && PCI
 	help
 	  Say Y here to support use of ATI's 64-bit Rage boards (or other
 	  boards based on the Mach64 CT, VT, GT, and LT chipsets) as a
-- 
2.27.0

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

* [PATCH 4.19 073/247] fbdev: aty: SPARC64 requires FB_ATY_CT
@ 2021-03-01 16:11   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Sasha Levin, linux-fbdev, Geert Uytterhoeven,
	Bartlomiej Zolnierkiewicz, David Airlie, Greg Kroah-Hartman,
	Randy Dunlap, stable, Tomi Valkeinen, Geert Uytterhoeven,
	dri-devel, Daniel Vetter, sparclinux, David S. Miller

From: Randy Dunlap <rdunlap@infradead.org>

[ Upstream commit c6c90c70db4d9a0989111d6b994d545659410f7a ]

It looks like SPARC64 requires FB_ATY_CT to build without errors,
so have FB_ATY select FB_ATY_CT if both SPARC64 and PCI are enabled
instead of using "default y if SPARC64 && PCI", which is not strong
enough to prevent build errors.

As it currently is, FB_ATY_CT can be disabled, resulting in build
errors:

ERROR: modpost: "aty_postdividers" [drivers/video/fbdev/aty/atyfb.ko] undefined!
ERROR: modpost: "aty_ld_pll_ct" [drivers/video/fbdev/aty/atyfb.ko] undefined!

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Fixes: f7018c213502 ("video: move fbdev to drivers/video/fbdev")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-fbdev@vger.kernel.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201127031752.10371-1-rdunlap@infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/video/fbdev/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index f99558d006bf4..97c4319797d5c 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -1303,6 +1303,7 @@ config FB_ATY
 	select FB_CFB_IMAGEBLIT
 	select FB_BACKLIGHT if FB_ATY_BACKLIGHT
 	select FB_MACMODES if PPC
+	select FB_ATY_CT if SPARC64 && PCI
 	help
 	  This driver supports graphics boards with the ATI Mach64 chips.
 	  Say Y if you have such a graphics board.
@@ -1313,7 +1314,6 @@ config FB_ATY
 config FB_ATY_CT
 	bool "Mach64 CT/VT/GT/LT (incl. 3D RAGE) support"
 	depends on PCI && FB_ATY
-	default y if SPARC64 && PCI
 	help
 	  Say Y here to support use of ATI's 64-bit Rage boards (or other
 	  boards based on the Mach64 CT, VT, GT, and LT chipsets) as a
-- 
2.27.0



_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH 4.19 074/247] drm/gma500: Fix error return code in psb_driver_load()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (72 preceding siblings ...)
  2021-03-01 16:11   ` Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 075/247] gma500: clean up error handling in init Greg Kroah-Hartman
                   ` (175 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Hulk Robot, Jialin Zhang,
	Daniel Vetter, Sasha Levin

From: Jialin Zhang <zhangjialin11@huawei.com>

[ Upstream commit 6926872ae24452d4f2176a3ba2dee659497de2c4 ]

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 5c49fd3aa0ab ("gma500: Add the core DRM files and headers")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201130020216.1906141-1-zhangjialin11@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/gma500/psb_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index ac32ab5aa0027..2fa3c7fc4b6d5 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -316,6 +316,8 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
 	if (ret)
 		goto out_err;
 
+	ret = -ENOMEM;
+
 	dev_priv->mmu = psb_mmu_driver_init(dev, 1, 0, 0);
 	if (!dev_priv->mmu)
 		goto out_err;
-- 
2.27.0




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

* [PATCH 4.19 075/247] gma500: clean up error handling in init
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (73 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 074/247] drm/gma500: Fix error return code in psb_driver_load() Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 076/247] crypto: sun4i-ss - fix kmap usage Greg Kroah-Hartman
                   ` (174 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Patrik Jakobsson, Sasha Levin

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

[ Upstream commit 15ccc39b3aab667c6fa131206f01f31bfbccdf6a ]

The main problem with this error handling was that it didn't clean up if
i2c_add_numbered_adapter() failed.  This code is pretty old, and doesn't
match with today's checkpatch.pl standards so I took the opportunity to
tidy it up a bit.  I changed the NULL comparison, and removed the
WARNING message if kzalloc() fails and updated the label names.

Fixes: 1b082ccf5901 ("gma500: Add Oaktrail support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/X8ikkAqZfnDO2lu6@mwanda
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c b/drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c
index e281070611480..fc9a34ed58bd1 100644
--- a/drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c
+++ b/drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c
@@ -279,11 +279,8 @@ int oaktrail_hdmi_i2c_init(struct pci_dev *dev)
 	hdmi_dev = pci_get_drvdata(dev);
 
 	i2c_dev = kzalloc(sizeof(struct hdmi_i2c_dev), GFP_KERNEL);
-	if (i2c_dev == NULL) {
-		DRM_ERROR("Can't allocate interface\n");
-		ret = -ENOMEM;
-		goto exit;
-	}
+	if (!i2c_dev)
+		return -ENOMEM;
 
 	i2c_dev->adap = &oaktrail_hdmi_i2c_adapter;
 	i2c_dev->status = I2C_STAT_INIT;
@@ -300,16 +297,23 @@ int oaktrail_hdmi_i2c_init(struct pci_dev *dev)
 			  oaktrail_hdmi_i2c_adapter.name, hdmi_dev);
 	if (ret) {
 		DRM_ERROR("Failed to request IRQ for I2C controller\n");
-		goto err;
+		goto free_dev;
 	}
 
 	/* Adapter registration */
 	ret = i2c_add_numbered_adapter(&oaktrail_hdmi_i2c_adapter);
-	return ret;
+	if (ret) {
+		DRM_ERROR("Failed to add I2C adapter\n");
+		goto free_irq;
+	}
 
-err:
+	return 0;
+
+free_irq:
+	free_irq(dev->irq, hdmi_dev);
+free_dev:
 	kfree(i2c_dev);
-exit:
+
 	return ret;
 }
 
-- 
2.27.0




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

* [PATCH 4.19 076/247] crypto: sun4i-ss - fix kmap usage
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (74 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 075/247] gma500: clean up error handling in init Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 077/247] drm/amdgpu: Fix macro name _AMDGPU_TRACE_H_ in preprocessor if condition Greg Kroah-Hartman
                   ` (173 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Corentin Labbe, Herbert Xu, Sasha Levin

From: Corentin Labbe <clabbe@baylibre.com>

[ Upstream commit 9bc3dd24e7dccd50757db743a3635ad5b0497e6e ]

With the recent kmap change, some tests which were conditional on
CONFIG_DEBUG_HIGHMEM now are enabled by default.
This permit to detect a problem in sun4i-ss usage of kmap.

sun4i-ss uses two kmap via sg_miter (one for input, one for output), but
using two kmap at the same time is hard:
"the ordering has to be correct and with sg_miter that's probably hard to get
right." (quoting Tlgx)

So the easiest solution is to never have two sg_miter/kmap open at the same time.
After each use of sg_miter, I store the current index, for being able to
resume sg_miter to the right place.

Fixes: 6298e948215f ("crypto: sunxi-ss - Add Allwinner Security System crypto accelerator")
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/crypto/sunxi-ss/sun4i-ss-cipher.c | 109 +++++++++++++---------
 1 file changed, 65 insertions(+), 44 deletions(-)

diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
index 22e4918579254..178096e4e77da 100644
--- a/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
@@ -34,6 +34,8 @@ static int sun4i_ss_opti_poll(struct skcipher_request *areq)
 	unsigned int ileft = areq->cryptlen;
 	unsigned int oleft = areq->cryptlen;
 	unsigned int todo;
+	unsigned long pi = 0, po = 0; /* progress for in and out */
+	bool miter_err;
 	struct sg_mapping_iter mi, mo;
 	unsigned int oi, oo; /* offset for in and out */
 	unsigned long flags;
@@ -64,39 +66,51 @@ static int sun4i_ss_opti_poll(struct skcipher_request *areq)
 	}
 	writel(mode, ss->base + SS_CTL);
 
-	sg_miter_start(&mi, areq->src, sg_nents(areq->src),
-		       SG_MITER_FROM_SG | SG_MITER_ATOMIC);
-	sg_miter_start(&mo, areq->dst, sg_nents(areq->dst),
-		       SG_MITER_TO_SG | SG_MITER_ATOMIC);
-	sg_miter_next(&mi);
-	sg_miter_next(&mo);
-	if (!mi.addr || !mo.addr) {
-		dev_err_ratelimited(ss->dev, "ERROR: sg_miter return null\n");
-		err = -EINVAL;
-		goto release_ss;
-	}
 
 	ileft = areq->cryptlen / 4;
 	oleft = areq->cryptlen / 4;
 	oi = 0;
 	oo = 0;
 	do {
-		todo = min(rx_cnt, ileft);
-		todo = min_t(size_t, todo, (mi.length - oi) / 4);
-		if (todo) {
-			ileft -= todo;
-			writesl(ss->base + SS_RXFIFO, mi.addr + oi, todo);
-			oi += todo * 4;
-		}
-		if (oi == mi.length) {
-			sg_miter_next(&mi);
-			oi = 0;
+		if (ileft) {
+			sg_miter_start(&mi, areq->src, sg_nents(areq->src),
+					SG_MITER_FROM_SG | SG_MITER_ATOMIC);
+			if (pi)
+				sg_miter_skip(&mi, pi);
+			miter_err = sg_miter_next(&mi);
+			if (!miter_err || !mi.addr) {
+				dev_err_ratelimited(ss->dev, "ERROR: sg_miter return null\n");
+				err = -EINVAL;
+				goto release_ss;
+			}
+			todo = min(rx_cnt, ileft);
+			todo = min_t(size_t, todo, (mi.length - oi) / 4);
+			if (todo) {
+				ileft -= todo;
+				writesl(ss->base + SS_RXFIFO, mi.addr + oi, todo);
+				oi += todo * 4;
+			}
+			if (oi == mi.length) {
+				pi += mi.length;
+				oi = 0;
+			}
+			sg_miter_stop(&mi);
 		}
 
 		spaces = readl(ss->base + SS_FCSR);
 		rx_cnt = SS_RXFIFO_SPACES(spaces);
 		tx_cnt = SS_TXFIFO_SPACES(spaces);
 
+		sg_miter_start(&mo, areq->dst, sg_nents(areq->dst),
+			       SG_MITER_TO_SG | SG_MITER_ATOMIC);
+		if (po)
+			sg_miter_skip(&mo, po);
+		miter_err = sg_miter_next(&mo);
+		if (!miter_err || !mo.addr) {
+			dev_err_ratelimited(ss->dev, "ERROR: sg_miter return null\n");
+			err = -EINVAL;
+			goto release_ss;
+		}
 		todo = min(tx_cnt, oleft);
 		todo = min_t(size_t, todo, (mo.length - oo) / 4);
 		if (todo) {
@@ -105,9 +119,10 @@ static int sun4i_ss_opti_poll(struct skcipher_request *areq)
 			oo += todo * 4;
 		}
 		if (oo == mo.length) {
-			sg_miter_next(&mo);
 			oo = 0;
+			po += mo.length;
 		}
+		sg_miter_stop(&mo);
 	} while (oleft);
 
 	if (areq->iv) {
@@ -118,8 +133,6 @@ static int sun4i_ss_opti_poll(struct skcipher_request *areq)
 	}
 
 release_ss:
-	sg_miter_stop(&mi);
-	sg_miter_stop(&mo);
 	writel(0, ss->base + SS_CTL);
 	spin_unlock_irqrestore(&ss->slock, flags);
 	return err;
@@ -148,6 +161,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)
 	unsigned int oleft = areq->cryptlen;
 	unsigned int todo;
 	struct sg_mapping_iter mi, mo;
+	unsigned long pi = 0, po = 0; /* progress for in and out */
+	bool miter_err;
 	unsigned int oi, oo;	/* offset for in and out */
 	char buf[4 * SS_RX_MAX];/* buffer for linearize SG src */
 	char bufo[4 * SS_TX_MAX]; /* buffer for linearize SG dst */
@@ -200,17 +215,6 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)
 	}
 	writel(mode, ss->base + SS_CTL);
 
-	sg_miter_start(&mi, areq->src, sg_nents(areq->src),
-		       SG_MITER_FROM_SG | SG_MITER_ATOMIC);
-	sg_miter_start(&mo, areq->dst, sg_nents(areq->dst),
-		       SG_MITER_TO_SG | SG_MITER_ATOMIC);
-	sg_miter_next(&mi);
-	sg_miter_next(&mo);
-	if (!mi.addr || !mo.addr) {
-		dev_err_ratelimited(ss->dev, "ERROR: sg_miter return null\n");
-		err = -EINVAL;
-		goto release_ss;
-	}
 	ileft = areq->cryptlen;
 	oleft = areq->cryptlen;
 	oi = 0;
@@ -218,6 +222,16 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)
 
 	while (oleft) {
 		if (ileft) {
+			sg_miter_start(&mi, areq->src, sg_nents(areq->src),
+				       SG_MITER_FROM_SG | SG_MITER_ATOMIC);
+			if (pi)
+				sg_miter_skip(&mi, pi);
+			miter_err = sg_miter_next(&mi);
+			if (!miter_err || !mi.addr) {
+				dev_err_ratelimited(ss->dev, "ERROR: sg_miter return null\n");
+				err = -EINVAL;
+				goto release_ss;
+			}
 			/*
 			 * todo is the number of consecutive 4byte word that we
 			 * can read from current SG
@@ -250,31 +264,38 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)
 				}
 			}
 			if (oi == mi.length) {
-				sg_miter_next(&mi);
+				pi += mi.length;
 				oi = 0;
 			}
+			sg_miter_stop(&mi);
 		}
 
 		spaces = readl(ss->base + SS_FCSR);
 		rx_cnt = SS_RXFIFO_SPACES(spaces);
 		tx_cnt = SS_TXFIFO_SPACES(spaces);
-		dev_dbg(ss->dev,
-			"%x %u/%zu %u/%u cnt=%u %u/%zu %u/%u cnt=%u %u\n",
-			mode,
-			oi, mi.length, ileft, areq->cryptlen, rx_cnt,
-			oo, mo.length, oleft, areq->cryptlen, tx_cnt, ob);
 
 		if (!tx_cnt)
 			continue;
+		sg_miter_start(&mo, areq->dst, sg_nents(areq->dst),
+			       SG_MITER_TO_SG | SG_MITER_ATOMIC);
+		if (po)
+			sg_miter_skip(&mo, po);
+		miter_err = sg_miter_next(&mo);
+		if (!miter_err || !mo.addr) {
+			dev_err_ratelimited(ss->dev, "ERROR: sg_miter return null\n");
+			err = -EINVAL;
+			goto release_ss;
+		}
 		/* todo in 4bytes word */
 		todo = min(tx_cnt, oleft / 4);
 		todo = min_t(size_t, todo, (mo.length - oo) / 4);
+
 		if (todo) {
 			readsl(ss->base + SS_TXFIFO, mo.addr + oo, todo);
 			oleft -= todo * 4;
 			oo += todo * 4;
 			if (oo == mo.length) {
-				sg_miter_next(&mo);
+				po += mo.length;
 				oo = 0;
 			}
 		} else {
@@ -299,12 +320,14 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)
 				obo += todo;
 				oo += todo;
 				if (oo == mo.length) {
+					po += mo.length;
 					sg_miter_next(&mo);
 					oo = 0;
 				}
 			} while (obo < obl);
 			/* bufo must be fully used here */
 		}
+		sg_miter_stop(&mo);
 	}
 	if (areq->iv) {
 		for (i = 0; i < 4 && i < ivsize / 4; i++) {
@@ -314,8 +337,6 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)
 	}
 
 release_ss:
-	sg_miter_stop(&mi);
-	sg_miter_stop(&mo);
 	writel(0, ss->base + SS_CTL);
 	spin_unlock_irqrestore(&ss->slock, flags);
 
-- 
2.27.0




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

* [PATCH 4.19 077/247] drm/amdgpu: Fix macro name _AMDGPU_TRACE_H_ in preprocessor if condition
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (75 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 076/247] crypto: sun4i-ss - fix kmap usage Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 078/247] MIPS: c-r4k: Fix section mismatch for loongson2_sc_init Greg Kroah-Hartman
                   ` (172 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Guchun Chen, Paul Menzel,
	Chenyang Li, Alex Deucher, Sasha Levin

From: Chenyang Li <lichenyang@loongson.cn>

[ Upstream commit 956e20eb0fbb206e5e795539db5469db099715c8 ]

Add an underscore in amdgpu_trace.h line 24 "_AMDGPU_TRACE_H".

Fixes: d38ceaf99ed0 ("drm/amdgpu: add core driver (v4)")
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Chenyang Li <lichenyang@loongson.cn>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
index 7206a0025b17a..db9907fb99f3f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
@@ -21,7 +21,7 @@
  *
  */
 
-#if !defined(_AMDGPU_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
+#if !defined(_AMDGPU_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
 #define _AMDGPU_TRACE_H_
 
 #include <linux/stringify.h>
-- 
2.27.0




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

* [PATCH 4.19 078/247] MIPS: c-r4k: Fix section mismatch for loongson2_sc_init
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (76 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 077/247] drm/amdgpu: Fix macro name _AMDGPU_TRACE_H_ in preprocessor if condition Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 079/247] MIPS: lantiq: Explicitly compare LTQ_EBU_PCC_ISTAT against 0 Greg Kroah-Hartman
                   ` (171 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Nathan Chancellor, Huacai Chen,
	Thomas Bogendoerfer, Sasha Levin

From: Nathan Chancellor <natechancellor@gmail.com>

[ Upstream commit c58734eee6a2151ba033c0dcb31902c89e310374 ]

When building with clang, the following section mismatch warning occurs:

WARNING: modpost: vmlinux.o(.text+0x24490): Section mismatch in
reference from the function r4k_cache_init() to the function
.init.text:loongson2_sc_init()

This should have been fixed with commit ad4fddef5f23 ("mips: fix Section
mismatch in reference") but it was missed. Remove the improper __init
annotation like that commit did.

Fixes: 078a55fc824c ("MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code")
Link: https://github.com/ClangBuiltLinux/linux/issues/787
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Huacai Chen <chenhuacai@kernel.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/mips/mm/c-r4k.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 7650edd5cf7ff..60fe72170856d 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -1673,7 +1673,7 @@ static int probe_scache(void)
 	return 1;
 }
 
-static void __init loongson2_sc_init(void)
+static void loongson2_sc_init(void)
 {
 	struct cpuinfo_mips *c = &current_cpu_data;
 
-- 
2.27.0




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

* [PATCH 4.19 079/247] MIPS: lantiq: Explicitly compare LTQ_EBU_PCC_ISTAT against 0
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (77 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 078/247] MIPS: c-r4k: Fix section mismatch for loongson2_sc_init Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 080/247] media: i2c: ov5670: Fix PIXEL_RATE minimum value Greg Kroah-Hartman
                   ` (170 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dmitry Golovin, Nathan Chancellor,
	Thomas Bogendoerfer, Sasha Levin

From: Nathan Chancellor <natechancellor@gmail.com>

[ Upstream commit c6f2a9e17b9bef7677caddb1626c2402f3e9d2bd ]

When building xway_defconfig with clang:

arch/mips/lantiq/irq.c:305:48: error: use of logical '&&' with constant
operand [-Werror,-Wconstant-logical-operand]
        if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT)
                                                      ^ ~~~~~~~~~~~~~~~~~
arch/mips/lantiq/irq.c:305:48: note: use '&' for a bitwise operation
        if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT)
                                                      ^~
                                                      &
arch/mips/lantiq/irq.c:305:48: note: remove constant to silence this
warning
        if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT)
                                                     ~^~~~~~~~~~~~~~~~~~~~
1 error generated.

Explicitly compare the constant LTQ_EBU_PCC_ISTAT against 0 to fix the
warning. Additionally, remove the unnecessary parentheses as this is a
simple conditional statement and shorthand '== 0' to '!'.

Fixes: 3645da0276ae ("OF: MIPS: lantiq: implement irq_domain support")
Link: https://github.com/ClangBuiltLinux/linux/issues/807
Reported-by: Dmitry Golovin <dima@golovin.in>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/mips/lantiq/irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c
index 37caeadb2964c..0476d7e97a03f 100644
--- a/arch/mips/lantiq/irq.c
+++ b/arch/mips/lantiq/irq.c
@@ -244,7 +244,7 @@ static void ltq_hw_irq_handler(struct irq_desc *desc)
 	generic_handle_irq(irq_linear_revmap(ltq_domain, hwirq));
 
 	/* if this is a EBU irq, we need to ack it or get a deadlock */
-	if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT)
+	if (irq == LTQ_ICU_EBU_IRQ && !module && LTQ_EBU_PCC_ISTAT != 0)
 		ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_PCC_ISTAT) | 0x10,
 			LTQ_EBU_PCC_ISTAT);
 }
-- 
2.27.0




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

* [PATCH 4.19 080/247] media: i2c: ov5670: Fix PIXEL_RATE minimum value
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (78 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 079/247] MIPS: lantiq: Explicitly compare LTQ_EBU_PCC_ISTAT against 0 Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 081/247] media: camss: missing error code in msm_video_register() Greg Kroah-Hartman
                   ` (169 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jacopo Mondi, Sakari Ailus,
	Mauro Carvalho Chehab, Sasha Levin

From: Jacopo Mondi <jacopo@jmondi.org>

[ Upstream commit dc1eb7c9c290cba52937c9a224b22a400bb0ffd7 ]

The driver currently reports a single supported value for
V4L2_CID_PIXEL_RATE and initializes the control's minimum value to 0,
which is very risky, as userspace might accidentally use it as divider
when calculating the time duration of a line.

Fix this by using as minimum the only supported value when registering
the control.

Fixes: 5de35c9b8dcd1 ("media: i2c: Add Omnivision OV5670 5M sensor support")
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/media/i2c/ov5670.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c
index 53dd30d96e691..62dfdcb6e0bd6 100644
--- a/drivers/media/i2c/ov5670.c
+++ b/drivers/media/i2c/ov5670.c
@@ -2081,7 +2081,8 @@ static int ov5670_init_controls(struct ov5670 *ov5670)
 
 	/* By default, V4L2_CID_PIXEL_RATE is read only */
 	ov5670->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &ov5670_ctrl_ops,
-					       V4L2_CID_PIXEL_RATE, 0,
+					       V4L2_CID_PIXEL_RATE,
+					       link_freq_configs[0].pixel_rate,
 					       link_freq_configs[0].pixel_rate,
 					       1,
 					       link_freq_configs[0].pixel_rate);
-- 
2.27.0




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

* [PATCH 4.19 081/247] media: camss: missing error code in msm_video_register()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (79 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 080/247] media: i2c: ov5670: Fix PIXEL_RATE minimum value Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 082/247] media: vsp1: Fix an error handling path in the probe function Greg Kroah-Hartman
                   ` (168 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Robert Foss,
	Hans Verkuil, Mauro Carvalho Chehab, Sasha Levin

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

[ Upstream commit 9c67ed2ab299123872be14a3dc2ea44ce7e4538b ]

This error path returns success but it should return -EINVAL.

Fixes: cba3819d1e93 ("media: camss: Format configuration per hardware version")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/media/platform/qcom/camss/camss-video.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c
index c9bb0d023db48..e81ebeb0506e4 100644
--- a/drivers/media/platform/qcom/camss/camss-video.c
+++ b/drivers/media/platform/qcom/camss/camss-video.c
@@ -901,6 +901,7 @@ int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev,
 			video->nformats = ARRAY_SIZE(formats_rdi_8x96);
 		}
 	} else {
+		ret = -EINVAL;
 		goto error_video_register;
 	}
 
-- 
2.27.0




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

* [PATCH 4.19 082/247] media: vsp1: Fix an error handling path in the probe function
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (80 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 081/247] media: camss: missing error code in msm_video_register() Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 083/247] media: em28xx: Fix use-after-free in em28xx_alloc_urbs Greg Kroah-Hartman
                   ` (167 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christophe JAILLET,
	Geert Uytterhoeven, Kieran Bingham, Laurent Pinchart,
	Hans Verkuil, Mauro Carvalho Chehab, Sasha Levin

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

[ Upstream commit 7113469dafc2d545fa4fa9bc649c31dc27db492e ]

A previous 'rcar_fcp_get()' call must be undone in the error handling path,
as already done in the remove function.

Fixes: 94fcdf829793 ("[media] v4l: vsp1: Add FCP support")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/media/platform/vsp1/vsp1_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
index 4e6530ee809af..022f84569d0e5 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -882,8 +882,10 @@ static int vsp1_probe(struct platform_device *pdev)
 	}
 
 done:
-	if (ret)
+	if (ret) {
 		pm_runtime_disable(&pdev->dev);
+		rcar_fcp_put(vsp1->fcp);
+	}
 
 	return ret;
 }
-- 
2.27.0




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

* [PATCH 4.19 083/247] media: em28xx: Fix use-after-free in em28xx_alloc_urbs
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (81 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 082/247] media: vsp1: Fix an error handling path in the probe function Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 084/247] media: media/pci: Fix memleak in empress_init Greg Kroah-Hartman
                   ` (166 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dinghao Liu, Hans Verkuil,
	Mauro Carvalho Chehab, Sasha Levin

From: Dinghao Liu <dinghao.liu@zju.edu.cn>

[ Upstream commit a26efd1961a18b91ae4cd2e433adbcf865b40fa3 ]

When kzalloc() fails, em28xx_uninit_usb_xfer() will free
usb_bufs->buf and set it to NULL. Thus the later access
to usb_bufs->buf[i] will lead to null pointer dereference.
Also the kfree(usb_bufs->buf) after that is redundant.

Fixes: d571b592c6206 ("media: em28xx: don't use coherent buffer for DMA transfers")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/media/usb/em28xx/em28xx-core.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index 69445c8e38e28..d0f95a5cb4d23 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -955,14 +955,10 @@ int em28xx_alloc_urbs(struct em28xx *dev, enum em28xx_mode mode, int xfer_bulk,
 
 		usb_bufs->buf[i] = kzalloc(sb_size, GFP_KERNEL);
 		if (!usb_bufs->buf[i]) {
-			em28xx_uninit_usb_xfer(dev, mode);
-
 			for (i--; i >= 0; i--)
 				kfree(usb_bufs->buf[i]);
 
-			kfree(usb_bufs->buf);
-			usb_bufs->buf = NULL;
-
+			em28xx_uninit_usb_xfer(dev, mode);
 			return -ENOMEM;
 		}
 
-- 
2.27.0




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

* [PATCH 4.19 084/247] media: media/pci: Fix memleak in empress_init
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (82 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 083/247] media: em28xx: Fix use-after-free in em28xx_alloc_urbs Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 085/247] media: tm6000: Fix memleak in tm6000_start_stream Greg Kroah-Hartman
                   ` (165 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dinghao Liu, Hans Verkuil,
	Mauro Carvalho Chehab, Sasha Levin

From: Dinghao Liu <dinghao.liu@zju.edu.cn>

[ Upstream commit 15d0c52241ecb1c9d802506bff6f5c3f7872c0df ]

When vb2_queue_init() fails, dev->empress_dev
should be released just like other error handling
paths.

Fixes: 2ada815fc48bb ("[media] saa7134: convert to vb2")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/media/pci/saa7134/saa7134-empress.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/saa7134/saa7134-empress.c b/drivers/media/pci/saa7134/saa7134-empress.c
index 66acfd35ffc60..8680eb08b654d 100644
--- a/drivers/media/pci/saa7134/saa7134-empress.c
+++ b/drivers/media/pci/saa7134/saa7134-empress.c
@@ -293,8 +293,11 @@ static int empress_init(struct saa7134_dev *dev)
 	q->lock = &dev->lock;
 	q->dev = &dev->pci->dev;
 	err = vb2_queue_init(q);
-	if (err)
+	if (err) {
+		video_device_release(dev->empress_dev);
+		dev->empress_dev = NULL;
 		return err;
+	}
 	dev->empress_dev->queue = q;
 
 	video_set_drvdata(dev->empress_dev, dev);
-- 
2.27.0




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

* [PATCH 4.19 085/247] media: tm6000: Fix memleak in tm6000_start_stream
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (83 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 084/247] media: media/pci: Fix memleak in empress_init Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 086/247] ASoC: cs42l56: fix up error handling in probe Greg Kroah-Hartman
                   ` (164 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dinghao Liu, Hans Verkuil,
	Mauro Carvalho Chehab, Sasha Levin

From: Dinghao Liu <dinghao.liu@zju.edu.cn>

[ Upstream commit 76aaf8a96771c16365b8510f1fb97738dc88026e ]

When usb_clear_halt() fails, dvb->bulk_urb->transfer_buffer
and dvb->bulk_urb should be freed just like when
usb_submit_urb() fails.

Fixes: 3169c9b26fffa ("V4L/DVB (12788): tm6000: Add initial DVB-T support")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/media/usb/tm6000/tm6000-dvb.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/usb/tm6000/tm6000-dvb.c b/drivers/media/usb/tm6000/tm6000-dvb.c
index 3db2fd7f5d7c4..e4f2160f46ff1 100644
--- a/drivers/media/usb/tm6000/tm6000-dvb.c
+++ b/drivers/media/usb/tm6000/tm6000-dvb.c
@@ -149,6 +149,10 @@ static int tm6000_start_stream(struct tm6000_core *dev)
 	if (ret < 0) {
 		printk(KERN_ERR "tm6000: error %i in %s during pipe reset\n",
 							ret, __func__);
+
+		kfree(dvb->bulk_urb->transfer_buffer);
+		usb_free_urb(dvb->bulk_urb);
+		dvb->bulk_urb = NULL;
 		return ret;
 	} else
 		printk(KERN_ERR "tm6000: pipe resetted\n");
-- 
2.27.0




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

* [PATCH 4.19 086/247] ASoC: cs42l56: fix up error handling in probe
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (84 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 085/247] media: tm6000: Fix memleak in tm6000_start_stream Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 087/247] crypto: bcm - Rename struct device_private to bcm_device_private Greg Kroah-Hartman
                   ` (163 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Mark Brown, Sasha Levin

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

[ Upstream commit 856fe64da84c95a1d415564b981ae3908eea2a76 ]

There are two issues with this code.  The first error path forgot to set
the error code and instead returns success.  The second error path
doesn't clean up.

Fixes: 272b5edd3b8f ("ASoC: Add support for CS42L56 CODEC")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/X9NE/9nK9/TuxuL+@mwanda
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/codecs/cs42l56.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/cs42l56.c b/sound/soc/codecs/cs42l56.c
index a5c8736fad777..04f89b751304c 100644
--- a/sound/soc/codecs/cs42l56.c
+++ b/sound/soc/codecs/cs42l56.c
@@ -1260,6 +1260,7 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client,
 		dev_err(&i2c_client->dev,
 			"CS42L56 Device ID (%X). Expected %X\n",
 			devid, CS42L56_DEVID);
+		ret = -EINVAL;
 		goto err_enable;
 	}
 	alpha_rev = reg & CS42L56_AREV_MASK;
@@ -1317,7 +1318,7 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client,
 	ret =  devm_snd_soc_register_component(&i2c_client->dev,
 			&soc_component_dev_cs42l56, &cs42l56_dai, 1);
 	if (ret < 0)
-		return ret;
+		goto err_enable;
 
 	return 0;
 
-- 
2.27.0




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

* [PATCH 4.19 087/247] crypto: bcm - Rename struct device_private to bcm_device_private
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (85 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 086/247] ASoC: cs42l56: fix up error handling in probe Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 088/247] drm/amd/display: Fix 10/12 bpc setup in DCE output bit depth reduction Greg Kroah-Hartman
                   ` (162 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jiri Olsa, Qais Yousef, Herbert Xu,
	Sasha Levin

From: Jiri Olsa <jolsa@kernel.org>

[ Upstream commit f7f2b43eaf6b4cfe54c75100709be31d5c4b52c8 ]

Renaming 'struct device_private' to 'struct bcm_device_private',
because it clashes with 'struct device_private' from
'drivers/base/base.h'.

While it's not a functional problem, it's causing two distinct
type hierarchies in BTF data. It also breaks build with options:
  CONFIG_DEBUG_INFO_BTF=y
  CONFIG_CRYPTO_DEV_BCM_SPU=y

as reported by Qais Yousef [1].

[1] https://lore.kernel.org/lkml/20201229151352.6hzmjvu3qh6p2qgg@e107158-lin/

Fixes: 9d12ba86f818 ("crypto: brcm - Add Broadcom SPU driver")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/crypto/bcm/cipher.c | 2 +-
 drivers/crypto/bcm/cipher.h | 4 ++--
 drivers/crypto/bcm/util.c   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c
index c2736274ad634..c63992fbbc988 100644
--- a/drivers/crypto/bcm/cipher.c
+++ b/drivers/crypto/bcm/cipher.c
@@ -52,7 +52,7 @@
 
 /* ================= Device Structure ================== */
 
-struct device_private iproc_priv;
+struct bcm_device_private iproc_priv;
 
 /* ==================== Parameters ===================== */
 
diff --git a/drivers/crypto/bcm/cipher.h b/drivers/crypto/bcm/cipher.h
index 763c425c41cae..36452d26c7c5c 100644
--- a/drivers/crypto/bcm/cipher.h
+++ b/drivers/crypto/bcm/cipher.h
@@ -431,7 +431,7 @@ struct spu_hw {
 	u32 num_chan;
 };
 
-struct device_private {
+struct bcm_device_private {
 	struct platform_device *pdev;
 
 	struct spu_hw spu;
@@ -478,6 +478,6 @@ struct device_private {
 	struct mbox_chan **mbox;
 };
 
-extern struct device_private iproc_priv;
+extern struct bcm_device_private iproc_priv;
 
 #endif
diff --git a/drivers/crypto/bcm/util.c b/drivers/crypto/bcm/util.c
index a912c6ad3e850..f96d1dade010a 100644
--- a/drivers/crypto/bcm/util.c
+++ b/drivers/crypto/bcm/util.c
@@ -400,7 +400,7 @@ char *spu_alg_name(enum spu_cipher_alg alg, enum spu_cipher_mode mode)
 static ssize_t spu_debugfs_read(struct file *filp, char __user *ubuf,
 				size_t count, loff_t *offp)
 {
-	struct device_private *ipriv;
+	struct bcm_device_private *ipriv;
 	char *buf;
 	ssize_t ret, out_offset, out_count;
 	int i;
-- 
2.27.0




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

* [PATCH 4.19 088/247] drm/amd/display: Fix 10/12 bpc setup in DCE output bit depth reduction.
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (86 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 087/247] crypto: bcm - Rename struct device_private to bcm_device_private Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 089/247] media: lmedm04: Fix misuse of comma Greg Kroah-Hartman
                   ` (161 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mario Kleiner, Harry Wentland,
	Alex Deucher, Sasha Levin

From: Mario Kleiner <mario.kleiner.de@gmail.com>

[ Upstream commit 1916866dfa4aaceba1a70db83fde569387649d93 ]

In set_clamp(), the comments and definitions for the COLOR_DEPTH_101010
and COLOR_DEPTH_121212 cases directly contradict the code comment which
explains how this should work, whereas the COLOR_DEPTH_888 case
is consistent with the code comments. Comment says the bitmask should
be chosen to align to the top-most 10 or 12 MSB's on a 14 bit bus, but
the implementation contradicts that: 10 bit case sets a mask for 12 bpc
clamping, whereas 12 bit case sets a mask for 14 bpc clamping.

Note that during my limited testing on DCE-8.3 (HDMI deep color)
and DCE-11.2 (DP deep color), this didn't have any obvious ill
effects, neither did fixing it change anything obvious for the
better, so this fix may be inconsequential on DCE, and just
reduce the confusion of innocent bystanders when reading the code
and trying to investigate problems with 10 bpc+ output.

Fixes: 4562236b3bc0 ("drm/amd/dc: Add dc display driver (v2)")

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_transform.c b/drivers/gpu/drm/amd/display/dc/dce/dce_transform.c
index ab63d0d0304cb..6fd57cfb112f5 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_transform.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_transform.c
@@ -429,12 +429,12 @@ static void set_clamp(
 		clamp_max = 0x3FC0;
 		break;
 	case COLOR_DEPTH_101010:
-		/* 10bit MSB aligned on 14 bit bus '11 1111 1111 1100' */
-		clamp_max = 0x3FFC;
+		/* 10bit MSB aligned on 14 bit bus '11 1111 1111 0000' */
+		clamp_max = 0x3FF0;
 		break;
 	case COLOR_DEPTH_121212:
-		/* 12bit MSB aligned on 14 bit bus '11 1111 1111 1111' */
-		clamp_max = 0x3FFF;
+		/* 12bit MSB aligned on 14 bit bus '11 1111 1111 1100' */
+		clamp_max = 0x3FFC;
 		break;
 	default:
 		clamp_max = 0x3FC0;
-- 
2.27.0




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

* [PATCH 4.19 089/247] media: lmedm04: Fix misuse of comma
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (87 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 088/247] drm/amd/display: Fix 10/12 bpc setup in DCE output bit depth reduction Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 090/247] media: qm1d1c0042: fix error return code in qm1d1c0042_init() Greg Kroah-Hartman
                   ` (160 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Joe Perches, Sean Young,
	Mauro Carvalho Chehab, Sasha Levin

From: Joe Perches <joe@perches.com>

[ Upstream commit 59a3e78f8cc33901fe39035c1ab681374bba95ad ]

There's a comma used instead of a semicolon that causes multiple
statements to be executed after an if instead of just the intended
single statement.

Replace the comma with a semicolon.

Fixes: 15e1ce33182d ("[media] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb")
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/media/usb/dvb-usb-v2/lmedm04.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c
index 0750a975bcb89..316edb2dd6c4a 100644
--- a/drivers/media/usb/dvb-usb-v2/lmedm04.c
+++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c
@@ -436,7 +436,7 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap)
 	ep = usb_pipe_endpoint(d->udev, lme_int->lme_urb->pipe);
 
 	if (usb_endpoint_type(&ep->desc) == USB_ENDPOINT_XFER_BULK)
-		lme_int->lme_urb->pipe = usb_rcvbulkpipe(d->udev, 0xa),
+		lme_int->lme_urb->pipe = usb_rcvbulkpipe(d->udev, 0xa);
 
 	lme_int->lme_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
 
-- 
2.27.0




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

* [PATCH 4.19 090/247] media: qm1d1c0042: fix error return code in qm1d1c0042_init()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (88 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 089/247] media: lmedm04: Fix misuse of comma Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 091/247] media: cx25821: Fix a bug when reallocating some dma memory Greg Kroah-Hartman
                   ` (159 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Hulk Robot, Luo Meng,
	Akihiro Tsukada, Hans Verkuil, Mauro Carvalho Chehab,
	Sasha Levin

From: Luo Meng <luomeng12@huawei.com>

[ Upstream commit fcf8d018bdca0453b8d6359062e6bc1512d04c38 ]

Fix to return a negative error code from the error handling case
instead of 0 in function qm1d1c0042_init(), as done elsewhere
in this function.

Fixes: ab4d14528fdf ("[media] em28xx: add support for PLEX PX-BCUD (ISDB-S)")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Luo Meng <luomeng12@huawei.com>
Acked-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/media/tuners/qm1d1c0042.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/tuners/qm1d1c0042.c b/drivers/media/tuners/qm1d1c0042.c
index 83ca5dc047ea2..baa9950783b66 100644
--- a/drivers/media/tuners/qm1d1c0042.c
+++ b/drivers/media/tuners/qm1d1c0042.c
@@ -343,8 +343,10 @@ static int qm1d1c0042_init(struct dvb_frontend *fe)
 		if (val == reg_initval[reg_index][0x00])
 			break;
 	}
-	if (reg_index >= QM1D1C0042_NUM_REG_ROWS)
+	if (reg_index >= QM1D1C0042_NUM_REG_ROWS) {
+		ret = -EINVAL;
 		goto failed;
+	}
 	memcpy(state->regs, reg_initval[reg_index], QM1D1C0042_NUM_REGS);
 	usleep_range(2000, 3000);
 
-- 
2.27.0




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

* [PATCH 4.19 091/247] media: cx25821: Fix a bug when reallocating some dma memory
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (89 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 090/247] media: qm1d1c0042: fix error return code in qm1d1c0042_init() Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 092/247] media: pxa_camera: declare variable when DEBUG is defined Greg Kroah-Hartman
                   ` (158 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christophe JAILLET, Hans Verkuil,
	Mauro Carvalho Chehab, Sasha Levin

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

[ Upstream commit b2de3643c5024fc4fd128ba7767c7fb8b714bea7 ]

This function looks like a realloc.

However, if 'risc->cpu != NULL', the memory will be freed, but never
reallocated with the bigger 'size'.
Explicitly set 'risc->cpu' to NULL, so that the reallocation is
correctly performed a few lines below.

[hverkuil: NULL != risc->cpu -> risc->cpu]

Fixes: 5ede94c70553 ("[media] cx25821: remove bogus btcx_risc dependency)
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/media/pci/cx25821/cx25821-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/cx25821/cx25821-core.c b/drivers/media/pci/cx25821/cx25821-core.c
index 2f0171134f7e1..e04fe9f17b7aa 100644
--- a/drivers/media/pci/cx25821/cx25821-core.c
+++ b/drivers/media/pci/cx25821/cx25821-core.c
@@ -986,8 +986,10 @@ int cx25821_riscmem_alloc(struct pci_dev *pci,
 	__le32 *cpu;
 	dma_addr_t dma = 0;
 
-	if (NULL != risc->cpu && risc->size < size)
+	if (risc->cpu && risc->size < size) {
 		pci_free_consistent(pci, risc->size, risc->cpu, risc->dma);
+		risc->cpu = NULL;
+	}
 	if (NULL == risc->cpu) {
 		cpu = pci_zalloc_consistent(pci, size, &dma);
 		if (NULL == cpu)
-- 
2.27.0




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

* [PATCH 4.19 092/247] media: pxa_camera: declare variable when DEBUG is defined
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (90 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 091/247] media: cx25821: Fix a bug when reallocating some dma memory Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 093/247] media: uvcvideo: Accept invalid bFormatIndex and bFrameIndex values Greg Kroah-Hartman
                   ` (157 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Tom Rix, Hans Verkuil,
	Mauro Carvalho Chehab, Sasha Levin

From: Tom Rix <trix@redhat.com>

[ Upstream commit 031b9212eeee365443aaef013360ea6cded7b2c4 ]

When DEBUG is defined this error occurs

drivers/media/platform/pxa_camera.c:1410:7: error:
  ‘i’ undeclared (first use in this function)
  for (i = 0; i < vb->num_planes; i++)
       ^
The variable 'i' is missing, so declare it.

Fixes: 6f28435d1c15 ("[media] media: platform: pxa_camera: trivial move of functions")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/media/platform/pxa_camera.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c
index 406ac673ad84c..0281b8e53fef2 100644
--- a/drivers/media/platform/pxa_camera.c
+++ b/drivers/media/platform/pxa_camera.c
@@ -1452,6 +1452,9 @@ static int pxac_vb2_prepare(struct vb2_buffer *vb)
 	struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vb->vb2_queue);
 	struct pxa_buffer *buf = vb2_to_pxa_buffer(vb);
 	int ret = 0;
+#ifdef DEBUG
+	int i;
+#endif
 
 	switch (pcdev->channels) {
 	case 1:
-- 
2.27.0




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

* [PATCH 4.19 093/247] media: uvcvideo: Accept invalid bFormatIndex and bFrameIndex values
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (91 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 092/247] media: pxa_camera: declare variable when DEBUG is defined Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 094/247] crypto: talitos - Work around SEC6 ERRATA (AES-CTR mode data size error) Greg Kroah-Hartman
                   ` (156 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Till Dörges, Laurent Pinchart,
	Mauro Carvalho Chehab, Sasha Levin

From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

[ Upstream commit dc9455ffae02d7b7fb51ba1e007fffcb9dc5d890 ]

The Renkforce RF AC4K 300 Action Cam 4K reports invalid bFormatIndex and
bFrameIndex values when negotiating the video probe and commit controls.
The UVC descriptors report a single supported format and frame size,
with bFormatIndex and bFrameIndex both equal to 2, but the video probe
and commit controls report bFormatIndex and bFrameIndex set to 1.

The device otherwise operates correctly, but the driver rejects the
values and fails the format try operation. Fix it by ignoring the
invalid indices, and assuming that the format and frame requested by the
driver are accepted by the device.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=210767

Fixes: 8a652a17e3c0 ("media: uvcvideo: Ensure all probed info is returned to v4l2")
Reported-by: Till Dörges <doerges@pre-sense.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/media/usb/uvc/uvc_v4l2.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 0921c95a1dca5..06167c51af128 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -253,7 +253,9 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
 		goto done;
 
 	/* After the probe, update fmt with the values returned from
-	 * negotiation with the device.
+	 * negotiation with the device. Some devices return invalid bFormatIndex
+	 * and bFrameIndex values, in which case we can only assume they have
+	 * accepted the requested format as-is.
 	 */
 	for (i = 0; i < stream->nformats; ++i) {
 		if (probe->bFormatIndex == stream->format[i].index) {
@@ -262,11 +264,10 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
 		}
 	}
 
-	if (i == stream->nformats) {
-		uvc_trace(UVC_TRACE_FORMAT, "Unknown bFormatIndex %u\n",
+	if (i == stream->nformats)
+		uvc_trace(UVC_TRACE_FORMAT,
+			  "Unknown bFormatIndex %u, using default\n",
 			  probe->bFormatIndex);
-		return -EINVAL;
-	}
 
 	for (i = 0; i < format->nframes; ++i) {
 		if (probe->bFrameIndex == format->frame[i].bFrameIndex) {
@@ -275,11 +276,10 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
 		}
 	}
 
-	if (i == format->nframes) {
-		uvc_trace(UVC_TRACE_FORMAT, "Unknown bFrameIndex %u\n",
+	if (i == format->nframes)
+		uvc_trace(UVC_TRACE_FORMAT,
+			  "Unknown bFrameIndex %u, using default\n",
 			  probe->bFrameIndex);
-		return -EINVAL;
-	}
 
 	fmt->fmt.pix.width = frame->wWidth;
 	fmt->fmt.pix.height = frame->wHeight;
-- 
2.27.0




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

* [PATCH 4.19 094/247] crypto: talitos - Work around SEC6 ERRATA (AES-CTR mode data size error)
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (92 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 093/247] media: uvcvideo: Accept invalid bFormatIndex and bFrameIndex values Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 095/247] ata: ahci_brcm: Add back regulators management Greg Kroah-Hartman
                   ` (155 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christophe Leroy, Herbert Xu, Sasha Levin

From: Christophe Leroy <christophe.leroy@csgroup.eu>

[ Upstream commit 416b846757bcea20006a9197e67ba3a8b5b2a680 ]

Talitos Security Engine AESU considers any input
data size that is not a multiple of 16 bytes to be an error.
This is not a problem in general, except for Counter mode
that is a stream cipher and can have an input of any size.

Test Manager for ctr(aes) fails on 4th test vector which has
a length of 499 while all previous vectors which have a 16 bytes
multiple length succeed.

As suggested by Freescale, round up the input data length to the
nearest 16 bytes.

Fixes: 5e75ae1b3cef ("crypto: talitos - add new crypto modes")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/crypto/talitos.c | 28 ++++++++++++++++------------
 drivers/crypto/talitos.h |  1 +
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index c70a7c4f5b739..7a55baa861e58 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -1066,11 +1066,12 @@ static void ipsec_esp_decrypt_hwauth_done(struct device *dev,
  */
 static int sg_to_link_tbl_offset(struct scatterlist *sg, int sg_count,
 				 unsigned int offset, int datalen, int elen,
-				 struct talitos_ptr *link_tbl_ptr)
+				 struct talitos_ptr *link_tbl_ptr, int align)
 {
 	int n_sg = elen ? sg_count + 1 : sg_count;
 	int count = 0;
 	int cryptlen = datalen + elen;
+	int padding = ALIGN(cryptlen, align) - cryptlen;
 
 	while (cryptlen && sg && n_sg--) {
 		unsigned int len = sg_dma_len(sg);
@@ -1094,7 +1095,7 @@ static int sg_to_link_tbl_offset(struct scatterlist *sg, int sg_count,
 			offset += datalen;
 		}
 		to_talitos_ptr(link_tbl_ptr + count,
-			       sg_dma_address(sg) + offset, len, 0);
+			       sg_dma_address(sg) + offset, sg_next(sg) ? len : len + padding, 0);
 		to_talitos_ptr_ext_set(link_tbl_ptr + count, 0, 0);
 		count++;
 		cryptlen -= len;
@@ -1117,10 +1118,11 @@ static int talitos_sg_map_ext(struct device *dev, struct scatterlist *src,
 			      unsigned int len, struct talitos_edesc *edesc,
 			      struct talitos_ptr *ptr, int sg_count,
 			      unsigned int offset, int tbl_off, int elen,
-			      bool force)
+			      bool force, int align)
 {
 	struct talitos_private *priv = dev_get_drvdata(dev);
 	bool is_sec1 = has_ftr_sec1(priv);
+	int aligned_len = ALIGN(len, align);
 
 	if (!src) {
 		to_talitos_ptr(ptr, 0, 0, is_sec1);
@@ -1128,22 +1130,22 @@ static int talitos_sg_map_ext(struct device *dev, struct scatterlist *src,
 	}
 	to_talitos_ptr_ext_set(ptr, elen, is_sec1);
 	if (sg_count == 1 && !force) {
-		to_talitos_ptr(ptr, sg_dma_address(src) + offset, len, is_sec1);
+		to_talitos_ptr(ptr, sg_dma_address(src) + offset, aligned_len, is_sec1);
 		return sg_count;
 	}
 	if (is_sec1) {
-		to_talitos_ptr(ptr, edesc->dma_link_tbl + offset, len, is_sec1);
+		to_talitos_ptr(ptr, edesc->dma_link_tbl + offset, aligned_len, is_sec1);
 		return sg_count;
 	}
 	sg_count = sg_to_link_tbl_offset(src, sg_count, offset, len, elen,
-					 &edesc->link_tbl[tbl_off]);
+					 &edesc->link_tbl[tbl_off], align);
 	if (sg_count == 1 && !force) {
 		/* Only one segment now, so no link tbl needed*/
 		copy_talitos_ptr(ptr, &edesc->link_tbl[tbl_off], is_sec1);
 		return sg_count;
 	}
 	to_talitos_ptr(ptr, edesc->dma_link_tbl +
-			    tbl_off * sizeof(struct talitos_ptr), len, is_sec1);
+			    tbl_off * sizeof(struct talitos_ptr), aligned_len, is_sec1);
 	to_talitos_ptr_ext_or(ptr, DESC_PTR_LNKTBL_JUMP, is_sec1);
 
 	return sg_count;
@@ -1155,7 +1157,7 @@ static int talitos_sg_map(struct device *dev, struct scatterlist *src,
 			  unsigned int offset, int tbl_off)
 {
 	return talitos_sg_map_ext(dev, src, len, edesc, ptr, sg_count, offset,
-				  tbl_off, 0, false);
+				  tbl_off, 0, false, 1);
 }
 
 /*
@@ -1224,7 +1226,7 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq,
 
 	ret = talitos_sg_map_ext(dev, areq->src, cryptlen, edesc, &desc->ptr[4],
 				 sg_count, areq->assoclen, tbl_off, elen,
-				 false);
+				 false, 1);
 
 	if (ret > 1) {
 		tbl_off += ret;
@@ -1244,7 +1246,7 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq,
 		elen = 0;
 	ret = talitos_sg_map_ext(dev, areq->dst, cryptlen, edesc, &desc->ptr[5],
 				 sg_count, areq->assoclen, tbl_off, elen,
-				 is_ipsec_esp && !encrypt);
+				 is_ipsec_esp && !encrypt, 1);
 	tbl_off += ret;
 
 	/* ICV data */
@@ -1554,6 +1556,8 @@ static int common_nonsnoop(struct talitos_edesc *edesc,
 	bool sync_needed = false;
 	struct talitos_private *priv = dev_get_drvdata(dev);
 	bool is_sec1 = has_ftr_sec1(priv);
+	bool is_ctr = (desc->hdr & DESC_HDR_SEL0_MASK) == DESC_HDR_SEL0_AESU &&
+		      (desc->hdr & DESC_HDR_MODE0_AESU_MASK) == DESC_HDR_MODE0_AESU_CTR;
 
 	/* first DWORD empty */
 
@@ -1574,8 +1578,8 @@ static int common_nonsnoop(struct talitos_edesc *edesc,
 	/*
 	 * cipher in
 	 */
-	sg_count = talitos_sg_map(dev, areq->src, cryptlen, edesc,
-				  &desc->ptr[3], sg_count, 0, 0);
+	sg_count = talitos_sg_map_ext(dev, areq->src, cryptlen, edesc, &desc->ptr[3],
+				      sg_count, 0, 0, 0, false, is_ctr ? 16 : 1);
 	if (sg_count > 1)
 		sync_needed = true;
 
diff --git a/drivers/crypto/talitos.h b/drivers/crypto/talitos.h
index cb0137e131cc8..16f96c57de341 100644
--- a/drivers/crypto/talitos.h
+++ b/drivers/crypto/talitos.h
@@ -377,6 +377,7 @@ static inline bool has_ftr_sec1(struct talitos_private *priv)
 
 /* primary execution unit mode (MODE0) and derivatives */
 #define	DESC_HDR_MODE0_ENCRYPT		cpu_to_be32(0x00100000)
+#define	DESC_HDR_MODE0_AESU_MASK	cpu_to_be32(0x00600000)
 #define	DESC_HDR_MODE0_AESU_CBC		cpu_to_be32(0x00200000)
 #define	DESC_HDR_MODE0_AESU_CTR		cpu_to_be32(0x00600000)
 #define	DESC_HDR_MODE0_DEU_CBC		cpu_to_be32(0x00400000)
-- 
2.27.0




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

* [PATCH 4.19 095/247] ata: ahci_brcm: Add back regulators management
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (93 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 094/247] crypto: talitos - Work around SEC6 ERRATA (AES-CTR mode data size error) Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 096/247] ASoC: cpcap: fix microphone timeslot mask Greg Kroah-Hartman
                   ` (154 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Florian Fainelli, Jens Axboe, Sasha Levin

From: Florian Fainelli <f.fainelli@gmail.com>

[ Upstream commit 10340f8d7b6dd54e616339c8ccb2f397133ebea0 ]

While reworking the resources management and departing from using
ahci_platform_enable_resources() which did not allow a proper step
separation like we need, we unfortunately lost the ability to control
AHCI regulators. This broke some Broadcom STB systems that do expect
regulators to be turned on to link up with attached hard drives.

Fixes: c0cdf2ac4b5b ("ata: ahci_brcm: Fix AHCI resources management")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/ata/ahci_brcm.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/ahci_brcm.c b/drivers/ata/ahci_brcm.c
index 0192cab1b862f..e58b336d1324c 100644
--- a/drivers/ata/ahci_brcm.c
+++ b/drivers/ata/ahci_brcm.c
@@ -370,6 +370,10 @@ static int brcm_ahci_resume(struct device *dev)
 	if (ret)
 		return ret;
 
+	ret = ahci_platform_enable_regulators(hpriv);
+	if (ret)
+		goto out_disable_clks;
+
 	brcm_sata_init(priv);
 	brcm_sata_phys_enable(priv);
 	brcm_sata_alpm_init(hpriv);
@@ -399,6 +403,8 @@ out_disable_platform_phys:
 	ahci_platform_disable_phys(hpriv);
 out_disable_phys:
 	brcm_sata_phys_disable(priv);
+	ahci_platform_disable_regulators(hpriv);
+out_disable_clks:
 	ahci_platform_disable_clks(hpriv);
 	return ret;
 }
@@ -471,6 +477,10 @@ static int brcm_ahci_probe(struct platform_device *pdev)
 	if (ret)
 		goto out_reset;
 
+	ret = ahci_platform_enable_regulators(hpriv);
+	if (ret)
+		goto out_disable_clks;
+
 	/* Must be first so as to configure endianness including that
 	 * of the standard AHCI register space.
 	 */
@@ -480,7 +490,7 @@ static int brcm_ahci_probe(struct platform_device *pdev)
 	priv->port_mask = brcm_ahci_get_portmask(hpriv, priv);
 	if (!priv->port_mask) {
 		ret = -ENODEV;
-		goto out_disable_clks;
+		goto out_disable_regulators;
 	}
 
 	/* Must be done before ahci_platform_enable_phys() */
@@ -505,6 +515,8 @@ out_disable_platform_phys:
 	ahci_platform_disable_phys(hpriv);
 out_disable_phys:
 	brcm_sata_phys_disable(priv);
+out_disable_regulators:
+	ahci_platform_disable_regulators(hpriv);
 out_disable_clks:
 	ahci_platform_disable_clks(hpriv);
 out_reset:
-- 
2.27.0




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

* [PATCH 4.19 096/247] ASoC: cpcap: fix microphone timeslot mask
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (94 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 095/247] ata: ahci_brcm: Add back regulators management Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 097/247] f2fs: fix to avoid inconsistent quota data Greg Kroah-Hartman
                   ` (153 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Sebastian Reichel,
	Tony Lindgren, Mark Brown, Sasha Levin

From: Sebastian Reichel <sre@kernel.org>

[ Upstream commit de5bfae2fd962a9da99f56382305ec7966a604b9 ]

The correct mask is 0x1f8 (Bit 3-8), but due to missing BIT() 0xf (Bit
0-3) was set instead. This means setting of CPCAP_BIT_MIC1_RX_TIMESLOT0
(Bit 3) still worked (part of both masks). On the other hand the code
does not properly clear the other MIC timeslot bits. I think this
is not a problem, since they are probably initialized to 0 and not
touched by the driver anywhere else. But the mask also contains some
wrong bits, that will be cleared. Bit 0 (CPCAP_BIT_SMB_CDC) should be
safe, since the driver enforces it to be 0 anyways.

Bit 1-2 are CPCAP_BIT_FS_INV and CPCAP_BIT_CLK_INV. This means enabling
audio recording forces the codec into SND_SOC_DAIFMT_NB_NF mode, which
is obviously bad.

The bug probably remained undetected, because there are not many use
cases for routing microphone to the CPU on platforms using cpcap and
user base is small. I do remember having some issues with bad sound
quality when testing voice recording back when I wrote the driver.
It probably was this bug.

Fixes: f6cdf2d3445d ("ASoC: cpcap: new codec")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Reviewed-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20210123172945.3958622-1-sre@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/codecs/cpcap.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/cpcap.c b/sound/soc/codecs/cpcap.c
index d7f05b384f1fb..1902689c5ea2c 100644
--- a/sound/soc/codecs/cpcap.c
+++ b/sound/soc/codecs/cpcap.c
@@ -1263,12 +1263,12 @@ static int cpcap_voice_hw_params(struct snd_pcm_substream *substream,
 
 	if (direction == SNDRV_PCM_STREAM_CAPTURE) {
 		mask = 0x0000;
-		mask |= CPCAP_BIT_MIC1_RX_TIMESLOT0;
-		mask |= CPCAP_BIT_MIC1_RX_TIMESLOT1;
-		mask |= CPCAP_BIT_MIC1_RX_TIMESLOT2;
-		mask |= CPCAP_BIT_MIC2_TIMESLOT0;
-		mask |= CPCAP_BIT_MIC2_TIMESLOT1;
-		mask |= CPCAP_BIT_MIC2_TIMESLOT2;
+		mask |= BIT(CPCAP_BIT_MIC1_RX_TIMESLOT0);
+		mask |= BIT(CPCAP_BIT_MIC1_RX_TIMESLOT1);
+		mask |= BIT(CPCAP_BIT_MIC1_RX_TIMESLOT2);
+		mask |= BIT(CPCAP_BIT_MIC2_TIMESLOT0);
+		mask |= BIT(CPCAP_BIT_MIC2_TIMESLOT1);
+		mask |= BIT(CPCAP_BIT_MIC2_TIMESLOT2);
 		val = 0x0000;
 		if (channels >= 2)
 			val = BIT(CPCAP_BIT_MIC1_RX_TIMESLOT0);
-- 
2.27.0




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

* [PATCH 4.19 097/247] f2fs: fix to avoid inconsistent quota data
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (95 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 096/247] ASoC: cpcap: fix microphone timeslot mask Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 098/247] drm/amdgpu: Prevent shift wrapping in amdgpu_read_mask() Greg Kroah-Hartman
                   ` (152 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Daiyue Zhang, Dehe Gu, Junchao Jiang,
	Ge Qiu, Yi Chen, Chao Yu, Jaegeuk Kim, Sasha Levin

From: Yi Chen <chenyi77@huawei.com>

[ Upstream commit 25fb04dbce6a0e165d28fd1fa8a1d7018c637fe8 ]

Occasionally, quota data may be corrupted detected by fsck:

Info: checkpoint state = 45 :  crc compacted_summary unmount
[QUOTA WARNING] Usage inconsistent for ID 0:actual (1543036928, 762) != expected (1543032832, 762)
[ASSERT] (fsck_chk_quota_files:1986)  --> Quota file is missing or invalid quota file content found.
[QUOTA WARNING] Usage inconsistent for ID 0:actual (1352478720, 344) != expected (1352474624, 344)
[ASSERT] (fsck_chk_quota_files:1986)  --> Quota file is missing or invalid quota file content found.

[FSCK] Unreachable nat entries                        [Ok..] [0x0]
[FSCK] SIT valid block bitmap checking                [Ok..]
[FSCK] Hard link checking for regular file            [Ok..] [0x0]
[FSCK] valid_block_count matching with CP             [Ok..] [0xdf299]
[FSCK] valid_node_count matcing with CP (de lookup)   [Ok..] [0x2b01]
[FSCK] valid_node_count matcing with CP (nat lookup)  [Ok..] [0x2b01]
[FSCK] valid_inode_count matched with CP              [Ok..] [0x2665]
[FSCK] free segment_count matched with CP             [Ok..] [0xcb04]
[FSCK] next block offset is free                      [Ok..]
[FSCK] fixing SIT types
[FSCK] other corrupted bugs                           [Fail]

The root cause is:
If we open file w/ readonly flag, disk quota info won't be initialized
for this file, however, following mmap() will force to convert inline
inode via f2fs_convert_inline_inode(), which may increase block usage
for this inode w/o updating quota data, it causes inconsistent disk quota
info.

The issue will happen in following stack:
open(file, O_RDONLY)
mmap(file)
- f2fs_convert_inline_inode
 - f2fs_convert_inline_page
  - f2fs_reserve_block
   - f2fs_reserve_new_block
    - f2fs_reserve_new_blocks
     - f2fs_i_blocks_write
      - dquot_claim_block
inode->i_blocks increase, but the dqb_curspace keep the size for the dquots
is NULL.

To fix this issue, let's call dquot_initialize() anyway in both
f2fs_truncate() and f2fs_convert_inline_inode() functions to avoid potential
inconsistent quota data issue.

Fixes: 0abd675e97e6 ("f2fs: support plain user/group quota")
Signed-off-by: Daiyue Zhang <zhangdaiyue1@huawei.com>
Signed-off-by: Dehe Gu <gudehe@huawei.com>
Signed-off-by: Junchao Jiang <jiangjunchao1@huawei.com>
Signed-off-by: Ge Qiu <qiuge@huawei.com>
Signed-off-by: Yi Chen <chenyi77@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/f2fs/file.c   | 4 ++++
 fs/f2fs/inline.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 59b5c0b032bb5..79e692a6c8b27 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -675,6 +675,10 @@ int f2fs_truncate(struct inode *inode)
 		return -EIO;
 	}
 
+	err = dquot_initialize(inode);
+	if (err)
+		return err;
+
 	/* we should check inline_data size */
 	if (!f2fs_may_inline_data(inode)) {
 		err = f2fs_convert_inline_inode(inode);
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 2fabeb0bb28fd..299f295fcb6c7 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -193,6 +193,10 @@ int f2fs_convert_inline_inode(struct inode *inode)
 	if (!f2fs_has_inline_data(inode))
 		return 0;
 
+	err = dquot_initialize(inode);
+	if (err)
+		return err;
+
 	page = f2fs_grab_cache_page(inode->i_mapping, 0, false);
 	if (!page)
 		return -ENOMEM;
-- 
2.27.0




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

* [PATCH 4.19 098/247] drm/amdgpu: Prevent shift wrapping in amdgpu_read_mask()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (96 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 097/247] f2fs: fix to avoid inconsistent quota data Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:11 ` [PATCH 4.19 099/247] Drivers: hv: vmbus: Avoid use-after-free in vmbus_onoffer_rescind() Greg Kroah-Hartman
                   ` (151 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Alex Deucher, Sasha Levin

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

[ Upstream commit c915ef890d5dc79f483e1ca3b3a5b5f1a170690c ]

If the user passes a "level" value which is higher than 31 then that
leads to shift wrapping.  The undefined behavior will lead to a
syzkaller stack dump.

Fixes: 5632708f4452 ("drm/amd/powerplay: add dpm force multiple levels on cz/tonga/fiji/polaris (v2)")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index e63a253eb4255..cbb969a870f6a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -617,7 +617,7 @@ static ssize_t amdgpu_get_pp_dpm_sclk(struct device *dev,
 static ssize_t amdgpu_read_mask(const char *buf, size_t count, uint32_t *mask)
 {
 	int ret;
-	long level;
+	unsigned long level;
 	char *sub_str = NULL;
 	char *tmp;
 	char buf_cpy[AMDGPU_MASK_BUF_MAX + 1];
@@ -633,8 +633,8 @@ static ssize_t amdgpu_read_mask(const char *buf, size_t count, uint32_t *mask)
 	while (tmp[0]) {
 		sub_str = strsep(&tmp, delimiter);
 		if (strlen(sub_str)) {
-			ret = kstrtol(sub_str, 0, &level);
-			if (ret)
+			ret = kstrtoul(sub_str, 0, &level);
+			if (ret || level > 31)
 				return -EINVAL;
 			*mask |= 1 << level;
 		} else
-- 
2.27.0




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

* [PATCH 4.19 099/247] Drivers: hv: vmbus: Avoid use-after-free in vmbus_onoffer_rescind()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (97 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 098/247] drm/amdgpu: Prevent shift wrapping in amdgpu_read_mask() Greg Kroah-Hartman
@ 2021-03-01 16:11 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 100/247] btrfs: clarify error returns values in __load_free_space_cache Greg Kroah-Hartman
                   ` (150 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Juan Vazquez,
	Andrea Parri (Microsoft),
	Michael Kelley, Wei Liu, Sasha Levin

From: Andrea Parri (Microsoft) <parri.andrea@gmail.com>

[ Upstream commit e3fa4b747f085d2cda09bba0533b86fa76038635 ]

When channel->device_obj is non-NULL, vmbus_onoffer_rescind() could
invoke put_device(), that will eventually release the device and free
the channel object (cf. vmbus_device_release()).  However, a pointer
to the object is dereferenced again later to load the primary_channel.
The use-after-free can be avoided by noticing that this load/check is
redundant if device_obj is non-NULL: primary_channel must be NULL if
device_obj is non-NULL, cf. vmbus_add_channel_work().

Fixes: 54a66265d6754b ("Drivers: hv: vmbus: Fix rescind handling")
Reported-by: Juan Vazquez <juvazq@microsoft.com>
Signed-off-by: Andrea Parri (Microsoft) <parri.andrea@gmail.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Link: https://lore.kernel.org/r/20201209070827.29335-5-parri.andrea@gmail.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/hv/channel_mgmt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 7920b0d7e35a7..ac9617671757c 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -1001,8 +1001,7 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr)
 			vmbus_device_unregister(channel->device_obj);
 			put_device(dev);
 		}
-	}
-	if (channel->primary_channel != NULL) {
+	} else if (channel->primary_channel != NULL) {
 		/*
 		 * Sub-channel is being rescinded. Following is the channel
 		 * close sequence when initiated from the driveri (refer to
-- 
2.27.0




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

* [PATCH 4.19 100/247] btrfs: clarify error returns values in __load_free_space_cache
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (98 preceding siblings ...)
  2021-03-01 16:11 ` [PATCH 4.19 099/247] Drivers: hv: vmbus: Avoid use-after-free in vmbus_onoffer_rescind() Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 101/247] hwrng: timeriomem - Fix cooldown period calculation Greg Kroah-Hartman
                   ` (149 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Hulk Robot, Zhihao Cheng,
	David Sterba, Sasha Levin

From: Zhihao Cheng <chengzhihao1@huawei.com>

[ Upstream commit 3cc64e7ebfb0d7faaba2438334c43466955a96e8 ]

Return value in __load_free_space_cache is not properly set after
(unlikely) memory allocation failures and 0 is returned instead.
This is not a problem for the caller load_free_space_cache because only
value 1 is considered as 'cache loaded' but for clarity it's better
to set the errors accordingly.

Fixes: a67509c30079 ("Btrfs: add a io_ctl struct and helpers for dealing with the space cache")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/btrfs/free-space-cache.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 652b0b16e93e2..6511cb71986c9 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -743,8 +743,10 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
 	while (num_entries) {
 		e = kmem_cache_zalloc(btrfs_free_space_cachep,
 				      GFP_NOFS);
-		if (!e)
+		if (!e) {
+			ret = -ENOMEM;
 			goto free_cache;
+		}
 
 		ret = io_ctl_read_entry(&io_ctl, e, &type);
 		if (ret) {
@@ -753,6 +755,7 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
 		}
 
 		if (!e->bytes) {
+			ret = -1;
 			kmem_cache_free(btrfs_free_space_cachep, e);
 			goto free_cache;
 		}
@@ -773,6 +776,7 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
 			e->bitmap = kmem_cache_zalloc(
 					btrfs_free_space_bitmap_cachep, GFP_NOFS);
 			if (!e->bitmap) {
+				ret = -ENOMEM;
 				kmem_cache_free(
 					btrfs_free_space_cachep, e);
 				goto free_cache;
-- 
2.27.0




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

* [PATCH 4.19 101/247] hwrng: timeriomem - Fix cooldown period calculation
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (99 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 100/247] btrfs: clarify error returns values in __load_free_space_cache Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 102/247] crypto: ecdh_helper - Ensure len >= secret.len in decode_key() Greg Kroah-Hartman
                   ` (148 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jan Henrik Weinstock, Herbert Xu,
	Sasha Levin

From: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de>

[ Upstream commit e145f5565dc48ccaf4cb50b7cfc48777bed8c100 ]

Ensure cooldown period tolerance of 1% is actually accounted for.

Fixes: ca3bff70ab32 ("hwrng: timeriomem - Improve performance...")
Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/char/hw_random/timeriomem-rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/timeriomem-rng.c b/drivers/char/hw_random/timeriomem-rng.c
index f615684028af7..ba01f24db6db0 100644
--- a/drivers/char/hw_random/timeriomem-rng.c
+++ b/drivers/char/hw_random/timeriomem-rng.c
@@ -72,7 +72,7 @@ static int timeriomem_rng_read(struct hwrng *hwrng, void *data,
 		 */
 		if (retval > 0)
 			usleep_range(period_us,
-					period_us + min(1, period_us / 100));
+					period_us + max(1, period_us / 100));
 
 		*(u32 *)data = readl(priv->io_base);
 		retval += sizeof(u32);
-- 
2.27.0




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

* [PATCH 4.19 102/247] crypto: ecdh_helper - Ensure len >= secret.len in decode_key()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (100 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 101/247] hwrng: timeriomem - Fix cooldown period calculation Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 103/247] ima: Free IMA measurement buffer on error Greg Kroah-Hartman
                   ` (147 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Daniele Alessandrelli, Herbert Xu,
	Sasha Levin

From: Daniele Alessandrelli <daniele.alessandrelli@intel.com>

[ Upstream commit a53ab94eb6850c3657392e2d2ce9b38c387a2633 ]

The length ('len' parameter) passed to crypto_ecdh_decode_key() is never
checked against the length encoded in the passed buffer ('buf'
parameter). This could lead to an out-of-bounds access when the passed
length is less than the encoded length.

Add a check to prevent that.

Fixes: 3c4b23901a0c7 ("crypto: ecdh - Add ECDH software support")
Signed-off-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 crypto/ecdh_helper.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/crypto/ecdh_helper.c b/crypto/ecdh_helper.c
index d3af8e8b0b5e4..25711de445848 100644
--- a/crypto/ecdh_helper.c
+++ b/crypto/ecdh_helper.c
@@ -71,6 +71,9 @@ int crypto_ecdh_decode_key(const char *buf, unsigned int len,
 	if (secret.type != CRYPTO_KPP_SECRET_TYPE_ECDH)
 		return -EINVAL;
 
+	if (unlikely(len < secret.len))
+		return -EINVAL;
+
 	ptr = ecdh_unpack_data(&params->curve_id, ptr, sizeof(params->curve_id));
 	ptr = ecdh_unpack_data(&params->key_size, ptr, sizeof(params->key_size));
 	if (secret.len != crypto_ecdh_key_len(params))
-- 
2.27.0




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

* [PATCH 4.19 103/247] ima: Free IMA measurement buffer on error
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (101 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 102/247] crypto: ecdh_helper - Ensure len >= secret.len in decode_key() Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 104/247] ima: Free IMA measurement buffer after kexec syscall Greg Kroah-Hartman
                   ` (146 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Lakshmi Ramasubramanian, Tyler Hicks,
	Mimi Zohar, Sasha Levin

From: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>

[ Upstream commit 6d14c6517885fa68524238787420511b87d671df ]

IMA allocates kernel virtual memory to carry forward the measurement
list, from the current kernel to the next kernel on kexec system call,
in ima_add_kexec_buffer() function.  In error code paths this memory
is not freed resulting in memory leak.

Free the memory allocated for the IMA measurement list in
the error code paths in ima_add_kexec_buffer() function.

Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
Suggested-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Fixes: 7b8589cc29e7 ("ima: on soft reboot, save the measurement list")
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 security/integrity/ima/ima_kexec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/security/integrity/ima/ima_kexec.c b/security/integrity/ima/ima_kexec.c
index 16bd18747cfa0..9f8449dea5b69 100644
--- a/security/integrity/ima/ima_kexec.c
+++ b/security/integrity/ima/ima_kexec.c
@@ -124,6 +124,7 @@ void ima_add_kexec_buffer(struct kimage *image)
 	ret = kexec_add_buffer(&kbuf);
 	if (ret) {
 		pr_err("Error passing over kexec measurement buffer.\n");
+		vfree(kexec_buffer);
 		return;
 	}
 
-- 
2.27.0




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

* [PATCH 4.19 104/247] ima: Free IMA measurement buffer after kexec syscall
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (102 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 103/247] ima: Free IMA measurement buffer on error Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 105/247] fs/jfs: fix potential integer overflow on shift of a int Greg Kroah-Hartman
                   ` (145 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Lakshmi Ramasubramanian, Tyler Hicks,
	Thiago Jung Bauermann, Mimi Zohar, Sasha Levin

From: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>

[ Upstream commit f31e3386a4e92ba6eda7328cb508462956c94c64 ]

IMA allocates kernel virtual memory to carry forward the measurement
list, from the current kernel to the next kernel on kexec system call,
in ima_add_kexec_buffer() function.  This buffer is not freed before
completing the kexec system call resulting in memory leak.

Add ima_buffer field in "struct kimage" to store the virtual address
of the buffer allocated for the IMA measurement list.
Free the memory allocated for the IMA measurement list in
kimage_file_post_load_cleanup() function.

Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
Suggested-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Fixes: 7b8589cc29e7 ("ima: on soft reboot, save the measurement list")
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/linux/kexec.h              | 5 +++++
 kernel/kexec_file.c                | 5 +++++
 security/integrity/ima/ima_kexec.c | 2 ++
 3 files changed, 12 insertions(+)

diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 9e4e638fb5051..fe9f6f2dd811d 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -260,6 +260,11 @@ struct kimage {
 	/* Information for loading purgatory */
 	struct purgatory_info purgatory_info;
 #endif
+
+#ifdef CONFIG_IMA_KEXEC
+	/* Virtual address of IMA measurement buffer for kexec syscall */
+	void *ima_buffer;
+#endif
 };
 
 /* kexec interface functions */
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index c6a3b6851372c..2fbdb78d66c80 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -168,6 +168,11 @@ void kimage_file_post_load_cleanup(struct kimage *image)
 	vfree(pi->sechdrs);
 	pi->sechdrs = NULL;
 
+#ifdef CONFIG_IMA_KEXEC
+	vfree(image->ima_buffer);
+	image->ima_buffer = NULL;
+#endif /* CONFIG_IMA_KEXEC */
+
 	/* See if architecture has anything to cleanup post load */
 	arch_kimage_file_post_load_cleanup(image);
 
diff --git a/security/integrity/ima/ima_kexec.c b/security/integrity/ima/ima_kexec.c
index 9f8449dea5b69..6a10d4d8b6e1d 100644
--- a/security/integrity/ima/ima_kexec.c
+++ b/security/integrity/ima/ima_kexec.c
@@ -134,6 +134,8 @@ void ima_add_kexec_buffer(struct kimage *image)
 		return;
 	}
 
+	image->ima_buffer = kexec_buffer;
+
 	pr_debug("kexec measurement buffer for the loaded kernel at 0x%lx.\n",
 		 kbuf.mem);
 }
-- 
2.27.0




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

* [PATCH 4.19 105/247] fs/jfs: fix potential integer overflow on shift of a int
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (103 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 104/247] ima: Free IMA measurement buffer after kexec syscall Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 106/247] jffs2: fix use after free in jffs2_sum_write_data() Greg Kroah-Hartman
                   ` (144 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Colin Ian King, Dave Kleikamp, Sasha Levin

From: Colin Ian King <colin.king@canonical.com>

[ Upstream commit 4208c398aae4c2290864ba15c3dab7111f32bec1 ]

The left shift of int 32 bit integer constant 1 is evaluated using 32 bit
arithmetic and then assigned to a signed 64 bit integer. In the case where
l2nb is 32 or more this can lead to an overflow.  Avoid this by shifting
the value 1LL instead.

Addresses-Coverity: ("Uninitentional integer overflow")
Fixes: b40c2e665cd5 ("fs/jfs: TRIM support for JFS Filesystem")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/jfs/jfs_dmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 49263e220dbcf..687b07b9b4f62 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -1669,7 +1669,7 @@ s64 dbDiscardAG(struct inode *ip, int agno, s64 minlen)
 		} else if (rc == -ENOSPC) {
 			/* search for next smaller log2 block */
 			l2nb = BLKSTOL2(nblocks) - 1;
-			nblocks = 1 << l2nb;
+			nblocks = 1LL << l2nb;
 		} else {
 			/* Trim any already allocated blocks */
 			jfs_error(bmp->db_ipbmap->i_sb, "-EIO\n");
-- 
2.27.0




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

* [PATCH 4.19 106/247] jffs2: fix use after free in jffs2_sum_write_data()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (104 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 105/247] fs/jfs: fix potential integer overflow on shift of a int Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 107/247] capabilities: Dont allow writing ambiguous v3 file capabilities Greg Kroah-Hartman
                   ` (143 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Tom Rix, Nathan Chancellor,
	Richard Weinberger, Sasha Levin

From: Tom Rix <trix@redhat.com>

[ Upstream commit 19646447ad3a680d2ab08c097585b7d96a66126b ]

clang static analysis reports this problem

fs/jffs2/summary.c:794:31: warning: Use of memory after it is freed
                c->summary->sum_list_head = temp->u.next;
                                            ^~~~~~~~~~~~

In jffs2_sum_write_data(), in a loop summary data is handles a node at
a time.  When it has written out the node it is removed the summary list,
and the node is deleted.  In the corner case when a
JFFS2_FEATURE_RWCOMPAT_COPY is seen, a call is made to
jffs2_sum_disable_collecting().  jffs2_sum_disable_collecting() deletes
the whole list which conflicts with the loop's deleting the list by parts.

To preserve the old behavior of stopping the write midway, bail out of
the loop after disabling summary collection.

Fixes: 6171586a7ae5 ("[JFFS2] Correct handling of JFFS2_FEATURE_RWCOMPAT_COPY nodes.")
Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/jffs2/summary.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c
index be7c8a6a57480..4fe64519870f1 100644
--- a/fs/jffs2/summary.c
+++ b/fs/jffs2/summary.c
@@ -783,6 +783,8 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock
 					dbg_summary("Writing unknown RWCOMPAT_COPY node type %x\n",
 						    je16_to_cpu(temp->u.nodetype));
 					jffs2_sum_disable_collecting(c->summary);
+					/* The above call removes the list, nothing more to do */
+					goto bail_rwcompat;
 				} else {
 					BUG();	/* unknown node in summary information */
 				}
@@ -794,6 +796,7 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock
 
 		c->summary->sum_num--;
 	}
+ bail_rwcompat:
 
 	jffs2_sum_reset_collected(c->summary);
 
-- 
2.27.0




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

* [PATCH 4.19 107/247] capabilities: Dont allow writing ambiguous v3 file capabilities
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (105 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 106/247] jffs2: fix use after free in jffs2_sum_write_data() Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 108/247] clk: meson: clk-pll: fix initializing the old rate (fallback) for a PLL Greg Kroah-Hartman
                   ` (142 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andrew G. Morgan, Serge Hallyn,
	Eric W. Biederman, Sasha Levin

From: Eric W. Biederman <ebiederm@xmission.com>

[ Upstream commit 95ebabde382c371572297915b104e55403674e73 ]

The v3 file capabilities have a uid field that records the filesystem
uid of the root user of the user namespace the file capabilities are
valid in.

When someone is silly enough to have the same underlying uid as the
root uid of multiple nested containers a v3 filesystem capability can
be ambiguous.

In the spirit of don't do that then, forbid writing a v3 filesystem
capability if it is ambiguous.

Fixes: 8db6c34f1dbc ("Introduce v3 namespaced file capabilities")
Reviewed-by: Andrew G. Morgan <morgan@kernel.org>
Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 security/commoncap.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/security/commoncap.c b/security/commoncap.c
index a1dee0ab345a2..1bc40e78fa7ff 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -506,7 +506,8 @@ int cap_convert_nscap(struct dentry *dentry, void **ivalue, size_t size)
 	__u32 magic, nsmagic;
 	struct inode *inode = d_backing_inode(dentry);
 	struct user_namespace *task_ns = current_user_ns(),
-		*fs_ns = inode->i_sb->s_user_ns;
+		*fs_ns = inode->i_sb->s_user_ns,
+		*ancestor;
 	kuid_t rootid;
 	size_t newsize;
 
@@ -529,6 +530,15 @@ int cap_convert_nscap(struct dentry *dentry, void **ivalue, size_t size)
 	if (nsrootid == -1)
 		return -EINVAL;
 
+	/*
+	 * Do not allow allow adding a v3 filesystem capability xattr
+	 * if the rootid field is ambiguous.
+	 */
+	for (ancestor = task_ns->parent; ancestor; ancestor = ancestor->parent) {
+		if (from_kuid(ancestor, rootid) == 0)
+			return -EINVAL;
+	}
+
 	newsize = sizeof(struct vfs_ns_cap_data);
 	nscap = kmalloc(newsize, GFP_ATOMIC);
 	if (!nscap)
-- 
2.27.0




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

* [PATCH 4.19 108/247] clk: meson: clk-pll: fix initializing the old rate (fallback) for a PLL
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (106 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 107/247] capabilities: Dont allow writing ambiguous v3 file capabilities Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 109/247] quota: Fix memory leak when handling corrupted quota file Greg Kroah-Hartman
                   ` (141 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Martin Blumenstingl, Jerome Brunet,
	Sasha Levin

From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

[ Upstream commit 2f290b7c67adf6459a17a4c978102af35cd62e4a ]

The "rate" parameter in meson_clk_pll_set_rate() contains the new rate.
Retrieve the old rate with clk_hw_get_rate() so we don't inifinitely try
to switch from the new rate to the same rate again.

Fixes: 7a29a869434e8b ("clk: meson: Add support for Meson clock controller")
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20201226121556.975418-2-martin.blumenstingl@googlemail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/clk/meson/clk-pll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c
index 3e04617ac47f6..6fdad22a583d9 100644
--- a/drivers/clk/meson/clk-pll.c
+++ b/drivers/clk/meson/clk-pll.c
@@ -197,7 +197,7 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,
 	if (parent_rate == 0 || rate == 0)
 		return -EINVAL;
 
-	old_rate = rate;
+	old_rate = clk_hw_get_rate(hw);
 
 	pllt = meson_clk_get_pll_settings(rate, pll);
 	if (!pllt)
-- 
2.27.0




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

* [PATCH 4.19 109/247] quota: Fix memory leak when handling corrupted quota file
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (107 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 108/247] clk: meson: clk-pll: fix initializing the old rate (fallback) for a PLL Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 110/247] spi: cadence-quadspi: Abort read if dummy cycles required are too many Greg Kroah-Hartman
                   ` (140 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, syzbot+77779c9b52ab78154b08,
	Jan Kara, Sasha Levin

From: Jan Kara <jack@suse.cz>

[ Upstream commit a4db1072e1a3bd7a8d9c356e1902b13ac5deb8ef ]

When checking corrupted quota file we can bail out and leak allocated
info structure. Properly free info structure on error return.

Reported-by: syzbot+77779c9b52ab78154b08@syzkaller.appspotmail.com
Fixes: 11c514a99bb9 ("quota: Sanity-check quota file headers on load")
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/quota/quota_v2.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/fs/quota/quota_v2.c b/fs/quota/quota_v2.c
index d99710270a373..addfaae8decfd 100644
--- a/fs/quota/quota_v2.c
+++ b/fs/quota/quota_v2.c
@@ -165,19 +165,24 @@ static int v2_read_file_info(struct super_block *sb, int type)
 		quota_error(sb, "Number of blocks too big for quota file size (%llu > %llu).",
 		    (loff_t)qinfo->dqi_blocks << qinfo->dqi_blocksize_bits,
 		    i_size_read(sb_dqopt(sb)->files[type]));
-		goto out;
+		goto out_free;
 	}
 	if (qinfo->dqi_free_blk >= qinfo->dqi_blocks) {
 		quota_error(sb, "Free block number too big (%u >= %u).",
 			    qinfo->dqi_free_blk, qinfo->dqi_blocks);
-		goto out;
+		goto out_free;
 	}
 	if (qinfo->dqi_free_entry >= qinfo->dqi_blocks) {
 		quota_error(sb, "Block with free entry too big (%u >= %u).",
 			    qinfo->dqi_free_entry, qinfo->dqi_blocks);
-		goto out;
+		goto out_free;
 	}
 	ret = 0;
+out_free:
+	if (ret) {
+		kfree(info->dqi_priv);
+		info->dqi_priv = NULL;
+	}
 out:
 	up_read(&dqopt->dqio_sem);
 	return ret;
-- 
2.27.0




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

* [PATCH 4.19 110/247] spi: cadence-quadspi: Abort read if dummy cycles required are too many
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (108 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 109/247] quota: Fix memory leak when handling corrupted quota file Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 111/247] clk: sunxi-ng: h6: Fix CEC clock Greg Kroah-Hartman
                   ` (139 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pratyush Yadav, Mark Brown, Sasha Levin

From: Pratyush Yadav <p.yadav@ti.com>

[ Upstream commit ceeda328edeeeeac7579e9dbf0610785a3b83d39 ]

The controller can only support up to 31 dummy cycles. If the command
requires more it falls back to using 31. This command is likely to fail
because the correct number of cycles are not waited upon. Rather than
silently issuing an incorrect command, fail loudly so the caller can get
a chance to find out the command can't be supported by the controller.

Fixes: 140623410536 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller")
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Link: https://lore.kernel.org/r/20201222184425.7028-3-p.yadav@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/mtd/spi-nor/cadence-quadspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
index 04cedd3a2bf66..a92f531ad23a3 100644
--- a/drivers/mtd/spi-nor/cadence-quadspi.c
+++ b/drivers/mtd/spi-nor/cadence-quadspi.c
@@ -473,7 +473,7 @@ static int cqspi_read_setup(struct spi_nor *nor)
 	/* Setup dummy clock cycles */
 	dummy_clk = nor->read_dummy;
 	if (dummy_clk > CQSPI_DUMMY_CLKS_MAX)
-		dummy_clk = CQSPI_DUMMY_CLKS_MAX;
+		return -EOPNOTSUPP;
 
 	if (dummy_clk / 8) {
 		reg |= (1 << CQSPI_REG_RD_INSTR_MODE_EN_LSB);
-- 
2.27.0




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

* [PATCH 4.19 111/247] clk: sunxi-ng: h6: Fix CEC clock
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (109 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 110/247] spi: cadence-quadspi: Abort read if dummy cycles required are too many Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 112/247] HID: core: detect and skip invalid inputs to snto32() Greg Kroah-Hartman
                   ` (138 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jernej Skrabec, Andre Przywara,
	Chen-Yu Tsai, Maxime Ripard, Sasha Levin

From: Andre Przywara <andre.przywara@arm.com>

[ Upstream commit 756650820abd4770c4200763505b634a3c04e05e ]

The CEC clock on the H6 SoC is a bit special, since it uses a fixed
pre-dividier for one source clock (the PLL), but conveys the other clock
(32K OSC) directly.
We are using a fixed predivider array for that, but fail to use the right
flag to actually activate that.

Fixes: 524353ea480b ("clk: sunxi-ng: add support for the Allwinner H6 CCU")
Reported-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20210106143246.11255-1-andre.przywara@arm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/clk/sunxi-ng/ccu-sun50i-h6.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
index d425b47cef179..3449dcf1908ef 100644
--- a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
+++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
@@ -662,7 +662,7 @@ static struct ccu_mux hdmi_cec_clk = {
 
 	.common		= {
 		.reg		= 0xb10,
-		.features	= CCU_FEATURE_VARIABLE_PREDIV,
+		.features	= CCU_FEATURE_FIXED_PREDIV,
 		.hw.init	= CLK_HW_INIT_PARENTS("hdmi-cec",
 						      hdmi_cec_parents,
 						      &ccu_mux_ops,
-- 
2.27.0




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

* [PATCH 4.19 112/247] HID: core: detect and skip invalid inputs to snto32()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (110 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 111/247] clk: sunxi-ng: h6: Fix CEC clock Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 113/247] dmaengine: fsldma: Fix a resource leak in the remove function Greg Kroah-Hartman
                   ` (137 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Randy Dunlap,
	syzbot+1e911ad71dd4ea72e04a, Jiri Kosina, Benjamin Tissoires,
	linux-input, Jiri Kosina, Sasha Levin

From: Randy Dunlap <rdunlap@infradead.org>

[ Upstream commit a0312af1f94d13800e63a7d0a66e563582e39aec ]

Prevent invalid (0, 0) inputs to hid-core's snto32() function.

Maybe it is just the dummy device here that is causing this, but
there are hundreds of calls to snto32(0, 0). Having n (bits count)
of 0 is causing the current UBSAN trap with a shift value of
0xffffffff (-1, or n - 1 in this function).

Either of the value to shift being 0 or the bits count being 0 can be
handled by just returning 0 to the caller, avoiding the following
complex shift + OR operations:

	return value & (1 << (n - 1)) ? value | (~0U << n) : value;

Fixes: dde5845a529f ("[PATCH] Generic HID layer - code split")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: syzbot+1e911ad71dd4ea72e04a@syzkaller.appspotmail.com
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/hid/hid-core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index bde5cef3290f5..9b66eb1d42c2d 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1128,6 +1128,9 @@ EXPORT_SYMBOL_GPL(hid_open_report);
 
 static s32 snto32(__u32 value, unsigned n)
 {
+	if (!value || !n)
+		return 0;
+
 	switch (n) {
 	case 8:  return ((__s8)value);
 	case 16: return ((__s16)value);
-- 
2.27.0




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

* [PATCH 4.19 113/247] dmaengine: fsldma: Fix a resource leak in the remove function
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (111 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 112/247] HID: core: detect and skip invalid inputs to snto32() Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 114/247] dmaengine: fsldma: Fix a resource leak in an error handling path of the probe function Greg Kroah-Hartman
                   ` (136 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christophe JAILLET, Vinod Koul, Sasha Levin

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

[ Upstream commit cbc0ad004c03ad7971726a5db3ec84dba3dcb857 ]

A 'irq_dispose_mapping()' call is missing in the remove function.
Add it.

This is needed to undo the 'irq_of_parse_and_map() call from the probe
function and already part of the error handling path of the probe function.

It was added in the probe function only in commit d3f620b2c4fe ("fsldma:
simplify IRQ probing and handling")

Fixes: 77cd62e8082b ("fsldma: allow Freescale Elo DMA driver to be compiled as a module")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/20201212160516.92515-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/dma/fsldma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index 1117b5123a6fc..e3412be957122 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -1318,6 +1318,7 @@ static int fsldma_of_remove(struct platform_device *op)
 		if (fdev->chan[i])
 			fsl_dma_chan_remove(fdev->chan[i]);
 	}
+	irq_dispose_mapping(fdev->irq);
 
 	iounmap(fdev->regs);
 	kfree(fdev);
-- 
2.27.0




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

* [PATCH 4.19 114/247] dmaengine: fsldma: Fix a resource leak in an error handling path of the probe function
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (112 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 113/247] dmaengine: fsldma: Fix a resource leak in the remove function Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 115/247] dmaengine: owl-dma: Fix a resource leak in the remove function Greg Kroah-Hartman
                   ` (135 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christophe JAILLET, Vinod Koul, Sasha Levin

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

[ Upstream commit b202d4e82531a62a33a6b14d321dd2aad491578e ]

In case of error, the previous 'fsl_dma_chan_probe()' calls must be undone
by some 'fsl_dma_chan_remove()', as already done in the remove function.

It was added in the remove function in commit 77cd62e8082b ("fsldma: allow
Freescale Elo DMA driver to be compiled as a module")

Fixes: d3f620b2c4fe ("fsldma: simplify IRQ probing and handling")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/20201212160614.92576-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/dma/fsldma.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index e3412be957122..e7ca3175dbc30 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -1218,6 +1218,7 @@ static int fsldma_of_probe(struct platform_device *op)
 {
 	struct fsldma_device *fdev;
 	struct device_node *child;
+	unsigned int i;
 	int err;
 
 	fdev = kzalloc(sizeof(*fdev), GFP_KERNEL);
@@ -1296,6 +1297,10 @@ static int fsldma_of_probe(struct platform_device *op)
 	return 0;
 
 out_free_fdev:
+	for (i = 0; i < FSL_DMA_MAX_CHANS_PER_DEVICE; i++) {
+		if (fdev->chan[i])
+			fsl_dma_chan_remove(fdev->chan[i]);
+	}
 	irq_dispose_mapping(fdev->irq);
 	iounmap(fdev->regs);
 out_free:
-- 
2.27.0




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

* [PATCH 4.19 115/247] dmaengine: owl-dma: Fix a resource leak in the remove function
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (113 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 114/247] dmaengine: fsldma: Fix a resource leak in an error handling path of the probe function Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 116/247] dmaengine: hsu: disable spurious interrupt Greg Kroah-Hartman
                   ` (134 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christophe JAILLET, Vinod Koul, Sasha Levin

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

[ Upstream commit 1f0a16f04113f9f0ab0c8e6d3abe661edab549e6 ]

A 'dma_pool_destroy()' call is missing in the remove function.
Add it.

This call is already made in the error handling path of the probe function.

Fixes: 47e20577c24d ("dmaengine: Add Actions Semi Owl family S900 DMA driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/20201212162535.95727-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/dma/owl-dma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/owl-dma.c b/drivers/dma/owl-dma.c
index 7ff04bf04b31b..da5050ab7f387 100644
--- a/drivers/dma/owl-dma.c
+++ b/drivers/dma/owl-dma.c
@@ -932,6 +932,7 @@ static int owl_dma_remove(struct platform_device *pdev)
 	owl_dma_free(od);
 
 	clk_disable_unprepare(od->clk);
+	dma_pool_destroy(od->lli_pool);
 
 	return 0;
 }
-- 
2.27.0




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

* [PATCH 4.19 116/247] dmaengine: hsu: disable spurious interrupt
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (114 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 115/247] dmaengine: owl-dma: Fix a resource leak in the remove function Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 117/247] mfd: bd9571mwv: Use devm_mfd_add_devices() Greg Kroah-Hartman
                   ` (133 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ferry Toth, Andy Shevchenko,
	Vinod Koul, Sasha Levin

From: Ferry Toth <ftoth@exalondelft.nl>

[ Upstream commit 035b73b2b3b2e074a56489a7bf84b6a8012c0e0d ]

On Intel Tangier B0 and Anniedale the interrupt line, disregarding
to have different numbers, is shared between HSU DMA and UART IPs.
Thus on such SoCs we are expecting that IRQ handler is called in
UART driver only. hsu_pci_irq was handling the spurious interrupt
from HSU DMA by returning immediately. This wastes CPU time and
since HSU DMA and HSU UART interrupt occur simultaneously they race
to be handled causing delay to the HSU UART interrupt handling.
Fix this by disabling the interrupt entirely.

Fixes: 4831e0d9054c ("serial: 8250_mid: handle interrupt correctly in DMA case")
Signed-off-by: Ferry Toth <ftoth@exalondelft.nl>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210112223749.97036-1-ftoth@exalondelft.nl
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/dma/hsu/pci.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/dma/hsu/pci.c b/drivers/dma/hsu/pci.c
index ad45cd344bbae..78836526d2e07 100644
--- a/drivers/dma/hsu/pci.c
+++ b/drivers/dma/hsu/pci.c
@@ -29,22 +29,12 @@
 static irqreturn_t hsu_pci_irq(int irq, void *dev)
 {
 	struct hsu_dma_chip *chip = dev;
-	struct pci_dev *pdev = to_pci_dev(chip->dev);
 	u32 dmaisr;
 	u32 status;
 	unsigned short i;
 	int ret = 0;
 	int err;
 
-	/*
-	 * On Intel Tangier B0 and Anniedale the interrupt line, disregarding
-	 * to have different numbers, is shared between HSU DMA and UART IPs.
-	 * Thus on such SoCs we are expecting that IRQ handler is called in
-	 * UART driver only.
-	 */
-	if (pdev->device == PCI_DEVICE_ID_INTEL_MRFLD_HSU_DMA)
-		return IRQ_HANDLED;
-
 	dmaisr = readl(chip->regs + HSU_PCI_DMAISR);
 	for (i = 0; i < chip->hsu->nr_channels; i++) {
 		if (dmaisr & 0x1) {
@@ -108,6 +98,17 @@ static int hsu_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	if (ret)
 		goto err_register_irq;
 
+	/*
+	 * On Intel Tangier B0 and Anniedale the interrupt line, disregarding
+	 * to have different numbers, is shared between HSU DMA and UART IPs.
+	 * Thus on such SoCs we are expecting that IRQ handler is called in
+	 * UART driver only. Instead of handling the spurious interrupt
+	 * from HSU DMA here and waste CPU time and delay HSU UART interrupt
+	 * handling, disable the interrupt entirely.
+	 */
+	if (pdev->device == PCI_DEVICE_ID_INTEL_MRFLD_HSU_DMA)
+		disable_irq_nosync(chip->irq);
+
 	pci_set_drvdata(pdev, chip);
 
 	return 0;
-- 
2.27.0




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

* [PATCH 4.19 117/247] mfd: bd9571mwv: Use devm_mfd_add_devices()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (115 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 116/247] dmaengine: hsu: disable spurious interrupt Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 118/247] fdt: Properly handle "no-map" field in the memory region Greg Kroah-Hartman
                   ` (132 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yoshihiro Shimoda,
	Geert Uytterhoeven, Matti Vaittinen, Lee Jones, Sasha Levin

From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

[ Upstream commit c58ad0f2b052b5675d6394e03713ee41e721b44c ]

To remove mfd devices when unload this driver, should use
devm_mfd_add_devices() instead.

Fixes: d3ea21272094 ("mfd: Add ROHM BD9571MWV-M MFD PMIC driver")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/mfd/bd9571mwv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/bd9571mwv.c b/drivers/mfd/bd9571mwv.c
index fab3cdc27ed64..19d57a45134c6 100644
--- a/drivers/mfd/bd9571mwv.c
+++ b/drivers/mfd/bd9571mwv.c
@@ -185,9 +185,9 @@ static int bd9571mwv_probe(struct i2c_client *client,
 		return ret;
 	}
 
-	ret = mfd_add_devices(bd->dev, PLATFORM_DEVID_AUTO, bd9571mwv_cells,
-			      ARRAY_SIZE(bd9571mwv_cells), NULL, 0,
-			      regmap_irq_get_domain(bd->irq_data));
+	ret = devm_mfd_add_devices(bd->dev, PLATFORM_DEVID_AUTO,
+				   bd9571mwv_cells, ARRAY_SIZE(bd9571mwv_cells),
+				   NULL, 0, regmap_irq_get_domain(bd->irq_data));
 	if (ret) {
 		regmap_del_irq_chip(bd->irq, bd->irq_data);
 		return ret;
-- 
2.27.0




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

* [PATCH 4.19 118/247] fdt: Properly handle "no-map" field in the memory region
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (116 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 117/247] mfd: bd9571mwv: Use devm_mfd_add_devices() Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 119/247] of/fdt: Make sure no-map does not remove already reserved regions Greg Kroah-Hartman
                   ` (131 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Rob Herring, Frank Rowand,
	devicetree, KarimAllah Ahmed, Quentin Perret, Rob Herring,
	Sasha Levin

From: KarimAllah Ahmed <karahmed@amazon.de>

[ Upstream commit 86588296acbfb1591e92ba60221e95677ecadb43 ]

Mark the memory region with NOMAP flag instead of completely removing it
from the memory blocks. That makes the FDT handling consistent with the EFI
memory map handling.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: KarimAllah Ahmed <karahmed@amazon.de>
Signed-off-by: Quentin Perret <qperret@google.com>
Link: https://lore.kernel.org/r/20210115114544.1830068-2-qperret@google.com
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/of/fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 800ad252cf9c6..aa15e5d183c18 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1173,7 +1173,7 @@ int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base,
 					phys_addr_t size, bool nomap)
 {
 	if (nomap)
-		return memblock_remove(base, size);
+		return memblock_mark_nomap(base, size);
 	return memblock_reserve(base, size);
 }
 
-- 
2.27.0




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

* [PATCH 4.19 119/247] of/fdt: Make sure no-map does not remove already reserved regions
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (117 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 118/247] fdt: Properly handle "no-map" field in the memory region Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 120/247] power: reset: at91-sama5d2_shdwc: fix wkupdbc mask Greg Kroah-Hartman
                   ` (130 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Nicolas Boichat, Stephen Boyd,
	Quentin Perret, Rob Herring, Sasha Levin

From: Nicolas Boichat <drinkcat@chromium.org>

[ Upstream commit 8a5a75e5e9e55de1cef5d83ca3589cb4899193ef ]

If the device tree is incorrectly configured, and attempts to
define a "no-map" reserved memory that overlaps with the kernel
data/code, the kernel would crash quickly after boot, with no
obvious clue about the nature of the issue.

For example, this would happen if we have the kernel mapped at
these addresses (from /proc/iomem):
40000000-41ffffff : System RAM
  40080000-40dfffff : Kernel code
  40e00000-411fffff : reserved
  41200000-413e0fff : Kernel data

And we declare a no-map shared-dma-pool region at a fixed address
within that range:
mem_reserved: mem_region {
	compatible = "shared-dma-pool";
	reg = <0 0x40000000 0 0x01A00000>;
	no-map;
};

To fix this, when removing memory regions at early boot (which is
what "no-map" regions do), we need to make sure that the memory
is not already reserved. If we do, __reserved_mem_reserve_reg
will throw an error:
[    0.000000] OF: fdt: Reserved memory: failed to reserve memory
   for node 'mem_region': base 0x0000000040000000, size 26 MiB
and the code that will try to use the region should also fail,
later on.

We do not do anything for non-"no-map" regions, as memblock
explicitly allows reserved regions to overlap, and the commit
that this fixes removed the check for that precise reason.

[ qperret: fixed conflicts caused by the usage of memblock_mark_nomap ]

Fixes: 094cb98179f19b7 ("of/fdt: memblock_reserve /memreserve/ regions in the case of partial overlap")
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Quentin Perret <qperret@google.com>
Link: https://lore.kernel.org/r/20210115114544.1830068-3-qperret@google.com
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/of/fdt.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index aa15e5d183c18..21160a08ead4b 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1172,8 +1172,16 @@ int __init __weak early_init_dt_mark_hotplug_memory_arch(u64 base, u64 size)
 int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base,
 					phys_addr_t size, bool nomap)
 {
-	if (nomap)
+	if (nomap) {
+		/*
+		 * If the memory is already reserved (by another region), we
+		 * should not allow it to be marked nomap.
+		 */
+		if (memblock_is_region_reserved(base, size))
+			return -EBUSY;
+
 		return memblock_mark_nomap(base, size);
+	}
 	return memblock_reserve(base, size);
 }
 
-- 
2.27.0




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

* [PATCH 4.19 120/247] power: reset: at91-sama5d2_shdwc: fix wkupdbc mask
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (118 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 119/247] of/fdt: Make sure no-map does not remove already reserved regions Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 121/247] rtc: s5m: select REGMAP_I2C Greg Kroah-Hartman
                   ` (129 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Claudiu Beznea, Alexandre Belloni,
	Sebastian Reichel, Sasha Levin

From: Claudiu Beznea <claudiu.beznea@microchip.com>

[ Upstream commit 95aa21a3f1183260db1b0395e03df5bebc5ed641 ]

According to datasheet WKUPDBC mask is b/w bits 26..24.

Fixes: f80cb48843987 ("power: reset: at91-shdwc: add new shutdown controller driver")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/power/reset/at91-sama5d2_shdwc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/reset/at91-sama5d2_shdwc.c b/drivers/power/reset/at91-sama5d2_shdwc.c
index d9493e893d64e..7cf59e764ef28 100644
--- a/drivers/power/reset/at91-sama5d2_shdwc.c
+++ b/drivers/power/reset/at91-sama5d2_shdwc.c
@@ -36,7 +36,7 @@
 
 #define AT91_SHDW_MR	0x04		/* Shut Down Mode Register */
 #define AT91_SHDW_WKUPDBC_SHIFT	24
-#define AT91_SHDW_WKUPDBC_MASK	GENMASK(31, 16)
+#define AT91_SHDW_WKUPDBC_MASK	GENMASK(26, 24)
 #define AT91_SHDW_WKUPDBC(x)	(((x) << AT91_SHDW_WKUPDBC_SHIFT) \
 						& AT91_SHDW_WKUPDBC_MASK)
 
-- 
2.27.0




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

* [PATCH 4.19 121/247] rtc: s5m: select REGMAP_I2C
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (119 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 120/247] power: reset: at91-sama5d2_shdwc: fix wkupdbc mask Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 122/247] clocksource/drivers/mxs_timer: Add missing semicolon when DEBUG is defined Greg Kroah-Hartman
                   ` (128 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Bartosz Golaszewski,
	Krzysztof Kozlowski, Alexandre Belloni, Sasha Levin

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

[ Upstream commit 1f0cbda3b452b520c5f3794f8f0e410e8bc7386a ]

The rtc-s5m uses the I2C regmap but doesn't select it in Kconfig so
depending on the configuration the build may fail. Fix it.

Fixes: 959df7778bbd ("rtc: Enable compile testing for Maxim and Samsung drivers")
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20210114102219.23682-2-brgl@bgdev.pl
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/rtc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 28a4505a1bc82..b5845f16a3a26 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -639,6 +639,7 @@ config RTC_DRV_S5M
 	tristate "Samsung S2M/S5M series"
 	depends on MFD_SEC_CORE || COMPILE_TEST
 	select REGMAP_IRQ
+	select REGMAP_I2C
 	help
 	  If you say yes here you will get support for the
 	  RTC of Samsung S2MPS14 and S5M PMIC series.
-- 
2.27.0




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

* [PATCH 4.19 122/247] clocksource/drivers/mxs_timer: Add missing semicolon when DEBUG is defined
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (120 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 121/247] rtc: s5m: select REGMAP_I2C Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 123/247] RDMA/mlx5: Use the correct obj_id upon DEVX TIR creation Greg Kroah-Hartman
                   ` (127 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Tom Rix, Daniel Lezcano, Sasha Levin

From: Tom Rix <trix@redhat.com>

[ Upstream commit 7da390694afbaed8e0f05717a541dfaf1077ba51 ]

When DEBUG is defined this error occurs

drivers/clocksource/mxs_timer.c:138:1: error:
  expected ‘;’ before ‘}’ token

The preceding statement needs a semicolon.
Replace pr_info() with pr_debug() and remove the unneeded ifdef.

Fixes: eb8703e2ef7c ("clockevents/drivers/mxs: Migrate to new 'set-state' interface")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210118211955.763609-1-trix@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/clocksource/mxs_timer.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/clocksource/mxs_timer.c b/drivers/clocksource/mxs_timer.c
index f6ddae30933f7..dae8c0c2e606f 100644
--- a/drivers/clocksource/mxs_timer.c
+++ b/drivers/clocksource/mxs_timer.c
@@ -138,10 +138,7 @@ static void mxs_irq_clear(char *state)
 
 	/* Clear pending interrupt */
 	timrot_irq_acknowledge();
-
-#ifdef DEBUG
-	pr_info("%s: changing mode to %s\n", __func__, state)
-#endif /* DEBUG */
+	pr_debug("%s: changing mode to %s\n", __func__, state);
 }
 
 static int mxs_shutdown(struct clock_event_device *evt)
-- 
2.27.0




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

* [PATCH 4.19 123/247] RDMA/mlx5: Use the correct obj_id upon DEVX TIR creation
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (121 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 122/247] clocksource/drivers/mxs_timer: Add missing semicolon when DEBUG is defined Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 124/247] clk: sunxi-ng: h6: Fix clock divider range on some clocks Greg Kroah-Hartman
                   ` (126 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yishai Hadas, Leon Romanovsky,
	Jason Gunthorpe, Sasha Levin

From: Yishai Hadas <yishaih@nvidia.com>

[ Upstream commit 8798e4ad0abe0ba1221928a46561981c510be0c6 ]

Use the correct obj_id upon DEVX TIR creation by strictly taking the tirn
24 bits and not the general obj_id which is 32 bits.

Fixes: 7efce3691d33 ("IB/mlx5: Add obj create and destroy functionality")
Link: https://lore.kernel.org/r/20201230130121.180350-2-leon@kernel.org
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/infiniband/hw/mlx5/devx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c
index 4c90a007e09db..c89aec834972e 100644
--- a/drivers/infiniband/hw/mlx5/devx.c
+++ b/drivers/infiniband/hw/mlx5/devx.c
@@ -572,7 +572,9 @@ static void devx_obj_build_destroy_cmd(void *in, void *out, void *din,
 		MLX5_SET(general_obj_in_cmd_hdr, din, opcode, MLX5_CMD_OP_DESTROY_RQT);
 		break;
 	case MLX5_CMD_OP_CREATE_TIR:
-		MLX5_SET(general_obj_in_cmd_hdr, din, opcode, MLX5_CMD_OP_DESTROY_TIR);
+		*obj_id = MLX5_GET(create_tir_out, out, tirn);
+		MLX5_SET(destroy_tir_in, din, opcode, MLX5_CMD_OP_DESTROY_TIR);
+		MLX5_SET(destroy_tir_in, din, tirn, *obj_id);
 		break;
 	case MLX5_CMD_OP_CREATE_TIS:
 		MLX5_SET(general_obj_in_cmd_hdr, din, opcode, MLX5_CMD_OP_DESTROY_TIS);
-- 
2.27.0




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

* [PATCH 4.19 124/247] clk: sunxi-ng: h6: Fix clock divider range on some clocks
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (122 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 123/247] RDMA/mlx5: Use the correct obj_id upon DEVX TIR creation Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 125/247] regulator: axp20x: Fix reference cout leak Greg Kroah-Hartman
                   ` (125 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andre Przywara, Jernej Skrabec,
	Maxime Ripard, Sasha Levin

From: Andre Przywara <andre.przywara@arm.com>

[ Upstream commit 04ef679591c76571a9e7d5ca48316cc86fa0ef12 ]

While comparing clocks between the H6 and H616, some of the M factor
ranges were found to be wrong: the manual says they are only covering
two bits [1:0], but our code had "5" in the number-of-bits field.

By writing 0xff into that register in U-Boot and via FEL, it could be
confirmed that bits [4:2] are indeed masked off, so the manual is right.

Change to number of bits in the affected clock's description.

Fixes: 524353ea480b ("clk: sunxi-ng: add support for the Allwinner H6 CCU")
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20210118000912.28116-1-andre.przywara@arm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/clk/sunxi-ng/ccu-sun50i-h6.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
index 3449dcf1908ef..1197ace591247 100644
--- a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
+++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
@@ -223,7 +223,7 @@ static const char * const psi_ahb1_ahb2_parents[] = { "osc24M", "osc32k",
 static SUNXI_CCU_MP_WITH_MUX(psi_ahb1_ahb2_clk, "psi-ahb1-ahb2",
 			     psi_ahb1_ahb2_parents,
 			     0x510,
-			     0, 5,	/* M */
+			     0, 2,	/* M */
 			     8, 2,	/* P */
 			     24, 2,	/* mux */
 			     0);
@@ -232,19 +232,19 @@ static const char * const ahb3_apb1_apb2_parents[] = { "osc24M", "osc32k",
 						       "psi-ahb1-ahb2",
 						       "pll-periph0" };
 static SUNXI_CCU_MP_WITH_MUX(ahb3_clk, "ahb3", ahb3_apb1_apb2_parents, 0x51c,
-			     0, 5,	/* M */
+			     0, 2,	/* M */
 			     8, 2,	/* P */
 			     24, 2,	/* mux */
 			     0);
 
 static SUNXI_CCU_MP_WITH_MUX(apb1_clk, "apb1", ahb3_apb1_apb2_parents, 0x520,
-			     0, 5,	/* M */
+			     0, 2,	/* M */
 			     8, 2,	/* P */
 			     24, 2,	/* mux */
 			     0);
 
 static SUNXI_CCU_MP_WITH_MUX(apb2_clk, "apb2", ahb3_apb1_apb2_parents, 0x524,
-			     0, 5,	/* M */
+			     0, 2,	/* M */
 			     8, 2,	/* P */
 			     24, 2,	/* mux */
 			     0);
-- 
2.27.0




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

* [PATCH 4.19 125/247] regulator: axp20x: Fix reference cout leak
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (123 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 124/247] clk: sunxi-ng: h6: Fix clock divider range on some clocks Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 126/247] certs: Fix blacklist flag type confusion Greg Kroah-Hartman
                   ` (124 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pan Bian, Mark Brown, Sasha Levin

From: Pan Bian <bianpan2016@163.com>

[ Upstream commit e78bf6be7edaacb39778f3a89416caddfc6c6d70 ]

Decrements the reference count of device node and its child node.

Fixes: dfe7a1b058bb ("regulator: AXP20x: Add support for regulators subsystem")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Link: https://lore.kernel.org/r/20210120123313.107640-1-bianpan2016@163.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/regulator/axp20x-regulator.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index 91b8ff8bac157..c9e3677ac734b 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -558,7 +558,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
 static int axp20x_regulator_parse_dt(struct platform_device *pdev)
 {
 	struct device_node *np, *regulators;
-	int ret;
+	int ret = 0;
 	u32 dcdcfreq = 0;
 
 	np = of_node_get(pdev->dev.parent->of_node);
@@ -573,13 +573,12 @@ static int axp20x_regulator_parse_dt(struct platform_device *pdev)
 		ret = axp20x_set_dcdc_freq(pdev, dcdcfreq);
 		if (ret < 0) {
 			dev_err(&pdev->dev, "Error setting dcdc frequency: %d\n", ret);
-			return ret;
 		}
-
 		of_node_put(regulators);
 	}
 
-	return 0;
+	of_node_put(np);
+	return ret;
 }
 
 static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 workmode)
-- 
2.27.0




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

* [PATCH 4.19 126/247] certs: Fix blacklist flag type confusion
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (124 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 125/247] regulator: axp20x: Fix reference cout leak Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 127/247] spi: atmel: Put allocated master before return Greg Kroah-Hartman
                   ` (123 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mickaël Salaün,
	David Howells, Mimi Zohar, David Woodhouse, Sasha Levin

From: David Howells <dhowells@redhat.com>

[ Upstream commit 4993e1f9479a4161fd7d93e2b8b30b438f00cb0f ]

KEY_FLAG_KEEP is not meant to be passed to keyring_alloc() or key_alloc(),
as these only take KEY_ALLOC_* flags.  KEY_FLAG_KEEP has the same value as
KEY_ALLOC_BYPASS_RESTRICTION, but fortunately only key_create_or_update()
uses it.  LSMs using the key_alloc hook don't check that flag.

KEY_FLAG_KEEP is then ignored but fortunately (again) the root user cannot
write to the blacklist keyring, so it is not possible to remove a key/hash
from it.

Fix this by adding a KEY_ALLOC_SET_KEEP flag that tells key_alloc() to set
KEY_FLAG_KEEP on the new key.  blacklist_init() can then, correctly, pass
this to keyring_alloc().

We can also use this in ima_mok_init() rather than setting the flag
manually.

Note that this doesn't fix an observable bug with the current
implementation but it is required to allow addition of new hashes to the
blacklist in the future without making it possible for them to be removed.

Fixes: 734114f8782f ("KEYS: Add a system blacklist keyring")
Reported-by: Mickaël Salaün <mic@linux.microsoft.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Mickaël Salaün <mic@linux.microsoft.com>
cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 certs/blacklist.c                | 2 +-
 include/linux/key.h              | 1 +
 security/integrity/ima/ima_mok.c | 5 ++---
 security/keys/key.c              | 2 ++
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/certs/blacklist.c b/certs/blacklist.c
index 3a507b9e2568a..e9f3f81c51f96 100644
--- a/certs/blacklist.c
+++ b/certs/blacklist.c
@@ -157,7 +157,7 @@ static int __init blacklist_init(void)
 			      KEY_USR_VIEW | KEY_USR_READ |
 			      KEY_USR_SEARCH,
 			      KEY_ALLOC_NOT_IN_QUOTA |
-			      KEY_FLAG_KEEP,
+			      KEY_ALLOC_SET_KEEP,
 			      NULL, NULL);
 	if (IS_ERR(blacklist_keyring))
 		panic("Can't allocate system blacklist keyring\n");
diff --git a/include/linux/key.h b/include/linux/key.h
index e58ee10f6e585..3683c6a6fca30 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -249,6 +249,7 @@ extern struct key *key_alloc(struct key_type *type,
 #define KEY_ALLOC_BUILT_IN		0x0004	/* Key is built into kernel */
 #define KEY_ALLOC_BYPASS_RESTRICTION	0x0008	/* Override the check on restricted keyrings */
 #define KEY_ALLOC_UID_KEYRING		0x0010	/* allocating a user or user session keyring */
+#define KEY_ALLOC_SET_KEEP		0x0020	/* Set the KEEP flag on the key/keyring */
 
 extern void key_revoke(struct key *key);
 extern void key_invalidate(struct key *key);
diff --git a/security/integrity/ima/ima_mok.c b/security/integrity/ima/ima_mok.c
index 073ddc9bce5ba..3e7a1523663b8 100644
--- a/security/integrity/ima/ima_mok.c
+++ b/security/integrity/ima/ima_mok.c
@@ -43,13 +43,12 @@ __init int ima_mok_init(void)
 				(KEY_POS_ALL & ~KEY_POS_SETATTR) |
 				KEY_USR_VIEW | KEY_USR_READ |
 				KEY_USR_WRITE | KEY_USR_SEARCH,
-				KEY_ALLOC_NOT_IN_QUOTA,
+				KEY_ALLOC_NOT_IN_QUOTA |
+				KEY_ALLOC_SET_KEEP,
 				restriction, NULL);
 
 	if (IS_ERR(ima_blacklist_keyring))
 		panic("Can't allocate IMA blacklist keyring.");
-
-	set_bit(KEY_FLAG_KEEP, &ima_blacklist_keyring->flags);
 	return 0;
 }
 device_initcall(ima_mok_init);
diff --git a/security/keys/key.c b/security/keys/key.c
index d5fa8c4fc5544..d3ebc0533e3ad 100644
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -305,6 +305,8 @@ struct key *key_alloc(struct key_type *type, const char *desc,
 		key->flags |= 1 << KEY_FLAG_BUILTIN;
 	if (flags & KEY_ALLOC_UID_KEYRING)
 		key->flags |= 1 << KEY_FLAG_UID_KEYRING;
+	if (flags & KEY_ALLOC_SET_KEEP)
+		key->flags |= 1 << KEY_FLAG_KEEP;
 
 #ifdef KEY_DEBUGGING
 	key->magic = KEY_DEBUG_MAGIC;
-- 
2.27.0




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

* [PATCH 4.19 127/247] spi: atmel: Put allocated master before return
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (125 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 126/247] certs: Fix blacklist flag type confusion Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 128/247] regulator: s5m8767: Drop regulators OF node reference Greg Kroah-Hartman
                   ` (122 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pan Bian, Tudor Ambarus, Mark Brown,
	Sasha Levin

From: Pan Bian <bianpan2016@163.com>

[ Upstream commit 21ea2743f015dbacec1831bdc8afc848db9c2b8c ]

The allocated master is not released. Goto error handling label rather
than directly return.

Fixes: 5e9af37e46bc ("spi: atmel: introduce probe deferring")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Fixes: 5e9af37e46bc ("spi: atmel: introduce probe deferring")
Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Link: https://lore.kernel.org/r/20210120050025.25426-1-bianpan2016@163.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/spi/spi-atmel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 5a9d7e252a77c..2254e36c7f468 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1605,7 +1605,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
 		if (ret == 0) {
 			as->use_dma = true;
 		} else if (ret == -EPROBE_DEFER) {
-			return ret;
+			goto out_unmap_regs;
 		}
 	} else if (as->caps.has_pdc_support) {
 		as->use_pdc = true;
-- 
2.27.0




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

* [PATCH 4.19 128/247] regulator: s5m8767: Drop regulators OF node reference
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (126 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 127/247] spi: atmel: Put allocated master before return Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 129/247] isofs: release buffer head before return Greg Kroah-Hartman
                   ` (121 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Krzysztof Kozlowski, Mark Brown, Sasha Levin

From: Krzysztof Kozlowski <krzk@kernel.org>

[ Upstream commit a5872bd3398d0ff2ce4c77794bc7837899c69024 ]

The device node reference obtained with of_get_child_by_name() should be
dropped on error paths.

Fixes: 26aec009f6b6 ("regulator: add device tree support for s5m8767")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20210121155914.48034-1-krzk@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/regulator/s5m8767.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index 667d16dc83ce1..7ff94695eee72 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -548,14 +548,18 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
 	rdata = devm_kcalloc(&pdev->dev,
 			     pdata->num_regulators, sizeof(*rdata),
 			     GFP_KERNEL);
-	if (!rdata)
+	if (!rdata) {
+		of_node_put(regulators_np);
 		return -ENOMEM;
+	}
 
 	rmode = devm_kcalloc(&pdev->dev,
 			     pdata->num_regulators, sizeof(*rmode),
 			     GFP_KERNEL);
-	if (!rmode)
+	if (!rmode) {
+		of_node_put(regulators_np);
 		return -ENOMEM;
+	}
 
 	pdata->regulators = rdata;
 	pdata->opmode = rmode;
-- 
2.27.0




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

* [PATCH 4.19 129/247] isofs: release buffer head before return
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (127 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 128/247] regulator: s5m8767: Drop regulators OF node reference Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 130/247] auxdisplay: ht16k33: Fix refresh rate handling Greg Kroah-Hartman
                   ` (120 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Pan Bian, Jan Kara, Sasha Levin

From: Pan Bian <bianpan2016@163.com>

[ Upstream commit 0a6dc67a6aa45f19bd4ff89b4f468fc50c4b8daa ]

Release the buffer_head before returning error code in
do_isofs_readdir() and isofs_find_entry().

Fixes: 2deb1acc653c ("isofs: fix access to unallocated memory when reading corrupted filesystem")
Link: https://lore.kernel.org/r/20210118120455.118955-1-bianpan2016@163.com
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/isofs/dir.c   | 1 +
 fs/isofs/namei.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
index 947ce22f5b3c3..55df4d80793ba 100644
--- a/fs/isofs/dir.c
+++ b/fs/isofs/dir.c
@@ -152,6 +152,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *file,
 			printk(KERN_NOTICE "iso9660: Corrupted directory entry"
 			       " in block %lu of inode %lu\n", block,
 			       inode->i_ino);
+			brelse(bh);
 			return -EIO;
 		}
 
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c
index cac468f04820e..558e7c51ce0d4 100644
--- a/fs/isofs/namei.c
+++ b/fs/isofs/namei.c
@@ -102,6 +102,7 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
 			printk(KERN_NOTICE "iso9660: Corrupted directory entry"
 			       " in block %lu of inode %lu\n", block,
 			       dir->i_ino);
+			brelse(bh);
 			return 0;
 		}
 
-- 
2.27.0




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

* [PATCH 4.19 130/247] auxdisplay: ht16k33: Fix refresh rate handling
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (128 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 129/247] isofs: release buffer head before return Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 131/247] IB/umad: Return EIO in case of when device disassociated Greg Kroah-Hartman
                   ` (119 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Geert Uytterhoeven, Miguel Ojeda,
	Sasha Levin

From: Geert Uytterhoeven <geert@linux-m68k.org>

[ Upstream commit e89b0a426721a8ca5971bc8d70aa5ea35c020f90 ]

Drop the call to msecs_to_jiffies(), as "HZ / fbdev->refresh_rate" is
already the number of jiffies to wait.

Fixes: 8992da44c6805d53 ("auxdisplay: ht16k33: Driver for LED controller")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/auxdisplay/ht16k33.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index 21393ec3b9a4a..194370ae37dd0 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -117,8 +117,7 @@ static void ht16k33_fb_queue(struct ht16k33_priv *priv)
 {
 	struct ht16k33_fbdev *fbdev = &priv->fbdev;
 
-	schedule_delayed_work(&fbdev->work,
-			      msecs_to_jiffies(HZ / fbdev->refresh_rate));
+	schedule_delayed_work(&fbdev->work, HZ / fbdev->refresh_rate);
 }
 
 /*
-- 
2.27.0




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

* [PATCH 4.19 131/247] IB/umad: Return EIO in case of when device disassociated
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (129 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 130/247] auxdisplay: ht16k33: Fix refresh rate handling Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 132/247] IB/umad: Return EPOLLERR " Greg Kroah-Hartman
                   ` (118 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Shay Drory, Leon Romanovsky,
	Jason Gunthorpe, Sasha Levin

From: Shay Drory <shayd@nvidia.com>

[ Upstream commit 4fc5461823c9cad547a9bdfbf17d13f0da0d6bb5 ]

MAD message received by the user has EINVAL error in all flows
including when the device is disassociated. That makes it impossible
for the applications to treat such flow differently.

Change it to return EIO, so the applications will be able to perform
disassociation recovery.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Link: https://lore.kernel.org/r/20210125121339.837518-2-leon@kernel.org
Signed-off-by: Shay Drory <shayd@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/infiniband/core/user_mad.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index a18f3f8ad77fe..db2ac5218c371 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -366,6 +366,11 @@ static ssize_t ib_umad_read(struct file *filp, char __user *buf,
 
 	mutex_lock(&file->mutex);
 
+	if (file->agents_dead) {
+		mutex_unlock(&file->mutex);
+		return -EIO;
+	}
+
 	while (list_empty(&file->recv_list)) {
 		mutex_unlock(&file->mutex);
 
@@ -508,7 +513,7 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
 
 	agent = __get_agent(file, packet->mad.hdr.id);
 	if (!agent) {
-		ret = -EINVAL;
+		ret = -EIO;
 		goto err_up;
 	}
 
-- 
2.27.0




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

* [PATCH 4.19 132/247] IB/umad: Return EPOLLERR in case of when device disassociated
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (130 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 131/247] IB/umad: Return EIO in case of when device disassociated Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 133/247] KVM: PPC: Make the VMX instruction emulation routines static Greg Kroah-Hartman
                   ` (117 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Shay Drory, Leon Romanovsky,
	Jason Gunthorpe, Sasha Levin

From: Shay Drory <shayd@nvidia.com>

[ Upstream commit def4cd43f522253645b72c97181399c241b54536 ]

Currently, polling a umad device will always works, even if the device was
disassociated. A disassociated device should immediately return EPOLLERR
from poll(). Otherwise userspace is endlessly hung on poll() with no idea
that the device has been removed from the system.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Link: https://lore.kernel.org/r/20210125121339.837518-3-leon@kernel.org
Signed-off-by: Shay Drory <shayd@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/infiniband/core/user_mad.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index db2ac5218c371..471a824be86c4 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -384,6 +384,11 @@ static ssize_t ib_umad_read(struct file *filp, char __user *buf,
 		mutex_lock(&file->mutex);
 	}
 
+	if (file->agents_dead) {
+		mutex_unlock(&file->mutex);
+		return -EIO;
+	}
+
 	packet = list_entry(file->recv_list.next, struct ib_umad_packet, list);
 	list_del(&packet->list);
 
@@ -642,10 +647,14 @@ static __poll_t ib_umad_poll(struct file *filp, struct poll_table_struct *wait)
 	/* we will always be able to post a MAD send */
 	__poll_t mask = EPOLLOUT | EPOLLWRNORM;
 
+	mutex_lock(&file->mutex);
 	poll_wait(filp, &file->recv_wait, wait);
 
 	if (!list_empty(&file->recv_list))
 		mask |= EPOLLIN | EPOLLRDNORM;
+	if (file->agents_dead)
+		mask = EPOLLERR;
+	mutex_unlock(&file->mutex);
 
 	return mask;
 }
@@ -1262,6 +1271,7 @@ static void ib_umad_kill_port(struct ib_umad_port *port)
 	list_for_each_entry(file, &port->file_list, port_list) {
 		mutex_lock(&file->mutex);
 		file->agents_dead = 1;
+		wake_up_interruptible(&file->recv_wait);
 		mutex_unlock(&file->mutex);
 
 		for (id = 0; id < IB_UMAD_MAX_AGENTS; ++id)
-- 
2.27.0




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

* [PATCH 4.19 133/247] KVM: PPC: Make the VMX instruction emulation routines static
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (131 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 132/247] IB/umad: Return EPOLLERR " Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 134/247] powerpc/47x: Disable 256k page size Greg Kroah-Hartman
                   ` (116 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Cédric Le Goater,
	Michael Ellerman, Sasha Levin

From: Cédric Le Goater <clg@kaod.org>

[ Upstream commit 9236f57a9e51c72ce426ccd2e53e123de7196a0f ]

These are only used locally. It fixes these W=1 compile errors :

../arch/powerpc/kvm/powerpc.c:1521:5: error: no previous prototype for ‘kvmppc_get_vmx_dword’ [-Werror=missing-prototypes]
 1521 | int kvmppc_get_vmx_dword(struct kvm_vcpu *vcpu, int index, u64 *val)
      |     ^~~~~~~~~~~~~~~~~~~~
../arch/powerpc/kvm/powerpc.c:1539:5: error: no previous prototype for ‘kvmppc_get_vmx_word’ [-Werror=missing-prototypes]
 1539 | int kvmppc_get_vmx_word(struct kvm_vcpu *vcpu, int index, u64 *val)
      |     ^~~~~~~~~~~~~~~~~~~
../arch/powerpc/kvm/powerpc.c:1557:5: error: no previous prototype for ‘kvmppc_get_vmx_hword’ [-Werror=missing-prototypes]
 1557 | int kvmppc_get_vmx_hword(struct kvm_vcpu *vcpu, int index, u64 *val)
      |     ^~~~~~~~~~~~~~~~~~~~
../arch/powerpc/kvm/powerpc.c:1575:5: error: no previous prototype for ‘kvmppc_get_vmx_byte’ [-Werror=missing-prototypes]
 1575 | int kvmppc_get_vmx_byte(struct kvm_vcpu *vcpu, int index, u64 *val)
      |     ^~~~~~~~~~~~~~~~~~~

Fixes: acc9eb9305fe ("KVM: PPC: Reimplement LOAD_VMX/STORE_VMX instruction mmio emulation with analyse_instr() input")
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210104143206.695198-19-clg@kaod.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/kvm/powerpc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 51cd66dc1bb09..7c8354dfe80e2 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -1497,7 +1497,7 @@ int kvmppc_handle_vmx_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
 	return emulated;
 }
 
-int kvmppc_get_vmx_dword(struct kvm_vcpu *vcpu, int index, u64 *val)
+static int kvmppc_get_vmx_dword(struct kvm_vcpu *vcpu, int index, u64 *val)
 {
 	union kvmppc_one_reg reg;
 	int vmx_offset = 0;
@@ -1515,7 +1515,7 @@ int kvmppc_get_vmx_dword(struct kvm_vcpu *vcpu, int index, u64 *val)
 	return result;
 }
 
-int kvmppc_get_vmx_word(struct kvm_vcpu *vcpu, int index, u64 *val)
+static int kvmppc_get_vmx_word(struct kvm_vcpu *vcpu, int index, u64 *val)
 {
 	union kvmppc_one_reg reg;
 	int vmx_offset = 0;
@@ -1533,7 +1533,7 @@ int kvmppc_get_vmx_word(struct kvm_vcpu *vcpu, int index, u64 *val)
 	return result;
 }
 
-int kvmppc_get_vmx_hword(struct kvm_vcpu *vcpu, int index, u64 *val)
+static int kvmppc_get_vmx_hword(struct kvm_vcpu *vcpu, int index, u64 *val)
 {
 	union kvmppc_one_reg reg;
 	int vmx_offset = 0;
@@ -1551,7 +1551,7 @@ int kvmppc_get_vmx_hword(struct kvm_vcpu *vcpu, int index, u64 *val)
 	return result;
 }
 
-int kvmppc_get_vmx_byte(struct kvm_vcpu *vcpu, int index, u64 *val)
+static int kvmppc_get_vmx_byte(struct kvm_vcpu *vcpu, int index, u64 *val)
 {
 	union kvmppc_one_reg reg;
 	int vmx_offset = 0;
-- 
2.27.0




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

* [PATCH 4.19 134/247] powerpc/47x: Disable 256k page size
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (132 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 133/247] KVM: PPC: Make the VMX instruction emulation routines static Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 135/247] mmc: usdhi6rol0: Fix a resource leak in the error handling path of the probe Greg Kroah-Hartman
                   ` (115 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, kernel test robot, Christophe Leroy,
	Michael Ellerman, Sasha Levin

From: Christophe Leroy <christophe.leroy@csgroup.eu>

[ Upstream commit 910a0cb6d259736a0c86e795d4c2f42af8d0d775 ]

PPC47x_TLBE_SIZE isn't defined for 256k pages, leading to a build
break if 256k pages is selected.

So change the kconfig so that 256k pages can't be selected for 47x.

Fixes: e7f75ad01d59 ("powerpc/47x: Base ppc476 support")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
[mpe: Expand change log to mention build break]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/2fed79b1154c872194f98bac4422c23918325e61.1611128938.git.christophe.leroy@csgroup.eu
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index d18ea3c1f4fac..6dd2a14e1ebcd 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -709,7 +709,7 @@ config PPC_64K_PAGES
 
 config PPC_256K_PAGES
 	bool "256k page size"
-	depends on 44x && !STDBINUTILS
+	depends on 44x && !STDBINUTILS && !PPC_47x
 	help
 	  Make the page size 256k.
 
-- 
2.27.0




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

* [PATCH 4.19 135/247] mmc: usdhi6rol0: Fix a resource leak in the error handling path of the probe
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (133 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 134/247] powerpc/47x: Disable 256k page size Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 136/247] mmc: renesas_sdhi_internal_dmac: Fix DMA buffer alignment from 8 to 128-bytes Greg Kroah-Hartman
                   ` (114 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christophe JAILLET, Ulf Hansson, Sasha Levin

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

[ Upstream commit 6052b3c370fb82dec28bcfff6d7ec0da84ac087a ]

A call to 'ausdhi6_dma_release()' to undo a previous call to
'usdhi6_dma_request()' is missing in the error handling path of the probe
function.

It is already present in the remove function.

Fixes: 75fa9ea6e3c0 ("mmc: add a driver for the Renesas usdhi6rol0 SD/SDIO host controller")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/20201217210922.165340-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/mmc/host/usdhi6rol0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/usdhi6rol0.c b/drivers/mmc/host/usdhi6rol0.c
index cdfeb15b6f051..ef3aa8b520787 100644
--- a/drivers/mmc/host/usdhi6rol0.c
+++ b/drivers/mmc/host/usdhi6rol0.c
@@ -1866,10 +1866,12 @@ static int usdhi6_probe(struct platform_device *pdev)
 
 	ret = mmc_add_host(mmc);
 	if (ret < 0)
-		goto e_clk_off;
+		goto e_release_dma;
 
 	return 0;
 
+e_release_dma:
+	usdhi6_dma_release(host);
 e_clk_off:
 	clk_disable_unprepare(host->clk);
 e_free_mmc:
-- 
2.27.0




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

* [PATCH 4.19 136/247] mmc: renesas_sdhi_internal_dmac: Fix DMA buffer alignment from 8 to 128-bytes
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (134 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 135/247] mmc: usdhi6rol0: Fix a resource leak in the error handling path of the probe Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 137/247] ARM: 9046/1: decompressor: Do not clear SCTLR.nTLSMD for ARMv7+ cores Greg Kroah-Hartman
                   ` (113 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Takeshi Saito, Yoshihiro Shimoda,
	Wolfram Sang, Ulf Hansson, Sasha Levin

From: Takeshi Saito <takeshi.saito.xv@renesas.com>

[ Upstream commit d7aefb2887601cf1fc3f86f55d43b2c9aece5e8f ]

According to the latest datasheet, the internal DMAC buffer alignment
R-Car Gen3 SDHI HW should be 128-bytes. So, fix it.

Signed-off-by: Takeshi Saito <takeshi.saito.xv@renesas.com>
[shimoda: revise commit description, rebase]
Fixes: 2a68ea7896e3 ("mmc: renesas-sdhi: add support for R-Car Gen3 SDHI DMAC")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/1608114572-1892-2-git-send-email-yoshihiro.shimoda.uh@renesas.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/mmc/host/renesas_sdhi_internal_dmac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index 74eea8247490d..6e2685c9e9cb5 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -180,8 +180,8 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host,
 			mmc_get_dma_dir(data)))
 		goto force_pio;
 
-	/* This DMAC cannot handle if buffer is not 8-bytes alignment */
-	if (!IS_ALIGNED(sg_dma_address(sg), 8))
+	/* This DMAC cannot handle if buffer is not 128-bytes alignment */
+	if (!IS_ALIGNED(sg_dma_address(sg), 128))
 		goto force_pio_with_unmap;
 
 	if (data->flags & MMC_DATA_READ) {
-- 
2.27.0




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

* [PATCH 4.19 137/247] ARM: 9046/1: decompressor: Do not clear SCTLR.nTLSMD for ARMv7+ cores
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (135 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 136/247] mmc: renesas_sdhi_internal_dmac: Fix DMA buffer alignment from 8 to 128-bytes Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 138/247] amba: Fix resource leak for drivers without .remove Greg Kroah-Hartman
                   ` (112 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Vladimir Murzin, Russell King, Sasha Levin

From: Vladimir Murzin <vladimir.murzin@arm.com>

[ Upstream commit 2acb909750431030b65a0a2a17fd8afcbd813a84 ]

It was observed that decompressor running on hardware implementing ARM v8.2
Load/Store Multiple Atomicity and Ordering Control (LSMAOC), say, as guest,
would stuck just after:

Uncompressing Linux... done, booting the kernel.

The reason is that it clears nTLSMD bit when disabling caches:

  nTLSMD, bit [3]

  When ARMv8.2-LSMAOC is implemented:

    No Trap Load Multiple and Store Multiple to
    Device-nGRE/Device-nGnRE/Device-nGnRnE memory.

    0b0 All memory accesses by A32 and T32 Load Multiple and Store
        Multiple at EL1 or EL0 that are marked at stage 1 as
        Device-nGRE/Device-nGnRE/Device-nGnRnE memory are trapped and
        generate a stage 1 Alignment fault.

    0b1 All memory accesses by A32 and T32 Load Multiple and Store
        Multiple at EL1 or EL0 that are marked at stage 1 as
        Device-nGRE/Device-nGnRE/Device-nGnRnE memory are not trapped.

  This bit is permitted to be cached in a TLB.

  This field resets to 1.

  Otherwise:

  Reserved, RES1

So as effect we start getting traps we are not quite ready for.

Looking into history it seems that mask used for SCTLR clear came from
the similar code for ARMv4, where bit[3] is the enable/disable bit for
the write buffer. That not applicable to ARMv7 and onwards, so retire
that bit from the masks.

Fixes: 7d09e85448dfa78e3e58186c934449aaf6d49b50 ("[ARM] 4393/2: ARMv7: Add uncompressing code for the new CPU Id format")
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/boot/compressed/head.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index e205bbbe27949..69e661f574a07 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -1090,9 +1090,9 @@ __armv4_mmu_cache_off:
 __armv7_mmu_cache_off:
 		mrc	p15, 0, r0, c1, c0
 #ifdef CONFIG_MMU
-		bic	r0, r0, #0x000d
+		bic	r0, r0, #0x0005
 #else
-		bic	r0, r0, #0x000c
+		bic	r0, r0, #0x0004
 #endif
 		mcr	p15, 0, r0, c1, c0	@ turn MMU and cache off
 		mov	r12, lr
-- 
2.27.0




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

* [PATCH 4.19 138/247] amba: Fix resource leak for drivers without .remove
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (136 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 137/247] ARM: 9046/1: decompressor: Do not clear SCTLR.nTLSMD for ARMv7+ cores Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 139/247] tracepoint: Do not fail unregistering a probe due to memory failure Greg Kroah-Hartman
                   ` (111 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ulf Hansson, Arnd Bergmann,
	Uwe Kleine-König, Sasha Levin

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

[ Upstream commit de5d7adb89367bbc87b4e5ce7afe7ae9bd86dc12 ]

Consider an amba driver with a .probe but without a .remove callback (e.g.
pl061_gpio_driver). The function amba_probe() is called to bind a device
and so dev_pm_domain_attach() and others are called. As there is no remove
callback amba_remove() isn't called at unbind time however and so calling
dev_pm_domain_detach() is missed and the pm domain keeps active.

To fix this always use the core driver callbacks and handle missing amba
callbacks there. For probe refuse registration as a driver without probe
doesn't make sense.

Fixes: 7cfe249475fd ("ARM: AMBA: Add pclk support to AMBA bus infrastructure")
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20210126165835.687514-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/amba/bus.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 41b706403ef72..2380ebd9b7fda 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -284,10 +284,11 @@ static int amba_remove(struct device *dev)
 {
 	struct amba_device *pcdev = to_amba_device(dev);
 	struct amba_driver *drv = to_amba_driver(dev->driver);
-	int ret;
+	int ret = 0;
 
 	pm_runtime_get_sync(dev);
-	ret = drv->remove(pcdev);
+	if (drv->remove)
+		ret = drv->remove(pcdev);
 	pm_runtime_put_noidle(dev);
 
 	/* Undo the runtime PM settings in amba_probe() */
@@ -304,7 +305,9 @@ static int amba_remove(struct device *dev)
 static void amba_shutdown(struct device *dev)
 {
 	struct amba_driver *drv = to_amba_driver(dev->driver);
-	drv->shutdown(to_amba_device(dev));
+
+	if (drv->shutdown)
+		drv->shutdown(to_amba_device(dev));
 }
 
 /**
@@ -317,12 +320,13 @@ static void amba_shutdown(struct device *dev)
  */
 int amba_driver_register(struct amba_driver *drv)
 {
-	drv->drv.bus = &amba_bustype;
+	if (!drv->probe)
+		return -EINVAL;
 
-#define SETFN(fn)	if (drv->fn) drv->drv.fn = amba_##fn
-	SETFN(probe);
-	SETFN(remove);
-	SETFN(shutdown);
+	drv->drv.bus = &amba_bustype;
+	drv->drv.probe = amba_probe;
+	drv->drv.remove = amba_remove;
+	drv->drv.shutdown = amba_shutdown;
 
 	return driver_register(&drv->drv);
 }
-- 
2.27.0




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

* [PATCH 4.19 139/247] tracepoint: Do not fail unregistering a probe due to memory failure
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (137 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 138/247] amba: Fix resource leak for drivers without .remove Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 140/247] perf tools: Fix DSO filtering when not finding a map for a sampled address Greg Kroah-Hartman
                   ` (110 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Peter Zijlstra, Josh Poimboeuf,
	Mathieu Desnoyers, Ingo Molnar, Alexei Starovoitov,
	Daniel Borkmann, Dmitry Vyukov, Martin KaFai Lau, Song Liu,
	Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh, netdev,
	bpf, Kees Cook, Florian Weimer, syzbot+83aa762ef23b6f0d1991,
	syzbot+d29e58bb557324e55e5e, Matt Mullins,
	Steven Rostedt (VMware),
	Sasha Levin

From: Steven Rostedt (VMware) <rostedt@goodmis.org>

[ Upstream commit befe6d946551d65cddbd32b9cb0170b0249fd5ed ]

The list of tracepoint callbacks is managed by an array that is protected
by RCU. To update this array, a new array is allocated, the updates are
copied over to the new array, and then the list of functions for the
tracepoint is switched over to the new array. After a completion of an RCU
grace period, the old array is freed.

This process happens for both adding a callback as well as removing one.
But on removing a callback, if the new array fails to be allocated, the
callback is not removed, and may be used after it is freed by the clients
of the tracepoint.

There's really no reason to fail if the allocation for a new array fails
when removing a function. Instead, the function can simply be replaced by a
stub function that could be cleaned up on the next modification of the
array. That is, instead of calling the function registered to the
tracepoint, it would call a stub function in its place.

Link: https://lore.kernel.org/r/20201115055256.65625-1-mmullins@mmlx.us
Link: https://lore.kernel.org/r/20201116175107.02db396d@gandalf.local.home
Link: https://lore.kernel.org/r/20201117211836.54acaef2@oasis.local.home
Link: https://lkml.kernel.org/r/20201118093405.7a6d2290@gandalf.local.home

[ Note, this version does use undefined compiler behavior (assuming that
  a stub function with no parameters or return, can be called by a location
  that thinks it has parameters but still no return value. Static calls
  do the same thing, so this trick is not without precedent.

  There's another solution that uses RCU tricks and is more complex, but
  can be an alternative if this solution becomes an issue.

  Link: https://lore.kernel.org/lkml/20210127170721.58bce7cc@gandalf.local.home/
]

Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Song Liu <songliubraving@fb.com>
Cc: Yonghong Song <yhs@fb.com>
Cc: Andrii Nakryiko <andriin@fb.com>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: KP Singh <kpsingh@chromium.org>
Cc: netdev <netdev@vger.kernel.org>
Cc: bpf <bpf@vger.kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Florian Weimer <fw@deneb.enyo.de>
Fixes: 97e1c18e8d17b ("tracing: Kernel Tracepoints")
Reported-by: syzbot+83aa762ef23b6f0d1991@syzkaller.appspotmail.com
Reported-by: syzbot+d29e58bb557324e55e5e@syzkaller.appspotmail.com
Reported-by: Matt Mullins <mmullins@mmlx.us>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Tested-by: Matt Mullins <mmullins@mmlx.us>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/tracepoint.c | 80 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 64 insertions(+), 16 deletions(-)

diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index a3be42304485f..d5ce692319128 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -66,6 +66,12 @@ struct tp_probes {
 	struct tracepoint_func probes[0];
 };
 
+/* Called in removal of a func but failed to allocate a new tp_funcs */
+static void tp_stub_func(void)
+{
+	return;
+}
+
 static inline void *allocate_probes(int count)
 {
 	struct tp_probes *p  = kmalloc(count * sizeof(struct tracepoint_func)
@@ -144,6 +150,7 @@ func_add(struct tracepoint_func **funcs, struct tracepoint_func *tp_func,
 {
 	struct tracepoint_func *old, *new;
 	int nr_probes = 0;
+	int stub_funcs = 0;
 	int pos = -1;
 
 	if (WARN_ON(!tp_func->func))
@@ -160,14 +167,34 @@ func_add(struct tracepoint_func **funcs, struct tracepoint_func *tp_func,
 			if (old[nr_probes].func == tp_func->func &&
 			    old[nr_probes].data == tp_func->data)
 				return ERR_PTR(-EEXIST);
+			if (old[nr_probes].func == tp_stub_func)
+				stub_funcs++;
 		}
 	}
-	/* + 2 : one for new probe, one for NULL func */
-	new = allocate_probes(nr_probes + 2);
+	/* + 2 : one for new probe, one for NULL func - stub functions */
+	new = allocate_probes(nr_probes + 2 - stub_funcs);
 	if (new == NULL)
 		return ERR_PTR(-ENOMEM);
 	if (old) {
-		if (pos < 0) {
+		if (stub_funcs) {
+			/* Need to copy one at a time to remove stubs */
+			int probes = 0;
+
+			pos = -1;
+			for (nr_probes = 0; old[nr_probes].func; nr_probes++) {
+				if (old[nr_probes].func == tp_stub_func)
+					continue;
+				if (pos < 0 && old[nr_probes].prio < prio)
+					pos = probes++;
+				new[probes++] = old[nr_probes];
+			}
+			nr_probes = probes;
+			if (pos < 0)
+				pos = probes;
+			else
+				nr_probes--; /* Account for insertion */
+
+		} else if (pos < 0) {
 			pos = nr_probes;
 			memcpy(new, old, nr_probes * sizeof(struct tracepoint_func));
 		} else {
@@ -201,8 +228,9 @@ static void *func_remove(struct tracepoint_func **funcs,
 	/* (N -> M), (N > 1, M >= 0) probes */
 	if (tp_func->func) {
 		for (nr_probes = 0; old[nr_probes].func; nr_probes++) {
-			if (old[nr_probes].func == tp_func->func &&
-			     old[nr_probes].data == tp_func->data)
+			if ((old[nr_probes].func == tp_func->func &&
+			     old[nr_probes].data == tp_func->data) ||
+			    old[nr_probes].func == tp_stub_func)
 				nr_del++;
 		}
 	}
@@ -221,14 +249,32 @@ static void *func_remove(struct tracepoint_func **funcs,
 		/* N -> M, (N > 1, M > 0) */
 		/* + 1 for NULL */
 		new = allocate_probes(nr_probes - nr_del + 1);
-		if (new == NULL)
-			return ERR_PTR(-ENOMEM);
-		for (i = 0; old[i].func; i++)
-			if (old[i].func != tp_func->func
-					|| old[i].data != tp_func->data)
-				new[j++] = old[i];
-		new[nr_probes - nr_del].func = NULL;
-		*funcs = new;
+		if (new) {
+			for (i = 0; old[i].func; i++)
+				if ((old[i].func != tp_func->func
+				     || old[i].data != tp_func->data)
+				    && old[i].func != tp_stub_func)
+					new[j++] = old[i];
+			new[nr_probes - nr_del].func = NULL;
+			*funcs = new;
+		} else {
+			/*
+			 * Failed to allocate, replace the old function
+			 * with calls to tp_stub_func.
+			 */
+			for (i = 0; old[i].func; i++)
+				if (old[i].func == tp_func->func &&
+				    old[i].data == tp_func->data) {
+					old[i].func = tp_stub_func;
+					/* Set the prio to the next event. */
+					if (old[i + 1].func)
+						old[i].prio =
+							old[i + 1].prio;
+					else
+						old[i].prio = -1;
+				}
+			*funcs = old;
+		}
 	}
 	debug_print_probes(*funcs);
 	return old;
@@ -284,10 +330,12 @@ static int tracepoint_remove_func(struct tracepoint *tp,
 	tp_funcs = rcu_dereference_protected(tp->funcs,
 			lockdep_is_held(&tracepoints_mutex));
 	old = func_remove(&tp_funcs, func);
-	if (IS_ERR(old)) {
-		WARN_ON_ONCE(PTR_ERR(old) != -ENOMEM);
+	if (WARN_ON_ONCE(IS_ERR(old)))
 		return PTR_ERR(old);
-	}
+
+	if (tp_funcs == old)
+		/* Failed allocating new tp_funcs, replaced func with stub */
+		return 0;
 
 	if (!tp_funcs) {
 		/* Removed last function */
-- 
2.27.0




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

* [PATCH 4.19 140/247] perf tools: Fix DSO filtering when not finding a map for a sampled address
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (138 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 139/247] tracepoint: Do not fail unregistering a probe due to memory failure Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 141/247] RDMA/rxe: Fix coding error in rxe_recv.c Greg Kroah-Hartman
                   ` (109 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alexander Shishkin, Andi Kleen,
	Ingo Molnar, Jin Yao, Jiri Olsa, Kan Liang, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo, Sasha Levin

From: Arnaldo Carvalho de Melo <acme@redhat.com>

[ Upstream commit c69bf11ad3d30b6bf01cfa538ddff1a59467c734 ]

When we lookup an address and don't find a map we should filter that
sample if the user specified a list of --dso entries to filter on, fix
it.

Before:

  $ perf script
             sleep 274800  2843.556162:          1 cycles:u:  ffffffffbb26bff4 [unknown] ([unknown])
             sleep 274800  2843.556168:          1 cycles:u:  ffffffffbb2b047d [unknown] ([unknown])
             sleep 274800  2843.556171:          1 cycles:u:  ffffffffbb2706b2 [unknown] ([unknown])
             sleep 274800  2843.556174:          6 cycles:u:  ffffffffbb2b0267 [unknown] ([unknown])
             sleep 274800  2843.556176:         59 cycles:u:  ffffffffbb2b03b1 [unknown] ([unknown])
             sleep 274800  2843.556180:        691 cycles:u:  ffffffffbb26bff4 [unknown] ([unknown])
             sleep 274800  2843.556189:       9160 cycles:u:      7fa9550eeaa3 __GI___tunables_init+0xf3 (/usr/lib64/ld-2.32.so)
             sleep 274800  2843.556312:      86937 cycles:u:      7fa9550e157b _dl_lookup_symbol_x+0x4b (/usr/lib64/ld-2.32.so)
  $

So we have some samples we somehow didn't find in a map for, if we now
do:

  $ perf report --stdio --dso /usr/lib64/ld-2.32.so
  # dso: /usr/lib64/ld-2.32.so
  #
  # Total Lost Samples: 0
  #
  # Samples: 8  of event 'cycles:u'
  # Event count (approx.): 96856
  #
  # Overhead  Command  Symbol
  # ........  .......  ........................
  #
      89.76%  sleep    [.] _dl_lookup_symbol_x
       9.46%  sleep    [.] __GI___tunables_init
       0.71%  sleep    [k] 0xffffffffbb26bff4
       0.06%  sleep    [k] 0xffffffffbb2b03b1
       0.01%  sleep    [k] 0xffffffffbb2b0267
       0.00%  sleep    [k] 0xffffffffbb2706b2
       0.00%  sleep    [k] 0xffffffffbb2b047d
  $

After this patch we get the right output with just entries for the DSOs
specified in --dso:

  $ perf report --stdio --dso /usr/lib64/ld-2.32.so
  # dso: /usr/lib64/ld-2.32.so
  #
  # Total Lost Samples: 0
  #
  # Samples: 8  of event 'cycles:u'
  # Event count (approx.): 96856
  #
  # Overhead  Command  Symbol
  # ........  .......  ........................
  #
      89.76%  sleep    [.] _dl_lookup_symbol_x
       9.46%  sleep    [.] __GI___tunables_init
  $
  #

Fixes: 96415e4d3f5fdf9c ("perf symbols: Avoid unnecessary symbol loading when dso list is specified")
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20210128131209.GD775562@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 tools/perf/util/event.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 9c22729e2ad60..538c935b40b8b 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1660,6 +1660,8 @@ int machine__resolve(struct machine *machine, struct addr_location *al,
 		}
 
 		al->sym = map__find_symbol(al->map, al->addr);
+	} else if (symbol_conf.dso_list) {
+		al->filtered |= (1 << HIST_FILTER__DSO);
 	}
 
 	if (symbol_conf.sym_list &&
-- 
2.27.0




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

* [PATCH 4.19 141/247] RDMA/rxe: Fix coding error in rxe_recv.c
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (139 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 140/247] perf tools: Fix DSO filtering when not finding a map for a sampled address Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 142/247] RDMA/rxe: Correct skb on loopback path Greg Kroah-Hartman
                   ` (108 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Bob Pearson, Jason Gunthorpe, Sasha Levin

From: Bob Pearson <rpearsonhpe@gmail.com>

[ Upstream commit 7d9ae80e31df57dd3253e1ec514f0000aa588a81 ]

check_type_state() in rxe_recv.c is written as if the type bits in the
packet opcode were a bit mask which is not correct. This patch corrects
this code to compare all 3 type bits to the required type.

Fixes: 8700e3e7c485 ("Soft RoCE driver")
Link: https://lore.kernel.org/r/20210127214500.3707-1-rpearson@hpe.com
Signed-off-by: Bob Pearson <rpearson@hpe.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/infiniband/sw/rxe/rxe_recv.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c
index b8f3e65402d1d..d94e2c5bc317d 100644
--- a/drivers/infiniband/sw/rxe/rxe_recv.c
+++ b/drivers/infiniband/sw/rxe/rxe_recv.c
@@ -36,21 +36,26 @@
 #include "rxe.h"
 #include "rxe_loc.h"
 
+/* check that QP matches packet opcode type and is in a valid state */
 static int check_type_state(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
 			    struct rxe_qp *qp)
 {
+	unsigned int pkt_type;
+
 	if (unlikely(!qp->valid))
 		goto err1;
 
+	pkt_type = pkt->opcode & 0xe0;
+
 	switch (qp_type(qp)) {
 	case IB_QPT_RC:
-		if (unlikely((pkt->opcode & IB_OPCODE_RC) != 0)) {
+		if (unlikely(pkt_type != IB_OPCODE_RC)) {
 			pr_warn_ratelimited("bad qp type\n");
 			goto err1;
 		}
 		break;
 	case IB_QPT_UC:
-		if (unlikely(!(pkt->opcode & IB_OPCODE_UC))) {
+		if (unlikely(pkt_type != IB_OPCODE_UC)) {
 			pr_warn_ratelimited("bad qp type\n");
 			goto err1;
 		}
@@ -58,7 +63,7 @@ static int check_type_state(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
 	case IB_QPT_UD:
 	case IB_QPT_SMI:
 	case IB_QPT_GSI:
-		if (unlikely(!(pkt->opcode & IB_OPCODE_UD))) {
+		if (unlikely(pkt_type != IB_OPCODE_UD)) {
 			pr_warn_ratelimited("bad qp type\n");
 			goto err1;
 		}
-- 
2.27.0




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

* [PATCH 4.19 142/247] RDMA/rxe: Correct skb on loopback path
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (140 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 141/247] RDMA/rxe: Fix coding error in rxe_recv.c Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 143/247] spi: stm32: properly handle 0 byte transfer Greg Kroah-Hartman
                   ` (107 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Bob Pearson, Jason Gunthorpe, Sasha Levin

From: Bob Pearson <rpearsonhpe@gmail.com>

[ Upstream commit 5120bf0a5fc15dec210a0fe0f39e4a256bb6e349 ]

rxe_net.c sends packets at the IP layer with skb->data pointing at the IP
header but receives packets from a UDP tunnel with skb->data pointing at
the UDP header.  On the loopback path this was not correctly accounted
for.  This patch corrects for this by using sbk_pull() to strip the IP
header from the skb on received packets.

Fixes: 8700e3e7c485 ("Soft RoCE driver")
Link: https://lore.kernel.org/r/20210128182301.16859-1-rpearson@hpe.com
Signed-off-by: Bob Pearson <rpearson@hpe.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/infiniband/sw/rxe/rxe_net.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
index 7903bd5c639ea..04bfc36cc8d76 100644
--- a/drivers/infiniband/sw/rxe/rxe_net.c
+++ b/drivers/infiniband/sw/rxe/rxe_net.c
@@ -500,6 +500,11 @@ int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb)
 
 void rxe_loopback(struct sk_buff *skb)
 {
+	if (skb->protocol == htons(ETH_P_IP))
+		skb_pull(skb, sizeof(struct iphdr));
+	else
+		skb_pull(skb, sizeof(struct ipv6hdr));
+
 	rxe_rcv(skb);
 }
 
-- 
2.27.0




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

* [PATCH 4.19 143/247] spi: stm32: properly handle 0 byte transfer
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (141 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 142/247] RDMA/rxe: Correct skb on loopback path Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 144/247] mfd: wm831x-auxadc: Prevent use after free in wm831x_auxadc_read_irq() Greg Kroah-Hartman
                   ` (106 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alain Volmat, Mark Brown, Sasha Levin

From: Alain Volmat <alain.volmat@foss.st.com>

[ Upstream commit 2269f5a8b1a7b38651d62676b98182828f29d11a ]

On 0 byte transfer request, return straight from the
xfer function after finalizing the transfer.

Fixes: dcbe0d84dfa5 ("spi: add driver for STM32 SPI controller")
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Link: https://lore.kernel.org/r/1612551572-495-2-git-send-email-alain.volmat@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/spi/spi-stm32.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 8eb2644506dd3..8d692f16d90ac 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -992,6 +992,10 @@ static int stm32_spi_transfer_one(struct spi_master *master,
 	struct stm32_spi *spi = spi_master_get_devdata(master);
 	int ret;
 
+	/* Don't do anything on 0 bytes transfers */
+	if (transfer->len == 0)
+		return 0;
+
 	spi->tx_buf = transfer->tx_buf;
 	spi->rx_buf = transfer->rx_buf;
 	spi->tx_len = spi->tx_buf ? transfer->len : 0;
-- 
2.27.0




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

* [PATCH 4.19 144/247] mfd: wm831x-auxadc: Prevent use after free in wm831x_auxadc_read_irq()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (142 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 143/247] spi: stm32: properly handle 0 byte transfer Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 145/247] powerpc/pseries/dlpar: handle ibm, configure-connector delay status Greg Kroah-Hartman
                   ` (105 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Charles Keepax,
	Lee Jones, Sasha Levin

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

[ Upstream commit 26783d74cc6a440ee3ef9836a008a697981013d0 ]

The "req" struct is always added to the "wm831x->auxadc_pending" list,
but it's only removed from the list on the success path.  If a failure
occurs then the "req" struct is freed but it's still on the list,
leading to a use after free.

Fixes: 78bb3688ea18 ("mfd: Support multiple active WM831x AUXADC conversions")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/mfd/wm831x-auxadc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mfd/wm831x-auxadc.c b/drivers/mfd/wm831x-auxadc.c
index fd789d2eb0f52..9f7ae1e1ebcd6 100644
--- a/drivers/mfd/wm831x-auxadc.c
+++ b/drivers/mfd/wm831x-auxadc.c
@@ -98,11 +98,10 @@ static int wm831x_auxadc_read_irq(struct wm831x *wm831x,
 	wait_for_completion_timeout(&req->done, msecs_to_jiffies(500));
 
 	mutex_lock(&wm831x->auxadc_lock);
-
-	list_del(&req->list);
 	ret = req->val;
 
 out:
+	list_del(&req->list);
 	mutex_unlock(&wm831x->auxadc_lock);
 
 	kfree(req);
-- 
2.27.0




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

* [PATCH 4.19 145/247] powerpc/pseries/dlpar: handle ibm, configure-connector delay status
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (143 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 144/247] mfd: wm831x-auxadc: Prevent use after free in wm831x_auxadc_read_irq() Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 146/247] powerpc/8xx: Fix software emulation interrupt Greg Kroah-Hartman
                   ` (104 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Nathan Lynch, Tyrel Datwyler,
	Michael Ellerman, Sasha Levin

From: Nathan Lynch <nathanl@linux.ibm.com>

[ Upstream commit 768d70e19ba525debd571b36e6d0ab19956c63d7 ]

dlpar_configure_connector() has two problems in its handling of
ibm,configure-connector's return status:

1. When the status is -2 (busy, call again), we call
   ibm,configure-connector again immediately without checking whether
   to schedule, which can result in monopolizing the CPU.
2. Extended delay status (9900..9905) goes completely unhandled,
   causing the configuration to unnecessarily terminate.

Fix both of these issues by using rtas_busy_delay().

Fixes: ab519a011caa ("powerpc/pseries: Kernel DLPAR Infrastructure")
Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Reviewed-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210107025900.410369-1-nathanl@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/platforms/pseries/dlpar.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index c5ffcadab7302..90fd03b9d3c25 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -132,7 +132,6 @@ void dlpar_free_cc_nodes(struct device_node *dn)
 #define NEXT_PROPERTY   3
 #define PREV_PARENT     4
 #define MORE_MEMORY     5
-#define CALL_AGAIN	-2
 #define ERR_CFG_USE     -9003
 
 struct device_node *dlpar_configure_connector(__be32 drc_index,
@@ -173,6 +172,9 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
 
 		spin_unlock(&rtas_data_buf_lock);
 
+		if (rtas_busy_delay(rc))
+			continue;
+
 		switch (rc) {
 		case COMPLETE:
 			break;
@@ -221,9 +223,6 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
 			last_dn = last_dn->parent;
 			break;
 
-		case CALL_AGAIN:
-			break;
-
 		case MORE_MEMORY:
 		case ERR_CFG_USE:
 		default:
-- 
2.27.0




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

* [PATCH 4.19 146/247] powerpc/8xx: Fix software emulation interrupt
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (144 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 145/247] powerpc/pseries/dlpar: handle ibm, configure-connector delay status Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 147/247] clk: qcom: gcc-msm8998: Fix Alpha PLL type for all GPLLs Greg Kroah-Hartman
                   ` (103 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christophe Leroy, Michael Ellerman,
	Sasha Levin

From: Christophe Leroy <christophe.leroy@csgroup.eu>

[ Upstream commit 903178d0ce6bb30ef80a3604ab9ee2b57869fbc9 ]

For unimplemented instructions or unimplemented SPRs, the 8xx triggers
a "Software Emulation Exception" (0x1000). That interrupt doesn't set
reason bits in SRR1 as the "Program Check Exception" does.

Go through emulation_assist_interrupt() to set REASON_ILLEGAL.

Fixes: fbbcc3bb139e ("powerpc/8xx: Remove SoftwareEmulation()")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/ad782af87a222efc79cfb06079b0fd23d4224eaf.1612515180.git.christophe.leroy@csgroup.eu
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/kernel/head_8xx.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index dc99258f2e8c6..08c16aa0dd534 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -269,7 +269,7 @@ SystemCall:
 /* On the MPC8xx, this is a software emulation interrupt.  It occurs
  * for all unimplemented and illegal instructions.
  */
-	EXCEPTION(0x1000, SoftEmu, program_check_exception, EXC_XFER_STD)
+	EXCEPTION(0x1000, SoftEmu, emulation_assist_interrupt, EXC_XFER_STD)
 
 	. = 0x1100
 /*
-- 
2.27.0




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

* [PATCH 4.19 147/247] clk: qcom: gcc-msm8998: Fix Alpha PLL type for all GPLLs
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (145 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 146/247] powerpc/8xx: Fix software emulation interrupt Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 148/247] spi: pxa2xx: Fix the controller numbering for Wildcat Point Greg Kroah-Hartman
                   ` (102 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, AngeloGioacchino Del Regno,
	Stephen Boyd, Sasha Levin

From: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>

[ Upstream commit 292f75ecff07e8a07fe2e3e19b4b567d0b698842 ]

All of the GPLLs in the MSM8998 Global Clock Controller are Fabia PLLs
and not generic alphas: this was producing bad effects over the entire
clock tree of MSM8998, where any GPLL child clock was declaring a false
clock rate, due to their parent also showing the same.

The issue resides in the calculation of the clock rate for the specific
Alpha PLL type, where Fabia has a different register layout; switching
the MSM8998 GPLLs to the correct Alpha Fabia PLL type fixes the rate
(calculation) reading. While at it, also make these PLLs fixed since
their rate is supposed to *never* be changed while the system runs, as
this would surely crash the entire SoC.

Now all the children of all the PLLs are also complying with their
specified clock table and system stability is improved.

Fixes: b5f5f525c547 ("clk: qcom: Add MSM8998 Global Clock Control (GCC) driver")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Link: https://lore.kernel.org/r/20210114221059.483390-7-angelogioacchino.delregno@somainline.org
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/clk/qcom/gcc-msm8998.c | 100 ++++++++++++++++-----------------
 1 file changed, 50 insertions(+), 50 deletions(-)

diff --git a/drivers/clk/qcom/gcc-msm8998.c b/drivers/clk/qcom/gcc-msm8998.c
index 772a08101ddf2..0ccd6b79cb5e7 100644
--- a/drivers/clk/qcom/gcc-msm8998.c
+++ b/drivers/clk/qcom/gcc-msm8998.c
@@ -124,7 +124,7 @@ static struct pll_vco fabia_vco[] = {
 
 static struct clk_alpha_pll gpll0 = {
 	.offset = 0x0,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.vco_table = fabia_vco,
 	.num_vco = ARRAY_SIZE(fabia_vco),
 	.clkr = {
@@ -134,58 +134,58 @@ static struct clk_alpha_pll gpll0 = {
 			.name = "gpll0",
 			.parent_names = (const char *[]){ "xo" },
 			.num_parents = 1,
-			.ops = &clk_alpha_pll_ops,
+			.ops = &clk_alpha_pll_fixed_fabia_ops,
 		}
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll0_out_even = {
 	.offset = 0x0,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll0_out_even",
 		.parent_names = (const char *[]){ "gpll0" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll0_out_main = {
 	.offset = 0x0,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll0_out_main",
 		.parent_names = (const char *[]){ "gpll0" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll0_out_odd = {
 	.offset = 0x0,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll0_out_odd",
 		.parent_names = (const char *[]){ "gpll0" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll0_out_test = {
 	.offset = 0x0,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll0_out_test",
 		.parent_names = (const char *[]){ "gpll0" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll gpll1 = {
 	.offset = 0x1000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.vco_table = fabia_vco,
 	.num_vco = ARRAY_SIZE(fabia_vco),
 	.clkr = {
@@ -195,58 +195,58 @@ static struct clk_alpha_pll gpll1 = {
 			.name = "gpll1",
 			.parent_names = (const char *[]){ "xo" },
 			.num_parents = 1,
-			.ops = &clk_alpha_pll_ops,
+			.ops = &clk_alpha_pll_fixed_fabia_ops,
 		}
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll1_out_even = {
 	.offset = 0x1000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll1_out_even",
 		.parent_names = (const char *[]){ "gpll1" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll1_out_main = {
 	.offset = 0x1000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll1_out_main",
 		.parent_names = (const char *[]){ "gpll1" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll1_out_odd = {
 	.offset = 0x1000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll1_out_odd",
 		.parent_names = (const char *[]){ "gpll1" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll1_out_test = {
 	.offset = 0x1000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll1_out_test",
 		.parent_names = (const char *[]){ "gpll1" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll gpll2 = {
 	.offset = 0x2000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.vco_table = fabia_vco,
 	.num_vco = ARRAY_SIZE(fabia_vco),
 	.clkr = {
@@ -256,58 +256,58 @@ static struct clk_alpha_pll gpll2 = {
 			.name = "gpll2",
 			.parent_names = (const char *[]){ "xo" },
 			.num_parents = 1,
-			.ops = &clk_alpha_pll_ops,
+			.ops = &clk_alpha_pll_fixed_fabia_ops,
 		}
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll2_out_even = {
 	.offset = 0x2000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll2_out_even",
 		.parent_names = (const char *[]){ "gpll2" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll2_out_main = {
 	.offset = 0x2000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll2_out_main",
 		.parent_names = (const char *[]){ "gpll2" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll2_out_odd = {
 	.offset = 0x2000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll2_out_odd",
 		.parent_names = (const char *[]){ "gpll2" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll2_out_test = {
 	.offset = 0x2000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll2_out_test",
 		.parent_names = (const char *[]){ "gpll2" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll gpll3 = {
 	.offset = 0x3000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.vco_table = fabia_vco,
 	.num_vco = ARRAY_SIZE(fabia_vco),
 	.clkr = {
@@ -317,58 +317,58 @@ static struct clk_alpha_pll gpll3 = {
 			.name = "gpll3",
 			.parent_names = (const char *[]){ "xo" },
 			.num_parents = 1,
-			.ops = &clk_alpha_pll_ops,
+			.ops = &clk_alpha_pll_fixed_fabia_ops,
 		}
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll3_out_even = {
 	.offset = 0x3000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll3_out_even",
 		.parent_names = (const char *[]){ "gpll3" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll3_out_main = {
 	.offset = 0x3000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll3_out_main",
 		.parent_names = (const char *[]){ "gpll3" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll3_out_odd = {
 	.offset = 0x3000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll3_out_odd",
 		.parent_names = (const char *[]){ "gpll3" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll3_out_test = {
 	.offset = 0x3000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll3_out_test",
 		.parent_names = (const char *[]){ "gpll3" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll gpll4 = {
 	.offset = 0x77000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.vco_table = fabia_vco,
 	.num_vco = ARRAY_SIZE(fabia_vco),
 	.clkr = {
@@ -378,52 +378,52 @@ static struct clk_alpha_pll gpll4 = {
 			.name = "gpll4",
 			.parent_names = (const char *[]){ "xo" },
 			.num_parents = 1,
-			.ops = &clk_alpha_pll_ops,
+			.ops = &clk_alpha_pll_fixed_fabia_ops,
 		}
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll4_out_even = {
 	.offset = 0x77000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll4_out_even",
 		.parent_names = (const char *[]){ "gpll4" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll4_out_main = {
 	.offset = 0x77000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll4_out_main",
 		.parent_names = (const char *[]){ "gpll4" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll4_out_odd = {
 	.offset = 0x77000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll4_out_odd",
 		.parent_names = (const char *[]){ "gpll4" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
 static struct clk_alpha_pll_postdiv gpll4_out_test = {
 	.offset = 0x77000,
-	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpll4_out_test",
 		.parent_names = (const char *[]){ "gpll4" },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_postdiv_ops,
+		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };
 
-- 
2.27.0




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

* [PATCH 4.19 148/247] spi: pxa2xx: Fix the controller numbering for Wildcat Point
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (146 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 147/247] clk: qcom: gcc-msm8998: Fix Alpha PLL type for all GPLLs Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 149/247] Input: sur40 - fix an error code in sur40_probe() Greg Kroah-Hartman
                   ` (101 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Leif Liddy, Andy Shevchenko,
	Mark Brown, Sasha Levin

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

[ Upstream commit 54c5d3bfb0cfb7b31259765524567871dee11615 ]

Wildcat Point has two SPI controllers and added one is actually second one.
Fix the numbering by adding the description of the first one.

Fixes: caba248db286 ("spi: spi-pxa2xx-pci: Add ID and driver type for WildcatPoint PCH")
Cc: Leif Liddy <leif.liddy@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210208163816.22147-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/spi/spi-pxa2xx-pci.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c
index 869f188b02eb3..1736a48bbccec 100644
--- a/drivers/spi/spi-pxa2xx-pci.c
+++ b/drivers/spi/spi-pxa2xx-pci.c
@@ -21,7 +21,8 @@ enum {
 	PORT_BSW1,
 	PORT_BSW2,
 	PORT_CE4100,
-	PORT_LPT,
+	PORT_LPT0,
+	PORT_LPT1,
 };
 
 struct pxa_spi_info {
@@ -55,8 +56,10 @@ static struct dw_dma_slave bsw1_rx_param = { .src_id = 7 };
 static struct dw_dma_slave bsw2_tx_param = { .dst_id = 8 };
 static struct dw_dma_slave bsw2_rx_param = { .src_id = 9 };
 
-static struct dw_dma_slave lpt_tx_param = { .dst_id = 0 };
-static struct dw_dma_slave lpt_rx_param = { .src_id = 1 };
+static struct dw_dma_slave lpt1_tx_param = { .dst_id = 0 };
+static struct dw_dma_slave lpt1_rx_param = { .src_id = 1 };
+static struct dw_dma_slave lpt0_tx_param = { .dst_id = 2 };
+static struct dw_dma_slave lpt0_rx_param = { .src_id = 3 };
 
 static bool lpss_dma_filter(struct dma_chan *chan, void *param)
 {
@@ -182,12 +185,19 @@ static struct pxa_spi_info spi_info_configs[] = {
 		.num_chipselect = 1,
 		.max_clk_rate = 50000000,
 	},
-	[PORT_LPT] = {
+	[PORT_LPT0] = {
 		.type = LPSS_LPT_SSP,
 		.port_id = 0,
 		.setup = lpss_spi_setup,
-		.tx_param = &lpt_tx_param,
-		.rx_param = &lpt_rx_param,
+		.tx_param = &lpt0_tx_param,
+		.rx_param = &lpt0_rx_param,
+	},
+	[PORT_LPT1] = {
+		.type = LPSS_LPT_SSP,
+		.port_id = 1,
+		.setup = lpss_spi_setup,
+		.tx_param = &lpt1_tx_param,
+		.rx_param = &lpt1_rx_param,
 	},
 };
 
@@ -281,8 +291,9 @@ static const struct pci_device_id pxa2xx_spi_pci_devices[] = {
 	{ PCI_VDEVICE(INTEL, 0x2290), PORT_BSW1 },
 	{ PCI_VDEVICE(INTEL, 0x22ac), PORT_BSW2 },
 	{ PCI_VDEVICE(INTEL, 0x2e6a), PORT_CE4100 },
-	{ PCI_VDEVICE(INTEL, 0x9ce6), PORT_LPT },
-	{ },
+	{ PCI_VDEVICE(INTEL, 0x9ce5), PORT_LPT0 },
+	{ PCI_VDEVICE(INTEL, 0x9ce6), PORT_LPT1 },
+	{ }
 };
 MODULE_DEVICE_TABLE(pci, pxa2xx_spi_pci_devices);
 
-- 
2.27.0




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

* [PATCH 4.19 149/247] Input: sur40 - fix an error code in sur40_probe()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (147 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 148/247] spi: pxa2xx: Fix the controller numbering for Wildcat Point Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 150/247] perf intel-pt: Fix missing CYC processing in PSB Greg Kroah-Hartman
                   ` (100 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Dmitry Torokhov, Sasha Levin

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

[ Upstream commit b0b7d2815839024e5181bd2572f5d8d4f65363b3 ]

If v4l2_ctrl_handler_setup() fails then probe() should return an error
code instead of returning success.

Fixes: cee1e3e2ef39 ("media: add video control handlers using V4L2 control framework")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YBKFkbATXa5fA3xj@mwanda
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/input/touchscreen/sur40.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
index caa3aca2ea541..d5956854ac983 100644
--- a/drivers/input/touchscreen/sur40.c
+++ b/drivers/input/touchscreen/sur40.c
@@ -778,6 +778,7 @@ static int sur40_probe(struct usb_interface *interface,
 		dev_err(&interface->dev,
 			"Unable to register video controls.");
 		v4l2_ctrl_handler_free(&sur40->hdl);
+		error = sur40->hdl.error;
 		goto err_unreg_v4l2;
 	}
 
-- 
2.27.0




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

* [PATCH 4.19 150/247] perf intel-pt: Fix missing CYC processing in PSB
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (148 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 149/247] Input: sur40 - fix an error code in sur40_probe() Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 151/247] perf test: Fix unaligned access in sample parsing test Greg Kroah-Hartman
                   ` (99 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Adrian Hunter, Andi Kleen, Jiri Olsa,
	Arnaldo Carvalho de Melo, Sasha Levin

From: Adrian Hunter <adrian.hunter@intel.com>

[ Upstream commit 03fb0f859b45d1eb05c984ab4bd3bef67e45ede2 ]

Add missing CYC packet processing when walking through PSB+. This
improves the accuracy of timestamps that follow PSB+, until the next
MTC.

Fixes: 3d49807870f08 ("perf tools: Add new Intel PT packet definitions")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: https://lore.kernel.org/r/20210205175350.23817-2-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
index 6522b6513895c..e2f038f84dbc1 100644
--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
+++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
@@ -1596,6 +1596,9 @@ static int intel_pt_walk_psbend(struct intel_pt_decoder *decoder)
 			break;
 
 		case INTEL_PT_CYC:
+			intel_pt_calc_cyc_timestamp(decoder);
+			break;
+
 		case INTEL_PT_VMCS:
 		case INTEL_PT_MNT:
 		case INTEL_PT_PAD:
-- 
2.27.0




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

* [PATCH 4.19 151/247] perf test: Fix unaligned access in sample parsing test
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (149 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 150/247] perf intel-pt: Fix missing CYC processing in PSB Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 152/247] Input: elo - fix an error code in elo_connect() Greg Kroah-Hartman
                   ` (98 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Namhyung Kim, Adrian Hunter,
	Alexander Shishkin, Andi Kleen, Ian Rogers, Ingo Molnar,
	Jiri Olsa, Mark Rutland, Peter Zijlstra, Stephane Eranian,
	Arnaldo Carvalho de Melo, Sasha Levin

From: Namhyung Kim <namhyung@kernel.org>

[ Upstream commit c5c97cadd7ed13381cb6b4bef5c841a66938d350 ]

The ubsan reported the following error.  It was because sample's raw
data missed u32 padding at the end.  So it broke the alignment of the
array after it.

The raw data contains an u32 size prefix so the data size should have
an u32 padding after 8-byte aligned data.

27: Sample parsing  :util/synthetic-events.c:1539:4:
  runtime error: store to misaligned address 0x62100006b9bc for type
  '__u64' (aka 'unsigned long long'), which requires 8 byte alignment
0x62100006b9bc: note: pointer points here
  00 00 00 00 ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
              ^
    #0 0x561532a9fc96 in perf_event__synthesize_sample util/synthetic-events.c:1539:13
    #1 0x5615327f4a4f in do_test tests/sample-parsing.c:284:8
    #2 0x5615327f3f50 in test__sample_parsing tests/sample-parsing.c:381:9
    #3 0x56153279d3a1 in run_test tests/builtin-test.c:424:9
    #4 0x56153279c836 in test_and_print tests/builtin-test.c:454:9
    #5 0x56153279b7eb in __cmd_test tests/builtin-test.c:675:4
    #6 0x56153279abf0 in cmd_test tests/builtin-test.c:821:9
    #7 0x56153264e796 in run_builtin perf.c:312:11
    #8 0x56153264cf03 in handle_internal_command perf.c:364:8
    #9 0x56153264e47d in run_argv perf.c:408:2
    #10 0x56153264c9a9 in main perf.c:538:3
    #11 0x7f137ab6fbbc in __libc_start_main (/lib64/libc.so.6+0x38bbc)
    #12 0x561532596828 in _start ...

SUMMARY: UndefinedBehaviorSanitizer: misaligned-pointer-use
 util/synthetic-events.c:1539:4 in

Fixes: 045f8cd8542d ("perf tests: Add a sample parsing test")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20210214091638.519643-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 tools/perf/tests/sample-parsing.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/sample-parsing.c b/tools/perf/tests/sample-parsing.c
index 0e2d00d69e6e2..66e46bc8d6f1d 100644
--- a/tools/perf/tests/sample-parsing.c
+++ b/tools/perf/tests/sample-parsing.c
@@ -173,7 +173,7 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)
 		.data = {1, 211, 212, 213},
 	};
 	u64 regs[64];
-	const u64 raw_data[] = {0x123456780a0b0c0dULL, 0x1102030405060708ULL};
+	const u32 raw_data[] = {0x12345678, 0x0a0b0c0d, 0x11020304, 0x05060708, 0 };
 	const u64 data[] = {0x2211443366558877ULL, 0, 0xaabbccddeeff4321ULL};
 	struct perf_sample sample = {
 		.ip		= 101,
-- 
2.27.0




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

* [PATCH 4.19 152/247] Input: elo - fix an error code in elo_connect()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (150 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 151/247] perf test: Fix unaligned access in sample parsing test Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12   ` Greg Kroah-Hartman
                   ` (97 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Dmitry Torokhov, Sasha Levin

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

[ Upstream commit 0958351e93fa0ac142f6dd8bd844441594f30a57 ]

If elo_setup_10() fails then this should return an error code instead
of success.

Fixes: fae3006e4b42 ("Input: elo - add support for non-pressure-sensitive touchscreens")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YBKFd5CvDu+jVmfW@mwanda
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/input/touchscreen/elo.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/elo.c b/drivers/input/touchscreen/elo.c
index 7f2942f3cec6e..0f3146bcfcd0f 100644
--- a/drivers/input/touchscreen/elo.c
+++ b/drivers/input/touchscreen/elo.c
@@ -345,8 +345,10 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv)
 	switch (elo->id) {
 
 	case 0: /* 10-byte protocol */
-		if (elo_setup_10(elo))
+		if (elo_setup_10(elo)) {
+			err = -EIO;
 			goto fail3;
+		}
 
 		break;
 
-- 
2.27.0




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

* [PATCH 4.19 153/247] sparc64: only select COMPAT_BINFMT_ELF if BINFMT_ELF is set
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
@ 2021-03-01 16:12   ` Greg Kroah-Hartman
  2021-03-01 16:10 ` [PATCH 4.19 002/247] USB: quirks: sort quirk entries Greg Kroah-Hartman
                     ` (248 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Randy Dunlap, David S. Miller,
	sparclinux, Sam Ravnborg, Sasha Levin

From: Randy Dunlap <rdunlap@infradead.org>

[ Upstream commit 80bddf5c93a99e11fc9faf7e4b575d01cecd45d3 ]

Currently COMPAT on SPARC64 selects COMPAT_BINFMT_ELF unconditionally,
even when BINFMT_ELF is not enabled. This causes a kconfig warning.

Instead, just select COMPAT_BINFMT_ELF if BINFMT_ELF is enabled.
This builds cleanly with no kconfig warnings.

WARNING: unmet direct dependencies detected for COMPAT_BINFMT_ELF
  Depends on [n]: COMPAT [=y] && BINFMT_ELF [=n]
  Selected by [y]:
  - COMPAT [=y] && SPARC64 [=y]

Fixes: 26b4c912185a ("sparc,sparc64: unify Kconfig files")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/sparc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index e6f2a38d2e61e..1f1a7583fa905 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -554,7 +554,7 @@ config COMPAT
 	bool
 	depends on SPARC64
 	default y
-	select COMPAT_BINFMT_ELF
+	select COMPAT_BINFMT_ELF if BINFMT_ELF
 	select HAVE_UID16
 	select ARCH_WANT_OLD_COMPAT_IPC
 	select COMPAT_OLD_SIGACTION
-- 
2.27.0




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

* [PATCH 4.19 153/247] sparc64: only select COMPAT_BINFMT_ELF if BINFMT_ELF is set
@ 2021-03-01 16:12   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Randy Dunlap, David S. Miller,
	sparclinux, Sam Ravnborg, Sasha Levin

From: Randy Dunlap <rdunlap@infradead.org>

[ Upstream commit 80bddf5c93a99e11fc9faf7e4b575d01cecd45d3 ]

Currently COMPAT on SPARC64 selects COMPAT_BINFMT_ELF unconditionally,
even when BINFMT_ELF is not enabled. This causes a kconfig warning.

Instead, just select COMPAT_BINFMT_ELF if BINFMT_ELF is enabled.
This builds cleanly with no kconfig warnings.

WARNING: unmet direct dependencies detected for COMPAT_BINFMT_ELF
  Depends on [n]: COMPAT [=y] && BINFMT_ELF [=n]
  Selected by [y]:
  - COMPAT [=y] && SPARC64 [=y]

Fixes: 26b4c912185a ("sparc,sparc64: unify Kconfig files")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/sparc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index e6f2a38d2e61e..1f1a7583fa905 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -554,7 +554,7 @@ config COMPAT
 	bool
 	depends on SPARC64
 	default y
-	select COMPAT_BINFMT_ELF
+	select COMPAT_BINFMT_ELF if BINFMT_ELF
 	select HAVE_UID16
 	select ARCH_WANT_OLD_COMPAT_IPC
 	select COMPAT_OLD_SIGACTION
-- 
2.27.0

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

* [PATCH 4.19 154/247] misc: eeprom_93xx46: Fix module alias to enable module autoprobe
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (152 preceding siblings ...)
  2021-03-01 16:12   ` Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 155/247] misc: eeprom_93xx46: Add module alias to avoid breaking support for non device tree users Greg Kroah-Hartman
                   ` (95 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Aswath Govindraju, Sasha Levin

From: Aswath Govindraju <a-govindraju@ti.com>

[ Upstream commit 13613a2246bf531f5fc04e8e62e8f21a3d39bf1c ]

Fix module autoprobe by correcting module alias to match the string from
/sys/class/.../spi1.0/modalias content.

Fixes: 06b4501e88ad ("misc/eeprom: add driver for microwire 93xx46 EEPROMs")
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Link: https://lore.kernel.org/r/20210107163957.28664-2-a-govindraju@ti.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/misc/eeprom/eeprom_93xx46.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c
index 38766968bfa20..afaa717207b37 100644
--- a/drivers/misc/eeprom/eeprom_93xx46.c
+++ b/drivers/misc/eeprom/eeprom_93xx46.c
@@ -522,4 +522,4 @@ module_spi_driver(eeprom_93xx46_driver);
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Driver for 93xx46 EEPROMs");
 MODULE_AUTHOR("Anatolij Gustschin <agust@denx.de>");
-MODULE_ALIAS("spi:93xx46");
+MODULE_ALIAS("spi:eeprom-93xx46");
-- 
2.27.0




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

* [PATCH 4.19 155/247] misc: eeprom_93xx46: Add module alias to avoid breaking support for non device tree users
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (153 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 154/247] misc: eeprom_93xx46: Fix module alias to enable module autoprobe Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 156/247] pwm: rockchip: rockchip_pwm_probe(): Remove superfluous clk_unprepare() Greg Kroah-Hartman
                   ` (94 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Aswath Govindraju, Sasha Levin

From: Aswath Govindraju <a-govindraju@ti.com>

[ Upstream commit 4540b9fbd8ebb21bb3735796d300a1589ee5fbf2 ]

Module alias "spi:93xx46" is used by non device tree users like
drivers/misc/eeprom/digsy_mtc_eeprom.c  and removing it will
break support for them.

Fix this by adding back the module alias "spi:93xx46".

Fixes: 13613a2246bf ("misc: eeprom_93xx46: Fix module alias to enable module autoprobe")
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Link: https://lore.kernel.org/r/20210113051253.15061-1-a-govindraju@ti.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/misc/eeprom/eeprom_93xx46.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c
index afaa717207b37..a3248ebd28c62 100644
--- a/drivers/misc/eeprom/eeprom_93xx46.c
+++ b/drivers/misc/eeprom/eeprom_93xx46.c
@@ -522,4 +522,5 @@ module_spi_driver(eeprom_93xx46_driver);
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Driver for 93xx46 EEPROMs");
 MODULE_AUTHOR("Anatolij Gustschin <agust@denx.de>");
+MODULE_ALIAS("spi:93xx46");
 MODULE_ALIAS("spi:eeprom-93xx46");
-- 
2.27.0




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

* [PATCH 4.19 156/247] pwm: rockchip: rockchip_pwm_probe(): Remove superfluous clk_unprepare()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (154 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 155/247] misc: eeprom_93xx46: Add module alias to avoid breaking support for non device tree users Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 157/247] VMCI: Use set_page_dirty_lock() when unregistering guest memory Greg Kroah-Hartman
                   ` (93 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Simon South, Thierry Reding, Sasha Levin

From: Simon South <simon@simonsouth.net>

[ Upstream commit d5d8d675865ccddfe4da26c85f22c55cec663bf2 ]

If rockchip_pwm_probe() fails to register a PWM device it calls
clk_unprepare() for the device's PWM clock, without having first disabled
the clock and before jumping to an error handler that also unprepares
it. This is likely to produce warnings from the kernel about the clock
being unprepared when it is still enabled, and then being unprepared when
it has already been unprepared.

Prevent these warnings by removing this unnecessary call to
clk_unprepare().

Fixes: 48cf973cae33 ("pwm: rockchip: Avoid glitches on already running PWMs")
Signed-off-by: Simon South <simon@simonsouth.net>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/pwm/pwm-rockchip.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c
index 4d99d468df09a..48bcc853d57a7 100644
--- a/drivers/pwm/pwm-rockchip.c
+++ b/drivers/pwm/pwm-rockchip.c
@@ -370,7 +370,6 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
 
 	ret = pwmchip_add(&pc->chip);
 	if (ret < 0) {
-		clk_unprepare(pc->clk);
 		dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret);
 		goto err_pclk;
 	}
-- 
2.27.0




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

* [PATCH 4.19 157/247] VMCI: Use set_page_dirty_lock() when unregistering guest memory
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (155 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 156/247] pwm: rockchip: rockchip_pwm_probe(): Remove superfluous clk_unprepare() Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 158/247] PCI: Align checking of syscall user config accessors Greg Kroah-Hartman
                   ` (92 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Vishnu Dasa, Jorgen Hansen, Sasha Levin

From: Jorgen Hansen <jhansen@vmware.com>

[ Upstream commit 5a16c535409f8dcb7568e20737309e3027ae3e49 ]

When the VMCI host support releases guest memory in the case where
the VM was killed, the pinned guest pages aren't locked. Use
set_page_dirty_lock() instead of set_page_dirty().

Testing done: Killed VM while having an active VMCI based vSocket
connection and observed warning from ext4. With this fix, no
warning was observed. Ran various vSocket tests without issues.

Fixes: 06164d2b72aa ("VMCI: queue pairs implementation.")
Reviewed-by: Vishnu Dasa <vdasa@vmware.com>
Signed-off-by: Jorgen Hansen <jhansen@vmware.com>
Link: https://lore.kernel.org/r/1611160360-30299-1-git-send-email-jhansen@vmware.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/misc/vmw_vmci/vmci_queue_pair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c
index 5e0d1ac67f73f..36025e1058169 100644
--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
+++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
@@ -645,7 +645,7 @@ static void qp_release_pages(struct page **pages,
 
 	for (i = 0; i < num_pages; i++) {
 		if (dirty)
-			set_page_dirty(pages[i]);
+			set_page_dirty_lock(pages[i]);
 
 		put_page(pages[i]);
 		pages[i] = NULL;
-- 
2.27.0




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

* [PATCH 4.19 158/247] PCI: Align checking of syscall user config accessors
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (156 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 157/247] VMCI: Use set_page_dirty_lock() when unregistering guest memory Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:12 ` [PATCH 4.19 159/247] drm/msm/dsi: Correct io_start for MSM8994 (20nm PHY) Greg Kroah-Hartman
                   ` (91 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Heiner Kallweit, Bjorn Helgaas, Sasha Levin

From: Heiner Kallweit <hkallweit1@gmail.com>

[ Upstream commit ef9e4005cbaf022c6251263aa27836acccaef65d ]

After 34e3207205ef ("PCI: handle positive error codes"),
pci_user_read_config_*() and pci_user_write_config_*() return 0 or negative
errno values, not PCIBIOS_* values like PCIBIOS_SUCCESSFUL or
PCIBIOS_BAD_REGISTER_NUMBER.

Remove comparisons with PCIBIOS_SUCCESSFUL and check only for non-zero.  It
happens that PCIBIOS_SUCCESSFUL is zero, so this is not a functional
change, but it aligns this code with the user accessors.

[bhelgaas: commit log]
Fixes: 34e3207205ef ("PCI: handle positive error codes")
Link: https://lore.kernel.org/r/f1220314-e518-1e18-bf94-8e6f8c703758@gmail.com
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/pci/syscall.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c
index d96626c614f56..a7bdd10fccf33 100644
--- a/drivers/pci/syscall.c
+++ b/drivers/pci/syscall.c
@@ -19,7 +19,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
 	u16 word;
 	u32 dword;
 	long err;
-	long cfg_ret;
+	int cfg_ret;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
@@ -45,7 +45,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
 	}
 
 	err = -EIO;
-	if (cfg_ret != PCIBIOS_SUCCESSFUL)
+	if (cfg_ret)
 		goto error;
 
 	switch (len) {
@@ -103,7 +103,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
 		if (err)
 			break;
 		err = pci_user_write_config_byte(dev, off, byte);
-		if (err != PCIBIOS_SUCCESSFUL)
+		if (err)
 			err = -EIO;
 		break;
 
@@ -112,7 +112,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
 		if (err)
 			break;
 		err = pci_user_write_config_word(dev, off, word);
-		if (err != PCIBIOS_SUCCESSFUL)
+		if (err)
 			err = -EIO;
 		break;
 
@@ -121,7 +121,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
 		if (err)
 			break;
 		err = pci_user_write_config_dword(dev, off, dword);
-		if (err != PCIBIOS_SUCCESSFUL)
+		if (err)
 			err = -EIO;
 		break;
 
-- 
2.27.0




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

* [PATCH 4.19 159/247] drm/msm/dsi: Correct io_start for MSM8994 (20nm PHY)
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (157 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 158/247] PCI: Align checking of syscall user config accessors Greg Kroah-Hartman
@ 2021-03-01 16:12 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 160/247] ext4: fix potential htree index checksum corruption Greg Kroah-Hartman
                   ` (90 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Konrad Dybcio, Rob Clark, Sasha Levin

From: Konrad Dybcio <konrad.dybcio@somainline.org>

[ Upstream commit 33a7808ce1aea6e2edc1af25db25928137940c02 ]

The previous registers were *almost* correct, but instead of
PHYs, they were pointing at DSI PLLs, resulting in the PHY id
autodetection failing miserably.

Fixes: dcefc117cc19 ("drm/msm/dsi: Add support for msm8x94")
Signed-off-by: Konrad Dybcio <konrad.dybcio@somainline.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c
index 1ca6c69516f57..4c037d855b272 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c
@@ -147,7 +147,7 @@ const struct msm_dsi_phy_cfg dsi_phy_20nm_cfgs = {
 		.disable = dsi_20nm_phy_disable,
 		.init = msm_dsi_phy_init_common,
 	},
-	.io_start = { 0xfd998300, 0xfd9a0300 },
+	.io_start = { 0xfd998500, 0xfd9a0500 },
 	.num_dsi_phy = 2,
 };
 
-- 
2.27.0




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

* [PATCH 4.19 160/247] ext4: fix potential htree index checksum corruption
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (158 preceding siblings ...)
  2021-03-01 16:12 ` [PATCH 4.19 159/247] drm/msm/dsi: Correct io_start for MSM8994 (20nm PHY) Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 161/247] regmap: sdw: use _no_pm functions in regmap_read/write Greg Kroah-Hartman
                   ` (89 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Artem Blagodarenko, Theodore Tso,
	Sasha Levin

From: Theodore Ts'o <tytso@mit.edu>

[ Upstream commit b5776e7524afbd4569978ff790864755c438bba7 ]

In the case where we need to do an interior node split, and
immediately afterwards, we are unable to allocate a new directory leaf
block due to ENOSPC, the directory index checksum's will not be filled
in correctly (and indeed, will not be correctly journalled).

This looks like a bug that was introduced when we added largedir
support.  The original code doesn't make any sense (and should have
been caught in code review), but it was hidden because most of the
time, the index node checksum will be set by do_split().  But if
do_split bails out due to ENOSPC, then ext4_handle_dirty_dx_node()
won't get called, and so the directory index checksum field will not
get set, leading to:

EXT4-fs error (device sdb): dx_probe:858: inode #6635543: block 4022: comm nfsd: Directory index failed checksum

Google-Bug-Id: 176345532
Fixes: e08ac99fa2a2 ("ext4: add largedir feature")
Cc: Artem Blagodarenko <artem.blagodarenko@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/ext4/namei.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 8f7e0ad5b5ef1..0dde6385a1258 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2315,11 +2315,10 @@ again:
 						   (frame - 1)->bh);
 			if (err)
 				goto journal_error;
-			if (restart) {
-				err = ext4_handle_dirty_dx_node(handle, dir,
-							   frame->bh);
+			err = ext4_handle_dirty_dx_node(handle, dir,
+							frame->bh);
+			if (err)
 				goto journal_error;
-			}
 		} else {
 			struct dx_root *dxroot;
 			memcpy((char *) entries2, (char *) entries,
-- 
2.27.0




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

* [PATCH 4.19 161/247] regmap: sdw: use _no_pm functions in regmap_read/write
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (159 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 160/247] ext4: fix potential htree index checksum corruption Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 162/247] i40e: Fix flow for IPv6 next header (extension header) Greg Kroah-Hartman
                   ` (88 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Bard Liao, Mark Brown, Vinod Koul,
	Sasha Levin

From: Bard Liao <yung-chuan.liao@linux.intel.com>

[ Upstream commit d288a5712ef961e16d588bbdb2d846e00b5ef154 ]

sdw_update_slave_status will be invoked when a codec is attached,
and the codec driver will initialize the codec with regmap functions
while the codec device is pm_runtime suspended.

regmap routines currently rely on regular SoundWire IO functions,
which will call pm_runtime_get_sync()/put_autosuspend.

This causes a deadlock where the resume routine waits for an
initialization complete signal that while the initialization complete
can only be reached when the resume completes.

The only solution if we allow regmap functions to be used in resume
operations as well as during codec initialization is to use _no_pm
routines. The duty of making sure the bus is operational needs to be
handled above the regmap level.

Fixes: 7c22ce6e21840 ('regmap: Add SoundWire bus support')
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210122070634.12825-6-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/base/regmap/regmap-sdw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/regmap/regmap-sdw.c b/drivers/base/regmap/regmap-sdw.c
index 50a66382d87d0..e75168b941d0c 100644
--- a/drivers/base/regmap/regmap-sdw.c
+++ b/drivers/base/regmap/regmap-sdw.c
@@ -12,7 +12,7 @@ static int regmap_sdw_write(void *context, unsigned int reg, unsigned int val)
 	struct device *dev = context;
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 
-	return sdw_write(slave, reg, val);
+	return sdw_write_no_pm(slave, reg, val);
 }
 
 static int regmap_sdw_read(void *context, unsigned int reg, unsigned int *val)
@@ -21,7 +21,7 @@ static int regmap_sdw_read(void *context, unsigned int reg, unsigned int *val)
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	int read;
 
-	read = sdw_read(slave, reg);
+	read = sdw_read_no_pm(slave, reg);
 	if (read < 0)
 		return read;
 
-- 
2.27.0




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

* [PATCH 4.19 162/247] i40e: Fix flow for IPv6 next header (extension header)
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (160 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 161/247] regmap: sdw: use _no_pm functions in regmap_read/write Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 163/247] i40e: Add zero-initialization of AQ command structures Greg Kroah-Hartman
                   ` (87 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Slawomir Laba, Przemyslaw Patynowski,
	Aleksandr Loktionov, Tony Brelinski, Tony Nguyen, Sasha Levin

From: Slawomir Laba <slawomirx.laba@intel.com>

[ Upstream commit 92c6058024e87087cf1b99b0389d67c0a886360e ]

When a packet contains an IPv6 header with next header which is
an extension header and not a protocol one, the kernel function
skb_transport_header called with such sk_buff will return a
pointer to the extension header and not to the TCP one.

The above explained call caused a problem with packet processing
for skb with encapsulation for tunnel with I40E_TX_CTX_EXT_IP_IPV6.
The extension header was not skipped at all.

The ipv6_skip_exthdr function does check if next header of the IPV6
header is an extension header and doesn't modify the l4_proto pointer
if it points to a protocol header value so its safe to omit the
comparison of exthdr and l4.hdr pointers. The ipv6_skip_exthdr can
return value -1. This means that the skipping process failed
and there is something wrong with the packet so it will be dropped.

Fixes: a3fd9d8876a5 ("i40e/i40evf: Handle IPv6 extension headers in checksum offload")
Signed-off-by: Slawomir Laba <slawomirx.laba@intel.com>
Signed-off-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index b5042d1a63c0b..9ccbcd88bf1e6 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -3070,13 +3070,16 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,
 
 			l4_proto = ip.v4->protocol;
 		} else if (*tx_flags & I40E_TX_FLAGS_IPV6) {
+			int ret;
+
 			tunnel |= I40E_TX_CTX_EXT_IP_IPV6;
 
 			exthdr = ip.hdr + sizeof(*ip.v6);
 			l4_proto = ip.v6->nexthdr;
-			if (l4.hdr != exthdr)
-				ipv6_skip_exthdr(skb, exthdr - skb->data,
-						 &l4_proto, &frag_off);
+			ret = ipv6_skip_exthdr(skb, exthdr - skb->data,
+					       &l4_proto, &frag_off);
+			if (ret < 0)
+				return -1;
 		}
 
 		/* define outer transport */
-- 
2.27.0




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

* [PATCH 4.19 163/247] i40e: Add zero-initialization of AQ command structures
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (161 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 162/247] i40e: Fix flow for IPv6 next header (extension header) Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 164/247] i40e: Fix overwriting flow control settings during driver loading Greg Kroah-Hartman
                   ` (86 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andrzej Sawuła,
	Mateusz Palczewski, Arkadiusz Kubalewski, Aleksandr Loktionov,
	Tony Brelinski, Tony Nguyen, Sasha Levin

From: Mateusz Palczewski <mateusz.palczewski@intel.com>

[ Upstream commit d2c788f739b6f68090e968a2ee31b543701e795f ]

Zero-initialize AQ command data structures to comply with
API specifications.

Fixes: 2f4b411a3d67 ("i40e: Enable cloud filters via tc-flower")
Fixes: f4492db16df8 ("i40e: Add NPAR BW get and set functions")
Signed-off-by: Andrzej Sawuła <andrzej.sawula@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index a728b6a7872cb..2518e2d6484c0 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -7007,6 +7007,8 @@ int i40e_add_del_cloud_filter(struct i40e_vsi *vsi,
 	if (filter->flags >= ARRAY_SIZE(flag_table))
 		return I40E_ERR_CONFIG;
 
+	memset(&cld_filter, 0, sizeof(cld_filter));
+
 	/* copy element needed to add cloud filter from filter */
 	i40e_set_cld_element(filter, &cld_filter);
 
@@ -7074,6 +7076,8 @@ int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi,
 	    !ipv6_addr_any(&filter->ip.v6.src_ip6))
 		return -EOPNOTSUPP;
 
+	memset(&cld_filter, 0, sizeof(cld_filter));
+
 	/* copy element needed to add cloud filter from filter */
 	i40e_set_cld_element(filter, &cld_filter.element);
 
@@ -11107,6 +11111,8 @@ i40e_status i40e_set_partition_bw_setting(struct i40e_pf *pf)
 	struct i40e_aqc_configure_partition_bw_data bw_data;
 	i40e_status status;
 
+	memset(&bw_data, 0, sizeof(bw_data));
+
 	/* Set the valid bit for this PF */
 	bw_data.pf_valid_bits = cpu_to_le16(BIT(pf->hw.pf_id));
 	bw_data.max_bw[pf->hw.pf_id] = pf->max_bw & I40E_ALT_BW_VALUE_MASK;
-- 
2.27.0




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

* [PATCH 4.19 164/247] i40e: Fix overwriting flow control settings during driver loading
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (162 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 163/247] i40e: Add zero-initialization of AQ command structures Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 165/247] i40e: Fix VFs not created Greg Kroah-Hartman
                   ` (85 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dawid Lukwinski, Mateusz Palczewski,
	Aleksandr Loktionov, Tony Brelinski, Tony Nguyen, Sasha Levin

From: Mateusz Palczewski <mateusz.palczewski@intel.com>

[ Upstream commit 4cdb9f80dcd46aab3c0020b4a6920c22735c5d6e ]

During driver loading flow control settings were written to FW
using a variable which was always zero, since it was being set
only by ethtool. This behavior has been corrected and driver
no longer overwrites the default FW/NVM settings.

Fixes: 373149fc99a0 ("i40e: Decrease the scope of rtnl lock")
Signed-off-by: Dawid Lukwinski <dawid.lukwinski@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 27 ---------------------
 1 file changed, 27 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 2518e2d6484c0..7a9d8bf2e1d5f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -9403,7 +9403,6 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)
 {
 	struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
 	struct i40e_hw *hw = &pf->hw;
-	u8 set_fc_aq_fail = 0;
 	i40e_status ret;
 	u32 val;
 	int v;
@@ -9484,13 +9483,6 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)
 			 i40e_stat_str(&pf->hw, ret),
 			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));
 
-	/* make sure our flow control settings are restored */
-	ret = i40e_set_fc(&pf->hw, &set_fc_aq_fail, true);
-	if (ret)
-		dev_dbg(&pf->pdev->dev, "setting flow control: ret = %s last_status = %s\n",
-			i40e_stat_str(&pf->hw, ret),
-			i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));
-
 	/* Rebuild the VSIs and VEBs that existed before reset.
 	 * They are still in our local switch element arrays, so only
 	 * need to rebuild the switch model in the HW.
@@ -13629,7 +13621,6 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	int err;
 	u32 val;
 	u32 i;
-	u8 set_fc_aq_fail;
 
 	err = pci_enable_device_mem(pdev);
 	if (err)
@@ -13909,24 +13900,6 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	}
 	INIT_LIST_HEAD(&pf->vsi[pf->lan_vsi]->ch_list);
 
-	/* Make sure flow control is set according to current settings */
-	err = i40e_set_fc(hw, &set_fc_aq_fail, true);
-	if (set_fc_aq_fail & I40E_SET_FC_AQ_FAIL_GET)
-		dev_dbg(&pf->pdev->dev,
-			"Set fc with err %s aq_err %s on get_phy_cap\n",
-			i40e_stat_str(hw, err),
-			i40e_aq_str(hw, hw->aq.asq_last_status));
-	if (set_fc_aq_fail & I40E_SET_FC_AQ_FAIL_SET)
-		dev_dbg(&pf->pdev->dev,
-			"Set fc with err %s aq_err %s on set_phy_config\n",
-			i40e_stat_str(hw, err),
-			i40e_aq_str(hw, hw->aq.asq_last_status));
-	if (set_fc_aq_fail & I40E_SET_FC_AQ_FAIL_UPDATE)
-		dev_dbg(&pf->pdev->dev,
-			"Set fc with err %s aq_err %s on get_link_info\n",
-			i40e_stat_str(hw, err),
-			i40e_aq_str(hw, hw->aq.asq_last_status));
-
 	/* if FDIR VSI was set up, start it now */
 	for (i = 0; i < pf->num_alloc_vsi; i++) {
 		if (pf->vsi[i] && pf->vsi[i]->type == I40E_VSI_FDIR) {
-- 
2.27.0




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

* [PATCH 4.19 165/247] i40e: Fix VFs not created
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (163 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 164/247] i40e: Fix overwriting flow control settings during driver loading Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 166/247] Take mmap lock in cacheflush syscall Greg Kroah-Hartman
                   ` (84 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sylwester Dziedziuch,
	Konrad Jankowski, Tony Nguyen, Sasha Levin

From: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>

[ Upstream commit dc8812626440fa6a27f1f3f654f6dc435e042e42 ]

When creating VFs they were sometimes not getting resources.
It was caused by not executing i40e_reset_all_vfs due to
flag __I40E_VF_DISABLE being set on PF. Because of this
IAVF was never able to finish setup sequence never
getting reset indication from PF.
Changed test_and_set_bit __I40E_VF_DISABLE in
i40e_sync_filters_subtask to test_bit and removed clear_bit.
This function should not set this bit it should only check
if it hasn't been already set.

Fixes: a7542b876075 ("i40e: check __I40E_VF_DISABLE bit in i40e_sync_filters_subtask")
Signed-off-by: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 7a9d8bf2e1d5f..eba6f7b118a9b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -2577,7 +2577,7 @@ static void i40e_sync_filters_subtask(struct i40e_pf *pf)
 		return;
 	if (!test_and_clear_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state))
 		return;
-	if (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) {
+	if (test_bit(__I40E_VF_DISABLE, pf->state)) {
 		set_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state);
 		return;
 	}
@@ -2595,7 +2595,6 @@ static void i40e_sync_filters_subtask(struct i40e_pf *pf)
 			}
 		}
 	}
-	clear_bit(__I40E_VF_DISABLE, pf->state);
 }
 
 /**
-- 
2.27.0




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

* [PATCH 4.19 166/247] Take mmap lock in cacheflush syscall
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (164 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 165/247] i40e: Fix VFs not created Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 167/247] i40e: Fix add TC filter for IPv6 Greg Kroah-Hartman
                   ` (83 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jann Horn, Ley Foon Tan, Sasha Levin

From: Jann Horn <jannh@google.com>

[ Upstream commit c26958cb5a0d9053d1358258827638773f3d36ed ]

We need to take the mmap lock around find_vma() and subsequent use of the
VMA. Otherwise, we can race with concurrent operations like munmap(), which
can lead to use-after-free accesses to freed VMAs.

Fixes: 1000197d8013 ("nios2: System calls handling")
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/nios2/kernel/sys_nios2.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/nios2/kernel/sys_nios2.c b/arch/nios2/kernel/sys_nios2.c
index cd390ec4f88bf..b1ca856999521 100644
--- a/arch/nios2/kernel/sys_nios2.c
+++ b/arch/nios2/kernel/sys_nios2.c
@@ -22,6 +22,7 @@ asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len,
 				unsigned int op)
 {
 	struct vm_area_struct *vma;
+	struct mm_struct *mm = current->mm;
 
 	if (len == 0)
 		return 0;
@@ -34,16 +35,22 @@ asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len,
 	if (addr + len < addr)
 		return -EFAULT;
 
+	if (mmap_read_lock_killable(mm))
+		return -EINTR;
+
 	/*
 	 * Verify that the specified address region actually belongs
 	 * to this process.
 	 */
-	vma = find_vma(current->mm, addr);
-	if (vma == NULL || addr < vma->vm_start || addr + len > vma->vm_end)
+	vma = find_vma(mm, addr);
+	if (vma == NULL || addr < vma->vm_start || addr + len > vma->vm_end) {
+		mmap_read_unlock(mm);
 		return -EFAULT;
+	}
 
 	flush_cache_range(vma, addr, addr + len);
 
+	mmap_read_unlock(mm);
 	return 0;
 }
 
-- 
2.27.0




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

* [PATCH 4.19 167/247] i40e: Fix add TC filter for IPv6
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (165 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 166/247] Take mmap lock in cacheflush syscall Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 168/247] net/mlx4_core: Add missed mlx4_free_cmd_mailbox() Greg Kroah-Hartman
                   ` (82 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Grzegorz Szczurek,
	Mateusz Palczewski, Jaroslaw Gawin, Tony Brelinski, Tony Nguyen,
	Sasha Levin

From: Mateusz Palczewski <mateusz.palczewski@intel.com>

[ Upstream commit 61c1e0eb8375def7c891bfe857bb795a57090526 ]

Fix insufficient distinction between IPv4 and IPv6 addresses
when creating a filter.
IPv4 and IPv6 are kept in the same memory area. If IPv6 is added,
then it's caught by IPv4 check, which leads to err -95.

Fixes: 2f4b411a3d67 ("i40e: Enable cloud filters via tc-flower")
Signed-off-by: Grzegorz Szczurek <grzegorzx.szczurek@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Reviewed-by: Jaroslaw Gawin <jaroslawx.gawin@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index eba6f7b118a9b..fe9da568ee196 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -7071,7 +7071,8 @@ int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi,
 		return -EOPNOTSUPP;
 
 	/* adding filter using src_port/src_ip is not supported at this stage */
-	if (filter->src_port || filter->src_ipv4 ||
+	if (filter->src_port ||
+	    (filter->src_ipv4 && filter->n_proto != ETH_P_IPV6) ||
 	    !ipv6_addr_any(&filter->ip.v6.src_ip6))
 		return -EOPNOTSUPP;
 
@@ -7100,7 +7101,7 @@ int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi,
 			cpu_to_le16(I40E_AQC_ADD_CLOUD_FILTER_MAC_VLAN_PORT);
 		}
 
-	} else if (filter->dst_ipv4 ||
+	} else if ((filter->dst_ipv4 && filter->n_proto != ETH_P_IPV6) ||
 		   !ipv6_addr_any(&filter->ip.v6.dst_ip6)) {
 		cld_filter.element.flags =
 				cpu_to_le16(I40E_AQC_ADD_CLOUD_FILTER_IP_PORT);
-- 
2.27.0




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

* [PATCH 4.19 168/247] net/mlx4_core: Add missed mlx4_free_cmd_mailbox()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (166 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 167/247] i40e: Fix add TC filter for IPv6 Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 169/247] vxlan: move debug check after netdev unregister Greg Kroah-Hartman
                   ` (81 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Chuhong Yuan, Tariq Toukan,
	Jakub Kicinski, Sasha Levin

From: Chuhong Yuan <hslester96@gmail.com>

[ Upstream commit 8eb65fda4a6dbd59cd5de24b106a10b6ee0d2176 ]

mlx4_do_mirror_rule() forgets to call mlx4_free_cmd_mailbox() to
free the memory region allocated by mlx4_alloc_cmd_mailbox() before
an exit.
Add the missed call to fix it.

Fixes: 78efed275117 ("net/mlx4_core: Support mirroring VF DMFS rules on both ports")
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://lore.kernel.org/r/20210221143559.390277-1-hslester96@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index a4c1ed65f620c..550e4893253ee 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -4990,6 +4990,7 @@ static int mlx4_do_mirror_rule(struct mlx4_dev *dev, struct res_fs_rule *fs_rule
 
 	if (!fs_rule->mirr_mbox) {
 		mlx4_err(dev, "rule mirroring mailbox is null\n");
+		mlx4_free_cmd_mailbox(dev, mailbox);
 		return -EINVAL;
 	}
 	memcpy(mailbox->buf, fs_rule->mirr_mbox, fs_rule->mirr_mbox_size);
-- 
2.27.0




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

* [PATCH 4.19 169/247] vxlan: move debug check after netdev unregister
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (167 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 168/247] net/mlx4_core: Add missed mlx4_free_cmd_mailbox() Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 170/247] ocfs2: fix a use after free on error Greg Kroah-Hartman
                   ` (80 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Taehee Yoo, Jakub Kicinski, Sasha Levin

From: Taehee Yoo <ap420073@gmail.com>

[ Upstream commit 92584ddf550ae72d492858c19d1f9025e07a9350 ]

The debug check must be done after unregister_netdevice_many() call --
the hlist_del_rcu() for this is done inside .ndo_stop.

This is the same with commit 0fda7600c2e1 ("geneve: move debug check after
netdev unregister")

Test commands:
    ip netns del A
    ip netns add A
    ip netns add B

    ip netns exec B ip link add vxlan0 type vxlan vni 100 local 10.0.0.1 \
	    remote 10.0.0.2 dstport 4789 srcport 4789 4789
    ip netns exec B ip link set vxlan0 netns A
    ip netns exec A ip link set vxlan0 up
    ip netns del B

Splat looks like:
[   73.176249][    T7] ------------[ cut here ]------------
[   73.178662][    T7] WARNING: CPU: 4 PID: 7 at drivers/net/vxlan.c:4743 vxlan_exit_batch_net+0x52e/0x720 [vxlan]
[   73.182597][    T7] Modules linked in: vxlan openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 mlx5_core nfp mlxfw ixgbevf tls sch_fq_codel nf_tables nfnetlink ip_tables x_tables unix
[   73.190113][    T7] CPU: 4 PID: 7 Comm: kworker/u16:0 Not tainted 5.11.0-rc7+ #838
[   73.193037][    T7] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[   73.196986][    T7] Workqueue: netns cleanup_net
[   73.198946][    T7] RIP: 0010:vxlan_exit_batch_net+0x52e/0x720 [vxlan]
[   73.201509][    T7] Code: 00 01 00 00 0f 84 39 fd ff ff 48 89 ca 48 c1 ea 03 80 3c 1a 00 0f 85 a6 00 00 00 89 c2 48 83 c2 02 49 8b 14 d4 48 85 d2 74 ce <0f> 0b eb ca e8 b9 51 db dd 84 c0 0f 85 4a fe ff ff 48 c7 c2 80 bc
[   73.208813][    T7] RSP: 0018:ffff888100907c10 EFLAGS: 00010286
[   73.211027][    T7] RAX: 000000000000003c RBX: dffffc0000000000 RCX: ffff88800ec411f0
[   73.213702][    T7] RDX: ffff88800a278000 RSI: ffff88800fc78c70 RDI: ffff88800fc78070
[   73.216169][    T7] RBP: ffff88800b5cbdc0 R08: fffffbfff424de61 R09: fffffbfff424de61
[   73.218463][    T7] R10: ffffffffa126f307 R11: fffffbfff424de60 R12: ffff88800ec41000
[   73.220794][    T7] R13: ffff888100907d08 R14: ffff888100907c50 R15: ffff88800fc78c40
[   73.223337][    T7] FS:  0000000000000000(0000) GS:ffff888114800000(0000) knlGS:0000000000000000
[   73.225814][    T7] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   73.227616][    T7] CR2: 0000562b5cb4f4d0 CR3: 0000000105fbe001 CR4: 00000000003706e0
[   73.229700][    T7] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   73.231820][    T7] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[   73.233844][    T7] Call Trace:
[   73.234698][    T7]  ? vxlan_err_lookup+0x3c0/0x3c0 [vxlan]
[   73.235962][    T7]  ? ops_exit_list.isra.11+0x93/0x140
[   73.237134][    T7]  cleanup_net+0x45e/0x8a0
[ ... ]

Fixes: 57b61127ab7d ("vxlan: speedup vxlan tunnels dismantle")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Link: https://lore.kernel.org/r/20210221154552.11749-1-ap420073@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/vxlan.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 66fffbd64a33f..49e8c6d42cda4 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -3812,7 +3812,6 @@ static void vxlan_destroy_tunnels(struct net *net, struct list_head *head)
 	struct vxlan_net *vn = net_generic(net, vxlan_net_id);
 	struct vxlan_dev *vxlan, *next;
 	struct net_device *dev, *aux;
-	unsigned int h;
 
 	for_each_netdev_safe(net, dev, aux)
 		if (dev->rtnl_link_ops == &vxlan_link_ops)
@@ -3826,14 +3825,13 @@ static void vxlan_destroy_tunnels(struct net *net, struct list_head *head)
 			unregister_netdevice_queue(vxlan->dev, head);
 	}
 
-	for (h = 0; h < PORT_HASH_SIZE; ++h)
-		WARN_ON_ONCE(!hlist_empty(&vn->sock_list[h]));
 }
 
 static void __net_exit vxlan_exit_batch_net(struct list_head *net_list)
 {
 	struct net *net;
 	LIST_HEAD(list);
+	unsigned int h;
 
 	rtnl_lock();
 	list_for_each_entry(net, net_list, exit_list)
@@ -3841,6 +3839,13 @@ static void __net_exit vxlan_exit_batch_net(struct list_head *net_list)
 
 	unregister_netdevice_many(&list);
 	rtnl_unlock();
+
+	list_for_each_entry(net, net_list, exit_list) {
+		struct vxlan_net *vn = net_generic(net, vxlan_net_id);
+
+		for (h = 0; h < PORT_HASH_SIZE; ++h)
+			WARN_ON_ONCE(!hlist_empty(&vn->sock_list[h]));
+	}
 }
 
 static struct pernet_operations vxlan_net_ops = {
-- 
2.27.0




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

* [PATCH 4.19 170/247] ocfs2: fix a use after free on error
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (168 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 169/247] vxlan: move debug check after netdev unregister Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 171/247] mm/memory.c: fix potential pte_unmap_unlock pte error Greg Kroah-Hartman
                   ` (79 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Joseph Qi,
	Mark Fasheh, Joel Becker, Junxiao Bi, Changwei Ge, Gang He,
	Jun Piao, Andrew Morton, Linus Torvalds, Sasha Levin

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

[ Upstream commit c57d117f2b2f2a19b570c36f2819ef8d8210af20 ]

The error handling in this function frees "reg" but it is still on the
"o2hb_all_regions" list so it will lead to a use after freew.  Joseph Qi
points out that we need to clear the bit in the "o2hb_region_bitmap" as
well

Link: https://lkml.kernel.org/r/YBk4M6HUG8jB/jc7@mwanda
Fixes: 1cf257f51191 ("ocfs2: fix memory leak")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/ocfs2/cluster/heartbeat.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 9b2ed62dd6385..19b0d358a0d6e 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -2154,7 +2154,7 @@ static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *g
 			o2hb_nego_timeout_handler,
 			reg, NULL, &reg->hr_handler_list);
 	if (ret)
-		goto free;
+		goto remove_item;
 
 	ret = o2net_register_handler(O2HB_NEGO_APPROVE_MSG, reg->hr_key,
 			sizeof(struct o2hb_nego_msg),
@@ -2173,6 +2173,12 @@ static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *g
 
 unregister_handler:
 	o2net_unregister_handler_list(&reg->hr_handler_list);
+remove_item:
+	spin_lock(&o2hb_live_lock);
+	list_del(&reg->hr_all_item);
+	if (o2hb_global_heartbeat_active())
+		clear_bit(reg->hr_region_num, o2hb_region_bitmap);
+	spin_unlock(&o2hb_live_lock);
 free:
 	kfree(reg);
 	return ERR_PTR(ret);
-- 
2.27.0




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

* [PATCH 4.19 171/247] mm/memory.c: fix potential pte_unmap_unlock pte error
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (169 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 170/247] ocfs2: fix a use after free on error Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 172/247] mm/hugetlb: fix potential double free in hugetlb_register_node() error path Greg Kroah-Hartman
                   ` (78 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Hongxiang Lou, Miaohe Lin,
	Thomas Gleixner, Dave Hansen, Andi Kleen, Josh Poimboeuf,
	Andrew Morton, Linus Torvalds, Sasha Levin

From: Miaohe Lin <linmiaohe@huawei.com>

[ Upstream commit 90a3e375d324b2255b83e3dd29e99e2b05d82aaf ]

Since commit 42e4089c7890 ("x86/speculation/l1tf: Disallow non privileged
high MMIO PROT_NONE mappings"), when the first pfn modify is not allowed,
we would break the loop with pte unchanged.  Then the wrong pte - 1 would
be passed to pte_unmap_unlock.

Andi said:

 "While the fix is correct, I'm not sure if it actually is a real bug.
  Is there any architecture that would do something else than unlocking
  the underlying page? If it's just the underlying page then it should
  be always the same page, so no bug"

Link: https://lkml.kernel.org/r/20210109080118.20885-1-linmiaohe@huawei.com
Fixes: 42e4089c789 ("x86/speculation/l1tf: Disallow non privileged high MMIO PROT_NONE mappings")
Signed-off-by: Hongxiang Lou <louhongxiang@huawei.com>
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 mm/memory.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index eeae63bd95027..4bd37296df89b 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1995,11 +1995,11 @@ static int remap_pte_range(struct mm_struct *mm, pmd_t *pmd,
 			unsigned long addr, unsigned long end,
 			unsigned long pfn, pgprot_t prot)
 {
-	pte_t *pte;
+	pte_t *pte, *mapped_pte;
 	spinlock_t *ptl;
 	int err = 0;
 
-	pte = pte_alloc_map_lock(mm, pmd, addr, &ptl);
+	mapped_pte = pte = pte_alloc_map_lock(mm, pmd, addr, &ptl);
 	if (!pte)
 		return -ENOMEM;
 	arch_enter_lazy_mmu_mode();
@@ -2013,7 +2013,7 @@ static int remap_pte_range(struct mm_struct *mm, pmd_t *pmd,
 		pfn++;
 	} while (pte++, addr += PAGE_SIZE, addr != end);
 	arch_leave_lazy_mmu_mode();
-	pte_unmap_unlock(pte - 1, ptl);
+	pte_unmap_unlock(mapped_pte, ptl);
 	return err;
 }
 
-- 
2.27.0




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

* [PATCH 4.19 172/247] mm/hugetlb: fix potential double free in hugetlb_register_node() error path
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (170 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 171/247] mm/memory.c: fix potential pte_unmap_unlock pte error Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 173/247] r8169: fix jumbo packet handling on RTL8168e Greg Kroah-Hartman
                   ` (77 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Miaohe Lin, Mike Kravetz,
	Muchun Song, Andrew Morton, Linus Torvalds, Sasha Levin

From: Miaohe Lin <linmiaohe@huawei.com>

[ Upstream commit cc2205a67dec5a700227a693fc113441e73e4641 ]

In hugetlb_sysfs_add_hstate(), we would do kobject_put() on hstate_kobjs
when failed to create sysfs group but forget to set hstate_kobjs to NULL.
Then in hugetlb_register_node() error path, we may free it again via
hugetlb_unregister_node().

Link: https://lkml.kernel.org/r/20210107123249.36964-1-linmiaohe@huawei.com
Fixes: a3437870160c ("hugetlb: new sysfs interface")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Reviewed-by: Muchun Song <smuchun@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 mm/hugetlb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index df89aed023029..9eb5c25fabc9e 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2648,8 +2648,10 @@ static int hugetlb_sysfs_add_hstate(struct hstate *h, struct kobject *parent,
 		return -ENOMEM;
 
 	retval = sysfs_create_group(hstate_kobjs[hi], hstate_attr_group);
-	if (retval)
+	if (retval) {
 		kobject_put(hstate_kobjs[hi]);
+		hstate_kobjs[hi] = NULL;
+	}
 
 	return retval;
 }
-- 
2.27.0




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

* [PATCH 4.19 173/247] r8169: fix jumbo packet handling on RTL8168e
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (171 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 172/247] mm/hugetlb: fix potential double free in hugetlb_register_node() error path Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 174/247] arm64: Add missing ISB after invalidating TLB in __primary_switch Greg Kroah-Hartman
                   ` (76 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Josef Oškera, Heiner Kallweit,
	Jakub Kicinski, Sasha Levin

From: Heiner Kallweit <hkallweit1@gmail.com>

[ Upstream commit 6cf739131a15e4177e58a1b4f2bede9d5da78552 ]

Josef reported [0] that using jumbo packets fails on RTL8168e.
Aligning the values for register MaxTxPacketSize with the
vendor driver fixes the problem.

[0] https://bugzilla.kernel.org/show_bug.cgi?id=211827

Fixes: d58d46b5d851 ("r8169: jumbo fixes.")
Reported-by: Josef Oškera <joskera@redhat.com>
Tested-by: Josef Oškera <joskera@redhat.com>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/b15ddef7-0d50-4320-18f4-6a3f86fbfd3e@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/realtek/r8169.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 6b901bf1cd54d..6fd1a639ec533 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -4365,7 +4365,7 @@ static void r8168dp_hw_jumbo_disable(struct rtl8169_private *tp)
 
 static void r8168e_hw_jumbo_enable(struct rtl8169_private *tp)
 {
-	RTL_W8(tp, MaxTxPacketSize, 0x3f);
+	RTL_W8(tp, MaxTxPacketSize, 0x24);
 	RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
 	RTL_W8(tp, Config4, RTL_R8(tp, Config4) | 0x01);
 	rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_512B);
@@ -4373,7 +4373,7 @@ static void r8168e_hw_jumbo_enable(struct rtl8169_private *tp)
 
 static void r8168e_hw_jumbo_disable(struct rtl8169_private *tp)
 {
-	RTL_W8(tp, MaxTxPacketSize, 0x0c);
+	RTL_W8(tp, MaxTxPacketSize, 0x3f);
 	RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
 	RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~0x01);
 	rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
-- 
2.27.0




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

* [PATCH 4.19 174/247] arm64: Add missing ISB after invalidating TLB in __primary_switch
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (172 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 173/247] r8169: fix jumbo packet handling on RTL8168e Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 175/247] i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition Greg Kroah-Hartman
                   ` (75 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Will Deacon, Marc Zyngier,
	Mark Rutland, Sasha Levin

From: Marc Zyngier <maz@kernel.org>

[ Upstream commit 9d41053e8dc115c92b8002c3db5f545d7602498b ]

Although there has been a bit of back and forth on the subject, it
appears that invalidating TLBs requires an ISB instruction when FEAT_ETS
is not implemented by the CPU.

>From the bible:

  | In an implementation that does not implement FEAT_ETS, a TLB
  | maintenance instruction executed by a PE, PEx, can complete at any
  | time after it is issued, but is only guaranteed to be finished for a
  | PE, PEx, after the execution of DSB by the PEx followed by a Context
  | synchronization event

Add the missing ISB in __primary_switch, just in case.

Fixes: 3c5e9f238bc4 ("arm64: head.S: move KASLR processing out of __enable_mmu()")
Suggested-by: Will Deacon <will@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20210224093738.3629662-3-maz@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm64/kernel/head.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index d22ab8d9edc95..c85ea70b92936 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -867,6 +867,7 @@ __primary_switch:
 
 	tlbi	vmalle1				// Remove any stale TLB entries
 	dsb	nsh
+	isb
 
 	msr	sctlr_el1, x19			// re-enable the MMU
 	isb
-- 
2.27.0




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

* [PATCH 4.19 175/247] i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (173 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 174/247] arm64: Add missing ISB after invalidating TLB in __primary_switch Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 176/247] mm/rmap: fix potential pte_unmap on an not mapped pte Greg Kroah-Hartman
                   ` (74 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dave Stevenson, Maxime Ripard,
	Florian Fainelli, Wolfram Sang, Sasha Levin

From: Maxime Ripard <maxime@cerno.tech>

[ Upstream commit a1858ce0cfe31368b23ba55794e409fb57ced4a4 ]

The brcmstb_send_i2c_cmd currently has a condition that is (CMD_RD ||
CMD_WR) which always evaluates to true, while the obvious fix is to test
whether the cmd variable passed as parameter holds one of these two
values.

Fixes: dd1aa2524bc5 ("i2c: brcmstb: Add Broadcom settop SoC i2c controller driver")
Reported-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/i2c/busses/i2c-brcmstb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c
index 826d320499961..2086a96307bf9 100644
--- a/drivers/i2c/busses/i2c-brcmstb.c
+++ b/drivers/i2c/busses/i2c-brcmstb.c
@@ -318,7 +318,7 @@ static int brcmstb_send_i2c_cmd(struct brcmstb_i2c_dev *dev,
 		goto cmd_out;
 	}
 
-	if ((CMD_RD || CMD_WR) &&
+	if ((cmd == CMD_RD || cmd == CMD_WR) &&
 	    bsc_readl(dev, iic_enable) & BSC_IIC_EN_NOACK_MASK) {
 		rc = -EREMOTEIO;
 		dev_dbg(dev->device, "controller received NOACK intr for %s\n",
-- 
2.27.0




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

* [PATCH 4.19 176/247] mm/rmap: fix potential pte_unmap on an not mapped pte
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (174 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 175/247] i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 177/247] scsi: bnx2fc: Fix Kconfig warning & CNIC build errors Greg Kroah-Hartman
                   ` (73 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Hongxiang Lou, Miaohe Lin,
	Sedat Dilek, Kees Cook, Nathan Chancellor, Mike Kravetz,
	Shakeel Butt, Johannes Weiner, Vlastimil Babka,
	Michel Lespinasse, Nick Desaulniers, Kirill A. Shutemov,
	Wei Yang, Dmitry Safonov, Brian Geffon, Andrew Morton,
	Linus Torvalds, Sasha Levin

From: Miaohe Lin <linmiaohe@huawei.com>

[ Upstream commit 5d5d19eda6b0ee790af89c45e3f678345be6f50f ]

For PMD-mapped page (usually THP), pvmw->pte is NULL.  For PTE-mapped THP,
pvmw->pte is mapped.  But for HugeTLB pages, pvmw->pte is not mapped and
set to the relevant page table entry.  So in page_vma_mapped_walk_done(),
we may do pte_unmap() for HugeTLB pte which is not mapped.  Fix this by
checking pvmw->page against PageHuge before trying to do pte_unmap().

Link: https://lkml.kernel.org/r/20210127093349.39081-1-linmiaohe@huawei.com
Fixes: ace71a19cec5 ("mm: introduce page_vma_mapped_walk()")
Signed-off-by: Hongxiang Lou <louhongxiang@huawei.com>
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Nathan Chancellor <natechancellor@gmail.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Michel Lespinasse <walken@google.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Wei Yang <richard.weiyang@linux.alibaba.com>
Cc: Dmitry Safonov <0x7f454c46@gmail.com>
Cc: Brian Geffon <bgeffon@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/linux/rmap.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 988d176472df7..d7d6d4eb17949 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -214,7 +214,8 @@ struct page_vma_mapped_walk {
 
 static inline void page_vma_mapped_walk_done(struct page_vma_mapped_walk *pvmw)
 {
-	if (pvmw->pte)
+	/* HugeTLB pte is set to the relevant page table entry without pte_mapped. */
+	if (pvmw->pte && !PageHuge(pvmw->page))
 		pte_unmap(pvmw->pte);
 	if (pvmw->ptl)
 		spin_unlock(pvmw->ptl);
-- 
2.27.0




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

* [PATCH 4.19 177/247] scsi: bnx2fc: Fix Kconfig warning & CNIC build errors
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (175 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 176/247] mm/rmap: fix potential pte_unmap on an not mapped pte Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 178/247] blk-settings: align max_sectors on "logical_block_size" boundary Greg Kroah-Hartman
                   ` (72 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Saurav Kashyap, Javed Hasan,
	GR-QLogic-Storage-Upstream, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, kernel test robot, Randy Dunlap,
	Sasha Levin

From: Randy Dunlap <rdunlap@infradead.org>

[ Upstream commit eefb816acb0162e94a85a857f3a55148f671d5a5 ]

CNIC depends on MMU, but since 'select' does not follow any dependency
chains, SCSI_BNX2X_FCOE also needs to depend on MMU, so that erroneous
configs are not generated, which cause build errors in cnic.

WARNING: unmet direct dependencies detected for CNIC
  Depends on [n]: NETDEVICES [=y] && ETHERNET [=y] && NET_VENDOR_BROADCOM [=y] && PCI [=y] && (IPV6 [=n] || IPV6 [=n]=n) && MMU [=n]
  Selected by [y]:
  - SCSI_BNX2X_FCOE [=y] && SCSI_LOWLEVEL [=y] && SCSI [=y] && PCI [=y] && (IPV6 [=n] || IPV6 [=n]=n) && LIBFC [=y] && LIBFCOE [=y]

riscv64-linux-ld: drivers/net/ethernet/broadcom/cnic.o: in function `.L154':
cnic.c:(.text+0x1094): undefined reference to `uio_event_notify'
riscv64-linux-ld: cnic.c:(.text+0x10bc): undefined reference to `uio_event_notify'
riscv64-linux-ld: drivers/net/ethernet/broadcom/cnic.o: in function `.L1442':
cnic.c:(.text+0x96a8): undefined reference to `__uio_register_device'
riscv64-linux-ld: drivers/net/ethernet/broadcom/cnic.o: in function `.L0 ':
cnic.c:(.text.unlikely+0x68): undefined reference to `uio_unregister_device'

Link: https://lore.kernel.org/r/20210213192428.22537-1-rdunlap@infradead.org
Fixes: 853e2bd2103a ("[SCSI] bnx2fc: Broadcom FCoE offload driver")
Cc: Saurav Kashyap <skashyap@marvell.com>
Cc: Javed Hasan <jhasan@marvell.com>
Cc: GR-QLogic-Storage-Upstream@marvell.com
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/bnx2fc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/bnx2fc/Kconfig b/drivers/scsi/bnx2fc/Kconfig
index d401a096dfc7e..2eb2476852b11 100644
--- a/drivers/scsi/bnx2fc/Kconfig
+++ b/drivers/scsi/bnx2fc/Kconfig
@@ -4,6 +4,7 @@ config SCSI_BNX2X_FCOE
 	depends on (IPV6 || IPV6=n)
 	depends on LIBFC
 	depends on LIBFCOE
+	depends on MMU
 	select NETDEVICES
 	select ETHERNET
 	select NET_VENDOR_BROADCOM
-- 
2.27.0




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

* [PATCH 4.19 178/247] blk-settings: align max_sectors on "logical_block_size" boundary
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (176 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 177/247] scsi: bnx2fc: Fix Kconfig warning & CNIC build errors Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 179/247] ACPI: property: Fix fwnode string properties matching Greg Kroah-Hartman
                   ` (71 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ming Lei, Mikulas Patocka, Jens Axboe

From: Mikulas Patocka <mpatocka@redhat.com>

commit 97f433c3601a24d3513d06f575a389a2ca4e11e4 upstream.

We get I/O errors when we run md-raid1 on the top of dm-integrity on the
top of ramdisk.
device-mapper: integrity: Bio not aligned on 8 sectors: 0xff00, 0xff
device-mapper: integrity: Bio not aligned on 8 sectors: 0xff00, 0xff
device-mapper: integrity: Bio not aligned on 8 sectors: 0xffff, 0x1
device-mapper: integrity: Bio not aligned on 8 sectors: 0xffff, 0x1
device-mapper: integrity: Bio not aligned on 8 sectors: 0x8048, 0xff
device-mapper: integrity: Bio not aligned on 8 sectors: 0x8147, 0xff
device-mapper: integrity: Bio not aligned on 8 sectors: 0x8246, 0xff
device-mapper: integrity: Bio not aligned on 8 sectors: 0x8345, 0xbb

The ramdisk device has logical_block_size 512 and max_sectors 255. The
dm-integrity device uses logical_block_size 4096 and it doesn't affect the
"max_sectors" value - thus, it inherits 255 from the ramdisk. So, we have
a device with max_sectors not aligned on logical_block_size.

The md-raid device sees that the underlying leg has max_sectors 255 and it
will split the bios on 255-sector boundary, making the bios unaligned on
logical_block_size.

In order to fix the bug, we round down max_sectors to logical_block_size.

Cc: stable@vger.kernel.org
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 block/blk-settings.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -513,6 +513,14 @@ void blk_queue_io_opt(struct request_que
 }
 EXPORT_SYMBOL(blk_queue_io_opt);
 
+static unsigned int blk_round_down_sectors(unsigned int sectors, unsigned int lbs)
+{
+	sectors = round_down(sectors, lbs >> SECTOR_SHIFT);
+	if (sectors < PAGE_SIZE >> SECTOR_SHIFT)
+		sectors = PAGE_SIZE >> SECTOR_SHIFT;
+	return sectors;
+}
+
 /**
  * blk_queue_stack_limits - inherit underlying queue limits for stacked drivers
  * @t:	the stacking driver (top)
@@ -639,6 +647,10 @@ int blk_stack_limits(struct queue_limits
 		ret = -1;
 	}
 
+	t->max_sectors = blk_round_down_sectors(t->max_sectors, t->logical_block_size);
+	t->max_hw_sectors = blk_round_down_sectors(t->max_hw_sectors, t->logical_block_size);
+	t->max_dev_sectors = blk_round_down_sectors(t->max_dev_sectors, t->logical_block_size);
+
 	/* Discard alignment and granularity */
 	if (b->discard_granularity) {
 		alignment = queue_limit_discard_alignment(b, start);



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

* [PATCH 4.19 179/247] ACPI: property: Fix fwnode string properties matching
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (177 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 178/247] blk-settings: align max_sectors on "logical_block_size" boundary Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 180/247] ACPI: configfs: add missing check after configfs_register_default_group() Greg Kroah-Hartman
                   ` (70 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Calvin Johnson, Rafael J. Wysocki,
	Sakari Ailus, Mika Westerberg, Andy Shevchenko

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

commit e1e6bd2995ac0e1ad0c2a2d906a06f59ce2ed293 upstream.

Property matching does not work for ACPI fwnodes if the value of the
given property is not represented as a package in the _DSD package
containing it.  For example, the "compatible" property in the _DSD
below

  Name (_DSD, Package () {
    ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
    Package () {
      Package () {"compatible", "ethernet-phy-ieee802.3-c45"}
    }
  })

will not be found by fwnode_property_match_string(), because the ACPI
code handling device properties does not regard the single value as a
"list" in that case.

Namely, fwnode_property_match_string() invoked to match a given
string property value first calls fwnode_property_read_string_array()
with the last two arguments equal to NULL and 0, respectively, in
order to count the items in the value of the given property, with the
assumption that this value may be an array.  For ACPI fwnodes, that
operation is carried out by acpi_node_prop_read() which calls
acpi_data_prop_read() for this purpose.  However, when the return
(val) pointer is NULL, that function only looks for a property whose
value is a package without checking the single-value case at all.

To fix that, make acpi_data_prop_read() check the single-value
case if its return pointer argument is NULL and modify
acpi_data_prop_read_single() handling that case to attempt to
read the value of the property if the return pointer is NULL
and return 1 if that succeeds.

Fixes: 3708184afc77 ("device property: Move FW type specific functionality to FW specific files")
Reported-by: Calvin Johnson <calvin.johnson@oss.nxp.com>
Cc: 4.13+ <stable@vger.kernel.org> # 4.13+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/acpi/property.c |   44 +++++++++++++++++++++++++++++++++-----------
 1 file changed, 33 insertions(+), 11 deletions(-)

--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -720,9 +720,6 @@ static int acpi_data_prop_read_single(co
 	const union acpi_object *obj;
 	int ret;
 
-	if (!val)
-		return -EINVAL;
-
 	if (proptype >= DEV_PROP_U8 && proptype <= DEV_PROP_U64) {
 		ret = acpi_data_get_property(data, propname, ACPI_TYPE_INTEGER, &obj);
 		if (ret)
@@ -732,28 +729,43 @@ static int acpi_data_prop_read_single(co
 		case DEV_PROP_U8:
 			if (obj->integer.value > U8_MAX)
 				return -EOVERFLOW;
-			*(u8 *)val = obj->integer.value;
+
+			if (val)
+				*(u8 *)val = obj->integer.value;
+
 			break;
 		case DEV_PROP_U16:
 			if (obj->integer.value > U16_MAX)
 				return -EOVERFLOW;
-			*(u16 *)val = obj->integer.value;
+
+			if (val)
+				*(u16 *)val = obj->integer.value;
+
 			break;
 		case DEV_PROP_U32:
 			if (obj->integer.value > U32_MAX)
 				return -EOVERFLOW;
-			*(u32 *)val = obj->integer.value;
+
+			if (val)
+				*(u32 *)val = obj->integer.value;
+
 			break;
 		default:
-			*(u64 *)val = obj->integer.value;
+			if (val)
+				*(u64 *)val = obj->integer.value;
+
 			break;
 		}
+
+		if (!val)
+			return 1;
 	} else if (proptype == DEV_PROP_STRING) {
 		ret = acpi_data_get_property(data, propname, ACPI_TYPE_STRING, &obj);
 		if (ret)
 			return ret;
 
-		*(char **)val = obj->string.pointer;
+		if (val)
+			*(char **)val = obj->string.pointer;
 
 		return 1;
 	} else {
@@ -767,7 +779,7 @@ int acpi_dev_prop_read_single(struct acp
 {
 	int ret;
 
-	if (!adev)
+	if (!adev || !val)
 		return -EINVAL;
 
 	ret = acpi_data_prop_read_single(&adev->data, propname, proptype, val);
@@ -861,10 +873,20 @@ static int acpi_data_prop_read(const str
 	const union acpi_object *items;
 	int ret;
 
-	if (val && nval == 1) {
+	if (nval == 1 || !val) {
 		ret = acpi_data_prop_read_single(data, propname, proptype, val);
-		if (ret >= 0)
+		/*
+		 * The overflow error means that the property is there and it is
+		 * single-value, but its type does not match, so return.
+		 */
+		if (ret >= 0 || ret == -EOVERFLOW)
 			return ret;
+
+		/*
+		 * Reading this property as a single-value one failed, but its
+		 * value may still be represented as one-element array, so
+		 * continue.
+		 */
 	}
 
 	ret = acpi_data_get_property_array(data, propname, ACPI_TYPE_ANY, &obj);



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

* [PATCH 4.19 180/247] ACPI: configfs: add missing check after configfs_register_default_group()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (178 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 179/247] ACPI: property: Fix fwnode string properties matching Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 181/247] HID: wacom: Ignore attempts to overwrite the touch_max value from HID Greg Kroah-Hartman
                   ` (69 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Hulk Robot, Hanjun Guo,
	Qinglang Miao, Rafael J. Wysocki

From: Qinglang Miao <miaoqinglang@huawei.com>

commit 67e40054de86aae520ddc2a072d7f6951812a14f upstream.

A list_add corruption is reported by Hulk Robot like this:
==============
list_add corruption.
Call Trace:
link_obj+0xc0/0x1c0
link_group+0x21/0x140
configfs_register_subsystem+0xdb/0x380
acpi_configfs_init+0x25/0x1000 [acpi_configfs]
do_one_initcall+0x149/0x820
do_init_module+0x1ef/0x720
load_module+0x35c8/0x4380
__do_sys_finit_module+0x10d/0x1a0
do_syscall_64+0x34/0x80

It's because of the missing check after configfs_register_default_group,
where configfs_unregister_subsystem should be called once failure.

Fixes: 612bd01fc6e0 ("ACPI: add support for loading SSDTs via configfs")
Reported-by: Hulk Robot <hulkci@huawei.com>
Suggested-by: Hanjun Guo <guohanjun@huawei.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Cc: 4.10+ <stable@vger.kernel.org> # 4.10+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/acpi/acpi_configfs.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/drivers/acpi/acpi_configfs.c
+++ b/drivers/acpi/acpi_configfs.c
@@ -269,7 +269,12 @@ static int __init acpi_configfs_init(voi
 
 	acpi_table_group = configfs_register_default_group(root, "table",
 							   &acpi_tables_type);
-	return PTR_ERR_OR_ZERO(acpi_table_group);
+	if (IS_ERR(acpi_table_group)) {
+		configfs_unregister_subsystem(&acpi_configfs);
+		return PTR_ERR(acpi_table_group);
+	}
+
+	return 0;
 }
 module_init(acpi_configfs_init);
 



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

* [PATCH 4.19 181/247] HID: wacom: Ignore attempts to overwrite the touch_max value from HID
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (179 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 180/247] ACPI: configfs: add missing check after configfs_register_default_group() Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 182/247] Input: raydium_ts_i2c - do not send zero length Greg Kroah-Hartman
                   ` (68 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Jason Gerecke, Jiri Kosina

From: Jason Gerecke <killertofu@gmail.com>

commit 88f38846bfb1a452a3d47e38aeab20a4ceb74294 upstream.

The `wacom_feature_mapping` function is careful to only set the the
touch_max value a single time, but this care does not extend to the
`wacom_wac_finger_event` function. In particular, if a device sends
multiple HID_DG_CONTACTMAX items in a single feature report, the
driver will end up retaining the value of last item.

The HID descriptor for the Cintiq Companion 2 does exactly this. It
incorrectly sets a "Report Count" of 2, which will cause the driver
to process two HID_DG_CONTACTCOUNT items. The first item has the actual
count, while the second item should have been declared as a constant
zero. The constant zero is the value the driver ends up using, however,
since it is the last HID_DG_CONTACTCOUNT in the report.

    Report ID (16),
    Usage (Contact Count Maximum),  ; Contact count maximum (55h, static value)
    Report Count (2),
    Logical Maximum (10),
    Feature (Variable),

To address this, we add a check that the touch_max is not already set
within the `wacom_wac_finger_event` function that processes the
HID_DG_TOUCHMAX item. We emit a warning if the value is set and ignore
the updated value.

This could potentially cause problems if there is a tablet which has
a similar issue but requires the last item to be used. This is unlikely,
however, since it would have to have a different non-zero value for
HID_DG_CONTACTMAX earlier in the same report, which makes no sense
except in the case of a firmware bug. Note that cases where the
HID_DG_CONTACTMAX items are in different reports is already handled
(and similarly ignored) by `wacom_feature_mapping` as mentioned above.

Link: https://github.com/linuxwacom/input-wacom/issues/223
Fixes: 184eccd40389 ("HID: wacom: generic: read HID_DG_CONTACTMAX from any feature report")
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
CC: stable@vger.kernel.org
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hid/wacom_wac.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -2557,7 +2557,12 @@ static void wacom_wac_finger_event(struc
 		wacom_wac->hid_data.tipswitch = value;
 		break;
 	case HID_DG_CONTACTMAX:
-		features->touch_max = value;
+		if (!features->touch_max) {
+			features->touch_max = value;
+		} else {
+			hid_warn(hdev, "%s: ignoring attempt to overwrite non-zero touch_max "
+				 "%d -> %d\n", __func__, features->touch_max, value);
+		}
 		return;
 	}
 



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

* [PATCH 4.19 182/247] Input: raydium_ts_i2c - do not send zero length
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (180 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 181/247] HID: wacom: Ignore attempts to overwrite the touch_max value from HID Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 183/247] Input: xpad - add support for PowerA Enhanced Wired Controller for Xbox Series X|S Greg Kroah-Hartman
                   ` (67 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, jeffrey.lin, Dmitry Torokhov

From: jeffrey.lin <jeffrey.lin@rad-ic.com>

commit fafd320ae51b9c72d371585b2501f86640ea7b7d upstream.

Add default write command package to prevent i2c quirk error of zero
data length as Raydium touch firmware update is executed.

Signed-off-by: jeffrey.lin <jeffrey.lin@rad-ic.com>
Link: https://lore.kernel.org/r/1608031217-7247-1-git-send-email-jeffrey.lin@raydium.corp-partner.google.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/input/touchscreen/raydium_i2c_ts.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/input/touchscreen/raydium_i2c_ts.c
+++ b/drivers/input/touchscreen/raydium_i2c_ts.c
@@ -419,6 +419,7 @@ static int raydium_i2c_write_object(stru
 				    enum raydium_bl_ack state)
 {
 	int error;
+	static const u8 cmd[] = { 0xFF, 0x39 };
 
 	error = raydium_i2c_send(client, RM_CMD_BOOT_WRT, data, len);
 	if (error) {
@@ -427,7 +428,7 @@ static int raydium_i2c_write_object(stru
 		return error;
 	}
 
-	error = raydium_i2c_send(client, RM_CMD_BOOT_ACK, NULL, 0);
+	error = raydium_i2c_send(client, RM_CMD_BOOT_ACK, cmd, sizeof(cmd));
 	if (error) {
 		dev_err(&client->dev, "Ack obj command failed: %d\n", error);
 		return error;



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

* [PATCH 4.19 183/247] Input: xpad - add support for PowerA Enhanced Wired Controller for Xbox Series X|S
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (181 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 182/247] Input: raydium_ts_i2c - do not send zero length Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 184/247] Input: joydev - prevent potential read overflow in ioctl Greg Kroah-Hartman
                   ` (66 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Olivier Crête, Dmitry Torokhov

From: Olivier Crête <olivier.crete@ocrete.ca>

commit 42ffcd1dba1796bcda386eb6f260df9fc23c90af upstream.

Signed-off-by: Olivier Crête <olivier.crete@ocrete.ca>
Link: https://lore.kernel.org/r/20210204005318.615647-1-olivier.crete@collabora.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/input/joystick/xpad.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -319,6 +319,7 @@ static const struct xpad_device {
 	{ 0x1bad, 0xfd00, "Razer Onza TE", 0, XTYPE_XBOX360 },
 	{ 0x1bad, 0xfd01, "Razer Onza", 0, XTYPE_XBOX360 },
 	{ 0x20d6, 0x2001, "BDA Xbox Series X Wired Controller", 0, XTYPE_XBOXONE },
+	{ 0x20d6, 0x2009, "PowerA Enhanced Wired Controller for Xbox Series X|S", 0, XTYPE_XBOXONE },
 	{ 0x20d6, 0x281f, "PowerA Wired Controller For Xbox 360", 0, XTYPE_XBOX360 },
 	{ 0x2e24, 0x0652, "Hyperkin Duke X-Box One pad", 0, XTYPE_XBOXONE },
 	{ 0x24c6, 0x5000, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },



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

* [PATCH 4.19 184/247] Input: joydev - prevent potential read overflow in ioctl
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (182 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 183/247] Input: xpad - add support for PowerA Enhanced Wired Controller for Xbox Series X|S Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 185/247] Input: i8042 - add ASUS Zenbook Flip to noselftest list Greg Kroah-Hartman
                   ` (65 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Dmitry Torokhov

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

commit 182d679b2298d62bf42bb14b12a8067b8e17b617 upstream.

The problem here is that "len" might be less than "joydev->nabs" so the
loops which verfy abspam[i] and keypam[] might read beyond the buffer.

Fixes: 999b874f4aa3 ("Input: joydev - validate axis/button maps before clobbering current ones")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YCyzR8WvFRw4HWw6@mwanda
[dtor: additional check for len being even in joydev_handle_JSIOCSBTNMAP]
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/input/joydev.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -460,7 +460,7 @@ static int joydev_handle_JSIOCSAXMAP(str
 	if (IS_ERR(abspam))
 		return PTR_ERR(abspam);
 
-	for (i = 0; i < joydev->nabs; i++) {
+	for (i = 0; i < len && i < joydev->nabs; i++) {
 		if (abspam[i] > ABS_MAX) {
 			retval = -EINVAL;
 			goto out;
@@ -484,6 +484,9 @@ static int joydev_handle_JSIOCSBTNMAP(st
 	int i;
 	int retval = 0;
 
+	if (len % sizeof(*keypam))
+		return -EINVAL;
+
 	len = min(len, sizeof(joydev->keypam));
 
 	/* Validate the map. */
@@ -491,7 +494,7 @@ static int joydev_handle_JSIOCSBTNMAP(st
 	if (IS_ERR(keypam))
 		return PTR_ERR(keypam);
 
-	for (i = 0; i < joydev->nkey; i++) {
+	for (i = 0; i < (len / 2) && i < joydev->nkey; i++) {
 		if (keypam[i] > KEY_MAX || keypam[i] < BTN_MISC) {
 			retval = -EINVAL;
 			goto out;



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

* [PATCH 4.19 185/247] Input: i8042 - add ASUS Zenbook Flip to noselftest list
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (183 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 184/247] Input: joydev - prevent potential read overflow in ioctl Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 186/247] USB: serial: option: update interface mapping for ZTE P685M Greg Kroah-Hartman
                   ` (64 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ludvig Norgren Guldhag,
	Marcos Paulo de Souza, Dmitry Torokhov

From: Marcos Paulo de Souza <mpdesouza@suse.com>

commit b5d6e7ab7fe7d186878142e9fc1a05e4c3b65eb9 upstream.

After commit 77b425399f6d ("Input: i8042 - use chassis info to skip
selftest on Asus laptops"), all modern Asus laptops have the i8042
selftest disabled. It has done by using chassys type "10" (laptop).

The Asus Zenbook Flip suffers from similar suspend/resume issues, but
it _sometimes_ work and sometimes it doesn't. Setting noselftest makes
it work reliably. In this case, we need to add chassis type "31"
(convertible) in order to avoid selftest in this device.

Reported-by: Ludvig Norgren Guldhag <ludvigng@gmail.com>
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Link: https://lore.kernel.org/r/20210219164638.761-1-mpdesouza@suse.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/input/serio/i8042-x86ia64io.h |    4 ++++
 1 file changed, 4 insertions(+)

--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -592,6 +592,10 @@ static const struct dmi_system_id i8042_
 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
 			DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
 		},
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_CHASSIS_TYPE, "31"), /* Convertible Notebook */
+		},
 	},
 	{ }
 };



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

* [PATCH 4.19 186/247] USB: serial: option: update interface mapping for ZTE P685M
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (184 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 185/247] Input: i8042 - add ASUS Zenbook Flip to noselftest list Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 187/247] usb: musb: Fix runtime PM race in musb_queue_resume_work Greg Kroah-Hartman
                   ` (63 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Johan Hovold, Bjørn Mork, Lech Perczak

From: Lech Perczak <lech.perczak@gmail.com>

commit 6420a569504e212d618d4a4736e2c59ed80a8478 upstream.

This patch prepares for qmi_wwan driver support for the device.
Previously "option" driver mapped itself to interfaces 0 and 3 (matching
ff/ff/ff), while interface 3 is in fact a QMI port.
Interfaces 1 and 2 (matching ff/00/00) expose AT commands,
and weren't supported previously at all.
Without this patch, a possible conflict would exist if device ID was
added to qmi_wwan driver for interface 3.

Update and simplify device ID to match interfaces 0-2 directly,
to expose QCDM (0), PCUI (1), and modem (2) ports and avoid conflict
with QMI (3), and ADB (4).

The modem is used inside ZTE MF283+ router and carriers identify it as
such.
Interface mapping is:
0: QCDM, 1: AT (PCUI), 2: AT (Modem), 3: QMI, 4: ADB

T:  Bus=02 Lev=02 Prnt=02 Port=05 Cnt=01 Dev#=  3 Spd=480  MxCh= 0
D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=19d2 ProdID=1275 Rev=f0.00
S:  Manufacturer=ZTE,Incorporated
S:  Product=ZTE Technologies MSM
S:  SerialNumber=P685M510ZTED0000CP&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&0
C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
E:  Ad=87(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

Cc: Johan Hovold <johan@kernel.org>
Cc: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
Link: https://lore.kernel.org/r/20210207005443.12936-1-lech.perczak@gmail.com
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/serial/option.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -1569,7 +1569,8 @@ static const struct usb_device_id option
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1272, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1273, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1274, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1275, 0xff, 0xff, 0xff) },
+	{ USB_DEVICE(ZTE_VENDOR_ID, 0x1275),	/* ZTE P685M */
+	  .driver_info = RSVD(3) | RSVD(4) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1276, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1277, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1278, 0xff, 0xff, 0xff) },



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

* [PATCH 4.19 187/247] usb: musb: Fix runtime PM race in musb_queue_resume_work
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (185 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 186/247] USB: serial: option: update interface mapping for ZTE P685M Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 188/247] usb: dwc3: gadget: Fix setting of DEPCFG.bInterval_m1 Greg Kroah-Hartman
                   ` (62 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Tony Lindgren, Paul Cercueil

From: Paul Cercueil <paul@crapouillou.net>

commit 0eaa1a3714db34a59ce121de5733c3909c529463 upstream.

musb_queue_resume_work() would call the provided callback if the runtime
PM status was 'active'. Otherwise, it would enqueue the request if the
hardware was still suspended (musb->is_runtime_suspended is true).

This causes a race with the runtime PM handlers, as it is possible to be
in the case where the runtime PM status is not yet 'active', but the
hardware has been awaken (PM resume function has been called).

When hitting the race, the resume work was not enqueued, which probably
triggered other bugs further down the stack. For instance, a telnet
connection on Ingenic SoCs would result in a 50/50 chance of a
segmentation fault somewhere in the musb code.

Rework the code so that either we call the callback directly if
(musb->is_runtime_suspended == 0), or enqueue the query otherwise.

Fixes: ea2f35c01d5e ("usb: musb: Fix sleeping function called from invalid context for hdrc glue")
Cc: stable@vger.kernel.org # v4.9+
Tested-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20210123142502.16980-1-paul@crapouillou.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/musb/musb_core.c |   31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2108,32 +2108,35 @@ int musb_queue_resume_work(struct musb *
 {
 	struct musb_pending_work *w;
 	unsigned long flags;
+	bool is_suspended;
 	int error;
 
 	if (WARN_ON(!callback))
 		return -EINVAL;
 
-	if (pm_runtime_active(musb->controller))
-		return callback(musb, data);
+	spin_lock_irqsave(&musb->list_lock, flags);
+	is_suspended = musb->is_runtime_suspended;
 
-	w = devm_kzalloc(musb->controller, sizeof(*w), GFP_ATOMIC);
-	if (!w)
-		return -ENOMEM;
+	if (is_suspended) {
+		w = devm_kzalloc(musb->controller, sizeof(*w), GFP_ATOMIC);
+		if (!w) {
+			error = -ENOMEM;
+			goto out_unlock;
+		}
+
+		w->callback = callback;
+		w->data = data;
 
-	w->callback = callback;
-	w->data = data;
-	spin_lock_irqsave(&musb->list_lock, flags);
-	if (musb->is_runtime_suspended) {
 		list_add_tail(&w->node, &musb->pending_list);
 		error = 0;
-	} else {
-		dev_err(musb->controller, "could not add resume work %p\n",
-			callback);
-		devm_kfree(musb->controller, w);
-		error = -EINPROGRESS;
 	}
+
+out_unlock:
 	spin_unlock_irqrestore(&musb->list_lock, flags);
 
+	if (!is_suspended)
+		error = callback(musb, data);
+
 	return error;
 }
 EXPORT_SYMBOL_GPL(musb_queue_resume_work);



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

* [PATCH 4.19 188/247] usb: dwc3: gadget: Fix setting of DEPCFG.bInterval_m1
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (186 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 187/247] usb: musb: Fix runtime PM race in musb_queue_resume_work Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 189/247] usb: dwc3: gadget: Fix dep->interval for fullspeed interrupt Greg Kroah-Hartman
                   ` (61 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Thinh Nguyen

From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

commit a1679af85b2ae35a2b78ad04c18bb069c37330cc upstream.

Valid range for DEPCFG.bInterval_m1 is from 0 to 13, and it must be set
to 0 when the controller operates in full-speed. See the programming
guide for DEPCFG command section 3.2.2.1 (v3.30a).

Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/3f57026f993c0ce71498dbb06e49b3a47c4d0265.1612820995.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/dwc3/gadget.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -593,7 +593,17 @@ static int dwc3_gadget_set_ep_config(str
 		params.param0 |= DWC3_DEPCFG_FIFO_NUMBER(dep->number >> 1);
 
 	if (desc->bInterval) {
-		params.param1 |= DWC3_DEPCFG_BINTERVAL_M1(desc->bInterval - 1);
+		u8 bInterval_m1;
+
+		/*
+		 * Valid range for DEPCFG.bInterval_m1 is from 0 to 13, and it
+		 * must be set to 0 when the controller operates in full-speed.
+		 */
+		bInterval_m1 = min_t(u8, desc->bInterval - 1, 13);
+		if (dwc->gadget.speed == USB_SPEED_FULL)
+			bInterval_m1 = 0;
+
+		params.param1 |= DWC3_DEPCFG_BINTERVAL_M1(bInterval_m1);
 		dep->interval = 1 << (desc->bInterval - 1);
 	}
 



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

* [PATCH 4.19 189/247] usb: dwc3: gadget: Fix dep->interval for fullspeed interrupt
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (187 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 188/247] usb: dwc3: gadget: Fix setting of DEPCFG.bInterval_m1 Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 190/247] USB: serial: ftdi_sio: fix FTX sub-integer prescaler Greg Kroah-Hartman
                   ` (60 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Thinh Nguyen

From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

commit 4b049f55ed95cd889bcdb3034fd75e1f01852b38 upstream.

The dep->interval captures the number of frames/microframes per interval
from bInterval. Fullspeed interrupt endpoint bInterval is the number of
frames per interval and not 2^(bInterval - 1). So fix it here. This
change is only for debugging purpose and should not affect the interrupt
endpoint operation.

Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/1263b563dedc4ab8b0fb854fba06ce4bc56bd495.1612820995.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/dwc3/gadget.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -603,8 +603,13 @@ static int dwc3_gadget_set_ep_config(str
 		if (dwc->gadget.speed == USB_SPEED_FULL)
 			bInterval_m1 = 0;
 
+		if (usb_endpoint_type(desc) == USB_ENDPOINT_XFER_INT &&
+		    dwc->gadget.speed == USB_SPEED_FULL)
+			dep->interval = desc->bInterval;
+		else
+			dep->interval = 1 << (desc->bInterval - 1);
+
 		params.param1 |= DWC3_DEPCFG_BINTERVAL_M1(bInterval_m1);
-		dep->interval = 1 << (desc->bInterval - 1);
 	}
 
 	return dwc3_send_gadget_ep_cmd(dep, DWC3_DEPCMD_SETEPCONFIG, &params);



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

* [PATCH 4.19 190/247] USB: serial: ftdi_sio: fix FTX sub-integer prescaler
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (188 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 189/247] usb: dwc3: gadget: Fix dep->interval for fullspeed interrupt Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 191/247] USB: serial: mos7840: fix error code in mos7840_write() Greg Kroah-Hartman
                   ` (59 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Vladimir, Johan Hovold

From: Johan Hovold <johan@kernel.org>

commit 528222d0c8ce93e435a95cd1e476b60409dd5381 upstream.

The most-significant bit of the sub-integer-prescaler index is set in
the high byte of the baudrate request wIndex also for FTX devices.

This fixes rates like 1152000 which got mapped to 1.2 MBd.

Reported-by: Vladimir <svv75@mail.ru>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=210351
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/serial/ftdi_sio.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1370,8 +1370,9 @@ static int change_speed(struct tty_struc
 	index_value = get_ftdi_divisor(tty, port);
 	value = (u16)index_value;
 	index = (u16)(index_value >> 16);
-	if ((priv->chip_type == FT2232C) || (priv->chip_type == FT2232H) ||
-		(priv->chip_type == FT4232H) || (priv->chip_type == FT232H)) {
+	if (priv->chip_type == FT2232C || priv->chip_type == FT2232H ||
+			priv->chip_type == FT4232H || priv->chip_type == FT232H ||
+			priv->chip_type == FTX) {
 		/* Probably the BM type needs the MSB of the encoded fractional
 		 * divider also moved like for the chips above. Any infos? */
 		index = (u16)((index << 8) | priv->interface);



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

* [PATCH 4.19 191/247] USB: serial: mos7840: fix error code in mos7840_write()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (189 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 190/247] USB: serial: ftdi_sio: fix FTX sub-integer prescaler Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 192/247] USB: serial: mos7720: fix error code in mos7720_write() Greg Kroah-Hartman
                   ` (58 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Johan Hovold

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

commit a70aa7dc60099bbdcbd6faca42a915d80f31161e upstream.

This should return -ENOMEM instead of 0 if the kmalloc() fails.

Fixes: 3f5429746d91 ("USB: Moschip 7840 USB-Serial Driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/serial/mos7840.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -1340,8 +1340,10 @@ static int mos7840_write(struct tty_stru
 	if (urb->transfer_buffer == NULL) {
 		urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
 					       GFP_ATOMIC);
-		if (!urb->transfer_buffer)
+		if (!urb->transfer_buffer) {
+			bytes_sent = -ENOMEM;
 			goto exit;
+		}
 	}
 	transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE);
 



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

* [PATCH 4.19 192/247] USB: serial: mos7720: fix error code in mos7720_write()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (190 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 191/247] USB: serial: mos7840: fix error code in mos7840_write() Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 193/247] ALSA: hda/realtek: modify EAPD in the ALC886 Greg Kroah-Hartman
                   ` (57 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Johan Hovold

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

commit fea7372cbc40869876df0f045e367f6f97a1666c upstream.

This code should return -ENOMEM if the kmalloc() fails but instead
it returns success.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 0f64478cbc7a ("USB: add USB serial mos7720 driver")
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/serial/mos7720.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -1250,8 +1250,10 @@ static int mos7720_write(struct tty_stru
 	if (urb->transfer_buffer == NULL) {
 		urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
 					       GFP_ATOMIC);
-		if (!urb->transfer_buffer)
+		if (!urb->transfer_buffer) {
+			bytes_sent = -ENOMEM;
 			goto exit;
+		}
 	}
 	transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE);
 



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

* [PATCH 4.19 193/247] ALSA: hda/realtek: modify EAPD in the ALC886
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (191 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 192/247] USB: serial: mos7720: fix error code in mos7720_write() Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 194/247] tpm_tis: Fix check_locality for correct locality acquisition Greg Kroah-Hartman
                   ` (56 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, PeiSen Hou, Takashi Iwai

From: PeiSen Hou <pshou@realtek.com>

commit 4841b8e6318a7f0ae57c4e5ec09032ea057c97a8 upstream.

Modify 0x20 index 7 bit 5 to 1, make the 0x15 EAPD the same as 0x14.

Signed-off-by: PeiSen Hou <pshou@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/e62c5058957f48d8b8953e97135ff108@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/pci/hda/patch_realtek.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1880,6 +1880,7 @@ enum {
 	ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
 	ALC889_FIXUP_VAIO_TT,
 	ALC888_FIXUP_EEE1601,
+	ALC886_FIXUP_EAPD,
 	ALC882_FIXUP_EAPD,
 	ALC883_FIXUP_EAPD,
 	ALC883_FIXUP_ACER_EAPD,
@@ -2213,6 +2214,15 @@ static const struct hda_fixup alc882_fix
 			{ }
 		}
 	},
+	[ALC886_FIXUP_EAPD] = {
+		.type = HDA_FIXUP_VERBS,
+		.v.verbs = (const struct hda_verb[]) {
+			/* change to EAPD mode */
+			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
+			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
+			{ }
+		}
+	},
 	[ALC882_FIXUP_EAPD] = {
 		.type = HDA_FIXUP_VERBS,
 		.v.verbs = (const struct hda_verb[]) {
@@ -2485,6 +2495,7 @@ static const struct snd_pci_quirk alc882
 	SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
 
 	SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
+	SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
 	SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),



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

* [PATCH 4.19 194/247] tpm_tis: Fix check_locality for correct locality acquisition
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (192 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 193/247] ALSA: hda/realtek: modify EAPD in the ALC886 Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 195/247] tpm_tis: Clean up locality release Greg Kroah-Hartman
                   ` (55 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, stable, James Bottomley,
	Jerry Snitselaar, Jarkko Sakkinen

From: James Bottomley <James.Bottomley@HansenPartnership.com>

commit 3d9ae54af1d02a7c0edc55c77d7df2b921e58a87 upstream.

The TPM TIS specification says the TPM signals the acquisition of locality
when the TMP_ACCESS_REQUEST_USE bit goes to one *and* the
TPM_ACCESS_REQUEST_USE bit goes to zero.  Currently we only check the
former not the latter, so check both.  Adding the check on
TPM_ACCESS_REQUEST_USE should fix the case where the locality is
re-requested before the TPM has released it.  In this case the locality may
get released briefly before it is reacquired, which causes all sorts of
problems. However, with the added check, TPM_ACCESS_REQUEST_USE should
remain 1 until the second request for the locality is granted.

Cc: stable@ger.kernel.org
Fixes: 27084efee0c3 ("[PATCH] tpm: driver for next generation TPM chips")
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/char/tpm/tpm_tis_core.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -129,7 +129,8 @@ static bool check_locality(struct tpm_ch
 	if (rc < 0)
 		return false;
 
-	if ((access & (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) ==
+	if ((access & (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID
+		       | TPM_ACCESS_REQUEST_USE)) ==
 	    (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) {
 		priv->locality = l;
 		return true;



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

* [PATCH 4.19 195/247] tpm_tis: Clean up locality release
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (193 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 194/247] tpm_tis: Fix check_locality for correct locality acquisition Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 196/247] KEYS: trusted: Fix migratable=1 failing Greg Kroah-Hartman
                   ` (54 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, stable, James Bottomley,
	Jerry Snitselaar, Jarkko Sakkinen

From: James Bottomley <James.Bottomley@HansenPartnership.com>

commit e42acf104d6e0bd7ccd2f09103d5be5e6d3c637c upstream.

The current release locality code seems to be based on the
misunderstanding that the TPM interrupts when a locality is released:
it doesn't, only when the locality is acquired.

Furthermore, there seems to be no point in waiting for the locality to
be released.  All it does is penalize the last TPM user.  However, if
there's no next TPM user, this is a pointless wait and if there is a
next TPM user, they'll pay the penalty waiting for the new locality
(or possibly not if it's the same as the old locality).

Fix the code by making release_locality as simple write to release
with no waiting for completion.

Cc: stable@ger.kernel.org
Fixes: 33bafe90824b ("tpm_tis: verify locality released before returning from release_locality")
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/char/tpm/tpm_tis_core.c |   47 ----------------------------------------
 1 file changed, 1 insertion(+), 46 deletions(-)

--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -139,58 +139,13 @@ static bool check_locality(struct tpm_ch
 	return false;
 }
 
-static bool locality_inactive(struct tpm_chip *chip, int l)
-{
-	struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
-	int rc;
-	u8 access;
-
-	rc = tpm_tis_read8(priv, TPM_ACCESS(l), &access);
-	if (rc < 0)
-		return false;
-
-	if ((access & (TPM_ACCESS_VALID | TPM_ACCESS_ACTIVE_LOCALITY))
-	    == TPM_ACCESS_VALID)
-		return true;
-
-	return false;
-}
-
 static int release_locality(struct tpm_chip *chip, int l)
 {
 	struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
-	unsigned long stop, timeout;
-	long rc;
 
 	tpm_tis_write8(priv, TPM_ACCESS(l), TPM_ACCESS_ACTIVE_LOCALITY);
 
-	stop = jiffies + chip->timeout_a;
-
-	if (chip->flags & TPM_CHIP_FLAG_IRQ) {
-again:
-		timeout = stop - jiffies;
-		if ((long)timeout <= 0)
-			return -1;
-
-		rc = wait_event_interruptible_timeout(priv->int_queue,
-						      (locality_inactive(chip, l)),
-						      timeout);
-
-		if (rc > 0)
-			return 0;
-
-		if (rc == -ERESTARTSYS && freezing(current)) {
-			clear_thread_flag(TIF_SIGPENDING);
-			goto again;
-		}
-	} else {
-		do {
-			if (locality_inactive(chip, l))
-				return 0;
-			tpm_msleep(TPM_TIMEOUT);
-		} while (time_before(jiffies, stop));
-	}
-	return -1;
+	return 0;
 }
 
 static int request_locality(struct tpm_chip *chip, int l)



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

* [PATCH 4.19 196/247] KEYS: trusted: Fix migratable=1 failing
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (194 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 195/247] tpm_tis: Clean up locality release Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 197/247] btrfs: abort the transaction if we fail to inc ref in btrfs_copy_root Greg Kroah-Hartman
                   ` (53 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, James E.J. Bottomley, Mimi Zohar,
	David Howells, Jarkko Sakkinen

From: Jarkko Sakkinen <jarkko@kernel.org>

commit 8da7520c80468c48f981f0b81fc1be6599e3b0ad upstream.

Consider the following transcript:

$ keyctl add trusted kmk "new 32 blobauth=helloworld keyhandle=80000000 migratable=1" @u
add_key: Invalid argument

The documentation has the following description:

  migratable=   0|1 indicating permission to reseal to new PCR values,
                default 1 (resealing allowed)

The consequence is that "migratable=1" should succeed. Fix this by
allowing this condition to pass instead of return -EINVAL.

[*] Documentation/security/keys/trusted-encrypted.rst

Cc: stable@vger.kernel.org
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: Mimi Zohar <zohar@linux.ibm.com>
Cc: David Howells <dhowells@redhat.com>
Fixes: d00a1c72f7f4 ("keys: add new trusted key-type")
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 security/keys/trusted.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/security/keys/trusted.c
+++ b/security/keys/trusted.c
@@ -796,7 +796,7 @@ static int getoptions(char *c, struct tr
 		case Opt_migratable:
 			if (*args[0].from == '0')
 				pay->migratable = 0;
-			else
+			else if (*args[0].from != '1')
 				return -EINVAL;
 			break;
 		case Opt_pcrlock:



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

* [PATCH 4.19 197/247] btrfs: abort the transaction if we fail to inc ref in btrfs_copy_root
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (195 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 196/247] KEYS: trusted: Fix migratable=1 failing Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 198/247] btrfs: fix reloc root leak with 0 ref reloc roots on recovery Greg Kroah-Hartman
                   ` (52 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Josef Bacik, David Sterba

From: Josef Bacik <josef@toxicpanda.com>

commit 867ed321f90d06aaba84e2c91de51cd3038825ef upstream.

While testing my error handling patches, I added a error injection site
at btrfs_inc_extent_ref, to validate the error handling I added was
doing the correct thing.  However I hit a pretty ugly corruption while
doing this check, with the following error injection stack trace:

btrfs_inc_extent_ref
  btrfs_copy_root
    create_reloc_root
      btrfs_init_reloc_root
	btrfs_record_root_in_trans
	  btrfs_start_transaction
	    btrfs_update_inode
	      btrfs_update_time
		touch_atime
		  file_accessed
		    btrfs_file_mmap

This is because we do not catch the error from btrfs_inc_extent_ref,
which in practice would be ENOMEM, which means we lose the extent
references for a root that has already been allocated and inserted,
which is the problem.  Fix this by aborting the transaction if we fail
to do the reference modification.

CC: stable@vger.kernel.org # 4.4+
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/btrfs/ctree.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -267,9 +267,10 @@ int btrfs_copy_root(struct btrfs_trans_h
 		ret = btrfs_inc_ref(trans, root, cow, 1);
 	else
 		ret = btrfs_inc_ref(trans, root, cow, 0);
-
-	if (ret)
+	if (ret) {
+		btrfs_abort_transaction(trans, ret);
 		return ret;
+	}
 
 	btrfs_mark_buffer_dirty(cow);
 	*cow_ret = cow;



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

* [PATCH 4.19 198/247] btrfs: fix reloc root leak with 0 ref reloc roots on recovery
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (196 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 197/247] btrfs: abort the transaction if we fail to inc ref in btrfs_copy_root Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 199/247] btrfs: fix extent buffer leak on failure to copy root Greg Kroah-Hartman
                   ` (51 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Josef Bacik, David Sterba

From: Josef Bacik <josef@toxicpanda.com>

commit c78a10aebb275c38d0cfccae129a803fe622e305 upstream.

When recovering a relocation, if we run into a reloc root that has 0
refs we simply add it to the reloc_control->reloc_roots list, and then
clean it up later.  The problem with this is __del_reloc_root() doesn't
do anything if the root isn't in the radix tree, which in this case it
won't be because we never call __add_reloc_root() on the reloc_root.

This exit condition simply isn't correct really.  During normal
operation we can remove ourselves from the rb tree and then we're meant
to clean up later at merge_reloc_roots() time, and this happens
correctly.  During recovery we're depending on free_reloc_roots() to
drop our references, but we're short-circuiting.

Fix this by continuing to check if we're on the list and dropping
ourselves from the reloc_control root list and dropping our reference
appropriately.  Change the corresponding BUG_ON() to an ASSERT() that
does the correct thing if we aren't in the rb tree.

CC: stable@vger.kernel.org # 4.4+
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/btrfs/relocation.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1291,9 +1291,7 @@ static void __del_reloc_root(struct btrf
 			RB_CLEAR_NODE(&node->rb_node);
 		}
 		spin_unlock(&rc->reloc_root_tree.lock);
-		if (!node)
-			return;
-		BUG_ON((struct btrfs_root *)node->data != root);
+		ASSERT(!node || (struct btrfs_root *)node->data == root);
 	}
 
 	spin_lock(&fs_info->trans_lock);



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

* [PATCH 4.19 199/247] btrfs: fix extent buffer leak on failure to copy root
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (197 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 198/247] btrfs: fix reloc root leak with 0 ref reloc roots on recovery Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 200/247] crypto: arm64/sha - add missing module aliases Greg Kroah-Hartman
                   ` (50 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Filipe Manana, David Sterba

From: Filipe Manana <fdmanana@suse.com>

commit 72c9925f87c8b74f36f8e75a4cd93d964538d3ca upstream.

At btrfs_copy_root(), if the call to btrfs_inc_ref() fails we end up
returning without unlocking and releasing our reference on the extent
buffer named "cow" we previously allocated with btrfs_alloc_tree_block().

So fix that by unlocking the extent buffer and dropping our reference on
it before returning.

Fixes: be20aa9dbadc8c ("Btrfs: Add mount option to turn off data cow")
CC: stable@vger.kernel.org # 4.4+
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/btrfs/ctree.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -268,6 +268,8 @@ int btrfs_copy_root(struct btrfs_trans_h
 	else
 		ret = btrfs_inc_ref(trans, root, cow, 0);
 	if (ret) {
+		btrfs_tree_unlock(cow);
+		free_extent_buffer(cow);
 		btrfs_abort_transaction(trans, ret);
 		return ret;
 	}



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

* [PATCH 4.19 200/247] crypto: arm64/sha - add missing module aliases
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (198 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 199/247] btrfs: fix extent buffer leak on failure to copy root Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 201/247] crypto: sun4i-ss - checking sg length is not sufficient Greg Kroah-Hartman
                   ` (49 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ard Biesheuvel, Herbert Xu

From: Ard Biesheuvel <ardb@kernel.org>

commit 0df07d8117c3576f1603b05b84089742a118d10a upstream.

The accelerated, instruction based implementations of SHA1, SHA2 and
SHA3 are autoloaded based on CPU capabilities, given that the code is
modest in size, and widely used, which means that resolving the algo
name, loading all compatible modules and picking the one with the
highest priority is taken to be suboptimal.

However, if these algorithms are requested before this CPU feature
based matching and autoloading occurs, these modules are not even
considered, and we end up with suboptimal performance.

So add the missing module aliases for the various SHA implementations.

Cc: <stable@vger.kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arm64/crypto/sha1-ce-glue.c   |    1 +
 arch/arm64/crypto/sha2-ce-glue.c   |    2 ++
 arch/arm64/crypto/sha3-ce-glue.c   |    4 ++++
 arch/arm64/crypto/sha512-ce-glue.c |    2 ++
 4 files changed, 9 insertions(+)

--- a/arch/arm64/crypto/sha1-ce-glue.c
+++ b/arch/arm64/crypto/sha1-ce-glue.c
@@ -21,6 +21,7 @@
 MODULE_DESCRIPTION("SHA1 secure hash using ARMv8 Crypto Extensions");
 MODULE_AUTHOR("Ard Biesheuvel <ard.biesheuvel@linaro.org>");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS_CRYPTO("sha1");
 
 struct sha1_ce_state {
 	struct sha1_state	sst;
--- a/arch/arm64/crypto/sha2-ce-glue.c
+++ b/arch/arm64/crypto/sha2-ce-glue.c
@@ -21,6 +21,8 @@
 MODULE_DESCRIPTION("SHA-224/SHA-256 secure hash using ARMv8 Crypto Extensions");
 MODULE_AUTHOR("Ard Biesheuvel <ard.biesheuvel@linaro.org>");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS_CRYPTO("sha224");
+MODULE_ALIAS_CRYPTO("sha256");
 
 struct sha256_ce_state {
 	struct sha256_state	sst;
--- a/arch/arm64/crypto/sha3-ce-glue.c
+++ b/arch/arm64/crypto/sha3-ce-glue.c
@@ -22,6 +22,10 @@
 MODULE_DESCRIPTION("SHA3 secure hash using ARMv8 Crypto Extensions");
 MODULE_AUTHOR("Ard Biesheuvel <ard.biesheuvel@linaro.org>");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS_CRYPTO("sha3-224");
+MODULE_ALIAS_CRYPTO("sha3-256");
+MODULE_ALIAS_CRYPTO("sha3-384");
+MODULE_ALIAS_CRYPTO("sha3-512");
 
 asmlinkage void sha3_ce_transform(u64 *st, const u8 *data, int blocks,
 				  int md_len);
--- a/arch/arm64/crypto/sha512-ce-glue.c
+++ b/arch/arm64/crypto/sha512-ce-glue.c
@@ -22,6 +22,8 @@
 MODULE_DESCRIPTION("SHA-384/SHA-512 secure hash using ARMv8 Crypto Extensions");
 MODULE_AUTHOR("Ard Biesheuvel <ard.biesheuvel@linaro.org>");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS_CRYPTO("sha384");
+MODULE_ALIAS_CRYPTO("sha512");
 
 asmlinkage void sha512_ce_transform(struct sha512_state *sst, u8 const *src,
 				    int blocks);



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

* [PATCH 4.19 201/247] crypto: sun4i-ss - checking sg length is not sufficient
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (199 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 200/247] crypto: arm64/sha - add missing module aliases Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 202/247] crypto: sun4i-ss - IV register does not work on A10 and A13 Greg Kroah-Hartman
                   ` (48 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Corentin Labbe, Herbert Xu

From: Corentin Labbe <clabbe@baylibre.com>

commit 7bdcd851fa7eb66e8922aa7f6cba9e2f2427a7cf upstream.

The optimized cipher function need length multiple of 4 bytes.
But it get sometimes odd length.
This is due to SG data could be stored with an offset.

So the fix is to check also if the offset is aligned with 4 bytes.
Fixes: 6298e948215f2 ("crypto: sunxi-ss - Add Allwinner Security System crypto accelerator")
Cc: <stable@vger.kernel.org>
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/crypto/sunxi-ss/sun4i-ss-cipher.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
@@ -189,12 +189,12 @@ static int sun4i_ss_cipher_poll(struct s
 	 * we can use the SS optimized function
 	 */
 	while (in_sg && no_chunk == 1) {
-		if (in_sg->length % 4)
+		if ((in_sg->length | in_sg->offset) & 3u)
 			no_chunk = 0;
 		in_sg = sg_next(in_sg);
 	}
 	while (out_sg && no_chunk == 1) {
-		if (out_sg->length % 4)
+		if ((out_sg->length | out_sg->offset) & 3u)
 			no_chunk = 0;
 		out_sg = sg_next(out_sg);
 	}



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

* [PATCH 4.19 202/247] crypto: sun4i-ss - IV register does not work on A10 and A13
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (200 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 201/247] crypto: sun4i-ss - checking sg length is not sufficient Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 203/247] crypto: sun4i-ss - handle BigEndian for cipher Greg Kroah-Hartman
                   ` (47 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Corentin Labbe, Herbert Xu

From: Corentin Labbe <clabbe@baylibre.com>

commit b756f1c8fc9d84e3f546d7ffe056c5352f4aab05 upstream.

Allwinner A10 and A13 SoC have a version of the SS which produce
invalid IV in IVx register.

Instead of adding a variant for those, let's convert SS to produce IV
directly from data.
Fixes: 6298e948215f2 ("crypto: sunxi-ss - Add Allwinner Security System crypto accelerator")
Cc: <stable@vger.kernel.org>
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/crypto/sunxi-ss/sun4i-ss-cipher.c |   34 ++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

--- a/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
@@ -24,6 +24,7 @@ static int sun4i_ss_opti_poll(struct skc
 	unsigned int ivsize = crypto_skcipher_ivsize(tfm);
 	struct sun4i_cipher_req_ctx *ctx = skcipher_request_ctx(areq);
 	u32 mode = ctx->mode;
+	void *backup_iv = NULL;
 	/* when activating SS, the default FIFO space is SS_RX_DEFAULT(32) */
 	u32 rx_cnt = SS_RX_DEFAULT;
 	u32 tx_cnt = 0;
@@ -53,6 +54,13 @@ static int sun4i_ss_opti_poll(struct skc
 		return -EINVAL;
 	}
 
+	if (areq->iv && ivsize > 0 && mode & SS_DECRYPTION) {
+		backup_iv = kzalloc(ivsize, GFP_KERNEL);
+		if (!backup_iv)
+			return -ENOMEM;
+		scatterwalk_map_and_copy(backup_iv, areq->src, areq->cryptlen - ivsize, ivsize, 0);
+	}
+
 	spin_lock_irqsave(&ss->slock, flags);
 
 	for (i = 0; i < op->keylen; i += 4)
@@ -126,9 +134,12 @@ static int sun4i_ss_opti_poll(struct skc
 	} while (oleft);
 
 	if (areq->iv) {
-		for (i = 0; i < 4 && i < ivsize / 4; i++) {
-			v = readl(ss->base + SS_IV0 + i * 4);
-			*(u32 *)(areq->iv + i * 4) = v;
+		if (mode & SS_DECRYPTION) {
+			memcpy(areq->iv, backup_iv, ivsize);
+			kfree_sensitive(backup_iv);
+		} else {
+			scatterwalk_map_and_copy(areq->iv, areq->dst, areq->cryptlen - ivsize,
+						 ivsize, 0);
 		}
 	}
 
@@ -160,6 +171,7 @@ static int sun4i_ss_cipher_poll(struct s
 	unsigned int ileft = areq->cryptlen;
 	unsigned int oleft = areq->cryptlen;
 	unsigned int todo;
+	void *backup_iv = NULL;
 	struct sg_mapping_iter mi, mo;
 	unsigned long pi = 0, po = 0; /* progress for in and out */
 	bool miter_err;
@@ -202,6 +214,13 @@ static int sun4i_ss_cipher_poll(struct s
 	if (no_chunk == 1)
 		return sun4i_ss_opti_poll(areq);
 
+	if (areq->iv && ivsize > 0 && mode & SS_DECRYPTION) {
+		backup_iv = kzalloc(ivsize, GFP_KERNEL);
+		if (!backup_iv)
+			return -ENOMEM;
+		scatterwalk_map_and_copy(backup_iv, areq->src, areq->cryptlen - ivsize, ivsize, 0);
+	}
+
 	spin_lock_irqsave(&ss->slock, flags);
 
 	for (i = 0; i < op->keylen; i += 4)
@@ -330,9 +349,12 @@ static int sun4i_ss_cipher_poll(struct s
 		sg_miter_stop(&mo);
 	}
 	if (areq->iv) {
-		for (i = 0; i < 4 && i < ivsize / 4; i++) {
-			v = readl(ss->base + SS_IV0 + i * 4);
-			*(u32 *)(areq->iv + i * 4) = v;
+		if (mode & SS_DECRYPTION) {
+			memcpy(areq->iv, backup_iv, ivsize);
+			kfree_sensitive(backup_iv);
+		} else {
+			scatterwalk_map_and_copy(areq->iv, areq->dst, areq->cryptlen - ivsize,
+						 ivsize, 0);
 		}
 	}
 



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

* [PATCH 4.19 203/247] crypto: sun4i-ss - handle BigEndian for cipher
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (201 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 202/247] crypto: sun4i-ss - IV register does not work on A10 and A13 Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 204/247] seccomp: Add missing return in non-void function Greg Kroah-Hartman
                   ` (46 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Corentin Labbe, Herbert Xu

From: Corentin Labbe <clabbe@baylibre.com>

commit 5ab6177fa02df15cd8a02a1f1fb361d2d5d8b946 upstream.

Ciphers produce invalid results on BE.
Key and IV need to be written in LE.

Fixes: 6298e948215f2 ("crypto: sunxi-ss - Add Allwinner Security System crypto accelerator")
Cc: <stable@vger.kernel.org>
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/crypto/sunxi-ss/sun4i-ss-cipher.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
@@ -63,13 +63,13 @@ static int sun4i_ss_opti_poll(struct skc
 
 	spin_lock_irqsave(&ss->slock, flags);
 
-	for (i = 0; i < op->keylen; i += 4)
-		writel(*(op->key + i / 4), ss->base + SS_KEY0 + i);
+	for (i = 0; i < op->keylen / 4; i++)
+		writesl(ss->base + SS_KEY0 + i * 4, &op->key[i], 1);
 
 	if (areq->iv) {
 		for (i = 0; i < 4 && i < ivsize / 4; i++) {
 			v = *(u32 *)(areq->iv + i * 4);
-			writel(v, ss->base + SS_IV0 + i * 4);
+			writesl(ss->base + SS_IV0 + i * 4, &v, 1);
 		}
 	}
 	writel(mode, ss->base + SS_CTL);
@@ -223,13 +223,13 @@ static int sun4i_ss_cipher_poll(struct s
 
 	spin_lock_irqsave(&ss->slock, flags);
 
-	for (i = 0; i < op->keylen; i += 4)
-		writel(*(op->key + i / 4), ss->base + SS_KEY0 + i);
+	for (i = 0; i < op->keylen / 4; i++)
+		writesl(ss->base + SS_KEY0 + i * 4, &op->key[i], 1);
 
 	if (areq->iv) {
 		for (i = 0; i < 4 && i < ivsize / 4; i++) {
 			v = *(u32 *)(areq->iv + i * 4);
-			writel(v, ss->base + SS_IV0 + i * 4);
+			writesl(ss->base + SS_IV0 + i * 4, &v, 1);
 		}
 	}
 	writel(mode, ss->base + SS_CTL);



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

* [PATCH 4.19 204/247] seccomp: Add missing return in non-void function
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (202 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 203/247] crypto: sun4i-ss - handle BigEndian for cipher Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 205/247] misc: rtsx: init of rts522a add OCP power off when no card is present Greg Kroah-Hartman
                   ` (45 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Paul Cercueil, Kees Cook

From: Paul Cercueil <paul@crapouillou.net>

commit 04b38d012556199ba4c31195940160e0c44c64f0 upstream.

We don't actually care about the value, since the kernel will panic
before that; but a value should nonetheless be returned, otherwise the
compiler will complain.

Fixes: 8112c4f140fa ("seccomp: remove 2-phase API")
Cc: stable@vger.kernel.org # 4.7+
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210111172839.640914-1-paul@crapouillou.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/seccomp.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -771,6 +771,8 @@ static int __seccomp_filter(int this_sys
 			    const bool recheck_after_trace)
 {
 	BUG();
+
+	return -1;
 }
 #endif
 



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

* [PATCH 4.19 205/247] misc: rtsx: init of rts522a add OCP power off when no card is present
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (203 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 204/247] seccomp: Add missing return in non-void function Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 206/247] drivers/misc/vmw_vmci: restrict too big queue size in qp_host_alloc_queue Greg Kroah-Hartman
                   ` (44 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ricky Wu

From: Ricky Wu <ricky_wu@realtek.com>

commit 920fd8a70619074eac7687352c8f1c6f3c2a64a5 upstream.

Power down OCP for power consumption
when no SD/MMC card is present

Cc: stable@vger.kernel.org
Signed-off-by: Ricky Wu <ricky_wu@realtek.com>
Link: https://lore.kernel.org/r/20210204083115.9471-1-ricky_wu@realtek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/misc/cardreader/rts5227.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/drivers/misc/cardreader/rts5227.c
+++ b/drivers/misc/cardreader/rts5227.c
@@ -339,6 +339,11 @@ static int rts522a_extra_init_hw(struct
 {
 	rts5227_extra_init_hw(pcr);
 
+	/* Power down OCP for power consumption */
+	if (!pcr->card_exist)
+		rtsx_pci_write_register(pcr, FPDCTL, OC_POWER_DOWN,
+				OC_POWER_DOWN);
+
 	rtsx_pci_write_register(pcr, FUNC_FORCE_CTL, FUNC_FORCE_UPME_XMT_DBG,
 		FUNC_FORCE_UPME_XMT_DBG);
 	rtsx_pci_write_register(pcr, PCLK_CTL, 0x04, 0x04);



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

* [PATCH 4.19 206/247] drivers/misc/vmw_vmci: restrict too big queue size in qp_host_alloc_queue
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (204 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 205/247] misc: rtsx: init of rts522a add OCP power off when no card is present Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 207/247] pstore: Fix typo in compression option name Greg Kroah-Hartman
                   ` (43 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, syzbot+15ec7391f3d6a1a7cc7d,
	Sabyrzhan Tasbolatov

From: Sabyrzhan Tasbolatov <snovitoll@gmail.com>

commit 2fd10bcf0310b9525b2af9e1f7aa9ddd87c3772e upstream.

syzbot found WARNING in qp_broker_alloc[1] in qp_host_alloc_queue()
when num_pages is 0x100001, giving queue_size + queue_page_size
bigger than KMALLOC_MAX_SIZE for kzalloc(), resulting order >= MAX_ORDER
condition.

queue_size + queue_page_size=0x8000d8, where KMALLOC_MAX_SIZE=0x400000.

[1]
Call Trace:
 alloc_pages include/linux/gfp.h:547 [inline]
 kmalloc_order+0x40/0x130 mm/slab_common.c:837
 kmalloc_order_trace+0x15/0x70 mm/slab_common.c:853
 kmalloc_large include/linux/slab.h:481 [inline]
 __kmalloc+0x257/0x330 mm/slub.c:3959
 kmalloc include/linux/slab.h:557 [inline]
 kzalloc include/linux/slab.h:682 [inline]
 qp_host_alloc_queue drivers/misc/vmw_vmci/vmci_queue_pair.c:540 [inline]
 qp_broker_create drivers/misc/vmw_vmci/vmci_queue_pair.c:1351 [inline]
 qp_broker_alloc+0x936/0x2740 drivers/misc/vmw_vmci/vmci_queue_pair.c:1739

Reported-by: syzbot+15ec7391f3d6a1a7cc7d@syzkaller.appspotmail.com
Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
Link: https://lore.kernel.org/r/20210209102612.2112247-1-snovitoll@gmail.com
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/misc/vmw_vmci/vmci_queue_pair.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
+++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
@@ -552,6 +552,9 @@ static struct vmci_queue *qp_host_alloc_
 
 	queue_page_size = num_pages * sizeof(*queue->kernel_if->u.h.page);
 
+	if (queue_size + queue_page_size > KMALLOC_MAX_SIZE)
+		return NULL;
+
 	queue = kzalloc(queue_size + queue_page_size, GFP_KERNEL);
 	if (queue) {
 		queue->q_header = NULL;



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

* [PATCH 4.19 207/247] pstore: Fix typo in compression option name
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (205 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 206/247] drivers/misc/vmw_vmci: restrict too big queue size in qp_host_alloc_queue Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 208/247] dts64: mt7622: fix slow sd card access Greg Kroah-Hartman
                   ` (42 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jiri Bohac, Matteo Croce, Kees Cook

From: Jiri Bohac <jbohac@suse.cz>

commit 19d8e9149c27b689c6224f5c84b96a159342195a upstream.

Both pstore_compress() and decompress_record() use a mistyped config
option name ("PSTORE_COMPRESSION" instead of "PSTORE_COMPRESS"). As
a result compression and decompression of pstore records was always
disabled.

Use the correct config option name.

Signed-off-by: Jiri Bohac <jbohac@suse.cz>
Fixes: fd49e03280e5 ("pstore: Fix linking when crypto API disabled")
Acked-by: Matteo Croce <mcroce@microsoft.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20210218111547.johvp5klpv3xrpnn@dwarf.suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/pstore/platform.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -250,7 +250,7 @@ static int pstore_compress(const void *i
 {
 	int ret;
 
-	if (!IS_ENABLED(CONFIG_PSTORE_COMPRESSION))
+	if (!IS_ENABLED(CONFIG_PSTORE_COMPRESS))
 		return -EINVAL;
 
 	ret = crypto_comp_compress(tfm, in, inlen, out, &outlen);
@@ -650,7 +650,7 @@ static void decompress_record(struct pst
 	int unzipped_len;
 	char *decompressed;
 
-	if (!IS_ENABLED(CONFIG_PSTORE_COMPRESSION) || !record->compressed)
+	if (!IS_ENABLED(CONFIG_PSTORE_COMPRESS) || !record->compressed)
 		return;
 
 	/* Only PSTORE_TYPE_DMESG support compression. */



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

* [PATCH 4.19 208/247] dts64: mt7622: fix slow sd card access
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (206 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 207/247] pstore: Fix typo in compression option name Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 209/247] staging/mt7621-dma: mtk-hsdma.c->hsdma-mt7621.c Greg Kroah-Hartman
                   ` (41 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Frank Wunderlich, Matthias Brugger

From: Frank Wunderlich <frank-w@public-files.de>

commit dc2e76175417e69c41d927dba75a966399f18354 upstream.

Fix extreme slow speed (200MB takes ~20 min) on writing sdcard on
bananapi-r64 by adding reset-control for mmc1 like it's done for mmc0/emmc.

Fixes: 2c002a3049f7 ("arm64: dts: mt7622: add mmc related device nodes")
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20210113180919.49523-1-linux@fw-web.de
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arm64/boot/dts/mediatek/mt7622.dtsi |    2 ++
 1 file changed, 2 insertions(+)

--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
@@ -641,6 +641,8 @@
 		clocks = <&pericfg CLK_PERI_MSDC30_1_PD>,
 			 <&topckgen CLK_TOP_AXI_SEL>;
 		clock-names = "source", "hclk";
+		resets = <&pericfg MT7622_PERI_MSDC1_SW_RST>;
+		reset-names = "hrst";
 		status = "disabled";
 	};
 



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

* [PATCH 4.19 209/247] staging/mt7621-dma: mtk-hsdma.c->hsdma-mt7621.c
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (207 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 208/247] dts64: mt7622: fix slow sd card access Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 17:41   ` Ilya Lipnitskiy
  2021-03-01 16:13 ` [PATCH 4.19 210/247] staging: gdm724x: Fix DMA from stack Greg Kroah-Hartman
                   ` (40 subsequent siblings)
  249 siblings, 1 reply; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Masahiro Yamada, Ilya Lipnitskiy

From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>

commit 1f92798cbe7fe923479cff754dd06dd23d352e36 upstream.

Also use KBUILD_MODNAME for module name.

This driver is only used by RALINK MIPS MT7621 SoCs. Tested by building
against that target using OpenWrt with Linux 5.10.10.

Fixes the following error:
error: the following would cause module name conflict:
  drivers/dma/mediatek/mtk-hsdma.ko
  drivers/staging/mt7621-dma/mtk-hsdma.ko

Cc: stable@vger.kernel.org
Cc: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Link: https://lore.kernel.org/r/20210130034507.2115280-1-ilya.lipnitskiy@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/mt7621-dma/Makefile       |    2 
 drivers/staging/mt7621-dma/hsdma-mt7621.c |  771 ++++++++++++++++++++++++++++++
 drivers/staging/mt7621-dma/mtk-hsdma.c    |  771 ------------------------------
 3 files changed, 772 insertions(+), 772 deletions(-)
 rename drivers/staging/mt7621-dma/{mtk-hsdma.c => hsdma-mt7621.c} (99%)

--- a/drivers/staging/mt7621-dma/Makefile
+++ b/drivers/staging/mt7621-dma/Makefile
@@ -1,4 +1,4 @@
 obj-$(CONFIG_DMA_RALINK) += ralink-gdma.o
-obj-$(CONFIG_MTK_HSDMA) += mtk-hsdma.o
+obj-$(CONFIG_MTK_HSDMA) += hsdma-mt7621.o
 
 ccflags-y += -I$(srctree)/drivers/dma
--- /dev/null
+++ b/drivers/staging/mt7621-dma/hsdma-mt7621.c
@@ -0,0 +1,771 @@
+/*
+ *  Copyright (C) 2015, Michael Lee <igvtee@gmail.com>
+ *  MTK HSDMA support
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under  the terms of the GNU General	 Public License as published by the
+ *  Free Software Foundation;  either version 2 of the License, or (at your
+ *  option) any later version.
+ *
+ */
+
+#include <linux/dmaengine.h>
+#include <linux/dma-mapping.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/list.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/irq.h>
+#include <linux/of_dma.h>
+#include <linux/reset.h>
+#include <linux/of_device.h>
+
+#include "virt-dma.h"
+
+#define HSDMA_BASE_OFFSET		0x800
+
+#define HSDMA_REG_TX_BASE		0x00
+#define HSDMA_REG_TX_CNT		0x04
+#define HSDMA_REG_TX_CTX		0x08
+#define HSDMA_REG_TX_DTX		0x0c
+#define HSDMA_REG_RX_BASE		0x100
+#define HSDMA_REG_RX_CNT		0x104
+#define HSDMA_REG_RX_CRX		0x108
+#define HSDMA_REG_RX_DRX		0x10c
+#define HSDMA_REG_INFO			0x200
+#define HSDMA_REG_GLO_CFG		0x204
+#define HSDMA_REG_RST_CFG		0x208
+#define HSDMA_REG_DELAY_INT		0x20c
+#define HSDMA_REG_FREEQ_THRES		0x210
+#define HSDMA_REG_INT_STATUS		0x220
+#define HSDMA_REG_INT_MASK		0x228
+#define HSDMA_REG_SCH_Q01		0x280
+#define HSDMA_REG_SCH_Q23		0x284
+
+#define HSDMA_DESCS_MAX			0xfff
+#define HSDMA_DESCS_NUM			8
+#define HSDMA_DESCS_MASK		(HSDMA_DESCS_NUM - 1)
+#define HSDMA_NEXT_DESC(x)		(((x) + 1) & HSDMA_DESCS_MASK)
+
+/* HSDMA_REG_INFO */
+#define HSDMA_INFO_INDEX_MASK		0xf
+#define HSDMA_INFO_INDEX_SHIFT		24
+#define HSDMA_INFO_BASE_MASK		0xff
+#define HSDMA_INFO_BASE_SHIFT		16
+#define HSDMA_INFO_RX_MASK		0xff
+#define HSDMA_INFO_RX_SHIFT		8
+#define HSDMA_INFO_TX_MASK		0xff
+#define HSDMA_INFO_TX_SHIFT		0
+
+/* HSDMA_REG_GLO_CFG */
+#define HSDMA_GLO_TX_2B_OFFSET		BIT(31)
+#define HSDMA_GLO_CLK_GATE		BIT(30)
+#define HSDMA_GLO_BYTE_SWAP		BIT(29)
+#define HSDMA_GLO_MULTI_DMA		BIT(10)
+#define HSDMA_GLO_TWO_BUF		BIT(9)
+#define HSDMA_GLO_32B_DESC		BIT(8)
+#define HSDMA_GLO_BIG_ENDIAN		BIT(7)
+#define HSDMA_GLO_TX_DONE		BIT(6)
+#define HSDMA_GLO_BT_MASK		0x3
+#define HSDMA_GLO_BT_SHIFT		4
+#define HSDMA_GLO_RX_BUSY		BIT(3)
+#define HSDMA_GLO_RX_DMA		BIT(2)
+#define HSDMA_GLO_TX_BUSY		BIT(1)
+#define HSDMA_GLO_TX_DMA		BIT(0)
+
+#define HSDMA_BT_SIZE_16BYTES		(0 << HSDMA_GLO_BT_SHIFT)
+#define HSDMA_BT_SIZE_32BYTES		(1 << HSDMA_GLO_BT_SHIFT)
+#define HSDMA_BT_SIZE_64BYTES		(2 << HSDMA_GLO_BT_SHIFT)
+#define HSDMA_BT_SIZE_128BYTES		(3 << HSDMA_GLO_BT_SHIFT)
+
+#define HSDMA_GLO_DEFAULT		(HSDMA_GLO_MULTI_DMA | \
+		HSDMA_GLO_RX_DMA | HSDMA_GLO_TX_DMA | HSDMA_BT_SIZE_32BYTES)
+
+/* HSDMA_REG_RST_CFG */
+#define HSDMA_RST_RX_SHIFT		16
+#define HSDMA_RST_TX_SHIFT		0
+
+/* HSDMA_REG_DELAY_INT */
+#define HSDMA_DELAY_INT_EN		BIT(15)
+#define HSDMA_DELAY_PEND_OFFSET		8
+#define HSDMA_DELAY_TIME_OFFSET		0
+#define HSDMA_DELAY_TX_OFFSET		16
+#define HSDMA_DELAY_RX_OFFSET		0
+
+#define HSDMA_DELAY_INIT(x)		(HSDMA_DELAY_INT_EN | \
+		((x) << HSDMA_DELAY_PEND_OFFSET))
+#define HSDMA_DELAY(x)			((HSDMA_DELAY_INIT(x) << \
+		HSDMA_DELAY_TX_OFFSET) | HSDMA_DELAY_INIT(x))
+
+/* HSDMA_REG_INT_STATUS */
+#define HSDMA_INT_DELAY_RX_COH		BIT(31)
+#define HSDMA_INT_DELAY_RX_INT		BIT(30)
+#define HSDMA_INT_DELAY_TX_COH		BIT(29)
+#define HSDMA_INT_DELAY_TX_INT		BIT(28)
+#define HSDMA_INT_RX_MASK		0x3
+#define HSDMA_INT_RX_SHIFT		16
+#define HSDMA_INT_RX_Q0			BIT(16)
+#define HSDMA_INT_TX_MASK		0xf
+#define HSDMA_INT_TX_SHIFT		0
+#define HSDMA_INT_TX_Q0			BIT(0)
+
+/* tx/rx dma desc flags */
+#define HSDMA_PLEN_MASK			0x3fff
+#define HSDMA_DESC_DONE			BIT(31)
+#define HSDMA_DESC_LS0			BIT(30)
+#define HSDMA_DESC_PLEN0(_x)		(((_x) & HSDMA_PLEN_MASK) << 16)
+#define HSDMA_DESC_TAG			BIT(15)
+#define HSDMA_DESC_LS1			BIT(14)
+#define HSDMA_DESC_PLEN1(_x)		((_x) & HSDMA_PLEN_MASK)
+
+/* align 4 bytes */
+#define HSDMA_ALIGN_SIZE		3
+/* align size 128bytes */
+#define HSDMA_MAX_PLEN			0x3f80
+
+struct hsdma_desc {
+	u32 addr0;
+	u32 flags;
+	u32 addr1;
+	u32 unused;
+};
+
+struct mtk_hsdma_sg {
+	dma_addr_t src_addr;
+	dma_addr_t dst_addr;
+	u32 len;
+};
+
+struct mtk_hsdma_desc {
+	struct virt_dma_desc vdesc;
+	unsigned int num_sgs;
+	struct mtk_hsdma_sg sg[1];
+};
+
+struct mtk_hsdma_chan {
+	struct virt_dma_chan vchan;
+	unsigned int id;
+	dma_addr_t desc_addr;
+	int tx_idx;
+	int rx_idx;
+	struct hsdma_desc *tx_ring;
+	struct hsdma_desc *rx_ring;
+	struct mtk_hsdma_desc *desc;
+	unsigned int next_sg;
+};
+
+struct mtk_hsdam_engine {
+	struct dma_device ddev;
+	struct device_dma_parameters dma_parms;
+	void __iomem *base;
+	struct tasklet_struct task;
+	volatile unsigned long chan_issued;
+
+	struct mtk_hsdma_chan chan[1];
+};
+
+static inline struct mtk_hsdam_engine *mtk_hsdma_chan_get_dev(
+		struct mtk_hsdma_chan *chan)
+{
+	return container_of(chan->vchan.chan.device, struct mtk_hsdam_engine,
+			ddev);
+}
+
+static inline struct mtk_hsdma_chan *to_mtk_hsdma_chan(struct dma_chan *c)
+{
+	return container_of(c, struct mtk_hsdma_chan, vchan.chan);
+}
+
+static inline struct mtk_hsdma_desc *to_mtk_hsdma_desc(
+		struct virt_dma_desc *vdesc)
+{
+	return container_of(vdesc, struct mtk_hsdma_desc, vdesc);
+}
+
+static inline u32 mtk_hsdma_read(struct mtk_hsdam_engine *hsdma, u32 reg)
+{
+	return readl(hsdma->base + reg);
+}
+
+static inline void mtk_hsdma_write(struct mtk_hsdam_engine *hsdma,
+				   unsigned reg, u32 val)
+{
+	writel(val, hsdma->base + reg);
+}
+
+static void mtk_hsdma_reset_chan(struct mtk_hsdam_engine *hsdma,
+				 struct mtk_hsdma_chan *chan)
+{
+	chan->tx_idx = 0;
+	chan->rx_idx = HSDMA_DESCS_NUM - 1;
+
+	mtk_hsdma_write(hsdma, HSDMA_REG_TX_CTX, chan->tx_idx);
+	mtk_hsdma_write(hsdma, HSDMA_REG_RX_CRX, chan->rx_idx);
+
+	mtk_hsdma_write(hsdma, HSDMA_REG_RST_CFG,
+			0x1 << (chan->id + HSDMA_RST_TX_SHIFT));
+	mtk_hsdma_write(hsdma, HSDMA_REG_RST_CFG,
+			0x1 << (chan->id + HSDMA_RST_RX_SHIFT));
+}
+
+static void hsdma_dump_reg(struct mtk_hsdam_engine *hsdma)
+{
+	dev_dbg(hsdma->ddev.dev, "tbase %08x, tcnt %08x, " \
+			"tctx %08x, tdtx: %08x, rbase %08x, " \
+			"rcnt %08x, rctx %08x, rdtx %08x\n",
+			mtk_hsdma_read(hsdma, HSDMA_REG_TX_BASE),
+			mtk_hsdma_read(hsdma, HSDMA_REG_TX_CNT),
+			mtk_hsdma_read(hsdma, HSDMA_REG_TX_CTX),
+			mtk_hsdma_read(hsdma, HSDMA_REG_TX_DTX),
+			mtk_hsdma_read(hsdma, HSDMA_REG_RX_BASE),
+			mtk_hsdma_read(hsdma, HSDMA_REG_RX_CNT),
+			mtk_hsdma_read(hsdma, HSDMA_REG_RX_CRX),
+			mtk_hsdma_read(hsdma, HSDMA_REG_RX_DRX));
+
+	dev_dbg(hsdma->ddev.dev, "info %08x, glo %08x, delay %08x, " \
+			"intr_stat %08x, intr_mask %08x\n",
+			mtk_hsdma_read(hsdma, HSDMA_REG_INFO),
+			mtk_hsdma_read(hsdma, HSDMA_REG_GLO_CFG),
+			mtk_hsdma_read(hsdma, HSDMA_REG_DELAY_INT),
+			mtk_hsdma_read(hsdma, HSDMA_REG_INT_STATUS),
+			mtk_hsdma_read(hsdma, HSDMA_REG_INT_MASK));
+}
+
+static void hsdma_dump_desc(struct mtk_hsdam_engine *hsdma,
+			    struct mtk_hsdma_chan *chan)
+{
+	struct hsdma_desc *tx_desc;
+	struct hsdma_desc *rx_desc;
+	int i;
+
+	dev_dbg(hsdma->ddev.dev, "tx idx: %d, rx idx: %d\n",
+			chan->tx_idx, chan->rx_idx);
+
+	for (i = 0; i < HSDMA_DESCS_NUM; i++) {
+		tx_desc = &chan->tx_ring[i];
+		rx_desc = &chan->rx_ring[i];
+
+		dev_dbg(hsdma->ddev.dev, "%d tx addr0: %08x, flags %08x, " \
+				"tx addr1: %08x, rx addr0 %08x, flags %08x\n",
+				i, tx_desc->addr0, tx_desc->flags, \
+				tx_desc->addr1, rx_desc->addr0, rx_desc->flags);
+	}
+}
+
+static void mtk_hsdma_reset(struct mtk_hsdam_engine *hsdma,
+			    struct mtk_hsdma_chan *chan)
+{
+	int i;
+
+	/* disable dma */
+	mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, 0);
+
+	/* disable intr */
+	mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, 0);
+
+	/* init desc value */
+	for (i = 0; i < HSDMA_DESCS_NUM; i++) {
+		chan->tx_ring[i].addr0 = 0;
+		chan->tx_ring[i].flags = HSDMA_DESC_LS0 |
+			HSDMA_DESC_DONE;
+	}
+	for (i = 0; i < HSDMA_DESCS_NUM; i++) {
+		chan->rx_ring[i].addr0 = 0;
+		chan->rx_ring[i].flags = 0;
+	}
+
+	/* reset */
+	mtk_hsdma_reset_chan(hsdma, chan);
+
+	/* enable intr */
+	mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, HSDMA_INT_RX_Q0);
+
+	/* enable dma */
+	mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, HSDMA_GLO_DEFAULT);
+}
+
+static int mtk_hsdma_terminate_all(struct dma_chan *c)
+{
+	struct mtk_hsdma_chan *chan = to_mtk_hsdma_chan(c);
+	struct mtk_hsdam_engine *hsdma = mtk_hsdma_chan_get_dev(chan);
+	unsigned long timeout;
+	LIST_HEAD(head);
+
+	spin_lock_bh(&chan->vchan.lock);
+	chan->desc = NULL;
+	clear_bit(chan->id, &hsdma->chan_issued);
+	vchan_get_all_descriptors(&chan->vchan, &head);
+	spin_unlock_bh(&chan->vchan.lock);
+
+	vchan_dma_desc_free_list(&chan->vchan, &head);
+
+	/* wait dma transfer complete */
+	timeout = jiffies + msecs_to_jiffies(2000);
+	while (mtk_hsdma_read(hsdma, HSDMA_REG_GLO_CFG) &
+			(HSDMA_GLO_RX_BUSY | HSDMA_GLO_TX_BUSY)) {
+		if (time_after_eq(jiffies, timeout)) {
+			hsdma_dump_desc(hsdma, chan);
+			mtk_hsdma_reset(hsdma, chan);
+			dev_err(hsdma->ddev.dev, "timeout, reset it\n");
+			break;
+		}
+		cpu_relax();
+	}
+
+	return 0;
+}
+
+static int mtk_hsdma_start_transfer(struct mtk_hsdam_engine *hsdma,
+				    struct mtk_hsdma_chan *chan)
+{
+	dma_addr_t src, dst;
+	size_t len, tlen;
+	struct hsdma_desc *tx_desc, *rx_desc;
+	struct mtk_hsdma_sg *sg;
+	unsigned int i;
+	int rx_idx;
+
+	sg = &chan->desc->sg[0];
+	len = sg->len;
+	chan->desc->num_sgs = DIV_ROUND_UP(len, HSDMA_MAX_PLEN);
+
+	/* tx desc */
+	src = sg->src_addr;
+	for (i = 0; i < chan->desc->num_sgs; i++) {
+		tx_desc = &chan->tx_ring[chan->tx_idx];
+
+		if (len > HSDMA_MAX_PLEN)
+			tlen = HSDMA_MAX_PLEN;
+		else
+			tlen = len;
+
+		if (i & 0x1) {
+			tx_desc->addr1 = src;
+			tx_desc->flags |= HSDMA_DESC_PLEN1(tlen);
+		} else {
+			tx_desc->addr0 = src;
+			tx_desc->flags = HSDMA_DESC_PLEN0(tlen);
+
+			/* update index */
+			chan->tx_idx = HSDMA_NEXT_DESC(chan->tx_idx);
+		}
+
+		src += tlen;
+		len -= tlen;
+	}
+	if (i & 0x1)
+		tx_desc->flags |= HSDMA_DESC_LS0;
+	else
+		tx_desc->flags |= HSDMA_DESC_LS1;
+
+	/* rx desc */
+	rx_idx = HSDMA_NEXT_DESC(chan->rx_idx);
+	len = sg->len;
+	dst = sg->dst_addr;
+	for (i = 0; i < chan->desc->num_sgs; i++) {
+		rx_desc = &chan->rx_ring[rx_idx];
+		if (len > HSDMA_MAX_PLEN)
+			tlen = HSDMA_MAX_PLEN;
+		else
+			tlen = len;
+
+		rx_desc->addr0 = dst;
+		rx_desc->flags = HSDMA_DESC_PLEN0(tlen);
+
+		dst += tlen;
+		len -= tlen;
+
+		/* update index */
+		rx_idx = HSDMA_NEXT_DESC(rx_idx);
+	}
+
+	/* make sure desc and index all up to date */
+	wmb();
+	mtk_hsdma_write(hsdma, HSDMA_REG_TX_CTX, chan->tx_idx);
+
+	return 0;
+}
+
+static int gdma_next_desc(struct mtk_hsdma_chan *chan)
+{
+	struct virt_dma_desc *vdesc;
+
+	vdesc = vchan_next_desc(&chan->vchan);
+	if (!vdesc) {
+		chan->desc = NULL;
+		return 0;
+	}
+	chan->desc = to_mtk_hsdma_desc(vdesc);
+	chan->next_sg = 0;
+
+	return 1;
+}
+
+static void mtk_hsdma_chan_done(struct mtk_hsdam_engine *hsdma,
+				struct mtk_hsdma_chan *chan)
+{
+	struct mtk_hsdma_desc *desc;
+	int chan_issued;
+
+	chan_issued = 0;
+	spin_lock_bh(&chan->vchan.lock);
+	desc = chan->desc;
+	if (likely(desc)) {
+		if (chan->next_sg == desc->num_sgs) {
+			list_del(&desc->vdesc.node);
+			vchan_cookie_complete(&desc->vdesc);
+			chan_issued = gdma_next_desc(chan);
+		}
+	} else
+		dev_dbg(hsdma->ddev.dev, "no desc to complete\n");
+
+	if (chan_issued)
+		set_bit(chan->id, &hsdma->chan_issued);
+	spin_unlock_bh(&chan->vchan.lock);
+}
+
+static irqreturn_t mtk_hsdma_irq(int irq, void *devid)
+{
+	struct mtk_hsdam_engine *hsdma = devid;
+	u32 status;
+
+	status = mtk_hsdma_read(hsdma, HSDMA_REG_INT_STATUS);
+	if (unlikely(!status))
+		return IRQ_NONE;
+
+	if (likely(status & HSDMA_INT_RX_Q0))
+		tasklet_schedule(&hsdma->task);
+	else
+		dev_dbg(hsdma->ddev.dev, "unhandle irq status %08x\n",
+			status);
+	/* clean intr bits */
+	mtk_hsdma_write(hsdma, HSDMA_REG_INT_STATUS, status);
+
+	return IRQ_HANDLED;
+}
+
+static void mtk_hsdma_issue_pending(struct dma_chan *c)
+{
+	struct mtk_hsdma_chan *chan = to_mtk_hsdma_chan(c);
+	struct mtk_hsdam_engine *hsdma = mtk_hsdma_chan_get_dev(chan);
+
+	spin_lock_bh(&chan->vchan.lock);
+	if (vchan_issue_pending(&chan->vchan) && !chan->desc) {
+		if (gdma_next_desc(chan)) {
+			set_bit(chan->id, &hsdma->chan_issued);
+			tasklet_schedule(&hsdma->task);
+		} else
+			dev_dbg(hsdma->ddev.dev, "no desc to issue\n");
+	}
+	spin_unlock_bh(&chan->vchan.lock);
+}
+
+static struct dma_async_tx_descriptor *mtk_hsdma_prep_dma_memcpy(
+		struct dma_chan *c, dma_addr_t dest, dma_addr_t src,
+		size_t len, unsigned long flags)
+{
+	struct mtk_hsdma_chan *chan = to_mtk_hsdma_chan(c);
+	struct mtk_hsdma_desc *desc;
+
+	if (len <= 0)
+		return NULL;
+
+	desc = kzalloc(sizeof(struct mtk_hsdma_desc), GFP_ATOMIC);
+	if (!desc) {
+		dev_err(c->device->dev, "alloc memcpy decs error\n");
+		return NULL;
+	}
+
+	desc->sg[0].src_addr = src;
+	desc->sg[0].dst_addr = dest;
+	desc->sg[0].len = len;
+
+	return vchan_tx_prep(&chan->vchan, &desc->vdesc, flags);
+}
+
+static enum dma_status mtk_hsdma_tx_status(struct dma_chan *c,
+					   dma_cookie_t cookie,
+					   struct dma_tx_state *state)
+{
+	return dma_cookie_status(c, cookie, state);
+}
+
+static void mtk_hsdma_free_chan_resources(struct dma_chan *c)
+{
+	vchan_free_chan_resources(to_virt_chan(c));
+}
+
+static void mtk_hsdma_desc_free(struct virt_dma_desc *vdesc)
+{
+	kfree(container_of(vdesc, struct mtk_hsdma_desc, vdesc));
+}
+
+static void mtk_hsdma_tx(struct mtk_hsdam_engine *hsdma)
+{
+	struct mtk_hsdma_chan *chan;
+
+	if (test_and_clear_bit(0, &hsdma->chan_issued)) {
+		chan = &hsdma->chan[0];
+		if (chan->desc)
+			mtk_hsdma_start_transfer(hsdma, chan);
+		else
+			dev_dbg(hsdma->ddev.dev, "chan 0 no desc to issue\n");
+	}
+}
+
+static void mtk_hsdma_rx(struct mtk_hsdam_engine *hsdma)
+{
+	struct mtk_hsdma_chan *chan;
+	int next_idx, drx_idx, cnt;
+
+	chan = &hsdma->chan[0];
+	next_idx = HSDMA_NEXT_DESC(chan->rx_idx);
+	drx_idx = mtk_hsdma_read(hsdma, HSDMA_REG_RX_DRX);
+
+	cnt = (drx_idx - next_idx) & HSDMA_DESCS_MASK;
+	if (!cnt)
+		return;
+
+	chan->next_sg += cnt;
+	chan->rx_idx = (chan->rx_idx + cnt) & HSDMA_DESCS_MASK;
+
+	/* update rx crx */
+	wmb();
+	mtk_hsdma_write(hsdma, HSDMA_REG_RX_CRX, chan->rx_idx);
+
+	mtk_hsdma_chan_done(hsdma, chan);
+}
+
+static void mtk_hsdma_tasklet(unsigned long arg)
+{
+	struct mtk_hsdam_engine *hsdma = (struct mtk_hsdam_engine *)arg;
+
+	mtk_hsdma_rx(hsdma);
+	mtk_hsdma_tx(hsdma);
+}
+
+static int mtk_hsdam_alloc_desc(struct mtk_hsdam_engine *hsdma,
+				struct mtk_hsdma_chan *chan)
+{
+	int i;
+
+	chan->tx_ring = dma_alloc_coherent(hsdma->ddev.dev,
+			2 * HSDMA_DESCS_NUM * sizeof(*chan->tx_ring),
+			&chan->desc_addr, GFP_ATOMIC | __GFP_ZERO);
+	if (!chan->tx_ring)
+		goto no_mem;
+
+	chan->rx_ring = &chan->tx_ring[HSDMA_DESCS_NUM];
+
+	/* init tx ring value */
+	for (i = 0; i < HSDMA_DESCS_NUM; i++)
+		chan->tx_ring[i].flags = HSDMA_DESC_LS0 | HSDMA_DESC_DONE;
+
+	return 0;
+no_mem:
+	return -ENOMEM;
+}
+
+static void mtk_hsdam_free_desc(struct mtk_hsdam_engine *hsdma,
+				struct mtk_hsdma_chan *chan)
+{
+	if (chan->tx_ring) {
+		dma_free_coherent(hsdma->ddev.dev,
+				2 * HSDMA_DESCS_NUM * sizeof(*chan->tx_ring),
+				chan->tx_ring, chan->desc_addr);
+		chan->tx_ring = NULL;
+		chan->rx_ring = NULL;
+	}
+}
+
+static int mtk_hsdma_init(struct mtk_hsdam_engine *hsdma)
+{
+	struct mtk_hsdma_chan *chan;
+	int ret;
+	u32 reg;
+
+	/* init desc */
+	chan = &hsdma->chan[0];
+	ret = mtk_hsdam_alloc_desc(hsdma, chan);
+	if (ret)
+		return ret;
+
+	/* tx */
+	mtk_hsdma_write(hsdma, HSDMA_REG_TX_BASE, chan->desc_addr);
+	mtk_hsdma_write(hsdma, HSDMA_REG_TX_CNT, HSDMA_DESCS_NUM);
+	/* rx */
+	mtk_hsdma_write(hsdma, HSDMA_REG_RX_BASE, chan->desc_addr +
+			(sizeof(struct hsdma_desc) * HSDMA_DESCS_NUM));
+	mtk_hsdma_write(hsdma, HSDMA_REG_RX_CNT, HSDMA_DESCS_NUM);
+	/* reset */
+	mtk_hsdma_reset_chan(hsdma, chan);
+
+	/* enable rx intr */
+	mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, HSDMA_INT_RX_Q0);
+
+	/* enable dma */
+	mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, HSDMA_GLO_DEFAULT);
+
+	/* hardware info */
+	reg = mtk_hsdma_read(hsdma, HSDMA_REG_INFO);
+	dev_info(hsdma->ddev.dev, "rx: %d, tx: %d\n",
+		 (reg >> HSDMA_INFO_RX_SHIFT) & HSDMA_INFO_RX_MASK,
+		 (reg >> HSDMA_INFO_TX_SHIFT) & HSDMA_INFO_TX_MASK);
+
+	hsdma_dump_reg(hsdma);
+
+	return ret;
+}
+
+static void mtk_hsdma_uninit(struct mtk_hsdam_engine *hsdma)
+{
+	struct mtk_hsdma_chan *chan;
+
+	/* disable dma */
+	mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, 0);
+
+	/* disable intr */
+	mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, 0);
+
+	/* free desc */
+	chan = &hsdma->chan[0];
+	mtk_hsdam_free_desc(hsdma, chan);
+
+	/* tx */
+	mtk_hsdma_write(hsdma, HSDMA_REG_TX_BASE, 0);
+	mtk_hsdma_write(hsdma, HSDMA_REG_TX_CNT, 0);
+	/* rx */
+	mtk_hsdma_write(hsdma, HSDMA_REG_RX_BASE, 0);
+	mtk_hsdma_write(hsdma, HSDMA_REG_RX_CNT, 0);
+	/* reset */
+	mtk_hsdma_reset_chan(hsdma, chan);
+}
+
+static const struct of_device_id mtk_hsdma_of_match[] = {
+	{ .compatible = "mediatek,mt7621-hsdma" },
+	{ },
+};
+
+static int mtk_hsdma_probe(struct platform_device *pdev)
+{
+	const struct of_device_id *match;
+	struct mtk_hsdma_chan *chan;
+	struct mtk_hsdam_engine *hsdma;
+	struct dma_device *dd;
+	struct resource *res;
+	int ret;
+	int irq;
+	void __iomem *base;
+
+	ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+	if (ret)
+		return ret;
+
+	match = of_match_device(mtk_hsdma_of_match, &pdev->dev);
+	if (!match)
+		return -EINVAL;
+
+	hsdma = devm_kzalloc(&pdev->dev, sizeof(*hsdma), GFP_KERNEL);
+	if (!hsdma) {
+		dev_err(&pdev->dev, "alloc dma device failed\n");
+		return -EINVAL;
+	}
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(base))
+		return PTR_ERR(base);
+	hsdma->base = base + HSDMA_BASE_OFFSET;
+	tasklet_init(&hsdma->task, mtk_hsdma_tasklet, (unsigned long)hsdma);
+
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0) {
+		dev_err(&pdev->dev, "failed to get irq\n");
+		return -EINVAL;
+	}
+	ret = devm_request_irq(&pdev->dev, irq, mtk_hsdma_irq,
+			       0, dev_name(&pdev->dev), hsdma);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to request irq\n");
+		return ret;
+	}
+
+	device_reset(&pdev->dev);
+
+	dd = &hsdma->ddev;
+	dma_cap_set(DMA_MEMCPY, dd->cap_mask);
+	dd->copy_align = HSDMA_ALIGN_SIZE;
+	dd->device_free_chan_resources = mtk_hsdma_free_chan_resources;
+	dd->device_prep_dma_memcpy = mtk_hsdma_prep_dma_memcpy;
+	dd->device_terminate_all = mtk_hsdma_terminate_all;
+	dd->device_tx_status = mtk_hsdma_tx_status;
+	dd->device_issue_pending = mtk_hsdma_issue_pending;
+	dd->dev = &pdev->dev;
+	dd->dev->dma_parms = &hsdma->dma_parms;
+	dma_set_max_seg_size(dd->dev, HSDMA_MAX_PLEN);
+	INIT_LIST_HEAD(&dd->channels);
+
+	chan = &hsdma->chan[0];
+	chan->id = 0;
+	chan->vchan.desc_free = mtk_hsdma_desc_free;
+	vchan_init(&chan->vchan, dd);
+
+	/* init hardware */
+	ret = mtk_hsdma_init(hsdma);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to alloc ring descs\n");
+		return ret;
+	}
+
+	ret = dma_async_device_register(dd);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to register dma device\n");
+		goto err_uninit_hsdma;
+	}
+
+	ret = of_dma_controller_register(pdev->dev.of_node,
+					 of_dma_xlate_by_chan_id, hsdma);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to register of dma controller\n");
+		goto err_unregister;
+	}
+
+	platform_set_drvdata(pdev, hsdma);
+
+	return 0;
+
+err_unregister:
+	dma_async_device_unregister(dd);
+err_uninit_hsdma:
+	mtk_hsdma_uninit(hsdma);
+	return ret;
+}
+
+static int mtk_hsdma_remove(struct platform_device *pdev)
+{
+	struct mtk_hsdam_engine *hsdma = platform_get_drvdata(pdev);
+
+	mtk_hsdma_uninit(hsdma);
+
+	of_dma_controller_free(pdev->dev.of_node);
+	dma_async_device_unregister(&hsdma->ddev);
+
+	return 0;
+}
+
+static struct platform_driver mtk_hsdma_driver = {
+	.probe = mtk_hsdma_probe,
+	.remove = mtk_hsdma_remove,
+	.driver = {
+		.name = KBUILD_MODNAME,
+		.of_match_table = mtk_hsdma_of_match,
+	},
+};
+module_platform_driver(mtk_hsdma_driver);
+
+MODULE_AUTHOR("Michael Lee <igvtee@gmail.com>");
+MODULE_DESCRIPTION("MTK HSDMA driver");
+MODULE_LICENSE("GPL v2");
--- a/drivers/staging/mt7621-dma/mtk-hsdma.c
+++ /dev/null
@@ -1,771 +0,0 @@
-/*
- *  Copyright (C) 2015, Michael Lee <igvtee@gmail.com>
- *  MTK HSDMA support
- *
- *  This program is free software; you can redistribute it and/or modify it
- *  under  the terms of the GNU General	 Public License as published by the
- *  Free Software Foundation;  either version 2 of the License, or (at your
- *  option) any later version.
- *
- */
-
-#include <linux/dmaengine.h>
-#include <linux/dma-mapping.h>
-#include <linux/err.h>
-#include <linux/init.h>
-#include <linux/list.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-#include <linux/spinlock.h>
-#include <linux/irq.h>
-#include <linux/of_dma.h>
-#include <linux/reset.h>
-#include <linux/of_device.h>
-
-#include "virt-dma.h"
-
-#define HSDMA_BASE_OFFSET		0x800
-
-#define HSDMA_REG_TX_BASE		0x00
-#define HSDMA_REG_TX_CNT		0x04
-#define HSDMA_REG_TX_CTX		0x08
-#define HSDMA_REG_TX_DTX		0x0c
-#define HSDMA_REG_RX_BASE		0x100
-#define HSDMA_REG_RX_CNT		0x104
-#define HSDMA_REG_RX_CRX		0x108
-#define HSDMA_REG_RX_DRX		0x10c
-#define HSDMA_REG_INFO			0x200
-#define HSDMA_REG_GLO_CFG		0x204
-#define HSDMA_REG_RST_CFG		0x208
-#define HSDMA_REG_DELAY_INT		0x20c
-#define HSDMA_REG_FREEQ_THRES		0x210
-#define HSDMA_REG_INT_STATUS		0x220
-#define HSDMA_REG_INT_MASK		0x228
-#define HSDMA_REG_SCH_Q01		0x280
-#define HSDMA_REG_SCH_Q23		0x284
-
-#define HSDMA_DESCS_MAX			0xfff
-#define HSDMA_DESCS_NUM			8
-#define HSDMA_DESCS_MASK		(HSDMA_DESCS_NUM - 1)
-#define HSDMA_NEXT_DESC(x)		(((x) + 1) & HSDMA_DESCS_MASK)
-
-/* HSDMA_REG_INFO */
-#define HSDMA_INFO_INDEX_MASK		0xf
-#define HSDMA_INFO_INDEX_SHIFT		24
-#define HSDMA_INFO_BASE_MASK		0xff
-#define HSDMA_INFO_BASE_SHIFT		16
-#define HSDMA_INFO_RX_MASK		0xff
-#define HSDMA_INFO_RX_SHIFT		8
-#define HSDMA_INFO_TX_MASK		0xff
-#define HSDMA_INFO_TX_SHIFT		0
-
-/* HSDMA_REG_GLO_CFG */
-#define HSDMA_GLO_TX_2B_OFFSET		BIT(31)
-#define HSDMA_GLO_CLK_GATE		BIT(30)
-#define HSDMA_GLO_BYTE_SWAP		BIT(29)
-#define HSDMA_GLO_MULTI_DMA		BIT(10)
-#define HSDMA_GLO_TWO_BUF		BIT(9)
-#define HSDMA_GLO_32B_DESC		BIT(8)
-#define HSDMA_GLO_BIG_ENDIAN		BIT(7)
-#define HSDMA_GLO_TX_DONE		BIT(6)
-#define HSDMA_GLO_BT_MASK		0x3
-#define HSDMA_GLO_BT_SHIFT		4
-#define HSDMA_GLO_RX_BUSY		BIT(3)
-#define HSDMA_GLO_RX_DMA		BIT(2)
-#define HSDMA_GLO_TX_BUSY		BIT(1)
-#define HSDMA_GLO_TX_DMA		BIT(0)
-
-#define HSDMA_BT_SIZE_16BYTES		(0 << HSDMA_GLO_BT_SHIFT)
-#define HSDMA_BT_SIZE_32BYTES		(1 << HSDMA_GLO_BT_SHIFT)
-#define HSDMA_BT_SIZE_64BYTES		(2 << HSDMA_GLO_BT_SHIFT)
-#define HSDMA_BT_SIZE_128BYTES		(3 << HSDMA_GLO_BT_SHIFT)
-
-#define HSDMA_GLO_DEFAULT		(HSDMA_GLO_MULTI_DMA | \
-		HSDMA_GLO_RX_DMA | HSDMA_GLO_TX_DMA | HSDMA_BT_SIZE_32BYTES)
-
-/* HSDMA_REG_RST_CFG */
-#define HSDMA_RST_RX_SHIFT		16
-#define HSDMA_RST_TX_SHIFT		0
-
-/* HSDMA_REG_DELAY_INT */
-#define HSDMA_DELAY_INT_EN		BIT(15)
-#define HSDMA_DELAY_PEND_OFFSET		8
-#define HSDMA_DELAY_TIME_OFFSET		0
-#define HSDMA_DELAY_TX_OFFSET		16
-#define HSDMA_DELAY_RX_OFFSET		0
-
-#define HSDMA_DELAY_INIT(x)		(HSDMA_DELAY_INT_EN | \
-		((x) << HSDMA_DELAY_PEND_OFFSET))
-#define HSDMA_DELAY(x)			((HSDMA_DELAY_INIT(x) << \
-		HSDMA_DELAY_TX_OFFSET) | HSDMA_DELAY_INIT(x))
-
-/* HSDMA_REG_INT_STATUS */
-#define HSDMA_INT_DELAY_RX_COH		BIT(31)
-#define HSDMA_INT_DELAY_RX_INT		BIT(30)
-#define HSDMA_INT_DELAY_TX_COH		BIT(29)
-#define HSDMA_INT_DELAY_TX_INT		BIT(28)
-#define HSDMA_INT_RX_MASK		0x3
-#define HSDMA_INT_RX_SHIFT		16
-#define HSDMA_INT_RX_Q0			BIT(16)
-#define HSDMA_INT_TX_MASK		0xf
-#define HSDMA_INT_TX_SHIFT		0
-#define HSDMA_INT_TX_Q0			BIT(0)
-
-/* tx/rx dma desc flags */
-#define HSDMA_PLEN_MASK			0x3fff
-#define HSDMA_DESC_DONE			BIT(31)
-#define HSDMA_DESC_LS0			BIT(30)
-#define HSDMA_DESC_PLEN0(_x)		(((_x) & HSDMA_PLEN_MASK) << 16)
-#define HSDMA_DESC_TAG			BIT(15)
-#define HSDMA_DESC_LS1			BIT(14)
-#define HSDMA_DESC_PLEN1(_x)		((_x) & HSDMA_PLEN_MASK)
-
-/* align 4 bytes */
-#define HSDMA_ALIGN_SIZE		3
-/* align size 128bytes */
-#define HSDMA_MAX_PLEN			0x3f80
-
-struct hsdma_desc {
-	u32 addr0;
-	u32 flags;
-	u32 addr1;
-	u32 unused;
-};
-
-struct mtk_hsdma_sg {
-	dma_addr_t src_addr;
-	dma_addr_t dst_addr;
-	u32 len;
-};
-
-struct mtk_hsdma_desc {
-	struct virt_dma_desc vdesc;
-	unsigned int num_sgs;
-	struct mtk_hsdma_sg sg[1];
-};
-
-struct mtk_hsdma_chan {
-	struct virt_dma_chan vchan;
-	unsigned int id;
-	dma_addr_t desc_addr;
-	int tx_idx;
-	int rx_idx;
-	struct hsdma_desc *tx_ring;
-	struct hsdma_desc *rx_ring;
-	struct mtk_hsdma_desc *desc;
-	unsigned int next_sg;
-};
-
-struct mtk_hsdam_engine {
-	struct dma_device ddev;
-	struct device_dma_parameters dma_parms;
-	void __iomem *base;
-	struct tasklet_struct task;
-	volatile unsigned long chan_issued;
-
-	struct mtk_hsdma_chan chan[1];
-};
-
-static inline struct mtk_hsdam_engine *mtk_hsdma_chan_get_dev(
-		struct mtk_hsdma_chan *chan)
-{
-	return container_of(chan->vchan.chan.device, struct mtk_hsdam_engine,
-			ddev);
-}
-
-static inline struct mtk_hsdma_chan *to_mtk_hsdma_chan(struct dma_chan *c)
-{
-	return container_of(c, struct mtk_hsdma_chan, vchan.chan);
-}
-
-static inline struct mtk_hsdma_desc *to_mtk_hsdma_desc(
-		struct virt_dma_desc *vdesc)
-{
-	return container_of(vdesc, struct mtk_hsdma_desc, vdesc);
-}
-
-static inline u32 mtk_hsdma_read(struct mtk_hsdam_engine *hsdma, u32 reg)
-{
-	return readl(hsdma->base + reg);
-}
-
-static inline void mtk_hsdma_write(struct mtk_hsdam_engine *hsdma,
-				   unsigned reg, u32 val)
-{
-	writel(val, hsdma->base + reg);
-}
-
-static void mtk_hsdma_reset_chan(struct mtk_hsdam_engine *hsdma,
-				 struct mtk_hsdma_chan *chan)
-{
-	chan->tx_idx = 0;
-	chan->rx_idx = HSDMA_DESCS_NUM - 1;
-
-	mtk_hsdma_write(hsdma, HSDMA_REG_TX_CTX, chan->tx_idx);
-	mtk_hsdma_write(hsdma, HSDMA_REG_RX_CRX, chan->rx_idx);
-
-	mtk_hsdma_write(hsdma, HSDMA_REG_RST_CFG,
-			0x1 << (chan->id + HSDMA_RST_TX_SHIFT));
-	mtk_hsdma_write(hsdma, HSDMA_REG_RST_CFG,
-			0x1 << (chan->id + HSDMA_RST_RX_SHIFT));
-}
-
-static void hsdma_dump_reg(struct mtk_hsdam_engine *hsdma)
-{
-	dev_dbg(hsdma->ddev.dev, "tbase %08x, tcnt %08x, " \
-			"tctx %08x, tdtx: %08x, rbase %08x, " \
-			"rcnt %08x, rctx %08x, rdtx %08x\n",
-			mtk_hsdma_read(hsdma, HSDMA_REG_TX_BASE),
-			mtk_hsdma_read(hsdma, HSDMA_REG_TX_CNT),
-			mtk_hsdma_read(hsdma, HSDMA_REG_TX_CTX),
-			mtk_hsdma_read(hsdma, HSDMA_REG_TX_DTX),
-			mtk_hsdma_read(hsdma, HSDMA_REG_RX_BASE),
-			mtk_hsdma_read(hsdma, HSDMA_REG_RX_CNT),
-			mtk_hsdma_read(hsdma, HSDMA_REG_RX_CRX),
-			mtk_hsdma_read(hsdma, HSDMA_REG_RX_DRX));
-
-	dev_dbg(hsdma->ddev.dev, "info %08x, glo %08x, delay %08x, " \
-			"intr_stat %08x, intr_mask %08x\n",
-			mtk_hsdma_read(hsdma, HSDMA_REG_INFO),
-			mtk_hsdma_read(hsdma, HSDMA_REG_GLO_CFG),
-			mtk_hsdma_read(hsdma, HSDMA_REG_DELAY_INT),
-			mtk_hsdma_read(hsdma, HSDMA_REG_INT_STATUS),
-			mtk_hsdma_read(hsdma, HSDMA_REG_INT_MASK));
-}
-
-static void hsdma_dump_desc(struct mtk_hsdam_engine *hsdma,
-			    struct mtk_hsdma_chan *chan)
-{
-	struct hsdma_desc *tx_desc;
-	struct hsdma_desc *rx_desc;
-	int i;
-
-	dev_dbg(hsdma->ddev.dev, "tx idx: %d, rx idx: %d\n",
-			chan->tx_idx, chan->rx_idx);
-
-	for (i = 0; i < HSDMA_DESCS_NUM; i++) {
-		tx_desc = &chan->tx_ring[i];
-		rx_desc = &chan->rx_ring[i];
-
-		dev_dbg(hsdma->ddev.dev, "%d tx addr0: %08x, flags %08x, " \
-				"tx addr1: %08x, rx addr0 %08x, flags %08x\n",
-				i, tx_desc->addr0, tx_desc->flags, \
-				tx_desc->addr1, rx_desc->addr0, rx_desc->flags);
-	}
-}
-
-static void mtk_hsdma_reset(struct mtk_hsdam_engine *hsdma,
-			    struct mtk_hsdma_chan *chan)
-{
-	int i;
-
-	/* disable dma */
-	mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, 0);
-
-	/* disable intr */
-	mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, 0);
-
-	/* init desc value */
-	for (i = 0; i < HSDMA_DESCS_NUM; i++) {
-		chan->tx_ring[i].addr0 = 0;
-		chan->tx_ring[i].flags = HSDMA_DESC_LS0 |
-			HSDMA_DESC_DONE;
-	}
-	for (i = 0; i < HSDMA_DESCS_NUM; i++) {
-		chan->rx_ring[i].addr0 = 0;
-		chan->rx_ring[i].flags = 0;
-	}
-
-	/* reset */
-	mtk_hsdma_reset_chan(hsdma, chan);
-
-	/* enable intr */
-	mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, HSDMA_INT_RX_Q0);
-
-	/* enable dma */
-	mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, HSDMA_GLO_DEFAULT);
-}
-
-static int mtk_hsdma_terminate_all(struct dma_chan *c)
-{
-	struct mtk_hsdma_chan *chan = to_mtk_hsdma_chan(c);
-	struct mtk_hsdam_engine *hsdma = mtk_hsdma_chan_get_dev(chan);
-	unsigned long timeout;
-	LIST_HEAD(head);
-
-	spin_lock_bh(&chan->vchan.lock);
-	chan->desc = NULL;
-	clear_bit(chan->id, &hsdma->chan_issued);
-	vchan_get_all_descriptors(&chan->vchan, &head);
-	spin_unlock_bh(&chan->vchan.lock);
-
-	vchan_dma_desc_free_list(&chan->vchan, &head);
-
-	/* wait dma transfer complete */
-	timeout = jiffies + msecs_to_jiffies(2000);
-	while (mtk_hsdma_read(hsdma, HSDMA_REG_GLO_CFG) &
-			(HSDMA_GLO_RX_BUSY | HSDMA_GLO_TX_BUSY)) {
-		if (time_after_eq(jiffies, timeout)) {
-			hsdma_dump_desc(hsdma, chan);
-			mtk_hsdma_reset(hsdma, chan);
-			dev_err(hsdma->ddev.dev, "timeout, reset it\n");
-			break;
-		}
-		cpu_relax();
-	}
-
-	return 0;
-}
-
-static int mtk_hsdma_start_transfer(struct mtk_hsdam_engine *hsdma,
-				    struct mtk_hsdma_chan *chan)
-{
-	dma_addr_t src, dst;
-	size_t len, tlen;
-	struct hsdma_desc *tx_desc, *rx_desc;
-	struct mtk_hsdma_sg *sg;
-	unsigned int i;
-	int rx_idx;
-
-	sg = &chan->desc->sg[0];
-	len = sg->len;
-	chan->desc->num_sgs = DIV_ROUND_UP(len, HSDMA_MAX_PLEN);
-
-	/* tx desc */
-	src = sg->src_addr;
-	for (i = 0; i < chan->desc->num_sgs; i++) {
-		tx_desc = &chan->tx_ring[chan->tx_idx];
-
-		if (len > HSDMA_MAX_PLEN)
-			tlen = HSDMA_MAX_PLEN;
-		else
-			tlen = len;
-
-		if (i & 0x1) {
-			tx_desc->addr1 = src;
-			tx_desc->flags |= HSDMA_DESC_PLEN1(tlen);
-		} else {
-			tx_desc->addr0 = src;
-			tx_desc->flags = HSDMA_DESC_PLEN0(tlen);
-
-			/* update index */
-			chan->tx_idx = HSDMA_NEXT_DESC(chan->tx_idx);
-		}
-
-		src += tlen;
-		len -= tlen;
-	}
-	if (i & 0x1)
-		tx_desc->flags |= HSDMA_DESC_LS0;
-	else
-		tx_desc->flags |= HSDMA_DESC_LS1;
-
-	/* rx desc */
-	rx_idx = HSDMA_NEXT_DESC(chan->rx_idx);
-	len = sg->len;
-	dst = sg->dst_addr;
-	for (i = 0; i < chan->desc->num_sgs; i++) {
-		rx_desc = &chan->rx_ring[rx_idx];
-		if (len > HSDMA_MAX_PLEN)
-			tlen = HSDMA_MAX_PLEN;
-		else
-			tlen = len;
-
-		rx_desc->addr0 = dst;
-		rx_desc->flags = HSDMA_DESC_PLEN0(tlen);
-
-		dst += tlen;
-		len -= tlen;
-
-		/* update index */
-		rx_idx = HSDMA_NEXT_DESC(rx_idx);
-	}
-
-	/* make sure desc and index all up to date */
-	wmb();
-	mtk_hsdma_write(hsdma, HSDMA_REG_TX_CTX, chan->tx_idx);
-
-	return 0;
-}
-
-static int gdma_next_desc(struct mtk_hsdma_chan *chan)
-{
-	struct virt_dma_desc *vdesc;
-
-	vdesc = vchan_next_desc(&chan->vchan);
-	if (!vdesc) {
-		chan->desc = NULL;
-		return 0;
-	}
-	chan->desc = to_mtk_hsdma_desc(vdesc);
-	chan->next_sg = 0;
-
-	return 1;
-}
-
-static void mtk_hsdma_chan_done(struct mtk_hsdam_engine *hsdma,
-				struct mtk_hsdma_chan *chan)
-{
-	struct mtk_hsdma_desc *desc;
-	int chan_issued;
-
-	chan_issued = 0;
-	spin_lock_bh(&chan->vchan.lock);
-	desc = chan->desc;
-	if (likely(desc)) {
-		if (chan->next_sg == desc->num_sgs) {
-			list_del(&desc->vdesc.node);
-			vchan_cookie_complete(&desc->vdesc);
-			chan_issued = gdma_next_desc(chan);
-		}
-	} else
-		dev_dbg(hsdma->ddev.dev, "no desc to complete\n");
-
-	if (chan_issued)
-		set_bit(chan->id, &hsdma->chan_issued);
-	spin_unlock_bh(&chan->vchan.lock);
-}
-
-static irqreturn_t mtk_hsdma_irq(int irq, void *devid)
-{
-	struct mtk_hsdam_engine *hsdma = devid;
-	u32 status;
-
-	status = mtk_hsdma_read(hsdma, HSDMA_REG_INT_STATUS);
-	if (unlikely(!status))
-		return IRQ_NONE;
-
-	if (likely(status & HSDMA_INT_RX_Q0))
-		tasklet_schedule(&hsdma->task);
-	else
-		dev_dbg(hsdma->ddev.dev, "unhandle irq status %08x\n",
-			status);
-	/* clean intr bits */
-	mtk_hsdma_write(hsdma, HSDMA_REG_INT_STATUS, status);
-
-	return IRQ_HANDLED;
-}
-
-static void mtk_hsdma_issue_pending(struct dma_chan *c)
-{
-	struct mtk_hsdma_chan *chan = to_mtk_hsdma_chan(c);
-	struct mtk_hsdam_engine *hsdma = mtk_hsdma_chan_get_dev(chan);
-
-	spin_lock_bh(&chan->vchan.lock);
-	if (vchan_issue_pending(&chan->vchan) && !chan->desc) {
-		if (gdma_next_desc(chan)) {
-			set_bit(chan->id, &hsdma->chan_issued);
-			tasklet_schedule(&hsdma->task);
-		} else
-			dev_dbg(hsdma->ddev.dev, "no desc to issue\n");
-	}
-	spin_unlock_bh(&chan->vchan.lock);
-}
-
-static struct dma_async_tx_descriptor *mtk_hsdma_prep_dma_memcpy(
-		struct dma_chan *c, dma_addr_t dest, dma_addr_t src,
-		size_t len, unsigned long flags)
-{
-	struct mtk_hsdma_chan *chan = to_mtk_hsdma_chan(c);
-	struct mtk_hsdma_desc *desc;
-
-	if (len <= 0)
-		return NULL;
-
-	desc = kzalloc(sizeof(struct mtk_hsdma_desc), GFP_ATOMIC);
-	if (!desc) {
-		dev_err(c->device->dev, "alloc memcpy decs error\n");
-		return NULL;
-	}
-
-	desc->sg[0].src_addr = src;
-	desc->sg[0].dst_addr = dest;
-	desc->sg[0].len = len;
-
-	return vchan_tx_prep(&chan->vchan, &desc->vdesc, flags);
-}
-
-static enum dma_status mtk_hsdma_tx_status(struct dma_chan *c,
-					   dma_cookie_t cookie,
-					   struct dma_tx_state *state)
-{
-	return dma_cookie_status(c, cookie, state);
-}
-
-static void mtk_hsdma_free_chan_resources(struct dma_chan *c)
-{
-	vchan_free_chan_resources(to_virt_chan(c));
-}
-
-static void mtk_hsdma_desc_free(struct virt_dma_desc *vdesc)
-{
-	kfree(container_of(vdesc, struct mtk_hsdma_desc, vdesc));
-}
-
-static void mtk_hsdma_tx(struct mtk_hsdam_engine *hsdma)
-{
-	struct mtk_hsdma_chan *chan;
-
-	if (test_and_clear_bit(0, &hsdma->chan_issued)) {
-		chan = &hsdma->chan[0];
-		if (chan->desc)
-			mtk_hsdma_start_transfer(hsdma, chan);
-		else
-			dev_dbg(hsdma->ddev.dev, "chan 0 no desc to issue\n");
-	}
-}
-
-static void mtk_hsdma_rx(struct mtk_hsdam_engine *hsdma)
-{
-	struct mtk_hsdma_chan *chan;
-	int next_idx, drx_idx, cnt;
-
-	chan = &hsdma->chan[0];
-	next_idx = HSDMA_NEXT_DESC(chan->rx_idx);
-	drx_idx = mtk_hsdma_read(hsdma, HSDMA_REG_RX_DRX);
-
-	cnt = (drx_idx - next_idx) & HSDMA_DESCS_MASK;
-	if (!cnt)
-		return;
-
-	chan->next_sg += cnt;
-	chan->rx_idx = (chan->rx_idx + cnt) & HSDMA_DESCS_MASK;
-
-	/* update rx crx */
-	wmb();
-	mtk_hsdma_write(hsdma, HSDMA_REG_RX_CRX, chan->rx_idx);
-
-	mtk_hsdma_chan_done(hsdma, chan);
-}
-
-static void mtk_hsdma_tasklet(unsigned long arg)
-{
-	struct mtk_hsdam_engine *hsdma = (struct mtk_hsdam_engine *)arg;
-
-	mtk_hsdma_rx(hsdma);
-	mtk_hsdma_tx(hsdma);
-}
-
-static int mtk_hsdam_alloc_desc(struct mtk_hsdam_engine *hsdma,
-				struct mtk_hsdma_chan *chan)
-{
-	int i;
-
-	chan->tx_ring = dma_alloc_coherent(hsdma->ddev.dev,
-			2 * HSDMA_DESCS_NUM * sizeof(*chan->tx_ring),
-			&chan->desc_addr, GFP_ATOMIC | __GFP_ZERO);
-	if (!chan->tx_ring)
-		goto no_mem;
-
-	chan->rx_ring = &chan->tx_ring[HSDMA_DESCS_NUM];
-
-	/* init tx ring value */
-	for (i = 0; i < HSDMA_DESCS_NUM; i++)
-		chan->tx_ring[i].flags = HSDMA_DESC_LS0 | HSDMA_DESC_DONE;
-
-	return 0;
-no_mem:
-	return -ENOMEM;
-}
-
-static void mtk_hsdam_free_desc(struct mtk_hsdam_engine *hsdma,
-				struct mtk_hsdma_chan *chan)
-{
-	if (chan->tx_ring) {
-		dma_free_coherent(hsdma->ddev.dev,
-				2 * HSDMA_DESCS_NUM * sizeof(*chan->tx_ring),
-				chan->tx_ring, chan->desc_addr);
-		chan->tx_ring = NULL;
-		chan->rx_ring = NULL;
-	}
-}
-
-static int mtk_hsdma_init(struct mtk_hsdam_engine *hsdma)
-{
-	struct mtk_hsdma_chan *chan;
-	int ret;
-	u32 reg;
-
-	/* init desc */
-	chan = &hsdma->chan[0];
-	ret = mtk_hsdam_alloc_desc(hsdma, chan);
-	if (ret)
-		return ret;
-
-	/* tx */
-	mtk_hsdma_write(hsdma, HSDMA_REG_TX_BASE, chan->desc_addr);
-	mtk_hsdma_write(hsdma, HSDMA_REG_TX_CNT, HSDMA_DESCS_NUM);
-	/* rx */
-	mtk_hsdma_write(hsdma, HSDMA_REG_RX_BASE, chan->desc_addr +
-			(sizeof(struct hsdma_desc) * HSDMA_DESCS_NUM));
-	mtk_hsdma_write(hsdma, HSDMA_REG_RX_CNT, HSDMA_DESCS_NUM);
-	/* reset */
-	mtk_hsdma_reset_chan(hsdma, chan);
-
-	/* enable rx intr */
-	mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, HSDMA_INT_RX_Q0);
-
-	/* enable dma */
-	mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, HSDMA_GLO_DEFAULT);
-
-	/* hardware info */
-	reg = mtk_hsdma_read(hsdma, HSDMA_REG_INFO);
-	dev_info(hsdma->ddev.dev, "rx: %d, tx: %d\n",
-		 (reg >> HSDMA_INFO_RX_SHIFT) & HSDMA_INFO_RX_MASK,
-		 (reg >> HSDMA_INFO_TX_SHIFT) & HSDMA_INFO_TX_MASK);
-
-	hsdma_dump_reg(hsdma);
-
-	return ret;
-}
-
-static void mtk_hsdma_uninit(struct mtk_hsdam_engine *hsdma)
-{
-	struct mtk_hsdma_chan *chan;
-
-	/* disable dma */
-	mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, 0);
-
-	/* disable intr */
-	mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, 0);
-
-	/* free desc */
-	chan = &hsdma->chan[0];
-	mtk_hsdam_free_desc(hsdma, chan);
-
-	/* tx */
-	mtk_hsdma_write(hsdma, HSDMA_REG_TX_BASE, 0);
-	mtk_hsdma_write(hsdma, HSDMA_REG_TX_CNT, 0);
-	/* rx */
-	mtk_hsdma_write(hsdma, HSDMA_REG_RX_BASE, 0);
-	mtk_hsdma_write(hsdma, HSDMA_REG_RX_CNT, 0);
-	/* reset */
-	mtk_hsdma_reset_chan(hsdma, chan);
-}
-
-static const struct of_device_id mtk_hsdma_of_match[] = {
-	{ .compatible = "mediatek,mt7621-hsdma" },
-	{ },
-};
-
-static int mtk_hsdma_probe(struct platform_device *pdev)
-{
-	const struct of_device_id *match;
-	struct mtk_hsdma_chan *chan;
-	struct mtk_hsdam_engine *hsdma;
-	struct dma_device *dd;
-	struct resource *res;
-	int ret;
-	int irq;
-	void __iomem *base;
-
-	ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
-	if (ret)
-		return ret;
-
-	match = of_match_device(mtk_hsdma_of_match, &pdev->dev);
-	if (!match)
-		return -EINVAL;
-
-	hsdma = devm_kzalloc(&pdev->dev, sizeof(*hsdma), GFP_KERNEL);
-	if (!hsdma) {
-		dev_err(&pdev->dev, "alloc dma device failed\n");
-		return -EINVAL;
-	}
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	base = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(base))
-		return PTR_ERR(base);
-	hsdma->base = base + HSDMA_BASE_OFFSET;
-	tasklet_init(&hsdma->task, mtk_hsdma_tasklet, (unsigned long)hsdma);
-
-	irq = platform_get_irq(pdev, 0);
-	if (irq < 0) {
-		dev_err(&pdev->dev, "failed to get irq\n");
-		return -EINVAL;
-	}
-	ret = devm_request_irq(&pdev->dev, irq, mtk_hsdma_irq,
-			       0, dev_name(&pdev->dev), hsdma);
-	if (ret) {
-		dev_err(&pdev->dev, "failed to request irq\n");
-		return ret;
-	}
-
-	device_reset(&pdev->dev);
-
-	dd = &hsdma->ddev;
-	dma_cap_set(DMA_MEMCPY, dd->cap_mask);
-	dd->copy_align = HSDMA_ALIGN_SIZE;
-	dd->device_free_chan_resources = mtk_hsdma_free_chan_resources;
-	dd->device_prep_dma_memcpy = mtk_hsdma_prep_dma_memcpy;
-	dd->device_terminate_all = mtk_hsdma_terminate_all;
-	dd->device_tx_status = mtk_hsdma_tx_status;
-	dd->device_issue_pending = mtk_hsdma_issue_pending;
-	dd->dev = &pdev->dev;
-	dd->dev->dma_parms = &hsdma->dma_parms;
-	dma_set_max_seg_size(dd->dev, HSDMA_MAX_PLEN);
-	INIT_LIST_HEAD(&dd->channels);
-
-	chan = &hsdma->chan[0];
-	chan->id = 0;
-	chan->vchan.desc_free = mtk_hsdma_desc_free;
-	vchan_init(&chan->vchan, dd);
-
-	/* init hardware */
-	ret = mtk_hsdma_init(hsdma);
-	if (ret) {
-		dev_err(&pdev->dev, "failed to alloc ring descs\n");
-		return ret;
-	}
-
-	ret = dma_async_device_register(dd);
-	if (ret) {
-		dev_err(&pdev->dev, "failed to register dma device\n");
-		goto err_uninit_hsdma;
-	}
-
-	ret = of_dma_controller_register(pdev->dev.of_node,
-					 of_dma_xlate_by_chan_id, hsdma);
-	if (ret) {
-		dev_err(&pdev->dev, "failed to register of dma controller\n");
-		goto err_unregister;
-	}
-
-	platform_set_drvdata(pdev, hsdma);
-
-	return 0;
-
-err_unregister:
-	dma_async_device_unregister(dd);
-err_uninit_hsdma:
-	mtk_hsdma_uninit(hsdma);
-	return ret;
-}
-
-static int mtk_hsdma_remove(struct platform_device *pdev)
-{
-	struct mtk_hsdam_engine *hsdma = platform_get_drvdata(pdev);
-
-	mtk_hsdma_uninit(hsdma);
-
-	of_dma_controller_free(pdev->dev.of_node);
-	dma_async_device_unregister(&hsdma->ddev);
-
-	return 0;
-}
-
-static struct platform_driver mtk_hsdma_driver = {
-	.probe = mtk_hsdma_probe,
-	.remove = mtk_hsdma_remove,
-	.driver = {
-		.name = "hsdma-mt7621",
-		.of_match_table = mtk_hsdma_of_match,
-	},
-};
-module_platform_driver(mtk_hsdma_driver);
-
-MODULE_AUTHOR("Michael Lee <igvtee@gmail.com>");
-MODULE_DESCRIPTION("MTK HSDMA driver");
-MODULE_LICENSE("GPL v2");



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

* [PATCH 4.19 210/247] staging: gdm724x: Fix DMA from stack
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (208 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 209/247] staging/mt7621-dma: mtk-hsdma.c->hsdma-mt7621.c Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 211/247] staging: rtl8188eu: Add Edimax EW-7811UN V2 to device table Greg Kroah-Hartman
                   ` (39 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Amey Narkhede

From: Amey Narkhede <ameynarkhede03@gmail.com>

commit 7c3a0635cd008eaca9a734dc802709ee0b81cac5 upstream.

Stack allocated buffers cannot be used for DMA
on all architectures so allocate hci_packet buffer
using kmalloc.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Amey Narkhede <ameynarkhede03@gmail.com>
Link: https://lore.kernel.org/r/20210211053819.34858-1-ameynarkhede03@gmail.com
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/gdm724x/gdm_usb.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

--- a/drivers/staging/gdm724x/gdm_usb.c
+++ b/drivers/staging/gdm724x/gdm_usb.c
@@ -56,20 +56,24 @@ static int gdm_usb_recv(void *priv_dev,
 
 static int request_mac_address(struct lte_udev *udev)
 {
-	u8 buf[16] = {0,};
-	struct hci_packet *hci = (struct hci_packet *)buf;
+	struct hci_packet *hci;
 	struct usb_device *usbdev = udev->usbdev;
 	int actual;
 	int ret = -1;
 
+	hci = kmalloc(struct_size(hci, data, 1), GFP_KERNEL);
+	if (!hci)
+		return -ENOMEM;
+
 	hci->cmd_evt = gdm_cpu_to_dev16(udev->gdm_ed, LTE_GET_INFORMATION);
 	hci->len = gdm_cpu_to_dev16(udev->gdm_ed, 1);
 	hci->data[0] = MAC_ADDRESS;
 
-	ret = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 2), buf, 5,
+	ret = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 2), hci, 5,
 			   &actual, 1000);
 
 	udev->request_mac_addr = 1;
+	kfree(hci);
 
 	return ret;
 }



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

* [PATCH 4.19 211/247] staging: rtl8188eu: Add Edimax EW-7811UN V2 to device table
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (209 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 210/247] staging: gdm724x: Fix DMA from stack Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 212/247] media: ipu3-cio2: Fix mbus_code processing in cio2_subdev_set_fmt() Greg Kroah-Hartman
                   ` (38 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Martin Kaiser

From: Martin Kaiser <martin@kaiser.cx>

commit 7a8d2f1908a59003e55ef8691d09efb7fbc51625 upstream.

The Edimax EW-7811UN V2 uses an RTL8188EU chipset and works with this
driver.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210204085217.9743-1-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -41,6 +41,7 @@ static const struct usb_device_id rtw_us
 	{USB_DEVICE(0x2357, 0x0111)}, /* TP-Link TL-WN727N v5.21 */
 	{USB_DEVICE(0x2C4E, 0x0102)}, /* MERCUSYS MW150US v2 */
 	{USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */
+	{USB_DEVICE(0x7392, 0xb811)}, /* Edimax EW-7811UN V2 */
 	{USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */
 	{}	/* Terminating entry */
 };



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

* [PATCH 4.19 212/247] media: ipu3-cio2: Fix mbus_code processing in cio2_subdev_set_fmt()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (210 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 211/247] staging: rtl8188eu: Add Edimax EW-7811UN V2 to device table Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 213/247] x86/reboot: Force all cpus to exit VMX root if VMX is supported Greg Kroah-Hartman
                   ` (37 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pavel Machek (CIP),
	Laurent Pinchart, Sakari Ailus, Mauro Carvalho Chehab

From: Pavel Machek <pavel@denx.de>

commit 334de4b45892f7e67074e1b1b2ac36fd3e091118 upstream.

Loop was useless as it would always exit on the first iteration. Fix
it with right condition.

Signed-off-by: Pavel Machek (CIP) <pavel@denx.de>
Fixes: a86cf9b29e8b ("media: ipu3-cio2: Validate mbus format in setting subdev format")
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: stable@vger.kernel.org # v4.16 and up
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/media/pci/intel/ipu3/ipu3-cio2.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
@@ -1290,7 +1290,7 @@ static int cio2_subdev_set_fmt(struct v4
 	fmt->format.code = formats[0].mbus_code;
 
 	for (i = 0; i < ARRAY_SIZE(formats); i++) {
-		if (formats[i].mbus_code == fmt->format.code) {
+		if (formats[i].mbus_code == mbus_code) {
 			fmt->format.code = mbus_code;
 			break;
 		}



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

* [PATCH 4.19 213/247] x86/reboot: Force all cpus to exit VMX root if VMX is supported
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (211 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 212/247] media: ipu3-cio2: Fix mbus_code processing in cio2_subdev_set_fmt() Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 214/247] floppy: reintroduce O_NDELAY fix Greg Kroah-Hartman
                   ` (36 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sean Christopherson, David P. Reed,
	Paolo Bonzini

From: Sean Christopherson <seanjc@google.com>

commit ed72736183c45a413a8d6974dd04be90f514cb6b upstream.

Force all CPUs to do VMXOFF (via NMI shootdown) during an emergency
reboot if VMX is _supported_, as VMX being off on the current CPU does
not prevent other CPUs from being in VMX root (post-VMXON).  This fixes
a bug where a crash/panic reboot could leave other CPUs in VMX root and
prevent them from being woken via INIT-SIPI-SIPI in the new kernel.

Fixes: d176720d34c7 ("x86: disable VMX on all CPUs on reboot")
Cc: stable@vger.kernel.org
Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: David P. Reed <dpreed@deepplum.com>
[sean: reworked changelog and further tweaked comment]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20201231002702.2223707-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/x86/kernel/reboot.c |   29 ++++++++++-------------------
 1 file changed, 10 insertions(+), 19 deletions(-)

--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -538,29 +538,20 @@ static void emergency_vmx_disable_all(vo
 	local_irq_disable();
 
 	/*
-	 * We need to disable VMX on all CPUs before rebooting, otherwise
-	 * we risk hanging up the machine, because the CPU ignore INIT
-	 * signals when VMX is enabled.
+	 * Disable VMX on all CPUs before rebooting, otherwise we risk hanging
+	 * the machine, because the CPU blocks INIT when it's in VMX root.
 	 *
-	 * We can't take any locks and we may be on an inconsistent
-	 * state, so we use NMIs as IPIs to tell the other CPUs to disable
-	 * VMX and halt.
+	 * We can't take any locks and we may be on an inconsistent state, so
+	 * use NMIs as IPIs to tell the other CPUs to exit VMX root and halt.
 	 *
-	 * For safety, we will avoid running the nmi_shootdown_cpus()
-	 * stuff unnecessarily, but we don't have a way to check
-	 * if other CPUs have VMX enabled. So we will call it only if the
-	 * CPU we are running on has VMX enabled.
-	 *
-	 * We will miss cases where VMX is not enabled on all CPUs. This
-	 * shouldn't do much harm because KVM always enable VMX on all
-	 * CPUs anyway. But we can miss it on the small window where KVM
-	 * is still enabling VMX.
+	 * Do the NMI shootdown even if VMX if off on _this_ CPU, as that
+	 * doesn't prevent a different CPU from being in VMX root operation.
 	 */
-	if (cpu_has_vmx() && cpu_vmx_enabled()) {
-		/* Disable VMX on this CPU. */
-		cpu_vmxoff();
+	if (cpu_has_vmx()) {
+		/* Safely force _this_ CPU out of VMX root operation. */
+		__cpu_emergency_vmxoff();
 
-		/* Halt and disable VMX on the other CPUs */
+		/* Halt and exit VMX root operation on the other CPUs. */
 		nmi_shootdown_cpus(vmxoff_nmi);
 
 	}



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

* [PATCH 4.19 214/247] floppy: reintroduce O_NDELAY fix
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (212 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 213/247] x86/reboot: Force all cpus to exit VMX root if VMX is supported Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 215/247] arm64: uprobe: Return EOPNOTSUPP for AARCH32 instruction probing Greg Kroah-Hartman
                   ` (35 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Wim Osterholt, Jiri Kosina,
	Denis Efremov, Kurt Garloff

From: Jiri Kosina <jkosina@suse.cz>

commit 8a0c014cd20516ade9654fc13b51345ec58e7be8 upstream.

This issue was originally fixed in 09954bad4 ("floppy: refactor open()
flags handling").

The fix as a side-effect, however, introduce issue for open(O_ACCMODE)
that is being used for ioctl-only open. I wrote a fix for that, but
instead of it being merged, full revert of 09954bad4 was performed,
re-introducing the O_NDELAY / O_NONBLOCK issue, and it strikes again.

This is a forward-port of the original fix to current codebase; the
original submission had the changelog below:

====
Commit 09954bad4 ("floppy: refactor open() flags handling"), as a
side-effect, causes open(/dev/fdX, O_ACCMODE) to fail. It turns out that
this is being used setfdprm userspace for ioctl-only open().

Reintroduce back the original behavior wrt !(FMODE_READ|FMODE_WRITE)
modes, while still keeping the original O_NDELAY bug fixed.

Link: https://lore.kernel.org/r/nycvar.YFH.7.76.2101221209060.5622@cbobk.fhfr.pm
Cc: stable@vger.kernel.org
Reported-by: Wim Osterholt <wim@djo.tudelft.nl>
Tested-by: Wim Osterholt <wim@djo.tudelft.nl>
Reported-and-tested-by: Kurt Garloff <kurt@garloff.de>
Fixes: 09954bad4 ("floppy: refactor open() flags handling")
Fixes: f2791e7ead ("Revert "floppy: refactor open() flags handling"")
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Denis Efremov <efremov@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/block/floppy.c |   27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4074,21 +4074,22 @@ static int floppy_open(struct block_devi
 	if (UFDCS->rawcmd == 1)
 		UFDCS->rawcmd = 2;
 
-	if (!(mode & FMODE_NDELAY)) {
-		if (mode & (FMODE_READ|FMODE_WRITE)) {
-			UDRS->last_checked = 0;
-			clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags);
-			check_disk_change(bdev);
-			if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags))
-				goto out;
-			if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags))
-				goto out;
-		}
-		res = -EROFS;
-		if ((mode & FMODE_WRITE) &&
-		    !test_bit(FD_DISK_WRITABLE_BIT, &UDRS->flags))
+	if (mode & (FMODE_READ|FMODE_WRITE)) {
+		UDRS->last_checked = 0;
+		clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags);
+		check_disk_change(bdev);
+		if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags))
+			goto out;
+		if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags))
 			goto out;
 	}
+
+	res = -EROFS;
+
+	if ((mode & FMODE_WRITE) &&
+			!test_bit(FD_DISK_WRITABLE_BIT, &UDRS->flags))
+		goto out;
+
 	mutex_unlock(&open_lock);
 	mutex_unlock(&floppy_mutex);
 	return 0;



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

* [PATCH 4.19 215/247] arm64: uprobe: Return EOPNOTSUPP for AARCH32 instruction probing
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (213 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 214/247] floppy: reintroduce O_NDELAY fix Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 216/247] watchdog: mei_wdt: request stop on unregister Greg Kroah-Hartman
                   ` (34 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, He Zhe, Will Deacon

From: He Zhe <zhe.he@windriver.com>

commit d47422d953e258ad587b5edf2274eb95d08bdc7d upstream.

As stated in linux/errno.h, ENOTSUPP should never be seen by user programs.
When we set up uprobe with 32-bit perf and arm64 kernel, we would see the
following vague error without useful hint.

The sys_perf_event_open() syscall returned with 524 (INTERNAL ERROR:
strerror_r(524, [buf], 128)=22)

Use EOPNOTSUPP instead to indicate such cases.

Signed-off-by: He Zhe <zhe.he@windriver.com>
Link: https://lore.kernel.org/r/20210223082535.48730-1-zhe.he@windriver.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arm64/kernel/probes/uprobes.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arm64/kernel/probes/uprobes.c
+++ b/arch/arm64/kernel/probes/uprobes.c
@@ -41,7 +41,7 @@ int arch_uprobe_analyze_insn(struct arch
 
 	/* TODO: Currently we do not support AARCH32 instruction probing */
 	if (mm->context.flags & MMCF_AARCH32)
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 	else if (!IS_ALIGNED(addr, AARCH64_INSN_SIZE))
 		return -EINVAL;
 



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

* [PATCH 4.19 216/247] watchdog: mei_wdt: request stop on unregister
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (214 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 215/247] arm64: uprobe: Return EOPNOTSUPP for AARCH32 instruction probing Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 217/247] mtd: spi-nor: hisi-sfc: Put child node np on error path Greg Kroah-Hartman
                   ` (33 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alexander Usyskin, Tomas Winkler,
	Guenter Roeck, Wim Van Sebroeck

From: Alexander Usyskin <alexander.usyskin@intel.com>

commit 740c0a57b8f1e36301218bf549f3c9cc833a60be upstream.

The MEI bus has a special behavior on suspend it destroys
all the attached devices, this is due to the fact that also
firmware context is not persistent across power flows.

If watchdog on MEI bus is ticking before suspending the firmware
times out and reports that the OS is missing watchdog tick.
Send the stop command to the firmware on watchdog unregistered
to eliminate the false event on suspend.
This does not make the things worse from the user-space perspective
as a user-space should re-open watchdog device after
suspending before this patch.

Cc: <stable@vger.kernel.org>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20210124114938.373885-1-tomas.winkler@intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/watchdog/mei_wdt.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/watchdog/mei_wdt.c
+++ b/drivers/watchdog/mei_wdt.c
@@ -382,6 +382,7 @@ static int mei_wdt_register(struct mei_w
 
 	watchdog_set_drvdata(&wdt->wdd, wdt);
 	watchdog_stop_on_reboot(&wdt->wdd);
+	watchdog_stop_on_unregister(&wdt->wdd);
 
 	ret = watchdog_register_device(&wdt->wdd);
 	if (ret) {



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

* [PATCH 4.19 217/247] mtd: spi-nor: hisi-sfc: Put child node np on error path
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (215 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 216/247] watchdog: mei_wdt: request stop on unregister Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 218/247] fs/affs: release old buffer head " Greg Kroah-Hartman
                   ` (32 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Pan Bian, Tudor Ambarus

From: Pan Bian <bianpan2016@163.com>

commit fe6653460ee7a7dbe0cd5fd322992af862ce5ab0 upstream.

Put the child node np when it fails to get or register device.

Fixes: e523f11141bd ("mtd: spi-nor: add hisilicon spi-nor flash controller driver")
Cc: stable@vger.kernel.org
Signed-off-by: Pan Bian <bianpan2016@163.com>
[ta: Add Fixes tag and Cc stable]
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Link: https://lore.kernel.org/r/20210121091847.85362-1-bianpan2016@163.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/mtd/spi-nor/hisi-sfc.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/mtd/spi-nor/hisi-sfc.c
+++ b/drivers/mtd/spi-nor/hisi-sfc.c
@@ -408,8 +408,10 @@ static int hisi_spi_nor_register_all(str
 
 	for_each_available_child_of_node(dev->of_node, np) {
 		ret = hisi_spi_nor_register(np, host);
-		if (ret)
+		if (ret) {
+			of_node_put(np);
 			goto fail;
+		}
 
 		if (host->num_chip == HIFMC_MAX_CHIP_NUM) {
 			dev_warn(dev, "Flash device number exceeds the maximum chipselect number\n");



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

* [PATCH 4.19 218/247] fs/affs: release old buffer head on error path
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (216 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 217/247] mtd: spi-nor: hisi-sfc: Put child node np on error path Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:13 ` [PATCH 4.19 219/247] seq_file: document how per-entry resources are managed Greg Kroah-Hartman
                   ` (31 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Pan Bian, David Sterba

From: Pan Bian <bianpan2016@163.com>

commit 70779b897395b330ba5a47bed84f94178da599f9 upstream.

The reference count of the old buffer head should be decremented on path
that fails to get the new buffer head.

Fixes: 6b4657667ba0 ("fs/affs: add rename exchange")
CC: stable@vger.kernel.org # 4.14+
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/affs/namei.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -460,8 +460,10 @@ affs_xrename(struct inode *old_dir, stru
 		return -EIO;
 
 	bh_new = affs_bread(sb, d_inode(new_dentry)->i_ino);
-	if (!bh_new)
+	if (!bh_new) {
+		affs_brelse(bh_old);
 		return -EIO;
+	}
 
 	/* Remove old header from its parent directory. */
 	affs_lock_dir(old_dir);



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

* [PATCH 4.19 219/247] seq_file: document how per-entry resources are managed.
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (217 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 218/247] fs/affs: release old buffer head " Greg Kroah-Hartman
@ 2021-03-01 16:13 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 220/247] x86: fix seq_file iteration for pat/memtype.c Greg Kroah-Hartman
                   ` (30 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, NeilBrown, Xin Long, Alexander Viro,
	Jonathan Corbet, Ingo Molnar, Dave Hansen, Andy Lutomirski,
	Peter Zijlstra, Vlad Yasevich, Neil Horman,
	Marcelo Ricardo Leitner, David S. Miller, Andrew Morton,
	Linus Torvalds

From: NeilBrown <neilb@suse.de>

commit b3656d8227f4c45812c6b40815d8f4e446ed372a upstream.

Patch series "Fix some seq_file users that were recently broken".

A recent change to seq_file broke some users which were using seq_file
in a non-"standard" way ...  though the "standard" isn't documented, so
they can be excused.  The result is a possible leak - of memory in one
case, of references to a 'transport' in the other.

These three patches:
 1/ document and explain the problem
 2/ fix the problem user in x86
 3/ fix the problem user in net/sctp

This patch (of 3):

Users of seq_file will sometimes find it convenient to take a resource,
such as a lock or memory allocation, in the ->start or ->next operations.
These are per-entry resources, distinct from per-session resources which
are taken in ->start and released in ->stop.

The preferred management of these is release the resource on the
subsequent call to ->next or ->stop.

However prior to Commit 1f4aace60b0e ("fs/seq_file.c: simplify seq_file
iteration code and interface") it happened that ->show would always be
called after ->start or ->next, and a few users chose to release the
resource in ->show.

This is no longer reliable.  Since the mentioned commit, ->next will
always come after a successful ->show (to ensure m->index is updated
correctly), so the original ordering cannot be maintained.

This patch updates the documentation to clearly state the required
behaviour.  Other patches will fix the few problematic users.

[akpm@linux-foundation.org: fix typo, per Willy]

Link: https://lkml.kernel.org/r/161248518659.21478.2484341937387294998.stgit@noble1
Link: https://lkml.kernel.org/r/161248539020.21478.3147971477400875336.stgit@noble1
Fixes: 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code and interface")
Signed-off-by: NeilBrown <neilb@suse.de>
Cc: Xin Long <lucien.xin@gmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Vlad Yasevich <vyasevich@gmail.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 Documentation/filesystems/seq_file.txt |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/Documentation/filesystems/seq_file.txt
+++ b/Documentation/filesystems/seq_file.txt
@@ -192,6 +192,12 @@ between the calls to start() and stop(),
 is a reasonable thing to do. The seq_file code will also avoid taking any
 other locks while the iterator is active.
 
+The iterater value returned by start() or next() is guaranteed to be
+passed to a subsequent next() or stop() call.  This allows resources
+such as locks that were taken to be reliably released.  There is *no*
+guarantee that the iterator will be passed to show(), though in practice
+it often will be.
+
 
 Formatted output
 



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

* [PATCH 4.19 220/247] x86: fix seq_file iteration for pat/memtype.c
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (218 preceding siblings ...)
  2021-03-01 16:13 ` [PATCH 4.19 219/247] seq_file: document how per-entry resources are managed Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 221/247] hugetlb: fix copy_huge_page_from_user contig page struct assumption Greg Kroah-Hartman
                   ` (29 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, NeilBrown, Xin Long, Alexander Viro,
	Andy Lutomirski, Dave Hansen, David S. Miller, Ingo Molnar,
	Jonathan Corbet, Marcelo Ricardo Leitner, Neil Horman,
	Peter Zijlstra, Vlad Yasevich, Andrew Morton, Linus Torvalds

From: NeilBrown <neilb@suse.de>

commit 3d2fc4c082448e9c05792f9b2a11c1d5db408b85 upstream.

The memtype seq_file iterator allocates a buffer in the ->start and ->next
functions and frees it in the ->show function.  The preferred handling for
such resources is to free them in the subsequent ->next or ->stop function
call.

Since Commit 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration
code and interface") there is no guarantee that ->show will be called
after ->next, so this function can now leak memory.

So move the freeing of the buffer to ->next and ->stop.

Link: https://lkml.kernel.org/r/161248539022.21478.13874455485854739066.stgit@noble1
Fixes: 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code and interface")
Signed-off-by: NeilBrown <neilb@suse.de>
Cc: Xin Long <lucien.xin@gmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Vlad Yasevich <vyasevich@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/x86/mm/pat.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -1131,12 +1131,14 @@ static void *memtype_seq_start(struct se
 
 static void *memtype_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 {
+	kfree(v);
 	++*pos;
 	return memtype_get_idx(*pos);
 }
 
 static void memtype_seq_stop(struct seq_file *seq, void *v)
 {
+	kfree(v);
 }
 
 static int memtype_seq_show(struct seq_file *seq, void *v)
@@ -1145,7 +1147,6 @@ static int memtype_seq_show(struct seq_f
 
 	seq_printf(seq, "%s @ 0x%Lx-0x%Lx\n", cattr_name(print_entry->type),
 			print_entry->start, print_entry->end);
-	kfree(print_entry);
 
 	return 0;
 }



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

* [PATCH 4.19 221/247] hugetlb: fix copy_huge_page_from_user contig page struct assumption
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (219 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 220/247] x86: fix seq_file iteration for pat/memtype.c Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 222/247] libnvdimm/dimm: Avoid race between probe and available_slots_show() Greg Kroah-Hartman
                   ` (28 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mike Kravetz, Zi Yan,
	Davidlohr Bueso, Kirill A . Shutemov, Andrea Arcangeli,
	Matthew Wilcox, Oscar Salvador, Joao Martins, Andrew Morton,
	Linus Torvalds

From: Mike Kravetz <mike.kravetz@oracle.com>

commit 3272cfc2525b3a2810a59312d7a1e6f04a0ca3ef upstream.

page structs are not guaranteed to be contiguous for gigantic pages.  The
routine copy_huge_page_from_user can encounter gigantic pages, yet it
assumes page structs are contiguous when copying pages from user space.

Since page structs for the target gigantic page are not contiguous, the
data copied from user space could overwrite other pages not associated
with the gigantic page and cause data corruption.

Non-contiguous page structs are generally not an issue.  However, they can
exist with a specific kernel configuration and hotplug operations.  For
example: Configure the kernel with CONFIG_SPARSEMEM and
!CONFIG_SPARSEMEM_VMEMMAP.  Then, hotplug add memory for the area where
the gigantic page will be allocated.

Link: https://lkml.kernel.org/r/20210217184926.33567-2-mike.kravetz@oracle.com
Fixes: 8fb5debc5fcd ("userfaultfd: hugetlbfs: add hugetlb_mcopy_atomic_pte for userfaultfd support")
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Davidlohr Bueso <dbueso@suse.de>
Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Joao Martins <joao.m.martins@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 mm/memory.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4885,17 +4885,19 @@ long copy_huge_page_from_user(struct pag
 	void *page_kaddr;
 	unsigned long i, rc = 0;
 	unsigned long ret_val = pages_per_huge_page * PAGE_SIZE;
+	struct page *subpage = dst_page;
 
-	for (i = 0; i < pages_per_huge_page; i++) {
+	for (i = 0; i < pages_per_huge_page;
+	     i++, subpage = mem_map_next(subpage, dst_page, i)) {
 		if (allow_pagefault)
-			page_kaddr = kmap(dst_page + i);
+			page_kaddr = kmap(subpage);
 		else
-			page_kaddr = kmap_atomic(dst_page + i);
+			page_kaddr = kmap_atomic(subpage);
 		rc = copy_from_user(page_kaddr,
 				(const void __user *)(src + i * PAGE_SIZE),
 				PAGE_SIZE);
 		if (allow_pagefault)
-			kunmap(dst_page + i);
+			kunmap(subpage);
 		else
 			kunmap_atomic(page_kaddr);
 



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

* [PATCH 4.19 222/247] libnvdimm/dimm: Avoid race between probe and available_slots_show()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (220 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 221/247] hugetlb: fix copy_huge_page_from_user contig page struct assumption Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 223/247] arm64: Extend workaround for erratum 1024718 to all versions of Cortex-A55 Greg Kroah-Hartman
                   ` (27 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Vishal Verma, Dave Jiang, Ira Weiny,
	Coly Li, Richard Palethorpe, Dan Williams, Sudip Mukherjee

From: Dan Williams <dan.j.williams@intel.com>

commit 7018c897c2f243d4b5f1b94bc6b4831a7eab80fb upstream

Richard reports that the following test:

(while true; do
     cat /sys/bus/nd/devices/nmem*/available_slots 2>&1 > /dev/null
 done) &

while true; do
     for i in $(seq 0 4); do
         echo nmem$i > /sys/bus/nd/drivers/nvdimm/bind
     done
     for i in $(seq 0 4); do
         echo nmem$i > /sys/bus/nd/drivers/nvdimm/unbind
     done
 done

...fails with a crash signature like:

    divide error: 0000 [#1] SMP KASAN PTI
    RIP: 0010:nd_label_nfree+0x134/0x1a0 [libnvdimm]
    [..]
    Call Trace:
     available_slots_show+0x4e/0x120 [libnvdimm]
     dev_attr_show+0x42/0x80
     ? memset+0x20/0x40
     sysfs_kf_seq_show+0x218/0x410

The root cause is that available_slots_show() consults driver-data, but
fails to synchronize against device-unbind setting up a TOCTOU race to
access uninitialized memory.

Validate driver-data under the device-lock.

Fixes: 4d88a97aa9e8 ("libnvdimm, nvdimm: dimm driver and base libnvdimm device-driver infrastructure")
Cc: <stable@vger.kernel.org>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Coly Li <colyli@suse.com>
Reported-by: Richard Palethorpe <rpalethorpe@suse.com>
Acked-by: Richard Palethorpe <rpalethorpe@suse.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
[sudip: use device_lock()]
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/nvdimm/dimm_devs.c |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

--- a/drivers/nvdimm/dimm_devs.c
+++ b/drivers/nvdimm/dimm_devs.c
@@ -359,16 +359,16 @@ static ssize_t state_show(struct device
 }
 static DEVICE_ATTR_RO(state);
 
-static ssize_t available_slots_show(struct device *dev,
-		struct device_attribute *attr, char *buf)
+static ssize_t __available_slots_show(struct nvdimm_drvdata *ndd, char *buf)
 {
-	struct nvdimm_drvdata *ndd = dev_get_drvdata(dev);
+	struct device *dev;
 	ssize_t rc;
 	u32 nfree;
 
 	if (!ndd)
 		return -ENXIO;
 
+	dev = ndd->dev;
 	nvdimm_bus_lock(dev);
 	nfree = nd_label_nfree(ndd);
 	if (nfree - 1 > nfree) {
@@ -380,6 +380,18 @@ static ssize_t available_slots_show(stru
 	nvdimm_bus_unlock(dev);
 	return rc;
 }
+
+static ssize_t available_slots_show(struct device *dev,
+				    struct device_attribute *attr, char *buf)
+{
+	ssize_t rc;
+
+	device_lock(dev);
+	rc = __available_slots_show(dev_get_drvdata(dev), buf);
+	device_unlock(dev);
+
+	return rc;
+}
 static DEVICE_ATTR_RO(available_slots);
 
 static struct attribute *nvdimm_attributes[] = {



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

* [PATCH 4.19 223/247] arm64: Extend workaround for erratum 1024718 to all versions of Cortex-A55
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (221 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 222/247] libnvdimm/dimm: Avoid race between probe and available_slots_show() Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 224/247] module: Ignore _GLOBAL_OFFSET_TABLE_ when warning for undefined symbols Greg Kroah-Hartman
                   ` (26 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Catalin Marinas, Will Deacon,
	James Morse, Kunihiko Hayashi, Suzuki K Poulose

From: Suzuki K Poulose <suzuki.poulose@arm.com>

commit c0b15c25d25171db4b70cc0b7dbc1130ee94017d upstream.

The erratum 1024718 affects Cortex-A55 r0p0 to r2p0. However
we apply the work around for r0p0 - r1p0. Unfortunately this
won't be fixed for the future revisions for the CPU. Thus
extend the work around for all versions of A55, to cover
for r2p0 and any future revisions.

Cc: stable@vger.kernel.org
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: James Morse <james.morse@arm.com>
Cc: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20210203230057.3961239-1-suzuki.poulose@arm.com
[will: Update Kconfig help text]
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/Kconfig             |    2 +-
 arch/arm64/kernel/cpufeature.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -473,7 +473,7 @@ config ARM64_ERRATUM_1024718
 	help
 	  This option adds work around for Arm Cortex-A55 Erratum 1024718.
 
-	  Affected Cortex-A55 cores (r0p0, r0p1, r1p0) could cause incorrect
+	  Affected Cortex-A55 cores (all revisions) could cause incorrect
 	  update of the hardware dirty bit when the DBM/AP bits are updated
 	  without a break-before-make. The work around is to disable the usage
 	  of hardware DBM locally on the affected cores. CPUs not affected by
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -1012,7 +1012,7 @@ static bool cpu_has_broken_dbm(void)
 	/* List of CPUs which have broken DBM support. */
 	static const struct midr_range cpus[] = {
 #ifdef CONFIG_ARM64_ERRATUM_1024718
-		MIDR_RANGE(MIDR_CORTEX_A55, 0, 0, 1, 0),  // A55 r0p0 -r1p0
+		MIDR_ALL_VERSIONS(MIDR_CORTEX_A55),
 #endif
 		{},
 	};



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

* [PATCH 4.19 224/247] module: Ignore _GLOBAL_OFFSET_TABLE_ when warning for undefined symbols
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (222 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 223/247] arm64: Extend workaround for erratum 1024718 to all versions of Cortex-A55 Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 225/247] mmc: sdhci-esdhc-imx: fix kernel panic when remove module Greg Kroah-Hartman
                   ` (25 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Marco Elver, Nick Desaulniers,
	Nathan Chancellor, Fangrui Song, Jessica Yu

From: Fangrui Song <maskray@google.com>

commit ebfac7b778fac8b0e8e92ec91d0b055f046b4604 upstream.

clang-12 -fno-pic (since
https://github.com/llvm/llvm-project/commit/a084c0388e2a59b9556f2de0083333232da3f1d6)
can emit `call __stack_chk_fail@PLT` instead of `call __stack_chk_fail`
on x86.  The two forms should have identical behaviors on x86-64 but the
former causes GNU as<2.37 to produce an unreferenced undefined symbol
_GLOBAL_OFFSET_TABLE_.

(On x86-32, there is an R_386_PC32 vs R_386_PLT32 difference but the
linker behavior is identical as far as Linux kernel is concerned.)

Simply ignore _GLOBAL_OFFSET_TABLE_ for now, like what
scripts/mod/modpost.c:ignore_undef_symbol does. This also fixes the
problem for gcc/clang -fpie and -fpic, which may emit `call foo@PLT` for
external function calls on x86.

Note: ld -z defs and dynamic loaders do not error for unreferenced
undefined symbols so the module loader is reading too much.  If we ever
need to ignore more symbols, the code should be refactored to ignore
unreferenced symbols.

Cc: <stable@vger.kernel.org>
Link: https://github.com/ClangBuiltLinux/linux/issues/1250
Link: https://sourceware.org/bugzilla/show_bug.cgi?id=27178
Reported-by: Marco Elver <elver@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Marco Elver <elver@google.com>
Signed-off-by: Fangrui Song <maskray@google.com>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/module.c |   21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2274,6 +2274,21 @@ static int verify_export_symbols(struct
 	return 0;
 }
 
+static bool ignore_undef_symbol(Elf_Half emachine, const char *name)
+{
+	/*
+	 * On x86, PIC code and Clang non-PIC code may have call foo@PLT. GNU as
+	 * before 2.37 produces an unreferenced _GLOBAL_OFFSET_TABLE_ on x86-64.
+	 * i386 has a similar problem but may not deserve a fix.
+	 *
+	 * If we ever have to ignore many symbols, consider refactoring the code to
+	 * only warn if referenced by a relocation.
+	 */
+	if (emachine == EM_386 || emachine == EM_X86_64)
+		return !strcmp(name, "_GLOBAL_OFFSET_TABLE_");
+	return false;
+}
+
 /* Change all symbols so that st_value encodes the pointer directly. */
 static int simplify_symbols(struct module *mod, const struct load_info *info)
 {
@@ -2319,8 +2334,10 @@ static int simplify_symbols(struct modul
 				break;
 			}
 
-			/* Ok if weak.  */
-			if (!ksym && ELF_ST_BIND(sym[i].st_info) == STB_WEAK)
+			/* Ok if weak or ignored.  */
+			if (!ksym &&
+			    (ELF_ST_BIND(sym[i].st_info) == STB_WEAK ||
+			     ignore_undef_symbol(info->hdr->e_machine, name)))
 				break;
 
 			ret = PTR_ERR(ksym) ?: -ENOENT;



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

* [PATCH 4.19 225/247] mmc: sdhci-esdhc-imx: fix kernel panic when remove module
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (223 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 224/247] module: Ignore _GLOBAL_OFFSET_TABLE_ when warning for undefined symbols Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 226/247] gpio: pcf857x: Fix missing first interrupt Greg Kroah-Hartman
                   ` (24 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Frank Li, Ulf Hansson

From: Frank Li <Frank.Li@nxp.com>

commit a56f44138a2c57047f1ea94ea121af31c595132b upstream.

In sdhci_esdhc_imx_remove() the SDHCI_INT_STATUS in read. Under some
circumstances, this may be done while the device is runtime suspended,
triggering the below splat.

Fix the problem by adding a pm_runtime_get_sync(), before reading the
register, which will turn on clocks etc making the device accessible again.

[ 1811.323148] mmc1: card aaaa removed
[ 1811.347483] Internal error: synchronous external abort: 96000210 [#1] PREEMPT SMP
[ 1811.354988] Modules linked in: sdhci_esdhc_imx(-) sdhci_pltfm sdhci cqhci mmc_block mmc_core [last unloaded: mmc_core]
[ 1811.365726] CPU: 0 PID: 3464 Comm: rmmod Not tainted 5.10.1-sd-99871-g53835a2e8186 #5
[ 1811.373559] Hardware name: Freescale i.MX8DXL EVK (DT)
[ 1811.378705] pstate: 60000005 (nZCv daif -PAN -UAO -TCO BTYPE=--)
[ 1811.384723] pc : sdhci_esdhc_imx_remove+0x28/0x15c [sdhci_esdhc_imx]
[ 1811.391090] lr : platform_drv_remove+0x2c/0x50
[ 1811.395536] sp : ffff800012c7bcb0
[ 1811.398855] x29: ffff800012c7bcb0 x28: ffff00002c72b900
[ 1811.404181] x27: 0000000000000000 x26: 0000000000000000
[ 1811.409497] x25: 0000000000000000 x24: 0000000000000000
[ 1811.414814] x23: ffff0000042b3890 x22: ffff800009127120
[ 1811.420131] x21: ffff00002c4c9580 x20: ffff0000042d0810
[ 1811.425456] x19: ffff0000042d0800 x18: 0000000000000020
[ 1811.430773] x17: 0000000000000000 x16: 0000000000000000
[ 1811.436089] x15: 0000000000000004 x14: ffff000004019c10
[ 1811.441406] x13: 0000000000000000 x12: 0000000000000020
[ 1811.446723] x11: 0101010101010101 x10: 7f7f7f7f7f7f7f7f
[ 1811.452040] x9 : fefefeff6364626d x8 : 7f7f7f7f7f7f7f7f
[ 1811.457356] x7 : 78725e6473607372 x6 : 0000000080808080
[ 1811.462673] x5 : 0000000000000000 x4 : 0000000000000000
[ 1811.467990] x3 : ffff800011ac1cb0 x2 : 0000000000000000
[ 1811.473307] x1 : ffff8000091214d4 x0 : ffff8000133a0030
[ 1811.478624] Call trace:
[ 1811.481081]  sdhci_esdhc_imx_remove+0x28/0x15c [sdhci_esdhc_imx]
[ 1811.487098]  platform_drv_remove+0x2c/0x50
[ 1811.491198]  __device_release_driver+0x188/0x230
[ 1811.495818]  driver_detach+0xc0/0x14c
[ 1811.499487]  bus_remove_driver+0x5c/0xb0
[ 1811.503413]  driver_unregister+0x30/0x60
[ 1811.507341]  platform_driver_unregister+0x14/0x20
[ 1811.512048]  sdhci_esdhc_imx_driver_exit+0x1c/0x3a8 [sdhci_esdhc_imx]
[ 1811.518495]  __arm64_sys_delete_module+0x19c/0x230
[ 1811.523291]  el0_svc_common.constprop.0+0x78/0x1a0
[ 1811.528086]  do_el0_svc+0x24/0x90
[ 1811.531405]  el0_svc+0x14/0x20
[ 1811.534461]  el0_sync_handler+0x1a4/0x1b0
[ 1811.538474]  el0_sync+0x174/0x180
[ 1811.541801] Code: a9025bf5 f9403e95 f9400ea0 9100c000 (b9400000)
[ 1811.547902] ---[ end trace 3fb1a3bd48ff7be5 ]---

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Cc: stable@vger.kernel.org # v4.0+
Link: https://lore.kernel.org/r/20210210181933.29263-1-Frank.Li@nxp.com
[Ulf: Clarified the commit message a bit]
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/mmc/host/sdhci-esdhc-imx.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1370,9 +1370,10 @@ static int sdhci_esdhc_imx_remove(struct
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
-	int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
+	int dead;
 
 	pm_runtime_get_sync(&pdev->dev);
+	dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_put_noidle(&pdev->dev);
 



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

* [PATCH 4.19 226/247] gpio: pcf857x: Fix missing first interrupt
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (224 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 225/247] mmc: sdhci-esdhc-imx: fix kernel panic when remove module Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 227/247] printk: fix deadlock when kernel panic Greg Kroah-Hartman
                   ` (23 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Maxim Kiselev, Bartosz Golaszewski

From: Maxim Kiselev <bigunclemax@gmail.com>

commit a8002a35935aaefcd6a42ad3289f62bab947f2ca upstream.

If no n_latch value will be provided at driver probe then all pins will
be used as an input:

    gpio->out = ~n_latch;

In that case initial state for all pins is "one":

    gpio->status = gpio->out;

So if pcf857x IRQ happens with change pin value from "zero" to "one"
then we miss it, because of "one" from IRQ and "one" from initial state
leaves corresponding pin unchanged:
change = (gpio->status ^ status) & gpio->irq_enabled;

The right solution will be to read actual state at driver probe.

Cc: stable@vger.kernel.org
Fixes: 6e20a0a429bd ("gpio: pcf857x: enable gpio_to_irq() support")
Signed-off-by: Maxim Kiselev <bigunclemax@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/gpio/gpio-pcf857x.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/gpio/gpio-pcf857x.c
+++ b/drivers/gpio/gpio-pcf857x.c
@@ -357,7 +357,7 @@ static int pcf857x_probe(struct i2c_clie
 	 * reset state.  Otherwise it flags pins to be driven low.
 	 */
 	gpio->out = ~n_latch;
-	gpio->status = gpio->out;
+	gpio->status = gpio->read(gpio->client);
 
 	status = devm_gpiochip_add_data(&client->dev, &gpio->chip, gpio);
 	if (status < 0)



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

* [PATCH 4.19 227/247] printk: fix deadlock when kernel panic
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (225 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 226/247] gpio: pcf857x: Fix missing first interrupt Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 228/247] cpufreq: intel_pstate: Get per-CPU max freq via MSR_HWP_CAPABILITIES if available Greg Kroah-Hartman
                   ` (22 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Muchun Song, Petr Mladek, Sergey Senozhatsky

From: Muchun Song <songmuchun@bytedance.com>

commit 8a8109f303e25a27f92c1d8edd67d7cbbc60a4eb upstream.

printk_safe_flush_on_panic() caused the following deadlock on our
server:

CPU0:                                         CPU1:
panic                                         rcu_dump_cpu_stacks
  kdump_nmi_shootdown_cpus                      nmi_trigger_cpumask_backtrace
    register_nmi_handler(crash_nmi_callback)      printk_safe_flush
                                                    __printk_safe_flush
                                                      raw_spin_lock_irqsave(&read_lock)
    // send NMI to other processors
    apic_send_IPI_allbutself(NMI_VECTOR)
                                                        // NMI interrupt, dead loop
                                                        crash_nmi_callback
  printk_safe_flush_on_panic
    printk_safe_flush
      __printk_safe_flush
        // deadlock
        raw_spin_lock_irqsave(&read_lock)

DEADLOCK: read_lock is taken on CPU1 and will never get released.

It happens when panic() stops a CPU by NMI while it has been in
the middle of printk_safe_flush().

Handle the lock the same way as logbuf_lock. The printk_safe buffers
are flushed only when both locks can be safely taken. It can avoid
the deadlock _in this particular case_ at expense of losing contents
of printk_safe buffers.

Note: It would actually be safe to re-init the locks when all CPUs were
      stopped by NMI. But it would require passing this information
      from arch-specific code. It is not worth the complexity.
      Especially because logbuf_lock and printk_safe buffers have been
      obsoleted by the lockless ring buffer.

Fixes: cf9b1106c81c ("printk/nmi: flush NMI messages on the system panic")
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Cc: <stable@vger.kernel.org>
Acked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20210210034823.64867-1-songmuchun@bytedance.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/printk/printk_safe.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

--- a/kernel/printk/printk_safe.c
+++ b/kernel/printk/printk_safe.c
@@ -55,6 +55,8 @@ struct printk_safe_seq_buf {
 static DEFINE_PER_CPU(struct printk_safe_seq_buf, safe_print_seq);
 static DEFINE_PER_CPU(int, printk_context);
 
+static DEFINE_RAW_SPINLOCK(safe_read_lock);
+
 #ifdef CONFIG_PRINTK_NMI
 static DEFINE_PER_CPU(struct printk_safe_seq_buf, nmi_print_seq);
 #endif
@@ -190,8 +192,6 @@ static void report_message_lost(struct p
  */
 static void __printk_safe_flush(struct irq_work *work)
 {
-	static raw_spinlock_t read_lock =
-		__RAW_SPIN_LOCK_INITIALIZER(read_lock);
 	struct printk_safe_seq_buf *s =
 		container_of(work, struct printk_safe_seq_buf, work);
 	unsigned long flags;
@@ -205,7 +205,7 @@ static void __printk_safe_flush(struct i
 	 * different CPUs. This is especially important when printing
 	 * a backtrace.
 	 */
-	raw_spin_lock_irqsave(&read_lock, flags);
+	raw_spin_lock_irqsave(&safe_read_lock, flags);
 
 	i = 0;
 more:
@@ -242,7 +242,7 @@ more:
 
 out:
 	report_message_lost(s);
-	raw_spin_unlock_irqrestore(&read_lock, flags);
+	raw_spin_unlock_irqrestore(&safe_read_lock, flags);
 }
 
 /**
@@ -288,6 +288,14 @@ void printk_safe_flush_on_panic(void)
 		raw_spin_lock_init(&logbuf_lock);
 	}
 
+	if (raw_spin_is_locked(&safe_read_lock)) {
+		if (num_online_cpus() > 1)
+			return;
+
+		debug_locks_off();
+		raw_spin_lock_init(&safe_read_lock);
+	}
+
 	printk_safe_flush();
 }
 



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

* [PATCH 4.19 228/247] cpufreq: intel_pstate: Get per-CPU max freq via MSR_HWP_CAPABILITIES if available
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (226 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 227/247] printk: fix deadlock when kernel panic Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 229/247] f2fs: fix out-of-repair __setattr_copy() Greg Kroah-Hartman
                   ` (21 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Wendy Wang, Chen Yu, Rafael J. Wysocki

From: Chen Yu <yu.c.chen@intel.com>

commit 6f67e060083a84a4cc364eab6ae40c717165fb0c upstream.

Currently, when turbo is disabled (either by BIOS or by the user),
the intel_pstate driver reads the max non-turbo frequency from the
package-wide MSR_PLATFORM_INFO(0xce) register.

However, on asymmetric platforms it is possible in theory that small
and big core with HWP enabled might have different max non-turbo CPU
frequency, because MSR_HWP_CAPABILITIES is per-CPU scope according
to Intel Software Developer Manual.

The turbo max freq is already per-CPU in current code, so make
similar change to the max non-turbo frequency as well.

Reported-by: Wendy Wang <wendy.wang@intel.com>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
[ rjw: Subject and changelog edits ]
Cc: 4.18+ <stable@vger.kernel.org> # 4.18+: a45ee4d4e13b: cpufreq: intel_pstate: Change intel_pstate_get_hwp_max() argument
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/cpufreq/intel_pstate.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -1420,11 +1420,9 @@ static void intel_pstate_max_within_limi
 static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
 {
 	cpu->pstate.min_pstate = pstate_funcs.get_min();
-	cpu->pstate.max_pstate = pstate_funcs.get_max();
 	cpu->pstate.max_pstate_physical = pstate_funcs.get_max_physical();
 	cpu->pstate.turbo_pstate = pstate_funcs.get_turbo();
 	cpu->pstate.scaling = pstate_funcs.get_scaling();
-	cpu->pstate.max_freq = cpu->pstate.max_pstate * cpu->pstate.scaling;
 
 	if (hwp_active && !hwp_mode_bdw) {
 		unsigned int phy_max, current_max;
@@ -1432,9 +1430,12 @@ static void intel_pstate_get_cpu_pstates
 		intel_pstate_get_hwp_max(cpu->cpu, &phy_max, &current_max);
 		cpu->pstate.turbo_freq = phy_max * cpu->pstate.scaling;
 		cpu->pstate.turbo_pstate = phy_max;
+		cpu->pstate.max_pstate = HWP_GUARANTEED_PERF(READ_ONCE(cpu->hwp_cap_cached));
 	} else {
 		cpu->pstate.turbo_freq = cpu->pstate.turbo_pstate * cpu->pstate.scaling;
+		cpu->pstate.max_pstate = pstate_funcs.get_max();
 	}
+	cpu->pstate.max_freq = cpu->pstate.max_pstate * cpu->pstate.scaling;
 
 	if (pstate_funcs.get_aperf_mperf_shift)
 		cpu->aperf_mperf_shift = pstate_funcs.get_aperf_mperf_shift();



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

* [PATCH 4.19 229/247] f2fs: fix out-of-repair __setattr_copy()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (227 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 228/247] cpufreq: intel_pstate: Get per-CPU max freq via MSR_HWP_CAPABILITIES if available Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 230/247] sparc32: fix a user-triggerable oops in clear_user() Greg Kroah-Hartman
                   ` (20 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Chao Yu, Jaegeuk Kim

From: Chao Yu <yuchao0@huawei.com>

commit 2562515f0ad7342bde6456602c491b64c63fe950 upstream.

__setattr_copy() was copied from setattr_copy() in fs/attr.c, there is
two missing patches doesn't cover this inner function, fix it.

Commit 7fa294c8991c ("userns: Allow chown and setgid preservation")
Commit 23adbe12ef7d ("fs,userns: Change inode_capable to capable_wrt_inode_uidgid")

Fixes: fbfa2cc58d53 ("f2fs: add file operations")
Cc: stable@vger.kernel.org
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/f2fs/file.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -760,7 +760,8 @@ static void __setattr_copy(struct inode
 	if (ia_valid & ATTR_MODE) {
 		umode_t mode = attr->ia_mode;
 
-		if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
+		if (!in_group_p(inode->i_gid) &&
+			!capable_wrt_inode_uidgid(inode, CAP_FSETID))
 			mode &= ~S_ISGID;
 		set_acl_inode(inode, mode);
 	}



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

* [PATCH 4.19 230/247] sparc32: fix a user-triggerable oops in clear_user()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (228 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 229/247] f2fs: fix out-of-repair __setattr_copy() Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 231/247] gfs2: Dont skip dlm unlock if glock has an lvb Greg Kroah-Hartman
                   ` (19 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, stable, Al Viro, David S. Miller

From: Al Viro <viro@zeniv.linux.org.uk>

commit 7780918b36489f0b2f9a3749d7be00c2ceaec513 upstream.

Back in 2.1.29 the clear_user() guts (__bzero()) had been merged
with memset().  Unfortunately, while all exception handlers had been
copied, one of the exception table entries got lost.  As the result,
clear_user() starting at 128*n bytes before the end of page and
spanning between 8 and 127 bytes into the next page would oops when
the second page is unmapped.  It's trivial to reproduce - all
it takes is

main()
{
	int fd = open("/dev/zero", O_RDONLY);
	char *p = mmap(NULL, 16384, PROT_READ|PROT_WRITE,
			MAP_PRIVATE|MAP_ANON, -1, 0);
	munmap(p + 8192, 8192);
	read(fd, p + 8192 - 128, 192);
}

which had been oopsing since March 1997.  Says something about
the quality of test coverage... ;-/  And while today sparc32 port
is nearly dead, back in '97 it had been very much alive; in fact,
sparc64 had only been in mainline for 3 months by that point...

Cc: stable@kernel.org
Fixes: v2.1.29
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/sparc/lib/memset.S |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/sparc/lib/memset.S
+++ b/arch/sparc/lib/memset.S
@@ -142,6 +142,7 @@ __bzero:
 	ZERO_LAST_BLOCKS(%o0, 0x48, %g2)
 	ZERO_LAST_BLOCKS(%o0, 0x08, %g2)
 13:
+	EXT(12b, 13b, 21f)
 	be	8f
 	 andcc	%o1, 4, %g0
 



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

* [PATCH 4.19 231/247] gfs2: Dont skip dlm unlock if glock has an lvb
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (229 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 230/247] sparc32: fix a user-triggerable oops in clear_user() Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 232/247] dm: fix deadlock when swapping to encrypted device Greg Kroah-Hartman
                   ` (18 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Bob Peterson, Andreas Gruenbacher

From: Bob Peterson <rpeterso@redhat.com>

commit 78178ca844f0eb88f21f31c7fde969384be4c901 upstream.

Patch fb6791d100d1 was designed to allow gfs2 to unmount quicker by
skipping the step where it tells dlm to unlock glocks in EX with lvbs.
This was done because when gfs2 unmounts a file system, it destroys the
dlm lockspace shortly after it destroys the glocks so it doesn't need to
unlock them all: the unlock is implied when the lockspace is destroyed
by dlm.

However, that patch introduced a use-after-free in dlm: as part of its
normal dlm_recoverd process, it can call ls_recovery to recover dead
locks. In so doing, it can call recover_rsbs which calls recover_lvb for
any mastered rsbs. Func recover_lvb runs through the list of lkbs queued
to the given rsb (if the glock is cached but unlocked, it will still be
queued to the lkb, but in NL--Unlocked--mode) and if it has an lvb,
copies it to the rsb, thus trying to preserve the lkb. However, when
gfs2 skips the dlm unlock step, it frees the glock and its lvb, which
means dlm's function recover_lvb references the now freed lvb pointer,
copying the freed lvb memory to the rsb.

This patch changes the check in gdlm_put_lock so that it calls
dlm_unlock for all glocks that contain an lvb pointer.

Fixes: fb6791d100d1 ("GFS2: skip dlm_unlock calls in unmount")
Cc: stable@vger.kernel.org # v3.8+
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/gfs2/lock_dlm.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

--- a/fs/gfs2/lock_dlm.c
+++ b/fs/gfs2/lock_dlm.c
@@ -283,7 +283,6 @@ static void gdlm_put_lock(struct gfs2_gl
 {
 	struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
 	struct lm_lockstruct *ls = &sdp->sd_lockstruct;
-	int lvb_needs_unlock = 0;
 	int error;
 
 	if (gl->gl_lksb.sb_lkid == 0) {
@@ -296,13 +295,10 @@ static void gdlm_put_lock(struct gfs2_gl
 	gfs2_sbstats_inc(gl, GFS2_LKS_DCOUNT);
 	gfs2_update_request_times(gl);
 
-	/* don't want to skip dlm_unlock writing the lvb when lock is ex */
-
-	if (gl->gl_lksb.sb_lvbptr && (gl->gl_state == LM_ST_EXCLUSIVE))
-		lvb_needs_unlock = 1;
+	/* don't want to skip dlm_unlock writing the lvb when lock has one */
 
 	if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) &&
-	    !lvb_needs_unlock) {
+	    !gl->gl_lksb.sb_lvbptr) {
 		gfs2_glock_free(gl);
 		return;
 	}



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

* [PATCH 4.19 232/247] dm: fix deadlock when swapping to encrypted device
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (230 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 231/247] gfs2: Dont skip dlm unlock if glock has an lvb Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 233/247] dm era: Recover committed writeset after crash Greg Kroah-Hartman
                   ` (17 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Mikulas Patocka, Mike Snitzer

From: Mikulas Patocka <mpatocka@redhat.com>

commit a666e5c05e7c4aaabb2c5d58117b0946803d03d2 upstream.

The system would deadlock when swapping to a dm-crypt device. The reason
is that for each incoming write bio, dm-crypt allocates memory that holds
encrypted data. These excessive allocations exhaust all the memory and the
result is either deadlock or OOM trigger.

This patch limits the number of in-flight swap bios, so that the memory
consumed by dm-crypt is limited. The limit is enforced if the target set
the "limit_swap_bios" variable and if the bio has REQ_SWAP set.

Non-swap bios are not affected becuase taking the semaphore would cause
performance degradation.

This is similar to request-based drivers - they will also block when the
number of requests is over the limit.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/md/dm-core.h          |    4 ++
 drivers/md/dm-crypt.c         |    1 
 drivers/md/dm.c               |   60 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/device-mapper.h |    5 +++
 4 files changed, 70 insertions(+)

--- a/drivers/md/dm-core.h
+++ b/drivers/md/dm-core.h
@@ -110,6 +110,10 @@ struct mapped_device {
 	/* zero-length flush that will be cloned and submitted to targets */
 	struct bio flush_bio;
 
+	int swap_bios;
+	struct semaphore swap_bios_semaphore;
+	struct mutex swap_bios_lock;
+
 	struct dm_stats stats;
 
 	struct kthread_worker kworker;
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -2852,6 +2852,7 @@ static int crypt_ctr(struct dm_target *t
 	wake_up_process(cc->write_thread);
 
 	ti->num_flush_bios = 1;
+	ti->limit_swap_bios = true;
 
 	return 0;
 
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -146,6 +146,16 @@ EXPORT_SYMBOL_GPL(dm_bio_get_target_bio_
 #define DM_NUMA_NODE NUMA_NO_NODE
 static int dm_numa_node = DM_NUMA_NODE;
 
+#define DEFAULT_SWAP_BIOS	(8 * 1048576 / PAGE_SIZE)
+static int swap_bios = DEFAULT_SWAP_BIOS;
+static int get_swap_bios(void)
+{
+	int latch = READ_ONCE(swap_bios);
+	if (unlikely(latch <= 0))
+		latch = DEFAULT_SWAP_BIOS;
+	return latch;
+}
+
 /*
  * For mempools pre-allocation at the table loading time.
  */
@@ -935,6 +945,11 @@ void disable_write_zeroes(struct mapped_
 	limits->max_write_zeroes_sectors = 0;
 }
 
+static bool swap_bios_limit(struct dm_target *ti, struct bio *bio)
+{
+	return unlikely((bio->bi_opf & REQ_SWAP) != 0) && unlikely(ti->limit_swap_bios);
+}
+
 static void clone_endio(struct bio *bio)
 {
 	blk_status_t error = bio->bi_status;
@@ -972,6 +987,11 @@ static void clone_endio(struct bio *bio)
 		}
 	}
 
+	if (unlikely(swap_bios_limit(tio->ti, bio))) {
+		struct mapped_device *md = io->md;
+		up(&md->swap_bios_semaphore);
+	}
+
 	free_tio(tio);
 	dec_pending(io, error);
 }
@@ -1250,6 +1270,22 @@ void dm_remap_zone_report(struct dm_targ
 }
 EXPORT_SYMBOL_GPL(dm_remap_zone_report);
 
+static noinline void __set_swap_bios_limit(struct mapped_device *md, int latch)
+{
+	mutex_lock(&md->swap_bios_lock);
+	while (latch < md->swap_bios) {
+		cond_resched();
+		down(&md->swap_bios_semaphore);
+		md->swap_bios--;
+	}
+	while (latch > md->swap_bios) {
+		cond_resched();
+		up(&md->swap_bios_semaphore);
+		md->swap_bios++;
+	}
+	mutex_unlock(&md->swap_bios_lock);
+}
+
 static blk_qc_t __map_bio(struct dm_target_io *tio)
 {
 	int r;
@@ -1270,6 +1306,14 @@ static blk_qc_t __map_bio(struct dm_targ
 	atomic_inc(&io->io_count);
 	sector = clone->bi_iter.bi_sector;
 
+	if (unlikely(swap_bios_limit(ti, clone))) {
+		struct mapped_device *md = io->md;
+		int latch = get_swap_bios();
+		if (unlikely(latch != md->swap_bios))
+			__set_swap_bios_limit(md, latch);
+		down(&md->swap_bios_semaphore);
+	}
+
 	r = ti->type->map(ti, clone);
 	switch (r) {
 	case DM_MAPIO_SUBMITTED:
@@ -1284,10 +1328,18 @@ static blk_qc_t __map_bio(struct dm_targ
 			ret = generic_make_request(clone);
 		break;
 	case DM_MAPIO_KILL:
+		if (unlikely(swap_bios_limit(ti, clone))) {
+			struct mapped_device *md = io->md;
+			up(&md->swap_bios_semaphore);
+		}
 		free_tio(tio);
 		dec_pending(io, BLK_STS_IOERR);
 		break;
 	case DM_MAPIO_REQUEUE:
+		if (unlikely(swap_bios_limit(ti, clone))) {
+			struct mapped_device *md = io->md;
+			up(&md->swap_bios_semaphore);
+		}
 		free_tio(tio);
 		dec_pending(io, BLK_STS_DM_REQUEUE);
 		break;
@@ -1859,6 +1911,7 @@ static void cleanup_mapped_device(struct
 	mutex_destroy(&md->suspend_lock);
 	mutex_destroy(&md->type_lock);
 	mutex_destroy(&md->table_devices_lock);
+	mutex_destroy(&md->swap_bios_lock);
 
 	dm_mq_cleanup_mapped_device(md);
 }
@@ -1933,6 +1986,10 @@ static struct mapped_device *alloc_dev(i
 	init_completion(&md->kobj_holder.completion);
 	md->kworker_task = NULL;
 
+	md->swap_bios = get_swap_bios();
+	sema_init(&md->swap_bios_semaphore, md->swap_bios);
+	mutex_init(&md->swap_bios_lock);
+
 	md->disk->major = _major;
 	md->disk->first_minor = minor;
 	md->disk->fops = &dm_blk_dops;
@@ -3228,6 +3285,9 @@ MODULE_PARM_DESC(reserved_bio_based_ios,
 module_param(dm_numa_node, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(dm_numa_node, "NUMA node for DM device memory allocations");
 
+module_param(swap_bios, int, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(swap_bios, "Maximum allowed inflight swap IOs");
+
 MODULE_DESCRIPTION(DM_NAME " driver");
 MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>");
 MODULE_LICENSE("GPL");
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -315,6 +315,11 @@ struct dm_target {
 	 * on max_io_len boundary.
 	 */
 	bool split_discard_bios:1;
+
+	/*
+	 * Set if we need to limit the number of in-flight bios when swapping.
+	 */
+	bool limit_swap_bios:1;
 };
 
 /* Each target can link one of these into the table */



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

* [PATCH 4.19 233/247] dm era: Recover committed writeset after crash
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (231 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 232/247] dm: fix deadlock when swapping to encrypted device Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 234/247] dm era: Verify the data block size hasnt changed Greg Kroah-Hartman
                   ` (16 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Nikos Tsironis, Mike Snitzer

From: Nikos Tsironis <ntsironis@arrikto.com>

commit de89afc1e40fdfa5f8b666e5d07c43d21a1d3be0 upstream.

Following a system crash, dm-era fails to recover the committed writeset
for the current era, leading to lost writes. That is, we lose the
information about what blocks were written during the affected era.

dm-era assumes that the writeset of the current era is archived when the
device is suspended. So, when resuming the device, it just moves on to
the next era, ignoring the committed writeset.

This assumption holds when the device is properly shut down. But, when
the system crashes, the code that suspends the target never runs, so the
writeset for the current era is not archived.

There are three issues that cause the committed writeset to get lost:

1. dm-era doesn't load the committed writeset when opening the metadata
2. The code that resizes the metadata wipes the information about the
   committed writeset (assuming it was loaded at step 1)
3. era_preresume() starts a new era, without taking into account that
   the current era might not have been archived, due to a system crash.

To fix this:

1. Load the committed writeset when opening the metadata
2. Fix the code that resizes the metadata to make sure it doesn't wipe
   the loaded writeset
3. Fix era_preresume() to check for a loaded writeset and archive it,
   before starting a new era.

Fixes: eec40579d84873 ("dm: add era target")
Cc: stable@vger.kernel.org # v3.15+
Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/md/dm-era-target.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

--- a/drivers/md/dm-era-target.c
+++ b/drivers/md/dm-era-target.c
@@ -70,8 +70,6 @@ static size_t bitset_size(unsigned nr_bi
  */
 static int writeset_alloc(struct writeset *ws, dm_block_t nr_blocks)
 {
-	ws->md.nr_bits = nr_blocks;
-	ws->md.root = INVALID_WRITESET_ROOT;
 	ws->bits = vzalloc(bitset_size(nr_blocks));
 	if (!ws->bits) {
 		DMERR("%s: couldn't allocate in memory bitset", __func__);
@@ -84,12 +82,14 @@ static int writeset_alloc(struct writese
 /*
  * Wipes the in-core bitset, and creates a new on disk bitset.
  */
-static int writeset_init(struct dm_disk_bitset *info, struct writeset *ws)
+static int writeset_init(struct dm_disk_bitset *info, struct writeset *ws,
+			 dm_block_t nr_blocks)
 {
 	int r;
 
-	memset(ws->bits, 0, bitset_size(ws->md.nr_bits));
+	memset(ws->bits, 0, bitset_size(nr_blocks));
 
+	ws->md.nr_bits = nr_blocks;
 	r = setup_on_disk_bitset(info, ws->md.nr_bits, &ws->md.root);
 	if (r) {
 		DMERR("%s: setup_on_disk_bitset failed", __func__);
@@ -578,6 +578,7 @@ static int open_metadata(struct era_meta
 	md->nr_blocks = le32_to_cpu(disk->nr_blocks);
 	md->current_era = le32_to_cpu(disk->current_era);
 
+	ws_unpack(&disk->current_writeset, &md->current_writeset->md);
 	md->writeset_tree_root = le64_to_cpu(disk->writeset_tree_root);
 	md->era_array_root = le64_to_cpu(disk->era_array_root);
 	md->metadata_snap = le64_to_cpu(disk->metadata_snap);
@@ -869,7 +870,6 @@ static int metadata_era_archive(struct e
 	}
 
 	ws_pack(&md->current_writeset->md, &value);
-	md->current_writeset->md.root = INVALID_WRITESET_ROOT;
 
 	keys[0] = md->current_era;
 	__dm_bless_for_disk(&value);
@@ -881,6 +881,7 @@ static int metadata_era_archive(struct e
 		return r;
 	}
 
+	md->current_writeset->md.root = INVALID_WRITESET_ROOT;
 	md->archived_writesets = true;
 
 	return 0;
@@ -897,7 +898,7 @@ static int metadata_new_era(struct era_m
 	int r;
 	struct writeset *new_writeset = next_writeset(md);
 
-	r = writeset_init(&md->bitset_info, new_writeset);
+	r = writeset_init(&md->bitset_info, new_writeset, md->nr_blocks);
 	if (r) {
 		DMERR("%s: writeset_init failed", __func__);
 		return r;
@@ -950,7 +951,7 @@ static int metadata_commit(struct era_me
 	int r;
 	struct dm_block *sblock;
 
-	if (md->current_writeset->md.root != SUPERBLOCK_LOCATION) {
+	if (md->current_writeset->md.root != INVALID_WRITESET_ROOT) {
 		r = dm_bitset_flush(&md->bitset_info, md->current_writeset->md.root,
 				    &md->current_writeset->md.root);
 		if (r) {
@@ -1579,7 +1580,7 @@ static int era_preresume(struct dm_targe
 
 	start_worker(era);
 
-	r = in_worker0(era, metadata_new_era);
+	r = in_worker0(era, metadata_era_rollover);
 	if (r) {
 		DMERR("%s: metadata_era_rollover failed", __func__);
 		return r;



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

* [PATCH 4.19 234/247] dm era: Verify the data block size hasnt changed
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (232 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 233/247] dm era: Recover committed writeset after crash Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 235/247] dm era: Fix bitset memory leaks Greg Kroah-Hartman
                   ` (15 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Nikos Tsironis, Ming-Hung Tsai, Mike Snitzer

From: Nikos Tsironis <ntsironis@arrikto.com>

commit c8e846ff93d5eaa5384f6f325a1687ac5921aade upstream.

dm-era doesn't support changing the data block size of existing devices,
so check explicitly that the requested block size for a new target
matches the one stored in the metadata.

Fixes: eec40579d84873 ("dm: add era target")
Cc: stable@vger.kernel.org # v3.15+
Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
Reviewed-by: Ming-Hung Tsai <mtsai@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/md/dm-era-target.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- a/drivers/md/dm-era-target.c
+++ b/drivers/md/dm-era-target.c
@@ -563,6 +563,15 @@ static int open_metadata(struct era_meta
 	}
 
 	disk = dm_block_data(sblock);
+
+	/* Verify the data block size hasn't changed */
+	if (le32_to_cpu(disk->data_block_size) != md->block_size) {
+		DMERR("changing the data block size (from %u to %llu) is not supported",
+		      le32_to_cpu(disk->data_block_size), md->block_size);
+		r = -EINVAL;
+		goto bad;
+	}
+
 	r = dm_tm_open_with_sm(md->bm, SUPERBLOCK_LOCATION,
 			       disk->metadata_space_map_root,
 			       sizeof(disk->metadata_space_map_root),
@@ -574,7 +583,6 @@ static int open_metadata(struct era_meta
 
 	setup_infos(md);
 
-	md->block_size = le32_to_cpu(disk->data_block_size);
 	md->nr_blocks = le32_to_cpu(disk->nr_blocks);
 	md->current_era = le32_to_cpu(disk->current_era);
 



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

* [PATCH 4.19 235/247] dm era: Fix bitset memory leaks
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (233 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 234/247] dm era: Verify the data block size hasnt changed Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 236/247] dm era: Use correct value size in equality function of writeset tree Greg Kroah-Hartman
                   ` (14 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Nikos Tsironis, Ming-Hung Tsai, Mike Snitzer

From: Nikos Tsironis <ntsironis@arrikto.com>

commit 904e6b266619c2da5c58b5dce14ae30629e39645 upstream.

Deallocate the memory allocated for the in-core bitsets when destroying
the target and in error paths.

Fixes: eec40579d84873 ("dm: add era target")
Cc: stable@vger.kernel.org # v3.15+
Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
Reviewed-by: Ming-Hung Tsai <mtsai@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/md/dm-era-target.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/drivers/md/dm-era-target.c
+++ b/drivers/md/dm-era-target.c
@@ -46,6 +46,7 @@ struct writeset {
 static void writeset_free(struct writeset *ws)
 {
 	vfree(ws->bits);
+	ws->bits = NULL;
 }
 
 static int setup_on_disk_bitset(struct dm_disk_bitset *info,
@@ -810,6 +811,8 @@ static struct era_metadata *metadata_ope
 
 static void metadata_close(struct era_metadata *md)
 {
+	writeset_free(&md->writesets[0]);
+	writeset_free(&md->writesets[1]);
 	destroy_persistent_data_objects(md);
 	kfree(md);
 }
@@ -847,6 +850,7 @@ static int metadata_resize(struct era_me
 	r = writeset_alloc(&md->writesets[1], *new_size);
 	if (r) {
 		DMERR("%s: writeset_alloc failed for writeset 1", __func__);
+		writeset_free(&md->writesets[0]);
 		return r;
 	}
 
@@ -857,6 +861,8 @@ static int metadata_resize(struct era_me
 			    &value, &md->era_array_root);
 	if (r) {
 		DMERR("%s: dm_array_resize failed", __func__);
+		writeset_free(&md->writesets[0]);
+		writeset_free(&md->writesets[1]);
 		return r;
 	}
 



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

* [PATCH 4.19 236/247] dm era: Use correct value size in equality function of writeset tree
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (234 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 235/247] dm era: Fix bitset memory leaks Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 237/247] dm era: Reinitialize bitset cache before digesting a new writeset Greg Kroah-Hartman
                   ` (13 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Nikos Tsironis, Ming-Hung Tsai, Mike Snitzer

From: Nikos Tsironis <ntsironis@arrikto.com>

commit 64f2d15afe7b336aafebdcd14cc835ecf856df4b upstream.

Fix the writeset tree equality test function to use the right value size
when comparing two btree values.

Fixes: eec40579d84873 ("dm: add era target")
Cc: stable@vger.kernel.org # v3.15+
Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
Reviewed-by: Ming-Hung Tsai <mtsai@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/md/dm-era-target.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/md/dm-era-target.c
+++ b/drivers/md/dm-era-target.c
@@ -388,7 +388,7 @@ static void ws_dec(void *context, const
 
 static int ws_eq(void *context, const void *value1, const void *value2)
 {
-	return !memcmp(value1, value2, sizeof(struct writeset_metadata));
+	return !memcmp(value1, value2, sizeof(struct writeset_disk));
 }
 
 /*----------------------------------------------------------------*/



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

* [PATCH 4.19 237/247] dm era: Reinitialize bitset cache before digesting a new writeset
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (235 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 236/247] dm era: Use correct value size in equality function of writeset tree Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 238/247] dm era: only resize metadata in preresume Greg Kroah-Hartman
                   ` (12 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Nikos Tsironis, Mike Snitzer

From: Nikos Tsironis <ntsironis@arrikto.com>

commit 2524933307fd0036d5c32357c693c021ab09a0b0 upstream.

In case of devices with at most 64 blocks, the digestion of consecutive
eras uses the writeset of the first era as the writeset of all eras to
digest, leading to lost writes. That is, we lose the information about
what blocks were written during the affected eras.

The digestion code uses a dm_disk_bitset object to access the archived
writesets. This structure includes a one word (64-bit) cache to reduce
the number of array lookups.

This structure is initialized only once, in metadata_digest_start(),
when we kick off digestion.

But, when we insert a new writeset into the writeset tree, before the
digestion of the previous writeset is done, or equivalently when there
are multiple writesets in the writeset tree to digest, then all these
writesets are digested using the same cache and the cache is not
re-initialized when moving from one writeset to the next.

For devices with more than 64 blocks, i.e., the size of the cache, the
cache is indirectly invalidated when we move to a next set of blocks, so
we avoid the bug.

But for devices with at most 64 blocks we end up using the same cached
data for digesting all archived writesets, i.e., the cache is loaded
when digesting the first writeset and it never gets reloaded, until the
digestion is done.

As a result, the writeset of the first era to digest is used as the
writeset of all the following archived eras, leading to lost writes.

Fix this by reinitializing the dm_disk_bitset structure, and thus
invalidating the cache, every time the digestion code starts digesting a
new writeset.

Fixes: eec40579d84873 ("dm: add era target")
Cc: stable@vger.kernel.org # v3.15+
Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/md/dm-era-target.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/drivers/md/dm-era-target.c
+++ b/drivers/md/dm-era-target.c
@@ -755,6 +755,12 @@ static int metadata_digest_lookup_writes
 	ws_unpack(&disk, &d->writeset);
 	d->value = cpu_to_le32(key);
 
+	/*
+	 * We initialise another bitset info to avoid any caching side effects
+	 * with the previous one.
+	 */
+	dm_disk_bitset_init(md->tm, &d->info);
+
 	d->nr_bits = min(d->writeset.nr_bits, md->nr_blocks);
 	d->current_bit = 0;
 	d->step = metadata_digest_transcribe_writeset;
@@ -768,12 +774,6 @@ static int metadata_digest_start(struct
 		return 0;
 
 	memset(d, 0, sizeof(*d));
-
-	/*
-	 * We initialise another bitset info to avoid any caching side
-	 * effects with the previous one.
-	 */
-	dm_disk_bitset_init(md->tm, &d->info);
 	d->step = metadata_digest_lookup_writeset;
 
 	return 0;



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

* [PATCH 4.19 238/247] dm era: only resize metadata in preresume
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (236 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 237/247] dm era: Reinitialize bitset cache before digesting a new writeset Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 239/247] icmp: introduce helper for natd source address in network device context Greg Kroah-Hartman
                   ` (11 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Nikos Tsironis, Mike Snitzer

From: Nikos Tsironis <ntsironis@arrikto.com>

commit cca2c6aebe86f68103a8615074b3578e854b5016 upstream.

Metadata resize shouldn't happen in the ctr. The ctr loads a temporary
(inactive) table that will only become active upon resume. That is why
resize should always be done in terms of resume. Otherwise a load (ctr)
whose inactive table never becomes active will incorrectly resize the
metadata.

Also, perform the resize directly in preresume, instead of using the
worker to do it.

The worker might run other metadata operations, e.g., it could start
digestion, before resizing the metadata. These operations will end up
using the old size.

This could lead to errors, like:

  device-mapper: era: metadata_digest_transcribe_writeset: dm_array_set_value failed
  device-mapper: era: process_old_eras: digest step failed, stopping digestion

The reason of the above error is that the worker started the digestion
of the archived writeset using the old, larger size.

As a result, metadata_digest_transcribe_writeset tried to write beyond
the end of the era array.

Fixes: eec40579d84873 ("dm: add era target")
Cc: stable@vger.kernel.org # v3.15+
Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/md/dm-era-target.c |   21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

--- a/drivers/md/dm-era-target.c
+++ b/drivers/md/dm-era-target.c
@@ -1500,15 +1500,6 @@ static int era_ctr(struct dm_target *ti,
 	}
 	era->md = md;
 
-	era->nr_blocks = calc_nr_blocks(era);
-
-	r = metadata_resize(era->md, &era->nr_blocks);
-	if (r) {
-		ti->error = "couldn't resize metadata";
-		era_destroy(era);
-		return -ENOMEM;
-	}
-
 	era->wq = alloc_ordered_workqueue("dm-" DM_MSG_PREFIX, WQ_MEM_RECLAIM);
 	if (!era->wq) {
 		ti->error = "could not create workqueue for metadata object";
@@ -1585,9 +1576,17 @@ static int era_preresume(struct dm_targe
 	dm_block_t new_size = calc_nr_blocks(era);
 
 	if (era->nr_blocks != new_size) {
-		r = in_worker1(era, metadata_resize, &new_size);
-		if (r)
+		r = metadata_resize(era->md, &new_size);
+		if (r) {
+			DMERR("%s: metadata_resize failed", __func__);
+			return r;
+		}
+
+		r = metadata_commit(era->md);
+		if (r) {
+			DMERR("%s: metadata_commit failed", __func__);
 			return r;
+		}
 
 		era->nr_blocks = new_size;
 	}



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

* [PATCH 4.19 239/247] icmp: introduce helper for natd source address in network device context
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (237 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 238/247] dm era: only resize metadata in preresume Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 240/247] gtp: use icmp_ndo_send helper Greg Kroah-Hartman
                   ` (10 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jason A. Donenfeld, Florian Westphal,
	David S. Miller

From: Jason A. Donenfeld <Jason@zx2c4.com>

commit 0b41713b606694257b90d61ba7e2712d8457648b upstream.

This introduces a helper function to be called only by network drivers
that wraps calls to icmp[v6]_send in a conntrack transformation, in case
NAT has been used. We don't want to pollute the non-driver path, though,
so we introduce this as a helper to be called by places that actually
make use of this, as suggested by Florian.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 include/linux/icmpv6.h |    6 ++++++
 include/net/icmp.h     |    6 ++++++
 net/ipv4/icmp.c        |   33 +++++++++++++++++++++++++++++++++
 net/ipv6/ip6_icmp.c    |   34 ++++++++++++++++++++++++++++++++++
 4 files changed, 79 insertions(+)

--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -31,6 +31,12 @@ static inline void icmpv6_send(struct sk
 }
 #endif
 
+#if IS_ENABLED(CONFIG_NF_NAT)
+void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info);
+#else
+#define icmpv6_ndo_send icmpv6_send
+#endif
+
 extern int				icmpv6_init(void);
 extern int				icmpv6_err_convert(u8 type, u8 code,
 							   int *err);
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -47,6 +47,12 @@ static inline void icmp_send(struct sk_b
 	__icmp_send(skb_in, type, code, info, &IPCB(skb_in)->opt);
 }
 
+#if IS_ENABLED(CONFIG_NF_NAT)
+void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info);
+#else
+#define icmp_ndo_send icmp_send
+#endif
+
 int icmp_rcv(struct sk_buff *skb);
 void icmp_err(struct sk_buff *skb, u32 info);
 int icmp_init(void);
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -755,6 +755,39 @@ out:;
 }
 EXPORT_SYMBOL(__icmp_send);
 
+#if IS_ENABLED(CONFIG_NF_NAT)
+#include <net/netfilter/nf_conntrack.h>
+void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info)
+{
+	struct sk_buff *cloned_skb = NULL;
+	enum ip_conntrack_info ctinfo;
+	struct nf_conn *ct;
+	__be32 orig_ip;
+
+	ct = nf_ct_get(skb_in, &ctinfo);
+	if (!ct || !(ct->status & IPS_SRC_NAT)) {
+		icmp_send(skb_in, type, code, info);
+		return;
+	}
+
+	if (skb_shared(skb_in))
+		skb_in = cloned_skb = skb_clone(skb_in, GFP_ATOMIC);
+
+	if (unlikely(!skb_in || skb_network_header(skb_in) < skb_in->head ||
+	    (skb_network_header(skb_in) + sizeof(struct iphdr)) >
+	    skb_tail_pointer(skb_in) || skb_ensure_writable(skb_in,
+	    skb_network_offset(skb_in) + sizeof(struct iphdr))))
+		goto out;
+
+	orig_ip = ip_hdr(skb_in)->saddr;
+	ip_hdr(skb_in)->saddr = ct->tuplehash[0].tuple.src.u3.ip;
+	icmp_send(skb_in, type, code, info);
+	ip_hdr(skb_in)->saddr = orig_ip;
+out:
+	consume_skb(cloned_skb);
+}
+EXPORT_SYMBOL(icmp_ndo_send);
+#endif
 
 static void icmp_socket_deliver(struct sk_buff *skb, u32 info)
 {
--- a/net/ipv6/ip6_icmp.c
+++ b/net/ipv6/ip6_icmp.c
@@ -45,4 +45,38 @@ out:
 	rcu_read_unlock();
 }
 EXPORT_SYMBOL(icmpv6_send);
+
+#if IS_ENABLED(CONFIG_NF_NAT)
+#include <net/netfilter/nf_conntrack.h>
+void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info)
+{
+	struct sk_buff *cloned_skb = NULL;
+	enum ip_conntrack_info ctinfo;
+	struct in6_addr orig_ip;
+	struct nf_conn *ct;
+
+	ct = nf_ct_get(skb_in, &ctinfo);
+	if (!ct || !(ct->status & IPS_SRC_NAT)) {
+		icmpv6_send(skb_in, type, code, info);
+		return;
+	}
+
+	if (skb_shared(skb_in))
+		skb_in = cloned_skb = skb_clone(skb_in, GFP_ATOMIC);
+
+	if (unlikely(!skb_in || skb_network_header(skb_in) < skb_in->head ||
+	    (skb_network_header(skb_in) + sizeof(struct ipv6hdr)) >
+	    skb_tail_pointer(skb_in) || skb_ensure_writable(skb_in,
+	    skb_network_offset(skb_in) + sizeof(struct ipv6hdr))))
+		goto out;
+
+	orig_ip = ipv6_hdr(skb_in)->saddr;
+	ipv6_hdr(skb_in)->saddr = ct->tuplehash[0].tuple.src.u3.in6;
+	icmpv6_send(skb_in, type, code, info);
+	ipv6_hdr(skb_in)->saddr = orig_ip;
+out:
+	consume_skb(cloned_skb);
+}
+EXPORT_SYMBOL(icmpv6_ndo_send);
+#endif
 #endif



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

* [PATCH 4.19 240/247] gtp: use icmp_ndo_send helper
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (238 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 239/247] icmp: introduce helper for natd source address in network device context Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 241/247] sunvnet: " Greg Kroah-Hartman
                   ` (9 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jason A. Donenfeld, Harald Welte,
	David S. Miller

From: Jason A. Donenfeld <Jason@zx2c4.com>

commit e0fce6f945a26d4e953a147fe7ca11410322c9fe upstream.

Because gtp is calling icmp from network device context, it should use
the ndo helper so that the rate limiting applies correctly.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Harald Welte <laforge@gnumonks.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/gtp.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -550,8 +550,8 @@ static int gtp_build_skb_ip4(struct sk_b
 	    mtu < ntohs(iph->tot_len)) {
 		netdev_dbg(dev, "packet too big, fragmentation needed\n");
 		memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
-		icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
-			  htonl(mtu));
+		icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
+			      htonl(mtu));
 		goto err_rt;
 	}
 



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

* [PATCH 4.19 241/247] sunvnet: use icmp_ndo_send helper
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (239 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 240/247] gtp: use icmp_ndo_send helper Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 242/247] xfrm: interface: " Greg Kroah-Hartman
                   ` (8 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jason A. Donenfeld, Shannon Nelson,
	David S. Miller

From: Jason A. Donenfeld <Jason@zx2c4.com>

commit 67c9a7e1e3ac491b5df018803639addc36f154ba upstream.

Because sunvnet is calling icmp from network device context, it should use
the ndo helper so that the rate limiting applies correctly. While we're
at it, doing the additional route lookup before calling icmp_ndo_send is
superfluous, since this is the job of the icmp code in the first place.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/sun/sunvnet_common.c |   23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

--- a/drivers/net/ethernet/sun/sunvnet_common.c
+++ b/drivers/net/ethernet/sun/sunvnet_common.c
@@ -1353,27 +1353,12 @@ sunvnet_start_xmit_common(struct sk_buff
 		if (vio_version_after_eq(&port->vio, 1, 3))
 			localmtu -= VLAN_HLEN;
 
-		if (skb->protocol == htons(ETH_P_IP)) {
-			struct flowi4 fl4;
-			struct rtable *rt = NULL;
-
-			memset(&fl4, 0, sizeof(fl4));
-			fl4.flowi4_oif = dev->ifindex;
-			fl4.flowi4_tos = RT_TOS(ip_hdr(skb)->tos);
-			fl4.daddr = ip_hdr(skb)->daddr;
-			fl4.saddr = ip_hdr(skb)->saddr;
-
-			rt = ip_route_output_key(dev_net(dev), &fl4);
-			if (!IS_ERR(rt)) {
-				skb_dst_set(skb, &rt->dst);
-				icmp_send(skb, ICMP_DEST_UNREACH,
-					  ICMP_FRAG_NEEDED,
-					  htonl(localmtu));
-			}
-		}
+		if (skb->protocol == htons(ETH_P_IP))
+			icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
+				      htonl(localmtu));
 #if IS_ENABLED(CONFIG_IPV6)
 		else if (skb->protocol == htons(ETH_P_IPV6))
-			icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, localmtu);
+			icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, localmtu);
 #endif
 		goto out_dropped;
 	}



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

* [PATCH 4.19 242/247] xfrm: interface: use icmp_ndo_send helper
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (240 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 241/247] sunvnet: " Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 243/247] ipv6: icmp6: avoid indirect call for icmpv6_send() Greg Kroah-Hartman
                   ` (7 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jason A. Donenfeld, Nicolas Dichtel,
	Steffen Klassert, David S. Miller

From: Jason A. Donenfeld <Jason@zx2c4.com>

commit 45942ba890e6f35232727a5fa33d732681f4eb9f upstream.

Because xfrmi is calling icmp from network device context, it should use
the ndo helper so that the rate limiting applies correctly.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/xfrm/xfrm_interface.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/net/xfrm/xfrm_interface.c
+++ b/net/xfrm/xfrm_interface.c
@@ -300,10 +300,10 @@ xfrmi_xmit2(struct sk_buff *skb, struct
 			if (mtu < IPV6_MIN_MTU)
 				mtu = IPV6_MIN_MTU;
 
-			icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
+			icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
 		} else {
-			icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
-				  htonl(mtu));
+			icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
+				      htonl(mtu));
 		}
 
 		dst_release(dst);



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

* [PATCH 4.19 243/247] ipv6: icmp6: avoid indirect call for icmpv6_send()
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (241 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 242/247] xfrm: interface: " Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 244/247] ipv6: silence compilation warning for non-IPV6 builds Greg Kroah-Hartman
                   ` (6 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Eric Dumazet, David S. Miller

From: Eric Dumazet <edumazet@google.com>

commit cc7a21b6fbd945f8d8f61422ccd27203c1fafeb7 upstream.

If IPv6 is builtin, we do not need an expensive indirect call
to reach icmp6_send().

v2: put inline keyword before the type to avoid sparse warnings.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 include/linux/icmpv6.h |   22 +++++++++++++++++++++-
 net/ipv6/icmp.c        |    5 +++--
 net/ipv6/ip6_icmp.c    |   10 +++++-----
 3 files changed, 29 insertions(+), 8 deletions(-)

--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -13,12 +13,32 @@ static inline struct icmp6hdr *icmp6_hdr
 #include <linux/netdevice.h>
 
 #if IS_ENABLED(CONFIG_IPV6)
-extern void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info);
 
 typedef void ip6_icmp_send_t(struct sk_buff *skb, u8 type, u8 code, __u32 info,
 			     const struct in6_addr *force_saddr);
+#if IS_BUILTIN(CONFIG_IPV6)
+void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
+		const struct in6_addr *force_saddr);
+static inline void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
+{
+	icmp6_send(skb, type, code, info, NULL);
+}
+static inline int inet6_register_icmp_sender(ip6_icmp_send_t *fn)
+{
+	BUILD_BUG_ON(fn != icmp6_send);
+	return 0;
+}
+static inline int inet6_unregister_icmp_sender(ip6_icmp_send_t *fn)
+{
+	BUILD_BUG_ON(fn != icmp6_send);
+	return 0;
+}
+#else
+extern void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info);
 extern int inet6_register_icmp_sender(ip6_icmp_send_t *fn);
 extern int inet6_unregister_icmp_sender(ip6_icmp_send_t *fn);
+#endif
+
 int ip6_err_gen_icmpv6_unreach(struct sk_buff *skb, int nhs, int type,
 			       unsigned int data_len);
 
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -418,8 +418,8 @@ static int icmp6_iif(const struct sk_buf
 /*
  *	Send an ICMP message in response to a packet in error
  */
-static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
-		       const struct in6_addr *force_saddr)
+void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
+		const struct in6_addr *force_saddr)
 {
 	struct inet6_dev *idev = NULL;
 	struct ipv6hdr *hdr = ipv6_hdr(skb);
@@ -592,6 +592,7 @@ out:
 out_bh_enable:
 	local_bh_enable();
 }
+EXPORT_SYMBOL(icmp6_send);
 
 /* Slightly more convenient version of icmp6_send.
  */
--- a/net/ipv6/ip6_icmp.c
+++ b/net/ipv6/ip6_icmp.c
@@ -9,6 +9,8 @@
 
 #if IS_ENABLED(CONFIG_IPV6)
 
+#if !IS_BUILTIN(CONFIG_IPV6)
+
 static ip6_icmp_send_t __rcu *ip6_icmp_send;
 
 int inet6_register_icmp_sender(ip6_icmp_send_t *fn)
@@ -37,14 +39,12 @@ void icmpv6_send(struct sk_buff *skb, u8
 
 	rcu_read_lock();
 	send = rcu_dereference(ip6_icmp_send);
-
-	if (!send)
-		goto out;
-	send(skb, type, code, info, NULL);
-out:
+	if (send)
+		send(skb, type, code, info, NULL);
 	rcu_read_unlock();
 }
 EXPORT_SYMBOL(icmpv6_send);
+#endif
 
 #if IS_ENABLED(CONFIG_NF_NAT)
 #include <net/netfilter/nf_conntrack.h>



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

* [PATCH 4.19 244/247] ipv6: silence compilation warning for non-IPV6 builds
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (242 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 243/247] ipv6: icmp6: avoid indirect call for icmpv6_send() Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 245/247] net: icmp: pass zeroed opts from icmp{,v6}_ndo_send before sending Greg Kroah-Hartman
                   ` (5 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Leon Romanovsky, Jakub Kicinski

From: Leon Romanovsky <leonro@nvidia.com>

commit 1faba27f11c8da244e793546a1b35a9b1da8208e upstream.

The W=1 compilation of allmodconfig generates the following warning:

net/ipv6/icmp.c:448:6: warning: no previous prototype for 'icmp6_send' [-Wmissing-prototypes]
  448 | void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
      |      ^~~~~~~~~~

Fix it by providing function declaration for builds with ipv6 as a module.

Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 include/linux/icmpv6.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -16,9 +16,9 @@ static inline struct icmp6hdr *icmp6_hdr
 
 typedef void ip6_icmp_send_t(struct sk_buff *skb, u8 type, u8 code, __u32 info,
 			     const struct in6_addr *force_saddr);
-#if IS_BUILTIN(CONFIG_IPV6)
 void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
 		const struct in6_addr *force_saddr);
+#if IS_BUILTIN(CONFIG_IPV6)
 static inline void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
 {
 	icmp6_send(skb, type, code, info, NULL);



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

* [PATCH 4.19 245/247] net: icmp: pass zeroed opts from icmp{,v6}_ndo_send before sending
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (243 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 244/247] ipv6: silence compilation warning for non-IPV6 builds Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 246/247] dm era: Update in-core bitset after committing the metadata Greg Kroah-Hartman
                   ` (4 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, SinYu, Willem de Bruijn,
	Jason A. Donenfeld, Jakub Kicinski

From: Jason A. Donenfeld <Jason@zx2c4.com>

commit ee576c47db60432c37e54b1e2b43a8ca6d3a8dca upstream.

The icmp{,v6}_send functions make all sorts of use of skb->cb, casting
it with IPCB or IP6CB, assuming the skb to have come directly from the
inet layer. But when the packet comes from the ndo layer, especially
when forwarded, there's no telling what might be in skb->cb at that
point. As a result, the icmp sending code risks reading bogus memory
contents, which can result in nasty stack overflows such as this one
reported by a user:

    panic+0x108/0x2ea
    __stack_chk_fail+0x14/0x20
    __icmp_send+0x5bd/0x5c0
    icmp_ndo_send+0x148/0x160

In icmp_send, skb->cb is cast with IPCB and an ip_options struct is read
from it. The optlen parameter there is of particular note, as it can
induce writes beyond bounds. There are quite a few ways that can happen
in __ip_options_echo. For example:

    // sptr/skb are attacker-controlled skb bytes
    sptr = skb_network_header(skb);
    // dptr/dopt points to stack memory allocated by __icmp_send
    dptr = dopt->__data;
    // sopt is the corrupt skb->cb in question
    if (sopt->rr) {
        optlen  = sptr[sopt->rr+1]; // corrupt skb->cb + skb->data
        soffset = sptr[sopt->rr+2]; // corrupt skb->cb + skb->data
	// this now writes potentially attacker-controlled data, over
	// flowing the stack:
        memcpy(dptr, sptr+sopt->rr, optlen);
    }

In the icmpv6_send case, the story is similar, but not as dire, as only
IP6CB(skb)->iif and IP6CB(skb)->dsthao are used. The dsthao case is
worse than the iif case, but it is passed to ipv6_find_tlv, which does
a bit of bounds checking on the value.

This is easy to simulate by doing a `memset(skb->cb, 0x41,
sizeof(skb->cb));` before calling icmp{,v6}_ndo_send, and it's only by
good fortune and the rarity of icmp sending from that context that we've
avoided reports like this until now. For example, in KASAN:

    BUG: KASAN: stack-out-of-bounds in __ip_options_echo+0xa0e/0x12b0
    Write of size 38 at addr ffff888006f1f80e by task ping/89
    CPU: 2 PID: 89 Comm: ping Not tainted 5.10.0-rc7-debug+ #5
    Call Trace:
     dump_stack+0x9a/0xcc
     print_address_description.constprop.0+0x1a/0x160
     __kasan_report.cold+0x20/0x38
     kasan_report+0x32/0x40
     check_memory_region+0x145/0x1a0
     memcpy+0x39/0x60
     __ip_options_echo+0xa0e/0x12b0
     __icmp_send+0x744/0x1700

Actually, out of the 4 drivers that do this, only gtp zeroed the cb for
the v4 case, while the rest did not. So this commit actually removes the
gtp-specific zeroing, while putting the code where it belongs in the
shared infrastructure of icmp{,v6}_ndo_send.

This commit fixes the issue by passing an empty IPCB or IP6CB along to
the functions that actually do the work. For the icmp_send, this was
already trivial, thanks to __icmp_send providing the plumbing function.
For icmpv6_send, this required a tiny bit of refactoring to make it
behave like the v4 case, after which it was straight forward.

Fixes: a2b78e9b2cac ("sunvnet: generate ICMP PTMUD messages for smaller port MTUs")
Reported-by: SinYu <liuxyon@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/netdev/CAF=yD-LOF116aHub6RMe8vB8ZpnrrnoTdqhobEx+bvoA8AsP0w@mail.gmail.com/T/
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Link: https://lore.kernel.org/r/20210223131858.72082-1-Jason@zx2c4.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/gtp.c      |    1 -
 include/linux/icmpv6.h |   26 ++++++++++++++++++++------
 include/linux/ipv6.h   |    2 +-
 include/net/icmp.h     |    6 +++++-
 net/ipv4/icmp.c        |    5 +++--
 net/ipv6/icmp.c        |   16 ++++++++--------
 net/ipv6/ip6_icmp.c    |   12 +++++++-----
 7 files changed, 44 insertions(+), 24 deletions(-)

--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -549,7 +549,6 @@ static int gtp_build_skb_ip4(struct sk_b
 	if (!skb_is_gso(skb) && (iph->frag_off & htons(IP_DF)) &&
 	    mtu < ntohs(iph->tot_len)) {
 		netdev_dbg(dev, "packet too big, fragmentation needed\n");
-		memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
 		icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
 			      htonl(mtu));
 		goto err_rt;
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -3,6 +3,7 @@
 #define _LINUX_ICMPV6_H
 
 #include <linux/skbuff.h>
+#include <linux/ipv6.h>
 #include <uapi/linux/icmpv6.h>
 
 static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb)
@@ -15,13 +16,16 @@ static inline struct icmp6hdr *icmp6_hdr
 #if IS_ENABLED(CONFIG_IPV6)
 
 typedef void ip6_icmp_send_t(struct sk_buff *skb, u8 type, u8 code, __u32 info,
-			     const struct in6_addr *force_saddr);
+			     const struct in6_addr *force_saddr,
+			     const struct inet6_skb_parm *parm);
 void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
-		const struct in6_addr *force_saddr);
+		const struct in6_addr *force_saddr,
+		const struct inet6_skb_parm *parm);
 #if IS_BUILTIN(CONFIG_IPV6)
-static inline void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
+static inline void __icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
+				 const struct inet6_skb_parm *parm)
 {
-	icmp6_send(skb, type, code, info, NULL);
+	icmp6_send(skb, type, code, info, NULL, parm);
 }
 static inline int inet6_register_icmp_sender(ip6_icmp_send_t *fn)
 {
@@ -34,11 +38,17 @@ static inline int inet6_unregister_icmp_
 	return 0;
 }
 #else
-extern void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info);
+extern void __icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
+			  const struct inet6_skb_parm *parm);
 extern int inet6_register_icmp_sender(ip6_icmp_send_t *fn);
 extern int inet6_unregister_icmp_sender(ip6_icmp_send_t *fn);
 #endif
 
+static inline void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
+{
+	__icmpv6_send(skb, type, code, info, IP6CB(skb));
+}
+
 int ip6_err_gen_icmpv6_unreach(struct sk_buff *skb, int nhs, int type,
 			       unsigned int data_len);
 
@@ -54,7 +64,11 @@ static inline void icmpv6_send(struct sk
 #if IS_ENABLED(CONFIG_NF_NAT)
 void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info);
 #else
-#define icmpv6_ndo_send icmpv6_send
+static inline void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info)
+{
+	struct inet6_skb_parm parm = { 0 };
+	__icmpv6_send(skb_in, type, code, info, &parm);
+}
 #endif
 
 extern int				icmpv6_init(void);
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -3,6 +3,7 @@
 #define _IPV6_H
 
 #include <uapi/linux/ipv6.h>
+#include <uapi/linux/icmpv6.h>
 
 #define ipv6_optlen(p)  (((p)->hdrlen+1) << 3)
 #define ipv6_authlen(p) (((p)->hdrlen+2) << 2)
@@ -83,7 +84,6 @@ struct ipv6_params {
 	__s32 autoconf;
 };
 extern struct ipv6_params ipv6_defaults;
-#include <linux/icmpv6.h>
 #include <linux/tcp.h>
 #include <linux/udp.h>
 
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -50,7 +50,11 @@ static inline void icmp_send(struct sk_b
 #if IS_ENABLED(CONFIG_NF_NAT)
 void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info);
 #else
-#define icmp_ndo_send icmp_send
+static inline void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info)
+{
+	struct ip_options opts = { 0 };
+	__icmp_send(skb_in, type, code, info, &opts);
+}
 #endif
 
 int icmp_rcv(struct sk_buff *skb);
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -760,13 +760,14 @@ EXPORT_SYMBOL(__icmp_send);
 void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info)
 {
 	struct sk_buff *cloned_skb = NULL;
+	struct ip_options opts = { 0 };
 	enum ip_conntrack_info ctinfo;
 	struct nf_conn *ct;
 	__be32 orig_ip;
 
 	ct = nf_ct_get(skb_in, &ctinfo);
 	if (!ct || !(ct->status & IPS_SRC_NAT)) {
-		icmp_send(skb_in, type, code, info);
+		__icmp_send(skb_in, type, code, info, &opts);
 		return;
 	}
 
@@ -781,7 +782,7 @@ void icmp_ndo_send(struct sk_buff *skb_i
 
 	orig_ip = ip_hdr(skb_in)->saddr;
 	ip_hdr(skb_in)->saddr = ct->tuplehash[0].tuple.src.u3.ip;
-	icmp_send(skb_in, type, code, info);
+	__icmp_send(skb_in, type, code, info, &opts);
 	ip_hdr(skb_in)->saddr = orig_ip;
 out:
 	consume_skb(cloned_skb);
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -309,10 +309,9 @@ static int icmpv6_getfrag(void *from, ch
 }
 
 #if IS_ENABLED(CONFIG_IPV6_MIP6)
-static void mip6_addr_swap(struct sk_buff *skb)
+static void mip6_addr_swap(struct sk_buff *skb, const struct inet6_skb_parm *opt)
 {
 	struct ipv6hdr *iph = ipv6_hdr(skb);
-	struct inet6_skb_parm *opt = IP6CB(skb);
 	struct ipv6_destopt_hao *hao;
 	struct in6_addr tmp;
 	int off;
@@ -329,7 +328,7 @@ static void mip6_addr_swap(struct sk_buf
 	}
 }
 #else
-static inline void mip6_addr_swap(struct sk_buff *skb) {}
+static inline void mip6_addr_swap(struct sk_buff *skb, const struct inet6_skb_parm *opt) {}
 #endif
 
 static struct dst_entry *icmpv6_route_lookup(struct net *net,
@@ -419,7 +418,8 @@ static int icmp6_iif(const struct sk_buf
  *	Send an ICMP message in response to a packet in error
  */
 void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
-		const struct in6_addr *force_saddr)
+		const struct in6_addr *force_saddr,
+		const struct inet6_skb_parm *parm)
 {
 	struct inet6_dev *idev = NULL;
 	struct ipv6hdr *hdr = ipv6_hdr(skb);
@@ -512,7 +512,7 @@ void icmp6_send(struct sk_buff *skb, u8
 	if (!(skb->dev->flags&IFF_LOOPBACK) && !icmpv6_global_allow(type))
 		goto out_bh_enable;
 
-	mip6_addr_swap(skb);
+	mip6_addr_swap(skb, parm);
 
 	memset(&fl6, 0, sizeof(fl6));
 	fl6.flowi6_proto = IPPROTO_ICMPV6;
@@ -598,7 +598,7 @@ EXPORT_SYMBOL(icmp6_send);
  */
 void icmpv6_param_prob(struct sk_buff *skb, u8 code, int pos)
 {
-	icmp6_send(skb, ICMPV6_PARAMPROB, code, pos, NULL);
+	icmp6_send(skb, ICMPV6_PARAMPROB, code, pos, NULL, IP6CB(skb));
 	kfree_skb(skb);
 }
 
@@ -655,10 +655,10 @@ int ip6_err_gen_icmpv6_unreach(struct sk
 	}
 	if (type == ICMP_TIME_EXCEEDED)
 		icmp6_send(skb2, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT,
-			   info, &temp_saddr);
+			   info, &temp_saddr, IP6CB(skb2));
 	else
 		icmp6_send(skb2, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH,
-			   info, &temp_saddr);
+			   info, &temp_saddr, IP6CB(skb2));
 	if (rt)
 		ip6_rt_put(rt);
 
--- a/net/ipv6/ip6_icmp.c
+++ b/net/ipv6/ip6_icmp.c
@@ -33,23 +33,25 @@ int inet6_unregister_icmp_sender(ip6_icm
 }
 EXPORT_SYMBOL(inet6_unregister_icmp_sender);
 
-void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
+void __icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
+		   const struct inet6_skb_parm *parm)
 {
 	ip6_icmp_send_t *send;
 
 	rcu_read_lock();
 	send = rcu_dereference(ip6_icmp_send);
 	if (send)
-		send(skb, type, code, info, NULL);
+		send(skb, type, code, info, NULL, parm);
 	rcu_read_unlock();
 }
-EXPORT_SYMBOL(icmpv6_send);
+EXPORT_SYMBOL(__icmpv6_send);
 #endif
 
 #if IS_ENABLED(CONFIG_NF_NAT)
 #include <net/netfilter/nf_conntrack.h>
 void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info)
 {
+	struct inet6_skb_parm parm = { 0 };
 	struct sk_buff *cloned_skb = NULL;
 	enum ip_conntrack_info ctinfo;
 	struct in6_addr orig_ip;
@@ -57,7 +59,7 @@ void icmpv6_ndo_send(struct sk_buff *skb
 
 	ct = nf_ct_get(skb_in, &ctinfo);
 	if (!ct || !(ct->status & IPS_SRC_NAT)) {
-		icmpv6_send(skb_in, type, code, info);
+		__icmpv6_send(skb_in, type, code, info, &parm);
 		return;
 	}
 
@@ -72,7 +74,7 @@ void icmpv6_ndo_send(struct sk_buff *skb
 
 	orig_ip = ipv6_hdr(skb_in)->saddr;
 	ipv6_hdr(skb_in)->saddr = ct->tuplehash[0].tuple.src.u3.in6;
-	icmpv6_send(skb_in, type, code, info);
+	__icmpv6_send(skb_in, type, code, info, &parm);
 	ipv6_hdr(skb_in)->saddr = orig_ip;
 out:
 	consume_skb(cloned_skb);



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

* [PATCH 4.19 246/247] dm era: Update in-core bitset after committing the metadata
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (244 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 245/247] net: icmp: pass zeroed opts from icmp{,v6}_ndo_send before sending Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 16:14 ` [PATCH 4.19 247/247] net: qrtr: Fix memory leak in qrtr_tun_open Greg Kroah-Hartman
                   ` (3 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Nikos Tsironis, Mike Snitzer

From: Nikos Tsironis <ntsironis@arrikto.com>

commit 2099b145d77c1d53f5711f029c37cc537897cee6 upstream.

In case of a system crash, dm-era might fail to mark blocks as written
in its metadata, although the corresponding writes to these blocks were
passed down to the origin device and completed successfully.

Consider the following sequence of events:

1. We write to a block that has not been yet written in the current era
2. era_map() checks the in-core bitmap for the current era and sees
   that the block is not marked as written.
3. The write is deferred for submission after the metadata have been
   updated and committed.
4. The worker thread processes the deferred write
   (process_deferred_bios()) and marks the block as written in the
   in-core bitmap, **before** committing the metadata.
5. The worker thread starts committing the metadata.
6. We do more writes that map to the same block as the write of step (1)
7. era_map() checks the in-core bitmap and sees that the block is marked
   as written, **although the metadata have not been committed yet**.
8. These writes are passed down to the origin device immediately and the
   device reports them as completed.
9. The system crashes, e.g., power failure, before the commit from step
   (5) finishes.

When the system recovers and we query the dm-era target for the list of
written blocks it doesn't report the aforementioned block as written,
although the writes of step (6) completed successfully.

The issue is that era_map() decides whether to defer or not a write
based on non committed information. The root cause of the bug is that we
update the in-core bitmap, **before** committing the metadata.

Fix this by updating the in-core bitmap **after** successfully
committing the metadata.

Fixes: eec40579d84873 ("dm: add era target")
Cc: stable@vger.kernel.org # v3.15+
Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/md/dm-era-target.c |   25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

--- a/drivers/md/dm-era-target.c
+++ b/drivers/md/dm-era-target.c
@@ -134,7 +134,7 @@ static int writeset_test_and_set(struct
 {
 	int r;
 
-	if (!test_and_set_bit(block, ws->bits)) {
+	if (!test_bit(block, ws->bits)) {
 		r = dm_bitset_set_bit(info, ws->md.root, block, &ws->md.root);
 		if (r) {
 			/* FIXME: fail mode */
@@ -1240,8 +1240,10 @@ static void process_deferred_bios(struct
 	int r;
 	struct bio_list deferred_bios, marked_bios;
 	struct bio *bio;
+	struct blk_plug plug;
 	bool commit_needed = false;
 	bool failed = false;
+	struct writeset *ws = era->md->current_writeset;
 
 	bio_list_init(&deferred_bios);
 	bio_list_init(&marked_bios);
@@ -1251,9 +1253,11 @@ static void process_deferred_bios(struct
 	bio_list_init(&era->deferred_bios);
 	spin_unlock(&era->deferred_lock);
 
+	if (bio_list_empty(&deferred_bios))
+		return;
+
 	while ((bio = bio_list_pop(&deferred_bios))) {
-		r = writeset_test_and_set(&era->md->bitset_info,
-					  era->md->current_writeset,
+		r = writeset_test_and_set(&era->md->bitset_info, ws,
 					  get_block(era, bio));
 		if (r < 0) {
 			/*
@@ -1261,7 +1265,6 @@ static void process_deferred_bios(struct
 			 * FIXME: finish.
 			 */
 			failed = true;
-
 		} else if (r == 0)
 			commit_needed = true;
 
@@ -1277,9 +1280,19 @@ static void process_deferred_bios(struct
 	if (failed)
 		while ((bio = bio_list_pop(&marked_bios)))
 			bio_io_error(bio);
-	else
-		while ((bio = bio_list_pop(&marked_bios)))
+	else {
+		blk_start_plug(&plug);
+		while ((bio = bio_list_pop(&marked_bios))) {
+			/*
+			 * Only update the in-core writeset if the on-disk one
+			 * was updated too.
+			 */
+			if (commit_needed)
+				set_bit(get_block(era, bio), ws->bits);
 			generic_make_request(bio);
+		}
+		blk_finish_plug(&plug);
+	}
 }
 
 static void process_rpc_calls(struct era *era)



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

* [PATCH 4.19 247/247] net: qrtr: Fix memory leak in qrtr_tun_open
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (245 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 246/247] dm era: Update in-core bitset after committing the metadata Greg Kroah-Hartman
@ 2021-03-01 16:14 ` Greg Kroah-Hartman
  2021-03-01 21:45 ` [PATCH 4.19 000/247] 4.19.178-rc1 review Shuah Khan
                   ` (2 subsequent siblings)
  249 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-01 16:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, syzbot+5d6e4af21385f5cfc56a,
	Takeshi Misawa, Jakub Kicinski

From: Takeshi Misawa <jeliantsurux@gmail.com>

commit fc0494ead6398609c49afa37bc949b61c5c16b91 upstream.

If qrtr_endpoint_register() failed, tun is leaked.
Fix this, by freeing tun in error path.

syzbot report:
BUG: memory leak
unreferenced object 0xffff88811848d680 (size 64):
  comm "syz-executor684", pid 10171, jiffies 4294951561 (age 26.070s)
  hex dump (first 32 bytes):
    80 dd 0a 84 ff ff ff ff 00 00 00 00 00 00 00 00  ................
    90 d6 48 18 81 88 ff ff 90 d6 48 18 81 88 ff ff  ..H.......H.....
  backtrace:
    [<0000000018992a50>] kmalloc include/linux/slab.h:552 [inline]
    [<0000000018992a50>] kzalloc include/linux/slab.h:682 [inline]
    [<0000000018992a50>] qrtr_tun_open+0x22/0x90 net/qrtr/tun.c:35
    [<0000000003a453ef>] misc_open+0x19c/0x1e0 drivers/char/misc.c:141
    [<00000000dec38ac8>] chrdev_open+0x10d/0x340 fs/char_dev.c:414
    [<0000000079094996>] do_dentry_open+0x1e6/0x620 fs/open.c:817
    [<000000004096d290>] do_open fs/namei.c:3252 [inline]
    [<000000004096d290>] path_openat+0x74a/0x1b00 fs/namei.c:3369
    [<00000000b8e64241>] do_filp_open+0xa0/0x190 fs/namei.c:3396
    [<00000000a3299422>] do_sys_openat2+0xed/0x230 fs/open.c:1172
    [<000000002c1bdcef>] do_sys_open fs/open.c:1188 [inline]
    [<000000002c1bdcef>] __do_sys_openat fs/open.c:1204 [inline]
    [<000000002c1bdcef>] __se_sys_openat fs/open.c:1199 [inline]
    [<000000002c1bdcef>] __x64_sys_openat+0x7f/0xe0 fs/open.c:1199
    [<00000000f3a5728f>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
    [<000000004b38b7ec>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

Fixes: 28fb4e59a47d ("net: qrtr: Expose tunneling endpoint to user space")
Reported-by: syzbot+5d6e4af21385f5cfc56a@syzkaller.appspotmail.com
Signed-off-by: Takeshi Misawa <jeliantsurux@gmail.com>
Link: https://lore.kernel.org/r/20210221234427.GA2140@DESKTOP
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/qrtr/tun.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

--- a/net/qrtr/tun.c
+++ b/net/qrtr/tun.c
@@ -31,6 +31,7 @@ static int qrtr_tun_send(struct qrtr_end
 static int qrtr_tun_open(struct inode *inode, struct file *filp)
 {
 	struct qrtr_tun *tun;
+	int ret;
 
 	tun = kzalloc(sizeof(*tun), GFP_KERNEL);
 	if (!tun)
@@ -43,7 +44,16 @@ static int qrtr_tun_open(struct inode *i
 
 	filp->private_data = tun;
 
-	return qrtr_endpoint_register(&tun->ep, QRTR_EP_NID_AUTO);
+	ret = qrtr_endpoint_register(&tun->ep, QRTR_EP_NID_AUTO);
+	if (ret)
+		goto out;
+
+	return 0;
+
+out:
+	filp->private_data = NULL;
+	kfree(tun);
+	return ret;
 }
 
 static ssize_t qrtr_tun_read_iter(struct kiocb *iocb, struct iov_iter *to)



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

* Re: [PATCH 4.19 209/247] staging/mt7621-dma: mtk-hsdma.c->hsdma-mt7621.c
  2021-03-01 16:13 ` [PATCH 4.19 209/247] staging/mt7621-dma: mtk-hsdma.c->hsdma-mt7621.c Greg Kroah-Hartman
@ 2021-03-01 17:41   ` Ilya Lipnitskiy
  2021-03-04  8:14     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 280+ messages in thread
From: Ilya Lipnitskiy @ 2021-03-01 17:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Linux Kernel Mailing List, stable, Masahiro Yamada

Sorry, I should have been more clear in my original email, but we
don't strictly need this in 4.19 as the check only became fatal in
5.10 (actually, before 5.10, but 5.10 is the first stable release with
it). Feel free to take or omit this from 4.19.

On Mon, Mar 1, 2021 at 8:45 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
>
> commit 1f92798cbe7fe923479cff754dd06dd23d352e36 upstream.
>
> Also use KBUILD_MODNAME for module name.
>
> This driver is only used by RALINK MIPS MT7621 SoCs. Tested by building
> against that target using OpenWrt with Linux 5.10.10.
>
> Fixes the following error:
> error: the following would cause module name conflict:
>   drivers/dma/mediatek/mtk-hsdma.ko
>   drivers/staging/mt7621-dma/mtk-hsdma.ko
>
> Cc: stable@vger.kernel.org
> Cc: Masahiro Yamada <masahiroy@kernel.org>
> Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
> Link: https://lore.kernel.org/r/20210130034507.2115280-1-ilya.lipnitskiy@gmail.com
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/staging/mt7621-dma/Makefile       |    2
>  drivers/staging/mt7621-dma/hsdma-mt7621.c |  771 ++++++++++++++++++++++++++++++
>  drivers/staging/mt7621-dma/mtk-hsdma.c    |  771 ------------------------------
>  3 files changed, 772 insertions(+), 772 deletions(-)
>  rename drivers/staging/mt7621-dma/{mtk-hsdma.c => hsdma-mt7621.c} (99%)
>
> --- a/drivers/staging/mt7621-dma/Makefile
> +++ b/drivers/staging/mt7621-dma/Makefile
> @@ -1,4 +1,4 @@
>  obj-$(CONFIG_DMA_RALINK) += ralink-gdma.o
> -obj-$(CONFIG_MTK_HSDMA) += mtk-hsdma.o
> +obj-$(CONFIG_MTK_HSDMA) += hsdma-mt7621.o
>
>  ccflags-y += -I$(srctree)/drivers/dma
> --- /dev/null
> +++ b/drivers/staging/mt7621-dma/hsdma-mt7621.c
> @@ -0,0 +1,771 @@
> +/*
> + *  Copyright (C) 2015, Michael Lee <igvtee@gmail.com>
> + *  MTK HSDMA support
> + *
> + *  This program is free software; you can redistribute it and/or modify it
> + *  under  the terms of the GNU General         Public License as published by the
> + *  Free Software Foundation;  either version 2 of the License, or (at your
> + *  option) any later version.
> + *
> + */
> +
> +#include <linux/dmaengine.h>
> +#include <linux/dma-mapping.h>
> +#include <linux/err.h>
> +#include <linux/init.h>
> +#include <linux/list.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/slab.h>
> +#include <linux/spinlock.h>
> +#include <linux/irq.h>
> +#include <linux/of_dma.h>
> +#include <linux/reset.h>
> +#include <linux/of_device.h>
> +
> +#include "virt-dma.h"
> +
> +#define HSDMA_BASE_OFFSET              0x800
> +
> +#define HSDMA_REG_TX_BASE              0x00
> +#define HSDMA_REG_TX_CNT               0x04
> +#define HSDMA_REG_TX_CTX               0x08
> +#define HSDMA_REG_TX_DTX               0x0c
> +#define HSDMA_REG_RX_BASE              0x100
> +#define HSDMA_REG_RX_CNT               0x104
> +#define HSDMA_REG_RX_CRX               0x108
> +#define HSDMA_REG_RX_DRX               0x10c
> +#define HSDMA_REG_INFO                 0x200
> +#define HSDMA_REG_GLO_CFG              0x204
> +#define HSDMA_REG_RST_CFG              0x208
> +#define HSDMA_REG_DELAY_INT            0x20c
> +#define HSDMA_REG_FREEQ_THRES          0x210
> +#define HSDMA_REG_INT_STATUS           0x220
> +#define HSDMA_REG_INT_MASK             0x228
> +#define HSDMA_REG_SCH_Q01              0x280
> +#define HSDMA_REG_SCH_Q23              0x284
> +
> +#define HSDMA_DESCS_MAX                        0xfff
> +#define HSDMA_DESCS_NUM                        8
> +#define HSDMA_DESCS_MASK               (HSDMA_DESCS_NUM - 1)
> +#define HSDMA_NEXT_DESC(x)             (((x) + 1) & HSDMA_DESCS_MASK)
> +
> +/* HSDMA_REG_INFO */
> +#define HSDMA_INFO_INDEX_MASK          0xf
> +#define HSDMA_INFO_INDEX_SHIFT         24
> +#define HSDMA_INFO_BASE_MASK           0xff
> +#define HSDMA_INFO_BASE_SHIFT          16
> +#define HSDMA_INFO_RX_MASK             0xff
> +#define HSDMA_INFO_RX_SHIFT            8
> +#define HSDMA_INFO_TX_MASK             0xff
> +#define HSDMA_INFO_TX_SHIFT            0
> +
> +/* HSDMA_REG_GLO_CFG */
> +#define HSDMA_GLO_TX_2B_OFFSET         BIT(31)
> +#define HSDMA_GLO_CLK_GATE             BIT(30)
> +#define HSDMA_GLO_BYTE_SWAP            BIT(29)
> +#define HSDMA_GLO_MULTI_DMA            BIT(10)
> +#define HSDMA_GLO_TWO_BUF              BIT(9)
> +#define HSDMA_GLO_32B_DESC             BIT(8)
> +#define HSDMA_GLO_BIG_ENDIAN           BIT(7)
> +#define HSDMA_GLO_TX_DONE              BIT(6)
> +#define HSDMA_GLO_BT_MASK              0x3
> +#define HSDMA_GLO_BT_SHIFT             4
> +#define HSDMA_GLO_RX_BUSY              BIT(3)
> +#define HSDMA_GLO_RX_DMA               BIT(2)
> +#define HSDMA_GLO_TX_BUSY              BIT(1)
> +#define HSDMA_GLO_TX_DMA               BIT(0)
> +
> +#define HSDMA_BT_SIZE_16BYTES          (0 << HSDMA_GLO_BT_SHIFT)
> +#define HSDMA_BT_SIZE_32BYTES          (1 << HSDMA_GLO_BT_SHIFT)
> +#define HSDMA_BT_SIZE_64BYTES          (2 << HSDMA_GLO_BT_SHIFT)
> +#define HSDMA_BT_SIZE_128BYTES         (3 << HSDMA_GLO_BT_SHIFT)
> +
> +#define HSDMA_GLO_DEFAULT              (HSDMA_GLO_MULTI_DMA | \
> +               HSDMA_GLO_RX_DMA | HSDMA_GLO_TX_DMA | HSDMA_BT_SIZE_32BYTES)
> +
> +/* HSDMA_REG_RST_CFG */
> +#define HSDMA_RST_RX_SHIFT             16
> +#define HSDMA_RST_TX_SHIFT             0
> +
> +/* HSDMA_REG_DELAY_INT */
> +#define HSDMA_DELAY_INT_EN             BIT(15)
> +#define HSDMA_DELAY_PEND_OFFSET                8
> +#define HSDMA_DELAY_TIME_OFFSET                0
> +#define HSDMA_DELAY_TX_OFFSET          16
> +#define HSDMA_DELAY_RX_OFFSET          0
> +
> +#define HSDMA_DELAY_INIT(x)            (HSDMA_DELAY_INT_EN | \
> +               ((x) << HSDMA_DELAY_PEND_OFFSET))
> +#define HSDMA_DELAY(x)                 ((HSDMA_DELAY_INIT(x) << \
> +               HSDMA_DELAY_TX_OFFSET) | HSDMA_DELAY_INIT(x))
> +
> +/* HSDMA_REG_INT_STATUS */
> +#define HSDMA_INT_DELAY_RX_COH         BIT(31)
> +#define HSDMA_INT_DELAY_RX_INT         BIT(30)
> +#define HSDMA_INT_DELAY_TX_COH         BIT(29)
> +#define HSDMA_INT_DELAY_TX_INT         BIT(28)
> +#define HSDMA_INT_RX_MASK              0x3
> +#define HSDMA_INT_RX_SHIFT             16
> +#define HSDMA_INT_RX_Q0                        BIT(16)
> +#define HSDMA_INT_TX_MASK              0xf
> +#define HSDMA_INT_TX_SHIFT             0
> +#define HSDMA_INT_TX_Q0                        BIT(0)
> +
> +/* tx/rx dma desc flags */
> +#define HSDMA_PLEN_MASK                        0x3fff
> +#define HSDMA_DESC_DONE                        BIT(31)
> +#define HSDMA_DESC_LS0                 BIT(30)
> +#define HSDMA_DESC_PLEN0(_x)           (((_x) & HSDMA_PLEN_MASK) << 16)
> +#define HSDMA_DESC_TAG                 BIT(15)
> +#define HSDMA_DESC_LS1                 BIT(14)
> +#define HSDMA_DESC_PLEN1(_x)           ((_x) & HSDMA_PLEN_MASK)
> +
> +/* align 4 bytes */
> +#define HSDMA_ALIGN_SIZE               3
> +/* align size 128bytes */
> +#define HSDMA_MAX_PLEN                 0x3f80
> +
> +struct hsdma_desc {
> +       u32 addr0;
> +       u32 flags;
> +       u32 addr1;
> +       u32 unused;
> +};
> +
> +struct mtk_hsdma_sg {
> +       dma_addr_t src_addr;
> +       dma_addr_t dst_addr;
> +       u32 len;
> +};
> +
> +struct mtk_hsdma_desc {
> +       struct virt_dma_desc vdesc;
> +       unsigned int num_sgs;
> +       struct mtk_hsdma_sg sg[1];
> +};
> +
> +struct mtk_hsdma_chan {
> +       struct virt_dma_chan vchan;
> +       unsigned int id;
> +       dma_addr_t desc_addr;
> +       int tx_idx;
> +       int rx_idx;
> +       struct hsdma_desc *tx_ring;
> +       struct hsdma_desc *rx_ring;
> +       struct mtk_hsdma_desc *desc;
> +       unsigned int next_sg;
> +};
> +
> +struct mtk_hsdam_engine {
> +       struct dma_device ddev;
> +       struct device_dma_parameters dma_parms;
> +       void __iomem *base;
> +       struct tasklet_struct task;
> +       volatile unsigned long chan_issued;
> +
> +       struct mtk_hsdma_chan chan[1];
> +};
> +
> +static inline struct mtk_hsdam_engine *mtk_hsdma_chan_get_dev(
> +               struct mtk_hsdma_chan *chan)
> +{
> +       return container_of(chan->vchan.chan.device, struct mtk_hsdam_engine,
> +                       ddev);
> +}
> +
> +static inline struct mtk_hsdma_chan *to_mtk_hsdma_chan(struct dma_chan *c)
> +{
> +       return container_of(c, struct mtk_hsdma_chan, vchan.chan);
> +}
> +
> +static inline struct mtk_hsdma_desc *to_mtk_hsdma_desc(
> +               struct virt_dma_desc *vdesc)
> +{
> +       return container_of(vdesc, struct mtk_hsdma_desc, vdesc);
> +}
> +
> +static inline u32 mtk_hsdma_read(struct mtk_hsdam_engine *hsdma, u32 reg)
> +{
> +       return readl(hsdma->base + reg);
> +}
> +
> +static inline void mtk_hsdma_write(struct mtk_hsdam_engine *hsdma,
> +                                  unsigned reg, u32 val)
> +{
> +       writel(val, hsdma->base + reg);
> +}
> +
> +static void mtk_hsdma_reset_chan(struct mtk_hsdam_engine *hsdma,
> +                                struct mtk_hsdma_chan *chan)
> +{
> +       chan->tx_idx = 0;
> +       chan->rx_idx = HSDMA_DESCS_NUM - 1;
> +
> +       mtk_hsdma_write(hsdma, HSDMA_REG_TX_CTX, chan->tx_idx);
> +       mtk_hsdma_write(hsdma, HSDMA_REG_RX_CRX, chan->rx_idx);
> +
> +       mtk_hsdma_write(hsdma, HSDMA_REG_RST_CFG,
> +                       0x1 << (chan->id + HSDMA_RST_TX_SHIFT));
> +       mtk_hsdma_write(hsdma, HSDMA_REG_RST_CFG,
> +                       0x1 << (chan->id + HSDMA_RST_RX_SHIFT));
> +}
> +
> +static void hsdma_dump_reg(struct mtk_hsdam_engine *hsdma)
> +{
> +       dev_dbg(hsdma->ddev.dev, "tbase %08x, tcnt %08x, " \
> +                       "tctx %08x, tdtx: %08x, rbase %08x, " \
> +                       "rcnt %08x, rctx %08x, rdtx %08x\n",
> +                       mtk_hsdma_read(hsdma, HSDMA_REG_TX_BASE),
> +                       mtk_hsdma_read(hsdma, HSDMA_REG_TX_CNT),
> +                       mtk_hsdma_read(hsdma, HSDMA_REG_TX_CTX),
> +                       mtk_hsdma_read(hsdma, HSDMA_REG_TX_DTX),
> +                       mtk_hsdma_read(hsdma, HSDMA_REG_RX_BASE),
> +                       mtk_hsdma_read(hsdma, HSDMA_REG_RX_CNT),
> +                       mtk_hsdma_read(hsdma, HSDMA_REG_RX_CRX),
> +                       mtk_hsdma_read(hsdma, HSDMA_REG_RX_DRX));
> +
> +       dev_dbg(hsdma->ddev.dev, "info %08x, glo %08x, delay %08x, " \
> +                       "intr_stat %08x, intr_mask %08x\n",
> +                       mtk_hsdma_read(hsdma, HSDMA_REG_INFO),
> +                       mtk_hsdma_read(hsdma, HSDMA_REG_GLO_CFG),
> +                       mtk_hsdma_read(hsdma, HSDMA_REG_DELAY_INT),
> +                       mtk_hsdma_read(hsdma, HSDMA_REG_INT_STATUS),
> +                       mtk_hsdma_read(hsdma, HSDMA_REG_INT_MASK));
> +}
> +
> +static void hsdma_dump_desc(struct mtk_hsdam_engine *hsdma,
> +                           struct mtk_hsdma_chan *chan)
> +{
> +       struct hsdma_desc *tx_desc;
> +       struct hsdma_desc *rx_desc;
> +       int i;
> +
> +       dev_dbg(hsdma->ddev.dev, "tx idx: %d, rx idx: %d\n",
> +                       chan->tx_idx, chan->rx_idx);
> +
> +       for (i = 0; i < HSDMA_DESCS_NUM; i++) {
> +               tx_desc = &chan->tx_ring[i];
> +               rx_desc = &chan->rx_ring[i];
> +
> +               dev_dbg(hsdma->ddev.dev, "%d tx addr0: %08x, flags %08x, " \
> +                               "tx addr1: %08x, rx addr0 %08x, flags %08x\n",
> +                               i, tx_desc->addr0, tx_desc->flags, \
> +                               tx_desc->addr1, rx_desc->addr0, rx_desc->flags);
> +       }
> +}
> +
> +static void mtk_hsdma_reset(struct mtk_hsdam_engine *hsdma,
> +                           struct mtk_hsdma_chan *chan)
> +{
> +       int i;
> +
> +       /* disable dma */
> +       mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, 0);
> +
> +       /* disable intr */
> +       mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, 0);
> +
> +       /* init desc value */
> +       for (i = 0; i < HSDMA_DESCS_NUM; i++) {
> +               chan->tx_ring[i].addr0 = 0;
> +               chan->tx_ring[i].flags = HSDMA_DESC_LS0 |
> +                       HSDMA_DESC_DONE;
> +       }
> +       for (i = 0; i < HSDMA_DESCS_NUM; i++) {
> +               chan->rx_ring[i].addr0 = 0;
> +               chan->rx_ring[i].flags = 0;
> +       }
> +
> +       /* reset */
> +       mtk_hsdma_reset_chan(hsdma, chan);
> +
> +       /* enable intr */
> +       mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, HSDMA_INT_RX_Q0);
> +
> +       /* enable dma */
> +       mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, HSDMA_GLO_DEFAULT);
> +}
> +
> +static int mtk_hsdma_terminate_all(struct dma_chan *c)
> +{
> +       struct mtk_hsdma_chan *chan = to_mtk_hsdma_chan(c);
> +       struct mtk_hsdam_engine *hsdma = mtk_hsdma_chan_get_dev(chan);
> +       unsigned long timeout;
> +       LIST_HEAD(head);
> +
> +       spin_lock_bh(&chan->vchan.lock);
> +       chan->desc = NULL;
> +       clear_bit(chan->id, &hsdma->chan_issued);
> +       vchan_get_all_descriptors(&chan->vchan, &head);
> +       spin_unlock_bh(&chan->vchan.lock);
> +
> +       vchan_dma_desc_free_list(&chan->vchan, &head);
> +
> +       /* wait dma transfer complete */
> +       timeout = jiffies + msecs_to_jiffies(2000);
> +       while (mtk_hsdma_read(hsdma, HSDMA_REG_GLO_CFG) &
> +                       (HSDMA_GLO_RX_BUSY | HSDMA_GLO_TX_BUSY)) {
> +               if (time_after_eq(jiffies, timeout)) {
> +                       hsdma_dump_desc(hsdma, chan);
> +                       mtk_hsdma_reset(hsdma, chan);
> +                       dev_err(hsdma->ddev.dev, "timeout, reset it\n");
> +                       break;
> +               }
> +               cpu_relax();
> +       }
> +
> +       return 0;
> +}
> +
> +static int mtk_hsdma_start_transfer(struct mtk_hsdam_engine *hsdma,
> +                                   struct mtk_hsdma_chan *chan)
> +{
> +       dma_addr_t src, dst;
> +       size_t len, tlen;
> +       struct hsdma_desc *tx_desc, *rx_desc;
> +       struct mtk_hsdma_sg *sg;
> +       unsigned int i;
> +       int rx_idx;
> +
> +       sg = &chan->desc->sg[0];
> +       len = sg->len;
> +       chan->desc->num_sgs = DIV_ROUND_UP(len, HSDMA_MAX_PLEN);
> +
> +       /* tx desc */
> +       src = sg->src_addr;
> +       for (i = 0; i < chan->desc->num_sgs; i++) {
> +               tx_desc = &chan->tx_ring[chan->tx_idx];
> +
> +               if (len > HSDMA_MAX_PLEN)
> +                       tlen = HSDMA_MAX_PLEN;
> +               else
> +                       tlen = len;
> +
> +               if (i & 0x1) {
> +                       tx_desc->addr1 = src;
> +                       tx_desc->flags |= HSDMA_DESC_PLEN1(tlen);
> +               } else {
> +                       tx_desc->addr0 = src;
> +                       tx_desc->flags = HSDMA_DESC_PLEN0(tlen);
> +
> +                       /* update index */
> +                       chan->tx_idx = HSDMA_NEXT_DESC(chan->tx_idx);
> +               }
> +
> +               src += tlen;
> +               len -= tlen;
> +       }
> +       if (i & 0x1)
> +               tx_desc->flags |= HSDMA_DESC_LS0;
> +       else
> +               tx_desc->flags |= HSDMA_DESC_LS1;
> +
> +       /* rx desc */
> +       rx_idx = HSDMA_NEXT_DESC(chan->rx_idx);
> +       len = sg->len;
> +       dst = sg->dst_addr;
> +       for (i = 0; i < chan->desc->num_sgs; i++) {
> +               rx_desc = &chan->rx_ring[rx_idx];
> +               if (len > HSDMA_MAX_PLEN)
> +                       tlen = HSDMA_MAX_PLEN;
> +               else
> +                       tlen = len;
> +
> +               rx_desc->addr0 = dst;
> +               rx_desc->flags = HSDMA_DESC_PLEN0(tlen);
> +
> +               dst += tlen;
> +               len -= tlen;
> +
> +               /* update index */
> +               rx_idx = HSDMA_NEXT_DESC(rx_idx);
> +       }
> +
> +       /* make sure desc and index all up to date */
> +       wmb();
> +       mtk_hsdma_write(hsdma, HSDMA_REG_TX_CTX, chan->tx_idx);
> +
> +       return 0;
> +}
> +
> +static int gdma_next_desc(struct mtk_hsdma_chan *chan)
> +{
> +       struct virt_dma_desc *vdesc;
> +
> +       vdesc = vchan_next_desc(&chan->vchan);
> +       if (!vdesc) {
> +               chan->desc = NULL;
> +               return 0;
> +       }
> +       chan->desc = to_mtk_hsdma_desc(vdesc);
> +       chan->next_sg = 0;
> +
> +       return 1;
> +}
> +
> +static void mtk_hsdma_chan_done(struct mtk_hsdam_engine *hsdma,
> +                               struct mtk_hsdma_chan *chan)
> +{
> +       struct mtk_hsdma_desc *desc;
> +       int chan_issued;
> +
> +       chan_issued = 0;
> +       spin_lock_bh(&chan->vchan.lock);
> +       desc = chan->desc;
> +       if (likely(desc)) {
> +               if (chan->next_sg == desc->num_sgs) {
> +                       list_del(&desc->vdesc.node);
> +                       vchan_cookie_complete(&desc->vdesc);
> +                       chan_issued = gdma_next_desc(chan);
> +               }
> +       } else
> +               dev_dbg(hsdma->ddev.dev, "no desc to complete\n");
> +
> +       if (chan_issued)
> +               set_bit(chan->id, &hsdma->chan_issued);
> +       spin_unlock_bh(&chan->vchan.lock);
> +}
> +
> +static irqreturn_t mtk_hsdma_irq(int irq, void *devid)
> +{
> +       struct mtk_hsdam_engine *hsdma = devid;
> +       u32 status;
> +
> +       status = mtk_hsdma_read(hsdma, HSDMA_REG_INT_STATUS);
> +       if (unlikely(!status))
> +               return IRQ_NONE;
> +
> +       if (likely(status & HSDMA_INT_RX_Q0))
> +               tasklet_schedule(&hsdma->task);
> +       else
> +               dev_dbg(hsdma->ddev.dev, "unhandle irq status %08x\n",
> +                       status);
> +       /* clean intr bits */
> +       mtk_hsdma_write(hsdma, HSDMA_REG_INT_STATUS, status);
> +
> +       return IRQ_HANDLED;
> +}
> +
> +static void mtk_hsdma_issue_pending(struct dma_chan *c)
> +{
> +       struct mtk_hsdma_chan *chan = to_mtk_hsdma_chan(c);
> +       struct mtk_hsdam_engine *hsdma = mtk_hsdma_chan_get_dev(chan);
> +
> +       spin_lock_bh(&chan->vchan.lock);
> +       if (vchan_issue_pending(&chan->vchan) && !chan->desc) {
> +               if (gdma_next_desc(chan)) {
> +                       set_bit(chan->id, &hsdma->chan_issued);
> +                       tasklet_schedule(&hsdma->task);
> +               } else
> +                       dev_dbg(hsdma->ddev.dev, "no desc to issue\n");
> +       }
> +       spin_unlock_bh(&chan->vchan.lock);
> +}
> +
> +static struct dma_async_tx_descriptor *mtk_hsdma_prep_dma_memcpy(
> +               struct dma_chan *c, dma_addr_t dest, dma_addr_t src,
> +               size_t len, unsigned long flags)
> +{
> +       struct mtk_hsdma_chan *chan = to_mtk_hsdma_chan(c);
> +       struct mtk_hsdma_desc *desc;
> +
> +       if (len <= 0)
> +               return NULL;
> +
> +       desc = kzalloc(sizeof(struct mtk_hsdma_desc), GFP_ATOMIC);
> +       if (!desc) {
> +               dev_err(c->device->dev, "alloc memcpy decs error\n");
> +               return NULL;
> +       }
> +
> +       desc->sg[0].src_addr = src;
> +       desc->sg[0].dst_addr = dest;
> +       desc->sg[0].len = len;
> +
> +       return vchan_tx_prep(&chan->vchan, &desc->vdesc, flags);
> +}
> +
> +static enum dma_status mtk_hsdma_tx_status(struct dma_chan *c,
> +                                          dma_cookie_t cookie,
> +                                          struct dma_tx_state *state)
> +{
> +       return dma_cookie_status(c, cookie, state);
> +}
> +
> +static void mtk_hsdma_free_chan_resources(struct dma_chan *c)
> +{
> +       vchan_free_chan_resources(to_virt_chan(c));
> +}
> +
> +static void mtk_hsdma_desc_free(struct virt_dma_desc *vdesc)
> +{
> +       kfree(container_of(vdesc, struct mtk_hsdma_desc, vdesc));
> +}
> +
> +static void mtk_hsdma_tx(struct mtk_hsdam_engine *hsdma)
> +{
> +       struct mtk_hsdma_chan *chan;
> +
> +       if (test_and_clear_bit(0, &hsdma->chan_issued)) {
> +               chan = &hsdma->chan[0];
> +               if (chan->desc)
> +                       mtk_hsdma_start_transfer(hsdma, chan);
> +               else
> +                       dev_dbg(hsdma->ddev.dev, "chan 0 no desc to issue\n");
> +       }
> +}
> +
> +static void mtk_hsdma_rx(struct mtk_hsdam_engine *hsdma)
> +{
> +       struct mtk_hsdma_chan *chan;
> +       int next_idx, drx_idx, cnt;
> +
> +       chan = &hsdma->chan[0];
> +       next_idx = HSDMA_NEXT_DESC(chan->rx_idx);
> +       drx_idx = mtk_hsdma_read(hsdma, HSDMA_REG_RX_DRX);
> +
> +       cnt = (drx_idx - next_idx) & HSDMA_DESCS_MASK;
> +       if (!cnt)
> +               return;
> +
> +       chan->next_sg += cnt;
> +       chan->rx_idx = (chan->rx_idx + cnt) & HSDMA_DESCS_MASK;
> +
> +       /* update rx crx */
> +       wmb();
> +       mtk_hsdma_write(hsdma, HSDMA_REG_RX_CRX, chan->rx_idx);
> +
> +       mtk_hsdma_chan_done(hsdma, chan);
> +}
> +
> +static void mtk_hsdma_tasklet(unsigned long arg)
> +{
> +       struct mtk_hsdam_engine *hsdma = (struct mtk_hsdam_engine *)arg;
> +
> +       mtk_hsdma_rx(hsdma);
> +       mtk_hsdma_tx(hsdma);
> +}
> +
> +static int mtk_hsdam_alloc_desc(struct mtk_hsdam_engine *hsdma,
> +                               struct mtk_hsdma_chan *chan)
> +{
> +       int i;
> +
> +       chan->tx_ring = dma_alloc_coherent(hsdma->ddev.dev,
> +                       2 * HSDMA_DESCS_NUM * sizeof(*chan->tx_ring),
> +                       &chan->desc_addr, GFP_ATOMIC | __GFP_ZERO);
> +       if (!chan->tx_ring)
> +               goto no_mem;
> +
> +       chan->rx_ring = &chan->tx_ring[HSDMA_DESCS_NUM];
> +
> +       /* init tx ring value */
> +       for (i = 0; i < HSDMA_DESCS_NUM; i++)
> +               chan->tx_ring[i].flags = HSDMA_DESC_LS0 | HSDMA_DESC_DONE;
> +
> +       return 0;
> +no_mem:
> +       return -ENOMEM;
> +}
> +
> +static void mtk_hsdam_free_desc(struct mtk_hsdam_engine *hsdma,
> +                               struct mtk_hsdma_chan *chan)
> +{
> +       if (chan->tx_ring) {
> +               dma_free_coherent(hsdma->ddev.dev,
> +                               2 * HSDMA_DESCS_NUM * sizeof(*chan->tx_ring),
> +                               chan->tx_ring, chan->desc_addr);
> +               chan->tx_ring = NULL;
> +               chan->rx_ring = NULL;
> +       }
> +}
> +
> +static int mtk_hsdma_init(struct mtk_hsdam_engine *hsdma)
> +{
> +       struct mtk_hsdma_chan *chan;
> +       int ret;
> +       u32 reg;
> +
> +       /* init desc */
> +       chan = &hsdma->chan[0];
> +       ret = mtk_hsdam_alloc_desc(hsdma, chan);
> +       if (ret)
> +               return ret;
> +
> +       /* tx */
> +       mtk_hsdma_write(hsdma, HSDMA_REG_TX_BASE, chan->desc_addr);
> +       mtk_hsdma_write(hsdma, HSDMA_REG_TX_CNT, HSDMA_DESCS_NUM);
> +       /* rx */
> +       mtk_hsdma_write(hsdma, HSDMA_REG_RX_BASE, chan->desc_addr +
> +                       (sizeof(struct hsdma_desc) * HSDMA_DESCS_NUM));
> +       mtk_hsdma_write(hsdma, HSDMA_REG_RX_CNT, HSDMA_DESCS_NUM);
> +       /* reset */
> +       mtk_hsdma_reset_chan(hsdma, chan);
> +
> +       /* enable rx intr */
> +       mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, HSDMA_INT_RX_Q0);
> +
> +       /* enable dma */
> +       mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, HSDMA_GLO_DEFAULT);
> +
> +       /* hardware info */
> +       reg = mtk_hsdma_read(hsdma, HSDMA_REG_INFO);
> +       dev_info(hsdma->ddev.dev, "rx: %d, tx: %d\n",
> +                (reg >> HSDMA_INFO_RX_SHIFT) & HSDMA_INFO_RX_MASK,
> +                (reg >> HSDMA_INFO_TX_SHIFT) & HSDMA_INFO_TX_MASK);
> +
> +       hsdma_dump_reg(hsdma);
> +
> +       return ret;
> +}
> +
> +static void mtk_hsdma_uninit(struct mtk_hsdam_engine *hsdma)
> +{
> +       struct mtk_hsdma_chan *chan;
> +
> +       /* disable dma */
> +       mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, 0);
> +
> +       /* disable intr */
> +       mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, 0);
> +
> +       /* free desc */
> +       chan = &hsdma->chan[0];
> +       mtk_hsdam_free_desc(hsdma, chan);
> +
> +       /* tx */
> +       mtk_hsdma_write(hsdma, HSDMA_REG_TX_BASE, 0);
> +       mtk_hsdma_write(hsdma, HSDMA_REG_TX_CNT, 0);
> +       /* rx */
> +       mtk_hsdma_write(hsdma, HSDMA_REG_RX_BASE, 0);
> +       mtk_hsdma_write(hsdma, HSDMA_REG_RX_CNT, 0);
> +       /* reset */
> +       mtk_hsdma_reset_chan(hsdma, chan);
> +}
> +
> +static const struct of_device_id mtk_hsdma_of_match[] = {
> +       { .compatible = "mediatek,mt7621-hsdma" },
> +       { },
> +};
> +
> +static int mtk_hsdma_probe(struct platform_device *pdev)
> +{
> +       const struct of_device_id *match;
> +       struct mtk_hsdma_chan *chan;
> +       struct mtk_hsdam_engine *hsdma;
> +       struct dma_device *dd;
> +       struct resource *res;
> +       int ret;
> +       int irq;
> +       void __iomem *base;
> +
> +       ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> +       if (ret)
> +               return ret;
> +
> +       match = of_match_device(mtk_hsdma_of_match, &pdev->dev);
> +       if (!match)
> +               return -EINVAL;
> +
> +       hsdma = devm_kzalloc(&pdev->dev, sizeof(*hsdma), GFP_KERNEL);
> +       if (!hsdma) {
> +               dev_err(&pdev->dev, "alloc dma device failed\n");
> +               return -EINVAL;
> +       }
> +
> +       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +       base = devm_ioremap_resource(&pdev->dev, res);
> +       if (IS_ERR(base))
> +               return PTR_ERR(base);
> +       hsdma->base = base + HSDMA_BASE_OFFSET;
> +       tasklet_init(&hsdma->task, mtk_hsdma_tasklet, (unsigned long)hsdma);
> +
> +       irq = platform_get_irq(pdev, 0);
> +       if (irq < 0) {
> +               dev_err(&pdev->dev, "failed to get irq\n");
> +               return -EINVAL;
> +       }
> +       ret = devm_request_irq(&pdev->dev, irq, mtk_hsdma_irq,
> +                              0, dev_name(&pdev->dev), hsdma);
> +       if (ret) {
> +               dev_err(&pdev->dev, "failed to request irq\n");
> +               return ret;
> +       }
> +
> +       device_reset(&pdev->dev);
> +
> +       dd = &hsdma->ddev;
> +       dma_cap_set(DMA_MEMCPY, dd->cap_mask);
> +       dd->copy_align = HSDMA_ALIGN_SIZE;
> +       dd->device_free_chan_resources = mtk_hsdma_free_chan_resources;
> +       dd->device_prep_dma_memcpy = mtk_hsdma_prep_dma_memcpy;
> +       dd->device_terminate_all = mtk_hsdma_terminate_all;
> +       dd->device_tx_status = mtk_hsdma_tx_status;
> +       dd->device_issue_pending = mtk_hsdma_issue_pending;
> +       dd->dev = &pdev->dev;
> +       dd->dev->dma_parms = &hsdma->dma_parms;
> +       dma_set_max_seg_size(dd->dev, HSDMA_MAX_PLEN);
> +       INIT_LIST_HEAD(&dd->channels);
> +
> +       chan = &hsdma->chan[0];
> +       chan->id = 0;
> +       chan->vchan.desc_free = mtk_hsdma_desc_free;
> +       vchan_init(&chan->vchan, dd);
> +
> +       /* init hardware */
> +       ret = mtk_hsdma_init(hsdma);
> +       if (ret) {
> +               dev_err(&pdev->dev, "failed to alloc ring descs\n");
> +               return ret;
> +       }
> +
> +       ret = dma_async_device_register(dd);
> +       if (ret) {
> +               dev_err(&pdev->dev, "failed to register dma device\n");
> +               goto err_uninit_hsdma;
> +       }
> +
> +       ret = of_dma_controller_register(pdev->dev.of_node,
> +                                        of_dma_xlate_by_chan_id, hsdma);
> +       if (ret) {
> +               dev_err(&pdev->dev, "failed to register of dma controller\n");
> +               goto err_unregister;
> +       }
> +
> +       platform_set_drvdata(pdev, hsdma);
> +
> +       return 0;
> +
> +err_unregister:
> +       dma_async_device_unregister(dd);
> +err_uninit_hsdma:
> +       mtk_hsdma_uninit(hsdma);
> +       return ret;
> +}
> +
> +static int mtk_hsdma_remove(struct platform_device *pdev)
> +{
> +       struct mtk_hsdam_engine *hsdma = platform_get_drvdata(pdev);
> +
> +       mtk_hsdma_uninit(hsdma);
> +
> +       of_dma_controller_free(pdev->dev.of_node);
> +       dma_async_device_unregister(&hsdma->ddev);
> +
> +       return 0;
> +}
> +
> +static struct platform_driver mtk_hsdma_driver = {
> +       .probe = mtk_hsdma_probe,
> +       .remove = mtk_hsdma_remove,
> +       .driver = {
> +               .name = KBUILD_MODNAME,
> +               .of_match_table = mtk_hsdma_of_match,
> +       },
> +};
> +module_platform_driver(mtk_hsdma_driver);
> +
> +MODULE_AUTHOR("Michael Lee <igvtee@gmail.com>");
> +MODULE_DESCRIPTION("MTK HSDMA driver");
> +MODULE_LICENSE("GPL v2");
> --- a/drivers/staging/mt7621-dma/mtk-hsdma.c
> +++ /dev/null
> @@ -1,771 +0,0 @@
> -/*
> - *  Copyright (C) 2015, Michael Lee <igvtee@gmail.com>
> - *  MTK HSDMA support
> - *
> - *  This program is free software; you can redistribute it and/or modify it
> - *  under  the terms of the GNU General         Public License as published by the
> - *  Free Software Foundation;  either version 2 of the License, or (at your
> - *  option) any later version.
> - *
> - */
> -
> -#include <linux/dmaengine.h>
> -#include <linux/dma-mapping.h>
> -#include <linux/err.h>
> -#include <linux/init.h>
> -#include <linux/list.h>
> -#include <linux/module.h>
> -#include <linux/platform_device.h>
> -#include <linux/slab.h>
> -#include <linux/spinlock.h>
> -#include <linux/irq.h>
> -#include <linux/of_dma.h>
> -#include <linux/reset.h>
> -#include <linux/of_device.h>
> -
> -#include "virt-dma.h"
> -
> -#define HSDMA_BASE_OFFSET              0x800
> -
> -#define HSDMA_REG_TX_BASE              0x00
> -#define HSDMA_REG_TX_CNT               0x04
> -#define HSDMA_REG_TX_CTX               0x08
> -#define HSDMA_REG_TX_DTX               0x0c
> -#define HSDMA_REG_RX_BASE              0x100
> -#define HSDMA_REG_RX_CNT               0x104
> -#define HSDMA_REG_RX_CRX               0x108
> -#define HSDMA_REG_RX_DRX               0x10c
> -#define HSDMA_REG_INFO                 0x200
> -#define HSDMA_REG_GLO_CFG              0x204
> -#define HSDMA_REG_RST_CFG              0x208
> -#define HSDMA_REG_DELAY_INT            0x20c
> -#define HSDMA_REG_FREEQ_THRES          0x210
> -#define HSDMA_REG_INT_STATUS           0x220
> -#define HSDMA_REG_INT_MASK             0x228
> -#define HSDMA_REG_SCH_Q01              0x280
> -#define HSDMA_REG_SCH_Q23              0x284
> -
> -#define HSDMA_DESCS_MAX                        0xfff
> -#define HSDMA_DESCS_NUM                        8
> -#define HSDMA_DESCS_MASK               (HSDMA_DESCS_NUM - 1)
> -#define HSDMA_NEXT_DESC(x)             (((x) + 1) & HSDMA_DESCS_MASK)
> -
> -/* HSDMA_REG_INFO */
> -#define HSDMA_INFO_INDEX_MASK          0xf
> -#define HSDMA_INFO_INDEX_SHIFT         24
> -#define HSDMA_INFO_BASE_MASK           0xff
> -#define HSDMA_INFO_BASE_SHIFT          16
> -#define HSDMA_INFO_RX_MASK             0xff
> -#define HSDMA_INFO_RX_SHIFT            8
> -#define HSDMA_INFO_TX_MASK             0xff
> -#define HSDMA_INFO_TX_SHIFT            0
> -
> -/* HSDMA_REG_GLO_CFG */
> -#define HSDMA_GLO_TX_2B_OFFSET         BIT(31)
> -#define HSDMA_GLO_CLK_GATE             BIT(30)
> -#define HSDMA_GLO_BYTE_SWAP            BIT(29)
> -#define HSDMA_GLO_MULTI_DMA            BIT(10)
> -#define HSDMA_GLO_TWO_BUF              BIT(9)
> -#define HSDMA_GLO_32B_DESC             BIT(8)
> -#define HSDMA_GLO_BIG_ENDIAN           BIT(7)
> -#define HSDMA_GLO_TX_DONE              BIT(6)
> -#define HSDMA_GLO_BT_MASK              0x3
> -#define HSDMA_GLO_BT_SHIFT             4
> -#define HSDMA_GLO_RX_BUSY              BIT(3)
> -#define HSDMA_GLO_RX_DMA               BIT(2)
> -#define HSDMA_GLO_TX_BUSY              BIT(1)
> -#define HSDMA_GLO_TX_DMA               BIT(0)
> -
> -#define HSDMA_BT_SIZE_16BYTES          (0 << HSDMA_GLO_BT_SHIFT)
> -#define HSDMA_BT_SIZE_32BYTES          (1 << HSDMA_GLO_BT_SHIFT)
> -#define HSDMA_BT_SIZE_64BYTES          (2 << HSDMA_GLO_BT_SHIFT)
> -#define HSDMA_BT_SIZE_128BYTES         (3 << HSDMA_GLO_BT_SHIFT)
> -
> -#define HSDMA_GLO_DEFAULT              (HSDMA_GLO_MULTI_DMA | \
> -               HSDMA_GLO_RX_DMA | HSDMA_GLO_TX_DMA | HSDMA_BT_SIZE_32BYTES)
> -
> -/* HSDMA_REG_RST_CFG */
> -#define HSDMA_RST_RX_SHIFT             16
> -#define HSDMA_RST_TX_SHIFT             0
> -
> -/* HSDMA_REG_DELAY_INT */
> -#define HSDMA_DELAY_INT_EN             BIT(15)
> -#define HSDMA_DELAY_PEND_OFFSET                8
> -#define HSDMA_DELAY_TIME_OFFSET                0
> -#define HSDMA_DELAY_TX_OFFSET          16
> -#define HSDMA_DELAY_RX_OFFSET          0
> -
> -#define HSDMA_DELAY_INIT(x)            (HSDMA_DELAY_INT_EN | \
> -               ((x) << HSDMA_DELAY_PEND_OFFSET))
> -#define HSDMA_DELAY(x)                 ((HSDMA_DELAY_INIT(x) << \
> -               HSDMA_DELAY_TX_OFFSET) | HSDMA_DELAY_INIT(x))
> -
> -/* HSDMA_REG_INT_STATUS */
> -#define HSDMA_INT_DELAY_RX_COH         BIT(31)
> -#define HSDMA_INT_DELAY_RX_INT         BIT(30)
> -#define HSDMA_INT_DELAY_TX_COH         BIT(29)
> -#define HSDMA_INT_DELAY_TX_INT         BIT(28)
> -#define HSDMA_INT_RX_MASK              0x3
> -#define HSDMA_INT_RX_SHIFT             16
> -#define HSDMA_INT_RX_Q0                        BIT(16)
> -#define HSDMA_INT_TX_MASK              0xf
> -#define HSDMA_INT_TX_SHIFT             0
> -#define HSDMA_INT_TX_Q0                        BIT(0)
> -
> -/* tx/rx dma desc flags */
> -#define HSDMA_PLEN_MASK                        0x3fff
> -#define HSDMA_DESC_DONE                        BIT(31)
> -#define HSDMA_DESC_LS0                 BIT(30)
> -#define HSDMA_DESC_PLEN0(_x)           (((_x) & HSDMA_PLEN_MASK) << 16)
> -#define HSDMA_DESC_TAG                 BIT(15)
> -#define HSDMA_DESC_LS1                 BIT(14)
> -#define HSDMA_DESC_PLEN1(_x)           ((_x) & HSDMA_PLEN_MASK)
> -
> -/* align 4 bytes */
> -#define HSDMA_ALIGN_SIZE               3
> -/* align size 128bytes */
> -#define HSDMA_MAX_PLEN                 0x3f80
> -
> -struct hsdma_desc {
> -       u32 addr0;
> -       u32 flags;
> -       u32 addr1;
> -       u32 unused;
> -};
> -
> -struct mtk_hsdma_sg {
> -       dma_addr_t src_addr;
> -       dma_addr_t dst_addr;
> -       u32 len;
> -};
> -
> -struct mtk_hsdma_desc {
> -       struct virt_dma_desc vdesc;
> -       unsigned int num_sgs;
> -       struct mtk_hsdma_sg sg[1];
> -};
> -
> -struct mtk_hsdma_chan {
> -       struct virt_dma_chan vchan;
> -       unsigned int id;
> -       dma_addr_t desc_addr;
> -       int tx_idx;
> -       int rx_idx;
> -       struct hsdma_desc *tx_ring;
> -       struct hsdma_desc *rx_ring;
> -       struct mtk_hsdma_desc *desc;
> -       unsigned int next_sg;
> -};
> -
> -struct mtk_hsdam_engine {
> -       struct dma_device ddev;
> -       struct device_dma_parameters dma_parms;
> -       void __iomem *base;
> -       struct tasklet_struct task;
> -       volatile unsigned long chan_issued;
> -
> -       struct mtk_hsdma_chan chan[1];
> -};
> -
> -static inline struct mtk_hsdam_engine *mtk_hsdma_chan_get_dev(
> -               struct mtk_hsdma_chan *chan)
> -{
> -       return container_of(chan->vchan.chan.device, struct mtk_hsdam_engine,
> -                       ddev);
> -}
> -
> -static inline struct mtk_hsdma_chan *to_mtk_hsdma_chan(struct dma_chan *c)
> -{
> -       return container_of(c, struct mtk_hsdma_chan, vchan.chan);
> -}
> -
> -static inline struct mtk_hsdma_desc *to_mtk_hsdma_desc(
> -               struct virt_dma_desc *vdesc)
> -{
> -       return container_of(vdesc, struct mtk_hsdma_desc, vdesc);
> -}
> -
> -static inline u32 mtk_hsdma_read(struct mtk_hsdam_engine *hsdma, u32 reg)
> -{
> -       return readl(hsdma->base + reg);
> -}
> -
> -static inline void mtk_hsdma_write(struct mtk_hsdam_engine *hsdma,
> -                                  unsigned reg, u32 val)
> -{
> -       writel(val, hsdma->base + reg);
> -}
> -
> -static void mtk_hsdma_reset_chan(struct mtk_hsdam_engine *hsdma,
> -                                struct mtk_hsdma_chan *chan)
> -{
> -       chan->tx_idx = 0;
> -       chan->rx_idx = HSDMA_DESCS_NUM - 1;
> -
> -       mtk_hsdma_write(hsdma, HSDMA_REG_TX_CTX, chan->tx_idx);
> -       mtk_hsdma_write(hsdma, HSDMA_REG_RX_CRX, chan->rx_idx);
> -
> -       mtk_hsdma_write(hsdma, HSDMA_REG_RST_CFG,
> -                       0x1 << (chan->id + HSDMA_RST_TX_SHIFT));
> -       mtk_hsdma_write(hsdma, HSDMA_REG_RST_CFG,
> -                       0x1 << (chan->id + HSDMA_RST_RX_SHIFT));
> -}
> -
> -static void hsdma_dump_reg(struct mtk_hsdam_engine *hsdma)
> -{
> -       dev_dbg(hsdma->ddev.dev, "tbase %08x, tcnt %08x, " \
> -                       "tctx %08x, tdtx: %08x, rbase %08x, " \
> -                       "rcnt %08x, rctx %08x, rdtx %08x\n",
> -                       mtk_hsdma_read(hsdma, HSDMA_REG_TX_BASE),
> -                       mtk_hsdma_read(hsdma, HSDMA_REG_TX_CNT),
> -                       mtk_hsdma_read(hsdma, HSDMA_REG_TX_CTX),
> -                       mtk_hsdma_read(hsdma, HSDMA_REG_TX_DTX),
> -                       mtk_hsdma_read(hsdma, HSDMA_REG_RX_BASE),
> -                       mtk_hsdma_read(hsdma, HSDMA_REG_RX_CNT),
> -                       mtk_hsdma_read(hsdma, HSDMA_REG_RX_CRX),
> -                       mtk_hsdma_read(hsdma, HSDMA_REG_RX_DRX));
> -
> -       dev_dbg(hsdma->ddev.dev, "info %08x, glo %08x, delay %08x, " \
> -                       "intr_stat %08x, intr_mask %08x\n",
> -                       mtk_hsdma_read(hsdma, HSDMA_REG_INFO),
> -                       mtk_hsdma_read(hsdma, HSDMA_REG_GLO_CFG),
> -                       mtk_hsdma_read(hsdma, HSDMA_REG_DELAY_INT),
> -                       mtk_hsdma_read(hsdma, HSDMA_REG_INT_STATUS),
> -                       mtk_hsdma_read(hsdma, HSDMA_REG_INT_MASK));
> -}
> -
> -static void hsdma_dump_desc(struct mtk_hsdam_engine *hsdma,
> -                           struct mtk_hsdma_chan *chan)
> -{
> -       struct hsdma_desc *tx_desc;
> -       struct hsdma_desc *rx_desc;
> -       int i;
> -
> -       dev_dbg(hsdma->ddev.dev, "tx idx: %d, rx idx: %d\n",
> -                       chan->tx_idx, chan->rx_idx);
> -
> -       for (i = 0; i < HSDMA_DESCS_NUM; i++) {
> -               tx_desc = &chan->tx_ring[i];
> -               rx_desc = &chan->rx_ring[i];
> -
> -               dev_dbg(hsdma->ddev.dev, "%d tx addr0: %08x, flags %08x, " \
> -                               "tx addr1: %08x, rx addr0 %08x, flags %08x\n",
> -                               i, tx_desc->addr0, tx_desc->flags, \
> -                               tx_desc->addr1, rx_desc->addr0, rx_desc->flags);
> -       }
> -}
> -
> -static void mtk_hsdma_reset(struct mtk_hsdam_engine *hsdma,
> -                           struct mtk_hsdma_chan *chan)
> -{
> -       int i;
> -
> -       /* disable dma */
> -       mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, 0);
> -
> -       /* disable intr */
> -       mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, 0);
> -
> -       /* init desc value */
> -       for (i = 0; i < HSDMA_DESCS_NUM; i++) {
> -               chan->tx_ring[i].addr0 = 0;
> -               chan->tx_ring[i].flags = HSDMA_DESC_LS0 |
> -                       HSDMA_DESC_DONE;
> -       }
> -       for (i = 0; i < HSDMA_DESCS_NUM; i++) {
> -               chan->rx_ring[i].addr0 = 0;
> -               chan->rx_ring[i].flags = 0;
> -       }
> -
> -       /* reset */
> -       mtk_hsdma_reset_chan(hsdma, chan);
> -
> -       /* enable intr */
> -       mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, HSDMA_INT_RX_Q0);
> -
> -       /* enable dma */
> -       mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, HSDMA_GLO_DEFAULT);
> -}
> -
> -static int mtk_hsdma_terminate_all(struct dma_chan *c)
> -{
> -       struct mtk_hsdma_chan *chan = to_mtk_hsdma_chan(c);
> -       struct mtk_hsdam_engine *hsdma = mtk_hsdma_chan_get_dev(chan);
> -       unsigned long timeout;
> -       LIST_HEAD(head);
> -
> -       spin_lock_bh(&chan->vchan.lock);
> -       chan->desc = NULL;
> -       clear_bit(chan->id, &hsdma->chan_issued);
> -       vchan_get_all_descriptors(&chan->vchan, &head);
> -       spin_unlock_bh(&chan->vchan.lock);
> -
> -       vchan_dma_desc_free_list(&chan->vchan, &head);
> -
> -       /* wait dma transfer complete */
> -       timeout = jiffies + msecs_to_jiffies(2000);
> -       while (mtk_hsdma_read(hsdma, HSDMA_REG_GLO_CFG) &
> -                       (HSDMA_GLO_RX_BUSY | HSDMA_GLO_TX_BUSY)) {
> -               if (time_after_eq(jiffies, timeout)) {
> -                       hsdma_dump_desc(hsdma, chan);
> -                       mtk_hsdma_reset(hsdma, chan);
> -                       dev_err(hsdma->ddev.dev, "timeout, reset it\n");
> -                       break;
> -               }
> -               cpu_relax();
> -       }
> -
> -       return 0;
> -}
> -
> -static int mtk_hsdma_start_transfer(struct mtk_hsdam_engine *hsdma,
> -                                   struct mtk_hsdma_chan *chan)
> -{
> -       dma_addr_t src, dst;
> -       size_t len, tlen;
> -       struct hsdma_desc *tx_desc, *rx_desc;
> -       struct mtk_hsdma_sg *sg;
> -       unsigned int i;
> -       int rx_idx;
> -
> -       sg = &chan->desc->sg[0];
> -       len = sg->len;
> -       chan->desc->num_sgs = DIV_ROUND_UP(len, HSDMA_MAX_PLEN);
> -
> -       /* tx desc */
> -       src = sg->src_addr;
> -       for (i = 0; i < chan->desc->num_sgs; i++) {
> -               tx_desc = &chan->tx_ring[chan->tx_idx];
> -
> -               if (len > HSDMA_MAX_PLEN)
> -                       tlen = HSDMA_MAX_PLEN;
> -               else
> -                       tlen = len;
> -
> -               if (i & 0x1) {
> -                       tx_desc->addr1 = src;
> -                       tx_desc->flags |= HSDMA_DESC_PLEN1(tlen);
> -               } else {
> -                       tx_desc->addr0 = src;
> -                       tx_desc->flags = HSDMA_DESC_PLEN0(tlen);
> -
> -                       /* update index */
> -                       chan->tx_idx = HSDMA_NEXT_DESC(chan->tx_idx);
> -               }
> -
> -               src += tlen;
> -               len -= tlen;
> -       }
> -       if (i & 0x1)
> -               tx_desc->flags |= HSDMA_DESC_LS0;
> -       else
> -               tx_desc->flags |= HSDMA_DESC_LS1;
> -
> -       /* rx desc */
> -       rx_idx = HSDMA_NEXT_DESC(chan->rx_idx);
> -       len = sg->len;
> -       dst = sg->dst_addr;
> -       for (i = 0; i < chan->desc->num_sgs; i++) {
> -               rx_desc = &chan->rx_ring[rx_idx];
> -               if (len > HSDMA_MAX_PLEN)
> -                       tlen = HSDMA_MAX_PLEN;
> -               else
> -                       tlen = len;
> -
> -               rx_desc->addr0 = dst;
> -               rx_desc->flags = HSDMA_DESC_PLEN0(tlen);
> -
> -               dst += tlen;
> -               len -= tlen;
> -
> -               /* update index */
> -               rx_idx = HSDMA_NEXT_DESC(rx_idx);
> -       }
> -
> -       /* make sure desc and index all up to date */
> -       wmb();
> -       mtk_hsdma_write(hsdma, HSDMA_REG_TX_CTX, chan->tx_idx);
> -
> -       return 0;
> -}
> -
> -static int gdma_next_desc(struct mtk_hsdma_chan *chan)
> -{
> -       struct virt_dma_desc *vdesc;
> -
> -       vdesc = vchan_next_desc(&chan->vchan);
> -       if (!vdesc) {
> -               chan->desc = NULL;
> -               return 0;
> -       }
> -       chan->desc = to_mtk_hsdma_desc(vdesc);
> -       chan->next_sg = 0;
> -
> -       return 1;
> -}
> -
> -static void mtk_hsdma_chan_done(struct mtk_hsdam_engine *hsdma,
> -                               struct mtk_hsdma_chan *chan)
> -{
> -       struct mtk_hsdma_desc *desc;
> -       int chan_issued;
> -
> -       chan_issued = 0;
> -       spin_lock_bh(&chan->vchan.lock);
> -       desc = chan->desc;
> -       if (likely(desc)) {
> -               if (chan->next_sg == desc->num_sgs) {
> -                       list_del(&desc->vdesc.node);
> -                       vchan_cookie_complete(&desc->vdesc);
> -                       chan_issued = gdma_next_desc(chan);
> -               }
> -       } else
> -               dev_dbg(hsdma->ddev.dev, "no desc to complete\n");
> -
> -       if (chan_issued)
> -               set_bit(chan->id, &hsdma->chan_issued);
> -       spin_unlock_bh(&chan->vchan.lock);
> -}
> -
> -static irqreturn_t mtk_hsdma_irq(int irq, void *devid)
> -{
> -       struct mtk_hsdam_engine *hsdma = devid;
> -       u32 status;
> -
> -       status = mtk_hsdma_read(hsdma, HSDMA_REG_INT_STATUS);
> -       if (unlikely(!status))
> -               return IRQ_NONE;
> -
> -       if (likely(status & HSDMA_INT_RX_Q0))
> -               tasklet_schedule(&hsdma->task);
> -       else
> -               dev_dbg(hsdma->ddev.dev, "unhandle irq status %08x\n",
> -                       status);
> -       /* clean intr bits */
> -       mtk_hsdma_write(hsdma, HSDMA_REG_INT_STATUS, status);
> -
> -       return IRQ_HANDLED;
> -}
> -
> -static void mtk_hsdma_issue_pending(struct dma_chan *c)
> -{
> -       struct mtk_hsdma_chan *chan = to_mtk_hsdma_chan(c);
> -       struct mtk_hsdam_engine *hsdma = mtk_hsdma_chan_get_dev(chan);
> -
> -       spin_lock_bh(&chan->vchan.lock);
> -       if (vchan_issue_pending(&chan->vchan) && !chan->desc) {
> -               if (gdma_next_desc(chan)) {
> -                       set_bit(chan->id, &hsdma->chan_issued);
> -                       tasklet_schedule(&hsdma->task);
> -               } else
> -                       dev_dbg(hsdma->ddev.dev, "no desc to issue\n");
> -       }
> -       spin_unlock_bh(&chan->vchan.lock);
> -}
> -
> -static struct dma_async_tx_descriptor *mtk_hsdma_prep_dma_memcpy(
> -               struct dma_chan *c, dma_addr_t dest, dma_addr_t src,
> -               size_t len, unsigned long flags)
> -{
> -       struct mtk_hsdma_chan *chan = to_mtk_hsdma_chan(c);
> -       struct mtk_hsdma_desc *desc;
> -
> -       if (len <= 0)
> -               return NULL;
> -
> -       desc = kzalloc(sizeof(struct mtk_hsdma_desc), GFP_ATOMIC);
> -       if (!desc) {
> -               dev_err(c->device->dev, "alloc memcpy decs error\n");
> -               return NULL;
> -       }
> -
> -       desc->sg[0].src_addr = src;
> -       desc->sg[0].dst_addr = dest;
> -       desc->sg[0].len = len;
> -
> -       return vchan_tx_prep(&chan->vchan, &desc->vdesc, flags);
> -}
> -
> -static enum dma_status mtk_hsdma_tx_status(struct dma_chan *c,
> -                                          dma_cookie_t cookie,
> -                                          struct dma_tx_state *state)
> -{
> -       return dma_cookie_status(c, cookie, state);
> -}
> -
> -static void mtk_hsdma_free_chan_resources(struct dma_chan *c)
> -{
> -       vchan_free_chan_resources(to_virt_chan(c));
> -}
> -
> -static void mtk_hsdma_desc_free(struct virt_dma_desc *vdesc)
> -{
> -       kfree(container_of(vdesc, struct mtk_hsdma_desc, vdesc));
> -}
> -
> -static void mtk_hsdma_tx(struct mtk_hsdam_engine *hsdma)
> -{
> -       struct mtk_hsdma_chan *chan;
> -
> -       if (test_and_clear_bit(0, &hsdma->chan_issued)) {
> -               chan = &hsdma->chan[0];
> -               if (chan->desc)
> -                       mtk_hsdma_start_transfer(hsdma, chan);
> -               else
> -                       dev_dbg(hsdma->ddev.dev, "chan 0 no desc to issue\n");
> -       }
> -}
> -
> -static void mtk_hsdma_rx(struct mtk_hsdam_engine *hsdma)
> -{
> -       struct mtk_hsdma_chan *chan;
> -       int next_idx, drx_idx, cnt;
> -
> -       chan = &hsdma->chan[0];
> -       next_idx = HSDMA_NEXT_DESC(chan->rx_idx);
> -       drx_idx = mtk_hsdma_read(hsdma, HSDMA_REG_RX_DRX);
> -
> -       cnt = (drx_idx - next_idx) & HSDMA_DESCS_MASK;
> -       if (!cnt)
> -               return;
> -
> -       chan->next_sg += cnt;
> -       chan->rx_idx = (chan->rx_idx + cnt) & HSDMA_DESCS_MASK;
> -
> -       /* update rx crx */
> -       wmb();
> -       mtk_hsdma_write(hsdma, HSDMA_REG_RX_CRX, chan->rx_idx);
> -
> -       mtk_hsdma_chan_done(hsdma, chan);
> -}
> -
> -static void mtk_hsdma_tasklet(unsigned long arg)
> -{
> -       struct mtk_hsdam_engine *hsdma = (struct mtk_hsdam_engine *)arg;
> -
> -       mtk_hsdma_rx(hsdma);
> -       mtk_hsdma_tx(hsdma);
> -}
> -
> -static int mtk_hsdam_alloc_desc(struct mtk_hsdam_engine *hsdma,
> -                               struct mtk_hsdma_chan *chan)
> -{
> -       int i;
> -
> -       chan->tx_ring = dma_alloc_coherent(hsdma->ddev.dev,
> -                       2 * HSDMA_DESCS_NUM * sizeof(*chan->tx_ring),
> -                       &chan->desc_addr, GFP_ATOMIC | __GFP_ZERO);
> -       if (!chan->tx_ring)
> -               goto no_mem;
> -
> -       chan->rx_ring = &chan->tx_ring[HSDMA_DESCS_NUM];
> -
> -       /* init tx ring value */
> -       for (i = 0; i < HSDMA_DESCS_NUM; i++)
> -               chan->tx_ring[i].flags = HSDMA_DESC_LS0 | HSDMA_DESC_DONE;
> -
> -       return 0;
> -no_mem:
> -       return -ENOMEM;
> -}
> -
> -static void mtk_hsdam_free_desc(struct mtk_hsdam_engine *hsdma,
> -                               struct mtk_hsdma_chan *chan)
> -{
> -       if (chan->tx_ring) {
> -               dma_free_coherent(hsdma->ddev.dev,
> -                               2 * HSDMA_DESCS_NUM * sizeof(*chan->tx_ring),
> -                               chan->tx_ring, chan->desc_addr);
> -               chan->tx_ring = NULL;
> -               chan->rx_ring = NULL;
> -       }
> -}
> -
> -static int mtk_hsdma_init(struct mtk_hsdam_engine *hsdma)
> -{
> -       struct mtk_hsdma_chan *chan;
> -       int ret;
> -       u32 reg;
> -
> -       /* init desc */
> -       chan = &hsdma->chan[0];
> -       ret = mtk_hsdam_alloc_desc(hsdma, chan);
> -       if (ret)
> -               return ret;
> -
> -       /* tx */
> -       mtk_hsdma_write(hsdma, HSDMA_REG_TX_BASE, chan->desc_addr);
> -       mtk_hsdma_write(hsdma, HSDMA_REG_TX_CNT, HSDMA_DESCS_NUM);
> -       /* rx */
> -       mtk_hsdma_write(hsdma, HSDMA_REG_RX_BASE, chan->desc_addr +
> -                       (sizeof(struct hsdma_desc) * HSDMA_DESCS_NUM));
> -       mtk_hsdma_write(hsdma, HSDMA_REG_RX_CNT, HSDMA_DESCS_NUM);
> -       /* reset */
> -       mtk_hsdma_reset_chan(hsdma, chan);
> -
> -       /* enable rx intr */
> -       mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, HSDMA_INT_RX_Q0);
> -
> -       /* enable dma */
> -       mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, HSDMA_GLO_DEFAULT);
> -
> -       /* hardware info */
> -       reg = mtk_hsdma_read(hsdma, HSDMA_REG_INFO);
> -       dev_info(hsdma->ddev.dev, "rx: %d, tx: %d\n",
> -                (reg >> HSDMA_INFO_RX_SHIFT) & HSDMA_INFO_RX_MASK,
> -                (reg >> HSDMA_INFO_TX_SHIFT) & HSDMA_INFO_TX_MASK);
> -
> -       hsdma_dump_reg(hsdma);
> -
> -       return ret;
> -}
> -
> -static void mtk_hsdma_uninit(struct mtk_hsdam_engine *hsdma)
> -{
> -       struct mtk_hsdma_chan *chan;
> -
> -       /* disable dma */
> -       mtk_hsdma_write(hsdma, HSDMA_REG_GLO_CFG, 0);
> -
> -       /* disable intr */
> -       mtk_hsdma_write(hsdma, HSDMA_REG_INT_MASK, 0);
> -
> -       /* free desc */
> -       chan = &hsdma->chan[0];
> -       mtk_hsdam_free_desc(hsdma, chan);
> -
> -       /* tx */
> -       mtk_hsdma_write(hsdma, HSDMA_REG_TX_BASE, 0);
> -       mtk_hsdma_write(hsdma, HSDMA_REG_TX_CNT, 0);
> -       /* rx */
> -       mtk_hsdma_write(hsdma, HSDMA_REG_RX_BASE, 0);
> -       mtk_hsdma_write(hsdma, HSDMA_REG_RX_CNT, 0);
> -       /* reset */
> -       mtk_hsdma_reset_chan(hsdma, chan);
> -}
> -
> -static const struct of_device_id mtk_hsdma_of_match[] = {
> -       { .compatible = "mediatek,mt7621-hsdma" },
> -       { },
> -};
> -
> -static int mtk_hsdma_probe(struct platform_device *pdev)
> -{
> -       const struct of_device_id *match;
> -       struct mtk_hsdma_chan *chan;
> -       struct mtk_hsdam_engine *hsdma;
> -       struct dma_device *dd;
> -       struct resource *res;
> -       int ret;
> -       int irq;
> -       void __iomem *base;
> -
> -       ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> -       if (ret)
> -               return ret;
> -
> -       match = of_match_device(mtk_hsdma_of_match, &pdev->dev);
> -       if (!match)
> -               return -EINVAL;
> -
> -       hsdma = devm_kzalloc(&pdev->dev, sizeof(*hsdma), GFP_KERNEL);
> -       if (!hsdma) {
> -               dev_err(&pdev->dev, "alloc dma device failed\n");
> -               return -EINVAL;
> -       }
> -
> -       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -       base = devm_ioremap_resource(&pdev->dev, res);
> -       if (IS_ERR(base))
> -               return PTR_ERR(base);
> -       hsdma->base = base + HSDMA_BASE_OFFSET;
> -       tasklet_init(&hsdma->task, mtk_hsdma_tasklet, (unsigned long)hsdma);
> -
> -       irq = platform_get_irq(pdev, 0);
> -       if (irq < 0) {
> -               dev_err(&pdev->dev, "failed to get irq\n");
> -               return -EINVAL;
> -       }
> -       ret = devm_request_irq(&pdev->dev, irq, mtk_hsdma_irq,
> -                              0, dev_name(&pdev->dev), hsdma);
> -       if (ret) {
> -               dev_err(&pdev->dev, "failed to request irq\n");
> -               return ret;
> -       }
> -
> -       device_reset(&pdev->dev);
> -
> -       dd = &hsdma->ddev;
> -       dma_cap_set(DMA_MEMCPY, dd->cap_mask);
> -       dd->copy_align = HSDMA_ALIGN_SIZE;
> -       dd->device_free_chan_resources = mtk_hsdma_free_chan_resources;
> -       dd->device_prep_dma_memcpy = mtk_hsdma_prep_dma_memcpy;
> -       dd->device_terminate_all = mtk_hsdma_terminate_all;
> -       dd->device_tx_status = mtk_hsdma_tx_status;
> -       dd->device_issue_pending = mtk_hsdma_issue_pending;
> -       dd->dev = &pdev->dev;
> -       dd->dev->dma_parms = &hsdma->dma_parms;
> -       dma_set_max_seg_size(dd->dev, HSDMA_MAX_PLEN);
> -       INIT_LIST_HEAD(&dd->channels);
> -
> -       chan = &hsdma->chan[0];
> -       chan->id = 0;
> -       chan->vchan.desc_free = mtk_hsdma_desc_free;
> -       vchan_init(&chan->vchan, dd);
> -
> -       /* init hardware */
> -       ret = mtk_hsdma_init(hsdma);
> -       if (ret) {
> -               dev_err(&pdev->dev, "failed to alloc ring descs\n");
> -               return ret;
> -       }
> -
> -       ret = dma_async_device_register(dd);
> -       if (ret) {
> -               dev_err(&pdev->dev, "failed to register dma device\n");
> -               goto err_uninit_hsdma;
> -       }
> -
> -       ret = of_dma_controller_register(pdev->dev.of_node,
> -                                        of_dma_xlate_by_chan_id, hsdma);
> -       if (ret) {
> -               dev_err(&pdev->dev, "failed to register of dma controller\n");
> -               goto err_unregister;
> -       }
> -
> -       platform_set_drvdata(pdev, hsdma);
> -
> -       return 0;
> -
> -err_unregister:
> -       dma_async_device_unregister(dd);
> -err_uninit_hsdma:
> -       mtk_hsdma_uninit(hsdma);
> -       return ret;
> -}
> -
> -static int mtk_hsdma_remove(struct platform_device *pdev)
> -{
> -       struct mtk_hsdam_engine *hsdma = platform_get_drvdata(pdev);
> -
> -       mtk_hsdma_uninit(hsdma);
> -
> -       of_dma_controller_free(pdev->dev.of_node);
> -       dma_async_device_unregister(&hsdma->ddev);
> -
> -       return 0;
> -}
> -
> -static struct platform_driver mtk_hsdma_driver = {
> -       .probe = mtk_hsdma_probe,
> -       .remove = mtk_hsdma_remove,
> -       .driver = {
> -               .name = "hsdma-mt7621",
> -               .of_match_table = mtk_hsdma_of_match,
> -       },
> -};
> -module_platform_driver(mtk_hsdma_driver);
> -
> -MODULE_AUTHOR("Michael Lee <igvtee@gmail.com>");
> -MODULE_DESCRIPTION("MTK HSDMA driver");
> -MODULE_LICENSE("GPL v2");
>
>

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

* Re: [PATCH 4.19 000/247] 4.19.178-rc1 review
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (246 preceding siblings ...)
  2021-03-01 16:14 ` [PATCH 4.19 247/247] net: qrtr: Fix memory leak in qrtr_tun_open Greg Kroah-Hartman
@ 2021-03-01 21:45 ` Shuah Khan
  2021-03-02  2:35 ` Hanjun Guo
  2021-03-03  7:59 ` Hanjun Guo
  249 siblings, 0 replies; 280+ messages in thread
From: Shuah Khan @ 2021-03-01 21:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, shuah, patches, lkft-triage, pavel,
	jonathanh, f.fainelli, stable, Shuah Khan

On 3/1/21 9:10 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.19.178 release.
> There are 247 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, 03 Mar 2021 16:09:49 +0000.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.178-rc1.gz
> or in the git tree and branch at:
> 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.19.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 


Compiled and booted on my test system. No dmesg regressions.

Tested-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah

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

* Re: [PATCH 4.19 055/247] soc: aspeed: snoop: Add clock control logic
  2021-03-01 16:11 ` [PATCH 4.19 055/247] soc: aspeed: snoop: Add clock control logic Greg Kroah-Hartman
@ 2021-03-01 22:44   ` Joel Stanley
  2021-03-02  0:09     ` Yoo, Jae Hyun
  0 siblings, 1 reply; 280+ messages in thread
From: Joel Stanley @ 2021-03-01 22:44 UTC (permalink / raw)
  To: Greg Kroah-Hartman, John Wang, Jae Hyun Yoo
  Cc: Linux Kernel Mailing List, stable, Vernon Mauery, Sasha Levin

On Mon, 1 Mar 2021 at 16:37, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
>
> [ Upstream commit 3f94cf15583be554df7aaa651b8ff8e1b68fbe51 ]
>
> If LPC SNOOP driver is registered ahead of lpc-ctrl module, LPC
> SNOOP block will be enabled without heart beating of LCLK until
> lpc-ctrl enables the LCLK. This issue causes improper handling on
> host interrupts when the host sends interrupt in that time frame.
> Then kernel eventually forcibly disables the interrupt with
> dumping stack and printing a 'nobody cared this irq' message out.
>
> To prevent this issue, all LPC sub-nodes should enable LCLK
> individually so this patch adds clock control logic into the LPC
> SNOOP driver.

Jae, John; with this backported do we need to also provide a
corresponding device tree change for the stable tree, otherwise this
driver will no longer probe?

>
> Fixes: 3772e5da4454 ("drivers/misc: Aspeed LPC snoop output using misc chardev")
> Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
> Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
> Signed-off-by: John Wang <wangzhiqiang.bj@bytedance.com>
> Reviewed-by: Joel Stanley <joel@jms.id.au>
> Link: https://lore.kernel.org/r/20201208091748.1920-1-wangzhiqiang.bj@bytedance.com
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>  drivers/misc/aspeed-lpc-snoop.c | 30 +++++++++++++++++++++++++++---
>  1 file changed, 27 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/misc/aspeed-lpc-snoop.c b/drivers/misc/aspeed-lpc-snoop.c
> index c10be21a1663d..b4a776bf44bc5 100644
> --- a/drivers/misc/aspeed-lpc-snoop.c
> +++ b/drivers/misc/aspeed-lpc-snoop.c
> @@ -15,6 +15,7 @@
>   */
>
>  #include <linux/bitops.h>
> +#include <linux/clk.h>
>  #include <linux/interrupt.h>
>  #include <linux/fs.h>
>  #include <linux/kfifo.h>
> @@ -71,6 +72,7 @@ struct aspeed_lpc_snoop_channel {
>  struct aspeed_lpc_snoop {
>         struct regmap           *regmap;
>         int                     irq;
> +       struct clk              *clk;
>         struct aspeed_lpc_snoop_channel chan[NUM_SNOOP_CHANNELS];
>  };
>
> @@ -286,22 +288,42 @@ static int aspeed_lpc_snoop_probe(struct platform_device *pdev)
>                 return -ENODEV;
>         }
>
> +       lpc_snoop->clk = devm_clk_get(dev, NULL);
> +       if (IS_ERR(lpc_snoop->clk)) {
> +               rc = PTR_ERR(lpc_snoop->clk);
> +               if (rc != -EPROBE_DEFER)
> +                       dev_err(dev, "couldn't get clock\n");
> +               return rc;
> +       }
> +       rc = clk_prepare_enable(lpc_snoop->clk);
> +       if (rc) {
> +               dev_err(dev, "couldn't enable clock\n");
> +               return rc;
> +       }
> +
>         rc = aspeed_lpc_snoop_config_irq(lpc_snoop, pdev);
>         if (rc)
> -               return rc;
> +               goto err;
>
>         rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 0, port);
>         if (rc)
> -               return rc;
> +               goto err;
>
>         /* Configuration of 2nd snoop channel port is optional */
>         if (of_property_read_u32_index(dev->of_node, "snoop-ports",
>                                        1, &port) == 0) {
>                 rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 1, port);
> -               if (rc)
> +               if (rc) {
>                         aspeed_lpc_disable_snoop(lpc_snoop, 0);
> +                       goto err;
> +               }
>         }
>
> +       return 0;
> +
> +err:
> +       clk_disable_unprepare(lpc_snoop->clk);
> +
>         return rc;
>  }
>
> @@ -313,6 +335,8 @@ static int aspeed_lpc_snoop_remove(struct platform_device *pdev)
>         aspeed_lpc_disable_snoop(lpc_snoop, 0);
>         aspeed_lpc_disable_snoop(lpc_snoop, 1);
>
> +       clk_disable_unprepare(lpc_snoop->clk);
> +
>         return 0;
>  }
>
> --
> 2.27.0
>
>
>

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

* RE: [PATCH 4.19 055/247] soc: aspeed: snoop: Add clock control logic
  2021-03-01 22:44   ` Joel Stanley
@ 2021-03-02  0:09     ` Yoo, Jae Hyun
  2021-03-04  8:12       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 280+ messages in thread
From: Yoo, Jae Hyun @ 2021-03-02  0:09 UTC (permalink / raw)
  To: Joel Stanley, Greg Kroah-Hartman, John Wang
  Cc: Linux Kernel Mailing List, stable, Vernon Mauery, Sasha Levin

> -----Original Message-----
> From: Joel Stanley <joel@jms.id.au>
> Sent: Monday, March 1, 2021 2:44 PM
> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; John Wang
> <wangzhiqiang.bj@bytedance.com>; Yoo, Jae Hyun
> <jae.hyun.yoo@intel.com>
> Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>;
> stable@vger.kernel.org; Vernon Mauery <vernon.mauery@linux.intel.com>;
> Sasha Levin <sashal@kernel.org>
> Subject: Re: [PATCH 4.19 055/247] soc: aspeed: snoop: Add clock control logic
> 
> On Mon, 1 Mar 2021 at 16:37, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
> >
> > [ Upstream commit 3f94cf15583be554df7aaa651b8ff8e1b68fbe51 ]
> >
> > If LPC SNOOP driver is registered ahead of lpc-ctrl module, LPC SNOOP
> > block will be enabled without heart beating of LCLK until lpc-ctrl
> > enables the LCLK. This issue causes improper handling on host
> > interrupts when the host sends interrupt in that time frame.
> > Then kernel eventually forcibly disables the interrupt with dumping
> > stack and printing a 'nobody cared this irq' message out.
> >
> > To prevent this issue, all LPC sub-nodes should enable LCLK
> > individually so this patch adds clock control logic into the LPC SNOOP
> > driver.
> 
> Jae, John; with this backported do we need to also provide a corresponding
> device tree change for the stable tree, otherwise this driver will no longer
> probe?

Right. The second patch
https://lore.kernel.org/linux-arm-kernel/20201208091748.1920-2-wangzhiqiang.bj@bytedance.com/
John submitted should be applied to stable tree too to make this module be probed
correctly.

> >
> > Fixes: 3772e5da4454 ("drivers/misc: Aspeed LPC snoop output using misc
> > chardev")
> > Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
> > Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
> > Signed-off-by: John Wang <wangzhiqiang.bj@bytedance.com>
> > Reviewed-by: Joel Stanley <joel@jms.id.au>
> > Link:
> > https://lore.kernel.org/r/20201208091748.1920-1-wangzhiqiang.bj@byteda
> > nce.com
> > Signed-off-by: Joel Stanley <joel@jms.id.au>
> > Signed-off-by: Sasha Levin <sashal@kernel.org>
> > ---
> >  drivers/misc/aspeed-lpc-snoop.c | 30 +++++++++++++++++++++++++++-
> --
> >  1 file changed, 27 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/misc/aspeed-lpc-snoop.c
> > b/drivers/misc/aspeed-lpc-snoop.c index c10be21a1663d..b4a776bf44bc5
> > 100644
> > --- a/drivers/misc/aspeed-lpc-snoop.c
> > +++ b/drivers/misc/aspeed-lpc-snoop.c
> > @@ -15,6 +15,7 @@
> >   */
> >
> >  #include <linux/bitops.h>
> > +#include <linux/clk.h>
> >  #include <linux/interrupt.h>
> >  #include <linux/fs.h>
> >  #include <linux/kfifo.h>
> > @@ -71,6 +72,7 @@ struct aspeed_lpc_snoop_channel {  struct
> > aspeed_lpc_snoop {
> >         struct regmap           *regmap;
> >         int                     irq;
> > +       struct clk              *clk;
> >         struct aspeed_lpc_snoop_channel chan[NUM_SNOOP_CHANNELS];  };
> >
> > @@ -286,22 +288,42 @@ static int aspeed_lpc_snoop_probe(struct
> platform_device *pdev)
> >                 return -ENODEV;
> >         }
> >
> > +       lpc_snoop->clk = devm_clk_get(dev, NULL);
> > +       if (IS_ERR(lpc_snoop->clk)) {
> > +               rc = PTR_ERR(lpc_snoop->clk);
> > +               if (rc != -EPROBE_DEFER)
> > +                       dev_err(dev, "couldn't get clock\n");
> > +               return rc;
> > +       }
> > +       rc = clk_prepare_enable(lpc_snoop->clk);
> > +       if (rc) {
> > +               dev_err(dev, "couldn't enable clock\n");
> > +               return rc;
> > +       }
> > +
> >         rc = aspeed_lpc_snoop_config_irq(lpc_snoop, pdev);
> >         if (rc)
> > -               return rc;
> > +               goto err;
> >
> >         rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 0, port);
> >         if (rc)
> > -               return rc;
> > +               goto err;
> >
> >         /* Configuration of 2nd snoop channel port is optional */
> >         if (of_property_read_u32_index(dev->of_node, "snoop-ports",
> >                                        1, &port) == 0) {
> >                 rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 1, port);
> > -               if (rc)
> > +               if (rc) {
> >                         aspeed_lpc_disable_snoop(lpc_snoop, 0);
> > +                       goto err;
> > +               }
> >         }
> >
> > +       return 0;
> > +
> > +err:
> > +       clk_disable_unprepare(lpc_snoop->clk);
> > +
> >         return rc;
> >  }
> >
> > @@ -313,6 +335,8 @@ static int aspeed_lpc_snoop_remove(struct
> platform_device *pdev)
> >         aspeed_lpc_disable_snoop(lpc_snoop, 0);
> >         aspeed_lpc_disable_snoop(lpc_snoop, 1);
> >
> > +       clk_disable_unprepare(lpc_snoop->clk);
> > +
> >         return 0;
> >  }
> >
> > --
> > 2.27.0
> >
> >
> >

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

* Re: [PATCH 4.19 000/247] 4.19.178-rc1 review
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (247 preceding siblings ...)
  2021-03-01 21:45 ` [PATCH 4.19 000/247] 4.19.178-rc1 review Shuah Khan
@ 2021-03-02  2:35 ` Hanjun Guo
  2021-03-03  7:59 ` Hanjun Guo
  249 siblings, 0 replies; 280+ messages in thread
From: Hanjun Guo @ 2021-03-02  2:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, shuah, patches, lkft-triage, pavel,
	jonathanh, f.fainelli, stable, zou_wei

On 2021/3/2 0:10, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.19.178 release.
> There are 247 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, 03 Mar 2021 16:09:49 +0000.
> Anything received after that time might be too late.

Tested both on x86 [1] and ARM64 [2] server,

Tested-by: Hulk Robot <hulkci@huawei.com>

Thanks
Hanjun

[1]:
Arch: x86 (confirmed that no kernel failures)
--------------------------------------------------------------------
Testcase Result Summary:
total_num: 4681
succeed_num: 4677
failed_num: 4
timeout_num: 1


[2]:
Arch: arm64
--------------------------------------------------------------------
Testcase Result Summary:
total_num: 4675
succeed_num: 4675
failed_num: 0
timeout_num: 0




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

* Re: [PATCH 4.19 000/247] 4.19.178-rc1 review
  2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
                   ` (248 preceding siblings ...)
  2021-03-02  2:35 ` Hanjun Guo
@ 2021-03-03  7:59 ` Hanjun Guo
  249 siblings, 0 replies; 280+ messages in thread
From: Hanjun Guo @ 2021-03-03  7:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, shuah, patches, lkft-triage, pavel,
	jonathanh, f.fainelli, stable

On 2021/3/2 0:10, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.19.178 release.
> There are 247 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, 03 Mar 2021 16:09:49 +0000.
> Anything received after that time might be too late.

Tested on arm64 and x86 for 4.19.178-rc3+,

arm64:
--------------------------------------------------------------------
Testcase Result Summary:
total_num: 4674
succeed_num: 4674
failed_num: 0
timeout_num: 0

x86 (No kernel failures)
--------------------------------------------------------------------
Testcase Result Summary:
total_num: 4674
succeed_num: 4673
failed_num: 1
timeout_num: 0

Tested-by: Hulk Robot <hulkci@huawei.com>

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

* Re: [PATCH 4.19 055/247] soc: aspeed: snoop: Add clock control logic
  2021-03-02  0:09     ` Yoo, Jae Hyun
@ 2021-03-04  8:12       ` Greg Kroah-Hartman
  2021-03-04  9:52         ` Joel Stanley
  0 siblings, 1 reply; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-04  8:12 UTC (permalink / raw)
  To: Yoo, Jae Hyun
  Cc: Joel Stanley, John Wang, Linux Kernel Mailing List, stable,
	Vernon Mauery, Sasha Levin

On Tue, Mar 02, 2021 at 12:09:21AM +0000, Yoo, Jae Hyun wrote:
> > -----Original Message-----
> > From: Joel Stanley <joel@jms.id.au>
> > Sent: Monday, March 1, 2021 2:44 PM
> > To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; John Wang
> > <wangzhiqiang.bj@bytedance.com>; Yoo, Jae Hyun
> > <jae.hyun.yoo@intel.com>
> > Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>;
> > stable@vger.kernel.org; Vernon Mauery <vernon.mauery@linux.intel.com>;
> > Sasha Levin <sashal@kernel.org>
> > Subject: Re: [PATCH 4.19 055/247] soc: aspeed: snoop: Add clock control logic
> > 
> > On Mon, 1 Mar 2021 at 16:37, Greg Kroah-Hartman
> > <gregkh@linuxfoundation.org> wrote:
> > >
> > > From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
> > >
> > > [ Upstream commit 3f94cf15583be554df7aaa651b8ff8e1b68fbe51 ]
> > >
> > > If LPC SNOOP driver is registered ahead of lpc-ctrl module, LPC SNOOP
> > > block will be enabled without heart beating of LCLK until lpc-ctrl
> > > enables the LCLK. This issue causes improper handling on host
> > > interrupts when the host sends interrupt in that time frame.
> > > Then kernel eventually forcibly disables the interrupt with dumping
> > > stack and printing a 'nobody cared this irq' message out.
> > >
> > > To prevent this issue, all LPC sub-nodes should enable LCLK
> > > individually so this patch adds clock control logic into the LPC SNOOP
> > > driver.
> > 
> > Jae, John; with this backported do we need to also provide a corresponding
> > device tree change for the stable tree, otherwise this driver will no longer
> > probe?
> 
> Right. The second patch
> https://lore.kernel.org/linux-arm-kernel/20201208091748.1920-2-wangzhiqiang.bj@bytedance.com/
> John submitted should be applied to stable tree too to make this module be probed
> correctly.

Now queued up, thanks.

greg k-h

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

* Re: [PATCH 4.19 209/247] staging/mt7621-dma: mtk-hsdma.c->hsdma-mt7621.c
  2021-03-01 17:41   ` Ilya Lipnitskiy
@ 2021-03-04  8:14     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-04  8:14 UTC (permalink / raw)
  To: Ilya Lipnitskiy; +Cc: Linux Kernel Mailing List, stable, Masahiro Yamada

On Mon, Mar 01, 2021 at 09:41:39AM -0800, Ilya Lipnitskiy wrote:
> Sorry, I should have been more clear in my original email, but we
> don't strictly need this in 4.19 as the check only became fatal in
> 5.10 (actually, before 5.10, but 5.10 is the first stable release with
> it). Feel free to take or omit this from 4.19.

I'll leave it in as having duplicate module names is not good no matter
what kernel tree it is in.

thanks for the review!

greg k-h

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

* Re: [PATCH 4.19 055/247] soc: aspeed: snoop: Add clock control logic
  2021-03-04  8:12       ` Greg Kroah-Hartman
@ 2021-03-04  9:52         ` Joel Stanley
  0 siblings, 0 replies; 280+ messages in thread
From: Joel Stanley @ 2021-03-04  9:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Yoo, Jae Hyun, John Wang, Linux Kernel Mailing List, stable,
	Vernon Mauery, Sasha Levin

On Thu, 4 Mar 2021 at 08:12, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Tue, Mar 02, 2021 at 12:09:21AM +0000, Yoo, Jae Hyun wrote:

> > > From: Joel Stanley <joel@jms.id.au>

> > > Jae, John; with this backported do we need to also provide a corresponding
> > > device tree change for the stable tree, otherwise this driver will no longer
> > > probe?
> >
> > Right. The second patch
> > https://lore.kernel.org/linux-arm-kernel/20201208091748.1920-2-wangzhiqiang.bj@bytedance.com/
> > John submitted should be applied to stable tree too to make this module be probed
> > correctly.
>
> Now queued up, thanks.

Thanks Jae and Greg.

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

* Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-03-01 16:10 ` [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath Greg Kroah-Hartman
@ 2021-04-06 11:38   ` Salvatore Bonaccorso
  2021-04-06 13:41     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 280+ messages in thread
From: Salvatore Bonaccorso @ 2021-04-06 11:38 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, stable, Shyam Prasad N, Aurelien Aptel,
	Steve French, Sasha Levin

Hi,

On Mon, Mar 01, 2021 at 05:10:33PM +0100, Greg Kroah-Hartman wrote:
> From: Shyam Prasad N <sprasad@microsoft.com>
> 
> [ Upstream commit a738c93fb1c17e386a09304b517b1c6b2a6a5a8b ]
> 
> While debugging another issue today, Steve and I noticed that if a
> subdir for a file share is already mounted on the client, any new
> mount of any other subdir (or the file share root) of the same share
> results in sharing the cifs superblock, which e.g. can result in
> incorrect device name.
> 
> While setting prefix path for the root of a cifs_sb,
> CIFS_MOUNT_USE_PREFIX_PATH flag should also be set.
> Without it, prepath is not even considered in some places,
> and output of "mount" and various /proc/<>/*mount* related
> options can be missing part of the device name.
> 
> Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
> Reviewed-by: Aurelien Aptel <aaptel@suse.com>
> Signed-off-by: Steve French <stfrench@microsoft.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>  fs/cifs/connect.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 6285085195c15..632249ce61eba 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -3882,6 +3882,7 @@ int cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
>  		cifs_sb->prepath = kstrdup(pvolume_info->prepath, GFP_KERNEL);
>  		if (cifs_sb->prepath == NULL)
>  			return -ENOMEM;
> +		cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_USE_PREFIX_PATH;
>  	}
>  
>  	return 0;

A user in Debian reported an issue with mounts of DFS shares after an
update in Debian from 4.19.177 to 4.181:

https://lists.debian.org/debian-user/2021/04/msg00062.html

In a test setup i was able to reproduce the issue with 4.19.184 itself
(but interestingly not withing the 5.10.y series, checked 5.10.26)
which both contain the above commit.

4.19.184 with a738c93fb1c1 ("cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag
on setting cifs_sb->prepath.") reverted fixes the issue.

Is there probably some missing prerequisites missing in the 4.19.y
brach? I could not test othr versions, but maybe other versions are
affected as well as before 4.19.y, as the commit was backported to
4.14.223 as well.

Regards,
Salvatore

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

* Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-04-06 11:38   ` Salvatore Bonaccorso
@ 2021-04-06 13:41     ` Greg Kroah-Hartman
  2021-04-06 14:00       ` [EXTERNAL] " Shyam Prasad
  0 siblings, 1 reply; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-04-06 13:41 UTC (permalink / raw)
  To: Salvatore Bonaccorso
  Cc: linux-kernel, stable, Shyam Prasad N, Aurelien Aptel,
	Steve French, Sasha Levin

On Tue, Apr 06, 2021 at 01:38:24PM +0200, Salvatore Bonaccorso wrote:
> Hi,
> 
> On Mon, Mar 01, 2021 at 05:10:33PM +0100, Greg Kroah-Hartman wrote:
> > From: Shyam Prasad N <sprasad@microsoft.com>
> > 
> > [ Upstream commit a738c93fb1c17e386a09304b517b1c6b2a6a5a8b ]
> > 
> > While debugging another issue today, Steve and I noticed that if a
> > subdir for a file share is already mounted on the client, any new
> > mount of any other subdir (or the file share root) of the same share
> > results in sharing the cifs superblock, which e.g. can result in
> > incorrect device name.
> > 
> > While setting prefix path for the root of a cifs_sb,
> > CIFS_MOUNT_USE_PREFIX_PATH flag should also be set.
> > Without it, prepath is not even considered in some places,
> > and output of "mount" and various /proc/<>/*mount* related
> > options can be missing part of the device name.
> > 
> > Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
> > Reviewed-by: Aurelien Aptel <aaptel@suse.com>
> > Signed-off-by: Steve French <stfrench@microsoft.com>
> > Signed-off-by: Sasha Levin <sashal@kernel.org>
> > ---
> >  fs/cifs/connect.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> > index 6285085195c15..632249ce61eba 100644
> > --- a/fs/cifs/connect.c
> > +++ b/fs/cifs/connect.c
> > @@ -3882,6 +3882,7 @@ int cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
> >  		cifs_sb->prepath = kstrdup(pvolume_info->prepath, GFP_KERNEL);
> >  		if (cifs_sb->prepath == NULL)
> >  			return -ENOMEM;
> > +		cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_USE_PREFIX_PATH;
> >  	}
> >  
> >  	return 0;
> 
> A user in Debian reported an issue with mounts of DFS shares after an
> update in Debian from 4.19.177 to 4.181:
> 
> https://lists.debian.org/debian-user/2021/04/msg00062.html
> 
> In a test setup i was able to reproduce the issue with 4.19.184 itself
> (but interestingly not withing the 5.10.y series, checked 5.10.26)
> which both contain the above commit.
> 
> 4.19.184 with a738c93fb1c1 ("cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag
> on setting cifs_sb->prepath.") reverted fixes the issue.
> 
> Is there probably some missing prerequisites missing in the 4.19.y
> brach? I could not test othr versions, but maybe other versions are
> affected as well as before 4.19.y, as the commit was backported to
> 4.14.223 as well.

If there is a missing patch, we will be glad to take it, does 5.4 also
have this problem?

thanks,

greg k-h

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

* RE: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-04-06 13:41     ` Greg Kroah-Hartman
@ 2021-04-06 14:00       ` Shyam Prasad
  2021-04-06 15:01         ` Salvatore Bonaccorso
  0 siblings, 1 reply; 280+ messages in thread
From: Shyam Prasad @ 2021-04-06 14:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Salvatore Bonaccorso
  Cc: linux-kernel, stable, Aurelien Aptel, Steven French, Sasha Levin

Hi Greg,
We'll need to debug this further to understand what's going on. 

Hi Salvatore,
Any chance that you'll be able to provide us the cifsFYI logs from the time of mount failure?
https://wiki.samba.org/index.php/LinuxCIFS_troubleshooting#Enabling_Debugging

Regards,
Shyam

-----Original Message-----
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 
Sent: Tuesday, April 6, 2021 7:12 PM
To: Salvatore Bonaccorso <carnil@debian.org>
Cc: linux-kernel@vger.kernel.org; stable@vger.kernel.org; Shyam Prasad <Shyam.Prasad@microsoft.com>; Aurelien Aptel <aaptel@suse.com>; Steven French <Steven.French@microsoft.com>; Sasha Levin <sashal@kernel.org>
Subject: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.

On Tue, Apr 06, 2021 at 01:38:24PM +0200, Salvatore Bonaccorso wrote:
> Hi,
> 
> On Mon, Mar 01, 2021 at 05:10:33PM +0100, Greg Kroah-Hartman wrote:
> > From: Shyam Prasad N <sprasad@microsoft.com>
> > 
> > [ Upstream commit a738c93fb1c17e386a09304b517b1c6b2a6a5a8b ]
> > 
> > While debugging another issue today, Steve and I noticed that if a 
> > subdir for a file share is already mounted on the client, any new 
> > mount of any other subdir (or the file share root) of the same share 
> > results in sharing the cifs superblock, which e.g. can result in 
> > incorrect device name.
> > 
> > While setting prefix path for the root of a cifs_sb, 
> > CIFS_MOUNT_USE_PREFIX_PATH flag should also be set.
> > Without it, prepath is not even considered in some places, and 
> > output of "mount" and various /proc/<>/*mount* related options can 
> > be missing part of the device name.
> > 
> > Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
> > Reviewed-by: Aurelien Aptel <aaptel@suse.com>
> > Signed-off-by: Steve French <stfrench@microsoft.com>
> > Signed-off-by: Sasha Levin <sashal@kernel.org>
> > ---
> >  fs/cifs/connect.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 
> > 6285085195c15..632249ce61eba 100644
> > --- a/fs/cifs/connect.c
> > +++ b/fs/cifs/connect.c
> > @@ -3882,6 +3882,7 @@ int cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
> >  		cifs_sb->prepath = kstrdup(pvolume_info->prepath, GFP_KERNEL);
> >  		if (cifs_sb->prepath == NULL)
> >  			return -ENOMEM;
> > +		cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_USE_PREFIX_PATH;
> >  	}
> >  
> >  	return 0;
> 
> A user in Debian reported an issue with mounts of DFS shares after an 
> update in Debian from 4.19.177 to 4.181:
> 
> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
> s.debian.org%2Fdebian-user%2F2021%2F04%2Fmsg00062.html&amp;data=04%7C0
> 1%7CShyam.Prasad%40microsoft.com%7C0acbccd2643f4d55c6d008d8f901c180%7C
> 72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637533133251645484%7CUnknow
> n%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLC
> JXVCI6Mn0%3D%7C1000&amp;sdata=9xz2q%2FC1ur%2F3y70L5CJ5YoL%2FLhSci5hJ3U
> pttjbZJas%3D&amp;reserved=0
> 
> In a test setup i was able to reproduce the issue with 4.19.184 itself 
> (but interestingly not withing the 5.10.y series, checked 5.10.26) 
> which both contain the above commit.
> 
> 4.19.184 with a738c93fb1c1 ("cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag 
> on setting cifs_sb->prepath.") reverted fixes the issue.
> 
> Is there probably some missing prerequisites missing in the 4.19.y 
> brach? I could not test othr versions, but maybe other versions are 
> affected as well as before 4.19.y, as the commit was backported to
> 4.14.223 as well.

If there is a missing patch, we will be glad to take it, does 5.4 also have this problem?

thanks,

greg k-h

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

* Re: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-04-06 14:00       ` [EXTERNAL] " Shyam Prasad
@ 2021-04-06 15:01         ` Salvatore Bonaccorso
  2021-04-08 11:41           ` Salvatore Bonaccorso
  0 siblings, 1 reply; 280+ messages in thread
From: Salvatore Bonaccorso @ 2021-04-06 15:01 UTC (permalink / raw)
  To: Shyam Prasad
  Cc: Greg Kroah-Hartman, linux-kernel, stable, Aurelien Aptel,
	Steven French, Sasha Levin

[-- Attachment #1: Type: text/plain, Size: 754 bytes --]

Hi,

On Tue, Apr 06, 2021 at 02:00:48PM +0000, Shyam Prasad wrote:
> Hi Greg,
> We'll need to debug this further to understand what's going on. 

Greg asked it the same happens with 5.4 as well, I do not know I was
not able to test 5.4.y (yet) but only 5.10.y and 4.19.y.
> 
> Hi Salvatore,
> Any chance that you'll be able to provide us the cifsFYI logs from the time of mount failure?
> https://wiki.samba.org/index.php/LinuxCIFS_troubleshooting#Enabling_Debugging

Please find it attached. Is this enough information?

The mentioned home DFS link 'home' is a DFS link to
msdfs:SECONDHOST\REDACTED on a Samba host.

The mount is triggered as

mount -t cifs //HOSTIP/REDACTED/home /mnt --verbose -o username='REDACTED,domain=DOMAIN'

Regards,
Salvatore

[-- Attachment #2: dmesg.log --]
[-- Type: text/plain, Size: 19955 bytes --]

[  514.926988] fs/cifs/cifsfs.c: Devname: //HOSTIP/REDACTED/home flags: 0
[  514.927034] fs/cifs/connect.c: Domain name set
[  514.927045] No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount.
[  514.938086] fs/cifs/connect.c: Username: REDACTED
[  514.938227] fs/cifs/connect.c: file mode: 0755  dir mode: 0755
[  514.938229] fs/cifs/connect.c: CIFS VFS: in cifs_mount as Xid: 22 with uid: 0
[  514.938230] fs/cifs/connect.c: UNC: \\HOSTIP\REDACTED
[  514.938242] fs/cifs/connect.c: Socket created
[  514.938244] fs/cifs/connect.c: sndbuf 16384 rcvbuf 131072 rcvtimeo 0x6d6
[  514.938740] fs/cifs/fscache.c: cifs_fscache_get_client_cookie: (0x00000000d2679e7e/0x00000000684ecea8)
[  514.938743] fs/cifs/connect.c: CIFS VFS: in cifs_get_smb_ses as Xid: 23 with uid: 0
[  514.938744] fs/cifs/connect.c: Existing smb sess not found
[  514.938747] fs/cifs/smb2pdu.c: Negotiate protocol
[  514.938756] fs/cifs/transport.c: Sending smb: smb_len=110
[  514.938783] fs/cifs/connect.c: Demultiplex PID: 708
[  514.975155] fs/cifs/connect.c: RFC1002 header 0xe0
[  514.975161] fs/cifs/smb2misc.c: SMB2 data length 96 offset 128
[  514.975161] fs/cifs/smb2misc.c: SMB2 len 224
[  514.975195] fs/cifs/transport.c: cifs_sync_mid_result: cmd=0 mid=0 state=4
[  514.975202] fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[  514.975204] fs/cifs/smb2pdu.c: mode 0x1
[  514.975205] fs/cifs/smb2pdu.c: negotiated smb3.02 dialect
[  514.975209] fs/cifs/asn1.c: OID len = 7 oid = 0x1 0x2 0x348 0xbb92
[  514.975210] fs/cifs/asn1.c: OID len = 7 oid = 0x1 0x2 0x348 0x1bb92
[  514.975211] fs/cifs/asn1.c: OID len = 10 oid = 0x1 0x3 0x6 0x1
[  514.975212] fs/cifs/connect.c: Security Mode: 0x1 Capabilities: 0x300047 TimeAdjust: 0
[  514.975213] fs/cifs/smb2pdu.c: Session Setup
[  514.975214] fs/cifs/smb2pdu.c: sess setup type 4
[  514.975220] fs/cifs/transport.c: Sending smb: smb_len=124
[  514.989895] fs/cifs/connect.c: RFC1002 header 0xe6
[  514.989899] fs/cifs/smb2misc.c: SMB2 data length 158 offset 72
[  514.989900] fs/cifs/smb2misc.c: SMB2 len 230
[  514.989922] fs/cifs/transport.c: cifs_sync_mid_result: cmd=1 mid=1 state=4
[  514.989933] Status code returned 0xc0000016 STATUS_MORE_PROCESSING_REQUIRED
[  514.992502] fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc0000016 to POSIX err -5
[  514.992618] fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[  514.992622] fs/cifs/smb2pdu.c: rawntlmssp session setup challenge phase
[  514.992664] fs/cifs/transport.c: Sending smb: smb_len=336
[  515.216303] fs/cifs/connect.c: RFC1002 header 0x48
[  515.216312] fs/cifs/smb2misc.c: SMB2 data length 0 offset 72
[  515.216313] fs/cifs/smb2misc.c: SMB2 len 73
[  515.216316] fs/cifs/smb2misc.c: Calculated size 73 length 72 mismatch mid 2
[  515.216352] fs/cifs/transport.c: cifs_sync_mid_result: cmd=1 mid=2 state=4
[  515.216356] fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[  515.216380] fs/cifs/smb2pdu.c: SMB2/3 session established successfully
[  515.216384] fs/cifs/connect.c: CIFS VFS: leaving cifs_get_smb_ses (xid = 23) rc = 0
[  515.216389] fs/cifs/connect.c: CIFS VFS: in cifs_setup_ipc as Xid: 24 with uid: 0
[  515.216391] fs/cifs/smb2pdu.c: TCON
[  515.216403] fs/cifs/transport.c: Sending smb: smb_len=116
[  515.231610] fs/cifs/connect.c: RFC1002 header 0x50
[  515.231618] fs/cifs/smb2misc.c: SMB2 len 80
[  515.231656] fs/cifs/transport.c: cifs_sync_mid_result: cmd=3 mid=3 state=4
[  515.231658] fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[  515.231661] fs/cifs/smb2ops.c: add 2 credits total=34
[  515.231663] fs/cifs/smb2pdu.c: connection to pipe share
[  515.231665] fs/cifs/smb2pdu.c: validate negotiate
[  515.231667] fs/cifs/smb2pdu.c: SMB2 IOCTL
[  515.231687] fs/cifs/transport.c: Sending smb: smb_len=154
[  515.246340] fs/cifs/connect.c: RFC1002 header 0x88
[  515.246348] fs/cifs/smb2misc.c: SMB2 data length 24 offset 112
[  515.246349] fs/cifs/smb2misc.c: SMB2 len 136
[  515.246364] fs/cifs/transport.c: cifs_sync_mid_result: cmd=11 mid=4 state=4
[  515.246366] fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[  515.246368] fs/cifs/smb2ops.c: add 2 credits total=35
[  515.246371] fs/cifs/smb2pdu.c: validate negotiate info successful
[  515.246374] fs/cifs/connect.c: CIFS VFS: leaving cifs_setup_ipc (xid = 24) rc = 0
[  515.246375] fs/cifs/connect.c: IPC tcon rc = 0 ipc tid = 26334402
[  515.246381] fs/cifs/connect.c: CIFS VFS: in cifs_get_tcon as Xid: 25 with uid: 0
[  515.246382] fs/cifs/smb2pdu.c: TCON
[  515.246393] fs/cifs/transport.c: Sending smb: smb_len=124
[  515.261403] fs/cifs/connect.c: RFC1002 header 0x50
[  515.261411] fs/cifs/smb2misc.c: SMB2 len 80
[  515.261425] fs/cifs/transport.c: cifs_sync_mid_result: cmd=3 mid=5 state=4
[  515.261427] fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[  515.261429] fs/cifs/smb2ops.c: add 2 credits total=36
[  515.261431] fs/cifs/smb2pdu.c: connection to disk share
[  515.261433] fs/cifs/smb2pdu.c: validate negotiate
[  515.261434] fs/cifs/smb2pdu.c: SMB2 IOCTL
[  515.261450] fs/cifs/transport.c: Sending smb: smb_len=154
[  515.276126] fs/cifs/connect.c: RFC1002 header 0x88
[  515.276133] fs/cifs/smb2misc.c: SMB2 data length 24 offset 112
[  515.276134] fs/cifs/smb2misc.c: SMB2 len 136
[  515.276149] fs/cifs/transport.c: cifs_sync_mid_result: cmd=11 mid=6 state=4
[  515.276150] fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[  515.276153] fs/cifs/smb2ops.c: add 2 credits total=37
[  515.276155] fs/cifs/smb2pdu.c: validate negotiate info successful
[  515.276158] fs/cifs/connect.c: CIFS VFS: leaving cifs_get_tcon (xid = 25) rc = 0
[  515.276159] fs/cifs/connect.c: Tcon rc = 0
[  515.276165] fs/cifs/fscache.c: cifs_fscache_get_super_cookie: (0x00000000684ecea8/0x000000004ef56176)
[  515.276167] fs/cifs/smb2pdu.c: create/open
[  515.276180] fs/cifs/transport.c: Sending smb: smb_len=252
[  515.291695] fs/cifs/connect.c: RFC1002 header 0x98
[  515.291703] fs/cifs/smb2misc.c: SMB2 data length 0 offset 0
[  515.291705] fs/cifs/smb2misc.c: SMB2 len 153
[  515.291707] fs/cifs/smb2misc.c: Calculated size 153 length 152 mismatch mid 7
[  515.291721] fs/cifs/transport.c: cifs_sync_mid_result: cmd=5 mid=7 state=4
[  515.291723] fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[  515.291725] fs/cifs/smb2ops.c: add 2 credits total=38
[  515.291728] fs/cifs/smb2pdu.c: SMB2 IOCTL
[  515.291739] fs/cifs/transport.c: Sending smb: smb_len=125
[  515.306208] fs/cifs/connect.c: RFC1002 header 0x49
[  515.306215] fs/cifs/smb2misc.c: SMB2 data length 0 offset 0
[  515.306217] fs/cifs/smb2misc.c: SMB2 len 73
[  515.306231] fs/cifs/transport.c: cifs_sync_mid_result: cmd=11 mid=8 state=4
[  515.306235] Status code returned 0xc0000010 STATUS_INVALID_DEVICE_REQUEST
[  515.312000] fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc0000010 to POSIX err -95
[  515.312003] fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[  515.312007] fs/cifs/smb2ops.c: add 2 credits total=39
[  515.312010] fs/cifs/smb2ops.c: server does not support query network interfaces
[  515.312012] fs/cifs/smb2pdu.c: Query FSInfo level 5
[  515.312876] fs/cifs/transport.c: Sending smb: smb_len=109
[  515.327423] fs/cifs/connect.c: RFC1002 header 0x5c
[  515.327429] fs/cifs/smb2misc.c: SMB2 data length 20 offset 72
[  515.327431] fs/cifs/smb2misc.c: SMB2 len 92
[  515.327445] fs/cifs/transport.c: cifs_sync_mid_result: cmd=16 mid=9 state=4
[  515.327446] fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[  515.327448] fs/cifs/smb2ops.c: add 2 credits total=40
[  515.327451] fs/cifs/smb2pdu.c: Query FSInfo level 4
[  515.341970] fs/cifs/smb2misc.c: SMB2 data length 8 offset 72
[  515.341989] fs/cifs/smb2ops.c: add 2 credits total=41
[  515.341991] fs/cifs/smb2pdu.c: Query FSInfo level 1
[  515.356797] fs/cifs/smb2misc.c: SMB2 data length 34 offset 72
[  515.356815] fs/cifs/smb2ops.c: add 2 credits total=42
[  515.356818] fs/cifs/smb2pdu.c: Query FSInfo level 11
[  515.371694] fs/cifs/smb2ops.c: add 2 credits total=43
[  515.371701] fs/cifs/connect.c: build_unc_path_to_root: full_path=\\HOSTIP\REDACTED\home
[  515.371704] fs/cifs/smb2ops.c: smb2_get_dfs_refer path <\HOSTIP\REDACTED>
[  515.371709] fs/cifs/smb2pdu.c: SMB2 IOCTL
[  515.386939] fs/cifs/misc.c: num_referrals: 1 dfs flags: 0x3 ...
[  515.386955] fs/cifs/dns_resolve.c: dns_resolve_server_name_to_ip: unc is IP, skipping dns upcall: HOSTIP
[  515.386979] fs/cifs/connect.c: Domain name set
[  515.386990] No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount.
[  515.400089] fs/cifs/connect.c: Username: REDACTED
[  515.400091] fs/cifs/connect.c: cifs_put_tcon: tc_count=1
[  515.400091] fs/cifs/connect.c: CIFS VFS: in cifs_put_tcon as Xid: 26 with uid: 0
[  515.400092] fs/cifs/smb2pdu.c: Tree Disconnect
[  515.414824] fs/cifs/fscache.c: cifs_fscache_release_super_cookie: (0x000000004ef56176)
[  515.414826] fs/cifs/connect.c: cifs_put_smb_ses: ses_count=1
[  515.414827] fs/cifs/connect.c: CIFS VFS: in cifs_free_ipc as Xid: 27 with uid: 0
[  515.414827] fs/cifs/smb2pdu.c: Tree Disconnect
[  515.414828] fs/cifs/connect.c: CIFS VFS: leaving cifs_free_ipc (xid = 27) rc = -5
[  515.414828] fs/cifs/connect.c: failed to disconnect IPC tcon (rc=-5)
[  515.414829] fs/cifs/connect.c: CIFS VFS: in cifs_put_smb_ses as Xid: 28 with uid: 0
[  515.414830] fs/cifs/smb2pdu.c: disconnect session 000000006ca91b5c
[  515.429202] fs/cifs/fscache.c: cifs_fscache_release_client_cookie: (0x00000000d2679e7e/0x00000000684ecea8)
[  515.429209] fs/cifs/connect.c: CIFS VFS: leaving cifs_mount (xid = 22) rc = 0
[  515.429210] fs/cifs/connect.c: CIFS VFS: in cifs_mount as Xid: 29 with uid: 0
[  515.429211] fs/cifs/connect.c: UNC: \\HOSTIP\REDACTED
[  515.429230] fs/cifs/connect.c: Socket created
[  515.429232] fs/cifs/connect.c: sndbuf 16384 rcvbuf 131072 rcvtimeo 0x6d6
[  515.429597] fs/cifs/fscache.c: cifs_fscache_get_client_cookie: (0x00000000462d8926/0x000000004ef56176)
[  515.429608] fs/cifs/connect.c: CIFS VFS: in cifs_get_smb_ses as Xid: 30 with uid: 0
[  515.429609] fs/cifs/connect.c: Existing smb sess not found
[  515.429676] fs/cifs/smb2pdu.c: Negotiate protocol
[  515.429726] fs/cifs/connect.c: Demultiplex PID: 709
[  515.466950] fs/cifs/smb2pdu.c: mode 0x1
[  515.466952] fs/cifs/smb2pdu.c: negotiated smb3.02 dialect
[  515.466956] fs/cifs/asn1.c: OID len = 7 oid = 0x1 0x2 0x348 0xbb92
[  515.466957] fs/cifs/asn1.c: OID len = 7 oid = 0x1 0x2 0x348 0x1bb92
[  515.466958] fs/cifs/asn1.c: OID len = 10 oid = 0x1 0x3 0x6 0x1
[  515.466960] fs/cifs/connect.c: Security Mode: 0x1 Capabilities: 0x300047 TimeAdjust: 0
[  515.466961] fs/cifs/smb2pdu.c: Session Setup
[  515.466962] fs/cifs/smb2pdu.c: sess setup type 4
[  515.481545] Status code returned 0xc0000016 STATUS_MORE_PROCESSING_REQUIRED
[  515.484947] fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc0000016 to POSIX err -5
[  515.484952] fs/cifs/smb2pdu.c: rawntlmssp session setup challenge phase
[  515.607137] fs/cifs/smb2misc.c: Calculated size 73 length 72 mismatch mid 2
[  515.607171] fs/cifs/smb2pdu.c: SMB2/3 session established successfully
[  515.607175] fs/cifs/connect.c: CIFS VFS: leaving cifs_get_smb_ses (xid = 30) rc = 0
[  515.607179] fs/cifs/connect.c: CIFS VFS: in cifs_setup_ipc as Xid: 31 with uid: 0
[  515.607181] fs/cifs/smb2pdu.c: TCON
[  515.622244] fs/cifs/smb2pdu.c: connection to pipe share
[  515.622247] fs/cifs/smb2pdu.c: validate negotiate
[  515.622250] fs/cifs/smb2pdu.c: SMB2 IOCTL
[  515.637047] fs/cifs/smb2pdu.c: validate negotiate info successful
[  515.637052] fs/cifs/connect.c: CIFS VFS: leaving cifs_setup_ipc (xid = 31) rc = 0
[  515.637054] fs/cifs/connect.c: IPC tcon rc = 0 ipc tid = 211309129
[  515.637059] fs/cifs/connect.c: CIFS VFS: in cifs_get_tcon as Xid: 32 with uid: 0
[  515.637060] fs/cifs/smb2pdu.c: TCON
[  515.652585] fs/cifs/smb2pdu.c: connection to disk share
[  515.652588] fs/cifs/smb2pdu.c: validate negotiate
[  515.652590] fs/cifs/smb2pdu.c: SMB2 IOCTL
[  515.667482] fs/cifs/smb2pdu.c: validate negotiate info successful
[  515.667487] fs/cifs/connect.c: CIFS VFS: leaving cifs_get_tcon (xid = 32) rc = 0
[  515.667488] fs/cifs/connect.c: Tcon rc = 0
[  515.667495] fs/cifs/fscache.c: cifs_fscache_get_super_cookie: (0x000000004ef56176/0x00000000f43276d2)
[  515.667497] fs/cifs/smb2pdu.c: create/open
[  515.682771] fs/cifs/smb2misc.c: Calculated size 153 length 152 mismatch mid 7
[  515.682796] fs/cifs/smb2pdu.c: SMB2 IOCTL
[  515.697266] Status code returned 0xc0000010 STATUS_INVALID_DEVICE_REQUEST
[  515.702597] fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc0000010 to POSIX err -95
[  515.702604] fs/cifs/smb2ops.c: server does not support query network interfaces
[  515.702607] fs/cifs/smb2pdu.c: Query FSInfo level 5
[  515.717126] fs/cifs/smb2pdu.c: Query FSInfo level 4
[  515.731626] fs/cifs/smb2pdu.c: Query FSInfo level 1
[  515.746342] fs/cifs/smb2pdu.c: Query FSInfo level 11
[  515.761307] fs/cifs/smb2pdu.c: create/open
[  515.776111] Status code returned 0xc0000257 STATUS_PATH_NOT_COVERED
[  515.780819] fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc0000257 to POSIX err -66
[  515.780828] fs/cifs/connect.c: build_unc_path_to_root: full_path=\\HOSTIP\REDACTED\home
[  515.780830] fs/cifs/smb2ops.c: smb2_get_dfs_refer path <\HOSTIP\REDACTED\home>
[  515.780836] fs/cifs/smb2pdu.c: SMB2 IOCTL
[  515.795585] fs/cifs/misc.c: num_referrals: 1 dfs flags: 0x2 ...
[  515.795598] fs/cifs/dns_resolve.c: dns_resolve_server_name_to_ip: resolved: SECONDHOST to SECONDHOSTIP
[  515.795611] fs/cifs/connect.c: Domain name set
[  515.795617] No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount.
[  515.803897] fs/cifs/connect.c: Username: REDACTED
[  515.803900] fs/cifs/connect.c: cifs_put_tcon: tc_count=1
[  515.803901] fs/cifs/connect.c: CIFS VFS: in cifs_put_tcon as Xid: 33 with uid: 0
[  515.803902] fs/cifs/smb2pdu.c: Tree Disconnect
[  515.818981] fs/cifs/fscache.c: cifs_fscache_release_super_cookie: (0x00000000f43276d2)
[  515.818985] fs/cifs/connect.c: cifs_put_smb_ses: ses_count=1
[  515.818987] fs/cifs/connect.c: CIFS VFS: in cifs_free_ipc as Xid: 34 with uid: 0
[  515.818988] fs/cifs/smb2pdu.c: Tree Disconnect
[  515.818989] fs/cifs/connect.c: CIFS VFS: leaving cifs_free_ipc (xid = 34) rc = -5
[  515.818990] fs/cifs/connect.c: failed to disconnect IPC tcon (rc=-5)
[  515.818991] fs/cifs/connect.c: CIFS VFS: in cifs_put_smb_ses as Xid: 35 with uid: 0
[  515.818992] fs/cifs/smb2pdu.c: disconnect session 00000000490c2b16
[  515.834179] fs/cifs/fscache.c: cifs_fscache_release_client_cookie: (0x00000000462d8926/0x000000004ef56176)
[  515.834188] fs/cifs/connect.c: CIFS VFS: leaving cifs_mount (xid = 29) rc = 0
[  515.834190] fs/cifs/connect.c: CIFS VFS: in cifs_mount as Xid: 36 with uid: 0
[  515.834191] fs/cifs/connect.c: UNC: \\SECONDHOST\REDACTED
[  515.834210] fs/cifs/connect.c: Socket created
[  515.834212] fs/cifs/connect.c: sndbuf 16384 rcvbuf 131072 rcvtimeo 0x6d6
[  515.834653] fs/cifs/fscache.c: cifs_fscache_get_client_cookie: (0x000000000856a885/0x000000004ef56176)
[  515.834657] fs/cifs/connect.c: CIFS VFS: in cifs_get_smb_ses as Xid: 37 with uid: 0
[  515.834658] fs/cifs/connect.c: Existing smb sess not found
[  515.834661] fs/cifs/smb2pdu.c: Negotiate protocol
[  515.834732] fs/cifs/connect.c: Demultiplex PID: 710
[  515.905007] fs/cifs/smb2pdu.c: mode 0x1
[  515.905009] fs/cifs/smb2pdu.c: negotiated smb3.02 dialect
[  515.905013] fs/cifs/asn1.c: OID len = 7 oid = 0x1 0x2 0x348 0xbb92
[  515.905015] fs/cifs/asn1.c: OID len = 7 oid = 0x1 0x2 0x348 0x1bb92
[  515.905016] fs/cifs/asn1.c: OID len = 10 oid = 0x1 0x3 0x6 0x1
[  515.905019] fs/cifs/connect.c: Security Mode: 0x1 Capabilities: 0x300047 TimeAdjust: 0
[  515.905019] fs/cifs/smb2pdu.c: Session Setup
[  515.905021] fs/cifs/smb2pdu.c: sess setup type 4
[  515.919817] Status code returned 0xc0000016 STATUS_MORE_PROCESSING_REQUIRED
[  515.923917] fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc0000016 to POSIX err -5
[  515.923924] fs/cifs/smb2pdu.c: rawntlmssp session setup challenge phase
[  516.041427] fs/cifs/smb2misc.c: Calculated size 73 length 72 mismatch mid 2
[  516.041540] fs/cifs/smb2pdu.c: SMB2/3 session established successfully
[  516.041546] fs/cifs/connect.c: CIFS VFS: leaving cifs_get_smb_ses (xid = 37) rc = 0
[  516.041551] fs/cifs/connect.c: CIFS VFS: in cifs_setup_ipc as Xid: 38 with uid: 0
[  516.041552] fs/cifs/smb2pdu.c: TCON
[  516.056722] fs/cifs/smb2pdu.c: connection to pipe share
[  516.056726] fs/cifs/smb2pdu.c: validate negotiate
[  516.056728] fs/cifs/smb2pdu.c: SMB2 IOCTL
[  516.071737] fs/cifs/smb2pdu.c: validate negotiate info successful
[  516.071742] fs/cifs/connect.c: CIFS VFS: leaving cifs_setup_ipc (xid = 38) rc = 0
[  516.071743] fs/cifs/connect.c: IPC tcon rc = 0 ipc tid = -630022267
[  516.071749] fs/cifs/connect.c: CIFS VFS: in cifs_get_tcon as Xid: 39 with uid: 0
[  516.071750] fs/cifs/smb2pdu.c: TCON
[  516.087722] fs/cifs/smb2pdu.c: connection to disk share
[  516.087725] fs/cifs/smb2pdu.c: validate negotiate
[  516.087727] fs/cifs/smb2pdu.c: SMB2 IOCTL
[  516.101839] fs/cifs/smb2pdu.c: validate negotiate info successful
[  516.101844] fs/cifs/connect.c: CIFS VFS: leaving cifs_get_tcon (xid = 39) rc = 0
[  516.101846] fs/cifs/connect.c: Tcon rc = 0
[  516.101852] fs/cifs/fscache.c: cifs_fscache_get_super_cookie: (0x000000004ef56176/0x00000000f43276d2)
[  516.101854] fs/cifs/smb2pdu.c: create/open
[  516.116441] fs/cifs/smb2misc.c: Calculated size 153 length 152 mismatch mid 7
[  516.130609] Status code returned 0xc0000010 STATUS_INVALID_DEVICE_REQUEST
[  516.136197] fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc0000010 to POSIX err -95
[  516.136205] fs/cifs/smb2ops.c: server does not support query network interfaces
[  516.136208] fs/cifs/smb2pdu.c: Query FSInfo level 5
[  516.150224] fs/cifs/smb2pdu.c: Query FSInfo level 4
[  516.192048] fs/cifs/connect.c: CIFS VFS: leaving cifs_mount (xid = 36) rc = 0
[  516.192194] fs/cifs/inode.c: CIFS VFS: in cifs_root_iget as Xid: 40 with uid: 0
[  516.192196] fs/cifs/inode.c: Getting info on \home
[  516.192220] fs/cifs/smb2pdu.c: create/open
[  516.207194] Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
[  516.211766] fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc0000034 to POSIX err -2
[  516.211776] fs/cifs/inode.c: CIFS VFS: leaving cifs_root_iget (xid = 40) rc = -2
[  516.211778] CIFS VFS: cifs_read_super: get root inode failed
[  516.216945] fs/cifs/connect.c: cifs_put_tcon: tc_count=1
[  516.216948] fs/cifs/connect.c: CIFS VFS: in cifs_put_tcon as Xid: 41 with uid: 0
[  516.216949] fs/cifs/smb2pdu.c: Tree Disconnect
[  516.231510] fs/cifs/fscache.c: cifs_fscache_release_super_cookie: (0x00000000f43276d2)
[  516.231513] fs/cifs/connect.c: cifs_put_smb_ses: ses_count=1
[  516.231514] fs/cifs/connect.c: CIFS VFS: in cifs_free_ipc as Xid: 42 with uid: 0
[  516.231514] fs/cifs/smb2pdu.c: Tree Disconnect
[  516.231515] fs/cifs/connect.c: CIFS VFS: leaving cifs_free_ipc (xid = 42) rc = -5
[  516.231516] fs/cifs/connect.c: failed to disconnect IPC tcon (rc=-5)
[  516.231516] fs/cifs/connect.c: CIFS VFS: in cifs_put_smb_ses as Xid: 43 with uid: 0
[  516.231517] fs/cifs/smb2pdu.c: disconnect session 00000000548ab32c
[  516.245329] fs/cifs/fscache.c: cifs_fscache_release_client_cookie: (0x000000000856a885/0x000000004ef56176)

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

* Re: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-04-06 15:01         ` Salvatore Bonaccorso
@ 2021-04-08 11:41           ` Salvatore Bonaccorso
  2021-04-12  8:01             ` Greg Kroah-Hartman
  0 siblings, 1 reply; 280+ messages in thread
From: Salvatore Bonaccorso @ 2021-04-08 11:41 UTC (permalink / raw)
  To: Shyam Prasad
  Cc: Greg Kroah-Hartman, linux-kernel, stable, Aurelien Aptel,
	Steven French, Sasha Levin

Hi Shyam,

On Tue, Apr 06, 2021 at 05:01:17PM +0200, Salvatore Bonaccorso wrote:
> Hi,
> 
> On Tue, Apr 06, 2021 at 02:00:48PM +0000, Shyam Prasad wrote:
> > Hi Greg,
> > We'll need to debug this further to understand what's going on. 
> 
> Greg asked it the same happens with 5.4 as well, I do not know I was
> not able to test 5.4.y (yet) but only 5.10.y and 4.19.y.
> > 
> > Hi Salvatore,
> > Any chance that you'll be able to provide us the cifsFYI logs from the time of mount failure?
> > https://wiki.samba.org/index.php/LinuxCIFS_troubleshooting#Enabling_Debugging
> 
> Please find it attached. Is this enough information?
> 
> The mentioned home DFS link 'home' is a DFS link to
> msdfs:SECONDHOST\REDACTED on a Samba host.
> 
> The mount is triggered as
> 
> mount -t cifs //HOSTIP/REDACTED/home /mnt --verbose -o username='REDACTED,domain=DOMAIN'

So I can confirm the issue is both present in 4.19.185 and 5.4.110
upstream (without any Debian patches applied, we do not anyway apply
any cifs related one on top of the respetive upstream version).

The issue is not present in 5.10.28.

So I think there are commits as dependency of a738c93fb1c1 ("cifs: Set
CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.") which
are required and not applied in the released before 5.10.y which make
introducing the regression.

Regards,
Salvatore

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

* Re: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-04-08 11:41           ` Salvatore Bonaccorso
@ 2021-04-12  8:01             ` Greg Kroah-Hartman
  2021-04-18 12:41               ` Salvatore Bonaccorso
  0 siblings, 1 reply; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-04-12  8:01 UTC (permalink / raw)
  To: Salvatore Bonaccorso
  Cc: Shyam Prasad, linux-kernel, stable, Aurelien Aptel,
	Steven French, Sasha Levin

On Thu, Apr 08, 2021 at 01:41:05PM +0200, Salvatore Bonaccorso wrote:
> Hi Shyam,
> 
> On Tue, Apr 06, 2021 at 05:01:17PM +0200, Salvatore Bonaccorso wrote:
> > Hi,
> > 
> > On Tue, Apr 06, 2021 at 02:00:48PM +0000, Shyam Prasad wrote:
> > > Hi Greg,
> > > We'll need to debug this further to understand what's going on. 
> > 
> > Greg asked it the same happens with 5.4 as well, I do not know I was
> > not able to test 5.4.y (yet) but only 5.10.y and 4.19.y.
> > > 
> > > Hi Salvatore,
> > > Any chance that you'll be able to provide us the cifsFYI logs from the time of mount failure?
> > > https://wiki.samba.org/index.php/LinuxCIFS_troubleshooting#Enabling_Debugging
> > 
> > Please find it attached. Is this enough information?
> > 
> > The mentioned home DFS link 'home' is a DFS link to
> > msdfs:SECONDHOST\REDACTED on a Samba host.
> > 
> > The mount is triggered as
> > 
> > mount -t cifs //HOSTIP/REDACTED/home /mnt --verbose -o username='REDACTED,domain=DOMAIN'
> 
> So I can confirm the issue is both present in 4.19.185 and 5.4.110
> upstream (without any Debian patches applied, we do not anyway apply
> any cifs related one on top of the respetive upstream version).
> 
> The issue is not present in 5.10.28.
> 
> So I think there are commits as dependency of a738c93fb1c1 ("cifs: Set
> CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.") which
> are required and not applied in the released before 5.10.y which make
> introducing the regression.

Ok, I've dropped this from 5.4 and older kernel trees now, thanks for
the report.

greg k-h

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

* Re: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-04-12  8:01             ` Greg Kroah-Hartman
@ 2021-04-18 12:41               ` Salvatore Bonaccorso
  2021-04-19  5:48                 ` Shyam Prasad
  2021-04-19 14:15                 ` Paulo Alcantara
  0 siblings, 2 replies; 280+ messages in thread
From: Salvatore Bonaccorso @ 2021-04-18 12:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Shyam Prasad, linux-kernel, stable, Aurelien Aptel,
	Steven French, Sasha Levin

Hi Greg,

On Mon, Apr 12, 2021 at 10:01:33AM +0200, Greg Kroah-Hartman wrote:
> On Thu, Apr 08, 2021 at 01:41:05PM +0200, Salvatore Bonaccorso wrote:
> > Hi Shyam,
> > 
> > On Tue, Apr 06, 2021 at 05:01:17PM +0200, Salvatore Bonaccorso wrote:
> > > Hi,
> > > 
> > > On Tue, Apr 06, 2021 at 02:00:48PM +0000, Shyam Prasad wrote:
> > > > Hi Greg,
> > > > We'll need to debug this further to understand what's going on. 
> > > 
> > > Greg asked it the same happens with 5.4 as well, I do not know I was
> > > not able to test 5.4.y (yet) but only 5.10.y and 4.19.y.
> > > > 
> > > > Hi Salvatore,
> > > > Any chance that you'll be able to provide us the cifsFYI logs from the time of mount failure?
> > > > https://wiki.samba.org/index.php/LinuxCIFS_troubleshooting#Enabling_Debugging
> > > 
> > > Please find it attached. Is this enough information?
> > > 
> > > The mentioned home DFS link 'home' is a DFS link to
> > > msdfs:SECONDHOST\REDACTED on a Samba host.
> > > 
> > > The mount is triggered as
> > > 
> > > mount -t cifs //HOSTIP/REDACTED/home /mnt --verbose -o username='REDACTED,domain=DOMAIN'
> > 
> > So I can confirm the issue is both present in 4.19.185 and 5.4.110
> > upstream (without any Debian patches applied, we do not anyway apply
> > any cifs related one on top of the respetive upstream version).
> > 
> > The issue is not present in 5.10.28.
> > 
> > So I think there are commits as dependency of a738c93fb1c1 ("cifs: Set
> > CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.") which
> > are required and not applied in the released before 5.10.y which make
> > introducing the regression.
> 
> Ok, I've dropped this from 5.4 and older kernel trees now, thanks for
> the report.

Thanks Greg! Shyam, Steven, now the commit was reverted for the older
brnaches. But did you got a chance to find why it breaks for the older
series?

Regards,
Salvatore

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

* RE: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-04-18 12:41               ` Salvatore Bonaccorso
@ 2021-04-19  5:48                 ` Shyam Prasad
  2021-04-19 13:22                   ` Salvatore Bonaccorso
                                     ` (2 more replies)
  2021-04-19 14:15                 ` Paulo Alcantara
  1 sibling, 3 replies; 280+ messages in thread
From: Shyam Prasad @ 2021-04-19  5:48 UTC (permalink / raw)
  To: Salvatore Bonaccorso, Greg Kroah-Hartman, pc
  Cc: linux-kernel, stable, Aurelien Aptel, Steven French, Sasha Levin

[-- Attachment #1: Type: text/plain, Size: 3135 bytes --]

<Including Paulo in this email thread>

Hi Salvatore,

Attached is a proposed fix from Paulo for older kernels. 
Can you please confirm that this works for you too? 

Regards,
Shyam

-----Original Message-----
From: Salvatore Bonaccorso <salvatore.bonaccorso@gmail.com> On Behalf Of Salvatore Bonaccorso
Sent: Sunday, April 18, 2021 6:11 PM
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Shyam Prasad <Shyam.Prasad@microsoft.com>; linux-kernel@vger.kernel.org; stable@vger.kernel.org; Aurelien Aptel <aaptel@suse.com>; Steven French <Steven.French@microsoft.com>; Sasha Levin <sashal@kernel.org>
Subject: Re: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.

Hi Greg,

On Mon, Apr 12, 2021 at 10:01:33AM +0200, Greg Kroah-Hartman wrote:
> On Thu, Apr 08, 2021 at 01:41:05PM +0200, Salvatore Bonaccorso wrote:
> > Hi Shyam,
> > 
> > On Tue, Apr 06, 2021 at 05:01:17PM +0200, Salvatore Bonaccorso wrote:
> > > Hi,
> > > 
> > > On Tue, Apr 06, 2021 at 02:00:48PM +0000, Shyam Prasad wrote:
> > > > Hi Greg,
> > > > We'll need to debug this further to understand what's going on. 
> > > 
> > > Greg asked it the same happens with 5.4 as well, I do not know I 
> > > was not able to test 5.4.y (yet) but only 5.10.y and 4.19.y.
> > > > 
> > > > Hi Salvatore,
> > > > Any chance that you'll be able to provide us the cifsFYI logs from the time of mount failure?
> > > > https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%
> > > > 2Fwiki.samba.org%2Findex.php%2FLinuxCIFS_troubleshooting%23Enabl
> > > > ing_Debugging&amp;data=04%7C01%7CShyam.Prasad%40microsoft.com%7C
> > > > 3f7f5a39dd974cacf6aa08d902674040%7C72f988bf86f141af91ab2d7cd011d
> > > > b47%7C1%7C0%7C637543465194151840%7CUnknown%7CTWFpbGZsb3d8eyJWIjo
> > > > iMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C10
> > > > 00&amp;sdata=nH2tcSzqFzzqLZ2RIARR008%2FuvBEdDHEnjKpVXhzIdk%3D&am
> > > > p;reserved=0
> > > 
> > > Please find it attached. Is this enough information?
> > > 
> > > The mentioned home DFS link 'home' is a DFS link to 
> > > msdfs:SECONDHOST\REDACTED on a Samba host.
> > > 
> > > The mount is triggered as
> > > 
> > > mount -t cifs //HOSTIP/REDACTED/home /mnt --verbose -o username='REDACTED,domain=DOMAIN'
> > 
> > So I can confirm the issue is both present in 4.19.185 and 5.4.110 
> > upstream (without any Debian patches applied, we do not anyway apply 
> > any cifs related one on top of the respetive upstream version).
> > 
> > The issue is not present in 5.10.28.
> > 
> > So I think there are commits as dependency of a738c93fb1c1 ("cifs: 
> > Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.") 
> > which are required and not applied in the released before 5.10.y 
> > which make introducing the regression.
> 
> Ok, I've dropped this from 5.4 and older kernel trees now, thanks for 
> the report.

Thanks Greg! Shyam, Steven, now the commit was reverted for the older brnaches. But did you got a chance to find why it breaks for the older series?

Regards,
Salvatore

[-- Attachment #2: 0001-cifs-fix-prefix-path-in-dfs-mounts.patch --]
[-- Type: application/octet-stream, Size: 1160 bytes --]

From d38a3c15d8dd35ce55fc10e5eebd7219718179cf Mon Sep 17 00:00:00 2001
From: Paulo Alcantara <pc@cjr.nz>
Date: Thu, 8 Apr 2021 13:31:03 -0300
Subject: [PATCH 4.19] cifs: fix prefix path in dfs mounts

When chasing dfs referrals we update the volume info accordingly so we
can build new dfs full paths from them, but we missed to update the
final prefix path in superblock that is used in most places.

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
---
 fs/cifs/connect.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 632249ce61eb..e342ab94f79d 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -4283,6 +4283,16 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
 		goto mount_fail_check;
 	}
 
+	kfree(cifs_sb->prepath);
+	cifs_sb->prepath = NULL;
+	if (volume_info->prepath) {
+		cifs_sb->prepath = kstrdup(volume_info->prepath, GFP_KERNEL);
+		if (!cifs_sb->prepath) {
+			rc = -ENOMEM;
+			goto mount_fail_check;
+		}
+	}
+
 	tlink->tl_uid = ses->linux_uid;
 	tlink->tl_tcon = tcon;
 	tlink->tl_time = jiffies;
-- 
2.30.2


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

* Re: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-04-19  5:48                 ` Shyam Prasad
@ 2021-04-19 13:22                   ` Salvatore Bonaccorso
  2021-04-19 13:43                     ` Shyam Prasad
  2021-04-19 14:16                     ` Paulo Alcantara
  2021-04-19 17:09                   ` Salvatore Bonaccorso
  2021-04-21  7:09                   ` Santiago Garcia Mantinan
  2 siblings, 2 replies; 280+ messages in thread
From: Salvatore Bonaccorso @ 2021-04-19 13:22 UTC (permalink / raw)
  To: Shyam Prasad
  Cc: Greg Kroah-Hartman, pc, linux-kernel, stable, Aurelien Aptel,
	Steven French, Sasha Levin

Hi Shyam,

On Mon, Apr 19, 2021 at 05:48:24AM +0000, Shyam Prasad wrote:
> <Including Paulo in this email thread>
> 
> Hi Salvatore,
> 
> Attached is a proposed fix from Paulo for older kernels. 
> Can you please confirm that this works for you too? 

So just to be clear, first apply again a738c93fb1c1 and then your
additional patch on top?

Regards,
Salvatore

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

* RE: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-04-19 13:22                   ` Salvatore Bonaccorso
@ 2021-04-19 13:43                     ` Shyam Prasad
  2021-04-19 14:16                     ` Paulo Alcantara
  1 sibling, 0 replies; 280+ messages in thread
From: Shyam Prasad @ 2021-04-19 13:43 UTC (permalink / raw)
  To: Salvatore Bonaccorso
  Cc: Greg Kroah-Hartman, pc, linux-kernel, stable, Aurelien Aptel,
	Steven French, Sasha Levin

I think so; Paulo can confirm.

-----Original Message-----
From: Salvatore Bonaccorso <salvatore.bonaccorso@gmail.com> On Behalf Of Salvatore Bonaccorso
Sent: Monday, April 19, 2021 6:52 PM
To: Shyam Prasad <Shyam.Prasad@microsoft.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; pc <pc@cjr.nz>; linux-kernel@vger.kernel.org; stable@vger.kernel.org; Aurelien Aptel <aaptel@suse.com>; Steven French <Steven.French@microsoft.com>; Sasha Levin <sashal@kernel.org>
Subject: Re: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.

Hi Shyam,

On Mon, Apr 19, 2021 at 05:48:24AM +0000, Shyam Prasad wrote:
> <Including Paulo in this email thread>
> 
> Hi Salvatore,
> 
> Attached is a proposed fix from Paulo for older kernels. 
> Can you please confirm that this works for you too? 

So just to be clear, first apply again a738c93fb1c1 and then your additional patch on top?

Regards,
Salvatore

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

* Re: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-04-18 12:41               ` Salvatore Bonaccorso
  2021-04-19  5:48                 ` Shyam Prasad
@ 2021-04-19 14:15                 ` Paulo Alcantara
  1 sibling, 0 replies; 280+ messages in thread
From: Paulo Alcantara @ 2021-04-19 14:15 UTC (permalink / raw)
  To: Salvatore Bonaccorso, Greg Kroah-Hartman
  Cc: Shyam Prasad, linux-kernel, stable, Aurelien Aptel,
	Steven French, Sasha Levin

Salvatore Bonaccorso <carnil@debian.org> writes:

> Thanks Greg! Shyam, Steven, now the commit was reverted for the older
> brnaches. But did you got a chance to find why it breaks for the older
> series?

That commit has revealed another bug in cifs_mount() where we failed to
update the super's prefix path after chasing DFS referrals.

Newer kernel versions do not have it because the code & logic in
cifs_mount() changed entirely.

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

* Re: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-04-19 13:22                   ` Salvatore Bonaccorso
  2021-04-19 13:43                     ` Shyam Prasad
@ 2021-04-19 14:16                     ` Paulo Alcantara
  1 sibling, 0 replies; 280+ messages in thread
From: Paulo Alcantara @ 2021-04-19 14:16 UTC (permalink / raw)
  To: Salvatore Bonaccorso, Shyam Prasad
  Cc: Greg Kroah-Hartman, linux-kernel, stable, Aurelien Aptel,
	Steven French, Sasha Levin

Salvatore Bonaccorso <carnil@debian.org> writes:

> So just to be clear, first apply again a738c93fb1c1 and then your
> additional patch on top?

Yes.

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

* Re: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-04-19  5:48                 ` Shyam Prasad
  2021-04-19 13:22                   ` Salvatore Bonaccorso
@ 2021-04-19 17:09                   ` Salvatore Bonaccorso
  2021-04-22 15:36                     ` Shyam Prasad
  2021-04-21  7:09                   ` Santiago Garcia Mantinan
  2 siblings, 1 reply; 280+ messages in thread
From: Salvatore Bonaccorso @ 2021-04-19 17:09 UTC (permalink / raw)
  To: Shyam Prasad
  Cc: Greg Kroah-Hartman, pc, linux-kernel, stable, Aurelien Aptel,
	Steven French, Sasha Levin

Hi Shyam,

On Mon, Apr 19, 2021 at 05:48:24AM +0000, Shyam Prasad wrote:
> <Including Paulo in this email thread>
> 
> Hi Salvatore,
> 
> Attached is a proposed fix from Paulo for older kernels. 
> Can you please confirm that this works for you too? 

I re-applied commit a738c93fb1c1 ("cifs: Set
CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.") and on
top of that your provided patch, and this seems to resolve the issue
for the testcase I have at hand!

Regards,
Salvatore

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

* Re: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-04-19  5:48                 ` Shyam Prasad
  2021-04-19 13:22                   ` Salvatore Bonaccorso
  2021-04-19 17:09                   ` Salvatore Bonaccorso
@ 2021-04-21  7:09                   ` Santiago Garcia Mantinan
  2 siblings, 0 replies; 280+ messages in thread
From: Santiago Garcia Mantinan @ 2021-04-21  7:09 UTC (permalink / raw)
  To: Shyam Prasad
  Cc: Salvatore Bonaccorso, Greg Kroah-Hartman, pc, linux-kernel,
	stable, Aurelien Aptel, Steven French, Sasha Levin

Hi!

On Abr 19 2021, Shyam Prasad wrote:
> Hi Salvatore,
> 
> Attached is a proposed fix from Paulo for older kernels. 
> Can you please confirm that this works for you too? 

Salvatore pinged me for some tests on this, I did apply this patch on top of
Debian's 4.19.181-1 which was failing and it now works as expected.

Regards.
-- 
Manty/BestiaTester -> http://manty.net

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

* RE: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-04-19 17:09                   ` Salvatore Bonaccorso
@ 2021-04-22 15:36                     ` Shyam Prasad
  2021-04-23  7:42                       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 280+ messages in thread
From: Shyam Prasad @ 2021-04-22 15:36 UTC (permalink / raw)
  To: Salvatore Bonaccorso, Greg Kroah-Hartman
  Cc: pc, linux-kernel, stable, Aurelien Aptel, Steven French, Sasha Levin

Hi Salvatore and Santiago,

Thanks for testing this out.

@Greg Kroah-Hartman: The reverted patch used in combination with Paulo's fix seems to fix both use cases. 
Can we have both these taken in on stable kernels? Paulo's patch is needed only for kernels 5.10 and older.

Regards,
Shyam

-----Original Message-----
From: Salvatore Bonaccorso <salvatore.bonaccorso@gmail.com> On Behalf Of Salvatore Bonaccorso
Sent: Monday, April 19, 2021 10:39 PM
To: Shyam Prasad <Shyam.Prasad@microsoft.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; pc <pc@cjr.nz>; linux-kernel@vger.kernel.org; stable@vger.kernel.org; Aurelien Aptel <aaptel@suse.com>; Steven French <Steven.French@microsoft.com>; Sasha Levin <sashal@kernel.org>
Subject: Re: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.

Hi Shyam,

On Mon, Apr 19, 2021 at 05:48:24AM +0000, Shyam Prasad wrote:
> <Including Paulo in this email thread>
> 
> Hi Salvatore,
> 
> Attached is a proposed fix from Paulo for older kernels. 
> Can you please confirm that this works for you too? 

I re-applied commit a738c93fb1c1 ("cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.") and on top of that your provided patch, and this seems to resolve the issue for the testcase I have at hand!

Regards,
Salvatore

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

* Re: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-04-22 15:36                     ` Shyam Prasad
@ 2021-04-23  7:42                       ` Greg Kroah-Hartman
  2021-05-08 13:22                         ` Salvatore Bonaccorso
  0 siblings, 1 reply; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-04-23  7:42 UTC (permalink / raw)
  To: Shyam Prasad
  Cc: Salvatore Bonaccorso, pc, linux-kernel, stable, Aurelien Aptel,
	Steven French, Sasha Levin

On Thu, Apr 22, 2021 at 03:36:07PM +0000, Shyam Prasad wrote:
> Hi Salvatore and Santiago,
> 
> Thanks for testing this out.
> 
> @Greg Kroah-Hartman: The reverted patch used in combination with Paulo's fix seems to fix both use cases. 
> Can we have both these taken in on stable kernels? Paulo's patch is needed only for kernels 5.10 and older.

I do not know what "both" is here at all.

Please resubmit all of the needed commits in a format that I can apply
them in, and I will be glad to review them and queue them up.

Note, patches that are not in Linus's tree better be documented really
really really really well for why that is not so...

thanks,

greg k-h

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

* Re: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-04-23  7:42                       ` Greg Kroah-Hartman
@ 2021-05-08 13:22                         ` Salvatore Bonaccorso
  2021-05-09 10:16                           ` Shyam Prasad
  0 siblings, 1 reply; 280+ messages in thread
From: Salvatore Bonaccorso @ 2021-05-08 13:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Shyam Prasad, pc, linux-kernel, stable, Aurelien Aptel,
	Steven French, Sasha Levin

Shyam, Paulo,

On Fri, Apr 23, 2021 at 09:42:35AM +0200, Greg Kroah-Hartman wrote:
> On Thu, Apr 22, 2021 at 03:36:07PM +0000, Shyam Prasad wrote:
> > Hi Salvatore and Santiago,
> > 
> > Thanks for testing this out.
> > 
> > @Greg Kroah-Hartman: The reverted patch used in combination with Paulo's fix seems to fix both use cases. 
> > Can we have both these taken in on stable kernels? Paulo's patch is needed only for kernels 5.10 and older.
> 
> I do not know what "both" is here at all.
> 
> Please resubmit all of the needed commits in a format that I can apply
> them in, and I will be glad to review them and queue them up.
> 
> Note, patches that are not in Linus's tree better be documented really
> really really really well for why that is not so...

Did you saw the ping from Greg? Otherwise I think the situation as it
is now for the older stable series is probably just as fine as it is
now with the repsective original commit reverted.

Regards,
Salvatore

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

* RE: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-05-08 13:22                         ` Salvatore Bonaccorso
@ 2021-05-09 10:16                           ` Shyam Prasad
  2021-05-10  7:46                             ` Greg Kroah-Hartman
  0 siblings, 1 reply; 280+ messages in thread
From: Shyam Prasad @ 2021-05-09 10:16 UTC (permalink / raw)
  To: Salvatore Bonaccorso, Greg Kroah-Hartman, Paulo Alcantara
  Cc: pc, linux-kernel, stable, Aurelien Aptel, Steven French, Sasha Levin

[-- Attachment #1: Type: text/plain, Size: 3204 bytes --]

Hi Salvatore,

Thanks for reminding me. I had to do some reading to reply to this one. 
The situation right now is this:
The patch "cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath." has been reverted. Which means that the DFS bug which you originally faced will not be seen. 

Hi Greg,

Here are the two patches which I'm referring to:
1. cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.12&id=a738c93fb1c17e386a09304b517b1c6b2a6a5a8b
This fixed an issue when two cifs mount points shared a common prefix in the path which they mounted from the same server. The patch was marked for CC:stable considering that this fix can be important for some users.
However, there was a dependent change for DFS scenario, which is present in the Linus' mainline tree, but were not marked for CC:stable, so missing from the stable trees.
Due to the missing dependent changes, DFS users faced issues with pre-5.11 kernels, and this patch was reverted in the stable trees.

2. Due to a major change that went into the 5.11 kernel (the new mount API support), the code differs significantly, and the missing patch cannot be applied to pre-5.11 trees.
Hence, Paulo submitted the attached patch (cifs: fix prefix path in dfs mounts), which fixes this for pre-5.11 kernels.

I was referring to these two patches to be applied to all stable trees. Salvatore has verified that with both patches applied, the DFS scenario starts working again. 
@Paulo Alcantara Please add if I missed something here. 

Regards,
Shyam

-----Original Message-----
From: Salvatore Bonaccorso <salvatore.bonaccorso@gmail.com> On Behalf Of Salvatore Bonaccorso
Sent: Saturday, May 8, 2021 6:52 PM
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Shyam Prasad <Shyam.Prasad@microsoft.com>; pc <pc@cjr.nz>; linux-kernel@vger.kernel.org; stable@vger.kernel.org; Aurelien Aptel <aaptel@suse.com>; Steven French <Steven.French@microsoft.com>; Sasha Levin <sashal@kernel.org>
Subject: Re: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.

Shyam, Paulo,

On Fri, Apr 23, 2021 at 09:42:35AM +0200, Greg Kroah-Hartman wrote:
> On Thu, Apr 22, 2021 at 03:36:07PM +0000, Shyam Prasad wrote:
> > Hi Salvatore and Santiago,
> > 
> > Thanks for testing this out.
> > 
> > @Greg Kroah-Hartman: The reverted patch used in combination with Paulo's fix seems to fix both use cases. 
> > Can we have both these taken in on stable kernels? Paulo's patch is needed only for kernels 5.10 and older.
> 
> I do not know what "both" is here at all.
> 
> Please resubmit all of the needed commits in a format that I can apply 
> them in, and I will be glad to review them and queue them up.
> 
> Note, patches that are not in Linus's tree better be documented really 
> really really really well for why that is not so...

Did you saw the ping from Greg? Otherwise I think the situation as it is now for the older stable series is probably just as fine as it is now with the repsective original commit reverted.

Regards,
Salvatore

[-- Attachment #2: 0001-cifs-fix-prefix-path-in-dfs-mounts.patch --]
[-- Type: application/octet-stream, Size: 1160 bytes --]

From d38a3c15d8dd35ce55fc10e5eebd7219718179cf Mon Sep 17 00:00:00 2001
From: Paulo Alcantara <pc@cjr.nz>
Date: Thu, 8 Apr 2021 13:31:03 -0300
Subject: [PATCH 4.19] cifs: fix prefix path in dfs mounts

When chasing dfs referrals we update the volume info accordingly so we
can build new dfs full paths from them, but we missed to update the
final prefix path in superblock that is used in most places.

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
---
 fs/cifs/connect.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 632249ce61eb..e342ab94f79d 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -4283,6 +4283,16 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
 		goto mount_fail_check;
 	}
 
+	kfree(cifs_sb->prepath);
+	cifs_sb->prepath = NULL;
+	if (volume_info->prepath) {
+		cifs_sb->prepath = kstrdup(volume_info->prepath, GFP_KERNEL);
+		if (!cifs_sb->prepath) {
+			rc = -ENOMEM;
+			goto mount_fail_check;
+		}
+	}
+
 	tlink->tl_uid = ses->linux_uid;
 	tlink->tl_tcon = tcon;
 	tlink->tl_time = jiffies;
-- 
2.30.2


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

* Re: [EXTERNAL] Re: [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
  2021-05-09 10:16                           ` Shyam Prasad
@ 2021-05-10  7:46                             ` Greg Kroah-Hartman
  0 siblings, 0 replies; 280+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-10  7:46 UTC (permalink / raw)
  To: Shyam Prasad
  Cc: Salvatore Bonaccorso, Paulo Alcantara, pc, linux-kernel, stable,
	Aurelien Aptel, Steven French, Sasha Levin

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

On Sun, May 09, 2021 at 10:16:06AM +0000, Shyam Prasad wrote:
> Hi Salvatore,
> 
> Thanks for reminding me. I had to do some reading to reply to this one. 
> The situation right now is this:
> The patch "cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath." has been reverted. Which means that the DFS bug which you originally faced will not be seen. 
> 
> Hi Greg,
> 
> Here are the two patches which I'm referring to:
> 1. cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.12&id=a738c93fb1c17e386a09304b517b1c6b2a6a5a8b
> This fixed an issue when two cifs mount points shared a common prefix in the path which they mounted from the same server. The patch was marked for CC:stable considering that this fix can be important for some users.
> However, there was a dependent change for DFS scenario, which is present in the Linus' mainline tree, but were not marked for CC:stable, so missing from the stable trees.
> Due to the missing dependent changes, DFS users faced issues with pre-5.11 kernels, and this patch was reverted in the stable trees.

So, you need that a738c93fb1c1 ("cifs: Set CIFS_MOUNT_USE_PREFIX_PATH
flag on setting cifs_sb->prepath.") merged to where exactly?

> 2. Due to a major change that went into the 5.11 kernel (the new mount API support), the code differs significantly, and the missing patch cannot be applied to pre-5.11 trees.
> Hence, Paulo submitted the attached patch (cifs: fix prefix path in dfs mounts), which fixes this for pre-5.11 kernels.

Can you submit this in a proper format (i.e. not dos line ends, and good
changelog and most importantly, YOUR signed off by on it saying that the
patch came through you?

Make this a 2 patch series please, and be specific as to what tree(s)
this needs to be backported to, and I will be glad to review it.

thnaks,

greg k-h

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

* RE: [PATCH 4.19 041/247] ACPICA: Fix exception code class checks
  2021-03-01 16:11 ` [PATCH 4.19 041/247] ACPICA: Fix exception code class checks Greg Kroah-Hartman
@ 2022-03-02 15:52   ` Moore, Robert
  0 siblings, 0 replies; 280+ messages in thread
From: Moore, Robert @ 2022-03-02 15:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: stable, Maximilian Luz, Kaneda, Erik, Wysocki, Rafael J, Sasha Levin

I have the feeling that this was already fixed in a previous commit, but I could be wrong.

-----Original Message-----
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 
Sent: Monday, March 01, 2021 8:11 AM
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; stable@vger.kernel.org; Maximilian Luz <luzmaximilian@gmail.com>; Moore, Robert <robert.moore@intel.com>; Kaneda, Erik <erik.kaneda@intel.com>; Wysocki, Rafael J <rafael.j.wysocki@intel.com>; Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.19 041/247] ACPICA: Fix exception code class checks

From: Maximilian Luz <luzmaximilian@gmail.com>

[ Upstream commit 3dfaea3811f8b6a89a347e8da9ab862cdf3e30fe ]

ACPICA commit 1a3a549286ea9db07d7ec700e7a70dd8bcc4354e

The macros to classify different AML exception codes are broken. For instance,

  ACPI_ENV_EXCEPTION(Status)

will always evaluate to zero due to

  #define AE_CODE_ENVIRONMENTAL      0x0000
  #define ACPI_ENV_EXCEPTION(Status) (Status & AE_CODE_ENVIRONMENTAL)

Similarly, ACPI_AML_EXCEPTION(Status) will evaluate to a non-zero value for error codes of type AE_CODE_PROGRAMMER, AE_CODE_ACPI_TABLES, as well as AE_CODE_AML, and not just AE_CODE_AML as the name suggests.

This commit fixes those checks.

Fixes: d46b6537f0ce ("ACPICA: AML Parser: ignore all exceptions resulting from incorrect AML during table load")
Link: https://github.com/acpica/acpica/commit/1a3a5492
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/acpi/acexcep.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index 856c56ef01431..878b8e26c6c50 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -59,11 +59,11 @@ struct acpi_exception_info {
 
 #define AE_OK                           (acpi_status) 0x0000
 
-#define ACPI_ENV_EXCEPTION(status)      (status & AE_CODE_ENVIRONMENTAL)
-#define ACPI_AML_EXCEPTION(status)      (status & AE_CODE_AML)
-#define ACPI_PROG_EXCEPTION(status)     (status & AE_CODE_PROGRAMMER)
-#define ACPI_TABLE_EXCEPTION(status)    (status & AE_CODE_ACPI_TABLES)
-#define ACPI_CNTL_EXCEPTION(status)     (status & AE_CODE_CONTROL)
+#define ACPI_ENV_EXCEPTION(status)      (((status) & AE_CODE_MASK) == AE_CODE_ENVIRONMENTAL)
+#define ACPI_AML_EXCEPTION(status)      (((status) & AE_CODE_MASK) == AE_CODE_AML)
+#define ACPI_PROG_EXCEPTION(status)     (((status) & AE_CODE_MASK) == AE_CODE_PROGRAMMER)
+#define ACPI_TABLE_EXCEPTION(status)    (((status) & AE_CODE_MASK) == AE_CODE_ACPI_TABLES)
+#define ACPI_CNTL_EXCEPTION(status)     (((status) & AE_CODE_MASK) == AE_CODE_CONTROL)
 
 /*
  * Environmental exceptions
--
2.27.0




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

end of thread, other threads:[~2022-03-02 15:53 UTC | newest]

Thread overview: 280+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-01 16:10 [PATCH 4.19 000/247] 4.19.178-rc1 review Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 001/247] HID: make arrays usage and value to be the same Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 002/247] USB: quirks: sort quirk entries Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 003/247] usb: quirks: add quirk to start video capture on ELMO L-12F document camera reliable Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 004/247] ntfs: check for valid standard information attribute Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 005/247] arm64: tegra: Add power-domain for Tegra210 HDA Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 006/247] scripts: use pkg-config to locate libcrypto Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 007/247] scripts: set proper OpenSSL include dir also for sign-file Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 008/247] block: add helper for checking if queue is registered Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 009/247] block: split .sysfs_lock into two locks Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 010/247] block: fix race between switching elevator and removing queues Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 011/247] block: dont release queues sysfs lock during switching elevator Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 012/247] NET: usb: qmi_wwan: Adding support for Cinterion MV31 Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 013/247] cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath Greg Kroah-Hartman
2021-04-06 11:38   ` Salvatore Bonaccorso
2021-04-06 13:41     ` Greg Kroah-Hartman
2021-04-06 14:00       ` [EXTERNAL] " Shyam Prasad
2021-04-06 15:01         ` Salvatore Bonaccorso
2021-04-08 11:41           ` Salvatore Bonaccorso
2021-04-12  8:01             ` Greg Kroah-Hartman
2021-04-18 12:41               ` Salvatore Bonaccorso
2021-04-19  5:48                 ` Shyam Prasad
2021-04-19 13:22                   ` Salvatore Bonaccorso
2021-04-19 13:43                     ` Shyam Prasad
2021-04-19 14:16                     ` Paulo Alcantara
2021-04-19 17:09                   ` Salvatore Bonaccorso
2021-04-22 15:36                     ` Shyam Prasad
2021-04-23  7:42                       ` Greg Kroah-Hartman
2021-05-08 13:22                         ` Salvatore Bonaccorso
2021-05-09 10:16                           ` Shyam Prasad
2021-05-10  7:46                             ` Greg Kroah-Hartman
2021-04-21  7:09                   ` Santiago Garcia Mantinan
2021-04-19 14:15                 ` Paulo Alcantara
2021-03-01 16:10 ` [PATCH 4.19 014/247] scripts/recordmcount.pl: support big endian for ARCH sh Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 015/247] jump_label/lockdep: Assert we hold the hotplug lock for _cpuslocked() operations Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 016/247] locking/static_key: Fix false positive warnings on concurrent dec/inc Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 017/247] vmlinux.lds.h: add DWARF v5 sections Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 018/247] kdb: Make memory allocations more robust Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 019/247] PCI: qcom: Use PHY_REFCLK_USE_PAD only for ipq8064 Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 020/247] bfq: Avoid false bfq queue merging Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 021/247] ALSA: usb-audio: Fix PCM buffer allocation in non-vmalloc mode Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 022/247] MIPS: vmlinux.lds.S: add missing PAGE_ALIGNED_DATA() section Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 023/247] random: fix the RNDRESEEDCRNG ioctl Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 024/247] ath10k: Fix error handling in case of CE pipe init failure Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 025/247] Bluetooth: btqcomsmd: Fix a resource leak in error handling paths in the probe function Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 026/247] Bluetooth: Fix initializing response id after clearing struct Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 027/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Artik 5 Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 028/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Monk Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 029/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Rinato Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 030/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Spring Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 031/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Arndale Octa Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 032/247] ARM: dts: exynos: correct PMIC interrupt trigger level on Odroid XU3 family Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 033/247] arm64: dts: exynos: correct PMIC interrupt trigger level on TM2 Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 034/247] arm64: dts: exynos: correct PMIC interrupt trigger level on Espresso Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 035/247] bpf: Avoid warning when re-casting __bpf_call_base into __bpf_call_base_args Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 036/247] arm64: dts: allwinner: A64: properly connect USB PHY to port 0 Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 037/247] arm64: dts: allwinner: Drop non-removable from SoPine/LTS SD card Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 038/247] arm64: dts: allwinner: A64: Limit MMC2 bus frequency to 150 MHz Greg Kroah-Hartman
2021-03-01 16:10 ` [PATCH 4.19 039/247] cpufreq: brcmstb-avs-cpufreq: Free resources in error path Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 040/247] cpufreq: brcmstb-avs-cpufreq: Fix resource leaks in ->remove() Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 041/247] ACPICA: Fix exception code class checks Greg Kroah-Hartman
2022-03-02 15:52   ` Moore, Robert
2021-03-01 16:11 ` [PATCH 4.19 042/247] usb: gadget: u_audio: Free requests only after callback Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 043/247] Bluetooth: drop HCI device reference before return Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 044/247] Bluetooth: Put HCI device if inquiry procedure interrupts Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 045/247] memory: ti-aemif: Drop child node when jumping out loop Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 046/247] ARM: dts: Configure missing thermal interrupt for 4430 Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 047/247] usb: dwc2: Do not update data length if it is 0 on inbound transfers Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 048/247] usb: dwc2: Abort transaction after errors with unknown reason Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 049/247] usb: dwc2: Make "trimming xfer length" a debug message Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 050/247] staging: rtl8723bs: wifi_regd.c: Fix incorrect number of regulatory rules Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 051/247] ARM: dts: armada388-helios4: assign pinctrl to LEDs Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 052/247] ARM: dts: armada388-helios4: assign pinctrl to each fan Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 053/247] arm64: dts: msm8916: Fix reserved and rfsa nodes unit address Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 054/247] ARM: s3c: fix fiq for clang IAS Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 055/247] soc: aspeed: snoop: Add clock control logic Greg Kroah-Hartman
2021-03-01 22:44   ` Joel Stanley
2021-03-02  0:09     ` Yoo, Jae Hyun
2021-03-04  8:12       ` Greg Kroah-Hartman
2021-03-04  9:52         ` Joel Stanley
2021-03-01 16:11 ` [PATCH 4.19 056/247] bpf_lru_list: Read double-checked variable once without lock Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 057/247] ath9k: fix data bus crash when setting nf_override via debugfs Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 058/247] ibmvnic: Set to CLOSED state even on error Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 059/247] bnxt_en: reverse order of TX disable and carrier off Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 060/247] xen/netback: fix spurious event detection for common event case Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 061/247] mac80211: fix potential overflow when multiplying to u32 integers Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 062/247] bpf: Fix bpf_fib_lookup helper MTU check for SKB ctx Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 063/247] tcp: fix SO_RCVLOWAT related hangs under mem pressure Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 064/247] cxgb4/chtls/cxgbit: Keeping the max ofld immediate data size same in cxgb4 and ulds Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 065/247] b43: N-PHY: Fix the update of coef for the PHY revision >= 3case Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 066/247] ibmvnic: add memory barrier to protect long term buffer Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 067/247] ibmvnic: skip send_request_unmap for timeout reset Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 068/247] net: amd-xgbe: Reset the PHY rx data path when mailbox command timeout Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 069/247] net: amd-xgbe: Fix NETDEV WATCHDOG transmit queue timeout warning Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 070/247] net: amd-xgbe: Reset link when the link never comes back Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 071/247] net: amd-xgbe: Fix network fluctuations when using 1G BELFUSE SFP Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 072/247] net: mvneta: Remove per-cpu queue mapping for Armada 3700 Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 073/247] fbdev: aty: SPARC64 requires FB_ATY_CT Greg Kroah-Hartman
2021-03-01 16:11   ` Greg Kroah-Hartman
2021-03-01 16:11   ` Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 074/247] drm/gma500: Fix error return code in psb_driver_load() Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 075/247] gma500: clean up error handling in init Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 076/247] crypto: sun4i-ss - fix kmap usage Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 077/247] drm/amdgpu: Fix macro name _AMDGPU_TRACE_H_ in preprocessor if condition Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 078/247] MIPS: c-r4k: Fix section mismatch for loongson2_sc_init Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 079/247] MIPS: lantiq: Explicitly compare LTQ_EBU_PCC_ISTAT against 0 Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 080/247] media: i2c: ov5670: Fix PIXEL_RATE minimum value Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 081/247] media: camss: missing error code in msm_video_register() Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 082/247] media: vsp1: Fix an error handling path in the probe function Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 083/247] media: em28xx: Fix use-after-free in em28xx_alloc_urbs Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 084/247] media: media/pci: Fix memleak in empress_init Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 085/247] media: tm6000: Fix memleak in tm6000_start_stream Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 086/247] ASoC: cs42l56: fix up error handling in probe Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 087/247] crypto: bcm - Rename struct device_private to bcm_device_private Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 088/247] drm/amd/display: Fix 10/12 bpc setup in DCE output bit depth reduction Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 089/247] media: lmedm04: Fix misuse of comma Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 090/247] media: qm1d1c0042: fix error return code in qm1d1c0042_init() Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 091/247] media: cx25821: Fix a bug when reallocating some dma memory Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 092/247] media: pxa_camera: declare variable when DEBUG is defined Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 093/247] media: uvcvideo: Accept invalid bFormatIndex and bFrameIndex values Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 094/247] crypto: talitos - Work around SEC6 ERRATA (AES-CTR mode data size error) Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 095/247] ata: ahci_brcm: Add back regulators management Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 096/247] ASoC: cpcap: fix microphone timeslot mask Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 097/247] f2fs: fix to avoid inconsistent quota data Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 098/247] drm/amdgpu: Prevent shift wrapping in amdgpu_read_mask() Greg Kroah-Hartman
2021-03-01 16:11 ` [PATCH 4.19 099/247] Drivers: hv: vmbus: Avoid use-after-free in vmbus_onoffer_rescind() Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 100/247] btrfs: clarify error returns values in __load_free_space_cache Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 101/247] hwrng: timeriomem - Fix cooldown period calculation Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 102/247] crypto: ecdh_helper - Ensure len >= secret.len in decode_key() Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 103/247] ima: Free IMA measurement buffer on error Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 104/247] ima: Free IMA measurement buffer after kexec syscall Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 105/247] fs/jfs: fix potential integer overflow on shift of a int Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 106/247] jffs2: fix use after free in jffs2_sum_write_data() Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 107/247] capabilities: Dont allow writing ambiguous v3 file capabilities Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 108/247] clk: meson: clk-pll: fix initializing the old rate (fallback) for a PLL Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 109/247] quota: Fix memory leak when handling corrupted quota file Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 110/247] spi: cadence-quadspi: Abort read if dummy cycles required are too many Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 111/247] clk: sunxi-ng: h6: Fix CEC clock Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 112/247] HID: core: detect and skip invalid inputs to snto32() Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 113/247] dmaengine: fsldma: Fix a resource leak in the remove function Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 114/247] dmaengine: fsldma: Fix a resource leak in an error handling path of the probe function Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 115/247] dmaengine: owl-dma: Fix a resource leak in the remove function Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 116/247] dmaengine: hsu: disable spurious interrupt Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 117/247] mfd: bd9571mwv: Use devm_mfd_add_devices() Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 118/247] fdt: Properly handle "no-map" field in the memory region Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 119/247] of/fdt: Make sure no-map does not remove already reserved regions Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 120/247] power: reset: at91-sama5d2_shdwc: fix wkupdbc mask Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 121/247] rtc: s5m: select REGMAP_I2C Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 122/247] clocksource/drivers/mxs_timer: Add missing semicolon when DEBUG is defined Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 123/247] RDMA/mlx5: Use the correct obj_id upon DEVX TIR creation Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 124/247] clk: sunxi-ng: h6: Fix clock divider range on some clocks Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 125/247] regulator: axp20x: Fix reference cout leak Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 126/247] certs: Fix blacklist flag type confusion Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 127/247] spi: atmel: Put allocated master before return Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 128/247] regulator: s5m8767: Drop regulators OF node reference Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 129/247] isofs: release buffer head before return Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 130/247] auxdisplay: ht16k33: Fix refresh rate handling Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 131/247] IB/umad: Return EIO in case of when device disassociated Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 132/247] IB/umad: Return EPOLLERR " Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 133/247] KVM: PPC: Make the VMX instruction emulation routines static Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 134/247] powerpc/47x: Disable 256k page size Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 135/247] mmc: usdhi6rol0: Fix a resource leak in the error handling path of the probe Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 136/247] mmc: renesas_sdhi_internal_dmac: Fix DMA buffer alignment from 8 to 128-bytes Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 137/247] ARM: 9046/1: decompressor: Do not clear SCTLR.nTLSMD for ARMv7+ cores Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 138/247] amba: Fix resource leak for drivers without .remove Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 139/247] tracepoint: Do not fail unregistering a probe due to memory failure Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 140/247] perf tools: Fix DSO filtering when not finding a map for a sampled address Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 141/247] RDMA/rxe: Fix coding error in rxe_recv.c Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 142/247] RDMA/rxe: Correct skb on loopback path Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 143/247] spi: stm32: properly handle 0 byte transfer Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 144/247] mfd: wm831x-auxadc: Prevent use after free in wm831x_auxadc_read_irq() Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 145/247] powerpc/pseries/dlpar: handle ibm, configure-connector delay status Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 146/247] powerpc/8xx: Fix software emulation interrupt Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 147/247] clk: qcom: gcc-msm8998: Fix Alpha PLL type for all GPLLs Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 148/247] spi: pxa2xx: Fix the controller numbering for Wildcat Point Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 149/247] Input: sur40 - fix an error code in sur40_probe() Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 150/247] perf intel-pt: Fix missing CYC processing in PSB Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 151/247] perf test: Fix unaligned access in sample parsing test Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 152/247] Input: elo - fix an error code in elo_connect() Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 153/247] sparc64: only select COMPAT_BINFMT_ELF if BINFMT_ELF is set Greg Kroah-Hartman
2021-03-01 16:12   ` Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 154/247] misc: eeprom_93xx46: Fix module alias to enable module autoprobe Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 155/247] misc: eeprom_93xx46: Add module alias to avoid breaking support for non device tree users Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 156/247] pwm: rockchip: rockchip_pwm_probe(): Remove superfluous clk_unprepare() Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 157/247] VMCI: Use set_page_dirty_lock() when unregistering guest memory Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 158/247] PCI: Align checking of syscall user config accessors Greg Kroah-Hartman
2021-03-01 16:12 ` [PATCH 4.19 159/247] drm/msm/dsi: Correct io_start for MSM8994 (20nm PHY) Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 160/247] ext4: fix potential htree index checksum corruption Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 161/247] regmap: sdw: use _no_pm functions in regmap_read/write Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 162/247] i40e: Fix flow for IPv6 next header (extension header) Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 163/247] i40e: Add zero-initialization of AQ command structures Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 164/247] i40e: Fix overwriting flow control settings during driver loading Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 165/247] i40e: Fix VFs not created Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 166/247] Take mmap lock in cacheflush syscall Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 167/247] i40e: Fix add TC filter for IPv6 Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 168/247] net/mlx4_core: Add missed mlx4_free_cmd_mailbox() Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 169/247] vxlan: move debug check after netdev unregister Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 170/247] ocfs2: fix a use after free on error Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 171/247] mm/memory.c: fix potential pte_unmap_unlock pte error Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 172/247] mm/hugetlb: fix potential double free in hugetlb_register_node() error path Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 173/247] r8169: fix jumbo packet handling on RTL8168e Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 174/247] arm64: Add missing ISB after invalidating TLB in __primary_switch Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 175/247] i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 176/247] mm/rmap: fix potential pte_unmap on an not mapped pte Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 177/247] scsi: bnx2fc: Fix Kconfig warning & CNIC build errors Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 178/247] blk-settings: align max_sectors on "logical_block_size" boundary Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 179/247] ACPI: property: Fix fwnode string properties matching Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 180/247] ACPI: configfs: add missing check after configfs_register_default_group() Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 181/247] HID: wacom: Ignore attempts to overwrite the touch_max value from HID Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 182/247] Input: raydium_ts_i2c - do not send zero length Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 183/247] Input: xpad - add support for PowerA Enhanced Wired Controller for Xbox Series X|S Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 184/247] Input: joydev - prevent potential read overflow in ioctl Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 185/247] Input: i8042 - add ASUS Zenbook Flip to noselftest list Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 186/247] USB: serial: option: update interface mapping for ZTE P685M Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 187/247] usb: musb: Fix runtime PM race in musb_queue_resume_work Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 188/247] usb: dwc3: gadget: Fix setting of DEPCFG.bInterval_m1 Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 189/247] usb: dwc3: gadget: Fix dep->interval for fullspeed interrupt Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 190/247] USB: serial: ftdi_sio: fix FTX sub-integer prescaler Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 191/247] USB: serial: mos7840: fix error code in mos7840_write() Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 192/247] USB: serial: mos7720: fix error code in mos7720_write() Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 193/247] ALSA: hda/realtek: modify EAPD in the ALC886 Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 194/247] tpm_tis: Fix check_locality for correct locality acquisition Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 195/247] tpm_tis: Clean up locality release Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 196/247] KEYS: trusted: Fix migratable=1 failing Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 197/247] btrfs: abort the transaction if we fail to inc ref in btrfs_copy_root Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 198/247] btrfs: fix reloc root leak with 0 ref reloc roots on recovery Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 199/247] btrfs: fix extent buffer leak on failure to copy root Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 200/247] crypto: arm64/sha - add missing module aliases Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 201/247] crypto: sun4i-ss - checking sg length is not sufficient Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 202/247] crypto: sun4i-ss - IV register does not work on A10 and A13 Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 203/247] crypto: sun4i-ss - handle BigEndian for cipher Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 204/247] seccomp: Add missing return in non-void function Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 205/247] misc: rtsx: init of rts522a add OCP power off when no card is present Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 206/247] drivers/misc/vmw_vmci: restrict too big queue size in qp_host_alloc_queue Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 207/247] pstore: Fix typo in compression option name Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 208/247] dts64: mt7622: fix slow sd card access Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 209/247] staging/mt7621-dma: mtk-hsdma.c->hsdma-mt7621.c Greg Kroah-Hartman
2021-03-01 17:41   ` Ilya Lipnitskiy
2021-03-04  8:14     ` Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 210/247] staging: gdm724x: Fix DMA from stack Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 211/247] staging: rtl8188eu: Add Edimax EW-7811UN V2 to device table Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 212/247] media: ipu3-cio2: Fix mbus_code processing in cio2_subdev_set_fmt() Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 213/247] x86/reboot: Force all cpus to exit VMX root if VMX is supported Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 214/247] floppy: reintroduce O_NDELAY fix Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 215/247] arm64: uprobe: Return EOPNOTSUPP for AARCH32 instruction probing Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 216/247] watchdog: mei_wdt: request stop on unregister Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 217/247] mtd: spi-nor: hisi-sfc: Put child node np on error path Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 218/247] fs/affs: release old buffer head " Greg Kroah-Hartman
2021-03-01 16:13 ` [PATCH 4.19 219/247] seq_file: document how per-entry resources are managed Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 220/247] x86: fix seq_file iteration for pat/memtype.c Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 221/247] hugetlb: fix copy_huge_page_from_user contig page struct assumption Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 222/247] libnvdimm/dimm: Avoid race between probe and available_slots_show() Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 223/247] arm64: Extend workaround for erratum 1024718 to all versions of Cortex-A55 Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 224/247] module: Ignore _GLOBAL_OFFSET_TABLE_ when warning for undefined symbols Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 225/247] mmc: sdhci-esdhc-imx: fix kernel panic when remove module Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 226/247] gpio: pcf857x: Fix missing first interrupt Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 227/247] printk: fix deadlock when kernel panic Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 228/247] cpufreq: intel_pstate: Get per-CPU max freq via MSR_HWP_CAPABILITIES if available Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 229/247] f2fs: fix out-of-repair __setattr_copy() Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 230/247] sparc32: fix a user-triggerable oops in clear_user() Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 231/247] gfs2: Dont skip dlm unlock if glock has an lvb Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 232/247] dm: fix deadlock when swapping to encrypted device Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 233/247] dm era: Recover committed writeset after crash Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 234/247] dm era: Verify the data block size hasnt changed Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 235/247] dm era: Fix bitset memory leaks Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 236/247] dm era: Use correct value size in equality function of writeset tree Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 237/247] dm era: Reinitialize bitset cache before digesting a new writeset Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 238/247] dm era: only resize metadata in preresume Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 239/247] icmp: introduce helper for natd source address in network device context Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 240/247] gtp: use icmp_ndo_send helper Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 241/247] sunvnet: " Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 242/247] xfrm: interface: " Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 243/247] ipv6: icmp6: avoid indirect call for icmpv6_send() Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 244/247] ipv6: silence compilation warning for non-IPV6 builds Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 245/247] net: icmp: pass zeroed opts from icmp{,v6}_ndo_send before sending Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 246/247] dm era: Update in-core bitset after committing the metadata Greg Kroah-Hartman
2021-03-01 16:14 ` [PATCH 4.19 247/247] net: qrtr: Fix memory leak in qrtr_tun_open Greg Kroah-Hartman
2021-03-01 21:45 ` [PATCH 4.19 000/247] 4.19.178-rc1 review Shuah Khan
2021-03-02  2:35 ` Hanjun Guo
2021-03-03  7:59 ` Hanjun Guo

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.