5.10.61-rc1 review
Subsystems (3)
Sasha Levin
maintainercover 5.10.61-rc1 review
This is the start of the stable review cycle for the 5.10.61 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu 26 Aug 2021 04:58:25 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.10.y&id2=v5.10.60
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.
Thanks,
Sasha
-------------
Pseudo-Shortlog of commits:
Adrian Larumbe (1):
dmaengine: xilinx_dma: Fix read-after-free bug when terminating
transfers
Alan Stern (2):
USB: core: Avoid WARNings for 0-length descriptor requests
USB: core: Fix incorrect pipe calculation in do_proc_control()
Andreas Persson (1):
mtd: cfi_cmdset_0002: fix crash when erasing/writing AMD cards
Andy Shevchenko (1):
ptp_pch: Restore dependency on PCI
Arkadiusz Kubalewski (1):
i40e: Fix ATR queue selection
Bing Guo (1):
drm/amd/display: Fix Dynamic bpp issue with 8K30 with Navi 1X
Bjorn Andersson (1):
clk: qcom: gdsc: Ensure regulator init state matches GDSC state
Christophe Kerello (1):
mmc: mmci: stm32: Check when the voltage switch procedure should be
done
Dan Carpenter (1):
media: zr364xx: fix memory leaks in probe()
Dave Gerlach (1):
ARM: dts: am43x-epos-evm: Reduce i2c0 bus speed for tps65218
Dinghao Liu (1):
net: qlcnic: add missed unlock in qlcnic_83xx_flash_read32
Dong Aisheng (1):
clk: imx6q: fix uart earlycon unwork
Dongliang Mu (2):
ipack: tpci200: fix many double free issues in tpci200_pci_probe
ipack: tpci200: fix memory leak in the tpci200_register
Eli Cohen (1):
vdpa/mlx5: Avoid destroying MR on empty iotlb
Evgeny Novikov (1):
media: zr364xx: propagate errors from zr364xx_start_readpipe()
Frank Wunderlich (1):
iommu: Check if group is NULL before remove device
Harshvardhan Jha (2):
net: xfrm: Fix end of loop tests for list_for_each_entry
scsi: megaraid_mm: Fix end of loop tests for list_for_each_entry()
Hayes Wang (1):
r8152: fix writing USB_BP2_EN
Ido Schimmel (1):
Revert "flow_offload: action should not be NULL when it is referenced"
Igor Pylypiv (1):
scsi: pm80xx: Fix TMF task completion race condition
Ilya Leoshkevich (1):
bpf: Clear zext_dst of dead insns
Ivan T. Ivanov (1):
net: usb: lan78xx: don't modify phy_device state concurrently
Jakub Kicinski (4):
bnxt: don't lock the tx queue from napi poll
bnxt: disable napi before canceling DIM
bnxt: make sure xmit_more + errors does not miss doorbells
bnxt: count Tx drops
Jaroslav Kysela (1):
ALSA: hda - fix the 'Capture Switch' value change notifications
Jason Wang (1):
virtio-net: use NETIF_F_GRO_HW instead of NETIF_F_LRO
Jeff Layton (1):
fs: warn about impending deprecation of mandatory locks
Jens Axboe (2):
io_uring: fix xa_alloc_cycle() error return value check
io_uring: only assign io_uring_enter() SQPOLL error in actual error
case
Johannes Weiner (1):
mm: memcontrol: fix occasional OOMs due to proportional memory.low
reclaim
Jouni Malinen (5):
ath: Use safer key clearing with key cache entries
ath9k: Clear key cache explicitly on disabling hardware
ath: Export ath_hw_keysetmac()
ath: Modify ath_key_delete() to not need full key entry
ath9k: Postpone key cache entry deletion for TXQ frames reference it
Kai-Heng Feng (1):
ALSA: hda/realtek: Limit mic boost on HP ProBook 445 G8
Kristin Paget (1):
ALSA: hda/realtek: Enable 4-speaker output for Dell XPS 15 9510 laptop
Lahav Schlesinger (1):
vrf: Reset skb conntrack connection on VRF rcv
Linus Torvalds (1):
pipe: avoid unnecessary EPOLLET wakeups under normal loads
Liu Yi L (1):
iommu/vt-d: Fix incomplete cache flush in
intel_pasid_tear_down_entry()
Lu Baolu (1):
iommu/vt-d: Consolidate duplicate cache invaliation code
Marcin Bachry (1):
PCI: Increase D3 delay for AMD Renoir/Cezanne XHCI
Marek Behún (1):
cpufreq: armada-37xx: forbid cpufreq for 1.2 GHz variant
Michael Chan (2):
bnxt_en: Disable aRFS if running on 212 firmware
bnxt_en: Add missing DMA memory barriers
NeilBrown (1):
btrfs: prevent rename2 from exchanging a subvol with a directory from
different parents
Nicolas Saenz Julienne (2):
mmc: sdhci-iproc: Cap min clock frequency on BCM2711
mmc: sdhci-iproc: Set SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN on BCM2711
Niklas Schnelle (1):
s390/pci: fix use after free of zpci_dev
Ole Bjørn Midtbø (1):
Bluetooth: hidp: use correct wait queue when removing ctrl_wait
Parav Pandit (3):
vdpa: Extend routine to accept vdpa device name
vdpa: Define vdpa mgmt device, ops and a netlink interface
virtio: Protect vqs list access
Pavel Skripkin (2):
media: drivers/media/usb: fix memory leak in zr364xx_probe
net: 6pack: fix slab-out-of-bounds in decode_data
Peter Ujfalusi (1):
dmaengine: of-dma: router_xlate to return -EPROBE_DEFER if controller
is not yet available
Petko Manolov (1):
net: usb: pegasus: Check the return value of get_geristers() and
friends;
Petr Vorel (1):
arm64: dts: qcom: msm8992-bullhead: Remove PSCI
Prabhakar Kushwaha (1):
qede: fix crash in rmmod qede while automatic debug collection
Qingqing Zhuo (1):
drm/amd/display: workaround for hard hang on HPD on native DP
Randy Dunlap (1):
dccp: add do-while-0 stubs for dccp_pr_debug macros
Saravana Kannan (2):
net: mdio-mux: Don't ignore memory allocation errors
net: mdio-mux: Handle -EPROBE_DEFER correctly
Sasha Levin (1):
Linux 5.10.61-rc1
Shaik Sajida Bhanu (1):
mmc: sdhci-msm: Update the software timeout value for sdhc
Sreekanth Reddy (1):
scsi: core: Avoid printing an error if target_alloc() returns -ENXIO
Srinivas Kandagatla (4):
arm64: dts: qcom: c630: fix correct powerdown pin for WSA881x
slimbus: messaging: start transaction ids from 1 instead of zero
slimbus: messaging: check for valid transaction id
slimbus: ngd: reset dma setup during runtime pm
Steven Rostedt (VMware) (1):
tracing / histogram: Fix NULL pointer dereference on strcmp() on NULL
event name
Sudeep Holla (1):
ARM: dts: nomadik: Fix up interrupt controller node names
Sylwester Dziedziuch (1):
iavf: Fix ping is lost after untrusted VF had tried to change MAC
Takashi Iwai (2):
ALSA: hda/via: Apply runtime PM workaround for ASUS B23E
ASoC: intel: atom: Fix breakage for PCM buffer address setup
Toke Høiland-Jørgensen (1):
sch_cake: fix srchost/dsthost hashing mode
Tony Lindgren (1):
bus: ti-sysc: Fix error handling for sysc_check_active_timer()
Uwe Kleine-König (1):
spi: spi-mux: Add module info needed for autoloading
Vincent Whitchurch (1):
mmc: dw_mmc: Fix hang on data CRC error
Wang Hai (1):
ixgbe, xsk: clean up the resources in ixgbe_xsk_pool_enable error path
Wanpeng Li (1):
KVM: X86: Fix warning caused by stale emulation context
Wei Huang (1):
KVM: x86: Factor out x86 instruction emulation with decoding
Xie Yongji (2):
vhost-vdpa: Fix integer overflow in vhost_vdpa_process_iotlb_update()
vhost: Fix the calculation in vhost_overflow()
Xuan Zhuo (1):
virtio-net: support XDP when not more queues
Ye Bin (1):
scsi: scsi_dh_rdac: Avoid crash during rdac_bus_attach()
Yifan Zhang (1):
drm/amdgpu: fix the doorbell missing when in CGPG issue for renoir.
Yongqiang Niu (2):
soc / drm: mediatek: Move DDP component defines into mtk-mmsys.h drm/mediatek: Fix aal size config
Yu Kuai (1):
dmaengine: usb-dmac: Fix PM reference leak in usb_dmac_probe()
jason-jh.lin (1):
drm/mediatek: Add AAL output size configuration
kaixi.fan (1):
ovs: clear skb->tstamp in forwarding path
lijinlin (1):
scsi: core: Fix capacity set to zero after offlinining device
Makefile | 4 +- arch/arm/boot/dts/am43x-epos-evm.dts | 2 +- arch/arm/boot/dts/ste-nomadik-stn8815.dtsi | 4 +- .../dts/qcom/msm8992-bullhead-rev-101.dts | 4 + .../boot/dts/qcom/sdm850-lenovo-yoga-c630.dts | 4 +- arch/s390/pci/pci.c | 6 + arch/s390/pci/pci_bus.h | 5 + arch/x86/kvm/x86.c | 62 +++-- arch/x86/kvm/x86.h | 2 + drivers/bus/ti-sysc.c | 4 +- drivers/clk/imx/clk-imx6q.c | 2 +- drivers/clk/qcom/gdsc.c | 54 ++-- drivers/cpufreq/armada-37xx-cpufreq.c | 6 +- drivers/dma/of-dma.c | 9 +- drivers/dma/sh/usb-dmac.c | 2 +- drivers/dma/xilinx/xilinx_dma.c | 12 + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 21 +- .../amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c | 4 +- .../gpu/drm/amd/display/dc/dcn20/dcn20_optc.c | 2 +- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 4 +- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 34 +-- drivers/iommu/intel/pasid.c | 26 +- drivers/iommu/intel/pasid.h | 6 + drivers/iommu/intel/svm.c | 55 +--- drivers/iommu/iommu.c | 3 + drivers/ipack/carriers/tpci200.c | 60 +++-- drivers/media/usb/zr364xx/zr364xx.c | 77 ++++-- drivers/mmc/host/dw_mmc.c | 6 +- drivers/mmc/host/mmci_stm32_sdmmc.c | 7 +- drivers/mmc/host/sdhci-iproc.c | 21 +- drivers/mmc/host/sdhci-msm.c | 18 ++ drivers/mtd/chips/cfi_cmdset_0002.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 113 +++++--- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + drivers/net/ethernet/intel/i40e/i40e_txrx.c | 3 +- drivers/net/ethernet/intel/iavf/iavf.h | 1 + drivers/net/ethernet/intel/iavf/iavf_main.c | 1 + .../net/ethernet/intel/iavf/iavf_virtchnl.c | 47 +++- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 5 +- drivers/net/ethernet/qlogic/qede/qede.h | 1 + drivers/net/ethernet/qlogic/qede/qede_main.c | 8 + .../ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 4 +- drivers/net/hamradio/6pack.c | 6 + drivers/net/mdio/mdio-mux.c | 36 ++- drivers/net/usb/lan78xx.c | 16 +- drivers/net/usb/pegasus.c | 108 +++++--- drivers/net/usb/r8152.c | 2 +- drivers/net/virtio_net.c | 76 ++++-- drivers/net/vrf.c | 4 + drivers/net/wireless/ath/ath.h | 3 +- drivers/net/wireless/ath/ath5k/mac80211-ops.c | 2 +- drivers/net/wireless/ath/ath9k/htc_drv_main.c | 2 +- drivers/net/wireless/ath/ath9k/hw.h | 1 + drivers/net/wireless/ath/ath9k/main.c | 95 ++++++- drivers/net/wireless/ath/key.c | 41 +-- drivers/pci/quirks.c | 1 + drivers/ptp/Kconfig | 3 +- drivers/scsi/device_handler/scsi_dh_rdac.c | 4 +- drivers/scsi/megaraid/megaraid_mm.c | 21 +- drivers/scsi/pm8001/pm8001_sas.c | 32 ++- drivers/scsi/scsi_scan.c | 3 +- drivers/scsi/scsi_sysfs.c | 9 +- drivers/slimbus/messaging.c | 7 +- drivers/slimbus/qcom-ngd-ctrl.c | 5 +- drivers/soc/mediatek/mtk-mmsys.c | 4 +- drivers/spi/spi-mux.c | 8 + drivers/usb/core/devio.c | 2 +- drivers/usb/core/message.c | 6 + drivers/vdpa/Kconfig | 1 + drivers/vdpa/ifcvf/ifcvf_main.c | 2 +- drivers/vdpa/mlx5/core/mr.c | 9 - drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +- drivers/vdpa/vdpa.c | 249 +++++++++++++++++- drivers/vdpa/vdpa_sim/vdpa_sim.c | 2 +- drivers/vhost/vdpa.c | 3 +- drivers/vhost/vhost.c | 10 +- drivers/virtio/virtio.c | 1 + drivers/virtio/virtio_ring.c | 8 + fs/btrfs/inode.c | 10 +- fs/io_uring.c | 16 +- fs/namespace.c | 6 +- fs/pipe.c | 15 +- include/linux/memcontrol.h | 29 +- include/linux/pipe_fs_i.h | 2 + include/linux/soc/mediatek/mtk-mmsys.h | 33 +++ include/linux/vdpa.h | 38 ++- include/linux/virtio.h | 1 + include/net/flow_offload.h | 12 +- include/uapi/linux/vdpa.h | 31 +++ kernel/bpf/verifier.c | 1 + kernel/trace/trace_events_hist.c | 2 + mm/vmscan.c | 27 +- net/bluetooth/hidp/core.c | 2 +- net/dccp/dccp.h | 6 +- net/openvswitch/vport.c | 1 + net/sched/sch_cake.c | 2 +- net/xfrm/xfrm_ipcomp.c | 2 +- sound/pci/hda/hda_generic.c | 10 +- sound/pci/hda/patch_realtek.c | 12 +- sound/pci/hda/patch_via.c | 1 + sound/soc/intel/atom/sst-mfld-platform-pcm.c | 2 +- 101 files changed, 1290 insertions(+), 467 deletions(-) create mode 100644 include/uapi/linux/vdpa.h
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 1/98 ath: Use safer key clearing with key cache entries
From: Jouni Malinen <[email protected]>
commit 56c5485c9e444c2e85e11694b6c44f1338fc20fd upstream.
It is possible for there to be pending frames in TXQs with a reference to the key cache entry that is being deleted. If such a key cache entry is cleared, those pending frame in TXQ might get transmitted without proper encryption. It is safer to leave the previously used key into the key cache in such cases. Instead, only clear the MAC address to prevent RX processing from using this key cache entry.
This is needed in particularly in AP mode where the TXQs cannot be flushed on station disconnection. This change alone may not be able to address all cases where the key cache entry might get reused for other purposes immediately (the key cache entry should be released for reuse only once the TXQs do not have any remaining references to them), but this makes it less likely to get unprotected frames and the more complete changes may end up being significantly more complex.
--- drivers/net/wireless/ath/key.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/key.c +10 -1
@@ -583,7 +583,16 @@ EXPORT_SYMBOL(ath_key_config);*/ void ath_key_delete (struct ath_common *common,struct ieee80211_key_conf *key) { -ath_hw_keyreset (common, key->hw_key_idx); +/* Leave CCMP and TKIP (main key) configured to avoid disabling +* encryption for potentially pending frames already in a TXQ with the +* keyix pointing to this key entry. Instead, only clear the MAC address +* to prevent RX processing from using this key cache entry. +*/ +if (test_bit (key->hw_key_idx, common->ccmp_keymap) || +test_bit (key->hw_key_idx, common->tkip_keymap)) +ath_hw_keysetmac (common, key->hw_key_idx,NULL ); +else +ath_hw_keyreset (common, key->hw_key_idx);if (key->hw_key_idx <IEEE80211_WEP_NKID )return ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 2/98 ath9k: Clear key cache explicitly on disabling hardware
In reply to Sasha LevinFrom: Jouni Malinen <[email protected]>
commit 73488cb2fa3bb1ef9f6cf0d757f76958bd4deaca upstream.
Now that ath/key.c may not be explicitly clearing keys from the key cache, clear all key cache entries when disabling hardware to make sure no keys are left behind beyond this point.
--- drivers/net/wireless/ath/ath9k/main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/ath/ath9k/main.c +5 -0
@@ -899,6 +899,11 @@ static void ath9k_stop(struct ieee80211_hw *hw)spin_unlock_bh (&sc->sc_pcu_lock); +/* Clear key cache entries explicitly to get rid of any potentially +* remaining keys. +*/ +ath9k_cmn_init_crypto (sc->sc_ah); +ath9k_ps_restore (sc); sc->ps_idle = prev_idle;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 3/98 ath: Export ath_hw_keysetmac()
In reply to Sasha LevinFrom: Jouni Malinen <[email protected]>
commit d2d3e36498dd8e0c83ea99861fac5cf9e8671226 upstream.
ath9k is going to use this for safer management of key cache entries.
--- drivers/net/wireless/ath/ath.h | 1 + drivers/net/wireless/ath/key.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath.h +1 -0
@@ -203,6 +203,7 @@ int ath_key_config(struct ath_common *common,struct ieee80211_sta *sta, struct ieee80211_key_conf *key);bool ath_hw_keyreset (struct ath_common *common,u16 entry); +bool ath_hw_keysetmac (struct ath_common *common,u16 entry,const u8 *mac);void ath_hw_cycle_counters_update (struct ath_common *common);int32_t ath_hw_get_listen_time (struct ath_common *common);
drivers/net/wireless/ath/key.c +2 -2
@@ -84,8 +84,7 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry) }EXPORT_SYMBOL (ath_hw_keyreset); -static bool ath_hw_keysetmac (struct ath_common *common, -u16 entry,const u8 *mac) +bool ath_hw_keysetmac (struct ath_common *common,u16 entry,const u8 *mac) {u32 macHi, macLo;u32 unicast_flag =AR_KEYTABLE_VALID ;
@@ -125,6 +124,7 @@ static bool ath_hw_keysetmac(struct ath_common *common,return true; } +EXPORT_SYMBOL (ath_hw_keysetmac); static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry, const struct ath_keyval *k,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 4/98 ath: Modify ath_key_delete() to not need full key entry
In reply to Sasha LevinFrom: Jouni Malinen <[email protected]>
commit 144cd24dbc36650a51f7fe3bf1424a1432f1f480 upstream.
tkip_keymap can be used internally to avoid the reference to key->cipher and with this, only the key index value itself is needed. This allows ath_key_delete() call to be postponed to be handled after the upper layer STA and key entry have already been removed. This is needed to make ath9k key cache management safer.
--- drivers/net/wireless/ath/ath.h | 2 +- drivers/net/wireless/ath/ath5k/mac80211-ops.c | 2 +- drivers/net/wireless/ath/ath9k/htc_drv_main.c | 2 +- drivers/net/wireless/ath/ath9k/main.c | 5 ++- drivers/net/wireless/ath/key.c | 34 +++++++++---------- 5 files changed, 22 insertions(+), 23 deletions(-)
drivers/net/wireless/ath/ath.h +1 -1
@@ -197,7 +197,7 @@ struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,bool ath_is_mybeacon (struct ath_common *common,struct ieee80211_hdr *hdr);void ath_hw_setbssidmask (struct ath_common *common); -void ath_key_delete (struct ath_common *common,struct ieee80211_key_conf *key); +void ath_key_delete (struct ath_common *common,u8 hw_key_idx); int ath_key_config(struct ath_common *common, struct ieee80211_vif *vif, struct ieee80211_sta *sta,
drivers/net/wireless/ath/ath5k/mac80211-ops.c +1 -1
@@ -521,7 +521,7 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, }break ;case DISABLE_KEY : -ath_key_delete (common, key); +ath_key_delete (common, key->hw_key_idx);break ;default : ret = -EINVAL ;
drivers/net/wireless/ath/ath9k/htc_drv_main.c +1 -1
@@ -1461,7 +1461,7 @@ static int ath9k_htc_set_key(struct ieee80211_hw *hw, }break ;case DISABLE_KEY : -ath_key_delete (common, key); +ath_key_delete (common, key->hw_key_idx);break ;default : ret = -EINVAL ;
drivers/net/wireless/ath/ath9k/main.c +2 -3
@@ -1553,12 +1553,11 @@ static void ath9k_del_ps_key(struct ath_softc *sc, {struct ath_common *common =ath9k_hw_common (sc->sc_ah);struct ath_node *an = (struct ath_node *) sta->drv_priv; -struct ieee80211_key_conf ps_key = { .hw_key_idx = an->ps_key };if (!an->ps_key)return ; -ath_key_delete (common, &ps_key); +ath_key_delete (common, an->ps_key); an->ps_key =0 ; an->key_idx[0 ] =0 ; }
@@ -1758,7 +1757,7 @@ static int ath9k_set_key(struct ieee80211_hw *hw, }break ;case DISABLE_KEY : -ath_key_delete (common, key); +ath_key_delete (common, key->hw_key_idx);if (an) {for (i =0 ; i <ARRAY_SIZE (an->key_idx); i++) {if (an->key_idx[i] != key->hw_key_idx)
drivers/net/wireless/ath/key.c +17 -17
@@ -581,38 +581,38 @@ EXPORT_SYMBOL(ath_key_config);/* * Delete Key. */ -void ath_key_delete (struct ath_common *common,struct ieee80211_key_conf *key) +void ath_key_delete (struct ath_common *common,u8 hw_key_idx) {/* Leave CCMP and TKIP (main key) configured to avoid disabling * encryption for potentially pending frames already in a TXQ with the * keyix pointing to this key entry. Instead, only clear the MAC address * to prevent RX processing from using this key cache entry. */ -if (test_bit (key->hw_key_idx, common->ccmp_keymap) || -test_bit (key->hw_key_idx, common->tkip_keymap)) -ath_hw_keysetmac (common, key->hw_key_idx,NULL ); +if (test_bit (hw_key_idx, common->ccmp_keymap) || +test_bit (hw_key_idx, common->tkip_keymap)) +ath_hw_keysetmac (common, hw_key_idx,NULL );else -ath_hw_keyreset (common, key->hw_key_idx); -if (key->hw_key_idx <IEEE80211_WEP_NKID ) +ath_hw_keyreset (common, hw_key_idx); +if (hw_key_idx <IEEE80211_WEP_NKID )return ; -clear_bit (key->hw_key_idx, common->keymap); -clear_bit (key->hw_key_idx, common->ccmp_keymap); -if (key->cipher !=WLAN_CIPHER_SUITE_TKIP ) +clear_bit (hw_key_idx, common->keymap); +clear_bit (hw_key_idx, common->ccmp_keymap); +if (!test_bit (hw_key_idx, common->tkip_keymap))return ; -clear_bit (key->hw_key_idx +64 , common->keymap); +clear_bit (hw_key_idx +64 , common->keymap); -clear_bit (key->hw_key_idx, common->tkip_keymap); -clear_bit (key->hw_key_idx +64 , common->tkip_keymap); +clear_bit (hw_key_idx, common->tkip_keymap); +clear_bit (hw_key_idx +64 , common->tkip_keymap);if (!(common->crypt_caps &ATH_CRYPT_CAP_MIC_COMBINED )) { -ath_hw_keyreset (common, key->hw_key_idx +32 ); -clear_bit (key->hw_key_idx +32 , common->keymap); -clear_bit (key->hw_key_idx +64 +32 , common->keymap); +ath_hw_keyreset (common, hw_key_idx +32 ); +clear_bit (hw_key_idx +32 , common->keymap); +clear_bit (hw_key_idx +64 +32 , common->keymap); -clear_bit (key->hw_key_idx +32 , common->tkip_keymap); -clear_bit (key->hw_key_idx +64 +32 , common->tkip_keymap); +clear_bit (hw_key_idx +32 , common->tkip_keymap); +clear_bit (hw_key_idx +64 +32 , common->tkip_keymap); } }EXPORT_SYMBOL (ath_key_delete);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 5/98 ath9k: Postpone key cache entry deletion for TXQ frames reference it
In reply to Sasha LevinFrom: Jouni Malinen <[email protected]>
commit ca2848022c12789685d3fab3227df02b863f9696 upstream.
Do not delete a key cache entry that is still being referenced by pending frames in TXQs. This avoids reuse of the key cache entry while a frame might still be transmitted using it.
To avoid having to do any additional operations during the main TX path operations, track pending key cache entries in a new bitmap and check whether any pending entries can be deleted before every new key add/remove operation. Also clear any remaining entries when stopping the interface.
--- drivers/net/wireless/ath/ath9k/hw.h | 1 + drivers/net/wireless/ath/ath9k/main.c | 87 ++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/hw.h +1 -0
@@ -820,6 +820,7 @@ struct ath_hw {struct ath9k_pacal_info pacal_info;struct ar5416Stats stats;struct ath9k_tx_queue_info txq[ATH9K_NUM_TX_QUEUES ]; +DECLARE_BITMAP (pending_del_keymap,ATH_KEYMAX );enum ath9k_int imask;u32 imrs2_reg;
drivers/net/wireless/ath/ath9k/main.c +86 -1
117 lines not on this page · raw message
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 6/98 mtd: cfi_cmdset_0002: fix crash when erasing/writing AMD cards
In reply to Sasha LevinFrom: Andreas Persson <[email protected]>
commit 2394e628738933aa014093d93093030f6232946d upstream.
Erasing an AMD linear flash card (AM29F016D) crashes after the first sector has been erased. Likewise, writing to it crashes after two bytes have been written. The reason is a missing check for a null pointer - the cmdset_priv field is not set for this type of card.
--- drivers/mtd/chips/cfi_cmdset_0002.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/chips/cfi_cmdset_0002.c +1 -1
@@ -119,7 +119,7 @@ static int cfi_use_status_reg(struct cfi_private *cfi)struct cfi_pri_amdstd *extp = cfi->cmdset_priv;u8 poll_mask =CFI_POLL_STATUS_REG |CFI_POLL_DQ ; -return extp->MinorVersion >='5' && +return extp && extp->MinorVersion >='5' && (extp->SoftwareFeatures & poll_mask) ==CFI_POLL_STATUS_REG ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 7/98 media: zr364xx: propagate errors from zr364xx_start_readpipe()
In reply to Sasha LevinFrom: Evgeny Novikov <[email protected]>
[ Upstream commit af0321a5be3e5647441eb6b79355beaa592df97a ]
zr364xx_start_readpipe() can fail but callers do not care about that. This can result in various negative consequences. The patch adds missed error handling.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/media/usb/zr364xx/zr364xx.c | 31 ++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-)
drivers/media/usb/zr364xx/zr364xx.c +24 -7
@@ -1328,6 +1328,7 @@ static int zr364xx_board_init(struct zr364xx_camera *cam) {struct zr364xx_pipeinfo *pipe = cam->pipe;unsigned long i; +int err;DBG ("board init: %p\n" , cam);memset (pipe,0 ,sizeof (*pipe));
@@ -1360,9 +1361,8 @@ static int zr364xx_board_init(struct zr364xx_camera *cam)if (i ==0 ) { printk(KERN_INFO KBUILD_MODNAME ": out of memory. Aborting\n"); -kfree (cam->pipe->transfer_buffer); - cam->pipe->transfer_buffer =NULL ; -return -ENOMEM ; + err = -ENOMEM ; + goto err_free; }else cam->buffer.dwFrames = i;
@@ -1377,9 +1377,17 @@ static int zr364xx_board_init(struct zr364xx_camera *cam)/*** end create system buffers ***/ /* start read pipe */ -zr364xx_start_readpipe (cam); + err =zr364xx_start_readpipe (cam); +if (err) + goto err_free; +DBG (": board initialized\n" );return 0 ; + +err_free: +kfree (cam->pipe->transfer_buffer); + cam->pipe->transfer_buffer =NULL ; +return err; } static int zr364xx_probe(struct usb_interface *intf,
@@ -1576,10 +1584,19 @@ static int zr364xx_resume(struct usb_interface *intf)if (!cam->was_streaming)return 0 ; -zr364xx_start_readpipe (cam); + res =zr364xx_start_readpipe (cam); +if (res) +return res; + res =zr364xx_prepare (cam); -if (!res) -zr364xx_start_acquire (cam); +if (res) + goto err_prepare; + +zr364xx_start_acquire (cam); +return 0 ; + +err_prepare: +zr364xx_stop_readpipe (cam); return res; }#endif
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 8/98 media: zr364xx: fix memory leaks in probe()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit ea354b6ddd6f09be29424f41fa75a3e637fea234 ]
Syzbot discovered that the probe error handling doesn't clean up the resources allocated in zr364xx_board_init(). There are several related bugs in this code so I have re-written the error handling.
1) Introduce a new function zr364xx_board_uninit() which cleans up the resources in zr364xx_board_init().
2) In zr364xx_board_init() if the call to zr364xx_start_readpipe() fails then release the "cam->buffer.frame[i].lpvbits" memory before returning. This way every function either allocates everything successfully or it cleans up after itself.
3) Re-write the probe function so that each failure path goto frees the most recent allocation. That way we don't free anything before it has been allocated and we can also verify that everything is freed.
4) Originally, in the probe function the "cam->v4l2_dev.release" pointer was set to "zr364xx_release" near the start but I moved that assignment to the end, after everything had succeeded. The release function was never actually called during the probe cleanup process, but with this change I wanted to make it clear that we don't want to call zr364xx_release() until everything is allocated successfully.
Next I re-wrote the zr364xx_release() function. Ideally this would have been a simple matter of copy and pasting the cleanup code from probe and adding an additional call to video_unregister_device(). But there are a couple quirks to note.
1) The probe function does not call videobuf_mmap_free() and I don't know where the videobuf_mmap is allocated. I left the code as-is to avoid introducing a bug in code I don't understand.
2) The zr364xx_board_uninit() has a call to zr364xx_stop_readpipe() which is a change from the original behavior with regards to unloading the driver. Calling zr364xx_stop_readpipe() on a stopped pipe is not a problem so this is safe and is potentially a bugfix.
--- drivers/media/usb/zr364xx/zr364xx.c | 49 ++++++++++++++++++----------- 1 file changed, 31 insertions(+), 18 deletions(-)
drivers/media/usb/zr364xx/zr364xx.c +31 -18
@@ -1184,15 +1184,11 @@ out:return err; } -static void zr364xx_release (struct v4l2_device *v4l2_dev) +static void zr364xx_board_uninit (struct zr364xx_camera *cam) { -struct zr364xx_camera *cam = - container_of(v4l2_dev, struct zr364xx_camera, v4l2_dev);unsigned long i; -v4l2_device_unregister (&cam->v4l2_dev); - -videobuf_mmap_free (&cam->vb_vidq); +zr364xx_stop_readpipe (cam);/* release sys buffers */ for (i =0 ; i <FRAMES ; i++) {
@@ -1203,9 +1199,19 @@ static void zr364xx_release(struct v4l2_device *v4l2_dev) cam->buffer.frame[i].lpvbits =NULL ; } -v4l2_ctrl_handler_free (&cam->ctrl_handler);/* release transfer buffer */ kfree (cam->pipe->transfer_buffer); +} + +static void zr364xx_release (struct v4l2_device *v4l2_dev) +{ +struct zr364xx_camera *cam = + container_of(v4l2_dev, struct zr364xx_camera, v4l2_dev); + +videobuf_mmap_free (&cam->vb_vidq); +v4l2_ctrl_handler_free (&cam->ctrl_handler); +zr364xx_board_uninit (cam); +v4l2_device_unregister (&cam->v4l2_dev);kfree (cam); }
@@ -1379,11 +1385,14 @@ static int zr364xx_board_init(struct zr364xx_camera *cam)/* start read pipe */ err =zr364xx_start_readpipe (cam);if (err) - goto err_free; + goto err_free_frames;DBG (": board initialized\n" );return 0 ; +err_free_frames: +for (i =0 ; i <FRAMES ; i++) +vfree (cam->buffer.frame[i].lpvbits); err_free:kfree (cam->pipe->transfer_buffer); cam->pipe->transfer_buffer =NULL ;
@@ -1412,12 +1421,10 @@ static int zr364xx_probe(struct usb_interface *intf,if (!cam)return -ENOMEM ; - cam->v4l2_dev.release = zr364xx_release; err =v4l2_device_register (&intf->dev, &cam->v4l2_dev);if (err <0 ) {dev_err (&udev->dev,"couldn't register v4l2_device\n" ); -kfree (cam); -return err; + goto free_cam; } hdl = &cam->ctrl_handler;v4l2_ctrl_handler_init (hdl,1 );
@@ -1426,7 +1433,7 @@ static int zr364xx_probe(struct usb_interface *intf,if (hdl->error) { err = hdl->error;dev_err (&udev->dev,"couldn't register control\n" ); - goto fail; + goto unregister; }/* save the init method used by this camera */ cam->method = id->driver_info;
@@ -1499,7 +1506,7 @@ static int zr364xx_probe(struct usb_interface *intf,if (!cam->read_endpoint) { err = -ENOMEM ;dev_err (&intf->dev,"Could not find bulk-in endpoint\n" ); - goto fail; + goto unregister; }/* v4l */
@@ -1510,10 +1517,11 @@ static int zr364xx_probe(struct usb_interface *intf,/* load zr364xx board specific */ err =zr364xx_board_init (cam); -if (!err) - err =v4l2_ctrl_handler_setup (hdl);if (err) - goto fail; + goto unregister; + err =v4l2_ctrl_handler_setup (hdl); +if (err) + goto board_uninit;spin_lock_init (&cam->slock);
@@ -1528,16 +1536,21 @@ static int zr364xx_probe(struct usb_interface *intf, err =video_register_device (&cam->vdev,VFL_TYPE_VIDEO ,-1 );if (err) {dev_err (&udev->dev,"video_register_device failed\n" ); - goto fail; + goto free_handler; } + cam->v4l2_dev.release = zr364xx_release;dev_info (&udev->dev,DRIVER_DESC " controlling device %s\n" ,video_device_node_name (&cam->vdev));return 0 ; -fail: +free_handler:v4l2_ctrl_handler_free (hdl); +board_uninit: +zr364xx_board_uninit (cam); +unregister:v4l2_device_unregister (&cam->v4l2_dev); +free_cam:kfree (cam);return err; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 9/98 vdpa: Extend routine to accept vdpa device name
In reply to Sasha LevinFrom: Parav Pandit <[email protected]>
[ Upstream commit fd70a406a344e084ac680c3f14e71d37d6023883 ]
In a subsequent patch, when user initiated command creates a vdpa device, the user chooses the name of the vdpa device.
To support it, extend the device allocation API to consider this name specified by the caller driver.
--- drivers/vdpa/ifcvf/ifcvf_main.c | 2 +- drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +- drivers/vdpa/vdpa.c | 36 +++++++++++++++++++++++++++---- drivers/vdpa/vdpa_sim/vdpa_sim.c | 2 +- include/linux/vdpa.h | 7 +++--- 5 files changed, 38 insertions(+), 11 deletions(-)
drivers/vdpa/ifcvf/ifcvf_main.c +1 -1
@@ -439,7 +439,7 @@ static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id) adapter = vdpa_alloc_device(struct ifcvf_adapter, vdpa, dev, &ifc_vdpa_ops, -IFCVF_MAX_QUEUE_PAIRS *2 ); +IFCVF_MAX_QUEUE_PAIRS *2 ,NULL );if (adapter ==NULL ) {IFCVF_ERR (pdev,"Failed to allocate vDPA structure" );return -ENOMEM ;
drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -1
@@ -1982,7 +1982,7 @@ void *mlx5_vdpa_add_dev(struct mlx5_core_dev *mdev) max_vqs =min_t (u32, max_vqs,MLX5_MAX_SUPPORTED_VQS ); ndev = vdpa_alloc_device(struct mlx5_vdpa_net, mvdev.vdev, mdev->device, &mlx5_vdpa_ops, -2 *mlx5_vdpa_max_qps (max_vqs)); +2 *mlx5_vdpa_max_qps (max_vqs),NULL );if (IS_ERR (ndev))return ndev;
drivers/vdpa/vdpa.c +32 -4
@@ -12,6 +12,8 @@#include <linux/slab.h> #include <linux/vdpa.h> +/* A global mutex that protects vdpa management device and device level operations. */ +static DEFINE_MUTEX (vdpa_dev_mutex);static DEFINE_IDA (vdpa_index_ida);static int vdpa_dev_probe (struct device *d)
@@ -63,6 +65,7 @@ static void vdpa_release_dev(struct device *d)* @config: the bus operations that is supported by this device * @nvqs: number of virtqueues supported by this device * @size: size of the parent structure that contains private data +* @name: name of the vdpa device; optional. * * Driver should use vdpa_alloc_device() wrapper macro instead of * using this directly.
@@ -72,8 +75,7 @@ static void vdpa_release_dev(struct device *d)*/ struct vdpa_device *__vdpa_alloc_device (struct device *parent,const struct vdpa_config_ops *config, -int nvqs, -size_t size) +int nvqs,size_t size,const char *name) {struct vdpa_device *vdev;int err = -EINVAL ;
@@ -101,7 +103,10 @@ struct vdpa_device *__vdpa_alloc_device(struct device *parent, vdev->features_valid = false; vdev->nvqs = nvqs; - err =dev_set_name (&vdev->dev,"vdpa%u" , vdev->index); +if (name) + err =dev_set_name (&vdev->dev,"%s" , name); +else + err =dev_set_name (&vdev->dev,"vdpa%u" , vdev->index);if (err) goto err_name;
@@ -118,6 +123,13 @@ err: }EXPORT_SYMBOL_GPL (__vdpa_alloc_device); +static int vdpa_name_match (struct device *dev,const void *data) +{ + struct vdpa_device *vdev = container_of(dev, struct vdpa_device, dev); + +return (strcmp (dev_name (&vdev->dev), data) ==0 ); +} +/** * vdpa_register_device - register a vDPA device * Callers must have a succeed call of vdpa_alloc_device() before.
@@ -127,7 +139,21 @@ EXPORT_SYMBOL_GPL(__vdpa_alloc_device);*/ int vdpa_register_device (struct vdpa_device *vdev) { -return device_add (&vdev->dev); +struct device *dev; +int err; + +mutex_lock (&vdpa_dev_mutex); + dev =bus_find_device (&vdpa_bus,NULL ,dev_name (&vdev->dev), vdpa_name_match); +if (dev) { +put_device (dev); + err = -EEXIST ; + goto name_err; + } + + err =device_add (&vdev->dev); +name_err: +mutex_unlock (&vdpa_dev_mutex); +return err; }EXPORT_SYMBOL_GPL (vdpa_register_device);
@@ -137,7 +163,9 @@ EXPORT_SYMBOL_GPL(vdpa_register_device);*/ void vdpa_unregister_device (struct vdpa_device *vdev) { +mutex_lock (&vdpa_dev_mutex);device_unregister (&vdev->dev); +mutex_unlock (&vdpa_dev_mutex); }EXPORT_SYMBOL_GPL (vdpa_unregister_device);
drivers/vdpa/vdpa_sim/vdpa_sim.c +1 -1
@@ -370,7 +370,7 @@ static struct vdpasim *vdpasim_create(struct vdpasim_dev_attr *dev_attr) ops = &vdpasim_net_config_ops; vdpasim = vdpa_alloc_device(struct vdpasim, vdpa, NULL, ops, - dev_attr->nvqs); + dev_attr->nvqs,NULL );if (!vdpasim) goto err_alloc;
include/linux/vdpa.h +3 -4
@@ -244,15 +244,14 @@ struct vdpa_config_ops {struct vdpa_device *__vdpa_alloc_device (struct device *parent,const struct vdpa_config_ops *config, -int nvqs, -size_t size); +int nvqs,size_t size,const char *name); -#define vdpa_alloc_device (dev_struct, member, parent, config, nvqs) \ +#define vdpa_alloc_device (dev_struct, member, parent, config, nvqs, name) \ container_of(__vdpa_alloc_device( \ parent, config, nvqs, \ sizeof(dev_struct) + \ BUILD_BUG_ON_ZERO(offsetof( \ - dev_struct, member))), \ + dev_struct, member)), name), \ dev_struct, member)int vdpa_register_device (struct vdpa_device *vdev);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 10/98 vdpa: Define vdpa mgmt device, ops and a netlink interface
In reply to Sasha LevinFrom: Parav Pandit <[email protected]>
[ Upstream commit 33b347503f014ebf76257327cbc7001c6b721956 ]
To add one or more VDPA devices, define a management device which allows adding or removing vdpa device. A management device defines set of callbacks to manage vdpa devices.
To begin with, it defines add and remove callbacks through which a user defined vdpa device can be added or removed.
A unique management device is identified by its unique handle identified by management device name and optionally the bus name.
Hence, introduce routine through which driver can register a management device and its callback operations for adding and remove a vdpa device.
Introduce vdpa netlink socket family so that user can query management device and its attributes.
Example of show vdpa management device which allows creating vdpa device of networking class (device id = 0x1) of virtio specification 1.1 section 5.1.1.
$ vdpa mgmtdev show
vdpasim_net:
supported_classes:
netExample of showing vdpa management device in JSON format.
$ vdpa mgmtdev show -jp
{
"show": {
"vdpasim_net": {
"supported_classes": [ "net" ]
}
}
}Including a bugfix:
vpda: correctly size vdpa_nl_policy
We need to ensure last entry of vdpa_nl_policy[] is zero, otherwise out-of-bounds access is hurting us.
--- drivers/vdpa/Kconfig | 1 + drivers/vdpa/vdpa.c | 213 +++++++++++++++++++++++++++++++++++++- include/linux/vdpa.h | 31 ++++++ include/uapi/linux/vdpa.h | 31 ++++++ 4 files changed, 275 insertions(+), 1 deletion(-) create mode 100644 include/uapi/linux/vdpa.h
drivers/vdpa/Kconfig +1 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only menuconfig VDPA tristate "vDPA drivers" + depends on NET help Enable this module to support vDPA device that uses a datapath which complies with virtio specifications with
drivers/vdpa/vdpa.c +212 -1
236 lines not on this page · raw message
include/linux/vdpa.h +31 -0
@@ -35,6 +35,8 @@ struct vdpa_vq_state {u16 avail_index; }; +struct vdpa_mgmt_dev ; +/** * vDPA device - representation of a vDPA device * @dev: underlying device
@@ -334,4 +336,33 @@ static inline void vdpa_get_config(struct vdpa_device *vdev, unsigned offset, ops->get_config(vdev, offset, buf, len); } +/** +* vdpa_mgmtdev_ops - vdpa device ops +* @dev_add: Add a vdpa device using alloc and register +* @mdev: parent device to use for device addition +* @name: name of the new vdpa device +* Driver need to add a new device using _vdpa_register_device() +* after fully initializing the vdpa device. Driver must return 0 +* on success or appropriate error code. +* @dev_del: Remove a vdpa device using unregister +* @mdev: parent device to use for device removal +* @dev: vdpa device to remove +* Driver need to remove the specified device by calling +* _vdpa_unregister_device(). +*/ +struct vdpa_mgmtdev_ops { +int (*dev_add)(struct vdpa_mgmt_dev *mdev,const char *name); +void (*dev_del)(struct vdpa_mgmt_dev *mdev,struct vdpa_device *dev); +}; + +struct vdpa_mgmt_dev { +struct device *device; +const struct vdpa_mgmtdev_ops *ops; +const struct virtio_device_id *id_table;/* supported ids */ +struct list_head list; +}; + +int vdpa_mgmtdev_register (struct vdpa_mgmt_dev *mdev); +void vdpa_mgmtdev_unregister (struct vdpa_mgmt_dev *mdev); +#endif /* _LINUX_VDPA_H */
include/uapi/linux/vdpa.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ +/* +* vdpa device management interface +* Copyright (c) 2020 Mellanox Technologies Ltd. All rights reserved. +*/ + +#ifndef _UAPI_LINUX_VDPA_H_ +#define _UAPI_LINUX_VDPA_H_ + +#define VDPA_GENL_NAME "vdpa" +#define VDPA_GENL_VERSION 0x1 + +enum vdpa_command { +VDPA_CMD_UNSPEC , +VDPA_CMD_MGMTDEV_NEW , +VDPA_CMD_MGMTDEV_GET ,/* can dump */ +}; + +enum vdpa_attr { +VDPA_ATTR_UNSPEC , + +/* bus name (optional) + dev name together make the parent device handle */ +VDPA_ATTR_MGMTDEV_BUS_NAME ,/* string */ +VDPA_ATTR_MGMTDEV_DEV_NAME ,/* string */ +VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES ,/* u64 */ + +/* new attributes must be added above here */ +VDPA_ATTR_MAX , +}; + +#endif
Signature · 1 line
2.30.2
Re: [PATCH 5.10 10/98] vdpa: Define vdpa mgmt device, ops and a netlink interface
Hi!
Quoted 10 lines
From: Parav Pandit <[email protected]>
[ Upstream commit
33b347503f014ebf76257327cbc7001c6b721956]To add one or more VDPA devices, define a management device which allows adding or removing vdpa device. A management device defines set of callbacks to manage vdpa devices.
To begin with, it defines add and remove callbacks through which a user defined vdpa device can be added or removed.
This looks quite intrusive; is it meant to be in -stable, or is it some kind of mistake?
Best regards,
Pavel
Quoted 29 lines
Signed-off-by Parav Pandit <[email protected]>Reviewed-by Eli Cohen <[email protected]>Reviewed-by Jason Wang <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>Including a bugfix:
vpda: correctly size
vdpa_nl_policyWe need to ensure last entry of vdpa_nl_policy[] is zero, otherwise out-of-bounds access is hurting us.
Signed-off-by Eric Dumazet <[email protected]>Reported-by syzbot <[email protected]>Cc Parav Pandit <[email protected]>Cc Eli Cohen <[email protected]>Cc Jason Wang <[email protected]>Cc Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/vdpa/Kconfig | 1 + drivers/vdpa/vdpa.c | 213 +++++++++++++++++++++++++++++++++++++- include/linux/vdpa.h | 31 ++++++ include/uapi/linux/vdpa.h | 31 ++++++ 4 files changed, 275 insertions(+), 1 deletion(-) create mode 100644 include/uapi/linux/vdpa.h
Signature · 1 line
http://www.livejournal.com/~pavelmachek
Sasha Levin
maintainerRe: [PATCH 5.10 10/98] vdpa: Define vdpa mgmt device, ops and a netlink interface
Quoted 10 lines · Pavel Machek
Hi!
Quoted 8 lines
From: Parav Pandit <[email protected]>
[ Upstream commit
33b347503f014ebf76257327cbc7001c6b721956]To add one or more VDPA devices, define a management device which allows adding or removing vdpa device. A management device defines set of callbacks to manage vdpa devices.
Quoted 5 lines
Quoted 2 lines
To begin with, it defines add and remove callbacks through which a user defined vdpa device can be added or removed.
This looks quite intrusive; is it meant to be in -stable, or is it some kind of mistake?
Looks like a mistake: I wanted to try and backport the vdpa patches that are in 5.13, but gave up and forgot to drop these.
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 11/98 media: drivers/media/usb: fix memory leak in zr364xx_probe
In reply to Sasha LevinFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 9c39be40c0155c43343f53e3a439290c0fec5542 ]
syzbot reported memory leak in zr364xx_probe()[1]. The problem was in invalid error handling order. All error conditions rigth after v4l2_ctrl_handler_init() must call v4l2_ctrl_handler_free().
--- drivers/media/usb/zr364xx/zr364xx.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/media/usb/zr364xx/zr364xx.c +6 -7
@@ -1433,7 +1433,7 @@ static int zr364xx_probe(struct usb_interface *intf,if (hdl->error) { err = hdl->error;dev_err (&udev->dev,"couldn't register control\n" ); - goto unregister; + goto free_hdlr_and_unreg_dev; }/* save the init method used by this camera */ cam->method = id->driver_info;
@@ -1506,7 +1506,7 @@ static int zr364xx_probe(struct usb_interface *intf,if (!cam->read_endpoint) { err = -ENOMEM ;dev_err (&intf->dev,"Could not find bulk-in endpoint\n" ); - goto unregister; + goto free_hdlr_and_unreg_dev; }/* v4l */
@@ -1518,7 +1518,7 @@ static int zr364xx_probe(struct usb_interface *intf,/* load zr364xx board specific */ err =zr364xx_board_init (cam);if (err) - goto unregister; + goto free_hdlr_and_unreg_dev; err =v4l2_ctrl_handler_setup (hdl);if (err) goto board_uninit;
@@ -1536,7 +1536,7 @@ static int zr364xx_probe(struct usb_interface *intf, err =video_register_device (&cam->vdev,VFL_TYPE_VIDEO ,-1 );if (err) {dev_err (&udev->dev,"video_register_device failed\n" ); - goto free_handler; + goto board_uninit; } cam->v4l2_dev.release = zr364xx_release;
@@ -1544,11 +1544,10 @@ static int zr364xx_probe(struct usb_interface *intf, video_device_node_name(&cam->vdev));return 0 ; -free_handler: -v4l2_ctrl_handler_free (hdl); board_uninit:zr364xx_board_uninit (cam); -unregister: +free_hdlr_and_unreg_dev: +v4l2_ctrl_handler_free (hdl);v4l2_device_unregister (&cam->v4l2_dev); free_cam:kfree (cam);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 12/98 KVM: x86: Factor out x86 instruction emulation with decoding
In reply to Sasha LevinFrom: Wei Huang <[email protected]>
[ Upstream commit 4aa2691dcbd38ce1c461188799d863398dd2865d ]
Move the instruction decode part out of x86_emulate_instruction() for it to be used in other places. Also kvm_clear_exception_queue() is moved inside the if-statement as it doesn't apply when KVM are coming back from userspace.
Message-Id: <[email protected]>
--- arch/x86/kvm/x86.c | 62 +++++++++++++++++++++++++++++----------------- arch/x86/kvm/x86.h | 2 ++ 2 files changed, 41 insertions(+), 23 deletions(-)
arch/x86/kvm/x86.c +39 -23
@@ -7338,6 +7338,42 @@ static bool is_vmware_backdoor_opcode(struct x86_emulate_ctxt *ctxt)return false; } +/* +* Decode to be emulated instruction. Return EMULATION_OK if success. +*/ +int x86_decode_emulated_instruction (struct kvm_vcpu *vcpu,int emulation_type, +void *insn,int insn_len) +{ +int r =EMULATION_OK ; +struct x86_emulate_ctxt *ctxt = vcpu->arch.emulate_ctxt; + +init_emulate_ctxt (vcpu); + +/* +* We will reenter on the same instruction since we do not set +* complete_userspace_io. This does not handle watchpoints yet, +* those would be handled in the emulate_ops. +*/ +if (!(emulation_type &EMULTYPE_SKIP ) && +kvm_vcpu_check_breakpoint (vcpu, &r)) +return r; + + ctxt->interruptibility =0 ; + ctxt->have_exception = false; + ctxt->exception.vector =-1 ; + ctxt->perm_ok = false; + + ctxt->ud = emulation_type &EMULTYPE_TRAP_UD ; + + r =x86_decode_insn (ctxt, insn, insn_len); + +trace_kvm_emulate_insn_start (vcpu); + ++vcpu->stat.insn_emulation; + +return r; +} +EXPORT_SYMBOL_GPL (x86_decode_emulated_instruction); +int x86_emulate_instruction (struct kvm_vcpu *vcpu,gpa_t cr2_or_gpa,int emulation_type,void *insn,int insn_len) {
@@ -7357,32 +7393,12 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa,*/ write_fault_to_spt = vcpu->arch.write_fault_to_shadow_pgtable; vcpu->arch.write_fault_to_shadow_pgtable = false; -kvm_clear_exception_queue (vcpu);if (!(emulation_type &EMULTYPE_NO_DECODE )) { -init_emulate_ctxt (vcpu); - -/* -* We will reenter on the same instruction since -* we do not set complete_userspace_io. This does not -* handle watchpoints yet, those would be handled in -* the emulate_ops. -*/ -if (!(emulation_type &EMULTYPE_SKIP ) && -kvm_vcpu_check_breakpoint (vcpu, &r)) -return r; - - ctxt->interruptibility =0 ; - ctxt->have_exception = false; - ctxt->exception.vector =-1 ; - ctxt->perm_ok = false; - - ctxt->ud = emulation_type &EMULTYPE_TRAP_UD ; - - r =x86_decode_insn (ctxt, insn, insn_len); +kvm_clear_exception_queue (vcpu); -trace_kvm_emulate_insn_start (vcpu); - ++vcpu->stat.insn_emulation; + r =x86_decode_emulated_instruction (vcpu, emulation_type, + insn, insn_len);if (r !=EMULATION_OK ) {if ((emulation_type &EMULTYPE_TRAP_UD ) || (emulation_type &EMULTYPE_TRAP_UD_FORCED )) {
arch/x86/kvm/x86.h +2 -0
@@ -272,6 +272,8 @@ bool kvm_mtrr_check_gfn_range_consistency(struct kvm_vcpu *vcpu, gfn_t gfn, int page_num);bool kvm_vector_hashing_enabled (void );void kvm_fixup_and_inject_pf_error (struct kvm_vcpu *vcpu,gva_t gva,u16 error_code); +int x86_decode_emulated_instruction (struct kvm_vcpu *vcpu,int emulation_type, +void *insn,int insn_len);int x86_emulate_instruction (struct kvm_vcpu *vcpu,gpa_t cr2_or_gpa,int emulation_type,void *insn,int insn_len);fastpath_t handle_fastpath_set_msr_irqoff (struct kvm_vcpu *vcpu);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 13/98 KVM: X86: Fix warning caused by stale emulation context
In reply to Sasha LevinFrom: Wanpeng Li <[email protected]>
[ Upstream commit da6393cdd8aaa354b3a2437cd73ebb34cac958e3 ]
Reported by syzkaller:
WARNING: CPU: 7 PID: 10526 at linux/arch/x86/kvm//x86.c:7621 x86_emulate_instruction+0x41b/0x510 [kvm] RIP: 0010:x86_emulate_instruction+0x41b/0x510 [kvm] Call Trace: kvm_mmu_page_fault+0x126/0x8f0 [kvm] vmx_handle_exit+0x11e/0x680 [kvm_intel] vcpu_enter_guest+0xd95/0x1b40 [kvm] kvm_arch_vcpu_ioctl_run+0x377/0x6a0 [kvm] kvm_vcpu_ioctl+0x389/0x630 [kvm] __x64_sys_ioctl+0x8e/0xd0 do_syscall_64+0x3c/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xae
Commit 4a1e10d5b5d8 ("KVM: x86: handle hardware breakpoints during emulation()) adds hardware breakpoints check before emulation the instruction and parts of emulation context initialization, actually we don't have the EMULTYPE_NO_DECODE flag here and the emulation context will not be reused. Commit c8848cee74ff ("KVM: x86:
set ctxt->have_exception in x86_decode_insn()) triggers the warning because it catches the stale emulation context has #UD, however, it is not during instruction decoding which should result in EMULATION_FAILED. This patch fixes it by moving the second part emulation context initialization into init_emulate_ctxt() and before hardware breakpoints check. The ctxt->ud will be dropped by a follow-up patch.
syzkaller source: https://syzkaller.appspot.com/x/repro.c?x=134683fdd00000
Message-Id: <[email protected]>
--- arch/x86/kvm/x86.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/x86/kvm/x86.c +5 -5
@@ -7023,6 +7023,11 @@ static void init_emulate_ctxt(struct kvm_vcpu *vcpu)BUILD_BUG_ON (HF_SMM_MASK !=X86EMUL_SMM_MASK );BUILD_BUG_ON (HF_SMM_INSIDE_NMI_MASK !=X86EMUL_SMM_INSIDE_NMI_MASK ); + ctxt->interruptibility =0 ; + ctxt->have_exception = false; + ctxt->exception.vector =-1 ; + ctxt->perm_ok = false; +init_decode_cache (ctxt); vcpu->arch.emulate_regs_need_sync_from_vcpu = false; }
@@ -7358,11 +7363,6 @@ int x86_decode_emulated_instruction(struct kvm_vcpu *vcpu, int emulation_type, kvm_vcpu_check_breakpoint(vcpu, &r))return r; - ctxt->interruptibility =0 ; - ctxt->have_exception = false; - ctxt->exception.vector =-1 ; - ctxt->perm_ok = false; - ctxt->ud = emulation_type &EMULTYPE_TRAP_UD ; r =x86_decode_insn (ctxt, insn, insn_len);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 14/98 USB: core: Avoid WARNings for 0-length descriptor requests
In reply to Sasha LevinFrom: Alan Stern <[email protected]>
[ Upstream commit 60dfe484cef45293e631b3a6e8995f1689818172 ]
The USB core has utility routines to retrieve various types of descriptors. These routines will now provoke a WARN if they are asked to retrieve 0 bytes (USB "receive" requests must not have zero length), so avert this by checking the size argument at the start.
--- drivers/usb/core/message.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/core/message.c +6 -0
@@ -785,6 +785,9 @@ int usb_get_descriptor(struct usb_device *dev, unsigned char type,int i;int result; +if (size <=0 )/* No point in asking for no data */ +return -EINVAL ; +memset (buf,0 , size);/* Make sure we parse really received data */ for (i =0 ; i <3 ; ++i) {
@@ -833,6 +836,9 @@ static int usb_get_string(struct usb_device *dev, unsigned short langid,int i;int result; +if (size <=0 )/* No point in asking for no data */ +return -EINVAL ; +for (i =0 ; i <3 ; ++i) {/* retry on length 0 or stall; some devices are flakey */ result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 15/98 USB: core: Fix incorrect pipe calculation in do_proc_control()
In reply to Sasha LevinFrom: Alan Stern <[email protected]>
[ Upstream commit b0863f1927323110e3d0d69f6adb6a91018a9a3c ]
When the user submits a control URB via usbfs, the user supplies the bRequestType value and the kernel uses it to compute the pipe value. However, do_proc_control() performs this computation incorrectly in the case where the bRequestType direction bit is set to USB_DIR_IN and the URB's transfer length is 0: The pipe's direction is also set to IN but it should be OUT, which is the direction the actual transfer will use regardless of bRequestType.
Commit 5cc59c418fde ("USB: core: WARN if pipe direction != setup packet direction") added a check to compare the direction bit in the pipe value to a control URB's actual direction and to WARN if they are different. This can be triggered by the incorrect computation mentioned above, as found by syzbot.
This patch fixes the computation, thus avoiding the WARNing.
--- drivers/usb/core/devio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/core/devio.c +1 -1
@@ -1133,7 +1133,7 @@ static int do_proc_control(struct usb_dev_state *ps,"wIndex=%04x wLength=%04x\n" , ctrl->bRequestType, ctrl->bRequest, ctrl->wValue, ctrl->wIndex, ctrl->wLength); -if (ctrl->bRequestType &0x80 ) { +if ((ctrl->bRequestType &USB_DIR_IN ) && ctrl->wLength) { pipe =usb_rcvctrlpipe (dev,0 );snoop_urb (dev,NULL , pipe, ctrl->wLength, tmo,SUBMIT ,NULL ,0 );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 16/98 dmaengine: xilinx_dma: Fix read-after-free bug when terminating transfers
In reply to Sasha LevinFrom: Adrian Larumbe <[email protected]>
[ Upstream commit 7dd2dd4ff9f3abda601f22b9d01441a0869d20d7 ]
When user calls dmaengine_terminate_sync, the driver will clean up any remaining descriptors for all the pending or active transfers that had previously been submitted. However, this might happen whilst the tasklet is invoking the DMA callback for the last finished transfer, so by the time it returns and takes over the channel's spinlock, the list of completed descriptors it was traversing is no longer valid. This leads to a read-after-free situation.
Fix it by signalling whether a user-triggered termination has happened by means of a boolean variable.
--- drivers/dma/xilinx/xilinx_dma.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/dma/xilinx/xilinx_dma.c +12 -0
@@ -394,6 +394,7 @@ struct xilinx_dma_tx_descriptor {* @genlock: Support genlock mode * @err: Channel has errors * @idle: Check for channel idle +* @terminating: Check for channel being synchronized by user * @tasklet: Cleanup work after irq * @config: Device configuration info * @flush_on_fsync: Flush on Frame sync
@@ -431,6 +432,7 @@ struct xilinx_dma_chan {bool genlock;bool err;bool idle; +bool terminating;struct tasklet_struct tasklet;struct xilinx_vdma_config config;bool flush_on_fsync;
@@ -1049,6 +1051,13 @@ static void xilinx_dma_chan_desc_cleanup(struct xilinx_dma_chan *chan)/* Run any dependencies, then free the descriptor */ dma_run_dependencies (&desc->async_tx);xilinx_dma_free_tx_descriptor (chan, desc); + +/* +* While we ran a callback the user called a terminate function, +* which takes care of cleaning up any remaining descriptors +*/ +if (chan->terminating) +break ; }spin_unlock_irqrestore (&chan->lock, flags);
@@ -1965,6 +1974,8 @@ static dma_cookie_t xilinx_dma_tx_submit(struct dma_async_tx_descriptor *tx)if (desc->cyclic) chan->cyclic = true; + chan->terminating = false; +spin_unlock_irqrestore (&chan->lock, flags);return cookie;
@@ -2436,6 +2447,7 @@ static int xilinx_dma_terminate_all(struct dma_chan *dchan)xilinx_dma_chan_reset (chan);/* Remove and free all of the descriptors in the lists */ + chan->terminating = true;xilinx_dma_free_descriptors (chan); chan->idle = true;
Signature · 1 line
2.30.2
Re: [PATCH 5.10 16/98] dmaengine: xilinx_dma: Fix read-after-free bug when terminating transfers
Hi!
Quoted 10 lines
[ Upstream commit
7dd2dd4ff9f3abda601f22b9d01441a0869d20d7]When user calls
dmaengine_terminate_sync, the driver will clean up any remaining descriptors for all the pending or active transfers that had previously been submitted. However, this might happen whilst the tasklet is invoking the DMA callback for the last finished transfer, so by the time it returns and takes over the channel's spinlock, the list of completed descriptors it was traversing is no longer valid. This leads to a read-after-free situation.
Quoted 2 lines
Fix it by signalling whether a user-triggered termination has happened by means of a boolean variable.
I see the variable is cleared and tested under spinlock, but it is set without any locking. Do we need to take the spinlock, too?
Best regards,
Pavel
Quoted 31 lines
drivers/dma/xilinx/xilinx_dma.c +10
-0@@ -1049,6 +1051,13 @@ static void xilinx_dma_chan_desc_cleanup(struct xilinx_dma_chan *chan)/* Run any dependencies, then free the descriptor */ dma_run_dependencies (&desc->async_tx);xilinx_dma_free_tx_descriptor (chan, desc); + +/* +* While we ran a callback the user called a terminate function, +* which takes care of cleaning up any remaining descriptors +*/ +if (chan->terminating) +break ; }spin_unlock_irqrestore (&chan->lock, flags);@@ -1965,6 +1974,8 @@ static dma_cookie_t xilinx_dma_tx_submit(struct dma_async_tx_descriptor *tx)if (desc->cyclic) chan->cyclic = true; + chan->terminating = false; +spin_unlock_irqrestore (&chan->lock, flags);return cookie;@@ -2436,6 +2447,7 @@ static int xilinx_dma_terminate_all(struct dma_chan *dchan)xilinx_dma_chan_reset (chan);/* Remove and free all of the descriptors in the lists */ + chan->terminating = true;xilinx_dma_free_descriptors (chan); chan->idle = true;
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Sasha Levin
maintainerPATCH 17/98 dmaengine: usb-dmac: Fix PM reference leak in usb_dmac_probe()
In reply to Sasha LevinFrom: Yu Kuai <[email protected]>
[ Upstream commit 1da569fa7ec8cb0591c74aa3050d4ea1397778b4 ]
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by moving the error_pm label above the pm_runtime_put() in the error path.
--- drivers/dma/sh/usb-dmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/sh/usb-dmac.c +1 -1
@@ -855,8 +855,8 @@ static int usb_dmac_probe(struct platform_device *pdev) error:of_dma_controller_free (pdev->dev.of_node); -pm_runtime_put (&pdev->dev); error_pm: +pm_runtime_put (&pdev->dev);pm_runtime_disable (&pdev->dev);return ret; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 18/98 spi: spi-mux: Add module info needed for autoloading
In reply to Sasha LevinFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 1d5ccab95f06675a269f4cb223a1e3f6d1ebef42 ]
With the spi device table udev can autoload the spi-mux module in the presence of an spi-mux device.
--- drivers/spi/spi-mux.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/spi/spi-mux.c +8 -0
@@ -167,10 +167,17 @@ err_put_ctlr:return ret; } +static const struct spi_device_id spi_mux_id[] = { + {"spi-mux" }, + { } +}; +MODULE_DEVICE_TABLE (spi, spi_mux_id); +static const struct of_device_id spi_mux_of_match[] = { { .compatible ="spi-mux" }, { } }; +MODULE_DEVICE_TABLE (of, spi_mux_of_match);static struct spi_driver spi_mux_driver = { .probe = spi_mux_probe,
@@ -178,6 +185,7 @@ static struct spi_driver spi_mux_driver = { .name = "spi-mux", .of_match_table = spi_mux_of_match, }, + .id_table = spi_mux_id, };module_spi_driver (spi_mux_driver);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 19/98 net: xfrm: Fix end of loop tests for list_for_each_entry
In reply to Sasha LevinFrom: Harshvardhan Jha <[email protected]>
[ Upstream commit 480e93e12aa04d857f7cc2e6fcec181c0d690404 ]
The list_for_each_entry() iterator, "pos" in this code, can never be NULL so the warning will never be printed.
--- net/xfrm/xfrm_ipcomp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/xfrm/xfrm_ipcomp.c +1 -1
@@ -250,7 +250,7 @@ static void ipcomp_free_tfms(struct crypto_comp * __percpu *tfms)break ; } -WARN_ON (!pos); +WARN_ON (list_entry_is_head (pos, &ipcomp_tfms_list, list));if (--pos->users)return ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 20/98 ARM: dts: am43x-epos-evm: Reduce i2c0 bus speed for tps65218
In reply to Sasha LevinFrom: Dave Gerlach <[email protected]>
[ Upstream commit 20a6b3fd8e2e2c063b25fbf2ee74d86b898e5087 ]
Based on the latest timing specifications for the TPS65218 from the data sheet, http://www.ti.com/lit/ds/symlink/tps65218.pdf, document SLDS206 from November 2014, we must change the i2c bus speed to better fit within the minimum high SCL time required for proper i2c transfer.
When running at 400khz, measurements show that SCL spends 0.8125 uS/1.666 uS high/low which violates the requirement for minimum high period of SCL provided in datasheet Table 7.6 which is 1 uS. Switching to 100khz gives us 5 uS/5 uS high/low which both fall above the minimum given values for 100 khz, 4.0 uS/4.7 uS high/low.
Without this patch occasionally a voltage set operation from the kernel will appear to have worked but the actual voltage reflected on the PMIC will not have updated, causing problems especially with cpufreq that may update to a higher OPP without actually raising the voltage on DCDC2, leading to a hang.
--- arch/arm/boot/dts/am43x-epos-evm.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/am43x-epos-evm.dts +1 -1
@@ -582,7 +582,7 @@ status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins>; - clock-frequency = <400000>; + clock-frequency = <100000>; tps65218: tps65218@24 { reg = <0x24>;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 21/98 dmaengine: of-dma: router_xlate to return -EPROBE_DEFER if controller is not yet available
In reply to Sasha LevinFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit eda97cb095f2958bbad55684a6ca3e7d7af0176a ]
If the router_xlate can not find the controller in the available DMA devices then it should return with -EPORBE_DEFER in a same way as the of_dma_request_slave_channel() does.
The issue can be reproduced if the event router is registered before the DMA controller itself and a driver would request for a channel before the controller is registered.
In of_dma_request_slave_channel():
1. of_dma_find_controller() would find the dma_router
2. ofdma->of_dma_xlate() would fail and returned NULL
3. -ENODEV is returned as error code
with this patch we would return in this case the correct -EPROBE_DEFER and the client can try to request the channel later.
--- drivers/dma/of-dma.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/dma/of-dma.c +7 -2
@@ -67,8 +67,12 @@ static struct dma_chan *of_dma_router_xlate(struct of_phandle_args *dma_spec,return NULL ; ofdma_target =of_dma_find_controller (&dma_spec_target); -if (!ofdma_target) -return NULL ; +if (!ofdma_target) { + ofdma->dma_router->route_free (ofdma->dma_router->dev, + route_data); + chan =ERR_PTR (-EPROBE_DEFER ); + goto err; + } chan = ofdma_target->of_dma_xlate (&dma_spec_target, ofdma_target);if (IS_ERR_OR_NULL (chan)) {
@@ -79,6 +83,7 @@ static struct dma_chan *of_dma_router_xlate(struct of_phandle_args *dma_spec, chan->route_data = route_data; } +err:/* * Need to put the node back since the ofdma->of_dma_route_allocate * has taken it for generating the new, translated dma_spec
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 22/98 scsi: pm80xx: Fix TMF task completion race condition
In reply to Sasha LevinFrom: Igor Pylypiv <[email protected]>
[ Upstream commit d712d3fb484b7fa8d1d57e9ca6f134bb9d8c18b1 ]
The TMF timeout timer may trigger at the same time when the response from a controller is being handled. When this happens the SAS task may get freed before the response processing is finished.
Fix this by calling complete() only when SAS_TASK_STATE_DONE is not set.
A similar race condition was fixed in commit b90cd6f2b905 ("scsi: libsas:
fix a race condition when smp task timeout")
--- drivers/scsi/pm8001/pm8001_sas.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-)
drivers/scsi/pm8001/pm8001_sas.c +15 -17
@@ -684,8 +684,7 @@ int pm8001_dev_found(struct domain_device *dev)void pm8001_task_done (struct sas_task *task) { -if (!del_timer (&task->slow_task->timer)) -return ; +del_timer (&task->slow_task->timer);complete (&task->slow_task->completion); }
@@ -693,9 +692,14 @@ static void pm8001_tmf_timedout(struct timer_list *t) {struct sas_task_slow *slow =from_timer (slow, t, timer);struct sas_task *task = slow->task; +unsigned long flags; - task->task_state_flags |=SAS_TASK_STATE_ABORTED ; -complete (&task->slow_task->completion); +spin_lock_irqsave (&task->task_state_lock, flags); +if (!(task->task_state_flags &SAS_TASK_STATE_DONE )) { + task->task_state_flags |=SAS_TASK_STATE_ABORTED ; +complete (&task->slow_task->completion); + } +spin_unlock_irqrestore (&task->task_state_lock, flags); }#define PM8001_TASK_TIMEOUT 20
@@ -748,13 +752,10 @@ static int pm8001_exec_internal_tmf_task(struct domain_device *dev, } res = -TMF_RESP_FUNC_FAILED ;/* Even TMF timed out, return direct. */ -if ((task->task_state_flags &SAS_TASK_STATE_ABORTED )) { -if (!(task->task_state_flags &SAS_TASK_STATE_DONE )) { -pm8001_dbg (pm8001_ha,FAIL , -"TMF task[%x]timeout.\n" , - tmf->tmf); - goto ex_err; - } +if (task->task_state_flags &SAS_TASK_STATE_ABORTED ) { +pm8001_dbg (pm8001_ha,FAIL ,"TMF task[%x]timeout.\n" , + tmf->tmf); + goto ex_err; } if (task->task_status.resp == SAS_TASK_COMPLETE &&
@@ -834,12 +835,9 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha,wait_for_completion (&task->slow_task->completion); res =TMF_RESP_FUNC_FAILED ;/* Even TMF timed out, return direct. */ -if ((task->task_state_flags &SAS_TASK_STATE_ABORTED )) { -if (!(task->task_state_flags &SAS_TASK_STATE_DONE )) { -pm8001_dbg (pm8001_ha,FAIL , -"TMF task timeout.\n" ); - goto ex_err; - } +if (task->task_state_flags &SAS_TASK_STATE_ABORTED ) { +pm8001_dbg (pm8001_ha,FAIL ,"TMF task timeout.\n" ); + goto ex_err; } if (task->task_status.resp == SAS_TASK_COMPLETE &&
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 23/98 scsi: megaraid_mm: Fix end of loop tests for list_for_each_entry()
In reply to Sasha LevinFrom: Harshvardhan Jha <[email protected]>
[ Upstream commit 77541f78eadfe9fdb018a7b8b69f0f2af2cf4b82 ]
The list_for_each_entry() iterator, "adapter" in this code, can never be NULL. If we exit the loop without finding the correct adapter then "adapter" points invalid memory that is an offset from the list head. This will eventually lead to memory corruption and presumably a kernel crash.
--- drivers/scsi/megaraid/megaraid_mm.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/scsi/megaraid/megaraid_mm.c +15 -6
@@ -238,7 +238,7 @@ mraid_mm_get_adapter(mimd_t __user *umimd, int *rval)mimd_t mimd;uint32_t adapno;int iterator; - +bool is_found;if (copy_from_user (&mimd, umimd,sizeof (mimd_t))) { *rval = -EFAULT ;
@@ -254,12 +254,16 @@ mraid_mm_get_adapter(mimd_t __user *umimd, int *rval) adapter =NULL ; iterator =0 ; + is_found = false;list_for_each_entry (adapter, &adapters_list_g, list) { -if (iterator++ == adapno)break ; +if (iterator++ == adapno) { + is_found = true; +break ; + } } -if (!adapter) { +if (!is_found) { *rval = -ENODEV ;return NULL ; }
@@ -725,6 +729,7 @@ ioctl_done(uioc_t *kioc)uint32_t adapno;int iterator;mraid_mmadp_t * adapter; +bool is_found;/* * When the kioc returns from driver, make sure it still doesn't
@@ -747,19 +752,23 @@ ioctl_done(uioc_t *kioc) iterator =0 ; adapter =NULL ; adapno = kioc->adapno; + is_found = false;con_log (CL_ANN , (KERN_WARNING "megaraid cmm: completed " "ioctl that was timedout before\n" ));list_for_each_entry (adapter, &adapters_list_g, list) { -if (iterator++ == adapno)break ; +if (iterator++ == adapno) { + is_found = true; +break ; + } } kioc->timedout =0 ; -if (adapter) { +if (is_found)mraid_mm_dealloc_kioc ( adapter, kioc ); - } + }else {wake_up (&wait_q);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 24/98 scsi: scsi_dh_rdac: Avoid crash during rdac_bus_attach()
In reply to Sasha LevinFrom: Ye Bin <[email protected]>
[ Upstream commit bc546c0c9abb3bb2fb46866b3d1e6ade9695a5f6 ]
The following BUG_ON() was observed during RDAC scan:
[595952.944297] kernel BUG at drivers/scsi/device_handler/scsi_dh_rdac.c:427! [595952.951143] Internal error: Oops - BUG: 0 [#1] SMP ...... [595953.251065] Call trace: [595953.259054] check_ownership+0xb0/0x118 [595953.269794] rdac_bus_attach+0x1f0/0x4b0 [595953.273787] scsi_dh_handler_attach+0x3c/0xe8 [595953.278211] scsi_dh_add_device+0xc4/0xe8 [595953.282291] scsi_sysfs_add_sdev+0x8c/0x2a8 [595953.286544] scsi_probe_and_add_lun+0x9fc/0xd00 [595953.291142] __scsi_scan_target+0x598/0x630 [595953.295395] scsi_scan_target+0x120/0x130 [595953.299481] fc_user_scan+0x1a0/0x1c0 [scsi_transport_fc] [595953.304944] store_scan+0xb0/0x108 [595953.308420] dev_attr_store+0x44/0x60 [595953.312160] sysfs_kf_write+0x58/0x80 [595953.315893] kernfs_fop_write+0xe8/0x1f0 [595953.319888] __vfs_write+0x60/0x190 [595953.323448] vfs_write+0xac/0x1c0 [595953.326836] ksys_write+0x74/0xf0 [595953.330221] __arm64_sys_write+0x24/0x30
Code is in check_ownership:
list_for_each_entry_rcu(tmp, &h->ctlr->dh_list, node) {
/* h->sdev should always be valid */
BUG_ON(!tmp->sdev);
tmp->sdev->access_state = access_state;
}
rdac_bus_attach
initialize_controller
list_add_rcu(&h->node, &h->ctlr->dh_list);
h->sdev = sdev;
rdac_bus_detach
list_del_rcu(&h->node);
h->sdev = NULL;Fix the race between rdac_bus_attach() and rdac_bus_detach() where h->sdev is NULL when processing the RDAC attach.
--- drivers/scsi/device_handler/scsi_dh_rdac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/device_handler/scsi_dh_rdac.c +2 -2
@@ -453,8 +453,8 @@ static int initialize_controller(struct scsi_device *sdev,if (!h->ctlr) err =SCSI_DH_RES_TEMP_UNAVAIL ;else { -list_add_rcu (&h->node, &h->ctlr->dh_list); h->sdev = sdev; +list_add_rcu (&h->node, &h->ctlr->dh_list); }spin_unlock (&list_lock); err =SCSI_DH_OK ;
@@ -778,11 +778,11 @@ static void rdac_bus_detach( struct scsi_device *sdev )spin_lock (&list_lock);if (h->ctlr) {list_del_rcu (&h->node); - h->sdev =NULL ;kref_put (&h->ctlr->kref, release_controller); }spin_unlock (&list_lock); sdev->handler_data =NULL ; +synchronize_rcu ();kfree (h); }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 25/98 scsi: core: Avoid printing an error if target_alloc() returns -ENXIO
In reply to Sasha LevinFrom: Sreekanth Reddy <[email protected]>
[ Upstream commit 70edd2e6f652f67d854981fd67f9ad0f1deaea92 ]
Avoid printing a 'target allocation failed' error if the driver target_alloc() callback function returns -ENXIO. This return value indicates that the corresponding H:C:T:L entry is empty.
Removing this error reduces the scan time if the user issues SCAN_WILD_CARD scan operation through sysfs parameter on a host with a lot of empty H:C:T:L entries.
Avoiding the printk on -ENXIO matches the behavior of the other callback functions during scanning.
--- drivers/scsi/scsi_scan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/scsi_scan.c +2 -1
@@ -453,7 +453,8 @@ static struct scsi_target *scsi_alloc_target(struct device *parent, error = shost->hostt->target_alloc (starget);if (error) { -dev_printk (KERN_ERR , dev,"target allocation failed, error %d\n" , error); +if (error != -ENXIO ) +dev_err (dev,"target allocation failed, error %d\n" , error);/* don't want scsi_target_reap to do the final * put because it will be under the host lock */ scsi_target_destroy (starget);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 26/98 scsi: core: Fix capacity set to zero after offlinining device
In reply to Sasha LevinFrom: lijinlin <[email protected]>
[ Upstream commit f0f82e2476f6adb9c7a0135cfab8091456990c99 ]
After adding physical volumes to a volume group through vgextend, the kernel will rescan the partitions. This in turn will cause the device capacity to be queried.
If the device status is set to offline through sysfs at this time, READ CAPACITY command will return a result which the host byte is DID_NO_CONNECT, and the capacity of the device will be set to zero in read_capacity_error(). After setting device status back to running, the capacity of the device will remain stuck at zero.
Fix this issue by rescanning device when the device state changes to SDEV_RUNNING.
--- drivers/scsi/scsi_sysfs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/scsi/scsi_sysfs.c +6 -3
@@ -807,11 +807,14 @@ store_state_field(struct device *dev, struct device_attribute *attr,mutex_lock (&sdev->state_mutex); ret =scsi_device_set_state (sdev, state);/* -* If the device state changes to SDEV_RUNNING, we need to run -* the queue to avoid I/O hang. +* If the device state changes to SDEV_RUNNING, we need to +* rescan the device to revalidate it, and run the queue to +* avoid I/O hang. */ -if (ret ==0 && state ==SDEV_RUNNING ) +if (ret ==0 && state ==SDEV_RUNNING ) { +scsi_rescan_device (dev);blk_mq_run_hw_queues (sdev->request_queue, true); + }mutex_unlock (&sdev->state_mutex);return ret ==0 ? count : -EINVAL ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 27/98 drm/amdgpu: fix the doorbell missing when in CGPG issue for renoir.
In reply to Sasha LevinFrom: Yifan Zhang <[email protected]>
[ Upstream commit 1c0539a6fc8a4a4b77278e35d763073890de96b9 ]
If GC has entered CGPG, ringing doorbell > first page doesn't wakeup GC. Enlarge CP_MEC_DOORBELL_RANGE_UPPER to workaround this issue.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +20 -1
@@ -1271,6 +1271,16 @@ static bool is_raven_kicker(struct amdgpu_device *adev)return false; } +static bool check_if_enlarge_doorbell_range (struct amdgpu_device *adev) +{ +if ((adev->asic_type ==CHIP_RENOIR ) && + (adev->gfx.me_fw_version >=0x000000a5 ) && + (adev->gfx.me_feature_version >=52 )) +return true; +else +return false; +} +static void gfx_v9_0_check_if_need_gfxoff (struct amdgpu_device *adev) {if (gfx_v9_0_should_disable_gfxoff (adev->pdev))
@@ -3619,7 +3629,16 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)if (ring->use_doorbell) {WREG32_SOC15 (GC ,0 , mmCP_MEC_DOORBELL_RANGE_LOWER, (adev->doorbell_index.kiq *2 ) <<2 ); -WREG32_SOC15 (GC ,0 , mmCP_MEC_DOORBELL_RANGE_UPPER, +/* If GC has entered CGPG, ringing doorbell > first page +* doesn't wakeup GC. Enlarge CP_MEC_DOORBELL_RANGE_UPPER to +* workaround this issue. And this change has to align with firmware +* update. +*/ +if (check_if_enlarge_doorbell_range (adev)) +WREG32_SOC15 (GC ,0 , mmCP_MEC_DOORBELL_RANGE_UPPER, + (adev->doorbell.size -4 )); +else +WREG32_SOC15 (GC ,0 , mmCP_MEC_DOORBELL_RANGE_UPPER, (adev->doorbell_index.userqueue_end *2 ) <<2 ); }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 28/98 qede: fix crash in rmmod qede while automatic debug collection
In reply to Sasha LevinFrom: Prabhakar Kushwaha <[email protected]>
[ Upstream commit 1159e25c137422bdc48ee96e3fb014bd942092c6 ]
A crash has been observed if rmmod is done while automatic debug collection in progress. It is due to a race condition between both of them.
To fix stop the sp_task during unload to avoid running qede_sp_task even if they are schedule during removal process.
--- drivers/net/ethernet/qlogic/qede/qede.h | 1 + drivers/net/ethernet/qlogic/qede/qede_main.c | 8 ++++++++ 2 files changed, 9 insertions(+)
drivers/net/ethernet/qlogic/qede/qede.h +1 -0
@@ -494,6 +494,7 @@ struct qede_fastpath {#define QEDE_SP_HW_ERR 4#define QEDE_SP_ARFS_CONFIG 5#define QEDE_SP_AER 7 +#define QEDE_SP_DISABLE 8#ifdef CONFIG_RFS_ACCEL int qede_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
drivers/net/ethernet/qlogic/qede/qede_main.c +8 -0
@@ -1006,6 +1006,13 @@ static void qede_sp_task(struct work_struct *work) struct qede_dev *edev = container_of(work, struct qede_dev, sp_task.work); +/* Disable execution of this deferred work once +* qede removal is in progress, this stop any future +* scheduling of sp_task. +*/ +if (test_bit (QEDE_SP_DISABLE , &edev->sp_flags)) +return ; +/* The locking scheme depends on the specific flag: * In case of QEDE_SP_RECOVERY, acquiring the RTNL lock is required to * ensure that ongoing flows are ended and new ones are not started.
@@ -1297,6 +1304,7 @@ static void __qede_remove(struct pci_dev *pdev, enum qede_remove_mode mode)qede_rdma_dev_remove (edev, (mode ==QEDE_REMOVE_RECOVERY ));if (mode !=QEDE_REMOVE_RECOVERY ) { +set_bit (QEDE_SP_DISABLE , &edev->sp_flags);unregister_netdev (ndev);cancel_delayed_work_sync (&edev->sp_task);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 29/98 ARM: dts: nomadik: Fix up interrupt controller node names
In reply to Sasha LevinFrom: Sudeep Holla <[email protected]>
[ Upstream commit 47091f473b364c98207c4def197a0ae386fc9af1 ]
Once the new schema interrupt-controller/arm,vic.yaml is added, we get the below warnings:
arch/arm/boot/dts/ste-nomadik-nhk15.dt.yaml: intc@10140000: $nodename:0: 'intc@10140000' does not match '^interrupt-controller(@[0-9a-f,]+)*$'
Fix the node names for the interrupt controller to conform to the standard node name interrupt-controller@..
--- arch/arm/boot/dts/ste-nomadik-stn8815.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/ste-nomadik-stn8815.dtsi +2 -2
@@ -755,14 +755,14 @@ status = "disabled"; }; - vica: intc@10140000 { + vica: interrupt-controller@10140000 { compatible = "arm,versatile-vic"; interrupt-controller; #interrupt-cells = <1>; reg = <0x10140000 0x20>; }; - vicb: intc@10140020 { + vicb: interrupt-controller@10140020 { compatible = "arm,versatile-vic"; interrupt-controller; #interrupt-cells = <1>;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 30/98 net: usb: pegasus: Check the return value of get_geristers() and friends;
In reply to Sasha LevinFrom: Petko Manolov <[email protected]>
[ Upstream commit 8a160e2e9aeb8318159b48701ad8a6e22274372d ]
Certain call sites of get_geristers() did not do proper error handling. This could be a problem as get_geristers() typically return the data via pointer to a buffer. If an error occurred the code is carelessly manipulating the wrong data.
--- drivers/net/usb/pegasus.c | 108 ++++++++++++++++++++++++++------------ 1 file changed, 75 insertions(+), 33 deletions(-)
drivers/net/usb/pegasus.c +75 -33
@@ -132,9 +132,15 @@ static int get_registers(pegasus_t *pegasus, __u16 indx, __u16 size, void *data)static int set_registers (pegasus_t *pegasus,__u16 indx,__u16 size,const void *data) { -return usb_control_msg_send (pegasus->usb,0 ,PEGASUS_REQ_SET_REGS , +int ret; + + ret =usb_control_msg_send (pegasus->usb,0 ,PEGASUS_REQ_SET_REGS ,PEGASUS_REQT_WRITE ,0 , indx, data, size,1000 ,GFP_NOIO ); +if (ret <0 ) +netif_dbg (pegasus, drv, pegasus->net,"%s failed with %d\n" , __func__, ret); + +return ret; }/*
@@ -145,10 +151,15 @@ static int set_registers(pegasus_t *pegasus, __u16 indx, __u16 size,static int set_register (pegasus_t *pegasus,__u16 indx,__u8 data) {void *buf = &data; +int ret; -return usb_control_msg_send (pegasus->usb,0 ,PEGASUS_REQ_SET_REG , + ret =usb_control_msg_send (pegasus->usb,0 ,PEGASUS_REQ_SET_REG ,PEGASUS_REQT_WRITE , data, indx, buf,1 ,1000 ,GFP_NOIO ); +if (ret <0 ) +netif_dbg (pegasus, drv, pegasus->net,"%s failed with %d\n" , __func__, ret); + +return ret; }static int update_eth_regs_async (pegasus_t *pegasus)
@@ -188,10 +199,9 @@ static int update_eth_regs_async(pegasus_t *pegasus)static int __mii_op (pegasus_t *p,__u8 phy,__u8 indx,__u16 *regd,__u8 cmd) { -int i; -__u8 data[4 ] = { phy,0 ,0 , indx }; +int i, ret;__le16 regdi; -int ret = -ETIMEDOUT ; +__u8 data[4 ] = { phy,0 ,0 , indx };if (cmd &PHY_WRITE ) {__le16 *t = (__le16 *) & data[1 ];
@@ -207,12 +217,15 @@ static int __mii_op(pegasus_t *p, __u8 phy, __u8 indx, __u16 *regd, __u8 cmd)if (data[0 ] &PHY_DONE )break ; } -if (i >=REG_TIMEOUT ) +if (i >=REG_TIMEOUT ) { + ret = -ETIMEDOUT ; goto fail; + }if (cmd &PHY_READ ) { ret =get_registers (p, PhyData,2 , ®di); +if (ret <0 ) + goto fail; *regd =le16_to_cpu (regdi); -return ret; }return 0 ; fail:
@@ -235,9 +248,13 @@ static int write_mii_word(pegasus_t *pegasus, __u8 phy, __u8 indx, __u16 *regd)static int mdio_read (struct net_device *dev,int phy_id,int loc) {pegasus_t *pegasus =netdev_priv (dev); +int ret;u16 res; -read_mii_word (pegasus, phy_id, loc, &res); + ret =read_mii_word (pegasus, phy_id, loc, &res); +if (ret <0 ) +return ret; +return (int )res; }
@@ -251,10 +268,9 @@ static void mdio_write(struct net_device *dev, int phy_id, int loc, int val)static int read_eprom_word (pegasus_t *pegasus,__u8 index,__u16 *retdata) { -int i; -__u8 tmp =0 ; +int ret, i;__le16 retdatai; -int ret; +__u8 tmp =0 ;set_register (pegasus, EpromCtrl,0 );set_register (pegasus, EpromOffset, index);
@@ -262,21 +278,25 @@ static int read_eprom_word(pegasus_t *pegasus, __u8 index, __u16 *retdata)for (i =0 ; i <REG_TIMEOUT ; i++) { ret =get_registers (pegasus, EpromCtrl,1 , &tmp); +if (ret <0 ) + goto fail;if (tmp &EPROM_DONE )break ; -if (ret == -ESHUTDOWN ) - goto fail; } -if (i >=REG_TIMEOUT ) +if (i >=REG_TIMEOUT ) { + ret = -ETIMEDOUT ; goto fail; + } ret =get_registers (pegasus, EpromData,2 , &retdatai); +if (ret <0 ) + goto fail; *retdata =le16_to_cpu (retdatai);return ret; fail: -netif_warn (pegasus, drv, pegasus->net,"%s failed\n" , __func__); -return -ETIMEDOUT ; +netif_dbg (pegasus, drv, pegasus->net,"%s failed\n" , __func__); +return ret; }#ifdef PEGASUS_WRITE_EEPROM
@@ -324,10 +344,10 @@ static int write_eprom_word(pegasus_t *pegasus, __u8 index, __u16 data)return ret; fail: -netif_warn (pegasus, drv, pegasus->net,"%s failed\n" , __func__); +netif_dbg (pegasus, drv, pegasus->net,"%s failed\n" , __func__); return -ETIMEDOUT; } -#endif /* PEGASUS_WRITE_EEPROM */ +#endif /* PEGASUS_WRITE_EEPROM */ static inline int get_node_id (pegasus_t *pegasus,u8 *id) {
@@ -367,19 +387,21 @@ static void set_ethernet_addr(pegasus_t *pegasus)return ; err:eth_hw_addr_random (pegasus->net); -dev_info (&pegasus->intf->dev,"software assigned MAC address.\n" ); +netif_dbg (pegasus, drv, pegasus->net,"software assigned MAC address.\n" );return ; }static inline int reset_mac (pegasus_t *pegasus) { +int ret, i;__u8 data =0x8 ; -int i;set_register (pegasus, EthCtrl1, data);for (i =0 ; i <REG_TIMEOUT ; i++) { -get_registers (pegasus, EthCtrl1,1 , &data); + ret =get_registers (pegasus, EthCtrl1,1 , &data); +if (ret <0 ) + goto fail;if (~data &0x08 ) {if (loopback)break ;
@@ -402,22 +424,29 @@ static inline int reset_mac(pegasus_t *pegasus) }if (usb_dev_id[pegasus->dev_index].vendor ==VENDOR_ELCON ) {__u16 auxmode; -read_mii_word (pegasus,3 ,0x1b , &auxmode); + ret =read_mii_word (pegasus,3 ,0x1b , &auxmode); +if (ret <0 ) + goto fail; auxmode |=4 ;write_mii_word (pegasus,3 ,0x1b , &auxmode); }return 0 ; +fail: +netif_dbg (pegasus, drv, pegasus->net,"%s failed\n" , __func__); +return ret; }static int enable_net_traffic (struct net_device *dev,struct usb_device *usb) { -__u16 linkpart; -__u8 data[4 ];pegasus_t *pegasus =netdev_priv (dev);int ret; +__u16 linkpart; +__u8 data[4 ]; -read_mii_word (pegasus, pegasus->phy,MII_LPA , &linkpart); + ret =read_mii_word (pegasus, pegasus->phy,MII_LPA , &linkpart); +if (ret <0 ) + goto fail; data[0 ] =0xc8 ;/* TX & RX enable, append status, no CRC */ data[1 ] =0 ;if (linkpart & (ADVERTISE_100FULL |ADVERTISE_10FULL ))
@@ -435,11 +464,16 @@ static int enable_net_traffic(struct net_device *dev, struct usb_device *usb) usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS2 || usb_dev_id[pegasus->dev_index].vendor == VENDOR_DLINK) {u16 auxmode; -read_mii_word (pegasus,0 ,0x1b , &auxmode); + ret =read_mii_word (pegasus,0 ,0x1b , &auxmode); +if (ret <0 ) + goto fail; auxmode |=4 ;write_mii_word (pegasus,0 ,0x1b , &auxmode); } +return 0 ; +fail: +netif_dbg (pegasus, drv, pegasus->net,"%s failed\n" , __func__);return ret; }
@@ -447,9 +481,9 @@ static void read_bulk_callback(struct urb *urb) {pegasus_t *pegasus = urb->context;struct net_device *net; +u8 *buf = urb->transfer_buffer;int rx_status, count = urb->actual_length;int status = urb->status; -u8 *buf = urb->transfer_buffer;__u16 pkt_len;if (!pegasus)
@@ -1005,8 +1039,7 @@ static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd) data[0 ] = pegasus->phy; fallthrough;case SIOCDEVPRIVATE +1 : -read_mii_word (pegasus, data[0 ], data[1 ] &0x1f , &data[3 ]); - res =0 ; + res =read_mii_word (pegasus, data[0 ], data[1 ] &0x1f , &data[3 ]);break ;case SIOCDEVPRIVATE +2 :if (!capable (CAP_NET_ADMIN ))
@@ -1040,22 +1073,25 @@ static void pegasus_set_multicast(struct net_device *net)static __u8 mii_phy_probe (pegasus_t *pegasus) { -int i; +int i, ret;__u16 tmp;for (i =0 ; i <32 ; i++) { -read_mii_word (pegasus, i,MII_BMSR , &tmp); + ret =read_mii_word (pegasus, i,MII_BMSR , &tmp); +if (ret <0 ) + goto fail;if (tmp ==0 || tmp ==0xffff || (tmp &BMSR_MEDIA ) ==0 )continue ;else return i; } - +fail:return 0xff ; }static inline void setup_pegasus_II (pegasus_t *pegasus) { +int ret;__u8 data =0xa5 ;set_register (pegasus, Reg1d,0 );
@@ -1067,7 +1103,9 @@ static inline void setup_pegasus_II(pegasus_t *pegasus)set_register (pegasus, Reg7b,2 );set_register (pegasus,0x83 , data); -get_registers (pegasus,0x83 ,1 , &data); + ret =get_registers (pegasus,0x83 ,1 , &data); +if (ret <0 ) + goto fail;if (data ==0xa5 ) pegasus->chip =0x8513 ;
@@ -1082,6 +1120,10 @@ static inline void setup_pegasus_II(pegasus_t *pegasus)set_register (pegasus, Reg81,6 ); else set_register(pegasus, Reg81, 2); + + return; +fail: + netif_dbg(pegasus, drv, pegasus->net, "%s failed\n", __func__); } static void check_carrier(struct work_struct *work)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 31/98 net: usb: lan78xx: don't modify phy_device state concurrently
In reply to Sasha LevinFrom: "Ivan T. Ivanov" <[email protected]>
[ Upstream commit 6b67d4d63edece1033972214704c04f36c5be89a ]
Currently phy_device state could be left in inconsistent state shown by following alert message[1]. This is because phy_read_status could be called concurrently from lan78xx_delayedwork, phy_state_machine and __ethtool_get_link. Fix this by making sure that phy_device state is updated atomically.
[1] lan78xx 1-1.1.1:1.0 eth0: No phy led trigger registered for speed(-1)
--- drivers/net/usb/lan78xx.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/net/usb/lan78xx.c +12 -4
@@ -1159,7 +1159,7 @@ static int lan78xx_link_reset(struct lan78xx_net *dev) {struct phy_device *phydev = dev->net->phydev;struct ethtool_link_ksettings ecmd; -int ladv, radv, ret; +int ladv, radv, ret, link;u32 buf;/* clear LAN78xx interrupt status */
@@ -1167,9 +1167,12 @@ static int lan78xx_link_reset(struct lan78xx_net *dev)if (unlikely (ret <0 ))return -EIO ; +mutex_lock (&phydev->lock);phy_read_status (phydev); + link = phydev->link; +mutex_unlock (&phydev->lock); -if (!phydev->link && dev->link_on) { +if (!link && dev->link_on) { dev->link_on = false;/* reset MAC */
@@ -1182,7 +1185,7 @@ static int lan78xx_link_reset(struct lan78xx_net *dev)return -EIO ;del_timer (&dev->stat_monitor); - }else if (phydev->link && !dev->link_on) { + }else if (link && !dev->link_on) { dev->link_on = true;phy_ethtool_ksettings_get (phydev, &ecmd);
@@ -1471,9 +1474,14 @@ static int lan78xx_set_eee(struct net_device *net, struct ethtool_eee *edata)static u32 lan78xx_get_link (struct net_device *net) { +u32 link; + +mutex_lock (&net->phydev->lock);phy_read_status (net->phydev); + link = net->phydev->link; +mutex_unlock (&net->phydev->lock); -return net->phydev->link; +return link; } static void lan78xx_get_drvinfo(struct net_device *net,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 32/98 drm/amd/display: Fix Dynamic bpp issue with 8K30 with Navi 1X
In reply to Sasha LevinFrom: Bing Guo <[email protected]>
[ Upstream commit 06050a0f01dbac2ca33145ef19a72041206ea983 ]
Why:
In DCN2x, HW doesn't automatically divide MASTER_UPDATE_LOCK_DB_X by the number of pipes ODM Combined.
How:
Set MASTER_UPDATE_LOCK_DB_X to the value that is adjusted by the number of pipes ODM Combined.
--- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.c +1 -1
@@ -357,7 +357,7 @@ void optc2_lock_doublebuffer_enable(struct timing_generator *optc)REG_UPDATE_2 (OTG_GLOBAL_CONTROL1 ,MASTER_UPDATE_LOCK_DB_X , - h_blank_start -200 -1 , + (h_blank_start -200 -1 ) / optc1->opp_count,MASTER_UPDATE_LOCK_DB_Y , v_blank_start -1 ); }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 33/98 drm/amd/display: workaround for hard hang on HPD on native DP
In reply to Sasha LevinFrom: Qingqing Zhuo <[email protected]>
[ Upstream commit c4152b297d56d3696ad0a9003169bc5b98ad7b72 ]
[Why]
HPD disable and enable sequences are not mutually exclusive on Linux. For HPDs that spans over 1s (i.e. HPD low = 1s), part of the disable sequence (specifically, a request to SMU to lower refclk) could come right before the call to PHY enable, causing DMUB to access an unresponsive PHY and thus a hard hang on the system.
[How]
Disable 48mhz refclk off on native DP.
--- drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +3 -1
@@ -66,9 +66,11 @@ int rn_get_active_display_cnt_wa(for (i =0 ; i < context->stream_count; i++) {const struct dc_stream_state *stream = context->streams[i]; +/* Extend the WA to DP for Linux*/ if (stream->signal ==SIGNAL_TYPE_HDMI_TYPE_A || stream->signal ==SIGNAL_TYPE_DVI_SINGLE_LINK || - stream->signal ==SIGNAL_TYPE_DVI_DUAL_LINK ) + stream->signal ==SIGNAL_TYPE_DVI_DUAL_LINK || + stream->signal ==SIGNAL_TYPE_DISPLAY_PORT ) tmds_present = true; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 34/98 Bluetooth: hidp: use correct wait queue when removing ctrl_wait
In reply to Sasha LevinFrom: Ole Bjørn Midtbø <[email protected]>
[ Upstream commit cca342d98bef68151a80b024f7bf5f388d1fbdea ]
A different wait queue was used when removing ctrl_wait than when adding it. This effectively made the remove operation without locking compared to other operations on the wait queue ctrl_wait was part of. This caused issues like below where dead000000000100 is LIST_POISON1 and dead000000000200 is LIST_POISON2.
list_add corruption. next->prev should be prev (ffffffc1b0a33a08), \ but was dead000000000200. (next=ffffffc03ac77de0). ------------[ cut here ]------------ CPU: 3 PID: 2138 Comm: bluetoothd Tainted: G O 4.4.238+ #9 ... ---[ end trace 0adc2158f0646eac ]--- Call trace: [<ffffffc000443f78>] __list_add+0x38/0xb0 [<ffffffc0000f0d04>] add_wait_queue+0x4c/0x68 [<ffffffc00020eecc>] __pollwait+0xec/0x100 [<ffffffc000d1556c>] bt_sock_poll+0x74/0x200 [<ffffffc000bdb8a8>] sock_poll+0x110/0x128 [<ffffffc000210378>] do_sys_poll+0x220/0x480 [<ffffffc0002106f0>] SyS_poll+0x80/0x138 [<ffffffc00008510c>] __sys_trace_return+0x0/0x4 Unable to handle kernel paging request at virtual address dead000000000100 ... CPU: 4 PID: 5387 Comm: kworker/u15:3 Tainted: G W O 4.4.238+ #9 ... Call trace: [<ffffffc0000f079c>] __wake_up_common+0x7c/0xa8 [<ffffffc0000f0818>] __wake_up+0x50/0x70 [<ffffffc000be11b0>] sock_def_wakeup+0x58/0x60 [<ffffffc000de5e10>] l2cap_sock_teardown_cb+0x200/0x224 [<ffffffc000d3f2ac>] l2cap_chan_del+0xa4/0x298 [<ffffffc000d45ea0>] l2cap_conn_del+0x118/0x198 [<ffffffc000d45f8c>] l2cap_disconn_cfm+0x6c/0x78 [<ffffffc000d29934>] hci_event_packet+0x564/0x2e30 [<ffffffc000d19b0c>] hci_rx_work+0x10c/0x360 [<ffffffc0000c2218>] process_one_work+0x268/0x460 [<ffffffc0000c2678>] worker_thread+0x268/0x480 [<ffffffc0000c94e0>] kthread+0x118/0x128 [<ffffffc000085070>] ret_from_fork+0x10/0x20 ---[ end trace 0adc2158f0646ead ]---
--- net/bluetooth/hidp/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hidp/core.c +1 -1
@@ -1290,7 +1290,7 @@ static int hidp_session_thread(void *arg)/* cleanup runtime environment */ remove_wait_queue (sk_sleep (session->intr_sock->sk), &intr_wait); -remove_wait_queue (sk_sleep (session->intr_sock->sk), &ctrl_wait); +remove_wait_queue (sk_sleep (session->ctrl_sock->sk), &ctrl_wait);wake_up_interruptible (&session->report_queue);hidp_del_timer (session);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 35/98 arm64: dts: qcom: c630: fix correct powerdown pin for WSA881x
In reply to Sasha LevinFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit 9a253bb42f190efd1a1c156939ad7298b3529dca ]
WSA881x powerdown pin is connected to GPIO1, GPIO2 not GPIO2 and GPIO3, so correct this. This was working so far due to a shift bug in gpio driver, however once that is fixed this will stop working, so fix this!
For some reason we forgot to add this dts change in last merge cycle so currently audio is broken in 5.13 as the gpio driver fix already landed in 5.13.
--- arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts +2 -2
@@ -564,7 +564,7 @@ left_spkr: wsa8810-left{ compatible = "sdw10217211000"; reg = <0 3>; - powerdown-gpios = <&wcdgpio 2 GPIO_ACTIVE_HIGH>; + powerdown-gpios = <&wcdgpio 1 GPIO_ACTIVE_HIGH>; #thermal-sensor-cells = <0>; sound-name-prefix = "SpkrLeft"; #sound-dai-cells = <0>;
@@ -572,7 +572,7 @@ right_spkr: wsa8810-right{ compatible = "sdw10217211000"; - powerdown-gpios = <&wcdgpio 3 GPIO_ACTIVE_HIGH>; + powerdown-gpios = <&wcdgpio 2 GPIO_ACTIVE_HIGH>; reg = <0 4>; #thermal-sensor-cells = <0>; sound-name-prefix = "SpkrRight";
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 36/98 arm64: dts: qcom: msm8992-bullhead: Remove PSCI
In reply to Sasha LevinFrom: Petr Vorel <[email protected]>
[ Upstream commit 9d1fc2e4f5a94a492c7dd1ca577c66fdb7571c84 ]
Bullhead firmware obviously doesn't support PSCI as it fails to boot with this definition.
--- arch/arm64/boot/dts/qcom/msm8992-bullhead-rev-101.dts | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/qcom/msm8992-bullhead-rev-101.dts +4 -0
@@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2015, LGE Inc. All rights reserved. * Copyright (c) 2016, The Linux Foundation. All rights reserved. + * Copyright (c) 2021, Petr Vorel <[email protected]> */ /dts-v1/;
@@ -15,6 +16,9 @@ qcom,board-id = <0xb64 0>; qcom,pmic-id = <0x10009 0x1000A 0x0 0x0>; + /* Bullhead firmware doesn't support PSCI */ + /delete-node/ psci; + aliases { serial0 = &blsp1_uart2; };
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 37/98 iommu: Check if group is NULL before remove device
In reply to Sasha LevinFrom: Frank Wunderlich <[email protected]>
[ Upstream commit 5aa95d8834e07907e64937d792c12ffef7fb271f ]
If probe_device is failing, iommu_group is not initialized because iommu_group_add_device is not reached, so freeing it will result in NULL pointer access.
iommu_bus_init
->bus_iommu_probe
->probe_iommu_group in for each:/* return -22 in fail case */
->iommu_probe_device
->__iommu_probe_device /* return -22 here.*/
-> ops->probe_device /* return -22 here.*/
-> iommu_group_get_for_dev
-> ops->device_group
-> iommu_group_add_device //good case
->remove_iommu_group //in fail case, it will remove group
->iommu_release_device
->iommu_group_remove_device // here we don't have groupIn my case ops->probe_device (mtk_iommu_probe_device from mtk_iommu_v1.c) is due to failing fwspec->ops mismatch.
--- drivers/iommu/iommu.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iommu/iommu.c +3 -0
@@ -879,6 +879,9 @@ void iommu_group_remove_device(struct device *dev)struct iommu_group *group = dev->iommu_group;struct group_device *tmp_device, *device =NULL ; +if (!group) +return ; +dev_info (dev,"Removing from iommu group %d\n" , group->id);/* Pre-notify listeners that a device is being removed. */
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 38/98 cpufreq: armada-37xx: forbid cpufreq for 1.2 GHz variant
In reply to Sasha LevinFrom: Marek Behún <[email protected]>
[ Upstream commit 484f2b7c61b9ae58cc00c5127bcbcd9177af8dfe ]
The 1.2 GHz variant of the Armada 3720 SOC is unstable with DVFS: when the SOC boots, the WTMI firmware sets clocks and AVS values that work correctly with 1.2 GHz CPU frequency, but random crashes occur once cpufreq driver starts scaling.
We do not know currently what is the reason:
- it may be that the voltage value for L0 for 1.2 GHz variant provided by the vendor in the OTP is simply incorrect when scaling is used,
- it may be that some delay is needed somewhere,
- it may be something else.
The most sane solution now seems to be to simply forbid the cpufreq driver on 1.2 GHz variant.
--- drivers/cpufreq/armada-37xx-cpufreq.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/cpufreq/armada-37xx-cpufreq.c +5 -1
@@ -102,7 +102,11 @@ struct armada_37xx_dvfs { };static struct armada_37xx_dvfs armada_37xx_dvfs[] = { - {.cpu_freq_max =1200 *1000 *1000 , .divider = {1 ,2 ,4 ,6 } }, +/* +* The cpufreq scaling for 1.2 GHz variant of the SOC is currently +* unstable because we do not know how to configure it properly. +*/ +/* {.cpu_freq_max = 1200*1000*1000, .divider = {1, 2, 4, 6} }, */ {.cpu_freq_max =1000 *1000 *1000 , .divider = {1 ,2 ,4 ,5 } }, {.cpu_freq_max =800 *1000 *1000 , .divider = {1 ,2 ,3 ,4 } }, {.cpu_freq_max =600 *1000 *1000 , .divider = {2 ,4 ,5 ,6 } },
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 39/98 dccp: add do-while-0 stubs for dccp_pr_debug macros
In reply to Sasha LevinFrom: Randy Dunlap <[email protected]>
[ Upstream commit 86aab09a4870bb8346c9579864588c3d7f555299 ]
GCC complains about empty macros in an 'if' statement, so convert them to 'do {} while (0)' macros.
Fixes these build warnings:
net/dccp/output.c: In function 'dccp_xmit_packet':../net/dccp/output.c:283:71: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
283 | dccp_pr_debug("transmit_skb() returned err=%d\n", err);net/dccp/ackvec.c: In function 'dccp_ackvec_update_old':../net/dccp/ackvec.c:163:80: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
163 | (unsigned long long)seqno, state);
--- net/dccp/dccp.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/dccp/dccp.h +3 -3
@@ -41,9 +41,9 @@ extern bool dccp_debug; #define dccp_pr_debug_cat(format, a...) DCCP_PRINTK(dccp_debug, format, ##a) #define dccp_debug(fmt, a...) dccp_pr_debug_cat(KERN_DEBUG fmt, ##a)#else -#define dccp_pr_debug(format, a...) -#define dccp_pr_debug_cat(format, a...) -#define dccp_debug(format, a...) +#define dccp_pr_debug(format, a...) do {} while (0) +#define dccp_pr_debug_cat(format, a...) do {} while (0) +#define dccp_debug(format, a...) do {} while (0)#endif extern struct inet_hashinfo dccp_hashinfo;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 40/98 virtio: Protect vqs list access
In reply to Sasha LevinFrom: Parav Pandit <[email protected]>
[ Upstream commit 0e566c8f0f2e8325e35f6f97e13cde5356b41814 ]
VQs may be accessed to mark the device broken while they are created/destroyed. Hence protect the access to the vqs list.
--- drivers/virtio/virtio.c | 1 + drivers/virtio/virtio_ring.c | 8 ++++++++ include/linux/virtio.h | 1 + 3 files changed, 10 insertions(+)
drivers/virtio/virtio.c +1 -0
@@ -357,6 +357,7 @@ int register_virtio_device(struct virtio_device *dev)virtio_add_status (dev,VIRTIO_CONFIG_S_ACKNOWLEDGE );INIT_LIST_HEAD (&dev->vqs); +spin_lock_init (&dev->vqs_list_lock);/* * device_add() causes the bus infrastructure to look for a matching
drivers/virtio/virtio_ring.c +8 -0
@@ -1668,7 +1668,9 @@ static struct virtqueue *vring_create_virtqueue_packed(cpu_to_le16 (vq->packed.event_flags_shadow); } +spin_lock (&vdev->vqs_list_lock);list_add_tail (&vq->vq.list, &vdev->vqs); +spin_unlock (&vdev->vqs_list_lock);return &vq->vq; err_desc_extra:
@@ -2126,7 +2128,9 @@ struct virtqueue *__vring_new_virtqueue(unsigned int index,memset (vq->split.desc_state,0 , vring.num *sizeof (struct vring_desc_state_split )); +spin_lock (&vdev->vqs_list_lock);list_add_tail (&vq->vq.list, &vdev->vqs); +spin_unlock (&vdev->vqs_list_lock);return &vq->vq; }EXPORT_SYMBOL_GPL (__vring_new_virtqueue);
@@ -2210,7 +2214,9 @@ void vring_del_virtqueue(struct virtqueue *_vq) }if (!vq->packed_ring)kfree (vq->split.desc_state); +spin_lock (&vq->vq.vdev->vqs_list_lock);list_del (&_vq->list); +spin_unlock (&vq->vq.vdev->vqs_list_lock);kfree (vq); }EXPORT_SYMBOL_GPL (vring_del_virtqueue);
@@ -2274,10 +2280,12 @@ void virtio_break_device(struct virtio_device *dev) {struct virtqueue *_vq; +spin_lock (&dev->vqs_list_lock);list_for_each_entry (_vq, &dev->vqs, list) {struct vring_virtqueue *vq =to_vvq (_vq); vq->broken = true; } +spin_unlock (&dev->vqs_list_lock); }EXPORT_SYMBOL_GPL (virtio_break_device);
include/linux/virtio.h +1 -0
@@ -110,6 +110,7 @@ struct virtio_device {bool config_enabled;bool config_change_pending;spinlock_t config_lock; +spinlock_t vqs_list_lock;/* Protects VQs list access */ struct device dev;struct virtio_device_id id;const struct virtio_config_ops *config;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 41/98 vhost-vdpa: Fix integer overflow in vhost_vdpa_process_iotlb_update()
In reply to Sasha LevinFrom: Xie Yongji <[email protected]>
[ Upstream commit 0e398290cff997610b66e73573faaee70c9a700e ]
The "msg->iova + msg->size" addition can have an integer overflow if the iotlb message is from a malicious user space application. So let's fix it.
--- drivers/vhost/vdpa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/vhost/vdpa.c +2 -1
@@ -623,7 +623,8 @@ static int vhost_vdpa_process_iotlb_update(struct vhost_vdpa *v,long pinned;int ret =0 ; -if (msg->iova < v->range.first || +if (msg->iova < v->range.first || !msg->size || + msg->iova >U64_MAX - msg->size +1 || msg->iova + msg->size -1 > v->range.last)return -EINVAL ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 42/98 bus: ti-sysc: Fix error handling for sysc_check_active_timer()
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
[ Upstream commit 06a089ef644934372a3062528244fca3417d3430 ]
We have changed the return type for sysc_check_active_timer() from -EBUSY to -ENXIO, but the gpt12 system timer fix still checks for -EBUSY. We are also not returning on other errors like we did earlier as noted by Pavel Machek <[email protected]>.
Commit 3ff340e24c9d ("bus: ti-sysc: Fix gpt12 system timer issue with reserved status") should have been updated for commit 65fb73676112 ("bus: ti-sysc: suppress err msg for timers used as clockevent/source").
Let's fix the issue by checking for -ENXIO and returning on any other errors as suggested by Pavel Machek <[email protected]>.
Depends-on: 65fb73676112 ("bus: ti-sysc: suppress err msg for timers used as clockevent/source")
--- drivers/bus/ti-sysc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/bus/ti-sysc.c +3 -1
@@ -3061,8 +3061,10 @@ static int sysc_probe(struct platform_device *pdev)return error; error =sysc_check_active_timer (ddata); -if (error == -EBUSY ) +if (error == -ENXIO ) ddata->reserved = true; +else if (error) +return error; error =sysc_get_clocks (ddata);if (error)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 43/98 vhost: Fix the calculation in vhost_overflow()
In reply to Sasha LevinFrom: Xie Yongji <[email protected]>
[ Upstream commit f7ad318ea0ad58ebe0e595e59aed270bb643b29b ]
This fixes the incorrect calculation for integer overflow when the last address of iova range is 0xffffffff.
--- drivers/vhost/vhost.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/vhost/vhost.c +8 -2
@@ -735,10 +735,16 @@ static bool log_access_ok(void __user *log_base, u64 addr, unsigned long sz) (sz + VHOST_PAGE_SIZE * 8 - 1) / VHOST_PAGE_SIZE / 8); } +/* Make sure 64 bit math will not overflow. */ static bool vhost_overflow (u64 uaddr,u64 size) { -/* Make sure 64 bit math will not overflow. */ -return uaddr >ULONG_MAX || size >ULONG_MAX || uaddr >ULONG_MAX - size; +if (uaddr >ULONG_MAX || size >ULONG_MAX ) +return true; + +if (!size) +return false; + +return uaddr >ULONG_MAX - size +1 ; }/* Caller should have vq mutex and device mutex. */
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 44/98 vdpa/mlx5: Avoid destroying MR on empty iotlb
In reply to Sasha LevinFrom: Eli Cohen <[email protected]>
[ Upstream commit 08dbd5660232bede7916d8568003012c1182cc9a ]
The current code treats an empty iotlb provdied in set_map() as a special case and destroy the memory region object. This must not be done since the virtqueue objects reference this MR. Doing so will cause the driver unload to emit errors and log timeouts caused by the firmware complaining on busy resources.
This patch treats an empty iotlb as any other change of mapping. In this case, mlx5_vdpa_create_mr() will fail and the entire set_map() call to fail.
This issue has not been encountered before but was seen to occur in a non-official version of qemu. Since qemu is a userspace program, the driver must protect against such case.
--- drivers/vdpa/mlx5/core/mr.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/vdpa/mlx5/core/mr.c +0 -9
@@ -454,11 +454,6 @@ out:mutex_unlock (&mr->mkey_mtx); } -static bool map_empty (struct vhost_iotlb *iotlb) -{ -return !vhost_iotlb_itree_first (iotlb,0 ,U64_MAX ); -} -int mlx5_vdpa_handle_set_map (struct mlx5_vdpa_dev *mvdev,struct vhost_iotlb *iotlb,bool *change_map) {
@@ -466,10 +461,6 @@ int mlx5_vdpa_handle_set_map(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *ioint err =0 ; *change_map = false; -if (map_empty (iotlb)) { -mlx5_vdpa_destroy_mr (mvdev); -return 0 ; - }mutex_lock (&mr->mkey_mtx);if (mr->initialized) {mlx5_vdpa_info (mvdev,"memory map update\n" );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 45/98 soc / drm: mediatek: Move DDP component defines into mtk-mmsys.h
In reply to Sasha LevinFrom: Yongqiang Niu <[email protected]>
[ Upstream commit 51c0e618b219c025ddaaf14baea8942cb7e2105b ]
MMSYS is the driver which controls the routing of these DDP components, so the definition of the mtk_ddp_comp_id enum should be placed in mtk-mmsys.h
--- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 34 +-------------------- drivers/soc/mediatek/mtk-mmsys.c | 4 +-- include/linux/soc/mediatek/mtk-mmsys.h | 33 ++++++++++++++++++++ 3 files changed, 35 insertions(+), 36 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h +1 -33
@@ -7,6 +7,7 @@#define MTK_DRM_DDP_COMP_H #include <linux/io.h> +#include <linux/soc/mediatek/mtk-mmsys.h> struct device ;struct device_node ;
@@ -35,39 +36,6 @@ enum mtk_ddp_comp_type { MTK_DDP_COMP_TYPE_MAX, }; -enum mtk_ddp_comp_id { -DDP_COMPONENT_AAL0 , -DDP_COMPONENT_AAL1 , -DDP_COMPONENT_BLS , -DDP_COMPONENT_CCORR , -DDP_COMPONENT_COLOR0 , -DDP_COMPONENT_COLOR1 , -DDP_COMPONENT_DITHER , -DDP_COMPONENT_DPI0 , -DDP_COMPONENT_DPI1 , -DDP_COMPONENT_DSI0 , -DDP_COMPONENT_DSI1 , -DDP_COMPONENT_DSI2 , -DDP_COMPONENT_DSI3 , -DDP_COMPONENT_GAMMA , -DDP_COMPONENT_OD0 , -DDP_COMPONENT_OD1 , -DDP_COMPONENT_OVL0 , -DDP_COMPONENT_OVL_2L0 , -DDP_COMPONENT_OVL_2L1 , -DDP_COMPONENT_OVL1 , -DDP_COMPONENT_PWM0 , -DDP_COMPONENT_PWM1 , -DDP_COMPONENT_PWM2 , -DDP_COMPONENT_RDMA0 , -DDP_COMPONENT_RDMA1 , -DDP_COMPONENT_RDMA2 , -DDP_COMPONENT_UFOE , -DDP_COMPONENT_WDMA0 , -DDP_COMPONENT_WDMA1 , -DDP_COMPONENT_ID_MAX , -}; -struct mtk_ddp_comp ;struct cmdq_pkt ;struct mtk_ddp_comp_funcs {
drivers/soc/mediatek/mtk-mmsys.c +1 -3
@@ -5,13 +5,11 @@*/ #include <linux/device.h> +#include <linux/io.h> #include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/soc/mediatek/mtk-mmsys.h> -#include "../../gpu/drm/mediatek/mtk_drm_ddp.h" -#include "../../gpu/drm/mediatek/mtk_drm_ddp_comp.h" -#define DISP_REG_CONFIG_DISP_OVL0_MOUT_EN 0x040#define DISP_REG_CONFIG_DISP_OVL1_MOUT_EN 0x044#define DISP_REG_CONFIG_DISP_OD_MOUT_EN 0x048
include/linux/soc/mediatek/mtk-mmsys.h +33 -0
@@ -9,6 +9,39 @@enum mtk_ddp_comp_id ;struct device ; +enum mtk_ddp_comp_id { +DDP_COMPONENT_AAL0 , +DDP_COMPONENT_AAL1 , +DDP_COMPONENT_BLS , +DDP_COMPONENT_CCORR , +DDP_COMPONENT_COLOR0 , +DDP_COMPONENT_COLOR1 , +DDP_COMPONENT_DITHER , +DDP_COMPONENT_DPI0 , +DDP_COMPONENT_DPI1 , +DDP_COMPONENT_DSI0 , +DDP_COMPONENT_DSI1 , +DDP_COMPONENT_DSI2 , +DDP_COMPONENT_DSI3 , +DDP_COMPONENT_GAMMA , +DDP_COMPONENT_OD0 , +DDP_COMPONENT_OD1 , +DDP_COMPONENT_OVL0 , +DDP_COMPONENT_OVL_2L0 , +DDP_COMPONENT_OVL_2L1 , +DDP_COMPONENT_OVL1 , +DDP_COMPONENT_PWM0 , +DDP_COMPONENT_PWM1 , +DDP_COMPONENT_PWM2 , +DDP_COMPONENT_RDMA0 , +DDP_COMPONENT_RDMA1 , +DDP_COMPONENT_RDMA2 , +DDP_COMPONENT_UFOE , +DDP_COMPONENT_WDMA0 , +DDP_COMPONENT_WDMA1 , +DDP_COMPONENT_ID_MAX , +}; +void mtk_mmsys_ddp_connect (struct device *dev,enum mtk_ddp_comp_id cur,enum mtk_ddp_comp_id next);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 46/98 drm/mediatek: Fix aal size config
In reply to Sasha LevinFrom: Yongqiang Niu <[email protected]>
[ Upstream commit 71dcadba34203d8dd35152e368720f977e9cdb81 ]
The orginal setting is not correct, fix it to follow hardware data sheet. If keep this error setting, mt8173/mt8183 display ok
but mt8192 display abnormal.
--- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +1 -1
@@ -180,7 +180,7 @@ static void mtk_aal_config(struct mtk_ddp_comp *comp, unsigned int w, unsigned int h, unsigned int vrefresh, unsigned int bpc, struct cmdq_pkt *cmdq_pkt) { - mtk_ddp_write(cmdq_pkt, h << 16 | w, comp, DISP_AAL_SIZE); + mtk_ddp_write(cmdq_pkt, w << 16 | h, comp, DISP_AAL_SIZE); }static void mtk_aal_start (struct mtk_ddp_comp *comp)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 47/98 drm/mediatek: Add AAL output size configuration
In reply to Sasha LevinFrom: "jason-jh.lin" <[email protected]>
[ Upstream commit 71ac6f390f6a3017f58d05d677b961bb1f851338 ]
To avoid the output width and height is incorrect, AAL_OUTPUT_SIZE configuration should be set.
--- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +2 -0
@@ -34,6 +34,7 @@#define DISP_AAL_EN 0x0000#define DISP_AAL_SIZE 0x0030 +#define DISP_AAL_OUTPUT_SIZE 0x04d8#define DISP_CCORR_EN 0x0000#define CCORR_EN BIT(0)
@@ -181,6 +182,7 @@ static void mtk_aal_config(struct mtk_ddp_comp *comp, unsigned int w, unsigned int bpc, struct cmdq_pkt *cmdq_pkt) { mtk_ddp_write(cmdq_pkt, w << 16 | h, comp, DISP_AAL_SIZE); +mtk_ddp_write (cmdq_pkt, w <<16 | h, comp,DISP_AAL_OUTPUT_SIZE ); }static void mtk_aal_start (struct mtk_ddp_comp *comp)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 48/98 bpf: Clear zext_dst of dead insns
In reply to Sasha LevinFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit 45c709f8c71b525b51988e782febe84ce933e7e0 ]
"access skb fields ok" verifier test fails on s390 with the "verifier bug. zext_dst is set, but no reg is defined" message. The first insns of the test prog are ...
0: 61 01 00 00 00 00 00 00 ldxw %r0,[%r1+0]
8: 35 00 00 01 00 00 00 00 jge %r0,0,1
10: 61 01 00 08 00 00 00 00 ldxw %r0,[%r1+8]
... and the 3rd one is dead (this does not look intentional to me, but this is a separate topic).
sanitize_dead_code() converts dead insns into "ja -1", but keeps zext_dst. When opt_subreg_zext_lo32_rnd_hi32() tries to parse such an insn, it sees this discrepancy and bails. This problem can be seen only with JITs whose bpf_jit_needs_zext() returns true.
Fix by clearning dead insns' zext_dst.
The commits that contributed to this problem are:
1. 5aa5bd14c5f8 ("bpf: add initial suite for selftests"), which introduced the test with the dead code.
2. 5327ed3d44b7 ("bpf: verifier: mark verified-insn with sub-register zext flag"), which introduced the zext_dst flag.
3. 83a2881903f3 ("bpf: Account for BPF_FETCH in insn_has_def32()"), which introduced the sanity check.
4. 9183671af6db ("bpf: Fix leakage under speculation on mispredicted branches"), which bisect points to.
It's best to fix this on stable branches that contain the second one, since that's the point where the inconsistency was introduced.
--- kernel/bpf/verifier.c | 1 + 1 file changed, 1 insertion(+)
kernel/bpf/verifier.c +1 -0
@@ -10705,6 +10705,7 @@ static void sanitize_dead_code(struct bpf_verifier_env *env)if (aux_data[i].seen)continue ;memcpy (insn + i, &trap,sizeof (trap)); + aux_data[i].zext_dst = false; } }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 49/98 bnxt: don't lock the tx queue from napi poll
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 3c603136c9f82833813af77185618de5af67676c ]
We can't take the tx lock from the napi poll routine, because netpoll can poll napi at any moment, including with the tx lock already held.
The tx lock is protecting against two paths - the disable path, and (as Michael points out) the NETDEV_TX_BUSY case which may occur if NAPI completions race with start_xmit and both decide to re-enable the queue.
For the disable/ifdown path use synchronize_net() to make sure closing the device does not race we restarting the queues. Annotate accesses to dev_state against data races.
For the NAPI cleanup vs start_xmit path - appropriate barriers are already in place in the main spot where Tx queue is stopped but we need to do the same careful dance in the TX_BUSY case.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 54 ++++++++++++++--------- 1 file changed, 32 insertions(+), 22 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +32 -22
@@ -360,6 +360,26 @@ static u16 bnxt_xmit_get_cfa_action(struct sk_buff *skb)return md_dst->u.port_info.port_id; } +static bool bnxt_txr_netif_try_stop_queue (struct bnxt *bp, +struct bnxt_tx_ring_info *txr, +struct netdev_queue *txq) +{ +netif_tx_stop_queue (txq); + +/* netif_tx_stop_queue() must be done before checking +* tx index in bnxt_tx_avail() below, because in +* bnxt_tx_int(), we update tx index before checking for +* netif_tx_queue_stopped(). +*/ +smp_mb (); +if (bnxt_tx_avail (bp, txr) > bp->tx_wake_thresh) { +netif_tx_wake_queue (txq); +return false; + } + +return true; +} +static netdev_tx_t bnxt_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct bnxt *bp =netdev_priv (dev);
@@ -387,8 +407,8 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) free_size =bnxt_tx_avail (bp, txr);if (unlikely (free_size <skb_shinfo (skb)->nr_frags +2 )) { -netif_tx_stop_queue (txq); -return NETDEV_TX_BUSY ; +if (bnxt_txr_netif_try_stop_queue (bp, txr, txq)) +return NETDEV_TX_BUSY ; } length = skb->len;
@@ -597,16 +617,7 @@ tx_done:if (netdev_xmit_more () && !tx_buf->is_push)bnxt_db_write (bp, &txr->tx_db, prod); -netif_tx_stop_queue (txq); - -/* netif_tx_stop_queue() must be done before checking -* tx index in bnxt_tx_avail() below, because in -* bnxt_tx_int(), we update tx index before checking for -* netif_tx_queue_stopped(). -*/ -smp_mb (); -if (bnxt_tx_avail (bp, txr) > bp->tx_wake_thresh) -netif_tx_wake_queue (txq); +bnxt_txr_netif_try_stop_queue (bp, txr, txq); }return NETDEV_TX_OK ;
@@ -690,14 +701,9 @@ next_tx_int:smp_mb ();if (unlikely (netif_tx_queue_stopped (txq)) && - (bnxt_tx_avail (bp, txr) > bp->tx_wake_thresh)) { -__netif_tx_lock (txq,smp_processor_id ()); -if (netif_tx_queue_stopped (txq) && -bnxt_tx_avail (bp, txr) > bp->tx_wake_thresh && - txr->dev_state !=BNXT_DEV_STATE_CLOSING ) -netif_tx_wake_queue (txq); -__netif_tx_unlock (txq); - } +bnxt_tx_avail (bp, txr) > bp->tx_wake_thresh && +READ_ONCE (txr->dev_state) !=BNXT_DEV_STATE_CLOSING ) +netif_tx_wake_queue (txq); } static struct page *__bnxt_alloc_rx_page(struct bnxt *bp, dma_addr_t *mapping,
@@ -8885,9 +8891,11 @@ void bnxt_tx_disable(struct bnxt *bp)if (bp->tx_ring) {for (i =0 ; i < bp->tx_nr_rings; i++) { txr = &bp->tx_ring[i]; - txr->dev_state =BNXT_DEV_STATE_CLOSING ; +WRITE_ONCE (txr->dev_state,BNXT_DEV_STATE_CLOSING ); } } +/* Make sure napi polls see @dev_state change */ +synchronize_net ();/* Drop carrier first to prevent TX timeout */ netif_carrier_off (bp->dev);/* Stop all TX queues */
@@ -8901,8 +8909,10 @@ void bnxt_tx_enable(struct bnxt *bp)for (i =0 ; i < bp->tx_nr_rings; i++) { txr = &bp->tx_ring[i]; - txr->dev_state =0 ; +WRITE_ONCE (txr->dev_state,0 ); } +/* Make sure napi polls see @dev_state change */ +synchronize_net ();netif_tx_wake_all_queues (bp->dev);if (bp->link_info.link_up)netif_carrier_on (bp->dev);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 50/98 bnxt: disable napi before canceling DIM
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 01cca6b9330ac7460de44eeeb3a0607f8aae69ff ]
napi schedules DIM, napi has to be disabled first, then DIM canceled.
Noticed while reading the code.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -2
@@ -8855,10 +8855,9 @@ static void bnxt_disable_napi(struct bnxt *bp)for (i =0 ; i < bp->cp_nr_rings; i++) {struct bnxt_cp_ring_info *cpr = &bp->bnapi[i]->cp_ring; +napi_disable (&bp->bnapi[i]->napi);if (bp->bnapi[i]->rx_ring)cancel_work_sync (&cpr->dim.work); - -napi_disable (&bp->bnapi[i]->napi); } }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 51/98 bnxt: make sure xmit_more + errors does not miss doorbells
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit e8d8c5d80f5e9d4586c68061b62c642752289095 ]
skbs are freed on error and not put on the ring. We may, however, be in a situation where we're freeing the last skb of a batch, and there is a doorbell ring pending because of xmit_more() being true earlier. Make sure we ring the door bell in such situations.
Since errors are rare don't pay attention to xmit_more() and just always flush the pending frames.
The busy case should be safe to be left alone because it can only happen if start_xmit races with completions and they both enable the queue. In that case the kick can't be pending.
Noticed while reading the code.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 39 +++++++++++++++-------- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + 2 files changed, 27 insertions(+), 13 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +26 -13
@@ -69,7 +69,8 @@#include "bnxt_debugfs.h" #define BNXT_TX_TIMEOUT (5 * HZ) -#define BNXT_DEF_MSG_ENABLE (NETIF_MSG_DRV | NETIF_MSG_HW) +#define BNXT_DEF_MSG_ENABLE (NETIF_MSG_DRV | NETIF_MSG_HW | \ + NETIF_MSG_TX_ERR)MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Broadcom BCM573xx network driver" );
@@ -360,6 +361,13 @@ static u16 bnxt_xmit_get_cfa_action(struct sk_buff *skb)return md_dst->u.port_info.port_id; } +static void bnxt_txr_db_kick (struct bnxt *bp,struct bnxt_tx_ring_info *txr, +u16 prod) +{ +bnxt_db_write (bp, &txr->tx_db, prod); + txr->kick_pending =0 ; +} +static bool bnxt_txr_netif_try_stop_queue (struct bnxt *bp,struct bnxt_tx_ring_info *txr,struct netdev_queue *txq)
@@ -407,6 +415,10 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) free_size =bnxt_tx_avail (bp, txr);if (unlikely (free_size <skb_shinfo (skb)->nr_frags +2 )) { +/* We must have raced with NAPI cleanup */ +if (net_ratelimit () && txr->kick_pending) +netif_warn (bp, tx_err, dev, +"bnxt: ring busy w/ flush pending!\n" );if (bnxt_txr_netif_try_stop_queue (bp, txr, txq))return NETDEV_TX_BUSY ; }
@@ -510,21 +522,16 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) normal_tx:if (length <BNXT_MIN_PKT_SIZE ) { pad =BNXT_MIN_PKT_SIZE - length; -if (skb_pad (skb, pad)) { +if (skb_pad (skb, pad))/* SKB already freed. */ - tx_buf->skb =NULL ; -return NETDEV_TX_OK ; - } + goto tx_kick_pending; length =BNXT_MIN_PKT_SIZE ; } mapping =dma_map_single (&pdev->dev, skb->data, len,DMA_TO_DEVICE ); -if (unlikely (dma_mapping_error (&pdev->dev, mapping))) { -dev_kfree_skb_any (skb); - tx_buf->skb =NULL ; -return NETDEV_TX_OK ; - } +if (unlikely (dma_mapping_error (&pdev->dev, mapping))) + goto tx_free;dma_unmap_addr_set (tx_buf, mapping, mapping); flags = (len << TX_BD_LEN_SHIFT) | TX_BD_TYPE_LONG_TX_BD |
@@ -609,13 +616,15 @@ normal_tx: txr->tx_prod = prod;if (!netdev_xmit_more () ||netif_xmit_stopped (txq)) -bnxt_db_write (bp, &txr->tx_db, prod); +bnxt_txr_db_kick (bp, txr, prod); +else + txr->kick_pending =1 ; tx_done:if (unlikely (bnxt_tx_avail (bp, txr) <=MAX_SKB_FRAGS +1 )) {if (netdev_xmit_more () && !tx_buf->is_push) -bnxt_db_write (bp, &txr->tx_db, prod); +bnxt_txr_db_kick (bp, txr, prod);bnxt_txr_netif_try_stop_queue (bp, txr, txq); }
@@ -627,7 +636,6 @@ tx_dma_error:/* start back at beginning and unmap skb */ prod = txr->tx_prod; tx_buf = &txr->tx_buf_ring[prod]; - tx_buf->skb =NULL ;dma_unmap_single (&pdev->dev,dma_unmap_addr (tx_buf, mapping),skb_headlen (skb),PCI_DMA_TODEVICE ); prod =NEXT_TX (prod);
@@ -641,7 +649,12 @@ tx_dma_error: PCI_DMA_TODEVICE); } +tx_free:dev_kfree_skb_any (skb); +tx_kick_pending: +if (txr->kick_pending) +bnxt_txr_db_kick (bp, txr, txr->tx_prod); + txr->tx_buf_ring[txr->tx_prod].skb =NULL ;return NETDEV_TX_OK ; }
drivers/net/ethernet/broadcom/bnxt/bnxt.h +1 -0
@@ -770,6 +770,7 @@ struct bnxt_tx_ring_info {u16 tx_prod;u16 tx_cons;u16 txq_index; +u8 kick_pending;struct bnxt_db_info tx_db;struct tx_bd *tx_desc_ring[MAX_TX_PAGES ];
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 52/98 bnxt: count Tx drops
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit fb9f7190092d2bbd1f8f0b1cc252732cbe99a87e ]
Drivers should count packets they are dropping.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 -0
@@ -406,6 +406,7 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) i =skb_get_queue_mapping (skb);if (unlikely (i >= bp->tx_nr_rings)) {dev_kfree_skb_any (skb); +atomic_long_inc (&dev->tx_dropped);return NETDEV_TX_OK ; }
@@ -655,6 +656,7 @@ tx_kick_pending:if (txr->kick_pending)bnxt_txr_db_kick (bp, txr, txr->tx_prod); txr->tx_buf_ring[txr->tx_prod].skb =NULL ; +atomic_long_inc (&dev->tx_dropped);return NETDEV_TX_OK ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 53/98 net: 6pack: fix slab-out-of-bounds in decode_data
In reply to Sasha LevinFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 19d1532a187669ce86d5a2696eb7275310070793 ]
Syzbot reported slab-out-of bounds write in decode_data(). The problem was in missing validation checks.
Syzbot's reproducer generated malicious input, which caused decode_data() to be called a lot in sixpack_decode(). Since rx_count_cooked is only 400 bytes and noone reported before, that 400 bytes is not enough, let's just check if input is malicious and complain about buffer overrun.
Fail log:
==================================================================
BUG: KASAN: slab-out-of-bounds in drivers/net/hamradio/6pack.c:843 Write of size 1 at addr ffff888087c5544e by task kworker/u4:0/7 CPU: 0 PID: 7 Comm: kworker/u4:0 Not tainted 5.6.0-rc3-syzkaller #0 ... Workqueue: events_unbound flush_to_ldisc Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x197/0x210 lib/dump_stack.c:118 print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374 __kasan_report.cold+0x1b/0x32 mm/kasan/report.c:506 kasan_report+0x12/0x20 mm/kasan/common.c:641 __asan_report_store1_noabort+0x17/0x20 mm/kasan/generic_report.c:137 decode_data.part.0+0x23b/0x270 drivers/net/hamradio/6pack.c:843 decode_data drivers/net/hamradio/6pack.c:965 [inline] sixpack_decode drivers/net/hamradio/6pack.c:968 [inline]
--- drivers/net/hamradio/6pack.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/hamradio/6pack.c +6 -0
@@ -839,6 +839,12 @@ static void decode_data(struct sixpack *sp, unsigned char inbyte)return ; } +if (sp->rx_count_cooked +2 >=sizeof (sp->cooked_buf)) { +pr_err ("6pack: cooked buffer overrun, data loss\n" ); + sp->rx_count =0 ; +return ; + } + buf = sp->raw_buf; sp->cooked_buf[sp->rx_count_cooked++] = buf[0 ] | ((buf[1 ] <<2 ) &0xc0 );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 54/98 ptp_pch: Restore dependency on PCI
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 55c8fca1dae1fb0d11deaa21b65a647dedb1bc50 ]
During the swap dependency on PCH_GBE to selection PTP_1588_CLOCK_PCH incidentally dropped the implicit dependency on the PCI. Restore it.
--- drivers/ptp/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/ptp/Kconfig +2 -1
@@ -90,7 +90,8 @@ config PTP_1588_CLOCK_INES config PTP_1588_CLOCK_PCH tristate "Intel PCH EG20T as PTP clock" depends on X86_32 || COMPILE_TEST - depends on HAS_IOMEM && NET + depends on HAS_IOMEM && PCI + depends on NET imply PTP_1588_CLOCK help This driver adds support for using the PCH EG20T as a PTP
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 55/98 bnxt_en: Disable aRFS if running on 212 firmware
In reply to Sasha LevinFrom: Michael Chan <[email protected]>
[ Upstream commit 976e52b718c3de9077fff8f3f674afb159c57fb1 ]
212 firmware broke aRFS, so disable it. Traffic may stop after ntuple filters are inserted and deleted by the 212 firmware.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +3 -0
@@ -10396,6 +10396,9 @@ static bool bnxt_rfs_supported(struct bnxt *bp)return true;return false; } +/* 212 firmware is broken for aRFS */ +if (BNXT_FW_MAJ (bp) ==212 ) +return false;if (BNXT_PF (bp) && !BNXT_CHIP_TYPE_NITRO_A0 (bp))return true;if (bp->flags &BNXT_FLAG_NEW_RSS_CAP )
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 56/98 bnxt_en: Add missing DMA memory barriers
In reply to Sasha LevinFrom: Michael Chan <[email protected]>
[ Upstream commit 828affc27ed43441bd1efdaf4e07e96dd43a0362 ]
Each completion ring entry has a valid bit to indicate that the entry contains a valid completion event. The driver's main poll loop __bnxt_poll_work() has the proper dma_rmb() to make sure the valid bit of the next entry has been checked before proceeding further. But when we call bnxt_rx_pkt() to process the RX event, the RX completion event consists of two completion entries and only the first entry has been checked to be valid. We need the same barrier after checking the next completion entry. Add missing dma_rmb() barriers in bnxt_rx_pkt() and other similar locations.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +12 -0
@@ -1747,6 +1747,10 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,if (!RX_CMP_VALID (rxcmp1, tmp_raw_cons))return -EBUSY ; +/* The valid test of the entry must be done first before +* reading any further. +*/ +dma_rmb (); prod = rxr->rx_prod;if (cmp_type ==CMP_TYPE_RX_L2_TPA_START_CMP ) {
@@ -1950,6 +1954,10 @@ static int bnxt_force_rx_discard(struct bnxt *bp,if (!RX_CMP_VALID (rxcmp1, tmp_raw_cons))return -EBUSY ; +/* The valid test of the entry must be done first before +* reading any further. +*/ +dma_rmb (); cmp_type =RX_CMP_TYPE (rxcmp);if (cmp_type ==CMP_TYPE_RX_L2_CMP ) { rxcmp1->rx_cmp_cfa_code_errors_v2 |=
@@ -2394,6 +2402,10 @@ static int bnxt_poll_nitroa0(struct napi_struct *napi, int budget)if (!TX_CMP_VALID (txcmp, raw_cons))break ; +/* The valid test of the entry must be done first before +* reading any further. +*/ +dma_rmb ();if ((TX_CMP_TYPE (txcmp) &0x30 ) ==0x10 ) { tmp_raw_cons =NEXT_RAW_CMP (raw_cons); cp_cons =RING_CMP (tmp_raw_cons);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 57/98 vrf: Reset skb conntrack connection on VRF rcv
In reply to Sasha LevinFrom: Lahav Schlesinger <[email protected]>
[ Upstream commit 09e856d54bda5f288ef8437a90ab2b9b3eab83d1 ]
To fix the "reverse-NAT" for replies.
When a packet is sent over a VRF, the POST_ROUTING hooks are called
twice: Once from the VRF interface, and once from the "actual" interface the packet will be sent from:
1) First SNAT: l3mdev_l3_out() -> vrf_l3_out() -> .. -> vrf_output_direct() This causes the POST_ROUTING hooks to run.
2) Second SNAT: 'ip_output()' calls POST_ROUTING hooks again.
Similarly for replies, first ip_rcv() calls PRE_ROUTING hooks, and second vrf_l3_rcv() calls them again.
As an example, consider the following SNAT rule:
Quoted 1 line
iptables -t nat -A POSTROUTING -p udp -m udp --dport 53 -j SNAT --to-source 2.2.2.2 -o
vrf_1
In this case sending over a VRF will create 2 conntrack entries. The first is from the VRF interface, which performs the IP SNAT. The second will run the SNAT, but since the "expected reply" will remain the same, conntrack randomizes the source port of the packet:
e..g With a socket bound to 1.1.1.1:10000, sending to 3.3.3.3:53, the conntrack rules are:
udp 17 29 src=2.2.2.2 dst=3.3.3.3 sport=10000 dport=53 packets=1 bytes=68 [UNREPLIED] src=3.3.3.3 dst=2.2.2.2 sport=53 dport=61033 packets=0 bytes=0 mark=0 use=1
udp 17 29 src=1.1.1.1 dst=3.3.3.3 sport=10000 dport=53 packets=1 bytes=68 [UNREPLIED] src=3.3.3.3 dst=2.2.2.2 sport=53 dport=10000 packets=0 bytes=0 mark=0 use=1
i.e. First SNAT IP from 1.1.1.1 --> 2.2.2.2, and second the src port is SNAT-ed from 10000 --> 61033.
But when a reply is sent (3.3.3.3:53 -> 2.2.2.2:61033) only the later conntrack entry is matched:
udp 17 29 src=2.2.2.2 dst=3.3.3.3 sport=10000 dport=53 packets=1 bytes=68 src=3.3.3.3 dst=2.2.2.2 sport=53 dport=61033 packets=1 bytes=49 mark=0 use=1
udp 17 28 src=1.1.1.1 dst=3.3.3.3 sport=10000 dport=53 packets=1 bytes=68 [UNREPLIED] src=3.3.3.3 dst=2.2.2.2 sport=53 dport=10000 packets=0 bytes=0 mark=0 use=1
And a "port 61033 unreachable" ICMP packet is sent back.
The issue is that when PRE_ROUTING hooks are called from vrf_l3_rcv(), the skb already has a conntrack flow attached to it, which means nf_conntrack_in() will not resolve the flow again.
This means only the dest port is "reverse-NATed" (61033 -> 10000) but the dest IP remains 2.2.2.2, and since the socket is bound to 1.1.1.1 it's not received.
This can be verified by logging the 4-tuple of the packet in '__udp4_lib_rcv()'.
The fix is then to reset the flow when skb is received on a VRF, to let conntrack resolve the flow again (which now will hit the earlier flow).
To reproduce: (Without the fix "Got pkt_to_nat_port" will not be printed by
running 'bash ./repro'):
$ cat run_in_A1.py
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *
import argparse def get_packet_to_send(udp_dst_port, msg_name):
return Ether(src='11:22:33:44:55:66', dst=iface_mac)/ \
IP(src='3.3.3.3', dst='2.2.2.2')/ \
UDP(sport=53, dport=udp_dst_port)/ \
Raw(f'{msg_name}\x0012345678901234567890') parser = argparse.ArgumentParser() parser.add_argument('-iface_mac', dest="iface_mac", type=str, required=True,
help="From run_in_A3.py")
parser.add_argument('-socket_port', dest="socket_port", type=str,
required=True, help="From run_in_A3.py")
parser.add_argument('-v1_mac', dest="v1_mac", type=str, required=True,
help="From script")
args, _ = parser.parse_known_args()
iface_mac = args.iface_mac
socket_port = int(args.socket_port)
v1_mac = args.v1_mac
print(f'Source port before NAT: {socket_port}')
while True:
pkts = sniff(iface='_v0', store=True, count=1, timeout=10) if 0 == len(pkts):
print('Something failed, rerun the script :(', flush=True) break
pkt = pkts[0]
if not pkt.haslayer('UDP'):
continue
pkt_sport = pkt.getlayer('UDP').sport print(f'Source port after NAT: {pkt_sport}', flush=True)
pkt_to_send = get_packet_to_send(pkt_sport, 'pkt_to_nat_port') sendp(pkt_to_send, '_v0', verbose=False) # Will not be received
pkt_to_send = get_packet_to_send(socket_port, 'pkt_to_socket_port') sendp(pkt_to_send, '_v0', verbose=False)
break
$ cat run_in_A2.py import socket import netifaces
print(f"{netifaces.ifaddresses('e00000')[netifaces.AF_LINK][0]['addr']}",
flush=True)
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_BINDTODEVICE,
str('vrf_1' + '\0').encode('utf-8')) s.connect(('3.3.3.3', 53))
print(f'{s. getsockname()[1]}', flush=True)
s.settimeout(5)
while True:
try:
# Periodically send in order to keep the conntrack entry alive. s.send(b'a'*40)
resp = s.recvfrom(1024)
msg_name = resp[0].decode('utf-8').split('\0')[0] print(f"Got {msg_name}", flush=True)
except Exception as e:
pass
$ cat repro.sh ip netns del A1 2> /dev/null ip netns del A2 2> /dev/null ip netns add A1 ip netns add A2
ip -n A1 link add _v0 type veth peer name _v1 netns A2 ip -n A1 link set _v0 up
ip -n A2 link add e00000 type bond
ip -n A2 link add lo0 type dummy
ip -n A2 link add vrf_1 type vrf table 10001
ip -n A2 link set vrf_1 up
ip -n A2 link set e00000 master vrf_1
ip -n A2 addr add 1.1.1.1/24 dev e00000
ip -n A2 link set e00000 up
ip -n A2 link set _v1 master e00000
ip -n A2 link set _v1 up
ip -n A2 link set lo0 up
ip -n A2 addr add 2.2.2.2/32 dev lo0
ip -n A2 neigh add 1.1.1.10 lladdr 77:77:77:77:77:77 dev e00000 ip -n A2 route add 3.3.3.3/32 via 1.1.1.10 dev e00000 table 10001
ip netns exec A2 iptables -t nat -A POSTROUTING -p udp -m udp --dport 53 -j \ SNAT --to-source 2.2.2.2 -o vrf_1
sleep 5
ip netns exec A2 python3 run_in_A2.py > x &
XPID=$!
sleep 5
IFACE_MAC=`sed -n 1p x`
SOCKET_PORT=`sed -n 2p x`
V1_MAC=`ip -n A2 link show _v1 | sed -n 2p | awk '{print $2'}`
ip netns exec A1 python3 run_in_A1.py -iface_mac ${IFACE_MAC} -socket_port \
${SOCKET_PORT} -v1_mac ${SOCKET_PORT}
sleep 5 kill -9 $XPID
wait $XPID 2> /dev/null
ip netns del A1
ip netns del A2
tail x -n 2
rm x
set +x
--- drivers/net/vrf.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/vrf.c +4 -0
@@ -1313,6 +1313,8 @@ static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev,bool need_strict =rt6_need_strict (&ipv6_hdr (skb)->daddr);bool is_ndisc =ipv6_ndisc_frame (skb); +nf_reset_ct (skb); +/* loopback, multicast & non-ND link-local traffic; do not push through * packet taps again. Reset pkt_type for upper layers to process skb. * For strict packets with a source LLA, determine the dst using the
@@ -1369,6 +1371,8 @@ static struct sk_buff *vrf_ip_rcv(struct net_device *vrf_dev, skb->skb_iif = vrf_dev->ifindex;IPCB (skb)->flags |=IPSKB_L3SLAVE ; +nf_reset_ct (skb); +if (ipv4_is_multicast (ip_hdr (skb)->daddr)) goto out;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 58/98 virtio-net: support XDP when not more queues
In reply to Sasha LevinFrom: Xuan Zhuo <[email protected]>
[ Upstream commit 97c2c69e1926260c78c7f1c0b2c987934f1dc7a1 ]
The number of queues implemented by many virtio backends is limited, especially some machines have a large number of CPUs. In this case, it is often impossible to allocate a separate queue for XDP_TX/XDP_REDIRECT, then xdp cannot be loaded to work, even xdp does not use the XDP_TX/XDP_REDIRECT.
This patch allows XDP_TX/XDP_REDIRECT to run by reuse the existing SQ with __netif_tx_lock() hold when there are not enough queues.
--- drivers/net/virtio_net.c | 62 +++++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 13 deletions(-)
drivers/net/virtio_net.c +49 -13
@@ -195,6 +195,9 @@ struct virtnet_info {/* # of XDP queue pairs currently used by the driver */ u16 xdp_queue_pairs; +/* xdp_queue_pairs may be 0, when xdp is already loaded. So add this. */ +bool xdp_enabled; +/* I like... big packets and I cannot lie! */ bool big_packets;
@@ -485,12 +488,41 @@ static int __virtnet_xdp_xmit_one(struct virtnet_info *vi,return 0 ; } -static struct send_queue *virtnet_xdp_sq (struct virtnet_info *vi) -{ -unsigned int qp; - - qp = vi->curr_queue_pairs - vi->xdp_queue_pairs +smp_processor_id (); -return &vi->sq[qp]; +/* when vi->curr_queue_pairs > nr_cpu_ids, the txq/sq is only used for xdp tx on +* the current cpu, so it does not need to be locked. +* +* Here we use marco instead of inline functions because we have to deal with +* three issues at the same time: 1. the choice of sq. 2. judge and execute the +* lock/unlock of txq 3. make sparse happy. It is difficult for two inline +* functions to perfectly solve these three problems at the same time. +*/ +#define virtnet_xdp_get_sq (vi) ({ \ + struct netdev_queue *txq; \ + typeof(vi) v = (vi); \ + unsigned int qp; \ + \ + if (v->curr_queue_pairs > nr_cpu_ids) { \ + qp = v->curr_queue_pairs - v->xdp_queue_pairs; \ + qp += smp_processor_id(); \ + txq = netdev_get_tx_queue(v->dev, qp); \ + __netif_tx_acquire(txq); \ + } else { \ + qp = smp_processor_id() % v->curr_queue_pairs; \ + txq = netdev_get_tx_queue(v->dev, qp); \ + __netif_tx_lock(txq, raw_smp_processor_id()); \ + } \ + v->sq + qp; \ +}) + +#define virtnet_xdp_put_sq (vi, q) { \ + struct netdev_queue *txq; \ + typeof(vi) v = (vi); \ + \ + txq = netdev_get_tx_queue(v->dev, (q) - v->sq); \ + if (v->curr_queue_pairs > nr_cpu_ids) \ + __netif_tx_release(txq); \ + else \ + __netif_tx_unlock(txq); \ } static int virtnet_xdp_xmit(struct net_device *dev,
@@ -516,7 +548,7 @@ static int virtnet_xdp_xmit(struct net_device *dev,if (!xdp_prog)return -ENXIO ; - sq =virtnet_xdp_sq (vi); + sq =virtnet_xdp_get_sq (vi);if (unlikely (flags & ~XDP_XMIT_FLAGS_MASK )) { ret = -EINVAL ;
@@ -564,12 +596,13 @@ out: sq->stats.kicks += kicks;u64_stats_update_end (&sq->stats.syncp); +virtnet_xdp_put_sq (vi, sq);return ret; }static unsigned int virtnet_get_headroom (struct virtnet_info *vi) { -return vi->xdp_queue_pairs ?VIRTIO_XDP_HEADROOM :0 ; +return vi->xdp_enabled ?VIRTIO_XDP_HEADROOM :0 ; }/* We copy the packet for XDP in the following cases:
@@ -1473,12 +1506,13 @@ static int virtnet_poll(struct napi_struct *napi, int budget)xdp_do_flush ();if (xdp_xmit &VIRTIO_XDP_TX ) { - sq =virtnet_xdp_sq (vi); + sq =virtnet_xdp_get_sq (vi);if (virtqueue_kick_prepare (sq->vq) &&virtqueue_notify (sq->vq)) {u64_stats_update_begin (&sq->stats.syncp); sq->stats.kicks++;u64_stats_update_end (&sq->stats.syncp); } +virtnet_xdp_put_sq (vi, sq); }return received;
@@ -2453,10 +2487,9 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog,/* XDP requires extra queues for XDP_TX */ if (curr_qp + xdp_qp > vi->max_queue_pairs) { -NL_SET_ERR_MSG_MOD (extack,"Too few free TX rings available" ); -netdev_warn (dev,"request %i queues but max is %i\n" , +netdev_warn (dev,"XDP request %i queues but max is %i. XDP_TX and XDP_REDIRECT will operate in a slower locked tx mode.\n" , curr_qp + xdp_qp, vi->max_queue_pairs); -return -ENOMEM ; + xdp_qp =0 ; } old_prog =rtnl_dereference (vi->rq[0 ].xdp_prog);
@@ -2490,11 +2523,14 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, vi->xdp_queue_pairs = xdp_qp;if (prog) { + vi->xdp_enabled = true;for (i =0 ; i < vi->max_queue_pairs; i++) {rcu_assign_pointer (vi->rq[i].xdp_prog, prog);if (i ==0 && !old_prog)virtnet_clear_guest_offloads (vi); } + }else { + vi->xdp_enabled = false; }for (i =0 ; i < vi->max_queue_pairs; i++) {
@@ -2562,7 +2598,7 @@ static int virtnet_set_features(struct net_device *dev,int err;if ((dev->features ^ features) &NETIF_F_LRO ) { -if (vi->xdp_queue_pairs) +if (vi->xdp_enabled)return -EBUSY ;if (features &NETIF_F_LRO )
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 59/98 virtio-net: use NETIF_F_GRO_HW instead of NETIF_F_LRO
In reply to Sasha LevinFrom: Jason Wang <[email protected]>
[ Upstream commit dbcf24d153884439dad30484a0e3f02350692e4c ]
Commit a02e8964eaf92 ("virtio-net: ethtool configurable LRO") maps LRO to virtio guest offloading features and allows the administrator to enable and disable those features via ethtool.
This leads to several issues:
- For a device that doesn't support control guest offloads, the "LRO" can't be disabled triggering WARN in dev_disable_lro() when turning off LRO or when enabling forwarding bridging etc.
- For a device that supports control guest offloads, the guest offloads are disabled in cases of bridging, forwarding etc slowing down the traffic.
Fix this by using NETIF_F_GRO_HW instead. Though the spec does not guarantee packets to be re-segmented as the original ones, we can add that to the spec, possibly with a flag for devices to differentiate between GRO and LRO.
Further, we never advertised LRO historically before a02e8964eaf92 ("virtio-net: ethtool configurable LRO") and so bridged/forwarded configs effectively always relied on virtio receive offloads behaving like GRO - thus even if this breaks any configs it is at least not a regression.
--- drivers/net/virtio_net.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/virtio_net.c +7 -7
@@ -63,7 +63,7 @@ static const unsigned long guest_offloads[] = { VIRTIO_NET_F_GUEST_CSUM }; -#define GUEST_OFFLOAD_LRO_MASK ((1ULL << VIRTIO_NET_F_GUEST_TSO4) | \ +#define GUEST_OFFLOAD_GRO_HW_MASK ((1ULL << VIRTIO_NET_F_GUEST_TSO4) | \ (1ULL << VIRTIO_NET_F_GUEST_TSO6) | \ (1ULL << VIRTIO_NET_F_GUEST_ECN) | \ (1ULL << VIRTIO_NET_F_GUEST_UFO))
@@ -2466,7 +2466,7 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ECN) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_UFO) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM))) { -NL_SET_ERR_MSG_MOD (extack,"Can't set XDP while host is implementing LRO/CSUM, disable LRO/CSUM first" ); +NL_SET_ERR_MSG_MOD (extack,"Can't set XDP while host is implementing GRO_HW/CSUM, disable GRO_HW/CSUM first" );return -EOPNOTSUPP ; }
@@ -2597,15 +2597,15 @@ static int virtnet_set_features(struct net_device *dev,u64 offloads;int err; -if ((dev->features ^ features) &NETIF_F_LRO ) { +if ((dev->features ^ features) &NETIF_F_GRO_HW ) {if (vi->xdp_enabled)return -EBUSY ; -if (features &NETIF_F_LRO ) +if (features &NETIF_F_GRO_HW ) offloads = vi->guest_offloads_capable;else offloads = vi->guest_offloads_capable & - ~GUEST_OFFLOAD_LRO_MASK ; + ~GUEST_OFFLOAD_GRO_HW_MASK ; err =virtnet_set_guest_offloads (vi, offloads);if (err)
@@ -3080,9 +3080,9 @@ static int virtnet_probe(struct virtio_device *vdev) dev->features |=NETIF_F_RXCSUM ;if (virtio_has_feature (vdev,VIRTIO_NET_F_GUEST_TSO4 ) ||virtio_has_feature (vdev,VIRTIO_NET_F_GUEST_TSO6 )) - dev->features |=NETIF_F_LRO ; + dev->features |=NETIF_F_GRO_HW ;if (virtio_has_feature (vdev,VIRTIO_NET_F_CTRL_GUEST_OFFLOADS )) - dev->hw_features |=NETIF_F_LRO ; + dev->hw_features |=NETIF_F_GRO_HW ; dev->vlan_features = dev->features;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 60/98 net: qlcnic: add missed unlock in qlcnic_83xx_flash_read32
In reply to Sasha LevinFrom: Dinghao Liu <[email protected]>
[ Upstream commit 0a298d133893c72c96e2156ed7cb0f0c4a306a3e ]
qlcnic_83xx_unlock_flash() is called on all paths after we call qlcnic_83xx_lock_flash(), except for one error path on failure of QLCRD32(), which may cause a deadlock. This bug is suggested by a static analysis tool, please advise.
--- drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +3 -1
@@ -3156,8 +3156,10 @@ int qlcnic_83xx_flash_read32(struct qlcnic_adapter *adapter, u32 flash_addr, indirect_addr =QLC_83XX_FLASH_DIRECT_DATA (addr); ret =QLCRD32 (adapter, indirect_addr, &err); -if (err == -EIO ) +if (err == -EIO ) { +qlcnic_83xx_unlock_flash (adapter);return err; + } word = ret; *(u32 *)p_data = word;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 61/98 ixgbe, xsk: clean up the resources in ixgbe_xsk_pool_enable error path
In reply to Sasha LevinFrom: Wang Hai <[email protected]>
[ Upstream commit 1b80fec7b043552e01609bae7d0aad07aa742adc ]
In ixgbe_xsk_pool_enable(), if ixgbe_xsk_wakeup() fails, We should restore the previous state and clean up the resources. Add the missing clear af_xdp_zc_qps and unmap dma to fix this bug.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +4 -1
@@ -52,8 +52,11 @@ static int ixgbe_xsk_pool_enable(struct ixgbe_adapter *adapter,/* Kick start the NAPI context so that receiving will start */ err =ixgbe_xsk_wakeup (adapter->netdev, qid,XDP_WAKEUP_RX ); -if (err) +if (err) { +clear_bit (qid, adapter->af_xdp_zc_qps); +xsk_pool_dma_unmap (pool,IXGBE_RX_DMA_ATTR );return err; + } }return 0 ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 62/98 sch_cake: fix srchost/dsthost hashing mode
In reply to Sasha LevinFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 86b9bbd332d0510679c7fedcee3e3bd278be5756 ]
When adding support for using the skb->hash value as the flow hash in CAKE, I accidentally introduced a logic error that broke the host-only isolation modes of CAKE (srchost and dsthost keywords). Specifically, the flow_hash variable should stay initialised to 0 in cake_hash() in pure host-based hashing mode. Add a check for this before using the skb->hash value as flow_hash.
--- net/sched/sch_cake.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_cake.c +1 -1
@@ -720,7 +720,7 @@ static u32 cake_hash(struct cake_tin_data *q, const struct sk_buff *skb, skip_hash:if (flow_override) flow_hash = flow_override -1 ; -else if (use_skbhash) +else if (use_skbhash && (flow_mode &CAKE_FLOW_FLOWS )) flow_hash = skb->hash;if (host_override) { dsthost_hash = host_override -1 ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 63/98 net: mdio-mux: Don't ignore memory allocation errors
In reply to Sasha LevinFrom: Saravana Kannan <[email protected]>
[ Upstream commit 99d81e942474cc7677d12f673f42a7ea699e2589 ]
If we are seeing memory allocation errors, don't try to continue registering child mdiobus devices. It's unlikely they'll succeed.
--- drivers/net/mdio/mdio-mux.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-)
drivers/net/mdio/mdio-mux.c +18 -10
@@ -82,6 +82,17 @@ out:static int parent_count; +static void mdio_mux_uninit_children (struct mdio_mux_parent_bus *pb) +{ +struct mdio_mux_child_bus *cb = pb->children; + +while (cb) { +mdiobus_unregister (cb->mii_bus); +mdiobus_free (cb->mii_bus); + cb = cb->next; + } +} + int mdio_mux_init(struct device *dev, struct device_node *mux_node, int (*switch_fn)(int cur, int desired, void *data),
@@ -144,7 +155,7 @@ int mdio_mux_init(struct device *dev, cb =devm_kzalloc (dev,sizeof (*cb),GFP_KERNEL );if (!cb) { ret_val = -ENOMEM ; -continue ; + goto err_loop; } cb->bus_number = v; cb->parent = pb;
@@ -152,8 +163,7 @@ int mdio_mux_init(struct device *dev, cb->mii_bus =mdiobus_alloc ();if (!cb->mii_bus) { ret_val = -ENOMEM ; -devm_kfree (dev, cb); -continue ; + goto err_loop; } cb->mii_bus->priv = cb;
@@ -182,6 +192,10 @@ int mdio_mux_init(struct device *dev,dev_err (dev,"Error: No acceptable child buses found\n" );devm_kfree (dev, pb); + +err_loop: +mdio_mux_uninit_children (pb); +of_node_put (child_bus_node); err_pb_kz:put_device (&parent_bus->dev); err_parent_bus:
@@ -193,14 +207,8 @@ EXPORT_SYMBOL_GPL(mdio_mux_init);void mdio_mux_uninit (void *mux_handle) {struct mdio_mux_parent_bus *pb = mux_handle; -struct mdio_mux_child_bus *cb = pb->children; - -while (cb) { -mdiobus_unregister (cb->mii_bus); -mdiobus_free (cb->mii_bus); - cb = cb->next; - } +mdio_mux_uninit_children (pb);put_device (&pb->mii_bus->dev); }EXPORT_SYMBOL_GPL (mdio_mux_uninit);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 64/98 net: mdio-mux: Handle -EPROBE_DEFER correctly
In reply to Sasha LevinFrom: Saravana Kannan <[email protected]>
[ Upstream commit 7bd0cef5dac685f09ef8b0b2a7748ff42d284dc7 ]
When registering mdiobus children, if we get an -EPROBE_DEFER, we shouldn't ignore it and continue registering the rest of the mdiobus children. This would permanently prevent the deferring child mdiobus from working instead of reattempting it in the future. So, if a child mdiobus needs to be reattempted in the future, defer the entire mdio-mux initialization.
This fixes the issue where PHYs sitting under the mdio-mux aren't initialized correctly if the PHY's interrupt controller is not yet ready when the mdio-mux is being probed. Additional context in the link below.
--- drivers/net/mdio/mdio-mux.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/mdio/mdio-mux.c +6 -2
@@ -175,11 +175,15 @@ int mdio_mux_init(struct device *dev, cb->mii_bus->write = mdio_mux_write; r =of_mdiobus_register (cb->mii_bus, child_bus_node);if (r) { +mdiobus_free (cb->mii_bus); +if (r == -EPROBE_DEFER ) { + ret_val = r; + goto err_loop; + } +devm_kfree (dev, cb);dev_err (dev,"Error: Failed to register MDIO bus for child %pOF\n" , child_bus_node); -mdiobus_free (cb->mii_bus); -devm_kfree (dev, cb); }else { cb->next = pb->children; pb->children = cb;
Signature · 1 line
2.30.2
Re: [PATCH 5.10 64/98] net: mdio-mux: Handle -EPROBE_DEFER correctly
Hi1
Quoted 10 lines
When registering mdiobus children, if we get an -EPROBE_DEFER, we shouldn't ignore it and continue registering the rest of the mdiobus children. This would permanently prevent the deferring child mdiobus from working instead of reattempting it in the future. So, if a child mdiobus needs to be reattempted in the future, defer the entire mdio-mux initialization.
This fixes the issue where PHYs sitting under the mdio-mux aren't initialized correctly if the PHY's interrupt controller is not yet ready when the mdio-mux is being probed. Additional context in the link below.
I don't believe this is quite right. AFAICT it leaks memory in the EPROBE_DEFER case. Could someone double-check? Suggested fix is below.
Quoted 9 lines
+++
b/drivers/net/mdio/mdio-mux.c(quoted diff) +4
-0@@ -175,11 +175,15 @@ int mdio_mux_init(struct device *dev, cb->mii_bus->write = mdio_mux_write; r = of_mdiobus_register(cb->mii_bus, child_bus_node); if (r) { + mdiobus_free(cb->mii_bus); + if (r == -EPROBE_DEFER) { + ret_val = r; + goto err_loop;
Review int mdio_mux_init(struct device *dev, · line 189
Quoted 10 lines
(quoted diff) +2
-2+ } + devm_kfree(dev, cb); dev_err(dev, "Error: Failed to register MDIO bus for child %pOF\n", child_bus_node); - mdiobus_free(cb->mii_bus); - devm_kfree(dev, cb); } else { cb->next = pb->children; pb->children = cb;
drivers/net/mdio/mdio-mux.c +2 -1
@@ -163,6 +163,7 @@ int mdio_mux_init(struct device *dev, cb->mii_bus =mdiobus_alloc ();if (!cb->mii_bus) { ret_val = -ENOMEM ; +devm_kfree (dev, cb); goto err_loop; } cb->mii_bus->priv = cb;
@@ -176,11 +177,11 @@ int mdio_mux_init(struct device *dev, r =of_mdiobus_register (cb->mii_bus, child_bus_node);if (r) {mdiobus_free (cb->mii_bus); +devm_kfree (dev, cb);if (r == -EPROBE_DEFER ) { ret_val = r; goto err_loop; } -devm_kfree (dev, cb);dev_err (dev,"Error: Failed to register MDIO bus for child %pOF\n" , child_bus_node);
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Re: [PATCH 5.10 64/98] net: mdio-mux: Handle -EPROBE_DEFER correctly
Quoted 9 lines · Pavel Machek
Hi1
Quoted 6 lines
When registering mdiobus children, if we get an -EPROBE_DEFER, we shouldn't ignore it and continue registering the rest of the mdiobus children. This would permanently prevent the deferring child mdiobus from working instead of reattempting it in the future. So, if a child mdiobus needs to be reattempted in the future, defer the entire mdio-mux initialization.
Quoted 7 lines
Quoted 4 lines
This fixes the issue where PHYs sitting under the mdio-mux aren't initialized correctly if the PHY's interrupt controller is not yet ready when the mdio-mux is being probed. Additional context in the link below.
I don't believe this is quite right. AFAICT it leaks memory in the
EPROBE_DEFERcase. Could someone double-check? Suggested fix is below.
devm_ APIs would take care of releasing the resource (memory) automatically because the probe didn't succeed. So I'm not sure there's a leak. Does that make sense?
-Saravana
Quoted 54 lines
Quoted 10 lines
+++
b/drivers/net/mdio/mdio-mux.c(quoted diff) +4
-0@@ -175,11 +175,15 @@ int mdio_mux_init(struct device *dev, cb->mii_bus->write = mdio_mux_write; r = of_mdiobus_register(cb->mii_bus, child_bus_node); if (r) { + mdiobus_free(cb->mii_bus); + if (r == -EPROBE_DEFER) { + ret_val = r; + goto err_loop;Review int mdio_mux_init(struct device *dev, · line 189
Quoted 10 lines
(quoted diff) +2
-2+ } + devm_kfree(dev, cb); dev_err(dev, "Error: Failed to register MDIO bus for child %pOF\n", child_bus_node); - mdiobus_free(cb->mii_bus); - devm_kfree(dev, cb); } else { cb->next = pb->children; pb->children = cb;Signed-off-by Pavel Machek (CIP) <[email protected]>drivers/net/mdio/mdio-mux.c +2
-2@@ -163,6 +163,7 @@ int mdio_mux_init(struct device *dev, cb->mii_bus =mdiobus_alloc ();if (!cb->mii_bus) { ret_val = -ENOMEM ; +devm_kfree (dev, cb); goto err_loop; } cb->mii_bus->priv = cb;@@ -176,11 +177,11 @@ int mdio_mux_init(struct device *dev, r =of_mdiobus_register (cb->mii_bus, child_bus_node);if (r) {mdiobus_free (cb->mii_bus); +devm_kfree (dev, cb);if (r == -EPROBE_DEFER ) { ret_val = r; goto err_loop; } -devm_kfree (dev, cb);dev_err (dev,"Error: Failed to register MDIO bus for child %pOF\n" , child_bus_node); --DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Re: [PATCH 5.10 64/98] net: mdio-mux: Handle -EPROBE_DEFER correctly
Hi!
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
When registering mdiobus children, if we get an -EPROBE_DEFER, we shouldn't ignore it and continue registering the rest of the mdiobus children. This would permanently prevent the deferring child mdiobus from working instead of reattempting it in the future. So, if a child mdiobus needs to be reattempted in the future, defer the entire mdio-mux initialization.
This fixes the issue where PHYs sitting under the mdio-mux aren't initialized correctly if the PHY's interrupt controller is not yet ready when the mdio-mux is being probed. Additional context in the link below.
Quoted 6 lines
Quoted 2 lines
I don't believe this is quite right. AFAICT it leaks memory in the
EPROBE_DEFERcase. Could someone double-check? Suggested fix is below.
devm_APIs would take care of releasing the resource (memory) automatically because the probe didn't succeed. So I'm not sure there's a leak. Does that make sense?
Yes, it does, I believe you are right.
This part of code confused me: We are going to return error there, yet we do explicit tree, which should not be neccessary according to this logic.
dev_err(dev, "Error: No acceptable child buses found\n"); devm_kfree(dev, pb);
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Sasha Levin
maintainerPATCH 65/98 ovs: clear skb->tstamp in forwarding path
In reply to Sasha LevinFrom: "kaixi.fan" <[email protected]>
[ Upstream commit 01634047bf0d5c2d9b7d8095bb4de1663dbeedeb ]
fq qdisc requires tstamp to be cleared in the forwarding path. Now ovs doesn't clear skb->tstamp. We encountered a problem with linux version 5.4.56 and ovs version 2.14.1, and packets failed to dequeue from qdisc when fq qdisc was attached to ovs port.
--- net/openvswitch/vport.c | 1 + 1 file changed, 1 insertion(+)
net/openvswitch/vport.c +1 -0
@@ -503,6 +503,7 @@ void ovs_vport_send(struct vport *vport, struct sk_buff *skb, u8 mac_proto) } skb->dev = vport->dev; + skb->tstamp =0 ; vport->ops->send (skb);return ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 66/98 iommu/vt-d: Consolidate duplicate cache invaliation code
In reply to Sasha LevinFrom: Lu Baolu <[email protected]>
[ Upstream commit 9872f9bd9dbd68f75e8db782717d71e8594f6a02 ]
The pasid based IOTLB and devTLB invalidation code is duplicate in several places. Consolidate them by using the common helpers.
--- drivers/iommu/intel/pasid.c | 18 ++---------- drivers/iommu/intel/svm.c | 55 ++++++------------------------------- 2 files changed, 11 insertions(+), 62 deletions(-)
drivers/iommu/intel/pasid.c +2 -16
@@ -466,20 +466,6 @@ pasid_cache_invalidation_with_pasid(struct intel_iommu *iommu,qi_submit_sync (iommu, &desc,1 ,0 ); } -static void -iotlb_invalidation_with_pasid (struct intel_iommu *iommu,u16 did,u32 pasid) -{ -struct qi_desc desc; - - desc.qw0 =QI_EIOTLB_PASID (pasid) |QI_EIOTLB_DID (did) | -QI_EIOTLB_GRAN (QI_GRAN_NONG_PASID ) |QI_EIOTLB_TYPE ; - desc.qw1 =0 ; - desc.qw2 =0 ; - desc.qw3 =0 ; - -qi_submit_sync (iommu, &desc,1 ,0 ); -} -static void devtlb_invalidation_with_pasid (struct intel_iommu *iommu,struct device *dev,u32 pasid)
@@ -524,7 +510,7 @@ void intel_pasid_tear_down_entry(struct intel_iommu *iommu, struct device *dev,clflush_cache_range (pte,sizeof (*pte));pasid_cache_invalidation_with_pasid (iommu, did, pasid); -iotlb_invalidation_with_pasid (iommu, did, pasid); +qi_flush_piotlb (iommu, did, pasid,0 ,-1 ,0 );/* Device IOTLB doesn't need to be flushed in caching mode. */ if (!cap_caching_mode (iommu->cap))
@@ -540,7 +526,7 @@ static void pasid_flush_caches(struct intel_iommu *iommu,if (cap_caching_mode (iommu->cap)) {pasid_cache_invalidation_with_pasid (iommu, did, pasid); -iotlb_invalidation_with_pasid (iommu, did, pasid); +qi_flush_piotlb (iommu, did, pasid,0 ,-1 ,0 ); }else {iommu_flush_write_buffer (iommu); }
drivers/iommu/intel/svm.c +9 -46
62 lines not on this page · raw message
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 67/98 iommu/vt-d: Fix incomplete cache flush in intel_pasid_tear_down_entry()
In reply to Sasha LevinFrom: Liu Yi L <[email protected]>
[ Upstream commit 8798d36411196da86e70b994725349c16c1119f6 ]
This fixes improper iotlb invalidation in intel_pasid_tear_down_entry(). When a PASID was used as nested mode, released and reused, the following error message will appear:
[ 180.187556] Unexpected page request in Privilege Mode [ 180.187565] Unexpected page request in Privilege Mode [ 180.279933] Unexpected page request in Privilege Mode [ 180.279937] Unexpected page request in Privilege Mode
Per chapter 6.5.3.3 of VT-d spec 3.3, when tear down a pasid entry, the software should use Domain selective IOTLB flush if the PGTT of the pasid entry is SL only or Nested, while for the pasid entries whose PGTT is FL only or PT using PASID-based IOTLB flush is enough.
--- drivers/iommu/intel/pasid.c | 10 ++++++++-- drivers/iommu/intel/pasid.h | 6 ++++++ 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/iommu/intel/pasid.c +8 -2
@@ -497,20 +497,26 @@ void intel_pasid_tear_down_entry(struct intel_iommu *iommu, struct device *dev, u32 pasid, bool fault_ignore) {struct pasid_entry *pte; -u16 did; +u16 did, pgtt; pte =intel_pasid_get_entry (dev, pasid);if (WARN_ON (!pte))return ; did =pasid_get_domain_id (pte); + pgtt =pasid_pte_get_pgtt (pte); +intel_pasid_clear_entry (dev, pasid, fault_ignore);if (!ecap_coherent (iommu->ecap))clflush_cache_range (pte,sizeof (*pte));pasid_cache_invalidation_with_pasid (iommu, did, pasid); -qi_flush_piotlb (iommu, did, pasid,0 ,-1 ,0 ); + +if (pgtt ==PASID_ENTRY_PGTT_PT || pgtt ==PASID_ENTRY_PGTT_FL_ONLY ) +qi_flush_piotlb (iommu, did, pasid,0 ,-1 ,0 ); +else + iommu->flush.flush_iotlb (iommu, did,0 ,0 ,DMA_TLB_DSI_FLUSH );/* Device IOTLB doesn't need to be flushed in caching mode. */ if (!cap_caching_mode (iommu->cap))
drivers/iommu/intel/pasid.h +6 -0
@@ -99,6 +99,12 @@ static inline bool pasid_pte_is_present(struct pasid_entry *pte)return READ_ONCE (pte->val[0 ]) &PASID_PTE_PRESENT ; } +/* Get PGTT field of a PASID table entry */ +static inline u16 pasid_pte_get_pgtt (struct pasid_entry *pte) +{ +return (u16)((READ_ONCE (pte->val[0 ]) >>6 ) &0x7 ); +} +extern unsigned int intel_pasid_max_id;int intel_pasid_alloc_id (void *ptr,int start,int end,gfp_t gfp);void intel_pasid_free_id (u32 pasid);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 68/98 pipe: avoid unnecessary EPOLLET wakeups under normal loads
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
[ Upstream commit 3b844826b6c6affa80755254da322b017358a2f4 ]
I had forgotten just how sensitive hackbench is to extra pipe wakeups, and commit 3a34b13a88ca ("pipe: make pipe writes always wake up readers") ended up causing a quite noticeable regression on larger machines.
Now, hackbench isn't necessarily a hugely meaningful benchmark, and it's not clear that this matters in real life all that much, but as Mel points out, it's used often enough when comparing kernels and so the performance regression shows up like a sore thumb.
It's easy enough to fix at least for the common cases where pipes are used purely for data transfer, and you never have any exciting poll usage at all. So set a special 'poll_usage' flag when there is polling activity, and make the ugly "EPOLLET has crazy legacy expectations" semantics explicit to only that case.
I would love to limit it to just the broken EPOLLET case, but the pipe code can't see the difference between epoll and regular select/poll, so any non-read/write waiting will trigger the extra wakeup behavior. That is sufficient for at least the hackbench case.
Apart from making the odd extra wakeup cases more explicitly about EPOLLET, this also makes the extra wakeup be at the _end_ of the pipe write, not at the first write chunk. That is actually much saner semantics (as much as you can call any of the legacy edge-triggered expectations for EPOLLET "sane") since it means that you know the wakeup will happen once the write is done, rather than possibly in the middle of one.
[ For stable people: I'm putting a "Fixes" tag on this, but I leave it
up to you to decide whether you actually want to backport it or not. It likely has no impact outside of synthetic benchmarks - Linus ]
--- fs/pipe.c | 15 +++++++++------ include/linux/pipe_fs_i.h | 2 ++ 2 files changed, 11 insertions(+), 6 deletions(-)
fs/pipe.c +9 -6
@@ -444,9 +444,6 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)#endif /* -* Epoll nonsensically wants a wakeup whether the pipe -* was already empty or not. -* * If it wasn't empty we try to merge new data into * the last buffer. *
@@ -455,9 +452,9 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)* spanning multiple pages. */ head = pipe->head; - was_empty = true; + was_empty =pipe_empty (head, pipe->tail); chars = total_len & (PAGE_SIZE -1 ); -if (chars && !pipe_empty (head, pipe->tail)) { +if (chars && !was_empty) {unsigned int mask = pipe->ring_size -1 ;struct pipe_buffer *buf = &pipe->bufs[(head -1 ) & mask];int offset = buf->offset + buf->len;
@@ -590,8 +587,11 @@ out:* This is particularly important for small writes, because of * how (for example) the GNU make jobserver uses small writes to * wake up pending jobs +* +* Epoll nonsensically wants a wakeup whether the pipe +* was already empty or not. */ -if (was_empty) { +if (was_empty || pipe->poll_usage) {wake_up_interruptible_sync_poll (&pipe->rd_wait,EPOLLIN |EPOLLRDNORM );kill_fasync (&pipe->fasync_readers,SIGIO ,POLL_IN ); }
@@ -654,6 +654,9 @@ pipe_poll(struct file *filp, poll_table *wait)struct pipe_inode_info *pipe = filp->private_data;unsigned int head, tail; +/* Epoll has some historical nasty semantics, this enables them */ + pipe->poll_usage =1 ; +/* * Reading pipe state only -- no need for acquiring the semaphore. *
include/linux/pipe_fs_i.h +2 -0
@@ -48,6 +48,7 @@ struct pipe_buffer {* @files: number of struct file referring this pipe (protected by ->i_lock) * @r_counter: reader counter * @w_counter: writer counter +* @poll_usage: is this pipe used for epoll, which has crazy wakeups? * @fasync_readers: reader side fasync * @fasync_writers: writer side fasync * @bufs: the circular array of pipe buffers
@@ -70,6 +71,7 @@ struct pipe_inode_info {unsigned int files;unsigned int r_counter;unsigned int w_counter; +unsigned int poll_usage;struct page *tmp_page;struct fasync_struct *fasync_readers;struct fasync_struct *fasync_writers;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 69/98 r8152: fix writing USB_BP2_EN
In reply to Sasha LevinFrom: Hayes Wang <[email protected]>
[ Upstream commit a876a33d2a1102f99fc782fefb784f4dd4841d8c ]
The register of USB_BP2_EN is 16 bits, so we should use ocp_write_word(), not ocp_write_byte().
--- drivers/net/usb/r8152.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/r8152.c +1 -1
@@ -3432,7 +3432,7 @@ static void rtl_clear_bp(struct r8152 *tp, u16 type)case RTL_VER_09 :default :if (type ==MCU_TYPE_USB ) { -ocp_write_byte (tp,MCU_TYPE_USB ,USB_BP2_EN ,0 ); +ocp_write_word (tp,MCU_TYPE_USB ,USB_BP2_EN ,0 );ocp_write_word (tp,MCU_TYPE_USB ,USB_BP_8 ,0 );ocp_write_word (tp,MCU_TYPE_USB ,USB_BP_9 ,0 );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 70/98 i40e: Fix ATR queue selection
In reply to Sasha LevinFrom: Arkadiusz Kubalewski <[email protected]>
[ Upstream commit a222be597e316389f9f8c26033352c124ce93056 ]
Without this patch, ATR does not work. Receive/transmit uses queue selection based on SW DCB hashing method.
If traffic classes are not configured for PF, then use netdev_pick_tx function for selecting queue for packet transmission. Instead of calling i40e_swdcb_skb_tx_hash, call netdev_pick_tx, which ensures that packet is transmitted/received from CPU that is running the application.
Reproduction steps:
1. Load i40e driver
2. Map each MSI interrupt of i40e port for each CPU
3. Disable ntuple, enable ATR i.e.:
ethtool -K $interface ntuple off
ethtool --set-priv-flags $interface flow-director-atr
4. Run application that is generating traffic and is bound to a single CPU, i.e.:
taskset -c 9 netperf -H 1.1.1.1 -t TCP_RR -l 10
5. Observe behavior:
Application's traffic should be restricted to the CPU provided in taskset.
--- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +1 -2
@@ -3556,8 +3556,7 @@ u16 i40e_lan_select_queue(struct net_device *netdev,/* is DCB enabled at all? */ if (vsi->tc_config.numtc ==1 ) -return i40e_swdcb_skb_tx_hash (netdev, skb, - netdev->real_num_tx_queues); +return netdev_pick_tx (netdev, skb, sb_dev); prio = skb->priority; hw = &vsi->back->hw;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 71/98 iavf: Fix ping is lost after untrusted VF had tried to change MAC
In reply to Sasha LevinFrom: Sylwester Dziedziuch <[email protected]>
[ Upstream commit 8da80c9d50220a8e4190a4eaa0dd6aeefcbbb5bf ]
Make changes to MAC address dependent on the response of PF. Disallow changes to HW MAC address and MAC filter from untrusted VF, thanks to that ping is not lost if VF tries to change MAC. Add a new field in iavf_mac_filter, to indicate whether there was response from PF for given filter. Based on this field pass or discard the filter.
If untrusted VF tried to change it's address, it's not changed. Still filter was changed, because of that ping couldn't go through.
--- drivers/net/ethernet/intel/iavf/iavf.h | 1 + drivers/net/ethernet/intel/iavf/iavf_main.c | 1 + .../net/ethernet/intel/iavf/iavf_virtchnl.c | 47 ++++++++++++++++++- 3 files changed, 47 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/iavf/iavf.h +1 -0
@@ -134,6 +134,7 @@ struct iavf_q_vector {struct iavf_mac_filter {struct list_head list;u8 macaddr[ETH_ALEN ]; +bool is_new_mac;/* filter is new, wait for PF decision */ bool remove;/* filter needs to be removed */ bool add;/* filter needs to be added */ };
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -0
@@ -751,6 +751,7 @@ struct iavf_mac_filter *iavf_add_filter(struct iavf_adapter *adapter,list_add_tail (&f->list, &adapter->mac_filter_list); f->add = true; + f->is_new_mac = true; adapter->aq_required |=IAVF_FLAG_AQ_ADD_MAC_FILTER ; }else { f->remove = false;
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +45 -2
67 lines not on this page · raw message
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 72/98 Revert "flow_offload: action should not be NULL when it is referenced"
In reply to Sasha LevinFrom: Ido Schimmel <[email protected]>
[ Upstream commit fa05bdb89b01b098aad19ec0ebc4d1cc7b11177e ]
This reverts commit 9ea3e52c5bc8bb4a084938dc1e3160643438927a.
Cited commit added a check to make sure 'action' is not NULL, but 'action' is already dereferenced before the check, when calling flow_offload_has_one_action().
Therefore, the check does not make any sense and results in a smatch warning:
include/net/flow_offload.h:322 flow_action_mixed_hw_stats_check() warn:
variable dereferenced before check 'action' (see line 319)
Fix by reverting this commit.
--- include/net/flow_offload.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
include/net/flow_offload.h +5 -7
@@ -312,14 +312,12 @@ flow_action_mixed_hw_stats_check(const struct flow_action *action,if (flow_offload_has_one_action (action))return true; -if (action) { -flow_action_for_each (i, action_entry, action) { -if (i && action_entry->hw_stats != last_hw_stats) { -NL_SET_ERR_MSG_MOD (extack,"Mixing HW stats types for actions is not supported" ); -return false; - } - last_hw_stats = action_entry->hw_stats; +flow_action_for_each (i, action_entry, action) { +if (i && action_entry->hw_stats != last_hw_stats) { +NL_SET_ERR_MSG_MOD (extack,"Mixing HW stats types for actions is not supported" ); +return false; } + last_hw_stats = action_entry->hw_stats; }return true; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 73/98 mmc: dw_mmc: Fix hang on data CRC error
In reply to Sasha LevinFrom: Vincent Whitchurch <[email protected]>
[ Upstream commit 25f8203b4be1937c4939bb98623e67dcfd7da4d1 ]
When a Data CRC interrupt is received, the driver disables the DMA, then sends the stop/abort command and then waits for Data Transfer Over.
However, sometimes, when a data CRC error is received in the middle of a multi-block write transfer, the Data Transfer Over interrupt is never received, and the driver hangs and never completes the request.
The driver sets the BMOD.SWR bit (SDMMC_IDMAC_SWRESET) when stopping the DMA, but according to the manual CMD.STOP_ABORT_CMD should be programmed "before assertion of SWR". Do these operations in the recommended order. With this change the Data Transfer Over is always received correctly in my tests.
--- drivers/mmc/host/dw_mmc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/host/dw_mmc.c +3 -3
@@ -2018,8 +2018,8 @@ static void dw_mci_tasklet_func(unsigned long priv)continue ; } -dw_mci_stop_dma (host);send_stop_abort (host, data); +dw_mci_stop_dma (host); state =STATE_SENDING_STOP ;break ; }
@@ -2043,10 +2043,10 @@ static void dw_mci_tasklet_func(unsigned long priv)*/ if (test_and_clear_bit (EVENT_DATA_ERROR , &host->pending_events)) { -dw_mci_stop_dma (host);if (!(host->data_status & (SDMMC_INT_DRTO |SDMMC_INT_EBE )))send_stop_abort (host, data); +dw_mci_stop_dma (host); state =STATE_DATA_ERROR ;break ; }
@@ -2079,10 +2079,10 @@ static void dw_mci_tasklet_func(unsigned long priv)*/ if (test_and_clear_bit (EVENT_DATA_ERROR , &host->pending_events)) { -dw_mci_stop_dma (host);if (!(host->data_status & (SDMMC_INT_DRTO |SDMMC_INT_EBE )))send_stop_abort (host, data); +dw_mci_stop_dma (host); state =STATE_DATA_ERROR ;break ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 74/98 mmc: mmci: stm32: Check when the voltage switch procedure should be done
In reply to Sasha LevinFrom: Christophe Kerello <[email protected]>
[ Upstream commit d8e193f13b07e6c0ffaa1a999386f1989f2b4c5e ]
If the card has not been power cycled, it may still be using 1.8V signaling. This situation is detected in mmc_sd_init_card function and should be handled in mmci stm32 variant. The host->pwr_reg variable is also correctly protected with spin locks.
--- drivers/mmc/host/mmci_stm32_sdmmc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/mmc/host/mmci_stm32_sdmmc.c +5 -2
@@ -479,8 +479,9 @@ static int sdmmc_post_sig_volt_switch(struct mmci_host *host,u32 status;int ret =0 ; -if (ios->signal_voltage ==MMC_SIGNAL_VOLTAGE_180 ) { -spin_lock_irqsave (&host->lock, flags); +spin_lock_irqsave (&host->lock, flags); +if (ios->signal_voltage ==MMC_SIGNAL_VOLTAGE_180 && + host->pwr_reg &MCI_STM32_VSWITCHEN ) {mmci_write_pwrreg (host, host->pwr_reg |MCI_STM32_VSWITCH );spin_unlock_irqrestore (&host->lock, flags);
@@ -492,9 +493,11 @@ static int sdmmc_post_sig_volt_switch(struct mmci_host *host,writel_relaxed (MCI_STM32_VSWENDC |MCI_STM32_CKSTOPC , host->base +MMCICLEAR ); +spin_lock_irqsave (&host->lock, flags);mmci_write_pwrreg (host, host->pwr_reg & ~(MCI_STM32_VSWITCHEN |MCI_STM32_VSWITCH )); } +spin_unlock_irqrestore (&host->lock, flags);return ret; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 75/98 mmc: sdhci-msm: Update the software timeout value for sdhc
In reply to Sasha LevinFrom: Shaik Sajida Bhanu <[email protected]>
[ Upstream commit 67b13f3e221ed81b46a657e2b499bf8b20162476 ]
Whenever SDHC run at clock rate 50MHZ or below, the hardware data timeout value will be 21.47secs, which is approx. 22secs and we have a current software timeout value as 10secs. We have to set software timeout value more than the hardware data timeout value to avioid seeing the below register dumps.
[ 332.953670] mmc2: Timeout waiting for hardware interrupt. [ 332.959608] mmc2: sdhci: ============ SDHCI REGISTER DUMP =========== [ 332.966450] mmc2: sdhci: Sys addr: 0x00000000 | Version: 0x00007202 [ 332.973256] mmc2: sdhci: Blk size: 0x00000200 | Blk cnt: 0x00000001 [ 332.980054] mmc2: sdhci: Argument: 0x00000000 | Trn mode: 0x00000027 [ 332.986864] mmc2: sdhci: Present: 0x01f801f6 | Host ctl: 0x0000001f [ 332.993671] mmc2: sdhci: Power: 0x00000001 | Blk gap: 0x00000000 [ 333.000583] mmc2: sdhci: Wake-up: 0x00000000 | Clock: 0x00000007 [ 333.007386] mmc2: sdhci: Timeout: 0x0000000e | Int stat: 0x00000000 [ 333.014182] mmc2: sdhci: Int enab: 0x03ff100b | Sig enab: 0x03ff100b [ 333.020976] mmc2: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000 [ 333.027771] mmc2: sdhci: Caps: 0x322dc8b2 | Caps_1: 0x0000808f [ 333.034561] mmc2: sdhci: Cmd: 0x0000183a | Max curr: 0x00000000 [ 333.041359] mmc2: sdhci: Resp[0]: 0x00000900 | Resp[1]: 0x00000000 [ 333.048157] mmc2: sdhci: Resp[2]: 0x00000000 | Resp[3]: 0x00000000 [ 333.054945] mmc2: sdhci: Host ctl2: 0x00000000 [ 333.059657] mmc2: sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x0000000ffffff218 [ 333.067178] mmc2: sdhci_msm: ----------- VENDOR REGISTER DUMP ----------- [ 333.074343] mmc2: sdhci_msm: DLL sts: 0x00000000 | DLL cfg: 0x6000642c | DLL cfg2: 0x0020a000 [ 333.083417] mmc2: sdhci_msm: DLL cfg3: 0x00000000 | DLL usr ctl: 0x00000000 | DDR cfg: 0x80040873 [ 333.092850] mmc2: sdhci_msm: Vndr func: 0x00008a9c | Vndr func2 : 0xf88218a8 Vndr func3: 0x02626040 [ 333.102371] mmc2: sdhci: ============================================
So, set software timeout value more than hardware timeout value.
--- drivers/mmc/host/sdhci-msm.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/mmc/host/sdhci-msm.c +18 -0
@@ -1834,6 +1834,23 @@ static void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery)sdhci_cqe_disable (mmc, recovery); } +static void sdhci_msm_set_timeout (struct sdhci_host *host,struct mmc_command *cmd) +{ +u32 count, start =15 ; + +__sdhci_set_timeout (host, cmd); + count =sdhci_readb (host,SDHCI_TIMEOUT_CONTROL ); +/* +* Update software timeout value if its value is less than hardware data +* timeout value. Qcom SoC hardware data timeout value was calculated +* using 4 * MCLK * 2^(count + 13). where MCLK = 1 / host->clock. +*/ +if (cmd && cmd->data && host->clock >400000 && + host->clock <=50000000 && + ((1 << (count + start)) > (10 * host->clock))) + host->data_timeout =22LL *NSEC_PER_SEC ; +} +static const struct cqhci_host_ops sdhci_msm_cqhci_ops = { .enable = sdhci_cqe_enable, .disable = sdhci_msm_cqe_disable,
@@ -2184,6 +2201,7 @@ static const struct sdhci_ops sdhci_msm_ops = { .irq = sdhci_msm_cqe_irq, .dump_vendor_regs = sdhci_msm_dump_vendor_regs, .set_power = sdhci_set_power_noreg, + .set_timeout = sdhci_msm_set_timeout, };static const struct sdhci_pltfm_data sdhci_msm_pdata = {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 76/98 clk: imx6q: fix uart earlycon unwork
In reply to Sasha LevinFrom: Dong Aisheng <[email protected]>
[ Upstream commit 283f1b9a0401859c53fdd6483ab66f1c4fadaea5 ]
The earlycon depends on the bootloader setup UART clocks being retained. There're actually two uart clocks (ipg, per) on MX6QDL,
but the 'Fixes' commit change to register only one which means another clock may be disabled during booting phase
and result in the earlycon unwork.
--- drivers/clk/imx/clk-imx6q.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/imx/clk-imx6q.c +1 -1
@@ -974,6 +974,6 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) hws[IMX6QDL_CLK_PLL3_USB_OTG]->clk); } -imx_register_uart_clocks (1 ); +imx_register_uart_clocks (2 ); }CLK_OF_DECLARE (imx6q,"fsl,imx6q-ccm" , imx6q_clocks_init);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 77/98 clk: qcom: gdsc: Ensure regulator init state matches GDSC state
In reply to Sasha LevinFrom: Bjorn Andersson <[email protected]>
[ Upstream commit 9711759a87a041705148161b937ec847048d882e ]
As GDSCs are registered and found to be already enabled gdsc_init() ensures that 1) the kernel state matches the hardware state, and 2) votable GDSCs are properly enabled from this master as well.
But as the (optional) supply regulator is enabled deep into gdsc_toggle_logic(), which is only executed for votable GDSCs, the kernel's state of the regulator might not match the hardware. The regulator might be automatically turned off if no other users are present or the next call to gdsc_disable() would cause an unbalanced regulator_disable().
Given that the votable case deals with an already enabled GDSC, most of gdsc_enable() and gdsc_toggle_logic() can be skipped. Reduce it to just clearing the SW_COLLAPSE_MASK and enabling hardware control to simply call regulator_enable() in both cases.
The enablement of hardware control seems to be an independent property from the GDSC being enabled, so this is moved outside that conditional segment.
Lastly, as the propagation of ALWAYS_ON to GENPD_FLAG_ALWAYS_ON needs to happen regardless of the initial state this is grouped together with the other sc->pd updates at the end of the function.
--- drivers/clk/qcom/gdsc.c | 54 +++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 18 deletions(-)
drivers/clk/qcom/gdsc.c +36 -18
@@ -357,27 +357,43 @@ static int gdsc_init(struct gdsc *sc)if (on <0 )return on; -/* -* Votable GDSCs can be ON due to Vote from other masters. -* If a Votable GDSC is ON, make sure we have a Vote. -*/ -if ((sc->flags &VOTABLE ) && on) -gdsc_enable (&sc->pd); +if (on) { +/* The regulator must be on, sync the kernel state */ +if (sc->rsupply) { + ret =regulator_enable (sc->rsupply); +if (ret <0 ) +return ret; + } -/* -* Make sure the retain bit is set if the GDSC is already on, otherwise -* we end up turning off the GDSC and destroying all the register -* contents that we thought we were saving. -*/ -if ((sc->flags &RETAIN_FF_ENABLE ) && on) -gdsc_retain_ff_on (sc); +/* +* Votable GDSCs can be ON due to Vote from other masters. +* If a Votable GDSC is ON, make sure we have a Vote. +*/ +if (sc->flags &VOTABLE ) { + ret =regmap_update_bits (sc->regmap, sc->gdscr, +SW_COLLAPSE_MASK , val); +if (ret) +return ret; + } + +/* Turn on HW trigger mode if supported */ +if (sc->flags &HW_CTRL ) { + ret =gdsc_hwctrl (sc, true); +if (ret <0 ) +return ret; + } -/* If ALWAYS_ON GDSCs are not ON, turn them ON */ -if (sc->flags &ALWAYS_ON ) { -if (!on) -gdsc_enable (&sc->pd); +/* +* Make sure the retain bit is set if the GDSC is already on, +* otherwise we end up turning off the GDSC and destroying all +* the register contents that we thought we were saving. +*/ +if (sc->flags &RETAIN_FF_ENABLE ) +gdsc_retain_ff_on (sc); + }else if (sc->flags &ALWAYS_ON ) { +/* If ALWAYS_ON GDSCs are not ON, turn them ON */ +gdsc_enable (&sc->pd); on = true; - sc->pd.flags |=GENPD_FLAG_ALWAYS_ON ; }if (on || (sc->pwrsts &PWRSTS_RET ))
@@ -385,6 +401,8 @@ static int gdsc_init(struct gdsc *sc)else gdsc_clear_mem_on (sc); +if (sc->flags &ALWAYS_ON ) + sc->pd.flags |=GENPD_FLAG_ALWAYS_ON ;if (!sc->pd.power_off) sc->pd.power_off = gdsc_disable;if (!sc->pd.power_on)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 78/98 ALSA: hda - fix the 'Capture Switch' value change notifications
In reply to Sasha LevinFrom: Jaroslav Kysela <[email protected]>
[ Upstream commit a2befe9380dd04ee76c871568deca00eedf89134 ]
The original code in the cap_put_caller() function does not handle correctly the positive values returned from the passed function for multiple iterations. It means that the change notifications may be lost.
--- sound/pci/hda/hda_generic.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
sound/pci/hda/hda_generic.c +7 -3
@@ -3458,7 +3458,7 @@ static int cap_put_caller(struct snd_kcontrol *kcontrol,struct hda_gen_spec *spec = codec->spec;const struct hda_input_mux *imux;struct nid_path *path; -int i, adc_idx, err =0 ; +int i, adc_idx, ret, err =0 ; imux = &spec->input_mux; adc_idx = kcontrol->id.index;
@@ -3468,9 +3468,13 @@ static int cap_put_caller(struct snd_kcontrol *kcontrol,if (!path || !path->ctls[type])continue ; kcontrol->private_value = path->ctls[type]; - err =func (kcontrol, ucontrol); -if (err <0 ) + ret =func (kcontrol, ucontrol); +if (ret <0 ) { + err = ret;break ; + } +if (ret >0 ) + err =1 ; }mutex_unlock (&codec->control_mutex);if (err >=0 && spec->cap_sync_hook)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 79/98 tracing / histogram: Fix NULL pointer dereference on strcmp() on NULL event name
In reply to Sasha LevinFrom: "Steven Rostedt (VMware)" <[email protected]>
[ Upstream commit 5acce0bff2a0420ce87d4591daeb867f47d552c2 ]
The following commands:
# echo 'read_max u64 size;' > synthetic_events # echo 'hist:keys=common_pid:count=count:onmax($count).trace(read_max,count)' > events/syscalls/sys_enter_read/trigger
Causes:
BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP CPU: 4 PID: 1763 Comm: bash Not tainted 5.14.0-rc2-test+ #155 Hardware name: Hewlett-Packard HP Compaq Pro 6300 SFF/339A, BIOS K01 v03.03 07/14/2016 RIP: 0010:strcmp+0xc/0x20 Code: 75 f7 31 c0 0f b6 0c 06 88 0c 02 48 83 c0 01 84 c9 75 f1 4c 89 c0
c3 0f 1f 80 00 00 00 00 31 c0 eb 08 48 83 c0 01 84 d2 74 0f <0f> b6 14 07 3a 14 06 74 ef 19 c0 83 c8 01 c3 31 c0 c3 66 90 48 89
RSP: 0018:ffffb5fdc0963ca8 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffffffffb3a4e040 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffff9714c0d0b640 RDI: 0000000000000000
RBP: 0000000000000000 R08: 00000022986b7cde R09: ffffffffb3a4dff8
R10: 0000000000000000 R11: 0000000000000000 R12: ffff9714c50603c8
R13: 0000000000000000 R14: ffff97143fdf9e48 R15: ffff9714c01a2210
FS: 00007f1fa6785740(0000) GS:ffff9714da400000(0000)
knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 000000002d863004 CR4: 00000000001706e0
Call Trace: __find_event_file+0x4e/0x80 action_create+0x6b7/0xeb0 ? kstrdup+0x44/0x60 event_hist_trigger_func+0x1a07/0x2130 trigger_process_regex+0xbd/0x110 event_trigger_write+0x71/0xd0 vfs_write+0xe9/0x310 ksys_write+0x68/0xe0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f1fa6879e87
The problem was the "trace(read_max,count)" where the "count" should be "$count" as "onmax()" only handles variables (although it really should be able to figure out that "count" is a field of sys_enter_read). But there's a path that does not find the variable and ends up passing a NULL for the event, which ends up getting passed to "strcmp()".
Add a check for NULL to return and error on the command with:
# cat error_log
hist:syscalls:sys_enter_read: error: Couldn't create or find variable
Command: hist:keys=common_pid:count=count:onmax($count).trace(read_max,count)
^
Link: https://lkml.kernel.org/r/[email protected]--- kernel/trace/trace_events_hist.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/trace/trace_events_hist.c +2 -0
@@ -3405,6 +3405,8 @@ trace_action_create_field_var(struct hist_trigger_data *hist_data, event = data->match_data.event; } +if (!event) + goto free;/* * At this point, we're looking at a field on another * event. Because we can't modify a hist trigger on
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 80/98 slimbus: messaging: start transaction ids from 1 instead of zero
In reply to Sasha LevinFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit 9659281ce78de0f15a4aa124da8f7450b1399c09 ]
As tid is unsigned its hard to figure out if the tid is valid or invalid. So Start the transaction ids from 1 instead of zero so that we could differentiate between a valid tid and invalid tids
This is useful in cases where controller would add a tid for controller specific transfers.
--- drivers/slimbus/messaging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/slimbus/messaging.c +1 -1
@@ -66,7 +66,7 @@ int slim_alloc_txn_tid(struct slim_controller *ctrl, struct slim_msg_txn *txn)int ret =0 ;spin_lock_irqsave (&ctrl->txn_lock, flags); - ret =idr_alloc_cyclic (&ctrl->tid_idr, txn,0 , + ret =idr_alloc_cyclic (&ctrl->tid_idr, txn,1 ,SLIM_MAX_TIDS ,GFP_ATOMIC );if (ret <0 ) {spin_unlock_irqrestore (&ctrl->txn_lock, flags);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 81/98 slimbus: messaging: check for valid transaction id
In reply to Sasha LevinFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit a263c1ff6abe0e66712f40d595bbddc7a35907f8 ]
In some usecases transaction ids are dynamically allocated inside the controller driver after sending the messages which have generic acknowledge responses. So check for this before refcounting pm_runtime.
Without this we would end up imbalancing runtime pm count by doing pm_runtime_put() in both slim_do_transfer() and slim_msg_response() for a single pm_runtime_get() in slim_do_transfer()
--- drivers/slimbus/messaging.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/slimbus/messaging.c +3 -2
@@ -131,7 +131,8 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn) goto slim_xfer_err; } } - +/* Initialize tid to invalid value */ + txn->tid =0 ; need_tid =slim_tid_txn (txn->mt, txn->mc);if (need_tid) {
@@ -163,7 +164,7 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn) txn->mt, txn->mc, txn->la, ret); slim_xfer_err: -if (!clk_pause_msg && (!need_tid || ret == -ETIMEDOUT )) { +if (!clk_pause_msg && (txn->tid ==0 || ret == -ETIMEDOUT )) {/* * remove runtime-pm vote if this was TX only, or * if there was error during this transaction
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 82/98 slimbus: ngd: reset dma setup during runtime pm
In reply to Sasha LevinFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit d77772538f00b7265deace6e77e555ee18365ad0 ]
During suspend/resume NGD remote instance is power cycled along with remotely controlled bam dma engine.
So Reset the dma configuration during this suspend resume path so that we are not dealing with any stale dma setup.
Without this transactions timeout after first suspend resume path.
--- drivers/slimbus/qcom-ngd-ctrl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/slimbus/qcom-ngd-ctrl.c +4 -1
@@ -1065,7 +1065,8 @@ static void qcom_slim_ngd_setup(struct qcom_slim_ngd_ctrl *ctrl) {u32 cfg =readl_relaxed (ctrl->ngd->base); -if (ctrl->state ==QCOM_SLIM_NGD_CTRL_DOWN ) +if (ctrl->state ==QCOM_SLIM_NGD_CTRL_DOWN || + ctrl->state ==QCOM_SLIM_NGD_CTRL_ASLEEP )qcom_slim_ngd_init_dma (ctrl);/* By default enable message queues */
@@ -1116,6 +1117,7 @@ static int qcom_slim_ngd_power_up(struct qcom_slim_ngd_ctrl *ctrl)dev_info (ctrl->dev,"Subsys restart: ADSP active framer\n" );return 0 ; } +qcom_slim_ngd_setup (ctrl);return 0 ; }
@@ -1506,6 +1508,7 @@ static int __maybe_unused qcom_slim_ngd_runtime_suspend(struct device *dev)struct qcom_slim_ngd_ctrl *ctrl =dev_get_drvdata (dev);int ret =0 ; +qcom_slim_ngd_exit_dma (ctrl);if (!ctrl->qmi.handle)return 0 ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 83/98 ipack: tpci200: fix many double free issues in tpci200_pci_probe
In reply to Sasha LevinFrom: Dongliang Mu <[email protected]>
[ Upstream commit 57a1681095f912239c7fb4d66683ab0425973838 ]
The function tpci200_register called by tpci200_install and tpci200_unregister called by tpci200_uninstall are in pair. However, tpci200_unregister has some cleanup operations not in the tpci200_register. So the error handling code of tpci200_pci_probe has many different double free issues.
Fix this problem by moving those cleanup operations out of tpci200_unregister, into tpci200_pci_remove and reverting the previous commit 9272e5d0028d ("ipack/carriers/tpci200:
Fix a double free in tpci200_pci_probe").
--- drivers/ipack/carriers/tpci200.c | 36 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-)
drivers/ipack/carriers/tpci200.c +18 -18
@@ -91,16 +91,13 @@ static void tpci200_unregister(struct tpci200_board *tpci200)free_irq (tpci200->info->pdev->irq, (void *) tpci200);pci_iounmap (tpci200->info->pdev, tpci200->info->interface_regs); -pci_iounmap (tpci200->info->pdev, tpci200->info->cfg_regs);pci_release_region (tpci200->info->pdev,TPCI200_IP_INTERFACE_BAR );pci_release_region (tpci200->info->pdev,TPCI200_IO_ID_INT_SPACES_BAR );pci_release_region (tpci200->info->pdev,TPCI200_MEM16_SPACE_BAR );pci_release_region (tpci200->info->pdev,TPCI200_MEM8_SPACE_BAR ); -pci_release_region (tpci200->info->pdev,TPCI200_CFG_MEM_BAR );pci_disable_device (tpci200->info->pdev); -pci_dev_put (tpci200->info->pdev); } static void tpci200_enable_irq(struct tpci200_board *tpci200,
@@ -529,7 +526,7 @@ static int tpci200_pci_probe(struct pci_dev *pdev, tpci200->info =kzalloc (sizeof (struct tpci200_infos ),GFP_KERNEL );if (!tpci200->info) { ret = -ENOMEM ; - goto out_err_info; + goto err_tpci200; }pci_dev_get (pdev);
@@ -540,7 +537,7 @@ static int tpci200_pci_probe(struct pci_dev *pdev,if (ret) {dev_err (&pdev->dev,"Failed to allocate PCI Configuration Memory" ); ret = -EBUSY ; - goto out_err_pci_request; + goto err_tpci200_info; } tpci200->info->cfg_regs = ioremap( pci_resource_start(pdev, TPCI200_CFG_MEM_BAR),
@@ -548,7 +545,7 @@ static int tpci200_pci_probe(struct pci_dev *pdev,if (!tpci200->info->cfg_regs) {dev_err (&pdev->dev,"Failed to map PCI Configuration Memory" ); ret = -EFAULT ; - goto out_err_ioremap; + goto err_request_region; }/* Disable byte swapping for 16 bit IP module access. This will ensure
@@ -571,7 +568,7 @@ static int tpci200_pci_probe(struct pci_dev *pdev,if (ret) {dev_err (&pdev->dev,"error during tpci200 install\n" ); ret = -ENODEV ; - goto out_err_install; + goto err_cfg_regs; }/* Register the carrier in the industry pack bus driver */
@@ -583,7 +580,7 @@ static int tpci200_pci_probe(struct pci_dev *pdev,dev_err (&pdev->dev,"error registering the carrier on ipack driver\n" ); ret = -EFAULT ; - goto out_err_bus_register; + goto err_tpci200_install; }/* save the bus number given by ipack to logging purpose */
@@ -594,19 +591,16 @@ static int tpci200_pci_probe(struct pci_dev *pdev,tpci200_create_device (tpci200, i);return 0 ; -out_err_bus_register: +err_tpci200_install:tpci200_uninstall (tpci200); -/* tpci200->info->cfg_regs is unmapped in tpci200_uninstall */ - tpci200->info->cfg_regs =NULL ; -out_err_install: -if (tpci200->info->cfg_regs) -iounmap (tpci200->info->cfg_regs); -out_err_ioremap: +err_cfg_regs: +pci_iounmap (tpci200->info->pdev, tpci200->info->cfg_regs); +err_request_region:pci_release_region (pdev,TPCI200_CFG_MEM_BAR ); -out_err_pci_request: -pci_dev_put (pdev); +err_tpci200_info:kfree (tpci200->info); -out_err_info: +pci_dev_put (pdev); +err_tpci200:kfree (tpci200);return ret; }
@@ -616,6 +610,12 @@ static void __tpci200_pci_remove(struct tpci200_board *tpci200)ipack_bus_unregister (tpci200->info->ipack_bus);tpci200_uninstall (tpci200); +pci_iounmap (tpci200->info->pdev, tpci200->info->cfg_regs); + +pci_release_region (tpci200->info->pdev,TPCI200_CFG_MEM_BAR ); + +pci_dev_put (tpci200->info->pdev); +kfree (tpci200->info);kfree (tpci200); }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 84/98 ipack: tpci200: fix memory leak in the tpci200_register
In reply to Sasha LevinFrom: Dongliang Mu <[email protected]>
[ Upstream commit 50f05bd114a46a74726e432bf81079d3f13a55b7 ]
The error handling code in tpci200_register does not free interface_regs allocated by ioremap and the current version of error handling code is problematic.
Fix this by refactoring the error handling code and free interface_regs when necessary.
--- drivers/ipack/carriers/tpci200.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
drivers/ipack/carriers/tpci200.c +14 -10
@@ -256,7 +256,7 @@ static int tpci200_register(struct tpci200_board *tpci200)"(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 2 !" , tpci200->info->pdev->bus->number, tpci200->info->pdev->devfn); - goto out_disable_pci; + goto err_disable_device; }/* Request IO ID INT space (Bar 3) */
@@ -268,7 +268,7 @@ static int tpci200_register(struct tpci200_board *tpci200)"(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 3 !" , tpci200->info->pdev->bus->number, tpci200->info->pdev->devfn); - goto out_release_ip_space; + goto err_ip_interface_bar; }/* Request MEM8 space (Bar 5) */
@@ -279,7 +279,7 @@ static int tpci200_register(struct tpci200_board *tpci200)"(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 5!" , tpci200->info->pdev->bus->number, tpci200->info->pdev->devfn); - goto out_release_ioid_int_space; + goto err_io_id_int_spaces_bar; }/* Request MEM16 space (Bar 4) */
@@ -290,7 +290,7 @@ static int tpci200_register(struct tpci200_board *tpci200)"(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 4!" , tpci200->info->pdev->bus->number, tpci200->info->pdev->devfn); - goto out_release_mem8_space; + goto err_mem8_space_bar; }/* Map internal tpci200 driver user space */
@@ -304,7 +304,7 @@ static int tpci200_register(struct tpci200_board *tpci200) tpci200->info->pdev->bus->number, tpci200->info->pdev->devfn); res = -ENOMEM ; - goto out_release_mem8_space; + goto err_mem16_space_bar; }/* Initialize lock that protects interface_regs */
@@ -343,18 +343,22 @@ static int tpci200_register(struct tpci200_board *tpci200)"(bn 0x%X, sn 0x%X) unable to register IRQ !" , tpci200->info->pdev->bus->number, tpci200->info->pdev->devfn); - goto out_release_ioid_int_space; + goto err_interface_regs; }return 0 ; -out_release_mem8_space: +err_interface_regs: +pci_iounmap (tpci200->info->pdev, tpci200->info->interface_regs); +err_mem16_space_bar: +pci_release_region (tpci200->info->pdev,TPCI200_MEM16_SPACE_BAR ); +err_mem8_space_bar:pci_release_region (tpci200->info->pdev,TPCI200_MEM8_SPACE_BAR ); -out_release_ioid_int_space: +err_io_id_int_spaces_bar:pci_release_region (tpci200->info->pdev,TPCI200_IO_ID_INT_SPACES_BAR ); -out_release_ip_space: +err_ip_interface_bar:pci_release_region (tpci200->info->pdev,TPCI200_IP_INTERFACE_BAR ); -out_disable_pci: +err_disable_device:pci_disable_device (tpci200->info->pdev);return res; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 85/98 ALSA: hda/realtek: Enable 4-speaker output for Dell XPS 15 9510 laptop
In reply to Sasha LevinFrom: Kristin Paget <[email protected]>
[ Upstream commit da94692001ea45ffa1f5e9f17ecdef7aecd90c27 ]
The 2021-model XPS 15 appears to use the same 4-speakers-on-ALC289 audio setup as the Precision models, so requires the same quirk to enable woofer output. Tested on my own 9510.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -8258,6 +8258,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1028 ,0x0a2e ,"Dell" ,ALC236_FIXUP_DELL_AIO_HEADSET_MIC ),SND_PCI_QUIRK (0x1028 ,0x0a30 ,"Dell" ,ALC236_FIXUP_DELL_AIO_HEADSET_MIC ),SND_PCI_QUIRK (0x1028 ,0x0a58 ,"Dell" ,ALC255_FIXUP_DELL_HEADSET_MIC ), +SND_PCI_QUIRK (0x1028 ,0x0a61 ,"Dell XPS 15 9510" ,ALC289_FIXUP_DUAL_SPK ),SND_PCI_QUIRK (0x1028 ,0x164a ,"Dell" ,ALC293_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x164b ,"Dell" ,ALC293_FIXUP_DELL1_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 86/98 mmc: sdhci-iproc: Cap min clock frequency on BCM2711
In reply to Sasha LevinFrom: Nicolas Saenz Julienne <[email protected]>
[ Upstream commit c9107dd0b851777d7e134420baf13a5c5343bc16 ]
There is a known bug on BCM2711's SDHCI core integration where the controller will hang when the difference between the core clock and the bus clock is too great. Specifically this can be reproduced under the following conditions:
- No SD card plugged in, polling thread is running, probing cards at 100 kHz.
- BCM2711's core clock configured at 500MHz or more.
So set 200 kHz as the minimum clock frequency available for that board.
For more information on the issue see this:
https://lore.kernel.org/linux-mmc/[email protected]/T/#m11f2783a09b581da6b8a15f302625b43a6ecdeca
--- drivers/mmc/host/sdhci-iproc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/mmc/host/sdhci-iproc.c +18 -0
@@ -173,6 +173,23 @@ static unsigned int sdhci_iproc_get_max_clock(struct sdhci_host *host)return pltfm_host->clock; } +/* +* There is a known bug on BCM2711's SDHCI core integration where the +* controller will hang when the difference between the core clock and the bus +* clock is too great. Specifically this can be reproduced under the following +* conditions: +* +* - No SD card plugged in, polling thread is running, probing cards at +* 100 kHz. +* - BCM2711's core clock configured at 500MHz or more +* +* So we set 200kHz as the minimum clock frequency available for that SoC. +*/ +static unsigned int sdhci_iproc_bcm2711_get_min_clock (struct sdhci_host *host) +{ +return 200000 ; +} +static const struct sdhci_ops sdhci_iproc_ops = { .set_clock = sdhci_set_clock, .get_max_clock = sdhci_iproc_get_max_clock,
@@ -271,6 +288,7 @@ static const struct sdhci_ops sdhci_iproc_bcm2711_ops = { .set_clock = sdhci_set_clock, .set_power = sdhci_set_power_and_bus_voltage, .get_max_clock = sdhci_iproc_get_max_clock, + .get_min_clock = sdhci_iproc_bcm2711_get_min_clock, .set_bus_width = sdhci_set_bus_width, .reset = sdhci_reset, .set_uhs_signaling = sdhci_set_uhs_signaling,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 87/98 mmc: sdhci-iproc: Set SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN on BCM2711
In reply to Sasha LevinFrom: Nicolas Saenz Julienne <[email protected]>
[ Upstream commit 419dd626e357e89fc9c4e3863592c8b38cfe1571 ]
The controller doesn't seem to pick-up on clock changes, so set the SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN flag to query the clock frequency directly from the clock.
--- drivers/mmc/host/sdhci-iproc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-iproc.c +2 -1
@@ -295,7 +295,8 @@ static const struct sdhci_ops sdhci_iproc_bcm2711_ops = { };static const struct sdhci_pltfm_data sdhci_bcm2711_pltfm_data = { - .quirks =SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 , + .quirks =SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 | +SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN , .ops = &sdhci_iproc_bcm2711_ops, };
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 88/98 btrfs: prevent rename2 from exchanging a subvol with a directory from different parents
In reply to Sasha LevinFrom: NeilBrown <[email protected]>
[ Upstream commit 3f79f6f6247c83f448c8026c3ee16d4636ef8d4f ]
Cross-rename lacks a check when that would prevent exchanging a directory and subvolume from different parent subvolume. This causes data inconsistencies and is caught before commit by tree-checker, turning the filesystem to read-only.
Calling the renameat2 with RENAME_EXCHANGE flags like
renameat2(AT_FDCWD, namesrc, AT_FDCWD, namedest, (1 << 1))
on two paths:
namesrc = dir1/subvol1/dir2
namedest = subvol2/subvol3
will cause key order problem with following write time tree-checker report:
[1194842.307890] BTRFS critical (device loop1): corrupt leaf: root=5 block=27574272 slot=10 ino=258, invalid previous key objectid, have 257 expect 258 [1194842.322221] BTRFS info (device loop1): leaf 27574272 gen 8 total ptrs 11 free space 15444 owner 5 [1194842.331562] BTRFS info (device loop1): refs 2 lock_owner 0 current 26561 [1194842.338772] item 0 key (256 1 0) itemoff 16123 itemsize 160 [1194842.338793] inode generation 3 size 16 mode 40755 [1194842.338801] item 1 key (256 12 256) itemoff 16111 itemsize 12 [1194842.338809] item 2 key (256 84 2248503653) itemoff 16077 itemsize 34 [1194842.338817] dir oid 258 type 2 [1194842.338823] item 3 key (256 84 2363071922) itemoff 16043 itemsize 34 [1194842.338830] dir oid 257 type 2 [1194842.338836] item 4 key (256 96 2) itemoff 16009 itemsize 34 [1194842.338843] item 5 key (256 96 3) itemoff 15975 itemsize 34 [1194842.338852] item 6 key (257 1 0) itemoff 15815 itemsize 160 [1194842.338863] inode generation 6 size 8 mode 40755 [1194842.338869] item 7 key (257 12 256) itemoff 15801 itemsize 14 [1194842.338876] item 8 key (257 84 2505409169) itemoff 15767 itemsize 34 [1194842.338883] dir oid 256 type 2 [1194842.338888] item 9 key (257 96 2) itemoff 15733 itemsize 34 [1194842.338895] item 10 key (258 12 256) itemoff 15719 itemsize 14 [1194842.339163] BTRFS error (device loop1): block=27574272 write time tree block corruption detected [1194842.339245] ------------[ cut here ]------------ [1194842.443422] WARNING: CPU: 6 PID: 26561 at fs/btrfs/disk-io.c:449 csum_one_extent_buffer+0xed/0x100 [btrfs] [1194842.511863] CPU: 6 PID: 26561 Comm: kworker/u17:2 Not tainted 5.14.0-rc3-git+ #793 [1194842.511870] Hardware name: empty empty/S3993, BIOS PAQEX0-3 02/24/2008 [1194842.511876] Workqueue: btrfs-worker-high btrfs_work_helper [btrfs] [1194842.511976] RIP: 0010:csum_one_extent_buffer+0xed/0x100 [btrfs] [1194842.512068] RSP: 0018:ffffa2c284d77da0 EFLAGS: 00010282 [1194842.512074] RAX: 0000000000000000 RBX: 0000000000001000 RCX: ffff928867bd9978 [1194842.512078] RDX: 0000000000000000 RSI: 0000000000000027 RDI: ffff928867bd9970 [1194842.512081] RBP: ffff92876b958000 R08: 0000000000000001 R09: 00000000000c0003 [1194842.512085] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000 [1194842.512088] R13: ffff92875f989f98 R14: 0000000000000000 R15: 0000000000000000 [1194842.512092] FS: 0000000000000000(0000) GS:ffff928867a00000(0000) knlGS:0000000000000000 [1194842.512095] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [1194842.512099] CR2: 000055f5384da1f0 CR3: 0000000102fe4000 CR4: 00000000000006e0 [1194842.512103] Call Trace: [1194842.512128] ? run_one_async_free+0x10/0x10 [btrfs] [1194842.631729] btree_csum_one_bio+0x1ac/0x1d0 [btrfs] [1194842.631837] run_one_async_start+0x18/0x30 [btrfs] [1194842.631938] btrfs_work_helper+0xd5/0x1d0 [btrfs] [1194842.647482] process_one_work+0x262/0x5e0 [1194842.647520] worker_thread+0x4c/0x320 [1194842.655935] ? process_one_work+0x5e0/0x5e0 [1194842.655946] kthread+0x135/0x160 [1194842.655953] ? set_kthread_struct+0x40/0x40 [1194842.655965] ret_from_fork+0x1f/0x30 [1194842.672465] irq event stamp: 1729 [1194842.672469] hardirqs last enabled at (1735): [<ffffffffbd1104f5>] console_trylock_spinning+0x185/0x1a0 [1194842.672477] hardirqs last disabled at (1740): [<ffffffffbd1104cc>] console_trylock_spinning+0x15c/0x1a0 [1194842.672482] softirqs last enabled at (1666): [<ffffffffbdc002e1>] __do_softirq+0x2e1/0x50a [1194842.672491] softirqs last disabled at (1651): [<ffffffffbd08aab7>] __irq_exit_rcu+0xa7/0xd0
The corrupted data will not be written, and filesystem can be unmounted and mounted again (all changes since the last commit will be lost).
Add the missing check for new_ino so that all non-subvolumes must reside under the same parent subvolume. There's an exception allowing to exchange two subvolumes from any parents as the directory representing a subvolume is only a logical link and does not have any other structures related to the parent subvolume, unlike files, directories etc, that are always in the inode namespace of the parent subvolume.
--- fs/btrfs/inode.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
fs/btrfs/inode.c +8 -2
@@ -8904,8 +8904,14 @@ static int btrfs_rename_exchange(struct inode *old_dir,bool dest_log_pinned = false;bool need_abort = false; -/* we only allow rename subvolume link between subvolumes */ -if (old_ino !=BTRFS_FIRST_FREE_OBJECTID && root != dest) +/* +* For non-subvolumes allow exchange only within one subvolume, in the +* same inode namespace. Two subvolumes (represented as directory) can +* be exchanged as they're a logical link and have a fixed inode number. +*/ +if (root != dest && + (old_ino !=BTRFS_FIRST_FREE_OBJECTID || + new_ino !=BTRFS_FIRST_FREE_OBJECTID ))return -EXDEV ;/* close the race window with snapshot create/destroy ioctl */
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 89/98 ALSA: hda/via: Apply runtime PM workaround for ASUS B23E
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 4bf61ad5f0204b67ba570da6e5c052c2095e29df ]
ASUS B23E requires the same workaround like other machines with VT1802, otherwise it looses the codec power on a few nodes and the sound kept silence.
--- sound/pci/hda/patch_via.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_via.c +1 -0
@@ -1041,6 +1041,7 @@ static const struct hda_fixup via_fixups[] = { };static const struct snd_pci_quirk vt2002p_fixups[] = { +SND_PCI_QUIRK (0x1043 ,0x13f7 ,"Asus B23E" ,VIA_FIXUP_POWER_SAVE ),SND_PCI_QUIRK (0x1043 ,0x1487 ,"Asus G75" ,VIA_FIXUP_ASUS_G75 ),SND_PCI_QUIRK (0x1043 ,0x8532 ,"Asus X202E" ,VIA_FIXUP_INTMIC_BOOST ),SND_PCI_QUIRK_VENDOR (0x1558 ,"Clevo" ,VIA_FIXUP_POWER_SAVE ),
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 90/98 s390/pci: fix use after free of zpci_dev
In reply to Sasha LevinFrom: Niklas Schnelle <[email protected]>
[ Upstream commit 2a671f77ee49f3e78997b77fdee139467ff6a598 ]
The struct pci_dev uses reference counting but zPCI assumed erroneously that the last reference would always be the local reference after calling pci_stop_and_remove_bus_device(). This is usually the case but not how reference counting works and thus inherently fragile.
In fact one case where this causes a NULL pointer dereference when on an SRIOV device the function 0 was hot unplugged before another function of the same multi-function device. In this case the second function's pdev->sriov->dev reference keeps the struct pci_dev of function 0 alive even after the unplug. This bug was previously hidden by the fact that we were leaking the struct pci_dev which in turn means that it always outlived the struct zpci_dev. This was fixed in commit 0b13525c20fe ("s390/pci: fix leak of PCI device structure") exposing the broken behavior.
Fix this by accounting for the long living reference a struct pci_dev has to its underlying struct zpci_dev via the zbus->function[] array and only release that in pcibios_release_device() ensuring that the struct pci_dev is not left with a dangling reference. This is a minimal fix in the future it would probably better to use fine grained reference counting for struct zpci_dev.
--- arch/s390/pci/pci.c | 6 ++++++ arch/s390/pci/pci_bus.h | 5 +++++ 2 files changed, 11 insertions(+)
arch/s390/pci/pci.c +6 -0
@@ -558,9 +558,12 @@ static void zpci_cleanup_bus_resources(struct zpci_dev *zdev)int pcibios_add_device (struct pci_dev *pdev) { +struct zpci_dev *zdev =to_zpci (pdev);struct resource *res;int i; +/* The pdev has a reference to the zdev via its bus */ +zpci_zdev_get (zdev);if (pdev->is_physfn) pdev->no_vf_scan =1 ;
@@ -580,7 +583,10 @@ int pcibios_add_device(struct pci_dev *pdev)void pcibios_release_device (struct pci_dev *pdev) { +struct zpci_dev *zdev =to_zpci (pdev); +zpci_unmap_resources (pdev); +zpci_zdev_put (zdev); }int pcibios_enable_device (struct pci_dev *pdev,int mask)
arch/s390/pci/pci_bus.h +5 -0
@@ -16,6 +16,11 @@ static inline void zpci_zdev_put(struct zpci_dev *zdev)kref_put (&zdev->kref, zpci_release_device); } +static inline void zpci_zdev_get (struct zpci_dev *zdev) +{ +kref_get (&zdev->kref); +} +int zpci_alloc_domain (int domain);void zpci_free_domain (int domain); int zpci_setup_bus_resources(struct zpci_dev *zdev,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 91/98 PCI: Increase D3 delay for AMD Renoir/Cezanne XHCI
In reply to Sasha LevinFrom: Marcin Bachry <[email protected]>
[ Upstream commit e0bff43220925b7e527f9d3bc9f5c624177c959e ]
The Renoir XHCI controller apparently doesn't resume reliably with the standard D3hot-to-D0 delay. Increase it to 20ms.
[Alex: I talked to the AMD USB hardware team and the AMD Windows team and they are not aware of any HW errata or specific issues. The HW works fine in Windows. I was told Windows uses a rather generous default delay of 100ms for PCI state transitions.]
--- drivers/pci/quirks.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/quirks.c +1 -0
@@ -1905,6 +1905,7 @@ static void quirk_ryzen_xhci_d3hot(struct pci_dev *dev) }DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_AMD ,0x15e0 , quirk_ryzen_xhci_d3hot);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_AMD ,0x15e1 , quirk_ryzen_xhci_d3hot); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_AMD ,0x1639 , quirk_ryzen_xhci_d3hot);#ifdef CONFIG_X86_IO_APIC static int dmi_disable_ioapicreroute (const struct dmi_system_id *d)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 92/98 ALSA: hda/realtek: Limit mic boost on HP ProBook 445 G8
In reply to Sasha LevinFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 8903376dc69949199301b290cc22dc64ae5d8a6d ]
The mic has lots of noises if mic boost is enabled. So disable mic boost to get crystal clear audio capture.
--- sound/pci/hda/patch_realtek.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
sound/pci/hda/patch_realtek.c +9 -2
@@ -6590,6 +6590,7 @@ enum {ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP ,ALC623_FIXUP_LENOVO_THINKSTATION_P340 ,ALC255_FIXUP_ACER_HEADPHONE_AND_MIC , + ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST, }; static const struct hda_fixup alc269_fixups[] = {
@@ -8168,6 +8169,12 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id =ALC255_FIXUP_XIAOMI_HEADSET_MIC }, + [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc269_fixup_limit_int_mic_boost, + .chained = true, + .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF, + }, };static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -8364,8 +8371,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8847 ,"HP EliteBook x360 830 G8 Notebook PC" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x884b ,"HP EliteBook 840 Aero G8 Notebook PC" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x884c ,"HP EliteBook 840 G8 Notebook PC" ,ALC285_FIXUP_HP_GPIO_LED ), -SND_PCI_QUIRK (0x103c ,0x8862 ,"HP ProBook 445 G8 Notebook PC" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ), -SND_PCI_QUIRK (0x103c ,0x8863 ,"HP ProBook 445 G8 Notebook PC" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ), +SND_PCI_QUIRK (0x103c ,0x8862 ,"HP ProBook 445 G8 Notebook PC" ,ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST ), +SND_PCI_QUIRK (0x103c ,0x8863 ,"HP ProBook 445 G8 Notebook PC" ,ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST ),SND_PCI_QUIRK (0x103c ,0x886d ,"HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ),SND_PCI_QUIRK (0x103c ,0x8870 ,"HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ), SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 93/98 ASoC: intel: atom: Fix breakage for PCM buffer address setup
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 65ca89c2b12cca0d473f3dd54267568ad3af55cc ]
The commit 2e6b836312a4 ("ASoC: intel: atom: Fix reference to PCM buffer address") changed the reference of PCM buffer address to substream->runtime->dma_addr as the buffer address may change dynamically. However, I forgot that the dma_addr field is still not set up for the CONTINUOUS buffer type (that this driver uses) yet in 5.14 and earlier kernels, and it resulted in garbage I/O. The problem will be fixed in 5.15, but we need to address it quickly for now.
The fix is to deduce the address again from the DMA pointer with virt_to_phys(), but from the right one, substream->runtime->dma_area.
--- sound/soc/intel/atom/sst-mfld-platform-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/atom/sst-mfld-platform-pcm.c +1 -1
@@ -127,7 +127,7 @@ static void sst_fill_alloc_params(struct snd_pcm_substream *substream,snd_pcm_uframes_t period_size;ssize_t periodbytes;ssize_t buffer_bytes =snd_pcm_lib_buffer_bytes (substream); -u32 buffer_addr = substream->runtime->dma_addr; +u32 buffer_addr =virt_to_phys (substream->runtime->dma_area); channels = substream->runtime->channels; period_size = substream->runtime->period_size;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 94/98 mm: memcontrol: fix occasional OOMs due to proportional memory.low reclaim
In reply to Sasha LevinFrom: Johannes Weiner <[email protected]>
[ Upstream commit f56ce412a59d7d938b81de8878faef128812482c ]
We've noticed occasional OOM killing when memory.low settings are in effect for cgroups. This is unexpected and undesirable as memory.low is supposed to express non-OOMing memory priorities between cgroups.
The reason for this is proportional memory.low reclaim. When cgroups are below their memory.low threshold, reclaim passes them over in the first round, and then retries if it couldn't find pages anywhere else. But when cgroups are slightly above their memory.low setting, page scan force is scaled down and diminished in proportion to the overage, to the point where it can cause reclaim to fail as well - only in that case we currently don't retry, and instead trigger OOM.
To fix this, hook proportional reclaim into the same retry logic we have in place for when cgroups are skipped entirely. This way if reclaim fails and some cgroups were scanned with diminished pressure, we'll try another full-force cycle before giving up and OOMing.
[[email protected]: coding-style fixes]
--- include/linux/memcontrol.h | 29 +++++++++++++++-------------- mm/vmscan.c | 27 +++++++++++++++++++-------- 2 files changed, 34 insertions(+), 22 deletions(-)
include/linux/memcontrol.h +15 -14
@@ -360,12 +360,15 @@ static inline bool mem_cgroup_disabled(void)return !cgroup_subsys_enabled (memory_cgrp_subsys); } -static inline unsigned long mem_cgroup_protection (struct mem_cgroup *root, -struct mem_cgroup *memcg, -bool in_low_reclaim) +static inline void mem_cgroup_protection (struct mem_cgroup *root, +struct mem_cgroup *memcg, +unsigned long *min, +unsigned long *low) { + *min = *low =0 ; +if (mem_cgroup_disabled ()) -return 0 ; +return ;/* * There is no reclaim protection applied to a targeted reclaim.
@@ -401,13 +404,10 @@ static inline unsigned long mem_cgroup_protection(struct mem_cgroup *root,* */ if (root == memcg) -return 0 ; - -if (in_low_reclaim) -return READ_ONCE (memcg->memory.emin); +return ; -return max (READ_ONCE (memcg->memory.emin), -READ_ONCE (memcg->memory.elow)); + *min =READ_ONCE (memcg->memory.emin); + *low =READ_ONCE (memcg->memory.elow); } void mem_cgroup_calculate_protection(struct mem_cgroup *root,
@@ -966,11 +966,12 @@ static inline void memcg_memory_event_mm(struct mm_struct *mm, { } -static inline unsigned long mem_cgroup_protection (struct mem_cgroup *root, -struct mem_cgroup *memcg, -bool in_low_reclaim) +static inline void mem_cgroup_protection (struct mem_cgroup *root, +struct mem_cgroup *memcg, +unsigned long *min, +unsigned long *low) { -return 0 ; + *min = *low =0 ; } static inline void mem_cgroup_calculate_protection(struct mem_cgroup *root,
mm/vmscan.c +19 -8
@@ -102,9 +102,12 @@ struct scan_control { unsigned int may_swap:1;/* -* Cgroups are not reclaimed below their configured memory.low, -* unless we threaten to OOM. If any cgroups are skipped due to -* memory.low and nothing was reclaimed, go back for memory.low. +* Cgroup memory below memory.low is protected as long as we +* don't threaten to OOM. If any cgroup is reclaimed at +* reduced force or passed over entirely due to its memory.low +* setting (memcg_low_skipped), and nothing is reclaimed as a +* result, then go back for one more cycle that reclaims the protected +* memory (memcg_low_reclaim) to avert OOM. */ unsigned int memcg_low_reclaim:1; unsigned int memcg_low_skipped:1;
@@ -2323,15 +2326,14 @@ out:for_each_evictable_lru (lru) {int file =is_file_lru (lru);unsigned long lruvec_size; +unsigned long low, min;unsigned long scan; -unsigned long protection; lruvec_size =lruvec_lru_size (lruvec, lru, sc->reclaim_idx); - protection =mem_cgroup_protection (sc->target_mem_cgroup, - memcg, - sc->memcg_low_reclaim); +mem_cgroup_protection (sc->target_mem_cgroup, memcg, + &min, &low); -if (protection) { +if (min || low) {/* * Scale a cgroup's reclaim pressure by proportioning * its current usage to its memory.low or memory.min
@@ -2362,6 +2364,15 @@ out:* hard protection. */ unsigned long cgroup_size =mem_cgroup_size (memcg); +unsigned long protection; + +/* memory.low scaling, make sure we retry before OOM */ +if (!sc->memcg_low_reclaim && low > min) { + protection = low; + sc->memcg_low_skipped =1 ; + }else { + protection = min; + }/* Avoid TOCTOU with earlier protection check */ cgroup_size =max (cgroup_size, protection);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 95/98 fs: warn about impending deprecation of mandatory locks
In reply to Sasha LevinFrom: Jeff Layton <[email protected]>
[ Upstream commit fdd92b64d15bc4aec973caa25899afd782402e68 ]
We've had CONFIG_MANDATORY_FILE_LOCKING since 2015 and a lot of distros have disabled it. Warn the stragglers that still use "-o mand" that we'll be dropping support for that mount option.
--- fs/namespace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/namespace.c +5 -1
@@ -1697,8 +1697,12 @@ static inline bool may_mount(void) }#ifdef CONFIG_MANDATORY_FILE_LOCKING -static inline bool may_mandlock (void ) +static bool may_mandlock (void ) { +pr_warn_once ("======================================================\n" +"WARNING: the mand mount option is being deprecated and\n" +" will be removed in v5.15!\n" +"======================================================\n" );return capable (CAP_SYS_ADMIN ); }#else
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 96/98 io_uring: fix xa_alloc_cycle() error return value check
In reply to Sasha LevinFrom: Jens Axboe <[email protected]>
[ upstream commit a30f895ad3239f45012e860d4f94c1a388b36d14 ]
We currently check for ret != 0 to indicate error, but '1' is a valid return and just indicates that the allocation succeeded with a wrap. Correct the check to be for < 0, like it was before the xarray conversion.
--- fs/io_uring.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
fs/io_uring.c +6 -5
@@ -9601,11 +9601,12 @@ static int io_register_personality(struct io_ring_ctx *ctx) ret =xa_alloc_cyclic (&ctx->personalities, &id, (void *)iod,XA_LIMIT (0 ,USHRT_MAX ), &ctx->pers_next,GFP_KERNEL ); -if (!ret) -return id; -put_cred (iod->creds); -kfree (iod); -return ret; +if (ret <0 ) { +put_cred (iod->creds); +kfree (iod); +return ret; + } +return id; } static int io_register_restrictions(struct io_ring_ctx *ctx, void __user *arg,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 97/98 io_uring: only assign io_uring_enter() SQPOLL error in actual error case
In reply to Sasha LevinFrom: Jens Axboe <[email protected]>
[ upstream commit 21f965221e7c42609521342403e8fb91b8b3e76e ]
If an SQPOLL based ring is newly created and an application issues an io_uring_enter(2) system call on it, then we can return a spurious -EOWNERDEAD error. This happens because there's nothing to submit, and if the caller doesn't specify any other action, the initial error assignment of -EOWNERDEAD never gets overwritten. This causes us to return it directly, even if it isn't valid.
Move the error assignment into the actual failure case instead.
--- fs/io_uring.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/io_uring.c +3 -2
@@ -9078,9 +9078,10 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,if (ctx->flags &IORING_SETUP_SQPOLL ) {io_cqring_overflow_flush (ctx, false,NULL ,NULL ); - ret = -EOWNERDEAD ; -if (unlikely (ctx->sqo_dead)) +if (unlikely (ctx->sqo_dead)) { + ret = -EOWNERDEAD ; goto out; + }if (flags &IORING_ENTER_SQ_WAKEUP )wake_up (&ctx->sq_data->wait);if (flags &IORING_ENTER_SQ_WAIT ) {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 98/98 Linux 5.10.61-rc1
In reply to Sasha Levin--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
@@ -1,8 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 5 PATCHLEVEL = 10 -SUBLEVEL = 60 -EXTRAVERSION = +SUBLEVEL = 61 +EXTRAVERSION = -rc1 NAME = Dare mighty things # *DOCUMENTATION*
Signature · 1 line
2.30.2
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 5.10.61 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-5.10.y
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Sasha Levin
maintainerQuoted 7 lines · Pavel Machek
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 5.10.61 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 5 lines
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-5.10.y
Tested-by Pavel Machek (CIP) <[email protected]>
Thanks for testing, Pavel!
Signature · 2 lines
Thanks, Sasha
Hi Sasha,
Quoted 8 lines · Sasha Levin
This is the start of the stable review cycle for the 5.10.61 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu 26 Aug 2021 04:58:25 PM UTC. Anything received after that time might be too late.
Build test:
mips (gcc version 11.1.1 20210816): 63 configs -> no new failure arm (gcc version 11.1.1 20210816): 105 configs -> no new failure arm64 (gcc version 11.1.1 20210816): 3 configs -> no failure x86_64 (gcc version 10.2.1 20210110): 4 configs -> no failure
Boot test:x86_64: Booted on my test laptop. No regression.x86_64: Booted on qemu. No regression. [1]
arm64: Booted on rpi4b (4GB model). No regression. [2]
[1]. https://openqa.qa.codethink.co.uk/tests/56
[2]. https://openqa.qa.codethink.co.uk/tests/57
--
Regards
Sudip
Sasha Levin
maintainerQuoted 23 lines · Sudip Mukherjee
Hi Sasha,
Quoted 8 lines · Sasha Levin
This is the start of the stable review cycle for the 5.10.61 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu 26 Aug 2021 04:58:25 PM UTC. Anything received after that time might be too late.
Build test:
mips (gcc version 11.1.1 20210816): 63 configs -> no new failure arm (gcc version 11.1.1 20210816): 105 configs -> no new failure arm64 (gcc version 11.1.1 20210816): 3 configs -> no failurex86_64(gcc version 10.2.1 20210110): 4 configs -> no failureBoot test:
x86_64: Booted on my test laptop. No regression.x86_64: Booted on qemu. No regression. [1]
arm64: Booted on rpi4b (4GB model). No regression. [2]
Quoted 5 lines
[1]. https://openqa.qa.codethink.co.uk/tests/56
[2]. https://openqa.qa.codethink.co.uk/tests/57Tested-by Sudip Mukherjee <[email protected]>
Thanks for testing, Sudip!
Signature · 2 lines
Thanks, Sasha
Quoted 9 lines · Sasha Levin
This is the start of the stable review cycle for the 5.10.61 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu 26 Aug 2021 04:58:25 PM UTC. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.10.y&id2=v5.10.60or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.Thanks,
Sasha
All tests passing for Tegra ...
Test results for stable-v5.10:
10 builds: 10 pass, 0 fail
28 boots: 28 pass, 0 fail
75 tests: 75 pass, 0 failLinux version: 5.10.61-rc1-gbd3eb40a9de7
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Hello!
Quoted 8 lines · Sasha Levin
This is the start of the stable review cycle for the 5.10.61 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu 26 Aug 2021 04:58:25 PM UTC. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.10.y&id2=v5.10.60or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.Thanks,
Sasha
Results from Linaro's test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 5.10.61-rc1
* git: ['https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git', 'https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc']
* git branch: linux-5.10.y
* git commit: bd3eb40a9de703ab9ab65f9c583e40d185d6aaad
* git describe: v5.10.60-98-gbd3eb40a9de7
* test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.10.y/build/v5.10.60-98-gbd3eb40a9de7
## No regressions (compared to v5.10.60)
## No fixes (compared to v5.10.60)
## Test result summary
total: 78086, pass: 66126, fail: 526, skip: 10629, xfail: 805
## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 226 total, 226 passed, 0 failed
* arm64: 32 total, 32 passed, 0 failed
* dragonboard-410c: 1 total, 1 passed, 0 failed
* hi6220-hikey: 1 total, 1 passed, 0 failed
* i386: 31 total, 31 passed, 0 failed
* juno-r2: 1 total, 1 passed, 0 failed
* mips: 48 total, 48 passed, 0 failed
* parisc: 9 total, 9 passed, 0 failed
* powerpc: 27 total, 27 passed, 0 failed
* riscv: 24 total, 24 passed, 0 failed
* s390: 21 total, 21 passed, 0 failed
* sh: 18 total, 18 passed, 0 failed
* sparc: 9 total, 9 passed, 0 failed
* x15: 1 total, 1 passed, 0 failed
* x86: 1 total, 1 passed, 0 failed
* x86_64: 33 total, 33 passed, 0 failed
## Test suites summary
* fwts
* install-android-platform-tools-r2600
* kselftest-android
* kselftest-arm64
* kselftest-bpf
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-vm
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-tracing-tests
* network-basic-tests
* packetdrill
* perf
* rcutorture
* ssuite
* v4l2-compliance
Greetings!
Daniel Díaz
[email protected]
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Sasha Levin
This is the start of the stable review cycle for the 5.10.61 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu 26 Aug 2021 04:58:25 PM UTC. Anything received after that time might be too late.
Build results:
total: 159 pass: 159 fail: 0 Qemu test results: total: 471 pass: 471 fail: 0
Guenter
Quoted 9 lines · Sasha Levin
This is the start of the stable review cycle for the 5.10.61 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu 26 Aug 2021 04:58:25 PM UTC. Anything received after that time might be too late.
Quoted 9 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.10.y&id2=v5.10.60or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.Thanks,
Sasha
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 9 lines · Sasha Levin
This is the start of the stable review cycle for the 5.10.61 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu 26 Aug 2021 04:58:25 PM UTC. Anything received after that time might be too late.
Quoted 9 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.10.y&id2=v5.10.60or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.Thanks,
Sasha
Tested on arm64 and x86 for 5.10.61-rc1,
Kernel repo:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Branch: linux-5.10.y
Version: 5.10.61-rc1
Commit: bd3eb40a9de703ab9ab65f9c583e40d185d6aaad
Compiler: gcc version 7.3.0 (GCC)
arm64:
--------------------------------------------------------------------
Testcase Result Summary:
total: 8907
passed: 8907
failed: 0
timeout: 0
--------------------------------------------------------------------
x86:
--------------------------------------------------------------------
Testcase Result Summary:
total: 8907
passed: 8907
failed: 0
timeout: 0
--------------------------------------------------------------------
Sasha Levin
maintainerQuoted 49 lines · Samuel Zou
Quoted 9 lines · Sasha Levin
This is the start of the stable review cycle for the 5.10.61 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu 26 Aug 2021 04:58:25 PM UTC. Anything received after that time might be too late.
Quoted 9 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.10.y&id2=v5.10.60or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.Thanks,
SashaTested on arm64 and x86 for 5.10.61-rc1,
Kernel repo:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Branch: linux-5.10.y
Version: 5.10.61-rc1
Commit:bd3eb40a9de703ab9ab65f9c583e40d185d6aaad
Compiler: gcc version 7.3.0 (GCC)arm64:
--------------------------------------------------------------------
Testcase Result Summary:
total: 8907
passed: 8907
failed: 0
timeout: 0
--------------------------------------------------------------------x86:
--------------------------------------------------------------------
Testcase Result Summary:
total: 8907
passed: 8907
failed: 0
timeout: 0
--------------------------------------------------------------------
Quoted 1 line
Tested-by Hulk Robot <[email protected]>
Thanks for testing, Samuel!
Signature · 2 lines
Thanks, Sasha