From 9435d34f36ea7b08ef3d81ccde0d8e9c8c38ee0b Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Mon, 20 Sep 2021 11:39:44 -0400 Subject: [PATCH] Fixes for 4.4 Signed-off-by: Sasha Levin --- ...c-export-clear_user_page-for-modules.patch | 45 ++++++++++++++++ ...gpmc-fix-the-ecc-bytes-vs.-oob-bytes.patch | 43 +++++++++++++++ ...ethtool-fix-an-error-code-in-cxgb2.c.patch | 39 ++++++++++++++ ...-fix-a-resource-leak-in-the-error-ha.patch | 53 +++++++++++++++++++ ..._eth-fix-freeing-wrong-tx-descriptor.patch | 40 ++++++++++++++ ...egister_driver-stub-for-config_pci-n.patch | 42 +++++++++++++++ ...dundant-unlock-in-qlcnic_pinit_from_.patch | 38 +++++++++++++ queue-4.4/series | 7 +++ 8 files changed, 307 insertions(+) create mode 100644 queue-4.4/arc-export-clear_user_page-for-modules.patch create mode 100644 queue-4.4/dt-bindings-mtd-gpmc-fix-the-ecc-bytes-vs.-oob-bytes.patch create mode 100644 queue-4.4/ethtool-fix-an-error-code-in-cxgb2.c.patch create mode 100644 queue-4.4/mtd-rawnand-cafe-fix-a-resource-leak-in-the-error-ha.patch create mode 100644 queue-4.4/net-renesas-sh_eth-fix-freeing-wrong-tx-descriptor.patch create mode 100644 queue-4.4/pci-sync-__pci_register_driver-stub-for-config_pci-n.patch create mode 100644 queue-4.4/qlcnic-remove-redundant-unlock-in-qlcnic_pinit_from_.patch diff --git a/queue-4.4/arc-export-clear_user_page-for-modules.patch b/queue-4.4/arc-export-clear_user_page-for-modules.patch new file mode 100644 index 00000000000..2bc7fd6e003 --- /dev/null +++ b/queue-4.4/arc-export-clear_user_page-for-modules.patch @@ -0,0 +1,45 @@ +From b4d3a2a4e54db75141e1c28b8df0090d3302aec6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 16 Aug 2021 14:05:33 -0700 +Subject: ARC: export clear_user_page() for modules + +From: Randy Dunlap + +[ Upstream commit 6b5ff0405e4190f23780362ea324b250bc495683 ] + +0day bot reports a build error: + ERROR: modpost: "clear_user_page" [drivers/media/v4l2-core/videobuf-dma-sg.ko] undefined! +so export it in arch/arc/ to fix the build error. + +In most ARCHes, clear_user_page() is a macro. OTOH, in a few +ARCHes it is a function and needs to be exported. +PowerPC exported it in 2004. It looks like nds32 and nios2 +still need to have it exported. + +Fixes: 4102b53392d63 ("ARC: [mm] Aliasing VIPT dcache support 2/4") +Signed-off-by: Randy Dunlap +Reported-by: kernel test robot +Cc: Guenter Roeck +Cc: linux-snps-arc@lists.infradead.org +Signed-off-by: Vineet Gupta +Signed-off-by: Sasha Levin +--- + arch/arc/mm/cache.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c +index 017fb440bba4..f425405a8a76 100644 +--- a/arch/arc/mm/cache.c ++++ b/arch/arc/mm/cache.c +@@ -904,7 +904,7 @@ void clear_user_page(void *to, unsigned long u_vaddr, struct page *page) + clear_page(to); + clear_bit(PG_dc_clean, &page->flags); + } +- ++EXPORT_SYMBOL(clear_user_page); + + /********************************************************************** + * Explicit Cache flush request from user space via syscall +-- +2.30.2 + diff --git a/queue-4.4/dt-bindings-mtd-gpmc-fix-the-ecc-bytes-vs.-oob-bytes.patch b/queue-4.4/dt-bindings-mtd-gpmc-fix-the-ecc-bytes-vs.-oob-bytes.patch new file mode 100644 index 00000000000..0b6337373bd --- /dev/null +++ b/queue-4.4/dt-bindings-mtd-gpmc-fix-the-ecc-bytes-vs.-oob-bytes.patch @@ -0,0 +1,43 @@ +From afe3c5512b3308c7a35e5a4b766888de2bf02806 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 10 Jun 2021 16:39:45 +0200 +Subject: dt-bindings: mtd: gpmc: Fix the ECC bytes vs. OOB bytes equation + +From: Miquel Raynal + +[ Upstream commit 778cb8e39f6ec252be50fc3850d66f3dcbd5dd5a ] + +"PAGESIZE / 512" is the number of ECC chunks. +"ECC_BYTES" is the number of bytes needed to store a single ECC code. +"2" is the space reserved by the bad block marker. + +"2 + (PAGESIZE / 512) * ECC_BYTES" should of course be lower or equal +than the total number of OOB bytes, otherwise it won't fit. + +Fix the equation by substituting s/>=/<=/. + +Suggested-by: Ryan J. Barnett +Signed-off-by: Miquel Raynal +Acked-by: Rob Herring +Link: https://lore.kernel.org/linux-mtd/20210610143945.3504781-1-miquel.raynal@bootlin.com +Signed-off-by: Sasha Levin +--- + Documentation/devicetree/bindings/mtd/gpmc-nand.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Documentation/devicetree/bindings/mtd/gpmc-nand.txt b/Documentation/devicetree/bindings/mtd/gpmc-nand.txt +index fb733c4e1c11..3a58fdf0c566 100644 +--- a/Documentation/devicetree/bindings/mtd/gpmc-nand.txt ++++ b/Documentation/devicetree/bindings/mtd/gpmc-nand.txt +@@ -112,7 +112,7 @@ on various other factors also like; + so the device should have enough free bytes available its OOB/Spare + area to accommodate ECC for entire page. In general following expression + helps in determining if given device can accommodate ECC syndrome: +- "2 + (PAGESIZE / 512) * ECC_BYTES" >= OOBSIZE" ++ "2 + (PAGESIZE / 512) * ECC_BYTES" <= OOBSIZE" + where + OOBSIZE number of bytes in OOB/spare area + PAGESIZE number of bytes in main-area of device page +-- +2.30.2 + diff --git a/queue-4.4/ethtool-fix-an-error-code-in-cxgb2.c.patch b/queue-4.4/ethtool-fix-an-error-code-in-cxgb2.c.patch new file mode 100644 index 00000000000..f7e25db9d3b --- /dev/null +++ b/queue-4.4/ethtool-fix-an-error-code-in-cxgb2.c.patch @@ -0,0 +1,39 @@ +From 3164adbd461f3d5faf6bb65379f46aea977e5763 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Sep 2021 14:42:33 +0800 +Subject: ethtool: Fix an error code in cxgb2.c + +From: Yang Li + +[ Upstream commit 7db8263a12155c7ae4ad97e850f1e499c73765fc ] + +When adapter->registered_device_map is NULL, the value of err is +uncertain, we set err to -EINVAL to avoid ambiguity. + +Clean up smatch warning: +drivers/net/ethernet/chelsio/cxgb/cxgb2.c:1114 init_one() warn: missing +error code 'err' + +Reported-by: Abaci Robot +Signed-off-by: Yang Li +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/chelsio/cxgb/cxgb2.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c +index f5f1b0b51ebd..79eb2257a30e 100644 +--- a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c ++++ b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c +@@ -1133,6 +1133,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) + if (!adapter->registered_device_map) { + pr_err("%s: could not register any net devices\n", + pci_name(pdev)); ++ err = -EINVAL; + goto out_release_adapter_res; + } + +-- +2.30.2 + diff --git a/queue-4.4/mtd-rawnand-cafe-fix-a-resource-leak-in-the-error-ha.patch b/queue-4.4/mtd-rawnand-cafe-fix-a-resource-leak-in-the-error-ha.patch new file mode 100644 index 00000000000..dc750970a60 --- /dev/null +++ b/queue-4.4/mtd-rawnand-cafe-fix-a-resource-leak-in-the-error-ha.patch @@ -0,0 +1,53 @@ +From f4af3d283a04e834bec58e5503aae312bdf2b497 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 21 Aug 2021 09:58:45 +0200 +Subject: mtd: rawnand: cafe: Fix a resource leak in the error handling path of + 'cafe_nand_probe()' +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Christophe JAILLET + +[ Upstream commit 6b430c7595e4eb95fae8fb54adc3c3ce002e75ae ] + +A successful 'init_rs_non_canonical()' call should be balanced by a +corresponding 'free_rs()' call in the error handling path of the probe, as +already done in the remove function. + +Update the error handling path accordingly. + +Fixes: 8c61b7a7f4d4 ("[MTD] [NAND] Use rslib for CAFÉ ECC") +Signed-off-by: Christophe JAILLET +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/fd313d3fb787458bcc73189e349f481133a2cdc9.1629532640.git.christophe.jaillet@wanadoo.fr +Signed-off-by: Sasha Levin +--- + drivers/mtd/nand/cafe_nand.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c +index 9de78d2a2eb1..10c063d73ee3 100644 +--- a/drivers/mtd/nand/cafe_nand.c ++++ b/drivers/mtd/nand/cafe_nand.c +@@ -672,7 +672,7 @@ static int cafe_nand_probe(struct pci_dev *pdev, + "CAFE NAND", mtd); + if (err) { + dev_warn(&pdev->dev, "Could not register IRQ %d\n", pdev->irq); +- goto out_ior; ++ goto out_free_rs; + } + + /* Disable master reset, enable NAND clock */ +@@ -781,6 +781,8 @@ static int cafe_nand_probe(struct pci_dev *pdev, + /* Disable NAND IRQ in global IRQ mask register */ + cafe_writel(cafe, ~1 & cafe_readl(cafe, GLOBAL_IRQ_MASK), GLOBAL_IRQ_MASK); + free_irq(pdev->irq, mtd); ++ out_free_rs: ++ free_rs(cafe->rs); + out_ior: + pci_iounmap(pdev, cafe->mmio); + out_free_mtd: +-- +2.30.2 + diff --git a/queue-4.4/net-renesas-sh_eth-fix-freeing-wrong-tx-descriptor.patch b/queue-4.4/net-renesas-sh_eth-fix-freeing-wrong-tx-descriptor.patch new file mode 100644 index 00000000000..5d63e5ed3c0 --- /dev/null +++ b/queue-4.4/net-renesas-sh_eth-fix-freeing-wrong-tx-descriptor.patch @@ -0,0 +1,40 @@ +From 5ef945011746359c846a9d6285cc0e8b7c03740f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 Sep 2021 20:29:40 +0900 +Subject: net: renesas: sh_eth: Fix freeing wrong tx descriptor + +From: Yoshihiro Shimoda + +[ Upstream commit 0341d5e3d1ee2a36dd5a49b5bef2ce4ad1cfa6b4 ] + +The cur_tx counter must be incremented after TACT bit of +txdesc->status was set. However, a CPU is possible to reorder +instructions and/or memory accesses between cur_tx and +txdesc->status. And then, if TX interrupt happened at such a +timing, the sh_eth_tx_free() may free the descriptor wrongly. +So, add wmb() before cur_tx++. +Otherwise NETDEV WATCHDOG timeout is possible to happen. + +Fixes: 86a74ff21a7a ("net: sh_eth: add support for Renesas SuperH Ethernet") +Signed-off-by: Yoshihiro Shimoda +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/renesas/sh_eth.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c +index 1942264b621b..73fc8e9683b7 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.c ++++ b/drivers/net/ethernet/renesas/sh_eth.c +@@ -2426,6 +2426,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) + else + txdesc->status |= cpu_to_edmac(mdp, TD_TACT); + ++ wmb(); /* cur_tx must be incremented after TACT bit was set */ + mdp->cur_tx++; + + if (!(sh_eth_read(ndev, EDTRR) & sh_eth_get_edtrr_trns(mdp))) +-- +2.30.2 + diff --git a/queue-4.4/pci-sync-__pci_register_driver-stub-for-config_pci-n.patch b/queue-4.4/pci-sync-__pci_register_driver-stub-for-config_pci-n.patch new file mode 100644 index 00000000000..13022227e2a --- /dev/null +++ b/queue-4.4/pci-sync-__pci_register_driver-stub-for-config_pci-n.patch @@ -0,0 +1,42 @@ +From 30af27934149e95a8112063183f81a0ee60e2429 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 Aug 2021 18:36:19 +0300 +Subject: PCI: Sync __pci_register_driver() stub for CONFIG_PCI=n + +From: Andy Shevchenko + +[ Upstream commit 817f9916a6e96ae43acdd4e75459ef4f92d96eb1 ] + +The CONFIG_PCI=y case got a new parameter long time ago. Sync the stub as +well. + +[bhelgaas: add parameter names] +Fixes: 725522b5453d ("PCI: add the sysfs driver name to all modules") +Link: https://lore.kernel.org/r/20210813153619.89574-1-andriy.shevchenko@linux.intel.com +Reported-by: kernel test robot +Signed-off-by: Andy Shevchenko +Signed-off-by: Bjorn Helgaas +Signed-off-by: Sasha Levin +--- + include/linux/pci.h | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/include/linux/pci.h b/include/linux/pci.h +index 5f37614f2451..c871b19cc915 100644 +--- a/include/linux/pci.h ++++ b/include/linux/pci.h +@@ -1442,8 +1442,9 @@ static inline int pci_set_dma_seg_boundary(struct pci_dev *dev, + { return -EIO; } + static inline int pci_assign_resource(struct pci_dev *dev, int i) + { return -EBUSY; } +-static inline int __pci_register_driver(struct pci_driver *drv, +- struct module *owner) ++static inline int __must_check __pci_register_driver(struct pci_driver *drv, ++ struct module *owner, ++ const char *mod_name) + { return 0; } + static inline int pci_register_driver(struct pci_driver *drv) + { return 0; } +-- +2.30.2 + diff --git a/queue-4.4/qlcnic-remove-redundant-unlock-in-qlcnic_pinit_from_.patch b/queue-4.4/qlcnic-remove-redundant-unlock-in-qlcnic_pinit_from_.patch new file mode 100644 index 00000000000..64723174dda --- /dev/null +++ b/queue-4.4/qlcnic-remove-redundant-unlock-in-qlcnic_pinit_from_.patch @@ -0,0 +1,38 @@ +From b7c7959c1e456ffc7851d94ec204f9bd11045600 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Sep 2021 15:35:43 +0800 +Subject: qlcnic: Remove redundant unlock in qlcnic_pinit_from_rom + +From: Dinghao Liu + +[ Upstream commit 9ddbc2a00d7f63fa9748f4278643193dac985f2d ] + +Previous commit 68233c583ab4 removes the qlcnic_rom_lock() +in qlcnic_pinit_from_rom(), but remains its corresponding +unlock function, which is odd. I'm not very sure whether the +lock is missing, or the unlock is redundant. This bug is +suggested by a static analysis tool, please advise. + +Fixes: 68233c583ab4 ("qlcnic: updated reset sequence") +Signed-off-by: Dinghao Liu +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c +index be41e4c77b65..eff587c6e9be 100644 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c +@@ -440,7 +440,6 @@ int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter) + QLCWR32(adapter, QLCNIC_CRB_PEG_NET_4 + 0x3c, 1); + msleep(20); + +- qlcnic_rom_unlock(adapter); + /* big hammer don't reset CAM block on reset */ + QLCWR32(adapter, QLCNIC_ROMUSB_GLB_SW_RESET, 0xfeffffff); + +-- +2.30.2 + diff --git a/queue-4.4/series b/queue-4.4/series index 92369c4ce9b..c07ef45b8d8 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -124,3 +124,10 @@ r6040-restore-mdio-clock-frequency-after-mac-reset.patch tipc-increase-timeout-in-tipc_sk_enqueue.patch net-af_unix-fix-a-data-race-in-unix_dgram_poll.patch x86-mm-fix-kern_addr_valid-to-cope-with-existing-but-not-present-entries.patch +dt-bindings-mtd-gpmc-fix-the-ecc-bytes-vs.-oob-bytes.patch +ethtool-fix-an-error-code-in-cxgb2.c.patch +pci-sync-__pci_register_driver-stub-for-config_pci-n.patch +mtd-rawnand-cafe-fix-a-resource-leak-in-the-error-ha.patch +arc-export-clear_user_page-for-modules.patch +qlcnic-remove-redundant-unlock-in-qlcnic_pinit_from_.patch +net-renesas-sh_eth-fix-freeing-wrong-tx-descriptor.patch -- 2.47.2