From: Sasha Levin Date: Sun, 24 May 2020 13:51:26 +0000 (-0400) Subject: Fixes for 4.9 X-Git-Tag: v4.4.225~29 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0be2b69d56f5576171fb959897c69e1d89504a1b;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.9 Signed-off-by: Sasha Levin --- diff --git a/queue-4.9/cxgb4-cxgb4vf-fix-mac_hlist-initialization-and-free.patch b/queue-4.9/cxgb4-cxgb4vf-fix-mac_hlist-initialization-and-free.patch new file mode 100644 index 00000000000..5fdab3ef4ec --- /dev/null +++ b/queue-4.9/cxgb4-cxgb4vf-fix-mac_hlist-initialization-and-free.patch @@ -0,0 +1,116 @@ +From c9bfea8750fe84b9161476169bf644b560c77006 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 20 Nov 2018 12:11:39 +0530 +Subject: cxgb4/cxgb4vf: Fix mac_hlist initialization and free + +From: Arjun Vynipadath + +[ Upstream commit b539ea60f5043b9acd7562f04fa2117f18776cbb ] + +Null pointer dereference seen when cxgb4vf driver is unloaded +without bringing up any interfaces, moving mac_hlist initialization +to driver probe and free the mac_hlist in remove to fix the issue. + +Fixes: 24357e06ba51 ("cxgb4vf: fix memleak in mac_hlist initialization") +Signed-off-by: Arjun Vynipadath +Signed-off-by: Casey Leedom +Signed-off-by: Ganesh Goudar +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 19 ++++++++++--------- + .../ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 6 +++--- + 2 files changed, 13 insertions(+), 12 deletions(-) + +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +index 821f68baa55c..54b5f61c8ed9 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +@@ -2236,8 +2236,6 @@ static int cxgb_up(struct adapter *adap) + #if IS_ENABLED(CONFIG_IPV6) + update_clip(adap); + #endif +- /* Initialize hash mac addr list*/ +- INIT_LIST_HEAD(&adap->mac_hlist); + return err; + + irq_err: +@@ -2251,8 +2249,6 @@ static int cxgb_up(struct adapter *adap) + + static void cxgb_down(struct adapter *adapter) + { +- struct hash_mac_addr *entry, *tmp; +- + cancel_work_sync(&adapter->tid_release_task); + cancel_work_sync(&adapter->db_full_task); + cancel_work_sync(&adapter->db_drop_task); +@@ -2262,11 +2258,6 @@ static void cxgb_down(struct adapter *adapter) + t4_sge_stop(adapter); + t4_free_sge_resources(adapter); + +- list_for_each_entry_safe(entry, tmp, &adapter->mac_hlist, list) { +- list_del(&entry->list); +- kfree(entry); +- } +- + adapter->flags &= ~FULL_INIT_DONE; + } + +@@ -4797,6 +4788,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) + (is_t5(adapter->params.chip) ? STATMODE_V(0) : + T6_STATMODE_V(0))); + ++ /* Initialize hash mac addr list */ ++ INIT_LIST_HEAD(&adapter->mac_hlist); ++ + for_each_port(adapter, i) { + netdev = alloc_etherdev_mq(sizeof(struct port_info), + MAX_ETH_QSETS); +@@ -5075,6 +5069,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) + static void remove_one(struct pci_dev *pdev) + { + struct adapter *adapter = pci_get_drvdata(pdev); ++ struct hash_mac_addr *entry, *tmp; + + if (!adapter) { + pci_release_regions(pdev); +@@ -5113,6 +5108,12 @@ static void remove_one(struct pci_dev *pdev) + if (adapter->num_uld || adapter->num_ofld_uld) + t4_uld_mem_free(adapter); + free_some_resources(adapter); ++ list_for_each_entry_safe(entry, tmp, &adapter->mac_hlist, ++ list) { ++ list_del(&entry->list); ++ kfree(entry); ++ } ++ + #if IS_ENABLED(CONFIG_IPV6) + t4_cleanup_clip_tbl(adapter); + #endif +diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +index 9eb3071b69a4..17db5be9d2b7 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c ++++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +@@ -719,9 +719,6 @@ static int adapter_up(struct adapter *adapter) + if (adapter->flags & USING_MSIX) + name_msix_vecs(adapter); + +- /* Initialize hash mac addr list*/ +- INIT_LIST_HEAD(&adapter->mac_hlist); +- + adapter->flags |= FULL_INIT_DONE; + } + +@@ -2902,6 +2899,9 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev, + if (err) + goto err_unmap_bar; + ++ /* Initialize hash mac addr list */ ++ INIT_LIST_HEAD(&adapter->mac_hlist); ++ + /* + * Allocate our "adapter ports" and stitch everything together. + */ +-- +2.25.1 + diff --git a/queue-4.9/cxgb4-free-mac_hlist-properly.patch b/queue-4.9/cxgb4-free-mac_hlist-properly.patch new file mode 100644 index 00000000000..211b46c30b3 --- /dev/null +++ b/queue-4.9/cxgb4-free-mac_hlist-properly.patch @@ -0,0 +1,49 @@ +From aee925acfe095b3308b927850a70fc5005515875 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 9 Nov 2018 14:50:25 +0530 +Subject: cxgb4: free mac_hlist properly + +From: Arjun Vynipadath + +[ Upstream commit 2a8d84bf513823ba398f4b2dec41b8decf4041af ] + +The locally maintained list for tracking hash mac table was +not freed during driver remove. + +Signed-off-by: Arjun Vynipadath +Signed-off-by: Ganesh Goudar +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +index 5478a2ab45c4..821f68baa55c 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +@@ -2251,6 +2251,8 @@ static int cxgb_up(struct adapter *adap) + + static void cxgb_down(struct adapter *adapter) + { ++ struct hash_mac_addr *entry, *tmp; ++ + cancel_work_sync(&adapter->tid_release_task); + cancel_work_sync(&adapter->db_full_task); + cancel_work_sync(&adapter->db_drop_task); +@@ -2259,6 +2261,12 @@ static void cxgb_down(struct adapter *adapter) + + t4_sge_stop(adapter); + t4_free_sge_resources(adapter); ++ ++ list_for_each_entry_safe(entry, tmp, &adapter->mac_hlist, list) { ++ list_del(&entry->list); ++ kfree(entry); ++ } ++ + adapter->flags &= ~FULL_INIT_DONE; + } + +-- +2.25.1 + diff --git a/queue-4.9/edac-ghes-use-cper-module-handles-to-locate-dimms.patch b/queue-4.9/edac-ghes-use-cper-module-handles-to-locate-dimms.patch new file mode 100644 index 00000000000..5c67c0b8f21 --- /dev/null +++ b/queue-4.9/edac-ghes-use-cper-module-handles-to-locate-dimms.patch @@ -0,0 +1,104 @@ +From d0b41e69bd83b92817db1b31a9563315cbefd45f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 19 Sep 2018 01:59:00 +0000 +Subject: EDAC, ghes: Use CPER module handles to locate DIMMs + +From: Fan Wu + +[ Upstream commit c798c88f3962ddff89c7aa818986caeecd46ab4c ] + +Use SMBIOS module handle type 17, on platforms which provide valid +ones, to locate the corresponding DIMM and thus have per-DIMM error +counter updates. + +Signed-off-by: Fan Wu +[ Massage commit message. ] +Signed-off-by: Borislav Petkov +Reviewed-by: Tyler Baicar +Reviewed-by: James Morse +Tested-by: Toshi Kani +Cc: Mauro Carvalho Chehab +Cc: baicar.tyler@gmail.com +Cc: john.garry@huawei.com +Cc: linux-arm-kernel@lists.infradead.org +Cc: linux-edac +Cc: shiju.jose@huawei.com +Cc: tanxiaofei@huawei.com +Cc: wanghuiqiang@huawei.com +Link: http://lkml.kernel.org/r/1537322340-1860-1-git-send-email-wufan@codeaurora.org +Signed-off-by: Sasha Levin +--- + drivers/edac/ghes_edac.c | 23 +++++++++++++++++++++++ + include/linux/edac.h | 2 ++ + 2 files changed, 25 insertions(+) + +diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c +index 4ddbf6604e2a..4249b9ada3a6 100644 +--- a/drivers/edac/ghes_edac.c ++++ b/drivers/edac/ghes_edac.c +@@ -74,6 +74,18 @@ static void ghes_edac_count_dimms(const struct dmi_header *dh, void *arg) + (*num_dimm)++; + } + ++static int get_dimm_smbios_index(u16 handle) ++{ ++ struct mem_ctl_info *mci = ghes_pvt->mci; ++ int i; ++ ++ for (i = 0; i < mci->tot_dimms; i++) { ++ if (mci->dimms[i]->smbios_handle == handle) ++ return i; ++ } ++ return -1; ++} ++ + static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) + { + struct ghes_edac_dimm_fill *dimm_fill = arg; +@@ -161,6 +173,8 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) + entry->total_width, entry->data_width); + } + ++ dimm->smbios_handle = entry->handle; ++ + dimm_fill->count++; + } + } +@@ -307,12 +321,21 @@ void ghes_edac_report_mem_error(struct ghes *ghes, int sev, + p += sprintf(p, "bit_pos:%d ", mem_err->bit_pos); + if (mem_err->validation_bits & CPER_MEM_VALID_MODULE_HANDLE) { + const char *bank = NULL, *device = NULL; ++ int index = -1; ++ + dmi_memdev_name(mem_err->mem_dev_handle, &bank, &device); + if (bank != NULL && device != NULL) + p += sprintf(p, "DIMM location:%s %s ", bank, device); + else + p += sprintf(p, "DIMM DMI handle: 0x%.4x ", + mem_err->mem_dev_handle); ++ ++ index = get_dimm_smbios_index(mem_err->mem_dev_handle); ++ if (index >= 0) { ++ e->top_layer = index; ++ e->enable_per_layer_report = true; ++ } ++ + } + if (p > e->location) + *(p - 1) = '\0'; +diff --git a/include/linux/edac.h b/include/linux/edac.h +index c6233227720c..1f69c994b9cc 100644 +--- a/include/linux/edac.h ++++ b/include/linux/edac.h +@@ -559,6 +559,8 @@ struct dimm_info { + u32 nr_pages; /* number of pages on this dimm */ + + unsigned csrow, cschannel; /* Points to the old API data */ ++ ++ u16 smbios_handle; /* Handle for SMBIOS type 17 */ + }; + + /** +-- +2.25.1 + diff --git a/queue-4.9/libnvdimm-btt-remove-unnecessary-code-in-btt_freelis.patch b/queue-4.9/libnvdimm-btt-remove-unnecessary-code-in-btt_freelis.patch new file mode 100644 index 00000000000..0a000d75cbe --- /dev/null +++ b/queue-4.9/libnvdimm-btt-remove-unnecessary-code-in-btt_freelis.patch @@ -0,0 +1,51 @@ +From b9eb6c2b708124682e113cd773ab87b96c77b72a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 27 Feb 2019 17:06:26 -0700 +Subject: libnvdimm/btt: Remove unnecessary code in btt_freelist_init + +From: Vishal Verma + +[ Upstream commit 2f8c9011151337d0bc106693f272f9bddbccfab2 ] + +We call btt_log_read() twice, once to get the 'old' log entry, and again +to get the 'new' entry. However, we have no use for the 'old' entry, so +remove it. + +Cc: Dan Williams +Signed-off-by: Vishal Verma +Signed-off-by: Dan Williams +Signed-off-by: Sasha Levin +--- + drivers/nvdimm/btt.c | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c +index 0c46ada027cf..e90ecb179622 100644 +--- a/drivers/nvdimm/btt.c ++++ b/drivers/nvdimm/btt.c +@@ -447,9 +447,9 @@ static int btt_log_init(struct arena_info *arena) + + static int btt_freelist_init(struct arena_info *arena) + { +- int old, new, ret; ++ int new, ret; + u32 i, map_entry; +- struct log_entry log_new, log_old; ++ struct log_entry log_new; + + arena->freelist = kcalloc(arena->nfree, sizeof(struct free_entry), + GFP_KERNEL); +@@ -457,10 +457,6 @@ static int btt_freelist_init(struct arena_info *arena) + return -ENOMEM; + + for (i = 0; i < arena->nfree; i++) { +- old = btt_log_read(arena, i, &log_old, LOG_OLD_ENT); +- if (old < 0) +- return old; +- + new = btt_log_read(arena, i, &log_new, LOG_NEW_ENT); + if (new < 0) + return new; +-- +2.25.1 + diff --git a/queue-4.9/ppp-mppe-revert-ppp-mppe-add-softdep-to-arc4.patch b/queue-4.9/ppp-mppe-revert-ppp-mppe-add-softdep-to-arc4.patch new file mode 100644 index 00000000000..e915d59fb69 --- /dev/null +++ b/queue-4.9/ppp-mppe-revert-ppp-mppe-add-softdep-to-arc4.patch @@ -0,0 +1,47 @@ +From a8e46f1e0a99e8c924b5bf62c8dea0853511793b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 12 Jul 2019 16:39:31 -0700 +Subject: ppp: mppe: Revert "ppp: mppe: Add softdep to arc4" + +From: Eric Biggers + +[ Upstream commit 25a09ce79639a8775244808c17282c491cff89cf ] + +Commit 0e5a610b5ca5 ("ppp: mppe: switch to RC4 library interface"), +which was merged through the crypto tree for v5.3, changed ppp_mppe.c to +use the new arc4_crypt() library function rather than access RC4 through +the dynamic crypto_skcipher API. + +Meanwhile commit aad1dcc4f011 ("ppp: mppe: Add softdep to arc4") was +merged through the net tree and added a module soft-dependency on "arc4". + +The latter commit no longer makes sense because the code now uses the +"libarc4" module rather than "arc4", and also due to the direct use of +arc4_crypt(), no module soft-dependency is required. + +So revert the latter commit. + +Cc: Takashi Iwai +Cc: Ard Biesheuvel +Signed-off-by: Eric Biggers +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ppp/ppp_mppe.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/net/ppp/ppp_mppe.c b/drivers/net/ppp/ppp_mppe.c +index 92f52a73ec0e..f60f7660b451 100644 +--- a/drivers/net/ppp/ppp_mppe.c ++++ b/drivers/net/ppp/ppp_mppe.c +@@ -63,7 +63,6 @@ MODULE_AUTHOR("Frank Cusack "); + MODULE_DESCRIPTION("Point-to-Point Protocol Microsoft Point-to-Point Encryption support"); + MODULE_LICENSE("Dual BSD/GPL"); + MODULE_ALIAS("ppp-compress-" __stringify(CI_MPPE)); +-MODULE_SOFTDEP("pre: arc4"); + MODULE_VERSION("1.0.2"); + + static unsigned int +-- +2.25.1 + diff --git a/queue-4.9/revert-gfs2-don-t-demote-a-glock-until-its-revokes-a.patch b/queue-4.9/revert-gfs2-don-t-demote-a-glock-until-its-revokes-a.patch new file mode 100644 index 00000000000..6331b2b0ba7 --- /dev/null +++ b/queue-4.9/revert-gfs2-don-t-demote-a-glock-until-its-revokes-a.patch @@ -0,0 +1,48 @@ +From f2e35dfd0261f4b0dbcf95fc46ffc8132c0c569f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 8 May 2020 15:01:25 -0500 +Subject: Revert "gfs2: Don't demote a glock until its revokes are written" + +From: Bob Peterson + +[ Upstream commit b14c94908b1b884276a6608dea3d0b1b510338b7 ] + +This reverts commit df5db5f9ee112e76b5202fbc331f990a0fc316d6. + +This patch fixes a regression: patch df5db5f9ee112 allowed function +run_queue() to bypass its call to do_xmote() if revokes were queued for +the glock. That's wrong because its call to do_xmote() is what is +responsible for calling the go_sync() glops functions to sync both +the ail list and any revokes queued for it. By bypassing the call, +gfs2 could get into a stand-off where the glock could not be demoted +until its revokes are written back, but the revokes would not be +written back because do_xmote() was never called. + +It "sort of" works, however, because there are other mechanisms like +the log flush daemon (logd) that can sync the ail items and revokes, +if it deems it necessary. The problem is: without file system pressure, +it might never deem it necessary. + +Signed-off-by: Bob Peterson +Signed-off-by: Sasha Levin +--- + fs/gfs2/glock.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c +index adc1a97cfe96..efd44d5645d8 100644 +--- a/fs/gfs2/glock.c ++++ b/fs/gfs2/glock.c +@@ -548,9 +548,6 @@ __acquires(&gl->gl_lockref.lock) + goto out_unlock; + if (nonblock) + goto out_sched; +- smp_mb(); +- if (atomic_read(&gl->gl_revokes) != 0) +- goto out_sched; + set_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags); + GLOCK_BUG_ON(gl, gl->gl_demote_state == LM_ST_EXCLUSIVE); + gl->gl_target = gl->gl_demote_state; +-- +2.25.1 + diff --git a/queue-4.9/series b/queue-4.9/series index af846df5464..5b799534e84 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -52,3 +52,9 @@ l2tp-device-mtu-setup-tunnel-socket-needs-a-lock.patch x86-uaccess-ubsan-fix-ubsan-vs.-smap.patch ubsan-build-ubsan.c-more-conservatively.patch platform-x86-alienware-wmi-fix-kfree-on-potentially-uninitialized-pointer.patch +libnvdimm-btt-remove-unnecessary-code-in-btt_freelis.patch +ppp-mppe-revert-ppp-mppe-add-softdep-to-arc4.patch +edac-ghes-use-cper-module-handles-to-locate-dimms.patch +cxgb4-free-mac_hlist-properly.patch +cxgb4-cxgb4vf-fix-mac_hlist-initialization-and-free.patch +revert-gfs2-don-t-demote-a-glock-until-its-revokes-a.patch