drm/vmwgfx: Fix subresource updates with new contexts
Subsystems (41)
Sasha Levin
maintainerPATCH 160/219 usb: chipidea: host: fix port index underflow and UBSAN complains
In reply to Sasha LevinFrom: Li Jun <[email protected]>
[ Upstream commit e5d6a7c6cfae9e714a0e8ff64facd1ac68a784c6 ]
If wIndex is 0 (and it often is), these calculations underflow and UBSAN complains, here resolve this by not decrementing the index when it is equal to 0, this copies the solution from commit 85e3990bea49 ("USB: EHCI: avoid undefined pointer arithmetic and placate UBSAN")
--- drivers/usb/chipidea/host.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/usb/chipidea/host.c +11 -3
@@ -240,15 +240,18 @@ static int ci_ehci_hub_control( ) {struct ehci_hcd *ehci =hcd_to_ehci (hcd); +unsigned int ports =HCS_N_PORTS (ehci->hcs_params);u32 __iomem *status_reg; -u32 temp; +u32 temp, port_index;unsigned long flags;int retval =0 ;bool done = false;struct device *dev = hcd->self.controller;struct ci_hdrc *ci =dev_get_drvdata (dev); - status_reg = &ehci->regs->port_status[(wIndex &0xff ) -1 ]; + port_index = wIndex &0xff ; + port_index -= (port_index >0 ); + status_reg = &ehci->regs->port_status[port_index];spin_lock_irqsave (&ehci->lock, flags);
@@ -260,6 +263,11 @@ static int ci_ehci_hub_control( }if (typeReq == SetPortFeature && wValue ==USB_PORT_FEAT_SUSPEND ) { +if (!wIndex || wIndex > ports) { + retval = -EPIPE ; + goto done; + } + temp =ehci_readl (ehci, status_reg);if ((temp &PORT_PE ) ==0 || (temp &PORT_RESET ) !=0 ) { retval = -EPIPE ;
@@ -288,7 +296,7 @@ static int ci_ehci_hub_control(ehci_writel (ehci, temp, status_reg); } -set_bit ((wIndex &0xff ) -1 , &ehci->suspended_ports); +set_bit (port_index, &ehci->suspended_ports); goto done; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 161/219 lockd: lockd server-side shouldn't set fl_ops
In reply to Sasha LevinFrom: "J. Bruce Fields" <[email protected]>
[ Upstream commit 7de875b231edb807387a81cde288aa9e1015ef9e ]
Locks have two sets of op arrays, fl_lmops for the lock manager (lockd or nfsd), fl_ops for the filesystem. The server-side lockd code has been setting its own fl_ops, which leads to confusion (and crashes) in the reexport case, where the filesystem expects to be the only one setting fl_ops.
And there's no reason for it that I can see-the lm_get/put_owner ops do the same job.
--- fs/lockd/svclock.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-)
fs/lockd/svclock.c +12 -18
@@ -395,28 +395,10 @@ nlmsvc_release_lockowner(struct nlm_lock *lock)nlmsvc_put_lockowner (lock->fl.fl_owner); } -static void nlmsvc_locks_copy_lock (struct file_lock *new,struct file_lock *fl) -{ -struct nlm_lockowner *nlm_lo = (struct nlm_lockowner *)fl->fl_owner; - new->fl_owner =nlmsvc_get_lockowner (nlm_lo); -} - -static void nlmsvc_locks_release_private (struct file_lock *fl) -{ -nlmsvc_put_lockowner ((struct nlm_lockowner *)fl->fl_owner); -} - -static const struct file_lock_operations nlmsvc_lock_ops = { - .fl_copy_lock = nlmsvc_locks_copy_lock, - .fl_release_private = nlmsvc_locks_release_private, -}; -void nlmsvc_locks_init_private (struct file_lock *fl,struct nlm_host *host,pid_t pid) { fl->fl_owner =nlmsvc_find_lockowner (host, pid); -if (fl->fl_owner !=NULL ) - fl->fl_ops = &nlmsvc_lock_ops; }/*
@@ -788,9 +770,21 @@ nlmsvc_notify_blocked(struct file_lock *fl)printk (KERN_WARNING "lockd: notification for unknown block!\n" ); } +static fl_owner_t nlmsvc_get_owner (fl_owner_t owner) +{ +return nlmsvc_get_lockowner (owner); +} + +static void nlmsvc_put_owner (fl_owner_t owner) +{ +nlmsvc_put_lockowner (owner); +} +const struct lock_manager_operations nlmsvc_lock_operations = { .lm_notify = nlmsvc_notify_blocked, .lm_grant = nlmsvc_grant_deferred, + .lm_get_owner = nlmsvc_get_owner, + .lm_put_owner = nlmsvc_put_owner, };/*
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 162/219 drm/exynos: Always initialize mapping in exynos_drm_register_dma()
In reply to Sasha LevinFrom: Nathan Chancellor <[email protected]>
[ Upstream commit c626f3864bbbb28bbe06476b0b497c1330aa4463 ]
In certain randconfigs, clang warns:
drivers/gpu/drm/exynos/exynos_drm_dma.c:121:19: warning: variable 'mapping' is uninitialized when used here [-Wuninitialized]
priv->mapping = mapping;
^~~~~~~
drivers/gpu/drm/exynos/exynos_drm_dma.c:111:16: note: initialize the
variable 'mapping' to silence this warning
void *mapping;
^
= NULL1 warning generated.
This occurs when CONFIG_EXYNOS_IOMMU is enabled and both CONFIG_ARM_DMA_USE_IOMMU and CONFIG_IOMMU_DMA are disabled, which makes the code look like
void *mapping;
if (0)
mapping = arm_iommu_create_mapping()
else if (0)
mapping = iommu_get_domain_for_dev()
... priv->mapping = mapping;
Add an else branch that initializes mapping to the -ENODEV error pointer so that there is no more warning and the driver does not change during runtime.
--- drivers/gpu/drm/exynos/exynos_drm_dma.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_dma.c +2 -0
@@ -115,6 +115,8 @@ int exynos_drm_register_dma(struct drm_device *drm, struct device *dev, EXYNOS_DEV_ADDR_START, EXYNOS_DEV_ADDR_SIZE); else if (IS_ENABLED(CONFIG_IOMMU_DMA)) mapping =iommu_get_domain_for_dev (priv->dma_dev); + else + mapping =ERR_PTR (-ENODEV );if (IS_ERR (mapping))return PTR_ERR (mapping);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 163/219 rtl8xxxu: Fix the handling of TX A-MPDU aggregation
In reply to Sasha LevinFrom: Chris Chiu <[email protected]>
[ Upstream commit 95a581ab3592082c60a08090aabe09ac7d0bd650 ]
The TX A-MPDU aggregation is not handled in the driver since the ieee80211_start_tx_ba_session has never been started properly. Start and stop the TX BA session by tracking the TX aggregation status of each TID. Fix the ampdu_action and the tx descriptor accordingly with the given TID.
--- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 ++ .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 33 ++++++++++++++----- 2 files changed, 26 insertions(+), 9 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +2 -0
@@ -1378,6 +1378,8 @@ struct rtl8xxxu_priv { u8 no_pape:1;u8 int_buf[USB_INTR_CONTENT_LENGTH ];u8 rssi_level; +DECLARE_BITMAP (tx_aggr_started,IEEE80211_NUM_TIDS ); +DECLARE_BITMAP (tid_tx_operational,IEEE80211_NUM_TIDS );/* * Only one virtual interface permitted because only STA mode * is supported and no iface_combinations are provided.
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +24 -9
@@ -4805,6 +4805,8 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,struct ieee80211_rate *tx_rate =ieee80211_get_tx_rate (hw, tx_info);struct rtl8xxxu_priv *priv = hw->priv;struct device *dev = &priv->udev->dev; +u8 *qc =ieee80211_get_qos_ctl (hdr); +u8 tid = qc[0 ] &IEEE80211_QOS_CTL_TID_MASK ;u32 rate;u16 rate_flags = tx_info->control.rates[0 ].flags;u16 seq_number;
@@ -4828,7 +4830,7 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, tx_desc->txdw3 =cpu_to_le32 ((u32 )seq_number <<TXDESC32_SEQ_SHIFT ); -if (ampdu_enable) +if (ampdu_enable &&test_bit (tid, priv->tid_tx_operational)) tx_desc->txdw1 |=cpu_to_le32 (TXDESC32_AGG_ENABLE );else tx_desc->txdw1 |=cpu_to_le32 (TXDESC32_AGG_BREAK );
@@ -4876,6 +4878,8 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,struct rtl8xxxu_priv *priv = hw->priv;struct device *dev = &priv->udev->dev;struct rtl8xxxu_txdesc40 *tx_desc40; +u8 *qc =ieee80211_get_qos_ctl (hdr); +u8 tid = qc[0 ] &IEEE80211_QOS_CTL_TID_MASK ;u32 rate;u16 rate_flags = tx_info->control.rates[0 ].flags;u16 seq_number;
@@ -4902,7 +4906,7 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, tx_desc40->txdw9 =cpu_to_le32 ((u32 )seq_number <<TXDESC40_SEQ_SHIFT ); -if (ampdu_enable) +if (ampdu_enable &&test_bit (tid, priv->tid_tx_operational)) tx_desc40->txdw2 |=cpu_to_le32 (TXDESC40_AGG_ENABLE );else tx_desc40->txdw2 |=cpu_to_le32 (TXDESC40_AGG_BREAK );
@@ -5015,12 +5019,19 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw,if (ieee80211_is_data_qos (hdr->frame_control) && sta) {if (sta->ht_cap.ht_supported) {u32 ampdu, val32; +u8 *qc =ieee80211_get_qos_ctl (hdr); +u8 tid = qc[0 ] &IEEE80211_QOS_CTL_TID_MASK ; ampdu = (u32 )sta->ht_cap.ampdu_density; val32 = ampdu <<TXDESC_AMPDU_DENSITY_SHIFT ; tx_desc->txdw2 |=cpu_to_le32 (val32); ampdu_enable = true; + +if (!test_bit (tid, priv->tx_aggr_started) && + !(skb->protocol ==cpu_to_be16 (ETH_P_PAE ))) +if (!ieee80211_start_tx_ba_session (sta, tid,0 )) +set_bit (tid, priv->tx_aggr_started); } }
@@ -6089,6 +6100,7 @@ rtl8xxxu_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,struct device *dev = &priv->udev->dev;u8 ampdu_factor, ampdu_density;struct ieee80211_sta *sta = params->sta; +u16 tid = params->tid;enum ieee80211_ampdu_mlme_action action = params->action;switch (action) {
@@ -6101,17 +6113,20 @@ rtl8xxxu_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,dev_dbg (dev,"Changed HT: ampdu_factor %02x, ampdu_density %02x\n" , ampdu_factor, ampdu_density); -break ; +return IEEE80211_AMPDU_TX_START_IMMEDIATE ; +case IEEE80211_AMPDU_TX_STOP_CONT :case IEEE80211_AMPDU_TX_STOP_FLUSH : -dev_dbg (dev,"%s: IEEE80211_AMPDU_TX_STOP_FLUSH\n" , __func__); -rtl8xxxu_set_ampdu_factor (priv,0 ); -rtl8xxxu_set_ampdu_min_space (priv,0 ); -break ;case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT : -dev_dbg (dev,"%s: IEEE80211_AMPDU_TX_STOP_FLUSH_CONT\n" , - __func__); +dev_dbg (dev,"%s: IEEE80211_AMPDU_TX_STOP\n" , __func__);rtl8xxxu_set_ampdu_factor (priv,0 );rtl8xxxu_set_ampdu_min_space (priv,0 ); +clear_bit (tid, priv->tx_aggr_started); +clear_bit (tid, priv->tid_tx_operational); +ieee80211_stop_tx_ba_cb_irqsafe (vif, sta->addr, tid); +break ; +case IEEE80211_AMPDU_TX_OPERATIONAL : +dev_dbg (dev,"%s: IEEE80211_AMPDU_TX_OPERATIONAL\n" , __func__); +set_bit (tid, priv->tid_tx_operational);break ;case IEEE80211_AMPDU_RX_START :dev_dbg (dev,"%s: IEEE80211_AMPDU_RX_START\n" , __func__);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 164/219 rtw88: use read_poll_timeout instead of fixed sleep
In reply to Sasha LevinFrom: Chin-Yen Lee <[email protected]>
[ Upstream commit 02a55c0009a55b204e1e5c17295431f0a9e7d3b6 ]
In current wow flow, driver calls rtw_wow_fw_start and sleep for 100ms, to wait firmware finish preliminary work and then update the value of WOWLAN_WAKE_REASON register to zero. But later firmware will start wow function with power-saving mode, in which mode the value of WOWLAN_WAKE_REASON register is 0xea. So driver may get 0xea value and return fail. We use read_poll_timeout instead to check the value to avoid this issue.
--- drivers/net/wireless/realtek/rtw88/wow.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/net/wireless/realtek/rtw88/wow.c +16 -5
@@ -283,15 +283,26 @@ static void rtw_wow_rx_dma_start(struct rtw_dev *rtwdev)static int rtw_wow_check_fw_status (struct rtw_dev *rtwdev,bool wow_enable) { -/* wait 100ms for wow firmware to finish work */ -msleep (100 ); +int ret; +u8 check; +u32 check_dis;if (wow_enable) { -if (rtw_read8 (rtwdev,REG_WOWLAN_WAKE_REASON )) + ret =read_poll_timeout (rtw_read8, check, !check,1000 , +100000 , true, rtwdev, +REG_WOWLAN_WAKE_REASON ); +if (ret) goto wow_fail; }else { -if (rtw_read32_mask (rtwdev,REG_FE1IMR ,BIT_FS_RXDONE ) || -rtw_read32_mask (rtwdev,REG_RXPKT_NUM ,BIT_RW_RELEASE )) + ret =read_poll_timeout (rtw_read32_mask, check_dis, + !check_dis,1000 ,100000 , true, rtwdev, +REG_FE1IMR ,BIT_FS_RXDONE ); +if (ret) + goto wow_fail; + ret =read_poll_timeout (rtw_read32_mask, check_dis, + !check_dis,1000 ,100000 , false, rtwdev, +REG_RXPKT_NUM ,BIT_RW_RELEASE ); +if (ret) goto wow_fail; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 165/219 rtw88: wow: build wow function only if CONFIG_PM is on
In reply to Sasha LevinFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit 05e45887382c4c0f9522515759b34991aa17e69d ]
The kernel test robot reports undefined reference after we report wakeup reason to mac80211. This is because CONFIG_PM is not defined in the testing configuration file. In fact, functions within wow.c are used if CONFIG_PM is defined, so use CONFIG_PM to decide whether we build this file or not.
The reported messages are:
hppa-linux-ld: drivers/net/wireless/realtek/rtw88/wow.o: in function `rtw_wow_show_wakeup_reason':
Quoted 2 lines
Quoted 2 lines
(.text+0x6c4): undefined reference to `ieee80211_report_wowlan_wakeup'
hppa-linux-ld: (.text+0x6e0): undefined reference to `ieee80211_report_wowlan_wakeup'
--- drivers/net/wireless/realtek/rtw88/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/Makefile +1 -1
@@ -15,9 +15,9 @@ rtw88_core-y += main.o \ ps.o \ sec.o \ bf.o \ - wow.o \ regd.o +rtw88_core-$(CONFIG_PM) += wow.o obj-$(CONFIG_RTW88_8822B) += rtw88_8822b.o rtw88_8822b-objs := rtw8822b.o rtw8822b_table.o
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 166/219 rtw88: wow: fix size access error of probe request
In reply to Sasha LevinFrom: Chin-Yen Lee <[email protected]>
[ Upstream commit 69c7044526d984df672b8d9b6d6998c34617cde4 ]
Current flow will lead to null ptr access because of trying to get the size of freed probe-request packets. We store the information of packet size into rsvd page instead and also fix the size error issue, which will cause unstable behavoir of sending probe request by wow firmware.
--- drivers/net/wireless/realtek/rtw88/fw.c | 8 ++++++-- drivers/net/wireless/realtek/rtw88/fw.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/fw.c +6 -2
@@ -715,7 +715,7 @@ static u16 rtw_get_rsvd_page_probe_req_size(struct rtw_dev *rtwdev,continue ;if ((!ssid && !rsvd_pkt->ssid) ||rtw_ssid_equal (rsvd_pkt->ssid, ssid)) - size = rsvd_pkt->skb->len; + size = rsvd_pkt->probe_req_size; }return size;
@@ -943,6 +943,8 @@ static struct sk_buff *rtw_get_rsvd_page_skb(struct ieee80211_hw *hw, ssid->ssid_len, 0); else skb_new =ieee80211_probereq_get (hw, vif->addr,NULL ,0 ,0 ); +if (skb_new) + rsvd_pkt->probe_req_size = (u16 )skb_new->len;break ;case RSVD_NLO_INFO : skb_new =rtw_nlo_info_get (hw);
@@ -1539,6 +1541,7 @@ int rtw_fw_dump_fifo(struct rtw_dev *rtwdev, u8 fifo_sel, u32 addr, u32 size,static void __rtw_fw_update_pkt (struct rtw_dev *rtwdev,u8 pkt_id,u16 size,u8 location) { +struct rtw_chip_info *chip = rtwdev->chip;u8 h2c_pkt[H2C_PKT_SIZE ] = {0 };u16 total_size =H2C_PKT_HDR_SIZE +H2C_PKT_UPDATE_PKT_LEN ;
@@ -1549,6 +1552,7 @@ static void __rtw_fw_update_pkt(struct rtw_dev *rtwdev, u8 pkt_id, u16 size,UPDATE_PKT_SET_LOCATION (h2c_pkt, location);/* include txdesc size */ + size += chip->tx_pkt_desc_sz;UPDATE_PKT_SET_SIZE (h2c_pkt, size);rtw_fw_send_h2c_packet (rtwdev, h2c_pkt);
@@ -1558,7 +1562,7 @@ void rtw_fw_update_pkt_probe_req(struct rtw_dev *rtwdev, struct cfg80211_ssid *ssid) {u8 loc; -u32 size; +u16 size; loc =rtw_get_rsvd_page_probe_req_location (rtwdev, ssid);if (!loc) {
drivers/net/wireless/realtek/rtw88/fw.h +1 -0
@@ -126,6 +126,7 @@ struct rtw_rsvd_page {u8 page;bool add_txdesc;struct cfg80211_ssid *ssid; +u16 probe_req_size; };enum rtw_keep_alive_pkt_type {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 167/219 octeontx2-pf: Fix NIX1_RX interface backpressure
In reply to Sasha LevinFrom: Subbaraya Sundeep <[email protected]>
[ Upstream commit e8fb4df1f5d84bc08dd4f4827821a851d2eab241 ]
'bp_ena' in Aura context is NIX block index, setting it zero will always backpressure NIX0 block, even if NIXLF belongs to NIX1. Hence fix this by setting it appropriately based on NIX block address.
--- .../ethernet/marvell/octeontx2/nic/otx2_common.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +15 -0
@@ -1187,7 +1187,22 @@ static int otx2_aura_init(struct otx2_nic *pfvf, int aura_id,/* Enable backpressure for RQ aura */ if (aura_id < pfvf->hw.rqpool_cnt && !is_otx2_lbkvf (pfvf->pdev)) { aq->aura.bp_ena =0 ; +/* If NIX1 LF is attached then specify NIX1_RX. +* +* Below NPA_AURA_S[BP_ENA] is set according to the +* NPA_BPINTF_E enumeration given as: +* 0x0 + a*0x1 where 'a' is 0 for NIX0_RX and 1 for NIX1_RX so +* NIX0_RX is 0x0 + 0*0x1 = 0 +* NIX1_RX is 0x0 + 1*0x1 = 1 +* But in HRM it is given that +* "NPA_AURA_S[BP_ENA](w1[33:32]) - Enable aura backpressure to +* NIX-RX based on [BP] level. One bit per NIX-RX; index +* enumerated by NPA_BPINTF_E." +*/ +if (pfvf->nix_blkaddr ==BLKADDR_NIX1 ) + aq->aura.bp_ena =1 ; aq->aura.nix0_bpid = pfvf->bpid[0 ]; +/* Set backpressure level for RQ's Aura */ aq->aura.bp =RQ_BP_LVL_AURA ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 168/219 m68knommu: only set CONFIG_ISA_DMA_API for ColdFire sub-arch
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit db87db65c1059f3be04506d122f8ec9b2fa3b05e ]
Quoted 33 lines
Hi Arnd,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 2f73937c9aa561e2082839bc1a8efaac75d6e244 commit: 47fd22f2b84765a2f7e3f150282497b902624547 [4771/5318] cs89x0: rework driver configuration config: m68k-randconfig-c003-20210804 (attached as .config) compiler: m68k-linux-gcc (GCC) 10.3.0reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=47fd22f2b84765a2f7e3f150282497b902624547
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout47fd22f2b84765a2f7e3f150282497b902624547
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=m68kIf you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>All errors (new ones prefixed by >>):
In file included from include/linux/kernel.h:19, from include/linux/list.h:9, from include/linux/module.h:12, from drivers/net/ethernet/cirrus/cs89x0.c:51: drivers/net/ethernet/cirrus/cs89x0.c: In function 'net_open': drivers/net/ethernet/cirrus/cs89x0.c:897:20: error: implicit declaration of function 'isa_virt_to_bus'; did you mean 'virt_to_bus'? [-Werror=implicit-function-declaration] 897 | (unsigned long)isa_virt_to_bus(lp->dma_buff)); | ^~~~~~~~~~~~~~~ include/linux/printk.h:141:17: note: in definition of macro 'no_printk'
Quoted 9 lines
141 | printk(fmt, ##__VA_ARGS__); \ | ^~~~~~~~~~~ drivers/net/ethernet/cirrus/cs89x0.c:86:3: note: in expansion of macro 'pr_debug' 86 | pr_##level(fmt, ##__VA_ARGS__); \ | ^~~ drivers/net/ethernet/cirrus/cs89x0.c:894:3: note: in expansion of macro 'cs89_dbg' 894 | cs89_dbg(1, debug, "%s: dma %lx %lx\n", | ^~~~~~~~Quoted 1 line
Quoted 1 line
drivers/net/ethernet/cirrus/cs89x0.c:914:3: error: implicit declaration of function 'disable_dma'; did you mean 'disable_irq'? [-Werror=implicit-function-declaration]
As far as I can tell, this is a bug with the m68kmmu architecture, not with my driver:
The CONFIG_ISA_DMA_API option is provided for coldfire, which implements it, but dragonball also sets the option as a side-effect, without actually implementing
the interfaces. The patch below should fix it.
--- arch/m68k/Kconfig.bus | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/Kconfig.bus +1 -1
@@ -63,7 +63,7 @@ source "drivers/zorro/Kconfig" endif -if !MMU +if COLDFIRE config ISA_DMA_API def_bool !M5272
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 169/219 btrfs: remove racy and unnecessary inode transaction update when using no-holes
In reply to Sasha LevinFrom: Filipe Manana <[email protected]>
[ Upstream commit cceaa89f02f15f232391ae4be214137b0a0285c0 ]
When using the NO_HOLES feature and expanding the size of an inode, we update the inode's last_trans, last_sub_trans and last_log_commit fields at maybe_insert_hole() so that a fsync does know that the inode needs to be logged (by making sure that btrfs_inode_in_log() returns false). This happens for expanding truncate operations, buffered writes, direct IO writes and when cloning extents to an offset greater than the inode's i_size.
However the way we do it is racy, because in between setting the inode's last_sub_trans and last_log_commit fields, the log transaction ID that was assigned to last_sub_trans might be committed before we read the root's last_log_commit and assign that value to last_log_commit. If that happens it would make a future call to btrfs_inode_in_log() return true. This is a race that should be extremely unlikely to be hit in practice, and it is the same that was described by commit bc0939fcfab0d7 ("btrfs: fix race between marking inode needs to be logged and log syncing").
The fix would simply be to set last_log_commit to the value we assigned to last_sub_trans minus 1, like it was done in that commit. However updating these two fields plus the last_trans field is pointless here because all the callers of btrfs_cont_expand() (which is the only caller of maybe_insert_hole()) always call btrfs_set_inode_last_trans() or btrfs_update_inode() after calling btrfs_cont_expand(). Calling either btrfs_set_inode_last_trans() or btrfs_update_inode() guarantees that the next fsync will log the inode, as it makes btrfs_inode_in_log() return false.
So just remove the code that explicitly sets the inode's last_trans, last_sub_trans and last_log_commit fields.
--- fs/btrfs/inode.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
fs/btrfs/inode.c +5 -7
@@ -5064,15 +5064,13 @@ static int maybe_insert_hole(struct btrfs_root *root, struct btrfs_inode *inode,int ret;/* -* Still need to make sure the inode looks like it's been updated so -* that any holes get logged if we fsync. +* If NO_HOLES is enabled, we don't need to do anything. +* Later, up in the call chain, either btrfs_set_inode_last_sub_trans() +* or btrfs_update_inode() will be called, which guarantee that the next +* fsync will know this inode was changed and needs to be logged. */ -if (btrfs_fs_incompat (fs_info,NO_HOLES )) { - inode->last_trans = fs_info->generation; - inode->last_sub_trans = root->log_transid; - inode->last_log_commit = root->last_log_commit; +if (btrfs_fs_incompat (fs_info,NO_HOLES ))return 0 ; - }/* * 1 - for the one we're dropping
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 170/219 btrfs: reset this_bio_flag to avoid inheriting old flags
In reply to Sasha LevinFrom: Qu Wenruo <[email protected]>
[ Upstream commit 4c37a7938496756649096a7ec26320eb8b0d90fb ]
In btrfs_do_readpage(), we never reset @this_bio_flag after we hit a compressed extent.
This is fine, as for PAGE_SIZE == sectorsize case, we can only have one sector for one page, thus @this_bio_flag will only be set at most once.
But for subpage case, after hitting a compressed extent, @this_bio_flag will always have EXTENT_BIO_COMPRESSED bit, even we're reading a regular extent.
This will lead to various read errors, and causing new ASSERT() in incoming subpage patches, which adds more strict check in btrfs_submit_compressed_read().
Fix it by declaring @this_bio_flag inside the main loop and reset its value for each iteration.
--- fs/btrfs/extent_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/extent_io.c +1 -1
@@ -3400,7 +3400,6 @@ int btrfs_do_readpage(struct page *page, struct extent_map **em_cached,size_t pg_offset =0 ;size_t iosize;size_t blocksize = inode->i_sb->s_blocksize; -unsigned long this_bio_flag =0 ;struct extent_io_tree *tree = &BTRFS_I (inode)->io_tree; ret =set_page_extent_mapped (page);
@@ -3431,6 +3430,7 @@ int btrfs_do_readpage(struct page *page, struct extent_map **em_cached, }begin_page_read (fs_info, page);while (cur <= end) { +unsigned long this_bio_flag =0 ;bool force_bio_submit = false;u64 disk_bytenr;
Signature · 1 line
2.30.2
Re: [PATCH AUTOSEL 5.13 170/219] btrfs: reset this_bio_flag to avoid inheriting old flags
Quoted 3 lines · Sasha Levin
From: Qu Wenruo <[email protected]>
[ Upstream commit
4c37a7938496756649096a7ec26320eb8b0d90fb]
Please drop this patch from stable queue, thanks.
Sasha Levin
maintainerPATCH 171/219 btrfs: subpage: check if there are compressed extents inside one page
In reply to Sasha LevinFrom: Qu Wenruo <[email protected]>
[ Upstream commit 3670e6451bc9c39ab3a46f1da19360219e4319f3 ]
[BUG]
When testing experimental subpage compressed write support, it hits a NULL pointer dereference inside read path:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000018 pc : __pi_memcmp+0x28/0x1ec lr : check_data_csum+0xd0/0x274 [btrfs] Call trace: __pi_memcmp+0x28/0x1ec btrfs_verify_data_csum+0xf4/0x244 [btrfs] end_bio_extent_readpage+0x1d0/0x6b0 [btrfs] bio_endio+0x15c/0x1dc end_workqueue_fn+0x44/0x64 [btrfs] btrfs_work_helper+0x74/0x250 [btrfs] process_one_work+0x1d4/0x47c worker_thread+0x180/0x400 kthread+0x11c/0x120 ret_from_fork+0x10/0x30 Code: 54000261 d100044c d343fd8c f8408403 (f8408424) ---[ end trace 9e2c59f33ea40866 ]---
[CAUSE]
When reading two compressed extents inside the same page, like the following layout, we trigger above crash:
0 32K 64K |-------|\\\\\\\| | \- Compressed extent (A) \--------- Compressed extent (B)
For compressed read, we don't need to populate its io_bio->csum, as we rely on compressed_bio->csum to verify the compressed data, and then copy the decompressed to inode pages.
Normally btrfs_verify_data_csum() skip such page by checking and clearing its PageChecked flag
But since that flag is still for the full page, when endio for inode page range [0, 32K) gets executed, it clears PageChecked flag for the full page.
Then when endio for inode page range [32K, 64K) gets executed, since the page no longer has PageChecked flag, it just continues checking, even though io_bio->csum is NULL.
[FIX]
Thankfully there are only two users of PageChecked bit:
- Cow fixup
Since subpage has its own way to trace page dirty (dirty_bitmap) and ordered bit (ordered_bitmap), it should never trigger cow fixup.
- Compressed read
We can distinguish such read by just checking io_bio->csum.
So just check io_bio->csum before doing the verification to avoid such NULL pointer dereference.
--- fs/btrfs/inode.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
fs/btrfs/inode.c +14 -0
@@ -3256,6 +3256,20 @@ int btrfs_verify_data_csum(struct btrfs_io_bio *io_bio, u32 bio_offset,return 0 ; } +/* +* For subpage case, above PageChecked is not safe as it's not subpage +* compatible. +* But for now only cow fixup and compressed read utilize PageChecked +* flag, while in this context we can easily use io_bio->csum to +* determine if we really need to do csum verification. +* +* So for now, just exit if io_bio->csum is NULL, as it means it's +* compressed read, and its compressed data csum has already been +* verified. +*/ +if (io_bio->csum ==NULL ) +return 0 ; +if (BTRFS_I (inode)->flags &BTRFS_INODE_NODATASUM )return 0 ;
Signature · 1 line
2.30.2
Re: [PATCH AUTOSEL 5.13 171/219] btrfs: subpage: check if there are compressed extents inside one page
Quoted 4 lines · Sasha Levin
From: Qu Wenruo <[email protected]>
[ Upstream commit
3670e6451bc9c39ab3a46f1da19360219e4319f3]
Please drop this patch from stable queue, thanks.
Sasha Levin
maintainerPATCH 172/219 btrfs: grab correct extent map for subpage compressed extent read
In reply to Sasha LevinFrom: Qu Wenruo <[email protected]>
[ Upstream commit 557023ea9f06baf2659b232b08b8e8711f7001a6 ]
[BUG]
When subpage compressed read write support is enabled, btrfs/038 always fails with EIO.
A simplified script can easily trigger the problem:
mkfs.btrfs -f -s 4k $dev
mount $dev $mnt -o compress=lzo
xfs_io -f -c "truncate 118811" $mnt/foo
xfs_io -c "pwrite -S 0x0d -b 39987 92267 39987" $mnt/foo > /dev/null
sync
btrfs subvolume snapshot -r $mnt $mnt/mysnap1
xfs_io -c "pwrite -S 0x3e -b 80000 200000 80000" $mnt/foo > /dev/null sync
xfs_io -c "pwrite -S 0xdc -b 10000 250000 10000" $mnt/foo > /dev/null xfs_io -c "pwrite -S 0xff -b 10000 300000 10000" $mnt/foo > /dev/null
sync
btrfs subvolume snapshot -r $mnt $mnt/mysnap2
cat $mnt/mysnap2/foo
# Above cat will fail due to EIO
[CAUSE]
The problem is in btrfs_submit_compressed_read().
When it tries to grab the extent map of the read range, it uses the following call:
em = lookup_extent_mapping(em_tree,
page_offset(bio_first_page_all(bio)),
fs_info->sectorsize);
The problem is in the page_offset(bio_first_page_all(bio)) part.
The offending inode has the following file extent layout
item 10 key (257 EXTENT_DATA 131072) itemoff 15639 itemsize 53
generation 8 type 1 (regular)
extent data disk byte 13680640 nr 4096 extent data offset 0 nr 4096 ram 4096 extent compression 0 (none)
item 11 key (257 EXTENT_DATA 135168) itemoff 15586 itemsize 53
generation 8 type 1 (regular)
extent data disk byte 0 nr 0
item 12 key (257 EXTENT_DATA 196608) itemoff 15533 itemsize 53
generation 8 type 1 (regular)
extent data disk byte 13676544 nr 4096 extent data offset 0 nr 53248 ram 86016 extent compression 2 (lzo)
And the bio passed in has the following parameters:
page_offset(bio_first_page_all(bio)) = 131072
bio_first_bvec_all(bio)->bv_offset = 65536
If we use page_offset(bio_first_page_all(bio) without adding bv_offset, we will get an extent map for file offset 131072, not 196608.
This means we read uncompressed data from disk, and later decompression will definitely fail.
[FIX]
Take bv_offset into consideration when trying to grab an extent map.
And add an ASSERT() to ensure we're really getting a compressed extent.
Thankfully this won't affect anything but subpage, thus we only need to ensure this patch get merged before we enabled basic subpage support.
--- fs/btrfs/compression.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
fs/btrfs/compression.c +6 -3
@@ -683,6 +683,7 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,struct page *page;struct bio *comp_bio;u64 cur_disk_byte = bio->bi_iter.bi_sector <<9 ; +u64 file_offset;u64 em_len;u64 em_start;struct extent_map *em;
@@ -692,15 +693,17 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, em_tree = &BTRFS_I (inode)->extent_tree; + file_offset =bio_first_bvec_all (bio)->bv_offset + +page_offset (bio_first_page_all (bio)); +/* we need the actual starting offset of this extent in the file */ read_lock (&em_tree->lock); - em =lookup_extent_mapping (em_tree, -page_offset (bio_first_page_all (bio)), - fs_info->sectorsize); + em =lookup_extent_mapping (em_tree, file_offset, fs_info->sectorsize);read_unlock (&em_tree->lock);if (!em)return BLK_STS_IOERR ; +ASSERT (em->compress_type !=BTRFS_COMPRESS_NONE ); compressed_len = em->block_len; cb =kmalloc (compressed_bio_size (fs_info, compressed_len),GFP_NOFS );if (!cb)
Signature · 1 line
2.30.2
Re: [PATCH AUTOSEL 5.13 172/219] btrfs: grab correct extent map for subpage compressed extent read
Quoted 3 lines · Sasha Levin
From: Qu Wenruo <[email protected]>
[ Upstream commit
557023ea9f06baf2659b232b08b8e8711f7001a6]
Please drop this patch from stable queue, thanks.
Sasha Levin
maintainerPATCH 173/219 btrfs: subpage: fix race between prepare_pages() and btrfs_releasepage()
In reply to Sasha LevinFrom: Qu Wenruo <[email protected]>
[ Upstream commit e0467866198f7f536806f39e5d0d91ae8018de08 ]
[BUG]
When running generic/095, there is a high chance to crash with subpage data RW support:
assertion failed: PagePrivate(page) && page->private
------------[ cut here ]------------ kernel BUG at fs/btrfs/ctree.h:3403! Internal error: Oops - BUG: 0 [#1] SMP CPU: 1 PID: 3567 Comm: fio Tainted: 5.12.0-rc7-custom+ #17 Hardware name: Khadas VIM3 (DT) Call trace: assertfail.constprop.0+0x28/0x2c [btrfs] btrfs_subpage_assert+0x80/0xa0 [btrfs] btrfs_subpage_set_uptodate+0x34/0xec [btrfs] btrfs_page_clamp_set_uptodate+0x74/0xa4 [btrfs] btrfs_dirty_pages+0x160/0x270 [btrfs] btrfs_buffered_write+0x444/0x630 [btrfs] btrfs_direct_write+0x1cc/0x2d0 [btrfs] btrfs_file_write_iter+0xc0/0x160 [btrfs] new_sync_write+0xe8/0x180 vfs_write+0x1b4/0x210 ksys_pwrite64+0x7c/0xc0 __arm64_sys_pwrite64+0x24/0x30 el0_svc_common.constprop.0+0x70/0x140 do_el0_svc+0x28/0x90 el0_svc+0x2c/0x54 el0_sync_handler+0x1a8/0x1ac el0_sync+0x170/0x180 Code: f0000160 913be042 913c4000 955444bc (d4210000) ---[ end trace 3fdd39f4cccedd68 ]---
[CAUSE]
Although prepare_pages() calls find_or_create_page(), which returns the page locked, but in later prepare_uptodate_page() calls, we may call btrfs_readpage() which will unlock the page before it returns.
This leaves a window where btrfs_releasepage() can sneak in and release the page, clearing page->private and causing above ASSERT().
[FIX]
In prepare_uptodate_page(), we should not only check page->mapping, but also PagePrivate() to ensure we are still holding the correct page which has proper fs context setup.
--- fs/btrfs/file.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
fs/btrfs/file.c +12 -1
@@ -1338,7 +1338,18 @@ static int prepare_uptodate_page(struct inode *inode,unlock_page (page);return -EIO ; } -if (page->mapping != inode->i_mapping) { + +/* +* Since btrfs_readpage() will unlock the page before it +* returns, there is a window where btrfs_releasepage() can +* be called to release the page. +* Here we check both inode mapping and PagePrivate() to +* make sure the page was not released. +* +* The private flag check is essential for subpage as we need +* to store extra bitmap using page->private. +*/ +if (page->mapping != inode->i_mapping || !PagePrivate (page)) {unlock_page (page);return -EAGAIN ; }
Signature · 1 line
2.30.2
Re: [PATCH AUTOSEL 5.13 173/219] btrfs: subpage: fix race between prepare_pages() and btrfs_releasepage()
Quoted 3 lines · Sasha Levin
From: Qu Wenruo <[email protected]>
[ Upstream commit
e0467866198f7f536806f39e5d0d91ae8018de08]
Please drop this patch from stable queue, thanks.
Sasha Levin
maintainerPATCH 174/219 btrfs: subpage: fix false alert when relocating partial preallocated data extents
In reply to Sasha LevinFrom: Qu Wenruo <[email protected]>
[ Upstream commit e3c62324e470c0a89df966603156b34fccd01708 ]
[BUG]
When relocating partial preallocated data extents (part of the preallocated extent is written) for subpage, it can cause the following false alert and make the relocation to fail:
BTRFS info (device dm-3): balance: start -d
BTRFS info (device dm-3): relocating block group 13631488 flags data
BTRFS warning (device dm-3): csum failed root -9 ino 257 off 4096 csum 0x98757625 expected csum 0x00000000 mirror 1 BTRFS error (device dm-3): bdev /dev/mapper/arm_nvme-test errs: wr 0, rd 0, flush 0, corrupt 1, gen 0 BTRFS warning (device dm-3): csum failed root -9 ino 257 off 4096 csum 0x98757625 expected csum 0x00000000 mirror 1 BTRFS error (device dm-3): bdev /dev/mapper/arm_nvme-test errs: wr 0, rd 0, flush 0, corrupt 2, gen 0 BTRFS info (device dm-3): balance: ended with status: -5
The minimal script to reproduce looks like this:
mkfs.btrfs -f -s 4k $dev
mount $dev -o nospace_cache $mnt
xfs_io -f -c "falloc 0 8k" $mnt/file
xfs_io -f -c "pwrite 0 4k" $mnt/file
btrfs balance start -d $mnt
[CAUSE]
Function btrfs_verify_data_csum() checks if the full range has EXTENT_NODATASUM bit for data reloc inode, if *all* bytes of the range have EXTENT_NODATASUM bit, then it skip the range.
This works pretty well for regular sectorsize, as in that case btrfs_verify_data_csum() is called for each sector, thus no problem at all.
But for subpage case, btrfs_verify_data_csum() is called on each bvec, which can contain several sectors, and since it checks *all* bytes for EXTENT_NODATASUM bit, if we have some range with csum, then we will continue checking all the sectors.
For the preallocated sectors, it doesn't have any csum, thus obviously the csum won't match and cause the false alert.
[FIX]
Move the EXTENT_NODATASUM check into the main loop, so that we can check each sector for EXTENT_NODATASUM bit for subpage case.
--- fs/btrfs/inode.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
fs/btrfs/inode.c +11 -6
@@ -3276,19 +3276,24 @@ int btrfs_verify_data_csum(struct btrfs_io_bio *io_bio, u32 bio_offset,if (!root->fs_info->csum_root)return 0 ; -if (root->root_key.objectid ==BTRFS_DATA_RELOC_TREE_OBJECTID && -test_range_bit (io_tree, start, end,EXTENT_NODATASUM ,1 ,NULL )) { -clear_extent_bits (io_tree, start, end,EXTENT_NODATASUM ); -return 0 ; - } -ASSERT (page_offset (page) <= start && end <=page_offset (page) +PAGE_SIZE -1 );for (pg_off =offset_in_page (start); pg_off <offset_in_page (end); pg_off += sectorsize, bio_offset += sectorsize) { +u64 file_offset = pg_off +page_offset (page);int ret; +if (root->root_key.objectid ==BTRFS_DATA_RELOC_TREE_OBJECTID && +test_range_bit (io_tree, file_offset, + file_offset + sectorsize -1 , +EXTENT_NODATASUM ,1 ,NULL )) { +/* Skip the range without csum for data reloc inode */ +clear_extent_bits (io_tree, file_offset, + file_offset + sectorsize -1 , +EXTENT_NODATASUM ); +continue ; + } ret =check_data_csum (inode, io_bio, bio_offset, page, pg_off,page_offset (page) + pg_off);if (ret <0 )
Signature · 1 line
2.30.2
Re: [PATCH AUTOSEL 5.13 174/219] btrfs: subpage: fix false alert when relocating partial preallocated data extents
Quoted 3 lines · Sasha Levin
From: Qu Wenruo <[email protected]>
[ Upstream commit
e3c62324e470c0a89df966603156b34fccd01708]
Please drop this patch from stable queue, thanks.
Sasha Levin
maintainerPATCH 175/219 btrfs: tree-log: check btrfs_lookup_data_extent return value
In reply to Sasha LevinFrom: Marcos Paulo de Souza <[email protected]>
[ Upstream commit 3736127a3aa805602b7a2ad60ec9cfce68065fbb ]
Function btrfs_lookup_data_extent calls btrfs_search_slot to verify if the EXTENT_ITEM exists in the extent tree. btrfs_search_slot can return values bellow zero if an error happened.
Function replay_one_extent currently checks if the search found something (0 returned) and increments the reference, and if not, it seems to evaluate as 'not found'.
Fix the condition by checking if the value was bellow zero and return early.
--- fs/btrfs/tree-log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/tree-log.c +3 -1
@@ -753,7 +753,9 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,*/ ret =btrfs_lookup_data_extent (fs_info, ins.objectid, ins.offset); -if (ret ==0 ) { +if (ret <0 ) { + goto out; + }else if (ret ==0 ) {btrfs_init_generic_ref (&ref,BTRFS_ADD_DELAYED_REF , ins.objectid, ins.offset,0 );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 176/219 ASoC: intel: atom: Revert PCM buffer address setup workaround again
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit e28ac04a705e946eddc5e7d2fc712dea3f20fe9e ]
We worked around the breakage of PCM buffer setup by the commit 65ca89c2b12c ("ASoC: intel: atom: Fix breakage for PCM buffer address setup"), but this isn't necessary since the CONTINUOUS buffer type also sets runtime->dma_addr since commit f84ba106a018 ("ALSA:
memalloc: Store snd_dma_buffer.addr for continuous pages, too"). Let's revert the change again.
--- 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 =virt_to_phys (substream->runtime->dma_area); +u32 buffer_addr = substream->runtime->dma_addr; channels = substream->runtime->channels; period_size = substream->runtime->period_size;
Signature · 1 line
2.30.2
Re: [PATCH AUTOSEL 5.13 176/219] ASoC: intel: atom: Revert PCM buffer address setup workaround again
Quoted 12 lines · Sasha Levin
From: Takashi Iwai <[email protected]>
[ Upstream commit
e28ac04a705e946eddc5e7d2fc712dea3f20fe9e]We worked around the breakage of PCM buffer setup by the commit
65ca89c2b12c("ASoC: intel: atom: Fix breakage for PCM buffer address setup"), but this isn't necessary since the CONTINUOUS buffer type also setsruntime->dma_addrsince commitf84ba106a018("ALSA:
memalloc: Store snd_dma_buffer.addr for continuous pages, too"). Let's revert the change again.
Quoted 3 lines
Signed-off-by Takashi Iwai <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Please drop. It's only for 5.15.
Takashi
Sasha Levin
maintainerRe: [PATCH AUTOSEL 5.13 176/219] ASoC: intel: atom: Revert PCM buffer address setup workaround again
Quoted 14 lines · Takashi Iwai
Quoted 12 lines · Sasha Levin
From: Takashi Iwai <[email protected]>
[ Upstream commit
e28ac04a705e946eddc5e7d2fc712dea3f20fe9e]We worked around the breakage of PCM buffer setup by the commit
65ca89c2b12c("ASoC: intel: atom: Fix breakage for PCM buffer address setup"), but this isn't necessary since the CONTINUOUS buffer type also setsruntime->dma_addrsince commitf84ba106a018("ALSA:
memalloc: Store snd_dma_buffer.addr for continuous pages, too"). Let's revert the change again.
Quoted 5 lines
Quoted 3 lines
Signed-off-by Takashi Iwai <[email protected]>Signed-off-by Sasha Levin <[email protected]>Please drop. It's only for 5.15.
Dropped, thanks!
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 177/219 soundwire: intel: fix potential race condition during power down
In reply to Sasha LevinFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit ea6942dad4b2a7e1735aa0f10f3d0b04b847750f ]
The power down sequence sets the link_up flag as false outside of the mutex_lock. This is potentially unsafe.
In additional the flow in that sequence can be improved by first testing if the link was powered, setting the link_up flag as false and proceeding with the power down. In case the CPA bits cannot be cleared, we only flag an error since we cannot deal with interrupts any longer.
--- drivers/soundwire/intel.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/soundwire/intel.c +13 -10
@@ -537,12 +537,14 @@ static int intel_link_power_down(struct sdw_intel *sdw)mutex_lock (sdw->link_res->shim_lock); -intel_shim_master_ip_to_glue (sdw); -if (!(*shim_mask &BIT (link_id)))dev_err (sdw->cdns.dev,"%s: Unbalanced power-up/down calls\n" , __func__); + sdw->cdns.link_up = false; + +intel_shim_master_ip_to_glue (sdw); + *shim_mask &= ~BIT (link_id);if (!*shim_mask) {
@@ -559,18 +561,19 @@ static int intel_link_power_down(struct sdw_intel *sdw) link_control &= spa_mask; ret =intel_clear_bit (shim,SDW_SHIM_LCTL , link_control, cpa_mask); +if (ret <0 ) { +dev_err (sdw->cdns.dev,"%s: could not power down link\n" , __func__); + +/* +* we leave the sdw->cdns.link_up flag as false since we've disabled +* the link at this point and cannot handle interrupts any longer. +*/ + } }mutex_unlock (sdw->link_res->shim_lock); -if (ret <0 ) { -dev_err (sdw->cdns.dev,"%s: could not power down link\n" , __func__); - -return ret; - } - - sdw->cdns.link_up = false; -return 0 ; +return ret; }static void intel_shim_sync_arm (struct sdw_intel *sdw)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 178/219 ASoC: Intel: Skylake: Fix module configuration for KPB and MIXER
In reply to Sasha LevinFrom: Cezary Rojewski <[email protected]>
[ Upstream commit e4e0633bcadc950b4b4af06c7f1bb7f7e3e86321 ]
KeyPhrasebuffer, Mixin and Mixout modules configuration is described by firmware's basic module configuration structure. There are no extended parameters required. Update functions taking part in building INIT_INSTANCE IPC payload to reflect that.
--- sound/soc/intel/skylake/skl-messages.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
sound/soc/intel/skylake/skl-messages.c +9 -2
@@ -802,9 +802,12 @@ static u16 skl_get_module_param_size(struct skl_dev *skl,case SKL_MODULE_TYPE_BASE_OUTFMT :case SKL_MODULE_TYPE_MIC_SELECT : -case SKL_MODULE_TYPE_KPB :return sizeof (struct skl_base_outfmt_cfg ); +case SKL_MODULE_TYPE_MIXER : +case SKL_MODULE_TYPE_KPB : +return sizeof (struct skl_base_cfg ); +default :/* * return only base cfg when no specific module type is
@@ -857,10 +860,14 @@ static int skl_set_module_format(struct skl_dev *skl,case SKL_MODULE_TYPE_BASE_OUTFMT :case SKL_MODULE_TYPE_MIC_SELECT : -case SKL_MODULE_TYPE_KPB :skl_set_base_outfmt_format (skl, module_config, *param_data);break ; +case SKL_MODULE_TYPE_MIXER : +case SKL_MODULE_TYPE_KPB : +skl_set_base_module_format (skl, module_config, *param_data); +break ; +default :skl_set_base_module_format (skl, module_config, *param_data);break ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 179/219 ASoC: Intel: Skylake: Fix passing loadable flag for module
In reply to Sasha LevinFrom: Gustaw Lewandowski <[email protected]>
[ Upstream commit c5ed9c547cba1dc1238c6e8a0c290fd62ee6e127 ]
skl_get_module_info() tries to set mconfig->module->loadable before mconfig->module has been assigned thus flag was always set to false and driver did not try to load module binaries.
--- sound/soc/intel/skylake/skl-pcm.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +9 -16
@@ -1317,21 +1317,6 @@ static int skl_get_module_info(struct skl_dev *skl,return -EIO ; } -list_for_each_entry (module, &skl->uuid_list, list) { -if (guid_equal (uuid_mod, &module->uuid)) { - mconfig->id.module_id = module->id; -if (mconfig->module) - mconfig->module->loadable = module->is_loadable; - ret =0 ; -break ; - } - } - -if (ret) -return ret; - - uuid_mod = &module->uuid; - ret = -EIO ;for (i =0 ; i < skl->nr_modules; i++) { skl_module = skl->modules[i]; uuid_tplg = &skl_module->uuid;
@@ -1341,10 +1326,18 @@ static int skl_get_module_info(struct skl_dev *skl,break ; } } +if (skl->nr_modules && ret)return ret; + ret = -EIO ;list_for_each_entry (module, &skl->uuid_list, list) { +if (guid_equal (uuid_mod, &module->uuid)) { + mconfig->id.module_id = module->id; + mconfig->module->loadable = module->is_loadable; + ret =0 ; + } +for (i =0 ; i <MAX_IN_QUEUE ; i++) { pin_id = &mconfig->m_in_pin[i].id;if (guid_equal (&pin_id->mod_uuid, &module->uuid))
@@ -1358,7 +1351,7 @@ static int skl_get_module_info(struct skl_dev *skl, } } -return 0 ; +return ret; }static int skl_populate_modules (struct skl_dev *skl)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 180/219 of: Don't allow __of_attached_node_sysfs() without CONFIG_SYSFS
In reply to Sasha LevinFrom: Marc Zyngier <[email protected]>
[ Upstream commit 6211e9cb2f8faf7faae0b6caf844bfe9527cc607 ]
Trying to boot without SYSFS, but with OF_DYNAMIC quickly results in a crash:
[ 0.088460] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000070 [...] [ 0.103927] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.14.0-rc3 #4179 [ 0.105810] Hardware name: linux,dummy-virt (DT) [ 0.107147] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--) [ 0.108876] pc : kernfs_find_and_get_ns+0x3c/0x7c [ 0.110244] lr : kernfs_find_and_get_ns+0x3c/0x7c [...] [ 0.134087] Call trace: [ 0.134800] kernfs_find_and_get_ns+0x3c/0x7c [ 0.136054] safe_name+0x4c/0xd0 [ 0.136994] __of_attach_node_sysfs+0xf8/0x124 [ 0.138287] of_core_init+0x90/0xfc [ 0.139296] driver_init+0x30/0x4c [ 0.140283] kernel_init_freeable+0x160/0x1b8 [ 0.141543] kernel_init+0x30/0x140 [ 0.142561] ret_from_fork+0x10/0x18
While not having sysfs isn't a very common option these days, it is still expected that such configuration would work.
Paper over it by bailing out from __of_attach_node_sysfs() if CONFIG_SYSFS isn't enabled.
--- drivers/of/kobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/kobj.c +1 -1
@@ -119,7 +119,7 @@ int __of_attach_node_sysfs(struct device_node *np)struct property *pp;int rc; -if (!of_kset) +if (!IS_ENABLED (CONFIG_SYSFS ) || !of_kset)return 0 ; np->kobj.kset = of_kset;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 181/219 mmc: sdhci-of-arasan: Modified SD default speed to 19MHz for ZynqMP
In reply to Sasha LevinFrom: Manish Narani <[email protected]>
[ Upstream commit c0b4e411a9b09748466ee06d2ae6772effa64dfb ]
SD standard speed timing was met only at 19MHz and not 25 MHz, that's why changing driver to 19MHz. The reason for this is when a level shifter is used on the board, timing was met for standard speed only at 19MHz. Since this level shifter is commonly required for high speed modes, the driver is modified to use standard speed of 19Mhz.
--- drivers/mmc/host/sdhci-of-arasan.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/mmc/host/sdhci-of-arasan.c +18 -0
@@ -159,6 +159,12 @@ struct sdhci_arasan_data {/* Controller immediately reports SDHCI_CLOCK_INT_STABLE after enabling the * internal clock even when the clock isn't stable */ #define SDHCI_ARASAN_QUIRK_CLOCK_UNSTABLE BIT(1) +/* +* Some of the Arasan variations might not have timing requirements +* met at 25MHz for Default Speed mode, those controllers work at +* 19MHz instead +*/ +#define SDHCI_ARASAN_QUIRK_CLOCK_25_BROKEN BIT(2) };struct sdhci_arasan_of_data {
@@ -290,6 +296,16 @@ static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock) sdhci_arasan->is_phy_on = false; } +if (sdhci_arasan->quirks &SDHCI_ARASAN_QUIRK_CLOCK_25_BROKEN ) { +/* +* Some of the Arasan variations might not have timing +* requirements met at 25MHz for Default Speed mode, +* those controllers work at 19MHz instead. +*/ +if (clock ==DEFAULT_SPEED_MAX_DTR ) + clock = (DEFAULT_SPEED_MAX_DTR *19 ) /25 ; + } +/* Set the Input and Output Clock Phase Delays */ if (clk_data->set_clk_delays) clk_data->set_clk_delays (host);
@@ -1598,6 +1614,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev)if (of_device_is_compatible (np,"xlnx,zynqmp-8.9a" )) { host->mmc_host_ops.execute_tuning = arasan_zynqmp_execute_tuning; + + sdhci_arasan->quirks |=SDHCI_ARASAN_QUIRK_CLOCK_25_BROKEN ; }arasan_dt_parse_clk_phases (dev, &sdhci_arasan->clk_data);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 182/219 mmc: sdhci-of-arasan: Check return value of non-void funtions
In reply to Sasha LevinFrom: Manish Narani <[email protected]>
[ Upstream commit 66bad6ed2204fdb78a0a8fb89d824397106a5471 ]
At a couple of places, the return values of the non-void functions were not getting checked. This was reported by the coverity tool. Modify the code to check the return values of the same.
Addresses-Coverity: ("check_return")
--- drivers/mmc/host/sdhci-of-arasan.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci-of-arasan.c +15 -3
@@ -273,7 +273,12 @@ static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock)* through low speeds without power cycling. */ sdhci_set_clock (host, host->max_clk); -phy_power_on (sdhci_arasan->phy); +if (phy_power_on (sdhci_arasan->phy)) { +pr_err ("%s: Cannot power on phy.\n" , +mmc_hostname (host->mmc)); +return ; + } + sdhci_arasan->is_phy_on = true;/*
@@ -323,7 +328,12 @@ static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock)msleep (20 );if (ctrl_phy) { -phy_power_on (sdhci_arasan->phy); +if (phy_power_on (sdhci_arasan->phy)) { +pr_err ("%s: Cannot power on phy.\n" , +mmc_hostname (host->mmc)); +return ; + } + sdhci_arasan->is_phy_on = true; } }
@@ -479,7 +489,9 @@ static int sdhci_arasan_suspend(struct device *dev) ret =phy_power_off (sdhci_arasan->phy);if (ret) {dev_err (dev,"Cannot power off phy.\n" ); -sdhci_resume_host (host); +if (sdhci_resume_host (host)) +dev_err (dev,"Cannot resume host.\n" ); +return ret; } sdhci_arasan->is_phy_on = false;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 183/219 mmc: rtsx_pci: Fix long reads when clock is prescaled
In reply to Sasha LevinFrom: Thomas Hebb <[email protected]>
[ Upstream commit 3ac5e45291f3f0d699a721357380d4593bc2dcb3 ]
For unexplained reasons, the prescaler register for this device needs to be cleared (set to 1) while performing a data read or else the command will hang. This does not appear to affect the real clock rate sent out on the bus, so I assume it's purely to work around a hardware bug.
During normal operation, the prescaler is already set to 1, so nothing needs to be done. However, in "initial mode" (which is used for sub-MHz clock speeds, like the core sets while enumerating cards), it's set to 128 and so we need to reset it during data reads. We currently fail to do this for long reads.
This has no functional affect on the driver's operation currently written, as the MMC core always sets a clock above 1MHz before attempting any long reads. However, the core could conceivably set any clock speed at any time and the driver should still work, so I think this fix is worthwhile.
I personally encountered this issue while performing data recovery on an external chip. My connections had poor signal integrity, so I modified the core code to reduce the clock speed. Without this change, I saw the card enumerate but was unable to actually read any data.
Writes don't seem to work in the situation described above even with this change (and even if the workaround is extended to encompass data write commands). I was not able to find a way to get them working.
--- drivers/mmc/host/rtsx_pci_sdmmc.c | 36 ++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-)
drivers/mmc/host/rtsx_pci_sdmmc.c +23 -13
@@ -542,9 +542,22 @@ static int sd_write_long_data(struct realtek_pci_sdmmc *host,return 0 ; } +static inline void sd_enable_initial_mode (struct realtek_pci_sdmmc *host) +{ +rtsx_pci_write_register (host->pcr,SD_CFG1 , +SD_CLK_DIVIDE_MASK ,SD_CLK_DIVIDE_128 ); +} + +static inline void sd_disable_initial_mode (struct realtek_pci_sdmmc *host) +{ +rtsx_pci_write_register (host->pcr,SD_CFG1 , +SD_CLK_DIVIDE_MASK ,SD_CLK_DIVIDE_0 ); +} +static int sd_rw_multi (struct realtek_pci_sdmmc *host,struct mmc_request *mrq) {struct mmc_data *data = mrq->data; +int err;if (host->sg_count <0 ) { data->error = host->sg_count;
@@ -553,22 +566,19 @@ static int sd_rw_multi(struct realtek_pci_sdmmc *host, struct mmc_request *mrq)return data->error; } -if (data->flags &MMC_DATA_READ ) -return sd_read_long_data (host, mrq); +if (data->flags &MMC_DATA_READ ) { +if (host->initial_mode) +sd_disable_initial_mode (host); -return sd_write_long_data (host, mrq); -} + err =sd_read_long_data (host, mrq); -static inline void sd_enable_initial_mode (struct realtek_pci_sdmmc *host) -{ -rtsx_pci_write_register (host->pcr,SD_CFG1 , -SD_CLK_DIVIDE_MASK ,SD_CLK_DIVIDE_128 ); -} +if (host->initial_mode) +sd_enable_initial_mode (host); -static inline void sd_disable_initial_mode (struct realtek_pci_sdmmc *host) -{ -rtsx_pci_write_register (host->pcr,SD_CFG1 , -SD_CLK_DIVIDE_MASK ,SD_CLK_DIVIDE_0 ); +return err; + } + +return sd_write_long_data (host, mrq); } static void sd_normal_rw(struct realtek_pci_sdmmc *host,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 184/219 mptcp: fix ADD_ADDR and RM_ADDR maybe flush addr_signal each other
In reply to Sasha LevinFrom: Yonglong Li <[email protected]>
[ Upstream commit 119c022096f5805680c79dfa74e15044c289856d ]
ADD_ADDR shares pm.addr_signal with RM_ADDR, so after RM_ADDR/ADD_ADDR has done, we should not clean ADD_ADDR/RM_ADDR's addr_signal.
--- net/mptcp/pm.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
net/mptcp/pm.c +10 -3
@@ -253,6 +253,7 @@ bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining, struct mptcp_addr_info *saddr, bool *echo, bool *port) { int ret = false; +u8 add_addr;spin_lock_bh (&msk->pm.lock);
@@ -267,7 +268,11 @@ bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining, goto out_unlock; *saddr = msk->pm.local; -WRITE_ONCE (msk->pm.addr_signal,0 ); +if (*echo) + add_addr = msk->pm.addr_signal & ~BIT (MPTCP_ADD_ADDR_ECHO ); +else + add_addr = msk->pm.addr_signal & ~BIT (MPTCP_ADD_ADDR_SIGNAL ); +WRITE_ONCE (msk->pm.addr_signal, add_addr); ret = true; out_unlock:
@@ -279,6 +284,7 @@ bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining, struct mptcp_rm_list *rm_list) {int ret = false, len; +u8 rm_addr;spin_lock_bh (&msk->pm.lock);
@@ -286,16 +292,17 @@ bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining,if (!mptcp_pm_should_rm_signal (msk)) goto out_unlock; + rm_addr = msk->pm.addr_signal & ~BIT (MPTCP_RM_ADDR_SIGNAL ); len =mptcp_rm_addr_len (&msk->pm.rm_list_tx);if (len <0 ) { -WRITE_ONCE (msk->pm.addr_signal,0 ); +WRITE_ONCE (msk->pm.addr_signal, rm_addr); goto out_unlock; }if (remaining < len) goto out_unlock; *rm_list = msk->pm.rm_list_tx; -WRITE_ONCE (msk->pm.addr_signal,0 ); +WRITE_ONCE (msk->pm.addr_signal, rm_addr); ret = true; out_unlock:
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 185/219 selftests/bpf: Enlarge select() timeout for test_maps
In reply to Sasha LevinFrom: Li Zhijian <[email protected]>
[ Upstream commit 2d82d73da35b72b53fe0d96350a2b8d929d07e42 ]
0Day robot observed that it's easily timeout on a heavy load host.
-------------------
# selftests: bpf: test_maps
# Fork 1024 tasks to 'test_update_delete'
# Fork 1024 tasks to 'test_update_delete'
# Fork 100 tasks to 'test_hashmap'
# Fork 100 tasks to 'test_hashmap_percpu'
# Fork 100 tasks to 'test_hashmap_sizes'
# Fork 100 tasks to 'test_hashmap_walk'
# Fork 100 tasks to 'test_arraymap'
# Fork 100 tasks to 'test_arraymap_percpu'
# Failed sockmap unexpected timeout
not ok 3 selftests: bpf: test_maps # exit=1
# selftests: bpf: test_lru_map
# nr_cpus:8
-------------------
Since this test will be scheduled by 0Day to a random host that could have only a few cpus(2-8), enlarge the timeout to avoid a false NG report.
In practice, i tried to pin it to only one cpu by 'taskset 0x01 ./test_maps', and knew 10S is likely enough, but i still perfer to a larger value 30.
--- tools/testing/selftests/bpf/test_maps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/test_maps.c +1 -1
@@ -968,7 +968,7 @@ static void test_sockmap(unsigned int tasks, void *data)FD_ZERO (&w);FD_SET (sfd[3 ], &w); - to.tv_sec =1 ; + to.tv_sec =30 ; to.tv_usec =0 ; s =select (sfd[3 ] +1 , &w,NULL ,NULL , &to);if (s ==-1 ) {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 186/219 mmc: core: Return correct emmc response in case of ioctl error
In reply to Sasha LevinFrom: Nishad Kamdar <[email protected]>
[ Upstream commit e72a55f2e5ddcfb3dce0701caf925ce435b87682 ]
When a read/write command is sent via ioctl to the kernel, and the command fails, the actual error response of the emmc is not sent to the user.
IOCTL read/write tests are carried out using commands 17 (Single BLock Read), 24 (Single Block Write), 18 (Multi Block Read), 25 (Multi Block Write)
The tests are carried out on a 64Gb emmc device. All of these tests try to access an "out of range" sector address (0x09B2FFFF).
It is seen that without the patch the response received by the user is not OUT_OF_RANGE error (R1 response 31st bit is not set) as per JEDEC specification. After applying the patch proper response is seen. This is because the function returns without copying the response to the user in case of failure. This patch fixes the issue.
Hence, this memcpy is required whether we get an error response or not. Therefor it is moved up from the current position up to immediately after we have called mmc_wait_for_req().
The test code and the output of only the CMD17 is included in the commit to limit the message length.
CMD17 (Test Code Snippet):
==========================
printf("Forming CMD%d\n", opt_idx);
/* single block read */
cmd.blksz = 512;
cmd.blocks = 1;
cmd.write_flag = 0;
cmd.opcode = 17;
//cmd.arg = atoi(argv[3]);
cmd.arg = 0x09B2FFFF;
/* Expecting response R1B */
cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC;
memset(data, 0, sizeof(__u8) * 512);
mmc_ioc_cmd_set_data(cmd, data);
printf("Sending CMD%d: ARG[0x%08x]\n", opt_idx, cmd.arg);
if(ioctl(fd, MMC_IOC_CMD, &cmd))
perror("Error");
printf("\nResponse: %08x\n", cmd.response[0]);CMD17 (Output without patch):
=============================
test@test-LIVA-Z:~$ sudo ./mmc cmd_test /dev/mmcblk0 17 Entering the do_mmc_commands:Device: /dev/mmcblk0 nargs:4 Entering the do_mmc_commands:Device: /dev/mmcblk0 options[17, 0x09B2FFF] Forming CMD17 Sending CMD17: ARG[0x09b2ffff] Error: Connection timed out
Response: 00000000
(Incorrect response)
CMD17 (Output with patch):
==========================
test@test-LIVA-Z:~$ sudo ./mmc cmd_test /dev/mmcblk0 17 [sudo] password for test: Entering the do_mmc_commands:Device: /dev/mmcblk0 nargs:4 Entering the do_mmc_commands:Device: /dev/mmcblk0 options[17, 09B2FFFF] Forming CMD17 Sending CMD17: ARG[0x09b2ffff] Error: Connection timed out
Response: 80000900
(Correct OUT_OF_ERROR response as per JEDEC specification)
--- drivers/mmc/core/block.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/core/block.c +1 -2
@@ -542,6 +542,7 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,return mmc_sanitize (card, idata->ic.cmd_timeout_ms);mmc_wait_for_req (card->host, &mrq); +memcpy (&idata->ic.response, cmd.resp,sizeof (cmd.resp));if (cmd.error) { dev_err(mmc_dev(card->host), "%s: cmd error %d\n",
@@ -591,8 +592,6 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,if (idata->ic.postsleep_min_us)usleep_range (idata->ic.postsleep_min_us, idata->ic.postsleep_max_us); -memcpy (&(idata->ic.response), cmd.resp,sizeof (cmd.resp)); -if (idata->rpmb || (cmd.flags &MMC_RSP_R1B ) ==MMC_RSP_R1B ) {/* * Ensure RPMB/R1B command has completed by polling CMD13
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 187/219 samples: pktgen: fix to print when terminated normally
In reply to Sasha LevinFrom: Juhee Kang <[email protected]>
[ Upstream commit c0e9422c4e6ca9abd4bd6e1598400c7231eb600b ]
Currently, most pktgen samples print the execution result when the program is terminated normally. However, sample03 doesn't work appropriately.
This is results of samples:
# DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample04_many_flows.sh -n 1
Running... ctrl^C to stop
Device: eth0@0
Result: OK: 19(c5+d13) usec, 1 (60byte,0frags)
51762pps 24Mb/sec (24845760bps) errors: 0
# DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample03_burst_single_flow.sh -n 1
Running... ctrl^C to stopThe reason why it doesn't print the execution result when the program is terminated usually is that sample03 doesn't call the function which prints the result, unlike other samples.
So, this commit solves this issue by calling the function before termination. Also, this commit changes control_c function to print_result to maintain consistency with other samples.
--- samples/pktgen/pktgen_sample03_burst_single_flow.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
samples/pktgen/pktgen_sample03_burst_single_flow.sh +4 -2
@@ -83,7 +83,7 @@ for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do done # Run if user hits control-c -function control_c() { +function print_result() { # Print results for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do dev=${DEV}@${thread}
@@ -92,11 +92,13 @@ function control_c() { done } # trap keyboard interrupt (Ctrl-C) -trap control_c SIGINT +trap true SIGINT if [ -z "$APPEND" ]; then echo "Running... ctrl^C to stop" >&2 pg_ctrl "start" + + print_result else echo "Append mode: config done. Do more or use 'pg_ctrl start' to run" fi
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 188/219 cifs: fix wrong release in sess_alloc_buffer() failed path
In reply to Sasha LevinFrom: Ding Hui <[email protected]>
[ Upstream commit d72c74197b70bc3c95152f351a568007bffa3e11 ]
smb_buf is allocated by small_smb_init_no_tc(), and buf type is CIFS_SMALL_BUFFER, so we should use cifs_small_buf_release() to release it in failed path.
--- fs/cifs/sess.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/sess.c +1 -1
@@ -889,7 +889,7 @@ sess_alloc_buffer(struct sess_data *sess_data, int wct)return 0 ; out_free_smb_buf: -kfree (smb_buf); +cifs_small_buf_release (smb_buf); sess_data->iov[0 ].iov_base =NULL ; sess_data->iov[0 ].iov_len =0 ; sess_data->buf0_type =CIFS_NO_BUFFER ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 189/219 Revert "USB: xhci: fix U1/U2 handling for hardware with XHCI_INTEL_HOST quirk set"
In reply to Sasha LevinFrom: Mathias Nyman <[email protected]>
[ Upstream commit 2847c46c61486fd8bca9136a6e27177212e78c69 ]
This reverts commit 5d5323a6f3625f101dbfa94ba3ef7706cce38760.
That commit effectively disabled Intel host initiated U1/U2 lpm for devices with periodic endpoints.
Before that commit we disabled host initiated U1/U2 lpm if the exit latency was larger than any periodic endpoint service interval, this is according to xhci spec xhci 1.1 specification section 4.23.5.2
After that commit we incorrectly checked that service interval was smaller than U1/U2 inactivity timeout. This is not relevant, and can't happen for Intel hosts as previously set U1/U2 timeout = 105% * service interval.
Patch claimed it solved cases where devices can't be enumerated because of bandwidth issues. This might be true but it's a side effect of accidentally turning off lpm.
exit latency calculations have been revised since then
--- drivers/usb/host/xhci.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/usb/host/xhci.c +12 -12
@@ -4705,19 +4705,19 @@ static u16 xhci_calculate_u1_timeout(struct xhci_hcd *xhci, {unsigned long long timeout_ns; -if (xhci->quirks &XHCI_INTEL_HOST ) - timeout_ns =xhci_calculate_intel_u1_timeout (udev, desc); -else - timeout_ns = udev->u1_params.sel; -/* Prevent U1 if service interval is shorter than U1 exit latency */ if (usb_endpoint_xfer_int (desc) ||usb_endpoint_xfer_isoc (desc)) { -if (xhci_service_interval_to_ns (desc) <= timeout_ns) { +if (xhci_service_interval_to_ns (desc) <= udev->u1_params.mel) {dev_dbg (&udev->dev,"Disable U1, ESIT shorter than exit latency\n" );return USB3_LPM_DISABLED ; } } +if (xhci->quirks &XHCI_INTEL_HOST ) + timeout_ns =xhci_calculate_intel_u1_timeout (udev, desc); +else + timeout_ns = udev->u1_params.sel; +/* The U1 timeout is encoded in 1us intervals. * Don't return a timeout of zero, because that's USB3_LPM_DISABLED. */
@@ -4769,19 +4769,19 @@ static u16 xhci_calculate_u2_timeout(struct xhci_hcd *xhci, {unsigned long long timeout_ns; -if (xhci->quirks &XHCI_INTEL_HOST ) - timeout_ns =xhci_calculate_intel_u2_timeout (udev, desc); -else - timeout_ns = udev->u2_params.sel; -/* Prevent U2 if service interval is shorter than U2 exit latency */ if (usb_endpoint_xfer_int (desc) ||usb_endpoint_xfer_isoc (desc)) { -if (xhci_service_interval_to_ns (desc) <= timeout_ns) { +if (xhci_service_interval_to_ns (desc) <= udev->u2_params.mel) {dev_dbg (&udev->dev,"Disable U2, ESIT shorter than exit latency\n" );return USB3_LPM_DISABLED ; } } +if (xhci->quirks &XHCI_INTEL_HOST ) + timeout_ns =xhci_calculate_intel_u2_timeout (udev, desc); +else + timeout_ns = udev->u2_params.sel; +/* The U2 timeout is encoded in 256us intervals */ timeout_ns =DIV_ROUND_UP_ULL (timeout_ns,256 *1000 );/* If the necessary timeout value is bigger than what we can set in the
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 190/219 usb: dwc3: imx8mp: request irq after initializing dwc3
In reply to Sasha LevinFrom: Nadezda Lutovinova <[email protected]>
[ Upstream commit 6a48d0ae01a6ab05ae5e78328546a2f5f6d3054a ]
If IRQ occurs between calling devm_request_threaded_irq() and initializing dwc3_imx->dwc3, then null pointer dereference occurs since dwc3_imx->dwc3 is used in dwc3_imx8mp_interrupt().
The patch puts registration of the interrupt handler after initializing of neccesery data.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/usb/dwc3/dwc3-imx8mp.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/usb/dwc3/dwc3-imx8mp.c +7 -7
@@ -152,13 +152,6 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev) } dwc3_imx->irq = irq; - err =devm_request_threaded_irq (dev, irq,NULL , dwc3_imx8mp_interrupt, -IRQF_ONESHOT ,dev_name (dev), dwc3_imx); -if (err) { -dev_err (dev,"failed to request IRQ #%d --> %d\n" , irq, err); - goto disable_clks; - } -pm_runtime_set_active (dev);pm_runtime_enable (dev); err =pm_runtime_get_sync (dev);
@@ -186,6 +179,13 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev) }of_node_put (dwc3_np); + err =devm_request_threaded_irq (dev, irq,NULL , dwc3_imx8mp_interrupt, +IRQF_ONESHOT ,dev_name (dev), dwc3_imx); +if (err) { +dev_err (dev,"failed to request IRQ #%d --> %d\n" , irq, err); + goto depopulate; + } +device_set_wakeup_capable (dev, true);pm_runtime_put (dev);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 191/219 usb: musb: musb_dsps: request_irq() after initializing musb
In reply to Sasha LevinFrom: Nadezda Lutovinova <[email protected]>
[ Upstream commit 7c75bde329d7e2a93cf86a5c15c61f96f1446cdc ]
If IRQ occurs between calling dsps_setup_optional_vbus_irq() and dsps_create_musb_pdev(), then null pointer dereference occurs since glue->musb wasn't initialized yet.
The patch puts initializing of neccesery data before registration of the interrupt handler.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/usb/musb/musb_dsps.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/usb/musb/musb_dsps.c +6 -7
@@ -890,23 +890,22 @@ static int dsps_probe(struct platform_device *pdev)if (!glue->usbss_base)return -ENXIO ; -if (usb_get_dr_mode (&pdev->dev) ==USB_DR_MODE_PERIPHERAL ) { - ret =dsps_setup_optional_vbus_irq (pdev, glue); -if (ret) - goto err_iounmap; - } -platform_set_drvdata (pdev, glue);pm_runtime_enable (&pdev->dev); ret =dsps_create_musb_pdev (glue, pdev);if (ret) goto err; +if (usb_get_dr_mode (&pdev->dev) ==USB_DR_MODE_PERIPHERAL ) { + ret =dsps_setup_optional_vbus_irq (pdev, glue); +if (ret) + goto err; + } +return 0 ; err:pm_runtime_disable (&pdev->dev); -err_iounmap:iounmap (glue->usbss_base);return ret; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 192/219 usbip: give back URBs for unsent unlink requests during cleanup
In reply to Sasha LevinFrom: Anirudh Rayabharam <[email protected]>
[ Upstream commit 258c81b341c8025d79073ce2d6ce19dcdc7d10d2 ]
In vhci_device_unlink_cleanup(), the URBs for unsent unlink requests are not given back. This sometimes causes usb_kill_urb to wait indefinitely for that urb to be given back. syzbot has reported a hung task issue [1] for this.
To fix this, give back the urbs corresponding to unsent unlink requests (unlink_tx list) similar to how urbs corresponding to unanswered unlink requests (unlink_rx list) are given back.
[1]: https://syzkaller.appspot.com/bug?id=08f12df95ae7da69814e64eb5515d5a85ed06b76
--- drivers/usb/usbip/vhci_hcd.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/usb/usbip/vhci_hcd.c +24 -0
@@ -957,8 +957,32 @@ static void vhci_device_unlink_cleanup(struct vhci_device *vdev)spin_lock (&vdev->priv_lock);list_for_each_entry_safe (unlink, tmp, &vdev->unlink_tx, list) { +struct urb *urb; + +/* give back urb of unsent unlink request */ pr_info ("unlink cleanup tx %lu\n" , unlink->unlink_seqnum); + + urb =pickup_urb_and_free_priv (vdev, unlink->unlink_seqnum); +if (!urb) { +list_del (&unlink->list); +kfree (unlink); +continue ; + } + + urb->status = -ENODEV ; + +usb_hcd_unlink_urb_from_ep (hcd, urb); +list_del (&unlink->list); + +spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vhci->lock, flags); + +usb_hcd_giveback_urb (hcd, urb, urb->status); + +spin_lock_irqsave (&vhci->lock, flags); +spin_lock (&vdev->priv_lock); +kfree (unlink); }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 193/219 usbip:vhci_hcd USB port can get stuck in the disabled state
In reply to Sasha LevinFrom: Shuah Khan <[email protected]>
[ Upstream commit 66cce9e73ec61967ed1f97f30cee79bd9a2bb7ee ]
When a remote usb device is attached to the local Virtual USB Host Controller Root Hub port, the bound device driver may send a port reset command.
vhci_hcd accepts port resets only when the device doesn't have port address assigned to it. When reset happens device is in assigned/used state and vhci_hcd rejects it leaving the port in a stuck state.
This problem was found when a blue-tooth or xbox wireless dongle was passed through using usbip.
A few drivers reset the port during probe including mt76 driver specific to this bug report. Fix the problem with a change to honor reset requests when device is in used state (VDEV_ST_USED).
--- drivers/usb/usbip/vhci_hcd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/usb/usbip/vhci_hcd.c +7 -1
@@ -455,8 +455,14 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, vhci_hcd->port_status[rhport] &= ~(1 <<USB_PORT_FEAT_RESET ); vhci_hcd->re_timeout =0 ; +/* +* A few drivers do usb reset during probe when +* the device could be in VDEV_ST_USED state +*/ if (vhci_hcd->vdev[rhport].ud.status == -VDEV_ST_NOTASSIGNED ) { +VDEV_ST_NOTASSIGNED || + vhci_hcd->vdev[rhport].ud.status == +VDEV_ST_USED ) { usbip_dbg_vhci_rh( " enable rhport %d (status %u)\n", rhport,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 194/219 usb: xhci-mtk: fix use-after-free of mtk->hcd
In reply to Sasha LevinFrom: Chunfeng Yun <[email protected]>
[ Upstream commit 7f85c16f40d8be5656fb3476909db5c3a5a9c6ea ]
BUG: KASAN: use-after-free in usb_hcd_is_primary_hcd+0x38/0x60 Call trace: dump_backtrace+0x0/0x3dc show_stack+0x20/0x2c dump_stack+0x15c/0x1d4 print_address_description+0x7c/0x510 kasan_report+0x164/0x1ac __asan_report_load8_noabort+0x44/0x50 usb_hcd_is_primary_hcd+0x38/0x60 xhci_mtk_runtime_suspend+0x68/0x148 pm_generic_runtime_suspend+0x90/0xac __rpm_callback+0xb8/0x1f4 rpm_callback+0x54/0x1d0 rpm_suspend+0x4e0/0xc84 __pm_runtime_suspend+0xc4/0x114 xhci_mtk_probe+0xa58/0xd00
This may happen when probe fails, needn't suspend it synchronously, fix it by using pm_runtime_put_noidle().
--- drivers/usb/host/xhci-mtk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-mtk.c +1 -1
@@ -571,7 +571,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)xhci_mtk_ldos_disable (mtk); disable_pm: -pm_runtime_put_sync_autosuspend (dev); +pm_runtime_put_noidle (dev);pm_runtime_disable (dev);return ret; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 195/219 ASoC: rockchip: i2s: Fix regmap_ops hang
In reply to Sasha LevinFrom: Sugar Zhang <[email protected]>
[ Upstream commit 53ca9b9777b95cdd689181d7c547e38dc79adad0 ]
API 'set_fmt' maybe called when PD is off, in the situation, any register access will hang the system. so, enable PD before r/w register.
--- sound/soc/rockchip/rockchip_i2s.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
sound/soc/rockchip/rockchip_i2s.c +14 -5
@@ -186,7 +186,9 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, {struct rk_i2s_dev *i2s =to_info (cpu_dai);unsigned int mask =0 , val =0 ; +int ret =0 ; +pm_runtime_get_sync (cpu_dai->dev); mask =I2S_CKR_MSS_MASK ;switch (fmt &SND_SOC_DAIFMT_MASTER_MASK ) {case SND_SOC_DAIFMT_CBS_CFS :
@@ -199,7 +201,8 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, i2s->is_master_mode = false;break ;default : -return -EINVAL ; + ret = -EINVAL ; + goto err_pm_put; }regmap_update_bits (i2s->regmap,I2S_CKR , mask, val);
@@ -213,7 +216,8 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, val =I2S_CKR_CKP_POS ;break ;default : -return -EINVAL ; + ret = -EINVAL ; + goto err_pm_put; }regmap_update_bits (i2s->regmap,I2S_CKR , mask, val);
@@ -236,7 +240,8 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, val =I2S_TXCR_TFS_PCM |I2S_TXCR_PBM_MODE (1 );break ;default : -return -EINVAL ; + ret = -EINVAL ; + goto err_pm_put; }regmap_update_bits (i2s->regmap,I2S_TXCR , mask, val);
@@ -259,12 +264,16 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, val =I2S_RXCR_TFS_PCM |I2S_RXCR_PBM_MODE (1 );break ;default : -return -EINVAL ; + ret = -EINVAL ; + goto err_pm_put; }regmap_update_bits (i2s->regmap,I2S_RXCR , mask, val); -return 0 ; +err_pm_put: +pm_runtime_put (cpu_dai->dev); + +return ret; } static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 196/219 ASoC: rockchip: i2s: Fixup config for DAIFMT_DSP_A/B
In reply to Sasha LevinFrom: Xiaotan Luo <[email protected]>
[ Upstream commit 1bf56843e664eef2525bdbfae6a561e98910f676 ]
- DSP_A: PCM delay 1 bit mode, L data MSB after FRM LRC
- DSP_B: PCM no delay mode, L data MSB during FRM LRC
--- sound/soc/rockchip/rockchip_i2s.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
sound/soc/rockchip/rockchip_i2s.c +8 -8
@@ -233,12 +233,12 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai,case SND_SOC_DAIFMT_I2S : val =I2S_TXCR_IBM_NORMAL ;break ; -case SND_SOC_DAIFMT_DSP_A :/* PCM no delay mode */ - val =I2S_TXCR_TFS_PCM ; -break ; -case SND_SOC_DAIFMT_DSP_B :/* PCM delay 1 mode */ +case SND_SOC_DAIFMT_DSP_A :/* PCM delay 1 bit mode */ val =I2S_TXCR_TFS_PCM |I2S_TXCR_PBM_MODE (1 );break ; +case SND_SOC_DAIFMT_DSP_B :/* PCM no delay mode */ + val =I2S_TXCR_TFS_PCM ; +break ;default : ret = -EINVAL ; goto err_pm_put;
@@ -257,12 +257,12 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai,case SND_SOC_DAIFMT_I2S : val =I2S_RXCR_IBM_NORMAL ;break ; -case SND_SOC_DAIFMT_DSP_A :/* PCM no delay mode */ - val =I2S_RXCR_TFS_PCM ; -break ; -case SND_SOC_DAIFMT_DSP_B :/* PCM delay 1 mode */ +case SND_SOC_DAIFMT_DSP_A :/* PCM delay 1 bit mode */ val =I2S_RXCR_TFS_PCM |I2S_RXCR_PBM_MODE (1 );break ; +case SND_SOC_DAIFMT_DSP_B :/* PCM no delay mode */ + val =I2S_RXCR_TFS_PCM ; +break ;default : ret = -EINVAL ; goto err_pm_put;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 197/219 ASoC: soc-pcm: protect BE dailink state changes in trigger
In reply to Sasha LevinFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 0c75fc7193387776c10f7c7b440d93496e3d5e21 ]
When more than one FE is connected to a BE, e.g. in a mixing use case, the BE can be triggered multiple times when the FE are opened/started concurrently. This race condition is problematic in the case of SoundWire BE dailinks, and this is not desirable in a general case. The code carefully checks when the BE can be stopped or hw_free'ed, but the trigger code does not use any mutual exclusion.
Fix by using the same spinlock already used to check FE states, and set the state before the trigger. In case of errors, the initial state will be restored.
This patch does not change how the triggers are handled, it only makes sure the states are handled in critical sections.
Message-Id: <[email protected]>
--- sound/soc/soc-pcm.c | 103 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 85 insertions(+), 18 deletions(-)
sound/soc/soc-pcm.c +85 -18
@@ -2001,6 +2001,8 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,struct snd_soc_pcm_runtime *be;struct snd_soc_dpcm *dpcm;int ret =0 ; +unsigned long flags; +enum snd_soc_dpcm_state state;for_each_dpcm_be (fe, stream, dpcm) {struct snd_pcm_substream *be_substream;
@@ -2017,76 +2019,141 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,switch (cmd) {case SNDRV_PCM_TRIGGER_START : +spin_lock_irqsave (&fe->card->dpcm_lock, flags);if ((be->dpcm[stream].state !=SND_SOC_DPCM_STATE_PREPARE ) && (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_STOP ) && - (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_PAUSED )) + (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_PAUSED )) { +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags);continue ; + } + state = be->dpcm[stream].state; + be->dpcm[stream].state =SND_SOC_DPCM_STATE_START ; +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags); ret =soc_pcm_trigger (be_substream, cmd); -if (ret) +if (ret) { +spin_lock_irqsave (&fe->card->dpcm_lock, flags); + be->dpcm[stream].state = state; +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags); goto end; + } - be->dpcm[stream].state =SND_SOC_DPCM_STATE_START ;break ;case SNDRV_PCM_TRIGGER_RESUME : -if ((be->dpcm[stream].state !=SND_SOC_DPCM_STATE_SUSPEND )) +spin_lock_irqsave (&fe->card->dpcm_lock, flags); +if (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_SUSPEND ) { +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags);continue ; + } + + state = be->dpcm[stream].state; + be->dpcm[stream].state =SND_SOC_DPCM_STATE_START ; +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags); ret =soc_pcm_trigger (be_substream, cmd); -if (ret) +if (ret) { +spin_lock_irqsave (&fe->card->dpcm_lock, flags); + be->dpcm[stream].state = state; +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags); goto end; + } - be->dpcm[stream].state =SND_SOC_DPCM_STATE_START ;break ;case SNDRV_PCM_TRIGGER_PAUSE_RELEASE : -if ((be->dpcm[stream].state !=SND_SOC_DPCM_STATE_PAUSED )) +spin_lock_irqsave (&fe->card->dpcm_lock, flags); +if (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_PAUSED ) { +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags);continue ; + } + + state = be->dpcm[stream].state; + be->dpcm[stream].state =SND_SOC_DPCM_STATE_START ; +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags); ret =soc_pcm_trigger (be_substream, cmd); -if (ret) +if (ret) { +spin_lock_irqsave (&fe->card->dpcm_lock, flags); + be->dpcm[stream].state = state; +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags); goto end; + } - be->dpcm[stream].state =SND_SOC_DPCM_STATE_START ;break ;case SNDRV_PCM_TRIGGER_STOP : +spin_lock_irqsave (&fe->card->dpcm_lock, flags);if ((be->dpcm[stream].state !=SND_SOC_DPCM_STATE_START ) && - (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_PAUSED )) + (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_PAUSED )) { +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags);continue ; + } +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags);if (!snd_soc_dpcm_can_be_free_stop (fe, be, stream))continue ; +spin_lock_irqsave (&fe->card->dpcm_lock, flags); + state = be->dpcm[stream].state; + be->dpcm[stream].state =SND_SOC_DPCM_STATE_STOP ; +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags); + ret =soc_pcm_trigger (be_substream, cmd); -if (ret) +if (ret) { +spin_lock_irqsave (&fe->card->dpcm_lock, flags); + be->dpcm[stream].state = state; +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags); goto end; + } - be->dpcm[stream].state =SND_SOC_DPCM_STATE_STOP ;break ;case SNDRV_PCM_TRIGGER_SUSPEND : -if (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_START ) +spin_lock_irqsave (&fe->card->dpcm_lock, flags); +if (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_START ) { +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags);continue ; + } +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags);if (!snd_soc_dpcm_can_be_free_stop (fe, be, stream))continue ; +spin_lock_irqsave (&fe->card->dpcm_lock, flags); + state = be->dpcm[stream].state; + be->dpcm[stream].state =SND_SOC_DPCM_STATE_STOP ; +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags); + ret =soc_pcm_trigger (be_substream, cmd); -if (ret) +if (ret) { +spin_lock_irqsave (&fe->card->dpcm_lock, flags); + be->dpcm[stream].state = state; +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags); goto end; + } - be->dpcm[stream].state =SND_SOC_DPCM_STATE_SUSPEND ;break ;case SNDRV_PCM_TRIGGER_PAUSE_PUSH : -if (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_START ) +spin_lock_irqsave (&fe->card->dpcm_lock, flags); +if (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_START ) { +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags);continue ; + } +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags);if (!snd_soc_dpcm_can_be_free_stop (fe, be, stream))continue ; +spin_lock_irqsave (&fe->card->dpcm_lock, flags); + state = be->dpcm[stream].state; + be->dpcm[stream].state =SND_SOC_DPCM_STATE_PAUSED ; +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags); + ret =soc_pcm_trigger (be_substream, cmd); -if (ret) +if (ret) { +spin_lock_irqsave (&fe->card->dpcm_lock, flags); + be->dpcm[stream].state = state; +spin_unlock_irqrestore (&fe->card->dpcm_lock, flags); goto end; + } - be->dpcm[stream].state =SND_SOC_DPCM_STATE_PAUSED ;break ; } }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 198/219 drm/amdkfd: Account for SH/SE count when setting up cu masks.
In reply to Sasha LevinFrom: Sean Keely <[email protected]>
[ Upstream commit 1ec06c2dee679e9f089e78ed20cb74ee90155f61 ]
On systems with multiple SH per SE compute_static_thread_mgmt_se# is split into independent masks, one for each SH, in the upper and lower 16 bits. We need to detect this and apply cu masking to each SH. The cu mask bits are assigned first to each SE, then to alternate SHs, then finally to higher CU id. This ensures that the maximum number of SPIs are engaged as early as possible while balancing CU assignment to each SH.
v2: Use max SH/SE rather than max SH in cu_per_sh.
v3: Fix comment blocks, ensure se_mask is initially zero filled,
and correctly assign se.sh.cu positions to unset bits in cu_mask.
--- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c | 84 +++++++++++++++----- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h | 1 + 2 files changed, 64 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c +63 -21
@@ -98,36 +98,78 @@ void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm, uint32_t *se_mask) {struct kfd_cu_info cu_info; -uint32_t cu_per_se[KFD_MAX_NUM_SE ] = {0 }; -int i, se, sh, cu =0 ; - +uint32_t cu_per_sh[KFD_MAX_NUM_SE ][KFD_MAX_NUM_SH_PER_SE ] = {0 }; +int i, se, sh, cu;amdgpu_amdkfd_get_cu_info (mm->dev->kgd, &cu_info);if (cu_mask_count > cu_info.cu_active_number) cu_mask_count = cu_info.cu_active_number; +/* Exceeding these bounds corrupts the stack and indicates a coding error. +* Returning with no CU's enabled will hang the queue, which should be +* attention grabbing. +*/ +if (cu_info.num_shader_engines >KFD_MAX_NUM_SE ) { +pr_err ("Exceeded KFD_MAX_NUM_SE, chip reports %d\n" , cu_info.num_shader_engines); +return ; + } +if (cu_info.num_shader_arrays_per_engine >KFD_MAX_NUM_SH_PER_SE ) { +pr_err ("Exceeded KFD_MAX_NUM_SH, chip reports %d\n" , + cu_info.num_shader_arrays_per_engine * cu_info.num_shader_engines); +return ; + } +/* Count active CUs per SH. +* +* Some CUs in an SH may be disabled. HW expects disabled CUs to be +* represented in the high bits of each SH's enable mask (the upper and lower +* 16 bits of se_mask) and will take care of the actual distribution of +* disabled CUs within each SH automatically. +* Each half of se_mask must be filled only on bits 0-cu_per_sh[se][sh]-1. +* +* See note on Arcturus cu_bitmap layout in gfx_v9_0_get_cu_info. +*/ for (se =0 ; se < cu_info.num_shader_engines; se++)for (sh =0 ; sh < cu_info.num_shader_arrays_per_engine; sh++) - cu_per_se[se] +=hweight32 (cu_info.cu_bitmap[se %4 ][sh + (se /4 )]); - -/* Symmetrically map cu_mask to all SEs: -* cu_mask[0] bit0 -> se_mask[0] bit0; -* cu_mask[0] bit1 -> se_mask[1] bit0; -* ... (if # SE is 4) -* cu_mask[0] bit4 -> se_mask[0] bit1; + cu_per_sh[se][sh] =hweight32 (cu_info.cu_bitmap[se %4 ][sh + (se /4 )]); + +/* Symmetrically map cu_mask to all SEs & SHs: +* se_mask programs up to 2 SH in the upper and lower 16 bits. +* +* Examples +* Assuming 1 SH/SE, 4 SEs: +* cu_mask[0] bit0 -> se_mask[0] bit0 +* cu_mask[0] bit1 -> se_mask[1] bit0 +* ... +* cu_mask[0] bit4 -> se_mask[0] bit1 +* ... +* +* Assuming 2 SH/SE, 4 SEs +* cu_mask[0] bit0 -> se_mask[0] bit0 (SE0,SH0,CU0) +* cu_mask[0] bit1 -> se_mask[1] bit0 (SE1,SH0,CU0) +* ... +* cu_mask[0] bit4 -> se_mask[0] bit16 (SE0,SH1,CU0) +* cu_mask[0] bit5 -> se_mask[1] bit16 (SE1,SH1,CU0) +* ... +* cu_mask[0] bit8 -> se_mask[0] bit1 (SE0,SH0,CU1) * ... +* +* First ensure all CUs are disabled, then enable user specified CUs. */ - se =0 ; -for (i =0 ; i < cu_mask_count; i++) { -if (cu_mask[i /32 ] & (1 << (i %32 ))) - se_mask[se] |=1 << cu; - -do { - se++; -if (se == cu_info.num_shader_engines) { - se =0 ; - cu++; +for (i =0 ; i < cu_info.num_shader_engines; i++) + se_mask[i] =0 ; + + i =0 ; +for (cu =0 ; cu <16 ; cu++) { +for (sh =0 ; sh < cu_info.num_shader_arrays_per_engine; sh++) { +for (se =0 ; se < cu_info.num_shader_engines; se++) { +if (cu_per_sh[se][sh] > cu) { +if (cu_mask[i /32 ] & (1 << (i %32 ))) + se_mask[se] |=1 << (cu + sh *16 ); + i++; +if (i == cu_mask_count) +return ; + } } - }while (cu >= cu_per_se[se] && cu <32 ); + } } }
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h +1 -0
@@ -27,6 +27,7 @@#include "kfd_priv.h" #define KFD_MAX_NUM_SE 8 +#define KFD_MAX_NUM_SH_PER_SE 2/** * struct mqd_manager
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 199/219 nfs: don't atempt blocking locks on nfs reexports
In reply to Sasha LevinFrom: "J. Bruce Fields" <[email protected]>
[ Upstream commit f657f8eef3ff870552c9fd2839e0061046f44618 ]
NFS implements blocking locks by blocking inside its lock method. In the reexport case, this blocks the nfs server thread, which could lead to deadlocks since an nfs server thread might be required to unlock the conflicting lock. It also causes a crash, since the nfs server thread assumes it can free the lock when its lm_notify lock callback is called.
Ideal would be to make the nfs lock method return without blocking in this case, but for now it works just not to attempt blocking locks. The difference is just that the original client will have to poll (as it does in the v4.0 case) instead of getting a callback when the lock's available.
--- fs/nfs/export.c | 2 +- fs/nfsd/nfs4state.c | 8 ++++++-- include/linux/exportfs.h | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-)
fs/nfs/export.c +1 -1
@@ -180,5 +180,5 @@ const struct export_operations nfs_export_ops = { .fetch_iversion = nfs_fetch_iversion, .flags =EXPORT_OP_NOWCC |EXPORT_OP_NOSUBTREECHK |EXPORT_OP_CLOSE_BEFORE_UNLINK |EXPORT_OP_REMOTE_FS | - EXPORT_OP_NOATOMIC_ATTR, + EXPORT_OP_NOATOMIC_ATTR|EXPORT_OP_SYNC_LOCKS, };
fs/nfsd/nfs4state.c +6 -2
@@ -6727,6 +6727,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,struct nfsd4_blocked_lock *nbl =NULL ;struct file_lock *file_lock =NULL ;struct file_lock *conflock =NULL ; +struct super_block *sb;__be32 status =0 ;int lkflg;int err;
@@ -6748,6 +6749,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,dprintk ("NFSD: nfsd4_lock: permission denied!\n" );return status; } + sb = cstate->current_fh.fh_dentry->d_sb;if (lock->lk_is_new) {if (nfsd4_has_session (cstate))
@@ -6796,7 +6798,8 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, fp = lock_stp->st_stid.sc_file;switch (lock->lk_type) {case NFS4_READW_LT : -if (nfsd4_has_session (cstate)) +if (nfsd4_has_session (cstate) && + !(sb->s_export_op->flags &EXPORT_OP_SYNC_LOCKS )) fl_flags |=FL_SLEEP ; fallthrough;case NFS4_READ_LT :
@@ -6808,7 +6811,8 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, fl_type =F_RDLCK ;break ;case NFS4_WRITEW_LT : -if (nfsd4_has_session (cstate)) +if (nfsd4_has_session (cstate) && + !(sb->s_export_op->flags &EXPORT_OP_SYNC_LOCKS )) fl_flags |=FL_SLEEP ; fallthrough;case NFS4_WRITE_LT :
include/linux/exportfs.h +2 -0
@@ -221,6 +221,8 @@ struct export_operations {#define EXPORT_OP_NOATOMIC_ATTR (0x10)/* Filesystem cannot supply atomic attribute updates */ +#define EXPORT_OP_SYNC_LOCKS (0x20)/* Filesystem can't do +asychronous blocking locks */ unsigned long flags; };
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 200/219 nfsd: fix crash on LOCKT on reexported NFSv3
In reply to Sasha LevinFrom: "J. Bruce Fields" <[email protected]>
[ Upstream commit 0bcc7ca40bd823193224e9f38bafbd8325aaf566 ]
Unlike other filesystems, NFSv3 tries to use fl_file in the GETLK case.
--- fs/nfsd/nfs4state.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/nfsd/nfs4state.c +3 -2
@@ -6932,8 +6932,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,/* * The NFSv4 spec allows a client to do a LOCKT without holding an OPEN, * so we do a temporary open here just to get an open file to pass to -* vfs_test_lock. (Arguably perhaps test_lock should be done with an -* inode operation.) +* vfs_test_lock. */ static __be32 nfsd_test_lock (struct svc_rqst *rqstp,struct svc_fh *fhp,struct file_lock *lock) {
@@ -6948,7 +6947,9 @@ static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct NFSD_MAY_READ));if (err) goto out; + lock->fl_file = nf->nf_file; err =nfserrno (vfs_test_lock (nf->nf_file, lock)); + lock->fl_file =NULL ; out:fh_unlock (fhp);nfsd_file_put (nf);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 201/219 iwlwifi: pcie: free RBs during configure
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 6ac5720086c8b176794eb74c5cc09f8b79017f38 ]
When switching op-modes, or more generally when reconfiguring, we might switch the RB size. In _iwl_pcie_rx_init() we have a comment saying we must free all RBs since we might switch the size, but this is actually too late: the switch has been done and we'll free the buffers with the wrong size.
Fix this by always freeing the buffers, if any, at the start of configure, instead of only after the size may have changed.
--- drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 5 ++++- drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/pcie/rx.c +4 -1
@@ -487,6 +487,9 @@ void iwl_pcie_free_rbs_pool(struct iwl_trans *trans)struct iwl_trans_pcie *trans_pcie =IWL_TRANS_GET_PCIE_TRANS (trans);int i; +if (!trans_pcie->rx_pool) +return ; +for (i =0 ; i <RX_POOL_SIZE (trans_pcie->num_rx_bufs); i++) {if (!trans_pcie->rx_pool[i].page)continue ;
@@ -1093,7 +1096,7 @@ static int _iwl_pcie_rx_init(struct iwl_trans *trans)INIT_LIST_HEAD (&rba->rbd_empty);spin_unlock_bh (&rba->lock); -/* free all first - we might be reconfigured for a different size */ +/* free all first - we overwrite everything here */ iwl_pcie_free_rbs_pool (trans);for (i =0 ; i <RX_QUEUE_SIZE ; i++)
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +3 -0
@@ -1866,6 +1866,9 @@ static void iwl_trans_pcie_configure(struct iwl_trans *trans, {struct iwl_trans_pcie *trans_pcie =IWL_TRANS_GET_PCIE_TRANS (trans); +/* free all first - we might be reconfigured for a different size */ +iwl_pcie_free_rbs_pool (trans); + trans->txqs.cmd.q_id = trans_cfg->cmd_queue; trans->txqs.cmd.fifo = trans_cfg->cmd_fifo; trans->txqs.cmd.wdg_timeout = trans_cfg->cmd_q_wdg_timeout;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 202/219 iwlwifi: mvm: Do not use full SSIDs in 6GHz scan
In reply to Sasha LevinFrom: Ilan Peer <[email protected]>
[ Upstream commit deedf9b97cd4ef45da476c9bdd2a5f3276053956 ]
The scan request processing populated the direct SSIDs in the FW scan request command also for 6GHz scan, which is not needed and might result in unexpected behavior.
Fix the code to add the direct SSIDs only in case the scan is not a 6GHz scan.
--- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/scan.c +6 -3
@@ -2368,14 +2368,17 @@ static int iwl_mvm_scan_umac_v14(struct iwl_mvm *mvm, struct ieee80211_vif *vif,if (ret)return ret; -iwl_mvm_scan_umac_fill_probe_p_v4 (params, &scan_p->probe_params, - &bitmap_ssid);if (!params->scan_6ghz) { +iwl_mvm_scan_umac_fill_probe_p_v4 (params, &scan_p->probe_params, + &bitmap_ssid);iwl_mvm_scan_umac_fill_ch_p_v6 (mvm, params, vif, - &scan_p->channel_params, bitmap_ssid); + &scan_p->channel_params, bitmap_ssid);return 0 ; + }else { + pb->preq = params->preq; } + cp->flags =iwl_mvm_scan_umac_chan_flags_v2 (mvm, params, vif); cp->n_aps_override[0 ] =IWL_SCAN_ADWELL_N_APS_GO_FRIENDLY ; cp->n_aps_override[1 ] =IWL_SCAN_ADWELL_N_APS_SOCIAL_CHS ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 203/219 iwlwifi: mvm: fix a memory leak in iwl_mvm_mac_ctxt_beacon_changed
In reply to Sasha LevinFrom: Zhang Qilong <[email protected]>
[ Upstream commit 0f5d44ac6e55551798dd3da0ff847c8df5990822 ]
If beacon_inject_active is true, we will return without freeing beacon. Fid that by freeing it before returning.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +3 -1
@@ -1005,8 +1005,10 @@ int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,return -ENOMEM ;#ifdef CONFIG_IWLWIFI_DEBUGFS -if (mvm->beacon_inject_active) +if (mvm->beacon_inject_active) { +dev_kfree_skb (beacon);return -EBUSY ; + }#endif ret =iwl_mvm_mac_ctxt_send_beacon (mvm, vif, beacon);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 204/219 iwlwifi: mvm: avoid static queue number aliasing
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit c6ce1c74ef2923b8ffd85f7f8b486f804f343b39 ]
When TVQM is enabled (iwl_mvm_has_new_tx_api() is true), then queue numbers are just sequentially assigned 0, 1, 2, ... Prior to TVQM, in DQA, there were some statically allocated queue numbers:
* IWL_MVM_DQA_AUX_QUEUE == 1,
* both IWL_MVM_DQA_INJECT_MONITOR_QUEUE and IWL_MVM_DQA_P2P_DEVICE_QUEUE == 2, and
* IWL_MVM_DQA_AP_PROBE_RESP_QUEUE == 9.
Now, these values are assigned to the members mvm->aux_queue, mvm->snif_queue, mvm->probe_queue and mvm->p2p_dev_queue by default. Normally, this doesn't really matter, and if TVQM is in fact available we override them to the real values after allocating a queue for use there.
However, this allocation doesn't always happen. For example, for mvm->p2p_dev_queue (== 2) it only happens when the P2P Device interface is started, if any. If it's not started, the value in mvm->p2p_dev_queue remains 2. This wouldn't really matter all that much if it weren't for iwl_mvm_is_static_queue() which checks a queue number against one of those four static numbers.
Now, if no P2P Device or monitor interface is added then queue 2 may be dynamically allocated, yet alias mvm->p2p_dev_queue or mvm->snif_queue, and thus iwl_mvm_is_static_queue() erroneously returns true for it. If it then gets full, all interface queues are stopped, instead of just backpressuring against the one TXQ that's really the only affected one.
This clearly can lead to issues, as everything is stopped even if just a single TXQ filled its corresponding HW queue, if it happens to have an appropriate number (2 or 9, AUX is always reassigned.) Due to a mac80211 bug, this also led to a situation in which the queues remained stopped across a deauthentication and then attempts to connect to a new AP started failing, but that's fixed separately.
Fix all of this by simply initializing the queue numbers to the invalid value until they're used, if TVQM is enabled, and also setting them back to that value when the queues are later freed again.
--- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 24 +++++++++++++--- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 30 ++++++++++++-------- 2 files changed, 38 insertions(+), 16 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/ops.c +20 -4
@@ -754,10 +754,26 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, mvm->fw_restart = iwlwifi_mod_params.fw_restart ?-1 :0 ; - mvm->aux_queue =IWL_MVM_DQA_AUX_QUEUE ; - mvm->snif_queue =IWL_MVM_DQA_INJECT_MONITOR_QUEUE ; - mvm->probe_queue =IWL_MVM_DQA_AP_PROBE_RESP_QUEUE ; - mvm->p2p_dev_queue =IWL_MVM_DQA_P2P_DEVICE_QUEUE ; +if (iwl_mvm_has_new_tx_api (mvm)) { +/* +* If we have the new TX/queue allocation API initialize them +* all to invalid numbers. We'll rewrite the ones that we need +* later, but that doesn't happen for all of them all of the +* time (e.g. P2P Device is optional), and if a dynamic queue +* ends up getting number 2 (IWL_MVM_DQA_P2P_DEVICE_QUEUE) then +* iwl_mvm_is_static_queue() erroneously returns true, and we +* might have things getting stuck. +*/ + mvm->aux_queue =IWL_MVM_INVALID_QUEUE ; + mvm->snif_queue =IWL_MVM_INVALID_QUEUE ; + mvm->probe_queue =IWL_MVM_INVALID_QUEUE ; + mvm->p2p_dev_queue =IWL_MVM_INVALID_QUEUE ; + }else { + mvm->aux_queue =IWL_MVM_DQA_AUX_QUEUE ; + mvm->snif_queue =IWL_MVM_DQA_INJECT_MONITOR_QUEUE ; + mvm->probe_queue =IWL_MVM_DQA_AP_PROBE_RESP_QUEUE ; + mvm->p2p_dev_queue =IWL_MVM_DQA_P2P_DEVICE_QUEUE ; + } mvm->sf_state =SF_UNINIT ;if (iwl_mvm_has_unified_ucode (mvm))
drivers/net/wireless/intel/iwlwifi/mvm/sta.c +18 -12
@@ -316,8 +316,9 @@ static int iwl_mvm_invalidate_sta_queue(struct iwl_mvm *mvm, int queue, }static int iwl_mvm_disable_txq (struct iwl_mvm *mvm,struct ieee80211_sta *sta, -int queue,u8 tid,u8 flags) +u16 *queueptr,u8 tid,u8 flags) { +int queue = *queueptr;struct iwl_scd_txq_cfg_cmd cmd = { .scd_queue = queue, .action =SCD_CFG_DISABLE_QUEUE ,
@@ -326,6 +327,7 @@ static int iwl_mvm_disable_txq(struct iwl_mvm *mvm, struct ieee80211_sta *sta,if (iwl_mvm_has_new_tx_api (mvm)) {iwl_trans_txq_free (mvm->trans, queue); + *queueptr =IWL_MVM_INVALID_QUEUE ;return 0 ; }
@@ -487,6 +489,7 @@ static int iwl_mvm_free_inactive_queue(struct iwl_mvm *mvm, int queue,u8 sta_id, tid;unsigned long disable_agg_tids =0 ;bool same_sta; +u16 queue_tmp = queue;int ret;lockdep_assert_held (&mvm->mutex);
@@ -509,7 +512,7 @@ static int iwl_mvm_free_inactive_queue(struct iwl_mvm *mvm, int queue,iwl_mvm_invalidate_sta_queue (mvm, queue, disable_agg_tids, false); - ret =iwl_mvm_disable_txq (mvm, old_sta, queue, tid,0 ); + ret =iwl_mvm_disable_txq (mvm, old_sta, &queue_tmp, tid,0 );if (ret) { IWL_ERR(mvm, "Failed to free inactive queue %d (ret=%d)\n",
@@ -1184,6 +1187,7 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm,unsigned int wdg_timeout =iwl_mvm_get_wd_timeout (mvm, mvmsta->vif, false, false);int queue =-1 ; +u16 queue_tmp;unsigned long disable_agg_tids =0 ;enum iwl_mvm_agg_state queue_state;bool shared_queue = false, inc_ssn;
@@ -1332,7 +1336,8 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm,return 0 ; out_err: -iwl_mvm_disable_txq (mvm, sta, queue, tid,0 ); + queue_tmp = queue; +iwl_mvm_disable_txq (mvm, sta, &queue_tmp, tid,0 );return ret; }
@@ -1779,7 +1784,7 @@ static void iwl_mvm_disable_sta_queues(struct iwl_mvm *mvm,if (mvm_sta->tid_data[i].txq_id ==IWL_MVM_INVALID_QUEUE )continue ; -iwl_mvm_disable_txq (mvm, sta, mvm_sta->tid_data[i].txq_id, i, +iwl_mvm_disable_txq (mvm, sta, &mvm_sta->tid_data[i].txq_id, i,0 ); mvm_sta->tid_data[i].txq_id =IWL_MVM_INVALID_QUEUE ; }
@@ -1987,7 +1992,7 @@ static int iwl_mvm_add_int_sta_with_queue(struct iwl_mvm *mvm, int macidx, ret =iwl_mvm_add_int_sta_common (mvm, sta, addr, macidx, maccolor);if (ret) {if (!iwl_mvm_has_new_tx_api (mvm)) -iwl_mvm_disable_txq (mvm,NULL , *queue, +iwl_mvm_disable_txq (mvm,NULL , queue,IWL_MAX_TID_COUNT ,0 );return ret; }
@@ -2060,7 +2065,7 @@ int iwl_mvm_rm_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)if (WARN_ON_ONCE (mvm->snif_sta.sta_id ==IWL_MVM_INVALID_STA ))return -EINVAL ; -iwl_mvm_disable_txq (mvm,NULL , mvm->snif_queue,IWL_MAX_TID_COUNT ,0 ); +iwl_mvm_disable_txq (mvm,NULL , &mvm->snif_queue,IWL_MAX_TID_COUNT ,0 ); ret =iwl_mvm_rm_sta_common (mvm, mvm->snif_sta.sta_id);if (ret)IWL_WARN (mvm,"Failed sending remove station\n" );
@@ -2077,7 +2082,7 @@ int iwl_mvm_rm_aux_sta(struct iwl_mvm *mvm)if (WARN_ON_ONCE (mvm->aux_sta.sta_id ==IWL_MVM_INVALID_STA ))return -EINVAL ; -iwl_mvm_disable_txq (mvm,NULL , mvm->aux_queue,IWL_MAX_TID_COUNT ,0 ); +iwl_mvm_disable_txq (mvm,NULL , &mvm->aux_queue,IWL_MAX_TID_COUNT ,0 ); ret =iwl_mvm_rm_sta_common (mvm, mvm->aux_sta.sta_id);if (ret)IWL_WARN (mvm,"Failed sending remove station\n" );
@@ -2173,7 +2178,7 @@ static void iwl_mvm_free_bcast_sta_queues(struct iwl_mvm *mvm, struct ieee80211_vif *vif) {struct iwl_mvm_vif *mvmvif =iwl_mvm_vif_from_mac80211 (vif); -int queue; +u16 *queueptr, queue;lockdep_assert_held (&mvm->mutex);
@@ -2182,10 +2187,10 @@ static void iwl_mvm_free_bcast_sta_queues(struct iwl_mvm *mvm,switch (vif->type) {case NL80211_IFTYPE_AP :case NL80211_IFTYPE_ADHOC : - queue = mvm->probe_queue; + queueptr = &mvm->probe_queue;break ;case NL80211_IFTYPE_P2P_DEVICE : - queue = mvm->p2p_dev_queue; + queueptr = &mvm->p2p_dev_queue;break ;default : WARN(1, "Can't free bcast queue on vif type %d\n",
@@ -2193,7 +2198,8 @@ static void iwl_mvm_free_bcast_sta_queues(struct iwl_mvm *mvm,return ; } -iwl_mvm_disable_txq (mvm,NULL , queue,IWL_MAX_TID_COUNT ,0 ); + queue = *queueptr; +iwl_mvm_disable_txq (mvm,NULL , queueptr,IWL_MAX_TID_COUNT ,0 );if (iwl_mvm_has_new_tx_api (mvm))return ;
@@ -2428,7 +2434,7 @@ int iwl_mvm_rm_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)iwl_mvm_flush_sta (mvm, &mvmvif->mcast_sta, true); -iwl_mvm_disable_txq (mvm,NULL , mvmvif->cab_queue,0 ,0 ); +iwl_mvm_disable_txq (mvm,NULL , &mvmvif->cab_queue,0 ,0 ); ret =iwl_mvm_rm_sta_common (mvm, mvmvif->mcast_sta.sta_id);if (ret)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 205/219 iwlwifi: mvm: Fix umac scan request probe parameters
In reply to Sasha LevinFrom: Ilan Peer <[email protected]>
[ Upstream commit 35fc5feca7b24b97e828e6e6a4243b4b9b0131f8 ]
Both 'iwl_scan_probe_params_v3' and 'iwl_scan_probe_params_v4' wrongly addressed the 'bssid_array' field which should supposed to be any array of BSSIDs each of size ETH_ALEN and not the opposite. Fix it.
--- drivers/net/wireless/intel/iwlwifi/fw/api/scan.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/api/scan.h +3 -3
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* -* Copyright (C) 2012-2014, 2018-2020 Intel Corporation +* Copyright (C) 2012-2014, 2018-2021 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2016-2017 Intel Deutschland GmbH */
@@ -874,7 +874,7 @@ struct iwl_scan_probe_params_v3 {u8 reserved;struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX ];__le32 short_ssid[SCAN_SHORT_SSID_MAX_SIZE ]; -u8 bssid_array[ETH_ALEN ][SCAN_BSSID_MAX_SIZE ]; +u8 bssid_array[SCAN_BSSID_MAX_SIZE ][ETH_ALEN ]; } __packed;/* SCAN_PROBE_PARAMS_API_S_VER_3 */ /**
@@ -894,7 +894,7 @@ struct iwl_scan_probe_params_v4 {__le16 reserved;struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX ];__le32 short_ssid[SCAN_SHORT_SSID_MAX_SIZE ]; -u8 bssid_array[ETH_ALEN ][SCAN_BSSID_MAX_SIZE ]; +u8 bssid_array[SCAN_BSSID_MAX_SIZE ][ETH_ALEN ]; } __packed;/* SCAN_PROBE_PARAMS_API_S_VER_4 */ #define SCAN_MAX_NUM_CHANS_V3 67
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 206/219 iwlwifi: mvm: fix access to BSS elements
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 6c608cd6962ebdf84fd3de6d42f88ed64d2f4e1b ]
BSS elements are protected using RCU, so we need to use RCU properly to access them, fix that.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +6 -2
@@ -2987,16 +2987,20 @@ static void iwl_mvm_check_he_obss_narrow_bw_ru_iter(struct wiphy *wiphy, void *_data) {struct iwl_mvm_he_obss_narrow_bw_ru_data *data = _data; +const struct cfg80211_bss_ies *ies;const struct element *elem; - elem =cfg80211_find_elem (WLAN_EID_EXT_CAPABILITY , bss->ies->data, - bss->ies->len); +rcu_read_lock (); + ies =rcu_dereference (bss->ies); + elem =cfg80211_find_elem (WLAN_EID_EXT_CAPABILITY , ies->data, + ies->len);if (!elem || elem->datalen <10 || !(elem->data[10 ] &WLAN_EXT_CAPA10_OBSS_NARROW_BW_RU_TOLERANCE_SUPPORT )) { data->tolerated = false; } +rcu_read_unlock (); } static void iwl_mvm_check_he_obss_narrow_bw_ru(struct ieee80211_hw *hw,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 207/219 iwlwifi: fw: correctly limit to monitor dump
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit e6344c060209ef4e970cac18adeac1676a2a73cd ]
In commit 79f033f6f229 ("iwlwifi: dbg: don't limit dump decisions to all or monitor") we changed the code to pass around a bitmap, but in the monitor_only case, one place accidentally used the bit number, not the bit mask, resulting in CSR and FW_INFO getting dumped instead of monitor data. Fix that.
--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +1 -1
@@ -2314,7 +2314,7 @@ static void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt,return ;if (dump_data->monitor_only) - dump_mask &=IWL_FW_ERROR_DUMP_FW_MONITOR ; + dump_mask &=BIT (IWL_FW_ERROR_DUMP_FW_MONITOR ); fw_error_dump.trans_ptr =iwl_trans_dump_data (fwrt->trans, dump_mask); file_len =le32_to_cpu (dump_file->file_len);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 208/219 iwlwifi: mvm: Fix scan channel flags settings
In reply to Sasha LevinFrom: Ilan Peer <[email protected]>
[ Upstream commit 090f1be3abf3069ef856b29761f181808bf55917 ]
The iwl_mvm_scan_ch_n_aps_flag() is called with a variable before the value of the variable is set. Fix it.
--- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/scan.c +1 -1
@@ -1648,7 +1648,7 @@ iwl_mvm_umac_scan_cfg_channels_v6(struct iwl_mvm *mvm,struct iwl_scan_channel_cfg_umac *cfg = &cp->channel_config[i];u32 n_aps_flag =iwl_mvm_scan_ch_n_aps_flag (vif_type, - cfg->v2.channel_num); + channels[i]->hw_value); cfg->flags =cpu_to_le32 (flags | n_aps_flag); cfg->v2.channel_num = channels[i]->hw_value;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 209/219 net/mlx5: DR, fix a potential use-after-free bug
In reply to Sasha LevinFrom: Wentao_Liang <[email protected]>
[ Upstream commit 6cc64770fb386b10a64a1fe09328396de7bb5262 ]
In line 849 (#1), "mlx5dr_htbl_put(cur_htbl);" drops the reference to cur_htbl and may cause cur_htbl to be freed.
However, cur_htbl is subsequently used in the next line, which may result in an use-after-free bug.
Fix this by calling mlx5dr_err() before the cur_htbl is put.
--- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c +1 -1
@@ -846,9 +846,9 @@ dr_rule_handle_ste_branch(struct mlx5dr_rule *rule, new_htbl =dr_rule_rehash (rule, nic_rule, cur_htbl, ste_location, send_ste_list);if (!new_htbl) { -mlx5dr_htbl_put (cur_htbl);mlx5dr_err (dmn,"Failed creating rehash table, htbl-log_size: %d\n" , cur_htbl->chunk_size); +mlx5dr_htbl_put (cur_htbl); }else { cur_htbl = new_htbl; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 210/219 net/mlx5: DR, Enable QP retransmission
In reply to Sasha LevinFrom: Yevgeny Kliteynik <[email protected]>
[ Upstream commit ec449ed8230cd30769de3cb70ee0fce293047372 ]
Under high stress, SW steering might get stuck on polling for completion that never comes.
For such cases QP needs to have protocol retransmission mechanism enabled. Currently the retransmission timeout is defined as 0 (unlimited). Fix this by defining a real timeout.
--- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c +1 -0
@@ -620,6 +620,7 @@ static int dr_cmd_modify_qp_rtr2rts(struct mlx5_core_dev *mdev,MLX5_SET (qpc, qpc, retry_count, attr->retry_cnt);MLX5_SET (qpc, qpc, rnr_retry, attr->rnr_retry); +MLX5_SET (qpc, qpc, primary_address_path.ack_timeout,0x8 );/* ~1ms */ MLX5_SET (rtr2rts_qp_in, in, opcode,MLX5_CMD_OP_RTR2RTS_QP );MLX5_SET (rtr2rts_qp_in, in, qpn, dr_qp->qpn);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 211/219 parport: remove non-zero check on count
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit 0be883a0d795d9146f5325de582584147dd0dcdc ]
The check for count appears to be incorrect since a non-zero count check occurs a couple of statements earlier. Currently the check is always false and the dev->port->irq != PARPORT_IRQ_NONE part of the check is never tested and the if statement is dead-code. Fix this by removing the check on count.
Note that this code is pre-git history, so I can't find a sha for it.
Addresses-Coverity: ("Logically dead code")
--- drivers/parport/ieee1284_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/parport/ieee1284_ops.c +1 -1
@@ -518,7 +518,7 @@ size_t parport_ieee1284_ecp_read_data (struct parport *port, goto out;/* Yield the port for a while. */ -if (count && dev->port->irq !=PARPORT_IRQ_NONE ) { +if (dev->port->irq !=PARPORT_IRQ_NONE ) {parport_release (dev);schedule_timeout_interruptible (msecs_to_jiffies (40 ));parport_claim_or_block (dev);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 212/219 selftests/bpf: Fix potential unreleased lock
In reply to Sasha LevinFrom: Chengfeng Ye <[email protected]>
[ Upstream commit 47bb27a20d6ea22cd092c1fc2bb4fcecac374838 ]
This lock is not released if the program
return at the patched branch.
--- tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c +3 -1
@@ -195,8 +195,10 @@ static void run_test(int cgroup_fd)pthread_mutex_lock (&server_started_mtx);if (CHECK_FAIL (pthread_create (&tid,NULL , server_thread, - (void *)&server_fd))) + (void *)&server_fd))) { +pthread_mutex_unlock (&server_started_mtx); goto close_server_fd; + }pthread_cond_wait (&server_started, &server_started_mtx);pthread_mutex_unlock (&server_started_mtx);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 213/219 wcn36xx: Fix missing frame timestamp for beacon/probe-resp
In reply to Sasha LevinFrom: Loic Poulain <[email protected]>
[ Upstream commit 8678fd31f2d3eb14f2b8b39c9bc266f16fa24b22 ]
When receiving a beacon or probe response, we should update the boottime_ns field which is the timestamp the frame was received at. (cf mac80211.h)
This fixes a scanning issue with Android since it relies on this timestamp to determine when the AP has been seen for the last time (via the nl80211 BSS_LAST_SEEN_BOOTTIME parameter).
--- drivers/net/wireless/ath/wcn36xx/txrx.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/wcn36xx/txrx.c +4 -0
@@ -287,6 +287,10 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb) status.rate_idx =0 ; } +if (ieee80211_is_beacon (hdr->frame_control) || +ieee80211_is_probe_resp (hdr->frame_control)) + status.boottime_ns =ktime_get_boottime_ns (); +memcpy (IEEE80211_SKB_RXCB (skb), &status,sizeof (status));if (ieee80211_is_beacon (hdr->frame_control)) {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 214/219 ath9k: fix OOB read ar9300_eeprom_restore_internal
In reply to Sasha LevinFrom: Zekun Shen <[email protected]>
[ Upstream commit 23151b9ae79e3bc4f6a0c4cd3a7f355f68dad128 ]
Bad header can have large length field which can cause OOB. cptr is the last bytes for read, and the eeprom is parsed from high to low address. The OOB, triggered by the condition length > cptr could cause memory error with a read on negative index.
There are some sanity check around length, but it is not compared with cptr (the remaining bytes). Here, the corrupted/bad EEPROM can cause panic.
I was able to reproduce the crash, but I cannot find the log and the reproducer now. After I applied the patch, the bug is no longer reproducible.
--- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +2 -1
@@ -3351,7 +3351,8 @@ static int ar9300_eeprom_restore_internal(struct ath_hw *ah,"Found block at %x: code=%d ref=%d length=%d major=%d minor=%d\n" , cptr, code, reference, length, major, minor);if ((!AR_SREV_9485 (ah) && length >=1024 ) || - (AR_SREV_9485 (ah) && length >EEPROM_DATA_LEN_9485 )) { + (AR_SREV_9485 (ah) && length >EEPROM_DATA_LEN_9485 ) || + (length > cptr)) {ath_dbg (common,EEPROM ,"Skipping bad header\n" ); cptr -=COMP_HDR_LEN ;continue ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 215/219 ath9k: fix sleeping in atomic context
In reply to Sasha LevinFrom: Miaoqing Pan <[email protected]>
[ Upstream commit 7c48662b9d56666219f526a71ace8c15e6e12f1f ]
The problem is that gpio_free() can sleep and the cfg_soc() can be called with spinlocks held. One problematic call tree is:
--> ath_reset_internal() takes &sc->sc_pcu_lock spin lock
--> ath9k_hw_reset()
--> ath9k_hw_gpio_request_in()
--> ath9k_hw_gpio_request()
--> ath9k_hw_gpio_cfg_soc()Remove gpio_free(), use error message instead, so we should make sure there is no GPIO conflict.
Also remove ath9k_hw_gpio_free() from ath9k_hw_apply_gpio_override(), as gpio_mask will never be set for SOC chips.
--- drivers/net/wireless/ath/ath9k/hw.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath9k/hw.c +7 -5
@@ -1621,7 +1621,6 @@ static void ath9k_hw_apply_gpio_override(struct ath_hw *ah)ath9k_hw_gpio_request_out (ah, i,NULL ,AR_GPIO_OUTPUT_MUX_AS_OUTPUT );ath9k_hw_set_gpio (ah, i, !!(ah->gpio_val &BIT (i))); -ath9k_hw_gpio_free (ah, i); } }
@@ -2728,14 +2727,17 @@ static void ath9k_hw_gpio_cfg_output_mux(struct ath_hw *ah, u32 gpio, u32 type)static void ath9k_hw_gpio_cfg_soc (struct ath_hw *ah,u32 gpio,bool out,const char *label) { +int err; +if (ah->caps.gpio_requested &BIT (gpio))return ; -/* may be requested by BSP, free anyway */ -gpio_free (gpio); - -if (gpio_request_one (gpio, out ?GPIOF_OUT_INIT_LOW :GPIOF_IN , label)) + err =gpio_request_one (gpio, out ?GPIOF_OUT_INIT_LOW :GPIOF_IN , label); +if (err) { +ath_err (ath9k_hw_common (ah),"request GPIO%d failed:%d\n" , + gpio, err);return ; + } ah->caps.gpio_requested |=BIT (gpio); }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 216/219 net: fix NULL pointer reference in cipso_v4_doi_free
In reply to Sasha LevinFrom: 王贇 <[email protected]>
[ Upstream commit 733c99ee8be9a1410287cdbb943887365e83b2d6 ]
In netlbl_cipsov4_add_std() when 'doi_def->map.std' alloc failed, we sometime observe panic:
BUG: kernel NULL pointer dereference, address: ... RIP: 0010:cipso_v4_doi_free+0x3a/0x80 ... Call Trace: netlbl_cipsov4_add_std+0xf4/0x8c0 netlbl_cipsov4_add+0x13f/0x1b0 genl_family_rcv_msg_doit.isra.15+0x132/0x170 genl_rcv_msg+0x125/0x240
This is because in cipso_v4_doi_free() there is no check on 'doi_def->map.std' when 'doi_def->type' equal 1, which is possibe, since netlbl_cipsov4_add_std() haven't initialize it before alloc 'doi_def->map.std'.
This patch just add the check to prevent panic happen for similar cases.
--- net/netlabel/netlabel_cipso_v4.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netlabel/netlabel_cipso_v4.c +2 -2
@@ -144,8 +144,8 @@ static int netlbl_cipsov4_add_std(struct genl_info *info,return -ENOMEM ; doi_def->map.std =kzalloc (sizeof (*doi_def->map.std),GFP_KERNEL );if (doi_def->map.std ==NULL ) { - ret_val = -ENOMEM ; - goto add_std_failure; +kfree (doi_def); +return -ENOMEM ; } doi_def->type =CIPSO_V4_MAP_TRANS ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 217/219 fix array-index-out-of-bounds in taprio_change
In reply to Sasha LevinFrom: Haimin Zhang <[email protected]>
[ Upstream commit efe487fce3061d94222c6501d7be3aa549b3dc78 ]
syzbot report an array-index-out-of-bounds in taprio_change index 16 is out of range for type '__u16 [16]'
that's because mqprio->num_tc is lager than TC_MAX_QUEUE,so we check the return value of netdev_set_num_tc.
--- net/sched/sch_taprio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/sched/sch_taprio.c +3 -1
@@ -1547,7 +1547,9 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,taprio_set_picos_per_byte (dev, q);if (mqprio) { -netdev_set_num_tc (dev, mqprio->num_tc); + err =netdev_set_num_tc (dev, mqprio->num_tc); +if (err) + goto free_sched;for (i =0 ; i < mqprio->num_tc; i++) netdev_set_tc_queue(dev, i, mqprio->count[i],
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 218/219 net: w5100: check return value after calling platform_get_resource()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit a39ff4a47f3e1da3b036817ef436b1a9be10783a ]
It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value.
--- drivers/net/ethernet/wiznet/w5100.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/wiznet/w5100.c +2 -0
@@ -1052,6 +1052,8 @@ static int w5100_mmio_probe(struct platform_device *pdev) mac_addr = data->mac_addr; mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!mem) +return -EINVAL ;if (resource_size (mem) <W5100_BUS_DIRECT_SIZE ) ops = &w5100_mmio_indirect_ops;else
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 219/219 net: hns3: clean up a type mismatch warning
In reply to Sasha LevinFrom: Guojia Liao <[email protected]>
[ Upstream commit e79c0e324b011b0288cd411a5b53870a7730f163 ]
abs() returns signed long, which could not convert the type as unsigned, and it may cause a mismatch type warning from static tools. To fix it, this patch uses an variable to save the abs()'s result and does a explicit conversion.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +8 -1
@@ -10,7 +10,14 @@static u16 hclge_errno_to_resp (int errno) { -return abs (errno); +int resp =abs (errno); + +/* The status for pf to vf msg cmd is u16, constrainted by HW. +* We need to keep the same type with it. +* The intput errno is the stander error code, it's safely to +* use a u16 to store the abs(errno). +*/ +return (u16 )resp; }/* hclge_gen_resp_to_vf: used to generate a synchronous response to VF when PF
Signature · 1 line
2.30.2