From 3bf4e9683dc033dee7820b82fde9c810e9b8580f Mon Sep 17 00:00:00 2001 From: Kmods SIG Date: Jan 13 2022 23:40:34 +0000 Subject: Switch to EL kernel source and versioning --- diff --git a/.gitignore b/.gitignore index cb82a4f..bb7b30a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/iwlegacy-5.12.tar.xz +SOURCES/iwlegacy-4.18.0-348.el8.tar.xz diff --git a/.kmod-iwlegacy.metadata b/.kmod-iwlegacy.metadata index 92af24f..56a27d1 100644 --- a/.kmod-iwlegacy.metadata +++ b/.kmod-iwlegacy.metadata @@ -1 +1 @@ -25667d08fe5a73a6eca0d34a7df9efdb7188ee69 SOURCES/iwlegacy-5.12.tar.xz +aac070afc8a5f20f4fbad8ac270f78ad0c3f8175 SOURCES/iwlegacy-4.18.0-348.el8.tar.xz diff --git a/SOURCES/0001-iwlegacy-Add-a-lock-assertion-in-il4965_send_rxon_as.patch b/SOURCES/0001-iwlegacy-Add-a-lock-assertion-in-il4965_send_rxon_as.patch new file mode 100644 index 0000000..1570d77 --- /dev/null +++ b/SOURCES/0001-iwlegacy-Add-a-lock-assertion-in-il4965_send_rxon_as.patch @@ -0,0 +1,34 @@ +From 52a312673aff9baac0d677e0aee068d65dc30467 Mon Sep 17 00:00:00 2001 +From: Jia-Ju Bai +Date: Fri, 5 Oct 2018 21:55:46 +0800 +Subject: [Backport 52a312673aff] iwlegacy: Add a lock assertion in + il4965_send_rxon_assoc() + +The variables il->staging.filter_flags, rxon1->filter_flags and +rxon2->filter_flags need to be protected by the mutex lock il->mutex. +This patch adds a lock assertion of il->mutex to check whether +this lock is held. + +Signed-off-by: Jia-Ju Bai +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + src/4965.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/4965.c b/src/4965.c +index c3c638ed0ed72e8c2f6c95929afc445f5c361d84..ce4144a892173a14e24bd8cd9e660732e96a8e60 100644 +--- a/src/4965.c ++++ b/src/4965.c +@@ -1297,6 +1297,8 @@ il4965_send_rxon_assoc(struct il_priv *il) + const struct il_rxon_cmd *rxon1 = &il->staging; + const struct il_rxon_cmd *rxon2 = &il->active; + ++ lockdep_assert_held(&il->mutex); ++ + if (rxon1->flags == rxon2->flags && + rxon1->filter_flags == rxon2->filter_flags && + rxon1->cck_basic_rates == rxon2->cck_basic_rates && +-- +2.31.1 + diff --git a/SOURCES/0002-iwlegacy-3945-no-need-to-check-return-value-of-debug.patch b/SOURCES/0002-iwlegacy-3945-no-need-to-check-return-value-of-debug.patch new file mode 100644 index 0000000..f9e80f1 --- /dev/null +++ b/SOURCES/0002-iwlegacy-3945-no-need-to-check-return-value-of-debug.patch @@ -0,0 +1,78 @@ +From f503c769534353e7eba5b5ff6b1b6cbce39efc2b Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Wed, 12 Jun 2019 16:26:54 +0200 +Subject: [Backport f503c7695343] iwlegacy: 3945: no need to check return value + of debugfs_create functions + +When calling debugfs functions, there is no need to ever check the +return value. This driver was saving the debugfs file away to be +removed at a later time. However, the 80211 core would delete the whole +directory that the debugfs files are created in, after it asks the +driver to do the deletion, so just rely on the 80211 core to do all of +the cleanup for us, making us not need to keep a pointer to the dentries +around at all. + +This cleans up the structure of the driver data a bit and makes the code +a tiny bit smaller. + +Cc: Stanislaw Gruszka +Cc: Kalle Valo +Cc: "David S. Miller" +Cc: linux-wireless@vger.kernel.org +Cc: netdev@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Kalle Valo +--- + src/3945-rs.c | 14 ++------------ + src/3945.h | 3 --- + 2 files changed, 2 insertions(+), 15 deletions(-) + +diff --git a/src/3945-rs.c b/src/3945-rs.c +index a697edd46e7fcb41c6c52de33609e1247255aedb..1d810cae6091db9609e48604df55c7f0a59fb67a 100644 +--- a/src/3945-rs.c ++++ b/src/3945-rs.c +@@ -861,17 +861,8 @@ il3945_add_debugfs(void *il, void *il_sta, struct dentry *dir) + { + struct il3945_rs_sta *lq_sta = il_sta; + +- lq_sta->rs_sta_dbgfs_stats_table_file = +- debugfs_create_file("rate_stats_table", 0600, dir, lq_sta, +- &rs_sta_dbgfs_stats_table_ops); +- +-} +- +-static void +-il3945_remove_debugfs(void *il, void *il_sta) +-{ +- struct il3945_rs_sta *lq_sta = il_sta; +- debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); ++ debugfs_create_file("rate_stats_table", 0600, dir, lq_sta, ++ &rs_sta_dbgfs_stats_table_ops); + } + #endif + +@@ -898,7 +889,6 @@ static const struct rate_control_ops rs_ops = { + .free_sta = il3945_rs_free_sta, + #ifdef CONFIG_MAC80211_DEBUGFS + .add_sta_debugfs = il3945_add_debugfs, +- .remove_sta_debugfs = il3945_remove_debugfs, + #endif + + }; +diff --git a/src/3945.h b/src/3945.h +index 00030d43a1947380cf818bae7ff11a31b26d92a8..1aeb4b238fcf3f4b91b147e40431fd3b0dba3a5d 100644 +--- a/src/3945.h ++++ b/src/3945.h +@@ -87,9 +87,6 @@ struct il3945_rs_sta { + u8 start_rate; + struct timer_list rate_scale_flush; + struct il3945_rate_scale_data win[RATE_COUNT_3945]; +-#ifdef CONFIG_MAC80211_DEBUGFS +- struct dentry *rs_sta_dbgfs_stats_table_file; +-#endif + + /* used to be in sta_info */ + int last_txrate_idx; +-- +2.31.1 + diff --git a/SOURCES/0003-iwlegacy-4965-no-need-to-check-return-value-of-debug.patch b/SOURCES/0003-iwlegacy-4965-no-need-to-check-return-value-of-debug.patch new file mode 100644 index 0000000..7ebf2f1 --- /dev/null +++ b/SOURCES/0003-iwlegacy-4965-no-need-to-check-return-value-of-debug.patch @@ -0,0 +1,97 @@ +From ffb92649f4d93a83de8977f8806cda64204cc465 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Wed, 12 Jun 2019 16:26:55 +0200 +Subject: [Backport ffb92649f4d9] iwlegacy: 4965: no need to check return value + of debugfs_create functions + +When calling debugfs functions, there is no need to ever check the +return value. This driver was saving the debugfs file away to be +removed at a later time. However, the 80211 core would delete the whole +directory that the debugfs files are created in, after it asks the +driver to do the deletion, so just rely on the 80211 core to do all of +the cleanup for us, making us not need to keep a pointer to the dentries +around at all. + +This cleans up the structure of the driver data a bit and makes the code +a tiny bit smaller. + +Cc: Stanislaw Gruszka +Cc: Kalle Valo +Cc: "David S. Miller" +Cc: linux-wireless@vger.kernel.org +Cc: netdev@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Kalle Valo +--- + src/4965-rs.c | 31 +++++-------------- + src/common.h | 4 --- + 2 files changed, 8 insertions(+), 27 deletions(-) + +diff --git a/src/4965-rs.c b/src/4965-rs.c +index 54ff83829afb11dcc8c56871bac3d1543e3fa33b..f640709d986233f25a852cbe32f28c8f6abcbe3c 100644 +--- a/src/4965-rs.c ++++ b/src/4965-rs.c +@@ -2767,29 +2767,15 @@ static void + il4965_rs_add_debugfs(void *il, void *il_sta, struct dentry *dir) + { + struct il_lq_sta *lq_sta = il_sta; +- lq_sta->rs_sta_dbgfs_scale_table_file = +- debugfs_create_file("rate_scale_table", 0600, dir, +- lq_sta, &rs_sta_dbgfs_scale_table_ops); +- lq_sta->rs_sta_dbgfs_stats_table_file = +- debugfs_create_file("rate_stats_table", 0400, dir, lq_sta, +- &rs_sta_dbgfs_stats_table_ops); +- lq_sta->rs_sta_dbgfs_rate_scale_data_file = +- debugfs_create_file("rate_scale_data", 0400, dir, lq_sta, +- &rs_sta_dbgfs_rate_scale_data_ops); +- lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file = +- debugfs_create_u8("tx_agg_tid_enable", 0600, dir, +- &lq_sta->tx_agg_tid_en); + +-} +- +-static void +-il4965_rs_remove_debugfs(void *il, void *il_sta) +-{ +- struct il_lq_sta *lq_sta = il_sta; +- debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file); +- debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); +- debugfs_remove(lq_sta->rs_sta_dbgfs_rate_scale_data_file); +- debugfs_remove(lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file); ++ debugfs_create_file("rate_scale_table", 0600, dir, lq_sta, ++ &rs_sta_dbgfs_scale_table_ops); ++ debugfs_create_file("rate_stats_table", 0400, dir, lq_sta, ++ &rs_sta_dbgfs_stats_table_ops); ++ debugfs_create_file("rate_scale_data", 0400, dir, lq_sta, ++ &rs_sta_dbgfs_rate_scale_data_ops); ++ debugfs_create_u8("tx_agg_tid_enable", 0600, dir, ++ &lq_sta->tx_agg_tid_en); + } + #endif + +@@ -2816,7 +2802,6 @@ static const struct rate_control_ops rs_4965_ops = { + .free_sta = il4965_rs_free_sta, + #ifdef CONFIG_MAC80211_DEBUGFS + .add_sta_debugfs = il4965_rs_add_debugfs, +- .remove_sta_debugfs = il4965_rs_remove_debugfs, + #endif + }; + +diff --git a/src/common.h b/src/common.h +index 986646af8dfd4da3e0da8c7bb023fe646ccc9930..3c6f41763dde17a24677e77e9808aeff21c350c3 100644 +--- a/src/common.h ++++ b/src/common.h +@@ -2822,10 +2822,6 @@ struct il_lq_sta { + struct il_traffic_load load[TID_MAX_LOAD_COUNT]; + u8 tx_agg_tid_en; + #ifdef CONFIG_MAC80211_DEBUGFS +- struct dentry *rs_sta_dbgfs_scale_table_file; +- struct dentry *rs_sta_dbgfs_stats_table_file; +- struct dentry *rs_sta_dbgfs_rate_scale_data_file; +- struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file; + u32 dbg_fixed_rate; + #endif + struct il_priv *drv; +-- +2.31.1 + diff --git a/SOURCES/0004-iwlegacy-ensure-loop-counter-addr-does-not-wrap-and-.patch b/SOURCES/0004-iwlegacy-ensure-loop-counter-addr-does-not-wrap-and-.patch new file mode 100644 index 0000000..97320f2 --- /dev/null +++ b/SOURCES/0004-iwlegacy-ensure-loop-counter-addr-does-not-wrap-and-.patch @@ -0,0 +1,37 @@ +From c2f9a4e4a5abfc84c01b738496b3fd2d471e0b18 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Sun, 26 Jan 2020 00:09:54 +0000 +Subject: [Backport c2f9a4e4a5ab] iwlegacy: ensure loop counter addr does not + wrap and cause an infinite loop + +The loop counter addr is a u16 where as the upper limit of the loop +is an int. In the unlikely event that the il->cfg->eeprom_size is +greater than 64K then we end up with an infinite loop since addr will +wrap around an never reach upper loop limit. Fix this by making addr +an int. + +Addresses-Coverity: ("Infinite loop") +Fixes: be663ab67077 ("iwlwifi: split the drivers for agn and legacy devices 3945/4965") +Signed-off-by: Colin Ian King +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + src/common.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/common.c b/src/common.c +index d966b29b45ee7716499edae1ff171cd77176604b..348c17ce72f5cd57b66fb5ae161b2381b3585bf3 100644 +--- a/src/common.c ++++ b/src/common.c +@@ -699,7 +699,7 @@ il_eeprom_init(struct il_priv *il) + u32 gp = _il_rd(il, CSR_EEPROM_GP); + int sz; + int ret; +- u16 addr; ++ int addr; + + /* allocate eeprom */ + sz = il->cfg->eeprom_size; +-- +2.31.1 + diff --git a/SOURCES/0005-iwlegacy-Check-the-return-value-of-pcie_capability_r.patch b/SOURCES/0005-iwlegacy-Check-the-return-value-of-pcie_capability_r.patch new file mode 100644 index 0000000..9c17475 --- /dev/null +++ b/SOURCES/0005-iwlegacy-Check-the-return-value-of-pcie_capability_r.patch @@ -0,0 +1,41 @@ +From 9018fd7f2a73e9b290f48a56b421558fa31e8b75 Mon Sep 17 00:00:00 2001 +From: Bolarinwa Olayemi Saheed +Date: Mon, 13 Jul 2020 19:55:27 +0200 +Subject: [Backport 9018fd7f2a73] iwlegacy: Check the return value of + pcie_capability_read_*() + +On failure pcie_capability_read_dword() sets it's last parameter, val +to 0. However, with Patch 14/14, it is possible that val is set to ~0 on +failure. This would introduce a bug because (x & x) == (~0 & x). + +This bug can be avoided without changing the function's behaviour if the +return value of pcie_capability_read_dword is checked to confirm success. + +Check the return value of pcie_capability_read_dword() to ensure success. + +Suggested-by: Bjorn Helgaas +Signed-off-by: Bolarinwa Olayemi Saheed +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20200713175529.29715-3-refactormyself@gmail.com +--- + src/common.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/common.c b/src/common.c +index 348c17ce72f5cd57b66fb5ae161b2381b3585bf3..f78e062df572abacb6ab7d3a271de85f5903247d 100644 +--- a/src/common.c ++++ b/src/common.c +@@ -4286,8 +4286,8 @@ il_apm_init(struct il_priv *il) + * power savings, even without L1. + */ + if (il->cfg->set_l0s) { +- pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &lctl); +- if (lctl & PCI_EXP_LNKCTL_ASPM_L1) { ++ ret = pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &lctl); ++ if (!ret && (lctl & PCI_EXP_LNKCTL_ASPM_L1)) { + /* L1-ASPM enabled; disable(!) L0S */ + il_set_bit(il, CSR_GIO_REG, + CSR_GIO_REG_VAL_L0S_ENABLED); +-- +2.31.1 + diff --git a/SOURCES/9999-enable-iwlegacy.patch b/SOURCES/9999-enable-iwlegacy.patch new file mode 100644 index 0000000..acfcd56 --- /dev/null +++ b/SOURCES/9999-enable-iwlegacy.patch @@ -0,0 +1,24 @@ +--- a/src/Makefile ++++ b/src/Makefile +@@ -2 +2 @@ +-obj-$(CONFIG_IWLEGACY) += iwlegacy.o ++obj-m += iwlegacy.o +@@ -4 +4 @@ +-iwlegacy-$(CONFIG_IWLEGACY_DEBUGFS) += debug.o ++iwlegacy-m += debug.o +@@ -9 +9 @@ +-obj-$(CONFIG_IWL4965) += iwl4965.o ++obj-m += iwl4965.o +@@ -11 +11 @@ +-iwl4965-$(CONFIG_IWLEGACY_DEBUGFS) += 4965-debug.o ++iwl4965-m += 4965-debug.o +@@ -14 +14 @@ +-obj-$(CONFIG_IWL3945) += iwl3945.o ++obj-m += iwl3945.o +@@ -16 +16,5 @@ +-iwl3945-$(CONFIG_IWLEGACY_DEBUGFS) += 3945-debug.o ++iwl3945-m += 3945-debug.o ++ ++ccflags-y += -DCONFIG_IWL4965 ++ccflags-y += -DCONFIG_IWL3945 ++ccflags-y += -DCONFIG_IWLEGACY_DEBUGFS diff --git a/SPECS/kmod-iwlegacy.spec b/SPECS/kmod-iwlegacy.spec index 3b4e803..be5ae44 100644 --- a/SPECS/kmod-iwlegacy.spec +++ b/SPECS/kmod-iwlegacy.spec @@ -1,5 +1,7 @@ %global pkg iwlegacy +%global driver_version 4.18.0-348.el8 + %global kernel_version 4.18.0-348.el8 %global _use_internal_dependency_generator 0 @@ -18,14 +20,20 @@ Name: kmod-%{pkg} -Version: 5.12 +Version: 4.18.0.348 Release: 1%{?dist} Summary: Intel WiFi 3945ABG/BG (iwl3945) and 4965AGN (iwl4965) driver License: GPLv2 URL: https://www.kernel.org/ -Source0: %{pkg}-%{version}.tar.xz +Source0: %{pkg}-%{driver_version}.tar.xz +Patch1: 0001-iwlegacy-Add-a-lock-assertion-in-il4965_send_rxon_as.patch +Patch2: 0002-iwlegacy-3945-no-need-to-check-return-value-of-debug.patch +Patch3: 0003-iwlegacy-4965-no-need-to-check-return-value-of-debug.patch +Patch4: 0004-iwlegacy-ensure-loop-counter-addr-does-not-wrap-and-.patch +Patch5: 0005-iwlegacy-Check-the-return-value-of-pcie_capability_r.patch +Patch9999: 9999-enable-iwlegacy.patch ExclusiveArch: x86_64 @@ -71,7 +79,7 @@ This package provides drivers for Intel's WiFi adapter 3945ABG/BG (iwl3945) and %prep -%autosetup -p1 -n %{pkg}-%{version} +%autosetup -p1 -n %{pkg}-%{driver_version} %build @@ -135,11 +143,6 @@ fi %changelog -* Tue Nov 16 2021 Peter Georg - 5.12-1 -- Update to v5.12 (a82ce507d36e) - -* Tue Nov 09 2021 Peter Georg - 5.9-7 -- Rebuild for 4.18.0-348.el8 - -* Tue Sep 28 2021 Peter Georg - 5.9-6 -- Convert to kABI tracking kmod package (kernel >= 4.18.0-305.7.1.el8_4) +* Wed Jan 12 2022 Kmods SIG - 4.18.0.348-1 +- Switch to EL kernel source and versioning +- kABI tracking kmod package (kernel >= 4.18.0-348.el8)