netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Mordechay Goodstein <mordechay.goodstein@intel.com>,
	Luca Coelho <luciano.coelho@intel.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 5.4 112/175] iwlwifi: avoid debug max amsdu config overwriting itself
Date: Mon,  8 Jun 2020 19:17:45 -0400	[thread overview]
Message-ID: <20200608231848.3366970-112-sashal@kernel.org> (raw)
In-Reply-To: <20200608231848.3366970-1-sashal@kernel.org>

From: Mordechay Goodstein <mordechay.goodstein@intel.com>

[ Upstream commit a65a5824298b06049dbaceb8a9bd19709dc9507c ]

If we set amsdu_len one after another the second one overwrites
the orig_amsdu_len so allow only moving from debug to non debug state.

Also the TLC update check was wrong: it was checking that also the orig
is smaller then the new updated size, which is not the case in debug
amsdu mode.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Fixes: af2984e9e625 ("iwlwifi: mvm: add a debugfs entry to set a fixed size AMSDU for all TX packets")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200424182644.e565446a4fce.I9729d8c520d8b8bb4de9a5cdc62e01eb85168aac@changeid
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 11 +++++++----
 drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c   | 15 ++++++++-------
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
index ad18c2f1a806..524f9dd2323d 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
@@ -5,10 +5,9 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
- * Copyright(c) 2018 - 2019 Intel Corporation
+ * Copyright(c) 2012 - 2014, 2018 - 2020 Intel Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -28,10 +27,9 @@
  *
  * BSD LICENSE
  *
- * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
- * Copyright(c) 2018 - 2019 Intel Corporation
+ * Copyright(c) 2012 - 2014, 2018 - 2020 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -478,6 +476,11 @@ static ssize_t iwl_dbgfs_amsdu_len_write(struct ieee80211_sta *sta,
 	if (kstrtou16(buf, 0, &amsdu_len))
 		return -EINVAL;
 
+	/* only change from debug set <-> debug unset */
+	if ((amsdu_len && mvmsta->orig_amsdu_len) ||
+	    (!!amsdu_len && mvmsta->orig_amsdu_len))
+		return -EBUSY;
+
 	if (amsdu_len) {
 		mvmsta->orig_amsdu_len = sta->max_amsdu_len;
 		sta->max_amsdu_len = amsdu_len;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
index 5b2bd603febf..be8bc0601d7b 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
@@ -367,14 +367,15 @@ void iwl_mvm_tlc_update_notif(struct iwl_mvm *mvm,
 		u16 size = le32_to_cpu(notif->amsdu_size);
 		int i;
 
-		/*
-		 * In debug sta->max_amsdu_len < size
-		 * so also check with orig_amsdu_len which holds the original
-		 * data before debugfs changed the value
-		 */
-		if (WARN_ON(sta->max_amsdu_len < size &&
-			    mvmsta->orig_amsdu_len < size))
+		if (sta->max_amsdu_len < size) {
+			/*
+			 * In debug sta->max_amsdu_len < size
+			 * so also check with orig_amsdu_len which holds the
+			 * original data before debugfs changed the value
+			 */
+			WARN_ON(mvmsta->orig_amsdu_len < size);
 			goto out;
+		}
 
 		mvmsta->amsdu_enabled = le32_to_cpu(notif->amsdu_enabled);
 		mvmsta->max_amsdu_len = size;
-- 
2.25.1


  parent reply	other threads:[~2020-06-08 23:21 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200608231848.3366970-1-sashal@kernel.org>
2020-06-08 23:15 ` [PATCH AUTOSEL 5.4 002/175] ath10k: Fix the race condition in firmware dump work queue Sasha Levin
2020-06-08 23:15 ` [PATCH AUTOSEL 5.4 003/175] ath9x: Fix stack-out-of-bounds Write in ath9k_hif_usb_rx_cb Sasha Levin
2020-06-08 23:15 ` [PATCH AUTOSEL 5.4 004/175] ath9k: Fix use-after-free Write in ath9k_htc_rx_msg Sasha Levin
2020-06-08 23:15 ` [PATCH AUTOSEL 5.4 005/175] ath9k: Fix use-after-free Read in htc_connect_service Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 016/175] libbpf: Fix memory leak and possible double-free in hashmap__clear Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 020/175] net: atlantic: make hw_get_regs optional Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 021/175] net: ena: fix error returning in ena_com_get_hash_function() Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 023/175] ath10k: remove the max_sched_scan_reqs value Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 026/175] rtw88: fix an issue about leak system resources Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 035/175] ixgbe: Fix XDP redirect on archs with PAGE_SIZE above 4K Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 038/175] Bluetooth: Add SCO fallback for invalid LMP parameters error Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 051/175] batman-adv: Revert "disable ethtool link speed detection when auto negotiation off" Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 052/175] ice: Fix memory leak Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 053/175] ice: Fix for memory leaks and modify ICE_FREE_CQ_BUFS Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 058/175] net: vmxnet3: fix possible buffer overflow caused by bad DMA value in vmxnet3_get_rss() Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 059/175] tun: correct header offsets in napi frags mode Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 062/175] ath10k: fix kernel null pointer dereference Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 063/175] ath9k: Fix use-after-free Read in ath9k_wmi_ctrl_rx Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 064/175] ath9k: Fix general protection fault in ath9k_hif_usb_rx_cb Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 067/175] brcmfmac: fix wrong location to get firmware feature Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 070/175] e1000: Distribute switch variables for initialization Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 077/175] ath10k: add flush tx packets for SDIO chip Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 081/175] dpaa2-eth: fix return codes used in ndo_setup_tc Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 082/175] netfilter: nft_nat: return EOPNOTSUPP if type or flags are not supported Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 083/175] selftests/bpf: Fix memory leak in extract_build_id() Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 084/175] net: bcmgenet: set Rx mode before starting netif Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 085/175] net: bcmgenet: Fix WoL with password after deep sleep Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 092/175] net: lpc-enet: fix error return code in lpc_mii_init() Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 094/175] drivers: net: davinci_mdio: fix potential NULL dereference in davinci_mdio_probe() Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 096/175] net: allwinner: Fix use correct return type for ndo_start_xmit() Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 098/175] ath9k_htc: Silence undersized packet warnings Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 099/175] libertas_tf: avoid a null dereference in pointer priv Sasha Levin
2020-06-08 23:17 ` Sasha Levin [this message]
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 116/175] ath10k: Remove msdu from idr when management pkt send fails Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 117/175] wcn36xx: Fix error handling path in 'wcn36xx_probe()' Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 118/175] net: qed*: Reduce RX and TX default ring count when running inside kdump kernel Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 120/175] mt76: avoid rx reorder buffer overflow Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 123/175] net: dsa: mt7530: set CPU port to fallback mode Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 126/175] veth: Adjust hard_start offset on redirect XDP frames Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 127/175] net/mlx5e: IPoIB, Drop multicast packets that this interface sent Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 128/175] rtlwifi: Fix a double free in _rtl_usb_tx_urb_setup() Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 129/175] mwifiex: Fix memory corruption in dump_station Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 140/175] selftests/bpf: CONFIG_IPV6_SEG6_BPF required for test_seg6_loop.o Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 146/175] net: ethernet: fec: move GPR register offset and bit into DT Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 147/175] macvlan: Skip loopback packets in RX handler Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 157/175] ice: fix potential double free in probe unrolling Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 158/175] ixgbe: fix signed-integer-overflow warning Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 159/175] iwlwifi: mvm: fix aux station leak Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 167/175] vxlan: Avoid infinite loop when suppressing NS messages with invalid options Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 168/175] libbpf: Fix perf_buffer__free() API for sparse allocs Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 169/175] bpf: Fix map permissions check Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 170/175] bpf: Refactor sockmap redirect code so its easy to reuse Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 171/175] bpf: Fix running sk_skb program types with ktls Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 172/175] selftests/bpf, flow_dissector: Close TAP device FD after the test Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 173/175] net_failover: fixed rollback in net_failover_open() Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200608231848.3366970-112-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luciano.coelho@intel.com \
    --cc=mordechay.goodstein@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).