]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.4
authorSasha Levin <sashal@kernel.org>
Mon, 15 Nov 2021 02:43:14 +0000 (21:43 -0500)
committerSasha Levin <sashal@kernel.org>
Mon, 15 Nov 2021 02:43:14 +0000 (21:43 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
223 files changed:
queue-5.4/acpi-battery-accept-charges-over-the-design-capacity.patch [new file with mode: 0644]
queue-5.4/acpi-pmic-fix-intel_pmic_regs_handler-read-accesses.patch [new file with mode: 0644]
queue-5.4/acpica-avoid-evaluating-methods-too-early-during-sys.patch [new file with mode: 0644]
queue-5.4/alsa-hda-reduce-udelay-at-skl-position-reporting.patch [new file with mode: 0644]
queue-5.4/apparmor-fix-error-check.patch [new file with mode: 0644]
queue-5.4/ar7-fix-kernel-builds-for-compiler-test.patch [new file with mode: 0644]
queue-5.4/arm-9136-1-armv7-m-uses-be-8-not-be-32.patch [new file with mode: 0644]
queue-5.4/arm-clang-do-not-rely-on-lr-register-for-stacktrace.patch [new file with mode: 0644]
queue-5.4/arm-dts-at91-tse850-the-emac-phy-interface-is-rmii.patch [new file with mode: 0644]
queue-5.4/arm-dts-omap3-gta04a4-accelerometer-irq-fix.patch [new file with mode: 0644]
queue-5.4/arm-dts-qcom-msm8974-add-xo_board-reference-clock-to.patch [new file with mode: 0644]
queue-5.4/arm-dts-stm32-fix-sai-sub-nodes-register-range.patch [new file with mode: 0644]
queue-5.4/arm-s3c-irq-s3c24xx-fix-return-value-check-for-s3c24.patch [new file with mode: 0644]
queue-5.4/arm64-dts-meson-g12a-fix-the-pwm-regulator-supply-pr.patch [new file with mode: 0644]
queue-5.4/arm64-dts-rockchip-fix-gpu-register-width-for-rk3328.patch [new file with mode: 0644]
queue-5.4/arm64-pgtable-make-__pte_to_phys-__phys_to_pte_val-i.patch [new file with mode: 0644]
queue-5.4/asoc-cs42l42-correct-some-register-default-values.patch [new file with mode: 0644]
queue-5.4/asoc-cs42l42-defer-probe-if-request_threaded_irq-ret.patch [new file with mode: 0644]
queue-5.4/ath-dfs_pattern_detector-fix-possible-null-pointer-d.patch [new file with mode: 0644]
queue-5.4/ath10k-fix-max-antenna-gain-unit.patch [new file with mode: 0644]
queue-5.4/ath10k-fix-missing-frame-timestamp-for-beacon-probe-.patch [new file with mode: 0644]
queue-5.4/ath10k-high-latency-fixes-for-beacon-buffer.patch [new file with mode: 0644]
queue-5.4/ath9k-fix-potential-interrupt-storm-on-queue-reset.patch [new file with mode: 0644]
queue-5.4/auxdisplay-ht16k33-connect-backlight-to-fbdev.patch [new file with mode: 0644]
queue-5.4/auxdisplay-ht16k33-fix-frame-buffer-device-blanking.patch [new file with mode: 0644]
queue-5.4/auxdisplay-img-ascii-lcd-fix-lock-up-when-displaying.patch [new file with mode: 0644]
queue-5.4/b43-fix-a-lower-bounds-test.patch [new file with mode: 0644]
queue-5.4/b43legacy-fix-a-lower-bounds-test.patch [new file with mode: 0644]
queue-5.4/block-ataflop-fix-breakage-introduced-at-blk-mq-refa.patch [new file with mode: 0644]
queue-5.4/block-remove-inaccurate-requeue-check.patch [new file with mode: 0644]
queue-5.4/bluetooth-btmtkuart-fix-a-memleak-in-mtk_hci_wmt_syn.patch [new file with mode: 0644]
queue-5.4/bluetooth-fix-init-and-cleanup-of-sco_conn.timeout_w.patch [new file with mode: 0644]
queue-5.4/bluetooth-fix-use-after-free-error-in-lock_sock_nest.patch [new file with mode: 0644]
queue-5.4/bluetooth-sco-fix-lock_sock-blockage-by-memcpy_from_.patch [new file with mode: 0644]
queue-5.4/bonding-fix-a-use-after-free-problem-when-bond_sysfs.patch [new file with mode: 0644]
queue-5.4/bpf-sockmap-strparser-and-tls-are-reusing-qdisc_skb_.patch [new file with mode: 0644]
queue-5.4/brcmfmac-add-dmi-nvram-filename-quirk-for-cyberbook-.patch [new file with mode: 0644]
queue-5.4/btrfs-do-not-take-the-uuid_mutex-in-btrfs_rm_device.patch [new file with mode: 0644]
queue-5.4/btrfs-subpage-make-btrfs_submit_compressed_write-com.patch [new file with mode: 0644]
queue-5.4/cgroup-make-rebind_subsystems-disable-v2-controllers.patch [new file with mode: 0644]
queue-5.4/clk-at91-check-pmc-node-status-before-registering-sy.patch [new file with mode: 0644]
queue-5.4/clk-mvebu-ap-cpu-clk-fix-a-memory-leak-in-error-hand.patch [new file with mode: 0644]
queue-5.4/clocksource-drivers-timer-ti-dm-select-timer_of.patch [new file with mode: 0644]
queue-5.4/cpuidle-fix-kobject-memory-leaks-in-error-paths.patch [new file with mode: 0644]
queue-5.4/crypto-caam-disable-pkc-for-non-e-socs.patch [new file with mode: 0644]
queue-5.4/crypto-ecc-fix-crypto_default_rng-dependency.patch [new file with mode: 0644]
queue-5.4/crypto-pcrypt-delay-write-to-padata-info.patch [new file with mode: 0644]
queue-5.4/crypto-qat-detect-pfvf-collision-after-ack.patch [new file with mode: 0644]
queue-5.4/crypto-qat-disregard-spurious-pfvf-interrupts.patch [new file with mode: 0644]
queue-5.4/cxgb4-fix-eeprom-len-when-diagnostics-not-implemente.patch [new file with mode: 0644]
queue-5.4/dma-buf-warn-on-dmabuf-release-with-pending-attachme.patch [new file with mode: 0644]
queue-5.4/dmaengine-at_xdmac-fix-at_xdmac_cc_perid-macro.patch [new file with mode: 0644]
queue-5.4/dmaengine-dmaengine_desc_callback_valid-check-for-ca.patch [new file with mode: 0644]
queue-5.4/drm-amdgpu-fix-warning-for-overflow-check.patch [new file with mode: 0644]
queue-5.4/drm-amdgpu-gmc6-fix-dma-mask-from-44-to-40-bits.patch [new file with mode: 0644]
queue-5.4/drm-msm-fix-potential-null-dereference-in-dpu-sspp.patch [new file with mode: 0644]
queue-5.4/drm-msm-uninitialized-variable-in-msm_gem_import.patch [new file with mode: 0644]
queue-5.4/drm-panel-orientation-quirks-add-quirk-for-kd-kurio-.patch [new file with mode: 0644]
queue-5.4/drm-panel-orientation-quirks-add-quirk-for-the-samsu.patch [new file with mode: 0644]
queue-5.4/drm-panel-orientation-quirks-add-valve-steam-deck.patch [new file with mode: 0644]
queue-5.4/drm-panel-orientation-quirks-update-the-lenovo-ideap.patch [new file with mode: 0644]
queue-5.4/drm-plane-helper-fix-uninitialized-variable-referenc.patch [new file with mode: 0644]
queue-5.4/drm-v3d-fix-wait-for-tmu-write-combiner-flush.patch [new file with mode: 0644]
queue-5.4/edac-amd64-handle-three-rank-interleaving-mode.patch [new file with mode: 0644]
queue-5.4/fs-orangefs-fix-error-return-code-of-orangefs_revali.patch [new file with mode: 0644]
queue-5.4/gre-sit-don-t-generate-link-local-addr-if-addr_gen_m.patch [new file with mode: 0644]
queue-5.4/hid-u2fzero-clarify-error-check-and-length-calculati.patch [new file with mode: 0644]
queue-5.4/hid-u2fzero-properly-handle-timeouts-in-usb_submit_u.patch [new file with mode: 0644]
queue-5.4/hwmon-fix-possible-memleak-in-__hwmon_device_registe.patch [new file with mode: 0644]
queue-5.4/hwmon-pmbus-lm25066-let-compiler-determine-outer-dim.patch [new file with mode: 0644]
queue-5.4/hwrng-mtk-force-runtime-pm-ops-for-sleep-ops.patch [new file with mode: 0644]
queue-5.4/i2c-xlr-fix-a-resource-leak-in-the-error-handling-pa.patch [new file with mode: 0644]
queue-5.4/ia64-don-t-do-ia64_cmpxchg_debug-without-config_prin.patch [new file with mode: 0644]
queue-5.4/ibmvnic-don-t-stop-queue-in-xmit.patch [new file with mode: 0644]
queue-5.4/ibmvnic-process-crqs-after-enabling-interrupts.patch [new file with mode: 0644]
queue-5.4/iov_iter-fix-iov_iter_get_pages-_alloc-page-fault-re.patch [new file with mode: 0644]
queue-5.4/ipmi-disable-some-operations-during-a-panic.patch [new file with mode: 0644]
queue-5.4/irq-mips-avoid-nested-irq_enter.patch [new file with mode: 0644]
queue-5.4/iwlwifi-mvm-disable-rx-diversity-in-powersave.patch [new file with mode: 0644]
queue-5.4/jfs-fix-memleak-in-jfs_mount.patch [new file with mode: 0644]
queue-5.4/kprobes-do-not-use-local-variable-when-creating-debu.patch [new file with mode: 0644]
queue-5.4/kvm-s390-fix-handle_sske-page-fault-handling.patch [new file with mode: 0644]
queue-5.4/leaking_addresses-always-print-a-trailing-newline.patch [new file with mode: 0644]
queue-5.4/lib-xz-avoid-overlapping-memcpy-with-invalid-input-w.patch [new file with mode: 0644]
queue-5.4/lib-xz-validate-the-value-before-assigning-it-to-an-.patch [new file with mode: 0644]
queue-5.4/libbpf-fix-btf-data-layout-checks-and-allow-empty-bt.patch [new file with mode: 0644]
queue-5.4/libertas-fix-possible-memory-leak-in-probe-and-disco.patch [new file with mode: 0644]
queue-5.4/libertas_tf-fix-possible-memory-leak-in-probe-and-di.patch [new file with mode: 0644]
queue-5.4/llc-fix-out-of-bound-array-index-in-llc_sk_dev_hash.patch [new file with mode: 0644]
queue-5.4/locking-lockdep-avoid-rcu-induced-noinstr-fail.patch [new file with mode: 0644]
queue-5.4/m68k-set-a-default-value-for-memory_reserve.patch [new file with mode: 0644]
queue-5.4/media-cx23885-fix-snd_card_free-call-on-null-card-po.patch [new file with mode: 0644]
queue-5.4/media-cxd2880-spi-fix-a-null-pointer-dereference-on-.patch [new file with mode: 0644]
queue-5.4/media-dvb-frontends-mn88443x-handle-errors-of-clk_pr.patch [new file with mode: 0644]
queue-5.4/media-dvb-usb-fix-ununit-value-in-az6027_rc_query.patch [new file with mode: 0644]
queue-5.4/media-em28xx-add-missing-em28xx_close_extension.patch [new file with mode: 0644]
queue-5.4/media-em28xx-don-t-use-ops-suspend-if-it-is-null.patch [new file with mode: 0644]
queue-5.4/media-i2c-ths8200-needs-v4l2_async.patch [new file with mode: 0644]
queue-5.4/media-imx-set-a-media_device-bus_info-string.patch [new file with mode: 0644]
queue-5.4/media-ipu3-imgu-imgu_fmt-handle-properly-try.patch [new file with mode: 0644]
queue-5.4/media-ipu3-imgu-vidioc_querycap-fix-bus_info.patch [new file with mode: 0644]
queue-5.4/media-mceusb-return-without-resubmitting-urb-in-case.patch [new file with mode: 0644]
queue-5.4/media-mt9p031-fix-corrupted-frame-after-restarting-s.patch [new file with mode: 0644]
queue-5.4/media-mtk-vpu-fix-a-resource-leak-in-the-error-handl.patch [new file with mode: 0644]
queue-5.4/media-netup_unidvb-handle-interrupt-properly-accordi.patch [new file with mode: 0644]
queue-5.4/media-radio-wl1273-avoid-card-name-truncation.patch [new file with mode: 0644]
queue-5.4/media-rcar-csi2-add-checking-to-rcsi2_start_receiver.patch [new file with mode: 0644]
queue-5.4/media-s5p-mfc-add-checking-to-s5p_mfc_probe.patch [new file with mode: 0644]
queue-5.4/media-s5p-mfc-fix-possible-null-pointer-dereference-.patch [new file with mode: 0644]
queue-5.4/media-si470x-avoid-card-name-truncation.patch [new file with mode: 0644]
queue-5.4/media-stm32-potential-null-pointer-dereference-in-dc.patch [new file with mode: 0644]
queue-5.4/media-tda1997x-handle-short-reads-of-hdmi-info-frame.patch [new file with mode: 0644]
queue-5.4/media-tm6000-avoid-card-name-truncation.patch [new file with mode: 0644]
queue-5.4/media-usb-dvd-usb-fix-uninit-value-bug-in-dibusb_rea.patch [new file with mode: 0644]
queue-5.4/media-uvcvideo-return-eio-for-control-errors.patch [new file with mode: 0644]
queue-5.4/media-uvcvideo-set-capability-in-s_param.patch [new file with mode: 0644]
queue-5.4/media-uvcvideo-set-unique-vdev-name-based-in-type.patch [new file with mode: 0644]
queue-5.4/memory-fsl_ifc-fix-leak-of-irq-and-nand_irq-in-fsl_i.patch [new file with mode: 0644]
queue-5.4/memstick-avoid-out-of-range-warning.patch [new file with mode: 0644]
queue-5.4/memstick-jmb38x_ms-use-appropriate-free-function-in-.patch [new file with mode: 0644]
queue-5.4/memstick-r592-fix-a-uaf-bug-when-removing-the-driver.patch [new file with mode: 0644]
queue-5.4/mips-cm-convert-to-bitfield-api-to-fix-out-of-bounds.patch [new file with mode: 0644]
queue-5.4/mips-lantiq-dma-add-small-delay-after-reset.patch [new file with mode: 0644]
queue-5.4/mips-lantiq-dma-reset-correct-number-of-channel.patch [new file with mode: 0644]
queue-5.4/mips-loongson64-make-cpu_loongson64-depends-on-mips_.patch [new file with mode: 0644]
queue-5.4/mm-zsmalloc.c-close-race-window-between-zs_pool_dec_.patch [new file with mode: 0644]
queue-5.4/mmc-mxs-mmc-disable-regulator-on-error-and-in-the-re.patch [new file with mode: 0644]
queue-5.4/mmc-sdhci-omap-fix-null-pointer-exception-if-regulat.patch [new file with mode: 0644]
queue-5.4/mt76-mt76x02-fix-endianness-warnings-in-mt76x02_mac..patch [new file with mode: 0644]
queue-5.4/mtd-core-don-t-remove-debugfs-directory-if-device-is.patch [new file with mode: 0644]
queue-5.4/mtd-spi-nor-hisi-sfc-remove-excessive-clk_disable_un.patch [new file with mode: 0644]
queue-5.4/mwifiex-properly-initialize-private-structure-on-int.patch [new file with mode: 0644]
queue-5.4/mwifiex-run-set_bss_mode-when-changing-from-p2p-to-s.patch [new file with mode: 0644]
queue-5.4/mwifiex-send-delba-requests-according-to-spec.patch [new file with mode: 0644]
queue-5.4/mwl8k-fix-use-after-free-in-mwl8k_fw_state_machine.patch [new file with mode: 0644]
queue-5.4/net-amd-xgbe-toggle-pll-settings-during-rate-change.patch [new file with mode: 0644]
queue-5.4/net-annotate-data-race-in-neigh_output.patch [new file with mode: 0644]
queue-5.4/net-davinci_emac-fix-interrupt-pacing-disable.patch [new file with mode: 0644]
queue-5.4/net-dsa-lantiq_gswip-serialize-access-to-the-pce-tab.patch [new file with mode: 0644]
queue-5.4/net-dsa-rtl8366rb-fix-off-by-one-bug.patch [new file with mode: 0644]
queue-5.4/net-hns3-allow-configure-ets-bandwidth-of-all-tcs.patch [new file with mode: 0644]
queue-5.4/net-neigh-fix-ntf_ext_learned-in-combination-with-nt.patch [new file with mode: 0644]
queue-5.4/net-net_namespace-fix-undefined-member-in-key_remove.patch [new file with mode: 0644]
queue-5.4/net-phylink-avoid-mvneta-warning-when-setting-pause-.patch [new file with mode: 0644]
queue-5.4/net-sched-sch_taprio-fix-undefined-behavior-in-ktime.patch [new file with mode: 0644]
queue-5.4/net-sched-update-default-qdisc-visibility-after-tx-q.patch [new file with mode: 0644]
queue-5.4/net-smc-fix-sk_refcnt-underflow-on-linkdown-and-fall.patch [new file with mode: 0644]
queue-5.4/net-stream-don-t-purge-sk_error_queue-in-sk_stream_k.patch [new file with mode: 0644]
queue-5.4/net-sysfs-try-not-to-restart-the-syscall-if-it-will-.patch [new file with mode: 0644]
queue-5.4/net-vlan-fix-a-uaf-in-vlan_dev_real_dev.patch [new file with mode: 0644]
queue-5.4/netfilter-conntrack-set-on-ips_assured-if-flows-ente.patch [new file with mode: 0644]
queue-5.4/netfilter-nfnetlink_queue-fix-oob-when-mac-header-wa.patch [new file with mode: 0644]
queue-5.4/netfilter-nft_dynset-relax-superfluous-check-on-set-.patch [new file with mode: 0644]
queue-5.4/nfc-pn533-fix-double-free-when-pn533_fill_fragment_s.patch [new file with mode: 0644]
queue-5.4/nfs-fix-deadlocks-in-nfs_scan_commit_list.patch [new file with mode: 0644]
queue-5.4/nfsv4-fix-a-regression-in-nfs_set_open_stateid_locke.patch [new file with mode: 0644]
queue-5.4/nvme-drop-scan_lock-and-always-kick-requeue-list-whe.patch [new file with mode: 0644]
queue-5.4/nvme-rdma-fix-error-code-in-nvme_rdma_setup_ctrl.patch [new file with mode: 0644]
queue-5.4/nvmet-fix-use-after-free-when-a-port-is-removed.patch [new file with mode: 0644]
queue-5.4/nvmet-tcp-fix-use-after-free-when-a-port-is-removed.patch [new file with mode: 0644]
queue-5.4/opp-fix-return-in-_opp_add_static_v2.patch [new file with mode: 0644]
queue-5.4/parisc-fix-warning-in-flush_tlb_all.patch [new file with mode: 0644]
queue-5.4/parisc-kgdb-add-kgdb_roundup-to-make-kgdb-work-with-.patch [new file with mode: 0644]
queue-5.4/parisc-unwind-fix-unwinder-when-config_64bit-is-enab.patch [new file with mode: 0644]
queue-5.4/pci-aardvark-don-t-spam-about-pio-response-status.patch [new file with mode: 0644]
queue-5.4/pci-aardvark-fix-preserving-pci_exp_rtctl_crssve-fla.patch [new file with mode: 0644]
queue-5.4/perf-bpf-add-missing-free-to-bpf_event__print_bpf_pr.patch [new file with mode: 0644]
queue-5.4/phy-micrel-ksz8041nl-do-not-use-power-down-mode.patch [new file with mode: 0644]
queue-5.4/phy-qcom-qusb2-fix-a-memory-leak-on-probe.patch [new file with mode: 0644]
queue-5.4/platform-x86-thinkpad_acpi-fix-bitwise-vs.-logical-w.patch [new file with mode: 0644]
queue-5.4/platform-x86-wmi-do-not-fail-if-disabling-fails.patch [new file with mode: 0644]
queue-5.4/pm-hibernate-fix-sparse-warnings.patch [new file with mode: 0644]
queue-5.4/pm-hibernate-get-block-device-exclusively-in-swsusp_.patch [new file with mode: 0644]
queue-5.4/pnfs-flexfiles-fix-misplaced-barrier-in-nfs4_ff_layo.patch [new file with mode: 0644]
queue-5.4/power-supply-bq27xxx-fix-kernel-crash-on-irq-handler.patch [new file with mode: 0644]
queue-5.4/power-supply-rt5033_battery-change-voltage-values-to.patch [new file with mode: 0644]
queue-5.4/powerpc-44x-fsp2-add-missing-of_node_put.patch [new file with mode: 0644]
queue-5.4/rcu-fix-existing-exp-request-check-in-sync_sched_exp.patch [new file with mode: 0644]
queue-5.4/rdma-bnxt_re-fix-query-srq-failure.patch [new file with mode: 0644]
queue-5.4/rdma-mlx4-return-missed-an-error-if-device-doesn-t-s.patch [new file with mode: 0644]
queue-5.4/rdma-rxe-fix-wrong-port_cap_flags.patch [new file with mode: 0644]
queue-5.4/rpmsg-fix-rpmsg_create_ept-return-when-rpmsg-config-.patch [new file with mode: 0644]
queue-5.4/rsi-stop-thread-firstly-in-rsi_91x_init-error-handli.patch [new file with mode: 0644]
queue-5.4/rxrpc-fix-_usecs_to_jiffies-by-using-usecs_to_jiffie.patch [new file with mode: 0644]
queue-5.4/s390-gmap-don-t-unconditionally-call-pte_unmap_unloc.patch [new file with mode: 0644]
queue-5.4/samples-kretprobes-fix-return-value-if-register_kret.patch [new file with mode: 0644]
queue-5.4/scsi-csiostor-uninitialized-data-in-csio_ln_vnp_read.patch [new file with mode: 0644]
queue-5.4/scsi-dc395-fix-error-case-unwinding.patch [new file with mode: 0644]
queue-5.4/scsi-qla2xxx-fix-gnl-list-corruption.patch [new file with mode: 0644]
queue-5.4/scsi-qla2xxx-turn-off-target-reset-during-issue_lip.patch [new file with mode: 0644]
queue-5.4/selftests-bpf-fix-fclose-pclose-mismatch-in-test_pro.patch [new file with mode: 0644]
queue-5.4/selftests-bpf-fix-strobemeta-selftest-regression.patch [new file with mode: 0644]
queue-5.4/selftests-kvm-fix-mismatched-fclose-after-popen.patch [new file with mode: 0644]
queue-5.4/selftests-net-udpgso_bench_rx-fix-port-argument.patch [new file with mode: 0644]
queue-5.4/serial-8250_dw-drop-wrong-use-of-acpi_ptr.patch [new file with mode: 0644]
queue-5.4/serial-xilinx_uartps-fix-race-condition-causing-stuc.patch [new file with mode: 0644]
queue-5.4/series
queue-5.4/signal-sh-use-force_sig-sigkill-instead-of-do_group_.patch [new file with mode: 0644]
queue-5.4/smackfs-fix-use-after-free-in-netlbl_catmap_walk.patch [new file with mode: 0644]
queue-5.4/smackfs-use-__gfp_nofail-for-smk_cipso_doi.patch [new file with mode: 0644]
queue-5.4/smackfs-use-netlbl_cfg_cipsov4_del-for-deleting-cips.patch [new file with mode: 0644]
queue-5.4/soc-fsl-dpaa2-console-free-buffer-before-returning-f.patch [new file with mode: 0644]
queue-5.4/soc-tegra-fix-an-error-handling-path-in-tegra_powerg.patch [new file with mode: 0644]
queue-5.4/spi-bcm-qspi-fix-missing-clk_disable_unprepare-on-er.patch [new file with mode: 0644]
queue-5.4/staging-ks7010-select-crypto_hash-crypto_michael_mic.patch [new file with mode: 0644]
queue-5.4/task_stack-fix-end_of_stack-for-architectures-with-u.patch [new file with mode: 0644]
queue-5.4/tcp-don-t-free-a-fin-sk_buff-in-tcp_remove_empty_skb.patch [new file with mode: 0644]
queue-5.4/tracefs-have-tracefs-directories-not-set-oth-permiss.patch [new file with mode: 0644]
queue-5.4/tracing-cfi-fix-cmp_entries_-functions-signature-mis.patch [new file with mode: 0644]
queue-5.4/udp6-allow-so_mark-ctrl-msg-to-affect-routing.patch [new file with mode: 0644]
queue-5.4/usb-gadget-hid-fix-error-code-in-do_config.patch [new file with mode: 0644]
queue-5.4/video-fbdev-chipsfb-use-memset_io-instead-of-memset.patch [new file with mode: 0644]
queue-5.4/virtio-gpu-fix-possible-memory-allocation-failure.patch [new file with mode: 0644]
queue-5.4/vrf-run-conntrack-only-in-context-of-lower-physdev-f.patch [new file with mode: 0644]
queue-5.4/vsock-prevent-unnecessary-refcnt-inc-for-nonblocking.patch [new file with mode: 0644]
queue-5.4/watchdog-f71808e_wdt-fix-inaccurate-report-in-wdioc_.patch [new file with mode: 0644]
queue-5.4/wcn36xx-add-proper-dma-memory-barriers-in-rx-path.patch [new file with mode: 0644]
queue-5.4/wilc1000-fix-possible-memory-leak-in-cfg_scan_result.patch [new file with mode: 0644]
queue-5.4/workqueue-make-sysfs-of-unbound-kworker-cpumask-more.patch [new file with mode: 0644]
queue-5.4/x86-hyperv-protect-set_hv_tscchange_cb-against-getti.patch [new file with mode: 0644]
queue-5.4/x86-increase-exception-stack-sizes.patch [new file with mode: 0644]
queue-5.4/xen-pciback-fix-return-in-pm_ctrl_init.patch [new file with mode: 0644]
queue-5.4/zram-off-by-one-in-read_block_state.patch [new file with mode: 0644]

diff --git a/queue-5.4/acpi-battery-accept-charges-over-the-design-capacity.patch b/queue-5.4/acpi-battery-accept-charges-over-the-design-capacity.patch
new file mode 100644 (file)
index 0000000..716e9d5
--- /dev/null
@@ -0,0 +1,44 @@
+From 00a94e24f6c814d511ca9f5e0ca3a1202062fcf0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 8 Oct 2021 00:05:29 -0300
+Subject: ACPI: battery: Accept charges over the design capacity as full
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: André Almeida <andrealmeid@collabora.com>
+
+[ Upstream commit 2835f327bd1240508db2c89fe94a056faa53c49a ]
+
+Some buggy firmware and/or brand new batteries can support a charge that's
+slightly over the reported design capacity. In such cases, the kernel will
+report to userspace that the charging state of the battery is "Unknown",
+when in reality the battery charge is "Full", at least from the design
+capacity point of view. Make the fallback condition accepts capacities
+over the designed capacity so userspace knows that is full.
+
+Signed-off-by: André Almeida <andrealmeid@collabora.com>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/acpi/battery.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
+index 254a7d98b9d4c..6e96ed68b3379 100644
+--- a/drivers/acpi/battery.c
++++ b/drivers/acpi/battery.c
+@@ -185,7 +185,7 @@ static int acpi_battery_is_charged(struct acpi_battery *battery)
+               return 1;
+       /* fallback to using design values for broken batteries */
+-      if (battery->design_capacity == battery->capacity_now)
++      if (battery->design_capacity <= battery->capacity_now)
+               return 1;
+       /* we don't do any sort of metric based on percentages */
+-- 
+2.33.0
+
diff --git a/queue-5.4/acpi-pmic-fix-intel_pmic_regs_handler-read-accesses.patch b/queue-5.4/acpi-pmic-fix-intel_pmic_regs_handler-read-accesses.patch
new file mode 100644 (file)
index 0000000..263dc2f
--- /dev/null
@@ -0,0 +1,141 @@
+From 9b7eb342922690c5ee2ad511057bf713f731ce29 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 31 Oct 2021 16:31:35 +0100
+Subject: ACPI: PMIC: Fix intel_pmic_regs_handler() read accesses
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+[ Upstream commit 009a789443fe4c8e6b1ecb7c16b4865c026184cd ]
+
+The handling of PMIC register reads through writing 0 to address 4
+of the OpRegion is wrong. Instead of returning the read value
+through the value64, which is a no-op for function == ACPI_WRITE calls,
+store the value and then on a subsequent function == ACPI_READ with
+address == 3 (the address for the value field of the OpRegion)
+return the stored value.
+
+This has been tested on a Xiaomi Mi Pad 2 and makes the ACPI battery dev
+there mostly functional (unfortunately there are still other issues).
+
+Here are the SET() / GET() functions of the PMIC ACPI device,
+which use this OpRegion, which clearly show the new behavior to
+be correct:
+
+OperationRegion (REGS, 0x8F, Zero, 0x50)
+Field (REGS, ByteAcc, NoLock, Preserve)
+{
+    CLNT,   8,
+    SA,     8,
+    OFF,    8,
+    VAL,    8,
+    RWM,    8
+}
+
+Method (GET, 3, Serialized)
+{
+    If ((AVBE == One))
+    {
+        CLNT = Arg0
+        SA = Arg1
+        OFF = Arg2
+        RWM = Zero
+        If ((AVBG == One))
+        {
+            GPRW = Zero
+        }
+    }
+
+    Return (VAL) /* \_SB_.PCI0.I2C7.PMI5.VAL_ */
+}
+
+Method (SET, 4, Serialized)
+{
+    If ((AVBE == One))
+    {
+        CLNT = Arg0
+        SA = Arg1
+        OFF = Arg2
+        VAL = Arg3
+        RWM = One
+        If ((AVBG == One))
+        {
+            GPRW = One
+        }
+    }
+}
+
+Fixes: 0afa877a5650 ("ACPI / PMIC: intel: add REGS operation region support")
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/acpi/pmic/intel_pmic.c | 51 +++++++++++++++++++---------------
+ 1 file changed, 28 insertions(+), 23 deletions(-)
+
+diff --git a/drivers/acpi/pmic/intel_pmic.c b/drivers/acpi/pmic/intel_pmic.c
+index 452041398b347..36d5a5d50b2ff 100644
+--- a/drivers/acpi/pmic/intel_pmic.c
++++ b/drivers/acpi/pmic/intel_pmic.c
+@@ -211,31 +211,36 @@ static acpi_status intel_pmic_regs_handler(u32 function,
+               void *handler_context, void *region_context)
+ {
+       struct intel_pmic_opregion *opregion = region_context;
+-      int result = 0;
++      int result = -EINVAL;
++
++      if (function == ACPI_WRITE) {
++              switch (address) {
++              case 0:
++                      return AE_OK;
++              case 1:
++                      opregion->ctx.addr |= (*value64 & 0xff) << 8;
++                      return AE_OK;
++              case 2:
++                      opregion->ctx.addr |= *value64 & 0xff;
++                      return AE_OK;
++              case 3:
++                      opregion->ctx.val = *value64 & 0xff;
++                      return AE_OK;
++              case 4:
++                      if (*value64) {
++                              result = regmap_write(opregion->regmap, opregion->ctx.addr,
++                                                    opregion->ctx.val);
++                      } else {
++                              result = regmap_read(opregion->regmap, opregion->ctx.addr,
++                                                   &opregion->ctx.val);
++                      }
++                      opregion->ctx.addr = 0;
++              }
++      }
+-      switch (address) {
+-      case 0:
+-              return AE_OK;
+-      case 1:
+-              opregion->ctx.addr |= (*value64 & 0xff) << 8;
+-              return AE_OK;
+-      case 2:
+-              opregion->ctx.addr |= *value64 & 0xff;
++      if (function == ACPI_READ && address == 3) {
++              *value64 = opregion->ctx.val;
+               return AE_OK;
+-      case 3:
+-              opregion->ctx.val = *value64 & 0xff;
+-              return AE_OK;
+-      case 4:
+-              if (*value64) {
+-                      result = regmap_write(opregion->regmap, opregion->ctx.addr,
+-                                            opregion->ctx.val);
+-              } else {
+-                      result = regmap_read(opregion->regmap, opregion->ctx.addr,
+-                                           &opregion->ctx.val);
+-                      if (result == 0)
+-                              *value64 = opregion->ctx.val;
+-              }
+-              memset(&opregion->ctx, 0x00, sizeof(opregion->ctx));
+       }
+       if (result < 0) {
+-- 
+2.33.0
+
diff --git a/queue-5.4/acpica-avoid-evaluating-methods-too-early-during-sys.patch b/queue-5.4/acpica-avoid-evaluating-methods-too-early-during-sys.patch
new file mode 100644 (file)
index 0000000..6b8f5c5
--- /dev/null
@@ -0,0 +1,130 @@
+From a840d71b60fcb8d12ac047327183395db4e5cb21 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 29 Sep 2021 18:31:25 +0200
+Subject: ACPICA: Avoid evaluating methods too early during system resume
+
+From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+
+[ Upstream commit d3c4b6f64ad356c0d9ddbcf73fa471e6a841cc5c ]
+
+ACPICA commit 0762982923f95eb652cf7ded27356b247c9774de
+
+During wakeup from system-wide sleep states, acpi_get_sleep_type_data()
+is called and it tries to get memory from the slab allocator in order
+to evaluate a control method, but if KFENCE is enabled in the kernel,
+the memory allocation attempt causes an IRQ work to be queued and a
+self-IPI to be sent to the CPU running the code which requires the
+memory controller to be ready, so if that happens too early in the
+wakeup path, it doesn't work.
+
+Prevent that from taking place by calling acpi_get_sleep_type_data()
+for S0 upfront, when preparing to enter a given sleep state, and
+saving the data obtained by it for later use during system wakeup.
+
+BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=214271
+Reported-by: Reik Keutterling <spielkind@gmail.com>
+Tested-by: Reik Keutterling <spielkind@gmail.com>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/acpi/acpica/acglobal.h  |  2 ++
+ drivers/acpi/acpica/hwesleep.c  |  8 ++------
+ drivers/acpi/acpica/hwsleep.c   | 11 ++++-------
+ drivers/acpi/acpica/hwxfsleep.c |  7 +++++++
+ 4 files changed, 15 insertions(+), 13 deletions(-)
+
+diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
+index fd3beea934213..42c4bfd796f42 100644
+--- a/drivers/acpi/acpica/acglobal.h
++++ b/drivers/acpi/acpica/acglobal.h
+@@ -220,6 +220,8 @@ extern struct acpi_bit_register_info
+     acpi_gbl_bit_register_info[ACPI_NUM_BITREG];
+ ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a);
+ ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b);
++ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a_s0);
++ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b_s0);
+ /*****************************************************************************
+  *
+diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
+index dee3affaca491..aa502ae3b6b31 100644
+--- a/drivers/acpi/acpica/hwesleep.c
++++ b/drivers/acpi/acpica/hwesleep.c
+@@ -147,17 +147,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
+ acpi_status acpi_hw_extended_wake_prep(u8 sleep_state)
+ {
+-      acpi_status status;
+       u8 sleep_type_value;
+       ACPI_FUNCTION_TRACE(hw_extended_wake_prep);
+-      status = acpi_get_sleep_type_data(ACPI_STATE_S0,
+-                                        &acpi_gbl_sleep_type_a,
+-                                        &acpi_gbl_sleep_type_b);
+-      if (ACPI_SUCCESS(status)) {
++      if (acpi_gbl_sleep_type_a_s0 != ACPI_SLEEP_TYPE_INVALID) {
+               sleep_type_value =
+-                  ((acpi_gbl_sleep_type_a << ACPI_X_SLEEP_TYPE_POSITION) &
++                  ((acpi_gbl_sleep_type_a_s0 << ACPI_X_SLEEP_TYPE_POSITION) &
+                    ACPI_X_SLEEP_TYPE_MASK);
+               (void)acpi_write((u64)(sleep_type_value | ACPI_X_SLEEP_ENABLE),
+diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
+index b62db8ec446fa..5f7d63badbe9d 100644
+--- a/drivers/acpi/acpica/hwsleep.c
++++ b/drivers/acpi/acpica/hwsleep.c
+@@ -179,7 +179,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
+ acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state)
+ {
+-      acpi_status status;
++      acpi_status status = AE_OK;
+       struct acpi_bit_register_info *sleep_type_reg_info;
+       struct acpi_bit_register_info *sleep_enable_reg_info;
+       u32 pm1a_control;
+@@ -192,10 +192,7 @@ acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state)
+        * This is unclear from the ACPI Spec, but it is required
+        * by some machines.
+        */
+-      status = acpi_get_sleep_type_data(ACPI_STATE_S0,
+-                                        &acpi_gbl_sleep_type_a,
+-                                        &acpi_gbl_sleep_type_b);
+-      if (ACPI_SUCCESS(status)) {
++      if (acpi_gbl_sleep_type_a_s0 != ACPI_SLEEP_TYPE_INVALID) {
+               sleep_type_reg_info =
+                   acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE);
+               sleep_enable_reg_info =
+@@ -216,9 +213,9 @@ acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state)
+                       /* Insert the SLP_TYP bits */
+-                      pm1a_control |= (acpi_gbl_sleep_type_a <<
++                      pm1a_control |= (acpi_gbl_sleep_type_a_s0 <<
+                                        sleep_type_reg_info->bit_position);
+-                      pm1b_control |= (acpi_gbl_sleep_type_b <<
++                      pm1b_control |= (acpi_gbl_sleep_type_b_s0 <<
+                                        sleep_type_reg_info->bit_position);
+                       /* Write the control registers and ignore any errors */
+diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
+index abbf9702aa7f2..79731efbe8fe2 100644
+--- a/drivers/acpi/acpica/hwxfsleep.c
++++ b/drivers/acpi/acpica/hwxfsleep.c
+@@ -214,6 +214,13 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
+               return_ACPI_STATUS(status);
+       }
++      status = acpi_get_sleep_type_data(ACPI_STATE_S0,
++                                        &acpi_gbl_sleep_type_a_s0,
++                                        &acpi_gbl_sleep_type_b_s0);
++      if (ACPI_FAILURE(status)) {
++              acpi_gbl_sleep_type_a_s0 = ACPI_SLEEP_TYPE_INVALID;
++      }
++
+       /* Execute the _PTS method (Prepare To Sleep) */
+       arg_list.count = 1;
+-- 
+2.33.0
+
diff --git a/queue-5.4/alsa-hda-reduce-udelay-at-skl-position-reporting.patch b/queue-5.4/alsa-hda-reduce-udelay-at-skl-position-reporting.patch
new file mode 100644 (file)
index 0000000..2f922e3
--- /dev/null
@@ -0,0 +1,116 @@
+From 8703086ff48ac44e12f68b5c9706757f45fee815 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 29 Sep 2021 09:29:33 +0200
+Subject: ALSA: hda: Reduce udelay() at SKL+ position reporting
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit 46243b85b0ec5d2cee7545e5ce18c015ce91957e ]
+
+The position reporting on Intel Skylake and later chips via
+azx_get_pos_skl() contains a udelay(20) call for the capture streams.
+A call for this alone doesn't sound too harmful.  However, as the
+pointer PCM ops is one of the hottest path in the PCM operations --
+especially for the timer-scheduled operations like PulseAudio -- such
+a delay hogs CPU usage significantly in the total performance.
+
+The code there was taken from the original code in ASoC SST Skylake
+driver blindly.  The udelay() is a workaround for the case where the
+reported position is behind the period boundary at the timing
+triggered from interrupts; applications often expect that the full
+data is available for the whole period when returned (and also that's
+the definition of the ALSA PCM period).
+
+OTOH, HD-audio (legacy) driver has already some workarounds for the
+delayed position reporting due to its relatively large FIFO, such as
+the BDL position adjustment and the delayed period-elapsed call in the
+work.  That said, the udelay() is almost superfluous for HD-audio
+driver unlike SST, and we can drop the udelay().
+
+Though, the current code doesn't guarantee the full period readiness
+as mentioned in the above, but rather it checks the wallclock and
+detects the unexpected jump.  That's one missing piece, and the drop
+of udelay() needs a bit more sanity checks for the delayed handling.
+
+This patch implements those: the drop of udelay() call in
+azx_get_pos_skl() and the more proper check of hwptr in
+azx_position_ok().  The latter change is applied only for the case
+where the stream is running in the normal mode without
+no_period_wakeup flag.  When no_period_wakeup is set, it essentially
+ignores the period handling and rather concentrates only on the
+current position; which implies that we don't need to care about the
+period boundary at all.
+
+Fixes: f87e7f25893d ("ALSA: hda - Improved position reporting on SKL+")
+Reported-by: Jens Axboe <axboe@kernel.dk>
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20210929072934.6809-2-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/hda_intel.c | 28 +++++++++++++++++++++++-----
+ 1 file changed, 23 insertions(+), 5 deletions(-)
+
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
+index ebb1ee69dd0c3..95d472d433e70 100644
+--- a/sound/pci/hda/hda_intel.c
++++ b/sound/pci/hda/hda_intel.c
+@@ -671,13 +671,17 @@ static int azx_position_check(struct azx *chip, struct azx_dev *azx_dev)
+  * the update-IRQ timing.  The IRQ is issued before actually the
+  * data is processed.  So, we need to process it afterwords in a
+  * workqueue.
++ *
++ * Returns 1 if OK to proceed, 0 for delay handling, -1 for skipping update
+  */
+ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev)
+ {
+       struct snd_pcm_substream *substream = azx_dev->core.substream;
++      struct snd_pcm_runtime *runtime = substream->runtime;
+       int stream = substream->stream;
+       u32 wallclk;
+       unsigned int pos;
++      snd_pcm_uframes_t hwptr, target;
+       wallclk = azx_readl(chip, WALLCLK) - azx_dev->core.start_wallclk;
+       if (wallclk < (azx_dev->core.period_wallclk * 2) / 3)
+@@ -714,6 +718,24 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev)
+               /* NG - it's below the first next period boundary */
+               return chip->bdl_pos_adj ? 0 : -1;
+       azx_dev->core.start_wallclk += wallclk;
++
++      if (azx_dev->core.no_period_wakeup)
++              return 1; /* OK, no need to check period boundary */
++
++      if (runtime->hw_ptr_base != runtime->hw_ptr_interrupt)
++              return 1; /* OK, already in hwptr updating process */
++
++      /* check whether the period gets really elapsed */
++      pos = bytes_to_frames(runtime, pos);
++      hwptr = runtime->hw_ptr_base + pos;
++      if (hwptr < runtime->status->hw_ptr)
++              hwptr += runtime->buffer_size;
++      target = runtime->hw_ptr_interrupt + runtime->period_size;
++      if (hwptr < target) {
++              /* too early wakeup, process it later */
++              return chip->bdl_pos_adj ? 0 : -1;
++      }
++
+       return 1; /* OK, it's fine */
+ }
+@@ -907,11 +929,7 @@ static unsigned int azx_get_pos_skl(struct azx *chip, struct azx_dev *azx_dev)
+       if (azx_dev->core.substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+               return azx_skl_get_dpib_pos(chip, azx_dev);
+-      /* For capture, we need to read posbuf, but it requires a delay
+-       * for the possible boundary overlap; the read of DPIB fetches the
+-       * actual posbuf
+-       */
+-      udelay(20);
++      /* read of DPIB fetches the actual posbuf */
+       azx_skl_get_dpib_pos(chip, azx_dev);
+       return azx_get_pos_posbuf(chip, azx_dev);
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/apparmor-fix-error-check.patch b/queue-5.4/apparmor-fix-error-check.patch
new file mode 100644 (file)
index 0000000..dde9b68
--- /dev/null
@@ -0,0 +1,60 @@
+From f85077b6f8665792edce275cf61d062f42101308 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 4 Oct 2020 07:24:22 -0700
+Subject: apparmor: fix error check
+
+From: Tom Rix <trix@redhat.com>
+
+[ Upstream commit d108370c644b153382632b3e5511ade575c91c86 ]
+
+clang static analysis reports this representative problem:
+
+label.c:1463:16: warning: Assigned value is garbage or undefined
+        label->hname = name;
+                     ^ ~~~~
+
+In aa_update_label_name(), this the problem block of code
+
+       if (aa_label_acntsxprint(&name, ...) == -1)
+               return res;
+
+On failure, aa_label_acntsxprint() has a more complicated return
+that just -1.  So check for a negative return.
+
+It was also noted that the aa_label_acntsxprint() main comment refers
+to a nonexistent parameter, so clean up the comment.
+
+Fixes: f1bd904175e8 ("apparmor: add the base fns() for domain labels")
+Signed-off-by: Tom Rix <trix@redhat.com>
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: John Johansen <john.johansen@canonical.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ security/apparmor/label.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/security/apparmor/label.c b/security/apparmor/label.c
+index 5f324d63ceaa3..747a734a08246 100644
+--- a/security/apparmor/label.c
++++ b/security/apparmor/label.c
+@@ -1459,7 +1459,7 @@ bool aa_update_label_name(struct aa_ns *ns, struct aa_label *label, gfp_t gfp)
+       if (label->hname || labels_ns(label) != ns)
+               return res;
+-      if (aa_label_acntsxprint(&name, ns, label, FLAGS_NONE, gfp) == -1)
++      if (aa_label_acntsxprint(&name, ns, label, FLAGS_NONE, gfp) < 0)
+               return res;
+       ls = labels_set(label);
+@@ -1709,7 +1709,7 @@ int aa_label_asxprint(char **strp, struct aa_ns *ns, struct aa_label *label,
+ /**
+  * aa_label_acntsxprint - allocate a __counted string buffer and print label
+- * @strp: buffer to write to. (MAY BE NULL if @size == 0)
++ * @strp: buffer to write to.
+  * @ns: namespace profile is being viewed from
+  * @label: label to view (NOT NULL)
+  * @flags: flags controlling what label info is printed
+-- 
+2.33.0
+
diff --git a/queue-5.4/ar7-fix-kernel-builds-for-compiler-test.patch b/queue-5.4/ar7-fix-kernel-builds-for-compiler-test.patch
new file mode 100644 (file)
index 0000000..5688526
--- /dev/null
@@ -0,0 +1,49 @@
+From 9589f83a4d1f787ebd47ea5c572aad0816796405 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 7 Sep 2021 10:49:04 +0800
+Subject: ar7: fix kernel builds for compiler test
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Jackie Liu <liuyun01@kylinos.cn>
+
+[ Upstream commit 28b7ee33a2122569ac065cad578bf23f50cc65c3 ]
+
+TI AR7 Watchdog Timer is only build for 32bit.
+
+Avoid error like:
+In file included from drivers/watchdog/ar7_wdt.c:29:
+./arch/mips/include/asm/mach-ar7/ar7.h: In function â€˜ar7_is_titan’:
+./arch/mips/include/asm/mach-ar7/ar7.h:111:24: error: implicit declaration of function â€˜KSEG1ADDR’; did you mean â€˜CKSEG1ADDR’? [-Werror=implicit-function-declaration]
+  111 |  return (readl((void *)KSEG1ADDR(AR7_REGS_GPIO + 0x24)) & 0xffff) ==
+      |                        ^~~~~~~~~
+      |                        CKSEG1ADDR
+
+Fixes: da2a68b3eb47 ("watchdog: Enable COMPILE_TEST where possible")
+Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
+Reviewed-by: Guenter Roeck <linux@roeck-us.net>
+Link: https://lore.kernel.org/r/20210907024904.4127611-1-liu.yun@linux.dev
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/watchdog/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
+index 1aa42e879e633..3fabd4177b0ee 100644
+--- a/drivers/watchdog/Kconfig
++++ b/drivers/watchdog/Kconfig
+@@ -1682,7 +1682,7 @@ config SIBYTE_WDOG
+ config AR7_WDT
+       tristate "TI AR7 Watchdog Timer"
+-      depends on AR7 || (MIPS && COMPILE_TEST)
++      depends on AR7 || (MIPS && 32BIT && COMPILE_TEST)
+       help
+         Hardware driver for the TI AR7 Watchdog Timer.
+-- 
+2.33.0
+
diff --git a/queue-5.4/arm-9136-1-armv7-m-uses-be-8-not-be-32.patch b/queue-5.4/arm-9136-1-armv7-m-uses-be-8-not-be-32.patch
new file mode 100644 (file)
index 0000000..c055326
--- /dev/null
@@ -0,0 +1,47 @@
+From 3f32bb9fc11794eb8c3b0d83bfbb91862d4b1e03 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 18 Oct 2021 15:30:06 +0100
+Subject: ARM: 9136/1: ARMv7-M uses BE-8, not BE-32
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit 345dac33f58894a56d17b92a41be10e16585ceff ]
+
+When configuring the kernel for big-endian, we set either BE-8 or BE-32
+based on the CPU architecture level. Until linux-4.4, we did not have
+any ARMv7-M platform allowing big-endian builds, but now i.MX/Vybrid
+is in that category, adn we get a build error because of this:
+
+arch/arm/kernel/module-plts.c: In function 'get_module_plt':
+arch/arm/kernel/module-plts.c:60:46: error: implicit declaration of function '__opcode_to_mem_thumb32' [-Werror=implicit-function-declaration]
+
+This comes down to picking the wrong default, ARMv7-M uses BE8
+like ARMv7-A does. Changing the default gets the kernel to compile
+and presumably works.
+
+https://lore.kernel.org/all/1455804123-2526139-2-git-send-email-arnd@arndb.de/
+
+Tested-by: Vladimir Murzin <vladimir.murzin@arm.com>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/mm/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
+index 0ab3a86b1f523..fc388eb60e0b7 100644
+--- a/arch/arm/mm/Kconfig
++++ b/arch/arm/mm/Kconfig
+@@ -752,7 +752,7 @@ config CPU_BIG_ENDIAN
+ config CPU_ENDIAN_BE8
+       bool
+       depends on CPU_BIG_ENDIAN
+-      default CPU_V6 || CPU_V6K || CPU_V7
++      default CPU_V6 || CPU_V6K || CPU_V7 || CPU_V7M
+       help
+         Support for the BE-8 (big-endian) mode on ARMv6 and ARMv7 processors.
+-- 
+2.33.0
+
diff --git a/queue-5.4/arm-clang-do-not-rely-on-lr-register-for-stacktrace.patch b/queue-5.4/arm-clang-do-not-rely-on-lr-register-for-stacktrace.patch
new file mode 100644 (file)
index 0000000..b1dced5
--- /dev/null
@@ -0,0 +1,46 @@
+From 9fcf89f6d5cf3cabd68ceac65fbd1c3801e41b9e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 21 Oct 2021 09:55:17 +0900
+Subject: ARM: clang: Do not rely on lr register for stacktrace
+
+From: Masami Hiramatsu <mhiramat@kernel.org>
+
+[ Upstream commit b3ea5d56f212ad81328c82454829a736197ebccc ]
+
+Currently the stacktrace on clang compiled arm kernel uses the 'lr'
+register to find the first frame address from pt_regs. However, that
+is wrong after calling another function, because the 'lr' register
+is used by 'bl' instruction and never be recovered.
+
+As same as gcc arm kernel, directly use the frame pointer (r11) of
+the pt_regs to find the first frame address.
+
+Note that this fixes kretprobe stacktrace issue only with
+CONFIG_UNWINDER_FRAME_POINTER=y. For the CONFIG_UNWINDER_ARM,
+we need another fix.
+
+Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/kernel/stacktrace.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c
+index 76ea4178a55cb..db798eac74315 100644
+--- a/arch/arm/kernel/stacktrace.c
++++ b/arch/arm/kernel/stacktrace.c
+@@ -54,8 +54,7 @@ int notrace unwind_frame(struct stackframe *frame)
+       frame->sp = frame->fp;
+       frame->fp = *(unsigned long *)(fp);
+-      frame->pc = frame->lr;
+-      frame->lr = *(unsigned long *)(fp + 4);
++      frame->pc = *(unsigned long *)(fp + 4);
+ #else
+       /* check current frame pointer is within bounds */
+       if (fp < low + 12 || fp > high - 4)
+-- 
+2.33.0
+
diff --git a/queue-5.4/arm-dts-at91-tse850-the-emac-phy-interface-is-rmii.patch b/queue-5.4/arm-dts-at91-tse850-the-emac-phy-interface-is-rmii.patch
new file mode 100644 (file)
index 0000000..03c311e
--- /dev/null
@@ -0,0 +1,39 @@
+From e216655529c38de3514ab04b8eaa8a04cde2f5ff Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 20 Sep 2021 22:37:38 +0200
+Subject: ARM: dts: at91: tse850: the emac<->phy interface is rmii
+
+From: Peter Rosin <peda@axentia.se>
+
+[ Upstream commit dcdbc335a91a26e022a803e1a6b837266989c032 ]
+
+This went unnoticed until commit 7897b071ac3b ("net: macb: convert
+to phylink") which tickled the problem. The sama5d3 emac has never
+been capable of rgmii, and it all just happened to work before that
+commit.
+
+Fixes: 21dd0ece34c2 ("ARM: dts: at91: add devicetree for the Axentia TSE-850")
+Signed-off-by: Peter Rosin <peda@axentia.se>
+Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
+Link: https://lore.kernel.org/r/ea781f5e-422f-6cbf-3cf4-d5a7bac9392d@axentia.se
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/at91-tse850-3.dts | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/at91-tse850-3.dts b/arch/arm/boot/dts/at91-tse850-3.dts
+index 3ca97b47c69ce..7e5c598e7e68f 100644
+--- a/arch/arm/boot/dts/at91-tse850-3.dts
++++ b/arch/arm/boot/dts/at91-tse850-3.dts
+@@ -262,7 +262,7 @@
+ &macb1 {
+       status = "okay";
+-      phy-mode = "rgmii";
++      phy-mode = "rmii";
+       #address-cells = <1>;
+       #size-cells = <0>;
+-- 
+2.33.0
+
diff --git a/queue-5.4/arm-dts-omap3-gta04a4-accelerometer-irq-fix.patch b/queue-5.4/arm-dts-omap3-gta04a4-accelerometer-irq-fix.patch
new file mode 100644 (file)
index 0000000..2b74682
--- /dev/null
@@ -0,0 +1,36 @@
+From e21c9e25b858c17099d5347291048ef9f7d3138c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 1 Oct 2021 09:34:15 +0200
+Subject: arm: dts: omap3-gta04a4: accelerometer irq fix
+
+From: Andreas Kemnade <andreas@kemnade.info>
+
+[ Upstream commit 884ea75d79a36faf3731ad9d6b9c29f58697638d ]
+
+Fix typo in pinctrl. It did only work because the bootloader
+seems to have initialized it.
+
+Fixes: ee327111953b ("ARM: dts: omap3-gta04: Define and use bma180 irq pin")
+Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/omap3-gta04.dtsi | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi
+index b6ef1a7ac8a4e..186b2af7743e3 100644
+--- a/arch/arm/boot/dts/omap3-gta04.dtsi
++++ b/arch/arm/boot/dts/omap3-gta04.dtsi
+@@ -515,7 +515,7 @@
+               compatible = "bosch,bma180";
+               reg = <0x41>;
+               pinctrl-names = "default";
+-              pintcrl-0 = <&bma180_pins>;
++              pinctrl-0 = <&bma180_pins>;
+               interrupt-parent = <&gpio4>;
+               interrupts = <19 IRQ_TYPE_LEVEL_HIGH>; /* GPIO_115 */
+       };
+-- 
+2.33.0
+
diff --git a/queue-5.4/arm-dts-qcom-msm8974-add-xo_board-reference-clock-to.patch b/queue-5.4/arm-dts-qcom-msm8974-add-xo_board-reference-clock-to.patch
new file mode 100644 (file)
index 0000000..50bbee0
--- /dev/null
@@ -0,0 +1,40 @@
+From 2adc9aca0f6703b84855a5909aa32f3bd95c5e18 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 30 Aug 2021 19:57:39 +0200
+Subject: ARM: dts: qcom: msm8974: Add xo_board reference clock to DSI0 PHY
+
+From: Marijn Suijten <marijn.suijten@somainline.org>
+
+[ Upstream commit 8ccecf6c710b8c048eecc65709640642e5357d6e ]
+
+According to YAML validation, and for a future patchset putting this
+xo_board reference clock to use as VCO reference parent, add the missing
+clock to dsi_phy0.
+
+Fixes: 5a9fc531f6ec ("ARM: dts: msm8974: add display support")
+Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
+Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
+Link: https://lore.kernel.org/r/20210830175739.143401-1-marijn.suijten@somainline.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/qcom-msm8974.dtsi | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-msm8974.dtsi
+index 369e58f64145d..9de4f17955e31 100644
+--- a/arch/arm/boot/dts/qcom-msm8974.dtsi
++++ b/arch/arm/boot/dts/qcom-msm8974.dtsi
+@@ -1213,8 +1213,8 @@
+                               #phy-cells = <0>;
+                               qcom,dsi-phy-index = <0>;
+-                              clocks = <&mmcc MDSS_AHB_CLK>;
+-                              clock-names = "iface";
++                              clocks = <&mmcc MDSS_AHB_CLK>, <&xo_board>;
++                              clock-names = "iface", "ref";
+                       };
+               };
+       };
+-- 
+2.33.0
+
diff --git a/queue-5.4/arm-dts-stm32-fix-sai-sub-nodes-register-range.patch b/queue-5.4/arm-dts-stm32-fix-sai-sub-nodes-register-range.patch
new file mode 100644 (file)
index 0000000..357a9d6
--- /dev/null
@@ -0,0 +1,102 @@
+From dcb3f2840a756786629728c9fb15785b1d9290fd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 24 Sep 2021 18:02:21 +0200
+Subject: ARM: dts: stm32: fix SAI sub nodes register range
+
+From: Olivier Moysan <olivier.moysan@foss.st.com>
+
+[ Upstream commit 6f87a74d31277f0896dcf8c0850ec14bde03c423 ]
+
+The STM32 SAI subblocks registers offsets are in the range
+0x0004 (SAIx_CR1) to 0x0020 (SAIx_DR).
+The corresponding range length is 0x20 instead of 0x1c.
+Change reg property accordingly.
+
+Fixes: 5afd65c3a060 ("ARM: dts: stm32: add sai support on stm32mp157c")
+
+Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
+Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/stm32mp157c.dtsi | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/arch/arm/boot/dts/stm32mp157c.dtsi b/arch/arm/boot/dts/stm32mp157c.dtsi
+index eca469a64a977..a687c024daa92 100644
+--- a/arch/arm/boot/dts/stm32mp157c.dtsi
++++ b/arch/arm/boot/dts/stm32mp157c.dtsi
+@@ -773,7 +773,7 @@
+                               #sound-dai-cells = <0>;
+                               compatible = "st,stm32-sai-sub-a";
+-                              reg = <0x4 0x1c>;
++                              reg = <0x4 0x20>;
+                               clocks = <&rcc SAI1_K>;
+                               clock-names = "sai_ck";
+                               dmas = <&dmamux1 87 0x400 0x01>;
+@@ -783,7 +783,7 @@
+                       sai1b: audio-controller@4400a024 {
+                               #sound-dai-cells = <0>;
+                               compatible = "st,stm32-sai-sub-b";
+-                              reg = <0x24 0x1c>;
++                              reg = <0x24 0x20>;
+                               clocks = <&rcc SAI1_K>;
+                               clock-names = "sai_ck";
+                               dmas = <&dmamux1 88 0x400 0x01>;
+@@ -804,7 +804,7 @@
+                       sai2a: audio-controller@4400b004 {
+                               #sound-dai-cells = <0>;
+                               compatible = "st,stm32-sai-sub-a";
+-                              reg = <0x4 0x1c>;
++                              reg = <0x4 0x20>;
+                               clocks = <&rcc SAI2_K>;
+                               clock-names = "sai_ck";
+                               dmas = <&dmamux1 89 0x400 0x01>;
+@@ -814,7 +814,7 @@
+                       sai2b: audio-controller@4400b024 {
+                               #sound-dai-cells = <0>;
+                               compatible = "st,stm32-sai-sub-b";
+-                              reg = <0x24 0x1c>;
++                              reg = <0x24 0x20>;
+                               clocks = <&rcc SAI2_K>;
+                               clock-names = "sai_ck";
+                               dmas = <&dmamux1 90 0x400 0x01>;
+@@ -835,7 +835,7 @@
+                       sai3a: audio-controller@4400c004 {
+                               #sound-dai-cells = <0>;
+                               compatible = "st,stm32-sai-sub-a";
+-                              reg = <0x04 0x1c>;
++                              reg = <0x04 0x20>;
+                               clocks = <&rcc SAI3_K>;
+                               clock-names = "sai_ck";
+                               dmas = <&dmamux1 113 0x400 0x01>;
+@@ -845,7 +845,7 @@
+                       sai3b: audio-controller@4400c024 {
+                               #sound-dai-cells = <0>;
+                               compatible = "st,stm32-sai-sub-b";
+-                              reg = <0x24 0x1c>;
++                              reg = <0x24 0x20>;
+                               clocks = <&rcc SAI3_K>;
+                               clock-names = "sai_ck";
+                               dmas = <&dmamux1 114 0x400 0x01>;
+@@ -1191,7 +1191,7 @@
+                       sai4a: audio-controller@50027004 {
+                               #sound-dai-cells = <0>;
+                               compatible = "st,stm32-sai-sub-a";
+-                              reg = <0x04 0x1c>;
++                              reg = <0x04 0x20>;
+                               clocks = <&rcc SAI4_K>;
+                               clock-names = "sai_ck";
+                               dmas = <&dmamux1 99 0x400 0x01>;
+@@ -1201,7 +1201,7 @@
+                       sai4b: audio-controller@50027024 {
+                               #sound-dai-cells = <0>;
+                               compatible = "st,stm32-sai-sub-b";
+-                              reg = <0x24 0x1c>;
++                              reg = <0x24 0x20>;
+                               clocks = <&rcc SAI4_K>;
+                               clock-names = "sai_ck";
+                               dmas = <&dmamux1 100 0x400 0x01>;
+-- 
+2.33.0
+
diff --git a/queue-5.4/arm-s3c-irq-s3c24xx-fix-return-value-check-for-s3c24.patch b/queue-5.4/arm-s3c-irq-s3c24xx-fix-return-value-check-for-s3c24.patch
new file mode 100644 (file)
index 0000000..a0b3c16
--- /dev/null
@@ -0,0 +1,60 @@
+From fde984f2deb1957b68ee591948acf35bd8f31922 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 1 Sep 2021 20:35:57 +0800
+Subject: ARM: s3c: irq-s3c24xx: Fix return value check for s3c24xx_init_intc()
+
+From: Jackie Liu <liuyun01@kylinos.cn>
+
+[ Upstream commit 2aa717473ce96c93ae43a5dc8c23cedc8ce7dd9f ]
+
+The s3c24xx_init_intc() returns an error pointer upon failure, not NULL.
+let's add an error pointer check in s3c24xx_handle_irq.
+
+s3c_intc[0] is not NULL or ERR, we can simplify the code.
+
+Fixes: 1f629b7a3ced ("ARM: S3C24XX: transform irq handling into a declarative form")
+Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
+Link: https://lore.kernel.org/r/20210901123557.1043953-1-liu.yun@linux.dev
+Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/irqchip/irq-s3c24xx.c | 22 ++++++++++++++++++----
+ 1 file changed, 18 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/irqchip/irq-s3c24xx.c b/drivers/irqchip/irq-s3c24xx.c
+index d2031fecc3861..5e97ae54782d6 100644
+--- a/drivers/irqchip/irq-s3c24xx.c
++++ b/drivers/irqchip/irq-s3c24xx.c
+@@ -359,11 +359,25 @@ static inline int s3c24xx_handle_intc(struct s3c_irq_intc *intc,
+ asmlinkage void __exception_irq_entry s3c24xx_handle_irq(struct pt_regs *regs)
+ {
+       do {
+-              if (likely(s3c_intc[0]))
+-                      if (s3c24xx_handle_intc(s3c_intc[0], regs, 0))
+-                              continue;
++              /*
++               * For platform based machines, neither ERR nor NULL can happen here.
++               * The s3c24xx_handle_irq() will be set as IRQ handler iff this succeeds:
++               *
++               *    s3c_intc[0] = s3c24xx_init_intc()
++               *
++               * If this fails, the next calls to s3c24xx_init_intc() won't be executed.
++               *
++               * For DT machine, s3c_init_intc_of() could set the IRQ handler without
++               * setting s3c_intc[0] only if it was called with num_ctrl=0. There is no
++               * such code path, so again the s3c_intc[0] will have a valid pointer if
++               * set_handle_irq() is called.
++               *
++               * Therefore in s3c24xx_handle_irq(), the s3c_intc[0] is always something.
++               */
++              if (s3c24xx_handle_intc(s3c_intc[0], regs, 0))
++                      continue;
+-              if (s3c_intc[2])
++              if (!IS_ERR_OR_NULL(s3c_intc[2]))
+                       if (s3c24xx_handle_intc(s3c_intc[2], regs, 64))
+                               continue;
+-- 
+2.33.0
+
diff --git a/queue-5.4/arm64-dts-meson-g12a-fix-the-pwm-regulator-supply-pr.patch b/queue-5.4/arm64-dts-meson-g12a-fix-the-pwm-regulator-supply-pr.patch
new file mode 100644 (file)
index 0000000..279f7c2
--- /dev/null
@@ -0,0 +1,75 @@
+From 99a1c37a1d3a69c5664a4e08308af0d1741d9942 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 19 Sep 2021 20:29:09 +0000
+Subject: arm64: dts: meson-g12a: Fix the pwm regulator supply properties
+
+From: Anand Moon <linux.amoon@gmail.com>
+
+[ Upstream commit 085675117ecf5e02c4220698fd549024ec64ad2c ]
+
+After enabling CONFIG_REGULATOR_DEBUG=y we observe below debug logs.
+Changes help link VDDCPU pwm regulator to 12V regulator supply
+instead of dummy regulator.
+
+[   11.602281] pwm-regulator regulator-vddcpu: Looking up pwm-supply property
+               in node /regulator-vddcpu failed
+[   11.602344] VDDCPU: supplied by regulator-dummy
+[   11.602365] regulator-dummy: could not add device link regulator.11: -ENOENT
+[   11.602548] VDDCPU: 721 <--> 1022 mV at 1022 mV, enabled
+
+Fixes: e9bc0765cc12 ("arm64: dts: meson-g12a: enable DVFS on G12A boards")
+
+Cc: Neil Armstrong <narmstrong@baylibre.com>
+Signed-off-by: Anand Moon <linux.amoon@gmail.com>
+Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
+Link: https://lore.kernel.org/r/20210919202918.3556-2-linux.amoon@gmail.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts  | 2 +-
+ arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts    | 2 +-
+ arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts
+index c9fa23a565624..b8d9e92197ac8 100644
+--- a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts
++++ b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts
+@@ -139,7 +139,7 @@
+               regulator-min-microvolt = <721000>;
+               regulator-max-microvolt = <1022000>;
+-              vin-supply = <&dc_in>;
++              pwm-supply = <&dc_in>;
+               pwms = <&pwm_AO_cd 1 1250 0>;
+               pwm-dutycycle-range = <100 0>;
+diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts
+index 2a324f0136e3f..02ec6eda03b1c 100644
+--- a/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts
++++ b/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts
+@@ -139,7 +139,7 @@
+               regulator-min-microvolt = <721000>;
+               regulator-max-microvolt = <1022000>;
+-              vin-supply = <&main_12v>;
++              pwm-supply = <&main_12v>;
+               pwms = <&pwm_AO_cd 1 1250 0>;
+               pwm-dutycycle-range = <100 0>;
+diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
+index c48125bf9d1e3..5209c44fda01a 100644
+--- a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
++++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
+@@ -139,7 +139,7 @@
+               regulator-min-microvolt = <721000>;
+               regulator-max-microvolt = <1022000>;
+-              vin-supply = <&dc_in>;
++              pwm-supply = <&dc_in>;
+               pwms = <&pwm_AO_cd 1 1250 0>;
+               pwm-dutycycle-range = <100 0>;
+-- 
+2.33.0
+
diff --git a/queue-5.4/arm64-dts-rockchip-fix-gpu-register-width-for-rk3328.patch b/queue-5.4/arm64-dts-rockchip-fix-gpu-register-width-for-rk3328.patch
new file mode 100644 (file)
index 0000000..8f9242a
--- /dev/null
@@ -0,0 +1,40 @@
+From d4e567dc1d60c05675f5e9a012c634408512a44c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 23 Jun 2021 13:59:26 +0200
+Subject: arm64: dts: rockchip: Fix GPU register width for RK3328
+
+From: Alex Bee <knaerzche@gmail.com>
+
+[ Upstream commit 932b4610f55b49f3a158b0db451137bab7ed0e1f ]
+
+As can be seen in RK3328's TRM the register range for the GPU is
+0xff300000 to 0xff330000.
+It would (and does in vendor kernel) overlap with the registers of
+the HEVC encoder (node/driver do not exist yet in upstream kernel).
+See already existing h265e_mmu node.
+
+Fixes: 752fbc0c8da7 ("arm64: dts: rockchip: add rk3328 mali gpu node")
+Signed-off-by: Alex Bee <knaerzche@gmail.com>
+Link: https://lore.kernel.org/r/20210623115926.164861-1-knaerzche@gmail.com
+Signed-off-by: Heiko Stuebner <heiko@sntech.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/rockchip/rk3328.dtsi | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
+index 44ad744c4710d..6ddb6b8c1fad5 100644
+--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi
++++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
+@@ -555,7 +555,7 @@
+       gpu: gpu@ff300000 {
+               compatible = "rockchip,rk3328-mali", "arm,mali-450";
+-              reg = <0x0 0xff300000 0x0 0x40000>;
++              reg = <0x0 0xff300000 0x0 0x30000>;
+               interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>,
+-- 
+2.33.0
+
diff --git a/queue-5.4/arm64-pgtable-make-__pte_to_phys-__phys_to_pte_val-i.patch b/queue-5.4/arm64-pgtable-make-__pte_to_phys-__phys_to_pte_val-i.patch
new file mode 100644 (file)
index 0000000..2cac3ce
--- /dev/null
@@ -0,0 +1,67 @@
+From 8ec327c454c5ce9b7ec1e8c87d0089edd69e9b4e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 5 Nov 2021 08:54:03 +0100
+Subject: arm64: pgtable: make __pte_to_phys/__phys_to_pte_val inline functions
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit c7c386fbc20262c1d911c615c65db6a58667d92c ]
+
+gcc warns about undefined behavior the vmalloc code when building
+with CONFIG_ARM64_PA_BITS_52, when the 'idx++' in the argument to
+__phys_to_pte_val() is evaluated twice:
+
+mm/vmalloc.c: In function 'vmap_pfn_apply':
+mm/vmalloc.c:2800:58: error: operation on 'data->idx' may be undefined [-Werror=sequence-point]
+ 2800 |         *pte = pte_mkspecial(pfn_pte(data->pfns[data->idx++], data->prot));
+      |                                                 ~~~~~~~~~^~
+arch/arm64/include/asm/pgtable-types.h:25:37: note: in definition of macro '__pte'
+   25 | #define __pte(x)        ((pte_t) { (x) } )
+      |                                     ^
+arch/arm64/include/asm/pgtable.h:80:15: note: in expansion of macro '__phys_to_pte_val'
+   80 |         __pte(__phys_to_pte_val((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
+      |               ^~~~~~~~~~~~~~~~~
+mm/vmalloc.c:2800:30: note: in expansion of macro 'pfn_pte'
+ 2800 |         *pte = pte_mkspecial(pfn_pte(data->pfns[data->idx++], data->prot));
+      |                              ^~~~~~~
+
+I have no idea why this never showed up earlier, but the safest
+workaround appears to be changing those macros into inline functions
+so the arguments get evaluated only once.
+
+Cc: Matthew Wilcox <willy@infradead.org>
+Fixes: 75387b92635e ("arm64: handle 52-bit physical addresses in page table entries")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Link: https://lore.kernel.org/r/20211105075414.2553155-1-arnd@kernel.org
+Signed-off-by: Will Deacon <will@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/include/asm/pgtable.h | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
+index a92a187ec8919..3a057d4279007 100644
+--- a/arch/arm64/include/asm/pgtable.h
++++ b/arch/arm64/include/asm/pgtable.h
+@@ -54,9 +54,15 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
+  * page table entry, taking care of 52-bit addresses.
+  */
+ #ifdef CONFIG_ARM64_PA_BITS_52
+-#define __pte_to_phys(pte)    \
+-      ((pte_val(pte) & PTE_ADDR_LOW) | ((pte_val(pte) & PTE_ADDR_HIGH) << 36))
+-#define __phys_to_pte_val(phys)       (((phys) | ((phys) >> 36)) & PTE_ADDR_MASK)
++static inline phys_addr_t __pte_to_phys(pte_t pte)
++{
++      return (pte_val(pte) & PTE_ADDR_LOW) |
++              ((pte_val(pte) & PTE_ADDR_HIGH) << 36);
++}
++static inline pteval_t __phys_to_pte_val(phys_addr_t phys)
++{
++      return (phys | (phys >> 36)) & PTE_ADDR_MASK;
++}
+ #else
+ #define __pte_to_phys(pte)    (pte_val(pte) & PTE_ADDR_MASK)
+ #define __phys_to_pte_val(phys)       (phys)
+-- 
+2.33.0
+
diff --git a/queue-5.4/asoc-cs42l42-correct-some-register-default-values.patch b/queue-5.4/asoc-cs42l42-correct-some-register-default-values.patch
new file mode 100644 (file)
index 0000000..cad5f4e
--- /dev/null
@@ -0,0 +1,45 @@
+From a96292728a9eadadea293d22c0316f0fd051ffdf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 15 Oct 2021 14:36:06 +0100
+Subject: ASoC: cs42l42: Correct some register default values
+
+From: Richard Fitzgerald <rf@opensource.cirrus.com>
+
+[ Upstream commit d591d4b32aa9552af14a0c7c586a2d3fe9ecc6e0 ]
+
+Some registers had wrong default values in cs42l42_reg_defaults[].
+
+Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
+Fixes: 2c394ca79604 ("ASoC: Add support for CS42L42 codec")
+Link: https://lore.kernel.org/r/20211015133619.4698-4-rf@opensource.cirrus.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/cs42l42.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c
+index 6825e874785f2..710b43205ea05 100644
+--- a/sound/soc/codecs/cs42l42.c
++++ b/sound/soc/codecs/cs42l42.c
+@@ -91,7 +91,7 @@ static const struct reg_default cs42l42_reg_defaults[] = {
+       { CS42L42_ASP_RX_INT_MASK,              0x1F },
+       { CS42L42_ASP_TX_INT_MASK,              0x0F },
+       { CS42L42_CODEC_INT_MASK,               0x03 },
+-      { CS42L42_SRCPL_INT_MASK,               0xFF },
++      { CS42L42_SRCPL_INT_MASK,               0x7F },
+       { CS42L42_VPMON_INT_MASK,               0x01 },
+       { CS42L42_PLL_LOCK_INT_MASK,            0x01 },
+       { CS42L42_TSRS_PLUG_INT_MASK,           0x0F },
+@@ -128,7 +128,7 @@ static const struct reg_default cs42l42_reg_defaults[] = {
+       { CS42L42_MIXER_CHA_VOL,                0x3F },
+       { CS42L42_MIXER_ADC_VOL,                0x3F },
+       { CS42L42_MIXER_CHB_VOL,                0x3F },
+-      { CS42L42_EQ_COEF_IN0,                  0x22 },
++      { CS42L42_EQ_COEF_IN0,                  0x00 },
+       { CS42L42_EQ_COEF_IN1,                  0x00 },
+       { CS42L42_EQ_COEF_IN2,                  0x00 },
+       { CS42L42_EQ_COEF_IN3,                  0x00 },
+-- 
+2.33.0
+
diff --git a/queue-5.4/asoc-cs42l42-defer-probe-if-request_threaded_irq-ret.patch b/queue-5.4/asoc-cs42l42-defer-probe-if-request_threaded_irq-ret.patch
new file mode 100644 (file)
index 0000000..23a3d3b
--- /dev/null
@@ -0,0 +1,43 @@
+From 4efb46151820b4e95487970efecd5f5b4107becd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 15 Oct 2021 14:36:08 +0100
+Subject: ASoC: cs42l42: Defer probe if request_threaded_irq() returns
+ EPROBE_DEFER
+
+From: Richard Fitzgerald <rf@opensource.cirrus.com>
+
+[ Upstream commit 0306988789d9d91a18ff70bd2bf165d3ae0ef1dd ]
+
+The driver can run without an interrupt so if devm_request_threaded_irq()
+failed, the probe() just carried on. But if this was EPROBE_DEFER the
+driver would continue without an interrupt instead of deferring to wait
+for the interrupt to become available.
+
+Fixes: 2c394ca79604 ("ASoC: Add support for CS42L42 codec")
+Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
+Link: https://lore.kernel.org/r/20211015133619.4698-6-rf@opensource.cirrus.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/cs42l42.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c
+index 710b43205ea05..ebee58eca4d51 100644
+--- a/sound/soc/codecs/cs42l42.c
++++ b/sound/soc/codecs/cs42l42.c
+@@ -1798,8 +1798,9 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client,
+                       NULL, cs42l42_irq_thread,
+                       IRQF_ONESHOT | IRQF_TRIGGER_LOW,
+                       "cs42l42", cs42l42);
+-
+-      if (ret != 0)
++      if (ret == -EPROBE_DEFER)
++              goto err_disable;
++      else if (ret != 0)
+               dev_err(&i2c_client->dev,
+                       "Failed to request IRQ: %d\n", ret);
+-- 
+2.33.0
+
diff --git a/queue-5.4/ath-dfs_pattern_detector-fix-possible-null-pointer-d.patch b/queue-5.4/ath-dfs_pattern_detector-fix-possible-null-pointer-d.patch
new file mode 100644 (file)
index 0000000..f7777a1
--- /dev/null
@@ -0,0 +1,53 @@
+From 015bc2ad06ae0855ac6f19c470fcc17eb5c0dfa7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 5 Aug 2021 08:38:53 -0700
+Subject: ath: dfs_pattern_detector: Fix possible null-pointer dereference in
+ channel_detector_create()
+
+From: Tuo Li <islituo@gmail.com>
+
+[ Upstream commit 4b6012a7830b813799a7faf40daa02a837e0fd5b ]
+
+kzalloc() is used to allocate memory for cd->detectors, and if it fails,
+channel_detector_exit() behind the label fail will be called:
+  channel_detector_exit(dpd, cd);
+
+In channel_detector_exit(), cd->detectors is dereferenced through:
+  struct pri_detector *de = cd->detectors[i];
+
+To fix this possible null-pointer dereference, check cd->detectors before
+the for loop to dereference cd->detectors.
+
+Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
+Signed-off-by: Tuo Li <islituo@gmail.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/20210805153854.154066-1-islituo@gmail.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/ath/dfs_pattern_detector.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/net/wireless/ath/dfs_pattern_detector.c b/drivers/net/wireless/ath/dfs_pattern_detector.c
+index a274eb0d19688..a0ad6e48a35b4 100644
+--- a/drivers/net/wireless/ath/dfs_pattern_detector.c
++++ b/drivers/net/wireless/ath/dfs_pattern_detector.c
+@@ -182,10 +182,12 @@ static void channel_detector_exit(struct dfs_pattern_detector *dpd,
+       if (cd == NULL)
+               return;
+       list_del(&cd->head);
+-      for (i = 0; i < dpd->num_radar_types; i++) {
+-              struct pri_detector *de = cd->detectors[i];
+-              if (de != NULL)
+-                      de->exit(de);
++      if (cd->detectors) {
++              for (i = 0; i < dpd->num_radar_types; i++) {
++                      struct pri_detector *de = cd->detectors[i];
++                      if (de != NULL)
++                              de->exit(de);
++              }
+       }
+       kfree(cd->detectors);
+       kfree(cd);
+-- 
+2.33.0
+
diff --git a/queue-5.4/ath10k-fix-max-antenna-gain-unit.patch b/queue-5.4/ath10k-fix-max-antenna-gain-unit.patch
new file mode 100644 (file)
index 0000000..012ba5c
--- /dev/null
@@ -0,0 +1,86 @@
+From b1b1929e4ee24a13efc1cba11e5d050310f40a4b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 11 Jun 2019 19:21:31 +0200
+Subject: ath10k: fix max antenna gain unit
+
+From: Sven Eckelmann <seckelmann@datto.com>
+
+[ Upstream commit 0a491167fe0cf9f26062462de2a8688b96125d48 ]
+
+Most of the txpower for the ath10k firmware is stored as twicepower (0.5 dB
+steps). This isn't the case for max_antenna_gain - which is still expected
+by the firmware as dB.
+
+The firmware is converting it from dB to the internal (twicepower)
+representation when it calculates the limits of a channel. This can be seen
+in tpc_stats when configuring "12" as max_antenna_gain. Instead of the
+expected 12 (6 dB), the tpc_stats shows 24 (12 dB).
+
+Tested on QCA9888 and IPQ4019 with firmware 10.4-3.5.3-00057.
+
+Fixes: 02256930d9b8 ("ath10k: use proper tx power unit")
+Signed-off-by: Sven Eckelmann <seckelmann@datto.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/20190611172131.6064-1-sven@narfation.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/ath/ath10k/mac.c | 6 +++---
+ drivers/net/wireless/ath/ath10k/wmi.h | 3 +++
+ 2 files changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
+index 603f817ae3a59..9daaacf789d60 100644
+--- a/drivers/net/wireless/ath/ath10k/mac.c
++++ b/drivers/net/wireless/ath/ath10k/mac.c
+@@ -1044,7 +1044,7 @@ static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id)
+       arg.channel.min_power = 0;
+       arg.channel.max_power = channel->max_power * 2;
+       arg.channel.max_reg_power = channel->max_reg_power * 2;
+-      arg.channel.max_antenna_gain = channel->max_antenna_gain * 2;
++      arg.channel.max_antenna_gain = channel->max_antenna_gain;
+       reinit_completion(&ar->vdev_setup_done);
+       reinit_completion(&ar->vdev_delete_done);
+@@ -1490,7 +1490,7 @@ static int ath10k_vdev_start_restart(struct ath10k_vif *arvif,
+       arg.channel.min_power = 0;
+       arg.channel.max_power = chandef->chan->max_power * 2;
+       arg.channel.max_reg_power = chandef->chan->max_reg_power * 2;
+-      arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain * 2;
++      arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain;
+       if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
+               arg.ssid = arvif->u.ap.ssid;
+@@ -3149,7 +3149,7 @@ static int ath10k_update_channel_list(struct ath10k *ar)
+                       ch->min_power = 0;
+                       ch->max_power = channel->max_power * 2;
+                       ch->max_reg_power = channel->max_reg_power * 2;
+-                      ch->max_antenna_gain = channel->max_antenna_gain * 2;
++                      ch->max_antenna_gain = channel->max_antenna_gain;
+                       ch->reg_class_id = 0; /* FIXME */
+                       /* FIXME: why use only legacy modes, why not any
+diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
+index 761bc4a7064df..de22396d085ce 100644
+--- a/drivers/net/wireless/ath/ath10k/wmi.h
++++ b/drivers/net/wireless/ath/ath10k/wmi.h
+@@ -2045,7 +2045,9 @@ struct wmi_channel {
+       union {
+               __le32 reginfo1;
+               struct {
++                      /* note: power unit is 1 dBm */
+                       u8 antenna_max;
++                      /* note: power unit is 0.5 dBm */
+                       u8 max_tx_power;
+               } __packed;
+       } __packed;
+@@ -2065,6 +2067,7 @@ struct wmi_channel_arg {
+       u32 min_power;
+       u32 max_power;
+       u32 max_reg_power;
++      /* note: power unit is 1 dBm */
+       u32 max_antenna_gain;
+       u32 reg_class_id;
+       enum wmi_phy_mode mode;
+-- 
+2.33.0
+
diff --git a/queue-5.4/ath10k-fix-missing-frame-timestamp-for-beacon-probe-.patch b/queue-5.4/ath10k-fix-missing-frame-timestamp-for-beacon-probe-.patch
new file mode 100644 (file)
index 0000000..6543d0e
--- /dev/null
@@ -0,0 +1,44 @@
+From bfb9b5ffc249ddcf6cc971d44a527f6f95cf35c1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 28 Sep 2021 14:00:47 +0300
+Subject: ath10k: Fix missing frame timestamp for beacon/probe-resp
+
+From: Loic Poulain <loic.poulain@linaro.org>
+
+[ Upstream commit e6dfbc3ba90cc2b619229be56b485f085a0a8e1c ]
+
+When receiving a beacon or probe response, we should update the
+boottime_ns field which is the timestamp the frame was received at.
+(cf mac80211.h)
+
+This fixes a scanning issue with Android since it relies on this
+timestamp to determine when the AP has been seen for the last time
+(via the nl80211 BSS_LAST_SEEN_BOOTTIME parameter).
+
+Fixes: 5e3dd157d7e7 ("ath10k: mac80211 driver for Qualcomm Atheros 802.11ac CQA98xx devices")
+Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/1629811733-7927-1-git-send-email-loic.poulain@linaro.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/ath/ath10k/wmi.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
+index 91604a14a8f46..796bd93c599b1 100644
+--- a/drivers/net/wireless/ath/ath10k/wmi.c
++++ b/drivers/net/wireless/ath/ath10k/wmi.c
+@@ -2541,6 +2541,10 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
+       if (ieee80211_is_beacon(hdr->frame_control))
+               ath10k_mac_handle_beacon(ar, skb);
++      if (ieee80211_is_beacon(hdr->frame_control) ||
++          ieee80211_is_probe_resp(hdr->frame_control))
++              status->boottime_ns = ktime_get_boottime_ns();
++
+       ath10k_dbg(ar, ATH10K_DBG_MGMT,
+                  "event mgmt rx skb %pK len %d ftype %02x stype %02x\n",
+                  skb, skb->len,
+-- 
+2.33.0
+
diff --git a/queue-5.4/ath10k-high-latency-fixes-for-beacon-buffer.patch b/queue-5.4/ath10k-high-latency-fixes-for-beacon-buffer.patch
new file mode 100644 (file)
index 0000000..73d8714
--- /dev/null
@@ -0,0 +1,84 @@
+From 6d047ec10ac74fd2494916263cb73cd4f0cbd3d4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 28 Sep 2021 14:00:47 +0300
+Subject: ath10k: high latency fixes for beacon buffer
+
+From: Alagu Sankar <alagusankar@silex-india.com>
+
+[ Upstream commit e263bdab9c0e8025fb7f41f153709a9cda51f6b6 ]
+
+Beacon buffer for high latency devices does not use DMA. other similar
+buffer allocation methods in the driver have already been modified for
+high latency path. Fix the beacon buffer allocation left out in the
+earlier high latency changes.
+
+Signed-off-by: Alagu Sankar <alagusankar@silex-india.com>
+Signed-off-by: Erik Stromdahl <erik.stromdahl@gmail.com>
+[fabio: adapt it to use ar->bus_param.dev_type ]
+Signed-off-by: Fabio Estevam <festevam@denx.de>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/20210818232627.2040121-1-festevam@denx.de
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/ath/ath10k/mac.c | 31 ++++++++++++++++++++-------
+ 1 file changed, 23 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
+index 20e248fd43642..603f817ae3a59 100644
+--- a/drivers/net/wireless/ath/ath10k/mac.c
++++ b/drivers/net/wireless/ath/ath10k/mac.c
+@@ -985,8 +985,12 @@ static void ath10k_mac_vif_beacon_cleanup(struct ath10k_vif *arvif)
+       ath10k_mac_vif_beacon_free(arvif);
+       if (arvif->beacon_buf) {
+-              dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN,
+-                                arvif->beacon_buf, arvif->beacon_paddr);
++              if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL)
++                      kfree(arvif->beacon_buf);
++              else
++                      dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN,
++                                        arvif->beacon_buf,
++                                        arvif->beacon_paddr);
+               arvif->beacon_buf = NULL;
+       }
+ }
+@@ -5251,10 +5255,17 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
+       if (vif->type == NL80211_IFTYPE_ADHOC ||
+           vif->type == NL80211_IFTYPE_MESH_POINT ||
+           vif->type == NL80211_IFTYPE_AP) {
+-              arvif->beacon_buf = dma_alloc_coherent(ar->dev,
+-                                                     IEEE80211_MAX_FRAME_LEN,
+-                                                     &arvif->beacon_paddr,
+-                                                     GFP_ATOMIC);
++              if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL) {
++                      arvif->beacon_buf = kmalloc(IEEE80211_MAX_FRAME_LEN,
++                                                  GFP_KERNEL);
++                      arvif->beacon_paddr = (dma_addr_t)arvif->beacon_buf;
++              } else {
++                      arvif->beacon_buf =
++                              dma_alloc_coherent(ar->dev,
++                                                 IEEE80211_MAX_FRAME_LEN,
++                                                 &arvif->beacon_paddr,
++                                                 GFP_ATOMIC);
++              }
+               if (!arvif->beacon_buf) {
+                       ret = -ENOMEM;
+                       ath10k_warn(ar, "failed to allocate beacon buffer: %d\n",
+@@ -5469,8 +5480,12 @@ err_vdev_delete:
+ err:
+       if (arvif->beacon_buf) {
+-              dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN,
+-                                arvif->beacon_buf, arvif->beacon_paddr);
++              if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL)
++                      kfree(arvif->beacon_buf);
++              else
++                      dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN,
++                                        arvif->beacon_buf,
++                                        arvif->beacon_paddr);
+               arvif->beacon_buf = NULL;
+       }
+-- 
+2.33.0
+
diff --git a/queue-5.4/ath9k-fix-potential-interrupt-storm-on-queue-reset.patch b/queue-5.4/ath9k-fix-potential-interrupt-storm-on-queue-reset.patch
new file mode 100644 (file)
index 0000000..f3cf113
--- /dev/null
@@ -0,0 +1,99 @@
+From f687da3f1d7acdd54d9b01eb88d1af2a0e705844 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 5 Oct 2021 16:55:53 +0300
+Subject: ath9k: Fix potential interrupt storm on queue reset
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Linus Lüssing <ll@simonwunderlich.de>
+
+[ Upstream commit 4925642d541278575ad1948c5924d71ffd57ef14 ]
+
+In tests with two Lima boards from 8devices (QCA4531 based) on OpenWrt
+19.07 we could force a silent restart of a device with no serial
+output when we were sending a high amount of UDP traffic (iperf3 at 80
+MBit/s in both directions from external hosts, saturating the wifi and
+causing a load of about 4.5 to 6) and were then triggering an
+ath9k_queue_reset().
+
+Further debugging showed that the restart was caused by the ath79
+watchdog. With disabled watchdog we could observe that the device was
+constantly going into ath_isr() interrupt handler and was returning
+early after the ATH_OP_HW_RESET flag test, without clearing any
+interrupts. Even though ath9k_queue_reset() calls
+ath9k_hw_kill_interrupts().
+
+With JTAG we could observe the following race condition:
+
+1) ath9k_queue_reset()
+   ...
+   -> ath9k_hw_kill_interrupts()
+   -> set_bit(ATH_OP_HW_RESET, &common->op_flags);
+   ...
+   <- returns
+
+      2) ath9k_tasklet()
+         ...
+         -> ath9k_hw_resume_interrupts()
+         ...
+         <- returns
+
+                 3) loops around:
+                    ...
+                    handle_int()
+                    -> ath_isr()
+                       ...
+                       -> if (test_bit(ATH_OP_HW_RESET,
+                                       &common->op_flags))
+                            return IRQ_HANDLED;
+
+                    x) ath_reset_internal():
+                       => never reached <=
+
+And in ath_isr() we would typically see the following interrupts /
+interrupt causes:
+
+* status: 0x00111030 or 0x00110030
+* async_cause: 2 (AR_INTR_MAC_IPQ)
+* sync_cause: 0
+
+So the ath9k_tasklet() reenables the ath9k interrupts
+through ath9k_hw_resume_interrupts() which ath9k_queue_reset() had just
+disabled. And ath_isr() then keeps firing because it returns IRQ_HANDLED
+without actually clearing the interrupt.
+
+To fix this IRQ storm also clear/disable the interrupts again when we
+are in reset state.
+
+Cc: Sven Eckelmann <sven@narfation.org>
+Cc: Simon Wunderlich <sw@simonwunderlich.de>
+Cc: Linus Lüssing <linus.luessing@c0d3.blue>
+Fixes: 872b5d814f99 ("ath9k: do not access hardware on IRQs during reset")
+Signed-off-by: Linus Lüssing <ll@simonwunderlich.de>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/20210914192515.9273-3-linus.luessing@c0d3.blue
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/ath/ath9k/main.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
+index 28ccdcb197de2..ec13bd8d5487d 100644
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -530,8 +530,10 @@ irqreturn_t ath_isr(int irq, void *dev)
+       ath9k_debug_sync_cause(sc, sync_cause);
+       status &= ah->imask;    /* discard unasked-for bits */
+-      if (test_bit(ATH_OP_HW_RESET, &common->op_flags))
++      if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) {
++              ath9k_hw_kill_interrupts(sc->sc_ah);
+               return IRQ_HANDLED;
++      }
+       /*
+        * If there are no status bits set, then this interrupt was not
+-- 
+2.33.0
+
diff --git a/queue-5.4/auxdisplay-ht16k33-connect-backlight-to-fbdev.patch b/queue-5.4/auxdisplay-ht16k33-connect-backlight-to-fbdev.patch
new file mode 100644 (file)
index 0000000..d6c2bc1
--- /dev/null
@@ -0,0 +1,107 @@
+From 644019de3cb5d58b9de4b787c29af14a65007bdd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 19 Oct 2021 16:45:08 +0200
+Subject: auxdisplay: ht16k33: Connect backlight to fbdev
+
+From: Geert Uytterhoeven <geert@linux-m68k.org>
+
+[ Upstream commit 80f9eb70fd9276938f0a131f76d438021bfd8b34 ]
+
+Currently /sys/class/graphics/fb0/bl_curve is not accessible (-ENODEV),
+as the driver does not connect the backlight to the frame buffer device.
+Fix this moving backlight initialization up, and filling in
+fb_info.bl_dev.
+
+Fixes: 8992da44c6805d53 ("auxdisplay: ht16k33: Driver for LED controller")
+Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Reviewed-by: Robin van der Gracht <robin@protonic.nl>
+Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/auxdisplay/ht16k33.c | 56 ++++++++++++++++++------------------
+ 1 file changed, 28 insertions(+), 28 deletions(-)
+
+diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
+index 33b887b389061..1b0e8232517dd 100644
+--- a/drivers/auxdisplay/ht16k33.c
++++ b/drivers/auxdisplay/ht16k33.c
+@@ -418,6 +418,33 @@ static int ht16k33_probe(struct i2c_client *client,
+       if (err)
+               return err;
++      /* Backlight */
++      memset(&bl_props, 0, sizeof(struct backlight_properties));
++      bl_props.type = BACKLIGHT_RAW;
++      bl_props.max_brightness = MAX_BRIGHTNESS;
++
++      bl = devm_backlight_device_register(&client->dev, DRIVER_NAME"-bl",
++                                          &client->dev, priv,
++                                          &ht16k33_bl_ops, &bl_props);
++      if (IS_ERR(bl)) {
++              dev_err(&client->dev, "failed to register backlight\n");
++              return PTR_ERR(bl);
++      }
++
++      err = of_property_read_u32(node, "default-brightness-level",
++                                 &dft_brightness);
++      if (err) {
++              dft_brightness = MAX_BRIGHTNESS;
++      } else if (dft_brightness > MAX_BRIGHTNESS) {
++              dev_warn(&client->dev,
++                       "invalid default brightness level: %u, using %u\n",
++                       dft_brightness, MAX_BRIGHTNESS);
++              dft_brightness = MAX_BRIGHTNESS;
++      }
++
++      bl->props.brightness = dft_brightness;
++      ht16k33_bl_update_status(bl);
++
+       /* Framebuffer (2 bytes per column) */
+       BUILD_BUG_ON(PAGE_SIZE < HT16K33_FB_SIZE);
+       fbdev->buffer = (unsigned char *) get_zeroed_page(GFP_KERNEL);
+@@ -450,6 +477,7 @@ static int ht16k33_probe(struct i2c_client *client,
+       fbdev->info->screen_size = HT16K33_FB_SIZE;
+       fbdev->info->fix = ht16k33_fb_fix;
+       fbdev->info->var = ht16k33_fb_var;
++      fbdev->info->bl_dev = bl;
+       fbdev->info->pseudo_palette = NULL;
+       fbdev->info->flags = FBINFO_FLAG_DEFAULT;
+       fbdev->info->par = priv;
+@@ -462,34 +490,6 @@ static int ht16k33_probe(struct i2c_client *client,
+       if (err)
+               goto err_fbdev_unregister;
+-      /* Backlight */
+-      memset(&bl_props, 0, sizeof(struct backlight_properties));
+-      bl_props.type = BACKLIGHT_RAW;
+-      bl_props.max_brightness = MAX_BRIGHTNESS;
+-
+-      bl = devm_backlight_device_register(&client->dev, DRIVER_NAME"-bl",
+-                                          &client->dev, priv,
+-                                          &ht16k33_bl_ops, &bl_props);
+-      if (IS_ERR(bl)) {
+-              dev_err(&client->dev, "failed to register backlight\n");
+-              err = PTR_ERR(bl);
+-              goto err_fbdev_unregister;
+-      }
+-
+-      err = of_property_read_u32(node, "default-brightness-level",
+-                                 &dft_brightness);
+-      if (err) {
+-              dft_brightness = MAX_BRIGHTNESS;
+-      } else if (dft_brightness > MAX_BRIGHTNESS) {
+-              dev_warn(&client->dev,
+-                       "invalid default brightness level: %u, using %u\n",
+-                       dft_brightness, MAX_BRIGHTNESS);
+-              dft_brightness = MAX_BRIGHTNESS;
+-      }
+-
+-      bl->props.brightness = dft_brightness;
+-      ht16k33_bl_update_status(bl);
+-
+       ht16k33_fb_queue(priv);
+       return 0;
+-- 
+2.33.0
+
diff --git a/queue-5.4/auxdisplay-ht16k33-fix-frame-buffer-device-blanking.patch b/queue-5.4/auxdisplay-ht16k33-fix-frame-buffer-device-blanking.patch
new file mode 100644 (file)
index 0000000..6d4357c
--- /dev/null
@@ -0,0 +1,59 @@
+From e1576156dc823e19275903fdc17e67f8df69f750 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 19 Oct 2021 16:45:09 +0200
+Subject: auxdisplay: ht16k33: Fix frame buffer device blanking
+
+From: Geert Uytterhoeven <geert@linux-m68k.org>
+
+[ Upstream commit 840fe258332544aa7321921e1723d37b772af7a9 ]
+
+As the ht16k33 frame buffer sub-driver does not register an
+fb_ops.fb_blank() handler, blanking does not work:
+
+    $ echo 1 > /sys/class/graphics/fb0/blank
+    sh: write error: Invalid argument
+
+Fix this by providing a handler that always returns zero, to make sure
+blank events will be sent to the actual device handling the backlight.
+
+Reported-by: Robin van der Gracht <robin@protonic.nl>
+Suggested-by: Robin van der Gracht <robin@protonic.nl>
+Fixes: 8992da44c6805d53 ("auxdisplay: ht16k33: Driver for LED controller")
+Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/auxdisplay/ht16k33.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
+index 1b0e8232517dd..59109b410c67f 100644
+--- a/drivers/auxdisplay/ht16k33.c
++++ b/drivers/auxdisplay/ht16k33.c
+@@ -219,6 +219,15 @@ static const struct backlight_ops ht16k33_bl_ops = {
+       .check_fb       = ht16k33_bl_check_fb,
+ };
++/*
++ * Blank events will be passed to the actual device handling the backlight when
++ * we return zero here.
++ */
++static int ht16k33_blank(int blank, struct fb_info *info)
++{
++      return 0;
++}
++
+ static int ht16k33_mmap(struct fb_info *info, struct vm_area_struct *vma)
+ {
+       struct ht16k33_priv *priv = info->par;
+@@ -231,6 +240,7 @@ static struct fb_ops ht16k33_fb_ops = {
+       .owner = THIS_MODULE,
+       .fb_read = fb_sys_read,
+       .fb_write = fb_sys_write,
++      .fb_blank = ht16k33_blank,
+       .fb_fillrect = sys_fillrect,
+       .fb_copyarea = sys_copyarea,
+       .fb_imageblit = sys_imageblit,
+-- 
+2.33.0
+
diff --git a/queue-5.4/auxdisplay-img-ascii-lcd-fix-lock-up-when-displaying.patch b/queue-5.4/auxdisplay-img-ascii-lcd-fix-lock-up-when-displaying.patch
new file mode 100644 (file)
index 0000000..363740b
--- /dev/null
@@ -0,0 +1,53 @@
+From bbe43bef65c2b9d1e97ed243f29667f8fe442859 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 19 Oct 2021 16:45:02 +0200
+Subject: auxdisplay: img-ascii-lcd: Fix lock-up when displaying empty string
+
+From: Geert Uytterhoeven <geert@linux-m68k.org>
+
+[ Upstream commit afcb5a811ff3ab3969f09666535eb6018a160358 ]
+
+While writing an empty string to a device attribute is a no-op, and thus
+does not need explicit safeguards, the user can still write a single
+newline to an attribute file:
+
+    echo > .../message
+
+If that happens, img_ascii_lcd_display() trims the newline, yielding an
+empty string, and causing an infinite loop in img_ascii_lcd_scroll().
+
+Fix this by adding a check for empty strings.  Clear the display in case
+one is encountered.
+
+Fixes: 0cad855fbd083ee5 ("auxdisplay: img-ascii-lcd: driver for simple ASCII LCD displays")
+Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/auxdisplay/img-ascii-lcd.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/drivers/auxdisplay/img-ascii-lcd.c b/drivers/auxdisplay/img-ascii-lcd.c
+index efb928e25aef3..9556d6827f005 100644
+--- a/drivers/auxdisplay/img-ascii-lcd.c
++++ b/drivers/auxdisplay/img-ascii-lcd.c
+@@ -280,6 +280,16 @@ static int img_ascii_lcd_display(struct img_ascii_lcd_ctx *ctx,
+       if (msg[count - 1] == '\n')
+               count--;
++      if (!count) {
++              /* clear the LCD */
++              devm_kfree(&ctx->pdev->dev, ctx->message);
++              ctx->message = NULL;
++              ctx->message_len = 0;
++              memset(ctx->curr, ' ', ctx->cfg->num_chars);
++              ctx->cfg->update(ctx);
++              return 0;
++      }
++
+       new_msg = devm_kmalloc(&ctx->pdev->dev, count + 1, GFP_KERNEL);
+       if (!new_msg)
+               return -ENOMEM;
+-- 
+2.33.0
+
diff --git a/queue-5.4/b43-fix-a-lower-bounds-test.patch b/queue-5.4/b43-fix-a-lower-bounds-test.patch
new file mode 100644 (file)
index 0000000..b531b82
--- /dev/null
@@ -0,0 +1,47 @@
+From 79993ca0599fe615482c339aece2a4173e6efed3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 6 Oct 2021 10:36:22 +0300
+Subject: b43: fix a lower bounds test
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit 9b793db5fca44d01f72d3564a168171acf7c4076 ]
+
+The problem is that "channel" is an unsigned int, when it's less 5 the
+value of "channel - 5" is not a negative number as one would expect but
+is very high positive value instead.
+
+This means that "start" becomes a very high positive value.  The result
+of that is that we never enter the "for (i = start; i <= end; i++) {"
+loop.  Instead of storing the result from b43legacy_radio_aci_detect()
+it just uses zero.
+
+Fixes: ef1a628d83fc ("b43: Implement dynamic PHY API")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Acked-by: Michael Büsch <m@bues.ch>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/20211006073621.GE8404@kili
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/broadcom/b43/phy_g.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/broadcom/b43/phy_g.c b/drivers/net/wireless/broadcom/b43/phy_g.c
+index 1e022ec733a37..8b8fdb4965bde 100644
+--- a/drivers/net/wireless/broadcom/b43/phy_g.c
++++ b/drivers/net/wireless/broadcom/b43/phy_g.c
+@@ -2297,7 +2297,7 @@ static u8 b43_gphy_aci_scan(struct b43_wldev *dev)
+       b43_phy_mask(dev, B43_PHY_G_CRS, 0x7FFF);
+       b43_set_all_gains(dev, 3, 8, 1);
+-      start = (channel - 5 > 0) ? channel - 5 : 1;
++      start = (channel > 5) ? channel - 5 : 1;
+       end = (channel + 5 < 14) ? channel + 5 : 13;
+       for (i = start; i <= end; i++) {
+-- 
+2.33.0
+
diff --git a/queue-5.4/b43legacy-fix-a-lower-bounds-test.patch b/queue-5.4/b43legacy-fix-a-lower-bounds-test.patch
new file mode 100644 (file)
index 0000000..05ec43c
--- /dev/null
@@ -0,0 +1,47 @@
+From d9f6f9a86871ba4ef11d3ab22eb5d530a8c53841 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 6 Oct 2021 10:35:42 +0300
+Subject: b43legacy: fix a lower bounds test
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit c1c8380b0320ab757e60ed90efc8b1992a943256 ]
+
+The problem is that "channel" is an unsigned int, when it's less 5 the
+value of "channel - 5" is not a negative number as one would expect but
+is very high positive value instead.
+
+This means that "start" becomes a very high positive value.  The result
+of that is that we never enter the "for (i = start; i <= end; i++) {"
+loop.  Instead of storing the result from b43legacy_radio_aci_detect()
+it just uses zero.
+
+Fixes: 75388acd0cd8 ("[B43LEGACY]: add mac80211-based driver for legacy BCM43xx devices")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Acked-by: Michael Büsch <m@bues.ch>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/20211006073542.GD8404@kili
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/broadcom/b43legacy/radio.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/broadcom/b43legacy/radio.c b/drivers/net/wireless/broadcom/b43legacy/radio.c
+index da40d1ca8723d..e4dce76a4481d 100644
+--- a/drivers/net/wireless/broadcom/b43legacy/radio.c
++++ b/drivers/net/wireless/broadcom/b43legacy/radio.c
+@@ -283,7 +283,7 @@ u8 b43legacy_radio_aci_scan(struct b43legacy_wldev *dev)
+                           & 0x7FFF);
+       b43legacy_set_all_gains(dev, 3, 8, 1);
+-      start = (channel - 5 > 0) ? channel - 5 : 1;
++      start = (channel > 5) ? channel - 5 : 1;
+       end = (channel + 5 < 14) ? channel + 5 : 13;
+       for (i = start; i <= end; i++) {
+-- 
+2.33.0
+
diff --git a/queue-5.4/block-ataflop-fix-breakage-introduced-at-blk-mq-refa.patch b/queue-5.4/block-ataflop-fix-breakage-introduced-at-blk-mq-refa.patch
new file mode 100644 (file)
index 0000000..3c4f142
--- /dev/null
@@ -0,0 +1,118 @@
+From e400b13396aa681d0ff2e845e2d1dd72724af284 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 19 Oct 2021 19:13:21 +1300
+Subject: block: ataflop: fix breakage introduced at blk-mq refactoring
+
+From: Michael Schmitz <schmitzmic@gmail.com>
+
+[ Upstream commit 86d46fdaa12ae5befc16b8d73fc85a3ca0399ea6 ]
+
+Refactoring of the Atari floppy driver when converting to blk-mq
+has broken the state machine in not-so-subtle ways:
+
+finish_fdc() must be called when operations on the floppy device
+have completed. This is crucial in order to relase the ST-DMA
+lock, which protects against concurrent access to the ST-DMA
+controller by other drivers (some DMA related, most just related
+to device register access - broken beyond compare, I know).
+
+When rewriting the driver's old do_request() function, the fact
+that finish_fdc() was called only when all queued requests had
+completed appears to have been overlooked. Instead, the new
+request function calls finish_fdc() immediately after the last
+request has been queued. finish_fdc() executes a dummy seek after
+most requests, and this overwrites the state machine's interrupt
+hander that was set up to wait for completion of the read/write
+request just prior. To make matters worse, finish_fdc() is called
+before device interrupts are re-enabled, making certain that the
+read/write interupt is missed.
+
+Shifting the finish_fdc() call into the read/write request
+completion handler ensures the driver waits for the request to
+actually complete. With a queue depth of 2, we won't see long
+request sequences, so calling finish_fdc() unconditionally just
+adds a little overhead for the dummy seeks, and keeps the code
+simple.
+
+While we're at it, kill ataflop_commit_rqs() which does nothing
+but run finish_fdc() unconditionally, again likely wiping out an
+in-flight request.
+
+Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
+Fixes: 6ec3938cff95 ("ataflop: convert to blk-mq")
+CC: linux-block@vger.kernel.org
+CC: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
+Link: https://lore.kernel.org/r/20211019061321.26425-1-schmitzmic@gmail.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/block/ataflop.c | 18 +++---------------
+ 1 file changed, 3 insertions(+), 15 deletions(-)
+
+diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
+index bd7d3bb8b890b..ad4cf10749100 100644
+--- a/drivers/block/ataflop.c
++++ b/drivers/block/ataflop.c
+@@ -653,9 +653,6 @@ static inline void copy_buffer(void *from, void *to)
+               *p2++ = *p1++;
+ }
+-  
+-  
+-
+ /* General Interrupt Handling */
+ static void (*FloppyIRQHandler)( int status ) = NULL;
+@@ -1225,6 +1222,7 @@ static void fd_rwsec_done1(int status)
+       }
+       else {
+               /* all sectors finished */
++              finish_fdc();
+               fd_end_request_cur(BLK_STS_OK);
+       }
+       return;
+@@ -1472,15 +1470,6 @@ static void setup_req_params( int drive )
+                       ReqTrack, ReqSector, (unsigned long)ReqData ));
+ }
+-static void ataflop_commit_rqs(struct blk_mq_hw_ctx *hctx)
+-{
+-      spin_lock_irq(&ataflop_lock);
+-      atari_disable_irq(IRQ_MFP_FDC);
+-      finish_fdc();
+-      atari_enable_irq(IRQ_MFP_FDC);
+-      spin_unlock_irq(&ataflop_lock);
+-}
+-
+ static blk_status_t ataflop_queue_rq(struct blk_mq_hw_ctx *hctx,
+                                    const struct blk_mq_queue_data *bd)
+ {
+@@ -1488,6 +1477,8 @@ static blk_status_t ataflop_queue_rq(struct blk_mq_hw_ctx *hctx,
+       int drive = floppy - unit;
+       int type = floppy->type;
++      DPRINT(("Queue request: drive %d type %d last %d\n", drive, type, bd->last));
++
+       spin_lock_irq(&ataflop_lock);
+       if (fd_request) {
+               spin_unlock_irq(&ataflop_lock);
+@@ -1547,8 +1538,6 @@ static blk_status_t ataflop_queue_rq(struct blk_mq_hw_ctx *hctx,
+       setup_req_params( drive );
+       do_fd_action( drive );
+-      if (bd->last)
+-              finish_fdc();
+       atari_enable_irq( IRQ_MFP_FDC );
+ out:
+@@ -1958,7 +1947,6 @@ static const struct block_device_operations floppy_fops = {
+ static const struct blk_mq_ops ataflop_mq_ops = {
+       .queue_rq = ataflop_queue_rq,
+-      .commit_rqs = ataflop_commit_rqs,
+ };
+ static struct kobject *floppy_find(dev_t dev, int *part, void *data)
+-- 
+2.33.0
+
diff --git a/queue-5.4/block-remove-inaccurate-requeue-check.patch b/queue-5.4/block-remove-inaccurate-requeue-check.patch
new file mode 100644 (file)
index 0000000..eb63846
--- /dev/null
@@ -0,0 +1,40 @@
+From bc238c311242e29681de4d997921c017d8864d1a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Oct 2021 08:21:40 -0600
+Subject: block: remove inaccurate requeue check
+
+From: Jens Axboe <axboe@kernel.dk>
+
+[ Upstream commit 037057a5a979c7eeb2ee5d12cf4c24b805192c75 ]
+
+This check is meant to catch cases where a requeue is attempted on a
+request that is still inserted. It's never really been useful to catch any
+misuse, and now it's actively wrong. Outside of that, this should not be a
+BUG_ON() to begin with.
+
+Remove the check as it's now causing active harm, as requeue off the plug
+path will trigger it even though the request state is just fine.
+
+Reported-by: Yi Zhang <yi.zhang@redhat.com>
+Link: https://lore.kernel.org/linux-block/CAHj4cs80zAUc2grnCZ015-2Rvd-=gXRfB_dFKy=RTm+wRo09HQ@mail.gmail.com/
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ block/blk-mq.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/block/blk-mq.c b/block/blk-mq.c
+index 0674f53c60528..84798d09ca464 100644
+--- a/block/blk-mq.c
++++ b/block/blk-mq.c
+@@ -733,7 +733,6 @@ void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list)
+       /* this request will be re-inserted to io scheduler queue */
+       blk_mq_sched_requeue_request(rq);
+-      BUG_ON(!list_empty(&rq->queuelist));
+       blk_mq_add_to_requeue_list(rq, true, kick_requeue_list);
+ }
+ EXPORT_SYMBOL(blk_mq_requeue_request);
+-- 
+2.33.0
+
diff --git a/queue-5.4/bluetooth-btmtkuart-fix-a-memleak-in-mtk_hci_wmt_syn.patch b/queue-5.4/bluetooth-btmtkuart-fix-a-memleak-in-mtk_hci_wmt_syn.patch
new file mode 100644 (file)
index 0000000..4f06521
--- /dev/null
@@ -0,0 +1,68 @@
+From 755ebc0327e6fb5457e39b1d69580a6f1751c16b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 22 Sep 2021 21:49:45 +0800
+Subject: Bluetooth: btmtkuart: fix a memleak in mtk_hci_wmt_sync
+
+From: Dinghao Liu <dinghao.liu@zju.edu.cn>
+
+[ Upstream commit 3e5f2d90c28f9454e421108554707620bc23269d ]
+
+bdev->evt_skb will get freed in the normal path and one error path
+of mtk_hci_wmt_sync, while the other error paths do not free it,
+which may cause a memleak. This bug is suggested by a static analysis
+tool, please advise.
+
+Fixes: e0b67035a90b ("Bluetooth: mediatek: update the common setup between MT7622 and other devices")
+Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
+Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/bluetooth/btmtkuart.c | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/bluetooth/btmtkuart.c b/drivers/bluetooth/btmtkuart.c
+index 8a81fbca5c9d8..2beb2321825e3 100644
+--- a/drivers/bluetooth/btmtkuart.c
++++ b/drivers/bluetooth/btmtkuart.c
+@@ -158,8 +158,10 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev,
+       int err;
+       hlen = sizeof(*hdr) + wmt_params->dlen;
+-      if (hlen > 255)
+-              return -EINVAL;
++      if (hlen > 255) {
++              err = -EINVAL;
++              goto err_free_skb;
++      }
+       hdr = (struct mtk_wmt_hdr *)&wc;
+       hdr->dir = 1;
+@@ -173,7 +175,7 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev,
+       err = __hci_cmd_send(hdev, 0xfc6f, hlen, &wc);
+       if (err < 0) {
+               clear_bit(BTMTKUART_TX_WAIT_VND_EVT, &bdev->tx_state);
+-              return err;
++              goto err_free_skb;
+       }
+       /* The vendor specific WMT commands are all answered by a vendor
+@@ -190,13 +192,14 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev,
+       if (err == -EINTR) {
+               bt_dev_err(hdev, "Execution of wmt command interrupted");
+               clear_bit(BTMTKUART_TX_WAIT_VND_EVT, &bdev->tx_state);
+-              return err;
++              goto err_free_skb;
+       }
+       if (err) {
+               bt_dev_err(hdev, "Execution of wmt command timed out");
+               clear_bit(BTMTKUART_TX_WAIT_VND_EVT, &bdev->tx_state);
+-              return -ETIMEDOUT;
++              err = -ETIMEDOUT;
++              goto err_free_skb;
+       }
+       /* Parse and handle the return WMT event */
+-- 
+2.33.0
+
diff --git a/queue-5.4/bluetooth-fix-init-and-cleanup-of-sco_conn.timeout_w.patch b/queue-5.4/bluetooth-fix-init-and-cleanup-of-sco_conn.timeout_w.patch
new file mode 100644 (file)
index 0000000..8525f03
--- /dev/null
@@ -0,0 +1,66 @@
+From 0ed0917f7baa352b3192fe0c08d9ec1f9502c695 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 2 Sep 2021 23:13:06 -0400
+Subject: Bluetooth: fix init and cleanup of sco_conn.timeout_work
+
+From: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
+
+[ Upstream commit 49d8a5606428ca0962d09050a5af81461ff90fbb ]
+
+Before freeing struct sco_conn, all delayed timeout work should be
+cancelled. Otherwise, sco_sock_timeout could potentially use the
+sco_conn after it has been freed.
+
+Additionally, sco_conn.timeout_work should be initialized when the
+connection is allocated, not when the channel is added. This is
+because an sco_conn can create channels with multiple sockets over its
+lifetime, which happens if sockets are released but the connection
+isn't deleted.
+
+Fixes: ba316be1b6a0 ("Bluetooth: schedule SCO timeouts with delayed_work")
+Signed-off-by: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/bluetooth/sco.c | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
+index cc5a1d2545679..2c616c1c62958 100644
+--- a/net/bluetooth/sco.c
++++ b/net/bluetooth/sco.c
+@@ -133,6 +133,7 @@ static struct sco_conn *sco_conn_add(struct hci_conn *hcon)
+               return NULL;
+       spin_lock_init(&conn->lock);
++      INIT_DELAYED_WORK(&conn->timeout_work, sco_sock_timeout);
+       hcon->sco_data = conn;
+       conn->hcon = hcon;
+@@ -196,11 +197,11 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
+               sco_chan_del(sk, err);
+               bh_unlock_sock(sk);
+               sock_put(sk);
+-
+-              /* Ensure no more work items will run before freeing conn. */
+-              cancel_delayed_work_sync(&conn->timeout_work);
+       }
++      /* Ensure no more work items will run before freeing conn. */
++      cancel_delayed_work_sync(&conn->timeout_work);
++
+       hcon->sco_data = NULL;
+       kfree(conn);
+ }
+@@ -213,8 +214,6 @@ static void __sco_chan_add(struct sco_conn *conn, struct sock *sk,
+       sco_pi(sk)->conn = conn;
+       conn->sk = sk;
+-      INIT_DELAYED_WORK(&conn->timeout_work, sco_sock_timeout);
+-
+       if (parent)
+               bt_accept_enqueue(parent, sk, true);
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/bluetooth-fix-use-after-free-error-in-lock_sock_nest.patch b/queue-5.4/bluetooth-fix-use-after-free-error-in-lock_sock_nest.patch
new file mode 100644 (file)
index 0000000..8ec9c7e
--- /dev/null
@@ -0,0 +1,139 @@
+From 1ff8cdc88c415af637671455c364338971285f5e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 31 Aug 2021 17:35:37 -0700
+Subject: Bluetooth: fix use-after-free error in lock_sock_nested()
+
+From: Wang ShaoBo <bobo.shaobowang@huawei.com>
+
+[ Upstream commit 1bff51ea59a9afb67d2dd78518ab0582a54a472c ]
+
+use-after-free error in lock_sock_nested is reported:
+
+[  179.140137][ T3731] =====================================================
+[  179.142675][ T3731] BUG: KMSAN: use-after-free in lock_sock_nested+0x280/0x2c0
+[  179.145494][ T3731] CPU: 4 PID: 3731 Comm: kworker/4:2 Not tainted 5.12.0-rc6+ #54
+[  179.148432][ T3731] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
+[  179.151806][ T3731] Workqueue: events l2cap_chan_timeout
+[  179.152730][ T3731] Call Trace:
+[  179.153301][ T3731]  dump_stack+0x24c/0x2e0
+[  179.154063][ T3731]  kmsan_report+0xfb/0x1e0
+[  179.154855][ T3731]  __msan_warning+0x5c/0xa0
+[  179.155579][ T3731]  lock_sock_nested+0x280/0x2c0
+[  179.156436][ T3731]  ? kmsan_get_metadata+0x116/0x180
+[  179.157257][ T3731]  l2cap_sock_teardown_cb+0xb8/0x890
+[  179.158154][ T3731]  ? __msan_metadata_ptr_for_load_8+0x10/0x20
+[  179.159141][ T3731]  ? kmsan_get_metadata+0x116/0x180
+[  179.159994][ T3731]  ? kmsan_get_shadow_origin_ptr+0x84/0xb0
+[  179.160959][ T3731]  ? l2cap_sock_recv_cb+0x420/0x420
+[  179.161834][ T3731]  l2cap_chan_del+0x3e1/0x1d50
+[  179.162608][ T3731]  ? kmsan_get_metadata+0x116/0x180
+[  179.163435][ T3731]  ? kmsan_get_shadow_origin_ptr+0x84/0xb0
+[  179.164406][ T3731]  l2cap_chan_close+0xeea/0x1050
+[  179.165189][ T3731]  ? kmsan_internal_unpoison_shadow+0x42/0x70
+[  179.166180][ T3731]  l2cap_chan_timeout+0x1da/0x590
+[  179.167066][ T3731]  ? __msan_metadata_ptr_for_load_8+0x10/0x20
+[  179.168023][ T3731]  ? l2cap_chan_create+0x560/0x560
+[  179.168818][ T3731]  process_one_work+0x121d/0x1ff0
+[  179.169598][ T3731]  worker_thread+0x121b/0x2370
+[  179.170346][ T3731]  kthread+0x4ef/0x610
+[  179.171010][ T3731]  ? process_one_work+0x1ff0/0x1ff0
+[  179.171828][ T3731]  ? kthread_blkcg+0x110/0x110
+[  179.172587][ T3731]  ret_from_fork+0x1f/0x30
+[  179.173348][ T3731]
+[  179.173752][ T3731] Uninit was created at:
+[  179.174409][ T3731]  kmsan_internal_poison_shadow+0x5c/0xf0
+[  179.175373][ T3731]  kmsan_slab_free+0x76/0xc0
+[  179.176060][ T3731]  kfree+0x3a5/0x1180
+[  179.176664][ T3731]  __sk_destruct+0x8af/0xb80
+[  179.177375][ T3731]  __sk_free+0x812/0x8c0
+[  179.178032][ T3731]  sk_free+0x97/0x130
+[  179.178686][ T3731]  l2cap_sock_release+0x3d5/0x4d0
+[  179.179457][ T3731]  sock_close+0x150/0x450
+[  179.180117][ T3731]  __fput+0x6bd/0xf00
+[  179.180787][ T3731]  ____fput+0x37/0x40
+[  179.181481][ T3731]  task_work_run+0x140/0x280
+[  179.182219][ T3731]  do_exit+0xe51/0x3e60
+[  179.182930][ T3731]  do_group_exit+0x20e/0x450
+[  179.183656][ T3731]  get_signal+0x2dfb/0x38f0
+[  179.184344][ T3731]  arch_do_signal_or_restart+0xaa/0xe10
+[  179.185266][ T3731]  exit_to_user_mode_prepare+0x2d2/0x560
+[  179.186136][ T3731]  syscall_exit_to_user_mode+0x35/0x60
+[  179.186984][ T3731]  do_syscall_64+0xc5/0x140
+[  179.187681][ T3731]  entry_SYSCALL_64_after_hwframe+0x44/0xae
+[  179.188604][ T3731] =====================================================
+
+In our case, there are two Thread A and B:
+
+Context: Thread A:              Context: Thread B:
+
+l2cap_chan_timeout()            __se_sys_shutdown()
+  l2cap_chan_close()              l2cap_sock_shutdown()
+    l2cap_chan_del()                l2cap_chan_close()
+      l2cap_sock_teardown_cb()        l2cap_sock_teardown_cb()
+
+Once l2cap_sock_teardown_cb() excuted, this sock will be marked as SOCK_ZAPPED,
+and can be treated as killable in l2cap_sock_kill() if sock_orphan() has
+excuted, at this time we close sock through sock_close() which end to call
+l2cap_sock_kill() like Thread C:
+
+Context: Thread C:
+
+sock_close()
+  l2cap_sock_release()
+    sock_orphan()
+    l2cap_sock_kill()  #free sock if refcnt is 1
+
+If C completed, Once A or B reaches l2cap_sock_teardown_cb() again,
+use-after-free happened.
+
+We should set chan->data to NULL if sock is destructed, for telling teardown
+operation is not allowed in l2cap_sock_teardown_cb(), and also we should
+avoid killing an already killed socket in l2cap_sock_close_cb().
+
+Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/bluetooth/l2cap_sock.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
+index 82e76ff01267a..08e9f332adad3 100644
+--- a/net/bluetooth/l2cap_sock.c
++++ b/net/bluetooth/l2cap_sock.c
+@@ -1347,6 +1347,9 @@ static void l2cap_sock_close_cb(struct l2cap_chan *chan)
+ {
+       struct sock *sk = chan->data;
++      if (!sk)
++              return;
++
+       l2cap_sock_kill(sk);
+ }
+@@ -1355,6 +1358,9 @@ static void l2cap_sock_teardown_cb(struct l2cap_chan *chan, int err)
+       struct sock *sk = chan->data;
+       struct sock *parent;
++      if (!sk)
++              return;
++
+       BT_DBG("chan %p state %s", chan, state_to_string(chan->state));
+       /* This callback can be called both for server (BT_LISTEN)
+@@ -1538,8 +1544,10 @@ static void l2cap_sock_destruct(struct sock *sk)
+ {
+       BT_DBG("sk %p", sk);
+-      if (l2cap_pi(sk)->chan)
++      if (l2cap_pi(sk)->chan) {
++              l2cap_pi(sk)->chan->data = NULL;
+               l2cap_chan_put(l2cap_pi(sk)->chan);
++      }
+       if (l2cap_pi(sk)->rx_busy_skb) {
+               kfree_skb(l2cap_pi(sk)->rx_busy_skb);
+-- 
+2.33.0
+
diff --git a/queue-5.4/bluetooth-sco-fix-lock_sock-blockage-by-memcpy_from_.patch b/queue-5.4/bluetooth-sco-fix-lock_sock-blockage-by-memcpy_from_.patch
new file mode 100644 (file)
index 0000000..471666d
--- /dev/null
@@ -0,0 +1,96 @@
+From 49c0ffcaea7420f0af7e7c1ff8922dd0e0036d27 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 28 Aug 2021 18:18:18 +0200
+Subject: Bluetooth: sco: Fix lock_sock() blockage by memcpy_from_msg()
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit 99c23da0eed4fd20cae8243f2b51e10e66aa0951 ]
+
+The sco_send_frame() also takes lock_sock() during memcpy_from_msg()
+call that may be endlessly blocked by a task with userfaultd
+technique, and this will result in a hung task watchdog trigger.
+
+Just like the similar fix for hci_sock_sendmsg() in commit
+92c685dc5de0 ("Bluetooth: reorganize functions..."), this patch moves
+the  memcpy_from_msg() out of lock_sock() for addressing the hang.
+
+This should be the last piece for fixing CVE-2021-3640 after a few
+already queued fixes.
+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/bluetooth/sco.c | 24 ++++++++++++++++--------
+ 1 file changed, 16 insertions(+), 8 deletions(-)
+
+diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
+index 1915943bb646a..cc5a1d2545679 100644
+--- a/net/bluetooth/sco.c
++++ b/net/bluetooth/sco.c
+@@ -280,7 +280,8 @@ static int sco_connect(struct hci_dev *hdev, struct sock *sk)
+       return err;
+ }
+-static int sco_send_frame(struct sock *sk, struct msghdr *msg, int len)
++static int sco_send_frame(struct sock *sk, void *buf, int len,
++                        unsigned int msg_flags)
+ {
+       struct sco_conn *conn = sco_pi(sk)->conn;
+       struct sk_buff *skb;
+@@ -292,15 +293,11 @@ static int sco_send_frame(struct sock *sk, struct msghdr *msg, int len)
+       BT_DBG("sk %p len %d", sk, len);
+-      skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err);
++      skb = bt_skb_send_alloc(sk, len, msg_flags & MSG_DONTWAIT, &err);
+       if (!skb)
+               return err;
+-      if (memcpy_from_msg(skb_put(skb, len), msg, len)) {
+-              kfree_skb(skb);
+-              return -EFAULT;
+-      }
+-
++      memcpy(skb_put(skb, len), buf, len);
+       hci_send_sco(conn->hcon, skb);
+       return len;
+@@ -714,6 +711,7 @@ static int sco_sock_sendmsg(struct socket *sock, struct msghdr *msg,
+                           size_t len)
+ {
+       struct sock *sk = sock->sk;
++      void *buf;
+       int err;
+       BT_DBG("sock %p, sk %p", sock, sk);
+@@ -725,14 +723,24 @@ static int sco_sock_sendmsg(struct socket *sock, struct msghdr *msg,
+       if (msg->msg_flags & MSG_OOB)
+               return -EOPNOTSUPP;
++      buf = kmalloc(len, GFP_KERNEL);
++      if (!buf)
++              return -ENOMEM;
++
++      if (memcpy_from_msg(buf, msg, len)) {
++              kfree(buf);
++              return -EFAULT;
++      }
++
+       lock_sock(sk);
+       if (sk->sk_state == BT_CONNECTED)
+-              err = sco_send_frame(sk, msg, len);
++              err = sco_send_frame(sk, buf, len, msg->msg_flags);
+       else
+               err = -ENOTCONN;
+       release_sock(sk);
++      kfree(buf);
+       return err;
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/bonding-fix-a-use-after-free-problem-when-bond_sysfs.patch b/queue-5.4/bonding-fix-a-use-after-free-problem-when-bond_sysfs.patch
new file mode 100644 (file)
index 0000000..3c901a0
--- /dev/null
@@ -0,0 +1,200 @@
+From d3fe49c7426219c0d9c613f34176d328ee789a4d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 2 Nov 2021 17:37:33 +0800
+Subject: bonding: Fix a use-after-free problem when bond_sysfs_slave_add()
+ failed
+
+From: Huang Guobin <huangguobin4@huawei.com>
+
+[ Upstream commit b93c6a911a3fe926b00add28f3b932007827c4ca ]
+
+When I do fuzz test for bonding device interface, I got the following
+use-after-free Calltrace:
+
+==================================================================
+BUG: KASAN: use-after-free in bond_enslave+0x1521/0x24f0
+Read of size 8 at addr ffff88825bc11c00 by task ifenslave/7365
+
+CPU: 5 PID: 7365 Comm: ifenslave Tainted: G            E     5.15.0-rc1+ #13
+Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1 04/01/2014
+Call Trace:
+ dump_stack_lvl+0x6c/0x8b
+ print_address_description.constprop.0+0x48/0x70
+ kasan_report.cold+0x82/0xdb
+ __asan_load8+0x69/0x90
+ bond_enslave+0x1521/0x24f0
+ bond_do_ioctl+0x3e0/0x450
+ dev_ifsioc+0x2ba/0x970
+ dev_ioctl+0x112/0x710
+ sock_do_ioctl+0x118/0x1b0
+ sock_ioctl+0x2e0/0x490
+ __x64_sys_ioctl+0x118/0x150
+ do_syscall_64+0x35/0xb0
+ entry_SYSCALL_64_after_hwframe+0x44/0xae
+RIP: 0033:0x7f19159cf577
+Code: b3 66 90 48 8b 05 11 89 2c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 78
+RSP: 002b:00007ffeb3083c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
+RAX: ffffffffffffffda RBX: 00007ffeb3084bca RCX: 00007f19159cf577
+RDX: 00007ffeb3083ce0 RSI: 0000000000008990 RDI: 0000000000000003
+RBP: 00007ffeb3084bc4 R08: 0000000000000040 R09: 0000000000000000
+R10: 00007ffeb3084bc0 R11: 0000000000000246 R12: 00007ffeb3083ce0
+R13: 0000000000000000 R14: 0000000000000000 R15: 00007ffeb3083cb0
+
+Allocated by task 7365:
+ kasan_save_stack+0x23/0x50
+ __kasan_kmalloc+0x83/0xa0
+ kmem_cache_alloc_trace+0x22e/0x470
+ bond_enslave+0x2e1/0x24f0
+ bond_do_ioctl+0x3e0/0x450
+ dev_ifsioc+0x2ba/0x970
+ dev_ioctl+0x112/0x710
+ sock_do_ioctl+0x118/0x1b0
+ sock_ioctl+0x2e0/0x490
+ __x64_sys_ioctl+0x118/0x150
+ do_syscall_64+0x35/0xb0
+ entry_SYSCALL_64_after_hwframe+0x44/0xae
+
+Freed by task 7365:
+ kasan_save_stack+0x23/0x50
+ kasan_set_track+0x20/0x30
+ kasan_set_free_info+0x24/0x40
+ __kasan_slab_free+0xf2/0x130
+ kfree+0xd1/0x5c0
+ slave_kobj_release+0x61/0x90
+ kobject_put+0x102/0x180
+ bond_sysfs_slave_add+0x7a/0xa0
+ bond_enslave+0x11b6/0x24f0
+ bond_do_ioctl+0x3e0/0x450
+ dev_ifsioc+0x2ba/0x970
+ dev_ioctl+0x112/0x710
+ sock_do_ioctl+0x118/0x1b0
+ sock_ioctl+0x2e0/0x490
+ __x64_sys_ioctl+0x118/0x150
+ do_syscall_64+0x35/0xb0
+ entry_SYSCALL_64_after_hwframe+0x44/0xae
+
+Last potentially related work creation:
+ kasan_save_stack+0x23/0x50
+ kasan_record_aux_stack+0xb7/0xd0
+ insert_work+0x43/0x190
+ __queue_work+0x2e3/0x970
+ delayed_work_timer_fn+0x3e/0x50
+ call_timer_fn+0x148/0x470
+ run_timer_softirq+0x8a8/0xc50
+ __do_softirq+0x107/0x55f
+
+Second to last potentially related work creation:
+ kasan_save_stack+0x23/0x50
+ kasan_record_aux_stack+0xb7/0xd0
+ insert_work+0x43/0x190
+ __queue_work+0x2e3/0x970
+ __queue_delayed_work+0x130/0x180
+ queue_delayed_work_on+0xa7/0xb0
+ bond_enslave+0xe25/0x24f0
+ bond_do_ioctl+0x3e0/0x450
+ dev_ifsioc+0x2ba/0x970
+ dev_ioctl+0x112/0x710
+ sock_do_ioctl+0x118/0x1b0
+ sock_ioctl+0x2e0/0x490
+ __x64_sys_ioctl+0x118/0x150
+ do_syscall_64+0x35/0xb0
+ entry_SYSCALL_64_after_hwframe+0x44/0xae
+
+The buggy address belongs to the object at ffff88825bc11c00
+ which belongs to the cache kmalloc-1k of size 1024
+The buggy address is located 0 bytes inside of
+ 1024-byte region [ffff88825bc11c00, ffff88825bc12000)
+The buggy address belongs to the page:
+page:ffffea00096f0400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x25bc10
+head:ffffea00096f0400 order:3 compound_mapcount:0 compound_pincount:0
+flags: 0x57ff00000010200(slab|head|node=1|zone=2|lastcpupid=0x7ff)
+raw: 057ff00000010200 ffffea0009a71c08 ffff888240001968 ffff88810004dbc0
+raw: 0000000000000000 00000000000a000a 00000001ffffffff 0000000000000000
+page dumped because: kasan: bad access detected
+
+Memory state around the buggy address:
+ ffff88825bc11b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
+ ffff88825bc11b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
+>ffff88825bc11c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
+                   ^
+ ffff88825bc11c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
+ ffff88825bc11d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
+==================================================================
+
+Put new_slave in bond_sysfs_slave_add() will cause use-after-free problems
+when new_slave is accessed in the subsequent error handling process. Since
+new_slave will be put in the subsequent error handling process, remove the
+unnecessary put to fix it.
+In addition, when sysfs_create_file() fails, if some files have been crea-
+ted successfully, we need to call sysfs_remove_file() to remove them.
+Since there are sysfs_create_files() & sysfs_remove_files() can be used,
+use these two functions instead.
+
+Fixes: 7afcaec49696 (bonding: use kobject_put instead of _del after kobject_add)
+Signed-off-by: Huang Guobin <huangguobin4@huawei.com>
+Reviewed-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/bonding/bond_sysfs_slave.c | 36 ++++++++------------------
+ 1 file changed, 11 insertions(+), 25 deletions(-)
+
+diff --git a/drivers/net/bonding/bond_sysfs_slave.c b/drivers/net/bonding/bond_sysfs_slave.c
+index fd07561da0348..6a6cdd0bb2585 100644
+--- a/drivers/net/bonding/bond_sysfs_slave.c
++++ b/drivers/net/bonding/bond_sysfs_slave.c
+@@ -108,15 +108,15 @@ static ssize_t ad_partner_oper_port_state_show(struct slave *slave, char *buf)
+ }
+ static SLAVE_ATTR_RO(ad_partner_oper_port_state);
+-static const struct slave_attribute *slave_attrs[] = {
+-      &slave_attr_state,
+-      &slave_attr_mii_status,
+-      &slave_attr_link_failure_count,
+-      &slave_attr_perm_hwaddr,
+-      &slave_attr_queue_id,
+-      &slave_attr_ad_aggregator_id,
+-      &slave_attr_ad_actor_oper_port_state,
+-      &slave_attr_ad_partner_oper_port_state,
++static const struct attribute *slave_attrs[] = {
++      &slave_attr_state.attr,
++      &slave_attr_mii_status.attr,
++      &slave_attr_link_failure_count.attr,
++      &slave_attr_perm_hwaddr.attr,
++      &slave_attr_queue_id.attr,
++      &slave_attr_ad_aggregator_id.attr,
++      &slave_attr_ad_actor_oper_port_state.attr,
++      &slave_attr_ad_partner_oper_port_state.attr,
+       NULL
+ };
+@@ -137,24 +137,10 @@ const struct sysfs_ops slave_sysfs_ops = {
+ int bond_sysfs_slave_add(struct slave *slave)
+ {
+-      const struct slave_attribute **a;
+-      int err;
+-
+-      for (a = slave_attrs; *a; ++a) {
+-              err = sysfs_create_file(&slave->kobj, &((*a)->attr));
+-              if (err) {
+-                      kobject_put(&slave->kobj);
+-                      return err;
+-              }
+-      }
+-
+-      return 0;
++      return sysfs_create_files(&slave->kobj, slave_attrs);
+ }
+ void bond_sysfs_slave_del(struct slave *slave)
+ {
+-      const struct slave_attribute **a;
+-
+-      for (a = slave_attrs; *a; ++a)
+-              sysfs_remove_file(&slave->kobj, &((*a)->attr));
++      sysfs_remove_files(&slave->kobj, slave_attrs);
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/bpf-sockmap-strparser-and-tls-are-reusing-qdisc_skb_.patch b/queue-5.4/bpf-sockmap-strparser-and-tls-are-reusing-qdisc_skb_.patch
new file mode 100644 (file)
index 0000000..e1e4c12
--- /dev/null
@@ -0,0 +1,144 @@
+From 05267e90abfb63e68bf7cf9252e30c3aff581400 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 3 Nov 2021 13:47:35 -0700
+Subject: bpf: sockmap, strparser, and tls are reusing qdisc_skb_cb and
+ colliding
+
+From: John Fastabend <john.fastabend@gmail.com>
+
+[ Upstream commit e0dc3b93bd7bcff8c3813d1df43e0908499c7cf0 ]
+
+Strparser is reusing the qdisc_skb_cb struct to stash the skb message handling
+progress, e.g. offset and length of the skb. First this is poorly named and
+inherits a struct from qdisc that doesn't reflect the actual usage of cb[] at
+this layer.
+
+But, more importantly strparser is using the following to access its metadata.
+
+  (struct _strp_msg *)((void *)skb->cb + offsetof(struct qdisc_skb_cb, data))
+
+Where _strp_msg is defined as:
+
+  struct _strp_msg {
+        struct strp_msg            strp;                 /*     0     8 */
+        int                        accum_len;            /*     8     4 */
+
+        /* size: 12, cachelines: 1, members: 2 */
+        /* last cacheline: 12 bytes */
+  };
+
+So we use 12 bytes of ->data[] in struct. However in BPF code running parser
+and verdict the user has read capabilities into the data[] array as well. Its
+not too problematic, but we should not be exposing internal state to BPF
+program. If its really needed then we can use the probe_read() APIs which allow
+reading kernel memory. And I don't believe cb[] layer poses any API breakage by
+moving this around because programs can't depend on cb[] across layers.
+
+In order to fix another issue with a ctx rewrite we need to stash a temp
+variable somewhere. To make this work cleanly this patch builds a cb struct
+for sk_skb types called sk_skb_cb struct. Then we can use this consistently
+in the strparser, sockmap space. Additionally we can start allowing ->cb[]
+write access after this.
+
+Fixes: 604326b41a6fb ("bpf, sockmap: convert to generic sk_msg interface")
+Signed-off-by: John Fastabend <john.fastabend@gmail.com>
+Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
+Tested-by: Jussi Maki <joamaki@gmail.com>
+Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
+Link: https://lore.kernel.org/bpf/20211103204736.248403-5-john.fastabend@gmail.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/net/strparser.h   | 16 +++++++++++++++-
+ net/core/filter.c         | 21 +++++++++++++++++++++
+ net/strparser/strparser.c | 10 +---------
+ 3 files changed, 37 insertions(+), 10 deletions(-)
+
+diff --git a/include/net/strparser.h b/include/net/strparser.h
+index 1d20b98493a10..bec1439bd3be6 100644
+--- a/include/net/strparser.h
++++ b/include/net/strparser.h
+@@ -54,10 +54,24 @@ struct strp_msg {
+       int offset;
+ };
++struct _strp_msg {
++      /* Internal cb structure. struct strp_msg must be first for passing
++       * to upper layer.
++       */
++      struct strp_msg strp;
++      int accum_len;
++};
++
++struct sk_skb_cb {
++#define SK_SKB_CB_PRIV_LEN 20
++      unsigned char data[SK_SKB_CB_PRIV_LEN];
++      struct _strp_msg strp;
++};
++
+ static inline struct strp_msg *strp_msg(struct sk_buff *skb)
+ {
+       return (struct strp_msg *)((void *)skb->cb +
+-              offsetof(struct qdisc_skb_cb, data));
++              offsetof(struct sk_skb_cb, strp));
+ }
+ /* Structure for an attached lower socket */
+diff --git a/net/core/filter.c b/net/core/filter.c
+index 0e161a6dff7e5..5ebc973ed4c50 100644
+--- a/net/core/filter.c
++++ b/net/core/filter.c
+@@ -8356,6 +8356,27 @@ static u32 sk_skb_convert_ctx_access(enum bpf_access_type type,
+               *insn++ = BPF_LDX_MEM(BPF_SIZEOF(void *), si->dst_reg,
+                                     si->src_reg, off);
+               break;
++      case offsetof(struct __sk_buff, cb[0]) ...
++           offsetofend(struct __sk_buff, cb[4]) - 1:
++              BUILD_BUG_ON(sizeof_field(struct sk_skb_cb, data) < 20);
++              BUILD_BUG_ON((offsetof(struct sk_buff, cb) +
++                            offsetof(struct sk_skb_cb, data)) %
++                           sizeof(__u64));
++
++              prog->cb_access = 1;
++              off  = si->off;
++              off -= offsetof(struct __sk_buff, cb[0]);
++              off += offsetof(struct sk_buff, cb);
++              off += offsetof(struct sk_skb_cb, data);
++              if (type == BPF_WRITE)
++                      *insn++ = BPF_STX_MEM(BPF_SIZE(si->code), si->dst_reg,
++                                            si->src_reg, off);
++              else
++                      *insn++ = BPF_LDX_MEM(BPF_SIZE(si->code), si->dst_reg,
++                                            si->src_reg, off);
++              break;
++
++
+       default:
+               return bpf_convert_ctx_access(type, si, insn_buf, prog,
+                                             target_size);
+diff --git a/net/strparser/strparser.c b/net/strparser/strparser.c
+index b3815c1e8f2ea..cd9954c4ad808 100644
+--- a/net/strparser/strparser.c
++++ b/net/strparser/strparser.c
+@@ -27,18 +27,10 @@
+ static struct workqueue_struct *strp_wq;
+-struct _strp_msg {
+-      /* Internal cb structure. struct strp_msg must be first for passing
+-       * to upper layer.
+-       */
+-      struct strp_msg strp;
+-      int accum_len;
+-};
+-
+ static inline struct _strp_msg *_strp_msg(struct sk_buff *skb)
+ {
+       return (struct _strp_msg *)((void *)skb->cb +
+-              offsetof(struct qdisc_skb_cb, data));
++              offsetof(struct sk_skb_cb, strp));
+ }
+ /* Lower lock held */
+-- 
+2.33.0
+
diff --git a/queue-5.4/brcmfmac-add-dmi-nvram-filename-quirk-for-cyberbook-.patch b/queue-5.4/brcmfmac-add-dmi-nvram-filename-quirk-for-cyberbook-.patch
new file mode 100644 (file)
index 0000000..f19d549
--- /dev/null
@@ -0,0 +1,50 @@
+From 4d8b8aff01d1d230154b4166ac07cb7f5b768c39 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 28 Sep 2021 18:06:33 +0200
+Subject: brcmfmac: Add DMI nvram filename quirk for Cyberbook T116 tablet
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+[ Upstream commit 49c3eb3036e6359c5c20fe76c611a2c0e0d4710e ]
+
+The Cyberbook T116 tablet contains quite generic names in the sys_vendor
+and product_name DMI strings, without this patch brcmfmac will try to load:
+"brcmfmac43455-sdio.Default string-Default string.txt" as nvram file which
+is way too generic.
+
+The nvram file shipped on the factory Android image contains the exact
+same settings as those used on the AcePC T8 mini PC, so point the new
+DMI nvram filename quirk to the acepc-t8 nvram file.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/20210928160633.96928-1-hdegoede@redhat.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c
+index 6d5188b78f2de..0af452dca7664 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c
+@@ -75,6 +75,16 @@ static const struct dmi_system_id dmi_platform_data[] = {
+               },
+               .driver_data = (void *)&acepc_t8_data,
+       },
++      {
++              /* Cyberbook T116 rugged tablet */
++              .matches = {
++                      DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Default string"),
++                      DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
++                      DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "20170531"),
++              },
++              /* The factory image nvram file is identical to the ACEPC T8 one */
++              .driver_data = (void *)&acepc_t8_data,
++      },
+       {
+               /* Match for the GPDwin which unfortunately uses somewhat
+                * generic dmi strings, which is why we test for 4 strings.
+-- 
+2.33.0
+
diff --git a/queue-5.4/btrfs-do-not-take-the-uuid_mutex-in-btrfs_rm_device.patch b/queue-5.4/btrfs-do-not-take-the-uuid_mutex-in-btrfs_rm_device.patch
new file mode 100644 (file)
index 0000000..2e07b13
--- /dev/null
@@ -0,0 +1,237 @@
+From cdeec5af7258fbbc4dc60eb86848be7bcb30c9ed Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 27 Jul 2021 17:01:14 -0400
+Subject: btrfs: do not take the uuid_mutex in btrfs_rm_device
+
+From: Josef Bacik <josef@toxicpanda.com>
+
+[ Upstream commit 8ef9dc0f14ba6124c62547a4fdc59b163d8b864e ]
+
+We got the following lockdep splat while running fstests (specifically
+btrfs/003 and btrfs/020 in a row) with the new rc.  This was uncovered
+by 87579e9b7d8d ("loop: use worker per cgroup instead of kworker") which
+converted loop to using workqueues, which comes with lockdep
+annotations that don't exist with kworkers.  The lockdep splat is as
+follows:
+
+  WARNING: possible circular locking dependency detected
+  5.14.0-rc2-custom+ #34 Not tainted
+  ------------------------------------------------------
+  losetup/156417 is trying to acquire lock:
+  ffff9c7645b02d38 ((wq_completion)loop0){+.+.}-{0:0}, at: flush_workqueue+0x84/0x600
+
+  but task is already holding lock:
+  ffff9c7647395468 (&lo->lo_mutex){+.+.}-{3:3}, at: __loop_clr_fd+0x41/0x650 [loop]
+
+  which lock already depends on the new lock.
+
+  the existing dependency chain (in reverse order) is:
+
+  -> #5 (&lo->lo_mutex){+.+.}-{3:3}:
+        __mutex_lock+0xba/0x7c0
+        lo_open+0x28/0x60 [loop]
+        blkdev_get_whole+0x28/0xf0
+        blkdev_get_by_dev.part.0+0x168/0x3c0
+        blkdev_open+0xd2/0xe0
+        do_dentry_open+0x163/0x3a0
+        path_openat+0x74d/0xa40
+        do_filp_open+0x9c/0x140
+        do_sys_openat2+0xb1/0x170
+        __x64_sys_openat+0x54/0x90
+        do_syscall_64+0x3b/0x90
+        entry_SYSCALL_64_after_hwframe+0x44/0xae
+
+  -> #4 (&disk->open_mutex){+.+.}-{3:3}:
+        __mutex_lock+0xba/0x7c0
+        blkdev_get_by_dev.part.0+0xd1/0x3c0
+        blkdev_get_by_path+0xc0/0xd0
+        btrfs_scan_one_device+0x52/0x1f0 [btrfs]
+        btrfs_control_ioctl+0xac/0x170 [btrfs]
+        __x64_sys_ioctl+0x83/0xb0
+        do_syscall_64+0x3b/0x90
+        entry_SYSCALL_64_after_hwframe+0x44/0xae
+
+  -> #3 (uuid_mutex){+.+.}-{3:3}:
+        __mutex_lock+0xba/0x7c0
+        btrfs_rm_device+0x48/0x6a0 [btrfs]
+        btrfs_ioctl+0x2d1c/0x3110 [btrfs]
+        __x64_sys_ioctl+0x83/0xb0
+        do_syscall_64+0x3b/0x90
+        entry_SYSCALL_64_after_hwframe+0x44/0xae
+
+  -> #2 (sb_writers#11){.+.+}-{0:0}:
+        lo_write_bvec+0x112/0x290 [loop]
+        loop_process_work+0x25f/0xcb0 [loop]
+        process_one_work+0x28f/0x5d0
+        worker_thread+0x55/0x3c0
+        kthread+0x140/0x170
+        ret_from_fork+0x22/0x30
+
+  -> #1 ((work_completion)(&lo->rootcg_work)){+.+.}-{0:0}:
+        process_one_work+0x266/0x5d0
+        worker_thread+0x55/0x3c0
+        kthread+0x140/0x170
+        ret_from_fork+0x22/0x30
+
+  -> #0 ((wq_completion)loop0){+.+.}-{0:0}:
+        __lock_acquire+0x1130/0x1dc0
+        lock_acquire+0xf5/0x320
+        flush_workqueue+0xae/0x600
+        drain_workqueue+0xa0/0x110
+        destroy_workqueue+0x36/0x250
+        __loop_clr_fd+0x9a/0x650 [loop]
+        lo_ioctl+0x29d/0x780 [loop]
+        block_ioctl+0x3f/0x50
+        __x64_sys_ioctl+0x83/0xb0
+        do_syscall_64+0x3b/0x90
+        entry_SYSCALL_64_after_hwframe+0x44/0xae
+
+  other info that might help us debug this:
+  Chain exists of:
+    (wq_completion)loop0 --> &disk->open_mutex --> &lo->lo_mutex
+   Possible unsafe locking scenario:
+        CPU0                    CPU1
+        ----                    ----
+    lock(&lo->lo_mutex);
+                                lock(&disk->open_mutex);
+                                lock(&lo->lo_mutex);
+    lock((wq_completion)loop0);
+
+   *** DEADLOCK ***
+  1 lock held by losetup/156417:
+   #0: ffff9c7647395468 (&lo->lo_mutex){+.+.}-{3:3}, at: __loop_clr_fd+0x41/0x650 [loop]
+
+  stack backtrace:
+  CPU: 8 PID: 156417 Comm: losetup Not tainted 5.14.0-rc2-custom+ #34
+  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
+  Call Trace:
+   dump_stack_lvl+0x57/0x72
+   check_noncircular+0x10a/0x120
+   __lock_acquire+0x1130/0x1dc0
+   lock_acquire+0xf5/0x320
+   ? flush_workqueue+0x84/0x600
+   flush_workqueue+0xae/0x600
+   ? flush_workqueue+0x84/0x600
+   drain_workqueue+0xa0/0x110
+   destroy_workqueue+0x36/0x250
+   __loop_clr_fd+0x9a/0x650 [loop]
+   lo_ioctl+0x29d/0x780 [loop]
+   ? __lock_acquire+0x3a0/0x1dc0
+   ? update_dl_rq_load_avg+0x152/0x360
+   ? lock_is_held_type+0xa5/0x120
+   ? find_held_lock.constprop.0+0x2b/0x80
+   block_ioctl+0x3f/0x50
+   __x64_sys_ioctl+0x83/0xb0
+   do_syscall_64+0x3b/0x90
+   entry_SYSCALL_64_after_hwframe+0x44/0xae
+  RIP: 0033:0x7f645884de6b
+
+Usually the uuid_mutex exists to protect the fs_devices that map
+together all of the devices that match a specific uuid.  In rm_device
+we're messing with the uuid of a device, so it makes sense to protect
+that here.
+
+However in doing that it pulls in a whole host of lockdep dependencies,
+as we call mnt_may_write() on the sb before we grab the uuid_mutex, thus
+we end up with the dependency chain under the uuid_mutex being added
+under the normal sb write dependency chain, which causes problems with
+loop devices.
+
+We don't need the uuid mutex here however.  If we call
+btrfs_scan_one_device() before we scratch the super block we will find
+the fs_devices and not find the device itself and return EBUSY because
+the fs_devices is open.  If we call it after the scratch happens it will
+not appear to be a valid btrfs file system.
+
+We do not need to worry about other fs_devices modifying operations here
+because we're protected by the exclusive operations locking.
+
+So drop the uuid_mutex here in order to fix the lockdep splat.
+
+A more detailed explanation from the discussion:
+
+We are worried about rm and scan racing with each other, before this
+change we'll zero the device out under the UUID mutex so when scan does
+run it'll make sure that it can go through the whole device scan thing
+without rm messing with us.
+
+We aren't worried if the scratch happens first, because the result is we
+don't think this is a btrfs device and we bail out.
+
+The only case we are concerned with is we scratch _after_ scan is able
+to read the superblock and gets a seemingly valid super block, so lets
+consider this case.
+
+Scan will call device_list_add() with the device we're removing.  We'll
+call find_fsid_with_metadata_uuid() and get our fs_devices for this
+UUID.  At this point we lock the fs_devices->device_list_mutex.  This is
+what protects us in this case, but we have two cases here.
+
+1. We aren't to the device removal part of the RM.  We found our device,
+   and device name matches our path, we go down and we set total_devices
+   to our super number of devices, which doesn't affect anything because
+   we haven't done the remove yet.
+
+2. We are past the device removal part, which is protected by the
+   device_list_mutex.  Scan doesn't find the device, it goes down and
+   does the
+
+   if (fs_devices->opened)
+          return -EBUSY;
+
+   check and we bail out.
+
+Nothing about this situation is ideal, but the lockdep splat is real,
+and the fix is safe, tho admittedly a bit scary looking.
+
+Reviewed-by: Anand Jain <anand.jain@oracle.com>
+Signed-off-by: Josef Bacik <josef@toxicpanda.com>
+Reviewed-by: David Sterba <dsterba@suse.com>
+[ copy more from the discussion ]
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/btrfs/volumes.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
+index 8af92e44deae4..344d18de1f08c 100644
+--- a/fs/btrfs/volumes.c
++++ b/fs/btrfs/volumes.c
+@@ -2162,8 +2162,11 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,
+       u64 num_devices;
+       int ret = 0;
+-      mutex_lock(&uuid_mutex);
+-
++      /*
++       * The device list in fs_devices is accessed without locks (neither
++       * uuid_mutex nor device_list_mutex) as it won't change on a mounted
++       * filesystem and another device rm cannot run.
++       */
+       num_devices = btrfs_num_devices(fs_info);
+       ret = btrfs_check_raid_min_devices(fs_info, num_devices - 1);
+@@ -2207,11 +2210,9 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,
+               mutex_unlock(&fs_info->chunk_mutex);
+       }
+-      mutex_unlock(&uuid_mutex);
+       ret = btrfs_shrink_device(device, 0);
+       if (!ret)
+               btrfs_reada_remove_dev(device);
+-      mutex_lock(&uuid_mutex);
+       if (ret)
+               goto error_undo;
+@@ -2293,7 +2294,6 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,
+       }
+ out:
+-      mutex_unlock(&uuid_mutex);
+       return ret;
+ error_undo:
+-- 
+2.33.0
+
diff --git a/queue-5.4/btrfs-subpage-make-btrfs_submit_compressed_write-com.patch b/queue-5.4/btrfs-subpage-make-btrfs_submit_compressed_write-com.patch
new file mode 100644 (file)
index 0000000..0827ea7
--- /dev/null
@@ -0,0 +1,44 @@
+From 43eed27532e1c7b2ae261346cf8bda59a148be60 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 27 Sep 2021 15:22:00 +0800
+Subject: btrfs: subpage: make btrfs_submit_compressed_write() compatible
+
+From: Qu Wenruo <wqu@suse.com>
+
+[ Upstream commit bbbff01a47bfe1b7733c5ccac6a78ff6d7a8954f ]
+
+There is a WARN_ON() checking if @start is aligned to PAGE_SIZE, not
+sectorsize, which will cause false alert for subpage.  Fix it to check
+against sectorsize.
+
+Furthermore:
+
+- Use ASSERT() to do the check
+  So that in the future we may skip the check for production build
+
+- Also check alignment for @len
+
+Signed-off-by: Qu Wenruo <wqu@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/btrfs/compression.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
+index 28f78e4f2c87a..fc64f75075e31 100644
+--- a/fs/btrfs/compression.c
++++ b/fs/btrfs/compression.c
+@@ -324,7 +324,8 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start,
+       blk_status_t ret;
+       int skip_sum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM;
+-      WARN_ON(!PAGE_ALIGNED(start));
++      ASSERT(IS_ALIGNED(start, fs_info->sectorsize) &&
++             IS_ALIGNED(len, fs_info->sectorsize));
+       cb = kmalloc(compressed_bio_size(fs_info, compressed_len), GFP_NOFS);
+       if (!cb)
+               return BLK_STS_RESOURCE;
+-- 
+2.33.0
+
diff --git a/queue-5.4/cgroup-make-rebind_subsystems-disable-v2-controllers.patch b/queue-5.4/cgroup-make-rebind_subsystems-disable-v2-controllers.patch
new file mode 100644 (file)
index 0000000..509d2b3
--- /dev/null
@@ -0,0 +1,120 @@
+From 135f08b6ce6172484665e347ae66ea52cee8ae93 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 18 Sep 2021 18:53:08 -0400
+Subject: cgroup: Make rebind_subsystems() disable v2 controllers all at once
+
+From: Waiman Long <longman@redhat.com>
+
+[ Upstream commit 7ee285395b211cad474b2b989db52666e0430daf ]
+
+It was found that the following warning was displayed when remounting
+controllers from cgroup v2 to v1:
+
+[ 8042.997778] WARNING: CPU: 88 PID: 80682 at kernel/cgroup/cgroup.c:3130 cgroup_apply_control_disable+0x158/0x190
+   :
+[ 8043.091109] RIP: 0010:cgroup_apply_control_disable+0x158/0x190
+[ 8043.096946] Code: ff f6 45 54 01 74 39 48 8d 7d 10 48 c7 c6 e0 46 5a a4 e8 7b 67 33 00 e9 41 ff ff ff 49 8b 84 24 e8 01 00 00 0f b7 40 08 eb 95 <0f> 0b e9 5f ff ff ff 48 83 c4 08 5b 5d 41 5c 41 5d 41 5e 41 5f c3
+[ 8043.115692] RSP: 0018:ffffba8a47c23d28 EFLAGS: 00010202
+[ 8043.120916] RAX: 0000000000000036 RBX: ffffffffa624ce40 RCX: 000000000000181a
+[ 8043.128047] RDX: ffffffffa63c43e0 RSI: ffffffffa63c43e0 RDI: ffff9d7284ee1000
+[ 8043.135180] RBP: ffff9d72874c5800 R08: ffffffffa624b090 R09: 0000000000000004
+[ 8043.142314] R10: ffffffffa624b080 R11: 0000000000002000 R12: ffff9d7284ee1000
+[ 8043.149447] R13: ffff9d7284ee1000 R14: ffffffffa624ce70 R15: ffffffffa6269e20
+[ 8043.156576] FS:  00007f7747cff740(0000) GS:ffff9d7a5fc00000(0000) knlGS:0000000000000000
+[ 8043.164663] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+[ 8043.170409] CR2: 00007f7747e96680 CR3: 0000000887d60001 CR4: 00000000007706e0
+[ 8043.177539] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+[ 8043.184673] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
+[ 8043.191804] PKRU: 55555554
+[ 8043.194517] Call Trace:
+[ 8043.196970]  rebind_subsystems+0x18c/0x470
+[ 8043.201070]  cgroup_setup_root+0x16c/0x2f0
+[ 8043.205177]  cgroup1_root_to_use+0x204/0x2a0
+[ 8043.209456]  cgroup1_get_tree+0x3e/0x120
+[ 8043.213384]  vfs_get_tree+0x22/0xb0
+[ 8043.216883]  do_new_mount+0x176/0x2d0
+[ 8043.220550]  __x64_sys_mount+0x103/0x140
+[ 8043.224474]  do_syscall_64+0x38/0x90
+[ 8043.228063]  entry_SYSCALL_64_after_hwframe+0x44/0xae
+
+It was caused by the fact that rebind_subsystem() disables
+controllers to be rebound one by one. If more than one disabled
+controllers are originally from the default hierarchy, it means that
+cgroup_apply_control_disable() will be called multiple times for the
+same default hierarchy. A controller may be killed by css_kill() in
+the first round. In the second round, the killed controller may not be
+completely dead yet leading to the warning.
+
+To avoid this problem, we collect all the ssid's of controllers that
+needed to be disabled from the default hierarchy and then disable them
+in one go instead of one by one.
+
+Fixes: 334c3679ec4b ("cgroup: reimplement rebind_subsystems() using cgroup_apply_control() and friends")
+Signed-off-by: Waiman Long <longman@redhat.com>
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/cgroup/cgroup.c | 31 +++++++++++++++++++++++++++----
+ 1 file changed, 27 insertions(+), 4 deletions(-)
+
+diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
+index ede370ec245d9..1904ffcee0f1e 100644
+--- a/kernel/cgroup/cgroup.c
++++ b/kernel/cgroup/cgroup.c
+@@ -1721,6 +1721,7 @@ int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask)
+       struct cgroup *dcgrp = &dst_root->cgrp;
+       struct cgroup_subsys *ss;
+       int ssid, i, ret;
++      u16 dfl_disable_ss_mask = 0;
+       lockdep_assert_held(&cgroup_mutex);
+@@ -1737,8 +1738,28 @@ int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask)
+               /* can't move between two non-dummy roots either */
+               if (ss->root != &cgrp_dfl_root && dst_root != &cgrp_dfl_root)
+                       return -EBUSY;
++
++              /*
++               * Collect ssid's that need to be disabled from default
++               * hierarchy.
++               */
++              if (ss->root == &cgrp_dfl_root)
++                      dfl_disable_ss_mask |= 1 << ssid;
++
+       } while_each_subsys_mask();
++      if (dfl_disable_ss_mask) {
++              struct cgroup *scgrp = &cgrp_dfl_root.cgrp;
++
++              /*
++               * Controllers from default hierarchy that need to be rebound
++               * are all disabled together in one go.
++               */
++              cgrp_dfl_root.subsys_mask &= ~dfl_disable_ss_mask;
++              WARN_ON(cgroup_apply_control(scgrp));
++              cgroup_finalize_control(scgrp, 0);
++      }
++
+       do_each_subsys_mask(ss, ssid, ss_mask) {
+               struct cgroup_root *src_root = ss->root;
+               struct cgroup *scgrp = &src_root->cgrp;
+@@ -1747,10 +1768,12 @@ int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask)
+               WARN_ON(!css || cgroup_css(dcgrp, ss));
+-              /* disable from the source */
+-              src_root->subsys_mask &= ~(1 << ssid);
+-              WARN_ON(cgroup_apply_control(scgrp));
+-              cgroup_finalize_control(scgrp, 0);
++              if (src_root != &cgrp_dfl_root) {
++                      /* disable from the source */
++                      src_root->subsys_mask &= ~(1 << ssid);
++                      WARN_ON(cgroup_apply_control(scgrp));
++                      cgroup_finalize_control(scgrp, 0);
++              }
+               /* rebind */
+               RCU_INIT_POINTER(scgrp->subsys[ssid], NULL);
+-- 
+2.33.0
+
diff --git a/queue-5.4/clk-at91-check-pmc-node-status-before-registering-sy.patch b/queue-5.4/clk-at91-check-pmc-node-status-before-registering-sy.patch
new file mode 100644 (file)
index 0000000..3fce7c5
--- /dev/null
@@ -0,0 +1,49 @@
+From 5483e315127960595e3a5d026e4bc09638376a32 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 13 Sep 2021 10:26:33 +0200
+Subject: clk: at91: check pmc node status before registering syscore ops
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Clément Léger <clement.leger@bootlin.com>
+
+[ Upstream commit c405f5c15e9f6094f2fa1658e73e56f3058e2122 ]
+
+Currently, at91 pmc driver always register the syscore_ops whatever
+the status of the pmc node that has been found. When set as secure
+and disabled, the pmc should not be accessed or this will generate
+abort exceptions.
+To avoid this, add a check on node availability before registering
+the syscore operations.
+
+Signed-off-by: Clément Léger <clement.leger@bootlin.com>
+Link: https://lore.kernel.org/r/20210913082633.110168-1-clement.leger@bootlin.com
+Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
+Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
+Fixes: b3b02eac33ed ("clk: at91: Add sama5d2 suspend/resume")
+Signed-off-by: Stephen Boyd <sboyd@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/clk/at91/pmc.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
+index b71515acdec1f..976ca41e9157e 100644
+--- a/drivers/clk/at91/pmc.c
++++ b/drivers/clk/at91/pmc.c
+@@ -275,6 +275,11 @@ static int __init pmc_register_ops(void)
+       np = of_find_matching_node(NULL, sama5d2_pmc_dt_ids);
++      if (!of_device_is_available(np)) {
++              of_node_put(np);
++              return -ENODEV;
++      }
++
+       pmcreg = device_node_to_regmap(np);
+       if (IS_ERR(pmcreg))
+               return PTR_ERR(pmcreg);
+-- 
+2.33.0
+
diff --git a/queue-5.4/clk-mvebu-ap-cpu-clk-fix-a-memory-leak-in-error-hand.patch b/queue-5.4/clk-mvebu-ap-cpu-clk-fix-a-memory-leak-in-error-hand.patch
new file mode 100644 (file)
index 0000000..17e76d1
--- /dev/null
@@ -0,0 +1,78 @@
+From ac37c308d2b671d5cfd233996d81c84c12c4fb51 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 23 Apr 2021 09:02:26 +0200
+Subject: clk: mvebu: ap-cpu-clk: Fix a memory leak in error handling paths
+
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+
+[ Upstream commit af9617b419f77cf0b99702a7b2b0519da0d27715 ]
+
+If we exit the for_each_of_cpu_node loop early, the reference on the
+current node must be decremented, otherwise there is a leak.
+
+Fixes: f756e362d938 ("clk: mvebu: add CPU clock driver for Armada 7K/8K")
+Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Link: https://lore.kernel.org/r/545df946044fc1fc05a4217cdf0054be7a79e49e.1619161112.git.christophe.jaillet@wanadoo.fr
+Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
+Signed-off-by: Stephen Boyd <sboyd@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/clk/mvebu/ap-cpu-clk.c | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/clk/mvebu/ap-cpu-clk.c b/drivers/clk/mvebu/ap-cpu-clk.c
+index af5e5acad3706..bde4a7d6a1d33 100644
+--- a/drivers/clk/mvebu/ap-cpu-clk.c
++++ b/drivers/clk/mvebu/ap-cpu-clk.c
+@@ -256,12 +256,15 @@ static int ap_cpu_clock_probe(struct platform_device *pdev)
+               int cpu, err;
+               err = of_property_read_u32(dn, "reg", &cpu);
+-              if (WARN_ON(err))
++              if (WARN_ON(err)) {
++                      of_node_put(dn);
+                       return err;
++              }
+               /* If cpu2 or cpu3 is enabled */
+               if (cpu & APN806_CLUSTER_NUM_MASK) {
+                       nclusters = 2;
++                      of_node_put(dn);
+                       break;
+               }
+       }
+@@ -288,8 +291,10 @@ static int ap_cpu_clock_probe(struct platform_device *pdev)
+               int cpu, err;
+               err = of_property_read_u32(dn, "reg", &cpu);
+-              if (WARN_ON(err))
++              if (WARN_ON(err)) {
++                      of_node_put(dn);
+                       return err;
++              }
+               cluster_index = cpu & APN806_CLUSTER_NUM_MASK;
+               cluster_index >>= APN806_CLUSTER_NUM_OFFSET;
+@@ -301,6 +306,7 @@ static int ap_cpu_clock_probe(struct platform_device *pdev)
+               parent = of_clk_get(np, cluster_index);
+               if (IS_ERR(parent)) {
+                       dev_err(dev, "Could not get the clock parent\n");
++                      of_node_put(dn);
+                       return -EINVAL;
+               }
+               parent_name =  __clk_get_name(parent);
+@@ -319,8 +325,10 @@ static int ap_cpu_clock_probe(struct platform_device *pdev)
+               init.parent_names = &parent_name;
+               ret = devm_clk_hw_register(dev, &ap_cpu_clk[cluster_index].hw);
+-              if (ret)
++              if (ret) {
++                      of_node_put(dn);
+                       return ret;
++              }
+               ap_cpu_data->hws[cluster_index] = &ap_cpu_clk[cluster_index].hw;
+       }
+-- 
+2.33.0
+
diff --git a/queue-5.4/clocksource-drivers-timer-ti-dm-select-timer_of.patch b/queue-5.4/clocksource-drivers-timer-ti-dm-select-timer_of.patch
new file mode 100644 (file)
index 0000000..7c932f6
--- /dev/null
@@ -0,0 +1,49 @@
+From b01f5e9992ca189bd067db62a8888b82799cd667 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 28 Aug 2021 10:57:47 -0700
+Subject: clocksource/drivers/timer-ti-dm: Select TIMER_OF
+
+From: Kees Cook <keescook@chromium.org>
+
+[ Upstream commit eda9a4f7af6ee47e9e131f20e4f8a41a97379293 ]
+
+When building OMAP_DM_TIMER without TIMER_OF, there are orphan sections
+due to the use of TIMER_OF_DELCARE() without CONFIG_TIMER_OF. Select
+CONFIG_TIMER_OF when enaling OMAP_DM_TIMER:
+
+arm-linux-gnueabi-ld: warning: orphan section `__timer_of_table' from `drivers/clocksource/timer-ti-dm-systimer.o' being placed in section `__timer_of_table'
+
+Reported-by: kernel test robot <lkp@intel.com>
+Link: https://lore.kernel.org/lkml/202108282255.tkdt4ani-lkp@intel.com/
+Cc: Tony Lindgren <tony@atomide.com>
+Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
+Cc: Keerthy <j-keerthy@ti.com>
+Cc: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
+Cc: Ladislav Michl <ladis@linux-mips.org>
+Cc: Grygorii Strashko <grygorii.strashko@ti.com>
+Cc: linux-omap@vger.kernel.org
+Fixes: 52762fbd1c47 ("clocksource/drivers/timer-ti-dm: Add clockevent and clocksource support")
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Acked-by: Tony Lindgren <tony@atomide.com>
+Link: https://lore.kernel.org/r/20210828175747.3777891-1-keescook@chromium.org
+Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/clocksource/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
+index 3bb5625504e2f..9bfe4c5af87e3 100644
+--- a/drivers/clocksource/Kconfig
++++ b/drivers/clocksource/Kconfig
+@@ -24,6 +24,7 @@ config I8253_LOCK
+ config OMAP_DM_TIMER
+       bool
++      select TIMER_OF
+ config CLKBLD_I8253
+       def_bool y if CLKSRC_I8253 || CLKEVT_I8253 || I8253_LOCK
+-- 
+2.33.0
+
diff --git a/queue-5.4/cpuidle-fix-kobject-memory-leaks-in-error-paths.patch b/queue-5.4/cpuidle-fix-kobject-memory-leaks-in-error-paths.patch
new file mode 100644 (file)
index 0000000..2c30719
--- /dev/null
@@ -0,0 +1,70 @@
+From 82b5ca4bc4da2b62c5a70784eeccb7a34d2abd5c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 6 Sep 2021 18:34:40 +0000
+Subject: cpuidle: Fix kobject memory leaks in error paths
+
+From: Anel Orazgaliyeva <anelkz@amazon.de>
+
+[ Upstream commit e5f5a66c9aa9c331da5527c2e3fd9394e7091e01 ]
+
+Commit c343bf1ba5ef ("cpuidle: Fix three reference count leaks")
+fixes the cleanup of kobjects; however, it removes kfree() calls
+altogether, leading to memory leaks.
+
+Fix those and also defer the initialization of dev->kobj_dev until
+after the error check, so that we do not end up with a dangling
+pointer.
+
+Fixes: c343bf1ba5ef ("cpuidle: Fix three reference count leaks")
+Signed-off-by: Anel Orazgaliyeva <anelkz@amazon.de>
+Suggested-by: Aman Priyadarshi <apeureka@amazon.de>
+[ rjw: Subject edits ]
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/cpuidle/sysfs.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
+index f8747322b3c70..e591f56f98c03 100644
+--- a/drivers/cpuidle/sysfs.c
++++ b/drivers/cpuidle/sysfs.c
+@@ -481,6 +481,7 @@ static int cpuidle_add_state_sysfs(struct cpuidle_device *device)
+                                          &kdev->kobj, "state%d", i);
+               if (ret) {
+                       kobject_put(&kobj->kobj);
++                      kfree(kobj);
+                       goto error_state;
+               }
+               cpuidle_add_s2idle_attr_group(kobj);
+@@ -612,6 +613,7 @@ static int cpuidle_add_driver_sysfs(struct cpuidle_device *dev)
+                                  &kdev->kobj, "driver");
+       if (ret) {
+               kobject_put(&kdrv->kobj);
++              kfree(kdrv);
+               return ret;
+       }
+@@ -698,7 +700,6 @@ int cpuidle_add_sysfs(struct cpuidle_device *dev)
+       if (!kdev)
+               return -ENOMEM;
+       kdev->dev = dev;
+-      dev->kobj_dev = kdev;
+       init_completion(&kdev->kobj_unregister);
+@@ -706,9 +707,11 @@ int cpuidle_add_sysfs(struct cpuidle_device *dev)
+                                  "cpuidle");
+       if (error) {
+               kobject_put(&kdev->kobj);
++              kfree(kdev);
+               return error;
+       }
++      dev->kobj_dev = kdev;
+       kobject_uevent(&kdev->kobj, KOBJ_ADD);
+       return 0;
+-- 
+2.33.0
+
diff --git a/queue-5.4/crypto-caam-disable-pkc-for-non-e-socs.patch b/queue-5.4/crypto-caam-disable-pkc-for-non-e-socs.patch
new file mode 100644 (file)
index 0000000..98c9188
--- /dev/null
@@ -0,0 +1,89 @@
+From 64e6df7c84488b4db2571404d48017a82512d212 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 16 Sep 2021 00:03:07 +0200
+Subject: crypto: caam - disable pkc for non-E SoCs
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Michael Walle <michael@walle.cc>
+
+[ Upstream commit f20311cc9c58052e0b215013046cbf390937910c ]
+
+On newer CAAM versions, not all accelerators are disabled if the SoC is
+a non-E variant. While the driver checks most of the modules for
+availability, there is one - PKHA - which sticks out. On non-E variants
+it is still reported as available, that is the number of instances is
+non-zero, but it has limited functionality. In particular it doesn't
+support encryption and decryption, but just signing and verifying. This
+is indicated by a bit in the PKHA_MISC field. Take this bit into account
+if we are checking for availability.
+
+This will the following error:
+[    8.167817] caam_jr 8020000.jr: 20000b0f: CCB: desc idx 11: : Invalid CHA selected.
+
+Tested on an NXP LS1028A (non-E) SoC.
+
+Fixes: d239b10d4ceb ("crypto: caam - add register map changes cf. Era 10")
+Signed-off-by: Michael Walle <michael@walle.cc>
+Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/crypto/caam/caampkc.c | 19 +++++++++++++++----
+ drivers/crypto/caam/regs.h    |  3 +++
+ 2 files changed, 18 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/crypto/caam/caampkc.c b/drivers/crypto/caam/caampkc.c
+index 83f96d4f86e03..30e3f41ed8721 100644
+--- a/drivers/crypto/caam/caampkc.c
++++ b/drivers/crypto/caam/caampkc.c
+@@ -1087,16 +1087,27 @@ static struct caam_akcipher_alg caam_rsa = {
+ int caam_pkc_init(struct device *ctrldev)
+ {
+       struct caam_drv_private *priv = dev_get_drvdata(ctrldev);
+-      u32 pk_inst;
++      u32 pk_inst, pkha;
+       int err;
+       init_done = false;
+       /* Determine public key hardware accelerator presence. */
+-      if (priv->era < 10)
++      if (priv->era < 10) {
+               pk_inst = (rd_reg32(&priv->ctrl->perfmon.cha_num_ls) &
+                          CHA_ID_LS_PK_MASK) >> CHA_ID_LS_PK_SHIFT;
+-      else
+-              pk_inst = rd_reg32(&priv->ctrl->vreg.pkha) & CHA_VER_NUM_MASK;
++      } else {
++              pkha = rd_reg32(&priv->ctrl->vreg.pkha);
++              pk_inst = pkha & CHA_VER_NUM_MASK;
++
++              /*
++               * Newer CAAMs support partially disabled functionality. If this is the
++               * case, the number is non-zero, but this bit is set to indicate that
++               * no encryption or decryption is supported. Only signing and verifying
++               * is supported.
++               */
++              if (pkha & CHA_VER_MISC_PKHA_NO_CRYPT)
++                      pk_inst = 0;
++      }
+       /* Do not register algorithms if PKHA is not present. */
+       if (!pk_inst)
+diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h
+index 05127b70527d7..43975f01465d2 100644
+--- a/drivers/crypto/caam/regs.h
++++ b/drivers/crypto/caam/regs.h
+@@ -317,6 +317,9 @@ struct version_regs {
+ /* CHA Miscellaneous Information - AESA_MISC specific */
+ #define CHA_VER_MISC_AES_GCM  BIT(1 + CHA_VER_MISC_SHIFT)
++/* CHA Miscellaneous Information - PKHA_MISC specific */
++#define CHA_VER_MISC_PKHA_NO_CRYPT    BIT(7 + CHA_VER_MISC_SHIFT)
++
+ /*
+  * caam_perfmon - Performance Monitor/Secure Memory Status/
+  *                CAAM Global Status/Component Version IDs
+-- 
+2.33.0
+
diff --git a/queue-5.4/crypto-ecc-fix-crypto_default_rng-dependency.patch b/queue-5.4/crypto-ecc-fix-crypto_default_rng-dependency.patch
new file mode 100644 (file)
index 0000000..04f944f
--- /dev/null
@@ -0,0 +1,50 @@
+From 5755adfd7f479efb67eeb663ae4543f26d11238a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 20 Sep 2021 12:05:35 +0200
+Subject: crypto: ecc - fix CRYPTO_DEFAULT_RNG dependency
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit 38aa192a05f22f9778f9420e630f0322525ef12e ]
+
+The ecc.c file started out as part of the ECDH algorithm but got
+moved out into a standalone module later. It does not build without
+CRYPTO_DEFAULT_RNG, so now that other modules are using it as well we
+can run into this link error:
+
+aarch64-linux-ld: ecc.c:(.text+0xfc8): undefined reference to `crypto_default_rng'
+aarch64-linux-ld: ecc.c:(.text+0xff4): undefined reference to `crypto_put_default_rng'
+
+Move the 'select CRYPTO_DEFAULT_RNG' statement into the correct symbol.
+
+Fixes: 0d7a78643f69 ("crypto: ecrdsa - add EC-RDSA (GOST 34.10) algorithm")
+Fixes: 4e6602916bc6 ("crypto: ecdsa - Add support for ECDSA signature verification")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ crypto/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/crypto/Kconfig b/crypto/Kconfig
+index b2cc0ad3792ad..ce60ec30e78df 100644
+--- a/crypto/Kconfig
++++ b/crypto/Kconfig
+@@ -242,12 +242,12 @@ config CRYPTO_DH
+ config CRYPTO_ECC
+       tristate
++      select CRYPTO_RNG_DEFAULT
+ config CRYPTO_ECDH
+       tristate "ECDH algorithm"
+       select CRYPTO_ECC
+       select CRYPTO_KPP
+-      select CRYPTO_RNG_DEFAULT
+       help
+         Generic implementation of the ECDH algorithm
+-- 
+2.33.0
+
diff --git a/queue-5.4/crypto-pcrypt-delay-write-to-padata-info.patch b/queue-5.4/crypto-pcrypt-delay-write-to-padata-info.patch
new file mode 100644 (file)
index 0000000..a4aeb5d
--- /dev/null
@@ -0,0 +1,85 @@
+From f6fdfe0438535eb66a232986a47dc3ee41e6dbf3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 21 Oct 2021 14:30:28 -0400
+Subject: crypto: pcrypt - Delay write to padata->info
+
+From: Daniel Jordan <daniel.m.jordan@oracle.com>
+
+[ Upstream commit 68b6dea802cea0dbdd8bd7ccc60716b5a32a5d8a ]
+
+These three events can race when pcrypt is used multiple times in a
+template ("pcrypt(pcrypt(...))"):
+
+  1.  [taskA] The caller makes the crypto request via crypto_aead_encrypt()
+  2.  [kworkerB] padata serializes the inner pcrypt request
+  3.  [kworkerC] padata serializes the outer pcrypt request
+
+3 might finish before the call to crypto_aead_encrypt() returns in 1,
+resulting in two possible issues.
+
+First, a use-after-free of the crypto request's memory when, for
+example, taskA writes to the outer pcrypt request's padata->info in
+pcrypt_aead_enc() after kworkerC completes the request.
+
+Second, the outer pcrypt request overwrites the inner pcrypt request's
+return code with -EINPROGRESS, making a successful request appear to
+fail.  For instance, kworkerB writes the outer pcrypt request's
+padata->info in pcrypt_aead_done() and then taskA overwrites it
+in pcrypt_aead_enc().
+
+Avoid both situations by delaying the write of padata->info until after
+the inner crypto request's return code is checked.  This prevents the
+use-after-free by not touching the crypto request's memory after the
+next-inner crypto request is made, and stops padata->info from being
+overwritten.
+
+Fixes: 5068c7a883d16 ("crypto: pcrypt - Add pcrypt crypto parallelization wrapper")
+Reported-by: syzbot+b187b77c8474f9648fae@syzkaller.appspotmail.com
+Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ crypto/pcrypt.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
+index a4f3b3f342c8d..276d2fd9e911c 100644
+--- a/crypto/pcrypt.c
++++ b/crypto/pcrypt.c
+@@ -79,12 +79,14 @@ static void pcrypt_aead_enc(struct padata_priv *padata)
+ {
+       struct pcrypt_request *preq = pcrypt_padata_request(padata);
+       struct aead_request *req = pcrypt_request_ctx(preq);
++      int ret;
+-      padata->info = crypto_aead_encrypt(req);
++      ret = crypto_aead_encrypt(req);
+-      if (padata->info == -EINPROGRESS)
++      if (ret == -EINPROGRESS)
+               return;
++      padata->info = ret;
+       padata_do_serial(padata);
+ }
+@@ -124,12 +126,14 @@ static void pcrypt_aead_dec(struct padata_priv *padata)
+ {
+       struct pcrypt_request *preq = pcrypt_padata_request(padata);
+       struct aead_request *req = pcrypt_request_ctx(preq);
++      int ret;
+-      padata->info = crypto_aead_decrypt(req);
++      ret = crypto_aead_decrypt(req);
+-      if (padata->info == -EINPROGRESS)
++      if (ret == -EINPROGRESS)
+               return;
++      padata->info = ret;
+       padata_do_serial(padata);
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/crypto-qat-detect-pfvf-collision-after-ack.patch b/queue-5.4/crypto-qat-detect-pfvf-collision-after-ack.patch
new file mode 100644 (file)
index 0000000..6034fbf
--- /dev/null
@@ -0,0 +1,46 @@
+From ef4f14ad557ab6b0329c8a9e75b704e216bdc8f6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 28 Sep 2021 12:44:29 +0100
+Subject: crypto: qat - detect PFVF collision after ACK
+
+From: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
+
+[ Upstream commit 9b768e8a3909ac1ab39ed44a3933716da7761a6f ]
+
+Detect a PFVF collision between the local and the remote function by
+checking if the message on the PFVF CSR has been overwritten.
+This is done after the remote function confirms that the message has
+been received, by clearing the interrupt bit, or the maximum number of
+attempts (ADF_IOV_MSG_ACK_MAX_RETRY) to check the CSR has been exceeded.
+
+Fixes: ed8ccaef52fa ("crypto: qat - Add support for SRIOV")
+Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
+Co-developed-by: Marco Chiappero <marco.chiappero@intel.com>
+Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
+index c64481160b711..72fd2bbbe704e 100644
+--- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
++++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
+@@ -195,6 +195,13 @@ static int __adf_iov_putmsg(struct adf_accel_dev *accel_dev, u32 msg, u8 vf_nr)
+               val = ADF_CSR_RD(pmisc_bar_addr, pf2vf_offset);
+       } while ((val & int_bit) && (count++ < ADF_IOV_MSG_ACK_MAX_RETRY));
++      if (val != msg) {
++              dev_dbg(&GET_DEV(accel_dev),
++                      "Collision - PFVF CSR overwritten by remote function\n");
++              ret = -EIO;
++              goto out;
++      }
++
+       if (val & int_bit) {
+               dev_dbg(&GET_DEV(accel_dev), "ACK not received from remote\n");
+               val &= ~int_bit;
+-- 
+2.33.0
+
diff --git a/queue-5.4/crypto-qat-disregard-spurious-pfvf-interrupts.patch b/queue-5.4/crypto-qat-disregard-spurious-pfvf-interrupts.patch
new file mode 100644 (file)
index 0000000..b5972d8
--- /dev/null
@@ -0,0 +1,75 @@
+From 6a46c9e495c449ff5a35bcfab2f929e81c5d6681 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 28 Sep 2021 12:44:30 +0100
+Subject: crypto: qat - disregard spurious PFVF interrupts
+
+From: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
+
+[ Upstream commit 18fcba469ba5359c1de7e3fb16f7b9e8cd1b8e02 ]
+
+Upon receiving a PFVF message, check if the interrupt bit is set in the
+message. If it is not, that means that the interrupt was probably
+triggered by a collision. In this case, disregard the message and
+re-enable the interrupts.
+
+Fixes: ed8ccaef52fa ("crypto: qat - Add support for SRIOV")
+Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
+Reviewed-by: Marco Chiappero <marco.chiappero@intel.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 6 ++++++
+ drivers/crypto/qat/qat_common/adf_vf_isr.c    | 6 ++++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
+index 72fd2bbbe704e..180016e157771 100644
+--- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
++++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
+@@ -250,6 +250,11 @@ void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info)
+       /* Read message from the VF */
+       msg = ADF_CSR_RD(pmisc_addr, hw_data->get_pf2vf_offset(vf_nr));
++      if (!(msg & ADF_VF2PF_INT)) {
++              dev_info(&GET_DEV(accel_dev),
++                       "Spurious VF2PF interrupt, msg %X. Ignored\n", msg);
++              goto out;
++      }
+       /* To ACK, clear the VF2PFINT bit */
+       msg &= ~ADF_VF2PF_INT;
+@@ -333,6 +338,7 @@ void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info)
+       if (resp && adf_iov_putmsg(accel_dev, resp, vf_nr))
+               dev_err(&GET_DEV(accel_dev), "Failed to send response to VF\n");
++out:
+       /* re-enable interrupt on PF from this VF */
+       adf_enable_vf2pf_interrupts(accel_dev, (1 << vf_nr));
+       return;
+diff --git a/drivers/crypto/qat/qat_common/adf_vf_isr.c b/drivers/crypto/qat/qat_common/adf_vf_isr.c
+index ef90902c8200d..86274e3c6781d 100644
+--- a/drivers/crypto/qat/qat_common/adf_vf_isr.c
++++ b/drivers/crypto/qat/qat_common/adf_vf_isr.c
+@@ -123,6 +123,11 @@ static void adf_pf2vf_bh_handler(void *data)
+       /* Read the message from PF */
+       msg = ADF_CSR_RD(pmisc_bar_addr, hw_data->get_pf2vf_offset(0));
++      if (!(msg & ADF_PF2VF_INT)) {
++              dev_info(&GET_DEV(accel_dev),
++                       "Spurious PF2VF interrupt, msg %X. Ignored\n", msg);
++              goto out;
++      }
+       if (!(msg & ADF_PF2VF_MSGORIGIN_SYSTEM))
+               /* Ignore legacy non-system (non-kernel) PF2VF messages */
+@@ -171,6 +176,7 @@ static void adf_pf2vf_bh_handler(void *data)
+       msg &= ~ADF_PF2VF_INT;
+       ADF_CSR_WR(pmisc_bar_addr, hw_data->get_pf2vf_offset(0), msg);
++out:
+       /* Re-enable PF2VF interrupts */
+       adf_enable_pf2vf_interrupts(accel_dev);
+       return;
+-- 
+2.33.0
+
diff --git a/queue-5.4/cxgb4-fix-eeprom-len-when-diagnostics-not-implemente.patch b/queue-5.4/cxgb4-fix-eeprom-len-when-diagnostics-not-implemente.patch
new file mode 100644 (file)
index 0000000..65de1ac
--- /dev/null
@@ -0,0 +1,61 @@
+From 66134c8d121efe732c07e9983cbd014437365d63 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 11 Nov 2021 15:55:16 +0530
+Subject: cxgb4: fix eeprom len when diagnostics not implemented
+
+From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
+
+[ Upstream commit 4ca110bf8d9b31a60f8f8ff6706ea147d38ad97c ]
+
+Ensure diagnostics monitoring support is implemented for the SFF 8472
+compliant port module and set the correct length for ethtool port
+module eeprom read.
+
+Fixes: f56ec6766dcf ("cxgb4: Add support for ethtool i2c dump")
+Signed-off-by: Manoj Malviya <manojmalviya@chelsio.com>
+Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 7 +++++--
+ drivers/net/ethernet/chelsio/cxgb4/t4_hw.h         | 2 ++
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
+index f537be9cb3155..5ba30b8eb1e11 100644
+--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
+@@ -1466,12 +1466,15 @@ static int cxgb4_get_module_info(struct net_device *dev,
+               if (ret)
+                       return ret;
+-              if (!sff8472_comp || (sff_diag_type & 4)) {
++              if (!sff8472_comp || (sff_diag_type & SFP_DIAG_ADDRMODE)) {
+                       modinfo->type = ETH_MODULE_SFF_8079;
+                       modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN;
+               } else {
+                       modinfo->type = ETH_MODULE_SFF_8472;
+-                      modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
++                      if (sff_diag_type & SFP_DIAG_IMPLEMENTED)
++                              modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
++                      else
++                              modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN / 2;
+               }
+               break;
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.h b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.h
+index 002fc62ea7262..63bc956d20376 100644
+--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.h
++++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.h
+@@ -293,6 +293,8 @@ enum {
+ #define I2C_PAGE_SIZE         0x100
+ #define SFP_DIAG_TYPE_ADDR    0x5c
+ #define SFP_DIAG_TYPE_LEN     0x1
++#define SFP_DIAG_ADDRMODE     BIT(2)
++#define SFP_DIAG_IMPLEMENTED  BIT(6)
+ #define SFF_8472_COMP_ADDR    0x5e
+ #define SFF_8472_COMP_LEN     0x1
+ #define SFF_REV_ADDR          0x1
+-- 
+2.33.0
+
diff --git a/queue-5.4/dma-buf-warn-on-dmabuf-release-with-pending-attachme.patch b/queue-5.4/dma-buf-warn-on-dmabuf-release-with-pending-attachme.patch
new file mode 100644 (file)
index 0000000..894c84e
--- /dev/null
@@ -0,0 +1,56 @@
+From 36226f6738ce3313a9956b16db332be106a28017 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 23 Jul 2021 18:01:08 +0530
+Subject: dma-buf: WARN on dmabuf release with pending attachments
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Charan Teja Reddy <charante@codeaurora.org>
+
+[ Upstream commit f492283b157053e9555787262f058ae33096f568 ]
+
+It is expected from the clients to follow the below steps on an imported
+dmabuf fd:
+a) dmabuf = dma_buf_get(fd) // Get the dmabuf from fd
+b) dma_buf_attach(dmabuf); // Clients attach to the dmabuf
+   o Here the kernel does some slab allocations, say for
+dma_buf_attachment and may be some other slab allocation in the
+dmabuf->ops->attach().
+c) Client may need to do dma_buf_map_attachment().
+d) Accordingly dma_buf_unmap_attachment() should be called.
+e) dma_buf_detach () // Clients detach to the dmabuf.
+   o Here the slab allocations made in b) are freed.
+f) dma_buf_put(dmabuf) // Can free the dmabuf if it is the last
+reference.
+
+Now say an erroneous client failed at step c) above thus it directly
+called dma_buf_put(), step f) above. Considering that it may be the last
+reference to the dmabuf, buffer will be freed with pending attachments
+left to the dmabuf which can show up as the 'memory leak'. This should
+at least be reported as the WARN().
+
+Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
+Reviewed-by: Christian König <christian.koenig@amd.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/1627043468-16381-1-git-send-email-charante@codeaurora.org
+Signed-off-by: Christian König <christian.koenig@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/dma-buf/dma-buf.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
+index 758de0e9b2ddc..16bbc9bc9e6d1 100644
+--- a/drivers/dma-buf/dma-buf.c
++++ b/drivers/dma-buf/dma-buf.c
+@@ -79,6 +79,7 @@ static void dma_buf_release(struct dentry *dentry)
+       if (dmabuf->resv == (struct dma_resv *)&dmabuf[1])
+               dma_resv_fini(dmabuf->resv);
++      WARN_ON(!list_empty(&dmabuf->attachments));
+       module_put(dmabuf->owner);
+       kfree(dmabuf->name);
+       kfree(dmabuf);
+-- 
+2.33.0
+
diff --git a/queue-5.4/dmaengine-at_xdmac-fix-at_xdmac_cc_perid-macro.patch b/queue-5.4/dmaengine-at_xdmac-fix-at_xdmac_cc_perid-macro.patch
new file mode 100644 (file)
index 0000000..c95222a
--- /dev/null
@@ -0,0 +1,41 @@
+From 6c6381ff4d66d31c9c5fc1a64bb30a35fc7913cd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 7 Oct 2021 14:12:28 +0300
+Subject: dmaengine: at_xdmac: fix AT_XDMAC_CC_PERID() macro
+
+From: Claudiu Beznea <claudiu.beznea@microchip.com>
+
+[ Upstream commit 320c88a3104dc955f928a1eecebd551ff89530c0 ]
+
+AT_XDMAC_CC_PERID() should be used to setup bits 24..30 of XDMAC_CC
+register. Using it without parenthesis around 0x7f & (i) will lead to
+setting all the time zero for bits 24..30 of XDMAC_CC as the << operator
+has higher precedence over bitwise &. Thus, add paranthesis around
+0x7f & (i).
+
+Fixes: 15a03850ab8f ("dmaengine: at_xdmac: fix macro typo")
+Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
+Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com>
+Link: https://lore.kernel.org/r/20211007111230.2331837-3-claudiu.beznea@microchip.com
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/dma/at_xdmac.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
+index b58ac720d9a12..6f1e97ba3e786 100644
+--- a/drivers/dma/at_xdmac.c
++++ b/drivers/dma/at_xdmac.c
+@@ -145,7 +145,7 @@
+ #define               AT_XDMAC_CC_WRIP        (0x1 << 23)     /* Write in Progress (read only) */
+ #define                       AT_XDMAC_CC_WRIP_DONE           (0x0 << 23)
+ #define                       AT_XDMAC_CC_WRIP_IN_PROGRESS    (0x1 << 23)
+-#define               AT_XDMAC_CC_PERID(i)    (0x7f & (i) << 24)      /* Channel Peripheral Identifier */
++#define               AT_XDMAC_CC_PERID(i)    ((0x7f & (i)) << 24)    /* Channel Peripheral Identifier */
+ #define AT_XDMAC_CDS_MSP      0x2C    /* Channel Data Stride Memory Set Pattern */
+ #define AT_XDMAC_CSUS         0x30    /* Channel Source Microblock Stride */
+ #define AT_XDMAC_CDUS         0x34    /* Channel Destination Microblock Stride */
+-- 
+2.33.0
+
diff --git a/queue-5.4/dmaengine-dmaengine_desc_callback_valid-check-for-ca.patch b/queue-5.4/dmaengine-dmaengine_desc_callback_valid-check-for-ca.patch
new file mode 100644 (file)
index 0000000..54636b5
--- /dev/null
@@ -0,0 +1,64 @@
+From a5dea05f758bf091d009d3d317250cf7ee3f66f1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 23 Oct 2021 15:41:01 +0200
+Subject: dmaengine: dmaengine_desc_callback_valid(): Check for
+ `callback_result`
+
+From: Lars-Peter Clausen <lars@metafoo.de>
+
+[ Upstream commit e7e1e880b114ca640a2f280b0d5d38aed98f98c6 ]
+
+Before the `callback_result` callback was introduced drivers coded their
+invocation to the callback in a similar way to:
+
+       if (cb->callback) {
+               spin_unlock(&dma->lock);
+               cb->callback(cb->callback_param);
+               spin_lock(&dma->lock);
+       }
+
+With the introduction of `callback_result` two helpers where introduced to
+transparently handle both types of callbacks. And drivers where updated to
+look like this:
+
+       if (dmaengine_desc_callback_valid(cb)) {
+               spin_unlock(&dma->lock);
+               dmaengine_desc_callback_invoke(cb, ...);
+               spin_lock(&dma->lock);
+       }
+
+dmaengine_desc_callback_invoke() correctly handles both `callback_result`
+and `callback`. But we forgot to update the dmaengine_desc_callback_valid()
+function to check for `callback_result`. As a result DMA descriptors that
+use the `callback_result` rather than `callback` don't have their callback
+invoked by drivers that follow the pattern above.
+
+Fix this by checking for both `callback` and `callback_result` in
+dmaengine_desc_callback_valid().
+
+Fixes: f067025bc676 ("dmaengine: add support to provide error result from a DMA transation")
+Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
+Acked-by: Dave Jiang <dave.jiang@intel.com>
+Link: https://lore.kernel.org/r/20211023134101.28042-1-lars@metafoo.de
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/dma/dmaengine.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/dma/dmaengine.h b/drivers/dma/dmaengine.h
+index 501c0b063f852..302f13efd35d9 100644
+--- a/drivers/dma/dmaengine.h
++++ b/drivers/dma/dmaengine.h
+@@ -168,7 +168,7 @@ dmaengine_desc_get_callback_invoke(struct dma_async_tx_descriptor *tx,
+ static inline bool
+ dmaengine_desc_callback_valid(struct dmaengine_desc_callback *cb)
+ {
+-      return (cb->callback) ? true : false;
++      return cb->callback || cb->callback_result;
+ }
+ #endif
+-- 
+2.33.0
+
diff --git a/queue-5.4/drm-amdgpu-fix-warning-for-overflow-check.patch b/queue-5.4/drm-amdgpu-fix-warning-for-overflow-check.patch
new file mode 100644 (file)
index 0000000..6944737
--- /dev/null
@@ -0,0 +1,62 @@
+From b20b9ca45c6f93955df3c91c724b54641a7ac4b3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 27 Sep 2021 14:58:10 +0200
+Subject: drm/amdgpu: fix warning for overflow check
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit 335aea75b0d95518951cad7c4c676e6f1c02c150 ]
+
+The overflow check in amdgpu_bo_list_create() causes a warning with
+clang-14 on 64-bit architectures, since the limit can never be
+exceeded.
+
+drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c:74:18: error: result of comparison of constant 256204778801521549 with expression of type 'unsigned int' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
+        if (num_entries > (SIZE_MAX - sizeof(struct amdgpu_bo_list))
+            ~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The check remains useful for 32-bit architectures, so just avoid the
+warning by using size_t as the type for the count.
+
+Fixes: 920990cb080a ("drm/amdgpu: allocate the bo_list array after the list")
+Reviewed-by: Christian König <christian.koenig@amd.com>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 2 +-
+ drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
+index 85b0515c0fdcf..e0d2f79571ef5 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
+@@ -61,7 +61,7 @@ static void amdgpu_bo_list_free(struct kref *ref)
+ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp,
+                         struct drm_amdgpu_bo_list_entry *info,
+-                        unsigned num_entries, struct amdgpu_bo_list **result)
++                        size_t num_entries, struct amdgpu_bo_list **result)
+ {
+       unsigned last_entry = 0, first_userptr = num_entries;
+       struct amdgpu_bo_list_entry *array;
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h
+index a130e766cbdbe..529d52a204cf4 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h
+@@ -60,7 +60,7 @@ int amdgpu_bo_create_list_entry_array(struct drm_amdgpu_bo_list_in *in,
+ int amdgpu_bo_list_create(struct amdgpu_device *adev,
+                                struct drm_file *filp,
+                                struct drm_amdgpu_bo_list_entry *info,
+-                               unsigned num_entries,
++                               size_t num_entries,
+                                struct amdgpu_bo_list **list);
+ static inline struct amdgpu_bo_list_entry *
+-- 
+2.33.0
+
diff --git a/queue-5.4/drm-amdgpu-gmc6-fix-dma-mask-from-44-to-40-bits.patch b/queue-5.4/drm-amdgpu-gmc6-fix-dma-mask-from-44-to-40-bits.patch
new file mode 100644 (file)
index 0000000..ecc1ad0
--- /dev/null
@@ -0,0 +1,47 @@
+From 9d5cbffd8c19965493f494e6b2622c1855e34831 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Oct 2021 13:26:19 -0400
+Subject: drm/amdgpu/gmc6: fix DMA mask from 44 to 40 bits
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Alex Deucher <alexander.deucher@amd.com>
+
+[ Upstream commit 403475be6d8b122c3e6b8a47e075926d7299e5ef ]
+
+The DMA mask on SI parts is 40 bits not 44.  Copy
+paste typo.
+
+Fixes: 244511f386ccb9 ("drm/amdgpu: simplify and cleanup setting the dma mask")
+Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1762
+Acked-by: Christian König <christian.koenig@amd.com>
+Tested-by: Paul Menzel <pmenzel@molgen.mpg.de>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
+index 9fb1765e92d15..e9f5de35f7953 100644
+--- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
++++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
+@@ -863,12 +863,12 @@ static int gmc_v6_0_sw_init(void *handle)
+       adev->gmc.mc_mask = 0xffffffffffULL;
+-      r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(44));
++      r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(40));
+       if (r) {
+               dev_warn(adev->dev, "amdgpu: No suitable DMA available.\n");
+               return r;
+       }
+-      adev->need_swiotlb = drm_need_swiotlb(44);
++      adev->need_swiotlb = drm_need_swiotlb(40);
+       r = gmc_v6_0_init_microcode(adev);
+       if (r) {
+-- 
+2.33.0
+
diff --git a/queue-5.4/drm-msm-fix-potential-null-dereference-in-dpu-sspp.patch b/queue-5.4/drm-msm-fix-potential-null-dereference-in-dpu-sspp.patch
new file mode 100644 (file)
index 0000000..fe449ce
--- /dev/null
@@ -0,0 +1,54 @@
+From bfeb74ce60f89c65a174f7d121ee8fc9d3eed77f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Oct 2021 10:57:33 -0700
+Subject: drm/msm: Fix potential NULL dereference in DPU SSPP
+
+From: Jessica Zhang <jesszhan@codeaurora.org>
+
+[ Upstream commit 8bf71a5719b6cc5b6ba358096081e5d50ea23ab6 ]
+
+Move initialization of sblk in _sspp_subblk_offset() after NULL check to
+avoid potential NULL pointer dereference.
+
+Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
+Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
+Signed-off-by: Jessica Zhang <jesszhan@codeaurora.org>
+Link: https://lore.kernel.org/r/20211020175733.3379-1-jesszhan@codeaurora.org
+Signed-off-by: Rob Clark <robdclark@chromium.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
+index 4f8b813aab810..8256f06218d0f 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
+@@ -137,11 +137,13 @@ static int _sspp_subblk_offset(struct dpu_hw_pipe *ctx,
+               u32 *idx)
+ {
+       int rc = 0;
+-      const struct dpu_sspp_sub_blks *sblk = ctx->cap->sblk;
++      const struct dpu_sspp_sub_blks *sblk;
+-      if (!ctx)
++      if (!ctx || !ctx->cap || !ctx->cap->sblk)
+               return -EINVAL;
++      sblk = ctx->cap->sblk;
++
+       switch (s_id) {
+       case DPU_SSPP_SRC:
+               *idx = sblk->src_blk.base;
+@@ -404,7 +406,7 @@ static void _dpu_hw_sspp_setup_scaler3(struct dpu_hw_pipe *ctx,
+       (void)pe;
+       if (_sspp_subblk_offset(ctx, DPU_SSPP_SCALER_QSEED3, &idx) || !sspp
+-              || !scaler3_cfg || !ctx || !ctx->cap || !ctx->cap->sblk)
++              || !scaler3_cfg)
+               return;
+       dpu_hw_setup_scaler3(&ctx->hw, scaler3_cfg, idx,
+-- 
+2.33.0
+
diff --git a/queue-5.4/drm-msm-uninitialized-variable-in-msm_gem_import.patch b/queue-5.4/drm-msm-uninitialized-variable-in-msm_gem_import.patch
new file mode 100644 (file)
index 0000000..df5190a
--- /dev/null
@@ -0,0 +1,52 @@
+From 0747eaf907a7057aac406e93e01dd75c4b2500f9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 13 Oct 2021 11:13:15 +0300
+Subject: drm/msm: uninitialized variable in msm_gem_import()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit 2203bd0e5c12ffc53ffdd4fbd7b12d6ba27e0424 ]
+
+The msm_gem_new_impl() function cleans up after itself so there is no
+need to call drm_gem_object_put().  Conceptually, it does not make sense
+to call a kref_put() function until after the reference counting has
+been initialized which happens immediately after this call in the
+drm_gem_(private_)object_init() functions.
+
+In the msm_gem_import() function the "obj" pointer is uninitialized, so
+it will lead to a crash.
+
+Fixes: 05b849111c07 ("drm/msm: prime support")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Link: https://lore.kernel.org/r/20211013081315.GG6010@kili
+Signed-off-by: Rob Clark <robdclark@chromium.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/msm/msm_gem.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
+index d92a0ffe2a767..8e6a4d5f3a405 100644
+--- a/drivers/gpu/drm/msm/msm_gem.c
++++ b/drivers/gpu/drm/msm/msm_gem.c
+@@ -1036,7 +1036,7 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev,
+       ret = msm_gem_new_impl(dev, size, flags, &obj);
+       if (ret)
+-              goto fail;
++              return ERR_PTR(ret);
+       msm_obj = to_msm_bo(obj);
+@@ -1124,7 +1124,7 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev,
+       ret = msm_gem_new_impl(dev, size, MSM_BO_WC, &obj);
+       if (ret)
+-              goto fail;
++              return ERR_PTR(ret);
+       drm_gem_private_object_init(dev, obj, size);
+-- 
+2.33.0
+
diff --git a/queue-5.4/drm-panel-orientation-quirks-add-quirk-for-kd-kurio-.patch b/queue-5.4/drm-panel-orientation-quirks-add-quirk-for-kd-kurio-.patch
new file mode 100644 (file)
index 0000000..2647f40
--- /dev/null
@@ -0,0 +1,42 @@
+From fea5fb503e387161a75d04110e164a199b6cafd3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 30 May 2021 13:04:26 +0200
+Subject: drm: panel-orientation-quirks: Add quirk for KD Kurio Smart C15200
+ 2-in-1
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+[ Upstream commit a53f1dd3ab9fec715c6c2e8e01bf4d3c07eef8e5 ]
+
+The KD Kurio Smart C15200 2-in-1 uses  a panel which has been mounted 90
+degrees rotated. Add a quirk for this.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Acked-by: Simon Ser <contact@emersion.fr>
+Link: https://patchwork.freedesktop.org/patch/msgid/20210530110428.12994-3-hdegoede@redhat.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/drm_panel_orientation_quirks.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c
+index 5d0942e3985b2..cf4db2cdebbbd 100644
+--- a/drivers/gpu/drm/drm_panel_orientation_quirks.c
++++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c
+@@ -205,6 +205,13 @@ static const struct dmi_system_id orientation_data[] = {
+                 DMI_EXACT_MATCH(DMI_BOARD_NAME, "TW891"),
+               },
+               .driver_data = (void *)&itworks_tw891,
++      }, {    /* KD Kurio Smart C15200 2-in-1 */
++              .matches = {
++                DMI_EXACT_MATCH(DMI_SYS_VENDOR, "KD Interactive"),
++                DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Kurio Smart"),
++                DMI_EXACT_MATCH(DMI_BOARD_NAME, "KDM960BCP"),
++              },
++              .driver_data = (void *)&lcd800x1280_rightside_up,
+       }, {    /*
+                * Lenovo Ideapad Miix 310 laptop, only some production batches
+                * have a portrait screen, the resolution checks makes the quirk
+-- 
+2.33.0
+
diff --git a/queue-5.4/drm-panel-orientation-quirks-add-quirk-for-the-samsu.patch b/queue-5.4/drm-panel-orientation-quirks-add-quirk-for-the-samsu.patch
new file mode 100644 (file)
index 0000000..4740c85
--- /dev/null
@@ -0,0 +1,54 @@
+From 473ad870bffbee328862e19e0f46b32e92a0deee Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 30 May 2021 13:04:27 +0200
+Subject: drm: panel-orientation-quirks: Add quirk for the Samsung Galaxy Book
+ 10.6
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+[ Upstream commit 88fa1fde918951c175ae5ea0f31efc4bb1736ab9 ]
+
+The Samsung Galaxy Book 10.6 uses a panel which has been mounted
+90 degrees rotated. Add a quirk for this.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Acked-by: Simon Ser <contact@emersion.fr>
+Link: https://patchwork.freedesktop.org/patch/msgid/20210530110428.12994-4-hdegoede@redhat.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/drm_panel_orientation_quirks.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c
+index cf4db2cdebbbd..926094b83e2f4 100644
+--- a/drivers/gpu/drm/drm_panel_orientation_quirks.c
++++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c
+@@ -109,6 +109,12 @@ static const struct drm_dmi_panel_orientation_data lcd1200x1920_rightside_up = {
+       .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
+ };
++static const struct drm_dmi_panel_orientation_data lcd1280x1920_rightside_up = {
++      .width = 1280,
++      .height = 1920,
++      .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
++};
++
+ static const struct dmi_system_id orientation_data[] = {
+       {       /* Acer One 10 (S1003) */
+               .matches = {
+@@ -249,6 +255,12 @@ static const struct dmi_system_id orientation_data[] = {
+                 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Default string"),
+               },
+               .driver_data = (void *)&onegx1_pro,
++      }, {    /* Samsung GalaxyBook 10.6 */
++              .matches = {
++                DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
++                DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Galaxy Book 10.6"),
++              },
++              .driver_data = (void *)&lcd1280x1920_rightside_up,
+       }, {    /* VIOS LTH17 */
+               .matches = {
+                 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VIOS"),
+-- 
+2.33.0
+
diff --git a/queue-5.4/drm-panel-orientation-quirks-add-valve-steam-deck.patch b/queue-5.4/drm-panel-orientation-quirks-add-valve-steam-deck.patch
new file mode 100644 (file)
index 0000000..68db706
--- /dev/null
@@ -0,0 +1,46 @@
+From fe8368175670aa71e98b387a5fe1c92c7a9cad46 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 11 Sep 2021 10:24:40 +0000
+Subject: drm/panel-orientation-quirks: add Valve Steam Deck
+
+From: Simon Ser <contact@emersion.fr>
+
+[ Upstream commit 9eeb7b4e40bfd69d8aaa920c7e9df751c9e11dce ]
+
+Valve's Steam Deck has a 800x1280 LCD screen.
+
+Signed-off-by: Simon Ser <contact@emersion.fr>
+Cc: Jared Baldridge <jrb@expunge.us>
+Cc: Emil Velikov <emil.l.velikov@gmail.com>
+Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
+Cc: Hans de Goede <hdegoede@redhat.com>
+Acked-by: Sam Ravnborg <sam@ravnborg.org>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20210911102430.253986-1-contact@emersion.fr
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/drm_panel_orientation_quirks.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c
+index 926094b83e2f4..a950d5db211c5 100644
+--- a/drivers/gpu/drm/drm_panel_orientation_quirks.c
++++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c
+@@ -261,6 +261,13 @@ static const struct dmi_system_id orientation_data[] = {
+                 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Galaxy Book 10.6"),
+               },
+               .driver_data = (void *)&lcd1280x1920_rightside_up,
++      }, {    /* Valve Steam Deck */
++              .matches = {
++                DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Valve"),
++                DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Jupiter"),
++                DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "1"),
++              },
++              .driver_data = (void *)&lcd800x1280_rightside_up,
+       }, {    /* VIOS LTH17 */
+               .matches = {
+                 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VIOS"),
+-- 
+2.33.0
+
diff --git a/queue-5.4/drm-panel-orientation-quirks-update-the-lenovo-ideap.patch b/queue-5.4/drm-panel-orientation-quirks-update-the-lenovo-ideap.patch
new file mode 100644 (file)
index 0000000..f2a1f70
--- /dev/null
@@ -0,0 +1,59 @@
+From 96fa750435c2425127a9949cb4d51b3f1f19f47f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 30 May 2021 13:04:25 +0200
+Subject: drm: panel-orientation-quirks: Update the Lenovo Ideapad D330 quirk
+ (v2)
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+[ Upstream commit 820a2ab23d5eab4ccfb82581eda8ad4acf18458f ]
+
+2 improvements to the Lenovo Ideapad D330 panel-orientation quirks:
+
+1. Some versions of the Lenovo Ideapad D330 have a DMI_PRODUCT_NAME of
+"81H3" and others have "81MD". Testing has shown that the "81MD" also has
+a 90 degree mounted panel. Drop the DMI_PRODUCT_NAME from the existing
+quirk so that the existing quirk matches both variants.
+
+2. Some of the Lenovo Ideapad D330 models have a HD (800x1280) screen
+instead of a FHD (1200x1920) screen (both are mounted right-side-up) add
+a second Lenovo Ideapad D330 quirk for the HD version.
+
+Changes in v2:
+- Add a new quirk for Lenovo Ideapad D330 models with a HD screen instead
+  of a FHD screen
+
+Link: https://github.com/systemd/systemd/pull/18884
+Acked-by: Simon Ser <contact@emersion.fr>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20210530110428.12994-2-hdegoede@redhat.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/drm_panel_orientation_quirks.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c
+index e1b2ce4921ae7..5d0942e3985b2 100644
+--- a/drivers/gpu/drm/drm_panel_orientation_quirks.c
++++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c
+@@ -223,10 +223,15 @@ static const struct dmi_system_id orientation_data[] = {
+                 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
+               },
+               .driver_data = (void *)&lcd800x1280_rightside_up,
+-      }, {    /* Lenovo Ideapad D330 */
++      }, {    /* Lenovo Ideapad D330-10IGM (HD) */
++              .matches = {
++                DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
++                DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"),
++              },
++              .driver_data = (void *)&lcd800x1280_rightside_up,
++      }, {    /* Lenovo Ideapad D330-10IGM (FHD) */
+               .matches = {
+                 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+-                DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "81H3"),
+                 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"),
+               },
+               .driver_data = (void *)&lcd1200x1920_rightside_up,
+-- 
+2.33.0
+
diff --git a/queue-5.4/drm-plane-helper-fix-uninitialized-variable-referenc.patch b/queue-5.4/drm-plane-helper-fix-uninitialized-variable-referenc.patch
new file mode 100644 (file)
index 0000000..738b83c
--- /dev/null
@@ -0,0 +1,46 @@
+From 34cfd7d3d0c544d60b419106cd143dac97413751 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 7 Oct 2021 02:37:06 -0400
+Subject: drm/plane-helper: fix uninitialized variable reference
+
+From: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
+
+[ Upstream commit 7be28bd73f23e53d6e7f5fe891ba9503fc0c7210 ]
+
+drivers/gpu/drm/drm_plane_helper.c: In function 'drm_primary_helper_update':
+drivers/gpu/drm/drm_plane_helper.c:113:32: error: 'visible' is used uninitialized [-Werror=uninitialized]
+  113 |         struct drm_plane_state plane_state = {
+      |                                ^~~~~~~~~~~
+drivers/gpu/drm/drm_plane_helper.c:178:14: note: 'visible' was declared here
+  178 |         bool visible;
+      |              ^~~~~~~
+cc1: all warnings being treated as errors
+
+visible is an output, not an input. in practice this use might turn out
+OK but it's still UB.
+
+Fixes: df86af9133b4 ("drm/plane-helper: Add drm_plane_helper_check_state()")
+Reviewed-by: Simon Ser <contact@emersion.fr>
+Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
+Signed-off-by: Simon Ser <contact@emersion.fr>
+Link: https://patchwork.freedesktop.org/patch/msgid/20211007063706.305984-1-alex_y_xu@yahoo.ca
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/drm_plane_helper.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
+index 3aae7ea522f23..c3f2292dc93d5 100644
+--- a/drivers/gpu/drm/drm_plane_helper.c
++++ b/drivers/gpu/drm/drm_plane_helper.c
+@@ -123,7 +123,6 @@ static int drm_plane_helper_check_update(struct drm_plane *plane,
+               .crtc_w = drm_rect_width(dst),
+               .crtc_h = drm_rect_height(dst),
+               .rotation = rotation,
+-              .visible = *visible,
+       };
+       struct drm_crtc_state crtc_state = {
+               .crtc = crtc,
+-- 
+2.33.0
+
diff --git a/queue-5.4/drm-v3d-fix-wait-for-tmu-write-combiner-flush.patch b/queue-5.4/drm-v3d-fix-wait-for-tmu-write-combiner-flush.patch
new file mode 100644 (file)
index 0000000..c8c9f55
--- /dev/null
@@ -0,0 +1,48 @@
+From 50643d491ef07c57634f90fd81710456201a4f73 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 15 Sep 2021 12:05:07 +0200
+Subject: drm/v3d: fix wait for TMU write combiner flush
+
+From: Iago Toral Quiroga <itoral@igalia.com>
+
+[ Upstream commit e4f868191138975f2fdf2f37c11318b47db4acc9 ]
+
+The hardware sets the TMUWCF bit back to 0 when the TMU write
+combiner flush completes so we should be checking for that instead
+of the L2TFLS bit.
+
+v2 (Melissa Wen):
+  - Add Signed-off-by and Fixes tags.
+  - Change the error message for the timeout to be more clear.
+
+Fixes spurious Vulkan CTS failures in:
+dEQP-VK.binding_model.descriptorset_random.*
+
+Fixes: d223f98f02099 ("drm/v3d: Add support for compute shader dispatch.")
+Signed-off-by: Iago Toral Quiroga <itoral@igalia.com>
+Reviewed-by: Melissa Wen <mwen@igalia.com>
+Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20210915100507.3945-1-itoral@igalia.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/v3d/v3d_gem.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c
+index 19c092d75266b..1609a85429cef 100644
+--- a/drivers/gpu/drm/v3d/v3d_gem.c
++++ b/drivers/gpu/drm/v3d/v3d_gem.c
+@@ -195,8 +195,8 @@ v3d_clean_caches(struct v3d_dev *v3d)
+       V3D_CORE_WRITE(core, V3D_CTL_L2TCACTL, V3D_L2TCACTL_TMUWCF);
+       if (wait_for(!(V3D_CORE_READ(core, V3D_CTL_L2TCACTL) &
+-                     V3D_L2TCACTL_L2TFLS), 100)) {
+-              DRM_ERROR("Timeout waiting for L1T write combiner flush\n");
++                     V3D_L2TCACTL_TMUWCF), 100)) {
++              DRM_ERROR("Timeout waiting for TMU write combiner flush\n");
+       }
+       mutex_lock(&v3d->cache_clean_lock);
+-- 
+2.33.0
+
diff --git a/queue-5.4/edac-amd64-handle-three-rank-interleaving-mode.patch b/queue-5.4/edac-amd64-handle-three-rank-interleaving-mode.patch
new file mode 100644 (file)
index 0000000..387a022
--- /dev/null
@@ -0,0 +1,94 @@
+From 6c38f402b6ae7c60cbeaae98788b0e160670feaf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 5 Oct 2021 15:44:19 +0000
+Subject: EDAC/amd64: Handle three rank interleaving mode
+
+From: Yazen Ghannam <yazen.ghannam@amd.com>
+
+[ Upstream commit 9f4873fb6af7966de8fcbd95c36b61351c1c4b1f ]
+
+AMD Rome systems and later support interleaving between three identical
+ranks within a channel.
+
+Check for this mode by counting the number of enabled chip selects and
+comparing their masks. If there are exactly three enabled chip selects
+and their masks are identical, then three rank interleaving is enabled.
+
+The size of a rank is determined from its mask value. However, three
+rank interleaving doesn't follow the method of swapping an interleave
+bit with the most significant bit. Rather, the interleave bit is flipped
+and the most significant bit remains the same. There is only a single
+interleave bit in this case.
+
+Account for this when determining the chip select size by keeping the
+most significant bit at its original value and ignoring any zero bits.
+This will return a full bitmask in [MSB:1].
+
+Fixes: e53a3b267fb0 ("EDAC/amd64: Find Chip Select memory size using Address Mask")
+Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Link: https://lkml.kernel.org/r/20211005154419.2060504-1-yazen.ghannam@amd.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/edac/amd64_edac.c | 22 +++++++++++++++++++++-
+ 1 file changed, 21 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
+index aed0f26c9af5d..ac4a5015c146b 100644
+--- a/drivers/edac/amd64_edac.c
++++ b/drivers/edac/amd64_edac.c
+@@ -797,12 +797,14 @@ static void debug_dump_dramcfg_low(struct amd64_pvt *pvt, u32 dclr, int chan)
+ #define CS_ODD_PRIMARY                BIT(1)
+ #define CS_EVEN_SECONDARY     BIT(2)
+ #define CS_ODD_SECONDARY      BIT(3)
++#define CS_3R_INTERLEAVE      BIT(4)
+ #define CS_EVEN                       (CS_EVEN_PRIMARY | CS_EVEN_SECONDARY)
+ #define CS_ODD                        (CS_ODD_PRIMARY | CS_ODD_SECONDARY)
+ static int f17_get_cs_mode(int dimm, u8 ctrl, struct amd64_pvt *pvt)
+ {
++      u8 base, count = 0;
+       int cs_mode = 0;
+       if (csrow_enabled(2 * dimm, ctrl, pvt))
+@@ -815,6 +817,20 @@ static int f17_get_cs_mode(int dimm, u8 ctrl, struct amd64_pvt *pvt)
+       if (csrow_sec_enabled(2 * dimm + 1, ctrl, pvt))
+               cs_mode |= CS_ODD_SECONDARY;
++      /*
++       * 3 Rank inteleaving support.
++       * There should be only three bases enabled and their two masks should
++       * be equal.
++       */
++      for_each_chip_select(base, ctrl, pvt)
++              count += csrow_enabled(base, ctrl, pvt);
++
++      if (count == 3 &&
++          pvt->csels[ctrl].csmasks[0] == pvt->csels[ctrl].csmasks[1]) {
++              edac_dbg(1, "3R interleaving in use.\n");
++              cs_mode |= CS_3R_INTERLEAVE;
++      }
++
+       return cs_mode;
+ }
+@@ -1623,10 +1639,14 @@ static int f17_addr_mask_to_cs_size(struct amd64_pvt *pvt, u8 umc,
+        *
+        * The MSB is the number of bits in the full mask because BIT[0] is
+        * always 0.
++       *
++       * In the special 3 Rank interleaving case, a single bit is flipped
++       * without swapping with the most significant bit. This can be handled
++       * by keeping the MSB where it is and ignoring the single zero bit.
+        */
+       msb = fls(addr_mask_orig) - 1;
+       weight = hweight_long(addr_mask_orig);
+-      num_zero_bits = msb - weight;
++      num_zero_bits = msb - weight - !!(cs_mode & CS_3R_INTERLEAVE);
+       /* Take the number of zero bits off from the top of the mask. */
+       addr_mask_deinterleaved = GENMASK_ULL(msb - num_zero_bits, 1);
+-- 
+2.33.0
+
diff --git a/queue-5.4/fs-orangefs-fix-error-return-code-of-orangefs_revali.patch b/queue-5.4/fs-orangefs-fix-error-return-code-of-orangefs_revali.patch
new file mode 100644 (file)
index 0000000..2967e24
--- /dev/null
@@ -0,0 +1,41 @@
+From 5aa3a7da22c3210791d0be6c7390b6c3dc5a756a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 9 Mar 2021 00:00:20 -0800
+Subject: fs: orangefs: fix error return code of orangefs_revalidate_lookup()
+
+From: Jia-Ju Bai <baijiaju1990@gmail.com>
+
+[ Upstream commit 4c2b46c824a78fc8190d8eafaaea5a9078fe7479 ]
+
+When op_alloc() returns NULL to new_op, no error return code of
+orangefs_revalidate_lookup() is assigned.
+To fix this bug, ret is assigned with -ENOMEM in this case.
+
+Fixes: 8bb8aefd5afb ("OrangeFS: Change almost all instances of the string PVFS2 to OrangeFS.")
+Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
+Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
+Signed-off-by: Mike Marshall <hubcap@omnibond.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/orangefs/dcache.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/fs/orangefs/dcache.c b/fs/orangefs/dcache.c
+index fe484cf93e5cd..8bbe9486e3a62 100644
+--- a/fs/orangefs/dcache.c
++++ b/fs/orangefs/dcache.c
+@@ -26,8 +26,10 @@ static int orangefs_revalidate_lookup(struct dentry *dentry)
+       gossip_debug(GOSSIP_DCACHE_DEBUG, "%s: attempting lookup.\n", __func__);
+       new_op = op_alloc(ORANGEFS_VFS_OP_LOOKUP);
+-      if (!new_op)
++      if (!new_op) {
++              ret = -ENOMEM;
+               goto out_put_parent;
++      }
+       new_op->upcall.req.lookup.sym_follow = ORANGEFS_LOOKUP_LINK_NO_FOLLOW;
+       new_op->upcall.req.lookup.parent_refn = parent->refn;
+-- 
+2.33.0
+
diff --git a/queue-5.4/gre-sit-don-t-generate-link-local-addr-if-addr_gen_m.patch b/queue-5.4/gre-sit-don-t-generate-link-local-addr-if-addr_gen_m.patch
new file mode 100644 (file)
index 0000000..e9f9f9b
--- /dev/null
@@ -0,0 +1,44 @@
+From 0f01827a9bfa4bb4455bf23a4c2b18a080f12838 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Oct 2021 16:06:18 -0400
+Subject: gre/sit: Don't generate link-local addr if addr_gen_mode is
+ IN6_ADDR_GEN_MODE_NONE
+
+From: Stephen Suryaputra <ssuryaextr@gmail.com>
+
+[ Upstream commit 61e18ce7348bfefb5688a8bcd4b4d6b37c0f9b2a ]
+
+When addr_gen_mode is set to IN6_ADDR_GEN_MODE_NONE, the link-local addr
+should not be generated. But it isn't the case for GRE (as well as GRE6)
+and SIT tunnels. Make it so that tunnels consider the addr_gen_mode,
+especially for IN6_ADDR_GEN_MODE_NONE.
+
+Do this in add_v4_addrs() to cover both GRE and SIT only if the addr
+scope is link.
+
+Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com>
+Acked-by: Antonio Quartulli <a@unstable.cc>
+Link: https://lore.kernel.org/r/20211020200618.467342-1-ssuryaextr@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv6/addrconf.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
+index 366c3792b8604..d1f29a3eb70be 100644
+--- a/net/ipv6/addrconf.c
++++ b/net/ipv6/addrconf.c
+@@ -3111,6 +3111,9 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
+       memcpy(&addr.s6_addr32[3], idev->dev->dev_addr, 4);
+       if (idev->dev->flags&IFF_POINTOPOINT) {
++              if (idev->cnf.addr_gen_mode == IN6_ADDR_GEN_MODE_NONE)
++                      return;
++
+               addr.s6_addr32[0] = htonl(0xfe800000);
+               scope = IFA_LINK;
+               plen = 64;
+-- 
+2.33.0
+
diff --git a/queue-5.4/hid-u2fzero-clarify-error-check-and-length-calculati.patch b/queue-5.4/hid-u2fzero-clarify-error-check-and-length-calculati.patch
new file mode 100644 (file)
index 0000000..af21f9b
--- /dev/null
@@ -0,0 +1,62 @@
+From 6e5a96fd735649f97d76d5a17e9f3a76d3c3e174 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 19 Oct 2021 17:29:16 +0200
+Subject: HID: u2fzero: clarify error check and length calculations
+
+From: Andrej Shadura <andrew.shadura@collabora.co.uk>
+
+[ Upstream commit b7abf78b7a6c4a29a6e0ba0bb883fe44a2f3d693 ]
+
+The previous commit fixed handling of incomplete packets but broke error
+handling: offsetof returns an unsigned value (size_t), but when compared
+against the signed return value, the return value is interpreted as if
+it were unsigned, so negative return values are never less than the
+offset.
+
+To make the code easier to read, calculate the minimal packet length
+once and separately, and assign it to a signed int variable to eliminate
+unsigned math and the need for type casts. It then becomes immediately
+obvious how the actual data length is calculated and why the return
+value cannot be less than the minimal length.
+
+Fixes: 22d65765f211 ("HID: u2fzero: ignore incomplete packets without data")
+Fixes: 42337b9d4d95 ("HID: add driver for U2F Zero built-in LED and RNG")
+Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hid/hid-u2fzero.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/hid/hid-u2fzero.c b/drivers/hid/hid-u2fzero.c
+index d70cd3d7f583b..94f78ffb76d04 100644
+--- a/drivers/hid/hid-u2fzero.c
++++ b/drivers/hid/hid-u2fzero.c
+@@ -191,6 +191,8 @@ static int u2fzero_rng_read(struct hwrng *rng, void *data,
+       struct u2f_hid_msg resp;
+       int ret;
+       size_t actual_length;
++      /* valid packets must have a correct header */
++      int min_length = offsetof(struct u2f_hid_msg, init.data);
+       if (!dev->present) {
+               hid_dbg(dev->hdev, "device not present");
+@@ -200,12 +202,12 @@ static int u2fzero_rng_read(struct hwrng *rng, void *data,
+       ret = u2fzero_recv(dev, &req, &resp);
+       /* ignore errors or packets without data */
+-      if (ret < offsetof(struct u2f_hid_msg, init.data))
++      if (ret < min_length)
+               return 0;
+       /* only take the minimum amount of data it is safe to take */
+-      actual_length = min3((size_t)ret - offsetof(struct u2f_hid_msg,
+-              init.data), U2F_HID_MSG_LEN(resp), max);
++      actual_length = min3((size_t)ret - min_length,
++              U2F_HID_MSG_LEN(resp), max);
+       memcpy(data, resp.init.data, actual_length);
+-- 
+2.33.0
+
diff --git a/queue-5.4/hid-u2fzero-properly-handle-timeouts-in-usb_submit_u.patch b/queue-5.4/hid-u2fzero-properly-handle-timeouts-in-usb_submit_u.patch
new file mode 100644 (file)
index 0000000..8ce1beb
--- /dev/null
@@ -0,0 +1,38 @@
+From 727660b022d812f20d89c69e1b806f7f991a9e9b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 19 Oct 2021 17:29:17 +0200
+Subject: HID: u2fzero: properly handle timeouts in usb_submit_urb
+
+From: Andrej Shadura <andrew.shadura@collabora.co.uk>
+
+[ Upstream commit 43775e62c4b784f44a159e13ba80e6146a42d502 ]
+
+The wait_for_completion_timeout function returns 0 if timed out or a
+positive value if completed. Hence, "less than zero" comparison always
+misses timeouts and doesn't kill the URB as it should, leading to
+re-sending it while it is active.
+
+Fixes: 42337b9d4d95 ("HID: add driver for U2F Zero built-in LED and RNG")
+Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hid/hid-u2fzero.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/hid/hid-u2fzero.c b/drivers/hid/hid-u2fzero.c
+index 94f78ffb76d04..67ae2b18e33ac 100644
+--- a/drivers/hid/hid-u2fzero.c
++++ b/drivers/hid/hid-u2fzero.c
+@@ -132,7 +132,7 @@ static int u2fzero_recv(struct u2fzero_device *dev,
+       ret = (wait_for_completion_timeout(
+               &ctx.done, msecs_to_jiffies(USB_CTRL_SET_TIMEOUT)));
+-      if (ret < 0) {
++      if (ret == 0) {
+               usb_kill_urb(dev->urb);
+               hid_err(hdev, "urb submission timed out");
+       } else {
+-- 
+2.33.0
+
diff --git a/queue-5.4/hwmon-fix-possible-memleak-in-__hwmon_device_registe.patch b/queue-5.4/hwmon-fix-possible-memleak-in-__hwmon_device_registe.patch
new file mode 100644 (file)
index 0000000..f9a6ded
--- /dev/null
@@ -0,0 +1,68 @@
+From e4fff379962dfdc6a1f8dae12a11fa83e73cc9a4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 12 Oct 2021 19:27:58 +0800
+Subject: hwmon: Fix possible memleak in __hwmon_device_register()
+
+From: Yang Yingliang <yangyingliang@huawei.com>
+
+[ Upstream commit ada61aa0b1184a8fda1a89a340c7d6cc4e59aee5 ]
+
+I got memory leak as follows when doing fault injection test:
+
+unreferenced object 0xffff888102740438 (size 8):
+  comm "27", pid 859, jiffies 4295031351 (age 143.992s)
+  hex dump (first 8 bytes):
+    68 77 6d 6f 6e 30 00 00                          hwmon0..
+  backtrace:
+    [<00000000544b5996>] __kmalloc_track_caller+0x1a6/0x300
+    [<00000000df0d62b9>] kvasprintf+0xad/0x140
+    [<00000000d3d2a3da>] kvasprintf_const+0x62/0x190
+    [<000000005f8f0f29>] kobject_set_name_vargs+0x56/0x140
+    [<00000000b739e4b9>] dev_set_name+0xb0/0xe0
+    [<0000000095b69c25>] __hwmon_device_register+0xf19/0x1e50 [hwmon]
+    [<00000000a7e65b52>] hwmon_device_register_with_info+0xcb/0x110 [hwmon]
+    [<000000006f181e86>] devm_hwmon_device_register_with_info+0x85/0x100 [hwmon]
+    [<0000000081bdc567>] tmp421_probe+0x2d2/0x465 [tmp421]
+    [<00000000502cc3f8>] i2c_device_probe+0x4e1/0xbb0
+    [<00000000f90bda3b>] really_probe+0x285/0xc30
+    [<000000007eac7b77>] __driver_probe_device+0x35f/0x4f0
+    [<000000004953d43d>] driver_probe_device+0x4f/0x140
+    [<000000002ada2d41>] __device_attach_driver+0x24c/0x330
+    [<00000000b3977977>] bus_for_each_drv+0x15d/0x1e0
+    [<000000005bf2a8e3>] __device_attach+0x267/0x410
+
+When device_register() returns an error, the name allocated in
+dev_set_name() will be leaked, the put_device() should be used
+instead of calling hwmon_dev_release() to give up the device
+reference, then the name will be freed in kobject_cleanup().
+
+Reported-by: Hulk Robot <hulkci@huawei.com>
+Fixes: bab2243ce189 ("hwmon: Introduce hwmon_device_register_with_groups")
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Link: https://lore.kernel.org/r/20211012112758.2681084-1-yangyingliang@huawei.com
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hwmon/hwmon.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
+index d018b20089ecd..a2175394cd253 100644
+--- a/drivers/hwmon/hwmon.c
++++ b/drivers/hwmon/hwmon.c
+@@ -645,8 +645,10 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
+       dev_set_drvdata(hdev, drvdata);
+       dev_set_name(hdev, HWMON_ID_FORMAT, id);
+       err = device_register(hdev);
+-      if (err)
+-              goto free_hwmon;
++      if (err) {
++              put_device(hdev);
++              goto ida_remove;
++      }
+       if (dev && dev->of_node && chip && chip->ops->read &&
+           chip->info[0]->type == hwmon_chip &&
+-- 
+2.33.0
+
diff --git a/queue-5.4/hwmon-pmbus-lm25066-let-compiler-determine-outer-dim.patch b/queue-5.4/hwmon-pmbus-lm25066-let-compiler-determine-outer-dim.patch
new file mode 100644 (file)
index 0000000..88493af
--- /dev/null
@@ -0,0 +1,38 @@
+From 776e486729da0a743e7d0b18c9515a790193999f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 28 Sep 2021 02:22:38 -0700
+Subject: hwmon: (pmbus/lm25066) Let compiler determine outer dimension of
+ lm25066_coeff
+
+From: Zev Weiss <zev@bewilderbeest.net>
+
+[ Upstream commit b7931a7b0e0df4d2a25fedd895ad32c746b77bc1 ]
+
+Maintaining this manually is error prone (there are currently only
+five chips supported, not six); gcc can do it for us automatically.
+
+Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
+Fixes: 666c14906b49 ("hwmon: (pmbus/lm25066) Drop support for LM25063")
+Link: https://lore.kernel.org/r/20210928092242.30036-5-zev@bewilderbeest.net
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hwmon/pmbus/lm25066.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c
+index eba043c59fc73..41c4bbb9c0572 100644
+--- a/drivers/hwmon/pmbus/lm25066.c
++++ b/drivers/hwmon/pmbus/lm25066.c
+@@ -51,7 +51,7 @@ struct __coeff {
+ #define PSC_CURRENT_IN_L      (PSC_NUM_CLASSES)
+ #define PSC_POWER_L           (PSC_NUM_CLASSES + 1)
+-static struct __coeff lm25066_coeff[6][PSC_NUM_CLASSES + 2] = {
++static struct __coeff lm25066_coeff[][PSC_NUM_CLASSES + 2] = {
+       [lm25056] = {
+               [PSC_VOLTAGE_IN] = {
+                       .m = 16296,
+-- 
+2.33.0
+
diff --git a/queue-5.4/hwrng-mtk-force-runtime-pm-ops-for-sleep-ops.patch b/queue-5.4/hwrng-mtk-force-runtime-pm-ops-for-sleep-ops.patch
new file mode 100644 (file)
index 0000000..87cef7e
--- /dev/null
@@ -0,0 +1,53 @@
+From 81c4acf3225d94bec0027427d99a5ca5908cdf8d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 30 Sep 2021 21:12:42 +0200
+Subject: hwrng: mtk - Force runtime pm ops for sleep ops
+
+From: Markus Schneider-Pargmann <msp@baylibre.com>
+
+[ Upstream commit b6f5f0c8f72d348b2d07b20d7b680ef13a7ffe98 ]
+
+Currently mtk_rng_runtime_suspend/resume is called for both runtime pm
+and system sleep operations.
+
+This is wrong as these should only be runtime ops as the name already
+suggests. Currently freezing the system will lead to a call to
+mtk_rng_runtime_suspend even if the device currently isn't active. This
+leads to a clock warning because it is disabled/unprepared although it
+isn't enabled/prepared currently.
+
+This patch fixes this by only setting the runtime pm ops and forces to
+call the runtime pm ops from the system sleep ops as well if active but
+not otherwise.
+
+Fixes: 81d2b34508c6 ("hwrng: mtk - add runtime PM support")
+Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/char/hw_random/mtk-rng.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/char/hw_random/mtk-rng.c b/drivers/char/hw_random/mtk-rng.c
+index e649be5a5f132..6670516fa194d 100644
+--- a/drivers/char/hw_random/mtk-rng.c
++++ b/drivers/char/hw_random/mtk-rng.c
+@@ -173,8 +173,13 @@ static int mtk_rng_runtime_resume(struct device *dev)
+       return mtk_rng_init(&priv->rng);
+ }
+-static UNIVERSAL_DEV_PM_OPS(mtk_rng_pm_ops, mtk_rng_runtime_suspend,
+-                          mtk_rng_runtime_resume, NULL);
++static const struct dev_pm_ops mtk_rng_pm_ops = {
++      SET_RUNTIME_PM_OPS(mtk_rng_runtime_suspend,
++                         mtk_rng_runtime_resume, NULL)
++      SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
++                              pm_runtime_force_resume)
++};
++
+ #define MTK_RNG_PM_OPS (&mtk_rng_pm_ops)
+ #else /* CONFIG_PM */
+ #define MTK_RNG_PM_OPS NULL
+-- 
+2.33.0
+
diff --git a/queue-5.4/i2c-xlr-fix-a-resource-leak-in-the-error-handling-pa.patch b/queue-5.4/i2c-xlr-fix-a-resource-leak-in-the-error-handling-pa.patch
new file mode 100644 (file)
index 0000000..31481fd
--- /dev/null
@@ -0,0 +1,51 @@
+From f2dc342bc402bb9009df918b738dce63ff5a89fc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 19 Aug 2021 22:48:08 +0200
+Subject: i2c: xlr: Fix a resource leak in the error handling path of
+ 'xlr_i2c_probe()'
+
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+
+[ Upstream commit 7f98960c046ee1136e7096aee168eda03aef8a5d ]
+
+A successful 'clk_prepare()' call should be balanced by a corresponding
+'clk_unprepare()' call in the error handling path of the probe, as already
+done in the remove function.
+
+More specifically, 'clk_prepare_enable()' is used, but 'clk_disable()' is
+also already called. So just the unprepare step has still to be done.
+
+Update the error handling path accordingly.
+
+Fixes: 75d31c2372e4 ("i2c: xlr: add support for Sigma Designs controller variant")
+Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Signed-off-by: Wolfram Sang <wsa@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/i2c/busses/i2c-xlr.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/i2c/busses/i2c-xlr.c b/drivers/i2c/busses/i2c-xlr.c
+index 34cd4b3085402..dda6cb848405b 100644
+--- a/drivers/i2c/busses/i2c-xlr.c
++++ b/drivers/i2c/busses/i2c-xlr.c
+@@ -433,11 +433,15 @@ static int xlr_i2c_probe(struct platform_device *pdev)
+       i2c_set_adapdata(&priv->adap, priv);
+       ret = i2c_add_numbered_adapter(&priv->adap);
+       if (ret < 0)
+-              return ret;
++              goto err_unprepare_clk;
+       platform_set_drvdata(pdev, priv);
+       dev_info(&priv->adap.dev, "Added I2C Bus.\n");
+       return 0;
++
++err_unprepare_clk:
++      clk_unprepare(clk);
++      return ret;
+ }
+ static int xlr_i2c_remove(struct platform_device *pdev)
+-- 
+2.33.0
+
diff --git a/queue-5.4/ia64-don-t-do-ia64_cmpxchg_debug-without-config_prin.patch b/queue-5.4/ia64-don-t-do-ia64_cmpxchg_debug-without-config_prin.patch
new file mode 100644 (file)
index 0000000..280130e
--- /dev/null
@@ -0,0 +1,53 @@
+From 45cb0719107f0eab438d121355bcf7ce887d759d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 26 Sep 2021 10:12:24 -0700
+Subject: ia64: don't do IA64_CMPXCHG_DEBUG without CONFIG_PRINTK
+
+From: Randy Dunlap <rdunlap@infradead.org>
+
+[ Upstream commit c15b5fc054c3d6c97e953617605235c5cb8ce979 ]
+
+When CONFIG_PRINTK is not set, the CMPXCHG_BUGCHECK() macro calls
+_printk(), but _printk() is a static inline function, not available
+as an extern.
+Since the purpose of the macro is to print the BUGCHECK info,
+make this config option depend on PRINTK.
+
+Fixes multiple occurrences of this build error:
+
+../include/linux/printk.h:208:5: error: static declaration of '_printk' follows non-static declaration
+  208 | int _printk(const char *s, ...)
+      |     ^~~~~~~
+In file included from ../arch/ia64/include/asm/cmpxchg.h:5,
+../arch/ia64/include/uapi/asm/cmpxchg.h:146:28: note: previous declaration of '_printk' with type 'int(const char *, ...)'
+  146 |                 extern int _printk(const char *fmt, ...);
+
+Cc: linux-ia64@vger.kernel.org
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Cc: Tony Luck <tony.luck@intel.com>
+Cc: Chris Down <chris@chrisdown.name>
+Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
+Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
+Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
+Signed-off-by: Petr Mladek <pmladek@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/ia64/Kconfig.debug | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/ia64/Kconfig.debug b/arch/ia64/Kconfig.debug
+index 40ca23bd228d6..2ce008e2d1644 100644
+--- a/arch/ia64/Kconfig.debug
++++ b/arch/ia64/Kconfig.debug
+@@ -39,7 +39,7 @@ config DISABLE_VHPT
+ config IA64_DEBUG_CMPXCHG
+       bool "Turn on compare-and-exchange bug checking (slow!)"
+-      depends on DEBUG_KERNEL
++      depends on DEBUG_KERNEL && PRINTK
+       help
+         Selecting this option turns on bug checking for the IA-64
+         compare-and-exchange instructions.  This is slow!  Itaniums
+-- 
+2.33.0
+
diff --git a/queue-5.4/ibmvnic-don-t-stop-queue-in-xmit.patch b/queue-5.4/ibmvnic-don-t-stop-queue-in-xmit.patch
new file mode 100644 (file)
index 0000000..d69040c
--- /dev/null
@@ -0,0 +1,52 @@
+From fdf4f75f02430df3b77fad6d886ecc02cfeb76b2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 29 Oct 2021 15:03:14 -0700
+Subject: ibmvnic: don't stop queue in xmit
+
+From: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
+
+[ Upstream commit 8878e46fcfd46b19964bd90e13b25dd94cbfc9be ]
+
+If adapter's resetting bit is on, discard the packet but don't stop the
+transmit queue - instead leave that to the reset code. With this change,
+it is possible that we may get several calls to ibmvnic_xmit() that simply
+discard packets and return.
+
+But if we stop the queue here, we might end up doing so just after
+__ibmvnic_open() started the queues (during a hard/soft reset) and before
+the ->resetting bit was cleared. If that happens, there will be no one to
+restart queue and transmissions will be blocked indefinitely.
+
+This can cause a TIMEOUT reset and with auto priority failover enabled,
+an unnecessary FAILOVER reset to less favored backing device and then a
+FAILOVER back to the most favored backing device. If we hit the window
+repeatedly, we can get stuck in a loop of TIMEOUT, FAILOVER, FAILOVER
+resets leaving the adapter unusable for extended periods of time.
+
+Fixes: 7f5b030830fe ("ibmvnic: Free skb's in cases of failure in transmit")
+Reported-by: Abdul Haleem <abdhalee@in.ibm.com>
+Reported-by: Vaishnavi Bhat <vaish123@in.ibm.com>
+Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
+Reviewed-by: Dany Madden <drt@linux.ibm.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/ibm/ibmvnic.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
+index cfe7229593ead..059eaa13e2c6d 100644
+--- a/drivers/net/ethernet/ibm/ibmvnic.c
++++ b/drivers/net/ethernet/ibm/ibmvnic.c
+@@ -1462,8 +1462,6 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
+       netdev_tx_t ret = NETDEV_TX_OK;
+       if (test_bit(0, &adapter->resetting)) {
+-              if (!netif_subqueue_stopped(netdev, skb))
+-                      netif_stop_subqueue(netdev, queue_num);
+               dev_kfree_skb_any(skb);
+               tx_send_failed++;
+-- 
+2.33.0
+
diff --git a/queue-5.4/ibmvnic-process-crqs-after-enabling-interrupts.patch b/queue-5.4/ibmvnic-process-crqs-after-enabling-interrupts.patch
new file mode 100644 (file)
index 0000000..6c9aade
--- /dev/null
@@ -0,0 +1,44 @@
+From a51b55789d6520830013e033593a20266d9695a1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 29 Oct 2021 15:03:15 -0700
+Subject: ibmvnic: Process crqs after enabling interrupts
+
+From: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
+
+[ Upstream commit 6e20d00158f31f7631d68b86996b7e951c4451c8 ]
+
+Soon after registering a CRQ it is possible that we get a fail over or
+maybe a CRQ_INIT from the VIOS while interrupts were disabled.
+
+Look for any such CRQs after enabling interrupts.
+
+Otherwise we can intermittently fail to bring up ibmvnic adapters during
+boot, specially in kexec/kdump kernels.
+
+Fixes: 032c5e82847a ("Driver for IBM System i/p VNIC protocol")
+Reported-by: Vaishnavi Bhat <vaish123@in.ibm.com>
+Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
+Reviewed-by: Dany Madden <drt@linux.ibm.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/ibm/ibmvnic.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
+index 059eaa13e2c6d..9adfc0a7ab823 100644
+--- a/drivers/net/ethernet/ibm/ibmvnic.c
++++ b/drivers/net/ethernet/ibm/ibmvnic.c
+@@ -4934,6 +4934,9 @@ static int init_crq_queue(struct ibmvnic_adapter *adapter)
+       crq->cur = 0;
+       spin_lock_init(&crq->lock);
++      /* process any CRQs that were queued before we enabled interrupts */
++      tasklet_schedule(&adapter->tasklet);
++
+       return retrc;
+ req_irq_failed:
+-- 
+2.33.0
+
diff --git a/queue-5.4/iov_iter-fix-iov_iter_get_pages-_alloc-page-fault-re.patch b/queue-5.4/iov_iter-fix-iov_iter_get_pages-_alloc-page-fault-re.patch
new file mode 100644 (file)
index 0000000..8427d89
--- /dev/null
@@ -0,0 +1,52 @@
+From 2671342870798a200601a203e622e40d731cb970 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 21 Jul 2021 19:03:47 +0200
+Subject: iov_iter: Fix iov_iter_get_pages{,_alloc} page fault return value
+
+From: Andreas Gruenbacher <agruenba@redhat.com>
+
+[ Upstream commit 814a66741b9ffb5e1ba119e368b178edb0b7322d ]
+
+Both iov_iter_get_pages and iov_iter_get_pages_alloc return the number
+of bytes of the iovec they could get the pages for.  When they cannot
+get any pages, they're supposed to return 0, but when the start of the
+iovec isn't page aligned, the calculation goes wrong and they return a
+negative value.  Fix both functions.
+
+In addition, change iov_iter_get_pages_alloc to return NULL in that case
+to prevent resource leaks.
+
+Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ lib/iov_iter.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/lib/iov_iter.c b/lib/iov_iter.c
+index 41b06af195368..957e3e58df652 100644
+--- a/lib/iov_iter.c
++++ b/lib/iov_iter.c
+@@ -1302,7 +1302,7 @@ ssize_t iov_iter_get_pages(struct iov_iter *i,
+               res = get_user_pages_fast(addr, n,
+                               iov_iter_rw(i) != WRITE ?  FOLL_WRITE : 0,
+                               pages);
+-              if (unlikely(res < 0))
++              if (unlikely(res <= 0))
+                       return res;
+               return (res == n ? len : res * PAGE_SIZE) - *start;
+       0;}),({
+@@ -1384,8 +1384,9 @@ ssize_t iov_iter_get_pages_alloc(struct iov_iter *i,
+                       return -ENOMEM;
+               res = get_user_pages_fast(addr, n,
+                               iov_iter_rw(i) != WRITE ?  FOLL_WRITE : 0, p);
+-              if (unlikely(res < 0)) {
++              if (unlikely(res <= 0)) {
+                       kvfree(p);
++                      *pages = NULL;
+                       return res;
+               }
+               *pages = p;
+-- 
+2.33.0
+
diff --git a/queue-5.4/ipmi-disable-some-operations-during-a-panic.patch b/queue-5.4/ipmi-disable-some-operations-during-a-panic.patch
new file mode 100644 (file)
index 0000000..197901d
--- /dev/null
@@ -0,0 +1,103 @@
+From b530f53c67137c330d4f585cd1e76174914ea912 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 16 Sep 2021 11:36:20 -0500
+Subject: ipmi: Disable some operations during a panic
+
+From: Corey Minyard <cminyard@mvista.com>
+
+[ Upstream commit b36eb5e7b75a756baa64909a176dd4269ee05a8b ]
+
+Don't do kfree or other risky things when oops_in_progress is set.
+It's easy enough to avoid doing them
+
+Signed-off-by: Corey Minyard <cminyard@mvista.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/char/ipmi/ipmi_msghandler.c | 10 +++++++---
+ drivers/char/ipmi/ipmi_watchdog.c   | 17 ++++++++++++-----
+ 2 files changed, 19 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
+index ac656a6d5daf1..bd3c9fb029fa5 100644
+--- a/drivers/char/ipmi/ipmi_msghandler.c
++++ b/drivers/char/ipmi/ipmi_msghandler.c
+@@ -4797,7 +4797,9 @@ static atomic_t recv_msg_inuse_count = ATOMIC_INIT(0);
+ static void free_smi_msg(struct ipmi_smi_msg *msg)
+ {
+       atomic_dec(&smi_msg_inuse_count);
+-      kfree(msg);
++      /* Try to keep as much stuff out of the panic path as possible. */
++      if (!oops_in_progress)
++              kfree(msg);
+ }
+ struct ipmi_smi_msg *ipmi_alloc_smi_msg(void)
+@@ -4816,7 +4818,9 @@ EXPORT_SYMBOL(ipmi_alloc_smi_msg);
+ static void free_recv_msg(struct ipmi_recv_msg *msg)
+ {
+       atomic_dec(&recv_msg_inuse_count);
+-      kfree(msg);
++      /* Try to keep as much stuff out of the panic path as possible. */
++      if (!oops_in_progress)
++              kfree(msg);
+ }
+ static struct ipmi_recv_msg *ipmi_alloc_recv_msg(void)
+@@ -4834,7 +4838,7 @@ static struct ipmi_recv_msg *ipmi_alloc_recv_msg(void)
+ void ipmi_free_recv_msg(struct ipmi_recv_msg *msg)
+ {
+-      if (msg->user)
++      if (msg->user && !oops_in_progress)
+               kref_put(&msg->user->refcount, free_user);
+       msg->done(msg);
+ }
+diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
+index ae06e5402e9d5..72ad7fff64a7a 100644
+--- a/drivers/char/ipmi/ipmi_watchdog.c
++++ b/drivers/char/ipmi/ipmi_watchdog.c
+@@ -337,13 +337,17 @@ static atomic_t msg_tofree = ATOMIC_INIT(0);
+ static DECLARE_COMPLETION(msg_wait);
+ static void msg_free_smi(struct ipmi_smi_msg *msg)
+ {
+-      if (atomic_dec_and_test(&msg_tofree))
+-              complete(&msg_wait);
++      if (atomic_dec_and_test(&msg_tofree)) {
++              if (!oops_in_progress)
++                      complete(&msg_wait);
++      }
+ }
+ static void msg_free_recv(struct ipmi_recv_msg *msg)
+ {
+-      if (atomic_dec_and_test(&msg_tofree))
+-              complete(&msg_wait);
++      if (atomic_dec_and_test(&msg_tofree)) {
++              if (!oops_in_progress)
++                      complete(&msg_wait);
++      }
+ }
+ static struct ipmi_smi_msg smi_msg = {
+       .done = msg_free_smi
+@@ -429,8 +433,10 @@ static int _ipmi_set_timeout(int do_heartbeat)
+       rv = __ipmi_set_timeout(&smi_msg,
+                               &recv_msg,
+                               &send_heartbeat_now);
+-      if (rv)
++      if (rv) {
++              atomic_set(&msg_tofree, 0);
+               return rv;
++      }
+       wait_for_completion(&msg_wait);
+@@ -575,6 +581,7 @@ restart:
+                                     &recv_msg,
+                                     1);
+       if (rv) {
++              atomic_set(&msg_tofree, 0);
+               pr_warn("heartbeat send failure: %d\n", rv);
+               return rv;
+       }
+-- 
+2.33.0
+
diff --git a/queue-5.4/irq-mips-avoid-nested-irq_enter.patch b/queue-5.4/irq-mips-avoid-nested-irq_enter.patch
new file mode 100644 (file)
index 0000000..9e2531f
--- /dev/null
@@ -0,0 +1,52 @@
+From 31a63ee7cc1abdb3923e4a5ef5112b677f09fd65 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Oct 2021 17:25:22 +0100
+Subject: irq: mips: avoid nested irq_enter()
+
+From: Mark Rutland <mark.rutland@arm.com>
+
+[ Upstream commit c65b52d02f6c1a06ddb20cba175ad49eccd6410d ]
+
+As bcm6345_l1_irq_handle() is a chained irqchip handler, it will be
+invoked within the context of the root irqchip handler, which must have
+entered IRQ context already.
+
+When bcm6345_l1_irq_handle() calls arch/mips's do_IRQ() , this will nest
+another call to irq_enter(), and the resulting nested increment to
+`rcu_data.dynticks_nmi_nesting` will cause rcu_is_cpu_rrupt_from_idle()
+to fail to identify wakeups from idle, resulting in failure to preempt,
+and RCU stalls.
+
+Chained irqchip handlers must invoke IRQ handlers by way of thee core
+irqchip code, i.e. generic_handle_irq() or generic_handle_domain_irq()
+and should not call do_IRQ(), which is intended only for root irqchip
+handlers.
+
+Fix bcm6345_l1_irq_handle() by calling generic_handle_irq() directly.
+
+Fixes: c7c42ec2baa1de7a ("irqchips/bmips: Add bcm6345-l1 interrupt controller")
+Signed-off-by: Mark Rutland <mark.rutland@arm.com>
+Reviewed-by: Marc Zyngier <maz@kernel.org>
+Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/irqchip/irq-bcm6345-l1.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/irqchip/irq-bcm6345-l1.c b/drivers/irqchip/irq-bcm6345-l1.c
+index e3483789f4df3..1bd0621c4ce2a 100644
+--- a/drivers/irqchip/irq-bcm6345-l1.c
++++ b/drivers/irqchip/irq-bcm6345-l1.c
+@@ -140,7 +140,7 @@ static void bcm6345_l1_irq_handle(struct irq_desc *desc)
+               for_each_set_bit(hwirq, &pending, IRQS_PER_WORD) {
+                       irq = irq_linear_revmap(intc->domain, base + hwirq);
+                       if (irq)
+-                              do_IRQ(irq);
++                              generic_handle_irq(irq);
+                       else
+                               spurious_interrupt();
+               }
+-- 
+2.33.0
+
diff --git a/queue-5.4/iwlwifi-mvm-disable-rx-diversity-in-powersave.patch b/queue-5.4/iwlwifi-mvm-disable-rx-diversity-in-powersave.patch
new file mode 100644 (file)
index 0000000..4b3323e
--- /dev/null
@@ -0,0 +1,39 @@
+From b5b755d81b99c0b7d62a458a7894de04380fddf7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 17 Oct 2021 11:43:40 +0300
+Subject: iwlwifi: mvm: disable RX-diversity in powersave
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+[ Upstream commit e5322b9ab5f63536c41301150b7ce64605ce52cc ]
+
+Just like we have default SMPS mode as dynamic in powersave,
+we should not enable RX-diversity in powersave, to reduce
+power consumption when connected to a non-MIMO AP.
+
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
+Link: https://lore.kernel.org/r/iwlwifi.20211017113927.fc896bc5cdaa.I1d11da71b8a5cbe921a37058d5f578f1b14a2023@changeid
+Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/intel/iwlwifi/mvm/utils.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
+index 8686107da1168..a637d7fb4b261 100644
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
+@@ -758,6 +758,9 @@ bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm)
+       lockdep_assert_held(&mvm->mutex);
++      if (iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM)
++              return false;
++
+       if (num_of_ant(iwl_mvm_get_valid_rx_ant(mvm)) == 1)
+               return false;
+-- 
+2.33.0
+
diff --git a/queue-5.4/jfs-fix-memleak-in-jfs_mount.patch b/queue-5.4/jfs-fix-memleak-in-jfs_mount.patch
new file mode 100644 (file)
index 0000000..90ed10e
--- /dev/null
@@ -0,0 +1,158 @@
+From b1cf562f902fa1149b59a2e42ac8ec7cd50bf6fb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 4 Sep 2021 10:37:41 +0800
+Subject: JFS: fix memleak in jfs_mount
+
+From: Dongliang Mu <mudongliangabcd@gmail.com>
+
+[ Upstream commit c48a14dca2cb57527dde6b960adbe69953935f10 ]
+
+In jfs_mount, when diMount(ipaimap2) fails, it goes to errout35. However,
+the following code does not free ipaimap2 allocated by diReadSpecial.
+
+Fix this by refactoring the error handling code of jfs_mount. To be
+specific, modify the lable name and free ipaimap2 when the above error
+ocurrs.
+
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
+Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/jfs/jfs_mount.c | 51 ++++++++++++++++++++--------------------------
+ 1 file changed, 22 insertions(+), 29 deletions(-)
+
+diff --git a/fs/jfs/jfs_mount.c b/fs/jfs/jfs_mount.c
+index 616de103dccc5..d41733540df91 100644
+--- a/fs/jfs/jfs_mount.c
++++ b/fs/jfs/jfs_mount.c
+@@ -80,14 +80,14 @@ int jfs_mount(struct super_block *sb)
+        * (initialize mount inode from the superblock)
+        */
+       if ((rc = chkSuper(sb))) {
+-              goto errout20;
++              goto out;
+       }
+       ipaimap = diReadSpecial(sb, AGGREGATE_I, 0);
+       if (ipaimap == NULL) {
+               jfs_err("jfs_mount: Failed to read AGGREGATE_I");
+               rc = -EIO;
+-              goto errout20;
++              goto out;
+       }
+       sbi->ipaimap = ipaimap;
+@@ -98,7 +98,7 @@ int jfs_mount(struct super_block *sb)
+        */
+       if ((rc = diMount(ipaimap))) {
+               jfs_err("jfs_mount: diMount(ipaimap) failed w/rc = %d", rc);
+-              goto errout21;
++              goto err_ipaimap;
+       }
+       /*
+@@ -107,7 +107,7 @@ int jfs_mount(struct super_block *sb)
+       ipbmap = diReadSpecial(sb, BMAP_I, 0);
+       if (ipbmap == NULL) {
+               rc = -EIO;
+-              goto errout22;
++              goto err_umount_ipaimap;
+       }
+       jfs_info("jfs_mount: ipbmap:0x%p", ipbmap);
+@@ -119,7 +119,7 @@ int jfs_mount(struct super_block *sb)
+        */
+       if ((rc = dbMount(ipbmap))) {
+               jfs_err("jfs_mount: dbMount failed w/rc = %d", rc);
+-              goto errout22;
++              goto err_ipbmap;
+       }
+       /*
+@@ -138,7 +138,7 @@ int jfs_mount(struct super_block *sb)
+               if (!ipaimap2) {
+                       jfs_err("jfs_mount: Failed to read AGGREGATE_I");
+                       rc = -EIO;
+-                      goto errout35;
++                      goto err_umount_ipbmap;
+               }
+               sbi->ipaimap2 = ipaimap2;
+@@ -150,7 +150,7 @@ int jfs_mount(struct super_block *sb)
+               if ((rc = diMount(ipaimap2))) {
+                       jfs_err("jfs_mount: diMount(ipaimap2) failed, rc = %d",
+                               rc);
+-                      goto errout35;
++                      goto err_ipaimap2;
+               }
+       } else
+               /* Secondary aggregate inode table is not valid */
+@@ -167,7 +167,7 @@ int jfs_mount(struct super_block *sb)
+               jfs_err("jfs_mount: Failed to read FILESYSTEM_I");
+               /* open fileset secondary inode allocation map */
+               rc = -EIO;
+-              goto errout40;
++              goto err_umount_ipaimap2;
+       }
+       jfs_info("jfs_mount: ipimap:0x%p", ipimap);
+@@ -177,41 +177,34 @@ int jfs_mount(struct super_block *sb)
+       /* initialize fileset inode allocation map */
+       if ((rc = diMount(ipimap))) {
+               jfs_err("jfs_mount: diMount failed w/rc = %d", rc);
+-              goto errout41;
++              goto err_ipimap;
+       }
+-      goto out;
++      return rc;
+       /*
+        *      unwind on error
+        */
+-      errout41:               /* close fileset inode allocation map inode */
++err_ipimap:
++      /* close fileset inode allocation map inode */
+       diFreeSpecial(ipimap);
+-
+-      errout40:               /* fileset closed */
+-
++err_umount_ipaimap2:
+       /* close secondary aggregate inode allocation map */
+-      if (ipaimap2) {
++      if (ipaimap2)
+               diUnmount(ipaimap2, 1);
++err_ipaimap2:
++      /* close aggregate inodes */
++      if (ipaimap2)
+               diFreeSpecial(ipaimap2);
+-      }
+-
+-      errout35:
+-
+-      /* close aggregate block allocation map */
++err_umount_ipbmap:    /* close aggregate block allocation map */
+       dbUnmount(ipbmap, 1);
++err_ipbmap:           /* close aggregate inodes */
+       diFreeSpecial(ipbmap);
+-
+-      errout22:               /* close aggregate inode allocation map */
+-
++err_umount_ipaimap:   /* close aggregate inode allocation map */
+       diUnmount(ipaimap, 1);
+-
+-      errout21:               /* close aggregate inodes */
++err_ipaimap:          /* close aggregate inodes */
+       diFreeSpecial(ipaimap);
+-      errout20:               /* aggregate closed */
+-
+-      out:
+-
++out:
+       if (rc)
+               jfs_err("Mount JFS Failure: %d", rc);
+-- 
+2.33.0
+
diff --git a/queue-5.4/kprobes-do-not-use-local-variable-when-creating-debu.patch b/queue-5.4/kprobes-do-not-use-local-variable-when-creating-debu.patch
new file mode 100644 (file)
index 0000000..9cd760a
--- /dev/null
@@ -0,0 +1,61 @@
+From 329aee3c0115d32e36b23a2bd048a069aa490069 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 14 Sep 2021 23:38:37 +0900
+Subject: kprobes: Do not use local variable when creating debugfs file
+
+From: Punit Agrawal <punitagrawal@gmail.com>
+
+[ Upstream commit 8f7262cd66699a4b02eb7549b35c81b2116aad95 ]
+
+debugfs_create_file() takes a pointer argument that can be used during
+file operation callbacks (accessible via i_private in the inode
+structure). An obvious requirement is for the pointer to refer to
+valid memory when used.
+
+When creating the debugfs file to dynamically enable / disable
+kprobes, a pointer to local variable is passed to
+debugfs_create_file(); which will go out of scope when the init
+function returns. The reason this hasn't triggered random memory
+corruption is because the pointer is not accessed during the debugfs
+file callbacks.
+
+Since the enabled state is managed by the kprobes_all_disabled global
+variable, the local variable is not needed. Fix the incorrect (and
+unnecessary) usage of local variable during debugfs_file_create() by
+passing NULL instead.
+
+Link: https://lkml.kernel.org/r/163163031686.489837.4476867635937014973.stgit@devnote2
+
+Fixes: bf8f6e5b3e51 ("Kprobes: The ON/OFF knob thru debugfs")
+Signed-off-by: Punit Agrawal <punitagrawal@gmail.com>
+Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
+Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/kprobes.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/kernel/kprobes.c b/kernel/kprobes.c
+index a7812c115e487..1668439b269d3 100644
+--- a/kernel/kprobes.c
++++ b/kernel/kprobes.c
+@@ -2712,14 +2712,13 @@ static const struct file_operations fops_kp = {
+ static int __init debugfs_kprobe_init(void)
+ {
+       struct dentry *dir;
+-      unsigned int value = 1;
+       dir = debugfs_create_dir("kprobes", NULL);
+       debugfs_create_file("list", 0400, dir, NULL,
+                           &debugfs_kprobes_operations);
+-      debugfs_create_file("enabled", 0600, dir, &value, &fops_kp);
++      debugfs_create_file("enabled", 0600, dir, NULL, &fops_kp);
+       debugfs_create_file("blacklist", 0400, dir, NULL,
+                           &debugfs_kprobe_blacklist_ops);
+-- 
+2.33.0
+
diff --git a/queue-5.4/kvm-s390-fix-handle_sske-page-fault-handling.patch b/queue-5.4/kvm-s390-fix-handle_sske-page-fault-handling.patch
new file mode 100644 (file)
index 0000000..9422f64
--- /dev/null
@@ -0,0 +1,46 @@
+From 7bfc425e0fa4ade9ac456128ba4befb048d86005 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 22 Oct 2021 17:26:48 +0200
+Subject: KVM: s390: Fix handle_sske page fault handling
+
+From: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
+
+[ Upstream commit 85f517b29418158d3e6e90c3f0fc01b306d2f1a1 ]
+
+If handle_sske cannot set the storage key, because there is no
+page table entry or no present large page entry, it calls
+fixup_user_fault.
+However, currently, if the call succeeds, handle_sske returns
+-EAGAIN, without having set the storage key.
+Instead, retry by continue'ing the loop without incrementing the
+address.
+The same issue in handle_pfmf was fixed by
+a11bdb1a6b78 ("KVM: s390: Fix pfmf and conditional skey emulation").
+
+Fixes: bd096f644319 ("KVM: s390: Add skey emulation fault handling")
+Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
+Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
+Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
+Link: https://lore.kernel.org/r/20211022152648.26536-1-scgl@linux.ibm.com
+Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/s390/kvm/priv.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
+index 560310e29e275..fa69610fe6b12 100644
+--- a/arch/s390/kvm/priv.c
++++ b/arch/s390/kvm/priv.c
+@@ -398,6 +398,8 @@ static int handle_sske(struct kvm_vcpu *vcpu)
+               up_read(&current->mm->mmap_sem);
+               if (rc == -EFAULT)
+                       return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
++              if (rc == -EAGAIN)
++                      continue;
+               if (rc < 0)
+                       return rc;
+               start += PAGE_SIZE;
+-- 
+2.33.0
+
diff --git a/queue-5.4/leaking_addresses-always-print-a-trailing-newline.patch b/queue-5.4/leaking_addresses-always-print-a-trailing-newline.patch
new file mode 100644 (file)
index 0000000..fe0b777
--- /dev/null
@@ -0,0 +1,44 @@
+From 0b41a48b242eeeadeca7322c668edc5be814db73 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 29 Sep 2021 15:02:18 -0700
+Subject: leaking_addresses: Always print a trailing newline
+
+From: Kees Cook <keescook@chromium.org>
+
+[ Upstream commit cf2a85efdade117e2169d6e26641016cbbf03ef0 ]
+
+For files that lack trailing newlines and match a leaking address (e.g.
+wchan[1]), the leaking_addresses.pl report would run together with the
+next line, making things look corrupted.
+
+Unconditionally remove the newline on input, and write it back out on
+output.
+
+[1] https://lore.kernel.org/all/20210103142726.GC30643@xsang-OptiPlex-9020/
+
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Link: https://lkml.kernel.org/r/20211008111626.151570317@infradead.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ scripts/leaking_addresses.pl | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl
+index b2d8b8aa2d99e..8f636a23bc3f2 100755
+--- a/scripts/leaking_addresses.pl
++++ b/scripts/leaking_addresses.pl
+@@ -455,8 +455,9 @@ sub parse_file
+       open my $fh, "<", $file or return;
+       while ( <$fh> ) {
++              chomp;
+               if (may_leak_address($_)) {
+-                      print $file . ': ' . $_;
++                      printf("$file: $_\n");
+               }
+       }
+       close $fh;
+-- 
+2.33.0
+
diff --git a/queue-5.4/lib-xz-avoid-overlapping-memcpy-with-invalid-input-w.patch b/queue-5.4/lib-xz-avoid-overlapping-memcpy-with-invalid-input-w.patch
new file mode 100644 (file)
index 0000000..61d8c1c
--- /dev/null
@@ -0,0 +1,91 @@
+From 3cf78d0ef72f5cafda0c8774cce1dcd468f24e5f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 11 Oct 2021 05:31:39 +0800
+Subject: lib/xz: Avoid overlapping memcpy() with invalid input with in-place
+ decompression
+
+From: Lasse Collin <lasse.collin@tukaani.org>
+
+[ Upstream commit 83d3c4f22a36d005b55f44628f46cc0d319a75e8 ]
+
+With valid files, the safety margin described in lib/decompress_unxz.c
+ensures that these buffers cannot overlap. But if the uncompressed size
+of the input is larger than the caller thought, which is possible when
+the input file is invalid/corrupt, the buffers can overlap. Obviously
+the result will then be garbage (and usually the decoder will return
+an error too) but no other harm will happen when such an over-run occurs.
+
+This change only affects uncompressed LZMA2 chunks and so this
+should have no effect on performance.
+
+Link: https://lore.kernel.org/r/20211010213145.17462-2-xiang@kernel.org
+Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
+Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ lib/decompress_unxz.c |  2 +-
+ lib/xz/xz_dec_lzma2.c | 21 +++++++++++++++++++--
+ 2 files changed, 20 insertions(+), 3 deletions(-)
+
+diff --git a/lib/decompress_unxz.c b/lib/decompress_unxz.c
+index 25d59a95bd668..abea25310ac73 100644
+--- a/lib/decompress_unxz.c
++++ b/lib/decompress_unxz.c
+@@ -167,7 +167,7 @@
+  * memeq and memzero are not used much and any remotely sane implementation
+  * is fast enough. memcpy/memmove speed matters in multi-call mode, but
+  * the kernel image is decompressed in single-call mode, in which only
+- * memcpy speed can matter and only if there is a lot of uncompressible data
++ * memmove speed can matter and only if there is a lot of uncompressible data
+  * (LZMA2 stores uncompressible chunks in uncompressed form). Thus, the
+  * functions below should just be kept small; it's probably not worth
+  * optimizing for speed.
+diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c
+index 156f26fdc4c91..dd80989ca5a6b 100644
+--- a/lib/xz/xz_dec_lzma2.c
++++ b/lib/xz/xz_dec_lzma2.c
+@@ -387,7 +387,14 @@ static void dict_uncompressed(struct dictionary *dict, struct xz_buf *b,
+               *left -= copy_size;
+-              memcpy(dict->buf + dict->pos, b->in + b->in_pos, copy_size);
++              /*
++               * If doing in-place decompression in single-call mode and the
++               * uncompressed size of the file is larger than the caller
++               * thought (i.e. it is invalid input!), the buffers below may
++               * overlap and cause undefined behavior with memcpy().
++               * With valid inputs memcpy() would be fine here.
++               */
++              memmove(dict->buf + dict->pos, b->in + b->in_pos, copy_size);
+               dict->pos += copy_size;
+               if (dict->full < dict->pos)
+@@ -397,7 +404,11 @@ static void dict_uncompressed(struct dictionary *dict, struct xz_buf *b,
+                       if (dict->pos == dict->end)
+                               dict->pos = 0;
+-                      memcpy(b->out + b->out_pos, b->in + b->in_pos,
++                      /*
++                       * Like above but for multi-call mode: use memmove()
++                       * to avoid undefined behavior with invalid input.
++                       */
++                      memmove(b->out + b->out_pos, b->in + b->in_pos,
+                                       copy_size);
+               }
+@@ -421,6 +432,12 @@ static uint32_t dict_flush(struct dictionary *dict, struct xz_buf *b)
+               if (dict->pos == dict->end)
+                       dict->pos = 0;
++              /*
++               * These buffers cannot overlap even if doing in-place
++               * decompression because in multi-call mode dict->buf
++               * has been allocated by us in this file; it's not
++               * provided by the caller like in single-call mode.
++               */
+               memcpy(b->out + b->out_pos, dict->buf + dict->start,
+                               copy_size);
+       }
+-- 
+2.33.0
+
diff --git a/queue-5.4/lib-xz-validate-the-value-before-assigning-it-to-an-.patch b/queue-5.4/lib-xz-validate-the-value-before-assigning-it-to-an-.patch
new file mode 100644 (file)
index 0000000..5a06017
--- /dev/null
@@ -0,0 +1,51 @@
+From abf3b6cc7c03eb3b170622949339685f8937aa81 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 11 Oct 2021 05:31:40 +0800
+Subject: lib/xz: Validate the value before assigning it to an enum variable
+
+From: Lasse Collin <lasse.collin@tukaani.org>
+
+[ Upstream commit 4f8d7abaa413c34da9d751289849dbfb7c977d05 ]
+
+This might matter, for example, if the underlying type of enum xz_check
+was a signed char. In such a case the validation wouldn't have caught an
+unsupported header. I don't know if this problem can occur in the kernel
+on any arch but it's still good to fix it because some people might copy
+the XZ code to their own projects from Linux instead of the upstream
+XZ Embedded repository.
+
+This change may increase the code size by a few bytes. An alternative
+would have been to use an unsigned int instead of enum xz_check but
+using an enumeration looks cleaner.
+
+Link: https://lore.kernel.org/r/20211010213145.17462-3-xiang@kernel.org
+Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
+Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ lib/xz/xz_dec_stream.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/lib/xz/xz_dec_stream.c b/lib/xz/xz_dec_stream.c
+index bd1d182419d7e..0b161f90d8d80 100644
+--- a/lib/xz/xz_dec_stream.c
++++ b/lib/xz/xz_dec_stream.c
+@@ -402,12 +402,12 @@ static enum xz_ret dec_stream_header(struct xz_dec *s)
+        * we will accept other check types too, but then the check won't
+        * be verified and a warning (XZ_UNSUPPORTED_CHECK) will be given.
+        */
++      if (s->temp.buf[HEADER_MAGIC_SIZE + 1] > XZ_CHECK_MAX)
++              return XZ_OPTIONS_ERROR;
++
+       s->check_type = s->temp.buf[HEADER_MAGIC_SIZE + 1];
+ #ifdef XZ_DEC_ANY_CHECK
+-      if (s->check_type > XZ_CHECK_MAX)
+-              return XZ_OPTIONS_ERROR;
+-
+       if (s->check_type > XZ_CHECK_CRC32)
+               return XZ_UNSUPPORTED_CHECK;
+ #else
+-- 
+2.33.0
+
diff --git a/queue-5.4/libbpf-fix-btf-data-layout-checks-and-allow-empty-bt.patch b/queue-5.4/libbpf-fix-btf-data-layout-checks-and-allow-empty-bt.patch
new file mode 100644 (file)
index 0000000..95254be
--- /dev/null
@@ -0,0 +1,64 @@
+From 6b75583320b0c3dbaf81fd84c758bfd496890ed3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 4 Nov 2020 20:33:57 -0800
+Subject: libbpf: Fix BTF data layout checks and allow empty BTF
+
+From: Andrii Nakryiko <andrii@kernel.org>
+
+[ Upstream commit d8123624506cd62730c9cd9c7672c698e462703d ]
+
+Make data section layout checks stricter, disallowing overlap of types and
+strings data.
+
+Additionally, allow BTFs with no type data. There is nothing inherently wrong
+with having BTF with no types (put potentially with some strings). This could
+be a situation with kernel module BTFs, if module doesn't introduce any new
+type information.
+
+Also fix invalid offset alignment check for btf->hdr->type_off.
+
+Fixes: 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf")
+Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
+Signed-off-by: Alexei Starovoitov <ast@kernel.org>
+Link: https://lore.kernel.org/bpf/20201105043402.2530976-8-andrii@kernel.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/lib/bpf/btf.c | 16 ++++++----------
+ 1 file changed, 6 insertions(+), 10 deletions(-)
+
+diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
+index d606a358480da..3380aadb74655 100644
+--- a/tools/lib/bpf/btf.c
++++ b/tools/lib/bpf/btf.c
+@@ -100,22 +100,18 @@ static int btf_parse_hdr(struct btf *btf)
+               return -EINVAL;
+       }
+-      if (meta_left < hdr->type_off) {
+-              pr_debug("Invalid BTF type section offset:%u\n", hdr->type_off);
++      if (meta_left < hdr->str_off + hdr->str_len) {
++              pr_debug("Invalid BTF total size:%u\n", btf->raw_size);
+               return -EINVAL;
+       }
+-      if (meta_left < hdr->str_off) {
+-              pr_debug("Invalid BTF string section offset:%u\n", hdr->str_off);
++      if (hdr->type_off + hdr->type_len > hdr->str_off) {
++              pr_debug("Invalid BTF data sections layout: type data at %u + %u, strings data at %u + %u\n",
++                       hdr->type_off, hdr->type_len, hdr->str_off, hdr->str_len);
+               return -EINVAL;
+       }
+-      if (hdr->type_off >= hdr->str_off) {
+-              pr_debug("BTF type section offset >= string section offset. No type?\n");
+-              return -EINVAL;
+-      }
+-
+-      if (hdr->type_off & 0x02) {
++      if (hdr->type_off % 4) {
+               pr_debug("BTF type section is not aligned to 4 bytes\n");
+               return -EINVAL;
+       }
+-- 
+2.33.0
+
diff --git a/queue-5.4/libertas-fix-possible-memory-leak-in-probe-and-disco.patch b/queue-5.4/libertas-fix-possible-memory-leak-in-probe-and-disco.patch
new file mode 100644 (file)
index 0000000..1286081
--- /dev/null
@@ -0,0 +1,72 @@
+From a4f97ff7be68ea3e95b6bf0d7f178e83adab2d54 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Oct 2021 20:03:45 +0800
+Subject: libertas: Fix possible memory leak in probe and disconnect
+
+From: Wang Hai <wanghai38@huawei.com>
+
+[ Upstream commit 9692151e2fe7a326bafe99836fd1f20a2cc3a049 ]
+
+I got memory leak as follows when doing fault injection test:
+
+unreferenced object 0xffff88812c7d7400 (size 512):
+  comm "kworker/6:1", pid 176, jiffies 4295003332 (age 822.830s)
+  hex dump (first 32 bytes):
+    00 68 1e 04 81 88 ff ff 01 00 00 00 00 00 00 00  .h..............
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  backtrace:
+    [<ffffffff8167939c>] slab_post_alloc_hook+0x9c/0x490
+    [<ffffffff8167f627>] kmem_cache_alloc_trace+0x1f7/0x470
+    [<ffffffffa02c9873>] if_usb_probe+0x63/0x446 [usb8xxx]
+    [<ffffffffa022668a>] usb_probe_interface+0x1aa/0x3c0 [usbcore]
+    [<ffffffff82b59630>] really_probe+0x190/0x480
+    [<ffffffff82b59a19>] __driver_probe_device+0xf9/0x180
+    [<ffffffff82b59af3>] driver_probe_device+0x53/0x130
+    [<ffffffff82b5a075>] __device_attach_driver+0x105/0x130
+    [<ffffffff82b55949>] bus_for_each_drv+0x129/0x190
+    [<ffffffff82b593c9>] __device_attach+0x1c9/0x270
+    [<ffffffff82b5a250>] device_initial_probe+0x20/0x30
+    [<ffffffff82b579c2>] bus_probe_device+0x142/0x160
+    [<ffffffff82b52e49>] device_add+0x829/0x1300
+    [<ffffffffa02229b1>] usb_set_configuration+0xb01/0xcc0 [usbcore]
+    [<ffffffffa0235c4e>] usb_generic_driver_probe+0x6e/0x90 [usbcore]
+    [<ffffffffa022641f>] usb_probe_device+0x6f/0x130 [usbcore]
+
+cardp is missing being freed in the error handling path of the probe
+and the path of the disconnect, which will cause memory leak.
+
+This patch adds the missing kfree().
+
+Fixes: 876c9d3aeb98 ("[PATCH] Marvell Libertas 8388 802.11b/g USB driver")
+Reported-by: Hulk Robot <hulkci@huawei.com>
+Signed-off-by: Wang Hai <wanghai38@huawei.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/20211020120345.2016045-3-wanghai38@huawei.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/marvell/libertas/if_usb.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/net/wireless/marvell/libertas/if_usb.c b/drivers/net/wireless/marvell/libertas/if_usb.c
+index 20436a289d5cd..5d6dc1dd050d4 100644
+--- a/drivers/net/wireless/marvell/libertas/if_usb.c
++++ b/drivers/net/wireless/marvell/libertas/if_usb.c
+@@ -292,6 +292,7 @@ err_add_card:
+       if_usb_reset_device(cardp);
+ dealloc:
+       if_usb_free(cardp);
++      kfree(cardp);
+ error:
+       return r;
+@@ -316,6 +317,7 @@ static void if_usb_disconnect(struct usb_interface *intf)
+       /* Unlink and free urb */
+       if_usb_free(cardp);
++      kfree(cardp);
+       usb_set_intfdata(intf, NULL);
+       usb_put_dev(interface_to_usbdev(intf));
+-- 
+2.33.0
+
diff --git a/queue-5.4/libertas_tf-fix-possible-memory-leak-in-probe-and-di.patch b/queue-5.4/libertas_tf-fix-possible-memory-leak-in-probe-and-di.patch
new file mode 100644 (file)
index 0000000..77c365d
--- /dev/null
@@ -0,0 +1,72 @@
+From dab07d75d918957a93f51dbd450e9c026143038d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Oct 2021 20:03:44 +0800
+Subject: libertas_tf: Fix possible memory leak in probe and disconnect
+
+From: Wang Hai <wanghai38@huawei.com>
+
+[ Upstream commit d549107305b4634c81223a853701c06bcf657bc3 ]
+
+I got memory leak as follows when doing fault injection test:
+
+unreferenced object 0xffff88810a2ddc00 (size 512):
+  comm "kworker/6:1", pid 176, jiffies 4295009893 (age 757.220s)
+  hex dump (first 32 bytes):
+    00 50 05 18 81 88 ff ff 00 00 00 00 00 00 00 00  .P..............
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  backtrace:
+    [<ffffffff8167939c>] slab_post_alloc_hook+0x9c/0x490
+    [<ffffffff8167f627>] kmem_cache_alloc_trace+0x1f7/0x470
+    [<ffffffffa02a1530>] if_usb_probe+0x60/0x37c [libertas_tf_usb]
+    [<ffffffffa022668a>] usb_probe_interface+0x1aa/0x3c0 [usbcore]
+    [<ffffffff82b59630>] really_probe+0x190/0x480
+    [<ffffffff82b59a19>] __driver_probe_device+0xf9/0x180
+    [<ffffffff82b59af3>] driver_probe_device+0x53/0x130
+    [<ffffffff82b5a075>] __device_attach_driver+0x105/0x130
+    [<ffffffff82b55949>] bus_for_each_drv+0x129/0x190
+    [<ffffffff82b593c9>] __device_attach+0x1c9/0x270
+    [<ffffffff82b5a250>] device_initial_probe+0x20/0x30
+    [<ffffffff82b579c2>] bus_probe_device+0x142/0x160
+    [<ffffffff82b52e49>] device_add+0x829/0x1300
+    [<ffffffffa02229b1>] usb_set_configuration+0xb01/0xcc0 [usbcore]
+    [<ffffffffa0235c4e>] usb_generic_driver_probe+0x6e/0x90 [usbcore]
+    [<ffffffffa022641f>] usb_probe_device+0x6f/0x130 [usbcore]
+
+cardp is missing being freed in the error handling path of the probe
+and the path of the disconnect, which will cause memory leak.
+
+This patch adds the missing kfree().
+
+Fixes: c305a19a0d0a ("libertas_tf: usb specific functions")
+Reported-by: Hulk Robot <hulkci@huawei.com>
+Signed-off-by: Wang Hai <wanghai38@huawei.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/20211020120345.2016045-2-wanghai38@huawei.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/marvell/libertas_tf/if_usb.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/net/wireless/marvell/libertas_tf/if_usb.c b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
+index bedc092150884..b30bcb28503ae 100644
+--- a/drivers/net/wireless/marvell/libertas_tf/if_usb.c
++++ b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
+@@ -230,6 +230,7 @@ static int if_usb_probe(struct usb_interface *intf,
+ dealloc:
+       if_usb_free(cardp);
++      kfree(cardp);
+ error:
+ lbtf_deb_leave(LBTF_DEB_MAIN);
+       return -ENOMEM;
+@@ -254,6 +255,7 @@ static void if_usb_disconnect(struct usb_interface *intf)
+       /* Unlink and free urb */
+       if_usb_free(cardp);
++      kfree(cardp);
+       usb_set_intfdata(intf, NULL);
+       usb_put_dev(interface_to_usbdev(intf));
+-- 
+2.33.0
+
diff --git a/queue-5.4/llc-fix-out-of-bound-array-index-in-llc_sk_dev_hash.patch b/queue-5.4/llc-fix-out-of-bound-array-index-in-llc_sk_dev_hash.patch
new file mode 100644 (file)
index 0000000..d093c3a
--- /dev/null
@@ -0,0 +1,68 @@
+From d9585eee55b144adcfa62fe8cb695723d9d9557c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 5 Nov 2021 14:42:14 -0700
+Subject: llc: fix out-of-bound array index in llc_sk_dev_hash()
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit 8ac9dfd58b138f7e82098a4e0a0d46858b12215b ]
+
+Both ifindex and LLC_SK_DEV_HASH_ENTRIES are signed.
+
+This means that (ifindex % LLC_SK_DEV_HASH_ENTRIES) is negative
+if @ifindex is negative.
+
+We could simply make LLC_SK_DEV_HASH_ENTRIES unsigned.
+
+In this patch I chose to use hash_32() to get more entropy
+from @ifindex, like llc_sk_laddr_hashfn().
+
+UBSAN: array-index-out-of-bounds in ./include/net/llc.h:75:26
+index -43 is out of range for type 'hlist_head [64]'
+CPU: 1 PID: 20999 Comm: syz-executor.3 Not tainted 5.15.0-syzkaller #0
+Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
+Call Trace:
+ <TASK>
+ __dump_stack lib/dump_stack.c:88 [inline]
+ dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
+ ubsan_epilogue+0xb/0x5a lib/ubsan.c:151
+ __ubsan_handle_out_of_bounds.cold+0x62/0x6c lib/ubsan.c:291
+ llc_sk_dev_hash include/net/llc.h:75 [inline]
+ llc_sap_add_socket+0x49c/0x520 net/llc/llc_conn.c:697
+ llc_ui_bind+0x680/0xd70 net/llc/af_llc.c:404
+ __sys_bind+0x1e9/0x250 net/socket.c:1693
+ __do_sys_bind net/socket.c:1704 [inline]
+ __se_sys_bind net/socket.c:1702 [inline]
+ __x64_sys_bind+0x6f/0xb0 net/socket.c:1702
+ do_syscall_x64 arch/x86/entry/common.c:50 [inline]
+ do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
+ entry_SYSCALL_64_after_hwframe+0x44/0xae
+RIP: 0033:0x7fa503407ae9
+
+Fixes: 6d2e3ea28446 ("llc: use a device based hash table to speed up multicast delivery")
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Reported-by: syzbot <syzkaller@googlegroups.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/net/llc.h | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/include/net/llc.h b/include/net/llc.h
+index df282d9b40170..9c10b121b49b0 100644
+--- a/include/net/llc.h
++++ b/include/net/llc.h
+@@ -72,7 +72,9 @@ struct llc_sap {
+ static inline
+ struct hlist_head *llc_sk_dev_hash(struct llc_sap *sap, int ifindex)
+ {
+-      return &sap->sk_dev_hash[ifindex % LLC_SK_DEV_HASH_ENTRIES];
++      u32 bucket = hash_32(ifindex, LLC_SK_DEV_HASH_BITS);
++
++      return &sap->sk_dev_hash[bucket];
+ }
+ static inline
+-- 
+2.33.0
+
diff --git a/queue-5.4/locking-lockdep-avoid-rcu-induced-noinstr-fail.patch b/queue-5.4/locking-lockdep-avoid-rcu-induced-noinstr-fail.patch
new file mode 100644 (file)
index 0000000..b9699bf
--- /dev/null
@@ -0,0 +1,34 @@
+From 966158273d48b0bcdbfe6efac3f5c123d038d336 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 24 Jun 2021 11:41:10 +0200
+Subject: locking/lockdep: Avoid RCU-induced noinstr fail
+
+From: Peter Zijlstra <peterz@infradead.org>
+
+[ Upstream commit ce0b9c805dd66d5e49fd53ec5415ae398f4c56e6 ]
+
+vmlinux.o: warning: objtool: look_up_lock_class()+0xc7: call to rcu_read_lock_any_held() leaves .noinstr.text section
+
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Link: https://lore.kernel.org/r/20210624095148.311980536@infradead.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/locking/lockdep.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
+index 3ec8fd2e80e53..db109d38f301e 100644
+--- a/kernel/locking/lockdep.c
++++ b/kernel/locking/lockdep.c
+@@ -830,7 +830,7 @@ look_up_lock_class(const struct lockdep_map *lock, unsigned int subclass)
+       if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
+               return NULL;
+-      hlist_for_each_entry_rcu(class, hash_head, hash_entry) {
++      hlist_for_each_entry_rcu_notrace(class, hash_head, hash_entry) {
+               if (class->key == key) {
+                       /*
+                        * Huh! same key, different name? Did someone trample
+-- 
+2.33.0
+
diff --git a/queue-5.4/m68k-set-a-default-value-for-memory_reserve.patch b/queue-5.4/m68k-set-a-default-value-for-memory_reserve.patch
new file mode 100644 (file)
index 0000000..0213469
--- /dev/null
@@ -0,0 +1,50 @@
+From 82c66d06abb8161d7de9ae21f968e886073e3c09 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 2 Oct 2021 17:02:23 -0700
+Subject: m68k: set a default value for MEMORY_RESERVE
+
+From: Randy Dunlap <rdunlap@infradead.org>
+
+[ Upstream commit 1aaa557b2db95c9506ed0981bc34505c32d6b62b ]
+
+'make randconfig' can produce a .config file with
+"CONFIG_MEMORY_RESERVE=" (no value) since it has no default.
+When a subsequent 'make all' is done, kconfig restarts the config
+and prompts for a value for MEMORY_RESERVE. This breaks
+scripting/automation where there is no interactive user input.
+
+Add a default value for MEMORY_RESERVE. (Any integer value will
+work here for kconfig.)
+
+Fixes a kconfig warning:
+
+.config:214:warning: symbol value '' invalid for MEMORY_RESERVE
+* Restart config...
+Memory reservation (MiB) (MEMORY_RESERVE) [] (NEW)
+
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") # from beginning of git history
+Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
+Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Cc: Greg Ungerer <gerg@linux-m68k.org>
+Cc: linux-m68k@lists.linux-m68k.org
+Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/m68k/Kconfig.machine | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine
+index 1bbe0dd0c4fe5..b88a980f56f8a 100644
+--- a/arch/m68k/Kconfig.machine
++++ b/arch/m68k/Kconfig.machine
+@@ -190,6 +190,7 @@ config INIT_LCD
+ config MEMORY_RESERVE
+       int "Memory reservation (MiB)"
+       depends on (UCSIMM || UCDIMM)
++      default 0
+       help
+         Reserve certain memory regions on 68x328 based boards.
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-cx23885-fix-snd_card_free-call-on-null-card-po.patch b/queue-5.4/media-cx23885-fix-snd_card_free-call-on-null-card-po.patch
new file mode 100644 (file)
index 0000000..119104a
--- /dev/null
@@ -0,0 +1,50 @@
+From a8598dcc7efb89fbe6e4fd9aa0dbd0b2731ad801 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 4 Aug 2021 10:50:10 +0200
+Subject: media: cx23885: Fix snd_card_free call on null card pointer
+
+From: Colin Ian King <colin.king@canonical.com>
+
+[ Upstream commit 7266dda2f1dfe151b12ef0c14eb4d4e622fb211c ]
+
+Currently a call to snd_card_new that fails will set card with a NULL
+pointer, this causes a null pointer dereference on the error cleanup
+path when card it passed to snd_card_free. Fix this by adding a new
+error exit path that does not call snd_card_free and exiting via this
+new path.
+
+Addresses-Coverity: ("Explicit null dereference")
+
+Fixes: 9e44d63246a9 ("[media] cx23885: Add ALSA support")
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/pci/cx23885/cx23885-alsa.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/media/pci/cx23885/cx23885-alsa.c b/drivers/media/pci/cx23885/cx23885-alsa.c
+index a8e980c6dacb9..50772c2611cad 100644
+--- a/drivers/media/pci/cx23885/cx23885-alsa.c
++++ b/drivers/media/pci/cx23885/cx23885-alsa.c
+@@ -550,7 +550,7 @@ struct cx23885_audio_dev *cx23885_audio_register(struct cx23885_dev *dev)
+                          SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
+                       THIS_MODULE, sizeof(struct cx23885_audio_dev), &card);
+       if (err < 0)
+-              goto error;
++              goto error_msg;
+       chip = (struct cx23885_audio_dev *) card->private_data;
+       chip->dev = dev;
+@@ -576,6 +576,7 @@ struct cx23885_audio_dev *cx23885_audio_register(struct cx23885_dev *dev)
+ error:
+       snd_card_free(card);
++error_msg:
+       pr_err("%s(): Failed to register analog audio adapter\n",
+              __func__);
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-cxd2880-spi-fix-a-null-pointer-dereference-on-.patch b/queue-5.4/media-cxd2880-spi-fix-a-null-pointer-dereference-on-.patch
new file mode 100644 (file)
index 0000000..444ad56
--- /dev/null
@@ -0,0 +1,43 @@
+From 014abe85dfb8749df5e34c022c0d861bcc9c1fef Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 20 Jul 2021 18:07:49 +0200
+Subject: media: cxd2880-spi: Fix a null pointer dereference on error handling
+ path
+
+From: Colin Ian King <colin.king@canonical.com>
+
+[ Upstream commit 11b982e950d2138e90bd120501df10a439006ff8 ]
+
+Currently the null pointer check on dvb_spi->vcc_supply is inverted and
+this leads to only null values of the dvb_spi->vcc_supply being passed
+to the call of regulator_disable causing null pointer dereferences.
+Fix this by only calling regulator_disable if dvb_spi->vcc_supply is
+not null.
+
+Addresses-Coverity: ("Dereference after null check")
+
+Fixes: dcb014582101 ("media: cxd2880-spi: Fix an error handling path")
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Signed-off-by: Sean Young <sean@mess.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/spi/cxd2880-spi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/media/spi/cxd2880-spi.c b/drivers/media/spi/cxd2880-spi.c
+index 93194f03764d2..11273be702b6e 100644
+--- a/drivers/media/spi/cxd2880-spi.c
++++ b/drivers/media/spi/cxd2880-spi.c
+@@ -618,7 +618,7 @@ fail_frontend:
+ fail_attach:
+       dvb_unregister_adapter(&dvb_spi->adapter);
+ fail_adapter:
+-      if (!dvb_spi->vcc_supply)
++      if (dvb_spi->vcc_supply)
+               regulator_disable(dvb_spi->vcc_supply);
+ fail_regulator:
+       kfree(dvb_spi);
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-dvb-frontends-mn88443x-handle-errors-of-clk_pr.patch b/queue-5.4/media-dvb-frontends-mn88443x-handle-errors-of-clk_pr.patch
new file mode 100644 (file)
index 0000000..6f1a158
--- /dev/null
@@ -0,0 +1,80 @@
+From aa2193aab8cc4208ab58d20744728fa13892d609 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 22 Aug 2021 11:48:03 +0200
+Subject: media: dvb-frontends: mn88443x: Handle errors of clk_prepare_enable()
+
+From: Evgeny Novikov <novikov@ispras.ru>
+
+[ Upstream commit 69a10678e2fba3d182e78ea041f2d1b1a6058764 ]
+
+mn88443x_cmn_power_on() did not handle possible errors of
+clk_prepare_enable() and always finished successfully so that its caller
+mn88443x_probe() did not care about failed preparing/enabling of clocks
+as well.
+
+Add missed error handling in both mn88443x_cmn_power_on() and
+mn88443x_probe(). This required to change the return value of the former
+from "void" to "int".
+
+Found by Linux Driver Verification project (linuxtesting.org).
+
+Fixes: 0f408ce8941f ("media: dvb-frontends: add Socionext MN88443x ISDB-S/T demodulator driver")
+Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
+Co-developed-by: Kirill Shilimanov <kirill.shilimanov@huawei.com>
+Signed-off-by: Kirill Shilimanov <kirill.shilimanov@huawei.com>
+Signed-off-by: Sean Young <sean@mess.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/dvb-frontends/mn88443x.c | 18 +++++++++++++++---
+ 1 file changed, 15 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/media/dvb-frontends/mn88443x.c b/drivers/media/dvb-frontends/mn88443x.c
+index e4528784f8477..fff212c0bf3b5 100644
+--- a/drivers/media/dvb-frontends/mn88443x.c
++++ b/drivers/media/dvb-frontends/mn88443x.c
+@@ -204,11 +204,18 @@ struct mn88443x_priv {
+       struct regmap *regmap_t;
+ };
+-static void mn88443x_cmn_power_on(struct mn88443x_priv *chip)
++static int mn88443x_cmn_power_on(struct mn88443x_priv *chip)
+ {
++      struct device *dev = &chip->client_s->dev;
+       struct regmap *r_t = chip->regmap_t;
++      int ret;
+-      clk_prepare_enable(chip->mclk);
++      ret = clk_prepare_enable(chip->mclk);
++      if (ret) {
++              dev_err(dev, "Failed to prepare and enable mclk: %d\n",
++                      ret);
++              return ret;
++      }
+       gpiod_set_value_cansleep(chip->reset_gpio, 1);
+       usleep_range(100, 1000);
+@@ -222,6 +229,8 @@ static void mn88443x_cmn_power_on(struct mn88443x_priv *chip)
+       } else {
+               regmap_write(r_t, HIZSET3, 0x8f);
+       }
++
++      return 0;
+ }
+ static void mn88443x_cmn_power_off(struct mn88443x_priv *chip)
+@@ -738,7 +747,10 @@ static int mn88443x_probe(struct i2c_client *client,
+       chip->fe.demodulator_priv = chip;
+       i2c_set_clientdata(client, chip);
+-      mn88443x_cmn_power_on(chip);
++      ret = mn88443x_cmn_power_on(chip);
++      if (ret)
++              goto err_i2c_t;
++
+       mn88443x_s_sleep(chip);
+       mn88443x_t_sleep(chip);
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-dvb-usb-fix-ununit-value-in-az6027_rc_query.patch b/queue-5.4/media-dvb-usb-fix-ununit-value-in-az6027_rc_query.patch
new file mode 100644 (file)
index 0000000..e4090e8
--- /dev/null
@@ -0,0 +1,39 @@
+From 808787da05fea38a14f02a7686556aa11010f4dd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 13 Aug 2021 16:34:20 +0200
+Subject: media: dvb-usb: fix ununit-value in az6027_rc_query
+
+From: Pavel Skripkin <paskripkin@gmail.com>
+
+[ Upstream commit afae4ef7d5ad913cab1316137854a36bea6268a5 ]
+
+Syzbot reported ununit-value bug in az6027_rc_query(). The problem was
+in missing state pointer initialization. Since this function does nothing
+we can simply initialize state to REMOTE_NO_KEY_PRESSED.
+
+Reported-and-tested-by: syzbot+2cd8c5db4a85f0a04142@syzkaller.appspotmail.com
+
+Fixes: 76f9a820c867 ("V4L/DVB: AZ6027: Initial import of the driver")
+Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
+Signed-off-by: Sean Young <sean@mess.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/dvb-usb/az6027.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/media/usb/dvb-usb/az6027.c b/drivers/media/usb/dvb-usb/az6027.c
+index 8de18da0c4bd1..5aa9c501ed9c9 100644
+--- a/drivers/media/usb/dvb-usb/az6027.c
++++ b/drivers/media/usb/dvb-usb/az6027.c
+@@ -391,6 +391,7 @@ static struct rc_map_table rc_map_az6027_table[] = {
+ /* remote control stuff (does not work with my box) */
+ static int az6027_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
+ {
++      *state = REMOTE_NO_KEY_PRESSED;
+       return 0;
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-em28xx-add-missing-em28xx_close_extension.patch b/queue-5.4/media-em28xx-add-missing-em28xx_close_extension.patch
new file mode 100644 (file)
index 0000000..6fda6d7
--- /dev/null
@@ -0,0 +1,44 @@
+From d3905557cd2cd8de1cd6617be374001eaa5cc5e4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 29 Jul 2021 22:23:33 +0200
+Subject: media: em28xx: add missing em28xx_close_extension
+
+From: Pavel Skripkin <paskripkin@gmail.com>
+
+[ Upstream commit 2c98b8a3458df03abdc6945bbef67ef91d181938 ]
+
+If em28xx dev has ->dev_next pointer, we need to delete ->dev_next list
+node from em28xx_extension_devlist on disconnect to avoid UAF bugs and
+corrupted list bugs, since driver frees this pointer on disconnect.
+
+Reported-and-tested-by: syzbot+a6969ef522a36d3344c9@syzkaller.appspotmail.com
+
+Fixes: 1a23f81b7dc3 ("V4L/DVB (9979): em28xx: move usb probe code to a proper place")
+Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/em28xx/em28xx-cards.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
+index 5983e72a0622c..3e96b4b711d75 100644
+--- a/drivers/media/usb/em28xx/em28xx-cards.c
++++ b/drivers/media/usb/em28xx/em28xx-cards.c
+@@ -4029,8 +4029,11 @@ static void em28xx_usb_disconnect(struct usb_interface *intf)
+       em28xx_close_extension(dev);
+-      if (dev->dev_next)
++      if (dev->dev_next) {
++              em28xx_close_extension(dev->dev_next);
+               em28xx_release_resources(dev->dev_next);
++      }
++
+       em28xx_release_resources(dev);
+       if (dev->dev_next) {
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-em28xx-don-t-use-ops-suspend-if-it-is-null.patch b/queue-5.4/media-em28xx-don-t-use-ops-suspend-if-it-is-null.patch
new file mode 100644 (file)
index 0000000..e95f830
--- /dev/null
@@ -0,0 +1,43 @@
+From 1678a7cb6056116bf429659fdc72bf3be73a0d8f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 17 Sep 2021 18:07:02 +0200
+Subject: media: em28xx: Don't use ops->suspend if it is NULL
+
+From: Colin Ian King <colin.king@canonical.com>
+
+[ Upstream commit 51fa3b70d27342baf1ea8aaab3e96e5f4f26d5b2 ]
+
+The call to ops->suspend for the dev->dev_next case can currently
+trigger a call on a null function pointer if ops->suspend is null.
+Skip over the use of function ops->suspend if it is null.
+
+Addresses-Coverity: ("Dereference after null check")
+
+Fixes: be7fd3c3a8c5 ("media: em28xx: Hauppauge DualHD second tuner functionality")
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/em28xx/em28xx-core.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
+index 3daa64bb1e1d9..af9216278024f 100644
+--- a/drivers/media/usb/em28xx/em28xx-core.c
++++ b/drivers/media/usb/em28xx/em28xx-core.c
+@@ -1152,8 +1152,9 @@ int em28xx_suspend_extension(struct em28xx *dev)
+       dev_info(&dev->intf->dev, "Suspending extensions\n");
+       mutex_lock(&em28xx_devlist_mutex);
+       list_for_each_entry(ops, &em28xx_extension_devlist, next) {
+-              if (ops->suspend)
+-                      ops->suspend(dev);
++              if (!ops->suspend)
++                      continue;
++              ops->suspend(dev);
+               if (dev->dev_next)
+                       ops->suspend(dev->dev_next);
+       }
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-i2c-ths8200-needs-v4l2_async.patch b/queue-5.4/media-i2c-ths8200-needs-v4l2_async.patch
new file mode 100644 (file)
index 0000000..89f4cd2
--- /dev/null
@@ -0,0 +1,44 @@
+From 3189af0b190d5792ffc42fcccb4d1108eb199ceb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 5 Sep 2021 01:28:08 +0200
+Subject: media: i2c: ths8200 needs V4L2_ASYNC
+
+From: Randy Dunlap <rdunlap@infradead.org>
+
+[ Upstream commit e4625044d656f3c33ece0cc9da22577bc10ca5d3 ]
+
+Fix the build errors reported by the kernel test robot by
+selecting V4L2_ASYNC:
+
+mips-linux-ld: drivers/media/i2c/ths8200.o: in function `ths8200_remove':
+ths8200.c:(.text+0x1ec): undefined reference to `v4l2_async_unregister_subdev'
+mips-linux-ld: drivers/media/i2c/ths8200.o: in function `ths8200_probe':
+ths8200.c:(.text+0x404): undefined reference to `v4l2_async_register_subdev'
+
+Fixes: ed29f89497006 ("media: i2c: ths8200: support asynchronous probing")
+Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
+Reported-by: kernel test robot <lkp@intel.com>
+Reviewed-by: Lad Prabhakar <prabhakar.csengg@gmail.com>
+Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/i2c/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
+index fcffcc31d168a..aa2c3776db840 100644
+--- a/drivers/media/i2c/Kconfig
++++ b/drivers/media/i2c/Kconfig
+@@ -552,6 +552,7 @@ config VIDEO_AK881X
+ config VIDEO_THS8200
+       tristate "Texas Instruments THS8200 video encoder"
+       depends on VIDEO_V4L2 && I2C
++      select V4L2_ASYNC
+       help
+         Support for the Texas Instruments THS8200 video encoder.
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-imx-set-a-media_device-bus_info-string.patch b/queue-5.4/media-imx-set-a-media_device-bus_info-string.patch
new file mode 100644 (file)
index 0000000..1b22f39
--- /dev/null
@@ -0,0 +1,41 @@
+From b21c74d95d3aa2077b5d3c723aa81474425e2139 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 8 Sep 2021 10:47:46 +0200
+Subject: media: imx: set a media_device bus_info string
+
+From: Martin Kepplinger <martin.kepplinger@puri.sm>
+
+[ Upstream commit 6d0d779b212c27293d9ccb4da092ff0ccb6efa39 ]
+
+Some tools like v4l2-compliance let users select a media device based
+on the bus_info string which can be quite convenient. Use a unique
+string for that.
+
+This also fixes the following v4l2-compliance warning:
+warn: v4l2-test-media.cpp(52): empty bus_info
+
+Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
+Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/staging/media/imx/imx-media-dev-common.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/staging/media/imx/imx-media-dev-common.c b/drivers/staging/media/imx/imx-media-dev-common.c
+index 66b505f7e8dff..137e414cda186 100644
+--- a/drivers/staging/media/imx/imx-media-dev-common.c
++++ b/drivers/staging/media/imx/imx-media-dev-common.c
+@@ -373,6 +373,8 @@ struct imx_media_dev *imx_media_dev_init(struct device *dev,
+       imxmd->v4l2_dev.notify = imx_media_notify;
+       strscpy(imxmd->v4l2_dev.name, "imx-media",
+               sizeof(imxmd->v4l2_dev.name));
++      snprintf(imxmd->md.bus_info, sizeof(imxmd->md.bus_info),
++               "platform:%s", dev_name(imxmd->md.dev));
+       media_device_init(&imxmd->md);
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-ipu3-imgu-imgu_fmt-handle-properly-try.patch b/queue-5.4/media-ipu3-imgu-imgu_fmt-handle-properly-try.patch
new file mode 100644 (file)
index 0000000..e947c3e
--- /dev/null
@@ -0,0 +1,41 @@
+From db8436d3e2415183bfb5ce4fab15ebd5f7b696e3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 7 Oct 2021 00:26:21 +0200
+Subject: media: ipu3-imgu: imgu_fmt: Handle properly try
+
+From: Ricardo Ribalda <ribalda@chromium.org>
+
+[ Upstream commit 553481e38045f349bb9aa596d03bebd020020c9c ]
+
+For a try_fmt call, the node noes not need to be enabled.
+
+Fixes v4l2-compliance
+
+fail: v4l2-test-formats.cpp(717): Video Output Multiplanar is valid, but
+                                 no TRY_FMT was implemented
+test VIDIOC_TRY_FMT: FAIL
+
+Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/staging/media/ipu3/ipu3-v4l2.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c
+index 908ae74aa970d..dd214fcd80cf8 100644
+--- a/drivers/staging/media/ipu3/ipu3-v4l2.c
++++ b/drivers/staging/media/ipu3/ipu3-v4l2.c
+@@ -695,7 +695,7 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node,
+               /* CSS expects some format on OUT queue */
+               if (i != IPU3_CSS_QUEUE_OUT &&
+-                  !imgu_pipe->nodes[inode].enabled) {
++                  !imgu_pipe->nodes[inode].enabled && !try) {
+                       fmts[i] = NULL;
+                       continue;
+               }
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-ipu3-imgu-vidioc_querycap-fix-bus_info.patch b/queue-5.4/media-ipu3-imgu-vidioc_querycap-fix-bus_info.patch
new file mode 100644 (file)
index 0000000..99b1367
--- /dev/null
@@ -0,0 +1,48 @@
+From 7c856d7de2fba9305f299da2185f1e929570ebc8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 7 Oct 2021 00:26:22 +0200
+Subject: media: ipu3-imgu: VIDIOC_QUERYCAP: Fix bus_info
+
+From: Ricardo Ribalda <ribalda@chromium.org>
+
+[ Upstream commit ea2b9a33711604e91f8c826f4dcb3c12baa1990a ]
+
+bus_info field had a different value for the media entity and the video
+device.
+
+Fixes v4l2-compliance:
+
+v4l2-compliance.cpp(637): media bus_info 'PCI:0000:00:05.0' differs from
+                         V4L2 bus_info 'PCI:viewfinder'
+
+Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
+Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/staging/media/ipu3/ipu3-v4l2.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c
+index dd214fcd80cf8..53239ea67fe48 100644
+--- a/drivers/staging/media/ipu3/ipu3-v4l2.c
++++ b/drivers/staging/media/ipu3/ipu3-v4l2.c
+@@ -594,11 +594,12 @@ static const struct imgu_fmt *find_format(struct v4l2_format *f, u32 type)
+ static int imgu_vidioc_querycap(struct file *file, void *fh,
+                               struct v4l2_capability *cap)
+ {
+-      struct imgu_video_device *node = file_to_intel_imgu_node(file);
++      struct imgu_device *imgu = video_drvdata(file);
+       strscpy(cap->driver, IMGU_NAME, sizeof(cap->driver));
+       strscpy(cap->card, IMGU_NAME, sizeof(cap->card));
+-      snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", node->name);
++      snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s",
++               pci_name(imgu->pci_dev));
+       return 0;
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-mceusb-return-without-resubmitting-urb-in-case.patch b/queue-5.4/media-mceusb-return-without-resubmitting-urb-in-case.patch
new file mode 100644 (file)
index 0000000..a75e89a
--- /dev/null
@@ -0,0 +1,40 @@
+From a8ee406b27190ef9b43deb39074cb1e97f4db244 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 18 Aug 2021 22:31:10 +0200
+Subject: media: mceusb: return without resubmitting URB in case of -EPROTO
+ error.
+
+From: Rajat Asthana <rajatasthana4@gmail.com>
+
+[ Upstream commit 476db72e521983ecb847e4013b263072bb1110fc ]
+
+Syzkaller reported a warning called "rcu detected stall in dummy_timer".
+
+The error seems to be an error in mceusb_dev_recv(). In the case of
+-EPROTO error, the routine immediately resubmits the URB. Instead it
+should return without resubmitting URB.
+
+Reported-by: syzbot+4d3749e9612c2cfab956@syzkaller.appspotmail.com
+Signed-off-by: Rajat Asthana <rajatasthana4@gmail.com>
+Signed-off-by: Sean Young <sean@mess.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/rc/mceusb.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
+index c68e52c17ae13..31e56f4f34791 100644
+--- a/drivers/media/rc/mceusb.c
++++ b/drivers/media/rc/mceusb.c
+@@ -1386,6 +1386,7 @@ static void mceusb_dev_recv(struct urb *urb)
+       case -ECONNRESET:
+       case -ENOENT:
+       case -EILSEQ:
++      case -EPROTO:
+       case -ESHUTDOWN:
+               usb_unlink_urb(urb);
+               return;
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-mt9p031-fix-corrupted-frame-after-restarting-s.patch b/queue-5.4/media-mt9p031-fix-corrupted-frame-after-restarting-s.patch
new file mode 100644 (file)
index 0000000..f25173d
--- /dev/null
@@ -0,0 +1,89 @@
+From 16c7aadce4a1626a11f392e2ab14d66998475034 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 26 Jul 2021 09:35:15 +0200
+Subject: media: mt9p031: Fix corrupted frame after restarting stream
+
+From: Dirk Bender <d.bender@phytec.de>
+
+[ Upstream commit 0961ba6dd211a4a52d1dd4c2d59be60ac2dc08c7 ]
+
+To prevent corrupted frames after starting and stopping the sensor its
+datasheet specifies a specific pause sequence to follow:
+
+Stopping:
+       Set Pause_Restart Bit -> Set Restart Bit -> Set Chip_Enable Off
+
+Restarting:
+       Set Chip_Enable On -> Clear Pause_Restart Bit
+
+The Restart Bit is cleared automatically and must not be cleared
+manually as this would cause undefined behavior.
+
+Signed-off-by: Dirk Bender <d.bender@phytec.de>
+Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de>
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/i2c/mt9p031.c | 28 +++++++++++++++++++++++++++-
+ 1 file changed, 27 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
+index dc23b9ed510a4..18440c5104ad9 100644
+--- a/drivers/media/i2c/mt9p031.c
++++ b/drivers/media/i2c/mt9p031.c
+@@ -78,7 +78,9 @@
+ #define               MT9P031_PIXEL_CLOCK_INVERT              (1 << 15)
+ #define               MT9P031_PIXEL_CLOCK_SHIFT(n)            ((n) << 8)
+ #define               MT9P031_PIXEL_CLOCK_DIVIDE(n)           ((n) << 0)
+-#define MT9P031_FRAME_RESTART                         0x0b
++#define MT9P031_RESTART                                       0x0b
++#define               MT9P031_FRAME_PAUSE_RESTART             (1 << 1)
++#define               MT9P031_FRAME_RESTART                   (1 << 0)
+ #define MT9P031_SHUTTER_DELAY                         0x0c
+ #define MT9P031_RST                                   0x0d
+ #define               MT9P031_RST_ENABLE                      1
+@@ -445,9 +447,23 @@ static int mt9p031_set_params(struct mt9p031 *mt9p031)
+ static int mt9p031_s_stream(struct v4l2_subdev *subdev, int enable)
+ {
+       struct mt9p031 *mt9p031 = to_mt9p031(subdev);
++      struct i2c_client *client = v4l2_get_subdevdata(subdev);
++      int val;
+       int ret;
+       if (!enable) {
++              /* enable pause restart */
++              val = MT9P031_FRAME_PAUSE_RESTART;
++              ret = mt9p031_write(client, MT9P031_RESTART, val);
++              if (ret < 0)
++                      return ret;
++
++              /* enable restart + keep pause restart set */
++              val |= MT9P031_FRAME_RESTART;
++              ret = mt9p031_write(client, MT9P031_RESTART, val);
++              if (ret < 0)
++                      return ret;
++
+               /* Stop sensor readout */
+               ret = mt9p031_set_output_control(mt9p031,
+                                                MT9P031_OUTPUT_CONTROL_CEN, 0);
+@@ -467,6 +483,16 @@ static int mt9p031_s_stream(struct v4l2_subdev *subdev, int enable)
+       if (ret < 0)
+               return ret;
++      /*
++       * - clear pause restart
++       * - don't clear restart as clearing restart manually can cause
++       *   undefined behavior
++       */
++      val = MT9P031_FRAME_RESTART;
++      ret = mt9p031_write(client, MT9P031_RESTART, val);
++      if (ret < 0)
++              return ret;
++
+       return mt9p031_pll_enable(mt9p031);
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-mtk-vpu-fix-a-resource-leak-in-the-error-handl.patch b/queue-5.4/media-mtk-vpu-fix-a-resource-leak-in-the-error-handl.patch
new file mode 100644 (file)
index 0000000..d49fbef
--- /dev/null
@@ -0,0 +1,52 @@
+From c23167caeb0f7ec46e6b3ec74c3dca2706cd8f84 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 19 Aug 2021 22:21:25 +0200
+Subject: media: mtk-vpu: Fix a resource leak in the error handling path of
+ 'mtk_vpu_probe()'
+
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+
+[ Upstream commit 2143ad413c05c7be24c3a92760e367b7f6aaac92 ]
+
+A successful 'clk_prepare()' call should be balanced by a corresponding
+'clk_unprepare()' call in the error handling path of the probe, as already
+done in the remove function.
+
+Update the error handling path accordingly.
+
+Fixes: 3003a180ef6b ("[media] VPU: mediatek: support Mediatek VPU")
+Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Reviewed-by: Houlong Wei <houlong.wei@mediatek.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/platform/mtk-vpu/mtk_vpu.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/media/platform/mtk-vpu/mtk_vpu.c b/drivers/media/platform/mtk-vpu/mtk_vpu.c
+index cc2ff40d060d1..acf64723f9381 100644
+--- a/drivers/media/platform/mtk-vpu/mtk_vpu.c
++++ b/drivers/media/platform/mtk-vpu/mtk_vpu.c
+@@ -809,7 +809,8 @@ static int mtk_vpu_probe(struct platform_device *pdev)
+       vpu->wdt.wq = create_singlethread_workqueue("vpu_wdt");
+       if (!vpu->wdt.wq) {
+               dev_err(dev, "initialize wdt workqueue failed\n");
+-              return -ENOMEM;
++              ret = -ENOMEM;
++              goto clk_unprepare;
+       }
+       INIT_WORK(&vpu->wdt.ws, vpu_wdt_reset_func);
+       mutex_init(&vpu->vpu_mutex);
+@@ -908,6 +909,8 @@ disable_vpu_clk:
+       vpu_clock_disable(vpu);
+ workqueue_destroy:
+       destroy_workqueue(vpu->wdt.wq);
++clk_unprepare:
++      clk_unprepare(vpu->clk);
+       return ret;
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-netup_unidvb-handle-interrupt-properly-accordi.patch b/queue-5.4/media-netup_unidvb-handle-interrupt-properly-accordi.patch
new file mode 100644 (file)
index 0000000..62eda41
--- /dev/null
@@ -0,0 +1,178 @@
+From e0745b3e98eba291e37370c7d3746e7a057d76e7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 23 Jun 2021 08:01:05 +0200
+Subject: media: netup_unidvb: handle interrupt properly according to the
+ firmware
+
+From: Zheyu Ma <zheyuma97@gmail.com>
+
+[ Upstream commit dbb4cfea6efe979ed153bd59a6a527a90d3d0ab3 ]
+
+The interrupt handling should be related to the firmware version. If
+the driver matches an old firmware, then the driver should not handle
+interrupt such as i2c or dma, otherwise it will cause some errors.
+
+This log reveals it:
+
+[   27.708641] INFO: trying to register non-static key.
+[   27.710851] The code is fine but needs lockdep annotation, or maybe
+[   27.712010] you didn't initialize this object before use?
+[   27.712396] turning off the locking correctness validator.
+[   27.712787] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 5.12.4-g70e7f0549188-dirty #169
+[   27.713349] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014
+[   27.714149] Call Trace:
+[   27.714329]  <IRQ>
+[   27.714480]  dump_stack+0xba/0xf5
+[   27.714737]  register_lock_class+0x873/0x8f0
+[   27.715052]  ? __lock_acquire+0x323/0x1930
+[   27.715353]  __lock_acquire+0x75/0x1930
+[   27.715636]  lock_acquire+0x1dd/0x3e0
+[   27.715905]  ? netup_i2c_interrupt+0x19/0x310
+[   27.716226]  _raw_spin_lock_irqsave+0x4b/0x60
+[   27.716544]  ? netup_i2c_interrupt+0x19/0x310
+[   27.716863]  netup_i2c_interrupt+0x19/0x310
+[   27.717178]  netup_unidvb_isr+0xd3/0x160
+[   27.717467]  __handle_irq_event_percpu+0x53/0x3e0
+[   27.717808]  handle_irq_event_percpu+0x35/0x90
+[   27.718129]  handle_irq_event+0x39/0x60
+[   27.718409]  handle_fasteoi_irq+0xc2/0x1d0
+[   27.718707]  __common_interrupt+0x7f/0x150
+[   27.719008]  common_interrupt+0xb4/0xd0
+[   27.719289]  </IRQ>
+[   27.719446]  asm_common_interrupt+0x1e/0x40
+[   27.719747] RIP: 0010:native_safe_halt+0x17/0x20
+[   27.720084] Code: 07 0f 00 2d 8b ee 4c 00 f4 5d c3 0f 1f 84 00 00 00 00 00 8b 05 72 95 17 02 55 48 89 e5 85 c0 7e 07 0f 00 2d 6b ee 4c 00 fb f4 <5d> c3 cc cc cc cc cc cc cc 55 48 89 e5 e8 67 53 ff ff 8b 0d 29 f6
+[   27.721386] RSP: 0018:ffffc9000008fe90 EFLAGS: 00000246
+[   27.721758] RAX: 0000000000000000 RBX: 0000000000000002 RCX: 0000000000000000
+[   27.722262] RDX: 0000000000000000 RSI: ffffffff85f7c054 RDI: ffffffff85ded4e6
+[   27.722770] RBP: ffffc9000008fe90 R08: 0000000000000001 R09: 0000000000000001
+[   27.723277] R10: 0000000000000000 R11: 0000000000000001 R12: ffffffff86a75408
+[   27.723781] R13: 0000000000000000 R14: 0000000000000000 R15: ffff888100260000
+[   27.724289]  default_idle+0x9/0x10
+[   27.724537]  arch_cpu_idle+0xa/0x10
+[   27.724791]  default_idle_call+0x6e/0x250
+[   27.725082]  do_idle+0x1f0/0x2d0
+[   27.725326]  cpu_startup_entry+0x18/0x20
+[   27.725613]  start_secondary+0x11f/0x160
+[   27.725902]  secondary_startup_64_no_verify+0xb0/0xbb
+[   27.726272] BUG: kernel NULL pointer dereference, address: 0000000000000002
+[   27.726768] #PF: supervisor read access in kernel mode
+[   27.727138] #PF: error_code(0x0000) - not-present page
+[   27.727507] PGD 8000000118688067 P4D 8000000118688067 PUD 10feab067 PMD 0
+[   27.727999] Oops: 0000 [#1] PREEMPT SMP PTI
+[   27.728302] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 5.12.4-g70e7f0549188-dirty #169
+[   27.728861] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014
+[   27.729660] RIP: 0010:netup_i2c_interrupt+0x23/0x310
+[   27.730019] Code: 0f 1f 80 00 00 00 00 55 48 89 e5 41 55 41 54 53 48 89 fb e8 af 6e 95 fd 48 89 df e8 e7 9f 1c 01 49 89 c5 48 8b 83 48 08 00 00 <66> 44 8b 60 02 44 89 e0 48 8b 93 48 08 00 00 83 e0 f8 66 89 42 02
+[   27.731339] RSP: 0018:ffffc90000118e90 EFLAGS: 00010046
+[   27.731716] RAX: 0000000000000000 RBX: ffff88810803c4d8 RCX: 0000000000000000
+[   27.732223] RDX: 0000000000000001 RSI: ffffffff85d37b94 RDI: ffff88810803c4d8
+[   27.732727] RBP: ffffc90000118ea8 R08: 0000000000000000 R09: 0000000000000001
+[   27.733239] R10: ffff88810803c4f0 R11: 61646e6f63657320 R12: 0000000000000000
+[   27.733745] R13: 0000000000000046 R14: ffff888101041000 R15: ffff8881081b2400
+[   27.734251] FS:  0000000000000000(0000) GS:ffff88817bc80000(0000) knlGS:0000000000000000
+[   27.734821] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+[   27.735228] CR2: 0000000000000002 CR3: 0000000108194000 CR4: 00000000000006e0
+[   27.735735] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+[   27.736241] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
+[   27.736744] Call Trace:
+[   27.736924]  <IRQ>
+[   27.737074]  netup_unidvb_isr+0xd3/0x160
+[   27.737363]  __handle_irq_event_percpu+0x53/0x3e0
+[   27.737706]  handle_irq_event_percpu+0x35/0x90
+[   27.738028]  handle_irq_event+0x39/0x60
+[   27.738306]  handle_fasteoi_irq+0xc2/0x1d0
+[   27.738602]  __common_interrupt+0x7f/0x150
+[   27.738899]  common_interrupt+0xb4/0xd0
+[   27.739176]  </IRQ>
+[   27.739331]  asm_common_interrupt+0x1e/0x40
+[   27.739633] RIP: 0010:native_safe_halt+0x17/0x20
+[   27.739967] Code: 07 0f 00 2d 8b ee 4c 00 f4 5d c3 0f 1f 84 00 00 00 00 00 8b 05 72 95 17 02 55 48 89 e5 85 c0 7e 07 0f 00 2d 6b ee 4c 00 fb f4 <5d> c3 cc cc cc cc cc cc cc 55 48 89 e5 e8 67 53 ff ff 8b 0d 29 f6
+[   27.741275] RSP: 0018:ffffc9000008fe90 EFLAGS: 00000246
+[   27.741647] RAX: 0000000000000000 RBX: 0000000000000002 RCX: 0000000000000000
+[   27.742148] RDX: 0000000000000000 RSI: ffffffff85f7c054 RDI: ffffffff85ded4e6
+[   27.742652] RBP: ffffc9000008fe90 R08: 0000000000000001 R09: 0000000000000001
+[   27.743154] R10: 0000000000000000 R11: 0000000000000001 R12: ffffffff86a75408
+[   27.743652] R13: 0000000000000000 R14: 0000000000000000 R15: ffff888100260000
+[   27.744157]  default_idle+0x9/0x10
+[   27.744405]  arch_cpu_idle+0xa/0x10
+[   27.744658]  default_idle_call+0x6e/0x250
+[   27.744948]  do_idle+0x1f0/0x2d0
+[   27.745190]  cpu_startup_entry+0x18/0x20
+[   27.745475]  start_secondary+0x11f/0x160
+[   27.745761]  secondary_startup_64_no_verify+0xb0/0xbb
+[   27.746123] Modules linked in:
+[   27.746348] Dumping ftrace buffer:
+[   27.746596]    (ftrace buffer empty)
+[   27.746852] CR2: 0000000000000002
+[   27.747094] ---[ end trace ebafd46f83ab946d ]---
+[   27.747424] RIP: 0010:netup_i2c_interrupt+0x23/0x310
+[   27.747778] Code: 0f 1f 80 00 00 00 00 55 48 89 e5 41 55 41 54 53 48 89 fb e8 af 6e 95 fd 48 89 df e8 e7 9f 1c 01 49 89 c5 48 8b 83 48 08 00 00 <66> 44 8b 60 02 44 89 e0 48 8b 93 48 08 00 00 83 e0 f8 66 89 42 02
+[   27.749082] RSP: 0018:ffffc90000118e90 EFLAGS: 00010046
+[   27.749461] RAX: 0000000000000000 RBX: ffff88810803c4d8 RCX: 0000000000000000
+[   27.749966] RDX: 0000000000000001 RSI: ffffffff85d37b94 RDI: ffff88810803c4d8
+[   27.750471] RBP: ffffc90000118ea8 R08: 0000000000000000 R09: 0000000000000001
+[   27.750976] R10: ffff88810803c4f0 R11: 61646e6f63657320 R12: 0000000000000000
+[   27.751480] R13: 0000000000000046 R14: ffff888101041000 R15: ffff8881081b2400
+[   27.751986] FS:  0000000000000000(0000) GS:ffff88817bc80000(0000) knlGS:0000000000000000
+[   27.752560] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+[   27.752970] CR2: 0000000000000002 CR3: 0000000108194000 CR4: 00000000000006e0
+[   27.753481] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+[   27.753984] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
+[   27.754487] Kernel panic - not syncing: Fatal exception in interrupt
+[   27.755033] Dumping ftrace buffer:
+[   27.755279]    (ftrace buffer empty)
+[   27.755534] Kernel Offset: disabled
+[   27.755785] Rebooting in 1 seconds..
+
+Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
+Signed-off-by: Sean Young <sean@mess.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../pci/netup_unidvb/netup_unidvb_core.c      | 27 +++++++++++--------
+ 1 file changed, 16 insertions(+), 11 deletions(-)
+
+diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c
+index 80a7c41baa901..eb5621c9ebf85 100644
+--- a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c
++++ b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c
+@@ -258,19 +258,24 @@ static irqreturn_t netup_unidvb_isr(int irq, void *dev_id)
+       if ((reg40 & AVL_IRQ_ASSERTED) != 0) {
+               /* IRQ is being signaled */
+               reg_isr = readw(ndev->bmmio0 + REG_ISR);
+-              if (reg_isr & NETUP_UNIDVB_IRQ_I2C0) {
+-                      iret = netup_i2c_interrupt(&ndev->i2c[0]);
+-              } else if (reg_isr & NETUP_UNIDVB_IRQ_I2C1) {
+-                      iret = netup_i2c_interrupt(&ndev->i2c[1]);
+-              } else if (reg_isr & NETUP_UNIDVB_IRQ_SPI) {
++              if (reg_isr & NETUP_UNIDVB_IRQ_SPI)
+                       iret = netup_spi_interrupt(ndev->spi);
+-              } else if (reg_isr & NETUP_UNIDVB_IRQ_DMA1) {
+-                      iret = netup_dma_interrupt(&ndev->dma[0]);
+-              } else if (reg_isr & NETUP_UNIDVB_IRQ_DMA2) {
+-                      iret = netup_dma_interrupt(&ndev->dma[1]);
+-              } else if (reg_isr & NETUP_UNIDVB_IRQ_CI) {
+-                      iret = netup_ci_interrupt(ndev);
++              else if (!ndev->old_fw) {
++                      if (reg_isr & NETUP_UNIDVB_IRQ_I2C0) {
++                              iret = netup_i2c_interrupt(&ndev->i2c[0]);
++                      } else if (reg_isr & NETUP_UNIDVB_IRQ_I2C1) {
++                              iret = netup_i2c_interrupt(&ndev->i2c[1]);
++                      } else if (reg_isr & NETUP_UNIDVB_IRQ_DMA1) {
++                              iret = netup_dma_interrupt(&ndev->dma[0]);
++                      } else if (reg_isr & NETUP_UNIDVB_IRQ_DMA2) {
++                              iret = netup_dma_interrupt(&ndev->dma[1]);
++                      } else if (reg_isr & NETUP_UNIDVB_IRQ_CI) {
++                              iret = netup_ci_interrupt(ndev);
++                      } else {
++                              goto err;
++                      }
+               } else {
++err:
+                       dev_err(&pci_dev->dev,
+                               "%s(): unknown interrupt 0x%x\n",
+                               __func__, reg_isr);
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-radio-wl1273-avoid-card-name-truncation.patch b/queue-5.4/media-radio-wl1273-avoid-card-name-truncation.patch
new file mode 100644 (file)
index 0000000..9ace984
--- /dev/null
@@ -0,0 +1,39 @@
+From b319e5c7504d2c58f57853c7a1b6437f2ee4d941 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 3 Aug 2021 21:46:08 +0200
+Subject: media: radio-wl1273: Avoid card name truncation
+
+From: Kees Cook <keescook@chromium.org>
+
+[ Upstream commit dfadec236aa99f6086141949c9dc3ec50f3ff20d ]
+
+The "card" string only holds 31 characters (and the terminating NUL).
+In order to avoid truncation, use a shorter card description instead of
+the current result, "Texas Instruments Wl1273 FM Rad".
+
+Suggested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Fixes: 87d1a50ce451 ("[media] V4L2: WL1273 FM Radio: TI WL1273 FM radio driver")
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/radio/radio-wl1273.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/media/radio/radio-wl1273.c b/drivers/media/radio/radio-wl1273.c
+index 1123768731676..484046471c03f 100644
+--- a/drivers/media/radio/radio-wl1273.c
++++ b/drivers/media/radio/radio-wl1273.c
+@@ -1279,7 +1279,7 @@ static int wl1273_fm_vidioc_querycap(struct file *file, void *priv,
+       strscpy(capability->driver, WL1273_FM_DRIVER_NAME,
+               sizeof(capability->driver));
+-      strscpy(capability->card, "Texas Instruments Wl1273 FM Radio",
++      strscpy(capability->card, "TI Wl1273 FM Radio",
+               sizeof(capability->card));
+       strscpy(capability->bus_info, radio->bus_type,
+               sizeof(capability->bus_info));
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-rcar-csi2-add-checking-to-rcsi2_start_receiver.patch b/queue-5.4/media-rcar-csi2-add-checking-to-rcsi2_start_receiver.patch
new file mode 100644 (file)
index 0000000..5071d1d
--- /dev/null
@@ -0,0 +1,45 @@
+From fe8ca092e44fddef6d793fcf2278fc2bc6b5ec66 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 11 Aug 2021 19:18:16 +0200
+Subject: media: rcar-csi2: Add checking to rcsi2_start_receiver()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Nadezda Lutovinova <lutovinova@ispras.ru>
+
+[ Upstream commit fc41665498332ad394b7db37f23e9394096ddc71 ]
+
+If rcsi2_code_to_fmt() return NULL, then null pointer dereference occurs
+in the next cycle. That should not be possible now but adding checking
+protects from future bugs.
+The patch adds checking if format is NULL.
+
+Found by Linux Driver Verification project (linuxtesting.org).
+
+Signed-off-by: Nadezda Lutovinova <lutovinova@ispras.ru>
+Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
+Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/platform/rcar-vin/rcar-csi2.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/platform/rcar-vin/rcar-csi2.c
+index d27eccfa57cae..e01f22bf826d4 100644
+--- a/drivers/media/platform/rcar-vin/rcar-csi2.c
++++ b/drivers/media/platform/rcar-vin/rcar-csi2.c
+@@ -488,6 +488,8 @@ static int rcsi2_start_receiver(struct rcar_csi2 *priv)
+       /* Code is validated in set_fmt. */
+       format = rcsi2_code_to_fmt(priv->mf.code);
++      if (!format)
++              return -EINVAL;
+       /*
+        * Enable all supported CSI-2 channels with virtual channel and
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-s5p-mfc-add-checking-to-s5p_mfc_probe.patch b/queue-5.4/media-s5p-mfc-add-checking-to-s5p_mfc_probe.patch
new file mode 100644 (file)
index 0000000..44e4be5
--- /dev/null
@@ -0,0 +1,41 @@
+From f7744f1c020045abc4abf3a6549733a5bf93a0f8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 11 Aug 2021 15:32:28 +0200
+Subject: media: s5p-mfc: Add checking to s5p_mfc_probe().
+
+From: Nadezda Lutovinova <lutovinova@ispras.ru>
+
+[ Upstream commit cdfaf4752e6915a4b455ad4400133e540e4dc965 ]
+
+If of_device_get_match_data() return NULL,
+then null pointer dereference occurs in  s5p_mfc_init_pm().
+The patch adds checking if dev->variant is NULL.
+
+Found by Linux Driver Verification project (linuxtesting.org).
+
+Signed-off-by: Nadezda Lutovinova <lutovinova@ispras.ru>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/platform/s5p-mfc/s5p_mfc.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
+index f8a5ed6bb9d7a..9faecd049002f 100644
+--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
++++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
+@@ -1284,6 +1284,10 @@ static int s5p_mfc_probe(struct platform_device *pdev)
+       }
+       dev->variant = of_device_get_match_data(&pdev->dev);
++      if (!dev->variant) {
++              dev_err(&pdev->dev, "Failed to get device MFC hardware variant information\n");
++              return -ENOENT;
++      }
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       dev->regs_base = devm_ioremap_resource(&pdev->dev, res);
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-s5p-mfc-fix-possible-null-pointer-dereference-.patch b/queue-5.4/media-s5p-mfc-fix-possible-null-pointer-dereference-.patch
new file mode 100644 (file)
index 0000000..68aa6cf
--- /dev/null
@@ -0,0 +1,49 @@
+From b5a66d6d481ae7b82fb1c072afabde0d493ec0fc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 5 Aug 2021 09:55:35 +0200
+Subject: media: s5p-mfc: fix possible null-pointer dereference in
+ s5p_mfc_probe()
+
+From: Tuo Li <islituo@gmail.com>
+
+[ Upstream commit 8515965e5e33f4feb56134348c95953f3eadfb26 ]
+
+The variable pdev is assigned to dev->plat_dev, and dev->plat_dev is
+checked in:
+  if (!dev->plat_dev)
+
+This indicates both dev->plat_dev and pdev can be NULL. If so, the
+function dev_err() is called to print error information.
+  dev_err(&pdev->dev, "No platform data specified\n");
+
+However, &pdev->dev is an illegal address, and it is dereferenced in
+dev_err().
+
+To fix this possible null-pointer dereference, replace dev_err() with
+mfc_err().
+
+Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
+Signed-off-by: Tuo Li <islituo@gmail.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/platform/s5p-mfc/s5p_mfc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
+index b776f83e395e0..f8a5ed6bb9d7a 100644
+--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
++++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
+@@ -1279,7 +1279,7 @@ static int s5p_mfc_probe(struct platform_device *pdev)
+       spin_lock_init(&dev->condlock);
+       dev->plat_dev = pdev;
+       if (!dev->plat_dev) {
+-              dev_err(&pdev->dev, "No platform data specified\n");
++              mfc_err("No platform data specified\n");
+               return -ENODEV;
+       }
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-si470x-avoid-card-name-truncation.patch b/queue-5.4/media-si470x-avoid-card-name-truncation.patch
new file mode 100644 (file)
index 0000000..8db9678
--- /dev/null
@@ -0,0 +1,54 @@
+From 74aee122d9a293d7170bee5431b938f8c7734a11 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 3 Aug 2021 21:46:09 +0200
+Subject: media: si470x: Avoid card name truncation
+
+From: Kees Cook <keescook@chromium.org>
+
+[ Upstream commit 2908249f3878a591f7918368fdf0b7b0a6c3158c ]
+
+The "card" string only holds 31 characters (and the terminating NUL).
+In order to avoid truncation, use a shorter card description instead of
+the current result, "Silicon Labs Si470x FM Radio Re".
+
+Suggested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Fixes: 78656acdcf48 ("V4L/DVB (7038): USB radio driver for Silicon Labs Si470x FM Radio Receivers")
+Fixes: cc35bbddfe10 ("V4L/DVB (12416): radio-si470x: add i2c driver for si470x")
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/radio/si470x/radio-si470x-i2c.c | 2 +-
+ drivers/media/radio/si470x/radio-si470x-usb.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c
+index f491420d7b538..a972c0705ac79 100644
+--- a/drivers/media/radio/si470x/radio-si470x-i2c.c
++++ b/drivers/media/radio/si470x/radio-si470x-i2c.c
+@@ -11,7 +11,7 @@
+ /* driver definitions */
+ #define DRIVER_AUTHOR "Joonyoung Shim <jy0922.shim@samsung.com>";
+-#define DRIVER_CARD "Silicon Labs Si470x FM Radio Receiver"
++#define DRIVER_CARD "Silicon Labs Si470x FM Radio"
+ #define DRIVER_DESC "I2C radio driver for Si470x FM Radio Receivers"
+ #define DRIVER_VERSION "1.0.2"
+diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c
+index fedff68d8c496..3f8634a465730 100644
+--- a/drivers/media/radio/si470x/radio-si470x-usb.c
++++ b/drivers/media/radio/si470x/radio-si470x-usb.c
+@@ -16,7 +16,7 @@
+ /* driver definitions */
+ #define DRIVER_AUTHOR "Tobias Lorenz <tobias.lorenz@gmx.net>"
+-#define DRIVER_CARD "Silicon Labs Si470x FM Radio Receiver"
++#define DRIVER_CARD "Silicon Labs Si470x FM Radio"
+ #define DRIVER_DESC "USB radio driver for Si470x FM Radio Receivers"
+ #define DRIVER_VERSION "1.0.10"
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-stm32-potential-null-pointer-dereference-in-dc.patch b/queue-5.4/media-stm32-potential-null-pointer-dereference-in-dc.patch
new file mode 100644 (file)
index 0000000..607b214
--- /dev/null
@@ -0,0 +1,94 @@
+From 85bc1f778753e67b75deca2c9997700c9d977945 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 27 May 2021 17:06:26 +0200
+Subject: media: stm32: Potential NULL pointer dereference in dcmi_irq_thread()
+
+From: Dmitriy Ulitin <ulitin@ispras.ru>
+
+[ Upstream commit 548fa43a58696450c15b8f5564e99589c5144664 ]
+
+At the moment of enabling irq handling:
+
+1922 ret = devm_request_threaded_irq(&pdev->dev, irq, dcmi_irq_callback,
+1923                   dcmi_irq_thread, IRQF_ONESHOT,
+1924                   dev_name(&pdev->dev), dcmi);
+
+there is still uninitialized field sd_format of struct stm32_dcmi *dcmi.
+If an interrupt occurs in the interval between the installation of the
+interrupt handler and the initialization of this field, NULL pointer
+dereference happens.
+
+This field is dereferenced in the handler function without any check:
+
+457 if (dcmi->sd_format->fourcc == V4L2_PIX_FMT_JPEG &&
+458        dcmi->misr & IT_FRAME) {
+
+The patch moves interrupt handler installation
+after initialization of the sd_format field that happens in
+dcmi_graph_notify_complete() via dcmi_set_default_fmt().
+
+Found by Linux Driver Verification project (linuxtesting.org).
+
+Signed-off-by: Dmitriy Ulitin <ulitin@ispras.ru>
+Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/platform/stm32/stm32-dcmi.c | 19 +++++++++++--------
+ 1 file changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
+index d41475f56ab54..72798aae7a628 100644
+--- a/drivers/media/platform/stm32/stm32-dcmi.c
++++ b/drivers/media/platform/stm32/stm32-dcmi.c
+@@ -135,6 +135,7 @@ struct stm32_dcmi {
+       int                             sequence;
+       struct list_head                buffers;
+       struct dcmi_buf                 *active;
++      int                     irq;
+       struct v4l2_device              v4l2_dev;
+       struct video_device             *vdev;
+@@ -1720,6 +1721,14 @@ static int dcmi_graph_notify_complete(struct v4l2_async_notifier *notifier)
+               return ret;
+       }
++      ret = devm_request_threaded_irq(dcmi->dev, dcmi->irq, dcmi_irq_callback,
++                                      dcmi_irq_thread, IRQF_ONESHOT,
++                                      dev_name(dcmi->dev), dcmi);
++      if (ret) {
++              dev_err(dcmi->dev, "Unable to request irq %d\n", dcmi->irq);
++              return ret;
++      }
++
+       return 0;
+ }
+@@ -1881,6 +1890,8 @@ static int dcmi_probe(struct platform_device *pdev)
+       if (irq <= 0)
+               return irq ? irq : -ENXIO;
++      dcmi->irq = irq;
++
+       dcmi->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!dcmi->res) {
+               dev_err(&pdev->dev, "Could not get resource\n");
+@@ -1893,14 +1904,6 @@ static int dcmi_probe(struct platform_device *pdev)
+               return PTR_ERR(dcmi->regs);
+       }
+-      ret = devm_request_threaded_irq(&pdev->dev, irq, dcmi_irq_callback,
+-                                      dcmi_irq_thread, IRQF_ONESHOT,
+-                                      dev_name(&pdev->dev), dcmi);
+-      if (ret) {
+-              dev_err(&pdev->dev, "Unable to request irq %d\n", irq);
+-              return ret;
+-      }
+-
+       mclk = devm_clk_get(&pdev->dev, "mclk");
+       if (IS_ERR(mclk)) {
+               if (PTR_ERR(mclk) != -EPROBE_DEFER)
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-tda1997x-handle-short-reads-of-hdmi-info-frame.patch b/queue-5.4/media-tda1997x-handle-short-reads-of-hdmi-info-frame.patch
new file mode 100644 (file)
index 0000000..3f498e5
--- /dev/null
@@ -0,0 +1,74 @@
+From 69d842db7531dc131fe94198141f91614206ee7e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 12 Aug 2021 19:00:43 +0200
+Subject: media: TDA1997x: handle short reads of hdmi info frame.
+
+From: Tom Rix <trix@redhat.com>
+
+[ Upstream commit 48d219f9cc667bc6fbc3e3af0b1bfd75db94fce4 ]
+
+Static analysis reports this representative problem
+
+tda1997x.c:1939: warning: 7th function call argument is an uninitialized
+value
+
+The 7th argument is buffer[0], which is set in the earlier call to
+io_readn().  When io_readn() call to io_read() fails with the first
+read, buffer[0] is not set and 0 is returned and stored in len.
+
+The later call to hdmi_infoframe_unpack()'s size parameter is the
+static size of buffer, always 40, so a short read is not caught
+in hdmi_infoframe_unpacks()'s checking.  The variable len should be
+used instead.
+
+Zero initialize buffer to 0 so it is in a known start state.
+
+Fixes: 9ac0038db9a7 ("media: i2c: Add TDA1997x HDMI receiver driver")
+Signed-off-by: Tom Rix <trix@redhat.com>
+Reviewed-by: Tim Harvey <tharvey@gateworks.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/i2c/tda1997x.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/media/i2c/tda1997x.c b/drivers/media/i2c/tda1997x.c
+index 18a2027ba1450..5faffedb0feba 100644
+--- a/drivers/media/i2c/tda1997x.c
++++ b/drivers/media/i2c/tda1997x.c
+@@ -1247,13 +1247,13 @@ tda1997x_parse_infoframe(struct tda1997x_state *state, u16 addr)
+ {
+       struct v4l2_subdev *sd = &state->sd;
+       union hdmi_infoframe frame;
+-      u8 buffer[40];
++      u8 buffer[40] = { 0 };
+       u8 reg;
+       int len, err;
+       /* read data */
+       len = io_readn(sd, addr, sizeof(buffer), buffer);
+-      err = hdmi_infoframe_unpack(&frame, buffer, sizeof(buffer));
++      err = hdmi_infoframe_unpack(&frame, buffer, len);
+       if (err) {
+               v4l_err(state->client,
+                       "failed parsing %d byte infoframe: 0x%04x/0x%02x\n",
+@@ -1927,13 +1927,13 @@ static int tda1997x_log_infoframe(struct v4l2_subdev *sd, int addr)
+ {
+       struct tda1997x_state *state = to_state(sd);
+       union hdmi_infoframe frame;
+-      u8 buffer[40];
++      u8 buffer[40] = { 0 };
+       int len, err;
+       /* read data */
+       len = io_readn(sd, addr, sizeof(buffer), buffer);
+       v4l2_dbg(1, debug, sd, "infoframe: addr=%d len=%d\n", addr, len);
+-      err = hdmi_infoframe_unpack(&frame, buffer, sizeof(buffer));
++      err = hdmi_infoframe_unpack(&frame, buffer, len);
+       if (err) {
+               v4l_err(state->client,
+                       "failed parsing %d byte infoframe: 0x%04x/0x%02x\n",
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-tm6000-avoid-card-name-truncation.patch b/queue-5.4/media-tm6000-avoid-card-name-truncation.patch
new file mode 100644 (file)
index 0000000..22fe240
--- /dev/null
@@ -0,0 +1,40 @@
+From 6a40548630461d14251b178b4e60d4c6923ae694 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 3 Aug 2021 21:46:10 +0200
+Subject: media: tm6000: Avoid card name truncation
+
+From: Kees Cook <keescook@chromium.org>
+
+[ Upstream commit 42bb98e420d454fef3614b70ea11cc59068395f6 ]
+
+The "card" string only holds 31 characters (and the terminating NUL).
+In order to avoid truncation, use a shorter card description instead of
+the current result, "Trident TVMaster TM5600/6000/60".
+
+Suggested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Fixes: e28f49b0b2a8 ("V4L/DVB: tm6000: fix some info messages")
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/tm6000/tm6000-video.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c
+index c46cbcfafab3f..8874b0b922eee 100644
+--- a/drivers/media/usb/tm6000/tm6000-video.c
++++ b/drivers/media/usb/tm6000/tm6000-video.c
+@@ -854,8 +854,7 @@ static int vidioc_querycap(struct file *file, void  *priv,
+       struct tm6000_core *dev = ((struct tm6000_fh *)priv)->dev;
+       strscpy(cap->driver, "tm6000", sizeof(cap->driver));
+-      strscpy(cap->card, "Trident TVMaster TM5600/6000/6010",
+-              sizeof(cap->card));
++      strscpy(cap->card, "Trident TM5600/6000/6010", sizeof(cap->card));
+       usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info));
+       cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
+                           V4L2_CAP_DEVICE_CAPS;
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-usb-dvd-usb-fix-uninit-value-bug-in-dibusb_rea.patch b/queue-5.4/media-usb-dvd-usb-fix-uninit-value-bug-in-dibusb_rea.patch
new file mode 100644 (file)
index 0000000..507bec8
--- /dev/null
@@ -0,0 +1,41 @@
+From 70030ab7da1e088f2c2fea95d1870b6a87b044b0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 7 Dec 2020 07:16:06 +0100
+Subject: media: usb: dvd-usb: fix uninit-value bug in
+ dibusb_read_eeprom_byte()
+
+From: Anant Thazhemadam <anant.thazhemadam@gmail.com>
+
+[ Upstream commit 899a61a3305d49e8a712e9ab20d0db94bde5929f ]
+
+In dibusb_read_eeprom_byte(), if dibusb_i2c_msg() fails, val gets
+assigned an value that's not properly initialized.
+Using kzalloc() in place of kmalloc() for the buffer fixes this issue,
+as the val can now be set to 0 in the event dibusb_i2c_msg() fails.
+
+Reported-by: syzbot+e27b4fd589762b0b9329@syzkaller.appspotmail.com
+Tested-by: syzbot+e27b4fd589762b0b9329@syzkaller.appspotmail.com
+Signed-off-by: Anant Thazhemadam <anant.thazhemadam@gmail.com>
+Signed-off-by: Sean Young <sean@mess.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/dvb-usb/dibusb-common.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/media/usb/dvb-usb/dibusb-common.c b/drivers/media/usb/dvb-usb/dibusb-common.c
+index 59ce2dec11e98..9c1ebea68b544 100644
+--- a/drivers/media/usb/dvb-usb/dibusb-common.c
++++ b/drivers/media/usb/dvb-usb/dibusb-common.c
+@@ -223,7 +223,7 @@ int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val)
+       u8 *buf;
+       int rc;
+-      buf = kmalloc(2, GFP_KERNEL);
++      buf = kzalloc(2, GFP_KERNEL);
+       if (!buf)
+               return -ENOMEM;
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-uvcvideo-return-eio-for-control-errors.patch b/queue-5.4/media-uvcvideo-return-eio-for-control-errors.patch
new file mode 100644 (file)
index 0000000..b0ca9e9
--- /dev/null
@@ -0,0 +1,48 @@
+From 98a167e5a88227f6378e51a8d4e9a480167c1d5c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 18 Jun 2021 14:29:09 +0200
+Subject: media: uvcvideo: Return -EIO for control errors
+
+From: Ricardo Ribalda <ribalda@chromium.org>
+
+[ Upstream commit ffccdde5f0e17d2f0d788a9d831a027187890eaa ]
+
+The device is doing something unexpected with the control. Either because
+the protocol is not properly implemented or there has been a HW error.
+
+Fixes v4l2-compliance:
+
+Control ioctls (Input 0):
+                fail: v4l2-test-controls.cpp(448): s_ctrl returned an error (22)
+        test VIDIOC_G/S_CTRL: FAIL
+                fail: v4l2-test-controls.cpp(698): s_ext_ctrls returned an error (22)
+        test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
+
+Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/uvc/uvc_video.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
+index 5d095b2a03464..96b85d66e7a87 100644
+--- a/drivers/media/usb/uvc/uvc_video.c
++++ b/drivers/media/usb/uvc/uvc_video.c
+@@ -112,6 +112,11 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit,
+       case 5: /* Invalid unit */
+       case 6: /* Invalid control */
+       case 7: /* Invalid Request */
++              /*
++               * The firmware has not properly implemented
++               * the control or there has been a HW error.
++               */
++              return -EIO;
+       case 8: /* Invalid value within range */
+               return -EINVAL;
+       default: /* reserved or unknown */
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-uvcvideo-set-capability-in-s_param.patch b/queue-5.4/media-uvcvideo-set-capability-in-s_param.patch
new file mode 100644 (file)
index 0000000..84081ac
--- /dev/null
@@ -0,0 +1,47 @@
+From 87bb336f45506c2bfa5a3e15c9d833ae6de4c9bc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 18 Jun 2021 14:29:08 +0200
+Subject: media: uvcvideo: Set capability in s_param
+
+From: Ricardo Ribalda <ribalda@chromium.org>
+
+[ Upstream commit 97a2777a96070afb7da5d587834086c0b586c8cc ]
+
+Fixes v4l2-compliance:
+
+Format ioctls (Input 0):
+                warn: v4l2-test-formats.cpp(1339): S_PARM is supported but doesn't report V4L2_CAP_TIMEPERFRAME
+                fail: v4l2-test-formats.cpp(1241): node->has_frmintervals && !cap->capability
+
+Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/uvc/uvc_v4l2.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
+index db7f8f8ee2f9f..3126ee9e965c9 100644
+--- a/drivers/media/usb/uvc/uvc_v4l2.c
++++ b/drivers/media/usb/uvc/uvc_v4l2.c
+@@ -467,10 +467,13 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream,
+       uvc_simplify_fraction(&timeperframe.numerator,
+               &timeperframe.denominator, 8, 333);
+-      if (parm->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
++      if (parm->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
+               parm->parm.capture.timeperframe = timeperframe;
+-      else
++              parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME;
++      } else {
+               parm->parm.output.timeperframe = timeperframe;
++              parm->parm.output.capability = V4L2_CAP_TIMEPERFRAME;
++      }
+       return 0;
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/media-uvcvideo-set-unique-vdev-name-based-in-type.patch b/queue-5.4/media-uvcvideo-set-unique-vdev-name-based-in-type.patch
new file mode 100644 (file)
index 0000000..3d530db
--- /dev/null
@@ -0,0 +1,67 @@
+From 5ae6b2faf3ce054e7cc7001442444772e54fb41d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 18 Jun 2021 14:29:13 +0200
+Subject: media: uvcvideo: Set unique vdev name based in type
+
+From: Ricardo Ribalda <ribalda@chromium.org>
+
+[ Upstream commit e3f60e7e1a2b451f538f9926763432249bcf39c4 ]
+
+All the entities must have a unique name. We can have a descriptive and
+unique name by appending the function and the entity->id.
+
+This is even resilent to multi chain devices.
+
+Fixes v4l2-compliance:
+Media Controller ioctls:
+                fail: v4l2-test-media.cpp(205): v2_entity_names_set.find(key) != v2_entity_names_set.end()
+        test MEDIA_IOC_G_TOPOLOGY: FAIL
+                fail: v4l2-test-media.cpp(394): num_data_links != num_links
+       test MEDIA_IOC_ENUM_ENTITIES/LINKS: FAIL
+
+Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
+Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/uvc/uvc_driver.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
+index 40ca1d4e03483..378cfc46fc195 100644
+--- a/drivers/media/usb/uvc/uvc_driver.c
++++ b/drivers/media/usb/uvc/uvc_driver.c
+@@ -1972,6 +1972,7 @@ int uvc_register_video_device(struct uvc_device *dev,
+                             const struct v4l2_file_operations *fops,
+                             const struct v4l2_ioctl_ops *ioctl_ops)
+ {
++      const char *name;
+       int ret;
+       /* Initialize the video buffers queue. */
+@@ -2000,16 +2001,20 @@ int uvc_register_video_device(struct uvc_device *dev,
+       case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+       default:
+               vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
++              name = "Video Capture";
+               break;
+       case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+               vdev->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
++              name = "Video Output";
+               break;
+       case V4L2_BUF_TYPE_META_CAPTURE:
+               vdev->device_caps = V4L2_CAP_META_CAPTURE | V4L2_CAP_STREAMING;
++              name = "Metadata";
+               break;
+       }
+-      strscpy(vdev->name, dev->name, sizeof(vdev->name));
++      snprintf(vdev->name, sizeof(vdev->name), "%s %u", name,
++               stream->header.bTerminalLink);
+       /*
+        * Set the driver data before calling video_register_device, otherwise
+-- 
+2.33.0
+
diff --git a/queue-5.4/memory-fsl_ifc-fix-leak-of-irq-and-nand_irq-in-fsl_i.patch b/queue-5.4/memory-fsl_ifc-fix-leak-of-irq-and-nand_irq-in-fsl_i.patch
new file mode 100644 (file)
index 0000000..4c2e119
--- /dev/null
@@ -0,0 +1,73 @@
+From b6f638292467bda53723d71637ea329585fe2659 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 25 Sep 2021 23:14:32 +0800
+Subject: memory: fsl_ifc: fix leak of irq and nand_irq in fsl_ifc_ctrl_probe
+
+From: Dongliang Mu <mudongliangabcd@gmail.com>
+
+[ Upstream commit 4ed2f3545c2e5acfbccd7f85fea5b1a82e9862d7 ]
+
+The error handling code of fsl_ifc_ctrl_probe is problematic. When
+fsl_ifc_ctrl_init fails or request_irq of fsl_ifc_ctrl_dev->irq fails,
+it forgets to free the irq and nand_irq. Meanwhile, if request_irq of
+fsl_ifc_ctrl_dev->nand_irq fails, it will still free nand_irq even if
+the request_irq is not successful.
+
+Fix this by refactoring the error handling code.
+
+Fixes: d2ae2e20fbdd ("driver/memory:Move Freescale IFC driver to a common driver")
+Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
+Link: https://lore.kernel.org/r/20210925151434.8170-1-mudongliangabcd@gmail.com
+Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/memory/fsl_ifc.c | 13 ++++++-------
+ 1 file changed, 6 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/memory/fsl_ifc.c b/drivers/memory/fsl_ifc.c
+index 2790258346070..84fa32f288c80 100644
+--- a/drivers/memory/fsl_ifc.c
++++ b/drivers/memory/fsl_ifc.c
+@@ -263,7 +263,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
+       ret = fsl_ifc_ctrl_init(fsl_ifc_ctrl_dev);
+       if (ret < 0)
+-              goto err;
++              goto err_unmap_nandirq;
+       init_waitqueue_head(&fsl_ifc_ctrl_dev->nand_wait);
+@@ -272,7 +272,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
+       if (ret != 0) {
+               dev_err(&dev->dev, "failed to install irq (%d)\n",
+                       fsl_ifc_ctrl_dev->irq);
+-              goto err_irq;
++              goto err_unmap_nandirq;
+       }
+       if (fsl_ifc_ctrl_dev->nand_irq) {
+@@ -281,17 +281,16 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
+               if (ret != 0) {
+                       dev_err(&dev->dev, "failed to install irq (%d)\n",
+                               fsl_ifc_ctrl_dev->nand_irq);
+-                      goto err_nandirq;
++                      goto err_free_irq;
+               }
+       }
+       return 0;
+-err_nandirq:
+-      free_irq(fsl_ifc_ctrl_dev->nand_irq, fsl_ifc_ctrl_dev);
+-      irq_dispose_mapping(fsl_ifc_ctrl_dev->nand_irq);
+-err_irq:
++err_free_irq:
+       free_irq(fsl_ifc_ctrl_dev->irq, fsl_ifc_ctrl_dev);
++err_unmap_nandirq:
++      irq_dispose_mapping(fsl_ifc_ctrl_dev->nand_irq);
+       irq_dispose_mapping(fsl_ifc_ctrl_dev->irq);
+ err:
+       iounmap(fsl_ifc_ctrl_dev->gregs);
+-- 
+2.33.0
+
diff --git a/queue-5.4/memstick-avoid-out-of-range-warning.patch b/queue-5.4/memstick-avoid-out-of-range-warning.patch
new file mode 100644 (file)
index 0000000..4ab5802
--- /dev/null
@@ -0,0 +1,44 @@
+From 77c4170bf0aab5d1b069d936b23c606f22154083 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 27 Sep 2021 11:44:47 +0200
+Subject: memstick: avoid out-of-range warning
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit 4853396f03c3019eccf5cd113e464231e9ddf0b3 ]
+
+clang-14 complains about a sanity check that always passes when the
+page size is 64KB or larger:
+
+drivers/memstick/core/ms_block.c:1739:21: error: result of comparison of constant 65536 with expression of type 'unsigned short' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
+        if (msb->page_size > PAGE_SIZE) {
+            ~~~~~~~~~~~~~~ ^ ~~~~~~~~~
+
+This is fine, it will still work on all architectures, so just shut
+up that warning with a cast.
+
+Fixes: 0ab30494bc4f ("memstick: add support for legacy memorysticks")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Link: https://lore.kernel.org/r/20210927094520.696665-1-arnd@kernel.org
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/memstick/core/ms_block.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c
+index d9ee8e3dc72da..55907e4c36b18 100644
+--- a/drivers/memstick/core/ms_block.c
++++ b/drivers/memstick/core/ms_block.c
+@@ -1727,7 +1727,7 @@ static int msb_init_card(struct memstick_dev *card)
+       msb->pages_in_block = boot_block->attr.block_size * 2;
+       msb->block_size = msb->page_size * msb->pages_in_block;
+-      if (msb->page_size > PAGE_SIZE) {
++      if ((size_t)msb->page_size > PAGE_SIZE) {
+               /* this isn't supported by linux at all, anyway*/
+               dbg("device page %d size isn't supported", msb->page_size);
+               return -EINVAL;
+-- 
+2.33.0
+
diff --git a/queue-5.4/memstick-jmb38x_ms-use-appropriate-free-function-in-.patch b/queue-5.4/memstick-jmb38x_ms-use-appropriate-free-function-in-.patch
new file mode 100644 (file)
index 0000000..e904576
--- /dev/null
@@ -0,0 +1,40 @@
+From 02ee0e85b397b0d1d6bcad964ae64601f96d6b0a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 11 Oct 2021 15:39:12 +0300
+Subject: memstick: jmb38x_ms: use appropriate free function in
+ jmb38x_ms_alloc_host()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit beae4a6258e64af609ad5995cc6b6056eb0d898e ]
+
+The "msh" pointer is device managed, meaning that memstick_alloc_host()
+calls device_initialize() on it.  That means that it can't be free
+using kfree() but must instead be freed with memstick_free_host().
+Otherwise it leads to a tiny memory leak of device resources.
+
+Fixes: 60fdd931d577 ("memstick: add support for JMicron jmb38x MemoryStick host controller")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Link: https://lore.kernel.org/r/20211011123912.GD15188@kili
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/memstick/host/jmb38x_ms.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c
+index 64fff6abe60e8..74d6686b35f77 100644
+--- a/drivers/memstick/host/jmb38x_ms.c
++++ b/drivers/memstick/host/jmb38x_ms.c
+@@ -899,7 +899,7 @@ static struct memstick_host *jmb38x_ms_alloc_host(struct jmb38x_ms *jm, int cnt)
+       iounmap(host->addr);
+ err_out_free:
+-      kfree(msh);
++      memstick_free_host(msh);
+       return NULL;
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/memstick-r592-fix-a-uaf-bug-when-removing-the-driver.patch b/queue-5.4/memstick-r592-fix-a-uaf-bug-when-removing-the-driver.patch
new file mode 100644 (file)
index 0000000..7b15602
--- /dev/null
@@ -0,0 +1,80 @@
+From 479688c5d17ba02da1e22912480e9efdbf51318c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 16 Oct 2021 11:26:21 +0000
+Subject: memstick: r592: Fix a UAF bug when removing the driver
+
+From: Zheyu Ma <zheyuma97@gmail.com>
+
+[ Upstream commit 738216c1953e802aa9f930c5d15b8f9092c847ff ]
+
+In r592_remove(), the driver will free dma after freeing the host, which
+may cause a UAF bug.
+
+The following log reveals it:
+
+[   45.361796 ] BUG: KASAN: use-after-free in r592_remove+0x269/0x350 [r592]
+[   45.364286 ] Call Trace:
+[   45.364472 ]  dump_stack_lvl+0xa8/0xd1
+[   45.364751 ]  print_address_description+0x87/0x3b0
+[   45.365137 ]  kasan_report+0x172/0x1c0
+[   45.365415 ]  ? r592_remove+0x269/0x350 [r592]
+[   45.365834 ]  ? r592_remove+0x269/0x350 [r592]
+[   45.366168 ]  __asan_report_load8_noabort+0x14/0x20
+[   45.366531 ]  r592_remove+0x269/0x350 [r592]
+[   45.378785 ]
+[   45.378903 ] Allocated by task 4674:
+[   45.379162 ]  ____kasan_kmalloc+0xb5/0xe0
+[   45.379455 ]  __kasan_kmalloc+0x9/0x10
+[   45.379730 ]  __kmalloc+0x150/0x280
+[   45.379984 ]  memstick_alloc_host+0x2a/0x190
+[   45.380664 ]
+[   45.380781 ] Freed by task 5509:
+[   45.381014 ]  kasan_set_track+0x3d/0x70
+[   45.381293 ]  kasan_set_free_info+0x23/0x40
+[   45.381635 ]  ____kasan_slab_free+0x10b/0x140
+[   45.381950 ]  __kasan_slab_free+0x11/0x20
+[   45.382241 ]  slab_free_freelist_hook+0x81/0x150
+[   45.382575 ]  kfree+0x13e/0x290
+[   45.382805 ]  memstick_free+0x1c/0x20
+[   45.383070 ]  device_release+0x9c/0x1d0
+[   45.383349 ]  kobject_put+0x2ef/0x4c0
+[   45.383616 ]  put_device+0x1f/0x30
+[   45.383865 ]  memstick_free_host+0x24/0x30
+[   45.384162 ]  r592_remove+0x242/0x350 [r592]
+[   45.384473 ]  pci_device_remove+0xa9/0x250
+
+Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
+Link: https://lore.kernel.org/r/1634383581-11055-1-git-send-email-zheyuma97@gmail.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/memstick/host/r592.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/memstick/host/r592.c b/drivers/memstick/host/r592.c
+index d2ef46337191c..eaa2a94d18be4 100644
+--- a/drivers/memstick/host/r592.c
++++ b/drivers/memstick/host/r592.c
+@@ -837,15 +837,15 @@ static void r592_remove(struct pci_dev *pdev)
+       }
+       memstick_remove_host(dev->host);
++      if (dev->dummy_dma_page)
++              dma_free_coherent(&pdev->dev, PAGE_SIZE, dev->dummy_dma_page,
++                      dev->dummy_dma_page_physical_address);
++
+       free_irq(dev->irq, dev);
+       iounmap(dev->mmio);
+       pci_release_regions(pdev);
+       pci_disable_device(pdev);
+       memstick_free_host(dev->host);
+-
+-      if (dev->dummy_dma_page)
+-              dma_free_coherent(&pdev->dev, PAGE_SIZE, dev->dummy_dma_page,
+-                      dev->dummy_dma_page_physical_address);
+ }
+ #ifdef CONFIG_PM_SLEEP
+-- 
+2.33.0
+
diff --git a/queue-5.4/mips-cm-convert-to-bitfield-api-to-fix-out-of-bounds.patch b/queue-5.4/mips-cm-convert-to-bitfield-api-to-fix-out-of-bounds.patch
new file mode 100644 (file)
index 0000000..8cfe6ee
--- /dev/null
@@ -0,0 +1,142 @@
+From 72c7d2d3839bd593a7c3458d28a8655e2970e82e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 29 Oct 2021 11:58:16 +0200
+Subject: mips: cm: Convert to bitfield API to fix out-of-bounds access
+
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+
+[ Upstream commit 18b8f5b6fc53d097cadb94a93d8d6566ba88e389 ]
+
+mips_cm_error_report() extracts the cause and other cause from the error
+register using shifts.  This works fine for the former, as it is stored
+in the top bits, and the shift will thus remove all non-related bits.
+However, the latter is stored in the bottom bits, hence thus needs masking
+to get rid of non-related bits.  Without such masking, using it as an
+index into the cm2_causes[] array will lead to an out-of-bounds access,
+probably causing a crash.
+
+Fix this by using FIELD_GET() instead.  Bite the bullet and convert all
+MIPS CM handling to the bitfield API, to improve readability and safety.
+
+Fixes: 3885c2b463f6a236 ("MIPS: CM: Add support for reporting CM cache errors")
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
+Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/mips/include/asm/mips-cm.h | 12 ++++++------
+ arch/mips/kernel/mips-cm.c      | 21 ++++++++++-----------
+ 2 files changed, 16 insertions(+), 17 deletions(-)
+
+diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h
+index aeae2effa123d..23c67c0871b17 100644
+--- a/arch/mips/include/asm/mips-cm.h
++++ b/arch/mips/include/asm/mips-cm.h
+@@ -11,6 +11,7 @@
+ #ifndef __MIPS_ASM_MIPS_CM_H__
+ #define __MIPS_ASM_MIPS_CM_H__
++#include <linux/bitfield.h>
+ #include <linux/bitops.h>
+ #include <linux/errno.h>
+@@ -153,8 +154,8 @@ GCR_ACCESSOR_RO(32, 0x030, rev)
+ #define CM_GCR_REV_MINOR                      GENMASK(7, 0)
+ #define CM_ENCODE_REV(major, minor) \
+-              (((major) << __ffs(CM_GCR_REV_MAJOR)) | \
+-               ((minor) << __ffs(CM_GCR_REV_MINOR)))
++              (FIELD_PREP(CM_GCR_REV_MAJOR, major) | \
++               FIELD_PREP(CM_GCR_REV_MINOR, minor))
+ #define CM_REV_CM2                            CM_ENCODE_REV(6, 0)
+ #define CM_REV_CM2_5                          CM_ENCODE_REV(7, 0)
+@@ -362,10 +363,10 @@ static inline int mips_cm_revision(void)
+ static inline unsigned int mips_cm_max_vp_width(void)
+ {
+       extern int smp_num_siblings;
+-      uint32_t cfg;
+       if (mips_cm_revision() >= CM_REV_CM3)
+-              return read_gcr_sys_config2() & CM_GCR_SYS_CONFIG2_MAXVPW;
++              return FIELD_GET(CM_GCR_SYS_CONFIG2_MAXVPW,
++                               read_gcr_sys_config2());
+       if (mips_cm_present()) {
+               /*
+@@ -373,8 +374,7 @@ static inline unsigned int mips_cm_max_vp_width(void)
+                * number of VP(E)s, and if that ever changes then this will
+                * need revisiting.
+                */
+-              cfg = read_gcr_cl_config() & CM_GCR_Cx_CONFIG_PVPE;
+-              return (cfg >> __ffs(CM_GCR_Cx_CONFIG_PVPE)) + 1;
++              return FIELD_GET(CM_GCR_Cx_CONFIG_PVPE, read_gcr_cl_config()) + 1;
+       }
+       if (IS_ENABLED(CONFIG_SMP))
+diff --git a/arch/mips/kernel/mips-cm.c b/arch/mips/kernel/mips-cm.c
+index a9eab83d9148d..611ef512c0b81 100644
+--- a/arch/mips/kernel/mips-cm.c
++++ b/arch/mips/kernel/mips-cm.c
+@@ -179,8 +179,7 @@ static void mips_cm_probe_l2sync(void)
+       phys_addr_t addr;
+       /* L2-only sync was introduced with CM major revision 6 */
+-      major_rev = (read_gcr_rev() & CM_GCR_REV_MAJOR) >>
+-              __ffs(CM_GCR_REV_MAJOR);
++      major_rev = FIELD_GET(CM_GCR_REV_MAJOR, read_gcr_rev());
+       if (major_rev < 6)
+               return;
+@@ -263,13 +262,13 @@ void mips_cm_lock_other(unsigned int cluster, unsigned int core,
+       preempt_disable();
+       if (cm_rev >= CM_REV_CM3) {
+-              val = core << __ffs(CM3_GCR_Cx_OTHER_CORE);
+-              val |= vp << __ffs(CM3_GCR_Cx_OTHER_VP);
++              val = FIELD_PREP(CM3_GCR_Cx_OTHER_CORE, core) |
++                    FIELD_PREP(CM3_GCR_Cx_OTHER_VP, vp);
+               if (cm_rev >= CM_REV_CM3_5) {
+                       val |= CM_GCR_Cx_OTHER_CLUSTER_EN;
+-                      val |= cluster << __ffs(CM_GCR_Cx_OTHER_CLUSTER);
+-                      val |= block << __ffs(CM_GCR_Cx_OTHER_BLOCK);
++                      val |= FIELD_PREP(CM_GCR_Cx_OTHER_CLUSTER, cluster);
++                      val |= FIELD_PREP(CM_GCR_Cx_OTHER_BLOCK, block);
+               } else {
+                       WARN_ON(cluster != 0);
+                       WARN_ON(block != CM_GCR_Cx_OTHER_BLOCK_LOCAL);
+@@ -299,7 +298,7 @@ void mips_cm_lock_other(unsigned int cluster, unsigned int core,
+               spin_lock_irqsave(&per_cpu(cm_core_lock, curr_core),
+                                 per_cpu(cm_core_lock_flags, curr_core));
+-              val = core << __ffs(CM_GCR_Cx_OTHER_CORENUM);
++              val = FIELD_PREP(CM_GCR_Cx_OTHER_CORENUM, core);
+       }
+       write_gcr_cl_other(val);
+@@ -343,8 +342,8 @@ void mips_cm_error_report(void)
+       cm_other = read_gcr_error_mult();
+       if (revision < CM_REV_CM3) { /* CM2 */
+-              cause = cm_error >> __ffs(CM_GCR_ERROR_CAUSE_ERRTYPE);
+-              ocause = cm_other >> __ffs(CM_GCR_ERROR_MULT_ERR2ND);
++              cause = FIELD_GET(CM_GCR_ERROR_CAUSE_ERRTYPE, cm_error);
++              ocause = FIELD_GET(CM_GCR_ERROR_MULT_ERR2ND, cm_other);
+               if (!cause)
+                       return;
+@@ -386,8 +385,8 @@ void mips_cm_error_report(void)
+               ulong core_id_bits, vp_id_bits, cmd_bits, cmd_group_bits;
+               ulong cm3_cca_bits, mcp_bits, cm3_tr_bits, sched_bit;
+-              cause = cm_error >> __ffs64(CM3_GCR_ERROR_CAUSE_ERRTYPE);
+-              ocause = cm_other >> __ffs(CM_GCR_ERROR_MULT_ERR2ND);
++              cause = FIELD_GET(CM3_GCR_ERROR_CAUSE_ERRTYPE, cm_error);
++              ocause = FIELD_GET(CM_GCR_ERROR_MULT_ERR2ND, cm_other);
+               if (!cause)
+                       return;
+-- 
+2.33.0
+
diff --git a/queue-5.4/mips-lantiq-dma-add-small-delay-after-reset.patch b/queue-5.4/mips-lantiq-dma-add-small-delay-after-reset.patch
new file mode 100644 (file)
index 0000000..843a696
--- /dev/null
@@ -0,0 +1,43 @@
+From 91e9170242290a678083a53fd88510b1833336bf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 14 Sep 2021 23:20:58 +0200
+Subject: MIPS: lantiq: dma: add small delay after reset
+
+From: Aleksander Jan Bajkowski <olek2@wp.pl>
+
+[ Upstream commit c12aa581f6d5e80c3c3675ab26a52c2b3b62f76e ]
+
+Reading the DMA registers immediately after the reset causes
+Data Bus Error. Adding a small delay fixes this issue.
+
+Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/mips/lantiq/xway/dma.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/arch/mips/lantiq/xway/dma.c b/arch/mips/lantiq/xway/dma.c
+index aeb1b989cd4ee..24c6267f78698 100644
+--- a/arch/mips/lantiq/xway/dma.c
++++ b/arch/mips/lantiq/xway/dma.c
+@@ -11,6 +11,7 @@
+ #include <linux/export.h>
+ #include <linux/spinlock.h>
+ #include <linux/clk.h>
++#include <linux/delay.h>
+ #include <linux/err.h>
+ #include <lantiq_soc.h>
+@@ -221,6 +222,8 @@ ltq_dma_init(struct platform_device *pdev)
+       clk_enable(clk);
+       ltq_dma_w32_mask(0, DMA_RESET, LTQ_DMA_CTRL);
++      usleep_range(1, 10);
++
+       /* disable all interrupts */
+       ltq_dma_w32(0, LTQ_DMA_IRNEN);
+-- 
+2.33.0
+
diff --git a/queue-5.4/mips-lantiq-dma-reset-correct-number-of-channel.patch b/queue-5.4/mips-lantiq-dma-reset-correct-number-of-channel.patch
new file mode 100644 (file)
index 0000000..a0874b3
--- /dev/null
@@ -0,0 +1,79 @@
+From 84e8c5bf81e3b04bb0695e9e85eb676624ec2d99 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 14 Sep 2021 23:20:59 +0200
+Subject: MIPS: lantiq: dma: reset correct number of channel
+
+From: Aleksander Jan Bajkowski <olek2@wp.pl>
+
+[ Upstream commit 5ca9ce2ba4d5884cd94d1a856c675ab1242cd242 ]
+
+Different SoCs have a different number of channels, e.g .:
+* amazon-se has 10 channels,
+* danube+ar9 have 20 channels,
+* vr9 has 28 channels,
+* ar10 has 24 channels.
+
+We can read the ID register and, depending on the reported
+number of channels, reset the appropriate number of channels.
+
+Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/mips/lantiq/xway/dma.c | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/arch/mips/lantiq/xway/dma.c b/arch/mips/lantiq/xway/dma.c
+index 24c6267f78698..e45077aecf83a 100644
+--- a/arch/mips/lantiq/xway/dma.c
++++ b/arch/mips/lantiq/xway/dma.c
+@@ -30,6 +30,7 @@
+ #define LTQ_DMA_PCTRL         0x44
+ #define LTQ_DMA_IRNEN         0xf4
++#define DMA_ID_CHNR           GENMASK(26, 20) /* channel number */
+ #define DMA_DESCPT            BIT(3)          /* descriptor complete irq */
+ #define DMA_TX                        BIT(8)          /* TX channel direction */
+ #define DMA_CHAN_ON           BIT(0)          /* channel on / off bit */
+@@ -40,7 +41,6 @@
+ #define DMA_POLL              BIT(31)         /* turn on channel polling */
+ #define DMA_CLK_DIV4          BIT(6)          /* polling clock divider */
+ #define DMA_2W_BURST          BIT(1)          /* 2 word burst length */
+-#define DMA_MAX_CHANNEL               20              /* the soc has 20 channels */
+ #define DMA_ETOP_ENDIANNESS   (0xf << 8) /* endianness swap etop channels */
+ #define DMA_WEIGHT    (BIT(17) | BIT(16))     /* default channel wheight */
+@@ -206,7 +206,7 @@ ltq_dma_init(struct platform_device *pdev)
+ {
+       struct clk *clk;
+       struct resource *res;
+-      unsigned id;
++      unsigned int id, nchannels;
+       int i;
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+@@ -228,17 +228,18 @@ ltq_dma_init(struct platform_device *pdev)
+       ltq_dma_w32(0, LTQ_DMA_IRNEN);
+       /* reset/configure each channel */
+-      for (i = 0; i < DMA_MAX_CHANNEL; i++) {
++      id = ltq_dma_r32(LTQ_DMA_ID);
++      nchannels = ((id & DMA_ID_CHNR) >> 20);
++      for (i = 0; i < nchannels; i++) {
+               ltq_dma_w32(i, LTQ_DMA_CS);
+               ltq_dma_w32(DMA_CHAN_RST, LTQ_DMA_CCTRL);
+               ltq_dma_w32(DMA_POLL | DMA_CLK_DIV4, LTQ_DMA_CPOLL);
+               ltq_dma_w32_mask(DMA_CHAN_ON, 0, LTQ_DMA_CCTRL);
+       }
+-      id = ltq_dma_r32(LTQ_DMA_ID);
+       dev_info(&pdev->dev,
+               "Init done - hw rev: %X, ports: %d, channels: %d\n",
+-              id & 0x1f, (id >> 16) & 0xf, id >> 20);
++              id & 0x1f, (id >> 16) & 0xf, nchannels);
+       return 0;
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/mips-loongson64-make-cpu_loongson64-depends-on-mips_.patch b/queue-5.4/mips-loongson64-make-cpu_loongson64-depends-on-mips_.patch
new file mode 100644 (file)
index 0000000..be284da
--- /dev/null
@@ -0,0 +1,50 @@
+From 07dc69cb66d1cd5c84b7c40219671827f890b493 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 13 Sep 2021 14:19:08 +0800
+Subject: MIPS: loongson64: make CPU_LOONGSON64 depends on MIPS_FP_SUPPORT
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Jackie Liu <liuyun01@kylinos.cn>
+
+[ Upstream commit 7f3b3c2bfa9c93ab9b5595543496f570983dc330 ]
+
+mach/loongson64 fails to build when the FPU support is disabled:
+
+arch/mips/loongson64/cop2-ex.c:45:15: error: implicit declaration of function â€˜__is_fpu_owner’; did you mean â€˜is_fpu_owner’? [-Werror=implicit-function-declaration]
+arch/mips/loongson64/cop2-ex.c:98:30: error: â€˜struct thread_struct’ has no member named â€˜fpu’
+arch/mips/loongson64/cop2-ex.c:99:30: error: â€˜struct thread_struct’ has no member named â€˜fpu’
+arch/mips/loongson64/cop2-ex.c:131:43: error: â€˜struct thread_struct’ has no member named â€˜fpu’
+arch/mips/loongson64/cop2-ex.c:137:38: error: â€˜struct thread_struct’ has no member named â€˜fpu’
+arch/mips/loongson64/cop2-ex.c:203:30: error: â€˜struct thread_struct’ has no member named â€˜fpu’
+arch/mips/loongson64/cop2-ex.c:219:30: error: â€˜struct thread_struct’ has no member named â€˜fpu’
+arch/mips/loongson64/cop2-ex.c:283:38: error: â€˜struct thread_struct’ has no member named â€˜fpu’
+arch/mips/loongson64/cop2-ex.c:301:38: error: â€˜struct thread_struct’ has no member named â€˜fpu’
+
+Fixes: ef2f826c8f2f ("MIPS: Loongson-3: Enable the COP2 usage")
+Suggested-by: Huacai Chen <chenhuacai@kernel.org>
+Reviewed-by: Huacai Chen <chenhuacai@kernel.org>
+Reported-by: k2ci robot <kernel-bot@kylinos.cn>
+Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
+Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/mips/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
+index 2bfef67d52c63..041d34975ea2c 100644
+--- a/arch/mips/Kconfig
++++ b/arch/mips/Kconfig
+@@ -1393,6 +1393,7 @@ config CPU_LOONGSON3
+       select WEAK_REORDERING_BEYOND_LLSC
+       select MIPS_PGD_C0_CONTEXT
+       select MIPS_L1_CACHE_SHIFT_6
++      select MIPS_FP_SUPPORT
+       select GPIOLIB
+       select SWIOTLB
+       help
+-- 
+2.33.0
+
diff --git a/queue-5.4/mm-zsmalloc.c-close-race-window-between-zs_pool_dec_.patch b/queue-5.4/mm-zsmalloc.c-close-race-window-between-zs_pool_dec_.patch
new file mode 100644 (file)
index 0000000..7072000
--- /dev/null
@@ -0,0 +1,65 @@
+From 75e49343bd1bb5584e530302362ead0e8c58043f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 5 Nov 2021 13:45:03 -0700
+Subject: mm/zsmalloc.c: close race window between zs_pool_dec_isolated() and
+ zs_unregister_migration()
+
+From: Miaohe Lin <linmiaohe@huawei.com>
+
+[ Upstream commit afe8605ca45424629fdddfd85984b442c763dc47 ]
+
+There is one possible race window between zs_pool_dec_isolated() and
+zs_unregister_migration() because wait_for_isolated_drain() checks the
+isolated count without holding class->lock and there is no order inside
+zs_pool_dec_isolated().  Thus the below race window could be possible:
+
+  zs_pool_dec_isolated         zs_unregister_migration
+    check pool->destroying != 0
+                                 pool->destroying = true;
+                                 smp_mb();
+                                 wait_for_isolated_drain()
+                                   wait for pool->isolated_pages == 0
+    atomic_long_dec(&pool->isolated_pages);
+    atomic_long_read(&pool->isolated_pages) == 0
+
+Since we observe the pool->destroying (false) before atomic_long_dec()
+for pool->isolated_pages, waking pool->migration_wait up is missed.
+
+Fix this by ensure checking pool->destroying happens after the
+atomic_long_dec(&pool->isolated_pages).
+
+Link: https://lkml.kernel.org/r/20210708115027.7557-1-linmiaohe@huawei.com
+Fixes: 701d678599d0 ("mm/zsmalloc.c: fix race condition in zs_destroy_pool")
+Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
+Cc: Minchan Kim <minchan@kernel.org>
+Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
+Cc: Henry Burns <henryburns@google.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ mm/zsmalloc.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
+index 443b3b1c95818..490e5f3ae614a 100644
+--- a/mm/zsmalloc.c
++++ b/mm/zsmalloc.c
+@@ -1835,10 +1835,11 @@ static inline void zs_pool_dec_isolated(struct zs_pool *pool)
+       VM_BUG_ON(atomic_long_read(&pool->isolated_pages) <= 0);
+       atomic_long_dec(&pool->isolated_pages);
+       /*
+-       * There's no possibility of racing, since wait_for_isolated_drain()
+-       * checks the isolated count under &class->lock after enqueuing
+-       * on migration_wait.
++       * Checking pool->destroying must happen after atomic_long_dec()
++       * for pool->isolated_pages above. Paired with the smp_mb() in
++       * zs_unregister_migration().
+        */
++      smp_mb__after_atomic();
+       if (atomic_long_read(&pool->isolated_pages) == 0 && pool->destroying)
+               wake_up_all(&pool->migration_wait);
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/mmc-mxs-mmc-disable-regulator-on-error-and-in-the-re.patch b/queue-5.4/mmc-mxs-mmc-disable-regulator-on-error-and-in-the-re.patch
new file mode 100644 (file)
index 0000000..3c85132
--- /dev/null
@@ -0,0 +1,55 @@
+From 0c713423edf8e06b1b765437ed9428c54059ddcf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 16 Oct 2021 08:21:44 +0200
+Subject: mmc: mxs-mmc: disable regulator on error and in the remove function
+
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+
+[ Upstream commit ce5f6c2c9b0fcb4094f8e162cfd37fb4294204f7 ]
+
+The 'reg_vmmc' regulator is enabled in the probe. It is never disabled.
+Neither in the error handling path of the probe nor in the remove
+function.
+
+Register a devm_action to disable it when needed.
+
+Fixes: 4dc5a79f1350 ("mmc: mxs-mmc: enable regulator for mmc slot")
+Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Link: https://lore.kernel.org/r/4aadb3c97835f7b80f00819c3d549e6130384e67.1634365151.git.christophe.jaillet@wanadoo.fr
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/mmc/host/mxs-mmc.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
+index 52054931c3507..3a90037254a4d 100644
+--- a/drivers/mmc/host/mxs-mmc.c
++++ b/drivers/mmc/host/mxs-mmc.c
+@@ -565,6 +565,11 @@ static const struct of_device_id mxs_mmc_dt_ids[] = {
+ };
+ MODULE_DEVICE_TABLE(of, mxs_mmc_dt_ids);
++static void mxs_mmc_regulator_disable(void *regulator)
++{
++      regulator_disable(regulator);
++}
++
+ static int mxs_mmc_probe(struct platform_device *pdev)
+ {
+       const struct of_device_id *of_id =
+@@ -606,6 +611,11 @@ static int mxs_mmc_probe(struct platform_device *pdev)
+                               "Failed to enable vmmc regulator: %d\n", ret);
+                       goto out_mmc_free;
+               }
++
++              ret = devm_add_action_or_reset(&pdev->dev, mxs_mmc_regulator_disable,
++                                             reg_vmmc);
++              if (ret)
++                      goto out_mmc_free;
+       }
+       ssp->clk = devm_clk_get(&pdev->dev, NULL);
+-- 
+2.33.0
+
diff --git a/queue-5.4/mmc-sdhci-omap-fix-null-pointer-exception-if-regulat.patch b/queue-5.4/mmc-sdhci-omap-fix-null-pointer-exception-if-regulat.patch
new file mode 100644 (file)
index 0000000..d0447c1
--- /dev/null
@@ -0,0 +1,55 @@
+From 6d486e15c159342dfd97f9b198c856b61e51ff4a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 Sep 2021 14:00:25 +0300
+Subject: mmc: sdhci-omap: Fix NULL pointer exception if regulator is not
+ configured
+
+From: Tony Lindgren <tony@atomide.com>
+
+[ Upstream commit 8e0e7bd38b1ec7f9e5d18725ad41828be4e09859 ]
+
+If sdhci-omap is configured for an unused device instance and the device
+is not set as disabled, we can get a NULL pointer dereference:
+
+Unable to handle kernel NULL pointer dereference at virtual address
+00000045
+...
+(regulator_set_voltage) from [<c07d7008>] (mmc_regulator_set_ocr+0x44/0xd0)
+(mmc_regulator_set_ocr) from [<c07e2d80>] (sdhci_set_ios+0xa4/0x490)
+(sdhci_set_ios) from [<c07ea690>] (sdhci_omap_set_ios+0x124/0x160)
+(sdhci_omap_set_ios) from [<c07c8e94>] (mmc_power_up.part.0+0x3c/0x154)
+(mmc_power_up.part.0) from [<c07c9d20>] (mmc_start_host+0x88/0x9c)
+(mmc_start_host) from [<c07cad34>] (mmc_add_host+0x58/0x7c)
+(mmc_add_host) from [<c07e2574>] (__sdhci_add_host+0xf0/0x22c)
+(__sdhci_add_host) from [<c07eaf68>] (sdhci_omap_probe+0x318/0x72c)
+(sdhci_omap_probe) from [<c06a39d8>] (platform_probe+0x58/0xb8)
+
+AFAIK we are not seeing this with the devices configured in the mainline
+kernel but this can cause issues for folks bringing up their boards.
+
+Fixes: 7d326930d352 ("mmc: sdhci-omap: Add OMAP SDHCI driver")
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Link: https://lore.kernel.org/r/20210921110029.21944-2-tony@atomide.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/mmc/host/sdhci-omap.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
+index d3135249b2e40..346ca41b28f8b 100644
+--- a/drivers/mmc/host/sdhci-omap.c
++++ b/drivers/mmc/host/sdhci-omap.c
+@@ -675,7 +675,8 @@ static void sdhci_omap_set_power(struct sdhci_host *host, unsigned char mode,
+ {
+       struct mmc_host *mmc = host->mmc;
+-      mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
++      if (!IS_ERR(mmc->supply.vmmc))
++              mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
+ }
+ static int sdhci_omap_enable_dma(struct sdhci_host *host)
+-- 
+2.33.0
+
diff --git a/queue-5.4/mt76-mt76x02-fix-endianness-warnings-in-mt76x02_mac..patch b/queue-5.4/mt76-mt76x02-fix-endianness-warnings-in-mt76x02_mac..patch
new file mode 100644 (file)
index 0000000..8a2b758
--- /dev/null
@@ -0,0 +1,87 @@
+From 3570c2782aad5f8bc01dd6e41a0ab612defeee52 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 22 Jun 2021 09:48:30 +0200
+Subject: mt76: mt76x02: fix endianness warnings in mt76x02_mac.c
+
+From: Lorenzo Bianconi <lorenzo@kernel.org>
+
+[ Upstream commit c33edef520213feccebc22c9474c685b9fb60611 ]
+
+Fix the following sparse warning in mt76x02_mac_write_txwi and
+mt76x02_mac_tx_rate_val routines:
+drivers/net/wireless/mediatek/mt76/mt76x02_mac.c:237:19:
+       warning: restricted __le16 degrades to intege
+       warning: cast from restricted __le16
+drivers/net/wireless/mediatek/mt76/mt76x02_mac.c:383:28:
+       warning: incorrect type in assignment (different base types)
+       expected restricted __le16 [usertype] rate
+       got unsigned long
+
+Fixes: db9f11d3433f7 ("mt76: store wcid tx rate info in one u32 reduce locking")
+Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
+index abacb4ea7179d..5c12cd7fce940 100644
+--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
++++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
+@@ -154,7 +154,7 @@ void mt76x02_mac_wcid_set_drop(struct mt76x02_dev *dev, u8 idx, bool drop)
+               mt76_wr(dev, MT_WCID_DROP(idx), (val & ~bit) | (bit * drop));
+ }
+-static __le16
++static u16
+ mt76x02_mac_tx_rate_val(struct mt76x02_dev *dev,
+                       const struct ieee80211_tx_rate *rate, u8 *nss_val)
+ {
+@@ -200,14 +200,14 @@ mt76x02_mac_tx_rate_val(struct mt76x02_dev *dev,
+               rateval |= MT_RXWI_RATE_SGI;
+       *nss_val = nss;
+-      return cpu_to_le16(rateval);
++      return rateval;
+ }
+ void mt76x02_mac_wcid_set_rate(struct mt76x02_dev *dev, struct mt76_wcid *wcid,
+                              const struct ieee80211_tx_rate *rate)
+ {
+       s8 max_txpwr_adj = mt76x02_tx_get_max_txpwr_adj(dev, rate);
+-      __le16 rateval;
++      u16 rateval;
+       u32 tx_info;
+       s8 nss;
+@@ -320,7 +320,7 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
+       struct ieee80211_key_conf *key = info->control.hw_key;
+       u32 wcid_tx_info;
+       u16 rate_ht_mask = FIELD_PREP(MT_RXWI_RATE_PHY, BIT(1) | BIT(2));
+-      u16 txwi_flags = 0;
++      u16 txwi_flags = 0, rateval;
+       u8 nss;
+       s8 txpwr_adj, max_txpwr_adj;
+       u8 ccmp_pn[8], nstreams = dev->mt76.chainmask & 0xf;
+@@ -356,14 +356,15 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
+       if (wcid && (rate->idx < 0 || !rate->count)) {
+               wcid_tx_info = wcid->tx_info;
+-              txwi->rate = FIELD_GET(MT_WCID_TX_INFO_RATE, wcid_tx_info);
++              rateval = FIELD_GET(MT_WCID_TX_INFO_RATE, wcid_tx_info);
+               max_txpwr_adj = FIELD_GET(MT_WCID_TX_INFO_TXPWR_ADJ,
+                                         wcid_tx_info);
+               nss = FIELD_GET(MT_WCID_TX_INFO_NSS, wcid_tx_info);
+       } else {
+-              txwi->rate = mt76x02_mac_tx_rate_val(dev, rate, &nss);
++              rateval = mt76x02_mac_tx_rate_val(dev, rate, &nss);
+               max_txpwr_adj = mt76x02_tx_get_max_txpwr_adj(dev, rate);
+       }
++      txwi->rate = cpu_to_le16(rateval);
+       txpwr_adj = mt76x02_tx_get_txpwr_adj(dev, dev->mt76.txpower_conf,
+                                            max_txpwr_adj);
+-- 
+2.33.0
+
diff --git a/queue-5.4/mtd-core-don-t-remove-debugfs-directory-if-device-is.patch b/queue-5.4/mtd-core-don-t-remove-debugfs-directory-if-device-is.patch
new file mode 100644 (file)
index 0000000..e003db3
--- /dev/null
@@ -0,0 +1,48 @@
+From 85ef918b63ceb31e409c6f88b23a71e07d7ed2c8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 14 Oct 2021 13:39:52 -0700
+Subject: mtd: core: don't remove debugfs directory if device is in use
+
+From: Zev Weiss <zev@bewilderbeest.net>
+
+[ Upstream commit c13de2386c78e890d4ae6f01a85eefd0b293fb08 ]
+
+Previously, if del_mtd_device() failed with -EBUSY due to a non-zero
+usecount, a subsequent call to attempt the deletion again would try to
+remove a debugfs directory that had already been removed and panic.
+With this change the second call can instead proceed safely.
+
+Fixes: e8e3edb95ce6 ("mtd: create per-device and module-scope debugfs entries")
+Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/linux-mtd/20211014203953.5424-1-zev@bewilderbeest.net
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/mtd/mtdcore.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
+index 32a76b8feaa5d..ac5d3b6db9b84 100644
+--- a/drivers/mtd/mtdcore.c
++++ b/drivers/mtd/mtdcore.c
+@@ -727,8 +727,6 @@ int del_mtd_device(struct mtd_info *mtd)
+       mutex_lock(&mtd_table_mutex);
+-      debugfs_remove_recursive(mtd->dbg.dfs_dir);
+-
+       if (idr_find(&mtd_idr, mtd->index) != mtd) {
+               ret = -ENODEV;
+               goto out_error;
+@@ -744,6 +742,8 @@ int del_mtd_device(struct mtd_info *mtd)
+                      mtd->index, mtd->name, mtd->usecount);
+               ret = -EBUSY;
+       } else {
++              debugfs_remove_recursive(mtd->dbg.dfs_dir);
++
+               /* Try to remove the NVMEM provider */
+               if (mtd->nvmem)
+                       nvmem_unregister(mtd->nvmem);
+-- 
+2.33.0
+
diff --git a/queue-5.4/mtd-spi-nor-hisi-sfc-remove-excessive-clk_disable_un.patch b/queue-5.4/mtd-spi-nor-hisi-sfc-remove-excessive-clk_disable_un.patch
new file mode 100644 (file)
index 0000000..0323ce7
--- /dev/null
@@ -0,0 +1,42 @@
+From cd5248784bbb351fff1370eb6dc0eb9b2c485e50 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 9 Jul 2021 17:45:29 +0300
+Subject: mtd: spi-nor: hisi-sfc: Remove excessive clk_disable_unprepare()
+
+From: Evgeny Novikov <novikov@ispras.ru>
+
+[ Upstream commit 78e4d342187625585932bb437ec26e1060f7fc6f ]
+
+hisi_spi_nor_probe() invokes clk_disable_unprepare() on all paths after
+successful call of clk_prepare_enable(). Besides, the clock is enabled by
+hispi_spi_nor_prep() and disabled by hispi_spi_nor_unprep(). So at remove
+time it is not possible to have the clock enabled. The patch removes
+excessive clk_disable_unprepare() from hisi_spi_nor_remove().
+
+Found by Linux Driver Verification project (linuxtesting.org).
+
+Fixes: e523f11141bd ("mtd: spi-nor: add hisilicon spi-nor flash controller driver")
+Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
+Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
+Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
+Link: https://lore.kernel.org/r/20210709144529.31379-1-novikov@ispras.ru
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/mtd/spi-nor/hisi-sfc.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/mtd/spi-nor/hisi-sfc.c b/drivers/mtd/spi-nor/hisi-sfc.c
+index 8fcc48056a8bc..569cfd473c87b 100644
+--- a/drivers/mtd/spi-nor/hisi-sfc.c
++++ b/drivers/mtd/spi-nor/hisi-sfc.c
+@@ -474,7 +474,6 @@ static int hisi_spi_nor_remove(struct platform_device *pdev)
+       hisi_spi_nor_unregister_all(host);
+       mutex_destroy(&host->lock);
+-      clk_disable_unprepare(host->clk);
+       return 0;
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/mwifiex-properly-initialize-private-structure-on-int.patch b/queue-5.4/mwifiex-properly-initialize-private-structure-on-int.patch
new file mode 100644 (file)
index 0000000..4656c11
--- /dev/null
@@ -0,0 +1,65 @@
+From ba3e958a40e1c93859a8a337e619414dc65a931f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 14 Sep 2021 21:59:08 +0200
+Subject: mwifiex: Properly initialize private structure on interface type
+ changes
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Jonas Dreßler <verdre@v0yd.nl>
+
+[ Upstream commit c606008b70627a2fc485732a53cc22f0f66d0981 ]
+
+When creating a new virtual interface in mwifiex_add_virtual_intf(), we
+update our internal driver states like bss_type, bss_priority, bss_role
+and bss_mode to reflect the mode the firmware will be set to.
+
+When switching virtual interface mode using
+mwifiex_init_new_priv_params() though, we currently only update bss_mode
+and bss_role. In order for the interface mode switch to actually work,
+we also need to update bss_type to its proper value, so do that.
+
+This fixes a crash of the firmware (because the driver tries to execute
+commands that are invalid in AP mode) when switching from station mode
+to AP mode.
+
+Signed-off-by: Jonas Dreßler <verdre@v0yd.nl>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/20210914195909.36035-9-verdre@v0yd.nl
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/marvell/mwifiex/cfg80211.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+index b5134f11fc32b..1599ae74b066b 100644
+--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
++++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+@@ -912,16 +912,20 @@ mwifiex_init_new_priv_params(struct mwifiex_private *priv,
+       switch (type) {
+       case NL80211_IFTYPE_STATION:
+       case NL80211_IFTYPE_ADHOC:
+-              priv->bss_role =  MWIFIEX_BSS_ROLE_STA;
++              priv->bss_role = MWIFIEX_BSS_ROLE_STA;
++              priv->bss_type = MWIFIEX_BSS_TYPE_STA;
+               break;
+       case NL80211_IFTYPE_P2P_CLIENT:
+-              priv->bss_role =  MWIFIEX_BSS_ROLE_STA;
++              priv->bss_role = MWIFIEX_BSS_ROLE_STA;
++              priv->bss_type = MWIFIEX_BSS_TYPE_P2P;
+               break;
+       case NL80211_IFTYPE_P2P_GO:
+-              priv->bss_role =  MWIFIEX_BSS_ROLE_UAP;
++              priv->bss_role = MWIFIEX_BSS_ROLE_UAP;
++              priv->bss_type = MWIFIEX_BSS_TYPE_P2P;
+               break;
+       case NL80211_IFTYPE_AP:
+               priv->bss_role = MWIFIEX_BSS_ROLE_UAP;
++              priv->bss_type = MWIFIEX_BSS_TYPE_UAP;
+               break;
+       default:
+               mwifiex_dbg(adapter, ERROR,
+-- 
+2.33.0
+
diff --git a/queue-5.4/mwifiex-run-set_bss_mode-when-changing-from-p2p-to-s.patch b/queue-5.4/mwifiex-run-set_bss_mode-when-changing-from-p2p-to-s.patch
new file mode 100644 (file)
index 0000000..c23f5bc
--- /dev/null
@@ -0,0 +1,77 @@
+From 525935a03afd94651daa57d0ec1f121e115a55da Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 14 Sep 2021 21:59:03 +0200
+Subject: mwifiex: Run SET_BSS_MODE when changing from P2P to STATION vif-type
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Jonas Dreßler <verdre@v0yd.nl>
+
+[ Upstream commit c2e9666cdffd347460a2b17988db4cfaf2a68fb9 ]
+
+We currently handle changing from the P2P to the STATION virtual
+interface type slightly different than changing from P2P to ADHOC: When
+changing to STATION, we don't send the SET_BSS_MODE command. We do send
+that command on all other type-changes though, and it probably makes
+sense to send the command since after all we just changed our BSS_MODE.
+Looking at prior changes to this part of the code, it seems that this is
+simply a leftover from old refactorings.
+
+Since sending the SET_BSS_MODE command is the only difference between
+mwifiex_change_vif_to_sta_adhoc() and the current code, we can now use
+mwifiex_change_vif_to_sta_adhoc() for both switching to ADHOC and
+STATION interface type.
+
+This does not fix any particular bug and just "looked right", so there's
+a small chance it might be a regression.
+
+Signed-off-by: Jonas Dreßler <verdre@v0yd.nl>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/20210914195909.36035-4-verdre@v0yd.nl
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../net/wireless/marvell/mwifiex/cfg80211.c   | 22 ++++---------------
+ 1 file changed, 4 insertions(+), 18 deletions(-)
+
+diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+index 9e6dc289ec3e8..b5134f11fc32b 100644
+--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
++++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+@@ -1233,29 +1233,15 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
+               break;
+       case NL80211_IFTYPE_P2P_CLIENT:
+       case NL80211_IFTYPE_P2P_GO:
++              if (mwifiex_cfg80211_deinit_p2p(priv))
++                      return -EFAULT;
++
+               switch (type) {
+-              case NL80211_IFTYPE_STATION:
+-                      if (mwifiex_cfg80211_deinit_p2p(priv))
+-                              return -EFAULT;
+-                      priv->adapter->curr_iface_comb.p2p_intf--;
+-                      priv->adapter->curr_iface_comb.sta_intf++;
+-                      dev->ieee80211_ptr->iftype = type;
+-                      if (mwifiex_deinit_priv_params(priv))
+-                              return -1;
+-                      if (mwifiex_init_new_priv_params(priv, dev, type))
+-                              return -1;
+-                      if (mwifiex_sta_init_cmd(priv, false, false))
+-                              return -1;
+-                      break;
+               case NL80211_IFTYPE_ADHOC:
+-                      if (mwifiex_cfg80211_deinit_p2p(priv))
+-                              return -EFAULT;
++              case NL80211_IFTYPE_STATION:
+                       return mwifiex_change_vif_to_sta_adhoc(dev, curr_iftype,
+                                                              type, params);
+-                      break;
+               case NL80211_IFTYPE_AP:
+-                      if (mwifiex_cfg80211_deinit_p2p(priv))
+-                              return -EFAULT;
+                       return mwifiex_change_vif_to_ap(dev, curr_iftype, type,
+                                                       params);
+               case NL80211_IFTYPE_UNSPECIFIED:
+-- 
+2.33.0
+
diff --git a/queue-5.4/mwifiex-send-delba-requests-according-to-spec.patch b/queue-5.4/mwifiex-send-delba-requests-according-to-spec.patch
new file mode 100644 (file)
index 0000000..997ecbc
--- /dev/null
@@ -0,0 +1,56 @@
+From 1a3d0721e46690d2494707895b791d77a5eb7c3a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 16 Oct 2021 17:32:43 +0200
+Subject: mwifiex: Send DELBA requests according to spec
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Jonas Dreßler <verdre@v0yd.nl>
+
+[ Upstream commit cc8a8bc37466f79b24d972555237f3d591150602 ]
+
+While looking at on-air packets using Wireshark, I noticed we're never
+setting the initiator bit when sending DELBA requests to the AP: While
+we set the bit on our del_ba_param_set bitmask, we forget to actually
+copy that bitmask over to the command struct, which means we never
+actually set the initiator bit.
+
+Fix that and copy the bitmask over to the host_cmd_ds_11n_delba command
+struct.
+
+Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell mwifiex driver")
+Signed-off-by: Jonas Dreßler <verdre@v0yd.nl>
+Acked-by: Pali Rohár <pali@kernel.org>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/20211016153244.24353-5-verdre@v0yd.nl
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/marvell/mwifiex/11n.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/wireless/marvell/mwifiex/11n.c b/drivers/net/wireless/marvell/mwifiex/11n.c
+index e435f801bc912..acbef9f1a83b6 100644
+--- a/drivers/net/wireless/marvell/mwifiex/11n.c
++++ b/drivers/net/wireless/marvell/mwifiex/11n.c
+@@ -657,14 +657,15 @@ int mwifiex_send_delba(struct mwifiex_private *priv, int tid, u8 *peer_mac,
+       uint16_t del_ba_param_set;
+       memset(&delba, 0, sizeof(delba));
+-      delba.del_ba_param_set = cpu_to_le16(tid << DELBA_TID_POS);
+-      del_ba_param_set = le16_to_cpu(delba.del_ba_param_set);
++      del_ba_param_set = tid << DELBA_TID_POS;
++
+       if (initiator)
+               del_ba_param_set |= IEEE80211_DELBA_PARAM_INITIATOR_MASK;
+       else
+               del_ba_param_set &= ~IEEE80211_DELBA_PARAM_INITIATOR_MASK;
++      delba.del_ba_param_set = cpu_to_le16(del_ba_param_set);
+       memcpy(&delba.peer_mac_addr, peer_mac, ETH_ALEN);
+       /* We don't wait for the response of this command */
+-- 
+2.33.0
+
diff --git a/queue-5.4/mwl8k-fix-use-after-free-in-mwl8k_fw_state_machine.patch b/queue-5.4/mwl8k-fix-use-after-free-in-mwl8k_fw_state_machine.patch
new file mode 100644 (file)
index 0000000..ce50b89
--- /dev/null
@@ -0,0 +1,61 @@
+From ddf90f03a6327f764dde5483294c069c67c56f72 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 16 Oct 2021 04:02:59 +0000
+Subject: mwl8k: Fix use-after-free in mwl8k_fw_state_machine()
+
+From: Zheyu Ma <zheyuma97@gmail.com>
+
+[ Upstream commit 257051a235c17e33782b6e24a4b17f2d7915aaec ]
+
+When the driver fails to request the firmware, it calls its error
+handler. In the error handler, the driver detaches device from driver
+first before releasing the firmware, which can cause a use-after-free bug.
+
+Fix this by releasing firmware first.
+
+The following log reveals it:
+
+[    9.007301 ] BUG: KASAN: use-after-free in mwl8k_fw_state_machine+0x320/0xba0
+[    9.010143 ] Workqueue: events request_firmware_work_func
+[    9.010830 ] Call Trace:
+[    9.010830 ]  dump_stack_lvl+0xa8/0xd1
+[    9.010830 ]  print_address_description+0x87/0x3b0
+[    9.010830 ]  kasan_report+0x172/0x1c0
+[    9.010830 ]  ? mutex_unlock+0xd/0x10
+[    9.010830 ]  ? mwl8k_fw_state_machine+0x320/0xba0
+[    9.010830 ]  ? mwl8k_fw_state_machine+0x320/0xba0
+[    9.010830 ]  __asan_report_load8_noabort+0x14/0x20
+[    9.010830 ]  mwl8k_fw_state_machine+0x320/0xba0
+[    9.010830 ]  ? mwl8k_load_firmware+0x5f0/0x5f0
+[    9.010830 ]  request_firmware_work_func+0x172/0x250
+[    9.010830 ]  ? read_lock_is_recursive+0x20/0x20
+[    9.010830 ]  ? process_one_work+0x7a1/0x1100
+[    9.010830 ]  ? request_firmware_nowait+0x460/0x460
+[    9.010830 ]  ? __this_cpu_preempt_check+0x13/0x20
+[    9.010830 ]  process_one_work+0x9bb/0x1100
+
+Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/1634356979-6211-1-git-send-email-zheyuma97@gmail.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/marvell/mwl8k.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/marvell/mwl8k.c b/drivers/net/wireless/marvell/mwl8k.c
+index 1b76b24191866..14ac2384218df 100644
+--- a/drivers/net/wireless/marvell/mwl8k.c
++++ b/drivers/net/wireless/marvell/mwl8k.c
+@@ -5796,8 +5796,8 @@ static void mwl8k_fw_state_machine(const struct firmware *fw, void *context)
+ fail:
+       priv->fw_state = FW_STATE_ERROR;
+       complete(&priv->firmware_loading_complete);
+-      device_release_driver(&priv->pdev->dev);
+       mwl8k_release_firmware(priv);
++      device_release_driver(&priv->pdev->dev);
+ }
+ #define MAX_RESTART_ATTEMPTS 1
+-- 
+2.33.0
+
diff --git a/queue-5.4/net-amd-xgbe-toggle-pll-settings-during-rate-change.patch b/queue-5.4/net-amd-xgbe-toggle-pll-settings-during-rate-change.patch
new file mode 100644 (file)
index 0000000..af5e304
--- /dev/null
@@ -0,0 +1,110 @@
+From eefd7ac9c893e4c263d19f4d1e6482f8cdb9b6d7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Oct 2021 15:27:27 +0530
+Subject: net: amd-xgbe: Toggle PLL settings during rate change
+
+From: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
+
+[ Upstream commit daf182d360e509a494db18666799f4e85d83dda0 ]
+
+For each rate change command submission, the FW has to do a phy
+power off sequence internally. For this to happen correctly, the
+PLL re-initialization control setting has to be turned off before
+sending mailbox commands and re-enabled once the command submission
+is complete.
+
+Without the PLL control setting, the link up takes longer time in a
+fixed phy configuration.
+
+Fixes: 47f164deab22 ("amd-xgbe: Add PCI device support")
+Co-developed-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
+Signed-off-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
+Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
+Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/amd/xgbe/xgbe-common.h |  8 ++++++++
+ drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 20 +++++++++++++++++++-
+ 2 files changed, 27 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-common.h b/drivers/net/ethernet/amd/xgbe/xgbe-common.h
+index b2cd3bdba9f89..533b8519ec352 100644
+--- a/drivers/net/ethernet/amd/xgbe/xgbe-common.h
++++ b/drivers/net/ethernet/amd/xgbe/xgbe-common.h
+@@ -1331,6 +1331,10 @@
+ #define MDIO_VEND2_PMA_CDR_CONTROL    0x8056
+ #endif
++#ifndef MDIO_VEND2_PMA_MISC_CTRL0
++#define MDIO_VEND2_PMA_MISC_CTRL0     0x8090
++#endif
++
+ #ifndef MDIO_CTRL1_SPEED1G
+ #define MDIO_CTRL1_SPEED1G            (MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100)
+ #endif
+@@ -1389,6 +1393,10 @@
+ #define XGBE_PMA_RX_RST_0_RESET_ON    0x10
+ #define XGBE_PMA_RX_RST_0_RESET_OFF   0x00
++#define XGBE_PMA_PLL_CTRL_MASK                BIT(15)
++#define XGBE_PMA_PLL_CTRL_ENABLE      BIT(15)
++#define XGBE_PMA_PLL_CTRL_DISABLE     0x0000
++
+ /* Bit setting and getting macros
+  *  The get macro will extract the current bit field value from within
+  *  the variable
+diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+index d6f6afb67bcc6..0b325ae875b52 100644
+--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
++++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+@@ -1972,12 +1972,26 @@ static void xgbe_phy_rx_reset(struct xgbe_prv_data *pdata)
+       }
+ }
++static void xgbe_phy_pll_ctrl(struct xgbe_prv_data *pdata, bool enable)
++{
++      XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_VEND2_PMA_MISC_CTRL0,
++                       XGBE_PMA_PLL_CTRL_MASK,
++                       enable ? XGBE_PMA_PLL_CTRL_ENABLE
++                              : XGBE_PMA_PLL_CTRL_DISABLE);
++
++      /* Wait for command to complete */
++      usleep_range(100, 200);
++}
++
+ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
+                                       unsigned int cmd, unsigned int sub_cmd)
+ {
+       unsigned int s0 = 0;
+       unsigned int wait;
++      /* Disable PLL re-initialization during FW command processing */
++      xgbe_phy_pll_ctrl(pdata, false);
++
+       /* Log if a previous command did not complete */
+       if (XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS)) {
+               netif_dbg(pdata, link, pdata->netdev,
+@@ -1998,7 +2012,7 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
+       wait = XGBE_RATECHANGE_COUNT;
+       while (wait--) {
+               if (!XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS))
+-                      return;
++                      goto reenable_pll;
+               usleep_range(1000, 2000);
+       }
+@@ -2008,6 +2022,10 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
+       /* Reset on error */
+       xgbe_phy_rx_reset(pdata);
++
++reenable_pll:
++      /* Enable PLL re-initialization */
++      xgbe_phy_pll_ctrl(pdata, true);
+ }
+ static void xgbe_phy_rrc(struct xgbe_prv_data *pdata)
+-- 
+2.33.0
+
diff --git a/queue-5.4/net-annotate-data-race-in-neigh_output.patch b/queue-5.4/net-annotate-data-race-in-neigh_output.patch
new file mode 100644 (file)
index 0000000..052cd06
--- /dev/null
@@ -0,0 +1,148 @@
+From 88833c4c6d54d1d5f08bfc7a1adebbded27cf03c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 25 Oct 2021 11:15:55 -0700
+Subject: net: annotate data-race in neigh_output()
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit d18785e213866935b4c3dc0c33c3e18801ce0ce8 ]
+
+neigh_output() reads n->nud_state and hh->hh_len locklessly.
+
+This is fine, but we need to add annotations and document this.
+
+We evaluate skip_cache first to avoid reading these fields
+if the cache has to by bypassed.
+
+syzbot report:
+
+BUG: KCSAN: data-race in __neigh_event_send / ip_finish_output2
+
+write to 0xffff88810798a885 of 1 bytes by interrupt on cpu 1:
+ __neigh_event_send+0x40d/0xac0 net/core/neighbour.c:1128
+ neigh_event_send include/net/neighbour.h:444 [inline]
+ neigh_resolve_output+0x104/0x410 net/core/neighbour.c:1476
+ neigh_output include/net/neighbour.h:510 [inline]
+ ip_finish_output2+0x80a/0xaa0 net/ipv4/ip_output.c:221
+ ip_finish_output+0x3b5/0x510 net/ipv4/ip_output.c:309
+ NF_HOOK_COND include/linux/netfilter.h:296 [inline]
+ ip_output+0xf3/0x1a0 net/ipv4/ip_output.c:423
+ dst_output include/net/dst.h:450 [inline]
+ ip_local_out+0x164/0x220 net/ipv4/ip_output.c:126
+ __ip_queue_xmit+0x9d3/0xa20 net/ipv4/ip_output.c:525
+ ip_queue_xmit+0x34/0x40 net/ipv4/ip_output.c:539
+ __tcp_transmit_skb+0x142a/0x1a00 net/ipv4/tcp_output.c:1405
+ tcp_transmit_skb net/ipv4/tcp_output.c:1423 [inline]
+ tcp_xmit_probe_skb net/ipv4/tcp_output.c:4011 [inline]
+ tcp_write_wakeup+0x4a9/0x810 net/ipv4/tcp_output.c:4064
+ tcp_send_probe0+0x2c/0x2b0 net/ipv4/tcp_output.c:4079
+ tcp_probe_timer net/ipv4/tcp_timer.c:398 [inline]
+ tcp_write_timer_handler+0x394/0x520 net/ipv4/tcp_timer.c:626
+ tcp_write_timer+0xb9/0x180 net/ipv4/tcp_timer.c:642
+ call_timer_fn+0x2e/0x1d0 kernel/time/timer.c:1421
+ expire_timers+0x135/0x240 kernel/time/timer.c:1466
+ __run_timers+0x368/0x430 kernel/time/timer.c:1734
+ run_timer_softirq+0x19/0x30 kernel/time/timer.c:1747
+ __do_softirq+0x12c/0x26e kernel/softirq.c:558
+ invoke_softirq kernel/softirq.c:432 [inline]
+ __irq_exit_rcu kernel/softirq.c:636 [inline]
+ irq_exit_rcu+0x4e/0xa0 kernel/softirq.c:648
+ sysvec_apic_timer_interrupt+0x69/0x80 arch/x86/kernel/apic/apic.c:1097
+ asm_sysvec_apic_timer_interrupt+0x12/0x20
+ native_safe_halt arch/x86/include/asm/irqflags.h:51 [inline]
+ arch_safe_halt arch/x86/include/asm/irqflags.h:89 [inline]
+ acpi_safe_halt drivers/acpi/processor_idle.c:109 [inline]
+ acpi_idle_do_entry drivers/acpi/processor_idle.c:553 [inline]
+ acpi_idle_enter+0x258/0x2e0 drivers/acpi/processor_idle.c:688
+ cpuidle_enter_state+0x2b4/0x760 drivers/cpuidle/cpuidle.c:237
+ cpuidle_enter+0x3c/0x60 drivers/cpuidle/cpuidle.c:351
+ call_cpuidle kernel/sched/idle.c:158 [inline]
+ cpuidle_idle_call kernel/sched/idle.c:239 [inline]
+ do_idle+0x1a3/0x250 kernel/sched/idle.c:306
+ cpu_startup_entry+0x15/0x20 kernel/sched/idle.c:403
+ secondary_startup_64_no_verify+0xb1/0xbb
+
+read to 0xffff88810798a885 of 1 bytes by interrupt on cpu 0:
+ neigh_output include/net/neighbour.h:507 [inline]
+ ip_finish_output2+0x79a/0xaa0 net/ipv4/ip_output.c:221
+ ip_finish_output+0x3b5/0x510 net/ipv4/ip_output.c:309
+ NF_HOOK_COND include/linux/netfilter.h:296 [inline]
+ ip_output+0xf3/0x1a0 net/ipv4/ip_output.c:423
+ dst_output include/net/dst.h:450 [inline]
+ ip_local_out+0x164/0x220 net/ipv4/ip_output.c:126
+ __ip_queue_xmit+0x9d3/0xa20 net/ipv4/ip_output.c:525
+ ip_queue_xmit+0x34/0x40 net/ipv4/ip_output.c:539
+ __tcp_transmit_skb+0x142a/0x1a00 net/ipv4/tcp_output.c:1405
+ tcp_transmit_skb net/ipv4/tcp_output.c:1423 [inline]
+ tcp_xmit_probe_skb net/ipv4/tcp_output.c:4011 [inline]
+ tcp_write_wakeup+0x4a9/0x810 net/ipv4/tcp_output.c:4064
+ tcp_send_probe0+0x2c/0x2b0 net/ipv4/tcp_output.c:4079
+ tcp_probe_timer net/ipv4/tcp_timer.c:398 [inline]
+ tcp_write_timer_handler+0x394/0x520 net/ipv4/tcp_timer.c:626
+ tcp_write_timer+0xb9/0x180 net/ipv4/tcp_timer.c:642
+ call_timer_fn+0x2e/0x1d0 kernel/time/timer.c:1421
+ expire_timers+0x135/0x240 kernel/time/timer.c:1466
+ __run_timers+0x368/0x430 kernel/time/timer.c:1734
+ run_timer_softirq+0x19/0x30 kernel/time/timer.c:1747
+ __do_softirq+0x12c/0x26e kernel/softirq.c:558
+ invoke_softirq kernel/softirq.c:432 [inline]
+ __irq_exit_rcu kernel/softirq.c:636 [inline]
+ irq_exit_rcu+0x4e/0xa0 kernel/softirq.c:648
+ sysvec_apic_timer_interrupt+0x69/0x80 arch/x86/kernel/apic/apic.c:1097
+ asm_sysvec_apic_timer_interrupt+0x12/0x20
+ native_safe_halt arch/x86/include/asm/irqflags.h:51 [inline]
+ arch_safe_halt arch/x86/include/asm/irqflags.h:89 [inline]
+ acpi_safe_halt drivers/acpi/processor_idle.c:109 [inline]
+ acpi_idle_do_entry drivers/acpi/processor_idle.c:553 [inline]
+ acpi_idle_enter+0x258/0x2e0 drivers/acpi/processor_idle.c:688
+ cpuidle_enter_state+0x2b4/0x760 drivers/cpuidle/cpuidle.c:237
+ cpuidle_enter+0x3c/0x60 drivers/cpuidle/cpuidle.c:351
+ call_cpuidle kernel/sched/idle.c:158 [inline]
+ cpuidle_idle_call kernel/sched/idle.c:239 [inline]
+ do_idle+0x1a3/0x250 kernel/sched/idle.c:306
+ cpu_startup_entry+0x15/0x20 kernel/sched/idle.c:403
+ rest_init+0xee/0x100 init/main.c:734
+ arch_call_rest_init+0xa/0xb
+ start_kernel+0x5e4/0x669 init/main.c:1142
+ secondary_startup_64_no_verify+0xb1/0xbb
+
+value changed: 0x20 -> 0x01
+
+Reported by Kernel Concurrency Sanitizer on:
+CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.15.0-rc6-syzkaller #0
+Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
+
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Reported-by: syzbot <syzkaller@googlegroups.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/net/neighbour.h | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/include/net/neighbour.h b/include/net/neighbour.h
+index 2be8d6b0dfb69..4232bc8ce3d7d 100644
+--- a/include/net/neighbour.h
++++ b/include/net/neighbour.h
+@@ -505,10 +505,15 @@ static inline int neigh_output(struct neighbour *n, struct sk_buff *skb,
+ {
+       const struct hh_cache *hh = &n->hh;
+-      if ((n->nud_state & NUD_CONNECTED) && hh->hh_len && !skip_cache)
++      /* n->nud_state and hh->hh_len could be changed under us.
++       * neigh_hh_output() is taking care of the race later.
++       */
++      if (!skip_cache &&
++          (READ_ONCE(n->nud_state) & NUD_CONNECTED) &&
++          READ_ONCE(hh->hh_len))
+               return neigh_hh_output(hh, skb);
+-      else
+-              return n->output(n, skb);
++
++      return n->output(n, skb);
+ }
+ static inline struct neighbour *
+-- 
+2.33.0
+
diff --git a/queue-5.4/net-davinci_emac-fix-interrupt-pacing-disable.patch b/queue-5.4/net-davinci_emac-fix-interrupt-pacing-disable.patch
new file mode 100644 (file)
index 0000000..3b7482c
--- /dev/null
@@ -0,0 +1,59 @@
+From 6c1e7c9f7569e13a4a7b6253ac14e1364c175be2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 1 Nov 2021 18:23:41 +0300
+Subject: net: davinci_emac: Fix interrupt pacing disable
+
+From: Maxim Kiselev <bigunclemax@gmail.com>
+
+[ Upstream commit d52bcb47bdf971a59a2467975d2405fcfcb2fa19 ]
+
+This patch allows to use 0 for `coal->rx_coalesce_usecs` param to
+disable rx irq coalescing.
+
+Previously we could enable rx irq coalescing via ethtool
+(For ex: `ethtool -C eth0 rx-usecs 2000`) but we couldn't disable
+it because this part rejects 0 value:
+
+       if (!coal->rx_coalesce_usecs)
+               return -EINVAL;
+
+Fixes: 84da2658a619 ("TI DaVinci EMAC : Implement interrupt pacing functionality.")
+Signed-off-by: Maxim Kiselev <bigunclemax@gmail.com>
+Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
+Link: https://lore.kernel.org/r/20211101152343.4193233-1-bigunclemax@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/ti/davinci_emac.c | 16 ++++++++++++++--
+ 1 file changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
+index 6869c5c74b9f7..fac59032bf83a 100644
+--- a/drivers/net/ethernet/ti/davinci_emac.c
++++ b/drivers/net/ethernet/ti/davinci_emac.c
+@@ -412,8 +412,20 @@ static int emac_set_coalesce(struct net_device *ndev,
+       u32 int_ctrl, num_interrupts = 0;
+       u32 prescale = 0, addnl_dvdr = 1, coal_intvl = 0;
+-      if (!coal->rx_coalesce_usecs)
+-              return -EINVAL;
++      if (!coal->rx_coalesce_usecs) {
++              priv->coal_intvl = 0;
++
++              switch (priv->version) {
++              case EMAC_VERSION_2:
++                      emac_ctrl_write(EMAC_DM646X_CMINTCTRL, 0);
++                      break;
++              default:
++                      emac_ctrl_write(EMAC_CTRL_EWINTTCNT, 0);
++                      break;
++              }
++
++              return 0;
++      }
+       coal_intvl = coal->rx_coalesce_usecs;
+-- 
+2.33.0
+
diff --git a/queue-5.4/net-dsa-lantiq_gswip-serialize-access-to-the-pce-tab.patch b/queue-5.4/net-dsa-lantiq_gswip-serialize-access-to-the-pce-tab.patch
new file mode 100644 (file)
index 0000000..f6f218c
--- /dev/null
@@ -0,0 +1,121 @@
+From 5e2817afb9f9efd4d1d49235d9fb199a4ffe4b33 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 22 Oct 2021 21:43:08 +0300
+Subject: net: dsa: lantiq_gswip: serialize access to the PCE table
+
+From: Vladimir Oltean <vladimir.oltean@nxp.com>
+
+[ Upstream commit 49753a75b9a32de4c0393bb8d1e51ea223fda8e4 ]
+
+Looking at the code, the GSWIP switch appears to hold bridging service
+structures (VLANs, FDBs, forwarding rules) in PCE table entries.
+Hardware access to the PCE table is non-atomic, and is comprised of
+several register reads and writes.
+
+These accesses are currently serialized by the rtnl_lock, but DSA is
+changing its driver API and that lock will no longer be held when
+calling ->port_fdb_add() and ->port_fdb_del().
+
+So this driver needs to serialize the access to the PCE table using its
+own locking scheme. This patch adds that.
+
+Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/dsa/lantiq_gswip.c | 28 +++++++++++++++++++++++-----
+ 1 file changed, 23 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
+index 60e36f46f8abe..d612ef8648baa 100644
+--- a/drivers/net/dsa/lantiq_gswip.c
++++ b/drivers/net/dsa/lantiq_gswip.c
+@@ -274,6 +274,7 @@ struct gswip_priv {
+       int num_gphy_fw;
+       struct gswip_gphy_fw *gphy_fw;
+       u32 port_vlan_filter;
++      struct mutex pce_table_lock;
+ };
+ struct gswip_pce_table_entry {
+@@ -521,10 +522,14 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv,
+       u16 addr_mode = tbl->key_mode ? GSWIP_PCE_TBL_CTRL_OPMOD_KSRD :
+                                       GSWIP_PCE_TBL_CTRL_OPMOD_ADRD;
++      mutex_lock(&priv->pce_table_lock);
++
+       err = gswip_switch_r_timeout(priv, GSWIP_PCE_TBL_CTRL,
+                                    GSWIP_PCE_TBL_CTRL_BAS);
+-      if (err)
++      if (err) {
++              mutex_unlock(&priv->pce_table_lock);
+               return err;
++      }
+       gswip_switch_w(priv, tbl->index, GSWIP_PCE_TBL_ADDR);
+       gswip_switch_mask(priv, GSWIP_PCE_TBL_CTRL_ADDR_MASK |
+@@ -534,8 +539,10 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv,
+       err = gswip_switch_r_timeout(priv, GSWIP_PCE_TBL_CTRL,
+                                    GSWIP_PCE_TBL_CTRL_BAS);
+-      if (err)
++      if (err) {
++              mutex_unlock(&priv->pce_table_lock);
+               return err;
++      }
+       for (i = 0; i < ARRAY_SIZE(tbl->key); i++)
+               tbl->key[i] = gswip_switch_r(priv, GSWIP_PCE_TBL_KEY(i));
+@@ -551,6 +558,8 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv,
+       tbl->valid = !!(crtl & GSWIP_PCE_TBL_CTRL_VLD);
+       tbl->gmap = (crtl & GSWIP_PCE_TBL_CTRL_GMAP_MASK) >> 7;
++      mutex_unlock(&priv->pce_table_lock);
++
+       return 0;
+ }
+@@ -563,10 +572,14 @@ static int gswip_pce_table_entry_write(struct gswip_priv *priv,
+       u16 addr_mode = tbl->key_mode ? GSWIP_PCE_TBL_CTRL_OPMOD_KSWR :
+                                       GSWIP_PCE_TBL_CTRL_OPMOD_ADWR;
++      mutex_lock(&priv->pce_table_lock);
++
+       err = gswip_switch_r_timeout(priv, GSWIP_PCE_TBL_CTRL,
+                                    GSWIP_PCE_TBL_CTRL_BAS);
+-      if (err)
++      if (err) {
++              mutex_unlock(&priv->pce_table_lock);
+               return err;
++      }
+       gswip_switch_w(priv, tbl->index, GSWIP_PCE_TBL_ADDR);
+       gswip_switch_mask(priv, GSWIP_PCE_TBL_CTRL_ADDR_MASK |
+@@ -598,8 +611,12 @@ static int gswip_pce_table_entry_write(struct gswip_priv *priv,
+       crtl |= GSWIP_PCE_TBL_CTRL_BAS;
+       gswip_switch_w(priv, crtl, GSWIP_PCE_TBL_CTRL);
+-      return gswip_switch_r_timeout(priv, GSWIP_PCE_TBL_CTRL,
+-                                    GSWIP_PCE_TBL_CTRL_BAS);
++      err = gswip_switch_r_timeout(priv, GSWIP_PCE_TBL_CTRL,
++                                   GSWIP_PCE_TBL_CTRL_BAS);
++
++      mutex_unlock(&priv->pce_table_lock);
++
++      return err;
+ }
+ /* Add the LAN port into a bridge with the CPU port by
+@@ -2020,6 +2037,7 @@ static int gswip_probe(struct platform_device *pdev)
+       priv->ds->priv = priv;
+       priv->ds->ops = &gswip_switch_ops;
+       priv->dev = dev;
++      mutex_init(&priv->pce_table_lock);
+       version = gswip_switch_r(priv, GSWIP_VERSION);
+       /* bring up the mdio bus */
+-- 
+2.33.0
+
diff --git a/queue-5.4/net-dsa-rtl8366rb-fix-off-by-one-bug.patch b/queue-5.4/net-dsa-rtl8366rb-fix-off-by-one-bug.patch
new file mode 100644 (file)
index 0000000..9474976
--- /dev/null
@@ -0,0 +1,50 @@
+From a34dcb5b605af1097be5452d187ee2ff44dba586 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 26 Sep 2021 00:59:27 +0200
+Subject: net: dsa: rtl8366rb: Fix off-by-one bug
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Linus Walleij <linus.walleij@linaro.org>
+
+[ Upstream commit 5f5f12f5d4b108399130bb5c11f07765851d9cdb ]
+
+The max VLAN number with non-4K VLAN activated is 15, and the
+range is 0..15. Not 16.
+
+The impact should be low since we by default have 4K VLAN and
+thus have 4095 VLANs to play with in this switch. There will
+not be a problem unless the code is rewritten to only use
+16 VLANs.
+
+Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver")
+Cc: Mauri Sandberg <sandberg@mailfence.com>
+Cc: DENG Qingfang <dqfext@gmail.com>
+Cc: Florian Fainelli <f.fainelli@gmail.com>
+Reviewed-by: Alvin Å ipraga <alsi@bang-olufsen.dk>
+Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/dsa/rtl8366rb.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c
+index 7f731bf369980..d047004360615 100644
+--- a/drivers/net/dsa/rtl8366rb.c
++++ b/drivers/net/dsa/rtl8366rb.c
+@@ -1264,7 +1264,7 @@ static int rtl8366rb_set_mc_index(struct realtek_smi *smi, int port, int index)
+ static bool rtl8366rb_is_vlan_valid(struct realtek_smi *smi, unsigned int vlan)
+ {
+-      unsigned int max = RTL8366RB_NUM_VLANS;
++      unsigned int max = RTL8366RB_NUM_VLANS - 1;
+       if (smi->vlan4k_enabled)
+               max = RTL8366RB_NUM_VIDS - 1;
+-- 
+2.33.0
+
diff --git a/queue-5.4/net-hns3-allow-configure-ets-bandwidth-of-all-tcs.patch b/queue-5.4/net-hns3-allow-configure-ets-bandwidth-of-all-tcs.patch
new file mode 100644 (file)
index 0000000..77a442e
--- /dev/null
@@ -0,0 +1,66 @@
+From 862174ea613fe5a590d7880e535d44af417cfb15 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 10 Nov 2021 21:42:56 +0800
+Subject: net: hns3: allow configure ETS bandwidth of all TCs
+
+From: Guangbin Huang <huangguangbin2@huawei.com>
+
+[ Upstream commit 688db0c7a4a69ddc8b8143a1cac01eb20082a3aa ]
+
+Currently, driver only allow configuring ETS bandwidth of TCs according
+to the max TC number queried from firmware. However, the hardware actually
+supports 8 TCs and users may need to configure ETS bandwidth of all TCs,
+so remove the restriction.
+
+Fixes: 330baff5423b ("net: hns3: add ETS TC weight setting in SSU module")
+Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 2 +-
+ drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c  | 9 +--------
+ 2 files changed, 2 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
+index 9076605403a74..bb22d91f6e53e 100644
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
+@@ -124,7 +124,7 @@ static int hclge_ets_validate(struct hclge_dev *hdev, struct ieee_ets *ets,
+       if (ret)
+               return ret;
+-      for (i = 0; i < hdev->tc_max; i++) {
++      for (i = 0; i < HNAE3_MAX_TC; i++) {
+               switch (ets->tc_tsa[i]) {
+               case IEEE_8021QAZ_TSA_STRICT:
+                       if (hdev->tm_info.tc_info[i].tc_sch_mode !=
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
+index d98f0e2ec7aa3..8448607742a6b 100644
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
+@@ -974,7 +974,6 @@ static int hclge_tm_pri_tc_base_dwrr_cfg(struct hclge_dev *hdev)
+ static int hclge_tm_ets_tc_dwrr_cfg(struct hclge_dev *hdev)
+ {
+-#define DEFAULT_TC_WEIGHT     1
+ #define DEFAULT_TC_OFFSET     14
+       struct hclge_ets_tc_weight_cmd *ets_weight;
+@@ -987,13 +986,7 @@ static int hclge_tm_ets_tc_dwrr_cfg(struct hclge_dev *hdev)
+       for (i = 0; i < HNAE3_MAX_TC; i++) {
+               struct hclge_pg_info *pg_info;
+-              ets_weight->tc_weight[i] = DEFAULT_TC_WEIGHT;
+-
+-              if (!(hdev->hw_tc_map & BIT(i)))
+-                      continue;
+-
+-              pg_info =
+-                      &hdev->tm_info.pg_info[hdev->tm_info.tc_info[i].pgid];
++              pg_info = &hdev->tm_info.pg_info[hdev->tm_info.tc_info[i].pgid];
+               ets_weight->tc_weight[i] = pg_info->tc_dwrr[i];
+       }
+-- 
+2.33.0
+
diff --git a/queue-5.4/net-neigh-fix-ntf_ext_learned-in-combination-with-nt.patch b/queue-5.4/net-neigh-fix-ntf_ext_learned-in-combination-with-nt.patch
new file mode 100644 (file)
index 0000000..7ac3914
--- /dev/null
@@ -0,0 +1,111 @@
+From f65ac9ed9df1e7162fc6dab10e25271e21cdaa6f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 11 Oct 2021 14:12:35 +0200
+Subject: net, neigh: Fix NTF_EXT_LEARNED in combination with NTF_USE
+
+From: Daniel Borkmann <daniel@iogearbox.net>
+
+[ Upstream commit e4400bbf5b15750e1b59bf4722d18d99be60c69f ]
+
+The NTF_EXT_LEARNED neigh flag is usually propagated back to user space
+upon dump of the neighbor table. However, when used in combination with
+NTF_USE flag this is not the case despite exempting the entry from the
+garbage collector. This results in inconsistent state since entries are
+typically marked in neigh->flags with NTF_EXT_LEARNED, but here they are
+not. Fix it by propagating the creation flag to ___neigh_create().
+
+Before fix:
+
+  # ./ip/ip n replace 192.168.178.30 dev enp5s0 use extern_learn
+  # ./ip/ip n
+  192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a REACHABLE
+  [...]
+
+After fix:
+
+  # ./ip/ip n replace 192.168.178.30 dev enp5s0 use extern_learn
+  # ./ip/ip n
+  192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a extern_learn REACHABLE
+  [...]
+
+Fixes: 9ce33e46531d ("neighbour: support for NTF_EXT_LEARNED flag")
+Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
+Acked-by: Roopa Prabhu <roopa@nvidia.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/core/neighbour.c | 26 ++++++++++++++------------
+ 1 file changed, 14 insertions(+), 12 deletions(-)
+
+diff --git a/net/core/neighbour.c b/net/core/neighbour.c
+index f94d405358a21..3a4cf53e38416 100644
+--- a/net/core/neighbour.c
++++ b/net/core/neighbour.c
+@@ -380,7 +380,7 @@ EXPORT_SYMBOL(neigh_ifdown);
+ static struct neighbour *neigh_alloc(struct neigh_table *tbl,
+                                    struct net_device *dev,
+-                                   bool exempt_from_gc)
++                                   u8 flags, bool exempt_from_gc)
+ {
+       struct neighbour *n = NULL;
+       unsigned long now = jiffies;
+@@ -413,6 +413,7 @@ do_alloc:
+       n->updated        = n->used = now;
+       n->nud_state      = NUD_NONE;
+       n->output         = neigh_blackhole;
++      n->flags          = flags;
+       seqlock_init(&n->hh.hh_lock);
+       n->parms          = neigh_parms_clone(&tbl->parms);
+       timer_setup(&n->timer, neigh_timer_handler, 0);
+@@ -576,19 +577,18 @@ struct neighbour *neigh_lookup_nodev(struct neigh_table *tbl, struct net *net,
+ }
+ EXPORT_SYMBOL(neigh_lookup_nodev);
+-static struct neighbour *___neigh_create(struct neigh_table *tbl,
+-                                       const void *pkey,
+-                                       struct net_device *dev,
+-                                       bool exempt_from_gc, bool want_ref)
++static struct neighbour *
++___neigh_create(struct neigh_table *tbl, const void *pkey,
++              struct net_device *dev, u8 flags,
++              bool exempt_from_gc, bool want_ref)
+ {
+-      struct neighbour *n1, *rc, *n = neigh_alloc(tbl, dev, exempt_from_gc);
+-      u32 hash_val;
+-      unsigned int key_len = tbl->key_len;
+-      int error;
++      u32 hash_val, key_len = tbl->key_len;
++      struct neighbour *n1, *rc, *n;
+       struct neigh_hash_table *nht;
++      int error;
++      n = neigh_alloc(tbl, dev, flags, exempt_from_gc);
+       trace_neigh_create(tbl, dev, pkey, n, exempt_from_gc);
+-
+       if (!n) {
+               rc = ERR_PTR(-ENOBUFS);
+               goto out;
+@@ -675,7 +675,7 @@ out_neigh_release:
+ struct neighbour *__neigh_create(struct neigh_table *tbl, const void *pkey,
+                                struct net_device *dev, bool want_ref)
+ {
+-      return ___neigh_create(tbl, pkey, dev, false, want_ref);
++      return ___neigh_create(tbl, pkey, dev, 0, false, want_ref);
+ }
+ EXPORT_SYMBOL(__neigh_create);
+@@ -1945,7 +1945,9 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh,
+               exempt_from_gc = ndm->ndm_state & NUD_PERMANENT ||
+                                ndm->ndm_flags & NTF_EXT_LEARNED;
+-              neigh = ___neigh_create(tbl, dst, dev, exempt_from_gc, true);
++              neigh = ___neigh_create(tbl, dst, dev,
++                                      ndm->ndm_flags & NTF_EXT_LEARNED,
++                                      exempt_from_gc, true);
+               if (IS_ERR(neigh)) {
+                       err = PTR_ERR(neigh);
+                       goto out;
+-- 
+2.33.0
+
diff --git a/queue-5.4/net-net_namespace-fix-undefined-member-in-key_remove.patch b/queue-5.4/net-net_namespace-fix-undefined-member-in-key_remove.patch
new file mode 100644 (file)
index 0000000..ad963ff
--- /dev/null
@@ -0,0 +1,47 @@
+From 4c292091bb4483d6d453c81f1fb91b0feec5ee9b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 18 Sep 2021 17:04:10 +0800
+Subject: net: net_namespace: Fix undefined member in key_remove_domain()
+
+From: Yajun Deng <yajun.deng@linux.dev>
+
+[ Upstream commit aed0826b0cf2e488900ab92193893e803d65c070 ]
+
+The key_domain member in struct net only exists if we define CONFIG_KEYS.
+So we should add the define when we used key_domain.
+
+Fixes: 9b242610514f ("keys: Network namespace domain tag")
+Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/core/net_namespace.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
+index 9bf15512601bf..cd1d40195e461 100644
+--- a/net/core/net_namespace.c
++++ b/net/core/net_namespace.c
+@@ -480,7 +480,9 @@ struct net *copy_net_ns(unsigned long flags,
+       if (rv < 0) {
+ put_userns:
++#ifdef CONFIG_KEYS
+               key_remove_domain(net->key_domain);
++#endif
+               put_user_ns(user_ns);
+               net_drop_ns(net);
+ dec_ucounts:
+@@ -612,7 +614,9 @@ static void cleanup_net(struct work_struct *work)
+       list_for_each_entry_safe(net, tmp, &net_exit_list, exit_list) {
+               list_del_init(&net->exit_list);
+               dec_net_namespaces(net->ucounts);
++#ifdef CONFIG_KEYS
+               key_remove_domain(net->key_domain);
++#endif
+               put_user_ns(net->user_ns);
+               net_drop_ns(net);
+       }
+-- 
+2.33.0
+
diff --git a/queue-5.4/net-phylink-avoid-mvneta-warning-when-setting-pause-.patch b/queue-5.4/net-phylink-avoid-mvneta-warning-when-setting-pause-.patch
new file mode 100644 (file)
index 0000000..c4158b9
--- /dev/null
@@ -0,0 +1,44 @@
+From ddfce4f28b42b1ee1ef2ea18cf7d09c8a3bff5a0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 28 Oct 2021 15:55:34 +0100
+Subject: net: phylink: avoid mvneta warning when setting pause parameters
+
+From: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
+
+[ Upstream commit fd8d9731bcdfb22d28e45bce789bcb211c868c78 ]
+
+mvneta does not support asymetric pause modes, and it flags this by the
+lack of AsymPause in the supported field. When setting pause modes, we
+check that pause->rx_pause == pause->tx_pause, but only when pause
+autoneg is enabled. When pause autoneg is disabled, we still allow
+pause->rx_pause != pause->tx_pause, which is incorrect when the MAC
+does not support asymetric pause, and causes mvneta to issue a warning.
+
+Fix this by removing the test for pause->autoneg, so we always check
+that pause->rx_pause == pause->tx_pause for network devices that do not
+support AsymPause.
+
+Fixes: 9525ae83959b ("phylink: add phylink infrastructure")
+Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/phy/phylink.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
+index bf5bbb565cf5e..7be43a1eaefda 100644
+--- a/drivers/net/phy/phylink.c
++++ b/drivers/net/phy/phylink.c
+@@ -1331,7 +1331,7 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl,
+               return -EOPNOTSUPP;
+       if (!phylink_test(pl->supported, Asym_Pause) &&
+-          !pause->autoneg && pause->rx_pause != pause->tx_pause)
++          pause->rx_pause != pause->tx_pause)
+               return -EINVAL;
+       config->pause &= ~(MLO_PAUSE_AN | MLO_PAUSE_TXRX_MASK);
+-- 
+2.33.0
+
diff --git a/queue-5.4/net-sched-sch_taprio-fix-undefined-behavior-in-ktime.patch b/queue-5.4/net-sched-sch_taprio-fix-undefined-behavior-in-ktime.patch
new file mode 100644 (file)
index 0000000..dbcaaeb
--- /dev/null
@@ -0,0 +1,138 @@
+From f6a017529f7ec1063c5db68eb94724a3977385a2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 8 Nov 2021 10:08:15 -0800
+Subject: net/sched: sch_taprio: fix undefined behavior in ktime_mono_to_any
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit 6dc25401cba4d428328eade8ceae717633fdd702 ]
+
+1) if q->tk_offset == TK_OFFS_MAX, then get_tcp_tstamp() calls
+   ktime_mono_to_any() with out-of-bound value.
+
+2) if q->tk_offset is changed in taprio_parse_clockid(),
+   taprio_get_time() might also call ktime_mono_to_any()
+   with out-of-bound value as sysbot found:
+
+UBSAN: array-index-out-of-bounds in kernel/time/timekeeping.c:908:27
+index 3 is out of range for type 'ktime_t *[3]'
+CPU: 1 PID: 25668 Comm: kworker/u4:0 Not tainted 5.15.0-syzkaller #0
+Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
+Workqueue: bat_events batadv_iv_send_outstanding_bat_ogm_packet
+Call Trace:
+ <TASK>
+ __dump_stack lib/dump_stack.c:88 [inline]
+ dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
+ ubsan_epilogue+0xb/0x5a lib/ubsan.c:151
+ __ubsan_handle_out_of_bounds.cold+0x62/0x6c lib/ubsan.c:291
+ ktime_mono_to_any+0x1d4/0x1e0 kernel/time/timekeeping.c:908
+ get_tcp_tstamp net/sched/sch_taprio.c:322 [inline]
+ get_packet_txtime net/sched/sch_taprio.c:353 [inline]
+ taprio_enqueue_one+0x5b0/0x1460 net/sched/sch_taprio.c:420
+ taprio_enqueue+0x3b1/0x730 net/sched/sch_taprio.c:485
+ dev_qdisc_enqueue+0x40/0x300 net/core/dev.c:3785
+ __dev_xmit_skb net/core/dev.c:3869 [inline]
+ __dev_queue_xmit+0x1f6e/0x3630 net/core/dev.c:4194
+ batadv_send_skb_packet+0x4a9/0x5f0 net/batman-adv/send.c:108
+ batadv_iv_ogm_send_to_if net/batman-adv/bat_iv_ogm.c:393 [inline]
+ batadv_iv_ogm_emit net/batman-adv/bat_iv_ogm.c:421 [inline]
+ batadv_iv_send_outstanding_bat_ogm_packet+0x6d7/0x8e0 net/batman-adv/bat_iv_ogm.c:1701
+ process_one_work+0x9b2/0x1690 kernel/workqueue.c:2298
+ worker_thread+0x658/0x11f0 kernel/workqueue.c:2445
+ kthread+0x405/0x4f0 kernel/kthread.c:327
+ ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
+
+Fixes: 7ede7b03484b ("taprio: make clock reference conversions easier")
+Fixes: 54002066100b ("taprio: Adjust timestamps for TCP packets")
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Cc: Vedang Patel <vedang.patel@intel.com>
+Reported-by: syzbot <syzkaller@googlegroups.com>
+Reviewed-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
+Link: https://lore.kernel.org/r/20211108180815.1822479-1-eric.dumazet@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/sched/sch_taprio.c | 27 +++++++++++++++++----------
+ 1 file changed, 17 insertions(+), 10 deletions(-)
+
+diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
+index e14a66ce4884d..b268e61304515 100644
+--- a/net/sched/sch_taprio.c
++++ b/net/sched/sch_taprio.c
+@@ -94,18 +94,22 @@ static ktime_t sched_base_time(const struct sched_gate_list *sched)
+       return ns_to_ktime(sched->base_time);
+ }
+-static ktime_t taprio_get_time(struct taprio_sched *q)
++static ktime_t taprio_mono_to_any(const struct taprio_sched *q, ktime_t mono)
+ {
+-      ktime_t mono = ktime_get();
++      /* This pairs with WRITE_ONCE() in taprio_parse_clockid() */
++      enum tk_offsets tk_offset = READ_ONCE(q->tk_offset);
+-      switch (q->tk_offset) {
++      switch (tk_offset) {
+       case TK_OFFS_MAX:
+               return mono;
+       default:
+-              return ktime_mono_to_any(mono, q->tk_offset);
++              return ktime_mono_to_any(mono, tk_offset);
+       }
++}
+-      return KTIME_MAX;
++static ktime_t taprio_get_time(const struct taprio_sched *q)
++{
++      return taprio_mono_to_any(q, ktime_get());
+ }
+ static void taprio_free_sched_cb(struct rcu_head *head)
+@@ -321,7 +325,7 @@ static ktime_t get_tcp_tstamp(struct taprio_sched *q, struct sk_buff *skb)
+               return 0;
+       }
+-      return ktime_mono_to_any(skb->skb_mstamp_ns, q->tk_offset);
++      return taprio_mono_to_any(q, skb->skb_mstamp_ns);
+ }
+ /* There are a few scenarios where we will have to modify the txtime from
+@@ -1342,6 +1346,7 @@ static int taprio_parse_clockid(struct Qdisc *sch, struct nlattr **tb,
+               }
+       } else if (tb[TCA_TAPRIO_ATTR_SCHED_CLOCKID]) {
+               int clockid = nla_get_s32(tb[TCA_TAPRIO_ATTR_SCHED_CLOCKID]);
++              enum tk_offsets tk_offset;
+               /* We only support static clockids and we don't allow
+                * for it to be modified after the first init.
+@@ -1356,22 +1361,24 @@ static int taprio_parse_clockid(struct Qdisc *sch, struct nlattr **tb,
+               switch (clockid) {
+               case CLOCK_REALTIME:
+-                      q->tk_offset = TK_OFFS_REAL;
++                      tk_offset = TK_OFFS_REAL;
+                       break;
+               case CLOCK_MONOTONIC:
+-                      q->tk_offset = TK_OFFS_MAX;
++                      tk_offset = TK_OFFS_MAX;
+                       break;
+               case CLOCK_BOOTTIME:
+-                      q->tk_offset = TK_OFFS_BOOT;
++                      tk_offset = TK_OFFS_BOOT;
+                       break;
+               case CLOCK_TAI:
+-                      q->tk_offset = TK_OFFS_TAI;
++                      tk_offset = TK_OFFS_TAI;
+                       break;
+               default:
+                       NL_SET_ERR_MSG(extack, "Invalid 'clockid'");
+                       err = -EINVAL;
+                       goto out;
+               }
++              /* This pairs with READ_ONCE() in taprio_mono_to_any */
++              WRITE_ONCE(q->tk_offset, tk_offset);
+               q->clockid = clockid;
+       } else {
+-- 
+2.33.0
+
diff --git a/queue-5.4/net-sched-update-default-qdisc-visibility-after-tx-q.patch b/queue-5.4/net-sched-update-default-qdisc-visibility-after-tx-q.patch
new file mode 100644 (file)
index 0000000..8ed4c86
--- /dev/null
@@ -0,0 +1,186 @@
+From 07ad61fe69e9660bec57ee231b0256ae86861f26 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 13 Sep 2021 15:53:30 -0700
+Subject: net: sched: update default qdisc visibility after Tx queue cnt
+ changes
+
+From: Jakub Kicinski <kuba@kernel.org>
+
+[ Upstream commit 1e080f17750d1083e8a32f7b350584ae1cd7ff20 ]
+
+mq / mqprio make the default child qdiscs visible. They only do
+so for the qdiscs which are within real_num_tx_queues when the
+device is registered. Depending on order of calls in the driver,
+or if user space changes config via ethtool -L the number of
+qdiscs visible under tc qdisc show will differ from the number
+of queues. This is confusing to users and potentially to system
+configuration scripts which try to make sure qdiscs have the
+right parameters.
+
+Add a new Qdisc_ops callback and make relevant qdiscs TTRT.
+
+Note that this uncovers the "shortcut" created by
+commit 1f27cde313d7 ("net: sched: use pfifo_fast for non real queues")
+The default child qdiscs beyond initial real_num_tx are always
+pfifo_fast, no matter what the sysfs setting is. Fixing this
+gets a little tricky because we'd need to keep a reference
+on whatever the default qdisc was at the time of creation.
+In practice this is likely an non-issue the qdiscs likely have
+to be configured to non-default settings, so whatever user space
+is doing such configuration can replace the pfifos... now that
+it will see them.
+
+Reported-by: Matthew Massey <matthewmassey@fb.com>
+Reviewed-by: Dave Taht <dave.taht@gmail.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/net/sch_generic.h |  4 ++++
+ net/core/dev.c            |  2 ++
+ net/sched/sch_generic.c   |  9 +++++++++
+ net/sched/sch_mq.c        | 24 ++++++++++++++++++++++++
+ net/sched/sch_mqprio.c    | 23 +++++++++++++++++++++++
+ 5 files changed, 62 insertions(+)
+
+diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
+index 0cb0a4bcb5447..939fda8f97215 100644
+--- a/include/net/sch_generic.h
++++ b/include/net/sch_generic.h
+@@ -299,6 +299,8 @@ struct Qdisc_ops {
+                                         struct netlink_ext_ack *extack);
+       void                    (*attach)(struct Qdisc *sch);
+       int                     (*change_tx_queue_len)(struct Qdisc *, unsigned int);
++      void                    (*change_real_num_tx)(struct Qdisc *sch,
++                                                    unsigned int new_real_tx);
+       int                     (*dump)(struct Qdisc *, struct sk_buff *);
+       int                     (*dump_stats)(struct Qdisc *, struct gnet_dump *);
+@@ -675,6 +677,8 @@ void qdisc_class_hash_grow(struct Qdisc *, struct Qdisc_class_hash *);
+ void qdisc_class_hash_destroy(struct Qdisc_class_hash *);
+ int dev_qdisc_change_tx_queue_len(struct net_device *dev);
++void dev_qdisc_change_real_num_tx(struct net_device *dev,
++                                unsigned int new_real_tx);
+ void dev_init_scheduler(struct net_device *dev);
+ void dev_shutdown(struct net_device *dev);
+ void dev_activate(struct net_device *dev);
+diff --git a/net/core/dev.c b/net/core/dev.c
+index 82dc094c03971..ff336417c9b90 100644
+--- a/net/core/dev.c
++++ b/net/core/dev.c
+@@ -2589,6 +2589,8 @@ int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq)
+               if (dev->num_tc)
+                       netif_setup_tc(dev, txq);
++              dev_qdisc_change_real_num_tx(dev, txq);
++
+               dev->real_num_tx_queues = txq;
+               if (disabling) {
+diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
+index 9bc5cbe9809b8..d973f8a15e117 100644
+--- a/net/sched/sch_generic.c
++++ b/net/sched/sch_generic.c
+@@ -1313,6 +1313,15 @@ static int qdisc_change_tx_queue_len(struct net_device *dev,
+       return 0;
+ }
++void dev_qdisc_change_real_num_tx(struct net_device *dev,
++                                unsigned int new_real_tx)
++{
++      struct Qdisc *qdisc = dev->qdisc;
++
++      if (qdisc->ops->change_real_num_tx)
++              qdisc->ops->change_real_num_tx(qdisc, new_real_tx);
++}
++
+ int dev_qdisc_change_tx_queue_len(struct net_device *dev)
+ {
+       bool up = dev->flags & IFF_UP;
+diff --git a/net/sched/sch_mq.c b/net/sched/sch_mq.c
+index e79f1afe0cfd6..db18d8a860f9c 100644
+--- a/net/sched/sch_mq.c
++++ b/net/sched/sch_mq.c
+@@ -125,6 +125,29 @@ static void mq_attach(struct Qdisc *sch)
+       priv->qdiscs = NULL;
+ }
++static void mq_change_real_num_tx(struct Qdisc *sch, unsigned int new_real_tx)
++{
++#ifdef CONFIG_NET_SCHED
++      struct net_device *dev = qdisc_dev(sch);
++      struct Qdisc *qdisc;
++      unsigned int i;
++
++      for (i = new_real_tx; i < dev->real_num_tx_queues; i++) {
++              qdisc = netdev_get_tx_queue(dev, i)->qdisc_sleeping;
++              /* Only update the default qdiscs we created,
++               * qdiscs with handles are always hashed.
++               */
++              if (qdisc != &noop_qdisc && !qdisc->handle)
++                      qdisc_hash_del(qdisc);
++      }
++      for (i = dev->real_num_tx_queues; i < new_real_tx; i++) {
++              qdisc = netdev_get_tx_queue(dev, i)->qdisc_sleeping;
++              if (qdisc != &noop_qdisc && !qdisc->handle)
++                      qdisc_hash_add(qdisc, false);
++      }
++#endif
++}
++
+ static int mq_dump(struct Qdisc *sch, struct sk_buff *skb)
+ {
+       struct net_device *dev = qdisc_dev(sch);
+@@ -288,6 +311,7 @@ struct Qdisc_ops mq_qdisc_ops __read_mostly = {
+       .init           = mq_init,
+       .destroy        = mq_destroy,
+       .attach         = mq_attach,
++      .change_real_num_tx = mq_change_real_num_tx,
+       .dump           = mq_dump,
+       .owner          = THIS_MODULE,
+ };
+diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c
+index 5eb3b1b7ae5e7..50e15add6068f 100644
+--- a/net/sched/sch_mqprio.c
++++ b/net/sched/sch_mqprio.c
+@@ -306,6 +306,28 @@ static void mqprio_attach(struct Qdisc *sch)
+       priv->qdiscs = NULL;
+ }
++static void mqprio_change_real_num_tx(struct Qdisc *sch,
++                                    unsigned int new_real_tx)
++{
++      struct net_device *dev = qdisc_dev(sch);
++      struct Qdisc *qdisc;
++      unsigned int i;
++
++      for (i = new_real_tx; i < dev->real_num_tx_queues; i++) {
++              qdisc = netdev_get_tx_queue(dev, i)->qdisc_sleeping;
++              /* Only update the default qdiscs we created,
++               * qdiscs with handles are always hashed.
++               */
++              if (qdisc != &noop_qdisc && !qdisc->handle)
++                      qdisc_hash_del(qdisc);
++      }
++      for (i = dev->real_num_tx_queues; i < new_real_tx; i++) {
++              qdisc = netdev_get_tx_queue(dev, i)->qdisc_sleeping;
++              if (qdisc != &noop_qdisc && !qdisc->handle)
++                      qdisc_hash_add(qdisc, false);
++      }
++}
++
+ static struct netdev_queue *mqprio_queue_get(struct Qdisc *sch,
+                                            unsigned long cl)
+ {
+@@ -629,6 +651,7 @@ static struct Qdisc_ops mqprio_qdisc_ops __read_mostly = {
+       .init           = mqprio_init,
+       .destroy        = mqprio_destroy,
+       .attach         = mqprio_attach,
++      .change_real_num_tx = mqprio_change_real_num_tx,
+       .dump           = mqprio_dump,
+       .owner          = THIS_MODULE,
+ };
+-- 
+2.33.0
+
diff --git a/queue-5.4/net-smc-fix-sk_refcnt-underflow-on-linkdown-and-fall.patch b/queue-5.4/net-smc-fix-sk_refcnt-underflow-on-linkdown-and-fall.patch
new file mode 100644 (file)
index 0000000..5fa65ef
--- /dev/null
@@ -0,0 +1,110 @@
+From c3ae38fd8f852e0259958ff85232e64548859e48 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 10 Nov 2021 15:02:34 +0800
+Subject: net/smc: fix sk_refcnt underflow on linkdown and fallback
+
+From: Dust Li <dust.li@linux.alibaba.com>
+
+[ Upstream commit e5d5aadcf3cd59949316df49c27cb21788d7efe4 ]
+
+We got the following WARNING when running ab/nginx
+test with RDMA link flapping (up-down-up).
+The reason is when smc_sock fallback and at linkdown
+happens simultaneously, we may got the following situation:
+
+__smc_lgr_terminate()
+ --> smc_conn_kill()
+    --> smc_close_active_abort()
+           smc_sock->sk_state = SMC_CLOSED
+           sock_put(smc_sock)
+
+smc_sock was set to SMC_CLOSED and sock_put() been called
+when terminate the link group. But later application call
+close() on the socket, then we got:
+
+__smc_release():
+    if (smc_sock->fallback)
+        smc_sock->sk_state = SMC_CLOSED
+        sock_put(smc_sock)
+
+Again we set the smc_sock to CLOSED through it's already
+in CLOSED state, and double put the refcnt, so the following
+warning happens:
+
+refcount_t: underflow; use-after-free.
+WARNING: CPU: 5 PID: 860 at lib/refcount.c:28 refcount_warn_saturate+0x8d/0xf0
+Modules linked in:
+CPU: 5 PID: 860 Comm: nginx Not tainted 5.10.46+ #403
+Hardware name: Alibaba Cloud Alibaba Cloud ECS, BIOS 8c24b4c 04/01/2014
+RIP: 0010:refcount_warn_saturate+0x8d/0xf0
+Code: 05 5c 1e b5 01 01 e8 52 25 bc ff 0f 0b c3 80 3d 4f 1e b5 01 00 75 ad 48
+
+RSP: 0018:ffffc90000527e50 EFLAGS: 00010286
+RAX: 0000000000000026 RBX: ffff8881300df2c0 RCX: 0000000000000027
+RDX: 0000000000000000 RSI: ffff88813bd58040 RDI: ffff88813bd58048
+RBP: 0000000000000000 R08: 0000000000000003 R09: 0000000000000001
+R10: ffff8881300df2c0 R11: ffffc90000527c78 R12: ffff8881300df340
+R13: ffff8881300df930 R14: ffff88810b3dad80 R15: ffff8881300df4f8
+FS:  00007f739de8fb80(0000) GS:ffff88813bd40000(0000) knlGS:0000000000000000
+CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+CR2: 000000000a01b008 CR3: 0000000111b64003 CR4: 00000000003706e0
+DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
+Call Trace:
+ smc_release+0x353/0x3f0
+ __sock_release+0x3d/0xb0
+ sock_close+0x11/0x20
+ __fput+0x93/0x230
+ task_work_run+0x65/0xa0
+ exit_to_user_mode_prepare+0xf9/0x100
+ syscall_exit_to_user_mode+0x27/0x190
+ entry_SYSCALL_64_after_hwframe+0x44/0xa9
+
+This patch adds check in __smc_release() to make
+sure we won't do an extra sock_put() and set the
+socket to CLOSED when its already in CLOSED state.
+
+Fixes: 51f1de79ad8e (net/smc: replace sock_put worker by socket refcounting)
+Signed-off-by: Dust Li <dust.li@linux.alibaba.com>
+Reviewed-by: Tony Lu <tonylu@linux.alibaba.com>
+Signed-off-by: Dust Li <dust.li@linux.alibaba.com>
+Acked-by: Karsten Graul <kgraul@linux.ibm.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/smc/af_smc.c | 18 +++++++++++-------
+ 1 file changed, 11 insertions(+), 7 deletions(-)
+
+diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
+index 2b3c13a0b2e5b..6b0f09c5b195f 100644
+--- a/net/smc/af_smc.c
++++ b/net/smc/af_smc.c
+@@ -139,14 +139,18 @@ static int __smc_release(struct smc_sock *smc)
+               sock_set_flag(sk, SOCK_DEAD);
+               sk->sk_shutdown |= SHUTDOWN_MASK;
+       } else {
+-              if (sk->sk_state != SMC_LISTEN && sk->sk_state != SMC_INIT)
+-                      sock_put(sk); /* passive closing */
+-              if (sk->sk_state == SMC_LISTEN) {
+-                      /* wake up clcsock accept */
+-                      rc = kernel_sock_shutdown(smc->clcsock, SHUT_RDWR);
++              if (sk->sk_state != SMC_CLOSED) {
++                      if (sk->sk_state != SMC_LISTEN &&
++                          sk->sk_state != SMC_INIT)
++                              sock_put(sk); /* passive closing */
++                      if (sk->sk_state == SMC_LISTEN) {
++                              /* wake up clcsock accept */
++                              rc = kernel_sock_shutdown(smc->clcsock,
++                                                        SHUT_RDWR);
++                      }
++                      sk->sk_state = SMC_CLOSED;
++                      sk->sk_state_change(sk);
+               }
+-              sk->sk_state = SMC_CLOSED;
+-              sk->sk_state_change(sk);
+               smc_restore_fallback_changes(smc);
+       }
+-- 
+2.33.0
+
diff --git a/queue-5.4/net-stream-don-t-purge-sk_error_queue-in-sk_stream_k.patch b/queue-5.4/net-stream-don-t-purge-sk_error_queue-in-sk_stream_k.patch
new file mode 100644 (file)
index 0000000..aba8879
--- /dev/null
@@ -0,0 +1,68 @@
+From 29a73f112fd2f55a69087a8c31e60128ee2af18c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 15 Oct 2021 06:37:39 -0700
+Subject: net: stream: don't purge sk_error_queue in sk_stream_kill_queues()
+
+From: Jakub Kicinski <kuba@kernel.org>
+
+[ Upstream commit 24bcbe1cc69fa52dc4f7b5b2456678ed464724d8 ]
+
+sk_stream_kill_queues() can be called on close when there are
+still outstanding skbs to transmit. Those skbs may try to queue
+notifications to the error queue (e.g. timestamps).
+If sk_stream_kill_queues() purges the queue without taking
+its lock the queue may get corrupted, and skbs leaked.
+
+This shows up as a warning about an rmem leak:
+
+WARNING: CPU: 24 PID: 0 at net/ipv4/af_inet.c:154 inet_sock_destruct+0x...
+
+The leak is always a multiple of 0x300 bytes (the value is in
+%rax on my builds, so RAX: 0000000000000300). 0x300 is truesize of
+an empty sk_buff. Indeed if we dump the socket state at the time
+of the warning the sk_error_queue is often (but not always)
+corrupted. The ->next pointer points back at the list head,
+but not the ->prev pointer. Indeed we can find the leaked skb
+by scanning the kernel memory for something that looks like
+an skb with ->sk = socket in question, and ->truesize = 0x300.
+The contents of ->cb[] of the skb confirms the suspicion that
+it is indeed a timestamp notification (as generated in
+__skb_complete_tx_timestamp()).
+
+Removing purging of sk_error_queue should be okay, since
+inet_sock_destruct() does it again once all socket refs
+are gone. Eric suggests this may cause sockets that go
+thru disconnect() to maintain notifications from the
+previous incarnations of the socket, but that should be
+okay since the race was there anyway, and disconnect()
+is not exactly dependable.
+
+Thanks to Jonathan Lemon and Omar Sandoval for help at various
+stages of tracing the issue.
+
+Fixes: cb9eff097831 ("net: new user space API for time stamping of incoming and outgoing packets")
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Reviewed-by: Eric Dumazet <edumazet@google.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/core/stream.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/net/core/stream.c b/net/core/stream.c
+index 4f1d4aa5fb38d..a166a32b411fa 100644
+--- a/net/core/stream.c
++++ b/net/core/stream.c
+@@ -195,9 +195,6 @@ void sk_stream_kill_queues(struct sock *sk)
+       /* First the read buffer. */
+       __skb_queue_purge(&sk->sk_receive_queue);
+-      /* Next, the error queue. */
+-      __skb_queue_purge(&sk->sk_error_queue);
+-
+       /* Next, the write queue. */
+       WARN_ON(!skb_queue_empty(&sk->sk_write_queue));
+-- 
+2.33.0
+
diff --git a/queue-5.4/net-sysfs-try-not-to-restart-the-syscall-if-it-will-.patch b/queue-5.4/net-sysfs-try-not-to-restart-the-syscall-if-it-will-.patch
new file mode 100644 (file)
index 0000000..913f4f9
--- /dev/null
@@ -0,0 +1,161 @@
+From 51c125469535908785e7a0db7297b5e927726ae4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 7 Oct 2021 16:00:51 +0200
+Subject: net-sysfs: try not to restart the syscall if it will fail eventually
+
+From: Antoine Tenart <atenart@kernel.org>
+
+[ Upstream commit 146e5e733310379f51924111068f08a3af0db830 ]
+
+Due to deadlocks in the networking subsystem spotted 12 years ago[1],
+a workaround was put in place[2] to avoid taking the rtnl lock when it
+was not available and restarting the syscall (back to VFS, letting
+userspace spin). The following construction is found a lot in the net
+sysfs and sysctl code:
+
+  if (!rtnl_trylock())
+          return restart_syscall();
+
+This can be problematic when multiple userspace threads use such
+interfaces in a short period, making them to spin a lot. This happens
+for example when adding and moving virtual interfaces: userspace
+programs listening on events, such as systemd-udevd and NetworkManager,
+do trigger actions reading files in sysfs. It gets worse when a lot of
+virtual interfaces are created concurrently, say when creating
+containers at boot time.
+
+Returning early without hitting the above pattern when the syscall will
+fail eventually does make things better. While it is not a fix for the
+issue, it does ease things.
+
+[1] https://lore.kernel.org/netdev/49A4D5D5.5090602@trash.net/
+    https://lore.kernel.org/netdev/m14oyhis31.fsf@fess.ebiederm.org/
+    and https://lore.kernel.org/netdev/20090226084924.16cb3e08@nehalam/
+[2] Rightfully, those deadlocks are *hard* to solve.
+
+Signed-off-by: Antoine Tenart <atenart@kernel.org>
+Reviewed-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/core/net-sysfs.c | 55 ++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 55 insertions(+)
+
+diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
+index 98474d85fb51f..05b0c60bfba2b 100644
+--- a/net/core/net-sysfs.c
++++ b/net/core/net-sysfs.c
+@@ -174,6 +174,14 @@ static int change_carrier(struct net_device *dev, unsigned long new_carrier)
+ static ssize_t carrier_store(struct device *dev, struct device_attribute *attr,
+                            const char *buf, size_t len)
+ {
++      struct net_device *netdev = to_net_dev(dev);
++
++      /* The check is also done in change_carrier; this helps returning early
++       * without hitting the trylock/restart in netdev_store.
++       */
++      if (!netdev->netdev_ops->ndo_change_carrier)
++              return -EOPNOTSUPP;
++
+       return netdev_store(dev, attr, buf, len, change_carrier);
+ }
+@@ -195,6 +203,12 @@ static ssize_t speed_show(struct device *dev,
+       struct net_device *netdev = to_net_dev(dev);
+       int ret = -EINVAL;
++      /* The check is also done in __ethtool_get_link_ksettings; this helps
++       * returning early without hitting the trylock/restart below.
++       */
++      if (!netdev->ethtool_ops->get_link_ksettings)
++              return ret;
++
+       if (!rtnl_trylock())
+               return restart_syscall();
+@@ -215,6 +229,12 @@ static ssize_t duplex_show(struct device *dev,
+       struct net_device *netdev = to_net_dev(dev);
+       int ret = -EINVAL;
++      /* The check is also done in __ethtool_get_link_ksettings; this helps
++       * returning early without hitting the trylock/restart below.
++       */
++      if (!netdev->ethtool_ops->get_link_ksettings)
++              return ret;
++
+       if (!rtnl_trylock())
+               return restart_syscall();
+@@ -438,6 +458,14 @@ static ssize_t proto_down_store(struct device *dev,
+                               struct device_attribute *attr,
+                               const char *buf, size_t len)
+ {
++      struct net_device *netdev = to_net_dev(dev);
++
++      /* The check is also done in change_proto_down; this helps returning
++       * early without hitting the trylock/restart in netdev_store.
++       */
++      if (!netdev->netdev_ops->ndo_change_proto_down)
++              return -EOPNOTSUPP;
++
+       return netdev_store(dev, attr, buf, len, change_proto_down);
+ }
+ NETDEVICE_SHOW_RW(proto_down, fmt_dec);
+@@ -448,6 +476,12 @@ static ssize_t phys_port_id_show(struct device *dev,
+       struct net_device *netdev = to_net_dev(dev);
+       ssize_t ret = -EINVAL;
++      /* The check is also done in dev_get_phys_port_id; this helps returning
++       * early without hitting the trylock/restart below.
++       */
++      if (!netdev->netdev_ops->ndo_get_phys_port_id)
++              return -EOPNOTSUPP;
++
+       if (!rtnl_trylock())
+               return restart_syscall();
+@@ -470,6 +504,13 @@ static ssize_t phys_port_name_show(struct device *dev,
+       struct net_device *netdev = to_net_dev(dev);
+       ssize_t ret = -EINVAL;
++      /* The checks are also done in dev_get_phys_port_name; this helps
++       * returning early without hitting the trylock/restart below.
++       */
++      if (!netdev->netdev_ops->ndo_get_phys_port_name &&
++          !netdev->netdev_ops->ndo_get_devlink_port)
++              return -EOPNOTSUPP;
++
+       if (!rtnl_trylock())
+               return restart_syscall();
+@@ -492,6 +533,14 @@ static ssize_t phys_switch_id_show(struct device *dev,
+       struct net_device *netdev = to_net_dev(dev);
+       ssize_t ret = -EINVAL;
++      /* The checks are also done in dev_get_phys_port_name; this helps
++       * returning early without hitting the trylock/restart below. This works
++       * because recurse is false when calling dev_get_port_parent_id.
++       */
++      if (!netdev->netdev_ops->ndo_get_port_parent_id &&
++          !netdev->netdev_ops->ndo_get_devlink_port)
++              return -EOPNOTSUPP;
++
+       if (!rtnl_trylock())
+               return restart_syscall();
+@@ -1097,6 +1146,12 @@ static ssize_t tx_maxrate_store(struct netdev_queue *queue,
+       if (!capable(CAP_NET_ADMIN))
+               return -EPERM;
++      /* The check is also done later; this helps returning early without
++       * hitting the trylock/restart below.
++       */
++      if (!dev->netdev_ops->ndo_set_tx_maxrate)
++              return -EOPNOTSUPP;
++
+       err = kstrtou32(buf, 10, &rate);
+       if (err < 0)
+               return err;
+-- 
+2.33.0
+
diff --git a/queue-5.4/net-vlan-fix-a-uaf-in-vlan_dev_real_dev.patch b/queue-5.4/net-vlan-fix-a-uaf-in-vlan_dev_real_dev.patch
new file mode 100644 (file)
index 0000000..95febfb
--- /dev/null
@@ -0,0 +1,86 @@
+From ec3263f69091978da2a9fdac3931f079a2c340b9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 2 Nov 2021 10:12:18 +0800
+Subject: net: vlan: fix a UAF in vlan_dev_real_dev()
+
+From: Ziyang Xuan <william.xuanziyang@huawei.com>
+
+[ Upstream commit 563bcbae3ba233c275c244bfce2efe12938f5363 ]
+
+The real_dev of a vlan net_device may be freed after
+unregister_vlan_dev(). Access the real_dev continually by
+vlan_dev_real_dev() will trigger the UAF problem for the
+real_dev like following:
+
+==================================================================
+BUG: KASAN: use-after-free in vlan_dev_real_dev+0xf9/0x120
+Call Trace:
+ kasan_report.cold+0x83/0xdf
+ vlan_dev_real_dev+0xf9/0x120
+ is_eth_port_of_netdev_filter.part.0+0xb1/0x2c0
+ is_eth_port_of_netdev_filter+0x28/0x40
+ ib_enum_roce_netdev+0x1a3/0x300
+ ib_enum_all_roce_netdevs+0xc7/0x140
+ netdevice_event_work_handler+0x9d/0x210
+...
+
+Freed by task 9288:
+ kasan_save_stack+0x1b/0x40
+ kasan_set_track+0x1c/0x30
+ kasan_set_free_info+0x20/0x30
+ __kasan_slab_free+0xfc/0x130
+ slab_free_freelist_hook+0xdd/0x240
+ kfree+0xe4/0x690
+ kvfree+0x42/0x50
+ device_release+0x9f/0x240
+ kobject_put+0x1c8/0x530
+ put_device+0x1b/0x30
+ free_netdev+0x370/0x540
+ ppp_destroy_interface+0x313/0x3d0
+...
+
+Move the put_device(real_dev) to vlan_dev_free(). Ensure
+real_dev not be freed before vlan_dev unregistered.
+
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Reported-by: syzbot+e4df4e1389e28972e955@syzkaller.appspotmail.com
+Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
+Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/8021q/vlan.c     | 3 ---
+ net/8021q/vlan_dev.c | 3 +++
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
+index 3f47abf9ef4a6..cd7c0429cddf8 100644
+--- a/net/8021q/vlan.c
++++ b/net/8021q/vlan.c
+@@ -116,9 +116,6 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head)
+       }
+       vlan_vid_del(real_dev, vlan->vlan_proto, vlan_id);
+-
+-      /* Get rid of the vlan's reference to real_dev */
+-      dev_put(real_dev);
+ }
+ int vlan_check_real_dev(struct net_device *real_dev,
+diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
+index 2a78da4072de9..415a29d42cdf0 100644
+--- a/net/8021q/vlan_dev.c
++++ b/net/8021q/vlan_dev.c
+@@ -790,6 +790,9 @@ static void vlan_dev_free(struct net_device *dev)
+       free_percpu(vlan->vlan_pcpu_stats);
+       vlan->vlan_pcpu_stats = NULL;
++
++      /* Get rid of the vlan's reference to real_dev */
++      dev_put(vlan->real_dev);
+ }
+ void vlan_setup(struct net_device *dev)
+-- 
+2.33.0
+
diff --git a/queue-5.4/netfilter-conntrack-set-on-ips_assured-if-flows-ente.patch b/queue-5.4/netfilter-conntrack-set-on-ips_assured-if-flows-ente.patch
new file mode 100644 (file)
index 0000000..e4124d8
--- /dev/null
@@ -0,0 +1,80 @@
+From daaffffed403e601acf4842000604ab1178f80cd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 25 Oct 2021 11:26:49 +0200
+Subject: netfilter: conntrack: set on IPS_ASSURED if flows enters internal
+ stream state
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Pablo Neira Ayuso <pablo@netfilter.org>
+
+[ Upstream commit b7b1d02fc43925a4d569ec221715db2dfa1ce4f5 ]
+
+The internal stream state sets the timeout to 120 seconds 2 seconds
+after the creation of the flow, attach this internal stream state to the
+IPS_ASSURED flag for consistent event reporting.
+
+Before this patch:
+
+      [NEW] udp      17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 [UNREPLIED] src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282
+   [UPDATE] udp      17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282
+   [UPDATE] udp      17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED]
+  [DESTROY] udp      17 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED]
+
+Note IPS_ASSURED for the flow not yet in the internal stream state.
+
+after this update:
+
+      [NEW] udp      17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 [UNREPLIED] src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282
+   [UPDATE] udp      17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282
+   [UPDATE] udp      17 120 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED]
+  [DESTROY] udp      17 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED]
+
+Before this patch, short-lived UDP flows never entered IPS_ASSURED, so
+they were already candidate flow to be deleted by early_drop under
+stress.
+
+Before this patch, IPS_ASSURED is set on regardless the internal stream
+state, attach this internal stream state to IPS_ASSURED.
+
+packet #1 (original direction) enters NEW state
+packet #2 (reply direction) enters ESTABLISHED state, sets on IPS_SEEN_REPLY
+paclet #3 (any direction) sets on IPS_ASSURED (if 2 seconds since the
+          creation has passed by).
+
+Reported-by: Maciej Å»enczykowski <zenczykowski@gmail.com>
+Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/netfilter/nf_conntrack_proto_udp.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c
+index 7365b43f8f980..e3a2d018f4ec5 100644
+--- a/net/netfilter/nf_conntrack_proto_udp.c
++++ b/net/netfilter/nf_conntrack_proto_udp.c
+@@ -105,15 +105,18 @@ int nf_conntrack_udp_packet(struct nf_conn *ct,
+        */
+       if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) {
+               unsigned long extra = timeouts[UDP_CT_UNREPLIED];
++              bool stream = false;
+               /* Still active after two seconds? Extend timeout. */
+-              if (time_after(jiffies, ct->proto.udp.stream_ts))
++              if (time_after(jiffies, ct->proto.udp.stream_ts)) {
+                       extra = timeouts[UDP_CT_REPLIED];
++                      stream = true;
++              }
+               nf_ct_refresh_acct(ct, ctinfo, skb, extra);
+               /* Also, more likely to be important, and not a probe */
+-              if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
++              if (stream && !test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
+                       nf_conntrack_event_cache(IPCT_ASSURED, ct);
+       } else {
+               nf_ct_refresh_acct(ct, ctinfo, skb,
+-- 
+2.33.0
+
diff --git a/queue-5.4/netfilter-nfnetlink_queue-fix-oob-when-mac-header-wa.patch b/queue-5.4/netfilter-nfnetlink_queue-fix-oob-when-mac-header-wa.patch
new file mode 100644 (file)
index 0000000..a7995bf
--- /dev/null
@@ -0,0 +1,55 @@
+From 5eacb3f2a97f99c8598594613dce1fc317bd18bd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Oct 2021 18:08:10 +0200
+Subject: netfilter: nfnetlink_queue: fix OOB when mac header was cleared
+
+From: Florian Westphal <fw@strlen.de>
+
+[ Upstream commit 5648b5e1169ff1d6d6a46c35c0b5fbebd2a5cbb2 ]
+
+On 64bit platforms the MAC header is set to 0xffff on allocation and
+also when a helper like skb_unset_mac_header() is called.
+
+dev_parse_header may call skb_mac_header() which assumes valid mac offset:
+
+ BUG: KASAN: use-after-free in eth_header_parse+0x75/0x90
+ Read of size 6 at addr ffff8881075a5c05 by task nf-queue/1364
+ Call Trace:
+  memcpy+0x20/0x60
+  eth_header_parse+0x75/0x90
+  __nfqnl_enqueue_packet+0x1a61/0x3380
+  __nf_queue+0x597/0x1300
+  nf_queue+0xf/0x40
+  nf_hook_slow+0xed/0x190
+  nf_hook+0x184/0x440
+  ip_output+0x1c0/0x2a0
+  nf_reinject+0x26f/0x700
+  nfqnl_recv_verdict+0xa16/0x18b0
+  nfnetlink_rcv_msg+0x506/0xe70
+
+The existing code only works if the skb has a mac header.
+
+Fixes: 2c38de4c1f8da7 ("netfilter: fix looped (broad|multi)cast's MAC handling")
+Signed-off-by: Florian Westphal <fw@strlen.de>
+Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/netfilter/nfnetlink_queue.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
+index 6f0a2bad8ad5e..a8cb562da3fea 100644
+--- a/net/netfilter/nfnetlink_queue.c
++++ b/net/netfilter/nfnetlink_queue.c
+@@ -562,7 +562,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
+               goto nla_put_failure;
+       if (indev && entskb->dev &&
+-          entskb->mac_header != entskb->network_header) {
++          skb_mac_header_was_set(entskb)) {
+               struct nfqnl_msg_packet_hw phw;
+               int len;
+-- 
+2.33.0
+
diff --git a/queue-5.4/netfilter-nft_dynset-relax-superfluous-check-on-set-.patch b/queue-5.4/netfilter-nft_dynset-relax-superfluous-check-on-set-.patch
new file mode 100644 (file)
index 0000000..34d2563
--- /dev/null
@@ -0,0 +1,46 @@
+From 696c4e568f82edff9c5a2341a23edc14e5867c8c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 25 Sep 2021 22:40:26 +0200
+Subject: netfilter: nft_dynset: relax superfluous check on set updates
+
+From: Pablo Neira Ayuso <pablo@netfilter.org>
+
+[ Upstream commit 7b1394892de8d95748d05e3ee41e85edb4abbfa1 ]
+
+Relax this condition to make add and update commands idempotent for sets
+with no timeout. The eval function already checks if the set element
+timeout is available and updates it if the update command is used.
+
+Fixes: 22fe54d5fefc ("netfilter: nf_tables: add support for dynamic set updates")
+Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/netfilter/nft_dynset.c | 11 +----------
+ 1 file changed, 1 insertion(+), 10 deletions(-)
+
+diff --git a/net/netfilter/nft_dynset.c b/net/netfilter/nft_dynset.c
+index 95415d2b81c93..6fdea0e57db8a 100644
+--- a/net/netfilter/nft_dynset.c
++++ b/net/netfilter/nft_dynset.c
+@@ -164,17 +164,8 @@ static int nft_dynset_init(const struct nft_ctx *ctx,
+               return -EBUSY;
+       priv->op = ntohl(nla_get_be32(tb[NFTA_DYNSET_OP]));
+-      switch (priv->op) {
+-      case NFT_DYNSET_OP_ADD:
+-      case NFT_DYNSET_OP_DELETE:
+-              break;
+-      case NFT_DYNSET_OP_UPDATE:
+-              if (!(set->flags & NFT_SET_TIMEOUT))
+-                      return -EOPNOTSUPP;
+-              break;
+-      default:
++      if (priv->op > NFT_DYNSET_OP_DELETE)
+               return -EOPNOTSUPP;
+-      }
+       timeout = 0;
+       if (tb[NFTA_DYNSET_TIMEOUT] != NULL) {
+-- 
+2.33.0
+
diff --git a/queue-5.4/nfc-pn533-fix-double-free-when-pn533_fill_fragment_s.patch b/queue-5.4/nfc-pn533-fix-double-free-when-pn533_fill_fragment_s.patch
new file mode 100644 (file)
index 0000000..056f8b4
--- /dev/null
@@ -0,0 +1,59 @@
+From dda2d87829df016d445a90c3d361981a30535f25 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 5 Nov 2021 06:36:36 -0700
+Subject: nfc: pn533: Fix double free when pn533_fill_fragment_skbs() fails
+
+From: Chengfeng Ye <cyeaa@connect.ust.hk>
+
+[ Upstream commit 9fec40f850658e00a14a7dd9e06f7fbc7e59cc4a ]
+
+skb is already freed by dev_kfree_skb in pn533_fill_fragment_skbs,
+but follow error handler branch when pn533_fill_fragment_skbs()
+fails, skb is freed again, results in double free issue. Fix this
+by not free skb in error path of pn533_fill_fragment_skbs.
+
+Fixes: 963a82e07d4e ("NFC: pn533: Split large Tx frames in chunks")
+Fixes: 93ad42020c2d ("NFC: pn533: Target mode Tx fragmentation support")
+Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
+Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
+Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/nfc/pn533/pn533.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c
+index 3ea38ce86cc9f..807b7b37d9dce 100644
+--- a/drivers/nfc/pn533/pn533.c
++++ b/drivers/nfc/pn533/pn533.c
+@@ -2072,7 +2072,7 @@ static int pn533_fill_fragment_skbs(struct pn533 *dev, struct sk_buff *skb)
+               frag = pn533_alloc_skb(dev, frag_size);
+               if (!frag) {
+                       skb_queue_purge(&dev->fragment_skb);
+-                      break;
++                      return -ENOMEM;
+               }
+               if (!dev->tgt_mode) {
+@@ -2143,7 +2143,7 @@ static int pn533_transceive(struct nfc_dev *nfc_dev,
+               /* jumbo frame ? */
+               if (skb->len > PN533_CMD_DATAEXCH_DATA_MAXLEN) {
+                       rc = pn533_fill_fragment_skbs(dev, skb);
+-                      if (rc <= 0)
++                      if (rc < 0)
+                               goto error;
+                       skb = skb_dequeue(&dev->fragment_skb);
+@@ -2215,7 +2215,7 @@ static int pn533_tm_send(struct nfc_dev *nfc_dev, struct sk_buff *skb)
+       /* let's split in multiple chunks if size's too big */
+       if (skb->len > PN533_CMD_DATAEXCH_DATA_MAXLEN) {
+               rc = pn533_fill_fragment_skbs(dev, skb);
+-              if (rc <= 0)
++              if (rc < 0)
+                       goto error;
+               /* get the first skb */
+-- 
+2.33.0
+
diff --git a/queue-5.4/nfs-fix-deadlocks-in-nfs_scan_commit_list.patch b/queue-5.4/nfs-fix-deadlocks-in-nfs_scan_commit_list.patch
new file mode 100644 (file)
index 0000000..09a76e6
--- /dev/null
@@ -0,0 +1,66 @@
+From 0f5d9c66f01a6b20a053822aa7c51b0085286710 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 4 Oct 2021 15:44:16 -0400
+Subject: NFS: Fix deadlocks in nfs_scan_commit_list()
+
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+
+[ Upstream commit 64a93dbf25d3a1368bb58ddf0f61d0a92d7479e3 ]
+
+Partially revert commit 2ce209c42c01 ("NFS: Wait for requests that are
+locked on the commit list"), since it can lead to deadlocks between
+commit requests and nfs_join_page_group().
+For now we should assume that any locked requests on the commit list are
+either about to be removed and committed by another task, or the writes
+they describe are about to be retransmitted. In either case, we should
+not need to worry.
+
+Fixes: 2ce209c42c01 ("NFS: Wait for requests that are locked on the commit list")
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/write.c | 17 ++---------------
+ 1 file changed, 2 insertions(+), 15 deletions(-)
+
+diff --git a/fs/nfs/write.c b/fs/nfs/write.c
+index 613c3ef23e07b..30d8e7bc1cef3 100644
+--- a/fs/nfs/write.c
++++ b/fs/nfs/write.c
+@@ -1050,25 +1050,11 @@ nfs_scan_commit_list(struct list_head *src, struct list_head *dst,
+       struct nfs_page *req, *tmp;
+       int ret = 0;
+-restart:
+       list_for_each_entry_safe(req, tmp, src, wb_list) {
+               kref_get(&req->wb_kref);
+               if (!nfs_lock_request(req)) {
+-                      int status;
+-
+-                      /* Prevent deadlock with nfs_lock_and_join_requests */
+-                      if (!list_empty(dst)) {
+-                              nfs_release_request(req);
+-                              continue;
+-                      }
+-                      /* Ensure we make progress to prevent livelock */
+-                      mutex_unlock(&NFS_I(cinfo->inode)->commit_mutex);
+-                      status = nfs_wait_on_request(req);
+                       nfs_release_request(req);
+-                      mutex_lock(&NFS_I(cinfo->inode)->commit_mutex);
+-                      if (status < 0)
+-                              break;
+-                      goto restart;
++                      continue;
+               }
+               nfs_request_remove_commit_list(req, cinfo);
+               clear_bit(PG_COMMIT_TO_DS, &req->wb_flags);
+@@ -1935,6 +1921,7 @@ static int __nfs_commit_inode(struct inode *inode, int how,
+       int may_wait = how & FLUSH_SYNC;
+       int ret, nscan;
++      how &= ~FLUSH_SYNC;
+       nfs_init_cinfo_from_inode(&cinfo, inode);
+       nfs_commit_begin(cinfo.mds);
+       for (;;) {
+-- 
+2.33.0
+
diff --git a/queue-5.4/nfsv4-fix-a-regression-in-nfs_set_open_stateid_locke.patch b/queue-5.4/nfsv4-fix-a-regression-in-nfs_set_open_stateid_locke.patch
new file mode 100644 (file)
index 0000000..87a71c4
--- /dev/null
@@ -0,0 +1,55 @@
+From 0bc5c22a4216a0c3913f600b4e87ec6932161bf4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 26 Oct 2021 21:56:40 -0400
+Subject: NFSv4: Fix a regression in nfs_set_open_stateid_locked()
+
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+
+[ Upstream commit 01d29f87fcfef38d51ce2b473981a5c1e861ac0a ]
+
+If we already hold open state on the client, yet the server gives us a
+completely different stateid to the one we already hold, then we
+currently treat it as if it were an out-of-sequence update, and wait for
+5 seconds for other updates to come in.
+This commit fixes the behaviour so that we immediately start processing
+of the new stateid, and then leave it to the call to
+nfs4_test_and_free_stateid() to decide what to do with the old stateid.
+
+Fixes: b4868b44c562 ("NFSv4: Wait for stateid updates after CLOSE/OPEN_DOWNGRADE")
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/nfs4proc.c | 15 ++++++++-------
+ 1 file changed, 8 insertions(+), 7 deletions(-)
+
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
+index 5ecaf7b6b0fa1..fb3d1532f11dd 100644
+--- a/fs/nfs/nfs4proc.c
++++ b/fs/nfs/nfs4proc.c
+@@ -1549,15 +1549,16 @@ static bool nfs_stateid_is_sequential(struct nfs4_state *state,
+ {
+       if (test_bit(NFS_OPEN_STATE, &state->flags)) {
+               /* The common case - we're updating to a new sequence number */
+-              if (nfs4_stateid_match_other(stateid, &state->open_stateid) &&
+-                      nfs4_stateid_is_next(&state->open_stateid, stateid)) {
+-                      return true;
++              if (nfs4_stateid_match_other(stateid, &state->open_stateid)) {
++                      if (nfs4_stateid_is_next(&state->open_stateid, stateid))
++                              return true;
++                      return false;
+               }
+-      } else {
+-              /* This is the first OPEN in this generation */
+-              if (stateid->seqid == cpu_to_be32(1))
+-                      return true;
++              /* The server returned a new stateid */
+       }
++      /* This is the first OPEN in this generation */
++      if (stateid->seqid == cpu_to_be32(1))
++              return true;
+       return false;
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/nvme-drop-scan_lock-and-always-kick-requeue-list-whe.patch b/queue-5.4/nvme-drop-scan_lock-and-always-kick-requeue-list-whe.patch
new file mode 100644 (file)
index 0000000..4cb1107
--- /dev/null
@@ -0,0 +1,74 @@
+From 071002fe6a2b7846079a6b1942198c37ed49a18f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Oct 2021 07:59:10 +0200
+Subject: nvme: drop scan_lock and always kick requeue list when removing
+ namespaces
+
+From: Hannes Reinecke <hare@suse.de>
+
+[ Upstream commit 2b81a5f015199f3d585ce710190a9e87714d3c1e ]
+
+When reading the partition table on initial scan hits an I/O error the
+I/O will hang with the scan_mutex held:
+
+[<0>] do_read_cache_page+0x49b/0x790
+[<0>] read_part_sector+0x39/0xe0
+[<0>] read_lba+0xf9/0x1d0
+[<0>] efi_partition+0xf1/0x7f0
+[<0>] bdev_disk_changed+0x1ee/0x550
+[<0>] blkdev_get_whole+0x81/0x90
+[<0>] blkdev_get_by_dev+0x128/0x2e0
+[<0>] device_add_disk+0x377/0x3c0
+[<0>] nvme_mpath_set_live+0x130/0x1b0 [nvme_core]
+[<0>] nvme_mpath_add_disk+0x150/0x160 [nvme_core]
+[<0>] nvme_alloc_ns+0x417/0x950 [nvme_core]
+[<0>] nvme_validate_or_alloc_ns+0xe9/0x1e0 [nvme_core]
+[<0>] nvme_scan_work+0x168/0x310 [nvme_core]
+[<0>] process_one_work+0x231/0x420
+
+and trying to delete the controller will deadlock as it tries to grab
+the scan mutex:
+
+[<0>] nvme_mpath_clear_ctrl_paths+0x25/0x80 [nvme_core]
+[<0>] nvme_remove_namespaces+0x31/0xf0 [nvme_core]
+[<0>] nvme_do_delete_ctrl+0x4b/0x80 [nvme_core]
+
+As we're now properly ordering the namespace list there is no need to
+hold the scan_mutex in nvme_mpath_clear_ctrl_paths() anymore.
+And we always need to kick the requeue list as the path will be marked
+as unusable and I/O will be requeued _without_ a current path.
+
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+Reviewed-by: Keith Busch <kbusch@kernel.org>
+Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/nvme/host/multipath.c | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
+index 016a67fd41989..9f01af2f03e68 100644
+--- a/drivers/nvme/host/multipath.c
++++ b/drivers/nvme/host/multipath.c
+@@ -156,13 +156,12 @@ void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl)
+ {
+       struct nvme_ns *ns;
+-      mutex_lock(&ctrl->scan_lock);
+       down_read(&ctrl->namespaces_rwsem);
+-      list_for_each_entry(ns, &ctrl->namespaces, list)
+-              if (nvme_mpath_clear_current_path(ns))
+-                      kblockd_schedule_work(&ns->head->requeue_work);
++      list_for_each_entry(ns, &ctrl->namespaces, list) {
++              nvme_mpath_clear_current_path(ns);
++              kblockd_schedule_work(&ns->head->requeue_work);
++      }
+       up_read(&ctrl->namespaces_rwsem);
+-      mutex_unlock(&ctrl->scan_lock);
+ }
+ static bool nvme_path_is_disabled(struct nvme_ns *ns)
+-- 
+2.33.0
+
diff --git a/queue-5.4/nvme-rdma-fix-error-code-in-nvme_rdma_setup_ctrl.patch b/queue-5.4/nvme-rdma-fix-error-code-in-nvme_rdma_setup_ctrl.patch
new file mode 100644 (file)
index 0000000..64e9c48
--- /dev/null
@@ -0,0 +1,43 @@
+From 5c8a61e524475c9208d5598fe09bcce983c2b0c6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 17 Oct 2021 11:58:16 +0300
+Subject: nvme-rdma: fix error code in nvme_rdma_setup_ctrl
+
+From: Max Gurtovoy <mgurtovoy@nvidia.com>
+
+[ Upstream commit 09748122009aed7bfaa7acc33c10c083a4758322 ]
+
+In case that icdoff is not zero or mandatory keyed sgls are not
+supported by the NVMe/RDMA target, we'll go to error flow but we'll
+return 0 to the caller. Fix it by returning an appropriate error code.
+
+Fixes: c66e2998c8ca ("nvme-rdma: centralize controller setup sequence")
+Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
+Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/nvme/host/rdma.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
+index dcc3d2393605e..08a23bb4b8b57 100644
+--- a/drivers/nvme/host/rdma.c
++++ b/drivers/nvme/host/rdma.c
+@@ -1019,11 +1019,13 @@ static int nvme_rdma_setup_ctrl(struct nvme_rdma_ctrl *ctrl, bool new)
+               return ret;
+       if (ctrl->ctrl.icdoff) {
++              ret = -EOPNOTSUPP;
+               dev_err(ctrl->ctrl.device, "icdoff is not supported!\n");
+               goto destroy_admin;
+       }
+       if (!(ctrl->ctrl.sgls & (1 << 2))) {
++              ret = -EOPNOTSUPP;
+               dev_err(ctrl->ctrl.device,
+                       "Mandatory keyed sgls are not supported!\n");
+               goto destroy_admin;
+-- 
+2.33.0
+
diff --git a/queue-5.4/nvmet-fix-use-after-free-when-a-port-is-removed.patch b/queue-5.4/nvmet-fix-use-after-free-when-a-port-is-removed.patch
new file mode 100644 (file)
index 0000000..4dc0aa2
--- /dev/null
@@ -0,0 +1,42 @@
+From 0592de467cd89398784794e7183a318d10e382b9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 6 Oct 2021 08:09:43 +0000
+Subject: nvmet: fix use-after-free when a port is removed
+
+From: Israel Rukshin <israelr@nvidia.com>
+
+[ Upstream commit e3e19dcc4c416d65f99f13d55be2b787f8d0050e ]
+
+When a port is removed through configfs, any connected controllers
+are starting teardown flow asynchronously and can still send commands.
+This causes a use-after-free bug for any command that dereferences
+req->port (like in nvmet_parse_io_cmd).
+
+To fix this, wait for all the teardown scheduled works to complete
+(like release_work at rdma/tcp drivers). This ensures there are no
+active controllers when the port is eventually removed.
+
+Signed-off-by: Israel Rukshin <israelr@nvidia.com>
+Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/nvme/target/configfs.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
+index 98613a45bd3b4..baf8a3e4ed12a 100644
+--- a/drivers/nvme/target/configfs.c
++++ b/drivers/nvme/target/configfs.c
+@@ -1148,6 +1148,8 @@ static void nvmet_port_release(struct config_item *item)
+ {
+       struct nvmet_port *port = to_nvmet_port(item);
++      /* Let inflight controllers teardown complete */
++      flush_scheduled_work();
+       list_del(&port->global_entry);
+       kfree(port->ana_state);
+-- 
+2.33.0
+
diff --git a/queue-5.4/nvmet-tcp-fix-use-after-free-when-a-port-is-removed.patch b/queue-5.4/nvmet-tcp-fix-use-after-free-when-a-port-is-removed.patch
new file mode 100644 (file)
index 0000000..ddd55ac
--- /dev/null
@@ -0,0 +1,62 @@
+From f0becd6b7c4303ae7654a6784d2a1ce6d6928bd8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 6 Oct 2021 08:09:45 +0000
+Subject: nvmet-tcp: fix use-after-free when a port is removed
+
+From: Israel Rukshin <israelr@nvidia.com>
+
+[ Upstream commit 2351ead99ce9164fb42555aee3f96af84c4839e9 ]
+
+When removing a port, all its controllers are being removed, but there
+are queues on the port that doesn't belong to any controller (during
+connection time). This causes a use-after-free bug for any command
+that dereferences req->port (like in nvmet_alloc_ctrl). Those queues
+should be destroyed before freeing the port via configfs. Destroy
+the remaining queues after the accept_work was cancelled guarantees
+that no new queue will be created.
+
+Signed-off-by: Israel Rukshin <israelr@nvidia.com>
+Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/nvme/target/tcp.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
+index 6b3d1ba7db7ee..fac1985870765 100644
+--- a/drivers/nvme/target/tcp.c
++++ b/drivers/nvme/target/tcp.c
+@@ -1667,6 +1667,17 @@ err_port:
+       return ret;
+ }
++static void nvmet_tcp_destroy_port_queues(struct nvmet_tcp_port *port)
++{
++      struct nvmet_tcp_queue *queue;
++
++      mutex_lock(&nvmet_tcp_queue_mutex);
++      list_for_each_entry(queue, &nvmet_tcp_queue_list, queue_list)
++              if (queue->port == port)
++                      kernel_sock_shutdown(queue->sock, SHUT_RDWR);
++      mutex_unlock(&nvmet_tcp_queue_mutex);
++}
++
+ static void nvmet_tcp_remove_port(struct nvmet_port *nport)
+ {
+       struct nvmet_tcp_port *port = nport->priv;
+@@ -1676,6 +1687,11 @@ static void nvmet_tcp_remove_port(struct nvmet_port *nport)
+       port->sock->sk->sk_user_data = NULL;
+       write_unlock_bh(&port->sock->sk->sk_callback_lock);
+       cancel_work_sync(&port->accept_work);
++      /*
++       * Destroy the remaining queues, which are not belong to any
++       * controller yet.
++       */
++      nvmet_tcp_destroy_port_queues(port);
+       sock_release(port->sock);
+       kfree(port);
+-- 
+2.33.0
+
diff --git a/queue-5.4/opp-fix-return-in-_opp_add_static_v2.patch b/queue-5.4/opp-fix-return-in-_opp_add_static_v2.patch
new file mode 100644 (file)
index 0000000..eb364ab
--- /dev/null
@@ -0,0 +1,38 @@
+From 572b36e7546a029a467014c3676be0673414253f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 8 Oct 2021 15:46:52 +0800
+Subject: opp: Fix return in _opp_add_static_v2()
+
+From: YueHaibing <yuehaibing@huawei.com>
+
+[ Upstream commit 27ff8187f13ecfec8a26fb1928e906f46f326cc5 ]
+
+Fix sparse warning:
+drivers/opp/of.c:924 _opp_add_static_v2() warn: passing zero to 'ERR_PTR'
+
+For duplicate OPPs 'ret' be set to zero.
+
+Fixes: deac8703da5f ("PM / OPP: _of_add_opp_table_v2(): increment count only if OPP is added")
+Signed-off-by: YueHaibing <yuehaibing@huawei.com>
+Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/opp/of.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/opp/of.c b/drivers/opp/of.c
+index 30cc407c8f93f..ba30694508153 100644
+--- a/drivers/opp/of.c
++++ b/drivers/opp/of.c
+@@ -639,7 +639,7 @@ free_required_opps:
+ free_opp:
+       _opp_free(new_opp);
+-      return ERR_PTR(ret);
++      return ret ? ERR_PTR(ret) : NULL;
+ }
+ /* Initializes OPP tables based on new bindings */
+-- 
+2.33.0
+
diff --git a/queue-5.4/parisc-fix-warning-in-flush_tlb_all.patch b/queue-5.4/parisc-fix-warning-in-flush_tlb_all.patch
new file mode 100644 (file)
index 0000000..8ecf84b
--- /dev/null
@@ -0,0 +1,68 @@
+From d83d9b4659fc69e9815d64e99a798aea36e017f3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 9 Oct 2021 20:24:39 +0200
+Subject: parisc: fix warning in flush_tlb_all
+
+From: Sven Schnelle <svens@stackframe.org>
+
+[ Upstream commit 1030d681319b43869e0d5b568b9d0226652d1a6f ]
+
+I've got the following splat after enabling preemption:
+
+[    3.724721] BUG: using __this_cpu_add() in preemptible [00000000] code: swapper/0/1
+[    3.734630] caller is __this_cpu_preempt_check+0x38/0x50
+[    3.740635] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.15.0-rc4-64bit+ #324
+[    3.744605] Hardware name: 9000/785/C8000
+[    3.744605] Backtrace:
+[    3.744605]  [<00000000401d9d58>] show_stack+0x74/0xb0
+[    3.744605]  [<0000000040c27bd4>] dump_stack_lvl+0x10c/0x188
+[    3.744605]  [<0000000040c27c84>] dump_stack+0x34/0x48
+[    3.744605]  [<0000000040c33438>] check_preemption_disabled+0x178/0x1b0
+[    3.744605]  [<0000000040c334f8>] __this_cpu_preempt_check+0x38/0x50
+[    3.744605]  [<00000000401d632c>] flush_tlb_all+0x58/0x2e0
+[    3.744605]  [<00000000401075c0>] 0x401075c0
+[    3.744605]  [<000000004010b8fc>] 0x4010b8fc
+[    3.744605]  [<00000000401080fc>] 0x401080fc
+[    3.744605]  [<00000000401d5224>] do_one_initcall+0x128/0x378
+[    3.744605]  [<0000000040102de8>] 0x40102de8
+[    3.744605]  [<0000000040c33864>] kernel_init+0x60/0x3a8
+[    3.744605]  [<00000000401d1020>] ret_from_kernel_thread+0x20/0x28
+[    3.744605]
+
+Fix this by moving the __inc_irq_stat() into the locked section.
+
+Signed-off-by: Sven Schnelle <svens@stackframe.org>
+Signed-off-by: Helge Deller <deller@gmx.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/parisc/mm/init.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
+index 3e54484797f62..d769d61cde7ca 100644
+--- a/arch/parisc/mm/init.c
++++ b/arch/parisc/mm/init.c
+@@ -892,9 +892,9 @@ void flush_tlb_all(void)
+ {
+       int do_recycle;
+-      __inc_irq_stat(irq_tlb_count);
+       do_recycle = 0;
+       spin_lock(&sid_lock);
++      __inc_irq_stat(irq_tlb_count);
+       if (dirty_space_ids > RECYCLE_THRESHOLD) {
+           BUG_ON(recycle_inuse);  /* FIXME: Use a semaphore/wait queue here */
+           get_dirty_sids(&recycle_ndirty,recycle_dirty_array);
+@@ -913,8 +913,8 @@ void flush_tlb_all(void)
+ #else
+ void flush_tlb_all(void)
+ {
+-      __inc_irq_stat(irq_tlb_count);
+       spin_lock(&sid_lock);
++      __inc_irq_stat(irq_tlb_count);
+       flush_tlb_all_local(NULL);
+       recycle_sids();
+       spin_unlock(&sid_lock);
+-- 
+2.33.0
+
diff --git a/queue-5.4/parisc-kgdb-add-kgdb_roundup-to-make-kgdb-work-with-.patch b/queue-5.4/parisc-kgdb-add-kgdb_roundup-to-make-kgdb-work-with-.patch
new file mode 100644 (file)
index 0000000..792b0be
--- /dev/null
@@ -0,0 +1,78 @@
+From 314dad22e3206eabc97acf04a6f81753d30e0520 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 15 Oct 2021 21:49:23 +0200
+Subject: parisc/kgdb: add kgdb_roundup() to make kgdb work with idle polling
+
+From: Sven Schnelle <svens@stackframe.org>
+
+[ Upstream commit 66e29fcda1824f0427966fbee2bd2c85bf362c82 ]
+
+With idle polling, IPIs are not sent when a CPU idle, but queued
+and run later from do_idle(). The default kgdb_call_nmi_hook()
+implementation gets the pointer to struct pt_regs from get_irq_reqs(),
+which doesn't work in that case because it was not called from the
+IPI interrupt handler. Fix it by defining our own kgdb_roundup()
+function which sents an IPI_ENTER_KGDB. When that IPI is received
+on the target CPU kgdb_nmicallback() is called.
+
+Signed-off-by: Sven Schnelle <svens@stackframe.org>
+Signed-off-by: Helge Deller <deller@gmx.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/parisc/kernel/smp.c | 19 +++++++++++++++++--
+ 1 file changed, 17 insertions(+), 2 deletions(-)
+
+diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
+index e202c37e56af3..9997465c11820 100644
+--- a/arch/parisc/kernel/smp.c
++++ b/arch/parisc/kernel/smp.c
+@@ -29,6 +29,7 @@
+ #include <linux/bitops.h>
+ #include <linux/ftrace.h>
+ #include <linux/cpu.h>
++#include <linux/kgdb.h>
+ #include <linux/atomic.h>
+ #include <asm/current.h>
+@@ -71,7 +72,10 @@ enum ipi_message_type {
+       IPI_CALL_FUNC,
+       IPI_CPU_START,
+       IPI_CPU_STOP,
+-      IPI_CPU_TEST
++      IPI_CPU_TEST,
++#ifdef CONFIG_KGDB
++      IPI_ENTER_KGDB,
++#endif
+ };
+@@ -169,7 +173,12 @@ ipi_interrupt(int irq, void *dev_id)
+                       case IPI_CPU_TEST:
+                               smp_debug(100, KERN_DEBUG "CPU%d is alive!\n", this_cpu);
+                               break;
+-
++#ifdef CONFIG_KGDB
++                      case IPI_ENTER_KGDB:
++                              smp_debug(100, KERN_DEBUG "CPU%d ENTER_KGDB\n", this_cpu);
++                              kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs());
++                              break;
++#endif
+                       default:
+                               printk(KERN_CRIT "Unknown IPI num on CPU%d: %lu\n",
+                                       this_cpu, which);
+@@ -225,6 +234,12 @@ send_IPI_allbutself(enum ipi_message_type op)
+       }
+ }
++#ifdef CONFIG_KGDB
++void kgdb_roundup_cpus(void)
++{
++      send_IPI_allbutself(IPI_ENTER_KGDB);
++}
++#endif
+ inline void 
+ smp_send_stop(void)   { send_IPI_allbutself(IPI_CPU_STOP); }
+-- 
+2.33.0
+
diff --git a/queue-5.4/parisc-unwind-fix-unwinder-when-config_64bit-is-enab.patch b/queue-5.4/parisc-unwind-fix-unwinder-when-config_64bit-is-enab.patch
new file mode 100644 (file)
index 0000000..6db2c31
--- /dev/null
@@ -0,0 +1,101 @@
+From b669d885ed15249b9b57c7d1bbe670cf9961fe0a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 9 Oct 2021 23:15:17 +0200
+Subject: parisc/unwind: fix unwinder when CONFIG_64BIT is enabled
+
+From: Sven Schnelle <svens@stackframe.org>
+
+[ Upstream commit 8e0ba125c2bf1030af3267058019ba86da96863f ]
+
+With 64 bit kernels unwind_special() is not working because
+it compares the pc to the address of the function descriptor.
+Add a helper function that compares pc with the dereferenced
+address. This fixes all of the backtraces on my c8000. Without
+this changes, a lot of backtraces are missing in kdb or the
+show-all-tasks command from /proc/sysrq-trigger.
+
+Signed-off-by: Sven Schnelle <svens@stackframe.org>
+Signed-off-by: Helge Deller <deller@gmx.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/parisc/kernel/unwind.c | 21 ++++++++++++++-------
+ 1 file changed, 14 insertions(+), 7 deletions(-)
+
+diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c
+index 87ae476d1c4f5..86a57fb0e6fae 100644
+--- a/arch/parisc/kernel/unwind.c
++++ b/arch/parisc/kernel/unwind.c
+@@ -21,6 +21,8 @@
+ #include <asm/ptrace.h>
+ #include <asm/unwind.h>
++#include <asm/switch_to.h>
++#include <asm/sections.h>
+ /* #define DEBUG 1 */
+ #ifdef DEBUG
+@@ -203,6 +205,11 @@ int __init unwind_init(void)
+       return 0;
+ }
++static bool pc_is_kernel_fn(unsigned long pc, void *fn)
++{
++      return (unsigned long)dereference_kernel_function_descriptor(fn) == pc;
++}
++
+ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, int frame_size)
+ {
+       /*
+@@ -221,7 +228,7 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, int
+       extern void * const _call_on_stack;
+ #endif /* CONFIG_IRQSTACKS */
+-      if (pc == (unsigned long) &handle_interruption) {
++      if (pc_is_kernel_fn(pc, handle_interruption)) {
+               struct pt_regs *regs = (struct pt_regs *)(info->sp - frame_size - PT_SZ_ALGN);
+               dbg("Unwinding through handle_interruption()\n");
+               info->prev_sp = regs->gr[30];
+@@ -229,13 +236,13 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, int
+               return 1;
+       }
+-      if (pc == (unsigned long) &ret_from_kernel_thread ||
+-          pc == (unsigned long) &syscall_exit) {
++      if (pc_is_kernel_fn(pc, ret_from_kernel_thread) ||
++          pc_is_kernel_fn(pc, syscall_exit)) {
+               info->prev_sp = info->prev_ip = 0;
+               return 1;
+       }
+-      if (pc == (unsigned long) &intr_return) {
++      if (pc_is_kernel_fn(pc, intr_return)) {
+               struct pt_regs *regs;
+               dbg("Found intr_return()\n");
+@@ -246,20 +253,20 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, int
+               return 1;
+       }
+-      if (pc == (unsigned long) &_switch_to_ret) {
++      if (pc_is_kernel_fn(pc, _switch_to) ||
++          pc_is_kernel_fn(pc, _switch_to_ret)) {
+               info->prev_sp = info->sp - CALLEE_SAVE_FRAME_SIZE;
+               info->prev_ip = *(unsigned long *)(info->prev_sp - RP_OFFSET);
+               return 1;
+       }
+ #ifdef CONFIG_IRQSTACKS
+-      if (pc == (unsigned long) &_call_on_stack) {
++      if (pc_is_kernel_fn(pc, _call_on_stack)) {
+               info->prev_sp = *(unsigned long *)(info->sp - FRAME_SIZE - REG_SZ);
+               info->prev_ip = *(unsigned long *)(info->sp - FRAME_SIZE - RP_OFFSET);
+               return 1;
+       }
+ #endif
+-
+       return 0;
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/pci-aardvark-don-t-spam-about-pio-response-status.patch b/queue-5.4/pci-aardvark-don-t-spam-about-pio-response-status.patch
new file mode 100644 (file)
index 0000000..60c21c7
--- /dev/null
@@ -0,0 +1,42 @@
+From 42af4a42429ad2e804d2fb962ea18f17601c0837 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 5 Oct 2021 20:09:42 +0200
+Subject: PCI: aardvark: Don't spam about PIO Response Status
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Marek Behún <kabel@kernel.org>
+
+[ Upstream commit 464de7e7fff767e87429cd7be09c4f2cb50a6ccb ]
+
+Use dev_dbg() instead of dev_err() in advk_pcie_check_pio_status().
+
+For example CRS is not an error status, it just says that the request
+should be retried.
+
+Link: https://lore.kernel.org/r/20211005180952.6812-4-kabel@kernel.org
+Fixes: 8c39d710363c1 ("PCI: aardvark: Add Aardvark PCI host controller driver")
+Signed-off-by: Marek Behún <kabel@kernel.org>
+Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pci/controller/pci-aardvark.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
+index 7f4c83bde3fe0..785f7ad4ac9c0 100644
+--- a/drivers/pci/controller/pci-aardvark.c
++++ b/drivers/pci/controller/pci-aardvark.c
+@@ -539,7 +539,7 @@ static int advk_pcie_check_pio_status(struct advk_pcie *pcie, bool allow_crs, u3
+       else
+               str_posted = "Posted";
+-      dev_err(dev, "%s PIO Response Status: %s, %#x @ %#x\n",
++      dev_dbg(dev, "%s PIO Response Status: %s, %#x @ %#x\n",
+               str_posted, strcomp_status, reg, advk_readl(pcie, PIO_ADDR_LS));
+       return -EFAULT;
+-- 
+2.33.0
+
diff --git a/queue-5.4/pci-aardvark-fix-preserving-pci_exp_rtctl_crssve-fla.patch b/queue-5.4/pci-aardvark-fix-preserving-pci_exp_rtctl_crssve-fla.patch
new file mode 100644 (file)
index 0000000..003ed5d
--- /dev/null
@@ -0,0 +1,50 @@
+From 3051df8f88225fc38aba4ca1746700950cf2097a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 5 Oct 2021 20:09:43 +0200
+Subject: PCI: aardvark: Fix preserving PCI_EXP_RTCTL_CRSSVE flag on emulated
+ bridge
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Pali Rohár <pali@kernel.org>
+
+[ Upstream commit d419052bc6c60fa4ab2b5a51d5f1e55a66e2b4ff ]
+
+Commit 43f5c77bcbd2 ("PCI: aardvark: Fix reporting CRS value") started
+using CRSSVE flag for handling CRS responses.
+
+PCI_EXP_RTCTL_CRSSVE flag is stored only in emulated config space buffer
+and there is handler for PCI_EXP_RTCTL register. So every read operation
+from config space automatically clears CRSSVE flag as it is not defined in
+PCI_EXP_RTCTL read handler.
+
+Fix this by reading current CRSSVE bit flag from emulated space buffer and
+appending it to PCI_EXP_RTCTL read response.
+
+Link: https://lore.kernel.org/r/20211005180952.6812-5-kabel@kernel.org
+Fixes: 43f5c77bcbd2 ("PCI: aardvark: Fix reporting CRS value")
+Signed-off-by: Pali Rohár <pali@kernel.org>
+Signed-off-by: Marek Behún <kabel@kernel.org>
+Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
+Reviewed-by: Marek Behún <kabel@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pci/controller/pci-aardvark.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
+index 785f7ad4ac9c0..45794ba643d40 100644
+--- a/drivers/pci/controller/pci-aardvark.c
++++ b/drivers/pci/controller/pci-aardvark.c
+@@ -580,6 +580,7 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge,
+       case PCI_EXP_RTCTL: {
+               u32 val = advk_readl(pcie, PCIE_ISR0_MASK_REG);
+               *value = (val & PCIE_MSG_PM_PME_MASK) ? 0 : PCI_EXP_RTCTL_PMEIE;
++              *value |= le16_to_cpu(bridge->pcie_conf.rootctl) & PCI_EXP_RTCTL_CRSSVE;
+               *value |= PCI_EXP_RTCAP_CRSVIS << 16;
+               return PCI_BRIDGE_EMUL_HANDLED;
+       }
+-- 
+2.33.0
+
diff --git a/queue-5.4/perf-bpf-add-missing-free-to-bpf_event__print_bpf_pr.patch b/queue-5.4/perf-bpf-add-missing-free-to-bpf_event__print_bpf_pr.patch
new file mode 100644 (file)
index 0000000..1c9940d
--- /dev/null
@@ -0,0 +1,60 @@
+From e1cd3437af30e2eb24058aec82c3529200b9eb6e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 5 Nov 2021 22:37:33 -0700
+Subject: perf bpf: Add missing free to bpf_event__print_bpf_prog_info()
+
+From: Ian Rogers <irogers@google.com>
+
+[ Upstream commit 88c42f4d6cb249eb68524282f8d4cc32f9059984 ]
+
+If btf__new() is called then there needs to be a corresponding btf__free().
+
+Fixes: f8dfeae009effc0b ("perf bpf: Show more BPF program info in print_bpf_prog_info()")
+Signed-off-by: Ian Rogers <irogers@google.com>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: Alexei Starovoitov <ast@kernel.org>
+Cc: Andrii Nakryiko <andrii@kernel.org>
+Cc: Daniel Borkmann <daniel@iogearbox.net>
+Cc: Jiri Olsa <jolsa@redhat.com>
+Cc: John Fastabend <john.fastabend@gmail.com>
+Cc: KP Singh <kpsingh@kernel.org>
+Cc: Mark Rutland <mark.rutland@arm.com>
+Cc: Martin KaFai Lau <kafai@fb.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Song Liu <songliubraving@fb.com>
+Cc: Stephane Eranian <eranian@google.com>
+Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
+Cc: Yonghong Song <yhs@fb.com>
+Cc: bpf@vger.kernel.org
+Cc: netdev@vger.kernel.org
+Link: http://lore.kernel.org/lkml/20211106053733.3580931-2-irogers@google.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/perf/util/bpf-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
+index f7ed5d122e229..c766813d56be0 100644
+--- a/tools/perf/util/bpf-event.c
++++ b/tools/perf/util/bpf-event.c
+@@ -467,7 +467,7 @@ void bpf_event__print_bpf_prog_info(struct bpf_prog_info *info,
+               synthesize_bpf_prog_name(name, KSYM_NAME_LEN, info, btf, 0);
+               fprintf(fp, "# bpf_prog_info %u: %s addr 0x%llx size %u\n",
+                       info->id, name, prog_addrs[0], prog_lens[0]);
+-              return;
++              goto out;
+       }
+       fprintf(fp, "# bpf_prog_info %u:\n", info->id);
+@@ -477,4 +477,6 @@ void bpf_event__print_bpf_prog_info(struct bpf_prog_info *info,
+               fprintf(fp, "# \tsub_prog %u: %s addr 0x%llx size %u\n",
+                       i, name, prog_addrs[i], prog_lens[i]);
+       }
++out:
++      btf__free(btf);
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/phy-micrel-ksz8041nl-do-not-use-power-down-mode.patch b/queue-5.4/phy-micrel-ksz8041nl-do-not-use-power-down-mode.patch
new file mode 100644 (file)
index 0000000..b63e5a2
--- /dev/null
@@ -0,0 +1,57 @@
+From ddd7f2f6f63569e73311f46d3b105d7a2c16e2c2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 19 Oct 2021 21:16:47 +0200
+Subject: phy: micrel: ksz8041nl: do not use power down mode
+
+From: Stefan Agner <stefan@agner.ch>
+
+[ Upstream commit 2641b62d2fab52648e34cdc6994b2eacde2d27c1 ]
+
+Some Micrel KSZ8041NL PHY chips exhibit continuous RX errors after using
+the power down mode bit (0.11). If the PHY is taken out of power down
+mode in a certain temperature range, the PHY enters a weird state which
+leads to continuously reporting RX errors. In that state, the MAC is not
+able to receive or send any Ethernet frames and the activity LED is
+constantly blinking. Since Linux is using the suspend callback when the
+interface is taken down, ending up in that state can easily happen
+during a normal startup.
+
+Micrel confirmed the issue in errata DS80000700A [*], caused by abnormal
+clock recovery when using power down mode. Even the latest revision (A4,
+Revision ID 0x1513) seems to suffer that problem, and according to the
+errata is not going to be fixed.
+
+Remove the suspend/resume callback to avoid using the power down mode
+completely.
+
+[*] https://ww1.microchip.com/downloads/en/DeviceDoc/80000700A.pdf
+
+Fixes: 1a5465f5d6a2 ("phy/micrel: Add suspend/resume support to Micrel PHYs")
+Signed-off-by: Stefan Agner <stefan@agner.ch>
+Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
+Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/phy/micrel.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
+index f95bd1b0fb965..0b61d80ea3f8c 100644
+--- a/drivers/net/phy/micrel.c
++++ b/drivers/net/phy/micrel.c
+@@ -1040,8 +1040,9 @@ static struct phy_driver ksphy_driver[] = {
+       .get_sset_count = kszphy_get_sset_count,
+       .get_strings    = kszphy_get_strings,
+       .get_stats      = kszphy_get_stats,
+-      .suspend        = genphy_suspend,
+-      .resume         = genphy_resume,
++      /* No suspend/resume callbacks because of errata DS80000700A,
++       * receiver error following software power down.
++       */
+ }, {
+       .phy_id         = PHY_ID_KSZ8041RNLI,
+       .phy_id_mask    = MICREL_PHY_ID_MASK,
+-- 
+2.33.0
+
diff --git a/queue-5.4/phy-qcom-qusb2-fix-a-memory-leak-on-probe.patch b/queue-5.4/phy-qcom-qusb2-fix-a-memory-leak-on-probe.patch
new file mode 100644 (file)
index 0000000..7752a20
--- /dev/null
@@ -0,0 +1,94 @@
+From ed268877df930d55a71a9a5d777bbc012cd006e9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 23 Sep 2021 02:35:48 +0300
+Subject: phy: qcom-qusb2: Fix a memory leak on probe
+
+From: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
+
+[ Upstream commit bf7ffcd0069d30e2e7ba2b827f08c89f471cd1f3 ]
+
+On success nvmem_cell_read() returns a pointer to a dynamically allocated
+buffer, and therefore it shall be freed after usage.
+
+The issue is reported by kmemleak:
+
+  # cat /sys/kernel/debug/kmemleak
+  unreferenced object 0xffff3b3803e4b280 (size 128):
+    comm "kworker/u16:1", pid 107, jiffies 4294892861 (age 94.120s)
+    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:
+      [<000000007739afdc>] __kmalloc+0x27c/0x41c
+      [<0000000071c0fbf8>] nvmem_cell_read+0x40/0xe0
+      [<00000000e803ef1f>] qusb2_phy_init+0x258/0x5bc
+      [<00000000fc81fcfa>] phy_init+0x70/0x110
+      [<00000000e3d48a57>] dwc3_core_soft_reset+0x4c/0x234
+      [<0000000027d1dbd4>] dwc3_core_init+0x68/0x990
+      [<000000001965faf9>] dwc3_probe+0x4f4/0x730
+      [<000000002f7617ca>] platform_probe+0x74/0xf0
+      [<00000000a2576cac>] really_probe+0xc4/0x470
+      [<00000000bc77f2c5>] __driver_probe_device+0x11c/0x190
+      [<00000000130db71f>] driver_probe_device+0x48/0x110
+      [<0000000019f36c2b>] __device_attach_driver+0xa4/0x140
+      [<00000000e5812ff7>]  bus_for_each_drv+0x84/0xe0
+      [<00000000f4bac574>] __device_attach+0xe4/0x1c0
+      [<00000000d3beb631>] device_initial_probe+0x20/0x30
+      [<000000008019b9db>] bus_probe_device+0xa4/0xb0
+
+Fixes: ca04d9d3e1b1 ("phy: qcom-qusb2: New driver for QUSB2 PHY on Qcom chips")
+Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
+Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
+Link: https://lore.kernel.org/r/20210922233548.2150244-1-vladimir.zapolskiy@linaro.org
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/phy/qualcomm/phy-qcom-qusb2.c | 16 ++++++++++------
+ 1 file changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c b/drivers/phy/qualcomm/phy-qcom-qusb2.c
+index bf94a52d30871..946e9b05f0ae6 100644
+--- a/drivers/phy/qualcomm/phy-qcom-qusb2.c
++++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c
+@@ -432,7 +432,7 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy)
+ {
+       struct device *dev = &qphy->phy->dev;
+       const struct qusb2_phy_cfg *cfg = qphy->cfg;
+-      u8 *val;
++      u8 *val, hstx_trim;
+       /* efuse register is optional */
+       if (!qphy->cell)
+@@ -446,7 +446,13 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy)
+        * set while configuring the phy.
+        */
+       val = nvmem_cell_read(qphy->cell, NULL);
+-      if (IS_ERR(val) || !val[0]) {
++      if (IS_ERR(val)) {
++              dev_dbg(dev, "failed to read a valid hs-tx trim value\n");
++              return;
++      }
++      hstx_trim = val[0];
++      kfree(val);
++      if (!hstx_trim) {
+               dev_dbg(dev, "failed to read a valid hs-tx trim value\n");
+               return;
+       }
+@@ -454,12 +460,10 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy)
+       /* Fused TUNE1/2 value is the higher nibble only */
+       if (cfg->update_tune1_with_efuse)
+               qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE1],
+-                               val[0] << HSTX_TRIM_SHIFT,
+-                               HSTX_TRIM_MASK);
++                               hstx_trim << HSTX_TRIM_SHIFT, HSTX_TRIM_MASK);
+       else
+               qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE2],
+-                               val[0] << HSTX_TRIM_SHIFT,
+-                               HSTX_TRIM_MASK);
++                               hstx_trim << HSTX_TRIM_SHIFT, HSTX_TRIM_MASK);
+ }
+ static int qusb2_phy_set_mode(struct phy *phy,
+-- 
+2.33.0
+
diff --git a/queue-5.4/platform-x86-thinkpad_acpi-fix-bitwise-vs.-logical-w.patch b/queue-5.4/platform-x86-thinkpad_acpi-fix-bitwise-vs.-logical-w.patch
new file mode 100644 (file)
index 0000000..5f12d43
--- /dev/null
@@ -0,0 +1,50 @@
+From d2c3681f04eb3247d75be60ff48fffb1bb6903e4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 18 Oct 2021 11:25:37 -0700
+Subject: platform/x86: thinkpad_acpi: Fix bitwise vs. logical warning
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+[ Upstream commit fd96e35ea7b95f1e216277805be89d66e4ae962d ]
+
+A new warning in clang points out a use of bitwise OR with boolean
+expressions in this driver:
+
+drivers/platform/x86/thinkpad_acpi.c:9061:11: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
+        else if ((strlencmp(cmd, "level disengaged") == 0) |
+                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+                                                           ||
+drivers/platform/x86/thinkpad_acpi.c:9061:11: note: cast one or both operands to int to silence this warning
+1 error generated.
+
+This should clearly be a logical OR so change it to fix the warning.
+
+Fixes: fe98a52ce754 ("ACPI: thinkpad-acpi: add sysfs support to fan subdriver")
+Link: https://github.com/ClangBuiltLinux/linux/issues/1476
+Reported-by: Tor Vic <torvic9@mailbox.org>
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Link: https://lore.kernel.org/r/20211018182537.2316800-1-nathan@kernel.org
+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>
+---
+ drivers/platform/x86/thinkpad_acpi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
+index f027609fdab6d..3028d9f1ac59c 100644
+--- a/drivers/platform/x86/thinkpad_acpi.c
++++ b/drivers/platform/x86/thinkpad_acpi.c
+@@ -9086,7 +9086,7 @@ static int fan_write_cmd_level(const char *cmd, int *rc)
+       if (strlencmp(cmd, "level auto") == 0)
+               level = TP_EC_FAN_AUTO;
+-      else if ((strlencmp(cmd, "level disengaged") == 0) |
++      else if ((strlencmp(cmd, "level disengaged") == 0) ||
+                       (strlencmp(cmd, "level full-speed") == 0))
+               level = TP_EC_FAN_FULLSPEED;
+       else if (sscanf(cmd, "level %d", &level) != 1)
+-- 
+2.33.0
+
diff --git a/queue-5.4/platform-x86-wmi-do-not-fail-if-disabling-fails.patch b/queue-5.4/platform-x86-wmi-do-not-fail-if-disabling-fails.patch
new file mode 100644 (file)
index 0000000..9cee4ec
--- /dev/null
@@ -0,0 +1,52 @@
+From 2588e5f1cc8ab530d93744f6a8b9474b061bd26f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 4 Sep 2021 17:56:26 +0000
+Subject: platform/x86: wmi: do not fail if disabling fails
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Barnabás PÅ‘cze <pobrn@protonmail.com>
+
+[ Upstream commit 1975718c488a39128f1f515b23ae61a5a214cc3d ]
+
+Previously, `__query_block()` would fail if the
+second WCxx method call failed. However, the
+WQxx method might have succeeded, and potentially
+allocated memory for the result. Instead of
+throwing away the result and potentially
+leaking memory, ignore the result of
+the second WCxx call.
+
+Signed-off-by: Barnabás PÅ‘cze <pobrn@protonmail.com>
+Link: https://lore.kernel.org/r/20210904175450.156801-25-pobrn@protonmail.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>
+---
+ drivers/platform/x86/wmi.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
+index 59e9aa0f96436..cb029126a68c6 100644
+--- a/drivers/platform/x86/wmi.c
++++ b/drivers/platform/x86/wmi.c
+@@ -353,7 +353,14 @@ static acpi_status __query_block(struct wmi_block *wblock, u8 instance,
+        * the WQxx method failed - we should disable collection anyway.
+        */
+       if ((block->flags & ACPI_WMI_EXPENSIVE) && ACPI_SUCCESS(wc_status)) {
+-              status = acpi_execute_simple_method(handle, wc_method, 0);
++              /*
++               * Ignore whether this WCxx call succeeds or not since
++               * the previously executed WQxx method call might have
++               * succeeded, and returning the failing status code
++               * of this call would throw away the result of the WQxx
++               * call, potentially leaking memory.
++               */
++              acpi_execute_simple_method(handle, wc_method, 0);
+       }
+       return status;
+-- 
+2.33.0
+
diff --git a/queue-5.4/pm-hibernate-fix-sparse-warnings.patch b/queue-5.4/pm-hibernate-fix-sparse-warnings.patch
new file mode 100644 (file)
index 0000000..94ed3ab
--- /dev/null
@@ -0,0 +1,52 @@
+From 5f56a1559fc86332f335a7a10a8a7b100bfeeec4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 7 Oct 2021 21:13:37 +0200
+Subject: PM: hibernate: fix sparse warnings
+
+From: Anders Roxell <anders.roxell@linaro.org>
+
+[ Upstream commit 01de5fcd8b1ac0ca28d2bb0921226a54fdd62684 ]
+
+When building the kernel with sparse enabled 'C=1' the following
+warnings shows up:
+
+kernel/power/swap.c:390:29: warning: incorrect type in assignment (different base types)
+kernel/power/swap.c:390:29:    expected int ret
+kernel/power/swap.c:390:29:    got restricted blk_status_t
+
+This is due to function hib_wait_io() returns a 'blk_status_t' which is
+a bitwise u8. Commit 5416da01ff6e ("PM: hibernate: Remove
+blk_status_to_errno in hib_wait_io") seemed to have mixed up the return
+type. However, the 4e4cbee93d56 ("block: switch bios to blk_status_t")
+actually broke the behaviour by returning the wrong type.
+
+Rework so function hib_wait_io() returns a 'int' instead of
+'blk_status_t' and make sure to call function
+blk_status_to_errno(hb->error)' when returning from function
+hib_wait_io() a int gets returned.
+
+Fixes: 4e4cbee93d56 ("block: switch bios to blk_status_t")
+Fixes: 5416da01ff6e ("PM: hibernate: Remove blk_status_to_errno in hib_wait_io")
+Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/power/swap.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/kernel/power/swap.c b/kernel/power/swap.c
+index d32cd03d5ff8c..bcc9769e8a3b5 100644
+--- a/kernel/power/swap.c
++++ b/kernel/power/swap.c
+@@ -292,7 +292,7 @@ static int hib_submit_io(int op, int op_flags, pgoff_t page_off, void *addr,
+       return error;
+ }
+-static blk_status_t hib_wait_io(struct hib_bio_batch *hb)
++static int hib_wait_io(struct hib_bio_batch *hb)
+ {
+       wait_event(hb->wait, atomic_read(&hb->count) == 0);
+       return blk_status_to_errno(hb->error);
+-- 
+2.33.0
+
diff --git a/queue-5.4/pm-hibernate-get-block-device-exclusively-in-swsusp_.patch b/queue-5.4/pm-hibernate-get-block-device-exclusively-in-swsusp_.patch
new file mode 100644 (file)
index 0000000..705a2b6
--- /dev/null
@@ -0,0 +1,100 @@
+From a09ac81cf8284c9df91d9614863e3f5c5b1e00dd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 13 Oct 2021 20:19:14 +0800
+Subject: PM: hibernate: Get block device exclusively in swsusp_check()
+
+From: Ye Bin <yebin10@huawei.com>
+
+[ Upstream commit 39fbef4b0f77f9c89c8f014749ca533643a37c9f ]
+
+The following kernel crash can be triggered:
+
+[   89.266592] ------------[ cut here ]------------
+[   89.267427] kernel BUG at fs/buffer.c:3020!
+[   89.268264] invalid opcode: 0000 [#1] SMP KASAN PTI
+[   89.269116] CPU: 7 PID: 1750 Comm: kmmpd-loop0 Not tainted 5.10.0-862.14.0.6.x86_64-08610-gc932cda3cef4-dirty #20
+[   89.273169] RIP: 0010:submit_bh_wbc.isra.0+0x538/0x6d0
+[   89.277157] RSP: 0018:ffff888105ddfd08 EFLAGS: 00010246
+[   89.278093] RAX: 0000000000000005 RBX: ffff888124231498 RCX: ffffffffb2772612
+[   89.279332] RDX: 1ffff11024846293 RSI: 0000000000000008 RDI: ffff888124231498
+[   89.280591] RBP: ffff8881248cc000 R08: 0000000000000001 R09: ffffed1024846294
+[   89.281851] R10: ffff88812423149f R11: ffffed1024846293 R12: 0000000000003800
+[   89.283095] R13: 0000000000000001 R14: 0000000000000000 R15: ffff8881161f7000
+[   89.284342] FS:  0000000000000000(0000) GS:ffff88839b5c0000(0000) knlGS:0000000000000000
+[   89.285711] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+[   89.286701] CR2: 00007f166ebc01a0 CR3: 0000000435c0e000 CR4: 00000000000006e0
+[   89.287919] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+[   89.289138] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
+[   89.290368] Call Trace:
+[   89.290842]  write_mmp_block+0x2ca/0x510
+[   89.292218]  kmmpd+0x433/0x9a0
+[   89.294902]  kthread+0x2dd/0x3e0
+[   89.296268]  ret_from_fork+0x22/0x30
+[   89.296906] Modules linked in:
+
+by running the following commands:
+
+ 1. mkfs.ext4 -O mmp  /dev/sda -b 1024
+ 2. mount /dev/sda /home/test
+ 3. echo "/dev/sda" > /sys/power/resume
+
+That happens because swsusp_check() calls set_blocksize() on the
+target partition which confuses the file system:
+
+       Thread1                       Thread2
+mount /dev/sda /home/test
+get s_mmp_bh  --> has mapped flag
+start kmmpd thread
+                               echo "/dev/sda" > /sys/power/resume
+                                 resume_store
+                                   software_resume
+                                     swsusp_check
+                                       set_blocksize
+                                         truncate_inode_pages_range
+                                           truncate_cleanup_page
+                                             block_invalidatepage
+                                               discard_buffer --> clean mapped flag
+write_mmp_block
+  submit_bh
+    submit_bh_wbc
+      BUG_ON(!buffer_mapped(bh))
+
+To address this issue, modify swsusp_check() to open the target block
+device with exclusive access.
+
+Signed-off-by: Ye Bin <yebin10@huawei.com>
+[ rjw: Subject and changelog edits ]
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/power/swap.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/kernel/power/swap.c b/kernel/power/swap.c
+index 0516c422206d8..d32cd03d5ff8c 100644
+--- a/kernel/power/swap.c
++++ b/kernel/power/swap.c
+@@ -1509,9 +1509,10 @@ end:
+ int swsusp_check(void)
+ {
+       int error;
++      void *holder;
+       hib_resume_bdev = blkdev_get_by_dev(swsusp_resume_device,
+-                                          FMODE_READ, NULL);
++                                          FMODE_READ | FMODE_EXCL, &holder);
+       if (!IS_ERR(hib_resume_bdev)) {
+               set_blocksize(hib_resume_bdev, PAGE_SIZE);
+               clear_page(swsusp_header);
+@@ -1533,7 +1534,7 @@ int swsusp_check(void)
+ put:
+               if (error)
+-                      blkdev_put(hib_resume_bdev, FMODE_READ);
++                      blkdev_put(hib_resume_bdev, FMODE_READ | FMODE_EXCL);
+               else
+                       pr_debug("Image signature found, resuming\n");
+       } else {
+-- 
+2.33.0
+
diff --git a/queue-5.4/pnfs-flexfiles-fix-misplaced-barrier-in-nfs4_ff_layo.patch b/queue-5.4/pnfs-flexfiles-fix-misplaced-barrier-in-nfs4_ff_layo.patch
new file mode 100644 (file)
index 0000000..afa6078
--- /dev/null
@@ -0,0 +1,74 @@
+From 36e75b80398a655deeb9b726a3d6a5e081c4b8a1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 6 Sep 2021 11:59:24 +1000
+Subject: pnfs/flexfiles: Fix misplaced barrier in nfs4_ff_layout_prepare_ds
+
+From: Baptiste Lepers <baptiste.lepers@gmail.com>
+
+[ Upstream commit a2915fa06227b056a8f9b0d79b61dca08ad5cfc6 ]
+
+_nfs4_pnfs_v3/v4_ds_connect do
+   some work
+   smp_wmb
+   ds->ds_clp = clp;
+
+And nfs4_ff_layout_prepare_ds currently does
+   smp_rmb
+   if(ds->ds_clp)
+      ...
+
+This patch places the smp_rmb after the if. This ensures that following
+reads only happen once nfs4_ff_layout_prepare_ds has checked that data
+has been properly initialized.
+
+Fixes: d67ae825a59d6 ("pnfs/flexfiles: Add the FlexFile Layout Driver")
+Signed-off-by: Baptiste Lepers <baptiste.lepers@gmail.com>
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/flexfilelayout/flexfilelayoutdev.c | 4 ++--
+ fs/nfs/pnfs_nfs.c                         | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
+index 3eda40a320a53..1f12297109b41 100644
+--- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
++++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
+@@ -378,10 +378,10 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg,
+               goto noconnect;
+       ds = mirror->mirror_ds->ds;
++      if (READ_ONCE(ds->ds_clp))
++              goto out;
+       /* matching smp_wmb() in _nfs4_pnfs_v3/4_ds_connect */
+       smp_rmb();
+-      if (ds->ds_clp)
+-              goto out;
+       /* FIXME: For now we assume the server sent only one version of NFS
+        * to use for the DS.
+diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c
+index 249cf9037dbd7..aff44a7b98f86 100644
+--- a/fs/nfs/pnfs_nfs.c
++++ b/fs/nfs/pnfs_nfs.c
+@@ -641,7 +641,7 @@ static int _nfs4_pnfs_v3_ds_connect(struct nfs_server *mds_srv,
+       }
+       smp_wmb();
+-      ds->ds_clp = clp;
++      WRITE_ONCE(ds->ds_clp, clp);
+       dprintk("%s [new] addr: %s\n", __func__, ds->ds_remotestr);
+ out:
+       return status;
+@@ -714,7 +714,7 @@ static int _nfs4_pnfs_v4_ds_connect(struct nfs_server *mds_srv,
+       }
+       smp_wmb();
+-      ds->ds_clp = clp;
++      WRITE_ONCE(ds->ds_clp, clp);
+       dprintk("%s [new] addr: %s\n", __func__, ds->ds_remotestr);
+ out:
+       return status;
+-- 
+2.33.0
+
diff --git a/queue-5.4/power-supply-bq27xxx-fix-kernel-crash-on-irq-handler.patch b/queue-5.4/power-supply-bq27xxx-fix-kernel-crash-on-irq-handler.patch
new file mode 100644 (file)
index 0000000..0e7f4ab
--- /dev/null
@@ -0,0 +1,45 @@
+From a523e79425b6b563abc09af1077968d3e795c232 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 31 Oct 2021 16:25:22 +0100
+Subject: power: supply: bq27xxx: Fix kernel crash on IRQ handler register
+ error
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+[ Upstream commit cdf10ffe8f626d8a2edc354abf063df0078b2d71 ]
+
+When registering the IRQ handler fails, do not just return the error code,
+this will free the devm_kzalloc()-ed data struct while leaving the queued
+work queued and the registered power_supply registered with both of them
+now pointing to free-ed memory, resulting in various kernel crashes
+soon afterwards.
+
+Instead properly tear-down things on IRQ handler register errors.
+
+Fixes: 703df6c09795 ("power: bq27xxx_battery: Reorganize I2C into a module")
+Cc: Andrew F. Davis <afd@ti.com>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
+Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/power/supply/bq27xxx_battery_i2c.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
+index 2677c38a8a424..34229c1f43e31 100644
+--- a/drivers/power/supply/bq27xxx_battery_i2c.c
++++ b/drivers/power/supply/bq27xxx_battery_i2c.c
+@@ -195,7 +195,8 @@ static int bq27xxx_battery_i2c_probe(struct i2c_client *client,
+                       dev_err(&client->dev,
+                               "Unable to register IRQ %d error %d\n",
+                               client->irq, ret);
+-                      return ret;
++                      bq27xxx_battery_teardown(di);
++                      goto err_failed;
+               }
+       }
+-- 
+2.33.0
+
diff --git a/queue-5.4/power-supply-rt5033_battery-change-voltage-values-to.patch b/queue-5.4/power-supply-rt5033_battery-change-voltage-values-to.patch
new file mode 100644 (file)
index 0000000..9d89c97
--- /dev/null
@@ -0,0 +1,42 @@
+From f06a24ae323aeb1e929b0c9e1c9e5c39f832bc58 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 8 Oct 2021 10:32:45 +0200
+Subject: =?UTF-8?q?power:=20supply:=20rt5033=5Fbattery:=20Change=20voltage?=
+ =?UTF-8?q?=20values=20to=20=C2=B5V?=
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Jakob Hauser <jahau@rocketmail.com>
+
+[ Upstream commit bf895295e9a73411889816f1a0c1f4f1a2d9c678 ]
+
+Currently the rt5033_battery driver provides voltage values in mV. It
+should be ÂµV as stated in Documentation/power/power_supply_class.rst.
+
+Fixes: b847dd96e659 ("power: rt5033_battery: Add RT5033 Fuel gauge device driver")
+Cc: Beomho Seo <beomho.seo@samsung.com>
+Cc: Chanwoo Choi <cw00.choi@samsung.com>
+Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
+Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/power/supply/rt5033_battery.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/power/supply/rt5033_battery.c b/drivers/power/supply/rt5033_battery.c
+index 6609f8cb8ca01..ef53891b88bbc 100644
+--- a/drivers/power/supply/rt5033_battery.c
++++ b/drivers/power/supply/rt5033_battery.c
+@@ -60,7 +60,7 @@ static int rt5033_battery_get_watt_prop(struct i2c_client *client,
+       regmap_read(battery->regmap, regh, &msb);
+       regmap_read(battery->regmap, regl, &lsb);
+-      ret = ((msb << 4) + (lsb >> 4)) * 1250 / 1000;
++      ret = ((msb << 4) + (lsb >> 4)) * 1250;
+       return ret;
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/powerpc-44x-fsp2-add-missing-of_node_put.patch b/queue-5.4/powerpc-44x-fsp2-add-missing-of_node_put.patch
new file mode 100644 (file)
index 0000000..e1cd4f4
--- /dev/null
@@ -0,0 +1,48 @@
+From 2c331e307e85adc0e249aa1355af08266127e21f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 28 Oct 2021 15:28:22 +0800
+Subject: powerpc/44x/fsp2: add missing of_node_put
+
+From: Bixuan Cui <cuibixuan@linux.alibaba.com>
+
+[ Upstream commit 290fe8aa69ef5c51c778c0bb33f8ef0181c769f5 ]
+
+Early exits from for_each_compatible_node() should decrement the
+node reference counter.  Reported by Coccinelle:
+
+./arch/powerpc/platforms/44x/fsp2.c:206:1-25: WARNING: Function
+"for_each_compatible_node" should have of_node_put() before return
+around line 218.
+
+Fixes: 7813043e1bbc ("powerpc/44x/fsp2: Add irq error handlers")
+Signed-off-by: Bixuan Cui <cuibixuan@linux.alibaba.com>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://lore.kernel.org/r/1635406102-88719-1-git-send-email-cuibixuan@linux.alibaba.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/powerpc/platforms/44x/fsp2.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/powerpc/platforms/44x/fsp2.c b/arch/powerpc/platforms/44x/fsp2.c
+index b299e43f5ef94..823397c802def 100644
+--- a/arch/powerpc/platforms/44x/fsp2.c
++++ b/arch/powerpc/platforms/44x/fsp2.c
+@@ -208,6 +208,7 @@ static void node_irq_request(const char *compat, irq_handler_t errirq_handler)
+               if (irq == NO_IRQ) {
+                       pr_err("device tree node %pOFn is missing a interrupt",
+                             np);
++                      of_node_put(np);
+                       return;
+               }
+@@ -215,6 +216,7 @@ static void node_irq_request(const char *compat, irq_handler_t errirq_handler)
+               if (rc) {
+                       pr_err("fsp_of_probe: request_irq failed: np=%pOF rc=%d",
+                             np, rc);
++                      of_node_put(np);
+                       return;
+               }
+       }
+-- 
+2.33.0
+
diff --git a/queue-5.4/rcu-fix-existing-exp-request-check-in-sync_sched_exp.patch b/queue-5.4/rcu-fix-existing-exp-request-check-in-sync_sched_exp.patch
new file mode 100644 (file)
index 0000000..d8aa3c6
--- /dev/null
@@ -0,0 +1,45 @@
+From fcae45b9a940a7ac037f104acb80da97bb804bbf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 18 Aug 2021 13:34:00 +0530
+Subject: rcu: Fix existing exp request check in
+ sync_sched_exp_online_cleanup()
+
+From: Neeraj Upadhyay <neeraju@codeaurora.org>
+
+[ Upstream commit f0b2b2df5423fb369ac762c77900bc7765496d58 ]
+
+The sync_sched_exp_online_cleanup() checks to see if RCU needs
+an expedited quiescent state from the incoming CPU, sending it
+an IPI if so. Before sending IPI, it checks whether expedited
+qs need has been already requested for the incoming CPU, by
+checking rcu_data.cpu_no_qs.b.exp for the current cpu, on which
+sync_sched_exp_online_cleanup() is running. This works for the
+case where incoming CPU is same as self. However, for the case
+where incoming CPU is different from self, expedited request
+won't get marked, which can potentially delay reporting of
+expedited quiescent state for the incoming CPU.
+
+Fixes: e015a3411220 ("rcu: Avoid self-IPI in sync_sched_exp_online_cleanup()")
+Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
+Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/rcu/tree_exp.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h
+index df90d4d7ad2e2..4c4d7683a4e5b 100644
+--- a/kernel/rcu/tree_exp.h
++++ b/kernel/rcu/tree_exp.h
+@@ -738,7 +738,7 @@ static void sync_sched_exp_online_cleanup(int cpu)
+       my_cpu = get_cpu();
+       /* Quiescent state either not needed or already requested, leave. */
+       if (!(READ_ONCE(rnp->expmask) & rdp->grpmask) ||
+-          __this_cpu_read(rcu_data.cpu_no_qs.b.exp)) {
++          rdp->cpu_no_qs.b.exp) {
+               put_cpu();
+               return;
+       }
+-- 
+2.33.0
+
diff --git a/queue-5.4/rdma-bnxt_re-fix-query-srq-failure.patch b/queue-5.4/rdma-bnxt_re-fix-query-srq-failure.patch
new file mode 100644 (file)
index 0000000..251e82f
--- /dev/null
@@ -0,0 +1,43 @@
+From 1ab6d617075e646cc1cc68e29415272c5e50c422 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 15 Sep 2021 05:32:38 -0700
+Subject: RDMA/bnxt_re: Fix query SRQ failure
+
+From: Selvin Xavier <selvin.xavier@broadcom.com>
+
+[ Upstream commit 598d16fa1bf93431ad35bbab3ed1affe4fb7b562 ]
+
+Fill the missing parameters for the FW command while querying SRQ.
+
+Fixes: 37cb11acf1f7 ("RDMA/bnxt_re: Add SRQ support for Broadcom adapters")
+Link: https://lore.kernel.org/r/1631709163-2287-8-git-send-email-selvin.xavier@broadcom.com
+Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
+Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
+Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/infiniband/hw/bnxt_re/qplib_fp.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
+index 4d07d22bfa7b1..5fc5ab7813c0f 100644
+--- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c
++++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
+@@ -642,12 +642,13 @@ int bnxt_qplib_query_srq(struct bnxt_qplib_res *res,
+       int rc = 0;
+       RCFW_CMD_PREP(req, QUERY_SRQ, cmd_flags);
+-      req.srq_cid = cpu_to_le32(srq->id);
+       /* Configure the request */
+       sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb));
+       if (!sbuf)
+               return -ENOMEM;
++      req.resp_size = sizeof(*sb) / BNXT_QPLIB_CMDQE_UNITS;
++      req.srq_cid = cpu_to_le32(srq->id);
+       sb = sbuf->sb;
+       rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp,
+                                         (void *)sbuf, 0);
+-- 
+2.33.0
+
diff --git a/queue-5.4/rdma-mlx4-return-missed-an-error-if-device-doesn-t-s.patch b/queue-5.4/rdma-mlx4-return-missed-an-error-if-device-doesn-t-s.patch
new file mode 100644 (file)
index 0000000..b4848dd
--- /dev/null
@@ -0,0 +1,42 @@
+From 798a3589ffefe632bd0c6acf8549bb417b7e963f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 12 Oct 2021 10:28:43 +0300
+Subject: RDMA/mlx4: Return missed an error if device doesn't support steering
+
+From: Leon Romanovsky <leonro@nvidia.com>
+
+[ Upstream commit f4e56ec4452f48b8292dcf0e1c4bdac83506fb8b ]
+
+The error flow fixed in this patch is not possible because all kernel
+users of create QP interface check that device supports steering before
+set IB_QP_CREATE_NETIF_QP flag.
+
+Fixes: c1c98501121e ("IB/mlx4: Add support for steerable IB UD QPs")
+Link: https://lore.kernel.org/r/91c61f6e60eb0240f8bbc321fda7a1d2986dd03c.1634023677.git.leonro@nvidia.com
+Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
+Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
+Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/infiniband/hw/mlx4/qp.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
+index 17ce928e41bde..bca5358f3ef29 100644
+--- a/drivers/infiniband/hw/mlx4/qp.c
++++ b/drivers/infiniband/hw/mlx4/qp.c
+@@ -1149,8 +1149,10 @@ static int create_qp_common(struct ib_pd *pd, struct ib_qp_init_attr *init_attr,
+                       if (dev->steering_support ==
+                           MLX4_STEERING_MODE_DEVICE_MANAGED)
+                               qp->flags |= MLX4_IB_QP_NETIF;
+-                      else
++                      else {
++                              err = -EINVAL;
+                               goto err;
++                      }
+               }
+               err = set_kernel_sq_size(dev, &init_attr->cap, qp_type, qp);
+-- 
+2.33.0
+
diff --git a/queue-5.4/rdma-rxe-fix-wrong-port_cap_flags.patch b/queue-5.4/rdma-rxe-fix-wrong-port_cap_flags.patch
new file mode 100644 (file)
index 0000000..ab58317
--- /dev/null
@@ -0,0 +1,39 @@
+From 6dee7b3da8995655bc6682e050373c8b6490ba90 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 31 Aug 2021 16:32:23 +0800
+Subject: RDMA/rxe: Fix wrong port_cap_flags
+
+From: Junji Wei <weijunji@bytedance.com>
+
+[ Upstream commit dcd3f985b20ffcc375f82ca0ca9f241c7025eb5e ]
+
+The port->attr.port_cap_flags should be set to enum
+ib_port_capability_mask_bits in ib_mad.h, not
+RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP.
+
+Fixes: 8700e3e7c485 ("Soft RoCE driver")
+Link: https://lore.kernel.org/r/20210831083223.65797-1-weijunji@bytedance.com
+Signed-off-by: Junji Wei <weijunji@bytedance.com>
+Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
+Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/infiniband/sw/rxe/rxe_param.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/infiniband/sw/rxe/rxe_param.h
+index fe52073867006..8d3f6d93dfb8d 100644
+--- a/drivers/infiniband/sw/rxe/rxe_param.h
++++ b/drivers/infiniband/sw/rxe/rxe_param.h
+@@ -140,7 +140,7 @@ enum rxe_device_param {
+ /* default/initial rxe port parameters */
+ enum rxe_port_param {
+       RXE_PORT_GID_TBL_LEN            = 1024,
+-      RXE_PORT_PORT_CAP_FLAGS         = RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP,
++      RXE_PORT_PORT_CAP_FLAGS         = IB_PORT_CM_SUP,
+       RXE_PORT_MAX_MSG_SZ             = 0x800000,
+       RXE_PORT_BAD_PKEY_CNTR          = 0,
+       RXE_PORT_QKEY_VIOL_CNTR         = 0,
+-- 
+2.33.0
+
diff --git a/queue-5.4/rpmsg-fix-rpmsg_create_ept-return-when-rpmsg-config-.patch b/queue-5.4/rpmsg-fix-rpmsg_create_ept-return-when-rpmsg-config-.patch
new file mode 100644 (file)
index 0000000..075c6fa
--- /dev/null
@@ -0,0 +1,38 @@
+From 42977cf9ed5a6d7f27f620cc9092cb02854ffd83 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 12 Jul 2021 14:39:12 +0200
+Subject: rpmsg: Fix rpmsg_create_ept return when RPMSG config is not defined
+
+From: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
+
+[ Upstream commit 537d3af1bee8ad1415fda9b622d1ea6d1ae76dfa ]
+
+According to the description of the rpmsg_create_ept in rpmsg_core.c
+the function should return NULL on error.
+
+Fixes: 2c8a57088045 ("rpmsg: Provide function stubs for API")
+Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
+Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
+Link: https://lore.kernel.org/r/20210712123912.10672-1-arnaud.pouliquen@foss.st.com
+Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/rpmsg.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h
+index 9fe156d1c018e..a68972b097b72 100644
+--- a/include/linux/rpmsg.h
++++ b/include/linux/rpmsg.h
+@@ -177,7 +177,7 @@ static inline struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *rpdev
+       /* This shouldn't be possible */
+       WARN_ON(1);
+-      return ERR_PTR(-ENXIO);
++      return NULL;
+ }
+ static inline int rpmsg_send(struct rpmsg_endpoint *ept, void *data, int len)
+-- 
+2.33.0
+
diff --git a/queue-5.4/rsi-stop-thread-firstly-in-rsi_91x_init-error-handli.patch b/queue-5.4/rsi-stop-thread-firstly-in-rsi_91x_init-error-handli.patch
new file mode 100644 (file)
index 0000000..d397d78
--- /dev/null
@@ -0,0 +1,61 @@
+From f819e5d18582ca0a7a42781d9be3fa69e5a64b73 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 15 Oct 2021 12:03:35 +0800
+Subject: rsi: stop thread firstly in rsi_91x_init() error handling
+
+From: Ziyang Xuan <william.xuanziyang@huawei.com>
+
+[ Upstream commit 515e7184bdf0a3ebf1757cc77fb046b4fe282189 ]
+
+When fail to init coex module, free 'common' and 'adapter' directly, but
+common->tx_thread which will access 'common' and 'adapter' is running at
+the same time. That will trigger the UAF bug.
+
+==================================================================
+BUG: KASAN: use-after-free in rsi_tx_scheduler_thread+0x50f/0x520 [rsi_91x]
+Read of size 8 at addr ffff8880076dc000 by task Tx-Thread/124777
+CPU: 0 PID: 124777 Comm: Tx-Thread Not tainted 5.15.0-rc5+ #19
+Call Trace:
+ dump_stack_lvl+0xe2/0x152
+ print_address_description.constprop.0+0x21/0x140
+ ? rsi_tx_scheduler_thread+0x50f/0x520
+ kasan_report.cold+0x7f/0x11b
+ ? rsi_tx_scheduler_thread+0x50f/0x520
+ rsi_tx_scheduler_thread+0x50f/0x520
+...
+
+Freed by task 111873:
+ kasan_save_stack+0x1b/0x40
+ kasan_set_track+0x1c/0x30
+ kasan_set_free_info+0x20/0x30
+ __kasan_slab_free+0x109/0x140
+ kfree+0x117/0x4c0
+ rsi_91x_init+0x741/0x8a0 [rsi_91x]
+ rsi_probe+0x9f/0x1750 [rsi_usb]
+
+Stop thread before free 'common' and 'adapter' to fix it.
+
+Fixes: 2108df3c4b18 ("rsi: add coex support")
+Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/20211015040335.1021546-1-william.xuanziyang@huawei.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/rsi/rsi_91x_main.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/net/wireless/rsi/rsi_91x_main.c b/drivers/net/wireless/rsi/rsi_91x_main.c
+index aece1d3a6b055..441fda71f6289 100644
+--- a/drivers/net/wireless/rsi/rsi_91x_main.c
++++ b/drivers/net/wireless/rsi/rsi_91x_main.c
+@@ -368,6 +368,7 @@ struct rsi_hw *rsi_91x_init(u16 oper_mode)
+       if (common->coex_mode > 1) {
+               if (rsi_coex_attach(common)) {
+                       rsi_dbg(ERR_ZONE, "Failed to init coex module\n");
++                      rsi_kill_thread(&common->tx_thread);
+                       goto err;
+               }
+       }
+-- 
+2.33.0
+
diff --git a/queue-5.4/rxrpc-fix-_usecs_to_jiffies-by-using-usecs_to_jiffie.patch b/queue-5.4/rxrpc-fix-_usecs_to_jiffies-by-using-usecs_to_jiffie.patch
new file mode 100644 (file)
index 0000000..a4d5155
--- /dev/null
@@ -0,0 +1,39 @@
+From 6b331ee35d86ae449b51549368dc84acb1ac4ec0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 24 Sep 2021 03:18:37 +0000
+Subject: rxrpc: Fix _usecs_to_jiffies() by using usecs_to_jiffies()
+
+From: Jiasheng Jiang <jiasheng@iscas.ac.cn>
+
+[ Upstream commit acde891c243c1ed85b19d4d5042bdf00914f5739 ]
+
+Directly using _usecs_to_jiffies() might be unsafe, so it's
+better to use usecs_to_jiffies() instead.
+Because we can see that the result of _usecs_to_jiffies()
+could be larger than MAX_JIFFY_OFFSET values without the
+check of the input.
+
+Fixes: c410bf01933e ("Fix the excessive initial retransmission timeout")
+Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/rxrpc/rtt.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/rxrpc/rtt.c b/net/rxrpc/rtt.c
+index 928d8b34a3eee..f3f87c9f0209d 100644
+--- a/net/rxrpc/rtt.c
++++ b/net/rxrpc/rtt.c
+@@ -23,7 +23,7 @@ static u32 rxrpc_rto_min_us(struct rxrpc_peer *peer)
+ static u32 __rxrpc_set_rto(const struct rxrpc_peer *peer)
+ {
+-      return _usecs_to_jiffies((peer->srtt_us >> 3) + peer->rttvar_us);
++      return usecs_to_jiffies((peer->srtt_us >> 3) + peer->rttvar_us);
+ }
+ static u32 rxrpc_bound_rto(u32 rto)
+-- 
+2.33.0
+
diff --git a/queue-5.4/s390-gmap-don-t-unconditionally-call-pte_unmap_unloc.patch b/queue-5.4/s390-gmap-don-t-unconditionally-call-pte_unmap_unloc.patch
new file mode 100644 (file)
index 0000000..4d0b3a6
--- /dev/null
@@ -0,0 +1,48 @@
+From b890d03ba063cf939e9facf029787138c08ce6c2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 9 Sep 2021 18:22:41 +0200
+Subject: s390/gmap: don't unconditionally call pte_unmap_unlock() in
+ __gmap_zap()
+
+From: David Hildenbrand <david@redhat.com>
+
+[ Upstream commit b159f94c86b43cf7e73e654bc527255b1f4eafc4 ]
+
+... otherwise we will try unlocking a spinlock that was never locked via a
+garbage pointer.
+
+At the time we reach this code path, we usually successfully looked up
+a PGSTE already; however, evil user space could have manipulated the VMA
+layout in the meantime and triggered removal of the page table.
+
+Fixes: 1e133ab296f3 ("s390/mm: split arch/s390/mm/pgtable.c")
+Signed-off-by: David Hildenbrand <david@redhat.com>
+Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
+Acked-by: Heiko Carstens <hca@linux.ibm.com>
+Link: https://lore.kernel.org/r/20210909162248.14969-3-david@redhat.com
+Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/s390/mm/gmap.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
+index 4fa7a562c6fc1..5e5a4e1f0e6cf 100644
+--- a/arch/s390/mm/gmap.c
++++ b/arch/s390/mm/gmap.c
+@@ -684,9 +684,10 @@ void __gmap_zap(struct gmap *gmap, unsigned long gaddr)
+               vmaddr |= gaddr & ~PMD_MASK;
+               /* Get pointer to the page table entry */
+               ptep = get_locked_pte(gmap->mm, vmaddr, &ptl);
+-              if (likely(ptep))
++              if (likely(ptep)) {
+                       ptep_zap_unused(gmap->mm, vmaddr, ptep, 0);
+-              pte_unmap_unlock(ptep, ptl);
++                      pte_unmap_unlock(ptep, ptl);
++              }
+       }
+ }
+ EXPORT_SYMBOL_GPL(__gmap_zap);
+-- 
+2.33.0
+
diff --git a/queue-5.4/samples-kretprobes-fix-return-value-if-register_kret.patch b/queue-5.4/samples-kretprobes-fix-return-value-if-register_kret.patch
new file mode 100644 (file)
index 0000000..71fa2b9
--- /dev/null
@@ -0,0 +1,49 @@
+From 2b3626d581fa1c456c19c646c0e1bf14d24309ea Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 26 Oct 2021 09:51:28 +0800
+Subject: samples/kretprobes: Fix return value if register_kretprobe() failed
+
+From: Tiezhu Yang <yangtiezhu@loongson.cn>
+
+[ Upstream commit f76fbbbb5061fe14824ba5807c44bd7400a6b4e1 ]
+
+Use the actual return value instead of always -1 if register_kretprobe()
+failed.
+
+E.g. without this patch:
+
+ # insmod samples/kprobes/kretprobe_example.ko func=no_such_func
+ insmod: ERROR: could not insert module samples/kprobes/kretprobe_example.ko: Operation not permitted
+
+With this patch:
+
+ # insmod samples/kprobes/kretprobe_example.ko func=no_such_func
+ insmod: ERROR: could not insert module samples/kprobes/kretprobe_example.ko: Unknown symbol in module
+
+Link: https://lkml.kernel.org/r/1635213091-24387-2-git-send-email-yangtiezhu@loongson.cn
+
+Fixes: 804defea1c02 ("Kprobes: move kprobe examples to samples/")
+Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
+Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ samples/kprobes/kretprobe_example.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/samples/kprobes/kretprobe_example.c b/samples/kprobes/kretprobe_example.c
+index 186315ca88b3f..2701549ee7b3a 100644
+--- a/samples/kprobes/kretprobe_example.c
++++ b/samples/kprobes/kretprobe_example.c
+@@ -84,7 +84,7 @@ static int __init kretprobe_init(void)
+       ret = register_kretprobe(&my_kretprobe);
+       if (ret < 0) {
+               pr_err("register_kretprobe failed, returned %d\n", ret);
+-              return -1;
++              return ret;
+       }
+       pr_info("Planted return probe at %s: %p\n",
+                       my_kretprobe.kp.symbol_name, my_kretprobe.kp.addr);
+-- 
+2.33.0
+
diff --git a/queue-5.4/scsi-csiostor-uninitialized-data-in-csio_ln_vnp_read.patch b/queue-5.4/scsi-csiostor-uninitialized-data-in-csio_ln_vnp_read.patch
new file mode 100644 (file)
index 0000000..40bd092
--- /dev/null
@@ -0,0 +1,40 @@
+From a22cdc6c79175659bd6d9945656c080d6a4728b6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 6 Oct 2021 10:32:43 +0300
+Subject: scsi: csiostor: Uninitialized data in csio_ln_vnp_read_cbfn()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit f4875d509a0a78ad294a1a538d534b5ba94e685a ]
+
+This variable is just a temporary variable, used to do an endian
+conversion.  The problem is that the last byte is not initialized.  After
+the conversion is completely done, the last byte is discarded so it doesn't
+cause a problem.  But static checkers and the KMSan runtime checker can
+detect the uninitialized read and will complain about it.
+
+Link: https://lore.kernel.org/r/20211006073242.GA8404@kili
+Fixes: 5036f0a0ecd3 ("[SCSI] csiostor: Fix sparse warnings.")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/csiostor/csio_lnode.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/csiostor/csio_lnode.c b/drivers/scsi/csiostor/csio_lnode.c
+index 23cbe4cda760e..c3bf590f5d685 100644
+--- a/drivers/scsi/csiostor/csio_lnode.c
++++ b/drivers/scsi/csiostor/csio_lnode.c
+@@ -619,7 +619,7 @@ csio_ln_vnp_read_cbfn(struct csio_hw *hw, struct csio_mb *mbp)
+       struct fc_els_csp *csp;
+       struct fc_els_cssp *clsp;
+       enum fw_retval retval;
+-      __be32 nport_id;
++      __be32 nport_id = 0;
+       retval = FW_CMD_RETVAL_G(ntohl(rsp->alloc_to_len16));
+       if (retval != FW_SUCCESS) {
+-- 
+2.33.0
+
diff --git a/queue-5.4/scsi-dc395-fix-error-case-unwinding.patch b/queue-5.4/scsi-dc395-fix-error-case-unwinding.patch
new file mode 100644 (file)
index 0000000..ab250c6
--- /dev/null
@@ -0,0 +1,43 @@
+From f049803abdbc77ee491e3437cde735e6d3d425a7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 6 Sep 2021 21:07:02 -0700
+Subject: scsi: dc395: Fix error case unwinding
+
+From: Tong Zhang <ztong0001@gmail.com>
+
+[ Upstream commit cbd9a3347c757383f3d2b50cf7cfd03eb479c481 ]
+
+dc395x_init_one()->adapter_init() might fail. In this case, the acb is
+already cleaned up by adapter_init(), no need to do that in
+adapter_uninit(acb) again.
+
+[    1.252251] dc395x: adapter init failed
+[    1.254900] RIP: 0010:adapter_uninit+0x94/0x170 [dc395x]
+[    1.260307] Call Trace:
+[    1.260442]  dc395x_init_one.cold+0x72a/0x9bb [dc395x]
+
+Link: https://lore.kernel.org/r/20210907040702.1846409-1-ztong0001@gmail.com
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Reviewed-by: Finn Thain <fthain@linux-m68k.org>
+Signed-off-by: Tong Zhang <ztong0001@gmail.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/dc395x.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
+index 13fbb2eab842e..5fb06930912a0 100644
+--- a/drivers/scsi/dc395x.c
++++ b/drivers/scsi/dc395x.c
+@@ -4698,6 +4698,7 @@ static int dc395x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
+       /* initialise the adapter and everything we need */
+       if (adapter_init(acb, io_port_base, io_port_len, irq)) {
+               dprintkl(KERN_INFO, "adapter init failed\n");
++              acb = NULL;
+               goto fail;
+       }
+-- 
+2.33.0
+
diff --git a/queue-5.4/scsi-qla2xxx-fix-gnl-list-corruption.patch b/queue-5.4/scsi-qla2xxx-fix-gnl-list-corruption.patch
new file mode 100644 (file)
index 0000000..2968ff8
--- /dev/null
@@ -0,0 +1,79 @@
+From 6a39f985cdd5d13d6ff01b20a2751d19516cfdb1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 26 Oct 2021 04:54:01 -0700
+Subject: scsi: qla2xxx: Fix gnl list corruption
+
+From: Quinn Tran <qutran@marvell.com>
+
+[ Upstream commit c98c5daaa24b583cba1369b7d167f93c6ae7299c ]
+
+Current code does list element deletion and addition in and out of lock
+protection. This patch moves deletion behind lock.
+
+list_add double add: new=ffff9130b5eb89f8, prev=ffff9130b5eb89f8,
+    next=ffff9130c6a715f0.
+ ------------[ cut here ]------------
+ kernel BUG at lib/list_debug.c:31!
+ invalid opcode: 0000 [#1] SMP PTI
+ CPU: 1 PID: 182395 Comm: kworker/1:37 Kdump: loaded Tainted: G W  OE
+ --------- -  - 4.18.0-193.el8.x86_64 #1
+ Hardware name: HP ProLiant DL160 Gen8, BIOS J03 02/10/2014
+ Workqueue: qla2xxx_wq qla2x00_iocb_work_fn [qla2xxx]
+ RIP: 0010:__list_add_valid+0x41/0x50
+ Code: 85 94 00 00 00 48 39 c7 74 0b 48 39 d7 74 06 b8 01 00 00 00 c3 48 89 f2
+ 4c 89 c1 48 89 fe 48 c7 c7 60 83 ad 97 e8 4d bd ce ff <0f> 0b 0f 1f 00 66 2e
+ 0f 1f 84 00 00 00 00 00 48 8b 07 48 8b 57 08
+ RSP: 0018:ffffaba306f47d68 EFLAGS: 00010046
+ RAX: 0000000000000058 RBX: ffff9130b5eb8800 RCX: 0000000000000006
+ RDX: 0000000000000000 RSI: 0000000000000096 RDI: ffff9130b7456a00
+ RBP: ffff9130c6a70a58 R08: 000000000008d7be R09: 0000000000000001
+ R10: 0000000000000000 R11: 0000000000000001 R12: ffff9130c6a715f0
+ R13: ffff9130b5eb8824 R14: ffff9130b5eb89f8 R15: ffff9130b5eb89f8
+ FS:  0000000000000000(0000) GS:ffff9130b7440000(0000) knlGS:0000000000000000
+ CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+ CR2: 00007efcaaef11a0 CR3: 000000005200a002 CR4: 00000000000606e0
+ Call Trace:
+  qla24xx_async_gnl+0x113/0x3c0 [qla2xxx]
+  ? qla2x00_iocb_work_fn+0x53/0x80 [qla2xxx]
+  ? process_one_work+0x1a7/0x3b0
+  ? worker_thread+0x30/0x390
+  ? create_worker+0x1a0/0x1a0
+  ? kthread+0x112/0x130
+
+Link: https://lore.kernel.org/r/20211026115412.27691-3-njavali@marvell.com
+Fixes: 726b85487067 ("qla2xxx: Add framework for async fabric discovery")
+Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
+Signed-off-by: Quinn Tran <qutran@marvell.com>
+Signed-off-by: Nilesh Javali <njavali@marvell.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/qla2xxx/qla_init.c | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
+index 5dae7ac0d3efe..37c1f27a76cf6 100644
+--- a/drivers/scsi/qla2xxx/qla_init.c
++++ b/drivers/scsi/qla2xxx/qla_init.c
+@@ -978,8 +978,6 @@ static void qla24xx_async_gnl_sp_done(srb_t *sp, int res)
+           sp->name, res, sp->u.iocb_cmd.u.mbx.in_mb[1],
+           sp->u.iocb_cmd.u.mbx.in_mb[2]);
+-      if (res == QLA_FUNCTION_TIMEOUT)
+-              return;
+       sp->fcport->flags &= ~(FCF_ASYNC_SENT|FCF_ASYNC_ACTIVE);
+       memset(&ea, 0, sizeof(ea));
+@@ -1017,8 +1015,8 @@ static void qla24xx_async_gnl_sp_done(srb_t *sp, int res)
+       spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags);
+       list_for_each_entry_safe(fcport, tf, &h, gnl_entry) {
+-              list_del_init(&fcport->gnl_entry);
+               spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags);
++              list_del_init(&fcport->gnl_entry);
+               fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE);
+               spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags);
+               ea.fcport = fcport;
+-- 
+2.33.0
+
diff --git a/queue-5.4/scsi-qla2xxx-turn-off-target-reset-during-issue_lip.patch b/queue-5.4/scsi-qla2xxx-turn-off-target-reset-during-issue_lip.patch
new file mode 100644 (file)
index 0000000..2d6cbbb
--- /dev/null
@@ -0,0 +1,131 @@
+From 821258a7777172f1e8c6adb27b199eccd06c4372 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 26 Oct 2021 04:54:02 -0700
+Subject: scsi: qla2xxx: Turn off target reset during issue_lip
+
+From: Quinn Tran <qutran@marvell.com>
+
+[ Upstream commit 0b7a9fd934a68ebfc1019811b7bdc1742072ad7b ]
+
+When user uses issue_lip to do link bounce, driver sends additional target
+reset to remote device before resetting the link. The target reset would
+affect other paths with active I/Os. This patch will remove the unnecessary
+target reset.
+
+Link: https://lore.kernel.org/r/20211026115412.27691-4-njavali@marvell.com
+Fixes: 5854771e314e ("[SCSI] qla2xxx: Add ISPFX00 specific bus reset routine")
+Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
+Signed-off-by: Quinn Tran <qutran@marvell.com>
+Signed-off-by: Nilesh Javali <njavali@marvell.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/qla2xxx/qla_gbl.h |  2 --
+ drivers/scsi/qla2xxx/qla_mr.c  | 23 -----------------------
+ drivers/scsi/qla2xxx/qla_os.c  | 27 ++-------------------------
+ 3 files changed, 2 insertions(+), 50 deletions(-)
+
+diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
+index 7aa233771ec86..1a98e37c9be22 100644
+--- a/drivers/scsi/qla2xxx/qla_gbl.h
++++ b/drivers/scsi/qla2xxx/qla_gbl.h
+@@ -156,7 +156,6 @@ extern int ql2xasynctmfenable;
+ extern int ql2xgffidenable;
+ extern int ql2xenabledif;
+ extern int ql2xenablehba_err_chk;
+-extern int ql2xtargetreset;
+ extern int ql2xdontresethba;
+ extern uint64_t ql2xmaxlun;
+ extern int ql2xmdcapmask;
+@@ -770,7 +769,6 @@ extern void qlafx00_abort_iocb(srb_t *, struct abort_iocb_entry_fx00 *);
+ extern void qlafx00_fxdisc_iocb(srb_t *, struct fxdisc_entry_fx00 *);
+ extern void qlafx00_timer_routine(scsi_qla_host_t *);
+ extern int qlafx00_rescan_isp(scsi_qla_host_t *);
+-extern int qlafx00_loop_reset(scsi_qla_host_t *vha);
+ /* qla82xx related functions */
+diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c
+index 605b59c76c901..badd09c5dd429 100644
+--- a/drivers/scsi/qla2xxx/qla_mr.c
++++ b/drivers/scsi/qla2xxx/qla_mr.c
+@@ -740,29 +740,6 @@ qlafx00_lun_reset(fc_port_t *fcport, uint64_t l, int tag)
+       return qla2x00_async_tm_cmd(fcport, TCF_LUN_RESET, l, tag);
+ }
+-int
+-qlafx00_loop_reset(scsi_qla_host_t *vha)
+-{
+-      int ret;
+-      struct fc_port *fcport;
+-      struct qla_hw_data *ha = vha->hw;
+-
+-      if (ql2xtargetreset) {
+-              list_for_each_entry(fcport, &vha->vp_fcports, list) {
+-                      if (fcport->port_type != FCT_TARGET)
+-                              continue;
+-
+-                      ret = ha->isp_ops->target_reset(fcport, 0, 0);
+-                      if (ret != QLA_SUCCESS) {
+-                              ql_dbg(ql_dbg_taskm, vha, 0x803d,
+-                                  "Bus Reset failed: Reset=%d "
+-                                  "d_id=%x.\n", ret, fcport->d_id.b24);
+-                      }
+-              }
+-      }
+-      return QLA_SUCCESS;
+-}
+-
+ int
+ qlafx00_iospace_config(struct qla_hw_data *ha)
+ {
+diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
+index 049a68c59c137..c1d4c964b0dd4 100644
+--- a/drivers/scsi/qla2xxx/qla_os.c
++++ b/drivers/scsi/qla2xxx/qla_os.c
+@@ -191,12 +191,6 @@ MODULE_PARM_DESC(ql2xdbwr,
+               " 0 -- Regular doorbell.\n"
+               " 1 -- CAMRAM doorbell (faster).\n");
+-int ql2xtargetreset = 1;
+-module_param(ql2xtargetreset, int, S_IRUGO);
+-MODULE_PARM_DESC(ql2xtargetreset,
+-               "Enable target reset."
+-               "Default is 1 - use hw defaults.");
+-
+ int ql2xgffidenable;
+ module_param(ql2xgffidenable, int, S_IRUGO);
+ MODULE_PARM_DESC(ql2xgffidenable,
+@@ -1638,27 +1632,10 @@ int
+ qla2x00_loop_reset(scsi_qla_host_t *vha)
+ {
+       int ret;
+-      struct fc_port *fcport;
+       struct qla_hw_data *ha = vha->hw;
+-      if (IS_QLAFX00(ha)) {
+-              return qlafx00_loop_reset(vha);
+-      }
+-
+-      if (ql2xtargetreset == 1 && ha->flags.enable_target_reset) {
+-              list_for_each_entry(fcport, &vha->vp_fcports, list) {
+-                      if (fcport->port_type != FCT_TARGET)
+-                              continue;
+-
+-                      ret = ha->isp_ops->target_reset(fcport, 0, 0);
+-                      if (ret != QLA_SUCCESS) {
+-                              ql_dbg(ql_dbg_taskm, vha, 0x802c,
+-                                  "Bus Reset failed: Reset=%d "
+-                                  "d_id=%x.\n", ret, fcport->d_id.b24);
+-                      }
+-              }
+-      }
+-
++      if (IS_QLAFX00(ha))
++              return QLA_SUCCESS;
+       if (ha->flags.enable_lip_full_login && !IS_CNA_CAPABLE(ha)) {
+               atomic_set(&vha->loop_state, LOOP_DOWN);
+-- 
+2.33.0
+
diff --git a/queue-5.4/selftests-bpf-fix-fclose-pclose-mismatch-in-test_pro.patch b/queue-5.4/selftests-bpf-fix-fclose-pclose-mismatch-in-test_pro.patch
new file mode 100644 (file)
index 0000000..c6238ce
--- /dev/null
@@ -0,0 +1,47 @@
+From 6347859abd847bc90967247ffd0527ef3885650f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 26 Oct 2021 16:34:09 +0200
+Subject: selftests/bpf: Fix fclose/pclose mismatch in test_progs
+
+From: Andrea Righi <andrea.righi@canonical.com>
+
+[ Upstream commit f48ad69097fe79d1de13c4d8fef556d4c11c5e68 ]
+
+Make sure to use pclose() to properly close the pipe opened by popen().
+
+Fixes: 81f77fd0deeb ("bpf: add selftest for stackmap with BPF_F_STACK_BUILD_ID")
+Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
+Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
+Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
+Acked-by: Martin KaFai Lau <kafai@fb.com>
+Link: https://lore.kernel.org/bpf/20211026143409.42666-1-andrea.righi@canonical.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/bpf/test_progs.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
+index 48bbe8e0ce48d..4369bc46bf9c2 100644
+--- a/tools/testing/selftests/bpf/test_progs.c
++++ b/tools/testing/selftests/bpf/test_progs.c
+@@ -289,7 +289,7 @@ int extract_build_id(char *build_id, size_t size)
+       if (getline(&line, &len, fp) == -1)
+               goto err;
+-      fclose(fp);
++      pclose(fp);
+       if (len > size)
+               len = size;
+@@ -298,7 +298,7 @@ int extract_build_id(char *build_id, size_t size)
+       free(line);
+       return 0;
+ err:
+-      fclose(fp);
++      pclose(fp);
+       return -1;
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/selftests-bpf-fix-strobemeta-selftest-regression.patch b/queue-5.4/selftests-bpf-fix-strobemeta-selftest-regression.patch
new file mode 100644 (file)
index 0000000..eb45d7c
--- /dev/null
@@ -0,0 +1,109 @@
+From adc7eb4538251d0bd75fc2aa339b1ef55f56dec3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 29 Oct 2021 11:29:07 -0700
+Subject: selftests/bpf: Fix strobemeta selftest regression
+
+From: Andrii Nakryiko <andrii@kernel.org>
+
+[ Upstream commit 0133c20480b14820d43c37c0e9502da4bffcad3a ]
+
+After most recent nightly Clang update strobemeta selftests started
+failing with the following error (relevant portion of assembly included):
+
+  1624: (85) call bpf_probe_read_user_str#114
+  1625: (bf) r1 = r0
+  1626: (18) r2 = 0xfffffffe
+  1628: (5f) r1 &= r2
+  1629: (55) if r1 != 0x0 goto pc+7
+  1630: (07) r9 += 104
+  1631: (6b) *(u16 *)(r9 +0) = r0
+  1632: (67) r0 <<= 32
+  1633: (77) r0 >>= 32
+  1634: (79) r1 = *(u64 *)(r10 -456)
+  1635: (0f) r1 += r0
+  1636: (7b) *(u64 *)(r10 -456) = r1
+  1637: (79) r1 = *(u64 *)(r10 -368)
+  1638: (c5) if r1 s< 0x1 goto pc+778
+  1639: (bf) r6 = r8
+  1640: (0f) r6 += r7
+  1641: (b4) w1 = 0
+  1642: (6b) *(u16 *)(r6 +108) = r1
+  1643: (79) r3 = *(u64 *)(r10 -352)
+  1644: (79) r9 = *(u64 *)(r10 -456)
+  1645: (bf) r1 = r9
+  1646: (b4) w2 = 1
+  1647: (85) call bpf_probe_read_user_str#114
+
+  R1 unbounded memory access, make sure to bounds check any such access
+
+In the above code r0 and r1 are implicitly related. Clang knows that,
+but verifier isn't able to infer this relationship.
+
+Yonghong Song narrowed down this "regression" in code generation to
+a recent Clang optimization change ([0]), which for BPF target generates
+code pattern that BPF verifier can't handle and loses track of register
+boundaries.
+
+This patch works around the issue by adding an BPF assembly-based helper
+that helps to prove to the verifier that upper bound of the register is
+a given constant by controlling the exact share of generated BPF
+instruction sequence. This fixes the immediate issue for strobemeta
+selftest.
+
+  [0] https://github.com/llvm/llvm-project/commit/acabad9ff6bf13e00305d9d8621ee8eafc1f8b08
+
+Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
+Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
+Acked-by: Yonghong Song <yhs@fb.com>
+Link: https://lore.kernel.org/bpf/20211029182907.166910-1-andrii@kernel.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/bpf/progs/strobemeta.h | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/tools/testing/selftests/bpf/progs/strobemeta.h b/tools/testing/selftests/bpf/progs/strobemeta.h
+index 067eb625d01c5..938765d87528a 100644
+--- a/tools/testing/selftests/bpf/progs/strobemeta.h
++++ b/tools/testing/selftests/bpf/progs/strobemeta.h
+@@ -10,6 +10,14 @@
+ #include <linux/types.h>
+ #include "bpf_helpers.h"
++#define bpf_clamp_umax(VAR, UMAX)                                     \
++      asm volatile (                                                  \
++              "if %0 <= %[max] goto +1\n"                             \
++              "%0 = %[max]\n"                                         \
++              : "+r"(VAR)                                             \
++              : [max]"i"(UMAX)                                        \
++      )
++
+ typedef uint32_t pid_t;
+ struct task_struct {};
+@@ -404,6 +412,7 @@ static __always_inline void *read_map_var(struct strobemeta_cfg *cfg,
+       len = bpf_probe_read_str(payload, STROBE_MAX_STR_LEN, map.tag);
+       if (len <= STROBE_MAX_STR_LEN) {
++              bpf_clamp_umax(len, STROBE_MAX_STR_LEN);
+               descr->tag_len = len;
+               payload += len;
+       }
+@@ -421,6 +430,7 @@ static __always_inline void *read_map_var(struct strobemeta_cfg *cfg,
+               len = bpf_probe_read_str(payload, STROBE_MAX_STR_LEN,
+                                        map.entries[i].key);
+               if (len <= STROBE_MAX_STR_LEN) {
++                      bpf_clamp_umax(len, STROBE_MAX_STR_LEN);
+                       descr->key_lens[i] = len;
+                       payload += len;
+               }
+@@ -428,6 +438,7 @@ static __always_inline void *read_map_var(struct strobemeta_cfg *cfg,
+               len = bpf_probe_read_str(payload, STROBE_MAX_STR_LEN,
+                                        map.entries[i].val);
+               if (len <= STROBE_MAX_STR_LEN) {
++                      bpf_clamp_umax(len, STROBE_MAX_STR_LEN);
+                       descr->val_lens[i] = len;
+                       payload += len;
+               }
+-- 
+2.33.0
+
diff --git a/queue-5.4/selftests-kvm-fix-mismatched-fclose-after-popen.patch b/queue-5.4/selftests-kvm-fix-mismatched-fclose-after-popen.patch
new file mode 100644 (file)
index 0000000..bfca006
--- /dev/null
@@ -0,0 +1,48 @@
+From 391e3e0d3f1f9b6f87601a76bc09d8f739e87799 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 21 Oct 2021 11:56:03 -0600
+Subject: selftests: kvm: fix mismatched fclose() after popen()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Shuah Khan <skhan@linuxfoundation.org>
+
+[ Upstream commit c3867ab5924b7a9a0b4a117902a08669d8be7c21 ]
+
+get_warnings_count() does fclose() using File * returned from popen().
+Fix it to call pclose() as it should.
+
+tools/testing/selftests/kvm/x86_64/mmio_warning_test
+x86_64/mmio_warning_test.c: In function â€˜get_warnings_count’:
+x86_64/mmio_warning_test.c:87:9: warning: â€˜fclose’ called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc]
+   87 |         fclose(f);
+      |         ^~~~~~~~~
+x86_64/mmio_warning_test.c:84:13: note: returned from â€˜popen’
+   84 |         f = popen("dmesg | grep \"WARNING:\" | wc -l", "r");
+      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
+Acked-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/kvm/x86_64/mmio_warning_test.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c b/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c
+index 2cbc09aad7f64..92419b66b0578 100644
+--- a/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c
++++ b/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c
+@@ -84,7 +84,7 @@ int get_warnings_count(void)
+       f = popen("dmesg | grep \"WARNING:\" | wc -l", "r");
+       if (fscanf(f, "%d", &warnings) < 1)
+               warnings = 0;
+-      fclose(f);
++      pclose(f);
+       return warnings;
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/selftests-net-udpgso_bench_rx-fix-port-argument.patch b/queue-5.4/selftests-net-udpgso_bench_rx-fix-port-argument.patch
new file mode 100644 (file)
index 0000000..cecf7dc
--- /dev/null
@@ -0,0 +1,67 @@
+From 589952e832472d279df281dfeff10790df10d836 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 11 Nov 2021 06:57:17 -0500
+Subject: selftests/net: udpgso_bench_rx: fix port argument
+
+From: Willem de Bruijn <willemb@google.com>
+
+[ Upstream commit d336509cb9d03970911878bb77f0497f64fda061 ]
+
+The below commit added optional support for passing a bind address.
+It configures the sockaddr bind arguments before parsing options and
+reconfigures on options -b and -4.
+
+This broke support for passing port (-p) on its own.
+
+Configure sockaddr after parsing all arguments.
+
+Fixes: 3327a9c46352 ("selftests: add functionals test for UDP GRO")
+Reported-by: Eric Dumazet <edumazet@google.com>
+Signed-off-by: Willem de Bruijn <willemb@google.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/net/udpgso_bench_rx.c | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/tools/testing/selftests/net/udpgso_bench_rx.c b/tools/testing/selftests/net/udpgso_bench_rx.c
+index 76a24052f4b47..6a193425c367f 100644
+--- a/tools/testing/selftests/net/udpgso_bench_rx.c
++++ b/tools/testing/selftests/net/udpgso_bench_rx.c
+@@ -293,19 +293,17 @@ static void usage(const char *filepath)
+ static void parse_opts(int argc, char **argv)
+ {
++      const char *bind_addr = NULL;
+       int c;
+-      /* bind to any by default */
+-      setup_sockaddr(PF_INET6, "::", &cfg_bind_addr);
+       while ((c = getopt(argc, argv, "4b:C:Gl:n:p:rR:S:tv")) != -1) {
+               switch (c) {
+               case '4':
+                       cfg_family = PF_INET;
+                       cfg_alen = sizeof(struct sockaddr_in);
+-                      setup_sockaddr(PF_INET, "0.0.0.0", &cfg_bind_addr);
+                       break;
+               case 'b':
+-                      setup_sockaddr(cfg_family, optarg, &cfg_bind_addr);
++                      bind_addr = optarg;
+                       break;
+               case 'C':
+                       cfg_connect_timeout_ms = strtoul(optarg, NULL, 0);
+@@ -341,6 +339,11 @@ static void parse_opts(int argc, char **argv)
+               }
+       }
++      if (!bind_addr)
++              bind_addr = cfg_family == PF_INET6 ? "::" : "0.0.0.0";
++
++      setup_sockaddr(cfg_family, bind_addr, &cfg_bind_addr);
++
+       if (optind != argc)
+               usage(argv[0]);
+-- 
+2.33.0
+
diff --git a/queue-5.4/serial-8250_dw-drop-wrong-use-of-acpi_ptr.patch b/queue-5.4/serial-8250_dw-drop-wrong-use-of-acpi_ptr.patch
new file mode 100644 (file)
index 0000000..47c8cff
--- /dev/null
@@ -0,0 +1,40 @@
+From e5b3d30f3758c6a29ae1ed23e57ce9e8bf126a70 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 5 Oct 2021 16:45:16 +0300
+Subject: serial: 8250_dw: Drop wrong use of ACPI_PTR()
+
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+
+[ Upstream commit ebabb77a2a115b6c5e68f7364b598310b5f61fb2 ]
+
+ACPI_PTR() is more harmful than helpful. For example, in this case
+if CONFIG_ACPI=n, the ID table left unused which is not what we want.
+
+Instead of adding ifdeffery here and there, drop ACPI_PTR().
+
+Fixes: 6a7320c4669f ("serial: 8250_dw: Add ACPI 5.0 support")
+Reported-by: Daniel Palmer <daniel@0x0f.com>
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Link: https://lore.kernel.org/r/20211005134516.23218-1-andriy.shevchenko@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/tty/serial/8250/8250_dw.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
+index 51a7d3b19b394..381c5117aec1b 100644
+--- a/drivers/tty/serial/8250/8250_dw.c
++++ b/drivers/tty/serial/8250/8250_dw.c
+@@ -660,7 +660,7 @@ static struct platform_driver dw8250_platform_driver = {
+               .name           = "dw-apb-uart",
+               .pm             = &dw8250_pm_ops,
+               .of_match_table = dw8250_of_match,
+-              .acpi_match_table = ACPI_PTR(dw8250_acpi_match),
++              .acpi_match_table = dw8250_acpi_match,
+       },
+       .probe                  = dw8250_probe,
+       .remove                 = dw8250_remove,
+-- 
+2.33.0
+
diff --git a/queue-5.4/serial-xilinx_uartps-fix-race-condition-causing-stuc.patch b/queue-5.4/serial-xilinx_uartps-fix-race-condition-causing-stuc.patch
new file mode 100644 (file)
index 0000000..7c75345
--- /dev/null
@@ -0,0 +1,69 @@
+From 18c6c0d95fc498c963dbfb884a057f342c978afe Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 26 Oct 2021 13:27:41 +0300
+Subject: serial: xilinx_uartps: Fix race condition causing stuck TX
+
+From: Anssi Hannula <anssi.hannula@bitwise.fi>
+
+[ Upstream commit 88b20f84f0fe47409342669caf3e58a3fc64c316 ]
+
+xilinx_uartps .start_tx() clears TXEMPTY when enabling TXEMPTY to avoid
+any previous TXEVENT event asserting the UART interrupt. This clear
+operation is done immediately after filling the TX FIFO.
+
+However, if the bytes inserted by cdns_uart_handle_tx() are consumed by
+the UART before the TXEMPTY is cleared, the clear operation eats the new
+TXEMPTY event as well, causing cdns_uart_isr() to never receive the
+TXEMPTY event. If there are bytes still queued in circbuf, TX will get
+stuck as they will never get transferred to FIFO (unless new bytes are
+queued to circbuf in which case .start_tx() is called again).
+
+While the racy missed TXEMPTY occurs fairly often with short data
+sequences (e.g. write 1 byte), in those cases circbuf is usually empty
+so no action on TXEMPTY would have been needed anyway. On the other
+hand, longer data sequences make the race much more unlikely as UART
+takes longer to consume the TX FIFO. Therefore it is rare for this race
+to cause visible issues in general.
+
+Fix the race by clearing the TXEMPTY bit in ISR *before* filling the
+FIFO.
+
+The TXEMPTY bit in ISR will only get asserted at the exact moment the
+TX FIFO *becomes* empty, so clearing the bit before filling FIFO does
+not cause an extra immediate assertion even if the FIFO is initially
+empty.
+
+This is hard to reproduce directly on a normal system, but inserting
+e.g. udelay(200) after cdns_uart_handle_tx(port), setting 4000000 baud,
+and then running "dd if=/dev/zero bs=128 of=/dev/ttyPS0 count=50"
+reliably reproduces the issue on my ZynqMP test system unless this fix
+is applied.
+
+Fixes: 85baf542d54e ("tty: xuartps: support 64 byte FIFO size")
+Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi>
+Link: https://lore.kernel.org/r/20211026102741.2910441-1-anssi.hannula@bitwise.fi
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/tty/serial/xilinx_uartps.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
+index 9359c80fbb9f5..a1409251fbcc3 100644
+--- a/drivers/tty/serial/xilinx_uartps.c
++++ b/drivers/tty/serial/xilinx_uartps.c
+@@ -595,9 +595,10 @@ static void cdns_uart_start_tx(struct uart_port *port)
+       if (uart_circ_empty(&port->state->xmit))
+               return;
++      writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_ISR);
++
+       cdns_uart_handle_tx(port);
+-      writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_ISR);
+       /* Enable the TX Empty interrupt */
+       writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_IER);
+ }
+-- 
+2.33.0
+
index cd892299f4661e9f6ff516aa1a1ff71215eb4b45..d08a68aee088dfd9d33408fc50e270ec453c1fb9 100644 (file)
@@ -111,3 +111,225 @@ iio-dac-ad5446-fix-ad5622_write-return-value.patch
 usb-serial-keyspan-fix-memleak-on-probe-errors.patch
 usb-iowarrior-fix-control-message-timeouts.patch
 usb-chipidea-fix-interrupt-deadlock.patch
+dma-buf-warn-on-dmabuf-release-with-pending-attachme.patch
+drm-panel-orientation-quirks-update-the-lenovo-ideap.patch
+drm-panel-orientation-quirks-add-quirk-for-kd-kurio-.patch
+drm-panel-orientation-quirks-add-quirk-for-the-samsu.patch
+bluetooth-sco-fix-lock_sock-blockage-by-memcpy_from_.patch
+bluetooth-fix-use-after-free-error-in-lock_sock_nest.patch
+drm-panel-orientation-quirks-add-valve-steam-deck.patch
+platform-x86-wmi-do-not-fail-if-disabling-fails.patch
+mips-lantiq-dma-add-small-delay-after-reset.patch
+mips-lantiq-dma-reset-correct-number-of-channel.patch
+locking-lockdep-avoid-rcu-induced-noinstr-fail.patch
+net-sched-update-default-qdisc-visibility-after-tx-q.patch
+smackfs-fix-use-after-free-in-netlbl_catmap_walk.patch
+x86-increase-exception-stack-sizes.patch
+mwifiex-run-set_bss_mode-when-changing-from-p2p-to-s.patch
+mwifiex-properly-initialize-private-structure-on-int.patch
+ath10k-high-latency-fixes-for-beacon-buffer.patch
+media-mt9p031-fix-corrupted-frame-after-restarting-s.patch
+media-netup_unidvb-handle-interrupt-properly-accordi.patch
+media-stm32-potential-null-pointer-dereference-in-dc.patch
+media-uvcvideo-set-capability-in-s_param.patch
+media-uvcvideo-return-eio-for-control-errors.patch
+media-uvcvideo-set-unique-vdev-name-based-in-type.patch
+media-s5p-mfc-fix-possible-null-pointer-dereference-.patch
+media-s5p-mfc-add-checking-to-s5p_mfc_probe.patch
+media-imx-set-a-media_device-bus_info-string.patch
+media-mceusb-return-without-resubmitting-urb-in-case.patch
+ia64-don-t-do-ia64_cmpxchg_debug-without-config_prin.patch
+brcmfmac-add-dmi-nvram-filename-quirk-for-cyberbook-.patch
+media-rcar-csi2-add-checking-to-rcsi2_start_receiver.patch
+ipmi-disable-some-operations-during-a-panic.patch
+acpica-avoid-evaluating-methods-too-early-during-sys.patch
+media-ipu3-imgu-imgu_fmt-handle-properly-try.patch
+media-ipu3-imgu-vidioc_querycap-fix-bus_info.patch
+media-usb-dvd-usb-fix-uninit-value-bug-in-dibusb_rea.patch
+net-sysfs-try-not-to-restart-the-syscall-if-it-will-.patch
+tracefs-have-tracefs-directories-not-set-oth-permiss.patch
+ath-dfs_pattern_detector-fix-possible-null-pointer-d.patch
+iov_iter-fix-iov_iter_get_pages-_alloc-page-fault-re.patch
+acpi-battery-accept-charges-over-the-design-capacity.patch
+leaking_addresses-always-print-a-trailing-newline.patch
+memstick-r592-fix-a-uaf-bug-when-removing-the-driver.patch
+lib-xz-avoid-overlapping-memcpy-with-invalid-input-w.patch
+lib-xz-validate-the-value-before-assigning-it-to-an-.patch
+workqueue-make-sysfs-of-unbound-kworker-cpumask-more.patch
+tracing-cfi-fix-cmp_entries_-functions-signature-mis.patch
+mwl8k-fix-use-after-free-in-mwl8k_fw_state_machine.patch
+block-remove-inaccurate-requeue-check.patch
+nvmet-fix-use-after-free-when-a-port-is-removed.patch
+nvmet-tcp-fix-use-after-free-when-a-port-is-removed.patch
+nvme-drop-scan_lock-and-always-kick-requeue-list-whe.patch
+pm-hibernate-get-block-device-exclusively-in-swsusp_.patch
+selftests-kvm-fix-mismatched-fclose-after-popen.patch
+iwlwifi-mvm-disable-rx-diversity-in-powersave.patch
+smackfs-use-__gfp_nofail-for-smk_cipso_doi.patch
+arm-clang-do-not-rely-on-lr-register-for-stacktrace.patch
+gre-sit-don-t-generate-link-local-addr-if-addr_gen_m.patch
+net-dsa-lantiq_gswip-serialize-access-to-the-pce-tab.patch
+arm-9136-1-armv7-m-uses-be-8-not-be-32.patch
+vrf-run-conntrack-only-in-context-of-lower-physdev-f.patch
+net-annotate-data-race-in-neigh_output.patch
+btrfs-do-not-take-the-uuid_mutex-in-btrfs_rm_device.patch
+btrfs-subpage-make-btrfs_submit_compressed_write-com.patch
+spi-bcm-qspi-fix-missing-clk_disable_unprepare-on-er.patch
+x86-hyperv-protect-set_hv_tscchange_cb-against-getti.patch
+parisc-fix-warning-in-flush_tlb_all.patch
+task_stack-fix-end_of_stack-for-architectures-with-u.patch
+parisc-unwind-fix-unwinder-when-config_64bit-is-enab.patch
+parisc-kgdb-add-kgdb_roundup-to-make-kgdb-work-with-.patch
+netfilter-conntrack-set-on-ips_assured-if-flows-ente.patch
+selftests-bpf-fix-strobemeta-selftest-regression.patch
+bluetooth-fix-init-and-cleanup-of-sco_conn.timeout_w.patch
+rcu-fix-existing-exp-request-check-in-sync_sched_exp.patch
+drm-v3d-fix-wait-for-tmu-write-combiner-flush.patch
+virtio-gpu-fix-possible-memory-allocation-failure.patch
+net-net_namespace-fix-undefined-member-in-key_remove.patch
+cgroup-make-rebind_subsystems-disable-v2-controllers.patch
+wilc1000-fix-possible-memory-leak-in-cfg_scan_result.patch
+bluetooth-btmtkuart-fix-a-memleak-in-mtk_hci_wmt_syn.patch
+crypto-caam-disable-pkc-for-non-e-socs.patch
+rxrpc-fix-_usecs_to_jiffies-by-using-usecs_to_jiffie.patch
+net-dsa-rtl8366rb-fix-off-by-one-bug.patch
+ath10k-fix-missing-frame-timestamp-for-beacon-probe-.patch
+drm-amdgpu-fix-warning-for-overflow-check.patch
+media-em28xx-add-missing-em28xx_close_extension.patch
+media-cxd2880-spi-fix-a-null-pointer-dereference-on-.patch
+media-dvb-usb-fix-ununit-value-in-az6027_rc_query.patch
+media-tda1997x-handle-short-reads-of-hdmi-info-frame.patch
+media-mtk-vpu-fix-a-resource-leak-in-the-error-handl.patch
+media-i2c-ths8200-needs-v4l2_async.patch
+media-radio-wl1273-avoid-card-name-truncation.patch
+media-si470x-avoid-card-name-truncation.patch
+media-tm6000-avoid-card-name-truncation.patch
+media-cx23885-fix-snd_card_free-call-on-null-card-po.patch
+kprobes-do-not-use-local-variable-when-creating-debu.patch
+crypto-ecc-fix-crypto_default_rng-dependency.patch
+cpuidle-fix-kobject-memory-leaks-in-error-paths.patch
+media-em28xx-don-t-use-ops-suspend-if-it-is-null.patch
+ath9k-fix-potential-interrupt-storm-on-queue-reset.patch
+edac-amd64-handle-three-rank-interleaving-mode.patch
+netfilter-nft_dynset-relax-superfluous-check-on-set-.patch
+media-dvb-frontends-mn88443x-handle-errors-of-clk_pr.patch
+crypto-qat-detect-pfvf-collision-after-ack.patch
+crypto-qat-disregard-spurious-pfvf-interrupts.patch
+hwrng-mtk-force-runtime-pm-ops-for-sleep-ops.patch
+b43legacy-fix-a-lower-bounds-test.patch
+b43-fix-a-lower-bounds-test.patch
+mmc-sdhci-omap-fix-null-pointer-exception-if-regulat.patch
+memstick-avoid-out-of-range-warning.patch
+memstick-jmb38x_ms-use-appropriate-free-function-in-.patch
+net-neigh-fix-ntf_ext_learned-in-combination-with-nt.patch
+hwmon-fix-possible-memleak-in-__hwmon_device_registe.patch
+hwmon-pmbus-lm25066-let-compiler-determine-outer-dim.patch
+ath10k-fix-max-antenna-gain-unit.patch
+drm-msm-uninitialized-variable-in-msm_gem_import.patch
+net-stream-don-t-purge-sk_error_queue-in-sk_stream_k.patch
+mmc-mxs-mmc-disable-regulator-on-error-and-in-the-re.patch
+block-ataflop-fix-breakage-introduced-at-blk-mq-refa.patch
+platform-x86-thinkpad_acpi-fix-bitwise-vs.-logical-w.patch
+mt76-mt76x02-fix-endianness-warnings-in-mt76x02_mac..patch
+rsi-stop-thread-firstly-in-rsi_91x_init-error-handli.patch
+mwifiex-send-delba-requests-according-to-spec.patch
+phy-micrel-ksz8041nl-do-not-use-power-down-mode.patch
+nvme-rdma-fix-error-code-in-nvme_rdma_setup_ctrl.patch
+pm-hibernate-fix-sparse-warnings.patch
+clocksource-drivers-timer-ti-dm-select-timer_of.patch
+drm-msm-fix-potential-null-dereference-in-dpu-sspp.patch
+smackfs-use-netlbl_cfg_cipsov4_del-for-deleting-cips.patch
+libbpf-fix-btf-data-layout-checks-and-allow-empty-bt.patch
+s390-gmap-don-t-unconditionally-call-pte_unmap_unloc.patch
+irq-mips-avoid-nested-irq_enter.patch
+tcp-don-t-free-a-fin-sk_buff-in-tcp_remove_empty_skb.patch
+samples-kretprobes-fix-return-value-if-register_kret.patch
+kvm-s390-fix-handle_sske-page-fault-handling.patch
+libertas_tf-fix-possible-memory-leak-in-probe-and-di.patch
+libertas-fix-possible-memory-leak-in-probe-and-disco.patch
+wcn36xx-add-proper-dma-memory-barriers-in-rx-path.patch
+drm-amdgpu-gmc6-fix-dma-mask-from-44-to-40-bits.patch
+net-amd-xgbe-toggle-pll-settings-during-rate-change.patch
+net-phylink-avoid-mvneta-warning-when-setting-pause-.patch
+crypto-pcrypt-delay-write-to-padata-info.patch
+selftests-bpf-fix-fclose-pclose-mismatch-in-test_pro.patch
+udp6-allow-so_mark-ctrl-msg-to-affect-routing.patch
+ibmvnic-don-t-stop-queue-in-xmit.patch
+ibmvnic-process-crqs-after-enabling-interrupts.patch
+rdma-rxe-fix-wrong-port_cap_flags.patch
+clk-mvebu-ap-cpu-clk-fix-a-memory-leak-in-error-hand.patch
+arm-s3c-irq-s3c24xx-fix-return-value-check-for-s3c24.patch
+arm64-dts-rockchip-fix-gpu-register-width-for-rk3328.patch
+arm-dts-qcom-msm8974-add-xo_board-reference-clock-to.patch
+rdma-bnxt_re-fix-query-srq-failure.patch
+arm64-dts-meson-g12a-fix-the-pwm-regulator-supply-pr.patch
+arm-dts-at91-tse850-the-emac-phy-interface-is-rmii.patch
+scsi-dc395-fix-error-case-unwinding.patch
+mips-loongson64-make-cpu_loongson64-depends-on-mips_.patch
+jfs-fix-memleak-in-jfs_mount.patch
+alsa-hda-reduce-udelay-at-skl-position-reporting.patch
+arm-dts-omap3-gta04a4-accelerometer-irq-fix.patch
+soc-tegra-fix-an-error-handling-path-in-tegra_powerg.patch
+memory-fsl_ifc-fix-leak-of-irq-and-nand_irq-in-fsl_i.patch
+clk-at91-check-pmc-node-status-before-registering-sy.patch
+video-fbdev-chipsfb-use-memset_io-instead-of-memset.patch
+serial-8250_dw-drop-wrong-use-of-acpi_ptr.patch
+usb-gadget-hid-fix-error-code-in-do_config.patch
+power-supply-rt5033_battery-change-voltage-values-to.patch
+scsi-csiostor-uninitialized-data-in-csio_ln_vnp_read.patch
+rdma-mlx4-return-missed-an-error-if-device-doesn-t-s.patch
+staging-ks7010-select-crypto_hash-crypto_michael_mic.patch
+arm-dts-stm32-fix-sai-sub-nodes-register-range.patch
+asoc-cs42l42-correct-some-register-default-values.patch
+asoc-cs42l42-defer-probe-if-request_threaded_irq-ret.patch
+phy-qcom-qusb2-fix-a-memory-leak-on-probe.patch
+serial-xilinx_uartps-fix-race-condition-causing-stuc.patch
+hid-u2fzero-clarify-error-check-and-length-calculati.patch
+hid-u2fzero-properly-handle-timeouts-in-usb_submit_u.patch
+powerpc-44x-fsp2-add-missing-of_node_put.patch
+mips-cm-convert-to-bitfield-api-to-fix-out-of-bounds.patch
+power-supply-bq27xxx-fix-kernel-crash-on-irq-handler.patch
+apparmor-fix-error-check.patch
+rpmsg-fix-rpmsg_create_ept-return-when-rpmsg-config-.patch
+pnfs-flexfiles-fix-misplaced-barrier-in-nfs4_ff_layo.patch
+drm-plane-helper-fix-uninitialized-variable-referenc.patch
+pci-aardvark-don-t-spam-about-pio-response-status.patch
+pci-aardvark-fix-preserving-pci_exp_rtctl_crssve-fla.patch
+opp-fix-return-in-_opp_add_static_v2.patch
+nfs-fix-deadlocks-in-nfs_scan_commit_list.patch
+fs-orangefs-fix-error-return-code-of-orangefs_revali.patch
+mtd-spi-nor-hisi-sfc-remove-excessive-clk_disable_un.patch
+mtd-core-don-t-remove-debugfs-directory-if-device-is.patch
+dmaengine-at_xdmac-fix-at_xdmac_cc_perid-macro.patch
+auxdisplay-img-ascii-lcd-fix-lock-up-when-displaying.patch
+auxdisplay-ht16k33-connect-backlight-to-fbdev.patch
+auxdisplay-ht16k33-fix-frame-buffer-device-blanking.patch
+soc-fsl-dpaa2-console-free-buffer-before-returning-f.patch
+netfilter-nfnetlink_queue-fix-oob-when-mac-header-wa.patch
+dmaengine-dmaengine_desc_callback_valid-check-for-ca.patch
+signal-sh-use-force_sig-sigkill-instead-of-do_group_.patch
+m68k-set-a-default-value-for-memory_reserve.patch
+watchdog-f71808e_wdt-fix-inaccurate-report-in-wdioc_.patch
+ar7-fix-kernel-builds-for-compiler-test.patch
+scsi-qla2xxx-fix-gnl-list-corruption.patch
+scsi-qla2xxx-turn-off-target-reset-during-issue_lip.patch
+nfsv4-fix-a-regression-in-nfs_set_open_stateid_locke.patch
+i2c-xlr-fix-a-resource-leak-in-the-error-handling-pa.patch
+xen-pciback-fix-return-in-pm_ctrl_init.patch
+net-davinci_emac-fix-interrupt-pacing-disable.patch
+net-vlan-fix-a-uaf-in-vlan_dev_real_dev.patch
+acpi-pmic-fix-intel_pmic_regs_handler-read-accesses.patch
+bonding-fix-a-use-after-free-problem-when-bond_sysfs.patch
+mm-zsmalloc.c-close-race-window-between-zs_pool_dec_.patch
+zram-off-by-one-in-read_block_state.patch
+perf-bpf-add-missing-free-to-bpf_event__print_bpf_pr.patch
+llc-fix-out-of-bound-array-index-in-llc_sk_dev_hash.patch
+nfc-pn533-fix-double-free-when-pn533_fill_fragment_s.patch
+arm64-pgtable-make-__pte_to_phys-__phys_to_pte_val-i.patch
+bpf-sockmap-strparser-and-tls-are-reusing-qdisc_skb_.patch
+net-sched-sch_taprio-fix-undefined-behavior-in-ktime.patch
+net-hns3-allow-configure-ets-bandwidth-of-all-tcs.patch
+vsock-prevent-unnecessary-refcnt-inc-for-nonblocking.patch
+net-smc-fix-sk_refcnt-underflow-on-linkdown-and-fall.patch
+cxgb4-fix-eeprom-len-when-diagnostics-not-implemente.patch
+selftests-net-udpgso_bench_rx-fix-port-argument.patch
diff --git a/queue-5.4/signal-sh-use-force_sig-sigkill-instead-of-do_group_.patch b/queue-5.4/signal-sh-use-force_sig-sigkill-instead-of-do_group_.patch
new file mode 100644 (file)
index 0000000..cf714e3
--- /dev/null
@@ -0,0 +1,63 @@
+From f454a916f29bed355a9c925bc39006571580c838 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Oct 2021 12:43:52 -0500
+Subject: signal/sh: Use force_sig(SIGKILL) instead of do_group_exit(SIGKILL)
+
+From: Eric W. Biederman <ebiederm@xmission.com>
+
+[ Upstream commit ce0ee4e6ac99606f3945f4d47775544edc3f7985 ]
+
+Today the sh code allocates memory the first time a process uses
+the fpu.  If that memory allocation fails, kill the affected task
+with force_sig(SIGKILL) rather than do_group_exit(SIGKILL).
+
+Calling do_group_exit from an exception handler can potentially lead
+to dead locks as do_group_exit is not designed to be called from
+interrupt context.  Instead use force_sig(SIGKILL) to kill the
+userspace process.  Sending signals in general and force_sig in
+particular has been tested from interrupt context so there should be
+no problems.
+
+Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
+Cc: Rich Felker <dalias@libc.org>
+Cc: linux-sh@vger.kernel.org
+Fixes: 0ea820cf9bf5 ("sh: Move over to dynamically allocated FPU context.")
+Link: https://lkml.kernel.org/r/20211020174406.17889-6-ebiederm@xmission.com
+Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/sh/kernel/cpu/fpu.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/arch/sh/kernel/cpu/fpu.c b/arch/sh/kernel/cpu/fpu.c
+index ae354a2931e7e..fd6db0ab19288 100644
+--- a/arch/sh/kernel/cpu/fpu.c
++++ b/arch/sh/kernel/cpu/fpu.c
+@@ -62,18 +62,20 @@ void fpu_state_restore(struct pt_regs *regs)
+       }
+       if (!tsk_used_math(tsk)) {
+-              local_irq_enable();
++              int ret;
+               /*
+                * does a slab alloc which can sleep
+                */
+-              if (init_fpu(tsk)) {
++              local_irq_enable();
++              ret = init_fpu(tsk);
++              local_irq_disable();
++              if (ret) {
+                       /*
+                        * ran out of memory!
+                        */
+-                      do_group_exit(SIGKILL);
++                      force_sig(SIGKILL);
+                       return;
+               }
+-              local_irq_disable();
+       }
+       grab_fpu(regs);
+-- 
+2.33.0
+
diff --git a/queue-5.4/smackfs-fix-use-after-free-in-netlbl_catmap_walk.patch b/queue-5.4/smackfs-fix-use-after-free-in-netlbl_catmap_walk.patch
new file mode 100644 (file)
index 0000000..c1d10e5
--- /dev/null
@@ -0,0 +1,55 @@
+From 5d18c28f3772ff5c041b1c4f4997e9340d554574 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 28 Aug 2021 23:41:40 -0700
+Subject: smackfs: Fix use-after-free in netlbl_catmap_walk()
+
+From: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
+
+[ Upstream commit 0817534ff9ea809fac1322c5c8c574be8483ea57 ]
+
+Syzkaller reported use-after-free bug as described in [1]. The bug is
+triggered when smk_set_cipso() tries to free stale category bitmaps
+while there are concurrent reader(s) using the same bitmaps.
+
+Wait for RCU grace period to finish before freeing the category bitmaps
+in smk_set_cipso(). This makes sure that there are no more readers using
+the stale bitmaps and freeing them should be safe.
+
+[1] https://lore.kernel.org/netdev/000000000000a814c505ca657a4e@google.com/
+
+Reported-by: syzbot+3f91de0b813cc3d19a80@syzkaller.appspotmail.com
+Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
+Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ security/smack/smackfs.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
+index 3823ab2c4e4be..cec3f56739dc2 100644
+--- a/security/smack/smackfs.c
++++ b/security/smack/smackfs.c
+@@ -831,6 +831,7 @@ static int smk_open_cipso(struct inode *inode, struct file *file)
+ static ssize_t smk_set_cipso(struct file *file, const char __user *buf,
+                               size_t count, loff_t *ppos, int format)
+ {
++      struct netlbl_lsm_catmap *old_cat;
+       struct smack_known *skp;
+       struct netlbl_lsm_secattr ncats;
+       char mapcatset[SMK_CIPSOLEN];
+@@ -920,9 +921,11 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf,
+       rc = smk_netlbl_mls(maplevel, mapcatset, &ncats, SMK_CIPSOLEN);
+       if (rc >= 0) {
+-              netlbl_catmap_free(skp->smk_netlabel.attr.mls.cat);
++              old_cat = skp->smk_netlabel.attr.mls.cat;
+               skp->smk_netlabel.attr.mls.cat = ncats.attr.mls.cat;
+               skp->smk_netlabel.attr.mls.lvl = ncats.attr.mls.lvl;
++              synchronize_rcu();
++              netlbl_catmap_free(old_cat);
+               rc = count;
+       }
+-- 
+2.33.0
+
diff --git a/queue-5.4/smackfs-use-__gfp_nofail-for-smk_cipso_doi.patch b/queue-5.4/smackfs-use-__gfp_nofail-for-smk_cipso_doi.patch
new file mode 100644 (file)
index 0000000..7583d51
--- /dev/null
@@ -0,0 +1,41 @@
+From d70b24cd745e10b7268187c15bf715d6b9186637 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 19 Oct 2021 20:54:31 +0900
+Subject: smackfs: use __GFP_NOFAIL for smk_cipso_doi()
+
+From: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
+
+[ Upstream commit f91488ee15bd3cac467e2d6a361fc2d34d1052ae ]
+
+syzbot is reporting kernel panic at smk_cipso_doi() due to memory
+allocation fault injection [1]. The reason for need to use panic() was
+not explained. But since no fix was proposed for 18 months, for now
+let's use __GFP_NOFAIL for utilizing syzbot resource on other bugs.
+
+Link: https://syzkaller.appspot.com/bug?extid=89731ccb6fec15ce1c22 [1]
+Reported-by: syzbot <syzbot+89731ccb6fec15ce1c22@syzkaller.appspotmail.com>
+Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
+Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ security/smack/smackfs.c | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
+index cec3f56739dc2..fdf5f336f834a 100644
+--- a/security/smack/smackfs.c
++++ b/security/smack/smackfs.c
+@@ -693,9 +693,7 @@ static void smk_cipso_doi(void)
+               printk(KERN_WARNING "%s:%d remove rc = %d\n",
+                      __func__, __LINE__, rc);
+-      doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL);
+-      if (doip == NULL)
+-              panic("smack:  Failed to initialize cipso DOI.\n");
++      doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL | __GFP_NOFAIL);
+       doip->map.std = NULL;
+       doip->doi = smk_cipso_doi_value;
+       doip->type = CIPSO_V4_MAP_PASS;
+-- 
+2.33.0
+
diff --git a/queue-5.4/smackfs-use-netlbl_cfg_cipsov4_del-for-deleting-cips.patch b/queue-5.4/smackfs-use-netlbl_cfg_cipsov4_del-for-deleting-cips.patch
new file mode 100644 (file)
index 0000000..8324f92
--- /dev/null
@@ -0,0 +1,41 @@
+From 101170315855daabc2b483b42f93fa8c591973bc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 19 Oct 2021 20:27:26 +0900
+Subject: smackfs: use netlbl_cfg_cipsov4_del() for deleting cipso_v4_doi
+
+From: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
+
+[ Upstream commit 0934ad42bb2c5df90a1b9de690f93de735b622fe ]
+
+syzbot is reporting UAF at cipso_v4_doi_search() [1], for smk_cipso_doi()
+is calling kfree() without removing from the cipso_v4_doi_list list after
+netlbl_cfg_cipsov4_map_add() returned an error. We need to use
+netlbl_cfg_cipsov4_del() in order to remove from the list and wait for
+RCU grace period before kfree().
+
+Link: https://syzkaller.appspot.com/bug?extid=93dba5b91f0fed312cbd [1]
+Reported-by: syzbot <syzbot+93dba5b91f0fed312cbd@syzkaller.appspotmail.com>
+Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
+Fixes: 6c2e8ac0953fccdd ("netlabel: Update kernel configuration API")
+Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ security/smack/smackfs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
+index fdf5f336f834a..6b6fec04c412b 100644
+--- a/security/smack/smackfs.c
++++ b/security/smack/smackfs.c
+@@ -712,7 +712,7 @@ static void smk_cipso_doi(void)
+       if (rc != 0) {
+               printk(KERN_WARNING "%s:%d map add rc = %d\n",
+                      __func__, __LINE__, rc);
+-              kfree(doip);
++              netlbl_cfg_cipsov4_del(doip->doi, &nai);
+               return;
+       }
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/soc-fsl-dpaa2-console-free-buffer-before-returning-f.patch b/queue-5.4/soc-fsl-dpaa2-console-free-buffer-before-returning-f.patch
new file mode 100644 (file)
index 0000000..4ac2778
--- /dev/null
@@ -0,0 +1,38 @@
+From 69da080df629269f265902b7a4588a4ce689e3f2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 23 Apr 2021 12:01:51 +0300
+Subject: soc: fsl: dpaa2-console: free buffer before returning from
+ dpaa2_console_read
+
+From: Robert-Ionut Alexa <robert-ionut.alexa@nxp.com>
+
+[ Upstream commit 8120bd469f5525da229953c1197f2b826c0109f4 ]
+
+Free the kbuf buffer before returning from the dpaa2_console_read()
+function. The variable no longer goes out of scope, leaking the storage
+it points to.
+
+Fixes: c93349d8c170 ("soc: fsl: add DPAA2 console support")
+Signed-off-by: Robert-Ionut Alexa <robert-ionut.alexa@nxp.com>
+Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
+Signed-off-by: Li Yang <leoyang.li@nxp.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/soc/fsl/dpaa2-console.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/soc/fsl/dpaa2-console.c b/drivers/soc/fsl/dpaa2-console.c
+index 27243f706f376..53917410f2bdb 100644
+--- a/drivers/soc/fsl/dpaa2-console.c
++++ b/drivers/soc/fsl/dpaa2-console.c
+@@ -231,6 +231,7 @@ static ssize_t dpaa2_console_read(struct file *fp, char __user *buf,
+       cd->cur_ptr += bytes;
+       written += bytes;
++      kfree(kbuf);
+       return written;
+ err_free_buf:
+-- 
+2.33.0
+
diff --git a/queue-5.4/soc-tegra-fix-an-error-handling-path-in-tegra_powerg.patch b/queue-5.4/soc-tegra-fix-an-error-handling-path-in-tegra_powerg.patch
new file mode 100644 (file)
index 0000000..551f8de
--- /dev/null
@@ -0,0 +1,41 @@
+From d2cc3b861793a04d5d5a7f8c69fabdff661e923b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 27 Jun 2021 17:54:31 +0200
+Subject: soc/tegra: Fix an error handling path in tegra_powergate_power_up()
+
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+
+[ Upstream commit 986b5094708e508baa452a23ffe809870934a7df ]
+
+If an error occurs after a successful tegra_powergate_enable_clocks()
+call, it must be undone by a tegra_powergate_disable_clocks() call, as
+already done in the below and above error handling paths of this function.
+
+Update the 'goto' to branch at the correct place of the error handling
+path.
+
+Fixes: a38045121bf4 ("soc/tegra: pmc: Add generic PM domain support")
+Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
+Signed-off-by: Thierry Reding <treding@nvidia.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/soc/tegra/pmc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
+index 0447afa970f5e..ab75f41e9c0c9 100644
+--- a/drivers/soc/tegra/pmc.c
++++ b/drivers/soc/tegra/pmc.c
+@@ -591,7 +591,7 @@ static int tegra_powergate_power_up(struct tegra_powergate *pg,
+       err = reset_control_deassert(pg->reset);
+       if (err)
+-              goto powergate_off;
++              goto disable_clks;
+       usleep_range(10, 20);
+-- 
+2.33.0
+
diff --git a/queue-5.4/spi-bcm-qspi-fix-missing-clk_disable_unprepare-on-er.patch b/queue-5.4/spi-bcm-qspi-fix-missing-clk_disable_unprepare-on-er.patch
new file mode 100644 (file)
index 0000000..755971f
--- /dev/null
@@ -0,0 +1,55 @@
+From 55146985c05f25c3dfde0261e7cd72e2d6b7aa05 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 18 Oct 2021 15:34:13 +0800
+Subject: spi: bcm-qspi: Fix missing clk_disable_unprepare() on error in
+ bcm_qspi_probe()
+
+From: Yang Yingliang <yangyingliang@huawei.com>
+
+[ Upstream commit ca9b8f56ec089d3a436050afefd17b7237301f47 ]
+
+Fix the missing clk_disable_unprepare() before return
+from bcm_qspi_probe() in the error handling case.
+
+Reported-by: Hulk Robot <hulkci@huawei.com>
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Link: https://lore.kernel.org/r/20211018073413.2029081-1-yangyingliang@huawei.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-bcm-qspi.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c
+index 8a4be34bccfd2..8a1176efa4c85 100644
+--- a/drivers/spi/spi-bcm-qspi.c
++++ b/drivers/spi/spi-bcm-qspi.c
+@@ -1300,7 +1300,7 @@ int bcm_qspi_probe(struct platform_device *pdev,
+                                              &qspi->dev_ids[val]);
+                       if (ret < 0) {
+                               dev_err(&pdev->dev, "IRQ %s not found\n", name);
+-                              goto qspi_probe_err;
++                              goto qspi_unprepare_err;
+                       }
+                       qspi->dev_ids[val].dev = qspi;
+@@ -1315,7 +1315,7 @@ int bcm_qspi_probe(struct platform_device *pdev,
+       if (!num_ints) {
+               dev_err(&pdev->dev, "no IRQs registered, cannot init driver\n");
+               ret = -EINVAL;
+-              goto qspi_probe_err;
++              goto qspi_unprepare_err;
+       }
+       /*
+@@ -1359,6 +1359,7 @@ int bcm_qspi_probe(struct platform_device *pdev,
+ qspi_reg_err:
+       bcm_qspi_hw_uninit(qspi);
++qspi_unprepare_err:
+       clk_disable_unprepare(qspi->clk);
+ qspi_probe_err:
+       kfree(qspi->dev_ids);
+-- 
+2.33.0
+
diff --git a/queue-5.4/staging-ks7010-select-crypto_hash-crypto_michael_mic.patch b/queue-5.4/staging-ks7010-select-crypto_hash-crypto_michael_mic.patch
new file mode 100644 (file)
index 0000000..54112d9
--- /dev/null
@@ -0,0 +1,47 @@
+From b9c0e047519090a655c458d69495ae7ebe5502fa Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 11 Oct 2021 17:29:41 +0200
+Subject: staging: ks7010: select CRYPTO_HASH/CRYPTO_MICHAEL_MIC
+
+From: Vegard Nossum <vegard.nossum@oracle.com>
+
+[ Upstream commit 9ca0e55e52c7b2a99f3c2051fc4bd1c63a061519 ]
+
+Fix the following build/link errors:
+
+  ld: drivers/staging/ks7010/ks_hostif.o: in function `michael_mic.constprop.0':
+  ks_hostif.c:(.text+0x95b): undefined reference to `crypto_alloc_shash'
+  ld: ks_hostif.c:(.text+0x97a): undefined reference to `crypto_shash_setkey'
+  ld: ks_hostif.c:(.text+0xa13): undefined reference to `crypto_shash_update'
+  ld: ks_hostif.c:(.text+0xa28): undefined reference to `crypto_shash_update'
+  ld: ks_hostif.c:(.text+0xa48): undefined reference to `crypto_shash_finup'
+  ld: ks_hostif.c:(.text+0xa6d): undefined reference to `crypto_destroy_tfm'
+
+Fixes: 8b523f20417d ("staging: ks7010: removed custom Michael MIC implementation.")
+Fixes: 3e5bc68fa5968 ("staging: ks7010: Fix build error")
+Fixes: a4961427e7494 ("Revert "staging: ks7010: Fix build error"")
+Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
+Link: https://lore.kernel.org/r/20211011152941.12847-1-vegard.nossum@oracle.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/staging/ks7010/Kconfig | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/staging/ks7010/Kconfig b/drivers/staging/ks7010/Kconfig
+index 0987fdc2f70db..8ea6c09286798 100644
+--- a/drivers/staging/ks7010/Kconfig
++++ b/drivers/staging/ks7010/Kconfig
+@@ -5,6 +5,9 @@ config KS7010
+       select WIRELESS_EXT
+       select WEXT_PRIV
+       select FW_LOADER
++      select CRYPTO
++      select CRYPTO_HASH
++      select CRYPTO_MICHAEL_MIC
+       help
+         This is a driver for KeyStream KS7010 based SDIO WIFI cards. It is
+         found on at least later Spectec SDW-821 (FCC-ID "S2Y-WLAN-11G-K" only,
+-- 
+2.33.0
+
diff --git a/queue-5.4/task_stack-fix-end_of_stack-for-architectures-with-u.patch b/queue-5.4/task_stack-fix-end_of_stack-for-architectures-with-u.patch
new file mode 100644 (file)
index 0000000..7e1ca50
--- /dev/null
@@ -0,0 +1,44 @@
+From e243f5653f288e4efb56febfe810c26b1fb5c922 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 5 Oct 2021 00:05:43 +0200
+Subject: task_stack: Fix end_of_stack() for architectures with upwards-growing
+ stack
+
+From: Helge Deller <deller@gmx.de>
+
+[ Upstream commit 9cc2fa4f4a92ccc6760d764e7341be46ee8aaaa1 ]
+
+The function end_of_stack() returns a pointer to the last entry of a
+stack. For architectures like parisc where the stack grows upwards
+return the pointer to the highest address in the stack.
+
+Without this change I faced a crash on parisc, because the stackleak
+functionality wrote STACKLEAK_POISON to the lowest address and thus
+overwrote the first 4 bytes of the task_struct which included the
+TIF_FLAGS.
+
+Signed-off-by: Helge Deller <deller@gmx.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/sched/task_stack.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/include/linux/sched/task_stack.h b/include/linux/sched/task_stack.h
+index 2413427e439c7..d10150587d819 100644
+--- a/include/linux/sched/task_stack.h
++++ b/include/linux/sched/task_stack.h
+@@ -25,7 +25,11 @@ static inline void *task_stack_page(const struct task_struct *task)
+ static inline unsigned long *end_of_stack(const struct task_struct *task)
+ {
++#ifdef CONFIG_STACK_GROWSUP
++      return (unsigned long *)((unsigned long)task->stack + THREAD_SIZE) - 1;
++#else
+       return task->stack;
++#endif
+ }
+ #elif !defined(__HAVE_THREAD_FUNCTIONS)
+-- 
+2.33.0
+
diff --git a/queue-5.4/tcp-don-t-free-a-fin-sk_buff-in-tcp_remove_empty_skb.patch b/queue-5.4/tcp-don-t-free-a-fin-sk_buff-in-tcp_remove_empty_skb.patch
new file mode 100644 (file)
index 0000000..3f94ae3
--- /dev/null
@@ -0,0 +1,65 @@
+From fd1074159b670f74a8afa347a9b343ab4b540d5c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 25 Oct 2021 10:59:03 +1100
+Subject: tcp: don't free a FIN sk_buff in tcp_remove_empty_skb()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Jon Maxwell <jmaxwell37@gmail.com>
+
+[ Upstream commit cf12e6f9124629b18a6182deefc0315f0a73a199 ]
+
+v1: Implement a more general statement as recommended by Eric Dumazet. The
+sequence number will be advanced, so this check will fix the FIN case and
+other cases.
+
+A customer reported sockets stuck in the CLOSING state. A Vmcore revealed that
+the write_queue was not empty as determined by tcp_write_queue_empty() but the
+sk_buff containing the FIN flag had been freed and the socket was zombied in
+that state. Corresponding pcaps show no FIN from the Linux kernel on the wire.
+
+Some instrumentation was added to the kernel and it was found that there is a
+timing window where tcp_sendmsg() can run after tcp_send_fin().
+
+tcp_sendmsg() will hit an error, for example:
+
+1269 â–¹       if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))↩
+1270 â–¹       â–¹       goto do_error;↩
+
+tcp_remove_empty_skb() will then free the FIN sk_buff as "skb->len == 0". The
+TCP socket is now wedged in the FIN-WAIT-1 state because the FIN is never sent.
+
+If the other side sends a FIN packet the socket will transition to CLOSING and
+remain that way until the system is rebooted.
+
+Fix this by checking for the FIN flag in the sk_buff and don't free it if that
+is the case. Testing confirmed that fixed the issue.
+
+Fixes: fdfc5c8594c2 ("tcp: remove empty skb from write queue in error cases")
+Signed-off-by: Jon Maxwell <jmaxwell37@gmail.com>
+Reported-by: Monir Zouaoui <Monir.Zouaoui@mail.schwarz>
+Reported-by: Simon Stier <simon.stier@mail.schwarz>
+Reviewed-by: Eric Dumazet <edumazet@google.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv4/tcp.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
+index 5c8d0fb498256..9f53d25e047e3 100644
+--- a/net/ipv4/tcp.c
++++ b/net/ipv4/tcp.c
+@@ -955,7 +955,7 @@ static int tcp_send_mss(struct sock *sk, int *size_goal, int flags)
+  */
+ static void tcp_remove_empty_skb(struct sock *sk, struct sk_buff *skb)
+ {
+-      if (skb && !skb->len) {
++      if (skb && TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq) {
+               tcp_unlink_write_queue(skb, sk);
+               if (tcp_write_queue_empty(sk))
+                       tcp_chrono_stop(sk, TCP_CHRONO_BUSY);
+-- 
+2.33.0
+
diff --git a/queue-5.4/tracefs-have-tracefs-directories-not-set-oth-permiss.patch b/queue-5.4/tracefs-have-tracefs-directories-not-set-oth-permiss.patch
new file mode 100644 (file)
index 0000000..e4e8dd3
--- /dev/null
@@ -0,0 +1,47 @@
+From 4e5f9404fbe3ad0341595f27e6065fd044c7fc25 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 18 Aug 2021 11:24:50 -0400
+Subject: tracefs: Have tracefs directories not set OTH permission bits by
+ default
+
+From: Steven Rostedt (VMware) <rostedt@goodmis.org>
+
+[ Upstream commit 49d67e445742bbcb03106b735b2ab39f6e5c56bc ]
+
+The tracefs file system is by default mounted such that only root user can
+access it. But there are legitimate reasons to create a group and allow
+those added to the group to have access to tracing. By changing the
+permissions of the tracefs mount point to allow access, it will allow
+group access to the tracefs directory.
+
+There should not be any real reason to allow all access to the tracefs
+directory as it contains sensitive information. Have the default
+permission of directories being created not have any OTH (other) bits set,
+such that an admin that wants to give permission to a group has to first
+disable all OTH bits in the file system.
+
+Link: https://lkml.kernel.org/r/20210818153038.664127804@goodmis.org
+
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/tracefs/inode.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
+index 0caa151cae4ee..efe078fe5d4a9 100644
+--- a/fs/tracefs/inode.c
++++ b/fs/tracefs/inode.c
+@@ -427,7 +427,8 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent,
+       if (unlikely(!inode))
+               return failed_creating(dentry);
+-      inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
++      /* Do not set bits for OTH */
++      inode->i_mode = S_IFDIR | S_IRWXU | S_IRUSR| S_IRGRP | S_IXUSR | S_IXGRP;
+       inode->i_op = ops;
+       inode->i_fop = &simple_dir_operations;
+-- 
+2.33.0
+
diff --git a/queue-5.4/tracing-cfi-fix-cmp_entries_-functions-signature-mis.patch b/queue-5.4/tracing-cfi-fix-cmp_entries_-functions-signature-mis.patch
new file mode 100644 (file)
index 0000000..ca080f4
--- /dev/null
@@ -0,0 +1,134 @@
+From 20174ecab92c1b17c5204a6499b3551533bdd6ad Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 13 Oct 2021 21:52:17 -0700
+Subject: tracing/cfi: Fix cmp_entries_* functions signature mismatch
+
+From: Kalesh Singh <kaleshsingh@google.com>
+
+[ Upstream commit 7ce1bb83a14019f8c396d57ec704d19478747716 ]
+
+If CONFIG_CFI_CLANG=y, attempting to read an event histogram will cause
+the kernel to panic due to failed CFI check.
+
+    1. echo 'hist:keys=common_pid' >> events/sched/sched_switch/trigger
+    2. cat events/sched/sched_switch/hist
+    3. kernel panics on attempting to read hist
+
+This happens because the sort() function expects a generic
+int (*)(const void *, const void *) pointer for the compare function.
+To prevent this CFI failure, change tracing map cmp_entries_* function
+signatures to match this.
+
+Also, fix the build error reported by the kernel test robot [1].
+
+[1] https://lore.kernel.org/r/202110141140.zzi4dRh4-lkp@intel.com/
+
+Link: https://lkml.kernel.org/r/20211014045217.3265162-1-kaleshsingh@google.com
+
+Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
+Reported-by: kernel test robot <lkp@intel.com>
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/trace/tracing_map.c | 40 ++++++++++++++++++++++----------------
+ 1 file changed, 23 insertions(+), 17 deletions(-)
+
+diff --git a/kernel/trace/tracing_map.c b/kernel/trace/tracing_map.c
+index 9e31bfc818ff8..10657b8dc2c2d 100644
+--- a/kernel/trace/tracing_map.c
++++ b/kernel/trace/tracing_map.c
+@@ -834,29 +834,35 @@ int tracing_map_init(struct tracing_map *map)
+       return err;
+ }
+-static int cmp_entries_dup(const struct tracing_map_sort_entry **a,
+-                         const struct tracing_map_sort_entry **b)
++static int cmp_entries_dup(const void *A, const void *B)
+ {
++      const struct tracing_map_sort_entry *a, *b;
+       int ret = 0;
+-      if (memcmp((*a)->key, (*b)->key, (*a)->elt->map->key_size))
++      a = *(const struct tracing_map_sort_entry **)A;
++      b = *(const struct tracing_map_sort_entry **)B;
++
++      if (memcmp(a->key, b->key, a->elt->map->key_size))
+               ret = 1;
+       return ret;
+ }
+-static int cmp_entries_sum(const struct tracing_map_sort_entry **a,
+-                         const struct tracing_map_sort_entry **b)
++static int cmp_entries_sum(const void *A, const void *B)
+ {
+       const struct tracing_map_elt *elt_a, *elt_b;
++      const struct tracing_map_sort_entry *a, *b;
+       struct tracing_map_sort_key *sort_key;
+       struct tracing_map_field *field;
+       tracing_map_cmp_fn_t cmp_fn;
+       void *val_a, *val_b;
+       int ret = 0;
+-      elt_a = (*a)->elt;
+-      elt_b = (*b)->elt;
++      a = *(const struct tracing_map_sort_entry **)A;
++      b = *(const struct tracing_map_sort_entry **)B;
++
++      elt_a = a->elt;
++      elt_b = b->elt;
+       sort_key = &elt_a->map->sort_key;
+@@ -873,18 +879,21 @@ static int cmp_entries_sum(const struct tracing_map_sort_entry **a,
+       return ret;
+ }
+-static int cmp_entries_key(const struct tracing_map_sort_entry **a,
+-                         const struct tracing_map_sort_entry **b)
++static int cmp_entries_key(const void *A, const void *B)
+ {
+       const struct tracing_map_elt *elt_a, *elt_b;
++      const struct tracing_map_sort_entry *a, *b;
+       struct tracing_map_sort_key *sort_key;
+       struct tracing_map_field *field;
+       tracing_map_cmp_fn_t cmp_fn;
+       void *val_a, *val_b;
+       int ret = 0;
+-      elt_a = (*a)->elt;
+-      elt_b = (*b)->elt;
++      a = *(const struct tracing_map_sort_entry **)A;
++      b = *(const struct tracing_map_sort_entry **)B;
++
++      elt_a = a->elt;
++      elt_b = b->elt;
+       sort_key = &elt_a->map->sort_key;
+@@ -989,10 +998,8 @@ static void sort_secondary(struct tracing_map *map,
+                          struct tracing_map_sort_key *primary_key,
+                          struct tracing_map_sort_key *secondary_key)
+ {
+-      int (*primary_fn)(const struct tracing_map_sort_entry **,
+-                        const struct tracing_map_sort_entry **);
+-      int (*secondary_fn)(const struct tracing_map_sort_entry **,
+-                          const struct tracing_map_sort_entry **);
++      int (*primary_fn)(const void *, const void *);
++      int (*secondary_fn)(const void *, const void *);
+       unsigned i, start = 0, n_sub = 1;
+       if (is_key(map, primary_key->field_idx))
+@@ -1061,8 +1068,7 @@ int tracing_map_sort_entries(struct tracing_map *map,
+                            unsigned int n_sort_keys,
+                            struct tracing_map_sort_entry ***sort_entries)
+ {
+-      int (*cmp_entries_fn)(const struct tracing_map_sort_entry **,
+-                            const struct tracing_map_sort_entry **);
++      int (*cmp_entries_fn)(const void *, const void *);
+       struct tracing_map_sort_entry *sort_entry, **entries;
+       int i, n_entries, ret;
+-- 
+2.33.0
+
diff --git a/queue-5.4/udp6-allow-so_mark-ctrl-msg-to-affect-routing.patch b/queue-5.4/udp6-allow-so_mark-ctrl-msg-to-affect-routing.patch
new file mode 100644 (file)
index 0000000..aa4ff45
--- /dev/null
@@ -0,0 +1,49 @@
+From f91aee277f2fac5b640de91ee1819ee5875c6f17 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 29 Oct 2021 08:51:34 -0700
+Subject: udp6: allow SO_MARK ctrl msg to affect routing
+
+From: Jakub Kicinski <kuba@kernel.org>
+
+[ Upstream commit 42dcfd850e514b229d616a53dec06d0f2533217c ]
+
+Commit c6af0c227a22 ("ip: support SO_MARK cmsg")
+added propagation of SO_MARK from cmsg to skb->mark.
+For IPv4 and raw sockets the mark also affects route
+lookup, but in case of IPv6 the flow info is
+initialized before cmsg is parsed.
+
+Fixes: c6af0c227a22 ("ip: support SO_MARK cmsg")
+Reported-and-tested-by: Xintong Hu <huxintong@fb.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Reviewed-by: David Ahern <dsahern@kernel.org>
+Reviewed-by: Willem de Bruijn <willemb@google.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv6/udp.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
+index 0f57c682afdd8..818fc99756256 100644
+--- a/net/ipv6/udp.c
++++ b/net/ipv6/udp.c
+@@ -1363,7 +1363,6 @@ do_udp_sendmsg:
+       if (!fl6.flowi6_oif)
+               fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex;
+-      fl6.flowi6_mark = ipc6.sockc.mark;
+       fl6.flowi6_uid = sk->sk_uid;
+       if (msg->msg_controllen) {
+@@ -1399,6 +1398,7 @@ do_udp_sendmsg:
+       ipc6.opt = opt;
+       fl6.flowi6_proto = sk->sk_protocol;
++      fl6.flowi6_mark = ipc6.sockc.mark;
+       fl6.daddr = *daddr;
+       if (ipv6_addr_any(&fl6.saddr) && !ipv6_addr_any(&np->saddr))
+               fl6.saddr = np->saddr;
+-- 
+2.33.0
+
diff --git a/queue-5.4/usb-gadget-hid-fix-error-code-in-do_config.patch b/queue-5.4/usb-gadget-hid-fix-error-code-in-do_config.patch
new file mode 100644 (file)
index 0000000..3da55f9
--- /dev/null
@@ -0,0 +1,40 @@
+From e90ec3b50630891e94013ca94ae61b20971f53d5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 11 Oct 2021 15:37:39 +0300
+Subject: usb: gadget: hid: fix error code in do_config()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit 68e7c510fdf4f6167404609da52e1979165649f6 ]
+
+Return an error code if usb_get_function() fails.  Don't return success.
+
+Fixes: 4bc8a33f2407 ("usb: gadget: hid: convert to new interface of f_hid")
+Acked-by: Felipe Balbi <balbi@kernel.org>
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Link: https://lore.kernel.org/r/20211011123739.GC15188@kili
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/usb/gadget/legacy/hid.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/usb/gadget/legacy/hid.c b/drivers/usb/gadget/legacy/hid.c
+index 5b27d289443fe..3912cc805f3af 100644
+--- a/drivers/usb/gadget/legacy/hid.c
++++ b/drivers/usb/gadget/legacy/hid.c
+@@ -99,8 +99,10 @@ static int do_config(struct usb_configuration *c)
+       list_for_each_entry(e, &hidg_func_list, node) {
+               e->f = usb_get_function(e->fi);
+-              if (IS_ERR(e->f))
++              if (IS_ERR(e->f)) {
++                      status = PTR_ERR(e->f);
+                       goto put;
++              }
+               status = usb_add_function(c, e->f);
+               if (status < 0) {
+                       usb_put_function(e->f);
+-- 
+2.33.0
+
diff --git a/queue-5.4/video-fbdev-chipsfb-use-memset_io-instead-of-memset.patch b/queue-5.4/video-fbdev-chipsfb-use-memset_io-instead-of-memset.patch
new file mode 100644 (file)
index 0000000..478b676
--- /dev/null
@@ -0,0 +1,84 @@
+From ac8c2daef5c4dad2bbe5afbb78fac30c31ac1081 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 15 Sep 2021 15:34:35 +0200
+Subject: video: fbdev: chipsfb: use memset_io() instead of memset()
+
+From: Christophe Leroy <christophe.leroy@csgroup.eu>
+
+[ Upstream commit f2719b26ae27282c145202ffd656d5ff1fe737cc ]
+
+While investigating a lockup at startup on Powerbook 3400C, it was
+identified that the fbdev driver generates alignment exception at
+startup:
+
+  --- interrupt: 600 at memset+0x60/0xc0
+  NIP:  c0021414 LR: c03fc49c CTR: 00007fff
+  REGS: ca021c10 TRAP: 0600   Tainted: G        W          (5.14.2-pmac-00727-g12a41fa69492)
+  MSR:  00009032 <EE,ME,IR,DR,RI>  CR: 44008442  XER: 20000100
+  DAR: cab80020 DSISR: 00017c07
+  GPR00: 00000007 ca021cd0 c14412e0 cab80000 00000000 00100000 cab8001c 00000004
+  GPR08: 00100000 00007fff 00000000 00000000 84008442 00000000 c0006fb4 00000000
+  GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00100000
+  GPR24: 00000000 81800000 00000320 c15fa400 c14d1878 00000000 c14d1800 c094e19c
+  NIP [c0021414] memset+0x60/0xc0
+  LR [c03fc49c] chipsfb_pci_init+0x160/0x580
+  --- interrupt: 600
+  [ca021cd0] [c03fc46c] chipsfb_pci_init+0x130/0x580 (unreliable)
+  [ca021d20] [c03a3a70] pci_device_probe+0xf8/0x1b8
+  [ca021d50] [c043d584] really_probe.part.0+0xac/0x388
+  [ca021d70] [c043d914] __driver_probe_device+0xb4/0x170
+  [ca021d90] [c043da18] driver_probe_device+0x48/0x144
+  [ca021dc0] [c043e318] __driver_attach+0x11c/0x1c4
+  [ca021de0] [c043ad30] bus_for_each_dev+0x88/0xf0
+  [ca021e10] [c043c724] bus_add_driver+0x190/0x22c
+  [ca021e40] [c043ee94] driver_register+0x9c/0x170
+  [ca021e60] [c0006c28] do_one_initcall+0x54/0x1ec
+  [ca021ed0] [c08246e4] kernel_init_freeable+0x1c0/0x270
+  [ca021f10] [c0006fdc] kernel_init+0x28/0x11c
+  [ca021f30] [c0017148] ret_from_kernel_thread+0x14/0x1c
+  Instruction dump:
+  7d4601a4 39490777 7d4701a4 39490888 7d4801a4 39490999 7d4901a4 39290aaa
+  7d2a01a4 4c00012c 4bfffe88 0fe00000 <4bfffe80> 9421fff0 38210010 48001970
+
+This is due to 'dcbz' instruction being used on non-cached memory.
+'dcbz' instruction is used by memset() to zeroize a complete
+cacheline at once, and memset() is not expected to be used on non
+cached memory.
+
+When performing a 'sparse' check on fbdev driver, it also appears
+that the use of memset() is unexpected:
+
+  drivers/video/fbdev/chipsfb.c:334:17: warning: incorrect type in argument 1 (different address spaces)
+  drivers/video/fbdev/chipsfb.c:334:17:    expected void *
+  drivers/video/fbdev/chipsfb.c:334:17:    got char [noderef] __iomem *screen_base
+  drivers/video/fbdev/chipsfb.c:334:15: warning: memset with byte count of 1048576
+
+Use fb_memset() instead of memset(). fb_memset() is defined as
+memset_io() for powerpc.
+
+Fixes: 8c8709334cec ("[PATCH] ppc32: Remove CONFIG_PMAC_PBOOK")
+Reported-by: Stan Johnson <userm57@yahoo.com>
+Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://lore.kernel.org/r/884a54f1e5cb774c1d9b4db780209bee5d4f6718.1631712563.git.christophe.leroy@csgroup.eu
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/video/fbdev/chipsfb.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/video/fbdev/chipsfb.c b/drivers/video/fbdev/chipsfb.c
+index f4dc320dcafe2..80fdd3ee0565f 100644
+--- a/drivers/video/fbdev/chipsfb.c
++++ b/drivers/video/fbdev/chipsfb.c
+@@ -331,7 +331,7 @@ static const struct fb_var_screeninfo chipsfb_var = {
+ static void init_chips(struct fb_info *p, unsigned long addr)
+ {
+-      memset(p->screen_base, 0, 0x100000);
++      fb_memset(p->screen_base, 0, 0x100000);
+       p->fix = chipsfb_fix;
+       p->fix.smem_start = addr;
+-- 
+2.33.0
+
diff --git a/queue-5.4/virtio-gpu-fix-possible-memory-allocation-failure.patch b/queue-5.4/virtio-gpu-fix-possible-memory-allocation-failure.patch
new file mode 100644 (file)
index 0000000..7b86a1a
--- /dev/null
@@ -0,0 +1,55 @@
+From c702f73717f0569bec8e270f98dd5b6619725e20 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 28 Aug 2021 18:43:21 +0800
+Subject: virtio-gpu: fix possible memory allocation failure
+
+From: liuyuntao <liuyuntao10@huawei.com>
+
+[ Upstream commit 5bd4f20de8acad37dbb3154feb34dbc36d506c02 ]
+
+When kmem_cache_zalloc in virtio_gpu_get_vbuf fails, it will return
+an error code. But none of its callers checks this error code, and
+a core dump will take place.
+
+Considering many of its callers can't handle such error, I add
+a __GFP_NOFAIL flag when calling kmem_cache_zalloc to make sure
+it won't fail, and delete those unused error handlings.
+
+Fixes: dc5698e80cf724 ("Add virtio gpu driver.")
+Signed-off-by: Yuntao Liu <liuyuntao10@huawei.com>
+Link: http://patchwork.freedesktop.org/patch/msgid/20210828104321.3410312-1-liuyuntao10@huawei.com
+Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/virtio/virtgpu_vq.c | 8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
+index bb46e7a0f1b5d..0ca996e6fd5cb 100644
+--- a/drivers/gpu/drm/virtio/virtgpu_vq.c
++++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
+@@ -80,9 +80,7 @@ virtio_gpu_get_vbuf(struct virtio_gpu_device *vgdev,
+ {
+       struct virtio_gpu_vbuffer *vbuf;
+-      vbuf = kmem_cache_zalloc(vgdev->vbufs, GFP_KERNEL);
+-      if (!vbuf)
+-              return ERR_PTR(-ENOMEM);
++      vbuf = kmem_cache_zalloc(vgdev->vbufs, GFP_KERNEL | __GFP_NOFAIL);
+       BUG_ON(size > MAX_INLINE_CMD_SIZE);
+       vbuf->buf = (void *)vbuf + sizeof(*vbuf);
+@@ -142,10 +140,6 @@ static void *virtio_gpu_alloc_cmd_resp(struct virtio_gpu_device *vgdev,
+       vbuf = virtio_gpu_get_vbuf(vgdev, cmd_size,
+                                  resp_size, resp_buf, cb);
+-      if (IS_ERR(vbuf)) {
+-              *vbuffer_p = NULL;
+-              return ERR_CAST(vbuf);
+-      }
+       *vbuffer_p = vbuf;
+       return (struct virtio_gpu_command *)vbuf->buf;
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/vrf-run-conntrack-only-in-context-of-lower-physdev-f.patch b/queue-5.4/vrf-run-conntrack-only-in-context-of-lower-physdev-f.patch
new file mode 100644 (file)
index 0000000..d46ed37
--- /dev/null
@@ -0,0 +1,141 @@
+From 039b17dd52ce5f87548f7af1f20c983f1dcbbca5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 25 Oct 2021 16:14:00 +0200
+Subject: vrf: run conntrack only in context of lower/physdev for locally
+ generated packets
+
+From: Florian Westphal <fw@strlen.de>
+
+[ Upstream commit 8c9c296adfae9ea05f655d69e9f6e13daa86fb4a ]
+
+The VRF driver invokes netfilter for output+postrouting hooks so that users
+can create rules that check for 'oif $vrf' rather than lower device name.
+
+This is a problem when NAT rules are configured.
+
+To avoid any conntrack involvement in round 1, tag skbs as 'untracked'
+to prevent conntrack from picking them up.
+
+This gets cleared before the packet gets handed to the ip stack so
+conntrack will be active on the second iteration.
+
+One remaining issue is that a rule like
+
+  output ... oif $vrfname notrack
+
+won't propagate to the second round because we can't tell
+'notrack set via ruleset' and 'notrack set by vrf driver' apart.
+However, this isn't a regression: the 'notrack' removal happens
+instead of unconditional nf_reset_ct().
+I'd also like to avoid leaking more vrf specific conditionals into the
+netfilter infra.
+
+For ingress, conntrack has already been done before the packet makes it
+to the vrf driver, with this patch egress does connection tracking with
+lower/physical device as well.
+
+Signed-off-by: Florian Westphal <fw@strlen.de>
+Acked-by: David Ahern <dsahern@kernel.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/vrf.c | 28 ++++++++++++++++++++++++----
+ 1 file changed, 24 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
+index f08ed52d51f3f..f436b8c130611 100644
+--- a/drivers/net/vrf.c
++++ b/drivers/net/vrf.c
+@@ -33,6 +33,7 @@
+ #include <net/l3mdev.h>
+ #include <net/fib_rules.h>
+ #include <net/netns/generic.h>
++#include <net/netfilter/nf_conntrack.h>
+ #define DRV_NAME      "vrf"
+ #define DRV_VERSION   "1.0"
+@@ -147,12 +148,26 @@ static int vrf_local_xmit(struct sk_buff *skb, struct net_device *dev,
+       return NETDEV_TX_OK;
+ }
++static void vrf_nf_set_untracked(struct sk_buff *skb)
++{
++      if (skb_get_nfct(skb) == 0)
++              nf_ct_set(skb, NULL, IP_CT_UNTRACKED);
++}
++
++static void vrf_nf_reset_ct(struct sk_buff *skb)
++{
++      if (skb_get_nfct(skb) == IP_CT_UNTRACKED)
++              nf_reset_ct(skb);
++}
++
+ #if IS_ENABLED(CONFIG_IPV6)
+ static int vrf_ip6_local_out(struct net *net, struct sock *sk,
+                            struct sk_buff *skb)
+ {
+       int err;
++      vrf_nf_reset_ct(skb);
++
+       err = nf_hook(NFPROTO_IPV6, NF_INET_LOCAL_OUT, net,
+                     sk, skb, NULL, skb_dst(skb)->dev, dst_output);
+@@ -232,6 +247,8 @@ static int vrf_ip_local_out(struct net *net, struct sock *sk,
+ {
+       int err;
++      vrf_nf_reset_ct(skb);
++
+       err = nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT, net, sk,
+                     skb, NULL, skb_dst(skb)->dev, dst_output);
+       if (likely(err == 1))
+@@ -351,8 +368,7 @@ static void vrf_finish_direct(struct sk_buff *skb)
+               skb_pull(skb, ETH_HLEN);
+       }
+-      /* reset skb device */
+-      nf_reset_ct(skb);
++      vrf_nf_reset_ct(skb);
+ }
+ #if IS_ENABLED(CONFIG_IPV6)
+@@ -366,7 +382,7 @@ static int vrf_finish_output6(struct net *net, struct sock *sk,
+       struct neighbour *neigh;
+       int ret;
+-      nf_reset_ct(skb);
++      vrf_nf_reset_ct(skb);
+       skb->protocol = htons(ETH_P_IPV6);
+       skb->dev = dev;
+@@ -477,6 +493,8 @@ static struct sk_buff *vrf_ip6_out_direct(struct net_device *vrf_dev,
+       skb->dev = vrf_dev;
++      vrf_nf_set_untracked(skb);
++
+       err = nf_hook(NFPROTO_IPV6, NF_INET_LOCAL_OUT, net, sk,
+                     skb, NULL, vrf_dev, vrf_ip6_out_direct_finish);
+@@ -584,7 +602,7 @@ static int vrf_finish_output(struct net *net, struct sock *sk, struct sk_buff *s
+       bool is_v6gw = false;
+       int ret = -EINVAL;
+-      nf_reset_ct(skb);
++      vrf_nf_reset_ct(skb);
+       /* Be paranoid, rather than too clever. */
+       if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) {
+@@ -712,6 +730,8 @@ static struct sk_buff *vrf_ip_out_direct(struct net_device *vrf_dev,
+       skb->dev = vrf_dev;
++      vrf_nf_set_untracked(skb);
++
+       err = nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT, net, sk,
+                     skb, NULL, vrf_dev, vrf_ip_out_direct_finish);
+-- 
+2.33.0
+
diff --git a/queue-5.4/vsock-prevent-unnecessary-refcnt-inc-for-nonblocking.patch b/queue-5.4/vsock-prevent-unnecessary-refcnt-inc-for-nonblocking.patch
new file mode 100644 (file)
index 0000000..46384db
--- /dev/null
@@ -0,0 +1,42 @@
+From c8d25ed34fc3110ae7a94d3bd96e4ef76757d804 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 9 Nov 2021 00:15:02 +0000
+Subject: vsock: prevent unnecessary refcnt inc for nonblocking connect
+
+From: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
+
+[ Upstream commit c7cd82b90599fa10915f41e3dd9098a77d0aa7b6 ]
+
+Currently vosck_connect() increments sock refcount for nonblocking
+socket each time it's called, which can lead to memory leak if
+it's called multiple times because connect timeout function decrements
+sock refcount only once.
+
+Fixes it by making vsock_connect() return -EALREADY immediately when
+sock state is already SS_CONNECTING.
+
+Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
+Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
+Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/vmw_vsock/af_vsock.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
+index d4104144bab1b..bc8055f4571bc 100644
+--- a/net/vmw_vsock/af_vsock.c
++++ b/net/vmw_vsock/af_vsock.c
+@@ -1151,6 +1151,8 @@ static int vsock_stream_connect(struct socket *sock, struct sockaddr *addr,
+                * non-blocking call.
+                */
+               err = -EALREADY;
++              if (flags & O_NONBLOCK)
++                      goto out;
+               break;
+       default:
+               if ((sk->sk_state == TCP_LISTEN) ||
+-- 
+2.33.0
+
diff --git a/queue-5.4/watchdog-f71808e_wdt-fix-inaccurate-report-in-wdioc_.patch b/queue-5.4/watchdog-f71808e_wdt-fix-inaccurate-report-in-wdioc_.patch
new file mode 100644 (file)
index 0000000..31679a4
--- /dev/null
@@ -0,0 +1,53 @@
+From 2bf44b21eaa550e24fc3062373727494d1f8fb7c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Aug 2021 18:20:31 +0200
+Subject: watchdog: f71808e_wdt: fix inaccurate report in WDIOC_GETTIMEOUT
+
+From: Ahmad Fatoum <a.fatoum@pengutronix.de>
+
+[ Upstream commit 164483c735190775f29d0dcbac0363adc51a068d ]
+
+The fintek watchdog timer can configure timeouts of second granularity
+only up to 255 seconds. Beyond that, the timeout needs to be configured
+with minute granularity. WDIOC_GETTIMEOUT should report the actual
+timeout configured, not just echo back the timeout configured by the
+user. Do so.
+
+Fixes: 96cb4eb019ce ("watchdog: f71808e_wdt: new watchdog driver for Fintek F71808E and F71882FG")
+Suggested-by: Guenter Roeck <linux@roeck-us.net>
+Reviewed-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
+Link: https://lore.kernel.org/r/5e17960fe8cc0e3cb2ba53de4730b75d9a0f33d5.1628525954.git-series.a.fatoum@pengutronix.de
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/watchdog/f71808e_wdt.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/watchdog/f71808e_wdt.c b/drivers/watchdog/f71808e_wdt.c
+index 893cef70c1599..aa57498009c34 100644
+--- a/drivers/watchdog/f71808e_wdt.c
++++ b/drivers/watchdog/f71808e_wdt.c
+@@ -228,15 +228,17 @@ static int watchdog_set_timeout(int timeout)
+       mutex_lock(&watchdog.lock);
+-      watchdog.timeout = timeout;
+       if (timeout > 0xff) {
+               watchdog.timer_val = DIV_ROUND_UP(timeout, 60);
+               watchdog.minutes_mode = true;
++              timeout = watchdog.timer_val * 60;
+       } else {
+               watchdog.timer_val = timeout;
+               watchdog.minutes_mode = false;
+       }
++      watchdog.timeout = timeout;
++
+       mutex_unlock(&watchdog.lock);
+       return 0;
+-- 
+2.33.0
+
diff --git a/queue-5.4/wcn36xx-add-proper-dma-memory-barriers-in-rx-path.patch b/queue-5.4/wcn36xx-add-proper-dma-memory-barriers-in-rx-path.patch
new file mode 100644 (file)
index 0000000..fea8341
--- /dev/null
@@ -0,0 +1,66 @@
+From e1adcc080163c31dfad21051431fc1af7939fa5f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 22 Oct 2021 17:15:28 -0700
+Subject: wcn36xx: add proper DMA memory barriers in rx path
+
+From: Benjamin Li <benl@squareup.com>
+
+[ Upstream commit 9bfe38e064af5decba2ffce66a2958ab8b10eaa4 ]
+
+This is essentially exactly following the dma_wmb()/dma_rmb() usage
+instructions in Documentation/memory-barriers.txt.
+
+The theoretical races here are:
+
+1. DXE (the DMA Transfer Engine in the Wi-Fi subsystem) seeing the
+dxe->ctrl & WCN36xx_DXE_CTRL_VLD write before the dxe->dst_addr_l
+write, thus performing DMA into the wrong address.
+
+2. CPU reading dxe->dst_addr_l before DXE unsets dxe->ctrl &
+WCN36xx_DXE_CTRL_VLD. This should generally be harmless since DXE
+doesn't write dxe->dst_addr_l (no risk of freeing the wrong skb).
+
+Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware")
+Signed-off-by: Benjamin Li <benl@squareup.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/20211023001528.3077822-1-benl@squareup.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/ath/wcn36xx/dxe.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/ath/wcn36xx/dxe.c
+index bab30f7a443ce..4da25e84793b7 100644
+--- a/drivers/net/wireless/ath/wcn36xx/dxe.c
++++ b/drivers/net/wireless/ath/wcn36xx/dxe.c
+@@ -563,6 +563,10 @@ static int wcn36xx_rx_handle_packets(struct wcn36xx *wcn,
+       dxe = ctl->desc;
+       while (!(READ_ONCE(dxe->ctrl) & WCN36xx_DXE_CTRL_VLD)) {
++              /* do not read until we own DMA descriptor */
++              dma_rmb();
++
++              /* read/modify DMA descriptor */
+               skb = ctl->skb;
+               dma_addr = dxe->dst_addr_l;
+               ret = wcn36xx_dxe_fill_skb(wcn->dev, ctl, GFP_ATOMIC);
+@@ -573,9 +577,15 @@ static int wcn36xx_rx_handle_packets(struct wcn36xx *wcn,
+                       dma_unmap_single(wcn->dev, dma_addr, WCN36XX_PKT_SIZE,
+                                       DMA_FROM_DEVICE);
+                       wcn36xx_rx_skb(wcn, skb);
+-              } /* else keep old skb not submitted and use it for rx DMA */
++              }
++              /* else keep old skb not submitted and reuse it for rx DMA
++               * (dropping the packet that it contained)
++               */
++              /* flush descriptor changes before re-marking as valid */
++              dma_wmb();
+               dxe->ctrl = ctrl;
++
+               ctl = ctl->next;
+               dxe = ctl->desc;
+       }
+-- 
+2.33.0
+
diff --git a/queue-5.4/wilc1000-fix-possible-memory-leak-in-cfg_scan_result.patch b/queue-5.4/wilc1000-fix-possible-memory-leak-in-cfg_scan_result.patch
new file mode 100644 (file)
index 0000000..8da818e
--- /dev/null
@@ -0,0 +1,41 @@
+From 4be73f2d4420909d10295b1ac5415c05c90e5500 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 16 Sep 2021 16:49:18 +0000
+Subject: wilc1000: fix possible memory leak in cfg_scan_result()
+
+From: Ajay Singh <ajay.kathat@microchip.com>
+
+[ Upstream commit 3c719fed0f3a5e95b1d164609ecc81c4191ade70 ]
+
+When the BSS reference holds a valid reference, it is not freed. The 'if'
+condition is wrong. Instead of the 'if (bss)' check, the 'if (!bss)' check
+is used.
+The issue is solved by removing the unnecessary 'if' check because
+cfg80211_put_bss() already performs the NULL validation.
+
+Fixes: 6cd4fa5ab691 ("staging: wilc1000: make use of cfg80211_inform_bss_frame()")
+Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/20210916164902.74629-3-ajay.kathat@microchip.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+index c3cd6f389a989..2a369fdaf0cbb 100644
+--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
++++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+@@ -97,8 +97,7 @@ static void cfg_scan_result(enum scan_event scan_event,
+                                               info->frame_len,
+                                               (s32)info->rssi * 100,
+                                               GFP_KERNEL);
+-              if (!bss)
+-                      cfg80211_put_bss(wiphy, bss);
++              cfg80211_put_bss(wiphy, bss);
+       } else if (scan_event == SCAN_EVENT_DONE) {
+               mutex_lock(&priv->scan_req_lock);
+-- 
+2.33.0
+
diff --git a/queue-5.4/workqueue-make-sysfs-of-unbound-kworker-cpumask-more.patch b/queue-5.4/workqueue-make-sysfs-of-unbound-kworker-cpumask-more.patch
new file mode 100644 (file)
index 0000000..5e1312f
--- /dev/null
@@ -0,0 +1,71 @@
+From b9d3c0f269a4a3578b0f5960b7d7fc0a9753d458 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 17 Oct 2021 20:04:02 +0800
+Subject: workqueue: make sysfs of unbound kworker cpumask more clever
+
+From: Menglong Dong <imagedong@tencent.com>
+
+[ Upstream commit d25302e46592c97d29f70ccb1be558df31a9a360 ]
+
+Some unfriendly component, such as dpdk, write the same mask to
+unbound kworker cpumask again and again. Every time it write to
+this interface some work is queue to cpu, even though the mask
+is same with the original mask.
+
+So, fix it by return success and do nothing if the cpumask is
+equal with the old one.
+
+Signed-off-by: Mengen Sun <mengensun@tencent.com>
+Signed-off-by: Menglong Dong <imagedong@tencent.com>
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/workqueue.c | 15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/kernel/workqueue.c b/kernel/workqueue.c
+index 885d4792abdfc..77e6964ae1a99 100644
+--- a/kernel/workqueue.c
++++ b/kernel/workqueue.c
+@@ -5302,9 +5302,6 @@ int workqueue_set_unbound_cpumask(cpumask_var_t cpumask)
+       int ret = -EINVAL;
+       cpumask_var_t saved_cpumask;
+-      if (!zalloc_cpumask_var(&saved_cpumask, GFP_KERNEL))
+-              return -ENOMEM;
+-
+       /*
+        * Not excluding isolated cpus on purpose.
+        * If the user wishes to include them, we allow that.
+@@ -5312,6 +5309,15 @@ int workqueue_set_unbound_cpumask(cpumask_var_t cpumask)
+       cpumask_and(cpumask, cpumask, cpu_possible_mask);
+       if (!cpumask_empty(cpumask)) {
+               apply_wqattrs_lock();
++              if (cpumask_equal(cpumask, wq_unbound_cpumask)) {
++                      ret = 0;
++                      goto out_unlock;
++              }
++
++              if (!zalloc_cpumask_var(&saved_cpumask, GFP_KERNEL)) {
++                      ret = -ENOMEM;
++                      goto out_unlock;
++              }
+               /* save the old wq_unbound_cpumask. */
+               cpumask_copy(saved_cpumask, wq_unbound_cpumask);
+@@ -5324,10 +5330,11 @@ int workqueue_set_unbound_cpumask(cpumask_var_t cpumask)
+               if (ret < 0)
+                       cpumask_copy(wq_unbound_cpumask, saved_cpumask);
++              free_cpumask_var(saved_cpumask);
++out_unlock:
+               apply_wqattrs_unlock();
+       }
+-      free_cpumask_var(saved_cpumask);
+       return ret;
+ }
+-- 
+2.33.0
+
diff --git a/queue-5.4/x86-hyperv-protect-set_hv_tscchange_cb-against-getti.patch b/queue-5.4/x86-hyperv-protect-set_hv_tscchange_cb-against-getti.patch
new file mode 100644 (file)
index 0000000..bda6bd6
--- /dev/null
@@ -0,0 +1,72 @@
+From 31e677469c78b2f1a92b8448bddb83e3a176cc0b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 12 Oct 2021 17:50:05 +0200
+Subject: x86/hyperv: Protect set_hv_tscchange_cb() against getting preempted
+
+From: Vitaly Kuznetsov <vkuznets@redhat.com>
+
+[ Upstream commit 285f68afa8b20f752b0b7194d54980b5e0e27b75 ]
+
+The following issue is observed with CONFIG_DEBUG_PREEMPT when KVM loads:
+
+ KVM: vmx: using Hyper-V Enlightened VMCS
+ BUG: using smp_processor_id() in preemptible [00000000] code: systemd-udevd/488
+ caller is set_hv_tscchange_cb+0x16/0x80
+ CPU: 1 PID: 488 Comm: systemd-udevd Not tainted 5.15.0-rc5+ #396
+ Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v4.0 12/17/2019
+ Call Trace:
+  dump_stack_lvl+0x6a/0x9a
+  check_preemption_disabled+0xde/0xe0
+  ? kvm_gen_update_masterclock+0xd0/0xd0 [kvm]
+  set_hv_tscchange_cb+0x16/0x80
+  kvm_arch_init+0x23f/0x290 [kvm]
+  kvm_init+0x30/0x310 [kvm]
+  vmx_init+0xaf/0x134 [kvm_intel]
+  ...
+
+set_hv_tscchange_cb() can get preempted in between acquiring
+smp_processor_id() and writing to HV_X64_MSR_REENLIGHTENMENT_CONTROL. This
+is not an issue by itself: HV_X64_MSR_REENLIGHTENMENT_CONTROL is a
+partition-wide MSR and it doesn't matter which particular CPU will be
+used to receive reenlightenment notifications. The only real problem can
+(in theory) be observed if the CPU whose id was acquired with
+smp_processor_id() goes offline before we manage to write to the MSR,
+the logic in hv_cpu_die() won't be able to reassign it correctly.
+
+Reported-by: Michael Kelley <mikelley@microsoft.com>
+Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
+Link: https://lore.kernel.org/r/20211012155005.1613352-1-vkuznets@redhat.com
+Signed-off-by: Wei Liu <wei.liu@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/hyperv/hv_init.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
+index 79583bac9ac4a..812db1ac8cb11 100644
+--- a/arch/x86/hyperv/hv_init.c
++++ b/arch/x86/hyperv/hv_init.c
+@@ -155,7 +155,6 @@ void set_hv_tscchange_cb(void (*cb)(void))
+       struct hv_reenlightenment_control re_ctrl = {
+               .vector = HYPERV_REENLIGHTENMENT_VECTOR,
+               .enabled = 1,
+-              .target_vp = hv_vp_index[smp_processor_id()]
+       };
+       struct hv_tsc_emulation_control emu_ctrl = {.enabled = 1};
+@@ -169,8 +168,12 @@ void set_hv_tscchange_cb(void (*cb)(void))
+       /* Make sure callback is registered before we write to MSRs */
+       wmb();
++      re_ctrl.target_vp = hv_vp_index[get_cpu()];
++
+       wrmsrl(HV_X64_MSR_REENLIGHTENMENT_CONTROL, *((u64 *)&re_ctrl));
+       wrmsrl(HV_X64_MSR_TSC_EMULATION_CONTROL, *((u64 *)&emu_ctrl));
++
++      put_cpu();
+ }
+ EXPORT_SYMBOL_GPL(set_hv_tscchange_cb);
+-- 
+2.33.0
+
diff --git a/queue-5.4/x86-increase-exception-stack-sizes.patch b/queue-5.4/x86-increase-exception-stack-sizes.patch
new file mode 100644 (file)
index 0000000..19ea4a6
--- /dev/null
@@ -0,0 +1,37 @@
+From ac7aede7ae0df1c45aacc569498ec70fb8901989 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 15 Sep 2021 16:19:46 +0200
+Subject: x86: Increase exception stack sizes
+
+From: Peter Zijlstra <peterz@infradead.org>
+
+[ Upstream commit 7fae4c24a2b84a66c7be399727aca11e7a888462 ]
+
+It turns out that a single page of stack is trivial to overflow with
+all the tracing gunk enabled. Raise the exception stacks to 2 pages,
+which is still half the interrupt stacks, which are at 4 pages.
+
+Reported-by: Michael Wang <yun.wang@linux.alibaba.com>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Link: https://lkml.kernel.org/r/YUIO9Ye98S5Eb68w@hirez.programming.kicks-ass.net
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/include/asm/page_64_types.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h
+index 288b065955b72..9d0b479452720 100644
+--- a/arch/x86/include/asm/page_64_types.h
++++ b/arch/x86/include/asm/page_64_types.h
+@@ -15,7 +15,7 @@
+ #define THREAD_SIZE_ORDER     (2 + KASAN_STACK_ORDER)
+ #define THREAD_SIZE  (PAGE_SIZE << THREAD_SIZE_ORDER)
+-#define EXCEPTION_STACK_ORDER (0 + KASAN_STACK_ORDER)
++#define EXCEPTION_STACK_ORDER (1 + KASAN_STACK_ORDER)
+ #define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
+ #define IRQ_STACK_ORDER (2 + KASAN_STACK_ORDER)
+-- 
+2.33.0
+
diff --git a/queue-5.4/xen-pciback-fix-return-in-pm_ctrl_init.patch b/queue-5.4/xen-pciback-fix-return-in-pm_ctrl_init.patch
new file mode 100644 (file)
index 0000000..e8c905f
--- /dev/null
@@ -0,0 +1,40 @@
+From 54858c6f61b25354105049fdde2a86c199c1d178 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 8 Oct 2021 15:44:17 +0800
+Subject: xen-pciback: Fix return in pm_ctrl_init()
+
+From: YueHaibing <yuehaibing@huawei.com>
+
+[ Upstream commit 4745ea2628bb43a7ec34b71763b5a56407b33990 ]
+
+Return NULL instead of passing to ERR_PTR while err is zero,
+this fix smatch warnings:
+drivers/xen/xen-pciback/conf_space_capability.c:163
+ pm_ctrl_init() warn: passing zero to 'ERR_PTR'
+
+Fixes: a92336a1176b ("xen/pciback: Drop two backends, squash and cleanup some code.")
+Signed-off-by: YueHaibing <yuehaibing@huawei.com>
+Reviewed-by: Juergen Gross <jgross@suse.com>
+Link: https://lore.kernel.org/r/20211008074417.8260-1-yuehaibing@huawei.com
+Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/xen/xen-pciback/conf_space_capability.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/xen/xen-pciback/conf_space_capability.c b/drivers/xen/xen-pciback/conf_space_capability.c
+index e5694133ebe57..42f0f64fcba47 100644
+--- a/drivers/xen/xen-pciback/conf_space_capability.c
++++ b/drivers/xen/xen-pciback/conf_space_capability.c
+@@ -160,7 +160,7 @@ static void *pm_ctrl_init(struct pci_dev *dev, int offset)
+       }
+ out:
+-      return ERR_PTR(err);
++      return err ? ERR_PTR(err) : NULL;
+ }
+ static const struct config_field caplist_pm[] = {
+-- 
+2.33.0
+
diff --git a/queue-5.4/zram-off-by-one-in-read_block_state.patch b/queue-5.4/zram-off-by-one-in-read_block_state.patch
new file mode 100644 (file)
index 0000000..d74dedf
--- /dev/null
@@ -0,0 +1,44 @@
+From aa8b82c64d4e5f582696e257a3f099382228fbf2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 5 Nov 2021 13:45:12 -0700
+Subject: zram: off by one in read_block_state()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit a88e03cf3d190cf46bc4063a9b7efe87590de5f4 ]
+
+snprintf() returns the number of bytes it would have printed if there
+were space.  But it does not count the NUL terminator.  So that means
+that if "count == copied" then this has already overflowed by one
+character.
+
+This bug likely isn't super harmful in real life.
+
+Link: https://lkml.kernel.org/r/20210916130404.GA25094@kili
+Fixes: c0265342bff4 ("zram: introduce zram memory tracking")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Cc: Minchan Kim <minchan@kernel.org>
+Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/block/zram/zram_drv.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
+index 719c6b7741afa..1cc9b67e9bcaa 100644
+--- a/drivers/block/zram/zram_drv.c
++++ b/drivers/block/zram/zram_drv.c
+@@ -901,7 +901,7 @@ static ssize_t read_block_state(struct file *file, char __user *buf,
+                       zram_test_flag(zram, index, ZRAM_HUGE) ? 'h' : '.',
+                       zram_test_flag(zram, index, ZRAM_IDLE) ? 'i' : '.');
+-              if (count < copied) {
++              if (count <= copied) {
+                       zram_slot_unlock(zram, index);
+                       break;
+               }
+-- 
+2.33.0
+