óÐÉÓÏË ÉÚÍÅÎÅÎÉÊ × Linux 5.15.81

 
9p/fd: fix issue of list_del corruption in p9_fd_cancel() [+ + +]
Author: Zhengchao Shao <shaozhengchao@huawei.com>
Date:   Thu Nov 10 20:26:06 2022 +0800

    9p/fd: fix issue of list_del corruption in p9_fd_cancel()
    
    [ Upstream commit 11c10956515b8ec44cf4f2a7b9d8bf8b9dc05ec4 ]
    
    Syz reported the following issue:
    kernel BUG at lib/list_debug.c:53!
    invalid opcode: 0000 [#1] PREEMPT SMP KASAN
    RIP: 0010:__list_del_entry_valid.cold+0x5c/0x72
    Call Trace:
    <TASK>
    p9_fd_cancel+0xb1/0x270
    p9_client_rpc+0x8ea/0xba0
    p9_client_create+0x9c0/0xed0
    v9fs_session_init+0x1e0/0x1620
    v9fs_mount+0xba/0xb80
    legacy_get_tree+0x103/0x200
    vfs_get_tree+0x89/0x2d0
    path_mount+0x4c0/0x1ac0
    __x64_sys_mount+0x33b/0x430
    do_syscall_64+0x35/0x80
    entry_SYSCALL_64_after_hwframe+0x46/0xb0
    </TASK>
    
    The process is as follows:
    Thread A:                       Thread B:
    p9_poll_workfn()                p9_client_create()
    ...                                 ...
        p9_conn_cancel()                p9_fd_cancel()
            list_del()                      ...
            ...                             list_del()  //list_del
                                                          corruption
    There is no lock protection when deleting list in p9_conn_cancel(). After
    deleting list in Thread A, thread B will delete the same list again. It
    will cause issue of list_del corruption.
    
    Setting req->status to REQ_STATUS_ERROR under lock prevents other
    cleanup paths from trying to manipulate req_list.
    The other thread can safely check req->status because it still holds a
    reference to req at this point.
    
    Link: https://lkml.kernel.org/r/20221110122606.383352-1-shaozhengchao@huawei.com
    Fixes: 52f1c45dde91 ("9p: trans_fd/p9_conn_cancel: drop client lock earlier")
    Reported-by: syzbot+9b69b8d10ab4a7d88056@syzkaller.appspotmail.com
    Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
    [Dominique: add description of the fix in commit message]
    Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
af_key: Fix send_acquire race with pfkey_register [+ + +]
Author: Herbert Xu <herbert@gondor.apana.org.au>
Date:   Tue Oct 25 14:06:48 2022 +0800

    af_key: Fix send_acquire race with pfkey_register
    
    [ Upstream commit 7f57f8165cb6d2c206e2b9ada53b9e2d6d8af42f ]
    
    The function pfkey_send_acquire may race with pfkey_register
    (which could even be in a different name space).  This may result
    in a buffer overrun.
    
    Allocating the maximum amount of memory that could be used prevents
    this.
    
    Reported-by: syzbot+1e9af9185d8850e2c2fa@syzkaller.appspotmail.com
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ALSA: usb-audio: add quirk to fix Hamedal C20 disconnect issue [+ + +]
Author: Ai Chao <aichao@kylinos.cn>
Date:   Thu Nov 10 14:34:52 2022 +0800

    ALSA: usb-audio: add quirk to fix Hamedal C20 disconnect issue
    
    [ Upstream commit bf990c10231937c0f51e5da5558e08cf5adc6a78 ]
    
    For Hamedal C20, the current rate is different from the runtime rate,
    snd_usb_endpoint stop and close endpoint to resetting rate.
    if snd_usb_endpoint close the endpoint, sometimes usb will
    disconnect the device.
    
    Signed-off-by: Ai Chao <aichao@kylinos.cn>
    Link: https://lore.kernel.org/r/20221110063452.295110-1-aichao@kylinos.cn
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
arcnet: fix potential memory leak in com20020_probe() [+ + +]
Author: Wang Hai <wanghai38@huawei.com>
Date:   Sun Nov 20 14:24:38 2022 +0800

    arcnet: fix potential memory leak in com20020_probe()
    
    [ Upstream commit 1c40cde6b5171d9c8dfc69be00464fd1c75e210b ]
    
    In com20020_probe(), if com20020_config() fails, dev and info
    will not be freed, which will lead to a memory leak.
    
    This patch adds freeing dev and info after com20020_config()
    fails to fix this bug.
    
    Compile tested only.
    
    Fixes: 15b99ac17295 ("[PATCH] pcmcia: add return value to _config() functions")
    Signed-off-by: Wang Hai <wanghai38@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
arm64/syscall: Include asm/ptrace.h in syscall_wrapper header. [+ + +]
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Mon Oct 31 14:57:28 2022 -0700

    arm64/syscall: Include asm/ptrace.h in syscall_wrapper header.
    
    [ Upstream commit acfc35cfcee5df419391671ef1a631f43feee4e3 ]
    
    Add the same change for ARM64 as done in the commit 9440c4294160
    ("x86/syscall: Include asm/ptrace.h in syscall_wrapper header") to
    make sure all syscalls see 'struct pt_regs' definition and resulted
    BTF for '__arm64_sys_*(struct pt_regs *regs)' functions point to
    actual struct.
    
    Without this patch, the BPF verifier refuses to load a tracing prog
    which accesses pt_regs.
    
      bpf(BPF_PROG_LOAD, {prog_type=0x1a, ...}, 128) = -1 EACCES
    
    With this patch, we can see the correct error, which saves us time
    in debugging the prog.
    
      bpf(BPF_PROG_LOAD, {prog_type=0x1a, ...}, 128) = 4
      bpf(BPF_RAW_TRACEPOINT_OPEN, {raw_tracepoint={name=NULL, prog_fd=4}}, 128) = -1 ENOTSUPP
    
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Acked-by: Andrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/r/20221031215728.50389-1-kuniyu@amazon.com
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
arm64: dts: rockchip: lower rk3399-puma-haikou SD controller clock frequency [+ + +]
Author: Jakob Unterwurzacher <jakob.unterwurzacher@theobroma-systems.com>
Date:   Wed Oct 19 16:27:27 2022 +0200

    arm64: dts: rockchip: lower rk3399-puma-haikou SD controller clock frequency
    
    commit 91e8b74fe6381e083f8aa55217bb0562785ab398 upstream.
    
    CRC errors (code -84 EILSEQ) have been observed for some SanDisk
    Ultra A1 cards when running at 50MHz.
    
    Waveform analysis suggest that the level shifters that are used on the
    RK3399-Q7 module for voltage translation between 3.0 and 3.3V don't
    handle clock rates at or above 48MHz properly. Back off to 40MHz for
    some safety margin.
    
    Cc: stable@vger.kernel.org
    Fixes: 60fd9f72ce8a ("arm64: dts: rockchip: add Haikou baseboard with RK3399-Q7 SoM")
    Signed-off-by: Jakob Unterwurzacher <jakob.unterwurzacher@theobroma-systems.com>
    Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
    Link: https://lore.kernel.org/r/20221019-upstream-puma-sd-40mhz-v1-0-754a76421518@theobroma-systems.com
    Signed-off-by: Heiko Stuebner <heiko@sntech.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ARM: dts: am335x-pcm-953: Define fixed regulators in root node [+ + +]
Author: Dominik Haller <d.haller@phytec.de>
Date:   Tue Oct 11 16:31:15 2022 +0200

    ARM: dts: am335x-pcm-953: Define fixed regulators in root node
    
    [ Upstream commit 8950f345a67d8046d2472dd6ea81fa18ef5b4844 ]
    
    Remove the regulators node and define fixed regulators in the root node.
    Prevents the sdhci-omap driver from waiting in probe deferral forever
    because of the missing vmmc-supply and keeps am335x-pcm-953 consistent with
    the other Phytec AM335 boards.
    
    Fixes: bb07a829ec38 ("ARM: dts: Add support for phyCORE-AM335x PCM-953 carrier board")
    Signed-off-by: Dominik Haller <d.haller@phytec.de>
    Message-Id: <20221011143115.248003-1-d.haller@phytec.de>
    Signed-off-by: Tony Lindgren <tony@atomide.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ARM: dts: at91: sam9g20ek: enable udc vbus gpio pinctrl [+ + +]
Author: Michael Grzeschik <m.grzeschik@pengutronix.de>
Date:   Mon Nov 14 19:59:23 2022 +0100

    ARM: dts: at91: sam9g20ek: enable udc vbus gpio pinctrl
    
    [ Upstream commit 40a2226e8bfacb79dd154dea68febeead9d847e9 ]
    
    We set the PIOC to GPIO mode. This way the pin becomes an
    input signal will be usable by the controller. Without
    this change the udc on the 9g20ek does not work.
    
    Cc: nicolas.ferre@microchip.com
    Cc: ludovic.desroches@microchip.com
    Cc: alexandre.belloni@bootlin.com
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: kernel@pengutronix.de
    Fixes: 5cb4e73575e3 ("ARM: at91: add at91sam9g20ek boards dt support")
    Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
    Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
    Link: https://lore.kernel.org/r/20221114185923.1023249-3-m.grzeschik@pengutronix.de
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ARM: dts: imx6q-prti6q: Fix ref/tcxo-clock-frequency properties [+ + +]
Author: Fabio Estevam <festevam@denx.de>
Date:   Fri Nov 18 10:41:02 2022 -0300

    ARM: dts: imx6q-prti6q: Fix ref/tcxo-clock-frequency properties
    
    [ Upstream commit e68be7b39f21d8a9291a5a3019787cd3ca999dd7 ]
    
    make dtbs_check gives the following errors:
    
    ref-clock-frequency: size (9) error for type uint32
    tcxo-clock-frequency: size (9) error for type uint32
    
    Fix it by passing the frequencies inside < > as documented in
    Documentation/devicetree/bindings/net/wireless/ti,wlcore.yaml.
    
    Signed-off-by: Fabio Estevam <festevam@denx.de>
    Fixes: 0d446a505592 ("ARM: dts: add Protonic PRTI6Q board")
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ARM: mxs: fix memory leak in mxs_machine_init() [+ + +]
Author: Zheng Yongjun <zhengyongjun3@huawei.com>
Date:   Thu Nov 17 06:20:11 2022 +0000

    ARM: mxs: fix memory leak in mxs_machine_init()
    
    [ Upstream commit f31e3c204d1844b8680a442a48868af5ac3d5481 ]
    
    If of_property_read_string() failed, 'soc_dev_attr' should be
    freed before return. Otherwise there is a memory leak.
    
    Fixes: 2046338dcbc6 ("ARM: mxs: Use soc bus infrastructure")
    Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
    Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ASoC: fsl_asrc fsl_esai fsl_sai: allow CONFIG_PM=N [+ + +]
Author: Maarten Zanders <maarten.zanders@mind.be>
Date:   Fri Oct 28 16:11:28 2022 +0200

    ASoC: fsl_asrc fsl_esai fsl_sai: allow CONFIG_PM=N
    
    [ Upstream commit 6a564338a23cefcfc29c4a535b98402d13efdda6 ]
    
    When CONFIG_PM=N, pm_runtime_put_sync() returns -ENOSYS
    which breaks the probe function of these drivers.
    
    Other users of pm_runtime_put_sync() typically don't check
    the return value. In order to keep the program flow as
    intended, check for -ENOSYS.
    
    This commit is similar to commit 0434d3f (omap-mailbox.c).
    
    Fixes: cab04ab5900f ("ASoC: fsl_asrc: Don't use devm_regmap_init_mmio_clk")
    Fixes: 203773e39347 ("ASoC: fsl_esai: Don't use devm_regmap_init_mmio_clk")
    Fixes: 2277e7e36b4b ("ASoC: fsl_sai: Don't use devm_regmap_init_mmio_clk")
    Signed-off-by: Maarten Zanders <maarten.zanders@mind.be>
    Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
    Link: https://lore.kernel.org/r/20221028141129.100702-1-maarten.zanders@mind.be
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: fsl_sai: use local device pointer [+ + +]
Author: Marco Felsch <m.felsch@pengutronix.de>
Date:   Wed Jun 1 11:23:40 2022 +0200

    ASoC: fsl_sai: use local device pointer
    
    [ Upstream commit f53f50ee21d46094a8c48970e95e38a4deaa128e ]
    
    Use a local variable to dereference the device pointer once and use the
    local variable in further calls. No functional changes.
    
    Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
    Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
    Link: https://lore.kernel.org/r/20220601092342.3328644-1-m.felsch@pengutronix.de
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Stable-dep-of: 6a564338a23c ("ASoC: fsl_asrc fsl_esai fsl_sai: allow CONFIG_PM=N")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
ASoC: hdac_hda: fix hda pcm buffer overflow issue [+ + +]
Author: Junxiao Chang <junxiao.chang@intel.com>
Date:   Thu Nov 10 07:40:23 2022 +0800

    ASoC: hdac_hda: fix hda pcm buffer overflow issue
    
    [ Upstream commit 37882100cd0629d830db430a8cee0b724fe1fea3 ]
    
    When KASAN is enabled, below log might be dumped with Intel EHL hardware:
    [   48.583597] ==================================================================
    [   48.585921] BUG: KASAN: slab-out-of-bounds in hdac_hda_dai_hw_params+0x20a/0x22b [snd_soc_hdac_hda]
    [   48.587995] Write of size 4 at addr ffff888103489708 by task pulseaudio/759
    
    [   48.589237] CPU: 2 PID: 759 Comm: pulseaudio Tainted: G     U      E     5.15.71-intel-ese-standard-lts #9
    [   48.591272] Hardware name: Intel Corporation Elkhart Lake Embedded Platform/ElkhartLake LPDDR4x T3 CRB, BIOS EHLSFWI1.R00.4251.A01.2206130432 06/13/2022
    [   48.593010] Call Trace:
    [   48.593648]  <TASK>
    [   48.593852]  dump_stack_lvl+0x34/0x48
    [   48.594404]  print_address_description.constprop.0+0x1f/0x140
    [   48.595174]  ? hdac_hda_dai_hw_params+0x20a/0x22b [snd_soc_hdac_hda]
    [   48.595868]  ? hdac_hda_dai_hw_params+0x20a/0x22b [snd_soc_hdac_hda]
    [   48.596519]  kasan_report.cold+0x7f/0x11b
    [   48.597003]  ? hdac_hda_dai_hw_params+0x20a/0x22b [snd_soc_hdac_hda]
    [   48.597885]  hdac_hda_dai_hw_params+0x20a/0x22b [snd_soc_hdac_hda]
    
    HDAC_LAST_DAI_ID is last index id, pcm buffer array size should
    be +1 to avoid out of bound access.
    
    Fixes: 608b8c36c371 ("ASoC: hdac_hda: add support for HDMI/DP as a HDA codec")
    Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
    Signed-off-by: Furong Zhou <furong.zhou@intel.com>
    Link: https://lore.kernel.org/r/20221109234023.3111035-1-junxiao.chang@intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: Intel: bytcht_es8316: Add quirk for the Nanote UMPC-01 [+ + +]
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Tue Oct 25 16:09:42 2022 +0200

    ASoC: Intel: bytcht_es8316: Add quirk for the Nanote UMPC-01
    
    [ Upstream commit 8bb0ac0e6f64ebdf15d963c26b028de391c9bcf9 ]
    
    The Nanote UMPC-01 mini laptop has stereo speakers, while the default
    bytcht_es8316 settings assume a mono speaker setup. Add a quirk for this.
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://lore.kernel.org/r/20221025140942.509066-1-hdegoede@redhat.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: max98373: Add checks for devm_kcalloc [+ + +]
Author: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Date:   Wed Nov 16 16:25:08 2022 +0800

    ASoC: max98373: Add checks for devm_kcalloc
    
    [ Upstream commit 60591bbf6d5eb44f275eb733943b7757325c1b60 ]
    
    As the devm_kcalloc may return NULL pointer,
    it should be better to check the return value
    in order to avoid NULL poineter dereference.
    
    Fixes: 349dd23931d1 ("ASoC: max98373: don't access volatile registers in bias level off")
    Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
    Link: https://lore.kernel.org/r/20221116082508.17418-1-jiasheng@iscas.ac.cn
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: sgtl5000: Reset the CHIP_CLK_CTRL reg on remove [+ + +]
Author: Detlev Casanova <detlev.casanova@collabora.com>
Date:   Thu Nov 10 14:06:12 2022 -0500

    ASoC: sgtl5000: Reset the CHIP_CLK_CTRL reg on remove
    
    [ Upstream commit 0bb8e9b36b5b7f2e77892981ff6c27ee831d8026 ]
    
    Since commit bf2aebccddef ("ASoC: sgtl5000: Fix noise on shutdown/remove"),
    the device power control registers are reset when the driver is
    removed/shutdown.
    
    This is an issue when the device is configured to use the PLL clock. The
    device will stop responding if it is still configured to use the PLL
    clock but the PLL clock is powered down.
    
    When rebooting linux, the probe function will show:
    sgtl5000 0-000a: Error reading chip id -11
    
    Make sure that the CHIP_CLK_CTRL is reset to its default value before
    powering down the device.
    
    Fixes: bf2aebccddef ("ASoC: sgtl5000: Fix noise on shutdown/remove")
    Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
    Reviewed-by: Fabio Estevam <festevam@gmail.com>
    Link: https://lore.kernel.org/r/20221110190612.1341469-1-detlev.casanova@collabora.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: soc-pcm: Don't zero TDM masks in __soc_pcm_open() [+ + +]
Author: Richard Fitzgerald <rf@opensource.cirrus.com>
Date:   Fri Nov 4 13:22:13 2022 +0000

    ASoC: soc-pcm: Don't zero TDM masks in __soc_pcm_open()
    
    [ Upstream commit 39bd801d6908900e9ab0cdc2655150f95ddd4f1a ]
    
    The DAI tx_mask and rx_mask are set by snd_soc_dai_set_tdm_slot()
    and used by later code that depends on the TDM settings. So
    __soc_pcm_open() should not be obliterating those mask values.
    
    The code in __soc_pcm_hw_params() uses these masks to calculate the
    active channels so that only the AIF_IN/AIF_OUT widgets for the
    active TDM slots are enabled. The zeroing of the masks in
    __soc_pcm_open() disables this functionality so all AIF widgets
    were enabled even for channels that are not assigned to a TDM slot.
    
    Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
    Fixes: 2e5894d73789 ("ASoC: pcm: Add support for DAI multicodec")
    Link: https://lore.kernel.org/r/20221104132213.121847-1-rf@opensource.cirrus.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: stm32: dfsdm: manage cb buffers cleanup [+ + +]
Author: Olivier Moysan <olivier.moysan@foss.st.com>
Date:   Wed Nov 9 18:08:49 2022 +0100

    ASoC: stm32: dfsdm: manage cb buffers cleanup
    
    [ Upstream commit 7d945b046be3d2605dbb1806e73095aadd7ae129 ]
    
    Ensure that resources allocated by iio_channel_get_all_cb()
    are released on driver unbind.
    
    Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
    Link: https://lore.kernel.org/r/20221109170849.273719-1-olivier.moysan@foss.st.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ata: libata-core: do not issue non-internal commands once EH is pending [+ + +]
Author: Niklas Cassel <niklas.cassel@wdc.com>
Date:   Wed Nov 9 00:15:34 2022 +0100

    ata: libata-core: do not issue non-internal commands once EH is pending
    
    [ Upstream commit e20e81a24a4d58744a29715aac2f795cd1651955 ]
    
    While the ATA specification states that a device should return command
    aborted for all commands queued after the device has entered error state,
    since ATA only keeps the sense data for the latest command (in non-NCQ
    case), we really don't want to send block layer commands to the device
    after it has entered error state. (Only ATA EH commands should be sent,
    to read the sense data etc.)
    
    Currently, scsi_queue_rq() will check if scsi_host_in_recovery()
    (state is SHOST_RECOVERY), and if so, it will _not_ issue a command via:
    scsi_dispatch_cmd() -> host->hostt->queuecommand() (ata_scsi_queuecmd())
    -> __ata_scsi_queuecmd() -> ata_scsi_translate() -> ata_qc_issue()
    
    Before commit e494f6a72839 ("[SCSI] improved eh timeout handler"),
    when receiving a TFES error IRQ, the call chain looked like this:
    ahci_error_intr() -> ata_port_abort() -> ata_do_link_abort() ->
    ata_qc_complete() -> ata_qc_schedule_eh() -> blk_abort_request() ->
    blk_rq_timed_out() -> q->rq_timed_out_fn() (scsi_times_out()) ->
    scsi_eh_scmd_add() -> scsi_host_set_state(shost, SHOST_RECOVERY)
    
    Which meant that as soon as an error IRQ was serviced, SHOST_RECOVERY
    would be set.
    
    However, after commit e494f6a72839 ("[SCSI] improved eh timeout handler"),
    scsi_times_out() will instead call scsi_abort_command() which will queue
    delayed work, and the worker function scmd_eh_abort_handler() will call
    scsi_eh_scmd_add(), which calls scsi_host_set_state(shost, SHOST_RECOVERY).
    
    So now, after the TFES error IRQ has been serviced, we need to wait for
    the SCSI workqueue to run its work before SHOST_RECOVERY gets set.
    
    It is worth noting that, even before commit e494f6a72839 ("[SCSI] improved
    eh timeout handler"), we could receive an error IRQ from the time when
    scsi_queue_rq() checks scsi_host_in_recovery(), to the time when
    ata_scsi_queuecmd() is actually called.
    
    In order to handle both the delayed setting of SHOST_RECOVERY and the
    window where we can receive an error IRQ, add a check against
    ATA_PFLAG_EH_PENDING (which gets set when servicing the error IRQ),
    inside ata_scsi_queuecmd() itself, while holding the ap->lock.
    (Since the ap->lock is held while servicing IRQs.)
    
    Fixes: e494f6a72839 ("[SCSI] improved eh timeout handler")
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Tested-by: John Garry <john.g.garry@oracle.com>
    Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ata: libata-scsi: simplify __ata_scsi_queuecmd() [+ + +]
Author: Wenchao Hao <haowenchao@huawei.com>
Date:   Wed Jan 5 19:13:54 2022 -0500

    ata: libata-scsi: simplify __ata_scsi_queuecmd()
    
    [ Upstream commit 84eac327af543f03172085d5ef9f98ea25a51191 ]
    
    This patch cleans up the code of __ata_scsi_queuecmd(). Since each
    branch of the "if" condition check that scmd->cmd_len is not zero, move
    this check out of the "if" to simplify the conditions being checked in
    the "else" branch.
    
    While at it, avoid the if-else-if-else structure using if-else if
    structure and remove the redundant rc local variable.
    
    This patch does not change the function logic.
    
    Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
    Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
    Stable-dep-of: e20e81a24a4d ("ata: libata-core: do not issue non-internal commands once EH is pending")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
audit: fix undefined behavior in bit shift for AUDIT_BIT [+ + +]
Author: Gaosheng Cui <cuigaosheng1@huawei.com>
Date:   Mon Oct 31 10:10:21 2022 +0800

    audit: fix undefined behavior in bit shift for AUDIT_BIT
    
    [ Upstream commit 986d93f55bdeab1cac858d1e47b41fac10b2d7f6 ]
    
    Shifting signed 32-bit value by 31 bits is undefined, so changing
    significant bit to unsigned. The UBSAN warning calltrace like below:
    
    UBSAN: shift-out-of-bounds in kernel/auditfilter.c:179:23
    left shift of 1 by 31 places cannot be represented in type 'int'
    Call Trace:
     <TASK>
     dump_stack_lvl+0x7d/0xa5
     dump_stack+0x15/0x1b
     ubsan_epilogue+0xe/0x4e
     __ubsan_handle_shift_out_of_bounds+0x1e7/0x20c
     audit_register_class+0x9d/0x137
     audit_classes_init+0x4d/0xb8
     do_one_initcall+0x76/0x430
     kernel_init_freeable+0x3b3/0x422
     kernel_init+0x24/0x1e0
     ret_from_fork+0x1f/0x30
     </TASK>
    
    Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
    [PM: remove bad 'Fixes' tag as issue predates git, added in v2.6.6-rc1]
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
binder: validate alloc->mm in ->mmap() handler [+ + +]
Author: Carlos Llamas <cmllamas@google.com>
Date:   Fri Nov 4 23:12:35 2022 +0000

    binder: validate alloc->mm in ->mmap() handler
    
    [ Upstream commit 3ce00bb7e91cf57d723905371507af57182c37ef ]
    
    Since commit 1da52815d5f1 ("binder: fix alloc->vma_vm_mm null-ptr
    dereference") binder caches a pointer to the current->mm during open().
    This fixes a null-ptr dereference reported by syzkaller. Unfortunately,
    it also opens the door for a process to update its mm after the open(),
    (e.g. via execve) making the cached alloc->mm pointer invalid.
    
    Things get worse when the process continues to mmap() a vma. From this
    point forward, binder will attempt to find this vma using an obsolete
    alloc->mm reference. Such as in binder_update_page_range(), where the
    wrong vma is obtained via vma_lookup(), yet binder proceeds to happily
    insert new pages into it.
    
    To avoid this issue fail the ->mmap() callback if we detect a mismatch
    between the vma->vm_mm and the original alloc->mm pointer. This prevents
    alloc->vm_addr from getting set, so that any subsequent vma_lookup()
    calls fail as expected.
    
    Fixes: 1da52815d5f1 ("binder: fix alloc->vma_vm_mm null-ptr dereference")
    Reported-by: Jann Horn <jannh@google.com>
    Cc: <stable@vger.kernel.org> # 5.15+
    Signed-off-by: Carlos Llamas <cmllamas@google.com>
    Acked-by: Todd Kjos <tkjos@google.com>
    Link: https://lore.kernel.org/r/20221104231235.348958-1-cmllamas@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
block, bfq: fix null pointer dereference in bfq_bio_bfqg() [+ + +]
Author: Yu Kuai <yukuai3@huawei.com>
Date:   Tue Nov 8 18:34:34 2022 +0800

    block, bfq: fix null pointer dereference in bfq_bio_bfqg()
    
    [ Upstream commit f02be9002c480cd3ec0fcf184ad27cf531bd6ece ]
    
    Out test found a following problem in kernel 5.10, and the same problem
    should exist in mainline:
    
    BUG: kernel NULL pointer dereference, address: 0000000000000094
    PGD 0 P4D 0
    Oops: 0000 [#1] SMP
    CPU: 7 PID: 155 Comm: kworker/7:1 Not tainted 5.10.0-01932-g19e0ace2ca1d-dirty 4
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_073836-b4
    Workqueue: kthrotld blk_throtl_dispatch_work_fn
    RIP: 0010:bfq_bio_bfqg+0x52/0xc0
    Code: 94 00 00 00 00 75 2e 48 8b 40 30 48 83 05 35 06 c8 0b 01 48 85 c0 74 3d 4b
    RSP: 0018:ffffc90001a1fba0 EFLAGS: 00010002
    RAX: ffff888100d60400 RBX: ffff8881132e7000 RCX: 0000000000000000
    RDX: 0000000000000017 RSI: ffff888103580a18 RDI: ffff888103580a18
    RBP: ffff8881132e7000 R08: 0000000000000000 R09: ffffc90001a1fe10
    R10: 0000000000000a20 R11: 0000000000034320 R12: 0000000000000000
    R13: ffff888103580a18 R14: ffff888114447000 R15: 0000000000000000
    FS:  0000000000000000(0000) GS:ffff88881fdc0000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000094 CR3: 0000000100cdb000 CR4: 00000000000006e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     bfq_bic_update_cgroup+0x3c/0x350
     ? ioc_create_icq+0x42/0x270
     bfq_init_rq+0xfd/0x1060
     bfq_insert_requests+0x20f/0x1cc0
     ? ioc_create_icq+0x122/0x270
     blk_mq_sched_insert_requests+0x86/0x1d0
     blk_mq_flush_plug_list+0x193/0x2a0
     blk_flush_plug_list+0x127/0x170
     blk_finish_plug+0x31/0x50
     blk_throtl_dispatch_work_fn+0x151/0x190
     process_one_work+0x27c/0x5f0
     worker_thread+0x28b/0x6b0
     ? rescuer_thread+0x590/0x590
     kthread+0x153/0x1b0
     ? kthread_flush_work+0x170/0x170
     ret_from_fork+0x1f/0x30
    Modules linked in:
    CR2: 0000000000000094
    ---[ end trace e2e59ac014314547 ]---
    RIP: 0010:bfq_bio_bfqg+0x52/0xc0
    Code: 94 00 00 00 00 75 2e 48 8b 40 30 48 83 05 35 06 c8 0b 01 48 85 c0 74 3d 4b
    RSP: 0018:ffffc90001a1fba0 EFLAGS: 00010002
    RAX: ffff888100d60400 RBX: ffff8881132e7000 RCX: 0000000000000000
    RDX: 0000000000000017 RSI: ffff888103580a18 RDI: ffff888103580a18
    RBP: ffff8881132e7000 R08: 0000000000000000 R09: ffffc90001a1fe10
    R10: 0000000000000a20 R11: 0000000000034320 R12: 0000000000000000
    R13: ffff888103580a18 R14: ffff888114447000 R15: 0000000000000000
    FS:  0000000000000000(0000) GS:ffff88881fdc0000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000094 CR3: 0000000100cdb000 CR4: 00000000000006e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    
    Root cause is quite complex:
    
    1) use bfq elevator for the test device.
    2) create a cgroup CG
    3) config blk throtl in CG
    
       blkg_conf_prep
        blkg_create
    
    4) create a thread T1 and issue async io in CG:
    
       bio_init
        bio_associate_blkg
       ...
       submit_bio
        submit_bio_noacct
         blk_throtl_bio -> io is throttled
         // io submit is done
    
    5) switch elevator:
    
       bfq_exit_queue
        blkcg_deactivate_policy
         list_for_each_entry(blkg, &q->blkg_list, q_node)
          blkg->pd[] = NULL
          // bfq policy is removed
    
    5) thread t1 exist, then remove the cgroup CG:
    
       blkcg_unpin_online
        blkcg_destroy_blkgs
         blkg_destroy
          list_del_init(&blkg->q_node)
          // blkg is removed from queue list
    
    6) switch elevator back to bfq
    
     bfq_init_queue
      bfq_create_group_hierarchy
       blkcg_activate_policy
        list_for_each_entry_reverse(blkg, &q->blkg_list)
         // blkg is removed from list, hence bfq policy is still NULL
    
    7) throttled io is dispatched to bfq:
    
     bfq_insert_requests
      bfq_init_rq
       bfq_bic_update_cgroup
        bfq_bio_bfqg
         bfqg = blkg_to_bfqg(blkg)
         // bfqg is NULL because bfq policy is NULL
    
    The problem is only possible in bfq because only bfq can be deactivated and
    activated while queue is online, while others can only be deactivated while
    the device is removed.
    
    Fix the problem in bfq by checking if blkg is online before calling
    blkg_to_bfqg().
    
    Signed-off-by: Yu Kuai <yukuai3@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Link: https://lore.kernel.org/r/20221108103434.2853269-1-yukuai1@huaweicloud.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
bnx2x: fix pci device refcount leak in bnx2x_vf_is_pcie_pending() [+ + +]
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Sat Nov 19 15:02:02 2022 +0800

    bnx2x: fix pci device refcount leak in bnx2x_vf_is_pcie_pending()
    
    [ Upstream commit 3637a29ccbb6461b7268c5c5db525935d510afc6 ]
    
    As comment of pci_get_domain_bus_and_slot() says, it returns
    a pci device with refcount increment, when finish using it,
    the caller must decrement the reference count by calling
    pci_dev_put(). Call pci_dev_put() before returning from
    bnx2x_vf_is_pcie_pending() to avoid refcount leak.
    
    Fixes: b56e9670ffa4 ("bnx2x: Prepare device and initialize VF database")
    Suggested-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Link: https://lore.kernel.org/r/20221119070202.1407648-1-yangyingliang@huawei.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
btrfs: free btrfs_path before copying fspath to userspace [+ + +]
Author: Anand Jain <anand.jain@oracle.com>
Date:   Thu Nov 10 11:36:29 2022 +0530

    btrfs: free btrfs_path before copying fspath to userspace
    
    commit 8cf96b409d9b3946ece58ced13f92d0f775b0442 upstream.
    
    btrfs_ioctl_ino_to_path() frees the search path after the userspace copy
    from the temp buffer @ipath->fspath. Which potentially can lead to a lock
    splat warning.
    
    Fix this by freeing the path before we copy it to userspace.
    
    CC: stable@vger.kernel.org # 4.19+
    Signed-off-by: Anand Jain <anand.jain@oracle.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>

btrfs: free btrfs_path before copying root refs to userspace [+ + +]
Author: Josef Bacik <josef@toxicpanda.com>
Date:   Mon Nov 7 11:44:51 2022 -0500

    btrfs: free btrfs_path before copying root refs to userspace
    
    commit b740d806166979488e798e41743aaec051f2443f upstream.
    
    Syzbot reported the following lockdep splat
    
    ======================================================
    WARNING: possible circular locking dependency detected
    6.0.0-rc7-syzkaller-18095-gbbed346d5a96 #0 Not tainted
    ------------------------------------------------------
    syz-executor307/3029 is trying to acquire lock:
    ffff0000c02525d8 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0x54/0xb4 mm/memory.c:5576
    
    but task is already holding lock:
    ffff0000c958a608 (btrfs-root-00){++++}-{3:3}, at: __btrfs_tree_read_lock fs/btrfs/locking.c:134 [inline]
    ffff0000c958a608 (btrfs-root-00){++++}-{3:3}, at: btrfs_tree_read_lock fs/btrfs/locking.c:140 [inline]
    ffff0000c958a608 (btrfs-root-00){++++}-{3:3}, at: btrfs_read_lock_root_node+0x13c/0x1c0 fs/btrfs/locking.c:279
    
    which lock already depends on the new lock.
    
    the existing dependency chain (in reverse order) is:
    
    -> #3 (btrfs-root-00){++++}-{3:3}:
           down_read_nested+0x64/0x84 kernel/locking/rwsem.c:1624
           __btrfs_tree_read_lock fs/btrfs/locking.c:134 [inline]
           btrfs_tree_read_lock fs/btrfs/locking.c:140 [inline]
           btrfs_read_lock_root_node+0x13c/0x1c0 fs/btrfs/locking.c:279
           btrfs_search_slot_get_root+0x74/0x338 fs/btrfs/ctree.c:1637
           btrfs_search_slot+0x1b0/0xfd8 fs/btrfs/ctree.c:1944
           btrfs_update_root+0x6c/0x5a0 fs/btrfs/root-tree.c:132
           commit_fs_roots+0x1f0/0x33c fs/btrfs/transaction.c:1459
           btrfs_commit_transaction+0x89c/0x12d8 fs/btrfs/transaction.c:2343
           flush_space+0x66c/0x738 fs/btrfs/space-info.c:786
           btrfs_async_reclaim_metadata_space+0x43c/0x4e0 fs/btrfs/space-info.c:1059
           process_one_work+0x2d8/0x504 kernel/workqueue.c:2289
           worker_thread+0x340/0x610 kernel/workqueue.c:2436
           kthread+0x12c/0x158 kernel/kthread.c:376
           ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860
    
    -> #2 (&fs_info->reloc_mutex){+.+.}-{3:3}:
           __mutex_lock_common+0xd4/0xca8 kernel/locking/mutex.c:603
           __mutex_lock kernel/locking/mutex.c:747 [inline]
           mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
           btrfs_record_root_in_trans fs/btrfs/transaction.c:516 [inline]
           start_transaction+0x248/0x944 fs/btrfs/transaction.c:752
           btrfs_start_transaction+0x34/0x44 fs/btrfs/transaction.c:781
           btrfs_create_common+0xf0/0x1b4 fs/btrfs/inode.c:6651
           btrfs_create+0x8c/0xb0 fs/btrfs/inode.c:6697
           lookup_open fs/namei.c:3413 [inline]
           open_last_lookups fs/namei.c:3481 [inline]
           path_openat+0x804/0x11c4 fs/namei.c:3688
           do_filp_open+0xdc/0x1b8 fs/namei.c:3718
           do_sys_openat2+0xb8/0x22c fs/open.c:1313
           do_sys_open fs/open.c:1329 [inline]
           __do_sys_openat fs/open.c:1345 [inline]
           __se_sys_openat fs/open.c:1340 [inline]
           __arm64_sys_openat+0xb0/0xe0 fs/open.c:1340
           __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
           invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
           el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
           do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206
           el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636
           el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654
           el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
    
    -> #1 (sb_internal#2){.+.+}-{0:0}:
           percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
           __sb_start_write include/linux/fs.h:1826 [inline]
           sb_start_intwrite include/linux/fs.h:1948 [inline]
           start_transaction+0x360/0x944 fs/btrfs/transaction.c:683
           btrfs_join_transaction+0x30/0x40 fs/btrfs/transaction.c:795
           btrfs_dirty_inode+0x50/0x140 fs/btrfs/inode.c:6103
           btrfs_update_time+0x1c0/0x1e8 fs/btrfs/inode.c:6145
           inode_update_time fs/inode.c:1872 [inline]
           touch_atime+0x1f0/0x4a8 fs/inode.c:1945
           file_accessed include/linux/fs.h:2516 [inline]
           btrfs_file_mmap+0x50/0x88 fs/btrfs/file.c:2407
           call_mmap include/linux/fs.h:2192 [inline]
           mmap_region+0x7fc/0xc14 mm/mmap.c:1752
           do_mmap+0x644/0x97c mm/mmap.c:1540
           vm_mmap_pgoff+0xe8/0x1d0 mm/util.c:552
           ksys_mmap_pgoff+0x1cc/0x278 mm/mmap.c:1586
           __do_sys_mmap arch/arm64/kernel/sys.c:28 [inline]
           __se_sys_mmap arch/arm64/kernel/sys.c:21 [inline]
           __arm64_sys_mmap+0x58/0x6c arch/arm64/kernel/sys.c:21
           __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
           invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
           el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
           do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206
           el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636
           el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654
           el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
    
    -> #0 (&mm->mmap_lock){++++}-{3:3}:
           check_prev_add kernel/locking/lockdep.c:3095 [inline]
           check_prevs_add kernel/locking/lockdep.c:3214 [inline]
           validate_chain kernel/locking/lockdep.c:3829 [inline]
           __lock_acquire+0x1530/0x30a4 kernel/locking/lockdep.c:5053
           lock_acquire+0x100/0x1f8 kernel/locking/lockdep.c:5666
           __might_fault+0x7c/0xb4 mm/memory.c:5577
           _copy_to_user include/linux/uaccess.h:134 [inline]
           copy_to_user include/linux/uaccess.h:160 [inline]
           btrfs_ioctl_get_subvol_rootref+0x3a8/0x4bc fs/btrfs/ioctl.c:3203
           btrfs_ioctl+0xa08/0xa64 fs/btrfs/ioctl.c:5556
           vfs_ioctl fs/ioctl.c:51 [inline]
           __do_sys_ioctl fs/ioctl.c:870 [inline]
           __se_sys_ioctl fs/ioctl.c:856 [inline]
           __arm64_sys_ioctl+0xd0/0x140 fs/ioctl.c:856
           __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
           invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
           el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
           do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206
           el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636
           el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654
           el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
    
    other info that might help us debug this:
    
    Chain exists of:
      &mm->mmap_lock --> &fs_info->reloc_mutex --> btrfs-root-00
    
     Possible unsafe locking scenario:
    
           CPU0                    CPU1
           ----                    ----
      lock(btrfs-root-00);
                                   lock(&fs_info->reloc_mutex);
                                   lock(btrfs-root-00);
      lock(&mm->mmap_lock);
    
     *** DEADLOCK ***
    
    1 lock held by syz-executor307/3029:
     #0: ffff0000c958a608 (btrfs-root-00){++++}-{3:3}, at: __btrfs_tree_read_lock fs/btrfs/locking.c:134 [inline]
     #0: ffff0000c958a608 (btrfs-root-00){++++}-{3:3}, at: btrfs_tree_read_lock fs/btrfs/locking.c:140 [inline]
     #0: ffff0000c958a608 (btrfs-root-00){++++}-{3:3}, at: btrfs_read_lock_root_node+0x13c/0x1c0 fs/btrfs/locking.c:279
    
    stack backtrace:
    CPU: 0 PID: 3029 Comm: syz-executor307 Not tainted 6.0.0-rc7-syzkaller-18095-gbbed346d5a96 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/30/2022
    Call trace:
     dump_backtrace+0x1c4/0x1f0 arch/arm64/kernel/stacktrace.c:156
     show_stack+0x2c/0x54 arch/arm64/kernel/stacktrace.c:163
     __dump_stack lib/dump_stack.c:88 [inline]
     dump_stack_lvl+0x104/0x16c lib/dump_stack.c:106
     dump_stack+0x1c/0x58 lib/dump_stack.c:113
     print_circular_bug+0x2c4/0x2c8 kernel/locking/lockdep.c:2053
     check_noncircular+0x14c/0x154 kernel/locking/lockdep.c:2175
     check_prev_add kernel/locking/lockdep.c:3095 [inline]
     check_prevs_add kernel/locking/lockdep.c:3214 [inline]
     validate_chain kernel/locking/lockdep.c:3829 [inline]
     __lock_acquire+0x1530/0x30a4 kernel/locking/lockdep.c:5053
     lock_acquire+0x100/0x1f8 kernel/locking/lockdep.c:5666
     __might_fault+0x7c/0xb4 mm/memory.c:5577
     _copy_to_user include/linux/uaccess.h:134 [inline]
     copy_to_user include/linux/uaccess.h:160 [inline]
     btrfs_ioctl_get_subvol_rootref+0x3a8/0x4bc fs/btrfs/ioctl.c:3203
     btrfs_ioctl+0xa08/0xa64 fs/btrfs/ioctl.c:5556
     vfs_ioctl fs/ioctl.c:51 [inline]
     __do_sys_ioctl fs/ioctl.c:870 [inline]
     __se_sys_ioctl fs/ioctl.c:856 [inline]
     __arm64_sys_ioctl+0xd0/0x140 fs/ioctl.c:856
     __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
     invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
     el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
     do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206
     el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636
     el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654
     el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
    
    We do generally the right thing here, copying the references into a
    temporary buffer, however we are still holding the path when we do
    copy_to_user from the temporary buffer.  Fix this by freeing the path
    before we copy to user space.
    
    Reported-by: syzbot+4ef9e52e464c6ff47d9d@syzkaller.appspotmail.com
    CC: stable@vger.kernel.org # 4.19+
    Reviewed-by: Anand Jain <anand.jain@oracle.com>
    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>

btrfs: free btrfs_path before copying subvol info to userspace [+ + +]
Author: Anand Jain <anand.jain@oracle.com>
Date:   Thu Nov 10 11:36:31 2022 +0530

    btrfs: free btrfs_path before copying subvol info to userspace
    
    commit 013c1c5585ebcfb19c88efe79063d0463b1b6159 upstream.
    
    btrfs_ioctl_get_subvol_info() frees the search path after the userspace
    copy from the temp buffer @subvol_info. This can lead to a lock splat
    warning.
    
    Fix this by freeing the path before we copy it to userspace.
    
    CC: stable@vger.kernel.org # 4.19+
    Signed-off-by: Anand Jain <anand.jain@oracle.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>

btrfs: sysfs: normalize the error handling branch in btrfs_init_sysfs() [+ + +]
Author: Zhen Lei <thunder.leizhen@huawei.com>
Date:   Tue Nov 22 19:50:02 2022 +0800

    btrfs: sysfs: normalize the error handling branch in btrfs_init_sysfs()
    
    commit ffdbb44f2f23f963b8f5672e35c3a26088177a62 upstream.
    
    Although kset_unregister() can eventually remove all attribute files,
    explicitly rolling back with the matching function makes the code logic
    look clearer.
    
    CC: stable@vger.kernel.org # 5.4+
    Reviewed-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: Zhen Lei <thunder.leizhen@huawei.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>

btrfs: use kvcalloc in btrfs_get_dev_zone_info [+ + +]
Author: Christoph Hellwig <hch@lst.de>
Date:   Sun Nov 20 13:43:03 2022 +0100

    btrfs: use kvcalloc in btrfs_get_dev_zone_info
    
    commit 8fe97d47b52ae1ad130470b1780f0ded4ba609a4 upstream.
    
    Otherwise the kernel memory allocator seems to be unhappy about failing
    order 6 allocations for the zones array, that cause 100% reproducible
    mount failures in my qemu setup:
    
      [26.078981] mount: page allocation failure: order:6, mode:0x40dc0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO), nodemask=(null)
      [26.079741] CPU: 0 PID: 2965 Comm: mount Not tainted 6.1.0-rc5+ #185
      [26.080181] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
      [26.080950] Call Trace:
      [26.081132]  <TASK>
      [26.081291]  dump_stack_lvl+0x56/0x6f
      [26.081554]  warn_alloc+0x117/0x140
      [26.081808]  ? __alloc_pages_direct_compact+0x1b5/0x300
      [26.082174]  __alloc_pages_slowpath.constprop.0+0xd0e/0xde0
      [26.082569]  __alloc_pages+0x32a/0x340
      [26.082836]  __kmalloc_large_node+0x4d/0xa0
      [26.083133]  ? trace_kmalloc+0x29/0xd0
      [26.083399]  kmalloc_large+0x14/0x60
      [26.083654]  btrfs_get_dev_zone_info+0x1b9/0xc00
      [26.083980]  ? _raw_spin_unlock_irqrestore+0x28/0x50
      [26.084328]  btrfs_get_dev_zone_info_all_devices+0x54/0x80
      [26.084708]  open_ctree+0xed4/0x1654
      [26.084974]  btrfs_mount_root.cold+0x12/0xde
      [26.085288]  ? lock_is_held_type+0xe2/0x140
      [26.085603]  legacy_get_tree+0x28/0x50
      [26.085876]  vfs_get_tree+0x1d/0xb0
      [26.086139]  vfs_kern_mount.part.0+0x6c/0xb0
      [26.086456]  btrfs_mount+0x118/0x3a0
      [26.086728]  ? lock_is_held_type+0xe2/0x140
      [26.087043]  legacy_get_tree+0x28/0x50
      [26.087323]  vfs_get_tree+0x1d/0xb0
      [26.087587]  path_mount+0x2ba/0xbe0
      [26.087850]  ? _raw_spin_unlock_irqrestore+0x38/0x50
      [26.088217]  __x64_sys_mount+0xfe/0x140
      [26.088506]  do_syscall_64+0x35/0x80
      [26.088776]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    Fixes: 5b316468983d ("btrfs: get zone information of zoned block devices")
    CC: stable@vger.kernel.org # 5.15+
    Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
    Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

btrfs: zoned: fix missing endianness conversion in sb_write_pointer [+ + +]
Author: Christoph Hellwig <hch@lst.de>
Date:   Tue Nov 15 10:39:44 2022 +0100

    btrfs: zoned: fix missing endianness conversion in sb_write_pointer
    
    commit c51f0e6a1254b3ac2d308e1c6fd8fb936992b455 upstream.
    
    generation is an on-disk __le64 value, so use btrfs_super_generation to
    convert it to host endian before comparing it.
    
    Fixes: 12659251ca5d ("btrfs: implement log-structured superblock for ZONED mode")
    CC: stable@vger.kernel.org # 5.15+
    Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Reviewed-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
bus: ixp4xx: Don't touch bit 7 on IXP42x [+ + +]
Author: Linus Walleij <linus.walleij@linaro.org>
Date:   Tue Nov 22 14:44:11 2022 +0100

    bus: ixp4xx: Don't touch bit 7 on IXP42x
    
    commit ff5a19909b49fe5c0b01ae197f84b741e0f698dc upstream.
    
    We face some regressions on a few IXP42x systems when
    accessing flash, the following unrelated error prints
    appear from the PCI driver:
    
    ixp4xx-pci c0000000.pci: PCI: abort_handler addr = 0xff9ffb5f,
               isr = 0x0, status = 0x22a0
    ixp4xx-pci c0000000.pci: imprecise abort
    (...)
    
    It turns out that while bit 7 is masked "reserved" it is
    not unused, so masking it off as zero is dangerous, and
    breaks flash access on some systems such as the NSLU2.
    Be more careful and avoid masking off any of the reserved
    bits 7, 8, 9 or 30. Only keep masking EXP_WORD (bit 2)
    on IXP43x which is necessary in some setups.
    
    Fixes: 1c953bda90ca ("bus: ixp4xx: Add a driver for IXP4xx expansion bus")
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20221122134411.2030372-1-linus.walleij@linaro.org
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

bus: sunxi-rsb: Remove the shutdown callback [+ + +]
Author: Samuel Holland <samuel@sholland.org>
Date:   Sun Nov 13 19:57:47 2022 -0600

    bus: sunxi-rsb: Remove the shutdown callback
    
    [ Upstream commit 5f4696ddca4b8a0bbbc36bd46829f97aab5a4552 ]
    
    Shutting down the RSB controller prevents communicating with a PMIC
    inside pm_power_off(), since that gets called after device_shutdown(),
    so it breaks system poweroff on some boards.
    
    Reported-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
    Tested-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
    Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
    Fixes: 843107498f91 ("bus: sunxi-rsb: Implement suspend/resume/shutdown callbacks")
    Signed-off-by: Samuel Holland <samuel@sholland.org>
    Link: https://lore.kernel.org/r/20221114015749.28490-2-samuel@sholland.org
    Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bus: sunxi-rsb: Support atomic transfers [+ + +]
Author: Samuel Holland <samuel@sholland.org>
Date:   Sun Nov 13 19:57:48 2022 -0600

    bus: sunxi-rsb: Support atomic transfers
    
    [ Upstream commit 077686da0e2162c4ea5ae0df205849c2a7a84479 ]
    
    When communicating with a PMIC during system poweroff (pm_power_off()),
    IRQs are disabled and we are in a RCU read-side critical section, so we
    cannot use wait_for_completion_io_timeout(). Instead, poll the status
    register for transfer completion.
    
    Fixes: d787dcdb9c8f ("bus: sunxi-rsb: Add driver for Allwinner Reduced Serial Bus")
    Signed-off-by: Samuel Holland <samuel@sholland.org>
    Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
    Link: https://lore.kernel.org/r/20221114015749.28490-3-samuel@sholland.org
    Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ceph: avoid putting the realm twice when decoding snaps fails [+ + +]
Author: Xiubo Li <xiubli@redhat.com>
Date:   Wed Nov 9 11:00:39 2022 +0800

    ceph: avoid putting the realm twice when decoding snaps fails
    
    [ Upstream commit 51884d153f7ec85e18d607b2467820a90e0f4359 ]
    
    When decoding the snaps fails it maybe leaving the 'first_realm'
    and 'realm' pointing to the same snaprealm memory. And then it'll
    put it twice and could cause random use-after-free, BUG_ON, etc
    issues.
    
    Cc: stable@vger.kernel.org
    Link: https://tracker.ceph.com/issues/57686
    Signed-off-by: Xiubo Li <xiubli@redhat.com>
    Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
    Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ceph: do not update snapshot context when there is no new snapshot [+ + +]
Author: Xiubo Li <xiubli@redhat.com>
Date:   Sat Feb 19 14:28:33 2022 +0800

    ceph: do not update snapshot context when there is no new snapshot
    
    [ Upstream commit 2e586641c950e7f3e7e008404bd783a466b9b590 ]
    
    We will only track the uppest parent snapshot realm from which we
    need to rebuild the snapshot contexts _downward_ in hierarchy. For
    all the others having no new snapshot we will do nothing.
    
    This fix will avoid calling ceph_queue_cap_snap() on some inodes
    inappropriately. For example, with the code in mainline, suppose there
    are 2 directory hierarchies (with 6 directories total), like this:
    
    /dir_X1/dir_X2/dir_X3/
    /dir_Y1/dir_Y2/dir_Y3/
    
    Firstly, make a snapshot under /dir_X1/dir_X2/.snap/snap_X2, then make a
    root snapshot under /.snap/root_snap. Every time we make snapshots under
    /dir_Y1/..., the kclient will always try to rebuild the snap context for
    snap_X2 realm and finally will always try to queue cap snaps for dir_Y2
    and dir_Y3, which makes no sense.
    
    That's because the snap_X2's seq is 2 and root_snap's seq is 3. So when
    creating a new snapshot under /dir_Y1/... the new seq will be 4, and
    the mds will send the kclient a snapshot backtrace in _downward_
    order: seqs 4, 3.
    
    When ceph_update_snap_trace() is called, it will always rebuild the from
    the last realm, that's the root_snap. So later when rebuilding the snap
    context, the current logic will always cause it to rebuild the snap_X2
    realm and then try to queue cap snaps for all the inodes related in that
    realm, even though it's not necessary.
    
    This is accompanied by a lot of these sorts of dout messages:
    
        "ceph:  queue_cap_snap 00000000a42b796b nothing dirty|writing"
    
    Fix the logic to avoid this situation.
    
    Also, the 'invalidate' word is not precise here. In actuality, it will
    cause a rebuild of the existing snapshot contexts or just build
    non-existent ones. Rename it to 'rebuild_snapcs'.
    
    URL: https://tracker.ceph.com/issues/44100
    Signed-off-by: Xiubo Li <xiubli@redhat.com>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
    Stable-dep-of: 51884d153f7e ("ceph: avoid putting the realm twice when decoding snaps fails")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ceph: fix NULL pointer dereference for req->r_session [+ + +]
Author: Xiubo Li <xiubli@redhat.com>
Date:   Thu Nov 10 21:01:59 2022 +0800

    ceph: fix NULL pointer dereference for req->r_session
    
    [ Upstream commit 5bd76b8de5b74fa941a6eafee87728a0fe072267 ]
    
    The request's r_session maybe changed when it was forwarded or
    resent. Both the forwarding and resending cases the requests will
    be protected by the mdsc->mutex.
    
    Cc: stable@vger.kernel.org
    Link: https://bugzilla.redhat.com/show_bug.cgi?id=2137955
    Signed-off-by: Xiubo Li <xiubli@redhat.com>
    Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
    Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ceph: Use kcalloc for allocating multiple elements [+ + +]
Author: Kenneth Lee <klee33@uw.edu>
Date:   Thu Aug 18 22:42:55 2022 -0700

    ceph: Use kcalloc for allocating multiple elements
    
    [ Upstream commit aa1d627207cace003163dee24d1c06fa4e910c6b ]
    
    Prefer using kcalloc(a, b) over kzalloc(a * b) as this improves
    semantics since kcalloc is intended for allocating an array of memory.
    
    Signed-off-by: Kenneth Lee <klee33@uw.edu>
    Reviewed-by: Xiubo Li <xiubli@redhat.com>
    Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
    Stable-dep-of: 5bd76b8de5b7 ("ceph: fix NULL pointer dereference for req->r_session")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
cifs: Fix connections leak when tlink setup failed [+ + +]
Author: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Date:   Fri Nov 11 15:12:12 2022 +0800

    cifs: Fix connections leak when tlink setup failed
    
    [ Upstream commit 1dcdf5f5b2137185cbdd5385f29949ab3da4f00c ]
    
    If the tlink setup failed, lost to put the connections, then
    the module refcnt leak since the cifsd kthread not exit.
    
    Also leak the fscache info, and for next mount with fsc, it will
    print the follow errors:
      CIFS: Cache volume key already in use (cifs,127.0.0.1:445,TEST)
    
    Let's check the result of tlink setup, and do some cleanup.
    
    Fixes: 56c762eb9bee ("cifs: Refactor out cifs_mount()")
    Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
    Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

cifs: fix missed refcounting of ipc tcon [+ + +]
Author: Paulo Alcantara <pc@cjr.nz>
Date:   Thu Dec 2 15:29:35 2021 -0300

    cifs: fix missed refcounting of ipc tcon
    
    commit 65de262a209da0951eb9bc60b3b7faf3bbffa38a upstream.
    
    Fix missed refcounting of IPC tcon used for getting domain-based DFS
    root referrals.  We want to keep it alive as long as mount is active
    and can be refreshed.  For standalone DFS root referrals it wouldn't
    be a problem as the client ends up having an IPC tcon for both mount
    and cache.
    
    Fixes: c88f7dcd6d64 ("cifs: support nested dfs links over reconnect")
    Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
    Reviewed-by: Enzo Matsumiya <ematsumiya@suse.de>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

cifs: introduce new helper for cifs_reconnect() [+ + +]
Author: Paulo Alcantara <pc@cjr.nz>
Date:   Thu Oct 14 13:57:21 2021 -0300

    cifs: introduce new helper for cifs_reconnect()
    
    [ Upstream commit 43b459aa5e222cb6610dac8723b40c19532ea00d ]
    
    Create cifs_mark_tcp_ses_conns_for_reconnect() helper to mark all
    sessions and tcons for reconnect when reconnecting tcp server.
    
    Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
    Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Stable-dep-of: 1dcdf5f5b213 ("cifs: Fix connections leak when tlink setup failed")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

cifs: split out dfs code from cifs_reconnect() [+ + +]
Author: Paulo Alcantara <pc@cjr.nz>
Date:   Thu Oct 14 17:49:54 2021 -0300

    cifs: split out dfs code from cifs_reconnect()
    
    [ Upstream commit bbcce368044572d0802c3bbb8ef3fe98f581d803 ]
    
    Make two separate functions that handle dfs and non-dfs reconnect
    logics since cifs_reconnect() became way too complex to handle both.
    While at it, add some documentation.
    
    Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
    Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Stable-dep-of: 1dcdf5f5b213 ("cifs: Fix connections leak when tlink setup failed")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

cifs: support nested dfs links over reconnect [+ + +]
Author: Paulo Alcantara <pc@cjr.nz>
Date:   Wed Nov 3 13:53:29 2021 -0300

    cifs: support nested dfs links over reconnect
    
    [ Upstream commit c88f7dcd6d6429197fc2fd87b54a894ffcd48e8e ]
    
    Mounting a dfs link that has nested links was already supported at
    mount(2), so make it work over reconnect as well.
    
    Make the following case work:
    
    * mount //root/dfs/link /mnt -o ...
      - final share: /server/share
    
    * in server settings
      - change target folder of /root/dfs/link3 to /server/share2
      - change target folder of /root/dfs/link2 to /root/dfs/link3
      - change target folder of /root/dfs/link to /root/dfs/link2
    
    * mount -o remount,... /mnt
     - refresh all dfs referrals
     - mark current connection for failover
     - cifs_reconnect() reconnects to root server
     - tree_connect()
       * checks that /root/dfs/link2 is a link, then chase it
       * checks that root/dfs/link3 is a link, then chase it
       * finally tree connect to /server/share2
    
    If the mounted share is no longer accessible and a reconnect had been
    triggered, the client will retry it from both last referral
    path (/root/dfs/link3) and original referral path (/root/dfs/link).
    
    Any new referral paths found while chasing dfs links over reconnect,
    it will be updated to TCP_Server_Info::leaf_fullpath, accordingly.
    
    Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Stable-dep-of: 1dcdf5f5b213 ("cifs: Fix connections leak when tlink setup failed")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
dccp/tcp: Reset saddr on failure after inet6?_hash_connect(). [+ + +]
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Fri Nov 18 17:49:11 2022 -0800

    dccp/tcp: Reset saddr on failure after inet6?_hash_connect().
    
    [ Upstream commit 77934dc6db0d2b111a8f2759e9ad2fb67f5cffa5 ]
    
    When connect() is called on a socket bound to the wildcard address,
    we change the socket's saddr to a local address.  If the socket
    fails to connect() to the destination, we have to reset the saddr.
    
    However, when an error occurs after inet_hash6?_connect() in
    (dccp|tcp)_v[46]_conect(), we forget to reset saddr and leave
    the socket bound to the address.
    
    From the user's point of view, whether saddr is reset or not varies
    with errno.  Let's fix this inconsistent behaviour.
    
    Note that after this patch, the repro [0] will trigger the WARN_ON()
    in inet_csk_get_port() again, but this patch is not buggy and rather
    fixes a bug papering over the bhash2's bug for which we need another
    fix.
    
    For the record, the repro causes -EADDRNOTAVAIL in inet_hash6_connect()
    by this sequence:
    
      s1 = socket()
      s1.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
      s1.bind(('127.0.0.1', 10000))
      s1.sendto(b'hello', MSG_FASTOPEN, (('127.0.0.1', 10000)))
      # or s1.connect(('127.0.0.1', 10000))
    
      s2 = socket()
      s2.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
      s2.bind(('0.0.0.0', 10000))
      s2.connect(('127.0.0.1', 10000))  # -EADDRNOTAVAIL
    
      s2.listen(32)  # WARN_ON(inet_csk(sk)->icsk_bind2_hash != tb2);
    
    [0]: https://syzkaller.appspot.com/bug?extid=015d756bbd1f8b5c8f09
    
    Fixes: 3df80d9320bc ("[DCCP]: Introduce DCCPv6")
    Fixes: 7c657876b63c ("[DCCP]: Initial implementation")
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Acked-by: Joanne Koong <joannelkoong@gmail.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
dm integrity: clear the journal on suspend [+ + +]
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Tue Nov 15 12:51:50 2022 -0500

    dm integrity: clear the journal on suspend
    
    [ Upstream commit 984bf2cc531e778e49298fdf6730e0396166aa21 ]
    
    There was a problem that a user burned a dm-integrity image on CDROM
    and could not activate it because it had a non-empty journal.
    
    Fix this problem by flushing the journal (done by the previous commit)
    and clearing the journal (done by this commit). Once the journal is
    cleared, dm-integrity won't attempt to replay it on the next
    activation.
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

dm integrity: flush the journal on suspend [+ + +]
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Tue Nov 15 12:48:26 2022 -0500

    dm integrity: flush the journal on suspend
    
    [ Upstream commit 5e5dab5ec763d600fe0a67837dd9155bdc42f961 ]
    
    This commit flushes the journal on suspend. It is prerequisite for the
    next commit that enables activating dm integrity devices in read-only mode.
    
    Note that we deliberately didn't flush the journal on suspend, so that the
    journal replay code would be tested. However, the dm-integrity code is 5
    years old now, so that journal replay is well-tested, and we can make this
    change now.
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
dma-buf: fix racing conflict of dma_heap_add() [+ + +]
Author: Dawei Li <set_pte_at@outlook.com>
Date:   Sat Nov 5 00:05:36 2022 +0800

    dma-buf: fix racing conflict of dma_heap_add()
    
    [ Upstream commit 432e25902b9651622578c6248e549297d03caf66 ]
    
    Racing conflict could be:
    task A                 task B
    list_for_each_entry
    strcmp(h->name))
                           list_for_each_entry
                           strcmp(h->name)
    kzalloc                kzalloc
    ......                 .....
    device_create          device_create
    list_add
                           list_add
    
    The root cause is that task B has no idea about the fact someone
    else(A) has inserted heap with same name when it calls list_add,
    so a potential collision occurs.
    
    Fixes: c02a81fba74f ("dma-buf: Add dma-buf heaps framework")
    Signed-off-by: Dawei Li <set_pte_at@outlook.com>
    Acked-by: Andrew Davis <afd@ti.com>
    Acked-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/TYCP286MB2323873BBDF88020781FB986CA3B9@TYCP286MB2323.JPNP286.PROD.OUTLOOK.COM
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Drivers: hv: vmbus: fix double free in the error path of vmbus_add_channel_work() [+ + +]
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Sat Nov 19 16:11:34 2022 +0800

    Drivers: hv: vmbus: fix double free in the error path of vmbus_add_channel_work()
    
    [ Upstream commit f92a4b50f0bd7fd52391dc4bb9a309085d278f91 ]
    
    In the error path of vmbus_device_register(), device_unregister()
    is called, which calls vmbus_device_release().  The latter frees
    the struct hv_device that was passed in to vmbus_device_register().
    So remove the kfree() in vmbus_add_channel_work() to avoid a double
    free.
    
    Fixes: c2e5df616e1a ("vmbus: add per-channel sysfs info")
    Suggested-by: Michael Kelley <mikelley@microsoft.com>
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Reviewed-by: Michael Kelley <mikelley@microsoft.com>
    Link: https://lore.kernel.org/r/20221119081135.1564691-2-yangyingliang@huawei.com
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Drivers: hv: vmbus: fix possible memory leak in vmbus_device_register() [+ + +]
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Sat Nov 19 16:11:35 2022 +0800

    Drivers: hv: vmbus: fix possible memory leak in vmbus_device_register()
    
    [ Upstream commit 25c94b051592c010abe92c85b0485f1faedc83f3 ]
    
    If device_register() returns error in vmbus_device_register(),
    the name allocated by dev_set_name() must be freed. As comment
    of device_register() says, it should use put_device() to give
    up the reference in the error path. So fix this by calling
    put_device(), then the name can be freed in kobject_cleanup().
    
    Fixes: 09d50ff8a233 ("Staging: hv: make the Hyper-V virtual bus code build")
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Reviewed-by: Michael Kelley <mikelley@microsoft.com>
    Link: https://lore.kernel.org/r/20221119081135.1564691-3-yangyingliang@huawei.com
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/amd/dc/dce120: Fix audio register mapping, stop triggering KASAN [+ + +]
Author: Lyude Paul <lyude@redhat.com>
Date:   Mon Nov 14 17:20:45 2022 -0500

    drm/amd/dc/dce120: Fix audio register mapping, stop triggering KASAN
    
    commit 44035ec2fde1114254ee465f9ba3bb246b0b6283 upstream.
    
    There's been a very long running bug that seems to have been neglected for
    a while, where amdgpu consistently triggers a KASAN error at start:
    
      BUG: KASAN: global-out-of-bounds in read_indirect_azalia_reg+0x1d4/0x2a0 [amdgpu]
      Read of size 4 at addr ffffffffc2274b28 by task modprobe/1889
    
    After digging through amd's rather creative method for accessing registers,
    I eventually discovered the problem likely has to do with the fact that on
    my dce120 GPU there are supposedly 7 sets of audio registers. But we only
    define a register mapping for 6 sets.
    
    So, fix this and fix the KASAN warning finally.
    
    Signed-off-by: Lyude Paul <lyude@redhat.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/amd/display: No display after resume from WB/CB [+ + +]
Author: Tsung-hua Lin <Tsung-hua.Lin@amd.com>
Date:   Wed Nov 9 12:54:22 2022 +0800

    drm/amd/display: No display after resume from WB/CB
    
    commit a6e1775da04ab042bc9e2e42399fa25714c253da upstream.
    
    [why]
    First MST sideband message returns AUX_RET_ERROR_HPD_DISCON
    on certain intel platform. Aux transaction considered failure
    if HPD unexpected pulled low. The actual aux transaction success
    in such case, hence do not return error.
    
    [how]
    Not returning error when AUX_RET_ERROR_HPD_DISCON detected
    on the first sideband message.
    
    v2: squash in fix (Alex)
    
    Reviewed-by: Jerry Zuo <Jerry.Zuo@amd.com>
    Acked-by: Brian Chang <Brian.Chang@amd.com>
    Signed-off-by: Tsung-hua Lin <Tsung-hua.Lin@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/amdgpu: always register an MMU notifier for userptr [+ + +]
Author: Christian König <christian.koenig@amd.com>
Date:   Wed Nov 9 12:14:44 2022 +0100

    drm/amdgpu: always register an MMU notifier for userptr
    
    commit b39df63b16b64a3af42695acb9bc567aad144776 upstream.
    
    Since switching to HMM we always need that because we no longer grab
    references to the pages.
    
    Signed-off-by: Christian König <christian.koenig@amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
    CC: stable@vger.kernel.org
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amdgpu: disable BACO support on more cards [+ + +]
Author: Guchun Chen <guchun.chen@amd.com>
Date:   Fri Nov 11 16:54:18 2022 +0800

    drm/amdgpu: disable BACO support on more cards
    
    [ Upstream commit 192039f12233c9063d040266e7c98188c7c89dec ]
    
    Otherwise, some unexpected PCIE AER errors will be observed
    in runtime suspend/resume cycle.
    
    Signed-off-by: Guchun Chen <guchun.chen@amd.com>
    Acked-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/amdgpu: Enable Aldebaran devices to report CU Occupancy [+ + +]
Author: Ramesh Errabolu <Ramesh.Errabolu@amd.com>
Date:   Wed Nov 16 10:46:08 2022 -0600

    drm/amdgpu: Enable Aldebaran devices to report CU Occupancy
    
    commit b9ab82da8804ec22c7e91ffd9d56c7a3abff0c8e upstream.
    
    Allow user to know number of compute units (CU) that are in use at any
    given moment. Enable access to the method kgd_gfx_v9_get_cu_occupancy
    that computes CU occupancy.
    
    Signed-off-by: Ramesh Errabolu <Ramesh.Errabolu@amd.com>
    Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/display: Don't assume dual mode adaptors support i2c sub-addressing [+ + +]
Author: Simon Rettberg <simon.rettberg@rz.uni-freiburg.de>
Date:   Thu Oct 6 11:33:14 2022 +0200

    drm/display: Don't assume dual mode adaptors support i2c sub-addressing
    
    [ Upstream commit 5954acbacbd1946b96ce8ee799d309cb0cd3cb9d ]
    
    Current dual mode adaptor ("DP++") detection code assumes that all
    adaptors support i2c sub-addressing for read operations from the
    DP-HDMI adaptor ID buffer.  It has been observed that multiple
    adaptors do not in fact support this, and always return data starting
    at register 0.  On affected adaptors, the code fails to read the proper
    registers that would identify the device as a type 2 adaptor, and
    handles those as type 1, limiting the TMDS clock to 165MHz, even if
    the according register would announce a higher TMDS clock.
    Fix this by always reading the ID buffer starting from offset 0, and
    discarding any bytes before the actual offset of interest.
    
    We tried finding authoritative documentation on whether or not this is
    allowed behaviour, but since all the official VESA docs are paywalled,
    the best we could come up with was the spec sheet for Texas Instruments'
    SNx5DP149 chip family.[1]  It explicitly mentions that sub-addressing is
    supported for register writes, but *not* for reads (See NOTE in
    section 8.5.3).  Unless TI openly decided to violate the VESA spec, one
    could take that as a hint that sub-addressing is in fact not mandated
    by VESA.
    The other two adaptors affected used the PS8409(A) and the LT8611,
    according to the data returned from their ID buffers.
    
    [1] https://www.ti.com/lit/ds/symlink/sn75dp149.pdf
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Simon Rettberg <simon.rettberg@rz.uni-freiburg.de>
    Reviewed-by: Rafael Gieschke <rafael.gieschke@rz.uni-freiburg.de>
    Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20221006113314.41101987@computer
    Acked-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/i915: fix TLB invalidation for Gen12 video and compute engines [+ + +]
Author: Andrzej Hajda <andrzej.hajda@intel.com>
Date:   Mon Nov 14 11:38:24 2022 +0100

    drm/i915: fix TLB invalidation for Gen12 video and compute engines
    
    commit 04aa64375f48a5d430b5550d9271f8428883e550 upstream.
    
    In case of Gen12 video and compute engines, TLB_INV registers are masked -
    to modify one bit, corresponding bit in upper half of the register must
    be enabled, otherwise nothing happens.
    
    CVE: CVE-2022-4139
    Suggested-by: Chris Wilson <chris.p.wilson@intel.com>
    Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
    Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Fixes: 7938d61591d3 ("drm/i915: Flush TLBs before releasing backing store")
    Cc: stable@vger.kernel.org
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm: panel-orientation-quirks: Add quirk for Acer Switch V 10 (SW5-017) [+ + +]
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Sun Nov 6 22:50:52 2022 +0100

    drm: panel-orientation-quirks: Add quirk for Acer Switch V 10 (SW5-017)
    
    [ Upstream commit 653f2d94fcda200b02bd79cea2e0307b26c1b747 ]
    
    Like the Acer Switch One 10 S1003, for which there already is a quirk,
    the Acer Switch V 10 (SW5-017) has a 800x1280 portrait screen mounted
    in the tablet part of a landscape oriented 2-in-1. Add a quirk for this.
    
    Cc: Rudolf Polzer <rpolzer@google.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Acked-by: Simon Ser <contact@emersion.fr>
    Link: https://patchwork.freedesktop.org/patch/msgid/20221106215052.66995-1-hdegoede@redhat.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ext4: fix use-after-free in ext4_ext_shift_extents [+ + +]
Author: Baokun Li <libaokun1@huawei.com>
Date:   Thu Sep 22 20:04:34 2022 +0800

    ext4: fix use-after-free in ext4_ext_shift_extents
    
    commit f6b1a1cf1c3ee430d3f5e47847047ce789a690aa upstream.
    
    If the starting position of our insert range happens to be in the hole
    between the two ext4_extent_idx, because the lblk of the ext4_extent in
    the previous ext4_extent_idx is always less than the start, which leads
    to the "extent" variable access across the boundary, the following UAF is
    triggered:
    ==================================================================
    BUG: KASAN: use-after-free in ext4_ext_shift_extents+0x257/0x790
    Read of size 4 at addr ffff88819807a008 by task fallocate/8010
    CPU: 3 PID: 8010 Comm: fallocate Tainted: G            E     5.10.0+ #492
    Call Trace:
     dump_stack+0x7d/0xa3
     print_address_description.constprop.0+0x1e/0x220
     kasan_report.cold+0x67/0x7f
     ext4_ext_shift_extents+0x257/0x790
     ext4_insert_range+0x5b6/0x700
     ext4_fallocate+0x39e/0x3d0
     vfs_fallocate+0x26f/0x470
     ksys_fallocate+0x3a/0x70
     __x64_sys_fallocate+0x4f/0x60
     do_syscall_64+0x33/0x40
     entry_SYSCALL_64_after_hwframe+0x44/0xa9
    ==================================================================
    
    For right shifts, we can divide them into the following situations:
    
    1. When the first ee_block of ext4_extent_idx is greater than or equal to
       start, make right shifts directly from the first ee_block.
        1) If it is greater than start, we need to continue searching in the
           previous ext4_extent_idx.
        2) If it is equal to start, we can exit the loop (iterator=NULL).
    
    2. When the first ee_block of ext4_extent_idx is less than start, then
       traverse from the last extent to find the first extent whose ee_block
       is less than start.
        1) If extent is still the last extent after traversal, it means that
           the last ee_block of ext4_extent_idx is less than start, that is,
           start is located in the hole between idx and (idx+1), so we can
           exit the loop directly (break) without right shifts.
        2) Otherwise, make right shifts at the corresponding position of the
           found extent, and then exit the loop (iterator=NULL).
    
    Fixes: 331573febb6a ("ext4: Add support FALLOC_FL_INSERT_RANGE for fallocate")
    Cc: stable@vger.kernel.org # v4.2+
    Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
    Signed-off-by: Baokun Li <libaokun1@huawei.com>
    Link: https://lore.kernel.org/r/20220922120434.1294789-1-libaokun1@huawei.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
fs: do not update freeing inode i_io_list [+ + +]
Author: Svyatoslav Feldsherov <feldsherov@google.com>
Date:   Tue Nov 15 20:20:01 2022 +0000

    fs: do not update freeing inode i_io_list
    
    [ Upstream commit 4e3c51f4e805291b057d12f5dda5aeb50a538dc4 ]
    
    After commit cbfecb927f42 ("fs: record I_DIRTY_TIME even if inode
    already has I_DIRTY_INODE") writeback_single_inode can push inode with
    I_DIRTY_TIME set to b_dirty_time list. In case of freeing inode with
    I_DIRTY_TIME set this can happen after deletion of inode from i_io_list
    at evict. Stack trace is following.
    
    evict
    fat_evict_inode
    fat_truncate_blocks
    fat_flush_inodes
    writeback_inode
    sync_inode_metadata(inode, sync=0)
    writeback_single_inode(inode, wbc) <- wbc->sync_mode == WB_SYNC_NONE
    
    This will lead to use after free in flusher thread.
    
    Similar issue can be triggered if writeback_single_inode in the
    stack trace update inode->i_io_list. Add explicit check to avoid it.
    
    Fixes: cbfecb927f42 ("fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE")
    Reported-by: syzbot+6ba92bd00d5093f7e371@syzkaller.appspotmail.com
    Reviewed-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Svyatoslav Feldsherov <feldsherov@google.com>
    Link: https://lore.kernel.org/r/20221115202001.324188-1-feldsherov@google.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
fuse: lock inode unconditionally in fuse_fallocate() [+ + +]
Author: Miklos Szeredi <mszeredi@redhat.com>
Date:   Wed Nov 23 09:10:42 2022 +0100

    fuse: lock inode unconditionally in fuse_fallocate()
    
    commit 44361e8cf9ddb23f17bdcc40ca944abf32e83e79 upstream.
    
    file_modified() must be called with inode lock held.  fuse_fallocate()
    didn't lock the inode in case of just FALLOC_KEEP_SIZE flags value, which
    resulted in a kernel Warning in notify_change().
    
    Lock the inode unconditionally, like all other fallocate implementations
    do.
    
    Reported-by: Pengfei Xu <pengfei.xu@intel.com>
    Reported-and-tested-by: syzbot+462da39f0667b357c4b6@syzkaller.appspotmail.com
    Fixes: 4a6f278d4827 ("fuse: add file_modified() to fallocate")
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
gcov: clang: fix the buffer overflow issue [+ + +]
Author: Mukesh Ojha <quic_mojha@quicinc.com>
Date:   Thu Nov 10 00:31:37 2022 +0530

    gcov: clang: fix the buffer overflow issue
    
    commit a6f810efabfd789d3bbafeacb4502958ec56c5ce upstream.
    
    Currently, in clang version of gcov code when module is getting removed
    gcov_info_add() incorrectly adds the sfn_ptr->counter to all the
    dst->functions and it result in the kernel panic in below crash report.
    Fix this by properly handling it.
    
    [    8.899094][  T599] Unable to handle kernel write to read-only memory at virtual address ffffff80461cc000
    [    8.899100][  T599] Mem abort info:
    [    8.899102][  T599]   ESR = 0x9600004f
    [    8.899103][  T599]   EC = 0x25: DABT (current EL), IL = 32 bits
    [    8.899105][  T599]   SET = 0, FnV = 0
    [    8.899107][  T599]   EA = 0, S1PTW = 0
    [    8.899108][  T599]   FSC = 0x0f: level 3 permission fault
    [    8.899110][  T599] Data abort info:
    [    8.899111][  T599]   ISV = 0, ISS = 0x0000004f
    [    8.899113][  T599]   CM = 0, WnR = 1
    [    8.899114][  T599] swapper pgtable: 4k pages, 39-bit VAs, pgdp=00000000ab8de000
    [    8.899116][  T599] [ffffff80461cc000] pgd=18000009ffcde003, p4d=18000009ffcde003, pud=18000009ffcde003, pmd=18000009ffcad003, pte=00600000c61cc787
    [    8.899124][  T599] Internal error: Oops: 9600004f [#1] PREEMPT SMP
    [    8.899265][  T599] Skip md ftrace buffer dump for: 0x1609e0
    ....
    ..,
    [    8.899544][  T599] CPU: 7 PID: 599 Comm: modprobe Tainted: G S         OE     5.15.41-android13-8-g38e9b1af6bce #1
    [    8.899547][  T599] Hardware name: XXX (DT)
    [    8.899549][  T599] pstate: 82400005 (Nzcv daif +PAN -UAO +TCO -DIT -SSBS BTYPE=--)
    [    8.899551][  T599] pc : gcov_info_add+0x9c/0xb8
    [    8.899557][  T599] lr : gcov_event+0x28c/0x6b8
    [    8.899559][  T599] sp : ffffffc00e733b00
    [    8.899560][  T599] x29: ffffffc00e733b00 x28: ffffffc00e733d30 x27: ffffffe8dc297470
    [    8.899563][  T599] x26: ffffffe8dc297000 x25: ffffffe8dc297000 x24: ffffffe8dc297000
    [    8.899566][  T599] x23: ffffffe8dc0a6200 x22: ffffff880f68bf20 x21: 0000000000000000
    [    8.899569][  T599] x20: ffffff880f68bf00 x19: ffffff8801babc00 x18: ffffffc00d7f9058
    [    8.899572][  T599] x17: 0000000000088793 x16: ffffff80461cbe00 x15: 9100052952800785
    [    8.899575][  T599] x14: 0000000000000200 x13: 0000000000000041 x12: 9100052952800785
    [    8.899577][  T599] x11: ffffffe8dc297000 x10: ffffffe8dc297000 x9 : ffffff80461cbc80
    [    8.899580][  T599] x8 : ffffff8801babe80 x7 : ffffffe8dc2ec000 x6 : ffffffe8dc2ed000
    [    8.899583][  T599] x5 : 000000008020001f x4 : fffffffe2006eae0 x3 : 000000008020001f
    [    8.899586][  T599] x2 : ffffff8027c49200 x1 : ffffff8801babc20 x0 : ffffff80461cb3a0
    [    8.899589][  T599] Call trace:
    [    8.899590][  T599]  gcov_info_add+0x9c/0xb8
    [    8.899592][  T599]  gcov_module_notifier+0xbc/0x120
    [    8.899595][  T599]  blocking_notifier_call_chain+0xa0/0x11c
    [    8.899598][  T599]  do_init_module+0x2a8/0x33c
    [    8.899600][  T599]  load_module+0x23cc/0x261c
    [    8.899602][  T599]  __arm64_sys_finit_module+0x158/0x194
    [    8.899604][  T599]  invoke_syscall+0x94/0x2bc
    [    8.899607][  T599]  el0_svc_common+0x1d8/0x34c
    [    8.899609][  T599]  do_el0_svc+0x40/0x54
    [    8.899611][  T599]  el0_svc+0x94/0x2f0
    [    8.899613][  T599]  el0t_64_sync_handler+0x88/0xec
    [    8.899615][  T599]  el0t_64_sync+0x1b4/0x1b8
    [    8.899618][  T599] Code: f905f56c f86e69ec f86e6a0f 8b0c01ec (f82e6a0c)
    [    8.899620][  T599] ---[ end trace ed5218e9e5b6e2e6 ]---
    
    Link: https://lkml.kernel.org/r/1668020497-13142-1-git-send-email-quic_mojha@quicinc.com
    Fixes: e178a5beb369 ("gcov: clang support")
    Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
    Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
    Tested-by: Peter Oberparleiter <oberpar@linux.ibm.com>
    Cc: Nathan Chancellor <nathan@kernel.org>
    Cc: Nick Desaulniers <ndesaulniers@google.com>
    Cc: Tom Rix <trix@redhat.com>
    Cc: <stable@vger.kernel.org>    [5.2+]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
genirq/msi: Shutdown managed interrupts with unsatifiable affinities [+ + +]
Author: Luiz Capitulino <luizcap@amazon.com>
Date:   Mon Nov 28 17:08:32 2022 +0000

    genirq/msi: Shutdown managed interrupts with unsatifiable affinities
    
    From: Marc Zyngier <maz@kernel.org>
    
    commit d802057c7c553ad426520a053da9f9fe08e2c35a upstream.
    
    [ This commit is almost a rewrite because it conflicts with Thomas
      Gleixner's refactoring of this code in v5.17-rc1. I wasn't sure if
      I should drop all the s-o-bs (including Mark's), but decided
      to keep as the original commit ]
    
    When booting with maxcpus=<small number>, interrupt controllers
    such as the GICv3 ITS may not be able to satisfy the affinity of
    some managed interrupts, as some of the HW resources are simply
    not available.
    
    The same thing happens when loading a driver using managed interrupts
    while CPUs are offline.
    
    In order to deal with this, do not try to activate such interrupt
    if there is no online CPU capable of handling it. Instead, place
    it in shutdown state. Once a capable CPU shows up, it will be
    activated.
    
    Reported-by: John Garry <john.garry@huawei.com>
    Reported-by: David Decotigny <ddecotig@google.com>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Tested-by: John Garry <john.garry@huawei.com>
    Link: https://lore.kernel.org/r/20220405185040.206297-2-maz@kernel.org
    
    Signed-off-by: Luiz Capitulino <luizcap@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
genirq: Always limit the affinity to online CPUs [+ + +]
Author: Luiz Capitulino <luizcap@amazon.com>
Date:   Mon Nov 28 17:08:33 2022 +0000

    genirq: Always limit the affinity to online CPUs
    
    From: Marc Zyngier <maz@kernel.org>
    
    commit 33de0aa4bae982ed6f7c777f86b5af3e627ac937 upstream.
    
    [ Fixed small conflicts due to the HK_FLAG_MANAGED_IRQ flag been
      renamed on upstream ]
    
    When booting with maxcpus=<small number> (or even loading a driver
    while most CPUs are offline), it is pretty easy to observe managed
    affinities containing a mix of online and offline CPUs being passed
    to the irqchip driver.
    
    This means that the irqchip cannot trust the affinity passed down
    from the core code, which is a bit annoying and requires (at least
    in theory) all drivers to implement some sort of affinity narrowing.
    
    In order to address this, always limit the cpumask to the set of
    online CPUs.
    
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/r/20220405185040.206297-3-maz@kernel.org
    
    Signed-off-by: Luiz Capitulino <luizcap@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

genirq: Take the proposed affinity at face value if force==true [+ + +]
Author: Luiz Capitulino <luizcap@amazon.com>
Date:   Mon Nov 28 17:08:35 2022 +0000

    genirq: Take the proposed affinity at face value if force==true
    
    From: Marc Zyngier <maz@kernel.org>
    
    commit c48c8b829d2b966a6649827426bcdba082ccf922 upstream.
    
    Although setting the affinity of an interrupt to a set of CPUs that doesn't
    have any online CPU is generally frowned apon, there are a few limited
    cases where such affinity is set from a CPUHP notifier, setting the
    affinity to a CPU that isn't online yet.
    
    The saving grace is that this is always done using the 'force' attribute,
    which gives a hint that the affinity setting can be outside of the online
    CPU mask and the callsite set this flag with the knowledge that the
    underlying interrupt controller knows to handle it.
    
    This restores the expected behaviour on Marek's system.
    
    Fixes: 33de0aa4bae9 ("genirq: Always limit the affinity to online CPUs")
    Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Link: https://lore.kernel.org/r/4b7fc13c-887b-a664-26e8-45aed13f048a@samsung.com
    Link: https://lore.kernel.org/r/20220414140011.541725-1-maz@kernel.org
    
    Signed-off-by: Luiz Capitulino <luizcap@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
gpu: host1x: Avoid trying to use GART on Tegra20 [+ + +]
Author: Robin Murphy <robin.murphy@arm.com>
Date:   Thu Oct 20 15:23:40 2022 +0100

    gpu: host1x: Avoid trying to use GART on Tegra20
    
    [ Upstream commit c2418f911a31a266af4fbaca998dc73d3676475a ]
    
    Since commit c7e3ca515e78 ("iommu/tegra: gart: Do not register with
    bus") quite some time ago, the GART driver has effectively disabled
    itself to avoid issues with the GPU driver expecting it to work in ways
    that it doesn't. As of commit 57365a04c921 ("iommu: Move bus setup to
    IOMMU device registration") that bodge no longer works, but really the
    GPU driver should be responsible for its own behaviour anyway. Make the
    workaround explicit.
    
    Reported-by: Jon Hunter <jonathanh@nvidia.com>
    Suggested-by: Dmitry Osipenko <digetx@gmail.com>
    Signed-off-by: Robin Murphy <robin.murphy@arm.com>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Signed-off-by: Thierry Reding <treding@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
iavf: Do not restart Tx queues after reset task failure [+ + +]
Author: Ivan Vecera <ivecera@redhat.com>
Date:   Tue Nov 8 11:25:02 2022 +0100

    iavf: Do not restart Tx queues after reset task failure
    
    [ Upstream commit 08f1c147b7265245d67321585c68a27e990e0c4b ]
    
    After commit aa626da947e9 ("iavf: Detach device during reset task")
    the device is detached during reset task and re-attached at its end.
    The problem occurs when reset task fails because Tx queues are
    restarted during device re-attach and this leads later to a crash.
    
    To resolve this issue properly close the net device in cause of
    failure in reset task to avoid restarting of tx queues at the end.
    Also replace the hacky manipulation with IFF_UP flag by device close
    that clears properly both IFF_UP and __LINK_STATE_START flags.
    In these case iavf_close() does not do anything because the adapter
    state is already __IAVF_DOWN.
    
    Reproducer:
    1) Run some Tx traffic (e.g. iperf3) over iavf interface
    2) Set VF trusted / untrusted in loop
    
    [root@host ~]# cat repro.sh
    
    PF=enp65s0f0
    IF=${PF}v0
    
    ip link set up $IF
    ip addr add 192.168.0.2/24 dev $IF
    sleep 1
    
    iperf3 -c 192.168.0.1 -t 600 --logfile /dev/null &
    sleep 2
    
    while :; do
            ip link set $PF vf 0 trust on
            ip link set $PF vf 0 trust off
    done
    [root@host ~]# ./repro.sh
    
    Result:
    [ 2006.650969] iavf 0000:41:01.0: Failed to init adminq: -53
    [ 2006.675662] ice 0000:41:00.0: VF 0 is now trusted
    [ 2006.689997] iavf 0000:41:01.0: Reset task did not complete, VF disabled
    [ 2006.696611] iavf 0000:41:01.0: failed to allocate resources during reinit
    [ 2006.703209] ice 0000:41:00.0: VF 0 is now untrusted
    [ 2006.737011] ice 0000:41:00.0: VF 0 is now trusted
    [ 2006.764536] ice 0000:41:00.0: VF 0 is now untrusted
    [ 2006.768919] BUG: kernel NULL pointer dereference, address: 0000000000000b4a
    [ 2006.776358] #PF: supervisor read access in kernel mode
    [ 2006.781488] #PF: error_code(0x0000) - not-present page
    [ 2006.786620] PGD 0 P4D 0
    [ 2006.789152] Oops: 0000 [#1] PREEMPT SMP NOPTI
    [ 2006.792903] ice 0000:41:00.0: VF 0 is now trusted
    [ 2006.793501] CPU: 4 PID: 0 Comm: swapper/4 Kdump: loaded Not tainted 6.1.0-rc3+ #2
    [ 2006.805668] Hardware name: Abacus electric, s.r.o. - servis@abacus.cz Super Server/H12SSW-iN, BIOS 2.4 04/13/2022
    [ 2006.815915] RIP: 0010:iavf_xmit_frame_ring+0x96/0xf70 [iavf]
    [ 2006.821028] ice 0000:41:00.0: VF 0 is now untrusted
    [ 2006.821572] Code: 48 83 c1 04 48 c1 e1 04 48 01 f9 48 83 c0 10 6b 50 f8 55 c1 ea 14 45 8d 64 14 01 48 39 c8 75 eb 41 83 fc 07 0f 8f e9 08 00 00 <0f> b7 45 4a 0f b7 55 48 41 8d 74 24 05 31 c9 66 39 d0 0f 86 da 00
    [ 2006.845181] RSP: 0018:ffffb253004bc9e8 EFLAGS: 00010293
    [ 2006.850397] RAX: ffff9d154de45b00 RBX: ffff9d15497d52e8 RCX: ffff9d154de45b00
    [ 2006.856327] ice 0000:41:00.0: VF 0 is now trusted
    [ 2006.857523] RDX: 0000000000000000 RSI: 00000000000005a8 RDI: ffff9d154de45ac0
    [ 2006.857525] RBP: 0000000000000b00 R08: ffff9d159cb010ac R09: 0000000000000001
    [ 2006.857526] R10: ffff9d154de45940 R11: 0000000000000000 R12: 0000000000000002
    [ 2006.883600] R13: ffff9d1770838dc0 R14: 0000000000000000 R15: ffffffffc07b8380
    [ 2006.885840] ice 0000:41:00.0: VF 0 is now untrusted
    [ 2006.890725] FS:  0000000000000000(0000) GS:ffff9d248e900000(0000) knlGS:0000000000000000
    [ 2006.890727] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 2006.909419] CR2: 0000000000000b4a CR3: 0000000c39c10002 CR4: 0000000000770ee0
    [ 2006.916543] PKRU: 55555554
    [ 2006.918254] ice 0000:41:00.0: VF 0 is now trusted
    [ 2006.919248] Call Trace:
    [ 2006.919250]  <IRQ>
    [ 2006.919252]  dev_hard_start_xmit+0x9e/0x1f0
    [ 2006.932587]  sch_direct_xmit+0xa0/0x370
    [ 2006.936424]  __dev_queue_xmit+0x7af/0xd00
    [ 2006.940429]  ip_finish_output2+0x26c/0x540
    [ 2006.944519]  ip_output+0x71/0x110
    [ 2006.947831]  ? __ip_finish_output+0x2b0/0x2b0
    [ 2006.952180]  __ip_queue_xmit+0x16d/0x400
    [ 2006.952721] ice 0000:41:00.0: VF 0 is now untrusted
    [ 2006.956098]  __tcp_transmit_skb+0xa96/0xbf0
    [ 2006.965148]  __tcp_retransmit_skb+0x174/0x860
    [ 2006.969499]  ? cubictcp_cwnd_event+0x40/0x40
    [ 2006.973769]  tcp_retransmit_skb+0x14/0xb0
    ...
    
    Fixes: aa626da947e9 ("iavf: Detach device during reset task")
    Cc: Jacob Keller <jacob.e.keller@intel.com>
    Cc: Patryk Piotrowski <patryk.piotrowski@intel.com>
    Cc: SlawomirX Laba <slawomirx.laba@intel.com>
    Signed-off-by: Ivan Vecera <ivecera@redhat.com>
    Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.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>

iavf: Fix a crash during reset task [+ + +]
Author: Ivan Vecera <ivecera@redhat.com>
Date:   Tue Nov 8 10:35:34 2022 +0100

    iavf: Fix a crash during reset task
    
    [ Upstream commit c678669d6b13b77de3b99b97526aaf23c3088d0a ]
    
    Recent commit aa626da947e9 ("iavf: Detach device during reset task")
    removed netif_tx_stop_all_queues() with an assumption that Tx queues
    are already stopped by netif_device_detach() in the beginning of
    reset task. This assumption is incorrect because during reset
    task a potential link event can start Tx queues again.
    Revert this change to fix this issue.
    
    Reproducer:
    1. Run some Tx traffic (e.g. iperf3) over iavf interface
    2. Switch MTU of this interface in a loop
    
    [root@host ~]# cat repro.sh
    
    IF=enp2s0f0v0
    
    iperf3 -c 192.168.0.1 -t 600 --logfile /dev/null &
    sleep 2
    
    while :; do
            for i in 1280 1500 2000 900 ; do
                    ip link set $IF mtu $i
                    sleep 2
            done
    done
    [root@host ~]# ./repro.sh
    
    Result:
    [  306.199917] iavf 0000:02:02.0 enp2s0f0v0: NIC Link is Up Speed is 40 Gbps Full Duplex
    [  308.205944] iavf 0000:02:02.0 enp2s0f0v0: NIC Link is Up Speed is 40 Gbps Full Duplex
    [  310.103223] BUG: kernel NULL pointer dereference, address: 0000000000000008
    [  310.110179] #PF: supervisor write access in kernel mode
    [  310.115396] #PF: error_code(0x0002) - not-present page
    [  310.120526] PGD 0 P4D 0
    [  310.123057] Oops: 0002 [#1] PREEMPT SMP NOPTI
    [  310.127408] CPU: 24 PID: 183 Comm: kworker/u64:9 Kdump: loaded Not tainted 6.1.0-rc3+ #2
    [  310.135485] Hardware name: Abacus electric, s.r.o. - servis@abacus.cz Super Server/H12SSW-iN, BIOS 2.4 04/13/2022
    [  310.145728] Workqueue: iavf iavf_reset_task [iavf]
    [  310.150520] RIP: 0010:iavf_xmit_frame_ring+0xd1/0xf70 [iavf]
    [  310.156180] Code: d0 0f 86 da 00 00 00 83 e8 01 0f b7 fa 29 f8 01 c8 39 c6 0f 8f a0 08 00 00 48 8b 45 20 48 8d 14 92 bf 01 00 00 00 4c 8d 3c d0 <49> 89 5f 08 8b 43 70 66 41 89 7f 14 41 89 47 10 f6 83 82 00 00 00
    [  310.174918] RSP: 0018:ffffbb5f0082caa0 EFLAGS: 00010293
    [  310.180137] RAX: 0000000000000000 RBX: ffff92345471a6e8 RCX: 0000000000000200
    [  310.187259] RDX: 0000000000000000 RSI: 000000000000000d RDI: 0000000000000001
    [  310.194385] RBP: ffff92341d249000 R08: ffff92434987fcac R09: 0000000000000001
    [  310.201509] R10: 0000000011f683b9 R11: 0000000011f50641 R12: 0000000000000008
    [  310.208631] R13: ffff923447500000 R14: 0000000000000000 R15: 0000000000000000
    [  310.215756] FS:  0000000000000000(0000) GS:ffff92434ee00000(0000) knlGS:0000000000000000
    [  310.223835] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  310.229572] CR2: 0000000000000008 CR3: 0000000fbc210004 CR4: 0000000000770ee0
    [  310.236696] PKRU: 55555554
    [  310.239399] Call Trace:
    [  310.241844]  <IRQ>
    [  310.243855]  ? dst_alloc+0x5b/0xb0
    [  310.247260]  dev_hard_start_xmit+0x9e/0x1f0
    [  310.251439]  sch_direct_xmit+0xa0/0x370
    [  310.255276]  __qdisc_run+0x13e/0x580
    [  310.258848]  __dev_queue_xmit+0x431/0xd00
    [  310.262851]  ? selinux_ip_postroute+0x147/0x3f0
    [  310.267377]  ip_finish_output2+0x26c/0x540
    
    Fixes: aa626da947e9 ("iavf: Detach device during reset task")
    Cc: Jacob Keller <jacob.e.keller@intel.com>
    Cc: Patryk Piotrowski <patryk.piotrowski@intel.com>
    Cc: SlawomirX Laba <slawomirx.laba@intel.com>
    Signed-off-by: Ivan Vecera <ivecera@redhat.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>

iavf: Fix race condition between iavf_shutdown and iavf_remove [+ + +]
Author: Slawomir Laba <slawomirx.laba@intel.com>
Date:   Thu Nov 3 14:00:03 2022 +0100

    iavf: Fix race condition between iavf_shutdown and iavf_remove
    
    [ Upstream commit a8417330f8a57275ed934293e832982b6d882713 ]
    
    Fix a deadlock introduced by commit
    974578017fc1 ("iavf: Add waiting so the port is initialized in remove")
    due to race condition between iavf_shutdown and iavf_remove, where
    iavf_remove stucks forever in while loop since iavf_shutdown already
    set __IAVF_REMOVE adapter state.
    
    Fix this by checking if the __IAVF_IN_REMOVE_TASK has already been
    set and return if so.
    
    Fixes: 974578017fc1 ("iavf: Add waiting so the port is initialized in remove")
    Signed-off-by: Slawomir Laba <slawomirx.laba@intel.com>
    Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
    Tested-by: Marek Szlosek <marek.szlosek@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
iio: core: Fix entry not deleted when iio_register_sw_trigger_type() fails [+ + +]
Author: Chen Zhongjin <chenzhongjin@huawei.com>
Date:   Tue Nov 8 11:28:02 2022 +0800

    iio: core: Fix entry not deleted when iio_register_sw_trigger_type() fails
    
    commit 4ad09d956f8eacff61e67e5b13ba8ebec3232f76 upstream.
    
    In iio_register_sw_trigger_type(), configfs_register_default_group() is
    possible to fail, but the entry add to iio_trigger_types_list is not
    deleted.
    
    This leaves wild in iio_trigger_types_list, which can cause page fault
    when module is loading again. So fix this by list_del(&t->list) in error
    path.
    
    BUG: unable to handle page fault for address: fffffbfff81d7400
    Call Trace:
    <TASK>
     iio_register_sw_trigger_type
     do_one_initcall
     do_init_module
     load_module
     ...
    
    Fixes: b662f809d410 ("iio: core: Introduce IIO software triggers")
    Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
    Link: https://lore.kernel.org/r/20221108032802.168623-1-chenzhongjin@huawei.com
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: light: apds9960: fix wrong register for gesture gain [+ + +]
Author: Alejandro Concepción Rodríguez <asconcepcion@acoro.eu>
Date:   Sun Nov 6 01:56:51 2022 +0000

    iio: light: apds9960: fix wrong register for gesture gain
    
    commit 0aa60ff5d996d4ecdd4a62699c01f6d00f798d59 upstream.
    
    Gesture Gain Control is in REG_GCONF_2 (0xa3), not in REG_CONFIG_2 (0x90).
    
    Fixes: aff268cd532e ("iio: light: add APDS9960 ALS + promixity driver")
    Signed-off-by: Alejandro Concepcion-Rodriguez <asconcepcion@acoro.eu>
    Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
    Cc: <Stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/EaT-NKC-H4DNX5z4Lg9B6IWPD5TrTrYBr5DYB784wfDKQkTmzPXkoYqyUOrOgJH-xvTsEkFLcVkeAPZRUODEFI5dGziaWXwjpfBNLeNGfNc=@acoro.eu
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: ms5611: Simplify IO callback parameters [+ + +]
Author: Lars-Peter Clausen <lars@metafoo.de>
Date:   Wed Oct 20 16:21:10 2021 +0200

    iio: ms5611: Simplify IO callback parameters
    
    [ Upstream commit dc19fa63ad80a636fdbc1a02153d1ab140cb901f ]
    
    The ms5611 passes &indio_dev->dev as a parameter to all its IO callbacks
    only to directly cast the struct device back to struct iio_dev. And the
    struct iio_dev is then only used to get the drivers state struct.
    
    Simplify this a bit by passing the state struct directly. This makes it a
    bit easier to follow what the code is doing.
    
    Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
    Link: https://lore.kernel.org/r/20211020142110.7060-1-lars@metafoo.de
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Stable-dep-of: 17f442e7e475 ("iio: pressure: ms5611: fixed value compensation bug")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

iio: pressure: ms5611: fixed value compensation bug [+ + +]
Author: Mitja Spes <mitja@lxnav.com>
Date:   Fri Oct 21 15:58:20 2022 +0200

    iio: pressure: ms5611: fixed value compensation bug
    
    [ Upstream commit 17f442e7e47579d3881fc4d47354eaef09302e6f ]
    
    When using multiple instances of this driver the compensation PROM was
    overwritten by the last initialized sensor. Now each sensor has own PROM
    storage.
    
    Signed-off-by: Mitja Spes <mitja@lxnav.com>
    Fixes: 9690d81a02dc ("iio: pressure: ms5611: add support for MS5607 temperature and pressure sensor")
    Link: https://lore.kernel.org/r/20221021135827.1444793-2-mitja@lxnav.com
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
init/Kconfig: fix CC_HAS_ASM_GOTO_TIED_OUTPUT test with dash [+ + +]
Author: Alexandre Belloni <alexandre.belloni@bootlin.com>
Date:   Tue Nov 15 12:01:58 2022 +0100

    init/Kconfig: fix CC_HAS_ASM_GOTO_TIED_OUTPUT test with dash
    
    [ Upstream commit 534bd70374d646f17e2cebe0e6e4cdd478ce4f0c ]
    
    When using dash as /bin/sh, the CC_HAS_ASM_GOTO_TIED_OUTPUT test fails
    with a syntax error which is not the one we are looking for:
    
    <stdin>: In function ‘foo’:
    <stdin>:1:29: warning: missing terminating " character
    <stdin>:1:29: error: missing terminating " character
    <stdin>:2:5: error: expected ‘:’ before ‘+’ token
    <stdin>:2:7: warning: missing terminating " character
    <stdin>:2:7: error: missing terminating " character
    <stdin>:2:5: error: expected declaration or statement at end of input
    
    Removing '\n' solves this.
    
    Fixes: 1aa0e8b144b6 ("Kconfig: Add option for asm goto w/ tied outputs to workaround clang-13 bug")
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Reviewed-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Input: goodix - try resetting the controller when no config is set [+ + +]
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Thu Nov 3 11:31:43 2022 -0700

    Input: goodix - try resetting the controller when no config is set
    
    [ Upstream commit c7e37cc6240767f794678d11704935d49cc81d59 ]
    
    On ACPI systems (irq_pin_access_method == IRQ_PIN_ACCESS_ACPI_*) the driver
    does not reset the controller at probe time, because sometimes the system
    firmware loads a config and resetting might loose this config.
    
    On the Nanote UMPC-01 device OTOH the config is in flash of the controller,
    the controller needs a reset to load this; and the system firmware does not
    reset the controller on a cold boot.
    
    To fix the Nanote UMPC-01 touchscreen not working on a cold boot, try
    resetting the controller and then re-reading the config when encountering
    a config with 0 width/height/max_touch_num value and the controller has
    not already been reset by goodix_ts_probe().
    
    This should be safe to do in general because normally we should never
    encounter a config with 0 width/height/max_touch_num. Doing this in
    general not only avoids the need for a DMI quirk, but also might help
    other systems.
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Bastien Nocera <hadess@hadess.net>
    Link: https://lore.kernel.org/r/20221025122930.421377-2-hdegoede@redhat.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Input: i8042 - apply probe defer to more ASUS ZenBook models [+ + +]
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Nov 8 09:30:52 2022 -0800

    Input: i8042 - apply probe defer to more ASUS ZenBook models
    
    [ Upstream commit 26c263bf1847d4dadba016a0457c4c5f446407bf ]
    
    There are yet a few more ASUS ZenBook models that require the deferred
    probe.  At least, there are different ZenBook UX325x and UX425x
    models.  Let's extend the DMI matching table entries for adapting
    those missing models.
    
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Link: https://lore.kernel.org/r/20221108142027.28480-1-tiwai@suse.de
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Input: soc_button_array - add Acer Switch V 10 to dmi_use_low_level_irq[] [+ + +]
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Mon Nov 7 10:30:41 2022 -0800

    Input: soc_button_array - add Acer Switch V 10 to dmi_use_low_level_irq[]
    
    [ Upstream commit e13757f52496444b994a7ac67b6e517a15d89bbc ]
    
    Like on the Acer Switch 10 SW5-012, the Acer Switch V 10 SW5-017's _LID
    method messes with home- and power-button GPIO IRQ settings, causing an
    IRQ storm.
    
    Add a quirk entry for the Acer Switch V 10 to the dmi_use_low_level_irq[]
    DMI quirk list, to use low-level IRQs on this model, fixing the IRQ storm.
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20221106215320.67109-2-hdegoede@redhat.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Input: soc_button_array - add use_low_level_irq module parameter [+ + +]
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Mon Nov 7 10:30:25 2022 -0800

    Input: soc_button_array - add use_low_level_irq module parameter
    
    [ Upstream commit 8e9ada1d0e72b4737df400fe1bba48dc42a68df7 ]
    
    It seems that the Windows drivers for the ACPI0011 soc_button_array
    device use low level triggered IRQs rather then using edge triggering.
    
    Some ACPI tables depend on this, directly poking the GPIO controller's
    registers to clear the trigger type when closing a laptop's/2-in-1's lid
    and re-instating the trigger when opening the lid again.
    
    Linux sets the edge/level on which to trigger to both low+high since
    it is using edge type IRQs, the ACPI tables then ends up also setting
    the bit for level IRQs and since both low and high level have been
    selected by Linux we get an IRQ storm leading to soft lockups.
    
    As a workaround for this the soc_button_array already contains
    a DMI quirk table with device models known to have this issue.
    
    Add a module parameter for this so that users can easily test if their
    device is affected too and so that they can use the module parameter
    as a workaround.
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20221106215320.67109-1-hdegoede@redhat.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Input: synaptics - switch touchpad on HP Laptop 15-da3001TU to RMI mode [+ + +]
Author: Aman Dhoot <amandhoot12@gmail.com>
Date:   Sat Oct 15 20:41:17 2022 -0700

    Input: synaptics - switch touchpad on HP Laptop 15-da3001TU to RMI mode
    
    [ Upstream commit ac5408991ea6b06e29129b4d4861097c4c3e0d59 ]
    
    The device works fine in native RMI mode, there is no reason to use legacy
    PS/2 mode with it.
    
    Signed-off-by: Aman Dhoot <amandhoot12@gmail.com>
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ipv4: Fix error return code in fib_table_insert() [+ + +]
Author: Ziyang Xuan <william.xuanziyang@huawei.com>
Date:   Sun Nov 20 15:28:38 2022 +0800

    ipv4: Fix error return code in fib_table_insert()
    
    [ Upstream commit 568fe84940ac0e4e0b2cd7751b8b4911f7b9c215 ]
    
    In fib_table_insert(), if the alias was already inserted, but node not
    exist, the error code should be set before return from error handling path.
    
    Fixes: a6c76c17df02 ("ipv4: Notify route after insertion to the routing table")
    Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
    Link: https://lore.kernel.org/r/20221120072838.2167047-1-william.xuanziyang@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
irqchip/gic-v3: Always trust the managed affinity provided by the core code [+ + +]
Author: Luiz Capitulino <luizcap@amazon.com>
Date:   Mon Nov 28 17:08:34 2022 +0000

    irqchip/gic-v3: Always trust the managed affinity provided by the core code
    
    From: Marc Zyngier <maz@kernel.org>
    
    commit 3f893a5962d31c0164efdbf6174ed0784f1d7603 upstream.
    
    Now that the core code has been fixed to always give us an affinity
    that only includes online CPUs, directly use this affinity when
    computing a target CPU.
    
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/r/20220405185040.206297-4-maz@kernel.org
    
    Signed-off-by: Luiz Capitulino <luizcap@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
KVM: arm64: pkvm: Fixup boot mode to reflect that the kernel resumes from EL1 [+ + +]
Author: Marc Zyngier <maz@kernel.org>
Date:   Mon Nov 28 18:52:22 2022 +0000

    KVM: arm64: pkvm: Fixup boot mode to reflect that the kernel resumes from EL1
    
    The kernel has an awfully complicated boot sequence in order to cope
    with the various EL2 configurations, including those that "enhanced"
    the architecture. We go from EL2 to EL1, then back to EL2, staying
    at EL2 if VHE capable and otherwise go back to EL1.
    
    Here's a paracetamol tablet for you.
    
    The cpu_resume path follows the same logic, because coming up with
    two versions of a square wheel is hard.
    
    However, things aren't this straightforward with pKVM, as the host
    resume path is always proxied by the hypervisor, which means that
    the kernel is always entered at EL1. Which contradicts what the
    __boot_cpu_mode[] array contains (it obviously says EL2).
    
    This thus triggers a HVC call from EL1 to EL2 in a vain attempt
    to upgrade from EL1 to EL2 VHE, which we are, funnily enough,
    reluctant to grant to the host kernel. This is also completely
    unexpected, and puzzles your average EL2 hacker.
    
    Address it by fixing up the boot mode at the point the host gets
    deprivileged. is_hyp_mode_available() and co already have a static
    branch to deal with this, making it pretty safe.
    
    This stable fix doesn't have an upstream version. The entire bootflow
    has been reworked from 6.0 and that fixed the boot mode at the same
    time, from commit 005e12676af0 ("arm64: head: record CPU boot mode after
    enabling the MMU") to be precise. However, the latter is part of a 20
    patches long series and can't be simply cherry-pick'ed.
    
    Link: https://lore.kernel.org/r/20220624150651.1358849-1-ardb@kernel.org/
    Link: https://lore.kernel.org/r/20221011165400.1241729-1-maz@kernel.org/
    Cc: <stable@vger.kernel.org> # 5.15+
    Reported-by: Vincent Donnefort <vdonnefort@google.com>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Tested-by: Vincent Donnefort <vdonnefort@google.com>
    [Vincent: Add a paragraph about why this patch is for stable only]
    Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: x86: add kvm_leave_nested [+ + +]
Author: Maxim Levitsky <mlevitsk@redhat.com>
Date:   Thu Nov 3 16:13:45 2022 +0200

    KVM: x86: add kvm_leave_nested
    
    commit f9697df251438b0798780900e8b43bdb12a56d64 upstream.
    
    add kvm_leave_nested which wraps a call to nested_ops->leave_nested
    into a function.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
    Message-Id: <20221103141351.50662-4-mlevitsk@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: x86: forcibly leave nested mode on vCPU reset [+ + +]
Author: Maxim Levitsky <mlevitsk@redhat.com>
Date:   Thu Nov 3 16:13:46 2022 +0200

    KVM: x86: forcibly leave nested mode on vCPU reset
    
    commit ed129ec9057f89d615ba0c81a4984a90345a1684 upstream.
    
    While not obivous, kvm_vcpu_reset() leaves the nested mode by clearing
    'vcpu->arch.hflags' but it does so without all the required housekeeping.
    
    On SVM, it is possible to have a vCPU reset while in guest mode because
    unlike VMX, on SVM, INIT's are not latched in SVM non root mode and in
    addition to that L1 doesn't have to intercept triple fault, which should
    also trigger L1's reset if happens in L2 while L1 didn't intercept it.
    
    If one of the above conditions happen, KVM will continue to use vmcb02
    while not having in the guest mode.
    
    Later the IA32_EFER will be cleared which will lead to freeing of the
    nested guest state which will (correctly) free the vmcb02, but since
    KVM still uses it (incorrectly) this will lead to a use after free
    and kernel crash.
    
    This issue is assigned CVE-2022-3344
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
    Message-Id: <20221103141351.50662-5-mlevitsk@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: x86: nSVM: harden svm_free_nested against freeing vmcb02 while still in use [+ + +]
Author: Maxim Levitsky <mlevitsk@redhat.com>
Date:   Thu Nov 3 16:13:44 2022 +0200

    KVM: x86: nSVM: harden svm_free_nested against freeing vmcb02 while still in use
    
    commit 16ae56d7e0528559bf8dc9070e3bfd8ba3de80df upstream.
    
    Make sure that KVM uses vmcb01 before freeing nested state, and warn if
    that is not the case.
    
    This is a minimal fix for CVE-2022-3344 making the kernel print a warning
    instead of a kernel panic.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
    Message-Id: <20221103141351.50662-3-mlevitsk@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: x86: nSVM: leave nested mode on vCPU free [+ + +]
Author: Maxim Levitsky <mlevitsk@redhat.com>
Date:   Thu Nov 3 16:13:43 2022 +0200

    KVM: x86: nSVM: leave nested mode on vCPU free
    
    commit 917401f26a6af5756d89b550a8e1bd50cf42b07e upstream.
    
    If the VM was terminated while nested, we free the nested state
    while the vCPU still is in nested mode.
    
    Soon a warning will be added for this condition.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
    Message-Id: <20221103141351.50662-2-mlevitsk@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: x86: remove exit_int_info warning in svm_handle_exit [+ + +]
Author: Maxim Levitsky <mlevitsk@redhat.com>
Date:   Thu Nov 3 16:13:51 2022 +0200

    KVM: x86: remove exit_int_info warning in svm_handle_exit
    
    commit 05311ce954aebe75935d9ae7d38ac82b5b796e33 upstream.
    
    It is valid to receive external interrupt and have broken IDT entry,
    which will lead to #GP with exit_int_into that will contain the index of
    the IDT entry (e.g any value).
    
    Other exceptions can happen as well, like #NP or #SS
    (if stack switch fails).
    
    Thus this warning can be user triggred and has very little value.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
    Message-Id: <20221103141351.50662-10-mlevitsk@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
lib/vdso: use "grep -E" instead of "egrep" [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Tue Sep 20 19:06:33 2022 +0200

    lib/vdso: use "grep -E" instead of "egrep"
    
    commit 8ac3b5cd3e0521d92f9755e90d140382fc292510 upstream.
    
    The latest version of grep claims the egrep is now obsolete so the build
    now contains warnings that look like:
            egrep: warning: egrep is obsolescent; using grep -E
    fix this up by moving the vdso Makefile to use "grep -E" instead.
    
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
    Link: https://lore.kernel.org/r/20220920170633.3133829-1-gregkh@linuxfoundation.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Linux: Linux 5.15.81 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Dec 2 17:41:12 2022 +0100

    Linux 5.15.81
    
    Link: https://lore.kernel.org/r/20221130180532.974348590@linuxfoundation.org
    Tested-by: Florian Fainelli <f.fainelli@gmail.com>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
    Tested-by: Kelsey Steele <kelseysteele@linux.microsoft.com>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
macsec: Fix invalid error code set [+ + +]
Author: YueHaibing <yuehaibing@huawei.com>
Date:   Fri Nov 18 09:12:49 2022 +0800

    macsec: Fix invalid error code set
    
    [ Upstream commit 7cef6b73fba96abef731a53501924fc3c4a0f947 ]
    
    'ret' is defined twice in macsec_changelink(), when it is set in macsec_is_offloaded
    case, it will be invalid before return.
    
    Fixes: 3cf3227a21d1 ("net: macsec: hardware offloading infrastructure")
    Signed-off-by: YueHaibing <yuehaibing@huawei.com>
    Reviewed-by: Saeed Mahameed <saeed@kernel.org>
    Reviewed-by: Antoine Tenart <atenart@kernel.org>
    Link: https://lore.kernel.org/r/20221118011249.48112-1-yuehaibing@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
MIPS: pic32: treat port as signed integer [+ + +]
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Fri Oct 28 15:23:44 2022 +0200

    MIPS: pic32: treat port as signed integer
    
    [ Upstream commit 648060902aa302331b5d6e4f26d8ee0761d239ab ]
    
    get_port_from_cmdline() returns an int, yet is assigned to a char, which
    is wrong in its own right, but also, with char becoming unsigned, this
    poses problems, because -1 is used as an error value. Further
    complicating things, fw_init_early_console() is only ever called with a
    -1 argument. Fix this up by removing the unused argument from
    fw_init_early_console() and treating port as a proper signed integer.
    
    Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
    Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mm: vmscan: fix extreme overreclaim and swap floods [+ + +]
Author: Johannes Weiner <hannes@cmpxchg.org>
Date:   Tue Aug 2 12:28:11 2022 -0400

    mm: vmscan: fix extreme overreclaim and swap floods
    
    commit f53af4285d775cd9a9a146fc438bd0a1bee1838a upstream.
    
    During proactive reclaim, we sometimes observe severe overreclaim, with
    several thousand times more pages reclaimed than requested.
    
    This trace was obtained from shrink_lruvec() during such an instance:
    
        prio:0 anon_cost:1141521 file_cost:7767
        nr_reclaimed:4387406 nr_to_reclaim:1047 (or_factor:4190)
        nr=[7161123 345 578 1111]
    
    While he reclaimer requested 4M, vmscan reclaimed close to 16G, most of it
    by swapping.  These requests take over a minute, during which the write()
    to memory.reclaim is unkillably stuck inside the kernel.
    
    Digging into the source, this is caused by the proportional reclaim
    bailout logic.  This code tries to resolve a fundamental conflict: to
    reclaim roughly what was requested, while also aging all LRUs fairly and
    in accordance to their size, swappiness, refault rates etc.  The way it
    attempts fairness is that once the reclaim goal has been reached, it stops
    scanning the LRUs with the smaller remaining scan targets, and adjusts the
    remainder of the bigger LRUs according to how much of the smaller LRUs was
    scanned.  It then finishes scanning that remainder regardless of the
    reclaim goal.
    
    This works fine if priority levels are low and the LRU lists are
    comparable in size.  However, in this instance, the cgroup that is
    targeted by proactive reclaim has almost no files left - they've already
    been squeezed out by proactive reclaim earlier - and the remaining anon
    pages are hot.  Anon rotations cause the priority level to drop to 0,
    which results in reclaim targeting all of anon (a lot) and all of file
    (almost nothing).  By the time reclaim decides to bail, it has scanned
    most or all of the file target, and therefor must also scan most or all of
    the enormous anon target.  This target is thousands of times larger than
    the reclaim goal, thus causing the overreclaim.
    
    The bailout code hasn't changed in years, why is this failing now?  The
    most likely explanations are two other recent changes in anon reclaim:
    
    1. Before the series starting with commit 5df741963d52 ("mm: fix LRU
       balancing effect of new transparent huge pages"), the VM was
       overall relatively reluctant to swap at all, even if swap was
       configured. This means the LRU balancing code didn't come into play
       as often as it does now, and mostly in high pressure situations
       where pronounced swap activity wouldn't be as surprising.
    
    2. For historic reasons, shrink_lruvec() loops on the scan targets of
       all LRU lists except the active anon one, meaning it would bail if
       the only remaining pages to scan were active anon - even if there
       were a lot of them.
    
       Before the series starting with commit ccc5dc67340c ("mm/vmscan:
       make active/inactive ratio as 1:1 for anon lru"), most anon pages
       would live on the active LRU; the inactive one would contain only a
       handful of preselected reclaim candidates. After the series, anon
       gets aged similarly to file, and the inactive list is the default
       for new anon pages as well, making it often the much bigger list.
    
       As a result, the VM is now more likely to actually finish large
       anon targets than before.
    
    Change the code such that only one SWAP_CLUSTER_MAX-sized nudge toward the
    larger LRU lists is made before bailing out on a met reclaim goal.
    
    This fixes the extreme overreclaim problem.
    
    Fairness is more subtle and harder to evaluate.  No obvious misbehavior
    was observed on the test workload, in any case.  Conceptually, fairness
    should primarily be a cumulative effect from regular, lower priority
    scans.  Once the VM is in trouble and needs to escalate scan targets to
    make forward progress, fairness needs to take a backseat.  This is also
    acknowledged by the myriad exceptions in get_scan_count().  This patch
    makes fairness decrease gradually, as it keeps fairness work static over
    increasing priority levels with growing scan targets.  This should make
    more sense - although we may have to re-visit the exact values.
    
    Link: https://lkml.kernel.org/r/20220802162811.39216-1-hannes@cmpxchg.org
    Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
    Reviewed-by: Rik van Riel <riel@surriel.com>
    Acked-by: Mel Gorman <mgorman@techsingularity.net>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mmc: sdhci-brcmstb: Enable Clock Gating to save power [+ + +]
Author: Al Cooper <alcooperx@gmail.com>
Date:   Wed Apr 27 14:08:51 2022 -0400

    mmc: sdhci-brcmstb: Enable Clock Gating to save power
    
    [ Upstream commit 6bcc55fe648b860ef0c2b8dc23adc05bcddb93c2 ]
    
    Enabling this feature will allow the controller to stop the bus
    clock when the bus is idle. The feature is not part of the standard
    and is unique to newer Arasan cores and is enabled with a bit in a
    vendor specific register. This feature will only be enabled for
    non-removable devices because they don't switch the voltage and
    clock gating breaks SD Card volatge switching.
    
    Signed-off-by: Al Cooper <alcooperx@gmail.com>
    Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
    Acked-by: Florian Fainelli <f.fainelli@gmail.com>
    Acked-by: Adrian Hunter <adrian.hunter@intel.com>
    Link: https://lore.kernel.org/r/20220427180853.35970-3-kdasu.kdev@gmail.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Stable-dep-of: 56baa208f910 ("mmc: sdhci-brcmstb: Fix SDHCI_RESET_ALL for CQHCI")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mmc: sdhci-brcmstb: Fix SDHCI_RESET_ALL for CQHCI [+ + +]
Author: Brian Norris <briannorris@chromium.org>
Date:   Wed Oct 26 12:42:05 2022 -0700

    mmc: sdhci-brcmstb: Fix SDHCI_RESET_ALL for CQHCI
    
    [ Upstream commit 56baa208f91061ff27ec2d93fbc483f624d373b4 ]
    
    [[ NOTE: this is completely untested by the author, but included solely
        because, as noted in commit df57d73276b8 ("mmc: sdhci-pci: Fix
        SDHCI_RESET_ALL for CQHCI for Intel GLK-based controllers"), "other
        drivers using CQHCI might benefit from a similar change, if they
        also have CQHCI reset by SDHCI_RESET_ALL." We've now seen the same
        bug on at least MSM, Arasan, and Intel hardware. ]]
    
    SDHCI_RESET_ALL resets will reset the hardware CQE state, but we aren't
    tracking that properly in software. When out of sync, we may trigger
    various timeouts.
    
    It's not typical to perform resets while CQE is enabled, but this may
    occur in some suspend or error recovery scenarios.
    
    Include this fix by way of the new sdhci_and_cqhci_reset() helper.
    
    I only patch the bcm7216 variant even though others potentially *could*
    provide the 'supports-cqe' property (and thus enable CQHCI), because
    d46ba2d17f90 ("mmc: sdhci-brcmstb: Add support for Command Queuing
    (CQE)") and some Broadcom folks confirm that only the 7216 variant
    actually supports it.
    
    This patch depends on (and should not compile without) the patch
    entitled "mmc: cqhci: Provide helper for resetting both SDHCI and
    CQHCI".
    
    Fixes: d46ba2d17f90 ("mmc: sdhci-brcmstb: Add support for Command Queuing (CQE)")
    Signed-off-by: Brian Norris <briannorris@chromium.org>
    Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
    Acked-by: Adrian Hunter <adrian.hunter@intel.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20221026124150.v4.3.I6a715feab6d01f760455865e968ecf0d85036018@changeid
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mmc: sdhci-brcmstb: Re-organize flags [+ + +]
Author: Al Cooper <alcooperx@gmail.com>
Date:   Wed Apr 27 14:08:50 2022 -0400

    mmc: sdhci-brcmstb: Re-organize flags
    
    [ Upstream commit f3a70f991dd07330225ea11e158e1d07ad5733fb ]
    
    Re-organize the flags by basing the bit names on the flag that they
    apply to. Also change the "flags" member in the "brcmstb_match_priv"
    struct to const.
    
    Signed-off-by: Al Cooper <alcooperx@gmail.com>
    Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
    Acked-by: Florian Fainelli <f.fainelli@gmail.com>
    Acked-by: Adrian Hunter <adrian.hunter@intel.com>
    Link: https://lore.kernel.org/r/20220427180853.35970-2-kdasu.kdev@gmail.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Stable-dep-of: 56baa208f910 ("mmc: sdhci-brcmstb: Fix SDHCI_RESET_ALL for CQHCI")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/mlx4: Check retval of mlx4_bitmap_init [+ + +]
Author: Peter Kosyh <pkosyh@yandex.ru>
Date:   Thu Nov 17 18:28:06 2022 +0300

    net/mlx4: Check retval of mlx4_bitmap_init
    
    [ Upstream commit 594c61ffc77de0a197934aa0f1df9285c68801c6 ]
    
    If mlx4_bitmap_init fails, mlx4_bitmap_alloc_range will dereference
    the NULL pointer (bitmap->table).
    
    Make sure, that mlx4_bitmap_alloc_range called in no error case.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: d57febe1a478 ("net/mlx4: Add A0 hybrid steering")
    Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
    Signed-off-by: Peter Kosyh <pkosyh@yandex.ru>
    Link: https://lore.kernel.org/r/20221117152806.278072-1-pkosyh@yandex.ru
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/mlx5: Do not query pci info while pci disabled [+ + +]
Author: Roy Novich <royno@nvidia.com>
Date:   Sun Jul 24 09:49:07 2022 +0300

    net/mlx5: Do not query pci info while pci disabled
    
    [ Upstream commit 394164f9d5a3020a7fd719d228386d48d544ec67 ]
    
    The driver should not interact with PCI while PCI is disabled. Trying to
    do so may result in being unable to get vital signs during PCI reset,
    driver gets timed out and fails to recover.
    
    Fixes: fad1783a6d66 ("net/mlx5: Print more info on pci error handlers")
    Signed-off-by: Roy Novich <royno@nvidia.com>
    Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
    Reviewed-by: Aya Levin <ayal@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/mlx5: Fix FW tracer timestamp calculation [+ + +]
Author: Moshe Shemesh <moshe@nvidia.com>
Date:   Thu Oct 20 12:25:59 2022 +0300

    net/mlx5: Fix FW tracer timestamp calculation
    
    [ Upstream commit 61db3d7b99a367416e489ccf764cc5f9b00d62a1 ]
    
    Fix a bug in calculation of FW tracer timestamp. Decreasing one in the
    calculation should effect only bits 52_7 and not effect bits 6_0 of the
    timestamp, otherwise bits 6_0 are always set in this calculation.
    
    Fixes: 70dd6fdb8987 ("net/mlx5: FW tracer, parse traces and kernel tracing support")
    Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
    Reviewed-by: Feras Daoud <ferasda@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/mlx5: Fix handling of entry refcount when command is not issued to FW [+ + +]
Author: Moshe Shemesh <moshe@nvidia.com>
Date:   Thu Nov 17 09:07:20 2022 +0200

    net/mlx5: Fix handling of entry refcount when command is not issued to FW
    
    [ Upstream commit aaf2e65cac7f2e1ae729c2fbc849091df9699f96 ]
    
    In case command interface is down, or the command is not allowed, driver
    did not increment the entry refcount, but might have decrement as part
    of forced completion handling.
    
    Fix that by always increment and decrement the refcount to make it
    symmetric for all flows.
    
    Fixes: 50b2412b7e78 ("net/mlx5: Avoid possible free of command entry while timeout comp handler")
    Signed-off-by: Eran Ben Elisha <eranbe@nvidia.com>
    Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
    Reported-by: Jack Wang <jinpu.wang@ionos.com>
    Tested-by: Jack Wang <jinpu.wang@ionos.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/qla3xxx: fix potential memleak in ql3xxx_send() [+ + +]
Author: Zhang Changzhong <zhangchangzhong@huawei.com>
Date:   Thu Nov 17 16:50:38 2022 +0800

    net/qla3xxx: fix potential memleak in ql3xxx_send()
    
    [ Upstream commit 62a7311fb96c61d281da9852dbee4712fc8c3277 ]
    
    The ql3xxx_send() returns NETDEV_TX_OK without freeing skb in error
    handling case, add dev_kfree_skb_any() to fix it.
    
    Fixes: bd36b0ac5d06 ("qla3xxx: Add support for Qlogic 4032 chip.")
    Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
    Link: https://lore.kernel.org/r/1668675039-21138-1-git-send-email-zhangchangzhong@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net: dsa: sja1105: disallow C45 transactions on the BASE-TX MDIO bus [+ + +]
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Wed Nov 16 12:06:53 2022 +0200

    net: dsa: sja1105: disallow C45 transactions on the BASE-TX MDIO bus
    
    [ Upstream commit 24deec6b9e4a051635f75777844ffc184644fec9 ]
    
    You'd think people know that the internal 100BASE-TX PHY on the SJA1110
    responds only to clause 22 MDIO transactions, but they don't :)
    
    When a clause 45 transaction is attempted, sja1105_base_tx_mdio_read()
    and sja1105_base_tx_mdio_write() don't expect "reg" to contain bit 30
    set (MII_ADDR_C45) and pack this value into the SPI transaction buffer.
    
    But the field in the SPI buffer has a width smaller than 30 bits, so we
    see this confusing message from the packing() API rather than a proper
    rejection of C45 transactions:
    
    Call trace:
     dump_stack+0x1c/0x38
     sja1105_pack+0xbc/0xc0 [sja1105]
     sja1105_xfer+0x114/0x2b0 [sja1105]
     sja1105_xfer_u32+0x44/0xf4 [sja1105]
     sja1105_base_tx_mdio_read+0x44/0x7c [sja1105]
     mdiobus_read+0x44/0x80
     get_phy_c45_ids+0x70/0x234
     get_phy_device+0x68/0x15c
     fwnode_mdiobus_register_phy+0x74/0x240
     of_mdiobus_register+0x13c/0x380
     sja1105_mdiobus_register+0x368/0x490 [sja1105]
     sja1105_setup+0x94/0x119c [sja1105]
    Cannot store 401d2405 inside bits 24-4 (would truncate)
    
    Fixes: 5a8f09748ee7 ("net: dsa: sja1105: register the MDIO buses for 100base-T1 and 100base-TX")
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: enetc: cache accesses to &priv->si->hw [+ + +]
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Wed Sep 28 12:52:02 2022 +0300

    net: enetc: cache accesses to &priv->si->hw
    
    [ Upstream commit 715bf2610f1d1adf3d4f9b7b3dd729984ec4270a ]
    
    The &priv->si->hw construct dereferences 2 pointers and makes lines
    longer than they need to be, in turn making the code harder to read.
    
    Replace &priv->si->hw accesses with a "hw" variable when there are 2 or
    more accesses within a function that dereference this. This includes
    loops, since &priv->si->hw is a loop invariant.
    
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 290b5fe096e7 ("net: enetc: preserve TX ring priority across reconfiguration")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: enetc: manage ENETC_F_QBV in priv->active_offloads only when enabled [+ + +]
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Tue May 10 19:36:14 2022 +0300

    net: enetc: manage ENETC_F_QBV in priv->active_offloads only when enabled
    
    [ Upstream commit 32bf8e1f6fb9f6dc334b2b98dffc2e5dcd51e513 ]
    
    Future work in this driver would like to look at priv->active_offloads &
    ENETC_F_QBV to determine whether a tc-taprio qdisc offload was
    installed, but this does not produce the intended effect.
    
    All the other flags in priv->active_offloads are managed dynamically,
    except ENETC_F_QBV which is set statically based on the probed SI capability.
    
    This change makes priv->active_offloads & ENETC_F_QBV really track the
    presence of a tc-taprio schedule on the port.
    
    Some existing users, like the enetc_sched_speed_set() call from
    phylink_mac_link_up(), are best kept using the old logic: the tc-taprio
    offload does not re-trigger another link mode resolve, so the scheduler
    needs to be functional from the get go, as long as Qbv is supported at
    all on the port. So to preserve functionality there, look at the static
    station interface capability from pf->si->hw_features instead.
    
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 290b5fe096e7 ("net: enetc: preserve TX ring priority across reconfiguration")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: enetc: preserve TX ring priority across reconfiguration [+ + +]
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Tue Nov 22 15:09:36 2022 +0200

    net: enetc: preserve TX ring priority across reconfiguration
    
    [ Upstream commit 290b5fe096e7dd0aad730d1af4f7f2d9fea43e11 ]
    
    In the blamed commit, a rudimentary reallocation procedure for RX buffer
    descriptors was implemented, for the situation when their format changes
    between normal (no PTP) and extended (PTP).
    
    enetc_hwtstamp_set() calls enetc_close() and enetc_open() in a sequence,
    and this sequence loses information which was previously configured in
    the TX BDR Mode Register, specifically via the enetc_set_bdr_prio() call.
    The TX ring priority is configured by tc-mqprio and tc-taprio, and
    affects important things for TSN such as the TX time of packets. The
    issue manifests itself most visibly by the fact that isochron --txtime
    reports premature packet transmissions when PTP is first enabled on an
    enetc interface.
    
    Save the TX ring priority in a new field in struct enetc_bdr (occupies a
    2 byte hole on arm64) in order to make this survive a ring reconfiguration.
    
    Fixes: 434cebabd3a2 ("enetc: Add dynamic allocation of extended Rx BD rings")
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: Alexander Lobakin <alexandr.lobakin@intel.com>
    Link: https://lore.kernel.org/r/20221122130936.1704151-1-vladimir.oltean@nxp.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: ethernet: mtk_eth_soc: fix error handling in mtk_open() [+ + +]
Author: Liu Jian <liujian56@huawei.com>
Date:   Thu Nov 17 19:13:56 2022 +0800

    net: ethernet: mtk_eth_soc: fix error handling in mtk_open()
    
    [ Upstream commit f70074140524c59a0935947b06dd6cb6e1ea642d ]
    
    If mtk_start_dma() fails, invoke phylink_disconnect_phy() to perform
    cleanup. phylink_disconnect_phy() contains the put_device action. If
    phylink_disconnect_phy is not performed, the Kref of netdev will leak.
    
    Fixes: b8fc9f30821e ("net: ethernet: mediatek: Add basic PHYLINK support")
    Signed-off-by: Liu Jian <liujian56@huawei.com>
    Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Link: https://lore.kernel.org/r/20221117111356.161547-1-liujian56@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: liquidio: simplify if expression [+ + +]
Author: Leon Romanovsky <leon@kernel.org>
Date:   Tue Nov 15 19:34:39 2022 +0200

    net: liquidio: simplify if expression
    
    [ Upstream commit 733d4bbf9514890eb53ebe75827bf1fb4fd25ebe ]
    
    Fix the warning reported by kbuild:
    
    cocci warnings: (new ones prefixed by >>)
    >> drivers/net/ethernet/cavium/liquidio/lio_main.c:1797:54-56: WARNING !A || A && B is equivalent to !A || B
       drivers/net/ethernet/cavium/liquidio/lio_main.c:1827:54-56: WARNING !A || A && B is equivalent to !A || B
    
    Fixes: 8979f428a4af ("net: liquidio: release resources when liquidio driver open failed")
    Reported-by: kernel test robot <lkp@intel.com>
    Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
    Reviewed-by: Saeed Mahameed <saeed@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: mvpp2: fix possible invalid pointer dereference [+ + +]
Author: Hui Tang <tanghui20@huawei.com>
Date:   Thu Nov 17 16:40:32 2022 +0800

    net: mvpp2: fix possible invalid pointer dereference
    
    [ Upstream commit cbe867685386af1f0a2648f5279f6e4c74bfd17f ]
    
    It will cause invalid pointer dereference to priv->cm3_base behind,
    if PTR_ERR(priv->cm3_base) in mvpp2_get_sram().
    
    Fixes: e54ad1e01c00 ("net: mvpp2: add CM3 SRAM memory map")
    Signed-off-by: Hui Tang <tanghui20@huawei.com>
    Link: https://lore.kernel.org/r/20221117084032.101144-1-tanghui20@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: pch_gbe: fix pci device refcount leak while module exiting [+ + +]
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Thu Nov 17 21:51:48 2022 +0800

    net: pch_gbe: fix pci device refcount leak while module exiting
    
    [ Upstream commit 5619537284f1017e9f6c7500b02b859b3830a06d ]
    
    As comment of pci_get_domain_bus_and_slot() says, it returns
    a pci device with refcount increment, when finish using it,
    the caller must decrement the reference count by calling
    pci_dev_put().
    
    In pch_gbe_probe(), pci_get_domain_bus_and_slot() is called,
    so in error path in probe() and remove() function, pci_dev_put()
    should be called to avoid refcount leak. Compile tested only.
    
    Fixes: 1a0bdadb4e36 ("net/pch_gbe: supports eg20t ptp clock")
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Link: https://lore.kernel.org/r/20221117135148.301014-1-yangyingliang@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: pch_gbe: fix potential memleak in pch_gbe_tx_queue() [+ + +]
Author: Wang Hai <wanghai38@huawei.com>
Date:   Thu Nov 17 14:55:27 2022 +0800

    net: pch_gbe: fix potential memleak in pch_gbe_tx_queue()
    
    [ Upstream commit 2360f9b8c4e81d242d4cbf99d630a2fffa681fab ]
    
    In pch_gbe_xmit_frame(), NETDEV_TX_OK will be returned whether
    pch_gbe_tx_queue() sends data successfully or not, so pch_gbe_tx_queue()
    needs to free skb before returning. But pch_gbe_tx_queue() returns without
    freeing skb in case of dma_map_single() fails. Add dev_kfree_skb_any()
    to fix it.
    
    Fixes: 77555ee72282 ("net: Add Gigabit Ethernet driver of Topcliff PCH")
    Signed-off-by: Wang Hai <wanghai38@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: sched: allow act_ct to be built without NF_NAT [+ + +]
Author: Xin Long <lucien.xin@gmail.com>
Date:   Fri Nov 18 16:33:03 2022 -0500

    net: sched: allow act_ct to be built without NF_NAT
    
    [ Upstream commit 8427fd100c7b7793650e212a81e42f1cf124613d ]
    
    In commit f11fe1dae1c4 ("net/sched: Make NET_ACT_CT depends on NF_NAT"),
    it fixed the build failure when NF_NAT is m and NET_ACT_CT is y by
    adding depends on NF_NAT for NET_ACT_CT. However, it would also cause
    NET_ACT_CT cannot be built without NF_NAT, which is not expected. This
    patch fixes it by changing to use "(!NF_NAT || NF_NAT)" as the depend.
    
    Fixes: f11fe1dae1c4 ("net/sched: Make NET_ACT_CT depends on NF_NAT")
    Signed-off-by: Xin Long <lucien.xin@gmail.com>
    Link: https://lore.kernel.org/r/b6386f28d1ba34721795fb776a91cbdabb203447.1668807183.git.lucien.xin@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: sparx5: fix error handling in sparx5_port_open() [+ + +]
Author: Liu Jian <liujian56@huawei.com>
Date:   Thu Nov 17 20:59:18 2022 +0800

    net: sparx5: fix error handling in sparx5_port_open()
    
    [ Upstream commit 4305fe232b8aa59af3761adc9fe6b6aa40913960 ]
    
    If phylink_of_phy_connect() fails, the port should be disabled.
    If sparx5_serdes_set()/phy_power_on() fails, the port should be
    disabled and the phylink should be stopped and disconnected.
    
    Fixes: 946e7fd5053a ("net: sparx5: add port module support")
    Fixes: f3cad2611a77 ("net: sparx5: add hostmode with phylink support")
    Signed-off-by: Liu Jian <liujian56@huawei.com>
    Tested-by: Bjarni Jonasson <bjarni.jonasson@microchip.com>
    Reviewed-by: Steen Hegelund <steen.hegelund@microchip.com>
    Link: https://lore.kernel.org/r/20221117125918.203997-1-liujian56@huawei.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: thunderx: Fix the ACPI memory leak [+ + +]
Author: Yu Liao <liaoyu15@huawei.com>
Date:   Wed Nov 23 16:22:36 2022 +0800

    net: thunderx: Fix the ACPI memory leak
    
    [ Upstream commit 661e5ebbafd26d9d2e3c749f5cf591e55c7364f5 ]
    
    The ACPI buffer memory (string.pointer) should be freed as the buffer is
    not used after returning from bgx_acpi_match_id(), free it to prevent
    memory leak.
    
    Fixes: 46b903a01c05 ("net, thunder, bgx: Add support to get MAC address from ACPI.")
    Signed-off-by: Yu Liao <liaoyu15@huawei.com>
    Link: https://lore.kernel.org/r/20221123082237.1220521-1-liaoyu15@huawei.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: usb: qmi_wwan: add Telit 0x103a composition [+ + +]
Author: Enrico Sau <enrico.sau@gmail.com>
Date:   Tue Nov 15 11:58:59 2022 +0100

    net: usb: qmi_wwan: add Telit 0x103a composition
    
    [ Upstream commit e103ba33998d0f25653cc8ebe745b68d1ee10cda ]
    
    Add the following Telit LE910C4-WWX composition:
    
    0x103a: rmnet
    
    Signed-off-by: Enrico Sau <enrico.sau@gmail.com>
    Acked-by: Bjørn Mork <bjorn@mork.no>
    Link: https://lore.kernel.org/r/20221115105859.14324-1-enrico.sau@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: wwan: iosm: use ACPI_FREE() but not kfree() in ipc_pcie_read_bios_cfg() [+ + +]
Author: Wang ShaoBo <bobo.shaobowang@huawei.com>
Date:   Fri Nov 18 14:24:47 2022 +0800

    net: wwan: iosm: use ACPI_FREE() but not kfree() in ipc_pcie_read_bios_cfg()
    
    [ Upstream commit e541dd7763fc34aec2f93f652a396cc2e7b92d8d ]
    
    acpi_evaluate_dsm() should be coupled with ACPI_FREE() to free the ACPI
    memory, because we need to track the allocation of acpi_object when
    ACPI_DBG_TRACK_ALLOCATIONS enabled, so use ACPI_FREE() instead of kfree().
    
    Fixes: d38a648d2d6c ("net: wwan: iosm: fix memory leak in ipc_pcie_read_bios_cfg")
    Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
    Link: https://lore.kernel.org/r/20221118062447.2324881-1-bobo.shaobowang@huawei.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
netfilter: conntrack: Fix data-races around ct mark [+ + +]
Author: Daniel Xu <dxu@dxuuu.xyz>
Date:   Wed Nov 9 12:39:07 2022 -0700

    netfilter: conntrack: Fix data-races around ct mark
    
    [ Upstream commit 52d1aa8b8249ff477aaa38b6f74a8ced780d079c ]
    
    nf_conn:mark can be read from and written to in parallel. Use
    READ_ONCE()/WRITE_ONCE() for reads and writes to prevent unwanted
    compiler optimizations.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: flowtable_offload: add missing locking [+ + +]
Author: Felix Fietkau <nbd@nbd.name>
Date:   Mon Nov 21 19:26:15 2022 +0100

    netfilter: flowtable_offload: add missing locking
    
    [ Upstream commit bcd9e3c1656d0f7dd9743598c65c3ae24efb38d0 ]
    
    nf_flow_table_block_setup and the driver TC_SETUP_FT call can modify the flow
    block cb list while they are being traversed elsewhere, causing a crash.
    Add a write lock around the calls to protect readers
    
    Fixes: c29f74e0df7a ("netfilter: nf_flow_table: hardware offload support")
    Reported-by: Chad Monroe <chad.monroe@smartrg.com>
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: ipset: regression in ip_set_hash_ip.c [+ + +]
Author: Vishwanath Pai <vpai@akamai.com>
Date:   Wed Sep 28 14:26:50 2022 -0400

    netfilter: ipset: regression in ip_set_hash_ip.c
    
    [ Upstream commit c7aa1a76d4a0a3c401025b60c401412bbb60f8c6 ]
    
    This patch introduced a regression: commit 48596a8ddc46 ("netfilter:
    ipset: Fix adding an IPv4 range containing more than 2^31 addresses")
    
    The variable e.ip is passed to adtfn() function which finally adds the
    ip address to the set. The patch above refactored the for loop and moved
    e.ip = htonl(ip) to the end of the for loop.
    
    What this means is that if the value of "ip" changes between the first
    assignement of e.ip and the forloop, then e.ip is pointing to a
    different ip address than "ip".
    
    Test case:
    $ ipset create jdtest_tmp hash:ip family inet hashsize 2048 maxelem 100000
    $ ipset add jdtest_tmp 10.0.1.1/31
    ipset v6.21.1: Element cannot be added to the set: it's already added
    
    The value of ip gets updated inside the  "else if (tb[IPSET_ATTR_CIDR])"
    block but e.ip is still pointing to the old value.
    
    Fixes: 48596a8ddc46 ("netfilter: ipset: Fix adding an IPv4 range containing more than 2^31 addresses")
    Reviewed-by: Joshua Hunt <johunt@akamai.com>
    Signed-off-by: Vishwanath Pai <vpai@akamai.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: ipset: restore allowing 64 clashing elements in hash:net,iface [+ + +]
Author: Jozsef Kadlecsik <kadlec@netfilter.org>
Date:   Tue Nov 22 20:18:58 2022 +0100

    netfilter: ipset: restore allowing 64 clashing elements in hash:net,iface
    
    [ Upstream commit 6a66ce44a51bdfc47721f0c591137df2d4b21247 ]
    
    The commit 510841da1fcc ("netfilter: ipset: enforce documented limit to
    prevent allocating huge memory") was too strict and prevented to add up to
    64 clashing elements to a hash:net,iface type of set. This patch fixes the
    issue and now the type behaves as documented.
    
    Fixes: 510841da1fcc ("netfilter: ipset: enforce documented limit to prevent allocating huge memory")
    Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: nf_tables: do not set up extensions for end interval [+ + +]
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Mon Nov 14 11:31:54 2022 +0100

    netfilter: nf_tables: do not set up extensions for end interval
    
    [ Upstream commit 33c7aba0b4ffd6d7cdab862a034eb582a5120a38 ]
    
    Elements with an end interval flag set on do not store extensions. The
    global set definition is currently setting on the timeout and stateful
    expression for end interval elements.
    
    This leads to skipping end interval elements from the set->ops->walk()
    path as the expired check bogusly reports true.
    
    Moreover, do not set up stateful expressions for elements with end
    interval flag set on since this is never used.
    
    Fixes: 65038428b2c6 ("netfilter: nf_tables: allow to specify stateful expression in set definition")
    Fixes: 8d8540c4f5e0 ("netfilter: nft_set_rbtree: add timeout support")
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nfc/nci: fix race with opening and closing [+ + +]
Author: Lin Ma <linma@zju.edu.cn>
Date:   Wed Nov 16 21:02:49 2022 +0800

    nfc/nci: fix race with opening and closing
    
    [ Upstream commit 0ad6bded175e829c2ca261529c9dce39a32a042d ]
    
    Previously we leverage NCI_UNREG and the lock inside nci_close_device to
    prevent the race condition between opening a device and closing a
    device. However, it still has problem because a failed opening command
    will erase the NCI_UNREG flag and allow another opening command to
    bypass the status checking.
    
    This fix corrects that by making sure the NCI_UNREG is held.
    
    Reported-by: syzbot+43475bf3cfbd6e41f5b7@syzkaller.appspotmail.com
    Fixes: 48b71a9e66c2 ("NFC: add NCI_UNREG flag to eliminate the race")
    Signed-off-by: Lin Ma <linma@zju.edu.cn>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
NFC: nci: fix memory leak in nci_rx_data_packet() [+ + +]
Author: Liu Shixin <liushixin2@huawei.com>
Date:   Fri Nov 18 16:24:19 2022 +0800

    NFC: nci: fix memory leak in nci_rx_data_packet()
    
    [ Upstream commit 53270fb0fd77fe786d8c07a0793981d797836b93 ]
    
    Syzbot reported a memory leak about skb:
    
    unreferenced object 0xffff88810e144e00 (size 240):
      comm "syz-executor284", pid 3701, jiffies 4294952403 (age 12.620s)
      hex dump (first 32 bytes):
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      backtrace:
        [<ffffffff83ab79a9>] __alloc_skb+0x1f9/0x270 net/core/skbuff.c:497
        [<ffffffff82a5cf64>] alloc_skb include/linux/skbuff.h:1267 [inline]
        [<ffffffff82a5cf64>] virtual_ncidev_write+0x24/0xe0 drivers/nfc/virtual_ncidev.c:116
        [<ffffffff815f6503>] do_loop_readv_writev fs/read_write.c:759 [inline]
        [<ffffffff815f6503>] do_loop_readv_writev fs/read_write.c:743 [inline]
        [<ffffffff815f6503>] do_iter_write+0x253/0x300 fs/read_write.c:863
        [<ffffffff815f66ed>] vfs_writev+0xdd/0x240 fs/read_write.c:934
        [<ffffffff815f68f6>] do_writev+0xa6/0x1c0 fs/read_write.c:977
        [<ffffffff848802d5>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
        [<ffffffff848802d5>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
        [<ffffffff84a00087>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    In nci_rx_data_packet(), if we don't get a valid conn_info, we will return
    directly but forget to release the skb.
    
    Reported-by: syzbot+cdb9a427d1bc08815104@syzkaller.appspotmail.com
    Fixes: 4aeee6871e8c ("NFC: nci: Add dynamic logical connections support")
    Signed-off-by: Liu Shixin <liushixin2@huawei.com>
    Link: https://lore.kernel.org/r/20221118082419.239475-1-liushixin2@huawei.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nfc: st-nci: fix incorrect sizing calculations in EVT_TRANSACTION [+ + +]
Author: Martin Faltesek <mfaltesek@google.com>
Date:   Mon Nov 21 18:42:46 2022 -0600

    nfc: st-nci: fix incorrect sizing calculations in EVT_TRANSACTION
    
    [ Upstream commit 0254f31a7df3bb3b90c2d9dd2d4052f7b95eb287 ]
    
    The transaction buffer is allocated by using the size of the packet buf,
    and subtracting two which seems intended to remove the two tags which are
    not present in the target structure. This calculation leads to under
    counting memory because of differences between the packet contents and the
    target structure. The aid_len field is a u8 in the packet, but a u32 in
    the structure, resulting in at least 3 bytes always being under counted.
    Further, the aid data is a variable length field in the packet, but fixed
    in the structure, so if this field is less than the max, the difference is
    added to the under counting.
    
    To fix, perform validation checks progressively to safely reach the
    next field, to determine the size of both buffers and verify both tags.
    Once all validation checks pass, allocate the buffer and copy the data.
    This eliminates freeing memory on the error path, as validation checks are
    moved ahead of memory allocation.
    
    Reported-by: Denis Efremov <denis.e.efremov@oracle.com>
    Reviewed-by: Guenter Roeck <groeck@google.com>
    Fixes: 5d1ceb7f5e56 ("NFC: st21nfcb: Add HCI transaction event support")
    Signed-off-by: Martin Faltesek <mfaltesek@google.com>
    Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

nfc: st-nci: fix incorrect validating logic in EVT_TRANSACTION [+ + +]
Author: Martin Faltesek <mfaltesek@google.com>
Date:   Mon Nov 21 18:42:44 2022 -0600

    nfc: st-nci: fix incorrect validating logic in EVT_TRANSACTION
    
    [ Upstream commit c60c152230828825c06e62a8f1ce956d4b659266 ]
    
    The first validation check for EVT_TRANSACTION has two different checks
    tied together with logical AND. One is a check for minimum packet length,
    and the other is for a valid aid_tag. If either condition is true (fails),
    then an error should be triggered. The fix is to change && to ||.
    
    Reported-by: Denis Efremov <denis.e.efremov@oracle.com>
    Reviewed-by: Guenter Roeck <groeck@google.com>
    Fixes: 5d1ceb7f5e56 ("NFC: st21nfcb: Add HCI transaction event support")
    Signed-off-by: Martin Faltesek <mfaltesek@google.com>
    Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

nfc: st-nci: fix memory leaks in EVT_TRANSACTION [+ + +]
Author: Martin Faltesek <mfaltesek@google.com>
Date:   Mon Nov 21 18:42:45 2022 -0600

    nfc: st-nci: fix memory leaks in EVT_TRANSACTION
    
    [ Upstream commit 440f2ae9c9f06e26f5dcea697a53717fc61a318c ]
    
    Error path does not free previously allocated memory. Add devm_kfree() to
    the failure path.
    
    Reported-by: Denis Efremov <denis.e.efremov@oracle.com>
    Reviewed-by: Guenter Roeck <groeck@google.com>
    Fixes: 5d1ceb7f5e56 ("NFC: st21nfcb: Add HCI transaction event support")
    Signed-off-by: Martin Faltesek <mfaltesek@google.com>
    Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nfp: add port from netdev validation for EEPROM access [+ + +]
Author: Jaco Coetzee <jaco.coetzee@corigine.com>
Date:   Thu Nov 17 16:37:44 2022 +0100

    nfp: add port from netdev validation for EEPROM access
    
    [ Upstream commit 0873016d46f6dfafd1bdf4d9b935b3331b226f7c ]
    
    Setting of the port flag `NFP_PORT_CHANGED`, introduced
    to ensure the correct reading of EEPROM data, causes a
    fatal kernel NULL pointer dereference in cases where
    the target netdev type cannot be determined.
    
    Add validation of port struct pointer before attempting
    to set the `NFP_PORT_CHANGED` flag. Return that operation
    is not supported if the netdev type cannot be determined.
    
    Fixes: 4ae97cae07e1 ("nfp: ethtool: fix the display error of `ethtool -m DEVNAME`")
    Signed-off-by: Jaco Coetzee <jaco.coetzee@corigine.com>
    Reviewed-by: Louis Peens <louis.peens@corigine.com>
    Signed-off-by: Simon Horman <simon.horman@corigine.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

nfp: fill splittable of devlink_port_attrs correctly [+ + +]
Author: Diana Wang <na.wang@corigine.com>
Date:   Thu Nov 17 16:37:43 2022 +0100

    nfp: fill splittable of devlink_port_attrs correctly
    
    [ Upstream commit 4abd9600b9d15d3d92a9ac25cf200422a4c415ee ]
    
    The error is reflected in that it shows wrong splittable status of
    port when executing "devlink port show".
    The reason which leads the error is that the assigned operation of
    splittable is just a simple negation operation of split and it does
    not consider port lanes quantity. A splittable port should have
    several lanes that can be split(lanes quantity > 1).
    If without the judgement, it will show wrong message for some
    firmware, such as 2x25G, 2x10G.
    
    Fixes: a0f49b548652 ("devlink: Add a new devlink port split ability attribute and pass to netlink")
    Signed-off-by: Diana Wang <na.wang@corigine.com>
    Reviewed-by: Louis Peens <louis.peens@corigine.com>
    Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
    Signed-off-by: Simon Horman <simon.horman@corigine.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nilfs2: fix nilfs_sufile_mark_dirty() not set segment usage as dirty [+ + +]
Author: Chen Zhongjin <chenzhongjin@huawei.com>
Date:   Fri Nov 18 14:33:04 2022 +0800

    nilfs2: fix nilfs_sufile_mark_dirty() not set segment usage as dirty
    
    commit 512c5ca01a3610ab14ff6309db363de51f1c13a6 upstream.
    
    When extending segments, nilfs_sufile_alloc() is called to get an
    unassigned segment, then mark it as dirty to avoid accidentally allocating
    the same segment in the future.
    
    But for some special cases such as a corrupted image it can be unreliable.
    If such corruption of the dirty state of the segment occurs, nilfs2 may
    reallocate a segment that is in use and pick the same segment for writing
    twice at the same time.
    
    This will cause the problem reported by syzkaller:
    https://syzkaller.appspot.com/bug?id=c7c4748e11ffcc367cef04f76e02e931833cbd24
    
    This case started with segbuf1.segnum = 3, nextnum = 4 when constructed.
    It supposed segment 4 has already been allocated and marked as dirty.
    
    However the dirty state was corrupted and segment 4 usage was not dirty.
    For the first time nilfs_segctor_extend_segments() segment 4 was allocated
    again, which made segbuf2 and next segbuf3 had same segment 4.
    
    sb_getblk() will get same bh for segbuf2 and segbuf3, and this bh is added
    to both buffer lists of two segbuf.  It makes the lists broken which
    causes NULL pointer dereference.
    
    Fix the problem by setting usage as dirty every time in
    nilfs_sufile_mark_dirty(), which is called during constructing current
    segment to be written out and before allocating next segment.
    
    [chenzhongjin@huawei.com: add lock protection per Ryusuke]
      Link: https://lkml.kernel.org/r/20221121091141.214703-1-chenzhongjin@huawei.com
    Link: https://lkml.kernel.org/r/20221118063304.140187-1-chenzhongjin@huawei.com
    Fixes: 9ff05123e3bf ("nilfs2: segment constructor")
    Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
    Reported-by: <syzbot+77e4f0...@syzkaller.appspotmail.com>
    Reported-by: Liu Shixin <liushixin2@huawei.com>
    Acked-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Tested-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nios2: add FORCE for vmlinuz.gz [+ + +]
Author: Randy Dunlap <rdunlap@infradead.org>
Date:   Wed Nov 23 19:20:53 2022 -0800

    nios2: add FORCE for vmlinuz.gz
    
    [ Upstream commit 869e4ae4cd2a23d625aaa14ae62dbebf768cb77d ]
    
    Add FORCE to placate a warning from make:
    
    arch/nios2/boot/Makefile:24: FORCE prerequisite is missing
    
    Fixes: 2fc8483fdcde ("nios2: Build infrastructure")
    Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
    Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nvme-pci: add NVME_QUIRK_BOGUS_NID for Micron Nitro [+ + +]
Author: Bean Huo <beanhuo@micron.com>
Date:   Mon Nov 14 14:48:52 2022 +0100

    nvme-pci: add NVME_QUIRK_BOGUS_NID for Micron Nitro
    
    [ Upstream commit d5ceb4d1c50786d21de3d4b06c3f43109ec56dd8 ]
    
    Added a quirk to fix Micron Nitro NVMe reporting duplicate NGUIDs.
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Bean Huo <beanhuo@micron.com>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

nvme-pci: add NVME_QUIRK_BOGUS_NID for Netac NV7000 [+ + +]
Author: Tiago Dias Ferreira <tiagodfer@gmail.com>
Date:   Wed Nov 16 00:17:56 2022 -0300

    nvme-pci: add NVME_QUIRK_BOGUS_NID for Netac NV7000
    
    [ Upstream commit 8d6e38f636ac063e8062a21e7616f7d9bf0df5d8 ]
    
    Added a quirk to fix the Netac NV7000 SSD reporting duplicate NGUIDs.
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Tiago Dias Ferreira <tiagodfer@gmail.com>
    Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

nvme-pci: disable namespace identifiers for the MAXIO MAP1001 [+ + +]
Author: Christoph Hellwig <hch@lst.de>
Date:   Fri May 27 07:32:08 2022 +0200

    nvme-pci: disable namespace identifiers for the MAXIO MAP1001
    
    [ Upstream commit 70ce3455345d056b5fc427c3bb4a3ff4d126b6d5 ]
    
    The MAXIO MAP1001 controllers reports completely bogus Namespace
    identifiers that even change after suspend cycles.  Disable using
    the Identifiers entirely.
    
    Reported-by: Arman Hajishafieha <arman.hajishafieha@hotmail.com>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
    Tested-by: Arman Hajishafieha <arman.hajishafieha@hotmail.com>
    Stable-dep-of: 8d6e38f636ac ("nvme-pci: add NVME_QUIRK_BOGUS_NID for Netac NV7000")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

nvme-pci: disable write zeroes on various Kingston SSD [+ + +]
Author: Xander Li <xander_li@kingston.com.tw>
Date:   Tue Oct 11 04:06:42 2022 -0700

    nvme-pci: disable write zeroes on various Kingston SSD
    
    [ Upstream commit ac9b57d4e1e3ecf0122e915bbba1bd4c90ec3031 ]
    
    Kingston SSDs do support NVMe Write_Zeroes cmd but take long time to
    process.  The firmware version is locked by these SSDs, we can not expect
    firmware improvement, so disable Write_Zeroes cmd.
    
    Signed-off-by: Xander Li <xander_li@kingston.com.tw>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Stable-dep-of: 8d6e38f636ac ("nvme-pci: add NVME_QUIRK_BOGUS_NID for Netac NV7000")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nvme: add a bogus subsystem NQN quirk for Micron MTFDKBA2T0TFH [+ + +]
Author: Leo Savernik <l.savernik@aon.at>
Date:   Wed Jun 22 12:19:21 2022 +0200

    nvme: add a bogus subsystem NQN quirk for Micron MTFDKBA2T0TFH
    
    [ Upstream commit 41f38043f884c66af4114a7109cf540d6222f450 ]
    
    The Micron MTFDKBA2T0TFH device reports the same subsysem NQN for
    all devices.  Add a quick to ignore it.
    
    Signed-off-by: Leo Savernik <l.savernik@aon.at>
    Reviewed-by: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Stable-dep-of: d5ceb4d1c507 ("nvme-pci: add NVME_QUIRK_BOGUS_NID for Micron Nitro")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nvmet: fix memory leak in nvmet_subsys_attr_model_store_locked [+ + +]
Author: Aleksandr Miloserdov <a.miloserdov@yadro.com>
Date:   Wed Oct 26 12:31:33 2022 +0400

    nvmet: fix memory leak in nvmet_subsys_attr_model_store_locked
    
    [ Upstream commit becc4cac309dc867571f0080fde4426a6c2222e0 ]
    
    Since model_number is allocated before it needs to be freed before
    kmemdump_nul.
    
    Reviewed-by: Konstantin Shelekhin <k.shelekhin@yadro.com>
    Reviewed-by: Dmitriy Bogdanov <d.bogdanov@yadro.com>
    Signed-off-by: Aleksandr Miloserdov <a.miloserdov@yadro.com>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
octeontx2-af: debugsfs: fix pci device refcount leak [+ + +]
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Thu Nov 17 20:46:58 2022 +0800

    octeontx2-af: debugsfs: fix pci device refcount leak
    
    [ Upstream commit d66608803aa2ffb9e475623343f69996305771ae ]
    
    As comment of pci_get_domain_bus_and_slot() says, it returns
    a pci device with refcount increment, when finish using it,
    the caller must decrement the reference count by calling
    pci_dev_put().
    
    So before returning from rvu_dbg_rvu_pf_cgx_map_display() or
    cgx_print_dmac_flt(), pci_dev_put() is called to avoid refcount
    leak.
    
    Fixes: dbc52debf95f ("octeontx2-af: Debugfs support for DMAC filters")
    Fixes: e2fb37303865 ("octeontx2-af: Display CGX, NIX and PF map in debugfs.")
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Link: https://lore.kernel.org/r/20221117124658.162409-1-yangyingliang@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

octeontx2-af: Fix reference count issue in rvu_sdp_init() [+ + +]
Author: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Date:   Wed Nov 23 14:59:19 2022 +0800

    octeontx2-af: Fix reference count issue in rvu_sdp_init()
    
    [ Upstream commit ad17c2a3f11b0f6b122e7842d8f7d9a5fcc7ac63 ]
    
    pci_get_device() will decrease the reference count for the *from*
    parameter. So we don't need to call put_device() to decrease the
    reference. Let's remove the put_device() in the loop and only decrease
    the reference count of the returned 'pdev' for the last loop because it
    will not be passed to pci_get_device() as input parameter. We don't need
    to check if 'pdev' is NULL because it is already checked inside
    pci_dev_put(). Also add pci_dev_put() for the error path.
    
    Fixes: fe1939bb2340 ("octeontx2-af: Add SDP interface support")
    Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
    Reviewed-by: Saeed Mahameed <saeed@kernel.org>
    Link: https://lore.kernel.org/r/20221123065919.31499-1-wangxiongfeng2@huawei.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
octeontx2-pf: Add check for devm_kcalloc [+ + +]
Author: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Date:   Tue Nov 22 13:54:49 2022 +0800

    octeontx2-pf: Add check for devm_kcalloc
    
    [ Upstream commit cd07eadd5147ffdae11b6fd28b77a3872f2a2484 ]
    
    As the devm_kcalloc may return NULL pointer,
    it should be better to add check for the return
    value, as same as the others.
    
    Fixes: e8e095b3b370 ("octeontx2-af: cn10k: Bandwidth profiles config support")
    Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
    Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
    Link: https://lore.kernel.org/r/20221122055449.31247-1-jiasheng@iscas.ac.cn
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
platform/x86/intel/hid: Add some ACPI device IDs [+ + +]
Author: Ivan Hu <ivan.hu@canonical.com>
Date:   Wed Nov 2 10:05:48 2022 +0800

    platform/x86/intel/hid: Add some ACPI device IDs
    
    [ Upstream commit a977ece5773b6746b814aac410da4776023db239 ]
    
    Add INTC1076 (JasonLake), INTC1077 (MeteorLake) and INTC1078 (RaptorLake)
    devices IDs.
    
    Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
    Link: https://lore.kernel.org/r/20221102020548.5225-1-ivan.hu@canonical.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
platform/x86/intel/pmt: Sapphire Rapids PMT errata fix [+ + +]
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Fri Nov 4 20:42:28 2022 -0700

    platform/x86/intel/pmt: Sapphire Rapids PMT errata fix
    
    [ Upstream commit bcdfa1f77ea7f67368d20384932a9d1e3047ddd2 ]
    
    On Sapphire Rapids, due to a hardware issue affecting the PUNIT telemetry
    region, reads that are not done in QWORD quantities and alignment may
    return incorrect data. Use a custom 64-bit copy for this region.
    
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20221105034228.1376677-1-david.e.box@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
platform/x86: acer-wmi: Enable SW_TABLET_MODE on Switch V 10 (SW5-017) [+ + +]
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Fri Nov 11 12:16:39 2022 +0100

    platform/x86: acer-wmi: Enable SW_TABLET_MODE on Switch V 10 (SW5-017)
    
    [ Upstream commit 1e817b889c7d8c14e7005258e15fec62edafe03c ]
    
    Like the Acer Switch 10 (SW5-012) and Acer Switch 10 (S1003) models
    the Acer Switch V 10 (SW5-017) supports reporting SW_TABLET_MODE
    through acer-wmi.
    
    Add a DMI quirk for the SW5-017 setting force_caps to ACER_CAP_KBD_DOCK
    (these devices have no other acer-wmi based functionality).
    
    Cc: Rudolf Polzer <rpolzer@google.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20221111111639.35730-1-hdegoede@redhat.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

platform/x86: asus-wmi: add missing pci_dev_put() in asus_wmi_set_xusb2pr() [+ + +]
Author: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Date:   Fri Nov 11 18:07:52 2022 +0800

    platform/x86: asus-wmi: add missing pci_dev_put() in asus_wmi_set_xusb2pr()
    
    [ Upstream commit d0cdd85046b15089df71a50548617ac1025300d0 ]
    
    pci_get_device() will increase the reference count for the returned
    pci_dev. We need to use pci_dev_put() to decrease the reference count
    before asus_wmi_set_xusb2pr() returns.
    
    Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
    Link: https://lore.kernel.org/r/20221111100752.134311-1-wangxiongfeng2@huawei.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

platform/x86: hp-wmi: Ignore Smart Experience App event [+ + +]
Author: Kai-Heng Feng <kai.heng.feng@canonical.com>
Date:   Mon Nov 14 15:38:41 2022 +0800

    platform/x86: hp-wmi: Ignore Smart Experience App event
    
    [ Upstream commit 8b9b6a044b408283b086702b1d9e3cf4ba45b426 ]
    
    Sometimes hp-wmi driver complains on system resume:
    [ 483.116451] hp_wmi: Unknown event_id - 33 - 0x0
    
    According to HP it's a feature called "HP Smart Experience App" and it's
    safe to be ignored.
    
    Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
    Link: https://lore.kernel.org/r/20221114073842.205392-1-kai.heng.feng@canonical.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

platform/x86: ideapad-laptop: Disable touchpad_switch [+ + +]
Author: Manyi Li <limanyi@uniontech.com>
Date:   Tue Oct 18 17:53:23 2022 +0800

    platform/x86: ideapad-laptop: Disable touchpad_switch
    
    [ Upstream commit a231224a601c1924b9df620281ad04472900d75f ]
    
    Ideapads for "Lenovo Yoga 3 Pro 1370" and "ZhaoYang K4e-IML" do not
    use EC to switch touchpad.
    
    Reading VPCCMD_R_TOUCHPAD will return zero thus touchpad may be blocked
    unexpectedly.
    
    Signed-off-by: Manyi Li <limanyi@uniontech.com>
    Link: https://lore.kernel.org/r/20221018095323.14591-1-limanyi@uniontech.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

platform/x86: ideapad-laptop: Fix interrupt storm on fn-lock toggle on some Yoga laptops [+ + +]
Author: Arnav Rawat <arnavr3@illinois.edu>
Date:   Fri Nov 11 14:32:09 2022 +0000

    platform/x86: ideapad-laptop: Fix interrupt storm on fn-lock toggle on some Yoga laptops
    
    [ Upstream commit 81a5603a0f50fd7cf17ff21d106052215eaf2028 ]
    
    Commit 3ae86d2d4704 ("platform/x86: ideapad-laptop: Fix Legion 5 Fn lock
    LED") uses the WMI event-id for the fn-lock event on some Legion 5 laptops
    to manually toggle the fn-lock LED because the EC does not do it itself.
    However, the same WMI ID is also sent on some Yoga laptops. Here, setting
    the fn-lock state is not valid behavior, and causes the EC to spam
    interrupts until the laptop is rebooted.
    
    Add a set_fn_lock_led_list[] DMI-id list and only enable the workaround to
    manually set the LED on models on this list.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=212671
    Cc: Meng Dong <whenov@gmail.com>
    Signed-off-by: Arnav Rawat <arnavr3@illinois.edu>
    Link: https://lore.kernel.org/r/12093851.O9o76ZdvQC@fedora
    [hdegoede@redhat.com: Check DMI-id list only once and store the result]
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

platform/x86: touchscreen_dmi: Add info for the RCA Cambio W101 v2 2-in-1 [+ + +]
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Tue Oct 25 16:11:31 2022 +0200

    platform/x86: touchscreen_dmi: Add info for the RCA Cambio W101 v2 2-in-1
    
    [ Upstream commit 0df044b34bf33e7e35c32b3bf6747fde6279c162 ]
    
    Add touchscreen info for the RCA Cambio W101 v2 2-in-1.
    
    Link: https://github.com/onitake/gsl-firmware/discussions/193
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20221025141131.509211-1-hdegoede@redhat.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
regulator: core: fix kobject release warning and memory leak in regulator_register() [+ + +]
Author: Zeng Heng <zengheng4@huawei.com>
Date:   Wed Nov 16 15:43:39 2022 +0800

    regulator: core: fix kobject release warning and memory leak in regulator_register()
    
    [ Upstream commit 5f4b204b6b8153923d5be8002c5f7082985d153f ]
    
    Here is a warning report about lack of registered release()
    from kobject lib:
    
    Device '(null)' does not have a release() function, it is broken and must be fixed.
    WARNING: CPU: 0 PID: 48430 at drivers/base/core.c:2332 device_release+0x104/0x120
    Call Trace:
     kobject_put+0xdc/0x180
     put_device+0x1b/0x30
     regulator_register+0x651/0x1170
     devm_regulator_register+0x4f/0xb0
    
    When regulator_register() returns fail and directly goto `clean` symbol,
    rdev->dev has not registered release() function yet (which is registered
    by regulator_class in the following), so rdev needs to be freed manually.
    If rdev->dev.of_node is not NULL, which means the of_node has gotten by
    regulator_of_get_init_data(), it needs to call of_node_put() to avoid
    refcount leak.
    
    Otherwise, only calling put_device() would lead memory leak of rdev
    in further:
    
    unreferenced object 0xffff88810d0b1000 (size 2048):
      comm "107-i2c-rtq6752", pid 48430, jiffies 4342258431 (age 1341.780s)
      backtrace:
        kmalloc_trace+0x22/0x110
        regulator_register+0x184/0x1170
        devm_regulator_register+0x4f/0xb0
    
    When regulator_register() returns fail and goto `wash` symbol,
    rdev->dev has registered release() function, so directly call
    put_device() to cleanup everything.
    
    Fixes: d3c731564e09 ("regulator: plug of_node leak in regulator_register()'s error path")
    Signed-off-by: Zeng Heng <zengheng4@huawei.com>
    Link: https://lore.kernel.org/r/20221116074339.1024240-1-zengheng4@huawei.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

regulator: core: fix UAF in destroy_regulator() [+ + +]
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Wed Nov 16 11:37:06 2022 +0800

    regulator: core: fix UAF in destroy_regulator()
    
    [ Upstream commit 1f386d6894d0f1b7de8ef640c41622ddd698e7ab ]
    
    I got a UAF report as following:
    
    ==================================================================
    BUG: KASAN: use-after-free in __lock_acquire+0x935/0x2060
    Read of size 8 at addr ffff88810e838220 by task python3/268
    Call Trace:
     <TASK>
     dump_stack_lvl+0x67/0x83
     print_report+0x178/0x4b0
     kasan_report+0x90/0x190
     __lock_acquire+0x935/0x2060
     lock_acquire+0x156/0x400
     _raw_spin_lock+0x2a/0x40
     lockref_get+0x11/0x30
     simple_recursive_removal+0x41/0x440
     debugfs_remove.part.12+0x32/0x50
     debugfs_remove+0x29/0x30
     _regulator_put.cold.54+0x3e/0x27f
     regulator_put+0x1f/0x30
     release_nodes+0x6a/0xa0
     devres_release_all+0xf8/0x150
    
    Allocated by task 37:
     kasan_save_stack+0x1c/0x40
     kasan_set_track+0x21/0x30
     __kasan_slab_alloc+0x5d/0x70
     slab_post_alloc_hook+0x62/0x510
     kmem_cache_alloc_lru+0x222/0x5a0
     __d_alloc+0x31/0x440
     d_alloc+0x30/0xf0
     d_alloc_parallel+0xc4/0xd20
     __lookup_slow+0x15e/0x2f0
     lookup_one_len+0x13a/0x150
     start_creating+0xea/0x190
     debugfs_create_dir+0x1e/0x210
     create_regulator+0x254/0x4e0
     _regulator_get+0x2a1/0x467
     _devm_regulator_get+0x5a/0xb0
     regulator_virtual_probe+0xb9/0x1a0
    
    Freed by task 30:
     kasan_save_stack+0x1c/0x40
     kasan_set_track+0x21/0x30
     kasan_save_free_info+0x2a/0x50
     __kasan_slab_free+0x102/0x190
     kmem_cache_free+0xf6/0x600
     rcu_core+0x54c/0x12b0
     __do_softirq+0xf2/0x5e3
    
    Last potentially related work creation:
     kasan_save_stack+0x1c/0x40
     __kasan_record_aux_stack+0x98/0xb0
     call_rcu+0x42/0x700
     dentry_free+0x6c/0xd0
     __dentry_kill+0x23b/0x2d0
     dput.part.31+0x431/0x780
     simple_recursive_removal+0xa9/0x440
     debugfs_remove.part.12+0x32/0x50
     debugfs_remove+0x29/0x30
     regulator_unregister+0xe3/0x230
     release_nodes+0x6a/0xa0
    
    ==================================================================
    
    Here is how happened:
    
    processor A                                     processor B
    regulator_register()
      rdev_init_debugfs()
        rdev->debugfs = debugfs_create_dir()
                                                    devm_regulator_get()
                                                      rdev = regulator_dev_lookup()
                                                      create_regulator(rdev)
                                                        // using rdev->debugfs as parent
                                                        debugfs_create_dir(rdev->debugfs)
    
    mfd_remove_devices_fn()
      release_nodes()
        regulator_unregister()
          // free rdev->debugfs
          debugfs_remove_recursive(rdev->debugfs)
                                                    release_nodes()
                                                      destroy_regulator()
                                                        debugfs_remove_recursive() <- causes UAF
    
    In devm_regulator_get(), after getting rdev, the refcount
    is get, so fix this by moving debugfs_remove_recursive()
    to regulator_dev_release(), then it can be proctected by
    the refcount, the 'rdev->debugfs' can not be freed until
    the refcount is 0.
    
    Fixes: 5de705194e98 ("regulator: Add basic per consumer debugfs")
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Link: https://lore.kernel.org/r/20221116033706.3595812-1-yangyingliang@huawei.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

regulator: twl6030: re-add TWL6032_SUBCLASS [+ + +]
Author: Andreas Kemnade <andreas@kemnade.info>
Date:   Sun Nov 20 23:12:07 2022 +0100

    regulator: twl6030: re-add TWL6032_SUBCLASS
    
    [ Upstream commit 3d6c982b26db94cc21bc9f7784f63e8286b7be62 ]
    
    In former times, info->feature was populated via the parent driver
    by pdata/regulator_init_data->driver_data for all regulators when
    USB_PRODUCT_ID_LSB indicates a TWL6032.
    Today, the information is not set, so re-add it at the regulator
    definitions.
    
    Fixes: 25d82337705e2 ("regulator: twl: make driver DT only")
    Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
    Link: https://lore.kernel.org/r/20221120221208.3093727-2-andreas@kemnade.info
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Revert "drm/amdgpu: Revert "drm/amdgpu: getting fan speed pwm for vega10 properly"" [+ + +]
Author: Asher Song <Asher.Song@amd.com>
Date:   Thu Nov 3 18:28:40 2022 +0800

    Revert "drm/amdgpu: Revert "drm/amdgpu: getting fan speed pwm for vega10 properly""
    
    [ Upstream commit 30b8e7b8ee3be003e0df85c857c5cd0e0bd58b82 ]
    
    This reverts commit 4545ae2ed3f2f7c3f615a53399c9c8460ee5bca7.
    
    The origin patch "drm/amdgpu: getting fan speed pwm for vega10 properly" works fine.
    Test failure is caused by test case self.
    
    Signed-off-by: Asher Song <Asher.Song@amd.com>
    Reviewed-by: Guchun Chen <guchun.chen@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Revert "net: macsec: report real_dev features when HW offloading is enabled" [+ + +]
Author: Sabrina Dubroca <sd@queasysnail.net>
Date:   Wed Nov 2 22:33:12 2022 +0100

    Revert "net: macsec: report real_dev features when HW offloading is enabled"
    
    [ Upstream commit 8bcd560ae8784da57c610d857118c5d6576b1a8f ]
    
    This reverts commit c850240b6c4132574a00f2da439277ab94265b66.
    
    That commit tried to improve the performance of macsec offload by
    taking advantage of some of the NIC's features, but in doing so, broke
    macsec offload when the lower device supports both macsec and ipsec
    offload, as the ipsec offload feature flags (mainly NETIF_F_HW_ESP)
    were copied from the real device. Since the macsec device doesn't
    provide xdo_* ops, the XFRM core rejects the registration of the new
    macsec device in xfrm_api_check.
    
    Example perf trace when running
      ip link add link eni1np1 type macsec port 4 offload mac
    
        ip   737 [003]   795.477676: probe:xfrm_dev_event__REGISTER      name="macsec0" features=0x1c000080014869
                  xfrm_dev_event+0x3a
                  notifier_call_chain+0x47
                  register_netdevice+0x846
                  macsec_newlink+0x25a
    
        ip   737 [003]   795.477687:   probe:xfrm_dev_event__return      ret=0x8002 (NOTIFY_BAD)
                 notifier_call_chain+0x47
                 register_netdevice+0x846
                 macsec_newlink+0x25a
    
    dev->features includes NETIF_F_HW_ESP (0x04000000000000), so
    xfrm_api_check returns NOTIFY_BAD because we don't have
    dev->xfrmdev_ops on the macsec device.
    
    We could probably propagate GSO and a few other features from the
    lower device, similar to macvlan. This will be done in a future patch.
    
    Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
    Reviewed-by: Antoine Tenart <atenart@kernel.org>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
RISC-V: vdso: Do not add missing symbols to version section in linker script [+ + +]
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Tue Nov 8 10:13:23 2022 -0700

    RISC-V: vdso: Do not add missing symbols to version section in linker script
    
    [ Upstream commit fcae44fd36d052e956e69a64642fc03820968d78 ]
    
    Recently, ld.lld moved from '--undefined-version' to
    '--no-undefined-version' as the default, which breaks the compat vDSO
    build:
    
      ld.lld: error: version script assignment of 'LINUX_4.15' to symbol '__vdso_gettimeofday' failed: symbol not defined
      ld.lld: error: version script assignment of 'LINUX_4.15' to symbol '__vdso_clock_gettime' failed: symbol not defined
      ld.lld: error: version script assignment of 'LINUX_4.15' to symbol '__vdso_clock_getres' failed: symbol not defined
    
    These symbols are not present in the compat vDSO or the regular vDSO for
    32-bit but they are unconditionally included in the version section of
    the linker script, which is prohibited with '--no-undefined-version'.
    
    Fix this issue by only including the symbols that are actually exported
    in the version section of the linker script.
    
    Link: https://github.com/ClangBuiltLinux/linux/issues/1756
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Tested-by: Conor Dooley <conor.dooley@microchip.com>
    Link: https://lore.kernel.org/r/20221108171324.3377226-1-nathan@kernel.org/
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
riscv: dts: sifive unleashed: Add PWM controlled LEDs [+ + +]
Author: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Date:   Wed Oct 12 13:09:28 2022 +0200

    riscv: dts: sifive unleashed: Add PWM controlled LEDs
    
    [ Upstream commit 8bc8824d30193eb7755043d5bb65fa7f0d11a595 ]
    
    This adds the 4 PWM controlled green LEDs to the HiFive Unleashed device
    tree. The schematic doesn't specify any special function for the LEDs,
    so they're added here without any default triggers and named d1, d2, d3
    and d4 just like in the schematic.
    
    Signed-off-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
    Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
    Tested-by: Conor Dooley <conor.dooley@microchip.com>
    Link: https://lore.kernel.org/r/20221012110928.352910-1-emil.renner.berthing@canonical.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
rxrpc: Allow list of in-use local UDP endpoints to be viewed in /proc [+ + +]
Author: David Howells <dhowells@redhat.com>
Date:   Sat May 21 08:45:15 2022 +0100

    rxrpc: Allow list of in-use local UDP endpoints to be viewed in /proc
    
    [ Upstream commit 33912c2639ad76660988c8ca97e4d18fca89b668 ]
    
    Allow the list of in-use local UDP endpoints in the current network
    namespace to be viewed in /proc.
    
    To aid with this, the endpoint list is converted to an hlist and RCU-safe
    manipulation is used so that the list can be read with only the RCU
    read lock held.
    
    Signed-off-by: David Howells <dhowells@redhat.com>
    cc: Marc Dionne <marc.dionne@auristor.com>
    cc: linux-afs@lists.infradead.org
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Stable-dep-of: 3bcd6c7eaa53 ("rxrpc: Fix race between conn bundle lookup and bundle removal [ZDI-CAN-15975]")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

rxrpc: Fix race between conn bundle lookup and bundle removal [ZDI-CAN-15975] [+ + +]
Author: David Howells <dhowells@redhat.com>
Date:   Wed Nov 16 14:02:28 2022 +0000

    rxrpc: Fix race between conn bundle lookup and bundle removal [ZDI-CAN-15975]
    
    [ Upstream commit 3bcd6c7eaa53b56c3f584da46a1f7652e759d0e5 ]
    
    After rxrpc_unbundle_conn() has removed a connection from a bundle, it
    checks to see if there are any conns with available channels and, if not,
    removes and attempts to destroy the bundle.
    
    Whilst it does check after grabbing client_bundles_lock that there are no
    connections attached, this races with rxrpc_look_up_bundle() retrieving the
    bundle, but not attaching a connection for the connection to be attached
    later.
    
    There is therefore a window in which the bundle can get destroyed before we
    manage to attach a new connection to it.
    
    Fix this by adding an "active" counter to struct rxrpc_bundle:
    
     (1) rxrpc_connect_call() obtains an active count by prepping/looking up a
         bundle and ditches it before returning.
    
     (2) If, during rxrpc_connect_call(), a connection is added to the bundle,
         this obtains an active count, which is held until the connection is
         discarded.
    
     (3) rxrpc_deactivate_bundle() is created to drop an active count on a
         bundle and destroy it when the active count reaches 0.  The active
         count is checked inside client_bundles_lock() to prevent a race with
         rxrpc_look_up_bundle().
    
     (4) rxrpc_unbundle_conn() then calls rxrpc_deactivate_bundle().
    
    Fixes: 245500d853e9 ("rxrpc: Rewrite the client connection manager")
    Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-15975
    Signed-off-by: David Howells <dhowells@redhat.com>
    Tested-by: zdi-disclosures@trendmicro.com
    cc: Marc Dionne <marc.dionne@auristor.com>
    cc: linux-afs@lists.infradead.org
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

rxrpc: Use refcount_t rather than atomic_t [+ + +]
Author: David Howells <dhowells@redhat.com>
Date:   Sat May 21 08:45:22 2022 +0100

    rxrpc: Use refcount_t rather than atomic_t
    
    [ Upstream commit a05754295e01f006a651eec759c5dbe682ef6cef ]
    
    Move to using refcount_t rather than atomic_t for refcounts in rxrpc.
    
    Signed-off-by: David Howells <dhowells@redhat.com>
    cc: Marc Dionne <marc.dionne@auristor.com>
    cc: linux-afs@lists.infradead.org
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Stable-dep-of: 3bcd6c7eaa53 ("rxrpc: Fix race between conn bundle lookup and bundle removal [ZDI-CAN-15975]")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
s390/crashdump: fix TOD programmable field size [+ + +]
Author: Heiko Carstens <hca@linux.ibm.com>
Date:   Fri Nov 18 13:05:39 2022 +0100

    s390/crashdump: fix TOD programmable field size
    
    [ Upstream commit f44e07a8afdd713ddc1a8832c39372fe5dd86895 ]
    
    The size of the TOD programmable field was incorrectly increased from
    four to eight bytes with commit 1a2c5840acf9 ("s390/dump: cleanup CPU
    save area handling").
    This leads to an elf notes section NT_S390_TODPREG which has a size of
    eight instead of four bytes in case of kdump, however even worse is
    that the contents is incorrect: it is supposed to contain only the
    contents of the TOD programmable field, but in fact contains a mix of
    the TOD programmable field (32 bit upper bits) and parts of the CPU
    timer register (lower 32 bits).
    
    Fix this by simply changing the size of the todpreg field within the
    save area structure. This will implicitly also fix the size of the
    corresponding elf notes sections.
    
    This also gets rid of this compile time warning:
    
    in function ‘fortify_memcpy_chk’,
        inlined from ‘save_area_add_regs’ at arch/s390/kernel/crash_dump.c:99:2:
    ./include/linux/fortify-string.h:413:25: error: call to ‘__read_overflow2_field’
       declared with attribute warning: detected read beyond size of field
       (2nd parameter); maybe use struct_group()? [-Werror=attribute-warning]
      413 |                         __read_overflow2_field(q_size_field, size);
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Fixes: 1a2c5840acf9 ("s390/dump: cleanup CPU save area handling")
    Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
s390/dasd: fix no record found for raw_track_access [+ + +]
Author: Stefan Haberland <sth@linux.ibm.com>
Date:   Wed Nov 23 17:07:18 2022 +0100

    s390/dasd: fix no record found for raw_track_access
    
    [ Upstream commit 590ce6d96d6a224b470a3862c33a483d5022bfdb ]
    
    For DASD devices in raw_track_access mode only full track images are
    read and written.
    For this purpose it is not necessary to do search operation in the
    locate record extended function. The documentation even states that
    this might fail if the searched record is not found on a track.
    
    Currently the driver sets a value of 1 in the search field for the first
    record after record zero. This is the default for disks not in
    raw_track_access mode but record 1 might be missing on a completely
    empty track.
    
    There has not been any problem with this on IBM storage servers but it
    might lead to errors with DASD devices on other vendors storage servers.
    
    Fix this by setting the search field to 0. Record zero is always available
    even on a completely empty track.
    
    Fixes: e4dbb0f2b5dd ("[S390] dasd: Add support for raw ECKD access.")
    Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
    Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
    Link: https://lore.kernel.org/r/20221123160719.3002694-4-sth@linux.ibm.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
scsi: ibmvfc: Avoid path failures during live migration [+ + +]
Author: Brian King <brking@linux.vnet.ibm.com>
Date:   Wed Oct 26 13:13:56 2022 -0500

    scsi: ibmvfc: Avoid path failures during live migration
    
    [ Upstream commit 62fa3ce05d5d73c5eccc40b2db493f55fecfc446 ]
    
    Fix an issue reported when performing a live migration when multipath is
    configured with a short fast fail timeout of 5 seconds and also to have
    no_path_retry set to fail. In this scenario, all paths would go into the
    devloss state while the ibmvfc driver went through discovery to log back
    in. On a loaded system, the discovery might take longer than 5 seconds,
    which was resulting in all paths being marked failed, which then resulted
    in a read only filesystem.
    
    This patch changes the migration code in ibmvfc to avoid deleting rports at
    all in this scenario, so we avoid losing all paths.
    
    Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
    Link: https://lore.kernel.org/r/20221026181356.148517-1-brking@linux.vnet.ibm.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: iscsi: Fix possible memory leak when device_register() failed [+ + +]
Author: Zhou Guanghui <zhouguanghui1@huawei.com>
Date:   Thu Nov 10 03:37:29 2022 +0000

    scsi: iscsi: Fix possible memory leak when device_register() failed
    
    [ Upstream commit f014165faa7b953b81dcbf18835936e5f8d01f2a ]
    
    If device_register() returns error, the name allocated by the
    dev_set_name() need be freed. As described in the comment of
    device_register(), we should use put_device() to give up the reference in
    the error path.
    
    Fix this by calling put_device(), the name will be freed in the
    kobject_cleanup(), and this patch modified resources will be released by
    calling the corresponding callback function in the device_release().
    
    Signed-off-by: Zhou Guanghui <zhouguanghui1@huawei.com>
    Link: https://lore.kernel.org/r/20221110033729.1555-1-zhouguanghui1@huawei.com
    Reviewed-by: Mike Christie <michael.christie@oracle.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: scsi_debug: Make the READ CAPACITY response compliant with ZBC [+ + +]
Author: Bart Van Assche <bvanassche@acm.org>
Date:   Wed Nov 2 12:32:48 2022 -0700

    scsi: scsi_debug: Make the READ CAPACITY response compliant with ZBC
    
    [ Upstream commit ecb8c2580d37dbb641451049376d80c8afaa387f ]
    
    From ZBC-1:
    
     - RC BASIS = 0: The RETURNED LOGICAL BLOCK ADDRESS field indicates the
       highest LBA of a contiguous range of zones that are not sequential write
       required zones starting with the first zone.
    
     - RC BASIS = 1: The RETURNED LOGICAL BLOCK ADDRESS field indicates the LBA
       of the last logical block on the logical unit.
    
    The current scsi_debug READ CAPACITY response does not comply with the
    above if there are one or more sequential write required zones. SCSI
    initiators need a way to retrieve the largest valid LBA from SCSI
    devices. Reporting the largest valid LBA if there are one or more
    sequential zones requires to set the RC BASIS field in the READ CAPACITY
    response to one. Hence this patch.
    
    Cc: Douglas Gilbert <dgilbert@interlog.com>
    Cc: Damien Le Moal <damien.lemoal@opensource.wdc.com>
    Suggested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
    Signed-off-by: Bart Van Assche <bvanassche@acm.org>
    Link: https://lore.kernel.org/r/20221102193248.3177608-1-bvanassche@acm.org
    Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
    Acked-by: Douglas Gilbert <dgilbert@interlog.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: storvsc: Fix handling of srb_status and capacity change events [+ + +]
Author: Michael Kelley <mikelley@microsoft.com>
Date:   Wed Nov 9 10:48:42 2022 -0800

    scsi: storvsc: Fix handling of srb_status and capacity change events
    
    [ Upstream commit b8a5376c321b4669f7ffabc708fd30c3970f3084 ]
    
    Current handling of the srb_status is incorrect. Commit 52e1b3b3daa9
    ("scsi: storvsc: Correctly handle multiple flags in srb_status")
    is based on srb_status being a set of flags, when in fact only the
    2 high order bits are flags and the remaining 6 bits are an integer
    status. Because the integer values of interest mostly look like flags,
    the code actually works when treated that way.
    
    But in the interest of correctness going forward, fix this by treating
    the low 6 bits of srb_status as an integer status code. Add handling
    for SRB_STATUS_INVALID_REQUEST, which was the original intent of commit
    52e1b3b3daa9. Furthermore, treat the ERROR, ABORTED, and INVALID_REQUEST
    srb status codes as essentially equivalent for the cases we care about.
    There's no harm in doing so, and it isn't always clear which status code
    current or older versions of Hyper-V report for particular conditions.
    
    Treating the srb status codes as equivalent has the additional benefit
    of ensuring that capacity change events result in an immediate rescan
    so that the new size is known to Linux. Existing code checks SCSI
    sense data for capacity change events when the srb status is ABORTED.
    But capacity change events are also being observed when Hyper-V reports
    the srb status as ERROR. Without the immediate rescan, the new size
    isn't known until something else causes a rescan (such as running
    fdisk to expand a partition), and in the meantime, tools such as "lsblk"
    continue to report the old size.
    
    Fixes: 52e1b3b3daa9 ("scsi: storvsc: Correctly handle multiple flags in srb_status")
    Reported-by: Juan Tian <juantian@microsoft.com>
    Signed-off-by: Michael Kelley <mikelley@microsoft.com>
    Link: https://lore.kernel.org/r/1668019722-1983-1-git-send-email-mikelley@microsoft.com
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
sctp: clear out_curr if all frag chunks of current msg are pruned [+ + +]
Author: Xin Long <lucien.xin@gmail.com>
Date:   Fri Nov 4 17:45:16 2022 -0400

    sctp: clear out_curr if all frag chunks of current msg are pruned
    
    [ Upstream commit 2f201ae14ae0f91dbf1cffea7bb1e29e81d4d108 ]
    
    A crash was reported by Zhen Chen:
    
      list_del corruption, ffffa035ddf01c18->next is NULL
      WARNING: CPU: 1 PID: 250682 at lib/list_debug.c:49 __list_del_entry_valid+0x59/0xe0
      RIP: 0010:__list_del_entry_valid+0x59/0xe0
      Call Trace:
       sctp_sched_dequeue_common+0x17/0x70 [sctp]
       sctp_sched_fcfs_dequeue+0x37/0x50 [sctp]
       sctp_outq_flush_data+0x85/0x360 [sctp]
       sctp_outq_uncork+0x77/0xa0 [sctp]
       sctp_cmd_interpreter.constprop.0+0x164/0x1450 [sctp]
       sctp_side_effects+0x37/0xe0 [sctp]
       sctp_do_sm+0xd0/0x230 [sctp]
       sctp_primitive_SEND+0x2f/0x40 [sctp]
       sctp_sendmsg_to_asoc+0x3fa/0x5c0 [sctp]
       sctp_sendmsg+0x3d5/0x440 [sctp]
       sock_sendmsg+0x5b/0x70
    
    and in sctp_sched_fcfs_dequeue() it dequeued a chunk from stream
    out_curr outq while this outq was empty.
    
    Normally stream->out_curr must be set to NULL once all frag chunks of
    current msg are dequeued, as we can see in sctp_sched_dequeue_done().
    However, in sctp_prsctp_prune_unsent() as it is not a proper dequeue,
    sctp_sched_dequeue_done() is not called to do this.
    
    This patch is to fix it by simply setting out_curr to NULL when the
    last frag chunk of current msg is dequeued from out_curr stream in
    sctp_prsctp_prune_unsent().
    
    Fixes: 5bbbbe32a431 ("sctp: introduce stream scheduler foundations")
    Reported-by: Zhen Chen <chenzhen126@huawei.com>
    Tested-by: Caowangbao <caowangbao@huawei.com>
    Signed-off-by: Xin Long <lucien.xin@gmail.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

sctp: remove the unnecessary sinfo_stream check in sctp_prsctp_prune_unsent [+ + +]
Author: Xin Long <lucien.xin@gmail.com>
Date:   Fri Nov 4 17:45:15 2022 -0400

    sctp: remove the unnecessary sinfo_stream check in sctp_prsctp_prune_unsent
    
    [ Upstream commit 9f0b773210c27a8f5d98ddb2fc4ba60a42a3285f ]
    
    Since commit 5bbbbe32a431 ("sctp: introduce stream scheduler foundations"),
    sctp_stream_outq_migrate() has been called in sctp_stream_init/update to
    removes those chunks to streams higher than the new max. There is no longer
    need to do such check in sctp_prsctp_prune_unsent().
    
    Signed-off-by: Xin Long <lucien.xin@gmail.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 2f201ae14ae0 ("sctp: clear out_curr if all frag chunks of current msg are pruned")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
selftests/bpf: Add verifier test for release_reference() [+ + +]
Author: Youlin Li <liulin063@gmail.com>
Date:   Thu Nov 3 17:34:40 2022 +0800

    selftests/bpf: Add verifier test for release_reference()
    
    [ Upstream commit 475244f5e06beeda7b557d9dde46a5f439bf3379 ]
    
    Add a test case to ensure that released pointer registers will not be
    leaked into the map.
    
    Before fix:
    
      ./test_verifier 984
        984/u reference tracking: try to leak released ptr reg FAIL
        Unexpected success to load!
        verification time 67 usec
        stack depth 4
        processed 23 insns (limit 1000000) max_states_per_insn 0 total_states 2
        peak_states 2 mark_read 1
        984/p reference tracking: try to leak released ptr reg OK
        Summary: 1 PASSED, 0 SKIPPED, 1 FAILED
    
    After fix:
    
      ./test_verifier 984
        984/u reference tracking: try to leak released ptr reg OK
        984/p reference tracking: try to leak released ptr reg OK
        Summary: 2 PASSED, 0 SKIPPED, 0 FAILED
    
    Signed-off-by: Youlin Li <liulin063@gmail.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Link: https://lore.kernel.org/bpf/20221103093440.3161-2-liulin063@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
selftests: mptcp: fix mibit vs mbit mix up [+ + +]
Author: Matthieu Baerts <matthieu.baerts@tessares.net>
Date:   Tue Nov 15 14:10:46 2022 -0800

    selftests: mptcp: fix mibit vs mbit mix up
    
    [ Upstream commit 3de88b95c4d436d78afc0266a0bed76c35ddeb62 ]
    
    The estimated time was supposing the rate was expressed in mibit
    (bit * 1024^2) but it is in mbit (bit * 1000^2).
    
    This makes the threshold higher but in a more realistic way to avoid
    false positives reported by CI instances.
    
    Before this patch, the thresholds were at 7561/4005ms and now they are
    at 7906/4178ms.
    
    While at it, also fix a typo in the linked comment, spotted by Mat.
    
    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/310
    Fixes: 1a418cb8e888 ("mptcp: simult flow self-tests")
    Suggested-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
    Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

selftests: mptcp: more stable simult_flows tests [+ + +]
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Fri Oct 29 16:55:59 2021 -0700

    selftests: mptcp: more stable simult_flows tests
    
    [ Upstream commit b6ab64b074f29b42ff272793806efc913f7cc742 ]
    
    Currently the simult_flows.sh self-tests are not very stable,
    especially when running on slow VMs.
    
    The tests measure runtime for transfers on multiple subflows
    and check that the time is near the theoretical maximum.
    
    The current test infra introduces a bit of jitter in test
    runtime, due to multiple explicit delays. Additionally the
    runtime is measured by the shell script wrapper. On a slow
    VM, the script overhead is measurable and subject to relevant
    jitter.
    
    One solution to make the test more stable would be adding more
    slack to the expected time; that could possibly hide real
    regressions. Instead move the measurement inside the command
    doing the transfer, and drop most unneeded sleeps.
    
    Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Stable-dep-of: 3de88b95c4d4 ("selftests: mptcp: fix mibit vs mbit mix up")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
serial: 8250: 8250_omap: Avoid RS485 RTS glitch on ->set_termios() [+ + +]
Author: Lukas Wunner <lukas@wunner.de>
Date:   Tue Sep 27 13:52:34 2022 +0200

    serial: 8250: 8250_omap: Avoid RS485 RTS glitch on ->set_termios()
    
    [ Upstream commit 038ee49fef18710bedd38b531d173ccd746b2d8d ]
    
    RS485-enabled UART ports on TI Sitara SoCs with active-low polarity
    exhibit a Transmit Enable glitch on ->set_termios():
    
    omap8250_restore_regs(), which is called from omap_8250_set_termios(),
    sets the TCRTLR bit in the MCR register and clears all other bits,
    including RTS.  If RTS uses active-low polarity, it is now asserted
    for no reason.
    
    The TCRTLR bit is subsequently cleared by writing up->mcr to the MCR
    register.  That variable is always zero, so the RTS bit is still cleared
    (incorrectly so if RTS is active-high).
    
    (up->mcr is not, as one might think, a cache of the MCR register's
    current value.  Rather, it only caches a single bit of that register,
    the AFE bit.  And it only does so if the UART supports the AFE bit,
    which OMAP does not.  For details see serial8250_do_set_termios() and
    serial8250_do_set_mctrl().)
    
    Finally at the end of omap8250_restore_regs(), the MCR register is
    restored (and RTS deasserted) by a call to up->port.ops->set_mctrl()
    (which equals serial8250_set_mctrl()) and serial8250_em485_stop_tx().
    
    So there's an RTS glitch between setting TCRTLR and calling
    serial8250_em485_stop_tx().  Avoid by using a read-modify-write
    when setting TCRTLR.
    
    While at it, drop a redundant initialization of up->mcr.  As explained
    above, the variable isn't used by the driver and it is already
    initialized to zero because it is part of the static struct
    serial8250_ports[] declared in 8250_core.c.  (Static structs are
    initialized to zero per section 6.7.8 nr. 10 of the C99 standard.)
    
    Cc: Jan Kiszka <jan.kiszka@siemens.com>
    Cc: Su Bao Cheng <baocheng.su@siemens.com>
    Tested-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Link: https://lore.kernel.org/r/6554b0241a2c7fd50f32576fdbafed96709e11e8.1664278942.git.lukas@wunner.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

serial: Add rs485_supported to uart_port [+ + +]
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Mon Jun 6 13:04:00 2022 +0300

    serial: Add rs485_supported to uart_port
    
    [ Upstream commit 8925c31c1ac2f1e05da988581f2a70a2a8c4d638 ]
    
    Preparing to move serial_rs485 struct sanitization into serial core,
    each driver has to provide what fields/flags it supports. This
    information is pointed into by rs485_supported.
    
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20220606100433.13793-4-ilpo.jarvinen@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 76bad3f88750 ("tty: serial: fsl_lpuart: don't break the on-going transfer when global reset")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

serial: fsl_lpuart: Fill in rs485_supported [+ + +]
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Mon Jun 6 13:04:12 2022 +0300

    serial: fsl_lpuart: Fill in rs485_supported
    
    [ Upstream commit 07481f448b635d7cebb92d5940f5bea5c4395a26 ]
    
    Add information on supported serial_rs485 features.
    
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20220606100433.13793-16-ilpo.jarvinen@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 76bad3f88750 ("tty: serial: fsl_lpuart: don't break the on-going transfer when global reset")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
sfc: fix potential memleak in __ef100_hard_start_xmit() [+ + +]
Author: Zhang Changzhong <zhangchangzhong@huawei.com>
Date:   Thu Nov 17 15:50:09 2022 +0800

    sfc: fix potential memleak in __ef100_hard_start_xmit()
    
    [ Upstream commit aad98abd5cb8133507f22654f56bcb443aaa2d89 ]
    
    The __ef100_hard_start_xmit() returns NETDEV_TX_OK without freeing skb
    in error handling case, add dev_kfree_skb_any() to fix it.
    
    Fixes: 51b35a454efd ("sfc: skeleton EF100 PF driver")
    Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
    Acked-by: Martin Habets <habetsm.xilinx@gmail.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Link: https://lore.kernel.org/r/1668671409-10909-1-git-send-email-zhangchangzhong@huawei.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
spi: dw-dma: decrease reference count in dw_spi_dma_init_mfld() [+ + +]
Author: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Date:   Wed Nov 16 17:32:04 2022 +0800

    spi: dw-dma: decrease reference count in dw_spi_dma_init_mfld()
    
    [ Upstream commit 804313b64e412a81b0b3389a10e7622452004aa6 ]
    
    pci_get_device() will increase the reference count for the returned
    pci_dev. Since 'dma_dev' is only used to filter the channel in
    dw_spi_dma_chan_filer() after using it we need to call pci_dev_put() to
    decrease the reference count. Also add pci_dev_put() for the error case.
    
    Fixes: 7063c0d942a1 ("spi/dw_spi: add DMA support")
    Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
    Acked-by: Serge Semin <fancer.lancer@gmail.com>
    Link: https://lore.kernel.org/r/20221116093204.46700-1-wangxiongfeng2@huawei.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

spi: stm32: fix stm32_spi_prepare_mbr() that halves spi clk for every run [+ + +]
Author: Sean Nyekjaer <sean@geanix.com>
Date:   Thu Nov 3 09:00:42 2022 +0100

    spi: stm32: fix stm32_spi_prepare_mbr() that halves spi clk for every run
    
    [ Upstream commit 62aa1a344b0904549f6de7af958e8a1136fd5228 ]
    
    When this driver is used with a driver that uses preallocated spi_transfer
    structs. The speed_hz is halved by every run. This results in:
    
    spi_stm32 44004000.spi: SPI transfer setup failed
    ads7846 spi0.0: SPI transfer failed: -22
    
    Example when running with DIV_ROUND_UP():
    - First run; speed_hz = 1000000, spi->clk_rate 125000000
      div 125 -> mbrdiv = 7, cur_speed = 976562
    - Second run; speed_hz = 976562
      div 128,00007 (roundup to 129) -> mbrdiv = 8, cur_speed = 488281
    - Third run; speed_hz = 488281
      div 256,000131072067109 (roundup to 257) and then -EINVAL is returned.
    
    Use DIV_ROUND_CLOSEST to allow to round down and allow us to keep the
    set speed.
    
    Signed-off-by: Sean Nyekjaer <sean@geanix.com>
    Link: https://lore.kernel.org/r/20221103080043.3033414-1-sean@geanix.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tcp: configurable source port perturb table size [+ + +]
Author: Gleb Mazovetskiy <glex.spb@gmail.com>
Date:   Mon Nov 14 22:56:16 2022 +0000

    tcp: configurable source port perturb table size
    
    [ Upstream commit aeac4ec8f46d610a10adbaeff5e2edf6a88ffc62 ]
    
    On embedded systems with little memory and no relevant
    security concerns, it is beneficial to reduce the size
    of the table.
    
    Reducing the size from 2^16 to 2^8 saves 255 KiB
    of kernel RAM.
    
    Makes the table size configurable as an expert option.
    
    The size was previously increased from 2^8 to 2^16
    in commit 4c2c8f03a5ab ("tcp: increase source port perturb table to
    2^16").
    
    Signed-off-by: Gleb Mazovetskiy <glex.spb@gmail.com>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tee: optee: fix possible memory leak in optee_register_device() [+ + +]
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Wed Nov 9 22:01:24 2022 +0800

    tee: optee: fix possible memory leak in optee_register_device()
    
    [ Upstream commit cce616e012c215d65c15e5d1afa73182dea49389 ]
    
    If device_register() returns error in optee_register_device(),
    the name allocated by dev_set_name() need be freed. As comment
    of device_register() says, it should use put_device() to give
    up the reference in the error path. So fix this by calling
    put_device(), then the name can be freed in kobject_cleanup(),
    and optee_device is freed in optee_release_device().
    
    Fixes: c3fa24af9244 ("tee: optee: add TEE bus device enumeration support")
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
    Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tipc: add an extra conn_get in tipc_conn_alloc [+ + +]
Author: Xin Long <lucien.xin@gmail.com>
Date:   Fri Nov 18 16:45:01 2022 -0500

    tipc: add an extra conn_get in tipc_conn_alloc
    
    [ Upstream commit a7b42969d63f47320853a802efd879fbdc4e010e ]
    
    One extra conn_get() is needed in tipc_conn_alloc(), as after
    tipc_conn_alloc() is called, tipc_conn_close() may free this
    con before deferencing it in tipc_topsrv_accept():
    
       tipc_conn_alloc();
       newsk = newsock->sk;
                                     <---- tipc_conn_close();
       write_lock_bh(&sk->sk_callback_lock);
       newsk->sk_data_ready = tipc_conn_data_ready;
    
    Then an uaf issue can be triggered:
    
      BUG: KASAN: use-after-free in tipc_topsrv_accept+0x1e7/0x370 [tipc]
      Call Trace:
       <TASK>
       dump_stack_lvl+0x33/0x46
       print_report+0x178/0x4b0
       kasan_report+0x8c/0x100
       kasan_check_range+0x179/0x1e0
       tipc_topsrv_accept+0x1e7/0x370 [tipc]
       process_one_work+0x6a3/0x1030
       worker_thread+0x8a/0xdf0
    
    This patch fixes it by holding it in tipc_conn_alloc(), then after
    all accessing in tipc_topsrv_accept() releasing it. Note when does
    this in tipc_topsrv_kern_subscr(), as tipc_conn_rcv_sub() returns
    0 or -1 only, we don't need to check for "> 0".
    
    Fixes: c5fa7b3cf3cb ("tipc: introduce new TIPC server infrastructure")
    Signed-off-by: Xin Long <lucien.xin@gmail.com>
    Acked-by: Jon Maloy <jmaloy@redhat.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

tipc: check skb_linearize() return value in tipc_disc_rcv() [+ + +]
Author: YueHaibing <yuehaibing@huawei.com>
Date:   Sat Nov 19 15:28:32 2022 +0800

    tipc: check skb_linearize() return value in tipc_disc_rcv()
    
    [ Upstream commit cd0f6421162201e4b22ce757a1966729323185eb ]
    
    If skb_linearize() fails in tipc_disc_rcv(), we need to free the skb instead of
    handle it.
    
    Fixes: 25b0b9c4e835 ("tipc: handle collisions of 32-bit node address hash values")
    Signed-off-by: YueHaibing <yuehaibing@huawei.com>
    Acked-by: Jon Maloy <jmaloy@redhat.com>
    Link: https://lore.kernel.org/r/20221119072832.7896-1-yuehaibing@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

tipc: set con sock in tipc_conn_alloc [+ + +]
Author: Xin Long <lucien.xin@gmail.com>
Date:   Fri Nov 18 16:45:00 2022 -0500

    tipc: set con sock in tipc_conn_alloc
    
    [ Upstream commit 0e5d56c64afcd6fd2d132ea972605b66f8a7d3c4 ]
    
    A crash was reported by Wei Chen:
    
      BUG: kernel NULL pointer dereference, address: 0000000000000018
      RIP: 0010:tipc_conn_close+0x12/0x100
      Call Trace:
       tipc_topsrv_exit_net+0x139/0x320
       ops_exit_list.isra.9+0x49/0x80
       cleanup_net+0x31a/0x540
       process_one_work+0x3fa/0x9f0
       worker_thread+0x42/0x5c0
    
    It was caused by !con->sock in tipc_conn_close(). In tipc_topsrv_accept(),
    con is allocated in conn_idr then its sock is set:
    
      con = tipc_conn_alloc();
      ...                    <----[1]
      con->sock = newsock;
    
    If tipc_conn_close() is called in anytime of [1], the null-pointer-def
    is triggered by con->sock->sk due to con->sock is not yet set.
    
    This patch fixes it by moving the con->sock setting to tipc_conn_alloc()
    under s->idr_lock. So that con->sock can never be NULL when getting the
    con from s->conn_idr. It will be also safer to move con->server and flag
    CF_CONNECTED setting under s->idr_lock, as they should all be set before
    tipc_conn_alloc() is called.
    
    Fixes: c5fa7b3cf3cb ("tipc: introduce new TIPC server infrastructure")
    Reported-by: Wei Chen <harperchen1110@gmail.com>
    Signed-off-by: Xin Long <lucien.xin@gmail.com>
    Acked-by: Jon Maloy <jmaloy@redhat.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tools: iio: iio_generic_buffer: Fix read size [+ + +]
Author: Matti Vaittinen <mazziesaccount@gmail.com>
Date:   Fri Oct 14 10:15:19 2022 +0300

    tools: iio: iio_generic_buffer: Fix read size
    
    [ Upstream commit 7c919b619bcc68158921b1bd968f0e704549bbb6 ]
    
    When noevents is true and small buffer is used the allocated memory for
    holding the data may be smaller than the hard-coded 64 bytes. This can
    cause the iio_generic_buffer to crash.
    
    Following was recorded on beagle bone black with v6.0 kernel and the
    digit fix patch:
    https://lore.kernel.org/all/Y0f+tKCz+ZAIoroQ@dc75zzyyyyyyyyyyyyycy-3.rev.dnainternet.fi/
    using valgrind;
    
    ==339== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
    ==339== Command: /iio_generic_buffer -n kx022-accel -T0 -e -l 10 -a -w 2000000
    ==339== Parent PID: 307
    ==339==
    ==339== Syscall param read(buf) points to unaddressable byte(s)
    ==339==    at 0x496BFA4: read (read.c:26)
    ==339==    by 0x11699: main (iio_generic_buffer.c:724)
    ==339==  Address 0x4ab3518 is 0 bytes after a block of size 160 alloc'd
    ==339==    at 0x4864B70: malloc (vg_replace_malloc.c:381)
    ==339==    by 0x115BB: main (iio_generic_buffer.c:677)
    
    Fix this by always using the same size for reading as was used for
    data storage allocation.
    
    Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
    Link: https://lore.kernel.org/r/Y0kMh0t5qUXJw3nQ@dc75zzyyyyyyyyyyyyycy-3.rev.dnainternet.fi
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tty: serial: fsl_lpuart: don't break the on-going transfer when global reset [+ + +]
Author: Sherry Sun <sherry.sun@nxp.com>
Date:   Mon Oct 24 16:58:44 2022 +0800

    tty: serial: fsl_lpuart: don't break the on-going transfer when global reset
    
    [ Upstream commit 76bad3f88750f8cc465c489e6846249e0bc3d8f5 ]
    
    lpuart_global_reset() shouldn't break the on-going transmit engine, need
    to recover the on-going data transfer after reset.
    
    This can help earlycon here, since commit 60f361722ad2 ("serial:
    fsl_lpuart: Reset prior to registration") moved lpuart_global_reset()
    before uart_add_one_port(), earlycon is writing during global reset,
    as global reset will disable the TX and clear the baud rate register,
    which caused the earlycon cannot work any more after reset, needs to
    restore the baud rate and re-enable the transmitter to recover the
    earlycon write.
    
    Also move the lpuart_global_reset() down, then we can reuse the
    lpuart32_tx_empty() without declaration.
    
    Fixes: bd5305dcabbc ("tty: serial: fsl_lpuart: do software reset for imx7ulp and imx8qxp")
    Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
    Link: https://lore.kernel.org/r/20221024085844.22786-1-sherry.sun@nxp.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
usb: cdnsp: Fix issue with Clear Feature Halt Endpoint [+ + +]
Author: Pawel Laszczak <pawell@cadence.com>
Date:   Thu Nov 10 01:30:05 2022 -0500

    usb: cdnsp: Fix issue with Clear Feature Halt Endpoint
    
    commit b25264f22b498dff3fa5c70c9bea840e83fff0d1 upstream.
    
    During handling Clear Halt Endpoint Feature request, driver invokes
    Reset Endpoint command. Because this command has some issue with
    transition endpoint from Running to Idle state the driver must
    stop the endpoint by using Stop Endpoint command.
    
    cc: <stable@vger.kernel.org>
    Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
    Reviewed-by: Peter Chen <peter.chen@kernel.org>
    Signed-off-by: Pawel Laszczak <pawell@cadence.com>
    Link: https://lore.kernel.org/r/20221110063005.370656-1-pawell@cadence.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: cdnsp: fix issue with ZLP - added TD_SIZE = 1 [+ + +]
Author: Pawel Laszczak <pawell@cadence.com>
Date:   Tue Nov 15 04:22:18 2022 -0500

    usb: cdnsp: fix issue with ZLP - added TD_SIZE = 1
    
    commit 7a21b27aafa3edead79ed97e6f22236be6b9f447 upstream.
    
    Patch modifies the TD_SIZE in TRB before ZLP TRB.
    The TD_SIZE in TRB before ZLP TRB must be set to 1 to force
    processing ZLP TRB by controller.
    
    cc: <stable@vger.kernel.org>
    Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
    Signed-off-by: Pawel Laszczak <pawell@cadence.com>
    Reviewed-by: Peter Chen <peter.chen@kernel.org>
    Link: https://lore.kernel.org/r/20221115092218.421267-1-pawell@cadence.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: dwc3: exynos: Fix remove() function [+ + +]
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Thu Nov 10 16:41:31 2022 +0100

    usb: dwc3: exynos: Fix remove() function
    
    commit e0481e5b3cc12ea7ccf4552d41518c89d3509004 upstream.
    
    The core DWC3 device node was not properly removed by the custom
    dwc3_exynos_remove_child() function. Replace it with generic
    of_platform_depopulate() which does that job right.
    
    Fixes: adcf20dcd262 ("usb: dwc3: exynos: Use of_platform API to create dwc3 core pdev")
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
    Link: https://lore.kernel.org/r/20221110154131.2577-1-m.szyprowski@samsung.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: dwc3: gadget: Clear ep descriptor last [+ + +]
Author: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Date:   Tue Nov 15 17:19:43 2022 -0800

    usb: dwc3: gadget: Clear ep descriptor last
    
    [ Upstream commit f90f5afd5083a7cb4aee13bd4cc0ae600bd381ca ]
    
    Until the endpoint is disabled, its descriptors should remain valid.
    When its requests are removed from ep disable, the request completion
    routine may attempt to access the endpoint's descriptor. Don't clear the
    descriptors before that.
    
    Fixes: f09ddcfcb8c5 ("usb: dwc3: gadget: Prevent EP queuing while stopping transfers")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/45db7c83b209259115bf652af210f8b2b3b1a383.1668561364.git.Thinh.Nguyen@synopsys.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: dwc3: gadget: conditionally remove requests [+ + +]
Author: Michael Grzeschik <m.grzeschik@pengutronix.de>
Date:   Wed Jul 20 23:35:23 2022 +0200

    usb: dwc3: gadget: conditionally remove requests
    
    [ Upstream commit b44c0e7fef51ee7e8ca8c6efbf706f5613787100 ]
    
    The functions stop_active_transfers and ep_disable are both calling
    remove_requests. This functions in both cases will giveback the requests
    with status ESHUTDOWN, which also represents an physical disconnection.
    For ep_disable this is not true. This patch adds the status parameter to
    remove_requests and sets the status to ECONNRESET on ep_disable.
    
    Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
    Link: https://lore.kernel.org/r/20220720213523.1055897-1-m.grzeschik@pengutronix.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: f90f5afd5083 ("usb: dwc3: gadget: Clear ep descriptor last")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: dwc3: gadget: Return -ESHUTDOWN on ep disable [+ + +]
Author: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Date:   Mon Nov 7 18:45:44 2022 -0800

    usb: dwc3: gadget: Return -ESHUTDOWN on ep disable
    
    [ Upstream commit ffb9da4a04c69567bad717707b6fdfbc4c216ef4 ]
    
    The usb_request API clearly noted that removed requests due to disabled
    endpoint should have -ESHUTDOWN status returned. Don't change this
    behavior.
    
    Fixes: b44c0e7fef51 ("usb: dwc3: gadget: conditionally remove requests")
    Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/3421859485cb32d77e2068549679a6c07a7797bc.1667875427.git.Thinh.Nguyen@synopsys.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: f90f5afd5083 ("usb: dwc3: gadget: Clear ep descriptor last")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
wifi: airo: do not assign -1 to unsigned char [+ + +]
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Mon Oct 24 18:28:43 2022 +0200

    wifi: airo: do not assign -1 to unsigned char
    
    [ Upstream commit e6cb8769452e8236b52134e5cb4a18b8f5986932 ]
    
    With char becoming unsigned by default, and with `char` alone being
    ambiguous and based on architecture, we get a warning when assigning the
    unchecked output of hex_to_bin() to that unsigned char. Mark `key` as a
    `u8`, which matches the struct's type, and then check each call to
    hex_to_bin() before casting.
    
    Cc: Kalle Valo <kvalo@kernel.org>
    Cc: linux-wireless@vger.kernel.org
    Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/20221024162843.535921-1-Jason@zx2c4.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: ath11k: Fix QCN9074 firmware boot on x86 [+ + +]
Author: Tyler J. Stachecki <stachecki.tyler@gmail.com>
Date:   Wed Nov 2 18:56:39 2022 +0200

    wifi: ath11k: Fix QCN9074 firmware boot on x86
    
    [ Upstream commit 3a89b6dec9920026eaa90fe8457f4348d3388a98 ]
    
    The 2.7.0 series of QCN9074's firmware requests 5 segments
    of memory instead of 3 (as in the 2.5.0 series).
    
    The first segment (11M) is too large to be kalloc'd in one
    go on x86 and requires piecemeal 1MB allocations, as was
    the case with the prior public firmware (2.5.0, 15M).
    
    Since f6f92968e1e5, ath11k will break the memory requests,
    but only if there were fewer than 3 segments requested by
    the firmware. It seems that 5 segments works fine and
    allows QCN9074 to boot on x86 with firmware 2.7.0, so
    change things accordingly.
    
    Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
    Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1
    Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.16
    
    Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
    Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
    Link: https://lore.kernel.org/r/20221022042728.43015-1-stachecki.tyler@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: mac80211: Fix ack frame idr leak when mesh has no route [+ + +]
Author: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
Date:   Thu Oct 27 16:01:33 2022 +0200

    wifi: mac80211: Fix ack frame idr leak when mesh has no route
    
    [ Upstream commit 39e7b5de9853bd92ddbfa4b14165babacd7da0ba ]
    
    When trying to transmit an data frame with tx_status to a destination
    that have no route in the mesh, then it is dropped without recrediting
    the ack_status_frames idr.
    
    Once it is exhausted, wpa_supplicant starts failing to do SAE with
    NL80211_CMD_FRAME and logs "nl80211: Frame command failed".
    
    Use ieee80211_free_txskb() instead of kfree_skb() to fix it.
    
    Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
    Link: https://lore.kernel.org/r/20221027140133.1504-1-nicolas.cavallari@green-communications.fr
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: mac80211: fix memory free error when registering wiphy fail [+ + +]
Author: taozhang <taozhang@bestechnic.com>
Date:   Sat Oct 15 17:38:31 2022 +0800

    wifi: mac80211: fix memory free error when registering wiphy fail
    
    [ Upstream commit 50b2e8711462409cd368c41067405aa446dfa2af ]
    
    ieee80211_register_hw free the allocated cipher suites when
    registering wiphy fail, and ieee80211_free_hw will re-free it.
    
    set wiphy_ciphers_allocated to false after freeing allocated
    cipher suites.
    
    Signed-off-by: taozhang <taozhang@bestechnic.com>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: mac80211_hwsim: fix debugfs attribute ps with rc table support [+ + +]
Author: Jonas Jelonek <jelonek.jonas@gmail.com>
Date:   Fri Oct 14 16:54:39 2022 +0200

    wifi: mac80211_hwsim: fix debugfs attribute ps with rc table support
    
    [ Upstream commit 69188df5f6e4cecc6b76b958979ba363cd5240e8 ]
    
    Fixes a warning that occurs when rc table support is enabled
    (IEEE80211_HW_SUPPORTS_RC_TABLE) in mac80211_hwsim and the PS mode
    is changed via the exported debugfs attribute.
    
    When the PS mode is changed, a packet is broadcasted via
    hwsim_send_nullfunc by creating and transmitting a plain skb with only
    header initialized. The ieee80211 rate array in the control buffer is
    zero-initialized. When ratetbl support is enabled, ieee80211_get_tx_rates
    is called for the skb with sta parameter set to NULL and thus no
    ratetbl can be used. The final rate array then looks like
    [-1,0; 0,0; 0,0; 0,0] which causes the warning in ieee80211_get_tx_rate.
    
    The issue is fixed by setting the count of the first rate with idx '0'
    to 1 and hence ieee80211_get_tx_rates won't overwrite it with idx '-1'.
    
    Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: wilc1000: validate length of IEEE80211_P2P_ATTR_CHANNEL_LIST attribute [+ + +]
Author: Phil Turnbull <philipturnbull@github.com>
Date:   Wed Nov 23 10:35:42 2022 -0500

    wifi: wilc1000: validate length of IEEE80211_P2P_ATTR_CHANNEL_LIST attribute
    
    commit f9b62f9843c7b0afdaecabbcebf1dbba18599408 upstream.
    
    Validate that the IEEE80211_P2P_ATTR_CHANNEL_LIST attribute contains
    enough space for a 'struct wilc_attr_oper_ch'. If the attribute is too
    small then it can trigger an out-of-bounds write later in the function.
    
    'struct wilc_attr_oper_ch' is variable sized so also check 'attr_len'
    does not extend beyond the end of 'buf'.
    
    Signed-off-by: Phil Turnbull <philipturnbull@github.com>
    Tested-by: Ajay Kathat <ajay.kathat@microchip.com>
    Acked-by: Ajay Kathat <ajay.kathat@microchip.com>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/20221123153543.8568-4-philipturnbull@github.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: wilc1000: validate length of IEEE80211_P2P_ATTR_OPER_CHANNEL attribute [+ + +]
Author: Phil Turnbull <philipturnbull@github.com>
Date:   Wed Nov 23 10:35:41 2022 -0500

    wifi: wilc1000: validate length of IEEE80211_P2P_ATTR_OPER_CHANNEL attribute
    
    commit 051ae669e4505abbe05165bebf6be7922de11f41 upstream.
    
    Validate that the IEEE80211_P2P_ATTR_OPER_CHANNEL attribute contains
    enough space for a 'struct struct wilc_attr_oper_ch'. If the attribute is
    too small then it triggers an out-of-bounds write later in the function.
    
    Signed-off-by: Phil Turnbull <philipturnbull@github.com>
    Tested-by: Ajay Kathat <ajay.kathat@microchip.com>
    Acked-by: Ajay Kathat <ajay.kathat@microchip.com>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/20221123153543.8568-3-philipturnbull@github.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: wilc1000: validate number of channels [+ + +]
Author: Phil Turnbull <philipturnbull@github.com>
Date:   Wed Nov 23 10:35:43 2022 -0500

    wifi: wilc1000: validate number of channels
    
    commit 0cdfa9e6f0915e3d243e2393bfa8a22e12d553b0 upstream.
    
    There is no validation of 'e->no_of_channels' which can trigger an
    out-of-bounds write in the following 'memset' call. Validate that the
    number of channels does not extends beyond the size of the channel list
    element.
    
    Signed-off-by: Phil Turnbull <philipturnbull@github.com>
    Tested-by: Ajay Kathat <ajay.kathat@microchip.com>
    Acked-by: Ajay Kathat <ajay.kathat@microchip.com>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/20221123153543.8568-5-philipturnbull@github.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: wilc1000: validate pairwise and authentication suite offsets [+ + +]
Author: Phil Turnbull <philipturnbull@github.com>
Date:   Wed Nov 23 10:35:40 2022 -0500

    wifi: wilc1000: validate pairwise and authentication suite offsets
    
    commit cd21d99e595ec1d8721e1058dcdd4f1f7de1d793 upstream.
    
    There is no validation of 'offset' which can trigger an out-of-bounds
    read when extracting RSN capabilities.
    
    Signed-off-by: Phil Turnbull <philipturnbull@github.com>
    Tested-by: Ajay Kathat <ajay.kathat@microchip.com>
    Acked-by: Ajay Kathat <ajay.kathat@microchip.com>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/20221123153543.8568-2-philipturnbull@github.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/hyperv: Restore VP assist page after cpu offlining/onlining [+ + +]
Author: Vitaly Kuznetsov <vkuznets@redhat.com>
Date:   Thu Nov 3 20:06:01 2022 +0100

    x86/hyperv: Restore VP assist page after cpu offlining/onlining
    
    [ Upstream commit ee6815416380bc069b7dcbdff0682d4c53617527 ]
    
    Commit e5d9b714fe40 ("x86/hyperv: fix root partition faults when writing
    to VP assist page MSR") moved 'wrmsrl(HV_X64_MSR_VP_ASSIST_PAGE)' under
    'if (*hvp)' condition. This works for root partition as hv_cpu_die()
    does memunmap() and sets 'hv_vp_assist_page[cpu]' to NULL but breaks
    non-root partitions as hv_cpu_die() doesn't free 'hv_vp_assist_page[cpu]'
    for them. This causes VP assist page to remain unset after CPU
    offline/online cycle:
    
    $ rdmsr -p 24 0x40000073
      10212f001
    $ echo 0 > /sys/devices/system/cpu/cpu24/online
    $ echo 1 > /sys/devices/system/cpu/cpu24/online
    $ rdmsr -p 24 0x40000073
      0
    
    Fix the issue by always writing to HV_X64_MSR_VP_ASSIST_PAGE in
    hv_cpu_init(). Note, checking 'if (!*hvp)', for root partition is
    pointless as hv_cpu_die() always sets 'hv_vp_assist_page[cpu]' to
    NULL (and it's also NULL initially).
    
    Note: the fact that 'hv_vp_assist_page[cpu]' is reset to NULL may
    present a (potential) issue for KVM. While Hyper-V uses
    CPUHP_AP_ONLINE_DYN stage in CPU hotplug, KVM uses CPUHP_AP_KVM_STARTING
    which comes earlier in CPU teardown sequence. It is theoretically
    possible that Enlightened VMCS is still in use. It is unclear if the
    issue is real and if using KVM with Hyper-V root partition is even
    possible.
    
    While on it, drop the unneeded smp_processor_id() call from hv_cpu_init().
    
    Fixes: e5d9b714fe40 ("x86/hyperv: fix root partition faults when writing to VP assist page MSR")
    Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
    Reviewed-by: Michael Kelley <mikelley@microsoft.com>
    Link: https://lore.kernel.org/r/20221103190601.399343-1-vkuznets@redhat.com
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
x86/ioremap: Fix page aligned size calculation in __ioremap_caller() [+ + +]
Author: Michael Kelley <mikelley@microsoft.com>
Date:   Wed Nov 16 10:41:24 2022 -0800

    x86/ioremap: Fix page aligned size calculation in __ioremap_caller()
    
    commit 4dbd6a3e90e03130973688fd79e19425f720d999 upstream.
    
    Current code re-calculates the size after aligning the starting and
    ending physical addresses on a page boundary. But the re-calculation
    also embeds the masking of high order bits that exceed the size of
    the physical address space (via PHYSICAL_PAGE_MASK). If the masking
    removes any high order bits, the size calculation results in a huge
    value that is likely to immediately fail.
    
    Fix this by re-calculating the page-aligned size first. Then mask any
    high order bits using PHYSICAL_PAGE_MASK.
    
    Fixes: ffa71f33a820 ("x86, ioremap: Fix incorrect physical address handling in PAE mode")
    Signed-off-by: Michael Kelley <mikelley@microsoft.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: <stable@kernel.org>
    Link: https://lore.kernel.org/r/1668624097-14884-2-git-send-email-mikelley@microsoft.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/pm: Add enumeration check before spec MSRs save/restore setup [+ + +]
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Tue Nov 15 11:17:06 2022 -0800

    x86/pm: Add enumeration check before spec MSRs save/restore setup
    
    commit 50bcceb7724e471d9b591803889df45dcbb584bc upstream.
    
    pm_save_spec_msr() keeps a list of all the MSRs which _might_ need
    to be saved and restored at hibernate and resume. However, it has
    zero awareness of CPU support for these MSRs. It mostly works by
    unconditionally attempting to manipulate these MSRs and relying on
    rdmsrl_safe() being able to handle a #GP on CPUs where the support is
    unavailable.
    
    However, it's possible for reads (RDMSR) to be supported for a given MSR
    while writes (WRMSR) are not. In this case, msr_build_context() sees
    a successful read (RDMSR) and marks the MSR as valid. Then, later, a
    write (WRMSR) fails, producing a nasty (but harmless) error message.
    This causes restore_processor_state() to try and restore it, but writing
    this MSR is not allowed on the Intel Atom N2600 leading to:
    
      unchecked MSR access error: WRMSR to 0x122 (tried to write 0x0000000000000002) \
         at rIP: 0xffffffff8b07a574 (native_write_msr+0x4/0x20)
      Call Trace:
       <TASK>
       restore_processor_state
       x86_acpi_suspend_lowlevel
       acpi_suspend_enter
       suspend_devices_and_enter
       pm_suspend.cold
       state_store
       kernfs_fop_write_iter
       vfs_write
       ksys_write
       do_syscall_64
       ? do_syscall_64
       ? up_read
       ? lock_is_held_type
       ? asm_exc_page_fault
       ? lockdep_hardirqs_on
       entry_SYSCALL_64_after_hwframe
    
    To fix this, add the corresponding X86_FEATURE bit for each MSR.  Avoid
    trying to manipulate the MSR when the feature bit is clear. This
    required adding a X86_FEATURE bit for MSRs that do not have one already,
    but it's a small price to pay.
    
      [ bp: Move struct msr_enumeration inside the only function that uses it. ]
    
    Fixes: 73924ec4d560 ("x86/pm: Save the MSR validity status at context setup")
    Reported-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>
    Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Cc: <stable@kernel.org>
    Link: https://lore.kernel.org/r/c24db75d69df6e66c0465e13676ad3f2837a2ed8.1668539735.git.pawan.kumar.gupta@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/sgx: Add overflow check in sgx_validate_offset_length() [+ + +]
Author: Borys Popławski <borysp@invisiblethingslab.com>
Date:   Wed Oct 5 00:59:03 2022 +0200

    x86/sgx: Add overflow check in sgx_validate_offset_length()
    
    [ Upstream commit f0861f49bd946ff94fce4f82509c45e167f63690 ]
    
    sgx_validate_offset_length() function verifies "offset" and "length"
    arguments provided by userspace, but was missing an overflow check on
    their addition. Add it.
    
    Fixes: c6d26d370767 ("x86/sgx: Add SGX_IOC_ENCLAVE_ADD_PAGES")
    Signed-off-by: Borys Popławski <borysp@invisiblethingslab.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
    Cc: stable@vger.kernel.org # v5.11+
    Link: https://lore.kernel.org/r/0d91ac79-6d84-abed-5821-4dbe59fa1a38@invisiblethingslab.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

x86/sgx: Create utility to validate user provided offset and length [+ + +]
Author: Reinette Chatre <reinette.chatre@intel.com>
Date:   Tue May 10 11:08:46 2022 -0700

    x86/sgx: Create utility to validate user provided offset and length
    
    [ Upstream commit dda03e2c331b9fc7bbc8fc0de12a6d92d8c18661 ]
    
    User provided offset and length is validated when parsing the parameters
    of the SGX_IOC_ENCLAVE_ADD_PAGES ioctl(). Extract this validation
    (with consistent use of IS_ALIGNED) into a utility that can be used
    by the SGX2 ioctl()s that will also provide these values.
    
    Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
    Link: https://lkml.kernel.org/r/767147bc100047abed47fe27c592901adfbb93a2.1652137848.git.reinette.chatre@intel.com
    Stable-dep-of: f0861f49bd94 ("x86/sgx: Add overflow check in sgx_validate_offset_length()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
x86/tsx: Add a feature bit for TSX control MSR support [+ + +]
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Tue Nov 15 11:17:05 2022 -0800

    x86/tsx: Add a feature bit for TSX control MSR support
    
    commit aaa65d17eec372c6a9756833f3964ba05b05ea14 upstream.
    
    Support for the TSX control MSR is enumerated in MSR_IA32_ARCH_CAPABILITIES.
    This is different from how other CPU features are enumerated i.e. via
    CPUID. Currently, a call to tsx_ctrl_is_supported() is required for
    enumerating the feature. In the absence of a feature bit for TSX control,
    any code that relies on checking feature bits directly will not work.
    
    In preparation for adding a feature bit check in MSR save/restore
    during suspend/resume, set a new feature bit X86_FEATURE_TSX_CTRL when
    MSR_IA32_TSX_CTRL is present. Also make tsx_ctrl_is_supported() use the
    new feature bit to avoid any overhead of reading the MSR.
    
      [ bp: Remove tsx_ctrl_is_supported(), add room for two more feature
        bits in word 11 which are coming up in the next merge window. ]
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: <stable@kernel.org>
    Link: https://lore.kernel.org/r/de619764e1d98afbb7a5fa58424f1278ede37b45.1668539735.git.pawan.kumar.gupta@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
xen-pciback: Allow setting PCI_MSIX_FLAGS_MASKALL too [+ + +]
Author: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Date:   Mon Nov 14 11:31:08 2022 +0100

    xen-pciback: Allow setting PCI_MSIX_FLAGS_MASKALL too
    
    [ Upstream commit 5e29500eba2aa19e1323df46f64dafcd4a327092 ]
    
    When Xen domain configures MSI-X, the usual approach is to enable MSI-X
    together with masking all of them via the config space, then fill the
    table and only then clear PCI_MSIX_FLAGS_MASKALL. Allow doing this via
    QEMU running in a stub domain.
    
    Previously, when changing PCI_MSIX_FLAGS_MASKALL was not allowed, the
    whole write was aborted, preventing change to the PCI_MSIX_FLAGS_ENABLE
    bit too.
    
    Note the Xen hypervisor intercepts this write anyway, and may keep the
    PCI_MSIX_FLAGS_MASKALL bit set if it wishes to. It will store the
    guest-requested state and will apply it eventually.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Link: https://lore.kernel.org/r/20221114103110.1519413-1-marmarek@invisiblethingslab.com
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
xen/platform-pci: add missing free_irq() in error path [+ + +]
Author: ruanjinjie <ruanjinjie@huawei.com>
Date:   Mon Nov 14 19:21:24 2022 +0800

    xen/platform-pci: add missing free_irq() in error path
    
    [ Upstream commit c53717e1e3f0d0f9129b2e0dbc6dcc5e0a8132e9 ]
    
    free_irq() is missing in case of error in platform_pci_probe(), fix that.
    
    Signed-off-by: ruanjinjie <ruanjinjie@huawei.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Link: https://lore.kernel.org/r/20221114112124.1965611-1-ruanjinjie@huawei.com
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
xfrm: fix "disable_policy" on ipv4 early demux [+ + +]
Author: Eyal Birger <eyal.birger@gmail.com>
Date:   Sun Oct 9 22:16:43 2022 +0300

    xfrm: fix "disable_policy" on ipv4 early demux
    
    [ Upstream commit 3a5913183aa1b14148c723bda030e6102ad73008 ]
    
    The commit in the "Fixes" tag tried to avoid a case where policy check
    is ignored due to dst caching in next hops.
    
    However, when the traffic is locally consumed, the dst may be cached
    in a local TCP or UDP socket as part of early demux. In this case the
    "disable_policy" flag is not checked as ip_route_input_noref() was only
    called before caching, and thus, packets after the initial packet in a
    flow will be dropped if not matching policies.
    
    Fix by checking the "disable_policy" flag also when a valid dst is
    already available.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=216557
    Reported-by: Monil Patel <monil191989@gmail.com>
    Fixes: e6175a2ed1f1 ("xfrm: fix "disable_policy" flag use when arriving from different devices")
    Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
    
    ----
    
    v2: use dev instead of skb->dev
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

xfrm: Fix ignored return value in xfrm6_init() [+ + +]
Author: Chen Zhongjin <chenzhongjin@huawei.com>
Date:   Thu Nov 3 17:07:13 2022 +0800

    xfrm: Fix ignored return value in xfrm6_init()
    
    [ Upstream commit 40781bfb836eda57d19c0baa37c7e72590e05fdc ]
    
    When IPv6 module initializing in xfrm6_init(), register_pernet_subsys()
    is possible to fail but its return value is ignored.
    
    If IPv6 initialization fails later and xfrm6_fini() is called,
    removing uninitialized list in xfrm6_net_ops will cause null-ptr-deref:
    
    KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
    CPU: 1 PID: 330 Comm: insmod
    RIP: 0010:unregister_pernet_operations+0xc9/0x450
    Call Trace:
     <TASK>
     unregister_pernet_subsys+0x31/0x3e
     xfrm6_fini+0x16/0x30 [ipv6]
     ip6_route_init+0xcd/0x128 [ipv6]
     inet6_init+0x29c/0x602 [ipv6]
     ...
    
    Fix it by catching the error return value of register_pernet_subsys().
    
    Fixes: 8d068875caca ("xfrm: make gc_thresh configurable in all namespaces")
    Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

xfrm: Fix oops in __xfrm_state_delete() [+ + +]
Author: Thomas Jarosch <thomas.jarosch@intra2net.com>
Date:   Wed Nov 2 11:18:48 2022 +0100

    xfrm: Fix oops in __xfrm_state_delete()
    
    [ Upstream commit b97df039a68b2f3e848e238df5d5d06343ea497b ]
    
    Kernel 5.14 added a new "byseq" index to speed
    up xfrm_state lookups by sequence number in commit
    fe9f1d8779cb ("xfrm: add state hashtable keyed by seq")
    
    While the patch was thorough, the function pfkey_send_new_mapping()
    in net/af_key.c also modifies x->km.seq and never added
    the current xfrm_state to the "byseq" index.
    
    This leads to the following kernel Ooops:
        BUG: kernel NULL pointer dereference, address: 0000000000000000
        ..
        RIP: 0010:__xfrm_state_delete+0xc9/0x1c0
        ..
        Call Trace:
        <TASK>
        xfrm_state_delete+0x1e/0x40
        xfrm_del_sa+0xb0/0x110 [xfrm_user]
        xfrm_user_rcv_msg+0x12d/0x270 [xfrm_user]
        ? remove_entity_load_avg+0x8a/0xa0
        ? copy_to_user_state_extra+0x580/0x580 [xfrm_user]
        netlink_rcv_skb+0x51/0x100
        xfrm_netlink_rcv+0x30/0x50 [xfrm_user]
        netlink_unicast+0x1a6/0x270
        netlink_sendmsg+0x22a/0x480
        __sys_sendto+0x1a6/0x1c0
        ? __audit_syscall_entry+0xd8/0x130
        ? __audit_syscall_exit+0x249/0x2b0
        __x64_sys_sendto+0x23/0x30
        do_syscall_64+0x3a/0x90
        entry_SYSCALL_64_after_hwframe+0x61/0xcb
    
    Exact location of the crash in __xfrm_state_delete():
        if (x->km.seq)
            hlist_del_rcu(&x->byseq);
    
    The hlist_node "byseq" was never populated.
    
    The bug only triggers if a new NAT traversal mapping (changed IP or port)
    is detected in esp_input_done2() / esp6_input_done2(), which in turn
    indirectly calls pfkey_send_new_mapping() *if* the kernel is compiled
    with CONFIG_NET_KEY and "af_key" is active.
    
    The PF_KEYv2 message SADB_X_NAT_T_NEW_MAPPING is not part of RFC 2367.
    Various implementations have been examined how they handle
    the "sadb_msg_seq" header field:
    
    - racoon (Android): does not process SADB_X_NAT_T_NEW_MAPPING
    - strongswan: does not care about sadb_msg_seq
    - openswan: does not care about sadb_msg_seq
    
    There is no standard how PF_KEYv2 sadb_msg_seq should be populated
    for SADB_X_NAT_T_NEW_MAPPING and it's not used in popular
    implementations either. Herbert Xu suggested we should just
    use the current km.seq value as is. This fixes the root cause
    of the oops since we no longer modify km.seq itself.
    
    The update of "km.seq" looks like a copy'n'paste error
    from pfkey_send_acquire(). SADB_ACQUIRE must indeed assign a unique km.seq
    number according to RFC 2367. It has been verified that code paths
    involving pfkey_send_acquire() don't cause the same Oops.
    
    PF_KEYv2 SADB_X_NAT_T_NEW_MAPPING support was originally added here:
        https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git
    
        commit cbc3488685b20e7b2a98ad387a1a816aada569d8
        Author:     Derek Atkins <derek@ihtfp.com>
        AuthorDate: Wed Apr 2 13:21:02 2003 -0800
    
            [IPSEC]: Implement UDP Encapsulation framework.
    
            In particular, implement ESPinUDP encapsulation for IPsec
            Nat Traversal.
    
    A note on triggering the bug: I was not able to trigger it using VMs.
    There is one VPN using a high latency link on our production VPN server
    that triggered it like once a day though.
    
    Link: https://github.com/strongswan/strongswan/issues/992
    Link: https://lore.kernel.org/netdev/00959f33ee52c4b3b0084d42c430418e502db554.1652340703.git.antony.antony@secunet.com/T/
    Link: https://lore.kernel.org/netdev/20221027142455.3975224-1-chenzhihao@meizu.com/T/
    
    Fixes: fe9f1d8779cb ("xfrm: add state hashtable keyed by seq")
    Reported-by: Roth Mark <rothm@mail.com>
    Reported-by: Zhihao Chen <chenzhihao@meizu.com>
    Tested-by: Roth Mark <rothm@mail.com>
    Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
    Acked-by: Antony Antony <antony.antony@secunet.com>
    Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

xfrm: replay: Fix ESN wrap around for GSO [+ + +]
Author: Christian Langrock <christian.langrock@secunet.com>
Date:   Mon Oct 17 08:34:47 2022 +0200

    xfrm: replay: Fix ESN wrap around for GSO
    
    [ Upstream commit 4b549ccce941798703f159b227aa28c716aa78fa ]
    
    When using GSO it can happen that the wrong seq_hi is used for the last
    packets before the wrap around. This can lead to double usage of a
    sequence number. To avoid this, we should serialize this last GSO
    packet.
    
    Fixes: d7dbefc45cf5 ("xfrm: Add xfrm_replay_overflow functions for offloading")
    Co-developed-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Christian Langrock <christian.langrock@secunet.com>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
zonefs: fix zone report size in __zonefs_io_error() [+ + +]
Author: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Date:   Tue Oct 25 13:39:31 2022 +0900

    zonefs: fix zone report size in __zonefs_io_error()
    
    [ Upstream commit 7dd12d65ac646046a3fe0bbf9a4e86f4514207b3 ]
    
    When an IO error occurs, the function __zonefs_io_error() is used to
    issue a zone report to obtain the latest zone information from the
    device. This function gets a zone report for all zones used as storage
    for a file, which is always 1 zone except for files representing
    aggregated conventional zones.
    
    The number of zones of a zone report for a file is calculated in
    __zonefs_io_error() by doing a bit-shift of the inode i_zone_size field,
    which is equal to or larger than the device zone size. However, this
    calculation does not take into account that the last zone of a zoned
    device may be smaller than the zone size reported by bdev_zone_sectors()
    (which is used to set the bit shift size). As a result, if an error
    occurs for an IO targetting such last smaller zone, the zone report will
    ask for 0 zones, leading to an invalid zone report.
    
    Fix this by using the fact that all files require a 1 zone report,
    except if the inode i_zone_size field indicates a zone size larger than
    the device zone size. This exception case corresponds to a mount with
    aggregated conventional zones.
    
    A check for this exception is added to the file inode initialization
    during mount. If an invalid setup is detected, emit an error and fail
    the mount (check contributed by Johannes Thumshirn).
    
    Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>