From: Sasha Levin Date: Fri, 18 Jun 2021 11:47:17 +0000 (-0400) Subject: Fixes for 5.4 X-Git-Tag: v5.4.128~64 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6028921037162e63ffd6f2dffd87c42c81af4c05;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/afs-fix-an-is_err-vs-null-check.patch b/queue-5.4/afs-fix-an-is_err-vs-null-check.patch new file mode 100644 index 00000000000..5d5561c7ed9 --- /dev/null +++ b/queue-5.4/afs-fix-an-is_err-vs-null-check.patch @@ -0,0 +1,41 @@ +From aa83ee52f01b5353ef90518708f484f36d6888f6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 15 Jun 2021 08:39:52 +0100 +Subject: afs: Fix an IS_ERR() vs NULL check + +From: Dan Carpenter + +[ Upstream commit a33d62662d275cee22888fa7760fe09d5b9cd1f9 ] + +The proc_symlink() function returns NULL on error, it doesn't return +error pointers. + +Fixes: 5b86d4ff5dce ("afs: Implement network namespacing") +Signed-off-by: Dan Carpenter +Signed-off-by: David Howells +cc: linux-afs@lists.infradead.org +Link: https://lore.kernel.org/r/YLjMRKX40pTrJvgf@mwanda/ +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + fs/afs/main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/fs/afs/main.c b/fs/afs/main.c +index 5cd26af2464c..d129a1a49616 100644 +--- a/fs/afs/main.c ++++ b/fs/afs/main.c +@@ -196,8 +196,8 @@ static int __init afs_init(void) + goto error_fs; + + afs_proc_symlink = proc_symlink("fs/afs", NULL, "../self/net/afs"); +- if (IS_ERR(afs_proc_symlink)) { +- ret = PTR_ERR(afs_proc_symlink); ++ if (!afs_proc_symlink) { ++ ret = -ENOMEM; + goto error_proc; + } + +-- +2.30.2 + diff --git a/queue-5.4/dmaengine-altera_msgdma-depends-on-has_iomem.patch b/queue-5.4/dmaengine-altera_msgdma-depends-on-has_iomem.patch new file mode 100644 index 00000000000..8bbe9478051 --- /dev/null +++ b/queue-5.4/dmaengine-altera_msgdma-depends-on-has_iomem.patch @@ -0,0 +1,49 @@ +From ca11f359937809fcd9b92c777c722c6023195d5b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 May 2021 19:13:10 -0700 +Subject: dmaengine: ALTERA_MSGDMA depends on HAS_IOMEM + +From: Randy Dunlap + +[ Upstream commit 253697b93c2a1c237d34d3ae326e394aeb0ca7b3 ] + +When CONFIG_HAS_IOMEM is not set/enabled, certain iomap() family +functions [including ioremap(), devm_ioremap(), etc.] are not +available. +Drivers that use these functions should depend on HAS_IOMEM so that +they do not cause build errors. + +Repairs this build error: +s390-linux-ld: drivers/dma/altera-msgdma.o: in function `request_and_map': +altera-msgdma.c:(.text+0x14b0): undefined reference to `devm_ioremap' + +Fixes: a85c6f1b2921 ("dmaengine: Add driver for Altera / Intel mSGDMA IP core") +Signed-off-by: Randy Dunlap +Reported-by: kernel test robot +Cc: Stefan Roese +Cc: Vinod Koul +Cc: dmaengine@vger.kernel.org +Reviewed-by: Stefan Roese +Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de +Link: https://lore.kernel.org/r/20210522021313.16405-2-rdunlap@infradead.org +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig +index 7af874b69ffb..a32d0d715247 100644 +--- a/drivers/dma/Kconfig ++++ b/drivers/dma/Kconfig +@@ -59,6 +59,7 @@ config DMA_OF + #devices + config ALTERA_MSGDMA + tristate "Altera / Intel mSGDMA Engine" ++ depends on HAS_IOMEM + select DMA_ENGINE + help + Enable support for Altera / Intel mSGDMA controller. +-- +2.30.2 + diff --git a/queue-5.4/dmaengine-qcom_hidma_mgmt-depends-on-has_iomem.patch b/queue-5.4/dmaengine-qcom_hidma_mgmt-depends-on-has_iomem.patch new file mode 100644 index 00000000000..a85befae28d --- /dev/null +++ b/queue-5.4/dmaengine-qcom_hidma_mgmt-depends-on-has_iomem.patch @@ -0,0 +1,50 @@ +From 3715583a84ccfc78ac6b02e35c101bb4e0bf9e54 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 May 2021 19:13:11 -0700 +Subject: dmaengine: QCOM_HIDMA_MGMT depends on HAS_IOMEM + +From: Randy Dunlap + +[ Upstream commit 0cfbb589d67f16fa55b26ae02b69c31b52e344b1 ] + +When CONFIG_HAS_IOMEM is not set/enabled, certain iomap() family +functions [including ioremap(), devm_ioremap(), etc.] are not +available. +Drivers that use these functions should depend on HAS_IOMEM so that +they do not cause build errors. + +Rectifies these build errors: +s390-linux-ld: drivers/dma/qcom/hidma_mgmt.o: in function `hidma_mgmt_probe': +hidma_mgmt.c:(.text+0x780): undefined reference to `devm_ioremap_resource' +s390-linux-ld: drivers/dma/qcom/hidma_mgmt.o: in function `hidma_mgmt_init': +hidma_mgmt.c:(.init.text+0x126): undefined reference to `of_address_to_resource' +s390-linux-ld: hidma_mgmt.c:(.init.text+0x16e): undefined reference to `of_address_to_resource' + +Fixes: 67a2003e0607 ("dmaengine: add Qualcomm Technologies HIDMA channel driver") +Signed-off-by: Randy Dunlap +Reported-by: kernel test robot +Cc: Sinan Kaya +Cc: Vinod Koul +Cc: dmaengine@vger.kernel.org +Link: https://lore.kernel.org/r/20210522021313.16405-3-rdunlap@infradead.org +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/qcom/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/dma/qcom/Kconfig b/drivers/dma/qcom/Kconfig +index 1d189438aeb0..bef309ef6a71 100644 +--- a/drivers/dma/qcom/Kconfig ++++ b/drivers/dma/qcom/Kconfig +@@ -10,6 +10,7 @@ config QCOM_BAM_DMA + + config QCOM_HIDMA_MGMT + tristate "Qualcomm Technologies HIDMA Management support" ++ depends on HAS_IOMEM + select DMA_ENGINE + help + Enable support for the Qualcomm Technologies HIDMA Management. +-- +2.30.2 + diff --git a/queue-5.4/dmaengine-stedma40-add-missing-iounmap-on-error-in-d.patch b/queue-5.4/dmaengine-stedma40-add-missing-iounmap-on-error-in-d.patch new file mode 100644 index 00000000000..d6c8be2322b --- /dev/null +++ b/queue-5.4/dmaengine-stedma40-add-missing-iounmap-on-error-in-d.patch @@ -0,0 +1,40 @@ +From e9e3facda2fa6d9295c1c9aba89e9a0a0265a78a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 May 2021 22:11:08 +0800 +Subject: dmaengine: stedma40: add missing iounmap() on error in d40_probe() + +From: Yang Yingliang + +[ Upstream commit fffdaba402cea79b8d219355487d342ec23f91c6 ] + +Add the missing iounmap() before return from d40_probe() +in the error handling case. + +Fixes: 8d318a50b3d7 ("DMAENGINE: Support for ST-Ericssons DMA40 block v3") +Reported-by: Hulk Robot +Signed-off-by: Yang Yingliang +Reviewed-by: Linus Walleij +Link: https://lore.kernel.org/r/20210518141108.1324127-1-yangyingliang@huawei.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/ste_dma40.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c +index de8bfd9a76e9..6671bfe08489 100644 +--- a/drivers/dma/ste_dma40.c ++++ b/drivers/dma/ste_dma40.c +@@ -3678,6 +3678,9 @@ static int __init d40_probe(struct platform_device *pdev) + + kfree(base->lcla_pool.base_unaligned); + ++ if (base->lcpa_base) ++ iounmap(base->lcpa_base); ++ + if (base->phy_lcpa) + release_mem_region(base->phy_lcpa, + base->lcpa_size); +-- +2.30.2 + diff --git a/queue-5.4/mm-memory-failure-make-sure-wait-for-page-writeback-.patch b/queue-5.4/mm-memory-failure-make-sure-wait-for-page-writeback-.patch new file mode 100644 index 00000000000..ae9cd7042e7 --- /dev/null +++ b/queue-5.4/mm-memory-failure-make-sure-wait-for-page-writeback-.patch @@ -0,0 +1,84 @@ +From b4c7ffec876ec119e18177ac65616777a5266a07 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 15 Jun 2021 18:23:32 -0700 +Subject: mm/memory-failure: make sure wait for page writeback in + memory_failure + +From: yangerkun + +[ Upstream commit e8675d291ac007e1c636870db880f837a9ea112a ] + +Our syzkaller trigger the "BUG_ON(!list_empty(&inode->i_wb_list))" in +clear_inode: + + kernel BUG at fs/inode.c:519! + Internal error: Oops - BUG: 0 [#1] SMP + Modules linked in: + Process syz-executor.0 (pid: 249, stack limit = 0x00000000a12409d7) + CPU: 1 PID: 249 Comm: syz-executor.0 Not tainted 4.19.95 + Hardware name: linux,dummy-virt (DT) + pstate: 80000005 (Nzcv daif -PAN -UAO) + pc : clear_inode+0x280/0x2a8 + lr : clear_inode+0x280/0x2a8 + Call trace: + clear_inode+0x280/0x2a8 + ext4_clear_inode+0x38/0xe8 + ext4_free_inode+0x130/0xc68 + ext4_evict_inode+0xb20/0xcb8 + evict+0x1a8/0x3c0 + iput+0x344/0x460 + do_unlinkat+0x260/0x410 + __arm64_sys_unlinkat+0x6c/0xc0 + el0_svc_common+0xdc/0x3b0 + el0_svc_handler+0xf8/0x160 + el0_svc+0x10/0x218 + Kernel panic - not syncing: Fatal exception + +A crash dump of this problem show that someone called __munlock_pagevec +to clear page LRU without lock_page: do_mmap -> mmap_region -> do_munmap +-> munlock_vma_pages_range -> __munlock_pagevec. + +As a result memory_failure will call identify_page_state without +wait_on_page_writeback. And after truncate_error_page clear the mapping +of this page. end_page_writeback won't call sb_clear_inode_writeback to +clear inode->i_wb_list. That will trigger BUG_ON in clear_inode! + +Fix it by checking PageWriteback too to help determine should we skip +wait_on_page_writeback. + +Link: https://lkml.kernel.org/r/20210604084705.3729204-1-yangerkun@huawei.com +Fixes: 0bc1f8b0682c ("hwpoison: fix the handling path of the victimized page frame that belong to non-LRU") +Signed-off-by: yangerkun +Acked-by: Naoya Horiguchi +Cc: Jan Kara +Cc: Theodore Ts'o +Cc: Oscar Salvador +Cc: Yu Kuai +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + mm/memory-failure.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/mm/memory-failure.c b/mm/memory-failure.c +index d823ec74f3fc..9030ab0d9d97 100644 +--- a/mm/memory-failure.c ++++ b/mm/memory-failure.c +@@ -1382,7 +1382,12 @@ int memory_failure(unsigned long pfn, int flags) + return 0; + } + +- if (!PageTransTail(p) && !PageLRU(p)) ++ /* ++ * __munlock_pagevec may clear a writeback page's LRU flag without ++ * page_lock. We need wait writeback completion for this page or it ++ * may trigger vfs BUG while evict inode. ++ */ ++ if (!PageTransTail(p) && !PageLRU(p) && !PageWriteback(p)) + goto identify_page_state; + + /* +-- +2.30.2 + diff --git a/queue-5.4/series b/queue-5.4/series new file mode 100644 index 00000000000..577e8a8fd01 --- /dev/null +++ b/queue-5.4/series @@ -0,0 +1,5 @@ +dmaengine-altera_msgdma-depends-on-has_iomem.patch +dmaengine-qcom_hidma_mgmt-depends-on-has_iomem.patch +dmaengine-stedma40-add-missing-iounmap-on-error-in-d.patch +afs-fix-an-is_err-vs-null-check.patch +mm-memory-failure-make-sure-wait-for-page-writeback-.patch