linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5.10 00/21] 5.10.79-rc1 review
@ 2021-11-10 18:43 Greg Kroah-Hartman
  2021-11-10 18:43 ` [PATCH 5.10 01/21] KVM: x86: avoid warning with -Wbitwise-instead-of-logical Greg Kroah-Hartman
                   ` (26 more replies)
  0 siblings, 27 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, torvalds, akpm, linux, shuah, patches,
	lkft-triage, pavel, jonathanh, f.fainelli, stable

This is the start of the stable review cycle for the 5.10.79 release.
There are 21 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Fri, 12 Nov 2021 18:19:54 +0000.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.79-rc1.gz
or in the git tree and branch at:
	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Linux 5.10.79-rc1

Johan Hovold <johan@kernel.org>
    rsi: fix control-message timeout

Gustavo A. R. Silva <gustavoars@kernel.org>
    media: staging/intel-ipu3: css: Fix wrong size comparison imgu_css_fw_init

Johan Hovold <johan@kernel.org>
    staging: rtl8192u: fix control-message timeouts

Johan Hovold <johan@kernel.org>
    staging: r8712u: fix control-message timeout

Johan Hovold <johan@kernel.org>
    comedi: vmk80xx: fix bulk and interrupt message timeouts

Johan Hovold <johan@kernel.org>
    comedi: vmk80xx: fix bulk-buffer overflow

Johan Hovold <johan@kernel.org>
    comedi: vmk80xx: fix transfer-buffer overflows

Johan Hovold <johan@kernel.org>
    comedi: ni_usb6501: fix NULL-deref in command paths

Johan Hovold <johan@kernel.org>
    comedi: dt9812: fix DMA buffers on stack

Jan Kara <jack@suse.cz>
    isofs: Fix out of bound access for corrupted isofs image

Pavel Skripkin <paskripkin@gmail.com>
    staging: rtl8712: fix use-after-free in rtl8712_dl_fw

Petr Mladek <pmladek@suse.com>
    printk/console: Allow to disable console output by using console="" or console=null

Todd Kjos <tkjos@google.com>
    binder: don't detect sender/target during buffer cleanup

James Buren <braewoods+lkml@braewoods.net>
    usb-storage: Add compatibility quirk flags for iODD 2531/2541

Viraj Shah <viraj.shah@linutronix.de>
    usb: musb: Balance list entry in musb_gadget_queue

Geert Uytterhoeven <geert@linux-m68k.org>
    usb: gadget: Mark USB_FSL_QE broken on 64-bit

Yang Shi <shy828301@gmail.com>
    mm: filemap: check if THP has hwpoisoned subpage for PMD page fault

Yang Shi <shy828301@gmail.com>
    mm: hwpoison: remove the unnecessary THP check

Neal Liu <neal_liu@aspeedtech.com>
    usb: ehci: handshake CMD_RUN instead of STS_HALT

Juergen Gross <jgross@suse.com>
    Revert "x86/kvm: fix vcpu-id indexed array sizes"

Paolo Bonzini <pbonzini@redhat.com>
    KVM: x86: avoid warning with -Wbitwise-instead-of-logical


-------------

Diffstat:

 Makefile                                    |   4 +-
 arch/x86/kvm/ioapic.c                       |   2 +-
 arch/x86/kvm/ioapic.h                       |   4 +-
 arch/x86/kvm/mmu/mmu.c                      |   2 +-
 drivers/android/binder.c                    |  14 ++--
 drivers/net/wireless/rsi/rsi_91x_usb.c      |   2 +-
 drivers/staging/comedi/drivers/dt9812.c     | 115 +++++++++++++++++++++-------
 drivers/staging/comedi/drivers/ni_usb6501.c |  10 +++
 drivers/staging/comedi/drivers/vmk80xx.c    |  28 +++----
 drivers/staging/media/ipu3/ipu3-css-fw.c    |   7 +-
 drivers/staging/media/ipu3/ipu3-css-fw.h    |   2 +-
 drivers/staging/rtl8192u/r8192U_core.c      |  18 ++---
 drivers/staging/rtl8712/usb_intf.c          |   4 +-
 drivers/staging/rtl8712/usb_ops_linux.c     |   2 +-
 drivers/usb/gadget/udc/Kconfig              |   1 +
 drivers/usb/host/ehci-hcd.c                 |  11 ++-
 drivers/usb/host/ehci-platform.c            |   6 ++
 drivers/usb/host/ehci.h                     |   1 +
 drivers/usb/musb/musb_gadget.c              |   4 +-
 drivers/usb/storage/unusual_devs.h          |  10 +++
 fs/isofs/inode.c                            |   2 +
 include/linux/page-flags.h                  |  23 ++++++
 kernel/printk/printk.c                      |   9 ++-
 mm/huge_memory.c                            |   2 +
 mm/memory-failure.c                         |  28 +++----
 mm/memory.c                                 |   9 +++
 mm/page_alloc.c                             |   4 +-
 27 files changed, 233 insertions(+), 91 deletions(-)



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 01/21] KVM: x86: avoid warning with -Wbitwise-instead-of-logical
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
@ 2021-11-10 18:43 ` Greg Kroah-Hartman
  2021-11-10 18:43 ` [PATCH 5.10 02/21] Revert "x86/kvm: fix vcpu-id indexed array sizes" Greg Kroah-Hartman
                   ` (25 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, torvic9, Paolo Bonzini, Nathan Chancellor

From: Paolo Bonzini <pbonzini@redhat.com>

commit 3d5e7a28b1ea2d603dea478e58e37ce75b9597ab upstream.

This is a new warning in clang top-of-tree (will be clang 14):

In file included from arch/x86/kvm/mmu/mmu.c:27:
arch/x86/kvm/mmu/spte.h:318:9: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
        return __is_bad_mt_xwr(rsvd_check, spte) |
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                 ||
arch/x86/kvm/mmu/spte.h:318:9: note: cast one or both operands to int to silence this warning

The code is fine, but change it anyway to shut up this clever clogs
of a compiler.

Reported-by: torvic9@mailbox.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[nathan: Backport to 5.10, which does not have 961f84457cd4]
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/x86/kvm/mmu/mmu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -3545,7 +3545,7 @@ static bool get_mmio_spte(struct kvm_vcp
 		 * reserved bit and EPT's invalid memtype/XWR checks to avoid
 		 * adding a Jcc in the loop.
 		 */
-		reserved |= __is_bad_mt_xwr(rsvd_check, sptes[level - 1]) |
+		reserved |= __is_bad_mt_xwr(rsvd_check, sptes[level - 1]) ||
 			    __is_rsvd_bits_set(rsvd_check, sptes[level - 1],
 					       level);
 	}



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 02/21] Revert "x86/kvm: fix vcpu-id indexed array sizes"
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
  2021-11-10 18:43 ` [PATCH 5.10 01/21] KVM: x86: avoid warning with -Wbitwise-instead-of-logical Greg Kroah-Hartman
@ 2021-11-10 18:43 ` Greg Kroah-Hartman
  2021-11-10 18:43 ` [PATCH 5.10 03/21] usb: ehci: handshake CMD_RUN instead of STS_HALT Greg Kroah-Hartman
                   ` (24 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Eduardo Habkost, Juergen Gross,
	Paolo Bonzini

From: Juergen Gross <jgross@suse.com>

commit 1e254d0d86a0f2efd4190a89d5204b37c18c6381 upstream.

This reverts commit 76b4f357d0e7d8f6f0013c733e6cba1773c266d3.

The commit has the wrong reasoning, as KVM_MAX_VCPU_ID is not defining the
maximum allowed vcpu-id as its name suggests, but the number of vcpu-ids.
So revert this patch again.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20210913135745.13944-2-jgross@suse.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/x86/kvm/ioapic.c |    2 +-
 arch/x86/kvm/ioapic.h |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

--- a/arch/x86/kvm/ioapic.c
+++ b/arch/x86/kvm/ioapic.c
@@ -96,7 +96,7 @@ static unsigned long ioapic_read_indirec
 static void rtc_irq_eoi_tracking_reset(struct kvm_ioapic *ioapic)
 {
 	ioapic->rtc_status.pending_eoi = 0;
-	bitmap_zero(ioapic->rtc_status.dest_map.map, KVM_MAX_VCPU_ID + 1);
+	bitmap_zero(ioapic->rtc_status.dest_map.map, KVM_MAX_VCPU_ID);
 }
 
 static void kvm_rtc_eoi_tracking_restore_all(struct kvm_ioapic *ioapic);
--- a/arch/x86/kvm/ioapic.h
+++ b/arch/x86/kvm/ioapic.h
@@ -43,13 +43,13 @@ struct kvm_vcpu;
 
 struct dest_map {
 	/* vcpu bitmap where IRQ has been sent */
-	DECLARE_BITMAP(map, KVM_MAX_VCPU_ID + 1);
+	DECLARE_BITMAP(map, KVM_MAX_VCPU_ID);
 
 	/*
 	 * Vector sent to a given vcpu, only valid when
 	 * the vcpu's bit in map is set
 	 */
-	u8 vectors[KVM_MAX_VCPU_ID + 1];
+	u8 vectors[KVM_MAX_VCPU_ID];
 };
 
 



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 03/21] usb: ehci: handshake CMD_RUN instead of STS_HALT
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
  2021-11-10 18:43 ` [PATCH 5.10 01/21] KVM: x86: avoid warning with -Wbitwise-instead-of-logical Greg Kroah-Hartman
  2021-11-10 18:43 ` [PATCH 5.10 02/21] Revert "x86/kvm: fix vcpu-id indexed array sizes" Greg Kroah-Hartman
@ 2021-11-10 18:43 ` Greg Kroah-Hartman
  2021-11-10 18:43 ` [PATCH 5.10 04/21] mm: hwpoison: remove the unnecessary THP check Greg Kroah-Hartman
                   ` (23 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Tao Ren, Alan Stern, Neal Liu, Joel Stanley

From: Neal Liu <neal_liu@aspeedtech.com>

commit 7f2d73788d9067fd4f677ac5f60ffd25945af7af upstream.

For Aspeed, HCHalted status depends on not only Run/Stop but also
ASS/PSS status.
Handshake CMD_RUN on startup instead.

Tested-by: Tao Ren <rentao.bupt@gmail.com>
Reviewed-by: Tao Ren <rentao.bupt@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Neal Liu <neal_liu@aspeedtech.com>
Link: https://lore.kernel.org/r/20210910073619.26095-1-neal_liu@aspeedtech.com
Cc: Joel Stanley <joel@jms.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/host/ehci-hcd.c      |   11 ++++++++++-
 drivers/usb/host/ehci-platform.c |    6 ++++++
 drivers/usb/host/ehci.h          |    1 +
 3 files changed, 17 insertions(+), 1 deletion(-)

--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -634,7 +634,16 @@ static int ehci_run (struct usb_hcd *hcd
 	/* Wait until HC become operational */
 	ehci_readl(ehci, &ehci->regs->command);	/* unblock posted writes */
 	msleep(5);
-	rc = ehci_handshake(ehci, &ehci->regs->status, STS_HALT, 0, 100 * 1000);
+
+	/* For Aspeed, STS_HALT also depends on ASS/PSS status.
+	 * Check CMD_RUN instead.
+	 */
+	if (ehci->is_aspeed)
+		rc = ehci_handshake(ehci, &ehci->regs->command, CMD_RUN,
+				    1, 100 * 1000);
+	else
+		rc = ehci_handshake(ehci, &ehci->regs->status, STS_HALT,
+				    0, 100 * 1000);
 
 	up_write(&ehci_cf_port_reset_rwsem);
 
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -294,6 +294,12 @@ static int ehci_platform_probe(struct pl
 					  "has-transaction-translator"))
 			hcd->has_tt = 1;
 
+		if (of_device_is_compatible(dev->dev.of_node,
+					    "aspeed,ast2500-ehci") ||
+		    of_device_is_compatible(dev->dev.of_node,
+					    "aspeed,ast2600-ehci"))
+			ehci->is_aspeed = 1;
+
 		if (soc_device_match(quirk_poll_match))
 			priv->quirk_poll = true;
 
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -218,6 +218,7 @@ struct ehci_hcd {			/* one per controlle
 	unsigned		frame_index_bug:1; /* MosChip (AKA NetMos) */
 	unsigned		need_oc_pp_cycle:1; /* MPC834X port power */
 	unsigned		imx28_write_fix:1; /* For Freescale i.MX28 */
+	unsigned		is_aspeed:1;
 
 	/* required for usb32 quirk */
 	#define OHCI_CTRL_HCFS          (3 << 6)



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 04/21] mm: hwpoison: remove the unnecessary THP check
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2021-11-10 18:43 ` [PATCH 5.10 03/21] usb: ehci: handshake CMD_RUN instead of STS_HALT Greg Kroah-Hartman
@ 2021-11-10 18:43 ` Greg Kroah-Hartman
  2021-11-10 18:43 ` [PATCH 5.10 05/21] mm: filemap: check if THP has hwpoisoned subpage for PMD page fault Greg Kroah-Hartman
                   ` (22 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yang Shi, Naoya Horiguchi,
	Hugh Dickins, Kirill A. Shutemov, Matthew Wilcox, Oscar Salvador,
	Peter Xu, Andrew Morton, Linus Torvalds

From: Yang Shi <shy828301@gmail.com>

commit c7cb42e94473aafe553c0f2a3d8ca904599399ed upstream.

When handling THP hwpoison checked if the THP is in allocation or free
stage since hwpoison may mistreat it as hugetlb page.  After commit
415c64c1453a ("mm/memory-failure: split thp earlier in memory error
handling") the problem has been fixed, so this check is no longer
needed.  Remove it.  The side effect of the removal is hwpoison may
report unsplit THP instead of unknown error for shmem THP.  It seems not
like a big deal.

The following patch "mm: filemap: check if THP has hwpoisoned subpage
for PMD page fault" depends on this, which fixes shmem THP with
hwpoisoned subpage(s) are mapped PMD wrongly.  So this patch needs to be
backported to -stable as well.

Link: https://lkml.kernel.org/r/20211020210755.23964-2-shy828301@gmail.com
Signed-off-by: Yang Shi <shy828301@gmail.com>
Suggested-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Peter Xu <peterx@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 mm/memory-failure.c |   14 --------------
 1 file changed, 14 deletions(-)

--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -956,20 +956,6 @@ static int get_hwpoison_page(struct page
 {
 	struct page *head = compound_head(page);
 
-	if (!PageHuge(head) && PageTransHuge(head)) {
-		/*
-		 * Non anonymous thp exists only in allocation/free time. We
-		 * can't handle such a case correctly, so let's give it up.
-		 * This should be better than triggering BUG_ON when kernel
-		 * tries to touch the "partially handled" page.
-		 */
-		if (!PageAnon(head)) {
-			pr_err("Memory failure: %#lx: non anonymous thp\n",
-				page_to_pfn(page));
-			return 0;
-		}
-	}
-
 	if (get_page_unless_zero(head)) {
 		if (head == compound_head(page))
 			return 1;



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 05/21] mm: filemap: check if THP has hwpoisoned subpage for PMD page fault
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2021-11-10 18:43 ` [PATCH 5.10 04/21] mm: hwpoison: remove the unnecessary THP check Greg Kroah-Hartman
@ 2021-11-10 18:43 ` Greg Kroah-Hartman
  2021-11-10 18:43 ` [PATCH 5.10 06/21] usb: gadget: Mark USB_FSL_QE broken on 64-bit Greg Kroah-Hartman
                   ` (21 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yang Shi, Naoya Horiguchi,
	Kirill A. Shutemov, Hugh Dickins, Matthew Wilcox, Oscar Salvador,
	Peter Xu, Andrew Morton, Linus Torvalds

From: Yang Shi <shy828301@gmail.com>

commit eac96c3efdb593df1a57bb5b95dbe037bfa9a522 upstream.

When handling shmem page fault the THP with corrupted subpage could be
PMD mapped if certain conditions are satisfied.  But kernel is supposed
to send SIGBUS when trying to map hwpoisoned page.

There are two paths which may do PMD map: fault around and regular
fault.

Before commit f9ce0be71d1f ("mm: Cleanup faultaround and finish_fault()
codepaths") the thing was even worse in fault around path.  The THP
could be PMD mapped as long as the VMA fits regardless what subpage is
accessed and corrupted.  After this commit as long as head page is not
corrupted the THP could be PMD mapped.

In the regular fault path the THP could be PMD mapped as long as the
corrupted page is not accessed and the VMA fits.

This loophole could be fixed by iterating every subpage to check if any
of them is hwpoisoned or not, but it is somewhat costly in page fault
path.

So introduce a new page flag called HasHWPoisoned on the first tail
page.  It indicates the THP has hwpoisoned subpage(s).  It is set if any
subpage of THP is found hwpoisoned by memory failure and after the
refcount is bumped successfully, then cleared when the THP is freed or
split.

The soft offline path doesn't need this since soft offline handler just
marks a subpage hwpoisoned when the subpage is migrated successfully.
But shmem THP didn't get split then migrated at all.

Link: https://lkml.kernel.org/r/20211020210755.23964-3-shy828301@gmail.com
Fixes: 800d8c63b2e9 ("shmem: add huge pages support")
Signed-off-by: Yang Shi <shy828301@gmail.com>
Reviewed-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Suggested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Peter Xu <peterx@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/linux/page-flags.h |   23 +++++++++++++++++++++++
 mm/huge_memory.c           |    2 ++
 mm/memory-failure.c        |   14 ++++++++++++++
 mm/memory.c                |    9 +++++++++
 mm/page_alloc.c            |    4 +++-
 5 files changed, 51 insertions(+), 1 deletion(-)

--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -169,6 +169,15 @@ enum pageflags {
 	/* Compound pages. Stored in first tail page's flags */
 	PG_double_map = PG_workingset,
 
+#ifdef CONFIG_MEMORY_FAILURE
+	/*
+	 * Compound pages. Stored in first tail page's flags.
+	 * Indicates that at least one subpage is hwpoisoned in the
+	 * THP.
+	 */
+	PG_has_hwpoisoned = PG_mappedtodisk,
+#endif
+
 	/* non-lru isolated movable page */
 	PG_isolated = PG_reclaim,
 
@@ -701,6 +710,20 @@ PAGEFLAG_FALSE(DoubleMap)
 	TESTSCFLAG_FALSE(DoubleMap)
 #endif
 
+#if defined(CONFIG_MEMORY_FAILURE) && defined(CONFIG_TRANSPARENT_HUGEPAGE)
+/*
+ * PageHasHWPoisoned indicates that at least one subpage is hwpoisoned in the
+ * compound page.
+ *
+ * This flag is set by hwpoison handler.  Cleared by THP split or free page.
+ */
+PAGEFLAG(HasHWPoisoned, has_hwpoisoned, PF_SECOND)
+	TESTSCFLAG(HasHWPoisoned, has_hwpoisoned, PF_SECOND)
+#else
+PAGEFLAG_FALSE(HasHWPoisoned)
+	TESTSCFLAG_FALSE(HasHWPoisoned)
+#endif
+
 /*
  * For pages that are never mapped to userspace (and aren't PageSlab),
  * page_type may be used.  Because it is initialised to -1, we invert the
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2464,6 +2464,8 @@ static void __split_huge_page(struct pag
 		xa_lock(&swap_cache->i_pages);
 	}
 
+	ClearPageHasHWPoisoned(head);
+
 	for (i = nr - 1; i >= 1; i--) {
 		__split_huge_page_tail(head, i, lruvec, list);
 		/* Some pages can be beyond i_size: drop them from page cache */
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1367,6 +1367,20 @@ int memory_failure(unsigned long pfn, in
 	}
 
 	if (PageTransHuge(hpage)) {
+		/*
+		 * The flag must be set after the refcount is bumped
+		 * otherwise it may race with THP split.
+		 * And the flag can't be set in get_hwpoison_page() since
+		 * it is called by soft offline too and it is just called
+		 * for !MF_COUNT_INCREASE.  So here seems to be the best
+		 * place.
+		 *
+		 * Don't need care about the above error handling paths for
+		 * get_hwpoison_page() since they handle either free page
+		 * or unhandlable page.  The refcount is bumped iff the
+		 * page is a valid handlable page.
+		 */
+		SetPageHasHWPoisoned(hpage);
 		if (try_to_split_thp_page(p, "Memory Failure") < 0) {
 			action_result(pfn, MF_MSG_UNSPLIT_THP, MF_IGNORED);
 			return -EBUSY;
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3921,6 +3921,15 @@ vm_fault_t finish_fault(struct vm_fault
 		page = vmf->page;
 
 	/*
+	 * Just backoff if any subpage of a THP is corrupted otherwise
+	 * the corrupted page may mapped by PMD silently to escape the
+	 * check.  This kind of THP just can be PTE mapped.  Access to
+	 * the corrupted subpage should trigger SIGBUS as expected.
+	 */
+	if (unlikely(PageHasHWPoisoned(page)))
+		return ret;
+
+	/*
 	 * check even for read faults because we might have lost our CoWed
 	 * page
 	 */
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1232,8 +1232,10 @@ static __always_inline bool free_pages_p
 
 		VM_BUG_ON_PAGE(compound && compound_order(page) != order, page);
 
-		if (compound)
+		if (compound) {
 			ClearPageDoubleMap(page);
+			ClearPageHasHWPoisoned(page);
+		}
 		for (i = 1; i < (1 << order); i++) {
 			if (compound)
 				bad += free_tail_pages_check(page, page + i);



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 06/21] usb: gadget: Mark USB_FSL_QE broken on 64-bit
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2021-11-10 18:43 ` [PATCH 5.10 05/21] mm: filemap: check if THP has hwpoisoned subpage for PMD page fault Greg Kroah-Hartman
@ 2021-11-10 18:43 ` Greg Kroah-Hartman
  2021-11-10 18:43 ` [PATCH 5.10 07/21] usb: musb: Balance list entry in musb_gadget_queue Greg Kroah-Hartman
                   ` (20 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Li Yang, Geert Uytterhoeven

From: Geert Uytterhoeven <geert@linux-m68k.org>

commit a0548b26901f082684ad1fb3ba397d2de3a1406a upstream.

On 64-bit:

    drivers/usb/gadget/udc/fsl_qe_udc.c: In function ‘qe_ep0_rx’:
    drivers/usb/gadget/udc/fsl_qe_udc.c:842:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
      842 |     vaddr = (u32)phys_to_virt(in_be32(&bd->buf));
	  |             ^
    In file included from drivers/usb/gadget/udc/fsl_qe_udc.c:41:
    drivers/usb/gadget/udc/fsl_qe_udc.c:843:28: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
      843 |     frame_set_data(pframe, (u8 *)vaddr);
	  |                            ^

The driver assumes physical and virtual addresses are 32-bit, hence it
cannot work on 64-bit platforms.

Acked-by: Li Yang <leoyang.li@nxp.com>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/20211027080849.3276289-1-geert@linux-m68k.org
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/gadget/udc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig
index 8c614bb86c66..69394dc1cdfb 100644
--- a/drivers/usb/gadget/udc/Kconfig
+++ b/drivers/usb/gadget/udc/Kconfig
@@ -330,6 +330,7 @@ config USB_AMD5536UDC
 config USB_FSL_QE
 	tristate "Freescale QE/CPM USB Device Controller"
 	depends on FSL_SOC && (QUICC_ENGINE || CPM)
+	depends on !64BIT || BROKEN
 	help
 	   Some of Freescale PowerPC processors have a Full Speed
 	   QE/CPM2 USB controller, which support device mode with 4
-- 
2.33.1




^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 5.10 07/21] usb: musb: Balance list entry in musb_gadget_queue
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (5 preceding siblings ...)
  2021-11-10 18:43 ` [PATCH 5.10 06/21] usb: gadget: Mark USB_FSL_QE broken on 64-bit Greg Kroah-Hartman
@ 2021-11-10 18:43 ` Greg Kroah-Hartman
  2021-11-10 18:43 ` [PATCH 5.10 08/21] usb-storage: Add compatibility quirk flags for iODD 2531/2541 Greg Kroah-Hartman
                   ` (19 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Viraj Shah

From: Viraj Shah <viraj.shah@linutronix.de>

commit 21b5fcdccb32ff09b6b63d4a83c037150665a83f upstream.

musb_gadget_queue() adds the passed request to musb_ep::req_list. If the
endpoint is idle and it is the first request then it invokes
musb_queue_resume_work(). If the function returns an error then the
error is passed to the caller without any clean-up and the request
remains enqueued on the list. If the caller enqueues the request again
then the list corrupts.

Remove the request from the list on error.

Fixes: ea2f35c01d5ea ("usb: musb: Fix sleeping function called from invalid context for hdrc glue")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Viraj Shah <viraj.shah@linutronix.de>
Link: https://lore.kernel.org/r/20211021093644.4734-1-viraj.shah@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/musb/musb_gadget.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1247,9 +1247,11 @@ static int musb_gadget_queue(struct usb_
 		status = musb_queue_resume_work(musb,
 						musb_ep_restart_resume_work,
 						request);
-		if (status < 0)
+		if (status < 0) {
 			dev_err(musb->controller, "%s resume work: %i\n",
 				__func__, status);
+			list_del(&request->list);
+		}
 	}
 
 unlock:



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 08/21] usb-storage: Add compatibility quirk flags for iODD 2531/2541
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (6 preceding siblings ...)
  2021-11-10 18:43 ` [PATCH 5.10 07/21] usb: musb: Balance list entry in musb_gadget_queue Greg Kroah-Hartman
@ 2021-11-10 18:43 ` Greg Kroah-Hartman
  2021-11-10 18:43 ` [PATCH 5.10 09/21] binder: dont detect sender/target during buffer cleanup Greg Kroah-Hartman
                   ` (18 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Alan Stern, James Buren

From: James Buren <braewoods+lkml@braewoods.net>

commit 05c8f1b67e67dcd786ae3fe44492bbc617b4bd12 upstream.

These drive enclosures have firmware bugs that make it impossible to mount
a new virtual ISO image after Linux ejects the old one if the device is
locked by Linux. Windows bypasses this problem by the fact that they do
not lock the device. Add a quirk to disable device locking for these
drive enclosures.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Buren <braewoods+lkml@braewoods.net>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20211014015504.2695089-1-braewoods+lkml@braewoods.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/storage/unusual_devs.h |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -407,6 +407,16 @@ UNUSUAL_DEV(  0x04b8, 0x0602, 0x0110, 0x
 		USB_SC_SCSI, USB_PR_BULK, NULL, US_FL_SINGLE_LUN),
 
 /*
+ * Reported by James Buren <braewoods+lkml@braewoods.net>
+ * Virtual ISOs cannot be remounted if ejected while the device is locked
+ * Disable locking to mimic Windows behavior that bypasses the issue
+ */
+UNUSUAL_DEV(  0x04c5, 0x2028, 0x0001, 0x0001,
+		"iODD",
+		"2531/2541",
+		USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE),
+
+/*
  * Not sure who reported this originally but
  * Pavel Machek <pavel@ucw.cz> reported that the extra US_FL_SINGLE_LUN
  * flag be added */



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 09/21] binder: dont detect sender/target during buffer cleanup
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (7 preceding siblings ...)
  2021-11-10 18:43 ` [PATCH 5.10 08/21] usb-storage: Add compatibility quirk flags for iODD 2531/2541 Greg Kroah-Hartman
@ 2021-11-10 18:43 ` Greg Kroah-Hartman
  2021-11-10 18:43 ` [PATCH 5.10 10/21] printk/console: Allow to disable console output by using console="" or console=null Greg Kroah-Hartman
                   ` (17 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Christian Brauner, Todd Kjos

From: Todd Kjos <tkjos@google.com>

commit 32e9f56a96d8d0f23cb2aeb2a3cd18d40393e787 upstream.

When freeing txn buffers, binder_transaction_buffer_release()
attempts to detect whether the current context is the target by
comparing current->group_leader to proc->tsk. This is an unreliable
test. Instead explicitly pass an 'is_failure' boolean.

Detecting the sender was being used as a way to tell if the
transaction failed to be sent.  When cleaning up after
failing to send a transaction, there is no need to close
the fds associated with a BINDER_TYPE_FDA object. Now
'is_failure' can be used to accurately detect this case.

Fixes: 44d8047f1d87 ("binder: use standard functions to allocate fds")
Cc: stable <stable@vger.kernel.org>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Todd Kjos <tkjos@google.com>
Link: https://lore.kernel.org/r/20211015233811.3532235-1-tkjos@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/android/binder.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -2254,7 +2254,7 @@ static void binder_transaction_buffer_re
 		binder_dec_node(buffer->target_node, 1, 0);
 
 	off_start_offset = ALIGN(buffer->data_size, sizeof(void *));
-	off_end_offset = is_failure ? failed_at :
+	off_end_offset = is_failure && failed_at ? failed_at :
 				off_start_offset + buffer->offsets_size;
 	for (buffer_offset = off_start_offset; buffer_offset < off_end_offset;
 	     buffer_offset += sizeof(binder_size_t)) {
@@ -2340,9 +2340,8 @@ static void binder_transaction_buffer_re
 			binder_size_t fd_buf_size;
 			binder_size_t num_valid;
 
-			if (proc->tsk != current->group_leader) {
+			if (is_failure) {
 				/*
-				 * Nothing to do if running in sender context
 				 * The fd fixups have not been applied so no
 				 * fds need to be closed.
 				 */
@@ -3544,6 +3543,7 @@ err_invalid_target_handle:
  * binder_free_buf() - free the specified buffer
  * @proc:	binder proc that owns buffer
  * @buffer:	buffer to be freed
+ * @is_failure:	failed to send transaction
  *
  * If buffer for an async transaction, enqueue the next async
  * transaction from the node.
@@ -3553,7 +3553,7 @@ err_invalid_target_handle:
 static void
 binder_free_buf(struct binder_proc *proc,
 		struct binder_thread *thread,
-		struct binder_buffer *buffer)
+		struct binder_buffer *buffer, bool is_failure)
 {
 	binder_inner_proc_lock(proc);
 	if (buffer->transaction) {
@@ -3581,7 +3581,7 @@ binder_free_buf(struct binder_proc *proc
 		binder_node_inner_unlock(buf_node);
 	}
 	trace_binder_transaction_buffer_release(buffer);
-	binder_transaction_buffer_release(proc, thread, buffer, 0, false);
+	binder_transaction_buffer_release(proc, thread, buffer, 0, is_failure);
 	binder_alloc_free_buf(&proc->alloc, buffer);
 }
 
@@ -3782,7 +3782,7 @@ static int binder_thread_write(struct bi
 				     proc->pid, thread->pid, (u64)data_ptr,
 				     buffer->debug_id,
 				     buffer->transaction ? "active" : "finished");
-			binder_free_buf(proc, thread, buffer);
+			binder_free_buf(proc, thread, buffer, false);
 			break;
 		}
 
@@ -4470,7 +4470,7 @@ retry:
 			buffer->transaction = NULL;
 			binder_cleanup_transaction(t, "fd fixups failed",
 						   BR_FAILED_REPLY);
-			binder_free_buf(proc, thread, buffer);
+			binder_free_buf(proc, thread, buffer, true);
 			binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
 				     "%d:%d %stransaction %d fd fixups failed %d/%d, line %d\n",
 				     proc->pid, thread->pid,



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 10/21] printk/console: Allow to disable console output by using console="" or console=null
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (8 preceding siblings ...)
  2021-11-10 18:43 ` [PATCH 5.10 09/21] binder: dont detect sender/target during buffer cleanup Greg Kroah-Hartman
@ 2021-11-10 18:43 ` Greg Kroah-Hartman
  2021-11-10 18:43 ` [PATCH 5.10 11/21] staging: rtl8712: fix use-after-free in rtl8712_dl_fw Greg Kroah-Hartman
                   ` (16 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sergey Senozhatsky, Guenter Roeck,
	Petr Mladek, Yi Fan

From: Petr Mladek <pmladek@suse.com>

commit 3cffa06aeef7ece30f6b5ac0ea51f264e8fea4d0 upstream.

The commit 48021f98130880dd74 ("printk: handle blank console arguments
passed in.") prevented crash caused by empty console= parameter value.

Unfortunately, this value is widely used on Chromebooks to disable
the console output. The above commit caused performance regression
because the messages were pushed on slow console even though nobody
was watching it.

Use ttynull driver explicitly for console="" and console=null
parameters. It has been created for exactly this purpose.

It causes that preferred_console is set. As a result, ttySX and ttyX
are not used as a fallback. And only ttynull console gets registered by
default.

It still allows to register other consoles either by additional console=
parameters or SPCR. It prevents regression because it worked this way even
before. Also it is a sane semantic. Preventing output on all consoles
should be done another way, for example, by introducing mute_console
parameter.

Link: https://lore.kernel.org/r/20201006025935.GA597@jagdpanzerIV.localdomain
Suggested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20201111135450.11214-3-pmladek@suse.com
Cc: Yi Fan <yfa@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/printk/printk.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2213,8 +2213,15 @@ static int __init console_setup(char *st
 	char *s, *options, *brl_options = NULL;
 	int idx;
 
-	if (str[0] == 0)
+	/*
+	 * console="" or console=null have been suggested as a way to
+	 * disable console output. Use ttynull that has been created
+	 * for exacly this purpose.
+	 */
+	if (str[0] == 0 || strcmp(str, "null") == 0) {
+		__add_preferred_console("ttynull", 0, NULL, NULL, true);
 		return 1;
+	}
 
 	if (_braille_console_setup(&str, &brl_options))
 		return 1;



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 11/21] staging: rtl8712: fix use-after-free in rtl8712_dl_fw
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (9 preceding siblings ...)
  2021-11-10 18:43 ` [PATCH 5.10 10/21] printk/console: Allow to disable console output by using console="" or console=null Greg Kroah-Hartman
@ 2021-11-10 18:43 ` Greg Kroah-Hartman
  2021-11-10 18:43 ` [PATCH 5.10 12/21] isofs: Fix out of bound access for corrupted isofs image Greg Kroah-Hartman
                   ` (15 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pavel Skripkin, syzbot+c55162be492189fb4f51

From: Pavel Skripkin <paskripkin@gmail.com>

commit c052cc1a069c3e575619cf64ec427eb41176ca70 upstream.

Syzbot reported use-after-free in rtl8712_dl_fw(). The problem was in
race condition between r871xu_dev_remove() ->ndo_open() callback.

It's easy to see from crash log, that driver accesses released firmware
in ->ndo_open() callback. It may happen, since driver was releasing
firmware _before_ unregistering netdev. Fix it by moving
unregister_netdev() before cleaning up resources.

Call Trace:
...
 rtl871x_open_fw drivers/staging/rtl8712/hal_init.c:83 [inline]
 rtl8712_dl_fw+0xd95/0xe10 drivers/staging/rtl8712/hal_init.c:170
 rtl8712_hal_init drivers/staging/rtl8712/hal_init.c:330 [inline]
 rtl871x_hal_init+0xae/0x180 drivers/staging/rtl8712/hal_init.c:394
 netdev_open+0xe6/0x6c0 drivers/staging/rtl8712/os_intfs.c:380
 __dev_open+0x2bc/0x4d0 net/core/dev.c:1484

Freed by task 1306:
...
 release_firmware+0x1b/0x30 drivers/base/firmware_loader/main.c:1053
 r871xu_dev_remove+0xcc/0x2c0 drivers/staging/rtl8712/usb_intf.c:599
 usb_unbind_interface+0x1d8/0x8d0 drivers/usb/core/driver.c:458

Fixes: 8c213fa59199 ("staging: r8712u: Use asynchronous firmware loading")
Cc: stable <stable@vger.kernel.org>
Reported-and-tested-by: syzbot+c55162be492189fb4f51@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Link: https://lore.kernel.org/r/20211019211718.26354-1-paskripkin@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/rtl8712/usb_intf.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/staging/rtl8712/usb_intf.c
+++ b/drivers/staging/rtl8712/usb_intf.c
@@ -598,12 +598,12 @@ static void r871xu_dev_remove(struct usb
 
 	/* never exit with a firmware callback pending */
 	wait_for_completion(&padapter->rtl8712_fw_ready);
+	if (pnetdev->reg_state != NETREG_UNINITIALIZED)
+		unregister_netdev(pnetdev); /* will call netdev_close() */
 	usb_set_intfdata(pusb_intf, NULL);
 	release_firmware(padapter->fw);
 	if (drvpriv.drv_registered)
 		padapter->surprise_removed = true;
-	if (pnetdev->reg_state != NETREG_UNINITIALIZED)
-		unregister_netdev(pnetdev); /* will call netdev_close() */
 	r8712_flush_rwctrl_works(padapter);
 	r8712_flush_led_works(padapter);
 	udelay(1);



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 12/21] isofs: Fix out of bound access for corrupted isofs image
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (10 preceding siblings ...)
  2021-11-10 18:43 ` [PATCH 5.10 11/21] staging: rtl8712: fix use-after-free in rtl8712_dl_fw Greg Kroah-Hartman
@ 2021-11-10 18:43 ` Greg Kroah-Hartman
  2021-11-10 18:43 ` [PATCH 5.10 13/21] comedi: dt9812: fix DMA buffers on stack Greg Kroah-Hartman
                   ` (14 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jan Kara, syzbot+6fc7fb214625d82af7d1

From: Jan Kara <jack@suse.cz>

commit e96a1866b40570b5950cda8602c2819189c62a48 upstream.

When isofs image is suitably corrupted isofs_read_inode() can read data
beyond the end of buffer. Sanity-check the directory entry length before
using it.

Reported-and-tested-by: syzbot+6fc7fb214625d82af7d1@syzkaller.appspotmail.com
CC: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/isofs/inode.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1321,6 +1321,8 @@ static int isofs_read_inode(struct inode
 
 	de = (struct iso_directory_record *) (bh->b_data + offset);
 	de_len = *(unsigned char *) de;
+	if (de_len < sizeof(struct iso_directory_record))
+		goto fail;
 
 	if (offset + de_len > bufsize) {
 		int frag1 = bufsize - offset;



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 13/21] comedi: dt9812: fix DMA buffers on stack
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (11 preceding siblings ...)
  2021-11-10 18:43 ` [PATCH 5.10 12/21] isofs: Fix out of bound access for corrupted isofs image Greg Kroah-Hartman
@ 2021-11-10 18:43 ` Greg Kroah-Hartman
  2021-11-10 18:44 ` [PATCH 5.10 14/21] comedi: ni_usb6501: fix NULL-deref in command paths Greg Kroah-Hartman
                   ` (13 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ian Abbott, Johan Hovold

From: Johan Hovold <johan@kernel.org>

commit 536de747bc48262225889a533db6650731ab25d3 upstream.

USB transfer buffers are typically mapped for DMA and must not be
allocated on the stack or transfers will fail.

Allocate proper transfer buffers in the various command helpers and
return an error on short transfers instead of acting on random stack
data.

Note that this also fixes a stack info leak on systems where DMA is not
used as 32 bytes are always sent to the device regardless of how short
the command is.

Fixes: 63274cd7d38a ("Staging: comedi: add usb dt9812 driver")
Cc: stable@vger.kernel.org      # 2.6.29
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20211027093529.30896-3-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/comedi/drivers/dt9812.c |  115 +++++++++++++++++++++++---------
 1 file changed, 86 insertions(+), 29 deletions(-)

--- a/drivers/staging/comedi/drivers/dt9812.c
+++ b/drivers/staging/comedi/drivers/dt9812.c
@@ -32,6 +32,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/errno.h>
+#include <linux/slab.h>
 #include <linux/uaccess.h>
 
 #include "../comedi_usb.h"
@@ -237,22 +238,42 @@ static int dt9812_read_info(struct comed
 {
 	struct usb_device *usb = comedi_to_usb_dev(dev);
 	struct dt9812_private *devpriv = dev->private;
-	struct dt9812_usb_cmd cmd;
+	struct dt9812_usb_cmd *cmd;
+	size_t tbuf_size;
 	int count, ret;
+	void *tbuf;
 
-	cmd.cmd = cpu_to_le32(DT9812_R_FLASH_DATA);
-	cmd.u.flash_data_info.address =
+	tbuf_size = max(sizeof(*cmd), buf_size);
+
+	tbuf = kzalloc(tbuf_size, GFP_KERNEL);
+	if (!tbuf)
+		return -ENOMEM;
+
+	cmd = tbuf;
+
+	cmd->cmd = cpu_to_le32(DT9812_R_FLASH_DATA);
+	cmd->u.flash_data_info.address =
 	    cpu_to_le16(DT9812_DIAGS_BOARD_INFO_ADDR + offset);
-	cmd.u.flash_data_info.numbytes = cpu_to_le16(buf_size);
+	cmd->u.flash_data_info.numbytes = cpu_to_le16(buf_size);
 
 	/* DT9812 only responds to 32 byte writes!! */
 	ret = usb_bulk_msg(usb, usb_sndbulkpipe(usb, devpriv->cmd_wr.addr),
-			   &cmd, 32, &count, DT9812_USB_TIMEOUT);
+			   cmd, sizeof(*cmd), &count, DT9812_USB_TIMEOUT);
 	if (ret)
-		return ret;
+		goto out;
+
+	ret = usb_bulk_msg(usb, usb_rcvbulkpipe(usb, devpriv->cmd_rd.addr),
+			   tbuf, buf_size, &count, DT9812_USB_TIMEOUT);
+	if (!ret) {
+		if (count == buf_size)
+			memcpy(buf, tbuf, buf_size);
+		else
+			ret = -EREMOTEIO;
+	}
+out:
+	kfree(tbuf);
 
-	return usb_bulk_msg(usb, usb_rcvbulkpipe(usb, devpriv->cmd_rd.addr),
-			    buf, buf_size, &count, DT9812_USB_TIMEOUT);
+	return ret;
 }
 
 static int dt9812_read_multiple_registers(struct comedi_device *dev,
@@ -261,22 +282,42 @@ static int dt9812_read_multiple_register
 {
 	struct usb_device *usb = comedi_to_usb_dev(dev);
 	struct dt9812_private *devpriv = dev->private;
-	struct dt9812_usb_cmd cmd;
+	struct dt9812_usb_cmd *cmd;
 	int i, count, ret;
+	size_t buf_size;
+	void *buf;
+
+	buf_size = max_t(size_t, sizeof(*cmd), reg_count);
+
+	buf = kzalloc(buf_size, GFP_KERNEL);
+	if (!buf)
+		return -ENOMEM;
+
+	cmd = buf;
 
-	cmd.cmd = cpu_to_le32(DT9812_R_MULTI_BYTE_REG);
-	cmd.u.read_multi_info.count = reg_count;
+	cmd->cmd = cpu_to_le32(DT9812_R_MULTI_BYTE_REG);
+	cmd->u.read_multi_info.count = reg_count;
 	for (i = 0; i < reg_count; i++)
-		cmd.u.read_multi_info.address[i] = address[i];
+		cmd->u.read_multi_info.address[i] = address[i];
 
 	/* DT9812 only responds to 32 byte writes!! */
 	ret = usb_bulk_msg(usb, usb_sndbulkpipe(usb, devpriv->cmd_wr.addr),
-			   &cmd, 32, &count, DT9812_USB_TIMEOUT);
+			   cmd, sizeof(*cmd), &count, DT9812_USB_TIMEOUT);
 	if (ret)
-		return ret;
+		goto out;
 
-	return usb_bulk_msg(usb, usb_rcvbulkpipe(usb, devpriv->cmd_rd.addr),
-			    value, reg_count, &count, DT9812_USB_TIMEOUT);
+	ret = usb_bulk_msg(usb, usb_rcvbulkpipe(usb, devpriv->cmd_rd.addr),
+			   buf, reg_count, &count, DT9812_USB_TIMEOUT);
+	if (!ret) {
+		if (count == reg_count)
+			memcpy(value, buf, reg_count);
+		else
+			ret = -EREMOTEIO;
+	}
+out:
+	kfree(buf);
+
+	return ret;
 }
 
 static int dt9812_write_multiple_registers(struct comedi_device *dev,
@@ -285,19 +326,27 @@ static int dt9812_write_multiple_registe
 {
 	struct usb_device *usb = comedi_to_usb_dev(dev);
 	struct dt9812_private *devpriv = dev->private;
-	struct dt9812_usb_cmd cmd;
+	struct dt9812_usb_cmd *cmd;
 	int i, count;
+	int ret;
 
-	cmd.cmd = cpu_to_le32(DT9812_W_MULTI_BYTE_REG);
-	cmd.u.read_multi_info.count = reg_count;
+	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+	if (!cmd)
+		return -ENOMEM;
+
+	cmd->cmd = cpu_to_le32(DT9812_W_MULTI_BYTE_REG);
+	cmd->u.read_multi_info.count = reg_count;
 	for (i = 0; i < reg_count; i++) {
-		cmd.u.write_multi_info.write[i].address = address[i];
-		cmd.u.write_multi_info.write[i].value = value[i];
+		cmd->u.write_multi_info.write[i].address = address[i];
+		cmd->u.write_multi_info.write[i].value = value[i];
 	}
 
 	/* DT9812 only responds to 32 byte writes!! */
-	return usb_bulk_msg(usb, usb_sndbulkpipe(usb, devpriv->cmd_wr.addr),
-			    &cmd, 32, &count, DT9812_USB_TIMEOUT);
+	ret = usb_bulk_msg(usb, usb_sndbulkpipe(usb, devpriv->cmd_wr.addr),
+			   cmd, sizeof(*cmd), &count, DT9812_USB_TIMEOUT);
+	kfree(cmd);
+
+	return ret;
 }
 
 static int dt9812_rmw_multiple_registers(struct comedi_device *dev,
@@ -306,17 +355,25 @@ static int dt9812_rmw_multiple_registers
 {
 	struct usb_device *usb = comedi_to_usb_dev(dev);
 	struct dt9812_private *devpriv = dev->private;
-	struct dt9812_usb_cmd cmd;
+	struct dt9812_usb_cmd *cmd;
 	int i, count;
+	int ret;
+
+	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+	if (!cmd)
+		return -ENOMEM;
 
-	cmd.cmd = cpu_to_le32(DT9812_RMW_MULTI_BYTE_REG);
-	cmd.u.rmw_multi_info.count = reg_count;
+	cmd->cmd = cpu_to_le32(DT9812_RMW_MULTI_BYTE_REG);
+	cmd->u.rmw_multi_info.count = reg_count;
 	for (i = 0; i < reg_count; i++)
-		cmd.u.rmw_multi_info.rmw[i] = rmw[i];
+		cmd->u.rmw_multi_info.rmw[i] = rmw[i];
 
 	/* DT9812 only responds to 32 byte writes!! */
-	return usb_bulk_msg(usb, usb_sndbulkpipe(usb, devpriv->cmd_wr.addr),
-			    &cmd, 32, &count, DT9812_USB_TIMEOUT);
+	ret = usb_bulk_msg(usb, usb_sndbulkpipe(usb, devpriv->cmd_wr.addr),
+			   cmd, sizeof(*cmd), &count, DT9812_USB_TIMEOUT);
+	kfree(cmd);
+
+	return ret;
 }
 
 static int dt9812_digital_in(struct comedi_device *dev, u8 *bits)



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 14/21] comedi: ni_usb6501: fix NULL-deref in command paths
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (12 preceding siblings ...)
  2021-11-10 18:43 ` [PATCH 5.10 13/21] comedi: dt9812: fix DMA buffers on stack Greg Kroah-Hartman
@ 2021-11-10 18:44 ` Greg Kroah-Hartman
  2021-11-10 18:44 ` [PATCH 5.10 15/21] comedi: vmk80xx: fix transfer-buffer overflows Greg Kroah-Hartman
                   ` (12 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:44 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Luca Ellero, Ian Abbott, Johan Hovold

From: Johan Hovold <johan@kernel.org>

commit 907767da8f3a925b060c740e0b5c92ea7dbec440 upstream.

The driver uses endpoint-sized USB transfer buffers but had no sanity
checks on the sizes. This can lead to zero-size-pointer dereferences or
overflowed transfer buffers in ni6501_port_command() and
ni6501_counter_command() if a (malicious) device has smaller max-packet
sizes than expected (or when doing descriptor fuzz testing).

Add the missing sanity checks to probe().

Fixes: a03bb00e50ab ("staging: comedi: add NI USB-6501 support")
Cc: stable@vger.kernel.org      # 3.18
Cc: Luca Ellero <luca.ellero@brickedbrain.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20211027093529.30896-2-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/comedi/drivers/ni_usb6501.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/drivers/staging/comedi/drivers/ni_usb6501.c
+++ b/drivers/staging/comedi/drivers/ni_usb6501.c
@@ -144,6 +144,10 @@ static const u8 READ_COUNTER_RESPONSE[]
 					   0x00, 0x00, 0x00, 0x02,
 					   0x00, 0x00, 0x00, 0x00};
 
+/* Largest supported packets */
+static const size_t TX_MAX_SIZE	= sizeof(SET_PORT_DIR_REQUEST);
+static const size_t RX_MAX_SIZE	= sizeof(READ_PORT_RESPONSE);
+
 enum commands {
 	READ_PORT,
 	WRITE_PORT,
@@ -501,6 +505,12 @@ static int ni6501_find_endpoints(struct
 	if (!devpriv->ep_rx || !devpriv->ep_tx)
 		return -ENODEV;
 
+	if (usb_endpoint_maxp(devpriv->ep_rx) < RX_MAX_SIZE)
+		return -ENODEV;
+
+	if (usb_endpoint_maxp(devpriv->ep_tx) < TX_MAX_SIZE)
+		return -ENODEV;
+
 	return 0;
 }
 



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 15/21] comedi: vmk80xx: fix transfer-buffer overflows
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (13 preceding siblings ...)
  2021-11-10 18:44 ` [PATCH 5.10 14/21] comedi: ni_usb6501: fix NULL-deref in command paths Greg Kroah-Hartman
@ 2021-11-10 18:44 ` Greg Kroah-Hartman
  2021-11-10 18:44 ` [PATCH 5.10 16/21] comedi: vmk80xx: fix bulk-buffer overflow Greg Kroah-Hartman
                   ` (11 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold, Ian Abbott

From: Johan Hovold <johan@kernel.org>

commit a23461c47482fc232ffc9b819539d1f837adf2b1 upstream.

The driver uses endpoint-sized USB transfer buffers but up until
recently had no sanity checks on the sizes.

Commit e1f13c879a7c ("staging: comedi: check validity of wMaxPacketSize
of usb endpoints found") inadvertently fixed NULL-pointer dereferences
when accessing the transfer buffers in case a malicious device has a
zero wMaxPacketSize.

Make sure to allocate buffers large enough to handle also the other
accesses that are done without a size check (e.g. byte 18 in
vmk80xx_cnt_insn_read() for the VMK8061_MODEL) to avoid writing beyond
the buffers, for example, when doing descriptor fuzzing.

The original driver was for a low-speed device with 8-byte buffers.
Support was later added for a device that uses bulk transfers and is
presumably a full-speed device with a maximum 64-byte wMaxPacketSize.

Fixes: 985cafccbf9b ("Staging: Comedi: vmk80xx: Add k8061 support")
Cc: stable@vger.kernel.org      # 2.6.31
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20211025114532.4599-4-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/comedi/drivers/vmk80xx.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/staging/comedi/drivers/vmk80xx.c
+++ b/drivers/staging/comedi/drivers/vmk80xx.c
@@ -90,6 +90,8 @@ enum {
 #define IC3_VERSION		BIT(0)
 #define IC6_VERSION		BIT(1)
 
+#define MIN_BUF_SIZE		64
+
 enum vmk80xx_model {
 	VMK8055_MODEL,
 	VMK8061_MODEL
@@ -678,12 +680,12 @@ static int vmk80xx_alloc_usb_buffers(str
 	struct vmk80xx_private *devpriv = dev->private;
 	size_t size;
 
-	size = usb_endpoint_maxp(devpriv->ep_rx);
+	size = max(usb_endpoint_maxp(devpriv->ep_rx), MIN_BUF_SIZE);
 	devpriv->usb_rx_buf = kzalloc(size, GFP_KERNEL);
 	if (!devpriv->usb_rx_buf)
 		return -ENOMEM;
 
-	size = usb_endpoint_maxp(devpriv->ep_tx);
+	size = max(usb_endpoint_maxp(devpriv->ep_rx), MIN_BUF_SIZE);
 	devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL);
 	if (!devpriv->usb_tx_buf)
 		return -ENOMEM;



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 16/21] comedi: vmk80xx: fix bulk-buffer overflow
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (14 preceding siblings ...)
  2021-11-10 18:44 ` [PATCH 5.10 15/21] comedi: vmk80xx: fix transfer-buffer overflows Greg Kroah-Hartman
@ 2021-11-10 18:44 ` Greg Kroah-Hartman
  2021-11-10 18:44 ` [PATCH 5.10 17/21] comedi: vmk80xx: fix bulk and interrupt message timeouts Greg Kroah-Hartman
                   ` (10 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold, Ian Abbott

From: Johan Hovold <johan@kernel.org>

commit 78cdfd62bd54af615fba9e3ca1ba35de39d3871d upstream.

The driver is using endpoint-sized buffers but must not assume that the
tx and rx buffers are of equal size or a malicious device could overflow
the slab-allocated receive buffer when doing bulk transfers.

Fixes: 985cafccbf9b ("Staging: Comedi: vmk80xx: Add k8061 support")
Cc: stable@vger.kernel.org      # 2.6.31
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20211025114532.4599-5-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/comedi/drivers/vmk80xx.c |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

--- a/drivers/staging/comedi/drivers/vmk80xx.c
+++ b/drivers/staging/comedi/drivers/vmk80xx.c
@@ -159,22 +159,20 @@ static void vmk80xx_do_bulk_msg(struct c
 	__u8 rx_addr;
 	unsigned int tx_pipe;
 	unsigned int rx_pipe;
-	size_t size;
+	size_t tx_size;
+	size_t rx_size;
 
 	tx_addr = devpriv->ep_tx->bEndpointAddress;
 	rx_addr = devpriv->ep_rx->bEndpointAddress;
 	tx_pipe = usb_sndbulkpipe(usb, tx_addr);
 	rx_pipe = usb_rcvbulkpipe(usb, rx_addr);
-
-	/*
-	 * The max packet size attributes of the K8061
-	 * input/output endpoints are identical
-	 */
-	size = usb_endpoint_maxp(devpriv->ep_tx);
+	tx_size = usb_endpoint_maxp(devpriv->ep_tx);
+	rx_size = usb_endpoint_maxp(devpriv->ep_rx);
 
 	usb_bulk_msg(usb, tx_pipe, devpriv->usb_tx_buf,
-		     size, NULL, devpriv->ep_tx->bInterval);
-	usb_bulk_msg(usb, rx_pipe, devpriv->usb_rx_buf, size, NULL, HZ * 10);
+		     tx_size, NULL, devpriv->ep_tx->bInterval);
+
+	usb_bulk_msg(usb, rx_pipe, devpriv->usb_rx_buf, rx_size, NULL, HZ * 10);
 }
 
 static int vmk80xx_read_packet(struct comedi_device *dev)



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 17/21] comedi: vmk80xx: fix bulk and interrupt message timeouts
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (15 preceding siblings ...)
  2021-11-10 18:44 ` [PATCH 5.10 16/21] comedi: vmk80xx: fix bulk-buffer overflow Greg Kroah-Hartman
@ 2021-11-10 18:44 ` Greg Kroah-Hartman
  2021-11-10 18:44 ` [PATCH 5.10 18/21] staging: r8712u: fix control-message timeout Greg Kroah-Hartman
                   ` (9 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold, Ian Abbott

From: Johan Hovold <johan@kernel.org>

commit a56d3e40bda460edf3f8d6aac00ec0b322b4ab83 upstream.

USB bulk and interrupt message timeouts are specified in milliseconds
and should specifically not vary with CONFIG_HZ.

Note that the bulk-out transfer timeout was set to the endpoint
bInterval value, which should be ignored for bulk endpoints and is
typically set to zero. This meant that a failing bulk-out transfer
would never time out.

Assume that the 10 second timeout used for all other transfers is more
than enough also for the bulk-out endpoint.

Fixes: 985cafccbf9b ("Staging: Comedi: vmk80xx: Add k8061 support")
Fixes: 951348b37738 ("staging: comedi: vmk80xx: wait for URBs to complete")
Cc: stable@vger.kernel.org      # 2.6.31
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20211025114532.4599-6-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/comedi/drivers/vmk80xx.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

--- a/drivers/staging/comedi/drivers/vmk80xx.c
+++ b/drivers/staging/comedi/drivers/vmk80xx.c
@@ -91,6 +91,7 @@ enum {
 #define IC6_VERSION		BIT(1)
 
 #define MIN_BUF_SIZE		64
+#define PACKET_TIMEOUT		10000	/* ms */
 
 enum vmk80xx_model {
 	VMK8055_MODEL,
@@ -169,10 +170,11 @@ static void vmk80xx_do_bulk_msg(struct c
 	tx_size = usb_endpoint_maxp(devpriv->ep_tx);
 	rx_size = usb_endpoint_maxp(devpriv->ep_rx);
 
-	usb_bulk_msg(usb, tx_pipe, devpriv->usb_tx_buf,
-		     tx_size, NULL, devpriv->ep_tx->bInterval);
+	usb_bulk_msg(usb, tx_pipe, devpriv->usb_tx_buf, tx_size, NULL,
+		     PACKET_TIMEOUT);
 
-	usb_bulk_msg(usb, rx_pipe, devpriv->usb_rx_buf, rx_size, NULL, HZ * 10);
+	usb_bulk_msg(usb, rx_pipe, devpriv->usb_rx_buf, rx_size, NULL,
+		     PACKET_TIMEOUT);
 }
 
 static int vmk80xx_read_packet(struct comedi_device *dev)
@@ -191,7 +193,7 @@ static int vmk80xx_read_packet(struct co
 	pipe = usb_rcvintpipe(usb, ep->bEndpointAddress);
 	return usb_interrupt_msg(usb, pipe, devpriv->usb_rx_buf,
 				 usb_endpoint_maxp(ep), NULL,
-				 HZ * 10);
+				 PACKET_TIMEOUT);
 }
 
 static int vmk80xx_write_packet(struct comedi_device *dev, int cmd)
@@ -212,7 +214,7 @@ static int vmk80xx_write_packet(struct c
 	pipe = usb_sndintpipe(usb, ep->bEndpointAddress);
 	return usb_interrupt_msg(usb, pipe, devpriv->usb_tx_buf,
 				 usb_endpoint_maxp(ep), NULL,
-				 HZ * 10);
+				 PACKET_TIMEOUT);
 }
 
 static int vmk80xx_reset_device(struct comedi_device *dev)



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 18/21] staging: r8712u: fix control-message timeout
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (16 preceding siblings ...)
  2021-11-10 18:44 ` [PATCH 5.10 17/21] comedi: vmk80xx: fix bulk and interrupt message timeouts Greg Kroah-Hartman
@ 2021-11-10 18:44 ` Greg Kroah-Hartman
  2021-11-10 18:44 ` [PATCH 5.10 19/21] staging: rtl8192u: fix control-message timeouts Greg Kroah-Hartman
                   ` (8 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Larry Finger, Johan Hovold

From: Johan Hovold <johan@kernel.org>

commit ce4940525f36ffdcf4fa623bcedab9c2a6db893a upstream.

USB control-message timeouts are specified in milliseconds and should
specifically not vary with CONFIG_HZ.

Fixes: 2865d42c78a9 ("staging: r8712u: Add the new driver to the mainline kernel")
Cc: stable@vger.kernel.org      # 2.6.37
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20211025120910.6339-3-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/rtl8712/usb_ops_linux.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/staging/rtl8712/usb_ops_linux.c
+++ b/drivers/staging/rtl8712/usb_ops_linux.c
@@ -494,7 +494,7 @@ int r8712_usbctrl_vendorreq(struct intf_
 		memcpy(pIo_buf, pdata, len);
 	}
 	status = usb_control_msg(udev, pipe, request, reqtype, value, index,
-				 pIo_buf, len, HZ / 2);
+				 pIo_buf, len, 500);
 	if (status > 0) {  /* Success this control transfer. */
 		if (requesttype == 0x01) {
 			/* For Control read transfer, we have to copy the read



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 19/21] staging: rtl8192u: fix control-message timeouts
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (17 preceding siblings ...)
  2021-11-10 18:44 ` [PATCH 5.10 18/21] staging: r8712u: fix control-message timeout Greg Kroah-Hartman
@ 2021-11-10 18:44 ` Greg Kroah-Hartman
  2021-11-10 18:44 ` [PATCH 5.10 20/21] media: staging/intel-ipu3: css: Fix wrong size comparison imgu_css_fw_init Greg Kroah-Hartman
                   ` (7 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Larry Finger, Johan Hovold

From: Johan Hovold <johan@kernel.org>

commit 4cfa36d312d6789448b59a7aae770ac8425017a3 upstream.

USB control-message timeouts are specified in milliseconds and should
specifically not vary with CONFIG_HZ.

Fixes: 8fc8598e61f6 ("Staging: Added Realtek rtl8192u driver to staging")
Cc: stable@vger.kernel.org      # 2.6.33
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20211025120910.6339-2-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/rtl8192u/r8192U_core.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -229,7 +229,7 @@ int write_nic_byte_E(struct net_device *
 
 	status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
 				 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
-				 indx | 0xfe00, 0, usbdata, 1, HZ / 2);
+				 indx | 0xfe00, 0, usbdata, 1, 500);
 	kfree(usbdata);
 
 	if (status < 0) {
@@ -251,7 +251,7 @@ int read_nic_byte_E(struct net_device *d
 
 	status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
 				 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
-				 indx | 0xfe00, 0, usbdata, 1, HZ / 2);
+				 indx | 0xfe00, 0, usbdata, 1, 500);
 	*data = *usbdata;
 	kfree(usbdata);
 
@@ -279,7 +279,7 @@ int write_nic_byte(struct net_device *de
 	status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
 				 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
 				 (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f,
-				 usbdata, 1, HZ / 2);
+				 usbdata, 1, 500);
 	kfree(usbdata);
 
 	if (status < 0) {
@@ -305,7 +305,7 @@ int write_nic_word(struct net_device *de
 	status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
 				 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
 				 (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f,
-				 usbdata, 2, HZ / 2);
+				 usbdata, 2, 500);
 	kfree(usbdata);
 
 	if (status < 0) {
@@ -331,7 +331,7 @@ int write_nic_dword(struct net_device *d
 	status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
 				 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
 				 (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f,
-				 usbdata, 4, HZ / 2);
+				 usbdata, 4, 500);
 	kfree(usbdata);
 
 	if (status < 0) {
@@ -355,7 +355,7 @@ int read_nic_byte(struct net_device *dev
 	status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
 				 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
 				 (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f,
-				 usbdata, 1, HZ / 2);
+				 usbdata, 1, 500);
 	*data = *usbdata;
 	kfree(usbdata);
 
@@ -380,7 +380,7 @@ int read_nic_word(struct net_device *dev
 	status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
 				 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
 				 (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f,
-				 usbdata, 2, HZ / 2);
+				 usbdata, 2, 500);
 	*data = *usbdata;
 	kfree(usbdata);
 
@@ -404,7 +404,7 @@ static int read_nic_word_E(struct net_de
 
 	status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
 				 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
-				 indx | 0xfe00, 0, usbdata, 2, HZ / 2);
+				 indx | 0xfe00, 0, usbdata, 2, 500);
 	*data = *usbdata;
 	kfree(usbdata);
 
@@ -430,7 +430,7 @@ int read_nic_dword(struct net_device *de
 	status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
 				 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
 				 (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f,
-				 usbdata, 4, HZ / 2);
+				 usbdata, 4, 500);
 	*data = *usbdata;
 	kfree(usbdata);
 



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 20/21] media: staging/intel-ipu3: css: Fix wrong size comparison imgu_css_fw_init
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (18 preceding siblings ...)
  2021-11-10 18:44 ` [PATCH 5.10 19/21] staging: rtl8192u: fix control-message timeouts Greg Kroah-Hartman
@ 2021-11-10 18:44 ` Greg Kroah-Hartman
  2021-11-10 18:44 ` [PATCH 5.10 21/21] rsi: fix control-message timeout Greg Kroah-Hartman
                   ` (6 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:44 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Gustavo A. R. Silva, Sakari Ailus,
	Mauro Carvalho Chehab

From: Gustavo A. R. Silva <gustavoars@kernel.org>

commit a44f9d6f9dc1fb314a3f1ed2dcd4fbbcc3d9f892 upstream.

There is a wrong comparison of the total size of the loaded firmware
css->fw->size with the size of a pointer to struct imgu_fw_header.

Turn binary_header into a flexible-array member[1][2], use the
struct_size() helper and fix the wrong size comparison. Notice
that the loaded firmware needs to contain at least one 'struct
imgu_fw_info' item in the binary_header[] array.

It's also worth mentioning that

	"css->fw->size < struct_size(css->fwp, binary_header, 1)"

with binary_header declared as a flexible-array member is equivalent
to

	"css->fw->size < sizeof(struct imgu_fw_header)"

with binary_header declared as a one-element array (as in the original
code).

The replacement of the one-element array with a flexible-array member
also helps with the ongoing efforts to globally enable -Warray-bounds
and get us closer to being able to tighten the FORTIFY_SOURCE routines
on memcpy().

[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.10/process/deprecated.html#zero-length-and-one-element-arrays

Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/109

Fixes: 09d290f0ba21 ("media: staging/intel-ipu3: css: Add support for firmware management")
Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/media/ipu3/ipu3-css-fw.c |    7 +++----
 drivers/staging/media/ipu3/ipu3-css-fw.h |    2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

--- a/drivers/staging/media/ipu3/ipu3-css-fw.c
+++ b/drivers/staging/media/ipu3/ipu3-css-fw.c
@@ -124,12 +124,11 @@ int imgu_css_fw_init(struct imgu_css *cs
 	/* Check and display fw header info */
 
 	css->fwp = (struct imgu_fw_header *)css->fw->data;
-	if (css->fw->size < sizeof(struct imgu_fw_header *) ||
+	if (css->fw->size < struct_size(css->fwp, binary_header, 1) ||
 	    css->fwp->file_header.h_size != sizeof(struct imgu_fw_bi_file_h))
 		goto bad_fw;
-	if (sizeof(struct imgu_fw_bi_file_h) +
-	    css->fwp->file_header.binary_nr * sizeof(struct imgu_fw_info) >
-	    css->fw->size)
+	if (struct_size(css->fwp, binary_header,
+			css->fwp->file_header.binary_nr) > css->fw->size)
 		goto bad_fw;
 
 	dev_info(dev, "loaded firmware version %.64s, %u binaries, %zu bytes\n",
--- a/drivers/staging/media/ipu3/ipu3-css-fw.h
+++ b/drivers/staging/media/ipu3/ipu3-css-fw.h
@@ -170,7 +170,7 @@ struct imgu_fw_bi_file_h {
 
 struct imgu_fw_header {
 	struct imgu_fw_bi_file_h file_header;
-	struct imgu_fw_info binary_header[1];	/* binary_nr items */
+	struct imgu_fw_info binary_header[];	/* binary_nr items */
 };
 
 /******************* Firmware functions *******************/



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 5.10 21/21] rsi: fix control-message timeout
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (19 preceding siblings ...)
  2021-11-10 18:44 ` [PATCH 5.10 20/21] media: staging/intel-ipu3: css: Fix wrong size comparison imgu_css_fw_init Greg Kroah-Hartman
@ 2021-11-10 18:44 ` Greg Kroah-Hartman
  2021-11-10 20:09 ` [PATCH 5.10 00/21] 5.10.79-rc1 review Florian Fainelli
                   ` (5 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-10 18:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold, Kalle Valo

From: Johan Hovold <johan@kernel.org>

commit 541fd20c3ce5b0bc39f0c6a52414b6b92416831c upstream.

USB control-message timeouts are specified in milliseconds and should
specifically not vary with CONFIG_HZ.

Use the common control-message timeout define for the five-second
timeout.

Fixes: dad0d04fa7ba ("rsi: Add RS9113 wireless driver")
Cc: stable@vger.kernel.org      # 3.15
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211025120522.6045-5-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/wireless/rsi/rsi_91x_usb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/wireless/rsi/rsi_91x_usb.c
+++ b/drivers/net/wireless/rsi/rsi_91x_usb.c
@@ -61,7 +61,7 @@ static int rsi_usb_card_write(struct rsi
 			      (void *)seg,
 			      (int)len,
 			      &transfer,
-			      HZ * 5);
+			      USB_CTRL_SET_TIMEOUT);
 
 	if (status < 0) {
 		rsi_dbg(ERR_ZONE,



^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.79-rc1 review
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (20 preceding siblings ...)
  2021-11-10 18:44 ` [PATCH 5.10 21/21] rsi: fix control-message timeout Greg Kroah-Hartman
@ 2021-11-10 20:09 ` Florian Fainelli
  2021-11-10 21:42 ` Fox Chen
                   ` (4 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Florian Fainelli @ 2021-11-10 20:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, shuah, patches, lkft-triage, pavel,
	jonathanh, stable

On 11/10/21 10:43 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 5.10.79 release.
> There are 21 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Fri, 12 Nov 2021 18:19:54 +0000.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.79-rc1.gz
> or in the git tree and branch at:
> 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h

On ARCH_BRCMSTB, using 32-bit and 64-bit ARM kernels:

Tested-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 37+ messages in thread

* RE: [PATCH 5.10 00/21] 5.10.79-rc1 review
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (21 preceding siblings ...)
  2021-11-10 20:09 ` [PATCH 5.10 00/21] 5.10.79-rc1 review Florian Fainelli
@ 2021-11-10 21:42 ` Fox Chen
  2021-11-11 13:01 ` Sudip Mukherjee
                   ` (3 subsequent siblings)
  26 siblings, 0 replies; 37+ messages in thread
From: Fox Chen @ 2021-11-10 21:42 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, torvalds, akpm, linux, shuah, patches,
	lkft-triage, pavel, jonathanh, f.fainelli, stable, Fox Chen

On Wed, 10 Nov 2021 19:43:46 +0100, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> This is the start of the stable review cycle for the 5.10.79 release.
> There are 21 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Fri, 12 Nov 2021 18:19:54 +0000.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.79-rc1.gz
> or in the git tree and branch at:
> 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 

5.10.79-rc1 Successfully Compiled and booted on my Raspberry PI 4b (8g) (bcm2711)
                
Tested-by: Fox Chen <foxhlchen@gmail.com>


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.79-rc1 review
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (22 preceding siblings ...)
  2021-11-10 21:42 ` Fox Chen
@ 2021-11-11 13:01 ` Sudip Mukherjee
  2021-11-11 14:54   ` Naresh Kamboju
                     ` (2 more replies)
  2021-11-11 16:20 ` Shuah Khan
                   ` (2 subsequent siblings)
  26 siblings, 3 replies; 37+ messages in thread
From: Sudip Mukherjee @ 2021-11-11 13:01 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, linux, shuah, patches, lkft-triage,
	pavel, jonathanh, f.fainelli, stable

Hi Greg,

On Wed, Nov 10, 2021 at 07:43:46PM +0100, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 5.10.79 release.
> There are 21 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Fri, 12 Nov 2021 18:19:54 +0000.
> Anything received after that time might be too late.

systemd-journal-flush.service failed due to a timeout resulting in a very very
slow boot on my test laptop. qemu test on openqa failed due to the same problem.

https://openqa.qa.codethink.co.uk/tests/365

A bisect showed the problem to be 8615ff6dd1ac ("mm: filemap: check if THP has
hwpoisoned subpage for PMD page fault"). Reverting it on top of 5.10.79-rc1
fixed the problem.
Incidentally, I was having similar problem with Linus's tree
for last few days and was failing since 20211106 (did not get the time to check).
I will test mainline again with this commit reverted.


--
Regards
Sudip

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.79-rc1 review
  2021-11-11 13:01 ` Sudip Mukherjee
@ 2021-11-11 14:54   ` Naresh Kamboju
  2021-11-12 13:47     ` Greg Kroah-Hartman
  2021-11-11 19:45   ` Sudip Mukherjee
  2021-11-11 21:36   ` Shuah Khan
  2 siblings, 1 reply; 37+ messages in thread
From: Naresh Kamboju @ 2021-11-11 14:54 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Greg Kroah-Hartman, f.fainelli, torvalds, linux-kernel,
	lkft-triage, patches, stable, pavel, akpm, jonathanh, shuah,
	linux, Yang Shi, Naoya Horiguchi, Kirill A. Shutemov,
	Hugh Dickins, Matthew Wilcox, Oscar Salvador, Peter Xu

On Thu, 11 Nov 2021 at 18:32, Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
>
> Hi Greg,
>
> On Wed, Nov 10, 2021 at 07:43:46PM +0100, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 5.10.79 release.
> > There are 21 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> >
> > Responses should be made by Fri, 12 Nov 2021 18:19:54 +0000.
> > Anything received after that time might be too late.
>
> systemd-journal-flush.service failed due to a timeout resulting in a very very
> slow boot on my test laptop. qemu test on openqa failed due to the same problem.
>
> https://openqa.qa.codethink.co.uk/tests/365
>
> A bisect showed the problem to be 8615ff6dd1ac ("mm: filemap: check if THP has
> hwpoisoned subpage for PMD page fault"). Reverting it on top of 5.10.79-rc1
> fixed the problem.
> Incidentally, I was having similar problem with Linus's tree
> for last few days and was failing since 20211106 (did not get the time to check).
> I will test mainline again with this commit reverted.

I have also noticed this problem and Anders bisected and found this
first bad commit.

Failed test log link,
A start job is running for Journal Service (5s / 1min 27s)
https://lkft.validation.linaro.org/scheduler/job/3901980#L2234

Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>

Bisect log:

# bad: [b85617a6291f710807d0cd078c230626dee60b16] Linux 5.10.79-rc1
# good: [5040520482a594e92d4f69141229a6dd26173511] Linux 5.10.78
git bisect start 'b85617a6291f710807d0cd078c230626dee60b16'
'5040520482a594e92d4f69141229a6dd26173511'
# bad: [7ceeda856035991a6c9804916987a03759745fb0] staging: rtl8712:
fix use-after-free in rtl8712_dl_fw
git bisect bad 7ceeda856035991a6c9804916987a03759745fb0
# bad: [8615ff6dd1ac9e01b6fcf0fc0652353f79f524ed] mm: filemap: check
if THP has hwpoisoned subpage for PMD page fault
git bisect bad 8615ff6dd1ac9e01b6fcf0fc0652353f79f524ed
# good: [e9cb6ce4690749d42013f1d56874c624d7241740] Revert "x86/kvm:
fix vcpu-id indexed array sizes"
git bisect good e9cb6ce4690749d42013f1d56874c624d7241740
# good: [dc385dfc126d51d7a93db694f8e151afe60eb06a] mm: hwpoison:
remove the unnecessary THP check
git bisect good dc385dfc126d51d7a93db694f8e151afe60eb06a
# first bad commit: [8615ff6dd1ac9e01b6fcf0fc0652353f79f524ed] mm:
filemap: check if THP has hwpoisoned subpage for PMD page fault
commit 8615ff6dd1ac9e01b6fcf0fc0652353f79f524ed
Author: Yang Shi <shy828301@gmail.com>
Date:   Thu Oct 28 14:36:11 2021 -0700

    mm: filemap: check if THP has hwpoisoned subpage for PMD page fault

    commit eac96c3efdb593df1a57bb5b95dbe037bfa9a522 upstream.

    When handling shmem page fault the THP with corrupted subpage could be
    PMD mapped if certain conditions are satisfied.  But kernel is supposed
    to send SIGBUS when trying to map hwpoisoned page.

    There are two paths which may do PMD map: fault around and regular
    fault.

    Before commit f9ce0be71d1f ("mm: Cleanup faultaround and finish_fault()
    codepaths") the thing was even worse in fault around path.  The THP
    could be PMD mapped as long as the VMA fits regardless what subpage is
    accessed and corrupted.  After this commit as long as head page is not
    corrupted the THP could be PMD mapped.

    In the regular fault path the THP could be PMD mapped as long as the
    corrupted page is not accessed and the VMA fits.

    This loophole could be fixed by iterating every subpage to check if any
    of them is hwpoisoned or not, but it is somewhat costly in page fault
    path.

    So introduce a new page flag called HasHWPoisoned on the first tail
    page.  It indicates the THP has hwpoisoned subpage(s).  It is set if any
    subpage of THP is found hwpoisoned by memory failure and after the
    refcount is bumped successfully, then cleared when the THP is freed or
    split.

    The soft offline path doesn't need this since soft offline handler just
    marks a subpage hwpoisoned when the subpage is migrated successfully.
    But shmem THP didn't get split then migrated at all.

    Link: https://lkml.kernel.org/r/20211020210755.23964-3-shy828301@gmail.com
    Fixes: 800d8c63b2e9 ("shmem: add huge pages support")
    Signed-off-by: Yang Shi <shy828301@gmail.com>
    Reviewed-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
    Suggested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Oscar Salvador <osalvador@suse.de>
    Cc: Peter Xu <peterx@redhat.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 include/linux/page-flags.h | 23 +++++++++++++++++++++++
 mm/huge_memory.c           |  2 ++
 mm/memory-failure.c        | 14 ++++++++++++++
 mm/memory.c                |  9 +++++++++
 mm/page_alloc.c            |  4 +++-
 5 files changed, 51 insertions(+), 1 deletion(-)


--
Linaro LKFT
https://lkft.linaro.org

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.79-rc1 review
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (23 preceding siblings ...)
  2021-11-11 13:01 ` Sudip Mukherjee
@ 2021-11-11 16:20 ` Shuah Khan
  2021-11-11 16:42 ` Pavel Machek
  2021-11-12  1:15 ` Guenter Roeck
  26 siblings, 0 replies; 37+ messages in thread
From: Shuah Khan @ 2021-11-11 16:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, shuah, patches, lkft-triage, pavel,
	jonathanh, f.fainelli, stable, Shuah Khan

On 11/10/21 11:43 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 5.10.79 release.
> There are 21 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Fri, 12 Nov 2021 18:19:54 +0000.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.79-rc1.gz
> or in the git tree and branch at:
> 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 

Compiled and booted on my test system.

dmesg regressions. It took a very long time in trying to start
Journal services and finally timed out. Pervious boot was on
5.14.18-rc1 both boot and shutdown were clean.

> systemd[1]: systemd-journald.service: Failed with result 'timeout'.
> systemd[1]: Failed to start Journal Service.
> systemd[1]: systemd-journald.service: Consumed 3min 490ms CPU time.
> systemd[1]: systemd-journald.service: Scheduled restart job, restart counter is at 6.
> systemd[1]: Stopped Journal Service.
> systemd[1]: systemd-journald.service: Consumed 3min 490ms CPU time.
> systemd[1]: Starting Journal Service...
> systemd-journald[913]: File /run/log/journal/351d6659a0b4490baeff8ad3c4704a35/system.journal corrupted or uncleanly shut down, renaming and replacing.
> systemd[1]: Started Journal Service.


Tested-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.79-rc1 review
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (24 preceding siblings ...)
  2021-11-11 16:20 ` Shuah Khan
@ 2021-11-11 16:42 ` Pavel Machek
  2021-11-12  1:15 ` Guenter Roeck
  26 siblings, 0 replies; 37+ messages in thread
From: Pavel Machek @ 2021-11-11 16:42 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, linux, shuah, patches, lkft-triage,
	pavel, jonathanh, f.fainelli, stable

[-- Attachment #1: Type: text/plain, Size: 660 bytes --]

Hi!

> This is the start of the stable review cycle for the 5.10.79 release.
> There are 21 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.

CIP testing did not find any problems here:

https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-5.10.y

Tested-by: Pavel Machek (CIP) <pavel@denx.de>

Best regards,
                                                                Pavel
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.79-rc1 review
  2021-11-11 13:01 ` Sudip Mukherjee
  2021-11-11 14:54   ` Naresh Kamboju
@ 2021-11-11 19:45   ` Sudip Mukherjee
  2021-11-12 13:46     ` Greg Kroah-Hartman
  2021-11-11 21:36   ` Shuah Khan
  2 siblings, 1 reply; 37+ messages in thread
From: Sudip Mukherjee @ 2021-11-11 19:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Linus Torvalds, Andrew Morton, Guenter Roeck,
	Shuah Khan, patches, lkft-triage, Pavel Machek, Jonathan Hunter,
	Florian Fainelli, Stable

On Thu, Nov 11, 2021 at 1:01 PM Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
>
> Hi Greg,
>
> On Wed, Nov 10, 2021 at 07:43:46PM +0100, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 5.10.79 release.
> > There are 21 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> >
> > Responses should be made by Fri, 12 Nov 2021 18:19:54 +0000.
> > Anything received after that time might be too late.
>
> systemd-journal-flush.service failed due to a timeout resulting in a very very
> slow boot on my test laptop. qemu test on openqa failed due to the same problem.

Build test:
mips (gcc version 11.2.1 20211104): 63 configs -> no new failure
arm (gcc version 11.2.1 20211104): 105 configs -> no new failure
arm64 (gcc version 11.2.1 20211104): 3 configs -> no failure
x86_64 (gcc version 11.2.1 20211104): 4 configs -> no failure

Boot test:
x86_64: Regression mail sent earlier.  Caused by 8615ff6dd1ac ("mm:
filemap: check if THP has
hwpoisoned subpage for PMD page fault").

arm64: Booted on rpi4b (4GB model). No regression. [1]

[1]. https://openqa.qa.codethink.co.uk/tests/362


Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>

--
Regards
Sudip

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.79-rc1 review
  2021-11-11 13:01 ` Sudip Mukherjee
  2021-11-11 14:54   ` Naresh Kamboju
  2021-11-11 19:45   ` Sudip Mukherjee
@ 2021-11-11 21:36   ` Shuah Khan
  2021-11-12 13:46     ` Greg Kroah-Hartman
  2 siblings, 1 reply; 37+ messages in thread
From: Shuah Khan @ 2021-11-11 21:36 UTC (permalink / raw)
  To: Sudip Mukherjee, Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, linux, shuah, patches, lkft-triage,
	pavel, jonathanh, f.fainelli, stable, Shuah Khan

On 11/11/21 6:01 AM, Sudip Mukherjee wrote:
> Hi Greg,
> 
> On Wed, Nov 10, 2021 at 07:43:46PM +0100, Greg Kroah-Hartman wrote:
>> This is the start of the stable review cycle for the 5.10.79 release.
>> There are 21 patches in this series, all will be posted as a response
>> to this one.  If anyone has any issues with these being applied, please
>> let me know.
>>
>> Responses should be made by Fri, 12 Nov 2021 18:19:54 +0000.
>> Anything received after that time might be too late.
> 
> systemd-journal-flush.service failed due to a timeout resulting in a very very
> slow boot on my test laptop. qemu test on openqa failed due to the same problem.
> 
> https://openqa.qa.codethink.co.uk/tests/365
> 
> A bisect showed the problem to be 8615ff6dd1ac ("mm: filemap: check if THP has
> hwpoisoned subpage for PMD page fault"). Reverting it on top of 5.10.79-rc1
> fixed the problem.
> Incidentally, I was having similar problem with Linus's tree
> for last few days and was failing since 20211106 (did not get the time to check).
> I will test mainline again with this commit reverted.
> 
> 

Reverting mm: filemap: check if THP has hwpoisoned subpage for PMD page fault"
worked for me on my test system.

With this commit boots are long and shutdown was at the 20+ minute m ark when
I powered it down. This commit isn't in any of the other release candidates.

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.79-rc1 review
  2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
                   ` (25 preceding siblings ...)
  2021-11-11 16:42 ` Pavel Machek
@ 2021-11-12  1:15 ` Guenter Roeck
  2021-11-12 13:45   ` Greg Kroah-Hartman
  26 siblings, 1 reply; 37+ messages in thread
From: Guenter Roeck @ 2021-11-12  1:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, shuah, patches, lkft-triage, pavel,
	jonathanh, f.fainelli, stable

On Wed, Nov 10, 2021 at 07:43:46PM +0100, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 5.10.79 release.
> There are 21 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Fri, 12 Nov 2021 18:19:54 +0000.
> Anything received after that time might be too late.
> 

Build results:
	total: 159 pass: 159 fail: 0
Qemu test results:
	total: 474 pass: 469 fail: 5
Failed tests:
	ppc64:powernv:powernv_defconfig:smp2:nvme:net,i82559a:rootfs
	ppc64:powernv:powernv_defconfig:usb-xhci:net,i82562:rootfs
	ppc64:powernv:powernv_defconfig:scsi[MEGASAS]:net,i82557a:rootfs
	ppc64:powernv:powernv_defconfig:smp2:sdhci:mmc:net,i82801:rootfs
	ppc64:powernv:powernv_defconfig:mtd32:net,rtl8139:rootfs

Reverting commit 8615ff6dd1ac ("mm: filemap: check if THP has hwpoisoned
subpage for PMD page fault") fixes the problem.

Guenter

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.79-rc1 review
  2021-11-12  1:15 ` Guenter Roeck
@ 2021-11-12 13:45   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-12 13:45 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-kernel, torvalds, akpm, shuah, patches, lkft-triage, pavel,
	jonathanh, f.fainelli, stable

On Thu, Nov 11, 2021 at 05:15:01PM -0800, Guenter Roeck wrote:
> On Wed, Nov 10, 2021 at 07:43:46PM +0100, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 5.10.79 release.
> > There are 21 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Fri, 12 Nov 2021 18:19:54 +0000.
> > Anything received after that time might be too late.
> > 
> 
> Build results:
> 	total: 159 pass: 159 fail: 0
> Qemu test results:
> 	total: 474 pass: 469 fail: 5
> Failed tests:
> 	ppc64:powernv:powernv_defconfig:smp2:nvme:net,i82559a:rootfs
> 	ppc64:powernv:powernv_defconfig:usb-xhci:net,i82562:rootfs
> 	ppc64:powernv:powernv_defconfig:scsi[MEGASAS]:net,i82557a:rootfs
> 	ppc64:powernv:powernv_defconfig:smp2:sdhci:mmc:net,i82801:rootfs
> 	ppc64:powernv:powernv_defconfig:mtd32:net,rtl8139:rootfs
> 
> Reverting commit 8615ff6dd1ac ("mm: filemap: check if THP has hwpoisoned
> subpage for PMD page fault") fixes the problem.

Ugh, ok, I'm going to drop this patch (and the one before it) again.

thanks for the testing.

greg k-h

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.79-rc1 review
  2021-11-11 21:36   ` Shuah Khan
@ 2021-11-12 13:46     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-12 13:46 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Sudip Mukherjee, linux-kernel, torvalds, akpm, linux, shuah,
	patches, lkft-triage, pavel, jonathanh, f.fainelli, stable

On Thu, Nov 11, 2021 at 02:36:08PM -0700, Shuah Khan wrote:
> On 11/11/21 6:01 AM, Sudip Mukherjee wrote:
> > Hi Greg,
> > 
> > On Wed, Nov 10, 2021 at 07:43:46PM +0100, Greg Kroah-Hartman wrote:
> > > This is the start of the stable review cycle for the 5.10.79 release.
> > > There are 21 patches in this series, all will be posted as a response
> > > to this one.  If anyone has any issues with these being applied, please
> > > let me know.
> > > 
> > > Responses should be made by Fri, 12 Nov 2021 18:19:54 +0000.
> > > Anything received after that time might be too late.
> > 
> > systemd-journal-flush.service failed due to a timeout resulting in a very very
> > slow boot on my test laptop. qemu test on openqa failed due to the same problem.
> > 
> > https://openqa.qa.codethink.co.uk/tests/365
> > 
> > A bisect showed the problem to be 8615ff6dd1ac ("mm: filemap: check if THP has
> > hwpoisoned subpage for PMD page fault"). Reverting it on top of 5.10.79-rc1
> > fixed the problem.
> > Incidentally, I was having similar problem with Linus's tree
> > for last few days and was failing since 20211106 (did not get the time to check).
> > I will test mainline again with this commit reverted.
> > 
> > 
> 
> Reverting mm: filemap: check if THP has hwpoisoned subpage for PMD page fault"
> worked for me on my test system.
> 
> With this commit boots are long and shutdown was at the 20+ minute m ark when
> I powered it down. This commit isn't in any of the other release candidates.

Thanks, will go drop this commit.

greg k-h

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.79-rc1 review
  2021-11-11 19:45   ` Sudip Mukherjee
@ 2021-11-12 13:46     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-12 13:46 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: linux-kernel, Linus Torvalds, Andrew Morton, Guenter Roeck,
	Shuah Khan, patches, lkft-triage, Pavel Machek, Jonathan Hunter,
	Florian Fainelli, Stable

On Thu, Nov 11, 2021 at 07:45:09PM +0000, Sudip Mukherjee wrote:
> On Thu, Nov 11, 2021 at 1:01 PM Sudip Mukherjee
> <sudipm.mukherjee@gmail.com> wrote:
> >
> > Hi Greg,
> >
> > On Wed, Nov 10, 2021 at 07:43:46PM +0100, Greg Kroah-Hartman wrote:
> > > This is the start of the stable review cycle for the 5.10.79 release.
> > > There are 21 patches in this series, all will be posted as a response
> > > to this one.  If anyone has any issues with these being applied, please
> > > let me know.
> > >
> > > Responses should be made by Fri, 12 Nov 2021 18:19:54 +0000.
> > > Anything received after that time might be too late.
> >
> > systemd-journal-flush.service failed due to a timeout resulting in a very very
> > slow boot on my test laptop. qemu test on openqa failed due to the same problem.
> 
> Build test:
> mips (gcc version 11.2.1 20211104): 63 configs -> no new failure
> arm (gcc version 11.2.1 20211104): 105 configs -> no new failure
> arm64 (gcc version 11.2.1 20211104): 3 configs -> no failure
> x86_64 (gcc version 11.2.1 20211104): 4 configs -> no failure
> 
> Boot test:
> x86_64: Regression mail sent earlier.  Caused by 8615ff6dd1ac ("mm:
> filemap: check if THP has
> hwpoisoned subpage for PMD page fault").
> 
> arm64: Booted on rpi4b (4GB model). No regression. [1]
> 
> [1]. https://openqa.qa.codethink.co.uk/tests/362
> 
> 
> Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>

Will go drop the offending patch, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.79-rc1 review
  2021-11-11 14:54   ` Naresh Kamboju
@ 2021-11-12 13:47     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-12 13:47 UTC (permalink / raw)
  To: Naresh Kamboju
  Cc: Sudip Mukherjee, f.fainelli, torvalds, linux-kernel, lkft-triage,
	patches, stable, pavel, akpm, jonathanh, shuah, linux, Yang Shi,
	Naoya Horiguchi, Kirill A. Shutemov, Hugh Dickins,
	Matthew Wilcox, Oscar Salvador, Peter Xu

On Thu, Nov 11, 2021 at 08:24:42PM +0530, Naresh Kamboju wrote:
> On Thu, 11 Nov 2021 at 18:32, Sudip Mukherjee
> <sudipm.mukherjee@gmail.com> wrote:
> >
> > Hi Greg,
> >
> > On Wed, Nov 10, 2021 at 07:43:46PM +0100, Greg Kroah-Hartman wrote:
> > > This is the start of the stable review cycle for the 5.10.79 release.
> > > There are 21 patches in this series, all will be posted as a response
> > > to this one.  If anyone has any issues with these being applied, please
> > > let me know.
> > >
> > > Responses should be made by Fri, 12 Nov 2021 18:19:54 +0000.
> > > Anything received after that time might be too late.
> >
> > systemd-journal-flush.service failed due to a timeout resulting in a very very
> > slow boot on my test laptop. qemu test on openqa failed due to the same problem.
> >
> > https://openqa.qa.codethink.co.uk/tests/365
> >
> > A bisect showed the problem to be 8615ff6dd1ac ("mm: filemap: check if THP has
> > hwpoisoned subpage for PMD page fault"). Reverting it on top of 5.10.79-rc1
> > fixed the problem.
> > Incidentally, I was having similar problem with Linus's tree
> > for last few days and was failing since 20211106 (did not get the time to check).
> > I will test mainline again with this commit reverted.
> 
> I have also noticed this problem and Anders bisected and found this
> first bad commit.
> 
> Failed test log link,
> A start job is running for Journal Service (5s / 1min 27s)
> https://lkft.validation.linaro.org/scheduler/job/3901980#L2234
> 
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> 
> Bisect log:
> 
> # bad: [b85617a6291f710807d0cd078c230626dee60b16] Linux 5.10.79-rc1
> # good: [5040520482a594e92d4f69141229a6dd26173511] Linux 5.10.78
> git bisect start 'b85617a6291f710807d0cd078c230626dee60b16'
> '5040520482a594e92d4f69141229a6dd26173511'
> # bad: [7ceeda856035991a6c9804916987a03759745fb0] staging: rtl8712:
> fix use-after-free in rtl8712_dl_fw
> git bisect bad 7ceeda856035991a6c9804916987a03759745fb0
> # bad: [8615ff6dd1ac9e01b6fcf0fc0652353f79f524ed] mm: filemap: check
> if THP has hwpoisoned subpage for PMD page fault
> git bisect bad 8615ff6dd1ac9e01b6fcf0fc0652353f79f524ed
> # good: [e9cb6ce4690749d42013f1d56874c624d7241740] Revert "x86/kvm:
> fix vcpu-id indexed array sizes"
> git bisect good e9cb6ce4690749d42013f1d56874c624d7241740
> # good: [dc385dfc126d51d7a93db694f8e151afe60eb06a] mm: hwpoison:
> remove the unnecessary THP check
> git bisect good dc385dfc126d51d7a93db694f8e151afe60eb06a
> # first bad commit: [8615ff6dd1ac9e01b6fcf0fc0652353f79f524ed] mm:
> filemap: check if THP has hwpoisoned subpage for PMD page fault
> commit 8615ff6dd1ac9e01b6fcf0fc0652353f79f524ed
> Author: Yang Shi <shy828301@gmail.com>
> Date:   Thu Oct 28 14:36:11 2021 -0700
> 
>     mm: filemap: check if THP has hwpoisoned subpage for PMD page fault
> 
>     commit eac96c3efdb593df1a57bb5b95dbe037bfa9a522 upstream.
> 
>     When handling shmem page fault the THP with corrupted subpage could be
>     PMD mapped if certain conditions are satisfied.  But kernel is supposed
>     to send SIGBUS when trying to map hwpoisoned page.
> 
>     There are two paths which may do PMD map: fault around and regular
>     fault.
> 
>     Before commit f9ce0be71d1f ("mm: Cleanup faultaround and finish_fault()
>     codepaths") the thing was even worse in fault around path.  The THP
>     could be PMD mapped as long as the VMA fits regardless what subpage is
>     accessed and corrupted.  After this commit as long as head page is not
>     corrupted the THP could be PMD mapped.
> 
>     In the regular fault path the THP could be PMD mapped as long as the
>     corrupted page is not accessed and the VMA fits.
> 
>     This loophole could be fixed by iterating every subpage to check if any
>     of them is hwpoisoned or not, but it is somewhat costly in page fault
>     path.
> 
>     So introduce a new page flag called HasHWPoisoned on the first tail
>     page.  It indicates the THP has hwpoisoned subpage(s).  It is set if any
>     subpage of THP is found hwpoisoned by memory failure and after the
>     refcount is bumped successfully, then cleared when the THP is freed or
>     split.
> 
>     The soft offline path doesn't need this since soft offline handler just
>     marks a subpage hwpoisoned when the subpage is migrated successfully.
>     But shmem THP didn't get split then migrated at all.
> 
>     Link: https://lkml.kernel.org/r/20211020210755.23964-3-shy828301@gmail.com
>     Fixes: 800d8c63b2e9 ("shmem: add huge pages support")
>     Signed-off-by: Yang Shi <shy828301@gmail.com>
>     Reviewed-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
>     Suggested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
>     Cc: Hugh Dickins <hughd@google.com>
>     Cc: Matthew Wilcox <willy@infradead.org>
>     Cc: Oscar Salvador <osalvador@suse.de>
>     Cc: Peter Xu <peterx@redhat.com>
>     Cc: <stable@vger.kernel.org>
>     Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
>     Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
>     Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
>  include/linux/page-flags.h | 23 +++++++++++++++++++++++
>  mm/huge_memory.c           |  2 ++
>  mm/memory-failure.c        | 14 ++++++++++++++
>  mm/memory.c                |  9 +++++++++
>  mm/page_alloc.c            |  4 +++-
>  5 files changed, 51 insertions(+), 1 deletion(-)
> 

Thanks, I'm going to go drop this patch again.

This has been the second time we have tried to add it.  Yang, are you
_SURE_ it needs to be in the 5.10.y tree?  So far it's been nothing but
build and boot failures :(

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.79-rc1 review
  2021-11-13 13:19 Tim Lewis
@ 2021-11-13 13:36 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-13 13:36 UTC (permalink / raw)
  To: Tim Lewis
  Cc: Yang Shi, Naresh Kamboju, Sudip Mukherjee, f.fainelli, torvalds,
	open list, lkft-triage, patches, stable, pavel, akpm, jonathanh,
	shuah, linux, Naoya Horiguchi, Kirill A. Shutemov, Hugh Dickins,
	Matthew Wilcox, Oscar Salvador, Peter Xu

On Sat, Nov 13, 2021 at 08:19:12AM -0500, Tim Lewis wrote:
> > commit 8615ff6dd1ac9e01b6fcf0fc0652353f79f524ed
> > Author: Yang Shi <shy828301@gmail.com>
> > Date:   Thu Oct 28 14:36:11 2021 -0700
> >
> >     mm: filemap: check if THP has hwpoisoned subpage for PMD page fault
> >
> >     commit eac96c3efdb593df1a57bb5b95dbe037bfa9a522 upstream.
> 
> For the sake of testing,
> other than this breaking systemd-journal,
> postgresql is another service that would hang forever with 100% CPU,
> on arm64 (odroid-c4) using Ubuntu 20.04.

Thanks, this commit was dropped from this release.

greg k-h

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.79-rc1 review
@ 2021-11-13 13:19 Tim Lewis
  2021-11-13 13:36 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 37+ messages in thread
From: Tim Lewis @ 2021-11-13 13:19 UTC (permalink / raw)
  To: Yang Shi
  Cc: Greg Kroah-Hartman, Naresh Kamboju, Sudip Mukherjee, f.fainelli,
	torvalds, open list, lkft-triage, patches, stable, pavel, akpm,
	jonathanh, shuah, linux, Naoya Horiguchi, Kirill A. Shutemov,
	Hugh Dickins, Matthew Wilcox, Oscar Salvador, Peter Xu

> commit 8615ff6dd1ac9e01b6fcf0fc0652353f79f524ed
> Author: Yang Shi <shy828301@gmail.com>
> Date:   Thu Oct 28 14:36:11 2021 -0700
>
>     mm: filemap: check if THP has hwpoisoned subpage for PMD page fault
>
>     commit eac96c3efdb593df1a57bb5b95dbe037bfa9a522 upstream.

For the sake of testing,
other than this breaking systemd-journal,
postgresql is another service that would hang forever with 100% CPU,
on arm64 (odroid-c4) using Ubuntu 20.04.

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2021-11-13 13:36 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10 18:43 [PATCH 5.10 00/21] 5.10.79-rc1 review Greg Kroah-Hartman
2021-11-10 18:43 ` [PATCH 5.10 01/21] KVM: x86: avoid warning with -Wbitwise-instead-of-logical Greg Kroah-Hartman
2021-11-10 18:43 ` [PATCH 5.10 02/21] Revert "x86/kvm: fix vcpu-id indexed array sizes" Greg Kroah-Hartman
2021-11-10 18:43 ` [PATCH 5.10 03/21] usb: ehci: handshake CMD_RUN instead of STS_HALT Greg Kroah-Hartman
2021-11-10 18:43 ` [PATCH 5.10 04/21] mm: hwpoison: remove the unnecessary THP check Greg Kroah-Hartman
2021-11-10 18:43 ` [PATCH 5.10 05/21] mm: filemap: check if THP has hwpoisoned subpage for PMD page fault Greg Kroah-Hartman
2021-11-10 18:43 ` [PATCH 5.10 06/21] usb: gadget: Mark USB_FSL_QE broken on 64-bit Greg Kroah-Hartman
2021-11-10 18:43 ` [PATCH 5.10 07/21] usb: musb: Balance list entry in musb_gadget_queue Greg Kroah-Hartman
2021-11-10 18:43 ` [PATCH 5.10 08/21] usb-storage: Add compatibility quirk flags for iODD 2531/2541 Greg Kroah-Hartman
2021-11-10 18:43 ` [PATCH 5.10 09/21] binder: dont detect sender/target during buffer cleanup Greg Kroah-Hartman
2021-11-10 18:43 ` [PATCH 5.10 10/21] printk/console: Allow to disable console output by using console="" or console=null Greg Kroah-Hartman
2021-11-10 18:43 ` [PATCH 5.10 11/21] staging: rtl8712: fix use-after-free in rtl8712_dl_fw Greg Kroah-Hartman
2021-11-10 18:43 ` [PATCH 5.10 12/21] isofs: Fix out of bound access for corrupted isofs image Greg Kroah-Hartman
2021-11-10 18:43 ` [PATCH 5.10 13/21] comedi: dt9812: fix DMA buffers on stack Greg Kroah-Hartman
2021-11-10 18:44 ` [PATCH 5.10 14/21] comedi: ni_usb6501: fix NULL-deref in command paths Greg Kroah-Hartman
2021-11-10 18:44 ` [PATCH 5.10 15/21] comedi: vmk80xx: fix transfer-buffer overflows Greg Kroah-Hartman
2021-11-10 18:44 ` [PATCH 5.10 16/21] comedi: vmk80xx: fix bulk-buffer overflow Greg Kroah-Hartman
2021-11-10 18:44 ` [PATCH 5.10 17/21] comedi: vmk80xx: fix bulk and interrupt message timeouts Greg Kroah-Hartman
2021-11-10 18:44 ` [PATCH 5.10 18/21] staging: r8712u: fix control-message timeout Greg Kroah-Hartman
2021-11-10 18:44 ` [PATCH 5.10 19/21] staging: rtl8192u: fix control-message timeouts Greg Kroah-Hartman
2021-11-10 18:44 ` [PATCH 5.10 20/21] media: staging/intel-ipu3: css: Fix wrong size comparison imgu_css_fw_init Greg Kroah-Hartman
2021-11-10 18:44 ` [PATCH 5.10 21/21] rsi: fix control-message timeout Greg Kroah-Hartman
2021-11-10 20:09 ` [PATCH 5.10 00/21] 5.10.79-rc1 review Florian Fainelli
2021-11-10 21:42 ` Fox Chen
2021-11-11 13:01 ` Sudip Mukherjee
2021-11-11 14:54   ` Naresh Kamboju
2021-11-12 13:47     ` Greg Kroah-Hartman
2021-11-11 19:45   ` Sudip Mukherjee
2021-11-12 13:46     ` Greg Kroah-Hartman
2021-11-11 21:36   ` Shuah Khan
2021-11-12 13:46     ` Greg Kroah-Hartman
2021-11-11 16:20 ` Shuah Khan
2021-11-11 16:42 ` Pavel Machek
2021-11-12  1:15 ` Guenter Roeck
2021-11-12 13:45   ` Greg Kroah-Hartman
2021-11-13 13:19 Tim Lewis
2021-11-13 13:36 ` Greg Kroah-Hartman

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).